solace-agent-mesh 1.6.3__py3-none-any.whl → 1.7.0__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.
- solace_agent_mesh/agent/adk/adk_llm.txt +12 -18
- solace_agent_mesh/agent/adk/artifacts/artifacts_llm.txt +1 -1
- solace_agent_mesh/agent/adk/callbacks.py +138 -20
- solace_agent_mesh/agent/adk/embed_resolving_mcp_toolset.py +2 -0
- solace_agent_mesh/agent/adk/models/lite_llm.py +38 -5
- solace_agent_mesh/agent/adk/models/models_llm.txt +82 -35
- solace_agent_mesh/agent/adk/runner.py +9 -0
- solace_agent_mesh/agent/adk/stream_parser.py +6 -1
- solace_agent_mesh/agent/adk/tool_wrapper.py +3 -0
- solace_agent_mesh/agent/agent_llm.txt +61 -70
- solace_agent_mesh/agent/protocol/event_handlers.py +29 -1
- solace_agent_mesh/agent/protocol/protocol_llm.txt +1 -1
- solace_agent_mesh/agent/proxies/a2a/a2a_llm.txt +190 -0
- solace_agent_mesh/agent/proxies/base/base_llm.txt +148 -0
- solace_agent_mesh/agent/proxies/proxies_llm.txt +283 -0
- solace_agent_mesh/agent/sac/app.py +22 -0
- solace_agent_mesh/agent/sac/component.py +76 -40
- solace_agent_mesh/agent/sac/sac_llm.txt +1 -1
- solace_agent_mesh/agent/sac/task_execution_context.py +21 -0
- solace_agent_mesh/agent/testing/testing_llm.txt +2 -1
- solace_agent_mesh/agent/tools/builtin_artifact_tools.py +13 -148
- solace_agent_mesh/agent/tools/dynamic_tool.py +2 -0
- solace_agent_mesh/agent/tools/tools_llm.txt +93 -80
- solace_agent_mesh/agent/tools/tools_llm_detail.txt +3 -2
- solace_agent_mesh/agent/utils/artifact_helpers.py +4 -0
- solace_agent_mesh/agent/utils/utils_llm.txt +16 -2
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/05749d90.c70b2be9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/15ba94aa.92fea363.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/15e40e79.36003774.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2987107d.a80604f9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3ac1795d.e4870a49.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3ff0015d.b63ee53a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/547e15cc.2f7790c1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5c2bd65f.45b32c2b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/631738c7.fa471607.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/64195356.c498c4d0.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6a520c9d.b6e3f2ce.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.a5b36a60.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/71da7b71.374b9d54.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8024126c.fa0e7186.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/8b032486.91a91afc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/94e8668d.09ed9234.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{ab9708a8.3e6dd091.js → ab9708a8.245ae0ef.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/ad87452a.9d73dad6.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cbe2e9ea.f902fad8.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/da0b5bad.b62f7b08.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/db5d6442.3daf1696.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/dd817ffc.c37a755e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/dd81e2b8.b682e9c2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/de915948.44a432bc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/e04b235d.c9c50c7b.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/e3d9abda.d11c67a7.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{e6f9706b.e74a984d.js → e6f9706b.045d0fa1.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/e92d0134.3bda61dd.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f284c35a.5099c51e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ff4d71f2.74710fc1.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/main.e6488e8b.js +2 -0
- solace_agent_mesh/assets/docs/assets/js/runtime~main.d9606d6a.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/components/agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/artifact-management/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/audio-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/data-analysis-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/embeds/index.html +18 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/builtin-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/cli/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/gateways/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/components/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/orchestrator/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/plugins/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/components/projects/index.html +196 -0
- solace_agent_mesh/assets/docs/docs/documentation/components/proxies/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/debugging/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/deploying/deployment-options/index.html +6 -7
- solace_agent_mesh/assets/docs/docs/documentation/deploying/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/kubernetes-deployment/index.html +47 -0
- solace_agent_mesh/assets/docs/docs/documentation/deploying/logging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deploying/observability/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/create-gateways/index.html +160 -169
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-python-tools/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/creating-service-providers/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/evaluations/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/bedrock-agents/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/custom-agent/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/event-mesh-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/mongodb-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rag-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/rest-gateway/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/slack-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/developing/tutorials/sql-database/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/agent-builder/index.html +59 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/connectors/index.html +62 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/index.html +10 -6
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/rbac-setup-guide/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/secure-user-delegated-access/index.html +440 -0
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/single-sign-on/index.html +27 -4
- solace_agent_mesh/assets/docs/docs/documentation/enterprise/wheel-installation/index.html +62 -0
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/architecture/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/index.html +5 -4
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/try-agent-mesh/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/artifact-storage/index.html +290 -0
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/configurations/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/large_language_models/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/run-project/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/session-storage/index.html +251 -0
- solace_agent_mesh/assets/docs/docs/documentation/installing-and-configuring/user-feedback/index.html +88 -0
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-gateway-upgrade-to-0.3.0/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/migrations/a2a-upgrade/a2a-technical-migration-map/index.html +3 -3
- solace_agent_mesh/assets/docs/lunr-index-1762189824009.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1762189824009.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/assets/docs/sitemap.xml +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/docs_cmd.py +4 -1
- solace_agent_mesh/cli/commands/init_cmd/orchestrator_step.py +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-D4_RMYRh.js → authCallback-tcIFZLis.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-UZ3qU6Bq.js → client-CRYdKo2Q.js} +3 -3
- solace_agent_mesh/client/webui/frontend/static/assets/main-CojeY_1w.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-ILja9MCG.js +353 -0
- solace_agent_mesh/client/webui/frontend/static/assets/vendor-CINwxvwV.js +470 -0
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
- solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
- solace_agent_mesh/common/a2a/a2a_llm.txt +13 -20
- solace_agent_mesh/common/a2a/protocol.py +5 -0
- solace_agent_mesh/common/a2a/types.py +1 -0
- solace_agent_mesh/common/a2a_spec/a2a_spec_llm.txt +49 -11
- solace_agent_mesh/common/a2a_spec/schemas/artifact_creation_progress.json +23 -6
- solace_agent_mesh/common/a2a_spec/schemas/feedback_event.json +51 -0
- solace_agent_mesh/common/a2a_spec/schemas/schemas_llm.txt +26 -9
- solace_agent_mesh/common/common_llm.txt +13 -34
- solace_agent_mesh/common/data_parts.py +20 -4
- solace_agent_mesh/common/middleware/middleware_llm.txt +1 -1
- solace_agent_mesh/common/sac/sac_llm.txt +1 -1
- solace_agent_mesh/common/sam_events/sam_events_llm.txt +1 -1
- solace_agent_mesh/common/services/employee_service.py +1 -1
- solace_agent_mesh/common/services/providers/providers_llm.txt +3 -2
- solace_agent_mesh/common/services/services_llm.txt +9 -4
- solace_agent_mesh/common/utils/embeds/constants.py +1 -0
- solace_agent_mesh/common/utils/embeds/embeds_llm.txt +1 -1
- solace_agent_mesh/common/utils/embeds/modifiers.py +2 -1
- solace_agent_mesh/common/utils/embeds/resolver.py +58 -6
- solace_agent_mesh/common/utils/embeds/types.py +8 -0
- solace_agent_mesh/common/utils/utils_llm.txt +5 -6
- solace_agent_mesh/core_a2a/core_a2a_llm.txt +1 -1
- solace_agent_mesh/gateway/adapter/__init__.py +1 -0
- solace_agent_mesh/gateway/adapter/base.py +143 -0
- solace_agent_mesh/gateway/adapter/types.py +221 -0
- solace_agent_mesh/gateway/base/app.py +29 -2
- solace_agent_mesh/gateway/base/base_llm.txt +10 -8
- solace_agent_mesh/gateway/base/component.py +573 -142
- solace_agent_mesh/gateway/gateway_llm.txt +55 -59
- solace_agent_mesh/gateway/generic/__init__.py +1 -0
- solace_agent_mesh/gateway/generic/app.py +50 -0
- solace_agent_mesh/gateway/generic/component.py +650 -0
- solace_agent_mesh/gateway/http_sse/alembic/alembic_llm.txt +99 -49
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_fulltext_search_indexes.py +92 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_project_users_table.py +72 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251023_add_soft_delete_and_search.py +150 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_default_agent_to_projects.py +26 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/20251024_add_projects_table.py +135 -0
- solace_agent_mesh/gateway/http_sse/alembic/versions/versions_llm.txt +26 -20
- solace_agent_mesh/gateway/http_sse/app.py +0 -14
- solace_agent_mesh/gateway/http_sse/component.py +17 -56
- solace_agent_mesh/gateway/http_sse/components/components_llm.txt +1 -1
- solace_agent_mesh/gateway/http_sse/dependencies.py +21 -3
- solace_agent_mesh/gateway/http_sse/http_sse_llm.txt +8 -8
- solace_agent_mesh/gateway/http_sse/main.py +23 -5
- solace_agent_mesh/gateway/http_sse/repository/__init__.py +19 -1
- solace_agent_mesh/gateway/http_sse/repository/entities/entities_llm.txt +56 -98
- solace_agent_mesh/gateway/http_sse/repository/entities/project.py +81 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/project_user.py +47 -0
- solace_agent_mesh/gateway/http_sse/repository/entities/session.py +23 -1
- solace_agent_mesh/gateway/http_sse/repository/feedback_repository.py +47 -0
- solace_agent_mesh/gateway/http_sse/repository/interfaces.py +112 -4
- solace_agent_mesh/gateway/http_sse/repository/models/__init__.py +9 -1
- solace_agent_mesh/gateway/http_sse/repository/models/models_llm.txt +51 -60
- solace_agent_mesh/gateway/http_sse/repository/models/project_model.py +51 -0
- solace_agent_mesh/gateway/http_sse/repository/models/project_user_model.py +75 -0
- solace_agent_mesh/gateway/http_sse/repository/models/session_model.py +7 -1
- solace_agent_mesh/gateway/http_sse/repository/project_repository.py +172 -0
- solace_agent_mesh/gateway/http_sse/repository/project_user_repository.py +186 -0
- solace_agent_mesh/gateway/http_sse/repository/repository_llm.txt +125 -157
- solace_agent_mesh/gateway/http_sse/repository/session_repository.py +269 -8
- solace_agent_mesh/gateway/http_sse/routers/artifacts.py +143 -51
- solace_agent_mesh/gateway/http_sse/routers/config.py +69 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/dto_llm.txt +198 -94
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/project_requests.py +48 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/requests_llm.txt +68 -18
- solace_agent_mesh/gateway/http_sse/routers/dto/requests/session_requests.py +13 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/project_responses.py +30 -0
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/responses_llm.txt +51 -35
- solace_agent_mesh/gateway/http_sse/routers/dto/responses/session_responses.py +2 -0
- solace_agent_mesh/gateway/http_sse/routers/feedback.py +133 -2
- solace_agent_mesh/gateway/http_sse/routers/projects.py +542 -0
- solace_agent_mesh/gateway/http_sse/routers/routers_llm.txt +9 -11
- solace_agent_mesh/gateway/http_sse/routers/sessions.py +154 -3
- solace_agent_mesh/gateway/http_sse/routers/tasks.py +296 -4
- solace_agent_mesh/gateway/http_sse/services/project_service.py +403 -0
- solace_agent_mesh/gateway/http_sse/services/services_llm.txt +16 -10
- solace_agent_mesh/gateway/http_sse/services/session_service.py +178 -6
- solace_agent_mesh/gateway/http_sse/shared/exception_handlers.py +2 -3
- solace_agent_mesh/gateway/http_sse/shared/shared_llm.txt +48 -14
- solace_agent_mesh/solace_agent_mesh_llm.txt +1 -1
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.0.dist-info}/METADATA +3 -5
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.0.dist-info}/RECORD +218 -175
- solace_agent_mesh/assets/docs/assets/js/15ba94aa.932dd2db.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3ac1795d.76654dd9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3ff0015d.2be20244.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/547e15cc.2cbb060a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/5c2bd65f.eda4bcb2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/631738c7.7c4594c9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/6a520c9d.ba015d81.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/6ad8f0bd.f4b15f3b.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/71da7b71.ddbdfbe2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/8024126c.56e59919.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/94e8668d.3b883666.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/da0b5bad.d08a9466.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/dd817ffc.0aa9630a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/dd81e2b8.d590bc9e.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/de915948.27d6b065.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/e3d9abda.6b9493d0.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/e92d0134.4f395c6b.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.720d2ef2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ff4d71f2.15b02f97.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/main.ed05b14d.js +0 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.a8a75e0b.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1761744323675.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1761744323675.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main--3yJYl7S.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-DojKHS49.js +0 -342
- solace_agent_mesh/client/webui/frontend/static/assets/vendor-DSqhjwq_.js +0 -405
- /solace_agent_mesh/assets/docs/assets/js/{main.ed05b14d.js.LICENSE.txt → main.e6488e8b.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.0.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.0.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.6.3.dist-info → solace_agent_mesh-1.7.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
var Up=Object.defineProperty;var Wp=(e,t,n)=>t in e?Up(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wa=(e,t,n)=>Wp(e,typeof t!="symbol"?t+"":t,n);import{c as Vp}from"./client-UZ3qU6Bq.js";import{r as d,j as a,c as ec,a as Kr,R as Ei,b as Gp,N as ko,X as Go,E as Yp,d as ct,C as tc,e as Ti,f as Kp,A as nc,L as ki,g as Ai,P as rc,B as qp,S as Xp,F as ba,h as Zp,i as Jp,k as fr,l as Qp,m as em,n as tm,o as oc,D as Yo,p as sc,q as ic,G as ya,K as Ca,I as Ni,s as nm,t as ac,u as Sa,W as rm,v as om,w as sm,x as im,y as lc,T as am,z as lm,H as cm,J as um,M as dm,O as fm,Q as cc,U as uc,V as dc,Y as pm,Z as mm,_ as Ea,$ as hm,a0 as gm,a1 as fc,a2 as xm,a3 as rt,a4 as ot,a5 as vm,a6 as wm,a7 as Ta,a8 as ka,a9 as vs,aa as bm,ab as ym,ac as Cm,ad as Sm,ae as Em,af as Tm,ag as km,ah as Am,ai as Nm,aj as _m,ak as Im,al as pc,am as jm,an as Mm}from"./vendor-DSqhjwq_.js";function Aa(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function mc(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Aa(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():Aa(e[o],null)}}}}function ze(...e){return d.useCallback(mc(...e),e)}function Bn(e){const t=Rm(e),n=d.forwardRef((r,o)=>{const{children:s,...i}=r,l=d.Children.toArray(s),c=l.find(Pm);if(c){const u=c.props.children,f=l.map(p=>p===c?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:p);return a.jsx(t,{...i,ref:o,children:d.isValidElement(u)?d.cloneElement(u,void 0,f):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var hc=Bn("Slot");function Rm(e){const t=d.forwardRef((n,r)=>{const{children:o,...s}=n;if(d.isValidElement(o)){const i=Om(o),l=Dm(s,o.props);return o.type!==d.Fragment&&(l.ref=r?mc(r,i):i),d.cloneElement(o,l)}return d.Children.count(o)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var gc=Symbol("radix.slottable");function Lm(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=gc,t}function Pm(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===gc}function Dm(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 Om(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 Na=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,_a=ec,Mn=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return _a(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const f=n==null?void 0:n[u],p=s==null?void 0:s[u];if(f===null)return null;const m=Na(f)||Na(p);return o[u][m]}),l=n&&Object.entries(n).reduce((u,f)=>{let[p,m]=f;return m===void 0||(u[p]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,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})?[...u,p,m]:u},[]);return _a(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},_i=()=>localStorage.getItem("access_token"),Fm=()=>localStorage.getItem("refresh_token"),$m=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},zm=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},Bm=async()=>{const e=Fm();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 $m(n.access_token,n.refresh_token),n.access_token}return zm(),window.location.href="/api/v1/auth/login",null},Fe=async(e,t={})=>{const n=_i();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 Bm();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},Hm=async e=>{const t=await Fe("/api/v1/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({detail:"Failed to submit feedback"}));throw new Error(n.detail||"Failed to submit feedback")}return t.json()},Ii="-",Um=e=>{const t=Vm(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(Ii);return l[0]===""&&l.length!==1&&l.shift(),xc(l,t)||Wm(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},xc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?xc(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Ii);return(i=t.validators.find(({validator:l})=>l(s)))==null?void 0:i.classGroupId},Ia=/^\[(.+)\]$/,Wm=e=>{if(Ia.test(e)){const t=Ia.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Vm=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Ys(n[o],r,o,t);return r},Ys=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:ja(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Gm(o)){Ys(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Ys(i,ja(t,s),n,r)})})},ja=(e,t)=>{let n=e;return t.split(Ii).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Gm=e=>e.isThemeGetter,Ym=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)}}},Ks="!",qs=":",Km=qs.length,qm=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;for(let x=0;x<o.length;x++){let h=o[x];if(i===0&&l===0){if(h===qs){s.push(o.slice(c,x)),c=x+Km;continue}if(h==="/"){u=x;continue}}h==="["?i++:h==="]"?i--:h==="("?l++:h===")"&&l--}const f=s.length===0?o:o.substring(c),p=Xm(f),m=p!==f,g=u&&u>c?u-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:g}};if(t){const o=t+qs,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},Xm=e=>e.endsWith(Ks)?e.substring(0,e.length-1):e.startsWith(Ks)?e.substring(1):e,Zm=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}},Jm=e=>({cache:Ym(e.cacheSize),parseClassName:qm(e),sortModifiers:Zm(e),...Um(e)}),Qm=/\s+/,eh=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Qm);let c="";for(let u=l.length-1;u>=0;u-=1){const f=l[u],{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,w=r(v?x.substring(0,h):x);if(!w){if(!v){c=f+(c.length>0?" "+c:c);continue}if(w=r(x),!w){c=f+(c.length>0?" "+c:c);continue}v=!1}const b=s(m).join(":"),y=g?b+Ks:b,S=y+w;if(i.includes(S))continue;i.push(S);const N=o(w,v);for(let j=0;j<N.length;++j){const k=N[j];i.push(y+k)}c=f+(c.length>0?" "+c:c)}return c};function th(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=vc(t))&&(r&&(r+=" "),r+=n);return r}const vc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vc(e[r]))&&(n&&(n+=" "),n+=t);return n};function nh(e,...t){let n,r,o,s=i;function i(c){const u=t.reduce((f,p)=>p(f),e());return n=Jm(u),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const u=r(c);if(u)return u;const f=eh(c,n);return o(c,f),f}return function(){return s(th.apply(null,arguments))}}const Qe=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},wc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rh=/^\d+\/\d+$/,oh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sh=/\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$/,ih=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ah=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zn=e=>rh.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Sn=e=>!!e&&Number.isInteger(Number(e)),ws=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),hn=e=>oh.test(e),ch=()=>!0,uh=e=>sh.test(e)&&!ih.test(e),yc=()=>!1,dh=e=>ah.test(e),fh=e=>lh.test(e),ph=e=>!se(e)&&!ie(e),mh=e=>br(e,Ec,yc),se=e=>wc.test(e),On=e=>br(e,Tc,uh),bs=e=>br(e,wh,Ne),Ma=e=>br(e,Cc,yc),hh=e=>br(e,Sc,fh),lo=e=>br(e,kc,dh),ie=e=>bc.test(e),kr=e=>yr(e,Tc),gh=e=>yr(e,bh),Ra=e=>yr(e,Cc),xh=e=>yr(e,Ec),vh=e=>yr(e,Sc),co=e=>yr(e,kc,!0),br=(e,t,n)=>{const r=wc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},yr=(e,t,n=!1)=>{const r=bc.exec(e);return r?r[1]?t(r[1]):n:!1},Cc=e=>e==="position"||e==="percentage",Sc=e=>e==="image"||e==="url",Ec=e=>e==="length"||e==="size"||e==="bg-size",Tc=e=>e==="length",wh=e=>e==="number",bh=e=>e==="family-name",kc=e=>e==="shadow",yh=()=>{const e=Qe("color"),t=Qe("font"),n=Qe("text"),r=Qe("font-weight"),o=Qe("tracking"),s=Qe("leading"),i=Qe("breakpoint"),l=Qe("container"),c=Qe("spacing"),u=Qe("radius"),f=Qe("shadow"),p=Qe("inset-shadow"),m=Qe("text-shadow"),g=Qe("drop-shadow"),x=Qe("blur"),h=Qe("perspective"),v=Qe("aspect"),w=Qe("ease"),b=Qe("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...S(),ie,se],j=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],A=()=>[ie,se,c],G=()=>[Zn,"full","auto",...A()],Q=()=>[Sn,"none","subgrid",ie,se],O=()=>["auto",{span:["full",Sn,ie,se]},Sn,ie,se],P=()=>[Sn,"auto",ie,se],K=()=>["auto","min","max","fr",ie,se],W=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],_=()=>["auto",...A()],q=()=>[Zn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],E=()=>[e,ie,se],T=()=>[...S(),Ra,Ma,{position:[ie,se]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],F=()=>["auto","cover","contain",xh,mh,{size:[ie,se]}],ee=()=>[ws,kr,On],L=()=>["","none","full",u,ie,se],U=()=>["",Ne,kr,On],Y=()=>["solid","dashed","dotted","double"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>[Ne,ws,Ra,Ma],X=()=>["","none",x,ie,se],re=()=>["none",Ne,ie,se],ne=()=>["none",Ne,ie,se],ue=()=>[Ne,ie,se],ae=()=>[Zn,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hn],breakpoint:[hn],color:[ch],container:[hn],"drop-shadow":[hn],ease:["in","out","in-out"],font:[ph],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hn],shadow:[hn],spacing:["px",Ne],text:[hn],"text-shadow":[hn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zn,se,ie,v]}],container:["container"],columns:[{columns:[Ne,se,ie,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:G()}],"inset-x":[{"inset-x":G()}],"inset-y":[{"inset-y":G()}],start:[{start:G()}],end:[{end:G()}],top:[{top:G()}],right:[{right:G()}],bottom:[{bottom:G()}],left:[{left:G()}],visibility:["visible","invisible","collapse"],z:[{z:[Sn,"auto",ie,se]}],basis:[{basis:[Zn,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Zn,"auto","initial","none",se]}],grow:[{grow:["",Ne,ie,se]}],shrink:[{shrink:["",Ne,ie,se]}],order:[{order:[Sn,"first","last","none",ie,se]}],"grid-cols":[{"grid-cols":Q()}],"col-start-end":[{col:O()}],"col-start":[{"col-start":P()}],"col-end":[{"col-end":P()}],"grid-rows":[{"grid-rows":Q()}],"row-start-end":[{row:O()}],"row-start":[{"row-start":P()}],"row-end":[{"row-end":P()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...W(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...W()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":W()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:_()}],mx:[{mx:_()}],my:[{my:_()}],ms:[{ms:_()}],me:[{me:_()}],mt:[{mt:_()}],mr:[{mr:_()}],mb:[{mb:_()}],ml:[{ml:_()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:q()}],w:[{w:[l,"screen",...q()]}],"min-w":[{"min-w":[l,"screen","none",...q()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...q()]}],h:[{h:["screen","lh",...q()]}],"min-h":[{"min-h":["screen","lh","none",...q()]}],"max-h":[{"max-h":["screen","lh",...q()]}],"font-size":[{text:["base",n,kr,On]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ie,bs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ws,se]}],"font-family":[{font:[gh,se,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,ie,se]}],"line-clamp":[{"line-clamp":[Ne,"none",ie,bs]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",ie,se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ie,se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:E()}],"text-color":[{text:E()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",ie,On]}],"text-decoration-color":[{decoration:E()}],"underline-offset":[{"underline-offset":[Ne,"auto",ie,se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ie,se]}],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",ie,se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:T()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:F()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Sn,ie,se],radial:["",ie,se],conic:[Sn,ie,se]},vh,hh]}],"bg-color":[{bg:E()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:E()}],"gradient-via":[{via:E()}],"gradient-to":[{to:E()}],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:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:E()}],"border-color-x":[{"border-x":E()}],"border-color-y":[{"border-y":E()}],"border-color-s":[{"border-s":E()}],"border-color-e":[{"border-e":E()}],"border-color-t":[{"border-t":E()}],"border-color-r":[{"border-r":E()}],"border-color-b":[{"border-b":E()}],"border-color-l":[{"border-l":E()}],"divide-color":[{divide:E()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,ie,se]}],"outline-w":[{outline:["",Ne,kr,On]}],"outline-color":[{outline:E()}],shadow:[{shadow:["","none",f,co,lo]}],"shadow-color":[{shadow:E()}],"inset-shadow":[{"inset-shadow":["none",p,co,lo]}],"inset-shadow-color":[{"inset-shadow":E()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:E()}],"ring-offset-w":[{"ring-offset":[Ne,On]}],"ring-offset-color":[{"ring-offset":E()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":E()}],"text-shadow":[{"text-shadow":["none",m,co,lo]}],"text-shadow-color":[{"text-shadow":E()}],opacity:[{opacity:[Ne,ie,se]}],"mix-blend":[{"mix-blend":[...J(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":J()}],"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":[Ne]}],"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":E()}],"mask-image-linear-to-color":[{"mask-linear-to":E()}],"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":E()}],"mask-image-t-to-color":[{"mask-t-to":E()}],"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":E()}],"mask-image-r-to-color":[{"mask-r-to":E()}],"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":E()}],"mask-image-b-to-color":[{"mask-b-to":E()}],"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":E()}],"mask-image-l-to-color":[{"mask-l-to":E()}],"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":E()}],"mask-image-x-to-color":[{"mask-x-to":E()}],"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":E()}],"mask-image-y-to-color":[{"mask-y-to":E()}],"mask-image-radial":[{"mask-radial":[ie,se]}],"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":E()}],"mask-image-radial-to-color":[{"mask-radial-to":E()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"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":E()}],"mask-image-conic-to-color":[{"mask-conic-to":E()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:T()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:F()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ie,se]}],filter:[{filter:["","none",ie,se]}],blur:[{blur:X()}],brightness:[{brightness:[Ne,ie,se]}],contrast:[{contrast:[Ne,ie,se]}],"drop-shadow":[{"drop-shadow":["","none",g,co,lo]}],"drop-shadow-color":[{"drop-shadow":E()}],grayscale:[{grayscale:["",Ne,ie,se]}],"hue-rotate":[{"hue-rotate":[Ne,ie,se]}],invert:[{invert:["",Ne,ie,se]}],saturate:[{saturate:[Ne,ie,se]}],sepia:[{sepia:["",Ne,ie,se]}],"backdrop-filter":[{"backdrop-filter":["","none",ie,se]}],"backdrop-blur":[{"backdrop-blur":X()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,ie,se]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,ie,se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,ie,se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,ie,se]}],"backdrop-invert":[{"backdrop-invert":["",Ne,ie,se]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,ie,se]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,ie,se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,ie,se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ie,se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",ie,se]}],ease:[{ease:["linear","initial",w,ie,se]}],delay:[{delay:[Ne,ie,se]}],animate:[{animate:["none",b,ie,se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,ie,se]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[ie,se,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ae()}],"translate-x":[{"translate-x":ae()}],"translate-y":[{"translate-y":ae()}],"translate-z":[{"translate-z":ae()}],"translate-none":["translate-none"],accent:[{accent:E()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:E()}],"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",ie,se]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",ie,se]}],fill:[{fill:["none",...E()]}],"stroke-w":[{stroke:[Ne,kr,On,bs]}],stroke:[{stroke:["none",...E()]}],"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"]}},Ch=nh(yh);function be(...e){return Ch(ec(e))}const Sh=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}},Ac=(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)}},Eh=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=Sh(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 Fe(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.");Ac(t,n)}catch(t){console.error("Error creating download link:",t)}},Nc=(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]},La=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"}},Th=e=>{if(!e)return"N/A";try{const t=new Date(e);return isNaN(t.getTime())?"N/A":t.toLocaleString()}catch{return"N/A"}},Pa=(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," "),kh=(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 ge(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 Ah(e,t){const n=d.createContext(t),r=s=>{const{children:i,...l}=s,c=d.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=d.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 Rn(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),c=n.length;n=[...n,i];const u=p=>{var w;const{scope:m,children:g,...x}=p,h=((w=m==null?void 0:m[e])==null?void 0:w[c])||l,v=d.useMemo(()=>x,Object.values(x));return a.jsx(h.Provider,{value:v,children:g})};u.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=d.useContext(g);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[u,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const c=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,Nh(o,...t)]}function Nh(...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:u})=>{const p=c(s)[`__scope${u}`];return{...l,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var _h=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=_h.reduce((e,t)=>{const n=Bn(`Primitive.${t}`),r=d.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 Ih(e,t){e&&Kr.flushSync(()=>e.dispatchEvent(t))}function Nn(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function jh(e,t=globalThis==null?void 0:globalThis.document){const n=Nn(e);d.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 Mh="DismissableLayer",Xs="dismissableLayer.update",Rh="dismissableLayer.pointerDownOutside",Lh="dismissableLayer.focusOutside",Da,_c=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qr=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=d.useContext(_c),[f,p]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=d.useState({}),x=ze(t,k=>p(k)),h=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(v),b=f?h.indexOf(f):-1,y=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=w,N=Oh(k=>{const A=k.target,G=[...u.branches].some(Q=>Q.contains(A));!S||G||(o==null||o(k),i==null||i(k),k.defaultPrevented||l==null||l())},m),j=Fh(k=>{const A=k.target;[...u.branches].some(Q=>Q.contains(A))||(s==null||s(k),i==null||i(k),k.defaultPrevented||l==null||l())},m);return jh(k=>{b===u.layers.size-1&&(r==null||r(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},m),d.useEffect(()=>{if(f)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Da=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),Oa(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Da)}},[f,m,n,u]),d.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),Oa())},[f,u]),d.useEffect(()=>{const k=()=>g({});return document.addEventListener(Xs,k),()=>document.removeEventListener(Xs,k)},[]),a.jsx(je.div,{...c,ref:x,style:{pointerEvents:y?S?"auto":"none":void 0,...e.style},onFocusCapture:ge(e.onFocusCapture,j.onFocusCapture),onBlurCapture:ge(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:ge(e.onPointerDownCapture,N.onPointerDownCapture)})});qr.displayName=Mh;var Ph="DismissableLayerBranch",Dh=d.forwardRef((e,t)=>{const n=d.useContext(_c),r=d.useRef(null),o=ze(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(je.div,{...e,ref:o})});Dh.displayName=Ph;function Oh(e,t=globalThis==null?void 0:globalThis.document){const n=Nn(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Ic(Rh,n,u,{discrete:!0})};const u={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 Fh(e,t=globalThis==null?void 0:globalThis.document){const n=Nn(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ic(Lh,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 Oa(){const e=new CustomEvent(Xs);document.dispatchEvent(e)}function Ic(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?Ih(o,s):o.dispatchEvent(s)}var ut=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{},$h=Ei[" useId ".trim().toString()]||(()=>{}),zh=0;function on(e){const[t,n]=d.useState($h());return ut(()=>{n(r=>r??String(zh++))},[e]),t?`radix-${t}`:""}const Bh=["top","right","bottom","left"],_n=Math.min,_t=Math.max,Mo=Math.round,uo=Math.floor,sn=e=>({x:e,y:e}),Hh={left:"right",right:"left",bottom:"top",top:"bottom"},Uh={start:"end",end:"start"};function Zs(e,t,n){return _t(e,_n(t,n))}function wn(e,t){return typeof e=="function"?e(t):e}function bn(e){return e.split("-")[0]}function Cr(e){return e.split("-")[1]}function ji(e){return e==="x"?"y":"x"}function Mi(e){return e==="y"?"height":"width"}const Wh=new Set(["top","bottom"]);function nn(e){return Wh.has(bn(e))?"y":"x"}function Ri(e){return ji(nn(e))}function Vh(e,t,n){n===void 0&&(n=!1);const r=Cr(e),o=Ri(e),s=Mi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Ro(i)),[i,Ro(i)]}function Gh(e){const t=Ro(e);return[Js(e),t,Js(t)]}function Js(e){return e.replace(/start|end/g,t=>Uh[t])}const Fa=["left","right"],$a=["right","left"],Yh=["top","bottom"],Kh=["bottom","top"];function qh(e,t,n){switch(e){case"top":case"bottom":return n?t?$a:Fa:t?Fa:$a;case"left":case"right":return t?Yh:Kh;default:return[]}}function Xh(e,t,n,r){const o=Cr(e);let s=qh(bn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Js)))),s}function Ro(e){return e.replace(/left|right|bottom|top/g,t=>Hh[t])}function Zh(e){return{top:0,right:0,bottom:0,left:0,...e}}function jc(e){return typeof e!="number"?Zh(e):{top:e,right:e,bottom:e,left:e}}function Lo(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 za(e,t,n){let{reference:r,floating:o}=e;const s=nn(t),i=Ri(t),l=Mi(i),c=bn(t),u=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(Cr(t)){case"start":g[i]-=m*(n&&u?-1:1);break;case"end":g[i]+=m*(n&&u?-1:1);break}return g}const Jh=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 u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=za(u,r,c),m=r,g={},x=0;for(let h=0;h<l.length;h++){const{name:v,fn:w}=l[h],{x:b,y,data:S,reset:N}=await w({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:u,platform:i,elements:{reference:e,floating:t}});f=b??f,p=y??p,g={...g,[v]:{...g[v],...S}},N&&x<=50&&(x++,typeof N=="object"&&(N.placement&&(m=N.placement),N.rects&&(u=N.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):N.rects),{x:f,y:p}=za(u,m,c)),h=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:g}};async function Fr(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=wn(t,e),x=jc(g),v=l[m?p==="floating"?"reference":"floating":p],w=Lo(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:u,rootBoundary:f,strategy:c})),b=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),S=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},N=Lo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:y,strategy:c}):b);return{top:(w.top-N.top+x.top)/S.y,bottom:(N.bottom-w.bottom+x.bottom)/S.y,left:(w.left-N.left+x.left)/S.x,right:(N.right-w.right+x.right)/S.x}}const Qh=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:u,padding:f=0}=wn(e,t)||{};if(u==null)return{};const p=jc(f),m={x:n,y:r},g=Ri(o),x=Mi(g),h=await i.getDimensions(u),v=g==="y",w=v?"top":"left",b=v?"bottom":"right",y=v?"clientHeight":"clientWidth",S=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(u));let k=j?j[y]:0;(!k||!await(i.isElement==null?void 0:i.isElement(j)))&&(k=l.floating[y]||s.floating[x]);const A=S/2-N/2,G=k/2-h[x]/2-1,Q=_n(p[w],G),O=_n(p[b],G),P=Q,K=k-h[x]-O,W=k/2-h[x]/2+A,z=Zs(P,W,K),_=!c.arrow&&Cr(o)!=null&&W!==z&&s.reference[x]/2-(W<P?Q:O)-h[x]/2<0,q=_?W<P?W-P:W-K:0;return{[g]:m[g]+q,data:{[g]:z,centerOffset:W-z-q,..._&&{alignmentOffset:q}},reset:_}}}),eg=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:u}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:h=!0,...v}=wn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=bn(o),b=nn(l),y=bn(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=m||(y||!h?[Ro(l)]:Gh(l)),j=x!=="none";!m&&j&&N.push(...Xh(l,h,x,S));const k=[l,...N],A=await Fr(t,v),G=[];let Q=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&G.push(A[w]),p){const W=Vh(o,i,S);G.push(A[W[0]],A[W[1]])}if(Q=[...Q,{placement:o,overflows:G}],!G.every(W=>W<=0)){var O,P;const W=(((O=s.flip)==null?void 0:O.index)||0)+1,z=k[W];if(z&&(!(p==="alignment"?b!==nn(z):!1)||Q.every(E=>nn(E.placement)===b?E.overflows[0]>0:!0)))return{data:{index:W,overflows:Q},reset:{placement:z}};let _=(P=Q.filter(q=>q.overflows[0]<=0).sort((q,E)=>q.overflows[1]-E.overflows[1])[0])==null?void 0:P.placement;if(!_)switch(g){case"bestFit":{var K;const q=(K=Q.filter(E=>{if(j){const T=nn(E.placement);return T===b||T==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(T=>T>0).reduce((T,M)=>T+M,0)]).sort((E,T)=>E[1]-T[1])[0])==null?void 0:K[0];q&&(_=q);break}case"initialPlacement":_=l;break}if(o!==_)return{reset:{placement:_}}}return{}}}};function Ba(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ha(e){return Bh.some(t=>e[t]>=0)}const tg=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=wn(e,t);switch(r){case"referenceHidden":{const s=await Fr(t,{...o,elementContext:"reference"}),i=Ba(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ha(i)}}}case"escaped":{const s=await Fr(t,{...o,altBoundary:!0}),i=Ba(s,n.floating);return{data:{escapedOffsets:i,escaped:Ha(i)}}}default:return{}}}}},Mc=new Set(["left","top"]);async function ng(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=bn(n),l=Cr(n),c=nn(n)==="y",u=Mc.has(i)?-1:1,f=s&&c?-1:1,p=wn(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*u}:{x:m*u,y:g*f}}const rg=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 ng(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}}}}},og=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:w,y:b}=v;return{x:w,y:b}}},...c}=wn(e,t),u={x:n,y:r},f=await Fr(t,c),p=nn(bn(o)),m=ji(p);let g=u[m],x=u[p];if(s){const v=m==="y"?"top":"left",w=m==="y"?"bottom":"right",b=g+f[v],y=g-f[w];g=Zs(b,g,y)}if(i){const v=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=x+f[v],y=x-f[w];x=Zs(b,x,y)}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}}}}}},sg=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:u=!0}=wn(e,t),f={x:n,y:r},p=nn(o),m=ji(p);let g=f[m],x=f[p];const h=wn(l,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const y=m==="y"?"height":"width",S=s.reference[m]-s.floating[y]+v.mainAxis,N=s.reference[m]+s.reference[y]-v.mainAxis;g<S?g=S:g>N&&(g=N)}if(u){var w,b;const y=m==="y"?"width":"height",S=Mc.has(bn(o)),N=s.reference[p]-s.floating[y]+(S&&((w=i.offset)==null?void 0:w[p])||0)+(S?0:v.crossAxis),j=s.reference[p]+s.reference[y]+(S?0:((b=i.offset)==null?void 0:b[p])||0)-(S?v.crossAxis:0);x<N?x=N:x>j&&(x=j)}return{[m]:g,[p]:x}}}},ig=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=()=>{},...u}=wn(e,t),f=await Fr(t,u),p=bn(o),m=Cr(o),g=nn(o)==="y",{width:x,height:h}=s.floating;let v,w;p==="top"||p==="bottom"?(v=p,w=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=p,v=m==="end"?"top":"bottom");const b=h-f.top-f.bottom,y=x-f.left-f.right,S=_n(h-f[v],b),N=_n(x-f[w],y),j=!t.middlewareData.shift;let k=S,A=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(k=b),j&&!m){const Q=_t(f.left,0),O=_t(f.right,0),P=_t(f.top,0),K=_t(f.bottom,0);g?A=x-2*(Q!==0||O!==0?Q+O:_t(f.left,f.right)):k=h-2*(P!==0||K!==0?P+K:_t(f.top,f.bottom))}await c({...t,availableWidth:A,availableHeight:k});const G=await i.getDimensions(l.floating);return x!==G.width||h!==G.height?{reset:{rects:!0}}:{}}}};function Ko(){return typeof window<"u"}function Sr(e){return Rc(e)?(e.nodeName||"").toLowerCase():"#document"}function jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cn(e){var t;return(t=(Rc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Rc(e){return Ko()?e instanceof Node||e instanceof jt(e).Node:!1}function Kt(e){return Ko()?e instanceof Element||e instanceof jt(e).Element:!1}function ln(e){return Ko()?e instanceof HTMLElement||e instanceof jt(e).HTMLElement:!1}function Ua(e){return!Ko()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jt(e).ShadowRoot}const ag=new Set(["inline","contents"]);function Xr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ag.has(o)}const lg=new Set(["table","td","th"]);function cg(e){return lg.has(Sr(e))}const ug=[":popover-open",":modal"];function qo(e){return ug.some(t=>{try{return e.matches(t)}catch{return!1}})}const dg=["transform","translate","scale","rotate","perspective"],fg=["transform","translate","scale","rotate","perspective","filter"],pg=["paint","layout","strict","content"];function Li(e){const t=Pi(),n=Kt(e)?qt(e):e;return dg.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)||fg.some(r=>(n.willChange||"").includes(r))||pg.some(r=>(n.contain||"").includes(r))}function mg(e){let t=In(e);for(;ln(t)&&!pr(t);){if(Li(t))return t;if(qo(t))return null;t=In(t)}return null}function Pi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hg=new Set(["html","body","#document"]);function pr(e){return hg.has(Sr(e))}function qt(e){return jt(e).getComputedStyle(e)}function Xo(e){return Kt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function In(e){if(Sr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ua(e)&&e.host||cn(e);return Ua(t)?t.host:t}function Lc(e){const t=In(e);return pr(t)?e.ownerDocument?e.ownerDocument.body:e.body:ln(t)&&Xr(t)?t:Lc(t)}function $r(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Lc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=jt(o);if(s){const l=Qs(i);return t.concat(i,i.visualViewport||[],Xr(o)?o:[],l&&n?$r(l):[])}return t.concat(o,$r(o,[],n))}function Qs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pc(e){const t=qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ln(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=Mo(n)!==s||Mo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function Di(e){return Kt(e)?e:e.contextElement}function lr(e){const t=Di(e);if(!ln(t))return sn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Pc(t);let i=(s?Mo(n.width):n.width)/r,l=(s?Mo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const gg=sn(0);function Dc(e){const t=jt(e);return!Pi()||!t.visualViewport?gg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jt(e)?!1:t}function Hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Di(e);let i=sn(1);t&&(r?Kt(r)&&(i=lr(r)):i=lr(e));const l=xg(s,n,r)?Dc(s):sn(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=jt(s),g=r&&Kt(r)?jt(r):r;let x=m,h=Qs(x);for(;h&&r&&g!==x;){const v=lr(h),w=h.getBoundingClientRect(),b=qt(h),y=w.left+(h.clientLeft+parseFloat(b.paddingLeft))*v.x,S=w.top+(h.clientTop+parseFloat(b.paddingTop))*v.y;c*=v.x,u*=v.y,f*=v.x,p*=v.y,c+=y,u+=S,x=jt(h),h=Qs(x)}}return Lo({width:f,height:p,x:c,y:u})}function Zo(e,t){const n=Xo(e).scrollLeft;return t?t.left+n:Hn(cn(e)).left+n}function Oc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function vg(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=cn(r),l=t?qo(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=sn(1);const f=sn(0),p=ln(r);if((p||!p&&!s)&&((Sr(r)!=="body"||Xr(i))&&(c=Xo(r)),ln(r))){const g=Hn(r);u=lr(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=i&&!p&&!s?Oc(i,c):sn(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+m.x,y:n.y*u.y-c.scrollTop*u.y+f.y+m.y}}function wg(e){return Array.from(e.getClientRects())}function bg(e){const t=cn(e),n=Xo(e),r=e.ownerDocument.body,o=_t(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=_t(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Zo(e);const l=-n.scrollTop;return qt(r).direction==="rtl"&&(i+=_t(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const Wa=25;function yg(e,t){const n=jt(e),r=cn(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=Pi();(!f||f&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Zo(r);if(u<=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<=Wa&&(s-=x)}else u<=Wa&&(s+=u);return{width:s,height:i,x:l,y:c}}const Cg=new Set(["absolute","fixed"]);function Sg(e,t){const n=Hn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ln(e)?lr(e):sn(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Va(e,t,n){let r;if(t==="viewport")r=yg(e,n);else if(t==="document")r=bg(cn(e));else if(Kt(t))r=Sg(t,n);else{const o=Dc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Lo(r)}function Fc(e,t){const n=In(e);return n===t||!Kt(n)||pr(n)?!1:qt(n).position==="fixed"||Fc(n,t)}function Eg(e,t){const n=t.get(e);if(n)return n;let r=$r(e,[],!1).filter(l=>Kt(l)&&Sr(l)!=="body"),o=null;const s=qt(e).position==="fixed";let i=s?In(e):e;for(;Kt(i)&&!pr(i);){const l=qt(i),c=Li(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&Cg.has(o.position)||Xr(i)&&!c&&Fc(e,i))?r=r.filter(f=>f!==i):o=l,i=In(i)}return t.set(e,r),r}function Tg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?qo(t)?[]:Eg(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,f)=>{const p=Va(t,f,o);return u.top=_t(p.top,u.top),u.right=_n(p.right,u.right),u.bottom=_n(p.bottom,u.bottom),u.left=_t(p.left,u.left),u},Va(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function kg(e){const{width:t,height:n}=Pc(e);return{width:t,height:n}}function Ag(e,t,n){const r=ln(t),o=cn(t),s=n==="fixed",i=Hn(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=sn(0);function u(){c.x=Zo(o)}if(r||!r&&!s)if((Sr(t)!=="body"||Xr(o))&&(l=Xo(t)),r){const g=Hn(t,!0,s,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else o&&u();s&&!r&&o&&u();const f=o&&!r&&!s?Oc(o,l):sn(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 ys(e){return qt(e).position==="static"}function Ga(e,t){if(!ln(e)||qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return cn(e)===n&&(n=n.ownerDocument.body),n}function $c(e,t){const n=jt(e);if(qo(e))return n;if(!ln(e)){let o=In(e);for(;o&&!pr(o);){if(Kt(o)&&!ys(o))return o;o=In(o)}return n}let r=Ga(e,t);for(;r&&cg(r)&&ys(r);)r=Ga(r,t);return r&&pr(r)&&ys(r)&&!Li(r)?n:r||mg(e)||n}const Ng=async function(e){const t=this.getOffsetParent||$c,n=this.getDimensions,r=await n(e.floating);return{reference:Ag(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _g(e){return qt(e).direction==="rtl"}const Ig={convertOffsetParentRelativeRectToViewportRelativeRect:vg,getDocumentElement:cn,getClippingRect:Tg,getOffsetParent:$c,getElementRects:Ng,getClientRects:wg,getDimensions:kg,getScale:lr,isElement:Kt,isRTL:_g};function zc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function jg(e,t){let n=null,r;const o=cn(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 u=e.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=u;if(l||t(),!m||!g)return;const x=uo(p),h=uo(o.clientWidth-(f+m)),v=uo(o.clientHeight-(p+g)),w=uo(f),y={rootMargin:-x+"px "+-h+"px "+-v+"px "+-w+"px",threshold:_t(0,_n(1,c))||1};let S=!0;function N(j){const k=j[0].intersectionRatio;if(k!==c){if(!S)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!zc(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(N,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(N,y)}n.observe(e)}return i(!0),s}function Mg(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,u=Di(e),f=o||s?[...u?$r(u):[],...$r(t)]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=u&&l?jg(u,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(w=>{let[b]=w;b&&b.target===u&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=g)==null||y.observe(t)})),n()}),u&&!c&&g.observe(u),g.observe(t));let x,h=c?Hn(e):null;c&&v();function v(){const w=Hn(e);h&&!zc(h,w)&&n(),h=w,x=requestAnimationFrame(v)}return n(),()=>{var w;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),p==null||p(),(w=g)==null||w.disconnect(),g=null,c&&cancelAnimationFrame(x)}}const Rg=rg,Lg=og,Pg=eg,Dg=ig,Og=tg,Ya=Qh,Fg=sg,$g=(e,t,n)=>{const r=new Map,o={platform:Ig,...n},s={...o.platform,_c:r};return Jh(e,t,{...o,platform:s})};var zg=typeof document<"u",Bg=function(){},Ao=zg?d.useLayoutEffect:Bg;function Po(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(!Po(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)&&!Po(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Bc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ka(e,t){const n=Bc(e);return Math.round(t*n)/n}function Cs(e){const t=d.useRef(e);return Ao(()=>{t.current=e}),t}function Hg(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:u}=e,[f,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=d.useState(r);Po(m,r)||g(r);const[x,h]=d.useState(null),[v,w]=d.useState(null),b=d.useCallback(E=>{E!==j.current&&(j.current=E,h(E))},[]),y=d.useCallback(E=>{E!==k.current&&(k.current=E,w(E))},[]),S=s||x,N=i||v,j=d.useRef(null),k=d.useRef(null),A=d.useRef(f),G=c!=null,Q=Cs(c),O=Cs(o),P=Cs(u),K=d.useCallback(()=>{if(!j.current||!k.current)return;const E={placement:t,strategy:n,middleware:m};O.current&&(E.platform=O.current),$g(j.current,k.current,E).then(T=>{const M={...T,isPositioned:P.current!==!1};W.current&&!Po(A.current,M)&&(A.current=M,Kr.flushSync(()=>{p(M)}))})},[m,t,n,O,P]);Ao(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(E=>({...E,isPositioned:!1})))},[u]);const W=d.useRef(!1);Ao(()=>(W.current=!0,()=>{W.current=!1}),[]),Ao(()=>{if(S&&(j.current=S),N&&(k.current=N),S&&N){if(Q.current)return Q.current(S,N,K);K()}},[S,N,K,Q,G]);const z=d.useMemo(()=>({reference:j,floating:k,setReference:b,setFloating:y}),[b,y]),_=d.useMemo(()=>({reference:S,floating:N}),[S,N]),q=d.useMemo(()=>{const E={position:n,left:0,top:0};if(!_.floating)return E;const T=Ka(_.floating,f.x),M=Ka(_.floating,f.y);return l?{...E,transform:"translate("+T+"px, "+M+"px)",...Bc(_.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:M}},[n,l,_.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:K,refs:z,elements:_,floatingStyles:q}),[f,K,z,_,q])}const Ug=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?Ya({element:r.current,padding:o}).fn(n):{}:r?Ya({element:r,padding:o}).fn(n):{}}}},Wg=(e,t)=>({...Rg(e),options:[e,t]}),Vg=(e,t)=>({...Lg(e),options:[e,t]}),Gg=(e,t)=>({...Fg(e),options:[e,t]}),Yg=(e,t)=>({...Pg(e),options:[e,t]}),Kg=(e,t)=>({...Dg(e),options:[e,t]}),qg=(e,t)=>({...Og(e),options:[e,t]}),Xg=(e,t)=>({...Ug(e),options:[e,t]});var Zg="Arrow",Hc=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(je.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"})})});Hc.displayName=Zg;var Jg=Hc;function Qg(e){const[t,n]=d.useState(void 0);return ut(()=>{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,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.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 Oi="Popper",[Uc,Er]=Rn(Oi),[e0,Wc]=Uc(Oi),Vc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return a.jsx(e0,{scope:t,anchor:r,onAnchorChange:o,children:n})};Vc.displayName=Oi;var Gc="PopperAnchor",Yc=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Wc(Gc,n),i=d.useRef(null),l=ze(t,i),c=d.useRef(null);return d.useEffect(()=>{const u=c.current;c.current=(r==null?void 0:r.current)||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(je.div,{...o,ref:l})});Yc.displayName=Gc;var Fi="PopperContent",[t0,n0]=Uc(Fi),Kc=d.forwardRef((e,t)=>{var I,X,re,ne,ue,ae;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:x,...h}=e,v=Wc(Fi,n),[w,b]=d.useState(null),y=ze(t,fe=>b(fe)),[S,N]=d.useState(null),j=Qg(S),k=(j==null?void 0:j.width)??0,A=(j==null?void 0:j.height)??0,G=r+(s!=="center"?"-"+s:""),Q=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},O=Array.isArray(u)?u:[u],P=O.length>0,K={padding:Q,boundary:O.filter(o0),altBoundary:P},{refs:W,floatingStyles:z,placement:_,isPositioned:q,middlewareData:E}=Hg({strategy:"fixed",placement:G,whileElementsMounted:(...fe)=>Mg(...fe,{animationFrame:g==="always"}),elements:{reference:v.anchor},middleware:[Wg({mainAxis:o+A,alignmentAxis:i}),c&&Vg({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Gg():void 0,...K}),c&&Yg({...K}),Kg({...K,apply:({elements:fe,rects:ye,availableWidth:Le,availableHeight:Pe})=>{const{width:$e,height:Oe}=ye.reference,Ue=fe.floating.style;Ue.setProperty("--radix-popper-available-width",`${Le}px`),Ue.setProperty("--radix-popper-available-height",`${Pe}px`),Ue.setProperty("--radix-popper-anchor-width",`${$e}px`),Ue.setProperty("--radix-popper-anchor-height",`${Oe}px`)}}),S&&Xg({element:S,padding:l}),s0({arrowWidth:k,arrowHeight:A}),m&&qg({strategy:"referenceHidden",...K})]}),[T,M]=Zc(_),F=Nn(x);ut(()=>{q&&(F==null||F())},[q,F]);const ee=(I=E.arrow)==null?void 0:I.x,L=(X=E.arrow)==null?void 0:X.y,U=((re=E.arrow)==null?void 0:re.centerOffset)!==0,[Y,J]=d.useState();return ut(()=>{w&&J(window.getComputedStyle(w).zIndex)},[w]),a.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(ne=E.transformOrigin)==null?void 0:ne.x,(ue=E.transformOrigin)==null?void 0:ue.y].join(" "),...((ae=E.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(t0,{scope:n,placedSide:T,onArrowChange:N,arrowX:ee,arrowY:L,shouldHideArrow:U,children:a.jsx(je.div,{"data-side":T,"data-align":M,...h,ref:y,style:{...h.style,animation:q?void 0:"none"}})})})});Kc.displayName=Fi;var qc="PopperArrow",r0={top:"bottom",right:"left",bottom:"top",left:"right"},Xc=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=n0(qc,r),i=r0[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(Jg,{...o,ref:n,style:{...o.style,display:"block"}})})});Xc.displayName=qc;function o0(e){return e!==null}var s0=e=>({name:"transformOrigin",options:e,fn(t){var v,w,b;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,[u,f]=Zc(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+l/2,g=(((b=o.arrow)==null?void 0:b.y)??0)+c/2;let x="",h="";return u==="bottom"?(x=i?p:`${m}px`,h=`${-c}px`):u==="top"?(x=i?p:`${m}px`,h=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,h=i?p:`${g}px`):u==="left"&&(x=`${r.floating.width+c}px`,h=i?p:`${g}px`),{data:{x,y:h}}}});function Zc(e){const[t,n="center"]=e.split("-");return[t,n]}var $i=Vc,Jo=Yc,zi=Kc,Bi=Xc,i0="Portal",Zr=d.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=d.useState(!1);ut(()=>s(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?Gp.createPortal(a.jsx(je.div,{...r,ref:t}),i):null});Zr.displayName=i0;function a0(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var Cn=e=>{const{present:t,children:n}=e,r=l0(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=ze(r.ref,c0(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Cn.displayName="Presence";function l0(e){const[t,n]=d.useState(),r=d.useRef(null),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,c]=a0(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const u=fo(r.current);s.current=l==="mounted"?u:"none"},[l]),ut(()=>{const u=r.current,f=o.current;if(f!==e){const m=s.current,g=fo(u);e?c("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),ut(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,p=g=>{const h=fo(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",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=g=>{g.target===t&&(s.current=fo(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function fo(e){return(e==null?void 0:e.animationName)||"none"}function c0(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 u0=Ei[" useInsertionEffect ".trim().toString()]||ut;function Un({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=d0({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const f=d.useRef(e!==void 0);d.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 u=d.useCallback(f=>{var p;if(l){const m=f0(f)?f(e):f;m!==e&&((p=i.current)==null||p.call(i,m))}else s(f)},[l,e,s,i]);return[c,u]}function d0({defaultProp:e,onChange:t}){const[n,r]=d.useState(e),o=d.useRef(n),s=d.useRef(t);return u0(()=>{s.current=t},[t]),d.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function f0(e){return typeof e=="function"}var Jc=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"}),p0="VisuallyHidden",Qc=d.forwardRef((e,t)=>a.jsx(je.span,{...e,ref:t,style:{...Jc,...e.style}}));Qc.displayName=p0;var m0=Qc,[Qo]=Rn("Tooltip",[Er]),es=Er(),eu="TooltipProvider",h0=700,ei="tooltip.open",[g0,Hi]=Qo(eu),tu=e=>{const{__scopeTooltip:t,delayDuration:n=h0,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=d.useRef(!0),l=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(g0,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:d.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};tu.displayName=eu;var zr="Tooltip",[x0,Jr]=Qo(zr),nu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Hi(zr,e.__scopeTooltip),u=es(t),[f,p]=d.useState(null),m=on(),g=d.useRef(0),x=i??c.disableHoverableContent,h=l??c.delayDuration,v=d.useRef(!1),[w,b]=Un({prop:r,defaultProp:o??!1,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(ei))):c.onClose(),s==null||s(k)},caller:zr}),y=d.useMemo(()=>w?v.current?"delayed-open":"instant-open":"closed",[w]),S=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,v.current=!1,b(!0)},[b]),N=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,b(!1)},[b]),j=d.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{v.current=!0,b(!0),g.current=0},h)},[h,b]);return d.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),a.jsx($i,{...u,children:a.jsx(x0,{scope:t,contentId:m,open:w,stateAttribute:y,trigger:f,onTriggerChange:p,onTriggerEnter:d.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:d.useCallback(()=>{x?N():(window.clearTimeout(g.current),g.current=0)},[N,x]),onOpen:S,onClose:N,disableHoverableContent:x,children:n})})};nu.displayName=zr;var ti="TooltipTrigger",ru=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Jr(ti,n),s=Hi(ti,n),i=es(n),l=d.useRef(null),c=ze(t,l,o.onTriggerChange),u=d.useRef(!1),f=d.useRef(!1),p=d.useCallback(()=>u.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Jo,{asChild:!0,...i,children:a.jsx(je.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ge(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:ge(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:ge(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ge(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ge(e.onBlur,o.onClose),onClick:ge(e.onClick,o.onClose)})})});ru.displayName=ti;var Ui="TooltipPortal",[v0,w0]=Qo(Ui,{forceMount:void 0}),ou=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Jr(Ui,t);return a.jsx(v0,{scope:t,forceMount:n,children:a.jsx(Cn,{present:n||s.open,children:a.jsx(Zr,{asChild:!0,container:o,children:r})})})};ou.displayName=Ui;var mr="TooltipContent",su=d.forwardRef((e,t)=>{const n=w0(mr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Jr(mr,e.__scopeTooltip);return a.jsx(Cn,{present:r||i.open,children:i.disableHoverableContent?a.jsx(iu,{side:o,...s,ref:t}):a.jsx(b0,{side:o,...s,ref:t})})}),b0=d.forwardRef((e,t)=>{const n=Jr(mr,e.__scopeTooltip),r=Hi(mr,e.__scopeTooltip),o=d.useRef(null),s=ze(t,o),[i,l]=d.useState(null),{trigger:c,onClose:u}=n,f=o.current,{onPointerInTransitChange:p}=r,m=d.useCallback(()=>{l(null),p(!1)},[p]),g=d.useCallback((x,h)=>{const v=x.currentTarget,w={x:x.clientX,y:x.clientY},b=E0(w,v.getBoundingClientRect()),y=T0(w,b),S=k0(h.getBoundingClientRect()),N=N0([...y,...S]);l(N),p(!0)},[p]);return d.useEffect(()=>()=>m(),[m]),d.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]),d.useEffect(()=>{if(i){const x=h=>{const v=h.target,w={x:h.clientX,y:h.clientY},b=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),y=!A0(w,i);b?m():y&&(m(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,f,i,u,m]),a.jsx(iu,{...e,ref:s})}),[y0,C0]=Qo(zr,{isInside:!1}),S0=Lm("TooltipContent"),iu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Jr(mr,n),u=es(n),{onClose:f}=c;return d.useEffect(()=>(document.addEventListener(ei,f),()=>document.removeEventListener(ei,f)),[f]),d.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(qr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:a.jsxs(zi,{"data-state":c.stateAttribute,...u,...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(S0,{children:r}),a.jsx(y0,{scope:n,isInside:!0,children:a.jsx(m0,{id:c.contentId,role:"tooltip",children:o||r})})]})})});su.displayName=mr;var au="TooltipArrow",lu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=es(n);return C0(au,n).isInside?null:a.jsx(Bi,{...o,...r,ref:t})});lu.displayName=au;function E0(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 T0(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 k0(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 A0(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],u=l.x,f=l.y,p=c.x,m=c.y;f>r!=m>r&&n<(p-u)*(r-f)/(m-f)+u&&(o=!o)}return o}function N0(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),_0(t)}function _0(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 I0=tu,j0=nu,M0=ru,R0=ou,L0=su,P0=lu;function D0({delayDuration:e=0,...t}){return a.jsx(I0,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Wi({...e}){return a.jsx(D0,{delayDuration:500,children:a.jsx(j0,{"data-slot":"tooltip",...e})})}function Vi({...e}){return a.jsx(M0,{"data-slot":"tooltip-trigger",...e})}function Gi({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(R0,{children:a.jsxs(L0,{"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(P0,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const cu="text-[var(--color-primary-wMain)] enabled:hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:enabled:hover:text-[var(--color-primary-text-w10)]",Ss=cu+" enabled:hover:bg-[var(--color-primary-w10)] dark:enabled:hover:bg-[var(--color-primary-w60)]",O0=Mn("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",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] enabled:hover:bg-[var(--color-primary-w100)] dark:enabled:hover:bg-[var(--color-primary-w60)] dark:text-[--color-primary-w10]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] enabled:hover:bg-[var(--color-error-w70)]",outline:Ss+" border border-1 border-[var(--color-primary-wMain)]",secondary:Ss,ghost:Ss,link:cu+" underline-offset-4 enabled: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 me({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:s="",...i}){const l=r?hc:"button",c=o?{...i,"aria-label":o}:i,u=a.jsx(l,{"data-slot":"button","data-testid":s||o||i.title,className:be(O0({variant:t,size:n,className:e})),...c});return o?a.jsxs(Wi,{children:[a.jsx(Vi,{asChild:!0,children:u}),a.jsx(Gi,{children:o})]}):u}const uu=({onClick:e,text:t="View Agent Workflow"})=>a.jsx(me,{"data-testid":"viewAgentWorkflow",variant:"ghost",size:"sm",onClick:e,tooltip:t,children:a.jsx(ko,{className:"h-4 w-4"})}),Yi=d.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}));Yi.displayName="Textarea";var Es="focusScope.autoFocusOnMount",Ts="focusScope.autoFocusOnUnmount",qa={bubbles:!1,cancelable:!0},F0="FocusScope",ts=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=d.useState(null),u=Nn(o),f=Nn(s),p=d.useRef(null),m=ze(t,h=>c(h)),g=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let h=function(y){if(g.paused||!l)return;const S=y.target;l.contains(S)?p.current=S:En(p.current,{select:!0})},v=function(y){if(g.paused||!l)return;const S=y.relatedTarget;S!==null&&(l.contains(S)||En(p.current,{select:!0}))},w=function(y){if(document.activeElement===document.body)for(const N of y)N.removedNodes.length>0&&En(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const b=new MutationObserver(w);return l&&b.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),b.disconnect()}}},[r,l,g.paused]),d.useEffect(()=>{if(l){Za.add(g);const h=document.activeElement;if(!l.contains(h)){const w=new CustomEvent(Es,qa);l.addEventListener(Es,u),l.dispatchEvent(w),w.defaultPrevented||($0(W0(du(l)),{select:!0}),document.activeElement===h&&En(l))}return()=>{l.removeEventListener(Es,u),setTimeout(()=>{const w=new CustomEvent(Ts,qa);l.addEventListener(Ts,f),l.dispatchEvent(w),w.defaultPrevented||En(h??document.body,{select:!0}),l.removeEventListener(Ts,f),Za.remove(g)},0)}}},[l,u,f,g]);const x=d.useCallback(h=>{if(!n&&!r||g.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,w=document.activeElement;if(v&&w){const b=h.currentTarget,[y,S]=z0(b);y&&S?!h.shiftKey&&w===S?(h.preventDefault(),n&&En(y,{select:!0})):h.shiftKey&&w===y&&(h.preventDefault(),n&&En(S,{select:!0})):w===b&&h.preventDefault()}},[n,r,g.paused]);return a.jsx(je.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});ts.displayName=F0;function $0(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(En(r,{select:t}),document.activeElement!==n)return}function z0(e){const t=du(e),n=Xa(t,e),r=Xa(t.reverse(),e);return[n,r]}function du(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 Xa(e,t){for(const n of e)if(!B0(n,{upTo:t}))return n}function B0(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 H0(e){return e instanceof HTMLInputElement&&"select"in e}function En(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&H0(e)&&t&&e.select()}}var Za=U0();function U0(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ja(e,t),e.unshift(t)},remove(t){var n;e=Ja(e,t),(n=e[0])==null||n.resume()}}}function Ja(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function W0(e){return e.filter(t=>t.tagName!=="A")}var ks=0;function Ki(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Qa()),document.body.insertAdjacentElement("beforeend",e[1]??Qa()),ks++,()=>{ks===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ks--}},[])}function Qa(){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 tn=function(){return tn=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},tn.apply(this,arguments)};function fu(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 V0(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 No="right-scroll-bar-position",_o="width-before-scroll-bar",G0="with-scroll-bars-hidden",Y0="--removed-body-scroll-bar-size";function As(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function K0(e,t){var n=d.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 q0=typeof window<"u"?d.useLayoutEffect:d.useEffect,el=new WeakMap;function X0(e,t){var n=K0(null,function(r){return e.forEach(function(o){return As(o,r)})});return q0(function(){var r=el.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||As(l,null)}),s.forEach(function(l){o.has(l)||As(l,i)})}el.set(n,e)},[e]),n}function Z0(e){return e}function J0(e,t){t===void 0&&(t=Z0);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)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(f){i.push(f),u()},filter:function(f){return i=i.filter(f),n}}}};return o}function Q0(e){e===void 0&&(e={});var t=J0(null);return t.options=tn({async:!0,ssr:!1},e),t}var pu=function(e){var t=e.sideCar,n=fu(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 d.createElement(r,tn({},n))};pu.isSideCarExport=!0;function ex(e,t){return e.useMedium(t),pu}var mu=Q0(),Ns=function(){},ns=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Ns,onWheelCapture:Ns,onTouchMoveCapture:Ns}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,g=e.noRelative,x=e.noIsolation,h=e.inert,v=e.allowPinchZoom,w=e.as,b=w===void 0?"div":w,y=e.gapMode,S=fu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=m,j=X0([n,t]),k=tn(tn({},S),o);return d.createElement(d.Fragment,null,f&&d.createElement(N,{sideCar:mu,removeScrollBar:u,shards:p,noRelative:g,noIsolation:x,inert:h,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:y}),i?d.cloneElement(d.Children.only(l),tn(tn({},k),{ref:j})):d.createElement(b,tn({},k,{className:c,ref:j}),l))});ns.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ns.classNames={fullWidth:_o,zeroRight:No};var tx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nx(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=tx();return t&&e.setAttribute("nonce",t),e}function rx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function ox(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var sx=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nx())&&(rx(t,n),ox(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},ix=function(){var e=sx();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},hu=function(){var e=ix(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},ax={left:0,top:0,right:0,gap:0},_s=function(e){return parseInt(e||"",10)||0},lx=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[_s(n),_s(r),_s(o)]},cx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return ax;var t=lx(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])}},ux=hu(),cr="data-scroll-locked",dx=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(G0,` {
|
|
74
|
-
overflow: hidden `).concat(r,`;
|
|
75
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
76
|
-
}
|
|
77
|
-
body[`).concat(cr,`] {
|
|
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(No,` {
|
|
91
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.`).concat(_o,` {
|
|
95
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.`).concat(No," .").concat(No,` {
|
|
99
|
-
right: 0 `).concat(r,`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.`).concat(_o," .").concat(_o,` {
|
|
103
|
-
margin-right: 0 `).concat(r,`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
body[`).concat(cr,`] {
|
|
107
|
-
`).concat(Y0,": ").concat(l,`px;
|
|
108
|
-
}
|
|
109
|
-
`)},tl=function(){var e=parseInt(document.body.getAttribute(cr)||"0",10);return isFinite(e)?e:0},fx=function(){d.useEffect(function(){return document.body.setAttribute(cr,(tl()+1).toString()),function(){var e=tl()-1;e<=0?document.body.removeAttribute(cr):document.body.setAttribute(cr,e.toString())}},[])},px=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;fx();var s=d.useMemo(function(){return cx(o)},[o]);return d.createElement(ux,{styles:dx(s,!t,o,n?"":"!important")})},ni=!1;if(typeof window<"u")try{var po=Object.defineProperty({},"passive",{get:function(){return ni=!0,!0}});window.addEventListener("test",po,po),window.removeEventListener("test",po,po)}catch{ni=!1}var Jn=ni?{passive:!1}:!1,mx=function(e){return e.tagName==="TEXTAREA"},gu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!mx(e)&&n[t]==="visible")},hx=function(e){return gu(e,"overflowY")},gx=function(e){return gu(e,"overflowX")},nl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=xu(e,r);if(o){var s=vu(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},xx=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},vx=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},xu=function(e,t){return e==="v"?hx(t):gx(t)},vu=function(e,t){return e==="v"?xx(t):vx(t)},wx=function(e,t){return e==="h"&&t==="rtl"?-1:1},bx=function(e,t,n,r,o){var s=wx(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,f=i>0,p=0,m=0;do{if(!l)break;var g=vu(e,l),x=g[0],h=g[1],v=g[2],w=h-v-s*x;(x||w)&&xu(e,l)&&(p+=w,m+=x);var b=l.parentNode;l=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(u=!0),u},mo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},rl=function(e){return[e.deltaX,e.deltaY]},ol=function(e){return e&&"current"in e?e.current:e},yx=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Cx=function(e){return`
|
|
110
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
111
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
112
|
-
`)},Sx=0,Qn=[];function Ex(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(Sx++)[0],s=d.useState(hu)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=V0([e.lockRef.current],(e.shards||[]).map(ol),!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=d.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var w=mo(h),b=n.current,y="deltaX"in h?h.deltaX:b[0]-w[0],S="deltaY"in h?h.deltaY:b[1]-w[1],N,j=h.target,k=Math.abs(y)>Math.abs(S)?"h":"v";if("touches"in h&&k==="h"&&j.type==="range")return!1;var A=nl(k,j);if(!A)return!0;if(A?N=k:(N=k==="v"?"h":"v",A=nl(k,j)),!A)return!1;if(!r.current&&"changedTouches"in h&&(y||S)&&(r.current=N),!N)return!0;var G=r.current||N;return bx(G,v,h,G==="h"?y:S)},[]),c=d.useCallback(function(h){var v=h;if(!(!Qn.length||Qn[Qn.length-1]!==s)){var w="deltaY"in v?rl(v):mo(v),b=t.current.filter(function(N){return N.name===v.type&&(N.target===v.target||v.target===N.shadowParent)&&yx(N.delta,w)})[0];if(b&&b.should){v.cancelable&&v.preventDefault();return}if(!b){var y=(i.current.shards||[]).map(ol).filter(Boolean).filter(function(N){return N.contains(v.target)}),S=y.length>0?l(v,y[0]):!i.current.noIsolation;S&&v.cancelable&&v.preventDefault()}}},[]),u=d.useCallback(function(h,v,w,b){var y={name:h,delta:v,target:w,should:b,shadowParent:Tx(w)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(S){return S!==y})},1)},[]),f=d.useCallback(function(h){n.current=mo(h),r.current=void 0},[]),p=d.useCallback(function(h){u(h.type,rl(h),h.target,l(h,e.lockRef.current))},[]),m=d.useCallback(function(h){u(h.type,mo(h),h.target,l(h,e.lockRef.current))},[]);d.useEffect(function(){return Qn.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Jn),document.addEventListener("touchmove",c,Jn),document.addEventListener("touchstart",f,Jn),function(){Qn=Qn.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,Jn),document.removeEventListener("touchmove",c,Jn),document.removeEventListener("touchstart",f,Jn)}},[]);var g=e.removeScrollBar,x=e.inert;return d.createElement(d.Fragment,null,x?d.createElement(s,{styles:Cx(o)}):null,g?d.createElement(px,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Tx(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const kx=ex(mu,Ex);var rs=d.forwardRef(function(e,t){return d.createElement(ns,tn({},e,{ref:t,sideCar:kx}))});rs.classNames=ns.classNames;var Ax=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},er=new WeakMap,ho=new WeakMap,go={},Is=0,wu=function(e){return e&&(e.host||wu(e.parentNode))},Nx=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=wu(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})},_x=function(e,t,n,r){var o=Nx(t,Array.isArray(e)?e:[e]);go[n]||(go[n]=new WeakMap);var s=go[n],i=[],l=new Set,c=new Set(o),u=function(p){!p||l.has(p)||(l.add(p),u(p.parentNode))};o.forEach(u);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=(er.get(m)||0)+1,v=(s.get(m)||0)+1;er.set(m,h),s.set(m,v),i.push(m),h===1&&x&&ho.set(m,!0),v===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return f(t),l.clear(),Is++,function(){i.forEach(function(p){var m=er.get(p)-1,g=s.get(p)-1;er.set(p,m),s.set(p,g),m||(ho.has(p)||p.removeAttribute(r),ho.delete(p)),g||p.removeAttribute(n)}),Is--,Is||(er=new WeakMap,er=new WeakMap,ho=new WeakMap,go={})}},qi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Ax(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),_x(r,o,n,"aria-hidden")):function(){return null}},os="Dialog",[bu]=Rn(os),[Ix,Xt]=bu(os),yu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=d.useRef(null),c=d.useRef(null),[u,f]=Un({prop:r,defaultProp:o??!1,onChange:s,caller:os});return a.jsx(Ix,{scope:t,triggerRef:l,contentRef:c,contentId:on(),titleId:on(),descriptionId:on(),open:u,onOpenChange:f,onOpenToggle:d.useCallback(()=>f(p=>!p),[f]),modal:i,children:n})};yu.displayName=os;var Cu="DialogTrigger",Su=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Xt(Cu,n),s=ze(t,o.triggerRef);return a.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ji(o.open),...r,ref:s,onClick:ge(e.onClick,o.onOpenToggle)})});Su.displayName=Cu;var Xi="DialogPortal",[jx,Eu]=bu(Xi,{forceMount:void 0}),Tu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Xt(Xi,t);return a.jsx(jx,{scope:t,forceMount:n,children:d.Children.map(r,i=>a.jsx(Cn,{present:n||s.open,children:a.jsx(Zr,{asChild:!0,container:o,children:i})}))})};Tu.displayName=Xi;var Do="DialogOverlay",ku=d.forwardRef((e,t)=>{const n=Eu(Do,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Xt(Do,e.__scopeDialog);return s.modal?a.jsx(Cn,{present:r||s.open,children:a.jsx(Rx,{...o,ref:t})}):null});ku.displayName=Do;var Mx=Bn("DialogOverlay.RemoveScroll"),Rx=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Xt(Do,n);return a.jsx(rs,{as:Mx,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(je.div,{"data-state":Ji(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Wn="DialogContent",Au=d.forwardRef((e,t)=>{const n=Eu(Wn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Xt(Wn,e.__scopeDialog);return a.jsx(Cn,{present:r||s.open,children:s.modal?a.jsx(Lx,{...o,ref:t}):a.jsx(Px,{...o,ref:t})})});Au.displayName=Wn;var Lx=d.forwardRef((e,t)=>{const n=Xt(Wn,e.__scopeDialog),r=d.useRef(null),o=ze(t,n.contentRef,r);return d.useEffect(()=>{const s=r.current;if(s)return qi(s)},[]),a.jsx(Nu,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ge(e.onFocusOutside,s=>s.preventDefault())})}),Px=d.forwardRef((e,t)=>{const n=Xt(Wn,e.__scopeDialog),r=d.useRef(!1),o=d.useRef(!1);return a.jsx(Nu,{...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,u;(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;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Nu=d.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=Xt(Wn,n),c=d.useRef(null),u=ze(t,c);return Ki(),a.jsxs(a.Fragment,{children:[a.jsx(ts,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(qr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ji(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Dx,{titleId:l.titleId}),a.jsx(Fx,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Zi="DialogTitle",_u=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Xt(Zi,n);return a.jsx(je.h2,{id:o.titleId,...r,ref:t})});_u.displayName=Zi;var Iu="DialogDescription",ju=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Xt(Iu,n);return a.jsx(je.p,{id:o.descriptionId,...r,ref:t})});ju.displayName=Iu;var Mu="DialogClose",Ru=d.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Xt(Mu,n);return a.jsx(je.button,{type:"button",...r,ref:t,onClick:ge(e.onClick,()=>o.onOpenChange(!1))})});Ru.displayName=Mu;function Ji(e){return e?"open":"closed"}var Lu="DialogTitleWarning",[HS,Pu]=Ah(Lu,{contentName:Wn,titleName:Zi,docsSlug:"dialog"}),Dx=({titleId:e})=>{const t=Pu(Lu),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 d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Ox="DialogDescriptionWarning",Fx=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Pu(Ox).contentName}}.`;return d.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},$x=yu,zx=Su,Bx=Tu,Hx=ku,Ux=Au,Wx=_u,Vx=ju,Du=Ru;function Qr({...e}){return a.jsx($x,{"data-slot":"dialog",...e})}function Gx({...e}){return a.jsx(zx,{"data-slot":"dialog-trigger",...e})}function Yx({...e}){return a.jsx(Bx,{"data-slot":"dialog-portal",...e})}function sl({...e}){return a.jsx(Du,{"data-slot":"dialog-close",...e})}function Kx({className:e,...t}){return a.jsx(Hx,{"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 eo({className:e,children:t,showCloseButton:n=!1,...r}){return a.jsxs(Yx,{"data-slot":"dialog-portal",children:[a.jsx(Kx,{}),a.jsxs(Ux,{"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(Du,{"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(Go,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function to({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 Qi({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 no({className:e,...t}){return a.jsx(Wx,{"data-slot":"dialog-title",className:be("text-lg leading-none font-semibold",e),...t})}function ro({className:e,...t}){return a.jsx(Vx,{"data-slot":"dialog-description",className:be("py-4 text-sm",e),...t})}const ss=d.createContext(null);ss.displayName="PanelGroupContext";const Ve={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"},ea=10,$n=d.useLayoutEffect,il=Ei.useId,qx=typeof il=="function"?il:()=>null;let Xx=0;function ta(e=null){const t=qx(),n=d.useRef(e||t||null);return n.current===null&&(n.current=""+Xx++),e??n.current}function Ou({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:i,maxSize:l,minSize:c,onCollapse:u,onExpand:f,onResize:p,order:m,style:g,tagName:x="div",...h}){const v=d.useContext(ss);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:w,expandPanel:b,getPanelSize:y,getPanelStyle:S,groupId:N,isPanelCollapsed:j,reevaluatePanelConstraints:k,registerPanel:A,resizePanel:G,unregisterPanel:Q}=v,O=ta(i),P=d.useRef({callbacks:{onCollapse:u,onExpand:f,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:O,idIsFromProps:i!==void 0,order:m});d.useRef({didLogMissingDefaultSizeWarning:!1}),$n(()=>{const{callbacks:W,constraints:z}=P.current,_={...z};P.current.id=O,P.current.idIsFromProps=i!==void 0,P.current.order=m,W.onCollapse=u,W.onExpand=f,W.onResize=p,z.collapsedSize=n,z.collapsible=r,z.defaultSize=o,z.maxSize=l,z.minSize=c,(_.collapsedSize!==z.collapsedSize||_.collapsible!==z.collapsible||_.maxSize!==z.maxSize||_.minSize!==z.minSize)&&k(P.current,_)}),$n(()=>{const W=P.current;return A(W),()=>{Q(W)}},[m,O,A,Q]),d.useImperativeHandle(s,()=>({collapse:()=>{w(P.current)},expand:W=>{b(P.current,W)},getId(){return O},getSize(){return y(P.current)},isCollapsed(){return j(P.current)},isExpanded(){return!j(P.current)},resize:W=>{G(P.current,W)}}),[w,b,y,j,O,G]);const K=S(P.current,o);return d.createElement(x,{...h,children:e,className:t,id:O,style:{...K,...g},[Ve.groupId]:N,[Ve.panel]:"",[Ve.panelCollapsible]:r||void 0,[Ve.panelId]:O,[Ve.panelSize]:parseFloat(""+K.flexGrow).toFixed(1)})}const Fu=d.forwardRef((e,t)=>d.createElement(Ou,{...e,forwardedRef:t}));Ou.displayName="Panel";Fu.displayName="forwardRef(Panel)";let ri=null,Io=-1,Tn=null;function Zx(e,t,n){const r=(t&Uu)!==0,o=(t&Wu)!==0,s=(t&Vu)!==0,i=(t&Gu)!==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 Jx(){Tn!==null&&(document.head.removeChild(Tn),ri=null,Tn=null,Io=-1)}function js(e,t,n){var r,o;const s=Zx(e,t);if(ri!==s){if(ri=s,Tn===null&&(Tn=document.createElement("style"),document.head.appendChild(Tn)),Io>=0){var i;(i=Tn.sheet)===null||i===void 0||i.removeRule(Io)}Io=(r=(o=Tn.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function $u(e){return e.type==="keydown"}function zu(e){return e.type.startsWith("pointer")}function Bu(e){return e.type.startsWith("mouse")}function is(e){if(zu(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Bu(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Qx(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function ev(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 tv(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:cl(e),b:cl(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Te(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:ll(al(n.a)),b:ll(al(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 nv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function rv(e){var t;const n=getComputedStyle((t=Hu(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function ov(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||rv(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"||nv.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function al(e){let t=e.length;for(;t--;){const n=e[t];if(Te(n,"Missing node"),ov(n))return n}return null}function ll(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cl(e){const t=[];for(;e;)t.push(e),e=Hu(e);return t}function Hu(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Uu=1,Wu=2,Vu=4,Gu=8,sv=Qx()==="coarse";let Yt=[],ur=!1,kn=new Map,as=new Map;const Br=new Set;function iv(e,t,n,r,o){var s;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=kn.get(i))!==null&&s!==void 0?s:0;return kn.set(i,c+1),Br.add(l),Oo(),function(){var f;as.delete(e),Br.delete(l);const p=(f=kn.get(i))!==null&&f!==void 0?f:1;if(kn.set(i,p-1),Oo(),p===1&&kn.delete(i),Yt.includes(l)){const m=Yt.indexOf(l);m>=0&&Yt.splice(m,1),ls(),o("up",!0,null)}}}function av(e){const{target:t}=e,{x:n,y:r}=is(e);ur=!0,na({target:t,x:n,y:r}),Oo(),Yt.length>0&&(Fo("down",e),ls(),e.preventDefault(),Yu(t)||e.stopImmediatePropagation())}function Ms(e){const{x:t,y:n}=is(e);if(ur&&e.type!=="pointerleave"&&e.buttons===0&&(ur=!1,Fo("up",e)),!ur){const{target:r}=e;na({target:r,x:t,y:n})}Fo("move",e),ls(),Yt.length>0&&e.preventDefault()}function Rs(e){const{target:t}=e,{x:n,y:r}=is(e);as.clear(),ur=!1,Yt.length>0&&(e.preventDefault(),Yu(t)||e.stopImmediatePropagation()),Fo("up",e),na({target:t,x:n,y:r}),ls(),Oo()}function Yu(e){let t=e;for(;t;){if(t.hasAttribute(Ve.resizeHandle))return!0;t=t.parentElement}return!1}function na({target:e,x:t,y:n}){Yt.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Br.forEach(o=>{const{element:s,hitAreaMargins:i}=o,l=s.getBoundingClientRect(),{bottom:c,left:u,right:f,top:p}=l,m=sv?i.coarse:i.fine;if(t>=u-m&&t<=f+m&&n>=p-m&&n<=c+m){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&tv(r,s)>0){let x=r,h=!1;for(;x&&!x.contains(s);){if(ev(x.getBoundingClientRect(),l)){h=!0;break}x=x.parentElement}if(h)return}Yt.push(o)}})}function Ls(e,t){as.set(e,t)}function ls(){let e=!1,t=!1;Yt.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;as.forEach(r=>{n|=r}),e&&t?js("intersection",n):e?js("horizontal",n):t?js("vertical",n):Jx()}let Ps;function Oo(){var e;(e=Ps)===null||e===void 0||e.abort(),Ps=new AbortController;const t={capture:!0,signal:Ps.signal};Br.size&&(ur?(Yt.length>0&&kn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Rs,t),o.addEventListener("pointerleave",Ms,t),o.addEventListener("pointermove",Ms,t))}),kn.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Rs,t),o.addEventListener("pointercancel",Rs,t)})):kn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",av,t),o.addEventListener("pointermove",Ms,t))}))}function Fo(e,t){Br.forEach(n=>{const{setResizeHandlerState:r}=n,o=Yt.includes(n);r(e,o,t)})}function lv(){const[e,t]=d.useState(0);return d.useCallback(()=>t(n=>n+1),[])}function Te(e,t){if(!e)throw console.error(t),Error(t)}function Vn(e,t,n=ea){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function xn(e,t,n=ea){return Vn(e,t,n)===0}function Nt(e,t,n){return Vn(e,t,n)===0}function cv(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(!Nt(o,s,n))return!1}return!0}function sr({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Te(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:s,maxSize:i=100,minSize:l=0}=r;if(Vn(n,l)<0)if(s){const c=(o+l)/2;Vn(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(ea)),n}function Lr({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(Nt(e,0))return t;const i=[...t],[l,c]=r;Te(l!=null,"Invalid first pivot index"),Te(c!=null,"Invalid second pivot index");let u=0;if(s==="keyboard"){{const p=e<0?c:l,m=n[p];Te(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(Te(v!=null,`Previous layout not found for panel index ${p}`),Nt(v,g)){const w=h-v;Vn(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}{const p=e<0?l:c,m=n[p];Te(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(Te(v!=null,`Previous layout not found for panel index ${p}`),Nt(v,h)){const w=v-g;Vn(w,Math.abs(e))>0&&(e=e<0?0-w:w)}}}}{const p=e<0?1:-1;let m=e<0?c:l,g=0;for(;;){const h=t[m];Te(h!=null,`Previous layout not found for panel index ${m}`);const w=sr({panelConstraints:n,panelIndex:m,size:100})-h;if(g+=w,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(u),x=t[m];Te(x!=null,`Previous layout not found for panel index ${m}`);const h=x-g,v=sr({panelConstraints:n,panelIndex:m,size:h});if(!Nt(x,v)&&(u+=x-v,i[m]=v,u.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(cv(o,i))return o;{const p=e<0?c:l,m=t[p];Te(m!=null,`Previous layout not found for panel index ${p}`);const g=m+u,x=sr({panelConstraints:n,panelIndex:p,size:g});if(i[p]=x,!Nt(x,g)){let h=g-x,w=e<0?c:l;for(;w>=0&&w<n.length;){const b=i[w];Te(b!=null,`Previous layout not found for panel index ${w}`);const y=b+h,S=sr({panelConstraints:n,panelIndex:w,size:y});if(Nt(b,S)||(h-=S-b,i[w]=S),Nt(h,0))break;e>0?w--:w++}}}const f=i.reduce((p,m)=>m+p,0);return Nt(f,100)?i:o}function uv({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,i=0;const l=n[0];Te(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),u=Math.max(r,100-i),f=e[l];return{valueMax:c,valueMin:u,valueNow:f}}function Hr(e,t=document){return Array.from(t.querySelectorAll(`[${Ve.resizeHandleId}][data-panel-group-id="${e}"]`))}function Ku(e,t,n=document){const o=Hr(e,n).findIndex(s=>s.getAttribute(Ve.resizeHandleId)===t);return o??null}function qu(e,t,n){const r=Ku(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function dv(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Xu(e,t=document){if(dv(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function cs(e,t=document){const n=t.querySelector(`[${Ve.resizeHandleId}="${e}"]`);return n||null}function fv(e,t,n,r=document){var o,s,i,l;const c=cs(t,r),u=Hr(e,r),f=c?u.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 pv({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:i}){d.useRef({didWarnAboutMissingResizeHandle:!1}),$n(()=>{if(!s)return;const l=Hr(n,s);for(let c=0;c<o.length-1;c++){const{valueMax:u,valueMin:f,valueNow:p}=uv({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const g=o[c];Te(g,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",g.id),m.setAttribute("aria-valuemax",""+Math.round(u)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((c,u)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),d.useEffect(()=>{if(!s)return;const l=t.current;Te(l,"Eager values not found");const{panelDataArray:c}=l,u=Xu(n,s);Te(u!=null,`No group found for id "${n}"`);const f=Hr(n,s);Te(f,`No resize handles found for group id "${n}"`);const p=f.map(m=>{const g=m.getAttribute(Ve.resizeHandleId);Te(g,"Resize handle element has no handle id attribute");const[x,h]=fv(n,g,c,s);if(x==null||h==null)return()=>{};const v=w=>{if(!w.defaultPrevented)switch(w.key){case"Enter":{w.preventDefault();const b=c.findIndex(y=>y.id===x);if(b>=0){const y=c[b];Te(y,`No panel data found for index ${b}`);const S=r[b],{collapsedSize:N=0,collapsible:j,minSize:k=0}=y.constraints;if(S!=null&&j){const A=Lr({delta:Nt(S,N)?k-N:N-S,initialLayout:r,panelConstraints:c.map(G=>G.constraints),pivotIndices:qu(n,g,s),prevLayout:r,trigger:"keyboard"});r!==A&&i(A)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{p.forEach(m=>m())}},[s,e,t,n,r,o,i])}function ul(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 Zu(e,t){const n=e==="horizontal",{x:r,y:o}=is(t);return n?r:o}function mv(e,t,n,r,o){const s=n==="horizontal",i=cs(t,o);Te(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(Ve.groupId);Te(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const u=Zu(n,e),f=Xu(l,o);Te(f,`No group element found for id "${l}"`);const p=f.getBoundingClientRect(),m=s?p.width:p.height;return(u-c)/m*100}function hv(e,t,n,r,o,s){if($u(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:mv(e,t,n,r,s)}function gv({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];Te(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];Te(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,u=o/c;r++,t[s]=u,o-=u}return t}function tr(e,t,n){t.forEach((r,o)=>{const s=e[o];Te(s,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=s,{collapsedSize:u=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||xn(p,u))&&!xn(r,u)&&g(),m&&(p==null||!xn(p,u))&&xn(r,u)&&m())}})}function xo(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 xv({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 vv(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function dl(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 Ju(e){return`react-resizable-panels:${e}`}function Qu(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 ed(e,t){try{const n=Ju(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function wv(e,t,n){var r,o;const s=(r=ed(e,n))!==null&&r!==void 0?r:{},i=Qu(t);return(o=s[i])!==null&&o!==void 0?o:null}function bv(e,t,n,r,o){var s;const i=Ju(e),l=Qu(t),c=(s=ed(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(u){console.error(u)}}function fl({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(!Nt(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];Te(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];Te(i!=null,`No layout data found for index ${s}`);const l=sr({panelConstraints:t,panelIndex:s,size:i});i!=l&&(o+=i-l,n[s]=l)}if(!Nt(o,0))for(let s=0;s<t.length;s++){const i=n[s];Te(i!=null,`No layout data found for index ${s}`);const l=i+o,c=sr({panelConstraints:t,panelIndex:s,size:l});if(i!==c&&(o-=c-i,n[s]=c,Nt(o,0)))break}return n}const yv=100,Pr={getItem:e=>(dl(Pr),Pr.getItem(e)),setItem:(e,t)=>{dl(Pr),Pr.setItem(e,t)}},pl={};function td({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Pr,style:u,tagName:f="div",...p}){const m=ta(s),g=d.useRef(null),[x,h]=d.useState(null),[v,w]=d.useState([]),b=lv(),y=d.useRef({}),S=d.useRef(new Map),N=d.useRef(0),j=d.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),k=d.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});d.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),d.useImperativeHandle(o,()=>({getId:()=>j.current.id,getLayout:()=>{const{layout:L}=k.current;return L},setLayout:L=>{const{onLayout:U}=j.current,{layout:Y,panelDataArray:J}=k.current,I=fl({layout:L,panelConstraints:J.map(X=>X.constraints)});ul(Y,I)||(w(I),k.current.layout=I,U&&U(I),tr(J,I,y.current))}}),[]),$n(()=>{j.current.autoSaveId=e,j.current.direction=r,j.current.dragState=x,j.current.id=m,j.current.onLayout=i,j.current.storage=c}),pv({committedValuesRef:j,eagerValuesRef:k,groupId:m,layout:v,panelDataArray:k.current.panelDataArray,setLayout:w,panelGroupElement:g.current}),d.useEffect(()=>{const{panelDataArray:L}=k.current;if(e){if(v.length===0||v.length!==L.length)return;let U=pl[e];U==null&&(U=vv(bv,yv),pl[e]=U);const Y=[...L],J=new Map(S.current);U(e,Y,J,v,c)}},[e,v,c]),d.useEffect(()=>{});const A=d.useCallback(L=>{const{onLayout:U}=j.current,{layout:Y,panelDataArray:J}=k.current;if(L.constraints.collapsible){const I=J.map(ue=>ue.constraints),{collapsedSize:X=0,panelSize:re,pivotIndices:ne}=Fn(J,L,Y);if(Te(re!=null,`Panel size not found for panel "${L.id}"`),!xn(re,X)){S.current.set(L.id,re);const ae=rr(J,L)===J.length-1?re-X:X-re,fe=Lr({delta:ae,initialLayout:Y,panelConstraints:I,pivotIndices:ne,prevLayout:Y,trigger:"imperative-api"});xo(Y,fe)||(w(fe),k.current.layout=fe,U&&U(fe),tr(J,fe,y.current))}}},[]),G=d.useCallback((L,U)=>{const{onLayout:Y}=j.current,{layout:J,panelDataArray:I}=k.current;if(L.constraints.collapsible){const X=I.map(ye=>ye.constraints),{collapsedSize:re=0,panelSize:ne=0,minSize:ue=0,pivotIndices:ae}=Fn(I,L,J),fe=U??ue;if(xn(ne,re)){const ye=S.current.get(L.id),Le=ye!=null&&ye>=fe?ye:fe,$e=rr(I,L)===I.length-1?ne-Le:Le-ne,Oe=Lr({delta:$e,initialLayout:J,panelConstraints:X,pivotIndices:ae,prevLayout:J,trigger:"imperative-api"});xo(J,Oe)||(w(Oe),k.current.layout=Oe,Y&&Y(Oe),tr(I,Oe,y.current))}}},[]),Q=d.useCallback(L=>{const{layout:U,panelDataArray:Y}=k.current,{panelSize:J}=Fn(Y,L,U);return Te(J!=null,`Panel size not found for panel "${L.id}"`),J},[]),O=d.useCallback((L,U)=>{const{panelDataArray:Y}=k.current,J=rr(Y,L);return xv({defaultSize:U,dragState:x,layout:v,panelData:Y,panelIndex:J})},[x,v]),P=d.useCallback(L=>{const{layout:U,panelDataArray:Y}=k.current,{collapsedSize:J=0,collapsible:I,panelSize:X}=Fn(Y,L,U);return Te(X!=null,`Panel size not found for panel "${L.id}"`),I===!0&&xn(X,J)},[]),K=d.useCallback(L=>{const{layout:U,panelDataArray:Y}=k.current,{collapsedSize:J=0,collapsible:I,panelSize:X}=Fn(Y,L,U);return Te(X!=null,`Panel size not found for panel "${L.id}"`),!I||Vn(X,J)>0},[]),W=d.useCallback(L=>{const{panelDataArray:U}=k.current;U.push(L),U.sort((Y,J)=>{const I=Y.order,X=J.order;return I==null&&X==null?0:I==null?-1:X==null?1:I-X}),k.current.panelDataArrayChanged=!0,b()},[b]);$n(()=>{if(k.current.panelDataArrayChanged){k.current.panelDataArrayChanged=!1;const{autoSaveId:L,onLayout:U,storage:Y}=j.current,{layout:J,panelDataArray:I}=k.current;let X=null;if(L){const ne=wv(L,I,Y);ne&&(S.current=new Map(Object.entries(ne.expandToSizes)),X=ne.layout)}X==null&&(X=gv({panelDataArray:I}));const re=fl({layout:X,panelConstraints:I.map(ne=>ne.constraints)});ul(J,re)||(w(re),k.current.layout=re,U&&U(re),tr(I,re,y.current))}}),$n(()=>{const L=k.current;return()=>{L.layout=[]}},[]);const z=d.useCallback(L=>{let U=!1;const Y=g.current;return Y&&window.getComputedStyle(Y,null).getPropertyValue("direction")==="rtl"&&(U=!0),function(I){I.preventDefault();const X=g.current;if(!X)return()=>null;const{direction:re,dragState:ne,id:ue,keyboardResizeBy:ae,onLayout:fe}=j.current,{layout:ye,panelDataArray:Le}=k.current,{initialLayout:Pe}=ne??{},$e=qu(ue,L,X);let Oe=hv(I,L,re,ne,ae,X);const Ue=re==="horizontal";Ue&&U&&(Oe=-Oe);const Mt=Le.map(it=>it.constraints),Ye=Lr({delta:Oe,initialLayout:Pe??ye,panelConstraints:Mt,pivotIndices:$e,prevLayout:ye,trigger:$u(I)?"keyboard":"mouse-or-touch"}),Rt=!xo(ye,Ye);(zu(I)||Bu(I))&&N.current!=Oe&&(N.current=Oe,!Rt&&Oe!==0?Ue?Ls(L,Oe<0?Uu:Wu):Ls(L,Oe<0?Vu:Gu):Ls(L,0)),Rt&&(w(Ye),k.current.layout=Ye,fe&&fe(Ye),tr(Le,Ye,y.current))}},[]),_=d.useCallback((L,U)=>{const{onLayout:Y}=j.current,{layout:J,panelDataArray:I}=k.current,X=I.map(ye=>ye.constraints),{panelSize:re,pivotIndices:ne}=Fn(I,L,J);Te(re!=null,`Panel size not found for panel "${L.id}"`);const ae=rr(I,L)===I.length-1?re-U:U-re,fe=Lr({delta:ae,initialLayout:J,panelConstraints:X,pivotIndices:ne,prevLayout:J,trigger:"imperative-api"});xo(J,fe)||(w(fe),k.current.layout=fe,Y&&Y(fe),tr(I,fe,y.current))},[]),q=d.useCallback((L,U)=>{const{layout:Y,panelDataArray:J}=k.current,{collapsedSize:I=0,collapsible:X}=U,{collapsedSize:re=0,collapsible:ne,maxSize:ue=100,minSize:ae=0}=L.constraints,{panelSize:fe}=Fn(J,L,Y);fe!=null&&(X&&ne&&xn(fe,I)?xn(I,re)||_(L,re):fe<ae?_(L,ae):fe>ue&&_(L,ue))},[_]),E=d.useCallback((L,U)=>{const{direction:Y}=j.current,{layout:J}=k.current;if(!g.current)return;const I=cs(L,g.current);Te(I,`Drag handle element not found for id "${L}"`);const X=Zu(Y,U);h({dragHandleId:L,dragHandleRect:I.getBoundingClientRect(),initialCursorPosition:X,initialLayout:J})},[]),T=d.useCallback(()=>{h(null)},[]),M=d.useCallback(L=>{const{panelDataArray:U}=k.current,Y=rr(U,L);Y>=0&&(U.splice(Y,1),delete y.current[L.id],k.current.panelDataArrayChanged=!0,b())},[b]),F=d.useMemo(()=>({collapsePanel:A,direction:r,dragState:x,expandPanel:G,getPanelSize:Q,getPanelStyle:O,groupId:m,isPanelCollapsed:P,isPanelExpanded:K,reevaluatePanelConstraints:q,registerPanel:W,registerResizeHandle:z,resizePanel:_,startDragging:E,stopDragging:T,unregisterPanel:M,panelGroupElement:g.current}),[A,x,r,G,Q,O,m,P,K,q,W,z,_,E,T,M]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return d.createElement(ss.Provider,{value:F},d.createElement(f,{...p,children:t,className:n,id:s,ref:g,style:{...ee,...u},[Ve.group]:"",[Ve.groupDirection]:r,[Ve.groupId]:m}))}const nd=d.forwardRef((e,t)=>d.createElement(td,{...e,forwardedRef:t}));td.displayName="PanelGroup";nd.displayName="forwardRef(PanelGroup)";function rr(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function Fn(e,t,n){const r=rr(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function Cv({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){d.useEffect(()=>{if(e||n==null||r==null)return;const o=cs(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(Ve.groupId);Te(l,`No group element found for id "${l}"`);const c=Hr(l,r),u=Ku(l,t,r);Te(u!==null,`No resize element found for id "${t}"`);const f=i.shiftKey?u>0?u-1:c.length-1:u+1<c.length?u+1:0;c[f].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[r,e,t,n])}function rd({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onClick:i,onDragging:l,onFocus:c,onPointerDown:u,onPointerUp:f,style:p={},tabIndex:m=0,tagName:g="div",...x}){var h,v;const w=d.useRef(null),b=d.useRef({onClick:i,onDragging:l,onPointerDown:u,onPointerUp:f});d.useEffect(()=>{b.current.onClick=i,b.current.onDragging=l,b.current.onPointerDown=u,b.current.onPointerUp=f});const y=d.useContext(ss);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:S,groupId:N,registerResizeHandle:j,startDragging:k,stopDragging:A,panelGroupElement:G}=y,Q=ta(o),[O,P]=d.useState("inactive"),[K,W]=d.useState(!1),[z,_]=d.useState(null),q=d.useRef({state:O});$n(()=>{q.current.state=O}),d.useEffect(()=>{if(n)_(null);else{const F=j(Q);_(()=>F)}},[n,Q,j]);const E=(h=r==null?void 0:r.coarse)!==null&&h!==void 0?h:15,T=(v=r==null?void 0:r.fine)!==null&&v!==void 0?v:5;d.useEffect(()=>{if(n||z==null)return;const F=w.current;Te(F,"Element ref not attached");let ee=!1;return iv(Q,F,S,{coarse:E,fine:T},(U,Y,J)=>{if(!Y){P("inactive");return}switch(U){case"down":{P("drag"),ee=!1,Te(J,'Expected event to be defined for "down" action'),k(Q,J);const{onDragging:I,onPointerDown:X}=b.current;I==null||I(!0),X==null||X();break}case"move":{const{state:I}=q.current;ee=!0,I!=="drag"&&P("hover"),Te(J,'Expected event to be defined for "move" action'),z(J);break}case"up":{P("hover"),A();const{onClick:I,onDragging:X,onPointerUp:re}=b.current;X==null||X(!1),re==null||re(),ee||I==null||I();break}}})},[E,S,n,T,j,Q,z,k,A]),Cv({disabled:n,handleId:Q,resizeHandler:z,panelGroupElement:G});const M={touchAction:"none",userSelect:"none"};return d.createElement(g,{...x,children:e,className:t,id:o,onBlur:()=>{W(!1),s==null||s()},onFocus:()=>{W(!0),c==null||c()},ref:w,role:"separator",style:{...M,...p},tabIndex:m,[Ve.groupDirection]:S,[Ve.groupId]:N,[Ve.resizeHandle]:"",[Ve.resizeHandleActive]:O==="drag"?"pointer":K?"keyboard":void 0,[Ve.resizeHandleEnabled]:!n,[Ve.resizeHandleId]:Q,[Ve.resizeHandleState]:O})}rd.displayName="PanelResizeHandle";function Sv({className:e,...t}){return a.jsx(nd,{"data-slot":"resizable-panel-group",className:be("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ml({...e}){return a.jsx(Fu,{"data-slot":"resizable-panel",...e})}function Ev({withHandle:e,className:t,...n}){return a.jsx(rd,{"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(Yp,{className:"size-2.5"})})})}const Tv=d.forwardRef(({className:e,...t},n)=>a.jsx("ul",{ref:n,className:be("flex flex-row items-center gap-1",e),...t}));Tv.displayName="PaginationContent";const kv=d.forwardRef(({className:e,...t},n)=>a.jsx("li",{ref:n,className:be("",e),...t}));kv.displayName="PaginationItem";function Av({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){d.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 Nv({onEscape:e,enabled:t=!0}){d.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const _v={x:0,y:0},Ot=16,Iv=["top-start","bottom-end","top-end"];function jv({anchorRef:e,placement:t="top-start",offset:n=_v,fallbackPlacements:r=Iv}){const o=d.useCallback((c,u,f)=>{let p=0,m=0;switch(f){case"top":p=c.top-u.height-n.y,m=c.left+(c.width-u.width)/2+n.x;break;case"top-start":p=c.top-u.height-n.y,m=c.left+n.x;break;case"top-end":p=c.top-u.height-n.y,m=c.right-u.width-n.x;break;case"bottom":p=c.bottom+n.y,m=c.left+(c.width-u.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-u.width-n.x;break;case"left":p=c.top+(c.height-u.height)/2+n.y,m=c.left-u.width-n.x;break;case"left-start":p=c.top+n.y,m=c.left-u.width-n.x;break;case"left-end":p=c.bottom-u.height-n.y,m=c.left-u.width-n.x;break;case"right":p=c.top+(c.height-u.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-u.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=d.useCallback((c,u)=>{const f={width:window.innerWidth,height:window.innerHeight};return c.left<Ot||c.top<Ot||c.left+u.width>f.width-Ot||c.top+u.height>f.height-Ot},[]),i=d.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 u=e.current.getBoundingClientRect(),f=c.getBoundingClientRect(),p=o(u,f,t);if(!s(p,f))return p;for(const x of r){const h=o(u,f,x);if(!s(h,f))return h}const m={width:window.innerWidth,height:window.innerHeight},g={...p};return g.left<Ot?g.left=Ot:g.left+f.width>m.width-Ot&&(g.left=m.width-f.width-Ot),g.top<Ot?g.top=Ot:g.top+f.height>m.height-Ot&&(g.top=m.height-f.height-Ot),g},[e,t,r,o,s]);return{getPositionStyle:d.useCallback(c=>{const u=i(c);return{position:"fixed",top:u.top,left:u.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function Mv({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[s,i]=d.useState(e),[l,c]=d.useState(!1),u=d.useRef(0),f=d.useRef(e),p=d.useCallback(w=>{w.preventDefault(),c(!0),u.current=w.clientX,f.current=s},[s]),m=d.useCallback(w=>{if(!l)return;const b=w.clientX-u.current,y=r==="right"?-b:b,S=Math.min(Math.max(f.current+y,t),n);i(S),o==null||o(S)},[l,t,n,r,o]),g=d.useCallback(()=>{c(!1)},[]),x=d.useCallback(w=>{w.preventDefault(),c(!0),u.current=w.touches[0].clientX,f.current=s},[s]),h=d.useCallback(w=>{if(!l)return;const b=w.touches[0].clientX-u.current,y=r==="right"?-b:b,S=Math.min(Math.max(f.current+y,t),n);i(S),o==null||o(S)},[l,t,n,r,o]),v=d.useCallback(()=>{c(!1)},[]);return d.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 Rv=d.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:s=!0,className:i,onWidthChange:l,...c},u)=>{const{width:f,isResizing:p,handleMouseDown:m,handleTouchStart:g}=Mv({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:u,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:w=>{if(w.key==="ArrowLeft"||w.key==="ArrowRight"){w.preventDefault();const b=w.key==="ArrowRight"?10:-10,y=o==="right"?-b:b,S=Math.min(Math.max(f+y,n),r);l==null||l(S)}},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)]")})})]})});Rv.displayName="SidePanel";const od=d.createContext(null),sd=d.createContext(void 0),id=d.createContext(null),ad=d.createContext(null),ld=d.createContext(void 0),cd=d.createContext(null);function Zt(){const e=d.useContext(id);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const Lv="https://solace.com/a2a/extensions/display-name",Pv="https://solace.com/a2a/extensions/peer-agent-topology",Dv="https://solace.com/a2a/extensions/sam/tools",Ov=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===Lv);(s=c==null?void 0:c.params)!=null&&s.display_name&&(t=c.params.display_name);const u=e.capabilities.extensions.find(p=>p.uri===Pv);(i=u==null?void 0:u.params)!=null&&i.peer_agent_names&&(n=u.params.peer_agent_names);const f=e.capabilities.extensions.find(p=>p.uri===Dv);(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||[]}},ud=()=>{const{configServerUrl:e}=Zt(),[t,n]=d.useState([]),[r,o]=d.useState({}),[s,i]=d.useState(!0),[l,c]=d.useState(null),u=d.useCallback(async()=>{i(!0),c(null);try{const f=`${e}/api/v1`,p=await Fe(`${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(Ov);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 d.useEffect(()=>{u()},[u]),d.useMemo(()=>({agents:t,agentNameMap:r,isLoading:s,error:l,refetch:u}),[t,r,s,l,u])},Fv=e=>{const{configServerUrl:t}=Zt(),[n,r]=d.useState([]),[o,s]=d.useState(!0),[i,l]=d.useState(null),c=`${t}/api/v1`,u=d.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0),l(null);try{const f=await Fe(`${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 d.useEffect(()=>{u()},[u]),{artifacts:n,isLoading:o,error:i,refetch:u}},$v=()=>{const e=d.useContext(od);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},He=()=>{const e=d.useContext(sd);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function zv(){const{messages:e}=He(),t=Zt(),n=d.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]);d.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function dd(){const e=d.useContext(ad);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}const Bv=async(e,t,n)=>{const r=await Fe(`${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();Ac(o,n.filename)},fd=()=>{const{configServerUrl:e}=Zt(),{addNotification:t,sessionId:n}=He();return{onDownload:async o=>{if(!n){t("Cannot download artifact: No active session.","error");return}try{await Bv(e,n,o),t(`Downloaded artifact: ${o.filename}.`)}catch{t(`Failed to download artifact: ${o.filename}.`,"error")}}}},Hv=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=d.useState(!1),s=d.useRef(0),i=d.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)+1,f.dataTransfer.types.includes("Files")&&o(!0))},[n,s]),l=d.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.types.includes("Files")&&(f.dataTransfer.dropEffect="copy"))},[n]),c=d.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)-1,s.current===0&&o(!1))},[n,s]),u=d.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:u}},ra=()=>{const e=d.useContext(ld);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function us(){const e=d.useContext(cd);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}const Uv=()=>{const{agents:e,sessionId:t,setMessages:n,setSelectedAgentName:r}=He();return{handleAgentSelection:d.useCallback(s=>{if(s){const i=e.find(l=>l.name===s);if(i){r(s);const l=`Hi! I'm the ${i.displayName}. How can I help?`;n(c=>[...c,{parts:[{kind:"text",text:l}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:t||"",lastProcessedEventSequence:0}}])}else console.warn(`Selected agent not found: ${s}`)}},[e,t,n,r])}};d.createContext(null);function pd(e){const t=e+"CollectionProvider",[n,r]=Rn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:v,children:w}=h,b=ct.useRef(null),y=ct.useRef(new Map).current;return a.jsx(o,{scope:v,itemMap:y,collectionRef:b,children:w})};i.displayName=t;const l=e+"CollectionSlot",c=Bn(l),u=ct.forwardRef((h,v)=>{const{scope:w,children:b}=h,y=s(l,w),S=ze(v,y.collectionRef);return a.jsx(c,{ref:S,children:b})});u.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Bn(f),g=ct.forwardRef((h,v)=>{const{scope:w,children:b,...y}=h,S=ct.useRef(null),N=ze(v,S),j=s(f,w);return ct.useEffect(()=>(j.itemMap.set(S,{ref:S,...y}),()=>void j.itemMap.delete(S))),a.jsx(m,{[p]:"",ref:N,children:b})});g.displayName=f;function x(h){const v=s(e+"CollectionConsumer",h);return ct.useCallback(()=>{const b=v.collectionRef.current;if(!b)return[];const y=Array.from(b.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((j,k)=>y.indexOf(j.ref.current)-y.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:g},x,r]}var Wv=d.createContext(void 0);function oa(e){const t=d.useContext(Wv);return e||t||"ltr"}const sa=d.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},s=(i,l)=>{var u,f,p,m,g;const c=(u=i.currentTarget.parentElement)==null?void 0:u.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(d.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,"data-disabled":i.disabled,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))})});sa.displayName="Menu";var ds="Popover",[md]=Rn(ds,[Er]),oo=Er(),[Vv,Ln]=md(ds),hd=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,l=oo(t),c=d.useRef(null),[u,f]=d.useState(!1),[p,m]=Un({prop:r,defaultProp:o??!1,onChange:s,caller:ds});return a.jsx($i,{...l,children:a.jsx(Vv,{scope:t,contentId:on(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:d.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:u,onCustomAnchorAdd:d.useCallback(()=>f(!0),[]),onCustomAnchorRemove:d.useCallback(()=>f(!1),[]),modal:i,children:n})})};hd.displayName=ds;var gd="PopoverAnchor",Gv=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ln(gd,n),s=oo(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return d.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(Jo,{...s,...r,ref:t})});Gv.displayName=gd;var xd="PopoverTrigger",vd=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ln(xd,n),s=oo(n),i=ze(t,o.triggerRef),l=a.jsx(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Sd(o.open),...r,ref:i,onClick:ge(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:a.jsx(Jo,{asChild:!0,...s,children:l})});vd.displayName=xd;var ia="PopoverPortal",[Yv,Kv]=md(ia,{forceMount:void 0}),wd=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Ln(ia,t);return a.jsx(Yv,{scope:t,forceMount:n,children:a.jsx(Cn,{present:n||s.open,children:a.jsx(Zr,{asChild:!0,container:o,children:r})})})};wd.displayName=ia;var hr="PopoverContent",bd=d.forwardRef((e,t)=>{const n=Kv(hr,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Ln(hr,e.__scopePopover);return a.jsx(Cn,{present:r||s.open,children:s.modal?a.jsx(Xv,{...o,ref:t}):a.jsx(Zv,{...o,ref:t})})});bd.displayName=hr;var qv=Bn("PopoverContent.RemoveScroll"),Xv=d.forwardRef((e,t)=>{const n=Ln(hr,e.__scopePopover),r=d.useRef(null),o=ze(t,r),s=d.useRef(!1);return d.useEffect(()=>{const i=r.current;if(i)return qi(i)},[]),a.jsx(rs,{as:qv,allowPinchZoom:!0,children:a.jsx(yd,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ge(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ge(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:ge(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Zv=d.forwardRef((e,t)=>{const n=Ln(hr,e.__scopePopover),r=d.useRef(!1),o=d.useRef(!1);return a.jsx(yd,{...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,u;(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;((u=n.triggerRef.current)==null?void 0:u.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),yd=d.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:f,...p}=e,m=Ln(hr,n),g=oo(n);return Ki(),a.jsx(ts,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(qr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(zi,{"data-state":Sd(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)"}})})})}),Cd="PopoverClose",Jv=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Ln(Cd,n);return a.jsx(je.button,{type:"button",...r,ref:t,onClick:ge(e.onClick,()=>o.onOpenChange(!1))})});Jv.displayName=Cd;var Qv="PopoverArrow",ew=d.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=oo(n);return a.jsx(Bi,{...o,...r,ref:t})});ew.displayName=Qv;function Sd(e){return e?"open":"closed"}var tw=hd,nw=vd,rw=wd,ow=bd;function Ed({...e}){return a.jsx(tw,{"data-slot":"popover",...e})}function Td({...e}){return a.jsx(nw,{"data-slot":"popover-trigger",...e})}function kd({className:e,align:t="center",sideOffset:n=4,...r}){return a.jsx(rw,{children:a.jsx(ow,{"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 sw({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:s,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:u=!0,animationDuration:f=150,fallbackPlacements:p}){const m=d.useRef(null),[g,x]=d.useState({}),[h,v]=d.useState(!1);Av({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),Nv({onEscape:t,enabled:e&&c});const{getPositionStyle:w}=jv({anchorRef:n,placement:o,offset:s,fallbackPlacements:p});if(d.useEffect(()=>{e&&m.current?(v(!1),requestAnimationFrame(()=>{if(m.current){const y=w(m.current);x(y),v(!0)}})):v(!1)},[e,w]),!e)return null;const b=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 u?Kr.createPortal(b,document.body):b}function hl(e,[t,n]){return Math.min(n,Math.max(t,e))}function iw(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var aw=[" ","Enter","ArrowUp","ArrowDown"],lw=[" ","Enter"],Gn="Select",[fs,ps,cw]=pd(Gn),[Tr]=Rn(Gn,[cw,Er]),ms=Er(),[uw,Pn]=Tr(Gn),[dw,fw]=Tr(Gn),Ad=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:f,autoComplete:p,disabled:m,required:g,form:x}=e,h=ms(t),[v,w]=d.useState(null),[b,y]=d.useState(null),[S,N]=d.useState(!1),j=oa(u),[k,A]=Un({prop:r,defaultProp:o??!1,onChange:s,caller:Gn}),[G,Q]=Un({prop:i,defaultProp:l,onChange:c,caller:Gn}),O=d.useRef(null),P=v?x||!!v.closest("form"):!0,[K,W]=d.useState(new Set),z=Array.from(K).map(_=>_.props.value).join(";");return a.jsx($i,{...h,children:a.jsxs(uw,{required:g,scope:t,trigger:v,onTriggerChange:w,valueNode:b,onValueNodeChange:y,valueNodeHasChildren:S,onValueNodeHasChildrenChange:N,contentId:on(),value:G,onValueChange:Q,open:k,onOpenChange:A,dir:j,triggerPointerDownPosRef:O,disabled:m,children:[a.jsx(fs.Provider,{scope:t,children:a.jsx(dw,{scope:e.__scopeSelect,onNativeOptionAdd:d.useCallback(_=>{W(q=>new Set(q).add(_))},[]),onNativeOptionRemove:d.useCallback(_=>{W(q=>{const E=new Set(q);return E.delete(_),E})},[]),children:n})}),P?a.jsxs(qd,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:p,value:G,onChange:_=>Q(_.target.value),disabled:m,form:x,children:[G===void 0?a.jsx("option",{value:""}):null,Array.from(K)]},z):null]})})};Ad.displayName=Gn;var Nd="SelectTrigger",_d=d.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=ms(n),i=Pn(Nd,n),l=i.disabled||r,c=ze(t,i.onTriggerChange),u=ps(n),f=d.useRef("touch"),[p,m,g]=Zd(h=>{const v=u().filter(y=>!y.disabled),w=v.find(y=>y.value===i.value),b=Jd(v,h,w);b!==void 0&&i.onValueChange(b.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(Jo,{asChild:!0,...s,children:a.jsx(je.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":Xd(i.value)?"":void 0,...o,ref:c,onClick:ge(o.onClick,h=>{h.currentTarget.focus(),f.current!=="mouse"&&x(h)}),onPointerDown:ge(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:ge(o.onKeyDown,h=>{const v=p.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&m(h.key),!(v&&h.key===" ")&&aw.includes(h.key)&&(x(),h.preventDefault())})})})});_d.displayName=Nd;var Id="SelectValue",jd=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Pn(Id,n),{onValueNodeHasChildrenChange:u}=c,f=s!==void 0,p=ze(t,c.onValueNodeChange);return ut(()=>{u(f)},[u,f]),a.jsx(je.span,{...l,ref:p,style:{pointerEvents:"none"},children:Xd(c.value)?a.jsx(a.Fragment,{children:i}):s})});jd.displayName=Id;var pw="SelectIcon",Md=d.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(je.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Md.displayName=pw;var mw="SelectPortal",Rd=e=>a.jsx(Zr,{asChild:!0,...e});Rd.displayName=mw;var Yn="SelectContent",Ld=d.forwardRef((e,t)=>{const n=Pn(Yn,e.__scopeSelect),[r,o]=d.useState();if(ut(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Kr.createPortal(a.jsx(Pd,{scope:e.__scopeSelect,children:a.jsx(fs.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Dd,{...e,ref:t})});Ld.displayName=Yn;var Vt=10,[Pd,Dn]=Tr(Yn),hw="SelectContentImpl",gw=Bn("SelectContent.RemoveScroll"),Dd=d.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:h,avoidCollisions:v,...w}=e,b=Pn(Yn,n),[y,S]=d.useState(null),[N,j]=d.useState(null),k=ze(t,I=>S(I)),[A,G]=d.useState(null),[Q,O]=d.useState(null),P=ps(n),[K,W]=d.useState(!1),z=d.useRef(!1);d.useEffect(()=>{if(y)return qi(y)},[y]),Ki();const _=d.useCallback(I=>{const[X,...re]=P().map(ae=>ae.ref.current),[ne]=re.slice(-1),ue=document.activeElement;for(const ae of I)if(ae===ue||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===X&&N&&(N.scrollTop=0),ae===ne&&N&&(N.scrollTop=N.scrollHeight),ae==null||ae.focus(),document.activeElement!==ue))return},[P,N]),q=d.useCallback(()=>_([A,y]),[_,A,y]);d.useEffect(()=>{K&&q()},[K,q]);const{onOpenChange:E,triggerPointerDownPosRef:T}=b;d.useEffect(()=>{if(y){let I={x:0,y:0};const X=ne=>{var ue,ae;I={x:Math.abs(Math.round(ne.pageX)-(((ue=T.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ne.pageY)-(((ae=T.current)==null?void 0:ae.y)??0))}},re=ne=>{I.x<=10&&I.y<=10?ne.preventDefault():y.contains(ne.target)||E(!1),document.removeEventListener("pointermove",X),T.current=null};return T.current!==null&&(document.addEventListener("pointermove",X),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",X),document.removeEventListener("pointerup",re,{capture:!0})}}},[y,E,T]),d.useEffect(()=>{const I=()=>E(!1);return window.addEventListener("blur",I),window.addEventListener("resize",I),()=>{window.removeEventListener("blur",I),window.removeEventListener("resize",I)}},[E]);const[M,F]=Zd(I=>{const X=P().filter(ue=>!ue.disabled),re=X.find(ue=>ue.ref.current===document.activeElement),ne=Jd(X,I,re);ne&&setTimeout(()=>ne.ref.current.focus())}),ee=d.useCallback((I,X,re)=>{const ne=!z.current&&!re;(b.value!==void 0&&b.value===X||ne)&&(G(I),ne&&(z.current=!0))},[b.value]),L=d.useCallback(()=>y==null?void 0:y.focus(),[y]),U=d.useCallback((I,X,re)=>{const ne=!z.current&&!re;(b.value!==void 0&&b.value===X||ne)&&O(I)},[b.value]),Y=r==="popper"?oi:Od,J=Y===oi?{side:l,sideOffset:c,align:u,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:x,hideWhenDetached:h,avoidCollisions:v}:{};return a.jsx(Pd,{scope:n,content:y,viewport:N,onViewportChange:j,itemRefCallback:ee,selectedItem:A,onItemLeave:L,itemTextRefCallback:U,focusSelectedItem:q,selectedItemText:Q,position:r,isPositioned:K,searchRef:M,children:a.jsx(rs,{as:gw,allowPinchZoom:!0,children:a.jsx(ts,{asChild:!0,trapped:b.open,onMountAutoFocus:I=>{I.preventDefault()},onUnmountAutoFocus:ge(o,I=>{var X;(X=b.trigger)==null||X.focus({preventScroll:!0}),I.preventDefault()}),children:a.jsx(qr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:I=>I.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:a.jsx(Y,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:I=>I.preventDefault(),...w,...J,onPlaced:()=>W(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:ge(w.onKeyDown,I=>{const X=I.ctrlKey||I.altKey||I.metaKey;if(I.key==="Tab"&&I.preventDefault(),!X&&I.key.length===1&&F(I.key),["ArrowUp","ArrowDown","Home","End"].includes(I.key)){let ne=P().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(I.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(I.key)){const ue=I.target,ae=ne.indexOf(ue);ne=ne.slice(ae+1)}setTimeout(()=>_(ne)),I.preventDefault()}})})})})})})});Dd.displayName=hw;var xw="SelectItemAlignedPosition",Od=d.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Pn(Yn,n),i=Dn(Yn,n),[l,c]=d.useState(null),[u,f]=d.useState(null),p=ze(t,k=>f(k)),m=ps(n),g=d.useRef(!1),x=d.useRef(!0),{viewport:h,selectedItem:v,selectedItemText:w,focusSelectedItem:b}=i,y=d.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&h&&v&&w){const k=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),G=s.valueNode.getBoundingClientRect(),Q=w.getBoundingClientRect();if(s.dir!=="rtl"){const ue=Q.left-A.left,ae=G.left-ue,fe=k.left-ae,ye=k.width+fe,Le=Math.max(ye,A.width),Pe=window.innerWidth-Vt,$e=hl(ae,[Vt,Math.max(Vt,Pe-Le)]);l.style.minWidth=ye+"px",l.style.left=$e+"px"}else{const ue=A.right-Q.right,ae=window.innerWidth-G.right-ue,fe=window.innerWidth-k.right-ae,ye=k.width+fe,Le=Math.max(ye,A.width),Pe=window.innerWidth-Vt,$e=hl(ae,[Vt,Math.max(Vt,Pe-Le)]);l.style.minWidth=ye+"px",l.style.right=$e+"px"}const O=m(),P=window.innerHeight-Vt*2,K=h.scrollHeight,W=window.getComputedStyle(u),z=parseInt(W.borderTopWidth,10),_=parseInt(W.paddingTop,10),q=parseInt(W.borderBottomWidth,10),E=parseInt(W.paddingBottom,10),T=z+_+K+E+q,M=Math.min(v.offsetHeight*5,T),F=window.getComputedStyle(h),ee=parseInt(F.paddingTop,10),L=parseInt(F.paddingBottom,10),U=k.top+k.height/2-Vt,Y=P-U,J=v.offsetHeight/2,I=v.offsetTop+J,X=z+_+I,re=T-X;if(X<=U){const ue=O.length>0&&v===O[O.length-1].ref.current;l.style.bottom="0px";const ae=u.clientHeight-h.offsetTop-h.offsetHeight,fe=Math.max(Y,J+(ue?L:0)+ae+q),ye=X+fe;l.style.height=ye+"px"}else{const ue=O.length>0&&v===O[0].ref.current;l.style.top="0px";const fe=Math.max(U,z+h.offsetTop+(ue?ee:0)+J)+re;l.style.height=fe+"px",h.scrollTop=X-U+h.offsetTop}l.style.margin=`${Vt}px 0`,l.style.minHeight=M+"px",l.style.maxHeight=P+"px",r==null||r(),requestAnimationFrame(()=>g.current=!0)}},[m,s.trigger,s.valueNode,l,u,h,v,w,s.dir,r]);ut(()=>y(),[y]);const[S,N]=d.useState();ut(()=>{u&&N(window.getComputedStyle(u).zIndex)},[u]);const j=d.useCallback(k=>{k&&x.current===!0&&(y(),b==null||b(),x.current=!1)},[y,b]);return a.jsx(ww,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:g,onScrollButtonChange:j,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(je.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Od.displayName=xw;var vw="SelectPopperPosition",oi=d.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Vt,...s}=e,i=ms(n);return a.jsx(zi,{...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)"}})});oi.displayName=vw;var[ww,aa]=Tr(Yn,{}),si="SelectViewport",Fd=d.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Dn(si,n),i=aa(si,n),l=ze(t,s.onViewportChange),c=d.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(fs.Slot,{scope:n,children:a.jsx(je.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ge(o.onScroll,u=>{const f=u.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-Vt*2,h=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),w=Math.max(h,v);if(w<x){const b=w+g,y=Math.min(x,b),S=b-y;p.style.height=y+"px",p.style.bottom==="0px"&&(f.scrollTop=S>0?S:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Fd.displayName=si;var $d="SelectGroup",[bw,yw]=Tr($d),Cw=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=on();return a.jsx(bw,{scope:n,id:o,children:a.jsx(je.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Cw.displayName=$d;var zd="SelectLabel",Sw=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=yw(zd,n);return a.jsx(je.div,{id:o.id,...r,ref:t})});Sw.displayName=zd;var $o="SelectItem",[Ew,Bd]=Tr($o),Hd=d.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Pn($o,n),c=Dn($o,n),u=l.value===r,[f,p]=d.useState(s??""),[m,g]=d.useState(!1),x=ze(t,b=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,b,r,o)}),h=on(),v=d.useRef("touch"),w=()=>{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(Ew,{scope:n,value:r,disabled:o,textId:h,isSelected:u,onItemTextChange:d.useCallback(b=>{p(y=>y||((b==null?void 0:b.textContent)??"").trim())},[]),children:a.jsx(fs.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:a.jsx(je.div,{role:"option","aria-labelledby":h,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:ge(i.onFocus,()=>g(!0)),onBlur:ge(i.onBlur,()=>g(!1)),onClick:ge(i.onClick,()=>{v.current!=="mouse"&&w()}),onPointerUp:ge(i.onPointerUp,()=>{v.current==="mouse"&&w()}),onPointerDown:ge(i.onPointerDown,b=>{v.current=b.pointerType}),onPointerMove:ge(i.onPointerMove,b=>{var y;v.current=b.pointerType,o?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ge(i.onPointerLeave,b=>{var y;b.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:ge(i.onKeyDown,b=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&b.key===" "||(lw.includes(b.key)&&w(),b.key===" "&&b.preventDefault())})})})})});Hd.displayName=$o;var Dr="SelectItemText",Ud=d.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Pn(Dr,n),l=Dn(Dr,n),c=Bd(Dr,n),u=fw(Dr,n),[f,p]=d.useState(null),m=ze(t,w=>p(w),c.onItemTextChange,w=>{var b;return(b=l.itemTextRefCallback)==null?void 0:b.call(l,w,c.value,c.disabled)}),g=f==null?void 0:f.textContent,x=d.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:h,onNativeOptionRemove:v}=u;return ut(()=>(h(x),()=>v(x)),[h,v,x]),a.jsxs(a.Fragment,{children:[a.jsx(je.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Kr.createPortal(s.children,i.valueNode):null]})});Ud.displayName=Dr;var Wd="SelectItemIndicator",Vd=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Bd(Wd,n).isSelected?a.jsx(je.span,{"aria-hidden":!0,...r,ref:t}):null});Vd.displayName=Wd;var ii="SelectScrollUpButton",Gd=d.forwardRef((e,t)=>{const n=Dn(ii,e.__scopeSelect),r=aa(ii,e.__scopeSelect),[o,s]=d.useState(!1),i=ze(t,r.onScrollButtonChange);return ut(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Kd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Gd.displayName=ii;var ai="SelectScrollDownButton",Yd=d.forwardRef((e,t)=>{const n=Dn(ai,e.__scopeSelect),r=aa(ai,e.__scopeSelect),[o,s]=d.useState(!1),i=ze(t,r.onScrollButtonChange);return ut(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<u;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Kd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Yd.displayName=ai;var Kd=d.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Dn("SelectScrollButton",n),i=d.useRef(null),l=ps(n),c=d.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return d.useEffect(()=>()=>c(),[c]),ut(()=>{var f;const u=l().find(p=>p.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(je.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ge(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ge(o.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ge(o.onPointerLeave,()=>{c()})})}),Tw="SelectSeparator",kw=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(je.div,{"aria-hidden":!0,...r,ref:t})});kw.displayName=Tw;var li="SelectArrow",Aw=d.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ms(n),s=Pn(li,n),i=Dn(li,n);return s.open&&i.position==="popper"?a.jsx(Bi,{...o,...r,ref:t}):null});Aw.displayName=li;var Nw="SelectBubbleInput",qd=d.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=d.useRef(null),s=ze(r,o),i=iw(t);return d.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(je.select,{...n,style:{...Jc,...n.style},ref:s,defaultValue:t})});qd.displayName=Nw;function Xd(e){return e===""||e===void 0}function Zd(e){const t=Nn(e),n=d.useRef(""),r=d.useRef(0),o=d.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=d.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Jd(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=_w(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function _w(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Iw=Ad,jw=_d,Mw=jd,Rw=Md,Lw=Rd,Pw=Ld,Dw=Fd,Ow=Hd,Fw=Ud,$w=Vd,zw=Gd,Bw=Yd;function Qd({...e}){return a.jsx(Iw,{"data-slot":"select",...e})}function ef({...e}){return a.jsx(Mw,{"data-slot":"select-value",...e})}function tf({className:e,size:t="default",children:n,...r}){return a.jsxs(jw,{"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(Rw,{asChild:!0,children:a.jsx(tc,{className:"size-4 opacity-50"})})]})}function nf({className:e,children:t,position:n="popper",...r}){return a.jsx(Lw,{children:a.jsxs(Pw,{"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(Hw,{}),a.jsx(Dw,{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(Uw,{})]})})}function rf({className:e,children:t,...n}){return a.jsxs(Ow,{"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($w,{children:a.jsx(Ti,{className:"size-4"})})}),a.jsx(Fw,{children:t})]})}function Hw({className:e,...t}){return a.jsx(zw,{"data-slot":"select-scroll-up-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Kp,{className:"size-4"})})}function Uw({className:e,...t}){return a.jsx(Bw,{"data-slot":"select-scroll-down-button",className:be("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(tc,{className:"size-4"})})}var Ds="rovingFocusGroup.onEntryFocus",Ww={bubbles:!1,cancelable:!0},so="RovingFocusGroup",[ci,of,Vw]=pd(so),[Gw,sf]=Rn(so,[Vw]),[Yw,Kw]=Gw(so),af=d.forwardRef((e,t)=>a.jsx(ci.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(ci.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(qw,{...e,ref:t})})}));af.displayName=so;var qw=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=d.useRef(null),g=ze(t,m),x=oa(s),[h,v]=Un({prop:i,defaultProp:l??null,onChange:c,caller:so}),[w,b]=d.useState(!1),y=Nn(u),S=of(n),N=d.useRef(!1),[j,k]=d.useState(0);return d.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(Ds,y),()=>A.removeEventListener(Ds,y)},[y]),a.jsx(Yw,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:h,onItemFocus:d.useCallback(A=>v(A),[v]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:d.useCallback(()=>k(A=>A-1),[]),children:a.jsx(je.div,{tabIndex:w||j===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:ge(e.onMouseDown,()=>{N.current=!0}),onFocus:ge(e.onFocus,A=>{const G=!N.current;if(A.target===A.currentTarget&&G&&!w){const Q=new CustomEvent(Ds,Ww);if(A.currentTarget.dispatchEvent(Q),!Q.defaultPrevented){const O=S().filter(_=>_.focusable),P=O.find(_=>_.active),K=O.find(_=>_.id===h),z=[P,K,...O].filter(Boolean).map(_=>_.ref.current);uf(z,f)}}N.current=!1}),onBlur:ge(e.onBlur,()=>b(!1))})})}),lf="RovingFocusGroupItem",cf=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=on(),u=s||c,f=Kw(lf,n),p=f.currentTabStopId===u,m=of(n),{onFocusableItemAdd:g,onFocusableItemRemove:x,currentTabStopId:h}=f;return d.useEffect(()=>{if(r)return g(),()=>x()},[r,g,x]),a.jsx(ci.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(je.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ge(e.onMouseDown,v=>{r?f.onItemFocus(u):v.preventDefault()}),onFocus:ge(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:ge(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const w=Jw(v,f.orientation,f.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=m().filter(S=>S.focusable).map(S=>S.ref.current);if(w==="last")y.reverse();else if(w==="prev"||w==="next"){w==="prev"&&y.reverse();const S=y.indexOf(v.currentTarget);y=f.loop?Qw(y,S+1):y.slice(S+1)}setTimeout(()=>uf(y))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:h!=null}):i})})});cf.displayName=lf;var Xw={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Zw(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Jw(e,t,n){const r=Zw(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Xw[r]}function uf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Qw(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var e1=af,t1=cf,hs="Tabs",[n1]=Rn(hs,[sf]),df=sf(),[r1,la]=n1(hs),ff=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,f=oa(l),[p,m]=Un({prop:r,onChange:o,defaultProp:s??"",caller:hs});return a.jsx(r1,{scope:n,baseId:on(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(je.div,{dir:f,"data-orientation":i,...u,ref:t})})});ff.displayName=hs;var pf="TabsList",mf=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=la(pf,n),i=df(n);return a.jsx(e1,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(je.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});mf.displayName=pf;var hf="TabsTrigger",gf=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=la(hf,n),l=df(n),c=wf(i.baseId,r),u=bf(i.baseId,r),f=r===i.value;return a.jsx(t1,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(je.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ge(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ge(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ge(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});gf.displayName=hf;var xf="TabsContent",vf=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=la(xf,n),c=wf(l.baseId,r),u=bf(l.baseId,r),f=r===l.value,p=d.useRef(f);return d.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Cn,{present:o||f,children:({present:m})=>a.jsx(je.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});vf.displayName=xf;function wf(e,t){return`${e}-trigger-${t}`}function bf(e,t){return`${e}-content-${t}`}var o1=ff,s1=mf,i1=gf,a1=vf;function l1({className:e,...t}){return a.jsx(o1,{"data-slot":"tabs",className:be("flex flex-col gap-2",e),...t})}function c1({className:e,...t}){return a.jsx(s1,{"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 gl({className:e,...t}){return a.jsx(i1,{"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 xl({className:e,...t}){return a.jsx(a1,{"data-slot":"tabs-content",className:be("flex-1 outline-none",e),...t})}const yf=d.forwardRef(({className:e,...t},n)=>a.jsx(Yi,{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}));yf.displayName="ChatInput";const u1=Mn("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"}}),Cf=d.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:be(u1({variant:t,layout:n,className:e}),"group relative"),ref:s,...o,children:d.Children.map(r,i=>d.isValidElement(i)&&typeof i.type!="string"?d.cloneElement(i,{variant:t,layout:n}):i)}));Cf.displayName="ChatBubble";const d1=Mn("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"}}),Sf=d.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:be(d1({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})}));Sf.displayName="ChatBubbleMessage";const f1=d.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}));f1.displayName="ChatBubbleActionWrapper";const Ef={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},Tf=ct.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:s,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=C1({smooth:!0,content:t});return d.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:Ef,children:t})}),!s&&c&&a.jsx(me,{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(nc,{className:"h-4 w-4"})})]})});Tf.displayName="ChatMessageList";const p1=Mn("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),m1=Mn("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 ca({size:e,show:t,children:n,className:r,variant:o}){return a.jsxs("span",{className:p1({show:t}),children:[a.jsx(ki,{className:be(m1({size:e,variant:o}),r)}),n]})}function h1({className:e=""}){return a.jsx(ca,{size:"small",variant:"primary",className:e})}const vo={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)]"},g1=Mn("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:vo.error,warning:vo.warning,info:vo.info,success:vo.success}},defaultVariants:{variant:"default"}});function kf({className:e,variant:t,type:n,asChild:r=!1,...o}){const s=r?hc:"span";return a.jsx(s,{"data-slot":"badge",className:be(g1({variant:t,type:n}),e),...o})}const x1=Mn("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 v1({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:be(x1({variant:t}),e),...n})}function w1({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 b1({message:e,type:t}){return a.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:a.jsx(v1,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:a.jsxs(w1,{className:"flex items-center text-sm",children:[t==="error"&&a.jsx(Ai,{className:"mr-2 text-[var(--color-error-wMain)]"}),a.jsx("div",{className:"truncate",children:e})]})})})}function y1(){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(b1,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function C1(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,s=d.useRef(null),i=d.useRef(0),l=d.useRef(!1),[c,u]=d.useState({isAtBottom:!0,autoScrollEnabled:!0}),f=d.useCallback(x=>{const{scrollTop:h,scrollHeight:v,clientHeight:w}=x;return Math.abs(v-h-w)<=t},[t]),p=d.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"}),u({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=d.useCallback(()=>{if(!s.current)return;const x=f(s.current);u(h=>({isAtBottom:x,autoScrollEnabled:x?!0:h.autoScrollEnabled}))},[f]);d.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),d.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]),d.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=d.useCallback(()=>{(s.current?f(s.current):!1)||(l.current=!0,u(h=>({...h,autoScrollEnabled:!1})))},[f]);return{scrollRef:s,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>p(),disableAutoScroll:g,userHasScrolled:l.current}}const S1=({fileName:e,onRemove:t})=>a.jsxs(kf,{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(me,{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(Go,{})})]}),E1=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,selectedAgentName:o,sessionId:s,handleSubmit:i,handleCancel:l}=He(),{handleAgentSelection:c}=Uv(),u=d.useRef(null),[f,p]=d.useState([]),m=d.useRef(null),g=d.useRef(n),[x,h]=d.useState("");d.useEffect(()=>{h("")},[s]),d.useEffect(()=>{g.current&&!n&&setTimeout(()=>{var P;(P=m.current)==null||P.focus()},100),g.current=n},[n]);const v=()=>{var P;n||(P=u.current)==null||P.click()},w=P=>{const K=P.target.files;if(K){const W=Array.from(K).filter(z=>!f.some(_=>_.name===z.name&&_.size===z.size&&_.lastModified===z.lastModified));W.length>0&&p(z=>[...z,...W])}P.target&&(P.target.value=""),setTimeout(()=>{var W;(W=m.current)==null||W.focus()},100)},b=P=>{if(n)return;const K=P.clipboardData;if(!K||!K.files||K.files.length===0)return;K.files.length>0&&P.preventDefault();const W=Array.from(K.files).filter(z=>!f.some(_=>_.name===z.name&&_.size===z.size&&_.lastModified===z.lastModified));W.length>0&&p(z=>[...z,...W])},y=P=>{p(K=>K.filter((W,z)=>z!==P))},S=d.useMemo(()=>!n&&((x==null?void 0:x.trim())||f.length!==0),[n,x,f]),N=async P=>{P.preventDefault(),S&&(await i(P,f,x.trim()),p([]),h(""),t==null||t())},j=P=>{if(n)return;const K=P.filter(W=>!f.some(z=>z.name===W.name&&z.size===W.size&&z.lastModified===W.lastModified));K.length>0&&p(W=>[...W,...K])},{isDragging:k,handleDragEnter:A,handleDragOver:G,handleDragLeave:Q,handleDrop:O}=Hv({onFilesDropped:j,disabled:n});return a.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${k?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:A,onDragOver:G,onDragLeave:Q,onDrop:O,children:[a.jsx("input",{type:"file",ref:u,className:"hidden",multiple:!0,onChange:w,accept:"*/*",disabled:n}),f.length>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:f.map((P,K)=>a.jsx(S1,{fileName:P.name,onRemove:()=>y(K)},`${P.name}-${P.lastModified}-${K}`))}),a.jsx(yf,{ref:m,value:x,onChange:P=>h(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:b,onKeyDown:P=>{P.key==="Enter"&&!P.shiftKey&&S&&N(P)}}),a.jsxs("div",{className:"m-2 flex items-center gap-2",children:[a.jsx(me,{variant:"ghost",onClick:v,disabled:n,tooltip:"Attach file",children:a.jsx(rc,{className:"size-4"})}),a.jsx("div",{children:"Agent: "}),a.jsxs(Qd,{value:o,onValueChange:c,disabled:n||e.length===0,children:[a.jsx(tf,{className:"w-[250px]",children:a.jsx(ef,{defaultValue:o})}),a.jsx(nf,{children:e.map(P=>a.jsx(rf,{value:P.name,children:P.displayName||P.name},P.name))})]}),n&&!r?a.jsxs(me,{"data-testid":"cancel",className:"ml-auto gap-1.5",onClick:l,variant:"outline",disabled:r,tooltip:"Cancel",children:[a.jsx(qp,{className:"size-4"}),"Stop"]}):a.jsx(me,{"data-testid":"sendMessage",variant:"ghost",className:"ml-auto gap-1.5",onClick:N,disabled:!S,tooltip:"Send message",children:a.jsx(Xp,{className:"size-4"})})]})]})};function T1(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function k1(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 A1(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 N1(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 _1(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 I1(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 j1(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 M1(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 R1(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 io(e,t){return k1(e,t)?"html":A1(e,t)?"mermaid":_1(e,t)?"image":M1(e,t)?"markdown":R1(e,t)?"audio":I1(e,t)?"json":j1(e,t)?"yaml":N1(e,t)?"csv":T1(e,t)?"text":null}function Af(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 Nf=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],L1=["image","audio"],P1=e=>{if(!e||!e.content)return"";const t=io(e.name,e.mime_type);if(!t||!Nf.includes(t))return"";if(L1.includes(t))return e.content;try{return Af(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},_f=5*1024*1024,D1=Nc(_f);function O1(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=io(e.filename,e.mime_type);return!t||!Nf.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>_f?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${D1}.`}:{canPreview:!0}}const If=(e,t="h-4 w-4")=>{if(!e)return a.jsx(ba,{className:t});switch(io(e.filename,e.mime_type)){case"image":case"mermaid":return a.jsx(tm,{className:t});case"audio":return a.jsx(em,{className:t});case"html":return a.jsx(Qp,{className:t});case"text":return a.jsx(fr,{className:t});case"csv":return a.jsx(Jp,{className:t});case"json":return a.jsx(Zp,{className:t});default:return a.jsx(ba,{className:t})}},jf=({fileAttachment:e,isEmbedded:t=!1})=>a.jsx(Mf,{filename:e.name,mimeType:e.mime_type,onDownload:()=>Eh(e),className:"ml-4",isEmbedded:t}),Mf=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:s,setPreviewArtifact:i,openSidePanelTab:l}=He(),c=d.useMemo(()=>s.find(f=>f.filename===e),[s,e]),u=d.useMemo(()=>If(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:[u,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(me,{variant:"ghost",onClick:f=>{f.stopPropagation(),l("files"),i(c)},tooltip:"Preview",children:a.jsx(oc,{className:"h-4 w-4"})}),r&&a.jsx(me,{variant:"ghost",onClick:()=>r(),tooltip:"Download file",children:a.jsx(Yo,{className:"h-4 w-4"})})]})},F1=ct.memo(({isOpen:e,onClose:t,feedbackType:n,onSubmit:r})=>{const[o,s]=d.useState(""),[i,l]=d.useState(!1),c=d.useRef(null);d.useEffect(()=>{e&&(s(""),l(!1),setTimeout(()=>{var m;(m=c.current)==null||m.focus()},100))},[e]);const u=async()=>{l(!0);try{await r(o),t()}catch{l(!1)}},f=()=>{i||t()},p=n==="up"?"What did you like about the response?":"What did you dislike about the response?";return a.jsx(Qr,{open:e,onOpenChange:f,children:a.jsxs(eo,{className:"sm:max-w-[750px]",showCloseButton:!1,children:[a.jsxs(to,{children:[a.jsx(no,{children:"Provide Feedback"}),a.jsxs(ro,{className:"flex flex-col gap-2",children:[a.jsx("span",{className:"font-medium",children:p}),a.jsx("span",{children:"Providing more details will help improve AI responses over time."})]})]}),a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsx(Yi,{ref:c,value:o,onChange:m=>s(m.target.value),className:"min-h-[120px] text-sm",disabled:i}),a.jsx("p",{className:"text-muted-foreground text-xs",children:"Along with your feedback, details of the task will be recorded."})]}),a.jsxs(Qi,{children:[a.jsx(me,{variant:"ghost",onClick:f,disabled:i,children:"Cancel"}),a.jsx(me,{variant:"default",onClick:u,disabled:i,children:i?"Submitting...":"Submit"})]})]})})}),$1=({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."]})})},z1=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},B1=({content:e,setRenderError:t})=>{d.useEffect(()=>{t(null)},[e,t]);const n=d.useMemo(()=>{try{return z1(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."})},H1=({content:e,setRenderError:t})=>{const n=d.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)})})},U1=({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 Rf(){const e=d.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 W1=({content:e})=>{const{ref:t,handleKeyDown:n}=Rf();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(dr,{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:Lf,setPrototypeOf:vl,isFrozen:V1,getPrototypeOf:G1,getOwnPropertyDescriptor:Y1}=Object;let{freeze:gt,seal:$t,create:Pf}=Object,{apply:ui,construct:di}=typeof Reflect<"u"&&Reflect;gt||(gt=function(t){return t});$t||($t=function(t){return t});ui||(ui=function(t,n,r){return t.apply(n,r)});di||(di=function(t,n){return new t(...n)});const wo=xt(Array.prototype.forEach),K1=xt(Array.prototype.lastIndexOf),wl=xt(Array.prototype.pop),Ar=xt(Array.prototype.push),q1=xt(Array.prototype.splice),jo=xt(String.prototype.toLowerCase),Os=xt(String.prototype.toString),bl=xt(String.prototype.match),Nr=xt(String.prototype.replace),X1=xt(String.prototype.indexOf),Z1=xt(String.prototype.trim),Gt=xt(Object.prototype.hasOwnProperty),pt=xt(RegExp.prototype.test),_r=J1(TypeError);function xt(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 ui(e,t,r)}}function J1(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return di(e,n)}}function Ie(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jo;vl&&vl(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(V1(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Q1(e){for(let t=0;t<e.length;t++)Gt(e,t)||(e[t]=null);return e}function gn(e){const t=Pf(null);for(const[n,r]of Lf(e))Gt(e,n)&&(Array.isArray(r)?t[n]=Q1(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=gn(r):t[n]=r);return t}function Ir(e,t){for(;e!==null;){const r=Y1(e,t);if(r){if(r.get)return xt(r.get);if(typeof r.value=="function")return xt(r.value)}e=G1(e)}function n(){return null}return n}const yl=gt(["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"]),Fs=gt(["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"]),$s=gt(["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"]),eb=gt(["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"]),zs=gt(["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"]),tb=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cl=gt(["#text"]),Sl=gt(["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"]),Bs=gt(["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"]),El=gt(["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"]),bo=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),nb=$t(/\{\{[\w\W]*|[\w\W]*\}\}/gm),rb=$t(/<%[\w\W]*|[\w\W]*%>/gm),ob=$t(/\$\{[\w\W]*/gm),sb=$t(/^data-[\-\w.\u00B7-\uFFFF]+$/),ib=$t(/^aria-[\-\w]+$/),Df=$t(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ab=$t(/^(?:\w+script|data):/i),lb=$t(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Of=$t(/^html$/i),cb=$t(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tl=Object.freeze({__proto__:null,ARIA_ATTR:ib,ATTR_WHITESPACE:lb,CUSTOM_ELEMENT:cb,DATA_ATTR:sb,DOCTYPE_NAME:Of,ERB_EXPR:rb,IS_ALLOWED_URI:Df,IS_SCRIPT_OR_DATA:ab,MUSTACHE_EXPR:nb,TMPLIT_EXPR:ob});const jr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ub=function(){return typeof window>"u"?null:window},db=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}},kl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ff(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ub();const t=V=>Ff(V);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==jr.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:u,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:g}=e,x=c.prototype,h=Ir(x,"cloneNode"),v=Ir(x,"remove"),w=Ir(x,"nextSibling"),b=Ir(x,"childNodes"),y=Ir(x,"parentNode");if(typeof i=="function"){const V=n.createElement("template");V.content&&V.content.ownerDocument&&(n=V.content.ownerDocument)}let S,N="";const{implementation:j,createNodeIterator:k,createDocumentFragment:A,getElementsByTagName:G}=n,{importNode:Q}=r;let O=kl();t.isSupported=typeof Lf=="function"&&typeof y=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:P,ERB_EXPR:K,TMPLIT_EXPR:W,DATA_ATTR:z,ARIA_ATTR:_,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:E,CUSTOM_ELEMENT:T}=Tl;let{IS_ALLOWED_URI:M}=Tl,F=null;const ee=Ie({},[...yl,...Fs,...$s,...zs,...Cl]);let L=null;const U=Ie({},[...Sl,...Bs,...El,...bo]);let Y=Object.seal(Pf(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}})),J=null,I=null,X=!0,re=!0,ne=!1,ue=!0,ae=!1,fe=!0,ye=!1,Le=!1,Pe=!1,$e=!1,Oe=!1,Ue=!1,Mt=!0,Ye=!1;const Rt="user-content-";let it=!0,at=!1,lt={},wt=null;const zt=Ie({},["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 ce=null;const Ct=Ie({},["audio","video","img","source","image","track"]);let bt=null;const Bt=Ie({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),St="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let ft=Ke,Ht=!1,Tt=null;const un=Ie({},[St,Et,Ke],Os);let Lt=Ie({},["mi","mo","mn","ms","mtext"]),Pt=Ie({},["annotation-xml"]);const dn=Ie({},["title","style","font","a","script"]);let kt=null;const fn=["application/xhtml+xml","text/html"],pn="text/html";let Ce=null,We=null;const Ut=n.createElement("form"),Jt=function(C){return C instanceof RegExp||C instanceof Function},At=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(We&&We===C)){if((!C||typeof C!="object")&&(C={}),C=gn(C),kt=fn.indexOf(C.PARSER_MEDIA_TYPE)===-1?pn:C.PARSER_MEDIA_TYPE,Ce=kt==="application/xhtml+xml"?Os:jo,F=Gt(C,"ALLOWED_TAGS")?Ie({},C.ALLOWED_TAGS,Ce):ee,L=Gt(C,"ALLOWED_ATTR")?Ie({},C.ALLOWED_ATTR,Ce):U,Tt=Gt(C,"ALLOWED_NAMESPACES")?Ie({},C.ALLOWED_NAMESPACES,Os):un,bt=Gt(C,"ADD_URI_SAFE_ATTR")?Ie(gn(Bt),C.ADD_URI_SAFE_ATTR,Ce):Bt,ce=Gt(C,"ADD_DATA_URI_TAGS")?Ie(gn(Ct),C.ADD_DATA_URI_TAGS,Ce):Ct,wt=Gt(C,"FORBID_CONTENTS")?Ie({},C.FORBID_CONTENTS,Ce):zt,J=Gt(C,"FORBID_TAGS")?Ie({},C.FORBID_TAGS,Ce):gn({}),I=Gt(C,"FORBID_ATTR")?Ie({},C.FORBID_ATTR,Ce):gn({}),lt=Gt(C,"USE_PROFILES")?C.USE_PROFILES:!1,X=C.ALLOW_ARIA_ATTR!==!1,re=C.ALLOW_DATA_ATTR!==!1,ne=C.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ae=C.SAFE_FOR_TEMPLATES||!1,fe=C.SAFE_FOR_XML!==!1,ye=C.WHOLE_DOCUMENT||!1,$e=C.RETURN_DOM||!1,Oe=C.RETURN_DOM_FRAGMENT||!1,Ue=C.RETURN_TRUSTED_TYPE||!1,Pe=C.FORCE_BODY||!1,Mt=C.SANITIZE_DOM!==!1,Ye=C.SANITIZE_NAMED_PROPS||!1,it=C.KEEP_CONTENT!==!1,at=C.IN_PLACE||!1,M=C.ALLOWED_URI_REGEXP||Df,ft=C.NAMESPACE||Ke,Lt=C.MATHML_TEXT_INTEGRATION_POINTS||Lt,Pt=C.HTML_INTEGRATION_POINTS||Pt,Y=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Jt(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Jt(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ae&&(re=!1),Oe&&($e=!0),lt&&(F=Ie({},Cl),L=[],lt.html===!0&&(Ie(F,yl),Ie(L,Sl)),lt.svg===!0&&(Ie(F,Fs),Ie(L,Bs),Ie(L,bo)),lt.svgFilters===!0&&(Ie(F,$s),Ie(L,Bs),Ie(L,bo)),lt.mathMl===!0&&(Ie(F,zs),Ie(L,El),Ie(L,bo))),C.ADD_TAGS&&(F===ee&&(F=gn(F)),Ie(F,C.ADD_TAGS,Ce)),C.ADD_ATTR&&(L===U&&(L=gn(L)),Ie(L,C.ADD_ATTR,Ce)),C.ADD_URI_SAFE_ATTR&&Ie(bt,C.ADD_URI_SAFE_ATTR,Ce),C.FORBID_CONTENTS&&(wt===zt&&(wt=gn(wt)),Ie(wt,C.FORBID_CONTENTS,Ce)),it&&(F["#text"]=!0),ye&&Ie(F,["html","head","body"]),F.table&&(Ie(F,["tbody"]),delete J.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw _r('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw _r('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=C.TRUSTED_TYPES_POLICY,N=S.createHTML("")}else S===void 0&&(S=db(g,o)),S!==null&&typeof N=="string"&&(N=S.createHTML(""));gt&>(C),We=C}},Dt=Ie({},[...Fs,...$s,...eb]),Qt=Ie({},[...zs,...tb]),Se=function(C){let R=y(C);(!R||!R.tagName)&&(R={namespaceURI:ft,tagName:"template"});const Z=jo(C.tagName),le=jo(R.tagName);return Tt[C.namespaceURI]?C.namespaceURI===Et?R.namespaceURI===Ke?Z==="svg":R.namespaceURI===St?Z==="svg"&&(le==="annotation-xml"||Lt[le]):!!Dt[Z]:C.namespaceURI===St?R.namespaceURI===Ke?Z==="math":R.namespaceURI===Et?Z==="math"&&Pt[le]:!!Qt[Z]:C.namespaceURI===Ke?R.namespaceURI===Et&&!Pt[le]||R.namespaceURI===St&&!Lt[le]?!1:!Qt[Z]&&(dn[Z]||!Dt[Z]):!!(kt==="application/xhtml+xml"&&Tt[C.namespaceURI]):!1},ke=function(C){Ar(t.removed,{element:C});try{y(C).removeChild(C)}catch{v(C)}},Me=function(C,R){try{Ar(t.removed,{attribute:R.getAttributeNode(C),from:R})}catch{Ar(t.removed,{attribute:null,from:R})}if(R.removeAttribute(C),C==="is")if($e||Oe)try{ke(R)}catch{}else try{R.setAttribute(C,"")}catch{}},_e=function(C){let R=null,Z=null;if(Pe)C="<remove></remove>"+C;else{const pe=bl(C,/^[\r\n\t ]+/);Z=pe&&pe[0]}kt==="application/xhtml+xml"&&ft===Ke&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const le=S?S.createHTML(C):C;if(ft===Ke)try{R=new m().parseFromString(le,kt)}catch{}if(!R||!R.documentElement){R=j.createDocument(ft,"template",null);try{R.documentElement.innerHTML=Ht?N:le}catch{}}const ve=R.body||R.documentElement;return C&&Z&&ve.insertBefore(n.createTextNode(Z),ve.childNodes[0]||null),ft===Ke?G.call(R,ye?"html":"body")[0]:ye?R.documentElement:ve},Je=function(C){return k.call(C.ownerDocument||C,C,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},qe=function(C){return C instanceof p&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof f)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},Ge=function(C){return typeof l=="function"&&C instanceof l};function Be(V,C,R){wo(V,Z=>{Z.call(t,C,R,We)})}const D=function(C){let R=null;if(Be(O.beforeSanitizeElements,C,null),qe(C))return ke(C),!0;const Z=Ce(C.nodeName);if(Be(O.uponSanitizeElement,C,{tagName:Z,allowedTags:F}),fe&&C.hasChildNodes()&&!Ge(C.firstElementChild)&&pt(/<[/\w!]/g,C.innerHTML)&&pt(/<[/\w!]/g,C.textContent)||C.nodeType===jr.progressingInstruction||fe&&C.nodeType===jr.comment&&pt(/<[/\w]/g,C.data))return ke(C),!0;if(!F[Z]||J[Z]){if(!J[Z]&&$(Z)&&(Y.tagNameCheck instanceof RegExp&&pt(Y.tagNameCheck,Z)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Z)))return!1;if(it&&!wt[Z]){const le=y(C)||C.parentNode,ve=b(C)||C.childNodes;if(ve&&le){const pe=ve.length;for(let Ae=pe-1;Ae>=0;--Ae){const te=h(ve[Ae],!0);te.__removalCount=(C.__removalCount||0)+1,le.insertBefore(te,w(C))}}}return ke(C),!0}return C instanceof c&&!Se(C)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&pt(/<\/no(script|embed|frames)/i,C.innerHTML)?(ke(C),!0):(ae&&C.nodeType===jr.text&&(R=C.textContent,wo([P,K,W],le=>{R=Nr(R,le," ")}),C.textContent!==R&&(Ar(t.removed,{element:C.cloneNode()}),C.textContent=R)),Be(O.afterSanitizeElements,C,null),!1)},B=function(C,R,Z){if(Mt&&(R==="id"||R==="name")&&(Z in n||Z in Ut))return!1;if(!(re&&!I[R]&&pt(z,R))){if(!(X&&pt(_,R))){if(!L[R]||I[R]){if(!($(C)&&(Y.tagNameCheck instanceof RegExp&&pt(Y.tagNameCheck,C)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(C))&&(Y.attributeNameCheck instanceof RegExp&&pt(Y.attributeNameCheck,R)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(R))||R==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&pt(Y.tagNameCheck,Z)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Z))))return!1}else if(!bt[R]){if(!pt(M,Nr(Z,E,""))){if(!((R==="src"||R==="xlink:href"||R==="href")&&C!=="script"&&X1(Z,"data:")===0&&ce[C])){if(!(ne&&!pt(q,Nr(Z,E,"")))){if(Z)return!1}}}}}}return!0},$=function(C){return C!=="annotation-xml"&&bl(C,T)},H=function(C){Be(O.beforeSanitizeAttributes,C,null);const{attributes:R}=C;if(!R||qe(C))return;const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let le=R.length;for(;le--;){const ve=R[le],{name:pe,namespaceURI:Ae,value:te}=ve,he=Ce(pe),Re=te;let we=pe==="value"?Re:Z1(Re);if(Z.attrName=he,Z.attrValue=we,Z.keepAttr=!0,Z.forceKeepAttr=void 0,Be(O.uponSanitizeAttribute,C,Z),we=Z.attrValue,Ye&&(he==="id"||he==="name")&&(Me(pe,C),we=Rt+we),fe&&pt(/((--!?|])>)|<\/(style|title)/i,we)){Me(pe,C);continue}if(Z.forceKeepAttr)continue;if(!Z.keepAttr){Me(pe,C);continue}if(!ue&&pt(/\/>/i,we)){Me(pe,C);continue}ae&&wo([P,K,W],xe=>{we=Nr(we,xe," ")});const Xe=Ce(C.nodeName);if(!B(Xe,he,we)){Me(pe,C);continue}if(S&&typeof g=="object"&&typeof g.getAttributeType=="function"&&!Ae)switch(g.getAttributeType(Xe,he)){case"TrustedHTML":{we=S.createHTML(we);break}case"TrustedScriptURL":{we=S.createScriptURL(we);break}}if(we!==Re)try{Ae?C.setAttributeNS(Ae,pe,we):C.setAttribute(pe,we),qe(C)?ke(C):wl(t.removed)}catch{Me(pe,C)}}Be(O.afterSanitizeAttributes,C,null)},oe=function V(C){let R=null;const Z=Je(C);for(Be(O.beforeSanitizeShadowDOM,C,null);R=Z.nextNode();)Be(O.uponSanitizeShadowNode,R,null),D(R),H(R),R.content instanceof s&&V(R.content);Be(O.afterSanitizeShadowDOM,C,null)};return t.sanitize=function(V){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},R=null,Z=null,le=null,ve=null;if(Ht=!V,Ht&&(V="<!-->"),typeof V!="string"&&!Ge(V))if(typeof V.toString=="function"){if(V=V.toString(),typeof V!="string")throw _r("dirty is not a string, aborting")}else throw _r("toString is not a function");if(!t.isSupported)return V;if(Le||At(C),t.removed=[],typeof V=="string"&&(at=!1),at){if(V.nodeName){const te=Ce(V.nodeName);if(!F[te]||J[te])throw _r("root node is forbidden and cannot be sanitized in-place")}}else if(V instanceof l)R=_e("<!---->"),Z=R.ownerDocument.importNode(V,!0),Z.nodeType===jr.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?R=Z:R.appendChild(Z);else{if(!$e&&!ae&&!ye&&V.indexOf("<")===-1)return S&&Ue?S.createHTML(V):V;if(R=_e(V),!R)return $e?null:Ue?N:""}R&&Pe&&ke(R.firstChild);const pe=Je(at?V:R);for(;le=pe.nextNode();)D(le),H(le),le.content instanceof s&&oe(le.content);if(at)return V;if($e){if(Oe)for(ve=A.call(R.ownerDocument);R.firstChild;)ve.appendChild(R.firstChild);else ve=R;return(L.shadowroot||L.shadowrootmode)&&(ve=Q.call(r,ve,!0)),ve}let Ae=ye?R.outerHTML:R.innerHTML;return ye&&F["!doctype"]&&R.ownerDocument&&R.ownerDocument.doctype&&R.ownerDocument.doctype.name&&pt(Of,R.ownerDocument.doctype.name)&&(Ae="<!DOCTYPE "+R.ownerDocument.doctype.name+`>
|
|
124
|
-
`+Ae),ae&&wo([P,K,W],te=>{Ae=Nr(Ae,te," ")}),S&&Ue?S.createHTML(Ae):Ae},t.setConfig=function(){let V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};At(V),Le=!0},t.clearConfig=function(){We=null,Le=!1},t.isValidAttribute=function(V,C,R){We||At({});const Z=Ce(V),le=Ce(C);return B(Z,le,R)},t.addHook=function(V,C){typeof C=="function"&&Ar(O[V],C)},t.removeHook=function(V,C){if(C!==void 0){const R=K1(O[V],C);return R===-1?void 0:q1(O[V],R,1)[0]}return wl(O[V])},t.removeHooks=function(V){O[V]=[]},t.removeAllHooks=function(){O=kl()},t}var $f=Ff();const fb=({content:e,setRenderError:t})=>{const[n,r]=d.useState(""),o=d.useMemo(()=>$f.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return d.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 zf(e){return typeof e>"u"||e===null}function pb(e){return typeof e=="object"&&e!==null}function mb(e){return Array.isArray(e)?e:zf(e)?[]:[e]}function hb(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 gb(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function xb(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var vb=zf,wb=pb,bb=mb,yb=gb,Cb=xb,Sb=hb,et={isNothing:vb,isObject:wb,toArray:bb,repeat:yb,isNegativeZero:Cb,extend:Sb};function Bf(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 Ur(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Bf(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ur.prototype=Object.create(Error.prototype);Ur.prototype.constructor=Ur;Ur.prototype.toString=function(t){return this.name+": "+Bf(this,t)};var ht=Ur;function Hs(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 Us(e,t){return et.repeat(" ",t-e.length)+e}function Eb(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,u,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++)u=Hs(e.buffer,r[i-c],o[i-c],e.position-(r[i]-r[i-c]),p),l=et.repeat(" ",t.indent)+Us((e.line-c+1).toString(),f)+" | "+u.str+`
|
|
301
|
-
`+l;for(u=Hs(e.buffer,r[i],o[i],e.position,p),l+=et.repeat(" ",t.indent)+Us((e.line+1).toString(),f)+" | "+u.str+`
|
|
302
|
-
`,l+=et.repeat("-",t.indent+f+3+u.pos)+`^
|
|
303
|
-
`,c=1;c<=t.linesAfter&&!(i+c>=o.length);c++)u=Hs(e.buffer,r[i+c],o[i+c],e.position-(r[i]-r[i+c]),p),l+=et.repeat(" ",t.indent)+Us((e.line+c+1).toString(),f)+" | "+u.str+`
|
|
304
|
-
`;return l.replace(/\n$/,"")}var Tb=Eb,kb=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],Ab=["scalar","sequence","mapping"];function Nb(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function _b(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(kb.indexOf(n)===-1)throw new ht('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=Nb(t.styleAliases||null),Ab.indexOf(this.kind)===-1)throw new ht('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var st=_b;function Al(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 Ib(){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 fi(e){return this.extend(e)}fi.prototype.extend=function(t){var n=[],r=[];if(t instanceof st)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 ht("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof st))throw new ht("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ht("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 ht("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 st))throw new ht("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(fi.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=Al(o,"implicit"),o.compiledExplicit=Al(o,"explicit"),o.compiledTypeMap=Ib(o.compiledImplicit,o.compiledExplicit),o};var Hf=fi,Uf=new st("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Wf=new st("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Vf=new st("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Gf=new Hf({explicit:[Uf,Wf,Vf]});function jb(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Mb(){return null}function Rb(e){return e===null}var Yf=new st("tag:yaml.org,2002:null",{kind:"scalar",resolve:jb,construct:Mb,predicate:Rb,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Lb(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 Pb(e){return e==="true"||e==="True"||e==="TRUE"}function Db(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Kf=new st("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Lb,construct:Pb,predicate:Db,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 Ob(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Fb(e){return 48<=e&&e<=55}function $b(e){return 48<=e&&e<=57}function zb(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(!Ob(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!Fb(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!$b(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function Bb(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 Hb(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!et.isNegativeZero(e)}var qf=new st("tag:yaml.org,2002:int",{kind:"scalar",resolve:zb,construct:Bb,predicate:Hb,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"]}}),Ub=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Wb(e){return!(e===null||!Ub.test(e)||e[e.length-1]==="_")}function Vb(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 Gb=/^[-+]?[0-9]+e/;function Yb(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(et.isNegativeZero(e))return"-0.0";return n=e.toString(10),Gb.test(n)?n.replace("e",".e"):n}function Kb(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||et.isNegativeZero(e))}var Xf=new st("tag:yaml.org,2002:float",{kind:"scalar",resolve:Wb,construct:Vb,predicate:Kb,represent:Yb,defaultStyle:"lowercase"}),Zf=Gf.extend({implicit:[Yf,Kf,qf,Xf]}),Jf=Zf,Qf=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ep=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 qb(e){return e===null?!1:Qf.exec(e)!==null||ep.exec(e)!==null}function Xb(e){var t,n,r,o,s,i,l,c=0,u=null,f,p,m;if(t=Qf.exec(e),t===null&&(t=ep.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),u=(f*60+p)*6e4,t[9]==="-"&&(u=-u)),m=new Date(Date.UTC(n,r,o,s,i,l,c)),u&&m.setTime(m.getTime()-u),m}function Zb(e){return e.toISOString()}var tp=new st("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:qb,construct:Xb,instanceOf:Date,represent:Zb});function Jb(e){return e==="<<"||e===null}var np=new st("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Jb}),ua=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
305
|
-
\r`;function Qb(e){if(e===null)return!1;var t,n,r=0,o=e.length,s=ua;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 ey(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,s=ua,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 ty(e){var t="",n=0,r,o,s=e.length,i=ua;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 ny(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var rp=new st("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Qb,construct:ey,predicate:ny,represent:ty}),ry=Object.prototype.hasOwnProperty,oy=Object.prototype.toString;function sy(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,oy.call(o)!=="[object Object]")return!1;for(s in o)if(ry.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 iy(e){return e!==null?e:[]}var op=new st("tag:yaml.org,2002:omap",{kind:"sequence",resolve:sy,construct:iy}),ay=Object.prototype.toString;function ly(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],ay.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;s[t]=[o[0],r[o[0]]]}return!0}function cy(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 sp=new st("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:ly,construct:cy}),uy=Object.prototype.hasOwnProperty;function dy(e){if(e===null)return!0;var t,n=e;for(t in n)if(uy.call(n,t)&&n[t]!==null)return!1;return!0}function fy(e){return e!==null?e:{}}var ip=new st("tag:yaml.org,2002:set",{kind:"mapping",resolve:dy,construct:fy}),da=Jf.extend({implicit:[tp,np],explicit:[rp,op,sp,ip]}),jn=Object.prototype.hasOwnProperty,zo=1,ap=2,lp=3,Bo=4,Ws=1,py=2,Nl=3,my=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,hy=/[\x85\u2028\u2029]/,gy=/[,\[\]\{\}]/,cp=/^(?:!|!!|![a-z\-]+!)$/i,up=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _l(e){return Object.prototype.toString.call(e)}function an(e){return e===10||e===13}function zn(e){return e===9||e===32}function yt(e){return e===9||e===32||e===10||e===13}function ir(e){return e===44||e===91||e===93||e===123||e===125}function xy(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function vy(e){return e===120?2:e===117?4:e===85?8:0}function wy(e){return 48<=e&&e<=57?e-48:-1}function Il(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 by(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var dp=new Array(256),fp=new Array(256);for(var nr=0;nr<256;nr++)dp[nr]=Il(nr)?1:0,fp[nr]=Il(nr);function yy(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||da,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 pp(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=Tb(n),new ht(t,n)}function de(e,t){throw pp(e,t)}function Ho(e,t){e.onWarning&&e.onWarning.call(null,pp(e,t))}var jl={YAML:function(t,n,r){var o,s,i;t.version!==null&&de(t,"duplication of %YAML directive"),r.length!==1&&de(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&de(t,"ill-formed argument of the YAML directive"),s=parseInt(o[1],10),i=parseInt(o[2],10),s!==1&&de(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,i!==1&&i!==2&&Ho(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,s;r.length!==2&&de(t,"TAG directive accepts exactly two arguments"),o=r[0],s=r[1],cp.test(o)||de(t,"ill-formed tag handle (first argument) of the TAG directive"),jn.call(t.tagMap,o)&&de(t,'there is a previously declared suffix for "'+o+'" tag handle'),up.test(s)||de(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{de(t,"tag prefix is malformed: "+s)}t.tagMap[o]=s}};function An(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||de(e,"expected valid JSON character");else my.test(l)&&de(e,"the stream contains non-printable characters");e.result+=l}}function Ml(e,t,n,r){var o,s,i,l;for(et.isObject(n)||de(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],jn.call(t,s)||(t[s]=n[s],r[s]=!0)}function ar(e,t,n,r,o,s,i,l,c){var u,f;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),u=0,f=o.length;u<f;u+=1)Array.isArray(o[u])&&de(e,"nested arrays are not supported inside keys"),typeof o=="object"&&_l(o[u])==="[object Object]"&&(o[u]="[object Object]");if(typeof o=="object"&&_l(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(u=0,f=s.length;u<f;u+=1)Ml(e,t,s[u],n);else Ml(e,t,s,n);else!e.json&&!jn.call(n,o)&&jn.call(t,o)&&(e.line=i||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,de(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 fa(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++):de(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function Ze(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;zn(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(an(o))for(fa(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&&Ho(e,"deficient indentation"),r}function gs(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||yt(n)))}function pa(e,t){t===1?e.result+=" ":t>1&&(e.result+=et.repeat(`
|
|
307
|
-
`,t-1))}function Cy(e,t,n){var r,o,s,i,l,c,u,f,p=e.kind,m=e.result,g;if(g=e.input.charCodeAt(e.position),yt(g)||ir(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),yt(o)||n&&ir(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),yt(o)||n&&ir(o))break}else if(g===35){if(r=e.input.charCodeAt(e.position-1),yt(r))break}else{if(e.position===e.lineStart&&gs(e)||n&&ir(g))break;if(an(g))if(c=e.line,u=e.lineStart,f=e.lineIndent,Ze(e,!1,-1),e.lineIndent>=t){l=!0,g=e.input.charCodeAt(e.position);continue}else{e.position=i,e.line=c,e.lineStart=u,e.lineIndent=f;break}}l&&(An(e,s,i,!1),pa(e,e.line-c),s=i=e.position,l=!1),zn(g)||(i=e.position+1),g=e.input.charCodeAt(++e.position)}return An(e,s,i,!1),e.result?!0:(e.kind=p,e.result=m,!1)}function Sy(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(An(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 an(n)?(An(e,r,o,!0),pa(e,Ze(e,!1,t)),r=o=e.position):e.position===e.lineStart&&gs(e)?de(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);de(e,"unexpected end of the stream within a single quoted scalar")}function Ey(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 An(e,n,e.position,!0),e.position++,!0;if(l===92){if(An(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),an(l))Ze(e,!1,t);else if(l<256&&dp[l])e.result+=fp[l],e.position++;else if((i=vy(l))>0){for(o=i,s=0;o>0;o--)l=e.input.charCodeAt(++e.position),(i=xy(l))>=0?s=(s<<4)+i:de(e,"expected hexadecimal character");e.result+=by(s),e.position++}else de(e,"unknown escape sequence");n=r=e.position}else an(l)?(An(e,n,r,!0),pa(e,Ze(e,!1,t)),n=r=e.position):e.position===e.lineStart&&gs(e)?de(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}de(e,"unexpected end of the stream within a double quoted scalar")}function Ty(e,t){var n=!0,r,o,s,i=e.tag,l,c=e.anchor,u,f,p,m,g,x=Object.create(null),h,v,w,b;if(b=e.input.charCodeAt(e.position),b===91)f=93,g=!1,l=[];else if(b===123)f=125,g=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),b=e.input.charCodeAt(++e.position);b!==0;){if(Ze(e,!0,t),b=e.input.charCodeAt(e.position),b===f)return e.position++,e.tag=i,e.anchor=c,e.kind=g?"mapping":"sequence",e.result=l,!0;n?b===44&&de(e,"expected the node content, but found ','"):de(e,"missed comma between flow collection entries"),v=h=w=null,p=m=!1,b===63&&(u=e.input.charCodeAt(e.position+1),yt(u)&&(p=m=!0,e.position++,Ze(e,!0,t))),r=e.line,o=e.lineStart,s=e.position,gr(e,t,zo,!1,!0),v=e.tag,h=e.result,Ze(e,!0,t),b=e.input.charCodeAt(e.position),(m||e.line===r)&&b===58&&(p=!0,b=e.input.charCodeAt(++e.position),Ze(e,!0,t),gr(e,t,zo,!1,!0),w=e.result),g?ar(e,l,x,v,h,w,r,o,s):p?l.push(ar(e,null,x,v,h,w,r,o,s)):l.push(h),Ze(e,!0,t),b=e.input.charCodeAt(e.position),b===44?(n=!0,b=e.input.charCodeAt(++e.position)):n=!1}de(e,"unexpected end of the stream within a flow collection")}function ky(e,t){var n,r,o=Ws,s=!1,i=!1,l=t,c=0,u=!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)Ws===o?o=p===43?Nl:py:de(e,"repeat of a chomping mode identifier");else if((f=wy(p))>=0)f===0?de(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):i?de(e,"repeat of an indentation width identifier"):(l=t+f-1,i=!0);else break;if(zn(p)){do p=e.input.charCodeAt(++e.position);while(zn(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!an(p)&&p!==0)}for(;p!==0;){for(fa(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),an(p)){c++;continue}if(e.lineIndent<l){o===Nl?e.result+=et.repeat(`
|
|
308
|
-
`,s?1+c:c):o===Ws&&s&&(e.result+=`
|
|
309
|
-
`);break}for(r?zn(p)?(u=!0,e.result+=et.repeat(`
|
|
310
|
-
`,s?1+c:c)):u?(u=!1,e.result+=et.repeat(`
|
|
311
|
-
`,c+1)):c===0?s&&(e.result+=" "):e.result+=et.repeat(`
|
|
312
|
-
`,c):e.result+=et.repeat(`
|
|
313
|
-
`,s?1+c:c),s=!0,i=!0,c=0,n=e.position;!an(p)&&p!==0;)p=e.input.charCodeAt(++e.position);An(e,n,e.position,!1)}return!0}function Rl(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,de(e,"tab characters must not be used in indentation")),!(c!==45||(i=e.input.charCodeAt(e.position+1),!yt(i))));){if(l=!0,e.position++,Ze(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,gr(e,t,lp,!1,!0),s.push(e.result),Ze(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)de(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 Ay(e,t,n){var r,o,s,i,l,c,u=e.tag,f=e.anchor,p={},m=Object.create(null),g=null,x=null,h=null,v=!1,w=!1,b;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),b=e.input.charCodeAt(e.position);b!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,de(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(b===63||b===58)&&yt(r))b===63?(v&&(ar(e,p,m,g,x,null,i,l,c),g=x=h=null),w=!0,v=!0,o=!0):v?(v=!1,o=!0):de(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,b=r;else{if(i=e.line,l=e.lineStart,c=e.position,!gr(e,n,ap,!1,!0))break;if(e.line===s){for(b=e.input.charCodeAt(e.position);zn(b);)b=e.input.charCodeAt(++e.position);if(b===58)b=e.input.charCodeAt(++e.position),yt(b)||de(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(ar(e,p,m,g,x,null,i,l,c),g=x=h=null),w=!0,v=!1,o=!1,g=e.tag,x=e.result;else if(w)de(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=f,!0}else if(w)de(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=f,!0}if((e.line===s||e.lineIndent>t)&&(v&&(i=e.line,l=e.lineStart,c=e.position),gr(e,t,Bo,!0,o)&&(v?x=e.result:h=e.result),v||(ar(e,p,m,g,x,h,i,l,c),g=x=h=null),Ze(e,!0,-1),b=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&b!==0)de(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&ar(e,p,m,g,x,null,i,l,c),w&&(e.tag=u,e.anchor=f,e.kind="mapping",e.result=p),w}function Ny(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&&de(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)):de(e,"unexpected end of the stream within a verbatim tag")}else{for(;i!==0&&!yt(i);)i===33&&(r?de(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),cp.test(o)||de(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),gy.test(s)&&de(e,"tag suffix cannot contain flow indicator characters")}s&&!up.test(s)&&de(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{de(e,"tag name is malformed: "+s)}return n?e.tag=s:jn.call(e.tagMap,o)?e.tag=e.tagMap[o]+s:o==="!"?e.tag="!"+s:o==="!!"?e.tag="tag:yaml.org,2002:"+s:de(e,'undeclared tag handle "'+o+'"'),!0}function _y(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&de(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!yt(n)&&!ir(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&de(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Iy(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&&!yt(r)&&!ir(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&de(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),jn.call(e.anchorMap,n)||de(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],Ze(e,!0,-1),!0}function gr(e,t,n,r,o){var s,i,l,c=1,u=!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=Bo===n||lp===n,r&&Ze(e,!0,-1)&&(u=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;Ny(e)||_y(e);)Ze(e,!0,-1)?(u=!0,l=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=u||o),(c===1||Bo===n)&&(zo===n||ap===n?h=t:h=t+1,v=e.position-e.lineStart,c===1?l&&(Rl(e,v)||Ay(e,v,h))||Ty(e,h)?f=!0:(i&&ky(e,h)||Sy(e,h)||Ey(e,h)?f=!0:Iy(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&de(e,"alias node should not have any properties")):Cy(e,h,zo===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&Rl(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"&&de(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(jn.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||de(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&de(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)):de(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 jy(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&&(Ze(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&&!yt(i);)i=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&de(e,"directive name must not be less than one character in length");i!==0;){for(;zn(i);)i=e.input.charCodeAt(++e.position);if(i===35){do i=e.input.charCodeAt(++e.position);while(i!==0&&!an(i));break}if(an(i))break;for(n=e.position;i!==0&&!yt(i);)i=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}i!==0&&fa(e),jn.call(jl,r)?jl[r](e,r,o):Ho(e,'unknown document directive "'+r+'"')}if(Ze(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,Ze(e,!0,-1)):s&&de(e,"directives end mark is expected"),gr(e,e.lineIndent-1,Bo,!1,!0),Ze(e,!0,-1),e.checkLineBreaks&&hy.test(e.input.slice(t,e.position))&&Ho(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&gs(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,Ze(e,!0,-1));return}if(e.position<e.length-1)de(e,"end of the stream or a document separator is expected");else return}function mp(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 yy(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,de(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;)jy(n);return n.documents}function My(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=mp(e,n);if(typeof t!="function")return r;for(var o=0,s=r.length;o<s;o+=1)t(r[o])}function Ry(e,t){var n=mp(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new ht("expected a single document in the stream, but found more")}}var Ly=My,Py=Ry,hp={loadAll:Ly,load:Py},gp=Object.prototype.toString,xp=Object.prototype.hasOwnProperty,ma=65279,Dy=9,Wr=10,Oy=13,Fy=32,$y=33,zy=34,pi=35,By=37,Hy=38,Uy=39,Wy=42,vp=44,Vy=45,Uo=58,Gy=61,Yy=62,Ky=63,qy=64,wp=91,bp=93,Xy=96,yp=123,Zy=124,Cp=125,dt={};dt[0]="\\0";dt[7]="\\a";dt[8]="\\b";dt[9]="\\t";dt[10]="\\n";dt[11]="\\v";dt[12]="\\f";dt[13]="\\r";dt[27]="\\e";dt[34]='\\"';dt[92]="\\\\";dt[133]="\\N";dt[160]="\\_";dt[8232]="\\L";dt[8233]="\\P";var Jy=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Qy=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function eC(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&&xp.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[i]=l;return n}function tC(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 ht("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+et.repeat("0",r-t.length)+t}var nC=1,Vr=2;function rC(e){this.schema=e.schema||da,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=et.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=eC(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==='"'?Vr:nC,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 Ll(e,t){for(var n=et.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 mi(e,t){return`
|
|
317
|
-
`+et.repeat(" ",e.indent*t)}function oC(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 Wo(e){return e===Fy||e===Dy}function Gr(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ma||65536<=e&&e<=1114111}function Pl(e){return Gr(e)&&e!==ma&&e!==Oy&&e!==Wr}function Dl(e,t,n){var r=Pl(e),o=r&&!Wo(e);return(n?r:r&&e!==vp&&e!==wp&&e!==bp&&e!==yp&&e!==Cp)&&e!==pi&&!(t===Uo&&!o)||Pl(t)&&!Wo(t)&&e===pi||t===Uo&&o}function sC(e){return Gr(e)&&e!==ma&&!Wo(e)&&e!==Vy&&e!==Ky&&e!==Uo&&e!==vp&&e!==wp&&e!==bp&&e!==yp&&e!==Cp&&e!==pi&&e!==Hy&&e!==Wy&&e!==$y&&e!==Zy&&e!==Gy&&e!==Yy&&e!==Uy&&e!==zy&&e!==By&&e!==qy&&e!==Xy}function iC(e){return!Wo(e)&&e!==Uo}function Or(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 Sp(e){var t=/^\n* /;return t.test(e)}var Ep=1,hi=2,Tp=3,kp=4,or=5;function aC(e,t,n,r,o,s,i,l){var c,u=0,f=null,p=!1,m=!1,g=r!==-1,x=-1,h=sC(Or(e,0))&&iC(Or(e,e.length-1));if(t||i)for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Or(e,c),!Gr(u))return or;h=h&&Dl(u,f,l),f=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=Or(e,c),u===Wr)p=!0,g&&(m=m||c-x-1>r&&e[x+1]!==" ",x=c);else if(!Gr(u))return or;h=h&&Dl(u,f,l),f=u}m=m||g&&c-x-1>r&&e[x+1]!==" "}return!p&&!m?h&&!i&&!o(e)?Ep:s===Vr?or:hi:n>9&&Sp(e)?or:i?s===Vr?or:hi:m?kp:Tp}function lC(e,t,n,r,o){e.dump=(function(){if(t.length===0)return e.quotingType===Vr?'""':"''";if(!e.noCompatMode&&(Jy.indexOf(t)!==-1||Qy.test(t)))return e.quotingType===Vr?'"'+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(u){return oC(e,u)}switch(aC(t,l,e.indent,i,c,e.quotingType,e.forceQuotes&&!r,o)){case Ep:return t;case hi:return"'"+t.replace(/'/g,"''")+"'";case Tp:return"|"+Ol(t,e.indent)+Fl(Ll(t,s));case kp:return">"+Ol(t,e.indent)+Fl(Ll(cC(t,i),s));case or:return'"'+uC(t)+'"';default:throw new ht("impossible error: invalid scalar style")}})()}function Ol(e,t){var n=Sp(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 Fl(e){return e[e.length-1]===`
|
|
322
|
-
`?e.slice(0,-1):e}function cC(e,t){for(var n=/(\n+)([^\n]*)/g,r=(function(){var u=e.indexOf(`
|
|
323
|
-
`);return u=u!==-1?u:e.length,n.lastIndex=u,$l(e.slice(0,u),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
|
-
`:"")+$l(c,t),o=s}return r}function $l(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 uC(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=Or(e,o),r=dt[n],!r&&Gr(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||tC(n);return t}function dC(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)),(yn(e,t,l,!1,!1)||typeof l>"u"&&yn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function zl(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)),(yn(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&yn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=mi(e,t)),e.dump&&Wr===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=s,e.dump=o||"[]"}function fC(e,t,n){var r="",o=e.tag,s=Object.keys(n),i,l,c,u,f;for(i=0,l=s.length;i<l;i+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=s[i],u=n[c],e.replacer&&(u=e.replacer.call(n,c,u)),yn(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),yn(e,t,u,!1,!1)&&(f+=e.dump,r+=f));e.tag=o,e.dump="{"+r+"}"}function pC(e,t,n,r){var o="",s=e.tag,i=Object.keys(n),l,c,u,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 ht("sortKeys must be a boolean or a function");for(l=0,c=i.length;l<c;l+=1)m="",(!r||o!=="")&&(m+=mi(e,t)),u=i[l],f=n[u],e.replacer&&(f=e.replacer.call(n,u,f)),yn(e,t+1,u,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&Wr===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,p&&(m+=mi(e,t)),yn(e,t+1,f,!0,p)&&(e.dump&&Wr===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,o+=m));e.tag=s,e.dump=o||"{}"}function Bl(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,gp.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(xp.call(l.represent,c))r=l.represent[c](t,c);else throw new ht("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function yn(e,t,n,r,o,s,i){e.tag=null,e.dump=n,Bl(e,n,!1)||Bl(e,n,!0);var l=gp.call(e.dump),c=r,u;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?(pC(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(fC(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?zl(e,t-1,e.dump,o):zl(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(dC(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&lC(e,e.dump,t,s,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ht("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function mC(e,t){var n=[],r=[],o,s;for(gi(e,n,r),o=0,s=r.length;o<s;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(s)}function gi(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)gi(e[o],t,n);else for(r=Object.keys(e),o=0,s=r.length;o<s;o+=1)gi(e[r[o]],t,n)}function hC(e,t){t=t||{};var n=new rC(t);n.noRefs||mC(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),yn(n,0,r,!0,!0)?n.dump+`
|
|
329
|
-
`:""}var gC=hC,xC={dump:gC};function ha(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 vC=st,wC=Hf,bC=Gf,yC=Zf,CC=Jf,SC=da,EC=hp.load,TC=hp.loadAll,kC=xC.dump,AC=ht,NC={binary:rp,float:Xf,map:Vf,null:Yf,pairs:sp,set:ip,timestamp:tp,bool:Kf,int:qf,merge:np,omap:op,seq:Wf,str:Uf},_C=ha("safeLoad","load"),IC=ha("safeLoadAll","loadAll"),jC=ha("safeDump","dump"),MC={Type:vC,Schema:wC,FAILSAFE_SCHEMA:bC,JSON_SCHEMA:yC,CORE_SCHEMA:CC,DEFAULT_SCHEMA:SC,load:EC,loadAll:TC,dump:kC,YAMLException:AC,types:NC,safeLoad:_C,safeLoadAll:IC,safeDump:jC};const RC=({content:e,rendererType:t,setRenderError:n})=>{const[r,o]=d.useState(!1);d.useEffect(()=>{n(null)},[e,n]);const[s,i]=d.useMemo(()=>{try{if(t==="yaml"){const l=MC.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 u={[`${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,u]}},[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(me,{onClick:()=>o(!r),title:r?"Show Structured View":"Show Raw Text",children:r?a.jsxs(a.Fragment,{children:[a.jsx(oc,{})," Structured"]}):a.jsxs(a.Fragment,{children:[a.jsx(sc,{})," 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(Ap,{content:s,setRenderError:n}):a.jsx(Si,{data:i,maxDepth:4,className:"min-h-16 border-none p-2"})})})]})},Ap=({content:e,className:t=""})=>{const{ref:n,handleKeyDown:r}=Rf();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})})},Np=({content:e,rendererType:t,mime_type:n,setRenderError:r})=>{switch(t){case"csv":return a.jsx(B1,{content:e,setRenderError:r});case"mermaid":return a.jsx(fb,{content:e,setRenderError:r});case"html":return a.jsx(H1,{content:e,setRenderError:r});case"json":case"yaml":return a.jsx(RC,{content:e,rendererType:t,setRenderError:r});case"image":return a.jsx(U1,{content:e,mime_type:n,setRenderError:r});case"markdown":return a.jsx(W1,{content:e,setRenderError:r});case"audio":return a.jsx($1,{content:e,mime_type:n,setRenderError:r});default:return a.jsx(Ap,{content:e,setRenderError:r})}},LC={"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 PC(e,t){const n=LC[e]||"bin";return`embedded_file_${t+1}.${n}`}function DC(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],u=e[r.index+s.length];if(!(c==='"'&&u==='"'||c==="'"&&u==="'")&&l&&l.length>10){const f=io(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:PC(i,o++)})}}return t}function OC(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 FC(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"?[]:[...DC(e),...OC(e),...FC(e)]}const _p={LAYOUT:"layout"},mt=({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})]}),zC=({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,u])=>a.jsxs("li",{className:"text-sm",children:[a.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",u?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?a.jsx("span",{children:c}):l.map(u=>a.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:u},u)),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(ic,{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(mt,{label:"Version",value:e.version,icon:a.jsx(ya,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&a.jsx(mt,{label:"Key Capabilities",value:r(e.capabilities),icon:a.jsx(Ca,{size:14}),fullWidthValue:!0})]}),a.jsx("div",{"data-testid":"clickForDetails",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(mt,{label:"Name",value:e.name,icon:a.jsx(Ni,{size:14})}),a.jsx(mt,{label:"Description",value:e.description,icon:a.jsx(nm,{size:14}),fullWidthValue:!0}),a.jsx(mt,{label:"Version",value:e.version,icon:a.jsx(ya,{size:14})}),a.jsx(mt,{label:"Endpoint",value:e.url||"N/A",icon:a.jsx(ac,{size:14})}),a.jsx(mt,{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(rc,{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(mt,{label:"Name",value:e.provider.organization}),a.jsx(mt,{label:"URL",value:e.provider.url||"N/A"})]}),a.jsx(mt,{label:"Capabilities",value:r(e.capabilities),icon:a.jsx(Ca,{size:14}),fullWidthValue:!0}),a.jsx(mt,{label:"Input Modes",value:o(e.defaultInputModes),icon:a.jsx(Sa,{size:14}),fullWidthValue:!0}),a.jsx(mt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:a.jsx(Sa,{size:14}),fullWidthValue:!0}),a.jsx(mt,{label:"Skills",value:s(e.skills),icon:a.jsx(rm,{size:14}),fullWidthValue:!0}),a.jsx(mt,{label:"Tools Info",value:i(e.tools),icon:a.jsx(sc,{size:14}),fullWidthValue:!0}),a.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:a.jsx(mt,{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"})]})]})})},BC={replace:e=>{e instanceof im.Element&&e.attribs&&e.name==="a"&&(e.attribs.target="_blank",e.attribs.rel="noopener noreferrer")}};function dr({children:e,className:t}){if(!e)return null;try{const n=om.parse(e,{gfm:!0}),r=$f.sanitize(n,{USE_PROFILES:{html:!0}}),o=sm(r,BC);return a.jsx("div",{className:Pa(t),children:o})}catch{return a.jsx("div",{className:Pa(t),children:e})}}const HC={error:"bg-[var(--color-error-w20)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-error-wMain)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-warning-wMain)]",info:"bg-[var(--color-info-w20)] text-[var(--color-info-wMain)] border-[var(--color-info-wMain)] dark:bg-[var(--color-info-w100)]/60 dark:text-[var(--color-white)] dark:border-[var(--color-info-wMain)]",success:"bg-[var(--color-success-w20)] text-[var(--color-success-wMain)] border-[var(--color-success-w40)] dark:bg-[var(--color-success-w100)]/60 dark:text-[var(--color-white)] dark:border-l-[var(--color-success-w70)]"},UC=Mn("flex items-center gap-3 px-4 py-3 text-sm font-medium transition-all border-l-4 border-solid ",{variants:{variant:HC},defaultVariants:{variant:"error"}}),WC={error:Ai,warning:am,info:Ni,success:lc};function Ip({className:e,variant:t="error",message:n,action:r,buttonText:o,dismissible:s=!1,onDismiss:i,...l}){const c=WC[t||"error"];return a.jsxs("div",{className:be(UC({variant:t,className:e}),"items-start"),role:"alert","aria-live":"polite",...l,children:[a.jsx(c,{className:"size-5 shrink-0"}),a.jsx("span",{children:n}),a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r&&o&&a.jsx(me,{variant:"link",className:"h-min p-0 font-normal text-current underline hover:text-current/60 dark:hover:text-white",onClick:r,children:o}),s&&i&&a.jsx(me,{variant:"link",className:"h-min self-center p-0",onClick:i,"aria-label":"Dismiss",children:a.jsx(Go,{className:"size-3"})})]})]})}function VC({width:e=24,height:t=24}){const{currentTheme:n}=us(),r=n==="dark"?"var(--color-background-wMain)":"var(--color-background-w10)",o=n==="dark"?"var(--color-error-w100)":"var(--color-error-w10)";return a.jsxs("svg",{width:e,height:t,focusable:"false","aria-hidden":"true",viewBox:"0 0 131 131",fill:"none",children:[a.jsx("path",{d:"M119.681 63.9952C119.681 94.0948 95.2807 118.495 65.1812 118.495C35.0816 118.495 10.6812 94.0948 10.6812 63.9952C10.6812 33.8957 35.0816 9.49524 65.1812 9.49524C95.2807 9.49524 119.681 33.8957 119.681 63.9952Z",fill:o}),a.jsx("path",{d:"M2.68115 119.495H128.681V120.495H2.68115V119.495Z",fill:"var(--color-secondary-wMain)"}),a.jsx("rect",{x:14,y:34,width:104.054,height:70.6982,rx:1,fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M59.4929 105.314C59.6018 104.866 60.0032 104.55 60.4646 104.55H72.4448C72.9061 104.55 73.3076 104.866 73.4165 105.314L75.1457 112.433C75.2986 113.062 74.8218 113.669 74.174 113.669H58.7354C58.0876 113.669 57.6107 113.062 57.7637 112.433L59.4929 105.314Z",fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M47.7852 114.103C47.7852 113.55 48.2329 113.103 48.7852 113.103H83.2724C83.8247 113.103 84.2724 113.55 84.2724 114.103V118.656C84.2724 119.208 83.8247 119.656 83.2724 119.656H48.7852C48.2329 119.656 47.7852 119.208 47.7852 118.656V114.103Z",fill:r,stroke:"var(--color-secondary-wMain)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M15.1406 95.0068H117.773",stroke:"var(--color-secondary-wMain)",strokeWidth:2}),a.jsxs("g",{clipPath:"url(#clip0_1688:196070)",children:[a.jsx("rect",{opacity:.2,x:54.1126,y:45.1681,width:24.1,height:24.1,stroke:"var(--color-secondary-wMain)",strokeWidth:.1}),a.jsx("path",{d:"M65.6426 60.1142C65.5359 60.1142 65.4453 60.0769 65.3706 60.0022C65.2959 59.9275 65.2586 59.8369 65.2586 59.7302V52.4022C65.2586 52.2955 65.2959 52.2049 65.3706 52.1302C65.4453 52.0555 65.5359 52.0182 65.6426 52.0182H66.9386C67.0559 52.0182 67.1466 52.0555 67.2106 52.1302C67.2853 52.1942 67.3226 52.2849 67.3226 52.4022V59.7302C67.3226 59.8369 67.2853 59.9275 67.2106 60.0022C67.1466 60.0769 67.0559 60.1142 66.9386 60.1142H65.6426ZM65.5466 63.2182C65.4399 63.2182 65.3493 63.1809 65.2746 63.1062C65.1999 63.0315 65.1626 62.9409 65.1626 62.8342V61.3462C65.1626 61.2289 65.1999 61.1329 65.2746 61.0582C65.3493 60.9835 65.4399 60.9462 65.5466 60.9462H67.0346C67.1519 60.9462 67.2479 60.9835 67.3226 61.0582C67.3973 61.1329 67.4346 61.2289 67.4346 61.3462V62.8342C67.4346 62.9409 67.3973 63.0315 67.3226 63.1062C67.2479 63.1809 67.1519 63.2182 67.0346 63.2182H65.5466Z",fill:"var(--color-secondary-wMain)"})]}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3433 73.2659C51.3433 72.9897 51.5671 72.7659 51.8433 72.7659H80.2102C80.4864 72.7659 80.7102 72.9897 80.7102 73.2659C80.7102 73.542 80.4864 73.7659 80.2102 73.7659H51.8433C51.5671 73.7659 51.3433 73.542 51.3433 73.2659Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M55.1851 83.2659C55.1851 82.9897 55.3503 82.7659 55.5542 82.7659H76.4995C76.7034 82.7659 76.8687 82.9897 76.8687 83.2659C76.8687 83.542 76.7034 83.7659 76.4995 83.7659H55.5542C55.3503 83.7659 55.1851 83.542 55.1851 83.2659Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.3433 78.2659C51.3433 77.9897 51.5671 77.7659 51.8433 77.7659H80.2102C80.4864 77.7659 80.7102 77.9897 80.7102 78.2659C80.7102 78.542 80.4864 78.7659 80.2102 78.7659H51.8433C51.5671 78.7659 51.3433 78.542 51.3433 78.2659Z",fill:"var(--color-secondary-wMain)"}),a.jsx("defs",{children:a.jsx("clipPath",{id:"clip0_1688:196070",children:a.jsx("rect",{width:24,height:24,fill:r,transform:"translate(54.1626 45.2181)"})})})]})}function GC({width:e=24,height:t=24}){const{currentTheme:n}=us(),r=n==="dark"?"var(--color-background-wMain)":"var(--color-background-w10)";return a.jsxs("svg",{width:e,height:t,viewBox:"0 0 130 130",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsxs("g",{clipPath:"url(#clip0_483_284)",children:[a.jsx("path",{opacity:.1,d:"M130 61.4874C130 95.4459 102.471 122.975 68.5125 122.975C34.554 122.975 7.02515 95.4459 7.02515 61.4874C7.02515 27.5288 34.554 0 68.5125 0C102.471 0 130 27.5288 130 61.4874Z",fill:"var(--color-info-wMain)"}),a.jsx("path",{d:"M0 25.9979C0 24.1286 1.51535 22.6133 3.38463 22.6133H41.082C49.1822 22.6133 55.7487 29.1798 55.7487 37.28V116.273C55.7487 118.142 54.2333 119.657 52.3641 119.657H3.38463C1.51535 119.657 0 118.142 0 116.273V25.9979Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M41.082 24.8697H3.38463C2.76154 24.8697 2.25642 25.3748 2.25642 25.9979V116.273C2.25642 116.896 2.76153 117.401 3.38463 117.401H52.3641C52.9871 117.401 53.4923 116.896 53.4923 116.273V37.28C53.4923 30.426 47.936 24.8697 41.082 24.8697ZM3.38463 22.6133C1.51535 22.6133 0 24.1286 0 25.9979V116.273C0 118.142 1.51535 119.657 3.38463 119.657H52.3641C54.2333 119.657 55.7487 118.142 55.7487 116.273V37.28C55.7487 29.1798 49.1822 22.6133 41.082 22.6133H3.38463Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M53.0258 112.821H2.25642V116.206C2.25642 116.829 2.76153 117.334 3.38462 117.334H51.8976C52.5207 117.334 53.0258 116.829 53.0258 116.206V112.821ZM0 110.565V116.206C0 118.075 1.51535 119.59 3.38462 119.59H51.8976C53.7669 119.59 55.2822 118.075 55.2822 116.206V110.565H0Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M51.8977 38.3591C51.8977 29.6358 58.9693 22.5642 67.6926 22.5642H107.18C109.049 22.5642 110.564 24.0796 110.564 25.9488V116.206C110.564 118.075 109.049 119.59 107.18 119.59H55.2823C53.413 119.59 51.8977 118.075 51.8977 116.206V38.3591Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M107.18 24.8206H67.6926C60.2155 24.8206 54.1541 30.882 54.1541 38.3591V116.206C54.1541 116.829 54.6592 117.334 55.2823 117.334H107.18C107.803 117.334 108.308 116.829 108.308 116.206V25.9488C108.308 25.3257 107.803 24.8206 107.18 24.8206ZM67.6926 22.5642C58.9693 22.5642 51.8977 29.6358 51.8977 38.3591V116.206C51.8977 118.075 53.413 119.59 55.2823 119.59H107.18C109.049 119.59 110.564 118.075 110.564 116.206V25.9488C110.564 24.0796 109.049 22.5642 107.18 22.5642H67.6926Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M108.308 112.821H54.1541V116.206C54.1541 116.829 54.6592 117.334 55.2823 117.334H107.18C107.803 117.334 108.308 116.829 108.308 116.206V112.821ZM51.8977 110.565V116.206C51.8977 118.075 53.413 119.59 55.2823 119.59H107.18C109.049 119.59 110.564 118.075 110.564 116.206V110.565H51.8977Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M29.0351 36.0336C29.0351 35.722 29.2876 35.4695 29.5992 35.4695H43.0726C43.3842 35.4695 43.6367 35.722 43.6367 36.0336C43.6367 36.3451 43.3842 36.5977 43.0726 36.5977H29.5992C29.2876 36.5977 29.0351 36.3451 29.0351 36.0336ZM29.0351 42.7441C29.0351 42.4325 29.2876 42.1799 29.5992 42.1799H43.0726C43.3842 42.1799 43.6367 42.4325 43.6367 42.7441C43.6367 43.0556 43.3842 43.3082 43.0726 43.3082H29.5992C29.2876 43.3082 29.0351 43.0556 29.0351 42.7441ZM29.0351 49.4545C29.0351 49.143 29.2876 48.8904 29.5992 48.8904H43.0726C43.3842 48.8904 43.6367 49.143 43.6367 49.4545C43.6367 49.7661 43.3842 50.0186 43.0726 50.0186H29.5992C29.2876 50.0186 29.0351 49.7661 29.0351 49.4545ZM9.75977 60.2946C9.75977 59.983 10.0123 59.7305 10.3239 59.7305H23.7973C24.1089 59.7305 24.3614 59.983 24.3614 60.2946C24.3614 60.6061 24.1089 60.8587 23.7973 60.8587H10.3239C10.0123 60.8587 9.75977 60.6061 9.75977 60.2946ZM9.75977 67.0051C9.75977 66.6935 10.0123 66.4409 10.3239 66.4409H23.7973C24.1089 66.4409 24.3614 66.6935 24.3614 67.0051C24.3614 67.3166 24.1089 67.5692 23.7973 67.5692H10.3239C10.0123 67.5692 9.75977 67.3166 9.75977 67.0051ZM9.75977 73.7155C9.75977 73.404 10.0123 73.1514 10.3239 73.1514H23.7973C24.1089 73.1514 24.3614 73.404 24.3614 73.7155C24.3614 74.0271 24.1089 74.2796 23.7973 74.2796H10.3239C10.0123 74.2796 9.75977 74.0271 9.75977 73.7155Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 83.5231C9.75977 83.2116 10.0123 82.959 10.3239 82.959H42.3277C42.6393 82.959 42.8918 83.2116 42.8918 83.5231C42.8918 83.8347 42.6393 84.0872 42.3277 84.0872H10.3239C10.0123 84.0872 9.75977 83.8347 9.75977 83.5231Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 93.8473C9.75977 93.5357 10.0123 93.2832 10.3239 93.2832H42.3277C42.6393 93.2832 42.8918 93.5357 42.8918 93.8473C42.8918 94.1588 42.6393 94.4114 42.3277 94.4114H10.3239C10.0123 94.4114 9.75977 94.1588 9.75977 93.8473Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 88.6852C9.75977 88.3737 10.0123 88.1211 10.3239 88.1211H42.3277C42.6393 88.1211 42.8918 88.3737 42.8918 88.6852C42.8918 88.9967 42.6393 89.2493 42.3277 89.2493H10.3239C10.0123 89.2493 9.75977 88.9967 9.75977 88.6852Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.75977 99.0089C9.75977 98.6974 10.0123 98.4448 10.3239 98.4448H42.3277C42.6393 98.4448 42.8918 98.6974 42.8918 99.0089C42.8918 99.3205 42.6393 99.573 42.3277 99.573H10.3239C10.0123 99.573 9.75977 99.3205 9.75977 99.0089Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M22.9252 42.8986C22.9252 46.6372 19.8945 49.6679 16.156 49.6679C12.4174 49.6679 9.38672 46.6372 9.38672 42.8986C9.38672 39.1601 12.4174 36.1294 16.156 36.1294C19.8945 36.1294 22.9252 39.1601 22.9252 42.8986Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.156 47.4115C18.6483 47.4115 20.6688 45.391 20.6688 42.8986C20.6688 40.4063 18.6483 38.3858 16.156 38.3858C13.6636 38.3858 11.6431 40.4063 11.6431 42.8986C11.6431 45.391 13.6636 47.4115 16.156 47.4115ZM16.156 49.6679C19.8945 49.6679 22.9252 46.6372 22.9252 42.8986C22.9252 39.1601 19.8945 36.1294 16.156 36.1294C12.4174 36.1294 9.38672 39.1601 9.38672 42.8986C9.38672 46.6372 12.4174 49.6679 16.156 49.6679Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M31.5107 63.1795C31.5107 61.9333 32.521 60.9231 33.7672 60.9231H40.5364C41.7826 60.9231 42.7928 61.9334 42.7928 63.1795V68.9231C42.7928 70.1693 41.7826 71.1796 40.5364 71.1796H33.7672C32.521 71.1796 31.5107 70.1693 31.5107 68.9231V63.1795Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40.5364 63.1795H33.7672V68.9231H40.5364V63.1795ZM33.7672 60.9231C32.521 60.9231 31.5107 61.9333 31.5107 63.1795V68.9231C31.5107 70.1693 32.521 71.1796 33.7672 71.1796H40.5364C41.7826 71.1796 42.7928 70.1693 42.7928 68.9231V63.1795C42.7928 61.9334 41.7826 60.9231 40.5364 60.9231H33.7672Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M102.325 102.029C101.702 100.949 102.072 99.5694 103.151 98.9463L107.108 96.6618C108.188 96.0387 109.568 96.4084 110.191 97.4877L123.409 120.382C124.032 121.461 123.662 122.841 122.583 123.464L118.626 125.749C117.547 126.372 116.167 126.002 115.543 124.923L102.325 102.029Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M108.237 98.6159L104.28 100.9L117.498 123.795L121.455 121.51L108.237 98.6159ZM103.151 98.9463C102.072 99.5694 101.702 100.949 102.325 102.029L115.543 124.923C116.167 126.002 117.547 126.372 118.626 125.749L122.583 123.464C123.662 122.841 124.032 121.461 123.409 120.382L110.191 97.4877C109.568 96.4084 108.188 96.0387 107.108 96.6618L103.151 98.9463Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M115.803 66.4824C115.803 82.3642 102.928 95.239 87.0466 95.239C71.1648 95.239 58.29 82.3642 58.29 66.4824C58.29 50.6006 71.1648 37.7258 87.0466 37.7258C102.928 37.7258 115.803 50.6006 115.803 66.4824Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M87.0466 92.9825C101.682 92.9825 113.547 81.118 113.547 66.4824C113.547 51.8468 101.682 39.9822 87.0466 39.9822C72.411 39.9822 60.5465 51.8468 60.5465 66.4824C60.5465 81.118 72.411 92.9825 87.0466 92.9825ZM87.0466 95.239C102.928 95.239 115.803 82.3642 115.803 66.4824C115.803 50.6006 102.928 37.7258 87.0466 37.7258C71.1648 37.7258 58.29 50.6006 58.29 66.4824C58.29 82.3642 71.1648 95.239 87.0466 95.239Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M109.771 66.4825C109.771 79.0329 99.5964 89.2071 87.0459 89.2071C74.4954 89.2071 64.3213 79.0329 64.3213 66.4825C64.3213 53.932 74.4954 43.7578 87.0459 43.7578C99.5964 43.7578 109.771 53.932 109.771 66.4825Z",fill:r}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M87.0459 86.9507C98.3502 86.9507 107.514 77.7868 107.514 66.4825C107.514 55.1782 98.3502 46.0142 87.0459 46.0142C75.7416 46.0142 66.5777 55.1782 66.5777 66.4825C66.5777 77.7868 75.7416 86.9507 87.0459 86.9507ZM87.0459 89.2071C99.5964 89.2071 109.771 79.0329 109.771 66.4825C109.771 53.932 99.5964 43.7578 87.0459 43.7578C74.4954 43.7578 64.3213 53.932 64.3213 66.4825C64.3213 79.0329 74.4954 89.2071 87.0459 89.2071Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M86.4824 49.2829C86.4824 48.9713 86.735 48.7188 87.0465 48.7188C96.8572 48.7188 104.81 56.6717 104.81 66.4823C104.81 66.7939 104.558 67.0465 104.246 67.0465C103.935 67.0465 103.682 66.7939 103.682 66.4823C103.682 57.2948 96.2341 49.847 87.0465 49.847C86.735 49.847 86.4824 49.5944 86.4824 49.2829ZM72.0594 74.9461C72.3254 74.7838 72.6725 74.868 72.8348 75.134C73.8285 76.7627 75.0945 78.2075 76.5695 79.4049C77.4599 80.1277 78.4264 80.7603 79.4549 81.2888C81.7303 82.4579 84.3105 83.1178 87.0465 83.1178C87.3581 83.1178 87.6106 83.3704 87.6106 83.6819C87.6106 83.9935 87.3581 84.2461 87.0465 84.2461C84.127 84.2461 81.3705 83.5413 78.9393 82.2922C77.8408 81.7278 76.8089 81.0524 75.8584 80.2808C74.2841 79.0028 72.9327 77.4606 71.8717 75.7216C71.7094 75.4556 71.7935 75.1084 72.0594 74.9461Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M104.511 99.0423L100.011 91.2478L101.965 90.1196L106.465 97.9141L104.511 99.0423Z",fill:"var(--color-secondary-wMain)"}),a.jsx("path",{d:"M86.2924 72.1957C86.1299 72.1957 85.9945 72.1505 85.8862 72.0603C85.7779 71.952 85.7238 71.8076 85.7238 71.6271C85.7238 71.4465 85.7238 71.266 85.7238 71.0855C85.7238 70.905 85.7238 70.7245 85.7238 70.544C85.7599 69.7678 85.9314 69.0818 86.2382 68.4861C86.5451 67.8904 86.9152 67.3489 87.3484 66.8615C87.7997 66.3741 88.251 65.9138 88.7023 65.4806C89.1535 65.0293 89.5326 64.578 89.8395 64.1267C90.1644 63.6754 90.363 63.1971 90.4352 62.6916C90.5074 62.0418 90.381 61.5003 90.0561 61.067C89.7312 60.6157 89.2889 60.2728 88.7293 60.0381C88.1697 59.8034 87.5921 59.6861 86.9964 59.6861C86.0397 59.6861 85.2183 59.9388 84.5324 60.4442C83.8645 60.9316 83.4222 61.762 83.2056 62.9353C83.1515 63.1519 83.0612 63.3054 82.9348 63.3956C82.8085 63.4859 82.6641 63.531 82.5016 63.531H81.2019C81.0395 63.531 80.895 63.4769 80.7687 63.3686C80.6604 63.2603 80.6062 63.1158 80.6062 62.9353C80.6243 62.1952 80.7867 61.4912 81.0936 60.8233C81.4005 60.1554 81.8337 59.5688 82.3933 59.0633C82.9709 58.5579 83.6479 58.1608 84.4241 57.8719C85.2183 57.5651 86.1029 57.4116 87.0776 57.4116C88.1788 57.4116 89.1174 57.5651 89.8936 57.8719C90.6879 58.1608 91.3197 58.5579 91.789 59.0633C92.2764 59.5507 92.6284 60.0922 92.845 60.6879C93.0616 61.2836 93.1519 61.8793 93.1158 62.475C93.0617 63.1971 92.8811 63.8469 92.5743 64.4246C92.2674 64.9842 91.8973 65.5076 91.4641 65.995C91.0309 66.4644 90.5886 66.9337 90.1373 67.403C89.7041 67.8543 89.325 68.3327 89.0001 68.8381C88.6932 69.3255 88.5217 69.858 88.4856 70.4357C88.4676 70.6342 88.4495 70.8328 88.4315 71.0314C88.4315 71.2119 88.4315 71.3924 88.4315 71.5729C88.3954 71.7715 88.3232 71.9249 88.2149 72.0332C88.1066 72.1415 87.9531 72.1957 87.7546 72.1957H86.2924ZM86.0758 76.6363C85.8953 76.6363 85.7418 76.5821 85.6155 76.4738C85.5072 76.3475 85.453 76.194 85.453 76.0135V74.3618C85.453 74.1813 85.5072 74.0369 85.6155 73.9286C85.7418 73.8022 85.8953 73.7391 86.0758 73.7391H87.8358C88.0344 73.7391 88.1878 73.8022 88.2961 73.9286C88.4225 74.0369 88.4856 74.1813 88.4856 74.3618V76.0135C88.4856 76.194 88.4225 76.3475 88.2961 76.4738C88.1878 76.5821 88.0344 76.6363 87.8358 76.6363H86.0758Z",fill:"var(--color-secondary-wMain)"})]}),a.jsx("defs",{children:a.jsx("clipPath",{id:"clip0_483_284",children:a.jsx("rect",{width:130,height:130,fill:r})})})]})}function Yr({title:e,subtitle:t,image:n,variant:r="error",buttons:o,className:s}){const i={error:a.jsx(VC,{width:150,height:150}),notFound:a.jsx(GC,{width:150,height:150}),loading:a.jsx(ca,{size:"large"}),noImage:null};return a.jsxs("div",{className:be("flex h-full w-full flex-col items-center justify-center gap-3",s),children:[n||i[r]||null,a.jsx("p",{className:"mt-4 text-lg",children:e}),t?a.jsx("p",{className:"text-sm",children:t}):null,a.jsx("div",{className:"flex gap-2",children:o&&o.map(({text:l,variant:c,onClick:u},f)=>a.jsx(me,{testid:l,title:l,variant:c,onClick:u,children:l},`button-${l}-${f}`))})]})}const xi=({agents:e})=>{const[t,n]=d.useState(null),[r,o]=d.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(a.Fragment,{children:e.length===0?a.jsx(Yr,{variant:"noImage",title:"No agents found",subtitle:"No agents discovered in the current namespace."}):a.jsxs("div",{className:"h-full w-full pt-12 pl-12",children:[a.jsx("input",{type:"text","data-testid":"agentSearchInput",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background mb-4 rounded-md border px-3 py-2"}),i.length===0&&r?a.jsx(Yr,{title:"No agents match your search",variant:"noImage",buttons:[{text:"Clear Search",variant:"default",onClick:()=>o("")}]}):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(zC,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>s(l.name)},l.name))})})]})})},YC=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=jp.getPluginsByType(_p.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(me,{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};class KC{constructor(){wa(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:_p.LAYOUT,id:"cards",label:"Cards",icon:lm,priority:100,render:t=>a.jsx(xi,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const jp=new KC;let yo=null,Co=null;function qC({children:e}){const{fetchCsrfToken:t}=dd(),[n,r]=d.useState(yo),[o,s]=d.useState(!yo&&!Co),[i,l]=d.useState(Co);return d.useEffect(()=>{if(yo||Co)return;let c=!0;return(async()=>{s(!0),l(null);try{let f=await Fe("/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 Fe("/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??!1};c&&(yo=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.";Co=p,l(p)}}finally{c&&s(!1)}})(),()=>{c=!1}},[t]),n?a.jsx(id.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(Yr,{className:"h-screen w-screen",variant:"error",title:"Configuration Error",subtitle:"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 XC=({children:e})=>{const{configServerUrl:t}=Zt(),n=`${t}/api/v1`,[r,o]=d.useState(null),[s,i]=d.useState(!1),[l,c]=d.useState(!1),[u,f]=d.useState(null),[p,m]=d.useState({}),[g,x]=d.useState([]),[h,v]=d.useState(null),[w,b]=d.useState(0),[y,S]=d.useState(!1),N=10,j=d.useRef(null),k=d.useRef(null),A=d.useRef(null);d.useEffect(()=>{k.current=r},[r]);const G=d.useCallback(E=>{m(T=>{var L,U,Y;const M=E.task_id;if(!M)return E.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",E),T;const F=T[M],ee=new Date(E.timestamp);if(F){const J=[...F.events,E].sort((I,X)=>new Date(I.timestamp).getTime()-new Date(X.timestamp).getTime());return{...T,[M]:{...F,events:J,lastUpdated:ee}}}else{let J="Task started...";if(E.direction==="request"&&((U=(L=E.full_payload)==null?void 0:L.method)!=null&&U.startsWith("message/"))){const X=E.full_payload.params;if((Y=X==null?void 0:X.message)!=null&&Y.parts){const re=X.message.parts.filter(ne=>ne.kind==="text"&&ne.text);re.length>0&&(J=re[re.length-1].text)}}const I={taskId:M,initialRequestText:J,events:[E],firstSeen:ee,lastUpdated:ee};return x(X=>[M,...X.filter(re=>re!==M)]),{...T,[M]:I}}})},[]),Q=d.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),f(null),b(0),S(!1),A.current&&(clearTimeout(A.current),A.current=null)},[]),O=d.useCallback(E=>{try{const T=JSON.parse(E.data);G(T)}catch(T){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",T,"Raw data:",E.data),f("Received unparseable 'a2a_message' event from server.")}},[G]),P=d.useCallback(E=>{console.error("TaskMonitorContext: SSE connection error:",E),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),A.current&&(clearTimeout(A.current),A.current=null)},[]),K=d.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 E={subscription_targets:[{type:"my_a2a_messages"}]},T=await Fe(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E),credentials:"include"});if(!T.ok){const Y=await T.json().catch(()=>({detail:"Failed to subscribe"}));if(Y.error_type==="authorization_failure"){const J=Y.message||"Access denied: insufficient permissions",I=Y.suggested_action?` ${Y.suggested_action}`:"";throw new Error(`${J}${I}`)}else if(Y.error_type==="subscription_failure"){const J=Y.message||"Subscription failed",I=Y.suggested_action?` ${Y.suggested_action}`:"";throw new Error(`${J}${I}`)}else throw new Error(Y.detail||Y.message||`Subscription failed: ${T.statusText}`)}const M=await T.json();o(M.stream_id);const F=M.sse_endpoint_url.startsWith("/")?`${t||""}${M.sse_endpoint_url}`:M.sse_endpoint_url;j.current&&j.current.close();const ee=_i(),L=`${F}${ee?`?token=${ee}`:""}`,U=new EventSource(L,{withCredentials:!0});j.current=U,U.onopen=Q,U.addEventListener("a2a_message",O),U.onerror=P}catch(E){console.error("TaskMonitorContext: Error connecting stream:",E),f(E instanceof Error?E.message:String(E)),i(!1),c(!1),o(null),j.current&&(j.current.close(),j.current=null),A.current&&(clearTimeout(A.current),A.current=null)}},[n,t,l,s,Q,O,P]),W=d.useCallback(()=>{if(A.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(w>=N){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),S(!1),f(`Connection lost. Max reconnection attempts (${N}) reached.`);return}const E=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${w+1}/${N} in ${E}ms...`),S(!0),b(T=>T+1),A.current=setTimeout(()=>{K()},E)},[w,K]),z=d.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),A.current&&(clearTimeout(A.current),A.current=null),j.current&&(j.current.close(),j.current=null);const E=k.current;if(E)try{await Fe(`${n}/visualization/${E}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(T){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${E}`,T)}o(null),i(!1),c(!1),f(null),m({}),x([]),v(null),b(0),S(!1)},[n]);d.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),j.current&&(j.current.close(),j.current=null);const E=k.current;if(E)if(navigator.sendBeacon){const T=new FormData;navigator.sendBeacon(`${n}/visualization/${E}/unsubscribe`,T)}else Fe(`${n}/visualization/${E}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(T=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",T))},[n]),d.useEffect(()=>{!l&&!s&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),K())},[]),d.useEffect(()=>{!l&&!s&&u&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),W())},[l,s,u,W]),d.useEffect(()=>()=>{A.current&&(clearTimeout(A.current),A.current=null)},[]);const _=d.useCallback(E=>{v(E)},[]),q={isTaskMonitorConnecting:s,isTaskMonitorConnected:l,taskMonitorSseError:u,monitoredTasks:p,monitoredTaskOrder:g,highlightedStepId:h,isReconnecting:y,reconnectionAttempts:w,connectTaskMonitorStream:K,disconnectTaskMonitorStream:z,setHighlightedStepId:_};return a.jsx(ld.Provider,{value:q,children:e})},nt=[];for(let e=0;e<256;++e)nt.push((e+256).toString(16).slice(1));function ZC(e,t=0){return(nt[e[t+0]]+nt[e[t+1]]+nt[e[t+2]]+nt[e[t+3]]+"-"+nt[e[t+4]]+nt[e[t+5]]+"-"+nt[e[t+6]]+nt[e[t+7]]+"-"+nt[e[t+8]]+nt[e[t+9]]+"-"+nt[e[t+10]]+nt[e[t+11]]+nt[e[t+12]]+nt[e[t+13]]+nt[e[t+14]]+nt[e[t+15]]).toLowerCase()}let Vs;const JC=new Uint8Array(16);function QC(){if(!Vs){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Vs=crypto.getRandomValues.bind(crypto)}return Vs(JC)}const e2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Hl={randomUUID:e2};function t2(e,t,n){var o;e=e||{};const r=e.random??((o=e.rng)==null?void 0:o.call(e))??QC();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,ZC(r)}function Wt(e,t,n){return Hl.randomUUID&&!e?Hl.randomUUID():t2(e)}const So=1,n2=e=>({...e,taskMetadata:{...e.taskMetadata,schema_version:1}}),r2={0:n2},Ul=1*1024*1024,Wl=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result.split(",")[1]),r.onerror=o=>n(o)}),o2=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n,persistenceEnabled:r,configCollectFeedback:o}=Zt(),s=d.useMemo(()=>`${n}/api/v1`,[n]),[i,l]=d.useState(""),[c,u]=d.useState([]),[f,p]=d.useState(!1),[m,g]=d.useState([]),[x,h]=d.useState(null),v=d.useRef(null),[w,b]=d.useState(""),[y,S]=d.useState(!1),[N,j]=d.useState(null),k=d.useRef(null),A=d.useRef(!1),G=d.useRef(null),Q=d.useRef(0),O=d.useRef(y),P=d.useRef(new Set);d.useEffect(()=>{O.current=y},[y]);const{agents:K,error:W,isLoading:z,refetch:_}=ud(),{artifacts:q,isLoading:E,refetch:T}=Fv(i),[M,F]=d.useState(!0),[ee,L]=d.useState("files"),[U,Y]=d.useState(!1),[J,I]=d.useState(null),[X,re]=d.useState(!1),[ne,ue]=d.useState(new Set),[ae,fe]=d.useState(!1),[ye,Le]=d.useState(null),[Pe,$e]=d.useState(null),[Oe,Ue]=d.useState(null),[Mt,Ye]=d.useState(null),[Rt,it]=d.useState(null),[at,lt]=d.useState(null),[wt,zt]=d.useState({}),ce=d.useCallback((D,B)=>{g($=>{if($.find(C=>C.message===D))return $;const oe=Date.now().toString(),V={id:oe,message:D,type:B||"info"};return setTimeout(()=>{g(C=>C.filter(R=>R.id!==oe))},3e3),[...$,V]})},[]),Ct=d.useCallback(D=>{var H,oe,V;const B=(H=D.parts)==null?void 0:H.filter(C=>C.kind==="text"),$=(B==null?void 0:B.map(C=>C.text).join(""))||"";return{id:((oe=D.metadata)==null?void 0:oe.messageId)||`msg-${Wt()}`,type:D.isUser?"user":D.artifactNotification?"artifact_notification":"agent",text:$,parts:D.parts,files:D.files,uploadedFiles:(V=D.uploadedFiles)==null?void 0:V.map(C=>({name:C.name,type:C.type})),artifactNotification:D.artifactNotification,isError:D.isError}},[]),bt=d.useCallback(async D=>{if(!(!r||!i)&&!P.current.has(D.task_id)){P.current.add(D.task_id);try{const B=await Fe(`${s}/sessions/${i}/chat-tasks`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:D.task_id,userMessage:D.user_message,messageBubbles:JSON.stringify(D.message_bubbles),taskMetadata:D.task_metadata?JSON.stringify(D.task_metadata):null})});if(!B.ok){const $=await B.json().catch(()=>({detail:"Failed to save task"}));throw new Error($.detail||`HTTP error ${B.status}`)}}catch(B){console.error(`Error saving task ${D.task_id}:`,B)}finally{setTimeout(()=>{P.current.delete(D.task_id)},100)}}},[s,i,r]),Bt=d.useCallback(D=>D.messageBubbles.map(B=>({taskId:D.taskId,role:B.type==="user"?"user":"agent",parts:B.parts||[{kind:"text",text:B.text||""}],isUser:B.type==="user",isComplete:!0,files:B.files,uploadedFiles:void 0,artifactNotification:B.artifactNotification,isError:B.isError,metadata:{messageId:B.id,sessionId:i,lastProcessedEventSequence:0}})),[i]),St=d.useCallback(D=>{var H;const B=((H=D.taskMetadata)==null?void 0:H.schema_version)||0;if(B>=So)return D;let $=D;for(let oe=B;oe<So;oe++){const V=r2[oe];V?($=V($),console.log(`Migrated task ${D.taskId} from v${oe} to v${oe+1}`)):console.warn(`No migration function found for version ${oe}`)}return $},[]),Et=d.useCallback(async D=>{var B,$;try{const H=await Fe(`${s}/sessions/${D}/chat-tasks`);if(!H.ok){const pe=await H.json().catch(()=>({detail:"Failed to load session tasks"}));throw new Error(pe.detail||`HTTP error ${H.status}`)}const R=((await H.json()).tasks||[]).map(pe=>({...pe,messageBubbles:JSON.parse(pe.messageBubbles),taskMetadata:pe.taskMetadata?JSON.parse(pe.taskMetadata):null})).map(St),Z=[];for(const pe of R){const Ae=Bt(pe);Z.push(...Ae)}const le={};for(const pe of R)(B=pe.taskMetadata)!=null&&B.feedback&&(le[pe.taskId]={type:pe.taskMetadata.feedback.type,text:pe.taskMetadata.feedback.text||""});let ve=null;for(let pe=R.length-1;pe>=0;pe--)if(($=R[pe].taskMetadata)!=null&&$.agent_name){ve=R[pe].taskMetadata.agent_name;break}u(Z),zt(le),ve&&b(ve)}catch(H){throw console.error("Error loading session tasks:",H),ce("Error loading session history. Please try again.","error"),H}},[s,Bt,ce,St]),Ke=d.useCallback(async(D,B)=>{const $=B||i,H=new FormData;H.append("upload_file",D),H.append("filename",D.name),$&&H.append("sessionId",$);try{const oe=await Fe(`${s}/artifacts/upload`,{method:"POST",body:H,credentials:"include"});if(!oe.ok){const R=await oe.json().catch(()=>({detail:`Failed to upload ${D.name}`}));throw new Error(R.detail||`HTTP error ${oe.status}`)}const V=await oe.json(),C=V.data||V;return ce(`Artifact "${D.name}" uploaded successfully.`),await T(),{uri:C.uri,sessionId:C.sessionId}}catch(oe){return ce(`Error uploading artifact "${D.name}": ${oe instanceof Error?oe.message:"Unknown error"}`),null}},[s,i,ce,T]),ft=d.useCallback(async D=>{try{const B=await Fe(`${s}/artifacts/${i}/${encodeURIComponent(D)}`,{method:"DELETE",credentials:"include"});if(!B.ok&&B.status!==204){const $=await B.json().catch(()=>({detail:`Failed to delete ${D}`}));throw new Error($.detail||`HTTP error ${B.status}`)}ce(`File "${D}" deleted successfully.`),T()}catch(B){ce(`Error deleting file "${D}": ${B instanceof Error?B.message:"Unknown error"}`)}},[s,i,ce,T]),Ht=d.useCallback(D=>{I(D),Y(!0)},[]),Tt=d.useCallback(()=>{I(null),Y(!1)},[]),un=d.useCallback(async()=>{J&&await ft(J.filename),Tt()},[J,ft,Tt]),Lt=d.useCallback(()=>{if(ne.size===0){ce("No files selected for deletion.");return}fe(!0)},[ne,ce]),Pt=d.useCallback(async()=>{fe(!1);const D=Array.from(ne);let B=0,$=0;for(const H of D)try{const oe=await Fe(`${s}/artifacts/${i}/${encodeURIComponent(H)}`,{method:"DELETE",credentials:"include"});if(!oe.ok&&oe.status!==204)throw new Error(`Failed to delete ${H}`);B++}catch(oe){console.error(oe),$++}B>0&&ce(`${B} files(s) deleted successfully.`),$>0&&ce(`Failed to delete ${$} files(s).`),T(),ue(new Set),re(!1)},[ne,ce,T,s,i]),dn=d.useCallback(async D=>{$e(null),Ue(null),Ye(null);try{const B=await Fe(`${s}/artifacts/${i}/${encodeURIComponent(D)}/versions`,{credentials:"include"});if(!B.ok)throw new Error("Error fetching version list");const $=await B.json();if(!$||$.length===0)throw new Error("No versions available");$e($.sort((le,ve)=>le-ve));const H=Math.max(...$);Ue(H);const oe=await Fe(`${s}/artifacts/${i}/${encodeURIComponent(D)}/versions/${H}`,{credentials:"include"});if(!oe.ok)throw new Error("Error fetching latest version content");const V=await oe.blob(),C=await new Promise((le,ve)=>{const pe=new FileReader;pe.onloadend=()=>{var Ae;return le(((Ae=pe.result)==null?void 0:Ae.toString().split(",")[1])||"")},pe.onerror=ve,pe.readAsDataURL(V)}),R=q.find(le=>le.filename===D),Z={name:D,mime_type:(R==null?void 0:R.mime_type)||"application/octet-stream",content:C,last_modified:(R==null?void 0:R.last_modified)||new Date().toISOString()};return Ye(Z),Z}catch(B){return ce(`Error loading preview for ${D}: ${B instanceof Error?B.message:"Unknown error"}`),null}},[s,i,q,ce]),kt=d.useCallback(async(D,B)=>{if(!Pe||!Pe.includes(B))return ce(`Version ${B} is not available for ${D}.`),null;Ye(null);try{const $=await Fe(`${s}/artifacts/${i}/${encodeURIComponent(D)}/versions/${B}`,{credentials:"include"});if(!$.ok)throw new Error(`Error fetching version ${B}`);const H=await $.blob(),oe=await new Promise((R,Z)=>{const le=new FileReader;le.onloadend=()=>{var ve;return R(((ve=le.result)==null?void 0:ve.toString().split(",")[1])||"")},le.onerror=Z,le.readAsDataURL(H)}),V=q.find(R=>R.filename===D),C={name:D,mime_type:(V==null?void 0:V.mime_type)||"application/octet-stream",content:oe,last_modified:(V==null?void 0:V.last_modified)||new Date().toISOString()};return Ue(B),Ye(C),C}catch($){return ce(`Error loading version ${B}: ${$ instanceof Error?$.message:"Unknown error"}`),null}},[s,ce,q,Pe,i]),fn=d.useCallback(D=>{ce(`Loading preview for attached file: ${D.name}`),Ye(D),$e(null),Ue(null)},[ce]),pn=d.useCallback(D=>{F(!1),L(D),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:D}}))},[]),Ce=d.useCallback(()=>{k.current&&(clearTimeout(k.current),k.current=null),v.current&&(v.current.close(),v.current=null),A.current=!1},[]),We=d.useCallback(D=>{var pe;Q.current+=1;const B=Q.current;let $;try{$=JSON.parse(D.data)}catch(Ae){console.error("Failed to parse SSE message:",Ae),ce("Received unparseable agent update.","error");return}if("error"in $&&$.error){const te=`Error: ${$.error.message}`;u(he=>{const Re=he.filter(we=>!we.isStatusBubble);return Re.push({role:"agent",parts:[{kind:"text",text:te}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${Wt()}`,lastProcessedEventSequence:B}}),Re}),p(!1),Ce(),h(null);return}if(!("result"in $)||!$.result){console.warn("Received SSE message without a result or error field.",$);return}const H=$.result;let oe=!1,V,C,R;switch(H.kind){case"task":oe=!0,V=void 0,R=H.id,H.artifacts&&H.artifacts.length>0&&console.log("Final task has artifacts to process:",H.artifacts);break;case"status-update":oe=H.final,V=(pe=H.status)==null?void 0:pe.message,R=H.taskId;break;case"artifact-update":C=H.artifact,R=H.taskId;break;default:console.warn("Received unknown result kind in SSE message:",H);return}const Z=[],le=[];let ve=null;if(V!=null&&V.parts)for(const Ae of V.parts)if(Ae.kind==="data"){const te=Ae.data;if(te&&typeof te=="object"&&"type"in te)switch(te.type){case"agent_progress_update":ve=String((te==null?void 0:te.status_text)??"Processing...");break;case"artifact_creation_progress":ve=`Saving artifact: ${String((te==null?void 0:te.filename)??"unknown file")} (${Number((te==null?void 0:te.bytes_saved)??0)} bytes)`;break;case"tool_invocation_start":break;case"authentication_required":{const he=te==null?void 0:te.auth_uri,Re=typeof(te==null?void 0:te.target_agent)=="string"?te.target_agent:"Agent",we=typeof(te==null?void 0:te.gateway_task_id)=="string"?te.gateway_task_id:void 0;if(typeof he=="string"&&he.startsWith("http")){const Xe={role:"agent",parts:[{kind:"text",text:""}],authenticationLink:{url:he,text:"Click to Authenticate",targetAgent:Re,gatewayTaskId:we},isUser:!1,isComplete:!0,metadata:{messageId:`auth-${Wt()}`}};u(xe=>[...xe,Xe])}break}default:Z.push(Ae)}}else if(Ae.kind==="file"){const he=Ae.file,Re={name:he.name||"untitled_file",mime_type:he.mimeType};"bytes"in he&&he.bytes?Re.content=he.bytes:"uri"in he&&he.uri&&(Re.uri=he.uri),le.push(Re)}else Z.push(Ae);ve&&(G.current=ve),u(Ae=>{var Xe;const te=[...Ae];let he=te[te.length-1];he!=null&&he.isStatusBubble&&(te.pop(),he=te[te.length-1]);const Re=Z.find(xe=>xe.kind==="text"),we=Z.filter(xe=>xe.kind!=="text");if(he&&!he.isUser&&!he.isComplete&&he.taskId===H.taskId&&(Re||le.length>0)){const xe={...he,parts:[...he.parts],files:he.files?[...he.files]:[],isComplete:oe||le.length>0,metadata:{...he.metadata,lastProcessedEventSequence:B}};if(Re){const Ee=xe.parts[xe.parts.length-1];(Ee==null?void 0:Ee.kind)==="text"?xe.parts[xe.parts.length-1]={...Ee,text:Ee.text+Re.text}:xe.parts.push(Re)}we.length>0&&xe.parts.push(...we),le.length>0&&xe.files.push(...le),te[te.length-1]=xe}else if(Z.some(Ee=>Ee.kind==="text"&&Ee.text.trim())||le.length>0||C){const Ee={role:"agent",parts:Z,files:le.length>0?le:void 0,taskId:H.taskId,isUser:!1,isComplete:oe||le.length>0,metadata:{messageId:((Xe=$.id)==null?void 0:Xe.toString())||`msg-${Wt()}`,sessionId:H.contextId,lastProcessedEventSequence:B}};C&&(Ee.artifactNotification={name:C.name||C.artifactId}),te.push(Ee)}if(!oe&&G.current)te.push({role:"agent",parts:[{kind:"text",text:G.current}],taskId:H.taskId,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{messageId:`status-${Wt()}`,lastProcessedEventSequence:B}});else if(oe){G.current=null;const xe=te.findLastIndex(Ee=>!Ee.isUser&&Ee.taskId===R);xe!==-1&&(te[xe]={...te[xe],isComplete:!0,metadata:{...te[xe].metadata,lastProcessedEventSequence:B}})}return te}),oe&&(O.current&&(ce("Task successfully cancelled."),k.current&&clearTimeout(k.current),S(!1)),R&&i&&u(Ae=>{var he;const te=Ae.filter(Re=>Re.taskId===R&&!Re.isStatusBubble);if(te.length>0){const Re=te.map(Ct),we=te.find(De=>De.isUser),Xe=((he=we==null?void 0:we.parts)==null?void 0:he.filter(De=>De.kind==="text").map(De=>De.text).join(""))||"",Ee=te.some(De=>De.isError)?"error":"completed";bt({task_id:R,user_message:Xe,message_bubbles:Re,task_metadata:{schema_version:So,status:Ee,agent_name:w}})}return Ae}),p(!1),Ce(),h(null),A.current=!0,T(),setTimeout(()=>{A.current=!1},100))},[ce,Ce,T,i,w,bt,Ct]),Ut=d.useCallback(async()=>{const D="ChatProvider.handleNewSession:";if(console.log(`${D} Starting new session process...`),Ce(),f&&x&&w&&!y){console.log(`${D} Cancelling current task ${x}`);try{const B={jsonrpc:"2.0",id:`req-${Wt()}`,method:"tasks/cancel",params:{id:x}};Fe(`${s}/tasks/${x}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B),credentials:"include"})}catch(B){console.warn(`${D} Failed to cancel current task:`,B)}}k.current&&(clearTimeout(k.current),k.current=null),S(!1),console.log(`${D} Resetting session state - new session will be created when first message is sent`),l(""),it(null),b(""),u([]),p(!1),h(null),j(null),Le(null),A.current=!1,G.current=null,Q.current=0,console.log(`${D} Refreshing artifacts for new session...`),await T(),ce("New session started successfully."),console.log(`${D} New session setup complete - session will be created on first message.`)},[s,f,x,w,y,ce,T,Ce]),Jt=d.useCallback(async D=>{var $;const B="ChatProvider.handleSwitchSession:";if(console.log(`${B} Switching to session ${D}...`),Ce(),f&&x&&w&&!y){console.log(`${B} Cancelling current task ${x}`);try{const H={jsonrpc:"2.0",id:`req-${Wt()}`,method:"tasks/cancel",params:{id:x}};await Fe(`${s}/tasks/${x}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),credentials:"include"})}catch(H){console.warn(`${B} Failed to cancel current task:`,H)}}k.current&&(clearTimeout(k.current),k.current=null),S(!1);try{await Et(D);const H=await Fe(`${s}/sessions/${D}`);if(H.ok){const oe=await H.json();it((($=oe==null?void 0:oe.data)==null?void 0:$.name)??"N/A")}l(D),p(!1),h(null),j(null),Le(null),A.current=!1,G.current=null,Q.current=0}catch(H){console.error(`${B} Failed to fetch session history:`,H),ce("Error switching session. Please try again.","error")}},[Ce,f,x,w,y,s,ce,Et]),At=d.useCallback(async(D,B,$=!0)=>{if(r)try{const H=await Fe(`${s}/sessions/${D}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})});if(!H.ok){const oe=await H.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(oe.detail||`HTTP error ${H.status}`)}$&&ce("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(H){ce(`Error updating session name: ${H instanceof Error?H.message:"Unknown error"}`)}},[s,r,ce]),Dt=d.useCallback(async D=>{try{const B=await Fe(`${s}/sessions/${D}`,{method:"DELETE"});if(!B.ok){const $=await B.json().catch(()=>({detail:"Failed to delete session"}));throw new Error($.detail||`HTTP error ${B.status}`)}ce("Session deleted successfully."),D===i&&Ut(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(B){ce(`Error deleting session: ${B instanceof Error?B.message:"Unknown error"}`)}},[s,ce,Ut,i]),Qt=d.useCallback(D=>{lt(D)},[]),Se=d.useCallback(()=>{lt(null)},[]),ke=d.useCallback(async()=>{at&&(await Dt(at.id),lt(null))},[at,Dt]),Me=d.useCallback(async()=>{if(!f&&!y||!x){ce("No active task to cancel.");return}if(y){ce("Cancellation already in progress.");return}ce(`Requesting cancellation for task ${x}...`),S(!0);try{const D={jsonrpc:"2.0",id:`req-${Wt()}`,method:"tasks/cancel",params:{id:x}},B=await Fe(`${s}/tasks/${x}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)});if(B.status===202)k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{ce(`Cancellation for task ${x} timed out. Allowing new input.`),S(!1),p(!1),Ce(),h(null),k.current=null,u($=>$.filter(H=>!H.isStatusBubble))},15e3);else{const $=await B.json().catch(()=>({detail:"Unknown cancellation error"}));ce(`Failed to request cancellation: ${$.detail||B.statusText}`),S(!1)}}catch(D){ce(`Error sending cancellation request: ${D instanceof Error?D.message:"Network error"}`),S(!1)}},[f,y,x,s,ce,Ce]),_e=d.useCallback(async(D,B,$)=>{if(!i){console.error("Cannot submit feedback without a session ID.");return}try{await Hm({taskId:D,sessionId:i,feedbackType:B,feedbackText:$}),zt(H=>({...H,[D]:{type:B,text:$}}))}catch(H){throw console.error("Failed to submit feedback:",H),ce("Failed to submit feedback. Please try again.","error"),H}},[i,ce]),Je=d.useCallback(()=>{},[]),qe=d.useCallback(()=>{f&&!A.current&&!O.current&&ce("Connection error with agent updates."),A.current||(p(!1),O.current||(Ce(),h(null)),G.current=null),u(D=>D.filter(B=>!B.isStatusBubble).map((B,$,H)=>$===H.length-1&&!B.isUser?{...B,isComplete:!0}:B))},[ce,Ce,f]),Ge=d.useCallback(async(D,B,$)=>{D.preventDefault();const H=($==null?void 0:$.trim())||"",oe=B||[];if(!H&&oe.length===0||f||y||!w){w||ce("Please select an agent first."),y&&ce("Cannot send new message while a task is being cancelled.");return}Ce(),A.current=!1,p(!0),h(null),G.current=null,Q.current=0;const V=!i;let C=i||void 0;const R={role:"user",parts:[{kind:"text",text:H}],isUser:!0,uploadedFiles:oe.length>0?oe:void 0,metadata:{messageId:`msg-${Wt()}`,sessionId:C,lastProcessedEventSequence:0}};G.current="Thinking",u(le=>[...le,R]);const Z=[];try{const le=[];if(V)for(const xe of oe)if(xe.size<Ul){const Ee=await Wl(xe);le.push({kind:"file",file:{bytes:Ee,name:xe.name,mimeType:xe.type}})}else{const Ee=await Ke(xe,C);Ee?(!C&&Ee.sessionId&&(C=Ee.sessionId,console.log(`Session created via artifact upload: ${C}`)),le.push({kind:"file",file:{uri:Ee.uri,name:xe.name,mimeType:xe.type}})):(Z.push(`Failed to upload large file: ${xe.name}`),ce(`Failed to upload large file: ${xe.name}`,"error"))}else{const xe=oe.map(async De=>{if(De.size<Ul)return{kind:"file",file:{bytes:await Wl(De),name:De.name,mimeType:De.type}};{const mn=await Ke(De,C);return mn?{kind:"file",file:{uri:mn.uri,name:De.name,mimeType:De.type}}:(Z.push(`Failed to upload large file: ${De.name}`),ce(`Failed to upload large file: ${De.name}`,"error"),null)}}),Ee=await Promise.all(xe);le.push(...Ee.filter(De=>De!==null))}V&&C&&C!==i&&(l(C),console.log(`Session created via artifact upload: ${C}`));const ve=[];if(H&&ve.push({kind:"text",text:H}),Z.length>0&&ve.push({kind:"text",text:`
|
|
330
|
-
Note: Some files failed to upload:
|
|
331
|
-
- ${Z.join(`
|
|
332
|
-
- `)}`}),ve.push(...le),ve.length===0)throw new Error("Cannot send an empty message.");const pe={role:"user",parts:ve,messageId:`msg-${Wt()}`,kind:"message",contextId:C,metadata:{agent_name:w}},Ae={jsonrpc:"2.0",id:`req-${Wt()}`,method:"message/stream",params:{message:pe}},te=await Fe(`${s}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ae)});if(!te.ok){const xe=await te.json().catch(()=>({detail:"Unknown error"}));throw new Error(xe.detail||`HTTP error ${te.status}`)}const he=await te.json(),Re=he==null?void 0:he.result,we=Re==null?void 0:Re.id,Xe=Re==null?void 0:Re.contextId;if(!we)throw new Error("Backend did not return a valid taskId.");if(Xe&&Xe!==C&&(C?console.warn(`Backend returned a different session ID (${Xe}) than expected (${C}). Updating to: ${Xe}`):console.log(`Backend created new session: ${Xe}`),l(Xe),C=Xe),C&&await bt({task_id:we,user_message:H,message_bubbles:[Ct(R)],task_metadata:{schema_version:So,status:"pending",agent_name:w}}),V&&Xe){const Ee=R.parts.filter(De=>De.kind==="text").map(De=>De.text).join(" ").trim();if(Ee){const De=Ee.length>100?`${Ee.substring(0,100)}...`:Ee;it(De),At(Xe,De,!1)}typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}h(we),j(we),u(xe=>xe.map(Ee=>{var De,mn;return((De=Ee.metadata)==null?void 0:De.messageId)===((mn=R.metadata)==null?void 0:mn.messageId)?{...Ee,taskId:we}:Ee}))}catch(le){ce(`Error: ${le instanceof Error?le.message:"Unknown error"}`),p(!1),u(ve=>ve.filter(pe=>!pe.isStatusBubble)),h(null),A.current=!1,G.current=null}},[i,f,y,w,Ce,ce,s,Ke,At,bt,Ct]);d.useEffect(()=>{if(!w&&K.length>0&&c.length===0){const D=K.find($=>$.name==="OrchestratorAgent")??K[0];b(D.name);const B=t||`Hi! I'm the ${D==null?void 0:D.displayName}. How can I help?`;u([{parts:[{kind:"text",text:B}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}])}},[K,t,c.length,w,i]),d.useEffect(()=>{if(x&&s){console.log(`ChatProvider Effect: currentTaskId is ${x}. Setting up EventSource.`);const D=_i(),B=`${s}/sse/subscribe/${x}${D?`?token=${D}`:""}`,$=new EventSource(B,{withCredentials:!0});return v.current=$,$.onopen=Je,$.onerror=qe,$.addEventListener("status_update",We),$.addEventListener("artifact_update",We),$.addEventListener("final_response",We),$.addEventListener("error",We),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${x}. Closing EventSource.`),$.removeEventListener("status_update",We),$.removeEventListener("artifact_update",We),$.removeEventListener("final_response",We),$.removeEventListener("error",We),Ce()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),Ce()},[x,s,We,Je,qe,Ce]);const Be={configCollectFeedback:o,submittedFeedback:wt,handleFeedbackSubmit:_e,sessionId:i,setSessionId:l,sessionName:Rt,setSessionName:it,messages:c,setMessages:u,isResponding:f,currentTaskId:x,isCancelling:y,latestStatusText:G,agents:K,agentsLoading:z,agentsError:W,agentsRefetch:_,handleNewSession:Ut,handleSwitchSession:Jt,handleSubmit:Ge,handleCancel:Me,notifications:m,addNotification:ce,selectedAgentName:w,setSelectedAgentName:b,artifacts:q,artifactsLoading:E,artifactsRefetch:T,uploadArtifactFile:Ke,isSidePanelCollapsed:M,activeSidePanelTab:ee,setIsSidePanelCollapsed:F,setActiveSidePanelTab:L,openSidePanelTab:pn,taskIdInSidePanel:N,setTaskIdInSidePanel:j,isDeleteModalOpen:U,artifactToDelete:J,openDeleteModal:Ht,closeDeleteModal:Tt,confirmDelete:un,openSessionDeleteModal:Qt,closeSessionDeleteModal:Se,confirmSessionDelete:ke,sessionToDelete:at,isArtifactEditMode:X,setIsArtifactEditMode:re,selectedArtifactFilenames:ne,setSelectedArtifactFilenames:ue,handleDeleteSelectedArtifacts:Lt,confirmBatchDeleteArtifacts:Pt,isBatchDeleteModalOpen:ae,setIsBatchDeleteModalOpen:fe,previewedArtifactAvailableVersions:Pe,currentPreviewedVersionNumber:Oe,previewFileContent:Mt,openArtifactForPreview:dn,navigateArtifactVersion:kt,openMessageAttachmentForPreview:fn,previewArtifact:ye,setPreviewArtifact:Le,updateSessionName:At,deleteSession:Dt};return a.jsx(sd.Provider,{value:Be,children:e})},s2=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=Zt(),{fetchCsrfToken:r,clearCsrfToken:o}=dd(),[s,i]=d.useState(!1),[l,c]=d.useState(!0),[u,f]=d.useState(null);d.useEffect(()=>{let g=!0;const x=async()=>{if(!t){g&&(i(!0),c(!1));return}try{const v=await Fe("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(v.ok){const w=await v.json();console.log("User is authenticated:",w),g&&(f(w),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(od.Provider,{value:{isAuthenticated:s,useAuthorization:t,login:p,logout:m,userInfo:u},children:e})};function i2(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 a2=e=>new Promise(t=>setTimeout(t,e)),l2=async(e=5,t=50)=>{try{const n=await Fe("/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=i2("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 a2(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 c2({children:e}){const[t,n]=d.useState(null),r=d.useCallback(async()=>{if(t)return t;const i=await l2();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=d.useCallback(()=>{n(null)},[]),s={fetchCsrfToken:r,clearCsrfToken:o};return a.jsx(ad.Provider,{value:s,children:e})}const u2={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"}},d2={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"}},f2={"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 p2(e,t){const n={},r=d2[t];for(const[o,s]of Object.entries(r)){const i=Vl(e,s);n[`--${o}`]=i}for(const[o,s]of Object.entries(f2)){const i=Vl(e,s);n[`--color-${o}`]=i}return n}const Vo="sam-theme";function m2(e){var n,r,o,s,i,l,c,u,f,p,m,g,x,h,v,w,b,y,S,N,j,k,A,G,Q,O,P,K,W,z,_,q,E,T,M,F,ee,L,U,Y,J,I,X,re,ne,ue,ae,fe,ye,Le,Pe,$e,Oe,Ue,Mt,Ye,Rt,it,at,lt,wt,zt,ce,Ct,bt,Bt,St,Et,Ke,ft,Ht,Tt,un,Lt,Pt,dn,kt,fn,pn,Ce,We,Ut,Jt,At,Dt,Qt,Se,ke,Me,_e,Je,qe,Ge,Be,D,B,$,H,oe,V,C,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),(u=e.error)!=null&&u.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),(w=e.warning)!=null&&w.w30&&(t["--color-warning-w30"]=e.warning.w30),(b=e.warning)!=null&&b.w20&&(t["--color-warning-w20"]=e.warning.w20),(y=e.warning)!=null&&y.w10&&(t["--color-warning-w10"]=e.warning.w10),(S=e.success)!=null&&S.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),(A=e.success)!=null&&A.w20&&(t["--color-success-w20"]=e.success.w20),(G=e.success)!=null&&G.w10&&(t["--color-success-w10"]=e.success.w10),(Q=e.stateLayer)!=null&&Q.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(O=e.stateLayer)!=null&&O.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(K=(P=e.accent)==null?void 0:P.n0)!=null&&K.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(z=(W=e.accent)==null?void 0:W.n0)!=null&&z.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(q=(_=e.accent)==null?void 0:_.n0)!=null&&q.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(T=(E=e.accent)==null?void 0:E.n0)!=null&&T.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(F=(M=e.accent)==null?void 0:M.n1)!=null&&F.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(L=(ee=e.accent)==null?void 0:ee.n1)!=null&&L.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(Y=(U=e.accent)==null?void 0:U.n1)!=null&&Y.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(I=(J=e.accent)==null?void 0:J.n1)!=null&&I.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(re=(X=e.accent)==null?void 0:X.n1)!=null&&re.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(ue=(ne=e.accent)==null?void 0:ne.n1)!=null&&ue.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(fe=(ae=e.accent)==null?void 0:ae.n2)!=null&&fe.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(Le=(ye=e.accent)==null?void 0:ye.n2)!=null&&Le.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),($e=(Pe=e.accent)==null?void 0:Pe.n2)!=null&&$e.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(Ue=(Oe=e.accent)==null?void 0:Oe.n2)!=null&&Ue.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(Ye=(Mt=e.accent)==null?void 0:Mt.n2)!=null&&Ye.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(it=(Rt=e.accent)==null?void 0:Rt.n3)!=null&&it.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(lt=(at=e.accent)==null?void 0:at.n3)!=null&<.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(zt=(wt=e.accent)==null?void 0:wt.n3)!=null&&zt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Ct=(ce=e.accent)==null?void 0:ce.n3)!=null&&Ct.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Bt=(bt=e.accent)==null?void 0:bt.n4)!=null&&Bt.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(Et=(St=e.accent)==null?void 0:St.n4)!=null&&Et.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(ft=(Ke=e.accent)==null?void 0:Ke.n4)!=null&&ft.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Tt=(Ht=e.accent)==null?void 0:Ht.n5)!=null&&Tt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(Lt=(un=e.accent)==null?void 0:un.n5)!=null&&Lt.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(dn=(Pt=e.accent)==null?void 0:Pt.n5)!=null&&dn.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(fn=(kt=e.accent)==null?void 0:kt.n5)!=null&&fn.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Ce=(pn=e.accent)==null?void 0:pn.n6)!=null&&Ce.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(Ut=(We=e.accent)==null?void 0:We.n6)!=null&&Ut.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(At=(Jt=e.accent)==null?void 0:Jt.n6)!=null&&At.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Qt=(Dt=e.accent)==null?void 0:Dt.n7)!=null&&Qt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(ke=(Se=e.accent)==null?void 0:Se.n7)!=null&&ke.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(_e=(Me=e.accent)==null?void 0:Me.n7)!=null&&_e.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(qe=(Je=e.accent)==null?void 0:Je.n8)!=null&&qe.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(Be=(Ge=e.accent)==null?void 0:Ge.n8)!=null&&Be.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(B=(D=e.accent)==null?void 0:D.n8)!=null&&B.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(H=($=e.accent)==null?void 0:$.n9)!=null&&H.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(oe=e.learning)!=null&&oe.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(V=e.learning)!=null&&V.w100&&(t["--color-learning-w100"]=e.learning.w100),(C=e.learning)!=null&&C.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 h2(e,t="light"){const n={};if(e){const o=m2(e);Object.assign(n,o)}const r=p2(e,t);return Object.assign(n,r),n}function g2(){const e=localStorage.getItem(Vo);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function x2(e,t){const n=h2(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(Vo,t)})}const v2=({children:e})=>{const t=d.useMemo(()=>u2,[]),[n,r]=d.useState(()=>g2()),o=d.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const s=n==="light"?"dark":"light";r(s),localStorage.setItem(Vo,s)}}),[n]);return d.useEffect(()=>{if(!(localStorage.getItem(Vo)!==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)}}},[]),d.useEffect(()=>{document.documentElement.classList.remove("light","dark"),x2(t,n)},[n,t]),a.jsx(cd.Provider,{value:o,children:e})},Gl={CARDS:"cards"},w2=({message:e})=>{const{handleCancel:t,setMessages:n}=He();if(e.authenticationLink){const r=e.authenticationLink.authenticationAttempted||!1,o=e.authenticationLink.rejected||!1,s=()=>{if(r||o)return;n(u=>u.map(f=>{var p,m;return((p=f.metadata)==null?void 0:p.messageId)===((m=e.metadata)==null?void 0:m.messageId)&&f.authenticationLink?{...f,authenticationLink:{...f.authenticationLink,authenticationAttempted:!0}}:f}));const c=window.open(e.authenticationLink.url,"_blank","width=800,height=700,scrollbars=yes,resizable=yes");c&&c.focus()},i=async()=>{r||o||(n(c=>c.map(u=>{var f,p;return((f=u.metadata)==null?void 0:f.messageId)===((p=e.metadata)==null?void 0:p.messageId)&&u.authenticationLink?{...u,authenticationLink:{...u.authenticationLink,rejected:!0}}:u})),t())},l=e.authenticationLink.targetAgent||"Agent";return a.jsxs("div",{className:"w-1/2 rounded-lg border p-4",children:[a.jsx("div",{className:"font-semibold",children:"Action Needed"}),a.jsxs("div",{className:"py-4",children:['The "',l,'" agent requires authentication.']}),a.jsxs("div",{className:"flex flex-row justify-end gap-2",children:[a.jsx(me,{variant:"ghost",onClick:i,disabled:r||o,children:"Reject"}),a.jsx(me,{onClick:s,disabled:r||o,children:e.authenticationLink.text})]}),a.jsxs("div",{className:"text-muted-foreground w-full text-center text-xs",children:[o&&a.jsx("div",{className:"mt-4",children:"Authentication request rejected."}),r&&a.jsx("div",{className:"mt-4",children:"Authentication window has been opened. Complete the process in the new window."})]})]})}return null},b2=["image","audio"],y2=({message:e,showWorkflowButton:t,showFeedbackActions:n,handleViewWorkflowClick:r})=>{var b;const{configCollectFeedback:o,submittedFeedback:s,handleFeedbackSubmit:i,addNotification:l}=He(),[c,u]=d.useState(!1),[f,p]=d.useState(null),m=e.taskId,g=m?(b=s[m])==null?void 0:b.type:void 0,x=y=>{p(y),u(!0)},h=()=>{u(!1),p(null)},v=async y=>{if(!(!f||!m))try{await i(m,f,y),l("Feedback submitted successfully","success")}catch(S){throw l("Failed to submit feedback. Please try again.","error"),S}},w=n&&o;return!t&&!w?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"mt-3 space-y-2",children:a.jsxs("div",{className:"flex items-center justify-start gap-2",children:[t&&a.jsx(uu,{onClick:r}),w&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(me,{variant:"ghost",size:"icon",className:`h-6 w-6 ${g?"!opacity-100":""}`,onClick:()=>x("up"),disabled:!!g,children:a.jsx(cm,{className:`h-4 w-4 ${g==="up"?"fill-[var(--color-brand-wMain)] text-[var(--color-brand-wMain)] !opacity-100":""}`})}),a.jsx(me,{variant:"ghost",size:"icon",className:`h-6 w-6 ${g?"!opacity-100":""}`,onClick:()=>x("down"),disabled:!!g,children:a.jsx(um,{className:`h-4 w-4 ${g==="down"?"fill-[var(--color-brand-wMain)] text-[var(--color-brand-wMain)] opacity-100":""}`})})]})]})}),f&&a.jsx(F1,{isOpen:c,onClose:h,feedbackType:f,onSubmit:v})]})},C2=ct.memo(({message:e})=>{var u;const[t,n]=d.useState(null),r=(u=e.parts)==null?void 0:u.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(Ai,{className:"mr-2 self-start text-[var(--color-error-wMain)]"}),a.jsx(dr,{children:s})]});const i=$C(s);if(i.length===0)return a.jsx(dr,{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(jf,{fileAttachment:m,isEmbedded:!0})},`embedded-file-${p}`))}else if(!b2.includes(f.type)){const m=Af(f.content);m&&c.push(a.jsx("div",{className:"my-2 h-auto w-md max-w-md",children:a.jsx(Np,{content:m,rendererType:f.type,mime_type:f.mimeType,setRenderError:n})},`embedded-${p}`))}}),a.jsxs("div",{children:[t&&a.jsx(Ip,{variant:"error",message:"Error rendering preview"}),a.jsx(dr,{children:l}),c]})}),Mp=ct.memo(({message:e,children:t,className:n})=>a.jsx("div",{className:`mt-1 space-y-1 ${e.isUser?"ml-auto":"mr-auto"} ${n}`,children:t})),S2=e=>e.uploadedFiles&&e.uploadedFiles.length>0?a.jsx(Mp,{message:e,className:"flex flex-wrap justify-end gap-2",children:e.uploadedFiles.map((t,n)=>{var r;return a.jsx(Mf,{filename:t.name,mimeType:t.type},`uploaded-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,E2=e=>e.files&&e.files.length>0?a.jsx(Mp,{message:e,children:e.files.map((t,n)=>{var r;return a.jsx(jf,{fileAttachment:t},`file-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,T2=(e,t,n)=>{var f,p;const{openSidePanelTab:r,setTaskIdInSidePanel:o}=t;if(e.isStatusBubble)return null;if(e.authenticationLink)return a.jsx(w2,{message:e});const s=(f=e.parts)==null?void 0:f.some(m=>m.kind==="text"&&m.text.trim());if(!s&&!e.artifactNotification)return null;const i=e.isUser?"sent":"received",l=!e.isUser&&e.isComplete&&!!e.taskId&&!!n,c=!e.isUser&&e.isComplete&&!!e.taskId&&!!n,u=()=>{e.taskId&&(o(e.taskId),r("workflow"))};return a.jsx(Cf,{variant:i,children:a.jsxs(Sf,{variant:i,children:[s&&a.jsx(C2,{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(fr,{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})`]})]}),a.jsx(y2,{message:e,showWorkflowButton:!!l,showFeedbackActions:!!c,handleViewWorkflowClick:u})]})},(p=e.metadata)==null?void 0:p.messageId)},k2=({message:e,isLastWithTaskId:t})=>{var r;const n=He();return e?a.jsxs("div",{"data-testid":`message-${((r=e.metadata)==null?void 0:r.messageId)||"unknown"}`,children:[T2(e,n,t),S2(e),E2(e)]}):null};var vi=new Map,Eo=new WeakMap,Yl=0,A2=void 0;function N2(e){return e?(Eo.has(e)||(Yl+=1,Eo.set(e,Yl.toString())),Eo.get(e)):"0"}function _2(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?N2(e.root):e[t]}`).toString()}function I2(e){const t=_2(e);let n=vi.get(t);if(!n){const r=new Map;let o;const s=new IntersectionObserver(i=>{i.forEach(l=>{var c;const u=l.isIntersecting&&o.some(f=>l.intersectionRatio>=f);e.trackVisibility&&typeof l.isVisible>"u"&&(l.isVisible=u),(c=r.get(l.target))==null||c.forEach(f=>{f(u,l)})})},e);o=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),n={id:t,observer:s,elements:r},vi.set(t,n)}return n}function j2(e,t,n={},r=A2){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}=I2(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(),vi.delete(o))}}function M2({threshold:e,delay:t,trackVisibility:n,rootMargin:r,root:o,triggerOnce:s,skip:i,initialInView:l,fallbackInView:c,onChange:u}={}){var f;const[p,m]=d.useState(null),g=d.useRef(u),[x,h]=d.useState({inView:!!l,entry:void 0});g.current=u,d.useEffect(()=>{if(i||!p)return;let y;return y=j2(p,(S,N)=>{h({inView:S,entry:N}),g.current&&g.current(S,N),N.isIntersecting&&s&&y&&(y(),y=void 0)},{root:o,rootMargin:r,threshold:e,trackVisibility:n,delay:t},c),()=>{y&&y()}},[Array.isArray(e)?e.toString():e,p,o,r,s,i,n,c,t]);const v=(f=x.entry)==null?void 0:f.target,w=d.useRef(void 0);!p&&v&&!s&&!i&&w.current!==v&&(w.current=v,h({inView:!!l,entry:void 0}));const b=[m,x.inView,x.entry];return b.ref=b[0],b.inView=b[1],b.entry=b[2],b}const R2=()=>{const{sessionId:e,handleSwitchSession:t,updateSessionName:n,openSessionDeleteModal:r}=He(),{configServerUrl:o}=Zt(),s=d.useRef(null),[i,l]=d.useState([]),[c,u]=d.useState(null),[f,p]=d.useState(""),[m,g]=d.useState(1),[x,h]=d.useState(!0),[v,w]=d.useState(!1),{ref:b,inView:y}=M2({threshold:0,triggerOnce:!1}),S=d.useCallback(async(O=1,P=!1)=>{w(!0);const W=`${o}/api/v1/sessions?pageNumber=${O}&pageSize=20`;try{const z=await Fe(W);if(z.ok){const _=await z.json();l(P?q=>[...q,..._.data]:_.data),h(_.meta.pagination.nextPage!==null),g(O)}else console.error(`Failed to fetch sessions: ${z.status} ${z.statusText}`)}catch(z){console.error("An error occurred while fetching sessions:",z)}finally{w(!1)}},[o]);d.useEffect(()=>{S(1,!1);const O=()=>{S(1,!1)},P=K=>{const{sessionId:W}=K.detail;l(z=>{const _=z.find(q=>q.id===W);if(_){const q=z.filter(E=>E.id!==W);return[_,...q]}return z})};return window.addEventListener("new-chat-session",O),window.addEventListener("session-updated",P),()=>{window.removeEventListener("new-chat-session",O),window.removeEventListener("session-updated",P)}},[S]),d.useEffect(()=>{y&&x&&!v&&S(m+1,!0)},[y,x,v,m,S]),d.useEffect(()=>{c&&s.current&&s.current.focus()},[c]);const N=async O=>{c!==O&&await t(O)},j=O=>{u(O.id),p(O.name||"")},k=async()=>{c&&(await n(c,f),u(null),S())},A=O=>{r(O)},G=O=>Th(O),Q=O=>{if(O.name&&O.name.trim())return O.name;const P=O.id;return P.startsWith("web-session-")?`Chat ${P.replace("web-session-","").substring(0,8)}`:`Session ${P.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:[i.length>0&&a.jsx("ul",{children:i.map(O=>a.jsx("li",{className:"group my-2 pr-4",children:a.jsxs("div",{className:`flex items-center justify-between rounded px-4 py-2 ${O.id===e?"bg-muted":""}`,children:[c===O.id?a.jsx("input",{ref:s,type:"text",value:f,onChange:P=>p(P.target.value),onKeyDown:P=>P.key==="Enter"&&k(),onBlur:k,className:"flex-grow bg-transparent focus:outline-none"}):a.jsx("button",{onClick:()=>N(O.id),className:"flex-grow cursor-pointer text-left",children:a.jsxs("div",{className:"flex max-w-50 flex-col",children:[a.jsx("span",{className:"truncate font-semibold",title:Q(O),children:Q(O)}),a.jsx("span",{className:"text-muted-foreground text-xs",children:G(O.updatedTime)})]})}),a.jsx("div",{className:"flex items-center opacity-0 transition-opacity group-hover:opacity-100",children:c===O.id?a.jsxs(a.Fragment,{children:[a.jsx(me,{variant:"ghost",onClick:k,children:a.jsx(Ti,{size:16})}),a.jsx(me,{variant:"ghost",onClick:()=>u(null),children:a.jsx(Go,{size:16})})]}):a.jsxs(a.Fragment,{children:[a.jsx(me,{variant:"ghost",onClick:()=>j(O),children:a.jsx(dm,{size:16})}),a.jsx(me,{variant:"ghost",onClick:()=>A(O),children:a.jsx(fm,{size:16})})]})})]})},O.id))}),i.length===0&&!v&&a.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center text-sm",children:[a.jsx(cc,{className:"mx-auto mb-4 h-12 w-12"}),"No chat sessions available"]}),x&&a.jsx("div",{ref:b,className:"flex justify-center py-4",children:v&&a.jsx(ca,{size:"small",variant:"muted"})})]})]})},L2=()=>{const{persistenceEnabled:e}=Zt(),{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(R2,{})},P2=({artifactInfo:e,isPreview:t=!1,isExpanded:n=!1,onDelete:r,onDownload:o,setIsExpanded:s})=>{const{previewedArtifactAvailableVersions:i,currentPreviewedVersionNumber:l,navigateArtifactVersion:c}=He(),u=d.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:La(e.last_modified),children:La(e.last_modified)})]}),t&&u.length>1&&a.jsx("div",{className:"align-right",children:a.jsxs(Qd,{value:l==null?void 0:l.toString(),onValueChange:f=>{c(e.filename,parseInt(f))},children:[a.jsx(tf,{className:"h-[16px] py-0 text-xs shadow-none",children:a.jsx(ef,{placeholder:"Version"})}),a.jsx(nf,{children:u.map(f=>a.jsxs(rf,{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(me,{variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),f.preventDefault(),s(!n)},tooltip:n?"Collapse Details":"Expand Details",children:a.jsx(Ni,{})}),o&&a.jsx(me,{variant:"ghost",size:"sm",onClick:async f=>{f.stopPropagation(),f.preventDefault(),await o(e)},tooltip:"Download",children:a.jsx(Yo,{})}),r&&a.jsx(me,{variant:"ghost",size:"sm",onClick:f=>{f.preventDefault(),f.stopPropagation(),r(e)},tooltip:"Delete",children:a.jsx(uc,{})})]})]})},Kl=({artifact:e,isPreview:t})=>{const{openDeleteModal:n,setPreviewArtifact:r}=He(),{onDownload:o}=fd(),[s,i]=d.useState(!1),l=()=>{t&&r(null),n(e)},c=u=>{if(!u||typeof u=="object"&&Object.keys(u).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 u=="object"&&u.type&&a.jsxs("p",{children:[a.jsx("strong",{children:"Type:"})," ",u.type," ",u.inferred&&a.jsx("span",{className:"text-xs",children:"(inferred)"})]}),typeof u=="object"&&u.columns&&a.jsxs("p",{children:[a.jsx("strong",{children:"Columns:"})," ",u.columns.join(", ")]}),typeof u=="object"&&u.structure&&a.jsxs("div",{children:[a.jsx("strong",{children:"Structure:"}),f(u.structure)]}),typeof u=="object"&&u.error&&a.jsxs("p",{className:"text-[var(--color-error-wMain)]",children:[a.jsx("strong",{children:"Schema Error:"})," ",u.error]}),typeof u=="string"&&a.jsx("p",{children:u})]})};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:u=>{u.stopPropagation(),r(e)},onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.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:If(e,"h-4 w-4 flex-shrink-0")}),a.jsxs("div",{className:"min-w-0 flex-grow",children:[a.jsx(P2,{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: "}),Nc(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)})]})]})]})]})})},D2=()=>{const{isDeleteModalOpen:e,artifactToDelete:t,closeDeleteModal:n,confirmDelete:r}=He();return!e||!t?null:a.jsx(Qr,{open:e,onOpenChange:n,children:a.jsxs(eo,{children:[a.jsxs(to,{children:[a.jsxs(no,{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(ro,{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(me,{variant:"outline",onClick:n,children:"Cancel"}),a.jsx(me,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})},O2=({artifact:e,message:t})=>{const{onDownload:n}=fd();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(me,{onClick:()=>n(e),children:[a.jsx(Yo,{className:"h-4 w-4"}),"Download"]})]})},Gs=({children:e})=>a.jsx("div",{className:"text-muted-foreground flex h-[50vh] items-center justify-center",children:e||"No preview available"}),F2=({artifact:e})=>{const{openArtifactForPreview:t,previewFileContent:n}=He(),r=d.useMemo(()=>O1(e),[e]),[o,s]=d.useState(!1),[i,l]=d.useState(null);if(d.useEffect(()=>{s(!1),l(null)},[e]),d.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(Ip,{variant:"error",message:"Error rendering preview"}),a.jsx(Gs,{children:"No preview available"})]});if(o)return a.jsx(Gs,{children:a.jsx(ki,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(!r.canPreview)return a.jsx(O2,{artifact:e,message:r.reason??""});const c=io(e.filename,e.mime_type),u=P1(n);return!c||!u?a.jsx(Gs,{children:"No preview available"}):a.jsx(Np,{content:u,rendererType:c,mime_type:n==null?void 0:n.mime_type,setRenderError:l})},rn={NameAsc:"name_asc",NameDesc:"name_desc",DateAsc:"date_asc",DateDesc:"date_desc"},$2=e=>{switch(e){case rn.NameAsc:return"Name (A-Z)";case rn.NameDesc:return"Name (Z-A)";case rn.DateAsc:return"Date (oldest first)";case rn.DateDesc:return"Date (newest first)"}},z2=({currentSortOption:e,onSortChange:t,children:n})=>{const r=Object.values(rn).map(o=>({id:o,label:$2(o),onClick:()=>t(o),icon:e===o?a.jsx(Ti,{}):void 0,iconPosition:"right"}));return a.jsxs(Ed,{children:[a.jsx(Td,{asChild:!0,children:n}),a.jsx(kd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(sa,{actions:r})})]})},B2=({children:e})=>{const{artifactsRefetch:t,setIsBatchDeleteModalOpen:n}=He(),r=[{id:"refreshAll",label:"Refresh",onClick:()=>{t()},icon:a.jsx(dc,{}),iconPosition:"left"},{id:"deleteAll",label:"Delete All",onClick:()=>{n(!0)},icon:a.jsx(uc,{}),iconPosition:"left",divider:!0}];return a.jsxs(Ed,{children:[a.jsx(Td,{asChild:!0,children:e}),a.jsx(kd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(sa,{actions:r})})]})},H2=()=>{const{artifacts:e,isBatchDeleteModalOpen:t,setIsBatchDeleteModalOpen:n,confirmBatchDeleteArtifacts:r,setSelectedArtifactFilenames:o}=He();return d.useEffect(()=>{t&&o(new Set(e.map(s=>s.filename)))},[e,t,o]),t?a.jsx(Qr,{open:t,onOpenChange:n,children:a.jsxs(eo,{children:[a.jsxs(to,{children:[a.jsx(no,{children:"Delete All?"}),a.jsxs(ro,{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(me,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),a.jsx(me,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})}):null},U2={[rn.NameAsc]:(e,t)=>e.filename.localeCompare(t.filename),[rn.NameDesc]:(e,t)=>t.filename.localeCompare(e.filename),[rn.DateAsc]:(e,t)=>e.last_modified>t.last_modified?1:-1,[rn.DateDesc]:(e,t)=>e.last_modified<t.last_modified?1:-1},W2=()=>{const{artifacts:e,artifactsLoading:t,previewArtifact:n,setPreviewArtifact:r,artifactsRefetch:o}=He(),[s,i]=d.useState(rn.DateDesc),l=d.useMemo(()=>t?[]:e?[...e].sort(U2[s]):[],[e,t,s]),c=d.useMemo(()=>n?a.jsxs("div",{className:"flex items-center gap-2 border-b p-2",children:[a.jsx(me,{variant:"ghost",onClick:()=>r(null),children:a.jsx(pm,{})}),a.jsx("div",{className:"text-md font-semibold",children:"Preview"})]}):l.length>0&&a.jsxs("div",{className:"flex items-center justify-end border-b p-2",children:[a.jsx(z2,{currentSortOption:s,onSortChange:i,children:a.jsxs(me,{variant:"ghost",title:"Sort By",children:[a.jsx(nc,{className:"h-5 w-5"}),a.jsx("div",{children:"Sort By"})]})},"sort-popover"),a.jsx(B2,{children:a.jsx(me,{variant:"ghost",tooltip:"More",children:a.jsx(mm,{className:"h-5 w-5"})})},"more-popover")]}),[n,l.length,s,r]);return a.jsxs("div",{className:"flex h-full flex-col",children:[c,a.jsxs("div",{className:"flex min-h-0 flex-1",children:[!n&&a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l.map(u=>a.jsx(Kl,{artifact:u},u.filename)),l.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(ki,{className:"size-6 animate-spin"}),!t&&a.jsxs(a.Fragment,{children:[a.jsx(fr,{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"}),a.jsx(me,{className:"mt-4",variant:"default",onClick:o,"data-testid":"refreshFiles",title:"Refresh Files",children:"Refresh"})]})]})})]}),n&&a.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-2",children:[a.jsx(Kl,{artifact:n,isPreview:!0},n.filename),a.jsx("div",{className:"min-h-0 min-w-0 flex-1 overflow-y-auto",children:a.jsx(F2,{artifact:n})})]})]}),a.jsx(D2,{}),a.jsx(H2,{})]})},V2=({onCollapsedToggle:e,isSidePanelCollapsed:t,setIsSidePanelCollapsed:n,isSidePanelTransitioning:r})=>{const{activeSidePanelTab:o,setActiveSidePanelTab:s,setPreviewArtifact:i,taskIdInSidePanel:l}=He(),{isReconnecting:c,isTaskMonitorConnecting:u,isTaskMonitorConnected:f,monitoredTasks:p,connectTaskMonitorStream:m}=ra(),[g,x]=d.useState(null);d.useEffect(()=>{if(l&&p[l]){const y=p[l],S=kS(y.events||[],p,y);x(S)}else x(null)},[l,p]);const h=()=>c||u?{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:hm,buttonAction:m},v=()=>{const y=!t;n(y),e(y)},w=y=>{y==="files"&&i(null),s(y)},b=y=>{t&&(n(!1),e==null||e(!1)),w(y)};return t?a.jsxs("div",{className:"bg-background flex h-full w-full flex-col items-center border-l py-4",children:[a.jsx(me,{"data-testid":"expandPanel",variant:"ghost",size:"sm",onClick:v,className:"h-10 w-10 p-0",tooltip:"Expand Panel",children:a.jsx(Ea,{className:"size-5"})}),a.jsx("div",{className:"bg-border my-4 h-px w-8"}),a.jsx(me,{variant:"ghost",size:"sm",onClick:()=>b("files"),className:"mb-2 h-10 w-10 p-0",tooltip:"Files",children:a.jsx(fr,{className:"size-5"})}),a.jsx(me,{variant:"ghost",size:"sm",onClick:()=>b("workflow"),className:"h-10 w-10 p-0",tooltip:"Workflow",children:a.jsx(ko,{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(l1,{value:o,onValueChange:y=>w(y),className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex gap-2 p-2",children:[a.jsx(me,{"data-testid":"collapsePanel",variant:"ghost",onClick:v,className:"p-1",tooltip:"Collapse Panel",children:a.jsx(Ea,{className:"size-5"})}),a.jsxs(c1,{className:"grid w-full grid-cols-2 bg-transparent p-0",children:[a.jsxs(gl,{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(fr,{className:"mr-2 h-4 w-4"}),"Files"]}),a.jsxs(gl,{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(ko,{className:"mr-2 h-4 w-4"}),"Workflow"]})]})]}),a.jsxs("div",{className:"min-h-0 flex-1",children:[a.jsx(xl,{value:"files",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:a.jsx(W2,{})})}),a.jsx(xl,{value:"workflow",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:(()=>{const y=h();return!y&&g?a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsx(K2,{task:g}),a.jsx(TS,{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(ko,{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:y==null?void 0:y.message}),(y==null?void 0:y.showButton)&&a.jsx("div",{className:"mt-4",children:a.jsxs(me,{onClick:y.buttonAction,children:[y.buttonIcon&&(()=>{const S=y.buttonIcon;return a.jsx(S,{className:"h-4 w-4"})})(),y.buttonText]})})]})})})()})})]})]})})})},wi=ct.memo(({statusText:e,onViewWorkflow:t})=>a.jsxs("div",{className:"flex h-8 items-center space-x-3 py-1",children:[t?a.jsx(uu,{onClick:t}):a.jsx(h1,{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})})]})),ql=({text:e,onClick:t})=>a.jsxs(me,{"data-testid":"startNewChat",variant:"ghost",onClick:t,tooltip:"Start New Chat Session",children:[a.jsx(gm,{className:"size-5"}),e]}),Rp=({buttonText:e})=>{const{handleNewSession:t}=He(),{persistenceEnabled:n}=Zt();return n?a.jsx(ql,{text:e,onClick:t}):a.jsxs(Qr,{children:[a.jsx(Gx,{asChild:!0,children:a.jsx(ql,{text:e})}),a.jsxs(eo,{children:[a.jsxs(to,{children:[a.jsx(no,{className:"flex max-w-[400px] flex-row gap-1",children:"New Chat Session?"}),a.jsx(ro,{className:"flex flex-col gap-2",children:"Starting a new chat session will clear the current chat history and files. Are you sure you want to proceed?"})]}),a.jsxs(Qi,{children:[a.jsx(sl,{asChild:!0,children:a.jsx(me,{variant:"ghost",children:"Cancel"})}),a.jsx(sl,{asChild:!0,children:a.jsx(me,{variant:"default",onClick:t,children:"Start New Chat"})})]})]})]})},G2=({onToggle:e})=>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(me,{variant:"ghost",onClick:e,className:"p-2","data-testid":"hideChatSessions",tooltip:"Hide Chat Sessions",children:a.jsx(fc,{className:"size-5"})}),a.jsx(Rp,{buttonText:"New Chat"})]}),a.jsx("div",{className:"mt-1 min-h-0 flex-1",children:a.jsx(L2,{})})]}),Mr=(e,t)=>a.jsx(kf,{type:t,className:"rounded-full border-none",children:a.jsx("span",{className:"text-xs font-semibold",title:e,children:e})}),Y2=(e,t)=>{var r;if(e.currentStatusText)return a.jsx("div",{title:e.currentStatusText,children:a.jsx(wi,{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(wi,{statusText:n||e.status})});case"input-required":return Mr("Input Required","info");case"completed":return Mr("Completed","success");case"canceled":return Mr("Canceled","info");case"failed":return Mr("Failed","error");default:return Mr("Unknown","info")}},K2=({task:e})=>{const{messages:t,addNotification:n}=He(),{configServerUrl:r,configFeatureEnablement:o}=Zt(),s=d.useMemo(()=>`${r}/api/v1`,[r]),i=(o==null?void 0:o.taskLogging)??!1,l=d.useMemo(()=>{const u=t.find(f=>f.isStatusBubble);return e?Y2(e,u):null},[t,e]),c=async()=>{if(!e.taskId){n("Task ID is missing, cannot download.","error");return}try{const u=await Fe(`${s}/tasks/${e.taskId}`);if(!u.ok){const g=await u.json().catch(()=>({detail:`Failed to download: ${u.statusText}`}));throw new Error(g.detail||`HTTP error ${u.status}`)}const f=await u.blob(),p=window.URL.createObjectURL(f),m=document.createElement("a");m.href=p,m.download=`${e.taskId}.stim`,document.body.appendChild(m),m.click(),m.remove(),window.URL.revokeObjectURL(p),n("Task log download started.","success")}catch(u){console.error("Failed to download .stim file:",u),n(`Failed to download task log: ${u instanceof Error?u.message:"Unknown error"}`,"error")}};return e?a.jsxs("div",{className:"grid grid-cols-[auto_1fr_auto] grid-rows-[32px_32px] items-center gap-x-8 border-b p-4",children:[a.jsx("div",{className:"text-muted-foreground",children:"User"}),a.jsx("div",{className:"truncate",title:e.initialRequestText,children:e.initialRequestText}),a.jsx("div",{}),a.jsx("div",{className:"text-muted-foreground",children:"Status"}),a.jsx("div",{className:"truncate",children:l}),a.jsx("div",{children:i&&a.jsx(me,{variant:"ghost",size:"icon",onClick:c,tooltip:"Download Task Log (.stim)",children:a.jsx(Yo,{className:"size-4"})})})]}):null};class Lp{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"),u=s.type==="AGENT_TOOL_EXECUTION_RESULT"&&((f=s.data.toolResult)==null?void 0:f.isPeerResponse);return l||c||u})}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 Pp(e,t){return(t==null?void 0:t[e])||e}const vn={USER:50,MAIN_FLOW:300,TOOLS:600},q2=50,tt=50,Ft=330,Kn=50,en=20,xr=10,Xl=tt+20,X2=90;function qn(e,t,n){return e.push(n),t.add(n.id),n}function Z2(e,t){return e.push(t),t}function Xn(e,t){return e.nodeIdCounter++,`${t.replace(/[^a-zA-Z0-9_]/g,"_")}_${e.nodeIdCounter}`}function vt(e){return e.currentPhaseIndex===-1||e.currentPhaseIndex>=e.phases.length?null:e.phases[e.currentPhaseIndex]}function ao(e){const t=vt(e);return!t||e.currentSubflowIndex===-1||e.currentSubflowIndex>=t.subflows.length?null:t.subflows[e.currentSubflowIndex]}function J2(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 Q2(e,t){if(!t)return null;const n=vt(e);return n&&n.subflows.findLast(r=>r.functionCallId===t)||null}function eS(e,t){if(!t)return null;const n=vt(e);return n&&n.subflows.findLast(r=>r.id===t)||null}function xs(e,t){var o;const n=vt(e);if(!n)return null;if(t.functionCallId){const s=Q2(e,t.functionCallId);if(s)return s}if(t.owningTaskId&&t.isSubTaskStep){const s=eS(e,t.owningTaskId);if(s){const i=n.subflows||[];if(!(new Set(i.map(c=>c.id)).size!==i.length))return s}}const r=ao(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 Dp(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 Op(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 J2(e,t,n)}function tS(e,t,n){const r=vt(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 Fp(r,l)}return null}function Fp(e,t){if(t.isParallel)return t;if(t.parentSubflowId){const n=e.subflows.find(r=>r.id===t.parentSubflowId);if(n)return Fp(e,n)}return null}function vr(e,t,n,r){const o=`phase_${e.phases.length}`,s=Xn(e,`${t}_${o}`),i=e.nextAvailableGlobalY,l=Pp(t,e.agentNameMap),c={id:s,type:"orchestratorNode",position:{x:vn.MAIN_FLOW,y:i},data:{label:l,visualizerStepId:n.id}};qn(r,e.allCreatedNodeIds,c),e.nodePositions.set(s,c.position);const u={id:s,yPosition:i,height:tt,width:Ft},f={id:s,name:t,type:"orchestrator",phaseId:o,context:"main",nodeInstance:u};e.agentRegistry.registerAgent(f);const p={id:o,orchestratorAgent:u,userNodes:[],subflows:[],toolInstances:[],currentToolYOffset:0,maxY:i+tt};return e.phases.push(p),e.currentPhaseIndex=e.phases.length-1,e.currentSubflowIndex=-1,e.nextAvailableGlobalY=p.maxY+Kn,p}function bi(e,t,n,r,o){var Q,O,P,K,W;const s=vt(e);if(!s)return null;const i=n.type==="AGENT_TOOL_EXECUTION_RESULT"&&((Q=n.data.toolResult)==null?void 0:Q.isPeerResponse)===!0,l=n.source||"",c=n.target||"",u=wr(l);!i&&!u&&!o&&e.indentationLevel++;const f=((P=(O=n.delegationInfo)==null?void 0:O[0])==null?void 0:P.subTaskId)||n.owningTaskId,p=Xn(e,`${t}_${f}`),m=Xn(e,`group_${t}_${f}`),g=((W=(K=n.data)==null?void 0:K.toolInvocationStart)==null?void 0:W.functionCallId)||n.functionCallId||"";let x,h,v;const w=Array.from(e.parallelFlows.values()).find(z=>z.subflowFunctionCallIds.includes(g)),b=ao(e),y=tS(e,l,c);o&&w?(x=w.startX+w.currentXOffset,h=w.startY,v=h+en,w.currentXOffset+=(Ft+xr)*2.2):y?(v=e.nextAvailableGlobalY,x=(y.groupNode.xPosition||vn.MAIN_FLOW-50)+e.indentationLevel*e.indentationStep,h=v-en):(v=e.nextAvailableGlobalY,x=vn.MAIN_FLOW-50+e.indentationLevel*e.indentationStep,h=v-en);const S=Pp(t,e.agentNameMap),N={id:p,type:"genericAgentNode",position:{x:50,y:en},data:{label:S,visualizerStepId:n.id},parentId:m},j={id:m,type:"group",position:{x,y:h},data:{label:`${S} Sub-flow`},style:{backgroundColor:"rgba(220, 220, 255, 0.1)",border:"1px solid #aac",borderRadius:"8px",minHeight:`${tt+2*en}px`}};qn(r,e.allCreatedNodeIds,j),qn(r,e.allCreatedNodeIds,N),e.nodePositions.set(p,N.position),e.nodePositions.set(m,j.position);const k={id:p,xPosition:vn.MAIN_FLOW,yPosition:v,height:tt,width:Ft},A={id:p,name:t,type:"peer",phaseId:s.id,subflowId:f,context:"subflow",nodeInstance:k};e.agentRegistry.registerAgent(A);const G={id:f,functionCallId:g,isParallel:o,peerAgent:k,groupNode:{id:m,xPosition:x,yPosition:h,height:tt+2*en,width:0},toolInstances:[],currentToolYOffset:0,maxY:v+tt,maxContentXRelative:N.position.x+Ft,callingPhaseId:s.id,parentSubflowId:b==null?void 0:b.id,inheritedXOffset:y==null?void 0:y.groupNode.xPosition};return s.subflows.push(G),y&&(y.lastSubflow=G),e.currentSubflowIndex=s.subflows.length-1,o&&w?(w.maxHeight=Math.max(w.maxHeight,G.groupNode.height),e.nextAvailableGlobalY=w.startY+w.maxHeight+Kn):e.nextAvailableGlobalY=G.groupNode.yPosition+G.groupNode.height+Kn,G}function $p(e,t,n,r,o,s,i=!1){const l=vt(e);if(!l)return null;const c=s?s.toolInstances:l.toolInstances,u=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+=Xl,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=vn.TOOLS,m=l.orchestratorAgent.yPosition+l.currentToolYOffset,l.currentToolYOffset+=Xl,x=g,h=m;const v=Xn(e,`${f}_${r.id}`),w={id:v,type:n,position:{x,y:h},data:{label:u,visualizerStepId:r.id,toolName:t},parentId:p};qn(o,e.allCreatedNodeIds,w),e.nodePositions.set(v,{x,y:h});const b={id:v,xPosition:g,yPosition:m,height:tt,width:Ft,functionCallId:r.functionCallId};c.push(b);const y=m+tt;if(s){s.maxY=Math.max(s.maxY,y),s.maxContentXRelative=Math.max(s.maxContentXRelative,x+Ft);const S=s.maxY-s.groupNode.yPosition+en;s.groupNode.height=Math.max(s.groupNode.height,S);const N=s.maxContentXRelative+xr;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+Kn)}else l.maxY=Math.max(l.maxY,y),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,l.maxY+Kn);return b}function ga(e,t,n,r){e.userNodeCounter++;const o=Xn(e,`User_response_${e.userNodeCounter}`),s=e.nextAvailableGlobalY+20,i={id:o,type:"userNode",position:{x:vn.USER,y:s},data:{label:"User",visualizerStepId:n.id,isBottomNode:!0}};qn(r,e.allCreatedNodeIds,i),e.nodePositions.set(o,i.position);const l={id:o,yPosition:s,height:tt,width:Ft};t.userNodes.push(l),e.allUserNodes.push(l);const c=s+tt;return t.maxY=Math.max(t.maxY,c),l}function It(e,t,n,r,o,s,i,l,c){if(!e||!t||e===t)return;const u=o.allCreatedNodeIds.has(e),f=o.allCreatedNodeIds.has(t);if(!u||!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),Z2(r,h)}}function nS(){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 yi(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 wr(e){return e==="OrchestratorAgent"||e.toLowerCase().includes("orchestrator")}const rS=["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 oS(e,t,n,r,o,s){const i=e.target,l=i.replace(/[^a-zA-Z0-9_]/g,"_"),c=vt(t),u=ao(t);let f,p=!1;if(u?(f=u.peerAgent,f.id.startsWith(l+"_")&&(p=!0)):c&&(f=c.orchestratorAgent,f.id.startsWith(l+"_")&&(p=!0)),p&&f&&c){t.userNodeCounter++;const m=Xn(t,`User_continue_${t.userNodeCounter}`),g=t.nextAvailableGlobalY,x={id:m,type:"userNode",position:{x:vn.USER,y:g},data:{label:"User",visualizerStepId:e.id}};qn(n,t.allCreatedNodeIds,x),t.nodePositions.set(m,x.position);const h={id:m,yPosition:g,height:tt,width:Ft};c.userNodes.push(h),t.allUserNodes.push(h);const v=g+tt;f.yPosition=Math.max(f.yPosition,g),c.maxY=Math.max(c.maxY,v,f.yPosition+tt),t.nextAvailableGlobalY=c.maxY+Kn;const w=wr(i)?"orch-left-input":"peer-left-input";It(h.id,f.id,e,r,t,o,s,"user-right-output",w)}else{const m=vr(t,i,e,n),g=Xn(t,`User_${m.id}`),x={id:g,type:"userNode",position:{x:vn.USER,y:m.orchestratorAgent.yPosition-X2},data:{label:"User",visualizerStepId:e.id,isTopNode:!0}};qn(n,t.allCreatedNodeIds,x),t.nodePositions.set(g,x.position);const h={id:g,yPosition:x.position.y,height:tt,width:Ft};m.userNodes.push(h),t.allUserNodes.push(h),t.userNodeCounter++,m.maxY=Math.max(m.maxY,x.position.y+tt),t.nextAvailableGlobalY=m.maxY+Kn,It(g,m.orchestratorAgent.id,e,r,t,o,s,"user-bottom-output","orch-top-input")}}function sS(e,t,n,r,o,s){const i=vt(t);if(!i)return;const l=xs(t,e),c=l?l.peerAgent.id:i.orchestratorAgent.id,u=$p(t,"LLM","llmNode",e,n,l,!0);u&&It(c,u.id,e,r,t,o,s,l?"peer-right-output-tools":"orch-right-output-tools","llm-left-input")}function iS(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:vn.MAIN_FLOW-50,startY:t.nextAvailableGlobalY,currentXOffset:0,maxHeight:0})}const i=vt(t);if(!i)return;const l=xs(t,e);let c;const f=Op((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?It(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 aS(e,t,n,r,o,s){var f;const i=vt(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=yi(m.type,"output","bottom"),h=Dp(e,t),v=bi(t,p,e,n,h);v&&It(g.id,v.peerAgent.id,e,r,t,o,s,x,"peer-top-input")}else{const p=xs(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=yi(h.type,"output","right")):(m=i.orchestratorAgent.id,g="orch-right-output-tools")}const x=$p(t,c,"genericToolNode",e,n,p);x&&It(m,x.id,e,r,t,o,s,g,`${x.id}-tool-left-input`)}}function lS(e,t,n,r,o,s){var u,f;const i=vt(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"OrchestratorAgent";if((u=e.data.toolResult)!=null&&u.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(S=>h.subflowFunctionCallIds.includes(S.functionCallId)),w=e.target||"OrchestratorAgent";let b,y;if(wr(w))t.indentationLevel=0,b=vr(t,w,e,n).orchestratorAgent,y="orch-top-input",t.currentSubflowIndex=-1;else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const S=bi(t,w,e,n,!1);if(!S)return;b=S.peerAgent,y="peer-top-input"}v.forEach(S=>{var N;It(((N=S.lastSubflow)==null?void 0:N.peerAgent.id)??S.peerAgent.id,b.id,e,r,t,o,s,"peer-bottom-output",y)}),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(wr(c)){t.indentationLevel=0;const x=vr(t,c,e,n);It(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=Dp(e,t)||Array.from(t.parallelFlows.values()).some(v=>v.subflowFunctionCallIds.some(w=>i.subflows.some(b=>b.functionCallId===w))),h=bi(t,c,e,n,x);h&&It(g.id,h.peerAgent.id,e,r,t,o,s,"peer-bottom-output","peer-top-input")}}else{let p;const m=xs(t,e),x=Op((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 w=t.agentRegistry.findAgentByName(c);w?(h=w.id,v=yi(w.type,"input","right")):(h=i.orchestratorAgent.id,v="orch-right-input-tools")}It(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 cS(e,t,n,r,o,s){const i=vt(t);if(!i||e.isSubTaskStep)return;const l=i.orchestratorAgent.id,c=ga(t,i,e,n);It(l,c.id,e,r,t,o,s,"orch-bottom-output","user-top-input")}function uS(e,t,n,r,o,s){const i=vt(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=vr(t,"OrchestratorAgent",e,n);i.subflows.forEach(x=>{l.subflowFunctionCallIds.includes(x.functionCallId)&&It(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=ao(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 u=c.peerAgent,f=n.some(g=>typeof g.data.label=="string"&&wr(g.data.label));let p,m;f?(t.indentationLevel=0,p=vr(t,"OrchestratorAgent",e,n).orchestratorAgent.id,m="orch-top-input"):(p=ga(t,i,e,n).id,m="user-top-input"),It(u.id,p,e,r,t,o,s,"peer-bottom-output",m),t.currentSubflowIndex=-1}function dS(e,t,n,r){const o=vt(t);if(!o)return;const s=e.source||"UnknownSource",i=e.target||"User";let l,c="orch-bottom-output";const u=ao(t);if(u&&u.peerAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_")))l=u.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;wr(i)?(t.indentationLevel=0,f=vr(t,i,e,n).orchestratorAgent.id,p="orch-top-input",t.currentSubflowIndex=-1):(f=ga(t,o,e,n).id,p="user-top-input"),fS(l.id,f,e,r,t,c,p)}function fS(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 u=`error-edge-${e}${s||""}-to-${t}${i||""}-${n.id}`;if(!r.some(m=>m.id===u)){const m=((p=n.data.errorDetails)==null?void 0:p.message)||"Task failed",g=m.length>30?"Error":m,x={id:u,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 pS=(e,t={})=>{const n=[],r=[];if(!e||e.length===0)return{nodes:n,edges:r};const o=new Lp,s={phases:[],currentPhaseIndex:-1,currentSubflowIndex:-1,parallelFlows:new Map,nextAvailableGlobalY:q2,nodeIdCounter:0,allCreatedNodeIds:new Set,nodePositions:new Map,allUserNodes:[],userNodeCounter:0,agentRegistry:nS(),indentationLevel:0,indentationStep:50,agentNameMap:t},i=e.filter(u=>rS.includes(u.type)),l=i.findIndex(u=>u.type==="USER_REQUEST");let c=i;l>0&&(c=[i[l],...i.slice(0,l),...i.slice(l+1)]);for(const u of c)switch(u.type){case"USER_REQUEST":oS(u,s,n,r,o,e);break;case"AGENT_LLM_CALL":sS(u,s,n,r,o,e);break;case"AGENT_LLM_RESPONSE_TO_AGENT":case"AGENT_LLM_RESPONSE_TOOL_DECISION":iS(u,s,n,r,o,e);break;case"AGENT_TOOL_INVOCATION_START":aS(u,s,n,r,o,e);break;case"AGENT_TOOL_EXECUTION_RESULT":lS(u,s,n,r,o,e);break;case"AGENT_RESPONSE_TEXT":cS(u,s,n,r,o,e);break;case"TASK_COMPLETED":uS(u,s,n,r,o,e);break;case"TASK_FAILED":dS(u,s,n,r);break}return s.phases.forEach(u=>{u.subflows.forEach(f=>{const p=n.find(m=>m.id===f.groupNode.id);if(p&&p.style){const g=f.maxY-f.groupNode.yPosition+en;p.style.height=`${Math.max(tt+2*en,g)}px`;const x=f.maxContentXRelative+xr,h=Ft+2*xr+s.indentationLevel*s.indentationStep;p.style.width=`${Math.max(x,h)}px`}})}),{nodes:n,edges:r}},mS=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:s,targetPosition:i,style:l={},markerEnd:c,data:u})=>{const[f,p]=d.useState(!1),[m]=xm({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},w=u;return w!=null&&w.isError?{...v,stroke:f?"var(--color-error-wMain)":"var(--color-error-w70)",strokeWidth:f?3:2}:w!=null&&w.isSelected?{...v,stroke:"#3b82f6",strokeWidth:3}:w!=null&&w.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})]})},hS=({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(rt,{type:"target",position:ot.Top,id:"peer-top-input",className:"!bg-blue-700",isConnectable:!0}),a.jsx(rt,{type:"source",position:ot.Right,id:"peer-right-output-tools",className:"!bg-blue-700",style:{top:"25%"},isConnectable:!0}),a.jsx(rt,{type:"target",position:ot.Right,id:"peer-right-input-tools",className:"!bg-blue-700",style:{top:"75%"},isConnectable:!0}),a.jsx(rt,{type:"source",position:ot.Bottom,id:"peer-bottom-output",className:"!bg-blue-700",isConnectable:!0}),a.jsx(rt,{type:"target",position:ot.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})})]}),gS=({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(rt,{type:"target",position:ot.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(rt,{type:"source",position:ot.Left,id:`${t}-tool-bottom-output`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"75%"}})]})},xS=({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(rt,{type:"target",position:ot.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(rt,{type:"source",position:ot.Left,id:"llm-bottom-output",className:"!bg-teal-500",isConnectable:!0,style:{top:"75%"}})]})},vS=({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(rt,{type:"source",position:ot.Right,id:"orch-right-output-tools",className:"!bg-indigo-500",style:{top:"25%"},isConnectable:!0}),a.jsx(rt,{type:"target",position:ot.Right,id:"orch-right-input-tools",className:"!bg-indigo-500",style:{top:"75%"},isConnectable:!0}),a.jsx(rt,{type:"target",position:ot.Top,id:"orch-top-input",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(rt,{type:"source",position:ot.Bottom,id:"orch-bottom-output",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(rt,{type:"target",position:ot.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})})]}),wS=({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(rt,{type:"source",position:ot.Bottom,id:"user-bottom-output",className:"!bg-gray-500",isConnectable:!0}),e.isBottomNode&&a.jsx(rt,{type:"target",position:ot.Top,id:"user-top-input",className:"!bg-gray-500",isConnectable:!0}),!e.isTopNode&&!e.isBottomNode&&a.jsx(rt,{type:"source",position:ot.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})]})]})},bS=({step:e,isHighlighted:t,onClick:n,variant:r="list"})=>{const o=()=>{var w,b,y;switch(e.type){case"USER_REQUEST":return a.jsx(ym,{className:"mr-2 text-blue-500 dark:text-blue-400",size:18});case"AGENT_RESPONSE_TEXT":return a.jsx(vs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"TASK_COMPLETED":return a.jsx(lc,{className:"mr-2 text-green-500 dark:text-green-400",size:18});case"TASK_FAILED":return a.jsx(bm,{className:"mr-2 text-red-500 dark:text-red-400",size:18});case"AGENT_LLM_CALL":return a.jsx(vs,{className:"mr-2 text-purple-500 dark:text-purple-400",size:18});case"AGENT_LLM_RESPONSE_TO_AGENT":return a.jsx(vs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_LLM_RESPONSE_TOOL_DECISION":{const S=(b=(w=e.data.toolDecision)==null?void 0:w.decisions)==null?void 0:b[0];return(S==null?void 0:S.isPeerDelegation)?a.jsx(Ta,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18}):a.jsx(ka,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18})}case"AGENT_TOOL_INVOCATION_START":return(y=e.data.toolInvocationStart)!=null&&y.isPeerInvocation?a.jsx(Ta,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18}):a.jsx(ka,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18});case"AGENT_TOOL_EXECUTION_RESULT":return a.jsx(wm,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_ARTIFACT_NOTIFICATION":return a.jsx(fr,{className:"mr-2 text-indigo-500 dark:text-indigo-400",size:18});default:return a.jsx(vm,{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})]}),u=({data:w})=>{const[b,y]=ct.useState(!1),S=N=>{N.stopPropagation(),y(!b)};return b?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:S,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:S,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(b=>a.jsxs("li",{className:"flex items-center",children:[a.jsx("span",{className:"mr-2",children:"•"}),a.jsx("code",{children:b.toolName})]},b.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(Si,{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(Si,{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"?`
|
|
333
|
-
p-3 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors duration-150
|
|
334
|
-
${n?"cursor-pointer":""}
|
|
335
|
-
`:`
|
|
336
|
-
mb-3 p-3 border rounded-lg shadow-sm
|
|
337
|
-
bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
|
|
338
|
-
${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
|
|
339
|
-
${n?"cursor-pointer":""}
|
|
340
|
-
`,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: ";return a.jsxs("div",{className:h,style:x,onClick:n,children:[a.jsxs("div",{className:"mb-1.5 flex w-full items-center gap-1",children:[o(),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-wrap items-center justify-between gap-2",children:[a.jsx("h4",{className:"flex-1 truncate text-sm font-semibold",title:e.title,children:e.title}),a.jsx("span",{className:"text-muted-foreground shrink-0 font-mono text-xs",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(ac,{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(dr,{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(dr,{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(u,{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)]})},yS={genericAgentNode:hS,userNode:wS,llmNode:xS,orchestratorNode:vS,genericToolNode:gS},CS={defaultFlowEdge:mS},SS={x:16,y:0},ES=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,s]=Sm([]),[i,l,c]=Em([]),{fitView:u}=Tm(),{highlightedStepId:f,setHighlightedStepId:p}=ra(),{taskIdInSidePanel:m}=He(),{agentNameMap:g}=ud(),x=d.useRef([]),[h,v]=d.useState(!1),[w,b]=d.useState(null),[y,S]=d.useState(!1),N=d.useRef(null),[j,k]=d.useState(null),A=d.useRef(new Lp),G=d.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:pS(e,g),[e,g]),Q=d.useMemo(()=>G.edges.length?G.edges.map(E=>{const T=E.data;let M={isAnimated:!1,animationType:"none"};if(T!=null&&T.visualizerStepId){const ee=e.length-1;M=A.current.getEdgeAnimationState(T.visualizerStepId,ee,e)}let F=E.id===j;return f&&(T==null?void 0:T.visualizerStepId)===f&&(F=!0),{...E,animated:M.isAnimated,data:{...T,isAnimated:M.isAnimated,animationType:M.animationType,isSelected:F}}}):[],[G.edges,e,j,f]),O=d.useCallback(()=>{o(E=>E.map(T=>{var ue,ae,fe,ye;if(T.type!=="group")return T;const M=E.filter(Le=>Le.parentId===T.id);if(M.length===0)return T;let F=0,ee=0;M.forEach(Le=>{const Pe=Le.position.x+Ft,$e=Le.position.y+tt;F=Math.max(F,Pe),ee=Math.max(ee,$e)});const L=F+xr,U=ee+en;let Y=0;const J=T.id.split("_");if(J.length>2){const Le=J.find(Pe=>Pe.startsWith("subflow"));if(Le){const Pe=parseInt(Le.replace("subflow",""));isNaN(Pe)||(Y=Pe)}}const I=Ft+2*xr+Y*50,X=Math.max(L,I),re=parseInt(((ae=(ue=T.style)==null?void 0:ue.width)==null?void 0:ae.toString().replace("px",""))||"0"),ne=parseInt(((ye=(fe=T.style)==null?void 0:fe.height)==null?void 0:ye.toString().replace("px",""))||"0");return re!==X||ne!==U?{...T,style:{...T.style,width:`${X}px`,height:`${U}px`}}:T}))},[o]);d.useEffect(()=>{o(G.nodes),l(Q),O()},[G.nodes,Q,o,l,O]);const P=d.useCallback((E,T)=>i.find(M=>M.source===E&&(T?M.sourceHandle===T:!0))||null,[i]),K=d.useCallback((E,T)=>{var F;v(!0);const M=(F=T.data)==null?void 0:F.visualizerStepId;if(M){const ee=e.find(L=>L.id===M);ee&&(k(T.id),t?p(M):(p(M),b(ee),S(!0)))}},[e,t,p]),W=d.useCallback(E=>{switch(E.type){case"userNode":{const T=E.data;return T!=null&&T.isTopNode?["user-bottom-output"]:T!=null&&T.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[`${E.id}-tool-bottom-output`];default:return[]}},[]),z=d.useCallback(()=>{S(!1),b(null)},[]),_=d.useCallback((E,T)=>{if(v(!0),T.type==="group"){p(null),k(null),z();return}const M=W(T);let F=null;for(const ee of M)if(F=P(T.id,ee),F)break;if(!F&&T.type==="userNode"){const ee=T.data;ee!=null&&ee.isBottomNode&&(F=i.find(L=>L.target===T.id)||null)}F&&K(E,F)},[W,p,z,P,i,K]),q=d.useCallback(E=>{E!=null&&E.isTrusted&&v(!0)},[]);return d.useEffect(()=>{v(!1)},[m]),d.useEffect(()=>{!n&&u&&r.length>0&&x.current!==e&&h===!1&&(u({duration:200,padding:.1,maxZoom:1.2}),x.current=e)},[r.length,u,e,n,h]),d.useEffect(()=>{if(o(E=>E.map(T=>{var L;const M=((L=T.data)==null?void 0:L.visualizerStepId)&&T.data.visualizerStepId===f,F=G.nodes.find(U=>U.id===T.id),ee=(F==null?void 0:F.style)||{};return{...T,style:{...ee,boxShadow:M?"0px 4px 12px rgba(0, 0, 0, 0.2)":ee.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),f){const E=Q.find(T=>{const M=T.data;return(M==null?void 0:M.visualizerStepId)===f});E&&k(E.id)}else k(null)},[f,o,G.nodes,Q]),!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."}):G.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(km,{nodes:r,edges:i.map(E=>({...E,markerEnd:{type:Im.ArrowClosed,color:"#888"}})),onNodesChange:s,onEdgesChange:c,onEdgeClick:K,onNodeClick:_,onPaneClick:()=>{p(null),k(null),z()},onMoveStart:q,nodeTypes:yS,edgeTypes:CS,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(Am,{}),a.jsx(Nm,{className:kh()}),a.jsx(_m,{position:"top-right",className:"flex items-center space-x-4",children:a.jsx("div",{ref:N})})]}),a.jsx(sw,{isOpen:y,onClose:z,anchorRef:N,offset:SS,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:w&&a.jsx(bS,{step:w,variant:"popover"})})]})},TS=e=>a.jsx(Cm,{children:a.jsx(ES,{...e})}),zp=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}},Rr=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},Bp=(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;zp(l)===e&&(s=s.concat(Bp(l.taskId,t,n,r+1)))}return s},kS=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,s=new Map,i=(_,q)=>(r.agents[_]||(r.agents[_]={agentName:q,instanceId:_,displayName:q,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[_]),l=new Map,c=Bp(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const u=c.sort((_,q)=>new Date(Rr(_)).getTime()-new Date(Rr(q)).getTime()),f=[];let p,m="",g,x,h=[],v=null,w;const b=new Map,y=new Map,S=new Map,N=_=>{if(m.trim()&&g&&x){const q=m.trim();let E=n.taskId;if(h.length>0){const F=h[0].split("-");F.length>2&&F[1]!=="global"&&(E=F.slice(1,F.length-1).join("-"))}else _&&(E=_);const T=l.get(E)??0,M=b.get(E)||S.get(E);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:q},rawEventIds:[...h],isSubTaskStep:T>0,nestingLevel:T,owningTaskId:E,functionCallId:M}),v=q}m="",g=void 0,x=void 0,h=[],w=void 0};u.forEach((_,q)=>{var I,X,re,ne,ue,ae,fe,ye,Le,Pe,$e,Oe,Ue,Mt,Ye,Rt,it,at,lt,wt,zt,ce,Ct,bt,Bt,St,Et,Ke,ft,Ht,Tt,un,Lt,Pt,dn,kt,fn,pn,Ce,We,Ut,Jt,At,Dt,Qt;const E=Rr(_),T=`raw-${_.task_id||"global"}-${q}`,M=_.full_payload,F=_.task_id||n.taskId,ee=l.get(F)??0;let L=_.source_entity||"UnknownAgent";(re=(X=(I=M==null?void 0:M.params)==null?void 0:I.message)==null?void 0:X.metadata)!=null&&re.agent_name?L=M.params.message.metadata.agent_name:(ue=(ne=M==null?void 0:M.result)==null?void 0:ne.metadata)!=null&&ue.agent_name?L=M.result.metadata.agent_name:(Le=(ye=(fe=(ae=M==null?void 0:M.result)==null?void 0:ae.status)==null?void 0:fe.message)==null?void 0:ye.metadata)!=null&&Le.agent_name?L=M.result.status.message.metadata.agent_name:(Oe=($e=(Pe=M==null?void 0:M.result)==null?void 0:Pe.artifact)==null?void 0:$e.metadata)!=null&&Oe.agent_name&&(L=M.result.artifact.metadata.agent_name);let U;if(ee>0?U=b.get(F):U=S.get(F),_.direction==="request"&&ee>0){const Se=(Ue=M.params)==null?void 0:Ue.metadata,ke=Se==null?void 0:Se.function_call_id,Me=_.task_id;if(Me&&ke){b.set(Me,ke);return}}if(_.direction==="request"&&ee===0&&_.task_id===n.taskId){N(F),v=null;const Se=M.params;let ke="User request";if((Mt=Se==null?void 0:Se.message)!=null&&Mt.parts){const Me=Se.message.parts.filter(_e=>_e.kind==="text"&&_e.text);Me.length>0&&(ke=Me[Me.length-1].text)}f.push({id:`vstep-userreq-${f.length}-${T}`,type:"USER_REQUEST",timestamp:E,title:"User Input",source:"User",target:_.target_entity||L,data:{text:ke},rawEventIds:[T],isSubTaskStep:!1,nestingLevel:0,owningTaskId:F});return}if(_.direction==="status-update"&&(M!=null&&M.result)){const Se=M.result,ke=(Ye=Se.status)==null?void 0:Ye.message,Me=ke==null?void 0:ke.metadata;let _e;const Je=!!(Me!=null&&Me.forwarded_from_peer);Je?_e=Me.forwarded_from_peer:(Rt=Se.metadata)!=null&&Rt.agent_name?_e=Se.metadata.agent_name:Me!=null&&Me.agent_name?_e=Me.agent_name:_e=_.source_entity||"Agent";const qe=`${_e}:${F}`;if(!Je&&(ke!=null&&ke.parts))for(const Ge of ke.parts){if(Ge.kind==="data"){const Be=Ge.data;Be.type==="agent_progress_update"?p=Be.status_text:Be.type==="artifact_creation_progress"&&(p=`Saving artifact: ${Be.filename} (${Be.bytes_saved} bytes)`)}if(Ge.kind==="data"){N(F);const D=Ge.data;switch(D==null?void 0:D.type){case"agent_progress_update":{f.push({id:`vstep-progress-${f.length}-${T}`,type:"AGENT_RESPONSE_TEXT",timestamp:E,title:`${_e}: Progress Update`,source:_e,target:"User",data:{text:D.status_text},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U});break}case"llm_invocation":{const $=D.request;let H="System-initiated LLM call";if($!=null&&$.contents&&Array.isArray($.contents)&&$.contents.length>0){const V=[...$.contents].reverse().find(C=>C.role==="user");V&&V.parts&&(H=V.parts.map(C=>C.text||"").join(`
|
|
341
|
-
`).trim())}const oe={modelName:($==null?void 0:$.model)||"Unknown Model",promptPreview:H||"No text in user prompt."};i(qe,_e),o.set(qe,{timestamp:E,modelName:oe.modelName}),f.push({id:`vstep-llmcall-${f.length}-${T}`,type:"AGENT_LLM_CALL",timestamp:E,title:`${_e}: LLM Call`,source:_e,target:"LLM",data:{llmCall:oe},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U});break}case"llm_response":{const $=o.get(qe);if($){const C=new Date(E).getTime()-new Date($.timestamp).getTime();i(qe,_e).llmCalls.push({modelName:$.modelName,durationMs:C,timestamp:$.timestamp}),o.delete(qe)}const H=D.data,oe=(it=H.content)==null?void 0:it.parts,V=oe==null?void 0:oe.filter(C=>C.function_call);if(V&&V.length>0){N(F),v=null,S.delete(F);const C=V.map(te=>{var he;return{functionCallId:te.function_call.id,toolName:te.function_call.name,toolArguments:te.function_call.args||{},isPeerDelegation:(he=te.function_call.name)==null?void 0:he.startsWith("peer_")}}),R={decisions:C,isParallel:C.length>1},Z=[],le=new Set;C.forEach(te=>{if(te.isPeerDelegation){const he=te.toolName.substring(5);for(const Re in t){const we=t[Re];if(le.has(we.taskId))continue;if(zp(we)===F&&we.events&&we.events.length>0){const xe=we.events.find(Ee=>{var De,mn,xa,va;return Ee.direction==="request"&&((va=(xa=(mn=(De=Ee.full_payload)==null?void 0:De.params)==null?void 0:mn.message)==null?void 0:xa.metadata)==null?void 0:va.function_call_id)===te.functionCallId});if(xe&&new Date(Rr(xe)).getTime()>=new Date(E).getTime()){const Ee={functionCallId:te.functionCallId,peerAgentName:he,subTaskId:we.taskId};Z.push(Ee),y.set(te.functionCallId,Ee),we.taskId&&(b.set(we.taskId,te.functionCallId),le.add(we.taskId));break}}}}});const ve={id:`vstep-tooldecision-${f.length}-${T}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:E,title:`LLM: Tool Decision${R.isParallel?" (Parallel)":""}`,source:"LLM",target:_e,data:{toolDecision:R},rawEventIds:[T],delegationInfo:Z.length>0?Z:void 0,isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U};f.push(ve);const pe=R.isParallel?ve.id:void 0,Ae=qe;i(Ae,_e),C.forEach(te=>{var Re;const he=te.isPeerDelegation?(Re=y.get(te.functionCallId))==null?void 0:Re.subTaskId:void 0;s.has(te.functionCallId)||s.set(te.functionCallId,{timestamp:E,toolName:te.toolName,isPeer:te.isPeerDelegation,invokingAgentInstanceId:Ae,subTaskId:he,parallelBlockId:pe})})}else{const C=(oe==null?void 0:oe.filter(Z=>Z.text).map(Z=>Z.text).join(`
|
|
342
|
-
`))||"",R={responsePreview:C.substring(0,200)+(C.length>200?"...":""),isFinalResponse:(H==null?void 0:H.partial)===!1};f.push({id:`vstep-llmrespagent-${f.length}-${T}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:E,title:`${_e}: LLM Response`,source:"LLM",target:_e,data:{llmResponseToAgent:R},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U})}break}case"tool_invocation_start":{const $={functionCallId:D.function_call_id,toolName:D.tool_name,toolArguments:D.tool_args,isPeerInvocation:(at=D.tool_name)==null?void 0:at.startsWith("peer_")};f.push({id:`vstep-toolinvokestart-${f.length}-${T}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:E,title:`${_e}: Executing tool ${$.toolName}`,source:_e,target:$.toolName,data:{toolInvocationStart:$},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U});break}case"tool_result":{const $=D.function_call_id,H=s.get($);if(H){const V=new Date(E).getTime()-new Date(H.timestamp).getTime(),C=r.agents[H.invokingAgentInstanceId];if(C){const R={toolName:H.toolName,durationMs:V,isPeer:H.isPeer,timestamp:H.timestamp,peerAgentName:H.isPeer?H.toolName.substring(5):void 0,subTaskId:H.subTaskId,parallelBlockId:H.parallelBlockId};C.toolCalls.push(R)}s.delete($)}const oe={toolName:D.tool_name,functionCallId:$,resultData:D.result_data,isPeerResponse:(lt=D.tool_name)==null?void 0:lt.startsWith("peer_")};f.push({id:`vstep-toolresult-${f.length}-${T}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:E,title:`${_e}: Tool Result - ${oe.toolName}`,source:oe.toolName,target:_e,data:{toolResult:oe},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U});break}}}else Ge.kind==="text"&&Ge.text&&(g&&g!==_e&&(N(F),v=null),g||(g=_e,x=E,w=Je),m+=Ge.text,h.push(T))}return}if(_.direction==="artifact_update"&&((wt=M==null?void 0:M.result)!=null&&wt.artifact)){N(F);const Se=M.result.artifact,ke=((zt=Se.metadata)==null?void 0:zt.agent_name)||_.source_entity||"Agent";let Me;if(Se.parts&&Se.parts.length>0){const Je=Se.parts[0];Je.kind==="file"?Me=Je.file.mimeType||void 0:(ce=Je.metadata)!=null&&ce.mime_type&&(Me=Je.metadata.mime_type)}const _e={artifactName:Se.name||"Unnamed Artifact",version:typeof((Ct=Se.metadata)==null?void 0:Ct.version)=="number"?Se.metadata.version:void 0,description:Se.description||void 0,mimeType:Me};f.push({id:`vstep-artifactnotify-${f.length}-${T}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:E,title:`${ke}: Artifact Update - ${_e.artifactName}`,source:ke,target:"User/System",data:{artifactNotification:_e},rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U});return}if(["response","task"].includes(_.direction)&&((Bt=(bt=M==null?void 0:M.result)==null?void 0:bt.status)!=null&&Bt.state)){m.trim()&&N(F);const Se=M.result,ke=Se.status.state,Me=((St=Se.metadata)==null?void 0:St.agent_name)||((ft=(Ke=(Et=Se.status)==null?void 0:Et.message)==null?void 0:Ke.metadata)==null?void 0:ft.agent_name)||_.source_entity||"Agent";if(["completed","failed","canceled"].includes(ke)&&ee==0){const _e=ke==="completed"?"TASK_COMPLETED":"TASK_FAILED",Je=`${Me}: Task ${ke.charAt(0).toUpperCase()+ke.slice(1)}`;let qe={},Ge="";if((Ht=Se.status.message)!=null&&Ht.parts){const B=Se.status.message.parts.find($=>$.kind==="text");B!=null&&B.text&&(Ge=B.text.trim())}const Be=F===n.taskId,D=Ge&&(!Be||Ge!==v);if(_e==="TASK_COMPLETED")qe={finalMessage:D?Ge:void 0};else{const $={message:D?Ge:`Task ${ke}.`},H=M.error;H&&($.message=H.message||$.message,$.code=H.code,H.data&&($.details=H.data)),Se.error&&($.message=Se.error.message||$.message,$.code=Se.error.code||$.code,$.details=Se.error.data||$.details),qe={errorDetails:$}}f.push({id:`vstep-${ke}-${f.length}-${T}`,type:_e,timestamp:E,title:Je,source:Me,target:"User",data:qe,rawEventIds:[T],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:F,functionCallId:U}),Be&&(v=null);return}}const Y=_.direction==="status-update"&&((Pt=(Lt=(un=(Tt=M==null?void 0:M.result)==null?void 0:Tt.status)==null?void 0:un.message)==null?void 0:Lt.parts)==null?void 0:Pt.some(Se=>Se.kind==="text"));let J=_.source_entity;(pn=(fn=(kt=(dn=M==null?void 0:M.result)==null?void 0:dn.status)==null?void 0:kt.message)==null?void 0:fn.metadata)!=null&&pn.forwarded_from_peer?J=M.result.status.message.metadata.forwarded_from_peer:(We=(Ce=M==null?void 0:M.result)==null?void 0:Ce.metadata)!=null&&We.agent_name?J=M.result.metadata.agent_name:(Dt=(At=(Jt=(Ut=M==null?void 0:M.result)==null?void 0:Ut.status)==null?void 0:Jt.message)==null?void 0:At.metadata)!=null&&Dt.agent_name&&(J=M.result.status.message.metadata.agent_name),m.trim()&&g&&(!Y||Y&&J!==g)&&(N(F),l.get(((Qt=h[0])==null?void 0:Qt.split("-")[1])||n.taskId)===0&&!w&&(v=null))});const j=u.length>0&&u[u.length-1].task_id||n.taskId;N(j);const k=u[0]?Rr(u[0]):n.firstSeen.toISOString();let A,G="working";const Q=f.filter(_=>_.owningTaskId===n.taskId),O=Q.length>0?Q[Q.length-1]:null;if(O&&(O.type==="TASK_COMPLETED"?(G="completed",A=O.timestamp):O.type==="TASK_FAILED"&&(G="failed",A=O.timestamp)),G==="working"&&u.length>0){const _=u[u.length-1];t[_.task_id||n.taskId]}let P;k&&A&&(P=new Date(A).getTime()-new Date(k).getTime()),["completed","failed","canceled","rejected"].includes(G)&&(p=void 0);const K={taskId:n.taskId,initialRequestText:n.initialRequestText,status:G,currentStatusText:p,startTime:k,endTime:A,durationMs:P,steps:f};K.steps.forEach((_,q)=>{if(_.type==="TASK_COMPLETED"){let E="";for(let T=q-1;T>=0;T--){const M=K.steps[T];if(M.type!=="AGENT_RESPONSE_TEXT"||M.source!==_.source)break;E=M.data.text+E}_.data.finalMessage&&(E+=_.data.finalMessage),_.data.finalMessage=E.trim()||void 0}}),Object.values(r.agents).forEach(_=>{_.totalLlmTimeMs=_.llmCalls.reduce((F,ee)=>F+ee.durationMs,0);const q=_.toolCalls.filter(F=>!F.parallelBlockId),E=new Map;_.toolCalls.forEach(F=>{F.parallelBlockId&&(E.has(F.parallelBlockId)||E.set(F.parallelBlockId,[]),E.get(F.parallelBlockId).push(F))});const T=q.reduce((F,ee)=>F+ee.durationMs,0);let M=0;E.forEach(F=>{if(F.length>0){const ee=Math.min(...F.map(U=>new Date(U.timestamp).getTime())),L=Math.max(...F.map(U=>new Date(U.timestamp).getTime()+U.durationMs));M+=L-ee}}),_.totalToolTimeMs=T+M});const W=new Map;Object.values(r.agents).forEach(_=>{W.has(_.agentName)||W.set(_.agentName,[]),W.get(_.agentName).push(_)}),W.forEach(_=>{_.length>1&&(_.sort((q,E)=>{const T=M=>{const F=[...M.llmCalls.map(ee=>new Date(ee.timestamp).getTime()),...M.toolCalls.map(ee=>new Date(ee.timestamp).getTime())];return F.length>0?Math.min(...F):1/0};return T(q)-T(E)}),_.forEach((q,E)=>{q.displayName=`${q.agentName} (${E+1})`}))});const z=new Map;return Object.values(r.agents).forEach(_=>{const q=_.instanceId.split(":").slice(1).join(":");q&&z.set(q,_.displayName)}),Object.values(r.agents).forEach(_=>{_.toolCalls.forEach(q=>{if(q.isPeer&&q.subTaskId){const E=z.get(q.subTaskId);E&&(q.peerAgentName=E)}})}),P!==void 0&&(r.overall.totalTaskDurationMs=P),K.performanceReport=r,K},AS=({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(_S,{onClick:o}),a.jsx(jS,{items:e,bottomItems:t,activeItem:n,onItemClick:s})]})},NS=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"})]}),_S=({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:NS})}),IS=()=>{const{currentTheme:e,toggleTheme:t}=us(),n=`Toggle theme (currently ${e})`;return a.jsxs(Wi,{children:[a.jsx(Vi,{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(pc,{className:"mb-1 h-6 w-6"})})}),a.jsx(Gi,{side:"right",children:n})]})},jS=({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(IS,{}):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=u=>{(u.key==="Enter"||u.key===" ")&&l()};return a.jsxs(Wi,{children:[a.jsx(Vi,{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(Gi,{side:"right",children:o})]})},Jl=[{id:"chat",label:"Chat",icon:cc},{id:"agentMesh",label:"Agents",icon:ic}],Ql=[{id:"theme-toggle",label:"Theme",icon:pc,onClick:()=>{}}],Hp=({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(ct.Fragment,{children:[i>0&&a.jsx("span",{className:"mx-1",children:a.jsx(jm,{size:16})}),s.onClick?a.jsx(me,{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(ct.Fragment,{children:s},i))})]});function MS(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=He(),[o,s]=d.useState("cards"),i=()=>{if(o===Gl.CARDS)return a.jsx(xi,{agents:e});const l=jp.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),a.jsx(xi,{agents:e}))};return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(Hp,{title:"Agents",buttons:[a.jsxs(me,{"data-testid":"refreshAgents",disabled:t,variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[a.jsx(dc,{className:"size-4"}),"Refresh Agents"]})]}),t?a.jsx(Yr,{title:"Loading agents...",variant:"loading"}):n?a.jsx(Yr,{variant:"error",title:"Error loading agents",subtitle:n}):a.jsxs("div",{className:`relative flex-1 p-4 ${o===Gl.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(YC,{currentLayout:o,onLayoutChange:s})}),i()]})]})}const RS=ct.memo(({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?a.jsx(Qr,{open:e,onOpenChange:t,children:a.jsxs(eo,{children:[a.jsxs(to,{children:[a.jsx(no,{children:"Delete Chat Session?"}),a.jsxs(ro,{children:["This action cannot be undone. This chat session and any associated artifacts will be permanently deleted: ",a.jsx("strong",{children:r})]})]}),a.jsxs(Qi,{children:[a.jsx(me,{variant:"outline",onClick:t,title:"Cancel",children:"Cancel"}),a.jsx(me,{onClick:n,title:"Delete",children:"Delete"})]})]})}):null),To=4,Ci={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},LS={chatPanelSizes:{...Ci.chatPanelSizes,min:50},sidePanelSizes:{...Ci.sidePanelSizes,max:50}};function PS(){var E;const{agents:e,messages:t,isSidePanelCollapsed:n,setIsSidePanelCollapsed:r,openSidePanelTab:o,setTaskIdInSidePanel:s,isResponding:i,latestStatusText:l,sessionToDelete:c,closeSessionDeleteModal:u,confirmSessionDelete:f,sessionName:p}=He(),{isTaskMonitorConnected:m,isTaskMonitorConnecting:g,taskMonitorSseError:x,connectTaskMonitorStream:h}=ra(),[v,w]=d.useState(!0),[b,y]=d.useState(!1),S=d.useRef(null),N=d.useRef(null),j=d.useRef(null),{chatPanelSizes:k,sidePanelSizes:A}=d.useMemo(()=>v?Ci:LS,[v]),G=d.useCallback(T=>{if(y(!0),N.current)if(T)N.current.resize(To);else{const M=j.current||A.default;N.current.resize(M)}setTimeout(()=>y(!1),300)},[A.default]),Q=d.useCallback(()=>{r(!0)},[r]),O=d.useCallback(()=>{r(!1)},[r]),P=d.useCallback(T=>{T>To+1&&(j.current=T)},[]),K=d.useCallback(()=>{w(!v)},[v]);d.useEffect(()=>{N.current&&n&&N.current.resize(To);const T=()=>{if(N.current&&n){y(!0);const M=j.current||A.default;N.current.resize(M),r(!1),setTimeout(()=>y(!1),300)}};return window.addEventListener("expand-side-panel",T),()=>{window.removeEventListener("expand-side-panel",T)}},[n,r,A.default]);const W=d.useMemo(()=>{const T=new Map;return t.forEach((M,F)=>{M.taskId&&T.set(M.taskId,F)}),T},[t]),z=d.useMemo(()=>t.find(T=>T.isStatusBubble),[t]),_=d.useMemo(()=>{if(!z||!z.parts)return null;const T=z.parts.find(M=>M.kind==="text");return(T==null?void 0:T.text)||null},[z]),q=d.useMemo(()=>{if(z!=null&&z.taskId)return()=>{s(z.taskId),o("workflow")}},[z==null?void 0:z.taskId,s,o]);return d.useEffect(()=>{const T=()=>{!m&&!g&&x&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),h())};return window.addEventListener("focus",T),()=>{window.removeEventListener("focus",T)}},[m,g,x,h]),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 ${v?"-translate-x-full":"translate-x-0"}`,children:a.jsx(G2,{onToggle:K})}),a.jsx("div",{className:`transition-all duration-300 ${v?"ml-0":"ml-100"}`,children:a.jsx(Hp,{title:p||"New Chat",leadingAction:v?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(me,{"data-testid":"showSessionsPanel",variant:"ghost",onClick:K,className:"h-10 w-10 p-0",tooltip:"Show Chat Sessions",children:a.jsx(fc,{className:"size-5"})}),a.jsx("div",{className:"h-6 border-r"}),a.jsx(Rp,{})]}):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 ${v?"ml-0":"ml-100"}`,children:a.jsxs(Sv,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[a.jsx(ml,{defaultSize:k.default,minSize:k.min,maxSize:k.max,id:"chat-panel",children:a.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[a.jsx(Tf,{className:"text-base",ref:S,children:t.map((T,M)=>{var L;const F=!!(T.taskId&&W.get(T.taskId)===M),ee=((L=T.metadata)==null?void 0:L.messageId)||`temp-${M}`;return a.jsx(k2,{message:T,isLastWithTaskId:F},ee)})}),a.jsxs("div",{style:Ef,children:[i&&a.jsx(wi,{statusText:(_||l.current)??void 0,onViewWorkflow:q}),a.jsx(E1,{agents:e,scrollToBottom:(E=S.current)==null?void 0:E.scrollToBottom})]})]})}),a.jsx(Ev,{}),a.jsx(ml,{ref:N,defaultSize:A.default,minSize:A.min,maxSize:A.max,collapsedSize:To,collapsible:!0,onCollapse:Q,onExpand:O,onResize:P,id:"chat-side-panel",className:b?"transition-all duration-300 ease-in-out":"",children:a.jsx("div",{className:"h-full",children:a.jsx(V2,{onCollapsedToggle:G,isSidePanelCollapsed:n,setIsSidePanelCollapsed:r,isSidePanelTransitioning:b})})})]})})}),a.jsx(RS,{isOpen:!!c,onClose:u,onConfirm:f,sessionName:(c==null?void 0:c.name)||`Session ${c==null?void 0:c.id.substring(0,8)}`})]})}const DS=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)"}}),Si=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=us(),o=d.useMemo(()=>DS(r==="dark"),[r]),s=d.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=d.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(Mm,{data:i,theme:o,viewOnly:!0,collapse:s,showStringQuotes:!0,showCollectionCount:"when-closed"})})};function OS(){const[e,t]=d.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=$v();if(zv(),o&&!n)return a.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:a.jsx(me,{onClick:r,children:"Login"})});const s=c=>{const u=Jl.find(f=>f.id===c)||Ql.find(f=>f.id===c);u!=null&&u.onClick&&c!=="settings"?u.onClick():c!=="settings"&&t(c)},i=()=>{t("chat")},l=()=>{switch(e){case"chat":return a.jsx(PS,{});case"agentMesh":return a.jsx(MS,{})}};return a.jsxs("div",{className:"relative flex h-screen",children:[a.jsx(AS,{items:Jl,bottomItems:Ql,activeItem:e,onItemChange:s,onHeaderClick:i}),a.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:l()}),a.jsx(y1,{})]})}function FS(){return a.jsx(v2,{children:a.jsx(c2,{children:a.jsx(qC,{children:a.jsx(s2,{children:a.jsx(o2,{children:a.jsx(XC,{children:a.jsx(OS,{})})})})})})})}Vp.createRoot(document.getElementById("root")).render(a.jsx(d.StrictMode,{children:a.jsx(FS,{})}));
|