solace-agent-mesh 0.2.4__py3-none-any.whl → 1.0.1__py3-none-any.whl

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.

Potentially problematic release.


This version of solace-agent-mesh might be problematic. Click here for more details.

Files changed (518) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +93 -0
  2. solace_agent_mesh/agent/adk/app_llm_agent.py +26 -0
  3. solace_agent_mesh/agent/adk/callbacks.py +1694 -0
  4. solace_agent_mesh/agent/adk/filesystem_artifact_service.py +381 -0
  5. solace_agent_mesh/agent/adk/invocation_monitor.py +295 -0
  6. solace_agent_mesh/agent/adk/models/lite_llm.py +872 -0
  7. solace_agent_mesh/agent/adk/models/models_llm.txt +94 -0
  8. solace_agent_mesh/agent/adk/runner.py +353 -0
  9. solace_agent_mesh/agent/adk/services.py +240 -0
  10. solace_agent_mesh/agent/adk/setup.py +751 -0
  11. solace_agent_mesh/agent/adk/stream_parser.py +214 -0
  12. solace_agent_mesh/agent/adk/tool_wrapper.py +139 -0
  13. solace_agent_mesh/agent/agent_llm.txt +41 -0
  14. solace_agent_mesh/agent/protocol/event_handlers.py +1469 -0
  15. solace_agent_mesh/agent/protocol/protocol_llm.txt +21 -0
  16. solace_agent_mesh/agent/sac/app.py +640 -0
  17. solace_agent_mesh/agent/sac/component.py +3388 -0
  18. solace_agent_mesh/agent/sac/patch_adk.py +111 -0
  19. solace_agent_mesh/agent/sac/sac_llm.txt +105 -0
  20. solace_agent_mesh/agent/sac/task_execution_context.py +176 -0
  21. solace_agent_mesh/agent/testing/__init__.py +3 -0
  22. solace_agent_mesh/agent/testing/debug_utils.py +135 -0
  23. solace_agent_mesh/agent/testing/testing_llm.txt +90 -0
  24. solace_agent_mesh/agent/tools/__init__.py +14 -0
  25. solace_agent_mesh/agent/tools/audio_tools.py +1622 -0
  26. solace_agent_mesh/agent/tools/builtin_artifact_tools.py +1954 -0
  27. solace_agent_mesh/agent/tools/builtin_data_analysis_tools.py +238 -0
  28. solace_agent_mesh/agent/tools/general_agent_tools.py +569 -0
  29. solace_agent_mesh/agent/tools/image_tools.py +1184 -0
  30. solace_agent_mesh/agent/tools/peer_agent_tool.py +289 -0
  31. solace_agent_mesh/agent/tools/registry.py +36 -0
  32. solace_agent_mesh/agent/tools/test_tools.py +135 -0
  33. solace_agent_mesh/agent/tools/tool_definition.py +45 -0
  34. solace_agent_mesh/agent/tools/tools_llm.txt +104 -0
  35. solace_agent_mesh/agent/tools/web_tools.py +381 -0
  36. solace_agent_mesh/agent/utils/artifact_helpers.py +927 -0
  37. solace_agent_mesh/agent/utils/config_parser.py +47 -0
  38. solace_agent_mesh/agent/utils/context_helpers.py +60 -0
  39. solace_agent_mesh/agent/utils/utils_llm.txt +153 -0
  40. solace_agent_mesh/assets/docs/404.html +16 -0
  41. solace_agent_mesh/assets/docs/assets/css/styles.906a1503.css +1 -0
  42. solace_agent_mesh/assets/docs/assets/images/Solace_AI_Framework_With_Broker-85f0a306a9bcdd20b390b7a949f6d862.png +0 -0
  43. solace_agent_mesh/assets/docs/assets/images/sac-flows-80d5b603c6aafd33e87945680ce0abf3.png +0 -0
  44. solace_agent_mesh/assets/docs/assets/images/sac_parts_of_a_component-cb3d0424b1d0c17734c5435cca6b4082.png +0 -0
  45. solace_agent_mesh/assets/docs/assets/js/04989206.674a8007.js +1 -0
  46. solace_agent_mesh/assets/docs/assets/js/0e682baa.79f0ab22.js +1 -0
  47. solace_agent_mesh/assets/docs/assets/js/1001.0182a8bd.js +1 -0
  48. solace_agent_mesh/assets/docs/assets/js/1023fc19.015679ca.js +1 -0
  49. solace_agent_mesh/assets/docs/assets/js/1039.0bd46aa1.js +1 -0
  50. solace_agent_mesh/assets/docs/assets/js/149.b797a808.js +1 -0
  51. solace_agent_mesh/assets/docs/assets/js/1523c6b4.91c7bc01.js +1 -0
  52. solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js +2 -0
  53. solace_agent_mesh/assets/docs/assets/js/165.6a39807d.js.LICENSE.txt +9 -0
  54. solace_agent_mesh/assets/docs/assets/js/166ab619.7d97ccaf.js +1 -0
  55. solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js +2 -0
  56. solace_agent_mesh/assets/docs/assets/js/17896441.a5e82f9b.js.LICENSE.txt +7 -0
  57. solace_agent_mesh/assets/docs/assets/js/1c6e87d2.23bccffb.js +1 -0
  58. solace_agent_mesh/assets/docs/assets/js/2130.ab9fd314.js +1 -0
  59. solace_agent_mesh/assets/docs/assets/js/21ceee5f.614fa8dd.js +1 -0
  60. solace_agent_mesh/assets/docs/assets/js/2237.5e477fc6.js +1 -0
  61. solace_agent_mesh/assets/docs/assets/js/2334.622a6395.js +1 -0
  62. solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +1 -0
  63. solace_agent_mesh/assets/docs/assets/js/3219.adc1d663.js +1 -0
  64. solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +1 -0
  65. solace_agent_mesh/assets/docs/assets/js/3624.b524e433.js +1 -0
  66. solace_agent_mesh/assets/docs/assets/js/375.708d48db.js +1 -0
  67. solace_agent_mesh/assets/docs/assets/js/3834.b6cd790e.js +1 -0
  68. solace_agent_mesh/assets/docs/assets/js/3d406171.f722eaf5.js +1 -0
  69. solace_agent_mesh/assets/docs/assets/js/4250.95455b28.js +1 -0
  70. solace_agent_mesh/assets/docs/assets/js/42b3f8d8.36090198.js +1 -0
  71. solace_agent_mesh/assets/docs/assets/js/4356.d169ab5b.js +1 -0
  72. solace_agent_mesh/assets/docs/assets/js/442a8107.5ba94b65.js +1 -0
  73. solace_agent_mesh/assets/docs/assets/js/4458.518e66fa.js +1 -0
  74. solace_agent_mesh/assets/docs/assets/js/4488.c7cc3442.js +1 -0
  75. solace_agent_mesh/assets/docs/assets/js/4494.6ee23046.js +1 -0
  76. solace_agent_mesh/assets/docs/assets/js/4855.fc4444b6.js +1 -0
  77. solace_agent_mesh/assets/docs/assets/js/4866.22daefc0.js +1 -0
  78. solace_agent_mesh/assets/docs/assets/js/4950.ca4caeda.js +1 -0
  79. solace_agent_mesh/assets/docs/assets/js/4c2787c2.66ee00e9.js +1 -0
  80. solace_agent_mesh/assets/docs/assets/js/5388.7a136447.js +1 -0
  81. solace_agent_mesh/assets/docs/assets/js/55f47984.c484bf96.js +1 -0
  82. solace_agent_mesh/assets/docs/assets/js/5607.081356f8.js +1 -0
  83. solace_agent_mesh/assets/docs/assets/js/5864.b0d0e9de.js +1 -0
  84. solace_agent_mesh/assets/docs/assets/js/5b4258a4.bda20761.js +1 -0
  85. solace_agent_mesh/assets/docs/assets/js/5e95c892.558d5167.js +1 -0
  86. solace_agent_mesh/assets/docs/assets/js/6143.0a1464c9.js +1 -0
  87. solace_agent_mesh/assets/docs/assets/js/6395.e9c73649.js +1 -0
  88. solace_agent_mesh/assets/docs/assets/js/6796.51d2c9b7.js +1 -0
  89. solace_agent_mesh/assets/docs/assets/js/6976.379be23b.js +1 -0
  90. solace_agent_mesh/assets/docs/assets/js/6978.ee0b945c.js +1 -0
  91. solace_agent_mesh/assets/docs/assets/js/7040.cb436723.js +1 -0
  92. solace_agent_mesh/assets/docs/assets/js/7195.412f418a.js +1 -0
  93. solace_agent_mesh/assets/docs/assets/js/7280.3fb73bdb.js +1 -0
  94. solace_agent_mesh/assets/docs/assets/js/768e31b0.a12673db.js +1 -0
  95. solace_agent_mesh/assets/docs/assets/js/7845.e33e7c4c.js +1 -0
  96. solace_agent_mesh/assets/docs/assets/js/7900.69516146.js +1 -0
  97. solace_agent_mesh/assets/docs/assets/js/8356.8a379c04.js +1 -0
  98. solace_agent_mesh/assets/docs/assets/js/85387663.6bf41934.js +1 -0
  99. solace_agent_mesh/assets/docs/assets/js/8567.4732c6b7.js +1 -0
  100. solace_agent_mesh/assets/docs/assets/js/8573.cb04eda5.js +1 -0
  101. solace_agent_mesh/assets/docs/assets/js/8577.1d54e766.js +1 -0
  102. solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js +2 -0
  103. solace_agent_mesh/assets/docs/assets/js/8591.d7c16be6.js.LICENSE.txt +61 -0
  104. solace_agent_mesh/assets/docs/assets/js/8709.7ecd4047.js +1 -0
  105. solace_agent_mesh/assets/docs/assets/js/8731.49e930c2.js +1 -0
  106. solace_agent_mesh/assets/docs/assets/js/8908.f9d1b506.js +1 -0
  107. solace_agent_mesh/assets/docs/assets/js/9157.b4093d07.js +1 -0
  108. solace_agent_mesh/assets/docs/assets/js/9278.a4fd875d.js +1 -0
  109. solace_agent_mesh/assets/docs/assets/js/945fb41e.74d728aa.js +1 -0
  110. solace_agent_mesh/assets/docs/assets/js/9616.b75c2f6d.js +1 -0
  111. solace_agent_mesh/assets/docs/assets/js/9793.c6d16376.js +1 -0
  112. solace_agent_mesh/assets/docs/assets/js/9eff14a2.1bf8f61c.js +1 -0
  113. solace_agent_mesh/assets/docs/assets/js/a3a92b25.26ca071f.js +1 -0
  114. solace_agent_mesh/assets/docs/assets/js/a7bd4aaa.2204d2f7.js +1 -0
  115. solace_agent_mesh/assets/docs/assets/js/a94703ab.0438dbc2.js +1 -0
  116. solace_agent_mesh/assets/docs/assets/js/aba21aa0.c42a534c.js +1 -0
  117. solace_agent_mesh/assets/docs/assets/js/aba87c2f.d3e2dcc3.js +1 -0
  118. solace_agent_mesh/assets/docs/assets/js/ae4415af.8e279b5d.js +1 -0
  119. solace_agent_mesh/assets/docs/assets/js/b7006a3a.40b10c9d.js +1 -0
  120. solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +1 -0
  121. solace_agent_mesh/assets/docs/assets/js/bb2ef573.207e6990.js +1 -0
  122. solace_agent_mesh/assets/docs/assets/js/c2c06897.63b76e9e.js +1 -0
  123. solace_agent_mesh/assets/docs/assets/js/cc969b05.954186d4.js +1 -0
  124. solace_agent_mesh/assets/docs/assets/js/cd3d4052.ca6eed8c.js +1 -0
  125. solace_agent_mesh/assets/docs/assets/js/ced92a13.fb92e7ca.js +1 -0
  126. solace_agent_mesh/assets/docs/assets/js/cee5d587.f5b73ca1.js +1 -0
  127. solace_agent_mesh/assets/docs/assets/js/f284c35a.ecc3d195.js +1 -0
  128. solace_agent_mesh/assets/docs/assets/js/f897a61a.2c2e152c.js +1 -0
  129. solace_agent_mesh/assets/docs/assets/js/fbfa3e75.aca209c9.js +1 -0
  130. solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js +2 -0
  131. solace_agent_mesh/assets/docs/assets/js/main.7ed3319f.js.LICENSE.txt +81 -0
  132. solace_agent_mesh/assets/docs/assets/js/runtime~main.d9520ae2.js +1 -0
  133. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +128 -0
  134. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +91 -0
  135. solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +201 -0
  136. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +91 -0
  137. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +55 -0
  138. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +82 -0
  139. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +60 -0
  140. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +48 -0
  141. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +54 -0
  142. solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +17 -0
  143. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +45 -0
  144. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +76 -0
  145. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +150 -0
  146. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +54 -0
  147. solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +267 -0
  148. solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +136 -0
  149. solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +116 -0
  150. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +80 -0
  151. solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +164 -0
  152. solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +57 -0
  153. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +72 -0
  154. solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +102 -0
  155. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +99 -0
  156. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +90 -0
  157. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +107 -0
  158. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +152 -0
  159. solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +103 -0
  160. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +170 -0
  161. solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +200 -0
  162. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +54 -0
  163. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +69 -0
  164. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +59 -0
  165. solace_agent_mesh/assets/docs/img/Solace_AI_Framework_README.png +0 -0
  166. solace_agent_mesh/assets/docs/img/Solace_AI_Framework_With_Broker.png +0 -0
  167. solace_agent_mesh/assets/docs/img/logo.png +0 -0
  168. solace_agent_mesh/assets/docs/img/sac-flows.png +0 -0
  169. solace_agent_mesh/assets/docs/img/sac_parts_of_a_component.png +0 -0
  170. solace_agent_mesh/assets/docs/img/solace-logo.png +0 -0
  171. solace_agent_mesh/assets/docs/lunr-index-1753813536522.json +1 -0
  172. solace_agent_mesh/assets/docs/lunr-index.json +1 -0
  173. solace_agent_mesh/assets/docs/search-doc-1753813536522.json +1 -0
  174. solace_agent_mesh/assets/docs/search-doc.json +1 -0
  175. solace_agent_mesh/assets/docs/sitemap.xml +1 -0
  176. solace_agent_mesh/cli/__init__.py +1 -1
  177. solace_agent_mesh/cli/commands/add_cmd/__init__.py +15 -0
  178. solace_agent_mesh/cli/commands/add_cmd/add_cmd_llm.txt +250 -0
  179. solace_agent_mesh/cli/commands/add_cmd/agent_cmd.py +659 -0
  180. solace_agent_mesh/cli/commands/add_cmd/gateway_cmd.py +322 -0
  181. solace_agent_mesh/cli/commands/add_cmd/web_add_agent_step.py +93 -0
  182. solace_agent_mesh/cli/commands/add_cmd/web_add_gateway_step.py +118 -0
  183. solace_agent_mesh/cli/commands/docs_cmd.py +57 -0
  184. solace_agent_mesh/cli/commands/eval_cmd.py +64 -0
  185. solace_agent_mesh/cli/commands/init_cmd/__init__.py +404 -0
  186. solace_agent_mesh/cli/commands/init_cmd/broker_step.py +201 -0
  187. solace_agent_mesh/cli/commands/init_cmd/directory_step.py +28 -0
  188. solace_agent_mesh/cli/commands/init_cmd/env_step.py +197 -0
  189. solace_agent_mesh/cli/commands/init_cmd/init_cmd_llm.txt +365 -0
  190. solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +387 -0
  191. solace_agent_mesh/cli/commands/init_cmd/project_files_step.py +38 -0
  192. solace_agent_mesh/cli/commands/init_cmd/web_init_step.py +110 -0
  193. solace_agent_mesh/cli/commands/init_cmd/webui_gateway_step.py +183 -0
  194. solace_agent_mesh/cli/commands/plugin_cmd/__init__.py +18 -0
  195. solace_agent_mesh/cli/commands/plugin_cmd/add_cmd.py +372 -0
  196. solace_agent_mesh/cli/commands/plugin_cmd/build_cmd.py +86 -0
  197. solace_agent_mesh/cli/commands/plugin_cmd/catalog_cmd.py +138 -0
  198. solace_agent_mesh/cli/commands/plugin_cmd/create_cmd.py +309 -0
  199. solace_agent_mesh/cli/commands/plugin_cmd/official_registry.py +174 -0
  200. solace_agent_mesh/cli/commands/plugin_cmd/plugin_cmd_llm.txt +305 -0
  201. solace_agent_mesh/cli/commands/run_cmd.py +158 -0
  202. solace_agent_mesh/cli/main.py +17 -294
  203. solace_agent_mesh/cli/utils.py +135 -204
  204. solace_agent_mesh/client/webui/frontend/static/assets/authCallback-DvlO62me.js +1 -0
  205. solace_agent_mesh/client/webui/frontend/static/assets/client-bp6u3qVZ.js +49 -0
  206. solace_agent_mesh/client/webui/frontend/static/assets/favicon-BLgzUch9.ico +0 -0
  207. solace_agent_mesh/client/webui/frontend/static/assets/main-An0a5j5k.js +663 -0
  208. solace_agent_mesh/client/webui/frontend/static/assets/main-Bu5-4Bac.css +1 -0
  209. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +14 -0
  210. solace_agent_mesh/client/webui/frontend/static/index.html +15 -0
  211. solace_agent_mesh/common/__init__.py +1 -0
  212. solace_agent_mesh/common/a2a_protocol.py +564 -0
  213. solace_agent_mesh/common/agent_registry.py +42 -0
  214. solace_agent_mesh/common/client/__init__.py +4 -0
  215. solace_agent_mesh/common/client/card_resolver.py +21 -0
  216. solace_agent_mesh/common/client/client.py +85 -0
  217. solace_agent_mesh/common/client/client_llm.txt +133 -0
  218. solace_agent_mesh/common/common_llm.txt +144 -0
  219. solace_agent_mesh/common/constants.py +1 -14
  220. solace_agent_mesh/common/middleware/__init__.py +12 -0
  221. solace_agent_mesh/common/middleware/config_resolver.py +130 -0
  222. solace_agent_mesh/common/middleware/middleware_llm.txt +174 -0
  223. solace_agent_mesh/common/middleware/registry.py +125 -0
  224. solace_agent_mesh/common/server/__init__.py +4 -0
  225. solace_agent_mesh/common/server/server.py +122 -0
  226. solace_agent_mesh/common/server/server_llm.txt +169 -0
  227. solace_agent_mesh/common/server/task_manager.py +291 -0
  228. solace_agent_mesh/common/server/utils.py +28 -0
  229. solace_agent_mesh/common/services/__init__.py +4 -0
  230. solace_agent_mesh/common/services/employee_service.py +162 -0
  231. solace_agent_mesh/common/services/identity_service.py +129 -0
  232. solace_agent_mesh/common/services/providers/__init__.py +4 -0
  233. solace_agent_mesh/common/services/providers/local_file_identity_service.py +148 -0
  234. solace_agent_mesh/common/services/providers/providers_llm.txt +113 -0
  235. solace_agent_mesh/common/services/services_llm.txt +132 -0
  236. solace_agent_mesh/common/types.py +411 -0
  237. solace_agent_mesh/common/utils/__init__.py +7 -0
  238. solace_agent_mesh/common/utils/asyncio_macos_fix.py +86 -0
  239. solace_agent_mesh/common/utils/embeds/__init__.py +33 -0
  240. solace_agent_mesh/common/utils/embeds/constants.py +55 -0
  241. solace_agent_mesh/common/utils/embeds/converter.py +452 -0
  242. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +124 -0
  243. solace_agent_mesh/common/utils/embeds/evaluators.py +394 -0
  244. solace_agent_mesh/common/utils/embeds/modifiers.py +816 -0
  245. solace_agent_mesh/common/utils/embeds/resolver.py +865 -0
  246. solace_agent_mesh/common/utils/embeds/types.py +14 -0
  247. solace_agent_mesh/common/utils/in_memory_cache.py +108 -0
  248. solace_agent_mesh/common/utils/log_formatters.py +44 -0
  249. solace_agent_mesh/common/utils/mime_helpers.py +106 -0
  250. solace_agent_mesh/common/utils/push_notification_auth.py +134 -0
  251. solace_agent_mesh/common/utils/utils_llm.txt +67 -0
  252. solace_agent_mesh/config_portal/backend/common.py +66 -24
  253. solace_agent_mesh/config_portal/backend/plugin_catalog/constants.py +23 -0
  254. solace_agent_mesh/config_portal/backend/plugin_catalog/models.py +49 -0
  255. solace_agent_mesh/config_portal/backend/plugin_catalog/registry_manager.py +160 -0
  256. solace_agent_mesh/config_portal/backend/plugin_catalog/scraper.py +525 -0
  257. solace_agent_mesh/config_portal/backend/plugin_catalog_server.py +216 -0
  258. solace_agent_mesh/config_portal/backend/server.py +550 -181
  259. solace_agent_mesh/config_portal/frontend/static/client/assets/_index-DNxCwAGB.js +48 -0
  260. solace_agent_mesh/config_portal/frontend/static/client/assets/components-B7lKcHVY.js +140 -0
  261. solace_agent_mesh/config_portal/frontend/static/client/assets/{entry.client-DX1misIU.js → entry.client-CEumGClk.js} +3 -3
  262. solace_agent_mesh/config_portal/frontend/static/client/assets/index-DSo1AH_7.js +68 -0
  263. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-d2b54a97.js +1 -0
  264. solace_agent_mesh/config_portal/frontend/static/client/assets/{root-BApq5dPK.js → root-C4XmHinv.js} +2 -2
  265. solace_agent_mesh/config_portal/frontend/static/client/assets/root-DxRwaWiE.css +1 -0
  266. solace_agent_mesh/config_portal/frontend/static/client/index.html +3 -3
  267. solace_agent_mesh/core_a2a/__init__.py +1 -0
  268. solace_agent_mesh/core_a2a/core_a2a_llm.txt +88 -0
  269. solace_agent_mesh/core_a2a/service.py +331 -0
  270. solace_agent_mesh/evaluation/config_loader.py +657 -0
  271. solace_agent_mesh/evaluation/evaluator.py +667 -0
  272. solace_agent_mesh/evaluation/message_organizer.py +568 -0
  273. solace_agent_mesh/evaluation/report/benchmark_info.html +35 -0
  274. solace_agent_mesh/evaluation/report/chart_section.html +141 -0
  275. solace_agent_mesh/evaluation/report/detailed_breakdown.html +28 -0
  276. solace_agent_mesh/evaluation/report/modal.html +59 -0
  277. solace_agent_mesh/evaluation/report/modal_chart_functions.js +411 -0
  278. solace_agent_mesh/evaluation/report/modal_script.js +296 -0
  279. solace_agent_mesh/evaluation/report/modal_styles.css +340 -0
  280. solace_agent_mesh/evaluation/report/performance_metrics_styles.css +93 -0
  281. solace_agent_mesh/evaluation/report/templates/footer.html +2 -0
  282. solace_agent_mesh/evaluation/report/templates/header.html +340 -0
  283. solace_agent_mesh/evaluation/report_data_processor.py +972 -0
  284. solace_agent_mesh/evaluation/report_generator.py +613 -0
  285. solace_agent_mesh/evaluation/run.py +613 -0
  286. solace_agent_mesh/evaluation/subscriber.py +872 -0
  287. solace_agent_mesh/evaluation/summary_builder.py +775 -0
  288. solace_agent_mesh/evaluation/test_case_loader.py +714 -0
  289. solace_agent_mesh/gateway/base/__init__.py +1 -0
  290. solace_agent_mesh/gateway/base/app.py +266 -0
  291. solace_agent_mesh/gateway/base/base_llm.txt +119 -0
  292. solace_agent_mesh/gateway/base/component.py +1542 -0
  293. solace_agent_mesh/gateway/base/task_context.py +74 -0
  294. solace_agent_mesh/gateway/gateway_llm.txt +125 -0
  295. solace_agent_mesh/gateway/http_sse/app.py +190 -0
  296. solace_agent_mesh/gateway/http_sse/component.py +1602 -0
  297. solace_agent_mesh/gateway/http_sse/components/__init__.py +7 -0
  298. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +65 -0
  299. solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +108 -0
  300. solace_agent_mesh/gateway/http_sse/dependencies.py +316 -0
  301. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +63 -0
  302. solace_agent_mesh/gateway/http_sse/main.py +442 -0
  303. solace_agent_mesh/gateway/http_sse/routers/__init__.py +4 -0
  304. solace_agent_mesh/gateway/http_sse/routers/agents.py +41 -0
  305. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +821 -0
  306. solace_agent_mesh/gateway/http_sse/routers/auth.py +212 -0
  307. solace_agent_mesh/gateway/http_sse/routers/config.py +55 -0
  308. solace_agent_mesh/gateway/http_sse/routers/people.py +69 -0
  309. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +37 -0
  310. solace_agent_mesh/gateway/http_sse/routers/sessions.py +80 -0
  311. solace_agent_mesh/gateway/http_sse/routers/sse.py +138 -0
  312. solace_agent_mesh/gateway/http_sse/routers/tasks.py +294 -0
  313. solace_agent_mesh/gateway/http_sse/routers/users.py +59 -0
  314. solace_agent_mesh/gateway/http_sse/routers/visualization.py +1131 -0
  315. solace_agent_mesh/gateway/http_sse/services/__init__.py +4 -0
  316. solace_agent_mesh/gateway/http_sse/services/agent_service.py +69 -0
  317. solace_agent_mesh/gateway/http_sse/services/people_service.py +158 -0
  318. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +179 -0
  319. solace_agent_mesh/gateway/http_sse/services/task_service.py +121 -0
  320. solace_agent_mesh/gateway/http_sse/session_manager.py +187 -0
  321. solace_agent_mesh/gateway/http_sse/sse_manager.py +328 -0
  322. solace_agent_mesh/llm.txt +228 -0
  323. solace_agent_mesh/llm_detail.txt +2835 -0
  324. solace_agent_mesh/templates/agent_template.yaml +53 -0
  325. solace_agent_mesh/templates/eval_backend_template.yaml +54 -0
  326. solace_agent_mesh/templates/gateway_app_template.py +73 -0
  327. solace_agent_mesh/templates/gateway_component_template.py +400 -0
  328. solace_agent_mesh/templates/gateway_config_template.yaml +43 -0
  329. solace_agent_mesh/templates/main_orchestrator.yaml +55 -0
  330. solace_agent_mesh/templates/plugin_agent_config_template.yaml +122 -0
  331. solace_agent_mesh/templates/plugin_custom_config_template.yaml +27 -0
  332. solace_agent_mesh/templates/plugin_custom_template.py +10 -0
  333. solace_agent_mesh/templates/plugin_gateway_config_template.yaml +63 -0
  334. solace_agent_mesh/templates/plugin_pyproject_template.toml +33 -0
  335. solace_agent_mesh/templates/plugin_readme_template.md +34 -0
  336. solace_agent_mesh/templates/plugin_tools_template.py +224 -0
  337. solace_agent_mesh/templates/shared_config.yaml +66 -0
  338. solace_agent_mesh/templates/templates_llm.txt +147 -0
  339. solace_agent_mesh/templates/webui.yaml +53 -0
  340. solace_agent_mesh-1.0.1.dist-info/METADATA +432 -0
  341. solace_agent_mesh-1.0.1.dist-info/RECORD +359 -0
  342. solace_agent_mesh-1.0.1.dist-info/entry_points.txt +3 -0
  343. {solace_agent_mesh-0.2.4.dist-info → solace_agent_mesh-1.0.1.dist-info}/licenses/LICENSE +1 -1
  344. solace_agent_mesh/agents/base_agent_component.py +0 -256
  345. solace_agent_mesh/agents/global/actions/agent_state_change.py +0 -54
  346. solace_agent_mesh/agents/global/actions/clear_history.py +0 -32
  347. solace_agent_mesh/agents/global/actions/convert_file_to_markdown.py +0 -160
  348. solace_agent_mesh/agents/global/actions/create_file.py +0 -70
  349. solace_agent_mesh/agents/global/actions/error_action.py +0 -45
  350. solace_agent_mesh/agents/global/actions/plantuml_diagram.py +0 -163
  351. solace_agent_mesh/agents/global/actions/plotly_graph.py +0 -152
  352. solace_agent_mesh/agents/global/actions/retrieve_file.py +0 -51
  353. solace_agent_mesh/agents/global/global_agent_component.py +0 -38
  354. solace_agent_mesh/agents/image_processing/actions/create_image.py +0 -75
  355. solace_agent_mesh/agents/image_processing/actions/describe_image.py +0 -115
  356. solace_agent_mesh/agents/image_processing/image_processing_agent_component.py +0 -23
  357. solace_agent_mesh/agents/slack/__init__.py +0 -1
  358. solace_agent_mesh/agents/slack/actions/__init__.py +0 -1
  359. solace_agent_mesh/agents/slack/actions/post_message.py +0 -177
  360. solace_agent_mesh/agents/slack/slack_agent_component.py +0 -59
  361. solace_agent_mesh/agents/web_request/actions/do_image_search.py +0 -84
  362. solace_agent_mesh/agents/web_request/actions/do_news_search.py +0 -47
  363. solace_agent_mesh/agents/web_request/actions/do_suggestion_search.py +0 -34
  364. solace_agent_mesh/agents/web_request/actions/do_web_request.py +0 -135
  365. solace_agent_mesh/agents/web_request/actions/download_file.py +0 -69
  366. solace_agent_mesh/agents/web_request/web_request_agent_component.py +0 -33
  367. solace_agent_mesh/assets/web-visualizer/assets/index-D0qORgkg.css +0 -1
  368. solace_agent_mesh/assets/web-visualizer/assets/index-DnDr1pnu.js +0 -109
  369. solace_agent_mesh/assets/web-visualizer/index.html +0 -14
  370. solace_agent_mesh/assets/web-visualizer/vite.svg +0 -1
  371. solace_agent_mesh/cli/commands/add/__init__.py +0 -3
  372. solace_agent_mesh/cli/commands/add/add.py +0 -88
  373. solace_agent_mesh/cli/commands/add/agent.py +0 -110
  374. solace_agent_mesh/cli/commands/add/copy_from_plugin.py +0 -92
  375. solace_agent_mesh/cli/commands/add/gateway.py +0 -374
  376. solace_agent_mesh/cli/commands/build.py +0 -670
  377. solace_agent_mesh/cli/commands/chat/__init__.py +0 -3
  378. solace_agent_mesh/cli/commands/chat/chat.py +0 -361
  379. solace_agent_mesh/cli/commands/config.py +0 -29
  380. solace_agent_mesh/cli/commands/init/__init__.py +0 -3
  381. solace_agent_mesh/cli/commands/init/ai_provider_step.py +0 -93
  382. solace_agent_mesh/cli/commands/init/broker_step.py +0 -99
  383. solace_agent_mesh/cli/commands/init/builtin_agent_step.py +0 -83
  384. solace_agent_mesh/cli/commands/init/check_if_already_done.py +0 -13
  385. solace_agent_mesh/cli/commands/init/create_config_file_step.py +0 -65
  386. solace_agent_mesh/cli/commands/init/create_other_project_files_step.py +0 -147
  387. solace_agent_mesh/cli/commands/init/file_service_step.py +0 -73
  388. solace_agent_mesh/cli/commands/init/init.py +0 -92
  389. solace_agent_mesh/cli/commands/init/project_structure_step.py +0 -16
  390. solace_agent_mesh/cli/commands/init/web_init_step.py +0 -32
  391. solace_agent_mesh/cli/commands/plugin/__init__.py +0 -3
  392. solace_agent_mesh/cli/commands/plugin/add.py +0 -100
  393. solace_agent_mesh/cli/commands/plugin/build.py +0 -268
  394. solace_agent_mesh/cli/commands/plugin/create.py +0 -117
  395. solace_agent_mesh/cli/commands/plugin/plugin.py +0 -124
  396. solace_agent_mesh/cli/commands/plugin/remove.py +0 -73
  397. solace_agent_mesh/cli/commands/run.py +0 -68
  398. solace_agent_mesh/cli/commands/visualizer.py +0 -138
  399. solace_agent_mesh/cli/config.py +0 -85
  400. solace_agent_mesh/common/action.py +0 -91
  401. solace_agent_mesh/common/action_list.py +0 -37
  402. solace_agent_mesh/common/action_response.py +0 -340
  403. solace_agent_mesh/common/mysql_database.py +0 -40
  404. solace_agent_mesh/common/postgres_database.py +0 -85
  405. solace_agent_mesh/common/prompt_templates.py +0 -28
  406. solace_agent_mesh/common/stimulus_utils.py +0 -152
  407. solace_agent_mesh/common/time.py +0 -24
  408. solace_agent_mesh/common/utils.py +0 -712
  409. solace_agent_mesh/config_portal/frontend/static/client/assets/_index-a-zJ6rLx.js +0 -46
  410. solace_agent_mesh/config_portal/frontend/static/client/assets/components-ZIfdTbrV.js +0 -191
  411. solace_agent_mesh/config_portal/frontend/static/client/assets/index-BJHAE5s4.js +0 -17
  412. solace_agent_mesh/config_portal/frontend/static/client/assets/manifest-44c41103.js +0 -1
  413. solace_agent_mesh/config_portal/frontend/static/client/assets/root-DX4gQ516.css +0 -1
  414. solace_agent_mesh/configs/agent_global.yaml +0 -74
  415. solace_agent_mesh/configs/agent_image_processing.yaml +0 -82
  416. solace_agent_mesh/configs/agent_slack.yaml +0 -64
  417. solace_agent_mesh/configs/agent_web_request.yaml +0 -75
  418. solace_agent_mesh/configs/conversation_to_file.yaml +0 -56
  419. solace_agent_mesh/configs/error_catcher.yaml +0 -56
  420. solace_agent_mesh/configs/monitor.yaml +0 -0
  421. solace_agent_mesh/configs/monitor_stim_and_errors_to_slack.yaml +0 -109
  422. solace_agent_mesh/configs/monitor_user_feedback.yaml +0 -58
  423. solace_agent_mesh/configs/orchestrator.yaml +0 -241
  424. solace_agent_mesh/configs/service_embedding.yaml +0 -81
  425. solace_agent_mesh/configs/service_llm.yaml +0 -265
  426. solace_agent_mesh/configs/visualize_websocket.yaml +0 -55
  427. solace_agent_mesh/gateway/components/gateway_base.py +0 -47
  428. solace_agent_mesh/gateway/components/gateway_input.py +0 -278
  429. solace_agent_mesh/gateway/components/gateway_output.py +0 -298
  430. solace_agent_mesh/gateway/identity/bamboohr_identity.py +0 -18
  431. solace_agent_mesh/gateway/identity/identity_base.py +0 -10
  432. solace_agent_mesh/gateway/identity/identity_provider.py +0 -60
  433. solace_agent_mesh/gateway/identity/no_identity.py +0 -9
  434. solace_agent_mesh/gateway/identity/passthru_identity.py +0 -9
  435. solace_agent_mesh/monitors/base_monitor_component.py +0 -26
  436. solace_agent_mesh/monitors/feedback/user_feedback_monitor.py +0 -75
  437. solace_agent_mesh/monitors/stim_and_errors/stim_and_error_monitor.py +0 -560
  438. solace_agent_mesh/orchestrator/__init__.py +0 -0
  439. solace_agent_mesh/orchestrator/action_manager.py +0 -237
  440. solace_agent_mesh/orchestrator/components/__init__.py +0 -0
  441. solace_agent_mesh/orchestrator/components/orchestrator_action_manager_timeout_component.py +0 -58
  442. solace_agent_mesh/orchestrator/components/orchestrator_action_response_component.py +0 -179
  443. solace_agent_mesh/orchestrator/components/orchestrator_register_component.py +0 -107
  444. solace_agent_mesh/orchestrator/components/orchestrator_stimulus_processor_component.py +0 -527
  445. solace_agent_mesh/orchestrator/components/orchestrator_streaming_output_component.py +0 -260
  446. solace_agent_mesh/orchestrator/orchestrator_main.py +0 -172
  447. solace_agent_mesh/orchestrator/orchestrator_prompt.py +0 -539
  448. solace_agent_mesh/services/__init__.py +0 -0
  449. solace_agent_mesh/services/authorization/providers/base_authorization_provider.py +0 -56
  450. solace_agent_mesh/services/bamboo_hr_service/__init__.py +0 -3
  451. solace_agent_mesh/services/bamboo_hr_service/bamboo_hr.py +0 -182
  452. solace_agent_mesh/services/common/__init__.py +0 -4
  453. solace_agent_mesh/services/common/auto_expiry.py +0 -45
  454. solace_agent_mesh/services/common/singleton.py +0 -18
  455. solace_agent_mesh/services/file_service/__init__.py +0 -14
  456. solace_agent_mesh/services/file_service/file_manager/__init__.py +0 -0
  457. solace_agent_mesh/services/file_service/file_manager/bucket_file_manager.py +0 -149
  458. solace_agent_mesh/services/file_service/file_manager/file_manager_base.py +0 -162
  459. solace_agent_mesh/services/file_service/file_manager/memory_file_manager.py +0 -64
  460. solace_agent_mesh/services/file_service/file_manager/volume_file_manager.py +0 -106
  461. solace_agent_mesh/services/file_service/file_service.py +0 -437
  462. solace_agent_mesh/services/file_service/file_service_constants.py +0 -54
  463. solace_agent_mesh/services/file_service/file_transformations.py +0 -141
  464. solace_agent_mesh/services/file_service/file_utils.py +0 -324
  465. solace_agent_mesh/services/file_service/transformers/__init__.py +0 -5
  466. solace_agent_mesh/services/history_service/__init__.py +0 -3
  467. solace_agent_mesh/services/history_service/history_providers/__init__.py +0 -0
  468. solace_agent_mesh/services/history_service/history_providers/base_history_provider.py +0 -54
  469. solace_agent_mesh/services/history_service/history_providers/file_history_provider.py +0 -74
  470. solace_agent_mesh/services/history_service/history_providers/index.py +0 -40
  471. solace_agent_mesh/services/history_service/history_providers/memory_history_provider.py +0 -33
  472. solace_agent_mesh/services/history_service/history_providers/mongodb_history_provider.py +0 -66
  473. solace_agent_mesh/services/history_service/history_providers/redis_history_provider.py +0 -66
  474. solace_agent_mesh/services/history_service/history_providers/sql_history_provider.py +0 -93
  475. solace_agent_mesh/services/history_service/history_service.py +0 -413
  476. solace_agent_mesh/services/history_service/long_term_memory/__init__.py +0 -0
  477. solace_agent_mesh/services/history_service/long_term_memory/long_term_memory.py +0 -399
  478. solace_agent_mesh/services/llm_service/components/llm_request_component.py +0 -340
  479. solace_agent_mesh/services/llm_service/components/llm_service_component_base.py +0 -152
  480. solace_agent_mesh/services/middleware_service/__init__.py +0 -0
  481. solace_agent_mesh/services/middleware_service/middleware_service.py +0 -20
  482. solace_agent_mesh/templates/action.py +0 -38
  483. solace_agent_mesh/templates/agent.py +0 -29
  484. solace_agent_mesh/templates/agent.yaml +0 -70
  485. solace_agent_mesh/templates/gateway-config-template.yaml +0 -6
  486. solace_agent_mesh/templates/gateway-default-config.yaml +0 -28
  487. solace_agent_mesh/templates/gateway-flows.yaml +0 -78
  488. solace_agent_mesh/templates/gateway-header.yaml +0 -16
  489. solace_agent_mesh/templates/gateway_base.py +0 -15
  490. solace_agent_mesh/templates/gateway_input.py +0 -98
  491. solace_agent_mesh/templates/gateway_output.py +0 -71
  492. solace_agent_mesh/templates/plugin-gateway-default-config.yaml +0 -29
  493. solace_agent_mesh/templates/plugin-pyproject.toml +0 -30
  494. solace_agent_mesh/templates/rest-api-default-config.yaml +0 -31
  495. solace_agent_mesh/templates/rest-api-flows.yaml +0 -81
  496. solace_agent_mesh/templates/slack-default-config.yaml +0 -16
  497. solace_agent_mesh/templates/slack-flows.yaml +0 -81
  498. solace_agent_mesh/templates/solace-agent-mesh-default.yaml +0 -86
  499. solace_agent_mesh/templates/solace-agent-mesh-plugin-default.yaml +0 -8
  500. solace_agent_mesh/templates/web-default-config.yaml +0 -10
  501. solace_agent_mesh/templates/web-flows.yaml +0 -76
  502. solace_agent_mesh/tools/__init__.py +0 -0
  503. solace_agent_mesh/tools/components/__init__.py +0 -0
  504. solace_agent_mesh/tools/components/conversation_formatter.py +0 -111
  505. solace_agent_mesh/tools/components/file_resolver_component.py +0 -58
  506. solace_agent_mesh/tools/config/runtime_config.py +0 -26
  507. solace_agent_mesh-0.2.4.dist-info/METADATA +0 -176
  508. solace_agent_mesh-0.2.4.dist-info/RECORD +0 -193
  509. solace_agent_mesh-0.2.4.dist-info/entry_points.txt +0 -3
  510. /solace_agent_mesh/{agents → agent}/__init__.py +0 -0
  511. /solace_agent_mesh/{agents/global → agent/adk}/__init__.py +0 -0
  512. /solace_agent_mesh/{agents/global/actions → agent/protocol}/__init__.py +0 -0
  513. /solace_agent_mesh/{agents/image_processing → agent/sac}/__init__.py +0 -0
  514. /solace_agent_mesh/{agents/image_processing/actions → agent/utils}/__init__.py +0 -0
  515. /solace_agent_mesh/{agents/web_request → config_portal/backend/plugin_catalog}/__init__.py +0 -0
  516. /solace_agent_mesh/{agents/web_request/actions → evaluation}/__init__.py +0 -0
  517. /solace_agent_mesh/gateway/{components → http_sse}/__init__.py +0 -0
  518. {solace_agent_mesh-0.2.4.dist-info → solace_agent_mesh-1.0.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,663 @@
1
+ var Lw=Object.defineProperty;var $w=(e,t,n)=>t in e?Lw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ut=(e,t,n)=>$w(e,typeof t!="symbol"?t+"":t,n);import{r as m,j as d,a as Fw,g as Xc,R as Zc,b as Ea,c as Pt,d as zw}from"./client-bp6u3qVZ.js";function xd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rh(...e){return t=>{let n=!1;const r=e.map(o=>{const i=xd(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():xd(e[o],null)}}}}function pt(...e){return m.useCallback(Rh(...e),e)}function $r(e){const t=Bw(e),n=m.forwardRef((r,o)=>{const{children:i,...s}=r,a=m.Children.toArray(i),l=a.find(Vw);if(l){const c=l.props.children,u=a.map(f=>f===l?m.Children.count(c)>1?m.Children.only(null):m.isValidElement(c)?c.props.children:null:f);return d.jsx(t,{...s,ref:o,children:m.isValidElement(c)?m.cloneElement(c,void 0,u):null})}return d.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var Mh=$r("Slot");function Bw(e){const t=m.forwardRef((n,r)=>{const{children:o,...i}=n;if(m.isValidElement(o)){const s=Ww(o),a=Uw(i,o.props);return o.type!==m.Fragment&&(a.ref=r?Rh(r,s):s),m.cloneElement(o,a)}return m.Children.count(o)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ph=Symbol("radix.slottable");function Hw(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Ph,t}function Vw(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ph}function Uw(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const l=i(...a);return o(...a),l}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function Ww(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Dh(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Dh(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Oh(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Dh(e))&&(r&&(r+=" "),r+=t);return r}const yd=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vd=Oh,yr=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return vd(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(c=>{const u=n==null?void 0:n[c],f=i==null?void 0:i[c];if(u===null)return null;const p=yd(u)||yd(f);return o[c][p]}),a=n&&Object.entries(n).reduce((c,u)=>{let[f,p]=u;return p===void 0||(c[f]=p),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:p,...h}=u;return Object.entries(h).every(x=>{let[g,y]=x;return Array.isArray(y)?y.includes({...i,...a}[g]):{...i,...a}[g]===y})?[...c,f,p]:c},[]);return vd(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},Qc=()=>localStorage.getItem("access_token"),Gw=()=>localStorage.getItem("refresh_token"),Yw=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},qw=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},Kw=async()=>{const e=Gw();if(!e)return null;const t=await fetch("/api/v1/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})});if(t.ok){const n=await t.json();return Yw(n.access_token,n.refresh_token),n.access_token}return qw(),window.location.href="/api/v1/auth/login",null},_t=async(e,t={})=>{const n=Qc();if(!n)return fetch(e,t);const r=await fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${n}`}});if(r.status===401){const o=await Kw();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},Jc="-",Xw=e=>{const t=Qw(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(Jc);return a[0]===""&&a.length!==1&&a.shift(),Lh(a,t)||Zw(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},Lh=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Lh(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Jc);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},wd=/^\[(.+)\]$/,Zw=e=>{if(wd.test(e)){const t=wd.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Qw=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Jl(n[o],r,o,t);return r},Jl=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:bd(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(Jw(o)){Jl(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{Jl(s,bd(t,i),n,r)})})},bd=(e,t)=>{let n=e;return t.split(Jc).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Jw=e=>e.isThemeGetter,eb=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},ec="!",tc=":",tb=tc.length,nb=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let s=0,a=0,l=0,c;for(let x=0;x<o.length;x++){let g=o[x];if(s===0&&a===0){if(g===tc){i.push(o.slice(l,x)),l=x+tb;continue}if(g==="/"){c=x;continue}}g==="["?s++:g==="]"?s--:g==="("?a++:g===")"&&a--}const u=i.length===0?o:o.substring(l),f=rb(u),p=f!==u,h=c&&c>l?c-l:void 0;return{modifiers:i,hasImportantModifier:p,baseClassName:f,maybePostfixModifierPosition:h}};if(t){const o=t+tc,i=r;r=s=>s.startsWith(o)?i(s.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:s,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},rb=e=>e.endsWith(ec)?e.substring(0,e.length-1):e.startsWith(ec)?e.substring(1):e,ob=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let i=[];return r.forEach(s=>{s[0]==="["||t[s]?(o.push(...i.sort(),s),i=[]):i.push(s)}),o.push(...i.sort()),o}},ib=e=>({cache:eb(e.cacheSize),parseClassName:nb(e),sortModifiers:ob(e),...Xw(e)}),sb=/\s+/,ab=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(sb);let l="";for(let c=a.length-1;c>=0;c-=1){const u=a[c],{isExternal:f,modifiers:p,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}=n(u);if(f){l=u+(l.length>0?" "+l:l);continue}let y=!!g,v=r(y?x.substring(0,g):x);if(!v){if(!y){l=u+(l.length>0?" "+l:l);continue}if(v=r(x),!v){l=u+(l.length>0?" "+l:l);continue}y=!1}const b=i(p).join(":"),w=h?b+ec:b,S=w+v;if(s.includes(S))continue;s.push(S);const E=o(v,y);for(let C=0;C<E.length;++C){const k=E[C];s.push(w+k)}l=u+(l.length>0?" "+l:l)}return l};function lb(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=$h(t))&&(r&&(r+=" "),r+=n);return r}const $h=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=$h(e[r]))&&(n&&(n+=" "),n+=t);return n};function cb(e,...t){let n,r,o,i=s;function s(l){const c=t.reduce((u,f)=>f(u),e());return n=ib(c),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=ab(l,n);return o(l,u),u}return function(){return i(lb.apply(null,arguments))}}const jt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},Fh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ub=/^\d+\/\d+$/,db=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,pb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,hb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,eo=e=>ub.test(e),Be=e=>!!e&&!Number.isNaN(Number(e)),rr=e=>!!e&&Number.isInteger(Number(e)),al=e=>e.endsWith("%")&&Be(e.slice(0,-1)),Fn=e=>db.test(e),gb=()=>!0,xb=e=>fb.test(e)&&!pb.test(e),Bh=()=>!1,yb=e=>hb.test(e),vb=e=>mb.test(e),wb=e=>!ve(e)&&!we(e),bb=e=>Vo(e,Uh,Bh),ve=e=>Fh.test(e),Sr=e=>Vo(e,Wh,xb),ll=e=>Vo(e,_b,Be),Ed=e=>Vo(e,Hh,Bh),Eb=e=>Vo(e,Vh,vb),ss=e=>Vo(e,Gh,yb),we=e=>zh.test(e),Qo=e=>Uo(e,Wh),Sb=e=>Uo(e,Tb),Sd=e=>Uo(e,Hh),kb=e=>Uo(e,Uh),Cb=e=>Uo(e,Vh),as=e=>Uo(e,Gh,!0),Vo=(e,t,n)=>{const r=Fh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Uo=(e,t,n=!1)=>{const r=zh.exec(e);return r?r[1]?t(r[1]):n:!1},Hh=e=>e==="position"||e==="percentage",Vh=e=>e==="image"||e==="url",Uh=e=>e==="length"||e==="size"||e==="bg-size",Wh=e=>e==="length",_b=e=>e==="number",Tb=e=>e==="family-name",Gh=e=>e==="shadow",Ab=()=>{const e=jt("color"),t=jt("font"),n=jt("text"),r=jt("font-weight"),o=jt("tracking"),i=jt("leading"),s=jt("breakpoint"),a=jt("container"),l=jt("spacing"),c=jt("radius"),u=jt("shadow"),f=jt("inset-shadow"),p=jt("text-shadow"),h=jt("drop-shadow"),x=jt("blur"),g=jt("perspective"),y=jt("aspect"),v=jt("ease"),b=jt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),we,ve],C=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],T=()=>[we,ve,l],P=()=>[eo,"full","auto",...T()],z=()=>[rr,"none","subgrid",we,ve],D=()=>["auto",{span:["full",rr,we,ve]},rr,we,ve],$=()=>[rr,"auto",we,ve],M=()=>["auto","min","max","fr",we,ve],_=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],N=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...T()],I=()=>[eo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],j=()=>[e,we,ve],R=()=>[...S(),Sd,Ed,{position:[we,ve]}],O=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",kb,bb,{size:[we,ve]}],Y=()=>[al,Qo,Sr],H=()=>["","none","full",c,we,ve],V=()=>["",Be,Qo,Sr],U=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>[Be,al,Sd,Ed],W=()=>["","none",x,we,ve],Z=()=>["none",Be,we,ve],ie=()=>["none",Be,we,ve],se=()=>[Be,we,ve],K=()=>[eo,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Fn],breakpoint:[Fn],color:[gb],container:[Fn],"drop-shadow":[Fn],ease:["in","out","in-out"],font:[wb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Fn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Fn],shadow:[Fn],spacing:["px",Be],text:[Fn],"text-shadow":[Fn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",eo,ve,we,y]}],container:["container"],columns:[{columns:[Be,ve,we,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:P()}],"inset-x":[{"inset-x":P()}],"inset-y":[{"inset-y":P()}],start:[{start:P()}],end:[{end:P()}],top:[{top:P()}],right:[{right:P()}],bottom:[{bottom:P()}],left:[{left:P()}],visibility:["visible","invisible","collapse"],z:[{z:[rr,"auto",we,ve]}],basis:[{basis:[eo,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Be,eo,"auto","initial","none",ve]}],grow:[{grow:["",Be,we,ve]}],shrink:[{shrink:["",Be,we,ve]}],order:[{order:[rr,"first","last","none",we,ve]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[..._(),"normal"]}],"justify-items":[{"justify-items":[...N(),"normal"]}],"justify-self":[{"justify-self":["auto",...N()]}],"align-content":[{content:["normal",..._()]}],"align-items":[{items:[...N(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...N(),{baseline:["","last"]}]}],"place-content":[{"place-content":_()}],"place-items":[{"place-items":[...N(),"baseline"]}],"place-self":[{"place-self":["auto",...N()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],w:[{w:[a,"screen",...I()]}],"min-w":[{"min-w":[a,"screen","none",...I()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Qo,Sr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,we,ll]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",al,ve]}],"font-family":[{font:[Sb,ve,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,we,ve]}],"line-clamp":[{"line-clamp":[Be,"none",we,ll]}],leading:[{leading:[i,...T()]}],"list-image":[{"list-image":["none",we,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:[Be,"from-font","auto",we,Sr]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[Be,"auto",we,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:O()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},rr,we,ve],radial:["",we,ve],conic:[rr,we,ve]},Cb,Eb]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:Y()}],"gradient-via-pos":[{via:Y()}],"gradient-to-pos":[{to:Y()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:V()}],"border-w-x":[{"border-x":V()}],"border-w-y":[{"border-y":V()}],"border-w-s":[{"border-s":V()}],"border-w-e":[{"border-e":V()}],"border-w-t":[{"border-t":V()}],"border-w-r":[{"border-r":V()}],"border-w-b":[{"border-b":V()}],"border-w-l":[{"border-l":V()}],"divide-x":[{"divide-x":V()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":V()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...U(),"hidden","none"]}],"divide-style":[{divide:[...U(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...U(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Be,we,ve]}],"outline-w":[{outline:["",Be,Qo,Sr]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","none",u,as,ss]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",f,as,ss]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[Be,Sr]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":V()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",p,as,ss]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[Be,we,ve]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Be]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[we,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Be]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:O()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ve]}],filter:[{filter:["","none",we,ve]}],blur:[{blur:W()}],brightness:[{brightness:[Be,we,ve]}],contrast:[{contrast:[Be,we,ve]}],"drop-shadow":[{"drop-shadow":["","none",h,as,ss]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",Be,we,ve]}],"hue-rotate":[{"hue-rotate":[Be,we,ve]}],invert:[{invert:["",Be,we,ve]}],saturate:[{saturate:[Be,we,ve]}],sepia:[{sepia:["",Be,we,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ve]}],"backdrop-blur":[{"backdrop-blur":W()}],"backdrop-brightness":[{"backdrop-brightness":[Be,we,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Be,we,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Be,we,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Be,we,ve]}],"backdrop-invert":[{"backdrop-invert":["",Be,we,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Be,we,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Be,we,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Be,we,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Be,"initial",we,ve]}],ease:[{ease:["linear","initial",v,we,ve]}],delay:[{delay:[Be,we,ve]}],animate:[{animate:["none",b,we,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,we,ve]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:se()}],"skew-x":[{"skew-x":se()}],"skew-y":[{"skew-y":se()}],transform:[{transform:[we,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:K()}],"translate-x":[{"translate-x":K()}],"translate-y":[{"translate-y":K()}],"translate-z":[{"translate-z":K()}],"translate-none":["translate-none"],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,ve]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[Be,Qo,Sr,ll]}],stroke:[{stroke:["none",...j()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Nb=cb(Ab);function He(...e){return Nb(Oh(e))}const Yh=(e,t)=>{try{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t||"download",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(n){console.error("Error downloading blob:",n)}},jb=e=>{try{const t=atob(e.content),n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);const r=new Uint8Array(n),o=new Blob([r],{type:e.mime_type??"application/octet-stream"});Yh(o,e.name)}catch(t){console.error("Error creating download link:",t)}},qh=(e,t=2)=>{if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],i=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,i)).toFixed(r))+" "+o[i]},kd=e=>{try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),i=Math.floor(o/60),s=Math.floor(i/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:i<24?`${i}h ago`:s===1?"Yesterday":s<7?`${s}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),e}},Ib=e=>{if(!e)return"N/A";try{return new Date(e).toLocaleString()}catch{return"N/A"}},Cd=(e="")=>`
2
+ whitespace-normal
3
+ break-words
4
+ leading-[24px]
5
+
6
+ /* Typography */
7
+ [&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:text-foreground
8
+ [&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-5 [&_h2]:text-foreground
9
+ [&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-foreground
10
+ [&_h4]:text-base [&_h4]:font-semibold [&_h4]:mb-2 [&_h4]:mt-3 [&_h4]:text-foreground
11
+ [&_h5]:text-sm [&_h5]:font-semibold [&_h5]:mb-1 [&_h5]:mt-2 [&_h5]:text-foreground
12
+ [&_h6]:text-xs [&_h6]:font-semibold [&_h6]:mb-1 [&_h6]:mt-2 [&_h6]:text-foreground
13
+
14
+ /* Paragraphs */
15
+ [&_p]:mb-2 [&_p]:leading-[24px] [&_p]:text-foreground
16
+
17
+ /* Text formatting */
18
+ [&_strong]:font-semibold [&_strong]:text-foreground
19
+ [&_em]:italic
20
+ [&_del]:line-through [&_del]:text-foreground
21
+
22
+ /* Links */
23
+ [&_a]:text-[var(--color-primary-wMain)] [&_a]:underline [&_a]:decoration-[var(--color-primary-wMain)] dark:[&_a]:text-[var(--color-primary-w20)] dark:[&_a]:decoration-[var(--color-primary-w20)]
24
+ [&_a:hover]:text-[var(--color-primary-w100)] [&_a:hover]:decoration-[var(--color-primary-w100)] dark:[&_a:hover]:text-[var(--color-primary-w10)] dark:[&_a:hover]:decoration-[var(--color-primary-w10)]
25
+
26
+ /* Lists */
27
+ [&_ul]:mb-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1
28
+ [&_ol]:mb-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1
29
+ [&_li]:text-foreground [&_li]:leading-[24px]
30
+ [&_ul_ul]:mt-1 [&_ul_ul]:mb-1
31
+ [&_ol_ol]:mt-1 [&_ol_ol]:mb-1
32
+
33
+ /* Code */
34
+ [&_code]:bg-transparent [&_code]:py-0.5 [&_code]:rounded
35
+ [&_code]:text-sm [&_code]:font-mono [&_code]:font-semibold [&_code]:text-foreground [&_code]:break-words
36
+ [&_pre]:bg-transparent [&_pre]:p-4 [&_pre]:rounded-lg [&_pre]:overflow-x-auto [&_pre]:max-w-full
37
+ [&_pre]:mb-4 [&_pre]:border [&_pre]:border-border [&_pre]:whitespace-pre-wrap
38
+ [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-sm [&_pre_code]:break-words
39
+
40
+ /* Blockquotes */
41
+ [&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4
42
+ [&_blockquote]:py-2 [&_blockquote]:mb-4 [&_blockquote]:italic
43
+ [&_blockquote]:text-foreground [&_blockquote]:bg-transparent
44
+
45
+ /* Tables */
46
+ [&_table]:w-full [&_table]:mb-4 [&_table]:border-collapse [&_table]:table-fixed [&_table]:max-w-full
47
+ [&_th]:border [&_th]:border-border [&_th]:px-3 [&_th]:py-2 [&_th]:break-words
48
+ [&_th]:bg-transparent [&_th]:font-semibold [&_th]:text-left
49
+ [&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-2 [&_td]:break-words
50
+ [&_tr:nth-child(even)]:bg-transparent
51
+
52
+ /* Horizontal rules */
53
+ [&_hr]:border-0 [&_hr]:border-t [&_hr]:border-border [&_hr]:my-6
54
+
55
+ /* Images */
56
+ [&_img]:max-w-full [&_img]:h-auto [&_img]:rounded [&_img]:my-2 [&_img]:object-contain
57
+
58
+ ${e}
59
+ `.trim().replace(/\s+/g," "),_d=(e="")=>`
60
+ /* Buttons - "important" overrides for flow controls */
61
+ [&>button]:bg-[var(--color-background-w10)]
62
+ [&>button]:dark:!bg-[var(--color-background-w100)]
63
+ [&>button]:hover:bg-[var(--color-background-w20)]
64
+ [&>button]:dark:hover:!bg-[var(--color-primary-w60)]
65
+ [&>button]:text-[var(--color-primary-text-wMain)]
66
+ [&>button]:dark:text-[var(--color-primary-text-w10)]
67
+ [&>button]:!border
68
+ [&>button]:!border-[var(--color-secondary-w40)]
69
+ [&>button]:dark:!border-[var(--color-secondary-w70)]
70
+
71
+ ${e}
72
+ `.trim().replace(/\s+/g," ");function Me(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Rb(e,t){const n=m.createContext(t),r=i=>{const{children:s,...a}=i,l=m.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=m.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function vr(e,t=[]){let n=[];function r(i,s){const a=m.createContext(s),l=n.length;n=[...n,s];const c=f=>{var v;const{scope:p,children:h,...x}=f,g=((v=p==null?void 0:p[e])==null?void 0:v[l])||a,y=m.useMemo(()=>x,Object.values(x));return d.jsx(g.Provider,{value:y,children:h})};c.displayName=i+"Provider";function u(f,p){var g;const h=((g=p==null?void 0:p[e])==null?void 0:g[l])||a,x=m.useContext(h);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[c,u]}const o=()=>{const i=n.map(s=>m.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return m.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Mb(o,...t)]}function Mb(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(i)[`__scope${c}`];return{...a,...f}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Wo=Fw();const Pb=Xc(Wo);var Db=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ye=Db.reduce((e,t)=>{const n=$r(`Primitive.${t}`),r=m.forwardRef((o,i)=>{const{asChild:s,...a}=o,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ob(e,t){e&&Wo.flushSync(()=>e.dispatchEvent(t))}function fr(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Lb(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e);m.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var $b="DismissableLayer",nc="dismissableLayer.update",Fb="dismissableLayer.pointerDownOutside",zb="dismissableLayer.focusOutside",Td,Kh=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gi=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,c=m.useContext(Kh),[u,f]=m.useState(null),p=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=m.useState({}),x=pt(t,k=>f(k)),g=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(y),b=u?g.indexOf(u):-1,w=c.layersWithOutsidePointerEventsDisabled.size>0,S=b>=v,E=Vb(k=>{const T=k.target,P=[...c.branches].some(z=>z.contains(T));!S||P||(o==null||o(k),s==null||s(k),k.defaultPrevented||a==null||a())},p),C=Ub(k=>{const T=k.target;[...c.branches].some(z=>z.contains(T))||(i==null||i(k),s==null||s(k),k.defaultPrevented||a==null||a())},p);return Lb(k=>{b===c.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&a&&(k.preventDefault(),a()))},p),m.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Td=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Ad(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Td)}},[u,p,n,c]),m.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Ad())},[u,c]),m.useEffect(()=>{const k=()=>h({});return document.addEventListener(nc,k),()=>document.removeEventListener(nc,k)},[]),d.jsx(Ye.div,{...l,ref:x,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:Me(e.onFocusCapture,C.onFocusCapture),onBlurCapture:Me(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Me(e.onPointerDownCapture,E.onPointerDownCapture)})});Gi.displayName=$b;var Bb="DismissableLayerBranch",Hb=m.forwardRef((e,t)=>{const n=m.useContext(Kh),r=m.useRef(null),o=pt(t,r);return m.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.jsx(Ye.div,{...e,ref:o})});Hb.displayName=Bb;function Vb(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e),r=m.useRef(!1),o=m.useRef(()=>{});return m.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){Xh(Fb,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ub(e,t=globalThis==null?void 0:globalThis.document){const n=fr(e),r=m.useRef(!1);return m.useEffect(()=>{const o=i=>{i.target&&!r.current&&Xh(zb,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ad(){const e=new CustomEvent(nc);document.dispatchEvent(e)}function Xh(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Ob(o,i):o.dispatchEvent(i)}var Vt=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Wb=Zc[" useId ".trim().toString()]||(()=>{}),Gb=0;function jn(e){const[t,n]=m.useState(Wb());return Vt(()=>{n(r=>r??String(Gb++))},[e]),t?`radix-${t}`:""}const Yb=["top","right","bottom","left"],pr=Math.min,nn=Math.max,Us=Math.round,ls=Math.floor,In=e=>({x:e,y:e}),qb={left:"right",right:"left",bottom:"top",top:"bottom"},Kb={start:"end",end:"start"};function rc(e,t,n){return nn(e,pr(t,n))}function Yn(e,t){return typeof e=="function"?e(t):e}function qn(e){return e.split("-")[0]}function Go(e){return e.split("-")[1]}function eu(e){return e==="x"?"y":"x"}function tu(e){return e==="y"?"height":"width"}const Xb=new Set(["top","bottom"]);function Tn(e){return Xb.has(qn(e))?"y":"x"}function nu(e){return eu(Tn(e))}function Zb(e,t,n){n===void 0&&(n=!1);const r=Go(e),o=nu(e),i=tu(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ws(s)),[s,Ws(s)]}function Qb(e){const t=Ws(e);return[oc(e),t,oc(t)]}function oc(e){return e.replace(/start|end/g,t=>Kb[t])}const Nd=["left","right"],jd=["right","left"],Jb=["top","bottom"],e1=["bottom","top"];function t1(e,t,n){switch(e){case"top":case"bottom":return n?t?jd:Nd:t?Nd:jd;case"left":case"right":return t?Jb:e1;default:return[]}}function n1(e,t,n,r){const o=Go(e);let i=t1(qn(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(oc)))),i}function Ws(e){return e.replace(/left|right|bottom|top/g,t=>qb[t])}function r1(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zh(e){return typeof e!="number"?r1(e):{top:e,right:e,bottom:e,left:e}}function Gs(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Id(e,t,n){let{reference:r,floating:o}=e;const i=Tn(t),s=nu(t),a=tu(s),l=qn(t),c=i==="y",u=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Go(t)){case"start":h[s]-=p*(n&&c?-1:1);break;case"end":h[s]+=p*(n&&c?-1:1);break}return h}const o1=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=Id(c,r,l),p=r,h={},x=0;for(let g=0;g<a.length;g++){const{name:y,fn:v}=a[g],{x:b,y:w,data:S,reset:E}=await v({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:c,platform:s,elements:{reference:e,floating:t}});u=b??u,f=w??f,h={...h,[y]:{...h[y],...S}},E&&x<=50&&(x++,typeof E=="object"&&(E.placement&&(p=E.placement),E.rects&&(c=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):E.rects),{x:u,y:f}=Id(c,p,l)),g=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:h}};async function Ti(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=Yn(t,e),x=Zh(h),y=a[p?f==="floating"?"reference":"floating":f],v=Gs(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),b=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},E=Gs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:l}):b);return{top:(v.top-E.top+x.top)/S.y,bottom:(E.bottom-v.bottom+x.bottom)/S.y,left:(v.left-E.left+x.left)/S.x,right:(E.right-v.right+x.right)/S.x}}const i1=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Yn(e,t)||{};if(c==null)return{};const f=Zh(u),p={x:n,y:r},h=nu(o),x=tu(h),g=await s.getDimensions(c),y=h==="y",v=y?"top":"left",b=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[h]-p[h]-i.floating[x],E=p[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c));let k=C?C[w]:0;(!k||!await(s.isElement==null?void 0:s.isElement(C)))&&(k=a.floating[w]||i.floating[x]);const T=S/2-E/2,P=k/2-g[x]/2-1,z=pr(f[v],P),D=pr(f[b],P),$=z,M=k-g[x]-D,_=k/2-g[x]/2+T,N=rc($,_,M),A=!l.arrow&&Go(o)!=null&&_!==N&&i.reference[x]/2-(_<$?z:D)-g[x]/2<0,I=A?_<$?_-$:_-M:0;return{[h]:p[h]+I,data:{[h]:N,centerOffset:_-N-I,...A&&{alignmentOffset:I}},reset:A}}}),s1=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...y}=Yn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=qn(o),b=Tn(a),w=qn(a)===a,S=await(l.isRTL==null?void 0:l.isRTL(c.floating)),E=p||(w||!g?[Ws(a)]:Qb(a)),C=x!=="none";!p&&C&&E.push(...n1(a,g,x,S));const k=[a,...E],T=await Ti(t,y),P=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&P.push(T[v]),f){const _=Zb(o,s,S);P.push(T[_[0]],T[_[1]])}if(z=[...z,{placement:o,overflows:P}],!P.every(_=>_<=0)){var D,$;const _=(((D=i.flip)==null?void 0:D.index)||0)+1,N=k[_];if(N&&(!(f==="alignment"?b!==Tn(N):!1)||z.every(j=>j.overflows[0]>0&&Tn(j.placement)===b)))return{data:{index:_,overflows:z},reset:{placement:N}};let A=($=z.filter(I=>I.overflows[0]<=0).sort((I,j)=>I.overflows[1]-j.overflows[1])[0])==null?void 0:$.placement;if(!A)switch(h){case"bestFit":{var M;const I=(M=z.filter(j=>{if(C){const R=Tn(j.placement);return R===b||R==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(R=>R>0).reduce((R,O)=>R+O,0)]).sort((j,R)=>j[1]-R[1])[0])==null?void 0:M[0];I&&(A=I);break}case"initialPlacement":A=a;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function Rd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Md(e){return Yb.some(t=>e[t]>=0)}const a1=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Yn(e,t);switch(r){case"referenceHidden":{const i=await Ti(t,{...o,elementContext:"reference"}),s=Rd(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Md(s)}}}case"escaped":{const i=await Ti(t,{...o,altBoundary:!0}),s=Rd(i,n.floating);return{data:{escapedOffsets:s,escaped:Md(s)}}}default:return{}}}}},Qh=new Set(["left","top"]);async function l1(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=qn(n),a=Go(n),l=Tn(n)==="y",c=Qh.has(s)?-1:1,u=i&&l?-1:1,f=Yn(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(h=a==="end"?x*-1:x),l?{x:h*u,y:p*c}:{x:p*c,y:h*u}}const c1=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await l1(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},u1=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:y=>{let{x:v,y:b}=y;return{x:v,y:b}}},...l}=Yn(e,t),c={x:n,y:r},u=await Ti(t,l),f=Tn(qn(o)),p=eu(f);let h=c[p],x=c[f];if(i){const y=p==="y"?"top":"left",v=p==="y"?"bottom":"right",b=h+u[y],w=h-u[v];h=rc(b,h,w)}if(s){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",b=x+u[y],w=x-u[v];x=rc(b,x,w)}const g=a.fn({...t,[p]:h,[f]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:i,[f]:s}}}}}},d1=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Yn(e,t),u={x:n,y:r},f=Tn(o),p=eu(f);let h=u[p],x=u[f];const g=Yn(a,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){const w=p==="y"?"height":"width",S=i.reference[p]-i.floating[w]+y.mainAxis,E=i.reference[p]+i.reference[w]-y.mainAxis;h<S?h=S:h>E&&(h=E)}if(c){var v,b;const w=p==="y"?"width":"height",S=Qh.has(qn(o)),E=i.reference[f]-i.floating[w]+(S&&((v=s.offset)==null?void 0:v[f])||0)+(S?0:y.crossAxis),C=i.reference[f]+i.reference[w]+(S?0:((b=s.offset)==null?void 0:b[f])||0)-(S?y.crossAxis:0);x<E?x=E:x>C&&(x=C)}return{[p]:h,[f]:x}}}},f1=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=Yn(e,t),u=await Ti(t,c),f=qn(o),p=Go(o),h=Tn(o)==="y",{width:x,height:g}=i.floating;let y,v;f==="top"||f==="bottom"?(y=f,v=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(v=f,y=p==="end"?"top":"bottom");const b=g-u.top-u.bottom,w=x-u.left-u.right,S=pr(g-u[y],b),E=pr(x-u[v],w),C=!t.middlewareData.shift;let k=S,T=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=b),C&&!p){const z=nn(u.left,0),D=nn(u.right,0),$=nn(u.top,0),M=nn(u.bottom,0);h?T=x-2*(z!==0||D!==0?z+D:nn(u.left,u.right)):k=g-2*($!==0||M!==0?$+M:nn(u.top,u.bottom))}await l({...t,availableWidth:T,availableHeight:k});const P=await s.getDimensions(a.floating);return x!==P.width||g!==P.height?{reset:{rects:!0}}:{}}}};function Sa(){return typeof window<"u"}function Yo(e){return Jh(e)?(e.nodeName||"").toLowerCase():"#document"}function sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function On(e){var t;return(t=(Jh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Jh(e){return Sa()?e instanceof Node||e instanceof sn(e).Node:!1}function wn(e){return Sa()?e instanceof Element||e instanceof sn(e).Element:!1}function Pn(e){return Sa()?e instanceof HTMLElement||e instanceof sn(e).HTMLElement:!1}function Pd(e){return!Sa()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof sn(e).ShadowRoot}const p1=new Set(["inline","contents"]);function Yi(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=bn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!p1.has(o)}const h1=new Set(["table","td","th"]);function m1(e){return h1.has(Yo(e))}const g1=[":popover-open",":modal"];function ka(e){return g1.some(t=>{try{return e.matches(t)}catch{return!1}})}const x1=["transform","translate","scale","rotate","perspective"],y1=["transform","translate","scale","rotate","perspective","filter"],v1=["paint","layout","strict","content"];function ru(e){const t=ou(),n=wn(e)?bn(e):e;return x1.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||y1.some(r=>(n.willChange||"").includes(r))||v1.some(r=>(n.contain||"").includes(r))}function w1(e){let t=hr(e);for(;Pn(t)&&!Co(t);){if(ru(t))return t;if(ka(t))return null;t=hr(t)}return null}function ou(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const b1=new Set(["html","body","#document"]);function Co(e){return b1.has(Yo(e))}function bn(e){return sn(e).getComputedStyle(e)}function Ca(e){return wn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function hr(e){if(Yo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pd(e)&&e.host||On(e);return Pd(t)?t.host:t}function em(e){const t=hr(e);return Co(t)?e.ownerDocument?e.ownerDocument.body:e.body:Pn(t)&&Yi(t)?t:em(t)}function Ai(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=em(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=sn(o);if(i){const a=ic(s);return t.concat(s,s.visualViewport||[],Yi(o)?o:[],a&&n?Ai(a):[])}return t.concat(o,Ai(o,[],n))}function ic(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tm(e){const t=bn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Pn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Us(n)!==i||Us(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function iu(e){return wn(e)?e:e.contextElement}function vo(e){const t=iu(e);if(!Pn(t))return In(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=tm(t);let s=(i?Us(n.width):n.width)/r,a=(i?Us(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const E1=In(0);function nm(e){const t=sn(e);return!ou()||!t.visualViewport?E1:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function S1(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==sn(e)?!1:t}function Fr(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=iu(e);let s=In(1);t&&(r?wn(r)&&(s=vo(r)):s=vo(e));const a=S1(i,n,r)?nm(i):In(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,u=o.width/s.x,f=o.height/s.y;if(i){const p=sn(i),h=r&&wn(r)?sn(r):r;let x=p,g=ic(x);for(;g&&r&&h!==x;){const y=vo(g),v=g.getBoundingClientRect(),b=bn(g),w=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*y.x,S=v.top+(g.clientTop+parseFloat(b.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=w,c+=S,x=sn(g),g=ic(x)}}return Gs({width:u,height:f,x:l,y:c})}function su(e,t){const n=Ca(e).scrollLeft;return t?t.left+n:Fr(On(e)).left+n}function rm(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:su(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function k1(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=On(r),a=t?ka(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=In(1);const u=In(0),f=Pn(r);if((f||!f&&!i)&&((Yo(r)!=="body"||Yi(s))&&(l=Ca(r)),Pn(r))){const h=Fr(r);c=vo(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const p=s&&!f&&!i?rm(s,l,!0):In(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function C1(e){return Array.from(e.getClientRects())}function _1(e){const t=On(e),n=Ca(e),r=e.ownerDocument.body,o=nn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=nn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+su(e);const a=-n.scrollTop;return bn(r).direction==="rtl"&&(s+=nn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function T1(e,t){const n=sn(e),r=On(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=ou();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}const A1=new Set(["absolute","fixed"]);function N1(e,t){const n=Fr(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Pn(e)?vo(e):In(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Dd(e,t,n){let r;if(t==="viewport")r=T1(e,n);else if(t==="document")r=_1(On(e));else if(wn(t))r=N1(t,n);else{const o=nm(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Gs(r)}function om(e,t){const n=hr(e);return n===t||!wn(n)||Co(n)?!1:bn(n).position==="fixed"||om(n,t)}function j1(e,t){const n=t.get(e);if(n)return n;let r=Ai(e,[],!1).filter(a=>wn(a)&&Yo(a)!=="body"),o=null;const i=bn(e).position==="fixed";let s=i?hr(e):e;for(;wn(s)&&!Co(s);){const a=bn(s),l=ru(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&A1.has(o.position)||Yi(s)&&!l&&om(e,s))?r=r.filter(u=>u!==s):o=a,s=hr(s)}return t.set(e,r),r}function I1(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?ka(t)?[]:j1(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,u)=>{const f=Dd(t,u,o);return c.top=nn(f.top,c.top),c.right=pr(f.right,c.right),c.bottom=pr(f.bottom,c.bottom),c.left=nn(f.left,c.left),c},Dd(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function R1(e){const{width:t,height:n}=tm(e);return{width:t,height:n}}function M1(e,t,n){const r=Pn(t),o=On(t),i=n==="fixed",s=Fr(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=In(0);function c(){l.x=su(o)}if(r||!r&&!i)if((Yo(t)!=="body"||Yi(o))&&(a=Ca(t)),r){const h=Fr(t,!0,i,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else o&&c();i&&!r&&o&&c();const u=o&&!r&&!i?rm(o,a):In(0),f=s.left+a.scrollLeft-l.x-u.x,p=s.top+a.scrollTop-l.y-u.y;return{x:f,y:p,width:s.width,height:s.height}}function cl(e){return bn(e).position==="static"}function Od(e,t){if(!Pn(e)||bn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return On(e)===n&&(n=n.ownerDocument.body),n}function im(e,t){const n=sn(e);if(ka(e))return n;if(!Pn(e)){let o=hr(e);for(;o&&!Co(o);){if(wn(o)&&!cl(o))return o;o=hr(o)}return n}let r=Od(e,t);for(;r&&m1(r)&&cl(r);)r=Od(r,t);return r&&Co(r)&&cl(r)&&!ru(r)?n:r||w1(e)||n}const P1=async function(e){const t=this.getOffsetParent||im,n=this.getDimensions,r=await n(e.floating);return{reference:M1(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function D1(e){return bn(e).direction==="rtl"}const O1={convertOffsetParentRelativeRectToViewportRelativeRect:k1,getDocumentElement:On,getClippingRect:I1,getOffsetParent:im,getElementRects:P1,getClientRects:C1,getDimensions:R1,getScale:vo,isElement:wn,isRTL:D1};function sm(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function L1(e,t){let n=null,r;const o=On(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:u,top:f,width:p,height:h}=c;if(a||t(),!p||!h)return;const x=ls(f),g=ls(o.clientWidth-(u+p)),y=ls(o.clientHeight-(f+h)),v=ls(u),w={rootMargin:-x+"px "+-g+"px "+-y+"px "+-v+"px",threshold:nn(0,pr(1,l))||1};let S=!0;function E(C){const k=C[0].intersectionRatio;if(k!==l){if(!S)return s();k?s(!1,k):r=setTimeout(()=>{s(!1,1e-7)},1e3)}k===1&&!sm(c,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(E,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(e)}return s(!0),i}function $1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=iu(e),u=o||i?[...c?Ai(c):[],...Ai(t)]:[];u.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=c&&a?L1(c,n):null;let p=-1,h=null;s&&(h=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let x,g=l?Fr(e):null;l&&y();function y(){const v=Fr(e);g&&!sm(g,v)&&n(),g=v,x=requestAnimationFrame(y)}return n(),()=>{var v;u.forEach(b=>{o&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),f==null||f(),(v=h)==null||v.disconnect(),h=null,l&&cancelAnimationFrame(x)}}const F1=c1,z1=u1,B1=s1,H1=f1,V1=a1,Ld=i1,U1=d1,W1=(e,t,n)=>{const r=new Map,o={platform:O1,...n},i={...o.platform,_c:r};return o1(e,t,{...o,platform:i})};var G1=typeof document<"u",Y1=function(){},Is=G1?m.useLayoutEffect:Y1;function Ys(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ys(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Ys(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function am(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $d(e,t){const n=am(e);return Math.round(t*n)/n}function ul(e){const t=m.useRef(e);return Is(()=>{t.current=e}),t}function q1(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);Ys(p,r)||h(r);const[x,g]=m.useState(null),[y,v]=m.useState(null),b=m.useCallback(j=>{j!==C.current&&(C.current=j,g(j))},[]),w=m.useCallback(j=>{j!==k.current&&(k.current=j,v(j))},[]),S=i||x,E=s||y,C=m.useRef(null),k=m.useRef(null),T=m.useRef(u),P=l!=null,z=ul(l),D=ul(o),$=ul(c),M=m.useCallback(()=>{if(!C.current||!k.current)return;const j={placement:t,strategy:n,middleware:p};D.current&&(j.platform=D.current),W1(C.current,k.current,j).then(R=>{const O={...R,isPositioned:$.current!==!1};_.current&&!Ys(T.current,O)&&(T.current=O,Wo.flushSync(()=>{f(O)}))})},[p,t,n,D,$]);Is(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(j=>({...j,isPositioned:!1})))},[c]);const _=m.useRef(!1);Is(()=>(_.current=!0,()=>{_.current=!1}),[]),Is(()=>{if(S&&(C.current=S),E&&(k.current=E),S&&E){if(z.current)return z.current(S,E,M);M()}},[S,E,M,z,P]);const N=m.useMemo(()=>({reference:C,floating:k,setReference:b,setFloating:w}),[b,w]),A=m.useMemo(()=>({reference:S,floating:E}),[S,E]),I=m.useMemo(()=>{const j={position:n,left:0,top:0};if(!A.floating)return j;const R=$d(A.floating,u.x),O=$d(A.floating,u.y);return a?{...j,transform:"translate("+R+"px, "+O+"px)",...am(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:O}},[n,a,A.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:M,refs:N,elements:A,floatingStyles:I}),[u,M,N,A,I])}const K1=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ld({element:r.current,padding:o}).fn(n):{}:r?Ld({element:r,padding:o}).fn(n):{}}}},X1=(e,t)=>({...F1(e),options:[e,t]}),Z1=(e,t)=>({...z1(e),options:[e,t]}),Q1=(e,t)=>({...U1(e),options:[e,t]}),J1=(e,t)=>({...B1(e),options:[e,t]}),eE=(e,t)=>({...H1(e),options:[e,t]}),tE=(e,t)=>({...V1(e),options:[e,t]}),nE=(e,t)=>({...K1(e),options:[e,t]});var rE="Arrow",lm=m.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return d.jsx(Ye.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});lm.displayName=rE;var oE=lm;function iE(e){const[t,n]=m.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;s=c.inlineSize,a=c.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var au="Popper",[cm,qo]=vr(au),[sE,um]=cm(au),dm=e=>{const{__scopePopper:t,children:n}=e,[r,o]=m.useState(null);return d.jsx(sE,{scope:t,anchor:r,onAnchorChange:o,children:n})};dm.displayName=au;var fm="PopperAnchor",pm=m.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=um(fm,n),s=m.useRef(null),a=pt(t,s);return m.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(Ye.div,{...o,ref:a})});pm.displayName=fm;var lu="PopperContent",[aE,lE]=cm(lu),hm=m.forwardRef((e,t)=>{var B,W,Z,ie,se,K;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,y=um(lu,n),[v,b]=m.useState(null),w=pt(t,ne=>b(ne)),[S,E]=m.useState(null),C=iE(S),k=(C==null?void 0:C.width)??0,T=(C==null?void 0:C.height)??0,P=r+(i!=="center"?"-"+i:""),z=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],$=D.length>0,M={padding:z,boundary:D.filter(uE),altBoundary:$},{refs:_,floatingStyles:N,placement:A,isPositioned:I,middlewareData:j}=q1({strategy:"fixed",placement:P,whileElementsMounted:(...ne)=>$1(...ne,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[X1({mainAxis:o+T,alignmentAxis:s}),l&&Z1({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Q1():void 0,...M}),l&&J1({...M}),eE({...M,apply:({elements:ne,rects:q,availableWidth:re,availableHeight:te})=>{const{width:pe,height:ee}=q.reference,Te=ne.floating.style;Te.setProperty("--radix-popper-available-width",`${re}px`),Te.setProperty("--radix-popper-available-height",`${te}px`),Te.setProperty("--radix-popper-anchor-width",`${pe}px`),Te.setProperty("--radix-popper-anchor-height",`${ee}px`)}}),S&&nE({element:S,padding:a}),dE({arrowWidth:k,arrowHeight:T}),p&&tE({strategy:"referenceHidden",...M})]}),[R,O]=xm(A),L=fr(x);Vt(()=>{I&&(L==null||L())},[I,L]);const Y=(B=j.arrow)==null?void 0:B.x,H=(W=j.arrow)==null?void 0:W.y,V=((Z=j.arrow)==null?void 0:Z.centerOffset)!==0,[U,G]=m.useState();return Vt(()=>{v&&G(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:_.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:I?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(ie=j.transformOrigin)==null?void 0:ie.x,(se=j.transformOrigin)==null?void 0:se.y].join(" "),...((K=j.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(aE,{scope:n,placedSide:R,onArrowChange:E,arrowX:Y,arrowY:H,shouldHideArrow:V,children:d.jsx(Ye.div,{"data-side":R,"data-align":O,...g,ref:w,style:{...g.style,animation:I?void 0:"none"}})})})});hm.displayName=lu;var mm="PopperArrow",cE={top:"bottom",right:"left",bottom:"top",left:"right"},gm=m.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=lE(mm,r),s=cE[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(oE,{...o,ref:n,style:{...o.style,display:"block"}})})});gm.displayName=mm;function uE(e){return e!==null}var dE=e=>({name:"transformOrigin",options:e,fn(t){var y,v,b;const{placement:n,rects:r,middlewareData:o}=t,s=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[c,u]=xm(n),f={start:"0%",center:"50%",end:"100%"}[u],p=(((v=o.arrow)==null?void 0:v.x)??0)+a/2,h=(((b=o.arrow)==null?void 0:b.y)??0)+l/2;let x="",g="";return c==="bottom"?(x=s?f:`${p}px`,g=`${-l}px`):c==="top"?(x=s?f:`${p}px`,g=`${r.floating.height+l}px`):c==="right"?(x=`${-l}px`,g=s?f:`${h}px`):c==="left"&&(x=`${r.floating.width+l}px`,g=s?f:`${h}px`),{data:{x,y:g}}}});function xm(e){const[t,n="center"]=e.split("-");return[t,n]}var cu=dm,_a=pm,uu=hm,du=gm,fE="Portal",qi=m.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=m.useState(!1);Vt(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?Pb.createPortal(d.jsx(Ye.div,{...r,ref:t}),s):null});qi.displayName=fE;function pE(e,t){return m.useReducer((n,r)=>t[n][r]??n,e)}var Zn=e=>{const{present:t,children:n}=e,r=hE(t),o=typeof n=="function"?n({present:r.isPresent}):m.Children.only(n),i=pt(r.ref,mE(o));return typeof n=="function"||r.isPresent?m.cloneElement(o,{ref:i}):null};Zn.displayName="Presence";function hE(e){const[t,n]=m.useState(),r=m.useRef(null),o=m.useRef(e),i=m.useRef("none"),s=e?"mounted":"unmounted",[a,l]=pE(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const c=cs(r.current);i.current=a==="mounted"?c:"none"},[a]),Vt(()=>{const c=r.current,u=o.current;if(u!==e){const p=i.current,h=cs(c);e?l("MOUNT"):h==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Vt(()=>{if(t){let c;const u=t.ownerDocument.defaultView??window,f=h=>{const g=cs(r.current).includes(h.animationName);if(h.target===t&&g&&(l("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=h=>{h.target===t&&(i.current=cs(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{u.clearTimeout(c),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:m.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function cs(e){return(e==null?void 0:e.animationName)||"none"}function mE(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gE=Zc[" useInsertionEffect ".trim().toString()]||Vt;function zr({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=xE({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:o;{const u=m.useRef(e!==void 0);m.useEffect(()=>{const f=u.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,r])}const c=m.useCallback(u=>{var f;if(a){const p=yE(u)?u(e):u;p!==e&&((f=s.current)==null||f.call(s,p))}else i(u)},[a,e,i,s]);return[l,c]}function xE({defaultProp:e,onChange:t}){const[n,r]=m.useState(e),o=m.useRef(n),i=m.useRef(t);return gE(()=>{i.current=t},[t]),m.useEffect(()=>{var s;o.current!==n&&((s=i.current)==null||s.call(i,n),o.current=n)},[n,o]),[n,r,i]}function yE(e){return typeof e=="function"}var ym=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),vE="VisuallyHidden",vm=m.forwardRef((e,t)=>d.jsx(Ye.span,{...e,ref:t,style:{...ym,...e.style}}));vm.displayName=vE;var wE=vm,[Ta,O5]=vr("Tooltip",[qo]),Aa=qo(),wm="TooltipProvider",bE=700,sc="tooltip.open",[EE,fu]=Ta(wm),bm=e=>{const{__scopeTooltip:t,delayDuration:n=bE,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,s=m.useRef(!0),a=m.useRef(!1),l=m.useRef(0);return m.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),d.jsx(EE,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:m.useCallback(()=>{window.clearTimeout(l.current),s.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:m.useCallback(c=>{a.current=c},[]),disableHoverableContent:o,children:i})};bm.displayName=wm;var Ni="Tooltip",[SE,Ki]=Ta(Ni),Em=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=fu(Ni,e.__scopeTooltip),c=Aa(t),[u,f]=m.useState(null),p=jn(),h=m.useRef(0),x=s??l.disableHoverableContent,g=a??l.delayDuration,y=m.useRef(!1),[v,b]=zr({prop:r,defaultProp:o??!1,onChange:k=>{k?(l.onOpen(),document.dispatchEvent(new CustomEvent(sc))):l.onClose(),i==null||i(k)},caller:Ni}),w=m.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),S=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,b(!0)},[b]),E=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,b(!1)},[b]),C=m.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,b(!0),h.current=0},g)},[g,b]);return m.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(cu,{...c,children:d.jsx(SE,{scope:t,contentId:p,open:v,stateAttribute:w,trigger:u,onTriggerChange:f,onTriggerEnter:m.useCallback(()=>{l.isOpenDelayedRef.current?C():S()},[l.isOpenDelayedRef,C,S]),onTriggerLeave:m.useCallback(()=>{x?E():(window.clearTimeout(h.current),h.current=0)},[E,x]),onOpen:S,onClose:E,disableHoverableContent:x,children:n})})};Em.displayName=Ni;var ac="TooltipTrigger",Sm=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ki(ac,n),i=fu(ac,n),s=Aa(n),a=m.useRef(null),l=pt(t,a,o.onTriggerChange),c=m.useRef(!1),u=m.useRef(!1),f=m.useCallback(()=>c.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),d.jsx(_a,{asChild:!0,...s,children:d.jsx(Ye.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:Me(e.onPointerMove,p=>{p.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),u.current=!0)}),onPointerLeave:Me(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:Me(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Me(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:Me(e.onBlur,o.onClose),onClick:Me(e.onClick,o.onClose)})})});Sm.displayName=ac;var pu="TooltipPortal",[kE,CE]=Ta(pu,{forceMount:void 0}),km=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Ki(pu,t);return d.jsx(kE,{scope:t,forceMount:n,children:d.jsx(Zn,{present:n||i.open,children:d.jsx(qi,{asChild:!0,container:o,children:r})})})};km.displayName=pu;var _o="TooltipContent",Cm=m.forwardRef((e,t)=>{const n=CE(_o,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Ki(_o,e.__scopeTooltip);return d.jsx(Zn,{present:r||s.open,children:s.disableHoverableContent?d.jsx(_m,{side:o,...i,ref:t}):d.jsx(_E,{side:o,...i,ref:t})})}),_E=m.forwardRef((e,t)=>{const n=Ki(_o,e.__scopeTooltip),r=fu(_o,e.__scopeTooltip),o=m.useRef(null),i=pt(t,o),[s,a]=m.useState(null),{trigger:l,onClose:c}=n,u=o.current,{onPointerInTransitChange:f}=r,p=m.useCallback(()=>{a(null),f(!1)},[f]),h=m.useCallback((x,g)=>{const y=x.currentTarget,v={x:x.clientX,y:x.clientY},b=jE(v,y.getBoundingClientRect()),w=IE(v,b),S=RE(g.getBoundingClientRect()),E=PE([...w,...S]);a(E),f(!0)},[f]);return m.useEffect(()=>()=>p(),[p]),m.useEffect(()=>{if(l&&u){const x=y=>h(y,u),g=y=>h(y,l);return l.addEventListener("pointerleave",x),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",g)}}},[l,u,h,p]),m.useEffect(()=>{if(s){const x=g=>{const y=g.target,v={x:g.clientX,y:g.clientY},b=(l==null?void 0:l.contains(y))||(u==null?void 0:u.contains(y)),w=!ME(v,s);b?p():w&&(p(),c())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,u,s,c,p]),d.jsx(_m,{...e,ref:i})}),[TE,AE]=Ta(Ni,{isInside:!1}),NE=Hw("TooltipContent"),_m=m.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Ki(_o,n),c=Aa(n),{onClose:u}=l;return m.useEffect(()=>(document.addEventListener(sc,u),()=>document.removeEventListener(sc,u)),[u]),m.useEffect(()=>{if(l.trigger){const f=p=>{const h=p.target;h!=null&&h.contains(l.trigger)&&u()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,u]),d.jsx(Gi,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:u,children:d.jsxs(uu,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(NE,{children:r}),d.jsx(TE,{scope:n,isInside:!0,children:d.jsx(wE,{id:l.contentId,role:"tooltip",children:o||r})})]})})});Cm.displayName=_o;var Tm="TooltipArrow",Am=m.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Aa(n);return AE(Tm,n).isInside?null:d.jsx(du,{...o,...r,ref:t})});Am.displayName=Tm;function jE(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function IE(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function RE(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function ME(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],l=t[s],c=a.x,u=a.y,f=l.x,p=l.y;u>r!=p>r&&n<(f-c)*(r-u)/(p-u)+c&&(o=!o)}return o}function PE(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),DE(t)}function DE(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var OE=bm,LE=Em,$E=Sm,FE=km,zE=Cm,BE=Am;function HE({delayDuration:e=0,...t}){return d.jsx(OE,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function VE({...e}){return d.jsx(HE,{delayDuration:500,children:d.jsx(LE,{"data-slot":"tooltip",...e})})}function UE({...e}){return d.jsx($E,{"data-slot":"tooltip-trigger",...e})}function WE({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(FE,{children:d.jsxs(zE,{"data-slot":"tooltip-content",sideOffset:t,className:He("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,d.jsx(BE,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const dl="text-[var(--color-primary-wMain)] hover:text-[var(--color-primary-text-w60)] hover:bg-[var(--color-primary-w10)] dark:text-[var(--color-primary-w20)] dark:hover:text-[var(--color-primary-text-w10)] dark:hover:bg-[var(--color-primary-w60)]",GE=yr("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm font-semibold transition-all disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 cursor-pointer disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] hover:bg-[var(--color-primary-w100)] dark:hover:bg-[var(--color-primary-w60)]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] hover:bg-[var(--color-error-w70)]",outline:dl+" border border-1 border-[var(--color-primary-wMain)]",secondary:dl,ghost:dl,link:"underline-offset-4 hover:underline"},size:{default:"h-9 px-5 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function tt({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",...i}){const s=r?Mh:"button",a=d.jsx(s,{"data-slot":"button",className:He(GE({variant:t,size:n,className:e})),...i});return o?d.jsxs(VE,{children:[d.jsx(UE,{asChild:!0,children:a}),d.jsx(WE,{children:o})]}):a}/**
73
+ * @license lucide-react v0.511.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const YE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qE=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Fd=e=>{const t=qE(e);return t.charAt(0).toUpperCase()+t.slice(1)},Nm=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),KE=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
78
+ * @license lucide-react v0.511.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */var XE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
83
+ * @license lucide-react v0.511.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const ZE=m.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>m.createElement("svg",{ref:l,...XE,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Nm("lucide",o),...!i&&!KE(a)&&{"aria-hidden":"true"},...a},[...s.map(([c,u])=>m.createElement(c,u)),...Array.isArray(i)?i:[i]]));/**
88
+ * @license lucide-react v0.511.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const De=(e,t)=>{const n=m.forwardRef(({className:r,...o},i)=>m.createElement(ZE,{ref:i,iconNode:t,className:Nm(`lucide-${YE(Fd(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Fd(e),n};/**
93
+ * @license lucide-react v0.511.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const QE=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],jm=De("arrow-down",QE);/**
98
+ * @license lucide-react v0.511.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const JE=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],eS=De("arrow-left",JE);/**
103
+ * @license lucide-react v0.511.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const tS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],nS=De("ban",tS);/**
108
+ * @license lucide-react v0.511.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const rS=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],oS=De("book",rS);/**
113
+ * @license lucide-react v0.511.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const iS=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Im=De("bot",iS);/**
118
+ * @license lucide-react v0.511.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const sS=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],zd=De("box",sS);/**
123
+ * @license lucide-react v0.511.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const aS=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Rm=De("check",aS);/**
128
+ * @license lucide-react v0.511.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const lS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mm=De("chevron-down",lS);/**
133
+ * @license lucide-react v0.511.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const cS=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],uS=De("chevron-up",cS);/**
138
+ * @license lucide-react v0.511.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const dS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],hu=De("circle-alert",dS);/**
143
+ * @license lucide-react v0.511.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const fS=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],pS=De("circle-check-big",fS);/**
148
+ * @license lucide-react v0.511.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const hS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],mS=De("clock",hS);/**
153
+ * @license lucide-react v0.511.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const gS=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Pm=De("code",gS);/**
158
+ * @license lucide-react v0.511.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const xS=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],mu=De("download",xS);/**
163
+ * @license lucide-react v0.511.0 - ISC
164
+ *
165
+ * This source code is licensed under the ISC license.
166
+ * See the LICENSE file in the root directory of this source tree.
167
+ */const yS=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],vS=De("ellipsis-vertical",yS);/**
168
+ * @license lucide-react v0.511.0 - ISC
169
+ *
170
+ * This source code is licensed under the ISC license.
171
+ * See the LICENSE file in the root directory of this source tree.
172
+ */const wS=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],bS=De("ellipsis",wS);/**
173
+ * @license lucide-react v0.511.0 - ISC
174
+ *
175
+ * This source code is licensed under the ISC license.
176
+ * See the LICENSE file in the root directory of this source tree.
177
+ */const ES=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Dm=De("eye",ES);/**
178
+ * @license lucide-react v0.511.0 - ISC
179
+ *
180
+ * This source code is licensed under the ISC license.
181
+ * See the LICENSE file in the root directory of this source tree.
182
+ */const SS=[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]],kS=De("file-audio",SS);/**
183
+ * @license lucide-react v0.511.0 - ISC
184
+ *
185
+ * This source code is licensed under the ISC license.
186
+ * See the LICENSE file in the root directory of this source tree.
187
+ */const CS=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],_S=De("file-code",CS);/**
188
+ * @license lucide-react v0.511.0 - ISC
189
+ *
190
+ * This source code is licensed under the ISC license.
191
+ * See the LICENSE file in the root directory of this source tree.
192
+ */const TS=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]],AS=De("file-image",TS);/**
193
+ * @license lucide-react v0.511.0 - ISC
194
+ *
195
+ * This source code is licensed under the ISC license.
196
+ * See the LICENSE file in the root directory of this source tree.
197
+ */const NS=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],jS=De("file-json",NS);/**
198
+ * @license lucide-react v0.511.0 - ISC
199
+ *
200
+ * This source code is licensed under the ISC license.
201
+ * See the LICENSE file in the root directory of this source tree.
202
+ */const IS=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]],RS=De("file-spreadsheet",IS);/**
203
+ * @license lucide-react v0.511.0 - ISC
204
+ *
205
+ * This source code is licensed under the ISC license.
206
+ * See the LICENSE file in the root directory of this source tree.
207
+ */const MS=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],qs=De("file-text",MS);/**
208
+ * @license lucide-react v0.511.0 - ISC
209
+ *
210
+ * This source code is licensed under the ISC license.
211
+ * See the LICENSE file in the root directory of this source tree.
212
+ */const PS=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Bd=De("file",PS);/**
213
+ * @license lucide-react v0.511.0 - ISC
214
+ *
215
+ * This source code is licensed under the ISC license.
216
+ * See the LICENSE file in the root directory of this source tree.
217
+ */const DS=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Hd=De("git-merge",DS);/**
218
+ * @license lucide-react v0.511.0 - ISC
219
+ *
220
+ * This source code is licensed under the ISC license.
221
+ * See the LICENSE file in the root directory of this source tree.
222
+ */const OS=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],LS=De("grid-3x3",OS);/**
223
+ * @license lucide-react v0.511.0 - ISC
224
+ *
225
+ * This source code is licensed under the ISC license.
226
+ * See the LICENSE file in the root directory of this source tree.
227
+ */const $S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],gu=De("info",$S);/**
228
+ * @license lucide-react v0.511.0 - ISC
229
+ *
230
+ * This source code is licensed under the ISC license.
231
+ * See the LICENSE file in the root directory of this source tree.
232
+ */const FS=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],Vd=De("key",FS);/**
233
+ * @license lucide-react v0.511.0 - ISC
234
+ *
235
+ * This source code is licensed under the ISC license.
236
+ * See the LICENSE file in the root directory of this source tree.
237
+ */const zS=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],BS=De("link",zS);/**
238
+ * @license lucide-react v0.511.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const HS=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Om=De("loader-circle",HS);/**
243
+ * @license lucide-react v0.511.0 - ISC
244
+ *
245
+ * This source code is licensed under the ISC license.
246
+ * See the LICENSE file in the root directory of this source tree.
247
+ */const VS=[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]],US=De("message-circle",VS);/**
248
+ * @license lucide-react v0.511.0 - ISC
249
+ *
250
+ * This source code is licensed under the ISC license.
251
+ * See the LICENSE file in the root directory of this source tree.
252
+ */const WS=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Rs=De("network",WS);/**
253
+ * @license lucide-react v0.511.0 - ISC
254
+ *
255
+ * This source code is licensed under the ISC license.
256
+ * See the LICENSE file in the root directory of this source tree.
257
+ */const GS=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Lm=De("panel-left",GS);/**
258
+ * @license lucide-react v0.511.0 - ISC
259
+ *
260
+ * This source code is licensed under the ISC license.
261
+ * See the LICENSE file in the root directory of this source tree.
262
+ */const YS=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Ud=De("panel-right",YS);/**
263
+ * @license lucide-react v0.511.0 - ISC
264
+ *
265
+ * This source code is licensed under the ISC license.
266
+ * See the LICENSE file in the root directory of this source tree.
267
+ */const qS=[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]],$m=De("paperclip",qS);/**
268
+ * @license lucide-react v0.511.0 - ISC
269
+ *
270
+ * This source code is licensed under the ISC license.
271
+ * See the LICENSE file in the root directory of this source tree.
272
+ */const KS=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],XS=De("send",KS);/**
273
+ * @license lucide-react v0.511.0 - ISC
274
+ *
275
+ * This source code is licensed under the ISC license.
276
+ * See the LICENSE file in the root directory of this source tree.
277
+ */const ZS=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],QS=De("settings",ZS);/**
278
+ * @license lucide-react v0.511.0 - ISC
279
+ *
280
+ * This source code is licensed under the ISC license.
281
+ * See the LICENSE file in the root directory of this source tree.
282
+ */const JS=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],ek=De("shield",JS);/**
283
+ * @license lucide-react v0.511.0 - ISC
284
+ *
285
+ * This source code is licensed under the ISC license.
286
+ * See the LICENSE file in the root directory of this source tree.
287
+ */const tk=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Fm=De("square-pen",tk);/**
288
+ * @license lucide-react v0.511.0 - ISC
289
+ *
290
+ * This source code is licensed under the ISC license.
291
+ * See the LICENSE file in the root directory of this source tree.
292
+ */const nk=[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]],zm=De("sun-moon",nk);/**
293
+ * @license lucide-react v0.511.0 - ISC
294
+ *
295
+ * This source code is licensed under the ISC license.
296
+ * See the LICENSE file in the root directory of this source tree.
297
+ */const rk=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]],Bm=De("trash",rk);/**
298
+ * @license lucide-react v0.511.0 - ISC
299
+ *
300
+ * This source code is licensed under the ISC license.
301
+ * See the LICENSE file in the root directory of this source tree.
302
+ */const ok=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],ik=De("triangle-alert",ok);/**
303
+ * @license lucide-react v0.511.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const sk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xu=De("x",sk);/**
308
+ * @license lucide-react v0.511.0 - ISC
309
+ *
310
+ * This source code is licensed under the ISC license.
311
+ * See the LICENSE file in the root directory of this source tree.
312
+ */const ak=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]],lk=De("wrench",ak),Hm=({onClick:e,text:t="View Agent Workflow"})=>d.jsx(tt,{variant:"ghost",size:"sm",onClick:e,tooltip:t,children:d.jsx(Rs,{className:"h-4 w-4"})}),Vm=m.forwardRef(({className:e,...t},n)=>d.jsx("textarea",{className:He("flex min-h-[80px] w-full rounded-md border px-3 py-2 placeholder:opacity-75 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Vm.displayName="Textarea";var fl={exports:{}},pl={};/**
313
+ * @license React
314
+ * use-sync-external-store-shim.production.js
315
+ *
316
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
317
+ *
318
+ * This source code is licensed under the MIT license found in the
319
+ * LICENSE file in the root directory of this source tree.
320
+ */var Wd;function ck(){if(Wd)return pl;Wd=1;var e=Ea();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(f,p){var h=p(),x=r({inst:{value:h,getSnapshot:p}}),g=x[0].inst,y=x[1];return i(function(){g.value=h,g.getSnapshot=p,l(g)&&y({inst:g})},[f,h,p]),o(function(){return l(g)&&y({inst:g}),f(function(){l(g)&&y({inst:g})})},[f]),s(h),h}function l(f){var p=f.getSnapshot;f=f.value;try{var h=p();return!n(f,h)}catch{return!0}}function c(f,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return pl.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,pl}var Gd;function uk(){return Gd||(Gd=1,fl.exports=ck()),fl.exports}var hl="focusScope.autoFocusOnMount",ml="focusScope.autoFocusOnUnmount",Yd={bubbles:!1,cancelable:!0},dk="FocusScope",Na=m.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=m.useState(null),c=fr(o),u=fr(i),f=m.useRef(null),p=pt(t,g=>l(g)),h=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(r){let g=function(w){if(h.paused||!a)return;const S=w.target;a.contains(S)?f.current=S:sr(f.current,{select:!0})},y=function(w){if(h.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||sr(f.current,{select:!0}))},v=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&sr(a)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const b=new MutationObserver(v);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,h.paused]),m.useEffect(()=>{if(a){Kd.add(h);const g=document.activeElement;if(!a.contains(g)){const v=new CustomEvent(hl,Yd);a.addEventListener(hl,c),a.dispatchEvent(v),v.defaultPrevented||(fk(xk(Um(a)),{select:!0}),document.activeElement===g&&sr(a))}return()=>{a.removeEventListener(hl,c),setTimeout(()=>{const v=new CustomEvent(ml,Yd);a.addEventListener(ml,u),a.dispatchEvent(v),v.defaultPrevented||sr(g??document.body,{select:!0}),a.removeEventListener(ml,u),Kd.remove(h)},0)}}},[a,c,u,h]);const x=m.useCallback(g=>{if(!n&&!r||h.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,v=document.activeElement;if(y&&v){const b=g.currentTarget,[w,S]=pk(b);w&&S?!g.shiftKey&&v===S?(g.preventDefault(),n&&sr(w,{select:!0})):g.shiftKey&&v===w&&(g.preventDefault(),n&&sr(S,{select:!0})):v===b&&g.preventDefault()}},[n,r,h.paused]);return d.jsx(Ye.div,{tabIndex:-1,...s,ref:p,onKeyDown:x})});Na.displayName=dk;function fk(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(sr(r,{select:t}),document.activeElement!==n)return}function pk(e){const t=Um(e),n=qd(t,e),r=qd(t.reverse(),e);return[n,r]}function Um(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function qd(e,t){for(const n of e)if(!hk(n,{upTo:t}))return n}function hk(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mk(e){return e instanceof HTMLInputElement&&"select"in e}function sr(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mk(e)&&t&&e.select()}}var Kd=gk();function gk(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Xd(e,t),e.unshift(t)},remove(t){var n;e=Xd(e,t),(n=e[0])==null||n.resume()}}}function Xd(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xk(e){return e.filter(t=>t.tagName!=="A")}var gl=0;function yu(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Zd()),document.body.insertAdjacentElement("beforeend",e[1]??Zd()),gl++,()=>{gl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gl--}},[])}function Zd(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var _n=function(){return _n=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_n.apply(this,arguments)};function Wm(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function yk(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Ms="right-scroll-bar-position",Ps="width-before-scroll-bar",vk="with-scroll-bars-hidden",wk="--removed-body-scroll-bar-size";function xl(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function bk(e,t){var n=m.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ek=typeof window<"u"?m.useLayoutEffect:m.useEffect,Qd=new WeakMap;function Sk(e,t){var n=bk(null,function(r){return e.forEach(function(o){return xl(o,r)})});return Ek(function(){var r=Qd.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||xl(a,null)}),i.forEach(function(a){o.has(a)||xl(a,s)})}Qd.set(n,e)},[e]),n}function kk(e){return e}function Ck(e,t){t===void 0&&(t=kk);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var l=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function _k(e){e===void 0&&(e={});var t=Ck(null);return t.options=_n({async:!0,ssr:!1},e),t}var Gm=function(e){var t=e.sideCar,n=Wm(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return m.createElement(r,_n({},n))};Gm.isSideCarExport=!0;function Tk(e,t){return e.useMedium(t),Gm}var Ym=_k(),yl=function(){},ja=m.forwardRef(function(e,t){var n=m.useRef(null),r=m.useState({onScrollCapture:yl,onWheelCapture:yl,onTouchMoveCapture:yl}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,f=e.shards,p=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,y=e.allowPinchZoom,v=e.as,b=v===void 0?"div":v,w=e.gapMode,S=Wm(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=p,C=Sk([n,t]),k=_n(_n({},S),o);return m.createElement(m.Fragment,null,u&&m.createElement(E,{sideCar:Ym,removeScrollBar:c,shards:f,noRelative:h,noIsolation:x,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:w}),s?m.cloneElement(m.Children.only(a),_n(_n({},k),{ref:C})):m.createElement(b,_n({},k,{className:l,ref:C}),a))});ja.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ja.classNames={fullWidth:Ps,zeroRight:Ms};var Ak=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Nk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ak();return t&&e.setAttribute("nonce",t),e}function jk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ik(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Rk=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Nk())&&(jk(t,n),Ik(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Mk=function(){var e=Rk();return function(t,n){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},qm=function(){var e=Mk(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Pk={left:0,top:0,right:0,gap:0},vl=function(e){return parseInt(e||"",10)||0},Dk=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[vl(n),vl(r),vl(o)]},Ok=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Pk;var t=Dk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Lk=qm(),wo="data-scroll-locked",$k=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
321
+ .`.concat(vk,` {
322
+ overflow: hidden `).concat(r,`;
323
+ padding-right: `).concat(a,"px ").concat(r,`;
324
+ }
325
+ body[`).concat(wo,`] {
326
+ overflow: hidden `).concat(r,`;
327
+ overscroll-behavior: contain;
328
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
329
+ padding-left: `.concat(o,`px;
330
+ padding-top: `).concat(i,`px;
331
+ padding-right: `).concat(s,`px;
332
+ margin-left:0;
333
+ margin-top:0;
334
+ margin-right: `).concat(a,"px ").concat(r,`;
335
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
336
+ }
337
+
338
+ .`).concat(Ms,` {
339
+ right: `).concat(a,"px ").concat(r,`;
340
+ }
341
+
342
+ .`).concat(Ps,` {
343
+ margin-right: `).concat(a,"px ").concat(r,`;
344
+ }
345
+
346
+ .`).concat(Ms," .").concat(Ms,` {
347
+ right: 0 `).concat(r,`;
348
+ }
349
+
350
+ .`).concat(Ps," .").concat(Ps,` {
351
+ margin-right: 0 `).concat(r,`;
352
+ }
353
+
354
+ body[`).concat(wo,`] {
355
+ `).concat(wk,": ").concat(a,`px;
356
+ }
357
+ `)},Jd=function(){var e=parseInt(document.body.getAttribute(wo)||"0",10);return isFinite(e)?e:0},Fk=function(){m.useEffect(function(){return document.body.setAttribute(wo,(Jd()+1).toString()),function(){var e=Jd()-1;e<=0?document.body.removeAttribute(wo):document.body.setAttribute(wo,e.toString())}},[])},zk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Fk();var i=m.useMemo(function(){return Ok(o)},[o]);return m.createElement(Lk,{styles:$k(i,!t,o,n?"":"!important")})},lc=!1;if(typeof window<"u")try{var us=Object.defineProperty({},"passive",{get:function(){return lc=!0,!0}});window.addEventListener("test",us,us),window.removeEventListener("test",us,us)}catch{lc=!1}var to=lc?{passive:!1}:!1,Bk=function(e){return e.tagName==="TEXTAREA"},Km=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Bk(e)&&n[t]==="visible")},Hk=function(e){return Km(e,"overflowY")},Vk=function(e){return Km(e,"overflowX")},ef=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Xm(e,r);if(o){var i=Zm(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Uk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Wk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Xm=function(e,t){return e==="v"?Hk(t):Vk(t)},Zm=function(e,t){return e==="v"?Uk(t):Wk(t)},Gk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Yk=function(e,t,n,r,o){var i=Gk(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),c=!1,u=s>0,f=0,p=0;do{if(!a)break;var h=Zm(e,a),x=h[0],g=h[1],y=h[2],v=g-y-i*x;(x||v)&&Xm(e,a)&&(f+=v,p+=x);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&Math.abs(f)<1||!u&&Math.abs(p)<1)&&(c=!0),c},ds=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},tf=function(e){return[e.deltaX,e.deltaY]},nf=function(e){return e&&"current"in e?e.current:e},qk=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Kk=function(e){return`
358
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
359
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
360
+ `)},Xk=0,no=[];function Zk(e){var t=m.useRef([]),n=m.useRef([0,0]),r=m.useRef(),o=m.useState(Xk++)[0],i=m.useState(qm)[0],s=m.useRef(e);m.useEffect(function(){s.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=yk([e.lockRef.current],(e.shards||[]).map(nf),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=m.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!s.current.allowPinchZoom;var v=ds(g),b=n.current,w="deltaX"in g?g.deltaX:b[0]-v[0],S="deltaY"in g?g.deltaY:b[1]-v[1],E,C=g.target,k=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in g&&k==="h"&&C.type==="range")return!1;var T=ef(k,C);if(!T)return!0;if(T?E=k:(E=k==="v"?"h":"v",T=ef(k,C)),!T)return!1;if(!r.current&&"changedTouches"in g&&(w||S)&&(r.current=E),!E)return!0;var P=r.current||E;return Yk(P,y,g,P==="h"?w:S)},[]),l=m.useCallback(function(g){var y=g;if(!(!no.length||no[no.length-1]!==i)){var v="deltaY"in y?tf(y):ds(y),b=t.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&qk(E.delta,v)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var w=(s.current.shards||[]).map(nf).filter(Boolean).filter(function(E){return E.contains(y.target)}),S=w.length>0?a(y,w[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),c=m.useCallback(function(g,y,v,b){var w={name:g,delta:y,target:v,should:b,shadowParent:Qk(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),u=m.useCallback(function(g){n.current=ds(g),r.current=void 0},[]),f=m.useCallback(function(g){c(g.type,tf(g),g.target,a(g,e.lockRef.current))},[]),p=m.useCallback(function(g){c(g.type,ds(g),g.target,a(g,e.lockRef.current))},[]);m.useEffect(function(){return no.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),document.addEventListener("wheel",l,to),document.addEventListener("touchmove",l,to),document.addEventListener("touchstart",u,to),function(){no=no.filter(function(g){return g!==i}),document.removeEventListener("wheel",l,to),document.removeEventListener("touchmove",l,to),document.removeEventListener("touchstart",u,to)}},[]);var h=e.removeScrollBar,x=e.inert;return m.createElement(m.Fragment,null,x?m.createElement(i,{styles:Kk(o)}):null,h?m.createElement(zk,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Qk(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Jk=Tk(Ym,Zk);var Ia=m.forwardRef(function(e,t){return m.createElement(ja,_n({},e,{ref:t,sideCar:Jk}))});Ia.classNames=ja.classNames;var eC=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ro=new WeakMap,fs=new WeakMap,ps={},wl=0,Qm=function(e){return e&&(e.host||Qm(e.parentNode))},tC=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Qm(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},nC=function(e,t,n,r){var o=tC(t,Array.isArray(e)?e:[e]);ps[n]||(ps[n]=new WeakMap);var i=ps[n],s=[],a=new Set,l=new Set(o),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};o.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(a.has(p))u(p);else try{var h=p.getAttribute(r),x=h!==null&&h!=="false",g=(ro.get(p)||0)+1,y=(i.get(p)||0)+1;ro.set(p,g),i.set(p,y),s.push(p),g===1&&x&&fs.set(p,!0),y===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",p,v)}})};return u(t),a.clear(),wl++,function(){s.forEach(function(f){var p=ro.get(f)-1,h=i.get(f)-1;ro.set(f,p),i.set(f,h),p||(fs.has(f)||f.removeAttribute(r),fs.delete(f)),h||f.removeAttribute(n)}),wl--,wl||(ro=new WeakMap,ro=new WeakMap,fs=new WeakMap,ps={})}},vu=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=eC(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),nC(r,o,n,"aria-hidden")):function(){return null}},Ra="Dialog",[Jm,L5]=vr(Ra),[rC,En]=Jm(Ra),eg=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=m.useRef(null),l=m.useRef(null),[c,u]=zr({prop:r,defaultProp:o??!1,onChange:i,caller:Ra});return d.jsx(rC,{scope:t,triggerRef:a,contentRef:l,contentId:jn(),titleId:jn(),descriptionId:jn(),open:c,onOpenChange:u,onOpenToggle:m.useCallback(()=>u(f=>!f),[u]),modal:s,children:n})};eg.displayName=Ra;var tg="DialogTrigger",oC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(tg,n),i=pt(t,o.triggerRef);return d.jsx(Ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Eu(o.open),...r,ref:i,onClick:Me(e.onClick,o.onOpenToggle)})});oC.displayName=tg;var wu="DialogPortal",[iC,ng]=Jm(wu,{forceMount:void 0}),rg=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=En(wu,t);return d.jsx(iC,{scope:t,forceMount:n,children:m.Children.map(r,s=>d.jsx(Zn,{present:n||i.open,children:d.jsx(qi,{asChild:!0,container:o,children:s})}))})};rg.displayName=wu;var Ks="DialogOverlay",og=m.forwardRef((e,t)=>{const n=ng(Ks,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En(Ks,e.__scopeDialog);return i.modal?d.jsx(Zn,{present:r||i.open,children:d.jsx(aC,{...o,ref:t})}):null});og.displayName=Ks;var sC=$r("DialogOverlay.RemoveScroll"),aC=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(Ks,n);return d.jsx(Ia,{as:sC,allowPinchZoom:!0,shards:[o.contentRef],children:d.jsx(Ye.div,{"data-state":Eu(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Br="DialogContent",ig=m.forwardRef((e,t)=>{const n=ng(Br,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En(Br,e.__scopeDialog);return d.jsx(Zn,{present:r||i.open,children:i.modal?d.jsx(lC,{...o,ref:t}):d.jsx(cC,{...o,ref:t})})});ig.displayName=Br;var lC=m.forwardRef((e,t)=>{const n=En(Br,e.__scopeDialog),r=m.useRef(null),o=pt(t,n.contentRef,r);return m.useEffect(()=>{const i=r.current;if(i)return vu(i)},[]),d.jsx(sg,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:Me(e.onFocusOutside,i=>i.preventDefault())})}),cC=m.forwardRef((e,t)=>{const n=En(Br,e.__scopeDialog),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(sg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),sg=m.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=En(Br,n),l=m.useRef(null),c=pt(t,l);return yu(),d.jsxs(d.Fragment,{children:[d.jsx(Na,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Gi,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Eu(a.open),...s,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(uC,{titleId:a.titleId}),d.jsx(fC,{contentRef:l,descriptionId:a.descriptionId})]})]})}),bu="DialogTitle",ag=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(bu,n);return d.jsx(Ye.h2,{id:o.titleId,...r,ref:t})});ag.displayName=bu;var lg="DialogDescription",cg=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(lg,n);return d.jsx(Ye.p,{id:o.descriptionId,...r,ref:t})});cg.displayName=lg;var ug="DialogClose",dg=m.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(ug,n);return d.jsx(Ye.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,()=>o.onOpenChange(!1))})});dg.displayName=ug;function Eu(e){return e?"open":"closed"}var fg="DialogTitleWarning",[$5,pg]=Rb(fg,{contentName:Br,titleName:bu,docsSlug:"dialog"}),uC=({titleId:e})=>{const t=pg(fg),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
361
+
362
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
363
+
364
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return m.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},dC="DialogDescriptionWarning",fC=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${pg(dC).contentName}}.`;return m.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},pC=eg,hC=rg,mC=og,gC=ig,xC=ag,yC=cg,vC=dg;function hg({...e}){return d.jsx(pC,{"data-slot":"dialog",...e})}function wC({...e}){return d.jsx(hC,{"data-slot":"dialog-portal",...e})}function bC({className:e,...t}){return d.jsx(mC,{"data-slot":"dialog-overlay",className:He("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function mg({className:e,children:t,showCloseButton:n=!0,...r}){return d.jsxs(wC,{"data-slot":"dialog-portal",children:[d.jsx(bC,{}),d.jsxs(gC,{"data-slot":"dialog-content",className:He("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,n&&d.jsxs(vC,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[d.jsx(xu,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function gg({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-header",className:He("flex flex-col gap-2 text-center sm:text-left",e),...t})}function xg({className:e,...t}){return d.jsx(xC,{"data-slot":"dialog-title",className:He("text-lg leading-none font-semibold",e),...t})}function yg({className:e,...t}){return d.jsx(yC,{"data-slot":"dialog-description",className:He("py-4 text-sm",e),...t})}const Ma=m.createContext(null);Ma.displayName="PanelGroupContext";const St={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Su=10,Pr=m.useLayoutEffect,rf=Zc.useId,EC=typeof rf=="function"?rf:()=>null;let SC=0;function ku(e=null){const t=EC(),n=m.useRef(e||t||null);return n.current===null&&(n.current=""+SC++),e??n.current}function vg({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:i,id:s,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:f,order:p,style:h,tagName:x="div",...g}){const y=m.useContext(Ma);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:v,expandPanel:b,getPanelSize:w,getPanelStyle:S,groupId:E,isPanelCollapsed:C,reevaluatePanelConstraints:k,registerPanel:T,resizePanel:P,unregisterPanel:z}=y,D=ku(s),$=m.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:f},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:a,minSize:l},id:D,idIsFromProps:s!==void 0,order:p});m.useRef({didLogMissingDefaultSizeWarning:!1}),Pr(()=>{const{callbacks:_,constraints:N}=$.current,A={...N};$.current.id=D,$.current.idIsFromProps=s!==void 0,$.current.order=p,_.onCollapse=c,_.onExpand=u,_.onResize=f,N.collapsedSize=n,N.collapsible=r,N.defaultSize=o,N.maxSize=a,N.minSize=l,(A.collapsedSize!==N.collapsedSize||A.collapsible!==N.collapsible||A.maxSize!==N.maxSize||A.minSize!==N.minSize)&&k($.current,A)}),Pr(()=>{const _=$.current;return T(_),()=>{z(_)}},[p,D,T,z]),m.useImperativeHandle(i,()=>({collapse:()=>{v($.current)},expand:_=>{b($.current,_)},getId(){return D},getSize(){return w($.current)},isCollapsed(){return C($.current)},isExpanded(){return!C($.current)},resize:_=>{P($.current,_)}}),[v,b,w,C,D,P]);const M=S($.current,o);return m.createElement(x,{...g,children:e,className:t,id:D,style:{...M,...h},[St.groupId]:E,[St.panel]:"",[St.panelCollapsible]:r||void 0,[St.panelId]:D,[St.panelSize]:parseFloat(""+M.flexGrow).toFixed(1)})}const wg=m.forwardRef((e,t)=>m.createElement(vg,{...e,forwardedRef:t}));vg.displayName="Panel";wg.displayName="forwardRef(Panel)";let cc=null,Ds=-1,ar=null;function kC(e,t){if(t){const n=(t&Cg)!==0,r=(t&_g)!==0,o=(t&Tg)!==0,i=(t&Ag)!==0;if(n)return o?"se-resize":i?"ne-resize":"e-resize";if(r)return o?"sw-resize":i?"nw-resize":"w-resize";if(o)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function CC(){ar!==null&&(document.head.removeChild(ar),cc=null,ar=null,Ds=-1)}function bl(e,t){var n,r;const o=kC(e,t);if(cc!==o){if(cc=o,ar===null&&(ar=document.createElement("style"),document.head.appendChild(ar)),Ds>=0){var i;(i=ar.sheet)===null||i===void 0||i.removeRule(Ds)}Ds=(n=(r=ar.sheet)===null||r===void 0?void 0:r.insertRule(`*{cursor: ${o} !important;}`))!==null&&n!==void 0?n:-1}}function bg(e){return e.type==="keydown"}function Eg(e){return e.type.startsWith("pointer")}function Sg(e){return e.type.startsWith("mouse")}function Pa(e){if(Eg(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Sg(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function _C(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function TC(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function AC(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:af(e),b:af(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Fe(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:sf(of(n.a)),b:sf(of(n.b))};if(o.a===o.b){const i=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(o.a-o.b)}const NC=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function jC(e){var t;const n=getComputedStyle((t=kg(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function IC(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||jC(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||NC.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function of(e){let t=e.length;for(;t--;){const n=e[t];if(Fe(n,"Missing node"),IC(n))return n}return null}function sf(e){return e&&Number(getComputedStyle(e).zIndex)||0}function af(e){const t=[];for(;e;)t.push(e),e=kg(e);return t}function kg(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Cg=1,_g=2,Tg=4,Ag=8,RC=_C()==="coarse";let vn=[],bo=!1,lr=new Map,Da=new Map;const ji=new Set;function MC(e,t,n,r,o){var i;const{ownerDocument:s}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},l=(i=lr.get(s))!==null&&i!==void 0?i:0;return lr.set(s,l+1),ji.add(a),Xs(),function(){var u;Da.delete(e),ji.delete(a);const f=(u=lr.get(s))!==null&&u!==void 0?u:1;if(lr.set(s,f-1),Xs(),f===1&&lr.delete(s),vn.includes(a)){const p=vn.indexOf(a);p>=0&&vn.splice(p,1),_u(),o("up",!0,null)}}}function PC(e){const{target:t}=e,{x:n,y:r}=Pa(e);bo=!0,Cu({target:t,x:n,y:r}),Xs(),vn.length>0&&(Zs("down",e),e.preventDefault(),Ng(t)||e.stopImmediatePropagation())}function El(e){const{x:t,y:n}=Pa(e);if(bo&&e.buttons===0&&(bo=!1,Zs("up",e)),!bo){const{target:r}=e;Cu({target:r,x:t,y:n})}Zs("move",e),_u(),vn.length>0&&e.preventDefault()}function Sl(e){const{target:t}=e,{x:n,y:r}=Pa(e);Da.clear(),bo=!1,vn.length>0&&(e.preventDefault(),Ng(t)||e.stopImmediatePropagation()),Zs("up",e),Cu({target:t,x:n,y:r}),_u(),Xs()}function Ng(e){let t=e;for(;t;){if(t.hasAttribute(St.resizeHandle))return!0;t=t.parentElement}return!1}function Cu({target:e,x:t,y:n}){vn.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),ji.forEach(o=>{const{element:i,hitAreaMargins:s}=o,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:f}=a,p=RC?s.coarse:s.fine;if(t>=c-p&&t<=u+p&&n>=f-p&&n<=l+p){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&AC(r,i)>0){let x=r,g=!1;for(;x&&!x.contains(i);){if(TC(x.getBoundingClientRect(),a)){g=!0;break}x=x.parentElement}if(g)return}vn.push(o)}})}function kl(e,t){Da.set(e,t)}function _u(){let e=!1,t=!1;vn.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Da.forEach(r=>{n|=r}),e&&t?bl("intersection",n):e?bl("horizontal",n):t?bl("vertical",n):CC()}let Cl;function Xs(){var e;(e=Cl)===null||e===void 0||e.abort(),Cl=new AbortController;const t={capture:!0,signal:Cl.signal};ji.size&&(bo?(vn.length>0&&lr.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Sl,t),o.addEventListener("pointerleave",El,t),o.addEventListener("pointermove",El,t))}),lr.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Sl,t),o.addEventListener("pointercancel",Sl,t)})):lr.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",PC,t),o.addEventListener("pointermove",El,t))}))}function Zs(e,t){ji.forEach(n=>{const{setResizeHandlerState:r}=n,o=vn.includes(n);r(e,o,t)})}function DC(){const[e,t]=m.useState(0);return m.useCallback(()=>t(n=>n+1),[])}function Fe(e,t){if(!e)throw console.error(t),Error(t)}function Hr(e,t,n=Su){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Hn(e,t,n=Su){return Hr(e,t,n)===0}function tn(e,t,n){return Hr(e,t,n)===0}function OC(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],i=t[r];if(!tn(o,i,n))return!1}return!0}function ho({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Fe(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:i,maxSize:s=100,minSize:a=0}=r;if(Hr(n,a)<0)if(i){const l=(o+a)/2;Hr(n,l)<0?n=o:n=a}else n=a;return n=Math.min(s,n),n=parseFloat(n.toFixed(Su)),n}function xi({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:i}){if(tn(e,0))return t;const s=[...t],[a,l]=r;Fe(a!=null,"Invalid first pivot index"),Fe(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const f=e<0?l:a,p=n[f];Fe(p,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=p;if(x){const y=t[f];if(Fe(y!=null,`Previous layout not found for panel index ${f}`),tn(y,h)){const v=g-y;Hr(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}{const f=e<0?a:l,p=n[f];Fe(p,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=p;if(x){const y=t[f];if(Fe(y!=null,`Previous layout not found for panel index ${f}`),tn(y,g)){const v=y-h;Hr(v,Math.abs(e))>0&&(e=e<0?0-v:v)}}}}{const f=e<0?1:-1;let p=e<0?l:a,h=0;for(;;){const g=t[p];Fe(g!=null,`Previous layout not found for panel index ${p}`);const v=ho({panelConstraints:n,panelIndex:p,size:100})-g;if(h+=v,p+=f,p<0||p>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-x:x}{let p=e<0?a:l;for(;p>=0&&p<n.length;){const h=Math.abs(e)-Math.abs(c),x=t[p];Fe(x!=null,`Previous layout not found for panel index ${p}`);const g=x-h,y=ho({panelConstraints:n,panelIndex:p,size:g});if(!tn(x,y)&&(c+=x-y,s[p]=y,c.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?p--:p++}}if(OC(o,s))return o;{const f=e<0?l:a,p=t[f];Fe(p!=null,`Previous layout not found for panel index ${f}`);const h=p+c,x=ho({panelConstraints:n,panelIndex:f,size:h});if(s[f]=x,!tn(x,h)){let g=h-x,v=e<0?l:a;for(;v>=0&&v<n.length;){const b=s[v];Fe(b!=null,`Previous layout not found for panel index ${v}`);const w=b+g,S=ho({panelConstraints:n,panelIndex:v,size:w});if(tn(b,S)||(g-=S-b,s[v]=S),tn(g,0))break;e>0?v--:v++}}}const u=s.reduce((f,p)=>p+f,0);return tn(u,100)?s:o}function LC({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,i=0,s=0;const a=n[0];Fe(a!=null,"No pivot index found"),t.forEach((f,p)=>{const{constraints:h}=f,{maxSize:x=100,minSize:g=0}=h;p===a?(r=g,o=x):(i+=g,s+=x)});const l=Math.min(o,100-i),c=Math.max(r,100-s),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function Ii(e,t=document){return Array.from(t.querySelectorAll(`[${St.resizeHandleId}][data-panel-group-id="${e}"]`))}function jg(e,t,n=document){const o=Ii(e,n).findIndex(i=>i.getAttribute(St.resizeHandleId)===t);return o??null}function Ig(e,t,n){const r=jg(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function $C(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Rg(e,t=document){if($C(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function Oa(e,t=document){const n=t.querySelector(`[${St.resizeHandleId}="${e}"]`);return n||null}function FC(e,t,n,r=document){var o,i,s,a;const l=Oa(t,r),c=Ii(e,r),u=l?c.indexOf(l):-1,f=(o=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&o!==void 0?o:null,p=(s=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&s!==void 0?s:null;return[f,p]}function zC({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:i,setLayout:s}){m.useRef({didWarnAboutMissingResizeHandle:!1}),Pr(()=>{if(!i)return;const a=Ii(n,i);for(let l=0;l<o.length-1;l++){const{valueMax:c,valueMin:u,valueNow:f}=LC({layout:r,panelsArray:o,pivotIndices:[l,l+1]}),p=a[l];if(p!=null){const h=o[l];Fe(h,`No panel data found for index "${l}"`),p.setAttribute("aria-controls",h.id),p.setAttribute("aria-valuemax",""+Math.round(c)),p.setAttribute("aria-valuemin",""+Math.round(u)),p.setAttribute("aria-valuenow",f!=null?""+Math.round(f):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,o,i]),m.useEffect(()=>{if(!i)return;const a=t.current;Fe(a,"Eager values not found");const{panelDataArray:l}=a,c=Rg(n,i);Fe(c!=null,`No group found for id "${n}"`);const u=Ii(n,i);Fe(u,`No resize handles found for group id "${n}"`);const f=u.map(p=>{const h=p.getAttribute(St.resizeHandleId);Fe(h,"Resize handle element has no handle id attribute");const[x,g]=FC(n,h,l,i);if(x==null||g==null)return()=>{};const y=v=>{if(!v.defaultPrevented)switch(v.key){case"Enter":{v.preventDefault();const b=l.findIndex(w=>w.id===x);if(b>=0){const w=l[b];Fe(w,`No panel data found for index ${b}`);const S=r[b],{collapsedSize:E=0,collapsible:C,minSize:k=0}=w.constraints;if(S!=null&&C){const T=xi({delta:tn(S,E)?k-E:E-S,initialLayout:r,panelConstraints:l.map(P=>P.constraints),pivotIndices:Ig(n,h,i),prevLayout:r,trigger:"keyboard"});r!==T&&s(T)}}break}}};return p.addEventListener("keydown",y),()=>{p.removeEventListener("keydown",y)}});return()=>{f.forEach(p=>p())}},[i,e,t,n,r,o,s])}function lf(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Mg(e,t){const n=e==="horizontal",{x:r,y:o}=Pa(t);return n?r:o}function BC(e,t,n,r,o){const i=n==="horizontal",s=Oa(t,o);Fe(s,`No resize handle element found for id "${t}"`);const a=s.getAttribute(St.groupId);Fe(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=Mg(n,e),u=Rg(a,o);Fe(u,`No group element found for id "${a}"`);const f=u.getBoundingClientRect(),p=i?f.width:f.height;return(c-l)/p*100}function HC(e,t,n,r,o,i){if(bg(e)){const s=n==="horizontal";let a=0;e.shiftKey?a=100:o!=null?a=o:a=10;let l=0;switch(e.key){case"ArrowDown":l=s?0:a;break;case"ArrowLeft":l=s?-a:0;break;case"ArrowRight":l=s?a:0;break;case"ArrowUp":l=s?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:BC(e,t,n,r,i)}function VC({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,o=100;for(let i=0;i<e.length;i++){const s=n[i];Fe(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;a!=null&&(r++,t[i]=a,o-=a)}for(let i=0;i<e.length;i++){const s=n[i];Fe(s,`Panel constraints not found for index ${i}`);const{defaultSize:a}=s;if(a!=null)continue;const l=e.length-r,c=o/l;r++,t[i]=c,o-=c}return t}function oo(e,t,n){t.forEach((r,o)=>{const i=e[o];Fe(i,`Panel data not found for index ${o}`);const{callbacks:s,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,f=n[l];if(f==null||r!==f){n[l]=r;const{onCollapse:p,onExpand:h,onResize:x}=s;x&&x(r,f),u&&(p||h)&&(h&&(f==null||Hn(f,c))&&!Hn(r,c)&&h(),p&&(f==null||!Hn(f,c))&&Hn(r,c)&&p())}})}function hs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function UC({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:i=3}){const s=n[o];let a;return s==null?a=e!=null?e.toPrecision(i):"1":r.length===1?a="1":a=s.toPrecision(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function WC(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function cf(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Pg(e){return`react-resizable-panels:${e}`}function Dg(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:i}=t;return o?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Og(e,t){try{const n=Pg(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function GC(e,t,n){var r,o;const i=(r=Og(e,n))!==null&&r!==void 0?r:{},s=Dg(t);return(o=i[s])!==null&&o!==void 0?o:null}function YC(e,t,n,r,o){var i;const s=Pg(e),a=Dg(t),l=(i=Og(e,o))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(s,JSON.stringify(l))}catch(c){console.error(c)}}function uf({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,s)=>i+s,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!tn(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const s=n[i];Fe(s!=null,`No layout data found for index ${i}`);const a=100/r*s;n[i]=a}let o=0;for(let i=0;i<t.length;i++){const s=n[i];Fe(s!=null,`No layout data found for index ${i}`);const a=ho({panelConstraints:t,panelIndex:i,size:s});s!=a&&(o+=s-a,n[i]=a)}if(!tn(o,0))for(let i=0;i<t.length;i++){const s=n[i];Fe(s!=null,`No layout data found for index ${i}`);const a=s+o,l=ho({panelConstraints:t,panelIndex:i,size:a});if(s!==l&&(o-=l-s,n[i]=l,tn(o,0)))break}return n}const qC=100,yi={getItem:e=>(cf(yi),yi.getItem(e)),setItem:(e,t)=>{cf(yi),yi.setItem(e,t)}},df={};function Lg({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:i=null,onLayout:s=null,keyboardResizeBy:a=null,storage:l=yi,style:c,tagName:u="div",...f}){const p=ku(i),h=m.useRef(null),[x,g]=m.useState(null),[y,v]=m.useState([]),b=DC(),w=m.useRef({}),S=m.useRef(new Map),E=m.useRef(0),C=m.useRef({autoSaveId:e,direction:r,dragState:x,id:p,keyboardResizeBy:a,onLayout:s,storage:l}),k=m.useRef({layout:y,panelDataArray:[],panelDataArrayChanged:!1});m.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),m.useImperativeHandle(o,()=>({getId:()=>C.current.id,getLayout:()=>{const{layout:H}=k.current;return H},setLayout:H=>{const{onLayout:V}=C.current,{layout:U,panelDataArray:G}=k.current,B=uf({layout:H,panelConstraints:G.map(W=>W.constraints)});lf(U,B)||(v(B),k.current.layout=B,V&&V(B),oo(G,B,w.current))}}),[]),Pr(()=>{C.current.autoSaveId=e,C.current.direction=r,C.current.dragState=x,C.current.id=p,C.current.onLayout=s,C.current.storage=l}),zC({committedValuesRef:C,eagerValuesRef:k,groupId:p,layout:y,panelDataArray:k.current.panelDataArray,setLayout:v,panelGroupElement:h.current}),m.useEffect(()=>{const{panelDataArray:H}=k.current;if(e){if(y.length===0||y.length!==H.length)return;let V=df[e];V==null&&(V=WC(YC,qC),df[e]=V);const U=[...H],G=new Map(S.current);V(e,U,G,y,l)}},[e,y,l]),m.useEffect(()=>{});const T=m.useCallback(H=>{const{onLayout:V}=C.current,{layout:U,panelDataArray:G}=k.current;if(H.constraints.collapsible){const B=G.map(se=>se.constraints),{collapsedSize:W=0,panelSize:Z,pivotIndices:ie}=kr(G,H,U);if(Fe(Z!=null,`Panel size not found for panel "${H.id}"`),!Hn(Z,W)){S.current.set(H.id,Z);const K=uo(G,H)===G.length-1?Z-W:W-Z,ne=xi({delta:K,initialLayout:U,panelConstraints:B,pivotIndices:ie,prevLayout:U,trigger:"imperative-api"});hs(U,ne)||(v(ne),k.current.layout=ne,V&&V(ne),oo(G,ne,w.current))}}},[]),P=m.useCallback((H,V)=>{const{onLayout:U}=C.current,{layout:G,panelDataArray:B}=k.current;if(H.constraints.collapsible){const W=B.map(q=>q.constraints),{collapsedSize:Z=0,panelSize:ie=0,minSize:se=0,pivotIndices:K}=kr(B,H,G),ne=V??se;if(Hn(ie,Z)){const q=S.current.get(H.id),re=q!=null&&q>=ne?q:ne,pe=uo(B,H)===B.length-1?ie-re:re-ie,ee=xi({delta:pe,initialLayout:G,panelConstraints:W,pivotIndices:K,prevLayout:G,trigger:"imperative-api"});hs(G,ee)||(v(ee),k.current.layout=ee,U&&U(ee),oo(B,ee,w.current))}}},[]),z=m.useCallback(H=>{const{layout:V,panelDataArray:U}=k.current,{panelSize:G}=kr(U,H,V);return Fe(G!=null,`Panel size not found for panel "${H.id}"`),G},[]),D=m.useCallback((H,V)=>{const{panelDataArray:U}=k.current,G=uo(U,H);return UC({defaultSize:V,dragState:x,layout:y,panelData:U,panelIndex:G})},[x,y]),$=m.useCallback(H=>{const{layout:V,panelDataArray:U}=k.current,{collapsedSize:G=0,collapsible:B,panelSize:W}=kr(U,H,V);return Fe(W!=null,`Panel size not found for panel "${H.id}"`),B===!0&&Hn(W,G)},[]),M=m.useCallback(H=>{const{layout:V,panelDataArray:U}=k.current,{collapsedSize:G=0,collapsible:B,panelSize:W}=kr(U,H,V);return Fe(W!=null,`Panel size not found for panel "${H.id}"`),!B||Hr(W,G)>0},[]),_=m.useCallback(H=>{const{panelDataArray:V}=k.current;V.push(H),V.sort((U,G)=>{const B=U.order,W=G.order;return B==null&&W==null?0:B==null?-1:W==null?1:B-W}),k.current.panelDataArrayChanged=!0,b()},[b]);Pr(()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:H,onLayout:V,storage:U}=C.current,{layout:G,panelDataArray:B}=k.current;let W=null;if(H){const ie=GC(H,B,U);ie&&(S.current=new Map(Object.entries(ie.expandToSizes)),W=ie.layout)}W==null&&(W=VC({panelDataArray:B}));const Z=uf({layout:W,panelConstraints:B.map(ie=>ie.constraints)});lf(G,Z)||(v(Z),k.current.layout=Z,V&&V(Z),oo(B,Z,w.current))}}),Pr(()=>{const H=k.current;return()=>{H.layout=[]}},[]);const N=m.useCallback(H=>{let V=!1;const U=h.current;return U&&window.getComputedStyle(U,null).getPropertyValue("direction")==="rtl"&&(V=!0),function(B){B.preventDefault();const W=h.current;if(!W)return()=>null;const{direction:Z,dragState:ie,id:se,keyboardResizeBy:K,onLayout:ne}=C.current,{layout:q,panelDataArray:re}=k.current,{initialLayout:te}=ie??{},pe=Ig(se,H,W);let ee=HC(B,H,Z,ie,K,W);const Te=Z==="horizontal";Te&&V&&(ee=-ee);const Ue=re.map(et=>et.constraints),Ve=xi({delta:ee,initialLayout:te??q,panelConstraints:Ue,pivotIndices:pe,prevLayout:q,trigger:bg(B)?"keyboard":"mouse-or-touch"}),Ge=!hs(q,Ve);(Eg(B)||Sg(B))&&E.current!=ee&&(E.current=ee,!Ge&&ee!==0?Te?kl(H,ee<0?Cg:_g):kl(H,ee<0?Tg:Ag):kl(H,0)),Ge&&(v(Ve),k.current.layout=Ve,ne&&ne(Ve),oo(re,Ve,w.current))}},[]),A=m.useCallback((H,V)=>{const{onLayout:U}=C.current,{layout:G,panelDataArray:B}=k.current,W=B.map(q=>q.constraints),{panelSize:Z,pivotIndices:ie}=kr(B,H,G);Fe(Z!=null,`Panel size not found for panel "${H.id}"`);const K=uo(B,H)===B.length-1?Z-V:V-Z,ne=xi({delta:K,initialLayout:G,panelConstraints:W,pivotIndices:ie,prevLayout:G,trigger:"imperative-api"});hs(G,ne)||(v(ne),k.current.layout=ne,U&&U(ne),oo(B,ne,w.current))},[]),I=m.useCallback((H,V)=>{const{layout:U,panelDataArray:G}=k.current,{collapsedSize:B=0,collapsible:W}=V,{collapsedSize:Z=0,collapsible:ie,maxSize:se=100,minSize:K=0}=H.constraints,{panelSize:ne}=kr(G,H,U);ne!=null&&(W&&ie&&Hn(ne,B)?Hn(B,Z)||A(H,Z):ne<K?A(H,K):ne>se&&A(H,se))},[A]),j=m.useCallback((H,V)=>{const{direction:U}=C.current,{layout:G}=k.current;if(!h.current)return;const B=Oa(H,h.current);Fe(B,`Drag handle element not found for id "${H}"`);const W=Mg(U,V);g({dragHandleId:H,dragHandleRect:B.getBoundingClientRect(),initialCursorPosition:W,initialLayout:G})},[]),R=m.useCallback(()=>{g(null)},[]),O=m.useCallback(H=>{const{panelDataArray:V}=k.current,U=uo(V,H);U>=0&&(V.splice(U,1),delete w.current[H.id],k.current.panelDataArrayChanged=!0,b())},[b]),L=m.useMemo(()=>({collapsePanel:T,direction:r,dragState:x,expandPanel:P,getPanelSize:z,getPanelStyle:D,groupId:p,isPanelCollapsed:$,isPanelExpanded:M,reevaluatePanelConstraints:I,registerPanel:_,registerResizeHandle:N,resizePanel:A,startDragging:j,stopDragging:R,unregisterPanel:O,panelGroupElement:h.current}),[T,x,r,P,z,D,p,$,M,I,_,N,A,j,R,O]),Y={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return m.createElement(Ma.Provider,{value:L},m.createElement(u,{...f,children:t,className:n,id:i,ref:h,style:{...Y,...c},[St.group]:"",[St.groupDirection]:r,[St.groupId]:p}))}const $g=m.forwardRef((e,t)=>m.createElement(Lg,{...e,forwardedRef:t}));Lg.displayName="PanelGroup";$g.displayName="forwardRef(PanelGroup)";function uo(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function kr(e,t,n){const r=uo(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],s=n[r];return{...t.constraints,panelSize:s,pivotIndices:i}}function KC({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){m.useEffect(()=>{if(e||n==null||r==null)return;const o=Oa(t,r);if(o==null)return;const i=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const a=o.getAttribute(St.groupId);Fe(a,`No group element found for id "${a}"`);const l=Ii(a,r),c=jg(a,t,r);Fe(c!==null,`No resize element found for id "${t}"`);const u=s.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return o.addEventListener("keydown",i),()=>{o.removeEventListener("keydown",i)}},[r,e,t,n])}function Fg({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:i,onClick:s,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:f={},tabIndex:p=0,tagName:h="div",...x}){var g,y;const v=m.useRef(null),b=m.useRef({onClick:s,onDragging:a,onPointerDown:c,onPointerUp:u});m.useEffect(()=>{b.current.onClick=s,b.current.onDragging=a,b.current.onPointerDown=c,b.current.onPointerUp=u});const w=m.useContext(Ma);if(w===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:S,groupId:E,registerResizeHandle:C,startDragging:k,stopDragging:T,panelGroupElement:P}=w,z=ku(o),[D,$]=m.useState("inactive"),[M,_]=m.useState(!1),[N,A]=m.useState(null),I=m.useRef({state:D});Pr(()=>{I.current.state=D}),m.useEffect(()=>{if(n)A(null);else{const L=C(z);A(()=>L)}},[n,z,C]);const j=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,R=(y=r==null?void 0:r.fine)!==null&&y!==void 0?y:5;m.useEffect(()=>{if(n||N==null)return;const L=v.current;Fe(L,"Element ref not attached");let Y=!1;return MC(z,L,S,{coarse:j,fine:R},(V,U,G)=>{if(!U){$("inactive");return}switch(V){case"down":{$("drag"),Y=!1,Fe(G,'Expected event to be defined for "down" action'),k(z,G);const{onDragging:B,onPointerDown:W}=b.current;B==null||B(!0),W==null||W();break}case"move":{const{state:B}=I.current;Y=!0,B!=="drag"&&$("hover"),Fe(G,'Expected event to be defined for "move" action'),N(G);break}case"up":{$("hover"),T();const{onClick:B,onDragging:W,onPointerUp:Z}=b.current;W==null||W(!1),Z==null||Z(),Y||B==null||B();break}}})},[j,S,n,R,C,z,N,k,T]),KC({disabled:n,handleId:z,resizeHandler:N,panelGroupElement:P});const O={touchAction:"none",userSelect:"none"};return m.createElement(h,{...x,children:e,className:t,id:o,onBlur:()=>{_(!1),i==null||i()},onFocus:()=>{_(!0),l==null||l()},ref:v,role:"separator",style:{...O,...f},tabIndex:p,[St.groupDirection]:S,[St.groupId]:E,[St.resizeHandle]:"",[St.resizeHandleActive]:D==="drag"?"pointer":M?"keyboard":void 0,[St.resizeHandleEnabled]:!n,[St.resizeHandleId]:z,[St.resizeHandleState]:D})}Fg.displayName="PanelResizeHandle";function XC({className:e,...t}){return d.jsx($g,{"data-slot":"resizable-panel-group",className:He("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ff({...e}){return d.jsx(wg,{"data-slot":"resizable-panel",...e})}function ZC({withHandle:e,className:t,...n}){return d.jsx(Fg,{"data-slot":"resizable-handle",className:He("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&d.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:d.jsx(vS,{className:"size-2.5"})})})}function QC({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){m.useEffect(()=>{if(!r)return;const o=i=>{const s=i.target,a=e.current&&!e.current.contains(s),l=t!=null&&t.current?!t.current.contains(s):!0;a&&l&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[e,t,n,r])}function JC({onEscape:e,enabled:t=!0}){m.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const e_={x:0,y:0},cn=16,t_=["top-start","bottom-end","top-end"];function n_({anchorRef:e,placement:t="top-start",offset:n=e_,fallbackPlacements:r=t_}){const o=m.useCallback((l,c,u)=>{let f=0,p=0;switch(u){case"top":f=l.top-c.height-n.y,p=l.left+(l.width-c.width)/2+n.x;break;case"top-start":f=l.top-c.height-n.y,p=l.left+n.x;break;case"top-end":f=l.top-c.height-n.y,p=l.right-c.width-n.x;break;case"bottom":f=l.bottom+n.y,p=l.left+(l.width-c.width)/2+n.x;break;case"bottom-start":f=l.bottom+n.y,p=l.left+n.x;break;case"bottom-end":f=l.bottom+n.y,p=l.right-c.width-n.x;break;case"left":f=l.top+(l.height-c.height)/2+n.y,p=l.left-c.width-n.x;break;case"left-start":f=l.top+n.y,p=l.left-c.width-n.x;break;case"left-end":f=l.bottom-c.height-n.y,p=l.left-c.width-n.x;break;case"right":f=l.top+(l.height-c.height)/2+n.y,p=l.right+n.x;break;case"right-start":f=l.top+n.y,p=l.right+n.x;break;case"right-end":f=l.bottom-c.height-n.y,p=l.right+n.x;break}return console.log(`Calculated position for ${u}:`,{top:f,left:p}),{top:f,left:p,placement:u}},[n.x,n.y]),i=m.useCallback((l,c)=>{const u={width:window.innerWidth,height:window.innerHeight};return l.left<cn||l.top<cn||l.left+c.width>u.width-cn||l.top+c.height>u.height-cn},[]),s=m.useCallback(l=>{if(!e.current){const x={width:window.innerWidth,height:window.innerHeight};return{top:x.height/2-100,left:x.width/2-100,placement:t}}const c=e.current.getBoundingClientRect(),u=l.getBoundingClientRect(),f=o(c,u,t);if(!i(f,u))return f;for(const x of r){const g=o(c,u,x);if(!i(g,u))return g}const p={width:window.innerWidth,height:window.innerHeight},h={...f};return h.left<cn?h.left=cn:h.left+u.width>p.width-cn&&(h.left=p.width-u.width-cn),h.top<cn?h.top=cn:h.top+u.height>p.height-cn&&(h.top=p.height-u.height-cn),h},[e,t,r,o,i]);return{getPositionStyle:m.useCallback(l=>{const c=s(l);return{position:"fixed",top:c.top,left:c.left,zIndex:1e3}},[s]),getOptimalPosition:s}}function r_({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[i,s]=m.useState(e),[a,l]=m.useState(!1),c=m.useRef(0),u=m.useRef(e),f=m.useCallback(v=>{v.preventDefault(),l(!0),c.current=v.clientX,u.current=i},[i]),p=m.useCallback(v=>{if(!a)return;const b=v.clientX-c.current,w=r==="right"?-b:b,S=Math.min(Math.max(u.current+w,t),n);s(S),o==null||o(S)},[a,t,n,r,o]),h=m.useCallback(()=>{l(!1)},[]),x=m.useCallback(v=>{v.preventDefault(),l(!0),c.current=v.touches[0].clientX,u.current=i},[i]),g=m.useCallback(v=>{if(!a)return;const b=v.touches[0].clientX-c.current,w=r==="right"?-b:b,S=Math.min(Math.max(u.current+w,t),n);s(S),o==null||o(S)},[a,t,n,r,o]),y=m.useCallback(()=>{l(!1)},[]);return m.useEffect(()=>{if(a)return document.addEventListener("mousemove",p),document.addEventListener("mouseup",h),document.addEventListener("touchmove",g),document.addEventListener("touchend",y),document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",y),document.body.style.userSelect="",document.body.style.cursor=""}},[a,p,h,g,y]),{width:i,isResizing:a,handleMouseDown:f,handleTouchStart:x,setWidth:s}}const o_=m.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:i=!0,className:s,onWidthChange:a,...l},c)=>{const{width:u,isResizing:f,handleMouseDown:p,handleTouchStart:h}=r_({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:a}),x={width:`${u}px`},g=o==="left"?"right-0":"left-0";return d.jsxs("div",{ref:c,className:He("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",s),style:x,...l,children:[d.jsx("div",{className:He("h-full overflow-x-hidden overflow-y-auto"),children:e}),i&&d.jsx("div",{className:He("group absolute top-0 bottom-0 w-2",g,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",f&&"bg-[var(--color-primary-wMain)]"),onMouseDown:p,onTouchStart:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:v=>{if(v.key==="ArrowLeft"||v.key==="ArrowRight"){v.preventDefault();const b=v.key==="ArrowRight"?10:-10,w=o==="right"?-b:b,S=Math.min(Math.max(u+w,n),r);a==null||a(S)}},children:d.jsx("div",{className:He("absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 transform","bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]","group-hover:bg-[var(--color-primary-wMain)]","transition-colors duration-200",f&&"bg-[var(--color-primary-wMain)]")})})]})});o_.displayName="SidePanel";const zg=m.createContext(null),Bg=m.createContext(void 0),Hg=m.createContext(null),Vg=m.createContext(null),Ug=m.createContext(void 0),Wg=m.createContext(null);function Ko(){const e=m.useContext(Hg);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const Gg=()=>{const{configServerUrl:e}=Ko(),[t,n]=m.useState([]),[r,o]=m.useState(!0),[i,s]=m.useState(null),a=`${e}/api/v1`,l=m.useCallback(async()=>{o(!0),s(null);try{const c=await _t(`${a}/agents`,{credentials:"include"});if(!c.ok){const f=await c.json().catch(()=>({message:`Failed to fetch agents: ${c.statusText}`}));throw new Error(f.message||`Failed to fetch agents: ${c.statusText}`)}const u=await c.json();n(u)}catch(c){console.error("Error fetching agents:",c),s(c instanceof Error?c.message:"Could not load agent information."),n([])}finally{o(!1)}},[a]);return m.useEffect(()=>{l()},[l]),{agents:t,isLoading:r,error:i,refetch:l}},i_=()=>{const{configServerUrl:e}=Ko(),[t,n]=m.useState([]),[r,o]=m.useState(!0),[i,s]=m.useState(null),a=`${e}/api/v1`,l=m.useCallback(async()=>{o(!0),s(null);try{const c=await _t(`${a}/artifacts/`,{credentials:"include"});if(!c.ok){const f=await c.json().catch(()=>({message:`Failed to fetch artifacts. ${c.statusText}`}));throw new Error(f.message||`Failed to fetch artifacts. ${c.statusText}`)}const u=await c.json();n(u)}catch(c){const u=c instanceof Error?c.message:"Failed to fetch artifacts.";s(u),n([])}finally{o(!1)}},[a]);return m.useEffect(()=>{l()},[l]),{artifacts:t,isLoading:r,error:i,refetch:l}},s_=()=>{const e=m.useContext(zg);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ot=()=>{const e=m.useContext(Bg);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function a_(){const{messages:e}=Ot(),t=m.useCallback(n=>{if(!(e.length<=1))return n.preventDefault(),"Are you sure you want to leave? Your chat history will be lost."},[e.length]);m.useEffect(()=>(window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}),[t])}function Yg(){const e=m.useContext(Vg);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function l_(e,t){const[n,r]=m.useState(e);return m.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const c_=async(e,t)=>{const n=await _t(`${e}/api/v1/artifacts/${encodeURIComponent(t.filename)}`,{credentials:"include"});if(!n.ok)throw new Error(`Failed to download artifact: ${t.filename}. Status: ${n.status}`);const r=await n.blob();Yh(r,t.filename)},qg=()=>{const{configServerUrl:e}=Ko(),{addNotification:t}=Ot();return{onDownload:async r=>{try{await c_(e,r),t(`Downloaded artifact: ${r.filename}.`)}catch{t(`Failed to download artifact: ${r.filename}.`,"error")}}}},u_=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=m.useState(!1),i=m.useRef(0),s=m.useCallback(u=>{n||(u.preventDefault(),u.stopPropagation(),i.current=(i.current||0)+1,u.dataTransfer.types.includes("Files")&&o(!0))},[n,i]),a=m.useCallback(u=>{n||(u.preventDefault(),u.stopPropagation(),u.dataTransfer.types.includes("Files")&&(u.dataTransfer.dropEffect="copy"))},[n]),l=m.useCallback(u=>{n||(u.preventDefault(),u.stopPropagation(),i.current=(i.current||0)-1,i.current===0&&o(!1))},[n,i]),c=m.useCallback(u=>{if(n||(u.preventDefault(),u.stopPropagation(),o(!1),i.current=0,!u.dataTransfer.files||u.dataTransfer.files.length===0))return;const f=Array.from(u.dataTransfer.files),p=t?f.filter(t):f;p.length!==0&&e(p)},[n,i,t,e]);return{isDragging:r,handleDragEnter:s,handleDragOver:a,handleDragLeave:l,handleDrop:c}},Kg=()=>{const{messages:e}=Ot();return m.useMemo(()=>{const t=e.find(n=>n.isUser&&n.text&&n.text.trim());if(t&&t.text){const n=t.text.trim();return n.length>100?n.substring(0,100)+"...":n}return"New Chat"},[e])},Tu=()=>{const e=m.useContext(Ug);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function Xg(){const e=m.useContext(Wg);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}m.createContext(null);function Zg(e){const t=e+"CollectionProvider",[n,r]=vr(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=g=>{const{scope:y,children:v}=g,b=Pt.useRef(null),w=Pt.useRef(new Map).current;return d.jsx(o,{scope:y,itemMap:w,collectionRef:b,children:v})};s.displayName=t;const a=e+"CollectionSlot",l=$r(a),c=Pt.forwardRef((g,y)=>{const{scope:v,children:b}=g,w=i(a,v),S=pt(y,w.collectionRef);return d.jsx(l,{ref:S,children:b})});c.displayName=a;const u=e+"CollectionItemSlot",f="data-radix-collection-item",p=$r(u),h=Pt.forwardRef((g,y)=>{const{scope:v,children:b,...w}=g,S=Pt.useRef(null),E=pt(y,S),C=i(u,v);return Pt.useEffect(()=>(C.itemMap.set(S,{ref:S,...w}),()=>void C.itemMap.delete(S))),d.jsx(p,{[f]:"",ref:E,children:b})});h.displayName=u;function x(g){const y=i(e+"CollectionConsumer",g);return Pt.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${f}]`));return Array.from(y.itemMap.values()).sort((C,k)=>w.indexOf(C.ref.current)-w.indexOf(k.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:c,ItemSlot:h},x,r]}var d_=m.createContext(void 0);function Au(e){const t=m.useContext(d_);return e||t||"ltr"}const Nu=m.forwardRef(({actions:e,className:t,...n},r)=>{const o=(s,a)=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),a.onClick())},i=(s,a)=>{var c,u,f,p,h;const l=(c=s.currentTarget.parentElement)==null?void 0:c.querySelectorAll('[role="menuitem"]');if(l)switch(s.key){case"ArrowDown":{s.preventDefault();const x=(a+1)%l.length;(u=l[x])==null||u.focus();break}case"ArrowUp":{s.preventDefault();const x=(a-1+l.length)%l.length;(f=l[x])==null||f.focus();break}case"Home":s.preventDefault(),(p=l[0])==null||p.focus();break;case"End":s.preventDefault(),(h=l[l.length-1])==null||h.focus();break;case"Escape":s.preventDefault(),s.currentTarget.blur();break}};return d.jsx("div",{ref:r,role:"menu",className:He("min-w-[8rem] overflow-hidden p-1",t),...n,children:e.map((s,a)=>d.jsxs(m.Fragment,{children:[s.divider&&a>0&&d.jsx("div",{className:"mx-1 my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),d.jsxs("div",{role:"menuitem",tabIndex:0,className:He("relative flex cursor-pointer items-center gap-2 px-2 py-1.5 text-sm transition-colors select-none","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)]"),onClick:s.onClick,onKeyDown:l=>{o(l,s),i(l,a)},children:[s.icon&&s.iconPosition!=="right"&&d.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:s.icon}),d.jsx("span",{className:"flex-1",children:s.label}),s.icon&&s.iconPosition==="right"&&d.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:s.icon})]})]},s.id))})});Nu.displayName="Menu";var La="Popover",[Qg,F5]=vr(La,[qo]),Xi=qo(),[f_,wr]=Qg(La),Jg=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!1}=e,a=Xi(t),l=m.useRef(null),[c,u]=m.useState(!1),[f,p]=zr({prop:r,defaultProp:o??!1,onChange:i,caller:La});return d.jsx(cu,{...a,children:d.jsx(f_,{scope:t,contentId:jn(),triggerRef:l,open:f,onOpenChange:p,onOpenToggle:m.useCallback(()=>p(h=>!h),[p]),hasCustomAnchor:c,onCustomAnchorAdd:m.useCallback(()=>u(!0),[]),onCustomAnchorRemove:m.useCallback(()=>u(!1),[]),modal:s,children:n})})};Jg.displayName=La;var e0="PopoverAnchor",p_=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=wr(e0,n),i=Xi(n),{onCustomAnchorAdd:s,onCustomAnchorRemove:a}=o;return m.useEffect(()=>(s(),()=>a()),[s,a]),d.jsx(_a,{...i,...r,ref:t})});p_.displayName=e0;var t0="PopoverTrigger",n0=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=wr(t0,n),i=Xi(n),s=pt(t,o.triggerRef),a=d.jsx(Ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":a0(o.open),...r,ref:s,onClick:Me(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?a:d.jsx(_a,{asChild:!0,...i,children:a})});n0.displayName=t0;var ju="PopoverPortal",[h_,m_]=Qg(ju,{forceMount:void 0}),r0=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,i=wr(ju,t);return d.jsx(h_,{scope:t,forceMount:n,children:d.jsx(Zn,{present:n||i.open,children:d.jsx(qi,{asChild:!0,container:o,children:r})})})};r0.displayName=ju;var To="PopoverContent",o0=m.forwardRef((e,t)=>{const n=m_(To,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,i=wr(To,e.__scopePopover);return d.jsx(Zn,{present:r||i.open,children:i.modal?d.jsx(x_,{...o,ref:t}):d.jsx(y_,{...o,ref:t})})});o0.displayName=To;var g_=$r("PopoverContent.RemoveScroll"),x_=m.forwardRef((e,t)=>{const n=wr(To,e.__scopePopover),r=m.useRef(null),o=pt(t,r),i=m.useRef(!1);return m.useEffect(()=>{const s=r.current;if(s)return vu(s)},[]),d.jsx(Ia,{as:g_,allowPinchZoom:!0,children:d.jsx(i0,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Me(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),i.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Me(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Me(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1})})})}),y_=m.forwardRef((e,t)=>{const n=wr(To,e.__scopePopover),r=m.useRef(!1),o=m.useRef(!1);return d.jsx(i0,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((c=n.triggerRef.current)==null?void 0:c.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),i0=m.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=e,p=wr(To,n),h=Xi(n);return yu(),d.jsx(Na,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:d.jsx(Gi,{asChild:!0,disableOutsidePointerEvents:s,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:d.jsx(uu,{"data-state":a0(p.open),role:"dialog",id:p.contentId,...h,...f,ref:t,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),s0="PopoverClose",v_=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=wr(s0,n);return d.jsx(Ye.button,{type:"button",...r,ref:t,onClick:Me(e.onClick,()=>o.onOpenChange(!1))})});v_.displayName=s0;var w_="PopoverArrow",b_=m.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Xi(n);return d.jsx(du,{...o,...r,ref:t})});b_.displayName=w_;function a0(e){return e?"open":"closed"}var E_=Jg,S_=n0,k_=r0,C_=o0;function l0({...e}){return d.jsx(E_,{"data-slot":"popover",...e})}function c0({...e}){return d.jsx(S_,{"data-slot":"popover-trigger",...e})}function u0({className:e,align:t="center",sideOffset:n=4,...r}){return d.jsx(k_,{children:d.jsx(C_,{"data-slot":"popover-content",align:t,sideOffset:n,className:He("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-sm border p-4 shadow-sm outline-hidden",e),...r})})}function __({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:i,className:s,closeOnClickOutside:a=!0,closeOnEscape:l=!0,portal:c=!0,animationDuration:u=150,fallbackPlacements:f}){const p=m.useRef(null),[h,x]=m.useState({}),[g,y]=m.useState(!1);QC({ref:p,anchorRef:n,onClickOutside:t,enabled:e&&a}),JC({onEscape:t,enabled:e&&l});const{getPositionStyle:v}=n_({anchorRef:n,placement:o,offset:i,fallbackPlacements:f});if(m.useEffect(()=>{e&&p.current?(y(!1),requestAnimationFrame(()=>{if(p.current){const w=v(p.current);x(w),y(!0)}})):y(!1)},[e,v]),!e)return null;const b=d.jsx("div",{ref:p,role:"dialog","aria-modal":"false",className:He("bg-background min-w-[8rem] overflow-hidden border shadow-md",s),style:{...h,opacity:e&&g?1:0,transform:`scale(${e&&g?1:.95})`,transition:`opacity ${u}ms ease-in-out, transform ${u}ms ease-in-out`,pointerEvents:e&&g?"auto":"none",visibility:g?"visible":"hidden"},children:r});return c?Wo.createPortal(b,document.body):b}function pf(e,[t,n]){return Math.min(n,Math.max(t,e))}function T_(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A_=[" ","Enter","ArrowUp","ArrowDown"],N_=[" ","Enter"],Vr="Select",[$a,Fa,j_]=Zg(Vr),[Xo,z5]=vr(Vr,[j_,qo]),za=qo(),[I_,br]=Xo(Vr),[R_,M_]=Xo(Vr),d0=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:p,required:h,form:x}=e,g=za(t),[y,v]=m.useState(null),[b,w]=m.useState(null),[S,E]=m.useState(!1),C=Au(c),[k,T]=zr({prop:r,defaultProp:o??!1,onChange:i,caller:Vr}),[P,z]=zr({prop:s,defaultProp:a,onChange:l,caller:Vr}),D=m.useRef(null),$=y?x||!!y.closest("form"):!0,[M,_]=m.useState(new Set),N=Array.from(M).map(A=>A.props.value).join(";");return d.jsx(cu,{...g,children:d.jsxs(I_,{required:h,scope:t,trigger:y,onTriggerChange:v,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:jn(),value:P,onValueChange:z,open:k,onOpenChange:T,dir:C,triggerPointerDownPosRef:D,disabled:p,children:[d.jsx($a.Provider,{scope:t,children:d.jsx(R_,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(A=>{_(I=>new Set(I).add(A))},[]),onNativeOptionRemove:m.useCallback(A=>{_(I=>{const j=new Set(I);return j.delete(A),j})},[]),children:n})}),$?d.jsxs(M0,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:f,value:P,onChange:A=>z(A.target.value),disabled:p,form:x,children:[P===void 0?d.jsx("option",{value:""}):null,Array.from(M)]},N):null]})})};d0.displayName=Vr;var f0="SelectTrigger",p0=m.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=za(n),s=br(f0,n),a=s.disabled||r,l=pt(t,s.onTriggerChange),c=Fa(n),u=m.useRef("touch"),[f,p,h]=D0(g=>{const y=c().filter(w=>!w.disabled),v=y.find(w=>w.value===s.value),b=O0(y,g,v);b!==void 0&&s.onValueChange(b.value)}),x=g=>{a||(s.onOpenChange(!0),h()),g&&(s.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return d.jsx(_a,{asChild:!0,...i,children:d.jsx(Ye.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":P0(s.value)?"":void 0,...o,ref:l,onClick:Me(o.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&x(g)}),onPointerDown:Me(o.onPointerDown,g=>{u.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(x(g),g.preventDefault())}),onKeyDown:Me(o.onKeyDown,g=>{const y=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&p(g.key),!(y&&g.key===" ")&&A_.includes(g.key)&&(x(),g.preventDefault())})})})});p0.displayName=f0;var h0="SelectValue",m0=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,l=br(h0,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,f=pt(t,l.onValueNodeChange);return Vt(()=>{c(u)},[c,u]),d.jsx(Ye.span,{...a,ref:f,style:{pointerEvents:"none"},children:P0(l.value)?d.jsx(d.Fragment,{children:s}):i})});m0.displayName=h0;var P_="SelectIcon",g0=m.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return d.jsx(Ye.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});g0.displayName=P_;var D_="SelectPortal",x0=e=>d.jsx(qi,{asChild:!0,...e});x0.displayName=D_;var Ur="SelectContent",y0=m.forwardRef((e,t)=>{const n=br(Ur,e.__scopeSelect),[r,o]=m.useState();if(Vt(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?Wo.createPortal(d.jsx(v0,{scope:e.__scopeSelect,children:d.jsx($a.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),i):null}return d.jsx(w0,{...e,ref:t})});y0.displayName=Ur;var hn=10,[v0,Er]=Xo(Ur),O_="SelectContentImpl",L_=$r("SelectContent.RemoveScroll"),w0=m.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:y,...v}=e,b=br(Ur,n),[w,S]=m.useState(null),[E,C]=m.useState(null),k=pt(t,B=>S(B)),[T,P]=m.useState(null),[z,D]=m.useState(null),$=Fa(n),[M,_]=m.useState(!1),N=m.useRef(!1);m.useEffect(()=>{if(w)return vu(w)},[w]),yu();const A=m.useCallback(B=>{const[W,...Z]=$().map(K=>K.ref.current),[ie]=Z.slice(-1),se=document.activeElement;for(const K of B)if(K===se||(K==null||K.scrollIntoView({block:"nearest"}),K===W&&E&&(E.scrollTop=0),K===ie&&E&&(E.scrollTop=E.scrollHeight),K==null||K.focus(),document.activeElement!==se))return},[$,E]),I=m.useCallback(()=>A([T,w]),[A,T,w]);m.useEffect(()=>{M&&I()},[M,I]);const{onOpenChange:j,triggerPointerDownPosRef:R}=b;m.useEffect(()=>{if(w){let B={x:0,y:0};const W=ie=>{var se,K;B={x:Math.abs(Math.round(ie.pageX)-(((se=R.current)==null?void 0:se.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((K=R.current)==null?void 0:K.y)??0))}},Z=ie=>{B.x<=10&&B.y<=10?ie.preventDefault():w.contains(ie.target)||j(!1),document.removeEventListener("pointermove",W),R.current=null};return R.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",Z,{capture:!0})}}},[w,j,R]),m.useEffect(()=>{const B=()=>j(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[j]);const[O,L]=D0(B=>{const W=$().filter(se=>!se.disabled),Z=W.find(se=>se.ref.current===document.activeElement),ie=O0(W,B,Z);ie&&setTimeout(()=>ie.ref.current.focus())}),Y=m.useCallback((B,W,Z)=>{const ie=!N.current&&!Z;(b.value!==void 0&&b.value===W||ie)&&(P(B),ie&&(N.current=!0))},[b.value]),H=m.useCallback(()=>w==null?void 0:w.focus(),[w]),V=m.useCallback((B,W,Z)=>{const ie=!N.current&&!Z;(b.value!==void 0&&b.value===W||ie)&&D(B)},[b.value]),U=r==="popper"?uc:b0,G=U===uc?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:p,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:y}:{};return d.jsx(v0,{scope:n,content:w,viewport:E,onViewportChange:C,itemRefCallback:Y,selectedItem:T,onItemLeave:H,itemTextRefCallback:V,focusSelectedItem:I,selectedItemText:z,position:r,isPositioned:M,searchRef:O,children:d.jsx(Ia,{as:L_,allowPinchZoom:!0,children:d.jsx(Na,{asChild:!0,trapped:b.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:Me(o,B=>{var W;(W=b.trigger)==null||W.focus({preventScroll:!0}),B.preventDefault()}),children:d.jsx(Gi,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:d.jsx(U,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:B=>B.preventDefault(),...v,...G,onPlaced:()=>_(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Me(v.onKeyDown,B=>{const W=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!W&&B.key.length===1&&L(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let ie=$().filter(se=>!se.disabled).map(se=>se.ref.current);if(["ArrowUp","End"].includes(B.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const se=B.target,K=ie.indexOf(se);ie=ie.slice(K+1)}setTimeout(()=>A(ie)),B.preventDefault()}})})})})})})});w0.displayName=O_;var $_="SelectItemAlignedPosition",b0=m.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=br(Ur,n),s=Er(Ur,n),[a,l]=m.useState(null),[c,u]=m.useState(null),f=pt(t,k=>u(k)),p=Fa(n),h=m.useRef(!1),x=m.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:v,focusSelectedItem:b}=s,w=m.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&y&&v){const k=i.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),P=i.valueNode.getBoundingClientRect(),z=v.getBoundingClientRect();if(i.dir!=="rtl"){const se=z.left-T.left,K=P.left-se,ne=k.left-K,q=k.width+ne,re=Math.max(q,T.width),te=window.innerWidth-hn,pe=pf(K,[hn,Math.max(hn,te-re)]);a.style.minWidth=q+"px",a.style.left=pe+"px"}else{const se=T.right-z.right,K=window.innerWidth-P.right-se,ne=window.innerWidth-k.right-K,q=k.width+ne,re=Math.max(q,T.width),te=window.innerWidth-hn,pe=pf(K,[hn,Math.max(hn,te-re)]);a.style.minWidth=q+"px",a.style.right=pe+"px"}const D=p(),$=window.innerHeight-hn*2,M=g.scrollHeight,_=window.getComputedStyle(c),N=parseInt(_.borderTopWidth,10),A=parseInt(_.paddingTop,10),I=parseInt(_.borderBottomWidth,10),j=parseInt(_.paddingBottom,10),R=N+A+M+j+I,O=Math.min(y.offsetHeight*5,R),L=window.getComputedStyle(g),Y=parseInt(L.paddingTop,10),H=parseInt(L.paddingBottom,10),V=k.top+k.height/2-hn,U=$-V,G=y.offsetHeight/2,B=y.offsetTop+G,W=N+A+B,Z=R-W;if(W<=V){const se=D.length>0&&y===D[D.length-1].ref.current;a.style.bottom="0px";const K=c.clientHeight-g.offsetTop-g.offsetHeight,ne=Math.max(U,G+(se?H:0)+K+I),q=W+ne;a.style.height=q+"px"}else{const se=D.length>0&&y===D[0].ref.current;a.style.top="0px";const ne=Math.max(V,N+g.offsetTop+(se?Y:0)+G)+Z;a.style.height=ne+"px",g.scrollTop=W-V+g.offsetTop}a.style.margin=`${hn}px 0`,a.style.minHeight=O+"px",a.style.maxHeight=$+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[p,i.trigger,i.valueNode,a,c,g,y,v,i.dir,r]);Vt(()=>w(),[w]);const[S,E]=m.useState();Vt(()=>{c&&E(window.getComputedStyle(c).zIndex)},[c]);const C=m.useCallback(k=>{k&&x.current===!0&&(w(),b==null||b(),x.current=!1)},[w,b]);return d.jsx(z_,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:h,onScrollButtonChange:C,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:d.jsx(Ye.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});b0.displayName=$_;var F_="SelectPopperPosition",uc=m.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=hn,...i}=e,s=za(n);return d.jsx(uu,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});uc.displayName=F_;var[z_,Iu]=Xo(Ur,{}),dc="SelectViewport",E0=m.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Er(dc,n),s=Iu(dc,n),a=pt(t,i.onViewportChange),l=m.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d.jsx($a.Slot,{scope:n,children:d.jsx(Ye.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Me(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:p}=s;if(p!=null&&p.current&&f){const h=Math.abs(l.current-u.scrollTop);if(h>0){const x=window.innerHeight-hn*2,g=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),v=Math.max(g,y);if(v<x){const b=v+h,w=Math.min(x,b),S=b-w;f.style.height=w+"px",f.style.bottom==="0px"&&(u.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});E0.displayName=dc;var S0="SelectGroup",[B_,H_]=Xo(S0),V_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=jn();return d.jsx(B_,{scope:n,id:o,children:d.jsx(Ye.div,{role:"group","aria-labelledby":o,...r,ref:t})})});V_.displayName=S0;var k0="SelectLabel",U_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=H_(k0,n);return d.jsx(Ye.div,{id:o.id,...r,ref:t})});U_.displayName=k0;var Qs="SelectItem",[W_,C0]=Xo(Qs),_0=m.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=br(Qs,n),l=Er(Qs,n),c=a.value===r,[u,f]=m.useState(i??""),[p,h]=m.useState(!1),x=pt(t,b=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,b,r,o)}),g=jn(),y=m.useRef("touch"),v=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(W_,{scope:n,value:r,disabled:o,textId:g,isSelected:c,onItemTextChange:m.useCallback(b=>{f(w=>w||((b==null?void 0:b.textContent)??"").trim())},[]),children:d.jsx($a.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:d.jsx(Ye.div,{role:"option","aria-labelledby":g,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:x,onFocus:Me(s.onFocus,()=>h(!0)),onBlur:Me(s.onBlur,()=>h(!1)),onClick:Me(s.onClick,()=>{y.current!=="mouse"&&v()}),onPointerUp:Me(s.onPointerUp,()=>{y.current==="mouse"&&v()}),onPointerDown:Me(s.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Me(s.onPointerMove,b=>{var w;y.current=b.pointerType,o?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Me(s.onPointerLeave,b=>{var w;b.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Me(s.onKeyDown,b=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&b.key===" "||(N_.includes(b.key)&&v(),b.key===" "&&b.preventDefault())})})})})});_0.displayName=Qs;var vi="SelectItemText",T0=m.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=br(vi,n),a=Er(vi,n),l=C0(vi,n),c=M_(vi,n),[u,f]=m.useState(null),p=pt(t,v=>f(v),l.onItemTextChange,v=>{var b;return(b=a.itemTextRefCallback)==null?void 0:b.call(a,v,l.value,l.disabled)}),h=u==null?void 0:u.textContent,x=m.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=c;return Vt(()=>(g(x),()=>y(x)),[g,y,x]),d.jsxs(d.Fragment,{children:[d.jsx(Ye.span,{id:l.textId,...i,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Wo.createPortal(i.children,s.valueNode):null]})});T0.displayName=vi;var A0="SelectItemIndicator",N0=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return C0(A0,n).isSelected?d.jsx(Ye.span,{"aria-hidden":!0,...r,ref:t}):null});N0.displayName=A0;var fc="SelectScrollUpButton",j0=m.forwardRef((e,t)=>{const n=Er(fc,e.__scopeSelect),r=Iu(fc,e.__scopeSelect),[o,i]=m.useState(!1),s=pt(t,r.onScrollButtonChange);return Vt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(R0,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});j0.displayName=fc;var pc="SelectScrollDownButton",I0=m.forwardRef((e,t)=>{const n=Er(pc,e.__scopeSelect),r=Iu(pc,e.__scopeSelect),[o,i]=m.useState(!1),s=pt(t,r.onScrollButtonChange);return Vt(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?d.jsx(R0,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});I0.displayName=pc;var R0=m.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Er("SelectScrollButton",n),s=m.useRef(null),a=Fa(n),l=m.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return m.useEffect(()=>()=>l(),[l]),Vt(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),d.jsx(Ye.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Me(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Me(o.onPointerMove,()=>{var c;(c=i.onItemLeave)==null||c.call(i),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Me(o.onPointerLeave,()=>{l()})})}),G_="SelectSeparator",Y_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return d.jsx(Ye.div,{"aria-hidden":!0,...r,ref:t})});Y_.displayName=G_;var hc="SelectArrow",q_=m.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=za(n),i=br(hc,n),s=Er(hc,n);return i.open&&s.position==="popper"?d.jsx(du,{...o,...r,ref:t}):null});q_.displayName=hc;var K_="SelectBubbleInput",M0=m.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=m.useRef(null),i=pt(r,o),s=T_(t);return m.useEffect(()=>{const a=o.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==t&&u){const f=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(f)}},[s,t]),d.jsx(Ye.select,{...n,style:{...ym,...n.style},ref:i,defaultValue:t})});M0.displayName=K_;function P0(e){return e===""||e===void 0}function D0(e){const t=fr(e),n=m.useRef(""),r=m.useRef(0),o=m.useCallback(s=>{const a=n.current+s;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),i=m.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function O0(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=X_(e,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));const l=s.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function X_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Z_=d0,Q_=p0,J_=m0,eT=g0,tT=x0,nT=y0,rT=E0,oT=_0,iT=T0,sT=N0,aT=j0,lT=I0;function L0({...e}){return d.jsx(Z_,{"data-slot":"select",...e})}function $0({...e}){return d.jsx(J_,{"data-slot":"select-value",...e})}function F0({className:e,size:t="default",children:n,...r}){return d.jsxs(Q_,{"data-slot":"select-trigger","data-size":t,className:He("flex w-fit items-center justify-between gap-2 rounded-md border px-3 py-2 text-sm whitespace-nowrap shadow-xs disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,d.jsx(eT,{asChild:!0,children:d.jsx(Mm,{className:"size-4 opacity-50"})})]})}function z0({className:e,children:t,position:n="popper",...r}){return d.jsx(tT,{children:d.jsxs(nT,{"data-slot":"select-content",className:He("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-background relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[d.jsx(cT,{}),d.jsx(rT,{className:He("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),d.jsx(uT,{})]})})}function B0({className:e,children:t,...n}){return d.jsxs(oT,{"data-slot":"select-item",className:He("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 hover:bg-muted",e),...n,children:[d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(sT,{children:d.jsx(Rm,{className:"size-4"})})}),d.jsx(iT,{children:t})]})}function cT({className:e,...t}){return d.jsx(aT,{"data-slot":"select-scroll-up-button",className:He("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(uS,{className:"size-4"})})}function uT({className:e,...t}){return d.jsx(lT,{"data-slot":"select-scroll-down-button",className:He("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(Mm,{className:"size-4"})})}var _l="rovingFocusGroup.onEntryFocus",dT={bubbles:!1,cancelable:!0},Zi="RovingFocusGroup",[mc,H0,fT]=Zg(Zi),[pT,V0]=vr(Zi,[fT]),[hT,mT]=pT(Zi),U0=m.forwardRef((e,t)=>d.jsx(mc.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(mc.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(gT,{...e,ref:t})})}));U0.displayName=Zi;var gT=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...f}=e,p=m.useRef(null),h=pt(t,p),x=Au(i),[g,y]=zr({prop:s,defaultProp:a??null,onChange:l,caller:Zi}),[v,b]=m.useState(!1),w=fr(c),S=H0(n),E=m.useRef(!1),[C,k]=m.useState(0);return m.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(_l,w),()=>T.removeEventListener(_l,w)},[w]),d.jsx(hT,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:m.useCallback(T=>y(T),[y]),onItemShiftTab:m.useCallback(()=>b(!0),[]),onFocusableItemAdd:m.useCallback(()=>k(T=>T+1),[]),onFocusableItemRemove:m.useCallback(()=>k(T=>T-1),[]),children:d.jsx(Ye.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:Me(e.onMouseDown,()=>{E.current=!0}),onFocus:Me(e.onFocus,T=>{const P=!E.current;if(T.target===T.currentTarget&&P&&!v){const z=new CustomEvent(_l,dT);if(T.currentTarget.dispatchEvent(z),!z.defaultPrevented){const D=S().filter(A=>A.focusable),$=D.find(A=>A.active),M=D.find(A=>A.id===g),N=[$,M,...D].filter(Boolean).map(A=>A.ref.current);Y0(N,u)}}E.current=!1}),onBlur:Me(e.onBlur,()=>b(!1))})})}),W0="RovingFocusGroupItem",G0=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,l=jn(),c=i||l,u=mT(W0,n),f=u.currentTabStopId===c,p=H0(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=u;return m.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),d.jsx(mc.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:d.jsx(Ye.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:Me(e.onMouseDown,y=>{r?u.onItemFocus(c):y.preventDefault()}),onFocus:Me(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Me(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){u.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=vT(y,u.orientation,u.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=p().filter(S=>S.focusable).map(S=>S.ref.current);if(v==="last")w.reverse();else if(v==="prev"||v==="next"){v==="prev"&&w.reverse();const S=w.indexOf(y.currentTarget);w=u.loop?wT(w,S+1):w.slice(S+1)}setTimeout(()=>Y0(w))}}),children:typeof s=="function"?s({isCurrentTabStop:f,hasTabStop:g!=null}):s})})});G0.displayName=W0;var xT={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function yT(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function vT(e,t,n){const r=yT(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return xT[r]}function Y0(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function wT(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var bT=U0,ET=G0,Ba="Tabs",[ST,B5]=vr(Ba,[V0]),q0=V0(),[kT,Ru]=ST(Ba),K0=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=Au(a),[f,p]=zr({prop:r,onChange:o,defaultProp:i??"",caller:Ba});return d.jsx(kT,{scope:n,baseId:jn(),value:f,onValueChange:p,orientation:s,dir:u,activationMode:l,children:d.jsx(Ye.div,{dir:u,"data-orientation":s,...c,ref:t})})});K0.displayName=Ba;var X0="TabsList",Z0=m.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Ru(X0,n),s=q0(n);return d.jsx(bT,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:d.jsx(Ye.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Z0.displayName=X0;var Q0="TabsTrigger",J0=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Ru(Q0,n),a=q0(n),l=nx(s.baseId,r),c=rx(s.baseId,r),u=r===s.value;return d.jsx(ET,{asChild:!0,...a,focusable:!o,active:u,children:d.jsx(Ye.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:Me(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Me(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Me(e.onFocus,()=>{const f=s.activationMode!=="manual";!u&&!o&&f&&s.onValueChange(r)})})})});J0.displayName=Q0;var ex="TabsContent",tx=m.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Ru(ex,n),l=nx(a.baseId,r),c=rx(a.baseId,r),u=r===a.value,f=m.useRef(u);return m.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),d.jsx(Zn,{present:o||u,children:({present:p})=>d.jsx(Ye.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:p&&i})})});tx.displayName=ex;function nx(e,t){return`${e}-trigger-${t}`}function rx(e,t){return`${e}-content-${t}`}var CT=K0,_T=Z0,TT=J0,AT=tx;function NT({className:e,...t}){return d.jsx(CT,{"data-slot":"tabs",className:He("flex flex-col gap-2",e),...t})}function jT({className:e,...t}){return d.jsx(_T,{"data-slot":"tabs-list",className:He("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function hf({className:e,...t}){return d.jsx(TT,{"data-slot":"tabs-trigger",className:He("data-[state=active]:bg-background dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color] hover:bg-[var(--color-brand-w10)] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-[var(--color-brand-wMain)] data-[state=active]:shadow-sm dark:hover:bg-[var(--color-brand-wMain30)] dark:data-[state=active]:text-[var(--color-brand-wMain)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function mf({className:e,...t}){return d.jsx(AT,{"data-slot":"tabs-content",className:He("flex-1 outline-none",e),...t})}const ox=m.forwardRef(({className:e,...t},n)=>d.jsx(Vm,{autoComplete:"off",ref:n,name:"message",className:He("flex w-full items-center rounded-md px-4 py-3 placeholder:text-[var(--color-secondary-wMain)] disabled:cursor-not-allowed disabled:opacity-50",e),...t}));ox.displayName="ChatInput";const IT=yr("flex gap-2 max-w-[90%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),ix=m.forwardRef(({className:e,variant:t,layout:n,children:r,...o},i)=>d.jsx("div",{className:He(IT({variant:t,layout:n,className:e}),"group relative"),ref:i,...o,children:m.Children.map(r,s=>m.isValidElement(s)&&typeof s.type!="string"?m.cloneElement(s,{variant:t,layout:n}):s)}));ix.displayName="ChatBubble";const RT=yr("p-4",{variants:{variant:{received:"rounded-r-lg rounded-tl-lg",sent:"rounded-l-lg rounded-tr-lg justify-end bg-[var(--message-background)]"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),sx=m.forwardRef(({className:e,variant:t,layout:n,children:r,...o},i)=>d.jsx("div",{className:He(RT({variant:t,layout:n,className:e}),"relative max-w-full break-words whitespace-pre-wrap"),ref:i,...o,children:d.jsx(d.Fragment,{children:r})}));sx.displayName="ChatBubbleMessage";const MT=m.forwardRef(({variant:e,className:t,children:n,...r},o)=>d.jsx("div",{ref:o,className:He("absolute top-1/2 flex -translate-y-1/2 opacity-0 transition-opacity duration-200 group-hover:opacity-100",e==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...r,children:n}));MT.displayName="ChatBubbleActionWrapper";const ax={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},lx=Pt.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:i,disableAutoScroll:s,scrollToBottom:a}=WT({smooth:!0,content:t,autoScrollOnNewContent:!0});return d.jsxs("div",{className:`fade-both-mask min-h-0 flex-1 py-3 relative h-full w-full ${e}`,ref:r,children:[d.jsx("div",{className:"flex h-full w-full flex-col overflow-y-auto p-4",ref:o,onWheel:s,onTouchMove:s,...n,style:{scrollBehavior:"smooth"},children:d.jsx("div",{className:"flex flex-col gap-6",style:ax,children:t})}),!i&&d.jsx(tt,{onClick:()=>{a()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md bg-background","aria-label":"Scroll to bottom",children:d.jsx(jm,{className:"h-4 w-4"})})]})});lx.displayName="ChatMessageList";const PT=yr("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),DT=yr("animate-spin",{variants:{size:{small:"size-4",medium:"size-8",large:"size-12"},variant:{primary:"text-[var(--color-brand-wMain)]",secondary:"text-[var(--color-primary-wMain)]",muted:"text-[var(--color-secondary-text-wMain)] dark:text-[var(--color-secondary-text-w50)]",foreground:"text-foreground"}},defaultVariants:{size:"medium",variant:"primary"}});function OT({size:e,show:t,children:n,className:r,variant:o}){return d.jsxs("span",{className:PT({show:t}),children:[d.jsx(Om,{className:He(DT({size:e,variant:o}),r)}),n]})}function LT(){return d.jsx(OT,{size:"small",variant:"primary"})}const $T=yr("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent [a&]:hover:bg-primary/90",secondary:"border-transparent [a&]:hover:bg-secondary/90",destructive:"border-transparent [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function FT({className:e,variant:t,asChild:n=!1,...r}){const o=n?Mh:"span";return d.jsx(o,{"data-slot":"badge",className:He($T({variant:t}),e),...r})}const zT=yr("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function BT({className:e,variant:t,...n}){return d.jsx("div",{"data-slot":"alert",role:"alert",className:He(zT({variant:t}),e),...n})}function HT({className:e,...t}){return d.jsx("div",{"data-slot":"alert-title",className:He("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function VT({message:e,type:t}){return d.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:d.jsx(BT,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:d.jsxs(HT,{className:"flex items-center text-sm",children:[t==="error"&&d.jsx(hu,{className:"mr-2 text-[var(--color-error-wMain)]"}),d.jsx("div",{className:"truncate",children:e})]})})})}function UT(){const{notifications:e}=Ot();return e.length===0?null:d.jsx("div",{className:"pointer-events-none fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 transform flex-col-reverse gap-2",children:e.map(t=>d.jsx("div",{className:"pointer-events-auto",children:d.jsx(VT,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function WT(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,i=m.useRef(null),s=m.useRef(0),a=m.useRef(!1),[l,c]=m.useState({isAtBottom:!0,autoScrollEnabled:!0}),u=m.useCallback(x=>{const{scrollTop:g,scrollHeight:y,clientHeight:v}=x;return Math.abs(y-g-v)<=t},[t]),f=m.useCallback(x=>{if(!i.current)return;const g=i.current.scrollHeight-i.current.clientHeight;x?i.current.scrollTop=g:i.current.scrollTo({top:g,behavior:n?"smooth":"auto"}),c({isAtBottom:!0,autoScrollEnabled:!0}),a.current=!1},[n]),p=m.useCallback(()=>{if(!i.current)return;const x=u(i.current);c(g=>({isAtBottom:x,autoScrollEnabled:x?!0:g.autoScrollEnabled}))},[u]);m.useEffect(()=>{const x=i.current;if(x)return x.addEventListener("scroll",p,{passive:!0}),()=>x.removeEventListener("scroll",p)},[p]),m.useEffect(()=>{const x=i.current;if(!x)return;const g=x.scrollHeight;g!==s.current&&((l.autoScrollEnabled||o)&&requestAnimationFrame(()=>{f(s.current===0)}),s.current=g)},[r,l.autoScrollEnabled,f,o]),m.useEffect(()=>{const x=i.current;if(!x)return;const g=new ResizeObserver(()=>{l.autoScrollEnabled&&f(!0)});return g.observe(x),()=>g.disconnect()},[l.autoScrollEnabled,f]);const h=m.useCallback(()=>{(i.current?u(i.current):!1)||(a.current=!0,c(g=>({...g,autoScrollEnabled:!1})))},[u]);return{scrollRef:i,isAtBottom:l.isAtBottom,autoScrollEnabled:l.autoScrollEnabled,scrollToBottom:()=>f(),disableAutoScroll:h}}function At(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=At(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var GT={value:()=>{}};function Ha(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Os(n)}function Os(e){this._=e}function YT(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Os.prototype=Ha.prototype={constructor:Os,on:function(e,t){var n=this._,r=YT(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=qT(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=gf(n[o],e.name,t);else if(t==null)for(o in n)n[o]=gf(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Os(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function qT(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function gf(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=GT,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var gc="http://www.w3.org/1999/xhtml";const xf={svg:"http://www.w3.org/2000/svg",xhtml:gc,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Va(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),xf.hasOwnProperty(t)?{space:xf[t],local:e}:e}function KT(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===gc&&t.documentElement.namespaceURI===gc?t.createElement(e):t.createElementNS(n,e)}}function XT(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cx(e){var t=Va(e);return(t.local?XT:KT)(t)}function ZT(){}function Mu(e){return e==null?ZT:function(){return this.querySelector(e)}}function QT(e){typeof e!="function"&&(e=Mu(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new an(r,this._parents)}function JT(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function eA(){return[]}function ux(e){return e==null?eA:function(){return this.querySelectorAll(e)}}function tA(e){return function(){return JT(e.apply(this,arguments))}}function nA(e){typeof e=="function"?e=tA(e):e=ux(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(r.push(e.call(l,l.__data__,c,s)),o.push(l));return new an(r,o)}function dx(e){return function(){return this.matches(e)}}function fx(e){return function(t){return t.matches(e)}}var rA=Array.prototype.find;function oA(e){return function(){return rA.call(this.children,e)}}function iA(){return this.firstElementChild}function sA(e){return this.select(e==null?iA:oA(typeof e=="function"?e:fx(e)))}var aA=Array.prototype.filter;function lA(){return Array.from(this.children)}function cA(e){return function(){return aA.call(this.children,e)}}function uA(e){return this.selectAll(e==null?lA:cA(typeof e=="function"?e:fx(e)))}function dA(e){typeof e!="function"&&(e=dx(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new an(r,this._parents)}function px(e){return new Array(e.length)}function fA(){return new an(this._enter||this._groups.map(px),this._parents)}function Js(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Js.prototype={constructor:Js,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 pA(e){return function(){return e}}function hA(e,t,n,r,o,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Js(e,i[s]);for(;s<l;++s)(a=t[s])&&(o[s]=a)}function mA(e,t,n,r,o,i,s){var a,l,c=new Map,u=t.length,f=i.length,p=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(p[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?o[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(r[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new Js(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(p[a])===l&&(o[a]=l)}function gA(e){return e.__data__}function xA(e,t){if(!arguments.length)return Array.from(this,gA);var n=t?mA:hA,r=this._parents,o=this._groups;typeof e!="function"&&(e=pA(e));for(var i=o.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=r[c],f=o[c],p=f.length,h=yA(e.call(u,u&&u.__data__,c,r)),x=h.length,g=a[c]=new Array(x),y=s[c]=new Array(x),v=l[c]=new Array(p);n(u,f,g,y,v,h,t);for(var b=0,w=0,S,E;b<x;++b)if(S=g[b]){for(b>=w&&(w=b+1);!(E=y[w])&&++w<x;);S._next=E||null}}return s=new an(s,r),s._enter=a,s._exit=l,s}function yA(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vA(){return new an(this._exit||this._groups.map(px),this._parents)}function wA(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function bA(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var c=n[l],u=r[l],f=c.length,p=a[l]=new Array(f),h,x=0;x<f;++x)(h=c[x]||u[x])&&(p[x]=h);for(;l<o;++l)a[l]=n[l];return new an(a,this._parents)}function EA(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function SA(e){e||(e=kA);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,l=o[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new an(o,this._parents).order()}function kA(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function CA(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function _A(){return Array.from(this)}function TA(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function AA(){let e=0;for(const t of this)++e;return e}function NA(){return!this.node()}function jA(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function IA(e){return function(){this.removeAttribute(e)}}function RA(e){return function(){this.removeAttributeNS(e.space,e.local)}}function MA(e,t){return function(){this.setAttribute(e,t)}}function PA(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function DA(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function OA(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 LA(e,t){var n=Va(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?RA:IA:typeof t=="function"?n.local?OA:DA:n.local?PA:MA)(n,t))}function hx(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $A(e){return function(){this.style.removeProperty(e)}}function FA(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zA(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function BA(e,t,n){return arguments.length>1?this.each((t==null?$A:typeof t=="function"?zA:FA)(e,t,n??"")):Ao(this.node(),e)}function Ao(e,t){return e.style.getPropertyValue(t)||hx(e).getComputedStyle(e,null).getPropertyValue(t)}function HA(e){return function(){delete this[e]}}function VA(e,t){return function(){this[e]=t}}function UA(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function WA(e,t){return arguments.length>1?this.each((t==null?HA:typeof t=="function"?UA:VA)(e,t)):this.node()[e]}function mx(e){return e.trim().split(/^|\s+/)}function Pu(e){return e.classList||new gx(e)}function gx(e){this._node=e,this._names=mx(e.getAttribute("class")||"")}gx.prototype={add:function(e){var t=this._names.indexOf(e);t<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 xx(e,t){for(var n=Pu(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function yx(e,t){for(var n=Pu(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function GA(e){return function(){xx(this,e)}}function YA(e){return function(){yx(this,e)}}function qA(e,t){return function(){(t.apply(this,arguments)?xx:yx)(this,e)}}function KA(e,t){var n=mx(e+"");if(arguments.length<2){for(var r=Pu(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?qA:t?GA:YA)(n,t))}function XA(){this.textContent=""}function ZA(e){return function(){this.textContent=e}}function QA(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function JA(e){return arguments.length?this.each(e==null?XA:(typeof e=="function"?QA:ZA)(e)):this.node().textContent}function eN(){this.innerHTML=""}function tN(e){return function(){this.innerHTML=e}}function nN(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function rN(e){return arguments.length?this.each(e==null?eN:(typeof e=="function"?nN:tN)(e)):this.node().innerHTML}function oN(){this.nextSibling&&this.parentNode.appendChild(this)}function iN(){return this.each(oN)}function sN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function aN(){return this.each(sN)}function lN(e){var t=typeof e=="function"?e:cx(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function cN(){return null}function uN(e,t){var n=typeof e=="function"?e:cx(e),r=t==null?cN:typeof t=="function"?t:Mu(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function dN(){var e=this.parentNode;e&&e.removeChild(this)}function fN(){return this.each(dN)}function pN(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hN(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mN(e){return this.select(e?hN:pN)}function gN(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xN(e){return function(t){e.call(this,t,this.__data__)}}function yN(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function vN(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function wN(e,t,n){return function(){var r=this.__on,o,i=xN(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function bN(e,t,n){var r=yN(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(o=0,u=a[l];o<i;++o)if((s=r[o]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?wN:vN,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function vx(e,t,n){var r=hx(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function EN(e,t){return function(){return vx(this,e,t)}}function SN(e,t){return function(){return vx(this,e,t.apply(this,arguments))}}function kN(e,t){return this.each((typeof t=="function"?SN:EN)(e,t))}function*CN(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var wx=[null];function an(e,t){this._groups=e,this._parents=t}function Qi(){return new an([[document.documentElement]],wx)}function _N(){return this}an.prototype=Qi.prototype={constructor:an,select:QT,selectAll:nA,selectChild:sA,selectChildren:uA,filter:dA,data:xA,enter:fA,exit:vA,join:wA,merge:bA,selection:_N,order:EA,sort:SA,call:CA,nodes:_A,node:TA,size:AA,empty:NA,each:jA,attr:LA,style:BA,property:WA,classed:KA,text:JA,html:rN,raise:iN,lower:aN,append:lN,insert:uN,remove:fN,clone:mN,datum:gN,on:bN,dispatch:kN,[Symbol.iterator]:CN};function rn(e){return typeof e=="string"?new an([[document.querySelector(e)]],[document.documentElement]):new an([[e]],wx)}function TN(e){let t;for(;t=e.sourceEvent;)e=t;return e}function gn(e,t){if(e=TN(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const AN={passive:!1},Ri={capture:!0,passive:!1};function Tl(e){e.stopImmediatePropagation()}function Eo(e){e.preventDefault(),e.stopImmediatePropagation()}function bx(e){var t=e.document.documentElement,n=rn(e).on("dragstart.drag",Eo,Ri);"onselectstart"in t?n.on("selectstart.drag",Eo,Ri):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ex(e,t){var n=e.document.documentElement,r=rn(e).on("dragstart.drag",null);t&&(r.on("click.drag",Eo,Ri),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ms=e=>()=>e;function xc(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}xc.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function NN(e){return!e.ctrlKey&&!e.button}function jN(){return this.parentNode}function IN(e,t){return t??{x:e.x,y:e.y}}function RN(){return navigator.maxTouchPoints||"ontouchstart"in this}function Sx(){var e=NN,t=jN,n=IN,r=RN,o={},i=Ha("start","drag","end"),s=0,a,l,c,u,f=0;function p(S){S.on("mousedown.drag",h).filter(r).on("touchstart.drag",y).on("touchmove.drag",v,AN).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(S,E){if(!(u||!e.call(this,S,E))){var C=w(this,t.call(this,S,E),S,E,"mouse");C&&(rn(S.view).on("mousemove.drag",x,Ri).on("mouseup.drag",g,Ri),bx(S.view),Tl(S),c=!1,a=S.clientX,l=S.clientY,C("start",S))}}function x(S){if(Eo(S),!c){var E=S.clientX-a,C=S.clientY-l;c=E*E+C*C>f}o.mouse("drag",S)}function g(S){rn(S.view).on("mousemove.drag mouseup.drag",null),Ex(S.view,c),Eo(S),o.mouse("end",S)}function y(S,E){if(e.call(this,S,E)){var C=S.changedTouches,k=t.call(this,S,E),T=C.length,P,z;for(P=0;P<T;++P)(z=w(this,k,S,E,C[P].identifier,C[P]))&&(Tl(S),z("start",S,C[P]))}}function v(S){var E=S.changedTouches,C=E.length,k,T;for(k=0;k<C;++k)(T=o[E[k].identifier])&&(Eo(S),T("drag",S,E[k]))}function b(S){var E=S.changedTouches,C=E.length,k,T;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),k=0;k<C;++k)(T=o[E[k].identifier])&&(Tl(S),T("end",S,E[k]))}function w(S,E,C,k,T,P){var z=i.copy(),D=gn(P||C,E),$,M,_;if((_=n.call(S,new xc("beforestart",{sourceEvent:C,target:p,identifier:T,active:s,x:D[0],y:D[1],dx:0,dy:0,dispatch:z}),k))!=null)return $=_.x-D[0]||0,M=_.y-D[1]||0,function N(A,I,j){var R=D,O;switch(A){case"start":o[T]=N,O=s++;break;case"end":delete o[T],--s;case"drag":D=gn(j||I,E),O=s;break}z.call(A,S,new xc(A,{sourceEvent:I,subject:_,target:p,identifier:T,active:O,x:D[0]+$,y:D[1]+M,dx:D[0]-R[0],dy:D[1]-R[1],dispatch:z}),k)}}return p.filter=function(S){return arguments.length?(e=typeof S=="function"?S:ms(!!S),p):e},p.container=function(S){return arguments.length?(t=typeof S=="function"?S:ms(S),p):t},p.subject=function(S){return arguments.length?(n=typeof S=="function"?S:ms(S),p):n},p.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:ms(!!S),p):r},p.on=function(){var S=i.on.apply(i,arguments);return S===i?p:S},p.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,p):Math.sqrt(f)},p}function Du(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function kx(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Ji(){}var Mi=.7,ea=1/Mi,So="\\s*([+-]?\\d+)\\s*",Pi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Rn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",MN=/^#([0-9a-f]{3,8})$/,PN=new RegExp(`^rgb\\(${So},${So},${So}\\)$`),DN=new RegExp(`^rgb\\(${Rn},${Rn},${Rn}\\)$`),ON=new RegExp(`^rgba\\(${So},${So},${So},${Pi}\\)$`),LN=new RegExp(`^rgba\\(${Rn},${Rn},${Rn},${Pi}\\)$`),$N=new RegExp(`^hsl\\(${Pi},${Rn},${Rn}\\)$`),FN=new RegExp(`^hsla\\(${Pi},${Rn},${Rn},${Pi}\\)$`),yf={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};Du(Ji,Wr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vf,formatHex:vf,formatHex8:zN,formatHsl:BN,formatRgb:wf,toString:wf});function vf(){return this.rgb().formatHex()}function zN(){return this.rgb().formatHex8()}function BN(){return Cx(this).formatHsl()}function wf(){return this.rgb().formatRgb()}function Wr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=MN.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?bf(t):n===3?new Qt(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?gs(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?gs(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=PN.exec(e))?new Qt(t[1],t[2],t[3],1):(t=DN.exec(e))?new Qt(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ON.exec(e))?gs(t[1],t[2],t[3],t[4]):(t=LN.exec(e))?gs(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$N.exec(e))?kf(t[1],t[2]/100,t[3]/100,1):(t=FN.exec(e))?kf(t[1],t[2]/100,t[3]/100,t[4]):yf.hasOwnProperty(e)?bf(yf[e]):e==="transparent"?new Qt(NaN,NaN,NaN,0):null}function bf(e){return new Qt(e>>16&255,e>>8&255,e&255,1)}function gs(e,t,n,r){return r<=0&&(e=t=n=NaN),new Qt(e,t,n,r)}function HN(e){return e instanceof Ji||(e=Wr(e)),e?(e=e.rgb(),new Qt(e.r,e.g,e.b,e.opacity)):new Qt}function yc(e,t,n,r){return arguments.length===1?HN(e):new Qt(e,t,n,r??1)}function Qt(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Du(Qt,yc,kx(Ji,{brighter(e){return e=e==null?ea:Math.pow(ea,e),new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mi:Math.pow(Mi,e),new Qt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Qt(Dr(this.r),Dr(this.g),Dr(this.b),ta(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:Ef,formatHex:Ef,formatHex8:VN,formatRgb:Sf,toString:Sf}));function Ef(){return`#${Nr(this.r)}${Nr(this.g)}${Nr(this.b)}`}function VN(){return`#${Nr(this.r)}${Nr(this.g)}${Nr(this.b)}${Nr((isNaN(this.opacity)?1:this.opacity)*255)}`}function Sf(){const e=ta(this.opacity);return`${e===1?"rgb(":"rgba("}${Dr(this.r)}, ${Dr(this.g)}, ${Dr(this.b)}${e===1?")":`, ${e})`}`}function ta(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Dr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Nr(e){return e=Dr(e),(e<16?"0":"")+e.toString(16)}function kf(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new xn(e,t,n,r)}function Cx(e){if(e instanceof xn)return new xn(e.h,e.s,e.l,e.opacity);if(e instanceof Ji||(e=Wr(e)),!e)return new xn;if(e instanceof xn)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,l=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=l<.5?i+o:2-i-o,s*=60):a=l>0&&l<1?0:s,new xn(s,a,l,e.opacity)}function UN(e,t,n,r){return arguments.length===1?Cx(e):new xn(e,t,n,r??1)}function xn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Du(xn,UN,kx(Ji,{brighter(e){return e=e==null?ea:Math.pow(ea,e),new xn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mi:Math.pow(Mi,e),new xn(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,o=2*n-r;return new Qt(Al(e>=240?e-240:e+120,o,r),Al(e,o,r),Al(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new xn(Cf(this.h),xs(this.s),xs(this.l),ta(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(){const e=ta(this.opacity);return`${e===1?"hsl(":"hsla("}${Cf(this.h)}, ${xs(this.s)*100}%, ${xs(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Cf(e){return e=(e||0)%360,e<0?e+360:e}function xs(e){return Math.max(0,Math.min(1,e||0))}function Al(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ou=e=>()=>e;function WN(e,t){return function(n){return e+n*t}}function GN(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function YN(e){return(e=+e)==1?_x:function(t,n){return n-t?GN(t,n,e):Ou(isNaN(t)?n:t)}}function _x(e,t){var n=t-e;return n?WN(e,n):Ou(isNaN(e)?t:e)}const na=function e(t){var n=YN(t);function r(o,i){var s=n((o=yc(o)).r,(i=yc(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=_x(o.opacity,i.opacity);return function(u){return o.r=s(u),o.g=a(u),o.b=l(u),o.opacity=c(u),o+""}}return r.gamma=e,r}(1);function qN(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function KN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function XN(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=ki(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function ZN(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Cn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function QN(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=ki(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var vc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Nl=new RegExp(vc.source,"g");function JN(e){return function(){return e}}function e2(e){return function(t){return e(t)+""}}function Tx(e,t){var n=vc.lastIndex=Nl.lastIndex=0,r,o,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(r=vc.exec(e))&&(o=Nl.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:Cn(r,o)})),n=Nl.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?e2(l[0].x):JN(t):(t=l.length,function(c){for(var u=0,f;u<t;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function ki(e,t){var n=typeof t,r;return t==null||n==="boolean"?Ou(t):(n==="number"?Cn:n==="string"?(r=Wr(t))?(t=r,na):Tx:t instanceof Wr?na:t instanceof Date?ZN:KN(t)?qN:Array.isArray(t)?XN:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?QN:Cn)(e,t)}var _f=180/Math.PI,wc={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ax(e,t,n,r,o,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*r)&&(n-=e*l,r-=t*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),e*r<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*_f,skewX:Math.atan(l)*_f,scaleX:s,scaleY:a}}var ys;function t2(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?wc:Ax(t.a,t.b,t.c,t.d,t.e,t.f)}function n2(e){return e==null||(ys||(ys=document.createElementNS("http://www.w3.org/2000/svg","g")),ys.setAttribute("transform",e),!(e=ys.transform.baseVal.consolidate()))?wc:(e=e.matrix,Ax(e.a,e.b,e.c,e.d,e.e,e.f))}function Nx(e,t,n,r){function o(c){return c.length?c.pop()+" ":""}function i(c,u,f,p,h,x){if(c!==f||u!==p){var g=h.push("translate(",null,t,null,n);x.push({i:g-4,x:Cn(c,f)},{i:g-2,x:Cn(u,p)})}else(f||p)&&h.push("translate("+f+t+p+n)}function s(c,u,f,p){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),p.push({i:f.push(o(f)+"rotate(",null,r)-2,x:Cn(c,u)})):u&&f.push(o(f)+"rotate("+u+r)}function a(c,u,f,p){c!==u?p.push({i:f.push(o(f)+"skewX(",null,r)-2,x:Cn(c,u)}):u&&f.push(o(f)+"skewX("+u+r)}function l(c,u,f,p,h,x){if(c!==f||u!==p){var g=h.push(o(h)+"scale(",null,",",null,")");x.push({i:g-4,x:Cn(c,f)},{i:g-2,x:Cn(u,p)})}else(f!==1||p!==1)&&h.push(o(h)+"scale("+f+","+p+")")}return function(c,u){var f=[],p=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,p),s(c.rotate,u.rotate,f,p),a(c.skewX,u.skewX,f,p),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,p),c=u=null,function(h){for(var x=-1,g=p.length,y;++x<g;)f[(y=p[x]).i]=y.x(h);return f.join("")}}}var r2=Nx(t2,"px, ","px)","deg)"),o2=Nx(n2,", ",")",")"),i2=1e-12;function Tf(e){return((e=Math.exp(e))+1/e)/2}function s2(e){return((e=Math.exp(e))-1/e)/2}function a2(e){return((e=Math.exp(2*e))-1)/(e+1)}const Ls=function e(t,n,r){function o(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],p=s[2],h=u-a,x=f-l,g=h*h+x*x,y,v;if(g<i2)v=Math.log(p/c)/t,y=function(k){return[a+k*h,l+k*x,c*Math.exp(t*k*v)]};else{var b=Math.sqrt(g),w=(p*p-c*c+r*g)/(2*c*n*b),S=(p*p-c*c-r*g)/(2*p*n*b),E=Math.log(Math.sqrt(w*w+1)-w),C=Math.log(Math.sqrt(S*S+1)-S);v=(C-E)/t,y=function(k){var T=k*v,P=Tf(E),z=c/(n*b)*(P*a2(t*T+E)-s2(E));return[a+z*h,l+z*x,c*P/Tf(t*T+E)]}}return y.duration=v*1e3*t/Math.SQRT2,y}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},o}(Math.SQRT2,2,4);var No=0,wi=0,Jo=0,jx=1e3,ra,bi,oa=0,Gr=0,Ua=0,Di=typeof performance=="object"&&performance.now?performance:Date,Ix=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Lu(){return Gr||(Ix(l2),Gr=Di.now()+Ua)}function l2(){Gr=0}function ia(){this._call=this._time=this._next=null}ia.prototype=Rx.prototype={constructor:ia,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Lu():+n)+(t==null?0:+t),!this._next&&bi!==this&&(bi?bi._next=this:ra=this,bi=this),this._call=e,this._time=n,bc()},stop:function(){this._call&&(this._call=null,this._time=1/0,bc())}};function Rx(e,t,n){var r=new ia;return r.restart(e,t,n),r}function c2(){Lu(),++No;for(var e=ra,t;e;)(t=Gr-e._time)>=0&&e._call.call(void 0,t),e=e._next;--No}function Af(){Gr=(oa=Di.now())+Ua,No=wi=0;try{c2()}finally{No=0,d2(),Gr=0}}function u2(){var e=Di.now(),t=e-oa;t>jx&&(Ua-=t,oa=e)}function d2(){for(var e,t=ra,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:ra=n);bi=e,bc(r)}function bc(e){if(!No){wi&&(wi=clearTimeout(wi));var t=e-Gr;t>24?(e<1/0&&(wi=setTimeout(Af,e-Di.now()-Ua)),Jo&&(Jo=clearInterval(Jo))):(Jo||(oa=Di.now(),Jo=setInterval(u2,jx)),No=1,Ix(Af))}}function Nf(e,t,n){var r=new ia;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var f2=Ha("start","end","cancel","interrupt"),p2=[],Mx=0,jf=1,Ec=2,$s=3,If=4,Sc=5,Fs=6;function Wa(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;h2(e,n,{name:t,index:r,group:o,on:f2,tween:p2,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Mx})}function $u(e,t){var n=Sn(e,t);if(n.state>Mx)throw new Error("too late; already scheduled");return n}function Ln(e,t){var n=Sn(e,t);if(n.state>$s)throw new Error("too late; already running");return n}function Sn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function h2(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=Rx(i,0,n.time);function i(c){n.state=jf,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,p,h;if(n.state!==jf)return l();for(u in r)if(h=r[u],h.name===n.name){if(h.state===$s)return Nf(s);h.state===If?(h.state=Fs,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Fs,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Nf(function(){n.state===$s&&(n.state=If,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Ec,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ec){for(n.state=$s,o=new Array(p=n.tween.length),u=0,f=-1;u<p;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++f]=h);o.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Sc,1),f=-1,p=o.length;++f<p;)o[f].call(e,u);n.state===Sc&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Fs,n.timer.stop(),delete r[t];for(var c in r)return;delete e.__transition}}function zs(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Ec&&r.state<Sc,r.state=Fs,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function m2(e){return this.each(function(){zs(this,e)})}function g2(e,t){var n,r;return function(){var o=Ln(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function x2(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Ln(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===t){o[l]=a;break}l===c&&o.push(a)}i.tween=o}}function y2(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Sn(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?g2:x2)(n,e,t))}function Fu(e,t,n){var r=e._id;return e.each(function(){var o=Ln(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Sn(o,r).value[t]}}function Px(e,t){var n;return(typeof t=="number"?Cn:t instanceof Wr?na:(n=Wr(t))?(t=n,na):Tx)(e,t)}function v2(e){return function(){this.removeAttribute(e)}}function w2(e){return function(){this.removeAttributeNS(e.space,e.local)}}function b2(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function E2(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function S2(e,t,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=t(r=s,a)))}}function k2(e,t,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=t(r=s,a)))}}function C2(e,t){var n=Va(e),r=n==="transform"?o2:Px;return this.attrTween(e,typeof t=="function"?(n.local?k2:S2)(n,r,Fu(this,"attr."+e,t)):t==null?(n.local?w2:v2)(n):(n.local?E2:b2)(n,r,t))}function _2(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function T2(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function A2(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&T2(e,i)),n}return o._value=t,o}function N2(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&_2(e,i)),n}return o._value=t,o}function j2(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 new Error;var r=Va(e);return this.tween(n,(r.local?A2:N2)(r,t))}function I2(e,t){return function(){$u(this,e).delay=+t.apply(this,arguments)}}function R2(e,t){return t=+t,function(){$u(this,e).delay=t}}function M2(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?I2:R2)(t,e)):Sn(this.node(),t).delay}function P2(e,t){return function(){Ln(this,e).duration=+t.apply(this,arguments)}}function D2(e,t){return t=+t,function(){Ln(this,e).duration=t}}function O2(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?P2:D2)(t,e)):Sn(this.node(),t).duration}function L2(e,t){if(typeof t!="function")throw new Error;return function(){Ln(this,e).ease=t}}function $2(e){var t=this._id;return arguments.length?this.each(L2(t,e)):Sn(this.node(),t).ease}function F2(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ln(this,e).ease=n}}function z2(e){if(typeof e!="function")throw new Error;return this.each(F2(this._id,e))}function B2(e){typeof e!="function"&&(e=dx(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Kn(r,this._parents,this._name,this._id)}function H2(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),p,h=0;h<u;++h)(p=l[h]||c[h])&&(f[h]=p);for(;a<r;++a)s[a]=t[a];return new Kn(s,this._parents,this._name,this._id)}function V2(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function U2(e,t,n){var r,o,i=V2(t)?$u:Ln;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function W2(e,t){var n=this._id;return arguments.length<2?Sn(this.node(),n).on.on(e):this.each(U2(n,e,t))}function G2(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Y2(){return this.on("end.remove",G2(this._id))}function q2(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mu(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],l=a.length,c=i[s]=new Array(l),u,f,p=0;p<l;++p)(u=a[p])&&(f=e.call(u,u.__data__,p,a))&&("__data__"in u&&(f.__data__=u.__data__),c[p]=f,Wa(c[p],t,n,p,c,Sn(u,n)));return new Kn(i,this._parents,t,n)}function K2(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ux(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var l=r[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var p=e.call(u,u.__data__,f,l),h,x=Sn(u,n),g=0,y=p.length;g<y;++g)(h=p[g])&&Wa(h,t,n,g,p,x);i.push(p),s.push(u)}return new Kn(i,s,t,n)}var X2=Qi.prototype.constructor;function Z2(){return new X2(this._groups,this._parents)}function Q2(e,t){var n,r,o;return function(){var i=Ao(this,e),s=(this.style.removeProperty(e),Ao(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Dx(e){return function(){this.style.removeProperty(e)}}function J2(e,t,n){var r,o=n+"",i;return function(){var s=Ao(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function ej(e,t,n){var r,o,i;return function(){var s=Ao(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Ao(this,e))),s===l?null:s===r&&l===o?i:(o=l,i=t(r=s,a))}}function tj(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var l=Ln(this,e),c=l.on,u=l.value[i]==null?a||(a=Dx(t)):void 0;(c!==n||o!==u)&&(r=(n=c).copy()).on(s,o=u),l.on=r}}function nj(e,t,n){var r=(e+="")=="transform"?r2:Px;return t==null?this.styleTween(e,Q2(e,r)).on("end.style."+e,Dx(e)):typeof t=="function"?this.styleTween(e,ej(e,r,Fu(this,"style."+e,t))).each(tj(this._id,e)):this.styleTween(e,J2(e,r,t),n).on("end.style."+e,null)}function rj(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function oj(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&rj(e,s,n)),r}return i._value=t,i}function ij(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 new Error;return this.tween(r,oj(e,t,n??""))}function sj(e){return function(){this.textContent=e}}function aj(e){return function(){var t=e(this);this.textContent=t??""}}function lj(e){return this.tween("text",typeof e=="function"?aj(Fu(this,"text",e)):sj(e==null?"":e+""))}function cj(e){return function(t){this.textContent=e.call(this,t)}}function uj(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&cj(o)),t}return r._value=e,r}function dj(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 new Error;return this.tween(t,uj(e))}function fj(){for(var e=this._name,t=this._id,n=Ox(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=Sn(l,t);Wa(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Kn(r,this._parents,e,n)}function pj(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--o===0&&i()}};n.each(function(){var c=Ln(this,r),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),o===0&&i()})}var hj=0;function Kn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Ox(){return++hj}var zn=Qi.prototype;Kn.prototype={constructor:Kn,select:q2,selectAll:K2,selectChild:zn.selectChild,selectChildren:zn.selectChildren,filter:B2,merge:H2,selection:Z2,transition:fj,call:zn.call,nodes:zn.nodes,node:zn.node,size:zn.size,empty:zn.empty,each:zn.each,on:W2,attr:C2,attrTween:j2,style:nj,styleTween:ij,text:lj,textTween:dj,remove:Y2,tween:y2,delay:M2,duration:O2,ease:$2,easeVarying:z2,end:pj,[Symbol.iterator]:zn[Symbol.iterator]};function mj(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var gj={time:null,delay:0,duration:250,ease:mj};function xj(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function yj(e){var t,n;e instanceof Kn?(t=e._id,e=e._name):(t=Ox(),(n=gj).time=Lu(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&Wa(l,e,t,c,s,n||xj(l,t));return new Kn(r,this._parents,e,t)}Qi.prototype.interrupt=m2;Qi.prototype.transition=yj;const vs=e=>()=>e;function vj(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Un(e,t,n){this.k=e,this.x=t,this.y=n}Un.prototype={constructor:Un,scale:function(e){return e===1?this:new Un(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Un(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+")"}};var Ga=new Un(1,0,0);Lx.prototype=Un.prototype;function Lx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ga;return e.__zoom}function jl(e){e.stopImmediatePropagation()}function ei(e){e.preventDefault(),e.stopImmediatePropagation()}function wj(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function bj(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Rf(){return this.__zoom||Ga}function Ej(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Sj(){return navigator.maxTouchPoints||"ontouchstart"in this}function kj(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function $x(){var e=wj,t=bj,n=kj,r=Ej,o=Sj,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ls,c=Ha("start","zoom","end"),u,f,p,h=500,x=150,g=0,y=10;function v(_){_.property("__zoom",Rf).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",z).filter(o).on("touchstart.zoom",D).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(_,N,A,I){var j=_.selection?_.selection():_;j.property("__zoom",Rf),_!==j?E(_,N,A,I):j.interrupt().each(function(){C(this,arguments).event(I).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},v.scaleBy=function(_,N,A,I){v.scaleTo(_,function(){var j=this.__zoom.k,R=typeof N=="function"?N.apply(this,arguments):N;return j*R},A,I)},v.scaleTo=function(_,N,A,I){v.transform(_,function(){var j=t.apply(this,arguments),R=this.__zoom,O=A==null?S(j):typeof A=="function"?A.apply(this,arguments):A,L=R.invert(O),Y=typeof N=="function"?N.apply(this,arguments):N;return n(w(b(R,Y),O,L),j,s)},A,I)},v.translateBy=function(_,N,A,I){v.transform(_,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),s)},null,I)},v.translateTo=function(_,N,A,I,j){v.transform(_,function(){var R=t.apply(this,arguments),O=this.__zoom,L=I==null?S(R):typeof I=="function"?I.apply(this,arguments):I;return n(Ga.translate(L[0],L[1]).scale(O.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof A=="function"?-A.apply(this,arguments):-A),R,s)},I,j)};function b(_,N){return N=Math.max(i[0],Math.min(i[1],N)),N===_.k?_:new Un(N,_.x,_.y)}function w(_,N,A){var I=N[0]-A[0]*_.k,j=N[1]-A[1]*_.k;return I===_.x&&j===_.y?_:new Un(_.k,I,j)}function S(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function E(_,N,A,I){_.on("start.zoom",function(){C(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(I).end()}).tween("zoom",function(){var j=this,R=arguments,O=C(j,R).event(I),L=t.apply(j,R),Y=A==null?S(L):typeof A=="function"?A.apply(j,R):A,H=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),V=j.__zoom,U=typeof N=="function"?N.apply(j,R):N,G=l(V.invert(Y).concat(H/V.k),U.invert(Y).concat(H/U.k));return function(B){if(B===1)B=U;else{var W=G(B),Z=H/W[2];B=new Un(Z,Y[0]-W[0]*Z,Y[1]-W[1]*Z)}O.zoom(null,B)}})}function C(_,N,A){return!A&&_.__zooming||new k(_,N)}function k(_,N){this.that=_,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,N),this.taps=0}k.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,N){return this.mouse&&_!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var N=rn(this.that).datum();c.call(_,this.that,new vj(_,{sourceEvent:this.sourceEvent,target:v,transform:this.that.__zoom,dispatch:c}),N)}};function T(_,...N){if(!e.apply(this,arguments))return;var A=C(this,N).event(_),I=this.__zoom,j=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),R=gn(_);if(A.wheel)(A.mouse[0][0]!==R[0]||A.mouse[0][1]!==R[1])&&(A.mouse[1]=I.invert(A.mouse[0]=R)),clearTimeout(A.wheel);else{if(I.k===j)return;A.mouse=[R,I.invert(R)],zs(this),A.start()}ei(_),A.wheel=setTimeout(O,x),A.zoom("mouse",n(w(b(I,j),A.mouse[0],A.mouse[1]),A.extent,s));function O(){A.wheel=null,A.end()}}function P(_,...N){if(p||!e.apply(this,arguments))return;var A=_.currentTarget,I=C(this,N,!0).event(_),j=rn(_.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",H,!0),R=gn(_,A),O=_.clientX,L=_.clientY;bx(_.view),jl(_),I.mouse=[R,this.__zoom.invert(R)],zs(this),I.start();function Y(V){if(ei(V),!I.moved){var U=V.clientX-O,G=V.clientY-L;I.moved=U*U+G*G>g}I.event(V).zoom("mouse",n(w(I.that.__zoom,I.mouse[0]=gn(V,A),I.mouse[1]),I.extent,s))}function H(V){j.on("mousemove.zoom mouseup.zoom",null),Ex(V.view,I.moved),ei(V),I.event(V).end()}}function z(_,...N){if(e.apply(this,arguments)){var A=this.__zoom,I=gn(_.changedTouches?_.changedTouches[0]:_,this),j=A.invert(I),R=A.k*(_.shiftKey?.5:2),O=n(w(b(A,R),I,j),t.apply(this,N),s);ei(_),a>0?rn(this).transition().duration(a).call(E,O,I,_):rn(this).call(v.transform,O,I,_)}}function D(_,...N){if(e.apply(this,arguments)){var A=_.touches,I=A.length,j=C(this,N,_.changedTouches.length===I).event(_),R,O,L,Y;for(jl(_),O=0;O<I;++O)L=A[O],Y=gn(L,this),Y=[Y,this.__zoom.invert(Y),L.identifier],j.touch0?!j.touch1&&j.touch0[2]!==Y[2]&&(j.touch1=Y,j.taps=0):(j.touch0=Y,R=!0,j.taps=1+!!u);u&&(u=clearTimeout(u)),R&&(j.taps<2&&(f=Y[0],u=setTimeout(function(){u=null},h)),zs(this),j.start())}}function $(_,...N){if(this.__zooming){var A=C(this,N).event(_),I=_.changedTouches,j=I.length,R,O,L,Y;for(ei(_),R=0;R<j;++R)O=I[R],L=gn(O,this),A.touch0&&A.touch0[2]===O.identifier?A.touch0[0]=L:A.touch1&&A.touch1[2]===O.identifier&&(A.touch1[0]=L);if(O=A.that.__zoom,A.touch1){var H=A.touch0[0],V=A.touch0[1],U=A.touch1[0],G=A.touch1[1],B=(B=U[0]-H[0])*B+(B=U[1]-H[1])*B,W=(W=G[0]-V[0])*W+(W=G[1]-V[1])*W;O=b(O,Math.sqrt(B/W)),L=[(H[0]+U[0])/2,(H[1]+U[1])/2],Y=[(V[0]+G[0])/2,(V[1]+G[1])/2]}else if(A.touch0)L=A.touch0[0],Y=A.touch0[1];else return;A.zoom("touch",n(w(O,L,Y),A.extent,s))}}function M(_,...N){if(this.__zooming){var A=C(this,N).event(_),I=_.changedTouches,j=I.length,R,O;for(jl(_),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),R=0;R<j;++R)O=I[R],A.touch0&&A.touch0[2]===O.identifier?delete A.touch0:A.touch1&&A.touch1[2]===O.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(O=gn(O,this),Math.hypot(f[0]-O[0],f[1]-O[1])<y)){var L=rn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return v.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:vs(+_),v):r},v.filter=function(_){return arguments.length?(e=typeof _=="function"?_:vs(!!_),v):e},v.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:vs(!!_),v):o},v.extent=function(_){return arguments.length?(t=typeof _=="function"?_:vs([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),v):t},v.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],v):[i[0],i[1]]},v.translateExtent=function(_){return arguments.length?(s[0][0]=+_[0][0],s[1][0]=+_[1][0],s[0][1]=+_[0][1],s[1][1]=+_[1][1],v):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},v.constrain=function(_){return arguments.length?(n=_,v):n},v.duration=function(_){return arguments.length?(a=+_,v):a},v.interpolate=function(_){return arguments.length?(l=_,v):l},v.on=function(){var _=c.on.apply(c,arguments);return _===c?v:_},v.clickDistance=function(_){return arguments.length?(g=(_=+_)*_,v):Math.sqrt(g)},v.tapDistance=function(_){return arguments.length?(y=+_,v):y},v}const Dn={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Oi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Fx=["Enter"," ","Escape"],zx={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var jo;(function(e){e.Strict="strict",e.Loose="loose"})(jo||(jo={}));var Or;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Or||(Or={}));var Li;(function(e){e.Partial="partial",e.Full="full"})(Li||(Li={}));const Bx={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var cr;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(cr||(cr={}));var $i;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($i||($i={}));var ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(ye||(ye={}));const Mf={[ye.Left]:ye.Right,[ye.Right]:ye.Left,[ye.Top]:ye.Bottom,[ye.Bottom]:ye.Top};function Hx(e){return e===null?null:e?"valid":"invalid"}const Vx=e=>"id"in e&&"source"in e&&"target"in e,Cj=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),zu=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),es=(e,t=[0,0])=>{const{width:n,height:r}=Qn(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},_j=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):zu(o)?o:t.nodeLookup.get(o.id));const a=s?sa(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ya(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return qa(n)},ts=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(r=>{if(t.filter===void 0||t.filter(r)){const o=sa(r);n=Ya(n,o)}}),qa(n)},Bu=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...ns(t,[n,r,o]),width:t.width/o,height:t.height/o},l=[];for(const c of e.values()){const{measured:u,selectable:f=!0,hidden:p=!1}=c;if(s&&!f||p)continue;const h=u.width??c.width??c.initialWidth??null,x=u.height??c.height??c.initialHeight??null,g=Fi(a,Ro(c)),y=(h??0)*(x??0),v=i&&g>0;(!c.internals.handleBounds||v||g>=y||c.dragging)&&l.push(c)}return l},Tj=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Aj(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Nj({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=Aj(e,s),l=ts(a),c=Hu(l,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(c,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Ux({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??r;let f=o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",Dn.error005());else{const h=a.measured.width,x=a.measured.height;h&&x&&(f=[[l,c],[l+h,c+x]])}else a&&Mo(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const p=Mo(f)?Yr(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",Dn.error015())),{position:{x:p.x-l+(s.measured.width??0)*u[0],y:p.y-c+(s.measured.height??0)*u[1]},positionAbsolute:p}}async function jj({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(p=>p.id)),s=[];for(const p of n){if(p.deletable===!1)continue;const h=i.has(p.id),x=!h&&p.parentId&&s.find(g=>g.id===p.parentId);(h||x)&&s.push(p)}const a=new Set(t.map(p=>p.id)),l=r.filter(p=>p.deletable!==!1),u=Tj(s,l);for(const p of l)a.has(p.id)&&!u.find(x=>x.id===p.id)&&u.push(p);if(!o)return{edges:u,nodes:s};const f=await o({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const Io=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Yr=(e={x:0,y:0},t,n)=>({x:Io(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Io(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function Wx(e,t,n){const{width:r,height:o}=Qn(n),{x:i,y:s}=n.internals.positionAbsolute;return Yr(e,[[i,s],[i+r,s+o]],t)}const Pf=(e,t,n)=>e<t?Io(Math.abs(e-t),1,t)/t:e>n?-Io(Math.abs(e-n),1,t)/t:0,Gx=(e,t,n=15,r=40)=>{const o=Pf(e.x,r,t.width-r)*n,i=Pf(e.y,r,t.height-r)*n;return[o,i]},Ya=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),kc=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),qa=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ro=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=zu(e)?e.internals.positionAbsolute:es(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},sa=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=zu(e)?e.internals.positionAbsolute:es(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},Yx=(e,t)=>qa(Ya(kc(e),kc(t))),Fi=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Df=e=>yn(e.width)&&yn(e.height)&&yn(e.x)&&yn(e.y),yn=e=>!isNaN(e)&&isFinite(e),Ij=(e,t)=>{},Ka=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),ns=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?Ka(a,s):a},aa=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function io(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Rj(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=io(e,n),o=io(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=io(e.top??e.y??0,n),o=io(e.bottom??e.y??0,n),i=io(e.left??e.x??0,t),s=io(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Mj(e,t,n,r,o,i){const{x:s,y:a}=aa(e,[t,n,r]),{x:l,y:c}=aa({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const Hu=(e,t,n,r,o,i)=>{const s=Rj(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=Io(c,r,o),f=e.x+e.width/2,p=e.y+e.height/2,h=t/2-f*u,x=n/2-p*u,g=Mj(e,h,x,u,t,n),y={left:Math.min(g.left-s.left,0),top:Math.min(g.top-s.top,0),right:Math.min(g.right-s.right,0),bottom:Math.min(g.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:x-y.top+y.bottom,zoom:u}},la=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Mo(e){return e!==void 0&&e!=="parent"}function Qn(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function qx(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function Kx(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function Of(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Pj(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Dj(e){return{...zx,...e||{}}}function Ci(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=An(e),a=ns({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:l,y:c}=n?Ka(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const Vu=e=>({width:e.offsetWidth,height:e.offsetHeight}),Xx=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Oj=["INPUT","SELECT","TEXTAREA"];function Zx(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Oj.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Qx=e=>"clientX"in e,An=(e,t)=>{var i,s;const n=Qx(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Lf=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Vu(s)}})};function Jx({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+o*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+r*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function ws(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function $f({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case ye.Left:return[t-ws(t-r,i),n];case ye.Right:return[t+ws(r-t,i),n];case ye.Top:return[t,n-ws(n-o,i)];case ye.Bottom:return[t,n+ws(o-n,i)]}}function Uu({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:r,targetY:o,targetPosition:i=ye.Top,curvature:s=.25}){const[a,l]=$f({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[c,u]=$f({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[f,p,h,x]=Jx({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${o}`,f,p,h,x]}function ey({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function Lj({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:o=!1}){if(r!==void 0)return r;const i=o&&n?1e3:0,s=Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0);return i+s}function $j({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=Ya(sa(e),sa(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return Fi(s,qa(i))>0}const Fj=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,zj=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Bj=(e,t)=>{if(!e.source||!e.target)return t;let n;return Vx(e)?n={...e}:n={...e,id:Fj(e)},zj(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function ty({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=ey({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const Ff={[ye.Left]:{x:-1,y:0},[ye.Right]:{x:1,y:0},[ye.Top]:{x:0,y:-1},[ye.Bottom]:{x:0,y:1}},Hj=({source:e,sourcePosition:t=ye.Bottom,target:n})=>t===ye.Left||t===ye.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},zf=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Vj({source:e,sourcePosition:t=ye.Bottom,target:n,targetPosition:r=ye.Top,center:o,offset:i}){const s=Ff[t],a=Ff[r],l={x:e.x+s.x*i,y:e.y+s.y*i},c={x:n.x+a.x*i,y:n.y+a.y*i},u=Hj({source:l,sourcePosition:t,target:c}),f=u.x!==0?"x":"y",p=u[f];let h=[],x,g;const y={x:0,y:0},v={x:0,y:0},[b,w,S,E]=ey({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*a[f]===-1){x=o.x??b,g=o.y??w;const k=[{x,y:l.y},{x,y:c.y}],T=[{x:l.x,y:g},{x:c.x,y:g}];s[f]===p?h=f==="x"?k:T:h=f==="x"?T:k}else{const k=[{x:l.x,y:c.y}],T=[{x:c.x,y:l.y}];if(f==="x"?h=s.x===p?T:k:h=s.y===p?k:T,t===r){const M=Math.abs(e[f]-n[f]);if(M<=i){const _=Math.min(i-1,i-M);s[f]===p?y[f]=(l[f]>e[f]?-1:1)*_:v[f]=(c[f]>n[f]?-1:1)*_}}if(t!==r){const M=f==="x"?"y":"x",_=s[f]===a[M],N=l[M]>c[M],A=l[M]<c[M];(s[f]===1&&(!_&&N||_&&A)||s[f]!==1&&(!_&&A||_&&N))&&(h=f==="x"?k:T)}const P={x:l.x+y.x,y:l.y+y.y},z={x:c.x+v.x,y:c.y+v.y},D=Math.max(Math.abs(P.x-h[0].x),Math.abs(z.x-h[0].x)),$=Math.max(Math.abs(P.y-h[0].y),Math.abs(z.y-h[0].y));D>=$?(x=(P.x+z.x)/2,g=h[0].y):(x=h[0].x,g=(P.y+z.y)/2)}return[[e,{x:l.x+y.x,y:l.y+y.y},...h,{x:c.x+v.x,y:c.y+v.y},n],x,g,S,E]}function Uj(e,t,n,r){const o=Math.min(zf(e,t)/2,zf(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+o*c},${s}Q ${i},${s} ${i},${s+o*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+o*l}Q ${i},${s} ${i+o*a},${s}`}function Cc({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:r,targetY:o,targetPosition:i=ye.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20}){const[u,f,p,h,x]=Vj({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:l},offset:c});return[u.reduce((y,v,b)=>{let w="";return b>0&&b<u.length-1?w=Uj(u[b-1],v,u[b+1],s):w=`${b===0?"M":"L"}${v.x} ${v.y}`,y+=w,y},""),f,p,h,x]}function Bf(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Wj(e){var f;const{sourceNode:t,targetNode:n}=e;if(!Bf(t)||!Bf(n))return null;const r=t.internals.handleBounds||Hf(t.handles),o=n.internals.handleBounds||Hf(n.handles),i=Vf((r==null?void 0:r.source)??[],e.sourceHandle),s=Vf(e.connectionMode===jo.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(f=e.onError)==null||f.call(e,"008",Dn.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||ye.Bottom,l=(s==null?void 0:s.position)||ye.Top,c=zi(t,i,a),u=zi(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function Hf(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function zi(e,t,n=ye.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Qn(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case ye.Top:return{x:o+s/2,y:i};case ye.Right:return{x:o+s,y:i+a/2};case ye.Bottom:return{x:o+s/2,y:i+a};case ye.Left:return{x:o,y:i+a/2}}}function Vf(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function _c(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Gj(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(l=>{if(l&&typeof l=="object"){const c=_c(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Wu={nodeOrigin:[0,0],nodeExtent:Oi,elevateNodesOnSelect:!0,defaults:{}},Yj={...Wu,checkEquality:!0};function Gu(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function qj(e,t,n){const r=Gu(Wu,n);for(const o of e.values())if(o.parentId)Yu(o,e,t,r);else{const i=es(o,r.nodeOrigin),s=Mo(o.extent)?o.extent:r.nodeExtent,a=Yr(i,s,Qn(o));o.internals.positionAbsolute=a}}function Tc(e,t,n,r){var l,c;const o=Gu(Yj,r);let i=e.length>0;const s=new Map(t),a=o!=null&&o.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(o.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const p=es(u,o.nodeOrigin),h=Mo(u.extent)?u.extent:o.nodeExtent,x=Yr(p,h,Qn(u));f={...o.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(c=u.measured)==null?void 0:c.height},internals:{positionAbsolute:x,handleBounds:u.measured?f==null?void 0:f.internals.handleBounds:void 0,z:ny(u,a),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(i=!1),u.parentId&&Yu(f,t,n,r)}return i}function Kj(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Yu(e,t,n,r){const{elevateNodesOnSelect:o,nodeOrigin:i,nodeExtent:s}=Gu(Wu,r),a=e.parentId,l=t.get(a);if(!l){console.warn(`Parent node ${a} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Kj(e,n);const c=o?1e3:0,{x:u,y:f,z:p}=Xj(e,l,i,s,c),{positionAbsolute:h}=e.internals,x=u!==h.x||f!==h.y;(x||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:u,y:f}:h,z:p}})}function ny(e,t){return(yn(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Xj(e,t,n,r,o){const{x:i,y:s}=t.internals.positionAbsolute,a=Qn(e),l=es(e,n),c=Mo(e.extent)?Yr(l,e.extent,a):l;let u=Yr({x:i+c.x,y:s+c.y},r,a);e.extent==="parent"&&(u=Wx(u,a,t));const f=ny(e,o),p=t.internals.z??0;return{x:u.x,y:u.y,z:p>=f?p+1:f}}function qu(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const l=t.get(a.parentId);if(!l)continue;const c=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ro(l),u=Yx(c,a.rect);i.set(a.parentId,{expandedRect:u,parent:l})}return i.size>0&&i.forEach(({expandedRect:a,parent:l},c)=>{var w;const u=l.internals.positionAbsolute,f=Qn(l),p=l.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,x=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,g=Math.max(f.width,Math.round(a.width)),y=Math.max(f.height,Math.round(a.height)),v=(g-f.width)*p[0],b=(y-f.height)*p[1];(h>0||x>0||v||b)&&(o.push({id:c,type:"position",position:{x:l.position.x-h+v,y:l.position.y-x+b}}),(w=n.get(c))==null||w.forEach(S=>{e.some(E=>E.id===S.id)||o.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+x}})})),(f.width<a.width||f.height<a.height||h||x)&&o.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(h?p[0]*h-v:0),height:y+(x?p[1]*x-b:0)}})}),o}function Zj(e,t,n,r,o,i){const s=r==null?void 0:r.querySelector(".xyflow__viewport");let a=!1;if(!s)return{changes:[],updatedInternals:a};const l=[],c=window.getComputedStyle(s),{m22:u}=new window.DOMMatrixReadOnly(c.transform),f=[];for(const p of e.values()){const h=t.get(p.id);if(!h)continue;if(h.hidden){t.set(h.id,{...h,internals:{...h.internals,handleBounds:void 0}}),a=!0;continue}const x=Vu(p.nodeElement),g=h.measured.width!==x.width||h.measured.height!==x.height;if(!!(x.width&&x.height&&(g||!h.internals.handleBounds||p.force))){const v=p.nodeElement.getBoundingClientRect(),b=Mo(h.extent)?h.extent:i;let{positionAbsolute:w}=h.internals;h.parentId&&h.extent==="parent"?w=Wx(w,x,t.get(h.parentId)):b&&(w=Yr(w,b,x));const S={...h,measured:x,internals:{...h.internals,positionAbsolute:w,handleBounds:{source:Lf("source",p.nodeElement,v,u,h.id),target:Lf("target",p.nodeElement,v,u,h.id)}}};t.set(h.id,S),h.parentId&&Yu(S,t,n,{nodeOrigin:o}),a=!0,g&&(l.push({id:h.id,type:"dimensions",dimensions:x}),h.expandParent&&h.parentId&&f.push({id:h.id,parentId:h.parentId,rect:Ro(S,o)}))}}if(f.length>0){const p=qu(f,t,n,o);l.push(...p)}return{changes:l,updatedInternals:a}}async function Qj({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Uf(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const l=r.get(s)||new Map;if(r.set(s,l.set(n,t)),i){s=`${o}-${e}-${i}`;const c=r.get(s)||new Map;r.set(s,c.set(n,t))}}function ry(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,l={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},c=`${o}-${s}--${i}-${a}`,u=`${i}-${a}--${o}-${s}`;Uf("source",l,u,e,o,s),Uf("target",l,c,e,i,a),t.set(r.id,r)}}function oy(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:oy(n,t):!1}function Wf(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Jj(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!oy(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function Il({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,l;const o=[];for(const[c,u]of t){const f=(s=n.get(c))==null?void 0:s.internals.userNode;f&&o.push({...f,position:u.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((l=t.get(e))==null?void 0:l.position)||i.position,dragging:r}:o[0],o]}function eI({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,p=null,h=!1,x=!1;function g({noDragClassName:v,handleSelector:b,domNode:w,isSelectable:S,nodeId:E,nodeClickDistance:C=0}){p=rn(w);function k({x:D,y:$},M){const{nodeLookup:_,nodeExtent:N,snapGrid:A,snapToGrid:I,nodeOrigin:j,onNodeDrag:R,onSelectionDrag:O,onError:L,updateNodePositions:Y}=t();i={x:D,y:$};let H=!1,V={x:0,y:0,x2:0,y2:0};if(a.size>1&&N){const U=ts(a);V=kc(U)}for(const[U,G]of a){if(!_.has(U))continue;let B={x:D-G.distance.x,y:$-G.distance.y};I&&(B=Ka(B,A));let W=[[N[0][0],N[0][1]],[N[1][0],N[1][1]]];if(a.size>1&&N&&!G.extent){const{positionAbsolute:se}=G.internals,K=se.x-V.x+N[0][0],ne=se.x+G.measured.width-V.x2+N[1][0],q=se.y-V.y+N[0][1],re=se.y+G.measured.height-V.y2+N[1][1];W=[[K,q],[ne,re]]}const{position:Z,positionAbsolute:ie}=Ux({nodeId:U,nextPosition:B,nodeLookup:_,nodeExtent:W,nodeOrigin:j,onError:L});H=H||G.position.x!==Z.x||G.position.y!==Z.y,G.position=Z,G.internals.positionAbsolute=ie}if(x=x||H,!!H&&(Y(a,!0),M&&(r||R||!E&&O))){const[U,G]=Il({nodeId:E,dragItems:a,nodeLookup:_});r==null||r(M,a,U,G),R==null||R(M,U,G),E||O==null||O(M,G)}}async function T(){if(!u)return;const{transform:D,panBy:$,autoPanSpeed:M,autoPanOnNodeDrag:_}=t();if(!_){l=!1,cancelAnimationFrame(s);return}const[N,A]=Gx(c,u,M);(N!==0||A!==0)&&(i.x=(i.x??0)-N/D[2],i.y=(i.y??0)-A/D[2],await $({x:N,y:A})&&k(i,null)),s=requestAnimationFrame(T)}function P(D){var H;const{nodeLookup:$,multiSelectionActive:M,nodesDraggable:_,transform:N,snapGrid:A,snapToGrid:I,selectNodesOnDrag:j,onNodeDragStart:R,onSelectionDragStart:O,unselectNodesAndEdges:L}=t();f=!0,(!j||!S)&&!M&&E&&((H=$.get(E))!=null&&H.selected||L()),S&&j&&E&&(e==null||e(E));const Y=Ci(D.sourceEvent,{transform:N,snapGrid:A,snapToGrid:I,containerBounds:u});if(i=Y,a=Jj($,_,Y,E),a.size>0&&(n||R||!E&&O)){const[V,U]=Il({nodeId:E,dragItems:a,nodeLookup:$});n==null||n(D.sourceEvent,a,V,U),R==null||R(D.sourceEvent,V,U),E||O==null||O(D.sourceEvent,U)}}const z=Sx().clickDistance(C).on("start",D=>{const{domNode:$,nodeDragThreshold:M,transform:_,snapGrid:N,snapToGrid:A}=t();u=($==null?void 0:$.getBoundingClientRect())||null,h=!1,x=!1,M===0&&P(D),i=Ci(D.sourceEvent,{transform:_,snapGrid:N,snapToGrid:A,containerBounds:u}),c=An(D.sourceEvent,u)}).on("drag",D=>{const{autoPanOnNodeDrag:$,transform:M,snapGrid:_,snapToGrid:N,nodeDragThreshold:A,nodeLookup:I}=t(),j=Ci(D.sourceEvent,{transform:M,snapGrid:_,snapToGrid:N,containerBounds:u});if((D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||E&&!I.has(E))&&(h=!0),!h){if(!l&&$&&f&&(l=!0,T()),!f){const R=j.xSnapped-(i.x??0),O=j.ySnapped-(i.y??0);Math.sqrt(R*R+O*O)>A&&P(D)}(i.x!==j.xSnapped||i.y!==j.ySnapped)&&a&&f&&(c=An(D.sourceEvent,u),k(j,D.sourceEvent))}}).on("end",D=>{if(!(!f||h)&&(l=!1,f=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:$,updateNodePositions:M,onNodeDragStop:_,onSelectionDragStop:N}=t();if(x&&(M(a,!1),x=!1),o||_||!E&&N){const[A,I]=Il({nodeId:E,dragItems:a,nodeLookup:$,dragging:!1});o==null||o(D.sourceEvent,a,A,I),_==null||_(D.sourceEvent,A,I),E||N==null||N(D.sourceEvent,I)}}}).filter(D=>{const $=D.target;return!D.button&&(!v||!Wf($,`.${v}`,w))&&(!b||Wf($,b,w))});p.call(z)}function y(){p==null||p.on(".drag",null)}return{update:g,destroy:y}}function tI(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Fi(o,Ro(i))>0&&r.push(i);return r}const nI=250;function rI(e,t,n,r){var a,l;let o=[],i=1/0;const s=tI(e,n,t+nI);for(const c of s){const u=[...((a=c.internals.handleBounds)==null?void 0:a.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]];for(const f of u){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:p,y:h}=zi(c,f,f.position,!0),x=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));x>t||(x<i?(o=[{...f,x:p,y:h}],i=x):x===i&&o.push({...f,x:p,y:h}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(u=>u.type===c)??o[0]}return o[0]}function iy(e,t,n,r,o,i=!1){var c,u,f;const s=r.get(e);if(!s)return null;const a=o==="strict"?(c=s.internals.handleBounds)==null?void 0:c[t]:[...((u=s.internals.handleBounds)==null?void 0:u.source)??[],...((f=s.internals.handleBounds)==null?void 0:f.target)??[]],l=(n?a==null?void 0:a.find(p=>p.id===n):a==null?void 0:a[0])??null;return l&&i?{...l,...zi(s,l,l.position,!0)}:l}function sy(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function oI(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const ay=()=>!0;function iI(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:p,cancelConnection:h,onConnectStart:x,onConnect:g,onConnectEnd:y,isValidConnection:v=ay,onReconnectEnd:b,updateConnection:w,getTransform:S,getFromHandle:E,autoPanSpeed:C,dragThreshold:k=1}){const T=Xx(e.target);let P=0,z;const{x:D,y:$}=An(e),M=T==null?void 0:T.elementFromPoint(D,$),_=sy(i,M),N=a==null?void 0:a.getBoundingClientRect();let A=!1;if(!N||!_)return;const I=iy(o,_,r,l,t);if(!I)return;let j=An(e,N),R=!1,O=null,L=!1,Y=null;function H(){if(!u||!N)return;const[se,K]=Gx(j,N,C);p({x:se,y:K}),P=requestAnimationFrame(H)}const V={...I,nodeId:o,type:_,position:I.position},U=l.get(o);let B={inProgress:!0,isValid:null,from:zi(U,V,ye.Left,!0),fromHandle:V,fromPosition:V.position,fromNode:U,to:j,toHandle:null,toPosition:Mf[V.position],toNode:null};function W(){A=!0,w(B),x==null||x(e,{nodeId:o,handleId:r,handleType:_})}k===0&&W();function Z(se){if(!A){const{x:re,y:te}=An(se),pe=re-D,ee=te-$;if(!(pe*pe+ee*ee>k*k))return;W()}if(!E()||!V){ie(se);return}const K=S();j=An(se,N),z=rI(ns(j,K,!1,[1,1]),n,l,V),R||(H(),R=!0);const ne=ly(se,{handle:z,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:v,doc:T,lib:c,flowId:f,nodeLookup:l});Y=ne.handleDomNode,O=ne.connection,L=oI(!!z,ne.isValid);const q={...B,isValid:L,to:ne.toHandle&&L?aa({x:ne.toHandle.x,y:ne.toHandle.y},K):j,toHandle:ne.toHandle,toPosition:L&&ne.toHandle?ne.toHandle.position:Mf[V.position],toNode:ne.toHandle?l.get(ne.toHandle.nodeId):null};L&&z&&B.toHandle&&q.toHandle&&B.toHandle.type===q.toHandle.type&&B.toHandle.nodeId===q.toHandle.nodeId&&B.toHandle.id===q.toHandle.id&&B.to.x===q.to.x&&B.to.y===q.to.y||(w(q),B=q)}function ie(se){if(A){(z||Y)&&O&&L&&(g==null||g(O));const{inProgress:K,...ne}=B,q={...ne,toPosition:B.toHandle?B.toPosition:null};y==null||y(se,q),i&&(b==null||b(se,q))}h(),cancelAnimationFrame(P),R=!1,L=!1,O=null,Y=null,T.removeEventListener("mousemove",Z),T.removeEventListener("mouseup",ie),T.removeEventListener("touchmove",Z),T.removeEventListener("touchend",ie)}T.addEventListener("mousemove",Z),T.addEventListener("mouseup",ie),T.addEventListener("touchmove",Z),T.addEventListener("touchend",ie)}function ly(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=ay,nodeLookup:u}){const f=i==="target",p=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:x}=An(e),g=s.elementFromPoint(h,x),y=g!=null&&g.classList.contains(`${a}-flow__handle`)?g:p,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=sy(void 0,y),w=y.getAttribute("data-nodeid"),S=y.getAttribute("data-handleid"),E=y.classList.contains("connectable"),C=y.classList.contains("connectableend");if(!w||!b)return v;const k={source:f?w:r,sourceHandle:f?S:o,target:f?r:w,targetHandle:f?o:S};v.connection=k;const P=E&&C&&(n===jo.Strict?f&&b==="source"||!f&&b==="target":w!==r||S!==o);v.isValid=P&&c(k),v.toHandle=iy(w,b,S,u,n,!0)}return v}const Ac={onPointerDown:iI,isValid:ly};function sI({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=rn(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=10,pannable:f=!0,zoomable:p=!0,inversePan:h=!1}){const x=w=>{const S=n();if(w.sourceEvent.type!=="wheel"||!t)return;const E=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*u,C=S[2]*Math.pow(2,E);t.scaleTo(C)};let g=[0,0];const y=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(g=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},v=w=>{const S=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const E=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],C=[E[0]-g[0],E[1]-g[1]];g=E;const k=r()*Math.max(S[2],Math.log(S[2]))*(h?-1:1),T={x:S[0]-C[0]*k,y:S[1]-C[1]*k},P=[[0,0],[l,c]];t.setViewportConstrained({x:T.x,y:T.y,zoom:S[2]},P,a)},b=$x().on("start",y).on("zoom",f?v:null).on("zoom.wheel",p?x:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:gn}}const aI=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Xa=e=>({x:e.x,y:e.y,zoom:e.k}),Rl=({x:e,y:t,zoom:n})=>Ga.translate(e,t).scale(n),mo=(e,t)=>e.target.closest(`.${t}`),cy=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),lI=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ml=(e,t=0,n=lI,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},uy=e=>{const t=e.ctrlKey&&la()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function cI({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(mo(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const y=gn(u),v=uy(u),b=f*Math.pow(2,v);r.scaleTo(n,b,y,u);return}const p=u.deltaMode===1?20:1;let h=o===Or.Vertical?0:u.deltaX*p,x=o===Or.Horizontal?0:u.deltaY*p;!la()&&u.shiftKey&&o!==Or.Vertical&&(h=u.deltaY*p,x=0),r.translateBy(n,-(h/f)*i,-(x/f)*i,{internal:!0});const g=Xa(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,a==null||a(u,g)),e.isPanScrolling&&(l==null||l(u,g),e.panScrollTimeout=setTimeout(()=>{c==null||c(u,g),e.isPanScrolling=!1},150))}}function uI({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=mo(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function dI({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=Xa(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function fI({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&cy(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,Xa(i.transform)))}}function pI({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&cy(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o&&aI(e.prevViewport,s.transform))){const l=Xa(s.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,l)},n?150:0)}}}function hI({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c}){return u=>{var x;const f=e||t,p=n&&u.ctrlKey;if(u.button===1&&u.type==="mousedown"&&(mo(u,`${c}-flow__node`)||mo(u,`${c}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||mo(u,a)&&u.type==="wheel"||mo(u,l)&&(u.type!=="wheel"||o&&u.type==="wheel"&&!e)||!n&&u.ctrlKey&&u.type==="wheel")return!1;if(!n&&u.type==="touchstart"&&((x=u.touches)==null?void 0:x.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!p&&u.type==="wheel"||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const h=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||u.type==="wheel")&&h}}function mI({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:o,viewport:i,onPanZoom:s,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),p=$x().clickDistance(!yn(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(o),h=rn(e).call(p);w({x:i.x,y:i.y,zoom:Io(i.zoom,t,n)},[[0,0],[f.width,f.height]],o);const x=h.on("wheel.zoom"),g=h.on("dblclick.zoom");p.wheelDelta(uy);function y($,M){return h?new Promise(_=>{p==null||p.interpolate((M==null?void 0:M.interpolate)==="linear"?ki:Ls).transform(Ml(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>_(!0)),$)}):Promise.resolve(!1)}function v({noWheelClassName:$,noPanClassName:M,onPaneContextMenu:_,userSelectionActive:N,panOnScroll:A,panOnDrag:I,panOnScrollMode:j,panOnScrollSpeed:R,preventScrolling:O,zoomOnPinch:L,zoomOnScroll:Y,zoomOnDoubleClick:H,zoomActivationKeyPressed:V,lib:U,onTransformChange:G}){N&&!u.isZoomingOrPanning&&b();const W=A&&!V&&!N?cI({zoomPanValues:u,noWheelClassName:$,d3Selection:h,d3Zoom:p,panOnScrollMode:j,panOnScrollSpeed:R,zoomOnPinch:L,onPanZoomStart:a,onPanZoom:s,onPanZoomEnd:l}):uI({noWheelClassName:$,preventScrolling:O,d3ZoomHandler:x});if(h.on("wheel.zoom",W,{passive:!1}),!N){const ie=dI({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});p.on("start",ie);const se=fI({zoomPanValues:u,panOnDrag:I,onPaneContextMenu:!!_,onPanZoom:s,onTransformChange:G});p.on("zoom",se);const K=pI({zoomPanValues:u,panOnDrag:I,panOnScroll:A,onPaneContextMenu:_,onPanZoomEnd:l,onDraggingChange:c});p.on("end",K)}const Z=hI({zoomActivationKeyPressed:V,panOnDrag:I,zoomOnScroll:Y,panOnScroll:A,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:N,noPanClassName:M,noWheelClassName:$,lib:U});p.filter(Z),H?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)}function b(){p.on("zoom",null)}async function w($,M,_){const N=Rl($),A=p==null?void 0:p.constrain()(N,M,_);return A&&await y(A),new Promise(I=>I(A))}async function S($,M){const _=Rl($);return await y(_,M),new Promise(N=>N(_))}function E($){if(h){const M=Rl($),_=h.property("__zoom");(_.k!==$.zoom||_.x!==$.x||_.y!==$.y)&&(p==null||p.transform(h,M,null,{sync:!0}))}}function C(){const $=h?Lx(h.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function k($,M){return h?new Promise(_=>{p==null||p.interpolate((M==null?void 0:M.interpolate)==="linear"?ki:Ls).scaleTo(Ml(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>_(!0)),$)}):Promise.resolve(!1)}function T($,M){return h?new Promise(_=>{p==null||p.interpolate((M==null?void 0:M.interpolate)==="linear"?ki:Ls).scaleBy(Ml(h,M==null?void 0:M.duration,M==null?void 0:M.ease,()=>_(!0)),$)}):Promise.resolve(!1)}function P($){p==null||p.scaleExtent($)}function z($){p==null||p.translateExtent($)}function D($){const M=!yn($)||$<0?0:$;p==null||p.clickDistance(M)}return{update:v,destroy:b,setViewport:S,setViewportConstrained:w,getViewport:C,scaleTo:k,scaleBy:T,setScaleExtent:P,setTranslateExtent:z,syncViewport:E,setClickDistance:D}}var Po;(function(e){e.Line="line",e.Handle="handle"})(Po||(Po={}));function gI({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function xI(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function or(e,t){return Math.max(0,t-e)}function ir(e,t){return Math.max(0,e-t)}function bs(e,t,n){return Math.max(0,t-e,e-n)}function Gf(e,t){return e?!t:t}function yI(e,t,n,r,o,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,p=u&&f,{xSnapped:h,ySnapped:x}=n,{minWidth:g,maxWidth:y,minHeight:v,maxHeight:b}=r,{x:w,y:S,width:E,height:C,aspectRatio:k}=e;let T=Math.floor(u?h-e.pointerX:0),P=Math.floor(f?x-e.pointerY:0);const z=E+(l?-T:T),D=C+(c?-P:P),$=-i[0]*E,M=-i[1]*C;let _=bs(z,g,y),N=bs(D,v,b);if(s){let j=0,R=0;l&&T<0?j=or(w+T+$,s[0][0]):!l&&T>0&&(j=ir(w+z+$,s[1][0])),c&&P<0?R=or(S+P+M,s[0][1]):!c&&P>0&&(R=ir(S+D+M,s[1][1])),_=Math.max(_,j),N=Math.max(N,R)}if(a){let j=0,R=0;l&&T>0?j=ir(w+T,a[0][0]):!l&&T<0&&(j=or(w+z,a[1][0])),c&&P>0?R=ir(S+P,a[0][1]):!c&&P<0&&(R=or(S+D,a[1][1])),_=Math.max(_,j),N=Math.max(N,R)}if(o){if(u){const j=bs(z/k,v,b)*k;if(_=Math.max(_,j),s){let R=0;!l&&!c||l&&!c&&p?R=ir(S+M+z/k,s[1][1])*k:R=or(S+M+(l?T:-T)/k,s[0][1])*k,_=Math.max(_,R)}if(a){let R=0;!l&&!c||l&&!c&&p?R=or(S+z/k,a[1][1])*k:R=ir(S+(l?T:-T)/k,a[0][1])*k,_=Math.max(_,R)}}if(f){const j=bs(D*k,g,y)/k;if(N=Math.max(N,j),s){let R=0;!l&&!c||c&&!l&&p?R=ir(w+D*k+$,s[1][0])/k:R=or(w+(c?P:-P)*k+$,s[0][0])/k,N=Math.max(N,R)}if(a){let R=0;!l&&!c||c&&!l&&p?R=or(w+D*k,a[1][0])/k:R=ir(w+(c?P:-P)*k,a[0][0])/k,N=Math.max(N,R)}}}P=P+(P<0?N:-N),T=T+(T<0?_:-_),o&&(p?z>D*k?P=(Gf(l,c)?-T:T)/k:T=(Gf(l,c)?-P:P)*k:u?(P=T/k,c=l):(T=P*k,l=c));const A=l?w+T:w,I=c?S+P:S;return{width:E+(l?-T:T),height:C+(c?-P:P),x:i[0]*T*(l?-1:1)+A,y:i[1]*P*(c?-1:1)+I}}const dy={width:0,height:0,x:0,y:0},vI={...dy,pointerX:0,pointerY:0,aspectRatio:1};function wI(e){return[[0,0],[e.measured.width,e.measured.height]]}function bI(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[r-a,o-l],[r+i-a,o+s-l]]}function EI({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=rn(e);function s({controlPosition:l,boundaries:c,keepAspectRatio:u,resizeDirection:f,onResizeStart:p,onResize:h,onResizeEnd:x,shouldResize:g}){let y={...dy},v={...vI};const b=xI(l);let w,S=null,E=[],C,k,T;const P=Sx().on("start",z=>{const{nodeLookup:D,transform:$,snapGrid:M,snapToGrid:_,nodeOrigin:N,paneDomNode:A}=n();if(w=D.get(t),!w)return;S=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:j}=Ci(z.sourceEvent,{transform:$,snapGrid:M,snapToGrid:_,containerBounds:S});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...y,pointerX:I,pointerY:j,aspectRatio:y.width/y.height},C=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(C=D.get(w.parentId),k=C&&w.extent==="parent"?wI(C):void 0),E=[],T=void 0;for(const[R,O]of D)if(O.parentId===t&&(E.push({id:R,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const L=bI(O,w,O.origin??N);T?T=[[Math.min(L[0][0],T[0][0]),Math.min(L[0][1],T[0][1])],[Math.max(L[1][0],T[1][0]),Math.max(L[1][1],T[1][1])]]:T=L}p==null||p(z,{...y})}).on("drag",z=>{const{transform:D,snapGrid:$,snapToGrid:M,nodeOrigin:_}=n(),N=Ci(z.sourceEvent,{transform:D,snapGrid:$,snapToGrid:M,containerBounds:S}),A=[];if(!w)return;const{x:I,y:j,width:R,height:O}=y,L={},Y=w.origin??_,{width:H,height:V,x:U,y:G}=yI(v,b,N,c,u,Y,k,T),B=H!==R,W=V!==O,Z=U!==I&&B,ie=G!==j&&W;if(!Z&&!ie&&!B&&!W)return;if((Z||ie||Y[0]===1||Y[1]===1)&&(L.x=Z?U:y.x,L.y=ie?G:y.y,y.x=L.x,y.y=L.y,E.length>0)){const q=U-I,re=G-j;for(const te of E)te.position={x:te.position.x-q+Y[0]*(H-R),y:te.position.y-re+Y[1]*(V-O)},A.push(te)}if((B||W)&&(L.width=B&&(!f||f==="horizontal")?H:y.width,L.height=W&&(!f||f==="vertical")?V:y.height,y.width=L.width,y.height=L.height),C&&w.expandParent){const q=Y[0]*(L.width??0);L.x&&L.x<q&&(y.x=q,v.x=v.x-(L.x-q));const re=Y[1]*(L.height??0);L.y&&L.y<re&&(y.y=re,v.y=v.y-(L.y-re))}const se=gI({width:y.width,prevWidth:R,height:y.height,prevHeight:O,affectsX:b.affectsX,affectsY:b.affectsY}),K={...y,direction:se};(g==null?void 0:g(z,K))!==!1&&(h==null||h(z,K),r(L,A))}).on("end",z=>{x==null||x(z,{...y}),o==null||o({...y})});i.call(P)}function a(){i.on(".drag",null)}return{update:s,destroy:a}}var Pl={exports:{}},Dl={};/**
365
+ * @license React
366
+ * use-sync-external-store-shim/with-selector.production.js
367
+ *
368
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
369
+ *
370
+ * This source code is licensed under the MIT license found in the
371
+ * LICENSE file in the root directory of this source tree.
372
+ */var Yf;function SI(){if(Yf)return Dl;Yf=1;var e=Ea(),t=uk();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Dl.useSyncExternalStoreWithSelector=function(c,u,f,p,h){var x=i(null);if(x.current===null){var g={hasValue:!1,value:null};x.current=g}else g=x.current;x=a(function(){function v(C){if(!b){if(b=!0,w=C,C=p(C),h!==void 0&&g.hasValue){var k=g.value;if(h(k,C))return S=k}return S=C}if(k=S,r(w,C))return k;var T=p(C);return h!==void 0&&h(k,T)?(w=C,k):(w=C,S=T)}var b=!1,w,S,E=f===void 0?null:f;return[function(){return v(u())},E===null?void 0:function(){return v(E())}]},[u,f,p,h]);var y=o(c,x[0],x[1]);return s(function(){g.hasValue=!0,g.value=y},[y]),l(y),y},Dl}var qf;function kI(){return qf||(qf=1,Pl.exports=SI()),Pl.exports}var CI=kI();const _I=Xc(CI),TI={},Kf=e=>{let t;const n=new Set,r=(u,f)=>{const p=typeof u=="function"?u(t):u;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(x=>x(t,h))}},o=()=>t,l={setState:r,getState:o,getInitialState:()=>c,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(TI?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,o,l);return l},AI=e=>e?Kf(e):Kf,{useDebugValue:NI}=Pt,{useSyncExternalStoreWithSelector:jI}=_I,II=e=>e;function fy(e,t=II,n){const r=jI(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return NI(r),r}const Xf=(e,t)=>{const n=AI(e),r=(o,i=t)=>fy(n,o,i);return Object.assign(r,n),r},RI=(e,t)=>e?Xf(e,t):Xf;function Et(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Za=m.createContext(null),MI=Za.Provider,py=Dn.error001();function Ze(e,t){const n=m.useContext(Za);if(n===null)throw new Error(py);return fy(n,e,t)}function gt(){const e=m.useContext(Za);if(e===null)throw new Error(py);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Zf={display:"none"},PI={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},hy="react-flow__node-desc",my="react-flow__edge-desc",DI="react-flow__aria-live",OI=e=>e.ariaLiveMessage,LI=e=>e.ariaLabelConfig;function $I({rfId:e}){const t=Ze(OI);return d.jsx("div",{id:`${DI}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:PI,children:t})}function FI({rfId:e,disableKeyboardA11y:t}){const n=Ze(LI);return d.jsxs(d.Fragment,{children:[d.jsx("div",{id:`${hy}-${e}`,style:Zf,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),d.jsx("div",{id:`${my}-${e}`,style:Zf,children:n["edge.a11yDescription.default"]}),!t&&d.jsx($I,{rfId:e})]})}const Do=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return d.jsx("div",{className:At(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});Do.displayName="Panel";function zI({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:d.jsx(Do,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:d.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const BI=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},Es=e=>e.id;function HI(e,t){return Et(e.selectedNodes.map(Es),t.selectedNodes.map(Es))&&Et(e.selectedEdges.map(Es),t.selectedEdges.map(Es))}function VI({onSelectionChange:e}){const t=gt(),{selectedNodes:n,selectedEdges:r}=Ze(BI,HI);return m.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const UI=e=>!!e.onSelectionChangeHandlers;function WI({onSelectionChange:e}){const t=Ze(UI);return e||t?d.jsx(VI,{onSelectionChange:e}):null}const gy=[0,0],GI={x:0,y:0,zoom:1},YI=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","ariaLabelConfig"],Qf=[...YI,"rfId"],qI=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Jf={translateExtent:Oi,nodeOrigin:gy,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function KI(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:l,setPaneClickDistance:c}=Ze(qI,Et),u=gt();m.useEffect(()=>(l(e.defaultNodes,e.defaultEdges),()=>{f.current=Jf,a()}),[]);const f=m.useRef(Jf);return m.useEffect(()=>{for(const p of Qf){const h=e[p],x=f.current[p];h!==x&&(typeof e[p]>"u"||(p==="nodes"?t(h):p==="edges"?n(h):p==="minZoom"?r(h):p==="maxZoom"?o(h):p==="translateExtent"?i(h):p==="nodeExtent"?s(h):p==="paneClickDistance"?c(h):p==="ariaLabelConfig"?u.setState({ariaLabelConfig:Dj(h)}):p==="fitView"?u.setState({fitViewQueued:h}):p==="fitViewOptions"?u.setState({fitViewOptions:h}):u.setState({[p]:h})))}f.current=e},Qf.map(p=>e[p])),null}function ep(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function XI(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const o=ep(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=ep())!=null&&r.matches?"dark":"light"}const tp=typeof document<"u"?document:null;function Bi(e=null,t={target:tp,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),o=m.useRef(!1),i=m.useRef(new Set([])),[s,a]=m.useMemo(()=>{if(e!==null){const c=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
373
+ `).replace(`
374
+
375
+ `,`
376
+ +`).split(`
377
+ `)),u=c.reduce((f,p)=>f.concat(...p),[]);return[c,u]}return[[],[]]},[e]);return m.useEffect(()=>{const l=(t==null?void 0:t.target)??tp,c=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var y,v;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!c)&&Zx(h))return!1;const g=rp(h.code,a);if(i.current.add(h[g]),np(s,i.current,!1)){const b=((v=(y=h.composedPath)==null?void 0:y.call(h))==null?void 0:v[0])||h.target,w=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(o.current||!w)&&h.preventDefault(),r(!0)}},f=h=>{const x=rp(h.code,a);np(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[x]),h.key==="Meta"&&i.current.clear(),o.current=!1},p=()=>{i.current.clear(),r(!1)};return l==null||l.addEventListener("keydown",u),l==null||l.addEventListener("keyup",f),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{l==null||l.removeEventListener("keydown",u),l==null||l.removeEventListener("keyup",f),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function np(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function rp(e,t){return t.includes(e)?"code":"key"}const ZI=()=>{const e=gt();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=Hu(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(l,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},u=n.snapGrid??o,f=n.snapToGrid??i;return ns(c,r,f,u)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=aa(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function xy(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const l of s)QI(l,a);n.push(a)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function QI(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured??(t.measured={}),t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function yy(e,t){return xy(e,t)}function vy(e,t){return xy(e,t)}function Ar(e,t){return{id:e,type:"select",selected:t}}function go(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(Ar(i.id,s)))}return r}function op({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const a=t.get(s.id),l=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;l!==void 0&&l!==s&&n.push({id:s.id,item:s,type:"replace"}),l===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function ip(e){return{id:e.id,type:"remove"}}const sp=e=>Cj(e),JI=e=>Vx(e);function wy(e){return m.forwardRef(e)}const eR=typeof window<"u"?m.useLayoutEffect:m.useEffect;function ap(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>tR(()=>n(o=>o+BigInt(1))));return eR(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function tR(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const by=m.createContext(null);function nR({children:e}){const t=gt(),n=m.useCallback(a=>{const{nodes:l=[],setNodes:c,hasDefaultNodes:u,onNodesChange:f,nodeLookup:p,fitViewQueued:h}=t.getState();let x=l;for(const y of a)x=typeof y=="function"?y(x):y;const g=op({items:x,lookup:p});u&&c(x),g.length>0?f==null||f(g):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:b}=t.getState();y&&b(v)})},[]),r=ap(n),o=m.useCallback(a=>{const{edges:l=[],setEdges:c,hasDefaultEdges:u,onEdgesChange:f,edgeLookup:p}=t.getState();let h=l;for(const x of a)h=typeof x=="function"?x(h):x;u?c(h):f&&f(op({items:h,lookup:p}))},[]),i=ap(o),s=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return d.jsx(by.Provider,{value:s,children:e})}function rR(){const e=m.useContext(by);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const oR=e=>!!e.panZoom;function Qa(){const e=ZI(),t=gt(),n=rR(),r=Ze(oR),o=m.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),s=f=>{n.nodeQueue.push(f)},a=f=>{n.edgeQueue.push(f)},l=f=>{var v,b;const{nodeLookup:p,nodeOrigin:h}=t.getState(),x=sp(f)?f:p.get(f.id),g=x.parentId?Kx(x.position,x.measured,x.parentId,p,h):x.position,y={...x,position:g,width:((v=x.measured)==null?void 0:v.width)??x.width,height:((b=x.measured)==null?void 0:b.height)??x.height};return Ro(y)},c=(f,p,h={replace:!1})=>{s(x=>x.map(g=>{if(g.id===f){const y=typeof p=="function"?p(g):p;return h.replace&&sp(y)?y:{...g,...y}}return g}))},u=(f,p,h={replace:!1})=>{a(x=>x.map(g=>{if(g.id===f){const y=typeof p=="function"?p(g):p;return h.replace&&JI(y)?y:{...g,...y}}return g}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var p;return(p=i(f))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(p=>({...p}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:s,setEdges:a,addNodes:f=>{const p=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...p])},addEdges:f=>{const p=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:f=[],edges:p=[],transform:h}=t.getState(),[x,g,y]=h;return{nodes:f.map(v=>({...v})),edges:p.map(v=>({...v})),viewport:{x,y:g,zoom:y}}},deleteElements:async({nodes:f=[],edges:p=[]})=>{const{nodes:h,edges:x,onNodesDelete:g,onEdgesDelete:y,triggerNodeChanges:v,triggerEdgeChanges:b,onDelete:w,onBeforeDelete:S}=t.getState(),{nodes:E,edges:C}=await jj({nodesToRemove:f,edgesToRemove:p,nodes:h,edges:x,onBeforeDelete:S}),k=C.length>0,T=E.length>0;if(k){const P=C.map(ip);y==null||y(C),b(P)}if(T){const P=E.map(ip);g==null||g(E),v(P)}return(T||k)&&(w==null||w({nodes:E,edges:C})),{deletedNodes:E,deletedEdges:C}},getIntersectingNodes:(f,p=!0,h)=>{const x=Df(f),g=x?f:l(f),y=h!==void 0;return g?(h||t.getState().nodes).filter(v=>{const b=t.getState().nodeLookup.get(v.id);if(b&&!x&&(v.id===f.id||!b.internals.positionAbsolute))return!1;const w=Ro(y?v:b),S=Fi(w,g);return p&&S>0||S>=g.width*g.height}):[]},isNodeIntersecting:(f,p,h=!0)=>{const g=Df(f)?f:l(f);if(!g)return!1;const y=Fi(g,p);return h&&y>0||y>=g.width*g.height},updateNode:c,updateNodeData:(f,p,h={replace:!1})=>{c(f,x=>{const g=typeof p=="function"?p(x):p;return h.replace?{...x,data:g}:{...x,data:{...x.data,...g}}},h)},updateEdge:u,updateEdgeData:(f,p,h={replace:!1})=>{u(f,x=>{const g=typeof p=="function"?p(x):p;return h.replace?{...x,data:g}:{...x,data:{...x.data,...g}}},h)},getNodesBounds:f=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return _j(f,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:f,id:p,nodeId:h})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${h}-${f}${p?`-${p}`:""}`))==null?void 0:x.values())??[])},getNodeConnections:({type:f,handleId:p,nodeId:h})=>{var x;return Array.from(((x=t.getState().connectionLookup.get(`${h}${f?p?`-${f}-${p}`:`-${f}`:""}`))==null?void 0:x.values())??[])},fitView:async f=>{const p=t.getState().fitViewResolver??Pj();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const lp=e=>e.selected,iR=typeof window<"u"?window:void 0;function sR({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=gt(),{deleteElements:r}=Qa(),o=Bi(e,{actInsideInputWithModifier:!1}),i=Bi(t,{target:iR});m.useEffect(()=>{if(o){const{edges:s,nodes:a}=n.getState();r({nodes:a.filter(lp),edges:s.filter(lp)}),n.setState({nodesSelectionActive:!1})}},[o]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function aR(e){const t=gt();m.useEffect(()=>{const n=()=>{var o,i;if(!e.current)return!1;const r=Vu(e.current);(r.height===0||r.width===0)&&((i=(o=t.getState()).onError)==null||i.call(o,"004",Dn.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Ja={position:"absolute",width:"100%",height:"100%",top:0,left:0},lR=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function cR({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Or.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:l,translateExtent:c,minZoom:u,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:h=!0,children:x,noWheelClassName:g,noPanClassName:y,onViewportChange:v,isControlledViewport:b,paneClickDistance:w}){const S=gt(),E=m.useRef(null),{userSelectionActive:C,lib:k}=Ze(lR,Et),T=Bi(p),P=m.useRef();aR(E);const z=m.useCallback(D=>{v==null||v({x:D[0],y:D[1],zoom:D[2]}),b||S.setState({transform:D})},[v,b]);return m.useEffect(()=>{if(E.current){P.current=mI({domNode:E.current,minZoom:u,maxZoom:f,translateExtent:c,viewport:l,paneClickDistance:w,onDraggingChange:_=>S.setState({paneDragging:_}),onPanZoomStart:(_,N)=>{const{onViewportChangeStart:A,onMoveStart:I}=S.getState();I==null||I(_,N),A==null||A(N)},onPanZoom:(_,N)=>{const{onViewportChange:A,onMove:I}=S.getState();I==null||I(_,N),A==null||A(N)},onPanZoomEnd:(_,N)=>{const{onViewportChangeEnd:A,onMoveEnd:I}=S.getState();I==null||I(_,N),A==null||A(N)}});const{x:D,y:$,zoom:M}=P.current.getViewport();return S.setState({panZoom:P.current,transform:[D,$,M],domNode:E.current.closest(".react-flow")}),()=>{var _;(_=P.current)==null||_.destroy()}}},[]),m.useEffect(()=>{var D;(D=P.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:T,preventScrolling:h,noPanClassName:y,userSelectionActive:C,noWheelClassName:g,lib:k,onTransformChange:z})},[e,t,n,r,o,i,s,a,T,h,y,C,g,k,z]),d.jsx("div",{className:"react-flow__renderer",ref:E,style:Ja,children:x})}const uR=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function dR(){const{userSelectionActive:e,userSelectionRect:t}=Ze(uR,Et);return e&&t?d.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Ol=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},fR=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function pR({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Li.Full,panOnDrag:r,selectionOnDrag:o,onSelectionStart:i,onSelectionEnd:s,onPaneClick:a,onPaneContextMenu:l,onPaneScroll:c,onPaneMouseEnter:u,onPaneMouseMove:f,onPaneMouseLeave:p,children:h}){const x=gt(),{userSelectionActive:g,elementsSelectable:y,dragging:v,connectionInProgress:b}=Ze(fR,Et),w=y&&(e||g),S=m.useRef(null),E=m.useRef(),C=m.useRef(new Set),k=m.useRef(new Set),T=m.useRef(!1),P=m.useRef(!1),z=I=>{if(T.current||b){T.current=!1;return}a==null||a(I),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},D=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}l==null||l(I)},$=c?I=>c(I):void 0,M=I=>{var Y,H;const{resetSelectedElements:j,domNode:R}=x.getState();if(E.current=R==null?void 0:R.getBoundingClientRect(),!y||!e||I.button!==0||I.target!==S.current||!E.current)return;(H=(Y=I.target)==null?void 0:Y.setPointerCapture)==null||H.call(Y,I.pointerId),P.current=!0,T.current=!1;const{x:O,y:L}=An(I.nativeEvent,E.current);j(),x.setState({userSelectionRect:{width:0,height:0,startX:O,startY:L,x:O,y:L}}),i==null||i(I)},_=I=>{const{userSelectionRect:j,transform:R,nodeLookup:O,edgeLookup:L,connectionLookup:Y,triggerNodeChanges:H,triggerEdgeChanges:V,defaultEdgeOptions:U}=x.getState();if(!E.current||!j)return;T.current=!0;const{x:G,y:B}=An(I.nativeEvent,E.current),{startX:W,startY:Z}=j,ie={startX:W,startY:Z,x:G<W?G:W,y:B<Z?B:Z,width:Math.abs(G-W),height:Math.abs(B-Z)},se=C.current,K=k.current;C.current=new Set(Bu(O,ie,R,n===Li.Partial,!0).map(q=>q.id)),k.current=new Set;const ne=(U==null?void 0:U.selectable)??!0;for(const q of C.current){const re=Y.get(q);if(re)for(const{edgeId:te}of re.values()){const pe=L.get(te);pe&&(pe.selectable??ne)&&k.current.add(te)}}if(!Of(se,C.current)){const q=go(O,C.current,!0);H(q)}if(!Of(K,k.current)){const q=go(L,k.current);V(q)}x.setState({userSelectionRect:ie,userSelectionActive:!0,nodesSelectionActive:!1})},N=I=>{var R,O;if(I.button!==0||!P.current)return;(O=(R=I.target)==null?void 0:R.releasePointerCapture)==null||O.call(R,I.pointerId);const{userSelectionRect:j}=x.getState();!g&&j&&I.target===S.current&&(z==null||z(I)),x.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:C.current.size>0}),s==null||s(I),(t||o)&&(T.current=!1),P.current=!1},A=r===!0||Array.isArray(r)&&r.includes(0);return d.jsxs("div",{className:At(["react-flow__pane",{draggable:A,dragging:v,selection:e}]),onClick:w?void 0:Ol(z,S),onContextMenu:Ol(D,S),onWheel:Ol($,S),onPointerEnter:w?void 0:u,onPointerDown:w?M:f,onPointerMove:w?_:f,onPointerUp:w?N:void 0,onPointerLeave:p,ref:S,style:Ja,children:[h,d.jsx(dR,{})]})}function Nc({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);if(!c){l==null||l("012",Dn.error012(e));return}t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):o([e])}function Ey({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const a=gt(),[l,c]=m.useState(!1),u=m.useRef();return m.useEffect(()=>{u.current=eI({getStoreItems:()=>a.getState(),onNodeMouseDown:f=>{Nc({id:f,store:a,nodeRef:e})},onDragStart:()=>{c(!0)},onDragStop:()=>{c(!1)}})},[]),m.useEffect(()=>{var f,p;if(t)(f=u.current)==null||f.destroy();else if(e.current)return(p=u.current)==null||p.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var h;(h=u.current)==null||h.destroy()}},[n,r,t,i,e,o]),l}const hR=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Sy(){const e=gt();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:l,nodeLookup:c,nodeOrigin:u}=e.getState(),f=new Map,p=hR(s),h=o?i[0]:5,x=o?i[1]:5,g=n.direction.x*h*n.factor,y=n.direction.y*x*n.factor;for(const[,v]of c){if(!p(v))continue;let b={x:v.internals.positionAbsolute.x+g,y:v.internals.positionAbsolute.y+y};o&&(b=Ka(b,i));const{position:w,positionAbsolute:S}=Ux({nodeId:v.id,nextPosition:b,nodeLookup:c,nodeExtent:r,nodeOrigin:u,onError:a});v.position=w,v.internals.positionAbsolute=S,f.set(v.id,v)}l(f)},[])}const Ku=m.createContext(null),mR=Ku.Provider;Ku.Consumer;const ky=()=>m.useContext(Ku),gR=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),xR=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:a,toHandle:l,isValid:c}=s,u=(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:u,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===jo.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:u&&c}};function yR({type:e="source",position:t=ye.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:l,className:c,onMouseDown:u,onTouchStart:f,...p},h){var N,A;const x=s||null,g=e==="target",y=gt(),v=ky(),{connectOnClick:b,noPanClassName:w,rfId:S}=Ze(gR,Et),{connectingFrom:E,connectingTo:C,clickConnecting:k,isPossibleEndHandle:T,connectionInProcess:P,clickConnectionInProcess:z,valid:D}=Ze(xR(v,x,e),Et);v||(A=(N=y.getState()).onError)==null||A.call(N,"010",Dn.error010());const $=I=>{const{defaultEdgeOptions:j,onConnect:R,hasDefaultEdges:O}=y.getState(),L={...j,...I};if(O){const{edges:Y,setEdges:H}=y.getState();H(Bj(L,Y))}R==null||R(L),a==null||a(L)},M=I=>{if(!v)return;const j=Qx(I.nativeEvent);if(o&&(j&&I.button===0||!j)){const R=y.getState();Ac.onPointerDown(I.nativeEvent,{autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:g,handleId:x,nodeId:v,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:R.onConnectEnd,updateConnection:R.updateConnection,onConnect:$,isValidConnection:n||R.isValidConnection,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}j?u==null||u(I):f==null||f(I)},_=I=>{const{onClickConnectStart:j,onClickConnectEnd:R,connectionClickStartHandle:O,connectionMode:L,isValidConnection:Y,lib:H,rfId:V,nodeLookup:U,connection:G}=y.getState();if(!v||!O&&!o)return;if(!O){j==null||j(I.nativeEvent,{nodeId:v,handleId:x,handleType:e}),y.setState({connectionClickStartHandle:{nodeId:v,type:e,id:x}});return}const B=Xx(I.target),W=n||Y,{connection:Z,isValid:ie}=Ac.isValid(I.nativeEvent,{handle:{nodeId:v,id:x,type:e},connectionMode:L,fromNodeId:O.nodeId,fromHandleId:O.id||null,fromType:O.type,isValidConnection:W,flowId:V,doc:B,lib:H,nodeLookup:U});ie&&Z&&$(Z);const se=structuredClone(G);delete se.inProgress,se.toPosition=se.toHandle?se.toHandle.position:null,R==null||R(I,se),y.setState({connectionClickStartHandle:null})};return d.jsx("div",{"data-handleid":x,"data-nodeid":v,"data-handlepos":t,"data-id":`${S}-${v}-${x}-${e}`,className:At(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,c,{source:!g,target:g,connectable:r,connectablestart:o,connectableend:i,clickconnecting:k,connectingfrom:E,connectingto:C,valid:D,connectionindicator:r&&(!P||T)&&(P||z?i:o)}]),onMouseDown:M,onTouchStart:M,onClick:b?_:void 0,ref:h,...p,children:l})}const Ct=m.memo(wy(yR));function vR({data:e,isConnectable:t,sourcePosition:n=ye.Bottom}){return d.jsxs(d.Fragment,{children:[e==null?void 0:e.label,d.jsx(Ct,{type:"source",position:n,isConnectable:t})]})}function wR({data:e,isConnectable:t,targetPosition:n=ye.Top,sourcePosition:r=ye.Bottom}){return d.jsxs(d.Fragment,{children:[d.jsx(Ct,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,d.jsx(Ct,{type:"source",position:r,isConnectable:t})]})}function bR(){return null}function ER({data:e,isConnectable:t,targetPosition:n=ye.Top}){return d.jsxs(d.Fragment,{children:[d.jsx(Ct,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ca={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},cp={input:vR,default:wR,output:ER,group:bR};function SR(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const kR=e=>{const{width:t,height:n,x:r,y:o}=ts(e.nodeLookup,{filter:i=>!!i.selected});return{width:yn(t)?t:null,height:yn(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function CR({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=gt(),{width:o,height:i,transformString:s,userSelectionActive:a}=Ze(kR,Et),l=Sy(),c=m.useRef(null);if(m.useEffect(()=>{var p;n||(p=c.current)==null||p.focus({preventScroll:!0})},[n]),Ey({nodeRef:c}),a||!o||!i)return null;const u=e?p=>{const h=r.getState().nodes.filter(x=>x.selected);e(p,h)}:void 0,f=p=>{Object.prototype.hasOwnProperty.call(ca,p.key)&&(p.preventDefault(),l({direction:ca[p.key],factor:p.shiftKey?4:1}))};return d.jsx("div",{className:At(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:d.jsx("div",{ref:c,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:i}})})}const up=typeof window<"u"?window:void 0,_R=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Cy({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:l,selectionKeyCode:c,selectionOnDrag:u,selectionMode:f,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:x,panActivationKeyCode:g,zoomActivationKeyCode:y,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:S,panOnScrollSpeed:E,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:T,defaultViewport:P,translateExtent:z,minZoom:D,maxZoom:$,preventScrolling:M,onSelectionContextMenu:_,noWheelClassName:N,noPanClassName:A,disableKeyboardA11y:I,onViewportChange:j,isControlledViewport:R}){const{nodesSelectionActive:O,userSelectionActive:L}=Ze(_R),Y=Bi(c,{target:up}),H=Bi(g,{target:up}),V=H||T,U=H||S,G=u&&V!==!0,B=Y||L||G;return sR({deleteKeyCode:l,multiSelectionKeyCode:x}),d.jsx(cR,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:U,panOnScrollSpeed:E,panOnScrollMode:C,zoomOnDoubleClick:k,panOnDrag:!Y&&V,defaultViewport:P,translateExtent:z,minZoom:D,maxZoom:$,zoomActivationKeyCode:y,preventScrolling:M,noWheelClassName:N,noPanClassName:A,onViewportChange:j,isControlledViewport:R,paneClickDistance:a,children:d.jsxs(pR,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:V,isSelecting:!!B,selectionMode:f,selectionKeyPressed:Y,selectionOnDrag:G,children:[e,O&&d.jsx(CR,{onSelectionContextMenu:_,noPanClassName:A,disableKeyboardA11y:I})]})})}Cy.displayName="FlowRenderer";const TR=m.memo(Cy),AR=e=>t=>e?Bu(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function NR(e){return Ze(m.useCallback(AR(e),[e]),Et)}const jR=e=>e.updateNodeInternals;function IR(){const e=Ze(jR),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function RR({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=gt(),i=m.useRef(null),s=m.useRef(null),a=m.useRef(e.sourcePosition),l=m.useRef(e.targetPosition),c=m.useRef(t),u=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!u||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[u,e.hidden]),m.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),m.useEffect(()=>{if(i.current){const f=c.current!==t,p=a.current!==e.sourcePosition,h=l.current!==e.targetPosition;(f||p||h)&&(c.current=t,a.current=e.sourcePosition,l.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function MR({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:l,nodesConnectable:c,nodesFocusable:u,resizeObserver:f,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:x,rfId:g,nodeTypes:y,nodeClickDistance:v,onError:b}){const{node:w,internals:S,isParent:E}=Ze(W=>{const Z=W.nodeLookup.get(e),ie=W.parentLookup.has(e);return{node:Z,internals:Z.internals,isParent:ie}},Et);let C=w.type||"default",k=(y==null?void 0:y[C])||cp[C];k===void 0&&(b==null||b("003",Dn.error003(C)),C="default",k=cp.default);const T=!!(w.draggable||a&&typeof w.draggable>"u"),P=!!(w.selectable||l&&typeof w.selectable>"u"),z=!!(w.connectable||c&&typeof w.connectable>"u"),D=!!(w.focusable||u&&typeof w.focusable>"u"),$=gt(),M=qx(w),_=RR({node:w,nodeType:C,hasDimensions:M,resizeObserver:f}),N=Ey({nodeRef:_,disabled:w.hidden||!T,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:P,nodeClickDistance:v}),A=Sy();if(w.hidden)return null;const I=Qn(w),j=SR(w),R=P||T||t||n||r||o,O=n?W=>n(W,{...S.userNode}):void 0,L=r?W=>r(W,{...S.userNode}):void 0,Y=o?W=>o(W,{...S.userNode}):void 0,H=i?W=>i(W,{...S.userNode}):void 0,V=s?W=>s(W,{...S.userNode}):void 0,U=W=>{const{selectNodesOnDrag:Z,nodeDragThreshold:ie}=$.getState();P&&(!Z||!T||ie>0)&&Nc({id:e,store:$,nodeRef:_}),t&&t(W,{...S.userNode})},G=W=>{if(!(Zx(W.nativeEvent)||x)){if(Fx.includes(W.key)&&P){const Z=W.key==="Escape";Nc({id:e,store:$,unselect:Z,nodeRef:_})}else if(T&&w.selected&&Object.prototype.hasOwnProperty.call(ca,W.key)){W.preventDefault();const{ariaLabelConfig:Z}=$.getState();$.setState({ariaLiveMessage:Z["node.a11yDescription.ariaLiveMessage"]({direction:W.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),A({direction:ca[W.key],factor:W.shiftKey?4:1})}}},B=()=>{var q;if(x||!((q=_.current)!=null&&q.matches(":focus-visible")))return;const{transform:W,width:Z,height:ie,autoPanOnNodeFocus:se,setCenter:K}=$.getState();if(!se)return;Bu(new Map([[e,w]]),{x:0,y:0,width:Z,height:ie},W,!0).length>0||K(w.position.x+I.width/2,w.position.y+I.height/2,{zoom:W[2]})};return d.jsx("div",{className:At(["react-flow__node",`react-flow__node-${C}`,{[h]:T},w.className,{selected:w.selected,selectable:P,parent:E,draggable:T,dragging:N}]),ref:_,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:M?"visible":"hidden",...w.style,...j},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:O,onMouseMove:L,onMouseLeave:Y,onContextMenu:H,onClick:U,onDoubleClick:V,onKeyDown:D?G:void 0,tabIndex:D?0:void 0,onFocus:D?B:void 0,role:w.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${hy}-${g}`,"aria-label":w.ariaLabel,...w.domAttributes,children:d.jsx(mR,{value:e,children:d.jsx(k,{id:e,data:w.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:w.selected??!1,selectable:P,draggable:T,deletable:w.deletable??!0,isConnectable:z,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:N,dragHandle:w.dragHandle,zIndex:S.z,parentId:w.parentId,...I})})})}const PR=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function _y(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=Ze(PR,Et),s=NR(e.onlyRenderVisibleElements),a=IR();return d.jsx("div",{className:"react-flow__nodes",style:Ja,children:s.map(l=>d.jsx(MR,{id:l,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},l))})}_y.displayName="NodeRenderer";const DR=m.memo(_y);function OR(e){return Ze(m.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&$j({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),Et)}const LR=({color:e="none",strokeWidth:t=1})=>d.jsx("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),$R=({color:e="none",strokeWidth:t=1})=>d.jsx("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),dp={[$i.Arrow]:LR,[$i.ArrowClosed]:$R};function FR(e){const t=gt();return m.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(dp,e)?dp[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",Dn.error009(e)),null)},[e])}const zR=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const l=FR(t);return l?d.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:d.jsx(l,{color:n,strokeWidth:s})}):null},Ty=({defaultColor:e,rfId:t})=>{const n=Ze(i=>i.edges),r=Ze(i=>i.defaultEdgeOptions),o=m.useMemo(()=>Gj(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?d.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:d.jsx("defs",{children:o.map(i=>d.jsx(zR,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Ty.displayName="MarkerDefinitions";var BR=m.memo(Ty);function Ay({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:l,className:c,...u}){const[f,p]=m.useState({x:1,y:0,width:0,height:0}),h=At(["react-flow__edge-textwrapper",c]),x=m.useRef(null);return m.useEffect(()=>{if(x.current){const g=x.current.getBBox();p({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?d.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...u,children:[o&&d.jsx("rect",{width:f.width+2*s[0],x:-s[0],y:-s[1],height:f.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),d.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:x,style:r,children:n}),l]}):null}Ay.displayName="EdgeText";const HR=m.memo(Ay);function el({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:c=20,...u}){return d.jsxs(d.Fragment,{children:[d.jsx("path",{...u,d:e,fill:"none",className:At(["react-flow__edge-path",u.className])}),c&&d.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:c,className:"react-flow__edge-interaction"}),r&&yn(t)&&yn(n)?d.jsx(HR,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function fp({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===ye.Left||e===ye.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function Ny({sourceX:e,sourceY:t,sourcePosition:n=ye.Bottom,targetX:r,targetY:o,targetPosition:i=ye.Top}){const[s,a]=fp({pos:n,x1:e,y1:t,x2:r,y2:o}),[l,c]=fp({pos:i,x1:r,y1:o,x2:e,y2:t}),[u,f,p,h]=Jx({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${r},${o}`,u,f,p,h]}function jy(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:x,markerEnd:g,markerStart:y,interactionWidth:v})=>{const[b,w,S]=Ny({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a}),E=e.isInternal?void 0:t;return d.jsx(el,{id:E,path:b,labelX:w,labelY:S,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:x,markerEnd:g,markerStart:y,interactionWidth:v})})}const VR=jy({isInternal:!1}),Iy=jy({isInternal:!0});VR.displayName="SimpleBezierEdge";Iy.displayName="SimpleBezierEdgeInternal";function Ry(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:p,sourcePosition:h=ye.Bottom,targetPosition:x=ye.Top,markerEnd:g,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,S,E]=Cc({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:i,targetPosition:x,borderRadius:v==null?void 0:v.borderRadius,offset:v==null?void 0:v.offset}),C=e.isInternal?void 0:t;return d.jsx(el,{id:C,path:w,labelX:S,labelY:E,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:y,interactionWidth:b})})}const My=Ry({isInternal:!1}),Py=Ry({isInternal:!0});My.displayName="SmoothStepEdge";Py.displayName="SmoothStepEdgeInternal";function Dy(e){return m.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return d.jsx(My,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const UR=Dy({isInternal:!1}),Oy=Dy({isInternal:!0});UR.displayName="StepEdge";Oy.displayName="StepEdgeInternal";function Ly(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:x,interactionWidth:g})=>{const[y,v,b]=ty({sourceX:n,sourceY:r,targetX:o,targetY:i}),w=e.isInternal?void 0:t;return d.jsx(el,{id:w,path:y,labelX:v,labelY:b,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:x,interactionWidth:g})})}const WR=Ly({isInternal:!1}),$y=Ly({isInternal:!0});WR.displayName="StraightEdge";$y.displayName="StraightEdgeInternal";function Fy(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=ye.Bottom,targetPosition:a=ye.Top,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:x,markerEnd:g,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,S,E]=Uu({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a,curvature:v==null?void 0:v.curvature}),C=e.isInternal?void 0:t;return d.jsx(el,{id:C,path:w,labelX:S,labelY:E,label:l,labelStyle:c,labelShowBg:u,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:x,markerEnd:g,markerStart:y,interactionWidth:b})})}const GR=Fy({isInternal:!1}),zy=Fy({isInternal:!0});GR.displayName="BezierEdge";zy.displayName="BezierEdgeInternal";const pp={default:zy,straight:$y,step:Oy,smoothstep:Py,simplebezier:Iy},hp={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},YR=(e,t,n)=>n===ye.Left?e-t:n===ye.Right?e+t:e,qR=(e,t,n)=>n===ye.Top?e-t:n===ye.Bottom?e+t:e,mp="react-flow__edgeupdater";function gp({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a}){return d.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:At([mp,`${mp}-${a}`]),cx:YR(t,r,e),cy:qR(n,r,e),r,stroke:"transparent",fill:"transparent"})}function KR({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:c,onReconnectStart:u,onReconnectEnd:f,setReconnecting:p,setUpdateHover:h}){const x=gt(),g=(S,E)=>{if(S.button!==0)return;const{autoPanOnConnect:C,domNode:k,isValidConnection:T,connectionMode:P,connectionRadius:z,lib:D,onConnectStart:$,onConnectEnd:M,cancelConnection:_,nodeLookup:N,rfId:A,panBy:I,updateConnection:j}=x.getState(),R=E.type==="target",O=(H,V)=>{p(!1),f==null||f(H,n,E.type,V)},L=H=>c==null?void 0:c(n,H),Y=(H,V)=>{p(!0),u==null||u(S,n,E.type),$==null||$(H,V)};Ac.onPointerDown(S.nativeEvent,{autoPanOnConnect:C,connectionMode:P,connectionRadius:z,domNode:k,handleId:E.id,nodeId:E.nodeId,nodeLookup:N,isTarget:R,edgeUpdaterType:E.type,lib:D,flowId:A,cancelConnection:_,panBy:I,isValidConnection:T,onConnect:L,onConnectStart:Y,onConnectEnd:M,onReconnectEnd:O,updateConnection:j,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold})},y=S=>g(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),v=S=>g(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),w=()=>h(!1);return d.jsxs(d.Fragment,{children:[(e===!0||e==="source")&&d.jsx(gp,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:y,onMouseEnter:b,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&d.jsx(gp,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:v,onMouseEnter:b,onMouseOut:w,type:"target"})]})}function XR({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,rfId:x,edgeTypes:g,noPanClassName:y,onError:v,disableKeyboardA11y:b}){let w=Ze(K=>K.edgeLookup.get(e));const S=Ze(K=>K.defaultEdgeOptions);w=S?{...S,...w}:w;let E=w.type||"default",C=(g==null?void 0:g[E])||pp[E];C===void 0&&(v==null||v("011",Dn.error011(E)),E="default",C=pp.default);const k=!!(w.focusable||t&&typeof w.focusable>"u"),T=typeof f<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),P=!!(w.selectable||r&&typeof w.selectable>"u"),z=m.useRef(null),[D,$]=m.useState(!1),[M,_]=m.useState(!1),N=gt(),{zIndex:A,sourceX:I,sourceY:j,targetX:R,targetY:O,sourcePosition:L,targetPosition:Y}=Ze(m.useCallback(K=>{const ne=K.nodeLookup.get(w.source),q=K.nodeLookup.get(w.target);if(!ne||!q)return{zIndex:w.zIndex,...hp};const re=Wj({id:e,sourceNode:ne,targetNode:q,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:K.connectionMode,onError:v});return{zIndex:Lj({selected:w.selected,zIndex:w.zIndex,sourceNode:ne,targetNode:q,elevateOnSelect:K.elevateEdgesOnSelect}),...re||hp}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),Et),H=m.useMemo(()=>w.markerStart?`url('#${_c(w.markerStart,x)}')`:void 0,[w.markerStart,x]),V=m.useMemo(()=>w.markerEnd?`url('#${_c(w.markerEnd,x)}')`:void 0,[w.markerEnd,x]);if(w.hidden||I===null||j===null||R===null||O===null)return null;const U=K=>{var te;const{addSelectedEdges:ne,unselectNodesAndEdges:q,multiSelectionActive:re}=N.getState();P&&(N.setState({nodesSelectionActive:!1}),w.selected&&re?(q({nodes:[],edges:[w]}),(te=z.current)==null||te.blur()):ne([e])),o&&o(K,w)},G=i?K=>{i(K,{...w})}:void 0,B=s?K=>{s(K,{...w})}:void 0,W=a?K=>{a(K,{...w})}:void 0,Z=l?K=>{l(K,{...w})}:void 0,ie=c?K=>{c(K,{...w})}:void 0,se=K=>{var ne;if(!b&&Fx.includes(K.key)&&P){const{unselectNodesAndEdges:q,addSelectedEdges:re}=N.getState();K.key==="Escape"?((ne=z.current)==null||ne.blur(),q({edges:[w]})):re([e])}};return d.jsx("svg",{style:{zIndex:A},children:d.jsxs("g",{className:At(["react-flow__edge",`react-flow__edge-${E}`,w.className,y,{selected:w.selected,animated:w.animated,inactive:!P&&!o,updating:D,selectable:P}]),onClick:U,onDoubleClick:G,onContextMenu:B,onMouseEnter:W,onMouseMove:Z,onMouseLeave:ie,onKeyDown:k?se:void 0,tabIndex:k?0:void 0,role:w.ariaRole??(k?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":k?`${my}-${x}`:void 0,ref:z,...w.domAttributes,children:[!M&&d.jsx(C,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:P,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:I,sourceY:j,targetX:R,targetY:O,sourcePosition:L,targetPosition:Y,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:H,markerEnd:V,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),T&&d.jsx(KR,{edge:w,isReconnectable:T,reconnectRadius:u,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,sourceX:I,sourceY:j,targetX:R,targetY:O,sourcePosition:L,targetPosition:Y,setUpdateHover:$,setReconnecting:_})]})})}const ZR=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function By({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:l,onEdgeMouseLeave:c,onEdgeClick:u,reconnectRadius:f,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:x,disableKeyboardA11y:g}){const{edgesFocusable:y,edgesReconnectable:v,elementsSelectable:b,onError:w}=Ze(ZR,Et),S=OR(t);return d.jsxs("div",{className:"react-flow__edges",children:[d.jsx(BR,{defaultColor:e,rfId:n}),S.map(E=>d.jsx(XR,{id:E,edgesFocusable:y,edgesReconnectable:v,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:l,onMouseLeave:c,onClick:u,reconnectRadius:f,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:x,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:g},E))]})}By.displayName="EdgeRenderer";const QR=m.memo(By),JR=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function eM({children:e}){const t=Ze(JR);return d.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function tM(e){const t=Qa(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const nM=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function rM(e){const t=Ze(nM),n=gt();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function oM(e){return e.connection.inProgress?{...e.connection,to:ns(e.connection.to,e.transform)}:{...e.connection}}function iM(e){return oM}function sM(e){const t=iM();return Ze(t,Et)}const aM=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function lM({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:a,inProgress:l}=Ze(aM,Et);return!(i&&o&&l)?null:d.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:d.jsx("g",{className:At(["react-flow__connection",Hx(a)]),children:d.jsx(Hy,{style:t,type:n,CustomComponent:r,isValid:a})})})}const Hy=({style:e,type:t=cr.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:c,toNode:u,toHandle:f,toPosition:p}=sM();if(!o)return;if(n)return d.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:c.x,toY:c.y,fromPosition:l,toPosition:p,connectionStatus:Hx(r),toNode:u,toHandle:f});let h="";const x={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:c.x,targetY:c.y,targetPosition:p};switch(t){case cr.Bezier:[h]=Uu(x);break;case cr.SimpleBezier:[h]=Ny(x);break;case cr.Step:[h]=Cc({...x,borderRadius:0});break;case cr.SmoothStep:[h]=Cc(x);break;default:[h]=ty(x)}return d.jsx("path",{d:h,fill:"none",className:"react-flow__connection-path",style:e})};Hy.displayName="ConnectionLine";const cM={};function xp(e=cM){m.useRef(e),gt(),m.useEffect(()=>{},[e])}function uM(){gt(),m.useRef(!1),m.useEffect(()=>{},[])}function Vy({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,onSelectionContextMenu:f,onSelectionStart:p,onSelectionEnd:h,connectionLineType:x,connectionLineStyle:g,connectionLineComponent:y,connectionLineContainerStyle:v,selectionKeyCode:b,selectionOnDrag:w,selectionMode:S,multiSelectionKeyCode:E,panActivationKeyCode:C,zoomActivationKeyCode:k,deleteKeyCode:T,onlyRenderVisibleElements:P,elementsSelectable:z,defaultViewport:D,translateExtent:$,minZoom:M,maxZoom:_,preventScrolling:N,defaultMarkerColor:A,zoomOnScroll:I,zoomOnPinch:j,panOnScroll:R,panOnScrollSpeed:O,panOnScrollMode:L,zoomOnDoubleClick:Y,panOnDrag:H,onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:B,onPaneScroll:W,onPaneContextMenu:Z,paneClickDistance:ie,nodeClickDistance:se,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:q,onEdgeMouseLeave:re,reconnectRadius:te,onReconnect:pe,onReconnectStart:ee,onReconnectEnd:Te,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:Ge,disableKeyboardA11y:et,nodeExtent:st,rfId:ot,viewport:ze,onViewportChange:dt}){return xp(e),xp(t),uM(),tM(n),rM(ze),d.jsx(TR,{onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:G,onPaneMouseLeave:B,onPaneContextMenu:Z,onPaneScroll:W,paneClickDistance:ie,deleteKeyCode:T,selectionKeyCode:b,selectionOnDrag:w,selectionMode:S,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:C,zoomActivationKeyCode:k,elementsSelectable:z,zoomOnScroll:I,zoomOnPinch:j,zoomOnDoubleClick:Y,panOnScroll:R,panOnScrollSpeed:O,panOnScrollMode:L,panOnDrag:H,defaultViewport:D,translateExtent:$,minZoom:M,maxZoom:_,onSelectionContextMenu:f,preventScrolling:N,noDragClassName:Ue,noWheelClassName:Ve,noPanClassName:Ge,disableKeyboardA11y:et,onViewportChange:dt,isControlledViewport:!!ze,children:d.jsxs(eM,{children:[d.jsx(QR,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:pe,onReconnectStart:ee,onReconnectEnd:Te,onlyRenderVisibleElements:P,onEdgeContextMenu:K,onEdgeMouseEnter:ne,onEdgeMouseMove:q,onEdgeMouseLeave:re,reconnectRadius:te,defaultMarkerColor:A,noPanClassName:Ge,disableKeyboardA11y:et,rfId:ot}),d.jsx(lM,{style:g,type:x,component:y,containerStyle:v}),d.jsx("div",{className:"react-flow__edgelabel-renderer"}),d.jsx(DR,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:l,onNodeMouseLeave:c,onNodeContextMenu:u,nodeClickDistance:se,onlyRenderVisibleElements:P,noPanClassName:Ge,noDragClassName:Ue,disableKeyboardA11y:et,nodeExtent:st,rfId:ot}),d.jsx("div",{className:"react-flow__viewport-portal"})]})})}Vy.displayName="GraphView";const dM=m.memo(Vy),yp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:f}={})=>{const p=new Map,h=new Map,x=new Map,g=new Map,y=r??t??[],v=n??e??[],b=u??[0,0],w=f??Oi;ry(x,g,y);const S=Tc(v,p,h,{nodeOrigin:b,nodeExtent:w,elevateNodesOnSelect:!1});let E=[0,0,1];if(s&&o&&i){const C=ts(p,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:k,y:T,zoom:P}=Hu(C,o,i,l,c,(a==null?void 0:a.padding)??.1);E=[k,T,P]}return{rfId:"1",width:0,height:0,transform:E,nodes:v,nodesInitialized:S,nodeLookup:p,parentLookup:h,edges:y,edgeLookup:g,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Oi,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:jo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Bx},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ij,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:zx}},fM=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f})=>RI((p,h)=>{async function x(){const{nodeLookup:g,panZoom:y,fitViewOptions:v,fitViewResolver:b,width:w,height:S,minZoom:E,maxZoom:C}=h();y&&(await Nj({nodes:g,width:w,height:S,panZoom:y,minZoom:E,maxZoom:C},v),b==null||b.resolve(!0),p({fitViewResolver:null}))}return{...yp({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:f,defaultNodes:n,defaultEdges:r}),setNodes:g=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:b,elevateNodesOnSelect:w,fitViewQueued:S}=h(),E=Tc(g,y,v,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:w,checkEquality:!0});S&&E?(x(),p({nodes:g,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:g,nodesInitialized:E})},setEdges:g=>{const{connectionLookup:y,edgeLookup:v}=h();ry(y,v,g),p({edges:g})},setDefaultNodesAndEdges:(g,y)=>{if(g){const{setNodes:v}=h();v(g),p({hasDefaultNodes:!0})}if(y){const{setEdges:v}=h();v(y),p({hasDefaultEdges:!0})}},updateNodeInternals:g=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:b,domNode:w,nodeOrigin:S,nodeExtent:E,debug:C,fitViewQueued:k}=h(),{changes:T,updatedInternals:P}=Zj(g,v,b,w,S,E);P&&(qj(v,b,{nodeOrigin:S,nodeExtent:E}),k?(x(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(T==null?void 0:T.length)>0&&(C&&console.log("React Flow: trigger node changes",T),y==null||y(T)))},updateNodePositions:(g,y=!1)=>{const v=[],b=[],{nodeLookup:w,triggerNodeChanges:S}=h();for(const[E,C]of g){const k=w.get(E),T=!!(k!=null&&k.expandParent&&(k!=null&&k.parentId)&&(C!=null&&C.position)),P={id:E,type:"position",position:T?{x:Math.max(0,C.position.x),y:Math.max(0,C.position.y)}:C.position,dragging:y};T&&k.parentId&&v.push({id:E,parentId:k.parentId,rect:{...C.internals.positionAbsolute,width:C.measured.width??0,height:C.measured.height??0}}),b.push(P)}if(v.length>0){const{parentLookup:E,nodeOrigin:C}=h(),k=qu(v,w,E,C);b.push(...k)}S(b)},triggerNodeChanges:g=>{const{onNodesChange:y,setNodes:v,nodes:b,hasDefaultNodes:w,debug:S}=h();if(g!=null&&g.length){if(w){const E=yy(g,b);v(E)}S&&console.log("React Flow: trigger node changes",g),y==null||y(g)}},triggerEdgeChanges:g=>{const{onEdgesChange:y,setEdges:v,edges:b,hasDefaultEdges:w,debug:S}=h();if(g!=null&&g.length){if(w){const E=vy(g,b);v(E)}S&&console.log("React Flow: trigger edge changes",g),y==null||y(g)}},addSelectedNodes:g=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:b,triggerNodeChanges:w,triggerEdgeChanges:S}=h();if(y){const E=g.map(C=>Ar(C,!0));w(E);return}w(go(b,new Set([...g]),!0)),S(go(v))},addSelectedEdges:g=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:b,triggerNodeChanges:w,triggerEdgeChanges:S}=h();if(y){const E=g.map(C=>Ar(C,!0));S(E);return}S(go(v,new Set([...g]))),w(go(b,new Set,!0))},unselectNodesAndEdges:({nodes:g,edges:y}={})=>{const{edges:v,nodes:b,nodeLookup:w,triggerNodeChanges:S,triggerEdgeChanges:E}=h(),C=g||b,k=y||v,T=C.map(z=>{const D=w.get(z.id);return D&&(D.selected=!1),Ar(z.id,!1)}),P=k.map(z=>Ar(z.id,!1));S(T),E(P)},setMinZoom:g=>{const{panZoom:y,maxZoom:v}=h();y==null||y.setScaleExtent([g,v]),p({minZoom:g})},setMaxZoom:g=>{const{panZoom:y,minZoom:v}=h();y==null||y.setScaleExtent([v,g]),p({maxZoom:g})},setTranslateExtent:g=>{var y;(y=h().panZoom)==null||y.setTranslateExtent(g),p({translateExtent:g})},setPaneClickDistance:g=>{var y;(y=h().panZoom)==null||y.setClickDistance(g)},resetSelectedElements:()=>{const{edges:g,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:b,elementsSelectable:w}=h();if(!w)return;const S=y.reduce((C,k)=>k.selected?[...C,Ar(k.id,!1)]:C,[]),E=g.reduce((C,k)=>k.selected?[...C,Ar(k.id,!1)]:C,[]);v(S),b(E)},setNodeExtent:g=>{const{nodes:y,nodeLookup:v,parentLookup:b,nodeOrigin:w,elevateNodesOnSelect:S,nodeExtent:E}=h();g[0][0]===E[0][0]&&g[0][1]===E[0][1]&&g[1][0]===E[1][0]&&g[1][1]===E[1][1]||(Tc(y,v,b,{nodeOrigin:w,nodeExtent:g,elevateNodesOnSelect:S,checkEquality:!1}),p({nodeExtent:g}))},panBy:g=>{const{transform:y,width:v,height:b,panZoom:w,translateExtent:S}=h();return Qj({delta:g,panZoom:w,transform:y,translateExtent:S,width:v,height:b})},setCenter:async(g,y,v)=>{const{width:b,height:w,maxZoom:S,panZoom:E}=h();if(!E)return Promise.resolve(!1);const C=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:S;return await E.setViewport({x:b/2-g*C,y:w/2-y*C,zoom:C},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...Bx}})},updateConnection:g=>{p({connection:g})},reset:()=>p({...yp()})}},Object.is);function Uy({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:l,fitView:c,nodeOrigin:u,nodeExtent:f,children:p}){const[h]=m.useState(()=>fM({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:c,minZoom:s,maxZoom:a,fitViewOptions:l,nodeOrigin:u,nodeExtent:f}));return d.jsx(MI,{value:h,children:d.jsx(nR,{children:p})})}function pM({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:f,nodeExtent:p}){return m.useContext(Za)?d.jsx(d.Fragment,{children:e}):d.jsx(Uy,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:l,initialMinZoom:c,initialMaxZoom:u,nodeOrigin:f,nodeExtent:p,children:e})}const hM={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function mM({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:l,onInit:c,onMove:u,onMoveStart:f,onMoveEnd:p,onConnect:h,onConnectStart:x,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:v,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:C,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:P,onNodesDelete:z,onEdgesDelete:D,onDelete:$,onSelectionChange:M,onSelectionDragStart:_,onSelectionDrag:N,onSelectionDragStop:A,onSelectionContextMenu:I,onSelectionStart:j,onSelectionEnd:R,onBeforeDelete:O,connectionMode:L,connectionLineType:Y=cr.Bezier,connectionLineStyle:H,connectionLineComponent:V,connectionLineContainerStyle:U,deleteKeyCode:G="Backspace",selectionKeyCode:B="Shift",selectionOnDrag:W=!1,selectionMode:Z=Li.Full,panActivationKeyCode:ie="Space",multiSelectionKeyCode:se=la()?"Meta":"Control",zoomActivationKeyCode:K=la()?"Meta":"Control",snapToGrid:ne,snapGrid:q,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:te,nodesDraggable:pe,autoPanOnNodeFocus:ee,nodesConnectable:Te,nodesFocusable:Ue,nodeOrigin:Ve=gy,edgesFocusable:Ge,edgesReconnectable:et,elementsSelectable:st=!0,defaultViewport:ot=GI,minZoom:ze=.5,maxZoom:dt=2,translateExtent:ft=Oi,preventScrolling:at=!0,nodeExtent:qe,defaultMarkerColor:Oe="#b1b1b7",zoomOnScroll:Ke=!0,zoomOnPinch:xt=!0,panOnScroll:Qe=!1,panOnScrollSpeed:Xe=.5,panOnScrollMode:kt=Or.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:Q=!0,onPaneClick:ae,onPaneMouseEnter:le,onPaneMouseMove:ge,onPaneMouseLeave:he,onPaneScroll:fe,onPaneContextMenu:Se,paneClickDistance:xe=0,nodeClickDistance:Ie=0,children:ke,onReconnect:Ne,onReconnectStart:$e,onReconnectEnd:Je,onEdgeContextMenu:mt,onEdgeDoubleClick:yt,onEdgeMouseEnter:lt,onEdgeMouseMove:vt,onEdgeMouseLeave:Lt,reconnectRadius:Ft=10,onNodesChange:zt,onEdgesChange:Nt,noDragClassName:wt="nodrag",noWheelClassName:Wt="nowheel",noPanClassName:Bt="nopan",fitView:je,fitViewOptions:Pe,connectOnClick:_e,attributionPosition:ce,proOptions:F,defaultEdgeOptions:oe,elevateNodesOnSelect:J,elevateEdgesOnSelect:me,disableKeyboardA11y:de=!1,autoPanOnConnect:X,autoPanOnNodeDrag:ue,autoPanSpeed:be,connectionRadius:Ae,isValidConnection:ct,onError:ht,style:Gt,id:nt,nodeDragThreshold:Rt,connectionDragThreshold:Ht,viewport:Mt,onViewportChange:Jn,width:Re,height:ln,colorMode:er="light",debug:tr,onScroll:nr,ariaLabelConfig:Zo,...is},Pw){const sl=nt||"1",Dw=XI(er),Ow=m.useCallback(gd=>{gd.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nr==null||nr(gd)},[nr]);return d.jsx("div",{"data-testid":"rf__wrapper",...is,onScroll:Ow,style:{...Gt,...hM},ref:Pw,className:At(["react-flow",o,Dw]),id:nt,role:"application",children:d.jsxs(pM,{nodes:e,edges:t,width:Re,height:ln,fitView:je,fitViewOptions:Pe,minZoom:ze,maxZoom:dt,nodeOrigin:Ve,nodeExtent:qe,children:[d.jsx(dM,{onInit:c,onNodeClick:a,onEdgeClick:l,onNodeMouseEnter:b,onNodeMouseMove:w,onNodeMouseLeave:S,onNodeContextMenu:E,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:s,connectionLineType:Y,connectionLineStyle:H,connectionLineComponent:V,connectionLineContainerStyle:U,selectionKeyCode:B,selectionOnDrag:W,selectionMode:Z,deleteKeyCode:G,multiSelectionKeyCode:se,panActivationKeyCode:ie,zoomActivationKeyCode:K,onlyRenderVisibleElements:re,defaultViewport:ot,translateExtent:ft,minZoom:ze,maxZoom:dt,preventScrolling:at,zoomOnScroll:Ke,zoomOnPinch:xt,zoomOnDoubleClick:Ee,panOnScroll:Qe,panOnScrollSpeed:Xe,panOnScrollMode:kt,panOnDrag:Q,onPaneClick:ae,onPaneMouseEnter:le,onPaneMouseMove:ge,onPaneMouseLeave:he,onPaneScroll:fe,onPaneContextMenu:Se,paneClickDistance:xe,nodeClickDistance:Ie,onSelectionContextMenu:I,onSelectionStart:j,onSelectionEnd:R,onReconnect:Ne,onReconnectStart:$e,onReconnectEnd:Je,onEdgeContextMenu:mt,onEdgeDoubleClick:yt,onEdgeMouseEnter:lt,onEdgeMouseMove:vt,onEdgeMouseLeave:Lt,reconnectRadius:Ft,defaultMarkerColor:Oe,noDragClassName:wt,noWheelClassName:Wt,noPanClassName:Bt,rfId:sl,disableKeyboardA11y:de,nodeExtent:qe,viewport:Mt,onViewportChange:Jn}),d.jsx(KI,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:x,onConnectEnd:g,onClickConnectStart:y,onClickConnectEnd:v,nodesDraggable:pe,autoPanOnNodeFocus:ee,nodesConnectable:Te,nodesFocusable:Ue,edgesFocusable:Ge,edgesReconnectable:et,elementsSelectable:st,elevateNodesOnSelect:J,elevateEdgesOnSelect:me,minZoom:ze,maxZoom:dt,nodeExtent:qe,onNodesChange:zt,onEdgesChange:Nt,snapToGrid:ne,snapGrid:q,connectionMode:L,translateExtent:ft,connectOnClick:_e,defaultEdgeOptions:oe,fitView:je,fitViewOptions:Pe,onNodesDelete:z,onEdgesDelete:D,onDelete:$,onNodeDragStart:k,onNodeDrag:T,onNodeDragStop:P,onSelectionDrag:N,onSelectionDragStart:_,onSelectionDragStop:A,onMove:u,onMoveStart:f,onMoveEnd:p,noPanClassName:Bt,nodeOrigin:Ve,rfId:sl,autoPanOnConnect:X,autoPanOnNodeDrag:ue,autoPanSpeed:be,onError:ht,connectionRadius:Ae,isValidConnection:ct,selectNodesOnDrag:te,nodeDragThreshold:Rt,connectionDragThreshold:Ht,onBeforeDelete:O,paneClickDistance:xe,debug:tr,ariaLabelConfig:Zo}),d.jsx(WI,{onSelectionChange:M}),ke,d.jsx(zI,{proOptions:F,position:ce}),d.jsx(FI,{rfId:sl,disableKeyboardA11y:de})]})})}var gM=wy(mM);function xM(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>yy(o,i)),[]);return[t,n,r]}function yM(e){const[t,n]=m.useState(e),r=m.useCallback(o=>n(i=>vy(o,i)),[]);return[t,n,r]}function vM({dimensions:e,lineWidth:t,variant:n,className:r}){return d.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:At(["react-flow__background-pattern",n,r])})}function wM({radius:e,className:t}){return d.jsx("circle",{cx:e,cy:e,r:e,className:At(["react-flow__background-pattern","dots",t])})}var ur;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ur||(ur={}));const bM={[ur.Dots]:1,[ur.Lines]:1,[ur.Cross]:6},EM=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Wy({id:e,variant:t=ur.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:a,style:l,className:c,patternClassName:u}){const f=m.useRef(null),{transform:p,patternId:h}=Ze(EM,Et),x=r||bM[t],g=t===ur.Dots,y=t===ur.Cross,v=Array.isArray(n)?n:[n,n],b=[v[0]*p[2]||1,v[1]*p[2]||1],w=x*p[2],S=Array.isArray(i)?i:[i,i],E=y?[w,w]:b,C=[S[0]*p[2]||1+E[0]/2,S[1]*p[2]||1+E[1]/2],k=`${h}${e||""}`;return d.jsxs("svg",{className:At(["react-flow__background",c]),style:{...l,...Ja,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:f,"data-testid":"rf__background",children:[d.jsx("pattern",{id:k,x:p[0]%b[0],y:p[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:g?d.jsx(wM,{radius:w/2,className:u}):d.jsx(vM,{dimensions:E,lineWidth:o,variant:t,className:u})}),d.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Wy.displayName="Background";const SM=m.memo(Wy);function kM(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:d.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function CM(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:d.jsx("path",{d:"M0 0h32v4.2H0z"})})}function _M(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:d.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function TM(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function AM(){return d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:d.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function jr({children:e,className:t,...n}){return d.jsx("button",{type:"button",className:At(["react-flow__controls-button",t]),...n,children:e})}const NM=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Gy({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:c,children:u,position:f="bottom-left",orientation:p="vertical","aria-label":h}){const x=gt(),{isInteractive:g,minZoomReached:y,maxZoomReached:v,ariaLabelConfig:b}=Ze(NM,Et),{zoomIn:w,zoomOut:S,fitView:E}=Qa(),C=()=>{w(),i==null||i()},k=()=>{S(),s==null||s()},T=()=>{E(o),a==null||a()},P=()=>{x.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),l==null||l(!g)},z=p==="horizontal"?"horizontal":"vertical";return d.jsxs(Do,{className:At(["react-flow__controls",z,c]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&d.jsxs(d.Fragment,{children:[d.jsx(jr,{onClick:C,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:v,children:d.jsx(kM,{})}),d.jsx(jr,{onClick:k,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:y,children:d.jsx(CM,{})})]}),n&&d.jsx(jr,{className:"react-flow__controls-fitview",onClick:T,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:d.jsx(_M,{})}),r&&d.jsx(jr,{className:"react-flow__controls-interactive",onClick:P,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:g?d.jsx(AM,{}):d.jsx(TM,{})}),u]})}Gy.displayName="Controls";const jM=m.memo(Gy);function IM({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:a,strokeWidth:l,className:c,borderRadius:u,shapeRendering:f,selected:p,onClick:h}){const{background:x,backgroundColor:g}=i||{},y=s||x||g;return d.jsx("rect",{className:At(["react-flow__minimap-node",{selected:p},c]),x:t,y:n,rx:u,ry:u,width:r,height:o,style:{fill:y,stroke:a,strokeWidth:l},shapeRendering:f,onClick:h?v=>h(v,e):void 0})}const RM=m.memo(IM),MM=e=>e.nodes.map(t=>t.id),Ll=e=>e instanceof Function?e:()=>e;function PM({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=RM,onClick:s}){const a=Ze(MM,Et),l=Ll(t),c=Ll(e),u=Ll(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return d.jsx(d.Fragment,{children:a.map(p=>d.jsx(OM,{id:p,nodeColorFunc:l,nodeStrokeColorFunc:c,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:f},p))})}function DM({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:c,x:u,y:f,width:p,height:h}=Ze(x=>{const{internals:g}=x.nodeLookup.get(e),y=g.userNode,{x:v,y:b}=g.positionAbsolute,{width:w,height:S}=Qn(y);return{node:y,x:v,y:b,width:w,height:S}},Et);return!c||c.hidden||!qx(c)?null:d.jsx(a,{x:u,y:f,width:p,height:h,style:c.style,selected:!!c.selected,className:r(c),color:t(c),borderRadius:o,strokeColor:n(c),strokeWidth:i,shapeRendering:s,onClick:l,id:c.id})}const OM=m.memo(DM);var LM=m.memo(PM);const $M=200,FM=150,zM=e=>!e.hidden,BM=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Yx(ts(e.nodeLookup,{filter:zM}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},HM="react-flow__minimap-desc";function Yy({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:l,maskColor:c,maskStrokeColor:u,maskStrokeWidth:f,position:p="bottom-right",onClick:h,onNodeClick:x,pannable:g=!1,zoomable:y=!1,ariaLabel:v,inversePan:b,zoomStep:w=10,offsetScale:S=5}){const E=gt(),C=m.useRef(null),{boundingRect:k,viewBB:T,rfId:P,panZoom:z,translateExtent:D,flowWidth:$,flowHeight:M,ariaLabelConfig:_}=Ze(BM,Et),N=(e==null?void 0:e.width)??$M,A=(e==null?void 0:e.height)??FM,I=k.width/N,j=k.height/A,R=Math.max(I,j),O=R*N,L=R*A,Y=S*R,H=k.x-(O-k.width)/2-Y,V=k.y-(L-k.height)/2-Y,U=O+Y*2,G=L+Y*2,B=`${HM}-${P}`,W=m.useRef(0),Z=m.useRef();W.current=R,m.useEffect(()=>{if(C.current&&z)return Z.current=sI({domNode:C.current,panZoom:z,getTransform:()=>E.getState().transform,getViewScale:()=>W.current}),()=>{var ne;(ne=Z.current)==null||ne.destroy()}},[z]),m.useEffect(()=>{var ne;(ne=Z.current)==null||ne.update({translateExtent:D,width:$,height:M,inversePan:b,pannable:g,zoomStep:w,zoomable:y})},[g,y,b,w,D,$,M]);const ie=h?ne=>{var te;const[q,re]=((te=Z.current)==null?void 0:te.pointer(ne))||[0,0];h(ne,{x:q,y:re})}:void 0,se=x?m.useCallback((ne,q)=>{const re=E.getState().nodeLookup.get(q).internals.userNode;x(ne,re)},[]):void 0,K=v??_["minimap.ariaLabel"];return d.jsx(Do,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*R:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:At(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:d.jsxs("svg",{width:N,height:A,viewBox:`${H} ${V} ${U} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":B,ref:C,onClick:ie,children:[K&&d.jsx("title",{id:B,children:K}),d.jsx(LM,{onClick:se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:a}),d.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-Y},${V-Y}h${U+Y*2}v${G+Y*2}h${-U-Y*2}z
378
+ M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Yy.displayName="MiniMap";m.memo(Yy);const VM=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,UM={[Po.Line]:"right",[Po.Handle]:"bottom-right"};function WM({nodeId:e,position:t,variant:n=Po.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:a=10,minHeight:l=10,maxWidth:c=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:p,autoScale:h=!0,shouldResize:x,onResizeStart:g,onResize:y,onResizeEnd:v}){const b=ky(),w=typeof e=="string"?e:b,S=gt(),E=m.useRef(null),C=n===Po.Handle,k=Ze(m.useCallback(VM(C&&h),[C,h]),Et),T=m.useRef(null),P=t??UM[n];m.useEffect(()=>{if(!(!E.current||!w))return T.current||(T.current=EI({domNode:E.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:D,transform:$,snapGrid:M,snapToGrid:_,nodeOrigin:N,domNode:A}=S.getState();return{nodeLookup:D,transform:$,snapGrid:M,snapToGrid:_,nodeOrigin:N,paneDomNode:A}},onChange:(D,$)=>{const{triggerNodeChanges:M,nodeLookup:_,parentLookup:N,nodeOrigin:A}=S.getState(),I=[],j={x:D.x,y:D.y},R=_.get(w);if(R&&R.expandParent&&R.parentId){const O=R.origin??A,L=D.width??R.measured.width??0,Y=D.height??R.measured.height??0,H={id:R.id,parentId:R.parentId,rect:{width:L,height:Y,...Kx({x:D.x??R.position.x,y:D.y??R.position.y},{width:L,height:Y},R.parentId,_,O)}},V=qu([H],_,N,A);I.push(...V),j.x=D.x?Math.max(O[0]*L,D.x):void 0,j.y=D.y?Math.max(O[1]*Y,D.y):void 0}if(j.x!==void 0&&j.y!==void 0){const O={id:w,type:"position",position:{...j}};I.push(O)}if(D.width!==void 0&&D.height!==void 0){const L={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};I.push(L)}for(const O of $){const L={...O,type:"position"};I.push(L)}M(I)},onEnd:({width:D,height:$})=>{const M={id:w,type:"dimensions",resizing:!1,dimensions:{width:D,height:$}};S.getState().triggerNodeChanges([M])}})),T.current.update({controlPosition:P,boundaries:{minWidth:a,minHeight:l,maxWidth:c,maxHeight:u},keepAspectRatio:f,resizeDirection:p,onResizeStart:g,onResize:y,onResizeEnd:v,shouldResize:x}),()=>{var D;(D=T.current)==null||D.destroy()}},[P,a,l,c,u,f,g,y,v,x]);const z=P.split("-");return d.jsx("div",{className:At(["react-flow__resize-control","nodrag",...z,n,r]),ref:E,style:{...o,scale:k,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:i})}m.memo(WM);var qy={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},vp=Pt.createContext&&Pt.createContext(qy),GM=["attr","size","title"];function YM(e,t){if(e==null)return{};var n=qM(e,t),r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qM(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ua(){return ua=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ua.apply(this,arguments)}function wp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function da(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wp(Object(n),!0).forEach(function(r){KM(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wp(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function KM(e,t,n){return t=XM(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function XM(e){var t=ZM(e,"string");return typeof t=="symbol"?t:t+""}function ZM(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ky(e){return e&&e.map((t,n)=>Pt.createElement(t.tag,da({key:n},t.attr),Ky(t.child)))}function pn(e){return t=>Pt.createElement(QM,ua({attr:da({},e.attr)},t),Ky(e.child))}function QM(e){var t=n=>{var{attr:r,size:o,title:i}=e,s=YM(e,GM),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),Pt.createElement("svg",ua({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,s,{className:l,style:da(da({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),i&&Pt.createElement("title",null,i),e.children)};return vp!==void 0?Pt.createElement(vp.Consumer,null,n=>t(n)):t(qy)}function JM(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},child:[]},{tag:"polyline",attr:{points:"22 4 12 14.01 9 11.01"},child:[]}]})(e)}function eP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"},child:[]},{tag:"polyline",attr:{points:"14 2 14 8 20 8"},child:[]},{tag:"line",attr:{x1:"16",y1:"13",x2:"8",y2:"13"},child:[]},{tag:"line",attr:{x1:"16",y1:"17",x2:"8",y2:"17"},child:[]},{tag:"polyline",attr:{points:"10 9 9 9 8 9"},child:[]}]})(e)}function tP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"22",y1:"12",x2:"2",y2:"12"},child:[]},{tag:"path",attr:{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"},child:[]},{tag:"line",attr:{x1:"6",y1:"16",x2:"6.01",y2:"16"},child:[]},{tag:"line",attr:{x1:"10",y1:"16",x2:"10.01",y2:"16"},child:[]}]})(e)}function nP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(e)}function rP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},child:[]}]})(e)}function oP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"6",y:"4",width:"4",height:"16"},child:[]},{tag:"rect",attr:{x:"14",y:"4",width:"4",height:"16"},child:[]}]})(e)}function bp(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"5 3 19 12 5 21 5 3"},child:[]}]})(e)}function Ep(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"18",cy:"5",r:"3"},child:[]},{tag:"circle",attr:{cx:"6",cy:"12",r:"3"},child:[]},{tag:"circle",attr:{cx:"18",cy:"19",r:"3"},child:[]},{tag:"line",attr:{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"},child:[]},{tag:"line",attr:{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"},child:[]}]})(e)}function Sp(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 17 10 11 4 5"},child:[]},{tag:"line",attr:{x1:"12",y1:"19",x2:"20",y2:"19"},child:[]}]})(e)}function iP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"12",cy:"7",r:"4"},child:[]}]})(e)}function sP(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"15",y1:"9",x2:"9",y2:"15"},child:[]},{tag:"line",attr:{x1:"9",y1:"9",x2:"15",y2:"15"},child:[]}]})(e)}function $l(e){return pn({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"},child:[]}]})(e)}class Xy{getEdgeAnimationState(t,n,r){const o=r.find(a=>a.id===t);if(!o)return{isAnimated:!1,animationType:"static"};if(!this.isAgentToToolRequest(o))return{isAnimated:!1,animationType:"static"};const i=r.slice(0,n+1);return this.hasMatchingResponse(o,i)?{isAnimated:!1,animationType:"static"}:{isAnimated:!0,animationType:"request"}}isAgentToToolRequest(t){var n,r;switch(t.type){case"AGENT_LLM_CALL":return!0;case"AGENT_TOOL_INVOCATION_START":return!(((n=t.data.toolDecision)==null?void 0:n.isPeerDelegation)||((r=t.data.toolInvocationStart)==null?void 0:r.isPeerInvocation)||t.target&&t.target.startsWith("peer_"));default:return!1}}hasMatchingResponse(t,n){switch(t.type){case"AGENT_LLM_CALL":return this.hasLLMResponse(t,n);case"AGENT_TOOL_INVOCATION_START":return this.hasToolResponse(t,n);default:return!1}}hasLLMResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.source;return n.some(i=>{if(new Date(i.timestamp).getTime()<=r)return!1;const a=(i.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||i.type==="AGENT_LLM_RESPONSE_TO_AGENT")&&i.target===o,l=i.source===o&&(i.type==="AGENT_TOOL_INVOCATION_START"||i.type==="AGENT_LLM_CALL"||i.type==="TASK_COMPLETED");return a||l})}hasToolResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.target,i=t.source;return n.some(s=>new Date(s.timestamp).getTime()<=r?!1:s.type==="AGENT_TOOL_EXECUTION_RESULT"&&s.source===o&&s.target===i)}isRequestStep(t){return this.isAgentToToolRequest(t)}isResponseStep(t){return["AGENT_TOOL_EXECUTION_RESULT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_LLM_RESPONSE_TO_AGENT"].includes(t.type)}}const mr={USER:50,MAIN_FLOW:300,TOOLS:600},aP=50,Dt=50,dn=330,gr=50,Vn=20,Oo=10,kp=Dt+20,lP=90;function qr(e,t,n){return e.push(n),t.add(n.id),n}function cP(e,t){return e.push(t),t}function Kr(e,t){return e.nodeIdCounter++,`${t.replace(/[^a-zA-Z0-9_]/g,"_")}_${e.nodeIdCounter}`}function en(e){return e.currentPhaseIndex===-1||e.currentPhaseIndex>=e.phases.length?null:e.phases[e.currentPhaseIndex]}function rs(e){const t=en(e);return!t||e.currentSubflowIndex===-1||e.currentSubflowIndex>=t.subflows.length?null:t.subflows[e.currentSubflowIndex]}function uP(e,t,n){var r;for(let o=e.length-1;o>=0;o--){const i=e[o],s=n.find(a=>a.id===i.id);if(((r=s==null?void 0:s.data)==null?void 0:r.toolName)===t)return i}return null}function dP(e,t){if(!t)return null;const n=en(e);if(!n)return null;const r=n.subflows.filter(o=>o.functionCallId===t);return r.length===0?null:r[r.length-1]}function fP(e,t){if(!t)return null;const n=en(e);return n&&n.subflows.find(r=>r.id===t)||null}function tl(e,t){if(t.functionCallId){const r=dP(e,t.functionCallId);if(r)return r}if(t.owningTaskId&&t.isSubTaskStep){const r=fP(e,t.owningTaskId);if(r)return r}const n=rs(e);if(n&&t.nestingLevel>0&&t.isSubTaskStep)return n;if(t.source&&t.nestingLevel>0){const r=pP(e,t.source,t.nestingLevel);if(r)return r}return null}function pP(e,t,n){const r=en(e);if(!r)return null;const o=t.replace(/[^a-zA-Z0-9_]/g,"_");if(n===1){const i=r.subflows.find(s=>s.peerAgent.id.includes(o));if(i)return i}return rs(e)}function hP(e,t){var r,o,i;if(((r=e.data.toolDecision)==null?void 0:r.isParallel)===!0)return!0;const n=(i=(o=e.data)==null?void 0:o.toolInvocationStart)==null?void 0:i.functionCallId;return n?Array.from(t.parallelFlows.values()).some(s=>s.subflowFunctionCallIds.includes(n)):!1}function Zy(e,t,n,r){var o;if(r)for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.functionCallId===r){const a=n.find(l=>l.id===s.id);if(((o=a==null?void 0:a.data)==null?void 0:o.toolName)===t||t==="LLM")return s}}return uP(e,t,n)}function Lo(e,t,n,r){const o=`phase_${e.phases.length}`,i=Kr(e,`${t}_${o}`),s=e.nextAvailableGlobalY,a={id:i,type:"orchestratorNode",position:{x:mr.MAIN_FLOW,y:s},data:{label:t,visualizerStepId:n.id}};qr(r,e.allCreatedNodeIds,a),e.nodePositions.set(i,a.position);const l={id:i,yPosition:s,height:Dt,width:dn},c={id:i,name:t,type:"orchestrator",phaseId:o,context:"main",nodeInstance:l};e.agentRegistry.registerAgent(c);const u={id:o,orchestratorAgent:l,userNodes:[],subflows:[],toolInstances:[],currentToolYOffset:0,maxY:s+Dt};return e.phases.push(u),e.currentPhaseIndex=e.phases.length-1,e.currentSubflowIndex=-1,e.nextAvailableGlobalY=u.maxY+gr,u}function jc(e,t,n,r,o){var C,k,T,P,z;const i=en(e);if(!i)return null;const s=n.type==="AGENT_TOOL_EXECUTION_RESULT"&&((C=n.data.toolResult)==null?void 0:C.isPeerResponse)===!0,a=n.source||"",l=$o(a);!s&&!l&&!o&&e.indentationLevel++;const c=((T=(k=n.delegationInfo)==null?void 0:k[0])==null?void 0:T.subTaskId)||`subflow_${i.subflows.length}`,u=Kr(e,`${t}_${c}`),f=Kr(e,`group_${t}_${c}`),p=((z=(P=n.data)==null?void 0:P.toolInvocationStart)==null?void 0:z.functionCallId)||n.functionCallId||"";let h,x,g;const y=Array.from(e.parallelFlows.values()).find(D=>D.subflowFunctionCallIds.includes(p));o&&y?(h=y.startX+y.currentXOffset,x=y.startY,g=x+Vn,y.currentXOffset+=(dn+Oo)*2.2):(g=e.nextAvailableGlobalY,h=mr.MAIN_FLOW-50+e.indentationLevel*e.indentationStep,x=g-Vn);const v={id:u,type:"genericAgentNode",position:{x:50,y:Vn},data:{label:t,visualizerStepId:n.id},parentId:f},b={id:f,type:"group",position:{x:h,y:x},data:{label:`${t} Sub-flow`},style:{backgroundColor:"rgba(220, 220, 255, 0.1)",border:"1px solid #aac",borderRadius:"8px",minHeight:`${Dt+2*Vn}px`}};qr(r,e.allCreatedNodeIds,b),qr(r,e.allCreatedNodeIds,v),e.nodePositions.set(u,v.position),e.nodePositions.set(f,b.position);const w={id:u,xPosition:mr.MAIN_FLOW,yPosition:g,height:Dt,width:dn},S={id:u,name:t,type:"peer",phaseId:i.id,subflowId:c,context:"subflow",nodeInstance:w};e.agentRegistry.registerAgent(S);const E={id:c,functionCallId:p,isParallel:o,peerAgent:w,groupNode:{id:f,xPosition:h,yPosition:x,height:Dt+2*Vn,width:0},toolInstances:[],currentToolYOffset:0,maxY:g+Dt,maxContentXRelative:v.position.x+dn,callingPhaseId:i.id};return i.subflows.push(E),e.currentSubflowIndex=i.subflows.length-1,o&&y?(y.maxHeight=Math.max(y.maxHeight,E.groupNode.height),e.nextAvailableGlobalY=y.startY+y.maxHeight+gr):e.nextAvailableGlobalY=E.groupNode.yPosition+E.groupNode.height+gr,E}function Qy(e,t,n,r,o,i,s=!1){const a=en(e);if(!a)return null;const l=i?i.toolInstances:a.toolInstances,c=s?"LLM":`Tool: ${t}`,u=s?"LLM":t,f=i?i.groupNode.id:void 0;let p,h,x,g;if(i){if(p=i.peerAgent.yPosition+i.currentToolYOffset,i.currentToolYOffset+=kp,x=50+300,i.groupNode.xPosition===void 0||i.groupNode.yPosition===void 0)return null;h=i.groupNode.xPosition+x,g=p-i.groupNode.yPosition}else h=mr.TOOLS,p=a.orchestratorAgent.yPosition+a.currentToolYOffset,a.currentToolYOffset+=kp,x=h,g=p;const y=Kr(e,`${u}_${r.id}`),v={id:y,type:n,position:{x,y:g},data:{label:c,visualizerStepId:r.id,toolName:t},parentId:f};qr(o,e.allCreatedNodeIds,v),e.nodePositions.set(y,{x,y:g});const b={id:y,xPosition:h,yPosition:p,height:Dt,width:dn,functionCallId:r.functionCallId};l.push(b);const w=p+Dt;if(i){i.maxY=Math.max(i.maxY,w),i.maxContentXRelative=Math.max(i.maxContentXRelative,x+dn);const S=i.maxY-i.groupNode.yPosition+Vn;i.groupNode.height=Math.max(i.groupNode.height,S);const E=i.maxContentXRelative+Oo;i.groupNode.width=Math.max(i.groupNode.width||0,E);const C=o.find(k=>k.id===i.groupNode.id);C&&(C.style={...C.style,height:`${i.groupNode.height}px`,width:`${i.groupNode.width}px`}),e.nextAvailableGlobalY=i.groupNode.yPosition+i.groupNode.height+gr}else a.maxY=Math.max(a.maxY,w),e.nextAvailableGlobalY=a.maxY+gr;return b}function Xu(e,t,n,r){e.userNodeCounter++;const o=Kr(e,`User_response_${e.userNodeCounter}`),i=e.nextAvailableGlobalY+20,s={id:o,type:"userNode",position:{x:mr.USER,y:i},data:{label:"User",visualizerStepId:n.id,isBottomNode:!0}};qr(r,e.allCreatedNodeIds,s),e.nodePositions.set(o,s.position);const a={id:o,yPosition:i,height:Dt,width:dn};t.userNodes.push(a),e.allUserNodes.push(a);const l=i+Dt;return t.maxY=Math.max(t.maxY,l),e.nextAvailableGlobalY=l+gr,a}function on(e,t,n,r,o,i,s,a,l){if(!e||!t||e===t)return;const c=o.allCreatedNodeIds.has(e),u=o.allCreatedNodeIds.has(t);if(!c||!u)return;const f=`edge-${e}${a||""}-to-${t}${l||""}-${n.id}`;if(!r.some(h=>h.id===f)){const h=n.title&&n.title.length>30?n.type.replace(/_/g," ").toLowerCase():n.title||"",x=i.isRequestStep(n),g={id:f,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:x,animationType:x?"request":"static",duration:1}};a&&(g.sourceHandle=a),l&&(g.targetHandle=l),cP(r,g)}}function mP(){const e=new Map;return{agents:e,findAgentByName(t){const n=t.startsWith("peer_")?t.substring(5):t,r=[];for(const[,o]of e)(o.name===n||o.name===t)&&r.push(o);return r.length===0?null:r.reduce((o,i)=>{const s=parseInt(o.id.split("_").pop()||"0");return parseInt(i.id.split("_").pop()||"0")>s?i:o})},findAgentById(t){for(const[,n]of e)if(n.id===t)return n;return null},registerAgent(t){e.set(t.id,t)}}}function Ic(e,t,n){return e==="orchestrator"?t==="output"?n==="bottom"?"orch-bottom-output":"orch-right-output-tools":n==="top"?"orch-top-input":"orch-right-input-tools":t==="output"?n==="bottom"?"peer-bottom-output":"peer-right-output-tools":n==="top"?"peer-top-input":"peer-right-input-tools"}function $o(e){return e==="OrchestratorAgent"||e.toLowerCase().includes("orchestrator")}function gP(e,t,n,r,o,i){const s=e.target,a=s.replace(/[^a-zA-Z0-9_]/g,"_"),l=en(t),c=rs(t);let u,f=!1;if(c?(u=c.peerAgent,u.id.startsWith(a+"_")&&(f=!0)):l&&(u=l.orchestratorAgent,u.id.startsWith(a+"_")&&(f=!0)),f&&u&&l){t.userNodeCounter++;const p=Kr(t,`User_continue_${t.userNodeCounter}`),h=t.nextAvailableGlobalY,x={id:p,type:"userNode",position:{x:mr.USER,y:h},data:{label:"User",visualizerStepId:e.id}};qr(n,t.allCreatedNodeIds,x),t.nodePositions.set(p,x.position);const g={id:p,yPosition:h,height:Dt,width:dn};l.userNodes.push(g),t.allUserNodes.push(g);const y=h+Dt;u.yPosition=Math.max(u.yPosition,h),l.maxY=Math.max(l.maxY,y,u.yPosition+Dt),t.nextAvailableGlobalY=l.maxY+gr;const v=$o(s)?"orch-left-input":"peer-left-input";on(g.id,u.id,e,r,t,o,i,"user-right-output",v)}else{const p=Lo(t,s,e,n),h=Kr(t,`User_${p.id}`),x={id:h,type:"userNode",position:{x:mr.USER,y:p.orchestratorAgent.yPosition-lP},data:{label:"User",visualizerStepId:e.id,isTopNode:!0}};qr(n,t.allCreatedNodeIds,x),t.nodePositions.set(h,x.position);const g={id:h,yPosition:x.position.y,height:Dt,width:dn};p.userNodes.push(g),t.allUserNodes.push(g),t.userNodeCounter++,p.maxY=Math.max(p.maxY,x.position.y+Dt),t.nextAvailableGlobalY=p.maxY+gr,on(h,p.orchestratorAgent.id,e,r,t,o,i,"user-bottom-output","orch-top-input")}}function xP(e,t,n,r,o,i){const s=en(t);if(!s)return;const a=tl(t,e),l=a?a.peerAgent.id:s.orchestratorAgent.id,c=Qy(t,"LLM","llmNode",e,n,a,!0);c&&on(l,c.id,e,r,t,o,i,a?"peer-right-output-tools":"orch-right-output-tools","llm-left-input")}function yP(e,t,n,r,o,i){var x;if(e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"&&((x=e.data.toolDecision)!=null&&x.isParallel)){const g=`parallel-${e.id}`;t.parallelFlows.set(g,{subflowFunctionCallIds:e.data.toolDecision.decisions.filter(y=>y.isPeerDelegation).map(y=>y.functionCallId),completedSubflows:new Set,startX:mr.MAIN_FLOW-50,startY:t.nextAvailableGlobalY,currentXOffset:0,maxHeight:0})}const s=en(t);if(!s)return;const a=tl(t,e);let l;const u=Zy((a||s).toolInstances,"LLM",n,e.functionCallId);if(u)l=u.id;else{console.error(`[Timeline] LLM node not found for step type ${e.type}: ${e.id}. Cannot create edge.`);return}const f=e.target||"UnknownAgent";let p,h;a?(p=a.peerAgent.id,h="peer-right-input-tools"):s.orchestratorAgent.id.startsWith(f.replace(/[^a-zA-Z0-9_]/g,"_")+"_")&&(p=s.orchestratorAgent.id,h="orch-right-input-tools"),l&&p&&h?on(l,p,e,r,t,o,i,"llm-bottom-output",h):console.error(`[Timeline] Could not determine target agent node ID or handle for step type ${e.type}: ${e.id}. Target agent name: ${f}. Edge will be missing.`)}function vP(e,t,n,r,o,i){var u;const s=en(t);if(!s)return;const a=e.source||"UnknownSource",l=e.target||"UnknownTool";if(((u=e.data.toolInvocationStart)==null?void 0:u.isPeerInvocation)||l.startsWith("peer_")){const f=l.startsWith("peer_")?l.substring(5):l,p=t.agentRegistry.findAgentByName(a);if(!p){console.error(`[Timeline] Could not find source agent in registry: ${a} for step ${e.id}`);return}const h=p.nodeInstance,x=Ic(p.type,"output","bottom"),g=hP(e,t),y=jc(t,f,e,n,g);y&&on(h.id,y.peerAgent.id,e,r,t,o,i,x,"peer-top-input")}else{const f=tl(t,e);let p,h;if(f)p=f.peerAgent.id,h="peer-right-output-tools";else{const g=t.agentRegistry.findAgentByName(a);g?(p=g.id,h=Ic(g.type,"output","right")):(p=s.orchestratorAgent.id,h="orch-right-output-tools")}const x=Qy(t,l,"genericToolNode",e,n,f);x&&on(p,x.id,e,r,t,o,i,h,`${x.id}-tool-left-input`)}}function wP(e,t,n,r,o,i){var c,u;const s=en(t);if(!s)return;const a=e.source||"UnknownSource",l=e.target||"OrchestratorAgent";if((c=e.data.toolResult)!=null&&c.isPeerResponse){const f=(u=e.data.toolResult)==null?void 0:u.functionCallId,p=Array.from(t.parallelFlows.entries()).find(([x,g])=>g.subflowFunctionCallIds.includes(f||""));if(p){const[x,g]=p;if(g.completedSubflows.add(f||""),g.completedSubflows.size<g.subflowFunctionCallIds.length)return;const y=s.subflows.filter(S=>g.subflowFunctionCallIds.includes(S.functionCallId)),v=e.target||"OrchestratorAgent";let b,w;if($o(v))t.indentationLevel=0,b=Lo(t,v,e,n).orchestratorAgent,w="orch-top-input",t.currentSubflowIndex=-1;else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const S=jc(t,v,e,n,!1);if(!S)return;b=S.peerAgent,w="peer-top-input"}y.forEach(S=>{on(S.peerAgent.id,b.id,e,r,t,o,i,"peer-bottom-output",w)}),t.parallelFlows.delete(x);return}const h=t.agentRegistry.findAgentByName(a.startsWith("peer_")?a.substring(5):a);if(!h){console.error(`[Timeline] Source peer agent not found for peer response: ${a}.`);return}if($o(l)){t.indentationLevel=0;const x=Lo(t,l,e,n);on(h.id,x.orchestratorAgent.id,e,r,t,o,i,"peer-bottom-output","orch-top-input"),t.currentSubflowIndex=-1}else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const x=jc(t,l,e,n,!1);x&&on(h.id,x.peerAgent.id,e,r,t,o,i,"peer-bottom-output","peer-top-input")}}else{let f;const p=tl(t,e),x=Zy((p||s).toolInstances,a,n,e.functionCallId);if(x&&(f=x.id),f){let g,y;if(p)g=p.peerAgent.id,y="peer-right-input-tools";else{const v=t.agentRegistry.findAgentByName(l);v?(g=v.id,y=Ic(v.type,"input","right")):(g=s.orchestratorAgent.id,y="orch-right-input-tools")}on(f,g,e,r,t,o,i,a==="LLM"?"llm-bottom-output":`${f}-tool-bottom-output`,y)}else console.error(`[Timeline] Could not find source tool node for regular tool result: ${e.id}. Step source (tool name): ${a}.`)}}function bP(e,t,n,r,o,i){const s=en(t);if(!s||e.isSubTaskStep)return;const a=s.orchestratorAgent.id,l=Xu(t,s,e,n);on(a,l.id,e,r,t,o,i,"orch-bottom-output","user-top-input")}function EP(e,t,n,r,o,i){const s=en(t);if(!s)return;const a=Array.from(t.parallelFlows.values()).find(h=>h.subflowFunctionCallIds.includes(e.functionCallId||""));if(a){if(a.completedSubflows.add(e.functionCallId||""),a.completedSubflows.size===a.subflowFunctionCallIds.length){t.indentationLevel=0;const h=Lo(t,"OrchestratorAgent",e,n);s.subflows.forEach(x=>{a.subflowFunctionCallIds.includes(x.functionCallId)&&on(x.peerAgent.id,h.orchestratorAgent.id,e,r,t,o,i,"peer-bottom-output","orch-top-input")}),t.currentSubflowIndex=-1}return}if(!e.isSubTaskStep)return;const l=rs(t);if(!l){console.warn(`[Timeline] TASK_COMPLETED with isSubTaskStep=true but no active subflow. Step ID: ${e.id}`);return}if(!s){console.error(`[Timeline] No current phase found for TASK_COMPLETED. Step ID: ${e.id}`);return}const c=l.peerAgent,u=n.some(h=>typeof h.data.label=="string"&&$o(h.data.label));let f,p;u?(t.indentationLevel=0,f=Lo(t,"OrchestratorAgent",e,n).orchestratorAgent.id,p="orch-top-input"):(f=Xu(t,s,e,n).id,p="user-top-input"),on(c.id,f,e,r,t,o,i,"peer-bottom-output",p),t.currentSubflowIndex=-1}function SP(e,t,n,r){const o=en(t);if(!o)return;const i=e.source||"UnknownSource",s=e.target||"User";let a,l="orch-bottom-output";const c=rs(t);if(c&&c.peerAgent.id.includes(i.replace(/[^a-zA-Z0-9_]/g,"_")))a=c.peerAgent,l="peer-bottom-output";else if(o.orchestratorAgent.id.includes(i.replace(/[^a-zA-Z0-9_]/g,"_")))a=o.orchestratorAgent,l="orch-bottom-output";else for(const p of o.subflows)if(p.peerAgent.id.includes(i.replace(/[^a-zA-Z0-9_]/g,"_"))){a=p.peerAgent,l="peer-bottom-output";break}if(!a){console.error(`[Timeline] Could not find source agent node for TASK_FAILED: ${i}`);return}let u,f;$o(s)?(t.indentationLevel=0,u=Lo(t,s,e,n).orchestratorAgent.id,f="orch-top-input",t.currentSubflowIndex=-1):(u=Xu(t,o,e,n).id,f="user-top-input"),kP(a.id,u,e,r,t,l,f)}function kP(e,t,n,r,o,i,s){var f;if(!e||!t||e===t)return;const a=o.allCreatedNodeIds.has(e),l=o.allCreatedNodeIds.has(t);if(!a||!l)return;const c=`error-edge-${e}${i||""}-to-${t}${s||""}-${n.id}`;if(!r.some(p=>p.id===c)){const p=((f=n.data.errorDetails)==null?void 0:f.message)||"Task failed",h=p.length>30?"Error":p,x={id:c,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:!1,animationType:"static",isError:!0,errorMessage:p}};i&&(x.sourceHandle=i),s&&(x.targetHandle=s),r.push(x)}}const CP=e=>{const t=[],n=[];if(!e||e.length===0)return{nodes:t,edges:n};const r=new Xy,o={phases:[],currentPhaseIndex:-1,currentSubflowIndex:-1,parallelFlows:new Map,nextAvailableGlobalY:aP,nodeIdCounter:0,allCreatedNodeIds:new Set,nodePositions:new Map,allUserNodes:[],userNodeCounter:0,agentRegistry:mP(),indentationLevel:0,indentationStep:50},i=["USER_REQUEST","AGENT_LLM_CALL","AGENT_LLM_RESPONSE_TO_AGENT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_TOOL_INVOCATION_START","AGENT_TOOL_EXECUTION_RESULT","AGENT_RESPONSE_TEXT","TASK_COMPLETED","TASK_FAILED"],s=e.filter(a=>i.includes(a.type));for(const a of s)switch(a.type){case"USER_REQUEST":gP(a,o,t,n,r,e);break;case"AGENT_LLM_CALL":xP(a,o,t,n,r,e);break;case"AGENT_LLM_RESPONSE_TO_AGENT":case"AGENT_LLM_RESPONSE_TOOL_DECISION":yP(a,o,t,n,r,e);break;case"AGENT_TOOL_INVOCATION_START":vP(a,o,t,n,r,e);break;case"AGENT_TOOL_EXECUTION_RESULT":wP(a,o,t,n,r,e);break;case"AGENT_RESPONSE_TEXT":bP(a,o,t,n,r,e);break;case"TASK_COMPLETED":EP(a,o,t,n,r,e);break;case"TASK_FAILED":SP(a,o,t,n);break}return o.phases.forEach(a=>{a.subflows.forEach(l=>{const c=t.find(u=>u.id===l.groupNode.id);if(c&&c.style){const f=l.maxY-l.groupNode.yPosition+Vn;c.style.height=`${Math.max(Dt+2*Vn,f)}px`;const p=l.maxContentXRelative+Oo,h=dn+2*Oo+o.indentationLevel*o.indentationStep;c.style.width=`${Math.max(p,h)}px`}})}),{nodes:t,edges:n}},_P=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:i,targetPosition:s,style:a={},markerEnd:l,data:c})=>{const[u,f]=m.useState(!1),[p]=Uu({sourceX:t,sourceY:n,sourcePosition:i,targetX:r,targetY:o,targetPosition:s}),h=()=>{const y={strokeWidth:u?3:2,stroke:"var(--color-muted-foreground)",...a},v=c;return v!=null&&v.isError?{...y,stroke:u?"var(--color-error-wMain)":"var(--color-error-w70)",strokeWidth:u?3:2}:v!=null&&v.isSelected?{...y,stroke:"#3b82f6",strokeWidth:3}:v!=null&&v.isAnimated?{...y,stroke:u?"#1d4ed8":"#3b82f6",strokeWidth:u?4:3}:u?{...y,stroke:"var(--edge-hover-color)"}:y},x=()=>f(!0),g=()=>f(!1);return d.jsxs(d.Fragment,{children:[d.jsx("path",{id:`${e}-interaction`,style:{strokeWidth:16,stroke:"transparent",fill:"none",cursor:"pointer"},className:"react-flow__edge-interaction",d:p,onMouseEnter:x,onMouseLeave:g}),d.jsx("path",{id:e,style:{...h(),cursor:"pointer",transition:"all 0.2s ease-in-out"},className:"react-flow__edge-path",d:p,markerEnd:l,onMouseEnter:x,onMouseLeave:g})]})},TP=({data:e})=>d.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-blue-700 bg-white px-5 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-blue-600 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"180px",textAlign:"center"},children:[d.jsx(Ct,{type:"target",position:ye.Top,id:"peer-top-input",className:"!bg-blue-700",isConnectable:!0}),d.jsx(Ct,{type:"source",position:ye.Right,id:"peer-right-output-tools",className:"!bg-blue-700",style:{top:"25%"},isConnectable:!0}),d.jsx(Ct,{type:"target",position:ye.Right,id:"peer-right-input-tools",className:"!bg-blue-700",style:{top:"75%"},isConnectable:!0}),d.jsx(Ct,{type:"source",position:ye.Bottom,id:"peer-bottom-output",className:"!bg-blue-700",isConnectable:!0}),d.jsx(Ct,{type:"target",position:ye.Left,id:"peer-left-input",className:"!bg-blue-700",isConnectable:!0}),d.jsx("div",{className:"flex items-center justify-center",children:d.jsx("div",{className:"text-md font-semibold",children:e.label})})]}),AP=({data:e,id:t})=>{const n=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-cyan-500"}};return d.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-cyan-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-cyan-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[d.jsx(Ct,{type:"target",position:ye.Left,id:`${t}-tool-left-input`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"25%"}}),d.jsxs("div",{className:"flex items-center justify-center",children:[d.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${n()}`}),d.jsx("div",{className:"text-md",children:e.label})]}),d.jsx(Ct,{type:"source",position:ye.Left,id:`${t}-tool-bottom-output`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"75%"}})]})},NP=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-teal-500"}};return d.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-teal-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-teal-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[d.jsx(Ct,{type:"target",position:ye.Left,id:"llm-left-input",className:"!bg-teal-500",isConnectable:!0,style:{top:"25%"}}),d.jsxs("div",{className:"flex items-center justify-center",children:[d.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${t()}`}),d.jsx("div",{className:"text-md",children:e.label})]}),d.jsx(Ct,{type:"source",position:ye.Left,id:"llm-bottom-output",className:"!bg-teal-500",isConnectable:!0,style:{top:"75%"}})]})},jP=({data:e})=>d.jsxs("div",{className:"cursor-pointer rounded-lg border-indigo-600 bg-gradient-to-r from-indigo-50 to-purple-50 px-5 py-3 text-gray-900 shadow-xl transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-2xl dark:border-indigo-400 dark:bg-gradient-to-r dark:from-indigo-900 dark:to-purple-900 dark:text-gray-100",style:{minWidth:"180px",textAlign:"center",borderWidth:"2px",borderStyle:"solid",boxShadow:"0 0 0 1px rgba(79, 70, 229, 0.3), 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:[d.jsx(Ct,{type:"source",position:ye.Right,id:"orch-right-output-tools",className:"!bg-indigo-500",style:{top:"25%"},isConnectable:!0}),d.jsx(Ct,{type:"target",position:ye.Right,id:"orch-right-input-tools",className:"!bg-indigo-500",style:{top:"75%"},isConnectable:!0}),d.jsx(Ct,{type:"target",position:ye.Top,id:"orch-top-input",className:"!bg-indigo-500",isConnectable:!0}),d.jsx(Ct,{type:"source",position:ye.Bottom,id:"orch-bottom-output",className:"!bg-indigo-500",isConnectable:!0}),d.jsx(Ct,{type:"target",position:ye.Left,id:"orch-left-input",className:"!bg-indigo-500",isConnectable:!0}),d.jsx("div",{className:"flex items-center justify-center",children:d.jsx("div",{className:"text-md flex items-center font-bold",children:e.label})})]}),IP=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-purple-500"}};return d.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-purple-600 bg-white px-4 py-3 text-gray-800 shadow-lg transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-purple-400 dark:bg-gray-700 dark:text-gray-200",style:{minWidth:"120px",textAlign:"center"},children:[e.isTopNode&&d.jsx(Ct,{type:"source",position:ye.Bottom,id:"user-bottom-output",className:"!bg-gray-500",isConnectable:!0}),e.isBottomNode&&d.jsx(Ct,{type:"target",position:ye.Top,id:"user-top-input",className:"!bg-gray-500",isConnectable:!0}),!e.isTopNode&&!e.isBottomNode&&d.jsx(Ct,{type:"source",position:ye.Right,id:"user-right-output",className:"!bg-gray-500",isConnectable:!0}),d.jsxs("div",{className:"flex items-center justify-center",children:[d.jsx("div",{className:`mr-2 h-3 w-3 rounded-full ${t()}`}),d.jsx("div",{className:"text-sm font-bold",children:e.label})]})]})},RP=({step:e,isHighlighted:t,onClick:n,variant:r="list"})=>{const o=()=>{var b,w,S;switch(e.type){case"USER_REQUEST":return d.jsx(iP,{className:"mr-2 text-blue-500 dark:text-blue-400",size:18});case"AGENT_RESPONSE_TEXT":return d.jsx($l,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"TASK_COMPLETED":return d.jsx(JM,{className:"mr-2 text-green-500 dark:text-green-400",size:18});case"TASK_FAILED":return d.jsx(sP,{className:"mr-2 text-red-500 dark:text-red-400",size:18});case"AGENT_LLM_CALL":return d.jsx($l,{className:"mr-2 text-purple-500 dark:text-purple-400",size:18});case"AGENT_LLM_RESPONSE_TO_AGENT":return d.jsx($l,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_LLM_RESPONSE_TOOL_DECISION":{const E=(w=(b=e.data.toolDecision)==null?void 0:b.decisions)==null?void 0:w[0];return(E==null?void 0:E.isPeerDelegation)?d.jsx(Ep,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18}):d.jsx(Sp,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18})}case"AGENT_TOOL_INVOCATION_START":return(S=e.data.toolInvocationStart)!=null&&S.isPeerInvocation?d.jsx(Ep,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18}):d.jsx(Sp,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18});case"AGENT_TOOL_EXECUTION_RESULT":return d.jsx(tP,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_ARTIFACT_NOTIFICATION":return d.jsx(eP,{className:"mr-2 text-indigo-500 dark:text-indigo-400",size:18});default:return d.jsx(rP,{className:"mr-2 text-gray-500 dark:text-gray-400",size:18})}},i=new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),s=String(new Date(e.timestamp).getMilliseconds()).padStart(3,"0"),a=`${i}.${s}`,l=b=>d.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[d.jsxs("p",{children:[d.jsx("strong",{children:"Model:"})," ",b.modelName]}),d.jsx("p",{className:"mt-1",children:d.jsx("strong",{children:"Prompt Preview:"})}),d.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:b.promptPreview})]}),c=({data:b})=>{const[w,S]=Pt.useState(!1),E=C=>{C.stopPropagation(),S(!w)};return w?d.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[d.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[d.jsx("strong",{children:"LLM Response Details:"}),d.jsx("button",{onClick:E,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Hide details"})]}),b.modelName&&d.jsxs("p",{children:[d.jsx("strong",{children:"Model:"})," ",b.modelName]}),d.jsxs("div",{className:"mt-1",children:[d.jsx("p",{children:d.jsx("strong",{children:"Response Preview:"})}),d.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:b.responsePreview})]}),b.isFinalResponse!==void 0&&d.jsxs("p",{className:"mt-1",children:[d.jsx("strong",{children:"Final Response:"})," ",b.isFinalResponse?"Yes":"No"]})]}):d.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[d.jsx("span",{className:"italic",children:"Internal LLM response"}),d.jsx("button",{onClick:E,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Show details"})]})},u=b=>d.jsxs("div",{className:"mt-1.5 rounded-md bg-blue-50 p-2 font-mono text-xs text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:[d.jsx("p",{className:"mb-2",children:d.jsxs("strong",{children:["🔧 ",b.isParallel?"Parallel Tool Calls:":"Tool Call:"]})}),d.jsx("ul",{className:"space-y-1 pl-2",children:b.decisions.map(w=>d.jsxs("li",{className:"flex items-center",children:[d.jsx("span",{className:"mr-2",children:"•"}),d.jsx("code",{children:w.toolName})]},w.functionCallId))})]}),f=b=>d.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[d.jsxs("p",{children:[d.jsx("strong",{children:"Tool:"})," ",b.toolName]}),d.jsx("p",{className:"mt-1",children:d.jsx("strong",{children:"Arguments:"})}),d.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:d.jsx(Kc,{data:b.toolArguments})})]}),p=b=>d.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[d.jsxs("p",{children:[d.jsx("strong",{children:"Tool:"})," ",b.toolName]}),d.jsx("p",{className:"mt-1",children:d.jsx("strong",{children:"Result:"})}),d.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:typeof b.resultData=="object"?d.jsx(Kc,{data:b.resultData}):d.jsx("pre",{className:"font-mono text-xs break-all whitespace-pre-wrap",children:String(b.resultData)})})]}),h=b=>d.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[d.jsxs("p",{children:[d.jsx("strong",{children:"Artifact:"})," ",b.artifactName,b.version!==void 0&&d.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[" (v",b.version,")"]})]}),b.mimeType&&d.jsxs("p",{children:[d.jsx("strong",{children:"Type:"})," ",b.mimeType]}),b.description&&d.jsxs("p",{className:"mt-1",children:[d.jsx("strong",{children:"Description:"})," ",b.description]})]}),x=r==="list"&&e.nestingLevel&&e.nestingLevel>0?{marginLeft:`${e.nestingLevel*24}px`}:{},g=r==="popover"?`
379
+ p-3 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors duration-150
380
+ ${n?"cursor-pointer":""}
381
+ `:`
382
+ mb-3 p-3 border rounded-lg shadow-sm
383
+ bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
384
+ ${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
385
+ ${n?"cursor-pointer":""}
386
+ `,y=()=>e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||e.type==="AGENT_TOOL_INVOCATION_START"?"Delegated to: ":e.type==="AGENT_TOOL_EXECUTION_RESULT"?"Response from: ":"Peer Interaction with: ",v=e.title;return d.jsxs("div",{className:g,style:x,onClick:n,children:[d.jsxs("div",{className:"mb-1.5 flex items-center",children:[o(),d.jsx("h4",{className:"flex-grow text-sm font-semibold text-gray-700 dark:text-gray-200",title:e.title,children:v}),d.jsx("span",{className:"font-mono text-xs text-gray-500 dark:text-gray-400",children:a})]}),e.delegationInfo&&e.delegationInfo.length>0&&d.jsx("div",{className:"mt-2 mb-1.5 space-y-2 rounded-r-md border-l-4 border-blue-500 bg-blue-50 p-2 text-sm dark:border-blue-400 dark:bg-gray-700/60",children:e.delegationInfo.map(b=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[d.jsx(nP,{className:"mr-2 h-4 w-4 flex-shrink-0"}),d.jsxs("span",{children:[y(),b.peerAgentName]})]}),b.subTaskId&&d.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",d.jsxs("span",{className:"font-mono",title:b.subTaskId,children:[b.subTaskId.substring(0,15),"..."]})]})]},b.functionCallId))}),e.data.text&&d.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:d.jsx(ko,{children:e.data.text})}),e.data.finalMessage&&d.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:d.jsx(ko,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&d.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&d.jsxs("div",{className:"mt-1 rounded-md bg-red-50 p-2 pl-1 text-sm text-red-700 dark:bg-red-900/30 dark:text-red-400",children:[d.jsxs("p",{children:[d.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&d.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&l(e.data.llmCall),e.data.llmResponseToAgent&&d.jsx(c,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&u(e.data.toolDecision),e.data.toolInvocationStart&&f(e.data.toolInvocationStart),e.data.toolResult&&p(e.data.toolResult),e.data.artifactNotification&&h(e.data.artifactNotification)]})},MP={genericAgentNode:TP,userNode:IP,llmNode:NP,orchestratorNode:jP,genericToolNode:AP},PP={defaultFlowEdge:_P},DP={x:16,y:0},OP=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,i]=xM([]),[s,a,l]=yM([]),{fitView:c}=Qa(),{highlightedStepId:u,setHighlightedStepId:f,setReplayState:p}=Tu(),{taskIdInSidePanel:h}=Ot(),x=m.useRef([]),[g,y]=m.useState(!1),[v,b]=m.useState(null),[w,S]=m.useState(!1),E=m.useRef(null),[C,k]=m.useState(null),[T,P]=m.useState(!1),[z,D]=m.useState(!1),[$,M]=m.useState([]),[_,N]=m.useState(0),[A,I]=m.useState(0),j=m.useRef(null),R=m.useRef(null),O=m.useRef(null),L=m.useRef(new Xy),Y=m.useMemo(()=>{const q=T?$:e;return!q||q.length===0?{nodes:[],edges:[]}:CP(q)},[e,$,T]),H=m.useMemo(()=>Y.edges.length?Y.edges.map(q=>{const re=q.data;let te={isAnimated:!1,animationType:"none"};if(re!=null&&re.visualizerStepId){const ee=T?$:e,Te=T?$.length-1:e.length-1;te=L.current.getEdgeAnimationState(re.visualizerStepId,Te,ee)}let pe=q.id===C;return u&&(re==null?void 0:re.visualizerStepId)===u&&(pe=!0),{...q,animated:te.isAnimated,data:{...re,isAnimated:te.isAnimated,animationType:te.animationType,isSelected:pe}}}):[],[Y.edges,T,$,e,C,u]),V=m.useCallback(()=>{o(q=>q.map(re=>{var dt,ft,at,qe;if(re.type!=="group")return re;const te=q.filter(Oe=>Oe.parentId===re.id);if(te.length===0)return re;let pe=0,ee=0;te.forEach(Oe=>{const Ke=Oe.position.x+dn,xt=Oe.position.y+Dt;pe=Math.max(pe,Ke),ee=Math.max(ee,xt)});const Te=pe+Oo,Ue=ee+Vn;let Ve=0;const Ge=re.id.split("_");if(Ge.length>2){const Oe=Ge.find(Ke=>Ke.startsWith("subflow"));if(Oe){const Ke=parseInt(Oe.replace("subflow",""));isNaN(Ke)||(Ve=Ke)}}const et=dn+2*Oo+Ve*50,st=Math.max(Te,et),ot=parseInt(((ft=(dt=re.style)==null?void 0:dt.width)==null?void 0:ft.toString().replace("px",""))||"0"),ze=parseInt(((qe=(at=re.style)==null?void 0:at.height)==null?void 0:qe.toString().replace("px",""))||"0");return ot!==st||ze!==Ue?{...re,style:{...re.style,width:`${st}px`,height:`${Ue}px`}}:re}))},[o]);m.useEffect(()=>{o(Y.nodes),a(H),V()},[Y.nodes,H,o,a,V]),m.useEffect(()=>{T||(N(0),M([]),j.current&&(clearTimeout(j.current),j.current=null),R.current=null,O.current=null)},[T]);const U=m.useCallback(()=>{if(e.length===0||T)return;const q=Date.parse(e[0].timestamp);if(isNaN(q)){console.error("Error: First step has an invalid timestamp. Cannot start replay.",e[0]);return}o([]),a([]),N(0),M([]),D(!1),I(0),O.current=q,R.current=Date.now(),P(!0),p(!0,0)},[e,T,o,a,N,P,p]),G=m.useCallback(()=>{if(!(!T||z)){if(R.current){const q=Date.now()-R.current;I(q)}j.current&&(clearTimeout(j.current),j.current=null),D(!0)}},[T,z]),B=m.useCallback(()=>{!T||!z||(R.current&&(R.current=Date.now()-A),D(!1))},[T,z,A]),W=m.useCallback((q,re)=>s.find(te=>te.source===q&&(re?te.sourceHandle===re:!0))||null,[s]),Z=m.useCallback((q,re)=>{var pe;y(!0);const te=(pe=re.data)==null?void 0:pe.visualizerStepId;if(te){const ee=e.find(Te=>Te.id===te);ee&&(k(re.id),t?f(te):(f(te),b(ee),S(!0)))}},[e,t,f]),ie=m.useCallback(q=>{switch(q.type){case"userNode":{const re=q.data;return re!=null&&re.isTopNode?["user-bottom-output"]:re!=null&&re.isBottomNode?["user-top-input"]:["user-right-output"]}case"orchestratorNode":return["orch-right-output-tools","orch-bottom-output"];case"genericAgentNode":return["peer-right-output-tools","peer-bottom-output"];case"llmNode":return["llm-bottom-output"];case"genericToolNode":return[`${q.id}-tool-bottom-output`];default:return[]}},[]),se=m.useCallback((q,re)=>{y(!0);const te=ie(re);let pe=null;for(const ee of te)if(pe=W(re.id,ee),pe)break;if(!pe&&re.type==="userNode"){const ee=re.data;ee!=null&&ee.isBottomNode&&(pe=s.find(Te=>Te.target===re.id)||null)}pe&&Z(q,pe)},[ie,W,Z,s]),K=m.useCallback(q=>{q!=null&&q.isTrusted&&y(!0)},[]),ne=m.useCallback(()=>{S(!1),b(null)},[]);return m.useEffect(()=>{if(T&&e.length>0&&O.current!==null&&R.current!==null){const q=O.current,re=R.current;let te=null;const pe=()=>{if(!T||_>=e.length){P(!1),p(!1,e.length),te&&cancelAnimationFrame(te),j.current&&clearTimeout(j.current),j.current=null;return}if(z){j.current&&clearTimeout(j.current),j.current=window.setTimeout(()=>{te=requestAnimationFrame(pe)},100);return}const ee=Date.now()-re;let Te=_,Ue=0;for(;Te<e.length;){const Ve=e[Te];if(Date.parse(Ve.timestamp)-q<=ee)M(et=>[...et,Ve]),Te++,Ue++;else break}if(Ue>0&&(N(Te),V(),p(!0,Te)),Te>=e.length)P(!1),p(!1,e.length),j.current&&clearTimeout(j.current),j.current=null;else{const Ve=e[Te],Ge=Date.parse(Ve.timestamp)-q,et=Math.max(0,Ge-ee);j.current&&clearTimeout(j.current),j.current=window.setTimeout(()=>{te=requestAnimationFrame(pe)},et)}};return te=requestAnimationFrame(pe),()=>{te&&cancelAnimationFrame(te),j.current&&(clearTimeout(j.current),j.current=null)}}},[T,z,e,_,P,N,V,p,M]),m.useEffect(()=>{y(!1)},[h]),m.useEffect(()=>{!n&&c&&r.length>0&&x.current!==e&&g===!1&&(c({duration:200,padding:.1,maxZoom:1.2}),x.current=e)},[r.length,c,e,n,g]),m.useEffect(()=>{o(q=>q.map(re=>{var Te;const te=((Te=re.data)==null?void 0:Te.visualizerStepId)&&re.data.visualizerStepId===u,pe=Y.nodes.find(Ue=>Ue.id===re.id),ee=(pe==null?void 0:pe.style)||{};return{...re,style:{...ee,boxShadow:te?"0px 4px 12px rgba(0, 0, 0, 0.2)":ee.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}}))},[u,o,Y.nodes]),m.useEffect(()=>{if(u){const q=H.find(re=>{const te=re.data;return(te==null?void 0:te.visualizerStepId)===u});q&&k(q.id)}else k(null)},[u,H]),!e||e.length===0?d.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:Object.keys(e).length>0?"Processing flow data...":"No steps to display in flow chart."}):Y.nodes.length===0&&e.length>0?d.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):d.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[d.jsxs(gM,{nodes:r,edges:s.map(q=>({...q,markerEnd:{type:$i.ArrowClosed,color:"#888"}})),onNodesChange:i,onEdgesChange:l,onEdgeClick:Z,onNodeClick:se,onPaneClick:()=>{f(null),k(null),ne()},onMoveStart:K,nodeTypes:MP,edgeTypes:PP,fitViewOptions:{padding:.1},className:"bg-gray-50 dark:bg-gray-900 [&>button]:dark:bg-gray-700",proOptions:{hideAttribution:!0},nodesDraggable:!1,elementsSelectable:!1,nodesConnectable:!1,minZoom:.2,children:[d.jsx(SM,{}),d.jsx(jM,{className:_d()}),d.jsx(Do,{position:"bottom-right",className:`flex space-x-1 rounded bg-white p-1 dark:bg-gray-800 ${_d()}`,children:T?z?d.jsx(jr,{onClick:B,title:"Resume Replay",children:d.jsx(bp,{})}):d.jsx(jr,{onClick:G,title:"Pause Replay",children:d.jsx(oP,{})}):d.jsx(jr,{onClick:U,title:"Replay Flow",disabled:e.length===0,children:d.jsx(bp,{})})}),d.jsx(Do,{position:"top-right",className:"flex items-center space-x-4",children:d.jsx("div",{ref:E})})]}),d.jsx(__,{isOpen:w,onClose:ne,anchorRef:E,offset:DP,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:v&&d.jsx(RP,{step:v,variant:"popover"})})]})},LP=e=>d.jsx(Uy,{children:d.jsx(OP,{...e})}),Rc=e=>{var t,n,r;if(e.events&&e.events.length>0){const o=e.events[0];if((r=(n=(t=o.full_payload)==null?void 0:t.params)==null?void 0:n.metadata)!=null&&r.parentTaskId)return o.full_payload.params.metadata.parentTaskId}},$P=(e,t)=>{var o,i,s,a,l;const n=t[e];if(!n)return null;for(const c of n.events||[]){const u=c.full_payload;if(c.direction==="status_update"&&(u!=null&&u.result)){const f=((o=u.result.metadata)==null?void 0:o.agent_name)||((a=(s=(i=u.result.status)==null?void 0:i.message)==null?void 0:s.metadata)==null?void 0:a.agent_name)||c.source_entity;if(f)return f}}const r=(l=n.events)==null?void 0:l.find(c=>c.direction==="request");return(r==null?void 0:r.target_entity)||null},ti=e=>{var t,n,r;return((r=(n=(t=e.full_payload)==null?void 0:t.result)==null?void 0:n.status)==null?void 0:r.timestamp)||e.timestamp},Jy=(e,t,n,r)=>{const o=t[e];if(!o)return console.warn(`[collectAllDescendantEvents] Task not found in allMonitoredTasks: ${e}`),[];n.set(e,r);let i=[...o.events||[]];for(const s in t){const a=t[s];if(a.taskId===e)continue;Rc(a)===e&&(i=i.concat(Jy(a.taskId,t,n,r+1)))}return i},FP=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,i=new Map,s=(N,A)=>(r.agents[N]||(r.agents[N]={agentName:A,instanceId:N,displayName:A,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[N]),a=new Map,l=Jy(n.taskId,t,a,0);if(l.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const c=l.sort((N,A)=>new Date(ti(N)).getTime()-new Date(ti(A)).getTime()),u=[];let f="",p,h,x=[],g=null,y;const v=new Map,b=new Map,w=new Map,S=N=>{if(f.trim()&&p&&h){const A=f.trim();let I=n.taskId;if(x.length>0){const O=x[0].split("-");O.length>2&&O[1]!=="global"&&(I=O.slice(1,O.length-1).join("-"))}else N&&(I=N);const j=a.get(I)??0,R=v.get(I)||w.get(I);u.push({id:`vstep-agenttext-${u.length}-${x[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:h,title:`${p}: Response`,source:p,target:"User",data:{text:A},rawEventIds:[...x],isSubTaskStep:j>0,nestingLevel:j,owningTaskId:I,functionCallId:R}),g=A}f="",p=void 0,h=void 0,x=[],y=void 0};c.forEach((N,A)=>{var B,W,Z,ie,se,K,ne,q,re,te,pe,ee,Te,Ue,Ve,Ge,et,st,ot,ze,dt,ft,at,qe,Oe,Ke,xt,Qe,Xe,kt,Ee,Q,ae,le,ge,he,fe,Se,xe,Ie,ke,Ne,$e,Je,mt,yt,lt,vt,Lt,Ft,zt,Nt,wt,Wt,Bt;const I=ti(N),j=`raw-${N.task_id||"global"}-${A}`,R=N.full_payload,O=N.task_id||n.taskId,L=a.get(O)??0;let Y=N.source_entity||"UnknownAgent";(W=(B=R==null?void 0:R.result)==null?void 0:B.metadata)!=null&&W.agent_name?Y=R.result.metadata.agent_name:(K=(se=(ie=(Z=R==null?void 0:R.result)==null?void 0:Z.status)==null?void 0:ie.message)==null?void 0:se.metadata)!=null&&K.agent_name?Y=R.result.status.message.metadata.agent_name:(re=(q=(ne=R==null?void 0:R.result)==null?void 0:ne.artifact)==null?void 0:q.metadata)!=null&&re.agent_name&&(Y=R.result.artifact.metadata.agent_name);let H;const V=(Te=(ee=(pe=(te=R==null?void 0:R.result)==null?void 0:te.status)==null?void 0:pe.message)==null?void 0:ee.metadata)==null?void 0:Te.function_call_id;if(L>0?H=v.get(O):H=w.get(O),V&&(H=V),N.direction==="request"&&L>0){const je=(Ue=R.params)==null?void 0:Ue.metadata,Pe=je==null?void 0:je.function_call_id,_e=N.task_id;if(_e&&Pe){v.set(_e,Pe);return}}if(N.direction==="request"&&L===0&&N.task_id===n.taskId){S(O),g=null;const je=R.params;let Pe="User request";if((Ve=je==null?void 0:je.message)!=null&&Ve.parts){const _e=je.message.parts.filter(ce=>ce.type==="text");Pe=((Ge=_e[1])==null?void 0:Ge.text)??((et=_e[0])==null?void 0:et.text)}u.push({id:`vstep-userreq-${u.length}-${j}`,type:"USER_REQUEST",timestamp:I,title:"User Input",source:"User",target:N.target_entity||Y,data:{text:Pe},rawEventIds:[j],isSubTaskStep:!1,nestingLevel:0,owningTaskId:O});return}if(N.direction==="status_update"&&(R!=null&&R.result)){const je=R.result,Pe=(st=je.status)==null?void 0:st.message,_e=Pe==null?void 0:Pe.metadata;let ce,F=!1;_e!=null&&_e.forwarded_from_peer?(ce=_e.forwarded_from_peer,F=!0):(ot=je.metadata)!=null&&ot.agent_name?ce=je.metadata.agent_name:_e!=null&&_e.agent_name?ce=_e.agent_name:ce=N.source_entity||"Agent";const oe=`${ce}:${O}`;if((_e==null?void 0:_e.type)==="llm_invocation"){S(O);const J=_e.data;let me="System-initiated LLM call";if(J!=null&&J.contents&&Array.isArray(J.contents))for(let ue=J.contents.length-1;ue>=0;ue--){const be=J.contents[ue];if((be==null?void 0:be.role)==="user"){if((ze=be.parts)!=null&&ze.some(Ae=>Ae.text)){me=be.parts.map(Ae=>Ae.text).join(`
387
+ `);break}else if((dt=be.parts)!=null&&dt.some(Ae=>Ae.function_response)){me=`Processing response from tool: ${be.parts.find(ct=>ct.function_response).function_response.name}`;break}}}const de={modelName:(J==null?void 0:J.model)||"Unknown Model",promptPreview:me};s(oe,ce),o.set(oe,{timestamp:I,modelName:de.modelName});const X={id:`vstep-llmcall-${u.length}-${j}`,type:"AGENT_LLM_CALL",timestamp:I,title:`${ce}: LLM Call`,source:ce,target:"LLM",data:{llmCall:de},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:H};u.push(X);return}if((_e==null?void 0:_e.type)==="llm_response"&&((at=(ft=_e.data)==null?void 0:ft.content)!=null&&at.parts)){const J=o.get(oe);if(J){const X=new Date(I).getTime()-new Date(J.timestamp).getTime();s(oe,ce).llmCalls.push({modelName:J.modelName,durationMs:X,timestamp:J.timestamp}),o.delete(oe)}const me=_e.data.content.parts,de=me.filter(X=>X.function_call);if(de.length>0){p===ce&&f.trim()&&(S(O),g=null),w.delete(O);const X=de.map(nt=>{var Ht;const Rt=nt.function_call;return{functionCallId:Rt.id,toolName:Rt.name,toolArguments:Rt.args||{},isPeerDelegation:(Ht=Rt.name)==null?void 0:Ht.startsWith("peer_")}}),ue={decisions:X,isParallel:X.length>1},be=[],Ae=new Set;X.forEach(nt=>{if(nt.isPeerDelegation){const Rt=nt.toolName.substring(5);for(const Ht in t){const Mt=t[Ht];if(Ae.has(Mt.taskId))continue;if(Rc(Mt)===O&&Mt.events&&Mt.events.length>0){const Re=Mt.events.find(ln=>{var er,tr;return ln.direction==="request"&&((tr=(er=ln.full_payload)==null?void 0:er.method)==null?void 0:tr.startsWith("tasks/"))&&ln.target_entity===Rt});if(Re&&new Date(ti(Re)).getTime()>=new Date(I).getTime()){const ln={functionCallId:nt.functionCallId,peerAgentName:Rt,subTaskId:Mt.taskId};be.push(ln),b.set(nt.functionCallId,ln),Mt.taskId&&(v.set(Mt.taskId,nt.functionCallId),Ae.add(Mt.taskId));break}}}}});const ct={id:`vstep-tooldecision-${u.length}-${j}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:I,title:`LLM: Tool Decision${ue.isParallel?" (Parallel)":""}`,source:"LLM",target:ce,data:{toolDecision:ue},rawEventIds:[j],delegationInfo:be.length>0?be:void 0,isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O};u.push(ct);const ht=ue.isParallel?ct.id:void 0,Gt=oe;s(Gt,ce),X.forEach(nt=>{var Ht;const Rt=nt.isPeerDelegation?(Ht=b.get(nt.functionCallId))==null?void 0:Ht.subTaskId:void 0;i.has(nt.functionCallId)||i.set(nt.functionCallId,{timestamp:I,toolName:nt.toolName,isPeer:nt.isPeerDelegation,invokingAgentInstanceId:Gt,subTaskId:Rt,parallelBlockId:ht})});return}else{const X=me.filter(be=>be.text).map(be=>be.text).join("\\n"),ue={responsePreview:X.substring(0,200)+(X.length>200?"...":""),isFinalResponse:((qe=_e.data)==null?void 0:qe.partial)===!1};u.push({id:`vstep-llmrespagent-${u.length}-${j}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:I,title:`${ce}: LLM Response`,source:"LLM",target:ce,data:{llmResponseToAgent:ue},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:H});return}}if((_e==null?void 0:_e.type)==="tool_invocation_start"){p===ce&&f.trim()&&(S(O),g=null);const J=_e.data,me=J==null?void 0:J.tool_name,de=(J==null?void 0:J.tool_args)||{},X=(J==null?void 0:J.function_call_id)||`unknown-${me}-${u.length}`;console.log(`Processing tool invocation start for ${me} with functionCallId: ${X}`);const ue={functionCallId:X,toolName:me,toolArguments:de,isPeerInvocation:me==null?void 0:me.startsWith("peer_")},be={id:`vstep-toolinvokestart-${u.length}-${j}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:I,title:`${ce}: Executing tool ${me}`,source:ce,target:me,data:{toolInvocationStart:ue},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:X};if(ue.isPeerInvocation){const Ae=b.get(X);Ae&&(be.delegationInfo=[Ae])}u.push(be);return}if(Pe!=null&&Pe.parts&&(_e==null?void 0:_e.type)==="tool_response_content"){S(O),(((xt=(Ke=(Oe=je.status)==null?void 0:Oe.message)==null?void 0:Ke.parts)==null?void 0:xt.filter(me=>{var de;return me.type==="data"&&((de=me.metadata)==null?void 0:de.tool_name)}))||[]).forEach((me,de)=>{const X=me.metadata,ue=X.tool_name,be=X.function_call_id;if(!ue||!be){console.warn("Skipping tool result part due to missing metadata",me);return}const Ae=i.get(be);if(Ae){const Gt=new Date(I).getTime()-new Date(Ae.timestamp).getTime(),nt=r.agents[Ae.invokingAgentInstanceId];if(nt){const Rt={toolName:Ae.toolName,durationMs:Gt,isPeer:Ae.isPeer,timestamp:Ae.timestamp,peerAgentName:Ae.isPeer?Ae.toolName.substring(5):void 0,subTaskId:Ae.subTaskId,parallelBlockId:Ae.parallelBlockId};nt.toolCalls.push(Rt)}i.delete(be)}const ct=ue==null?void 0:ue.startsWith("peer_"),ht={toolName:ue,functionCallId:be,resultData:me.data,isPeerResponse:ct};u.push({id:`vstep-toolresult-${u.length}-${j}-${de}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:I,title:`${ce}: Tool Result - ${ue}`,source:ue,target:ce,data:{toolResult:ht},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:be})});return}if(je.final===!0&&O===n.taskId){S(O);const J=(Qe=je.status)==null?void 0:Qe.message;if(J!=null&&J.parts){const me=J.parts.find(de=>de.type==="text");if(me!=null&&me.text&&me.text.trim()){const de=me.text.trim();de!==g&&(u.push({id:`vstep-agenttext-finalevent-${u.length}-${j}`,type:"AGENT_RESPONSE_TEXT",timestamp:I,title:`${ce}: Response (Final Update)`,source:ce,target:"User",data:{text:de},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:H}),g=de)}}return}if(Pe!=null&&Pe.parts){const J=Pe.parts.find(me=>me.type==="text");if(J!=null&&J.text)p&&p!==ce&&(S(O),g=null),p||(p=ce,h=I,y=F),f+=J.text,x.push(j);else{const me=Pe.parts.find(de=>{var X;return de.type==="data"&&((X=de.data)==null?void 0:X.a2a_signal_type)==="agent_status_message"});if(me&&F){const de=(Xe=me.data)==null?void 0:Xe.text;de&&(p&&p!==ce&&(S(O),g=null),p||(p=ce,h=I,y=!0),f+=de,x.push(j))}}}return}if(N.direction==="artifact_update"&&((kt=R==null?void 0:R.result)!=null&&kt.artifact)){S(O);const je=R.result.artifact,Pe=((Ee=je.metadata)==null?void 0:Ee.agent_name)||N.source_entity||"Agent";let _e;if(je.parts&&je.parts.length>0){const F=je.parts[0];F.type==="file"?_e=F.file.mimeType||void 0:(Q=F.metadata)!=null&&Q.mime_type&&(_e=F.metadata.mime_type)}const ce={artifactName:je.name||"Unnamed Artifact",version:typeof((ae=je.metadata)==null?void 0:ae.version)=="number"?je.metadata.version:void 0,description:je.description||void 0,mimeType:_e};u.push({id:`vstep-artifactnotify-${u.length}-${j}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:I,title:`${Pe}: Artifact Update - ${ce.artifactName}`,source:Pe,target:"User/System",data:{artifactNotification:ce},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:H});return}if(N.direction==="response"&&((ge=(le=R==null?void 0:R.result)==null?void 0:le.status)!=null&&ge.state)){f.trim()&&S(O);const je=R.result,Pe=je.status.state,_e=((he=je.metadata)==null?void 0:he.agent_name)||((xe=(Se=(fe=je.status)==null?void 0:fe.message)==null?void 0:Se.metadata)==null?void 0:xe.agent_name)||N.source_entity||"Agent";if(L>0&&Pe==="completed"){const ce=Rc(t[O]),F=ce?$P(ce,t):null,oe=v.get(O);if(F&&oe){const J=i.get(oe);if(J){const de=new Date(I).getTime()-new Date(J.timestamp).getTime(),X=r.agents[J.invokingAgentInstanceId];if(X){const ue={toolName:J.toolName,durationMs:de,isPeer:J.isPeer,timestamp:J.timestamp,peerAgentName:J.isPeer?J.toolName.substring(5):void 0,subTaskId:J.subTaskId,parallelBlockId:J.parallelBlockId};X.toolCalls.push(ue)}i.delete(oe)}const me={toolName:`peer_${_e}`,functionCallId:oe,resultData:je.status.message,isPeerResponse:!0};u.push({id:`vstep-toolresult-${u.length}-${j}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:I,title:`${F}: Tool Result - peer_${_e}`,source:`peer_${_e}`,target:F,data:{toolResult:me},rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:oe});return}}if(["completed","failed","canceled"].includes(Pe)){const ce=Pe==="completed"?"TASK_COMPLETED":"TASK_FAILED",F=`${_e}: Task ${Pe.charAt(0).toUpperCase()+Pe.slice(1)}`;let oe={},J="";if((Ie=je.status.message)!=null&&Ie.parts){const X=je.status.message.parts.find(ue=>ue.type==="text");X!=null&&X.text&&(J=X.text.trim())}const me=O===n.taskId,de=J&&(!me||J!==g);if(ce==="TASK_COMPLETED")oe={finalMessage:de?J:void 0};else{const ue={message:de?J:`Task ${Pe}.`},be=R.error;be&&(ue.message=be.message||ue.message,ue.code=be.code,be.data&&(ue.details=be.data)),je.error&&(ue.message=je.error.message||ue.message,ue.code=je.error.code||ue.code,ue.details=je.error.data||ue.details),oe={errorDetails:ue}}u.push({id:`vstep-${Pe}-${u.length}-${j}`,type:ce,timestamp:I,title:F,source:_e,target:"User",data:oe,rawEventIds:[j],isSubTaskStep:L>0,nestingLevel:L,owningTaskId:O,functionCallId:H}),me&&(g=null);return}}const U=N.direction==="status_update"&&((Je=($e=(Ne=(ke=R==null?void 0:R.result)==null?void 0:ke.status)==null?void 0:Ne.message)==null?void 0:$e.parts)==null?void 0:Je.some(je=>je.type==="text"));let G=N.source_entity;(vt=(lt=(yt=(mt=R==null?void 0:R.result)==null?void 0:mt.status)==null?void 0:yt.message)==null?void 0:lt.metadata)!=null&&vt.forwarded_from_peer?G=R.result.status.message.metadata.forwarded_from_peer:(Ft=(Lt=R==null?void 0:R.result)==null?void 0:Lt.metadata)!=null&&Ft.agent_name?G=R.result.metadata.agent_name:(Wt=(wt=(Nt=(zt=R==null?void 0:R.result)==null?void 0:zt.status)==null?void 0:Nt.message)==null?void 0:wt.metadata)!=null&&Wt.agent_name&&(G=R.result.status.message.metadata.agent_name),f.trim()&&p&&(!U||U&&G!==p)&&(S(O),a.get(((Bt=x[0])==null?void 0:Bt.split("-")[1])||n.taskId)===0&&!y&&(g=null))});const E=c.length>0&&c[c.length-1].task_id||n.taskId;S(E);const C=c[0]?ti(c[0]):n.firstSeen.toISOString();let k,T="working";const P=u.filter(N=>N.owningTaskId===n.taskId),z=P.length>0?P[P.length-1]:null;if(z&&(z.type==="TASK_COMPLETED"?(T="completed",k=z.timestamp):z.type==="TASK_FAILED"&&(T="failed",k=z.timestamp)),T==="working"&&c.length>0){const N=c[c.length-1];t[N.task_id||n.taskId]}let D;C&&k&&(D=new Date(k).getTime()-new Date(C).getTime());const $={taskId:n.taskId,initialRequestText:n.initialRequestText,status:T,startTime:C,endTime:k,durationMs:D,steps:u};Object.values(r.agents).forEach(N=>{N.totalLlmTimeMs=N.llmCalls.reduce((O,L)=>O+L.durationMs,0);const A=N.toolCalls.filter(O=>!O.parallelBlockId),I=new Map;N.toolCalls.forEach(O=>{O.parallelBlockId&&(I.has(O.parallelBlockId)||I.set(O.parallelBlockId,[]),I.get(O.parallelBlockId).push(O))});const j=A.reduce((O,L)=>O+L.durationMs,0);let R=0;I.forEach(O=>{if(O.length>0){const L=Math.min(...O.map(H=>new Date(H.timestamp).getTime())),Y=Math.max(...O.map(H=>new Date(H.timestamp).getTime()+H.durationMs));R+=Y-L}}),N.totalToolTimeMs=j+R});const M=new Map;Object.values(r.agents).forEach(N=>{M.has(N.agentName)||M.set(N.agentName,[]),M.get(N.agentName).push(N)}),M.forEach(N=>{N.length>1&&(N.sort((A,I)=>{const j=R=>{const O=[...R.llmCalls.map(L=>new Date(L.timestamp).getTime()),...R.toolCalls.map(L=>new Date(L.timestamp).getTime())];return O.length>0?Math.min(...O):1/0};return j(A)-j(I)}),N.forEach((A,I)=>{A.displayName=`${A.agentName} (${I+1})`}))});const _=new Map;return Object.values(r.agents).forEach(N=>{const A=N.instanceId.split(":").slice(1).join(":");A&&_.set(A,N.displayName)}),Object.values(r.agents).forEach(N=>{N.toolCalls.forEach(A=>{if(A.isPeer&&A.subTaskId){const I=_.get(A.subTaskId);I&&(A.peerAgentName=I)}})}),D!==void 0&&(r.overall.totalTaskDurationMs=D),$.performanceReport=r,$},zP=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const i=s=>{r(s)};return d.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[d.jsx(HP,{onClick:o}),d.jsx(VP,{items:e,bottomItems:t,activeItem:n,onItemClick:i})]})},BP=d.jsxs("svg",{id:"header-icon",xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 500 150",width:"100%",height:"100%",children:[d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M8.9,105.7h4.8c1.7,8.2,4.8,14,9.4,17.4,4.6,3.4,9.3,5.1,14.1,5.1,4.4,0,7.7-1,9.7-3,2.1-2.1,3.2-4.9,3.1-7.8,0-3-1.2-5.8-3.4-7.9-1.8-1.5-3.8-2.8-6-3.8l-12.7-6.2c-6.7-3.3-11.5-6.9-14.4-10.7-3-3.9-4.5-8.7-4.4-13.7,0-6.4,2.4-12.7,7-17.2,4.6-4.8,11.1-7.2,19.4-7.3,3.9,0,7.8.7,11.5,1.8,4.1,1.2,6.6,1.8,7.6,1.8,1.1.1,2.2-.2,3-.9.7-.7,1.2-1.5,1.5-2.5h3.8v24.8h-4.4c-1.3-5.3-4.1-10.2-8-14-3.4-3.4-8.1-5.3-12.9-5.3-3.8,0-6.6,1.1-8.5,3.2-1.8,1.9-2.8,4.3-2.8,6.9.1,2.2,1,4.4,2.5,6,1.6,2.1,4.7,4.2,9.2,6.4l9.4,4.5c5.8,2.8,10.1,5.5,12.7,8.1,4.4,4.3,6.8,10.3,6.7,16.5,0,6.4-2.3,12.3-6.9,17.8-4.6,5.5-11.5,8.3-20.7,8.2-2.3,0-4.6-.2-6.9-.7-2.9-.6-5.8-1.4-8.5-2.4l-2.9-1c-1.1-.4-1.7-.6-2-.7-.3,0-.7,0-1,0-.9,0-1.8.4-2.5,1.1-.9,1.1-1.7,2.4-2.3,3.8h-4.1v-28.4Z"}),d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M83.6,62.5c7.3-8,16.6-12,27.7-12s20.6,4.1,27.9,12.2c7.2,8.2,10.9,18.1,10.9,29.7,0,11.4-3.6,21.3-10.7,29.5-7.1,8.2-16.5,12.4-28,12.4-11.2,0-20.4-4-27.7-12-7.3-8-11-18-11-29.9,0-12,3.7-21.9,11-29.9ZM99.6,117.6c1.9,7.4,5.8,11.2,11.7,11.2,5.5,0,9.2-2.8,10.9-8.6,1.7-5.7,2.6-15,2.6-27.8,0-12.8-.9-22.1-2.7-27.8-1.8-5.7-5.4-8.6-10.7-8.6-5.8,0-9.7,3.7-11.7,11.1-1.3,5-1.9,13.4-1.9,25.2,0,12,.7,20.4,1.9,25.2h0Z"}),d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M154.8,131c3-.7,5.2-1.7,6.4-2.9s1.9-3.7,1.9-7.5V29.8c0-3.7-.6-6.1-1.8-7.2-1.2-1.1-3.4-2-6.5-2.8v-4.1h32.5v104.9c0,3.8.6,6.3,1.8,7.5,1.2,1.2,3.4,2.2,6.5,2.9v4.1h-40.9v-4.1Z"}),d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M212.6,97.3c7.4-4.5,19.1-9.1,34.9-13.7v-12.5c0-5.1-1.1-8.9-3.2-11.3-2.1-2.4-6-3.6-11.4-3.6-2.6-.1-5.3.5-7.6,1.7-2,1.1-3,2.6-3,4.3,0,.6,0,1.2.3,1.7.3.5.6,1,1,1.4l1,1.2c.8.9,1.4,2,1.9,3.1.5,1.2.7,2.4.7,3.6.2,2.9-1,5.6-3.2,7.5-2.1,1.7-4.8,2.7-7.5,2.6-3.1,0-6.1-1-8.4-2.9-2.3-2-3.5-4.8-3.5-8.4,0-6.6,3.1-11.8,9.3-15.6,6.2-3.8,13.8-5.8,22.9-5.8,9.7,0,17.8,1.9,24.4,5.6,6.5,3.7,9.8,10.7,9.7,21v41.6c0,1.1.3,2.2,1,3.1.5.8,1.2,1.2,2.1,1.3.6,0,1.2-.1,1.8-.4.9-.5,1.7-1.2,2.5-2l2.6,3.6c-3,3.6-6.8,6.5-11.1,8.2-2.6,1-5.4,1.5-8.1,1.5-5.1,0-8.8-1.5-11.1-4.4-1.6-2.2-2.6-4.8-2.9-7.5-4.5,4.6-10,8.1-16.1,10.1-3.4,1.2-7.1,1.8-10.7,1.8-4.8,0-9.4-1.6-13.2-4.5-4.1-3-6.1-7.7-6.1-14,0-7.8,3.7-13.9,11.2-18.5ZM242.5,119.4c1.7-1.4,3.3-3,4.8-4.7v-25.1c-4.3,1-8.4,2.8-12.1,5.3-5.9,4.1-8.8,9.3-8.8,15.6s.9,6.6,2.6,8.5c1.4,1.8,3.5,2.8,5.7,2.9,2.8,0,5.5-.9,7.8-2.5Z"}),d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M343.3,55.8c5.3,3.5,7.9,8,7.9,13.6,0,2.9-1.1,5.7-3.1,7.7-3.7,3.6-9.3,4.3-13.7,1.8-3.1-1.8-4.6-5-4.6-9.7s0-1.2,0-2.2c0-1,0-2,0-3.1,0-3-.7-5.1-2.1-6.2-1.4-1.1-3.2-1.7-5-1.7-5.3,0-9.1,2.9-11.3,8.8-2.3,6.4-3.5,13.2-3.4,20.1,0,10.7,2.1,19.7,6.4,27,4.2,7.3,10,10.9,17.2,10.9,4.1.1,8.1-.9,11.6-3,2.6-1.8,5-4,7-6.4l3.2,2.9c-5.6,7.8-12.1,13.1-19.6,16-4,1.5-8.3,2.3-12.6,2.3-11,0-20-3.9-27-11.8-7-7.9-10.5-17.5-10.4-28.8,0-12,3.7-22.1,11.1-30.5,7.4-8.4,17.3-12.6,29.6-12.6,6.6-.2,13.2,1.7,18.7,5.3Z"}),d.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M368.2,61.6c6.5-7.1,15.8-11,25.4-10.9,5.6,0,11.1,1.5,15.9,4.4,4.9,2.9,8.9,7.2,11.5,12.3,2.3,4.9,3.7,10.1,4.2,15.4.3,2.2.5,4.5.6,6.8h-43.9c.2,6.1,1.4,12.1,3.4,17.8,3.3,9.4,9.2,14.2,17.7,14.2,4.1,0,8.1-1.3,11.4-3.8,3-2.2,5.7-4.8,8.1-7.6l3.9,2.4c-5.3,8.7-11.5,14.8-18.5,18.2-4.9,2.2-10.2,3.4-15.6,3.3-8.4,0-16.4-3.3-23.7-10-7.4-6.7-11.1-17.3-11.1-31.8,0-13.2,3.5-23.4,10.5-30.7ZM404.7,83.3c-.1-10.1-.9-17.2-2.4-21.2-1.5-4-4.4-6-8.8-6-4.5,0-7.6,2.3-9.2,7-1.7,4.7-2.6,11.4-2.8,20.3h23.1Z"}),d.jsx("circle",{className:"fill-[var(--color-brand-wMain)]",cx:"463.1",cy:"105.7",r:"28.6"})]}),HP=({onClick:e})=>d.jsx("div",{className:"flex h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:d.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:BP})}),VP=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>{const{currentTheme:o,toggleTheme:i}=Xg();return d.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[d.jsx("ul",{className:"space-y-1",children:e.map(s=>d.jsxs("li",{children:[d.jsx(Cp,{item:s,isActive:n===s.id,onItemClick:r}),s.showDividerAfter&&d.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},s.id))}),t&&t.length>0&&d.jsx("div",{className:"flex-1"}),t&&t.length>0&&d.jsx("ul",{className:"space-y-1",children:t.map(s=>d.jsx("li",{className:"my-4",children:s.id==="theme-toggle"?d.jsx("button",{type:"button",disabled:s.disabled,onClick:i,className:"relative mx-auto flex w-full cursor-pointer flex-col items-center bg-[var(--color-primary-w100)] px-3 py-5 text-xs text-[var(--color-primary-text-w10)] transition-colors hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Toggle theme (currently ${o})`,title:`Toggle theme (currently ${o})`,children:d.jsx(zm,{className:"mb-1 h-6 w-6"})}):d.jsx(Cp,{item:s,isActive:n===s.id,onItemClick:r},s.id)},s.id))})]})},Cp=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:i,disabled:s}=e,a=()=>{!s&&n&&n(r)},l=c=>{(c.key==="Enter"||c.key===" ")&&a()};return d.jsxs("button",{type:"button",onClick:n?a:void 0,onKeyDown:n?l:void 0,disabled:s,className:He("relative mx-auto flex w-full cursor-pointer flex-col items-center border-l-4 border-[var(--color-primary-w100)] px-3 py-5 text-xs transition-colors","bg-[var(--color-primary-w100)] hover:bg-[var(--color-primary-w90)]","text-[var(--color-primary-text-w10)] hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)]","disabled:cursor-not-allowed disabled:opacity-50",t?"border-l-4 border-[var(--color-brand-wMain)] bg-[var(--color-primary-w90)]":""),title:o,"aria-label":o,"aria-current":t?"page":void 0,children:[d.jsx(i,{className:He("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),d.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})},_p=[{id:"chat",label:"Chat",icon:US},{id:"agentMesh",label:"Agents",icon:Im}],Tp=[{id:"theme-toggle",label:"Theme",icon:zm,onClick:()=>{}}],UP=({fileName:e,onRemove:t})=>d.jsxs(FT,{className:"max-w-50 gap-1.5 rounded-full bg-muted pr-1",children:[d.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&d.jsx(tt,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:d.jsx(xu,{})})]}),WP=({agents:e})=>{const{isResponding:t,isCancelling:n,userInput:r,selectedAgentName:o,setSelectedAgentName:i,setUserInput:s,handleSubmit:a,handleCancel:l}=Ot(),c=m.useRef(null),[u,f]=m.useState([]),p=m.useRef(null),h=m.useRef(t),[x,g]=m.useState(r),y=l_(x,300);m.useEffect(()=>{s(y)},[y,s]),m.useEffect(()=>{g(r)},[r]),m.useEffect(()=>{h.current&&!t&&setTimeout(()=>{var M;(M=p.current)==null||M.focus()},100),h.current=t},[t]);const v=()=>{var M;t||(M=c.current)==null||M.click()},b=M=>{const _=M.target.files;if(_){const N=Array.from(_).filter(A=>!u.some(I=>I.name===A.name&&I.size===A.size&&I.lastModified===A.lastModified));N.length>0&&f(A=>[...A,...N])}M.target&&(M.target.value=""),setTimeout(()=>{var N;(N=p.current)==null||N.focus()},100)},w=M=>{if(t)return;const _=M.clipboardData;if(!_||!_.files||_.files.length===0)return;_.files.length>0&&M.preventDefault();const N=Array.from(_.files).filter(A=>!u.some(I=>I.name===A.name&&I.size===A.size&&I.lastModified===A.lastModified));N.length>0&&f(A=>[...A,...N])},S=M=>{f(_=>_.filter((N,A)=>A!==M))},E=m.useMemo(()=>!t&&((x==null?void 0:x.trim())||u.length!==0),[t,x,u]),C=async M=>{M.preventDefault(),E&&(await a(M,u,x.trim()),f([]),g(""))},k=M=>{if(t)return;const _=M.filter(N=>!u.some(A=>A.name===N.name&&A.size===N.size&&A.lastModified===N.lastModified));_.length>0&&f(N=>[...N,..._])},{isDragging:T,handleDragEnter:P,handleDragOver:z,handleDragLeave:D,handleDrop:$}=u_({onFilesDropped:k,disabled:t});return d.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${T?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:P,onDragOver:z,onDragLeave:D,onDrop:$,children:[d.jsx("input",{type:"file",ref:c,className:"hidden",multiple:!0,onChange:b,accept:"*/*",disabled:t}),u.length>0&&d.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:u.map((M,_)=>d.jsx(UP,{fileName:M.name,onRemove:()=>S(_)},`${M.name}-${M.lastModified}-${_}`))}),d.jsx(ox,{ref:p,value:x,onChange:M=>g(M.target.value),placeholder:"How can I help you today?",className:"text-base/normal min-h-0 max-h-50 resize-none border-none p-3 shadow-none rounded-2xl focus-visible:outline-none field-sizing-content transition-[height] duration-500 ease-in-out",rows:1,onPaste:w,onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&E&&C(M)}}),d.jsxs("div",{className:"flex items-center gap-2 m-2",children:[d.jsx(tt,{variant:"ghost",onClick:v,disabled:t,tooltip:"Attach file",children:d.jsx($m,{className:"size-4"})}),d.jsx("div",{children:"Agent: "}),d.jsxs(L0,{value:o,onValueChange:i,disabled:t||e.length===0,children:[d.jsx(F0,{className:"w-[250px]",children:d.jsx($0,{defaultValue:o})}),d.jsx(z0,{children:e.map(M=>d.jsx(B0,{value:M.name,children:M.display_name||M.name},M.name))})]}),t&&!n?d.jsxs(tt,{className:"ml-auto gap-1.5",onClick:l,variant:"outline",disabled:n,tooltip:"Cancel",children:[d.jsx(nS,{className:"size-4"}),"Stop"]}):d.jsx(tt,{variant:"ghost",className:"ml-auto gap-1.5",onClick:C,disabled:!E,tooltip:"Send message",children:d.jsx(XS,{className:"size-4"})})]})]})};function GP(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function YP(e,t){if(t){const n=t.toLowerCase();if(n==="text/html"||n==="application/xhtml+xml")return!0}return e?e.toLowerCase().endsWith(".html")||e.toLowerCase().endsWith(".htm"):!1}function qP(e,t){if(t){const n=t.toLowerCase();if(n==="text/x-mermaid"||n==="application/x-mermaid")return!0}return e?e.toLowerCase().endsWith(".mermaid")||e.toLowerCase().endsWith(".mmd"):!1}function KP(e,t){if(t){const n=t.toLowerCase();if(n==="text/csv"||n==="application/csv")return!0}return e?e.toLowerCase().endsWith(".csv"):!1}function XP(e){if(!e)return!1;const t=e.toLowerCase();return t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".bmp")||t.endsWith(".webp")||t.endsWith(".svg")}function ZP(e,t){if(t){const n=t.toLowerCase();if(n==="application/json"||n==="text/json")return!0}return e?e.toLowerCase().endsWith(".json"):!1}function QP(e,t){if(t){const r=t.toLowerCase();if(r==="application/yaml"||r==="text/yaml"||r==="application/x-yaml"||r==="text/x-yaml")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".yaml")||n.endsWith(".yml")}function JP(e,t){if(t){const r=t.toLowerCase();if(r==="text/markdown"||r==="application/markdown")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function eD(e,t){if(t&&t.toLowerCase().startsWith("audio/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".mp3")||n.endsWith(".wav")||n.endsWith(".ogg")||n.endsWith(".aac")||n.endsWith(".flac")||n.endsWith(".m4a")}function nl(e,t){return YP(e,t)?"html":qP(e,t)?"mermaid":XP(e)?"image":JP(e,t)?"markdown":eD(e,t)?"audio":ZP(e,t)?"json":QP(e,t)?"yaml":KP(e,t)?"csv":GP(e,t)?"text":null}function tD(e){try{const t=Uint8Array.from(atob(e),n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!1}).decode(t)}catch(t){console.warn("TextDecoder failed (potentially non-UTF8 data), falling back to simple atob:",t);try{return atob(e)}catch(n){throw console.error("Failed to decode base64 content with atob fallback:",n),new Error("Invalid base64 string")}}}const ev=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],nD=["image","audio"],rD=e=>{if(!e||!e.content)return"";const t=nl(e.name,e.mime_type);if(!t||!ev.includes(t))return"";if(nD.includes(t))return e.content;try{return tD(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},tv=5*1024*1024,oD=qh(tv);function iD(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=nl(e.filename,e.mime_type);return!t||!ev.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>tv?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${oD}.`}:{canPreview:!0}}const nv=(e,t="h-4 w-4")=>{if(!e)return d.jsx(Bd,{className:t});switch(nl(e.filename,e.mime_type)){case"image":case"mermaid":return d.jsx(AS,{className:t});case"audio":return d.jsx(kS,{className:t});case"html":return d.jsx(_S,{className:t});case"text":return d.jsx(qs,{className:t});case"csv":return d.jsx(RS,{className:t});case"json":return d.jsx(jS,{className:t});default:return d.jsx(Bd,{className:t})}},sD=({fileAttachment:e})=>d.jsx(rv,{filename:e.name,onDownload:()=>jb(e)}),rv=({filename:e,onDownload:t})=>{const{artifacts:n,setPreviewArtifact:r,openSidePanelTab:o}=Ot(),i=m.useMemo(()=>n.find(a=>a.filename===e),[n,e]),s=m.useMemo(()=>nv(i),[i]);return d.jsx(d.Fragment,{children:d.jsxs("div",{className:"ml-4 flex flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 h-11 max-w-xs",children:[s,d.jsx("span",{className:"min-w-0 h-9 flex-1 truncate text-sm leading-9",title:e,children:d.jsx("strong",{children:d.jsx("code",{children:e})})}),i&&d.jsx(tt,{variant:"ghost",onClick:a=>{a.stopPropagation(),o("files"),r(i)},tooltip:"Preview",children:d.jsx(Dm,{className:"h-4 w-4"})}),t&&d.jsx(tt,{variant:"ghost",onClick:()=>t(),tooltip:"Download file",children:d.jsx(mu,{className:"h-4 w-4"})})]})})},aD=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return d.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center border p-4",children:d.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[d.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},lD=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let i=0;i<e.length;i++){const s=e[i],a=i<e.length-1?e[i+1]:"";s==='"'?a==='"'?(r+='"',i++):o=!o:s===","&&!o?(n.push(r.trim()),r=""):(s===`
388
+ `||s==="\r"&&a===`
389
+ `)&&!o?(s==="\r"&&a===`
390
+ `&&i++,n.push(r.trim()),r="",n.some(l=>l.trim())?(t.push(n),n=[]):n=[]):r+=s}return(r||n.length>0)&&(n.push(r.trim()),n.some(i=>i.trim())&&t.push(n)),t},cD=({content:e,setRenderError:t})=>{m.useEffect(()=>{t(null)},[e,t]);const n=m.useMemo(()=>{try{return lD(e)}catch(r){return console.error("Error parsing CSV:",r),t("Failed to parse CSV content."),[]}},[e,t]);return n.length?d.jsx("div",{className:"block w-full overflow-x-scroll border",children:d.jsx("div",{style:{minWidth:"min(100%, max-content)"},children:d.jsxs("table",{className:"border-collapse text-sm w-full",children:[d.jsx("thead",{className:"sticky top-0 z-10 shadow-sm",children:n.length>0&&d.jsx("tr",{children:n[0].map((r,o)=>d.jsx("th",{className:"border-b p-2 text-left font-medium whitespace-nowrap",title:r,children:(r==null?void 0:r.trim())||""},`header-${o}`))})}),d.jsx("tbody",{children:n.slice(1).map((r,o)=>d.jsx("tr",{className:o%2===0?"bg-muted dark:bg-gray-700":"",children:r.map((i,s)=>d.jsx("td",{className:"min-w-0 border-b p-2 break-words align-top",title:i,children:(i==null?void 0:i.trim())||""},`cell-${o}-${s}`))},`row-${o}`))})]})})}):d.jsx("div",{children:"No valid CSV content found or failed to parse."})},uD=({content:e,setRenderError:t})=>{const n=m.useMemo(()=>e.replace(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi,(i,s)=>{const a=i.match(/<script(\s[^>]*)?>/i);return`<script${a&&a[1]?a[1]:""}>(function() {
391
+ try {
392
+ ${s}
393
+ } catch (e) { console.error('Error in sandboxed script:', e); }
394
+ })();<\/script>`}),[e]);return d.jsx("div",{className:"h-full w-full overflow-hidden dark:bg-gray-400 border",children:d.jsx("iframe",{srcDoc:n,title:"HTML Preview",sandbox:"allow-scripts allow-same-origin allow-downloads allow-forms allow-popups",allow:"autoplay",className:"h-full w-full border-none",onError:()=>t("Failed to load HTML content."),onLoad:()=>t(null)})})},dD=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return d.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-2",children:d.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})},fD=({content:e})=>d.jsx("div",{className:"w-full",children:d.jsx("div",{className:"max-w-full overflow-hidden",children:d.jsx(ko,{className:"max-w-full break-words",children:e})})});/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:ov,setPrototypeOf:Ap,isFrozen:pD,getPrototypeOf:hD,getOwnPropertyDescriptor:mD}=Object;let{freeze:Xt,seal:fn,create:iv}=Object,{apply:Mc,construct:Pc}=typeof Reflect<"u"&&Reflect;Xt||(Xt=function(t){return t});fn||(fn=function(t){return t});Mc||(Mc=function(t,n,r){return t.apply(n,r)});Pc||(Pc=function(t,n){return new t(...n)});const Ss=Zt(Array.prototype.forEach),gD=Zt(Array.prototype.lastIndexOf),Np=Zt(Array.prototype.pop),ni=Zt(Array.prototype.push),xD=Zt(Array.prototype.splice),Bs=Zt(String.prototype.toLowerCase),Fl=Zt(String.prototype.toString),jp=Zt(String.prototype.match),ri=Zt(String.prototype.replace),yD=Zt(String.prototype.indexOf),vD=Zt(String.prototype.trim),mn=Zt(Object.prototype.hasOwnProperty),Yt=Zt(RegExp.prototype.test),oi=wD(TypeError);function Zt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Mc(e,t,r)}}function wD(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Pc(e,n)}}function We(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Bs;Ap&&Ap(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(pD(t)||(t[r]=i),o=i)}e[o]=!0}return e}function bD(e){for(let t=0;t<e.length;t++)mn(e,t)||(e[t]=null);return e}function Bn(e){const t=iv(null);for(const[n,r]of ov(e))mn(e,n)&&(Array.isArray(r)?t[n]=bD(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Bn(r):t[n]=r);return t}function ii(e,t){for(;e!==null;){const r=mD(e,t);if(r){if(r.get)return Zt(r.get);if(typeof r.value=="function")return Zt(r.value)}e=hD(e)}function n(){return null}return n}const Ip=Xt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zl=Xt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Bl=Xt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ED=Xt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Hl=Xt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),SD=Xt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Rp=Xt(["#text"]),Mp=Xt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Vl=Xt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Pp=Xt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ks=Xt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kD=fn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),CD=fn(/<%[\w\W]*|[\w\W]*%>/gm),_D=fn(/\$\{[\w\W]*/gm),TD=fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),AD=fn(/^aria-[\-\w]+$/),sv=fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ND=fn(/^(?:\w+script|data):/i),jD=fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),av=fn(/^html$/i),ID=fn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Dp=Object.freeze({__proto__:null,ARIA_ATTR:AD,ATTR_WHITESPACE:jD,CUSTOM_ELEMENT:ID,DATA_ATTR:TD,DOCTYPE_NAME:av,ERB_EXPR:CD,IS_ALLOWED_URI:sv,IS_SCRIPT_OR_DATA:ND,MUSTACHE_EXPR:kD,TMPLIT_EXPR:_D});const si={element:1,text:3,progressingInstruction:7,comment:8,document:9},RD=function(){return typeof window>"u"?null:window},MD=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Op=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lv(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:RD();const t=ce=>lv(ce);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==si.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:a,Element:l,NodeFilter:c,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=e,x=l.prototype,g=ii(x,"cloneNode"),y=ii(x,"remove"),v=ii(x,"nextSibling"),b=ii(x,"childNodes"),w=ii(x,"parentNode");if(typeof s=="function"){const ce=n.createElement("template");ce.content&&ce.content.ownerDocument&&(n=ce.content.ownerDocument)}let S,E="";const{implementation:C,createNodeIterator:k,createDocumentFragment:T,getElementsByTagName:P}=n,{importNode:z}=r;let D=Op();t.isSupported=typeof ov=="function"&&typeof w=="function"&&C&&C.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:$,ERB_EXPR:M,TMPLIT_EXPR:_,DATA_ATTR:N,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:I,ATTR_WHITESPACE:j,CUSTOM_ELEMENT:R}=Dp;let{IS_ALLOWED_URI:O}=Dp,L=null;const Y=We({},[...Ip,...zl,...Bl,...Hl,...Rp]);let H=null;const V=We({},[...Mp,...Vl,...Pp,...ks]);let U=Object.seal(iv(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,B=null,W=!0,Z=!0,ie=!1,se=!0,K=!1,ne=!0,q=!1,re=!1,te=!1,pe=!1,ee=!1,Te=!1,Ue=!0,Ve=!1;const Ge="user-content-";let et=!0,st=!1,ot={},ze=null;const dt=We({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ft=null;const at=We({},["audio","video","img","source","image","track"]);let qe=null;const Oe=We({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ke="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",Qe="http://www.w3.org/1999/xhtml";let Xe=Qe,kt=!1,Ee=null;const Q=We({},[Ke,xt,Qe],Fl);let ae=We({},["mi","mo","mn","ms","mtext"]),le=We({},["annotation-xml"]);const ge=We({},["title","style","font","a","script"]);let he=null;const fe=["application/xhtml+xml","text/html"],Se="text/html";let xe=null,Ie=null;const ke=n.createElement("form"),Ne=function(F){return F instanceof RegExp||F instanceof Function},$e=function(){let F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ie&&Ie===F)){if((!F||typeof F!="object")&&(F={}),F=Bn(F),he=fe.indexOf(F.PARSER_MEDIA_TYPE)===-1?Se:F.PARSER_MEDIA_TYPE,xe=he==="application/xhtml+xml"?Fl:Bs,L=mn(F,"ALLOWED_TAGS")?We({},F.ALLOWED_TAGS,xe):Y,H=mn(F,"ALLOWED_ATTR")?We({},F.ALLOWED_ATTR,xe):V,Ee=mn(F,"ALLOWED_NAMESPACES")?We({},F.ALLOWED_NAMESPACES,Fl):Q,qe=mn(F,"ADD_URI_SAFE_ATTR")?We(Bn(Oe),F.ADD_URI_SAFE_ATTR,xe):Oe,ft=mn(F,"ADD_DATA_URI_TAGS")?We(Bn(at),F.ADD_DATA_URI_TAGS,xe):at,ze=mn(F,"FORBID_CONTENTS")?We({},F.FORBID_CONTENTS,xe):dt,G=mn(F,"FORBID_TAGS")?We({},F.FORBID_TAGS,xe):Bn({}),B=mn(F,"FORBID_ATTR")?We({},F.FORBID_ATTR,xe):Bn({}),ot=mn(F,"USE_PROFILES")?F.USE_PROFILES:!1,W=F.ALLOW_ARIA_ATTR!==!1,Z=F.ALLOW_DATA_ATTR!==!1,ie=F.ALLOW_UNKNOWN_PROTOCOLS||!1,se=F.ALLOW_SELF_CLOSE_IN_ATTR!==!1,K=F.SAFE_FOR_TEMPLATES||!1,ne=F.SAFE_FOR_XML!==!1,q=F.WHOLE_DOCUMENT||!1,pe=F.RETURN_DOM||!1,ee=F.RETURN_DOM_FRAGMENT||!1,Te=F.RETURN_TRUSTED_TYPE||!1,te=F.FORCE_BODY||!1,Ue=F.SANITIZE_DOM!==!1,Ve=F.SANITIZE_NAMED_PROPS||!1,et=F.KEEP_CONTENT!==!1,st=F.IN_PLACE||!1,O=F.ALLOWED_URI_REGEXP||sv,Xe=F.NAMESPACE||Qe,ae=F.MATHML_TEXT_INTEGRATION_POINTS||ae,le=F.HTML_INTEGRATION_POINTS||le,U=F.CUSTOM_ELEMENT_HANDLING||{},F.CUSTOM_ELEMENT_HANDLING&&Ne(F.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=F.CUSTOM_ELEMENT_HANDLING.tagNameCheck),F.CUSTOM_ELEMENT_HANDLING&&Ne(F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=F.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),F.CUSTOM_ELEMENT_HANDLING&&typeof F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(U.allowCustomizedBuiltInElements=F.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(Z=!1),ee&&(pe=!0),ot&&(L=We({},Rp),H=[],ot.html===!0&&(We(L,Ip),We(H,Mp)),ot.svg===!0&&(We(L,zl),We(H,Vl),We(H,ks)),ot.svgFilters===!0&&(We(L,Bl),We(H,Vl),We(H,ks)),ot.mathMl===!0&&(We(L,Hl),We(H,Pp),We(H,ks))),F.ADD_TAGS&&(L===Y&&(L=Bn(L)),We(L,F.ADD_TAGS,xe)),F.ADD_ATTR&&(H===V&&(H=Bn(H)),We(H,F.ADD_ATTR,xe)),F.ADD_URI_SAFE_ATTR&&We(qe,F.ADD_URI_SAFE_ATTR,xe),F.FORBID_CONTENTS&&(ze===dt&&(ze=Bn(ze)),We(ze,F.FORBID_CONTENTS,xe)),et&&(L["#text"]=!0),q&&We(L,["html","head","body"]),L.table&&(We(L,["tbody"]),delete G.tbody),F.TRUSTED_TYPES_POLICY){if(typeof F.TRUSTED_TYPES_POLICY.createHTML!="function")throw oi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof F.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw oi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=F.TRUSTED_TYPES_POLICY,E=S.createHTML("")}else S===void 0&&(S=MD(h,o)),S!==null&&typeof E=="string"&&(E=S.createHTML(""));Xt&&Xt(F),Ie=F}},Je=We({},[...zl,...Bl,...ED]),mt=We({},[...Hl,...SD]),yt=function(F){let oe=w(F);(!oe||!oe.tagName)&&(oe={namespaceURI:Xe,tagName:"template"});const J=Bs(F.tagName),me=Bs(oe.tagName);return Ee[F.namespaceURI]?F.namespaceURI===xt?oe.namespaceURI===Qe?J==="svg":oe.namespaceURI===Ke?J==="svg"&&(me==="annotation-xml"||ae[me]):!!Je[J]:F.namespaceURI===Ke?oe.namespaceURI===Qe?J==="math":oe.namespaceURI===xt?J==="math"&&le[me]:!!mt[J]:F.namespaceURI===Qe?oe.namespaceURI===xt&&!le[me]||oe.namespaceURI===Ke&&!ae[me]?!1:!mt[J]&&(ge[J]||!Je[J]):!!(he==="application/xhtml+xml"&&Ee[F.namespaceURI]):!1},lt=function(F){ni(t.removed,{element:F});try{w(F).removeChild(F)}catch{y(F)}},vt=function(F,oe){try{ni(t.removed,{attribute:oe.getAttributeNode(F),from:oe})}catch{ni(t.removed,{attribute:null,from:oe})}if(oe.removeAttribute(F),F==="is")if(pe||ee)try{lt(oe)}catch{}else try{oe.setAttribute(F,"")}catch{}},Lt=function(F){let oe=null,J=null;if(te)F="<remove></remove>"+F;else{const X=jp(F,/^[\r\n\t ]+/);J=X&&X[0]}he==="application/xhtml+xml"&&Xe===Qe&&(F='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+F+"</body></html>");const me=S?S.createHTML(F):F;if(Xe===Qe)try{oe=new p().parseFromString(me,he)}catch{}if(!oe||!oe.documentElement){oe=C.createDocument(Xe,"template",null);try{oe.documentElement.innerHTML=kt?E:me}catch{}}const de=oe.body||oe.documentElement;return F&&J&&de.insertBefore(n.createTextNode(J),de.childNodes[0]||null),Xe===Qe?P.call(oe,q?"html":"body")[0]:q?oe.documentElement:de},Ft=function(F){return k.call(F.ownerDocument||F,F,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},zt=function(F){return F instanceof f&&(typeof F.nodeName!="string"||typeof F.textContent!="string"||typeof F.removeChild!="function"||!(F.attributes instanceof u)||typeof F.removeAttribute!="function"||typeof F.setAttribute!="function"||typeof F.namespaceURI!="string"||typeof F.insertBefore!="function"||typeof F.hasChildNodes!="function")},Nt=function(F){return typeof a=="function"&&F instanceof a};function wt(ce,F,oe){Ss(ce,J=>{J.call(t,F,oe,Ie)})}const Wt=function(F){let oe=null;if(wt(D.beforeSanitizeElements,F,null),zt(F))return lt(F),!0;const J=xe(F.nodeName);if(wt(D.uponSanitizeElement,F,{tagName:J,allowedTags:L}),ne&&F.hasChildNodes()&&!Nt(F.firstElementChild)&&Yt(/<[/\w!]/g,F.innerHTML)&&Yt(/<[/\w!]/g,F.textContent)||F.nodeType===si.progressingInstruction||ne&&F.nodeType===si.comment&&Yt(/<[/\w]/g,F.data))return lt(F),!0;if(!L[J]||G[J]){if(!G[J]&&je(J)&&(U.tagNameCheck instanceof RegExp&&Yt(U.tagNameCheck,J)||U.tagNameCheck instanceof Function&&U.tagNameCheck(J)))return!1;if(et&&!ze[J]){const me=w(F)||F.parentNode,de=b(F)||F.childNodes;if(de&&me){const X=de.length;for(let ue=X-1;ue>=0;--ue){const be=g(de[ue],!0);be.__removalCount=(F.__removalCount||0)+1,me.insertBefore(be,v(F))}}}return lt(F),!0}return F instanceof l&&!yt(F)||(J==="noscript"||J==="noembed"||J==="noframes")&&Yt(/<\/no(script|embed|frames)/i,F.innerHTML)?(lt(F),!0):(K&&F.nodeType===si.text&&(oe=F.textContent,Ss([$,M,_],me=>{oe=ri(oe,me," ")}),F.textContent!==oe&&(ni(t.removed,{element:F.cloneNode()}),F.textContent=oe)),wt(D.afterSanitizeElements,F,null),!1)},Bt=function(F,oe,J){if(Ue&&(oe==="id"||oe==="name")&&(J in n||J in ke))return!1;if(!(Z&&!B[oe]&&Yt(N,oe))){if(!(W&&Yt(A,oe))){if(!H[oe]||B[oe]){if(!(je(F)&&(U.tagNameCheck instanceof RegExp&&Yt(U.tagNameCheck,F)||U.tagNameCheck instanceof Function&&U.tagNameCheck(F))&&(U.attributeNameCheck instanceof RegExp&&Yt(U.attributeNameCheck,oe)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(oe))||oe==="is"&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&Yt(U.tagNameCheck,J)||U.tagNameCheck instanceof Function&&U.tagNameCheck(J))))return!1}else if(!qe[oe]){if(!Yt(O,ri(J,j,""))){if(!((oe==="src"||oe==="xlink:href"||oe==="href")&&F!=="script"&&yD(J,"data:")===0&&ft[F])){if(!(ie&&!Yt(I,ri(J,j,"")))){if(J)return!1}}}}}}return!0},je=function(F){return F!=="annotation-xml"&&jp(F,R)},Pe=function(F){wt(D.beforeSanitizeAttributes,F,null);const{attributes:oe}=F;if(!oe||zt(F))return;const J={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let me=oe.length;for(;me--;){const de=oe[me],{name:X,namespaceURI:ue,value:be}=de,Ae=xe(X),ct=be;let ht=X==="value"?ct:vD(ct);if(J.attrName=Ae,J.attrValue=ht,J.keepAttr=!0,J.forceKeepAttr=void 0,wt(D.uponSanitizeAttribute,F,J),ht=J.attrValue,Ve&&(Ae==="id"||Ae==="name")&&(vt(X,F),ht=Ge+ht),ne&&Yt(/((--!?|])>)|<\/(style|title)/i,ht)){vt(X,F);continue}if(J.forceKeepAttr)continue;if(!J.keepAttr){vt(X,F);continue}if(!se&&Yt(/\/>/i,ht)){vt(X,F);continue}K&&Ss([$,M,_],nt=>{ht=ri(ht,nt," ")});const Gt=xe(F.nodeName);if(!Bt(Gt,Ae,ht)){vt(X,F);continue}if(S&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!ue)switch(h.getAttributeType(Gt,Ae)){case"TrustedHTML":{ht=S.createHTML(ht);break}case"TrustedScriptURL":{ht=S.createScriptURL(ht);break}}if(ht!==ct)try{ue?F.setAttributeNS(ue,X,ht):F.setAttribute(X,ht),zt(F)?lt(F):Np(t.removed)}catch{vt(X,F)}}wt(D.afterSanitizeAttributes,F,null)},_e=function ce(F){let oe=null;const J=Ft(F);for(wt(D.beforeSanitizeShadowDOM,F,null);oe=J.nextNode();)wt(D.uponSanitizeShadowNode,oe,null),Wt(oe),Pe(oe),oe.content instanceof i&&ce(oe.content);wt(D.afterSanitizeShadowDOM,F,null)};return t.sanitize=function(ce){let F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},oe=null,J=null,me=null,de=null;if(kt=!ce,kt&&(ce="<!-->"),typeof ce!="string"&&!Nt(ce))if(typeof ce.toString=="function"){if(ce=ce.toString(),typeof ce!="string")throw oi("dirty is not a string, aborting")}else throw oi("toString is not a function");if(!t.isSupported)return ce;if(re||$e(F),t.removed=[],typeof ce=="string"&&(st=!1),st){if(ce.nodeName){const be=xe(ce.nodeName);if(!L[be]||G[be])throw oi("root node is forbidden and cannot be sanitized in-place")}}else if(ce instanceof a)oe=Lt("<!---->"),J=oe.ownerDocument.importNode(ce,!0),J.nodeType===si.element&&J.nodeName==="BODY"||J.nodeName==="HTML"?oe=J:oe.appendChild(J);else{if(!pe&&!K&&!q&&ce.indexOf("<")===-1)return S&&Te?S.createHTML(ce):ce;if(oe=Lt(ce),!oe)return pe?null:Te?E:""}oe&&te&&lt(oe.firstChild);const X=Ft(st?ce:oe);for(;me=X.nextNode();)Wt(me),Pe(me),me.content instanceof i&&_e(me.content);if(st)return ce;if(pe){if(ee)for(de=T.call(oe.ownerDocument);oe.firstChild;)de.appendChild(oe.firstChild);else de=oe;return(H.shadowroot||H.shadowrootmode)&&(de=z.call(r,de,!0)),de}let ue=q?oe.outerHTML:oe.innerHTML;return q&&L["!doctype"]&&oe.ownerDocument&&oe.ownerDocument.doctype&&oe.ownerDocument.doctype.name&&Yt(av,oe.ownerDocument.doctype.name)&&(ue="<!DOCTYPE "+oe.ownerDocument.doctype.name+`>
395
+ `+ue),K&&Ss([$,M,_],be=>{ue=ri(ue,be," ")}),S&&Te?S.createHTML(ue):ue},t.setConfig=function(){let ce=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};$e(ce),re=!0},t.clearConfig=function(){Ie=null,re=!1},t.isValidAttribute=function(ce,F,oe){Ie||$e({});const J=xe(ce),me=xe(F);return Bt(J,me,oe)},t.addHook=function(ce,F){typeof F=="function"&&ni(D[ce],F)},t.removeHook=function(ce,F){if(F!==void 0){const oe=gD(D[ce],F);return oe===-1?void 0:xD(D[ce],oe,1)[0]}return Np(D[ce])},t.removeHooks=function(ce){D[ce]=[]},t.removeAllHooks=function(){D=Op()},t}var cv=lv();const PD=({content:e,setRenderError:t})=>{const[n,r]=m.useState(""),o=m.useMemo(()=>cv.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return m.useEffect(()=>{r(`<!DOCTYPE html>
396
+ <html>
397
+ <head>
398
+ <meta charset="utf-8">
399
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
400
+ <title>Mermaid Preview</title>
401
+ <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"><\/script>
402
+ <script src="https://cdn.jsdelivr.net/npm/panzoom@9.4.0/dist/panzoom.min.js"><\/script>
403
+ <script>
404
+ document.addEventListener('DOMContentLoaded', function() {
405
+ try {
406
+ mermaid.initialize({
407
+ startOnLoad: true,
408
+ theme: 'default',
409
+ fontFamily: 'arial, sans-serif',
410
+ logLevel: 'error',
411
+ securityLevel: 'strict'
412
+ });
413
+
414
+ // Initialize panzoom after Mermaid rendering
415
+ mermaid.run().then(() => {
416
+ const diagramContainer = document.getElementById('diagram-container');
417
+ if (diagramContainer) {
418
+ const pz = panzoom(diagramContainer, {
419
+ maxZoom: 10,
420
+ minZoom: 0.1,
421
+ smoothScroll: true,
422
+ bounds: true,
423
+ boundsPadding: 0.1
424
+ });
425
+ // Add zoom controls (old version had only reset)
426
+ const resetButton = document.getElementById('reset');
427
+ if (resetButton) {
428
+ resetButton.addEventListener('click', () => {
429
+ pz.moveTo(0, 0);
430
+ pz.zoomAbs(0, 0, 1);
431
+ });
432
+ }
433
+ }
434
+ }).catch(err => {
435
+ console.error("Mermaid rendering failed inside iframe:", err);
436
+ const mermaidDiv = document.querySelector('.mermaid');
437
+ if (mermaidDiv) mermaidDiv.innerText = "Error rendering diagram: " + err.message;
438
+ });
439
+
440
+ window.addEventListener('message', function(event) {
441
+ if (event.data && event.data.action === 'getMermaidSvg') {
442
+ const svgElement = document.querySelector('.mermaid svg');
443
+ if (svgElement) {
444
+ if (!svgElement.getAttribute('xmlns')) { // Ensure xmlns for standalone SVG
445
+ svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
446
+ }
447
+ const svgData = new XMLSerializer().serializeToString(svgElement);
448
+ window.parent.postMessage({
449
+ action: 'downloadSvg',
450
+ svgData: svgData,
451
+ filename: event.data.filename || 'mermaid-diagram.svg'
452
+ }, '*');
453
+ } else {
454
+ console.error('SVG element not found for download inside iframe.');
455
+ }
456
+ }
457
+ });
458
+ } catch (e) {
459
+ console.error("Error initializing Mermaid or Panzoom inside iframe:", e);
460
+ const mermaidDiv = document.querySelector('.mermaid');
461
+ if (mermaidDiv) mermaidDiv.innerText = "Failed to initialize diagram viewer: " + e.message;
462
+ }
463
+ });
464
+ <\/script>
465
+ <style>
466
+ /* Styles from old code */
467
+ html, body {
468
+ height: 100%;
469
+ margin: 0;
470
+ padding: 0;
471
+ overflow: hidden;
472
+ font-family: Arial, sans-serif; /* Old font */
473
+ }
474
+ .container {
475
+ display: flex;
476
+ flex-direction: column;
477
+ height: 100vh;
478
+ overflow: hidden;
479
+ }
480
+ .diagram-wrapper {
481
+ flex: 1;
482
+ overflow: hidden;
483
+ position: relative;
484
+ display: flex;
485
+ justify-content: center;
486
+ align-items: center;
487
+ background-color: #f9f9f9;
488
+ }
489
+ #diagram-container {
490
+ transform-origin: 0 0;
491
+ cursor: grab;
492
+ box-shadow: 0 0 10px rgba(0,0,0,0.1);
493
+ background-color: white;
494
+ padding: 20px;
495
+ border-radius: 5px;
496
+ /* Ensure diagram container can hold the content */
497
+ width: auto; /* Adjust as needed, or let content define it */
498
+ height: auto;
499
+ max-width: 100%;
500
+ max-height: 100%;
501
+ }
502
+ #diagram-container:active {
503
+ cursor: grabbing;
504
+ }
505
+ .mermaid {
506
+ display: flex; /* Helps in centering if SVG is smaller */
507
+ justify-content: center;
508
+ align-items: center;
509
+ /* width: 100%; Ensures mermaid div takes space, SVG might scale within it */
510
+ /* height: 100%; */
511
+ }
512
+ .mermaid svg {
513
+ max-width: 100%; /* Ensure SVG scales down if too large */
514
+ max-height: 100%;
515
+ }
516
+ .controls{
517
+ position: fixed;
518
+ bottom: 20px;
519
+ right: 20px;
520
+ z-index: 1000;
521
+ display: flex;
522
+ gap: 5px;
523
+ }
524
+ .control-btn {
525
+ width: 40px;
526
+ height: 40px;
527
+ border-radius: 50%;
528
+ border: none;
529
+ background-color: white;
530
+ box-shadow: 0 2px 5px rgba(0,0,0,0.2);
531
+ cursor: pointer;
532
+ font-size: 18px;
533
+ display: flex;
534
+ align-items: center;
535
+ justify-content: center;
536
+ }
537
+ .control-btn:hover {
538
+ background-color: #f0f0f0;
539
+ }
540
+ .instructions {
541
+ position: fixed;
542
+ top: 10px;
543
+ left: 10px;
544
+ background-color: rgba(255,255,255,0.8);
545
+ padding: 5px 10px;
546
+ border-radius: 4px;
547
+ font-size: 12px;
548
+ color: #666;
549
+ }
550
+ </style>
551
+ </head>
552
+ <body>
553
+ <div class="container">
554
+ <div class="diagram-wrapper">
555
+ <div id="diagram-container">
556
+ <div class="mermaid">
557
+ ${o}
558
+ </div>
559
+ </div>
560
+ </div>
561
+ <div class="instructions">
562
+ Drag to pan and scroll to zoom
563
+ </div>
564
+ <div class="controls">
565
+ <button id="reset" class="control-btn" title="Reset View">↺</button>
566
+ </div>
567
+ </div>
568
+ </body>
569
+ </html>`)},[o]),d.jsx("div",{className:"bg-background h-full max-w-[100vw] overflow-hidden border",children:d.jsx("iframe",{srcDoc:n,title:"Mermaid Diagram Preview",sandbox:"allow-scripts allow-same-origin allow-downloads",className:"h-full w-full border-none",onError:()=>t("Failed to load Mermaid content."),onLoad:()=>t(null)})})};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function uv(e){return typeof e>"u"||e===null}function DD(e){return typeof e=="object"&&e!==null}function OD(e){return Array.isArray(e)?e:uv(e)?[]:[e]}function LD(e,t){var n,r,o,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)o=i[n],e[o]=t[o];return e}function $D(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function FD(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var zD=uv,BD=DD,HD=OD,VD=$D,UD=FD,WD=LD,It={isNothing:zD,isObject:BD,toArray:HD,repeat:VD,isNegativeZero:UD,extend:WD};function dv(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
570
+
571
+ `+e.mark.snippet),r+" "+n):r}function Hi(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=dv(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Hi.prototype=Object.create(Error.prototype);Hi.prototype.constructor=Hi;Hi.prototype.toString=function(t){return this.name+": "+dv(this,t)};var qt=Hi;function Ul(e,t,n,r,o){var i="",s="",a=Math.floor(o/2)-1;return r-t>a&&(i=" ... ",t=r-a+i.length),n-r>a&&(s=" ...",n=r+a-s.length),{str:i+e.slice(t,n).replace(/\t/g,"→")+s,pos:r-t+i.length}}function Wl(e,t){return It.repeat(" ",t-e.length)+e}function GD(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],i,s=-1;i=n.exec(e.buffer);)o.push(i.index),r.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=r.length-2);s<0&&(s=r.length-1);var a="",l,c,u=Math.min(e.line+t.linesAfter,o.length).toString().length,f=t.maxLength-(t.indent+u+3);for(l=1;l<=t.linesBefore&&!(s-l<0);l++)c=Ul(e.buffer,r[s-l],o[s-l],e.position-(r[s]-r[s-l]),f),a=It.repeat(" ",t.indent)+Wl((e.line-l+1).toString(),u)+" | "+c.str+`
572
+ `+a;for(c=Ul(e.buffer,r[s],o[s],e.position,f),a+=It.repeat(" ",t.indent)+Wl((e.line+1).toString(),u)+" | "+c.str+`
573
+ `,a+=It.repeat("-",t.indent+u+3+c.pos)+`^
574
+ `,l=1;l<=t.linesAfter&&!(s+l>=o.length);l++)c=Ul(e.buffer,r[s+l],o[s+l],e.position-(r[s]-r[s+l]),f),a+=It.repeat(" ",t.indent)+Wl((e.line+l+1).toString(),u)+" | "+c.str+`
575
+ `;return a.replace(/\n$/,"")}var YD=GD,qD=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],KD=["scalar","sequence","mapping"];function XD(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function ZD(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(qD.indexOf(n)===-1)throw new qt('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=XD(t.styleAliases||null),KD.indexOf(this.kind)===-1)throw new qt('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var $t=ZD;function Lp(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(i,s){i.tag===r.tag&&i.kind===r.kind&&i.multi===r.multi&&(o=s)}),n[o]=r}),n}function QD(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function Dc(e){return this.extend(e)}Dc.prototype.extend=function(t){var n=[],r=[];if(t instanceof $t)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new qt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof $t))throw new qt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new qt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new qt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(i){if(!(i instanceof $t))throw new qt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(Dc.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=Lp(o,"implicit"),o.compiledExplicit=Lp(o,"explicit"),o.compiledTypeMap=QD(o.compiledImplicit,o.compiledExplicit),o};var fv=Dc,pv=new $t("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),hv=new $t("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),mv=new $t("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),gv=new fv({explicit:[pv,hv,mv]});function JD(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function eO(){return null}function tO(e){return e===null}var xv=new $t("tag:yaml.org,2002:null",{kind:"scalar",resolve:JD,construct:eO,predicate:tO,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function nO(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function rO(e){return e==="true"||e==="True"||e==="TRUE"}function oO(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var yv=new $t("tag:yaml.org,2002:bool",{kind:"scalar",resolve:nO,construct:rO,predicate:oO,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function iO(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function sO(e){return 48<=e&&e<=55}function aO(e){return 48<=e&&e<=57}function lO(e){if(e===null)return!1;var t=e.length,n=0,r=!1,o;if(!t)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===t)return!0;if(o=e[++n],o==="b"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;r=!0}return r&&o!=="_"}if(o==="x"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!iO(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!sO(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!aO(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function cO(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function uO(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!It.isNegativeZero(e)}var vv=new $t("tag:yaml.org,2002:int",{kind:"scalar",resolve:lO,construct:cO,predicate:uO,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),dO=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function fO(e){return!(e===null||!dO.test(e)||e[e.length-1]==="_")}function pO(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var hO=/^[-+]?[0-9]+e/;function mO(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(It.isNegativeZero(e))return"-0.0";return n=e.toString(10),hO.test(n)?n.replace("e",".e"):n}function gO(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||It.isNegativeZero(e))}var wv=new $t("tag:yaml.org,2002:float",{kind:"scalar",resolve:fO,construct:pO,predicate:gO,represent:mO,defaultStyle:"lowercase"}),bv=gv.extend({implicit:[xv,yv,vv,wv]}),Ev=bv,Sv=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),kv=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function xO(e){return e===null?!1:Sv.exec(e)!==null||kv.exec(e)!==null}function yO(e){var t,n,r,o,i,s,a,l=0,c=null,u,f,p;if(t=Sv.exec(e),t===null&&(t=kv.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(i=+t[4],s=+t[5],a=+t[6],t[7]){for(l=t[7].slice(0,3);l.length<3;)l+="0";l=+l}return t[9]&&(u=+t[10],f=+(t[11]||0),c=(u*60+f)*6e4,t[9]==="-"&&(c=-c)),p=new Date(Date.UTC(n,r,o,i,s,a,l)),c&&p.setTime(p.getTime()-c),p}function vO(e){return e.toISOString()}var Cv=new $t("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:xO,construct:yO,instanceOf:Date,represent:vO});function wO(e){return e==="<<"||e===null}var _v=new $t("tag:yaml.org,2002:merge",{kind:"scalar",resolve:wO}),Zu=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
576
+ \r`;function bO(e){if(e===null)return!1;var t,n,r=0,o=e.length,i=Zu;for(n=0;n<o;n++)if(t=i.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function EO(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,i=Zu,s=0,a=[];for(t=0;t<o;t++)t%4===0&&t&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|i.indexOf(r.charAt(t));return n=o%4*6,n===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):n===18?(a.push(s>>10&255),a.push(s>>2&255)):n===12&&a.push(s>>4&255),new Uint8Array(a)}function SO(e){var t="",n=0,r,o,i=e.length,s=Zu;for(r=0;r<i;r++)r%3===0&&r&&(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]),n=(n<<8)+e[r];return o=i%3,o===0?(t+=s[n>>18&63],t+=s[n>>12&63],t+=s[n>>6&63],t+=s[n&63]):o===2?(t+=s[n>>10&63],t+=s[n>>4&63],t+=s[n<<2&63],t+=s[64]):o===1&&(t+=s[n>>2&63],t+=s[n<<4&63],t+=s[64],t+=s[64]),t}function kO(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Tv=new $t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:bO,construct:EO,predicate:kO,represent:SO}),CO=Object.prototype.hasOwnProperty,_O=Object.prototype.toString;function TO(e){if(e===null)return!0;var t=[],n,r,o,i,s,a=e;for(n=0,r=a.length;n<r;n+=1){if(o=a[n],s=!1,_O.call(o)!=="[object Object]")return!1;for(i in o)if(CO.call(o,i))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function AO(e){return e!==null?e:[]}var Av=new $t("tag:yaml.org,2002:omap",{kind:"sequence",resolve:TO,construct:AO}),NO=Object.prototype.toString;function jO(e){if(e===null)return!0;var t,n,r,o,i,s=e;for(i=new Array(s.length),t=0,n=s.length;t<n;t+=1){if(r=s[t],NO.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;i[t]=[o[0],r[o[0]]]}return!0}function IO(e){if(e===null)return[];var t,n,r,o,i,s=e;for(i=new Array(s.length),t=0,n=s.length;t<n;t+=1)r=s[t],o=Object.keys(r),i[t]=[o[0],r[o[0]]];return i}var Nv=new $t("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:jO,construct:IO}),RO=Object.prototype.hasOwnProperty;function MO(e){if(e===null)return!0;var t,n=e;for(t in n)if(RO.call(n,t)&&n[t]!==null)return!1;return!0}function PO(e){return e!==null?e:{}}var jv=new $t("tag:yaml.org,2002:set",{kind:"mapping",resolve:MO,construct:PO}),Qu=Ev.extend({implicit:[Cv,_v],explicit:[Tv,Av,Nv,jv]}),xr=Object.prototype.hasOwnProperty,fa=1,Iv=2,Rv=3,pa=4,Gl=1,DO=2,$p=3,OO=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,LO=/[\x85\u2028\u2029]/,$O=/[,\[\]\{\}]/,Mv=/^(?:!|!!|![a-z\-]+!)$/i,Pv=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Fp(e){return Object.prototype.toString.call(e)}function Mn(e){return e===10||e===13}function Lr(e){return e===9||e===32}function Jt(e){return e===9||e===32||e===10||e===13}function xo(e){return e===44||e===91||e===93||e===123||e===125}function FO(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function zO(e){return e===120?2:e===117?4:e===85?8:0}function BO(e){return 48<=e&&e<=57?e-48:-1}function zp(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
577
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function HO(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Dv=new Array(256),Ov=new Array(256);for(var so=0;so<256;so++)Dv[so]=zp(so)?1:0,Ov[so]=zp(so);function VO(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Qu,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Lv(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=YD(n),new qt(t,n)}function Ce(e,t){throw Lv(e,t)}function ha(e,t){e.onWarning&&e.onWarning.call(null,Lv(e,t))}var Bp={YAML:function(t,n,r){var o,i,s;t.version!==null&&Ce(t,"duplication of %YAML directive"),r.length!==1&&Ce(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&Ce(t,"ill-formed argument of the YAML directive"),i=parseInt(o[1],10),s=parseInt(o[2],10),i!==1&&Ce(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&ha(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,i;r.length!==2&&Ce(t,"TAG directive accepts exactly two arguments"),o=r[0],i=r[1],Mv.test(o)||Ce(t,"ill-formed tag handle (first argument) of the TAG directive"),xr.call(t.tagMap,o)&&Ce(t,'there is a previously declared suffix for "'+o+'" tag handle'),Pv.test(i)||Ce(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{Ce(t,"tag prefix is malformed: "+i)}t.tagMap[o]=i}};function dr(e,t,n,r){var o,i,s,a;if(t<n){if(a=e.input.slice(t,n),r)for(o=0,i=a.length;o<i;o+=1)s=a.charCodeAt(o),s===9||32<=s&&s<=1114111||Ce(e,"expected valid JSON character");else OO.test(a)&&Ce(e,"the stream contains non-printable characters");e.result+=a}}function Hp(e,t,n,r){var o,i,s,a;for(It.isObject(n)||Ce(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),s=0,a=o.length;s<a;s+=1)i=o[s],xr.call(t,i)||(t[i]=n[i],r[i]=!0)}function yo(e,t,n,r,o,i,s,a,l){var c,u;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),c=0,u=o.length;c<u;c+=1)Array.isArray(o[c])&&Ce(e,"nested arrays are not supported inside keys"),typeof o=="object"&&Fp(o[c])==="[object Object]"&&(o[c]="[object Object]");if(typeof o=="object"&&Fp(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(c=0,u=i.length;c<u;c+=1)Hp(e,t,i[c],n);else Hp(e,t,i,n);else!e.json&&!xr.call(n,o)&&xr.call(t,o)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=l||e.position,Ce(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:i}):t[o]=i,delete n[o];return t}function Ju(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Ce(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Tt(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Lr(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(Mn(o))for(Ju(e),o=e.input.charCodeAt(e.position),r++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&ha(e,"deficient indentation"),r}function rl(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||Jt(n)))}function ed(e,t){t===1?e.result+=" ":t>1&&(e.result+=It.repeat(`
578
+ `,t-1))}function UO(e,t,n){var r,o,i,s,a,l,c,u,f=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),Jt(h)||xo(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(o=e.input.charCodeAt(e.position+1),Jt(o)||n&&xo(o)))return!1;for(e.kind="scalar",e.result="",i=s=e.position,a=!1;h!==0;){if(h===58){if(o=e.input.charCodeAt(e.position+1),Jt(o)||n&&xo(o))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),Jt(r))break}else{if(e.position===e.lineStart&&rl(e)||n&&xo(h))break;if(Mn(h))if(l=e.line,c=e.lineStart,u=e.lineIndent,Tt(e,!1,-1),e.lineIndent>=t){a=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=l,e.lineStart=c,e.lineIndent=u;break}}a&&(dr(e,i,s,!1),ed(e,e.line-l),i=s=e.position,a=!1),Lr(h)||(s=e.position+1),h=e.input.charCodeAt(++e.position)}return dr(e,i,s,!1),e.result?!0:(e.kind=f,e.result=p,!1)}function WO(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(dr(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,o=e.position;else return!0;else Mn(n)?(dr(e,r,o,!0),ed(e,Tt(e,!1,t)),r=o=e.position):e.position===e.lineStart&&rl(e)?Ce(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);Ce(e,"unexpected end of the stream within a single quoted scalar")}function GO(e,t){var n,r,o,i,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return dr(e,n,e.position,!0),e.position++,!0;if(a===92){if(dr(e,n,e.position,!0),a=e.input.charCodeAt(++e.position),Mn(a))Tt(e,!1,t);else if(a<256&&Dv[a])e.result+=Ov[a],e.position++;else if((s=zO(a))>0){for(o=s,i=0;o>0;o--)a=e.input.charCodeAt(++e.position),(s=FO(a))>=0?i=(i<<4)+s:Ce(e,"expected hexadecimal character");e.result+=HO(i),e.position++}else Ce(e,"unknown escape sequence");n=r=e.position}else Mn(a)?(dr(e,n,r,!0),ed(e,Tt(e,!1,t)),n=r=e.position):e.position===e.lineStart&&rl(e)?Ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Ce(e,"unexpected end of the stream within a double quoted scalar")}function YO(e,t){var n=!0,r,o,i,s=e.tag,a,l=e.anchor,c,u,f,p,h,x=Object.create(null),g,y,v,b;if(b=e.input.charCodeAt(e.position),b===91)u=93,h=!1,a=[];else if(b===123)u=125,h=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),b=e.input.charCodeAt(++e.position);b!==0;){if(Tt(e,!0,t),b=e.input.charCodeAt(e.position),b===u)return e.position++,e.tag=s,e.anchor=l,e.kind=h?"mapping":"sequence",e.result=a,!0;n?b===44&&Ce(e,"expected the node content, but found ','"):Ce(e,"missed comma between flow collection entries"),y=g=v=null,f=p=!1,b===63&&(c=e.input.charCodeAt(e.position+1),Jt(c)&&(f=p=!0,e.position++,Tt(e,!0,t))),r=e.line,o=e.lineStart,i=e.position,Fo(e,t,fa,!1,!0),y=e.tag,g=e.result,Tt(e,!0,t),b=e.input.charCodeAt(e.position),(p||e.line===r)&&b===58&&(f=!0,b=e.input.charCodeAt(++e.position),Tt(e,!0,t),Fo(e,t,fa,!1,!0),v=e.result),h?yo(e,a,x,y,g,v,r,o,i):f?a.push(yo(e,null,x,y,g,v,r,o,i)):a.push(g),Tt(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}Ce(e,"unexpected end of the stream within a flow collection")}function qO(e,t){var n,r,o=Gl,i=!1,s=!1,a=t,l=0,c=!1,u,f;if(f=e.input.charCodeAt(e.position),f===124)r=!1;else if(f===62)r=!0;else return!1;for(e.kind="scalar",e.result="";f!==0;)if(f=e.input.charCodeAt(++e.position),f===43||f===45)Gl===o?o=f===43?$p:DO:Ce(e,"repeat of a chomping mode identifier");else if((u=BO(f))>=0)u===0?Ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?Ce(e,"repeat of an indentation width identifier"):(a=t+u-1,s=!0);else break;if(Lr(f)){do f=e.input.charCodeAt(++e.position);while(Lr(f));if(f===35)do f=e.input.charCodeAt(++e.position);while(!Mn(f)&&f!==0)}for(;f!==0;){for(Ju(e),e.lineIndent=0,f=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&f===32;)e.lineIndent++,f=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),Mn(f)){l++;continue}if(e.lineIndent<a){o===$p?e.result+=It.repeat(`
579
+ `,i?1+l:l):o===Gl&&i&&(e.result+=`
580
+ `);break}for(r?Lr(f)?(c=!0,e.result+=It.repeat(`
581
+ `,i?1+l:l)):c?(c=!1,e.result+=It.repeat(`
582
+ `,l+1)):l===0?i&&(e.result+=" "):e.result+=It.repeat(`
583
+ `,l):e.result+=It.repeat(`
584
+ `,i?1+l:l),i=!0,s=!0,l=0,n=e.position;!Mn(f)&&f!==0;)f=e.input.charCodeAt(++e.position);dr(e,n,e.position,!1)}return!0}function Vp(e,t){var n,r=e.tag,o=e.anchor,i=[],s,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ce(e,"tab characters must not be used in indentation")),!(l!==45||(s=e.input.charCodeAt(e.position+1),!Jt(s))));){if(a=!0,e.position++,Tt(e,!0,-1)&&e.lineIndent<=t){i.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,Fo(e,t,Rv,!1,!0),i.push(e.result),Tt(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)Ce(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=i,!0):!1}function KO(e,t,n){var r,o,i,s,a,l,c=e.tag,u=e.anchor,f={},p=Object.create(null),h=null,x=null,g=null,y=!1,v=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),b=e.input.charCodeAt(e.position);b!==0;){if(!y&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ce(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(b===63||b===58)&&Jt(r))b===63?(y&&(yo(e,f,p,h,x,null,s,a,l),h=x=g=null),v=!0,y=!0,o=!0):y?(y=!1,o=!0):Ce(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(s=e.line,a=e.lineStart,l=e.position,!Fo(e,n,Iv,!1,!0))break;if(e.line===i){for(b=e.input.charCodeAt(e.position);Lr(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),Jt(b)||Ce(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(yo(e,f,p,h,x,null,s,a,l),h=x=g=null),v=!0,y=!1,o=!1,h=e.tag,x=e.result;else if(v)Ce(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(v)Ce(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===i||e.lineIndent>t)&&(y&&(s=e.line,a=e.lineStart,l=e.position),Fo(e,t,pa,!0,o)&&(y?x=e.result:g=e.result),y||(yo(e,f,p,h,x,g,s,a,l),h=x=g=null),Tt(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&b!==0)Ce(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return y&&yo(e,f,p,h,x,null,s,a,l),v&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=f),v}function XO(e){var t,n=!1,r=!1,o,i,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&Ce(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(n=!0,s=e.input.charCodeAt(++e.position)):s===33?(r=!0,o="!!",s=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(i=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):Ce(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!Jt(s);)s===33&&(r?Ce(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),Mv.test(o)||Ce(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),$O.test(i)&&Ce(e,"tag suffix cannot contain flow indicator characters")}i&&!Pv.test(i)&&Ce(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{Ce(e,"tag name is malformed: "+i)}return n?e.tag=i:xr.call(e.tagMap,o)?e.tag=e.tagMap[o]+i:o==="!"?e.tag="!"+i:o==="!!"?e.tag="tag:yaml.org,2002:"+i:Ce(e,'undeclared tag handle "'+o+'"'),!0}function ZO(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Ce(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Jt(n)&&!xo(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ce(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function QO(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Jt(r)&&!xo(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),xr.call(e.anchorMap,n)||Ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Tt(e,!0,-1),!0}function Fo(e,t,n,r,o){var i,s,a,l=1,c=!1,u=!1,f,p,h,x,g,y;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=s=a=pa===n||Rv===n,r&&Tt(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;XO(e)||ZO(e);)Tt(e,!0,-1)?(c=!0,a=i,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=c||o),(l===1||pa===n)&&(fa===n||Iv===n?g=t:g=t+1,y=e.position-e.lineStart,l===1?a&&(Vp(e,y)||KO(e,y,g))||YO(e,g)?u=!0:(s&&qO(e,g)||WO(e,g)||GO(e,g)?u=!0:QO(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&Ce(e,"alias node should not have any properties")):UO(e,g,fa===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=a&&Vp(e,y))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ce(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,p=e.implicitTypes.length;f<p;f+=1)if(x=e.implicitTypes[f],x.resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(xr.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,h=e.typeMap.multi[e.kind||"fallback"],f=0,p=h.length;f<p;f+=1)if(e.tag.slice(0,h[f].tag.length)===h[f].tag){x=h[f];break}x||Ce(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&Ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result,e.tag)?(e.result=x.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function JO(e){var t=e.position,n,r,o,i=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(Tt(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(i=!0,s=e.input.charCodeAt(++e.position),n=e.position;s!==0&&!Jt(s);)s=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&Ce(e,"directive name must not be less than one character in length");s!==0;){for(;Lr(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Mn(s));break}if(Mn(s))break;for(n=e.position;s!==0&&!Jt(s);)s=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}s!==0&&Ju(e),xr.call(Bp,r)?Bp[r](e,r,o):ha(e,'unknown document directive "'+r+'"')}if(Tt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,Tt(e,!0,-1)):i&&Ce(e,"directives end mark is expected"),Fo(e,e.lineIndent-1,pa,!1,!0),Tt(e,!0,-1),e.checkLineBreaks&&LO.test(e.input.slice(t,e.position))&&ha(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&rl(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Tt(e,!0,-1));return}if(e.position<e.length-1)Ce(e,"end of the stream or a document separator is expected");else return}function $v(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
585
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new VO(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Ce(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)JO(n);return n.documents}function eL(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=$v(e,n);if(typeof t!="function")return r;for(var o=0,i=r.length;o<i;o+=1)t(r[o])}function tL(e,t){var n=$v(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new qt("expected a single document in the stream, but found more")}}var nL=eL,rL=tL,Fv={loadAll:nL,load:rL},zv=Object.prototype.toString,Bv=Object.prototype.hasOwnProperty,td=65279,oL=9,Vi=10,iL=13,sL=32,aL=33,lL=34,Oc=35,cL=37,uL=38,dL=39,fL=42,Hv=44,pL=45,ma=58,hL=61,mL=62,gL=63,xL=64,Vv=91,Uv=93,yL=96,Wv=123,vL=124,Gv=125,Ut={};Ut[0]="\\0";Ut[7]="\\a";Ut[8]="\\b";Ut[9]="\\t";Ut[10]="\\n";Ut[11]="\\v";Ut[12]="\\f";Ut[13]="\\r";Ut[27]="\\e";Ut[34]='\\"';Ut[92]="\\\\";Ut[133]="\\N";Ut[160]="\\_";Ut[8232]="\\L";Ut[8233]="\\P";var wL=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],bL=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function EL(e,t){var n,r,o,i,s,a,l;if(t===null)return{};for(n={},r=Object.keys(t),o=0,i=r.length;o<i;o+=1)s=r[o],a=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),l=e.compiledTypeMap.fallback[s],l&&Bv.call(l.styleAliases,a)&&(a=l.styleAliases[a]),n[s]=a;return n}function SL(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new qt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+It.repeat("0",r-t.length)+t}var kL=1,Ui=2;function CL(e){this.schema=e.schema||Qu,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=It.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=EL(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?Ui:kL,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Up(e,t){for(var n=It.repeat(" ",t),r=0,o=-1,i="",s,a=e.length;r<a;)o=e.indexOf(`
586
+ `,r),o===-1?(s=e.slice(r),r=a):(s=e.slice(r,o+1),r=o+1),s.length&&s!==`
587
+ `&&(i+=n),i+=s;return i}function Lc(e,t){return`
588
+ `+It.repeat(" ",e.indent*t)}function _L(e,t){var n,r,o;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(o=e.implicitTypes[n],o.resolve(t))return!0;return!1}function ga(e){return e===sL||e===oL}function Wi(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==td||65536<=e&&e<=1114111}function Wp(e){return Wi(e)&&e!==td&&e!==iL&&e!==Vi}function Gp(e,t,n){var r=Wp(e),o=r&&!ga(e);return(n?r:r&&e!==Hv&&e!==Vv&&e!==Uv&&e!==Wv&&e!==Gv)&&e!==Oc&&!(t===ma&&!o)||Wp(t)&&!ga(t)&&e===Oc||t===ma&&o}function TL(e){return Wi(e)&&e!==td&&!ga(e)&&e!==pL&&e!==gL&&e!==ma&&e!==Hv&&e!==Vv&&e!==Uv&&e!==Wv&&e!==Gv&&e!==Oc&&e!==uL&&e!==fL&&e!==aL&&e!==vL&&e!==hL&&e!==mL&&e!==dL&&e!==lL&&e!==cL&&e!==xL&&e!==yL}function AL(e){return!ga(e)&&e!==ma}function Ei(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function Yv(e){var t=/^\n* /;return t.test(e)}var qv=1,$c=2,Kv=3,Xv=4,fo=5;function NL(e,t,n,r,o,i,s,a){var l,c=0,u=null,f=!1,p=!1,h=r!==-1,x=-1,g=TL(Ei(e,0))&&AL(Ei(e,e.length-1));if(t||s)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Ei(e,l),!Wi(c))return fo;g=g&&Gp(c,u,a),u=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=Ei(e,l),c===Vi)f=!0,h&&(p=p||l-x-1>r&&e[x+1]!==" ",x=l);else if(!Wi(c))return fo;g=g&&Gp(c,u,a),u=c}p=p||h&&l-x-1>r&&e[x+1]!==" "}return!f&&!p?g&&!s&&!o(e)?qv:i===Ui?fo:$c:n>9&&Yv(e)?fo:s?i===Ui?fo:$c:p?Xv:Kv}function jL(e,t,n,r,o){e.dump=function(){if(t.length===0)return e.quotingType===Ui?'""':"''";if(!e.noCompatMode&&(wL.indexOf(t)!==-1||bL.test(t)))return e.quotingType===Ui?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),a=r||e.flowLevel>-1&&n>=e.flowLevel;function l(c){return _L(e,c)}switch(NL(t,a,e.indent,s,l,e.quotingType,e.forceQuotes&&!r,o)){case qv:return t;case $c:return"'"+t.replace(/'/g,"''")+"'";case Kv:return"|"+Yp(t,e.indent)+qp(Up(t,i));case Xv:return">"+Yp(t,e.indent)+qp(Up(IL(t,s),i));case fo:return'"'+RL(t)+'"';default:throw new qt("impossible error: invalid scalar style")}}()}function Yp(e,t){var n=Yv(e)?String(t):"",r=e[e.length-1]===`
589
+ `,o=r&&(e[e.length-2]===`
590
+ `||e===`
591
+ `),i=o?"+":r?"":"-";return n+i+`
592
+ `}function qp(e){return e[e.length-1]===`
593
+ `?e.slice(0,-1):e}function IL(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var c=e.indexOf(`
594
+ `);return c=c!==-1?c:e.length,n.lastIndex=c,Kp(e.slice(0,c),t)}(),o=e[0]===`
595
+ `||e[0]===" ",i,s;s=n.exec(e);){var a=s[1],l=s[2];i=l[0]===" ",r+=a+(!o&&!i&&l!==""?`
596
+ `:"")+Kp(l,t),o=i}return r}function Kp(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,i,s=0,a=0,l="";r=n.exec(e);)a=r.index,a-o>t&&(i=s>o?s:a,l+=`
597
+ `+e.slice(o,i),o=i+1),s=a;return l+=`
598
+ `,e.length-o>t&&s>o?l+=e.slice(o,s)+`
599
+ `+e.slice(s+1):l+=e.slice(o),l.slice(1)}function RL(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=Ei(e,o),r=Ut[n],!r&&Wi(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||SL(n);return t}function ML(e,t,n){var r="",o=e.tag,i,s,a;for(i=0,s=n.length;i<s;i+=1)a=n[i],e.replacer&&(a=e.replacer.call(n,String(i),a)),(Xn(e,t,a,!1,!1)||typeof a>"u"&&Xn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function Xp(e,t,n,r){var o="",i=e.tag,s,a,l;for(s=0,a=n.length;s<a;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(Xn(e,t+1,l,!0,!0,!1,!0)||typeof l>"u"&&Xn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=Lc(e,t)),e.dump&&Vi===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=i,e.dump=o||"[]"}function PL(e,t,n){var r="",o=e.tag,i=Object.keys(n),s,a,l,c,u;for(s=0,a=i.length;s<a;s+=1)u="",r!==""&&(u+=", "),e.condenseFlow&&(u+='"'),l=i[s],c=n[l],e.replacer&&(c=e.replacer.call(n,l,c)),Xn(e,t,l,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Xn(e,t,c,!1,!1)&&(u+=e.dump,r+=u));e.tag=o,e.dump="{"+r+"}"}function DL(e,t,n,r){var o="",i=e.tag,s=Object.keys(n),a,l,c,u,f,p;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new qt("sortKeys must be a boolean or a function");for(a=0,l=s.length;a<l;a+=1)p="",(!r||o!=="")&&(p+=Lc(e,t)),c=s[a],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),Xn(e,t+1,c,!0,!0,!0)&&(f=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,f&&(e.dump&&Vi===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,f&&(p+=Lc(e,t)),Xn(e,t+1,u,!0,f)&&(e.dump&&Vi===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,o+=p));e.tag=i,e.dump=o||"{}"}function Zp(e,t,n){var r,o,i,s,a,l;for(o=n?e.explicitTypes:e.implicitTypes,i=0,s=o.length;i<s;i+=1)if(a=o[i],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(n?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(l=e.styleMap[a.tag]||a.defaultStyle,zv.call(a.represent)==="[object Function]")r=a.represent(t,l);else if(Bv.call(a.represent,l))r=a.represent[l](t,l);else throw new qt("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');e.dump=r}return!0}return!1}function Xn(e,t,n,r,o,i,s){e.tag=null,e.dump=n,Zp(e,n,!1)||Zp(e,n,!0);var a=zv.call(e.dump),l=r,c;r&&(r=e.flowLevel<0||e.flowLevel>t);var u=a==="[object Object]"||a==="[object Array]",f,p;if(u&&(f=e.duplicates.indexOf(n),p=f!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(o=!1),p&&e.usedDuplicates[f])e.dump="*ref_"+f;else{if(u&&p&&!e.usedDuplicates[f]&&(e.usedDuplicates[f]=!0),a==="[object Object]")r&&Object.keys(e.dump).length!==0?(DL(e,t,e.dump,o),p&&(e.dump="&ref_"+f+e.dump)):(PL(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?Xp(e,t-1,e.dump,o):Xp(e,t,e.dump,o),p&&(e.dump="&ref_"+f+e.dump)):(ML(e,t,e.dump),p&&(e.dump="&ref_"+f+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&jL(e,e.dump,t,i,l);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new qt("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function OL(e,t){var n=[],r=[],o,i;for(Fc(e,n,r),o=0,i=r.length;o<i;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(i)}function Fc(e,t,n){var r,o,i;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,i=e.length;o<i;o+=1)Fc(e[o],t,n);else for(r=Object.keys(e),o=0,i=r.length;o<i;o+=1)Fc(e[r[o]],t,n)}function LL(e,t){t=t||{};var n=new CL(t);n.noRefs||OL(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),Xn(n,0,r,!0,!0)?n.dump+`
600
+ `:""}var $L=LL,FL={dump:$L};function nd(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var zL=$t,BL=fv,HL=gv,VL=bv,UL=Ev,WL=Qu,GL=Fv.load,YL=Fv.loadAll,qL=FL.dump,KL=qt,XL={binary:Tv,float:wv,map:mv,null:xv,pairs:Nv,set:jv,timestamp:Cv,bool:yv,int:vv,merge:_v,omap:Av,seq:hv,str:pv},ZL=nd("safeLoad","load"),QL=nd("safeLoadAll","loadAll"),JL=nd("safeDump","dump"),e3={Type:zL,Schema:BL,FAILSAFE_SCHEMA:HL,JSON_SCHEMA:VL,CORE_SCHEMA:UL,DEFAULT_SCHEMA:WL,load:GL,loadAll:YL,dump:qL,YAMLException:KL,types:XL,safeLoad:ZL,safeLoadAll:QL,safeDump:JL};const t3=({content:e,rendererType:t,setRenderError:n})=>{const[r,o]=m.useState(!1);m.useEffect(()=>{n(null)},[e,n]);const[i,s]=m.useMemo(()=>{try{if(t==="yaml"){const a=e3.load(e);return[e,a]}else if(t==="json"){const a=JSON.parse(e);return[JSON.stringify(a,null,2),a]}throw new Error(`Unsupported renderer type: ${t}`)}catch(a){const l=t==="yaml"?"YAML":"JSON";console.error(`Error parsing ${l} for panel:`,a);const c={[`${l}_Parsing_Error`]:`The provided content is not valid ${l}.`,Details:a.message,Content_Snippet:e.substring(0,500)+(e.length>500?"...":"")};return n(`${l} parsing failed: ${a.message}`),[e,c]}},[e,t,n]);return d.jsx("div",{className:"flex min-h-0 max-w-[100vw] flex-col",children:d.jsxs("div",{className:"bg-background relative flex-1 overflow-auto",children:[d.jsx(tt,{variant:"default",onClick:()=>o(!r),className:"absolute top-4 right-4 z-10",title:r?"Show Structured View":"Show Raw Text",children:r?d.jsxs(d.Fragment,{children:[d.jsx(Dm,{className:"mr-1 h-3.5 w-3.5"})," Structured"]}):d.jsxs(d.Fragment,{children:[d.jsx(Pm,{className:"mr-1 h-3.5 w-3.5"})," Raw Text"]})}),r?d.jsx("div",{className:"p-4 border overflow-auto",children:d.jsx("pre",{className:"whitespace-pre-wrap",style:{overflowWrap:"anywhere"},children:i})}):d.jsx(Kc,{data:s,maxDepth:4,className:"p-2 rounded-none"})]})})},Zv=({content:e,rendererType:t,mime_type:n,setRenderError:r})=>{switch(t){case"csv":return d.jsx(cD,{content:e,setRenderError:r});case"mermaid":return d.jsx(PD,{content:e,setRenderError:r});case"html":return d.jsx(uD,{content:e,setRenderError:r});case"json":case"yaml":return d.jsx(t3,{content:e,rendererType:t,setRenderError:r});case"image":return d.jsx(dD,{content:e,mime_type:n,setRenderError:r});case"markdown":return d.jsx(fD,{content:e,setRenderError:r});case"audio":return d.jsx(aD,{content:e,mime_type:n,setRenderError:r});default:return d.jsx("div",{className:"p-4 overflow-auto",children:d.jsx("pre",{className:"whitespace-pre-wrap",style:{overflowWrap:"anywhere"},children:e})})}},n3=["png","jpeg","jpg","gif","webp","svg+xml","bmp","ico"],r3=["mp3","wav","ogg","aac","flac","m4a"];function o3(e){if(!e||typeof e!="string")return[];const t=[],n=new RegExp(`data:image/(${n3.join("|")});base64,([A-Za-z0-9+/=]+)`,"g");let r;for(;(r=n.exec(e))!==null;){const[o,i,s]=r;s&&s.length>10&&t.push({type:"image",content:s,mimeType:`image/${i}`,originalMatch:o})}return t}function i3(e){if(!e||typeof e!="string")return[];const t=[],n=new RegExp(`data:audio/(${r3.join("|")});base64,([A-Za-z0-9+/=]+)`,"g");let r;for(;(r=n.exec(e))!==null;){const[o,i,s]=r;s&&s.length>10&&t.push({type:"audio",content:s,mimeType:`audio/${i}`,originalMatch:o})}return t}function s3(e){if(!e||typeof e!="string")return[];const t=[],n=/<html[\s\S]*?<\/html>/gi;let r;for(;(r=n.exec(e))!==null;)t.push({type:"html",content:r[0].trim(),originalMatch:r[0]});return t}function a3(e){if(!e||typeof e!="string")return[];const t=[],n=/```mermaid\s*\n([\s\S]*?)```/gi;let r;for(;(r=n.exec(e))!==null;){const[o,i]=r;t.push({type:"mermaid",content:i.trim(),originalMatch:o})}return t}function l3(e){return!e||typeof e!="string"?[]:[...o3(e),...i3(e),...s3(e),...a3(e)]}const c3=({message:e})=>{var a;const[t,n]=m.useState(null);if(e.isStatusBubble)return null;if(e.isUser)return d.jsx("span",{children:e.text||""});const r=(a=e.text)==null?void 0:a.trim();if(!r)return null;if(e.isError)return d.jsxs("div",{className:"flex items-center",children:[d.jsx(hu,{className:"mr-2 self-start text-[var(--color-error-wMain)]"}),d.jsx(ko,{children:r})]});const o=l3(r);if(o.length===0)return d.jsx(ko,{children:r});let i=r;const s=[];return o.forEach((l,c)=>{i=i.replace(l.originalMatch,""),s.push(d.jsx("div",{className:"my-2 h-auto w-md max-w-md overflow-hidden",children:d.jsx(Zv,{content:l.content,rendererType:l.type,mime_type:l.mimeType,setRenderError:n})},`embedded-${c}`))}),d.jsxs("div",{children:[t&&d.jsx(fd,{variant:"error",message:"Error rendering preview"}),d.jsx(ko,{children:i}),s]})},Qv=({message:e,children:t,className:n})=>d.jsx("div",{className:`mt-1 space-y-1 ${e.isUser?"ml-auto":"mr-auto"} ${n}`,children:t}),u3=e=>e.uploadedFiles&&e.uploadedFiles.length>0?d.jsx(Qv,{message:e,className:"flex flex-wrap justify-end gap-1",children:e.uploadedFiles.map((t,n)=>{var r;return d.jsx(rv,{filename:t.name},`uploaded-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,d3=e=>e.files&&e.files.length>0?d.jsx(Qv,{message:e,children:e.files.map((t,n)=>{var r;return d.jsx(sD,{fileAttachment:t},`file-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,f3=(e,t,n)=>{var i;const{openSidePanelTab:r,setTaskIdInSidePanel:o}=t;if(e.isStatusBubble)return null;if(e.text){const s=e.isUser?"sent":"received",a=!e.isUser&&e.isComplete&&!!e.taskId&&n,l=()=>{e.taskId&&(o(e.taskId),r("workflow"))};return d.jsx(ix,{variant:s,children:d.jsxs(sx,{variant:s,children:[d.jsx(c3,{message:e}),a&&d.jsx("div",{className:"mt-3",children:d.jsx(Hm,{onClick:l})})]})},(i=e.metadata)==null?void 0:i.messageId)}return null},p3=({message:e,isLastWithTaskId:t})=>{const n=Ot();return e?d.jsxs(d.Fragment,{children:[f3(e,n,t),u3(e),d3(e)]}):null},h3=()=>{const e=Kg();return d.jsx("div",{className:"flex h-full flex-col",children:d.jsxs("div",{className:"flex-1 overflow-y-auto px-4",children:[d.jsxs("div",{className:"bg-accent/50 hover:bg-accent mb-3 cursor-pointer rounded-md p-3",children:[d.jsx("div",{className:"text-foreground truncate text-sm font-medium text-nowrap",children:e}),d.jsx("div",{className:"text-muted-foreground mt-1 text-xs",children:"Current session"})]}),d.jsx("div",{className:"text-muted-foreground mt-4 text-center text-xs",children:"Multi-session support coming soon"})]})})},m3=({artifactInfo:e,displayVersionNavigation:t=!1,isExpanded:n=!1,onDelete:r,onDownload:o,setIsExpanded:i})=>{const{previewedArtifactAvailableVersions:s,currentPreviewedVersionNumber:a,navigateArtifactVersion:l}=Ot(),c=m.useMemo(()=>s??[],[s]);return d.jsxs("div",{className:"flex flex-row justify-between gap-1",children:[d.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[d.jsxs("div",{className:"min-w-0",children:[d.jsx("div",{className:"truncate text-sm",title:e.filename,children:e.filename}),d.jsx("div",{className:"truncate text-xs",title:kd(e.last_modified),children:kd(e.last_modified)})]}),t&&c.length>1&&d.jsx("div",{className:"align-right",children:d.jsxs(L0,{value:a==null?void 0:a.toString(),onValueChange:u=>{l(e.filename,parseInt(u))},children:[d.jsx(F0,{className:"h-[16px] py-0 text-xs shadow-none",children:d.jsx($0,{placeholder:"Version"})}),d.jsx(z0,{children:c.map(u=>d.jsxs(B0,{value:u.toString(),children:["Version ",u]},u))})]})})]}),d.jsxs("div",{className:"whitespace-nowrap opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100",children:[i&&d.jsx(tt,{variant:"ghost",size:"sm",onClick:u=>{u.stopPropagation(),u.preventDefault(),i(!n)},tooltip:n?"Collapse Details":"Expand Details",children:d.jsx(gu,{className:"h-4 w-4"})}),o&&d.jsx(tt,{variant:"ghost",size:"sm",onClick:async u=>{u.stopPropagation(),u.preventDefault(),await o(e)},tooltip:"Download",children:d.jsx(mu,{className:"h-4 w-4"})}),r&&d.jsx(tt,{variant:"ghost",size:"sm",onClick:u=>{u.preventDefault(),u.stopPropagation(),r(e)},tooltip:"Delete",children:d.jsx(Bm,{className:"h-4 w-4"})})]})]})},Qp=({artifact:e,isPreview:t})=>{const{openDeleteModal:n,setPreviewArtifact:r}=Ot(),{onDownload:o}=qg(),[i,s]=m.useState(!1),a=()=>{t&&r(null),n(e)},l=c=>{if(!c||typeof c=="object"&&Object.keys(c).length===0)return d.jsx("span",{children:"Not available"});const u=(f,p=0)=>typeof f=="string"?d.jsx("span",{children:f}):Array.isArray(f)?d.jsxs(d.Fragment,{children:["[",f.length>0&&u(f[0],p+1),f.length>1&&d.jsx("span",{children:", ..."}),"]"]}):typeof f=="object"&&f!==null?d.jsx("div",{className:`ml-${p*2} border-l pl-2`,children:Object.entries(f).map(([h,x],g)=>d.jsxs("div",{className:"text-xs",children:[d.jsxs("span",{className:"font-semibold",children:[h,":"]})," ",u(x,p+1)]},g))}):String(f);return d.jsxs("div",{className:"mt-1 space-y-0.5",children:[typeof c=="object"&&c.type&&d.jsxs("p",{children:[d.jsx("strong",{children:"Type:"})," ",c.type," ",c.inferred&&d.jsx("span",{className:"text-xs",children:"(inferred)"})]}),typeof c=="object"&&c.columns&&d.jsxs("p",{children:[d.jsx("strong",{children:"Columns:"})," ",c.columns.join(", ")]}),typeof c=="object"&&c.structure&&d.jsxs("div",{children:[d.jsx("strong",{children:"Structure:"}),u(c.structure)]}),typeof c=="object"&&c.error&&d.jsxs("p",{className:"text-[var(--color-error-wMain)]",children:[d.jsx("strong",{children:"Schema Error:"})," ",c.error]}),typeof c=="string"&&d.jsx("p",{children:c})]})};return d.jsx("div",{className:`group relative w-full border-b p-3 transition-all duration-150 ${t?"":"cursor-pointer hover:bg-[var(--accent-background)]"}`,onClick:c=>{c.stopPropagation(),r(e)},onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),c.stopPropagation(),r(e))},tabIndex:0,role:"button","aria-expanded":i,children:d.jsxs("div",{className:"flex items-start space-x-2",children:[d.jsx("div",{className:"flex-shrink-0 pt-0.5",children:nv(e,"h-4 w-4 flex-shrink-0")}),d.jsxs("div",{className:"min-w-0 flex-grow",children:[d.jsx(m3,{artifactInfo:e,isExpanded:i,onDelete:a,onDownload:o,setIsExpanded:s,displayVersionNavigation:t}),i&&d.jsxs("div",{className:"text-xs",children:[d.jsx("div",{className:"mt-1 text-xs break-words whitespace-pre-wrap italic",children:e.description||"No description."}),d.jsxs("div",{className:"mt-2 space-y-1 pt-2",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Size: "}),qh(e.size)]}),e.uri&&d.jsxs("div",{children:[d.jsx("strong",{children:"URI: "}),d.jsx("span",{className:"break-all",children:e.uri||"None"})]}),e.schema&&d.jsx("div",{children:l(e.schema)})]})]})]})]})})},g3=()=>{const{isDeleteModalOpen:e,artifactToDelete:t,closeDeleteModal:n,confirmDelete:r}=Ot();return!e||!t?null:d.jsx(hg,{open:e,onOpenChange:n,children:d.jsxs(mg,{children:[d.jsxs(gg,{children:[d.jsx(xg,{children:"Delete?"}),d.jsxs(yg,{children:["The file"," ",d.jsx("strong",{children:d.jsx("code",{children:t.filename})})," ","will be permanently deleted."]})]}),d.jsxs("div",{className:"flex justify-end space-x-2",children:[d.jsx(tt,{variant:"outline",onClick:n,children:"Cancel"}),d.jsx(tt,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})};function rd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Qr=rd();function Jv(e){Qr=e}var _i={exec:()=>null};function rt(e,t=""){let n=typeof e=="string"?e:e.source;const r={replace:(o,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(Kt.caret,"$1"),n=n.replace(o,s),r},getRegex:()=>new RegExp(n,t)};return r}var Kt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},x3=/^(?:[ \t]*(?:\n|$))+/,y3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,v3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,os=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,w3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,od=/(?:[*+-]|\d{1,9}[.)])/,ew=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,tw=rt(ew).replace(/bull/g,od).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),b3=rt(ew).replace(/bull/g,od).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),id=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,E3=/^[^\n]+/,sd=/(?!\s*\])(?:\\.|[^\[\]\\])+/,S3=rt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",sd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),k3=rt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,od).getRegex(),ol="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",ad=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,C3=rt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",ad).replace("tag",ol).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),nw=rt(id).replace("hr",os).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),_3=rt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",nw).getRegex(),ld={blockquote:_3,code:y3,def:S3,fences:v3,heading:w3,hr:os,html:C3,lheading:tw,list:k3,newline:x3,paragraph:nw,table:_i,text:E3},Jp=rt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",os).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex(),T3={...ld,lheading:b3,table:Jp,paragraph:rt(id).replace("hr",os).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Jp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ol).getRegex()},A3={...ld,html:rt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ad).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:_i,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:rt(id).replace("hr",os).replace("heading",` *#{1,6} *[^
601
+ ]`).replace("lheading",tw).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},N3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,j3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rw=/^( {2,}|\\)\n(?!\s*$)/,I3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,il=/[\p{P}\p{S}]/u,cd=/[\s\p{P}\p{S}]/u,ow=/[^\s\p{P}\p{S}]/u,R3=rt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,cd).getRegex(),iw=/(?!~)[\p{P}\p{S}]/u,M3=/(?!~)[\s\p{P}\p{S}]/u,P3=/(?:[^\s\p{P}\p{S}]|~)/u,D3=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,sw=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,O3=rt(sw,"u").replace(/punct/g,il).getRegex(),L3=rt(sw,"u").replace(/punct/g,iw).getRegex(),aw="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$3=rt(aw,"gu").replace(/notPunctSpace/g,ow).replace(/punctSpace/g,cd).replace(/punct/g,il).getRegex(),F3=rt(aw,"gu").replace(/notPunctSpace/g,P3).replace(/punctSpace/g,M3).replace(/punct/g,iw).getRegex(),z3=rt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ow).replace(/punctSpace/g,cd).replace(/punct/g,il).getRegex(),B3=rt(/\\(punct)/,"gu").replace(/punct/g,il).getRegex(),H3=rt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),V3=rt(ad).replace("(?:-->|$)","-->").getRegex(),U3=rt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",V3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xa=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,W3=rt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",xa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lw=rt(/^!?\[(label)\]\[(ref)\]/).replace("label",xa).replace("ref",sd).getRegex(),cw=rt(/^!?\[(ref)\](?:\[\])?/).replace("ref",sd).getRegex(),G3=rt("reflink|nolink(?!\\()","g").replace("reflink",lw).replace("nolink",cw).getRegex(),ud={_backpedal:_i,anyPunctuation:B3,autolink:H3,blockSkip:D3,br:rw,code:j3,del:_i,emStrongLDelim:O3,emStrongRDelimAst:$3,emStrongRDelimUnd:z3,escape:N3,link:W3,nolink:cw,punctuation:R3,reflink:lw,reflinkSearch:G3,tag:U3,text:I3,url:_i},Y3={...ud,link:rt(/^!?\[(label)\]\((.*?)\)/).replace("label",xa).getRegex(),reflink:rt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xa).getRegex()},zc={...ud,emStrongRDelimAst:F3,emStrongLDelim:L3,url:rt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},q3={...zc,br:rt(rw).replace("{2,}","*").getRegex(),text:rt(zc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Cs={normal:ld,gfm:T3,pedantic:A3},ai={normal:ud,gfm:zc,breaks:q3,pedantic:Y3},K3={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},eh=e=>K3[e];function kn(e,t){if(t){if(Kt.escapeTest.test(e))return e.replace(Kt.escapeReplace,eh)}else if(Kt.escapeTestNoEncode.test(e))return e.replace(Kt.escapeReplaceNoEncode,eh);return e}function th(e){try{e=encodeURI(e).replace(Kt.percentDecode,"%")}catch{return null}return e}function nh(e,t){var i;const n=e.replace(Kt.findPipe,(s,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),r=n.split(Kt.splitPipe);let o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(Kt.slashPipe,"|");return r}function li(e,t,n){const r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function X3(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function rh(e,t,n,r,o){const i=t.href,s=t.title||null,a=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;const l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function Z3(e,t,n){const r=e.match(n.other.indentCodeCompensation);if(r===null)return t;const o=r[1];return t.split(`
602
+ `).map(i=>{const s=i.match(n.other.beginningSpace);if(s===null)return i;const[a]=s;return a.length>=o.length?i.slice(o.length):i}).join(`
603
+ `)}var ya=class{constructor(e){ut(this,"options");ut(this,"rules");ut(this,"lexer");this.options=e||Qr}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:li(n,`
604
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],r=Z3(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const r=li(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:li(t[0],`
605
+ `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=li(t[0],`
606
+ `).split(`
607
+ `),r="",o="";const i=[];for(;n.length>0;){let s=!1;const a=[];let l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))a.push(n[l]),s=!0;else if(!s)a.push(n[l]);else break;n=n.slice(l);const c=a.join(`
608
+ `),u=c.replace(this.rules.other.blockquoteSetextReplace,`
609
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
610
+ ${c}`:c,o=o?`${o}
611
+ ${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=f,n.length===0)break;const p=i.at(-1);if((p==null?void 0:p.type)==="code")break;if((p==null?void 0:p.type)==="blockquote"){const h=p,x=h.raw+`
612
+ `+n.join(`
613
+ `),g=this.blockquote(x);i[i.length-1]=g,r=r.substring(0,r.length-h.raw.length)+g.raw,o=o.substring(0,o.length-h.text.length)+g.text;break}else if((p==null?void 0:p.type)==="list"){const h=p,x=h.raw+`
614
+ `+n.join(`
615
+ `),g=this.list(x);i[i.length-1]=g,r=r.substring(0,r.length-p.raw.length)+g.raw,o=o.substring(0,o.length-h.raw.length)+g.raw,n=x.substring(i.at(-1).raw.length).split(`
616
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const r=n.length>1,o={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let s=!1;for(;e;){let l=!1,c="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let f=t[2].split(`
617
+ `,1)[0].replace(this.rules.other.listReplaceTabs,v=>" ".repeat(3*v.length)),p=e.split(`
618
+ `,1)[0],h=!f.trim(),x=0;if(this.options.pedantic?(x=2,u=f.trimStart()):h?x=t[1].length+1:(x=t[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,u=f.slice(x),x+=t[1].length),h&&this.rules.other.blankLine.test(p)&&(c+=p+`
619
+ `,e=e.substring(p.length+1),l=!0),!l){const v=this.rules.other.nextBulletRegex(x),b=this.rules.other.hrRegex(x),w=this.rules.other.fencesBeginRegex(x),S=this.rules.other.headingBeginRegex(x),E=this.rules.other.htmlBeginRegex(x);for(;e;){const C=e.split(`
620
+ `,1)[0];let k;if(p=C,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),k=p):k=p.replace(this.rules.other.tabCharGlobal," "),w.test(p)||S.test(p)||E.test(p)||v.test(p)||b.test(p))break;if(k.search(this.rules.other.nonSpaceChar)>=x||!p.trim())u+=`
621
+ `+k.slice(x);else{if(h||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||w.test(f)||S.test(f)||b.test(f))break;u+=`
622
+ `+p}!h&&!p.trim()&&(h=!0),c+=C+`
623
+ `,e=e.substring(C.length+1),f=k.slice(x)}}o.loose||(s?o.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(s=!0));let g=null,y;this.options.gfm&&(g=this.rules.other.listIsTask.exec(u),g&&(y=g[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:c,task:!!g,checked:y,loose:!1,text:u,tokens:[]}),o.raw+=c}const a=o.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let l=0;l<o.items.length;l++)if(this.lexer.state.top=!1,o.items[l].tokens=this.lexer.blockTokens(o.items[l].text,[]),!o.loose){const c=o.items[l].tokens.filter(f=>f.type==="space"),u=c.length>0&&c.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=u}if(o.loose)for(let l=0;l<o.items.length;l++)o.items[l].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:r,title:o}}}table(e){var s;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=nh(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(s=t[3])!=null&&s.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
624
+ `):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const a of r)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<n.length;a++)i.header.push({text:n[a],tokens:this.lexer.inline(n[a]),header:!0,align:i.align[a]});for(const a of o)i.rows.push(nh(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
625
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const i=li(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=X3(t[2],"()");if(i===-2)return;if(i>-1){const a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),rh(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return rh(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const i=[...r[0]].length-1;let s,a,l=i,c=0;const u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(r=u.exec(t))!=null;){if(s=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!s)continue;if(a=[...s].length,r[3]||r[4]){l+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const f=[...r[0]][0].length,p=e.slice(0,i+r.index+f+a);if(Math.min(i,a)%2){const x=p.slice(1,-1);return{type:"em",raw:p,text:x,tokens:this.lexer.inlineTokens(x)}}const h=p.slice(2,-2);return{type:"strong",raw:p,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let r,o;if(t[2]==="@")r=t[0],o="mailto:"+r;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);r=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Wn=class Bc{constructor(t){ut(this,"tokens");ut(this,"options");ut(this,"state");ut(this,"tokenizer");ut(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Qr,this.options.tokenizer=this.options.tokenizer||new ya,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:Kt,block:Cs.normal,inline:ai.normal};this.options.pedantic?(n.block=Cs.pedantic,n.inline=ai.pedantic):this.options.gfm&&(n.block=Cs.gfm,this.options.breaks?n.inline=ai.breaks:n.inline=ai.gfm),this.tokenizer.rules=n}static get rules(){return{block:Cs,inline:ai}}static lex(t,n){return new Bc(n).lex(t)}static lexInline(t,n){return new Bc(n).inlineTokens(t)}lex(t){t=t.replace(Kt.carriageReturn,`
626
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var o,i,s;for(this.options.pedantic&&(t=t.replace(Kt.tabCharGlobal," ").replace(Kt.spaceLine,""));t;){let a;if((i=(o=this.options.extensions)==null?void 0:o.block)!=null&&i.some(c=>(a=c.call({lexer:this},t,n))?(t=t.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.space(t)){t=t.substring(a.raw.length);const c=n.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
627
+ `:n.push(a);continue}if(a=this.tokenizer.code(t)){t=t.substring(a.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
628
+ `+a.raw,c.text+=`
629
+ `+a.text,this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(a=this.tokenizer.fences(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.heading(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.hr(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.blockquote(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.list(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.html(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.def(t)){t=t.substring(a.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
630
+ `+a.raw,c.text+=`
631
+ `+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(t)){t=t.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.lheading(t)){t=t.substring(a.raw.length),n.push(a);continue}let l=t;if((s=this.options.extensions)!=null&&s.startBlock){let c=1/0;const u=t.slice(1);let f;this.options.extensions.startBlock.forEach(p=>{f=p.call({lexer:this},u),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(l=t.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){const c=n.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
632
+ `+a.raw,c.text+=`
633
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a),r=l.length!==t.length,t=t.substring(a.raw.length);continue}if(a=this.tokenizer.text(t)){t=t.substring(a.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
634
+ `+a.raw,c.text+=`
635
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(a);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var a,l,c;let r=t,o=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,o.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(o=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,s="";for(;t;){i||(s=""),i=!1;let u;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(p=>(u=p.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);const p=n.at(-1);u.type==="text"&&(p==null?void 0:p.type)==="text"?(p.raw+=u.raw,p.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(t,r,s)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),n.push(u);continue}let f=t;if((c=this.options.extensions)!=null&&c.startInline){let p=1/0;const h=t.slice(1);let x;this.options.extensions.startInline.forEach(g=>{x=g.call({lexer:this},h),typeof x=="number"&&x>=0&&(p=Math.min(p,x))}),p<1/0&&p>=0&&(f=t.substring(0,p+1))}if(u=this.tokenizer.inlineText(f)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(s=u.raw.slice(-1)),i=!0;const p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=u.raw,p.text+=u.text):n.push(u);continue}if(t){const p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return n}},va=class{constructor(e){ut(this,"options");ut(this,"parser");this.options=e||Qr}space(e){return""}code({text:e,lang:t,escaped:n}){var i;const r=(i=(t||"").match(Kt.notSpaceStart))==null?void 0:i[0],o=e.replace(Kt.endingNewline,"")+`
636
+ `;return r?'<pre><code class="language-'+kn(r)+'">'+(n?o:kn(o,!0))+`</code></pre>
637
+ `:"<pre><code>"+(n?o:kn(o,!0))+`</code></pre>
638
+ `}blockquote({tokens:e}){return`<blockquote>
639
+ ${this.parser.parse(e)}</blockquote>
640
+ `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
641
+ `}hr(e){return`<hr>
642
+ `}list(e){const t=e.ordered,n=e.start;let r="";for(let s=0;s<e.items.length;s++){const a=e.items[s];r+=this.listitem(a)}const o=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+o+i+`>
643
+ `+r+"</"+o+`>
644
+ `}listitem(e){var n;let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+kn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
645
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
646
+ `}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let r="";for(let o=0;o<e.rows.length;o++){const i=e.rows[o];n="";for(let s=0;s<i.length;s++)n+=this.tablecell(i[s]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
647
+ <thead>
648
+ `+t+`</thead>
649
+ `+r+`</table>
650
+ `}tablerow({text:e}){return`<tr>
651
+ ${e}</tr>
652
+ `}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
653
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${kn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const r=this.parser.parseInline(n),o=th(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+kn(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const o=th(e);if(o===null)return kn(n);e=o;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${kn(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:kn(e.text)}},dd=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},Gn=class Hc{constructor(t){ut(this,"options");ut(this,"renderer");ut(this,"textRenderer");this.options=t||Qr,this.options.renderer=this.options.renderer||new va,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new dd}static parse(t,n){return new Hc(n).parse(t)}static parseInline(t,n){return new Hc(n).parseInline(t)}parse(t,n=!0){var o,i;let r="";for(let s=0;s<t.length;s++){const a=t[s];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[a.type]){const c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){r+=u||"";continue}}const l=a;switch(l.type){case"space":{r+=this.renderer.space(l);continue}case"hr":{r+=this.renderer.hr(l);continue}case"heading":{r+=this.renderer.heading(l);continue}case"code":{r+=this.renderer.code(l);continue}case"table":{r+=this.renderer.table(l);continue}case"blockquote":{r+=this.renderer.blockquote(l);continue}case"list":{r+=this.renderer.list(l);continue}case"html":{r+=this.renderer.html(l);continue}case"paragraph":{r+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;s+1<t.length&&t[s+1].type==="text";)c=t[++s],u+=`
654
+ `+this.renderer.text(c);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(t,n=this.renderer){var o,i;let r="";for(let s=0;s<t.length;s++){const a=t[s];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}const l=a;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}},Ql,Hs=(Ql=class{constructor(e){ut(this,"options");ut(this,"block");this.options=e||Qr}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?Wn.lex:Wn.lexInline}provideParser(){return this.block?Gn.parse:Gn.parseInline}},ut(Ql,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Ql),Q3=class{constructor(...e){ut(this,"defaults",rd());ut(this,"options",this.setOptions);ut(this,"parse",this.parseMarkdown(!0));ut(this,"parseInline",this.parseMarkdown(!1));ut(this,"Parser",Gn);ut(this,"Renderer",va);ut(this,"TextRenderer",dd);ut(this,"Lexer",Wn);ut(this,"Tokenizer",ya);ut(this,"Hooks",Hs);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const s=i;for(const a of s.header)n=n.concat(this.walkTokens(a.tokens,t));for(const a of s.rows)for(const l of a)n=n.concat(this.walkTokens(l.tokens,t));break}case"list":{const s=i;n=n.concat(this.walkTokens(s.items,t));break}default:{const s=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[s.type]?this.defaults.extensions.childTokens[s.type].forEach(a=>{const l=s[a].flat(1/0);n=n.concat(this.walkTokens(l,t))}):s.tokens&&(n=n.concat(this.walkTokens(s.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=t.renderers[o.name];i?t.renderers[o.name]=function(...s){let a=o.renderer.apply(this,s);return a===!1&&(a=i.apply(this,s)),a}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){const o=this.defaults.renderer||new va(this.defaults);for(const i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const s=i,a=n.renderer[s],l=o[s];o[s]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u||""}}r.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new ya(this.defaults);for(const i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const s=i,a=n.tokenizer[s],l=o[s];o[s]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Hs;for(const i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const s=i,a=n.hooks[s],l=o[s];Hs.passThroughHooks.has(i)?o[s]=c=>{if(this.defaults.async)return Promise.resolve(a.call(o,c)).then(f=>l.call(o,f));const u=a.call(o,c);return l.call(o,u)}:o[s]=(...c)=>{let u=a.apply(o,c);return u===!1&&(u=l.apply(o,c)),u}}r.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(s){let a=[];return a.push(i.call(this,s)),o&&(a=a.concat(o.call(this,s))),a}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Wn.lex(e,t??this.defaults)}parser(e,t){return Gn.parse(e,t??this.defaults)}parseMarkdown(e){return(n,r)=>{const o={...r},i={...this.defaults,...o},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const a=i.hooks?i.hooks.provideLexer():e?Wn.lex:Wn.lexInline,l=i.hooks?i.hooks.provideParser():e?Gn.parse:Gn.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>l(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(s);try{i.hooks&&(n=i.hooks.preprocess(n));let c=a(n,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=l(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return s(c)}}}onError(e,t){return n=>{if(n.message+=`
655
+ Please report this to https://github.com/markedjs/marked.`,e){const r="<p>An error occurred:</p><pre>"+kn(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Xr=new Q3;function it(e,t){return Xr.parse(e,t)}it.options=it.setOptions=function(e){return Xr.setOptions(e),it.defaults=Xr.defaults,Jv(it.defaults),it};it.getDefaults=rd;it.defaults=Qr;it.use=function(...e){return Xr.use(...e),it.defaults=Xr.defaults,Jv(it.defaults),it};it.walkTokens=function(e,t){return Xr.walkTokens(e,t)};it.parseInline=Xr.parseInline;it.Parser=Gn;it.parser=Gn.parse;it.Renderer=va;it.TextRenderer=dd;it.Lexer=Wn;it.lexer=Wn.lex;it.Tokenizer=ya;it.Hooks=Hs;it.parse=it;it.options;it.setOptions;it.use;it.walkTokens;it.parseInline;Gn.parse;Wn.lex;var ci={},ao={},_s={},Cr={},_r={},Yl={},oh;function uw(){return oh||(oh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Doctype=e.CDATA=e.Tag=e.Style=e.Script=e.Comment=e.Directive=e.Text=e.Root=e.isTag=e.ElementType=void 0;var t;(function(r){r.Root="root",r.Text="text",r.Directive="directive",r.Comment="comment",r.Script="script",r.Style="style",r.Tag="tag",r.CDATA="cdata",r.Doctype="doctype"})(t=e.ElementType||(e.ElementType={}));function n(r){return r.type===t.Tag||r.type===t.Script||r.type===t.Style}e.isTag=n,e.Root=t.Root,e.Text=t.Text,e.Directive=t.Directive,e.Comment=t.Comment,e.Script=t.Script,e.Style=t.Style,e.Tag=t.Tag,e.CDATA=t.CDATA,e.Doctype=t.Doctype}(Yl)),Yl}var Le={},ih;function sh(){if(ih)return Le;ih=1;var e=Le&&Le.__extends||function(){var E=function(C,k){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,P){T.__proto__=P}||function(T,P){for(var z in P)Object.prototype.hasOwnProperty.call(P,z)&&(T[z]=P[z])},E(C,k)};return function(C,k){if(typeof k!="function"&&k!==null)throw new TypeError("Class extends value "+String(k)+" is not a constructor or null");E(C,k);function T(){this.constructor=C}C.prototype=k===null?Object.create(k):(T.prototype=k.prototype,new T)}}(),t=Le&&Le.__assign||function(){return t=Object.assign||function(E){for(var C,k=1,T=arguments.length;k<T;k++){C=arguments[k];for(var P in C)Object.prototype.hasOwnProperty.call(C,P)&&(E[P]=C[P])}return E},t.apply(this,arguments)};Object.defineProperty(Le,"__esModule",{value:!0}),Le.cloneNode=Le.hasChildren=Le.isDocument=Le.isDirective=Le.isComment=Le.isText=Le.isCDATA=Le.isTag=Le.Element=Le.Document=Le.CDATA=Le.NodeWithChildren=Le.ProcessingInstruction=Le.Comment=Le.Text=Le.DataNode=Le.Node=void 0;var n=uw(),r=function(){function E(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}return Object.defineProperty(E.prototype,"parentNode",{get:function(){return this.parent},set:function(C){this.parent=C},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"previousSibling",{get:function(){return this.prev},set:function(C){this.prev=C},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"nextSibling",{get:function(){return this.next},set:function(C){this.next=C},enumerable:!1,configurable:!0}),E.prototype.cloneNode=function(C){return C===void 0&&(C=!1),w(this,C)},E}();Le.Node=r;var o=function(E){e(C,E);function C(k){var T=E.call(this)||this;return T.data=k,T}return Object.defineProperty(C.prototype,"nodeValue",{get:function(){return this.data},set:function(k){this.data=k},enumerable:!1,configurable:!0}),C}(r);Le.DataNode=o;var i=function(E){e(C,E);function C(){var k=E!==null&&E.apply(this,arguments)||this;return k.type=n.ElementType.Text,k}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 3},enumerable:!1,configurable:!0}),C}(o);Le.Text=i;var s=function(E){e(C,E);function C(){var k=E!==null&&E.apply(this,arguments)||this;return k.type=n.ElementType.Comment,k}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 8},enumerable:!1,configurable:!0}),C}(o);Le.Comment=s;var a=function(E){e(C,E);function C(k,T){var P=E.call(this,T)||this;return P.name=k,P.type=n.ElementType.Directive,P}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),C}(o);Le.ProcessingInstruction=a;var l=function(E){e(C,E);function C(k){var T=E.call(this)||this;return T.children=k,T}return Object.defineProperty(C.prototype,"firstChild",{get:function(){var k;return(k=this.children[0])!==null&&k!==void 0?k:null},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"lastChild",{get:function(){return this.children.length>0?this.children[this.children.length-1]:null},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"childNodes",{get:function(){return this.children},set:function(k){this.children=k},enumerable:!1,configurable:!0}),C}(r);Le.NodeWithChildren=l;var c=function(E){e(C,E);function C(){var k=E!==null&&E.apply(this,arguments)||this;return k.type=n.ElementType.CDATA,k}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 4},enumerable:!1,configurable:!0}),C}(l);Le.CDATA=c;var u=function(E){e(C,E);function C(){var k=E!==null&&E.apply(this,arguments)||this;return k.type=n.ElementType.Root,k}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 9},enumerable:!1,configurable:!0}),C}(l);Le.Document=u;var f=function(E){e(C,E);function C(k,T,P,z){P===void 0&&(P=[]),z===void 0&&(z=k==="script"?n.ElementType.Script:k==="style"?n.ElementType.Style:n.ElementType.Tag);var D=E.call(this,P)||this;return D.name=k,D.attribs=T,D.type=z,D}return Object.defineProperty(C.prototype,"nodeType",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"tagName",{get:function(){return this.name},set:function(k){this.name=k},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"attributes",{get:function(){var k=this;return Object.keys(this.attribs).map(function(T){var P,z;return{name:T,value:k.attribs[T],namespace:(P=k["x-attribsNamespace"])===null||P===void 0?void 0:P[T],prefix:(z=k["x-attribsPrefix"])===null||z===void 0?void 0:z[T]}})},enumerable:!1,configurable:!0}),C}(l);Le.Element=f;function p(E){return(0,n.isTag)(E)}Le.isTag=p;function h(E){return E.type===n.ElementType.CDATA}Le.isCDATA=h;function x(E){return E.type===n.ElementType.Text}Le.isText=x;function g(E){return E.type===n.ElementType.Comment}Le.isComment=g;function y(E){return E.type===n.ElementType.Directive}Le.isDirective=y;function v(E){return E.type===n.ElementType.Root}Le.isDocument=v;function b(E){return Object.prototype.hasOwnProperty.call(E,"children")}Le.hasChildren=b;function w(E,C){C===void 0&&(C=!1);var k;if(x(E))k=new i(E.data);else if(g(E))k=new s(E.data);else if(p(E)){var T=C?S(E.children):[],P=new f(E.name,t({},E.attribs),T);T.forEach(function(M){return M.parent=P}),E.namespace!=null&&(P.namespace=E.namespace),E["x-attribsNamespace"]&&(P["x-attribsNamespace"]=t({},E["x-attribsNamespace"])),E["x-attribsPrefix"]&&(P["x-attribsPrefix"]=t({},E["x-attribsPrefix"])),k=P}else if(h(E)){var T=C?S(E.children):[],z=new c(T);T.forEach(function(_){return _.parent=z}),k=z}else if(v(E)){var T=C?S(E.children):[],D=new u(T);T.forEach(function(_){return _.parent=D}),E["x-mode"]&&(D["x-mode"]=E["x-mode"]),k=D}else if(y(E)){var $=new a(E.name,E.data);E["x-name"]!=null&&($["x-name"]=E["x-name"],$["x-publicId"]=E["x-publicId"],$["x-systemId"]=E["x-systemId"]),k=$}else throw new Error("Not implemented yet: ".concat(E.type));return k.startIndex=E.startIndex,k.endIndex=E.endIndex,E.sourceCodeLocation!=null&&(k.sourceCodeLocation=E.sourceCodeLocation),k}Le.cloneNode=w;function S(E){for(var C=E.map(function(T){return w(T,!0)}),k=1;k<C.length;k++)C[k].prev=C[k-1],C[k-1].next=C[k];return C}return Le}var ah;function dw(){return ah||(ah=1,function(e){var t=_r&&_r.__createBinding||(Object.create?function(a,l,c,u){u===void 0&&(u=c);var f=Object.getOwnPropertyDescriptor(l,c);(!f||("get"in f?!l.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return l[c]}}),Object.defineProperty(a,u,f)}:function(a,l,c,u){u===void 0&&(u=c),a[u]=l[c]}),n=_r&&_r.__exportStar||function(a,l){for(var c in a)c!=="default"&&!Object.prototype.hasOwnProperty.call(l,c)&&t(l,a,c)};Object.defineProperty(e,"__esModule",{value:!0}),e.DomHandler=void 0;var r=uw(),o=sh();n(sh(),e);var i={withStartIndices:!1,withEndIndices:!1,xmlMode:!1},s=function(){function a(l,c,u){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof c=="function"&&(u=c,c=i),typeof l=="object"&&(c=l,l=void 0),this.callback=l??null,this.options=c??i,this.elementCB=u??null}return a.prototype.onparserinit=function(l){this.parser=l},a.prototype.onreset=function(){this.dom=[],this.root=new o.Document(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null},a.prototype.onend=function(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))},a.prototype.onerror=function(l){this.handleCallback(l)},a.prototype.onclosetag=function(){this.lastNode=null;var l=this.tagStack.pop();this.options.withEndIndices&&(l.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(l)},a.prototype.onopentag=function(l,c){var u=this.options.xmlMode?r.ElementType.Tag:void 0,f=new o.Element(l,c,void 0,u);this.addNode(f),this.tagStack.push(f)},a.prototype.ontext=function(l){var c=this.lastNode;if(c&&c.type===r.ElementType.Text)c.data+=l,this.options.withEndIndices&&(c.endIndex=this.parser.endIndex);else{var u=new o.Text(l);this.addNode(u),this.lastNode=u}},a.prototype.oncomment=function(l){if(this.lastNode&&this.lastNode.type===r.ElementType.Comment){this.lastNode.data+=l;return}var c=new o.Comment(l);this.addNode(c),this.lastNode=c},a.prototype.oncommentend=function(){this.lastNode=null},a.prototype.oncdatastart=function(){var l=new o.Text(""),c=new o.CDATA([l]);this.addNode(c),l.parent=c,this.lastNode=l},a.prototype.oncdataend=function(){this.lastNode=null},a.prototype.onprocessinginstruction=function(l,c){var u=new o.ProcessingInstruction(l,c);this.addNode(u)},a.prototype.handleCallback=function(l){if(typeof this.callback=="function")this.callback(l,this.dom);else if(l)throw l},a.prototype.addNode=function(l){var c=this.tagStack[this.tagStack.length-1],u=c.children[c.children.length-1];this.options.withStartIndices&&(l.startIndex=this.parser.startIndex),this.options.withEndIndices&&(l.endIndex=this.parser.endIndex),c.children.push(l),u&&(l.prev=u,u.next=l),l.parent=c,this.lastNode=null},a}();e.DomHandler=s,e.default=s}(_r)),_r}var ql={},lh;function J3(){return lh||(lh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=e.CARRIAGE_RETURN_PLACEHOLDER=e.CARRIAGE_RETURN_REGEX=e.CARRIAGE_RETURN=e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES=void 0,e.CASE_SENSITIVE_TAG_NAMES=["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"],e.CASE_SENSITIVE_TAG_NAMES_MAP=e.CASE_SENSITIVE_TAG_NAMES.reduce(function(t,n){return t[n.toLowerCase()]=n,t},{}),e.CARRIAGE_RETURN="\r",e.CARRIAGE_RETURN_REGEX=new RegExp(e.CARRIAGE_RETURN,"g"),e.CARRIAGE_RETURN_PLACEHOLDER="__HTML_DOM_PARSER_CARRIAGE_RETURN_PLACEHOLDER_".concat(Date.now(),"__"),e.CARRIAGE_RETURN_PLACEHOLDER_REGEX=new RegExp(e.CARRIAGE_RETURN_PLACEHOLDER,"g")}(ql)),ql}var ch;function fw(){if(ch)return Cr;ch=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.formatAttributes=r,Cr.escapeSpecialCharacters=i,Cr.revertEscapedCharacters=s,Cr.formatDOM=a;var e=dw(),t=J3();function n(l){return t.CASE_SENSITIVE_TAG_NAMES_MAP[l]}function r(l){for(var c={},u=0,f=l.length;u<f;u++){var p=l[u];c[p.name]=p.value}return c}function o(l){l=l.toLowerCase();var c=n(l);return c||l}function i(l){return l.replace(t.CARRIAGE_RETURN_REGEX,t.CARRIAGE_RETURN_PLACEHOLDER)}function s(l){return l.replace(t.CARRIAGE_RETURN_PLACEHOLDER_REGEX,t.CARRIAGE_RETURN)}function a(l,c,u){c===void 0&&(c=null);for(var f=[],p,h=0,x=l.length;h<x;h++){var g=l[h];switch(g.nodeType){case 1:{var y=o(g.nodeName);p=new e.Element(y,r(g.attributes)),p.children=a(y==="template"?g.content.childNodes:g.childNodes,p);break}case 3:p=new e.Text(s(g.nodeValue));break;case 8:p=new e.Comment(g.nodeValue);break;default:continue}var v=f[h-1]||null;v&&(v.next=p),p.parent=c,p.prev=v,p.next=null,f.push(p)}return u&&(p=new e.ProcessingInstruction(u.substring(0,u.indexOf(" ")).toLowerCase(),u),p.next=f[0]||null,p.parent=c,f.unshift(p),f[1]&&(f[1].prev=f[0])),f}return Cr}var uh;function e$(){if(uh)return _s;uh=1,Object.defineProperty(_s,"__esModule",{value:!0}),_s.default=g;var e=fw(),t="html",n="head",r="body",o=/<([a-zA-Z]+[0-9]?)/,i=/<head[^]*>/i,s=/<body[^]*>/i,a=function(y,v){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},l=function(y,v){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")},c=typeof window=="object"&&window.DOMParser;if(typeof c=="function"){var u=new c,f="text/html";l=function(y,v){return v&&(y="<".concat(v,">").concat(y,"</").concat(v,">")),u.parseFromString(y,f)},a=l}if(typeof document=="object"&&document.implementation){var p=document.implementation.createHTMLDocument();a=function(y,v){if(v){var b=p.documentElement.querySelector(v);return b&&(b.innerHTML=y),p}return p.documentElement.innerHTML=y,p}}var h=typeof document=="object"&&document.createElement("template"),x;h&&h.content&&(x=function(y){return h.innerHTML=y,h.content.childNodes});function g(y){var v,b;y=(0,e.escapeSpecialCharacters)(y);var w=y.match(o),S=w&&w[1]?w[1].toLowerCase():"";switch(S){case t:{var E=l(y);if(!i.test(y)){var C=E.querySelector(n);(v=C==null?void 0:C.parentNode)===null||v===void 0||v.removeChild(C)}if(!s.test(y)){var C=E.querySelector(r);(b=C==null?void 0:C.parentNode)===null||b===void 0||b.removeChild(C)}return E.querySelectorAll(t)}case n:case r:{var k=a(y).querySelectorAll(S);return s.test(y)&&i.test(y)?k[0].parentNode.childNodes:k}default:{if(x)return x(y);var C=a(y,r).querySelector(r);return C.childNodes}}}return _s}var dh;function t$(){if(dh)return ao;dh=1;var e=ao&&ao.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ao,"__esModule",{value:!0}),ao.default=o;var t=e(e$()),n=fw(),r=/<(![a-zA-Z\s]+)>/;function o(i){if(typeof i!="string")throw new TypeError("First argument must be a string");if(!i)return[];var s=i.match(r),a=s?s[1]:void 0;return(0,n.formatDOM)((0,t.default)(i),null,a)}return ao}var Ts={},un={},ui={},fh;function n$(){if(fh)return ui;fh=1;var e=0;ui.SAME=e;var t=1;return ui.CAMELCASE=t,ui.possibleStandardNames={accept:0,acceptCharset:1,"accept-charset":"acceptCharset",accessKey:1,action:0,allowFullScreen:1,alt:0,as:0,async:0,autoCapitalize:1,autoComplete:1,autoCorrect:1,autoFocus:1,autoPlay:1,autoSave:1,capture:0,cellPadding:1,cellSpacing:1,challenge:0,charSet:1,checked:0,children:0,cite:0,class:"className",classID:1,className:1,cols:0,colSpan:1,content:0,contentEditable:1,contextMenu:1,controls:0,controlsList:1,coords:0,crossOrigin:1,dangerouslySetInnerHTML:1,data:0,dateTime:1,default:0,defaultChecked:1,defaultValue:1,defer:0,dir:0,disabled:0,disablePictureInPicture:1,disableRemotePlayback:1,download:0,draggable:0,encType:1,enterKeyHint:1,for:"htmlFor",form:0,formMethod:1,formAction:1,formEncType:1,formNoValidate:1,formTarget:1,frameBorder:1,headers:0,height:0,hidden:0,high:0,href:0,hrefLang:1,htmlFor:1,httpEquiv:1,"http-equiv":"httpEquiv",icon:0,id:0,innerHTML:1,inputMode:1,integrity:0,is:0,itemID:1,itemProp:1,itemRef:1,itemScope:1,itemType:1,keyParams:1,keyType:1,kind:0,label:0,lang:0,list:0,loop:0,low:0,manifest:0,marginWidth:1,marginHeight:1,max:0,maxLength:1,media:0,mediaGroup:1,method:0,min:0,minLength:1,multiple:0,muted:0,name:0,noModule:1,nonce:0,noValidate:1,open:0,optimum:0,pattern:0,placeholder:0,playsInline:1,poster:0,preload:0,profile:0,radioGroup:1,readOnly:1,referrerPolicy:1,rel:0,required:0,reversed:0,role:0,rows:0,rowSpan:1,sandbox:0,scope:0,scoped:0,scrolling:0,seamless:0,selected:0,shape:0,size:0,sizes:0,span:0,spellCheck:1,src:0,srcDoc:1,srcLang:1,srcSet:1,start:0,step:0,style:0,summary:0,tabIndex:1,target:0,title:0,type:0,useMap:1,value:0,width:0,wmode:0,wrap:0,about:0,accentHeight:1,"accent-height":"accentHeight",accumulate:0,additive:0,alignmentBaseline:1,"alignment-baseline":"alignmentBaseline",allowReorder:1,alphabetic:0,amplitude:0,arabicForm:1,"arabic-form":"arabicForm",ascent:0,attributeName:1,attributeType:1,autoReverse:1,azimuth:0,baseFrequency:1,baselineShift:1,"baseline-shift":"baselineShift",baseProfile:1,bbox:0,begin:0,bias:0,by:0,calcMode:1,capHeight:1,"cap-height":"capHeight",clip:0,clipPath:1,"clip-path":"clipPath",clipPathUnits:1,clipRule:1,"clip-rule":"clipRule",color:0,colorInterpolation:1,"color-interpolation":"colorInterpolation",colorInterpolationFilters:1,"color-interpolation-filters":"colorInterpolationFilters",colorProfile:1,"color-profile":"colorProfile",colorRendering:1,"color-rendering":"colorRendering",contentScriptType:1,contentStyleType:1,cursor:0,cx:0,cy:0,d:0,datatype:0,decelerate:0,descent:0,diffuseConstant:1,direction:0,display:0,divisor:0,dominantBaseline:1,"dominant-baseline":"dominantBaseline",dur:0,dx:0,dy:0,edgeMode:1,elevation:0,enableBackground:1,"enable-background":"enableBackground",end:0,exponent:0,externalResourcesRequired:1,fill:0,fillOpacity:1,"fill-opacity":"fillOpacity",fillRule:1,"fill-rule":"fillRule",filter:0,filterRes:1,filterUnits:1,floodOpacity:1,"flood-opacity":"floodOpacity",floodColor:1,"flood-color":"floodColor",focusable:0,fontFamily:1,"font-family":"fontFamily",fontSize:1,"font-size":"fontSize",fontSizeAdjust:1,"font-size-adjust":"fontSizeAdjust",fontStretch:1,"font-stretch":"fontStretch",fontStyle:1,"font-style":"fontStyle",fontVariant:1,"font-variant":"fontVariant",fontWeight:1,"font-weight":"fontWeight",format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:1,"glyph-name":"glyphName",glyphOrientationHorizontal:1,"glyph-orientation-horizontal":"glyphOrientationHorizontal",glyphOrientationVertical:1,"glyph-orientation-vertical":"glyphOrientationVertical",glyphRef:1,gradientTransform:1,gradientUnits:1,hanging:0,horizAdvX:1,"horiz-adv-x":"horizAdvX",horizOriginX:1,"horiz-origin-x":"horizOriginX",ideographic:0,imageRendering:1,"image-rendering":"imageRendering",in2:0,in:0,inlist:0,intercept:0,k1:0,k2:0,k3:0,k4:0,k:0,kernelMatrix:1,kernelUnitLength:1,kerning:0,keyPoints:1,keySplines:1,keyTimes:1,lengthAdjust:1,letterSpacing:1,"letter-spacing":"letterSpacing",lightingColor:1,"lighting-color":"lightingColor",limitingConeAngle:1,local:0,markerEnd:1,"marker-end":"markerEnd",markerHeight:1,markerMid:1,"marker-mid":"markerMid",markerStart:1,"marker-start":"markerStart",markerUnits:1,markerWidth:1,mask:0,maskContentUnits:1,maskUnits:1,mathematical:0,mode:0,numOctaves:1,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:1,"overline-position":"overlinePosition",overlineThickness:1,"overline-thickness":"overlineThickness",paintOrder:1,"paint-order":"paintOrder",panose1:0,"panose-1":"panose1",pathLength:1,patternContentUnits:1,patternTransform:1,patternUnits:1,pointerEvents:1,"pointer-events":"pointerEvents",points:0,pointsAtX:1,pointsAtY:1,pointsAtZ:1,prefix:0,preserveAlpha:1,preserveAspectRatio:1,primitiveUnits:1,property:0,r:0,radius:0,refX:1,refY:1,renderingIntent:1,"rendering-intent":"renderingIntent",repeatCount:1,repeatDur:1,requiredExtensions:1,requiredFeatures:1,resource:0,restart:0,result:0,results:0,rotate:0,rx:0,ry:0,scale:0,security:0,seed:0,shapeRendering:1,"shape-rendering":"shapeRendering",slope:0,spacing:0,specularConstant:1,specularExponent:1,speed:0,spreadMethod:1,startOffset:1,stdDeviation:1,stemh:0,stemv:0,stitchTiles:1,stopColor:1,"stop-color":"stopColor",stopOpacity:1,"stop-opacity":"stopOpacity",strikethroughPosition:1,"strikethrough-position":"strikethroughPosition",strikethroughThickness:1,"strikethrough-thickness":"strikethroughThickness",string:0,stroke:0,strokeDasharray:1,"stroke-dasharray":"strokeDasharray",strokeDashoffset:1,"stroke-dashoffset":"strokeDashoffset",strokeLinecap:1,"stroke-linecap":"strokeLinecap",strokeLinejoin:1,"stroke-linejoin":"strokeLinejoin",strokeMiterlimit:1,"stroke-miterlimit":"strokeMiterlimit",strokeWidth:1,"stroke-width":"strokeWidth",strokeOpacity:1,"stroke-opacity":"strokeOpacity",suppressContentEditableWarning:1,suppressHydrationWarning:1,surfaceScale:1,systemLanguage:1,tableValues:1,targetX:1,targetY:1,textAnchor:1,"text-anchor":"textAnchor",textDecoration:1,"text-decoration":"textDecoration",textLength:1,textRendering:1,"text-rendering":"textRendering",to:0,transform:0,typeof:0,u1:0,u2:0,underlinePosition:1,"underline-position":"underlinePosition",underlineThickness:1,"underline-thickness":"underlineThickness",unicode:0,unicodeBidi:1,"unicode-bidi":"unicodeBidi",unicodeRange:1,"unicode-range":"unicodeRange",unitsPerEm:1,"units-per-em":"unitsPerEm",unselectable:0,vAlphabetic:1,"v-alphabetic":"vAlphabetic",values:0,vectorEffect:1,"vector-effect":"vectorEffect",version:0,vertAdvY:1,"vert-adv-y":"vertAdvY",vertOriginX:1,"vert-origin-x":"vertOriginX",vertOriginY:1,"vert-origin-y":"vertOriginY",vHanging:1,"v-hanging":"vHanging",vIdeographic:1,"v-ideographic":"vIdeographic",viewBox:1,viewTarget:1,visibility:0,vMathematical:1,"v-mathematical":"vMathematical",vocab:0,widths:0,wordSpacing:1,"word-spacing":"wordSpacing",writingMode:1,"writing-mode":"writingMode",x1:0,x2:0,x:0,xChannelSelector:1,xHeight:1,"x-height":"xHeight",xlinkActuate:1,"xlink:actuate":"xlinkActuate",xlinkArcrole:1,"xlink:arcrole":"xlinkArcrole",xlinkHref:1,"xlink:href":"xlinkHref",xlinkRole:1,"xlink:role":"xlinkRole",xlinkShow:1,"xlink:show":"xlinkShow",xlinkTitle:1,"xlink:title":"xlinkTitle",xlinkType:1,"xlink:type":"xlinkType",xmlBase:1,"xml:base":"xmlBase",xmlLang:1,"xml:lang":"xmlLang",xmlns:0,"xml:space":"xmlSpace",xmlnsXlink:1,"xmlns:xlink":"xmlnsXlink",xmlSpace:1,y1:0,y2:0,y:0,yChannelSelector:1,z:0,zoomAndPan:1},ui}var ph;function r$(){if(ph)return un;ph=1;const e=0,t=1,n=2,r=3,o=4,i=5,s=6;function a(E){return c.hasOwnProperty(E)?c[E]:null}function l(E,C,k,T,P,z,D){this.acceptsBooleans=C===n||C===r||C===o,this.attributeName=T,this.attributeNamespace=P,this.mustUseProperty=k,this.propertyName=E,this.type=C,this.sanitizeURL=z,this.removeEmptyString=D}const c={};["children","dangerouslySetInnerHTML","defaultValue","defaultChecked","innerHTML","suppressContentEditableWarning","suppressHydrationWarning","style"].forEach(E=>{c[E]=new l(E,e,!1,E,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(([E,C])=>{c[E]=new l(E,t,!1,C,null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(E=>{c[E]=new l(E,n,!1,E.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(E=>{c[E]=new l(E,n,!1,E,null,!1,!1)}),["allowFullScreen","async","autoFocus","autoPlay","controls","default","defer","disabled","disablePictureInPicture","disableRemotePlayback","formNoValidate","hidden","loop","noModule","noValidate","open","playsInline","readOnly","required","reversed","scoped","seamless","itemScope"].forEach(E=>{c[E]=new l(E,r,!1,E.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(E=>{c[E]=new l(E,r,!0,E,null,!1,!1)}),["capture","download"].forEach(E=>{c[E]=new l(E,o,!1,E,null,!1,!1)}),["cols","rows","size","span"].forEach(E=>{c[E]=new l(E,s,!1,E,null,!1,!1)}),["rowSpan","start"].forEach(E=>{c[E]=new l(E,i,!1,E.toLowerCase(),null,!1,!1)});const f=/[\-\:]([a-z])/g,p=E=>E[1].toUpperCase();["accent-height","alignment-baseline","arabic-form","baseline-shift","cap-height","clip-path","clip-rule","color-interpolation","color-interpolation-filters","color-profile","color-rendering","dominant-baseline","enable-background","fill-opacity","fill-rule","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","horiz-adv-x","horiz-origin-x","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","overline-position","overline-thickness","paint-order","panose-1","pointer-events","rendering-intent","shape-rendering","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-rendering","underline-position","underline-thickness","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","vector-effect","vert-adv-y","vert-origin-x","vert-origin-y","word-spacing","writing-mode","xmlns:xlink","x-height"].forEach(E=>{const C=E.replace(f,p);c[C]=new l(C,t,!1,E,null,!1,!1)}),["xlink:actuate","xlink:arcrole","xlink:role","xlink:show","xlink:title","xlink:type"].forEach(E=>{const C=E.replace(f,p);c[C]=new l(C,t,!1,E,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(E=>{const C=E.replace(f,p);c[C]=new l(C,t,!1,E,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(E=>{c[E]=new l(E,t,!1,E.toLowerCase(),null,!1,!1)});const h="xlinkHref";c[h]=new l("xlinkHref",t,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(E=>{c[E]=new l(E,t,!1,E.toLowerCase(),null,!0,!0)});const{CAMELCASE:x,SAME:g,possibleStandardNames:y}=n$(),b=":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"+"\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",w=RegExp.prototype.test.bind(new RegExp("^(data|aria)-["+b+"]*$")),S=Object.keys(y).reduce((E,C)=>{const k=y[C];return k===g?E[C]=C:k===x?E[C.toLowerCase()]=C:E[C]=k,E},{});return un.BOOLEAN=r,un.BOOLEANISH_STRING=n,un.NUMERIC=i,un.OVERLOADED_BOOLEAN=o,un.POSITIVE_NUMERIC=s,un.RESERVED=e,un.STRING=t,un.getPropertyInfo=a,un.isCustomAttribute=w,un.possibleStandardNames=S,un}var di={},lo={},Kl,hh;function o$(){if(hh)return Kl;hh=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
656
+ `,c="/",u="*",f="",p="comment",h="declaration";Kl=function(g,y){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];y=y||{};var v=1,b=1;function w(M){var _=M.match(t);_&&(v+=_.length);var N=M.lastIndexOf(l);b=~N?M.length-N:b+M.length}function S(){var M={line:v,column:b};return function(_){return _.position=new E(M),T(),_}}function E(M){this.start=M,this.end={line:v,column:b},this.source=y.source}E.prototype.content=g;function C(M){var _=new Error(y.source+":"+v+":"+b+": "+M);if(_.reason=M,_.filename=y.source,_.line=v,_.column=b,_.source=g,!y.silent)throw _}function k(M){var _=M.exec(g);if(_){var N=_[0];return w(N),g=g.slice(N.length),_}}function T(){k(n)}function P(M){var _;for(M=M||[];_=z();)_!==!1&&M.push(_);return M}function z(){var M=S();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var _=2;f!=g.charAt(_)&&(u!=g.charAt(_)||c!=g.charAt(_+1));)++_;if(_+=2,f===g.charAt(_-1))return C("End of comment missing");var N=g.slice(2,_-2);return b+=2,w(N),g=g.slice(_),b+=2,M({type:p,comment:N})}}function D(){var M=S(),_=k(r);if(_){if(z(),!k(o))return C("property missing ':'");var N=k(i),A=M({type:h,property:x(_[0].replace(e,f)),value:N?x(N[0].replace(e,f)):f});return k(s),A}}function $(){var M=[];P(M);for(var _;_=D();)_!==!1&&(M.push(_),P(M));return M}return T(),$()};function x(g){return g?g.replace(a,f):f}return Kl}var mh;function i$(){if(mh)return lo;mh=1;var e=lo&&lo.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(lo,"__esModule",{value:!0}),lo.default=n;var t=e(o$());function n(r,o){var i=null;if(!r||typeof r!="string")return i;var s=(0,t.default)(r),a=typeof o=="function";return s.forEach(function(l){if(l.type==="declaration"){var c=l.property,u=l.value;a?o(c,u,l):u&&(i=i||{},i[c]=u)}}),i}return lo}var fi={},gh;function s$(){if(gh)return fi;gh=1,Object.defineProperty(fi,"__esModule",{value:!0}),fi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},s=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(o,a):c=c.replace(r,a),c.replace(t,s))};return fi.camelCase=l,fi}var pi,xh;function a$(){if(xh)return pi;xh=1;var e=pi&&pi.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(i$()),n=s$();function r(o,i){var s={};return!o||typeof o!="string"||(0,t.default)(o,function(a,l){a&&l&&(s[(0,n.camelCase)(a,i)]=l)}),s}return r.default=r,pi=r,pi}var yh;function pw(){return yh||(yh=1,function(e){var t=di&&di.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(e,"__esModule",{value:!0}),e.returnFirstArg=e.canTextBeChildOfNode=e.ELEMENTS_WITH_NO_TEXT_CHILDREN=e.PRESERVE_CUSTOM_ATTRIBUTES=void 0,e.isCustomComponent=i,e.setStyleProp=a;var n=Ea(),r=t(a$()),o=new Set(["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"]);function i(u,f){return u.includes("-")?!o.has(u):!!(f&&typeof f.is=="string")}var s={reactCompat:!0};function a(u,f){if(typeof u=="string"){if(!u.trim()){f.style={};return}try{f.style=(0,r.default)(u,s)}catch{f.style={}}}}e.PRESERVE_CUSTOM_ATTRIBUTES=Number(n.version.split(".")[0])>=16,e.ELEMENTS_WITH_NO_TEXT_CHILDREN=new Set(["tr","tbody","thead","tfoot","colgroup","table","head","html","frameset"]);var l=function(u){return!e.ELEMENTS_WITH_NO_TEXT_CHILDREN.has(u.name)};e.canTextBeChildOfNode=l;var c=function(u){return u};e.returnFirstArg=c}(di)),di}var vh;function hw(){if(vh)return Ts;vh=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.default=i;var e=r$(),t=pw(),n=["checked","value"],r=["input","select","textarea"],o={reset:!0,submit:!0};function i(a,l){a===void 0&&(a={});var c={},u=!!(a.type&&o[a.type]);for(var f in a){var p=a[f];if((0,e.isCustomAttribute)(f)){c[f]=p;continue}var h=f.toLowerCase(),x=s(h);if(x){var g=(0,e.getPropertyInfo)(x);switch(n.includes(x)&&r.includes(l)&&!u&&(x=s("default"+h)),c[x]=p,g&&g.type){case e.BOOLEAN:c[x]=!0;break;case e.OVERLOADED_BOOLEAN:p===""&&(c[x]=!0);break}continue}t.PRESERVE_CUSTOM_ATTRIBUTES&&(c[f]=p)}return(0,t.setStyleProp)(a.style,c),c}function s(a){return e.possibleStandardNames[a]}return Ts}var co={},wh;function l$(){if(wh)return co;wh=1;var e=co&&co.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(co,"__esModule",{value:!0}),co.default=i;var t=Ea(),n=e(hw()),r=pw(),o={cloneElement:t.cloneElement,createElement:t.createElement,isValidElement:t.isValidElement};function i(a,l){l===void 0&&(l={});for(var c=[],u=typeof l.replace=="function",f=l.transform||r.returnFirstArg,p=l.library||o,h=p.cloneElement,x=p.createElement,g=p.isValidElement,y=a.length,v=0;v<y;v++){var b=a[v];if(u){var w=l.replace(b,v);if(g(w)){y>1&&(w=h(w,{key:w.key||v})),c.push(f(w,b,v));continue}}if(b.type==="text"){var S=!b.data.trim().length;if(S&&b.parent&&!(0,r.canTextBeChildOfNode)(b.parent)||l.trim&&S)continue;c.push(f(b.data,b,v));continue}var E=b,C={};s(E)?((0,r.setStyleProp)(E.attribs.style,E.attribs),C=E.attribs):E.attribs&&(C=(0,n.default)(E.attribs,E.name));var k=void 0;switch(b.type){case"script":case"style":b.children[0]&&(C.dangerouslySetInnerHTML={__html:b.children[0].data});break;case"tag":b.name==="textarea"&&b.children[0]?C.defaultValue=b.children[0].data:b.children&&b.children.length&&(k=i(b.children,l));break;default:continue}y>1&&(C.key=v),c.push(f(x(b.name,C,k),b,v))}return c.length===1?c[0]:c}function s(a){return r.PRESERVE_CUSTOM_ATTRIBUTES&&a.type==="tag"&&(0,r.isCustomComponent)(a.name,a.attribs)}return co}var bh;function c$(){return bh||(bh=1,function(e){var t=ci&&ci.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(e,"__esModule",{value:!0}),e.htmlToDOM=e.domToReact=e.attributesToProps=e.Text=e.ProcessingInstruction=e.Element=e.Comment=void 0,e.default=a;var n=t(t$());e.htmlToDOM=n.default;var r=t(hw());e.attributesToProps=r.default;var o=t(l$());e.domToReact=o.default;var i=dw();Object.defineProperty(e,"Comment",{enumerable:!0,get:function(){return i.Comment}}),Object.defineProperty(e,"Element",{enumerable:!0,get:function(){return i.Element}}),Object.defineProperty(e,"ProcessingInstruction",{enumerable:!0,get:function(){return i.ProcessingInstruction}}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return i.Text}});var s={lowerCaseAttributeNames:!1};function a(l,c){if(typeof l!="string")throw new TypeError("First argument must be a string");return l?(0,o.default)((0,n.default)(l,(c==null?void 0:c.htmlparser2)||s),c):[]}}(ci)),ci}var mw=c$();const Eh=Xc(mw),u$=Eh.default||Eh,d$={replace:e=>{e instanceof mw.Element&&e.attribs&&e.name==="a"&&(e.attribs.target="_blank",e.attribs.rel="noopener noreferrer")}};function ko({children:e,className:t}){if(!e)return null;try{const n=it.parse(e,{gfm:!0}),r=cv.sanitize(n,{USE_PROFILES:{html:!0}}),o=u$(r,d$);return d.jsx("div",{className:Cd(t),children:o})}catch{return d.jsx("div",{className:Cd(t),children:e})}}const f$=yr("flex items-center gap-3 px-4 py-3 text-sm font-medium transition-all border-l-4 border-solid ",{variants:{variant:{error:"bg-[var(--color-error-w10)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-error-w10)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-warning-w10)]",info:"bg-[var(--color-info-w10)] text-[var(--color-info-wMain)] border-[var(--color-info-w10)] dark:bg-[var(--color-info-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-info-w10)]",success:"bg-[var(--color-success-w10)] text-[var(--color-success-wMain)] border-[var(--color-success-w10)] dark:bg-[var(--color-success-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-success-w10)]"}},defaultVariants:{variant:"error"}}),p$={error:hu,warning:ik,info:gu,success:pS};function fd({className:e,variant:t="error",message:n,dismissible:r=!1,onDismiss:o,...i}){const s=p$[t||"error"];return d.jsxs("div",{className:He(f$({variant:t,className:e})),role:"alert","aria-live":"polite",...i,children:[d.jsx(s,{className:"size-5 shrink-0"}),d.jsx("span",{className:"flex-1",children:n}),r&&o&&d.jsx(tt,{variant:"ghost",onClick:o,"aria-label":"Dismiss",children:d.jsx(xu,{className:"size-3"})})]})}const h$=({artifact:e,message:t})=>{const{onDownload:n}=qg();return d.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-4",children:[d.jsx("div",{className:"mb-1 font-semibold",children:"Preview Coming Soon"}),d.jsx("div",{children:t}),d.jsx("div",{className:"mb-4",children:"Download file to view."}),d.jsxs(tt,{onClick:()=>n(e),children:[d.jsx(mu,{className:"h-4 w-4"}),"Download"]})]})},Xl=({children:e})=>d.jsx("div",{className:"text-muted-foreground flex h-[50vh] items-center justify-center",children:e||"No preview available"}),m$=({artifact:e})=>{const{openArtifactForPreview:t,previewFileContent:n}=Ot(),r=m.useMemo(()=>iD(e),[e]),[o,i]=m.useState(!1),[s,a]=m.useState(null);if(m.useEffect(()=>{i(!1),a(null)},[e]),m.useEffect(()=>{async function u(){try{i(!0),a(null),await t(e.filename)}catch(f){console.error("Error fetching artifact content:",f),a(f instanceof Error?f.message:"Failed to load artifact content")}finally{i(!1)}}r!=null&&r.canPreview&&u()},[e,t,r]),s)return d.jsxs("div",{className:"flex h-full w-full flex-col",children:[d.jsx(fd,{variant:"error",message:"Error rendering preview"}),d.jsx(Xl,{children:"No preview available"})]});if(o)return d.jsx(Xl,{children:d.jsx(Om,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(!r.canPreview)return d.jsx(h$,{artifact:e,message:r.reason??""});const l=nl(e.filename,e.mime_type),c=rD(n);return!l||!c?d.jsx(Xl,{children:"No preview available"}):d.jsx(Zv,{content:c,rendererType:l,mime_type:n==null?void 0:n.mime_type,setRenderError:a})},Nn={NameAsc:"name_asc",NameDesc:"name_desc",DateAsc:"date_asc",DateDesc:"date_desc"},g$=e=>{switch(e){case Nn.NameAsc:return"Name (A-Z)";case Nn.NameDesc:return"Name (Z-A)";case Nn.DateAsc:return"Date (oldest first)";case Nn.DateDesc:return"Date (newest first)"}},x$=({currentSortOption:e,onSortChange:t,children:n})=>{const r=Object.values(Nn).map(o=>({id:o,label:g$(o),onClick:()=>t(o),icon:e===o?d.jsx(Rm,{}):void 0,iconPosition:"right"}));return d.jsxs(l0,{children:[d.jsx(c0,{asChild:!0,children:n}),d.jsx(u0,{align:"end",side:"bottom",className:"bg-background min-w-[200px] p-1",sideOffset:0,children:d.jsx(Nu,{actions:r})})]})},y$=({children:e})=>{const{setIsBatchDeleteModalOpen:t}=Ot(),n=[{id:"deleteAll",label:"Delete All",onClick:()=>{t(!0)},icon:d.jsx(Bm,{}),iconPosition:"right"}];return d.jsxs(l0,{children:[d.jsx(c0,{asChild:!0,children:e}),d.jsx(u0,{align:"end",side:"bottom",className:"bg-background min-w-[200px] p-1",sideOffset:0,children:d.jsx(Nu,{actions:n})})]})},v$=()=>{const{artifacts:e,isBatchDeleteModalOpen:t,setIsBatchDeleteModalOpen:n,confirmBatchDeleteArtifacts:r,setSelectedArtifactFilenames:o}=Ot();return m.useEffect(()=>{t&&o(new Set(e.map(i=>i.filename)))},[e,t,o]),t?d.jsx(hg,{open:t,onOpenChange:n,children:d.jsxs(mg,{children:[d.jsxs(gg,{children:[d.jsx(xg,{children:"Delete All?"}),d.jsxs(yg,{children:[e.length===1?"One file":`All ${e.length} files`," will be permanently deleted."]})]}),d.jsxs("div",{className:"flex justify-end space-x-2",children:[d.jsx(tt,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),d.jsx(tt,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})}):null},w$={[Nn.NameAsc]:(e,t)=>e.filename.localeCompare(t.filename),[Nn.NameDesc]:(e,t)=>t.filename.localeCompare(e.filename),[Nn.DateAsc]:(e,t)=>e.last_modified>t.last_modified?1:-1,[Nn.DateDesc]:(e,t)=>e.last_modified<t.last_modified?1:-1},b$=()=>{const{artifacts:e,previewArtifact:t,setPreviewArtifact:n}=Ot(),[r,o]=m.useState(Nn.DateDesc),i=m.useMemo(()=>e?[...e].sort(w$[r]):[],[e,r]),s=m.useMemo(()=>t?d.jsxs("div",{className:"flex items-center gap-2 border-b p-2",children:[d.jsx(tt,{variant:"ghost",onClick:()=>n(null),children:d.jsx(eS,{})}),d.jsx("div",{className:"text-md font-semibold",children:"Preview"})]}):i.length>0&&d.jsxs("div",{className:"flex items-center justify-end border-b p-2",children:[d.jsx(x$,{currentSortOption:r,onSortChange:o,children:d.jsxs(tt,{variant:"ghost",title:"Sort By",children:[d.jsx(jm,{className:"h-5 w-5"}),d.jsx("div",{children:"Sort By"})]})},"sort-popover"),d.jsx(y$,{children:d.jsx(tt,{variant:"ghost",tooltip:"More",children:d.jsx(bS,{className:"h-5 w-5"})})},"more-popover")]}),[t,i.length,r,n]);return d.jsxs("div",{className:"flex h-full flex-col",children:[s,d.jsxs("div",{className:"flex min-h-0 flex-1",children:[!t&&d.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.map(a=>d.jsx(Qp,{artifact:a},a.filename)),e.length===0&&d.jsx("div",{className:"flex h-full items-center justify-center p-4",children:d.jsxs("div",{className:"text-muted-foreground text-center",children:[d.jsx(qs,{className:"mx-auto mb-4 h-12 w-12"}),d.jsx("div",{className:"text-lg font-medium",children:"Files"}),d.jsx("div",{className:"mt-2 text-sm",children:"No files available"})]})})]}),t&&d.jsxs("div",{className:"flex flex-1 flex-col gap-2 min-h-0 min-w-0",children:[d.jsx(Qp,{artifact:t,isPreview:!0},t.filename),d.jsx("div",{className:"flex-1 min-h-0 min-w-0 overflow-y-auto",children:d.jsx(m$,{artifact:t})})]})]}),d.jsx(g3,{}),d.jsx(v$,{})]})},E$=({onCollapsedToggle:e,isSidePanelCollapsed:t,setIsSidePanelCollapsed:n,isSidePanelTransitioning:r})=>{const{activeSidePanelTab:o,setActiveSidePanelTab:i,taskIdInSidePanel:s}=Ot(),{monitoredTasks:a}=Tu(),[l,c]=m.useState(null);m.useEffect(()=>{if(s&&a[s]){const p=a[s],h=FP(p.events||[],a,p);c(h)}else c(null)},[s,a]);const u=()=>{const p=!t;n(p),e(p)},f=p=>{t?(n(!1),i(p),e==null||e(!1)):i(p)};return t?d.jsxs("div",{className:"bg-background flex h-full w-full flex-col items-center border-l py-4",children:[d.jsx(tt,{variant:"ghost",size:"sm",onClick:u,className:"h-10 w-10 p-0",tooltip:"Expand Panel",children:d.jsx(Ud,{className:"size-5"})}),d.jsx("div",{className:"bg-border my-4 h-px w-8"}),d.jsx(tt,{variant:"ghost",size:"sm",onClick:()=>f("files"),className:"mb-2 h-10 w-10 p-0",tooltip:"Files",children:d.jsx(qs,{className:"size-5"})}),d.jsx(tt,{variant:"ghost",size:"sm",onClick:()=>f("workflow"),className:"h-10 w-10 p-0",tooltip:"Workflow",children:d.jsx(Rs,{className:"size-5"})})]}):d.jsx("div",{className:"bg-background flex h-full flex-col border-l",children:d.jsx("div",{className:"m-1 min-h-0 flex-1",children:d.jsxs(NT,{value:o,onValueChange:p=>i(p),className:"flex h-full flex-col",children:[d.jsxs("div",{className:"flex gap-2 p-2",children:[d.jsx(tt,{variant:"ghost",onClick:u,className:"p-1",tooltip:"Collapse Panel",children:d.jsx(Ud,{className:"size-5"})}),d.jsxs(jT,{className:"grid w-full grid-cols-2 bg-transparent p-0",children:[d.jsxs(hf,{value:"files",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-l-md border border-r-0 data-[state=active]:z-10 data-[state=active]:border-r-0",children:[d.jsx(qs,{className:"mr-2 h-4 w-4"}),"Files"]}),d.jsxs(hf,{value:"workflow",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-r-md border border-l-0 data-[state=active]:z-10 data-[state=active]:border-l-0",children:[d.jsx(Rs,{className:"mr-2 h-4 w-4"}),"Workflow"]})]})]}),d.jsxs("div",{className:"min-h-0 flex-1",children:[d.jsx(mf,{value:"files",className:"m-0 h-full",children:d.jsx("div",{className:"h-full",children:d.jsx(b$,{})})}),d.jsx(mf,{value:"workflow",className:"m-0 h-full",children:d.jsx("div",{className:"h-full",children:l?d.jsx(LP,{processedSteps:l.steps||[],isRightPanelVisible:!1,isSidePanelTransitioning:r}):d.jsx("div",{className:"flex h-full items-center justify-center p-4",children:d.jsxs("div",{className:"text-muted-foreground text-center",children:[d.jsx(Rs,{className:"mx-auto mb-4 h-12 w-12"}),d.jsx("div",{className:"text-lg font-medium",children:"Workflow"}),d.jsx("div",{className:"mt-2 text-sm",children:s?"Loading workflow data...":"No task selected to display"})]})})})})]})]})})})},S$=({statusText:e,onViewWorkflow:t})=>d.jsxs("div",{className:"flex h-8 items-center space-x-3 py-1",children:[d.jsx(LT,{}),d.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:[e&&d.jsx("span",{className:"text-muted-foreground animate-pulse truncate text-sm",title:e,children:e}),t&&d.jsx(Hm,{onClick:t})]})]}),k$=({onToggle:e})=>{const{handleNewSession:t}=Ot(),n=()=>{t()};return d.jsxs("div",{className:"bg-background flex h-full w-100 flex-col border-r",children:[d.jsxs("div",{className:"flex items-center justify-between px-4 pt-[35px] pb-3",children:[d.jsx(tt,{variant:"ghost",onClick:e,className:"p-2",tooltip:"Collapse Sessions Panel",children:d.jsx(Lm,{className:"size-5"})}),d.jsxs(tt,{variant:"ghost",onClick:n,tooltip:"Start New Chat Session",children:[d.jsx(Fm,{className:"size-5"}),"New chat"]})]}),d.jsx("div",{className:"mt-1 min-h-0 flex-1",children:d.jsx(h3,{})})]})},gw=({title:e,tabs:t,buttons:n,leadingAction:r})=>d.jsxs("div",{className:"flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[r&&d.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:r}),d.jsx("div",{className:"truncate pt-[35px] text-xl text-nowrap",children:e}),t&&t.length>0&&d.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:t.map((o,i)=>d.jsxs("button",{role:"tab","aria-selected":o.isActive,onClick:o.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${o.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[o.label,o.isActive&&d.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},o.id))}),d.jsx("div",{className:"flex-1"}),n&&n.length>0&&d.jsx("div",{className:"flex items-center gap-2",children:n.map((o,i)=>d.jsx(Pt.Fragment,{children:o},i))})]}),bt=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:d.jsxs("div",{className:`flex mb-1.5 text-sm ${r?"flex-col items-start":"items-center"}`,children:[d.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&d.jsx("span",{className:"mr-2",children:n}),e,":"]}),d.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),C$=({agent:e,isExpanded:t,onToggleExpand:n})=>{var l;const r=c=>!c||Object.keys(c).length===0?d.jsx("span",{className:"text-sm",children:"N/A"}):d.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(c).map(([u,f])=>d.jsxs("li",{className:"text-sm",children:[d.jsxs("span",{className:"capitalize",children:[u.replace(/_/g," "),":"]})," ",f?"Yes":"No"]},u))}),o=(c,u="None")=>!c||c.length===0?d.jsx("span",{children:u}):c.map(f=>d.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:f},f)),i=c=>!c||c.length===0?d.jsx("span",{children:"No skills listed"}):d.jsx("div",{className:"space-y-1",children:c.map(u=>d.jsxs("div",{className:"rounded p-1.5 text-xs",children:[d.jsx("p",{className:"font-semibold",children:u.name}),d.jsx("p",{children:u.description})]},u.id||u.name))}),s=c=>!c||c.length===0?d.jsx("span",{children:"No tools listed"}):d.jsx("div",{className:"space-y-1",children:c.map(u=>d.jsxs("div",{className:"rounded p-1.5 text-xs",children:[d.jsx("p",{className:"font-semibold text-foreground",children:u.name}),d.jsx("p",{className:"mb-1",children:u.description})]},u.name))}),a=c=>!c||Object.keys(c).length===0?d.jsx("span",{children:"N/A"}):d.jsx("div",{className:"ml-1 border-l pl-2",children:Object.entries(c).map(([u,f])=>d.jsx(bt,{label:u.replace(/_/g," "),value:typeof f=="object"?d.jsx("span",{children:JSON.stringify(f)}):String(f)},u))});return d.jsx("div",{className:"h-[400px] cursor-pointer w-full sm:w-[380px] flex-shrink-0 bg-card rounded-lg",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:d.jsxs("div",{className:`transform-style-preserve-3d relative h-full w-full transition-transform duration-700 ${t?"rotate-y-180":""}`,style:{transformStyle:"preserve-3d"},children:[d.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(0deg)"},children:[d.jsx("div",{className:"flex items-center p-4",children:d.jsxs("div",{className:"flex min-w-0 items-center",children:[d.jsx(Im,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),d.jsx("div",{className:"min-w-0",children:d.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.display_name||e.name})})]})}),d.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[e.description&&d.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description}),!e.description&&d.jsx("div",{className:"mb-2 text-base",children:"No description provided."}),d.jsx(bt,{label:"Version",value:e.version,icon:d.jsx(Hd,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&d.jsx(bt,{label:"Key Capabilities",value:r(e.capabilities),icon:d.jsx(Vd,{size:14}),fullWidthValue:!0})]}),d.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for details"})]}),d.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:[d.jsx("div",{className:"flex items-center p-3",children:d.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.display_name||e.name]})}),d.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[d.jsx(bt,{label:"Name",value:e.name,icon:d.jsx(gu,{size:14})}),d.jsx(bt,{label:"Description",value:e.description,icon:d.jsx(oS,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Version",value:e.version,icon:d.jsx(Hd,{size:14})}),d.jsx(bt,{label:"Endpoint",value:e.url||"N/A",icon:d.jsx(BS,{size:14})}),d.jsx(bt,{label:"Docs",value:e.documentationUrl?d.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:d.jsx($m,{size:14})}),d.jsx(bt,{label:"Last Seen",value:Ib(e.last_seen),icon:d.jsx(mS,{size:14})}),e.provider&&d.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[d.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),d.jsx(bt,{label:"Name",value:e.provider.name}),d.jsx(bt,{label:"URL",value:e.provider.url||"N/A"})]}),e.authentication&&e.authentication.type!=="none"&&d.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[d.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Authentication"}),d.jsx(bt,{label:"Type",value:e.authentication.type,icon:d.jsx(ek,{size:14})}),d.jsx(bt,{label:"Token URL",value:e.authentication.token_url}),d.jsx(bt,{label:"Scopes",value:(l=e.authentication.scopes)==null?void 0:l.join(", ")})]}),d.jsx(bt,{label:"Capabilities",value:r(e.capabilities),icon:d.jsx(Vd,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Input Modes",value:o(e.defaultInputModes),icon:d.jsx(zd,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:d.jsx(zd,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Skills",value:i(e.skills),icon:d.jsx(lk,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Tools Info",value:s(e.tools),icon:d.jsx(Pm,{size:14}),fullWidthValue:!0}),d.jsx(bt,{label:"Model Settings",value:a(e.model_settings),icon:d.jsx(QS,{size:14}),fullWidthValue:!0}),d.jsxs("div",{className:"text-2xs mt-1.5 pt-1.5",children:[d.jsx(bt,{label:"A2A Protocol",value:e.a2a_protocol_version}),d.jsx(bt,{label:"ADK Version",value:e.adk_version}),d.jsx(bt,{label:"SAC Version",value:e.sac_version})]})]}),d.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for summary"})]})]})})},Vc=({agents:e})=>{const[t,n]=m.useState(null),[r,o]=m.useState(""),i=a=>{n(l=>l===a?null:a)},s=e.filter(a=>{var l;return(l=(a==null?void 0:a.display_name)||a.name)==null?void 0:l.toLowerCase().includes(r.toLowerCase())});return d.jsx("div",{children:e.length===0?d.jsx("div",{className:"flex h-[calc(100vh-250px)] items-center justify-center",children:"No agents discovered in the current namespace."}):d.jsxs("div",{className:"mx-auto mt-[50px] ml-[50px]",children:[d.jsx("div",{className:"my-4",children:d.jsx("input",{type:"text",placeholder:"Search...",value:r,onChange:a=>o(a.target.value),className:"bg-background rounded-md border px-3 py-2"})}),s.length===0&&r?d.jsxs("div",{className:"flex h-[calc(100vh-250px)] flex-col items-center justify-center gap-6",children:["No agents match your search.",d.jsx(tt,{variant:"outline",onClick:()=>o(""),children:"Clear Search"})]}):d.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:d.jsx("div",{className:"flex flex-wrap gap-10",children:s.map(a=>d.jsx(C$,{agent:a,isExpanded:t===a.name,onToggleExpand:()=>i(a.name)},a.name))})})]})})},xw={LAYOUT:"layout"},_$=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=yw.getPluginsByType(xw.LAYOUT);return r&&r.length>1?d.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[d.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),d.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const i=o.icon,s=e===o.id;return d.jsxs(tt,{variant:"ghost",size:"sm",onClick:()=>t(o.id),title:o.label,className:s?"bg-[var(--color-secondary-w20)] dark:bg-[var(--color-secondary-w80)]":"",children:[i&&d.jsx(i,{size:14}),d.jsx("span",{children:o.label})]},o.id)})})]}):null};class T${constructor(){ut(this,"_plugins",{});this.registerDefaultPlugins()}get plugins(){return Object.values(this._plugins)}registerPlugin(t){this._plugins[t.id]&&console.warn(`Plugin with ID ${t.id} already exists. Overwriting.`),this._plugins[t.id]=t}getPluginById(t){return this._plugins[t]}getPluginsByType(t){return Object.values(this._plugins).filter(n=>n.type===t)}registerDefaultPlugins(){this.registerPlugin({type:xw.LAYOUT,id:"cards",label:"Cards",icon:LS,priority:100,render:t=>d.jsx(Vc,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const yw=new T$,Sh={CARDS:"cards"};function A$(){const{agents:e,isLoading:t,error:n}=Gg(),[r,o]=m.useState("cards");if(t)return d.jsx("div",{className:"space-y-6",children:d.jsx("div",{className:"flex h-96 items-center justify-center",children:d.jsx("div",{children:"Loading agents..."})})});if(n)return d.jsx("div",{className:"space-y-6",children:d.jsx("div",{className:"flex h-96 items-center justify-center",children:d.jsx(fd,{variant:"error",message:`Error loading agents. ${n}`})})});const i=()=>{if(r===Sh.CARDS)return d.jsx(Vc,{agents:e});const s=yw.getPluginById(r);return s?s.render({agents:e}):(console.warn(`Layout ${r} not found, falling back to cards layout`),d.jsx(Vc,{agents:e}))};return d.jsxs("div",{className:"flex h-full w-full flex-col",children:[d.jsx(gw,{title:"Agents"}),d.jsxs("div",{className:`relative flex-1 p-4 ${r===Sh.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[d.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:d.jsx(_$,{currentLayout:r,onLayoutChange:o})}),i()]})]})}const As=4,Uc={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},N$={chatPanelSizes:{...Uc.chatPanelSizes,min:50},sidePanelSizes:{...Uc.sidePanelSizes,max:50}};function j$(){const{sessionId:e,messages:t,setMessages:n,selectedAgentName:r,setSelectedAgentName:o,isSidePanelCollapsed:i,setIsSidePanelCollapsed:s,handleNewSession:a,openSidePanelTab:l,setTaskIdInSidePanel:c}=Ot(),[u,f]=m.useState(!0),[p,h]=m.useState(!1),x=Kg(),{isTaskMonitorConnected:g,isTaskMonitorConnecting:y,taskMonitorSseError:v,connectTaskMonitorStream:b}=Tu(),w=m.useRef(null),S=m.useRef(null),{chatPanelSizes:E,sidePanelSizes:C}=m.useMemo(()=>u?Uc:N$,[u]),k=m.useCallback(A=>{if(h(!0),w.current)if(A)w.current.resize(As);else{const I=S.current||C.default;w.current.resize(I)}setTimeout(()=>h(!1),300)},[C.default]),T=m.useCallback(()=>{s(!0)},[s]),P=m.useCallback(()=>{s(!1)},[s]),z=m.useCallback(A=>{A>As+1&&(S.current=A)},[]),D=m.useCallback(()=>{f(!u)},[u]);m.useEffect(()=>{w.current&&i&&w.current.resize(As);const A=()=>{if(w.current&&i){h(!0);const I=S.current||C.default;w.current.resize(I),s(!1),setTimeout(()=>h(!1),300)}};return window.addEventListener("expand-side-panel",A),()=>{window.removeEventListener("expand-side-panel",A)}},[i,s,C.default]);const{agents:$}=Gg();m.useEffect(()=>{if(!r&&$.length>0){const A=$.find(O=>O.name==="OrchestratorAgent"),I=A?A.name:$[0].name;o(I);const j=$.find(O=>O.name===I),R=j!=null&&j.display_name?`Hi! I'm the ${j==null?void 0:j.display_name} Agent. How can I help?`:`Hi! I'm ${I}. How can I help?`;n(O=>[...O.filter(Y=>!Y.isStatusBubble),{text:R,isUser:!1,isComplete:!0,metadata:{sessionId:e,lastProcessedEventSequence:0}}])}},[$,r,e,n,o]);const M=m.useMemo(()=>{const A=new Map;return t.forEach((I,j)=>{I.taskId&&A.set(I.taskId,j)}),A},[t]),_=m.useMemo(()=>t.find(A=>A.isStatusBubble),[t]),N=m.useMemo(()=>{if(_!=null&&_.taskId)return()=>{c(_.taskId),l("workflow")}},[_==null?void 0:_.taskId,c,l]);return m.useEffect(()=>{const A=()=>{!g&&!y&&v&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),b())};return window.addEventListener("focus",A),()=>{window.removeEventListener("focus",A)}},[g,y,v,b]),d.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[d.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${u?"-translate-x-full":"translate-x-0"}`,children:d.jsx(k$,{onToggle:D})}),d.jsx("div",{className:`transition-all duration-300 ${u?"ml-0":"ml-100"}`,children:d.jsx(gw,{title:x,leadingAction:u?d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(tt,{variant:"ghost",onClick:D,className:"h-10 w-10 p-0",tooltip:"Show Sessions Panel",children:d.jsx(Lm,{className:"size-5"})}),d.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),d.jsx(tt,{variant:"ghost",onClick:a,className:"h-10 w-10 p-0",tooltip:"Start New Chat Session",children:d.jsx(Fm,{className:"size-5"})})]}):null})}),d.jsx("div",{className:"flex min-h-0 flex-1",children:d.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${u?"ml-0":"ml-100"}`,children:d.jsxs(XC,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[d.jsx(ff,{defaultSize:E.default,minSize:E.min,maxSize:E.max,id:"chat-panel",children:d.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[d.jsx(lx,{className:"text-base",children:t.map((A,I)=>{var R;const j=!!(A.taskId&&M.get(A.taskId)===I);return d.jsx(p3,{message:A,isLastWithTaskId:j},`${((R=A.metadata)==null?void 0:R.sessionId)||"session"}-${I}-${A.isUser?"received":"sent"}`)})}),d.jsxs("div",{style:ax,children:[_&&d.jsx(S$,{statusText:_.text,onViewWorkflow:N}),d.jsx(WP,{agents:$})]})]})}),d.jsx(ZC,{}),d.jsx(ff,{ref:w,defaultSize:C.default,minSize:C.min,maxSize:C.max,collapsedSize:As,collapsible:!0,onCollapse:T,onExpand:P,onResize:z,id:"chat-side-panel",className:p?"transition-all duration-300 ease-in-out":"",children:d.jsx("div",{className:"h-full",children:d.jsx(E$,{onCollapsedToggle:k,isSidePanelCollapsed:i,setIsSidePanelCollapsed:s,isSidePanelTransitioning:p})})})]})})})]})}const Ir=(e,t,n,r,o)=>{if(!r)throw new Error(o??`Invalid property path: ${t}
657
+ Couldn't access "${n}" in ${JSON.stringify(e)}`)},kh=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Vs=e=>Array.isArray(e),vw=(e,t)=>e.filter((n,r)=>r!==t),I$=(e,t,n,r={})=>{const{remove:o=!1,createNew:i=!0,noError:s=!1}=r,a=e,l=typeof(c=t)=="string"?c:typeof c=="number"?String(c):c.reduce((p,h)=>typeof h=="number"?`${p}[${h}]`:p===""?h:`${p}.${h}`,"");var c;const u=Object.assign(Object.assign({},r),{remove:o,createNew:i,noError:s,fullData:a,fullPath:l}),f=Array.isArray(t)?t:(p=>Array.isArray(p)?p:p.split(/(\.|\[\d+\])/).filter(h=>h!=="."&&h!=="").map(h=>{const x=/\[(\d+)\]/.exec(h);return x?Number(x[1]):h}).flat())(t).filter(p=>p!=="");return Vs(e)&&o&&f.length===1?vw(e,f[0]):Si(e,f,n,u)},Si=(e,t,n,r)=>{const o=kh(e)?Object.assign({},e):null,i=Vs(e)?[...e]:null;if(t.length===0)return e;if(!o&&!i)throw new Error("Can't assign property -- invalid input object");const{createNew:s,remove:a,noError:l,fullData:c,fullPath:u}=r,f=t[0];if(i&&typeof f=="string")return i.map(g=>Si(g,t,n,r));if(t.length===1){if(o&&typeof f=="string"){const g=R$(o,f,n,r);return g??o}return i&&typeof f=="number"?(M$(i,f,n,r),i):(Ir(c,u,f,l),e)}const p=o||i||[];if(a&&t.length===2&&typeof t[1]=="number"){const g=p[f],y=t[1];return Vs(g)?p[f]=vw(g,y):Ir(c,u,f,l,"Trying to remove an indexed item from an object that is not an array"),p}const h=t.slice(1);if(f in e){if(x=p[f],!Vs(x)&&!kh(x)){if(!s)return Ir(c,u,f,l),p;p[f]={}}return p[f]=Si(p[f],h,n,r),p}var x;if(s){const g=typeof h[0]=="number"?[]:{};if(o)return p[f]=g,p[f]=Si(p[f],h,n,r),p;if(i&&Array.isArray(p)){p.push(g);const y=p.length-1;return p[y]=Si(p[y],h,n,r),p}}return Ir(c,u,f,l),p},R$=(e,t,n,r)=>{const{remove:o,createNew:i,noError:s,insertAfter:a,insertBefore:l,fullData:c,fullPath:u}=r;if(l!==void 0||a!==void 0){const p=Object.entries(e);let h=1/0;return h=typeof l=="number"?l:typeof a=="number"?a:p.findIndex(([x,g])=>x===(l??a)),a&&h++,p.splice(h,0,[t,n]),Object.fromEntries(p)}const f=t in e;o?f?delete e[t]:Ir(c,u,t,s):i||f?e[t]=n:Ir(c,u,t,s)},M$=(e,t,n,r)=>{const{noError:o,fullData:i,fullPath:s,createNew:a,insert:l}=r;l&&e.splice(t,0,n),t in e?e[t]=n:a?e.push(n):Ir(i,s,t,o)},zo=(e,t,n)=>{const r=Array.isArray(t)?t:P$(t);if(r.length===0)return e;const o=r[0];if(Array.isArray(e)&&typeof o!="number")return e.map(s=>zo(s,r));if(typeof e!="object"||e===null||!(o in e))return D$(e,o);const i=e[o];return r.length===1?i:zo(i,r.slice(1))},P$=e=>e.split(/(\.|\[\d+\])/).filter(t=>t!=="."&&t!=="").map(t=>{const n=/\[(\d+)\]/.exec(t);return n?Number(n[1]):t}).flat(),D$=(e,t,n)=>{throw new Error(`Unable to extract object property
658
+ Looking for property: ${t}
659
+ In object: ${JSON.stringify(e)}`)};function ww(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function po(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(c){try{l(r.next(c))}catch(u){i(u)}}function a(c){try{l(r.throw(c))}catch(u){i(u)}}function l(c){var u;c.done?o(c.value):(u=c.value,u instanceof n?u:new n(function(f){f(u)})).then(s,a)}l((r=r.apply(e,[])).next())})}const bw=({className:e,name:t,value:n,setValue:r,handleKeyPress:o,styles:i,textAreaRef:s})=>{if(typeof n!="string")return null;const a=n.slice(-1)===`
660
+ `?n+".":n;return d.jsxs("div",{style:{display:"grid"},children:[d.jsx("textarea",{id:`${t}_textarea`,ref:s,style:Object.assign({height:"auto",gridArea:"1 / 1 / 2 / 2",overflowY:"auto",whiteSpace:"pre-wrap"},i),rows:1,className:e,name:`${t}_textarea`,value:n,onChange:l=>r(l.target.value),autoFocus:!0,onFocus:l=>{n.length<40&&l.target.select()},onKeyDown:o}),d.jsx("span",{className:e,style:Object.assign({visibility:"hidden",height:"auto",gridArea:"1 / 1 / 2 / 2",color:"red",opacity:.9,whiteSpace:"pre-wrap",overflowY:"auto",border:"1px solid transparent"},i),children:a})]})},Bo=e=>e!==null&&typeof e=="object",Ew=(e,t,n,r="")=>{if(!n&&!r)return!0;switch(e){case"collection":if(n){if(n(t,r))return!0;if(!Wc(r,t,n))return!1}if(!n&&r&&!Wc(r,t))return!1;break;case"value":if(n&&!n(t,r)||!n&&r&&!Ho(t,r))return!1}return!0},Wc=(e="",t,n=Ho)=>{const r=t.value;return Object.entries(r).some(([o,i])=>{const s=[...t.path,o],a=Object.assign(Object.assign({},t),{key:o,path:s,level:t.level+1,value:i,size:s.length,parentData:r});return Bo(i)?Wc(e,a,n):n(a,e)})},Ho=(e,t="")=>{const{value:n}=e;if(n===null&&"null".includes(t.toLowerCase()))return!0;switch(typeof n){case"string":return n.toLowerCase().includes(t.toLowerCase());case"number":return!!String(n).includes(t);case"boolean":return n?"true".includes(t.toLowerCase())||t==="1":"false".includes(t.toLowerCase())||t==="0";default:return!1}},Ch=({key:e,path:t},n="")=>!!Ho({value:e},n)||!!t.some(r=>Ho({value:r},n)),Jr=(e,t)=>(t??"")+e.map(n=>n===""?"\0":n).join("."),pd=e=>e.shiftKey?"Shift":e.metaKey?"Meta":e.ctrlKey?"Control":e.altKey?"Alt":void 0,O$=(e,t,n)=>{const r=e.key,o=pd(e);if(Array.isArray(t))return!!o&&t.includes(o);const{key:i,modifier:s}=t;return(n!=="stringLineBreak"||r!=="Enter"||o!=="Shift"||i!=="Enter"||!(s!=null&&s.includes("Shift")))&&r===i&&(s===o||Array.isArray(s)&&s.includes(o))},Tr={key:"Enter"},_h={confirm:Tr,cancel:{key:"Escape"},objectConfirm:Object.assign(Object.assign({},Tr),{modifier:["Meta","Shift","Control"]}),objectLineBreak:Tr,stringConfirm:Tr,stringLineBreak:Object.assign(Object.assign({},Tr),{modifier:["Shift"]}),numberConfirm:Tr,numberUp:{key:"ArrowUp"},numberDown:{key:"ArrowDown"},tabForward:{key:"Tab"},tabBack:{key:"Tab",modifier:"Shift"},booleanConfirm:Tr,booleanToggle:{key:" "},clipboardModifier:["Meta","Control"],collapseModifier:["Alt"]},Rr=(e,t,n="next",r)=>{const o=t.slice(0,t.length-1),i=t.slice(-1)[0];if(i===void 0)return null;const s=zo(e,o),a=L$(s);Array.isArray(s)||r(a,({key:u,value:f})=>[u,f]);const l=a.findIndex(u=>u.key===i),c=a[l+(n==="next"?1:-1)];return c?Bo(c.value)?Object.keys(c.value).length===0?Rr(e,[...o,c.key],n,r):Sw(e,[...o,c.key],n,r):[...o,c.key]:o.length===0?null:Rr(e,o,n,r)},Sw=(e,t,n="next",r)=>{const o=zo(e,t);if(!Bo(o))return t;const i=Array.isArray(o)?o.map((a,l)=>l):Object.keys(o);r(i,a=>[a,o]);const s=n==="next"?i[0]:i[i.length-1];return Sw(e,[...t,s],n,r)},L$=e=>Array.isArray(e)?e.map((t,n)=>({index:n,value:t,key:n})):Object.entries(e).map(([t,n],r)=>({key:t,value:n,index:r})),kw=(e,t)=>{var n,r,o,i;const s=e.current,a=(n=s==null?void 0:s.selectionStart)!==null&&n!==void 0?n:1/0,l=(r=s==null?void 0:s.selectionEnd)!==null&&r!==void 0?r:1/0,c=((o=s==null?void 0:s.textContent)===null||o===void 0?void 0:o.slice(0,a))+t+((i=s==null?void 0:s.textContent)===null||i===void 0?void 0:i.slice(l));return s.value=c,s==null||s.setSelectionRange(a+1,a+1),c},Gc=e=>{if(e!==Cw){if(Array.isArray(e))return e.map(t=>Gc(t));if(e&&typeof e=="object")for(const t in e)e[t]=Gc(e[t]);return e}},Cw="__​undefined__",hd={displayName:"Default",fragments:{edit:"rgb(42, 161, 152)"},styles:{container:{backgroundColor:"#f6f6f6",fontFamily:"monospace"},collection:{},collectionInner:{},collectionElement:{},dropZone:{},property:"#292929",bracket:{color:"rgb(0, 43, 54)",fontWeight:"bold"},itemCount:{color:"rgba(0, 0, 0, 0.3)",fontStyle:"italic"},string:"rgb(203, 75, 22)",number:"rgb(38, 139, 210)",boolean:"green",null:{color:"rgb(220, 50, 47)",fontVariant:"small-caps",fontWeight:"bold"},input:["#292929"],inputHighlight:"#b3d8ff",error:{fontSize:"0.8em",color:"red",fontWeight:"bold"},iconCollection:"rgb(0, 43, 54)",iconEdit:"edit",iconDelete:"rgb(203, 75, 22)",iconAdd:"edit",iconCopy:"rgb(38, 139, 210)",iconOk:"green",iconCancel:"rgb(203, 75, 22)"}},_w=m.createContext({getStyles:()=>({}),icons:{}}),$$=({theme:e=hd,icons:t={},docRoot:n,children:r})=>{const o=F$(e,n);return d.jsx(_w.Provider,{value:{getStyles:(i,s)=>typeof o[i]=="function"?o[i](s):o[i],icons:t},children:r})},$n=()=>m.useContext(_w),F$=(e,t)=>{var n,r,o,i;const s={},a=(Array.isArray(e)?e:[e]).map(u=>z$(u)?Zl({fragments:{},styles:u},s):Zl(u,s)),l=Zl(hd,{});Object.keys(l).forEach(u=>{const f=u;a.forEach(p=>{p[f]&&(l[f]=Object.assign(Object.assign({},l[f]),p[f]))})});const c=Object.assign({},l);return Object.entries(s).forEach(([u,f])=>{const p=u;c[p]=h=>{const x=f(h)||{};return Object.assign(Object.assign({},l[p]),x)}}),typeof(c==null?void 0:c.inputHighlight)!="function"&&(!((n=c==null?void 0:c.inputHighlight)===null||n===void 0)&&n.backgroundColor)&&t.style.setProperty("--jer-highlight-color",(r=c==null?void 0:c.inputHighlight)===null||r===void 0?void 0:r.backgroundColor),typeof(c==null?void 0:c.iconCopy)!="function"&&(!((o=c==null?void 0:c.iconCopy)===null||o===void 0)&&o.color)&&t.style.setProperty("--jer-icon-copy-color",(i=c==null?void 0:c.iconCopy)===null||i===void 0?void 0:i.color),c},Zl=(e,t)=>{const{fragments:n,styles:r}=e,o={};return Object.entries(r).forEach(([i,s])=>{const a=(Array.isArray(s)?s:[s]).reduce((l,c)=>{var u,f;if(typeof c=="function")return t[i]=c,Object.assign({},l);if(typeof c=="string"){const p=(u=n==null?void 0:n[c])!==null&&u!==void 0?u:c;return typeof p=="string"?Object.assign(Object.assign({},l),{[(f=B$[i])!==null&&f!==void 0?f:"color"]:p}):Object.assign(Object.assign({},l),p)}return Object.assign(Object.assign({},l),c)},{});o[i]=a}),o},z$=e=>!("styles"in e),B$={container:"backgroundColor",collection:"backgroundColor",collectionInner:"backgroundColor",collectionElement:"backgroundColor",dropZone:"borderColor",inputHighlight:"backgroundColor"},Tw=m.createContext(null),H$=({children:e,onEditEvent:t,onCollapse:n})=>{const[r,o]=m.useState(null),[i,s]=m.useState(null),[a,l]=m.useState(null),[c,u]=m.useState({path:null,pathString:null}),f=m.useRef(null),p=m.useRef("next"),h=m.useRef(null);return d.jsx(Tw.Provider,{value:{collapseState:r,setCollapseState:x=>{o(x),n&&x!==null&&(Array.isArray(x)?x.forEach(g=>n(g)):n(x)),x!==null&&setTimeout(()=>o(null),2e3)},getMatchingCollapseState:x=>{if(Array.isArray(r)){for(const g of r)if(Th(x,g))return g;return null}return Th(x,r)?r:null},currentlyEditingElement:i,setCurrentlyEditingElement:(x,g)=>{const y=typeof x=="string"||x===null?x:Jr(x,g==="key"?"key_":void 0);i!==null&&y!==null&&f.current!==null&&f.current(),s(y),t&&t(x,g==="key"),f.current=typeof g=="function"?g:null},areChildrenBeingEdited:x=>i!==null&&i.includes(x),previouslyEditedElement:h.current,setPreviouslyEditedElement:x=>{h.current=x},tabDirection:p.current,setTabDirection:x=>{p.current=x},previousValue:a,setPreviousValue:l,dragSource:c,setDragSource:u},children:e})},Zr=()=>{const e=m.useContext(Tw);if(!e)throw new Error("Missing Context Provider");return e},Th=(e,t)=>{if(t===null)return!1;if(!t.includeChildren)return t.path.every((n,r)=>e[r]===n)&&t.path.length===e.length;for(const[n,r]of t.path.entries())if(r!==e[n])return!1;return!0},Yc="**INVALID_FUNCTION**",V$=({nodeData:e,showStringQuotes:t=!0,stringTruncate:n=200,pathString:r,canEdit:o,setIsEditing:i,styles:s,translate:a,value:l,TextWrapper:c=({children:u})=>u})=>{const u=l??e.value,[f,p]=m.useState(!1),h=t?'"':"",x=u.length>n,g=()=>{o?i(!0):p(!f)};return d.jsxs("div",{id:`${r}_display`,onDoubleClick:g,onClick:y=>{(y.getModifierState("Control")||y.getModifierState("Meta"))&&g()},className:"jer-value-string",style:s,children:[h,x?d.jsxs(d.Fragment,f?{children:[d.jsx(c,{children:d.jsxs("span",{children:[u,h]})}),d.jsxs("span",{className:"jer-string-expansion jer-show-less",onClick:()=>p(!1),children:[" ",a("SHOW_LESS",e)]})]}:{children:[d.jsxs(c,{children:[d.jsx("span",{children:u.slice(0,n-2).trimEnd()})," "]}),d.jsx("span",{className:"jer-string-expansion jer-ellipsis",onClick:()=>p(!0),children:"..."}),h]}):d.jsx(c,{children:`${u}${h}`})]})},U$=({styles:e,pathString:t,value:n,setValue:r,handleEdit:o,handleKeyboard:i,keyboardCommon:s})=>{const a=m.useRef(null);return d.jsx(bw,{className:"jer-input-text",textAreaRef:a,name:t,value:n,setValue:r,handleKeyPress:l=>{i(l,Object.assign({stringConfirm:o,stringLineBreak:()=>{const c=kw(a,`
661
+ `);r(c)}},s))},styles:e})},W$=e=>{var{isEditing:t,path:n,enumType:r}=e,o=ww(e,["isEditing","path","enumType"]);const{getStyles:i}=$n(),s=Jr(n),{value:a,setValue:l,nodeData:c,handleEdit:u,handleKeyboard:f,keyboardCommon:p}=o;return t&&r?d.jsxs("div",{className:"jer-select jer-select-enums",children:[d.jsx("select",{name:`${s}-value-select`,className:"jer-select-inner",onChange:h=>l(h.target.value),value:a,autoFocus:!0,onKeyDown:h=>{f(h,Object.assign({stringConfirm:u},p))},children:r.values.map(h=>d.jsx("option",{value:h,children:h},h))}),d.jsx("span",{className:"focus"})]}):t?d.jsx(U$,Object.assign({styles:i("input",c),pathString:s},o,{setValue:o.setValue})):d.jsx(V$,Object.assign({pathString:s,styles:i("string",c)},o))},G$=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:o,handleEdit:i,nodeData:s,handleKeyboard:a,keyboardCommon:l})=>{const{getStyles:c}=$n();return n?d.jsx("input",{className:"jer-input-number",type:"text",name:Jr(r),value:e,onChange:u=>t(u.target.value.replace(/[^0-9.-]/g,"")),autoFocus:!0,onFocus:u=>setTimeout(()=>u.target.select(),10),onKeyDown:u=>a(u,Object.assign({numberConfirm:i,numberUp:()=>t(Number(e)+1),numberDown:()=>t(Number(e)-1)},l)),style:Object.assign({width:String(e).length/1.5+2+"em"},c("input",s))}):d.jsx("span",{onDoubleClick:()=>o(!0),className:"jer-value-number",style:c("number",s),children:e})},Y$=({value:e,setValue:t,isEditing:n,path:r,setIsEditing:o,handleEdit:i,nodeData:s,handleKeyboard:a,keyboardCommon:l})=>{const{getStyles:c}=$n();return typeof e!="boolean"?null:n?d.jsx("input",{className:"jer-input-boolean",type:"checkbox",name:Jr(r),checked:e,onChange:()=>t(!e),onKeyDown:u=>{u.key===" "&&u.preventDefault(),a(u,Object.assign({booleanConfirm:i,booleanToggle:()=>t(!e)},l))},autoFocus:!0}):d.jsx("span",{onDoubleClick:()=>o(!0),className:"jer-value-boolean",style:c("boolean",s),children:String(e)})},q$=(e,t)=>{const n=m.useRef(void 0),r=m.useRef(t);m.useEffect(()=>{r.current=t},[t]);const o=i=>{r.current(i)};m.useEffect(()=>{if(window.clearTimeout(n.current),e)return n.current=window.setTimeout(()=>{window.addEventListener("keydown",o)},100),()=>{window.clearTimeout(n.current),window.removeEventListener("keydown",o)}},[e])},K$=({value:e,isEditing:t,setIsEditing:n,handleEdit:r,nodeData:o,handleKeyboard:i,keyboardCommon:s})=>{const{getStyles:a}=$n();return q$(t,l=>i(l,Object.assign({confirm:r},s))),d.jsx("div",{onDoubleClick:()=>n(!0),className:"jer-value-null",style:a("null",o),children:String(e)})},X$=({value:e})=>{let t="Error!";switch(typeof e){case"string":e===Yc&&(t="Function");break;case"undefined":t="Undefined";break;case"symbol":t="Symbol"}return d.jsx("span",{className:"jer-value-invalid",children:t})},Z$=({size:e,style:t,className:n})=>d.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:[d.jsx("path",{d:"M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4z"}),d.jsx("path",{d:"M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"})]}),Q$=({size:e,style:t,className:n})=>d.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,transform:"translate(0, 0.5)",children:[d.jsx("path",{d:"M7 17.013l4.413-.015 9.632-9.54c.378-.378.586-.88.586-1.414s-.208-1.036-.586-1.414l-1.586-1.586c-.756-.756-2.075-.752-2.825-.003L7 12.583v4.43zM18.045 4.458l1.589 1.583-1.597 1.582-1.586-1.585 1.594-1.58zM9 13.417l6.03-5.973 1.586 1.586-6.029 5.971L9 15.006v-1.589z"}),d.jsx("path",{d:"M5 21h14c1.103 0 2-.897 2-2v-8.668l-2 2V19H8.158c-.026 0-.053.01-.079.01-.033 0-.066-.009-.1-.01H5V5h6.847l2-2H5c-1.103 0-2 .897-2 2v14c0 1.103.897 2 2 2z"})]}),J$=({size:e,style:t,className:n})=>d.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:d.jsx("path",{d:"M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6v12m2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12M15.5 4l-1-1h-5l-1 1H5v2h14V4h-3.5z"})}),e5=({size:e,style:t,className:n})=>d.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:e,height:e,className:n,style:t,children:[d.jsx("path",{d:"M9 2 H15 A1 1 0 0 1 16 3 V5 A1 1 0 0 1 15 6 H9 A1 1 0 0 1 8 5 V3 A1 1 0 0 1 9 2 z"}),d.jsx("path",{d:"M8 4H6a2 2 0 00-2 2v14a2 2 0 002 2h12a2 2 0 002-2v-2M16 4h2a2 2 0 012 2v4M21 14H11"}),d.jsx("path",{d:"M15 10l-4 4 4 4"})]}),t5=({size:e,style:t,className:n})=>d.jsxs("svg",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",width:e,height:e,className:n,style:t,children:[d.jsx("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),d.jsx("path",{d:"M22 4L12 14.01l-3-3"})]}),n5=({size:e,style:t,className:n})=>d.jsx("svg",{baseProfile:"tiny",viewBox:"0 0 24 24",fill:"currentColor",width:e,height:e,className:n,style:t,children:d.jsx("path",{d:"M12 4c-4.411 0-8 3.589-8 8s3.589 8 8 8 8-3.589 8-8-3.589-8-8-8zm-5 8c0-.832.224-1.604.584-2.295l6.711 6.711A4.943 4.943 0 0112 17c-2.757 0-5-2.243-5-5zm9.416 2.295L9.705 7.584A4.943 4.943 0 0112 7c2.757 0 5 2.243 5 5 0 .832-.224 1.604-.584 2.295z"})}),r5=({size:e,style:t,className:n})=>d.jsx("svg",{viewBox:"0 0 512 512",fill:"currentColor",width:e,height:e,className:n,style:t,children:d.jsx("path",{d:"M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"})}),Mr=({name:e,nodeData:t})=>{var n,r,o,i,s,a,l;const{getStyles:c,icons:u}=$n(),f={size:"1.4em",className:"jer-icon"};switch(e){case"add":return(n=u==null?void 0:u.add)!==null&&n!==void 0?n:d.jsx(Z$,Object.assign({},f,{style:c("iconAdd",t)}));case"edit":return(r=u==null?void 0:u.edit)!==null&&r!==void 0?r:d.jsx(Q$,Object.assign({},f,{style:c("iconEdit",t)}));case"delete":return(o=u==null?void 0:u.delete)!==null&&o!==void 0?o:d.jsx(J$,Object.assign({},f,{style:c("iconDelete",t),size:"1.45em"}));case"copy":return(i=u==null?void 0:u.copy)!==null&&i!==void 0?i:d.jsx(e5,Object.assign({},f,{style:c("iconCopy",t),size:"1.2em"}));case"ok":return(s=u==null?void 0:u.ok)!==null&&s!==void 0?s:d.jsx(t5,Object.assign({},f,{style:Object.assign({fontSize:"90%"},c("iconOk",t))}));case"cancel":return(a=u==null?void 0:u.cancel)!==null&&a!==void 0?a:d.jsx(n5,Object.assign({},f,{style:Object.assign({fontSize:"130%"},c("iconCancel",t))}));case"chevron":return(l=u==null?void 0:u.chevron)!==null&&l!==void 0?l:d.jsx(r5,{size:"1em",style:c("iconCollection",t)});default:return d.jsx(d.Fragment,{})}},Aw=({startEdit:e,handleDelete:t,handleAdd:n,enableClipboard:r,type:o,customButtons:i,nodeData:s,translate:a,keyboardControls:l,handleKeyboard:c,editConfirmRef:u,getNewKeyOptions:f,jsonStringify:p})=>{const{getStyles:h}=$n(),x=a("KEY_NEW",s),[g,y]=m.useState(x),[v,b]=m.useState(!1),{key:w,path:S,value:E}=s,C=Array.isArray(v),k=T=>{var P;if(!T)return void b(!1);const z=Object.keys(zo(s.fullData,S)),D=f?(P=f(s))===null||P===void 0?void 0:P.filter($=>!z.includes($)):null;D&&y(""),b(D==null||D)};return d.jsxs("div",{className:"jer-edit-buttons",style:{opacity:v?1:void 0},onClick:T=>T.stopPropagation(),children:[r&&d.jsx("div",{onClick:T=>{var P;T.stopPropagation();let z,D,$="value",M="",_=null;if(r){const N=pd(T);if(N&&l.clipboardModifier.includes(N)?(z=o5(S),M=z,$="path"):(z=E,M=typeof z=="object"?p(E):String(z)),!navigator.clipboard)return void(typeof r=="function"&&r({success:!1,value:z,stringValue:M,path:S,key:w,type:$,errorMessage:"Can't access clipboard API"}));(P=navigator.clipboard)===null||P===void 0||P.writeText(M).then(()=>D=!0).catch(A=>{D=!1,_=A.message}).finally(()=>{typeof r=="function"&&r({success:D,errorMessage:_,value:z,stringValue:M,path:S,key:w,type:$})})}},className:"jer-copy-pulse",children:d.jsx(Mr,{name:"copy",nodeData:s})}),e&&d.jsx("div",{onClick:e,children:d.jsx(Mr,{name:"edit",nodeData:s})}),t&&d.jsx("div",{onClick:t,children:d.jsx(Mr,{name:"delete",nodeData:s})}),n&&d.jsx("div",{onClick:()=>{o==="object"?k(!0):n("")},children:d.jsx(Mr,{name:"add",nodeData:s})}),i==null?void 0:i.map(({Element:T,onClick:P},z)=>d.jsx("div",{onClick:D=>P&&P(s,D),children:d.jsx(T,{nodeData:s})},z)),v&&n&&o==="object"&&d.jsxs(d.Fragment,{children:[C?d.jsxs("div",{className:"jer-select jer-select-keys",children:[d.jsxs("select",{name:"new-key-select",className:"jer-select-inner",onChange:T=>{n(T.target.value),k(!1)},defaultValue:"",autoFocus:!0,onKeyDown:T=>{c(T,{cancel:()=>k(!1)})},children:[d.jsx("option",{value:"",disabled:!0,children:v.length>0?a("KEY_SELECT",s):a("NO_KEY_OPTIONS",s)}),v.map(T=>d.jsx("option",{value:T,children:T},T))]}),d.jsx("span",{className:"focus"})]}):d.jsx("input",{className:"jer-input-new-key",type:"text",name:"new-object-key",value:g,onChange:T=>y(T.target.value),autoFocus:!0,onFocus:T=>T.target.select(),onKeyDown:T=>{c(T,{stringConfirm:()=>{n&&(k(!1),n(g),y(x))},cancel:()=>{k(!1),y(x)}})},style:h("input",s)}),d.jsx(md,{onOk:()=>{C&&!g||(k(!1),n(g))},onCancel:()=>{k(!1)},nodeData:s,editConfirmRef:u,hideOk:C})]})]})},md=({onOk:e,onCancel:t,nodeData:n,editConfirmRef:r,hideOk:o=!1})=>d.jsxs("div",{className:"jer-confirm-buttons",children:[!o&&d.jsx("div",{onClick:e,ref:r,children:d.jsx(Mr,{name:"ok",nodeData:n})}),d.jsx("div",{onClick:t,children:d.jsx(Mr,{name:"cancel",nodeData:n})})]}),o5=e=>e.reduce((t,n)=>typeof n=="number"?`${t}[${n}]`:t===""?n:`${t}.${n}`,""),i5=["string","number","boolean","null","object","array"],Nw=({props:e,collapsed:t})=>{const{data:n,nodeData:r,parentData:o,onEdit:i,onError:s,showErrorMessages:a,restrictEditFilter:l,restrictDeleteFilter:c,restrictAddFilter:u,restrictDragFilter:f,translate:p,errorMessageTimeout:h}=e,{currentlyEditingElement:x,setCurrentlyEditingElement:g}=Zr(),[y,v]=m.useState(null),b=Object.assign(Object.assign({},r),{collapsed:t}),{path:w,key:S,size:E}=b,C=Jr(w),k=!l(b),T=!c(b),P=!u(b),z=!f(b)&&T&&x===null,D=j=>{a&&(v(j),setTimeout(()=>v(null),h)),console.warn("Error",j)},$=m.useCallback((j,R)=>{D(j.message),s&&s({currentData:b.fullData,errorValue:R,currentValue:n,name:S,path:w,error:j})},[s,a]),M=x===C,_=x===`key_${C}`,N=typeof w.slice(-1)[0]=="number",A={isEditing:M,isEditingKey:_,isArray:N,canEditKey:o!==null&&k&&P&&T&&!N},I=S===""&&w.length>0?p("EMPTY_STRING",b):null;return{pathString:C,nodeData:b,path:w,name:S,size:E,canEdit:k,canDelete:T,canAdd:P,canDrag:z,error:y,showError:D,onError:$,setError:v,handleEditKey:j=>{if(g(null),S===j||!o)return;const R=w.slice(0,-1);if(Object.keys(o).includes(j))return void $({code:"KEY_EXISTS",message:p("ERROR_KEY_EXISTS",b)},j);const O=Object.fromEntries(Object.entries(o).map(([L,Y])=>L===S?[j,Y]:[L,Y]));i(O,R).then(L=>{L&&$({code:"UPDATE_ERROR",message:L},j)})},derivedValues:A,emptyStringKey:I}},jw=({canDrag:e,canDragOnto:t,path:n,nodeData:r,onMove:o,onError:i,translate:s})=>{const{getStyles:a}=$n(),{dragSource:l,setDragSource:c}=Zr(),[u,f]=m.useState(!1),p=Jr(n),h=m.useMemo(()=>e?{onDragStart:v=>{v.stopPropagation(),c({path:n,pathString:p})},onDragEnd:v=>{v.stopPropagation(),c({path:null,pathString:null})}}:{},[e,p]),x=m.useMemo(()=>v=>t?{onDragOver:b=>{b.stopPropagation(),b.preventDefault()},onDrop:b=>{b.stopPropagation(),y(v),c({path:null,pathString:null}),f(!1)},onDragEnter:b=>{var w;b.stopPropagation(),p.startsWith((w=l.pathString)!==null&&w!==void 0?w:"")||f(v)},onDragExit:b=>{b.stopPropagation(),f(!1)}}:{},[l,t,p]),g=m.useMemo(()=>t&&l.pathString!==null?d.jsx("div",Object.assign({className:"jer-drop-target-bottom",style:{height:"50%",position:"absolute",width:"100%",top:"50%",zIndex:n.length}},x("below"))):null,[l,t,n.length]),y=v=>{var b,w;const S=(b=l.path)===null||b===void 0?void 0:b.slice(-1)[0],E=(w=l.path)===null||w===void 0?void 0:w.slice(0,-1).join("."),C=n.slice(0,-1).join(""),{parentData:k}=r;typeof S=="string"&&k&&!Array.isArray(k)&&Object.keys(k).includes(S)&&S in k&&E!==C?i({code:"KEY_EXISTS",message:s("ERROR_KEY_EXISTS",r)},S):o(l.path,n,v).then(T=>{T&&i({code:"UPDATE_ERROR",message:T},r.value)})};return{dragSourceProps:h,getDropTargetProps:x,BottomDropTarget:g,DropTargetPadding:({position:v,nodeData:b})=>u===v?d.jsx("div",{className:"jer-drag-n-drop-padding",style:a("dropZone",b)}):null,handleDrop:y}},s5=(e,t,n,r)=>{var o,i,s;if(!t.current)return 0;const a=parseInt((o=getComputedStyle(n.current).getPropertyValue("line-height"))!==null&&o!==void 0?o:"16px"),l=((s=(i=t.current)===null||i===void 0?void 0:i.offsetWidth)!==null&&s!==void 0?s:0)/(.5*a),c=r(e).replace(/\\n/g,`
662
+ `).split(`
663
+ `).map(u=>Math.ceil(u.length/l)).reduce((u,f)=>u+f,0)*a;return Math.min(c+30,window.innerHeight-50)},wa=({isEditingKey:e,canEditKey:t,pathString:n,path:r,name:o,handleKeyboard:i,handleEditKey:s,handleCancel:a,handleClick:l,keyValueArray:c,styles:u,getNextOrPrevious:f,emptyStringKey:p})=>{const{setCurrentlyEditingElement:h}=Zr();return e?d.jsx("input",{className:"jer-input-text jer-key-edit",type:"text",name:n,defaultValue:o,autoFocus:!0,onFocus:x=>x.target.select(),onKeyDown:x=>i(x,{stringConfirm:()=>s(x.target.value),cancel:a,tabForward:()=>{if(s(x.target.value),c){const g=c==null?void 0:c[0][0];h(g?[...r,g]:f("next"))}else h(r)},tabBack:()=>{s(x.target.value),h(f("prev"))}}),style:{width:String(o).length/1.5+.5+"em"}}):d.jsxs("span",{className:"jer-key-text",style:Object.assign(Object.assign({},u),{minWidth:`${Math.min(String(o).length+1,5)}ch`,flexShrink:o.length>10?1:0}),onDoubleClick:()=>t&&h(r,"key"),onClick:l,children:[p?d.jsx("span",{className:"jer-empty-string",children:p}):o,o!==""||p?d.jsx("span",{className:"jer-key-colon",children:":"}):null]})},Iw=e=>{const{data:t,parentData:n,onEdit:r,onDelete:o,onChange:i,onMove:s,enableClipboard:a,canDragOnto:l,restrictTypeSelection:c,searchFilter:u,searchText:f,showLabel:p,stringTruncate:h,showStringQuotes:x,indent:g,translate:y,customNodeDefinitions:v,customNodeData:b,handleKeyboard:w,keyboardControls:S,sort:E,editConfirmRef:C,jsonStringify:k}=e,{getStyles:T}=$n(),{setCurrentlyEditingElement:P,setCollapseState:z,previouslyEditedElement:D,setPreviouslyEditedElement:$,tabDirection:M,setTabDirection:_,previousValue:N,setPreviousValue:A}=Zr(),[I,j]=m.useState(typeof t=="function"?Yc:t),{pathString:R,nodeData:O,path:L,name:Y,canEdit:H,canDelete:V,canDrag:U,error:G,onError:B,handleEditKey:W,emptyStringKey:Z,derivedValues:ie}=Nw({props:e}),{dragSourceProps:se,getDropTargetProps:K,BottomDropTarget:ne,DropTargetPadding:q}=jw({canDrag:U,canDragOnto:l,path:L,nodeData:O,onMove:s,onError:B,translate:y}),[re,te]=m.useState(qc(t,b)),pe=m.useCallback(fe=>{if(!i)return void j(fe);const Se=i({currentData:O.fullData,newValue:fe,currentValue:I,name:Y,path:L});j(Se)},[i]);m.useEffect(()=>{j(typeof t=="function"?Yc:t),te(qc(t,b))},[t,G]);const{CustomNode:ee,customNodeProps:Te,hideKey:Ue,showEditTools:Ve=!0,showOnEdit:Ge,showOnView:et,passOriginalNode:st}=b,ot=[...i5,...v.filter(({showInTypesSelector:fe=!1,name:Se})=>fe&&!!Se).map(({name:fe})=>fe)],ze=m.useMemo(()=>{if(typeof c=="boolean")return c?[]:ot;if(Array.isArray(c))return c;const fe=c(O);return typeof fe=="boolean"?fe?[]:ot:fe},[O,c]),[dt,ft]=m.useState(((fe,Se)=>{var xe;if(typeof fe!="string")return null;const Ie=Se.filter(ke=>ke instanceof Object&&ke.enum&&ke.values.includes(fe)&&ke.matchPriority);return Ie.sort((ke,Ne)=>{var $e,Je;return(($e=Ne.matchPriority)!==null&&$e!==void 0?$e:0)-((Je=ke.matchPriority)!==null&&Je!==void 0?Je:0)}),(xe=Ie[0])!==null&&xe!==void 0?xe:null})(I,ze)),{isEditing:at}=ie,qe=Ew("value",O,u,f);if(at&&(!qe||!H)){const fe=Rr(O.fullData,L,M,E);P(fe||D)}if(!qe)return null;const Oe=fe=>{let Se;if(P(null),A(null),fe===void 0||(xe=>xe&&typeof xe=="object"&&"type"in xe&&"target"in xe&&"preventDefault"in xe&&typeof xe.preventDefault=="function")(fe))switch(re){case"object":Se={[y("DEFAULT_NEW_KEY",O)]:I};break;case"array":Se=I??[];break;case"number":{const xe=Number(I);Se=isNaN(xe)?0:xe;break}default:Se=I}else Se=fe;r(Se,L).then(xe=>{xe&&B({code:"UPDATE_ERROR",message:xe},Se)})},Ke=()=>{P(null),N===null?(j(t),A(null)):r(N,L)},{isEditingKey:xt,canEditKey:Qe}=ie,Xe=!at&&G,kt=at&&ze.length>1,Ee=(re!=="invalid"||ee)&&!G&&Ve,Q=p&&!Ue,ae=ee&&(at&&Ge||!at&&et),le={value:I,parentData:n,setValue:pe,isEditing:at,canEdit:H,setIsEditing:H?()=>P(L):()=>{},handleEdit:Oe,handleCancel:Ke,path:L,stringTruncate:h,showStringQuotes:x,nodeData:O,enumType:dt,translate:y,handleKeyboard:w,keyboardCommon:{cancel:Ke,tabForward:()=>{_("next"),$(R);const fe=Rr(O.fullData,L,"next",E);fe&&(Oe(),P(fe))},tabBack:()=>{_("prev"),$(R);const fe=Rr(O.fullData,L,"prev",E);fe&&(Oe(),P(fe))}}},ge={canEditKey:Qe,isEditingKey:xt,pathString:R,path:L,name:Y,handleKeyboard:w,handleEditKey:W,handleCancel:Ke,styles:T("property",O),getNextOrPrevious:fe=>Rr(O.fullData,L,fe,E),emptyStringKey:Z},he=ae?d.jsx(ee,Object.assign({},e,{value:I,customNodeProps:Te,setValue:pe,handleEdit:Oe,handleCancel:Ke,handleKeyPress:fe=>w(fe,{stringConfirm:Oe,cancel:Ke}),isEditing:at,setIsEditing:()=>P(L),getStyles:T,originalNode:st?Ah(t,le):void 0,originalNodeKey:st?d.jsx(wa,Object.assign({},ge)):void 0,canEdit:H,keyboardCommon:le.keyboardCommon,onError:B})):Ah(t,le);return d.jsxs("div",Object.assign({className:"jer-component jer-value-component",style:{marginLeft:g/2+"em",position:"relative"},draggable:U},se,K("above"),{children:[ne,d.jsx(q,{position:"above",nodeData:O}),d.jsxs("div",{className:"jer-value-main-row",style:{flexWrap:Y.length>10?"wrap":"nowrap"},children:[Q&&d.jsx(wa,Object.assign({},ge)),d.jsxs("div",{className:"jer-value-and-buttons",children:[d.jsx("div",{className:"jer-input-component",children:he}),at?d.jsx(md,{onOk:Oe,onCancel:Ke,nodeData:O,editConfirmRef:C}):Ee&&d.jsx(Aw,{startEdit:H?()=>{A(N),P(L,Ke)}:void 0,handleDelete:V?()=>{o(I,L).then(fe=>{fe&&B({code:"DELETE_ERROR",message:fe},I)})}:void 0,enableClipboard:a,translate:y,customButtons:e.customButtons,nodeData:O,handleKeyboard:w,keyboardControls:S,editConfirmRef:C,jsonStringify:k}),kt&&d.jsxs("div",{className:"jer-select jer-select-types",children:[d.jsx("select",{name:`${Y}-type-select`,className:"jer-select-inner",onChange:fe=>(Se=>{const xe=v.find(Ne=>Ne.name===Se);if(xe)return r(xe.defaultValue,L),te(Se),ft(null),P(null),void z({path:L,collapsed:!1,includeChildren:!1});const Ie=ze.find(Ne=>Ne instanceof Object&&Ne.enum===Se);if(Ie)return typeof I=="string"&&Ie.values.includes(I)||r(Ie.values[0],L).then(Ne=>{Ne&&(B({code:"UPDATE_ERROR",message:Ne},ke),P(null))}),void ft(Ie);const ke=a5(I,Se,y("DEFAULT_NEW_KEY",O),b!=null&&b.CustomNode?y("DEFAULT_STRING",O):void 0);r(ke,L).then(Ne=>{Ne?(B({code:"UPDATE_ERROR",message:Ne},ke),P(null)):ft(null)})})(fe.target.value),value:dt?dt.enum:re,children:ze.map(fe=>fe instanceof Object&&"enum"in fe?d.jsx("option",{value:fe.enum,children:fe.enum},fe.enum):d.jsx("option",{value:fe,children:fe},fe))}),d.jsx("span",{className:"focus"})]}),Xe&&d.jsx("span",{className:"jer-error-slug",style:T("error",O),children:G})]})]}),d.jsx(q,{position:"below",nodeData:O})]}))},qc=(e,t)=>t!=null&&t.CustomNode&&(t!=null&&t.name)&&t.showInTypesSelector?t.name:typeof e=="string"?"string":typeof e=="number"?"number":typeof e=="boolean"?"boolean":e===null?"null":"invalid",Ah=(e,t)=>{const n=qc(e),{value:r}=t;switch(n){case"string":return d.jsx(W$,Object.assign({},t,{value:r}));case"number":return d.jsx(G$,Object.assign({},t,{value:r}));case"boolean":return d.jsx(Y$,Object.assign({},t,{value:r}));case"null":return d.jsx(K$,Object.assign({},t));default:return d.jsx(X$,Object.assign({},t))}},a5=(e,t,n,r)=>{switch(t){case"string":return r??String(e);case"number":{const o=Number(e);return isNaN(o)?0:o}case"boolean":return!!e;case"null":return null;case"object":return{[n]:e};case"array":return[e];default:return String(e)}},Rw=(e=[],t)=>{const n=e.filter(({condition:x})=>x(t));if(n.length===0)return{};const r=n[0],{element:o,wrapperElement:i,customNodeProps:s,wrapperProps:a,hideKey:l=!1,showEditTools:c=!0,showOnEdit:u=!1,showOnView:f=!0,showCollectionWrapper:p=!0}=r,h=ww(r,["element","wrapperElement","customNodeProps","wrapperProps","hideKey","showEditTools","showOnEdit","showOnView","showCollectionWrapper"]);return Object.assign({CustomNode:o,CustomWrapper:i,customNodeProps:s,wrapperProps:a,hideKey:l,showEditTools:c,showOnEdit:u,showOnView:f,showCollectionWrapper:p},h)},Mw=e=>{const{getStyles:t}=$n(),{collapseState:n,setCollapseState:r,getMatchingCollapseState:o,currentlyEditingElement:i,setCurrentlyEditingElement:s,areChildrenBeingEdited:a,previousValue:l,setPreviousValue:c}=Zr(),{mainContainerRef:u,data:f,nodeData:p,parentData:h,showCollectionCount:x,onEdit:g,onAdd:y,onDelete:v,canDragOnto:b,collapseFilter:w,collapseAnimationTime:S,onMove:E,enableClipboard:C,searchFilter:k,searchText:T,indent:P,sort:z,showArrayIndices:D,defaultValue:$,newKeyOptions:M,translate:_,customNodeDefinitions:N,customNodeData:A,jsonParse:I,jsonStringify:j,TextEditor:R,keyboardControls:O,handleKeyboard:L,insertAtTop:Y,onCollapse:H,editConfirmRef:V,collapseClickZones:U}=e,[G,B]=m.useState(j(f)),W=w(p),{contentRef:Z,isAnimating:ie,maxHeight:se,collapsed:K,animateCollapse:ne,cssTransitionValue:q}=((X,ue,be,Ae,ct)=>{const[ht,Gt]=m.useState(be?0:void 0),[nt,Rt]=m.useState(be),Ht=m.useRef(!1),Mt=m.useRef(null),Jn=m.useRef(0),Re=m.useRef(0),ln=ue/1e3+"s",er=m.useCallback(tr=>{var nr,Zo;if(nt!==tr){switch(window.clearTimeout(Re.current),Ht.current=!0,tr){case!0:{const is=(Zo=(nr=Mt.current)===null||nr===void 0?void 0:nr.offsetHeight)!==null&&Zo!==void 0?Zo:0;Jn.current=is,Gt(is),setTimeout(()=>{Gt(0)},5);break}case!1:Gt(Jn.current||s5(X,Mt,Ae,ct))}Rt(!nt),Re.current=window.setTimeout(()=>{Ht.current=!1,tr||Gt(void 0)},ue)}},[ue,nt,X,Ae,ct]);return{contentRef:Mt,isAnimating:Ht.current,animateCollapse:er,maxHeight:ht,collapsed:nt,cssTransitionValue:ln}})(f,S,W,u,j),{pathString:re,nodeData:te,path:pe,name:ee,size:Te,canEdit:Ue,canDelete:Ve,canAdd:Ge,canDrag:et,error:st,setError:ot,onError:ze,handleEditKey:dt,emptyStringKey:ft,derivedValues:at}=Nw({props:e,collapsed:K}),{dragSourceProps:qe,getDropTargetProps:Oe,BottomDropTarget:Ke,DropTargetPadding:xt}=jw({canDrag:et,canDragOnto:b,path:pe,nodeData:te,onMove:E,onError:ze,translate:_}),Qe=m.useRef(!W),{isEditing:Xe,isEditingKey:kt,isArray:Ee,canEditKey:Q}=at;m.useEffect(()=>{B(j(f))},[f,j]),m.useEffect(()=>{const X=w(te)&&!Xe;Qe.current=!X,ne(X)},[w]),m.useEffect(()=>{if(n!==null){const X=o(pe);X&&(Qe.current=!0,ne(X.collapsed))}},[n]);const ae=m.useRef(null),le=m.useCallback((X,ue)=>{if(typeof $!="function")return $;const be=$(X,ue);return be!==void 0?be:null},[$]),ge=m.useCallback(X=>M?typeof M!="function"?M:M(X):null,[M]),{CustomNode:he,customNodeProps:fe,CustomWrapper:Se,wrapperProps:xe={},hideKey:Ie,showEditTools:ke=!0,showOnEdit:Ne,showOnView:$e,showCollectionWrapper:Je=!0}=A,mt=a(re);if(mt&&K&&ne(!1),!(Ew("collection",te,k,T)||te.level===0)&&!mt)return null;const yt=Array.isArray(f)?"array":"object",lt=yt==="array"?{open:"[",close:"]"}:{open:"{",close:"}"},vt=X=>{if(X.key!=="Tab"||X.getModifierState("Shift"))L(X,{objectConfirm:Ft,cancel:Nt});else{X.preventDefault();const ue=kw(ae," ");B(ue)}},Lt=X=>{X.stopPropagation();const ue=pd(X);if(ue&&O.collapseModifier.includes(ue))return Qe.current=!0,void r({collapsed:!K,path:pe,includeChildren:!0});i&&i.includes(re)||(Qe.current=!0,r(null),H&&H({path:pe,collapsed:!K,includeChildren:!1}),ne(!K))},Ft=()=>{try{const X=I(G);if(s(null),c(null),ot(null),j(X)===j(f))return;g(X,pe).then(ue=>{ue&&ze({code:"UPDATE_ERROR",message:ue},X)})}catch{ze({code:"INVALID_JSON",message:_("ERROR_INVALID_JSON",te)},G)}},zt=pe.length>0?()=>{v(f,pe).then(X=>{X&&ze({code:"DELETE_ERROR",message:X},f)})}:void 0,Nt=()=>{s(null),l===null?(ot(null),B(j(f)),c(null)):g(l,pe)},wt=x==="when-closed"?K:x,Wt=!Xe&&ke,Bt=(D||!Ee)&&!Ie&&ee!==void 0,je=he&&(Xe&&Ne||!Xe&&$e),Pe=Object.entries(f).map(([X,ue])=>[yt==="array"?Number(X):X,ue]);yt==="object"&&z(Pe,X=>X);const _e=Qe.current?Xe?d.jsxs("div",{className:"jer-collection-text-edit",children:[R?d.jsx(R,{value:G,onChange:B,onKeyDown:X=>L(X,{objectConfirm:Ft,cancel:Nt})}):d.jsx(bw,{textAreaRef:ae,className:"jer-collection-text-area",name:re,value:G,setValue:B,handleKeyPress:vt,styles:t("input",te)}),d.jsx("div",{className:"jer-collection-input-button-row",children:d.jsx(md,{onOk:Ft,onCancel:Nt,nodeData:te,editConfirmRef:V})})]}):Pe.map(([X,ue],be)=>{const Ae={key:X,value:ue,path:[...pe,X],level:pe.length+1,index:be,size:Bo(ue)?Object.keys(ue).length:null,parentData:f,fullData:te.fullData},ct=Rw(N,Ae);return d.jsx("div",{className:"jer-collection-element",style:t("collectionElement",Ae),children:Bo(ue)&&!(ct!=null&&ct.renderCollectionAsValue)?d.jsx(Mw,Object.assign({},e,{data:ue,parentData:f,nodeData:Ae,showCollectionCount:x,canDragOnto:Ue,customNodeData:ct}),X):d.jsx(Iw,Object.assign({},e,{data:ue,parentData:f,nodeData:Ae,canDragOnto:Ue,showLabel:yt==="object"||D,customNodeData:ct}),X)},X)}):null,ce=!!Je&&K&&!mt;ce||(Qe.current=!0);const F=Object.assign(Object.assign({},e),{data:f,value:f,parentData:h,nodeData:te,setValue:X=>po(void 0,void 0,void 0,function*(){return yield g(X,pe)}),handleEdit:Ft,handleCancel:Nt,handleKeyPress:vt,isEditing:Xe,setIsEditing:()=>s(pe),getStyles:t,canDragOnto:Ue,canEdit:Ue,keyboardCommon:{},onError:ze}),oe=je?d.jsx(he,Object.assign({customNodeProps:fe},F,{children:_e})):_e,J=Wt&&d.jsx(Aw,{startEdit:Ue?()=>{Qe.current=!0,c(null),s(pe)}:void 0,handleAdd:Ge?X=>{ne(!1);const ue=le(te,X);if(yt==="array"){const be=Y.array?0:f.length,Ae=Y.array?{insert:!0}:{};y(ue,[...pe,be],Ae).then(ct=>{ct&&ze({code:"ADD_ERROR",message:ct},ue)})}else if(X in f)ze({code:"KEY_EXISTS",message:_("ERROR_KEY_EXISTS",te)},X);else{const be=Y.object?{insertBefore:0}:{};y(ue,[...pe,X],be).then(Ae=>{Ae&&ze({code:"ADD_ERROR",message:Ae},ue)})}}:void 0,handleDelete:Ve?zt:void 0,enableClipboard:C,type:yt,nodeData:te,translate:_,customButtons:e.customButtons,keyboardControls:O,handleKeyboard:L,getNewKeyOptions:ge,editConfirmRef:V,jsonStringify:j}),me={canEditKey:Q,isEditingKey:kt,pathString:re,path:pe,name:ee,handleKeyboard:L,handleEditKey:dt,handleCancel:Nt,keyValueArray:Pe,styles:t("property",te),getNextOrPrevious:X=>Rr(te.fullData,pe,X,z),handleClick:U.includes("property")?Lt:X=>X.stopPropagation(),emptyStringKey:ft},de=d.jsxs("div",Object.assign({className:"jer-component jer-collection-component",style:Object.assign(Object.assign({marginLeft:(pe.length===0?0:P/2)+"em"},t("collection",te)),{position:"relative"}),draggable:et},qe,Oe("above"),{children:[d.jsx("div",{className:"jer-clickzone",style:{width:P/2+1+"em",zIndex:10+2*te.level},onClick:U.includes("left")?Lt:void 0}),!Xe&&Ke,d.jsx(xt,{position:"above",nodeData:te}),Je?d.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},onClick:U.includes("header")?Lt:void 0,children:[d.jsxs("div",{className:"jer-collection-name",children:[d.jsx("div",{className:"jer-collapse-icon jer-accordion-icon"+(K?" jer-rotate-90":""),style:{zIndex:11+2*te.level,transition:q},onClick:Lt,children:d.jsx(Mr,{name:"chevron",rotate:K,nodeData:te})}),Bt&&d.jsx(wa,Object.assign({},me)),!Xe&&d.jsx("span",{className:"jer-brackets jer-bracket-open",style:t("bracket",te),children:lt.open})]}),!Xe&&wt&&d.jsx("div",{className:"jer-collection-item-count"+(wt?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("itemCount",te)),{transition:q}),children:Te===1?_("ITEM_SINGLE",Object.assign(Object.assign({},te),{size:1}),1):_("ITEMS_MULTIPLE",te,Te)}),d.jsx("div",{className:"jer-brackets"+(ce?" jer-visible":" jer-hidden"),style:Object.assign(Object.assign({},t("bracket",te)),{transition:q}),children:lt.close}),J]}):Ie?d.jsx(d.Fragment,{}):d.jsxs("div",{className:"jer-collection-header-row",style:{position:"relative"},children:[d.jsx(wa,Object.assign({},me)),J]}),d.jsxs("div",{className:"jer-collection-inner",style:Object.assign(Object.assign({overflowY:ce||ie?"clip":"visible",maxHeight:mt?void 0:se},t("collectionInner",te)),{transition:q}),ref:Z,children:[oe,d.jsx("div",{className:Xe?"jer-collection-error-row":"jer-collection-error-row-edit",children:st&&d.jsx("span",{className:"jer-error-slug",style:t("error",te),children:st})}),!Xe&&Je&&d.jsx("div",{className:"jer-brackets jer-bracket-outside",style:Object.assign(Object.assign({},t("bracket",te)),{marginLeft:(P<3?-1:P<6?-.5:0)+"em"}),children:lt.close})]}),d.jsx(xt,{position:"below",nodeData:te})]}));return Se?d.jsx(Se,Object.assign({customNodeProps:xe},F,{children:de})):de},l5={ITEM_SINGLE:"{{count}} item",ITEMS_MULTIPLE:"{{count}} items",KEY_NEW:"Enter new key",KEY_SELECT:"Select key",NO_KEY_OPTIONS:"No key options",ERROR_KEY_EXISTS:"Key already exists",ERROR_INVALID_JSON:"Invalid JSON",ERROR_UPDATE:"Update unsuccessful",ERROR_DELETE:"Delete unsuccessful",ERROR_ADD:"Adding node unsuccessful",DEFAULT_STRING:"New data!",DEFAULT_NEW_KEY:"key",SHOW_LESS:"(Show less)",EMPTY_STRING:"<empty string>"},c5=(e,t)=>(n,r,o)=>((i,s,a,l,c)=>{if(s[l]){const f=s[l](a);if(f!==null)return f}const u=l in i?i[l]:l5[l];return c===void 0?u:u==null?void 0:u.replace("{{count}}",String(c))})(e,t,r,n,o);var Nh=[],hi=[];(function(e,t){if(e&&typeof document<"u"){var n,r=t.prepend===!0?"prepend":"append",o=t.singleTag===!0,i=typeof t.container=="string"?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(o){var s=Nh.indexOf(i);s===-1&&(s=Nh.push(i)-1,hi[s]={}),n=hi[s]&&hi[s][r]?hi[s][r]:hi[s][r]=a()}else n=a();e.charCodeAt(0)===65279&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function a(){var l=document.createElement("style");if(l.setAttribute("type","text/css"),t.attributes)for(var c=Object.keys(t.attributes),u=0;u<c.length;u++)l.setAttribute(c[u],t.attributes[c[u]]);var f=r==="prepend"?"afterbegin":"beforeend";return i.insertAdjacentElement(f,l),l}})(':root{--jer-select-border:#b6b6b6;--jer-select-focus:#777;--jer-select-arrow:#777;--jer-form-border:1px solid #ededf0;--jer-form-border-focus:1px solid #e2e2e2;--jer-highlight-color:#b3d8ff}.jer-visible{opacity:1}.jer-hidden{opacity:0}.jer-select select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:transparent;border:none;color:#000;cursor:inherit;font-family:inherit;font-size:.8em;line-height:inherit;margin:0;outline:none;padding:0 1em 0 0;z-index:1}select::-ms-expand{display:none}.jer-select{align-items:center;background-color:#fff;background-image:linear-gradient(0deg,#f9f9f9,#fff 33%);border:1px solid var(--jer-select-border);border-radius:.25em;cursor:pointer;display:grid;grid-template-areas:"select";line-height:1.1;max-width:15ch;min-width:12ch;padding:.25em .5em;position:relative}.jer-select select,.jer-select:after{grid-area:select}.jer-select:not(.jer-select--multiple):after{background-color:var(--jer-select-arrow);clip-path:polygon(100% 0,0 0,50% 100%);content:"";height:.5em;justify-self:end;width:.8em}select:focus+.focus{border:1px solid var(--jer-select-focus);border-radius:inherit;bottom:-1px;left:-1px;position:absolute;right:-1px;top:-1px}.jer-select-inner{text-overflow:ellipsis;width:100%}.jer-editor-container{border-radius:.5em;font-size:16px;line-height:1;padding:1em 1em 1em 2em;position:relative;text-align:left}.jer-editor-container textarea{border:var(--jer-form-border);border-radius:.3em;color:var(--jer-input-color);outline:none}.jer-editor-container textarea:focus{border:var(--jer-form-border-focus)}.jer-editor-container input{border:var(--jer-form-border);border-radius:.3em;font-family:inherit;outline:none}.jer-editor-container input:focus{border:var(--jer-form-border-focus)}.jer-editor-container ::selection{background-color:var(--jer-highlight-color)}.jer-collection-header-row,.jer-value-main-row{align-items:center;display:flex;gap:.3em;min-height:1.7em}.jer-collection-header-row{display:flex;flex-wrap:wrap}.jer-collapse-icon{left:-1.2em;position:absolute;top:.35em}.jer-collection-inner{position:relative}.jer-collection-text-edit{align-items:flex-start;display:flex;flex-direction:column;gap:.3em;line-height:1.1em}.jer-collection-text-area{font-family:inherit;font-size:.85em;max-height:40em;overflow:hidden;padding:.2em .5em 0;resize:both}.jer-collection-input-button-row{display:flex;font-size:150%;justify-content:flex-end;margin-top:.4em;width:100%}.jer-collection-error-row{bottom:.5em;position:absolute}.jer-error-slug{margin-left:1em}.jer-value-component{position:relative}.jer-value-main-row{display:flex;gap:0}.jer-value-and-buttons{align-items:center;display:flex;justify-content:flex-start;padding-left:.5em}.jer-value-error-row{position:absolute}.jer-value-string{line-height:1.3em;overflow-wrap:anywhere;white-space:pre-wrap;word-break:break-word}.jer-string-expansion{cursor:pointer;filter:saturate(50%);opacity:.6}.jer-show-less{font-size:80%}.jer-hyperlink{text-decoration:underline}.jer-input-text{font-family:inherit;font-size:.9em;height:1.4em;line-height:1.2em;margin:0;min-width:6em;overflow:hidden;padding:.25em .5em .2em;resize:none}.jer-input-boolean{margin-left:.3em;margin-right:.3em;transform:scale(1.5)}.jer-key-text{line-height:1.1em;white-space:pre-wrap;word-break:break-word}.jer-key-edit{font-size:inherit;font-size:.9em;padding:0 .3em}.jer-value-invalid{font-style:italic;opacity:.5}.jer-input-number{font-size:90%;min-width:3em}.jer-confirm-buttons,.jer-edit-buttons{align-items:center;cursor:pointer;display:flex;height:1em}.jer-input-buttons{gap:.4em}.jer-edit-buttons{gap:.4em;margin-left:.5em;opacity:0}.jer-confirm-buttons{gap:.2em;margin-left:.4em}.jer-edit-buttons:hover{opacity:1;position:relative}.jer-collection-header-row:hover>.jer-edit-buttons,.jer-value-and-buttons:hover>.jer-edit-buttons,.jer-value-main-row:hover>.jer-edit-buttons{opacity:1}.jer-copy-pulse{position:relative;transition:.3s}.jer-copy-pulse:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-copy-pulse:after{border-radius:50%;box-shadow:0 0 15px 5px var(--jer-icon-copy-color);content:"";display:block;height:100%;left:0;opacity:0;position:absolute;top:0;transition:all .5s;width:100%}.jer-copy-pulse:active:after{border-radius:4em;box-shadow:0 0 0 0 var(--jer-icon-copy-color);left:0;opacity:1;position:absolute;top:0;transition:0s}.jer-copy-pulse:active{top:.07em}.jer-rotate-90{transform:rotate(-90deg)}.jer-icon:hover{opacity:.85;transform:scale(1.2);transition:.3s}.jer-empty-string{font-size:90%;font-style:italic}.jer-drag-n-drop-padding{border:1px dashed #e0e0e0;border-radius:.3em;height:.5em}.jer-clickzone{height:calc(100% - .8em);left:-1em;position:absolute;top:1.2em}',{});const u5=({data:e,setData:t,rootName:n="root",onUpdate:r=()=>{},onEdit:o=r,onDelete:i=r,onAdd:s=r,onChange:a,onError:l,showErrorMessages:c=!0,enableClipboard:u=!0,indent:f=2,collapse:p=!1,collapseAnimationTime:h=300,showCollectionCount:x=!0,restrictEdit:g=!1,restrictDelete:y=!1,restrictAdd:v=!1,restrictTypeSelection:b=!1,restrictDrag:w=!0,viewOnly:S,searchFilter:E,searchText:C,searchDebounceTime:k=350,keySort:T=!1,showArrayIndices:P=!0,showStringQuotes:z=!0,defaultValue:D=null,newKeyOptions:$,minWidth:M=250,maxWidth:_="min(600px, 90vw)",rootFontSize:N,stringTruncate:A=250,translations:I={},className:j,id:R,customText:O={},customNodeDefinitions:L=[],customButtons:Y=[],jsonParse:H=JSON.parse,jsonStringify:V=(K,ne)=>JSON.stringify(K,ne,2),TextEditor:U,errorMessageTimeout:G=2500,keyboardControls:B={},externalTriggers:W,insertAtTop:Z=!1,onCollapse:ie,collapseClickZones:se=["header","left"]})=>{const{getStyles:K}=$n(),{setCurrentlyEditingElement:ne}=Zr(),q=m.useMemo(()=>gi(p),[p]),re=m.useMemo(()=>c5(I,O),[I,O]),[te,pe]=m.useState(C),[ee,Te]=(({setData:Ee,data:Q})=>{const[ae,le]=m.useState(Ee?void 0:Q),ge=m.useCallback(he=>{Ee?Ee(he):le(he)},[Ee]);return m.useEffect(()=>{Ee||le(Q)},[Q]),[Ee?Q:ae,ge]})({setData:t,data:e}),Ue=m.useRef(null);m.useEffect(()=>{ne(null);const Ee=setTimeout(()=>pe(C),k);return()=>clearTimeout(Ee)},[C,k]);const Ve={key:n,path:[],level:0,index:0,value:ee,size:typeof ee=="object"&&ee!==null?Object.keys(ee).length:1,parentData:null,fullData:ee},Ge=(Ee,Q)=>po(void 0,void 0,void 0,function*(){const ae=yield Ee(Q);if(ae===!0||ae===void 0)return void Te(Q.newData);const le=p5(ae)?ae:["error",ae],[ge,he]=le;if(ge==="error")return Te(Q.currentData),he===!1?re("ERROR_UPDATE",Ve):String(he);Te(he)}),et=m.useMemo(()=>gi(g,S),[g,S]),st=m.useMemo(()=>gi(y,S),[y,S]),ot=m.useMemo(()=>gi(v,S),[v,S]),ze=m.useMemo(()=>gi(w,S),[w,S]),dt=m.useMemo(()=>f5(E),[E]),ft=m.useMemo(()=>(Ee=>{const Q=Object.assign({},_h);for(const ae of Object.keys(_h)){const le=ae;if(Ee[le]){const ge=Ee[le],he=["clipboardModifier","collapseModifier"].includes(ae)?Array.isArray(ge)?ge:[ge]:typeof ge=="string"?{key:ge}:ge;Q[le]=he,["stringConfirm","numberConfirm","booleanConfirm"].forEach(fe=>{!Ee[fe]&&Ee.confirm&&(Q[fe]=Q.confirm)})}}return Q})(B),[B]),at=m.useCallback((Ee,Q)=>((ae,le,ge)=>{const he=Object.entries(le);for(const[fe,Se]of he)if(O$(ge,ae[fe],fe)){ge.preventDefault(),Se();break}})(ft,Q,Ee),[ft]),qe=m.useMemo(()=>{const Ee=jh(L,"stringifyReplacer");return Q=>V(Q,Ee)},[L,V]),Oe=m.useMemo(()=>{const Ee=jh(L,"parseReviver");return Q=>{const ae=H(Q,Ee);return Gc(ae)}},[L,H]),Ke=m.useRef(null);((Ee,Q)=>{const{setCurrentlyEditingElement:ae,currentlyEditingElement:le,setCollapseState:ge}=Zr();m.useEffect(()=>{if(!Ee)return;const{collapse:he,edit:fe}=Ee;he&&ge(he);const Se=!(fe!=null&&fe.path)||Jr(fe.path)===le;switch(fe==null?void 0:fe.action){case"accept":Se&&(Q.current&&Q.current.click(),ae(null));break;case"cancel":Se&&ae(null);break;default:fe!=null&&fe.path&&ae(fe.path)}},[Ee])})(W,Ke);const xt=m.useCallback((Ee,Q)=>{T!==!1&&(typeof T!="function"?Ee.sort((ae,le)=>{const ge=Q(ae)[0],he=Q(le)[0];return ge<he?-1:ge>he?1:0}):Ee.sort((ae,le)=>T(Q(ae),Q(le))))},[T]),Qe=Rw(L,Ve),Xe={mainContainerRef:Ue,name:n,nodeData:Ve,onEdit:(Ee,Q)=>po(void 0,void 0,void 0,function*(){const{currentData:ae,newData:le,currentValue:ge,newValue:he}=mi(ee,Q,Ee,"update");if(ge!==he)return yield Ge(o,{currentData:ae,newData:le,currentValue:ge,newValue:he,name:Q.slice(-1)[0],path:Q})}),onDelete:(Ee,Q)=>po(void 0,void 0,void 0,function*(){const{currentData:ae,newData:le,currentValue:ge,newValue:he}=mi(ee,Q,Ee,"delete");return yield Ge(i,{currentData:ae,newData:le,currentValue:ge,newValue:he,name:Q.slice(-1)[0],path:Q})}),onAdd:(Ee,Q,ae)=>po(void 0,void 0,void 0,function*(){const{currentData:le,newData:ge,currentValue:he,newValue:fe}=mi(ee,Q,Ee,"add",ae);return yield Ge(s,{currentData:le,newData:ge,currentValue:he,newValue:fe,name:Q.slice(-1)[0],path:Q})}),onChange:a,onError:l,showErrorMessages:c,onMove:(Ee,Q,ae)=>po(void 0,void 0,void 0,function*(){if(Ee===null)return;const{currentData:le,newData:ge,currentValue:he}=mi(ee,Ee,"","delete"),fe=Ee.slice(-1)[0],Se=Q.slice(0,-1),xe=Q.slice(-1)[0];let Ie=typeof xe=="number"?ae==="above"?xe:xe+1:typeof fe=="number"?`arr_${fe}`:fe;Ee.slice(0,-1).join(".")===Q.slice(0,-1).join(".")&&typeof fe=="number"&&typeof Ie=="number"&&fe<Ie&&(Ie-=1);const ke=typeof Ie=="number"?{insert:!0}:ae==="above"?{insertBefore:xe}:{insertAfter:xe},{newData:Ne,newValue:$e}=mi(ge,[...Se,Ie],he,"add",ke);return yield Ge(o,{currentData:le,newData:Ne,currentValue:he,newValue:$e,name:Q.slice(-1)[0],path:Q})}),showCollectionCount:x,collapseFilter:q,collapseAnimationTime:h,restrictEditFilter:et,restrictDeleteFilter:st,restrictAddFilter:ot,restrictTypeSelection:b,restrictDragFilter:ze,canDragOnto:!1,searchFilter:dt,searchText:te,enableClipboard:u,keySort:T,sort:xt,showArrayIndices:P,showStringQuotes:z,indent:f,defaultValue:D,newKeyOptions:$,stringTruncate:A,translate:re,customNodeDefinitions:L,customNodeData:Qe,customButtons:Y,parentData:null,jsonParse:Oe,jsonStringify:qe,TextEditor:U,errorMessageTimeout:G,handleKeyboard:at,keyboardControls:ft,insertAtTop:{object:Z===!0||Z==="object",array:Z===!0||Z==="array"},onCollapse:ie,editConfirmRef:Ke,collapseClickZones:se},kt=Object.assign(Object.assign({},K("container",Ve)),{minWidth:M,maxWidth:_});return kt.fontSize=N??kt.fontSize,d.jsx("div",{id:R,ref:Ue,className:`jer-editor-container ${j??""}`,style:kt,children:Bo(ee)&&!Qe.renderCollectionAsValue?d.jsx(Mw,Object.assign({data:ee},Xe)):d.jsx(Iw,Object.assign({data:ee,showLabel:!0},Xe))})},d5=e=>{var t;const[n,r]=m.useState();return m.useEffect(()=>{const o=document.documentElement;r(o)},[]),n?d.jsx($$,{theme:(t=e.theme)!==null&&t!==void 0?t:hd,icons:e.icons,docRoot:n,children:d.jsx(H$,{onEditEvent:e.onEditEvent,onCollapse:e.onCollapse,children:d.jsx(u5,Object.assign({},e))})}):null},mi=(e,t,n,r,o={})=>{if(t.length===0)return{currentData:e,newData:n,currentValue:e,newValue:n};const i=Object.assign({remove:r==="delete"},o),s=r!=="add"?zo(e,t):void 0;return{currentData:e,newData:I$(e,t,n,i),currentValue:s,newValue:r!=="delete"?n:void 0}},gi=(e,t)=>t?()=>!0:typeof e=="boolean"?()=>e:typeof e=="number"?({level:n})=>n>=e:e,f5=e=>{if(e!==void 0)return e==="value"?Ho:e==="key"?Ch:e==="all"?(t,n)=>Ho(t,n)||Ch(t,n):e},p5=e=>Array.isArray(e)&&e.length===2&&["error","value"].includes(e[0]),jh=(e,t)=>{const n=t==="stringifyReplacer"?[r=>r===void 0?Cw:r]:[];if(n.push(...e.map(r=>r[t]).filter(r=>!!r)),n.length!==0)return(r,o)=>{let i=o;for(const s of n)i=s(i);return i}},h5=e=>({displayName:e?"Solace Dark JER":"Solace Light JER",styles:{container:{backgroundColor:"transparent",fontFamily:"monospace",fontSize:"14px"},property:e?"var(--color-primary-text-w10)":"var(--color-primary-text-wMain)",bracket:"var(--color-secondary-text-w50)",itemCount:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},string:e?"var(--color-success-w70)":"var(--color-success-wMain)",number:"var(--color-accent-n0-wMain)",boolean:e?"var(--color-warning-w70)":"var(--color-warning-wMain)",null:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},iconCollection:"var(--color-secondary-text-w50)",iconCopy:"var(--color-secondary-text-w50)"}}),Kc=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=Xg(),o=m.useMemo(()=>h5(r==="dark"),[r]),i=m.useMemo(()=>t===void 0||t<0?!1:t,[t]),s=m.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),a=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?d.jsx("div",{className:a,children:d.jsx("span",{className:"italic",children:"No JSON data"})}):d.jsx("div",{className:a,children:d.jsx(d5,{data:s,theme:o,viewOnly:!0,collapse:i,showStringQuotes:!0,showCollectionCount:"when-closed"})})};let Ns=null,js=null;function m5({children:e}){const{fetchCsrfToken:t}=Yg(),[n,r]=m.useState(Ns),[o,i]=m.useState(!Ns&&!js),[s,a]=m.useState(js);return m.useEffect(()=>{if(Ns||js)return;let l=!0;return(async()=>{i(!0),a(null);try{let u=await _t("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),f;if(u.ok)f=await u.json();else{const x=await u.text();if(console.error("Initial config fetch failed:",u.status,x),u.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const g=await t();if(!g)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),u=await _t("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":g,Accept:"application/json"}}),!u.ok){const y=await u.text();throw console.error("Config fetch retry failed:",u.status,y),new Error(`Failed to fetch config on retry: ${u.status} ${y}`)}f=await u.json()}else throw new Error(`Failed to fetch config: ${u.status} ${x}`)}const p=f.frontend_use_authorization??!1;p&&(console.log("Fetching CSRF token for config-related requests..."),await t());const h={configServerUrl:f.frontend_server_url,configAuthLoginUrl:f.frontend_auth_login_url,configUseAuthorization:p,configWelcomeMessage:f.frontend_welcome_message,configRedirectUrl:f.frontend_redirect_url,configCollectFeedback:f.frontend_collect_feedback,configBotName:f.frontend_bot_name,frontend_use_authorization:f.frontend_use_authorization};l&&(Ns=h,r(h)),console.log("App config processed and set:",h)}catch(u){if(console.error("Error initializing app:",u),l){const f=u.message||"Failed to load application configuration.";js=f,a(f)}}finally{l&&i(!1)}})(),()=>{l=!1}},[t]),n?d.jsx(Hg.Provider,{value:n,children:e}):o?d.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),d.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):s?d.jsx("div",{className:"flex min-h-screen items-center justify-center bg-red-100 dark:bg-red-900",children:d.jsxs("div",{className:"rounded border border-red-400 bg-white p-4 text-center dark:bg-gray-800",children:[d.jsx("h1",{className:"text-xl font-bold text-red-700 dark:text-red-300",children:"Configuration Error"}),d.jsx("p",{className:"mt-2 text-red-600 dark:text-red-200",children:s}),d.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Please check the backend server and network connection, then refresh the page."})]})}):d.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),d.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const g5=({children:e})=>{const{configServerUrl:t}=Ko(),n=`${t}/api/v1`,[r,o]=m.useState(null),[i,s]=m.useState(!1),[a,l]=m.useState(!1),[c,u]=m.useState(null),[f,p]=m.useState({}),[h,x]=m.useState([]),[g,y]=m.useState(null),[v,b]=m.useState(!1),[w,S]=m.useState(0),[E,C]=m.useState(0),[k,T]=m.useState(!1),[P]=m.useState(10),[z]=m.useState(1e3),D=m.useRef(null),$=m.useRef(null),M=m.useRef(null);m.useEffect(()=>{$.current=r},[r]);const _=m.useCallback(V=>{p(U=>{var Z,ie,se,K,ne;const G=V.task_id;if(!G)return V.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",V),U;const B=U[G],W=new Date(V.timestamp);if(B){const q=[...B.events,V].sort((re,te)=>new Date(re.timestamp).getTime()-new Date(te.timestamp).getTime());return{...U,[G]:{...B,events:q,lastUpdated:W}}}else{let q="Task started...";if(V.direction==="request"&&((ie=(Z=V.full_payload)==null?void 0:Z.method)!=null&&ie.startsWith("tasks/"))){const te=V.full_payload.params;if((se=te==null?void 0:te.message)!=null&&se.parts){const pe=te.message.parts.filter(ee=>ee.type==="text");q=((K=pe[1])==null?void 0:K.text)??((ne=pe[0])==null?void 0:ne.text)}}const re={taskId:G,initialRequestText:q,events:[V],firstSeen:W,lastUpdated:W};return x(te=>[G,...te.filter(pe=>pe!==G)]),{...U,[G]:re}}})},[]),N=m.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),s(!1),l(!0),u(null),C(0),T(!1),M.current&&(clearTimeout(M.current),M.current=null)},[]),A=m.useCallback(V=>{try{const U=JSON.parse(V.data);_(U)}catch(U){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",U,"Raw data:",V.data),u("Received unparseable 'a2a_message' event from server.")}},[_]),I=m.useCallback(V=>{console.error("TaskMonitorContext: SSE connection error:",V),s(!1),l(!1),D.current&&D.current.readyState===EventSource.CLOSED?u("Task Monitor SSE connection closed by server or network issue."):u("Task Monitor SSE connection error occurred."),D.current&&(D.current.close(),D.current=null)},[]),j=m.useCallback(async()=>{if(a||i){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),s(!0);try{const V={subscription_targets:[{type:"my_a2a_messages"}]},U=await _t(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(V),credentials:"include"});if(!U.ok){const se=await U.json().catch(()=>({detail:"Failed to subscribe"}));if(se.error_type==="authorization_failure"){const K=se.message||"Access denied: insufficient permissions",ne=se.suggested_action?` ${se.suggested_action}`:"";throw new Error(`${K}${ne}`)}else if(se.error_type==="subscription_failure"){const K=se.message||"Subscription failed",ne=se.suggested_action?` ${se.suggested_action}`:"";throw new Error(`${K}${ne}`)}else throw new Error(se.detail||se.message||`Subscription failed: ${U.statusText}`)}const G=await U.json();o(G.stream_id);const B=G.sse_endpoint_url.startsWith("/")?`${t||""}${G.sse_endpoint_url}`:G.sse_endpoint_url;D.current&&D.current.close();const W=Qc(),Z=`${B}${W?`?token=${W}`:""}`,ie=new EventSource(Z,{withCredentials:!0});D.current=ie,ie.onopen=N,ie.addEventListener("a2a_message",A),ie.onerror=I}catch(V){console.error("TaskMonitorContext: Error connecting stream:",V),u(V instanceof Error?V.message:String(V)),s(!1),l(!1),o(null),D.current&&(D.current.close(),D.current=null)}},[n,t,a,i,N,A,I]),R=m.useCallback(()=>{if(M.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(E>=P){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),T(!1),u(`Connection lost. Max reconnection attempts (${P}) reached.`);return}const V=z*Math.pow(2,E);console.log(`TaskMonitorContext: Attempting reconnection ${E+1}/${P} in ${V}ms...`),T(!0),C(U=>U+1),M.current=setTimeout(()=>{j()},V)},[E,P,z,j]),O=m.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),M.current&&(clearTimeout(M.current),M.current=null),D.current&&(D.current.close(),D.current=null);const V=$.current;if(V)try{await _t(`${n}/visualization/${V}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(U){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${V}`,U)}o(null),s(!1),l(!1),u(null),p({}),x([]),y(null),b(!1),S(0),C(0),T(!1)},[n]);m.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),D.current&&(D.current.close(),D.current=null);const V=$.current;if(V)if(navigator.sendBeacon){const U=new FormData;navigator.sendBeacon(`${n}/visualization/${V}/unsubscribe`,U)}else _t(`${n}/visualization/${V}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(U=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",U))},[n]),m.useEffect(()=>{!a&&!i&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),j())},[]),m.useEffect(()=>{!a&&!i&&!k&&c&&E<P&&(c.includes("closed by server")||c.includes("network issue")||c.includes("connection error"))&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),R())},[a,i,k,c,E,P,R]),m.useEffect(()=>()=>{M.current&&(clearTimeout(M.current),M.current=null)},[]);const L=m.useCallback(V=>{y(V)},[]),Y=m.useCallback((V,U)=>{b(V),S(U)},[]),H={isTaskMonitorConnecting:i,isTaskMonitorConnected:a,taskMonitorSseError:c,monitoredTasks:f,monitoredTaskOrder:h,highlightedStepId:g,isReplaying:v,currentReplayStep:w,isReconnecting:k,reconnectionAttempts:E,connectTaskMonitorStream:j,disconnectTaskMonitorStream:O,setHighlightedStepId:L,setReplayState:Y};return d.jsx(Ug.Provider,{value:H,children:e})},x5=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n}=Ko(),r=`${n}/api/v1`,[o,i]=m.useState(()=>`web-session-${Date.now()}`),[s,a]=m.useState([]),[l,c]=m.useState(""),[u,f]=m.useState(!1),[p,h]=m.useState([]),[x,g]=m.useState(null),y=m.useRef(null),[v,b]=m.useState(""),[w,S]=m.useState(!1),[E,C]=m.useState(null),k=m.useRef(null),T=m.useRef(!1),P=m.useRef(null),z=m.useRef(0),{artifacts:D,isLoading:$,refetch:M,error:_}=i_(),N=m.useCallback(async Q=>{!$&&(Q==null?void 0:Q.some(le=>!D.some(ge=>ge.filename===le.name)))&&await M()},[D,$,M]),[A,I]=m.useState(!0),[j,R]=m.useState("files"),[O,L]=m.useState(!1),[Y,H]=m.useState(null),[V,U]=m.useState(!1),[G,B]=m.useState(new Set),[W,Z]=m.useState(!1),[ie,se]=m.useState(null),[K,ne]=m.useState(null),[q,re]=m.useState(null),[te,pe]=m.useState(null),ee=m.useCallback((Q,ae)=>{h(le=>{if(le.find(Se=>Se.message===Q))return le;const he=Date.now().toString(),fe={id:he,message:Q,type:ae||"info"};return setTimeout(()=>{h(Se=>Se.filter(xe=>xe.id!==he))},3e3),[...le,fe]})},[]),Te=m.useCallback(async Q=>{const ae=new FormData;ae.append("upload_file",Q,Q.name);try{const le=await _t(`${r}/artifacts/${encodeURIComponent(Q.name)}`,{method:"POST",body:ae,credentials:"include"});if(!le.ok){const ge=await le.json().catch(()=>({detail:`Failed to upload ${Q.name}`}));throw new Error(ge.detail||`HTTP error ${le.status}`)}ee(`Artifact "${Q.name}" uploaded successfully.`),await M()}catch(le){ee(`Error uploading artifact "${Q.name}": ${le instanceof Error?le.message:"Unknown error"}`)}},[r,ee,M]),Ue=m.useCallback(async Q=>{try{const ae=await _t(`${r}/artifacts/${encodeURIComponent(Q)}`,{method:"DELETE",credentials:"include"});if(!ae.ok&&ae.status!==204){const le=await ae.json().catch(()=>({detail:`Failed to delete ${Q}`}));throw new Error(le.detail||`HTTP error ${ae.status}`)}ee(`File "${Q}" deleted successfully.`),await M()}catch(ae){ee(`Error deleting file "${Q}": ${ae instanceof Error?ae.message:"Unknown error"}`)}},[r,ee,M]),Ve=m.useCallback(Q=>{H(Q),L(!0)},[]),Ge=m.useCallback(()=>{H(null),L(!1)},[]),et=m.useCallback(async()=>{Y&&await Ue(Y.filename),Ge()},[Y,Ue,Ge]),st=m.useCallback(()=>{if(G.size===0){ee("No files selected for deletion.");return}Z(!0)},[G,ee]),ot=m.useCallback(async()=>{Z(!1);const Q=Array.from(G);let ae=0,le=0;for(const ge of Q)try{const he=await _t(`${r}/artifacts/${encodeURIComponent(ge)}`,{method:"DELETE",credentials:"include"});if(!he.ok&&he.status!==204)throw new Error(`Failed to delete ${ge}`);ae++}catch(he){console.error(he),le++}ae>0&&ee(`${ae} files(s) deleted successfully.`),le>0&&ee(`Failed to delete ${le} files(s).`),await M(),B(new Set),U(!1)},[G,r,ee,M]),ze=m.useCallback(async Q=>{ne(null),re(null),pe(null);try{const ae=await _t(`${r}/artifacts/${encodeURIComponent(Q)}/versions`,{credentials:"include"});if(!ae.ok)throw new Error("Error fetching version list");const le=await ae.json();if(!le||le.length===0)throw new Error("No versions available");ne(le.sort((ke,Ne)=>ke-Ne));const ge=Math.max(...le);re(ge);const he=await _t(`${r}/artifacts/${encodeURIComponent(Q)}/versions/${ge}`,{credentials:"include"});if(!he.ok)throw new Error("Error fetching latest version content");const fe=await he.blob(),Se=await new Promise((ke,Ne)=>{const $e=new FileReader;$e.onloadend=()=>{var Je;return ke(((Je=$e.result)==null?void 0:Je.toString().split(",")[1])||"")},$e.onerror=Ne,$e.readAsDataURL(fe)}),xe=D.find(ke=>ke.filename===Q),Ie={name:Q,mime_type:(xe==null?void 0:xe.mime_type)||"application/octet-stream",content:Se,last_modified:(xe==null?void 0:xe.last_modified)||new Date().toISOString()};return pe(Ie),Ie}catch(ae){return ee(`Error loading preview for ${Q}: ${ae instanceof Error?ae.message:"Unknown error"}`),null}},[r,ee,D]),dt=m.useCallback(async(Q,ae)=>{if(!K||!K.includes(ae))return ee(`Version ${ae} is not available for ${Q}.`),null;pe(null);try{const le=await _t(`${r}/artifacts/${encodeURIComponent(Q)}/versions/${ae}`,{credentials:"include"});if(!le.ok)throw new Error(`Error fetching version ${ae}`);const ge=await le.blob(),he=await new Promise((xe,Ie)=>{const ke=new FileReader;ke.onloadend=()=>{var Ne;return xe(((Ne=ke.result)==null?void 0:Ne.toString().split(",")[1])||"")},ke.onerror=Ie,ke.readAsDataURL(ge)}),fe=D.find(xe=>xe.filename===Q),Se={name:Q,mime_type:(fe==null?void 0:fe.mime_type)||"application/octet-stream",content:he,last_modified:(fe==null?void 0:fe.last_modified)||new Date().toISOString()};return re(ae),pe(Se),Se}catch(le){return ee(`Error loading version ${ae}: ${le instanceof Error?le.message:"Unknown error"}`),null}},[r,ee,D,K]),ft=m.useCallback(Q=>{ee(`Loading preview for attached file: ${Q.name}`),pe(Q),ne(null),re(null)},[ee]),at=m.useCallback(Q=>{I(!1),R(Q),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:Q}}))},[]),qe=m.useCallback(Q=>{var zt,Nt,wt,Wt,Bt,je,Pe,_e,ce,F,oe,J;z.current+=1;const ae=z.current;let le;try{console.log("TEST-SSE ChatProvider Raw Message:",Q.data),le=JSON.parse(Q.data)}catch(me){console.error(me),ee("Received unparseable agent update.","error");return}const ge=le;let he="",fe=[],Se,xe=!1,Ie=!1,ke=null,Ne=((zt=ge.id)==null?void 0:zt.toString())||x||`msg-${Date.now()}`;const $e=Q.type==="final_response";let Je=!1,mt=!1;const yt=!!ge.error||Q.type==="error";let lt=[],vt=null;if(ge.error)ke=ge.error,he=`Error: ${ke.message}`;else if(ge.result){const me=ge.result;if(me.id&&(me.status||me.artifact))if(me.status){const de=me;if(Je=de.final??!1,Ne=de.id,"sessionId"in me&&de.status.state==="failed"){if(console.log("DEBUG: Detected failed task in status_update",de),(Nt=de.status.message)!=null&&Nt.parts)for(const X of de.status.message.parts)X.type==="text"&&(he+=X.text||"",Ie=!0);he||(he="An unexpected error occurred during task execution.",Ie=!0),console.log("DEBUG: Failed task error message",{messageContent:he,hasOtherContentParts:Ie}),ke={code:-32603,message:he},console.log("DEBUG: Set errorContent for failed task",ke)}else if(de.status.message&&de.status.message.parts)for(const X of de.status.message.parts){if(X.type==="data"&&((wt=X.data)==null?void 0:wt.a2a_signal_type)==="agent_status_message"){xe=!0,xe=!0;const be=X.data.text||"Status update received.";P.current=be;continue}if(Ie=!0,X.type==="text")he+=X.text||"";else if(X.type==="file")fe.push({name:X.file.name||"unknown_file",content:X.file.bytes||"",mime_type:X.file.mimeType??"application/octet-stream"});else if(X.type==="data"){const ue=X;((Wt=ue.data)==null?void 0:Wt.type)==="agent_status"&&typeof((Bt=ue.data)==null?void 0:Bt.text)=="string"?vt=ue.data.text:(je=ue.metadata)!=null&&je.tool_name&&lt.push({toolName:ue.metadata.tool_name,data:ue.data})}}}else{const de=me;Ne=de.id;const X=de.artifact;X.parts.forEach(ue=>{var be,Ae;ue.type==="file"?fe.push({name:ue.file.name||X.name||"unknown_artifact_file",content:ue.file.bytes||"",mime_type:ue.file.mimeType??"application/octet-stream"}):ue.type==="data"&&((be=ue.metadata)!=null&&be.tool_name)&&lt.push({toolName:(Ae=ue==null?void 0:ue.metadata)==null?void 0:Ae.tool_name,data:ue.data})}),Se={name:X.name||"untitled",version:(Pe=X.metadata)==null?void 0:Pe.version},Ie=!0}else if(me.id&&me.status&&!("final"in me)&&Q.type==="final_response"){const de=me;if(Ne=de.id,((_e=de.status)==null?void 0:_e.state)==="failed"){if((ce=de.status.message)!=null&&ce.parts)for(const X of de.status.message.parts)X.type==="text"&&(he+=X.text||"",Ie=!0);he||(he="An unexpected error occurred during task execution.",Ie=!0),ke={code:-32603,message:he}}else he="",fe=[],Se=void 0,lt=[],vt=null,Ie=!1}(F=ge.result)!=null&&F.status&&((J=(oe=ge.result.status.message)==null?void 0:oe.metadata)==null?void 0:J.type)==="llm_response"&&!Ie&&(mt=!0)}vt&&(P.current=vt);const Lt=Je&&!mt||$e||yt;a(me=>{var nt,Rt,Ht,Mt,Jn;let de=[...me];((nt=de[de.length-1])==null?void 0:nt.isStatusBubble)&&(de=de.slice(0,-1));let ue=!1,be=!1;const Ae=(Re,ln)=>{const er={taskId:x??void 0,isUser:!1,isComplete:!1,metadata:{sessionId:o,messageId:Ne,lastProcessedEventSequence:ln},...Re};de.push(er),Re.text&&ke&&(de[de.length-1].isComplete=!0),be=!0},ct=de.length-1;if(!xe||Ie||$e||yt){const Re=de.length>0?de[de.length-1]:null;he&&!$e&&!Je&&(Re&&!Re.isUser&&!Re.isComplete&&((Rt=Re.metadata)==null?void 0:Rt.messageId)===Ne&&Re.text!==void 0&&!Re.toolEvents&&!Re.files&&!Re.artifactNotification&&(((Ht=Re.metadata)==null?void 0:Ht.lastProcessedEventSequence)||0)<ae?(de[de.length-1]={...Re,text:(Re.text||"")+he,metadata:{...Re.metadata,sessionId:o,lastProcessedEventSequence:ae}},ue=!0):Ae({text:he},ae)),lt.length>0&&!$e&&Ae({toolEvents:lt},ae),fe.length>0&&!$e&&(Ae({files:fe},ae),N(fe)),Se&&!$e&&Ae({artifactNotification:Se},ae),ke&&(console.log("DEBUG: Creating error bubble",{messageContent:he,errorContent:ke,currentEventSequence:ae}),Ae({text:he,isComplete:!0,isError:!0},ae))}if(Lt)for(let Re=0;Re<de.length;Re++)de[Re]&&!de[Re].isUser&&((Mt=de[Re].metadata)==null?void 0:Mt.messageId)===Ne&&!de[Re].isStatusBubble&&(!de[Re].isComplete||ke&&de[Re].text===he)&&(de[Re]={...de[Re],isComplete:!0,metadata:{...de[Re].metadata,lastProcessedEventSequence:ae}});else if(be&&!ue&&ct>=0&&ct<de.length){const Re=de[ct];Re&&!Re.isUser&&((Jn=Re.metadata)==null?void 0:Jn.messageId)===Ne&&!Re.isStatusBubble&&!Re.isComplete&&(de[ct]={...Re,isComplete:!0,metadata:{...Re.metadata,lastProcessedEventSequence:ae}})}if($e||yt||Je&&w)P.current=null;else{const Re=vt??P.current;Re&&de.push({taskId:x??void 0,text:Re,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{sessionId:o,messageId:Ne,lastProcessedEventSequence:ae}})}return de}),w&&(Je||yt)&&(ee(yt?"Task failed during cancellation.":"Task successfully cancelled."),k.current&&(clearTimeout(k.current),k.current=null),S(!1),a(me=>me.filter(de=>!de.isStatusBubble))),($e||yt||Je&&w)&&(f(!1),y.current&&(y.current.close(),y.current=null),g(null),T.current=!0,M(),setTimeout(()=>{T.current=!1},100))},[x,w,ee,o,N,M]),Oe=m.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null),S(!1),y.current&&(y.current.removeEventListener("status_update",qe),y.current.removeEventListener("artifact_update",qe),y.current.removeEventListener("final_response",qe),y.current.removeEventListener("error",qe),y.current.close(),y.current=null),T.current=!1},[qe]),Ke=m.useCallback(async()=>{var ae;const Q="ChatProvider.handleNewSession:";if(console.log(`${Q} Starting new session process...`),Oe(),u&&x&&v&&!w){console.log(`${Q} Cancelling current task ${x}`);try{await _t(`${r}/tasks/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_name:v,task_id:x}),credentials:"include"})}catch(le){console.warn(`${Q} Failed to cancel current task:`,le)}}k.current&&(clearTimeout(k.current),k.current=null),S(!1);try{console.log(`${Q} Requesting new session from backend...`);const le=await _t(`${r}/sessions/new`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(!le.ok){const Se=await le.json().catch(()=>({detail:`HTTP error ${le.status}`}));throw new Error(Se.detail||`Failed to create new session: ${le.status}`)}const ge=await le.json(),he=(ae=ge==null?void 0:ge.result)==null?void 0:ae.sessionId;if(!he)throw new Error("Backend did not return a valid session ID");console.log(`${Q} Received new backend session ID: ${he}`),i(he),a(t?[{text:t,isUser:!1,isComplete:!0,metadata:{sessionId:he,lastProcessedEventSequence:0}}]:[]),c(""),f(!1),g(null),C(null),se(null),T.current=!1,P.current=null,z.current=0,console.log(`${Q} Refreshing artifacts for new session...`),await M(),ee("New session started successfully."),console.log(`${Q} New session setup complete.`)}catch(le){console.error(`${Q} Error creating new session:`,le),ee(`Failed to create new session: ${le instanceof Error?le.message:"Unknown error"}`),console.log(`${Q} Falling back to frontend-only session reset...`);const ge=`web-session-${Date.now()}`;i(ge),a(t?[{text:t,isUser:!1,isComplete:!0,metadata:{sessionId:ge,lastProcessedEventSequence:0}}]:[]),c(""),f(!1),g(null),C(null),T.current=!1,P.current=null,z.current=0,ee("Session reset to frontend-only mode due to backend error.")}typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session",{detail:{sessionId:o}}))},[Oe,u,x,v,w,r,t,ee,M,o]),xt=m.useCallback(async()=>{if(!u&&!w||!x||!v){ee("No active task to cancel.");return}if(w){ee("Cancellation already in progress.");return}ee(`Requesting cancellation for task ${x}...`),S(!0);try{const Q=await _t(`${r}/tasks/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({agent_name:v,task_id:x})});if(Q.status===202)ee(`Cancellation signal sent for task ${x}. Waiting for confirmation...`),k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{ee(`Cancellation for task ${x} timed out. Allowing new input.`),S(!1),f(!1),Oe(),g(null),k.current=null,a(ae=>ae.filter(le=>!le.isStatusBubble))},15e3);else{const ae=await Q.json().catch(()=>({detail:"Unknown cancellation error"}));ee(`Failed to request cancellation: ${ae.detail||Q.statusText}`),S(!1)}}catch(Q){ee(`Error sending cancellation request: ${Q instanceof Error?Q.message:"Network error"}`),S(!1)}},[u,w,x,v,r,ee,Oe]),Qe=m.useCallback(()=>{},[]),Xe=m.useCallback(()=>{u&&!T.current&&!w&&ee("Connection error with agent updates."),T.current||(f(!1),w||(Oe(),g(null)),P.current=null),a(Q=>Q.filter(ae=>!ae.isStatusBubble).map((ae,le,ge)=>le===ge.length-1&&!ae.isUser?{...ae,isComplete:!0}:ae))},[ee,Oe,u,w]),kt=m.useCallback(async(Q,ae,le)=>{var Ie;Q.preventDefault();const ge=(le==null?void 0:le.trim())||l.trim(),he=ae||[];if(!ge&&he.length===0||u||w||!v){v||ee("Please select an agent first."),w&&ee("Cannot send new message while a task is being cancelled.");return}Oe(),T.current=!1,f(!0),g(null),P.current=null,z.current=0;const fe={text:ge,isUser:!0,uploadedFiles:he.length>0?he:void 0,metadata:{sessionId:o,lastProcessedEventSequence:0}},Se="Thinking";P.current=Se;const xe={text:Se,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{sessionId:o,lastProcessedEventSequence:0}};a(ke=>[...ke,fe,xe]),c("");try{const ke=new FormData;ke.append("agent_name",v),ke.append("message",ge),he.forEach(mt=>ke.append("files",mt,mt.name)),console.log("ChatProvider handleSubmit: Sending POST to /tasks/subscribe");const Ne=await _t(`${r}/tasks/subscribe`,{method:"POST",body:ke});if(!Ne.ok){const mt=await Ne.json().catch(()=>({detail:"Unknown error"}));throw console.error("ChatProvider handleSubmit: Error from /tasks/subscribe",Ne.status,mt),new Error(mt.detail||`HTTP error ${Ne.status}`)}const $e=await Ne.json(),Je=(Ie=$e==null?void 0:$e.result)==null?void 0:Ie.taskId;if(!Je)throw console.error("ChatProvider handleSubmit: Backend did not return a valid taskId. Result:",$e),new Error("Backend did not return a valid taskId.");console.log(`ChatProvider handleSubmit: Received taskId ${Je}. Setting currentTaskId and taskIdInSidePanel.`),g(Je),C(Je)}catch(ke){console.error("ChatProvider handleSubmit: Catch block error",ke),ee(`Error: ${ke instanceof Error?ke.message:"Unknown error"}`),f(!1),a(Ne=>Ne.filter($e=>!$e.isStatusBubble)),g(null),T.current=!1,P.current=null}},[l,u,w,o,v,r,ee,Oe]);m.useEffect(()=>{_&&ee(`Error fetching files: ${_}`,"error")},[ee,_]),m.useEffect(()=>{if(x&&r){console.log(`ChatProvider Effect: currentTaskId is ${x}. Setting up EventSource.`);const Q=Qc(),ae=`${r}/sse/subscribe/${x}${Q?`?token=${Q}`:""}`,le=new EventSource(ae,{withCredentials:!0});return y.current=le,le.onopen=Qe,le.onerror=Xe,le.addEventListener("status_update",qe),le.addEventListener("artifact_update",qe),le.addEventListener("final_response",qe),le.addEventListener("error",qe),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${x}. Closing EventSource.`),Oe()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),Oe()},[x,r,Qe,Xe,qe,Oe]);const Ee={sessionId:o,messages:s,setMessages:a,userInput:l,setUserInput:c,isResponding:u,currentTaskId:x,isCancelling:w,handleNewSession:Ke,handleSubmit:kt,handleCancel:xt,notifications:p,addNotification:ee,selectedAgentName:v,setSelectedAgentName:b,artifacts:D,uploadArtifactFile:Te,isSidePanelCollapsed:A,activeSidePanelTab:j,setIsSidePanelCollapsed:I,setActiveSidePanelTab:R,openSidePanelTab:at,taskIdInSidePanel:E,setTaskIdInSidePanel:C,isDeleteModalOpen:O,artifactToDelete:Y,openDeleteModal:Ve,closeDeleteModal:Ge,confirmDelete:et,isArtifactEditMode:V,setIsArtifactEditMode:U,selectedArtifactFilenames:G,setSelectedArtifactFilenames:B,handleDeleteSelectedArtifacts:st,confirmBatchDeleteArtifacts:ot,isBatchDeleteModalOpen:W,setIsBatchDeleteModalOpen:Z,previewedArtifactAvailableVersions:K,currentPreviewedVersionNumber:q,previewFileContent:te,openArtifactForPreview:ze,navigateArtifactVersion:dt,openMessageAttachmentForPreview:ft,previewArtifact:ie,setPreviewArtifact:se};return d.jsx(Bg.Provider,{value:Ee,children:e})},y5=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=Ko(),{fetchCsrfToken:r,clearCsrfToken:o}=Yg(),[i,s]=m.useState(!1),[a,l]=m.useState(!0),[c,u]=m.useState(null);m.useEffect(()=>{let h=!0;const x=async()=>{if(!t){h&&(s(!0),l(!1));return}try{const y=await _t("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(y.ok){const v=await y.json();console.log("User is authenticated:",v),h&&(u(v),s(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else y.status===401?(console.log("User is not authenticated"),h&&s(!1)):(console.error("Unexpected response from /users/me:",y.status),h&&s(!1))}catch(y){console.error("Error checking authentication:",y),h&&s(!1)}finally{h&&l(!1)}};x();const g=y=>{y.key==="access_token"&&x()};return window.addEventListener("storage",g),()=>{h=!1,window.removeEventListener("storage",g)}},[t,n,r]);const f=()=>{window.location.href=n},p=()=>{s(!1),u(null),o()};return a?d.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),d.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):d.jsx(zg.Provider,{value:{isAuthenticated:i,useAuthorization:t,login:f,logout:p,userInfo:c},children:e})};function v5(e){var r;if(typeof document>"u")return null;const n=`; ${document.cookie}`.split(`; ${e}=`);return n.length===2&&((r=n.pop())==null?void 0:r.split(";").shift())||null}const w5=e=>new Promise(t=>setTimeout(t,e)),b5=async(e=5,t=50)=>{try{const n=await _t("/api/v1/csrf-token",{credentials:"include"});if(!n.ok)throw new Error(`CSRF endpoint returned status ${n.status}`);const r=await n.json();if(r.csrf_token)return console.log("CSRF token found in response body:",r.csrf_token),r.csrf_token;for(let o=0;o<e;o++){const i=v5("csrf_token");if(i)return console.log(`CSRF token found in cookie after ${o} retries:`,i),i;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await w5(t)}throw new Error("CSRF token not available in response or cookie after retries")}catch(n){return console.error("Error fetching/reading CSRF token:",n),null}};function E5({children:e}){const[t,n]=m.useState(null),r=m.useCallback(async()=>{if(t)return t;const s=await b5();if(s)n(s);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return s},[t]),o=m.useCallback(()=>{n(null)},[]),i={fetchCsrfToken:r,clearCsrfToken:o};return d.jsx(Vg.Provider,{value:i,children:e})}const S5={brand:{wMain:"#00C895",w30:"#B3EFDF",wMain30:"#00C8954d",w10:"#E6FAF4",w60:"#66DEBF",w100:"#00AD93"},primary:{w100:"#01374E",w90:"#014968",wMain:"#015B82",w60:"#679DB4",w40:"#99BDCD",w20:"#CCDEE6",w10:"#E6EFF2",text:{wMain:"#273749",w100:"#000000",w10:"#CCCCCC"}},secondary:{w70:"#536574",w80:"#354E62",w8040:"#354E6240",w100:"#000000",wMain:"#8790A0",w40:"#CFD3D9",w20:"#E7E9EC",w10:"#F3F4F6",text:{wMain:"#647481",w50:"#B1B9C0"}},background:{w100:"#021B2F",wMain:"#03223B",w20:"#F7F8F9",w10:"#FFFFFF"},info:{w100:"#2B71B1",wMain:"#0591D3",w70:"#7CD3F6",w30:"#B4DEF2",w20:"#CDE9F6",w10:"#E6F4FB"},error:{w100:"#C33135",wMain:"#E94C4E",w70:"#ED9B9D",w30:"#F8C9CA",w20:"#FBDBDC",w10:"#FDEDED"},warning:{w100:"#E1681F",wMain:"#FF8E2B",w70:"#F8C785",w30:"#FFDDBF",w20:"#FFE8D5",w10:"#FFF4EA"},success:{w100:"#006B53",wMain:"#009A80",w70:"#6FCCBC",w30:"#B3E1D9",w20:"#CCEBE6",w10:"#E6F5F2"},stateLayer:{w10:"#03223B1a",w20:"#03223B33"},accent:{n0:{w100:"#2F51AD",wMain:"#3C69E1",w30:"#C5D2F6",w10:"#ECF0FC"},n1:{w100:"#1F284C",wMain:"#3A4880",w30:"#C4C8D9",w60:"#8991B3",w20:"#D8DAE6",w10:"#EBEDF2"},n2:{w100:"#165E64",wMain:"#009193",w30:"#B3DEDF",w20:"#CCE9E9",w10:"#E6F4F4"},n3:{w100:"#542D75",wMain:"#7841A8",w30:"#D7C6E5",w10:"#F2ECF6"},n4:{w100:"#951379",wMain:"#CB1AA5",w30:"#F2C4E8"},n5:{w100:"#D03C1B",wMain:"#F66651",w30:"#FCCEC7",w60:"#FAA397"},n6:{w100:"#DE7E00",wMain:"#FCA829",w30:"#FEE5BF"},n7:{w100:"#2DADE1",wMain:"#7CD3F6",w30:"#CBEDFB"},n8:{w100:"#4F5A63",wMain:"#86939E",w30:"#DBDFE2"},n9:{wMain:"#DA162D"}},learning:{wMain:"#033A6F",w90:"#022E59",w100:"#022343",w20:"#CDD8E2",w10:"#E6EBF1"}},k5={light:{background:"background.w10",foreground:"primary.text.wMain",card:"background.w10","card-foreground":"primary.text.wMain",popover:"background.w10","popover-foreground":"primary.text.wMain",primary:"primary.wMain","primary-foreground":"primary.text.w10",secondary:"secondary.w10","secondary-foreground":"secondary.text.wMain",muted:"secondary.w10","muted-foreground":"secondary.text.wMain",accent:"secondary.w40","accent-foreground":"secondary.text.wMain",destructive:"error.wMain",border:"secondary.w40",input:"secondary.w40",ring:"brand.wMain","ring-offset":"brand.wMain","accent-background":"background.w20","message-background":"secondary.w20","chart-1":"brand.w60","chart-2":"primary.wMain","chart-3":"accent.n3.wMain","chart-4":"accent.n6.wMain","chart-5":"accent.n5.wMain",sidebar:"background.w20","sidebar-foreground":"primary.text.wMain","sidebar-primary":"primary.wMain","sidebar-primary-foreground":"primary.text.w10","sidebar-accent":"secondary.w10","sidebar-accent-foreground":"secondary.text.wMain","sidebar-border":"secondary.w40","sidebar-ring":"brand.wMain"},dark:{background:"background.w100",foreground:"primary.text.w10",card:"background.wMain","card-foreground":"primary.text.w10",popover:"background.wMain","popover-foreground":"primary.text.w10",primary:"primary.w60","primary-foreground":"primary.text.wMain",secondary:"secondary.w80","secondary-foreground":"secondary.text.w50",muted:"secondary.w80","muted-foreground":"secondary.text.w50",accent:"secondary.w80","accent-foreground":"secondary.text.w50",destructive:"error.w70",border:"secondary.w70",input:"secondary.w70",ring:"brand.w60","ring-offset":"brand.w60","accent-background":"primary.w90","message-background":"secondary.w70","chart-1":"brand.w100","chart-2":"primary.wMain","chart-3":"accent.n3.w100","chart-4":"accent.n6.w30","chart-5":"accent.n5.w60",sidebar:"background.wMain","sidebar-foreground":"primary.text.w10","sidebar-primary":"primary.w60","sidebar-primary-foreground":"primary.text.wMain","sidebar-accent":"secondary.w80","sidebar-accent-foreground":"secondary.text.w50","sidebar-border":"secondary.w70","sidebar-ring":"brand.w60"}},C5={"error-text-wMain":"error.wMain","error-text-w50":"error.w70","warning-text-wMain":"warning.wMain","warning-text-w50":"warning.w70","success-text-wMain":"success.wMain","success-text-w50":"success.w70","info-text-wMain":"info.wMain","info-text-w50":"info.w70"};function Ih(e,t){const n=t.split(".");let r=e;for(const o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return console.warn(`Color path not found: ${t}`),"#000000";return typeof r=="string"?r:"#000000"}function _5(e,t){const n={},r=k5[t];for(const[o,i]of Object.entries(r)){const s=Ih(e,i);n[`--${o}`]=s}for(const[o,i]of Object.entries(C5)){const s=Ih(e,i);n[`--color-${o}`]=s}return n}const ba="sam-theme";function T5(e){var n,r,o,i,s,a,l,c,u,f,p,h,x,g,y,v,b,w,S,E,C,k,T,P,z,D,$,M,_,N,A,I,j,R,O,L,Y,H,V,U,G,B,W,Z,ie,se,K,ne,q,re,te,pe,ee,Te,Ue,Ve,Ge,et,st,ot,ze,dt,ft,at,qe,Oe,Ke,xt,Qe,Xe,kt,Ee,Q,ae,le,ge,he,fe,Se,xe,Ie,ke,Ne,$e,Je,mt,yt,lt,vt,Lt,Ft,zt,Nt,wt,Wt,Bt,je,Pe,_e,ce,F,oe,J;const t={};return e.brand.wMain&&(t["--color-brand-wMain"]=e.brand.wMain),e.brand.wMain30&&(t["--color-brand-wMain30"]=e.brand.wMain30),e.brand.w100&&(t["--color-brand-w100"]=e.brand.w100),e.brand.w60&&(t["--color-brand-w60"]=e.brand.w60),e.brand.w30&&(t["--color-brand-w30"]=e.brand.w30),e.brand.w10&&(t["--color-brand-w10"]=e.brand.w10),e.primary.wMain&&(t["--color-primary-wMain"]=e.primary.wMain),e.primary.w100&&(t["--color-primary-w100"]=e.primary.w100),e.primary.w90&&(t["--color-primary-w90"]=e.primary.w90),e.primary.w60&&(t["--color-primary-w60"]=e.primary.w60),e.primary.w40&&(t["--color-primary-w40"]=e.primary.w40),e.primary.w20&&(t["--color-primary-w20"]=e.primary.w20),e.primary.w10&&(t["--color-primary-w10"]=e.primary.w10),e.primary.text.wMain&&(t["--color-primary-text-wMain"]=e.primary.text.wMain),e.primary.text.w100&&(t["--color-primary-text-w100"]=e.primary.text.w100),e.primary.text.w10&&(t["--color-primary-text-w10"]=e.primary.text.w10),e.secondary.wMain&&(t["--color-secondary-wMain"]=e.secondary.wMain),e.secondary.w100&&(t["--color-secondary-w100"]=e.secondary.w100),e.secondary.w80&&(t["--color-secondary-w80"]=e.secondary.w80),e.secondary.w8040&&(t["--color-secondary-w8040"]=e.secondary.w8040),e.secondary.w70&&(t["--color-secondary-w70"]=e.secondary.w70),e.secondary.w40&&(t["--color-secondary-w40"]=e.secondary.w40),e.secondary.w20&&(t["--color-secondary-w20"]=e.secondary.w20),e.secondary.w10&&(t["--color-secondary-w10"]=e.secondary.w10),e.secondary.text.wMain&&(t["--color-secondary-text-wMain"]=e.secondary.text.wMain),e.secondary.text.w50&&(t["--color-secondary-text-w50"]=e.secondary.text.w50),e.background.wMain&&(t["--color-background-wMain"]=e.background.wMain),e.background.w100&&(t["--color-background-w100"]=e.background.w100),e.background.w20&&(t["--color-background-w20"]=e.background.w20),e.background.w10&&(t["--color-background-w10"]=e.background.w10),(n=e.info)!=null&&n.wMain&&(t["--color-info-wMain"]=e.info.wMain),(r=e.info)!=null&&r.w100&&(t["--color-info-w100"]=e.info.w100),(o=e.info)!=null&&o.w70&&(t["--color-info-w70"]=e.info.w70),(i=e.info)!=null&&i.w30&&(t["--color-info-w30"]=e.info.w30),(s=e.info)!=null&&s.w20&&(t["--color-info-w20"]=e.info.w20),(a=e.info)!=null&&a.w10&&(t["--color-info-w10"]=e.info.w10),(l=e.error)!=null&&l.wMain&&(t["--color-error-wMain"]=e.error.wMain),(c=e.error)!=null&&c.w100&&(t["--color-error-w100"]=e.error.w100),(u=e.error)!=null&&u.w70&&(t["--color-error-w70"]=e.error.w70),(f=e.error)!=null&&f.w30&&(t["--color-error-w30"]=e.error.w30),(p=e.error)!=null&&p.w20&&(t["--color-error-w20"]=e.error.w20),(h=e.error)!=null&&h.w10&&(t["--color-error-w10"]=e.error.w10),(x=e.warning)!=null&&x.wMain&&(t["--color-warning-wMain"]=e.warning.wMain),(g=e.warning)!=null&&g.w100&&(t["--color-warning-w100"]=e.warning.w100),(y=e.warning)!=null&&y.w70&&(t["--color-warning-w70"]=e.warning.w70),(v=e.warning)!=null&&v.w30&&(t["--color-warning-w30"]=e.warning.w30),(b=e.warning)!=null&&b.w20&&(t["--color-warning-w20"]=e.warning.w20),(w=e.warning)!=null&&w.w10&&(t["--color-warning-w10"]=e.warning.w10),(S=e.success)!=null&&S.wMain&&(t["--color-success-wMain"]=e.success.wMain),(E=e.success)!=null&&E.w100&&(t["--color-success-w100"]=e.success.w100),(C=e.success)!=null&&C.w70&&(t["--color-success-w70"]=e.success.w70),(k=e.success)!=null&&k.w30&&(t["--color-success-w30"]=e.success.w30),(T=e.success)!=null&&T.w20&&(t["--color-success-w20"]=e.success.w20),(P=e.success)!=null&&P.w10&&(t["--color-success-w10"]=e.success.w10),(z=e.stateLayer)!=null&&z.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(D=e.stateLayer)!=null&&D.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(M=($=e.accent)==null?void 0:$.n0)!=null&&M.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(N=(_=e.accent)==null?void 0:_.n0)!=null&&N.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(I=(A=e.accent)==null?void 0:A.n0)!=null&&I.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(R=(j=e.accent)==null?void 0:j.n0)!=null&&R.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(L=(O=e.accent)==null?void 0:O.n1)!=null&&L.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(H=(Y=e.accent)==null?void 0:Y.n1)!=null&&H.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(U=(V=e.accent)==null?void 0:V.n1)!=null&&U.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(B=(G=e.accent)==null?void 0:G.n1)!=null&&B.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(Z=(W=e.accent)==null?void 0:W.n1)!=null&&Z.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(se=(ie=e.accent)==null?void 0:ie.n1)!=null&&se.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(ne=(K=e.accent)==null?void 0:K.n2)!=null&&ne.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(re=(q=e.accent)==null?void 0:q.n2)!=null&&re.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(pe=(te=e.accent)==null?void 0:te.n2)!=null&&pe.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(Te=(ee=e.accent)==null?void 0:ee.n2)!=null&&Te.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(Ve=(Ue=e.accent)==null?void 0:Ue.n2)!=null&&Ve.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(et=(Ge=e.accent)==null?void 0:Ge.n3)!=null&&et.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(ot=(st=e.accent)==null?void 0:st.n3)!=null&&ot.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(dt=(ze=e.accent)==null?void 0:ze.n3)!=null&&dt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(at=(ft=e.accent)==null?void 0:ft.n3)!=null&&at.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Oe=(qe=e.accent)==null?void 0:qe.n4)!=null&&Oe.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(xt=(Ke=e.accent)==null?void 0:Ke.n4)!=null&&xt.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(Xe=(Qe=e.accent)==null?void 0:Qe.n4)!=null&&Xe.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Ee=(kt=e.accent)==null?void 0:kt.n5)!=null&&Ee.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(ae=(Q=e.accent)==null?void 0:Q.n5)!=null&&ae.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(ge=(le=e.accent)==null?void 0:le.n5)!=null&&ge.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(fe=(he=e.accent)==null?void 0:he.n5)!=null&&fe.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(xe=(Se=e.accent)==null?void 0:Se.n6)!=null&&xe.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(ke=(Ie=e.accent)==null?void 0:Ie.n6)!=null&&ke.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),($e=(Ne=e.accent)==null?void 0:Ne.n6)!=null&&$e.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(mt=(Je=e.accent)==null?void 0:Je.n7)!=null&&mt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(lt=(yt=e.accent)==null?void 0:yt.n7)!=null&&lt.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(Lt=(vt=e.accent)==null?void 0:vt.n7)!=null&&Lt.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(zt=(Ft=e.accent)==null?void 0:Ft.n8)!=null&&zt.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(wt=(Nt=e.accent)==null?void 0:Nt.n8)!=null&&wt.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(Bt=(Wt=e.accent)==null?void 0:Wt.n8)!=null&&Bt.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(Pe=(je=e.accent)==null?void 0:je.n9)!=null&&Pe.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(_e=e.learning)!=null&&_e.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(ce=e.learning)!=null&&ce.w100&&(t["--color-learning-w100"]=e.learning.w100),(F=e.learning)!=null&&F.w90&&(t["--color-learning-w90"]=e.learning.w90),(oe=e.learning)!=null&&oe.w20&&(t["--color-learning-w20"]=e.learning.w20),(J=e.learning)!=null&&J.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function A5(e,t="light"){const n={};if(e){const o=T5(e);Object.assign(n,o)}const r=_5(e,t);return Object.assign(n,r),n}function N5(){const e=localStorage.getItem(ba);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function j5(e,t){const n=A5(e,t),r=document.documentElement;for(const[o,i]of Object.entries(n))r.style.setProperty(o,i);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(ba,t)})}const I5=({children:e})=>{const t=m.useMemo(()=>S5,[]),[n,r]=m.useState(()=>N5()),o=m.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const i=n==="light"?"dark":"light";r(i),localStorage.setItem(ba,i)}}),[n]);return m.useEffect(()=>{if(!(localStorage.getItem(ba)!==null)){const s=window.matchMedia("(prefers-color-scheme: dark)"),a=l=>{r(l.matches?"dark":"light")};return s.addEventListener?s.addEventListener("change",a):s.addListener(a),()=>{s.removeEventListener?s.removeEventListener("change",a):s.removeListener(a)}}},[]),m.useEffect(()=>{document.documentElement.classList.remove("light","dark"),j5(t,n)},[n,t]),d.jsx(Wg.Provider,{value:o,children:e})};function R5(){const[e,t]=m.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=s_();if(a_(),o&&!n)return d.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:d.jsx(tt,{onClick:r,children:"Login"})});const i=l=>{const c=_p.find(u=>u.id===l)||Tp.find(u=>u.id===l);c!=null&&c.onClick&&l!=="settings"?c.onClick():l!=="settings"&&t(l)},s=()=>{t("chat")},a=()=>{switch(e){case"chat":return d.jsx(j$,{});case"agentMesh":return d.jsx(A$,{})}};return d.jsxs("div",{className:"relative flex h-screen",children:[d.jsx(zP,{items:_p,bottomItems:Tp,activeItem:e,onItemChange:i,onHeaderClick:s}),d.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:a()}),d.jsx(UT,{})]})}function M5(){return d.jsx(I5,{children:d.jsx(E5,{children:d.jsx(m5,{children:d.jsx(y5,{children:d.jsx(x5,{children:d.jsx(g5,{children:d.jsx(R5,{})})})})})})})}zw.createRoot(document.getElementById("root")).render(d.jsx(m.StrictMode,{children:d.jsx(M5,{})}));