solace-agent-mesh 1.4.12__py3-none-any.whl → 1.5.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 (359) hide show
  1. solace_agent_mesh/agent/adk/adk_llm.txt +3 -4
  2. solace_agent_mesh/agent/adk/adk_llm_detail.txt +566 -0
  3. solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
  4. solace_agent_mesh/agent/adk/callbacks.py +56 -5
  5. solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +3 -1
  6. solace_agent_mesh/agent/adk/intelligent_mcp_callbacks.py +2 -1
  7. solace_agent_mesh/agent/adk/mcp_content_processor.py +2 -1
  8. solace_agent_mesh/agent/adk/models/lite_llm.py +1 -0
  9. solace_agent_mesh/agent/adk/models/models_llm.txt +1 -2
  10. solace_agent_mesh/agent/adk/runner.py +3 -1
  11. solace_agent_mesh/agent/adk/services.py +4 -1
  12. solace_agent_mesh/agent/adk/setup.py +3 -1
  13. solace_agent_mesh/agent/adk/tool_wrapper.py +2 -2
  14. solace_agent_mesh/agent/agent_llm.txt +1 -1
  15. solace_agent_mesh/agent/agent_llm_detail.txt +1702 -0
  16. solace_agent_mesh/agent/protocol/event_handlers.py +4 -14
  17. solace_agent_mesh/agent/protocol/protocol_llm.txt +15 -2
  18. solace_agent_mesh/agent/protocol/protocol_llm_detail.txt +92 -0
  19. solace_agent_mesh/agent/sac/app.py +3 -1
  20. solace_agent_mesh/agent/sac/component.py +55 -22
  21. solace_agent_mesh/agent/sac/sac_llm.txt +15 -1
  22. solace_agent_mesh/agent/sac/sac_llm_detail.txt +200 -0
  23. solace_agent_mesh/agent/sac/task_execution_context.py +73 -0
  24. solace_agent_mesh/agent/testing/testing_llm_detail.txt +68 -0
  25. solace_agent_mesh/agent/tools/audio_tools.py +2 -1
  26. solace_agent_mesh/agent/tools/builtin_artifact_tools.py +3 -1
  27. solace_agent_mesh/agent/tools/builtin_data_analysis_tools.py +3 -1
  28. solace_agent_mesh/agent/tools/dynamic_tool.py +2 -1
  29. solace_agent_mesh/agent/tools/general_agent_tools.py +2 -1
  30. solace_agent_mesh/agent/tools/image_tools.py +2 -1
  31. solace_agent_mesh/agent/tools/peer_agent_tool.py +2 -1
  32. solace_agent_mesh/agent/tools/registry.py +3 -1
  33. solace_agent_mesh/agent/tools/test_tools.py +2 -1
  34. solace_agent_mesh/agent/tools/tools_llm.txt +148 -154
  35. solace_agent_mesh/agent/tools/tools_llm_detail.txt +274 -0
  36. solace_agent_mesh/agent/tools/web_tools.py +2 -1
  37. solace_agent_mesh/agent/utils/artifact_helpers.py +3 -1
  38. solace_agent_mesh/agent/utils/config_parser.py +3 -1
  39. solace_agent_mesh/agent/utils/utils_llm.txt +1 -1
  40. solace_agent_mesh/agent/utils/utils_llm_detail.txt +149 -0
  41. solace_agent_mesh/assets/docs/404.html +3 -3
  42. solace_agent_mesh/assets/docs/assets/js/{b7006a3a.73a79653.js → 032c2d61.f3d37824.js} +1 -1
  43. solace_agent_mesh/assets/docs/assets/js/0bcf40b7.c019ad46.js +1 -0
  44. solace_agent_mesh/assets/docs/assets/js/15ba94aa.932dd2db.js +1 -0
  45. solace_agent_mesh/assets/docs/assets/js/2131ec11.5c7a1f6e.js +1 -0
  46. solace_agent_mesh/assets/docs/assets/js/{2334.622a6395.js → 2334.1cf50a20.js} +1 -1
  47. solace_agent_mesh/assets/docs/assets/js/240a0364.7eac6021.js +1 -0
  48. solace_agent_mesh/assets/docs/assets/js/2e32b5e0.33f5d75b.js +1 -0
  49. solace_agent_mesh/assets/docs/assets/js/341393d4.0fac2613.js +1 -0
  50. solace_agent_mesh/assets/docs/assets/js/{3624.b524e433.js → 3624.0eaa1fd0.js} +1 -1
  51. solace_agent_mesh/assets/docs/assets/js/3a6c6137.f5940cfa.js +1 -0
  52. solace_agent_mesh/assets/docs/assets/js/3ac1795d.76654dd9.js +1 -0
  53. solace_agent_mesh/assets/docs/assets/js/3ff0015d.2be20244.js +1 -0
  54. solace_agent_mesh/assets/docs/assets/js/509e993c.4c7a1a6d.js +1 -0
  55. solace_agent_mesh/assets/docs/assets/js/547e15cc.2cbb060a.js +1 -0
  56. solace_agent_mesh/assets/docs/assets/js/55b7b518.f2b1d1ba.js +1 -0
  57. solace_agent_mesh/assets/docs/assets/js/5c2bd65f.e49689dd.js +1 -0
  58. solace_agent_mesh/assets/docs/assets/js/6063ff4c.ef84f702.js +1 -0
  59. solace_agent_mesh/assets/docs/assets/js/631738c7.a8b1ef8b.js +1 -0
  60. solace_agent_mesh/assets/docs/assets/js/6a520c9d.ba015d81.js +1 -0
  61. solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.39d5851d.js +1 -0
  62. solace_agent_mesh/assets/docs/assets/js/6d84eae0.4a5fbf39.js +1 -0
  63. solace_agent_mesh/assets/docs/assets/js/6fdfefc7.99de744e.js +1 -0
  64. solace_agent_mesh/assets/docs/assets/js/71da7b71.804d6567.js +1 -0
  65. solace_agent_mesh/assets/docs/assets/js/722f809d.965da774.js +1 -0
  66. solace_agent_mesh/assets/docs/assets/js/742f027b.46c07808.js +1 -0
  67. solace_agent_mesh/assets/docs/assets/js/77cf947d.64c9bd6c.js +1 -0
  68. solace_agent_mesh/assets/docs/assets/js/8024126c.56e59919.js +1 -0
  69. solace_agent_mesh/assets/docs/assets/js/81a99df0.07034dd9.js +1 -0
  70. solace_agent_mesh/assets/docs/assets/js/82fbfb93.139a1a1f.js +1 -0
  71. solace_agent_mesh/assets/docs/assets/js/{8591.d7c16be6.js → 8591.5d015485.js} +2 -2
  72. solace_agent_mesh/assets/docs/assets/js/{8731.49e930c2.js → 8731.6c1dbf0c.js} +1 -1
  73. solace_agent_mesh/assets/docs/assets/js/945fb41e.6f4cdffd.js +1 -0
  74. solace_agent_mesh/assets/docs/assets/js/94e8668d.b5ddb7a1.js +1 -0
  75. solace_agent_mesh/assets/docs/assets/js/9bb13469.dd1c9b54.js +1 -0
  76. solace_agent_mesh/assets/docs/assets/js/9e9d0a82.dd810042.js +1 -0
  77. solace_agent_mesh/assets/docs/assets/js/ab9708a8.3e6dd091.js +1 -0
  78. solace_agent_mesh/assets/docs/assets/js/ad71b5ed.60668e9e.js +1 -0
  79. solace_agent_mesh/assets/docs/assets/js/c198a0dc.8f31f867.js +1 -0
  80. solace_agent_mesh/assets/docs/assets/js/c93cbaa0.eaff365e.js +1 -0
  81. solace_agent_mesh/assets/docs/assets/js/da0b5bad.9d369087.js +1 -0
  82. solace_agent_mesh/assets/docs/assets/js/db924877.cbc66f02.js +1 -0
  83. solace_agent_mesh/assets/docs/assets/js/dd817ffc.0aa9630a.js +1 -0
  84. solace_agent_mesh/assets/docs/assets/js/dd81e2b8.d590bc9e.js +1 -0
  85. solace_agent_mesh/assets/docs/assets/js/de5f4c65.e8241890.js +1 -0
  86. solace_agent_mesh/assets/docs/assets/js/de915948.139b4b9c.js +1 -0
  87. solace_agent_mesh/assets/docs/assets/js/e3d9abda.2b916f9e.js +1 -0
  88. solace_agent_mesh/assets/docs/assets/js/e6f9706b.582a78ca.js +1 -0
  89. solace_agent_mesh/assets/docs/assets/js/e92d0134.cf6d6522.js +1 -0
  90. solace_agent_mesh/assets/docs/assets/js/f284c35a.5766a13d.js +1 -0
  91. solace_agent_mesh/assets/docs/assets/js/ff4d71f2.9c0297a6.js +1 -0
  92. solace_agent_mesh/assets/docs/assets/js/main.bd3c34f3.js +2 -0
  93. solace_agent_mesh/assets/docs/assets/js/runtime~main.18dc45dd.js +1 -0
  94. solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +143 -0
  95. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → components}/builtin-tools/artifact-management/index.html +7 -7
  96. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → components}/builtin-tools/audio-tools/index.html +7 -7
  97. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → components}/builtin-tools/data-analysis-tools/index.html +8 -8
  98. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → components}/builtin-tools/embeds/index.html +6 -6
  99. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → components}/builtin-tools/index.html +11 -11
  100. solace_agent_mesh/assets/docs/docs/documentation/{concepts → components}/cli/index.html +25 -25
  101. solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +91 -0
  102. solace_agent_mesh/assets/docs/docs/documentation/components/index.html +29 -0
  103. solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +55 -0
  104. solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +110 -0
  105. solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +104 -0
  106. solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +57 -0
  107. solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +25 -0
  108. solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +59 -0
  109. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → developing}/create-agents/index.html +113 -152
  110. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → developing}/create-gateways/index.html +9 -9
  111. solace_agent_mesh/assets/docs/docs/documentation/{user-guide → developing}/creating-python-tools/index.html +12 -12
  112. solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +54 -0
  113. solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +32 -0
  114. solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +55 -0
  115. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/bedrock-agents/index.html +25 -25
  116. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/custom-agent/index.html +13 -13
  117. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/event-mesh-gateway/index.html +11 -11
  118. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/mcp-integration/index.html +10 -10
  119. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/mongodb-integration/index.html +13 -13
  120. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/rag-integration/index.html +13 -13
  121. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/rest-gateway/index.html +10 -10
  122. solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +72 -0
  123. solace_agent_mesh/assets/docs/docs/documentation/{tutorials → developing/tutorials}/sql-database/index.html +14 -14
  124. solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +33 -0
  125. solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +83 -0
  126. solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +222 -0
  127. solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +161 -0
  128. solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +75 -0
  129. solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +53 -0
  130. solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +35 -100
  131. solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +41 -0
  132. solace_agent_mesh/assets/docs/docs/documentation/{getting-started → installing-and-configuring}/configurations/index.html +56 -50
  133. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +25 -0
  134. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +76 -0
  135. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +63 -0
  136. solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +142 -0
  137. solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +100 -0
  138. solace_agent_mesh/assets/docs/docs/documentation/{Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html → migrations/a2a-upgrade/a2a-technical-migration-map/index.html} +10 -11
  139. solace_agent_mesh/assets/docs/img/solace-logo.png +0 -0
  140. solace_agent_mesh/assets/docs/lunr-index-1760121512891.json +1 -0
  141. solace_agent_mesh/assets/docs/lunr-index.json +1 -1
  142. solace_agent_mesh/assets/docs/search-doc-1760121512891.json +1 -0
  143. solace_agent_mesh/assets/docs/search-doc.json +1 -1
  144. solace_agent_mesh/assets/docs/sitemap.xml +1 -1
  145. solace_agent_mesh/cli/__init__.py +1 -1
  146. solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-j1LW-wlq.js → authCallback-DwrxZE0E.js} +1 -1
  147. solace_agent_mesh/client/webui/frontend/static/assets/{client-B9p_nFNA.js → client-DarGQzyw.js} +1 -1
  148. solace_agent_mesh/client/webui/frontend/static/assets/main-2nd1gbaH.js +339 -0
  149. solace_agent_mesh/client/webui/frontend/static/assets/main-DoKXctCM.css +1 -0
  150. solace_agent_mesh/client/webui/frontend/static/assets/{vendor-CS5YMf8a.js → vendor-BKIeiHj_.js} +80 -70
  151. solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
  152. solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
  153. solace_agent_mesh/common/a2a/a2a_llm.txt +1 -1
  154. solace_agent_mesh/common/a2a/a2a_llm_detail.txt +193 -0
  155. solace_agent_mesh/common/a2a/artifact.py +2 -1
  156. solace_agent_mesh/common/a2a/protocol.py +3 -2
  157. solace_agent_mesh/common/a2a/translation.py +3 -1
  158. solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +1 -1
  159. solace_agent_mesh/common/a2a_spec/a2a_spec_llm_detail.txt +736 -0
  160. solace_agent_mesh/common/a2a_spec/schemas/llm_invocation.json +23 -0
  161. solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +93 -15
  162. solace_agent_mesh/common/a2a_spec/schemas/tool_result.json +23 -0
  163. solace_agent_mesh/common/common_llm.txt +24 -39
  164. solace_agent_mesh/common/common_llm_detail.txt +2562 -0
  165. solace_agent_mesh/common/data_parts.py +9 -1
  166. solace_agent_mesh/common/middleware/config_resolver.py +3 -1
  167. solace_agent_mesh/common/middleware/middleware_llm_detail.txt +185 -0
  168. solace_agent_mesh/common/middleware/registry.py +3 -1
  169. solace_agent_mesh/common/sac/sac_llm.txt +1 -1
  170. solace_agent_mesh/common/sac/sac_llm_detail.txt +82 -0
  171. solace_agent_mesh/common/sac/sam_component_base.py +2 -1
  172. solace_agent_mesh/common/sam_events/event_service.py +3 -2
  173. solace_agent_mesh/common/sam_events/sam_events_llm.txt +104 -0
  174. solace_agent_mesh/common/sam_events/sam_events_llm_detail.txt +115 -0
  175. solace_agent_mesh/common/services/employee_service.py +3 -1
  176. solace_agent_mesh/common/services/identity_service.py +2 -1
  177. solace_agent_mesh/common/services/providers/local_file_identity_service.py +2 -1
  178. solace_agent_mesh/common/services/services_llm.txt +57 -6
  179. solace_agent_mesh/common/services/services_llm_detail.txt +459 -0
  180. solace_agent_mesh/common/utils/artifact_utils.py +3 -1
  181. solace_agent_mesh/common/utils/asyncio_macos_fix.py +3 -1
  182. solace_agent_mesh/common/utils/embeds/converter.py +3 -1
  183. solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
  184. solace_agent_mesh/common/utils/embeds/evaluators.py +2 -1
  185. solace_agent_mesh/common/utils/embeds/modifiers.py +3 -2
  186. solace_agent_mesh/common/utils/embeds/resolver.py +2 -1
  187. solace_agent_mesh/common/utils/initializer.py +3 -1
  188. solace_agent_mesh/common/utils/message_utils.py +2 -1
  189. solace_agent_mesh/common/utils/push_notification_auth.py +3 -2
  190. solace_agent_mesh/common/utils/utils_llm.txt +75 -87
  191. solace_agent_mesh/common/utils/utils_llm_detail.txt +572 -0
  192. solace_agent_mesh/core_a2a/core_a2a_llm_detail.txt +101 -0
  193. solace_agent_mesh/core_a2a/service.py +2 -2
  194. solace_agent_mesh/gateway/base/app.py +3 -2
  195. solace_agent_mesh/gateway/base/base_llm.txt +1 -1
  196. solace_agent_mesh/gateway/base/base_llm_detail.txt +235 -0
  197. solace_agent_mesh/gateway/base/component.py +3 -1
  198. solace_agent_mesh/gateway/base/task_context.py +2 -1
  199. solace_agent_mesh/gateway/gateway_llm.txt +242 -235
  200. solace_agent_mesh/gateway/gateway_llm_detail.txt +3885 -0
  201. solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +295 -0
  202. solace_agent_mesh/gateway/http_sse/alembic/env.py +10 -1
  203. solace_agent_mesh/gateway/http_sse/alembic/versions/20251006_98882922fa59_add_tasks_events_feedback_chat_tasks.py +190 -0
  204. solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +155 -0
  205. solace_agent_mesh/gateway/http_sse/alembic.ini +1 -1
  206. solace_agent_mesh/gateway/http_sse/app.py +150 -3
  207. solace_agent_mesh/gateway/http_sse/component.py +372 -61
  208. solace_agent_mesh/gateway/http_sse/components/components_llm.txt +46 -6
  209. solace_agent_mesh/gateway/http_sse/components/task_logger_forwarder.py +109 -0
  210. solace_agent_mesh/gateway/http_sse/components/visualization_forwarder_component.py +4 -2
  211. solace_agent_mesh/gateway/http_sse/dependencies.py +119 -27
  212. solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +172 -172
  213. solace_agent_mesh/gateway/http_sse/http_sse_llm_detail.txt +3278 -0
  214. solace_agent_mesh/gateway/http_sse/main.py +149 -42
  215. solace_agent_mesh/gateway/http_sse/repository/__init__.py +3 -12
  216. solace_agent_mesh/gateway/http_sse/repository/chat_task_repository.py +103 -0
  217. solace_agent_mesh/gateway/http_sse/repository/entities/__init__.py +5 -3
  218. solace_agent_mesh/gateway/http_sse/repository/entities/chat_task.py +75 -0
  219. solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +263 -0
  220. solace_agent_mesh/gateway/http_sse/repository/entities/feedback.py +20 -0
  221. solace_agent_mesh/gateway/http_sse/repository/entities/session_history.py +0 -16
  222. solace_agent_mesh/gateway/http_sse/repository/entities/task.py +25 -0
  223. solace_agent_mesh/gateway/http_sse/repository/entities/task_event.py +21 -0
  224. solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +81 -0
  225. solace_agent_mesh/gateway/http_sse/repository/interfaces.py +73 -18
  226. solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -5
  227. solace_agent_mesh/gateway/http_sse/repository/models/chat_task_model.py +31 -0
  228. solace_agent_mesh/gateway/http_sse/repository/models/feedback_model.py +21 -0
  229. solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +266 -0
  230. solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +3 -3
  231. solace_agent_mesh/gateway/http_sse/repository/models/task_event_model.py +25 -0
  232. solace_agent_mesh/gateway/http_sse/repository/models/task_model.py +32 -0
  233. solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +340 -0
  234. solace_agent_mesh/gateway/http_sse/repository/session_repository.py +4 -53
  235. solace_agent_mesh/gateway/http_sse/repository/task_repository.py +173 -0
  236. solace_agent_mesh/gateway/http_sse/routers/agent_cards.py +3 -2
  237. solace_agent_mesh/gateway/http_sse/routers/artifacts.py +3 -3
  238. solace_agent_mesh/gateway/http_sse/routers/auth.py +3 -1
  239. solace_agent_mesh/gateway/http_sse/routers/config.py +29 -6
  240. solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +346 -0
  241. solace_agent_mesh/gateway/http_sse/routers/dto/requests/__init__.py +3 -3
  242. solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +83 -0
  243. solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +2 -10
  244. solace_agent_mesh/gateway/http_sse/routers/dto/requests/task_requests.py +58 -0
  245. solace_agent_mesh/gateway/http_sse/routers/dto/responses/__init__.py +5 -3
  246. solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +107 -0
  247. solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +1 -15
  248. solace_agent_mesh/gateway/http_sse/routers/dto/responses/task_responses.py +30 -0
  249. solace_agent_mesh/gateway/http_sse/routers/feedback.py +37 -0
  250. solace_agent_mesh/gateway/http_sse/routers/people.py +3 -1
  251. solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +255 -204
  252. solace_agent_mesh/gateway/http_sse/routers/sessions.py +223 -41
  253. solace_agent_mesh/gateway/http_sse/routers/sse.py +3 -2
  254. solace_agent_mesh/gateway/http_sse/routers/tasks.py +170 -43
  255. solace_agent_mesh/gateway/http_sse/routers/users.py +3 -1
  256. solace_agent_mesh/gateway/http_sse/routers/visualization.py +2 -1
  257. solace_agent_mesh/gateway/http_sse/services/agent_card_service.py +3 -1
  258. solace_agent_mesh/gateway/http_sse/services/data_retention_service.py +273 -0
  259. solace_agent_mesh/gateway/http_sse/services/feedback_service.py +242 -0
  260. solace_agent_mesh/gateway/http_sse/services/people_service.py +2 -82
  261. solace_agent_mesh/gateway/http_sse/services/services_llm.txt +177 -13
  262. solace_agent_mesh/gateway/http_sse/services/session_service.py +154 -85
  263. solace_agent_mesh/gateway/http_sse/services/task_logger_service.py +318 -0
  264. solace_agent_mesh/gateway/http_sse/services/task_service.py +3 -2
  265. solace_agent_mesh/gateway/http_sse/session_manager.py +2 -1
  266. solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +25 -14
  267. solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +285 -0
  268. solace_agent_mesh/gateway/http_sse/shared/types.py +7 -0
  269. solace_agent_mesh/gateway/http_sse/sse_event_buffer.py +2 -1
  270. solace_agent_mesh/gateway/http_sse/sse_manager.py +2 -2
  271. solace_agent_mesh/gateway/http_sse/utils/__init__.py +1 -0
  272. solace_agent_mesh/gateway/http_sse/utils/stim_utils.py +32 -0
  273. solace_agent_mesh/gateway/http_sse/utils/utils_llm.txt +47 -0
  274. solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
  275. solace_agent_mesh/solace_agent_mesh_llm_detail.txt +8599 -0
  276. solace_agent_mesh/templates/gateway_app_template.py +4 -2
  277. solace_agent_mesh/templates/gateway_component_template.py +3 -1
  278. solace_agent_mesh/templates/logging_config_template.ini +22 -45
  279. solace_agent_mesh/templates/plugin_tools_template.py +2 -2
  280. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.1.dist-info}/METADATA +2 -2
  281. solace_agent_mesh-1.5.1.dist-info/RECORD +504 -0
  282. solace_agent_mesh/agent/adk/invocation_monitor.py +0 -295
  283. solace_agent_mesh/assets/docs/assets/images/sac-flows-80d5b603c6aafd33e87945680ce0abf3.png +0 -0
  284. solace_agent_mesh/assets/docs/assets/images/sac_parts_of_a_component-cb3d0424b1d0c17734c5435cca6b4082.png +0 -0
  285. solace_agent_mesh/assets/docs/assets/js/04989206.a248f00c.js +0 -1
  286. solace_agent_mesh/assets/docs/assets/js/0e682baa.d54b8668.js +0 -1
  287. solace_agent_mesh/assets/docs/assets/js/1023fc19.8a8a9309.js +0 -1
  288. solace_agent_mesh/assets/docs/assets/js/1523c6b4.2645ef68.js +0 -1
  289. solace_agent_mesh/assets/docs/assets/js/166ab619.e27886d9.js +0 -1
  290. solace_agent_mesh/assets/docs/assets/js/1c6e87d2.e056b7e0.js +0 -1
  291. solace_agent_mesh/assets/docs/assets/js/21ceee5f.3bf39250.js +0 -1
  292. solace_agent_mesh/assets/docs/assets/js/2a9cab12.2afaee76.js +0 -1
  293. solace_agent_mesh/assets/docs/assets/js/332e10b5.f7629851.js +0 -1
  294. solace_agent_mesh/assets/docs/assets/js/3d406171.5560fdf9.js +0 -1
  295. solace_agent_mesh/assets/docs/assets/js/42b3f8d8.508ae8db.js +0 -1
  296. solace_agent_mesh/assets/docs/assets/js/442a8107.b5c2532a.js +0 -1
  297. solace_agent_mesh/assets/docs/assets/js/453a82a6.3c6bb61d.js +0 -1
  298. solace_agent_mesh/assets/docs/assets/js/483cef9a.4736f2d8.js +0 -1
  299. solace_agent_mesh/assets/docs/assets/js/4c2787c2.c1290a40.js +0 -1
  300. solace_agent_mesh/assets/docs/assets/js/55f47984.bcd00a86.js +0 -1
  301. solace_agent_mesh/assets/docs/assets/js/5b4258a4.fdfd2325.js +0 -1
  302. solace_agent_mesh/assets/docs/assets/js/664b740a.ba305a89.js +0 -1
  303. solace_agent_mesh/assets/docs/assets/js/75384d09.c19e8b51.js +0 -1
  304. solace_agent_mesh/assets/docs/assets/js/768e31b0.9abcdc48.js +0 -1
  305. solace_agent_mesh/assets/docs/assets/js/85387663.be2bc838.js +0 -1
  306. solace_agent_mesh/assets/docs/assets/js/945fb41e.16e00776.js +0 -1
  307. solace_agent_mesh/assets/docs/assets/js/9a09e75d.92de8cf5.js +0 -1
  308. solace_agent_mesh/assets/docs/assets/js/9eff14a2.d62aad71.js +0 -1
  309. solace_agent_mesh/assets/docs/assets/js/a12a4955.25fbed32.js +0 -1
  310. solace_agent_mesh/assets/docs/assets/js/a3a92b25.af35e313.js +0 -1
  311. solace_agent_mesh/assets/docs/assets/js/aba87c2f.4ddf32f2.js +0 -1
  312. solace_agent_mesh/assets/docs/assets/js/ae0e903d.5fe5203f.js +0 -1
  313. solace_agent_mesh/assets/docs/assets/js/ae4415af.16cc58d3.js +0 -1
  314. solace_agent_mesh/assets/docs/assets/js/bac0be12.17de4316.js +0 -1
  315. solace_agent_mesh/assets/docs/assets/js/c2c06897.87cb1f47.js +0 -1
  316. solace_agent_mesh/assets/docs/assets/js/c835a94d.ce21f0bf.js +0 -1
  317. solace_agent_mesh/assets/docs/assets/js/cc969b05.feef7dcc.js +0 -1
  318. solace_agent_mesh/assets/docs/assets/js/cd3d4052.a19e7d78.js +0 -1
  319. solace_agent_mesh/assets/docs/assets/js/ced92a13.fb92e7ca.js +0 -1
  320. solace_agent_mesh/assets/docs/assets/js/cee5d587.47904f5e.js +0 -1
  321. solace_agent_mesh/assets/docs/assets/js/d6a81ee7.829198f1.js +0 -1
  322. solace_agent_mesh/assets/docs/assets/js/f284c35a.ed8dd236.js +0 -1
  323. solace_agent_mesh/assets/docs/assets/js/f897a61a.126663fe.js +0 -1
  324. solace_agent_mesh/assets/docs/assets/js/fbfa3e75.e144b16c.js +0 -1
  325. solace_agent_mesh/assets/docs/assets/js/main.f67fc9f4.js +0 -2
  326. solace_agent_mesh/assets/docs/assets/js/runtime~main.40527046.js +0 -1
  327. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +0 -46
  328. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/rbac-setup-guilde/index.html +0 -201
  329. solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +0 -25
  330. solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +0 -105
  331. solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +0 -144
  332. solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +0 -91
  333. solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +0 -91
  334. solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +0 -55
  335. solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +0 -111
  336. solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +0 -77
  337. solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +0 -48
  338. solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +0 -54
  339. solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +0 -45
  340. solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/litellm_models/index.html +0 -49
  341. solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +0 -76
  342. solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +0 -73
  343. solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +0 -72
  344. solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +0 -54
  345. solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +0 -69
  346. solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +0 -59
  347. solace_agent_mesh/assets/docs/lunr-index-1759936913198.json +0 -1
  348. solace_agent_mesh/assets/docs/search-doc-1759936913198.json +0 -1
  349. solace_agent_mesh/client/webui/frontend/static/assets/main-ChRwcV89.css +0 -1
  350. solace_agent_mesh/client/webui/frontend/static/assets/main-DnnE01OM.js +0 -339
  351. solace_agent_mesh/gateway/http_sse/repository/entities/message.py +0 -41
  352. solace_agent_mesh/gateway/http_sse/repository/message_repository.py +0 -84
  353. solace_agent_mesh/gateway/http_sse/repository/models/message_model.py +0 -45
  354. solace_agent_mesh-1.4.12.dist-info/RECORD +0 -448
  355. /solace_agent_mesh/assets/docs/assets/js/{8591.d7c16be6.js.LICENSE.txt → 8591.5d015485.js.LICENSE.txt} +0 -0
  356. /solace_agent_mesh/assets/docs/assets/js/{main.f67fc9f4.js.LICENSE.txt → main.bd3c34f3.js.LICENSE.txt} +0 -0
  357. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.1.dist-info}/WHEEL +0 -0
  358. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.1.dist-info}/entry_points.txt +0 -0
  359. {solace_agent_mesh-1.4.12.dist-info → solace_agent_mesh-1.5.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,339 +0,0 @@
1
- var Op=Object.defineProperty;var Fp=(e,t,n)=>t in e?Op(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ma=(e,t,n)=>Fp(e,typeof t!="symbol"?t+"":t,n);import{c as zp}from"./client-B9p_nFNA.js";import{r as u,j as a,c as Yl,a as Wr,R as vi,b as $p,N as go,X as Do,E as Bp,d as Ut,C as Kl,e as wi,f as Up,A as ql,L as bi,g as yi,P as Xl,B as Hp,S as Wp,F as ha,h as Gp,i as Vp,k as ar,l as Yp,m as Kp,n as qp,o as Zl,D as Si,p as Jl,q as Xp,T as Zp,M as Ql,I as Ci,s as ec,t as Jp,u as Qp,v as em,w as tc,x as tm,y as nc,z as nm,G as rm,H as ga,J as om,K as rc,O as oc,Q as sm,U as Je,V as Qe,W as sc,Y as im,Z as am,_ as xa,$ as va,a0 as fs,a1 as lm,a2 as cm,a3 as um,a4 as dm,a5 as fm,a6 as pm,a7 as mm,a8 as hm,a9 as gm,aa as xm,ab as vm,ac as ic,ad as ac,ae as wm,af as wa,ag as ba,ah as bm,ai as ya,aj as ym,ak as Sm,al as Cm}from"./vendor-CS5YMf8a.js";function Sa(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function lc(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Sa(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Sa(e[o],null)}}}}function $e(...e){return u.useCallback(lc(...e),e)}function Dn(e){const t=Em(e),n=u.forwardRef((r,o)=>{const{children:s,...i}=r,l=u.Children.toArray(s),c=l.find(Am);if(c){const d=c.props.children,f=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return a.jsx(t,{...i,ref:o,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var cc=Dn("Slot");function Em(e){const t=u.forwardRef((n,r)=>{const{children:o,...s}=n;if(u.isValidElement(o)){const i=km(o),l=Nm(s,o.props);return o.type!==u.Fragment&&(l.ref=r?lc(r,i):i),u.cloneElement(o,l)}return u.Children.count(o)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var uc=Symbol("radix.slottable");function Tm(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=uc,t}function Am(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===uc}function Nm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function km(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)}const Ca=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ea=Yl,Nn=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return Ea(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(d=>{const f=n==null?void 0:n[d],p=s==null?void 0:s[d];if(f===null)return null;const m=Ca(f)||Ca(p);return o[d][m]}),l=n&&Object.entries(n).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(x=>{let[h,v]=x;return Array.isArray(v)?v.includes({...s,...l}[h]):{...s,...l}[h]===v})?[...d,p,m]:d},[]);return Ea(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},Ei=()=>localStorage.getItem("access_token"),_m=()=>localStorage.getItem("refresh_token"),Im=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},jm=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},Rm=async()=>{const e=_m();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 Im(n.access_token,n.refresh_token),n.access_token}return jm(),window.location.href="/api/v1/auth/login",null},ze=async(e,t={})=>{const n=Ei();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 Rm();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},Ti="-",Mm=e=>{const t=Lm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Ti);return l[0]===""&&l.length!==1&&l.shift(),dc(l,t)||Pm(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},dc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?dc(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Ti);return(i=t.validators.find(({validator:l})=>l(s)))==null?void 0:i.classGroupId},Ta=/^\[(.+)\]$/,Pm=e=>{if(Ta.test(e)){const t=Ta.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Lm=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Bs(n[o],r,o,t);return r},Bs=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Aa(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Dm(o)){Bs(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Bs(i,Aa(t,s),n,r)})})},Aa=(e,t)=>{let n=e;return t.split(Ti).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Dm=e=>e.isThemeGetter,Om=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Us="!",Hs=":",Fm=Hs.length,zm=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,d;for(let x=0;x<o.length;x++){let h=o[x];if(i===0&&l===0){if(h===Hs){s.push(o.slice(c,x)),c=x+Fm;continue}if(h==="/"){d=x;continue}}h==="["?i++:h==="]"?i--:h==="("?l++:h===")"&&l--}const f=s.length===0?o:o.substring(c),p=$m(f),m=p!==f,g=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:g}};if(t){const o=t+Hs,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},$m=e=>e.endsWith(Us)?e.substring(0,e.length-1):e.startsWith(Us)?e.substring(1):e,Bm=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},Um=e=>({cache:Om(e.cacheSize),parseClassName:zm(e),sortModifiers:Bm(e),...Mm(e)}),Hm=/\s+/,Wm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Hm);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:p,modifiers:m,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:h}=n(f);if(p){c=f+(c.length>0?" "+c:c);continue}let v=!!h,b=r(v?x.substring(0,h):x);if(!b){if(!v){c=f+(c.length>0?" "+c:c);continue}if(b=r(x),!b){c=f+(c.length>0?" "+c:c);continue}v=!1}const w=s(m).join(":"),S=g?w+Us:w,E=S+b;if(i.includes(E))continue;i.push(E);const N=o(b,v);for(let j=0;j<N.length;++j){const k=N[j];i.push(S+k)}c=f+(c.length>0?" "+c:c)}return c};function Gm(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=fc(t))&&(r&&(r+=" "),r+=n);return r}const fc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=fc(e[r]))&&(n&&(n+=" "),n+=t);return n};function Vm(e,...t){let n,r,o,s=i;function i(c){const d=t.reduce((f,p)=>p(f),e());return n=Um(d),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const d=r(c);if(d)return d;const f=Wm(c,n);return o(c,f),f}return function(){return s(Gm.apply(null,arguments))}}const Ye=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},pc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,mc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ym=/^\d+\/\d+$/,Km=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,qm=/\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$/,Xm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Zm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vn=e=>Ym.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),vn=e=>!!e&&Number.isInteger(Number(e)),ps=e=>e.endsWith("%")&&Te(e.slice(0,-1)),ln=e=>Km.test(e),Qm=()=>!0,eh=e=>qm.test(e)&&!Xm.test(e),hc=()=>!1,th=e=>Zm.test(e),nh=e=>Jm.test(e),rh=e=>!oe(e)&&!se(e),oh=e=>hr(e,vc,hc),oe=e=>pc.test(e),Rn=e=>hr(e,wc,eh),ms=e=>hr(e,ch,Te),Na=e=>hr(e,gc,hc),sh=e=>hr(e,xc,nh),Qr=e=>hr(e,bc,th),se=e=>mc.test(e),Cr=e=>gr(e,wc),ih=e=>gr(e,uh),ka=e=>gr(e,gc),ah=e=>gr(e,vc),lh=e=>gr(e,xc),eo=e=>gr(e,bc,!0),hr=(e,t,n)=>{const r=pc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},gr=(e,t,n=!1)=>{const r=mc.exec(e);return r?r[1]?t(r[1]):n:!1},gc=e=>e==="position"||e==="percentage",xc=e=>e==="image"||e==="url",vc=e=>e==="length"||e==="size"||e==="bg-size",wc=e=>e==="length",ch=e=>e==="number",uh=e=>e==="family-name",bc=e=>e==="shadow",dh=()=>{const e=Ye("color"),t=Ye("font"),n=Ye("text"),r=Ye("font-weight"),o=Ye("tracking"),s=Ye("leading"),i=Ye("breakpoint"),l=Ye("container"),c=Ye("spacing"),d=Ye("radius"),f=Ye("shadow"),p=Ye("inset-shadow"),m=Ye("text-shadow"),g=Ye("drop-shadow"),x=Ye("blur"),h=Ye("perspective"),v=Ye("aspect"),b=Ye("ease"),w=Ye("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...E(),se,oe],j=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],T=()=>[se,oe,c],V=()=>[Vn,"full","auto",...T()],F=()=>[vn,"none","subgrid",se,oe],z=()=>["auto",{span:["full",vn,se,oe]},vn,se,oe],q=()=>[vn,"auto",se,oe],Q=()=>["auto","min","max","fr",se,oe],P=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Y=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...T()],B=()=>[Vn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],C=()=>[e,se,oe],_=()=>[...E(),ka,Na,{position:[se,oe]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],M=()=>["auto","cover","contain",ah,oh,{size:[se,oe]}],J=()=>[ps,Cr,Rn],L=()=>["","none","full",d,se,oe],H=()=>["",Te,Cr,Rn],O=()=>["solid","dashed","dotted","double"],W=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[Te,ps,ka,Na],K=()=>["","none",x,se,oe],ee=()=>["none",Te,se,oe],te=()=>["none",Te,se,oe],ae=()=>[Te,se,oe],ie=()=>[Vn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ln],breakpoint:[ln],color:[Qm],container:[ln],"drop-shadow":[ln],ease:["in","out","in-out"],font:[rh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ln],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ln],shadow:[ln],spacing:["px",Te],text:[ln],"text-shadow":[ln],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Vn,oe,se,v]}],container:["container"],columns:[{columns:[Te,oe,se,l]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:N()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:V()}],"inset-x":[{"inset-x":V()}],"inset-y":[{"inset-y":V()}],start:[{start:V()}],end:[{end:V()}],top:[{top:V()}],right:[{right:V()}],bottom:[{bottom:V()}],left:[{left:V()}],visibility:["visible","invisible","collapse"],z:[{z:[vn,"auto",se,oe]}],basis:[{basis:[Vn,"full","auto",l,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Vn,"auto","initial","none",oe]}],grow:[{grow:["",Te,se,oe]}],shrink:[{shrink:["",Te,se,oe]}],order:[{order:[vn,"first","last","none",se,oe]}],"grid-cols":[{"grid-cols":F()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":F()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...P(),"normal"]}],"justify-items":[{"justify-items":[...Y(),"normal"]}],"justify-self":[{"justify-self":["auto",...Y()]}],"align-content":[{content:["normal",...P()]}],"align-items":[{items:[...Y(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Y(),{baseline:["","last"]}]}],"place-content":[{"place-content":P()}],"place-items":[{"place-items":[...Y(),"baseline"]}],"place-self":[{"place-self":["auto",...Y()]}],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:B()}],w:[{w:[l,"screen",...B()]}],"min-w":[{"min-w":[l,"screen","none",...B()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,Cr,Rn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,se,ms]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ps,oe]}],"font-family":[{font:[ih,oe,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,se,oe]}],"line-clamp":[{"line-clamp":[Te,"none",se,ms]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",se,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:C()}],"text-color":[{text:C()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...O(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",se,Rn]}],"text-decoration-color":[{decoration:C()}],"underline-offset":[{"underline-offset":[Te,"auto",se,oe]}],"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",se,oe]}],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",se,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:M()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vn,se,oe],radial:["",se,oe],conic:[vn,se,oe]},lh,sh]}],"bg-color":[{bg:C()}],"gradient-from-pos":[{from:J()}],"gradient-via-pos":[{via:J()}],"gradient-to-pos":[{to:J()}],"gradient-from":[{from:C()}],"gradient-via":[{via:C()}],"gradient-to":[{to:C()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...O(),"hidden","none"]}],"divide-style":[{divide:[...O(),"hidden","none"]}],"border-color":[{border:C()}],"border-color-x":[{"border-x":C()}],"border-color-y":[{"border-y":C()}],"border-color-s":[{"border-s":C()}],"border-color-e":[{"border-e":C()}],"border-color-t":[{"border-t":C()}],"border-color-r":[{"border-r":C()}],"border-color-b":[{"border-b":C()}],"border-color-l":[{"border-l":C()}],"divide-color":[{divide:C()}],"outline-style":[{outline:[...O(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,se,oe]}],"outline-w":[{outline:["",Te,Cr,Rn]}],"outline-color":[{outline:C()}],shadow:[{shadow:["","none",f,eo,Qr]}],"shadow-color":[{shadow:C()}],"inset-shadow":[{"inset-shadow":["none",p,eo,Qr]}],"inset-shadow-color":[{"inset-shadow":C()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:C()}],"ring-offset-w":[{"ring-offset":[Te,Rn]}],"ring-offset-color":[{"ring-offset":C()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":C()}],"text-shadow":[{"text-shadow":["none",m,eo,Qr]}],"text-shadow-color":[{"text-shadow":C()}],opacity:[{opacity:[Te,se,oe]}],"mix-blend":[{"mix-blend":[...W(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":W()}],"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":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":I()}],"mask-image-linear-to-pos":[{"mask-linear-to":I()}],"mask-image-linear-from-color":[{"mask-linear-from":C()}],"mask-image-linear-to-color":[{"mask-linear-to":C()}],"mask-image-t-from-pos":[{"mask-t-from":I()}],"mask-image-t-to-pos":[{"mask-t-to":I()}],"mask-image-t-from-color":[{"mask-t-from":C()}],"mask-image-t-to-color":[{"mask-t-to":C()}],"mask-image-r-from-pos":[{"mask-r-from":I()}],"mask-image-r-to-pos":[{"mask-r-to":I()}],"mask-image-r-from-color":[{"mask-r-from":C()}],"mask-image-r-to-color":[{"mask-r-to":C()}],"mask-image-b-from-pos":[{"mask-b-from":I()}],"mask-image-b-to-pos":[{"mask-b-to":I()}],"mask-image-b-from-color":[{"mask-b-from":C()}],"mask-image-b-to-color":[{"mask-b-to":C()}],"mask-image-l-from-pos":[{"mask-l-from":I()}],"mask-image-l-to-pos":[{"mask-l-to":I()}],"mask-image-l-from-color":[{"mask-l-from":C()}],"mask-image-l-to-color":[{"mask-l-to":C()}],"mask-image-x-from-pos":[{"mask-x-from":I()}],"mask-image-x-to-pos":[{"mask-x-to":I()}],"mask-image-x-from-color":[{"mask-x-from":C()}],"mask-image-x-to-color":[{"mask-x-to":C()}],"mask-image-y-from-pos":[{"mask-y-from":I()}],"mask-image-y-to-pos":[{"mask-y-to":I()}],"mask-image-y-from-color":[{"mask-y-from":C()}],"mask-image-y-to-color":[{"mask-y-to":C()}],"mask-image-radial":[{"mask-radial":[se,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":I()}],"mask-image-radial-to-pos":[{"mask-radial-to":I()}],"mask-image-radial-from-color":[{"mask-radial-from":C()}],"mask-image-radial-to-color":[{"mask-radial-to":C()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":I()}],"mask-image-conic-to-pos":[{"mask-conic-to":I()}],"mask-image-conic-from-color":[{"mask-conic-from":C()}],"mask-image-conic-to-color":[{"mask-conic-to":C()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:M()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,oe]}],filter:[{filter:["","none",se,oe]}],blur:[{blur:K()}],brightness:[{brightness:[Te,se,oe]}],contrast:[{contrast:[Te,se,oe]}],"drop-shadow":[{"drop-shadow":["","none",g,eo,Qr]}],"drop-shadow-color":[{"drop-shadow":C()}],grayscale:[{grayscale:["",Te,se,oe]}],"hue-rotate":[{"hue-rotate":[Te,se,oe]}],invert:[{invert:["",Te,se,oe]}],saturate:[{saturate:[Te,se,oe]}],sepia:[{sepia:["",Te,se,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",se,oe]}],"backdrop-blur":[{"backdrop-blur":K()}],"backdrop-brightness":[{"backdrop-brightness":[Te,se,oe]}],"backdrop-contrast":[{"backdrop-contrast":[Te,se,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,se,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,se,oe]}],"backdrop-invert":[{"backdrop-invert":["",Te,se,oe]}],"backdrop-opacity":[{"backdrop-opacity":[Te,se,oe]}],"backdrop-saturate":[{"backdrop-saturate":[Te,se,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,se,oe]}],"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",se,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",se,oe]}],ease:[{ease:["linear","initial",b,se,oe]}],delay:[{delay:[Te,se,oe]}],animate:[{animate:["none",w,se,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,se,oe]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ee()}],"rotate-x":[{"rotate-x":ee()}],"rotate-y":[{"rotate-y":ee()}],"rotate-z":[{"rotate-z":ee()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:ae()}],"skew-x":[{"skew-x":ae()}],"skew-y":[{"skew-y":ae()}],transform:[{transform:[se,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":["translate-none"],accent:[{accent:C()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:C()}],"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",se,oe]}],"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",se,oe]}],fill:[{fill:["none",...C()]}],"stroke-w":[{stroke:[Te,Cr,Rn,ms]}],stroke:[{stroke:["none",...C()]}],"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"]}},fh=Vm(dh);function be(...e){return fh(Yl(e))}const ph=e=>{try{const t=new URL(e);if(t.protocol!=="artifact:")return null;const n=t.pathname.split("/").filter(s=>s),r=n[n.length-1],o=t.searchParams.get("version");return{filename:r,version:o}}catch(t){return console.error("Invalid artifact URI:",t),null}},yc=(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)}},mh=async e=>{try{let t,n=e.name;if(e.content){const r=atob(e.content),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);const s=new Uint8Array(o);t=new Blob([s],{type:e.mime_type||"application/octet-stream"})}else if(e.uri){const r=ph(e.uri);if(!r)throw new Error(`Invalid or unhandled URI format: ${e.uri}`);n=r.filename;const o=r.version||"latest",s=`/api/v1/artifacts/${encodeURIComponent(n)}/versions/${o}`,i=await ze(s,{credentials:"include"});if(!i.ok)throw new Error(`Failed to download file: ${i.statusText}`);t=await i.blob()}else throw new Error("File has no content or URI to download.");yc(t,n)}catch(t){console.error("Error creating download link:",t)}},Sc=(e,t=2)=>{if(e===0)return"0 Bytes";if(e<0||!Number.isFinite(e))return"Invalid size";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+o[s]},_a=e=>{if(!e)return"N/A";try{const t=new Date(e);if(isNaN(t.getTime()))return"N/A";const r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),s=Math.floor(o/60),i=Math.floor(s/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:s<24?`${s}h ago`:i===1?"Yesterday":i<7?`${i}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),"Invalid date"}},hh=e=>{if(!e)return"N/A";try{const t=new Date(e);return isNaN(t.getTime())?"N/A":t.toLocaleString()}catch{return"N/A"}},Ia=(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," "),gh=(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 ve(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 xh(e,t){const n=u.createContext(t),r=s=>{const{children:i,...l}=s,c=u.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function kn(e,t=[]){let n=[];function r(s,i){const l=u.createContext(i),c=n.length;n=[...n,i];const d=p=>{var b;const{scope:m,children:g,...x}=p,h=((b=m==null?void 0:m[e])==null?void 0:b[c])||l,v=u.useMemo(()=>x,Object.values(x));return a.jsx(h.Provider,{value:v,children:g})};d.displayName=s+"Provider";function f(p,m){var h;const g=((h=m==null?void 0:m[e])==null?void 0:h[c])||l,x=u.useContext(g);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,f]}const o=()=>{const s=n.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||s;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,vh(o,...t)]}function vh(...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(s){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const p=c(s)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var wh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=wh.reduce((e,t)=>{const n=Dn(`Primitive.${t}`),r=u.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function bh(e,t){e&&Wr.flushSync(()=>e.dispatchEvent(t))}function Cn(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function yh(e,t=globalThis==null?void 0:globalThis.document){const n=Cn(e);u.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 Sh="DismissableLayer",Ws="dismissableLayer.update",Ch="dismissableLayer.pointerDownOutside",Eh="dismissableLayer.focusOutside",ja,Cc=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Gr=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(Cc),[f,p]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=u.useState({}),x=$e(t,k=>p(k)),h=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),w=f?h.indexOf(f):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,N=Nh(k=>{const T=k.target,V=[...d.branches].some(F=>F.contains(T));!E||V||(o==null||o(k),i==null||i(k),k.defaultPrevented||l==null||l())},m),j=kh(k=>{const T=k.target;[...d.branches].some(F=>F.contains(T))||(s==null||s(k),i==null||i(k),k.defaultPrevented||l==null||l())},m);return yh(k=>{w===d.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(ja=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),Ra(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=ja)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),Ra())},[f,d]),u.useEffect(()=>{const k=()=>g({});return document.addEventListener(Ws,k),()=>document.removeEventListener(Ws,k)},[]),a.jsx(ke.div,{...c,ref:x,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,j.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,N.onPointerDownCapture)})});Gr.displayName=Sh;var Th="DismissableLayerBranch",Ah=u.forwardRef((e,t)=>{const n=u.useContext(Cc),r=u.useRef(null),o=$e(t,r);return u.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(ke.div,{...e,ref:o})});Ah.displayName=Th;function Nh(e,t=globalThis==null?void 0:globalThis.document){const n=Cn(e),r=u.useRef(!1),o=u.useRef(()=>{});return u.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Ec(Ch,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function kh(e,t=globalThis==null?void 0:globalThis.document){const n=Cn(e),r=u.useRef(!1);return u.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ec(Eh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Ra(){const e=new CustomEvent(Ws);document.dispatchEvent(e)}function Ec(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?bh(o,s):o.dispatchEvent(s)}var ot=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},_h=vi[" useId ".trim().toString()]||(()=>{}),Ih=0;function Qt(e){const[t,n]=u.useState(_h());return ot(()=>{n(r=>r??String(Ih++))},[e]),t?`radix-${t}`:""}const jh=["top","right","bottom","left"],En=Math.min,vt=Math.max,So=Math.round,to=Math.floor,en=e=>({x:e,y:e}),Rh={left:"right",right:"left",bottom:"top",top:"bottom"},Mh={start:"end",end:"start"};function Gs(e,t,n){return vt(e,En(t,n))}function pn(e,t){return typeof e=="function"?e(t):e}function mn(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Ai(e){return e==="x"?"y":"x"}function Ni(e){return e==="y"?"height":"width"}const Ph=new Set(["top","bottom"]);function Zt(e){return Ph.has(mn(e))?"y":"x"}function ki(e){return Ai(Zt(e))}function Lh(e,t,n){n===void 0&&(n=!1);const r=xr(e),o=ki(e),s=Ni(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Co(i)),[i,Co(i)]}function Dh(e){const t=Co(e);return[Vs(e),t,Vs(t)]}function Vs(e){return e.replace(/start|end/g,t=>Mh[t])}const Ma=["left","right"],Pa=["right","left"],Oh=["top","bottom"],Fh=["bottom","top"];function zh(e,t,n){switch(e){case"top":case"bottom":return n?t?Pa:Ma:t?Ma:Pa;case"left":case"right":return t?Oh:Fh;default:return[]}}function $h(e,t,n,r){const o=xr(e);let s=zh(mn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Vs)))),s}function Co(e){return e.replace(/left|right|bottom|top/g,t=>Rh[t])}function Bh(e){return{top:0,right:0,bottom:0,left:0,...e}}function Tc(e){return typeof e!="number"?Bh(e):{top:e,right:e,bottom:e,left:e}}function Eo(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 La(e,t,n){let{reference:r,floating:o}=e;const s=Zt(t),i=ki(t),l=Ni(i),c=mn(t),d=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let g;switch(c){case"top":g={x:f,y:r.y-o.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-o.width,y:p};break;default:g={x:r.x,y:r.y}}switch(xr(t)){case"start":g[i]-=m*(n&&d?-1:1);break;case"end":g[i]+=m*(n&&d?-1:1);break}return g}const Uh=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=La(d,r,c),m=r,g={},x=0;for(let h=0;h<l.length;h++){const{name:v,fn:b}=l[h],{x:w,y:S,data:E,reset:N}=await b({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:d,platform:i,elements:{reference:e,floating:t}});f=w??f,p=S??p,g={...g,[v]:{...g[v],...E}},N&&x<=50&&(x++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(d=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):N.rects),{x:f,y:p}=La(d,m,c)),h=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:g}};async function Lr(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=pn(t,e),x=Tc(g),v=l[m?p==="floating"?"reference":"floating":p],b=Eo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),w=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},N=Eo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:S,strategy:c}):w);return{top:(b.top-N.top+x.top)/E.y,bottom:(N.bottom-b.bottom+x.bottom)/E.y,left:(b.left-N.left+x.left)/E.x,right:(N.right-b.right+x.right)/E.x}}const Hh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=pn(e,t)||{};if(d==null)return{};const p=Tc(f),m={x:n,y:r},g=ki(o),x=Ni(g),h=await i.getDimensions(d),v=g==="y",b=v?"top":"left",w=v?"bottom":"right",S=v?"clientHeight":"clientWidth",E=s.reference[x]+s.reference[g]-m[g]-s.floating[x],N=m[g]-s.reference[g],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let k=j?j[S]:0;(!k||!await(i.isElement==null?void 0:i.isElement(j)))&&(k=l.floating[S]||s.floating[x]);const T=E/2-N/2,V=k/2-h[x]/2-1,F=En(p[b],V),z=En(p[w],V),q=F,Q=k-h[x]-z,P=k/2-h[x]/2+T,Y=Gs(q,P,Q),A=!c.arrow&&xr(o)!=null&&P!==Y&&s.reference[x]/2-(P<q?F:z)-h[x]/2<0,B=A?P<q?P-q:P-Q:0;return{[g]:m[g]+B,data:{[g]:Y,centerOffset:P-Y-B,...A&&{alignmentOffset:B}},reset:A}}}),Wh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:h=!0,...v}=pn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=mn(o),w=Zt(l),S=mn(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=m||(S||!h?[Co(l)]:Dh(l)),j=x!=="none";!m&&j&&N.push(...$h(l,h,x,E));const k=[l,...N],T=await Lr(t,v),V=[];let F=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&V.push(T[b]),p){const P=Lh(o,i,E);V.push(T[P[0]],T[P[1]])}if(F=[...F,{placement:o,overflows:V}],!V.every(P=>P<=0)){var z,q;const P=(((z=s.flip)==null?void 0:z.index)||0)+1,Y=k[P];if(Y&&(!(p==="alignment"?w!==Zt(Y):!1)||F.every(C=>Zt(C.placement)===w?C.overflows[0]>0:!0)))return{data:{index:P,overflows:F},reset:{placement:Y}};let A=(q=F.filter(B=>B.overflows[0]<=0).sort((B,C)=>B.overflows[1]-C.overflows[1])[0])==null?void 0:q.placement;if(!A)switch(g){case"bestFit":{var Q;const B=(Q=F.filter(C=>{if(j){const _=Zt(C.placement);return _===w||_==="y"}return!0}).map(C=>[C.placement,C.overflows.filter(_=>_>0).reduce((_,D)=>_+D,0)]).sort((C,_)=>C[1]-_[1])[0])==null?void 0:Q[0];B&&(A=B);break}case"initialPlacement":A=l;break}if(o!==A)return{reset:{placement:A}}}return{}}}};function Da(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Oa(e){return jh.some(t=>e[t]>=0)}const Gh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=pn(e,t);switch(r){case"referenceHidden":{const s=await Lr(t,{...o,elementContext:"reference"}),i=Da(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Oa(i)}}}case"escaped":{const s=await Lr(t,{...o,altBoundary:!0}),i=Da(s,n.floating);return{data:{escapedOffsets:i,escaped:Oa(i)}}}default:return{}}}}},Ac=new Set(["left","top"]);async function Vh(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=mn(n),l=xr(n),c=Zt(n)==="y",d=Ac.has(i)?-1:1,f=s&&c?-1:1,p=pn(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof x=="number"&&(g=l==="end"?x*-1:x),c?{x:g*f,y:m*d}:{x:m*d,y:g*f}}const Yh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await Vh(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Kh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=pn(e,t),d={x:n,y:r},f=await Lr(t,c),p=Zt(mn(o)),m=Ai(p);let g=d[m],x=d[p];if(s){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=g+f[v],S=g-f[b];g=Gs(w,g,S)}if(i){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=x+f[v],S=x-f[b];x=Gs(w,x,S)}const h=l.fn({...t,[m]:g,[p]:x});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:s,[p]:i}}}}}},qh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=pn(e,t),f={x:n,y:r},p=Zt(o),m=Ai(p);let g=f[m],x=f[p];const h=pn(l,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const S=m==="y"?"height":"width",E=s.reference[m]-s.floating[S]+v.mainAxis,N=s.reference[m]+s.reference[S]-v.mainAxis;g<E?g=E:g>N&&(g=N)}if(d){var b,w;const S=m==="y"?"width":"height",E=Ac.has(mn(o)),N=s.reference[p]-s.floating[S]+(E&&((b=i.offset)==null?void 0:b[p])||0)+(E?0:v.crossAxis),j=s.reference[p]+s.reference[S]+(E?0:((w=i.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);x<N?x=N:x>j&&(x=j)}return{[m]:g,[p]:x}}}},Xh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=pn(e,t),f=await Lr(t,d),p=mn(o),m=xr(o),g=Zt(o)==="y",{width:x,height:h}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const w=h-f.top-f.bottom,S=x-f.left-f.right,E=En(h-f[v],w),N=En(x-f[b],S),j=!t.middlewareData.shift;let k=E,T=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=w),j&&!m){const F=vt(f.left,0),z=vt(f.right,0),q=vt(f.top,0),Q=vt(f.bottom,0);g?T=x-2*(F!==0||z!==0?F+z:vt(f.left,f.right)):k=h-2*(q!==0||Q!==0?q+Q:vt(f.top,f.bottom))}await c({...t,availableWidth:T,availableHeight:k});const V=await i.getDimensions(l.floating);return x!==V.width||h!==V.height?{reset:{rects:!0}}:{}}}};function Oo(){return typeof window<"u"}function vr(e){return Nc(e)?(e.nodeName||"").toLowerCase():"#document"}function bt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rn(e){var t;return(t=(Nc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Nc(e){return Oo()?e instanceof Node||e instanceof bt(e).Node:!1}function Wt(e){return Oo()?e instanceof Element||e instanceof bt(e).Element:!1}function nn(e){return Oo()?e instanceof HTMLElement||e instanceof bt(e).HTMLElement:!1}function Fa(e){return!Oo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bt(e).ShadowRoot}const Zh=new Set(["inline","contents"]);function Vr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Zh.has(o)}const Jh=new Set(["table","td","th"]);function Qh(e){return Jh.has(vr(e))}const eg=[":popover-open",":modal"];function Fo(e){return eg.some(t=>{try{return e.matches(t)}catch{return!1}})}const tg=["transform","translate","scale","rotate","perspective"],ng=["transform","translate","scale","rotate","perspective","filter"],rg=["paint","layout","strict","content"];function _i(e){const t=Ii(),n=Wt(e)?Gt(e):e;return tg.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)||ng.some(r=>(n.willChange||"").includes(r))||rg.some(r=>(n.contain||"").includes(r))}function og(e){let t=Tn(e);for(;nn(t)&&!lr(t);){if(_i(t))return t;if(Fo(t))return null;t=Tn(t)}return null}function Ii(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const sg=new Set(["html","body","#document"]);function lr(e){return sg.has(vr(e))}function Gt(e){return bt(e).getComputedStyle(e)}function zo(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tn(e){if(vr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Fa(e)&&e.host||rn(e);return Fa(t)?t.host:t}function kc(e){const t=Tn(e);return lr(t)?e.ownerDocument?e.ownerDocument.body:e.body:nn(t)&&Vr(t)?t:kc(t)}function Dr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=kc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=bt(o);if(s){const l=Ys(i);return t.concat(i,i.visualViewport||[],Vr(o)?o:[],l&&n?Dr(l):[])}return t.concat(o,Dr(o,[],n))}function Ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _c(e){const t=Gt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=nn(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=So(n)!==s||So(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ji(e){return Wt(e)?e:e.contextElement}function rr(e){const t=ji(e);if(!nn(t))return en(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=_c(t);let i=(s?So(n.width):n.width)/r,l=(s?So(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ig=en(0);function Ic(e){const t=bt(e);return!Ii()||!t.visualViewport?ig:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ag(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bt(e)?!1:t}function On(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ji(e);let i=en(1);t&&(r?Wt(r)&&(i=rr(r)):i=rr(e));const l=ag(s,n,r)?Ic(s):en(0);let c=(o.left+l.x)/i.x,d=(o.top+l.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=bt(s),g=r&&Wt(r)?bt(r):r;let x=m,h=Ys(x);for(;h&&r&&g!==x;){const v=rr(h),b=h.getBoundingClientRect(),w=Gt(h),S=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*v.x,E=b.top+(h.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,p*=v.y,c+=S,d+=E,x=bt(h),h=Ys(x)}}return Eo({width:f,height:p,x:c,y:d})}function $o(e,t){const n=zo(e).scrollLeft;return t?t.left+n:On(rn(e)).left+n}function jc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-$o(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function lg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=rn(r),l=t?Fo(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=en(1);const f=en(0),p=nn(r);if((p||!p&&!s)&&((vr(r)!=="body"||Vr(i))&&(c=zo(r)),nn(r))){const g=On(r);d=rr(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=i&&!p&&!s?jc(i,c):en(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function cg(e){return Array.from(e.getClientRects())}function ug(e){const t=rn(e),n=zo(e),r=e.ownerDocument.body,o=vt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=vt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+$o(e);const l=-n.scrollTop;return Gt(r).direction==="rtl"&&(i+=vt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const za=25;function dg(e,t){const n=bt(e),r=rn(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const f=Ii();(!f||f&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const d=$o(r);if(d<=0){const f=r.ownerDocument,p=f.body,m=getComputedStyle(p),g=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-g);x<=za&&(s-=x)}else d<=za&&(s+=d);return{width:s,height:i,x:l,y:c}}const fg=new Set(["absolute","fixed"]);function pg(e,t){const n=On(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=nn(e)?rr(e):en(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,d=r*s.y;return{width:i,height:l,x:c,y:d}}function $a(e,t,n){let r;if(t==="viewport")r=dg(e,n);else if(t==="document")r=ug(rn(e));else if(Wt(t))r=pg(t,n);else{const o=Ic(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Eo(r)}function Rc(e,t){const n=Tn(e);return n===t||!Wt(n)||lr(n)?!1:Gt(n).position==="fixed"||Rc(n,t)}function mg(e,t){const n=t.get(e);if(n)return n;let r=Dr(e,[],!1).filter(l=>Wt(l)&&vr(l)!=="body"),o=null;const s=Gt(e).position==="fixed";let i=s?Tn(e):e;for(;Wt(i)&&!lr(i);){const l=Gt(i),c=_i(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&fg.has(o.position)||Vr(i)&&!c&&Rc(e,i))?r=r.filter(f=>f!==i):o=l,i=Tn(i)}return t.set(e,r),r}function hg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Fo(t)?[]:mg(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,f)=>{const p=$a(t,f,o);return d.top=vt(p.top,d.top),d.right=En(p.right,d.right),d.bottom=En(p.bottom,d.bottom),d.left=vt(p.left,d.left),d},$a(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function gg(e){const{width:t,height:n}=_c(e);return{width:t,height:n}}function xg(e,t,n){const r=nn(t),o=rn(t),s=n==="fixed",i=On(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=en(0);function d(){c.x=$o(o)}if(r||!r&&!s)if((vr(t)!=="body"||Vr(o))&&(l=zo(t)),r){const g=On(t,!0,s,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else o&&d();s&&!r&&o&&d();const f=o&&!r&&!s?jc(o,l):en(0),p=i.left+l.scrollLeft-c.x-f.x,m=i.top+l.scrollTop-c.y-f.y;return{x:p,y:m,width:i.width,height:i.height}}function hs(e){return Gt(e).position==="static"}function Ba(e,t){if(!nn(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return rn(e)===n&&(n=n.ownerDocument.body),n}function Mc(e,t){const n=bt(e);if(Fo(e))return n;if(!nn(e)){let o=Tn(e);for(;o&&!lr(o);){if(Wt(o)&&!hs(o))return o;o=Tn(o)}return n}let r=Ba(e,t);for(;r&&Qh(r)&&hs(r);)r=Ba(r,t);return r&&lr(r)&&hs(r)&&!_i(r)?n:r||og(e)||n}const vg=async function(e){const t=this.getOffsetParent||Mc,n=this.getDimensions,r=await n(e.floating);return{reference:xg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wg(e){return Gt(e).direction==="rtl"}const bg={convertOffsetParentRelativeRectToViewportRelativeRect:lg,getDocumentElement:rn,getClippingRect:hg,getOffsetParent:Mc,getElementRects:vg,getClientRects:cg,getDimensions:gg,getScale:rr,isElement:Wt,isRTL:wg};function Pc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function yg(e,t){let n=null,r;const o=rn(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=d;if(l||t(),!m||!g)return;const x=to(p),h=to(o.clientWidth-(f+m)),v=to(o.clientHeight-(p+g)),b=to(f),S={rootMargin:-x+"px "+-h+"px "+-v+"px "+-b+"px",threshold:vt(0,En(1,c))||1};let E=!0;function N(j){const k=j[0].intersectionRatio;if(k!==c){if(!E)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!Pc(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(N,{...S,root:o.ownerDocument})}catch{n=new IntersectionObserver(N,S)}n.observe(e)}return i(!0),s}function Sg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=ji(e),f=o||s?[...d?Dr(d):[],...Dr(t)]:[];f.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const p=d&&l?yg(d,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),d&&!c&&g.observe(d),g.observe(t));let x,h=c?On(e):null;c&&v();function v(){const b=On(e);h&&!Pc(h,b)&&n(),h=b,x=requestAnimationFrame(v)}return n(),()=>{var b;f.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(b=g)==null||b.disconnect(),g=null,c&&cancelAnimationFrame(x)}}const Cg=Yh,Eg=Kh,Tg=Wh,Ag=Xh,Ng=Gh,Ua=Hh,kg=qh,_g=(e,t,n)=>{const r=new Map,o={platform:bg,...n},s={...o.platform,_c:r};return Uh(e,t,{...o,platform:s})};var Ig=typeof document<"u",jg=function(){},xo=Ig?u.useLayoutEffect:jg;function To(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(!To(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!To(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Lc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ha(e,t){const n=Lc(e);return Math.round(t*n)/n}function gs(e){const t=u.useRef(e);return xo(()=>{t.current=e}),t}function Rg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=u.useState(r);To(m,r)||g(r);const[x,h]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(C=>{C!==j.current&&(j.current=C,h(C))},[]),S=u.useCallback(C=>{C!==k.current&&(k.current=C,b(C))},[]),E=s||x,N=i||v,j=u.useRef(null),k=u.useRef(null),T=u.useRef(f),V=c!=null,F=gs(c),z=gs(o),q=gs(d),Q=u.useCallback(()=>{if(!j.current||!k.current)return;const C={placement:t,strategy:n,middleware:m};z.current&&(C.platform=z.current),_g(j.current,k.current,C).then(_=>{const D={..._,isPositioned:q.current!==!1};P.current&&!To(T.current,D)&&(T.current=D,Wr.flushSync(()=>{p(D)}))})},[m,t,n,z,q]);xo(()=>{d===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,p(C=>({...C,isPositioned:!1})))},[d]);const P=u.useRef(!1);xo(()=>(P.current=!0,()=>{P.current=!1}),[]),xo(()=>{if(E&&(j.current=E),N&&(k.current=N),E&&N){if(F.current)return F.current(E,N,Q);Q()}},[E,N,Q,F,V]);const Y=u.useMemo(()=>({reference:j,floating:k,setReference:w,setFloating:S}),[w,S]),A=u.useMemo(()=>({reference:E,floating:N}),[E,N]),B=u.useMemo(()=>{const C={position:n,left:0,top:0};if(!A.floating)return C;const _=Ha(A.floating,f.x),D=Ha(A.floating,f.y);return l?{...C,transform:"translate("+_+"px, "+D+"px)",...Lc(A.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:D}},[n,l,A.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:Q,refs:Y,elements:A,floatingStyles:B}),[f,Q,Y,A,B])}const Mg=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?Ua({element:r.current,padding:o}).fn(n):{}:r?Ua({element:r,padding:o}).fn(n):{}}}},Pg=(e,t)=>({...Cg(e),options:[e,t]}),Lg=(e,t)=>({...Eg(e),options:[e,t]}),Dg=(e,t)=>({...kg(e),options:[e,t]}),Og=(e,t)=>({...Tg(e),options:[e,t]}),Fg=(e,t)=>({...Ag(e),options:[e,t]}),zg=(e,t)=>({...Ng(e),options:[e,t]}),$g=(e,t)=>({...Mg(e),options:[e,t]});var Bg="Arrow",Dc=u.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(ke.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Dc.displayName=Bg;var Ug=Dc;function Hg(e){const[t,n]=u.useState(void 0);return ot(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Ri="Popper",[Oc,wr]=kn(Ri),[Wg,Fc]=Oc(Ri),zc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=u.useState(null);return a.jsx(Wg,{scope:t,anchor:r,onAnchorChange:o,children:n})};zc.displayName=Ri;var $c="PopperAnchor",Bc=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Fc($c,n),i=u.useRef(null),l=$e(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(ke.div,{...o,ref:l})});Bc.displayName=$c;var Mi="PopperContent",[Gg,Vg]=Oc(Mi),Uc=u.forwardRef((e,t)=>{var I,K,ee,te,ae,ie;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:x,...h}=e,v=Fc(Mi,n),[b,w]=u.useState(null),S=$e(t,de=>w(de)),[E,N]=u.useState(null),j=Hg(E),k=(j==null?void 0:j.width)??0,T=(j==null?void 0:j.height)??0,V=r+(s!=="center"?"-"+s:""),F=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},z=Array.isArray(d)?d:[d],q=z.length>0,Q={padding:F,boundary:z.filter(Kg),altBoundary:q},{refs:P,floatingStyles:Y,placement:A,isPositioned:B,middlewareData:C}=Rg({strategy:"fixed",placement:V,whileElementsMounted:(...de)=>Sg(...de,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[Pg({mainAxis:o+T,alignmentAxis:i}),c&&Lg({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Dg():void 0,...Q}),c&&Og({...Q}),Fg({...Q,apply:({elements:de,rects:ye,availableWidth:Ie,availableHeight:je})=>{const{width:Pe,height:Me}=ye.reference,Be=de.floating.style;Be.setProperty("--radix-popper-available-width",`${Ie}px`),Be.setProperty("--radix-popper-available-height",`${je}px`),Be.setProperty("--radix-popper-anchor-width",`${Pe}px`),Be.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),E&&$g({element:E,padding:l}),qg({arrowWidth:k,arrowHeight:T}),m&&zg({strategy:"referenceHidden",...Q})]}),[_,D]=Gc(A),M=Cn(x);ot(()=>{B&&(M==null||M())},[B,M]);const J=(I=C.arrow)==null?void 0:I.x,L=(K=C.arrow)==null?void 0:K.y,H=((ee=C.arrow)==null?void 0:ee.centerOffset)!==0,[O,W]=u.useState();return ot(()=>{b&&W(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...Y,transform:B?Y.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:O,"--radix-popper-transform-origin":[(te=C.transformOrigin)==null?void 0:te.x,(ae=C.transformOrigin)==null?void 0:ae.y].join(" "),...((ie=C.hide)==null?void 0:ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Gg,{scope:n,placedSide:_,onArrowChange:N,arrowX:J,arrowY:L,shouldHideArrow:H,children:a.jsx(ke.div,{"data-side":_,"data-align":D,...h,ref:S,style:{...h.style,animation:B?void 0:"none"}})})})});Uc.displayName=Mi;var Hc="PopperArrow",Yg={top:"bottom",right:"left",bottom:"top",left:"right"},Wc=u.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Vg(Hc,r),i=Yg[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Ug,{...o,ref:n,style:{...o.style,display:"block"}})})});Wc.displayName=Hc;function Kg(e){return e!==null}var qg=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:n,rects:r,middlewareData:o}=t,i=((v=o.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=Gc(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((b=o.arrow)==null?void 0:b.x)??0)+l/2,g=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let x="",h="";return d==="bottom"?(x=i?p:`${m}px`,h=`${-c}px`):d==="top"?(x=i?p:`${m}px`,h=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,h=i?p:`${g}px`):d==="left"&&(x=`${r.floating.width+c}px`,h=i?p:`${g}px`),{data:{x,y:h}}}});function Gc(e){const[t,n="center"]=e.split("-");return[t,n]}var Pi=zc,Bo=Bc,Li=Uc,Di=Wc,Xg="Portal",Yr=u.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=u.useState(!1);ot(()=>s(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?$p.createPortal(a.jsx(ke.div,{...r,ref:t}),i):null});Yr.displayName=Xg;function Zg(e,t){return u.useReducer((n,r)=>t[n][r]??n,e)}var gn=e=>{const{present:t,children:n}=e,r=Jg(t),o=typeof n=="function"?n({present:r.isPresent}):u.Children.only(n),s=$e(r.ref,Qg(o));return typeof n=="function"||r.isPresent?u.cloneElement(o,{ref:s}):null};gn.displayName="Presence";function Jg(e){const[t,n]=u.useState(),r=u.useRef(null),o=u.useRef(e),s=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=Zg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=no(r.current);s.current=l==="mounted"?d:"none"},[l]),ot(()=>{const d=r.current,f=o.current;if(f!==e){const m=s.current,g=no(d);e?c("MOUNT"):g==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ot(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=g=>{const h=no(r.current).includes(CSS.escape(g.animationName));if(g.target===t&&h&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=g=>{g.target===t&&(s.current=no(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function no(e){return(e==null?void 0:e.animationName)||"none"}function Qg(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 ex=vi[" useInsertionEffect ".trim().toString()]||ot;function Fn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=tx({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const p=f.current;p!==l&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${l?"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.`),f.current=l},[l,r])}const d=u.useCallback(f=>{var p;if(l){const m=nx(f)?f(e):f;m!==e&&((p=i.current)==null||p.call(i,m))}else s(f)},[l,e,s,i]);return[c,d]}function tx({defaultProp:e,onChange:t}){const[n,r]=u.useState(e),o=u.useRef(n),s=u.useRef(t);return ex(()=>{s.current=t},[t]),u.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function nx(e){return typeof e=="function"}var Vc=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"}),rx="VisuallyHidden",Yc=u.forwardRef((e,t)=>a.jsx(ke.span,{...e,ref:t,style:{...Vc,...e.style}}));Yc.displayName=rx;var ox=Yc,[Uo]=kn("Tooltip",[wr]),Ho=wr(),Kc="TooltipProvider",sx=700,Ks="tooltip.open",[ix,Oi]=Uo(Kc),qc=e=>{const{__scopeTooltip:t,delayDuration:n=sx,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(ix,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};qc.displayName=Kc;var Or="Tooltip",[ax,Kr]=Uo(Or),Xc=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Oi(Or,e.__scopeTooltip),d=Ho(t),[f,p]=u.useState(null),m=Qt(),g=u.useRef(0),x=i??c.disableHoverableContent,h=l??c.delayDuration,v=u.useRef(!1),[b,w]=Fn({prop:r,defaultProp:o??!1,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ks))):c.onClose(),s==null||s(k)},caller:Or}),S=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),E=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,v.current=!1,w(!0)},[w]),N=u.useCallback(()=>{window.clearTimeout(g.current),g.current=0,w(!1)},[w]),j=u.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{v.current=!0,w(!0),g.current=0},h)},[h,w]);return u.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),a.jsx(Pi,{...d,children:a.jsx(ax,{scope:t,contentId:m,open:b,stateAttribute:S,trigger:f,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?j():E()},[c.isOpenDelayedRef,j,E]),onTriggerLeave:u.useCallback(()=>{x?N():(window.clearTimeout(g.current),g.current=0)},[N,x]),onOpen:E,onClose:N,disableHoverableContent:x,children:n})})};Xc.displayName=Or;var qs="TooltipTrigger",Zc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Kr(qs,n),s=Oi(qs,n),i=Ho(n),l=u.useRef(null),c=$e(t,l,o.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Bo,{asChild:!0,...i,children:a.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ve(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ve(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});Zc.displayName=qs;var Fi="TooltipPortal",[lx,cx]=Uo(Fi,{forceMount:void 0}),Jc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Kr(Fi,t);return a.jsx(lx,{scope:t,forceMount:n,children:a.jsx(gn,{present:n||s.open,children:a.jsx(Yr,{asChild:!0,container:o,children:r})})})};Jc.displayName=Fi;var cr="TooltipContent",Qc=u.forwardRef((e,t)=>{const n=cx(cr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Kr(cr,e.__scopeTooltip);return a.jsx(gn,{present:r||i.open,children:i.disableHoverableContent?a.jsx(eu,{side:o,...s,ref:t}):a.jsx(ux,{side:o,...s,ref:t})})}),ux=u.forwardRef((e,t)=>{const n=Kr(cr,e.__scopeTooltip),r=Oi(cr,e.__scopeTooltip),o=u.useRef(null),s=$e(t,o),[i,l]=u.useState(null),{trigger:c,onClose:d}=n,f=o.current,{onPointerInTransitChange:p}=r,m=u.useCallback(()=>{l(null),p(!1)},[p]),g=u.useCallback((x,h)=>{const v=x.currentTarget,b={x:x.clientX,y:x.clientY},w=mx(b,v.getBoundingClientRect()),S=hx(b,w),E=gx(h.getBoundingClientRect()),N=vx([...S,...E]);l(N),p(!0)},[p]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const x=v=>g(v,f),h=v=>g(v,c);return c.addEventListener("pointerleave",x),f.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",h)}}},[c,f,g,m]),u.useEffect(()=>{if(i){const x=h=>{const v=h.target,b={x:h.clientX,y:h.clientY},w=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),S=!xx(b,i);w?m():S&&(m(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,f,i,d,m]),a.jsx(eu,{...e,ref:s})}),[dx,fx]=Uo(Or,{isInside:!1}),px=Tm("TooltipContent"),eu=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Kr(cr,n),d=Ho(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Ks,f),()=>document.removeEventListener(Ks,f)),[f]),u.useEffect(()=>{if(c.trigger){const p=m=>{const g=m.target;g!=null&&g.contains(c.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,f]),a.jsx(Gr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:a.jsxs(Li,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.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:[a.jsx(px,{children:r}),a.jsx(dx,{scope:n,isInside:!0,children:a.jsx(ox,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Qc.displayName=cr;var tu="TooltipArrow",nu=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ho(n);return fx(tu,n).isInside?null:a.jsx(Di,{...o,...r,ref:t})});nu.displayName=tu;function mx(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function hx(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 gx(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 xx(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,p=c.x,m=c.y;f>r!=m>r&&n<(p-d)*(r-f)/(m-f)+d&&(o=!o)}return o}function vx(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),wx(t)}function wx(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 bx=qc,yx=Xc,Sx=Zc,Cx=Jc,Ex=Qc,Tx=nu;function Ax({delayDuration:e=0,...t}){return a.jsx(bx,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function zi({...e}){return a.jsx(Ax,{delayDuration:500,children:a.jsx(yx,{"data-slot":"tooltip",...e})})}function $i({...e}){return a.jsx(Sx,{"data-slot":"tooltip-trigger",...e})}function Bi({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(Cx,{children:a.jsxs(Ex,{"data-slot":"tooltip-content",sideOffset:t,className:be("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,a.jsx(Tx,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const ru="text-[var(--color-primary-wMain)] hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:hover:text-[var(--color-primary-text-w10)]",xs=ru+" hover:bg-[var(--color-primary-w10)] dark:hover:bg-[var(--color-primary-w60)]",Nx=Nn("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:xs+" border border-1 border-[var(--color-primary-wMain)]",secondary:xs,ghost:xs,link:ru+" 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 we({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:s="",...i}){const l=r?cc:"button",c=o?{...i,"aria-label":o}:i,d=a.jsx(l,{"data-slot":"button","data-testid":s||o||i.title,className:be(Nx({variant:t,size:n,className:e})),...c});return o?a.jsxs(zi,{children:[a.jsx($i,{asChild:!0,children:d}),a.jsx(Bi,{children:o})]}):d}const ou=({onClick:e,text:t="View Agent Workflow"})=>a.jsx(we,{variant:"ghost",size:"sm",onClick:e,tooltip:t,children:a.jsx(go,{className:"h-4 w-4"})}),su=u.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:be("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}));su.displayName="Textarea";var vs="focusScope.autoFocusOnMount",ws="focusScope.autoFocusOnUnmount",Wa={bubbles:!1,cancelable:!0},kx="FocusScope",Wo=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=u.useState(null),d=Cn(o),f=Cn(s),p=u.useRef(null),m=$e(t,h=>c(h)),g=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let h=function(S){if(g.paused||!l)return;const E=S.target;l.contains(E)?p.current=E:wn(p.current,{select:!0})},v=function(S){if(g.paused||!l)return;const E=S.relatedTarget;E!==null&&(l.contains(E)||wn(p.current,{select:!0}))},b=function(S){if(document.activeElement===document.body)for(const N of S)N.removedNodes.length>0&&wn(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,g.paused]),u.useEffect(()=>{if(l){Va.add(g);const h=document.activeElement;if(!l.contains(h)){const b=new CustomEvent(vs,Wa);l.addEventListener(vs,d),l.dispatchEvent(b),b.defaultPrevented||(_x(Px(iu(l)),{select:!0}),document.activeElement===h&&wn(l))}return()=>{l.removeEventListener(vs,d),setTimeout(()=>{const b=new CustomEvent(ws,Wa);l.addEventListener(ws,f),l.dispatchEvent(b),b.defaultPrevented||wn(h??document.body,{select:!0}),l.removeEventListener(ws,f),Va.remove(g)},0)}}},[l,d,f,g]);const x=u.useCallback(h=>{if(!n&&!r||g.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(v&&b){const w=h.currentTarget,[S,E]=Ix(w);S&&E?!h.shiftKey&&b===E?(h.preventDefault(),n&&wn(S,{select:!0})):h.shiftKey&&b===S&&(h.preventDefault(),n&&wn(E,{select:!0})):b===w&&h.preventDefault()}},[n,r,g.paused]);return a.jsx(ke.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});Wo.displayName=kx;function _x(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(wn(r,{select:t}),document.activeElement!==n)return}function Ix(e){const t=iu(e),n=Ga(t,e),r=Ga(t.reverse(),e);return[n,r]}function iu(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 Ga(e,t){for(const n of e)if(!jx(n,{upTo:t}))return n}function jx(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 Rx(e){return e instanceof HTMLInputElement&&"select"in e}function wn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Rx(e)&&t&&e.select()}}var Va=Mx();function Mx(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ya(e,t),e.unshift(t)},remove(t){var n;e=Ya(e,t),(n=e[0])==null||n.resume()}}}function Ya(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Px(e){return e.filter(t=>t.tagName!=="A")}var bs=0;function Ui(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ka()),document.body.insertAdjacentElement("beforeend",e[1]??Ka()),bs++,()=>{bs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),bs--}},[])}function Ka(){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 Xt=function(){return Xt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Xt.apply(this,arguments)};function au(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 Lx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var vo="right-scroll-bar-position",wo="width-before-scroll-bar",Dx="with-scroll-bars-hidden",Ox="--removed-body-scroll-bar-size";function ys(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Fx(e,t){var n=u.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 zx=typeof window<"u"?u.useLayoutEffect:u.useEffect,qa=new WeakMap;function $x(e,t){var n=Fx(null,function(r){return e.forEach(function(o){return ys(o,r)})});return zx(function(){var r=qa.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||ys(l,null)}),s.forEach(function(l){o.has(l)||ys(l,i)})}qa.set(n,e)},[e]),n}function Bx(e){return e}function Ux(e,t){t===void 0&&(t=Bx);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(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var f=i;i=[],f.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return o}function Hx(e){e===void 0&&(e={});var t=Ux(null);return t.options=Xt({async:!0,ssr:!1},e),t}var lu=function(e){var t=e.sideCar,n=au(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 u.createElement(r,Xt({},n))};lu.isSideCarExport=!0;function Wx(e,t){return e.useMedium(t),lu}var cu=Hx(),Ss=function(){},Go=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:Ss,onWheelCapture:Ss,onTouchMoveCapture:Ss}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,g=e.noRelative,x=e.noIsolation,h=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,S=e.gapMode,E=au(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,j=$x([n,t]),k=Xt(Xt({},E),o);return u.createElement(u.Fragment,null,f&&u.createElement(N,{sideCar:cu,removeScrollBar:d,shards:p,noRelative:g,noIsolation:x,inert:h,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:S}),i?u.cloneElement(u.Children.only(l),Xt(Xt({},k),{ref:j})):u.createElement(w,Xt({},k,{className:c,ref:j}),l))});Go.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Go.classNames={fullWidth:wo,zeroRight:vo};var Gx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Vx(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Gx();return t&&e.setAttribute("nonce",t),e}function Yx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qx=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Vx())&&(Yx(t,n),Kx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Xx=function(){var e=qx();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},uu=function(){var e=Xx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Zx={left:0,top:0,right:0,gap:0},Cs=function(e){return parseInt(e||"",10)||0},Jx=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[Cs(n),Cs(r),Cs(o)]},Qx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Zx;var t=Jx(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])}},ev=uu(),or="data-scroll-locked",tv=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
73
- .`.concat(Dx,` {
74
- overflow: hidden `).concat(r,`;
75
- padding-right: `).concat(l,"px ").concat(r,`;
76
- }
77
- body[`).concat(or,`] {
78
- overflow: hidden `).concat(r,`;
79
- overscroll-behavior: contain;
80
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
81
- padding-left: `.concat(o,`px;
82
- padding-top: `).concat(s,`px;
83
- padding-right: `).concat(i,`px;
84
- margin-left:0;
85
- margin-top:0;
86
- margin-right: `).concat(l,"px ").concat(r,`;
87
- `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
88
- }
89
-
90
- .`).concat(vo,` {
91
- right: `).concat(l,"px ").concat(r,`;
92
- }
93
-
94
- .`).concat(wo,` {
95
- margin-right: `).concat(l,"px ").concat(r,`;
96
- }
97
-
98
- .`).concat(vo," .").concat(vo,` {
99
- right: 0 `).concat(r,`;
100
- }
101
-
102
- .`).concat(wo," .").concat(wo,` {
103
- margin-right: 0 `).concat(r,`;
104
- }
105
-
106
- body[`).concat(or,`] {
107
- `).concat(Ox,": ").concat(l,`px;
108
- }
109
- `)},Xa=function(){var e=parseInt(document.body.getAttribute(or)||"0",10);return isFinite(e)?e:0},nv=function(){u.useEffect(function(){return document.body.setAttribute(or,(Xa()+1).toString()),function(){var e=Xa()-1;e<=0?document.body.removeAttribute(or):document.body.setAttribute(or,e.toString())}},[])},rv=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;nv();var s=u.useMemo(function(){return Qx(o)},[o]);return u.createElement(ev,{styles:tv(s,!t,o,n?"":"!important")})},Xs=!1;if(typeof window<"u")try{var ro=Object.defineProperty({},"passive",{get:function(){return Xs=!0,!0}});window.addEventListener("test",ro,ro),window.removeEventListener("test",ro,ro)}catch{Xs=!1}var Yn=Xs?{passive:!1}:!1,ov=function(e){return e.tagName==="TEXTAREA"},du=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ov(e)&&n[t]==="visible")},sv=function(e){return du(e,"overflowY")},iv=function(e){return du(e,"overflowX")},Za=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=fu(e,r);if(o){var s=pu(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},av=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},lv=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},fu=function(e,t){return e==="v"?sv(t):iv(t)},pu=function(e,t){return e==="v"?av(t):lv(t)},cv=function(e,t){return e==="h"&&t==="rtl"?-1:1},uv=function(e,t,n,r,o){var s=cv(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),d=!1,f=i>0,p=0,m=0;do{if(!l)break;var g=pu(e,l),x=g[0],h=g[1],v=g[2],b=h-v-s*x;(x||b)&&fu(e,l)&&(p+=b,m+=x);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(d=!0),d},oo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ja=function(e){return[e.deltaX,e.deltaY]},Qa=function(e){return e&&"current"in e?e.current:e},dv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fv=function(e){return`
110
- .block-interactivity-`.concat(e,` {pointer-events: none;}
111
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
112
- `)},pv=0,Kn=[];function mv(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),o=u.useState(pv++)[0],s=u.useState(uu)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=Lx([e.lockRef.current],(e.shards||[]).map(Qa),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=oo(h),w=n.current,S="deltaX"in h?h.deltaX:w[0]-b[0],E="deltaY"in h?h.deltaY:w[1]-b[1],N,j=h.target,k=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in h&&k==="h"&&j.type==="range")return!1;var T=Za(k,j);if(!T)return!0;if(T?N=k:(N=k==="v"?"h":"v",T=Za(k,j)),!T)return!1;if(!r.current&&"changedTouches"in h&&(S||E)&&(r.current=N),!N)return!0;var V=r.current||N;return uv(V,v,h,V==="h"?S:E)},[]),c=u.useCallback(function(h){var v=h;if(!(!Kn.length||Kn[Kn.length-1]!==s)){var b="deltaY"in v?Ja(v):oo(v),w=t.current.filter(function(N){return N.name===v.type&&(N.target===v.target||v.target===N.shadowParent)&&dv(N.delta,b)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var S=(i.current.shards||[]).map(Qa).filter(Boolean).filter(function(N){return N.contains(v.target)}),E=S.length>0?l(v,S[0]):!i.current.noIsolation;E&&v.cancelable&&v.preventDefault()}}},[]),d=u.useCallback(function(h,v,b,w){var S={name:h,delta:v,target:b,should:w,shadowParent:hv(b)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),f=u.useCallback(function(h){n.current=oo(h),r.current=void 0},[]),p=u.useCallback(function(h){d(h.type,Ja(h),h.target,l(h,e.lockRef.current))},[]),m=u.useCallback(function(h){d(h.type,oo(h),h.target,l(h,e.lockRef.current))},[]);u.useEffect(function(){return Kn.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Yn),document.addEventListener("touchmove",c,Yn),document.addEventListener("touchstart",f,Yn),function(){Kn=Kn.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,Yn),document.removeEventListener("touchmove",c,Yn),document.removeEventListener("touchstart",f,Yn)}},[]);var g=e.removeScrollBar,x=e.inert;return u.createElement(u.Fragment,null,x?u.createElement(s,{styles:fv(o)}):null,g?u.createElement(rv,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const gv=Wx(cu,mv);var Vo=u.forwardRef(function(e,t){return u.createElement(Go,Xt({},e,{ref:t,sideCar:gv}))});Vo.classNames=Go.classNames;var xv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},qn=new WeakMap,so=new WeakMap,io={},Es=0,mu=function(e){return e&&(e.host||mu(e.parentNode))},vv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=mu(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})},wv=function(e,t,n,r){var o=vv(t,Array.isArray(e)?e:[e]);io[n]||(io[n]=new WeakMap);var s=io[n],i=[],l=new Set,c=new Set(o),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};o.forEach(d);var f=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))f(m);else try{var g=m.getAttribute(r),x=g!==null&&g!=="false",h=(qn.get(m)||0)+1,v=(s.get(m)||0)+1;qn.set(m,h),s.set(m,v),i.push(m),h===1&&x&&so.set(m,!0),v===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return f(t),l.clear(),Es++,function(){i.forEach(function(p){var m=qn.get(p)-1,g=s.get(p)-1;qn.set(p,m),s.set(p,g),m||(so.has(p)||p.removeAttribute(r),so.delete(p)),g||p.removeAttribute(n)}),Es--,Es||(qn=new WeakMap,qn=new WeakMap,so=new WeakMap,io={})}},Hi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=xv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),wv(r,o,n,"aria-hidden")):function(){return null}},Yo="Dialog",[hu]=kn(Yo),[bv,Vt]=hu(Yo),gu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=u.useRef(null),c=u.useRef(null),[d,f]=Fn({prop:r,defaultProp:o??!1,onChange:s,caller:Yo});return a.jsx(bv,{scope:t,triggerRef:l,contentRef:c,contentId:Qt(),titleId:Qt(),descriptionId:Qt(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(p=>!p),[f]),modal:i,children:n})};gu.displayName=Yo;var xu="DialogTrigger",yv=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vt(xu,n),s=$e(t,o.triggerRef);return a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Vi(o.open),...r,ref:s,onClick:ve(e.onClick,o.onOpenToggle)})});yv.displayName=xu;var Wi="DialogPortal",[Sv,vu]=hu(Wi,{forceMount:void 0}),wu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Vt(Wi,t);return a.jsx(Sv,{scope:t,forceMount:n,children:u.Children.map(r,i=>a.jsx(gn,{present:n||s.open,children:a.jsx(Yr,{asChild:!0,container:o,children:i})}))})};wu.displayName=Wi;var Ao="DialogOverlay",bu=u.forwardRef((e,t)=>{const n=vu(Ao,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vt(Ao,e.__scopeDialog);return s.modal?a.jsx(gn,{present:r||s.open,children:a.jsx(Ev,{...o,ref:t})}):null});bu.displayName=Ao;var Cv=Dn("DialogOverlay.RemoveScroll"),Ev=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vt(Ao,n);return a.jsx(Vo,{as:Cv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(ke.div,{"data-state":Vi(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),zn="DialogContent",yu=u.forwardRef((e,t)=>{const n=vu(zn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Vt(zn,e.__scopeDialog);return a.jsx(gn,{present:r||s.open,children:s.modal?a.jsx(Tv,{...o,ref:t}):a.jsx(Av,{...o,ref:t})})});yu.displayName=zn;var Tv=u.forwardRef((e,t)=>{const n=Vt(zn,e.__scopeDialog),r=u.useRef(null),o=$e(t,n.contentRef,r);return u.useEffect(()=>{const s=r.current;if(s)return Hi(s)},[]),a.jsx(Su,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,s=>s.preventDefault())})}),Av=u.forwardRef((e,t)=>{const n=Vt(zn,e.__scopeDialog),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(Su,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Su=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=Vt(zn,n),c=u.useRef(null),d=$e(t,c);return Ui(),a.jsxs(a.Fragment,{children:[a.jsx(Wo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Gr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Vi(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Nv,{titleId:l.titleId}),a.jsx(_v,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Gi="DialogTitle",Cu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vt(Gi,n);return a.jsx(ke.h2,{id:o.titleId,...r,ref:t})});Cu.displayName=Gi;var Eu="DialogDescription",Tu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vt(Eu,n);return a.jsx(ke.p,{id:o.descriptionId,...r,ref:t})});Tu.displayName=Eu;var Au="DialogClose",Nu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Vt(Au,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});Nu.displayName=Au;function Vi(e){return e?"open":"closed"}var ku="DialogTitleWarning",[TE,_u]=xh(ku,{contentName:zn,titleName:Gi,docsSlug:"dialog"}),Nv=({titleId:e})=>{const t=_u(ku),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
113
-
114
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
115
-
116
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},kv="DialogDescriptionWarning",_v=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_u(kv).contentName}}.`;return u.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Iv=gu,jv=wu,Rv=bu,Mv=yu,Pv=Cu,Lv=Tu,Dv=Nu;function Ko({...e}){return a.jsx(Iv,{"data-slot":"dialog",...e})}function Ov({...e}){return a.jsx(jv,{"data-slot":"dialog-portal",...e})}function Fv({className:e,...t}){return a.jsx(Rv,{"data-slot":"dialog-overlay",className:be("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 qo({className:e,children:t,showCloseButton:n=!0,...r}){return a.jsxs(Ov,{"data-slot":"dialog-portal",children:[a.jsx(Fv,{}),a.jsxs(Mv,{"data-slot":"dialog-content",className:be("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&&a.jsxs(Dv,{"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:[a.jsx(Do,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Xo({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:be("flex flex-col gap-2 text-center sm:text-left",e),...t})}function zv({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-footer",className:be("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Zo({className:e,...t}){return a.jsx(Pv,{"data-slot":"dialog-title",className:be("text-lg leading-none font-semibold",e),...t})}function Jo({className:e,...t}){return a.jsx(Lv,{"data-slot":"dialog-description",className:be("py-4 text-sm",e),...t})}const Qo=u.createContext(null);Qo.displayName="PanelGroupContext";const Ue={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"},Yi=10,Pn=u.useLayoutEffect,el=vi.useId,$v=typeof el=="function"?el:()=>null;let Bv=0;function Ki(e=null){const t=$v(),n=u.useRef(e||t||null);return n.current===null&&(n.current=""+Bv++),e??n.current}function Iu({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:i,maxSize:l,minSize:c,onCollapse:d,onExpand:f,onResize:p,order:m,style:g,tagName:x="div",...h}){const v=u.useContext(Qo);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:w,getPanelSize:S,getPanelStyle:E,groupId:N,isPanelCollapsed:j,reevaluatePanelConstraints:k,registerPanel:T,resizePanel:V,unregisterPanel:F}=v,z=Ki(i),q=u.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:z,idIsFromProps:i!==void 0,order:m});u.useRef({didLogMissingDefaultSizeWarning:!1}),Pn(()=>{const{callbacks:P,constraints:Y}=q.current,A={...Y};q.current.id=z,q.current.idIsFromProps=i!==void 0,q.current.order=m,P.onCollapse=d,P.onExpand=f,P.onResize=p,Y.collapsedSize=n,Y.collapsible=r,Y.defaultSize=o,Y.maxSize=l,Y.minSize=c,(A.collapsedSize!==Y.collapsedSize||A.collapsible!==Y.collapsible||A.maxSize!==Y.maxSize||A.minSize!==Y.minSize)&&k(q.current,A)}),Pn(()=>{const P=q.current;return T(P),()=>{F(P)}},[m,z,T,F]),u.useImperativeHandle(s,()=>({collapse:()=>{b(q.current)},expand:P=>{w(q.current,P)},getId(){return z},getSize(){return S(q.current)},isCollapsed(){return j(q.current)},isExpanded(){return!j(q.current)},resize:P=>{V(q.current,P)}}),[b,w,S,j,z,V]);const Q=E(q.current,o);return u.createElement(x,{...h,children:e,className:t,id:z,style:{...Q,...g},[Ue.groupId]:N,[Ue.panel]:"",[Ue.panelCollapsible]:r||void 0,[Ue.panelId]:z,[Ue.panelSize]:parseFloat(""+Q.flexGrow).toFixed(1)})}const ju=u.forwardRef((e,t)=>u.createElement(Iu,{...e,forwardedRef:t}));Iu.displayName="Panel";ju.displayName="forwardRef(Panel)";let Zs=null,bo=-1,bn=null;function Uv(e,t,n){const r=(t&Du)!==0,o=(t&Ou)!==0,s=(t&Fu)!==0,i=(t&zu)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(o)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)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 Hv(){bn!==null&&(document.head.removeChild(bn),Zs=null,bn=null,bo=-1)}function Ts(e,t,n){var r,o;const s=Uv(e,t);if(Zs!==s){if(Zs=s,bn===null&&(bn=document.createElement("style"),document.head.appendChild(bn)),bo>=0){var i;(i=bn.sheet)===null||i===void 0||i.removeRule(bo)}bo=(r=(o=bn.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function Ru(e){return e.type==="keydown"}function Mu(e){return e.type.startsWith("pointer")}function Pu(e){return e.type.startsWith("mouse")}function es(e){if(Mu(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Pu(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Wv(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Gv(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 Vv(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:rl(e),b:rl(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ee(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:nl(tl(n.a)),b:nl(tl(n.b))};if(o.a===o.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(o.a-o.b)}const Yv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Kv(e){var t;const n=getComputedStyle((t=Lu(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function qv(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Kv(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"||Yv.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function tl(e){let t=e.length;for(;t--;){const n=e[t];if(Ee(n,"Missing node"),qv(n))return n}return null}function nl(e){return e&&Number(getComputedStyle(e).zIndex)||0}function rl(e){const t=[];for(;e;)t.push(e),e=Lu(e);return t}function Lu(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Du=1,Ou=2,Fu=4,zu=8,Xv=Wv()==="coarse";let Ht=[],sr=!1,yn=new Map,ts=new Map;const Fr=new Set;function Zv(e,t,n,r,o){var s;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=yn.get(i))!==null&&s!==void 0?s:0;return yn.set(i,c+1),Fr.add(l),No(),function(){var f;ts.delete(e),Fr.delete(l);const p=(f=yn.get(i))!==null&&f!==void 0?f:1;if(yn.set(i,p-1),No(),p===1&&yn.delete(i),Ht.includes(l)){const m=Ht.indexOf(l);m>=0&&Ht.splice(m,1),ns(),o("up",!0,null)}}}function Jv(e){const{target:t}=e,{x:n,y:r}=es(e);sr=!0,qi({target:t,x:n,y:r}),No(),Ht.length>0&&(ko("down",e),ns(),e.preventDefault(),$u(t)||e.stopImmediatePropagation())}function As(e){const{x:t,y:n}=es(e);if(sr&&e.type!=="pointerleave"&&e.buttons===0&&(sr=!1,ko("up",e)),!sr){const{target:r}=e;qi({target:r,x:t,y:n})}ko("move",e),ns(),Ht.length>0&&e.preventDefault()}function Ns(e){const{target:t}=e,{x:n,y:r}=es(e);ts.clear(),sr=!1,Ht.length>0&&(e.preventDefault(),$u(t)||e.stopImmediatePropagation()),ko("up",e),qi({target:t,x:n,y:r}),ns(),No()}function $u(e){let t=e;for(;t;){if(t.hasAttribute(Ue.resizeHandle))return!0;t=t.parentElement}return!1}function qi({target:e,x:t,y:n}){Ht.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Fr.forEach(o=>{const{element:s,hitAreaMargins:i}=o,l=s.getBoundingClientRect(),{bottom:c,left:d,right:f,top:p}=l,m=Xv?i.coarse:i.fine;if(t>=d-m&&t<=f+m&&n>=p-m&&n<=c+m){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Vv(r,s)>0){let x=r,h=!1;for(;x&&!x.contains(s);){if(Gv(x.getBoundingClientRect(),l)){h=!0;break}x=x.parentElement}if(h)return}Ht.push(o)}})}function ks(e,t){ts.set(e,t)}function ns(){let e=!1,t=!1;Ht.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;ts.forEach(r=>{n|=r}),e&&t?Ts("intersection",n):e?Ts("horizontal",n):t?Ts("vertical",n):Hv()}let _s;function No(){var e;(e=_s)===null||e===void 0||e.abort(),_s=new AbortController;const t={capture:!0,signal:_s.signal};Fr.size&&(sr?(Ht.length>0&&yn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Ns,t),o.addEventListener("pointerleave",As,t),o.addEventListener("pointermove",As,t))}),yn.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Ns,t),o.addEventListener("pointercancel",Ns,t)})):yn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",Jv,t),o.addEventListener("pointermove",As,t))}))}function ko(e,t){Fr.forEach(n=>{const{setResizeHandlerState:r}=n,o=Ht.includes(n);r(e,o,t)})}function Qv(){const[e,t]=u.useState(0);return u.useCallback(()=>t(n=>n+1),[])}function Ee(e,t){if(!e)throw console.error(t),Error(t)}function $n(e,t,n=Yi){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function dn(e,t,n=Yi){return $n(e,t,n)===0}function xt(e,t,n){return $n(e,t,n)===0}function ew(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],s=t[r];if(!xt(o,s,n))return!1}return!0}function er({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Ee(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:s,maxSize:i=100,minSize:l=0}=r;if($n(n,l)<0)if(s){const c=(o+l)/2;$n(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(Yi)),n}function jr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(xt(e,0))return t;const i=[...t],[l,c]=r;Ee(l!=null,"Invalid first pivot index"),Ee(c!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const p=e<0?c:l,m=n[p];Ee(m,`Panel constraints not found for index ${p}`);const{collapsedSize:g=0,collapsible:x,minSize:h=0}=m;if(x){const v=t[p];if(Ee(v!=null,`Previous layout not found for panel index ${p}`),xt(v,g)){const b=h-v;$n(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?l:c,m=n[p];Ee(m,`No panel constraints found for index ${p}`);const{collapsedSize:g=0,collapsible:x,minSize:h=0}=m;if(x){const v=t[p];if(Ee(v!=null,`Previous layout not found for panel index ${p}`),xt(v,h)){const b=v-g;$n(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const p=e<0?1:-1;let m=e<0?c:l,g=0;for(;;){const h=t[m];Ee(h!=null,`Previous layout not found for panel index ${m}`);const b=er({panelConstraints:n,panelIndex:m,size:100})-h;if(g+=b,m+=p,m<0||m>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-x:x}{let m=e<0?l:c;for(;m>=0&&m<n.length;){const g=Math.abs(e)-Math.abs(d),x=t[m];Ee(x!=null,`Previous layout not found for panel index ${m}`);const h=x-g,v=er({panelConstraints:n,panelIndex:m,size:h});if(!xt(x,v)&&(d+=x-v,i[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(ew(o,i))return o;{const p=e<0?c:l,m=t[p];Ee(m!=null,`Previous layout not found for panel index ${p}`);const g=m+d,x=er({panelConstraints:n,panelIndex:p,size:g});if(i[p]=x,!xt(x,g)){let h=g-x,b=e<0?c:l;for(;b>=0&&b<n.length;){const w=i[b];Ee(w!=null,`Previous layout not found for panel index ${b}`);const S=w+h,E=er({panelConstraints:n,panelIndex:b,size:S});if(xt(w,E)||(h-=E-w,i[b]=E),xt(h,0))break;e>0?b--:b++}}}const f=i.reduce((p,m)=>m+p,0);return xt(f,100)?i:o}function tw({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,i=0;const l=n[0];Ee(l!=null,"No pivot index found"),t.forEach((p,m)=>{const{constraints:g}=p,{maxSize:x=100,minSize:h=0}=g;m===l?(r=h,o=x):(s+=h,i+=x)});const c=Math.min(o,100-s),d=Math.max(r,100-i),f=e[l];return{valueMax:c,valueMin:d,valueNow:f}}function zr(e,t=document){return Array.from(t.querySelectorAll(`[${Ue.resizeHandleId}][data-panel-group-id="${e}"]`))}function Bu(e,t,n=document){const o=zr(e,n).findIndex(s=>s.getAttribute(Ue.resizeHandleId)===t);return o??null}function Uu(e,t,n){const r=Bu(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function nw(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Hu(e,t=document){if(nw(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function rs(e,t=document){const n=t.querySelector(`[${Ue.resizeHandleId}="${e}"]`);return n||null}function rw(e,t,n,r=document){var o,s,i,l;const c=rs(t,r),d=zr(e,r),f=c?d.indexOf(c):-1,p=(o=(s=n[f])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,m=(i=(l=n[f+1])===null||l===void 0?void 0:l.id)!==null&&i!==void 0?i:null;return[p,m]}function ow({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:i}){u.useRef({didWarnAboutMissingResizeHandle:!1}),Pn(()=>{if(!s)return;const l=zr(n,s);for(let c=0;c<o.length-1;c++){const{valueMax:d,valueMin:f,valueNow:p}=tw({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const g=o[c];Ee(g,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",g.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),u.useEffect(()=>{if(!s)return;const l=t.current;Ee(l,"Eager values not found");const{panelDataArray:c}=l,d=Hu(n,s);Ee(d!=null,`No group found for id "${n}"`);const f=zr(n,s);Ee(f,`No resize handles found for group id "${n}"`);const p=f.map(m=>{const g=m.getAttribute(Ue.resizeHandleId);Ee(g,"Resize handle element has no handle id attribute");const[x,h]=rw(n,g,c,s);if(x==null||h==null)return()=>{};const v=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const w=c.findIndex(S=>S.id===x);if(w>=0){const S=c[w];Ee(S,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:N=0,collapsible:j,minSize:k=0}=S.constraints;if(E!=null&&j){const T=jr({delta:xt(E,N)?k-N:N-E,initialLayout:r,panelConstraints:c.map(V=>V.constraints),pivotIndices:Uu(n,g,s),prevLayout:r,trigger:"keyboard"});r!==T&&i(T)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{p.forEach(m=>m())}},[s,e,t,n,r,o,i])}function ol(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 Wu(e,t){const n=e==="horizontal",{x:r,y:o}=es(t);return n?r:o}function sw(e,t,n,r,o){const s=n==="horizontal",i=rs(t,o);Ee(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(Ue.groupId);Ee(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=Wu(n,e),f=Hu(l,o);Ee(f,`No group element found for id "${l}"`);const p=f.getBoundingClientRect(),m=s?p.width:p.height;return(d-c)/m*100}function iw(e,t,n,r,o,s){if(Ru(e)){const i=n==="horizontal";let l=0;e.shiftKey?l=100:o!=null?l=o:l=10;let c=0;switch(e.key){case"ArrowDown":c=i?0:l;break;case"ArrowLeft":c=i?-l:0;break;case"ArrowRight":c=i?l:0;break;case"ArrowUp":c=i?0:-l;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return r==null?0:sw(e,t,n,r,s)}function aw({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,o=100;for(let s=0;s<e.length;s++){const i=n[s];Ee(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;l!=null&&(r++,t[s]=l,o-=l)}for(let s=0;s<e.length;s++){const i=n[s];Ee(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,d=o/c;r++,t[s]=d,o-=d}return t}function Xn(e,t,n){t.forEach((r,o)=>{const s=e[o];Ee(s,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=s,{collapsedSize:d=0,collapsible:f}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:m,onExpand:g,onResize:x}=i;x&&x(r,p),f&&(m||g)&&(g&&(p==null||dn(p,d))&&!dn(r,d)&&g(),m&&(p==null||!dn(p,d))&&dn(r,d)&&m())}})}function ao(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 lw({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:s=3}){const i=n[o];let l;return i==null?l=e!=null?e.toFixed(s):"1":r.length===1?l="1":l=i.toFixed(s),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function cw(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function sl(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 Gu(e){return`react-resizable-panels:${e}`}function Vu(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Yu(e,t){try{const n=Gu(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function uw(e,t,n){var r,o;const s=(r=Yu(e,n))!==null&&r!==void 0?r:{},i=Vu(t);return(o=s[i])!==null&&o!==void 0?o:null}function dw(e,t,n,r,o){var s;const i=Gu(e),l=Vu(t),c=(s=Yu(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function il({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!xt(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];Ee(i!=null,`No layout data found for index ${s}`);const l=100/r*i;n[s]=l}let o=0;for(let s=0;s<t.length;s++){const i=n[s];Ee(i!=null,`No layout data found for index ${s}`);const l=er({panelConstraints:t,panelIndex:s,size:i});i!=l&&(o+=i-l,n[s]=l)}if(!xt(o,0))for(let s=0;s<t.length;s++){const i=n[s];Ee(i!=null,`No layout data found for index ${s}`);const l=i+o,c=er({panelConstraints:t,panelIndex:s,size:l});if(i!==c&&(o-=c-i,n[s]=c,xt(o,0)))break}return n}const fw=100,Rr={getItem:e=>(sl(Rr),Rr.getItem(e)),setItem:(e,t)=>{sl(Rr),Rr.setItem(e,t)}},al={};function Ku({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Rr,style:d,tagName:f="div",...p}){const m=Ki(s),g=u.useRef(null),[x,h]=u.useState(null),[v,b]=u.useState([]),w=Qv(),S=u.useRef({}),E=u.useRef(new Map),N=u.useRef(0),j=u.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),k=u.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});u.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),u.useImperativeHandle(o,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:L}=k.current;return L},setLayout:L=>{const{onLayout:H}=j.current,{layout:O,panelDataArray:W}=k.current,I=il({layout:L,panelConstraints:W.map(K=>K.constraints)});ol(O,I)||(b(I),k.current.layout=I,H&&H(I),Xn(W,I,S.current))}}),[]),Pn(()=>{j.current.autoSaveId=e,j.current.direction=r,j.current.dragState=x,j.current.id=m,j.current.onLayout=i,j.current.storage=c}),ow({committedValuesRef:j,eagerValuesRef:k,groupId:m,layout:v,panelDataArray:k.current.panelDataArray,setLayout:b,panelGroupElement:g.current}),u.useEffect(()=>{const{panelDataArray:L}=k.current;if(e){if(v.length===0||v.length!==L.length)return;let H=al[e];H==null&&(H=cw(dw,fw),al[e]=H);const O=[...L],W=new Map(E.current);H(e,O,W,v,c)}},[e,v,c]),u.useEffect(()=>{});const T=u.useCallback(L=>{const{onLayout:H}=j.current,{layout:O,panelDataArray:W}=k.current;if(L.constraints.collapsible){const I=W.map(ae=>ae.constraints),{collapsedSize:K=0,panelSize:ee,pivotIndices:te}=Mn(W,L,O);if(Ee(ee!=null,`Panel size not found for panel "${L.id}"`),!dn(ee,K)){E.current.set(L.id,ee);const ie=Jn(W,L)===W.length-1?ee-K:K-ee,de=jr({delta:ie,initialLayout:O,panelConstraints:I,pivotIndices:te,prevLayout:O,trigger:"imperative-api"});ao(O,de)||(b(de),k.current.layout=de,H&&H(de),Xn(W,de,S.current))}}},[]),V=u.useCallback((L,H)=>{const{onLayout:O}=j.current,{layout:W,panelDataArray:I}=k.current;if(L.constraints.collapsible){const K=I.map(ye=>ye.constraints),{collapsedSize:ee=0,panelSize:te=0,minSize:ae=0,pivotIndices:ie}=Mn(I,L,W),de=H??ae;if(dn(te,ee)){const ye=E.current.get(L.id),Ie=ye!=null&&ye>=de?ye:de,Pe=Jn(I,L)===I.length-1?te-Ie:Ie-te,Me=jr({delta:Pe,initialLayout:W,panelConstraints:K,pivotIndices:ie,prevLayout:W,trigger:"imperative-api"});ao(W,Me)||(b(Me),k.current.layout=Me,O&&O(Me),Xn(I,Me,S.current))}}},[]),F=u.useCallback(L=>{const{layout:H,panelDataArray:O}=k.current,{panelSize:W}=Mn(O,L,H);return Ee(W!=null,`Panel size not found for panel "${L.id}"`),W},[]),z=u.useCallback((L,H)=>{const{panelDataArray:O}=k.current,W=Jn(O,L);return lw({defaultSize:H,dragState:x,layout:v,panelData:O,panelIndex:W})},[x,v]),q=u.useCallback(L=>{const{layout:H,panelDataArray:O}=k.current,{collapsedSize:W=0,collapsible:I,panelSize:K}=Mn(O,L,H);return Ee(K!=null,`Panel size not found for panel "${L.id}"`),I===!0&&dn(K,W)},[]),Q=u.useCallback(L=>{const{layout:H,panelDataArray:O}=k.current,{collapsedSize:W=0,collapsible:I,panelSize:K}=Mn(O,L,H);return Ee(K!=null,`Panel size not found for panel "${L.id}"`),!I||$n(K,W)>0},[]),P=u.useCallback(L=>{const{panelDataArray:H}=k.current;H.push(L),H.sort((O,W)=>{const I=O.order,K=W.order;return I==null&&K==null?0:I==null?-1:K==null?1:I-K}),k.current.panelDataArrayChanged=!0,w()},[w]);Pn(()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:L,onLayout:H,storage:O}=j.current,{layout:W,panelDataArray:I}=k.current;let K=null;if(L){const te=uw(L,I,O);te&&(E.current=new Map(Object.entries(te.expandToSizes)),K=te.layout)}K==null&&(K=aw({panelDataArray:I}));const ee=il({layout:K,panelConstraints:I.map(te=>te.constraints)});ol(W,ee)||(b(ee),k.current.layout=ee,H&&H(ee),Xn(I,ee,S.current))}}),Pn(()=>{const L=k.current;return()=>{L.layout=[]}},[]);const Y=u.useCallback(L=>{let H=!1;const O=g.current;return O&&window.getComputedStyle(O,null).getPropertyValue("direction")==="rtl"&&(H=!0),function(I){I.preventDefault();const K=g.current;if(!K)return()=>null;const{direction:ee,dragState:te,id:ae,keyboardResizeBy:ie,onLayout:de}=j.current,{layout:ye,panelDataArray:Ie}=k.current,{initialLayout:je}=te??{},Pe=Uu(ae,L,K);let Me=iw(I,L,ee,te,ie,K);const Be=ee==="horizontal";Be&&H&&(Me=-Me);const yt=Ie.map(tt=>tt.constraints),We=jr({delta:Me,initialLayout:je??ye,panelConstraints:yt,pivotIndices:Pe,prevLayout:ye,trigger:Ru(I)?"keyboard":"mouse-or-touch"}),St=!ao(ye,We);(Mu(I)||Pu(I))&&N.current!=Me&&(N.current=Me,!St&&Me!==0?Be?ks(L,Me<0?Du:Ou):ks(L,Me<0?Fu:zu):ks(L,0)),St&&(b(We),k.current.layout=We,de&&de(We),Xn(Ie,We,S.current))}},[]),A=u.useCallback((L,H)=>{const{onLayout:O}=j.current,{layout:W,panelDataArray:I}=k.current,K=I.map(ye=>ye.constraints),{panelSize:ee,pivotIndices:te}=Mn(I,L,W);Ee(ee!=null,`Panel size not found for panel "${L.id}"`);const ie=Jn(I,L)===I.length-1?ee-H:H-ee,de=jr({delta:ie,initialLayout:W,panelConstraints:K,pivotIndices:te,prevLayout:W,trigger:"imperative-api"});ao(W,de)||(b(de),k.current.layout=de,O&&O(de),Xn(I,de,S.current))},[]),B=u.useCallback((L,H)=>{const{layout:O,panelDataArray:W}=k.current,{collapsedSize:I=0,collapsible:K}=H,{collapsedSize:ee=0,collapsible:te,maxSize:ae=100,minSize:ie=0}=L.constraints,{panelSize:de}=Mn(W,L,O);de!=null&&(K&&te&&dn(de,I)?dn(I,ee)||A(L,ee):de<ie?A(L,ie):de>ae&&A(L,ae))},[A]),C=u.useCallback((L,H)=>{const{direction:O}=j.current,{layout:W}=k.current;if(!g.current)return;const I=rs(L,g.current);Ee(I,`Drag handle element not found for id "${L}"`);const K=Wu(O,H);h({dragHandleId:L,dragHandleRect:I.getBoundingClientRect(),initialCursorPosition:K,initialLayout:W})},[]),_=u.useCallback(()=>{h(null)},[]),D=u.useCallback(L=>{const{panelDataArray:H}=k.current,O=Jn(H,L);O>=0&&(H.splice(O,1),delete S.current[L.id],k.current.panelDataArrayChanged=!0,w())},[w]),M=u.useMemo(()=>({collapsePanel:T,direction:r,dragState:x,expandPanel:V,getPanelSize:F,getPanelStyle:z,groupId:m,isPanelCollapsed:q,isPanelExpanded:Q,reevaluatePanelConstraints:B,registerPanel:P,registerResizeHandle:Y,resizePanel:A,startDragging:C,stopDragging:_,unregisterPanel:D,panelGroupElement:g.current}),[T,x,r,V,F,z,m,q,Q,B,P,Y,A,C,_,D]),J={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return u.createElement(Qo.Provider,{value:M},u.createElement(f,{...p,children:t,className:n,id:s,ref:g,style:{...J,...d},[Ue.group]:"",[Ue.groupDirection]:r,[Ue.groupId]:m}))}const qu=u.forwardRef((e,t)=>u.createElement(Ku,{...e,forwardedRef:t}));Ku.displayName="PanelGroup";qu.displayName="forwardRef(PanelGroup)";function Jn(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Mn(e,t,n){const r=Jn(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function pw({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){u.useEffect(()=>{if(e||n==null||r==null)return;const o=rs(t,r);if(o==null)return;const s=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const l=o.getAttribute(Ue.groupId);Ee(l,`No group element found for id "${l}"`);const c=zr(l,r),d=Bu(l,t,r);Ee(d!==null,`No resize element found for id "${t}"`);const f=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[r,e,t,n])}function Xu({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onClick:i,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:f,style:p={},tabIndex:m=0,tagName:g="div",...x}){var h,v;const b=u.useRef(null),w=u.useRef({onClick:i,onDragging:l,onPointerDown:d,onPointerUp:f});u.useEffect(()=>{w.current.onClick=i,w.current.onDragging=l,w.current.onPointerDown=d,w.current.onPointerUp=f});const S=u.useContext(Qo);if(S===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:N,registerResizeHandle:j,startDragging:k,stopDragging:T,panelGroupElement:V}=S,F=Ki(o),[z,q]=u.useState("inactive"),[Q,P]=u.useState(!1),[Y,A]=u.useState(null),B=u.useRef({state:z});Pn(()=>{B.current.state=z}),u.useEffect(()=>{if(n)A(null);else{const M=j(F);A(()=>M)}},[n,F,j]);const C=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,_=(v=r==null?void 0:r.fine)!==null&&v!==void 0?v:5;u.useEffect(()=>{if(n||Y==null)return;const M=b.current;Ee(M,"Element ref not attached");let J=!1;return Zv(F,M,E,{coarse:C,fine:_},(H,O,W)=>{if(!O){q("inactive");return}switch(H){case"down":{q("drag"),J=!1,Ee(W,'Expected event to be defined for "down" action'),k(F,W);const{onDragging:I,onPointerDown:K}=w.current;I==null||I(!0),K==null||K();break}case"move":{const{state:I}=B.current;J=!0,I!=="drag"&&q("hover"),Ee(W,'Expected event to be defined for "move" action'),Y(W);break}case"up":{q("hover"),T();const{onClick:I,onDragging:K,onPointerUp:ee}=w.current;K==null||K(!1),ee==null||ee(),J||I==null||I();break}}})},[C,E,n,_,j,F,Y,k,T]),pw({disabled:n,handleId:F,resizeHandler:Y,panelGroupElement:V});const D={touchAction:"none",userSelect:"none"};return u.createElement(g,{...x,children:e,className:t,id:o,onBlur:()=>{P(!1),s==null||s()},onFocus:()=>{P(!0),c==null||c()},ref:b,role:"separator",style:{...D,...p},tabIndex:m,[Ue.groupDirection]:E,[Ue.groupId]:N,[Ue.resizeHandle]:"",[Ue.resizeHandleActive]:z==="drag"?"pointer":Q?"keyboard":void 0,[Ue.resizeHandleEnabled]:!n,[Ue.resizeHandleId]:F,[Ue.resizeHandleState]:z})}Xu.displayName="PanelResizeHandle";function mw({className:e,...t}){return a.jsx(qu,{"data-slot":"resizable-panel-group",className:be("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ll({...e}){return a.jsx(ju,{"data-slot":"resizable-panel",...e})}function hw({withHandle:e,className:t,...n}){return a.jsx(Xu,{"data-slot":"resizable-handle",className:be("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&&a.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:a.jsx(Bp,{className:"size-2.5"})})})}const gw=u.forwardRef(({className:e,...t},n)=>a.jsx("ul",{ref:n,className:be("flex flex-row items-center gap-1",e),...t}));gw.displayName="PaginationContent";const xw=u.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,className:be("",e),...t}));xw.displayName="PaginationItem";function vw({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){u.useEffect(()=>{if(!r)return;const o=s=>{const i=s.target,l=e.current&&!e.current.contains(i),c=t!=null&&t.current?!t.current.contains(i):!0;l&&c&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[e,t,n,r])}function ww({onEscape:e,enabled:t=!0}){u.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const bw={x:0,y:0},kt=16,yw=["top-start","bottom-end","top-end"];function Sw({anchorRef:e,placement:t="top-start",offset:n=bw,fallbackPlacements:r=yw}){const o=u.useCallback((c,d,f)=>{let p=0,m=0;switch(f){case"top":p=c.top-d.height-n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"top-start":p=c.top-d.height-n.y,m=c.left+n.x;break;case"top-end":p=c.top-d.height-n.y,m=c.right-d.width-n.x;break;case"bottom":p=c.bottom+n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"bottom-start":p=c.bottom+n.y,m=c.left+n.x;break;case"bottom-end":p=c.bottom+n.y,m=c.right-d.width-n.x;break;case"left":p=c.top+(c.height-d.height)/2+n.y,m=c.left-d.width-n.x;break;case"left-start":p=c.top+n.y,m=c.left-d.width-n.x;break;case"left-end":p=c.bottom-d.height-n.y,m=c.left-d.width-n.x;break;case"right":p=c.top+(c.height-d.height)/2+n.y,m=c.right+n.x;break;case"right-start":p=c.top+n.y,m=c.right+n.x;break;case"right-end":p=c.bottom-d.height-n.y,m=c.right+n.x;break}return console.log(`Calculated position for ${f}:`,{top:p,left:m}),{top:p,left:m,placement:f}},[n.x,n.y]),s=u.useCallback((c,d)=>{const f={width:window.innerWidth,height:window.innerHeight};return c.left<kt||c.top<kt||c.left+d.width>f.width-kt||c.top+d.height>f.height-kt},[]),i=u.useCallback(c=>{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 d=e.current.getBoundingClientRect(),f=c.getBoundingClientRect(),p=o(d,f,t);if(!s(p,f))return p;for(const x of r){const h=o(d,f,x);if(!s(h,f))return h}const m={width:window.innerWidth,height:window.innerHeight},g={...p};return g.left<kt?g.left=kt:g.left+f.width>m.width-kt&&(g.left=m.width-f.width-kt),g.top<kt?g.top=kt:g.top+f.height>m.height-kt&&(g.top=m.height-f.height-kt),g},[e,t,r,o,s]);return{getPositionStyle:u.useCallback(c=>{const d=i(c);return{position:"fixed",top:d.top,left:d.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function Cw({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[s,i]=u.useState(e),[l,c]=u.useState(!1),d=u.useRef(0),f=u.useRef(e),p=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.clientX,f.current=s},[s]),m=u.useCallback(b=>{if(!l)return;const w=b.clientX-d.current,S=r==="right"?-w:w,E=Math.min(Math.max(f.current+S,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),g=u.useCallback(()=>{c(!1)},[]),x=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.touches[0].clientX,f.current=s},[s]),h=u.useCallback(b=>{if(!l)return;const w=b.touches[0].clientX-d.current,S=r==="right"?-w:w,E=Math.min(Math.max(f.current+S,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),v=u.useCallback(()=>{c(!1)},[]);return u.useEffect(()=>{if(l)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",g),document.addEventListener("touchmove",h),document.addEventListener("touchend",v),document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",g),document.removeEventListener("touchmove",h),document.removeEventListener("touchend",v),document.body.style.userSelect="",document.body.style.cursor=""}},[l,m,g,h,v]),{width:s,isResizing:l,handleMouseDown:p,handleTouchStart:x,setWidth:i}}const Ew=u.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:s=!0,className:i,onWidthChange:l,...c},d)=>{const{width:f,isResizing:p,handleMouseDown:m,handleTouchStart:g}=Cw({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:l}),x={width:`${f}px`},h=o==="left"?"right-0":"left-0";return a.jsxs("div",{ref:d,className:be("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",i),style:x,...c,children:[a.jsx("div",{className:be("h-full overflow-x-hidden overflow-y-auto"),children:e}),s&&a.jsx("div",{className:be("group absolute top-0 bottom-0 w-2",h,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",p&&"bg-[var(--color-primary-wMain)]"),onMouseDown:m,onTouchStart:g,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:b=>{if(b.key==="ArrowLeft"||b.key==="ArrowRight"){b.preventDefault();const w=b.key==="ArrowRight"?10:-10,S=o==="right"?-w:w,E=Math.min(Math.max(f+S,n),r);l==null||l(E)}},children:a.jsx("div",{className:be("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",p&&"bg-[var(--color-primary-wMain)]")})})]})});Ew.displayName="SidePanel";const Zu=u.createContext(null),Ju=u.createContext(void 0),Qu=u.createContext(null),ed=u.createContext(null),td=u.createContext(void 0),nd=u.createContext(null);function on(){const e=u.useContext(Qu);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const Tw="https://solace.com/a2a/extensions/display-name",Aw="https://solace.com/a2a/extensions/peer-agent-topology",Nw="https://solace.com/a2a/extensions/sam/tools",kw=e=>{var o,s,i,l;let t,n,r;if((o=e.capabilities)!=null&&o.extensions){const c=e.capabilities.extensions.find(p=>p.uri===Tw);(s=c==null?void 0:c.params)!=null&&s.display_name&&(t=c.params.display_name);const d=e.capabilities.extensions.find(p=>p.uri===Aw);(i=d==null?void 0:d.params)!=null&&i.peer_agent_names&&(n=d.params.peer_agent_names);const f=e.capabilities.extensions.find(p=>p.uri===Nw);(l=f==null?void 0:f.params)!=null&&l.tools&&(r=f.params.tools)}return{...e,display_name:t,peer_agents:n||[],tools:r||[],displayName:t,peerAgents:n||[]}},rd=()=>{const{configServerUrl:e}=on(),[t,n]=u.useState([]),[r,o]=u.useState({}),[s,i]=u.useState(!0),[l,c]=u.useState(null),d=u.useCallback(async()=>{i(!0),c(null);try{const f=`${e}/api/v1`,p=await ze(`${f}/agentCards`,{credentials:"include"});if(!p.ok){const h=await p.json().catch(()=>({message:`Failed to fetch agents: ${p.statusText}`}));throw new Error(h.message||`Failed to fetch agents: ${p.statusText}`)}const g=(await p.json()).map(kw);n(g);const x={};g.forEach(h=>{h.name&&(x[h.name]=h.displayName||h.name)}),o(x)}catch(f){console.error("Error fetching agents:",f),c(f instanceof Error?f.message:"Could not load agent information."),n([])}finally{i(!1)}},[e]);return u.useEffect(()=>{d()},[d]),u.useMemo(()=>({agents:t,agentNameMap:r,isLoading:s,error:l,refetch:d}),[t,r,s,l,d])},_w=e=>{const{configServerUrl:t}=on(),[n,r]=u.useState([]),[o,s]=u.useState(!0),[i,l]=u.useState(null),c=`${t}/api/v1`,d=u.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0),l(null);try{const f=await ze(`${c}/artifacts/${e}`,{credentials:"include"});if(!f.ok){const m=await f.json().catch(()=>({message:`Failed to fetch artifacts. ${f.statusText}`}));throw new Error(m.message||`Failed to fetch artifacts. ${f.statusText}`)}const p=await f.json();r(p)}catch(f){const p=f instanceof Error?f.message:"Failed to fetch artifacts.";l(p),r([])}finally{s(!1)}},[c,e]);return u.useEffect(()=>{d()},[d]),{artifacts:n,isLoading:o,error:i,refetch:d}},Iw=()=>{const e=u.useContext(Zu);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},He=()=>{const e=u.useContext(Ju);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function jw(){const{messages:e}=He(),t=on(),n=u.useCallback(r=>{if((t==null?void 0:t.persistenceEnabled)===!1&&!(e.length<=1))return r.preventDefault(),"Are you sure you want to leave? Your chat history will be lost."},[e.length,t==null?void 0:t.persistenceEnabled]);u.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function od(){const e=u.useContext(ed);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function Rw(e,t){const[n,r]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const Mw=async(e,t,n)=>{const r=await ze(`${e}/api/v1/artifacts/${t}/${encodeURIComponent(n.filename)}`,{credentials:"include"});if(!r.ok)throw new Error(`Failed to download artifact: ${n.filename}. Status: ${r.status}`);const o=await r.blob();yc(o,n.filename)},sd=()=>{const{configServerUrl:e}=on(),{addNotification:t,sessionId:n}=He();return{onDownload:async o=>{if(!n){t("Cannot download artifact: No active session.","error");return}try{await Mw(e,n,o),t(`Downloaded artifact: ${o.filename}.`)}catch{t(`Failed to download artifact: ${o.filename}.`,"error")}}}},Pw=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=u.useState(!1),s=u.useRef(0),i=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)+1,f.dataTransfer.types.includes("Files")&&o(!0))},[n,s]),l=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.types.includes("Files")&&(f.dataTransfer.dropEffect="copy"))},[n]),c=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)-1,s.current===0&&o(!1))},[n,s]),d=u.useCallback(f=>{if(n||(f.preventDefault(),f.stopPropagation(),o(!1),s.current=0,!f.dataTransfer.files||f.dataTransfer.files.length===0))return;const p=Array.from(f.dataTransfer.files),m=t?p.filter(t):p;m.length!==0&&e(m)},[n,s,t,e]);return{isDragging:r,handleDragEnter:i,handleDragOver:l,handleDragLeave:c,handleDrop:d}},Xi=()=>{const e=u.useContext(td);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function id(){const e=u.useContext(nd);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}u.createContext(null);function ad(e){const t=e+"CollectionProvider",[n,r]=kn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:v,children:b}=h,w=Ut.useRef(null),S=Ut.useRef(new Map).current;return a.jsx(o,{scope:v,itemMap:S,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Dn(l),d=Ut.forwardRef((h,v)=>{const{scope:b,children:w}=h,S=s(l,b),E=$e(v,S.collectionRef);return a.jsx(c,{ref:E,children:w})});d.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Dn(f),g=Ut.forwardRef((h,v)=>{const{scope:b,children:w,...S}=h,E=Ut.useRef(null),N=$e(v,E),j=s(f,b);return Ut.useEffect(()=>(j.itemMap.set(E,{ref:E,...S}),()=>void j.itemMap.delete(E))),a.jsx(m,{[p]:"",ref:N,children:w})});g.displayName=f;function x(h){const v=s(e+"CollectionConsumer",h);return Ut.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const S=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((j,k)=>S.indexOf(j.ref.current)-S.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:g},x,r]}var Lw=u.createContext(void 0);function Zi(e){const t=u.useContext(Lw);return e||t||"ltr"}const Ji=u.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},s=(i,l)=>{var d,f,p,m,g;const c=(d=i.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="menuitem"]');if(c)switch(i.key){case"ArrowDown":{i.preventDefault();const x=(l+1)%c.length;(f=c[x])==null||f.focus();break}case"ArrowUp":{i.preventDefault();const x=(l-1+c.length)%c.length;(p=c[x])==null||p.focus();break}case"Home":i.preventDefault(),(m=c[0])==null||m.focus();break;case"End":i.preventDefault(),(g=c[c.length-1])==null||g.focus();break;case"Escape":i.preventDefault(),i.currentTarget.blur();break}};return a.jsx("div",{ref:r,role:"menu",className:be("min-w-[8rem] overflow-hidden",t),...n,children:e.map((i,l)=>a.jsxs(u.Fragment,{children:[i.divider&&l>0&&a.jsx("div",{className:"my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),a.jsxs("div",{role:"menuitem",tabIndex:0,className:be("relative my-1.5 flex cursor-pointer items-center gap-2 px-3 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:i.onClick,onKeyDown:c=>{o(c,i),s(c,l)},children:[i.icon&&i.iconPosition!=="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon}),a.jsx("span",{className:"flex-1",children:i.label}),i.icon&&i.iconPosition==="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon})]})]},i.id))})});Ji.displayName="Menu";var os="Popover",[ld]=kn(os,[wr]),qr=wr(),[Dw,_n]=ld(os),cd=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,l=qr(t),c=u.useRef(null),[d,f]=u.useState(!1),[p,m]=Fn({prop:r,defaultProp:o??!1,onChange:s,caller:os});return a.jsx(Pi,{...l,children:a.jsx(Dw,{scope:t,contentId:Qt(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>f(!0),[]),onCustomAnchorRemove:u.useCallback(()=>f(!1),[]),modal:i,children:n})})};cd.displayName=os;var ud="PopoverAnchor",Ow=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=_n(ud,n),s=qr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return u.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(Bo,{...s,...r,ref:t})});Ow.displayName=ud;var dd="PopoverTrigger",fd=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=_n(dd,n),s=qr(n),i=$e(t,o.triggerRef),l=a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":xd(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:a.jsx(Bo,{asChild:!0,...s,children:l})});fd.displayName=dd;var Qi="PopoverPortal",[Fw,zw]=ld(Qi,{forceMount:void 0}),pd=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=_n(Qi,t);return a.jsx(Fw,{scope:t,forceMount:n,children:a.jsx(gn,{present:n||s.open,children:a.jsx(Yr,{asChild:!0,container:o,children:r})})})};pd.displayName=Qi;var ur="PopoverContent",md=u.forwardRef((e,t)=>{const n=zw(ur,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=_n(ur,e.__scopePopover);return a.jsx(gn,{present:r||s.open,children:s.modal?a.jsx(Bw,{...o,ref:t}):a.jsx(Uw,{...o,ref:t})})});md.displayName=ur;var $w=Dn("PopoverContent.RemoveScroll"),Bw=u.forwardRef((e,t)=>{const n=_n(ur,e.__scopePopover),r=u.useRef(null),o=$e(t,r),s=u.useRef(!1);return u.useEffect(()=>{const i=r.current;if(i)return Hi(i)},[]),a.jsx(Vo,{as:$w,allowPinchZoom:!0,children:a.jsx(hd,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Uw=u.forwardRef((e,t)=>{const n=_n(ur,e.__scopePopover),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(hd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),hd=u.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...p}=e,m=_n(ur,n),g=qr(n);return Ui(),a.jsx(Wo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Gr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(Li,{"data-state":xd(m.open),role:"dialog",id:m.contentId,...g,...p,ref:t,style:{...p.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)"}})})})}),gd="PopoverClose",Hw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=_n(gd,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});Hw.displayName=gd;var Ww="PopoverArrow",Gw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=qr(n);return a.jsx(Di,{...o,...r,ref:t})});Gw.displayName=Ww;function xd(e){return e?"open":"closed"}var Vw=cd,Yw=fd,Kw=pd,qw=md;function vd({...e}){return a.jsx(Vw,{"data-slot":"popover",...e})}function wd({...e}){return a.jsx(Yw,{"data-slot":"popover-trigger",...e})}function bd({className:e,align:t="center",sideOffset:n=4,...r}){return a.jsx(Kw,{children:a.jsx(qw,{"data-slot":"popover-content",align:t,sideOffset:n,className:be("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 z-50 w-auto origin-(--radix-popover-content-transform-origin) rounded-sm border px-0 py-1 shadow-sm outline-hidden",e),...r})})}function Xw({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:s,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:d=!0,animationDuration:f=150,fallbackPlacements:p}){const m=u.useRef(null),[g,x]=u.useState({}),[h,v]=u.useState(!1);vw({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),ww({onEscape:t,enabled:e&&c});const{getPositionStyle:b}=Sw({anchorRef:n,placement:o,offset:s,fallbackPlacements:p});if(u.useEffect(()=>{e&&m.current?(v(!1),requestAnimationFrame(()=>{if(m.current){const S=b(m.current);x(S),v(!0)}})):v(!1)},[e,b]),!e)return null;const w=a.jsx("div",{ref:m,role:"dialog","aria-modal":"false",className:be("bg-background min-w-[8rem] overflow-hidden border shadow-md",i),style:{...g,opacity:e&&h?1:0,transform:`scale(${e&&h?1:.95})`,transition:`opacity ${f}ms ease-in-out, transform ${f}ms ease-in-out`,pointerEvents:e&&h?"auto":"none",visibility:h?"visible":"hidden"},children:r});return d?Wr.createPortal(w,document.body):w}function cl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Zw(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Jw=[" ","Enter","ArrowUp","ArrowDown"],Qw=[" ","Enter"],Bn="Select",[ss,is,e0]=ad(Bn),[br]=kn(Bn,[e0,wr]),as=wr(),[t0,In]=br(Bn),[n0,r0]=br(Bn),yd=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:g,form:x}=e,h=as(t),[v,b]=u.useState(null),[w,S]=u.useState(null),[E,N]=u.useState(!1),j=Zi(d),[k,T]=Fn({prop:r,defaultProp:o??!1,onChange:s,caller:Bn}),[V,F]=Fn({prop:i,defaultProp:l,onChange:c,caller:Bn}),z=u.useRef(null),q=v?x||!!v.closest("form"):!0,[Q,P]=u.useState(new Set),Y=Array.from(Q).map(A=>A.props.value).join(";");return a.jsx(Pi,{...h,children:a.jsxs(t0,{required:g,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:E,onValueNodeHasChildrenChange:N,contentId:Qt(),value:V,onValueChange:F,open:k,onOpenChange:T,dir:j,triggerPointerDownPosRef:z,disabled:m,children:[a.jsx(ss.Provider,{scope:t,children:a.jsx(n0,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(A=>{P(B=>new Set(B).add(A))},[]),onNativeOptionRemove:u.useCallback(A=>{P(B=>{const C=new Set(B);return C.delete(A),C})},[]),children:n})}),q?a.jsxs(Hd,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:p,value:V,onChange:A=>F(A.target.value),disabled:m,form:x,children:[V===void 0?a.jsx("option",{value:""}):null,Array.from(Q)]},Y):null]})})};yd.displayName=Bn;var Sd="SelectTrigger",Cd=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=as(n),i=In(Sd,n),l=i.disabled||r,c=$e(t,i.onTriggerChange),d=is(n),f=u.useRef("touch"),[p,m,g]=Gd(h=>{const v=d().filter(S=>!S.disabled),b=v.find(S=>S.value===i.value),w=Vd(v,h,b);w!==void 0&&i.onValueChange(w.value)}),x=h=>{l||(i.onOpenChange(!0),g()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return a.jsx(Bo,{asChild:!0,...s,children:a.jsx(ke.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Wd(i.value)?"":void 0,...o,ref:c,onClick:ve(o.onClick,h=>{h.currentTarget.focus(),f.current!=="mouse"&&x(h)}),onPointerDown:ve(o.onPointerDown,h=>{f.current=h.pointerType;const v=h.target;v.hasPointerCapture(h.pointerId)&&v.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(x(h),h.preventDefault())}),onKeyDown:ve(o.onKeyDown,h=>{const v=p.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&m(h.key),!(v&&h.key===" ")&&Jw.includes(h.key)&&(x(),h.preventDefault())})})})});Cd.displayName=Sd;var Ed="SelectValue",Td=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=In(Ed,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,p=$e(t,c.onValueNodeChange);return ot(()=>{d(f)},[d,f]),a.jsx(ke.span,{...l,ref:p,style:{pointerEvents:"none"},children:Wd(c.value)?a.jsx(a.Fragment,{children:i}):s})});Td.displayName=Ed;var o0="SelectIcon",Ad=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Ad.displayName=o0;var s0="SelectPortal",Nd=e=>a.jsx(Yr,{asChild:!0,...e});Nd.displayName=s0;var Un="SelectContent",kd=u.forwardRef((e,t)=>{const n=In(Un,e.__scopeSelect),[r,o]=u.useState();if(ot(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Wr.createPortal(a.jsx(_d,{scope:e.__scopeSelect,children:a.jsx(ss.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Id,{...e,ref:t})});kd.displayName=Un;var $t=10,[_d,jn]=br(Un),i0="SelectContentImpl",a0=Dn("SelectContent.RemoveScroll"),Id=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:h,avoidCollisions:v,...b}=e,w=In(Un,n),[S,E]=u.useState(null),[N,j]=u.useState(null),k=$e(t,I=>E(I)),[T,V]=u.useState(null),[F,z]=u.useState(null),q=is(n),[Q,P]=u.useState(!1),Y=u.useRef(!1);u.useEffect(()=>{if(S)return Hi(S)},[S]),Ui();const A=u.useCallback(I=>{const[K,...ee]=q().map(ie=>ie.ref.current),[te]=ee.slice(-1),ae=document.activeElement;for(const ie of I)if(ie===ae||(ie==null||ie.scrollIntoView({block:"nearest"}),ie===K&&N&&(N.scrollTop=0),ie===te&&N&&(N.scrollTop=N.scrollHeight),ie==null||ie.focus(),document.activeElement!==ae))return},[q,N]),B=u.useCallback(()=>A([T,S]),[A,T,S]);u.useEffect(()=>{Q&&B()},[Q,B]);const{onOpenChange:C,triggerPointerDownPosRef:_}=w;u.useEffect(()=>{if(S){let I={x:0,y:0};const K=te=>{var ae,ie;I={x:Math.abs(Math.round(te.pageX)-(((ae=_.current)==null?void 0:ae.x)??0)),y:Math.abs(Math.round(te.pageY)-(((ie=_.current)==null?void 0:ie.y)??0))}},ee=te=>{I.x<=10&&I.y<=10?te.preventDefault():S.contains(te.target)||C(!1),document.removeEventListener("pointermove",K),_.current=null};return _.current!==null&&(document.addEventListener("pointermove",K),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",K),document.removeEventListener("pointerup",ee,{capture:!0})}}},[S,C,_]),u.useEffect(()=>{const I=()=>C(!1);return window.addEventListener("blur",I),window.addEventListener("resize",I),()=>{window.removeEventListener("blur",I),window.removeEventListener("resize",I)}},[C]);const[D,M]=Gd(I=>{const K=q().filter(ae=>!ae.disabled),ee=K.find(ae=>ae.ref.current===document.activeElement),te=Vd(K,I,ee);te&&setTimeout(()=>te.ref.current.focus())}),J=u.useCallback((I,K,ee)=>{const te=!Y.current&&!ee;(w.value!==void 0&&w.value===K||te)&&(V(I),te&&(Y.current=!0))},[w.value]),L=u.useCallback(()=>S==null?void 0:S.focus(),[S]),H=u.useCallback((I,K,ee)=>{const te=!Y.current&&!ee;(w.value!==void 0&&w.value===K||te)&&z(I)},[w.value]),O=r==="popper"?Js:jd,W=O===Js?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:h,avoidCollisions:v}:{};return a.jsx(_d,{scope:n,content:S,viewport:N,onViewportChange:j,itemRefCallback:J,selectedItem:T,onItemLeave:L,itemTextRefCallback:H,focusSelectedItem:B,selectedItemText:F,position:r,isPositioned:Q,searchRef:D,children:a.jsx(Vo,{as:a0,allowPinchZoom:!0,children:a.jsx(Wo,{asChild:!0,trapped:w.open,onMountAutoFocus:I=>{I.preventDefault()},onUnmountAutoFocus:ve(o,I=>{var K;(K=w.trigger)==null||K.focus({preventScroll:!0}),I.preventDefault()}),children:a.jsx(Gr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:I=>I.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:a.jsx(O,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:I=>I.preventDefault(),...b,...W,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,I=>{const K=I.ctrlKey||I.altKey||I.metaKey;if(I.key==="Tab"&&I.preventDefault(),!K&&I.key.length===1&&M(I.key),["ArrowUp","ArrowDown","Home","End"].includes(I.key)){let te=q().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);if(["ArrowUp","End"].includes(I.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(I.key)){const ae=I.target,ie=te.indexOf(ae);te=te.slice(ie+1)}setTimeout(()=>A(te)),I.preventDefault()}})})})})})})});Id.displayName=i0;var l0="SelectItemAlignedPosition",jd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=In(Un,n),i=jn(Un,n),[l,c]=u.useState(null),[d,f]=u.useState(null),p=$e(t,k=>f(k)),m=is(n),g=u.useRef(!1),x=u.useRef(!0),{viewport:h,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,S=u.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&h&&v&&b){const k=s.trigger.getBoundingClientRect(),T=d.getBoundingClientRect(),V=s.valueNode.getBoundingClientRect(),F=b.getBoundingClientRect();if(s.dir!=="rtl"){const ae=F.left-T.left,ie=V.left-ae,de=k.left-ie,ye=k.width+de,Ie=Math.max(ye,T.width),je=window.innerWidth-$t,Pe=cl(ie,[$t,Math.max($t,je-Ie)]);l.style.minWidth=ye+"px",l.style.left=Pe+"px"}else{const ae=T.right-F.right,ie=window.innerWidth-V.right-ae,de=window.innerWidth-k.right-ie,ye=k.width+de,Ie=Math.max(ye,T.width),je=window.innerWidth-$t,Pe=cl(ie,[$t,Math.max($t,je-Ie)]);l.style.minWidth=ye+"px",l.style.right=Pe+"px"}const z=m(),q=window.innerHeight-$t*2,Q=h.scrollHeight,P=window.getComputedStyle(d),Y=parseInt(P.borderTopWidth,10),A=parseInt(P.paddingTop,10),B=parseInt(P.borderBottomWidth,10),C=parseInt(P.paddingBottom,10),_=Y+A+Q+C+B,D=Math.min(v.offsetHeight*5,_),M=window.getComputedStyle(h),J=parseInt(M.paddingTop,10),L=parseInt(M.paddingBottom,10),H=k.top+k.height/2-$t,O=q-H,W=v.offsetHeight/2,I=v.offsetTop+W,K=Y+A+I,ee=_-K;if(K<=H){const ae=z.length>0&&v===z[z.length-1].ref.current;l.style.bottom="0px";const ie=d.clientHeight-h.offsetTop-h.offsetHeight,de=Math.max(O,W+(ae?L:0)+ie+B),ye=K+de;l.style.height=ye+"px"}else{const ae=z.length>0&&v===z[0].ref.current;l.style.top="0px";const de=Math.max(H,Y+h.offsetTop+(ae?J:0)+W)+ee;l.style.height=de+"px",h.scrollTop=K-H+h.offsetTop}l.style.margin=`${$t}px 0`,l.style.minHeight=D+"px",l.style.maxHeight=q+"px",r==null||r(),requestAnimationFrame(()=>g.current=!0)}},[m,s.trigger,s.valueNode,l,d,h,v,b,s.dir,r]);ot(()=>S(),[S]);const[E,N]=u.useState();ot(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const j=u.useCallback(k=>{k&&x.current===!0&&(S(),w==null||w(),x.current=!1)},[S,w]);return a.jsx(u0,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:j,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:a.jsx(ke.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});jd.displayName=l0;var c0="SelectPopperPosition",Js=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=$t,...s}=e,i=as(n);return a.jsx(Li,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});Js.displayName=c0;var[u0,ea]=br(Un,{}),Qs="SelectViewport",Rd=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=jn(Qs,n),i=ea(Qs,n),l=$e(t,s.onViewportChange),c=u.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(ss.Slot,{scope:n,children:a.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const g=Math.abs(c.current-f.scrollTop);if(g>0){const x=window.innerHeight-$t*2,h=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(h,v);if(b<x){const w=b+g,S=Math.min(x,w),E=w-S;p.style.height=S+"px",p.style.bottom==="0px"&&(f.scrollTop=E>0?E:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Rd.displayName=Qs;var Md="SelectGroup",[d0,f0]=br(Md),p0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Qt();return a.jsx(d0,{scope:n,id:o,children:a.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});p0.displayName=Md;var Pd="SelectLabel",m0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=f0(Pd,n);return a.jsx(ke.div,{id:o.id,...r,ref:t})});m0.displayName=Pd;var _o="SelectItem",[h0,Ld]=br(_o),Dd=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=In(_o,n),c=jn(_o,n),d=l.value===r,[f,p]=u.useState(s??""),[m,g]=u.useState(!1),x=$e(t,w=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,w,r,o)}),h=Qt(),v=u.useRef("touch"),b=()=>{o||(l.onValueChange(r),l.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 a.jsx(h0,{scope:n,value:r,disabled:o,textId:h,isSelected:d,onItemTextChange:u.useCallback(w=>{p(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:a.jsx(ss.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:a.jsx(ke.div,{role:"option","aria-labelledby":h,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:ve(i.onFocus,()=>g(!0)),onBlur:ve(i.onBlur,()=>g(!1)),onClick:ve(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:ve(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:ve(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:ve(i.onPointerMove,w=>{var S;v.current=w.pointerType,o?(S=c.onItemLeave)==null||S.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:ve(i.onKeyDown,w=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&w.key===" "||(Qw.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Dd.displayName=_o;var Mr="SelectItemText",Od=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=In(Mr,n),l=jn(Mr,n),c=Ld(Mr,n),d=r0(Mr,n),[f,p]=u.useState(null),m=$e(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),g=f==null?void 0:f.textContent,x=u.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:h,onNativeOptionRemove:v}=d;return ot(()=>(h(x),()=>v(x)),[h,v,x]),a.jsxs(a.Fragment,{children:[a.jsx(ke.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Wr.createPortal(s.children,i.valueNode):null]})});Od.displayName=Mr;var Fd="SelectItemIndicator",zd=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ld(Fd,n).isSelected?a.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});zd.displayName=Fd;var ei="SelectScrollUpButton",$d=u.forwardRef((e,t)=>{const n=jn(ei,e.__scopeSelect),r=ea(ei,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Ud,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});$d.displayName=ei;var ti="SelectScrollDownButton",Bd=u.forwardRef((e,t)=>{const n=jn(ti,e.__scopeSelect),r=ea(ti,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return ot(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Ud,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Bd.displayName=ti;var Ud=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=jn("SelectScrollButton",n),i=u.useRef(null),l=is(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),ot(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{c()})})}),g0="SelectSeparator",x0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});x0.displayName=g0;var ni="SelectArrow",v0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=as(n),s=In(ni,n),i=jn(ni,n);return s.open&&i.position==="popper"?a.jsx(Di,{...o,...r,ref:t}):null});v0.displayName=ni;var w0="SelectBubbleInput",Hd=u.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=u.useRef(null),s=$e(r,o),i=Zw(t);return u.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(p)}},[i,t]),a.jsx(ke.select,{...n,style:{...Vc,...n.style},ref:s,defaultValue:t})});Hd.displayName=w0;function Wd(e){return e===""||e===void 0}function Gd(e){const t=Cn(e),n=u.useRef(""),r=u.useRef(0),o=u.useCallback(i=>{const l=n.current+i;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=u.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Vd(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=b0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function b0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var y0=yd,S0=Cd,C0=Td,E0=Ad,T0=Nd,A0=kd,N0=Rd,k0=Dd,_0=Od,I0=zd,j0=$d,R0=Bd;function Yd({...e}){return a.jsx(y0,{"data-slot":"select",...e})}function Kd({...e}){return a.jsx(C0,{"data-slot":"select-value",...e})}function qd({className:e,size:t="default",children:n,...r}){return a.jsxs(S0,{"data-slot":"select-trigger","data-size":t,className:be("flex w-fit items-center justify-between gap-2 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,a.jsx(E0,{asChild:!0,children:a.jsx(Kl,{className:"size-4 opacity-50"})})]})}function Xd({className:e,children:t,position:n="popper",...r}){return a.jsx(T0,{children:a.jsxs(A0,{"data-slot":"select-content",className:be("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:[a.jsx(M0,{}),a.jsx(N0,{className:be("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(P0,{})]})})}function Zd({className:e,children:t,...n}){return a.jsxs(k0,{"data-slot":"select-item",className:be("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm select-none hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(I0,{children:a.jsx(wi,{className:"size-4"})})}),a.jsx(_0,{children:t})]})}function M0({className:e,...t}){return a.jsx(j0,{"data-slot":"select-scroll-up-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Up,{className:"size-4"})})}function P0({className:e,...t}){return a.jsx(R0,{"data-slot":"select-scroll-down-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Kl,{className:"size-4"})})}var Is="rovingFocusGroup.onEntryFocus",L0={bubbles:!1,cancelable:!0},Xr="RovingFocusGroup",[ri,Jd,D0]=ad(Xr),[O0,Qd]=kn(Xr,[D0]),[F0,z0]=O0(Xr),ef=u.forwardRef((e,t)=>a.jsx(ri.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(ri.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx($0,{...e,ref:t})})}));ef.displayName=Xr;var $0=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=u.useRef(null),g=$e(t,m),x=Zi(s),[h,v]=Fn({prop:i,defaultProp:l??null,onChange:c,caller:Xr}),[b,w]=u.useState(!1),S=Cn(d),E=Jd(n),N=u.useRef(!1),[j,k]=u.useState(0);return u.useEffect(()=>{const T=m.current;if(T)return T.addEventListener(Is,S),()=>T.removeEventListener(Is,S)},[S]),a.jsx(F0,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:h,onItemFocus:u.useCallback(T=>v(T),[v]),onItemShiftTab:u.useCallback(()=>w(!0),[]),onFocusableItemAdd:u.useCallback(()=>k(T=>T+1),[]),onFocusableItemRemove:u.useCallback(()=>k(T=>T-1),[]),children:a.jsx(ke.div,{tabIndex:b||j===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{N.current=!0}),onFocus:ve(e.onFocus,T=>{const V=!N.current;if(T.target===T.currentTarget&&V&&!b){const F=new CustomEvent(Is,L0);if(T.currentTarget.dispatchEvent(F),!F.defaultPrevented){const z=E().filter(A=>A.focusable),q=z.find(A=>A.active),Q=z.find(A=>A.id===h),Y=[q,Q,...z].filter(Boolean).map(A=>A.ref.current);rf(Y,f)}}N.current=!1}),onBlur:ve(e.onBlur,()=>w(!1))})})}),tf="RovingFocusGroupItem",nf=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Qt(),d=s||c,f=z0(tf,n),p=f.currentTabStopId===d,m=Jd(n),{onFocusableItemAdd:g,onFocusableItemRemove:x,currentTabStopId:h}=f;return u.useEffect(()=>{if(r)return g(),()=>x()},[r,g,x]),a.jsx(ri.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:a.jsx(ke.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ve(e.onMouseDown,v=>{r?f.onItemFocus(d):v.preventDefault()}),onFocus:ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ve(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=H0(v,f.orientation,f.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=m().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();const E=S.indexOf(v.currentTarget);S=f.loop?W0(S,E+1):S.slice(E+1)}setTimeout(()=>rf(S))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:h!=null}):i})})});nf.displayName=tf;var B0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function U0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function H0(e,t,n){const r=U0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return B0[r]}function rf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function W0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var G0=ef,V0=nf,ls="Tabs",[Y0]=kn(ls,[Qd]),of=Qd(),[K0,ta]=Y0(ls),sf=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=Zi(l),[p,m]=Fn({prop:r,onChange:o,defaultProp:s??"",caller:ls});return a.jsx(K0,{scope:n,baseId:Qt(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(ke.div,{dir:f,"data-orientation":i,...d,ref:t})})});sf.displayName=ls;var af="TabsList",lf=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=ta(af,n),i=of(n);return a.jsx(G0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(ke.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});lf.displayName=af;var cf="TabsTrigger",uf=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=ta(cf,n),l=of(n),c=pf(i.baseId,r),d=mf(i.baseId,r),f=r===i.value;return a.jsx(V0,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(ke.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ve(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ve(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});uf.displayName=cf;var df="TabsContent",ff=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=ta(df,n),c=pf(l.baseId,r),d=mf(l.baseId,r),f=r===l.value,p=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(gn,{present:o||f,children:({present:m})=>a.jsx(ke.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});ff.displayName=df;function pf(e,t){return`${e}-trigger-${t}`}function mf(e,t){return`${e}-content-${t}`}var q0=sf,X0=lf,Z0=uf,J0=ff;function Q0({className:e,...t}){return a.jsx(q0,{"data-slot":"tabs",className:be("flex flex-col gap-2",e),...t})}function eb({className:e,...t}){return a.jsx(X0,{"data-slot":"tabs-list",className:be("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function ul({className:e,...t}){return a.jsx(Z0,{"data-slot":"tabs-trigger","data-testid":t.value,"aria-label":t.value,title:t.title,className:be("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 dl({className:e,...t}){return a.jsx(J0,{"data-slot":"tabs-content",className:be("flex-1 outline-none",e),...t})}const hf=u.forwardRef(({className:e,...t},n)=>a.jsx(su,{autoComplete:"off",ref:n,name:"message","data-testid":"chat-input",className:be("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}));hf.displayName="ChatInput";const tb=Nn("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"}}),gf=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:be(tb({variant:t,layout:n,className:e}),"group relative"),ref:s,...o,children:u.Children.map(r,i=>u.isValidElement(i)&&typeof i.type!="string"?u.cloneElement(i,{variant:t,layout:n}):i)}));gf.displayName="ChatBubble";const nb=Nn("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"}}),xf=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:be(nb({variant:t,layout:n,className:e}),"relative max-w-full break-words whitespace-pre-wrap"),ref:s,...o,children:a.jsx(a.Fragment,{children:r})}));xf.displayName="ChatBubbleMessage";const rb=u.forwardRef(({variant:e,className:t,children:n,...r},o)=>a.jsx("div",{ref:o,className:be("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}));rb.displayName="ChatBubbleActionWrapper";const vf={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},wf=Ut.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:s,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=pb({smooth:!0,content:t});return u.useImperativeHandle(r,()=>({scrollToBottom:l})),a.jsxs("div",{className:`fade-both-mask relative h-full min-h-0 w-full flex-1 py-3 ${e}`,children:[a.jsx("div",{className:"flex h-full w-full flex-col overflow-y-auto p-4",ref:o,onWheel:i,onTouchMove:i,...n,style:{scrollBehavior:"smooth"},children:a.jsx("div",{className:"flex flex-col gap-6",style:vf,children:t})}),!s&&c&&a.jsx(we,{onClick:()=>{l()},size:"icon",variant:"outline",className:"bg-background absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md","aria-label":"Scroll to bottom",children:a.jsx(ql,{className:"h-4 w-4"})})]})});wf.displayName="ChatMessageList";const ob=Nn("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),sb=Nn("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 bf({size:e,show:t,children:n,className:r,variant:o}){return a.jsxs("span",{className:ob({show:t}),children:[a.jsx(bi,{className:be(sb({size:e,variant:o}),r)}),n]})}function ib({className:e=""}){return a.jsx(bf,{size:"small",variant:"primary",className:e})}const lo={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-wMain)]"},ab=Nn("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"},type:{error:lo.error,warning:lo.warning,info:lo.info,success:lo.success}},defaultVariants:{variant:"default"}});function yf({className:e,variant:t,type:n,asChild:r=!1,...o}){const s=r?cc:"span";return a.jsx(s,{"data-slot":"badge",className:be(ab({variant:t,type:n}),e),...o})}const lb=Nn("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 cb({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:be(lb({variant:t}),e),...n})}function ub({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:be("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function db({message:e,type:t}){return a.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:a.jsx(cb,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:a.jsxs(ub,{className:"flex items-center text-sm",children:[t==="error"&&a.jsx(yi,{className:"mr-2 text-[var(--color-error-wMain)]"}),a.jsx("div",{className:"truncate",children:e})]})})})}function fb(){const{notifications:e}=He();return e.length===0?null:a.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=>a.jsx("div",{className:"pointer-events-auto",children:a.jsx(db,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function pb(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,s=u.useRef(null),i=u.useRef(0),l=u.useRef(!1),[c,d]=u.useState({isAtBottom:!0,autoScrollEnabled:!0}),f=u.useCallback(x=>{const{scrollTop:h,scrollHeight:v,clientHeight:b}=x;return Math.abs(v-h-b)<=t},[t]),p=u.useCallback(x=>{if(!s.current)return;const h=s.current.scrollHeight-s.current.clientHeight;x?s.current.scrollTop=h:s.current.scrollTo({top:h,behavior:n?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=u.useCallback(()=>{if(!s.current)return;const x=f(s.current);d(h=>({isAtBottom:x,autoScrollEnabled:x?!0:h.autoScrollEnabled}))},[f]);u.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),u.useEffect(()=>{const x=s.current;if(!x)return;const h=x.scrollHeight;h!==i.current&&((c.autoScrollEnabled||o)&&requestAnimationFrame(()=>{p(i.current===0)}),i.current=h)},[r,c.autoScrollEnabled,p,o]),u.useEffect(()=>{const x=s.current;if(!x)return;const h=new ResizeObserver(()=>{c.autoScrollEnabled&&p(!0)});return h.observe(x),()=>h.disconnect()},[c.autoScrollEnabled,p]);const g=u.useCallback(()=>{(s.current?f(s.current):!1)||(l.current=!0,d(h=>({...h,autoScrollEnabled:!1})))},[f]);return{scrollRef:s,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>p(),disableAutoScroll:g,userHasScrolled:l.current}}const mb=({fileName:e,onRemove:t})=>a.jsxs(yf,{className:"bg-muted max-w-50 gap-1.5 rounded-full pr-1",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&a.jsx(we,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:a.jsx(Do,{})})]}),hb=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,userInput:o,selectedAgentName:s,setSelectedAgentName:i,setUserInput:l,handleSubmit:c,handleCancel:d}=He(),f=u.useRef(null),[p,m]=u.useState([]),g=u.useRef(null),x=u.useRef(n),[h,v]=u.useState(o),b=Rw(h,300);u.useEffect(()=>{l(b)},[b,l]),u.useEffect(()=>{v(o)},[o]),u.useEffect(()=>{x.current&&!n&&setTimeout(()=>{var P;(P=g.current)==null||P.focus()},100),x.current=n},[n]);const w=()=>{var P;n||(P=f.current)==null||P.click()},S=P=>{const Y=P.target.files;if(Y){const A=Array.from(Y).filter(B=>!p.some(C=>C.name===B.name&&C.size===B.size&&C.lastModified===B.lastModified));A.length>0&&m(B=>[...B,...A])}P.target&&(P.target.value=""),setTimeout(()=>{var A;(A=g.current)==null||A.focus()},100)},E=P=>{if(n)return;const Y=P.clipboardData;if(!Y||!Y.files||Y.files.length===0)return;Y.files.length>0&&P.preventDefault();const A=Array.from(Y.files).filter(B=>!p.some(C=>C.name===B.name&&C.size===B.size&&C.lastModified===B.lastModified));A.length>0&&m(B=>[...B,...A])},N=P=>{m(Y=>Y.filter((A,B)=>B!==P))},j=u.useMemo(()=>!n&&((h==null?void 0:h.trim())||p.length!==0),[n,h,p]),k=async P=>{P.preventDefault(),j&&(await c(P,p,h.trim()),m([]),v(""),t==null||t())},T=P=>{if(n)return;const Y=P.filter(A=>!p.some(B=>B.name===A.name&&B.size===A.size&&B.lastModified===A.lastModified));Y.length>0&&m(A=>[...A,...Y])},{isDragging:V,handleDragEnter:F,handleDragOver:z,handleDragLeave:q,handleDrop:Q}=Pw({onFilesDropped:T,disabled:n});return a.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${V?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:F,onDragOver:z,onDragLeave:q,onDrop:Q,children:[a.jsx("input",{type:"file",ref:f,className:"hidden",multiple:!0,onChange:S,accept:"*/*",disabled:n}),p.length>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:p.map((P,Y)=>a.jsx(mb,{fileName:P.name,onRemove:()=>N(Y)},`${P.name}-${P.lastModified}-${Y}`))}),a.jsx(hf,{ref:g,value:h,onChange:P=>v(P.target.value),placeholder:"How can I help you today?",className:"field-sizing-content max-h-50 min-h-0 resize-none rounded-2xl border-none p-3 text-base/normal shadow-none transition-[height] duration-500 ease-in-out focus-visible:outline-none",rows:1,onPaste:E,onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&j&&k(P)}}),a.jsxs("div",{className:"m-2 flex items-center gap-2",children:[a.jsx(we,{variant:"ghost",onClick:w,disabled:n,tooltip:"Attach file",children:a.jsx(Xl,{className:"size-4"})}),a.jsx("div",{children:"Agent: "}),a.jsxs(Yd,{value:s,onValueChange:i,disabled:n||e.length===0,children:[a.jsx(qd,{className:"w-[250px]",children:a.jsx(Kd,{defaultValue:s})}),a.jsx(Xd,{children:e.map(P=>a.jsx(Zd,{value:P.name,children:P.displayName||P.name},P.name))})]}),n&&!r?a.jsxs(we,{className:"ml-auto gap-1.5",onClick:d,variant:"outline",disabled:r,tooltip:"Cancel",children:[a.jsx(Hp,{className:"size-4"}),"Stop"]}):a.jsx(we,{variant:"ghost",className:"ml-auto gap-1.5",onClick:k,disabled:!j,tooltip:"Send message",children:a.jsx(Wp,{className:"size-4"})})]})]})};function gb(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function xb(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 vb(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 wb(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 bb(e,t){if(t&&t.toLowerCase().startsWith("image/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".png")||n.endsWith(".jpg")||n.endsWith(".jpeg")||n.endsWith(".gif")||n.endsWith(".bmp")||n.endsWith(".webp")||n.endsWith(".svg")}function yb(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 Sb(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 Cb(e,t){if(t){const r=t.toLowerCase();if(r==="text/markdown"||r==="application/markdown"||r==="text/x-markdown")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function Eb(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 Zr(e,t){return xb(e,t)?"html":vb(e,t)?"mermaid":bb(e,t)?"image":Cb(e,t)?"markdown":Eb(e,t)?"audio":yb(e,t)?"json":Sb(e,t)?"yaml":wb(e,t)?"csv":gb(e,t)?"text":null}function Sf(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){return console.error("Failed to decode base64 content with atob fallback:",n),e}}}const Cf=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],Tb=["image","audio"],Ab=e=>{if(!e||!e.content)return"";const t=Zr(e.name,e.mime_type);if(!t||!Cf.includes(t))return"";if(Tb.includes(t))return e.content;try{return Sf(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},Ef=5*1024*1024,Nb=Sc(Ef);function kb(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=Zr(e.filename,e.mime_type);return!t||!Cf.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>Ef?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${Nb}.`}:{canPreview:!0}}const Tf=(e,t="h-4 w-4")=>{if(!e)return a.jsx(ha,{className:t});switch(Zr(e.filename,e.mime_type)){case"image":case"mermaid":return a.jsx(qp,{className:t});case"audio":return a.jsx(Kp,{className:t});case"html":return a.jsx(Yp,{className:t});case"text":return a.jsx(ar,{className:t});case"csv":return a.jsx(Vp,{className:t});case"json":return a.jsx(Gp,{className:t});default:return a.jsx(ha,{className:t})}},Af=({fileAttachment:e,isEmbedded:t=!1})=>a.jsx(Nf,{filename:e.name,mimeType:e.mime_type,onDownload:()=>mh(e),className:"ml-4",isEmbedded:t}),Nf=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:s,setPreviewArtifact:i,openSidePanelTab:l}=He(),c=u.useMemo(()=>s.find(f=>f.filename===e),[s,e]),d=u.useMemo(()=>Tf(c||{filename:e,mime_type:t||""}),[c,e,t]);return a.jsxs("div",{className:`flex h-11 max-w-xs flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 ${n||""}`,children:[d,a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-9",title:e,children:a.jsx("strong",{children:a.jsx("code",{children:e})})}),c&&!o&&a.jsx(we,{variant:"ghost",onClick:f=>{f.stopPropagation(),l("files"),i(c)},tooltip:"Preview",children:a.jsx(Zl,{className:"h-4 w-4"})}),r&&a.jsx(we,{variant:"ghost",onClick:()=>r(),tooltip:"Download file",children:a.jsx(Si,{className:"h-4 w-4"})})]})},_b=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return a.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center p-4",children:a.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[a.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},Ib=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let s=0;s<e.length;s++){const i=e[s],l=s<e.length-1?e[s+1]:"";i==='"'?l==='"'?(r+='"',s++):o=!o:i===","&&!o?(n.push(r.trim()),r=""):(i===`
117
- `||i==="\r"&&l===`
118
- `)&&!o?(i==="\r"&&l===`
119
- `&&s++,n.push(r.trim()),r="",n.some(c=>c.trim())?(t.push(n),n=[]):n=[]):r+=i}return(r||n.length>0)&&(n.push(r.trim()),n.some(s=>s.trim())&&t.push(n)),t},jb=({content:e,setRenderError:t})=>{u.useEffect(()=>{t(null)},[e,t]);const n=u.useMemo(()=>{try{return Ib(e)}catch(r){return console.error("Error parsing CSV:",r),t("Failed to parse CSV content."),[]}},[e,t]);return n.length?a.jsx("div",{className:"block w-full overflow-x-scroll p-4",children:a.jsx("div",{style:{minWidth:"min(100%, max-content)"},children:a.jsxs("table",{className:"w-full border text-sm",children:[a.jsx("thead",{className:"sticky top-0 z-10 shadow-sm",children:n.length>0&&a.jsx("tr",{children:n[0].map((r,o)=>a.jsx("th",{className:"border-b p-2 text-left font-medium whitespace-nowrap",title:r,children:(r==null?void 0:r.trim())||""},`header-${o}`))})}),a.jsx("tbody",{children:n.slice(1).map((r,o)=>a.jsx("tr",{className:o%2===0?"bg-muted dark:bg-gray-700":"",children:r.map((s,i)=>a.jsx("td",{className:"min-w-0 border-b p-2 align-top break-words",title:s,children:(s==null?void 0:s.trim())||""},`cell-${o}-${i}`))},`row-${o}`))})]})})}):a.jsx("div",{children:"No valid CSV content found or failed to parse."})},Rb=({content:e,setRenderError:t})=>{const n=u.useMemo(()=>e.replace(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi,(s,i)=>{const l=s.match(/<script(\s[^>]*)?>/i);return`<script${l&&l[1]?l[1]:""}>(function() {
120
- try {
121
- ${i}
122
- } catch (e) { console.error('Error in sandboxed script:', e); }
123
- })();<\/script>`}),[e]);return a.jsx("div",{className:"h-full w-full overflow-hidden border dark:bg-gray-400",children:a.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)})})},Mb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return a.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-4",children:a.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})};function kf(){const e=u.useRef(null),t=()=>{if(e.current){const r=document.createRange();r.selectNodeContents(e.current);const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}};return{ref:e,handleKeyDown:r=>{(r.metaKey||r.ctrlKey)&&r.key==="a"&&(r.preventDefault(),t())},selectAllContent:t}}const Pb=({content:e})=>{const{ref:t,handleKeyDown:n}=kf();return a.jsx("div",{className:"w-full p-4",children:a.jsx("div",{ref:t,className:"max-w-full overflow-hidden select-text focus-visible:outline-none",tabIndex:0,onKeyDown:n,children:a.jsx(ir,{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:_f,setPrototypeOf:fl,isFrozen:Lb,getPrototypeOf:Db,getOwnPropertyDescriptor:Ob}=Object;let{freeze:ct,seal:It,create:If}=Object,{apply:oi,construct:si}=typeof Reflect<"u"&&Reflect;ct||(ct=function(t){return t});It||(It=function(t){return t});oi||(oi=function(t,n,r){return t.apply(n,r)});si||(si=function(t,n){return new t(...n)});const co=ut(Array.prototype.forEach),Fb=ut(Array.prototype.lastIndexOf),pl=ut(Array.prototype.pop),Er=ut(Array.prototype.push),zb=ut(Array.prototype.splice),yo=ut(String.prototype.toLowerCase),js=ut(String.prototype.toString),ml=ut(String.prototype.match),Tr=ut(String.prototype.replace),$b=ut(String.prototype.indexOf),Bb=ut(String.prototype.trim),Bt=ut(Object.prototype.hasOwnProperty),it=ut(RegExp.prototype.test),Ar=Ub(TypeError);function ut(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 oi(e,t,r)}}function Ub(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return si(e,n)}}function Ae(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;fl&&fl(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Lb(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Hb(e){for(let t=0;t<e.length;t++)Bt(e,t)||(e[t]=null);return e}function un(e){const t=If(null);for(const[n,r]of _f(e))Bt(e,n)&&(Array.isArray(r)?t[n]=Hb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=un(r):t[n]=r);return t}function Nr(e,t){for(;e!==null;){const r=Ob(e,t);if(r){if(r.get)return ut(r.get);if(typeof r.value=="function")return ut(r.value)}e=Db(e)}function n(){return null}return n}const hl=ct(["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"]),Rs=ct(["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"]),Ms=ct(["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"]),Wb=ct(["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"]),Ps=ct(["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"]),Gb=ct(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),gl=ct(["#text"]),xl=ct(["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"]),Ls=ct(["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"]),vl=ct(["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"]),uo=ct(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Vb=It(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Yb=It(/<%[\w\W]*|[\w\W]*%>/gm),Kb=It(/\$\{[\w\W]*/gm),qb=It(/^data-[\-\w.\u00B7-\uFFFF]+$/),Xb=It(/^aria-[\-\w]+$/),jf=It(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Zb=It(/^(?:\w+script|data):/i),Jb=It(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Rf=It(/^html$/i),Qb=It(/^[a-z][.\w]*(-[.\w]+)+$/i);var wl=Object.freeze({__proto__:null,ARIA_ATTR:Xb,ATTR_WHITESPACE:Jb,CUSTOM_ELEMENT:Qb,DATA_ATTR:qb,DOCTYPE_NAME:Rf,ERB_EXPR:Yb,IS_ALLOWED_URI:jf,IS_SCRIPT_OR_DATA:Zb,MUSTACHE_EXPR:Vb,TMPLIT_EXPR:Kb});const kr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ey=function(){return typeof window>"u"?null:window},ty=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 s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},bl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Mf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ey();const t=X=>Mf(X);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==kr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:g}=e,x=c.prototype,h=Nr(x,"cloneNode"),v=Nr(x,"remove"),b=Nr(x,"nextSibling"),w=Nr(x,"childNodes"),S=Nr(x,"parentNode");if(typeof i=="function"){const X=n.createElement("template");X.content&&X.content.ownerDocument&&(n=X.content.ownerDocument)}let E,N="";const{implementation:j,createNodeIterator:k,createDocumentFragment:T,getElementsByTagName:V}=n,{importNode:F}=r;let z=bl();t.isSupported=typeof _f=="function"&&typeof S=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:q,ERB_EXPR:Q,TMPLIT_EXPR:P,DATA_ATTR:Y,ARIA_ATTR:A,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:C,CUSTOM_ELEMENT:_}=wl;let{IS_ALLOWED_URI:D}=wl,M=null;const J=Ae({},[...hl,...Rs,...Ms,...Ps,...gl]);let L=null;const H=Ae({},[...xl,...Ls,...vl,...uo]);let O=Object.seal(If(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}})),W=null,I=null,K=!0,ee=!0,te=!1,ae=!0,ie=!1,de=!0,ye=!1,Ie=!1,je=!1,Pe=!1,Me=!1,Be=!1,yt=!0,We=!1;const St="user-content-";let tt=!0,nt=!1,rt={},le=null;const jt=Ae({},["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 ht=null;const Rt=Ae({},["audio","video","img","source","image","track"]);let Mt=null;const Ct=Ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",Tt="http://www.w3.org/2000/svg",Xe="http://www.w3.org/1999/xhtml";let ft=Xe,Pt=!1,Lt=null;const sn=Ae({},[Et,Tt,Xe],js);let De=Ae({},["mi","mo","mn","ms","mtext"]),Ge=Ae({},["annotation-xml"]);const Dt=Ae({},["title","style","font","a","script"]);let gt=null;const Ot=["application/xhtml+xml","text/html"],Ft="text/html";let Oe=null,pt=null;const an=n.createElement("form"),Yt=function(y){return y instanceof RegExp||y instanceof Function},At=function(){let y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(pt&&pt===y)){if((!y||typeof y!="object")&&(y={}),y=un(y),gt=Ot.indexOf(y.PARSER_MEDIA_TYPE)===-1?Ft:y.PARSER_MEDIA_TYPE,Oe=gt==="application/xhtml+xml"?js:yo,M=Bt(y,"ALLOWED_TAGS")?Ae({},y.ALLOWED_TAGS,Oe):J,L=Bt(y,"ALLOWED_ATTR")?Ae({},y.ALLOWED_ATTR,Oe):H,Lt=Bt(y,"ALLOWED_NAMESPACES")?Ae({},y.ALLOWED_NAMESPACES,js):sn,Mt=Bt(y,"ADD_URI_SAFE_ATTR")?Ae(un(Ct),y.ADD_URI_SAFE_ATTR,Oe):Ct,ht=Bt(y,"ADD_DATA_URI_TAGS")?Ae(un(Rt),y.ADD_DATA_URI_TAGS,Oe):Rt,le=Bt(y,"FORBID_CONTENTS")?Ae({},y.FORBID_CONTENTS,Oe):jt,W=Bt(y,"FORBID_TAGS")?Ae({},y.FORBID_TAGS,Oe):un({}),I=Bt(y,"FORBID_ATTR")?Ae({},y.FORBID_ATTR,Oe):un({}),rt=Bt(y,"USE_PROFILES")?y.USE_PROFILES:!1,K=y.ALLOW_ARIA_ATTR!==!1,ee=y.ALLOW_DATA_ATTR!==!1,te=y.ALLOW_UNKNOWN_PROTOCOLS||!1,ae=y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ie=y.SAFE_FOR_TEMPLATES||!1,de=y.SAFE_FOR_XML!==!1,ye=y.WHOLE_DOCUMENT||!1,Pe=y.RETURN_DOM||!1,Me=y.RETURN_DOM_FRAGMENT||!1,Be=y.RETURN_TRUSTED_TYPE||!1,je=y.FORCE_BODY||!1,yt=y.SANITIZE_DOM!==!1,We=y.SANITIZE_NAMED_PROPS||!1,tt=y.KEEP_CONTENT!==!1,nt=y.IN_PLACE||!1,D=y.ALLOWED_URI_REGEXP||jf,ft=y.NAMESPACE||Xe,De=y.MATHML_TEXT_INTEGRATION_POINTS||De,Ge=y.HTML_INTEGRATION_POINTS||Ge,O=y.CUSTOM_ELEMENT_HANDLING||{},y.CUSTOM_ELEMENT_HANDLING&&Yt(y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(O.tagNameCheck=y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),y.CUSTOM_ELEMENT_HANDLING&&Yt(y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(O.attributeNameCheck=y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),y.CUSTOM_ELEMENT_HANDLING&&typeof y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(O.allowCustomizedBuiltInElements=y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ie&&(ee=!1),Me&&(Pe=!0),rt&&(M=Ae({},gl),L=[],rt.html===!0&&(Ae(M,hl),Ae(L,xl)),rt.svg===!0&&(Ae(M,Rs),Ae(L,Ls),Ae(L,uo)),rt.svgFilters===!0&&(Ae(M,Ms),Ae(L,Ls),Ae(L,uo)),rt.mathMl===!0&&(Ae(M,Ps),Ae(L,vl),Ae(L,uo))),y.ADD_TAGS&&(M===J&&(M=un(M)),Ae(M,y.ADD_TAGS,Oe)),y.ADD_ATTR&&(L===H&&(L=un(L)),Ae(L,y.ADD_ATTR,Oe)),y.ADD_URI_SAFE_ATTR&&Ae(Mt,y.ADD_URI_SAFE_ATTR,Oe),y.FORBID_CONTENTS&&(le===jt&&(le=un(le)),Ae(le,y.FORBID_CONTENTS,Oe)),tt&&(M["#text"]=!0),ye&&Ae(M,["html","head","body"]),M.table&&(Ae(M,["tbody"]),delete W.tbody),y.TRUSTED_TYPES_POLICY){if(typeof y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=y.TRUSTED_TYPES_POLICY,N=E.createHTML("")}else E===void 0&&(E=ty(g,o)),E!==null&&typeof N=="string"&&(N=E.createHTML(""));ct&&ct(y),pt=y}},zt=Ae({},[...Rs,...Ms,...Wb]),Kt=Ae({},[...Ps,...Gb]),Se=function(y){let R=S(y);(!R||!R.tagName)&&(R={namespaceURI:ft,tagName:"template"});const Z=yo(y.tagName),Ce=yo(R.tagName);return Lt[y.namespaceURI]?y.namespaceURI===Tt?R.namespaceURI===Xe?Z==="svg":R.namespaceURI===Et?Z==="svg"&&(Ce==="annotation-xml"||De[Ce]):!!zt[Z]:y.namespaceURI===Et?R.namespaceURI===Xe?Z==="math":R.namespaceURI===Tt?Z==="math"&&Ge[Ce]:!!Kt[Z]:y.namespaceURI===Xe?R.namespaceURI===Tt&&!Ge[Ce]||R.namespaceURI===Et&&!De[Ce]?!1:!Kt[Z]&&(Dt[Z]||!zt[Z]):!!(gt==="application/xhtml+xml"&&Lt[y.namespaceURI]):!1},U=function(y){Er(t.removed,{element:y});try{S(y).removeChild(y)}catch{v(y)}},G=function(y,R){try{Er(t.removed,{attribute:R.getAttributeNode(y),from:R})}catch{Er(t.removed,{attribute:null,from:R})}if(R.removeAttribute(y),y==="is")if(Pe||Me)try{U(R)}catch{}else try{R.setAttribute(y,"")}catch{}},$=function(y){let R=null,Z=null;if(je)y="<remove></remove>"+y;else{const pe=ml(y,/^[\r\n\t ]+/);Z=pe&&pe[0]}gt==="application/xhtml+xml"&&ft===Xe&&(y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+y+"</body></html>");const Ce=E?E.createHTML(y):y;if(ft===Xe)try{R=new m().parseFromString(Ce,gt)}catch{}if(!R||!R.documentElement){R=j.createDocument(ft,"template",null);try{R.documentElement.innerHTML=Pt?N:Ce}catch{}}const Ne=R.body||R.documentElement;return y&&Z&&Ne.insertBefore(n.createTextNode(Z),Ne.childNodes[0]||null),ft===Xe?V.call(R,ye?"html":"body")[0]:ye?R.documentElement:Ne},re=function(y){return k.call(y.ownerDocument||y,y,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ce=function(y){return y instanceof p&&(typeof y.nodeName!="string"||typeof y.textContent!="string"||typeof y.removeChild!="function"||!(y.attributes instanceof f)||typeof y.removeAttribute!="function"||typeof y.setAttribute!="function"||typeof y.namespaceURI!="string"||typeof y.insertBefore!="function"||typeof y.hasChildNodes!="function")},me=function(y){return typeof l=="function"&&y instanceof l};function fe(X,y,R){co(X,Z=>{Z.call(t,y,R,pt)})}const ge=function(y){let R=null;if(fe(z.beforeSanitizeElements,y,null),ce(y))return U(y),!0;const Z=Oe(y.nodeName);if(fe(z.uponSanitizeElement,y,{tagName:Z,allowedTags:M}),de&&y.hasChildNodes()&&!me(y.firstElementChild)&&it(/<[/\w!]/g,y.innerHTML)&&it(/<[/\w!]/g,y.textContent)||y.nodeType===kr.progressingInstruction||de&&y.nodeType===kr.comment&&it(/<[/\w]/g,y.data))return U(y),!0;if(!M[Z]||W[Z]){if(!W[Z]&&ne(Z)&&(O.tagNameCheck instanceof RegExp&&it(O.tagNameCheck,Z)||O.tagNameCheck instanceof Function&&O.tagNameCheck(Z)))return!1;if(tt&&!le[Z]){const Ce=S(y)||y.parentNode,Ne=w(y)||y.childNodes;if(Ne&&Ce){const pe=Ne.length;for(let he=pe-1;he>=0;--he){const Re=h(Ne[he],!0);Re.__removalCount=(y.__removalCount||0)+1,Ce.insertBefore(Re,b(y))}}}return U(y),!0}return y instanceof c&&!Se(y)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&it(/<\/no(script|embed|frames)/i,y.innerHTML)?(U(y),!0):(ie&&y.nodeType===kr.text&&(R=y.textContent,co([q,Q,P],Ce=>{R=Tr(R,Ce," ")}),y.textContent!==R&&(Er(t.removed,{element:y.cloneNode()}),y.textContent=R)),fe(z.afterSanitizeElements,y,null),!1)},_e=function(y,R,Z){if(yt&&(R==="id"||R==="name")&&(Z in n||Z in an))return!1;if(!(ee&&!I[R]&&it(Y,R))){if(!(K&&it(A,R))){if(!L[R]||I[R]){if(!(ne(y)&&(O.tagNameCheck instanceof RegExp&&it(O.tagNameCheck,y)||O.tagNameCheck instanceof Function&&O.tagNameCheck(y))&&(O.attributeNameCheck instanceof RegExp&&it(O.attributeNameCheck,R)||O.attributeNameCheck instanceof Function&&O.attributeNameCheck(R))||R==="is"&&O.allowCustomizedBuiltInElements&&(O.tagNameCheck instanceof RegExp&&it(O.tagNameCheck,Z)||O.tagNameCheck instanceof Function&&O.tagNameCheck(Z))))return!1}else if(!Mt[R]){if(!it(D,Tr(Z,C,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&y!=="script"&&$b(Z,"data:")===0&&ht[y])){if(!(te&&!it(B,Tr(Z,C,"")))){if(Z)return!1}}}}}}return!0},ne=function(y){return y!=="annotation-xml"&&ml(y,_)},xe=function(y){fe(z.beforeSanitizeAttributes,y,null);const{attributes:R}=y;if(!R||ce(y))return;const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let Ce=R.length;for(;Ce--;){const Ne=R[Ce],{name:pe,namespaceURI:he,value:Re}=Ne,Nt=Oe(pe),xn=Re;let Fe=pe==="value"?xn:Bb(xn);if(Z.attrName=Nt,Z.attrValue=Fe,Z.keepAttr=!0,Z.forceKeepAttr=void 0,fe(z.uponSanitizeAttribute,y,Z),Fe=Z.attrValue,We&&(Nt==="id"||Nt==="name")&&(G(pe,y),Fe=St+Fe),de&&it(/((--!?|])>)|<\/(style|title)/i,Fe)){G(pe,y);continue}if(Z.forceKeepAttr)continue;if(!Z.keepAttr){G(pe,y);continue}if(!ae&&it(/\/>/i,Fe)){G(pe,y);continue}ie&&co([q,Q,P],yr=>{Fe=Tr(Fe,yr," ")});const ds=Oe(y.nodeName);if(!_e(ds,Nt,Fe)){G(pe,y);continue}if(E&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!he)switch(g.getAttributeType(ds,Nt)){case"TrustedHTML":{Fe=E.createHTML(Fe);break}case"TrustedScriptURL":{Fe=E.createScriptURL(Fe);break}}if(Fe!==xn)try{he?y.setAttributeNS(he,pe,Fe):y.setAttribute(pe,Fe),ce(y)?U(y):pl(t.removed)}catch{G(pe,y)}}fe(z.afterSanitizeAttributes,y,null)},Le=function X(y){let R=null;const Z=re(y);for(fe(z.beforeSanitizeShadowDOM,y,null);R=Z.nextNode();)fe(z.uponSanitizeShadowNode,R,null),ge(R),xe(R),R.content instanceof s&&X(R.content);fe(z.afterSanitizeShadowDOM,y,null)};return t.sanitize=function(X){let y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,Z=null,Ce=null,Ne=null;if(Pt=!X,Pt&&(X="<!-->"),typeof X!="string"&&!me(X))if(typeof X.toString=="function"){if(X=X.toString(),typeof X!="string")throw Ar("dirty is not a string, aborting")}else throw Ar("toString is not a function");if(!t.isSupported)return X;if(Ie||At(y),t.removed=[],typeof X=="string"&&(nt=!1),nt){if(X.nodeName){const Re=Oe(X.nodeName);if(!M[Re]||W[Re])throw Ar("root node is forbidden and cannot be sanitized in-place")}}else if(X instanceof l)R=$("<!---->"),Z=R.ownerDocument.importNode(X,!0),Z.nodeType===kr.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?R=Z:R.appendChild(Z);else{if(!Pe&&!ie&&!ye&&X.indexOf("<")===-1)return E&&Be?E.createHTML(X):X;if(R=$(X),!R)return Pe?null:Be?N:""}R&&je&&U(R.firstChild);const pe=re(nt?X:R);for(;Ce=pe.nextNode();)ge(Ce),xe(Ce),Ce.content instanceof s&&Le(Ce.content);if(nt)return X;if(Pe){if(Me)for(Ne=T.call(R.ownerDocument);R.firstChild;)Ne.appendChild(R.firstChild);else Ne=R;return(L.shadowroot||L.shadowrootmode)&&(Ne=F.call(r,Ne,!0)),Ne}let he=ye?R.outerHTML:R.innerHTML;return ye&&M["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&it(Rf,R.ownerDocument.doctype.name)&&(he="<!DOCTYPE "+R.ownerDocument.doctype.name+`>
124
- `+he),ie&&co([q,Q,P],Re=>{he=Tr(he,Re," ")}),E&&Be?E.createHTML(he):he},t.setConfig=function(){let X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(X),Ie=!0},t.clearConfig=function(){pt=null,Ie=!1},t.isValidAttribute=function(X,y,R){pt||At({});const Z=Oe(X),Ce=Oe(y);return _e(Z,Ce,R)},t.addHook=function(X,y){typeof y=="function"&&Er(z[X],y)},t.removeHook=function(X,y){if(y!==void 0){const R=Fb(z[X],y);return R===-1?void 0:zb(z[X],R,1)[0]}return pl(z[X])},t.removeHooks=function(X){z[X]=[]},t.removeAllHooks=function(){z=bl()},t}var Pf=Mf();const ny=({content:e,setRenderError:t})=>{const[n,r]=u.useState(""),o=u.useMemo(()=>Pf.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return u.useEffect(()=>{r(`<!DOCTYPE html>
125
- <html>
126
- <head>
127
- <meta charset="utf-8">
128
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
129
- <title>Mermaid Preview</title>
130
- <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"><\/script>
131
- <script src="https://cdn.jsdelivr.net/npm/panzoom@9.4.0/dist/panzoom.min.js"><\/script>
132
- <script>
133
- document.addEventListener('DOMContentLoaded', function() {
134
- try {
135
- mermaid.initialize({
136
- startOnLoad: true,
137
- theme: 'default',
138
- fontFamily: 'arial, sans-serif',
139
- logLevel: 'error',
140
- securityLevel: 'strict'
141
- });
142
-
143
- // Initialize panzoom after Mermaid rendering
144
- mermaid.run().then(() => {
145
- const diagramContainer = document.getElementById('diagram-container');
146
- if (diagramContainer) {
147
- const pz = panzoom(diagramContainer, {
148
- maxZoom: 10,
149
- minZoom: 0.1,
150
- smoothScroll: true,
151
- bounds: true,
152
- boundsPadding: 0.1
153
- });
154
- // Add zoom controls (old version had only reset)
155
- const resetButton = document.getElementById('reset');
156
- if (resetButton) {
157
- resetButton.addEventListener('click', () => {
158
- pz.moveTo(0, 0);
159
- pz.zoomAbs(0, 0, 1);
160
- });
161
- }
162
- }
163
- }).catch(err => {
164
- console.error("Mermaid rendering failed inside iframe:", err);
165
- const mermaidDiv = document.querySelector('.mermaid');
166
- if (mermaidDiv) mermaidDiv.innerText = "Error rendering diagram: " + err.message;
167
- });
168
-
169
- window.addEventListener('message', function(event) {
170
- if (event.data && event.data.action === 'getMermaidSvg') {
171
- const svgElement = document.querySelector('.mermaid svg');
172
- if (svgElement) {
173
- if (!svgElement.getAttribute('xmlns')) { // Ensure xmlns for standalone SVG
174
- svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
175
- }
176
- const svgData = new XMLSerializer().serializeToString(svgElement);
177
- window.parent.postMessage({
178
- action: 'downloadSvg',
179
- svgData: svgData,
180
- filename: event.data.filename || 'mermaid-diagram.svg'
181
- }, '*');
182
- } else {
183
- console.error('SVG element not found for download inside iframe.');
184
- }
185
- }
186
- });
187
- } catch (e) {
188
- console.error("Error initializing Mermaid or Panzoom inside iframe:", e);
189
- const mermaidDiv = document.querySelector('.mermaid');
190
- if (mermaidDiv) mermaidDiv.innerText = "Failed to initialize diagram viewer: " + e.message;
191
- }
192
- });
193
- <\/script>
194
- <style>
195
- /* Styles from old code */
196
- html, body {
197
- height: 100%;
198
- margin: 0;
199
- padding: 0;
200
- overflow: hidden;
201
- font-family: Arial, sans-serif; /* Old font */
202
- }
203
- .container {
204
- display: flex;
205
- flex-direction: column;
206
- height: 100vh;
207
- overflow: hidden;
208
- }
209
- .diagram-wrapper {
210
- flex: 1;
211
- overflow: hidden;
212
- position: relative;
213
- display: flex;
214
- justify-content: center;
215
- align-items: center;
216
- background-color: #f9f9f9;
217
- }
218
- #diagram-container {
219
- transform-origin: 0 0;
220
- cursor: grab;
221
- box-shadow: 0 0 10px rgba(0,0,0,0.1);
222
- background-color: white;
223
- padding: 20px;
224
- border-radius: 5px;
225
- /* Ensure diagram container can hold the content */
226
- width: auto; /* Adjust as needed, or let content define it */
227
- height: auto;
228
- max-width: 100%;
229
- max-height: 100%;
230
- }
231
- #diagram-container:active {
232
- cursor: grabbing;
233
- }
234
- .mermaid {
235
- display: flex; /* Helps in centering if SVG is smaller */
236
- justify-content: center;
237
- align-items: center;
238
- /* width: 100%; Ensures mermaid div takes space, SVG might scale within it */
239
- /* height: 100%; */
240
- }
241
- .mermaid svg {
242
- max-width: 100%; /* Ensure SVG scales down if too large */
243
- max-height: 100%;
244
- }
245
- .controls{
246
- position: fixed;
247
- bottom: 20px;
248
- right: 20px;
249
- z-index: 1000;
250
- display: flex;
251
- gap: 5px;
252
- }
253
- .control-btn {
254
- width: 40px;
255
- height: 40px;
256
- border-radius: 50%;
257
- border: none;
258
- background-color: white;
259
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
260
- cursor: pointer;
261
- font-size: 18px;
262
- display: flex;
263
- align-items: center;
264
- justify-content: center;
265
- }
266
- .control-btn:hover {
267
- background-color: #f0f0f0;
268
- }
269
- .instructions {
270
- position: fixed;
271
- top: 10px;
272
- left: 10px;
273
- background-color: rgba(255,255,255,0.8);
274
- padding: 5px 10px;
275
- border-radius: 4px;
276
- font-size: 12px;
277
- color: #666;
278
- }
279
- </style>
280
- </head>
281
- <body>
282
- <div class="container">
283
- <div class="diagram-wrapper">
284
- <div id="diagram-container">
285
- <div class="mermaid">
286
- ${o}
287
- </div>
288
- </div>
289
- </div>
290
- <div class="instructions">
291
- Drag to pan and scroll to zoom
292
- </div>
293
- <div class="controls">
294
- <button id="reset" class="control-btn" title="Reset View">↺</button>
295
- </div>
296
- </div>
297
- </body>
298
- </html>`)},[o]),a.jsx("div",{className:"bg-background h-full p-4",children:a.jsx("iframe",{srcDoc:n,title:"Mermaid Diagram Preview",sandbox:"allow-scripts allow-same-origin allow-downloads",className:"h-96 w-full resize 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 Lf(e){return typeof e>"u"||e===null}function ry(e){return typeof e=="object"&&e!==null}function oy(e){return Array.isArray(e)?e:Lf(e)?[]:[e]}function sy(e,t){var n,r,o,s;if(t)for(s=Object.keys(t),n=0,r=s.length;n<r;n+=1)o=s[n],e[o]=t[o];return e}function iy(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function ay(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var ly=Lf,cy=ry,uy=oy,dy=iy,fy=ay,py=sy,Ke={isNothing:ly,isObject:cy,toArray:uy,repeat:dy,isNegativeZero:fy,extend:py};function Df(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+=`
299
-
300
- `+e.mark.snippet),r+" "+n):r}function $r(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Df(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}$r.prototype=Object.create(Error.prototype);$r.prototype.constructor=$r;$r.prototype.toString=function(t){return this.name+": "+Df(this,t)};var lt=$r;function Ds(e,t,n,r,o){var s="",i="",l=Math.floor(o/2)-1;return r-t>l&&(s=" ... ",t=r-l+s.length),n-r>l&&(i=" ...",n=r+l-i.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+i,pos:r-t+s.length}}function Os(e,t){return Ke.repeat(" ",t-e.length)+e}function my(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=[],s,i=-1;s=n.exec(e.buffer);)o.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&i<0&&(i=r.length-2);i<0&&(i=r.length-1);var l="",c,d,f=Math.min(e.line+t.linesAfter,o.length).toString().length,p=t.maxLength-(t.indent+f+3);for(c=1;c<=t.linesBefore&&!(i-c<0);c++)d=Ds(e.buffer,r[i-c],o[i-c],e.position-(r[i]-r[i-c]),p),l=Ke.repeat(" ",t.indent)+Os((e.line-c+1).toString(),f)+" | "+d.str+`
301
- `+l;for(d=Ds(e.buffer,r[i],o[i],e.position,p),l+=Ke.repeat(" ",t.indent)+Os((e.line+1).toString(),f)+" | "+d.str+`
302
- `,l+=Ke.repeat("-",t.indent+f+3+d.pos)+`^
303
- `,c=1;c<=t.linesAfter&&!(i+c>=o.length);c++)d=Ds(e.buffer,r[i+c],o[i+c],e.position-(r[i]-r[i+c]),p),l+=Ke.repeat(" ",t.indent)+Os((e.line+c+1).toString(),f)+" | "+d.str+`
304
- `;return l.replace(/\n$/,"")}var hy=my,gy=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],xy=["scalar","sequence","mapping"];function vy(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function wy(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(gy.indexOf(n)===-1)throw new lt('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=vy(t.styleAliases||null),xy.indexOf(this.kind)===-1)throw new lt('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var et=wy;function yl(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(s,i){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(o=i)}),n[o]=r}),n}function by(){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 ii(e){return this.extend(e)}ii.prototype.extend=function(t){var n=[],r=[];if(t instanceof et)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 lt("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof et))throw new lt("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new lt("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new lt("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof et))throw new lt("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(ii.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=yl(o,"implicit"),o.compiledExplicit=yl(o,"explicit"),o.compiledTypeMap=by(o.compiledImplicit,o.compiledExplicit),o};var Of=ii,Ff=new et("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),zf=new et("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),$f=new et("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Bf=new Of({explicit:[Ff,zf,$f]});function yy(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Sy(){return null}function Cy(e){return e===null}var Uf=new et("tag:yaml.org,2002:null",{kind:"scalar",resolve:yy,construct:Sy,predicate:Cy,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ey(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 Ty(e){return e==="true"||e==="True"||e==="TRUE"}function Ay(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Hf=new et("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ey,construct:Ty,predicate:Ay,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 Ny(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function ky(e){return 48<=e&&e<=55}function _y(e){return 48<=e&&e<=57}function Iy(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(!Ny(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!ky(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!_y(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function jy(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 Ry(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Ke.isNegativeZero(e)}var Wf=new et("tag:yaml.org,2002:int",{kind:"scalar",resolve:Iy,construct:jy,predicate:Ry,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"]}}),My=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Py(e){return!(e===null||!My.test(e)||e[e.length-1]==="_")}function Ly(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 Dy=/^[-+]?[0-9]+e/;function Oy(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(Ke.isNegativeZero(e))return"-0.0";return n=e.toString(10),Dy.test(n)?n.replace("e",".e"):n}function Fy(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Ke.isNegativeZero(e))}var Gf=new et("tag:yaml.org,2002:float",{kind:"scalar",resolve:Py,construct:Ly,predicate:Fy,represent:Oy,defaultStyle:"lowercase"}),Vf=Bf.extend({implicit:[Uf,Hf,Wf,Gf]}),Yf=Vf,Kf=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),qf=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 zy(e){return e===null?!1:Kf.exec(e)!==null||qf.exec(e)!==null}function $y(e){var t,n,r,o,s,i,l,c=0,d=null,f,p,m;if(t=Kf.exec(e),t===null&&(t=qf.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(s=+t[4],i=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],p=+(t[11]||0),d=(f*60+p)*6e4,t[9]==="-"&&(d=-d)),m=new Date(Date.UTC(n,r,o,s,i,l,c)),d&&m.setTime(m.getTime()-d),m}function By(e){return e.toISOString()}var Xf=new et("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:zy,construct:$y,instanceOf:Date,represent:By});function Uy(e){return e==="<<"||e===null}var Zf=new et("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Uy}),na=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
305
- \r`;function Hy(e){if(e===null)return!1;var t,n,r=0,o=e.length,s=na;for(n=0;n<o;n++)if(t=s.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function Wy(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,s=na,i=0,l=[];for(t=0;t<o;t++)t%4===0&&t&&(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)),i=i<<6|s.indexOf(r.charAt(t));return n=o%4*6,n===0?(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)):n===18?(l.push(i>>10&255),l.push(i>>2&255)):n===12&&l.push(i>>4&255),new Uint8Array(l)}function Gy(e){var t="",n=0,r,o,s=e.length,i=na;for(r=0;r<s;r++)r%3===0&&r&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[r];return o=s%3,o===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):o===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):o===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function Vy(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Jf=new et("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Hy,construct:Wy,predicate:Vy,represent:Gy}),Yy=Object.prototype.hasOwnProperty,Ky=Object.prototype.toString;function qy(e){if(e===null)return!0;var t=[],n,r,o,s,i,l=e;for(n=0,r=l.length;n<r;n+=1){if(o=l[n],i=!1,Ky.call(o)!=="[object Object]")return!1;for(s in o)if(Yy.call(o,s))if(!i)i=!0;else return!1;if(!i)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function Xy(e){return e!==null?e:[]}var Qf=new et("tag:yaml.org,2002:omap",{kind:"sequence",resolve:qy,construct:Xy}),Zy=Object.prototype.toString;function Jy(e){if(e===null)return!0;var t,n,r,o,s,i=e;for(s=new Array(i.length),t=0,n=i.length;t<n;t+=1){if(r=i[t],Zy.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;s[t]=[o[0],r[o[0]]]}return!0}function Qy(e){if(e===null)return[];var t,n,r,o,s,i=e;for(s=new Array(i.length),t=0,n=i.length;t<n;t+=1)r=i[t],o=Object.keys(r),s[t]=[o[0],r[o[0]]];return s}var ep=new et("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Jy,construct:Qy}),eS=Object.prototype.hasOwnProperty;function tS(e){if(e===null)return!0;var t,n=e;for(t in n)if(eS.call(n,t)&&n[t]!==null)return!1;return!0}function nS(e){return e!==null?e:{}}var tp=new et("tag:yaml.org,2002:set",{kind:"mapping",resolve:tS,construct:nS}),ra=Yf.extend({implicit:[Xf,Zf],explicit:[Jf,Qf,ep,tp]}),An=Object.prototype.hasOwnProperty,Io=1,np=2,rp=3,jo=4,Fs=1,rS=2,Sl=3,oS=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,sS=/[\x85\u2028\u2029]/,iS=/[,\[\]\{\}]/,op=/^(?:!|!!|![a-z\-]+!)$/i,sp=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function Cl(e){return Object.prototype.toString.call(e)}function tn(e){return e===10||e===13}function Ln(e){return e===9||e===32}function mt(e){return e===9||e===32||e===10||e===13}function tr(e){return e===44||e===91||e===93||e===123||e===125}function aS(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function lS(e){return e===120?2:e===117?4:e===85?8:0}function cS(e){return 48<=e&&e<=57?e-48:-1}function El(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
306
- `: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 uS(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var ip=new Array(256),ap=new Array(256);for(var Zn=0;Zn<256;Zn++)ip[Zn]=El(Zn)?1:0,ap[Zn]=El(Zn);function dS(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||ra,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 lp(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=hy(n),new lt(t,n)}function ue(e,t){throw lp(e,t)}function Ro(e,t){e.onWarning&&e.onWarning.call(null,lp(e,t))}var Tl={YAML:function(t,n,r){var o,s,i;t.version!==null&&ue(t,"duplication of %YAML directive"),r.length!==1&&ue(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&ue(t,"ill-formed argument of the YAML directive"),s=parseInt(o[1],10),i=parseInt(o[2],10),s!==1&&ue(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,i!==1&&i!==2&&Ro(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,s;r.length!==2&&ue(t,"TAG directive accepts exactly two arguments"),o=r[0],s=r[1],op.test(o)||ue(t,"ill-formed tag handle (first argument) of the TAG directive"),An.call(t.tagMap,o)&&ue(t,'there is a previously declared suffix for "'+o+'" tag handle'),sp.test(s)||ue(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ue(t,"tag prefix is malformed: "+s)}t.tagMap[o]=s}};function Sn(e,t,n,r){var o,s,i,l;if(t<n){if(l=e.input.slice(t,n),r)for(o=0,s=l.length;o<s;o+=1)i=l.charCodeAt(o),i===9||32<=i&&i<=1114111||ue(e,"expected valid JSON character");else oS.test(l)&&ue(e,"the stream contains non-printable characters");e.result+=l}}function Al(e,t,n,r){var o,s,i,l;for(Ke.isObject(n)||ue(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),i=0,l=o.length;i<l;i+=1)s=o[i],An.call(t,s)||(t[s]=n[s],r[s]=!0)}function nr(e,t,n,r,o,s,i,l,c){var d,f;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),d=0,f=o.length;d<f;d+=1)Array.isArray(o[d])&&ue(e,"nested arrays are not supported inside keys"),typeof o=="object"&&Cl(o[d])==="[object Object]"&&(o[d]="[object Object]");if(typeof o=="object"&&Cl(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(d=0,f=s.length;d<f;d+=1)Al(e,t,s[d],n);else Al(e,t,s,n);else!e.json&&!An.call(n,o)&&An.call(t,o)&&(e.line=i||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,ue(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:s}):t[o]=s,delete n[o];return t}function oa(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++):ue(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Ve(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Ln(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(tn(o))for(oa(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&&Ro(e,"deficient indentation"),r}function cs(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||mt(n)))}function sa(e,t){t===1?e.result+=" ":t>1&&(e.result+=Ke.repeat(`
307
- `,t-1))}function fS(e,t,n){var r,o,s,i,l,c,d,f,p=e.kind,m=e.result,g;if(g=e.input.charCodeAt(e.position),mt(g)||tr(g)||g===35||g===38||g===42||g===33||g===124||g===62||g===39||g===34||g===37||g===64||g===96||(g===63||g===45)&&(o=e.input.charCodeAt(e.position+1),mt(o)||n&&tr(o)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,l=!1;g!==0;){if(g===58){if(o=e.input.charCodeAt(e.position+1),mt(o)||n&&tr(o))break}else if(g===35){if(r=e.input.charCodeAt(e.position-1),mt(r))break}else{if(e.position===e.lineStart&&cs(e)||n&&tr(g))break;if(tn(g))if(c=e.line,d=e.lineStart,f=e.lineIndent,Ve(e,!1,-1),e.lineIndent>=t){l=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=i,e.line=c,e.lineStart=d,e.lineIndent=f;break}}l&&(Sn(e,s,i,!1),sa(e,e.line-c),s=i=e.position,l=!1),Ln(g)||(i=e.position+1),g=e.input.charCodeAt(++e.position)}return Sn(e,s,i,!1),e.result?!0:(e.kind=p,e.result=m,!1)}function pS(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(Sn(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 tn(n)?(Sn(e,r,o,!0),sa(e,Ve(e,!1,t)),r=o=e.position):e.position===e.lineStart&&cs(e)?ue(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);ue(e,"unexpected end of the stream within a single quoted scalar")}function mS(e,t){var n,r,o,s,i,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return Sn(e,n,e.position,!0),e.position++,!0;if(l===92){if(Sn(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),tn(l))Ve(e,!1,t);else if(l<256&&ip[l])e.result+=ap[l],e.position++;else if((i=lS(l))>0){for(o=i,s=0;o>0;o--)l=e.input.charCodeAt(++e.position),(i=aS(l))>=0?s=(s<<4)+i:ue(e,"expected hexadecimal character");e.result+=uS(s),e.position++}else ue(e,"unknown escape sequence");n=r=e.position}else tn(l)?(Sn(e,n,r,!0),sa(e,Ve(e,!1,t)),n=r=e.position):e.position===e.lineStart&&cs(e)?ue(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}ue(e,"unexpected end of the stream within a double quoted scalar")}function hS(e,t){var n=!0,r,o,s,i=e.tag,l,c=e.anchor,d,f,p,m,g,x=Object.create(null),h,v,b,w;if(w=e.input.charCodeAt(e.position),w===91)f=93,g=!1,l=[];else if(w===123)f=125,g=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),w=e.input.charCodeAt(++e.position);w!==0;){if(Ve(e,!0,t),w=e.input.charCodeAt(e.position),w===f)return e.position++,e.tag=i,e.anchor=c,e.kind=g?"mapping":"sequence",e.result=l,!0;n?w===44&&ue(e,"expected the node content, but found ','"):ue(e,"missed comma between flow collection entries"),v=h=b=null,p=m=!1,w===63&&(d=e.input.charCodeAt(e.position+1),mt(d)&&(p=m=!0,e.position++,Ve(e,!0,t))),r=e.line,o=e.lineStart,s=e.position,dr(e,t,Io,!1,!0),v=e.tag,h=e.result,Ve(e,!0,t),w=e.input.charCodeAt(e.position),(m||e.line===r)&&w===58&&(p=!0,w=e.input.charCodeAt(++e.position),Ve(e,!0,t),dr(e,t,Io,!1,!0),b=e.result),g?nr(e,l,x,v,h,b,r,o,s):p?l.push(nr(e,null,x,v,h,b,r,o,s)):l.push(h),Ve(e,!0,t),w=e.input.charCodeAt(e.position),w===44?(n=!0,w=e.input.charCodeAt(++e.position)):n=!1}ue(e,"unexpected end of the stream within a flow collection")}function gS(e,t){var n,r,o=Fs,s=!1,i=!1,l=t,c=0,d=!1,f,p;if(p=e.input.charCodeAt(e.position),p===124)r=!1;else if(p===62)r=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)Fs===o?o=p===43?Sl:rS:ue(e,"repeat of a chomping mode identifier");else if((f=cS(p))>=0)f===0?ue(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):i?ue(e,"repeat of an indentation width identifier"):(l=t+f-1,i=!0);else break;if(Ln(p)){do p=e.input.charCodeAt(++e.position);while(Ln(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!tn(p)&&p!==0)}for(;p!==0;){for(oa(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!i||e.lineIndent<l)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!i&&e.lineIndent>l&&(l=e.lineIndent),tn(p)){c++;continue}if(e.lineIndent<l){o===Sl?e.result+=Ke.repeat(`
308
- `,s?1+c:c):o===Fs&&s&&(e.result+=`
309
- `);break}for(r?Ln(p)?(d=!0,e.result+=Ke.repeat(`
310
- `,s?1+c:c)):d?(d=!1,e.result+=Ke.repeat(`
311
- `,c+1)):c===0?s&&(e.result+=" "):e.result+=Ke.repeat(`
312
- `,c):e.result+=Ke.repeat(`
313
- `,s?1+c:c),s=!0,i=!0,c=0,n=e.position;!tn(p)&&p!==0;)p=e.input.charCodeAt(++e.position);Sn(e,n,e.position,!1)}return!0}function Nl(e,t){var n,r=e.tag,o=e.anchor,s=[],i,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ue(e,"tab characters must not be used in indentation")),!(c!==45||(i=e.input.charCodeAt(e.position+1),!mt(i))));){if(l=!0,e.position++,Ve(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,dr(e,t,rp,!1,!0),s.push(e.result),Ve(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)ue(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=s,!0):!1}function xS(e,t,n){var r,o,s,i,l,c,d=e.tag,f=e.anchor,p={},m=Object.create(null),g=null,x=null,h=null,v=!1,b=!1,w;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),w=e.input.charCodeAt(e.position);w!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ue(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(w===63||w===58)&&mt(r))w===63?(v&&(nr(e,p,m,g,x,null,i,l,c),g=x=h=null),b=!0,v=!0,o=!0):v?(v=!1,o=!0):ue(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,w=r;else{if(i=e.line,l=e.lineStart,c=e.position,!dr(e,n,np,!1,!0))break;if(e.line===s){for(w=e.input.charCodeAt(e.position);Ln(w);)w=e.input.charCodeAt(++e.position);if(w===58)w=e.input.charCodeAt(++e.position),mt(w)||ue(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(nr(e,p,m,g,x,null,i,l,c),g=x=h=null),b=!0,v=!1,o=!1,g=e.tag,x=e.result;else if(b)ue(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(b)ue(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=f,!0}if((e.line===s||e.lineIndent>t)&&(v&&(i=e.line,l=e.lineStart,c=e.position),dr(e,t,jo,!0,o)&&(v?x=e.result:h=e.result),v||(nr(e,p,m,g,x,h,i,l,c),g=x=h=null),Ve(e,!0,-1),w=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&w!==0)ue(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&nr(e,p,m,g,x,null,i,l,c),b&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=p),b}function vS(e){var t,n=!1,r=!1,o,s,i;if(i=e.input.charCodeAt(e.position),i!==33)return!1;if(e.tag!==null&&ue(e,"duplication of a tag property"),i=e.input.charCodeAt(++e.position),i===60?(n=!0,i=e.input.charCodeAt(++e.position)):i===33?(r=!0,o="!!",i=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do i=e.input.charCodeAt(++e.position);while(i!==0&&i!==62);e.position<e.length?(s=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):ue(e,"unexpected end of the stream within a verbatim tag")}else{for(;i!==0&&!mt(i);)i===33&&(r?ue(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),op.test(o)||ue(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),iS.test(s)&&ue(e,"tag suffix cannot contain flow indicator characters")}s&&!sp.test(s)&&ue(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ue(e,"tag name is malformed: "+s)}return n?e.tag=s:An.call(e.tagMap,o)?e.tag=e.tagMap[o]+s:o==="!"?e.tag="!"+s:o==="!!"?e.tag="tag:yaml.org,2002:"+s:ue(e,'undeclared tag handle "'+o+'"'),!0}function wS(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&ue(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!mt(n)&&!tr(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&ue(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function bS(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&&!mt(r)&&!tr(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ue(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),An.call(e.anchorMap,n)||ue(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Ve(e,!0,-1),!0}function dr(e,t,n,r,o){var s,i,l,c=1,d=!1,f=!1,p,m,g,x,h,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=i=l=jo===n||rp===n,r&&Ve(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;vS(e)||wS(e);)Ve(e,!0,-1)?(d=!0,l=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||o),(c===1||jo===n)&&(Io===n||np===n?h=t:h=t+1,v=e.position-e.lineStart,c===1?l&&(Nl(e,v)||xS(e,v,h))||hS(e,h)?f=!0:(i&&gS(e,h)||pS(e,h)||mS(e,h)?f=!0:bS(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&ue(e,"alias node should not have any properties")):fS(e,h,Io===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&Nl(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ue(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,m=e.implicitTypes.length;p<m;p+=1)if(x=e.implicitTypes[p],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(An.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,g=e.typeMap.multi[e.kind||"fallback"],p=0,m=g.length;p<m;p+=1)if(e.tag.slice(0,g[p].tag.length)===g[p].tag){x=g[p];break}x||ue(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&ue(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)):ue(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function yS(e){var t=e.position,n,r,o,s=!1,i;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(i=e.input.charCodeAt(e.position))!==0&&(Ve(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||i!==37));){for(s=!0,i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!mt(i);)i=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&ue(e,"directive name must not be less than one character in length");i!==0;){for(;Ln(i);)i=e.input.charCodeAt(++e.position);if(i===35){do i=e.input.charCodeAt(++e.position);while(i!==0&&!tn(i));break}if(tn(i))break;for(n=e.position;i!==0&&!mt(i);)i=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}i!==0&&oa(e),An.call(Tl,r)?Tl[r](e,r,o):Ro(e,'unknown document directive "'+r+'"')}if(Ve(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,Ve(e,!0,-1)):s&&ue(e,"directives end mark is expected"),dr(e,e.lineIndent-1,jo,!1,!0),Ve(e,!0,-1),e.checkLineBreaks&&sS.test(e.input.slice(t,e.position))&&Ro(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&cs(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Ve(e,!0,-1));return}if(e.position<e.length-1)ue(e,"end of the stream or a document separator is expected");else return}function cp(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
314
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new dS(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ue(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;)yS(n);return n.documents}function SS(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=cp(e,n);if(typeof t!="function")return r;for(var o=0,s=r.length;o<s;o+=1)t(r[o])}function CS(e,t){var n=cp(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new lt("expected a single document in the stream, but found more")}}var ES=SS,TS=CS,up={loadAll:ES,load:TS},dp=Object.prototype.toString,fp=Object.prototype.hasOwnProperty,ia=65279,AS=9,Br=10,NS=13,kS=32,_S=33,IS=34,ai=35,jS=37,RS=38,MS=39,PS=42,pp=44,LS=45,Mo=58,DS=61,OS=62,FS=63,zS=64,mp=91,hp=93,$S=96,gp=123,BS=124,xp=125,st={};st[0]="\\0";st[7]="\\a";st[8]="\\b";st[9]="\\t";st[10]="\\n";st[11]="\\v";st[12]="\\f";st[13]="\\r";st[27]="\\e";st[34]='\\"';st[92]="\\\\";st[133]="\\N";st[160]="\\_";st[8232]="\\L";st[8233]="\\P";var US=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],HS=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function WS(e,t){var n,r,o,s,i,l,c;if(t===null)return{};for(n={},r=Object.keys(t),o=0,s=r.length;o<s;o+=1)i=r[o],l=String(t[i]),i.slice(0,2)==="!!"&&(i="tag:yaml.org,2002:"+i.slice(2)),c=e.compiledTypeMap.fallback[i],c&&fp.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[i]=l;return n}function GS(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 lt("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Ke.repeat("0",r-t.length)+t}var VS=1,Ur=2;function YS(e){this.schema=e.schema||ra,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Ke.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=WS(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==='"'?Ur:VS,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 kl(e,t){for(var n=Ke.repeat(" ",t),r=0,o=-1,s="",i,l=e.length;r<l;)o=e.indexOf(`
315
- `,r),o===-1?(i=e.slice(r),r=l):(i=e.slice(r,o+1),r=o+1),i.length&&i!==`
316
- `&&(s+=n),s+=i;return s}function li(e,t){return`
317
- `+Ke.repeat(" ",e.indent*t)}function KS(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 Po(e){return e===kS||e===AS}function Hr(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ia||65536<=e&&e<=1114111}function _l(e){return Hr(e)&&e!==ia&&e!==NS&&e!==Br}function Il(e,t,n){var r=_l(e),o=r&&!Po(e);return(n?r:r&&e!==pp&&e!==mp&&e!==hp&&e!==gp&&e!==xp)&&e!==ai&&!(t===Mo&&!o)||_l(t)&&!Po(t)&&e===ai||t===Mo&&o}function qS(e){return Hr(e)&&e!==ia&&!Po(e)&&e!==LS&&e!==FS&&e!==Mo&&e!==pp&&e!==mp&&e!==hp&&e!==gp&&e!==xp&&e!==ai&&e!==RS&&e!==PS&&e!==_S&&e!==BS&&e!==DS&&e!==OS&&e!==MS&&e!==IS&&e!==jS&&e!==zS&&e!==$S}function XS(e){return!Po(e)&&e!==Mo}function Pr(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 vp(e){var t=/^\n* /;return t.test(e)}var wp=1,ci=2,bp=3,yp=4,Qn=5;function ZS(e,t,n,r,o,s,i,l){var c,d=0,f=null,p=!1,m=!1,g=r!==-1,x=-1,h=qS(Pr(e,0))&&XS(Pr(e,e.length-1));if(t||i)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Pr(e,c),!Hr(d))return Qn;h=h&&Il(d,f,l),f=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Pr(e,c),d===Br)p=!0,g&&(m=m||c-x-1>r&&e[x+1]!==" ",x=c);else if(!Hr(d))return Qn;h=h&&Il(d,f,l),f=d}m=m||g&&c-x-1>r&&e[x+1]!==" "}return!p&&!m?h&&!i&&!o(e)?wp:s===Ur?Qn:ci:n>9&&vp(e)?Qn:i?s===Ur?Qn:ci:m?yp:bp}function JS(e,t,n,r,o){e.dump=(function(){if(t.length===0)return e.quotingType===Ur?'""':"''";if(!e.noCompatMode&&(US.indexOf(t)!==-1||HS.test(t)))return e.quotingType===Ur?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,n),i=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return KS(e,d)}switch(ZS(t,l,e.indent,i,c,e.quotingType,e.forceQuotes&&!r,o)){case wp:return t;case ci:return"'"+t.replace(/'/g,"''")+"'";case bp:return"|"+jl(t,e.indent)+Rl(kl(t,s));case yp:return">"+jl(t,e.indent)+Rl(kl(QS(t,i),s));case Qn:return'"'+eC(t)+'"';default:throw new lt("impossible error: invalid scalar style")}})()}function jl(e,t){var n=vp(e)?String(t):"",r=e[e.length-1]===`
318
- `,o=r&&(e[e.length-2]===`
319
- `||e===`
320
- `),s=o?"+":r?"":"-";return n+s+`
321
- `}function Rl(e){return e[e.length-1]===`
322
- `?e.slice(0,-1):e}function QS(e,t){for(var n=/(\n+)([^\n]*)/g,r=(function(){var d=e.indexOf(`
323
- `);return d=d!==-1?d:e.length,n.lastIndex=d,Ml(e.slice(0,d),t)})(),o=e[0]===`
324
- `||e[0]===" ",s,i;i=n.exec(e);){var l=i[1],c=i[2];s=c[0]===" ",r+=l+(!o&&!s&&c!==""?`
325
- `:"")+Ml(c,t),o=s}return r}function Ml(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,s,i=0,l=0,c="";r=n.exec(e);)l=r.index,l-o>t&&(s=i>o?i:l,c+=`
326
- `+e.slice(o,s),o=s+1),i=l;return c+=`
327
- `,e.length-o>t&&i>o?c+=e.slice(o,i)+`
328
- `+e.slice(i+1):c+=e.slice(o),c.slice(1)}function eC(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=Pr(e,o),r=st[n],!r&&Hr(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||GS(n);return t}function tC(e,t,n){var r="",o=e.tag,s,i,l;for(s=0,i=n.length;s<i;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(hn(e,t,l,!1,!1)||typeof l>"u"&&hn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function Pl(e,t,n,r){var o="",s=e.tag,i,l,c;for(i=0,l=n.length;i<l;i+=1)c=n[i],e.replacer&&(c=e.replacer.call(n,String(i),c)),(hn(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&hn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=li(e,t)),e.dump&&Br===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=s,e.dump=o||"[]"}function nC(e,t,n){var r="",o=e.tag,s=Object.keys(n),i,l,c,d,f;for(i=0,l=s.length;i<l;i+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=s[i],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),hn(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),hn(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=o,e.dump="{"+r+"}"}function rC(e,t,n,r){var o="",s=e.tag,i=Object.keys(n),l,c,d,f,p,m;if(e.sortKeys===!0)i.sort();else if(typeof e.sortKeys=="function")i.sort(e.sortKeys);else if(e.sortKeys)throw new lt("sortKeys must be a boolean or a function");for(l=0,c=i.length;l<c;l+=1)m="",(!r||o!=="")&&(m+=li(e,t)),d=i[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),hn(e,t+1,d,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&Br===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,p&&(m+=li(e,t)),hn(e,t+1,f,!0,p)&&(e.dump&&Br===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,o+=m));e.tag=s,e.dump=o||"{}"}function Ll(e,t,n){var r,o,s,i,l,c;for(o=n?e.explicitTypes:e.implicitTypes,s=0,i=o.length;s<i;s+=1)if(l=o[s],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,dp.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(fp.call(l.represent,c))r=l.represent[c](t,c);else throw new lt("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function hn(e,t,n,r,o,s,i){e.tag=null,e.dump=n,Ll(e,n,!1)||Ll(e,n,!0);var l=dp.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",p,m;if(f&&(p=e.duplicates.indexOf(n),m=p!==-1),(e.tag!==null&&e.tag!=="?"||m||e.indent!==2&&t>0)&&(o=!1),m&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(f&&m&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(rC(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(nC(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!i&&t>0?Pl(e,t-1,e.dump,o):Pl(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(tC(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&JS(e,e.dump,t,s,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new lt("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function oC(e,t){var n=[],r=[],o,s;for(ui(e,n,r),o=0,s=r.length;o<s;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(s)}function ui(e,t,n){var r,o,s;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,s=e.length;o<s;o+=1)ui(e[o],t,n);else for(r=Object.keys(e),o=0,s=r.length;o<s;o+=1)ui(e[r[o]],t,n)}function sC(e,t){t=t||{};var n=new YS(t);n.noRefs||oC(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),hn(n,0,r,!0,!0)?n.dump+`
329
- `:""}var iC=sC,aC={dump:iC};function aa(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 lC=et,cC=Of,uC=Bf,dC=Vf,fC=Yf,pC=ra,mC=up.load,hC=up.loadAll,gC=aC.dump,xC=lt,vC={binary:Jf,float:Gf,map:$f,null:Uf,pairs:ep,set:tp,timestamp:Xf,bool:Hf,int:Wf,merge:Zf,omap:Qf,seq:zf,str:Ff},wC=aa("safeLoad","load"),bC=aa("safeLoadAll","loadAll"),yC=aa("safeDump","dump"),SC={Type:lC,Schema:cC,FAILSAFE_SCHEMA:uC,JSON_SCHEMA:dC,CORE_SCHEMA:fC,DEFAULT_SCHEMA:pC,load:mC,loadAll:hC,dump:gC,YAMLException:xC,types:vC,safeLoad:wC,safeLoadAll:bC,safeDump:yC};const CC=({content:e,rendererType:t,setRenderError:n})=>{const[r,o]=u.useState(!1);u.useEffect(()=>{n(null)},[e,n]);const[s,i]=u.useMemo(()=>{try{if(t==="yaml"){const l=SC.load(e);return[e,l]}else if(t==="json"){const l=JSON.parse(e);return[JSON.stringify(l,null,2),l]}throw new Error(`Unsupported renderer type: ${t}`)}catch(l){const c=t==="yaml"?"YAML":"JSON";console.error(`Error parsing ${c} for panel:`,l);const d={[`${c}_Parsing_Error`]:`The provided content is not valid ${c}.`,Details:l.message,Content_Snippet:e.substring(0,500)+(e.length>500?"...":"")};return n(`${c} parsing failed: ${l.message}`),[e,d]}},[e,t,n]);return a.jsxs("div",{className:"bg-background relative flex h-full flex-col overflow-hidden",children:[a.jsx("div",{className:"absolute top-4 right-4 z-10",children:a.jsx(we,{onClick:()=>o(!r),title:r?"Show Structured View":"Show Raw Text",children:r?a.jsxs(a.Fragment,{children:[a.jsx(Zl,{})," Structured"]}):a.jsxs(a.Fragment,{children:[a.jsx(Jl,{})," Raw Text"]})})}),a.jsx("div",{className:"flex min-h-0 flex-col",children:a.jsx("div",{className:"flex-1 overflow-auto",children:r?a.jsx(Sp,{content:s,setRenderError:n}):a.jsx(xi,{data:i,maxDepth:4,className:"min-h-16 border-none p-2"})})})]})},Sp=({content:e,className:t=""})=>{const{ref:n,handleKeyDown:r}=kf();return a.jsx("div",{className:`overflow-auto p-4 ${t}`,children:a.jsx("pre",{ref:n,className:"whitespace-pre-wrap select-text focus-visible:outline-none",style:{overflowWrap:"anywhere"},tabIndex:0,onKeyDown:r,children:e})})},Cp=({content:e,rendererType:t,mime_type:n,setRenderError:r})=>{switch(t){case"csv":return a.jsx(jb,{content:e,setRenderError:r});case"mermaid":return a.jsx(ny,{content:e,setRenderError:r});case"html":return a.jsx(Rb,{content:e,setRenderError:r});case"json":case"yaml":return a.jsx(CC,{content:e,rendererType:t,setRenderError:r});case"image":return a.jsx(Mb,{content:e,mime_type:n,setRenderError:r});case"markdown":return a.jsx(Pb,{content:e,setRenderError:r});case"audio":return a.jsx(_b,{content:e,mime_type:n,setRenderError:r});default:return a.jsx(Sp,{content:e,setRenderError:r})}},EC={"application/pdf":"pdf","application/zip":"zip","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","text/plain":"txt","text/csv":"csv","text/html":"html","text/markdown":"md","text/x-markdown":"md","application/json":"json","application/yaml":"yaml","text/yaml":"yaml","application/xml":"xml","text/xml":"xml","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff","audio/mpeg":"mp3","audio/wav":"wav","audio/ogg":"ogg","audio/aac":"aac","audio/flac":"flac","audio/x-m4a":"m4a","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","application/javascript":"js","application/gzip":"gz","application/x-tar":"tar","application/rtf":"rtf"};function TC(e,t){const n=EC[e]||"bin";return`embedded_file_${t+1}.${n}`}function AC(e){if(!e||typeof e!="string")return[];const t=[],n=/data:([a-zA-Z0-9/.-]+);base64,([A-Za-z0-9+/=]+)/g;let r,o=0;for(;(r=n.exec(e))!==null;){const[s,i,l]=r,c=e[r.index-1],d=e[r.index+s.length];if(!(c==='"'&&d==='"'||c==="'"&&d==="'")&&l&&l.length>10){const f=Zr(void 0,i);f?t.push({type:f,content:l,mimeType:i,originalMatch:s}):t.push({type:"file",content:l,mimeType:i,originalMatch:s,filename:TC(i,o++)})}}return t}function NC(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 kC(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,s]=r;t.push({type:"mermaid",content:s.trim(),originalMatch:o})}return t}function _C(e){return!e||typeof e!="string"?[]:[...AC(e),...NC(e),...kC(e)]}const IC=["image","audio"],jC=({message:e})=>{var d;const[t,n]=u.useState(null);if(e.isStatusBubble)return null;const r=(d=e.parts)==null?void 0:d.filter(f=>f.kind==="text"),o=(r==null?void 0:r.map(f=>f.text).join(""))||"";if(e.isUser)return a.jsx("span",{children:o});const s=o.trim();if(!s)return null;if(e.isError)return a.jsxs("div",{className:"flex items-center",children:[a.jsx(yi,{className:"mr-2 self-start text-[var(--color-error-wMain)]"}),a.jsx(ir,{children:s})]});const i=_C(s);if(i.length===0)return a.jsx(ir,{children:s});let l=s;const c=[];return i.forEach((f,p)=>{if(l=l.replace(f.originalMatch,""),f.type==="file"){const m={name:f.filename||"downloaded_file",content:f.content,mime_type:f.mimeType};c.push(a.jsx("div",{className:"my-2",children:a.jsx(Af,{fileAttachment:m,isEmbedded:!0})},`embedded-file-${p}`))}else if(!IC.includes(f.type)){const m=Sf(f.content);m&&c.push(a.jsx("div",{className:"my-2 h-auto w-md max-w-md",children:a.jsx(Cp,{content:m,rendererType:f.type,mime_type:f.mimeType,setRenderError:n})},`embedded-${p}`))}}),a.jsxs("div",{children:[t&&a.jsx(la,{variant:"error",message:"Error rendering preview"}),a.jsx(ir,{children:l}),c]})},Ep=({message:e,children:t,className:n})=>a.jsx("div",{className:`mt-1 space-y-1 ${e.isUser?"ml-auto":"mr-auto"} ${n}`,children:t}),RC=e=>e.uploadedFiles&&e.uploadedFiles.length>0?a.jsx(Ep,{message:e,className:"flex flex-wrap justify-end gap-2",children:e.uploadedFiles.map((t,n)=>{var r;return a.jsx(Nf,{filename:t.name,mimeType:t.type},`uploaded-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,MC=e=>e.files&&e.files.length>0?a.jsx(Ep,{message:e,children:e.files.map((t,n)=>{var r;return a.jsx(Af,{fileAttachment:t},`file-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,PC=(e,t,n)=>{var d,f;const{openSidePanelTab:r,setTaskIdInSidePanel:o}=t;if(e.isStatusBubble)return null;const s=(d=e.parts)==null?void 0:d.some(p=>p.kind==="text"&&p.text.trim());if(!s&&!e.artifactNotification)return null;const i=e.isUser?"sent":"received",l=!e.isUser&&e.isComplete&&!!e.taskId&&n,c=()=>{e.taskId&&(o(e.taskId),r("workflow"))};return a.jsx(gf,{variant:i,children:a.jsxs(xf,{variant:i,children:[s&&a.jsx(jC,{message:e}),e.artifactNotification&&a.jsxs("div",{className:"my-1 flex items-center rounded-md bg-blue-100 p-2 dark:bg-blue-900/50",children:[a.jsx(ar,{className:"mr-2 text-blue-500 dark:text-blue-400"}),a.jsxs("span",{className:"text-sm",children:["Artifact created: ",a.jsx("strong",{children:e.artifactNotification.name}),e.artifactNotification.version&&` (v${e.artifactNotification.version})`]})]}),l&&a.jsx("div",{className:"mt-3",children:a.jsx(ou,{onClick:c})})]})},(f=e.metadata)==null?void 0:f.messageId)},LC=({message:e,isLastWithTaskId:t})=>{const n=He();return e?a.jsxs(a.Fragment,{children:[PC(e,n,t),RC(e),MC(e)]}):null};var di=new Map,fo=new WeakMap,Dl=0,DC=void 0;function OC(e){return e?(fo.has(e)||(Dl+=1,fo.set(e,Dl.toString())),fo.get(e)):"0"}function FC(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?OC(e.root):e[t]}`).toString()}function zC(e){const t=FC(e);let n=di.get(t);if(!n){const r=new Map;let o;const s=new IntersectionObserver(i=>{i.forEach(l=>{var c;const d=l.isIntersecting&&o.some(f=>l.intersectionRatio>=f);e.trackVisibility&&typeof l.isVisible>"u"&&(l.isVisible=d),(c=r.get(l.target))==null||c.forEach(f=>{f(d,l)})})},e);o=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:s,elements:r},di.set(t,n)}return n}function $C(e,t,n={},r=DC){if(typeof window.IntersectionObserver>"u"&&r!==void 0){const c=e.getBoundingClientRect();return t(r,{isIntersecting:r,target:e,intersectionRatio:typeof n.threshold=="number"?n.threshold:0,time:0,boundingClientRect:c,intersectionRect:c,rootBounds:c}),()=>{}}const{id:o,observer:s,elements:i}=zC(n),l=i.get(e)||[];return i.has(e)||i.set(e,l),l.push(t),s.observe(e),function(){l.splice(l.indexOf(t),1),l.length===0&&(i.delete(e),s.unobserve(e)),i.size===0&&(s.disconnect(),di.delete(o))}}function BC({threshold:e,delay:t,trackVisibility:n,rootMargin:r,root:o,triggerOnce:s,skip:i,initialInView:l,fallbackInView:c,onChange:d}={}){var f;const[p,m]=u.useState(null),g=u.useRef(d),[x,h]=u.useState({inView:!!l,entry:void 0});g.current=d,u.useEffect(()=>{if(i||!p)return;let S;return S=$C(p,(E,N)=>{h({inView:E,entry:N}),g.current&&g.current(E,N),N.isIntersecting&&s&&S&&(S(),S=void 0)},{root:o,rootMargin:r,threshold:e,trackVisibility:n,delay:t},c),()=>{S&&S()}},[Array.isArray(e)?e.toString():e,p,o,r,s,i,n,c,t]);const v=(f=x.entry)==null?void 0:f.target,b=u.useRef(void 0);!p&&v&&!s&&!i&&b.current!==v&&(b.current=v,h({inView:!!l,entry:void 0}));const w=[m,x.inView,x.entry];return w.ref=w[0],w.inView=w[1],w.entry=w[2],w}const UC=()=>{const{handleSwitchSession:e,updateSessionName:t,openSessionDeleteModal:n}=He(),{configServerUrl:r}=on(),o=u.useRef(null),[s,i]=u.useState([]),[l,c]=u.useState(null),[d,f]=u.useState(""),[p,m]=u.useState(1),[g,x]=u.useState(!0),[h,v]=u.useState(!1),{ref:b,inView:w}=BC({threshold:0,triggerOnce:!1}),S=u.useCallback(async(F=1,z=!1)=>{v(!0);const Q=`${r}/api/v1/sessions?pageNumber=${F}&pageSize=20`;try{const P=await ze(Q);if(P.ok){const Y=await P.json();i(z?A=>[...A,...Y.data]:Y.data),x(Y.meta.pagination.nextPage!==null),m(F)}else console.error(`Failed to fetch sessions: ${P.status} ${P.statusText}`)}catch(P){console.error("An error occurred while fetching sessions:",P)}finally{v(!1)}},[r]);u.useEffect(()=>{S(1,!1);const F=()=>{S(1,!1)},z=q=>{const{sessionId:Q}=q.detail;i(P=>{const Y=P.find(A=>A.id===Q);if(Y){const A=P.filter(B=>B.id!==Q);return[Y,...A]}return P})};return window.addEventListener("new-chat-session",F),window.addEventListener("session-updated",z),()=>{window.removeEventListener("new-chat-session",F),window.removeEventListener("session-updated",z)}},[S]),u.useEffect(()=>{w&&g&&!h&&S(p+1,!0)},[w,g,h,p,S]),u.useEffect(()=>{l&&o.current&&o.current.focus()},[l]);const E=async F=>{l!==F&&await e(F)},N=F=>{c(F.id),f(F.name||"")},j=async()=>{l&&(await t(l,d),c(null),S())},k=F=>{n(F)},T=F=>hh(F),V=F=>{if(F.name&&F.name.trim())return F.name;const z=F.id;return z.startsWith("web-session-")?`Chat ${z.replace("web-session-","").substring(0,8)}`:`Session ${z.substring(0,8)}`};return a.jsxs("div",{className:"flex h-full flex-col gap-4 py-6 pl-6",children:[a.jsx("div",{className:"text-lg",children:"Chat Session History"}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.length>0&&a.jsx("ul",{children:s.map(F=>a.jsx("li",{className:"group my-2 pr-4",children:a.jsxs("div",{className:"flex items-center justify-between rounded px-4 py-2 hover:bg-gray-200 dark:hover:bg-gray-700",children:[l===F.id?a.jsx("input",{ref:o,type:"text",value:d,onChange:z=>f(z.target.value),onKeyDown:z=>z.key==="Enter"&&j(),onBlur:j,className:"flex-grow bg-transparent focus:outline-none"}):a.jsx("button",{onClick:()=>E(F.id),className:"flex-grow text-left",children:a.jsxs("div",{className:"flex max-w-50 flex-col",children:[a.jsx("span",{className:"truncate font-semibold",title:V(F),children:V(F)}),a.jsx("span",{className:"text-muted-foreground text-xs",children:T(F.updatedTime)})]})}),a.jsx("div",{className:"flex items-center opacity-0 transition-opacity group-hover:opacity-100",children:l===F.id?a.jsxs(a.Fragment,{children:[a.jsx(we,{variant:"ghost",onClick:j,children:a.jsx(wi,{size:16})}),a.jsx(we,{variant:"ghost",onClick:()=>c(null),children:a.jsx(Do,{size:16})})]}):a.jsxs(a.Fragment,{children:[a.jsx(we,{variant:"ghost",onClick:()=>N(F),children:a.jsx(Xp,{size:16})}),a.jsx(we,{variant:"ghost",onClick:()=>k(F),children:a.jsx(Zp,{size:16})})]})})]})},F.id))}),s.length===0&&!h&&a.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center text-sm",children:[a.jsx(Ql,{className:"mx-auto mb-4 h-12 w-12"}),"No chat sessions available"]}),g&&a.jsx("div",{ref:b,className:"flex justify-center py-4",children:h&&a.jsx(bf,{size:"small",variant:"muted"})})]})]})},HC=()=>{const{persistenceEnabled:e}=on(),{sessionName:t}=He();return e===!1?a.jsx("div",{className:"flex h-full flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto px-4",children:[a.jsxs("div",{className:"bg-accent/50 hover:bg-accent mb-3 cursor-pointer rounded-md p-3",children:[a.jsx("div",{className:"text-foreground truncate text-sm font-medium text-nowrap",children:t||"New Chat"}),a.jsx("div",{className:"text-muted-foreground mt-1 text-xs",children:"Current session"})]}),a.jsx("div",{className:"text-muted-foreground mt-4 text-center text-xs",children:"Multi-session support coming soon"})]})}):a.jsx(UC,{})},WC=({artifactInfo:e,isPreview:t=!1,isExpanded:n=!1,onDelete:r,onDownload:o,setIsExpanded:s})=>{const{previewedArtifactAvailableVersions:i,currentPreviewedVersionNumber:l,navigateArtifactVersion:c}=He(),d=u.useMemo(()=>i??[],[i]);return a.jsxs("div",{className:"flex flex-row justify-between gap-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"truncate text-sm",title:e.filename,children:e.filename}),a.jsx("div",{className:"truncate text-xs",title:_a(e.last_modified),children:_a(e.last_modified)})]}),t&&d.length>1&&a.jsx("div",{className:"align-right",children:a.jsxs(Yd,{value:l==null?void 0:l.toString(),onValueChange:f=>{c(e.filename,parseInt(f))},children:[a.jsx(qd,{className:"h-[16px] py-0 text-xs shadow-none",children:a.jsx(Kd,{placeholder:"Version"})}),a.jsx(Xd,{children:d.map(f=>a.jsxs(Zd,{value:f.toString(),children:["Version ",f]},f))})]})})]}),a.jsxs("div",{className:`whitespace-nowrap ${t?"opacity-100":"opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100"}`,children:[s&&a.jsx(we,{variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),f.preventDefault(),s(!n)},tooltip:n?"Collapse Details":"Expand Details",children:a.jsx(Ci,{})}),o&&a.jsx(we,{variant:"ghost",size:"sm",onClick:async f=>{f.stopPropagation(),f.preventDefault(),await o(e)},tooltip:"Download",children:a.jsx(Si,{})}),r&&a.jsx(we,{variant:"ghost",size:"sm",onClick:f=>{f.preventDefault(),f.stopPropagation(),r(e)},tooltip:"Delete",children:a.jsx(ec,{})})]})]})},Ol=({artifact:e,isPreview:t})=>{const{openDeleteModal:n,setPreviewArtifact:r}=He(),{onDownload:o}=sd(),[s,i]=u.useState(!1),l=()=>{t&&r(null),n(e)},c=d=>{if(!d||typeof d=="object"&&Object.keys(d).length===0)return a.jsx("span",{children:"Not available"});const f=(p,m=0)=>typeof p=="string"?a.jsx("span",{children:p}):Array.isArray(p)?a.jsxs(a.Fragment,{children:["[",p.length>0&&f(p[0],m+1),p.length>1&&a.jsx("span",{children:", ..."}),"]"]}):typeof p=="object"&&p!==null?a.jsx("div",{className:`ml-${m*2} border-l pl-2`,children:Object.entries(p).map(([g,x],h)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"font-semibold",children:[g,":"]})," ",f(x,m+1)]},h))}):String(p);return a.jsxs("div",{className:"mt-1 space-y-0.5",children:[typeof d=="object"&&d.type&&a.jsxs("p",{children:[a.jsx("strong",{children:"Type:"})," ",d.type," ",d.inferred&&a.jsx("span",{className:"text-xs",children:"(inferred)"})]}),typeof d=="object"&&d.columns&&a.jsxs("p",{children:[a.jsx("strong",{children:"Columns:"})," ",d.columns.join(", ")]}),typeof d=="object"&&d.structure&&a.jsxs("div",{children:[a.jsx("strong",{children:"Structure:"}),f(d.structure)]}),typeof d=="object"&&d.error&&a.jsxs("p",{className:"text-[var(--color-error-wMain)]",children:[a.jsx("strong",{children:"Schema Error:"})," ",d.error]}),typeof d=="string"&&a.jsx("p",{children:d})]})};return a.jsx("div",{className:`group relative w-full border-b px-4 py-3 transition-all duration-150 ${t?"":"cursor-pointer hover:bg-[var(--accent-background)]"}`,onClick:d=>{d.stopPropagation(),r(e)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),r(e))},tabIndex:0,role:"button","aria-expanded":s,children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx("div",{className:"flex-shrink-0 pt-0.5",children:Tf(e,"h-4 w-4 flex-shrink-0")}),a.jsxs("div",{className:"min-w-0 flex-grow",children:[a.jsx(WC,{artifactInfo:e,isExpanded:s,onDelete:l,onDownload:o,setIsExpanded:i,isPreview:t}),s&&a.jsxs("div",{className:"text-xs",children:[a.jsx("div",{className:"mt-1 text-xs break-words whitespace-pre-wrap italic",children:e.description||"No description."}),a.jsxs("div",{className:"mt-2 space-y-1 pt-2",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Size: "}),Sc(e.size)]}),e.uri&&a.jsxs("div",{children:[a.jsx("strong",{children:"URI: "}),a.jsx("span",{className:"break-all",children:e.uri||"None"})]}),e.schema&&a.jsx("div",{children:c(e.schema)})]})]})]})]})})},GC=()=>{const{isDeleteModalOpen:e,artifactToDelete:t,closeDeleteModal:n,confirmDelete:r}=He();return!e||!t?null:a.jsx(Ko,{open:e,onOpenChange:n,children:a.jsxs(qo,{children:[a.jsxs(Xo,{children:[a.jsxs(Zo,{className:"flex max-w-[400px] flex-row gap-1",children:["Delete",a.jsx("span",{className:"inline-block truncate",title:t.filename,children:a.jsx("code",{children:t.filename})}),"?"]}),a.jsx(Jo,{className:"flex flex-col gap-2",children:a.jsx("div",{children:"This file will be permanently deleted. "})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(we,{variant:"outline",onClick:n,children:"Cancel"}),a.jsx(we,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})},VC={replace:e=>{e instanceof em.Element&&e.attribs&&e.name==="a"&&(e.attribs.target="_blank",e.attribs.rel="noopener noreferrer")}};function ir({children:e,className:t}){if(!e)return null;try{const n=Jp.parse(e,{gfm:!0}),r=Pf.sanitize(n,{USE_PROFILES:{html:!0}}),o=Qp(r,VC);return a.jsx("div",{className:Ia(t),children:o})}catch{return a.jsx("div",{className:Ia(t),children:e})}}const YC=Nn("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"}}),KC={error:yi,warning:tm,info:Ci,success:tc};function la({className:e,variant:t="error",message:n,dismissible:r=!1,onDismiss:o,...s}){const i=KC[t||"error"];return a.jsxs("div",{className:be(YC({variant:t,className:e})),role:"alert","aria-live":"polite",...s,children:[a.jsx(i,{className:"size-5 shrink-0"}),a.jsx("span",{className:"flex-1",children:n}),r&&o&&a.jsx(we,{variant:"ghost",onClick:o,"aria-label":"Dismiss",children:a.jsx(Do,{className:"size-3"})})]})}const qC=({artifact:e,message:t})=>{const{onDownload:n}=sd();return a.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-4",children:[a.jsx("div",{className:"mb-1 font-semibold",children:"Preview Coming Soon"}),a.jsx("div",{children:t}),a.jsx("div",{className:"mb-4",children:"Download file to view."}),a.jsxs(we,{onClick:()=>n(e),children:[a.jsx(Si,{className:"h-4 w-4"}),"Download"]})]})},zs=({children:e})=>a.jsx("div",{className:"text-muted-foreground flex h-[50vh] items-center justify-center",children:e||"No preview available"}),XC=({artifact:e})=>{const{openArtifactForPreview:t,previewFileContent:n}=He(),r=u.useMemo(()=>kb(e),[e]),[o,s]=u.useState(!1),[i,l]=u.useState(null);if(u.useEffect(()=>{s(!1),l(null)},[e]),u.useEffect(()=>{async function f(){try{s(!0),l(null),await t(e.filename)}catch(p){console.error("Error fetching artifact content:",p),l(p instanceof Error?p.message:"Failed to load artifact content")}finally{s(!1)}}r!=null&&r.canPreview&&f()},[e,t,r]),i)return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(la,{variant:"error",message:"Error rendering preview"}),a.jsx(zs,{children:"No preview available"})]});if(o)return a.jsx(zs,{children:a.jsx(bi,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(!r.canPreview)return a.jsx(qC,{artifact:e,message:r.reason??""});const c=Zr(e.filename,e.mime_type),d=Ab(n);return!c||!d?a.jsx(zs,{children:"No preview available"}):a.jsx(Cp,{content:d,rendererType:c,mime_type:n==null?void 0:n.mime_type,setRenderError:l})},Jt={NameAsc:"name_asc",NameDesc:"name_desc",DateAsc:"date_asc",DateDesc:"date_desc"},ZC=e=>{switch(e){case Jt.NameAsc:return"Name (A-Z)";case Jt.NameDesc:return"Name (Z-A)";case Jt.DateAsc:return"Date (oldest first)";case Jt.DateDesc:return"Date (newest first)"}},JC=({currentSortOption:e,onSortChange:t,children:n})=>{const r=Object.values(Jt).map(o=>({id:o,label:ZC(o),onClick:()=>t(o),icon:e===o?a.jsx(wi,{}):void 0,iconPosition:"right"}));return a.jsxs(vd,{children:[a.jsx(wd,{asChild:!0,children:n}),a.jsx(bd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(Ji,{actions:r})})]})},QC=({children:e})=>{const{artifactsRefetch:t,setIsBatchDeleteModalOpen:n}=He(),r=[{id:"refreshAll",label:"Refresh",onClick:()=>{t()},icon:a.jsx(nc,{}),iconPosition:"left"},{id:"deleteAll",label:"Delete All",onClick:()=>{n(!0)},icon:a.jsx(ec,{}),iconPosition:"left",divider:!0}];return a.jsxs(vd,{children:[a.jsx(wd,{asChild:!0,children:e}),a.jsx(bd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(Ji,{actions:r})})]})},e1=()=>{const{artifacts:e,isBatchDeleteModalOpen:t,setIsBatchDeleteModalOpen:n,confirmBatchDeleteArtifacts:r,setSelectedArtifactFilenames:o}=He();return u.useEffect(()=>{t&&o(new Set(e.map(s=>s.filename)))},[e,t,o]),t?a.jsx(Ko,{open:t,onOpenChange:n,children:a.jsxs(qo,{children:[a.jsxs(Xo,{children:[a.jsx(Zo,{children:"Delete All?"}),a.jsxs(Jo,{children:[e.length===1?"One file":`All ${e.length} files`," will be permanently deleted."]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(we,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),a.jsx(we,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})}):null},t1={[Jt.NameAsc]:(e,t)=>e.filename.localeCompare(t.filename),[Jt.NameDesc]:(e,t)=>t.filename.localeCompare(e.filename),[Jt.DateAsc]:(e,t)=>e.last_modified>t.last_modified?1:-1,[Jt.DateDesc]:(e,t)=>e.last_modified<t.last_modified?1:-1},n1=()=>{const{artifacts:e,artifactsLoading:t,previewArtifact:n,setPreviewArtifact:r}=He(),[o,s]=u.useState(Jt.DateDesc),i=u.useMemo(()=>t?[]:e?[...e].sort(t1[o]):[],[e,t,o]),l=u.useMemo(()=>n?a.jsxs("div",{className:"flex items-center gap-2 border-b p-2",children:[a.jsx(we,{variant:"ghost",onClick:()=>r(null),children:a.jsx(nm,{})}),a.jsx("div",{className:"text-md font-semibold",children:"Preview"})]}):i.length>0&&a.jsxs("div",{className:"flex items-center justify-end border-b p-2",children:[a.jsx(JC,{currentSortOption:o,onSortChange:s,children:a.jsxs(we,{variant:"ghost",title:"Sort By",children:[a.jsx(ql,{className:"h-5 w-5"}),a.jsx("div",{children:"Sort By"})]})},"sort-popover"),a.jsx(QC,{children:a.jsx(we,{variant:"ghost",tooltip:"More",children:a.jsx(rm,{className:"h-5 w-5"})})},"more-popover")]}),[n,i.length,o,r]);return a.jsxs("div",{className:"flex h-full flex-col",children:[l,a.jsxs("div",{className:"flex min-h-0 flex-1",children:[!n&&a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.map(c=>a.jsx(Ol,{artifact:c},c.filename)),i.length===0&&a.jsx("div",{className:"flex h-full items-center justify-center p-4",children:a.jsxs("div",{className:"text-muted-foreground text-center",children:[t&&a.jsx(bi,{className:"size-6 animate-spin"}),!t&&a.jsxs(a.Fragment,{children:[a.jsx(ar,{className:"mx-auto mb-4 h-12 w-12"}),a.jsx("div",{className:"text-lg font-medium",children:"Files"}),a.jsx("div",{className:"mt-2 text-sm",children:"No files available"})]})]})})]}),n&&a.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-2",children:[a.jsx(Ol,{artifact:n,isPreview:!0},n.filename),a.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto",children:a.jsx(XC,{artifact:n})})]})]}),a.jsx(GC,{}),a.jsx(e1,{})]})},r1=({onCollapsedToggle:e,isSidePanelCollapsed:t,setIsSidePanelCollapsed:n,isSidePanelTransitioning:r})=>{const{activeSidePanelTab:o,setActiveSidePanelTab:s,setPreviewArtifact:i,taskIdInSidePanel:l}=He(),{isReconnecting:c,isTaskMonitorConnecting:d,isTaskMonitorConnected:f,monitoredTasks:p,connectTaskMonitorStream:m}=Xi(),[g,x]=u.useState(null);u.useEffect(()=>{if(l&&p[l]){const S=p[l],E=F1(S.events||[],p,S);x(E)}else x(null)},[l,p]);const h=()=>c||d?{message:"Connecting to task monitor ...",showButton:!1}:f?l?g?null:{message:"No workflow data available for the selected task",showButton:!1}:{message:"No task selected to display",showButton:!1}:{message:"No connection to task monitor",showButton:!0,buttonText:"Reconnect",buttonIcon:om,buttonAction:m},v=()=>{const S=!t;n(S),e(S)},b=S=>{S==="files"&&i(null),s(S)},w=S=>{t&&(n(!1),e==null||e(!1)),b(S)};return t?a.jsxs("div",{className:"bg-background flex h-full w-full flex-col items-center border-l py-4",children:[a.jsx(we,{variant:"ghost",size:"sm",onClick:v,className:"h-10 w-10 p-0",tooltip:"Expand Panel",children:a.jsx(ga,{className:"size-5"})}),a.jsx("div",{className:"bg-border my-4 h-px w-8"}),a.jsx(we,{variant:"ghost",size:"sm",onClick:()=>w("files"),className:"mb-2 h-10 w-10 p-0",tooltip:"Files",children:a.jsx(ar,{className:"size-5"})}),a.jsx(we,{variant:"ghost",size:"sm",onClick:()=>w("workflow"),className:"h-10 w-10 p-0",tooltip:"Workflow",children:a.jsx(go,{className:"size-5"})})]}):a.jsx("div",{className:"bg-background flex h-full flex-col border-l",children:a.jsx("div",{className:"m-1 min-h-0 flex-1",children:a.jsxs(Q0,{value:o,onValueChange:S=>b(S),className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex gap-2 p-2",children:[a.jsx(we,{variant:"ghost",onClick:v,className:"p-1",tooltip:"Collapse Panel",children:a.jsx(ga,{className:"size-5"})}),a.jsxs(eb,{className:"grid w-full grid-cols-2 bg-transparent p-0",children:[a.jsxs(ul,{value:"files",title:"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:[a.jsx(ar,{className:"mr-2 h-4 w-4"}),"Files"]}),a.jsxs(ul,{value:"workflow",title:"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:[a.jsx(go,{className:"mr-2 h-4 w-4"}),"Workflow"]})]})]}),a.jsxs("div",{className:"min-h-0 flex-1",children:[a.jsx(dl,{value:"files",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:a.jsx(n1,{})})}),a.jsx(dl,{value:"workflow",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:(()=>{const S=h();return!S&&g?a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsx(i1,{task:g}),a.jsx(O1,{processedSteps:g.steps||[],isRightPanelVisible:!1,isSidePanelTransitioning:r})]}):a.jsx("div",{className:"flex h-full items-center justify-center p-4",children:a.jsxs("div",{className:"text-muted-foreground text-center",children:[a.jsx(go,{className:"mx-auto mb-4 h-12 w-12"}),a.jsx("div",{className:"text-lg font-medium",children:"Workflow"}),a.jsx("div",{className:"mt-2 text-sm",children:S==null?void 0:S.message}),(S==null?void 0:S.showButton)&&a.jsx("div",{className:"mt-4",children:a.jsxs(we,{onClick:S.buttonAction,children:[S.buttonIcon&&(()=>{const E=S.buttonIcon;return a.jsx(E,{className:"h-4 w-4"})})(),S.buttonText]})})]})})})()})})]})]})})})},fi=({statusText:e,onViewWorkflow:t})=>a.jsxs("div",{className:"flex h-8 items-center space-x-3 py-1",children:[t?a.jsx(ou,{onClick:t}):a.jsx(ib,{className:"mr-3 ml-2"}),a.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:e&&a.jsx("span",{className:"text-muted-foreground animate-pulse truncate text-sm",title:e,children:e})})]}),Tp=({isOpen:e,onClose:t})=>{const{handleNewSession:n}=He(),{persistenceEnabled:r}=on();return a.jsx(Ko,{open:e,onOpenChange:t,children:a.jsxs(qo,{children:[a.jsxs(Xo,{children:[a.jsx(Zo,{className:"flex max-w-[400px] flex-row gap-1",children:r===!1?"New Chat Session?":"Start New Chat Session?"}),a.jsx(Jo,{className:"flex flex-col gap-2",children:r===!1?"Starting a new chat session will clear the current chat history and files. Are you sure you want to proceed?":"This will create a new chat session. Your current chat will be saved in the sessions panel."})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(we,{variant:"outline",onClick:t,children:"Cancel"}),a.jsx(we,{variant:"default",onClick:()=>{n(),t()},children:"Start New Chat"})]})]})})},o1=({onToggle:e})=>{const[t,n]=u.useState(!1);return a.jsxs("div",{className:"bg-background flex h-full w-100 flex-col border-r",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 pt-[35px] pb-3",children:[a.jsx(we,{variant:"ghost",onClick:e,className:"p-2",tooltip:"Collapse Sessions Panel",children:a.jsx(rc,{className:"size-5"})}),a.jsxs(we,{variant:"ghost",onClick:()=>n(!0),tooltip:"Start New Chat Session",children:[a.jsx(oc,{className:"size-5"}),"New chat"]})]}),a.jsx("div",{className:"mt-1 min-h-0 flex-1",children:a.jsx(HC,{})}),a.jsx(Tp,{isOpen:t,onClose:()=>n(!1)})]})},_r=(e,t)=>a.jsx(yf,{type:t,className:"rounded-full border-none",children:a.jsx("span",{className:"text-xs font-semibold",title:e,children:e})}),s1=(e,t)=>{var r;if(e.currentStatusText)return a.jsx("div",{title:e.currentStatusText,children:a.jsx(fi,{statusText:e.currentStatusText})});const n=(r=t==null?void 0:t.parts)==null?void 0:r.filter(o=>o.kind==="text").map(o=>o.text).join("");switch(e.status){case"submitted":case"working":return a.jsx("div",{title:n||e.status,children:a.jsx(fi,{statusText:n||e.status})});case"input-required":return _r("Input Required","info");case"completed":return _r("Completed","success");case"canceled":return _r("Canceled","info");case"failed":return _r("Failed","error");default:return _r("Unknown","info")}},i1=({task:e})=>{const{messages:t}=He(),n=u.useMemo(()=>{const r=t.find(o=>o.isStatusBubble);return e?s1(e,r):null},[t,e]);return e?a.jsxs("div",{className:"grid grid-cols-[auto_1fr] grid-rows-[32px_32px] gap-x-8 border-b p-4 leading-[32px]",children:[a.jsx("div",{className:"text-muted-foreground",children:"User"}),a.jsx("div",{className:"truncate",title:e.initialRequestText,children:e.initialRequestText}),a.jsx("div",{className:"text-muted-foreground",children:"Status"}),a.jsx("div",{className:"truncate",children:n})]}):null};class Ap{getEdgeAnimationState(t,n,r){const o=r.find(l=>l.id===t);if(!o)return{isAnimated:!1,animationType:"static"};if(!this.isAgentToToolRequest(o))return{isAnimated:!1,animationType:"static"};const s=r.slice(0,n+1);return this.hasMatchingResponse(o,s)?{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(s=>{var f;if(new Date(s.timestamp).getTime()<r)return!1;const l=(s.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||s.type==="AGENT_LLM_RESPONSE_TO_AGENT")&&s.target===o,c=s.source===o&&(s.type==="AGENT_TOOL_INVOCATION_START"||s.type==="TASK_COMPLETED"),d=s.type==="AGENT_TOOL_EXECUTION_RESULT"&&((f=s.data.toolResult)==null?void 0:f.isPeerResponse);return l||c||d})}hasToolResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.target,s=t.source;return n.some(i=>new Date(i.timestamp).getTime()<r?!1:i.type==="AGENT_TOOL_EXECUTION_RESULT"&&i.source===o&&i.target===s)}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)}}function Np(e,t){return(t==null?void 0:t[e])||e}const fn={USER:50,MAIN_FLOW:300,TOOLS:600},a1=50,qe=50,_t=330,Hn=50,qt=20,fr=10,Fl=qe+20,l1=90;function Wn(e,t,n){return e.push(n),t.add(n.id),n}function c1(e,t){return e.push(t),t}function Gn(e,t){return e.nodeIdCounter++,`${t.replace(/[^a-zA-Z0-9_]/g,"_")}_${e.nodeIdCounter}`}function dt(e){return e.currentPhaseIndex===-1||e.currentPhaseIndex>=e.phases.length?null:e.phases[e.currentPhaseIndex]}function Jr(e){const t=dt(e);return!t||e.currentSubflowIndex===-1||e.currentSubflowIndex>=t.subflows.length?null:t.subflows[e.currentSubflowIndex]}function u1(e,t,n){var r;for(let o=e.length-1;o>=0;o--){const s=e[o],i=n.find(l=>l.id===s.id);if(((r=i==null?void 0:i.data)==null?void 0:r.toolName)===t)return s}return null}function d1(e,t){if(!t)return null;const n=dt(e);return n&&n.subflows.findLast(r=>r.functionCallId===t)||null}function f1(e,t){if(!t)return null;const n=dt(e);return n&&n.subflows.findLast(r=>r.id===t)||null}function us(e,t){var o;const n=dt(e);if(!n)return null;if(t.functionCallId){const s=d1(e,t.functionCallId);if(s)return s}if(t.owningTaskId&&t.isSubTaskStep){const s=f1(e,t.owningTaskId);if(s){const i=n.subflows||[];if(!(new Set(i.map(c=>c.id)).size!==i.length))return s}}const r=Jr(e);if(r&&t.source){const s=t.source.replace(/[^a-zA-Z0-9_]/g,"_"),i=(o=t.target)==null?void 0:o.replace(/[^a-zA-Z0-9_]/g,"_"),l=r.peerAgent.id;if(l.includes(s)||i&&l.includes(i))return r}return r||null}function kp(e,t){var r,o,s;if(((r=e.data.toolDecision)==null?void 0:r.isParallel)===!0)return!0;const n=(s=(o=e.data)==null?void 0:o.toolInvocationStart)==null?void 0:s.functionCallId;return n?Array.from(t.parallelFlows.values()).some(i=>i.subflowFunctionCallIds.includes(n)):!1}function _p(e,t,n,r){var o;if(r)for(let s=e.length-1;s>=0;s--){const i=e[s];if(i.functionCallId===r){const l=n.find(c=>c.id===i.id);if(((o=l==null?void 0:l.data)==null?void 0:o.toolName)===t||t==="LLM")return i}}return u1(e,t,n)}function p1(e,t,n){const r=dt(e);if(!r)return null;const o=t.replace(/[^a-zA-Z0-9_]/g,"_"),s=n==null?void 0:n.replace(/[^a-zA-Z0-9_]/g,"_");let i=null;for(const l of r.subflows)if(l.peerAgent.id.includes(o)||s&&l.peerAgent.id.includes(s)){i=l;break}if(!i)return null;if(i.isParallel)return i;if(i.parentSubflowId){const l=r.subflows.find(c=>c.id===i.parentSubflowId);if(l&&l.isParallel)return l;if(l)return Ip(r,l)}return null}function Ip(e,t){if(t.isParallel)return t;if(t.parentSubflowId){const n=e.subflows.find(r=>r.id===t.parentSubflowId);if(n)return Ip(e,n)}return null}function pr(e,t,n,r){const o=`phase_${e.phases.length}`,s=Gn(e,`${t}_${o}`),i=e.nextAvailableGlobalY,l=Np(t,e.agentNameMap),c={id:s,type:"orchestratorNode",position:{x:fn.MAIN_FLOW,y:i},data:{label:l,visualizerStepId:n.id}};Wn(r,e.allCreatedNodeIds,c),e.nodePositions.set(s,c.position);const d={id:s,yPosition:i,height:qe,width:_t},f={id:s,name:t,type:"orchestrator",phaseId:o,context:"main",nodeInstance:d};e.agentRegistry.registerAgent(f);const p={id:o,orchestratorAgent:d,userNodes:[],subflows:[],toolInstances:[],currentToolYOffset:0,maxY:i+qe};return e.phases.push(p),e.currentPhaseIndex=e.phases.length-1,e.currentSubflowIndex=-1,e.nextAvailableGlobalY=p.maxY+Hn,p}function pi(e,t,n,r,o){var F,z,q,Q,P;const s=dt(e);if(!s)return null;const i=n.type==="AGENT_TOOL_EXECUTION_RESULT"&&((F=n.data.toolResult)==null?void 0:F.isPeerResponse)===!0,l=n.source||"",c=n.target||"",d=mr(l);!i&&!d&&!o&&e.indentationLevel++;const f=((q=(z=n.delegationInfo)==null?void 0:z[0])==null?void 0:q.subTaskId)||n.owningTaskId,p=Gn(e,`${t}_${f}`),m=Gn(e,`group_${t}_${f}`),g=((P=(Q=n.data)==null?void 0:Q.toolInvocationStart)==null?void 0:P.functionCallId)||n.functionCallId||"";let x,h,v;const b=Array.from(e.parallelFlows.values()).find(Y=>Y.subflowFunctionCallIds.includes(g)),w=Jr(e),S=p1(e,l,c);o&&b?(x=b.startX+b.currentXOffset,h=b.startY,v=h+qt,b.currentXOffset+=(_t+fr)*2.2):S?(v=e.nextAvailableGlobalY,x=(S.groupNode.xPosition||fn.MAIN_FLOW-50)+e.indentationLevel*e.indentationStep,h=v-qt):(v=e.nextAvailableGlobalY,x=fn.MAIN_FLOW-50+e.indentationLevel*e.indentationStep,h=v-qt);const E=Np(t,e.agentNameMap),N={id:p,type:"genericAgentNode",position:{x:50,y:qt},data:{label:E,visualizerStepId:n.id},parentId:m},j={id:m,type:"group",position:{x,y:h},data:{label:`${E} Sub-flow`},style:{backgroundColor:"rgba(220, 220, 255, 0.1)",border:"1px solid #aac",borderRadius:"8px",minHeight:`${qe+2*qt}px`}};Wn(r,e.allCreatedNodeIds,j),Wn(r,e.allCreatedNodeIds,N),e.nodePositions.set(p,N.position),e.nodePositions.set(m,j.position);const k={id:p,xPosition:fn.MAIN_FLOW,yPosition:v,height:qe,width:_t},T={id:p,name:t,type:"peer",phaseId:s.id,subflowId:f,context:"subflow",nodeInstance:k};e.agentRegistry.registerAgent(T);const V={id:f,functionCallId:g,isParallel:o,peerAgent:k,groupNode:{id:m,xPosition:x,yPosition:h,height:qe+2*qt,width:0},toolInstances:[],currentToolYOffset:0,maxY:v+qe,maxContentXRelative:N.position.x+_t,callingPhaseId:s.id,parentSubflowId:w==null?void 0:w.id,inheritedXOffset:S==null?void 0:S.groupNode.xPosition};return s.subflows.push(V),S&&(S.lastSubflow=V),e.currentSubflowIndex=s.subflows.length-1,o&&b?(b.maxHeight=Math.max(b.maxHeight,V.groupNode.height),e.nextAvailableGlobalY=b.startY+b.maxHeight+Hn):e.nextAvailableGlobalY=V.groupNode.yPosition+V.groupNode.height+Hn,V}function jp(e,t,n,r,o,s,i=!1){const l=dt(e);if(!l)return null;const c=s?s.toolInstances:l.toolInstances,d=i?"LLM":`Tool: ${t}`,f=i?"LLM":t,p=s?s.groupNode.id:void 0;let m,g,x,h;if(s){if(m=s.peerAgent.yPosition+s.currentToolYOffset,s.currentToolYOffset+=Fl,x=50+300,s.groupNode.xPosition===void 0||s.groupNode.yPosition===void 0)return null;g=s.groupNode.xPosition+x,h=m-s.groupNode.yPosition}else g=fn.TOOLS,m=l.orchestratorAgent.yPosition+l.currentToolYOffset,l.currentToolYOffset+=Fl,x=g,h=m;const v=Gn(e,`${f}_${r.id}`),b={id:v,type:n,position:{x,y:h},data:{label:d,visualizerStepId:r.id,toolName:t},parentId:p};Wn(o,e.allCreatedNodeIds,b),e.nodePositions.set(v,{x,y:h});const w={id:v,xPosition:g,yPosition:m,height:qe,width:_t,functionCallId:r.functionCallId};c.push(w);const S=m+qe;if(s){s.maxY=Math.max(s.maxY,S),s.maxContentXRelative=Math.max(s.maxContentXRelative,x+_t);const E=s.maxY-s.groupNode.yPosition+qt;s.groupNode.height=Math.max(s.groupNode.height,E);const N=s.maxContentXRelative+fr;s.groupNode.width=Math.max(s.groupNode.width||0,N);const j=o.find(k=>k.id===s.groupNode.id);j&&(j.style={...j.style,height:`${s.groupNode.height}px`,width:`${s.groupNode.width}px`}),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,s.groupNode.yPosition+s.groupNode.height+Hn)}else l.maxY=Math.max(l.maxY,S),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,l.maxY+Hn);return w}function ca(e,t,n,r){e.userNodeCounter++;const o=Gn(e,`User_response_${e.userNodeCounter}`),s=e.nextAvailableGlobalY+20,i={id:o,type:"userNode",position:{x:fn.USER,y:s},data:{label:"User",visualizerStepId:n.id,isBottomNode:!0}};Wn(r,e.allCreatedNodeIds,i),e.nodePositions.set(o,i.position);const l={id:o,yPosition:s,height:qe,width:_t};t.userNodes.push(l),e.allUserNodes.push(l);const c=s+qe;return t.maxY=Math.max(t.maxY,c),l}function wt(e,t,n,r,o,s,i,l,c){if(!e||!t||e===t)return;const d=o.allCreatedNodeIds.has(e),f=o.allCreatedNodeIds.has(t);if(!d||!f)return;const p=`edge-${e}${l||""}-to-${t}${c||""}-${n.id}`;if(!r.some(g=>g.id===p)){const g=n.title&&n.title.length>30?n.type.replace(/_/g," ").toLowerCase():n.title||"",x=s.isRequestStep(n),h={id:p,source:e,target:t,label:g,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:x,animationType:x?"request":"static",duration:1}};l&&(h.sourceHandle=l),c&&(h.targetHandle=c),c1(r,h)}}function m1(){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,s)=>{const i=parseInt(o.id.split("_").pop()||"0");return parseInt(s.id.split("_").pop()||"0")>i?s:o})},findAgentById(t){for(const[,n]of e)if(n.id===t)return n;return null},registerAgent(t){e.set(t.id,t)}}}function mi(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 mr(e){return e==="OrchestratorAgent"||e.toLowerCase().includes("orchestrator")}const h1=["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"];function g1(e,t,n,r,o,s){const i=e.target,l=i.replace(/[^a-zA-Z0-9_]/g,"_"),c=dt(t),d=Jr(t);let f,p=!1;if(d?(f=d.peerAgent,f.id.startsWith(l+"_")&&(p=!0)):c&&(f=c.orchestratorAgent,f.id.startsWith(l+"_")&&(p=!0)),p&&f&&c){t.userNodeCounter++;const m=Gn(t,`User_continue_${t.userNodeCounter}`),g=t.nextAvailableGlobalY,x={id:m,type:"userNode",position:{x:fn.USER,y:g},data:{label:"User",visualizerStepId:e.id}};Wn(n,t.allCreatedNodeIds,x),t.nodePositions.set(m,x.position);const h={id:m,yPosition:g,height:qe,width:_t};c.userNodes.push(h),t.allUserNodes.push(h);const v=g+qe;f.yPosition=Math.max(f.yPosition,g),c.maxY=Math.max(c.maxY,v,f.yPosition+qe),t.nextAvailableGlobalY=c.maxY+Hn;const b=mr(i)?"orch-left-input":"peer-left-input";wt(h.id,f.id,e,r,t,o,s,"user-right-output",b)}else{const m=pr(t,i,e,n),g=Gn(t,`User_${m.id}`),x={id:g,type:"userNode",position:{x:fn.USER,y:m.orchestratorAgent.yPosition-l1},data:{label:"User",visualizerStepId:e.id,isTopNode:!0}};Wn(n,t.allCreatedNodeIds,x),t.nodePositions.set(g,x.position);const h={id:g,yPosition:x.position.y,height:qe,width:_t};m.userNodes.push(h),t.allUserNodes.push(h),t.userNodeCounter++,m.maxY=Math.max(m.maxY,x.position.y+qe),t.nextAvailableGlobalY=m.maxY+Hn,wt(g,m.orchestratorAgent.id,e,r,t,o,s,"user-bottom-output","orch-top-input")}}function x1(e,t,n,r,o,s){const i=dt(t);if(!i)return;const l=us(t,e),c=l?l.peerAgent.id:i.orchestratorAgent.id,d=jp(t,"LLM","llmNode",e,n,l,!0);d&&wt(c,d.id,e,r,t,o,s,l?"peer-right-output-tools":"orch-right-output-tools","llm-left-input")}function v1(e,t,n,r,o,s){var x;if(e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"&&((x=e.data.toolDecision)!=null&&x.isParallel)){const h=`parallel-${e.id}`;e.data.toolDecision.decisions.filter(v=>v.isPeerDelegation).length>1&&t.parallelFlows.set(h,{subflowFunctionCallIds:e.data.toolDecision.decisions.filter(v=>v.isPeerDelegation).map(v=>v.functionCallId),completedSubflows:new Set,startX:fn.MAIN_FLOW-50,startY:t.nextAvailableGlobalY,currentXOffset:0,maxHeight:0})}const i=dt(t);if(!i)return;const l=us(t,e);let c;const f=_p((l||i).toolInstances,"LLM",n,e.functionCallId);if(f)c=f.id;else{console.error(`[Timeline] LLM node not found for step type ${e.type}: ${e.id}. Cannot create edge.`);return}const p=e.target||"UnknownAgent";let m,g;l?(m=l.peerAgent.id,g="peer-right-input-tools"):i.orchestratorAgent.id.startsWith(p.replace(/[^a-zA-Z0-9_]/g,"_")+"_")&&(m=i.orchestratorAgent.id,g="orch-right-input-tools"),c&&m&&g?wt(c,m,e,r,t,o,s,"llm-bottom-output",g):console.error(`[Timeline] Could not determine target agent node ID or handle for step type ${e.type}: ${e.id}. Target agent name: ${p}. Edge will be missing.`)}function w1(e,t,n,r,o,s){var f;const i=dt(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"UnknownTool";if(((f=e.data.toolInvocationStart)==null?void 0:f.isPeerInvocation)||c.startsWith("peer_")){const p=c.startsWith("peer_")?c.substring(5):c,m=t.agentRegistry.findAgentByName(l);if(!m){console.error(`[Timeline] Could not find source agent in registry: ${l} for step ${e.id}`);return}const g=m.nodeInstance,x=mi(m.type,"output","bottom"),h=kp(e,t),v=pi(t,p,e,n,h);v&&wt(g.id,v.peerAgent.id,e,r,t,o,s,x,"peer-top-input")}else{const p=us(t,e);let m,g;if(p)m=p.peerAgent.id,g="peer-right-output-tools";else{const h=t.agentRegistry.findAgentByName(l);h?(m=h.id,g=mi(h.type,"output","right")):(m=i.orchestratorAgent.id,g="orch-right-output-tools")}const x=jp(t,c,"genericToolNode",e,n,p);x&&wt(m,x.id,e,r,t,o,s,g,`${x.id}-tool-left-input`)}}function b1(e,t,n,r,o,s){var d,f;const i=dt(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"OrchestratorAgent";if((d=e.data.toolResult)!=null&&d.isPeerResponse){const p=(f=e.data.toolResult)==null?void 0:f.functionCallId,m=Array.from(t.parallelFlows.entries()).find(([x,h])=>h.subflowFunctionCallIds.includes(p||""));if(m){const[x,h]=m;if(h.completedSubflows.add(p||""),h.completedSubflows.size<h.subflowFunctionCallIds.length)return;const v=i.subflows.filter(E=>h.subflowFunctionCallIds.includes(E.functionCallId)),b=e.target||"OrchestratorAgent";let w,S;if(mr(b))t.indentationLevel=0,w=pr(t,b,e,n).orchestratorAgent,S="orch-top-input",t.currentSubflowIndex=-1;else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const E=pi(t,b,e,n,!1);if(!E)return;w=E.peerAgent,S="peer-top-input"}v.forEach(E=>{var N;wt(((N=E.lastSubflow)==null?void 0:N.peerAgent.id)??E.peerAgent.id,w.id,e,r,t,o,s,"peer-bottom-output",S)}),t.parallelFlows.delete(x);return}const g=t.agentRegistry.findAgentByName(l.startsWith("peer_")?l.substring(5):l);if(!g){console.error(`[Timeline] Source peer agent not found for peer response: ${l}.`);return}if(mr(c)){t.indentationLevel=0;const x=pr(t,c,e,n);wt(g.id,x.orchestratorAgent.id,e,r,t,o,s,"peer-bottom-output","orch-top-input"),t.currentSubflowIndex=-1}else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const x=kp(e,t)||Array.from(t.parallelFlows.values()).some(v=>v.subflowFunctionCallIds.some(b=>i.subflows.some(w=>w.functionCallId===b))),h=pi(t,c,e,n,x);h&&wt(g.id,h.peerAgent.id,e,r,t,o,s,"peer-bottom-output","peer-top-input")}}else{let p;const m=us(t,e),x=_p((m||i).toolInstances,l,n,e.functionCallId);if(x&&(p=x.id),p){let h,v;if(m)h=m.peerAgent.id,v="peer-right-input-tools";else{const b=t.agentRegistry.findAgentByName(c);b?(h=b.id,v=mi(b.type,"input","right")):(h=i.orchestratorAgent.id,v="orch-right-input-tools")}wt(p,h,e,r,t,o,s,l==="LLM"?"llm-bottom-output":`${p}-tool-bottom-output`,v)}else console.error(`[Timeline] Could not find source tool node for regular tool result: ${e.id}. Step source (tool name): ${l}.`)}}function y1(e,t,n,r,o,s){const i=dt(t);if(!i||e.isSubTaskStep)return;const l=i.orchestratorAgent.id,c=ca(t,i,e,n);wt(l,c.id,e,r,t,o,s,"orch-bottom-output","user-top-input")}function S1(e,t,n,r,o,s){const i=dt(t);if(!i)return;const l=Array.from(t.parallelFlows.values()).find(g=>g.subflowFunctionCallIds.includes(e.functionCallId||""));if(l){if(l.completedSubflows.add(e.functionCallId||""),l.completedSubflows.size===l.subflowFunctionCallIds.length){t.indentationLevel=0;const g=pr(t,"OrchestratorAgent",e,n);i.subflows.forEach(x=>{l.subflowFunctionCallIds.includes(x.functionCallId)&&wt(x.peerAgent.id,g.orchestratorAgent.id,e,r,t,o,s,"peer-bottom-output","orch-top-input")}),t.currentSubflowIndex=-1}return}if(!e.isSubTaskStep)return;const c=Jr(t);if(!c){console.warn(`[Timeline] TASK_COMPLETED with isSubTaskStep=true but no active subflow. Step ID: ${e.id}`);return}if(!i){console.error(`[Timeline] No current phase found for TASK_COMPLETED. Step ID: ${e.id}`);return}const d=c.peerAgent,f=n.some(g=>typeof g.data.label=="string"&&mr(g.data.label));let p,m;f?(t.indentationLevel=0,p=pr(t,"OrchestratorAgent",e,n).orchestratorAgent.id,m="orch-top-input"):(p=ca(t,i,e,n).id,m="user-top-input"),wt(d.id,p,e,r,t,o,s,"peer-bottom-output",m),t.currentSubflowIndex=-1}function C1(e,t,n,r){const o=dt(t);if(!o)return;const s=e.source||"UnknownSource",i=e.target||"User";let l,c="orch-bottom-output";const d=Jr(t);if(d&&d.peerAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_")))l=d.peerAgent,c="peer-bottom-output";else if(o.orchestratorAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_")))l=o.orchestratorAgent,c="orch-bottom-output";else for(const m of o.subflows)if(m.peerAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_"))){l=m.peerAgent,c="peer-bottom-output";break}if(!l){console.error(`[Timeline] Could not find source agent node for TASK_FAILED: ${s}`);return}let f,p;mr(i)?(t.indentationLevel=0,f=pr(t,i,e,n).orchestratorAgent.id,p="orch-top-input",t.currentSubflowIndex=-1):(f=ca(t,o,e,n).id,p="user-top-input"),E1(l.id,f,e,r,t,c,p)}function E1(e,t,n,r,o,s,i){var p;if(!e||!t||e===t)return;const l=o.allCreatedNodeIds.has(e),c=o.allCreatedNodeIds.has(t);if(!l||!c)return;const d=`error-edge-${e}${s||""}-to-${t}${i||""}-${n.id}`;if(!r.some(m=>m.id===d)){const m=((p=n.data.errorDetails)==null?void 0:p.message)||"Task failed",g=m.length>30?"Error":m,x={id:d,source:e,target:t,label:g,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:!1,animationType:"static",isError:!0,errorMessage:m}};s&&(x.sourceHandle=s),i&&(x.targetHandle=i),r.push(x)}}const T1=(e,t={})=>{const n=[],r=[];if(!e||e.length===0)return{nodes:n,edges:r};const o=new Ap,s={phases:[],currentPhaseIndex:-1,currentSubflowIndex:-1,parallelFlows:new Map,nextAvailableGlobalY:a1,nodeIdCounter:0,allCreatedNodeIds:new Set,nodePositions:new Map,allUserNodes:[],userNodeCounter:0,agentRegistry:m1(),indentationLevel:0,indentationStep:50,agentNameMap:t},i=e.filter(d=>h1.includes(d.type)),l=i.findIndex(d=>d.type==="USER_REQUEST");let c=i;l>0&&(c=[i[l],...i.slice(0,l),...i.slice(l+1)]);for(const d of c)switch(d.type){case"USER_REQUEST":g1(d,s,n,r,o,e);break;case"AGENT_LLM_CALL":x1(d,s,n,r,o,e);break;case"AGENT_LLM_RESPONSE_TO_AGENT":case"AGENT_LLM_RESPONSE_TOOL_DECISION":v1(d,s,n,r,o,e);break;case"AGENT_TOOL_INVOCATION_START":w1(d,s,n,r,o,e);break;case"AGENT_TOOL_EXECUTION_RESULT":b1(d,s,n,r,o,e);break;case"AGENT_RESPONSE_TEXT":y1(d,s,n,r,o,e);break;case"TASK_COMPLETED":S1(d,s,n,r,o,e);break;case"TASK_FAILED":C1(d,s,n,r);break}return s.phases.forEach(d=>{d.subflows.forEach(f=>{const p=n.find(m=>m.id===f.groupNode.id);if(p&&p.style){const g=f.maxY-f.groupNode.yPosition+qt;p.style.height=`${Math.max(qe+2*qt,g)}px`;const x=f.maxContentXRelative+fr,h=_t+2*fr+s.indentationLevel*s.indentationStep;p.style.width=`${Math.max(x,h)}px`}})}),{nodes:n,edges:r}},A1=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:s,targetPosition:i,style:l={},markerEnd:c,data:d})=>{const[f,p]=u.useState(!1),[m]=sm({sourceX:t,sourceY:n,sourcePosition:s,targetX:r,targetY:o,targetPosition:i}),g=()=>{const v={strokeWidth:f?3:2,stroke:"var(--color-muted-foreground)",...l},b=d;return b!=null&&b.isError?{...v,stroke:f?"var(--color-error-wMain)":"var(--color-error-w70)",strokeWidth:f?3:2}:b!=null&&b.isSelected?{...v,stroke:"#3b82f6",strokeWidth:3}:b!=null&&b.isAnimated?{...v,stroke:f?"#1d4ed8":"#3b82f6",strokeWidth:f?4:3}:f?{...v,stroke:"var(--edge-hover-color)"}:v},x=()=>p(!0),h=()=>p(!1);return a.jsxs(a.Fragment,{children:[a.jsx("path",{id:`${e}-interaction`,style:{strokeWidth:16,stroke:"transparent",fill:"none",cursor:"pointer"},className:"react-flow__edge-interaction",d:m,onMouseEnter:x,onMouseLeave:h}),a.jsx("path",{id:e,style:{...g(),cursor:"pointer",transition:"all 0.2s ease-in-out"},className:"react-flow__edge-path",d:m,markerEnd:c,onMouseEnter:x,onMouseLeave:h})]})},N1=({data:e})=>a.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:[a.jsx(Je,{type:"target",position:Qe.Top,id:"peer-top-input",className:"!bg-blue-700",isConnectable:!0}),a.jsx(Je,{type:"source",position:Qe.Right,id:"peer-right-output-tools",className:"!bg-blue-700",style:{top:"25%"},isConnectable:!0}),a.jsx(Je,{type:"target",position:Qe.Right,id:"peer-right-input-tools",className:"!bg-blue-700",style:{top:"75%"},isConnectable:!0}),a.jsx(Je,{type:"source",position:Qe.Bottom,id:"peer-bottom-output",className:"!bg-blue-700",isConnectable:!0}),a.jsx(Je,{type:"target",position:Qe.Left,id:"peer-left-input",className:"!bg-blue-700",isConnectable:!0}),a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"text-md truncate font-semibold",style:{maxWidth:"200px"},children:e.label})})]}),k1=({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 a.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:[a.jsx(Je,{type:"target",position:Qe.Left,id:`${t}-tool-left-input`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"25%"}}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${n()}`}),a.jsx("div",{className:"text-md truncate",style:{maxWidth:"200px"},children:e.label})]}),a.jsx(Je,{type:"source",position:Qe.Left,id:`${t}-tool-bottom-output`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"75%"}})]})},_1=({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 a.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:[a.jsx(Je,{type:"target",position:Qe.Left,id:"llm-left-input",className:"!bg-teal-500",isConnectable:!0,style:{top:"25%"}}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${t()}`}),a.jsx("div",{className:"text-md",children:e.label})]}),a.jsx(Je,{type:"source",position:Qe.Left,id:"llm-bottom-output",className:"!bg-teal-500",isConnectable:!0,style:{top:"75%"}})]})},I1=({data:e})=>a.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:[a.jsx(Je,{type:"source",position:Qe.Right,id:"orch-right-output-tools",className:"!bg-indigo-500",style:{top:"25%"},isConnectable:!0}),a.jsx(Je,{type:"target",position:Qe.Right,id:"orch-right-input-tools",className:"!bg-indigo-500",style:{top:"75%"},isConnectable:!0}),a.jsx(Je,{type:"target",position:Qe.Top,id:"orch-top-input",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(Je,{type:"source",position:Qe.Bottom,id:"orch-bottom-output",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(Je,{type:"target",position:Qe.Left,id:"orch-left-input",className:"!bg-indigo-500",isConnectable:!0}),a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"text-md truncate font-bold",style:{maxWidth:"200px"},children:e.label})})]}),j1=({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 a.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&&a.jsx(Je,{type:"source",position:Qe.Bottom,id:"user-bottom-output",className:"!bg-gray-500",isConnectable:!0}),e.isBottomNode&&a.jsx(Je,{type:"target",position:Qe.Top,id:"user-top-input",className:"!bg-gray-500",isConnectable:!0}),!e.isTopNode&&!e.isBottomNode&&a.jsx(Je,{type:"source",position:Qe.Right,id:"user-right-output",className:"!bg-gray-500",isConnectable:!0}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-3 w-3 rounded-full ${t()}`}),a.jsx("div",{className:"text-sm font-bold",children:e.label})]})]})},R1=({step:e,isHighlighted:t,onClick:n,variant:r="list"})=>{const o=()=>{var w,S,E;switch(e.type){case"USER_REQUEST":return a.jsx(cm,{className:"mr-2 text-blue-500 dark:text-blue-400",size:18});case"AGENT_RESPONSE_TEXT":return a.jsx(fs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"TASK_COMPLETED":return a.jsx(tc,{className:"mr-2 text-green-500 dark:text-green-400",size:18});case"TASK_FAILED":return a.jsx(lm,{className:"mr-2 text-red-500 dark:text-red-400",size:18});case"AGENT_LLM_CALL":return a.jsx(fs,{className:"mr-2 text-purple-500 dark:text-purple-400",size:18});case"AGENT_LLM_RESPONSE_TO_AGENT":return a.jsx(fs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_LLM_RESPONSE_TOOL_DECISION":{const N=(S=(w=e.data.toolDecision)==null?void 0:w.decisions)==null?void 0:S[0];return(N==null?void 0:N.isPeerDelegation)?a.jsx(xa,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18}):a.jsx(va,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18})}case"AGENT_TOOL_INVOCATION_START":return(E=e.data.toolInvocationStart)!=null&&E.isPeerInvocation?a.jsx(xa,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18}):a.jsx(va,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18});case"AGENT_TOOL_EXECUTION_RESULT":return a.jsx(am,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_ARTIFACT_NOTIFICATION":return a.jsx(ar,{className:"mr-2 text-indigo-500 dark:text-indigo-400",size:18});default:return a.jsx(im,{className:"mr-2 text-gray-500 dark:text-gray-400",size:18})}},s=new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),i=String(new Date(e.timestamp).getMilliseconds()).padStart(3,"0"),l=`${s}.${i}`,c=w=>a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",w.modelName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Prompt Preview:"})}),a.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:w.promptPreview})]}),d=({data:w})=>{const[S,E]=Ut.useState(!1),N=j=>{j.stopPropagation(),E(!S)};return S?a.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:[a.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[a.jsx("strong",{children:"LLM Response Details:"}),a.jsx("button",{onClick:N,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Hide details"})]}),w.modelName&&a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",w.modelName]}),a.jsxs("div",{className:"mt-1",children:[a.jsx("p",{children:a.jsx("strong",{children:"Response Preview:"})}),a.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:w.responsePreview})]}),w.isFinalResponse!==void 0&&a.jsxs("p",{className:"mt-1",children:[a.jsx("strong",{children:"Final Response:"})," ",w.isFinalResponse?"Yes":"No"]})]}):a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{className:"italic",children:"Internal LLM response"}),a.jsx("button",{onClick:N,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Show details"})]})},f=w=>a.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:[a.jsx("p",{className:"mb-2",children:a.jsxs("strong",{children:["🔧 ",w.isParallel?"Parallel Tool Calls:":"Tool Call:"]})}),a.jsx("ul",{className:"space-y-1 pl-2",children:w.decisions.map(S=>a.jsxs("li",{className:"flex items-center",children:[a.jsx("span",{className:"mr-2",children:"•"}),a.jsx("code",{children:S.toolName})]},S.functionCallId))})]}),p=w=>a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Tool:"})," ",w.toolName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Arguments:"})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:a.jsx(xi,{data:w.toolArguments})})]}),m=w=>a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Tool:"})," ",w.toolName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Result:"})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:typeof w.resultData=="object"?a.jsx(xi,{data:w.resultData}):a.jsx("pre",{className:"font-mono text-xs break-all whitespace-pre-wrap",children:String(w.resultData)})})]}),g=w=>a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Artifact:"})," ",w.artifactName,w.version!==void 0&&a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[" (v",w.version,")"]})]}),w.mimeType&&a.jsxs("p",{children:[a.jsx("strong",{children:"Type:"})," ",w.mimeType]}),w.description&&a.jsxs("p",{className:"mt-1",children:[a.jsx("strong",{children:"Description:"})," ",w.description]})]}),x=r==="list"&&e.nestingLevel&&e.nestingLevel>0?{marginLeft:`${e.nestingLevel*24}px`}:{},h=r==="popover"?`
330
- p-3 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors duration-150
331
- ${n?"cursor-pointer":""}
332
- `:`
333
- mb-3 p-3 border rounded-lg shadow-sm
334
- bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
335
- ${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
336
- ${n?"cursor-pointer":""}
337
- `,v=()=>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: ",b=e.title;return a.jsxs("div",{className:h,style:x,onClick:n,children:[a.jsxs("div",{className:"mb-1.5 flex items-center",children:[o(),a.jsx("h4",{className:"flex-grow text-sm font-semibold text-gray-700 dark:text-gray-200",title:e.title,children:b}),a.jsx("span",{className:"font-mono text-xs text-gray-500 dark:text-gray-400",children:l})]}),e.delegationInfo&&e.delegationInfo.length>0&&a.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(w=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[a.jsx(sc,{className:"mr-2 h-4 w-4 flex-shrink-0"}),a.jsxs("span",{children:[v(),w.peerAgentName]})]}),w.subTaskId&&a.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",a.jsxs("span",{className:"font-mono",title:w.subTaskId,children:[w.subTaskId.substring(0,15),"..."]})]})]},w.functionCallId))}),e.data.text&&a.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(ir,{children:e.data.text})}),e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(ir,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&a.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:[a.jsxs("p",{children:[a.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&a.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&c(e.data.llmCall),e.data.llmResponseToAgent&&a.jsx(d,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&f(e.data.toolDecision),e.data.toolInvocationStart&&p(e.data.toolInvocationStart),e.data.toolResult&&m(e.data.toolResult),e.data.artifactNotification&&g(e.data.artifactNotification)]})},M1={genericAgentNode:N1,userNode:j1,llmNode:_1,orchestratorNode:I1,genericToolNode:k1},P1={defaultFlowEdge:A1},L1={x:16,y:0},D1=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,s]=dm([]),[i,l,c]=fm([]),{fitView:d}=pm(),{highlightedStepId:f,setHighlightedStepId:p}=Xi(),{taskIdInSidePanel:m}=He(),{agentNameMap:g}=rd(),x=u.useRef([]),[h,v]=u.useState(!1),[b,w]=u.useState(null),[S,E]=u.useState(!1),N=u.useRef(null),[j,k]=u.useState(null),T=u.useRef(new Ap),V=u.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:T1(e,g),[e,g]),F=u.useMemo(()=>V.edges.length?V.edges.map(C=>{const _=C.data;let D={isAnimated:!1,animationType:"none"};if(_!=null&&_.visualizerStepId){const J=e.length-1;D=T.current.getEdgeAnimationState(_.visualizerStepId,J,e)}let M=C.id===j;return f&&(_==null?void 0:_.visualizerStepId)===f&&(M=!0),{...C,animated:D.isAnimated,data:{..._,isAnimated:D.isAnimated,animationType:D.animationType,isSelected:M}}}):[],[V.edges,e,j,f]),z=u.useCallback(()=>{o(C=>C.map(_=>{var ae,ie,de,ye;if(_.type!=="group")return _;const D=C.filter(Ie=>Ie.parentId===_.id);if(D.length===0)return _;let M=0,J=0;D.forEach(Ie=>{const je=Ie.position.x+_t,Pe=Ie.position.y+qe;M=Math.max(M,je),J=Math.max(J,Pe)});const L=M+fr,H=J+qt;let O=0;const W=_.id.split("_");if(W.length>2){const Ie=W.find(je=>je.startsWith("subflow"));if(Ie){const je=parseInt(Ie.replace("subflow",""));isNaN(je)||(O=je)}}const I=_t+2*fr+O*50,K=Math.max(L,I),ee=parseInt(((ie=(ae=_.style)==null?void 0:ae.width)==null?void 0:ie.toString().replace("px",""))||"0"),te=parseInt(((ye=(de=_.style)==null?void 0:de.height)==null?void 0:ye.toString().replace("px",""))||"0");return ee!==K||te!==H?{..._,style:{..._.style,width:`${K}px`,height:`${H}px`}}:_}))},[o]);u.useEffect(()=>{o(V.nodes),l(F),z()},[V.nodes,F,o,l,z]);const q=u.useCallback((C,_)=>i.find(D=>D.source===C&&(_?D.sourceHandle===_:!0))||null,[i]),Q=u.useCallback((C,_)=>{var M;v(!0);const D=(M=_.data)==null?void 0:M.visualizerStepId;if(D){const J=e.find(L=>L.id===D);J&&(k(_.id),t?p(D):(p(D),w(J),E(!0)))}},[e,t,p]),P=u.useCallback(C=>{switch(C.type){case"userNode":{const _=C.data;return _!=null&&_.isTopNode?["user-bottom-output"]:_!=null&&_.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[`${C.id}-tool-bottom-output`];default:return[]}},[]),Y=u.useCallback(()=>{E(!1),w(null)},[]),A=u.useCallback((C,_)=>{if(v(!0),_.type==="group"){p(null),k(null),Y();return}const D=P(_);let M=null;for(const J of D)if(M=q(_.id,J),M)break;if(!M&&_.type==="userNode"){const J=_.data;J!=null&&J.isBottomNode&&(M=i.find(L=>L.target===_.id)||null)}M&&Q(C,M)},[P,p,Y,q,i,Q]),B=u.useCallback(C=>{C!=null&&C.isTrusted&&v(!0)},[]);return u.useEffect(()=>{v(!1)},[m]),u.useEffect(()=>{!n&&d&&r.length>0&&x.current!==e&&h===!1&&(d({duration:200,padding:.1,maxZoom:1.2}),x.current=e)},[r.length,d,e,n,h]),u.useEffect(()=>{if(o(C=>C.map(_=>{var L;const D=((L=_.data)==null?void 0:L.visualizerStepId)&&_.data.visualizerStepId===f,M=V.nodes.find(H=>H.id===_.id),J=(M==null?void 0:M.style)||{};return{..._,style:{...J,boxShadow:D?"0px 4px 12px rgba(0, 0, 0, 0.2)":J.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),f){const C=F.find(_=>{const D=_.data;return(D==null?void 0:D.visualizerStepId)===f});C&&k(C.id)}else k(null)},[f,o,V.nodes,F]),!e||e.length===0?a.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."}):V.nodes.length===0&&e.length>0?a.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):a.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[a.jsxs(mm,{nodes:r,edges:i.map(C=>({...C,markerEnd:{type:vm.ArrowClosed,color:"#888"}})),onNodesChange:s,onEdgesChange:c,onEdgeClick:Q,onNodeClick:A,onPaneClick:()=>{p(null),k(null),Y()},onMoveStart:B,nodeTypes:M1,edgeTypes:P1,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:[a.jsx(hm,{}),a.jsx(gm,{className:gh()}),a.jsx(xm,{position:"top-right",className:"flex items-center space-x-4",children:a.jsx("div",{ref:N})})]}),a.jsx(Xw,{isOpen:S,onClose:Y,anchorRef:N,offset:L1,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:b&&a.jsx(R1,{step:b,variant:"popover"})})]})},O1=e=>a.jsx(um,{children:a.jsx(D1,{...e})}),Rp=e=>{var t,n,r,o;if(e.events&&e.events.length>0){const s=e.events[0];if((o=(r=(n=(t=s.full_payload)==null?void 0:t.params)==null?void 0:n.message)==null?void 0:r.metadata)!=null&&o.parentTaskId)return s.full_payload.params.message.metadata.parentTaskId}},Ir=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},Mp=(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 s=[...o.events||[]];for(const i in t){const l=t[i];if(l.taskId===e)continue;Rp(l)===e&&(s=s.concat(Mp(l.taskId,t,n,r+1)))}return s},F1=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,s=new Map,i=(A,B)=>(r.agents[A]||(r.agents[A]={agentName:B,instanceId:A,displayName:B,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[A]),l=new Map,c=Mp(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const d=c.sort((A,B)=>new Date(Ir(A)).getTime()-new Date(Ir(B)).getTime()),f=[];let p,m="",g,x,h=[],v=null,b;const w=new Map,S=new Map,E=new Map,N=A=>{if(m.trim()&&g&&x){const B=m.trim();let C=n.taskId;if(h.length>0){const M=h[0].split("-");M.length>2&&M[1]!=="global"&&(C=M.slice(1,M.length-1).join("-"))}else A&&(C=A);const _=l.get(C)??0,D=w.get(C)||E.get(C);f.push({id:`vstep-agenttext-${f.length}-${h[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:x,title:`${g}: Response`,source:g,target:"User",data:{text:B},rawEventIds:[...h],isSubTaskStep:_>0,nestingLevel:_,owningTaskId:C,functionCallId:D}),v=B}m="",g=void 0,x=void 0,h=[],b=void 0};d.forEach((A,B)=>{var I,K,ee,te,ae,ie,de,ye,Ie,je,Pe,Me,Be,yt,We,St,tt,nt,rt,le,jt,ht,Rt,Mt,Ct,Et,Tt,Xe,ft,Pt,Lt,sn,De,Ge,Dt,gt,Ot,Ft,Oe,pt,an,Yt,At,zt,Kt;const C=Ir(A),_=`raw-${A.task_id||"global"}-${B}`,D=A.full_payload,M=A.task_id||n.taskId,J=l.get(M)??0;let L=A.source_entity||"UnknownAgent";(ee=(K=(I=D==null?void 0:D.params)==null?void 0:I.message)==null?void 0:K.metadata)!=null&&ee.agent_name?L=D.params.message.metadata.agent_name:(ae=(te=D==null?void 0:D.result)==null?void 0:te.metadata)!=null&&ae.agent_name?L=D.result.metadata.agent_name:(Ie=(ye=(de=(ie=D==null?void 0:D.result)==null?void 0:ie.status)==null?void 0:de.message)==null?void 0:ye.metadata)!=null&&Ie.agent_name?L=D.result.status.message.metadata.agent_name:(Me=(Pe=(je=D==null?void 0:D.result)==null?void 0:je.artifact)==null?void 0:Pe.metadata)!=null&&Me.agent_name&&(L=D.result.artifact.metadata.agent_name);let H;if(J>0?H=w.get(M):H=E.get(M),A.direction==="request"&&J>0){const Se=(Be=D.params)==null?void 0:Be.metadata,U=Se==null?void 0:Se.function_call_id,G=A.task_id;if(G&&U){w.set(G,U);return}}if(A.direction==="request"&&J===0&&A.task_id===n.taskId){N(M),v=null;const Se=D.params;let U="User request";if((yt=Se==null?void 0:Se.message)!=null&&yt.parts){const G=Se.message.parts.filter($=>$.kind==="text"&&$.text);G.length>0&&(U=G[G.length-1].text)}f.push({id:`vstep-userreq-${f.length}-${_}`,type:"USER_REQUEST",timestamp:C,title:"User Input",source:"User",target:A.target_entity||L,data:{text:U},rawEventIds:[_],isSubTaskStep:!1,nestingLevel:0,owningTaskId:M});return}if(A.direction==="status-update"&&(D!=null&&D.result)){const Se=D.result,U=(We=Se.status)==null?void 0:We.message,G=U==null?void 0:U.metadata;let $;const re=!!(G!=null&&G.forwarded_from_peer);re?$=G.forwarded_from_peer:(St=Se.metadata)!=null&&St.agent_name?$=Se.metadata.agent_name:G!=null&&G.agent_name?$=G.agent_name:$=A.source_entity||"Agent";const ce=`${$}:${M}`;if(!re&&(U!=null&&U.parts))for(const me of U.parts){if(me.kind==="data"){const fe=me.data;fe.type==="agent_progress_update"?p=fe.status_text:fe.type==="artifact_creation_progress"&&(p=`Saving artifact: ${fe.filename} (${fe.bytes_saved} bytes)`)}if(me.kind==="data"){N(M);const ge=me.data;switch(ge==null?void 0:ge.type){case"agent_progress_update":{f.push({id:`vstep-progress-${f.length}-${_}`,type:"AGENT_RESPONSE_TEXT",timestamp:C,title:`${$}: Progress Update`,source:$,target:"User",data:{text:ge.status_text},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H});break}case"llm_invocation":{const ne=ge.request;let xe="System-initiated LLM call";if(ne!=null&&ne.contents&&Array.isArray(ne.contents)&&ne.contents.length>0){const X=[...ne.contents].reverse().find(y=>y.role==="user");X&&X.parts&&(xe=X.parts.map(y=>y.text||"").join(`
338
- `).trim())}const Le={modelName:(ne==null?void 0:ne.model)||"Unknown Model",promptPreview:xe||"No text in user prompt."};i(ce,$),o.set(ce,{timestamp:C,modelName:Le.modelName}),f.push({id:`vstep-llmcall-${f.length}-${_}`,type:"AGENT_LLM_CALL",timestamp:C,title:`${$}: LLM Call`,source:$,target:"LLM",data:{llmCall:Le},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H});break}case"llm_response":{const ne=o.get(ce);if(ne){const y=new Date(C).getTime()-new Date(ne.timestamp).getTime();i(ce,$).llmCalls.push({modelName:ne.modelName,durationMs:y,timestamp:ne.timestamp}),o.delete(ce)}const xe=ge.data,Le=(tt=xe.content)==null?void 0:tt.parts,X=Le==null?void 0:Le.filter(y=>y.function_call);if(X&&X.length>0){N(M),v=null,E.delete(M);const y=X.map(Re=>{var Nt;return{functionCallId:Re.function_call.id,toolName:Re.function_call.name,toolArguments:Re.function_call.args||{},isPeerDelegation:(Nt=Re.function_call.name)==null?void 0:Nt.startsWith("peer_")}}),R={decisions:y,isParallel:y.length>1},Z=[],Ce=new Set;y.forEach(Re=>{if(Re.isPeerDelegation){const Nt=Re.toolName.substring(5);for(const xn in t){const Fe=t[xn];if(Ce.has(Fe.taskId))continue;if(Rp(Fe)===M&&Fe.events&&Fe.events.length>0){const yr=Fe.events.find(Sr=>{var ua,da,fa,pa;return Sr.direction==="request"&&((pa=(fa=(da=(ua=Sr.full_payload)==null?void 0:ua.params)==null?void 0:da.message)==null?void 0:fa.metadata)==null?void 0:pa.function_call_id)===Re.functionCallId});if(yr&&new Date(Ir(yr)).getTime()>=new Date(C).getTime()){const Sr={functionCallId:Re.functionCallId,peerAgentName:Nt,subTaskId:Fe.taskId};Z.push(Sr),S.set(Re.functionCallId,Sr),Fe.taskId&&(w.set(Fe.taskId,Re.functionCallId),Ce.add(Fe.taskId));break}}}}});const Ne={id:`vstep-tooldecision-${f.length}-${_}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:C,title:`LLM: Tool Decision${R.isParallel?" (Parallel)":""}`,source:"LLM",target:$,data:{toolDecision:R},rawEventIds:[_],delegationInfo:Z.length>0?Z:void 0,isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H};f.push(Ne);const pe=R.isParallel?Ne.id:void 0,he=ce;i(he,$),y.forEach(Re=>{var xn;const Nt=Re.isPeerDelegation?(xn=S.get(Re.functionCallId))==null?void 0:xn.subTaskId:void 0;s.has(Re.functionCallId)||s.set(Re.functionCallId,{timestamp:C,toolName:Re.toolName,isPeer:Re.isPeerDelegation,invokingAgentInstanceId:he,subTaskId:Nt,parallelBlockId:pe})})}else{const y=(Le==null?void 0:Le.filter(Z=>Z.text).map(Z=>Z.text).join(`
339
- `))||"",R={responsePreview:y.substring(0,200)+(y.length>200?"...":""),isFinalResponse:(xe==null?void 0:xe.partial)===!1};f.push({id:`vstep-llmrespagent-${f.length}-${_}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:C,title:`${$}: LLM Response`,source:"LLM",target:$,data:{llmResponseToAgent:R},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H})}break}case"tool_invocation_start":{const ne={functionCallId:ge.function_call_id,toolName:ge.tool_name,toolArguments:ge.tool_args,isPeerInvocation:(nt=ge.tool_name)==null?void 0:nt.startsWith("peer_")};f.push({id:`vstep-toolinvokestart-${f.length}-${_}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:C,title:`${$}: Executing tool ${ne.toolName}`,source:$,target:ne.toolName,data:{toolInvocationStart:ne},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H});break}case"tool_result":{const ne=ge.function_call_id,xe=s.get(ne);if(xe){const X=new Date(C).getTime()-new Date(xe.timestamp).getTime(),y=r.agents[xe.invokingAgentInstanceId];if(y){const R={toolName:xe.toolName,durationMs:X,isPeer:xe.isPeer,timestamp:xe.timestamp,peerAgentName:xe.isPeer?xe.toolName.substring(5):void 0,subTaskId:xe.subTaskId,parallelBlockId:xe.parallelBlockId};y.toolCalls.push(R)}s.delete(ne)}const Le={toolName:ge.tool_name,functionCallId:ne,resultData:ge.result_data,isPeerResponse:(rt=ge.tool_name)==null?void 0:rt.startsWith("peer_")};f.push({id:`vstep-toolresult-${f.length}-${_}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:C,title:`${$}: Tool Result - ${Le.toolName}`,source:Le.toolName,target:$,data:{toolResult:Le},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H});break}}}else me.kind==="text"&&me.text&&(g&&g!==$&&(N(M),v=null),g||(g=$,x=C,b=re),m+=me.text,h.push(_))}return}if(A.direction==="artifact_update"&&((le=D==null?void 0:D.result)!=null&&le.artifact)){N(M);const Se=D.result.artifact,U=((jt=Se.metadata)==null?void 0:jt.agent_name)||A.source_entity||"Agent";let G;if(Se.parts&&Se.parts.length>0){const re=Se.parts[0];re.kind==="file"?G=re.file.mimeType||void 0:(ht=re.metadata)!=null&&ht.mime_type&&(G=re.metadata.mime_type)}const $={artifactName:Se.name||"Unnamed Artifact",version:typeof((Rt=Se.metadata)==null?void 0:Rt.version)=="number"?Se.metadata.version:void 0,description:Se.description||void 0,mimeType:G};f.push({id:`vstep-artifactnotify-${f.length}-${_}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:C,title:`${U}: Artifact Update - ${$.artifactName}`,source:U,target:"User/System",data:{artifactNotification:$},rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H});return}if(["response","task"].includes(A.direction)&&((Ct=(Mt=D==null?void 0:D.result)==null?void 0:Mt.status)!=null&&Ct.state)){m.trim()&&N(M);const Se=D.result,U=Se.status.state,G=((Et=Se.metadata)==null?void 0:Et.agent_name)||((ft=(Xe=(Tt=Se.status)==null?void 0:Tt.message)==null?void 0:Xe.metadata)==null?void 0:ft.agent_name)||A.source_entity||"Agent";if(["completed","failed","canceled"].includes(U)&&J==0){const $=U==="completed"?"TASK_COMPLETED":"TASK_FAILED",re=`${G}: Task ${U.charAt(0).toUpperCase()+U.slice(1)}`;let ce={},me="";if((Pt=Se.status.message)!=null&&Pt.parts){const _e=Se.status.message.parts.find(ne=>ne.kind==="text");_e!=null&&_e.text&&(me=_e.text.trim())}const fe=M===n.taskId,ge=me&&(!fe||me!==v);if($==="TASK_COMPLETED")ce={finalMessage:ge?me:void 0};else{const ne={message:ge?me:`Task ${U}.`},xe=D.error;xe&&(ne.message=xe.message||ne.message,ne.code=xe.code,xe.data&&(ne.details=xe.data)),Se.error&&(ne.message=Se.error.message||ne.message,ne.code=Se.error.code||ne.code,ne.details=Se.error.data||ne.details),ce={errorDetails:ne}}f.push({id:`vstep-${U}-${f.length}-${_}`,type:$,timestamp:C,title:re,source:G,target:"User",data:ce,rawEventIds:[_],isSubTaskStep:J>0,nestingLevel:J,owningTaskId:M,functionCallId:H}),fe&&(v=null);return}}const O=A.direction==="status-update"&&((Ge=(De=(sn=(Lt=D==null?void 0:D.result)==null?void 0:Lt.status)==null?void 0:sn.message)==null?void 0:De.parts)==null?void 0:Ge.some(Se=>Se.kind==="text"));let W=A.source_entity;(Ft=(Ot=(gt=(Dt=D==null?void 0:D.result)==null?void 0:Dt.status)==null?void 0:gt.message)==null?void 0:Ot.metadata)!=null&&Ft.forwarded_from_peer?W=D.result.status.message.metadata.forwarded_from_peer:(pt=(Oe=D==null?void 0:D.result)==null?void 0:Oe.metadata)!=null&&pt.agent_name?W=D.result.metadata.agent_name:(zt=(At=(Yt=(an=D==null?void 0:D.result)==null?void 0:an.status)==null?void 0:Yt.message)==null?void 0:At.metadata)!=null&&zt.agent_name&&(W=D.result.status.message.metadata.agent_name),m.trim()&&g&&(!O||O&&W!==g)&&(N(M),l.get(((Kt=h[0])==null?void 0:Kt.split("-")[1])||n.taskId)===0&&!b&&(v=null))});const j=d.length>0&&d[d.length-1].task_id||n.taskId;N(j);const k=d[0]?Ir(d[0]):n.firstSeen.toISOString();let T,V="working";const F=f.filter(A=>A.owningTaskId===n.taskId),z=F.length>0?F[F.length-1]:null;if(z&&(z.type==="TASK_COMPLETED"?(V="completed",T=z.timestamp):z.type==="TASK_FAILED"&&(V="failed",T=z.timestamp)),V==="working"&&d.length>0){const A=d[d.length-1];t[A.task_id||n.taskId]}let q;k&&T&&(q=new Date(T).getTime()-new Date(k).getTime()),["completed","failed","canceled","rejected"].includes(V)&&(p=void 0);const Q={taskId:n.taskId,initialRequestText:n.initialRequestText,status:V,currentStatusText:p,startTime:k,endTime:T,durationMs:q,steps:f};Q.steps.forEach((A,B)=>{if(A.type==="TASK_COMPLETED"){let C="";for(let _=B-1;_>=0;_--){const D=Q.steps[_];if(D.type!=="AGENT_RESPONSE_TEXT"||D.source!==A.source)break;C=D.data.text+C}A.data.finalMessage&&(C+=A.data.finalMessage),A.data.finalMessage=C.trim()||void 0}}),Object.values(r.agents).forEach(A=>{A.totalLlmTimeMs=A.llmCalls.reduce((M,J)=>M+J.durationMs,0);const B=A.toolCalls.filter(M=>!M.parallelBlockId),C=new Map;A.toolCalls.forEach(M=>{M.parallelBlockId&&(C.has(M.parallelBlockId)||C.set(M.parallelBlockId,[]),C.get(M.parallelBlockId).push(M))});const _=B.reduce((M,J)=>M+J.durationMs,0);let D=0;C.forEach(M=>{if(M.length>0){const J=Math.min(...M.map(H=>new Date(H.timestamp).getTime())),L=Math.max(...M.map(H=>new Date(H.timestamp).getTime()+H.durationMs));D+=L-J}}),A.totalToolTimeMs=_+D});const P=new Map;Object.values(r.agents).forEach(A=>{P.has(A.agentName)||P.set(A.agentName,[]),P.get(A.agentName).push(A)}),P.forEach(A=>{A.length>1&&(A.sort((B,C)=>{const _=D=>{const M=[...D.llmCalls.map(J=>new Date(J.timestamp).getTime()),...D.toolCalls.map(J=>new Date(J.timestamp).getTime())];return M.length>0?Math.min(...M):1/0};return _(B)-_(C)}),A.forEach((B,C)=>{B.displayName=`${B.agentName} (${C+1})`}))});const Y=new Map;return Object.values(r.agents).forEach(A=>{const B=A.instanceId.split(":").slice(1).join(":");B&&Y.set(B,A.displayName)}),Object.values(r.agents).forEach(A=>{A.toolCalls.forEach(B=>{if(B.isPeer&&B.subTaskId){const C=Y.get(B.subTaskId);C&&(B.peerAgentName=C)}})}),q!==void 0&&(r.overall.totalTaskDurationMs=q),Q.performanceReport=r,Q},z1=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const s=i=>{r(i)};return a.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[a.jsx(B1,{onClick:o}),a.jsx(H1,{items:e,bottomItems:t,activeItem:n,onItemClick:s})]})},$1=a.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:[a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M14.3,82.5c0-4.4,1-8.2,2.9-11.3,1.9-3.1,4.4-5.7,7.5-7.8,3.1-2,6.5-3.6,10.4-4.6,3.8-1,7.7-1.5,11.5-1.5s7.1.3,10.2.9c3.1.6,5.9,1.5,8.2,2.6,2.4,1.1,4.2,2.4,5.6,3.8,1.4,1.4,2,3,2,4.6,0,2.4,0,4.3-.2,5.7-.1,1.4-.3,2.4-.6,3.1-.3.7-.7,1.1-1.1,1.3-.4.2-.9.2-1.6.2-1.8,0-3.2-.7-4.3-2-1.1-1.3-2.3-2.8-3.7-4.4-1.4-1.6-3.1-3.1-5.3-4.4-2.1-1.3-5.3-2-9.3-2s-4.4.3-6,.9c-1.6.6-2.9,1.5-3.8,2.5-.9,1-1.6,2.2-2,3.4-.4,1.2-.6,2.4-.6,3.5,0,2.5,1,4.4,3.1,5.7,2.1,1.3,4.7,2.3,7.8,3.2,3.1.9,6.5,1.7,10.1,2.5,3.6.8,7,1.9,10.1,3.4,3.1,1.5,5.8,3.5,7.9,6.1,2.1,2.6,3.1,6.1,3.1,10.5s-.8,8-2.5,11.3c-1.7,3.4-4,6.2-7,8.5-3,2.3-6.6,4.1-10.8,5.3-4.2,1.3-8.9,1.9-13.9,1.9s-8.8-.6-12.5-1.9c-3.7-1.3-6.9-2.8-9.6-4.6-2.7-1.8-4.7-3.7-6.2-5.6-1.5-1.9-2.2-3.5-2.2-4.7,0-1.8.5-3.6,1.6-5.3,1-1.8,2.6-2.7,4.7-2.7s2.5.4,3.5,1.2c.9.8,1.8,1.7,2.7,2.8.8,1.1,1.7,2.3,2.6,3.7.9,1.4,2,2.6,3.3,3.7,1.3,1.1,2.9,2,4.7,2.8,1.8.8,4.1,1.2,6.8,1.2,4.1,0,7.5-1,10.3-3.1,2.8-2.1,4.2-4.8,4.2-8s-1-4.9-3.1-6.4c-2-1.4-4.6-2.6-7.7-3.5-3.1-.9-6.4-1.7-10-2.4-3.6-.7-7-1.8-10-3.2-3.1-1.4-5.7-3.4-7.7-6-2-2.6-3.1-6.3-3.1-11"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M124.6,66.8c-4,0-7.3.9-9.9,2.7-2.6,1.8-4.7,4.2-6.4,7.1-1.6,2.9-2.8,6.1-3.5,9.7-.7,3.5-1,6.9-1,10.1,0,4.9.5,9.2,1.6,13,1,3.7,2.5,6.8,4.4,9.3,1.9,2.5,4.1,4.3,6.7,5.6,2.6,1.3,5.3,1.9,8.2,1.9s5.7-.6,8.2-1.9c2.6-1.3,4.8-3.1,6.7-5.6,1.9-2.5,3.3-5.5,4.4-9.3,1-3.7,1.6-8,1.6-13,0-9.5-1.9-16.9-5.8-22-3.9-5.1-8.9-7.7-15.2-7.7M82.2,96.5c0-5.8,1.1-11,3.3-15.9,2.2-4.8,5.2-8.9,9.1-12.4,3.9-3.5,8.4-6.1,13.6-8,5.2-1.9,10.7-2.8,16.6-2.8s11.4.9,16.6,2.8c5.2,1.9,9.7,4.6,13.5,8,3.8,3.5,6.9,7.6,9.1,12.4,2.2,4.8,3.4,10.1,3.4,15.9s-1.1,11.2-3.4,15.9c-2.3,4.8-5.3,8.9-9.1,12.3-3.8,3.5-8.3,6.1-13.5,8-5.2,1.9-10.7,2.8-16.6,2.8s-11.4-.9-16.6-2.8c-5.2-1.9-9.7-4.6-13.6-8-3.9-3.5-6.9-7.6-9.1-12.3-2.2-4.8-3.3-10.1-3.3-15.9"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M172.3,23.3c0-.8.9-1.8,2.7-2.8,1.8-1,4-2,6.5-2.9,2.5-.9,5.1-1.6,7.7-2.3,2.6-.6,4.7-.9,6.3-.9s1.3,0,1.9.2c.6.2,1.2.5,1.8,1.2.6.6,1,1.6,1.4,2.9.4,1.3.5,3.1.5,5.4v94.7c0,2.4.4,4.1,1.2,4.9.8.9,1.6,1.5,2.5,2,.9.4,1.7.8,2.5,1.3.8.4,1.2,1.4,1.2,2.8s-.5,2.5-1.6,3.2c-1,.7-2.4,1-3.9,1h-24.2c-1.6,0-2.9-.3-3.9-1-1-.7-1.6-1.8-1.6-3.2s.4-2.3,1.2-2.7c.8-.5,1.6-.9,2.5-1.3.9-.4,1.7-1.1,2.5-2,.8-.9,1.2-2.5,1.2-4.9V34.5c0-2-.4-3.4-1.3-4.2-.9-.8-1.9-1.4-2.9-1.9-1-.5-2-1-2.9-1.6-.9-.6-1.3-1.8-1.3-3.5"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M254.4,93.3c-3.7,1.2-6.8,2.8-9.4,4.7-2.6,1.9-4.6,4.1-6,6.6-1.4,2.5-2.1,5-2.1,7.6s.3,3.6,1,5.3c.7,1.8,1.6,3.4,2.9,4.7,1.3,1.4,2.7,2.5,4.5,3.3,1.7.8,3.6,1.3,5.7,1.3s5.2-.7,7.2-2c2-1.3,3.6-2.9,4.9-4.7,1.3-1.8,2.2-3.7,2.7-5.7.6-1.9.9-3.6.9-4.9v-18.2c-4.5.1-8.6.8-12.2,2M220.5,69.7c0-1.9.9-3.6,2.6-5.1,1.7-1.5,4-2.8,6.8-3.8,2.8-1,6-1.9,9.5-2.4,3.5-.6,7-.9,10.4-.9,7,0,12.9.8,17.6,2.3,4.7,1.5,8.5,3.6,11.5,6.1,2.9,2.6,5,5.5,6.3,8.7,1.3,3.2,1.9,6.6,1.9,10v34.5c0,1.9.4,3.2,1.3,4.1.8.8,1.7,1.5,2.7,2,.9.5,1.8,1,2.7,1.5.8.5,1.3,1.4,1.3,2.7s-.4,2.5-1.2,3.4c-.8.9-2.7,1.3-5.7,1.3h-13.2c-2.4,0-4.1-.5-5.1-1.6-1-1-1.5-2.8-1.5-5.2v-1.7h-.6c-2.4,3.5-5.9,6-10.4,7.6-4.6,1.6-9.3,2.4-14.4,2.4s-8.5-.6-11.9-1.9c-3.4-1.3-6.3-3-8.6-5.1-2.4-2.1-4.1-4.6-5.3-7.5-1.2-2.8-1.8-5.8-1.8-8.8,0-5.2,1.6-9.7,4.8-13.5,3.2-3.8,7.3-6.8,12.2-9.2,5-2.4,10.5-4.1,16.6-5.2,6.1-1.1,12-1.6,17.9-1.6,0-4.7-1.3-8.6-4-11.5-2.7-3-6.6-4.5-11.7-4.5s-5.7.5-7.5,1.4c-1.9.9-3.6,2-5.1,3.1-1.5,1.2-3.1,2.2-4.7,3.1-1.6.9-3.7,1.4-6.2,1.4s-3.8-.5-5-1.6c-1.3-1.1-1.9-2.6-1.9-4.6"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M301.5,97.6c0-5.9,1-11.3,3.1-16.2,2.1-4.9,4.9-9.2,8.6-12.7,3.6-3.6,7.9-6.3,12.9-8.3,5-2,10.4-3,16.2-3s7.2.4,10.8,1.3c3.5.9,6.6,2.1,9.3,3.5,2.7,1.5,4.9,3.2,6.5,5.2,1.6,2,2.4,4.1,2.4,6.3s-.9,4.1-2.7,5.5c-1.8,1.4-4.2,2-7.2,2s-4.1-.8-5.3-2.4c-1.2-1.6-2.4-3.4-3.5-5.3-1.1-1.9-2.4-3.6-4-5.3-1.6-1.6-3.9-2.4-7.1-2.4s-5.2.8-7.5,2.3c-2.3,1.5-4.2,3.7-5.9,6.5-1.7,2.8-3,6.2-3.8,10-.9,3.9-1.3,8.2-1.3,12.9s.6,7.9,1.8,11.2c1.2,3.3,2.8,6.1,4.8,8.4,2,2.3,4.3,4.1,6.9,5.3,2.6,1.2,5.4,1.8,8.3,1.8s6.9-.6,9.4-1.9c2.5-1.3,4.7-2.6,6.4-4.2,1.8-1.5,3.3-2.9,4.6-4.2,1.3-1.3,2.6-1.9,4-1.9s2,.3,2.7,1c.8.7,1.2,1.6,1.2,2.7,0,1.7-.8,3.6-2.5,5.9-1.7,2.3-4,4.4-6.9,6.4-2.9,2-6.4,3.8-10.4,5.2-4,1.4-8.4,2.1-13.1,2.1s-10.7-.9-15.5-2.7c-4.8-1.8-8.9-4.4-12.3-7.8-3.5-3.3-6.2-7.4-8.2-12-2-4.7-3-9.8-3-15.5"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M423.2,65.9c-3.4,0-6.3.7-8.9,2.2-2.6,1.5-4.9,3.5-6.8,6.1-1.9,2.6-3.3,5.8-4.3,9.4-1,3.7-1.5,7.7-1.5,12.1v.9c3.5-.3,7.1-.9,11-1.7,3.9-.8,7.4-2,10.7-3.5,3.2-1.5,5.9-3.4,8.1-5.7,2.1-2.4,3.2-5.3,3.2-8.7s-.9-5.9-2.7-8c-1.8-2.1-4.7-3.1-8.7-3.1M380,98.4c0-5.7.9-11,2.7-15.9,1.8-5,4.5-9.3,8.2-13,3.7-3.7,8.3-6.6,13.9-8.8,5.6-2.1,12.2-3.2,19.9-3.2s6.8.4,10.4,1.2c3.6.8,6.8,2,9.8,3.8,3,1.7,5.4,4,7.4,6.8,1.9,2.8,2.9,6.1,2.9,10s-1.6,9-4.9,12.2c-3.3,3.2-7.5,5.8-12.6,7.7-5.1,1.9-10.8,3.4-16.9,4.3-6.1.9-12,1.6-17.7,1.9.5,3.1,1.5,5.9,2.9,8.3,1.4,2.4,3.1,4.4,5.2,6,2,1.6,4.2,2.8,6.6,3.6,2.4.8,4.7,1.2,7.1,1.2s5-.3,7.2-.9c2.2-.6,4.2-1.3,6-2.3,1.8-.9,3.5-2,4.9-3.1,1.5-1.1,2.8-2.2,3.9-3.2,1-1,2-1.9,2.8-2.4.8-.6,1.8-.9,3-.9,2.4,0,3.6,1.2,3.6,3.6s-1,4-3,6.4c-2,2.4-4.7,4.6-8,6.7-3.4,2-7.2,3.8-11.5,5.2-4.3,1.4-8.9,2.1-13.7,2.1s-10.9-.9-15.8-2.8c-4.9-1.9-9.1-4.5-12.7-7.8-3.6-3.3-6.4-7.2-8.5-11.8-2-4.6-3.1-9.5-3.1-14.8"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M464.7,123.7c0-6.5,5.3-11.8,11.8-11.8s11.8,5.3,11.8,11.8-5.3,11.8-11.8,11.8-11.8-5.3-11.8-11.8"})]}),B1=({onClick:e})=>a.jsx("div",{className:"flex h-[80px] min-h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:a.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:$1})}),U1=()=>{const{currentTheme:e,toggleTheme:t}=id(),n=`Toggle theme (currently ${e})`;return a.jsxs(zi,{children:[a.jsx($i,{asChild:!0,children:a.jsx("button",{type:"button",onClick:t,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":n,title:n,children:a.jsx(ic,{className:"mb-1 h-6 w-6"})})}),a.jsx(Bi,{side:"right",children:n})]})},H1=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>a.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[a.jsx("ul",{className:"space-y-1",children:e.map(o=>a.jsxs("li",{children:[a.jsx(zl,{item:o,isActive:n===o.id,onItemClick:r}),o.showDividerAfter&&a.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},o.id))}),t&&t.length>0&&a.jsx("div",{className:"flex-1"}),t&&t.length>0&&a.jsx("ul",{className:"space-y-1",children:t.map(o=>a.jsx("li",{className:"my-4",children:o.id==="theme-toggle"?a.jsx(U1,{}):a.jsx(zl,{item:o,isActive:n===o.id,onItemClick:r},o.id)},o.id))})]}),zl=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:s,disabled:i}=e,l=()=>{!i&&n&&n(r)},c=d=>{(d.key==="Enter"||d.key===" ")&&l()};return a.jsxs(zi,{children:[a.jsx($i,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:n?l:void 0,onKeyDown:n?c:void 0,disabled:i,className:be("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)]":""),"aria-label":o,"aria-current":t?"page":void 0,children:[a.jsx(s,{className:be("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),a.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})}),a.jsx(Bi,{side:"right",children:o})]})},$l=[{id:"chat",label:"Chat",icon:Ql},{id:"agentMesh",label:"Agents",icon:ac}],Bl=[{id:"theme-toggle",label:"Theme",icon:ic,onClick:()=>{}}],Pp=({title:e,breadcrumbs:t,tabs:n,buttons:r,leadingAction:o})=>a.jsxs("div",{className:"relative flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[t&&t.length>0&&a.jsx("div",{className:"absolute top-1 left-8 flex h-8 items-center",children:t.map((s,i)=>a.jsxs(Ut.Fragment,{children:[i>0&&a.jsx("span",{className:"mx-1",children:a.jsx(wm,{size:16})}),s.onClick?a.jsx(we,{variant:"link",className:"m-0 p-0",onClick:s.onClick,children:s.label}):a.jsx("div",{children:s.label})]},i))}),o&&a.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:o}),a.jsx("div",{className:"truncate pt-[35px] text-xl text-nowrap",children:e}),n&&n.length>0&&a.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:n.map((s,i)=>a.jsxs("button",{role:"tab","aria-selected":s.isActive,onClick:s.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${s.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[s.label,s.isActive&&a.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},s.id))}),a.jsx("div",{className:"flex-1"}),r&&r.length>0&&a.jsx("div",{className:"flex items-center gap-2 pt-[35px]",children:r.map((s,i)=>a.jsx(Ut.Fragment,{children:s},i))})]}),at=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:a.jsxs("div",{className:`mb-1.5 flex text-sm ${r?"flex-col items-start":"items-center"}`,children:[a.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&a.jsx("span",{className:"mr-2",children:n}),e,":"]}),a.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),W1=({agent:e,isExpanded:t,onToggleExpand:n})=>{const r=l=>!l||Object.keys(l).length===0?a.jsx("span",{className:"text-sm",children:"N/A"}):a.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(l).map(([c,d])=>a.jsxs("li",{className:"text-sm",children:[a.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",d?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?a.jsx("span",{children:c}):l.map(d=>a.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:d},d)),s=l=>!l||l.length===0?a.jsx("span",{children:"No skills listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold",children:c.name}),a.jsx("p",{children:c.description})]},c.id||c.name))}),i=l=>!l||l.length===0?a.jsx("span",{children:"No tools listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"text-foreground font-semibold",children:c.name}),a.jsx("p",{className:"mb-1",children:c.description})]},c.name))});return a.jsx("div",{className:"bg-card h-[400px] w-full flex-shrink-0 cursor-pointer rounded-lg sm:w-[380px]",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:a.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:[a.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:[a.jsx("div",{className:"flex items-center p-4",children:a.jsxs("div",{className:"flex min-w-0 items-center",children:[a.jsx(ac,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),a.jsx("div",{className:"min-w-0",children:a.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.displayName||e.name})})]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[a.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description||"No description provided."}),a.jsx(at,{label:"Version",value:e.version,icon:a.jsx(wa,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&a.jsx(at,{label:"Key Capabilities",value:r(e.capabilities),icon:a.jsx(ba,{size:14}),fullWidthValue:!0})]}),a.jsx("div",{className:"text-accent-foreground border-t p-2 text-center text-sm",children:"Click for details"})]}),a.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:[a.jsx("div",{className:"flex items-center p-3",children:a.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.displayName||e.name]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[a.jsx(at,{label:"Name",value:e.name,icon:a.jsx(Ci,{size:14})}),a.jsx(at,{label:"Description",value:e.description,icon:a.jsx(bm,{size:14}),fullWidthValue:!0}),a.jsx(at,{label:"Version",value:e.version,icon:a.jsx(wa,{size:14})}),a.jsx(at,{label:"Endpoint",value:e.url||"N/A",icon:a.jsx(sc,{size:14})}),a.jsx(at,{label:"Docs",value:e.documentationUrl?a.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:a.jsx(Xl,{size:14})}),e.provider&&a.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[a.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),a.jsx(at,{label:"Name",value:e.provider.organization}),a.jsx(at,{label:"URL",value:e.provider.url||"N/A"})]}),a.jsx(at,{label:"Capabilities",value:r(e.capabilities),icon:a.jsx(ba,{size:14}),fullWidthValue:!0}),a.jsx(at,{label:"Input Modes",value:o(e.defaultInputModes),icon:a.jsx(ya,{size:14}),fullWidthValue:!0}),a.jsx(at,{label:"Output Modes",value:o(e.defaultOutputModes),icon:a.jsx(ya,{size:14}),fullWidthValue:!0}),a.jsx(at,{label:"Skills",value:s(e.skills),icon:a.jsx(ym,{size:14}),fullWidthValue:!0}),a.jsx(at,{label:"Tools Info",value:i(e.tools),icon:a.jsx(Jl,{size:14}),fullWidthValue:!0}),a.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:a.jsx(at,{label:"A2A Protocol",value:e.protocolVersion})})]}),a.jsx("div",{className:"text-accent-foreground border-t p-2 text-center text-sm",children:"Click for summary"})]})]})})},hi=({agents:e})=>{const[t,n]=u.useState(null),[r,o]=u.useState(""),s=l=>{n(c=>c===l?null:l)},i=e.filter(l=>{var c;return(c=l.displayName||l.name)==null?void 0:c.toLowerCase().includes(r.toLowerCase())});return a.jsx("div",{children:e.length===0?a.jsx("div",{className:"flex h-[calc(100vh-250px)] items-center justify-center",children:"No agents discovered in the current namespace."}):a.jsxs("div",{className:"mx-auto mt-[50px] ml-[50px]",children:[a.jsx("div",{className:"my-4",children:a.jsx("input",{type:"text","data-testid":"agent-search-input",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background rounded-md border px-3 py-2"})}),i.length===0&&r?a.jsxs("div",{className:"flex h-[calc(100vh-250px)] flex-col items-center justify-center gap-6",children:["No agents match your search.",a.jsx(we,{variant:"outline",title:"Clear Search",onClick:()=>o(""),children:"Clear Search"})]}):a.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:a.jsx("div",{className:"flex flex-wrap gap-10",children:i.map(l=>a.jsx(W1,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>s(l.name)},l.name))})})]})})},Lp={LAYOUT:"layout"};class G1{constructor(){ma(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:Lp.LAYOUT,id:"cards",label:"Cards",icon:Sm,priority:100,render:t=>a.jsx(hi,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const Dp=new G1,V1=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=Dp.getPluginsByType(Lp.LAYOUT);return r&&r.length>1?a.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[a.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),a.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const s=o.icon,i=e===o.id;return a.jsxs(we,{variant:"ghost",size:"sm",onClick:()=>t(o.id),title:o.label,className:i?"bg-[var(--color-secondary-w20)] dark:bg-[var(--color-secondary-w80)]":"",children:[s&&a.jsx(s,{size:14}),a.jsx("span",{children:o.label})]},o.id)})})]}):null},Ul={CARDS:"cards"};function Y1(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=He(),[o,s]=u.useState("cards");if(t)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx("div",{children:"Loading agents..."})})});if(n)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx(la,{variant:"error",message:`Error loading agents. ${n}`})})});const i=()=>{if(o===Ul.CARDS)return a.jsx(hi,{agents:e});const l=Dp.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),a.jsx(hi,{agents:e}))};return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(Pp,{title:"Agents",buttons:[a.jsxs(we,{variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[a.jsx(nc,{className:"size-4"}),"Refresh Agents"]})]}),a.jsxs("div",{className:`relative flex-1 p-4 ${o===Ul.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[a.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:a.jsx(V1,{currentLayout:o,onLayoutChange:s})}),i()]})]})}const K1=({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?a.jsx(Ko,{open:e,onOpenChange:t,children:a.jsxs(qo,{children:[a.jsxs(Xo,{children:[a.jsx(Zo,{children:"Delete Chat Session?"}),a.jsxs(Jo,{children:["This action cannot be undone. This chat session and any associated artifacts will be permanently deleted: ",a.jsx("strong",{children:r})]})]}),a.jsxs(zv,{children:[a.jsx(we,{variant:"outline",onClick:t,title:"Cancel",children:"Cancel"}),a.jsx(we,{onClick:n,title:"Delete",children:"Delete"})]})]})}):null,po=4,gi={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},q1={chatPanelSizes:{...gi.chatPanelSizes,min:50},sidePanelSizes:{...gi.sidePanelSizes,max:50}};function X1(){var H;const{agents:e,sessionId:t,messages:n,setMessages:r,selectedAgentName:o,setSelectedAgentName:s,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,openSidePanelTab:c,setTaskIdInSidePanel:d,isResponding:f,latestStatusText:p,sessionToDelete:m,closeSessionDeleteModal:g,confirmSessionDelete:x,sessionName:h}=He(),{isTaskMonitorConnected:v,isTaskMonitorConnecting:b,taskMonitorSseError:w,connectTaskMonitorStream:S}=Xi(),[E,N]=u.useState(!0),[j,k]=u.useState(!1),[T,V]=u.useState(!1),F=u.useRef(null),z=u.useRef(null),q=u.useRef(null),{chatPanelSizes:Q,sidePanelSizes:P}=u.useMemo(()=>E?gi:q1,[E]),Y=u.useCallback(O=>{if(k(!0),z.current)if(O)z.current.resize(po);else{const W=q.current||P.default;z.current.resize(W)}setTimeout(()=>k(!1),300)},[P.default]),A=u.useCallback(()=>{l(!0)},[l]),B=u.useCallback(()=>{l(!1)},[l]),C=u.useCallback(O=>{O>po+1&&(q.current=O)},[]),_=u.useCallback(()=>{N(!E)},[E]);u.useEffect(()=>{z.current&&i&&z.current.resize(po);const O=()=>{if(z.current&&i){k(!0);const W=q.current||P.default;z.current.resize(W),l(!1),setTimeout(()=>k(!1),300)}};return window.addEventListener("expand-side-panel",O),()=>{window.removeEventListener("expand-side-panel",O)}},[i,l,P.default]),u.useEffect(()=>{if(!o&&e.length>0){const O=e.find(ee=>ee.name==="OrchestratorAgent"),W=O?O.name:e[0].name;s(W);const I=e.find(ee=>ee.name===W),K=I!=null&&I.displayName?`Hi! I'm the ${I==null?void 0:I.displayName} Agent. How can I help?`:`Hi! I'm ${W}. How can I help?`;r(ee=>[...ee.filter(ae=>!ae.isStatusBubble),{role:"agent",kind:"message",messageId:`welcome-${Date.now()}`,parts:[{kind:"text",text:K}],isUser:!1,isComplete:!0,metadata:{sessionId:t,lastProcessedEventSequence:0}}])}},[e,o,t,r,s]);const D=u.useMemo(()=>{const O=new Map;return n.forEach((W,I)=>{W.taskId&&O.set(W.taskId,I)}),O},[n]),M=u.useMemo(()=>n.find(O=>O.isStatusBubble),[n]),J=u.useMemo(()=>{if(!M||!M.parts)return null;const O=M.parts.find(W=>W.kind==="text");return(O==null?void 0:O.text)||null},[M]),L=u.useMemo(()=>{if(M!=null&&M.taskId)return()=>{d(M.taskId),c("workflow")}},[M==null?void 0:M.taskId,d,c]);return u.useEffect(()=>{const O=()=>{!v&&!b&&w&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),S())};return window.addEventListener("focus",O),()=>{window.removeEventListener("focus",O)}},[v,b,w,S]),a.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[a.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${E?"-translate-x-full":"translate-x-0"}`,children:a.jsx(o1,{onToggle:_})}),a.jsx("div",{className:`transition-all duration-300 ${E?"ml-0":"ml-100"}`,children:a.jsx(Pp,{title:h||"New Chat",leadingAction:E?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(we,{variant:"ghost",onClick:_,className:"h-10 w-10 p-0",tooltip:"Show Sessions Panel",children:a.jsx(rc,{className:"size-5"})}),a.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),a.jsx(we,{variant:"ghost",onClick:()=>V(!0),className:"h-10 w-10 p-0",tooltip:"Start New Chat Session",children:a.jsx(oc,{className:"size-5"})})]}):null})}),a.jsx("div",{className:"flex min-h-0 flex-1",children:a.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${E?"ml-0":"ml-100"}`,children:a.jsxs(mw,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[a.jsx(ll,{defaultSize:Q.default,minSize:Q.min,maxSize:Q.max,id:"chat-panel",children:a.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[a.jsx(wf,{className:"text-base",ref:F,children:n.map((O,W)=>{var K;const I=!!(O.taskId&&D.get(O.taskId)===W);return a.jsx(LC,{message:O,isLastWithTaskId:I},`${((K=O.metadata)==null?void 0:K.sessionId)||"session"}-${W}-${O.isUser?"received":"sent"}`)})}),a.jsxs("div",{style:vf,children:[f&&a.jsx(fi,{statusText:(J||p.current)??void 0,onViewWorkflow:L}),a.jsx(hb,{agents:e,scrollToBottom:(H=F.current)==null?void 0:H.scrollToBottom})]})]})}),a.jsx(hw,{}),a.jsx(ll,{ref:z,defaultSize:P.default,minSize:P.min,maxSize:P.max,collapsedSize:po,collapsible:!0,onCollapse:A,onExpand:B,onResize:C,id:"chat-side-panel",className:j?"transition-all duration-300 ease-in-out":"",children:a.jsx("div",{className:"h-full",children:a.jsx(r1,{onCollapsedToggle:Y,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,isSidePanelTransitioning:j})})})]})})}),a.jsx(Tp,{isOpen:T,onClose:()=>V(!1)}),a.jsx(K1,{isOpen:!!m,onClose:g,onConfirm:x,sessionName:(m==null?void 0:m.name)||`Session ${m==null?void 0:m.id.substring(0,8)}`})]})}const Z1=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)"}}),xi=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=id(),o=u.useMemo(()=>Z1(r==="dark"),[r]),s=u.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=u.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),l=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?a.jsx("div",{className:l,children:a.jsx("span",{className:"italic",children:"No JSON data"})}):a.jsx("div",{className:l,children:a.jsx(Cm,{data:i,theme:o,viewOnly:!0,collapse:s,showStringQuotes:!0,showCollectionCount:"when-closed"})})};let mo=null,ho=null;function J1({children:e}){const{fetchCsrfToken:t}=od(),[n,r]=u.useState(mo),[o,s]=u.useState(!mo&&!ho),[i,l]=u.useState(ho);return u.useEffect(()=>{if(mo||ho)return;let c=!0;return(async()=>{s(!0),l(null);try{let f=await ze("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),p;if(f.ok)p=await f.json();else{const x=await f.text();if(console.error("Initial config fetch failed:",f.status,x),f.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const h=await t();if(!h)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),f=await ze("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":h,Accept:"application/json"}}),!f.ok){const v=await f.text();throw console.error("Config fetch retry failed:",f.status,v),new Error(`Failed to fetch config on retry: ${f.status} ${v}`)}p=await f.json()}else throw new Error(`Failed to fetch config: ${f.status} ${x}`)}const m=p.frontend_use_authorization??!1;m&&(console.log("Fetching CSRF token for config-related requests..."),await t());const g={configServerUrl:p.frontend_server_url,configAuthLoginUrl:p.frontend_auth_login_url,configUseAuthorization:m,configWelcomeMessage:p.frontend_welcome_message,configRedirectUrl:p.frontend_redirect_url,configCollectFeedback:p.frontend_collect_feedback,configBotName:p.frontend_bot_name,configFeatureEnablement:p.frontend_feature_enablement??{},frontend_use_authorization:p.frontend_use_authorization,persistenceEnabled:p.persistence_enabled??!0};c&&(mo=g,r(g)),console.log("App config processed and set:",g)}catch(f){if(console.error("Error initializing app:",f),c){const p=f.message||"Failed to load application configuration.";ho=p,l(p)}}finally{c&&s(!1)}})(),()=>{c=!1}},[t]),n?a.jsx(Qu.Provider,{value:n,children:e}):o?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):i?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-red-100 dark:bg-red-900",children:a.jsxs("div",{className:"rounded border border-red-400 bg-white p-4 text-center dark:bg-gray-800",children:[a.jsx("h1",{className:"text-xl font-bold text-red-700 dark:text-red-300",children:"Configuration Error"}),a.jsx("p",{className:"mt-2 text-red-600 dark:text-red-200",children:i}),a.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."})]})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const Q1=({children:e})=>{const{configServerUrl:t}=on(),n=`${t}/api/v1`,[r,o]=u.useState(null),[s,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[p,m]=u.useState({}),[g,x]=u.useState([]),[h,v]=u.useState(null),[b,w]=u.useState(0),[S,E]=u.useState(!1),N=10,j=u.useRef(null),k=u.useRef(null),T=u.useRef(null);u.useEffect(()=>{k.current=r},[r]);const V=u.useCallback(C=>{m(_=>{var L,H,O;const D=C.task_id;if(!D)return C.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",C),_;const M=_[D],J=new Date(C.timestamp);if(M){const W=[...M.events,C].sort((I,K)=>new Date(I.timestamp).getTime()-new Date(K.timestamp).getTime());return{..._,[D]:{...M,events:W,lastUpdated:J}}}else{let W="Task started...";if(C.direction==="request"&&((H=(L=C.full_payload)==null?void 0:L.method)!=null&&H.startsWith("message/"))){const K=C.full_payload.params;if((O=K==null?void 0:K.message)!=null&&O.parts){const ee=K.message.parts.filter(te=>te.kind==="text"&&te.text);ee.length>0&&(W=ee[ee.length-1].text)}}const I={taskId:D,initialRequestText:W,events:[C],firstSeen:J,lastUpdated:J};return x(K=>[D,...K.filter(ee=>ee!==D)]),{..._,[D]:I}}})},[]),F=u.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),f(null),w(0),E(!1),T.current&&(clearTimeout(T.current),T.current=null)},[]),z=u.useCallback(C=>{try{const _=JSON.parse(C.data);V(_)}catch(_){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",_,"Raw data:",C.data),f("Received unparseable 'a2a_message' event from server.")}},[V]),q=u.useCallback(C=>{console.error("TaskMonitorContext: SSE connection error:",C),i(!1),c(!1),j.current&&j.current.readyState===EventSource.CLOSED?f("Task Monitor SSE connection closed by server or network issue."):f("Task Monitor SSE connection error occurred."),j.current&&(j.current.close(),j.current=null),T.current&&(clearTimeout(T.current),T.current=null)},[]),Q=u.useCallback(async()=>{if(l||s){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),i(!0);try{const C={subscription_targets:[{type:"my_a2a_messages"}]},_=await ze(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C),credentials:"include"});if(!_.ok){const O=await _.json().catch(()=>({detail:"Failed to subscribe"}));if(O.error_type==="authorization_failure"){const W=O.message||"Access denied: insufficient permissions",I=O.suggested_action?` ${O.suggested_action}`:"";throw new Error(`${W}${I}`)}else if(O.error_type==="subscription_failure"){const W=O.message||"Subscription failed",I=O.suggested_action?` ${O.suggested_action}`:"";throw new Error(`${W}${I}`)}else throw new Error(O.detail||O.message||`Subscription failed: ${_.statusText}`)}const D=await _.json();o(D.stream_id);const M=D.sse_endpoint_url.startsWith("/")?`${t||""}${D.sse_endpoint_url}`:D.sse_endpoint_url;j.current&&j.current.close();const J=Ei(),L=`${M}${J?`?token=${J}`:""}`,H=new EventSource(L,{withCredentials:!0});j.current=H,H.onopen=F,H.addEventListener("a2a_message",z),H.onerror=q}catch(C){console.error("TaskMonitorContext: Error connecting stream:",C),f(C instanceof Error?C.message:String(C)),i(!1),c(!1),o(null),j.current&&(j.current.close(),j.current=null),T.current&&(clearTimeout(T.current),T.current=null)}},[n,t,l,s,F,z,q]),P=u.useCallback(()=>{if(T.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(b>=N){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),E(!1),f(`Connection lost. Max reconnection attempts (${N}) reached.`);return}const C=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${b+1}/${N} in ${C}ms...`),E(!0),w(_=>_+1),T.current=setTimeout(()=>{Q()},C)},[b,Q]),Y=u.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),T.current&&(clearTimeout(T.current),T.current=null),j.current&&(j.current.close(),j.current=null);const C=k.current;if(C)try{await ze(`${n}/visualization/${C}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(_){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${C}`,_)}o(null),i(!1),c(!1),f(null),m({}),x([]),v(null),w(0),E(!1)},[n]);u.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),j.current&&(j.current.close(),j.current=null);const C=k.current;if(C)if(navigator.sendBeacon){const _=new FormData;navigator.sendBeacon(`${n}/visualization/${C}/unsubscribe`,_)}else ze(`${n}/visualization/${C}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(_=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",_))},[n]),u.useEffect(()=>{!l&&!s&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),Q())},[]),u.useEffect(()=>{!l&&!s&&d&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),P())},[l,s,d,P]),u.useEffect(()=>()=>{T.current&&(clearTimeout(T.current),T.current=null)},[]);const A=u.useCallback(C=>{v(C)},[]),B={isTaskMonitorConnecting:s,isTaskMonitorConnected:l,taskMonitorSseError:d,monitoredTasks:p,monitoredTaskOrder:g,highlightedStepId:h,isReconnecting:S,reconnectionAttempts:b,connectTaskMonitorStream:Q,disconnectTaskMonitorStream:Y,setHighlightedStepId:A};return a.jsx(td.Provider,{value:B,children:e})},Ze=[];for(let e=0;e<256;++e)Ze.push((e+256).toString(16).slice(1));function eE(e,t=0){return(Ze[e[t+0]]+Ze[e[t+1]]+Ze[e[t+2]]+Ze[e[t+3]]+"-"+Ze[e[t+4]]+Ze[e[t+5]]+"-"+Ze[e[t+6]]+Ze[e[t+7]]+"-"+Ze[e[t+8]]+Ze[e[t+9]]+"-"+Ze[e[t+10]]+Ze[e[t+11]]+Ze[e[t+12]]+Ze[e[t+13]]+Ze[e[t+14]]+Ze[e[t+15]]).toLowerCase()}let $s;const tE=new Uint8Array(16);function nE(){if(!$s){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");$s=crypto.getRandomValues.bind(crypto)}return $s(tE)}const rE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hl={randomUUID:rE};function oE(e,t,n){var o;e=e||{};const r=e.random??((o=e.rng)==null?void 0:o.call(e))??nE();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,eE(r)}function cn(e,t,n){return Hl.randomUUID&&!e?Hl.randomUUID():oE(e)}const Wl=1*1024*1024,Gl=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result.split(",")[1]),r.onerror=o=>n(o)}),sE=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n,persistenceEnabled:r}=on(),o=u.useMemo(()=>`${n}/api/v1`,[n]),[s,i]=u.useState(""),[l,c]=u.useState([]),[d,f]=u.useState(""),[p,m]=u.useState(!1),[g,x]=u.useState([]),[h,v]=u.useState(null),b=u.useRef(null),[w,S]=u.useState(""),[E,N]=u.useState(!1),[j,k]=u.useState(null),T=u.useRef(null),V=u.useRef(!1),F=u.useRef(null),z=u.useRef(0),q=u.useRef(E);u.useEffect(()=>{q.current=E},[E]);const{agents:Q,error:P,isLoading:Y,refetch:A}=rd(),{artifacts:B,isLoading:C,refetch:_}=_w(s),[D,M]=u.useState(!0),[J,L]=u.useState("files"),[H,O]=u.useState(!1),[W,I]=u.useState(null),[K,ee]=u.useState(!1),[te,ae]=u.useState(new Set),[ie,de]=u.useState(!1),[ye,Ie]=u.useState(null),[je,Pe]=u.useState(null),[Me,Be]=u.useState(null),[yt,We]=u.useState(null),[St,tt]=u.useState(null),[nt,rt]=u.useState(null),le=u.useCallback((U,G)=>{x($=>{if($.find(fe=>fe.message===U))return $;const ce=Date.now().toString(),me={id:ce,message:U,type:G||"info"};return setTimeout(()=>{x(fe=>fe.filter(ge=>ge.id!==ce))},3e3),[...$,me]})},[]),jt=u.useCallback(async U=>{const G=await ze(`${o}/sessions/${U}/messages`);if(!G.ok){const $=await G.json().catch(()=>({detail:"Failed to fetch session history"}));throw new Error($.detail||`HTTP error ${G.status}`)}return G.json()},[o]),ht=u.useCallback(async(U,G)=>{const $=G||s,re=new FormData;re.append("upload_file",U),re.append("filename",U.name),$&&re.append("sessionId",$);try{const ce=await ze(`${o}/artifacts/upload`,{method:"POST",body:re,credentials:"include"});if(!ce.ok){const ge=await ce.json().catch(()=>({detail:`Failed to upload ${U.name}`}));throw new Error(ge.detail||`HTTP error ${ce.status}`)}const me=await ce.json(),fe=me.data||me;return le(`Artifact "${U.name}" uploaded successfully.`),await _(),{uri:fe.uri,sessionId:fe.sessionId}}catch(ce){return le(`Error uploading artifact "${U.name}": ${ce instanceof Error?ce.message:"Unknown error"}`),null}},[o,s,le,_]),Rt=u.useCallback(async U=>{try{const G=await ze(`${o}/artifacts/${s}/${encodeURIComponent(U)}`,{method:"DELETE",credentials:"include"});if(!G.ok&&G.status!==204){const $=await G.json().catch(()=>({detail:`Failed to delete ${U}`}));throw new Error($.detail||`HTTP error ${G.status}`)}le(`File "${U}" deleted successfully.`),_()}catch(G){le(`Error deleting file "${U}": ${G instanceof Error?G.message:"Unknown error"}`)}},[o,s,le,_]),Mt=u.useCallback(U=>{I(U),O(!0)},[]),Ct=u.useCallback(()=>{I(null),O(!1)},[]),Et=u.useCallback(async()=>{W&&await Rt(W.filename),Ct()},[W,Rt,Ct]),Tt=u.useCallback(()=>{if(te.size===0){le("No files selected for deletion.");return}de(!0)},[te,le]),Xe=u.useCallback(async()=>{de(!1);const U=Array.from(te);let G=0,$=0;for(const re of U)try{const ce=await ze(`${o}/artifacts/${encodeURIComponent(re)}`,{method:"DELETE",credentials:"include"});if(!ce.ok&&ce.status!==204)throw new Error(`Failed to delete ${re}`);G++}catch(ce){console.error(ce),$++}G>0&&le(`${G} files(s) deleted successfully.`),$>0&&le(`Failed to delete ${$} files(s).`),_(),ae(new Set),ee(!1)},[te,o,le,_]),ft=u.useCallback(async U=>{Pe(null),Be(null),We(null);try{const G=await ze(`${o}/artifacts/${s}/${encodeURIComponent(U)}/versions`,{credentials:"include"});if(!G.ok)throw new Error("Error fetching version list");const $=await G.json();if(!$||$.length===0)throw new Error("No versions available");Pe($.sort((ne,xe)=>ne-xe));const re=Math.max(...$);Be(re);const ce=await ze(`${o}/artifacts/${s}/${encodeURIComponent(U)}/versions/${re}`,{credentials:"include"});if(!ce.ok)throw new Error("Error fetching latest version content");const me=await ce.blob(),fe=await new Promise((ne,xe)=>{const Le=new FileReader;Le.onloadend=()=>{var X;return ne(((X=Le.result)==null?void 0:X.toString().split(",")[1])||"")},Le.onerror=xe,Le.readAsDataURL(me)}),ge=B.find(ne=>ne.filename===U),_e={name:U,mime_type:(ge==null?void 0:ge.mime_type)||"application/octet-stream",content:fe,last_modified:(ge==null?void 0:ge.last_modified)||new Date().toISOString()};return We(_e),_e}catch(G){return le(`Error loading preview for ${U}: ${G instanceof Error?G.message:"Unknown error"}`),null}},[o,s,B,le]),Pt=u.useCallback(async(U,G)=>{if(!je||!je.includes(G))return le(`Version ${G} is not available for ${U}.`),null;We(null);try{const $=await ze(`${o}/artifacts/${s}/${encodeURIComponent(U)}/versions/${G}`,{credentials:"include"});if(!$.ok)throw new Error(`Error fetching version ${G}`);const re=await $.blob(),ce=await new Promise((ge,_e)=>{const ne=new FileReader;ne.onloadend=()=>{var xe;return ge(((xe=ne.result)==null?void 0:xe.toString().split(",")[1])||"")},ne.onerror=_e,ne.readAsDataURL(re)}),me=B.find(ge=>ge.filename===U),fe={name:U,mime_type:(me==null?void 0:me.mime_type)||"application/octet-stream",content:ce,last_modified:(me==null?void 0:me.last_modified)||new Date().toISOString()};return Be(G),We(fe),fe}catch($){return le(`Error loading version ${G}: ${$ instanceof Error?$.message:"Unknown error"}`),null}},[o,le,B,je,s]),Lt=u.useCallback(U=>{le(`Loading preview for attached file: ${U.name}`),We(U),Pe(null),Be(null)},[le]),sn=u.useCallback(U=>{M(!1),L(U),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:U}}))},[]),De=u.useCallback(()=>{T.current&&(clearTimeout(T.current),T.current=null),b.current&&(b.current.close(),b.current=null),V.current=!1},[]),Ge=u.useCallback(U=>{var Le;z.current+=1;const G=z.current;let $;try{$=JSON.parse(U.data)}catch(X){console.error("Failed to parse SSE message:",X),le("Received unparseable agent update.","error");return}if("error"in $&&$.error){const y=`Error: ${$.error.message}`;c(R=>{const Z=R.filter(Ce=>!Ce.isStatusBubble);return Z.push({role:"agent",parts:[{kind:"text",text:y}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${cn()}`,lastProcessedEventSequence:G}}),Z}),m(!1),De(),v(null);return}if(!("result"in $)||!$.result){console.warn("Received SSE message without a result or error field.",$);return}const re=$.result;let ce=!1,me,fe,ge;switch(re.kind){case"task":ce=!0,me=void 0,ge=re.id,re.artifacts&&re.artifacts.length>0&&console.log("Final task has artifacts to process:",re.artifacts);break;case"status-update":ce=re.final,me=(Le=re.status)==null?void 0:Le.message,ge=re.taskId;break;case"artifact-update":fe=re.artifact,ge=re.taskId;break;default:console.warn("Received unknown result kind in SSE message:",re);return}const _e=[],ne=[];let xe=null;if(me!=null&&me.parts)for(const X of me.parts)if(X.kind==="data"){const y=X.data;if(y&&typeof y=="object"&&"type"in y)switch(y.type){case"agent_progress_update":xe=String((y==null?void 0:y.status_text)??"Processing...");break;case"artifact_creation_progress":xe=`Saving artifact: ${String((y==null?void 0:y.filename)??"unknown file")} (${Number((y==null?void 0:y.bytes_saved)??0)} bytes)`;break;case"tool_invocation_start":break;default:_e.push(X)}}else if(X.kind==="file"){const R=X.file,Z={name:R.name||"untitled_file",mime_type:R.mimeType};"bytes"in R&&R.bytes?Z.content=R.bytes:"uri"in R&&R.uri&&(Z.uri=R.uri),ne.push(Z)}else _e.push(X);xe&&(F.current=xe),c(X=>{var Ne;const y=[...X];let R=y[y.length-1];R!=null&&R.isStatusBubble&&(y.pop(),R=y[y.length-1]);const Z=_e.find(pe=>pe.kind==="text"),Ce=_e.filter(pe=>pe.kind!=="text");if(R&&!R.isUser&&!R.isComplete&&R.taskId===re.taskId&&(Z||ne.length>0)){const pe={...R,parts:[...R.parts],files:R.files?[...R.files]:[],isComplete:ce||ne.length>0,metadata:{...R.metadata,lastProcessedEventSequence:G}};if(Z){const he=pe.parts[pe.parts.length-1];(he==null?void 0:he.kind)==="text"?pe.parts[pe.parts.length-1]={...he,text:he.text+Z.text}:pe.parts.push(Z)}Ce.length>0&&pe.parts.push(...Ce),ne.length>0&&pe.files.push(...ne),y[y.length-1]=pe}else if(_e.some(he=>he.kind==="text"&&he.text.trim())||ne.length>0||fe){const he={role:"agent",parts:_e,files:ne.length>0?ne:void 0,taskId:re.taskId,isUser:!1,isComplete:ce||ne.length>0,metadata:{messageId:((Ne=$.id)==null?void 0:Ne.toString())||`msg-${cn()}`,sessionId:re.contextId,lastProcessedEventSequence:G}};fe&&(he.artifactNotification={name:fe.name||fe.artifactId}),y.push(he)}if(!ce&&F.current)y.push({role:"agent",parts:[{kind:"text",text:F.current}],taskId:re.taskId,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{messageId:`status-${cn()}`,lastProcessedEventSequence:G}});else if(ce){F.current=null;const pe=y.findLastIndex(he=>!he.isUser&&he.taskId===ge);pe!==-1&&(y[pe]={...y[pe],isComplete:!0,metadata:{...y[pe].metadata,lastProcessedEventSequence:G}})}return y}),ce&&(q.current&&(le("Task successfully cancelled."),T.current&&clearTimeout(T.current),N(!1)),m(!1),De(),v(null),V.current=!0,_(),setTimeout(()=>{V.current=!1},100))},[le,De,_]),Dt=u.useCallback(async()=>{const U="ChatProvider.handleNewSession:";if(console.log(`${U} Starting new session process...`),De(),p&&h&&w&&!E){console.log(`${U} Cancelling current task ${h}`);try{const $={jsonrpc:"2.0",id:`req-${cn()}`,method:"tasks/cancel",params:{id:h}};ze(`${o}/tasks/${h}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),credentials:"include"})}catch($){console.warn(`${U} Failed to cancel current task:`,$)}}T.current&&(clearTimeout(T.current),T.current=null),N(!1),console.log(`${U} Resetting session state - new session will be created when first message is sent`),i(""),tt(null),c(t?[{parts:[{kind:"text",text:t}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}]:[]),f(""),m(!1),v(null),k(null),Ie(null),V.current=!1,F.current=null,z.current=0,console.log(`${U} Refreshing artifacts for new session...`),await _(),le("New session started successfully."),console.log(`${U} New session setup complete - session will be created on first message.`)},[o,p,h,w,E,t,le,_,De]),gt=u.useCallback(async U=>{const G="ChatProvider.handleSwitchSession:";if(console.log(`${G} Switching to session ${U}...`),De(),p&&h&&w&&!E){console.log(`${G} Cancelling current task ${h}`);try{const $={jsonrpc:"2.0",id:`req-${cn()}`,method:"tasks/cancel",params:{id:h}};await ze(`${o}/tasks/${h}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),credentials:"include"})}catch($){console.warn(`${G} Failed to cancel current task:`,$)}}T.current&&(clearTimeout(T.current),T.current=null),N(!1);try{const re=(await jt(U)).map(me=>({parts:[{kind:"text",text:me.message}],isUser:me.senderType==="user",isComplete:!0,role:me.senderType==="user"?"user":"agent",metadata:{sessionId:me.sessionId,messageId:me.id,lastProcessedEventSequence:0}})),ce=await ze(`${o}/sessions/${U}`);if(ce.ok){const me=await ce.json();tt(me.name)}i(U),c(re),f(""),m(!1),v(null),k(null),Ie(null),V.current=!1,F.current=null,z.current=0}catch($){console.error(`${G} Failed to fetch session history:`,$),le("Error switching session. Please try again.","error")}},[De,p,h,w,E,o,le,jt]),Ot=u.useCallback(async(U,G,$=!0)=>{if(r)try{const re=await ze(`${o}/sessions/${U}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G})});if(!re.ok){const ce=await re.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(ce.detail||`HTTP error ${re.status}`)}$&&le("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(re){le(`Error updating session name: ${re instanceof Error?re.message:"Unknown error"}`)}},[o,r,le]),Ft=u.useCallback(async U=>{try{const G=await ze(`${o}/sessions/${U}`,{method:"DELETE"});if(!G.ok){const $=await G.json().catch(()=>({detail:"Failed to delete session"}));throw new Error($.detail||`HTTP error ${G.status}`)}le("Session deleted successfully."),U===s&&Dt(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(G){le(`Error deleting session: ${G instanceof Error?G.message:"Unknown error"}`)}},[o,le,Dt,s]),Oe=u.useCallback(U=>{rt(U)},[]),pt=u.useCallback(()=>{rt(null)},[]),an=u.useCallback(async()=>{nt&&(await Ft(nt.id),rt(null))},[nt,Ft]),Yt=u.useCallback(async()=>{if(!p&&!E||!h){le("No active task to cancel.");return}if(E){le("Cancellation already in progress.");return}le(`Requesting cancellation for task ${h}...`),N(!0);try{const U={jsonrpc:"2.0",id:`req-${cn()}`,method:"tasks/cancel",params:{id:h}},G=await ze(`${o}/tasks/${h}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)});if(G.status===202)T.current&&clearTimeout(T.current),T.current=setTimeout(()=>{le(`Cancellation for task ${h} timed out. Allowing new input.`),N(!1),m(!1),De(),v(null),T.current=null,c($=>$.filter(re=>!re.isStatusBubble))},15e3);else{const $=await G.json().catch(()=>({detail:"Unknown cancellation error"}));le(`Failed to request cancellation: ${$.detail||G.statusText}`),N(!1)}}catch(U){le(`Error sending cancellation request: ${U instanceof Error?U.message:"Network error"}`),N(!1)}},[p,E,h,o,le,De]),At=u.useCallback(()=>{},[]),zt=u.useCallback(()=>{p&&!V.current&&!q.current&&le("Connection error with agent updates."),V.current||(m(!1),q.current||(De(),v(null)),F.current=null),c(U=>U.filter(G=>!G.isStatusBubble).map((G,$,re)=>$===re.length-1&&!G.isUser?{...G,isComplete:!0}:G))},[le,De,p]),Kt=u.useCallback(async(U,G,$)=>{U.preventDefault();const re=($==null?void 0:$.trim())||d.trim(),ce=G||[];if(!re&&ce.length===0||p||E||!w){w||le("Please select an agent first."),E&&le("Cannot send new message while a task is being cancelled.");return}De(),V.current=!1,m(!0),v(null),F.current=null,z.current=0;const me=!s;let fe=s||void 0;const ge={role:"user",parts:[{kind:"text",text:re}],isUser:!0,uploadedFiles:ce.length>0?ce:void 0,metadata:{messageId:`msg-${cn()}`,sessionId:fe,lastProcessedEventSequence:0}};F.current="Thinking",c(_e=>[..._e,ge]),f("");try{const _e=[];if(me)for(const Ne of ce)if(Ne.size<Wl){const pe=await Gl(Ne);_e.push({kind:"file",file:{bytes:pe,name:Ne.name,mimeType:Ne.type}})}else{const pe=await ht(Ne,fe);pe?(!fe&&pe.sessionId&&(fe=pe.sessionId,console.log(`Session created via artifact upload: ${fe}`)),_e.push({kind:"file",file:{uri:pe.uri,name:Ne.name,mimeType:Ne.type}})):le(`Failed to upload large file: ${Ne.name}`,"error")}else{const Ne=ce.map(async he=>{if(he.size<Wl)return{kind:"file",file:{bytes:await Gl(he),name:he.name,mimeType:he.type}};{const Re=await ht(he,fe);return Re?{kind:"file",file:{uri:Re.uri,name:he.name,mimeType:he.type}}:(le(`Failed to upload large file: ${he.name}`,"error"),null)}}),pe=await Promise.all(Ne);_e.push(...pe.filter(he=>he!==null))}me&&fe&&fe!==s&&(i(fe),console.log(`Session created via artifact upload: ${fe}`));const ne=[];if(re&&ne.push({kind:"text",text:re}),ne.push(..._e),ne.length===0)throw new Error("Cannot send an empty message.");const xe={role:"user",parts:ne,messageId:`msg-${cn()}`,kind:"message",contextId:fe,metadata:{agent_name:w}},Le={jsonrpc:"2.0",id:`req-${cn()}`,method:"message/stream",params:{message:xe}},X=await ze(`${o}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Le)});if(!X.ok){const Ne=await X.json().catch(()=>({detail:"Unknown error"}));throw new Error(Ne.detail||`HTTP error ${X.status}`)}const y=await X.json(),R=y==null?void 0:y.result,Z=R==null?void 0:R.id,Ce=R==null?void 0:R.contextId;if(!Z)throw new Error("Backend did not return a valid taskId.");if(Ce&&Ce!==fe&&(console.warn(`Backend returned a different session ID (${Ce}) than expected (${fe}). Updating to: ${Ce}`),i(Ce)),me&&Ce){const pe=ge.parts.filter(he=>he.kind==="text").map(he=>he.text).join(" ").trim();if(pe){const he=pe.length>100?`${pe.substring(0,100)}...`:pe;tt(he),Ot(Ce,he,!1)}typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}v(Z),k(Z)}catch(_e){le(`Error: ${_e instanceof Error?_e.message:"Unknown error"}`),m(!1),c(ne=>ne.filter(xe=>!xe.isStatusBubble)),v(null),V.current=!1,F.current=null}},[s,d,p,E,w,De,le,o,ht,Ot]);u.useEffect(()=>{if(h&&o){console.log(`ChatProvider Effect: currentTaskId is ${h}. Setting up EventSource.`);const U=Ei(),G=`${o}/sse/subscribe/${h}${U?`?token=${U}`:""}`,$=new EventSource(G,{withCredentials:!0});return b.current=$,$.onopen=At,$.onerror=zt,$.addEventListener("status_update",Ge),$.addEventListener("artifact_update",Ge),$.addEventListener("final_response",Ge),$.addEventListener("error",Ge),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${h}. Closing EventSource.`),$.removeEventListener("status_update",Ge),$.removeEventListener("artifact_update",Ge),$.removeEventListener("final_response",Ge),$.removeEventListener("error",Ge),De()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),De()},[h,o,Ge,At,zt,De]);const Se={sessionId:s,setSessionId:i,sessionName:St,setSessionName:tt,messages:l,setMessages:c,userInput:d,setUserInput:f,isResponding:p,currentTaskId:h,isCancelling:E,latestStatusText:F,agents:Q,agentsLoading:Y,agentsError:P,agentsRefetch:A,handleNewSession:Dt,handleSwitchSession:gt,handleSubmit:Kt,handleCancel:Yt,notifications:g,addNotification:le,selectedAgentName:w,setSelectedAgentName:S,artifacts:B,artifactsLoading:C,artifactsRefetch:_,uploadArtifactFile:ht,isSidePanelCollapsed:D,activeSidePanelTab:J,setIsSidePanelCollapsed:M,setActiveSidePanelTab:L,openSidePanelTab:sn,taskIdInSidePanel:j,setTaskIdInSidePanel:k,isDeleteModalOpen:H,artifactToDelete:W,openDeleteModal:Mt,closeDeleteModal:Ct,confirmDelete:Et,openSessionDeleteModal:Oe,closeSessionDeleteModal:pt,confirmSessionDelete:an,sessionToDelete:nt,isArtifactEditMode:K,setIsArtifactEditMode:ee,selectedArtifactFilenames:te,setSelectedArtifactFilenames:ae,handleDeleteSelectedArtifacts:Tt,confirmBatchDeleteArtifacts:Xe,isBatchDeleteModalOpen:ie,setIsBatchDeleteModalOpen:de,previewedArtifactAvailableVersions:je,currentPreviewedVersionNumber:Me,previewFileContent:yt,openArtifactForPreview:ft,navigateArtifactVersion:Pt,openMessageAttachmentForPreview:Lt,previewArtifact:ye,setPreviewArtifact:Ie,updateSessionName:Ot,deleteSession:Ft};return a.jsx(Ju.Provider,{value:Se,children:e})},iE=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=on(),{fetchCsrfToken:r,clearCsrfToken:o}=od(),[s,i]=u.useState(!1),[l,c]=u.useState(!0),[d,f]=u.useState(null);u.useEffect(()=>{let g=!0;const x=async()=>{if(!t){g&&(i(!0),c(!1));return}try{const v=await ze("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(v.ok){const b=await v.json();console.log("User is authenticated:",b),g&&(f(b),i(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else v.status===401?(console.log("User is not authenticated"),g&&i(!1)):(console.error("Unexpected response from /users/me:",v.status),g&&i(!1))}catch(v){console.error("Error checking authentication:",v),g&&i(!1)}finally{g&&c(!1)}};x();const h=v=>{v.key==="access_token"&&x()};return window.addEventListener("storage",h),()=>{g=!1,window.removeEventListener("storage",h)}},[t,n,r]);const p=()=>{window.location.href=n},m=()=>{i(!1),f(null),o()};return l?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):a.jsx(Zu.Provider,{value:{isAuthenticated:s,useAuthorization:t,login:p,logout:m,userInfo:d},children:e})};function aE(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 lE=e=>new Promise(t=>setTimeout(t,e)),cE=async(e=5,t=50)=>{try{const n=await ze("/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 s=aE("csrf_token");if(s)return console.log(`CSRF token found in cookie after ${o} retries:`,s),s;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await lE(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 uE({children:e}){const[t,n]=u.useState(null),r=u.useCallback(async()=>{if(t)return t;const i=await cE();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=u.useCallback(()=>{n(null)},[]),s={fetchCsrfToken:r,clearCsrfToken:o};return a.jsx(ed.Provider,{value:s,children:e})}const dE={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"}},fE={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"}},pE={"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 Vl(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 mE(e,t){const n={},r=fE[t];for(const[o,s]of Object.entries(r)){const i=Vl(e,s);n[`--${o}`]=i}for(const[o,s]of Object.entries(pE)){const i=Vl(e,s);n[`--color-${o}`]=i}return n}const Lo="sam-theme";function hE(e){var n,r,o,s,i,l,c,d,f,p,m,g,x,h,v,b,w,S,E,N,j,k,T,V,F,z,q,Q,P,Y,A,B,C,_,D,M,J,L,H,O,W,I,K,ee,te,ae,ie,de,ye,Ie,je,Pe,Me,Be,yt,We,St,tt,nt,rt,le,jt,ht,Rt,Mt,Ct,Et,Tt,Xe,ft,Pt,Lt,sn,De,Ge,Dt,gt,Ot,Ft,Oe,pt,an,Yt,At,zt,Kt,Se,U,G,$,re,ce,me,fe,ge,_e,ne,xe,Le,X,y,R,Z;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),(s=e.info)!=null&&s.w30&&(t["--color-info-w30"]=e.info.w30),(i=e.info)!=null&&i.w20&&(t["--color-info-w20"]=e.info.w20),(l=e.info)!=null&&l.w10&&(t["--color-info-w10"]=e.info.w10),(c=e.error)!=null&&c.wMain&&(t["--color-error-wMain"]=e.error.wMain),(d=e.error)!=null&&d.w100&&(t["--color-error-w100"]=e.error.w100),(f=e.error)!=null&&f.w70&&(t["--color-error-w70"]=e.error.w70),(p=e.error)!=null&&p.w30&&(t["--color-error-w30"]=e.error.w30),(m=e.error)!=null&&m.w20&&(t["--color-error-w20"]=e.error.w20),(g=e.error)!=null&&g.w10&&(t["--color-error-w10"]=e.error.w10),(x=e.warning)!=null&&x.wMain&&(t["--color-warning-wMain"]=e.warning.wMain),(h=e.warning)!=null&&h.w100&&(t["--color-warning-w100"]=e.warning.w100),(v=e.warning)!=null&&v.w70&&(t["--color-warning-w70"]=e.warning.w70),(b=e.warning)!=null&&b.w30&&(t["--color-warning-w30"]=e.warning.w30),(w=e.warning)!=null&&w.w20&&(t["--color-warning-w20"]=e.warning.w20),(S=e.warning)!=null&&S.w10&&(t["--color-warning-w10"]=e.warning.w10),(E=e.success)!=null&&E.wMain&&(t["--color-success-wMain"]=e.success.wMain),(N=e.success)!=null&&N.w100&&(t["--color-success-w100"]=e.success.w100),(j=e.success)!=null&&j.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),(V=e.success)!=null&&V.w10&&(t["--color-success-w10"]=e.success.w10),(F=e.stateLayer)!=null&&F.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(z=e.stateLayer)!=null&&z.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(Q=(q=e.accent)==null?void 0:q.n0)!=null&&Q.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(Y=(P=e.accent)==null?void 0:P.n0)!=null&&Y.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(B=(A=e.accent)==null?void 0:A.n0)!=null&&B.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(_=(C=e.accent)==null?void 0:C.n0)!=null&&_.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(M=(D=e.accent)==null?void 0:D.n1)!=null&&M.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(L=(J=e.accent)==null?void 0:J.n1)!=null&&L.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(O=(H=e.accent)==null?void 0:H.n1)!=null&&O.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(I=(W=e.accent)==null?void 0:W.n1)!=null&&I.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(ee=(K=e.accent)==null?void 0:K.n1)!=null&&ee.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(ae=(te=e.accent)==null?void 0:te.n1)!=null&&ae.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(de=(ie=e.accent)==null?void 0:ie.n2)!=null&&de.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(Ie=(ye=e.accent)==null?void 0:ye.n2)!=null&&Ie.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(Pe=(je=e.accent)==null?void 0:je.n2)!=null&&Pe.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(Be=(Me=e.accent)==null?void 0:Me.n2)!=null&&Be.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(We=(yt=e.accent)==null?void 0:yt.n2)!=null&&We.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(tt=(St=e.accent)==null?void 0:St.n3)!=null&&tt.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(rt=(nt=e.accent)==null?void 0:nt.n3)!=null&&rt.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(jt=(le=e.accent)==null?void 0:le.n3)!=null&&jt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Rt=(ht=e.accent)==null?void 0:ht.n3)!=null&&Rt.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Ct=(Mt=e.accent)==null?void 0:Mt.n4)!=null&&Ct.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(Tt=(Et=e.accent)==null?void 0:Et.n4)!=null&&Tt.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(ft=(Xe=e.accent)==null?void 0:Xe.n4)!=null&&ft.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Lt=(Pt=e.accent)==null?void 0:Pt.n5)!=null&&Lt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(De=(sn=e.accent)==null?void 0:sn.n5)!=null&&De.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(Dt=(Ge=e.accent)==null?void 0:Ge.n5)!=null&&Dt.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(Ot=(gt=e.accent)==null?void 0:gt.n5)!=null&&Ot.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Oe=(Ft=e.accent)==null?void 0:Ft.n6)!=null&&Oe.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(an=(pt=e.accent)==null?void 0:pt.n6)!=null&&an.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(At=(Yt=e.accent)==null?void 0:Yt.n6)!=null&&At.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Kt=(zt=e.accent)==null?void 0:zt.n7)!=null&&Kt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(U=(Se=e.accent)==null?void 0:Se.n7)!=null&&U.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),($=(G=e.accent)==null?void 0:G.n7)!=null&&$.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(ce=(re=e.accent)==null?void 0:re.n8)!=null&&ce.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(fe=(me=e.accent)==null?void 0:me.n8)!=null&&fe.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(_e=(ge=e.accent)==null?void 0:ge.n8)!=null&&_e.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(xe=(ne=e.accent)==null?void 0:ne.n9)!=null&&xe.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(Le=e.learning)!=null&&Le.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(X=e.learning)!=null&&X.w100&&(t["--color-learning-w100"]=e.learning.w100),(y=e.learning)!=null&&y.w90&&(t["--color-learning-w90"]=e.learning.w90),(R=e.learning)!=null&&R.w20&&(t["--color-learning-w20"]=e.learning.w20),(Z=e.learning)!=null&&Z.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function gE(e,t="light"){const n={};if(e){const o=hE(e);Object.assign(n,o)}const r=mE(e,t);return Object.assign(n,r),n}function xE(){const e=localStorage.getItem(Lo);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function vE(e,t){const n=gE(e,t),r=document.documentElement;for(const[o,s]of Object.entries(n))r.style.setProperty(o,s);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(Lo,t)})}const wE=({children:e})=>{const t=u.useMemo(()=>dE,[]),[n,r]=u.useState(()=>xE()),o=u.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const s=n==="light"?"dark":"light";r(s),localStorage.setItem(Lo,s)}}),[n]);return u.useEffect(()=>{if(!(localStorage.getItem(Lo)!==null)){const i=window.matchMedia("(prefers-color-scheme: dark)"),l=c=>{r(c.matches?"dark":"light")};return i.addEventListener?i.addEventListener("change",l):i.addListener(l),()=>{i.removeEventListener?i.removeEventListener("change",l):i.removeListener(l)}}},[]),u.useEffect(()=>{document.documentElement.classList.remove("light","dark"),vE(t,n)},[n,t]),a.jsx(nd.Provider,{value:o,children:e})};function bE(){const[e,t]=u.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=Iw();if(jw(),o&&!n)return a.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:a.jsx(we,{onClick:r,children:"Login"})});const s=c=>{const d=$l.find(f=>f.id===c)||Bl.find(f=>f.id===c);d!=null&&d.onClick&&c!=="settings"?d.onClick():c!=="settings"&&t(c)},i=()=>{t("chat")},l=()=>{switch(e){case"chat":return a.jsx(X1,{});case"agentMesh":return a.jsx(Y1,{})}};return a.jsxs("div",{className:"relative flex h-screen",children:[a.jsx(z1,{items:$l,bottomItems:Bl,activeItem:e,onItemChange:s,onHeaderClick:i}),a.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:l()}),a.jsx(fb,{})]})}function yE(){return a.jsx(wE,{children:a.jsx(uE,{children:a.jsx(J1,{children:a.jsx(iE,{children:a.jsx(sE,{children:a.jsx(Q1,{children:a.jsx(bE,{})})})})})})})}zp.createRoot(document.getElementById("root")).render(a.jsx(u.StrictMode,{children:a.jsx(yE,{})}));