@shepai/cli 1.202.1-pr606.60460ac → 1.202.2
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.
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/build-manifest.json +2 -2
- package/web/.next/fallback-build-manifest.json +2 -2
- package/web/.next/prerender-manifest.json +3 -3
- package/web/.next/required-server-files.js +2 -2
- package/web/.next/required-server-files.json +2 -2
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page/server-reference-manifest.json +37 -37
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/adopt/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/chat/page/server-reference-manifest.json +35 -35
- package/web/.next/server/app/(dashboard)/@drawer/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +47 -47
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +47 -47
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/chat/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/chat/page/server-reference-manifest.json +35 -35
- package/web/.next/server/app/(dashboard)/chat/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/chat/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/control-center/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/control-center/page/server-reference-manifest.json +35 -35
- package/web/.next/server/app/(dashboard)/control-center/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/control-center/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/create/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +38 -38
- package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +47 -47
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +47 -47
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/[tab]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +36 -36
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
- package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/server/app/_not-found/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/_not-found/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agent-questions/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/agent-questions/page/server-reference-manifest.json +11 -11
- package/web/.next/server/app/agent-questions/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents/[agentType]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/agents/[agentType]/page/server-reference-manifest.json +13 -13
- package/web/.next/server/app/agents/[agentType]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/agents/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/agents/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/application/[id]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/application/[id]/page/server-reference-manifest.json +18 -18
- package/web/.next/server/app/application/[id]/page.js.nft.json +1 -1
- package/web/.next/server/app/application/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/application/[id]/supervisor/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/application/[id]/supervisor/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/application/[id]/supervisor/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/applications/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/applications/page/server-reference-manifest.json +20 -20
- package/web/.next/server/app/applications/page.js.nft.json +1 -1
- package/web/.next/server/app/applications/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/features/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/features/page/server-reference-manifest.json +31 -31
- package/web/.next/server/app/features/page.js.nft.json +1 -1
- package/web/.next/server/app/features/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/onboarding/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/onboarding/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/projects/[slug]/items/[itemId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/projects/[slug]/items/[itemId]/page/server-reference-manifest.json +16 -16
- package/web/.next/server/app/projects/[slug]/items/[itemId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/projects/[slug]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/projects/[slug]/page/server-reference-manifest.json +28 -28
- package/web/.next/server/app/projects/[slug]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/projects/[slug]/pages/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/projects/[slug]/pages/page/server-reference-manifest.json +12 -12
- package/web/.next/server/app/projects/[slug]/pages/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/projects/[slug]/settings/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/projects/[slug]/settings/page/server-reference-manifest.json +18 -18
- package/web/.next/server/app/projects/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/projects/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/projects/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/settings/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/settings/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/skills/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/skills/page/server-reference-manifest.json +17 -17
- package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/supervisor/feature/[featureId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/supervisor/feature/[featureId]/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/supervisor/feature/[featureId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/supervisor/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/supervisor/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/supervisor/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/supervisor/repo/[repositoryId]/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/supervisor/repo/[repositoryId]/page/server-reference-manifest.json +10 -10
- package/web/.next/server/app/supervisor/repo/[repositoryId]/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/tools/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/tools/page/server-reference-manifest.json +15 -15
- package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
- package/web/.next/server/app/version/page/react-loadable-manifest.json +4 -4
- package/web/.next/server/app/version/page/server-reference-manifest.json +9 -9
- package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
- package/web/.next/server/chunks/[root-of-the-server]__10e976f3._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_agent-questions_page_actions_4b694f8d.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_agent-questions_page_actions_4b694f8d.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_agents_[agentType]_page_actions_103679a6.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_agents_[agentType]_page_actions_103679a6.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_projects_[slug]_pages_page_actions_19d50f6c.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web__next-internal_server_app_projects_[slug]_pages_page_actions_19d50f6c.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_app_projects_[slug]_items_[itemId]_work-item-detail-client_tsx_d2e02407._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_app_projects_[slug]_items_[itemId]_work-item-detail-client_tsx_d2e02407._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_app_projects_[slug]_settings_project-settings-client_tsx_e8b85ddc._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_app_projects_[slug]_settings_project-settings-client_tsx_e8b85ddc._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js +2 -2
- package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_feature-drawer-client_tsx_e9755fc8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js +1 -1
- package/web/.next/server/chunks/ssr/744ca_web_components_features_applications_applications-page-client_tsx_d0db9938._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0af8610a._.js +3 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0af8610a._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__0b652a2f._.js +1 -1
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__8b73253b._.js → [root-of-the-server]__2e388ba3._.js} +2 -2
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__8b73253b._.js.map → [root-of-the-server]__2e388ba3._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__56cf47e7._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__56cf47e7._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__648730d4._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__68df6415._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__68df6415._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6bc6bf96._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__6bc6bf96._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__9852cb08._.js +2 -2
- package/web/.next/server/chunks/ssr/[root-of-the-server]__9852cb08._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a1167cec._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a1167cec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__a12d0ad7._.js +3 -0
- package/web/.next/server/chunks/ssr/{[root-of-the-server]__52ca7f88._.js.map → [root-of-the-server]__a12d0ad7._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ba699bec._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ba699bec._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e0741ee1._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e0fa59e6._.js +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__e0fa59e6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ea26ff90._.js +3 -3
- package/web/.next/server/chunks/ssr/[root-of-the-server]__ff0095e3._.js +1 -1
- package/web/.next/server/chunks/ssr/_07036593._.js +1 -1
- package/web/.next/server/chunks/ssr/_07036593._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_0d2a7595._.js +1 -1
- package/web/.next/server/chunks/ssr/_0d2a7595._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_101de7c3._.js +1 -1
- package/web/.next/server/chunks/ssr/_101de7c3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_db111d21._.js → _10f54ace._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_db111d21._.js.map → _10f54ace._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_24fca3cf._.js +1 -1
- package/web/.next/server/chunks/ssr/_24fca3cf._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_6ff832ad._.js → _2759af76._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_6ff832ad._.js.map → _2759af76._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_2bc48f3d._.js +1 -1
- package/web/.next/server/chunks/ssr/_2bc48f3d._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_fb539286._.js → _2bef1982._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_fb539286._.js.map → _2bef1982._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_32f66845._.js +1 -1
- package/web/.next/server/chunks/ssr/_408848e6._.js +1 -1
- package/web/.next/server/chunks/ssr/_408848e6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_40e02782._.js +1 -1
- package/web/.next/server/chunks/ssr/_40e02782._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_486d45d6._.js +1 -1
- package/web/.next/server/chunks/ssr/_486d45d6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_824d5772._.js → _498cba11._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_824d5772._.js.map → _498cba11._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js +1 -1
- package/web/.next/server/chunks/ssr/_56b9d60f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_5cbb0e22._.js +1 -1
- package/web/.next/server/chunks/ssr/_5cbb0e22._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_5a3edc88._.js → _673be4f1._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_5a3edc88._.js.map → _673be4f1._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_7ba67729._.js +1 -1
- package/web/.next/server/chunks/ssr/_7ba67729._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_805ae1aa._.js +1 -1
- package/web/.next/server/chunks/ssr/_805ae1aa._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_87cf18c3._.js +1 -1
- package/web/.next/server/chunks/ssr/_87cf18c3._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_8a700ff4._.js +1 -1
- package/web/.next/server/chunks/ssr/_8a700ff4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_95b97274._.js +1 -1
- package/web/.next/server/chunks/ssr/_95b97274._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_fbcfaf3a._.js → _9d18d1b1._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_fbcfaf3a._.js.map → _9d18d1b1._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/{_70ff64a1._.js → _a93687e6._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_70ff64a1._.js.map → _a93687e6._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_c2e196ee._.js +1 -1
- package/web/.next/server/chunks/ssr/_c2e196ee._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ca3b7bf7._.js +1 -1
- package/web/.next/server/chunks/ssr/_ca3b7bf7._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d53224a9._.js +1 -1
- package/web/.next/server/chunks/ssr/_d53224a9._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_d573dcc2._.js +1 -1
- package/web/.next/server/chunks/ssr/_e2671e14._.js +1 -1
- package/web/.next/server/chunks/ssr/_e2671e14._.js.map +1 -1
- package/web/.next/server/chunks/ssr/_ecd45b17._.js +1 -1
- package/web/.next/server/chunks/ssr/_ecd45b17._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_f0d45e47._.js → _f46d2018._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_f0d45e47._.js.map → _f46d2018._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/_f602cc9f._.js +1 -1
- package/web/.next/server/chunks/ssr/_f602cc9f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{_20a56008._.js → _f71954a5._.js} +2 -2
- package/web/.next/server/chunks/ssr/{_20a56008._.js.map → _f71954a5._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
- package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
- package/web/.next/server/chunks/ssr/f3a1f_components_common_control-center-drawer_repository-drawer-client_tsx_39a00c03._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_0e291f0b._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_0e291f0b._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_40673f0c._.js → src_presentation_web_16c83ab4._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_40673f0c._.js.map → src_presentation_web_16c83ab4._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_1d8d177f._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_1d8d177f._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_450b58fc._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_450b58fc._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_47727150._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_47727150._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_64fcfc84._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_64fcfc84._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74b7bdb2._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_74b7bdb2._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_82aeca34._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_82aeca34._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_8a564d47._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_8a564d47._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_9a543843._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app__not-found_page_actions_f4f3fad9.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app__not-found_page_actions_f4f3fad9.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_agents_page_actions_d4bd4711.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_agents_page_actions_d4bd4711.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_onboarding_page_actions_bb695e8d.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_onboarding_page_actions_bb695e8d.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_page_actions_ac47e420.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_page_actions_ac47e420.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_projects_page_actions_c91a23a8.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_projects_page_actions_c91a23a8.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_version_page_actions_63c2d912.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_version_page_actions_63c2d912.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a53a3da6._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_a53a3da6._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_246617fe._.js +3 -3
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_adopt-local-directory_ts_75f1f28c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_adopt-local-directory_ts_75f1f28c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_approve-feature_ts_9453ce8b._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-directory_ts_1209d917._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_actions_open-directory_ts_1209d917._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_app_features_feature-tree-page-client_tsx_34c5cbbf._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b1b3c26c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b1b3c26c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b98a4353._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_b98a4353._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_c96ca051._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_c96ca051._.js.map +1 -1
- package/web/.next/server/chunks/ssr/{src_presentation_web_e812a69b._.js → src_presentation_web_cb0d2c28._.js} +2 -2
- package/web/.next/server/chunks/ssr/{src_presentation_web_e812a69b._.js.map → src_presentation_web_cb0d2c28._.js.map} +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_66643378._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_66643378._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_agent-editor_agent-editor-tabs_tsx_d5a954b4._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_agent-editor_agent-editor-tabs_tsx_d5a954b4._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_components_features_skills_8a174cac._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_d3858f16._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_d3858f16._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_d7f8130c._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_d7f8130c._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_dddd8ccd._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_dddd8ccd._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e13d58b0._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_e13d58b0._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ee94a9aa._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_ee94a9aa._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f0fcfdff._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f0fcfdff._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f17e8516._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f17e8516._.js.map +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f7180fec._.js +1 -1
- package/web/.next/server/chunks/ssr/src_presentation_web_f7180fec._.js.map +1 -1
- package/web/.next/server/pages/500.html +2 -2
- package/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/server/server-reference-manifest.json +111 -111
- package/web/.next/static/chunks/{5faa828877b1e669.js → 03dda23205877d8b.js} +1 -1
- package/web/.next/static/chunks/{4bf4f333302e24a4.js → 054e3a5f5ff4db71.js} +1 -1
- package/web/.next/static/chunks/{a868014dbe1b4e42.js → 06e58041911c290b.js} +1 -1
- package/web/.next/static/chunks/{b5ff852fee23795d.js → 089ef5b749d79ebd.js} +1 -1
- package/web/.next/static/chunks/{1a093b13a9d6952e.js → 0d106010c498c198.js} +2 -2
- package/web/.next/static/chunks/193e5a0540757f5e.js +1 -0
- package/web/.next/static/chunks/{9abc3e68af98e636.js → 25111a2f2597f500.js} +1 -1
- package/web/.next/static/chunks/285e724d07901ef6.js +1 -0
- package/web/.next/static/chunks/{3c396f63ebefe875.js → 2b2bfc0465b18a7d.js} +1 -1
- package/web/.next/static/chunks/{6af99a08ccacdbce.js → 2b436562e69d2827.js} +1 -1
- package/web/.next/static/chunks/{8c96a835b3b0dc44.js → 2e3844d0ac487ac7.js} +1 -1
- package/web/.next/static/chunks/325859b8a9482427.js +1 -0
- package/web/.next/static/chunks/{2773e7b2587bc9cc.js → 44ab458ceb89d85d.js} +1 -1
- package/web/.next/static/chunks/4fdf36904f5421a6.js +1 -0
- package/web/.next/static/chunks/59004c65d552581c.js +1 -0
- package/web/.next/static/chunks/{0edcdc8a2dd06b7a.js → 5c4837e88a3431b8.js} +1 -1
- package/web/.next/static/chunks/{a131f868af7f1f7c.js → 74cdd562eb663f72.js} +1 -1
- package/web/.next/static/chunks/{0315591c972888a6.js → 7670d76d4ee743e6.js} +1 -1
- package/web/.next/static/chunks/{02d88da9fd656fcd.js → 83fc784ce05a701e.js} +1 -1
- package/web/.next/static/chunks/{460cedaa85c821e7.js → 8dd4fdd20b103a66.js} +1 -1
- package/web/.next/static/chunks/9336bdc7fc319282.js +1 -0
- package/web/.next/static/chunks/9d285565922b2de7.js +1 -0
- package/web/.next/static/chunks/{45eeca36eabbed23.js → 9f7f2a11937d87eb.js} +1 -1
- package/web/.next/static/chunks/{c3931fdbae836be6.js → a7c7bcfb6f7696a3.js} +1 -1
- package/web/.next/static/chunks/{9f7985e2a73929a2.js → a8f57d2a12849f32.js} +1 -1
- package/web/.next/static/chunks/{0e1c933065a1100a.js → abe98954ccdf29db.js} +1 -1
- package/web/.next/static/chunks/{4378715fa2b5e7de.js → b05808da85e8b34c.js} +1 -1
- package/web/.next/static/chunks/{b5dc7979d66caa38.js → b5f83e5e1dad23d5.js} +1 -1
- package/web/.next/static/chunks/{6d2074fa3453d333.js → b8293a56f257e5a2.js} +1 -1
- package/web/.next/static/chunks/{bc5b87e4068ba11d.js → c61c5e97c76dc733.js} +1 -1
- package/web/.next/static/chunks/c6b411bf31744ca7.js +1 -0
- package/web/.next/static/chunks/{bdaa907bf3d1d932.js → c732d6cc4c5e4343.js} +1 -1
- package/web/.next/static/chunks/{25a200f055ae5cba.js → d214d6a670f48d79.js} +1 -1
- package/web/.next/static/chunks/{6901861cb53ab483.js → d7b17a93a26e97c8.js} +1 -1
- package/web/.next/static/chunks/{a0325f77bbccc63d.js → d8f14fac959a6bd0.js} +1 -1
- package/web/.next/static/chunks/{24ea54516dc249c0.js → d98912f5b6cf4938.js} +1 -1
- package/web/.next/static/chunks/{21500b3fe3754296.js → df79667c16344317.js} +1 -1
- package/web/.next/static/chunks/{05e8df10619fb980.js → ec8f19328ad1ecd4.js} +1 -1
- package/web/.next/static/chunks/{e6e6ba783b2e4d14.js → f0157331838ac962.js} +1 -1
- package/web/.next/static/chunks/{c687ed21b9518d73.js → f757d865fae71faf.js} +1 -1
- package/web/.next/static/chunks/fb3cbb7f575a7128.js +1 -0
- package/web/.next/server/chunks/ssr/[root-of-the-server]__52ca7f88._.js +0 -3
- package/web/.next/static/chunks/03d7b81c2554d52f.js +0 -1
- package/web/.next/static/chunks/15acdaaea57bb459.js +0 -1
- package/web/.next/static/chunks/39fe1c1397d5483b.js +0 -1
- package/web/.next/static/chunks/495883829026f13f.js +0 -1
- package/web/.next/static/chunks/4b3a4f416a6eb1ac.js +0 -1
- package/web/.next/static/chunks/4b4160f36cf2a3d6.js +0 -1
- package/web/.next/static/chunks/7269537b2188650d.js +0 -1
- package/web/.next/static/chunks/b1534b2f3d814fef.js +0 -1
- package/web/.next/static/chunks/f6dc1ba364203bb2.js +0 -1
- /package/web/.next/static/{My4IQDygZ4BFTXkkKanja → 9zd-B2rWybTaAgE74IKiK}/_buildManifest.js +0 -0
- /package/web/.next/static/{My4IQDygZ4BFTXkkKanja → 9zd-B2rWybTaAgE74IKiK}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{My4IQDygZ4BFTXkkKanja → 9zd-B2rWybTaAgE74IKiK}/_ssgManifest.js +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
${t.system}`:e.system=t.system),t.tools)for(let[n,r]of Object.entries(t.tools)){let t=e.tools?.[n];if(t&&t!==r)throw Error(`You tried to define a tool with the name ${n}, but it already exists.`);e.tools||(e.tools={}),e.tools[n]=r}return t.config&&(e.config={...e.config,...t.config}),t.callSettings&&(e.callSettings={...e.callSettings,...t.callSettings}),e},{})}registerModelContextProvider(e){this._providers.add(e);let t=e.subscribe?.(()=>{this.notifySubscribers()});return this.notifySubscribers(),()=>{this._providers.delete(e),t?.(),this.notifySubscribers()}}_subscribers=new Set;notifySubscribers(){for(let e of this._subscribers)e()}subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}}e.s(["CompositeContextProvider",()=>eW],979533);let eK=b(()=>{let[e]=I(()=>({version:2})),t=S(()=>new eW,[]);return{getState:()=>e,getModelContext:()=>t.getModelContext(),subscribe:e=>t.subscribe(e),register:e=>t.registerModelContextProvider(e)}}),eG=b(e=>({getState:()=>e})),eJ=b(e=>{let[t]=I(()=>({suggestions:(e??[]).map(e=>"string"==typeof e?{title:e,label:"",prompt:e}:{title:e.title,label:e.label,prompt:e.prompt})})),n=eM(()=>t.suggestions.map((e,t)=>D(t,eG(e))),[t.suggestions]);return{getState:()=>t,suggestion:({index:e})=>n.get({index:e})}}),eQ=b(e=>{let t=ey().clientRef;return C(()=>e.registerModelContextProvider(t.current.modelContext()),[e,t]),P(eV({runtime:e.threads,__internal_assistantRuntime:e}))}),eY=b(()=>{let[e,t]=I(()=>({renderers:{}}));return{getState:()=>e,setDataUI:j((e,n)=>(t(t=>({...t,renderers:{...t.renderers,[e]:[...t.renderers[e]??[],n]}})),()=>{t(t=>({...t,renderers:{...t.renderers,[e]:t.renderers[e]?.filter(e=>e!==n)??[]}}))}),[])}}),eX=b(({toolkit:e})=>{let[t,n]=I(()=>({tools:{}})),r=ey().clientRef,i=j((e,t)=>(n(n=>({...n,tools:{...n.tools,[e]:[...n.tools[e]??[],t]}})),()=>{n(n=>({...n,tools:{...n.tools,[e]:n.tools[e]?.filter(e=>e!==t)??[]}}))}),[]);return C(()=>{if(!e)return;let t=[];for(let[n,r]of Object.entries(e))r.render&&t.push(i(n,r.render));let n=Object.entries(e).reduce((e,[t,n])=>{let{render:r,...i}=n;return e[t]=i,e},{});return t.push(r.current.modelContext().register({getModelContext:()=>({tools:n})})),()=>{t.forEach(e=>e())}},[e,i,r]),{getState:()=>t,setToolUI:i}});ef(eX,(e,t)=>({...e,...e.modelContext||null!==t.modelContext.source?{}:{modelContext:eK()}}));let eZ=b(e=>P(eQ(e)));ef(eZ,(e,t)=>{let n,r=((n={...e,thread:e.thread??eh({source:"threads",query:{type:"main"},get:e=>e.threads().thread("main")}),threadListItem:e.threadListItem??eh({source:"threads",query:{type:"main"},get:e=>e.threads().item("main")}),composer:e.composer??eh({source:"thread",query:{},get:e=>e.threads().thread("main").composer()})}).modelContext||null!==t.modelContext.source||(n.modelContext=eK()),n.suggestions||null!==t.suggestions.source||(n.suggestions=eJ()),n);return r.tools||null!==t.tools.source||(r.tools=eX({})),r.dataRenderers||null!==t.dataRenderers.source||(r.dataRenderers=eY()),r});let e0=(0,r.memo)(({runtime:e,aui:t=null,children:r})=>{let i=eA({threads:eZ(e)},{parent:t}),s=e._core?.RenderComponent;return(0,n.jsxs)(ed,{value:i,children:[s&&(0,n.jsx)(s,{}),r]})}),e1=e=>{let t,n=new Set,r=(e,r)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=r?r:"object"!=typeof i||null===i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,s={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,s);return s},e5=e=>{let t=e?e1(e):e1,n=e=>(function(e,t=e=>e){let n=r.default.useSyncExternalStore(e.subscribe,r.default.useCallback(()=>t(e.getState()),[e,t]),r.default.useCallback(()=>t(e.getInitialState()),[e,t]));return r.default.useDebugValue(n),n})(t,e);return Object.assign(n,t),n},e2=e=>e?e5(e):e5;e.s(["create",()=>e2],705776);let e3=e=>{let t=new Map,n=()=>{let n=0;for(let e of t.values())n+=e;e(n)};return{register:()=>{let e=Symbol();return t.set(e,0),{setHeight:r=>{t.get(e)!==r&&(t.set(e,r),n())},unregister:()=>{t.delete(e),n()}}}}};function e4(e,t){function n(n){let r=e(n);return r?r[t]:null}return{[t]:function(e){let t,r=!1;"function"==typeof e?t=e:e&&"object"==typeof e&&(r=!!e.optional,t=e.selector);let i=n({optional:r});return i?t?i(t):i():null},[`${t}Store`]:n}}e.s(["createContextStoreHook",()=>e4],397607);let e6=(0,r.createContext)(null),{useThreadViewport:e9,useThreadViewportStore:e7}=e4(function(e){let t=(0,r.useContext)(e6);if(!e?.optional&&!t)throw Error("This component must be used within ThreadPrimitive.Viewport.");return t},"useThreadViewport");e.s(["ThreadViewportContext",0,e6,"useThreadViewport",0,e9,"useThreadViewportStore",0,e7],87846);let e8=e=>e;e.s(["writableStore",0,e8],682885);let te=({children:e,options:t={}})=>{let i=(e=>{let t=e7({optional:!0}),[n]=(0,r.useState)(()=>((e={})=>{let t=new Set,n=e3(e=>{s.setState({height:{...s.getState().height,viewport:e}})}),r=e3(e=>{s.setState({height:{...s.getState().height,inset:e}})}),i=e3(e=>{s.setState({height:{...s.getState().height,userMessage:e}})}),s=e2(()=>({isAtBottom:!0,scrollToBottom:({behavior:e="auto"}={})=>{for(let n of t)n({behavior:e})},onScrollToBottom:e=>(t.add(e),()=>{t.delete(e)}),turnAnchor:e.turnAnchor??"bottom",height:{viewport:0,inset:0,userMessage:0},registerViewport:n.register,registerContentInset:r.register,registerUserMessageHeight:i.register}));return s})(e));return(0,r.useEffect)(()=>t?.getState().onScrollToBottom(()=>{n.getState().scrollToBottom()}),[t,n]),(0,r.useEffect)(()=>{if(t)return n.subscribe(e=>{t.getState().isAtBottom!==e.isAtBottom&&e8(t).setState({isAtBottom:e.isAtBottom})})},[n,t]),(0,r.useEffect)(()=>{let t={turnAnchor:e.turnAnchor??"bottom"};n.getState().turnAnchor!==t.turnAnchor&&e8(n).setState(t)},[n,e.turnAnchor]),n})(t),[s]=(0,r.useState)(()=>({useThreadViewport:i}));return(0,n.jsx)(e6.Provider,{value:s,children:e})};e.s(["ThreadPrimitiveViewportProvider",0,te],284488);let tt=()=>{let e=eA();return(0,r.useEffect)(()=>{},[e]),null},tn=(0,r.memo)(({children:e,aui:t,runtime:r})=>(0,n.jsxs)(e0,{runtime:r,aui:t??null,children:[(0,n.jsx)(tt,{}),(0,n.jsx)(te,{children:e})]}));e.s(["AssistantRuntimeProvider",0,tn],819645)},418532,e=>{"use strict";let t=(0,e.i(903645).default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);e.s(["Cpu",()=>t],418532)},947951,848692,590189,147970,640912,e=>{"use strict";e.s([],829695),e.i(829695);var t,n,r=e.i(679606),i=e.i(152155);e.i(685446);var s=e.i(205978),o=Symbol.for("react.lazy"),a=i[" use ".trim().toString()];function l(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===o&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var u=Symbol("radix.slottable");function c(e){return i.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===u}var d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n,o;let u,d,h,p=(o=n=`Primitive.${t}`,(u=i.forwardRef((e,t)=>{let{children:n,...r}=e;if(l(n)&&"function"==typeof a&&(n=a(n._payload)),i.isValidElement(n)){var o;let e,a,l=(o=n,(a=(e=Object.getOwnPropertyDescriptor(o.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.ref:(a=(e=Object.getOwnPropertyDescriptor(o,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?o.props.ref:o.props.ref||o.ref),u=function(e,t){let n={...t};for(let r in t){let i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...e)=>{let t=s(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...s}:"className"===r&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}(r,n.props);return n.type!==i.Fragment&&(u.ref=t?(0,s.composeRefs)(t,l):l),i.cloneElement(n,u)}return i.Children.count(n)>1?i.Children.only(null):null})).displayName=`${o}.SlotClone`,d=u,(h=i.forwardRef((e,t)=>{let{children:n,...s}=e;l(n)&&"function"==typeof a&&(n=a(n._payload));let o=i.Children.toArray(n),u=o.find(c);if(u){let e=u.props.children,n=o.map(t=>t!==u?t:i.Children.count(e)>1?i.Children.only(null):i.isValidElement(e)?e.props.children:null);return(0,r.jsx)(d,{...s,ref:t,children:i.isValidElement(e)?i.cloneElement(e,void 0,n):null})}return(0,r.jsx)(d,{...s,ref:t,children:n})})).displayName=`${n}.Slot`,h),f=i.forwardRef((e,n)=>{let{asChild:i,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,r.jsx)(i?p:t,{...s,ref:n})});return f.displayName=`Primitive.${t}`,{...e,[t]:f}},{}),h=e.i(708624),p=e.i(32527);let f=e=>{let t=(0,h.useAui)(),n=(0,p.getProxiedAssistantState)(t),r=(0,i.useSyncExternalStore)(t.subscribe,()=>e(n),()=>e(n));if(r===n)throw Error("You tried to return the entire AssistantState. This is not supported due to technical limitations.");return(0,i.useDebugValue)(r),r};(t=n||(n={})).Hidden="hidden",t.Floating="floating",t.Normal="normal";let m=(0,i.createContext)(null),g=(0,i.forwardRef)(({hideWhenRunning:e,autohide:t,autohideFloat:s,...o},a)=>{let[l,u]=(0,i.useState)(0),c=(0,i.useCallback)(()=>{let e=!1;return u(e=>e+1),()=>{e||(e=!0,u(e=>Math.max(0,e-1)))}},[]),h=(0,i.useMemo)(()=>({acquireInteractionLock:c}),[c]),p=(({hideWhenRunning:e,autohide:t,autohideFloat:r,forceVisible:i})=>f(s=>{if(e&&s.thread.isRunning)return n.Hidden;let o="always"===t||"not-last"===t&&!s.message.isLast,a=i||s.message.isHovering;return o?a?"always"===r||"single-branch"===r&&s.message.branchCount<=1?n.Floating:n.Normal:n.Hidden:n.Normal}))({hideWhenRunning:e,autohide:t,autohideFloat:s,forceVisible:l>0});return p===n.Hidden?null:(0,r.jsx)(m.Provider,{value:h,children:(0,r.jsx)(d.div,{...p===n.Floating?{"data-floating":"true"}:null,...o,ref:a})})});g.displayName="ActionBarPrimitive.Root";var x=e.i(291967);let b=(0,i.forwardRef)(({copiedDuration:e,onClick:t,disabled:n,...s},o)=>{let a=f(e=>e.message.isCopied),l=(({copiedDuration:e=3e3}={})=>{let{copy:t,disabled:n}=(({copiedDuration:e=3e3,copyToClipboard:t}={})=>{let n=(0,h.useAui)(),r=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),s=f(e=>e.message.isCopied),o=f(e=>e.composer.isEditing),a=f(e=>e.composer.text);return{copy:(0,i.useCallback)(()=>{let r=o?a:n.message().getCopyText();r&&Promise.resolve((t??(()=>{}))(r)).then(()=>{n.message().setIsCopied(!0),setTimeout(()=>n.message().setIsCopied(!1),e)})},[n,o,a,e,t]),disabled:r,isCopied:s}})({copiedDuration:e,copyToClipboard:e=>navigator.clipboard.writeText(e)});return n?null:t})({copiedDuration:e});return(0,r.jsx)(d.button,{type:"button",...a?{"data-copied":"true"}:{},...s,ref:o,disabled:n||!l,onClick:(0,x.composeEventHandlers)(t,()=>{l?.()})})});b.displayName="ActionBarPrimitive.Copy";let y=(e,t,n=[])=>{let s=(0,i.forwardRef)((e,i)=>{let s={},o={};Object.keys(e).forEach(t=>{n.includes(t)?s[t]=e[t]:o[t]=e[t]});let a=t(s)??void 0;return(0,r.jsx)(d.button,{...o,type:"button",ref:i,disabled:o.disabled||!a,onClick:(0,x.composeEventHandlers)(o.onClick,a)})});return s.displayName=e,s},v=y("ActionBarPrimitive.Reload",()=>{let e,t,{disabled:n,reload:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||e.thread.isDisabled||"assistant"!==e.message.role),{reload:(0,i.useCallback)(()=>{e.message().reload()},[e]),disabled:t});return n?null:r}),k=y("ActionBarPrimitive.Edit",()=>{let e,t,{disabled:n,edit:r}=(e=(0,h.useAui)(),t=f(e=>e.composer.isEditing),{edit:(0,i.useCallback)(()=>{e.composer().beginEdit()},[e]),disabled:t});return n?null:r}),w=y("ActionBarPrimitive.Speak",()=>{let e,t,{disabled:n,speak:r}=(e=(0,h.useAui)(),t=f(e=>!(("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0))),{speak:(0,i.useCallback)(async()=>{e.message().speak()},[e]),disabled:t});return n?null:r});var S=e.i(67384);let _=(0,i.forwardRef)((e,t)=>{let n=(()=>{let e,t,{disabled:n,stopSpeaking:r}=(e=(0,h.useAui)(),t=f(e=>null==e.message.speech),{stopSpeaking:(0,i.useCallback)(()=>{e.message().stopSpeaking()},[e]),disabled:t});return n?null:r})();return(0,S.useEscapeKeydown)(e=>{n&&(e.preventDefault(),n())}),(0,r.jsx)(d.button,{type:"button",disabled:!n,...e,ref:t,onClick:(0,x.composeEventHandlers)(e.onClick,()=>{n?.()})})});_.displayName="ActionBarPrimitive.StopSpeaking";let C=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="positive"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"positive"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,x.composeEventHandlers)(e,()=>{a?.()})})});C.displayName="ActionBarPrimitive.FeedbackPositive";let j=(0,i.forwardRef)(({onClick:e,disabled:t,...n},s)=>{let o=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),a=(()=>{let e,t,{submit:n}=(e=(0,h.useAui)(),t=f(e=>e.message.metadata.submittedFeedback?.type==="negative"),{submit:(0,i.useCallback)(()=>{e.message().submitFeedback({type:"negative"})},[e]),isSubmitted:t});return n})();return(0,r.jsx)(d.button,{type:"button",...o?{"data-submitted":"true"}:{},...n,ref:s,disabled:t||!a,onClick:(0,x.composeEventHandlers)(e,()=>{a?.()})})});j.displayName="ActionBarPrimitive.FeedbackNegative";let E=(0,i.forwardRef)(({filename:e,onExport:t,onClick:n,disabled:s,...o},a)=>{let l=(({filename:e,onExport:t}={})=>{let n=(0,h.useAui)(),r=f(e=>("assistant"!==e.message.role||e.message.status?.type!=="running")&&e.message.parts.some(e=>"text"===e.type&&e.text.length>0)),s=(0,i.useCallback)(async()=>{let r=n.message().getCopyText();if(!r)return;if(t)return void await t(r);let i=new Blob([r],{type:"text/markdown"}),s=URL.createObjectURL(i),o=document.createElement("a");o.href=s,o.download=e??`message-${Date.now()}.md`,o.click(),URL.revokeObjectURL(s)},[n,e,t]);return r?s:null})({filename:e,onExport:t});return(0,r.jsx)(d.button,{type:"button",...o,ref:a,disabled:s||!l,onClick:(0,x.composeEventHandlers)(n,()=>{l?.()})})});E.displayName="ActionBarPrimitive.ExportMarkdown",e.s(["Copy",0,b,"Edit",0,k,"ExportMarkdown",0,E,"FeedbackNegative",0,j,"FeedbackPositive",0,C,"Reload",0,v,"Root",0,g,"Speak",0,w,"StopSpeaking",0,_],307129);var T=e.i(307129);e.s(["ActionBarPrimitive",0,T],947951),e.s([],875661),e.i(875661);let I=()=>{let e,t,{disabled:n,send:r}=(e=(0,h.useAui)(),t=f(e=>e.thread.isRunning||!e.composer.isEditing||e.composer.isEmpty),{send:(0,i.useCallback)(()=>{e.composer().send()},[e]),disabled:t});return n?null:r},A=y("ComposerPrimitive.Send",I),N=(0,i.forwardRef)(({onSubmit:e,...t},n)=>{let i=I();return(0,r.jsx)(d.form,{...t,ref:n,onSubmit:(0,x.composeEventHandlers)(e,e=>{e.preventDefault(),i&&i()})})});N.displayName="ComposerPrimitive.Root";var M=e.i(405240);function R(){return(R=Object.assign.bind()).apply(null,arguments)}var P=i.useLayoutEffect,D=function(e){var t=i.default.useRef(e);return P(function(){t.current=e}),t},O=function(e,t){"function"==typeof e?e(t):e.current=t},F=function(e,t){var n=i.default.useRef();return i.default.useCallback(function(r){e.current=r,n.current&&O(n.current,null),n.current=t,t&&O(t,r)},[t])},L={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},B=function(e){Object.keys(L).forEach(function(t){e.style.setProperty(t,L[t],"important")})},z=null,$=function(e,t){var n=e.scrollHeight;return"border-box"===t.sizingStyle.boxSizing?n+t.borderSize:n-t.paddingSize},U=function(){},q=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],H=!!document.documentElement.currentStyle,V=function(e){var t=window.getComputedStyle(e);if(null===t)return null;var n=q.reduce(function(e,n){return e[n]=t[n],e},{}),r=n.boxSizing;if(""===r)return null;H&&"border-box"===r&&(n.width=parseFloat(n.width)+parseFloat(n.borderRightWidth)+parseFloat(n.borderLeftWidth)+parseFloat(n.paddingRight)+parseFloat(n.paddingLeft)+"px");var i=parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),s=parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth);return{sizingStyle:n,paddingSize:i,borderSize:s}};function W(e,t,n){var r=D(n);i.useLayoutEffect(function(){var n=function(e){return r.current(e)};if(e)return e.addEventListener(t,n),function(){return e.removeEventListener(t,n)}},[])}var K=function(e,t){W(document.body,"reset",function(n){e.current.form===n.target&&t(n)})},G=function(e){W(window,"resize",e)},J=function(e){W(document.fonts,"loadingdone",e)},Q=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],Y=i.forwardRef(function(e,t){var n=e.cacheMeasurements,r=e.maxRows,s=e.minRows,o=e.onChange,a=void 0===o?U:o,l=e.onHeightChange,u=void 0===l?U:l,c=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,Q),d=void 0!==c.value,h=i.useRef(null),p=F(h,t),f=i.useRef(0),m=i.useRef(),g=function(){var e=h.current,t=n&&m.current?m.current:V(e);if(t){m.current=t;var i,o,a,l,c,d,p,g,x,b,y,v=(i=e.value||e.placeholder||"x",void 0===(o=s)&&(o=1),void 0===(a=r)&&(a=1/0),z||((z=document.createElement("textarea")).setAttribute("tabindex","-1"),z.setAttribute("aria-hidden","true"),B(z)),null===z.parentNode&&document.body.appendChild(z),l=t.paddingSize,c=t.borderSize,p=(d=t.sizingStyle).boxSizing,Object.keys(d).forEach(function(e){z.style[e]=d[e]}),B(z),z.value=i,g=$(z,t),z.value=i,g=$(z,t),z.value="x",b=(x=z.scrollHeight-l)*o,"border-box"===p&&(b=b+l+c),g=Math.max(b,g),y=x*a,"border-box"===p&&(y=y+l+c),[g=Math.min(y,g),x]),k=v[0],w=v[1];f.current!==k&&(f.current=k,e.style.setProperty("height",k+"px","important"),u(k,{rowHeight:w}))}};return i.useLayoutEffect(g),K(h,function(){if(!d){var e=h.current.value;requestAnimationFrame(function(){var t=h.current;t&&e!==t.value&&g()})}}),G(g),J(g),i.createElement("textarea",R({},c,{onChange:function(e){d||g(),a(e)},ref:p}))}),X=e.i(929297),Z=e.i(87846);let ee=e=>{let t=(0,X.useCallbackRef)(e),n=(0,Z.useThreadViewport)(e=>e.onScrollToBottom);(0,i.useEffect)(()=>n(t),[n,t])};var et=e.i(238782);let en=(0,i.forwardRef)(({autoFocus:e=!1,asChild:t,disabled:n,onChange:o,onKeyDown:a,onPaste:l,submitOnEnter:u,submitMode:c,cancelOnEscape:d=!0,unstable_focusOnRunStart:p=!0,unstable_focusOnScrollToBottom:m=!0,unstable_focusOnThreadSwitched:g=!0,addAttachmentOnPaste:b=!0,...y},v)=>{let k=(0,h.useAui)(),w=c??(!1===u?"none":"enter"),_=f(e=>e.composer.isEditing?e.composer.text:""),C=t?M.Slot.Root:Y,j=f(e=>e.thread.isDisabled||e.composer.dictation?.inputDisabled)||n,E=(0,i.useRef)(null),T=(0,s.useComposedRefs)(v,E);(0,S.useEscapeKeydown)(e=>{if(!d||!E.current?.contains(e.target))return;let t=k.composer();t.getState().canCancel&&(t.cancel(),e.preventDefault())});let I=async e=>{if(!b)return;let t=k.thread().getState().capabilities,n=Array.from(e.clipboardData?.files||[]);if(t.attachments&&n.length>0)try{e.preventDefault(),await Promise.all(n.map(e=>k.composer().addAttachment(e)))}catch(e){console.error("Error adding attachment:",e)}},A=e&&!j,N=(0,i.useCallback)(()=>{let e=E.current;e&&A&&(e.focus({preventScroll:!0}),e.setSelectionRange(e.value.length,e.value.length))},[A]);return(0,i.useEffect)(()=>N(),[N]),ee(()=>{"thread"===k.composer().getState().type&&m&&N()}),(0,i.useEffect)(()=>{if("thread"===k.composer().getState().type&&p)return k.on("thread.runStart",N)},[p,N,k]),(0,i.useEffect)(()=>{if("thread"===k.composer().getState().type&&g)return k.on("threadListItem.switchedTo",N)},[g,N,k]),(0,r.jsx)(C,{name:"input",value:_,...y,ref:T,disabled:j,onChange:(0,x.composeEventHandlers)(o,e=>{k.composer().getState().isEditing&&(0,et.flushResourcesSync)(()=>{k.composer().setText(e.target.value)})}),onKeyDown:(0,x.composeEventHandlers)(a,e=>{if(!j&&!e.nativeEvent.isComposing&&"Enter"===e.key&&!e.shiftKey){if(k.thread().getState().isRunning)return;let t=!1;"ctrlEnter"===w?t=e.ctrlKey||e.metaKey:"enter"===w&&(t=!0),t&&(e.preventDefault(),E.current?.closest("form")?.requestSubmit())}}),onPaste:(0,x.composeEventHandlers)(l,I)})});en.displayName="ComposerPrimitive.Input";let er=y("ComposerPrimitive.Cancel",()=>{let e,t,{disabled:n,cancel:r}=(e=(0,h.useAui)(),t=f(e=>!e.composer.canCancel),{cancel:(0,i.useCallback)(()=>{e.composer().cancel()},[e]),disabled:t});return n?null:r}),ei=y("ComposerPrimitive.AddAttachment",({multiple:e=!0}={})=>{let t,n,{disabled:r,addAttachment:s}=(t=(0,h.useAui)(),n=f(e=>!e.composer.isEditing),{addAttachment:(0,i.useCallback)(e=>t.composer().addAttachment(e),[t]),disabled:n}),o=(0,h.useAui)(),a=(0,i.useCallback)(()=>{let t=document.createElement("input");t.type="file",t.multiple=e,t.hidden=!0;let n=o.composer().getState().attachmentAccept;"*"!==n&&(t.accept=n),document.body.appendChild(t),t.onchange=e=>{let n=e.target.files;if(n){for(let e of n)s(e);document.body.removeChild(t)}},t.oncancel=()=>{t.files&&0!==t.files.length||document.body.removeChild(t)},t.click()},[o,e,s]);return r?null:a},["multiple"]),es=Object.freeze({});function eo({getItemState:e,children:t}){let n,r;return ea(t((n=(0,h.useAui)(),r=(0,i.useRef)(void 0),f(()=>(void 0===r.current&&(r.current=e(n)),r.current)),()=>(r.current=void 0,e(n)))))}let ea=e=>{let t="object"==typeof e&&null!=e&&"type"in e?e:null,n=t?.type,r=t?.key,s="object"==typeof t?.props&&null!=t.props&&0===Object.entries(t.props).length?es:t?.props;return(0,i.useMemo)(()=>t,[n,r,s])??e};var el=e.i(512504),eu=e.i(161163);let ec=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},ed=({index:e,children:t})=>{let n=(0,h.useAui)({attachment:(0,eu.Derived)({source:"composer",query:{type:"index",index:e},get:t=>t.composer().attachment({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},eh=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},ep=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=eh(e,t);return n?(0,r.jsx)(n,{}):null},ef=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ed,{index:e,children:(0,r.jsx)(ep,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);ef.displayName="ComposerPrimitive.AttachmentByIndex";let em=({children:e})=>{let t=f(e=>e.composer.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ed,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.composer().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},eg=({components:e,children:t})=>e?(0,r.jsx)(em,{children:({attachment:t})=>{let n=eh(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(em,{children:t});eg.displayName="ComposerPrimitive.Attachments";let ex=(0,i.forwardRef)(({disabled:e,asChild:t=!1,children:n,...s},o)=>{let[a,l]=(0,i.useState)(!1),u=(0,h.useAui)(),c=(0,i.useCallback)(t=>{e||(t.preventDefault(),l(!0))},[e]),d=(0,i.useCallback)(t=>{!e&&(t.preventDefault(),a||l(!0))},[e,a]),p=(0,i.useCallback)(t=>{if(e)return;t.preventDefault();let n=t.relatedTarget;n&&t.currentTarget.contains(n)||l(!1)},[e]),f=(0,i.useCallback)(async t=>{if(!e)for(let e of(t.preventDefault(),l(!1),t.dataTransfer.files))try{await u.composer().addAttachment(e)}catch(e){console.error("Failed to add attachment:",e)}},[e,u]),m=t?M.Slot.Root:"div";return(0,r.jsx)(m,{...a?{"data-dragging":"true"}:null,ref:o,onDragEnterCapture:c,onDragOverCapture:d,onDragLeaveCapture:p,onDropCapture:f,...s,children:n})});ex.displayName="ComposerPrimitive.AttachmentDropzone";let eb=y("ComposerPrimitive.Dictate",()=>{let e,t,{disabled:n,startDictation:r}=(e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation||!e.thread.capabilities.dictation||!e.composer.isEditing),{startDictation:(0,i.useCallback)(()=>{e.composer().startDictation()},[e]),disabled:t});return n?null:r}),ey=y("ComposerPrimitive.StopDictation",()=>{let e=(0,h.useAui)(),t=f(e=>null!=e.composer.dictation),n=(0,i.useCallback)(()=>{e.composer().stopDictation()},[e]);return t?n:null}),ev=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.dictation?.transcript);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});ev.displayName="ComposerPrimitive.DictationTranscript";let ek=({children:e,...t})=>f(e=>{if(!0===t.editing&&!e.composer.isEditing||!1===t.editing&&e.composer.isEditing)return!1;let n=null!=e.composer.dictation;return(!0!==t.dictation||!!n)&&(!1!==t.dictation||!n)})?e:null;ek.displayName="ComposerPrimitive.If";let ew=(0,i.forwardRef)((e,t)=>f(e=>e.composer.quote)?(0,r.jsx)(d.div,{...e,ref:t}):null);ew.displayName="ComposerPrimitive.Quote";let eS=(0,i.forwardRef)(({children:e,...t},n)=>{let i=f(e=>e.composer.quote?.text);return i?(0,r.jsx)(d.span,{...t,ref:n,children:e??i}):null});eS.displayName="ComposerPrimitive.QuoteText";let e_=(0,i.forwardRef)(({onClick:e,...t},n)=>{let s=(0,h.useAui)(),o=(0,i.useCallback)(()=>{s.composer().setQuote(void 0)},[s]);return(0,r.jsx)(d.button,{type:"button",...t,ref:n,onClick:(0,x.composeEventHandlers)(e,o)})});e_.displayName="ComposerPrimitive.QuoteDismiss",e.s(["AddAttachment",0,ei,"AttachmentByIndex",0,ef,"AttachmentDropzone",0,ex,"Attachments",0,eg,"Cancel",0,er,"Dictate",0,eb,"DictationTranscript",0,ev,"If",0,ek,"Input",0,en,"Quote",0,ew,"QuoteDismiss",0,e_,"QuoteText",0,eS,"Root",0,N,"Send",0,A,"StopDictation",0,ey],968617);var eC=e.i(968617);e.s(["ComposerPrimitive",0,eC],848692),e.s([],866125),e.i(866125);let ej=e=>{let t=(0,i.useRef)(void 0);return(0,i.useCallback)(n=>{t.current&&t.current(),n&&(t.current=e(n))},[e])},eE=(e,t)=>ej((0,i.useCallback)(n=>{if(!e)return;let r=e(),i=()=>{let e=t?t(n):n.offsetHeight;r.setHeight(e)},s=new ResizeObserver(i);return s.observe(n),i(),()=>{s.disconnect(),r.unregister()}},[e,t])),eT=(0,i.createContext)(!1),eI=(e,t)=>{let n=e.match(/^([\d.]+)(em|px|rem)$/);if(!n)return 0;let r=parseFloat(n[1]),i=n[2];return"px"===i?r:"em"===i?r*(parseFloat(getComputedStyle(t).fontSize)||16):"rem"===i?r*(parseFloat(getComputedStyle(document.documentElement).fontSize)||16):0},eA=({children:e,fillClampThreshold:t="10em",fillClampOffset:n="6em"})=>{let s=f(e=>e.message.isLast&&"assistant"===e.message.role&&e.message.index>=1&&e.thread.messages.at(e.message.index-1)?.role==="user"),o=(0,Z.useThreadViewportStore)({optional:!0}),a=(0,i.useContext)(eT),l=ej((0,i.useCallback)(e=>{if(!o||a)return;let r=()=>{let r=o.getState();if("top"===r.turnAnchor&&s){let{viewport:i,inset:s,userMessage:o}=r.height,a=eI(t,e),l=eI(n,e),u=Math.max(0,i-s-(o<=a?o:l));e.style.minHeight=`${u}px`,e.style.flexShrink="0",e.style.transition="min-height 0s"}else e.style.minHeight="",e.style.flexShrink="",e.style.transition=""};return r(),o.subscribe(r)},[o,s,a,t,n]));return(0,r.jsx)(eT.Provider,{value:!0,children:(0,r.jsx)(M.Slot.Root,{ref:l,children:e})})};eA.displayName="ThreadPrimitive.ViewportSlack";let eN=(0,i.forwardRef)((e,t)=>{let n,o,a,l,u=(n=(0,h.useAui)(),o=f(()=>n.message()),ej((0,i.useCallback)(e=>{let t=()=>{o.setIsHovering(!0)},n=()=>{o.setIsHovering(!1)};return e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),e.matches(":hover")&&queueMicrotask(()=>o.setIsHovering(!0)),()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n),o.setIsHovering(!1)}},[o]))),c=(a=(0,Z.useThreadViewport)(e=>e.turnAnchor),l=(0,Z.useThreadViewport)(e=>e.registerUserMessageHeight),eE(f(e=>"top"===a&&"user"===e.message.role&&e.message.index===e.thread.messages.length-2&&e.thread.messages.at(-1)?.role==="assistant")?l:null,(0,i.useCallback)(e=>e.offsetHeight,[]))),p=(0,s.useComposedRefs)(t,u,c),m=f(e=>e.message.id);return(0,r.jsx)(eA,{children:(0,r.jsx)(d.div,{...e,ref:p,"data-message-id":m})})});eN.displayName="MessagePrimitive.Root";let eM=({index:e,children:t})=>{let n=(0,h.useAui)({part:(0,eu.Derived)({source:"message",query:{type:"index",index:e},get:t=>t.message().part({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})};var eR=e.i(691379),eP=e.i(428038);let eD=(0,eR.resource)(({text:e,isRunning:t})=>{let n=(0,eP.tapMemo)(()=>({type:"text",text:e,status:t?{type:"running"}:{type:"complete"}}),[e,t]);return{getState:()=>n,addToolResult:()=>{throw Error("Not supported")},resumeToolCall:()=>{throw Error("Not supported")}}}),eO=({text:e,isRunning:t=!1,children:n})=>{let i=(0,h.useAui)({part:eD({text:e,isRunning:t})});return(0,r.jsx)(el.AuiProvider,{value:i,children:n})};var eF=e.i(642888);let eL=Object.freeze({type:"complete"}),eB=(0,eR.resource)(({parts:e,getMessagePart:t})=>{let[n,r]=(0,eF.tapState)(!0),i=(0,eP.tapMemo)(()=>{let t=e[e.length-1];return t?.status??eL},[e]),s=(0,eP.tapMemo)(()=>({parts:e,collapsed:n,status:i}),[e,n,i]);return{getState:()=>s,setCollapsed:r,part:t}}),ez=({startIndex:e,endIndex:t,children:n})=>{let i=f(e=>e.message.parts).slice(e,t+1),s=(0,h.useAui)(),o=(0,h.useAui)({chainOfThought:eB({parts:i,getMessagePart:({index:t})=>{if(t<0||t>=i.length)throw Error(`ChainOfThought part index ${t} is out of bounds (0..${i.length-1})`);return s.message().part({index:e+t})}})});return(0,r.jsx)(el.AuiProvider,{value:o,children:n})},e$=e=>{let t=e.message.metadata;if(t&&"object"==typeof t)return t.custom?.quote},eU=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},eq=e=>{let t=-1;return{startGroup:e=>{-1===t&&(t=e)},endGroup:(n,r)=>{-1!==t&&(r.push({type:e,startIndex:t,endIndex:n}),t=-1)},finalize:(n,r)=>{-1!==t&&r.push({type:e,startIndex:t,endIndex:n})}}},eH=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eV=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},eW={Text:()=>null,Reasoning:()=>null,Source:()=>null,Image:()=>null,File:()=>null,Unstable_Audio:()=>null,ToolGroup:({children:e})=>e,ReasoningGroup:({children:e})=>e},eK=({components:{Text:e=eW.Text,Reasoning:t=eW.Reasoning,Image:n=eW.Image,Source:i=eW.Source,File:s=eW.File,Unstable_Audio:o=eW.Unstable_Audio,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(eH,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(eV,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},eG=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(eK,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.ToolGroup===t.components?.ToolGroup&&e.components?.ReasoningGroup===t.components?.ReasoningGroup);eG.displayName="MessagePrimitive.PartByIndex";let eJ=({status:e,component:t})=>(0,r.jsx)(eO,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),eQ=Object.freeze({type:"complete"}),eY=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??eQ);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(eJ,{status:t,component:e?.Text??eW.Text})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eX=(0,i.memo)(({components:e,enabled:t})=>f(e=>{if(!t||0===e.message.parts.length)return!1;let n=e.message.parts[e.message.parts.length-1];return n?.type!=="text"&&n?.type!=="reasoning"})?(0,r.jsx)(eY,{components:e}):null,(e,t)=>e.enabled===t.enabled&&e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),eZ=(0,i.memo)(({Quote:e})=>{let t=f(e$);return t?(0,r.jsx)(e,{text:t.text,messageId:t.messageId}):null}),e0=()=>{let e=(0,h.useAui)(),t=f(e=>e.part),n=f(e=>{if("tool-call"!==e.part.type)return null;let t=e.tools.tools[e.part.toolName];return Array.isArray(t)?t[0]??null:t??null});return n&&"tool-call"===t.type?(0,r.jsx)(n,{...t,addResult:e.part().addToolResult,resume:e.part().resumeToolCall}):null},e1=()=>{let e=f(e=>e.part),t=f(e=>{if("data"!==e.part.type)return null;let t=e.dataRenderers.renderers[e.part.name];return Array.isArray(t)?t[0]??null:t??null});return t&&"data"===e.type?(0,r.jsx)(t,{...e}):null},e5=()=>{let e=f(e=>e.part.type);return"tool-call"===e?(0,r.jsx)(e0,{}):"data"===e?(0,r.jsx)(e1,{}):null},e2=({children:e})=>{let t=(0,h.useAui)(),n=f(e=>e.message.parts.length);return(0,i.useMemo)(()=>Array.from({length:n},(n,i)=>(0,r.jsx)(eM,{index:i,children:(0,r.jsx)(eo,{getItemState:e=>e.message().part({index:i}).getState(),children:n=>{let s=e({get part(){let e=n();if("tool-call"===e.type){let n=t.tools().getState().tools[e.toolName],s=Array.isArray(n)?!!n[0]:!!n,o=t.message().part({index:i});return{...e,toolUI:s?(0,r.jsx)(e0,{}):null,addResult:o.addToolResult,resume:o.resumeToolCall}}if("data"===e.type){let n=t.dataRenderers().getState().renderers[e.name],i=Array.isArray(n)?!!n[0]:!!n;return{...e,dataRendererUI:i?(0,r.jsx)(e1,{}):null}}return e}});return null!==s?s:(0,r.jsx)(e5,{})}})},i)),[n,e])},e3=({components:e,unstable_showEmptyOnNonTextEnd:t=!0,children:n})=>n?(0,r.jsx)(e2,{children:n}):(0,r.jsx)(e4,{components:e,unstable_showEmptyOnNonTextEnd:t});e3.displayName="MessagePrimitive.Parts";let e4=({components:e,unstable_showEmptyOnNonTextEnd:t})=>{var n,s;let o,a,l=f(e=>e.message.parts.length),u=(n=!!e?.ChainOfThought,a=f((s=e=>e.message.parts.map(e=>e.type),o=i.default.useRef(void 0),e=>{let t=s(e);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return eU(e,t);let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),s=r.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=n.next(),s=r.next()}return!!i.done&&!!s.done}return eU({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(o.current,t)?o.current=t:o.current})),(0,i.useMemo)(()=>0===a.length?[]:((e,t)=>{let n=[];if(t){let t=eq("chainOfThoughtGroup");for(let r=0;r<e.length;r++){let i=e[r];"tool-call"===i||"reasoning"===i?t.startGroup(r):(t.endGroup(r-1,n),n.push({type:"single",index:r}))}t.finalize(e.length-1,n)}else{let t=eq("toolGroup"),r=eq("reasoningGroup");for(let i=0;i<e.length;i++){let s=e[i];"tool-call"===s?(r.endGroup(i-1,n),t.startGroup(i)):"reasoning"===s?(t.endGroup(i-1,n),r.startGroup(i)):(t.endGroup(i-1,n),r.endGroup(i-1,n),n.push({type:"single",index:i}))}t.finalize(e.length-1,n),r.finalize(e.length-1,n)}return n})(a,n),[a,n])),c=(0,i.useMemo)(()=>0===l?(0,r.jsx)(eY,{components:e}):u.map(t=>{if("single"===t.type)return(0,r.jsx)(eG,{index:t.index,components:e},t.index);if("chainOfThoughtGroup"===t.type){let n=e?.ChainOfThought;return n?(0,r.jsx)(ez,{startIndex:t.startIndex,endIndex:t.endIndex,children:(0,r.jsx)(n,{})},`chainOfThought-${t.startIndex}`):null}if("toolGroup"===t.type){let n=e?.ToolGroup??eW.ToolGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eG,{index:t.startIndex+i,components:e},i))},`tool-${t.startIndex}`)}{let n=e?.ReasoningGroup??eW.ReasoningGroup;return(0,r.jsx)(n,{startIndex:t.startIndex,endIndex:t.endIndex,children:Array.from({length:t.endIndex-t.startIndex+1},(n,i)=>(0,r.jsx)(eG,{index:t.startIndex+i,components:e},i))},`reasoning-${t.startIndex}`)}}),[u,e,l]);return(0,r.jsxs)(r.Fragment,{children:[e?.Quote&&(0,r.jsx)(eZ,{Quote:e.Quote}),c,(0,r.jsx)(eX,{components:e,enabled:t})]})};e.i(705776);var e6=e.i(397607);let e9=(0,i.createContext)(null),{useSmoothStatus:e7,useSmoothStatusStore:e8}=(0,e6.createContextStoreHook)(function(e){let t=(0,i.useContext)(e9);if(!e?.optional&&!t)throw Error("This component must be used within a SmoothContextProvider.");return t},"useSmoothStatus");var te=e.i(682885);class tt{currentText;setText;animationFrameId=null;lastUpdateTime=Date.now();targetText="";constructor(e,t){this.currentText=e,this.setText=t}start(){null===this.animationFrameId&&(this.lastUpdateTime=Date.now(),this.animate())}stop(){null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}animate=()=>{let e=Date.now(),t=e-this.lastUpdateTime,n=this.targetText.length-this.currentText.length,r=Math.min(5,250/n),i=0;for(;t>=r&&i<n;)i++,t-=r;i!==n?this.animationFrameId=requestAnimationFrame(this.animate):this.animationFrameId=null,0!==i&&(this.currentText=this.targetText.slice(0,this.currentText.length+i),this.lastUpdateTime=e-t,this.setText(this.currentText))}}let tn=Object.freeze({type:"running"}),tr=(0,i.forwardRef)(({smooth:e=!0,component:t="span",...n},s)=>{let{text:o,status:a}=((e,t=!1)=>{let{text:n}=e,r=f(e=>e.message.id),s=(0,i.useRef)(r),[o,a]=(0,i.useState)("running"===e.status.type?"":n),l=e8({optional:!0}),u=(0,X.useCallbackRef)(t=>{if(a(t),l){let n=o!==t||"running"===e.status.type?tn:e.status;(0,te.writableStore)(l).setState(n,!0)}});(0,i.useEffect)(()=>{if(l){let r=t&&(o!==n||"running"===e.status.type)?tn:e.status;(0,te.writableStore)(l).setState(r,!0)}},[l,t,n,o,e.status]);let[c]=(0,i.useState)(new tt(o,u));return(0,i.useEffect)(()=>{if(!t)return void c.stop();if(s.current!==r||!n.startsWith(c.targetText)){s.current=r,"running"===e.status.type?(u(""),c.currentText="",c.targetText=n,c.start()):(u(n),c.currentText=n,c.targetText=n,c.stop());return}c.targetText=n,c.start()},[u,c,r,t,n,e.status.type]),(0,i.useEffect)(()=>()=>{c.stop()},[c]),(0,i.useMemo)(()=>t?{type:"text",text:o,status:n===o?e.status:tn}:e,[t,o,e,n])})(f(e=>{if("text"!==e.part.type&&"reasoning"!==e.part.type)throw Error("MessagePartText can only be used inside text or reasoning message parts.");return e.part}),e);return(0,r.jsx)(t,{"data-status":a.type,...n,ref:s,children:o})});tr.displayName="MessagePartPrimitive.Text";let ti=(0,i.forwardRef)((e,t)=>{let{image:n}=f(e=>{if("image"!==e.part.type)throw Error("MessagePartImage can only be used inside image message parts.");return e.part});return(0,r.jsx)(d.img,{src:n,...e,ref:t})});ti.displayName="MessagePartPrimitive.Image";let ts=({children:e})=>f(e=>"running"===e.part.status.type)?e:null;ts.displayName="MessagePartPrimitive.InProgress";let to={...eW,Text:()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),Image:()=>(0,r.jsx)(ti,{})},ta=e=>{if("children"in e)return(0,r.jsx)(e3,{children:e.children});let{components:t,...n}=e,i=t?{Text:t.Text??to.Text,Image:t.Image??to.Image,Reasoning:t.Reasoning??eW.Reasoning,Source:t.Source??eW.Source,File:t.File??eW.File,Unstable_Audio:t.Unstable_Audio??eW.Unstable_Audio,..."ChainOfThought"in t?{ChainOfThought:t.ChainOfThought}:{tools:t.tools,data:t.data,ToolGroup:t.ToolGroup??eW.ToolGroup,ReasoningGroup:t.ReasoningGroup??eW.ReasoningGroup},Empty:t.Empty,Quote:t.Quote}:to;return(0,r.jsx)(e3,{components:i,...n})};ta.displayName="MessagePrimitive.Parts";let tl=({children:e,...t})=>f(e=>{let{role:n,attachments:r,parts:i,branchCount:s,isLast:o,speech:a,isCopied:l,isHovering:u}=e.message;return!(!0===t.hasBranches&&s<2||t.user&&"user"!==n||t.assistant&&"assistant"!==n||t.system&&"system"!==n||!0===t.lastOrHover&&!u&&!o||void 0!==t.last&&t.last!==o||!0===t.copied&&!l||!1===t.copied&&l||!0===t.speaking&&null==a||!1===t.speaking&&null!=a||!0===t.hasAttachments&&("user"!==n||!r?.length)||!1===t.hasAttachments&&"user"===n&&r?.length)&&(!0!==t.hasContent||0!==i.length)&&(!1!==t.hasContent||!(i.length>0))&&(void 0===t.submittedFeedback||(e.message.metadata.submittedFeedback?.type??null)===t.submittedFeedback)})?e:null;tl.displayName="MessagePrimitive.If";let tu=(e,t)=>{switch(t.type){case"image":return e?.Image??e?.Attachment;case"document":return e?.Document??e?.Attachment;case"file":return e?.File??e?.Attachment;default:return e?.Attachment}},tc=({components:e})=>{let t=f(e=>e.attachment);if(!t)return null;let n=tu(e,t);return n?(0,r.jsx)(n,{}):null},td=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(ec,{index:e,children:(0,r.jsx)(tc,{components:t})}),(e,t)=>e.index===t.index&&e.components?.Image===t.components?.Image&&e.components?.Document===t.components?.Document&&e.components?.File===t.components?.File&&e.components?.Attachment===t.components?.Attachment);td.displayName="MessagePrimitive.AttachmentByIndex";let th=({children:e})=>{let t=f(e=>"user"!==e.message.role?0:e.message.attachments.length);return(0,i.useMemo)(()=>Array.from({length:t},(t,n)=>(0,r.jsx)(ec,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.message().attachment({index:n}).getState(),children:t=>e({get attachment(){return t()}})})},n)),[t,e])},tp=({components:e,children:t})=>e?(0,r.jsx)(th,{children:({attachment:t})=>{let n=tu(e,t);return n?(0,r.jsx)(n,{}):null}}):(0,r.jsx)(th,{children:t});tp.displayName="MessagePrimitive.Attachments";let tf=(0,i.memo)(({children:e})=>{let t=f(e$);return t?(0,r.jsx)(r.Fragment,{children:e(t)}):null});tf.displayName="MessagePrimitive.Quote";let tm=({children:e})=>void 0!==f(e=>e.message.status?.type==="incomplete"&&"error"===e.message.status.reason?e.message.status.error??"An error occurred":void 0)?e:null;tm.displayName="MessagePrimitive.Error";let tg=e=>{let t=new Map;for(let n=0;n<e.length;n++){let r=e[n],i=r?.parentId??`__ungrouped_${n}`,s=t.get(i)??[];s.push(n),t.set(i,s)}let n=[];for(let[e,r]of t){let t=e.startsWith("__ungrouped_")?void 0:e;n.push({groupKey:t,indices:r})}return n},tx=({Fallback:e,...t})=>{let n=f(n=>{let r=n.tools.tools[t.toolName]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},tb=({Fallback:e,...t})=>{let n=f(n=>{let r=n.dataRenderers.renderers[t.name]??e;return Array.isArray(r)?r[0]??e:r});return n?(0,r.jsx)(n,{...t}):null},ty=()=>(0,r.jsxs)("p",{style:{whiteSpace:"pre-line"},children:[(0,r.jsx)(tr,{}),(0,r.jsx)(ts,{children:(0,r.jsx)("span",{style:{fontFamily:"revert"},children:" ●"})})]}),tv=()=>null,tk=()=>null,tw=()=>(0,r.jsx)(ti,{}),tS=()=>null,t_=()=>null,tC=({children:e})=>e,tj=({components:{Text:e=ty,Reasoning:t=tv,Image:n=tw,Source:i=tk,File:s=tS,Unstable_Audio:o=t_,tools:a={},data:l}={}})=>{let u=(0,h.useAui)(),c=f(e=>e.part),d=c.type;if("tool-call"===d){let e=u.part().addToolResult,t=u.part().resumeToolCall;if("Override"in a)return(0,r.jsx)(a.Override,{...c,addResult:e,resume:t});let n=a.by_name?.[c.toolName]??a.Fallback;return(0,r.jsx)(tx,{...c,Fallback:n,addResult:e,resume:t})}if(c.status?.type==="requires-action")throw Error("Encountered unexpected requires-action status");switch(d){case"text":return(0,r.jsx)(e,{...c});case"reasoning":return(0,r.jsx)(t,{...c});case"source":return(0,r.jsx)(i,{...c});case"image":return(0,r.jsx)(n,{...c});case"file":return(0,r.jsx)(s,{...c});case"audio":return(0,r.jsx)(o,{...c});case"data":{let e=l?.by_name?.[c.name]??l?.Fallback;return(0,r.jsx)(tb,{...c,Fallback:e})}default:return console.warn(`Unknown message part type: ${d}`),null}},tE=(0,i.memo)(({partIndex:e,components:t})=>(0,r.jsx)(eM,{index:e,children:(0,r.jsx)(tj,{components:t})}),(e,t)=>e.partIndex===t.partIndex&&e.components?.Text===t.components?.Text&&e.components?.Reasoning===t.components?.Reasoning&&e.components?.Source===t.components?.Source&&e.components?.Image===t.components?.Image&&e.components?.File===t.components?.File&&e.components?.Unstable_Audio===t.components?.Unstable_Audio&&e.components?.tools===t.components?.tools&&e.components?.data===t.components?.data&&e.components?.Group===t.components?.Group),tT=({status:e,component:t})=>(0,r.jsx)(eO,{text:"",isRunning:"running"===e.type,children:(0,r.jsx)(t,{type:"text",text:"",status:e})}),tI=Object.freeze({type:"complete"}),tA=(0,i.memo)(({components:e})=>{let t=f(e=>e.message.status??tI);return e?.Empty?(0,r.jsx)(e.Empty,{status:t}):(0,r.jsx)(tT,{status:t,component:e?.Text??ty})},(e,t)=>e.components?.Empty===t.components?.Empty&&e.components?.Text===t.components?.Text),tN=({groupingFunction:e,components:t})=>{let n,s=f(e=>e.message.parts.length),o=(n=f(e=>e.message.parts),(0,i.useMemo)(()=>0===n.length?[]:e(n),[n,e])),a=(0,i.useMemo)(()=>0===s?(0,r.jsx)(tA,{components:t}):o.map((e,n)=>{let i=t?.Group??tC;return(0,r.jsx)(i,{groupKey:e.groupKey,indices:e.indices,children:e.indices.map(e=>(0,r.jsx)(tE,{partIndex:e,components:t},e))},`group-${n}-${e.groupKey??"ungrouped"}`)}),[o,t,s]);return(0,r.jsx)(r.Fragment,{children:a})};tN.displayName="MessagePrimitive.Unstable_PartsGrouped";let tM=({components:e,...t})=>(0,r.jsx)(tN,{...t,components:e,groupingFunction:tg});tM.displayName="MessagePrimitive.Unstable_PartsGroupedByParentId",e.s(["AttachmentByIndex",0,td,"Attachments",0,tp,"Content",0,ta,"Error",0,tm,"If",0,tl,"PartByIndex",0,eG,"Parts",0,ta,"Quote",0,tf,"Root",0,eN,"Unstable_PartsGrouped",0,tN,"Unstable_PartsGroupedByParentId",0,tM],735188);var tR=e.i(735188);e.s(["MessagePrimitive",0,tR],590189),e.s([],770436),e.i(770436);let tP=(0,i.forwardRef)((e,t)=>(0,r.jsx)(d.div,{...e,ref:t}));tP.displayName="ThreadPrimitive.Root";let tD=({children:e})=>f(e=>e.thread.isEmpty)?e:null;tD.displayName="ThreadPrimitive.Empty";let tO=({children:e,...t})=>f(e=>(!0!==t.empty||!!e.thread.isEmpty)&&(!1!==t.empty||!e.thread.isEmpty)&&(!0!==t.running||!!e.thread.isRunning)&&(!1!==t.running||!e.thread.isRunning)&&(!0!==t.disabled||!!e.thread.isDisabled)&&(!1!==t.disabled||!e.thread.isDisabled)&&!0)?e:null;tO.displayName="ThreadPrimitive.If";let tF=i.default.createContext(!0);function tL(){throw Error("A function wrapped in useEffectEvent can't be called during rendering.")}let tB="use"in i.default?()=>{try{return i.default.use(tF)}catch{return!1}}:()=>!1;var tz=e.i(88992);let t$=(e,t)=>{let n,r=(0,h.useAui)(),s=(n=i.default.useRef(tL),i.default.useInsertionEffect(()=>{n.current=t},[t]),(...e)=>(tB()&&tL(),(0,n.current)(...e))),{scope:o,event:a}=(0,tz.normalizeEventSelector)(e);(0,i.useEffect)(()=>r.on({scope:o,event:a},s),[r,o,a,s])};var tU=e.i(284488);let tq=(0,i.forwardRef)(({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o,children:a,...l},u)=>{let c=(({autoScroll:e,scrollToBottomOnRunStart:t=!0,scrollToBottomOnInitialize:n=!0,scrollToBottomOnThreadSwitch:r=!0})=>{var o;let a,l=(0,i.useRef)(null),u=(0,Z.useThreadViewportStore)();void 0===e&&(e="top"!==u.getState().turnAnchor);let c=(0,i.useRef)(0),d=(0,i.useRef)(null),h=(0,i.useCallback)(e=>{let t=l.current;t&&(d.current=e,t.scrollTo({top:t.scrollHeight,behavior:e}))},[]),p=()=>{let e=l.current;if(!e)return;let t=u.getState().isAtBottom,n=1>Math.abs(e.scrollHeight-e.scrollTop-e.clientHeight)||e.scrollHeight<=e.clientHeight;!n&&c.current<e.scrollTop||(n&&(d.current=null),(n||null===d.current)&&n!==t&&(0,te.writableStore)(u).setState({isAtBottom:n})),c.current=e.scrollTop},f=(o=()=>{let t=d.current;t?h(t):e&&u.getState().isAtBottom&&h("instant"),p()},a=(0,X.useCallbackRef)(o),ej((0,i.useCallback)(e=>{let t=new ResizeObserver(()=>{a()}),n=new MutationObserver(e=>{e.some(e=>"attributes"!==e.type||"style"!==e.attributeName)&&a()});return t.observe(e),n.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),()=>{t.disconnect(),n.disconnect()}},[a]))),m=ej(e=>(e.addEventListener("scroll",p),()=>{e.removeEventListener("scroll",p)}));return ee(({behavior:e})=>{h(e)}),t$("thread.runStart",()=>{t&&(d.current="auto",requestAnimationFrame(()=>{h("auto")}))}),t$("thread.initialize",()=>{n&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),t$("threadListItem.switchedTo",()=>{r&&(d.current="instant",requestAnimationFrame(()=>{h("instant")}))}),(0,s.useComposedRefs)(f,m,l)})({autoScroll:e,scrollToBottomOnRunStart:t,scrollToBottomOnInitialize:n,scrollToBottomOnThreadSwitch:o}),h=eE((0,Z.useThreadViewport)(e=>e.registerViewport),(0,i.useCallback)(e=>e.clientHeight,[])),p=(0,s.useComposedRefs)(u,c,h);return(0,r.jsx)(d.div,{...l,ref:p,children:a})});tq.displayName="ThreadPrimitive.ViewportScrollable";let tH=(0,i.forwardRef)(({turnAnchor:e,...t},n)=>(0,r.jsx)(tU.ThreadPrimitiveViewportProvider,{options:{turnAnchor:e},children:(0,r.jsx)(tq,{...t,ref:n})}));tH.displayName="ThreadPrimitive.Viewport";let tV=(0,i.forwardRef)((e,t)=>{let n=eE((0,Z.useThreadViewport)(e=>e.registerContentInset),(0,i.useCallback)(e=>{let t=parseFloat(getComputedStyle(e).marginTop)||0;return e.offsetHeight+t},[])),o=(0,s.useComposedRefs)(t,n);return(0,r.jsx)(d.div,{...e,ref:o})});tV.displayName="ThreadPrimitive.ViewportFooter";let tW=({index:e,children:t})=>{let n=(0,h.useAui)({message:(0,eu.Derived)({source:"thread",query:{type:"index",index:e},get:t=>t.thread().message({index:e})}),composer:(0,eu.Derived)({source:"message",query:{},get:t=>t.thread().message({index:e}).composer()})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},tK=(e,t)=>e.Message===t.Message&&e.EditComposer===t.EditComposer&&e.UserEditComposer===t.UserEditComposer&&e.AssistantEditComposer===t.AssistantEditComposer&&e.SystemEditComposer===t.SystemEditComposer&&e.UserMessage===t.UserMessage&&e.AssistantMessage===t.AssistantMessage&&e.SystemMessage===t.SystemMessage,tG=()=>null,tJ=({components:e})=>{let t=((e,t,n)=>{switch(t){case"user":if(n)return e.UserEditComposer??e.EditComposer??e.UserMessage??e.Message;return e.UserMessage??e.Message;case"assistant":if(n)return e.AssistantEditComposer??e.EditComposer??e.AssistantMessage??e.Message;return e.AssistantMessage??e.Message;case"system":if(n)return e.SystemEditComposer??e.EditComposer??e.SystemMessage??e.Message;return e.SystemMessage??e.Message??tG;default:throw Error(`Unknown message role: ${t}`)}})(e,f(e=>e.message.role),f(e=>e.message.composer.isEditing));return(0,r.jsx)(t,{})},tQ=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(tW,{index:e,children:(0,r.jsx)(tJ,{components:t})}),(e,t)=>e.index===t.index&&tK(e.components,t.components));tQ.displayName="ThreadPrimitive.MessageByIndex";let tY=({children:e})=>{let t=f(e=>e.thread.messages.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(tW,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.thread().message({index:n}).getState(),children:t=>e({get message(){return t()}})})},n)),[t,e])},tX=({components:e,children:t})=>e?(0,r.jsx)(tY,{children:()=>(0,r.jsx)(tJ,{components:e})}):(0,r.jsx)(tY,{children:t});tX.displayName="ThreadPrimitive.Messages";let tZ=(0,i.memo)(tX,(e,t)=>e.children||t.children?e.children===t.children:tK(e.components,t.components)),t0=y("ThreadPrimitive.ScrollToBottom",({behavior:e}={})=>{let t=(0,Z.useThreadViewport)(e=>e.isAtBottom),n=(0,Z.useThreadViewportStore)(),r=(0,i.useCallback)(()=>{n.getState().scrollToBottom({behavior:e})},[n,e]);return t?null:r},["behavior"]),t1=y("ThreadPrimitive.Suggestion",({prompt:e,send:t,clearComposer:n,autoSend:r,method:s})=>{let{disabled:o,trigger:a}=(({prompt:e,send:t,clearComposer:n=!0})=>{let r=(0,h.useAui)(),s=f(e=>e.thread.isDisabled),o=t??!1;return{trigger:(0,i.useCallback)(()=>{let t=r.thread().getState().isRunning;if(o&&!t)r.thread().append({content:[{type:"text",text:e}],runConfig:r.composer().getState().runConfig}),n&&r.composer().setText("");else if(n)r.composer().setText(e);else{let t=r.composer().getState().text;r.composer().setText(t.trim()?`${t} ${e}`:e)}},[r,o,n,e]),disabled:s}})({prompt:e,send:t??r??!1,clearComposer:n});return o?null:a},["prompt","send","clearComposer","autoSend","method"]),t5=({index:e,children:t})=>{let n=(0,h.useAui)({suggestion:(0,eu.Derived)({source:"suggestions",query:{index:e},get:t=>t.suggestions().suggestion({index:e})})});return(0,r.jsx)(el.AuiProvider,{value:n,children:t})},t2=({components:e})=>{let t=e.Suggestion;return(0,r.jsx)(t,{})},t3=(0,i.memo)(({index:e,components:t})=>(0,r.jsx)(t5,{index:e,children:(0,r.jsx)(t2,{components:t})}),(e,t)=>e.index===t.index&&e.components.Suggestion===t.components.Suggestion);t3.displayName="ThreadPrimitive.SuggestionByIndex";let t4=({children:e})=>{let t=f(e=>e.suggestions.suggestions.length);return(0,i.useMemo)(()=>0===t?null:Array.from({length:t},(t,n)=>(0,r.jsx)(t5,{index:n,children:(0,r.jsx)(eo,{getItemState:e=>e.suggestions().suggestion({index:n}).getState(),children:t=>e({get suggestion(){return t()}})})},n)),[t,e])},t6=({components:e,children:t})=>e?(0,r.jsx)(t4,{children:()=>(0,r.jsx)(t2,{components:e})}):(0,r.jsx)(t4,{children:t});t6.displayName="ThreadPrimitive.Suggestions";let t9=(0,i.memo)(t6,(e,t)=>e.children||t.children?e.children===t.children:e.components.Suggestion===t.components.Suggestion);e.s(["Empty",0,tD,"If",0,tO,"MessageByIndex",0,tQ,"Messages",0,tZ,"Root",0,tP,"ScrollToBottom",0,t0,"Suggestion",0,t1,"SuggestionByIndex",0,t3,"Suggestions",0,t9,"Viewport",0,tH,"ViewportFooter",0,tV,"ViewportProvider",()=>tU.ThreadPrimitiveViewportProvider,"ViewportSlack",0,eA],417260);var t7=e.i(417260);e.s(["ThreadPrimitive",0,t7],147970),e.i(54101);function t8(e){return function(t){let n,r=!1;"function"==typeof t?n=t:t&&(r=!!t.optional,n=t.selector);let s=e({optional:r});return s?function(e,t=e=>e){e.__isBound||(e.__internal_bindMethods?.(),e.__isBound=!0);let n=(0,i.useSyncExternalStore)(e.subscribe,()=>t(e.getState()),()=>t(e.getState()));return(0,i.useDebugValue)(n),n}(s,n):null}}function ne(e){let t=(0,h.useAui)(),n=f(()=>t.message.source?t.message().__internal_getRuntime?.()??null:null);if(!n&&!e?.optional)throw Error("MessageRuntime is not available");return n}let nt=t8(ne);t8(e=>ne(e)?.composer??null),e.s(["useMessage",0,nt],640912)},369090,(e,t,n)=>{"use strict";var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,i=/\n/g,s=/^\s*/,o=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,l=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,c=/^\s+|\s+$/g;function d(e){return e?e.replace(c,""):""}t.exports=function(e,t){if("string"!=typeof e)throw TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,c=1;function h(e){var t=e.match(i);t&&(n+=t.length);var r=e.lastIndexOf("\n");c=~r?e.length-r:c+e.length}function p(){var e={line:n,column:c};return function(t){return t.position=new f(e),g(s),t}}function f(e){this.start=e,this.end={line:n,column:c},this.source=t.source}function m(r){var i=Error(t.source+":"+n+":"+c+": "+r);if(i.reason=r,i.filename=t.source,i.line=n,i.column=c,i.source=e,t.silent);else throw i}function g(t){var n=t.exec(e);if(n){var r=n[0];return h(r),e=e.slice(r.length),n}}function x(e){var t;for(e=e||[];t=b();)!1!==t&&e.push(t);return e}function b(){var t=p();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var n=2;""!=e.charAt(n)&&("*"!=e.charAt(n)||"/"!=e.charAt(n+1));)++n;if(n+=2,""===e.charAt(n-1))return m("End of comment missing");var r=e.slice(2,n-2);return c+=2,h(r),e=e.slice(n),c+=2,t({type:"comment",comment:r})}}f.prototype.content=e,g(s);var y,v=[];for(x(v);y=function(){var e=p(),t=g(o);if(t){if(b(),!g(a))return m("property missing ':'");var n=g(l),i=e({type:"declaration",property:d(t[0].replace(r,"")),value:n?d(n[0].replace(r,"")):""});return g(u),i}}();)!1!==y&&(v.push(y),x(v));return v}},559596,(e,t,n)=>{"use strict";var r=e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,t){let n=null;if(!e||"string"!=typeof e)return n;let r=(0,i.default)(e),s="function"==typeof t;return r.forEach(e=>{if("declaration"!==e.type)return;let{property:r,value:i}=e;s?t(r,i,e):i&&((n=n||{})[r]=i)}),n};let i=r(e.r(369090))},851521,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.camelCase=void 0;var r=/^--[a-zA-Z0-9_-]+$/,i=/-([a-z])/g,s=/^[^-]+$/,o=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,l=function(e,t){return t.toUpperCase()},u=function(e,t){return"".concat(t,"-")};n.camelCase=function(e,t){var n;return(void 0===t&&(t={}),!(n=e)||s.test(n)||r.test(n))?e:(e=e.toLowerCase(),(e=t.reactCompat?e.replace(a,u):e.replace(o,u)).replace(i,l))}},763185,(e,t,n)=>{"use strict";var r=(e.e&&e.e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(e.r(559596)),i=e.r(851521);function s(e,t){var n={};return e&&"string"==typeof e&&(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}s.default=s,t.exports=s},975609,(e,t,n)=>{"use strict";var r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,s=Object.defineProperty,o=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===i.call(e)},l=function(e){if(!e||"[object Object]"!==i.call(e))return!1;var t,n=r.call(e,"constructor"),s=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!s)return!1;for(t in e);return void 0===t||r.call(e,t)},u=function(e,t){s&&"__proto__"===t.name?s(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;else if(o)return o(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,s,o,d=arguments[0],h=1,p=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<p;++h)if(t=arguments[h],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(f&&i&&(l(i)||(s=a(i)))?(s?(s=!1,o=r&&a(r)?r:[]):o=r&&l(r)?r:{},u(d,{name:n,newValue:e(f,o,i)})):void 0!==i&&u(d,{name:n,newValue:i}));return d}},800427,12105,559245,144819,455470,133220,51256,227066,705568,784484,173119,402652,216920,e=>{"use strict";var t=e.i(897802);let n=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,r=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i={};function s(e,t){return((t||i).jsx?r:n).test(e)}let o=/[ \t\n\f\r]/g;function a(e){return""===e.replace(o,"")}class l{constructor(e,t){this.attribute=t,this.property=e}}l.prototype.attribute="",l.prototype.booleanish=!1,l.prototype.boolean=!1,l.prototype.commaOrSpaceSeparated=!1,l.prototype.commaSeparated=!1,l.prototype.defined=!1,l.prototype.mustUseProperty=!1,l.prototype.number=!1,l.prototype.overloadedBoolean=!1,l.prototype.property="",l.prototype.spaceSeparated=!1,l.prototype.space=void 0;let u=0,c=x(),d=x(),h=x(),p=x(),f=x(),m=x(),g=x();function x(){return 2**++u}e.s(["boolean",0,c,"booleanish",0,d,"commaOrSpaceSeparated",0,g,"commaSeparated",0,m,"number",0,p,"overloadedBoolean",0,h,"spaceSeparated",0,f],383954);var b=e.i(383954);let y=Object.keys(b);class v extends l{constructor(e,t,n,r){let i=-1;if(super(e,t),function(e,t,n){n&&(e[t]=n)}(this,"space",r),"number"==typeof n)for(;++i<y.length;){const e=y[i];!function(e,t,n){n&&(e[t]=n)}(this,y[i],(n&b[e])===b[e])}}}function k(e){return e.toLowerCase()}v.prototype.defined=!0;let w=/[A-Z]/g,S=/-[a-z]/g,_=/^data[-\w.:]+$/i;function C(e){return"-"+e.toLowerCase()}function j(e){return e.charAt(1).toUpperCase()}let E={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};class T{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function I(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new T(n,r,t)}function A(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let s=new v(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[k(r)]=r,n[k(s.attribute)]=r}return new T(t,n,e.space)}T.prototype.normal={},T.prototype.property={},T.prototype.space=void 0;let N=A({properties:{ariaActiveDescendant:null,ariaAtomic:d,ariaAutoComplete:null,ariaBusy:d,ariaChecked:d,ariaColCount:p,ariaColIndex:p,ariaColSpan:p,ariaControls:f,ariaCurrent:null,ariaDescribedBy:f,ariaDetails:null,ariaDisabled:d,ariaDropEffect:f,ariaErrorMessage:null,ariaExpanded:d,ariaFlowTo:f,ariaGrabbed:d,ariaHasPopup:null,ariaHidden:d,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:f,ariaLevel:p,ariaLive:null,ariaModal:d,ariaMultiLine:d,ariaMultiSelectable:d,ariaOrientation:null,ariaOwns:f,ariaPlaceholder:null,ariaPosInSet:p,ariaPressed:d,ariaReadOnly:d,ariaRelevant:null,ariaRequired:d,ariaRoleDescription:f,ariaRowCount:p,ariaRowIndex:p,ariaRowSpan:p,ariaSelected:d,ariaSetSize:p,ariaSort:null,ariaValueMax:p,ariaValueMin:p,ariaValueNow:p,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function M(e,t){return t in e?e[t]:t}function R(e,t){return M(e,t.toLowerCase())}let P=A({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:m,acceptCharset:f,accessKey:f,action:null,allow:null,allowFullScreen:c,allowPaymentRequest:c,allowUserMedia:c,alt:null,as:null,async:c,autoCapitalize:null,autoComplete:f,autoFocus:c,autoPlay:c,blocking:f,capture:null,charSet:null,checked:c,cite:null,className:f,cols:p,colSpan:null,content:null,contentEditable:d,controls:c,controlsList:f,coords:p|m,crossOrigin:null,data:null,dateTime:null,decoding:null,default:c,defer:c,dir:null,dirName:null,disabled:c,download:h,draggable:d,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:c,formTarget:null,headers:f,height:p,hidden:h,high:p,href:null,hrefLang:null,htmlFor:f,httpEquiv:f,id:null,imageSizes:null,imageSrcSet:null,inert:c,inputMode:null,integrity:null,is:null,isMap:c,itemId:null,itemProp:f,itemRef:f,itemScope:c,itemType:f,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:c,low:p,manifest:null,max:null,maxLength:p,media:null,method:null,min:null,minLength:p,multiple:c,muted:c,name:null,nonce:null,noModule:c,noValidate:c,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:c,optimum:p,pattern:null,ping:f,placeholder:null,playsInline:c,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:c,referrerPolicy:null,rel:f,required:c,reversed:c,rows:p,rowSpan:p,sandbox:f,scope:null,scoped:c,seamless:c,selected:c,shadowRootClonable:c,shadowRootDelegatesFocus:c,shadowRootMode:null,shape:null,size:p,sizes:null,slot:null,span:p,spellCheck:d,src:null,srcDoc:null,srcLang:null,srcSet:null,start:p,step:null,style:null,tabIndex:p,target:null,title:null,translate:null,type:null,typeMustMatch:c,useMap:null,value:d,width:p,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:f,axis:null,background:null,bgColor:null,border:p,borderColor:null,bottomMargin:p,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:c,declare:c,event:null,face:null,frame:null,frameBorder:null,hSpace:p,leftMargin:p,link:null,longDesc:null,lowSrc:null,marginHeight:p,marginWidth:p,noResize:c,noHref:c,noShade:c,noWrap:c,object:null,profile:null,prompt:null,rev:null,rightMargin:p,rules:null,scheme:null,scrolling:d,standby:null,summary:null,text:null,topMargin:p,valueType:null,version:null,vAlign:null,vLink:null,vSpace:p,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:c,disableRemotePlayback:c,prefix:null,property:null,results:p,security:null,unselectable:null},space:"html",transform:R}),D=A({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:g,accentHeight:p,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:p,amplitude:p,arabicForm:null,ascent:p,attributeName:null,attributeType:null,azimuth:p,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:p,by:null,calcMode:null,capHeight:p,className:f,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:p,diffuseConstant:p,direction:null,display:null,dur:null,divisor:p,dominantBaseline:null,download:c,dx:null,dy:null,edgeMode:null,editable:null,elevation:p,enableBackground:null,end:null,event:null,exponent:p,externalResourcesRequired:null,fill:null,fillOpacity:p,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:m,g2:m,glyphName:m,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:p,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:p,horizOriginX:p,horizOriginY:p,id:null,ideographic:p,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:p,k:p,k1:p,k2:p,k3:p,k4:p,kernelMatrix:g,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:p,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:p,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:p,overlineThickness:p,paintOrder:null,panose1:null,path:null,pathLength:p,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:f,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:p,pointsAtY:p,pointsAtZ:p,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:g,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:g,rev:g,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:g,requiredFeatures:g,requiredFonts:g,requiredFormats:g,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:p,specularExponent:p,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:p,strikethroughThickness:p,string:null,stroke:null,strokeDashArray:g,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:p,strokeOpacity:p,strokeWidth:null,style:null,surfaceScale:p,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:g,tabIndex:p,tableValues:null,target:null,targetX:p,targetY:p,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:g,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:p,underlineThickness:p,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:p,values:null,vAlphabetic:p,vMathematical:p,vectorEffect:null,vHanging:p,vIdeographic:p,version:null,vertAdvY:p,vertOriginX:p,vertOriginY:p,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:p,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:M}),O=A({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),F=A({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:R}),L=A({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),B=I([N,P,O,F,L],"html"),z=I([N,D,O,F,L],"svg");var $=e.i(763185);let U=H("end"),q=H("start");function H(e){return function(t){let n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function V(e){return e&&"object"==typeof e?"position"in e||"type"in e?K(e.position):"start"in e||"end"in e?K(e):"line"in e||"column"in e?W(e):"":""}function W(e){return G(e&&e.line)+":"+G(e&&e.column)}function K(e){return W(e&&e.start)+"-"+W(e&&e.end)}function G(e){return e&&"number"==typeof e?e:1}class J extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",i={},s=!1;if(t&&(i="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!i.cause&&e&&(s=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){const e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}const o=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=V(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&"string"==typeof i.cause.stack?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}J.prototype.file="",J.prototype.name="",J.prototype.reason="",J.prototype.message="",J.prototype.stack="",J.prototype.column=void 0,J.prototype.line=void 0,J.prototype.ancestors=void 0,J.prototype.cause=void 0,J.prototype.fatal=void 0,J.prototype.place=void 0,J.prototype.ruleId=void 0,J.prototype.source=void 0;let Q={}.hasOwnProperty,Y=new Map,X=/[A-Z]/g,Z=new Set(["table","tbody","thead","tfoot","tr"]),ee=new Set(["td","th"]),et="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function en(e,n,r){var i,s,o,u,c,d,h,p,f;let m,g,x,b,y,T,I,A,N,M,R;return"element"===n.type?(i=e,s=n,o=r,g=m=i.schema,"svg"===s.tagName.toLowerCase()&&"html"===m.space&&(i.schema=z),i.ancestors.push(s),x=eo(i,s.tagName,!1),b=function(e,t){let n,r,i={};for(r in t.properties)if("children"!==r&&Q.call(t.properties,r)){let s=function(e,t,n){let r=function(e,t){let n=k(t),r=t,i=l;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&_.test(t)){if("-"===t.charAt(4)){let e=t.slice(5).replace(S,j);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!S.test(e)){let n=e.replace(w,C);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}i=v}return new i(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){var i;let t;if(Array.isArray(n)&&(n=r.commaSeparated?(t={},(""===(i=n)[i.length-1]?[...i,""]:i).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return(0,$.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};let t=new J("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw t.file=e.filePath||void 0,t.url=et+"#cannot-parse-style-attribute",t}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){let t,n={};for(t in e)Q.call(e,t)&&(n[function(e){let t=e.replace(X,el);return"ms-"===t.slice(0,3)&&(t="-"+t),t}(t)]=e[t]);return n}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?E[r.property]||r.property:r.attribute,n]}}(e,r,t.properties[r]);if(s){let[r,o]=s;e.tableCellAlignToStyle&&"align"===r&&"string"==typeof o&&ee.has(t.tagName)?n=o:i[r]=o}}return n&&((i.style||(i.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=n),i}(i,s),y=es(i,s),Z.has(s.tagName)&&(y=y.filter(function(e){return"string"!=typeof e||!("object"==typeof e?"text"===e.type&&a(e.value):a(e))})),er(i,b,x,s),ei(b,y),i.ancestors.pop(),i.schema=m,i.create(s,x,b,o)):"mdxFlowExpression"===n.type||"mdxTextExpression"===n.type?function(e,n){if(n.data&&n.data.estree&&e.evaluater){let r=n.data.estree.body[0];return(0,t.ok)("ExpressionStatement"===r.type),e.evaluater.evaluateExpression(r.expression)}ea(e,n.position)}(e,n):"mdxJsxFlowElement"===n.type||"mdxJsxTextElement"===n.type?(u=e,c=n,d=r,I=T=u.schema,"svg"===c.name&&"html"===T.space&&(u.schema=z),u.ancestors.push(c),A=null===c.name?u.Fragment:eo(u,c.name,!0),N=function(e,n){let r={};for(let i of n.attributes)if("mdxJsxExpressionAttribute"===i.type)if(i.data&&i.data.estree&&e.evaluater){let n=i.data.estree.body[0];(0,t.ok)("ExpressionStatement"===n.type);let s=n.expression;(0,t.ok)("ObjectExpression"===s.type);let o=s.properties[0];(0,t.ok)("SpreadElement"===o.type),Object.assign(r,e.evaluater.evaluateExpression(o.argument))}else ea(e,n.position);else{let s,o=i.name;if(i.value&&"object"==typeof i.value)if(i.value.data&&i.value.data.estree&&e.evaluater){let n=i.value.data.estree.body[0];(0,t.ok)("ExpressionStatement"===n.type),s=e.evaluater.evaluateExpression(n.expression)}else ea(e,n.position);else s=null===i.value||i.value;r[o]=s}return r}(u,c),M=es(u,c),er(u,N,A,c),ei(N,M),u.ancestors.pop(),u.schema=T,u.create(c,A,N,d)):"mdxjsEsm"===n.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ea(e,t.position)}(e,n):"root"===n.type?(h=e,p=n,f=r,ei(R={},es(h,p)),h.create(p,h.Fragment,R,f)):"text"===n.type?n.value:void 0}function er(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ei(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function es(e,t){let n=[],r=-1,i=e.passKeys?new Map:Y;for(;++r<t.children.length;){let s,o=t.children[r];if(e.passKeys){let e="element"===o.type?o.tagName:"mdxJsxFlowElement"===o.type||"mdxJsxTextElement"===o.type?o.name:void 0;if(e){let t=i.get(e)||0;s=e+"-"+t,i.set(e,t+1)}}let a=en(e,o,s);void 0!==a&&n.push(a)}return n}function eo(e,n,r){let i;if(r)if(n.includes(".")){let e,r=n.split("."),o=-1;for(;++o<r.length;){let t=s(r[o])?{type:"Identifier",name:r[o]}:{type:"Literal",value:r[o]};e=e?{type:"MemberExpression",object:e,property:t,computed:!!(o&&"Literal"===t.type),optional:!1}:t}(0,t.ok)(e,"always a result"),i=e}else i=s(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};else i={type:"Literal",value:n};if("Literal"===i.type){let t=i.value;return Q.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(i);ea(e)}function ea(e,t){let n=new J("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=et+"#cannot-handle-mdx-estrees-without-createevaluater",n}function el(e){return"-"+e.toLowerCase()}let eu={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};var ec=e.i(679606);e.i(152155);let ed={};function eh(e,t){let n=t||ed;return ep(e,"boolean"!=typeof n.includeImageAlt||n.includeImageAlt,"boolean"!=typeof n.includeHtml||n.includeHtml)}function ep(e,t,n){var r;if((r=e)&&"object"==typeof r){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return ef(e.children,t,n)}return Array.isArray(e)?ef(e,t,n):""}function ef(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ep(e[i],t,n);return r.join("")}function em(e,t,n,r){let i,s=e.length,o=0;if(t=t<0?-t>s?0:s+t:t>s?s:t,n=n>0?n:0,r.length<1e4)(i=Array.from(r)).unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);o<r.length;)(i=r.slice(o,o+1e4)).unshift(t,0),e.splice(...i),o+=1e4,t+=1e4}function eg(e,t){return e.length>0?(em(e,e.length,0,t),e):t}e.s(["toString",()=>eh],12105),e.s(["push",()=>eg,"splice",()=>em],559245);let ex={}.hasOwnProperty;function eb(e){let t={},n=-1;for(;++n<e.length;)!function(e,t){let n;for(n in t){let r,i=(ex.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];if(s)for(r in s){ex.call(i,r)||(i[r]=[]);let e=s[r];!function(e,t){let n=-1,r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);em(e,0,0,r)}(i[r],Array.isArray(e)?e:e?[e]:[])}}}(t,e[n]);return t}e.s(["combineExtensions",()=>eb],144819);let ey=eN(/[A-Za-z]/),ev=eN(/[\dA-Za-z]/),ek=eN(/[#-'*+\--9=?A-Z^-~]/);function ew(e){return null!==e&&(e<32||127===e)}let eS=eN(/\d/),e_=eN(/[\dA-Fa-f]/),eC=eN(/[!-/:-@[-`{-~]/);function ej(e){return null!==e&&e<-2}function eE(e){return null!==e&&(e<0||32===e)}function eT(e){return -2===e||-1===e||32===e}let eI=eN(/\p{P}|\p{S}/u),eA=eN(/\s/);function eN(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function eM(e,t,n,r){let i=r?r-1:1/0,s=0;return function(r){return eT(r)?(e.enter(n),function r(o){return eT(o)&&s++<i?(e.consume(o),r):(e.exit(n),t(o))}(r)):t(r)}}e.s(["asciiAlpha",0,ey,"asciiAlphanumeric",0,ev,"asciiAtext",0,ek,"asciiControl",()=>ew,"asciiDigit",0,eS,"asciiHexDigit",0,e_,"asciiPunctuation",0,eC,"markdownLineEnding",()=>ej,"markdownLineEndingOrSpace",()=>eE,"markdownSpace",()=>eT,"unicodePunctuation",0,eI,"unicodeWhitespace",0,eA],455470),e.s(["factorySpace",()=>eM],133220);let eR={tokenize:function(e){let t,n=e.attempt(this.parser.constructs.contentInitial,function(t){return null===t?void e.consume(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eM(e,n,"linePrefix"))},function(n){return e.enter("paragraph"),function n(r){let i=e.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=i),t=i,function t(r){if(null===r){e.exit("chunkText"),e.exit("paragraph"),e.consume(r);return}return ej(r)?(e.consume(r),e.exit("chunkText"),n):(e.consume(r),t)}(r)}(n)});return n}},eP={tokenize:function(e){let t,n,r,i=this,s=[],o=0;return a;function a(t){if(o<s.length){let n=s[o];return i.containerState=n[1],e.attempt(n[0].continuation,l,u)(t)}return u(t)}function l(e){if(o++,i.containerState._closeFlow){let n;i.containerState._closeFlow=void 0,t&&x();let r=i.events.length,s=r;for(;s--;)if("exit"===i.events[s][0]&&"chunkFlow"===i.events[s][1].type){n=i.events[s][1].end;break}g(o);let a=r;for(;a<i.events.length;)i.events[a][1].end={...n},a++;return em(i.events,s+1,0,i.events.slice(r)),i.events.length=a,u(e)}return a(e)}function u(n){if(o===s.length){if(!t)return h(n);if(t.currentConstruct&&t.currentConstruct.concrete)return f(n);i.interrupt=!!(t.currentConstruct&&!t._gfmTableDynamicInterruptHack)}return i.containerState={},e.check(eD,c,d)(n)}function c(e){return t&&x(),g(o),h(e)}function d(e){return i.parser.lazy[i.now().line]=o!==s.length,r=i.now().offset,f(e)}function h(t){return i.containerState={},e.attempt(eD,p,f)(t)}function p(e){return o++,s.push([i.currentConstruct,i.containerState]),h(e)}function f(r){if(null===r){t&&x(),g(0),e.consume(r);return}return t=t||i.parser.flow(i.now()),e.enter("chunkFlow",{_tokenizer:t,contentType:"flow",previous:n}),function t(n){if(null===n){m(e.exit("chunkFlow"),!0),g(0),e.consume(n);return}return ej(n)?(e.consume(n),m(e.exit("chunkFlow")),o=0,i.interrupt=void 0,a):(e.consume(n),t)}(r)}function m(e,s){let a=i.sliceStream(e);if(s&&a.push(null),e.previous=n,n&&(n.next=e),n=e,t.defineSkip(e.start),t.write(a),i.parser.lazy[e.start.line]){let e,n,s=t.events.length;for(;s--;)if(t.events[s][1].start.offset<r&&(!t.events[s][1].end||t.events[s][1].end.offset>r))return;let a=i.events.length,l=a;for(;l--;)if("exit"===i.events[l][0]&&"chunkFlow"===i.events[l][1].type){if(e){n=i.events[l][1].end;break}e=!0}for(g(o),s=a;s<i.events.length;)i.events[s][1].end={...n},s++;em(i.events,l+1,0,i.events.slice(a)),i.events.length=s}}function g(t){let n=s.length;for(;n-- >t;){let t=s[n];i.containerState=t[1],t[0].exit.call(i,e)}s.length=t}function x(){t.write([null]),n=void 0,t=void 0,i.containerState._closeFlow=void 0}}},eD={tokenize:function(e,t,n){return eM(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}},eO={partial:!0,tokenize:function(e,t,n){return function(t){return eT(t)?eM(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||ej(e)?t(e):n(e)}}};e.s(["blankLine",0,eO],51256);class eF{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=null==t?1/0:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-(t||0),1/0);return n&&eL(this.left,n),r.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),eL(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),eL(this.right,e.reverse())}setCursor(e){if(e!==this.left.length&&(!(e>this.left.length)||0!==this.right.length)&&(!(e<0)||0!==this.left.length))if(e<this.left.length){let t=this.left.splice(e,1/0);eL(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);eL(this.left,t.reverse())}}}function eL(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function eB(e){let t,n,r,i,s,o,a,l={},u=-1,c=new eF(e);for(;++u<c.length;){for(;u in l;)u=l[u];if(t=c.get(u),u&&"chunkFlow"===t[1].type&&"listItemPrefix"===c.get(u-1)[1].type&&((r=0)<(o=t[1]._tokenizer.events).length&&"lineEndingBlank"===o[r][1].type&&(r+=2),r<o.length&&"content"===o[r][1].type))for(;++r<o.length&&"content"!==o[r][1].type;)"chunkText"===o[r][1].type&&(o[r][1]._isInFirstContentOfListItem=!0,r++);if("enter"===t[0])t[1].contentType&&(Object.assign(l,function(e,t){let n,r,i=e.get(t)[1],s=e.get(t)[2],o=t-1,a=[],l=i._tokenizer;!l&&(l=s.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));let u=l.events,c=[],d={},h=-1,p=i,f=0,m=0,g=[0];for(;p;){for(;e.get(++o)[1]!==p;);a.push(o),!p._tokenizer&&(n=s.sliceStream(p),p.next||n.push(null),r&&l.defineSkip(p.start),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(n),p._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),r=p,p=p.next}for(p=i;++h<u.length;)"exit"===u[h][0]&&"enter"===u[h-1][0]&&u[h][1].type===u[h-1][1].type&&u[h][1].start.line!==u[h][1].end.line&&(m=h+1,g.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(l.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),h=g.length;h--;){let t=u.slice(g[h],g[h+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),h=-1;++h<c.length;)d[f+c[h][0]]=f+c[h][1],f+=c[h][1]-c[h][0]-1;return d}(c,u)),u=l[u],a=!0);else if(t[1]._container){for(r=u,n=void 0;r--;)if("lineEnding"===(i=c.get(r))[1].type||"lineEndingBlank"===i[1].type)"enter"===i[0]&&(n&&(c.get(n)[1].type="lineEndingBlank"),i[1].type="lineEnding",n=r);else if("linePrefix"===i[1].type||"listItemIndent"===i[1].type);else break;n&&(t[1].end={...c.get(n)[1].start},(s=c.slice(n,u)).unshift(t),c.splice(n,u-n+1,s))}}return em(e,0,1/0,c.slice(0)),!a}let ez={resolve:function(e){return eB(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?i(t):ej(t)?e.check(e$,s,i)(t):(e.consume(t),r)}function i(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},e$={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eM(e,i,"linePrefix")};function i(i){if(null===i||ej(i))return n(i);let s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}},eU={tokenize:function(e){let t=this,n=e.attempt(eO,function(r){return null===r?void e.consume(r):(e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n)},e.attempt(this.parser.constructs.flowInitial,r,eM(e,e.attempt(this.parser.constructs.flow,r,e.attempt(ez,r)),"linePrefix")));return n;function r(r){return null===r?void e.consume(r):(e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n)}}},eq={resolveAll:eK()},eH=eW("string"),eV=eW("text");function eW(e){return{resolveAll:eK("text"===e?eG:void 0),tokenize:function(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,s,o);return s;function s(e){return l(e)?i(e):o(e)}function o(e){return null===e?void t.consume(e):(t.enter("data"),t.consume(e),a)}function a(e){return l(e)?(t.exit("data"),i(e)):(t.consume(e),a)}function l(e){if(null===e)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function eK(e){return function(t,n){let r,i=-1;for(;++i<=t.length;)void 0===r?t[i]&&"data"===t[i][1].type&&(r=i,i++):t[i]&&"data"===t[i][1].type||(i!==r+2&&(t[r][1].end=t[i-1][1].end,t.splice(r+2,i-r-2),i=r+2),r=void 0);return e?e(t,n):t}}function eG(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){let r,i=e[n-1][1],s=t.sliceStream(i),o=s.length,a=-1,l=0;for(;o--;){let e=s[o];if("string"==typeof e){for(a=e.length;32===e.charCodeAt(a-1);)l++,a--;if(a)break;a=-1}else if(-2===e)r=!0,l++;else if(-1===e);else{o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){let s={type:n===e.length||r||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:i.start._bufferIndex+a,_index:i.start._index+o,line:i.end.line,column:i.end.column-l,offset:i.end.offset-l},end:{...i.end}};i.end={...s.start},i.start.offset===i.end.offset?Object.assign(i,s):(e.splice(n,0,["enter",s,t],["exit",s,t]),n+=2)}n++}return e}function eJ(e){return null===e||eE(e)||eA(e)?1:eI(e)?2:void 0}function eQ(e,t,n){let r=[],i=-1;for(;++i<e.length;){let s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}e.s(["classifyCharacter",()=>eJ],227066),e.s(["resolveAll",()=>eQ],705568);let eY={name:"attention",resolveAll:function(e,t){let n,r,i,s,o,a,l,u,c=-1;for(;++c<e.length;)if("enter"===e[c][0]&&"attentionSequence"===e[c][1].type&&e[c][1]._close){for(n=c;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[c][1]).charCodeAt(0)){if((e[n][1]._close||e[c][1]._open)&&(e[c][1].end.offset-e[c][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[c][1].end.offset-e[c][1].start.offset)%3))continue;a=e[n][1].end.offset-e[n][1].start.offset>1&&e[c][1].end.offset-e[c][1].start.offset>1?2:1;let d={...e[n][1].end},h={...e[c][1].start};eX(d,-a),eX(h,a),s={type:a>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:a>1?"strongSequence":"emphasisSequence",start:{...e[c][1].start},end:h},i={type:a>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[c][1].start}},r={type:a>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[c][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=eg(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=eg(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",i,t]]),l=eg(l,eQ(t.parser.constructs.insideSpan.null,e.slice(n+1,c),t)),l=eg(l,[["exit",i,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[c][1].end.offset-e[c][1].start.offset?(u=2,l=eg(l,[["enter",e[c][1],t],["exit",e[c][1],t]])):u=0,em(e,n-1,c-n+3,l),c=n+l.length-u-2;break}}for(c=-1;++c<e.length;)"attentionSequence"===e[c][1].type&&(e[c][1].type="data");return e},tokenize:function(e,t){let n,r=this.parser.constructs.attentionMarkers.null,i=this.previous,s=eJ(i);return function(o){return n=o,e.enter("attentionSequence"),function o(a){if(a===n)return e.consume(a),o;let l=e.exit("attentionSequence"),u=eJ(a),c=!u||2===u&&s||r.includes(a),d=!s||2===s&&u||r.includes(i);return l._open=!!(42===n?c:c&&(s||!d)),l._close=!!(42===n?d:d&&(u||!c)),t(a)}(o)}}};function eX(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}let eZ={continuation:{tokenize:function(e,t,n){let r=this;return function(t){return eT(t)?eM(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):i(t)};function i(r){return e.attempt(eZ,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){let r=this;return function(t){if(62===t){let n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),i}return n(t)};function i(n){return eT(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}},e0={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return eC(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}},e1=document.createElement("i");function e5(e){let t="&"+e+";";e1.innerHTML=t;let n=e1.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&n!==t&&n}let e2={name:"characterReference",tokenize:function(e,t,n){let r,i,s=this,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),a};function a(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),r=31,i=ev,u(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),r=6,i=e_,u):(e.enter("characterReferenceValue"),r=7,i=eS,u(t))}function u(a){if(59===a&&o){let r=e.exit("characterReferenceValue");return i!==ev||e5(s.sliceSerialize(r))?(e.enter("characterReferenceMarker"),e.consume(a),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(a)}return i(a)&&o++<r?(e.consume(a),u):n(a)}}},e3={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return null===t?n(t):(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},e4={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){let r,i=this,s={partial:!0,tokenize:function(e,t,n){let s=0;return function(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),o};function o(t){return e.enter("codeFencedFence"),eT(t)?eM(e,l,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):l(t)}function l(t){return t===r?(e.enter("codeFencedFenceSequence"),function t(i){return i===r?(s++,e.consume(i),t):s>=a?(e.exit("codeFencedFenceSequence"),eT(i)?eM(e,u,"whitespace")(i):u(i)):n(i)}(t)):n(t)}function u(r){return null===r||ej(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}},o=0,a=0;return function(t){var s;let u;return s=t,o=(u=i.events[i.events.length-1])&&"linePrefix"===u[1].type?u[2].sliceSerialize(u[1],!0).length:0,r=s,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),function t(i){return i===r?(a++,e.consume(i),t):a<3?n(i):(e.exit("codeFencedFenceSequence"),eT(i)?eM(e,l,"whitespace")(i):l(i))}(s)};function l(s){return null===s||ej(s)?(e.exit("codeFencedFence"),i.interrupt?t(s):e.check(e3,c,f)(s)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||ej(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(i)):eT(i)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),eM(e,u,"whitespace")(i)):96===i&&i===r?n(i):(e.consume(i),t)}(s))}function u(t){return null===t||ej(t)?l(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),function t(i){return null===i||ej(i)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(i)):96===i&&i===r?n(i):(e.consume(i),t)}(t))}function c(t){return e.attempt(s,f,d)(t)}function d(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&eT(t)?eM(e,p,"linePrefix",o+1)(t):p(t)}function p(t){return null===t||ej(t)?e.check(e3,c,f)(t):(e.enter("codeFlowValue"),function t(n){return null===n||ej(n)?(e.exit("codeFlowValue"),p(n)):(e.consume(n),t)}(t))}function f(n){return e.exit("codeFenced"),t(n)}}},e6={name:"codeIndented",tokenize:function(e,t,n){let r=this;return function(t){return e.enter("codeIndented"),eM(e,i,"linePrefix",5)(t)};function i(t){let i=r.events[r.events.length-1];return i&&"linePrefix"===i[1].type&&i[2].sliceSerialize(i[1],!0).length>=4?function t(n){return null===n?s(n):ej(n)?e.attempt(e9,t,s)(n):(e.enter("codeFlowValue"),function n(r){return null===r||ej(r)?(e.exit("codeFlowValue"),t(r)):(e.consume(r),n)}(n))}(t):n(t)}function s(n){return e.exit("codeIndented"),t(n)}}},e9={partial:!0,tokenize:function(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):ej(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):eM(e,s,"linePrefix",5)(t)}function s(e){let s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):ej(e)?i(e):n(e)}}};function e7(e,t,n,r,i,s,o,a,l){let u=l||1/0,c=0;return function(t){return 60===t?(e.enter(r),e.enter(i),e.enter(s),e.consume(t),e.exit(s),d):null===t||32===t||41===t||ew(t)?n(t):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),f(t))};function d(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),h(n))}function h(t){return 62===t?(e.exit("chunkString"),e.exit(a),d(t)):null===t||60===t||ej(t)?n(t):(e.consume(t),92===t?p:h)}function p(t){return 60===t||62===t||92===t?(e.consume(t),h):h(t)}function f(i){return!c&&(null===i||41===i||eE(i))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(i)):c<u&&40===i?(e.consume(i),c++,f):41===i?(e.consume(i),c--,f):null===i||32===i||40===i||ew(i)?n(i):(e.consume(i),92===i?m:f)}function m(t){return 40===t||41===t||92===t?(e.consume(t),f):f(t)}}function e8(e,t,n,r,i,s){let o,a=this,l=0;return function(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(s),u};function u(d){return l>999||null===d||91===d||93===d&&!o||94===d&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(d):93===d?(e.exit(s),e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):ej(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(t){return null===t||91===t||93===t||ej(t)||l++>999?(e.exit("chunkString"),u(t)):(e.consume(t),o||(o=!eT(t)),92===t?d:c)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}}function te(e,t,n,r,i,s){let o;return function(t){return 34===t||39===t||40===t?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=40===t?41:t,a):n(t)};function a(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),a(o)):null===t?n(t):ej(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),eM(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(t))}function u(t){return t===o||null===t||ej(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?c:u)}function c(t){return t===o||92===t?(e.consume(t),u):u(t)}}function tt(e,t){let n;return function r(i){return ej(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):eT(i)?eM(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}function tn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}e.s(["normalizeIdentifier",()=>tn],784484);let tr={partial:!0,tokenize:function(e,t,n){return function(t){return eE(t)?tt(e,r)(t):n(t)};function r(t){return te(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function i(t){return eT(t)?eM(e,s,"whitespace")(t):s(t)}function s(e){return null===e||ej(e)?t(e):n(e)}}},ti=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ts=["pre","script","style","textarea"],to={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(eO,t,n)}}},ta={partial:!0,tokenize:function(e,t,n){let r=this;return function(t){return ej(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):n(t)};function i(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tl={name:"labelEnd",resolveAll:function(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){let e="labelImage"===r.type?4:2;r.type="data",t+=e}}return e.length!==n.length&&em(e,0,e.length,n),e},resolveTo:function(e,t){let n,r,i,s,o=e.length,a=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(i){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){a=2;break}}else"labelEnd"===n.type&&(i=o);let l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[r][1].start},end:{...e[i][1].end}},c={type:"labelText",start:{...e[r+a+2][1].end},end:{...e[i-2][1].start}};return s=eg(s=[["enter",l,t],["enter",u,t]],e.slice(r+1,r+a+3)),s=eg(s,[["enter",c,t]]),s=eg(s,eQ(t.parser.constructs.insideSpan.null,e.slice(r+a+4,i-3),t)),s=eg(s,[["exit",c,t],e[i-2],e[i-1],["exit",u,t]]),s=eg(s,e.slice(i+1)),s=eg(s,[["exit",l,t]]),em(e,r,e.length,s),e},tokenize:function(e,t,n){let r,i,s=this,o=s.events.length;for(;o--;)if(("labelImage"===s.events[o][1].type||"labelLink"===s.events[o][1].type)&&!s.events[o][1]._balanced){r=s.events[o][1];break}return function(t){return r?r._inactive?c(t):(i=s.parser.defined.includes(tn(s.sliceSerialize({start:r.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),a):n(t)};function a(t){return 40===t?e.attempt(tu,u,i?u:c)(t):91===t?e.attempt(tc,u,i?l:c)(t):i?u(t):c(t)}function l(t){return e.attempt(td,u,c)(t)}function u(e){return t(e)}function c(e){return r._balanced=!0,n(e)}}},tu={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return eE(t)?tt(e,i)(t):i(t)}function i(t){return 41===t?u(t):e7(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return eE(t)?tt(e,a)(t):u(t)}function o(e){return n(e)}function a(t){return 34===t||39===t||40===t?te(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):u(t)}function l(t){return eE(t)?tt(e,u)(t):u(t)}function u(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},tc={tokenize:function(e,t,n){let r=this;return function(t){return e8.call(r,e,i,s,"reference","referenceMarker","referenceString")(t)};function i(e){return r.parser.defined.includes(tn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},td={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}},th={name:"labelStartImage",resolveAll:tl.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),i};function i(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tp={name:"labelStartLink",resolveAll:tl.resolveAll,tokenize:function(e,t,n){let r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),i};function i(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}},tf={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),eM(e,t,"linePrefix")}}},tm={name:"thematicBreak",tokenize:function(e,t,n){let r,i=0;return function(s){var o;return e.enter("thematicBreak"),r=o=s,function s(o){return o===r?(e.enter("thematicBreakSequence"),function t(n){return n===r?(e.consume(n),i++,t):(e.exit("thematicBreakSequence"),eT(n)?eM(e,s,"whitespace")(n):s(n))}(o)):i>=3&&(null===o||ej(o))?(e.exit("thematicBreak"),t(o)):n(o)}(o)}}},tg={continuation:{tokenize:function(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(eO,function(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,eM(e,t,"listItemIndent",r.containerState.size+1)(n)},function(n){return r.containerState.furtherBlankLines||!eT(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(tb,t,i)(n))});function i(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,eM(e,e.attempt(tg,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){let r=this,i=r.events[r.events.length-1],s=i&&"linePrefix"===i[1].type?i[2].sliceSerialize(i[1],!0).length:0,o=0;return function(t){let i=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===i?!r.containerState.marker||t===r.containerState.marker:eS(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),"listUnordered"===i)return e.enter("listItemPrefix"),42===t||45===t?e.check(tm,n,a)(t):a(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),function t(i){return eS(i)&&++o<10?(e.consume(i),t):(!r.interrupt||o<2)&&(r.containerState.marker?i===r.containerState.marker:41===i||46===i)?(e.exit("listItemValue"),a(i)):n(i)}(t)}return n(t)};function a(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(eO,r.interrupt?n:l,e.attempt(tx,c,u))}function l(e){return r.containerState.initialBlankLine=!0,s++,c(e)}function u(t){return eT(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),c):n(t)}function c(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},tx={partial:!0,tokenize:function(e,t,n){let r=this;return eM(e,function(e){let i=r.events[r.events.length-1];return!eT(e)&&i&&"listItemPrefixWhitespace"===i[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},tb={partial:!0,tokenize:function(e,t,n){let r=this;return eM(e,function(e){let i=r.events[r.events.length-1];return i&&"listItemIndent"===i[1].type&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}},ty={name:"setextUnderline",resolveTo:function(e,t){let n,r,i,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),i||"definition"!==e[s][1].type||(i=s);let o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};return e[r][1].type="setextHeadingText",i?(e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[n][1],t]),e[n][1].end={...e[i][1].end}):e[n][1]=o,e.push(["exit",o,t]),e},tokenize:function(e,t,n){let r,i=this;return function(t){var o;let a,l=i.events.length;for(;l--;)if("lineEnding"!==i.events[l][1].type&&"linePrefix"!==i.events[l][1].type&&"content"!==i.events[l][1].type){a="paragraph"===i.events[l][1].type;break}return!i.parser.lazy[i.now().line]&&(i.interrupt||a)?(e.enter("setextHeadingLine"),r=t,o=t,e.enter("setextHeadingLineSequence"),function t(n){return n===r?(e.consume(n),t):(e.exit("setextHeadingLineSequence"),eT(n)?eM(e,s,"lineSuffix")(n):s(n))}(o)):n(t)};function s(r){return null===r||ej(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};e.s(["attentionMarkers",0,{null:[42,95]},"contentInitial",0,{91:{name:"definition",tokenize:function(e,t,n){let r,i=this;return function(t){var r;return e.enter("definition"),r=t,e8.call(i,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(r)};function s(t){return(r=tn(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),58===t)?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return eE(t)?tt(e,a)(t):a(t)}function a(t){return e7(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(tr,u,u)(t)}function u(t){return eT(t)?eM(e,c,"whitespace")(t):c(t)}function c(s){return null===s||ej(s)?(e.exit("definition"),i.parser.defined.push(r),t(s)):n(s)}}}},"disable",0,{null:[]},"document",0,{42:tg,43:tg,45:tg,48:tg,49:tg,50:tg,51:tg,52:tg,53:tg,54:tg,55:tg,56:tg,57:tg,62:eZ},"flow",0,{35:{name:"headingAtx",resolve:function(e,t){let n,r,i=e.length-2,s=3;return"whitespace"===e[3][1].type&&(s+=2),i-2>s&&"whitespace"===e[i][1].type&&(i-=2),"atxHeadingSequence"===e[i][1].type&&(s===i-1||i-4>s&&"whitespace"===e[i-2][1].type)&&(i-=s+1===i?2:4),i>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[i][1].end},r={type:"chunkText",start:e[s][1].start,end:e[i][1].end,contentType:"text"},em(e,s,i-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]])),e},tokenize:function(e,t,n){let r=0;return function(i){var s;return e.enter("atxHeading"),s=i,e.enter("atxHeadingSequence"),function i(s){return 35===s&&r++<6?(e.consume(s),i):null===s||eE(s)?(e.exit("atxHeadingSequence"),function n(r){return 35===r?(e.enter("atxHeadingSequence"),function t(r){return 35===r?(e.consume(r),t):(e.exit("atxHeadingSequence"),n(r))}(r)):null===r||ej(r)?(e.exit("atxHeading"),t(r)):eT(r)?eM(e,n,"whitespace")(r):(e.enter("atxHeadingText"),function t(r){return null===r||35===r||eE(r)?(e.exit("atxHeadingText"),n(r)):(e.consume(r),t)}(r))}(s)):n(s)}(s)}}},42:tm,45:[ty,tm],60:{concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););return t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e},tokenize:function(e,t,n){let r,i,s,o,a,l=this;return function(t){var n;return n=t,e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(n),u};function u(o){return 33===o?(e.consume(o),c):47===o?(e.consume(o),i=!0,p):63===o?(e.consume(o),r=3,l.interrupt?t:M):ey(o)?(e.consume(o),s=String.fromCharCode(o),f):n(o)}function c(i){return 45===i?(e.consume(i),r=2,d):91===i?(e.consume(i),r=5,o=0,h):ey(i)?(e.consume(i),r=4,l.interrupt?t:M):n(i)}function d(r){return 45===r?(e.consume(r),l.interrupt?t:M):n(r)}function h(r){let i="CDATA[";return r===i.charCodeAt(o++)?(e.consume(r),o===i.length)?l.interrupt?t:_:h:n(r)}function p(t){return ey(t)?(e.consume(t),s=String.fromCharCode(t),f):n(t)}function f(o){if(null===o||47===o||62===o||eE(o)){let a=47===o,u=s.toLowerCase();return!a&&!i&&ts.includes(u)?(r=1,l.interrupt?t(o):_(o)):ti.includes(s.toLowerCase())?(r=6,a)?(e.consume(o),m):l.interrupt?t(o):_(o):(r=7,l.interrupt&&!l.parser.lazy[l.now().line]?n(o):i?function t(n){return eT(n)?(e.consume(n),t):w(n)}(o):g(o))}return 45===o||ev(o)?(e.consume(o),s+=String.fromCharCode(o),f):n(o)}function m(r){return 62===r?(e.consume(r),l.interrupt?t:_):n(r)}function g(t){return 47===t?(e.consume(t),w):58===t||95===t||ey(t)?(e.consume(t),x):eT(t)?(e.consume(t),g):w(t)}function x(t){return 45===t||46===t||58===t||95===t||ev(t)?(e.consume(t),x):b(t)}function b(t){return 61===t?(e.consume(t),y):eT(t)?(e.consume(t),b):g(t)}function y(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,v):eT(t)?(e.consume(t),y):function t(n){return null===n||34===n||39===n||47===n||60===n||61===n||62===n||96===n||eE(n)?b(n):(e.consume(n),t)}(t)}function v(t){return t===a?(e.consume(t),a=null,k):null===t||ej(t)?n(t):(e.consume(t),v)}function k(e){return 47===e||62===e||eT(e)?g(e):n(e)}function w(t){return 62===t?(e.consume(t),S):n(t)}function S(t){return null===t||ej(t)?_(t):eT(t)?(e.consume(t),S):n(t)}function _(t){return 45===t&&2===r?(e.consume(t),T):60===t&&1===r?(e.consume(t),I):62===t&&4===r?(e.consume(t),R):63===t&&3===r?(e.consume(t),M):93===t&&5===r?(e.consume(t),N):ej(t)&&(6===r||7===r)?(e.exit("htmlFlowData"),e.check(to,P,C)(t)):null===t||ej(t)?(e.exit("htmlFlowData"),C(t)):(e.consume(t),_)}function C(t){return e.check(ta,j,P)(t)}function j(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),E}function E(t){return null===t||ej(t)?C(t):(e.enter("htmlFlowData"),_(t))}function T(t){return 45===t?(e.consume(t),M):_(t)}function I(t){return 47===t?(e.consume(t),s="",A):_(t)}function A(t){if(62===t){let n=s.toLowerCase();return ts.includes(n)?(e.consume(t),R):_(t)}return ey(t)&&s.length<8?(e.consume(t),s+=String.fromCharCode(t),A):_(t)}function N(t){return 93===t?(e.consume(t),M):_(t)}function M(t){return 62===t?(e.consume(t),R):45===t&&2===r?(e.consume(t),M):_(t)}function R(t){return null===t||ej(t)?(e.exit("htmlFlowData"),P(t)):(e.consume(t),R)}function P(n){return e.exit("htmlFlow"),t(n)}}},61:ty,95:tm,96:e4,126:e4},"flowInitial",0,{[-2]:e6,[-1]:e6,32:e6},"insideSpan",0,{null:[eY,eq]},"string",0,{38:e2,92:e0},"text",0,{[-5]:tf,[-4]:tf,[-3]:tf,33:th,38:e2,42:eY,60:[{name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i};function i(t){return ey(t)?(e.consume(t),s):64===t?n(t):a(t)}function s(t){return 43===t||45===t||46===t||ev(t)?(r=1,function t(n){return 58===n?(e.consume(n),r=0,o):(43===n||45===n||46===n||ev(n))&&r++<32?(e.consume(n),t):(r=0,a(n))}(t)):a(t)}function o(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||ew(r)?n(r):(e.consume(r),o)}function a(t){return 64===t?(e.consume(t),l):ek(t)?(e.consume(t),a):n(t)}function l(i){return ev(i)?function i(s){return 46===s?(e.consume(s),r=0,l):62===s?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(s),e.exit("autolinkMarker"),e.exit("autolink"),t):function t(s){if((45===s||ev(s))&&r++<63){let n=45===s?t:i;return e.consume(s),n}return n(s)}(s)}(i):n(i)}}},{name:"htmlText",tokenize:function(e,t,n){let r,i,s,o=this;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),a};function a(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),b):ey(t)?(e.consume(t),w):n(t)}function l(t){return 45===t?(e.consume(t),u):91===t?(e.consume(t),i=0,p):ey(t)?(e.consume(t),x):n(t)}function u(t){return 45===t?(e.consume(t),h):n(t)}function c(t){return null===t?n(t):45===t?(e.consume(t),d):ej(t)?(s=c,A(t)):(e.consume(t),c)}function d(t){return 45===t?(e.consume(t),h):c(t)}function h(e){return 62===e?I(e):45===e?d(e):c(e)}function p(t){let r="CDATA[";return t===r.charCodeAt(i++)?(e.consume(t),i===r.length?f:p):n(t)}function f(t){return null===t?n(t):93===t?(e.consume(t),m):ej(t)?(s=f,A(t)):(e.consume(t),f)}function m(t){return 93===t?(e.consume(t),g):f(t)}function g(t){return 62===t?I(t):93===t?(e.consume(t),g):f(t)}function x(t){return null===t||62===t?I(t):ej(t)?(s=x,A(t)):(e.consume(t),x)}function b(t){return null===t?n(t):63===t?(e.consume(t),y):ej(t)?(s=b,A(t)):(e.consume(t),b)}function y(e){return 62===e?I(e):b(e)}function v(t){return ey(t)?(e.consume(t),k):n(t)}function k(t){return 45===t||ev(t)?(e.consume(t),k):function t(n){return ej(n)?(s=t,A(n)):eT(n)?(e.consume(n),t):I(n)}(t)}function w(t){return 45===t||ev(t)?(e.consume(t),w):47===t||62===t||eE(t)?S(t):n(t)}function S(t){return 47===t?(e.consume(t),I):58===t||95===t||ey(t)?(e.consume(t),_):ej(t)?(s=S,A(t)):eT(t)?(e.consume(t),S):I(t)}function _(t){return 45===t||46===t||58===t||95===t||ev(t)?(e.consume(t),_):function t(n){return 61===n?(e.consume(n),C):ej(n)?(s=t,A(n)):eT(n)?(e.consume(n),t):S(n)}(t)}function C(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),r=t,j):ej(t)?(s=C,A(t)):eT(t)?(e.consume(t),C):(e.consume(t),E)}function j(t){return t===r?(e.consume(t),r=void 0,T):null===t?n(t):ej(t)?(s=j,A(t)):(e.consume(t),j)}function E(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||eE(t)?S(t):(e.consume(t),E)}function T(e){return 47===e||62===e||eE(e)?S(e):n(e)}function I(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function A(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),N}function N(t){return eT(t)?eM(e,M,"linePrefix",o.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):M(t)}function M(t){return e.enter("htmlTextData"),s(t)}}}],91:tp,92:[{name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return ej(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}},e0],93:tl,95:eY,96:{name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,i=3;if(("lineEnding"===e[3][1].type||"space"===e[i][1].type)&&("lineEnding"===e[r][1].type||"space"===e[r][1].type)){for(t=i;++t<r;)if("codeTextData"===e[t][1].type){e[i][1].type="codeTextPadding",e[r][1].type="codeTextPadding",i+=2,r-=2;break}}for(t=i-1,r++;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):(t===r||"lineEnding"===e[t][1].type)&&(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,i,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),function t(n){return 96===n?(e.consume(n),s++,t):(e.exit("codeTextSequence"),o(n))}(t)};function o(l){return null===l?n(l):32===l?(e.enter("space"),e.consume(l),e.exit("space"),o):96===l?(i=e.enter("codeTextSequence"),r=0,function n(o){return 96===o?(e.consume(o),r++,n):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(o)):(i.type="codeTextData",a(o))}(l)):ej(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):(e.enter("codeTextData"),a(l))}function a(t){return null===t||32===t||96===t||ej(t)?(e.exit("codeTextData"),o(t)):(e.consume(t),a)}}}}],119210);var tv=e.i(119210);let tk=/[\0\t\n\r]/g;function tw(e,t){let n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(65535&n)==65535||(65535&n)==65534||n>1114111?"�":String.fromCodePoint(n)}let tS=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function t_(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){let e=n.charCodeAt(1),t=120===e||88===e;return tw(n.slice(t?2:1),t?16:10)}return e5(n)||e}let tC={}.hasOwnProperty;function tj(e){return{line:e.line,column:e.column,offset:e.offset}}function tE(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+V({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+V({start:t.start,end:t.end})+") is open");throw Error("Cannot close document, a token (`"+t.type+"`, "+V({start:t.start,end:t.end})+") is still open")}function tT(e){let t=this;t.parser=function(n){var r,i;let s,o,a,l;return"object"==typeof(r={...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})&&(i=r,r=void 0),(function(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:r(x),autolinkProtocol:u,autolinkEmail:u,atxHeading:r(f),blockQuote:r(function(){return{type:"blockquote",children:[]}}),characterEscape:u,characterReference:u,codeFenced:r(p),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:r(p,i),codeText:r(function(){return{type:"inlineCode",value:""}},i),codeTextData:u,data:u,codeFlowValue:u,definition:r(function(){return{type:"definition",identifier:"",label:null,title:null,url:""}}),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:r(function(){return{type:"emphasis",children:[]}}),hardBreakEscape:r(m),hardBreakTrailing:r(m),htmlFlow:r(g,i),htmlFlowData:u,htmlText:r(g,i),htmlTextData:u,image:r(function(){return{type:"image",title:null,url:"",alt:null}}),label:i,link:r(x),listItem:r(function(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}),listItemValue:function(e){this.data.expectingFirstListItemValue&&(this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0)},listOrdered:r(b,function(){this.data.expectingFirstListItemValue=!0}),listUnordered:r(b),paragraph:r(function(){return{type:"paragraph",children:[]}}),reference:function(){this.data.referenceType="collapsed"},referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:r(f),strong:r(function(){return{type:"strong",children:[]}}),thematicBreak:r(function(){return{type:"thematicBreak"}})},exit:{atxHeading:o(),atxHeadingSequence:function(e){let t=this.stack[this.stack.length-1];t.depth||(t.depth=this.sliceSerialize(e).length)},autolink:o(),autolinkEmail:function(e){c.call(this,e),this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)},autolinkProtocol:function(e){c.call(this,e),this.stack[this.stack.length-1].url=this.sliceSerialize(e)},blockQuote:o(),characterEscapeValue:c,characterReferenceMarkerHexadecimal:h,characterReferenceMarkerNumeric:h,characterReferenceValue:function(e){let t,n=this.sliceSerialize(e),r=this.data.characterReferenceType;r?(t=tw(n,"characterReferenceMarkerNumeric"===r?10:16),this.data.characterReferenceType=void 0):t=e5(n);let i=this.stack[this.stack.length-1];i.value+=t},characterReference:function(e){this.stack.pop().position.end=tj(e.end)},codeFenced:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}),codeFencedFence:function(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)},codeFencedFenceInfo:function(){let e=this.resume();this.stack[this.stack.length-1].lang=e},codeFencedFenceMeta:function(){let e=this.resume();this.stack[this.stack.length-1].meta=e},codeFlowValue:c,codeIndented:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}),codeText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),codeTextData:c,data:c,definition:o(),definitionDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},definitionLabelString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tn(this.sliceSerialize(e)).toLowerCase()},definitionTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},emphasis:o(),hardBreakEscape:o(d),hardBreakTrailing:o(d),htmlFlow:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlFlowData:c,htmlText:o(function(){let e=this.resume();this.stack[this.stack.length-1].value=e}),htmlTextData:c,image:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),label:function(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,"link"===n.type?n.children=e.children:n.alt=t},labelText:function(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=t.replace(tS,t_),n.identifier=tn(t).toLowerCase()},lineEnding:function(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){n.children[n.children.length-1].position.end=tj(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(u.call(this,e),c.call(this,e))},link:o(function(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:function(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=tn(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"},resourceDestinationString:function(){let e=this.resume();this.stack[this.stack.length-1].url=e},resourceTitleString:function(){let e=this.resume();this.stack[this.stack.length-1].title=e},resource:function(){this.data.inReference=void 0},setextHeading:o(function(){this.data.setextHeadingSlurpLineEnding=void 0}),setextHeadingLineSequence:function(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2},setextHeadingText:function(){this.data.setextHeadingSlurpLineEnding=!0},strong:o(),thematicBreak:o()}};!function e(t,n){let r=-1;for(;++r<n.length;){let i=n[r];Array.isArray(i)?e(t,i):function(e,t){let n;for(n in t)if(tC.call(t,n))switch(n){case"canContainEols":{let r=t[n];r&&e[n].push(...r);break}case"transforms":{let r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{let r=t[n];r&&Object.assign(e[n],r)}}}(t,i)}}(t,(e||{}).mdastExtensions||[]);let n={};return function(e){let r={type:"root",children:[]},o={stack:[r],tokenStack:[],config:t,enter:s,exit:a,buffer:i,resume:l,data:n},u=[],c=-1;for(;++c<e.length;)("listOrdered"===e[c][1].type||"listUnordered"===e[c][1].type)&&("enter"===e[c][0]?u.push(c):c=function(e,t,n){let r,i,s,o,a=t-1,l=-1,u=!1;for(;++a<=n;){let t=e[a];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=a),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=a;for(i=void 0;o--;){let t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;i&&(e[i][1].type="lineEndingBlank",u=!0),t[1].type="lineEnding",i=o}else if("linePrefix"===t[1].type||"blockQuotePrefix"===t[1].type||"blockQuotePrefixWhitespace"===t[1].type||"blockQuoteMarker"===t[1].type||"listItemIndent"===t[1].type);else break}s&&(!i||s<i)&&(r._spread=!0),r.end=Object.assign({},i?e[i][1].start:t[1].end),e.splice(i||a,0,["exit",r,t[2]]),a++,n++}if("listItemPrefix"===t[1].type){let i={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=i,e.splice(a,0,["enter",i,t[2]]),a++,n++,s=void 0,o=!0}}}return e[t][1]._spread=u,n}(e,u.pop(),c));for(c=-1;++c<e.length;){let n=t[e[c][0]];tC.call(n,e[c][1].type)&&n[e[c][1].type].call(Object.assign({sliceSerialize:e[c][2].sliceSerialize},o),e[c][1])}if(o.tokenStack.length>0){let e=o.tokenStack[o.tokenStack.length-1];(e[1]||tE).call(o,void 0,e[0])}for(r.position={start:tj(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:tj(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},c=-1;++c<t.transforms.length;)r=t.transforms[c](r)||r;return r};function r(e,t){return function(n){s.call(this,e(n),n),t&&t.call(this,n)}}function i(){this.stack.push({type:"fragment",children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:tj(t.start),end:void 0}}function o(e){return function(t){e&&e.call(this,t),a.call(this,t)}}function a(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||tE).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+V({start:e.start,end:e.end})+"): it’s not open");n.position.end=tj(e.end)}function l(){return eh(this.stack.pop())}function u(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];n&&"text"===n.type||((n={type:"text",value:""}).position={start:tj(e.start),end:void 0},t.push(n)),this.stack.push(n)}function c(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=tj(e.end)}function d(){this.data.atHardBreak=!0}function h(e){this.data.characterReferenceType=e.type}function p(){return{type:"code",lang:null,meta:null,value:""}}function f(){return{type:"heading",depth:0,children:[]}}function m(){return{type:"break"}}function g(){return{type:"html",value:""}}function x(){return{type:"link",title:null,url:"",children:[]}}function b(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}})(i)(function(e){for(;!eB(e););return e}((function(e){let t={constructs:eb([tv,...(e||{}).extensions||[]]),content:n(eR),defined:[],document:n(eP),flow:n(eU),lazy:{},string:n(eH),text:n(eV)};return t;function n(e){return function(n){return function(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},s=[],o=[],a=[],l={attempt:f(function(e,t){m(e,t.from)}),check:f(p),consume:function(e){ej(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,g()):-1!==e&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=e},enter:function(e,t){let n=t||{};return n.type=e,n.start=h(),u.events.push(["enter",n,u]),a.push(n),n},exit:function(e){let t=a.pop();return t.end=h(),u.events.push(["exit",t,u]),t},interrupt:f(p,{interrupt:!0})},u={code:null,containerState:{},defineSkip:function(e){i[e.line]=e.column,g()},events:[],now:h,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n,r=-1,i=[];for(;++r<e.length;){let s,o=e[r];if("string"==typeof o)s=o;else switch(o){case -5:s="\r";break;case -4:s="\n";break;case -3:s="\r\n";break;case -2:s=t?" ":" ";break;case -1:if(!t&&n)continue;s=" ";break;default:s=String.fromCharCode(o)}n=-2===o,i.push(s)}return i.join("")}(d(e),t)},sliceStream:d,write:function(e){return(o=eg(o,e),function(){let e;for(;r._index<o.length;){let n=o[r._index];if("string"==typeof n)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<n.length;){var t;t=n.charCodeAt(r._bufferIndex),c=c(t)}else c=c(n)}}(),null!==o[o.length-1])?[]:(m(t,0),u.events=eQ(s,u.events,u),u.events)}},c=t.tokenize.call(u,l);return t.resolveAll&&s.push(t),u;function d(e){return function(e,t){let n,r=t.start._index,i=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;if(r===s)n=[e[r].slice(i,o)];else{if(n=e.slice(r,s),i>-1){let e=n[0];"string"==typeof e?n[0]=e.slice(i):n.shift()}o>0&&n.push(e[s].slice(0,o))}return n}(o,e)}function h(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:s}}function p(e,t){t.restore()}function f(e,t){return function(n,i,s){var o;let c,d,p,f;return Array.isArray(n)?m(n):"tokenize"in n?m([n]):(o=n,function(e){let t=null!==e&&o[e],n=null!==e&&o.null;return m([...Array.isArray(t)?t:t?[t]:[],...Array.isArray(n)?n:n?[n]:[]])(e)});function m(e){return(c=e,d=0,0===e.length)?s:x(e[d])}function x(e){return function(n){let i,s,o,c,d;return(i=h(),s=u.previous,o=u.currentConstruct,c=u.events.length,d=Array.from(a),f={from:c,restore:function(){r=i,u.previous=s,u.currentConstruct=o,u.events.length=c,a=d,g()}},p=e,e.partial||(u.currentConstruct=e),e.name&&u.parser.constructs.disable.null.includes(e.name))?y(n):e.tokenize.call(t?Object.assign(Object.create(u),t):u,l,b,y)(n)}}function b(t){return e(p,f),i}function y(e){return(f.restore(),++d<c.length)?x(c[d]):s}}}function m(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&em(u.events,t,u.events.length-t,e.resolve(u.events.slice(t),u)),e.resolveTo&&(u.events=e.resolveTo(u.events,u))}function g(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}(t,e,n)}}})(i).document().write((o=1,a="",l=!0,function(e,t,n){let r,i,u,c,d,h=[];for(e=a+("string"==typeof e?e.toString():new TextDecoder(t||void 0).decode(e)),u=0,a="",l&&(65279===e.charCodeAt(0)&&u++,l=void 0);u<e.length;){if(tk.lastIndex=u,c=(r=tk.exec(e))&&void 0!==r.index?r.index:e.length,d=e.charCodeAt(c),!r){a=e.slice(u);break}if(10===d&&u===c&&s)h.push(-3),s=void 0;else switch(s&&(h.push(-5),s=void 0),u<c&&(h.push(e.slice(u,c)),o+=c-u),d){case 0:h.push(65533),o++;break;case 9:for(i=4*Math.ceil(o/4),h.push(-2);o++<i;)h.push(-1);break;case 10:h.push(-4),o=1;break;default:s=!0,o=1}u=c+1}return n&&(s&&h.push(-5),a&&h.push(a),h.push(null)),h})(n,r,!0))))}}let tI="object"==typeof self?self:globalThis,tA=e=>{var t;let n,r;return(t=new Map,n=(e,n)=>(t.set(n,e),e),r=i=>{if(t.has(i))return t.get(i);let[s,o]=e[i];switch(s){case 0:case -1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new tI[e](t),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new tI[s](o),i)})(0)},{toString:tN}={},{keys:tM}=Object,tR=e=>{let t=typeof e;if("object"!==t||!e)return[0,t];let n=tN.call(e).slice(8,-1);switch(n){case"Array":return[1,""];case"Object":return[2,""];case"Date":return[3,""];case"RegExp":return[4,""];case"Map":return[5,""];case"Set":return[6,""];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},tP=([e,t])=>0===e&&("function"===t||"symbol"===t),tD=(e,{json:t,lossy:n}={})=>{var r,i,s;let o,a,l=[];return(r=!(t||n),i=!!t,s=new Map,o=(e,t)=>{let n=l.push(e)-1;return s.set(t,n),n},a=e=>{if(s.has(e))return s.get(e);let[t,n]=tR(e);switch(t){case 0:{let i=e;switch(n){case"bigint":t=8,i=e.toString();break;case"function":case"symbol":if(r)throw TypeError("unable to serialize "+n);i=null;break;case"undefined":return o([-1],e)}return o([t,i],e)}case 1:{if(n){let t=e;return"DataView"===n?t=new Uint8Array(e.buffer):"ArrayBuffer"===n&&(t=new Uint8Array(e)),o([n,[...t]],e)}let r=[],i=o([t,r],e);for(let t of e)r.push(a(t));return i}case 2:{if(n)switch(n){case"BigInt":return o([n,e.toString()],e);case"Boolean":case"Number":case"String":return o([n,e.valueOf()],e)}if(i&&"toJSON"in e)return a(e.toJSON());let s=[],l=o([t,s],e);for(let t of tM(e))(r||!tP(tR(e[t])))&&s.push([a(t),a(e[t])]);return l}case 3:return o([t,e.toISOString()],e);case 4:{let{source:n,flags:r}=e;return o([t,{source:n,flags:r}],e)}case 5:{let n=[],i=o([t,n],e);for(let[t,i]of e)(r||!(tP(tR(t))||tP(tR(i))))&&n.push([a(t),a(i)]);return i}case 6:{let n=[],i=o([t,n],e);for(let t of e)(r||!tP(tR(t)))&&n.push(a(t));return i}}let{message:l}=e;return o([t,{name:n,message:l}],e)})(e),l},tO="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?tA(tD(e,t)):structuredClone(e):(e,t)=>tA(tD(e,t));function tF(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let s=e.charCodeAt(n),o="";if(37===s&&ev(e.charCodeAt(n+1))&&ev(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){let t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function tL(e,t){let n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function tB(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}let tz=function(e){var t,n;if(null==e)return tU;if("function"==typeof e)return t$(e);if("object"==typeof e){return Array.isArray(e)?function(e){let t=[],n=-1;for(;++n<e.length;)t[n]=tz(e[n]);return t$(function(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1})}(e):(t=e,t$(function(e){let n;for(n in t)if(e[n]!==t[n])return!1;return!0}))}if("string"==typeof e){return n=e,t$(function(e){return e&&e.type===n})}throw Error("Expected function, string, or object as test")};function t$(e){return function(t,n,r){return!!(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function tU(){return!0}e.s(["convert",0,tz],173119);let tq=[];function tH(e,t,n,r){let i;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):i=t;let s=tz(i),o=r?-1:1;(function e(i,a,l){let u=i&&"object"==typeof i?i:{};if("string"==typeof u.type){let e="string"==typeof u.tagName?u.tagName:"string"==typeof u.name?u.name:void 0;Object.defineProperty(c,"name",{value:"node ("+i.type+(e?"<"+e+">":"")+")"})}return c;function c(){var u;let c,d,h,p=tq;if((!t||s(i,a,l[l.length-1]||void 0))&&!1===(p=Array.isArray(u=n(i,l))?u:"number"==typeof u?[!0,u]:null==u?tq:[u])[0])return p;if("children"in i&&i.children&&i.children&&"skip"!==p[0])for(d=(r?i.children.length:-1)+o,h=l.concat(i);d>-1&&d<i.children.length;){if(!1===(c=e(i.children[d],d,h)())[0])return c;d="number"==typeof c[1]?c[1]:d+o}return p}})(e,void 0,[])()}function tV(e,t,n,r){let i,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,i=n):(s=t,o=n,i=r),tH(e,s,function(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},i)}function tW(e,t){let n=t.referenceType,r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),s=i[0];s&&"text"===s.type?s.value="["+s.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&"text"===o.type?o.value+=r:i.push({type:"text",value:r}),i}function tK(e){let t=e.spread;return null==t?e.children.length>1:t}function tG(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;9===t||32===t;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}e.s(["EXIT",0,!1,"visitParents",()=>tH],402652),e.s(["visit",()=>tV],216920);let tJ={blockquote:function(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){let n=t.value?t.value+"\n":"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s={type:"element",tagName:"pre",properties:{},children:[s=e.applyData(t,s)]},e.patch(t,s),s},delete:function(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){let n,r="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=tF(i.toLowerCase()),o=e.footnoteOrder.indexOf(i),a=e.footnoteCounts.get(i);void 0===a?(a=0,e.footnoteOrder.push(i),n=e.footnoteOrder.length):n=o+1,a+=1,e.footnoteCounts.set(i,a);let l={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+s,id:r+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(n)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)},heading:function(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tW(e,t);let i={src:tF(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){let n={src:tF(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return tW(e,t);let i={href:tF(r.url||"")};null!==r.title&&void 0!==r.title&&(i.title=r.title);let s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){let n={href:tF(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){let r=e.all(t),i=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=tK(n[r])}return t}(n):tK(t),s={},o=[];if("boolean"==typeof t.checked){let e,n=r[0];n&&"element"===n.type&&"p"===n.tagName?e=n:(e={type:"element",tagName:"p",properties:{},children:[]},r.unshift(e)),e.children.length>0&&e.children.unshift({type:"text",value:" "}),e.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){let e=r[a];(i||0!==a||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||i?o.push(e):o.push(...e.children)}let l=r[r.length-1];l&&(i||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});let u={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,u),e.applyData(t,u)},list:function(e,t){let n={},r=e.all(t),i=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++i<r.length;){let e=r[i];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}let s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){let n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){let n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){let n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=q(t.children[1]),o=U(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),i.push(r)}let s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){let n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){let r=n?n.children:void 0,i=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length,a=-1,l=[];for(;++a<o;){let n=t.children[a],r={},o=s?s[a]:void 0;o&&(r.align=o);let u={type:"element",tagName:i,properties:r,children:[]};n&&(u.children=e.all(n),e.patch(n,u),u=e.applyData(n,u)),l.push(u)}let u={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,u),e.applyData(t,u)},text:function(e,t){let n={type:"text",value:function(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,s=[];for(;r;)s.push(tG(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(tG(t.slice(i),i>0,!1)),s.join("")}(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:tQ,yaml:tQ,definition:tQ,footnoteDefinition:tQ};function tQ(){}let tY={}.hasOwnProperty,tX={};function tZ(e,t){e.position&&(t.position=function(e){let t=q(e),n=U(e);if(t&&n)return{start:t,end:n}}(e))}function t0(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;"string"==typeof t&&("element"===n.type?n.tagName=t:n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}),"element"===n.type&&i&&Object.assign(n.properties,tO(i)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function t1(e,t){let n=[],r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function t5(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function t2(e,n){let r,i,s,o,a=(r=n||tX,i=new Map,s=new Map,o={all:function(e){let t=[];if("children"in e){let n=e.children,r=-1;for(;++r<n.length;){let i=o.one(n[r],e);if(i){if(r&&"break"===n[r-1].type&&(Array.isArray(i)||"text"!==i.type||(i.value=t5(i.value)),!Array.isArray(i)&&"element"===i.type)){let e=i.children[0];e&&"text"===e.type&&(e.value=t5(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t},applyData:t0,definitionById:i,footnoteById:s,footnoteCounts:new Map,footnoteOrder:[],handlers:{...tJ,...r.handlers},one:function(e,t){let n=e.type,r=o.handlers[n];if(tY.call(o.handlers,n)&&r)return r(o,e,t);if(o.options.passThrough&&o.options.passThrough.includes(n)){if("children"in e){let{children:t,...n}=e,r=tO(n);return r.children=o.all(e),r}return tO(e)}return(o.options.unknownHandler||function(e,t){let n=t.data||{},r="value"in t&&!(tY.call(n,"hProperties")||tY.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)})(o,e,t)},options:r,patch:tZ,wrap:t1},tV(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){let t="definition"===e.type?i:s,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),o),l=a.one(e,void 0),u=function(e){let t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||tL,r=e.options.footnoteBackLabel||tB,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[],l=-1;for(;++l<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[l]);if(!i)continue;let s=e.all(i),o=String(i.identifier).toUpperCase(),u=tF(o.toLowerCase()),c=0,d=[],h=e.footnoteCounts.get(o);for(;void 0!==h&&++c<=h;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,c);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+u+(c>1?"-"+c:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,c),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}let p=s[s.length-1];if(p&&"element"===p.type&&"p"===p.tagName){let e=p.children[p.children.length-1];e&&"text"===e.type?e.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...d)}else s.push(...d);let f={type:"element",tagName:"li",properties:{id:t+"fn-"+u},children:e.wrap(s,!0)};e.patch(i,f),a.push(f)}if(0!==a.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...tO(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:"\n"}]}}(a),c=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return u&&((0,t.ok)("children"in c),c.children.push({type:"text",value:"\n"},u)),c}function t3(e,t){return e&&"run"in e?async function(n,r){let i=t2(n,{file:r,...t});await e.run(i,r)}:function(n,r){return t2(n,{file:r,...e||t})}}function t4(e){if(e)throw e}var t6=e.i(975609);function t9(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}let t7=function(e,t){let n;if(void 0!==t&&"string"!=typeof t)throw TypeError('"ext" argument must be a string');nn(e);let r=0,i=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else i<0&&(n=!0,i=s+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(i=s):(a=-1,i=o));return r===i?i=o:i<0&&(i=e.length),e.slice(r,i)},t8=function(e){let t;if(nn(e),0===e.length)return".";let n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},ne=function(e){let t;nn(e);let n=e.length,r=-1,i=0,s=-1,o=0;for(;n--;){let a=e.codePointAt(n);if(47===a){if(t){i=n+1;break}continue}r<0&&(t=!0,r=n+1),46===a?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1)}return s<0||r<0||0===o||1===o&&s===r-1&&s===i+1?"":e.slice(s,r)},nt=function(...e){var t;let n,r,i,s=-1;for(;++s<e.length;)nn(e[s]),e[s]&&(i=void 0===i?e[s]:i+"/"+e[s]);return void 0===i?".":(nn(t=i),n=47===t.codePointAt(0),0!==(r=function(e,t){let n,r,i="",s=0,o=-1,a=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else if(47===n)break;else n=47;if(47===n){if(o===l-1||1===a);else if(o!==l-1&&2===a){if(i.length<2||2!==s||46!==i.codePointAt(i.length-1)||46!==i.codePointAt(i.length-2)){if(i.length>2){if((r=i.lastIndexOf("/"))!==i.length-1){r<0?(i="",s=0):s=(i=i.slice(0,r)).length-1-i.lastIndexOf("/"),o=l,a=0;continue}}else if(i.length>0){i="",s=0,o=l,a=0;continue}}t&&(i=i.length>0?i+"/..":"..",s=2)}else i.length>0?i+="/"+e.slice(o+1,l):i=e.slice(o+1,l),s=l-o-1;o=l,a=0}else 46===n&&a>-1?a++:a=-1}return i}(t,!n)).length||n||(r="."),r.length>0&&47===t.codePointAt(t.length-1)&&(r+="/"),n?"/"+r:r)};function nn(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function nr(e){return!!(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}let ni=["history","path","basename","stem","extname","dirname"];class ns{constructor(e){let t,n;t=e?nr(e)?{path:e}:"string"==typeof e||function(e){return!!(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":"/",this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ni.length;){const e=ni[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)ni.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?t7(this.path):void 0}set basename(e){na(e,"basename"),no(e,"basename"),this.path=nt(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?t8(this.path):void 0}set dirname(e){nl(this.basename,"dirname"),this.path=nt(e||"",this.basename)}get extname(){return"string"==typeof this.path?ne(this.path):void 0}set extname(e){if(no(e,"extname"),nl(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw Error("`extname` must start with `.`");if(e.includes(".",1))throw Error("`extname` cannot contain multiple dots")}this.path=nt(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){nr(e)&&(e=function(e){if("string"==typeof e)e=new URL(e);else if(!nr(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){let e=TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){let e=TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}let t=e.pathname,n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){let e=t.codePointAt(n+2);if(70===e||102===e){let e=TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}(e)),na(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?t7(this.path,this.extname):void 0}set stem(e){na(e,"stem"),no(e,"stem"),this.path=nt(this.dirname||"",e+(this.extname||""))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new J(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return void 0===this.value?"":"string"==typeof this.value?this.value:new TextDecoder(e||void 0).decode(this.value)}}function no(e,t){if(e&&e.includes("/"))throw Error("`"+t+"` cannot be a path: did not expect `/`")}function na(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function nl(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}let nu=function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},nc={}.hasOwnProperty;class nd extends nu{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=function(){let e=[],t={run:function(...t){let n=-1,r=t.pop();if("function"!=typeof r)throw TypeError("Expected function as last argument, not "+r);!function i(s,...o){let a=e[++n],l=-1;if(s)return void r(s);for(;++l<t.length;)(null===o[l]||void 0===o[l])&&(o[l]=t[l]);t=o,a?(function(e,t){let n;return function(...t){let s,o=e.length>t.length;o&&t.push(r);try{s=e.apply(this,t)}catch(e){if(o&&n)throw e;return r(e)}o||(s&&s.then&&"function"==typeof s.then?s.then(i,r):s instanceof Error?r(s):i(s))};function r(e,...i){n||(n=!0,t(e,...i))}function i(e){r(null,e)}})(a,i)(...o):r(null,...o)}(null,...t)},use:function(n){if("function"!=typeof n)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}()}copy(){let e=new nd,t=-1;for(;++t<this.attachers.length;){let n=this.attachers[t];e.use(...n)}return e.data((0,t6.default)(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2==arguments.length?(nm("data",this.frozen),this.namespace[e]=t,this):nc.call(this.namespace,e)&&this.namespace[e]||void 0:e?(nm("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;for(;++this.freezeIndex<this.attachers.length;){let[e,...t]=this.attachers[this.freezeIndex];if(!1===t[0])continue;!0===t[0]&&(t[0]=void 0);let n=e.call(this,...t);"function"==typeof n&&this.transformers.use(n)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=nb(e),n=this.parser||this.Parser;return np("parse",n),n(String(t),t)}process(e,n){let r=this;return this.freeze(),np("process",this.parser||this.Parser),nf("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(i,s){let o=nb(e),a=r.parse(o);function l(e,r){e||!r?s(e):i?i(r):((0,t.ok)(n,"`done` is defined if `resolve` is not"),n(void 0,r))}r.run(a,o,function(e,t,n){var i,s;if(e||!t||!n)return l(e);let o=r.stringify(t,n);"string"==typeof(i=o)||(s=i)&&"object"==typeof s&&"byteLength"in s&&"byteOffset"in s?n.value=o:n.result=o,l(e,n)})}}processSync(e){let n,r=!1;return this.freeze(),np("processSync",this.parser||this.Parser),nf("processSync",this.compiler||this.Compiler),this.process(e,function(e,t){r=!0,t4(e),n=t}),nx("processSync","process",r),(0,t.ok)(n,"we either bailed on an error or have a tree"),n}run(e,n,r){ng(e),this.freeze();let i=this.transformers;return r||"function"!=typeof n||(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(s,o){(0,t.ok)("function"!=typeof n,"`file` can’t be a `done` anymore, we checked");let a=nb(n);i.run(e,a,function(n,i,a){let l=i||e;n?o(n):s?s(l):((0,t.ok)(r,"`done` is defined if `resolve` is not"),r(void 0,l,a))})}}runSync(e,n){let r,i=!1;return this.run(e,n,function(e,t){t4(e),r=t,i=!0}),nx("runSync","run",i),(0,t.ok)(r,"we either bailed on an error or have a tree"),r}stringify(e,t){this.freeze();let n=nb(t),r=this.compiler||this.Compiler;return nf("stringify",r),ng(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(nm("use",this.frozen),null==e);else if("function"==typeof e)o(e,t);else if("object"==typeof e)Array.isArray(e)?s(e):i(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(!("plugins"in e)&&!("settings"in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");s(e.plugins),e.settings&&(r.settings=(0,t6.default)(!0,r.settings,e.settings))}function s(e){let t=-1;if(null==e);else if(Array.isArray(e))for(;++t<e.length;)!function(e){if("function"==typeof e)o(e,[]);else if("object"==typeof e)if(Array.isArray(e)){let[t,...n]=e;o(t,n)}else i(e);else throw TypeError("Expected usable value, not `"+e+"`")}(e[t]);else throw TypeError("Expected a list of plugins, not `"+e+"`")}function o(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(-1===i)n.push([e,...t]);else if(t.length>0){let[r,...s]=t,o=n[i][1];t9(o)&&t9(r)&&(r=(0,t6.default)(!0,o,r)),n[i]=[e,r,...s]}}}}let nh=new nd().freeze();function np(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `parser`")}function nf(e,t){if("function"!=typeof t)throw TypeError("Cannot `"+e+"` without `compiler`")}function nm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function ng(e){if(!t9(e)||"string"!=typeof e.type)throw TypeError("Expected node, got `"+e+"`")}function nx(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function nb(e){var t;return(t=e)&&"object"==typeof t&&"message"in t&&"messages"in t?e:new ns(e)}let ny=[],nv={allowDangerousHtml:!0},nk=/^(https?|ircs?|mailto|xmpp)$/i,nw=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function nS(e){var n;let r,i,s,o,a,l=(r=(n=e).rehypePlugins||ny,i=n.remarkPlugins||ny,s=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...nv}:nv,nh().use(tT).use(i).use(t3,s).use(r)),u=(o=e.children||"",a=new ns,"string"==typeof o?a.value=o:(0,t.unreachable)("Unexpected value `"+o+"` for `children` prop, expected `string`"),a);return function(e,n){let r=n.allowedElements,i=n.allowElement,s=n.components,o=n.disallowedElements,a=n.skipHtml,l=n.unwrapDisallowed,u=n.urlTransform||n_;for(let e of nw)Object.hasOwn(n,e.from)&&(0,t.unreachable)("Unexpected `"+e.from+"` prop, "+(e.to?"use `"+e.to+"` instead":"remove it")+" (see <https://github.com/remarkjs/react-markdown/blob/main/changelog.md#"+e.id+"> for more info)");return r&&o&&(0,t.unreachable)("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other"),tV(e,function(e,t,n){if("raw"===e.type&&n&&"number"==typeof t)return a?n.children.splice(t,1):n.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in eu)if(Object.hasOwn(eu,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=eu[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=u(String(n||""),t,e))}}if("element"===e.type){let s=r?!r.includes(e.tagName):!!o&&o.includes(e.tagName);if(!s&&i&&"number"==typeof t&&(s=!i(e,t,n)),s&&n&&"number"==typeof t)return l&&e.children?n.children.splice(t,1,...e.children):n.children.splice(t,1),t}}),function(e,t){var n,r,i,s;let o;if(!t||void 0===t.Fragment)throw TypeError("Expected `Fragment` in options");let a=t.filePath||void 0;if(t.development){if("function"!=typeof t.jsxDEV)throw TypeError("Expected `jsxDEV` in options when `development: true`");n=a,r=t.jsxDEV,o=function(e,t,i,s){let o=Array.isArray(i.children),a=q(e);return r(t,i,s,o,{columnNumber:a?a.column-1:void 0,fileName:n,lineNumber:a?a.line:void 0},void 0)}}else{if("function"!=typeof t.jsx)throw TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw TypeError("Expected `jsxs` in production options");i=t.jsx,s=t.jsxs,o=function(e,t,n,r){let o=Array.isArray(n.children)?s:i;return r?o(t,n,r):o(t,n)}}let l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:o,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:a,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?z:B,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},u=en(l,e,void 0);return u&&"string"!=typeof u?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}(e,{Fragment:ec.Fragment,components:s,ignoreInvalidStyle:!0,jsx:ec.jsx,jsxs:ec.jsxs,passKeys:!0,passNode:!0})}(l.runSync(l.parse(u),u),e)}function n_(e){let t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return -1===t||-1!==i&&t>i||-1!==n&&t>n||-1!==r&&t>r||nk.test(e.slice(0,t))?e:""}e.s(["default",()=>nS],800427)},812878,590292,592603,49527,e=>{"use strict";function t(e,t){let n=String(e);if("string"!=typeof t)throw TypeError("Expected character");let r=0,i=n.indexOf(t);for(;-1!==i;)r++,i=n.indexOf(t,i+t.length);return r}var n=e.i(897802),r=e.i(455470),i=e.i(402652),s=e.i(173119);let o="phrasing",a=["autolink","link","image","label"];function l(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function u(e){this.config.enter.autolinkProtocol.call(this,e)}function c(e){this.config.exit.autolinkProtocol.call(this,e)}function d(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];(0,n.ok)("link"===t.type),t.url="http://"+this.sliceSerialize(e)}function h(e){this.config.exit.autolinkEmail.call(this,e)}function p(e){this.exit(e)}function f(e){!function(e,t,n){let r=(0,s.convert)((n||{}).ignore||[]),o=function(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){var i;let e=n[r];t.push(["string"==typeof(i=e[0])?RegExp(function(e){if("string"!=typeof e)throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(i),"g"):i,function(e){return"function"==typeof e?e:function(){return e}}(e[1])])}return t}(t),a=-1;for(;++a<o.length;)(0,i.visitParents)(e,"text",l);function l(e,t){let n,i=-1;for(;++i<t.length;){let e=t[i],s=n?n.children:void 0;if(r(e,s?s.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){let n=t[t.length-1],r=o[a][0],i=o[a][1],s=0,l=n.children.indexOf(e),u=!1,c=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,o={index:d.index,input:d.input,stack:[...t,e]},a=i(...d,o);if("string"==typeof a&&(a=a.length>0?{type:"text",value:a}:void 0),!1===a?r.lastIndex=n+1:(s!==n&&c.push({type:"text",value:e.value.slice(s,n)}),Array.isArray(a)?c.push(...a):a&&c.push(a),s=n+d[0].length,u=!0),!r.global)break;d=r.exec(e.value)}return u?(s<e.value.length&&c.push({type:"text",value:e.value.slice(s)}),n.children.splice(l,1,...c)):c=[e],l+c.length}(e,t)}}(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,m],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,g]],{ignore:["link","linkReference"]})}function m(e,n,r,i,s){let o,a="";if(!x(s))return!1;if(/^w/i.test(n)&&(r=n+r,n="",a="http://"),(o=r.split(".")).length<2||o[o.length-1]&&(/_/.test(o[o.length-1])||!/[a-zA-Z\d]/.test(o[o.length-1]))||o[o.length-2]&&(/_/.test(o[o.length-2])||!/[a-zA-Z\d]/.test(o[o.length-2])))return!1;let l=function(e){let n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],i=r.indexOf(")"),s=t(e,"("),o=t(e,")");for(;-1!==i&&s>o;)e+=r.slice(0,i+1),i=(r=r.slice(i+1)).indexOf(")"),o++;return[e,r]}(r+i);if(!l[0])return!1;let u={type:"link",title:null,url:a+n+l[0],children:[{type:"text",value:n+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function g(e,t,n,r){return!(!x(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function x(e,t){let n=e.input.charCodeAt(e.index-1);return(0===e.index||(0,r.unicodeWhitespace)(n)||(0,r.unicodePunctuation)(n))&&(!t||47!==n)}var b=e.i(784484);function y(){this.buffer()}function v(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function k(){this.buffer()}function w(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function S(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteReference"===r.type),r.identifier=(0,b.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function _(e){this.exit(e)}function C(e){let t=this.resume(),r=this.stack[this.stack.length-1];(0,n.ok)("footnoteDefinition"===r.type),r.identifier=(0,b.normalizeIdentifier)(this.sliceSerialize(e)).toLowerCase(),r.label=t}function j(e){this.exit(e)}function E(e,t,n,r){let i=n.createTracker(r),s=i.move("[^"),o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(e),{after:"]",before:s})),a(),o(),s+=i.move("]")}function T(e,t,n){return 0===t?e:I(e,t,n)}function I(e,t,n){return(n?"":" ")+e}E.peek=function(){return"["};let A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function N(e){this.enter({type:"delete",children:[]},e)}function M(e){this.exit(e)}function R(e,t,n,r){let i=n.createTracker(r),s=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function P(e){return e.length}function D(e){let t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:114*(82===t||114===t)}R.peek=function(){return"~"};var O=e.i(227066);e.i(216920);e.i(12105);function F(e,t,n){let r=e.value||"",i="`",s=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){let e,t=n.unsafe[s],i=n.compilePattern(t);if(t.atBreak)for(;e=i.exec(r);){let t=e.index;10===r.charCodeAt(t)&&13===r.charCodeAt(t-1)&&t--,r=r.slice(0,t)+" "+r.slice(e.index+1)}}return i+r+i}F.peek=function(){return"`"};(0,s.convert)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let L=function(e,t,n,r){let i=function(e){let t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n),s=n.bulletCurrent||function(e){let t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===i||"mixed"===i&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));let a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,a.current()),function(e,t,n){return t?(n?"":" ".repeat(o))+e:(n?s:s+" ".repeat(o-s.length))+e});return l(),u};function B(e){let t=e._align;(0,n.ok)(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function z(e){this.exit(e),this.data.inTable=void 0}function $(e){this.enter({type:"tableRow",children:[]},e)}function U(e){this.exit(e)}function q(e){this.enter({type:"tableCell",children:[]},e)}function H(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,V));let r=this.stack[this.stack.length-1];(0,n.ok)("inlineCode"===r.type),r.value=t,this.exit(e)}function V(e,t){return"|"===t?t:e}function W(e){let t=this.stack[this.stack.length-2];(0,n.ok)("listItem"===t.type),t.checked="taskListCheckValueChecked"===e.type}function K(e){let t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){let e=this.stack[this.stack.length-1];(0,n.ok)("paragraph"===e.type);let r=e.children[0];if(r&&"text"===r.type){let n,i=t.children,s=-1;for(;++s<i.length;){let e=i[s];if("paragraph"===e.type){n=e;break}}n===e&&(r.value=r.value.slice(1),0===r.value.length?e.children.shift():e.position&&r.position&&"number"==typeof r.position.start.offset&&(r.position.start.column++,r.position.start.offset++,e.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function G(e,t,n,r){let i=e.children[0],s="boolean"==typeof e.checked&&i&&"paragraph"===i.type,o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=L(e,t,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}var J=e.i(144819);let Q={tokenize:function(e,t,n){let r=0;return function t(s){return(87===s||119===s)&&r<3?(r++,e.consume(s),t):46===s&&3===r?(e.consume(s),i):n(s)};function i(e){return null===e?n(e):t(e)}},partial:!0},Y={tokenize:function(e,t,n){let i,s,o;return a;function a(t){return 46===t||95===t?e.check(Z,u,l)(t):null===t||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||45!==t&&(0,r.unicodePunctuation)(t)?u(t):(o=!0,e.consume(t),a)}function l(t){return 95===t?i=!0:(s=i,i=void 0),e.consume(t),a}function u(e){return s||i||!o?n(e):t(e)}},partial:!0},X={tokenize:function(e,t){let n=0,i=0;return s;function s(a){return 40===a?(n++,e.consume(a),s):41===a&&i<n?o(a):33===a||34===a||38===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||60===a||63===a||93===a||95===a||126===a?e.check(Z,t,o)(a):null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):(e.consume(a),s)}function o(t){return 41===t&&i++,e.consume(t),s}},partial:!0},Z={tokenize:function(e,t,n){return i;function i(a){return 33===a||34===a||39===a||41===a||42===a||44===a||46===a||58===a||59===a||63===a||95===a||126===a?(e.consume(a),i):38===a?(e.consume(a),o):93===a?(e.consume(a),s):60===a||null===a||(0,r.markdownLineEndingOrSpace)(a)||(0,r.unicodeWhitespace)(a)?t(a):n(a)}function s(e){return null===e||40===e||91===e||(0,r.markdownLineEndingOrSpace)(e)||(0,r.unicodeWhitespace)(e)?t(e):i(e)}function o(t){return(0,r.asciiAlpha)(t)?function t(s){return 59===s?(e.consume(s),i):(0,r.asciiAlpha)(s)?(e.consume(s),t):n(s)}(t):n(t)}},partial:!0},ee={tokenize:function(e,t,n){return function(t){return e.consume(t),i};function i(e){return(0,r.asciiAlphanumeric)(e)?n(e):t(e)}},partial:!0},et={name:"wwwAutolink",tokenize:function(e,t,n){let r=this;return function(t){return 87!==t&&119!==t||!eo.call(r,r.previous)||ec(r.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Q,e.attempt(Y,e.attempt(X,i),n),n)(t))};function i(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:eo},en={name:"protocolAutolink",tokenize:function(e,t,n){let i=this,s="",o=!1;return function(t){return(72===t||104===t)&&ea.call(i,i.previous)&&!ec(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(t),e.consume(t),a):n(t)};function a(t){if((0,r.asciiAlpha)(t)&&s.length<5)return s+=String.fromCodePoint(t),e.consume(t),a;if(58===t){let n=s.toLowerCase();if("http"===n||"https"===n)return e.consume(t),l}return n(t)}function l(t){return 47===t?(e.consume(t),o)?u:(o=!0,l):n(t)}function u(t){return null===t||(0,r.asciiControl)(t)||(0,r.markdownLineEndingOrSpace)(t)||(0,r.unicodeWhitespace)(t)||(0,r.unicodePunctuation)(t)?n(t):e.attempt(Y,e.attempt(X,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:ea},er={name:"emailAutolink",tokenize:function(e,t,n){let i,s,o=this;return function(t){return!eu(t)||!el.call(o,o.previous)||ec(o.events)?n(t):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),function t(r){return eu(r)?(e.consume(r),t):64===r?(e.consume(r),a):n(r)}(t))};function a(t){return 46===t?e.check(ee,u,l)(t):45===t||95===t||(0,r.asciiAlphanumeric)(t)?(s=!0,e.consume(t),a):u(t)}function l(t){return e.consume(t),i=!0,a}function u(a){return s&&i&&(0,r.asciiAlpha)(o.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(a)):n(a)}},previous:el},ei={},es=48;for(;es<123;)ei[es]=er,58==++es?es=65:91===es&&(es=97);function eo(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||(0,r.markdownLineEndingOrSpace)(e)}function ea(e){return!(0,r.asciiAlpha)(e)}function el(e){return!(47===e||eu(e))}function eu(e){return 43===e||45===e||46===e||95===e||(0,r.asciiAlphanumeric)(e)}function ec(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}ei[43]=er,ei[45]=er,ei[46]=er,ei[95]=er,ei[72]=[er,en],ei[104]=[er,en],ei[87]=[er,et],ei[119]=[er,et];var ed=e.i(51256),eh=e.i(133220);let ep={tokenize:function(e,t,n){let r=this;return(0,eh.factorySpace)(e,function(e){let i=r.events[r.events.length-1];return i&&"gfmFootnoteDefinitionIndent"===i[1].type&&4===i[2].sliceSerialize(i[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ef(e,t,n){let r,i=this,s=i.events.length,o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);for(;s--;){let e=i.events[s][1];if("labelImage"===e.type){r=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(s){if(!r||!r._balanced)return n(s);let a=(0,b.normalizeIdentifier)(i.sliceSerialize({start:r.end,end:i.now()}));return 94===a.codePointAt(0)&&o.includes(a.slice(1))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(s),e.exit("gfmFootnoteCallLabelMarker"),t(s)):n(s)}}function em(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function eg(e,t,n){let i,s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]),a=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),l};function l(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(l){if(a>999||93===l&&!i||null===l||91===l||(0,r.markdownLineEndingOrSpace)(l))return n(l);if(93===l){e.exit("chunkString");let r=e.exit("gfmFootnoteCallString");return o.includes((0,b.normalizeIdentifier)(s.sliceSerialize(r)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(l)}return(0,r.markdownLineEndingOrSpace)(l)||(i=!0),a++,e.consume(l),92===l?c:u}function c(t){return 91===t||92===t||93===t?(e.consume(t),a++,u):u(t)}}function ex(e,t,n){let i,s,o=this,a=o.parser.gfmFootnotes||(o.parser.gfmFootnotes=[]),l=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),u};function u(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(l>999||93===t&&!s||null===t||91===t||(0,r.markdownLineEndingOrSpace)(t))return n(t);if(93===t){e.exit("chunkString");let n=e.exit("gfmFootnoteDefinitionLabelString");return i=(0,b.normalizeIdentifier)(o.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),h}return(0,r.markdownLineEndingOrSpace)(t)||(s=!0),l++,e.consume(t),92===t?d:c}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,c):c(t)}function h(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a.includes(i)||a.push(i),(0,eh.factorySpace)(e,p,"gfmFootnoteDefinitionWhitespace")):n(t)}function p(e){return t(e)}}function eb(e,t,n){return e.check(ed.blankLine,t,e.attempt(ep,t,n))}function ey(e){e.exit("gfmFootnoteDefinition")}var ev=e.i(559245),ek=e.i(705568);class ew{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let i=0;if(0!==n||0!==r.length){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length,n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}}function eS(e,t,n){let i,s=this,o=0,a=0;return function(e){let t=s.events.length-1;for(;t>-1;){let e=s.events[t][1].type;if("lineEnding"===e||"linePrefix"===e)t--;else break}let r=t>-1?s.events[t][1].type:null,i="tableHead"===r||"tableRow"===r?y:l;return i===y&&s.parser.lazy[s.now().line]?n(e):i(e)};function l(t){var n;return e.enter("tableHead"),e.enter("tableRow"),124===(n=t)||(i=!0,a+=1),u(n)}function u(t){return null===t?n(t):(0,r.markdownLineEnding)(t)?a>1?(a=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h):n(t):(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,u,"whitespace")(t):(a+=1,i&&(i=!1,o+=1),124===t)?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),i=!0,u):(e.enter("data"),c(t))}function c(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),u(t)):(e.consume(t),92===t?d:c)}function d(t){return 92===t||124===t?(e.consume(t),c):c(t)}function h(t){return(s.interrupt=!1,s.parser.lazy[s.now().line])?n(t):(e.enter("tableDelimiterRow"),i=!1,(0,r.markdownSpace)(t))?(0,eh.factorySpace)(e,p,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):p(t)}function p(t){return 45===t||58===t?m(t):124===t?(i=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),f):n(t)}function f(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,m,"whitespace")(t):m(t)}function m(t){return 58===t?(a+=1,i=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),g):45===t?(a+=1,g(t)):null===t||(0,r.markdownLineEnding)(t)?b(t):n(t)}function g(t){return 45===t?(e.enter("tableDelimiterFiller"),function t(n){return 45===n?(e.consume(n),t):58===n?(i=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(n),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(n))}(t)):n(t)}function x(t){return(0,r.markdownSpace)(t)?(0,eh.factorySpace)(e,b,"whitespace")(t):b(t)}function b(s){if(124===s)return p(s);if(null===s||(0,r.markdownLineEnding)(s))return i&&o===a?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(s)):n(s);return n(s)}function y(t){return e.enter("tableRow"),v(t)}function v(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),v):null===n||(0,r.markdownLineEnding)(n)?(e.exit("tableRow"),t(n)):(0,r.markdownSpace)(n)?(0,eh.factorySpace)(e,v,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||(0,r.markdownLineEndingOrSpace)(t)?(e.exit("data"),v(t)):(e.consume(t),92===t?w:k)}function w(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function e_(e,t){let n,r,i,s=-1,o=!0,a=0,l=[0,0,0,0],u=[0,0,0,0],c=!1,d=0,h=new ew;for(;++s<e.length;){let p=e[s],f=p[1];"enter"===p[0]?"tableHead"===f.type?(c=!1,0!==d&&(ej(h,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",n,t]])):"tableRow"===f.type||"tableDelimiterRow"===f.type?(o=!0,i=void 0,l=[0,0,0,0],u=[0,s+1,0,0],c&&(c=!1,r={type:"tableBody",start:Object.assign({},f.start),end:Object.assign({},f.end)},h.add(s,0,[["enter",r,t]])),a="tableDelimiterRow"===f.type?2:r?3:1):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)?(o=!1,0===u[2]&&(0!==l[1]&&(u[0]=u[1],i=eC(h,t,l,a,void 0,i),l=[0,0,0,0]),u[2]=s)):"tableCellDivider"===f.type&&(o?o=!1:(0!==l[1]&&(u[0]=u[1],i=eC(h,t,l,a,void 0,i)),u=[(l=u)[1],s,0,0])):"tableHead"===f.type?(c=!0,d=s):"tableRow"===f.type||"tableDelimiterRow"===f.type?(d=s,0!==l[1]?(u[0]=u[1],i=eC(h,t,l,a,s,i)):0!==u[1]&&(i=eC(h,t,u,a,s,i)),a=0):a&&("data"===f.type||"tableDelimiterMarker"===f.type||"tableDelimiterFiller"===f.type)&&(u[3]=s)}for(0!==d&&ej(h,t,d,n,r),h.consume(t.events),s=-1;++s<t.events.length;){let e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=function(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if("enter"===i[0])"tableContent"===i[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===i[1].type){if("tableDelimiterMarker"===e[t-1][1].type){let e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===i[1].type)break}else"enter"===i[0]&&"tableDelimiterRow"===i[1].type&&(n=!0);t+=1}return r}(t.events,s))}return e}function eC(e,t,n,r,i,s){0!==n[0]&&(s.end=Object.assign({},eE(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));let o=eE(t.events,n[1]);if(s={type:1===r?"tableHeader":2===r?"tableDelimiter":"tableData",start:Object.assign({},o),end:Object.assign({},o)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){let i=eE(t.events,n[2]),s=eE(t.events,n[3]),o={type:"tableContent",start:Object.assign({},i),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==i&&(s.end=Object.assign({},eE(t.events,i)),e.add(i,0,[["exit",s,t]]),s=void 0),s}function ej(e,t,n,r,i){let s=[],o=eE(t.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function eE(e,t){let n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}let eT={name:"tasklistCheck",tokenize:function(e,t,n){let i=this;return function(t){return null===i.previous&&i._gfmTasklistFirstContentOfListItem?(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),s):n(t)};function s(t){return(0,r.markdownLineEndingOrSpace)(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),o):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),o):n(t)}function o(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(t)}function a(i){return(0,r.markdownLineEnding)(i)?t(i):(0,r.markdownSpace)(i)?e.check({tokenize:eI},t,n)(i):n(i)}}};function eI(e,t,n){return(0,eh.factorySpace)(e,function(e){return null===e?n(e):t(e)},"whitespace")}let eA={};function eN(e){var t;let n,r,i,s=e||eA,m=this.data(),g=m.micromarkExtensions||(m.micromarkExtensions=[]),x=m.fromMarkdownExtensions||(m.fromMarkdownExtensions=[]),b=m.toMarkdownExtensions||(m.toMarkdownExtensions=[]);g.push((t=s,(0,J.combineExtensions)([{text:ei},{document:{91:{name:"gfmFootnoteDefinition",tokenize:ex,continuation:{tokenize:eb},exit:ey}},text:{91:{name:"gfmFootnoteCall",tokenize:eg},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ef,resolveTo:em}}},(n=(t||{}).singleTilde,r={name:"strikethrough",tokenize:function(e,t,r){let i=this.previous,s=this.events,o=0;return function(a){return 126===i&&"characterEscape"!==s[s.length-1][1].type?r(a):(e.enter("strikethroughSequenceTemporary"),function s(a){let l=(0,O.classifyCharacter)(i);if(126===a)return o>1?r(a):(e.consume(a),o++,s);if(o<2&&!n)return r(a);let u=e.exit("strikethroughSequenceTemporary"),c=(0,O.classifyCharacter)(a);return u._open=!c||2===c&&!!l,u._close=!l||2===l&&!!c,t(a)}(a))}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset==e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";let i={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",i,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],a=t.parser.constructs.insideSpan.null;a&&(0,ev.splice)(o,o.length,0,(0,ek.resolveAll)(a,e.slice(r+1,n),t)),(0,ev.splice)(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",i,t]]),(0,ev.splice)(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}},null==n&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}}),{flow:{null:{name:"table",tokenize:eS,resolveAll:e_}}},{text:{91:eT}}]))),x.push([{transforms:[f],enter:{literalAutolink:l,literalAutolinkEmail:u,literalAutolinkHttp:u,literalAutolinkWww:u},exit:{literalAutolink:p,literalAutolinkEmail:h,literalAutolinkHttp:c,literalAutolinkWww:d}},{enter:{gfmFootnoteCallString:y,gfmFootnoteCall:v,gfmFootnoteDefinitionLabelString:k,gfmFootnoteDefinition:w},exit:{gfmFootnoteCallString:S,gfmFootnoteCall:_,gfmFootnoteDefinitionLabelString:C,gfmFootnoteDefinition:j}},{canContainEols:["delete"],enter:{strikethrough:N},exit:{strikethrough:M}},{enter:{table:B,tableData:q,tableHeader:q,tableRow:$},exit:{codeText:H,table:z,tableData:U,tableHeader:U,tableRow:U}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:K}}]),b.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:o,notInConstruct:a},{character:":",before:"[ps]",after:"\\/",inConstruct:o,notInConstruct:a}]},(i=!1,s&&s.firstLineBlank&&(i=!0),{handlers:{footnoteDefinition:function(e,t,n,r){let s=n.createTracker(r),o=s.move("[^"),a=n.enter("footnoteDefinition"),l=n.enter("label");return o+=s.move(n.safe(n.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((i?"\n":" ")+n.indentLines(n.containerFlow(e,s.current()),i?I:T))),a(),o},footnoteReference:E},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:A}],handlers:{delete:R}},function(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=F(e,t,n);return n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&")),r},table:function(e,t,n,r){return a(function(e,t,n){let r=e.children,i=-1,s=[],o=t.enter("table");for(;++i<r.length;)s[i]=l(r[i],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){let i=a([l(e,n,r)]);return i.slice(0,i.indexOf("\n"))}}};function o(e,t,n,r){let i=n.enter("tableCell"),o=n.enter("phrasing"),a=n.containerPhrasing(e,{...r,before:s,after:s});return o(),i(),a}function a(e,t){return function(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||P,s=[],o=[],a=[],l=[],u=0,c=-1;for(;++c<e.length;){let t=[],r=[],s=-1;for(e[c].length>u&&(u=e[c].length);++s<e[c].length;){var d;let o=null==(d=e[c][s])?"":String(d);if(!1!==n.alignDelimiters){let e=i(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[c]=t,a[c]=r}let h=-1;if("object"==typeof r&&"length"in r)for(;++h<u;)s[h]=D(r[h]);else{let e=D(r);for(;++h<u;)s[h]=e}h=-1;let p=[],f=[];for(;++h<u;){let e=s[h],t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let i=!1===n.alignDelimiters?1:Math.max(1,l[h]-t.length-r.length),o=t+"-".repeat(i)+r;!1!==n.alignDelimiters&&((i=t.length+i+r.length)>l[h]&&(l[h]=i),f[h]=i),p[h]=o}o.splice(1,0,p),a.splice(1,0,f),c=-1;let m=[];for(;++c<o.length;){let e=o[c],t=a[c];h=-1;let r=[];for(;++h<u;){let i=e[h]||"",o="",a="";if(!1!==n.alignDelimiters){let e=l[h]-(t[h]||0),n=s[h];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),a=" ".repeat(e/2-.5)):a=o=" ".repeat(e/2):a=" ".repeat(e)}!1===n.delimiterStart||h||r.push("|"),!1!==n.padding&&(!1!==n.alignDelimiters||""!==i)&&(!1!==n.delimiterStart||h)&&r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(i),!1!==n.alignDelimiters&&r.push(a),!1!==n.padding&&r.push(" "),(!1!==n.delimiterEnd||h!==u-1)&&r.push("|")}m.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return m.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function l(e,t,n){let r=e.children,i=-1,s=[],a=t.enter("tableRow");for(;++i<r.length;)s[i]=o(r[i],e,t,n);return a(),s}}(s),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:G}}]})}e.s(["default",()=>eN],812878);var eM=e.i(679606);let eR=/^\*\*(.+?)\*\*\s+`([\s\S]+)`\s*$/,eP=/^\*\*(.+?)\*\*\s*$/;function eD(e){let t=e.trim(),n=t.match(eR);if(n){let[,e,t]=n,r=null;try{let e=JSON.parse(t);e&&"object"==typeof e&&!Array.isArray(e)&&(r=e)}catch{}return{kind:"tool",name:e.trim(),detail:t,parsed:r}}let r=t.match(eP);return r?{kind:"label-only",name:r[1].trim()}:null}function eO(e){return/^(Write|Edit|MultiEdit|Update)$/i.test(e)}function eF(e){if(!e)return null;for(let t of[e.file_path,e.path,e.filePath,e.filepath])if("string"==typeof t&&t.length>0)return t;return null}function eL(e){if(!e)return null;for(let t of[e.content,e.new_string,e.newString,e.new_content,e.text])if("string"==typeof t)return t;return null}function eB(e,t,n=80){if(e)for(let t of["command","file_path","path","pattern","query","url"]){let r=e[t];if("string"==typeof r&&r.length>0)return ez(r,n)}return ez(t.replace(/\s+/g," ").trim(),n)}function ez(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}e.s(["extractFileContent",()=>eL,"extractFilePath",()=>eF,"isFileWriteTool",()=>eO,"parseToolEvent",()=>eD,"summarizeToolDetail",()=>eB],590292);var e$=e.i(152155),eU=e.i(99105),eq=e.i(276016),eH=e.i(181975),eV=e.i(131777);let eW={default:"bg-muted/40 hover:bg-muted/70",green:"bg-emerald-500/8 hover:bg-emerald-500/15 border-emerald-500/20",blue:"bg-sky-500/8 hover:bg-sky-500/15 border-sky-500/20"};function eK({name:e,summary:t,expanded:n,onToggle:r,icon:i,tint:s="default"}){return(0,eM.jsxs)("button",{type:"button",onClick:r,className:(0,eV.cn)("border-border/60 text-foreground/90 group inline-flex max-w-full items-center gap-1.5 rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",eW[s],n&&"rounded-b-none border-b-0"),children:[n?(0,eM.jsx)(eU.ChevronDown,{className:"h-3 w-3 shrink-0 opacity-60"}):(0,eM.jsx)(eq.ChevronRight,{className:"h-3 w-3 shrink-0 opacity-60"}),i??(0,eM.jsx)(eH.Wrench,{className:"h-3 w-3 shrink-0 opacity-60"}),(0,eM.jsx)("span",{className:"shrink-0 font-medium",children:e}),t?(0,eM.jsx)("span",{className:"text-muted-foreground/70 max-w-[360px] truncate",children:t}):null]})}function eG({name:e,detail:t,parsed:n,outputBody:r}){let[i,s]=(0,e$.useState)(!1),o=eB(n,t),a=n?JSON.stringify(n,null,2):t,l="string"==typeof r&&r.length>0;return(0,eM.jsxs)("div",{className:"inline-flex max-w-full flex-col",children:[(0,eM.jsx)(eK,{name:e,summary:i?null:o,expanded:i,onToggle:()=>s(e=>!e)}),i?(0,eM.jsxs)("div",{className:"border-border/60 bg-background/40 divide-border/40 flex max-w-full flex-col divide-y overflow-hidden rounded-md rounded-tl-none border",children:[a?(0,eM.jsxs)("section",{className:"flex flex-col",children:[l?(0,eM.jsx)("span",{className:"text-muted-foreground/70 bg-muted/40 px-3 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:"Input"}):null,(0,eM.jsx)("pre",{className:"text-foreground/70 max-w-full overflow-hidden px-3 py-2 font-mono text-[10px] leading-relaxed break-words whitespace-pre-wrap",children:a})]}):null,l?(0,eM.jsxs)("section",{className:"flex flex-col",children:[(0,eM.jsx)("span",{className:"text-muted-foreground/70 bg-muted/40 px-3 py-0.5 text-[9px] font-semibold tracking-wide uppercase",children:"Output"}),(0,eM.jsx)("pre",{className:"text-foreground/70 max-w-full overflow-hidden px-3 py-2 font-mono text-[10px] leading-relaxed break-words whitespace-pre-wrap",children:r})]}):null]}):null]})}var eJ=e.i(611345),eQ=e.i(670471),eY=e.i(903645);let eX=(0,eY.default)("pencil-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);function eZ({toolName:e,filePath:t,content:n}){let[r,i]=(0,e$.useState)(!1),s=t.split(/[\\/]/).pop()??t,o=n?n.split("\n").length:0,a=e.toLowerCase(),l=/edit/i.test(e);return r?(0,eM.jsxs)("div",{className:"border-border/60 bg-background/50 flex max-w-full flex-col overflow-hidden rounded-lg border",children:[(0,eM.jsxs)("div",{className:"bg-muted/60 border-border/60 flex items-center justify-between gap-2 border-b px-3 py-1.5",children:[(0,eM.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5 shrink-0 text-sky-500"}):(0,eM.jsx)(eQ.FileText,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500"}),(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",title:t,children:s}),(0,eM.jsx)("span",{className:"text-muted-foreground/60 shrink-0 font-mono text-[9px] tracking-wide uppercase",children:a})]}),(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!1),className:"text-muted-foreground hover:text-foreground inline-flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 text-[10px] transition-colors","aria-label":"Collapse file preview",children:[(0,eM.jsx)(eJ.ChevronLeft,{className:"h-3 w-3"}),"Back"]})]}),(0,eM.jsx)("pre",{className:"max-h-[420px] overflow-auto px-3 py-2 font-mono text-[10px] leading-relaxed",children:n??"(no content available)"}),(0,eM.jsx)("div",{className:"text-muted-foreground/60 border-border/60 border-t px-3 py-1 font-mono text-[9px]",children:t})]}):(0,eM.jsxs)("button",{type:"button",onClick:()=>i(!0),title:t,className:(0,eV.cn)("group inline-flex max-w-full items-center gap-2 rounded-lg border px-3 py-1.5 text-xs transition-all",l?"border-sky-500/25 bg-sky-500/10 hover:border-sky-500/40 hover:bg-sky-500/15":"border-emerald-500/25 bg-emerald-500/10 hover:border-emerald-500/40 hover:bg-emerald-500/15"),children:[(0,eM.jsx)("div",{className:(0,eV.cn)("flex h-6 w-6 shrink-0 items-center justify-center rounded",l?"bg-sky-500/15 text-sky-500":"bg-emerald-500/15 text-emerald-500"),children:l?(0,eM.jsx)(eX,{className:"h-3.5 w-3.5"}):(0,eM.jsx)(eQ.FileText,{className:"h-3.5 w-3.5"})}),(0,eM.jsxs)("div",{className:"flex min-w-0 flex-col items-start",children:[(0,eM.jsx)("span",{className:"truncate font-mono text-[11px] font-medium",children:s}),(0,eM.jsxs)("span",{className:"text-muted-foreground/70 font-mono text-[9px] tracking-wide uppercase",children:[a,o?` \xb7 ${o} line${1===o?"":"s"}`:""]})]})]})}function e0({text:e,outputText:t}){let n=eD(e);if(!n)return null;let r=function(e){if(!e)return null;let t=eD(e);return t?.kind==="tool"&&"Output"===t.name?t.detail:e}(t);if("label-only"===n.kind)return(0,eM.jsx)(eG,{name:n.name,detail:"",parsed:null,outputBody:r});if(eO(n.name)){let e=eF(n.parsed);if(e)return(0,eM.jsx)(eZ,{toolName:n.name,filePath:e,content:eL(n.parsed)})}return(0,eM.jsx)(eG,{name:n.name,detail:n.detail,parsed:n.parsed,outputBody:r})}e.s(["ToolBubble",()=>e0],592603);let e1=(0,eY.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);e.s(["CircleStop",()=>e1],49527)},878598,(e,t,n)=>{"use strict";var r=e.i(677120);let i=void 0!==r.Buffer,s=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,o=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,n){null==n&&null!==t&&"object"==typeof t&&(n=t,t=void 0),i&&r.Buffer.isBuffer(e)&&(e=e.toString()),e&&65279===e.charCodeAt(0)&&(e=e.slice(1));let a=JSON.parse(e,t);if(null===a||"object"!=typeof a)return a;let u=n&&n.protoAction||"error",c=n&&n.constructorAction||"error";if("ignore"===u&&"ignore"===c)return a;if("ignore"!==u&&"ignore"!==c){if(!1===s.test(e)&&!1===o.test(e))return a}else if("ignore"!==u&&"ignore"===c){if(!1===s.test(e))return a}else if(!1===o.test(e))return a;return l(a,{protoAction:u,constructorAction:c,safe:n&&n.safe})}function l(e,{protoAction:t="error",constructorAction:n="error",safe:r}={}){let i=[e];for(;i.length;){let e=i;for(let s of(i=[],e)){if("ignore"!==t&&Object.prototype.hasOwnProperty.call(s,"__proto__")){if(!0===r)return null;if("error"===t)throw SyntaxError("Object contains forbidden prototype property");delete s.__proto__}if("ignore"!==n&&Object.prototype.hasOwnProperty.call(s,"constructor")&&null!==s.constructor&&"object"==typeof s.constructor&&Object.prototype.hasOwnProperty.call(s.constructor,"prototype")){if(!0===r)return null;if("error"===n)throw SyntaxError("Object contains forbidden prototype property");delete s.constructor}for(let e in s){let t=s[e];t&&"object"==typeof t&&i.push(t)}}}return e}function u(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}t.exports=u,t.exports.default=u,t.exports.parse=u,t.exports.safeParse=function(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}},t.exports.scan=l},915109,684408,549922,323217,461152,673138,399746,628164,941275,e=>{"use strict";var t=e.i(679606),n=e.i(685446),r=e.i(947951),i=e.i(848692),s=e.i(590189),o=e.i(147970),a=e.i(640912),l=e.i(800427),u=e.i(812878);e.i(541001);var c=e.i(64780),d=e.i(131777),h=e.i(592603),p=e.i(590292),f=e.i(711719),m=e.i(49527),g=e.i(433548),x=e.i(935946),b=e.i(926370),y=e.i(194365),v=e.i(587538),k=e.i(860253),w=e.i(99105),S=e.i(48829),_=e.i(83428),C=e.i(723925),j=e.i(152155);let E={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-xs",children:e}),pre:({children:e})=>{let n=e?.props?.className?.replace("language-","")??"",r="string"==typeof e?.props?.children?e.props.children:"";return["html","svg"].includes(n)&&r.length>0?(0,t.jsx)(O,{code:r,language:n}):(0,t.jsx)(D,{language:n,children:e})},ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-base font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-sm font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e}),blockquote:({children:e})=>(0,t.jsx)("blockquote",{className:"border-muted-foreground/30 my-1 border-s-2 ps-3 italic opacity-80",children:e}),table:({children:e})=>(0,t.jsx)("div",{className:"my-2 overflow-x-auto",children:(0,t.jsx)("table",{className:"min-w-full border-collapse text-xs",children:e})}),thead:({children:e})=>(0,t.jsx)("thead",{className:"bg-muted/50 border-b",children:e}),th:({children:e})=>(0,t.jsx)("th",{className:"px-2 py-1 text-start font-semibold",children:e}),td:({children:e})=>(0,t.jsx)("td",{className:"border-muted border-t px-2 py-1",children:e}),tr:({children:e})=>(0,t.jsx)("tr",{children:e}),hr:()=>(0,t.jsx)("hr",{className:"border-border/40 my-3 border-t"})};function T({className:e,beforeMessages:n,afterMessages:r,composer:i,hideEmpty:s,hideMessages:a}){return(0,t.jsxs)(o.ThreadPrimitive.Root,{className:(0,d.cn)("flex h-full flex-col",e),children:[(0,t.jsxs)(o.ThreadPrimitive.Viewport,{className:"flex flex-1 flex-col overflow-y-auto pt-4",children:[s?null:(0,t.jsx)(o.ThreadPrimitive.Empty,{children:(0,t.jsx)(I,{})}),n,a?null:(0,t.jsx)(o.ThreadPrimitive.Messages,{components:{UserMessage:N,AssistantMessage:P}}),r]}),i??(0,t.jsx)(V,{})]})}function I(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 p-8 text-center",children:[(0,t.jsx)(b.Bot,{className:"text-muted-foreground/40 h-10 w-10"}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:"Send a message to start chatting with the agent."})]})}let A="{{interaction}}",N=()=>{let e=(0,a.useMessage)(),n=e?.content?.[0],i=n&&"text"in n?n.text:"";return i.startsWith(A)?(0,t.jsx)(M,{text:i}):(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15",children:(0,t.jsx)(y.User,{className:"h-3.5 w-3.5 text-violet-500"})}),(0,t.jsxs)("div",{className:"flex max-w-[85%] min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-500/15 bg-violet-500/8 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md dark:bg-violet-500/15",children:(0,t.jsx)(s.MessagePrimitive.Content,{components:{Text:R}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(q,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]})};function M({text:e}){let n=(0,j.useMemo)(()=>{try{let t=e.slice(A.length);return JSON.parse(t)}catch{return null}},[e]);return n?(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(C.Check,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"text-foreground mt-px flex flex-wrap items-center gap-x-4 gap-y-1 rounded-2xl rounded-tl-sm border border-emerald-600/20 bg-emerald-50/50 px-4 py-2 text-sm shadow-sm dark:border-emerald-500/20 dark:bg-emerald-950/20",children:n.questions.map(e=>(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-emerald-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-emerald-700 uppercase dark:bg-emerald-900/50 dark:text-emerald-400",children:e.header}),(0,t.jsx)("span",{className:"text-muted-foreground text-xs",children:n.answers[e.question]||"No answer"})]},e.question))}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(q,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]}):null}function R({text:e}){return(0,t.jsx)("span",{className:"whitespace-pre-wrap",children:e})}let P=()=>{let e=(0,a.useMessage)(),n=e?.content?.[0],i=n&&"text"in n?n.text:"";return(i?(0,p.parseToolEvent)(i):null)?(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"text-muted-foreground/40 mt-1 flex h-6 w-6 shrink-0 items-center justify-center",children:(0,t.jsx)(b.Bot,{className:"h-3 w-3"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center py-0.5",children:(0,t.jsx)(h.ToolBubble,{text:i})})]}):(0,t.jsxs)(s.MessagePrimitive.Root,{className:"group animate-in fade-in-0 slide-in-from-bottom-1 flex w-full items-start gap-2.5 px-4 py-0.5 duration-300 ease-out",children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(b.Bot,{className:"text-muted-foreground h-3.5 w-3.5"})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsx)("div",{className:"bg-muted/50 text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-white/5 px-4 py-2 text-sm leading-relaxed break-words shadow-sm backdrop-blur-md dark:bg-neutral-800/60",children:(0,t.jsx)(s.MessagePrimitive.Content,{components:{Text:L}})}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(q,{}),(0,t.jsx)(r.ActionBarPrimitive.Root,{className:"flex items-center gap-1",children:(0,t.jsx)(r.ActionBarPrimitive.Copy,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Copy",children:(0,t.jsx)(g.Copy,{})})})})]})]})]})};function D({children:e,language:n}){let{t:r}=(0,c.useTranslation)("web"),[i,s]=(0,j.useState)(!1),[o,a]=(0,j.useState)(!1),l=(0,j.useRef)(null);return(0,j.useEffect)(()=>{l.current&&l.current.scrollHeight>240&&a(!0)},[e]),(0,t.jsxs)("div",{className:"bg-background/50 relative my-2 overflow-hidden rounded-md",children:[n?(0,t.jsx)("div",{className:"text-muted-foreground/50 border-b border-white/5 px-3 py-1 font-mono text-[10px] uppercase",children:n}):null,(0,t.jsx)("pre",{ref:l,className:"overflow-x-auto p-3 font-mono text-xs leading-relaxed transition-[max-height] duration-300 ease-in-out",style:{maxHeight:i?"min(60vh, 500px)":o?"200px":"min(60vh, 500px)",overflow:i?"auto":void 0},children:e}),o&&!i?(0,t.jsx)("div",{className:"absolute inset-x-0 bottom-0 flex items-end justify-center bg-gradient-to-t from-black/60 via-black/30 to-transparent pt-12 pb-3",children:(0,t.jsxs)("button",{type:"button",onClick:()=>s(!0),className:"inline-flex items-center gap-1 rounded-full border border-white/10 bg-white/10 px-3 py-1 text-[11px] font-medium text-white/80 shadow-lg backdrop-blur-md transition-all hover:bg-white/20 hover:text-white",children:[(0,t.jsx)(w.ChevronDown,{className:"h-3 w-3"}),r("chat.showMore")]})}):null,o&&i?(0,t.jsx)("div",{className:"flex justify-center border-t border-white/5 py-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>s(!1),className:"inline-flex items-center gap-1 rounded-full px-3 py-0.5 text-[11px] text-white/50 transition-colors hover:text-white/80",children:[(0,t.jsx)(S.ChevronUp,{className:"h-3 w-3"}),r("chat.showLess")]})}):null]})}function O({code:e,language:r}){let{t:i}=(0,c.useTranslation)("web"),[s,o]=(0,j.useState)(!1),[a,l]=(0,j.useState)(!1),[u,h]=(0,j.useState)(!1),p=e.split("\n").length,f=e.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"bg-background/50 my-2 overflow-hidden rounded-md border",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground font-mono text-xs uppercase",children:r}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(!1),className:(0,d.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",s?"text-muted-foreground hover:text-foreground":"bg-muted text-foreground"),children:i("chat.code")}),(0,t.jsx)("button",{type:"button",onClick:()=>o(!0),className:(0,d.cn)("rounded px-2.5 py-0.5 text-xs font-medium transition-colors",s?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:i("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>{h(!s),l(!0)},className:"text-muted-foreground hover:text-foreground ms-1 rounded p-0.5 transition-colors",title:i("chat.openFullscreen"),children:(0,t.jsx)(v.Maximize2,{className:"h-3 w-3"})})]})]}),(0,t.jsx)("div",{style:{height:"min(55vh, 450px)"},children:s?(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"h-full w-full border-0 bg-white",title:i("chat.htmlPreview")}):(0,t.jsx)("pre",{className:"h-full overflow-auto p-3 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})})})]}),a&&"u">typeof document?(0,n.createPortal)((0,t.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/70 backdrop-blur-sm",onClick:()=>l(!1),children:(0,t.jsxs)("div",{className:"bg-background relative flex h-[95vh] w-[95vw] flex-col overflow-hidden rounded-xl border shadow-2xl",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"bg-muted/80 flex h-12 shrink-0 items-center justify-between border-b px-5",children:[(0,t.jsxs)("div",{className:"bg-muted flex items-center gap-0.5 rounded-lg p-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>h(!1),className:(0,d.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",u?"text-muted-foreground hover:text-foreground":"bg-background text-foreground shadow-sm"),children:i("chat.preview")}),(0,t.jsx)("button",{type:"button",onClick:()=>h(!0),className:(0,d.cn)("rounded-md px-4 py-1.5 text-sm font-medium transition-all",u?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:i("chat.code")})]}),(0,t.jsxs)("div",{className:"text-muted-foreground/60 flex items-center gap-4 text-xs",children:[(0,t.jsxs)("span",{children:[p," lines"]}),(0,t.jsxs)("span",{children:[f.toLocaleString()," chars"]}),(0,t.jsx)("span",{className:"font-mono uppercase",children:r})]}),(0,t.jsx)("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:bg-muted hover:text-foreground rounded-lg p-2 transition-colors",children:(0,t.jsx)(k.X,{className:"h-5 w-5"})})]}),u?(0,t.jsx)("pre",{className:"flex-1 overflow-auto p-4 font-mono text-xs leading-relaxed",children:(0,t.jsx)("code",{children:e})}):(0,t.jsx)("iframe",{srcDoc:e,sandbox:"allow-scripts",className:"flex-1 border-0 bg-white dark:bg-neutral-900",title:i("chat.htmlPreviewFullscreen")})]})}),document.body):null]})}let F=/^\*⏳ (.+)\*$/;function L({text:e}){if("*Thinking...*"===e||"*Agent is waking up...*"===e)return(0,t.jsx)(U,{booting:e.includes("waking")});let n=F.exec(e);return n?(0,t.jsx)(B,{label:n[1]}):(0,t.jsx)(l.default,{remarkPlugins:[u.default],components:E,children:e})}function B({label:e}){return(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex items-center gap-2 text-sm italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),(0,t.jsx)("span",{children:e})]})}let z=["Thinking","Reasoning","Analyzing","Processing","Evaluating","Considering","Reflecting","Pondering"],$=["Waking up","Initializing","Loading tools","Preparing","Connecting"];function U({booting:e}){let n=e?$:z,[r,i]=(0,j.useState)(0),[s,o]=(0,j.useState)(!0);return(0,j.useEffect)(()=>{let e=setInterval(()=>{o(!1),setTimeout(()=>{i(e=>(e+1)%n.length),o(!0)},200)},2e3);return()=>clearInterval(e)},[n]),(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex w-32 items-center gap-1.5 text-sm italic",children:[(0,t.jsx)("span",{className:"inline-block transition-all duration-300 ease-in-out",style:{opacity:+!!s,transform:s?"translateY(0)":"translateY(-4px)"},children:n[r]}),(0,t.jsxs)("span",{className:"inline-flex gap-0.5",children:[(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"0ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"150ms"}}),(0,t.jsx)("span",{className:"bg-muted-foreground/60 h-1 w-1 animate-bounce rounded-full",style:{animationDelay:"300ms"}})]})]})}function q(){let e=(0,a.useMessage)(),[n,r]=(0,j.useState)(0);(0,j.useEffect)(()=>{let e=setInterval(()=>r(e=>e+1),3e4);return()=>clearInterval(e)},[]);let i=(0,j.useMemo)(()=>{if(!e?.createdAt)return null;let t=new Date(e.createdAt);return isNaN(t.getTime())?null:{time:t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),relative:function(e){let t=Date.now()-e.getTime();if(t<0||t<5e3)return"just now";let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:e.toLocaleDateString()}(t)}},[e?.createdAt,n]);return i?(0,t.jsx)("span",{className:"text-muted-foreground/60 text-[10px]",title:i.time,children:i.relative}):null}let H=(0,j.forwardRef)(({tooltip:e,children:n,className:r,...i},s)=>(0,t.jsx)("button",{ref:s,type:"button",title:e,className:(0,d.cn)("text-muted-foreground hover:text-foreground hover:bg-muted inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors","[&>svg]:h-3.5 [&>svg]:w-3.5",r),...i,children:n}));function V(){return(0,t.jsxs)(i.ComposerPrimitive.Root,{className:"flex items-end gap-2 border-t p-3",children:[(0,t.jsx)(i.ComposerPrimitive.AddAttachment,{asChild:!0,children:(0,t.jsx)(H,{tooltip:"Attach file",className:"mb-0.5",children:(0,t.jsx)(x.Paperclip,{})})}),(0,t.jsx)(i.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:"Write a message...",className:(0,d.cn)("bg-muted min-h-[40px] flex-1 resize-none rounded-xl border-0 px-4 py-2.5 text-sm","focus:ring-ring/30 focus:ring-2 focus:outline-none","placeholder:text-muted-foreground/60","max-h-40 overflow-y-auto")}),(0,t.jsx)(W,{})]})}function W(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(i.ComposerPrimitive.Send,{className:(0,d.cn)("bg-primary text-primary-foreground inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(f.SendHorizontal,{className:"size-4"})})}),(0,t.jsx)(o.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(i.ComposerPrimitive.Cancel,{className:(0,d.cn)("bg-destructive/10 text-destructive inline-flex h-[40px] w-[40px] shrink-0 items-center justify-center rounded-xl","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(m.CircleStop,{className:"size-4"})})})]})}function K(e,t){if(!t||0===t.length)return e;let n=t.map(e=>e.notes?.trim()?`@${e.path} [Note: ${e.notes.trim()}]`:`@${e.path}`).join(" ");return`${e}
|
|
4
4
|
|
|
5
|
-
${n}`}H.displayName="IconButton",e.s(["Thread",()=>T],915109),e.s(["composeUserInput",()=>K],684408);var G=e.i(979533);class J{_contextProvider=new G.CompositeContextProvider;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}let Q=Object.freeze([]),Y="DEFAULT_THREAD_ID",X=Object.freeze([Y]),Z=Object.freeze({id:Y,remoteId:void 0,externalId:void 0,status:"regular"}),ee=Promise.resolve(),et=Object.freeze({[Y]:Z});class en{adapter;threadFactory;_mainThreadId=Y;_threads=X;_archivedThreads=Q;_threadData=et;get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return ee}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.adapter=e,this.threadFactory=t,this._mainThread=this.threadFactory(),this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){for(let t of this.adapter.threads??[])if(t.id===e)return t;for(let t of this.adapter.archivedThreads??[])if(t.id===e)return t;if(e===Y)return Z}__internal_setAdapter(e,t=!1){let n=this.adapter;this.adapter=e;let r=e.threadId??Y,i=e.threads??Q,s=e.archivedThreads??Q,o=n.threadId??Y,a=n.threads??Q,l=n.archivedThreads??Q;(t||o!==r||a!==i||l!==s)&&(this._threadData={...et,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])},a!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??Q),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??Q),o!==r&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let n=this.adapter.onRename;if(!n)throw Error("External store adapter does not support renaming");await n(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}let er=Symbol("innerMessage"),ei=Symbol("innerMessages"),es=[],eo=e=>{let t="messages"in e?e.messages:e,n=t[ei]||t[er];return n?Array.isArray(n)?n:(t[ei]=[n],t[ei]):es};class ea{cache=new WeakMap;convertMessages(e,t){return e.map((e,n)=>{let r=t(this.cache.get(e),e,n);return this.cache.set(e,r),r})}}let el=Symbol("autoStatus"),eu=Object.freeze(Object.assign({type:"running"},{[el]:!0})),ec=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[el]:!0})),ed=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[el]:!0})),eh=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[el]:!0})),ep=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[el]:!0}):e&&t?eu:n?eh:r?ed:ec;var ef=e.i(878598);let em=Symbol("aui.parse-partial-json-object.meta"),eg=((e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ex=()=>`__optimistic__${eg()}`,eb=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ey=(e,t,n)=>{let{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},c="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==r&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==r&&a)throw Error("status is only supported for assistant messages");if("assistant"!==r&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${eg()}`,...void 0!==t&&{parentId:t},...void 0!==n&&{messages:n}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:(e=>{if(0===e.length)return{[em]:{state:"partial",partialPath:[]}};try{let t=ef.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[em]={state:"complete",partialPath:[]},t}catch{try{let[t,n]=function(e){let t,n=["ROOT"],r=-1,i=null,s=[];function o(){void 0!==t&&(s.push(JSON.parse(`"${t}"`)),t=void 0)}function a(e,t,s){switch(e){case'"':r=t,n.pop(),n.push(s),n.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":r=t,i=t,n.pop(),n.push(s),n.push("INSIDE_LITERAL");break;case"-":n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=t,n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"{":r=t,n.pop(),n.push(s),n.push("INSIDE_OBJECT_START"),o();break;case"[":r=t,n.pop(),n.push(s),n.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":n.pop(),n.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=i,n.pop(),t=s.pop()}}function u(e,i){switch(e){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=i,n.pop(),t=s.pop()}}for(let o=0;o<e.length;o++){let c=e[o];switch(n[n.length-1]){case"ROOT":a(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_KEY"),t="";break;case"}":r=o,n.pop(),t=s.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===c&&(n.pop(),n.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":n.push("INSIDE_STRING_ESCAPE"),t+=c;break;default:t+=c}break;case"INSIDE_OBJECT_AFTER_KEY":":"===c&&(n.pop(),n.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(c,o);break;case"INSIDE_STRING":switch(c){case'"':n.pop(),r=o,t=s.pop();break;case"\\":n.push("INSIDE_STRING_ESCAPE");break;default:r=o}break;case"INSIDE_ARRAY_START":"]"===c?(r=o,n.pop(),t=s.pop()):(r=o,t="0",a(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=o,n.pop(),t=s.pop();break;default:r=o}break;case"INSIDE_ARRAY_AFTER_COMMA":a(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":n.pop(),"INSIDE_STRING"===n[n.length-1]?r=o:"INSIDE_OBJECT_KEY"===n[n.length-1]&&(t+=c);break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=o;break;case"e":case"E":case"-":case".":break;case",":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"}":n.pop(),t=s.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"]":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o);break;default:n.pop(),t=s.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?r=o:(n.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]?l(c,o):"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o))}}}let c=e.slice(0,r+1);for(let t=n.length-1;t>=0;t--)switch(n[t]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?c+="true".slice(t.length):"false".startsWith(t)?c+="false".slice(t.length):"null".startsWith(t)&&(c+="null".slice(t.length))}}return[c,s]}(e),r=ef.default.parse(t);if("object"!=typeof r||null===r)throw Error("argsText is expected to be an object");return r[em]={state:"partial",partialPath:n},r}catch{return}}})(e.argsText??"")??{},argsText:e.argsText??""}}default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>eb(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==c.length||"text"!==c[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},ev=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),ek=e=>{let t=e.map(e=>ey(e,eg(),ep(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},ew=e=>e.next?ew(e.next):"current"in e?e:null;class eS{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class e_{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let n of(e.level=t,e.children)){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if("relink"!==n||r!==i){if("link"!==n&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=t}if("cut"!==n){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(ew(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new eS(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(void 0===r)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let n;do n=ex();while(this.messages.has(n))return this.addOrUpdateMessage(e,ey(t,n,{type:"running"})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let r=void 0===t?n.prev:null===t?null:this.messages.get(t);if(void 0===r)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,t,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=ew(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=ew(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}}let eC=Symbol("skip-update");class ej{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class eE{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class eT extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===eC)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===eC||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let n of Object.keys(e))if(!Object.is(e[n],t[n]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class eI extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==eC&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class eA extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eN extends eE{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eM extends ej{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){if(this.isEmpty)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let e=this.getAttachmentAdapter(),t=this.attachments.length>0?Promise.all(this.attachments.map(async t=>{if("complete"===t.status.type)return t;if(!e)throw Error("Attachments are not supported");return await e.send(t)})):[],n=this.text,r=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let i={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await t,runConfig:this.runConfig,metadata:{custom:{...r?{quote:r}:{}}}};this.handleSend(i),this._notifyEventSubscribers("send")}cancel(){this.handleCancel()}async addAttachment(e){if(!(e instanceof File)){let t={id:e.id??eg(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,t],this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers();return}let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers()}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let n=this._attachments[t];if("complete"!==n.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let s=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(s);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let a=setInterval(()=>{this._isActiveSession(r,n)&&"ended"===n.status.type&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(a))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}}class eR extends eM{runtime;_canCancel=!1;get canCancel(){return this._canCancel}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}}class eP extends eM{runtime;endEditCallback;get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextParts;_previousText;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=ev(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>"text"!==e.type),this.setRunConfig({...e.composer.runConfig})}async handleSend(e){ev(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class eD{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new e_;get messages(){return this.repository.getMessages()}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new eR(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new eP(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{return}}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error("Feedback adapter not configured");let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),"assistant"===r.role){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(ev(n)),i=r.subscribe(()=>{"ended"===r.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize"))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(ek(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}}let eO=Object.freeze([]),eF=(e,t)=>{let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0};class eL extends eD{_assistantOptimisticId=null;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,attachments:!1,feedback:!1};get capabilities(){return this._capabilities}_messages;isDisabled;get isLoading(){return this._store.isLoading??!1}get messages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new ea;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,n;if(this._store===e)return;let r=e.isRunning??!1;this.isDisabled=e.isDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let s=e.suggestions??eO;eF(this.suggestions,s)||(this.suggestions=s);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback};if(eF(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new ea;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}t=e.convertMessage?this._converter.convertMessages(e.messages,(t,n,i)=>{if(!e.convertMessage)return n;let s=ep(i===(e.messages?.length??0)-1,r,!1,!1,void 0);if(t&&("assistant"!==t.role||!0!==t.status[el]||t.status===s))return t;let o=ey(e.convertMessage(n,i),i.toString(),s);return er in o||(o[er]=n),o}):e.messages;for(let e=0;e<t.length;e++){let n=t[e],r=t[e-1];this.repository.addOrUpdateMessage(r?.id??null,n)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart"):this._notifyEventSubscribers("runEnd")),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),n=t,r&&n[n.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}unstable_loadExternalState(e){this.importExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this.composer.text.trim()||this.composer.setText(ev(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){let t=new e_;t.import(ek(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(eo)):this._store.setMessages?.(e)}}let eB=e=>e.adapters?.threadList??{};class ez extends J{threads;constructor(e){super(),this.threads=new en(eB(e),()=>new eL(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(eB(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}class e${_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,"switchedTo"===e&&!s||"switchedAway"===e&&s||t())})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}class eU{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class eq extends eU{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class eH extends eq{get source(){return"thread-composer"}}class eV extends eq{get source(){return"edit-composer"}}class eW extends eU{get source(){return"message"}constructor(e){super(e)}remove(){throw Error("Message attachments cannot be removed")}}let eK=Object.freeze([]),eG=Object.freeze({});class eJ{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.send()}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eN({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}class eQ extends eJ{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new eI({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??eK,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??eG,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new eH(new eT({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:eC},subscribe:e=>this._core.subscribe(e)}),this._core)}}class eY extends eJ{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const n=new eI({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??eK,runConfig:t?.runConfig??eG,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new eV(new eT({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:eC},subscribe:e=>this._core.subscribe(e)}),this._core)}}let eX=Symbol.for("aui.tool-response");class eZ{get[eX](){return!0}artifact;result;isError;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&eX in e}static toResponse(e){return e instanceof eZ?e:new eZ({result:void 0===e?"<no result>":e})}}class e0{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let n=this.messageApi.getState();if(!n)throw Error("Message is not available");let r=t.toolName,i=t.toolCallId,s=eZ.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let e1=Object.freeze({type:"complete"}),e5=(e,t)=>{let n=e.content[t];if(!n)return eC;let r=((e,t,n)=>{if("assistant"!==e.role)return e1;if("tool-call"===n.type)if(!n.result)return e.status;else return e1;let r=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?e1:r?e.status:e1})(e,t,n);return Object.freeze({...n,...{[er]:n[er]},status:r})};class e2{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new eY(new eA({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,{runConfig:r=(t??n).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:r})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let r=this._threadBinding.getState().getBranches(n.id),i=t;if("previous"===e?i=r[n.branchNumber-2]:"next"===e&&(i=r[n.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ev(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new e0(new eT({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>e5(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new e0(new eT({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===n?eC:e5(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new eW(new eT({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,n=t?.[e];return n?{...n,source:"message"}:eC},subscribe:e=>this._core.subscribe(e)}))}}class e3{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const n=new eT({path:e.path,getState:()=>{var n,r;let i;return n=e.getState(),r=t.getState(),i=n.messages.at(-1),Object.freeze({threadId:r.id,metadata:r,capabilities:n.capabilities,isDisabled:n.isDisabled,isLoading:n.isLoading,isRunning:i?.role==="assistant"&&"running"===i.status.type,messages:n.messages,state:n.state,suggestions:n.suggestions,extras:n.extras,speech:n.speech})},subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new eQ(new eA({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.unstable_resumeRun=this.unstable_resumeRun.bind(this),this.unstable_loadExternalState=this.unstable_loadExternalState.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){let t;return this._threadBinding.getState().startRun({parentId:(t=null===e||"string"==typeof e?{parentId:e}:e).parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}unstable_resumeRun(e){return this.resumeRun(e)}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}unstable_loadExternalState(e){this._threadBinding.getState().unstable_loadExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new e2(new eT({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:s}=this._threadBinding.getState();if(!e||void 0===n||void 0===r)return eC;let o=this._threadBinding.getState().getBranches(e.id),a=e.metadata.submittedFeedback;return{...e,...{[er]:e[er]},index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:s?.messageId===e.id?s:void 0,submittedFeedback:a}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eN({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}let e4=(e,t)=>{if(void 0===t)return eC;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.id===e.mainThreadId}:eC};class e6{_core;_runtimeFactory;_getState;constructor(e,t=e3){this._core=e,this._runtimeFactory=t;const n=new eI({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new e$(new eT({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>e4(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new eA({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new eA({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new e$(new eT({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>e4(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new e$(new eT({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>e4(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new e$(new eT({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>e4(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class e9{_core;threads;get threadList(){return this.threads}_thread;constructor(e){this._core=e,this.threads=new e6(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(ek(e??[]))}}let e7=(0,j.createContext)(null);var e8=e.i(962885),te=e.i(687975),tt=e.i(806786),tn=e.i(477501),tr=e.i(800003),ti=class extends tn.Subscribable{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,tr.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,tr.hashKey)(t.mutationKey)!==(0,tr.hashKey)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#s()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??(0,te.getDefaultState)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#s(e){tt.notifyManager.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},ts=e.i(434682),to=e.i(317406);function ta(e){return["chat-messages",e]}async function tl(e){let t=await fetch(`/api/interactive/chat/${e}/messages`);if(!t.ok)throw console.error(`[ChatState] fetch failed: ${t.status}`,await t.text().catch(()=>"")),Error(`Failed to fetch chat state: ${t.status}`);return t.json()}function tu(e){if(null==e||""===e)return null;if("number"==typeof e)return Number.isFinite(e)?e:null;if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}if("string"==typeof e){let t=Number(e);if(Number.isFinite(t))return t;let n=new Date(e).getTime();return Number.isFinite(n)?n:null}return null}async function tc(e,t,n,r,i){let s=await fetch(`/api/interactive/chat/${e}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,worktreePath:n,model:r,agentType:i})});if(!s.ok)throw Error(`Failed to send message: ${s.status}`);return(await s.json()).message}function td(e){return{id:e.id,role:e.role===to.InteractiveMessageRole.user?"user":"assistant",content:[{type:"text",text:e.content}],createdAt:e.createdAt?new Date(e.createdAt):void 0}}function th(e,t,n){let r=(0,ts.useQueryClient)(),i=(0,j.useRef)(n?.model),s=(0,j.useRef)(n?.agentType);i.current=n?.model,s.current=n?.agentType;let o=(0,j.useRef)(n?.debugMode??!1);o.current=n?.debugMode??!1;let[a,l]=(0,j.useState)([]),u=(0,j.useCallback)((e,t)=>{o.current&&l(n=>[...n,{id:`dbg-${Date.now()}-${Math.random()}`,timestamp:new Date,label:e,detail:t}])},[]),{data:c,isLoading:d}=(0,e8.useQuery)({queryKey:ta(e),queryFn:()=>tl(e),initialData:n?.initialChatState,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1});(0,j.useEffect)(()=>{c?.turnStatus==="unread"&&fetch(`/api/interactive/chat/${e}/mark-read`,{method:"POST"})},[c?.turnStatus,e]);let h=(0,j.useMemo)(()=>c?.messages??[],[c?.messages]),p=c?.sessionStatus??null,f=(0,j.useRef)(null);(0,j.useEffect)(()=>{if(p&&p!==f.current){let e=c?.sessionInfo;u(`session_${p}`,e?`model=${e.model??"?"}, sid=${e.sessionId?.slice(0,8)??"?"}`:void 0)}f.current=p},[p,c?.sessionInfo,u]);let m=c?.streamingText??null,g=(0,j.useRef)(null);c?.sessionInfo&&(g.current=c.sessionInfo);let x=c?.sessionInfo??g.current,[b,y]=(0,j.useState)(""),[v,k]=(0,j.useState)(null),[w,S]=(0,j.useState)(!1),_=(0,j.useRef)(null),C=(0,j.useRef)(null),[E,T]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=c?.pendingInteraction??null;e?T(e):!e&&E&&T(null)},[c?.pendingInteraction,E]);let I=(0,j.useCallback)(()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>S(!0),600)},[]),A=(0,j.useCallback)(()=>{_.current&&(clearTimeout(_.current),_.current=null),S(!1)},[]),N=h.length>0?h[h.length-1].role:null;(0,j.useEffect)(()=>{N===to.InteractiveMessageRole.assistant&&A()},[N,h.length,A]),(0,j.useEffect)(()=>{let t=new EventSource(`/api/interactive/chat/${e}/stream`);return C.current=t,t.addEventListener("delta",e=>{try{let t=JSON.parse(e.data);t.delta&&(A(),y(e=>e+t.delta),k(null))}catch{}}),t.addEventListener("activity",e=>{A();try{let t=JSON.parse(e.data);t.activity&&u(`[${t.activity.kind}] ${t.activity.label}`,t.activity.detail)}catch{}}),t.addEventListener("log",e=>{try{let t=JSON.parse(e.data);t.log&&(A(),k(t.log),u("log",t.log))}catch{}}),t.addEventListener("interaction",e=>{try{let t=JSON.parse(e.data);t.interaction&&(A(),T(t.interaction))}catch{}}),t.addEventListener("message",t=>{try{let i=JSON.parse(t.data);if(i.message){var n;n=i.message,r.setQueryData(ta(e),e=>{let t=e??{messages:[],sessionStatus:null,streamingText:null,sessionInfo:null};if(t.messages.find(e=>e.id===n.id))return t;let r=t.messages.filter(e=>!(e.id.startsWith("optimistic-")&&e.role===n.role&&e.content===n.content));return{...t,messages:[...r,n]}}),i.message.role===to.InteractiveMessageRole.assistant&&A()}}catch{}}),t.addEventListener("session_status",t=>{try{var n;let i=JSON.parse(t.data);i.sessionStatus&&(n=i.sessionStatus,r.setQueryData(ta(e),e=>e?{...e,sessionStatus:n}:e))}catch{}}),t.addEventListener("turn_status",t=>{try{var n;let i=JSON.parse(t.data);i.turnStatus&&(n=i.turnStatus,r.setQueryData(ta(e),e=>e?{...e,turnStatus:n}:e))}catch{}}),t.addEventListener("workflow_step",t=>{try{let n=JSON.parse(t.data);if(!n.step)return;r.setQueryData(ta(e),e=>{let t;if(!e)return e;let r=e.workflow,i=r?.steps.findIndex(e=>e.id===n.step.id)??-1;r&&-1!==i?(t=r.steps.slice())[i]=n.step:t=[...r?.steps??[],n.step].sort((e,t)=>e.stepIndex-t.stepIndex);let s=t.find(e=>"running"===e.status);return{...e,workflow:{workflowId:n.step.workflowId,steps:t,currentStepId:s?.id??null}}})}catch{}}),t.addEventListener("done",()=>{k(null),A(),u("turn_done"),T(null),y("")}),t.addEventListener("open",()=>{r.invalidateQueries({queryKey:ta(e)})}),t.onerror=()=>{},()=>{t.close(),C.current=null}},[e,r,A,u]);let M=function(e,t){let n=(0,ts.useQueryClient)(void 0),[r]=j.useState(()=>new ti(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);let i=j.useSyncExternalStore(j.useCallback(e=>r.subscribe(tt.notifyManager.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=j.useCallback((e,t)=>{r.mutate(e,t).catch(tr.noop)},[r]);if(i.error&&(0,tr.shouldThrowError)(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}({mutationFn:n=>tc(e,n,t??"",i.current,s.current),onMutate:async t=>{u("send_message",`model=${i.current??"default"}, agent=${s.current??"default"}, len=${t.length}`),I(),await r.cancelQueries({queryKey:ta(e)});let n=r.getQueryData(ta(e));return r.setQueryData(ta(e),n=>({...n??{sessionStatus:"booting",sessionInfo:null},messages:[...n?.messages??[],{id:`optimistic-${Date.now()}`,featureId:e,role:to.InteractiveMessageRole.user,content:t,createdAt:new Date,updatedAt:new Date}],streamingText:null})),{previous:n}},onError:(t,n,i)=>{i?.previous&&r.setQueryData(ta(e),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:ta(e)})}}),R=c?.turnStatus,P=w||!!b||!!v||"booting"===p||"processing"===R,D=b??m??"",O=(0,j.useMemo)(()=>{let e=c?.workflow??null;if(!e||0===e.steps.length)return{hasPlan:!1,steps:[],activeStepId:null,allDone:!1,liveStatus:null};let t=new Map;for(let e of h){let n=e.stepId;if(!n||e.role!==to.InteractiveMessageRole.assistant)continue;let r=t.get(n)??[];r.push(e),t.set(n,r)}let n=e.steps.map(e=>({definition:{id:e.id,stepKey:e.stepKey,title:e.title,description:e.description},status:function(e){switch(e){case"pending":case"running":case"done":case"failed":case"interrupted":return e;default:return"pending"}}(e.status),metadata:function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(e.metadata),toolMessages:t.get(e.id)??[],startedAt:tu(e.startedAt),finishedAt:tu(e.finishedAt)})),r=n.length>0&&n.every(e=>"done"===e.status),i=m?.trim()??"",s=b?.trim()??"",o=(s||i).split("\n")[0]?.slice(0,80)??"",a=null;return r?a=null:v?a=v:o?a=o:("processing"===R||w||"booting"===p)&&(a="booting"===p?"Waking up…":"Thinking…"),{hasPlan:!0,steps:n,activeStepId:e.currentStepId,allDone:r,liveStatus:a}},[c?.workflow,h,v,b,m,R,w,p]),F=n?.pinInitialRequest===!0,L=(0,j.useMemo)(()=>O.hasPlan||F?h.find(e=>e.role===to.InteractiveMessageRole.user&&!e.stepId)??null:null,[O.hasPlan,F,h]),B=(0,j.useMemo)(()=>new Set(n?.hiddenMessageIds??[]),[n?.hiddenMessageIds]),z=(0,j.useMemo)(()=>{let e;if(n?.hideAllMessages===!0)return[];let t=O.hasPlan,r=t&&!O.allDone,i=(t||F||B.size>0?h.filter(e=>!(e.id===L?.id||e.stepId||B.has(e.id))&&(!r||e.role!==to.InteractiveMessageRole.assistant)):h).map(td);if(n?.debugMode&&a.length>0){let t=a.map(e=>({id:e.id,role:"assistant",content:[{type:"text",text:e.detail?`🔧 **${e.label}** — ${e.detail}`:`🔧 **${e.label}**`}],createdAt:e.timestamp}));e=[];let n=0,r=0;for(;n<i.length&&r<t.length;)(i[n].createdAt?new Date(i[n].createdAt).getTime():0)<=(t[r].createdAt?new Date(t[r].createdAt).getTime():0)?e.push(i[n++]):e.push(t[r++]);for(;n<i.length;)e.push(i[n++]);for(;r<t.length;)e.push(t[r++])}else e=i;if(t&&!O.allDone)return e;if(n?.suppressStreamingIndicator!==!0)if(D.trim()){let t=[{type:"text",text:D}];v&&t.push({type:"text",text:`*⏳ ${v}*`}),e.push({id:"streaming",role:"assistant",content:t})}else v?e.push({id:"streaming",role:"assistant",content:[{type:"text",text:`*⏳ ${v}*`}]}):(w||"booting"===p)&&e.push({id:"streaming",role:"assistant",content:[{type:"text",text:"booting"===p?"*Agent is waking up...*":"*Thinking...*"}]});return e},[h,L?.id,D,w,p,v,n?.debugMode,n?.suppressStreamingIndicator,n?.hideAllMessages,a,O.hasPlan,O.allDone,F,B]),$=(0,j.useMemo)(()=>P?{isRunning:!0,statusText:v}:{isRunning:!1,statusText:null},[P,v]),U=(0,j.useCallback)(async e=>{let t=e.content.find(e=>"text"===e.type);if(t?.type!=="text"||!t.text.trim())return;let r=n?.contentTransform?n.contentTransform(t.text):t.text;M.mutate(r,{onSuccess:()=>n?.onMessageSent?.()})},[M,n]),q=(0,j.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/messages`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to clear chat: ${t.status}`);y(""),l([]),k(null),A(),T(null),r.invalidateQueries({queryKey:ta(e)})},[e,r,A]),H=(0,j.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/stop`,{method:"POST"});if(!t.ok)throw Error(`Failed to stop agent: ${t.status}`);y(""),k(null),A(),r.invalidateQueries({queryKey:ta(e)})},[e,r,A]),V=(0,j.useCallback)(async t=>{T(null),k(null);try{let n=await fetch(`/api/interactive/chat/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:t})});n.ok||console.error(`[respondToInteraction] failed: ${n.status}`)}catch(e){console.error("[respondToInteraction] error:",e)}r.invalidateQueries({queryKey:ta(e)})},[e,r]),W=!(O.hasPlan&&!O.allDone)&&P;return{runtime:(e=>{let[t]=(0,j.useState)(()=>new ez(e));(0,j.useEffect)(()=>{t.setAdapter(e)});let{modelContext:n}=(0,j.useContext)(e7)??{};return(0,j.useEffect)(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),(0,j.useMemo)(()=>new e9(t),[t])})({messages:z,convertMessage:(0,j.useCallback)(e=>e,[]),isRunning:W,onNew:U,onCancel:(0,j.useCallback)(async()=>{y(""),k(null),A()},[A])}),status:$,clearChat:q,stopAgent:H,sessionInfo:x,isChatLoading:d,pendingInteraction:E,respondToInteraction:V,stepProgress:O,initialRequestMessage:L,rawMessages:h,streamingState:{text:D,statusLog:v,awaiting:w,sessionStatus:p}}}e.s(["chatQueryKey",()=>ta,"fetchChatState",()=>tl],549922),e.s(["useChatRuntime",()=>th],323217);var tp=e.i(102828);e.i(650032);var tf=e.i(486254);function tm({attachments:e,isDragOver:n,uploadError:r,onDragEnter:s,onDragLeave:o,onDragOver:a,onDrop:l,onPaste:u,onRemoveAttachment:h,onNotesChange:p,onPickFiles:f,agentPicker:m,disabled:g}){let{t:b}=(0,c.useTranslation)("web"),[y,v]=(0,j.useState)(!1),k=(0,j.useRef)(null);return(0,t.jsx)(i.ComposerPrimitive.Root,{className:(0,d.cn)("shrink-0 border-t p-3",g&&"pointer-events-none opacity-50"),children:(0,t.jsx)("div",{onDragEnter:s,onDragLeave:o,onDragOver:a,onDrop:l,className:(0,d.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",n&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{ref:k,onFocus:()=>v(!0),onBlur:()=>v(!1),className:(0,d.cn)("border-input flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",y&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(i.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:b("chat.writeMessage"),onPaste:u,className:"max-h-[4.5rem] min-h-0 resize-none rounded-none border-0 px-3 py-2.5 text-sm shadow-none focus:outline-none focus-visible:ring-0"}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:e.map(e=>(0,t.jsx)(tf.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>h(e.id),loading:e.loading,notes:e.notes,onNotesChange:t=>p(e.id,t)},e.id))}):null,r?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:r}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[m,(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(tp.Tooltip,{children:[(0,t.jsx)(tp.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:f,"aria-label":b("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(x.Paperclip,{className:"h-4 w-4"})})}),(0,t.jsx)(tp.TooltipContent,{side:"top",children:b("chat.attachFiles")})]}),(0,t.jsx)(tg,{})]})]})})})}function tg(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(i.ComposerPrimitive.Send,{className:(0,d.cn)("bg-primary text-primary-foreground inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(f.SendHorizontal,{className:"size-3.5"})})}),(0,t.jsx)(o.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(i.ComposerPrimitive.Cancel,{className:(0,d.cn)("bg-destructive/10 text-destructive inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(m.CircleStop,{className:"size-3.5"})})})]})}e.s(["ChatComposer",()=>tm],461152);var tx=e.i(604340);function tb({interaction:e,onSubmit:n,className:r}){let i=e.questions.length>1;return(0,t.jsxs)("div",{className:(0,d.cn)("group flex w-full items-start gap-2.5 px-4 py-0.5",r),children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(tx.MessageCircleQuestion,{className:"h-3.5 w-3.5 text-violet-600 dark:text-violet-400"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-200 bg-violet-50/50 text-sm leading-relaxed shadow-sm dark:border-violet-500/20 dark:bg-violet-950/20",children:i?(0,t.jsx)(ty,{questions:e.questions,onSubmit:n}):(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsx)(tk,{question:e.questions[0],onSubmit:n})})})})]})}function ty({questions:e,onSubmit:n}){let[r,i]=(0,j.useState)(0),[s,o]=(0,j.useState)(()=>{let t={};for(let n of e)t[n.question]={selectedOptions:new Set,otherText:"",isOtherSelected:!1};return t}),a=(0,j.useCallback)((e,t)=>{o(n=>({...n,[e]:t(n[e])}))},[]),l={};for(let t of e){let e=s[t.question];if(!e)continue;let n=[...e.selectedOptions];e.isOtherSelected&&e.otherText.trim()&&n.push(e.otherText.trim()),n.length>0&&(l[t.question]=n.join(", "))}let u=e.every(e=>l[e.question]),c=(0,j.useCallback)(()=>{u&&n(l)},[u,n,s]);return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex border-b border-violet-200 dark:border-violet-500/20",children:e.map((e,n)=>{let s=n===r,o=!!l[e.question];return(0,t.jsxs)("button",{type:"button",onClick:()=>i(n),className:(0,d.cn)("relative flex items-center gap-1.5 px-4 py-2 text-xs font-medium transition-colors",s?"text-violet-700 dark:text-violet-300":"text-muted-foreground hover:text-foreground"),children:[o?(0,t.jsx)(C.Check,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}):(0,t.jsxs)("span",{className:"text-muted-foreground/50 text-[10px]",children:[n+1,"."]}),e.header,s?(0,t.jsx)("span",{className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-violet-600 dark:bg-violet-400"}):null]},e.question)})}),e.map((e,n)=>(0,t.jsx)("div",{className:"px-4 py-3",style:{display:n===r?void 0:"none"},children:(0,t.jsx)(tv,{question:e,selection:s[e.question],onSelectionChange:t=>a(e.question,t)})},e.question)),(0,t.jsxs)("div",{className:"flex items-center gap-3 border-t border-violet-200 px-4 py-2.5 dark:border-violet-500/20",children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!u,className:(0,d.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",u?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(C.Check,{className:"h-3 w-3"}),"Submit all"]}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:[Object.keys(l).length,"/",e.length," answered"]})]})]})}function tv({question:e,selection:n,onSelectionChange:r}){let i=(0,j.useCallback)(t=>{r(n=>{let r=new Set(n.selectedOptions);return e.multiSelect?(r.has(t)?r.delete(t):r.add(t),{...n,selectedOptions:r}):(r.clear(),r.add(t),{...n,selectedOptions:r,isOtherSelected:!1})})},[e.multiSelect,r]),s=(0,j.useCallback)(()=>{r(t=>e.multiSelect?{...t,isOtherSelected:!t.isOtherSelected}:{selectedOptions:new Set,otherText:t.otherText,isOtherSelected:!0})},[e.multiSelect,r]),o=(0,j.useCallback)(e=>{r(t=>({...t,otherText:e}))},[r]);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-foreground mb-2 text-xs font-medium",children:[e.question,e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground ml-1 font-normal",children:"(select multiple)"}):null]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[e.options.map(r=>(0,t.jsx)(tw,{option:r,isSelected:n.selectedOptions.has(r.label),isMulti:e.multiSelect,onToggle:()=>i(r.label)},r.label)),(0,t.jsx)(tS,{isSelected:n.isOtherSelected,isMulti:e.multiSelect,text:n.otherText,onToggle:s,onTextChange:o})]})]})}function tk({question:e,onSubmit:n}){let[r,i]=(0,j.useState)(new Set),[s,o]=(0,j.useState)(""),[a,l]=(0,j.useState)(!1),u=(0,j.useCallback)(t=>{i(n=>{let r=new Set(n);return e.multiSelect?r.has(t)?r.delete(t):r.add(t):(r.clear(),r.add(t),l(!1)),r}),e.multiSelect||l(!1)},[e.multiSelect]),c=(0,j.useCallback)(()=>{e.multiSelect?l(e=>!e):(i(new Set),l(!0))},[e.multiSelect]),h=(0,j.useCallback)(()=>{let t=[...r];a&&s.trim()&&t.push(s.trim()),0!==t.length&&n({[e.question]:t.join(", ")})},[r,a,s,n,e.question]),p=r.size>0||a&&s.trim();return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-violet-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-violet-700 uppercase dark:bg-violet-900/50 dark:text-violet-300",children:e.header}),(0,t.jsx)("span",{className:"font-medium",children:e.question})]}),(0,t.jsxs)("div",{className:"ml-0.5 flex flex-col gap-1.5",children:[e.options.map(n=>(0,t.jsx)(tw,{option:n,isSelected:r.has(n.label),isMulti:e.multiSelect,onToggle:()=>u(n.label)},n.label)),(0,t.jsx)(tS,{isSelected:a,isMulti:e.multiSelect,text:s,onToggle:c,onTextChange:o})]}),(0,t.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:h,disabled:!p,className:(0,d.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",p?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(C.Check,{className:"h-3 w-3"}),"Submit"]}),e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Select one or more"}):null]})]})}function tw({option:e,isSelected:n,isMulti:r,onToggle:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,d.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-left text-xs transition-all",n?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 hover:bg-violet-50 dark:hover:border-violet-500/30 dark:hover:bg-violet-900/10"),children:[(0,t.jsx)("span",{className:(0,d.cn)("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border transition-colors",r?"rounded":"rounded-full",n?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:n?(0,t.jsx)(C.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:(0,d.cn)("font-medium",n&&"text-violet-700 dark:text-violet-300"),children:e.label}),(0,t.jsx)("span",{className:"text-muted-foreground text-[11px] leading-snug",children:e.description})]})]})}function tS({isSelected:e,isMulti:n,text:r,onToggle:i,onTextChange:s}){return(0,t.jsxs)("div",{className:(0,d.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-xs transition-all",e?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 dark:hover:border-violet-500/30"),children:[(0,t.jsx)("button",{type:"button",onClick:i,className:"mt-0.5 shrink-0",children:(0,t.jsx)("span",{className:(0,d.cn)("flex h-4 w-4 items-center justify-center border transition-colors",n?"rounded":"rounded-full",e?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:e?(0,t.jsx)(C.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:(0,d.cn)("font-medium",e&&"text-violet-700 dark:text-violet-300"),children:"Other"}),e?(0,t.jsx)("input",{type:"text",value:r,onChange:e=>s(e.target.value),placeholder:"Type your answer...",className:"w-full rounded-md border border-violet-200 bg-white/80 px-2 py-1 text-xs outline-none focus:border-violet-400 focus:ring-1 focus:ring-violet-300/30 dark:border-violet-500/30 dark:bg-violet-950/30 dark:focus:border-violet-500/50 dark:focus:ring-violet-500/20",autoFocus:!0}):null]})]})}e.s(["InteractionBubble",()=>tb],673138);var t_=e.i(291967),tC=e.i(922528),tj=e.i(936589),tE=e.i(305192),tT=e.i(205978),tI=e.i(287620),tA=e.i(685995),tN=e.i(713123),tM="Collapsible",[tR,tP]=(0,tC.createContextScope)(tM),[tD,tO]=tR(tM),tF=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:a,...l}=e,[u,c]=(0,tj.useControllableState)({prop:i,defaultProp:s??!1,onChange:a,caller:tM});return(0,t.jsx)(tD,{scope:r,disabled:o,contentId:(0,tN.useId)(),open:u,onOpenToggle:j.useCallback(()=>c(e=>!e),[c]),children:(0,t.jsx)(tI.Primitive.div,{"data-state":tq(u),"data-disabled":o?"":void 0,...l,ref:n})})});tF.displayName=tM;var tL="CollapsibleTrigger",tB=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,...i}=e,s=tO(tL,r);return(0,t.jsx)(tI.Primitive.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":tq(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:n,onClick:(0,t_.composeEventHandlers)(e.onClick,s.onOpenToggle)})});tB.displayName=tL;var tz="CollapsibleContent",t$=j.forwardRef((e,n)=>{let{forceMount:r,...i}=e,s=tO(tz,e.__scopeCollapsible);return(0,t.jsx)(tA.Presence,{present:r||s.open,children:({present:e})=>(0,t.jsx)(tU,{...i,ref:n,present:e})})});t$.displayName=tz;var tU=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,present:i,children:s,...o}=e,a=tO(tz,r),[l,u]=j.useState(i),c=j.useRef(null),d=(0,tT.useComposedRefs)(n,c),h=j.useRef(0),p=h.current,f=j.useRef(0),m=f.current,g=a.open||l,x=j.useRef(g),b=j.useRef(void 0);return j.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,tE.useLayoutEffect)(()=>{let e=c.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();h.current=t.height,f.current=t.width,x.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),u(i)}},[a.open,i]),(0,t.jsx)(tI.Primitive.div,{"data-state":tq(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&s})});function tq(e){return e?"open":"closed"}e.s(["Collapsible",()=>tF,"CollapsibleContent",()=>t$,"CollapsibleTrigger",()=>tB,"Content",()=>t$,"Root",()=>tF,"Trigger",()=>tB,"createCollapsibleScope",()=>tP],975074);var tH=e.i(975074),tH=tH,tV=e.i(276016),tW=e.i(495812),tK=e.i(958481);let tG=(0,e.i(294237).cva)("animate-spinner inline-block rounded-full",{variants:{size:{sm:"size-4",md:"size-6",lg:"size-10"}},defaultVariants:{size:"md"}}),tJ={sm:"3px",md:"4px",lg:"8px"};function tQ({className:e,size:n="md",...r}){let i=tJ[n??"md"];return(0,t.jsx)("div",{"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,d.cn)(tG({size:n}),e),style:{background:"conic-gradient(from 220deg, transparent 0%, currentColor 80%, transparent 100%)",WebkitMask:`radial-gradient(farthest-side, #0000 calc(100% - ${i}), #000 calc(100% - ${i} + 1px))`},...r})}let tY={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-background/50 my-2 overflow-x-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-sm font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-xs font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e})};function tX({steps:e,className:n,collapsedSummary:r,activeStepId:i,liveStatus:s,onRetry:o,onForceStop:a}){let[l,u]=(0,j.useState)(!1);if(0===e.length)return null;if(r&&!l){let r=e.filter(e=>"done"===e.status).length;return(0,t.jsx)("div",{className:(0,d.cn)("p-4",n),children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:"hover:bg-muted/40 border-border bg-background flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors dark:bg-neutral-800/50",children:[(0,t.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(C.Check,{className:"h-4 w-4",strokeWidth:3})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Initial setup complete"}),(0,t.jsxs)("div",{className:"text-muted-foreground text-xs",children:[r," of ",e.length," steps finished — click to review"]})]}),(0,t.jsx)(tV.ChevronRight,{className:"text-muted-foreground h-4 w-4 shrink-0"})]})})}let c=function(e){let t=null,n=null,r=0,i=0,s=0;for(let o of e){null!==o.startedAt&&(t=null===t?o.startedAt:Math.min(t,o.startedAt));let e="running"===o.status?Date.now():o.finishedAt??null;null!==e&&(n=null===n?e:Math.max(n,e)),r+=t2(o.metadata,"costUsd"),i+=t2(o.metadata,"inputTokens"),s+=t2(o.metadata,"outputTokens")}return null===t||null===n?null:{durationMs:Math.max(0,n-t),costUsd:r,inputTokens:i,outputTokens:s}}(e);return(0,t.jsxs)("ol",{className:(0,d.cn)("flex flex-col gap-2 p-4",n),children:[r?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!1),className:"text-muted-foreground hover:text-foreground mb-1 inline-flex items-center gap-1 text-[10px] tracking-wide uppercase",children:[(0,t.jsx)(w.ChevronDown,{className:"h-3 w-3"}),"Collapse setup"]})}):null,e.map((e,n)=>(0,t.jsx)(t0,{step:e,liveStatus:e.definition.id===i?s??null:null,mountIndex:n,onRetry:"interrupted"===e.status?o:void 0,onForceStop:a},e.definition.id)),c?(0,t.jsxs)("li",{className:"border-border/40 text-muted-foreground mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 border-t pt-3 text-[10px] tracking-wide uppercase",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Total"}),(0,t.jsx)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:t3(c.durationMs)})]}),c.costUsd>0?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Cost"}),(0,t.jsx)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:t4(c.costUsd)})]}):null,c.inputTokens>0||c.outputTokens>0?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Tokens"}),(0,t.jsxs)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:[t6(c.inputTokens)," in · ",t6(c.outputTokens)," out"]})]}):null]}):null]})}let tZ="Output";function t0({step:e,liveStatus:n,mountIndex:r,onRetry:i,onForceStop:s}){let[o,a]=(0,j.useState)(!1),[u,c]=(0,j.useState)(!1);(0,j.useEffect)(()=>{"interrupted"!==e.status&&a(!1)},[e.status]),(0,j.useEffect)(()=>{"running"!==e.status&&"pending"!==e.status&&c(!1)},[e.status]);let f=u?"interrupted":o?"running":e.status,[m,g]=(0,j.useState)("interrupted"===e.status||"failed"===e.status),{definition:x,metadata:b,toolMessages:y}=e,v=function(e,t){if(!e)return[];let n=e[t];return Array.isArray(n)?n.filter(e=>"string"==typeof e):[]}(b,"details"),w=function(e,t){if(!e)return"";let n=e[t];return"string"==typeof n?n:""}(b,"error"),S=function(e){let t=e.map(e=>{let t=e.content?.trim()??"";return{message:e,content:t,event:t?(0,p.parseToolEvent)(t):null}}).filter(e=>e.content.length>0),n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.event?.kind==="tool"&&"Thinking"===r.event.name){n.push({kind:"thinking",message:r.message});continue}if(r.event?.kind==="tool"&&r.event.name===tZ){n.push({kind:"tool",message:r.message,output:null});continue}if(r.event?.kind==="tool"){let i=t[e+1],s=i?.event?.kind==="tool"&&i.event.name===tZ;n.push({kind:"tool",message:r.message,output:s?i.message:null}),s&&e++;continue}if(r.event?.kind==="label-only"){n.push({kind:"tool",message:r.message,output:null});continue}n.push({kind:"text",message:r.message})}return n}(y),_=function(e,t){let[n,r]=(0,j.useState)(0);return((0,j.useEffect)(()=>{if("running"!==t||null===e.startedAt)return;let n=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(n)},[t,e.startedAt]),null===e.startedAt)?null:"running"===t?Math.max(0,Date.now()-e.startedAt):null===e.finishedAt?null:Math.max(0,e.finishedAt-e.startedAt)}(e,f),C=t2(b,"costUsd"),E=t2(b,"inputTokens"),T=t2(b,"outputTokens"),I=S.length>0||v.length>0||!!w||"interrupted"===f;return(0,t.jsx)(tH.Root,{asChild:!0,open:m,onOpenChange:g,children:(0,t.jsxs)("li",{className:(0,d.cn)("rounded-lg border transition-[background-color,border-color] duration-300 ease-out","animate-in fade-in-0 slide-in-from-top-2","running"===f&&"border-violet-500/40 bg-violet-500/5 dark:bg-violet-500/10","done"===f&&"border-border bg-background dark:bg-neutral-800/50","pending"===f&&"border-border/40 bg-muted/20 dark:bg-neutral-800/30","failed"===f&&"border-red-500/40 bg-red-500/5 dark:bg-red-500/10","interrupted"===f&&"border-amber-500/40 bg-amber-500/5 dark:bg-amber-500/10"),style:{animationDelay:`${40*Math.min(r,6)}ms`,animationDuration:"300ms"},children:[(0,t.jsx)(tH.Trigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",disabled:!I,className:(0,d.cn)("flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors duration-200",I&&"hover:bg-muted/40 cursor-pointer",!I&&"cursor-default"),children:[(0,t.jsx)(t5,{status:f}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-2",children:[(0,t.jsx)("span",{className:(0,d.cn)("shrink-0 truncate text-sm font-medium transition-colors duration-300","pending"===f&&"text-muted-foreground/60"),children:x.title}),"interrupted"===f?(0,t.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-amber-600 dark:text-amber-400",children:"Interrupted"}):n&&"running"===f?(0,t.jsxs)("span",{className:"flex min-w-0 items-baseline gap-1.5 text-xs text-violet-700 dark:text-violet-300",children:[(0,t.jsx)("span",{className:"inline-flex h-1 w-1 shrink-0 translate-y-[-1px] animate-pulse rounded-full bg-violet-500"}),(0,t.jsx)("span",{className:"animate-in fade-in-0 slide-in-from-left-1 truncate duration-300",children:n},n)]}):x.description?(0,t.jsx)("span",{className:(0,d.cn)("min-w-0 truncate text-xs font-normal","pending"===f?"text-muted-foreground/40":"text-muted-foreground/70"),children:x.description}):null]}),null!==_?(0,t.jsx)("span",{className:(0,d.cn)("shrink-0 text-[10px] font-medium tabular-nums transition-colors duration-300","running"===f?"text-violet-600 dark:text-violet-300":"text-muted-foreground/70"),title:`Step duration — ${t3(_)}`,children:t3(_)}):null,s&&("running"===f||"pending"===f)?(0,t.jsx)("span",{role:"button",tabIndex:0,"aria-label":"Force stop this step",title:"Force stop this step (mark as interrupted)",onClick:t=>{t.stopPropagation(),t.preventDefault(),c(!0),s(e.definition.id)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.stopPropagation(),t.preventDefault(),c(!0),s(e.definition.id))},className:"text-muted-foreground/50 hover:bg-muted/60 hover:text-foreground focus-visible:ring-ring/50 inline-flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors focus-visible:ring-2 focus-visible:outline-none",children:(0,t.jsx)(k.X,{className:"h-3 w-3",strokeWidth:2.5})}):null,S.length>0?(0,t.jsx)("span",{className:"text-muted-foreground/60 animate-in fade-in-0 zoom-in-95 mr-1 shrink-0 text-[10px] tabular-nums duration-200",children:S.length},S.length):null,I?(0,t.jsx)(tV.ChevronRight,{className:(0,d.cn)("text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200 ease-out",m&&"rotate-90")}):null]})}),(0,t.jsx)(tH.Content,{className:(0,d.cn)("overflow-hidden","data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up"),children:(0,t.jsxs)("div",{className:"border-border/40 space-y-2 border-t px-3 py-2.5 text-xs",children:["interrupted"!==f||w?null:(0,t.jsxs)("div",{className:"flex items-center justify-between rounded bg-amber-500/10 p-2",children:[(0,t.jsx)("span",{className:"text-amber-700 dark:text-amber-400",children:"This step was interrupted before it could finish."}),i?(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(!0),g(!1),i()},className:"ms-3 shrink-0 cursor-pointer rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-1 text-[11px] font-medium text-amber-700 transition-colors hover:bg-amber-500/20 dark:text-amber-400",children:"Continue"}):null]}),w?(0,t.jsx)("p",{className:"rounded bg-red-500/10 p-2 text-red-600 dark:text-red-400",children:w}):null,v.length>0?(0,t.jsx)("ul",{className:"text-muted-foreground list-disc space-y-0.5 ps-4",children:v.map(e=>(0,t.jsx)("li",{children:e},e))}):null,C>0||E>0||T>0?(0,t.jsxs)("div",{className:"text-muted-foreground/70 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px] tabular-nums",children:[C>0?(0,t.jsx)("span",{children:t4(C)}):null,E>0||T>0?(0,t.jsxs)("span",{children:[t6(E)," in · ",t6(T)," out"]}):null]}):null,S.length>0?(0,t.jsx)("div",{className:"-mx-1 flex flex-col gap-1",children:S.map((e,n)=>{let r={animationDelay:`${30*Math.min(n,6)}ms`};return"thinking"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)(t1,{text:e.message.content})},e.message.id):"tool"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)(h.ToolBubble,{text:e.message.content,outputText:e.output?.content})},e.message.id):(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)("div",{className:"border-border/60 bg-background text-foreground rounded-md border px-2.5 py-1.5 text-xs leading-relaxed dark:bg-neutral-800/70",children:(0,t.jsx)(l.default,{components:tY,children:e.message.content})})},e.message.id)})}):null]})})]})})}function t1({text:e}){let n,[r,i]=(0,j.useState)(!1),s=(n=(0,p.parseToolEvent)(e),n?.kind==="tool"&&"Thinking"===n.name?n.detail:e);return(0,t.jsxs)("div",{className:"flex max-w-full flex-col",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"text-muted-foreground/80 hover:text-foreground inline-flex items-center gap-1 self-start rounded px-1 py-0.5 text-[11px] italic transition-colors",children:[r?(0,t.jsx)(w.ChevronDown,{className:"h-3 w-3 shrink-0 opacity-60"}):(0,t.jsx)(tV.ChevronRight,{className:"h-3 w-3 shrink-0 opacity-60"}),(0,t.jsx)("span",{children:"Thinking"})]}),r?(0,t.jsx)("p",{className:"text-muted-foreground/80 mt-0.5 ml-5 max-w-full text-[11px] leading-relaxed break-words whitespace-pre-wrap italic",children:s}):null]})}function t5({status:e}){return"running"===e?(0,t.jsx)(tQ,{size:"sm",className:"shrink-0 text-violet-500"}):"done"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(C.Check,{className:"h-3 w-3",strokeWidth:3})}):"failed"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-red-500 text-white",children:(0,t.jsx)(tK.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):"interrupted"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-amber-500 text-white",children:(0,t.jsx)(tK.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):(0,t.jsx)(tW.Circle,{className:"text-muted-foreground/30 h-4 w-4 shrink-0"})}function t2(e,t){if(!e)return 0;let n=e[t];return"number"==typeof n&&Number.isFinite(n)?n:0}function t3(e){if(!Number.isFinite(e)||e<0)return"";if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;if(n<60)return 0===r?`${n}m`:`${n}m ${r}s`;let i=Math.floor(n/60),s=n%60;return 0===s?`${i}h`:`${i}h ${s}m`}function t4(e){return!Number.isFinite(e)||e<=0?"$0":e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function t6(e){return!Number.isFinite(e)||e<=0?"0":e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}e.s(["StepTracker",()=>tX],399746);var t9=e.i(435e3),t7=e.i(248109);function t8({id:e,title:n,assistantMessageCount:r,status:i,condensed:s,details:o,children:a}){let l="in-progress"===i,[u,c]=(0,j.useState)(l);(0,j.useEffect)(()=>{l||c(!1)},[l]);let h=`${e}-content`,p=l?s:o??a??null;return(0,t.jsxs)("div",{className:(0,d.cn)("mx-3 my-2 shrink-0 overflow-hidden rounded-lg border shadow-sm","animate-in fade-in-0 slide-in-from-top-1 duration-200 ease-out",l?"border-fuchsia-500/40 bg-gradient-to-br from-fuchsia-500/5 via-purple-500/5 to-sky-500/5":"border-border/60 bg-card/40"),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>c(e=>!e),"aria-expanded":u,"aria-controls":h,className:(0,d.cn)("group flex min-h-12 w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left transition-colors","hover:bg-muted/50"),children:[(0,t.jsx)("span",{className:(0,d.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded-full",l?"bg-gradient-to-br from-fuchsia-500 via-purple-500 to-sky-500 text-white shadow-sm":"bg-emerald-500/15"),children:l?(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(t9.CheckCircle2,{className:"h-3 w-3 text-emerald-500"})}),(0,t.jsx)("span",{className:(0,d.cn)("min-w-0 flex-1 truncate text-[12px] font-medium",l?"text-fuchsia-700 dark:text-fuchsia-300":"text-foreground"),children:l?"Working on your request…":n}),r>0?(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-1 text-[10px]",children:[(0,t.jsx)(t7.MessageSquare,{className:"h-3 w-3"}),r]}):null,(0,t.jsx)(w.ChevronDown,{className:(0,d.cn)("text-muted-foreground h-3.5 w-3.5 shrink-0 transition-transform",u&&"rotate-180")})]}),u&&p?(0,t.jsx)("div",{id:h,className:(0,d.cn)("border-t px-3 py-2",l?"bg-background/60 border-fuchsia-500/20":"border-border/60 bg-background/40"),children:p}):null]})}function ne(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function nt(e){if(e instanceof Date)return e.getTime();if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=Number(e);if(Number.isFinite(t))return t;let n=new Date(e).getTime();return Number.isFinite(n)?n:0}return 0}function nn(e,t){return(0,j.useMemo)(()=>(function(e,t=!0){let n=e.filter(e=>!e.stepId);if(0===n.length)return{groups:[],currentTurn:null,hiddenMessageIds:[]};let r=[],i=null;for(let e of n)e.role===to.InteractiveMessageRole.user?(i={user:e,items:[e]},r.push(i)):i&&i.items.push(e);if(0===r.length)return{groups:[],currentTurn:null,hiddenMessageIds:[]};let s=(e,t)=>{let n=e.items[0],r=e.items[e.items.length-1],i=e.user.content??"";return{id:`turn-${e.user.id}`,title:function(e){let t=e.trim().replace(/\s+/g," ");if(0===t.length)return"Working on your request";let n=ne(t,120);return ne(`Working on: ${n}`,140)}(i),userMessagePreview:ne(i.trim().replace(/\s+/g," "),120),messageIds:e.items.map(e=>e.id),assistantMessageCount:e.items.filter(e=>e.role===to.InteractiveMessageRole.assistant).length,startedAt:nt(n.createdAt),endedAt:nt(r.createdAt),status:t}},o=r[r.length-1];if(t){let e=r.slice(0,-1).map(e=>s(e,"completed")),t=s(o,"in-progress"),n=[...e.flatMap(e=>e.messageIds),...t.messageIds];return{groups:e,currentTurn:t,hiddenMessageIds:n}}let a=r.map(e=>s(e,"completed")),l=a.flatMap(e=>e.messageIds);return{groups:a,currentTurn:null,hiddenMessageIds:l}})(e,t),[e,t])}function nr({group:e,allMessages:n,streaming:r}){let i=new Map;for(let e of n)i.set(e.id,e);if("in-progress"!==e.status)return(0,t.jsx)(t8,{id:e.id,title:e.title,status:"completed",assistantMessageCount:e.assistantMessageCount,children:(0,t.jsx)(ni,{messageIds:e.messageIds,byId:i})});let s=e.messageIds.find(e=>{let t=i.get(e);return t?.role===to.InteractiveMessageRole.user}),o=s?i.get(s):null,a=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[o?(0,t.jsxs)("div",{className:"text-foreground border-l-2 border-violet-500/50 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:"You"}),o.content]}):null,r?(0,t.jsx)(no,{streaming:r}):null]}),l=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(ni,{messageIds:e.messageIds,byId:i}),r?(0,t.jsx)(ns,{streaming:r}):null]});return(0,t.jsx)(t8,{id:e.id,title:e.title,status:"in-progress",assistantMessageCount:e.assistantMessageCount,condensed:a,details:l})}function ni({messageIds:e,byId:n}){return(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{let r=n.get(e);if(!r)return(0,t.jsx)("div",{className:"text-muted-foreground/50 text-[11px] italic",children:"…"},e);let i=r.role===to.InteractiveMessageRole.user;return(0,t.jsxs)("div",{className:i?"text-foreground border-l-2 border-violet-500/50 pl-2 text-[12px] whitespace-pre-wrap":"text-foreground/90 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:i?"You":"Assistant"}),r.content]},e)})})}function ns({streaming:e}){let n=e.text.trim().length>0,r=(e.statusLog??"").trim().length>0,i="booting"===e.sessionStatus;return n?(0,t.jsxs)("div",{className:"text-foreground/90 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:"Assistant"}),e.text,r?(0,t.jsxs)("div",{className:"text-muted-foreground mt-1 inline-flex items-center gap-1 text-[10px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),e.statusLog]}):null]}):r?(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),e.statusLog]}):e.awaiting||i?(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),i?"Agent is waking up…":"Thinking…"]}):null}function no({streaming:e}){let n,r=(e.statusLog??"").trim().length>0,i=e.text.trim().length>0,s="booting"===e.sessionStatus;if(r)n=e.statusLog??"Working…";else if(e.awaiting||s)n=s?"Agent is waking up…":"Thinking…";else{if(!i)return null;n="Working…"}return(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),n]})}e.s(["SingleTurnCard",()=>nr,"useTurnGroupsView",()=>nn],628164);let na=(0,e.i(903645).default)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);e.s(["Cloud",()=>na],941275)},113367,e=>{"use strict";var t=e.i(530090);e.s(["XCircle",()=>t.default])},928112,561068,e=>{"use strict";e.i(54101);var t=e.i(679606),n=e.i(152155);e.i(541001);var r=e.i(64780),i=e.i(819645),s=e.i(267669),o=e.i(418532),a=e.i(958481),l=e.i(43416),u=e.i(131777),c=e.i(915109),d=e.i(731151),h=e.i(684408),p=e.i(283237),f=e.i(41413),m=e.i(323217),g=e.i(461152),x=e.i(673138),b=e.i(399746),y=e.i(628164),v=e.i(962885),k=e.i(435e3),w=e.i(99105),S=e.i(941275),_=e.i(382569),C=e.i(83428),j=e.i(113367),E=e.i(317406);let T=["Starting GitHub repository creation","Starting deploy to ","Starting save & backup"];function I(e){if(0===e.length)return[];let t=[],n=[];for(let r of e)(function(e){return T.some(t=>e.startsWith(t))})(r.message)&&n.length>0&&(t.push(n),n=[]),n.push(r);return n.length>0&&t.push(n),t}let A={publish:E.OperationLogKind.GitRemoteCreate,deploy:E.OperationLogKind.CloudDeploy,sync:E.OperationLogKind.RepoSync},N={publish:{title:"Published to GitHub",inProgressTitle:"Publishing to GitHub…",icon:_.Github,idleAccent:"bg-sky-500/15 text-sky-500",liveGradient:"border-sky-500/40 bg-gradient-to-br from-sky-500/5 via-sky-500/5 to-cyan-500/5",liveChip:"bg-gradient-to-br from-sky-500 via-blue-500 to-cyan-500 text-white shadow-sm",liveText:"text-sky-700 dark:text-sky-300"},deploy:{title:"Deployed to cloud",inProgressTitle:"Deploying to cloud…",icon:S.Cloud,idleAccent:"bg-fuchsia-500/15 text-fuchsia-500",liveGradient:"border-fuchsia-500/40 bg-gradient-to-br from-fuchsia-500/5 via-purple-500/5 to-sky-500/5",liveChip:"bg-gradient-to-br from-fuchsia-500 via-purple-500 to-sky-500 text-white shadow-sm",liveText:"text-fuchsia-700 dark:text-fuchsia-300"},sync:{title:"Saved & pushed to GitHub",inProgressTitle:"Saving & pushing to GitHub…",icon:l.RefreshCw,idleAccent:"bg-emerald-500/15 text-emerald-500",liveGradient:"border-emerald-500/40 bg-gradient-to-br from-emerald-500/5 via-emerald-500/5 to-teal-500/5",liveChip:"bg-gradient-to-br from-emerald-500 via-teal-500 to-cyan-500 text-white shadow-sm",liveText:"text-emerald-700 dark:text-emerald-300"}};async function M(e,t){let n=A[t],r=await fetch(`/api/operations/${encodeURIComponent(n)}/${encodeURIComponent(e)}/logs`);return r.ok?await r.json():{entries:[]}}function R(e){if(0===e.length)return"empty";let t=e[e.length-1],n=new Date(t.createdAt).getTime();if(Date.now()-n<1e4)return"in-progress";switch(t.level){case"Error":return"failed";case"Warn":return"warn";default:return"success"}}function P(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function D(e,t){let{data:r}=(0,v.useQuery)({queryKey:["operation-logs",e??"",t],queryFn:()=>e?M(e,t):Promise.resolve({entries:[]}),enabled:!!e,refetchInterval:e=>{let t=e.state.data?.entries??[];if(0===t.length)return 2500;let n=I(t);return"in-progress"===R(n[n.length-1]??[])?1500:2500},staleTime:0});return(0,n.useMemo)(()=>I(r?.entries??[]).map((e,n)=>{let r=e[0];return{id:r?.id??`${t}-${n}`,kind:t,startedAt:r?new Date(r.createdAt).getTime():0,entries:e}}),[r,t])}function O({applicationId:e,kind:r,entries:i,runIndex:s}){let[o,a]=(0,n.useState)(!1),l=R(i),c=N[r],d=c.icon,h="in-progress"===l,p=`op-${r}-${e}-${s}`;return(0,t.jsxs)("div",{className:(0,u.cn)("mx-3 shrink-0 overflow-hidden","animate-in fade-in-0 duration-150 ease-out"),"data-testid":`operation-bubble-${r}`,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":o,"aria-controls":p,className:(0,u.cn)("group flex w-full cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors","hover:bg-muted/40"),children:[(0,t.jsx)("span",{className:(0,u.cn)("flex h-4 w-4 shrink-0 items-center justify-center",h?c.liveText:"text-muted-foreground"),children:h?(0,t.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(d,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("span",{className:(0,u.cn)("truncate text-[11px] font-medium",h?c.liveText:"text-foreground/90"),children:h?c.inProgressTitle:c.title}),(0,t.jsxs)("span",{className:"text-muted-foreground shrink-0 text-[10px]",children:["· ",i.length," event",1===i.length?"":"s"," ·"," ",P(i[0].createdAt)]}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)(F,{status:l}),(0,t.jsx)(w.ChevronDown,{className:(0,u.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform",o&&"rotate-180")})]}),o?(0,t.jsx)("div",{id:p,className:"border-border/40 bg-background/30 mt-1 rounded-md border",children:(0,t.jsx)("ol",{className:"flex max-h-[28rem] flex-col gap-1 overflow-y-auto px-3 py-2.5",children:i.map(e=>(0,t.jsxs)("li",{className:"flex items-start gap-2 text-[11px] leading-relaxed",children:[(0,t.jsx)("span",{className:"text-muted-foreground/80 shrink-0 font-mono text-[10px]",children:P(e.createdAt)}),(0,t.jsx)(L,{level:e.level}),(0,t.jsxs)("span",{className:"text-foreground/90 min-w-0 flex-1 break-words whitespace-pre-wrap",children:[e.message,e.detail?(0,t.jsx)("span",{className:"text-muted-foreground/70 mt-0.5 block font-mono text-[10px] whitespace-pre-wrap",children:e.detail}):null]})]},e.id))})}):null]})}function F({status:e}){return"in-progress"===e?null:"success"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-emerald-500",children:[(0,t.jsx)(k.CheckCircle2,{className:"h-3 w-3"})," done"]}):"warn"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-amber-500",children:[(0,t.jsx)(a.AlertTriangle,{className:"h-3 w-3"})," warnings"]}):"failed"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-rose-500",children:[(0,t.jsx)(j.XCircle,{className:"h-3 w-3"})," failed"]}):null}function L({level:e}){return(0,t.jsx)("span",{className:(0,u.cn)("mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full","Error"===e?"bg-rose-500":"Warn"===e?"bg-amber-500":"Debug"===e?"bg-muted-foreground/50":"bg-emerald-500")})}let B="scaffold";function z({featureId:e,applicationId:r,worktreePath:s,initialAgent:o,initialModel:a,initialChatState:l,hideHeader:u,onAllStepsComplete:v,workflowPlaceholder:k,onResumeWorkflow:w,scaffoldingState:S,applicationError:_}){let[C,j]=(0,n.useState)(o),[E,T]=(0,n.useState)(a);(0,n.useEffect)(()=>{C&&E||(0,p.getDefaultAgentAndModel)().then(e=>{j(t=>t??e.agentType),T(t=>t??e.model)})},[]);let[I,A]=(0,n.useState)(!1),N=(0,d.useAttachments)(),M=!!r,R=(0,n.useCallback)(e=>(0,h.composeUserInput)(e,N.completedAttachments.map(e=>({path:e.path,name:e.name,notes:e.notes}))),[N.completedAttachments]),{runtime:P,status:F,clearChat:L,sessionInfo:z,isChatLoading:H,pendingInteraction:V,respondToInteraction:W,stepProgress:K,rawMessages:G,streamingState:J}=(0,m.useChatRuntime)(e,s,{contentTransform:R,onMessageSent:N.clearAttachments,model:E,agentType:C,debugMode:I,initialChatState:l,pinInitialRequest:(k?.length??0)>0,hideAllMessages:M,suppressStreamingIndicator:M}),Q=!!(S?.status==="running"||K.hasPlan&&!K.allDone),Y=(0,y.useTurnGroupsView)(G,F.isRunning&&!Q),X=(()=>{if(Q)return{groups:[],currentTurn:null,hiddenMessageIds:[]};if(!S&&!K.hasPlan)return Y;let e=[...Y.groups];Y.currentTurn&&e.push(Y.currentTurn);let t=e.slice(1),n=null!==Y.currentTurn&&t.length>0?t[t.length-1]:null;return{groups:n?t.slice(0,-1):t,currentTurn:n,hiddenMessageIds:Y.hiddenMessageIds}})(),Z=D(r,"publish"),ee=D(r,"deploy"),et=D(r,"sync"),en=(()=>{let e=[];for(let t of X.groups)e.push({kind:"turn",id:t.id,startedAt:t.startedAt,turn:t});if(X.currentTurn){let t=X.currentTurn;e.push({kind:"turn",id:t.id,startedAt:t.startedAt,turn:t})}for(let t of Z)e.push({kind:"operation",id:`pub-${t.id}`,startedAt:t.startedAt,run:t});for(let t of ee)e.push({kind:"operation",id:`dep-${t.id}`,startedAt:t.startedAt,run:t});for(let t of et)e.push({kind:"operation",id:`syn-${t.id}`,startedAt:t.startedAt,run:t});return e.sort((e,t)=>e.startedAt-t.startedAt),e})(),er=(0,n.useRef)(!1),ei=(0,n.useRef)(v);ei.current=v,(0,n.useEffect)(()=>{K.allDone&&!er.current&&(er.current=!0,ei.current?.())},[K.allDone]);let es=(0,n.useCallback)(async e=>{if(!e.startsWith("placeholder-"))try{let t=await fetch(`/api/workflow-steps/${encodeURIComponent(e)}/force-stop`,{method:"POST"});t.ok||409===t.status||console.warn("[force-stop-step] request failed",t.status)}catch(e){console.warn("[force-stop-step] request error",e)}},[]),eo=(0,n.useCallback)(async()=>{try{let t=await fetch("/api/dialog/pick-files");if(!t.ok)return;let n=await t.json();if(!n.paths?.length)return;for(let t of n.paths){let n=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,sessionId:`chat-${e}`})});if(!n.ok)continue;let r=await n.json();N.addAttachment(r)}}catch{}},[e,N.addAttachment]),ea=K.hasPlan?K.steps:(k??[]).filter(e=>e.stepKey!==B).map(e=>({definition:{id:`placeholder-${e.stepKey}`,stepKey:e.stepKey,title:e.title,description:e.description},status:"pending",metadata:null,toolMessages:[],startedAt:null,finishedAt:null})),el=(0,n.useRef)(null);K.hasPlan&&null==el.current&&(el.current=Date.now());let eu=S?{definition:{id:`placeholder-${B}`,stepKey:B,title:"Preparing your project",description:"Scaffolding the project tree and installing dependencies"},status:K.hasPlan?"done":S.status,metadata:S.error?{error:S.error}:null,toolMessages:[],startedAt:S.startedAt,finishedAt:S.finishedAt??(K.hasPlan?el.current:null)}:null,ec=eu?[eu,...ea]:ea,ed=ec.length>0,eh=K.hasPlan&&K.steps.some(e=>"running"===e.status),ep=(0,t.jsx)(g.ChatComposer,{disabled:eh,attachments:N.attachments,isDragOver:N.isDragOver,uploadError:N.uploadError,onDragEnter:N.handleDragEnter,onDragLeave:N.handleDragLeave,onDragOver:N.handleDragOver,onDrop:N.handleDrop,onPaste:N.handlePaste,onRemoveAttachment:N.removeAttachment,onNotesChange:N.updateNotes,onPickFiles:eo,agentPicker:(0,t.jsx)(f.AgentModelPicker,{initialAgentType:C??"",initialModel:E??"",mode:"override",onAgentModelChange:(e,t)=>{j(e),T(t)},className:"w-55",popoverSide:"top"})});return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[u?null:(0,t.jsx)(q,{sessionInfo:z,isAgentActive:F.isRunning,onClear:L,debugMode:I,onDebugToggle:void 0}),(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col dark:bg-neutral-900/40",children:H?(0,t.jsx)(U,{}):(0,t.jsx)(i.AssistantRuntimeProvider,{runtime:P,children:(0,t.jsx)(c.Thread,{composer:ep,hideEmpty:ed,hideMessages:M,beforeMessages:(0,t.jsxs)(t.Fragment,{children:[_?(0,t.jsx)($,{state:_,onRetry:w}):null,ed?(0,t.jsx)(b.StepTracker,{steps:ec,collapsedSummary:!0===K.hasPlan&&!0===K.allDone,activeStepId:K.activeStepId,liveStatus:K.liveStatus,onRetry:w,onForceStop:es}):null,M?en.map((e,n)=>"turn"===e.kind&&e.turn?(0,t.jsx)(y.SingleTurnCard,{group:e.turn,allMessages:G,streaming:"in-progress"===e.turn.status?J:void 0},e.id):"operation"===e.kind&&e.run&&r?(0,t.jsx)(O,{applicationId:r,kind:e.run.kind,entries:e.run.entries,runIndex:n},e.id):null):null]}),afterMessages:V?(0,t.jsx)(x.InteractionBubble,{interaction:V,onSubmit:W}):null})})})]})}function $({state:e,onRetry:r}){let[i,s]=(0,n.useState)(!1),o=(0,n.useCallback)(()=>{if(r&&!i){s(!0);try{r()}finally{setTimeout(()=>s(!1),4e3)}}},[r,i]);return(0,t.jsx)("div",{className:(0,u.cn)("animate-in fade-in-0 slide-in-from-top-1 mx-3 my-3 shrink-0 overflow-hidden rounded-lg border shadow-sm duration-200 ease-out","border-red-500/40 bg-red-500/5 dark:bg-red-500/10"),role:"alert",children:(0,t.jsxs)("div",{className:"flex items-start gap-3 px-3 py-3",children:[(0,t.jsx)("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-red-500/15",children:(0,t.jsx)(a.AlertTriangle,{className:"h-3.5 w-3.5 text-red-500"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-[13px] font-semibold text-red-700 dark:text-red-300",children:e.kind}),(0,t.jsx)("div",{className:"text-foreground/80 mt-0.5 text-[12px] leading-relaxed",children:e.message}),e.retryable&&r?(0,t.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:o,disabled:i,className:(0,u.cn)("inline-flex h-7 items-center gap-1.5 rounded-md bg-red-500 px-3 text-[11px] font-semibold text-white transition-opacity",i?"cursor-not-allowed opacity-60":"cursor-pointer hover:opacity-90"),children:[(0,t.jsx)(l.RefreshCw,{className:(0,u.cn)("h-3 w-3",i&&"animate-spin")}),i?"Retrying…":"Try again"]}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Re-runs the last failed step"})]}):null]})]})})}function U(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-3 p-4 pt-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-48 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-72 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-36 animate-pulse rounded-lg"})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-32 animate-pulse rounded-lg"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-56 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-64 animate-pulse rounded-lg"})]})]})]})}function q({sessionInfo:e,isAgentActive:n,onClear:i,debugMode:a,onDebugToggle:l}){let{t:u}=(0,r.useTranslation)("web");return(0,t.jsxs)("div",{className:"flex h-8 shrink-0 items-center border-b px-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:e?(0,t.jsxs)(t.Fragment,{children:[n?(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):(0,t.jsx)(o.Cpu,{className:"text-muted-foreground/40 h-3 w-3 shrink-0"}),(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-[10px]",children:[e.model??"agent",e.sessionId?` \xb7 ${e.sessionId.slice(0,8)}`:""]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-[11px]",children:u("chat.noSession")})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ps-2",children:[l?(0,t.jsxs)("label",{className:"text-muted-foreground/60 flex cursor-pointer items-center gap-1 text-[10px]",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>l(e.target.checked),className:"h-3 w-3 cursor-pointer rounded"}),"Debug"]}):null,(0,t.jsxs)(H,{onClick:()=>{i()},title:u("chat.clearChatHistory"),children:[(0,t.jsx)(s.Trash2,{className:"h-2.5 w-2.5"}),(0,t.jsx)("span",{children:u("chat.clear")})]})]})]})}function H({children:e,onClick:n,title:r,variant:i}){return(0,t.jsx)("button",{type:"button",onClick:n,title:r,className:(0,u.cn)("inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors","danger"===i?"text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:e})}e.s(["APPLICATION_CREATION_PLACEHOLDER_STEPS",0,[{stepKey:"components",title:"Building the pieces",description:"Designing and creating polished reusable parts"},{stepKey:"wire",title:"Connecting everything",description:"Wiring navigation and forms"},{stepKey:"verify",title:"Double-checking",description:"Making sure it runs cleanly"},{stepKey:"commit",title:"Saving a snapshot",description:"Committing the initial build"},{stepKey:"report",title:"Your app is ready",description:"Summary of what was built"}],"SCAFFOLD_STEP_KEY",0,B],561068),e.s(["ChatTab",()=>z],928112)}]);
|
|
5
|
+
${n}`}H.displayName="IconButton",e.s(["Thread",()=>T],915109),e.s(["composeUserInput",()=>K],684408);var G=e.i(979533);class J{_contextProvider=new G.CompositeContextProvider;registerModelContextProvider(e){return this._contextProvider.registerModelContextProvider(e)}getModelContextProvider(){return this._contextProvider}}let Q=Object.freeze([]),Y="DEFAULT_THREAD_ID",X=Object.freeze([Y]),Z=Object.freeze({id:Y,remoteId:void 0,externalId:void 0,status:"regular"}),ee=Promise.resolve(),et=Object.freeze({[Y]:Z});class en{adapter;threadFactory;_mainThreadId=Y;_threads=X;_archivedThreads=Q;_threadData=et;get isLoading(){return this.adapter.isLoading??!1}get newThreadId(){}get threadIds(){return this._threads}get archivedThreadIds(){return this._archivedThreads}get threadItems(){return this._threadData}getLoadThreadsPromise(){return ee}_mainThread;get mainThreadId(){return this._mainThreadId}constructor(e={},t){this.adapter=e,this.threadFactory=t,this._mainThread=this.threadFactory(),this.__internal_setAdapter(e,!0)}getMainThreadRuntimeCore(){return this._mainThread}getThreadRuntimeCore(){throw Error("Method not implemented.")}getItemById(e){for(let t of this.adapter.threads??[])if(t.id===e)return t;for(let t of this.adapter.archivedThreads??[])if(t.id===e)return t;if(e===Y)return Z}__internal_setAdapter(e,t=!1){let n=this.adapter;this.adapter=e;let r=e.threadId??Y,i=e.threads??Q,s=e.archivedThreads??Q,o=n.threadId??Y,a=n.threads??Q,l=n.archivedThreads??Q;(t||o!==r||a!==i||l!==s)&&(this._threadData={...et,...Object.fromEntries(e.threads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"regular"}])??[]),...Object.fromEntries(e.archivedThreads?.map(e=>[e.id,{...e,remoteId:e.remoteId,externalId:e.externalId,status:"archived"}])??[])},a!==i&&(this._threads=this.adapter.threads?.map(e=>e.id)??Q),l!==s&&(this._archivedThreads=this.adapter.archivedThreads?.map(e=>e.id)??Q),o!==r&&(this._mainThreadId=r,this._mainThread=this.threadFactory()),this._notifySubscribers())}async switchToThread(e){if(this._mainThreadId===e)return;let t=this.adapter.onSwitchToThread;if(!t)throw Error("External store adapter does not support switching to thread");await t(e)}async switchToNewThread(){let e=this.adapter.onSwitchToNewThread;if(!e)throw Error("External store adapter does not support switching to new thread");await e()}async rename(e,t){let n=this.adapter.onRename;if(!n)throw Error("External store adapter does not support renaming");await n(e,t)}async detach(){}async archive(e){let t=this.adapter.onArchive;if(!t)throw Error("External store adapter does not support archiving");await t(e)}async unarchive(e){let t=this.adapter.onUnarchive;if(!t)throw Error("External store adapter does not support unarchiving");await t(e)}async delete(e){let t=this.adapter.onDelete;if(!t)throw Error("External store adapter does not support deleting");await t(e)}initialize(e){return Promise.resolve({remoteId:e,externalId:void 0})}generateTitle(){throw Error("Method not implemented.")}_subscriptions=new Set;subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}_notifySubscribers(){for(let e of this._subscriptions)e()}}let er=Symbol("innerMessage"),ei=Symbol("innerMessages"),es=[],eo=e=>{let t="messages"in e?e.messages:e,n=t[ei]||t[er];return n?Array.isArray(n)?n:(t[ei]=[n],t[ei]):es};class ea{cache=new WeakMap;convertMessages(e,t){return e.map((e,n)=>{let r=t(this.cache.get(e),e,n);return this.cache.set(e,r),r})}}let el=Symbol("autoStatus"),eu=Object.freeze(Object.assign({type:"running"},{[el]:!0})),ec=Object.freeze(Object.assign({type:"complete",reason:"unknown"},{[el]:!0})),ed=Object.freeze(Object.assign({type:"requires-action",reason:"tool-calls"},{[el]:!0})),eh=Object.freeze(Object.assign({type:"requires-action",reason:"interrupt"},{[el]:!0})),ep=(e,t,n,r,i)=>e&&i?Object.assign({type:"incomplete",reason:"error",error:i},{[el]:!0}):e&&t?eu:n?eh:r?ed:ec;var ef=e.i(878598);let em=Symbol("aui.parse-partial-json-object.meta"),eg=((e,t=21)=>(n=t)=>{let r="",i=0|n;for(;i--;)r+=e[Math.random()*e.length|0];return r})("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7),ex=()=>`__optimistic__${eg()}`,eb=(e,t)=>{if(e.startsWith("data-"))return{type:"data",name:e.substring(5),data:t}},ey=(e,t,n)=>{let{role:r,id:i,createdAt:s,attachments:o,status:a,metadata:l}=e,u={id:i??t,createdAt:s??new Date},c="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;if("user"!==r&&o?.length)throw Error("attachments are only supported for user messages");if("assistant"!==r&&a)throw Error("status is only supported for assistant messages");if("assistant"!==r&&l?.steps)throw Error("metadata.steps is only supported for assistant messages");switch(r){case"assistant":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"reasoning":if(0===e.text.trim().length)return null;return e;case"file":case"source":case"data":return e;case"image":return(({image:e,...t})=>e.match(/^data:image\/(png|jpeg|jpg|gif|webp);base64,(.*)$/)?{...t,image:e}:(console.warn("Invalid image data format detected"),null))(e);case"tool-call":{let{parentId:t,messages:n,...r}=e,i={...r,toolCallId:e.toolCallId??`tool-${eg()}`,...void 0!==t&&{parentId:t},...void 0!==n&&{messages:n}};if(e.args)return{...i,args:e.args,argsText:e.argsText??JSON.stringify(e.args)};return{...i,args:(e=>{if(0===e.length)return{[em]:{state:"partial",partialPath:[]}};try{let t=ef.default.parse(e);if("object"!=typeof t||null===t)throw Error("argsText is expected to be an object");return t[em]={state:"complete",partialPath:[]},t}catch{try{let[t,n]=function(e){let t,n=["ROOT"],r=-1,i=null,s=[];function o(){void 0!==t&&(s.push(JSON.parse(`"${t}"`)),t=void 0)}function a(e,t,s){switch(e){case'"':r=t,n.pop(),n.push(s),n.push("INSIDE_STRING"),o();break;case"f":case"t":case"n":r=t,i=t,n.pop(),n.push(s),n.push("INSIDE_LITERAL");break;case"-":n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=t,n.pop(),n.push(s),n.push("INSIDE_NUMBER"),o();break;case"{":r=t,n.pop(),n.push(s),n.push("INSIDE_OBJECT_START"),o();break;case"[":r=t,n.pop(),n.push(s),n.push("INSIDE_ARRAY_START"),o()}}function l(e,i){switch(e){case",":n.pop(),n.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":r=i,n.pop(),t=s.pop()}}function u(e,i){switch(e){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=i,n.pop(),t=s.pop()}}for(let o=0;o<e.length;o++){let c=e[o];switch(n[n.length-1]){case"ROOT":a(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_KEY"),t="";break;case"}":r=o,n.pop(),t=s.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":'"'===c&&(n.pop(),n.push("INSIDE_OBJECT_KEY"),t="");break;case"INSIDE_OBJECT_KEY":switch(c){case'"':n.pop(),n.push("INSIDE_OBJECT_AFTER_KEY");break;case"\\":n.push("INSIDE_STRING_ESCAPE"),t+=c;break;default:t+=c}break;case"INSIDE_OBJECT_AFTER_KEY":":"===c&&(n.pop(),n.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":a(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":l(c,o);break;case"INSIDE_STRING":switch(c){case'"':n.pop(),r=o,t=s.pop();break;case"\\":n.push("INSIDE_STRING_ESCAPE");break;default:r=o}break;case"INSIDE_ARRAY_START":"]"===c?(r=o,n.pop(),t=s.pop()):(r=o,t="0",a(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":n.pop(),n.push("INSIDE_ARRAY_AFTER_COMMA"),t=(Number(t)+1).toString();break;case"]":r=o,n.pop(),t=s.pop();break;default:r=o}break;case"INSIDE_ARRAY_AFTER_COMMA":a(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":n.pop(),"INSIDE_STRING"===n[n.length-1]?r=o:"INSIDE_OBJECT_KEY"===n[n.length-1]&&(t+=c);break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r=o;break;case"e":case"E":case"-":case".":break;case",":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"}":n.pop(),t=s.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]&&l(c,o);break;case"]":n.pop(),t=s.pop(),"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o);break;default:n.pop(),t=s.pop()}break;case"INSIDE_LITERAL":{let t=e.substring(i,o+1);"false".startsWith(t)||"true".startsWith(t)||"null".startsWith(t)?r=o:(n.pop(),"INSIDE_OBJECT_AFTER_VALUE"===n[n.length-1]?l(c,o):"INSIDE_ARRAY_AFTER_VALUE"===n[n.length-1]&&u(c,o))}}}let c=e.slice(0,r+1);for(let t=n.length-1;t>=0;t--)switch(n[t]){case"INSIDE_STRING":c+='"';break;case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":c+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":c+="]";break;case"INSIDE_LITERAL":{let t=e.substring(i,e.length);"true".startsWith(t)?c+="true".slice(t.length):"false".startsWith(t)?c+="false".slice(t.length):"null".startsWith(t)&&(c+="null".slice(t.length))}}return[c,s]}(e),r=ef.default.parse(t);if("object"!=typeof r||null===r)throw Error("argsText is expected to be an object");return r[em]={state:"partial",partialPath:n},r}catch{return}}})(e.argsText??"")??{},argsText:e.argsText??""}}default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported assistant message part type: ${t}`)}}}).filter(e=>!!e),status:a??n,metadata:{unstable_state:l?.unstable_state??null,unstable_annotations:l?.unstable_annotations??[],unstable_data:l?.unstable_data??[],custom:l?.custom??{},steps:l?.steps??[],...l?.timing&&{timing:l.timing},...l?.submittedFeedback&&{submittedFeedback:l.submittedFeedback}}};case"user":return{...u,role:r,content:c.map(e=>{let t=e.type;switch(t){case"text":case"image":case"audio":case"file":case"data":return e;default:{let n=eb(t,e.data);if(n)return n;throw Error(`Unsupported user message part type: ${t}`)}}}),attachments:(o??[]).map(e=>({...e,content:e.content.map(e=>eb(e.type,e.data)??e)})),metadata:{custom:l?.custom??{}}};case"system":if(1!==c.length||"text"!==c[0].type)throw Error("System messages must have exactly one text message part.");return{...u,role:r,content:c,metadata:{custom:l?.custom??{}}};default:throw Error(`Unknown message role: ${r}`)}},ev=e=>e.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n\n"),ek=e=>{let t=e.map(e=>ey(e,eg(),ep(!1,!1,!1,!1,void 0)));return{messages:t.map((e,n)=>({parentId:n>0?t[n-1].id:null,message:e}))}},ew=e=>e.next?ew(e.next):"current"in e?e:null;class eS{func;_value=null;constructor(e){this.func=e}get value(){return null===this._value&&(this._value=this.func()),this._value}dirty(){this._value=null}}class e_{messages=new Map;head=null;root={children:[],next:null};updateLevels(e,t){for(let n of(e.level=t,e.children)){let e=this.messages.get(n);e&&this.updateLevels(e,t+1)}}performOp(e,t,n){let r=t.prev??this.root,i=e??this.root;if("relink"!==n||r!==i){if("link"!==n&&(r.children=r.children.filter(e=>e!==t.current.id),r.next===t)){let e=r.children.at(-1),t=e?this.messages.get(e):null;if(void 0===t)throw Error("MessageRepository(performOp/cut): Fallback sibling message not found. This is likely an internal bug in assistant-ui.");r.next=t}if("cut"!==n){for(let n=e;n;n=n.prev)if(n.current.id===t.current.id)throw Error("MessageRepository(performOp/link): A message with the same id already exists in the parent tree. This error occurs if the same message id is found multiple times. This is likely an internal bug in assistant-ui.");i.children=[...i.children,t.current.id],(ew(t)===this.head||null===i.next)&&(i.next=t),t.prev=e;let n=e?e.level+1:0;this.updateLevels(t,n)}}}_messages=new eS(()=>{let e=Array((this.head?.level??-1)+1);for(let t=this.head;t;t=t.prev)e[t.level]=t.current;return e});get headId(){return this.head?.current.id??null}getMessages(e){if(void 0===e||e===this.head?.current.id)return this._messages.value;let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getMessages): Head message not found. This is likely an internal bug in assistant-ui.");let n=Array(t.level+1);for(let e=t;e;e=e.prev)n[e.level]=e.current;return n}addOrUpdateMessage(e,t){let n=this.messages.get(t.id),r=e?this.messages.get(e):null;if(void 0===r)throw Error("MessageRepository(addOrUpdateMessage): Parent message not found. This is likely an internal bug in assistant-ui.");if(n){n.current=t,this.performOp(r,n,"relink"),this._messages.dirty();return}let i={prev:r,current:t,next:null,children:[],level:r?r.level+1:0};this.messages.set(t.id,i),this.performOp(r,i,"link"),this.head===r&&(this.head=i),this._messages.dirty()}getMessage(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(updateMessage): Message not found. This is likely an internal bug in assistant-ui.");return{parentId:t.prev?.current.id??null,message:t.current,index:t.level}}appendOptimisticMessage(e,t){let n;do n=ex();while(this.messages.has(n))return this.addOrUpdateMessage(e,ey(t,n,{type:"running"})),n}deleteMessage(e,t){let n=this.messages.get(e);if(!n)throw Error("MessageRepository(deleteMessage): Message not found. This is likely an internal bug in assistant-ui.");let r=void 0===t?n.prev:null===t?null:this.messages.get(t);if(void 0===r)throw Error("MessageRepository(deleteMessage): Replacement not found. This is likely an internal bug in assistant-ui.");for(let e of n.children){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(deleteMessage): Child message not found. This is likely an internal bug in assistant-ui.");this.performOp(r,t,"relink")}this.performOp(null,n,"cut"),this.messages.delete(e),this.head===n&&(this.head=ew(r??this.root)),this._messages.dirty()}getBranches(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(getBranches): Message not found. This is likely an internal bug in assistant-ui.");let{children:n}=t.prev??this.root;return n}switchToBranch(e){let t=this.messages.get(e);if(!t)throw Error("MessageRepository(switchToBranch): Branch not found. This is likely an internal bug in assistant-ui.");(t.prev??this.root).next=t,this.head=ew(t),this._messages.dirty()}resetHead(e){if(null===e)return void this.clear();let t=this.messages.get(e);if(!t)throw Error("MessageRepository(resetHead): Branch not found. This is likely an internal bug in assistant-ui.");if(t.children.length>0){let e=t=>{for(let n of t.children){let t=this.messages.get(n);t&&(e(t),this.messages.delete(n))}};e(t),t.children=[],t.next=null}this.head=t;for(let e=t;e;e=e.prev)e.prev?e.prev.next=e:this.root.next=e;this._messages.dirty()}clear(){this.messages.clear(),this.head=null,this.root={children:[],next:null},this._messages.dirty()}export(){let e=[];for(let[,t]of this.messages)e.push({message:t.current,parentId:t.prev?.current.id??null});return{headId:this.head?.current.id??null,messages:e}}import({headId:e,messages:t}){for(let{message:e,parentId:n}of t)this.addOrUpdateMessage(n,e);this.resetHead(e??t.at(-1)?.message.id??null)}}let eC=Symbol("skip-update");class ej{_subscribers=new Set;subscribe(e){return this._subscribers.add(e),()=>this._subscribers.delete(e)}waitForUpdate(){return new Promise(e=>{let t=this.subscribe(()=>{t(),e()})})}_notifySubscribers(){let e=[];for(let t of this._subscribers)try{t()}catch(t){e.push(t)}if(e.length>0)if(1===e.length)throw e[0];else{for(let t of e)console.error(t);throw AggregateError(e)}}}class eE{_subscriptions=new Set;_connection;get isConnected(){return!!this._connection}notifySubscribers(){for(let e of this._subscriptions)e()}_updateConnection(){this._subscriptions.size>0?this._connection||(this._connection=this._connect()):(this._connection?.(),this._connection=void 0)}subscribe(e){return this._subscriptions.add(e),this._updateConnection(),()=>{this._subscriptions.delete(e),this._updateConnection()}}}class eT extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e;const t=e.getState();if(t===eC)throw Error("Entry not available in the store");this._previousState=t}_previousState;getState=()=>(this.isConnected||this._syncState(),this._previousState);_syncState(){let e=this.binding.getState();return!(e===eC||function(e,t){if(void 0===e&&void 0===t)return!0;if(void 0===e||void 0===t)return!1;for(let n of Object.keys(e))if(!Object.is(e[n],t[n]))return!1;return!0}(e,this._previousState))&&(this._previousState=e,!0)}_connect(){let e=()=>{this._syncState()&&this.notifySubscribers()};return this.binding.subscribe(e)}}class eI extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}_previousStateDirty=!0;_previousState;getState=()=>{if(!this.isConnected||this._previousStateDirty){let e=this.binding.getState();e!==eC&&(this._previousState=e),this._previousStateDirty=!1}if(void 0===this._previousState)throw Error("Entry not available in the store");return this._previousState};_connect(){let e=()=>{this._previousStateDirty=!0,this.notifySubscribers()};return this.binding.subscribe(e)}}class eA extends eE{binding;get path(){return this.binding.path}constructor(e){super(),this.binding=e}getState(){return this.binding.getState()}outerSubscribe(e){return this.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.binding.getState(),n=t?.subscribe(e),r=()=>{let r=this.binding.getState();r!==t&&(t=r,n?.(),n=r?.subscribe(e),e())},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eN extends eE{config;constructor(e){super(),this.config=e}getState(){return this.config.binding.getState()}outerSubscribe(e){return this.config.binding.subscribe(e)}_connect(){let e=()=>{this.notifySubscribers()},t=this.config.binding.getState(),n=t?.unstable_on(this.config.event,e),r=()=>{let r=this.config.binding.getState();r!==t&&(t=r,n?.(),n=r?.unstable_on(this.config.event,e))},i=this.outerSubscribe(r);return()=>{i?.(),n?.()}}}class eM extends ej{isEditing=!0;get attachmentAccept(){return this.getAttachmentAdapter()?.accept??"*"}_attachments=[];get attachments(){return this._attachments}setAttachments(e){this._attachments=e,this._notifySubscribers()}get isEmpty(){return!this.text.trim()&&!this.attachments.length}_text="";get text(){return this._text}_role="user";get role(){return this._role}_runConfig={};get runConfig(){return this._runConfig}_quote=void 0;get quote(){return this._quote}setQuote(e){this._quote!==e&&(this._quote=e,this._notifySubscribers())}setText(e){if(this._text!==e){if(this._text=e,this._dictation){this._dictationBaseText=e,this._currentInterimText="";let{status:t,inputDisabled:n}=this._dictation;this._dictation=n?{status:t,inputDisabled:n}:{status:t}}this._notifySubscribers()}}setRole(e){this._role!==e&&(this._role=e,this._notifySubscribers())}setRunConfig(e){this._runConfig!==e&&(this._runConfig=e,this._notifySubscribers())}_emptyTextAndAttachments(){this._attachments=[],this._text="",this._notifySubscribers()}async _onClearAttachments(){let e=this.getAttachmentAdapter();if(e){let t=this._attachments.filter(e=>"complete"!==e.status.type);await Promise.all(t.map(t=>e.remove(t)))}}async reset(){if(0===this._attachments.length&&""===this._text&&"user"===this._role&&0===Object.keys(this._runConfig).length&&void 0===this._quote)return;this._role="user",this._runConfig={},this._quote=void 0;let e=this._onClearAttachments();this._emptyTextAndAttachments(),await e}async clearAttachments(){let e=this._onClearAttachments();this.setAttachments([]),await e}async send(){if(this.isEmpty)return;this._dictationSession&&(this._dictationSession.cancel(),this._cleanupDictation());let e=this.getAttachmentAdapter(),t=this.attachments.length>0?Promise.all(this.attachments.map(async t=>{if("complete"===t.status.type)return t;if(!e)throw Error("Attachments are not supported");return await e.send(t)})):[],n=this.text,r=this._quote;this._quote=void 0,this._emptyTextAndAttachments();let i={createdAt:new Date,role:this.role,content:n?[{type:"text",text:n}]:[],attachments:await t,runConfig:this.runConfig,metadata:{custom:{...r?{quote:r}:{}}}};this.handleSend(i),this._notifyEventSubscribers("send")}cancel(){this.handleCancel()}async addAttachment(e){if(!(e instanceof File)){let t={id:e.id??eg(),type:e.type??"document",name:e.name,contentType:e.contentType,content:e.content,status:{type:"complete"}};this._attachments=[...this._attachments,t],this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers();return}let t=this.getAttachmentAdapter();if(!t)throw Error("Attachments are not supported");let n=e=>{let t=this._attachments.findIndex(t=>t.id===e.id);-1!==t?this._attachments=[...this._attachments.slice(0,t),e,...this._attachments.slice(t+1)]:this._attachments=[...this._attachments,e],this._notifySubscribers()},r=t.add({file:e});if(Symbol.asyncIterator in r)for await(let e of r)n(e);else n(await r);this._notifyEventSubscribers("attachmentAdd"),this._notifySubscribers()}async removeAttachment(e){let t=this._attachments.findIndex(t=>t.id===e);if(-1===t)throw Error("Attachment not found");let n=this._attachments[t];if("complete"!==n.status.type){let e=this.getAttachmentAdapter();if(!e)throw Error("Attachments are not supported");await e.remove(n)}this._attachments=this._attachments.filter(t=>t.id!==e),this._notifySubscribers()}_dictation;_dictationSession;_dictationUnsubscribes=[];_dictationBaseText="";_currentInterimText="";_dictationSessionIdCounter=0;_activeDictationSessionId;_isCleaningDictation=!1;get dictation(){return this._dictation}_isActiveSession(e,t){return this._activeDictationSessionId===e&&this._dictationSession===t}startDictation(){let e=this.getDictationAdapter();if(!e)throw Error("Dictation adapter not configured");if(this._dictationSession){for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession.stop().catch(()=>{}),this._dictationSession=void 0}let t=e.disableInputDuringDictation??!1;this._dictationBaseText=this._text,this._currentInterimText="";let n=e.listen();this._dictationSession=n;let r=++this._dictationSessionIdCounter;this._activeDictationSessionId=r,this._dictation={status:n.status,inputDisabled:t},this._notifySubscribers();let i=n.onSpeech(e=>{if(!this._isActiveSession(r,n))return;let t=!1!==e.isFinal,i=this._dictationBaseText&&!this._dictationBaseText.endsWith(" ")&&e.transcript?" ":"";if(t){if(this._dictationBaseText=this._dictationBaseText+i+e.transcript,this._currentInterimText="",this._text=this._dictationBaseText,this._dictation){let{transcript:e,...t}=this._dictation;this._dictation=t}this._notifySubscribers()}else this._currentInterimText=i+e.transcript,this._text=this._dictationBaseText+this._currentInterimText,this._dictation&&(this._dictation={...this._dictation,transcript:e.transcript}),this._notifySubscribers()});this._dictationUnsubscribes.push(i);let s=n.onSpeechStart(()=>{this._isActiveSession(r,n)&&(this._dictation={status:{type:"running"},inputDisabled:t,...this._dictation?.transcript&&{transcript:this._dictation.transcript}},this._notifySubscribers())});this._dictationUnsubscribes.push(s);let o=n.onSpeechEnd(()=>{this._cleanupDictation({sessionId:r})});this._dictationUnsubscribes.push(o);let a=setInterval(()=>{this._isActiveSession(r,n)&&"ended"===n.status.type&&this._cleanupDictation({sessionId:r})},100);this._dictationUnsubscribes.push(()=>clearInterval(a))}stopDictation(){if(!this._dictationSession)return;let e=this._dictationSession,t=this._activeDictationSessionId;e.stop().finally(()=>{this._cleanupDictation({sessionId:t})})}_cleanupDictation(e){if((e?.sessionId===void 0||e.sessionId===this._activeDictationSessionId)&&!this._isCleaningDictation){this._isCleaningDictation=!0;try{for(let e of this._dictationUnsubscribes)e();this._dictationUnsubscribes=[],this._dictationSession=void 0,this._activeDictationSessionId=void 0,this._dictation=void 0,this._dictationBaseText="",this._currentInterimText="",this._notifySubscribers()}finally{this._isCleaningDictation=!1}}}_eventSubscribers=new Map;_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}unstable_on(e,t){let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{let n=this._eventSubscribers.get(e);n&&n.delete(t)}}}class eR extends eM{runtime;_canCancel=!1;get canCancel(){return this._canCancel}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}constructor(e){super(),this.runtime=e,this.connect()}connect(){return this.runtime.subscribe(()=>{this.canCancel!==this.runtime.capabilities.cancel&&(this._canCancel=this.runtime.capabilities.cancel,this._notifySubscribers())})}async handleSend(e){this.runtime.append({...e,parentId:this.runtime.messages.at(-1)?.id??null,sourceId:null})}async handleCancel(){this.runtime.cancelRun()}}class eP extends eM{runtime;endEditCallback;get canCancel(){return!0}getAttachmentAdapter(){return this.runtime.adapters?.attachments}getDictationAdapter(){return this.runtime.adapters?.dictation}_nonTextParts;_previousText;_parentId;_sourceId;constructor(e,t,{parentId:n,message:r}){super(),this.runtime=e,this.endEditCallback=t,this._parentId=n,this._sourceId=r.id,this._previousText=ev(r),this.setText(this._previousText),this.setRole(r.role),this.setAttachments(r.attachments??[]),this._nonTextParts=r.content.filter(e=>"text"!==e.type),this.setRunConfig({...e.composer.runConfig})}async handleSend(e){ev(e)!==this._previousText&&this.runtime.append({...e,content:[...e.content,...this._nonTextParts],parentId:this._parentId,sourceId:this._sourceId}),this.handleCancel()}handleCancel(){this.endEditCallback(),this._notifySubscribers()}}class eD{_contextProvider;_subscriptions=new Set;_isInitialized=!1;repository=new e_;get messages(){return this.repository.getMessages()}get state(){let e;for(let t of this.messages)"assistant"===t.role&&(e=t);return e?.metadata.unstable_state??null}composer=new eR(this);constructor(e){this._contextProvider=e}getModelContext(){return this._contextProvider.getModelContext()}_editComposers=new Map;getEditComposer(e){return this._editComposers.get(e)}beginEdit(e){if(this._editComposers.has(e))throw Error("Edit already in progress");this._editComposers.set(e,new eP(this,()=>this._editComposers.delete(e),this.repository.getMessage(e))),this._notifySubscribers()}getMessageById(e){try{return this.repository.getMessage(e)}catch{return}}getBranches(e){return this.repository.getBranches(e)}switchToBranch(e){this.repository.switchToBranch(e),this._notifySubscribers()}_notifySubscribers(){for(let e of this._subscriptions)e()}_notifyEventSubscribers(e){let t=this._eventSubscribers.get(e);if(t)for(let e of t)e()}subscribe(e){return this._subscriptions.add(e),()=>this._subscriptions.delete(e)}submitFeedback({messageId:e,type:t}){let n=this.adapters?.feedback;if(!n)throw Error("Feedback adapter not configured");let{message:r,parentId:i}=this.repository.getMessage(e);if(n.submit({message:r,type:t}),"assistant"===r.role){let e={...r,metadata:{...r.metadata,submittedFeedback:{type:t}}};this.repository.addOrUpdateMessage(i,e)}this._notifySubscribers()}_stopSpeaking;speech;speak(e){let t=this.adapters?.speech;if(!t)throw Error("Speech adapter not configured");let{message:n}=this.repository.getMessage(e);this._stopSpeaking?.();let r=t.speak(ev(n)),i=r.subscribe(()=>{"ended"===r.status.type?(this._stopSpeaking=void 0,this.speech=void 0):this.speech={messageId:e,status:r.status},this._notifySubscribers()});this.speech={messageId:e,status:r.status},this._notifySubscribers(),this._stopSpeaking=()=>{r.cancel(),i(),this.speech=void 0,this._stopSpeaking=void 0}}stopSpeaking(){if(!this._stopSpeaking)throw Error("No message is being spoken");this._stopSpeaking(),this._notifySubscribers()}ensureInitialized(){this._isInitialized||(this._isInitialized=!0,this._notifyEventSubscribers("initialize"))}export(){return this.repository.export()}import(e){this.ensureInitialized(),this.repository.clear(),this.repository.import(e),this._notifySubscribers()}reset(e){this.import(ek(e??[]))}_eventSubscribers=new Map;unstable_on(e,t){if("modelContextUpdate"===e)return this._contextProvider.subscribe?.(t)??(()=>{});let n=this._eventSubscribers.get(e);return n?n.add(t):this._eventSubscribers.set(e,new Set([t])),()=>{this._eventSubscribers.get(e).delete(t)}}}let eO=Object.freeze([]),eF=(e,t)=>{let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0};class eL extends eD{_assistantOptimisticId=null;_capabilities={switchToBranch:!1,switchBranchDuringRun:!1,edit:!1,reload:!1,cancel:!1,unstable_copy:!1,speech:!1,dictation:!1,attachments:!1,feedback:!1};get capabilities(){return this._capabilities}_messages;isDisabled;get isLoading(){return this._store.isLoading??!1}get messages(){return this._messages}get state(){return this._store.state??super.state}get adapters(){return this._store.adapters}suggestions=[];extras=void 0;_converter=new ea;_store;beginEdit(e){if(!this._store.onEdit)throw Error("Runtime does not support editing.");super.beginEdit(e)}constructor(e,t){super(e),this.__internal_setAdapter(t)}__internal_setAdapter(e){let t,n;if(this._store===e)return;let r=e.isRunning??!1;this.isDisabled=e.isDisabled??!1;let i=this._store;this._store=e,this.extras!==e.extras&&(this.extras=e.extras);let s=e.suggestions??eO;eF(this.suggestions,s)||(this.suggestions=s);let o={switchToBranch:void 0!==this._store.setMessages,switchBranchDuringRun:!1,edit:void 0!==this._store.onEdit,reload:void 0!==this._store.onReload,cancel:void 0!==this._store.onCancel,speech:this._store.adapters?.speech!==void 0,dictation:this._store.adapters?.dictation!==void 0,unstable_copy:this._store.unstable_capabilities?.copy!==!1,attachments:!!this._store.adapters?.attachments,feedback:!!this._store.adapters?.feedback};if(eF(this._capabilities,o)||(this._capabilities=o),e.messageRepository){if(i&&i.isRunning===e.isRunning&&i.messageRepository===e.messageRepository)return void this._notifySubscribers();this.repository.clear(),this._assistantOptimisticId=null,this.repository.import(e.messageRepository),t=this.repository.getMessages()}else if(e.messages){if(i){if(i.convertMessage!==e.convertMessage)this._converter=new ea;else if(i.isRunning===e.isRunning&&i.messages===e.messages)return void this._notifySubscribers()}t=e.convertMessage?this._converter.convertMessages(e.messages,(t,n,i)=>{if(!e.convertMessage)return n;let s=ep(i===(e.messages?.length??0)-1,r,!1,!1,void 0);if(t&&("assistant"!==t.role||!0!==t.status[el]||t.status===s))return t;let o=ey(e.convertMessage(n,i),i.toString(),s);return er in o||(o[er]=n),o}):e.messages;for(let e=0;e<t.length;e++){let n=t[e],r=t[e-1];this.repository.addOrUpdateMessage(r?.id??null,n)}}else throw Error("ExternalStoreAdapter must provide either 'messages' or 'messageRepository'");t.length>0&&this.ensureInitialized(),(i?.isRunning??!1)!==(e.isRunning??!1)&&(e.isRunning?this._notifyEventSubscribers("runStart"):this._notifyEventSubscribers("runEnd")),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null),n=t,r&&n[n.length-1]?.role!=="assistant"&&(this._assistantOptimisticId=this.repository.appendOptimisticMessage(t.at(-1)?.id??null,{role:"assistant",content:[]})),this.repository.resetHead(this._assistantOptimisticId??t.at(-1)?.id??null),this._messages=this.repository.getMessages(),this._notifySubscribers()}switchToBranch(e){if(!this._store.setMessages)throw Error("Runtime does not support switching branches.");this._store.isRunning||(this.repository.switchToBranch(e),this.updateMessages(this.repository.getMessages()))}async append(e){if(e.parentId!==(this.messages.at(-1)?.id??null)){if(!this._store.onEdit)throw Error("Runtime does not support editing messages.");await this._store.onEdit(e)}else await this._store.onNew(e)}async startRun(e){if(!this._store.onReload)throw Error("Runtime does not support reloading messages.");await this._store.onReload(e.parentId,e)}async resumeRun(e){if(!this._store.onResume)throw Error("Runtime does not support resuming runs.");await this._store.onResume(e)}exportExternalState(){if(!this._store.onExportExternalState)throw Error("Runtime does not support exporting external states.");return this._store.onExportExternalState()}importExternalState(e){if(!this._store.onLoadExternalState)throw Error("Runtime does not support importing external states.");this._store.onLoadExternalState(e)}unstable_loadExternalState(e){this.importExternalState(e)}cancelRun(){if(!this._store.onCancel)throw Error("Runtime does not support cancelling runs.");this._store.onCancel(),this._assistantOptimisticId&&(this.repository.deleteMessage(this._assistantOptimisticId),this._assistantOptimisticId=null);let e=this.repository.getMessages(),t=e[e.length-1];t?.role==="user"&&t.id===e.at(-1)?.id?(this.repository.deleteMessage(t.id),this.composer.text.trim()||this.composer.setText(ev(t)),e=this.repository.getMessages()):this._notifySubscribers(),setTimeout(()=>{this.updateMessages(e)},0)}addToolResult(e){if(!this._store.onAddToolResult&&!this._store.onAddToolResult)throw Error("Runtime does not support tool results.");this._store.onAddToolResult?.(e)}resumeToolCall(e){if(!this._store.onResumeToolCall)throw Error("Runtime does not support resuming tool calls.");this._store.onResumeToolCall(e)}reset(e){let t=new e_;t.import(ek(e??[])),this.updateMessages(t.getMessages())}import(e){this._assistantOptimisticId=null,super.import(e),this._store.onImport&&this._store.onImport(this.repository.getMessages())}updateMessages=e=>{void 0!==this._store.convertMessage?this._store.setMessages?.(e.flatMap(eo)):this._store.setMessages?.(e)}}let eB=e=>e.adapters?.threadList??{};class ez extends J{threads;constructor(e){super(),this.threads=new en(eB(e),()=>new eL(this._contextProvider,e))}setAdapter(e){this.threads.__internal_setAdapter(eB(e)),this.threads.getMainThreadRuntimeCore().__internal_setAdapter(e)}}class e${_core;_threadListBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadListBinding=t,this.__internal_bindMethods()}__internal_bindMethods(){this.switchTo=this.switchTo.bind(this),this.rename=this.rename.bind(this),this.archive=this.archive.bind(this),this.unarchive=this.unarchive.bind(this),this.delete=this.delete.bind(this),this.initialize=this.initialize.bind(this),this.generateTitle=this.generateTitle.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getState=this.getState.bind(this),this.detach=this.detach.bind(this)}getState(){return this._core.getState()}switchTo(){let e=this._core.getState();return this._threadListBinding.switchToThread(e.id)}rename(e){let t=this._core.getState();return this._threadListBinding.rename(t.id,e)}archive(){let e=this._core.getState();return this._threadListBinding.archive(e.id)}unarchive(){let e=this._core.getState();return this._threadListBinding.unarchive(e.id)}delete(){let e=this._core.getState();return this._threadListBinding.delete(e.id)}initialize(){let e=this._core.getState();return this._threadListBinding.initialize(e.id)}generateTitle(){let e=this._core.getState();return this._threadListBinding.generateTitle(e.id)}unstable_on(e,t){let n=this._core.getState().isMain,r=this._core.getState().id;return this.subscribe(()=>{let i=this._core.getState(),s=i.isMain,o=i.id;n===s&&r===o||(n=s,r=o,"switchedTo"===e&&!s||"switchedAway"===e&&s||t())})}subscribe(e){return this._core.subscribe(e)}detach(){let e=this._core.getState();this._threadListBinding.detach(e.id)}__internal_getRuntime(){return this}}class eU{_core;get path(){return this._core.path}constructor(e){this._core=e,this.__internal_bindMethods()}__internal_bindMethods(){this.getState=this.getState.bind(this),this.remove=this.remove.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this._core.getState()}subscribe(e){return this._core.subscribe(e)}}class eq extends eU{_composerApi;constructor(e,t){super(e),this._composerApi=t}remove(){let e=this._composerApi.getState();if(!e)throw Error("Composer is not available");return e.removeAttachment(this.getState().id)}}class eH extends eq{get source(){return"thread-composer"}}class eV extends eq{get source(){return"edit-composer"}}class eW extends eU{get source(){return"message"}constructor(e){super(e)}remove(){throw Error("Message attachments cannot be removed")}}let eK=Object.freeze([]),eG=Object.freeze({});class eJ{_core;get path(){return this._core.path}constructor(e){this._core=e}__internal_bindMethods(){this.setText=this.setText.bind(this),this.setRunConfig=this.setRunConfig.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.addAttachment=this.addAttachment.bind(this),this.reset=this.reset.bind(this),this.clearAttachments=this.clearAttachments.bind(this),this.send=this.send.bind(this),this.cancel=this.cancel.bind(this),this.setRole=this.setRole.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.startDictation=this.startDictation.bind(this),this.stopDictation=this.stopDictation.bind(this),this.setQuote=this.setQuote.bind(this),this.unstable_on=this.unstable_on.bind(this)}setText(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setText(e)}setRunConfig(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRunConfig(e)}addAttachment(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");return t.addAttachment(e)}reset(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.reset()}clearAttachments(){let e=this._core.getState();if(!e)throw Error("Composer is not available");return e.clearAttachments()}send(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.send()}cancel(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.cancel()}setRole(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setRole(e)}startDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.startDictation()}stopDictation(){let e=this._core.getState();if(!e)throw Error("Composer is not available");e.stopDictation()}setQuote(e){let t=this._core.getState();if(!t)throw Error("Composer is not available");t.setQuote(e)}subscribe(e){return this._core.subscribe(e)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eN({event:e,binding:this._core}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}class eQ extends eJ{get path(){return this._core.path}get type(){return"thread"}_getState;constructor(e){const t=new eI({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"thread",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,attachments:t?.attachments??eK,text:t?.text??"",role:t?.role??"user",runConfig:t?.runConfig??eG,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>t.subscribe(e)}),this._getState=t.getState.bind(t),this.__internal_bindMethods()}getState(){return this._getState()}getAttachmentByIndex(e){return new eH(new eT({path:{...this.path,attachmentSource:"thread-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"thread-composer"}:eC},subscribe:e=>this._core.subscribe(e)}),this._core)}}class eY extends eJ{_beginEdit;get path(){return this._core.path}get type(){return"edit"}_getState;constructor(e,t){const n=new eI({path:e.path,getState:()=>{let t;return t=e.getState(),Object.freeze({type:"edit",isEditing:t?.isEditing??!1,canCancel:t?.canCancel??!1,isEmpty:t?.isEmpty??!0,text:t?.text??"",role:t?.role??"user",attachments:t?.attachments??eK,runConfig:t?.runConfig??eG,attachmentAccept:t?.attachmentAccept??"",dictation:t?.dictation,quote:t?.quote,value:t?.text??""})},subscribe:t=>e.subscribe(t)});super({path:e.path,getState:()=>e.getState(),subscribe:e=>n.subscribe(e)}),this._beginEdit=t,this._getState=n.getState.bind(n),this.__internal_bindMethods()}__internal_bindMethods(){super.__internal_bindMethods(),this.beginEdit=this.beginEdit.bind(this)}getState(){return this._getState()}beginEdit(){this._beginEdit()}getAttachmentByIndex(e){return new eV(new eT({path:{...this.path,attachmentSource:"edit-composer",attachmentSelector:{type:"index",index:e},ref:`${this.path.ref}.attachments[${e}]`},getState:()=>{let t=this.getState().attachments[e];return t?{...t,source:"edit-composer"}:eC},subscribe:e=>this._core.subscribe(e)}),this._core)}}let eX=Symbol.for("aui.tool-response");class eZ{get[eX](){return!0}artifact;result;isError;messages;constructor(e){void 0!==e.artifact&&(this.artifact=e.artifact),this.result=e.result,this.isError=e.isError??!1,void 0!==e.messages&&(this.messages=e.messages)}static[Symbol.hasInstance](e){return"object"==typeof e&&null!==e&&eX in e}static toResponse(e){return e instanceof eZ?e:new eZ({result:void 0===e?"<no result>":e})}}class e0{contentBinding;messageApi;threadApi;get path(){return this.contentBinding.path}constructor(e,t,n){this.contentBinding=e,this.messageApi=t,this.threadApi=n,this.__internal_bindMethods()}__internal_bindMethods(){this.addToolResult=this.addToolResult.bind(this),this.resumeToolCall=this.resumeToolCall.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this)}getState(){return this.contentBinding.getState()}addToolResult(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to add tool result to non-tool message part");if(!this.messageApi)throw Error("Message API is not available. This is likely a bug in assistant-ui.");if(!this.threadApi)throw Error("Thread API is not available");let n=this.messageApi.getState();if(!n)throw Error("Message is not available");let r=t.toolName,i=t.toolCallId,s=eZ.toResponse(e);this.threadApi.getState().addToolResult({messageId:n.id,toolName:r,toolCallId:i,result:s.result,artifact:s.artifact,isError:s.isError})}resumeToolCall(e){let t=this.contentBinding.getState();if(!t)throw Error("Message part is not available");if("tool-call"!==t.type)throw Error("Tried to resume tool call on non-tool message part");if(!this.threadApi)throw Error("Thread API is not available");let n=t.toolCallId;this.threadApi.getState().resumeToolCall({toolCallId:n,payload:e})}subscribe(e){return this.contentBinding.subscribe(e)}}let e1=Object.freeze({type:"complete"}),e5=(e,t)=>{let n=e.content[t];if(!n)return eC;let r=((e,t,n)=>{if("assistant"!==e.role)return e1;if("tool-call"===n.type)if(!n.result)return e.status;else return e1;let r=t===Math.max(0,e.content.length-1);return"requires-action"===e.status.type?e1:r?e.status:e1})(e,t,n);return Object.freeze({...n,...{[er]:n[er]},status:r})};class e2{_core;_threadBinding;get path(){return this._core.path}constructor(e,t){this._core=e,this._threadBinding=t,this.composer=new eY(new eA({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.composer`,composerSource:"edit"},getState:this._getEditComposerRuntimeCore,subscribe:e=>this._threadBinding.subscribe(e)}),()=>this._threadBinding.getState().beginEdit(this._core.getState().id)),this.__internal_bindMethods()}__internal_bindMethods(){this.reload=this.reload.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getMessagePartByIndex=this.getMessagePartByIndex.bind(this),this.getMessagePartByToolCallId=this.getMessagePartByToolCallId.bind(this),this.getAttachmentByIndex=this.getAttachmentByIndex.bind(this),this.unstable_getCopyText=this.unstable_getCopyText.bind(this),this.speak=this.speak.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.submitFeedback=this.submitFeedback.bind(this),this.switchToBranch=this.switchToBranch.bind(this)}composer;_getEditComposerRuntimeCore=()=>this._threadBinding.getState().getEditComposer(this._core.getState().id);getState(){return this._core.getState()}reload(e={}){let t=this._getEditComposerRuntimeCore(),n=t??this._threadBinding.getState().composer,{runConfig:r=(t??n).runConfig}=e,i=this._core.getState();if("assistant"!==i.role)throw Error("Can only reload assistant messages");this._threadBinding.getState().startRun({parentId:i.parentId,sourceId:i.id,runConfig:r})}speak(){let e=this._core.getState();return this._threadBinding.getState().speak(e.id)}stopSpeaking(){let e=this._core.getState(),t=this._threadBinding.getState();if(t.speech?.messageId===e.id)this._threadBinding.getState().stopSpeaking();else throw Error("Message is not being spoken")}submitFeedback({type:e}){let t=this._core.getState();this._threadBinding.getState().submitFeedback({messageId:t.id,type:e})}switchToBranch({position:e,branchId:t}){let n=this._core.getState();if(t&&e)throw Error("May not specify both branchId and position");if(!t&&!e)throw Error("Must specify either branchId or position");let r=this._threadBinding.getState().getBranches(n.id),i=t;if("previous"===e?i=r[n.branchNumber-2]:"next"===e&&(i=r[n.branchNumber]),!i)throw Error("Branch not found");this._threadBinding.getState().switchToBranch(i)}unstable_getCopyText(){return ev(this.getState())}subscribe(e){return this._core.subscribe(e)}getMessagePartByIndex(e){if(e<0)throw Error("Message part index must be >= 0");return new e0(new eT({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.content[${e}]`,messagePartSelector:{type:"index",index:e}},getState:()=>e5(this.getState(),e),subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getMessagePartByToolCallId(e){return new e0(new eT({path:{...this.path,ref:this.path.ref+`${this.path.ref}.content[toolCallId=${JSON.stringify(e)}]`,messagePartSelector:{type:"toolCallId",toolCallId:e}},getState:()=>{let t=this._core.getState(),n=t.content.findIndex(t=>"tool-call"===t.type&&t.toolCallId===e);return -1===n?eC:e5(t,n)},subscribe:e=>this._core.subscribe(e)}),this._core,this._threadBinding)}getAttachmentByIndex(e){return new eW(new eT({path:{...this.path,ref:`${this.path.ref}${this.path.ref}.attachments[${e}]`,attachmentSource:"message",attachmentSelector:{type:"index",index:e}},getState:()=>{let t=this.getState().attachments,n=t?.[e];return n?{...n,source:"message"}:eC},subscribe:e=>this._core.subscribe(e)}))}}class e3{get path(){return this._threadBinding.path}get __internal_threadBinding(){return this._threadBinding}_threadBinding;constructor(e,t){const n=new eT({path:e.path,getState:()=>{var n,r;let i;return n=e.getState(),r=t.getState(),i=n.messages.at(-1),Object.freeze({threadId:r.id,metadata:r,capabilities:n.capabilities,isDisabled:n.isDisabled,isLoading:n.isLoading,isRunning:i?.role==="assistant"&&"running"===i.status.type,messages:n.messages,state:n.state,suggestions:n.suggestions,extras:n.extras,speech:n.speech})},subscribe:n=>{let r=e.subscribe(n),i=t.subscribe(n);return()=>{r(),i()}}});this._threadBinding={path:e.path,getState:()=>e.getState(),getStateState:()=>n.getState(),outerSubscribe:t=>e.outerSubscribe(t),subscribe:t=>e.subscribe(t)},this.composer=new eQ(new eA({path:{...this.path,ref:`${this.path.ref}.composer`,composerSource:"thread"},getState:()=>this._threadBinding.getState().composer,subscribe:e=>this._threadBinding.subscribe(e)})),this.__internal_bindMethods()}__internal_bindMethods(){this.append=this.append.bind(this),this.resumeRun=this.resumeRun.bind(this),this.unstable_resumeRun=this.unstable_resumeRun.bind(this),this.unstable_loadExternalState=this.unstable_loadExternalState.bind(this),this.importExternalState=this.importExternalState.bind(this),this.exportExternalState=this.exportExternalState.bind(this),this.startRun=this.startRun.bind(this),this.cancelRun=this.cancelRun.bind(this),this.stopSpeaking=this.stopSpeaking.bind(this),this.export=this.export.bind(this),this.import=this.import.bind(this),this.reset=this.reset.bind(this),this.getMessageByIndex=this.getMessageByIndex.bind(this),this.getMessageById=this.getMessageById.bind(this),this.subscribe=this.subscribe.bind(this),this.unstable_on=this.unstable_on.bind(this),this.getModelContext=this.getModelContext.bind(this),this.getModelConfig=this.getModelConfig.bind(this),this.getState=this.getState.bind(this)}composer;getState(){return this._threadBinding.getStateState()}append(e){var t;this._threadBinding.getState().append((t=this._threadBinding.getState().messages,"string"==typeof e?{createdAt:new Date,parentId:t.at(-1)?.id??null,sourceId:null,runConfig:{},role:"user",content:[{type:"text",text:e}],attachments:[],metadata:{custom:{}}}:{createdAt:e.createdAt??new Date,parentId:e.parentId??t.at(-1)?.id??null,sourceId:e.sourceId??null,role:e.role??"user",content:e.content,attachments:e.attachments??[],metadata:e.metadata??{custom:{}},runConfig:e.runConfig??{},startRun:e.startRun}))}subscribe(e){return this._threadBinding.subscribe(e)}getModelContext(){return this._threadBinding.getState().getModelContext()}getModelConfig(){return this.getModelContext()}startRun(e){let t;return this._threadBinding.getState().startRun({parentId:(t=null===e||"string"==typeof e?{parentId:e}:e).parentId??null,sourceId:t.sourceId??null,runConfig:t.runConfig??{}})}resumeRun(e){return this._threadBinding.getState().resumeRun({parentId:e.parentId??null,sourceId:e.sourceId??null,runConfig:e.runConfig??{},...e.stream?{stream:e.stream}:{}})}unstable_resumeRun(e){return this.resumeRun(e)}exportExternalState(){return this._threadBinding.getState().exportExternalState()}importExternalState(e){this._threadBinding.getState().importExternalState(e)}unstable_loadExternalState(e){this._threadBinding.getState().unstable_loadExternalState(e)}cancelRun(){this._threadBinding.getState().cancelRun()}stopSpeaking(){return this._threadBinding.getState().stopSpeaking()}export(){return this._threadBinding.getState().export()}import(e){this._threadBinding.getState().import(e)}reset(e){this._threadBinding.getState().reset(e)}getMessageByIndex(e){if(e<0)throw Error("Message index must be >= 0");return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[${e}]`,messageSelector:{type:"index",index:e}},()=>{let t=this._threadBinding.getState().messages,n=t[e];if(n)return{message:n,parentId:t[e-1]?.id??null,index:e}})}getMessageById(e){return this._getMessageRuntime({...this.path,ref:`${this.path.ref}.messages[messageId=${JSON.stringify(e)}]`,messageSelector:{type:"messageId",messageId:e}},()=>this._threadBinding.getState().getMessageById(e))}_getMessageRuntime(e,t){return new e2(new eT({path:e,getState:()=>{let{message:e,parentId:n,index:r}=t()??{},{messages:i,speech:s}=this._threadBinding.getState();if(!e||void 0===n||void 0===r)return eC;let o=this._threadBinding.getState().getBranches(e.id),a=e.metadata.submittedFeedback;return{...e,...{[er]:e[er]},index:r,isLast:i.at(-1)?.id===e.id,parentId:n,branchNumber:o.indexOf(e.id)+1,branchCount:o.length,speech:s?.messageId===e.id?s:void 0,submittedFeedback:a}},subscribe:e=>this._threadBinding.subscribe(e)}),this._threadBinding)}_eventSubscriptionSubjects=new Map;unstable_on(e,t){let n=this._eventSubscriptionSubjects.get(e);return n||(n=new eN({event:e,binding:this._threadBinding}),this._eventSubscriptionSubjects.set(e,n)),n.subscribe(t)}}let e4=(e,t)=>{if(void 0===t)return eC;let n=e.getItemById(t);return n?{id:n.id,remoteId:n.remoteId,externalId:n.externalId,title:n.title,status:n.status,isMain:n.id===e.mainThreadId}:eC};class e6{_core;_runtimeFactory;_getState;constructor(e,t=e3){this._core=e,this._runtimeFactory=t;const n=new eI({path:{},getState:()=>({mainThreadId:e.mainThreadId,newThreadId:e.newThreadId,threadIds:e.threadIds,archivedThreadIds:e.archivedThreadIds,isLoading:e.isLoading,threadItems:e.threadItems}),subscribe:t=>e.subscribe(t)});this._getState=n.getState.bind(n),this._mainThreadListItemRuntime=new e$(new eT({path:{ref:"threadItems[main]",threadSelector:{type:"main"}},getState:()=>e4(this._core,this._core.mainThreadId),subscribe:e=>this._core.subscribe(e)}),this._core),this.main=new t(new eA({path:{ref:"threads.main",threadSelector:{type:"main"}},getState:()=>e.getMainThreadRuntimeCore(),subscribe:t=>e.subscribe(t)}),this._mainThreadListItemRuntime),this.__internal_bindMethods()}__internal_bindMethods(){this.switchToThread=this.switchToThread.bind(this),this.switchToNewThread=this.switchToNewThread.bind(this),this.getState=this.getState.bind(this),this.subscribe=this.subscribe.bind(this),this.getById=this.getById.bind(this),this.getItemById=this.getItemById.bind(this),this.getItemByIndex=this.getItemByIndex.bind(this),this.getArchivedItemByIndex=this.getArchivedItemByIndex.bind(this)}switchToThread(e){return this._core.switchToThread(e)}switchToNewThread(){return this._core.switchToNewThread()}getState(){return this._getState()}subscribe(e){return this._core.subscribe(e)}_mainThreadListItemRuntime;main;get mainItem(){return this._mainThreadListItemRuntime}getById(e){return new this._runtimeFactory(new eA({path:{ref:`threads[threadId=${JSON.stringify(e)}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>this._core.getThreadRuntimeCore(e),subscribe:e=>this._core.subscribe(e)}),this.mainItem)}getItemByIndex(e){return new e$(new eT({path:{ref:`threadItems[${e}]`,threadSelector:{type:"index",index:e}},getState:()=>e4(this._core,this._core.threadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getArchivedItemByIndex(e){return new e$(new eT({path:{ref:`archivedThreadItems[${e}]`,threadSelector:{type:"archiveIndex",index:e}},getState:()=>e4(this._core,this._core.archivedThreadIds[e]),subscribe:e=>this._core.subscribe(e)}),this._core)}getItemById(e){return new e$(new eT({path:{ref:`threadItems[threadId=${e}]`,threadSelector:{type:"threadId",threadId:e}},getState:()=>e4(this._core,e),subscribe:e=>this._core.subscribe(e)}),this._core)}}class e9{_core;threads;get threadList(){return this.threads}_thread;constructor(e){this._core=e,this.threads=new e6(e.threads),this._thread=this.threads.main,this.__internal_bindMethods()}__internal_bindMethods(){this.switchToNewThread=this.switchToNewThread.bind(this),this.switchToThread=this.switchToThread.bind(this),this.registerModelContextProvider=this.registerModelContextProvider.bind(this),this.registerModelConfigProvider=this.registerModelConfigProvider.bind(this),this.reset=this.reset.bind(this)}get thread(){return this._thread}switchToNewThread(){return this._core.threads.switchToNewThread()}switchToThread(e){return this._core.threads.switchToThread(e)}registerModelContextProvider(e){return this._core.registerModelContextProvider(e)}registerModelConfigProvider(e){return this.registerModelContextProvider(e)}reset({initialMessages:e}={}){return this._core.threads.getMainThreadRuntimeCore().import(ek(e??[]))}}let e7=(0,j.createContext)(null);var e8=e.i(962885),te=e.i(687975),tt=e.i(806786),tn=e.i(477501),tr=e.i(800003),ti=class extends tn.Subscribable{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,tr.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,tr.hashKey)(t.mutationKey)!==(0,tr.hashKey)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#s()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??(0,te.getDefaultState)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#s(e){tt.notifyManager.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},ts=e.i(434682),to=e.i(317406);function ta(e){return["chat-messages",e]}async function tl(e){let t=await fetch(`/api/interactive/chat/${e}/messages`);if(!t.ok)throw console.error(`[ChatState] fetch failed: ${t.status}`,await t.text().catch(()=>"")),Error(`Failed to fetch chat state: ${t.status}`);return t.json()}function tu(e){if(null==e||""===e)return null;if("number"==typeof e)return Number.isFinite(e)?e:null;if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}if("string"==typeof e){let t=Number(e);if(Number.isFinite(t))return t;let n=new Date(e).getTime();return Number.isFinite(n)?n:null}return null}async function tc(e,t,n,r,i){let s=await fetch(`/api/interactive/chat/${e}/messages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,worktreePath:n,model:r,agentType:i})});if(!s.ok)throw Error(`Failed to send message: ${s.status}`);return(await s.json()).message}function td(e){return{id:e.id,role:e.role===to.InteractiveMessageRole.user?"user":"assistant",content:[{type:"text",text:e.content}],createdAt:e.createdAt?new Date(e.createdAt):void 0}}function th(e,t,n){let r=(0,ts.useQueryClient)(),i=(0,j.useRef)(n?.model),s=(0,j.useRef)(n?.agentType);i.current=n?.model,s.current=n?.agentType;let o=(0,j.useRef)(n?.debugMode??!1);o.current=n?.debugMode??!1;let[a,l]=(0,j.useState)([]),u=(0,j.useCallback)((e,t)=>{o.current&&l(n=>[...n,{id:`dbg-${Date.now()}-${Math.random()}`,timestamp:new Date,label:e,detail:t}])},[]),{data:c,isLoading:d}=(0,e8.useQuery)({queryKey:ta(e),queryFn:()=>tl(e),initialData:n?.initialChatState,staleTime:1/0,refetchOnWindowFocus:!1,refetchOnReconnect:!1});(0,j.useEffect)(()=>{c?.turnStatus==="unread"&&fetch(`/api/interactive/chat/${e}/mark-read`,{method:"POST"})},[c?.turnStatus,e]);let h=(0,j.useMemo)(()=>c?.messages??[],[c?.messages]),p=c?.sessionStatus??null,f=(0,j.useRef)(null);(0,j.useEffect)(()=>{if(p&&p!==f.current){let e=c?.sessionInfo;u(`session_${p}`,e?`model=${e.model??"?"}, sid=${e.sessionId?.slice(0,8)??"?"}`:void 0)}f.current=p},[p,c?.sessionInfo,u]);let m=c?.streamingText??null,g=(0,j.useRef)(null);c?.sessionInfo&&(g.current=c.sessionInfo);let x=c?.sessionInfo??g.current,[b,y]=(0,j.useState)(""),[v,k]=(0,j.useState)(null),[w,S]=(0,j.useState)(!1),_=(0,j.useRef)(null),C=(0,j.useRef)(null),[E,T]=(0,j.useState)(null);(0,j.useEffect)(()=>{let e=c?.pendingInteraction??null;e?T(e):!e&&E&&T(null)},[c?.pendingInteraction,E]);let I=(0,j.useCallback)(()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>S(!0),600)},[]),A=(0,j.useCallback)(()=>{_.current&&(clearTimeout(_.current),_.current=null),S(!1)},[]),N=h.length>0?h[h.length-1].role:null;(0,j.useEffect)(()=>{N===to.InteractiveMessageRole.assistant&&A()},[N,h.length,A]),(0,j.useEffect)(()=>{let t=new EventSource(`/api/interactive/chat/${e}/stream`);return C.current=t,t.addEventListener("delta",e=>{try{let t=JSON.parse(e.data);t.delta&&(A(),y(e=>e+t.delta),k(null))}catch{}}),t.addEventListener("activity",e=>{A();try{let t=JSON.parse(e.data);t.activity&&u(`[${t.activity.kind}] ${t.activity.label}`,t.activity.detail)}catch{}}),t.addEventListener("log",e=>{try{let t=JSON.parse(e.data);t.log&&(A(),k(t.log),u("log",t.log))}catch{}}),t.addEventListener("interaction",e=>{try{let t=JSON.parse(e.data);t.interaction&&(A(),T(t.interaction))}catch{}}),t.addEventListener("message",t=>{try{let i=JSON.parse(t.data);if(i.message){var n;n=i.message,r.setQueryData(ta(e),e=>{let t=e??{messages:[],sessionStatus:null,streamingText:null,sessionInfo:null};if(t.messages.find(e=>e.id===n.id))return t;let r=t.messages.filter(e=>!(e.id.startsWith("optimistic-")&&e.role===n.role&&e.content===n.content));return{...t,messages:[...r,n]}}),i.message.role===to.InteractiveMessageRole.assistant&&A()}}catch{}}),t.addEventListener("session_status",t=>{try{var n;let i=JSON.parse(t.data);i.sessionStatus&&(n=i.sessionStatus,r.setQueryData(ta(e),e=>e?{...e,sessionStatus:n}:e))}catch{}}),t.addEventListener("turn_status",t=>{try{var n;let i=JSON.parse(t.data);i.turnStatus&&(n=i.turnStatus,r.setQueryData(ta(e),e=>e?{...e,turnStatus:n}:e))}catch{}}),t.addEventListener("workflow_step",t=>{try{let n=JSON.parse(t.data);if(!n.step)return;r.setQueryData(ta(e),e=>{let t;if(!e)return e;let r=e.workflow,i=r?.steps.findIndex(e=>e.id===n.step.id)??-1;r&&-1!==i?(t=r.steps.slice())[i]=n.step:t=[...r?.steps??[],n.step].sort((e,t)=>e.stepIndex-t.stepIndex);let s=t.find(e=>"running"===e.status);return{...e,workflow:{workflowId:n.step.workflowId,steps:t,currentStepId:s?.id??null}}})}catch{}}),t.addEventListener("done",()=>{k(null),A(),u("turn_done"),T(null),y("")}),t.addEventListener("open",()=>{r.invalidateQueries({queryKey:ta(e)})}),t.onerror=()=>{},()=>{t.close(),C.current=null}},[e,r,A,u]);let M=function(e,t){let n=(0,ts.useQueryClient)(void 0),[r]=j.useState(()=>new ti(n,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);let i=j.useSyncExternalStore(j.useCallback(e=>r.subscribe(tt.notifyManager.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=j.useCallback((e,t)=>{r.mutate(e,t).catch(tr.noop)},[r]);if(i.error&&(0,tr.shouldThrowError)(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}({mutationFn:n=>tc(e,n,t??"",i.current,s.current),onMutate:async t=>{u("send_message",`model=${i.current??"default"}, agent=${s.current??"default"}, len=${t.length}`),I(),await r.cancelQueries({queryKey:ta(e)});let n=r.getQueryData(ta(e));return r.setQueryData(ta(e),n=>({...n??{sessionStatus:"booting",sessionInfo:null},messages:[...n?.messages??[],{id:`optimistic-${Date.now()}`,featureId:e,role:to.InteractiveMessageRole.user,content:t,createdAt:new Date,updatedAt:new Date}],streamingText:null})),{previous:n}},onError:(t,n,i)=>{i?.previous&&r.setQueryData(ta(e),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:ta(e)})}}),R=c?.turnStatus,P=w||!!b||!!v||"booting"===p||"processing"===R,D=b??m??"",O=(0,j.useMemo)(()=>{let e=c?.workflow??null;if(!e||0===e.steps.length)return{hasPlan:!1,steps:[],activeStepId:null,allDone:!1,liveStatus:null};let t=new Map;for(let e of h){let n=e.stepId;if(!n||e.role!==to.InteractiveMessageRole.assistant)continue;let r=t.get(n)??[];r.push(e),t.set(n,r)}let n=e.steps.map(e=>({definition:{id:e.id,stepKey:e.stepKey,title:e.title,description:e.description},status:function(e){switch(e){case"pending":case"running":case"done":case"failed":case"interrupted":return e;default:return"pending"}}(e.status),metadata:function(e){if(!e)return null;try{let t=JSON.parse(e);return t&&"object"==typeof t&&!Array.isArray(t)?t:null}catch{return null}}(e.metadata),toolMessages:t.get(e.id)??[],startedAt:tu(e.startedAt),finishedAt:tu(e.finishedAt)})),r=n.length>0&&n.every(e=>"done"===e.status),i=m?.trim()??"",s=b?.trim()??"",o=(s||i).split("\n")[0]?.slice(0,80)??"",a=null;return r?a=null:v?a=v:o?a=o:("processing"===R||w||"booting"===p)&&(a="booting"===p?"Waking up…":"Thinking…"),{hasPlan:!0,steps:n,activeStepId:e.currentStepId,allDone:r,liveStatus:a}},[c?.workflow,h,v,b,m,R,w,p]),F=n?.pinInitialRequest===!0,L=(0,j.useMemo)(()=>O.hasPlan||F?h.find(e=>e.role===to.InteractiveMessageRole.user&&!e.stepId)??null:null,[O.hasPlan,F,h]),B=(0,j.useMemo)(()=>new Set(n?.hiddenMessageIds??[]),[n?.hiddenMessageIds]),z=(0,j.useMemo)(()=>{let e;if(n?.hideAllMessages===!0)return[];let t=O.hasPlan,r=t&&!O.allDone,i=(t||F||B.size>0?h.filter(e=>!(e.id===L?.id||e.stepId||B.has(e.id))&&(!r||e.role!==to.InteractiveMessageRole.assistant)):h).map(td);if(n?.debugMode&&a.length>0){let t=a.map(e=>({id:e.id,role:"assistant",content:[{type:"text",text:e.detail?`🔧 **${e.label}** — ${e.detail}`:`🔧 **${e.label}**`}],createdAt:e.timestamp}));e=[];let n=0,r=0;for(;n<i.length&&r<t.length;)(i[n].createdAt?new Date(i[n].createdAt).getTime():0)<=(t[r].createdAt?new Date(t[r].createdAt).getTime():0)?e.push(i[n++]):e.push(t[r++]);for(;n<i.length;)e.push(i[n++]);for(;r<t.length;)e.push(t[r++])}else e=i;if(t&&!O.allDone)return e;if(n?.suppressStreamingIndicator!==!0)if(D.trim()){let t=[{type:"text",text:D}];v&&t.push({type:"text",text:`*⏳ ${v}*`}),e.push({id:"streaming",role:"assistant",content:t})}else v?e.push({id:"streaming",role:"assistant",content:[{type:"text",text:`*⏳ ${v}*`}]}):(w||"booting"===p)&&e.push({id:"streaming",role:"assistant",content:[{type:"text",text:"booting"===p?"*Agent is waking up...*":"*Thinking...*"}]});return e},[h,L?.id,D,w,p,v,n?.debugMode,n?.suppressStreamingIndicator,n?.hideAllMessages,a,O.hasPlan,O.allDone,F,B]),$=(0,j.useMemo)(()=>P?{isRunning:!0,statusText:v}:{isRunning:!1,statusText:null},[P,v]),U=(0,j.useCallback)(async e=>{let t=e.content.find(e=>"text"===e.type);if(t?.type!=="text"||!t.text.trim())return;let r=n?.contentTransform?n.contentTransform(t.text):t.text;M.mutate(r,{onSuccess:()=>n?.onMessageSent?.()})},[M,n]),q=(0,j.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/messages`,{method:"DELETE"});if(!t.ok)throw Error(`Failed to clear chat: ${t.status}`);y(""),l([]),k(null),A(),T(null),r.invalidateQueries({queryKey:ta(e)})},[e,r,A]),H=(0,j.useCallback)(async()=>{let t=await fetch(`/api/interactive/chat/${e}/stop`,{method:"POST"});if(!t.ok)throw Error(`Failed to stop agent: ${t.status}`);y(""),k(null),A(),r.invalidateQueries({queryKey:ta(e)})},[e,r,A]),V=(0,j.useCallback)(async t=>{T(null),k(null);try{let n=await fetch(`/api/interactive/chat/${e}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({answers:t})});n.ok||console.error(`[respondToInteraction] failed: ${n.status}`)}catch(e){console.error("[respondToInteraction] error:",e)}r.invalidateQueries({queryKey:ta(e)})},[e,r]),W=!(O.hasPlan&&!O.allDone)&&P;return{runtime:(e=>{let[t]=(0,j.useState)(()=>new ez(e));(0,j.useEffect)(()=>{t.setAdapter(e)});let{modelContext:n}=(0,j.useContext)(e7)??{};return(0,j.useEffect)(()=>{if(n)return t.registerModelContextProvider(n)},[n,t]),(0,j.useMemo)(()=>new e9(t),[t])})({messages:z,convertMessage:(0,j.useCallback)(e=>e,[]),isRunning:W,onNew:U,onCancel:(0,j.useCallback)(async()=>{y(""),k(null),A()},[A])}),status:$,clearChat:q,stopAgent:H,sessionInfo:x,isChatLoading:d,pendingInteraction:E,respondToInteraction:V,stepProgress:O,initialRequestMessage:L,rawMessages:h,streamingState:{text:D,statusLog:v,awaiting:w,sessionStatus:p}}}e.s(["chatQueryKey",()=>ta,"fetchChatState",()=>tl],549922),e.s(["useChatRuntime",()=>th],323217);var tp=e.i(102828);e.i(650032);var tf=e.i(486254);function tm({attachments:e,isDragOver:n,uploadError:r,onDragEnter:s,onDragLeave:o,onDragOver:a,onDrop:l,onPaste:u,onRemoveAttachment:h,onNotesChange:p,onPickFiles:f,agentPicker:m,disabled:g}){let{t:b}=(0,c.useTranslation)("web"),[y,v]=(0,j.useState)(!1),k=(0,j.useRef)(null);return(0,t.jsx)(i.ComposerPrimitive.Root,{className:(0,d.cn)("shrink-0 border-t p-3",g&&"pointer-events-none opacity-50"),children:(0,t.jsx)("div",{onDragEnter:s,onDragLeave:o,onDragOver:a,onDrop:l,className:(0,d.cn)("flex flex-col gap-1.5 rounded-md border-2 border-transparent p-1 transition-colors",n&&"border-primary/50 bg-primary/5"),children:(0,t.jsxs)("div",{ref:k,onFocus:()=>v(!0),onBlur:()=>v(!1),className:(0,d.cn)("border-input flex flex-col overflow-hidden rounded-md border shadow-xs transition-[color,box-shadow]",y&&"ring-ring/50 border-ring ring-[3px]"),children:[(0,t.jsx)(i.ComposerPrimitive.Input,{rows:1,autoFocus:!0,placeholder:b("chat.writeMessage"),onPaste:u,className:"max-h-[4.5rem] min-h-0 resize-none rounded-none border-0 px-3 py-2.5 text-sm shadow-none focus:outline-none focus-visible:ring-0"}),e.length>0?(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2",children:e.map(e=>(0,t.jsx)(tf.AttachmentChip,{name:e.name,size:e.size,mimeType:e.mimeType,path:e.path,onRemove:()=>h(e.id),loading:e.loading,notes:e.notes,onNotesChange:t=>p(e.id,t)},e.id))}):null,r?(0,t.jsx)("p",{className:"text-destructive px-3 pb-2 text-xs",children:r}):null,(0,t.jsxs)("div",{className:"border-input flex items-center gap-3 border-t px-3 py-1.5",children:[m,(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)(tp.Tooltip,{children:[(0,t.jsx)(tp.TooltipTrigger,{asChild:!0,children:(0,t.jsx)("button",{type:"button",onClick:f,"aria-label":b("chat.attachFiles"),className:"text-muted-foreground hover:text-foreground cursor-pointer rounded p-1 transition-colors",children:(0,t.jsx)(x.Paperclip,{className:"h-4 w-4"})})}),(0,t.jsx)(tp.TooltipContent,{side:"top",children:b("chat.attachFiles")})]}),(0,t.jsx)(tg,{})]})]})})})}function tg(){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.ThreadPrimitive.If,{running:!1,children:(0,t.jsx)(i.ComposerPrimitive.Send,{className:(0,d.cn)("bg-primary text-primary-foreground inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-30","transition-colors"),children:(0,t.jsx)(f.SendHorizontal,{className:"size-3.5"})})}),(0,t.jsx)(o.ThreadPrimitive.If,{running:!0,children:(0,t.jsx)(i.ComposerPrimitive.Cancel,{className:(0,d.cn)("bg-destructive/10 text-destructive inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md","hover:bg-destructive/20","transition-colors"),children:(0,t.jsx)(m.CircleStop,{className:"size-3.5"})})})]})}e.s(["ChatComposer",()=>tm],461152);var tx=e.i(604340);function tb({interaction:e,onSubmit:n,className:r}){let i=e.questions.length>1;return(0,t.jsxs)("div",{className:(0,d.cn)("group flex w-full items-start gap-2.5 px-4 py-0.5",r),children:[(0,t.jsx)("div",{className:"bg-muted flex h-6 w-6 shrink-0 items-center justify-center rounded-full",children:(0,t.jsx)(tx.MessageCircleQuestion,{className:"h-3.5 w-3.5 text-violet-600 dark:text-violet-400"})}),(0,t.jsx)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:(0,t.jsx)("div",{className:"text-foreground mt-px overflow-hidden rounded-2xl rounded-tl-sm border border-violet-200 bg-violet-50/50 text-sm leading-relaxed shadow-sm dark:border-violet-500/20 dark:bg-violet-950/20",children:i?(0,t.jsx)(ty,{questions:e.questions,onSubmit:n}):(0,t.jsx)("div",{className:"px-4 py-3",children:(0,t.jsx)(tk,{question:e.questions[0],onSubmit:n})})})})]})}function ty({questions:e,onSubmit:n}){let[r,i]=(0,j.useState)(0),[s,o]=(0,j.useState)(()=>{let t={};for(let n of e)t[n.question]={selectedOptions:new Set,otherText:"",isOtherSelected:!1};return t}),a=(0,j.useCallback)((e,t)=>{o(n=>({...n,[e]:t(n[e])}))},[]),l={};for(let t of e){let e=s[t.question];if(!e)continue;let n=[...e.selectedOptions];e.isOtherSelected&&e.otherText.trim()&&n.push(e.otherText.trim()),n.length>0&&(l[t.question]=n.join(", "))}let u=e.every(e=>l[e.question]),c=(0,j.useCallback)(()=>{u&&n(l)},[u,n,s]);return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex border-b border-violet-200 dark:border-violet-500/20",children:e.map((e,n)=>{let s=n===r,o=!!l[e.question];return(0,t.jsxs)("button",{type:"button",onClick:()=>i(n),className:(0,d.cn)("relative flex items-center gap-1.5 px-4 py-2 text-xs font-medium transition-colors",s?"text-violet-700 dark:text-violet-300":"text-muted-foreground hover:text-foreground"),children:[o?(0,t.jsx)(C.Check,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}):(0,t.jsxs)("span",{className:"text-muted-foreground/50 text-[10px]",children:[n+1,"."]}),e.header,s?(0,t.jsx)("span",{className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-violet-600 dark:bg-violet-400"}):null]},e.question)})}),e.map((e,n)=>(0,t.jsx)("div",{className:"px-4 py-3",style:{display:n===r?void 0:"none"},children:(0,t.jsx)(tv,{question:e,selection:s[e.question],onSelectionChange:t=>a(e.question,t)})},e.question)),(0,t.jsxs)("div",{className:"flex items-center gap-3 border-t border-violet-200 px-4 py-2.5 dark:border-violet-500/20",children:[(0,t.jsxs)("button",{type:"button",onClick:c,disabled:!u,className:(0,d.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",u?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(C.Check,{className:"h-3 w-3"}),"Submit all"]}),(0,t.jsxs)("span",{className:"text-muted-foreground text-[10px]",children:[Object.keys(l).length,"/",e.length," answered"]})]})]})}function tv({question:e,selection:n,onSelectionChange:r}){let i=(0,j.useCallback)(t=>{r(n=>{let r=new Set(n.selectedOptions);return e.multiSelect?(r.has(t)?r.delete(t):r.add(t),{...n,selectedOptions:r}):(r.clear(),r.add(t),{...n,selectedOptions:r,isOtherSelected:!1})})},[e.multiSelect,r]),s=(0,j.useCallback)(()=>{r(t=>e.multiSelect?{...t,isOtherSelected:!t.isOtherSelected}:{selectedOptions:new Set,otherText:t.otherText,isOtherSelected:!0})},[e.multiSelect,r]),o=(0,j.useCallback)(e=>{r(t=>({...t,otherText:e}))},[r]);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-foreground mb-2 text-xs font-medium",children:[e.question,e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground ml-1 font-normal",children:"(select multiple)"}):null]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[e.options.map(r=>(0,t.jsx)(tw,{option:r,isSelected:n.selectedOptions.has(r.label),isMulti:e.multiSelect,onToggle:()=>i(r.label)},r.label)),(0,t.jsx)(tS,{isSelected:n.isOtherSelected,isMulti:e.multiSelect,text:n.otherText,onToggle:s,onTextChange:o})]})]})}function tk({question:e,onSubmit:n}){let[r,i]=(0,j.useState)(new Set),[s,o]=(0,j.useState)(""),[a,l]=(0,j.useState)(!1),u=(0,j.useCallback)(t=>{i(n=>{let r=new Set(n);return e.multiSelect?r.has(t)?r.delete(t):r.add(t):(r.clear(),r.add(t),l(!1)),r}),e.multiSelect||l(!1)},[e.multiSelect]),c=(0,j.useCallback)(()=>{e.multiSelect?l(e=>!e):(i(new Set),l(!0))},[e.multiSelect]),h=(0,j.useCallback)(()=>{let t=[...r];a&&s.trim()&&t.push(s.trim()),0!==t.length&&n({[e.question]:t.join(", ")})},[r,a,s,n,e.question]),p=r.size>0||a&&s.trim();return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"mb-2 flex items-start gap-2",children:[(0,t.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-violet-100 px-2 py-0.5 text-[10px] font-semibold tracking-wider text-violet-700 uppercase dark:bg-violet-900/50 dark:text-violet-300",children:e.header}),(0,t.jsx)("span",{className:"font-medium",children:e.question})]}),(0,t.jsxs)("div",{className:"ml-0.5 flex flex-col gap-1.5",children:[e.options.map(n=>(0,t.jsx)(tw,{option:n,isSelected:r.has(n.label),isMulti:e.multiSelect,onToggle:()=>u(n.label)},n.label)),(0,t.jsx)(tS,{isSelected:a,isMulti:e.multiSelect,text:s,onToggle:c,onTextChange:o})]}),(0,t.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:h,disabled:!p,className:(0,d.cn)("inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-medium transition-all",p?"bg-violet-600 text-white shadow-sm hover:bg-violet-700 active:scale-[0.98] dark:bg-violet-600 dark:hover:bg-violet-500":"bg-muted text-muted-foreground cursor-not-allowed opacity-50"),children:[(0,t.jsx)(C.Check,{className:"h-3 w-3"}),"Submit"]}),e.multiSelect?(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Select one or more"}):null]})]})}function tw({option:e,isSelected:n,isMulti:r,onToggle:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,d.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-left text-xs transition-all",n?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 hover:bg-violet-50 dark:hover:border-violet-500/30 dark:hover:bg-violet-900/10"),children:[(0,t.jsx)("span",{className:(0,d.cn)("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center border transition-colors",r?"rounded":"rounded-full",n?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:n?(0,t.jsx)(C.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,t.jsx)("span",{className:(0,d.cn)("font-medium",n&&"text-violet-700 dark:text-violet-300"),children:e.label}),(0,t.jsx)("span",{className:"text-muted-foreground text-[11px] leading-snug",children:e.description})]})]})}function tS({isSelected:e,isMulti:n,text:r,onToggle:i,onTextChange:s}){return(0,t.jsxs)("div",{className:(0,d.cn)("flex items-start gap-2.5 rounded-lg border px-3 py-2 text-xs transition-all",e?"border-violet-300 bg-violet-100/60 shadow-sm dark:border-violet-500/40 dark:bg-violet-900/30":"border-border/50 hover:border-violet-300 dark:hover:border-violet-500/30"),children:[(0,t.jsx)("button",{type:"button",onClick:i,className:"mt-0.5 shrink-0",children:(0,t.jsx)("span",{className:(0,d.cn)("flex h-4 w-4 items-center justify-center border transition-colors",n?"rounded":"rounded-full",e?"border-violet-600 bg-violet-600 dark:border-violet-500 dark:bg-violet-500":"border-muted-foreground/30"),children:e?(0,t.jsx)(C.Check,{className:"h-2.5 w-2.5 text-white",strokeWidth:3}):null})}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,t.jsx)("span",{className:(0,d.cn)("font-medium",e&&"text-violet-700 dark:text-violet-300"),children:"Other"}),e?(0,t.jsx)("input",{type:"text",value:r,onChange:e=>s(e.target.value),placeholder:"Type your answer...",className:"w-full rounded-md border border-violet-200 bg-white/80 px-2 py-1 text-xs outline-none focus:border-violet-400 focus:ring-1 focus:ring-violet-300/30 dark:border-violet-500/30 dark:bg-violet-950/30 dark:focus:border-violet-500/50 dark:focus:ring-violet-500/20",autoFocus:!0}):null]})]})}e.s(["InteractionBubble",()=>tb],673138);var t_=e.i(291967),tC=e.i(922528),tj=e.i(936589),tE=e.i(305192),tT=e.i(205978),tI=e.i(287620),tA=e.i(685995),tN=e.i(713123),tM="Collapsible",[tR,tP]=(0,tC.createContextScope)(tM),[tD,tO]=tR(tM),tF=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,open:i,defaultOpen:s,disabled:o,onOpenChange:a,...l}=e,[u,c]=(0,tj.useControllableState)({prop:i,defaultProp:s??!1,onChange:a,caller:tM});return(0,t.jsx)(tD,{scope:r,disabled:o,contentId:(0,tN.useId)(),open:u,onOpenToggle:j.useCallback(()=>c(e=>!e),[c]),children:(0,t.jsx)(tI.Primitive.div,{"data-state":tq(u),"data-disabled":o?"":void 0,...l,ref:n})})});tF.displayName=tM;var tL="CollapsibleTrigger",tB=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,...i}=e,s=tO(tL,r);return(0,t.jsx)(tI.Primitive.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":tq(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...i,ref:n,onClick:(0,t_.composeEventHandlers)(e.onClick,s.onOpenToggle)})});tB.displayName=tL;var tz="CollapsibleContent",t$=j.forwardRef((e,n)=>{let{forceMount:r,...i}=e,s=tO(tz,e.__scopeCollapsible);return(0,t.jsx)(tA.Presence,{present:r||s.open,children:({present:e})=>(0,t.jsx)(tU,{...i,ref:n,present:e})})});t$.displayName=tz;var tU=j.forwardRef((e,n)=>{let{__scopeCollapsible:r,present:i,children:s,...o}=e,a=tO(tz,r),[l,u]=j.useState(i),c=j.useRef(null),d=(0,tT.useComposedRefs)(n,c),h=j.useRef(0),p=h.current,f=j.useRef(0),m=f.current,g=a.open||l,x=j.useRef(g),b=j.useRef(void 0);return j.useEffect(()=>{let e=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,tE.useLayoutEffect)(()=>{let e=c.current;if(e){b.current=b.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();h.current=t.height,f.current=t.width,x.current||(e.style.transitionDuration=b.current.transitionDuration,e.style.animationName=b.current.animationName),u(i)}},[a.open,i]),(0,t.jsx)(tI.Primitive.div,{"data-state":tq(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...o,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:g&&s})});function tq(e){return e?"open":"closed"}e.s(["Collapsible",()=>tF,"CollapsibleContent",()=>t$,"CollapsibleTrigger",()=>tB,"Content",()=>t$,"Root",()=>tF,"Trigger",()=>tB,"createCollapsibleScope",()=>tP],975074);var tH=e.i(975074),tH=tH,tV=e.i(276016),tW=e.i(495812),tK=e.i(958481);let tG=(0,e.i(294237).cva)("animate-spinner inline-block rounded-full",{variants:{size:{sm:"size-4",md:"size-6",lg:"size-10"}},defaultVariants:{size:"md"}}),tJ={sm:"3px",md:"4px",lg:"8px"};function tQ({className:e,size:n="md",...r}){let i=tJ[n??"md"];return(0,t.jsx)("div",{"data-slot":"spinner",role:"status","aria-label":"Loading",className:(0,d.cn)(tG({size:n}),e),style:{background:"conic-gradient(from 220deg, transparent 0%, currentColor 80%, transparent 100%)",WebkitMask:`radial-gradient(farthest-side, #0000 calc(100% - ${i}), #000 calc(100% - ${i} + 1px))`},...r})}let tY={p:({children:e})=>(0,t.jsx)("p",{className:"mb-2 leading-relaxed last:mb-0",children:e}),strong:({children:e})=>(0,t.jsx)("strong",{className:"font-semibold",children:e}),em:({children:e})=>(0,t.jsx)("em",{className:"italic",children:e}),code:({children:e,className:n})=>n?(0,t.jsx)("code",{className:`${n} text-[11px]`,children:e}):(0,t.jsx)("code",{className:"bg-background/50 rounded-md px-1.5 py-0.5 font-mono text-[11px]",children:e}),pre:({children:e})=>(0,t.jsx)("pre",{className:"bg-background/50 my-2 overflow-x-auto rounded-md p-3 font-mono text-[11px] leading-relaxed",children:e}),ul:({children:e})=>(0,t.jsx)("ul",{className:"mb-2 list-disc ps-4 last:mb-0",children:e}),ol:({children:e})=>(0,t.jsx)("ol",{className:"mb-2 list-decimal ps-4 last:mb-0",children:e}),li:({children:e})=>(0,t.jsx)("li",{className:"mb-0.5",children:e}),h1:({children:e})=>(0,t.jsx)("h1",{className:"mb-1 text-sm font-bold",children:e}),h2:({children:e})=>(0,t.jsx)("h2",{className:"mb-1 text-sm font-bold",children:e}),h3:({children:e})=>(0,t.jsx)("h3",{className:"mb-1 text-xs font-semibold",children:e}),a:({children:e,href:n})=>(0,t.jsx)("a",{href:n,className:"text-blue-500 underline",target:"_blank",rel:"noopener noreferrer",children:e})};function tX({steps:e,className:n,collapsedSummary:r,activeStepId:i,liveStatus:s,onRetry:o,onForceStop:a}){let[l,u]=(0,j.useState)(!1);if(0===e.length)return null;if(r&&!l){let r=e.filter(e=>"done"===e.status).length;return(0,t.jsx)("div",{className:(0,d.cn)("p-4",n),children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:"hover:bg-muted/40 border-border bg-background flex w-full items-center gap-3 rounded-lg border px-3 py-2.5 text-left transition-colors dark:bg-neutral-800/50",children:[(0,t.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(C.Check,{className:"h-4 w-4",strokeWidth:3})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:"Initial setup complete"}),(0,t.jsxs)("div",{className:"text-muted-foreground text-xs",children:[r," of ",e.length," steps finished — click to review"]})]}),(0,t.jsx)(tV.ChevronRight,{className:"text-muted-foreground h-4 w-4 shrink-0"})]})})}let c=function(e){let t=null,n=null,r=0,i=0,s=0;for(let o of e){null!==o.startedAt&&(t=null===t?o.startedAt:Math.min(t,o.startedAt));let e="running"===o.status?Date.now():o.finishedAt??null;null!==e&&(n=null===n?e:Math.max(n,e)),r+=t2(o.metadata,"costUsd"),i+=t2(o.metadata,"inputTokens"),s+=t2(o.metadata,"outputTokens")}return null===t||null===n?null:{durationMs:Math.max(0,n-t),costUsd:r,inputTokens:i,outputTokens:s}}(e);return(0,t.jsxs)("ol",{className:(0,d.cn)("flex flex-col gap-2 p-4",n),children:[r?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!1),className:"text-muted-foreground hover:text-foreground mb-1 inline-flex items-center gap-1 text-[10px] tracking-wide uppercase",children:[(0,t.jsx)(w.ChevronDown,{className:"h-3 w-3"}),"Collapse setup"]})}):null,e.map((e,n)=>(0,t.jsx)(t0,{step:e,liveStatus:e.definition.id===i?s??null:null,mountIndex:n,onRetry:"interrupted"===e.status?o:void 0,onForceStop:a},e.definition.id)),c?(0,t.jsxs)("li",{className:"border-border/40 text-muted-foreground mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 border-t pt-3 text-[10px] tracking-wide uppercase",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Total"}),(0,t.jsx)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:t3(c.durationMs)})]}),c.costUsd>0?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Cost"}),(0,t.jsx)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:t4(c.costUsd)})]}):null,c.inputTokens>0||c.outputTokens>0?(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-muted-foreground/70",children:"Tokens"}),(0,t.jsxs)("span",{className:"text-foreground font-semibold tracking-normal normal-case",children:[t6(c.inputTokens)," in · ",t6(c.outputTokens)," out"]})]}):null]}):null]})}let tZ="Output";function t0({step:e,liveStatus:n,mountIndex:r,onRetry:i,onForceStop:s}){let[o,a]=(0,j.useState)(!1),[u,c]=(0,j.useState)(!1);(0,j.useEffect)(()=>{"interrupted"!==e.status&&a(!1)},[e.status]),(0,j.useEffect)(()=>{"running"!==e.status&&"pending"!==e.status&&c(!1)},[e.status]);let f=u?"interrupted":o?"running":e.status,[m,g]=(0,j.useState)("interrupted"===e.status||"failed"===e.status),{definition:x,metadata:b,toolMessages:y}=e,v=function(e,t){if(!e)return[];let n=e[t];return Array.isArray(n)?n.filter(e=>"string"==typeof e):[]}(b,"details"),w=function(e,t){if(!e)return"";let n=e[t];return"string"==typeof n?n:""}(b,"error"),S=function(e){let t=e.map(e=>{let t=e.content?.trim()??"";return{message:e,content:t,event:t?(0,p.parseToolEvent)(t):null}}).filter(e=>e.content.length>0),n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.event?.kind==="tool"&&"Thinking"===r.event.name){n.push({kind:"thinking",message:r.message});continue}if(r.event?.kind==="tool"&&r.event.name===tZ){n.push({kind:"tool",message:r.message,output:null});continue}if(r.event?.kind==="tool"){let i=t[e+1],s=i?.event?.kind==="tool"&&i.event.name===tZ;n.push({kind:"tool",message:r.message,output:s?i.message:null}),s&&e++;continue}if(r.event?.kind==="label-only"){n.push({kind:"tool",message:r.message,output:null});continue}n.push({kind:"text",message:r.message})}return n}(y),_=function(e,t){let[n,r]=(0,j.useState)(0);return((0,j.useEffect)(()=>{if("running"!==t||null===e.startedAt)return;let n=setInterval(()=>r(e=>e+1),1e3);return()=>clearInterval(n)},[t,e.startedAt]),null===e.startedAt)?null:"running"===t?Math.max(0,Date.now()-e.startedAt):null===e.finishedAt?null:Math.max(0,e.finishedAt-e.startedAt)}(e,f),C=t2(b,"costUsd"),E=t2(b,"inputTokens"),T=t2(b,"outputTokens"),I=S.length>0||v.length>0||!!w||"interrupted"===f;return(0,t.jsx)(tH.Root,{asChild:!0,open:m,onOpenChange:g,children:(0,t.jsxs)("li",{className:(0,d.cn)("rounded-lg border transition-[background-color,border-color] duration-300 ease-out","animate-in fade-in-0 slide-in-from-top-2","running"===f&&"border-violet-500/40 bg-violet-500/5 dark:bg-violet-500/10","done"===f&&"border-border bg-background dark:bg-neutral-800/50","pending"===f&&"border-border/40 bg-muted/20 dark:bg-neutral-800/30","failed"===f&&"border-red-500/40 bg-red-500/5 dark:bg-red-500/10","interrupted"===f&&"border-amber-500/40 bg-amber-500/5 dark:bg-amber-500/10"),style:{animationDelay:`${40*Math.min(r,6)}ms`,animationDuration:"300ms"},children:[(0,t.jsx)(tH.Trigger,{asChild:!0,children:(0,t.jsxs)("button",{type:"button",disabled:!I,className:(0,d.cn)("flex w-full items-center gap-3 px-3 py-1.5 text-left transition-colors duration-200",I&&"hover:bg-muted/40 cursor-pointer",!I&&"cursor-default"),children:[(0,t.jsx)(t5,{status:f}),(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-baseline gap-2",children:[(0,t.jsx)("span",{className:(0,d.cn)("shrink-0 truncate text-sm font-medium transition-colors duration-300","pending"===f&&"text-muted-foreground/60"),children:x.title}),"interrupted"===f?(0,t.jsx)("span",{className:"min-w-0 truncate text-xs font-medium text-amber-600 dark:text-amber-400",children:"Interrupted"}):n&&"running"===f?(0,t.jsxs)("span",{className:"flex min-w-0 items-baseline gap-1.5 text-xs text-violet-700 dark:text-violet-300",children:[(0,t.jsx)("span",{className:"inline-flex h-1 w-1 shrink-0 translate-y-[-1px] animate-pulse rounded-full bg-violet-500"}),(0,t.jsx)("span",{className:"animate-in fade-in-0 slide-in-from-left-1 truncate duration-300",children:n},n)]}):x.description?(0,t.jsx)("span",{className:(0,d.cn)("min-w-0 truncate text-xs font-normal","pending"===f?"text-muted-foreground/40":"text-muted-foreground/70"),children:x.description}):null]}),null!==_?(0,t.jsx)("span",{className:(0,d.cn)("shrink-0 text-[10px] font-medium tabular-nums transition-colors duration-300","running"===f?"text-violet-600 dark:text-violet-300":"text-muted-foreground/70"),title:`Step duration — ${t3(_)}`,children:t3(_)}):null,s&&("running"===f||"pending"===f)?(0,t.jsx)("span",{role:"button",tabIndex:0,"aria-label":"Force stop this step",title:"Force stop this step (mark as interrupted)",onClick:t=>{t.stopPropagation(),t.preventDefault(),c(!0),s(e.definition.id)},onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.stopPropagation(),t.preventDefault(),c(!0),s(e.definition.id))},className:"text-muted-foreground/50 hover:bg-muted/60 hover:text-foreground focus-visible:ring-ring/50 inline-flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded-md transition-colors focus-visible:ring-2 focus-visible:outline-none",children:(0,t.jsx)(k.X,{className:"h-3 w-3",strokeWidth:2.5})}):null,S.length>0?(0,t.jsx)("span",{className:"text-muted-foreground/60 animate-in fade-in-0 zoom-in-95 mr-1 shrink-0 text-[10px] tabular-nums duration-200",children:S.length},S.length):null,I?(0,t.jsx)(tV.ChevronRight,{className:(0,d.cn)("text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200 ease-out",m&&"rotate-90")}):null]})}),(0,t.jsx)(tH.Content,{className:(0,d.cn)("overflow-hidden","data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up"),children:(0,t.jsxs)("div",{className:"border-border/40 space-y-2 border-t px-3 py-2.5 text-xs",children:["interrupted"!==f||w?null:(0,t.jsxs)("div",{className:"flex items-center justify-between rounded bg-amber-500/10 p-2",children:[(0,t.jsx)("span",{className:"text-amber-700 dark:text-amber-400",children:"This step was interrupted before it could finish."}),i?(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),a(!0),g(!1),i()},className:"ms-3 shrink-0 cursor-pointer rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-1 text-[11px] font-medium text-amber-700 transition-colors hover:bg-amber-500/20 dark:text-amber-400",children:"Continue"}):null]}),w?(0,t.jsx)("p",{className:"rounded bg-red-500/10 p-2 text-red-600 dark:text-red-400",children:w}):null,v.length>0?(0,t.jsx)("ul",{className:"text-muted-foreground list-disc space-y-0.5 ps-4",children:v.map(e=>(0,t.jsx)("li",{children:e},e))}):null,C>0||E>0||T>0?(0,t.jsxs)("div",{className:"text-muted-foreground/70 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[10px] tabular-nums",children:[C>0?(0,t.jsx)("span",{children:t4(C)}):null,E>0||T>0?(0,t.jsxs)("span",{children:[t6(E)," in · ",t6(T)," out"]}):null]}):null,S.length>0?(0,t.jsx)("div",{className:"-mx-1 flex flex-col gap-1",children:S.map((e,n)=>{let r={animationDelay:`${30*Math.min(n,6)}ms`};return"thinking"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)(t1,{text:e.message.content})},e.message.id):"tool"===e.kind?(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)(h.ToolBubble,{text:e.message.content,outputText:e.output?.content})},e.message.id):(0,t.jsx)("div",{className:"animate-in fade-in-0 slide-in-from-top-1 duration-200",style:r,children:(0,t.jsx)("div",{className:"border-border/60 bg-background text-foreground rounded-md border px-2.5 py-1.5 text-xs leading-relaxed dark:bg-neutral-800/70",children:(0,t.jsx)(l.default,{components:tY,children:e.message.content})})},e.message.id)})}):null]})})]})})}function t1({text:e}){let n,[r,i]=(0,j.useState)(!1),s=(n=(0,p.parseToolEvent)(e),n?.kind==="tool"&&"Thinking"===n.name?n.detail:e);return(0,t.jsxs)("div",{className:"flex max-w-full flex-col",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"text-muted-foreground/80 hover:text-foreground inline-flex items-center gap-1 self-start rounded px-1 py-0.5 text-[11px] italic transition-colors",children:[r?(0,t.jsx)(w.ChevronDown,{className:"h-3 w-3 shrink-0 opacity-60"}):(0,t.jsx)(tV.ChevronRight,{className:"h-3 w-3 shrink-0 opacity-60"}),(0,t.jsx)("span",{children:"Thinking"})]}),r?(0,t.jsx)("p",{className:"text-muted-foreground/80 mt-0.5 ml-5 max-w-full text-[11px] leading-relaxed break-words whitespace-pre-wrap italic",children:s}):null]})}function t5({status:e}){return"running"===e?(0,t.jsx)(tQ,{size:"sm",className:"shrink-0 text-violet-500"}):"done"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500 text-white",children:(0,t.jsx)(C.Check,{className:"h-3 w-3",strokeWidth:3})}):"failed"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-red-500 text-white",children:(0,t.jsx)(tK.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):"interrupted"===e?(0,t.jsx)("div",{className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-amber-500 text-white",children:(0,t.jsx)(tK.AlertTriangle,{className:"h-2.5 w-2.5",strokeWidth:3})}):(0,t.jsx)(tW.Circle,{className:"text-muted-foreground/30 h-4 w-4 shrink-0"})}function t2(e,t){if(!e)return 0;let n=e[t];return"number"==typeof n&&Number.isFinite(n)?n:0}function t3(e){if(!Number.isFinite(e)||e<0)return"";if(e<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;if(n<60)return 0===r?`${n}m`:`${n}m ${r}s`;let i=Math.floor(n/60),s=n%60;return 0===s?`${i}h`:`${i}h ${s}m`}function t4(e){return!Number.isFinite(e)||e<=0?"$0":e<.01?`$${e.toFixed(4)}`:e<1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function t6(e){return!Number.isFinite(e)||e<=0?"0":e<1e3?String(Math.round(e)):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}e.s(["StepTracker",()=>tX],399746);var t9=e.i(435e3),t7=e.i(248109);function t8({id:e,title:n,assistantMessageCount:r,status:i,condensed:s,details:o,children:a}){let l="in-progress"===i,[u,c]=(0,j.useState)(l);(0,j.useEffect)(()=>{l||c(!1)},[l]);let h=`${e}-content`,p=l?s:o??a??null;return(0,t.jsxs)("div",{className:(0,d.cn)("mx-3 my-2 shrink-0 overflow-hidden rounded-lg border shadow-sm","animate-in fade-in-0 slide-in-from-top-1 duration-200 ease-out",l?"border-fuchsia-500/40 bg-gradient-to-br from-fuchsia-500/5 via-purple-500/5 to-sky-500/5":"border-border/60 bg-card/40"),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>c(e=>!e),"aria-expanded":u,"aria-controls":h,className:(0,d.cn)("group flex min-h-12 w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left transition-colors","hover:bg-muted/50"),children:[(0,t.jsx)("span",{className:(0,d.cn)("flex h-5 w-5 shrink-0 items-center justify-center rounded-full",l?"bg-gradient-to-br from-fuchsia-500 via-purple-500 to-sky-500 text-white shadow-sm":"bg-emerald-500/15"),children:l?(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}):(0,t.jsx)(t9.CheckCircle2,{className:"h-3 w-3 text-emerald-500"})}),(0,t.jsx)("span",{className:(0,d.cn)("min-w-0 flex-1 truncate text-[12px] font-medium",l?"text-fuchsia-700 dark:text-fuchsia-300":"text-foreground"),children:l?"Working on your request…":n}),r>0?(0,t.jsxs)("span",{className:"text-muted-foreground inline-flex shrink-0 items-center gap-1 text-[10px]",children:[(0,t.jsx)(t7.MessageSquare,{className:"h-3 w-3"}),r]}):null,(0,t.jsx)(w.ChevronDown,{className:(0,d.cn)("text-muted-foreground h-3.5 w-3.5 shrink-0 transition-transform",u&&"rotate-180")})]}),u&&p?(0,t.jsx)("div",{id:h,className:(0,d.cn)("border-t px-3 py-2",l?"bg-background/60 border-fuchsia-500/20":"border-border/60 bg-background/40"),children:p}):null]})}function ne(e,t){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function nt(e){if(e instanceof Date)return e.getTime();if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e){let t=Number(e);if(Number.isFinite(t))return t;let n=new Date(e).getTime();return Number.isFinite(n)?n:0}return 0}function nn(e,t){return(0,j.useMemo)(()=>(function(e,t=!0){let n=e.filter(e=>!e.stepId);if(0===n.length)return{groups:[],currentTurn:null,hiddenMessageIds:[]};let r=[],i=null;for(let e of n)e.role===to.InteractiveMessageRole.user?(i={user:e,items:[e]},r.push(i)):i&&i.items.push(e);if(0===r.length)return{groups:[],currentTurn:null,hiddenMessageIds:[]};let s=(e,t)=>{let n=e.items[0],r=e.items[e.items.length-1],i=e.user.content??"";return{id:`turn-${e.user.id}`,title:function(e){let t=e.trim().replace(/\s+/g," ");if(0===t.length)return"Working on your request";let n=ne(t,120);return ne(`Working on: ${n}`,140)}(i),userMessagePreview:ne(i.trim().replace(/\s+/g," "),120),messageIds:e.items.map(e=>e.id),assistantMessageCount:e.items.filter(e=>e.role===to.InteractiveMessageRole.assistant).length,startedAt:nt(n.createdAt),endedAt:nt(r.createdAt),status:t}},o=r[r.length-1];if(t){let e=r.slice(0,-1).map(e=>s(e,"completed")),t=s(o,"in-progress"),n=[...e.flatMap(e=>e.messageIds),...t.messageIds];return{groups:e,currentTurn:t,hiddenMessageIds:n}}let a=r.map(e=>s(e,"completed")),l=a.flatMap(e=>e.messageIds);return{groups:a,currentTurn:null,hiddenMessageIds:l}})(e,t),[e,t])}function nr({group:e,allMessages:n,streaming:r}){let i=new Map;for(let e of n)i.set(e.id,e);if("in-progress"!==e.status)return(0,t.jsx)(t8,{id:e.id,title:e.title,status:"completed",assistantMessageCount:e.assistantMessageCount,children:(0,t.jsx)(ni,{messageIds:e.messageIds,byId:i})});let s=e.messageIds.find(e=>{let t=i.get(e);return t?.role===to.InteractiveMessageRole.user}),o=s?i.get(s):null,a=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[o?(0,t.jsxs)("div",{className:"text-foreground border-l-2 border-violet-500/50 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:"You"}),o.content]}):null,r?(0,t.jsx)(no,{streaming:r}):null]}),l=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(ni,{messageIds:e.messageIds,byId:i}),r?(0,t.jsx)(ns,{streaming:r}):null]});return(0,t.jsx)(t8,{id:e.id,title:e.title,status:"in-progress",assistantMessageCount:e.assistantMessageCount,condensed:a,details:l})}function ni({messageIds:e,byId:n}){return(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{let r=n.get(e);if(!r)return(0,t.jsx)("div",{className:"text-muted-foreground/50 text-[11px] italic",children:"…"},e);let i=r.role===to.InteractiveMessageRole.user;return(0,t.jsxs)("div",{className:i?"text-foreground border-l-2 border-violet-500/50 pl-2 text-[12px] whitespace-pre-wrap":"text-foreground/90 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:i?"You":"Assistant"}),r.content]},e)})})}function ns({streaming:e}){let n=e.text.trim().length>0,r=(e.statusLog??"").trim().length>0,i="booting"===e.sessionStatus;return n?(0,t.jsxs)("div",{className:"text-foreground/90 pl-2 text-[12px] whitespace-pre-wrap",children:[(0,t.jsx)("div",{className:"text-muted-foreground/70 mb-0.5 text-[10px] font-medium tracking-wide uppercase",children:"Assistant"}),e.text,r?(0,t.jsxs)("div",{className:"text-muted-foreground mt-1 inline-flex items-center gap-1 text-[10px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),e.statusLog]}):null]}):r?(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),e.statusLog]}):e.awaiting||i?(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),i?"Agent is waking up…":"Thinking…"]}):null}function no({streaming:e}){let n,r=(e.statusLog??"").trim().length>0,i=e.text.trim().length>0,s="booting"===e.sessionStatus;if(r)n=e.statusLog??"Working…";else if(e.awaiting||s)n=s?"Agent is waking up…":"Thinking…";else{if(!i)return null;n="Working…"}return(0,t.jsxs)("div",{className:"text-muted-foreground inline-flex items-center gap-1.5 pl-2 text-[11px] italic",children:[(0,t.jsx)(_.Loader2,{className:"h-3 w-3 animate-spin"}),n]})}e.s(["SingleTurnCard",()=>nr,"useTurnGroupsView",()=>nn],628164);let na=(0,e.i(903645).default)("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);e.s(["Cloud",()=>na],941275)},113367,e=>{"use strict";var t=e.i(530090);e.s(["XCircle",()=>t.default])},928112,561068,e=>{"use strict";e.i(54101);var t=e.i(679606),n=e.i(152155);e.i(541001);var r=e.i(64780),i=e.i(819645),s=e.i(267669),o=e.i(418532),a=e.i(958481),l=e.i(43416),u=e.i(131777),c=e.i(915109),d=e.i(731151),h=e.i(684408),p=e.i(684632),f=e.i(41413),m=e.i(323217),g=e.i(461152),x=e.i(673138),b=e.i(399746),y=e.i(628164),v=e.i(962885),k=e.i(435e3),w=e.i(99105),S=e.i(941275),_=e.i(382569),C=e.i(83428),j=e.i(113367),E=e.i(317406);let T=["Starting GitHub repository creation","Starting deploy to ","Starting save & backup"];function I(e){if(0===e.length)return[];let t=[],n=[];for(let r of e)(function(e){return T.some(t=>e.startsWith(t))})(r.message)&&n.length>0&&(t.push(n),n=[]),n.push(r);return n.length>0&&t.push(n),t}let A={publish:E.OperationLogKind.GitRemoteCreate,deploy:E.OperationLogKind.CloudDeploy,sync:E.OperationLogKind.RepoSync},N={publish:{title:"Published to GitHub",inProgressTitle:"Publishing to GitHub…",icon:_.Github,idleAccent:"bg-sky-500/15 text-sky-500",liveGradient:"border-sky-500/40 bg-gradient-to-br from-sky-500/5 via-sky-500/5 to-cyan-500/5",liveChip:"bg-gradient-to-br from-sky-500 via-blue-500 to-cyan-500 text-white shadow-sm",liveText:"text-sky-700 dark:text-sky-300"},deploy:{title:"Deployed to cloud",inProgressTitle:"Deploying to cloud…",icon:S.Cloud,idleAccent:"bg-fuchsia-500/15 text-fuchsia-500",liveGradient:"border-fuchsia-500/40 bg-gradient-to-br from-fuchsia-500/5 via-purple-500/5 to-sky-500/5",liveChip:"bg-gradient-to-br from-fuchsia-500 via-purple-500 to-sky-500 text-white shadow-sm",liveText:"text-fuchsia-700 dark:text-fuchsia-300"},sync:{title:"Saved & pushed to GitHub",inProgressTitle:"Saving & pushing to GitHub…",icon:l.RefreshCw,idleAccent:"bg-emerald-500/15 text-emerald-500",liveGradient:"border-emerald-500/40 bg-gradient-to-br from-emerald-500/5 via-emerald-500/5 to-teal-500/5",liveChip:"bg-gradient-to-br from-emerald-500 via-teal-500 to-cyan-500 text-white shadow-sm",liveText:"text-emerald-700 dark:text-emerald-300"}};async function M(e,t){let n=A[t],r=await fetch(`/api/operations/${encodeURIComponent(n)}/${encodeURIComponent(e)}/logs`);return r.ok?await r.json():{entries:[]}}function R(e){if(0===e.length)return"empty";let t=e[e.length-1],n=new Date(t.createdAt).getTime();if(Date.now()-n<1e4)return"in-progress";switch(t.level){case"Error":return"failed";case"Warn":return"warn";default:return"success"}}function P(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function D(e,t){let{data:r}=(0,v.useQuery)({queryKey:["operation-logs",e??"",t],queryFn:()=>e?M(e,t):Promise.resolve({entries:[]}),enabled:!!e,refetchInterval:e=>{let t=e.state.data?.entries??[];if(0===t.length)return 2500;let n=I(t);return"in-progress"===R(n[n.length-1]??[])?1500:2500},staleTime:0});return(0,n.useMemo)(()=>I(r?.entries??[]).map((e,n)=>{let r=e[0];return{id:r?.id??`${t}-${n}`,kind:t,startedAt:r?new Date(r.createdAt).getTime():0,entries:e}}),[r,t])}function O({applicationId:e,kind:r,entries:i,runIndex:s}){let[o,a]=(0,n.useState)(!1),l=R(i),c=N[r],d=c.icon,h="in-progress"===l,p=`op-${r}-${e}-${s}`;return(0,t.jsxs)("div",{className:(0,u.cn)("mx-3 shrink-0 overflow-hidden","animate-in fade-in-0 duration-150 ease-out"),"data-testid":`operation-bubble-${r}`,children:[(0,t.jsxs)("button",{type:"button",onClick:()=>a(e=>!e),"aria-expanded":o,"aria-controls":p,className:(0,u.cn)("group flex w-full cursor-pointer items-center gap-2 rounded-md px-1.5 py-1 text-left transition-colors","hover:bg-muted/40"),children:[(0,t.jsx)("span",{className:(0,u.cn)("flex h-4 w-4 shrink-0 items-center justify-center",h?c.liveText:"text-muted-foreground"),children:h?(0,t.jsx)(C.Loader2,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(d,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("span",{className:(0,u.cn)("truncate text-[11px] font-medium",h?c.liveText:"text-foreground/90"),children:h?c.inProgressTitle:c.title}),(0,t.jsxs)("span",{className:"text-muted-foreground shrink-0 text-[10px]",children:["· ",i.length," event",1===i.length?"":"s"," ·"," ",P(i[0].createdAt)]}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)(F,{status:l}),(0,t.jsx)(w.ChevronDown,{className:(0,u.cn)("text-muted-foreground h-3 w-3 shrink-0 transition-transform",o&&"rotate-180")})]}),o?(0,t.jsx)("div",{id:p,className:"border-border/40 bg-background/30 mt-1 rounded-md border",children:(0,t.jsx)("ol",{className:"flex max-h-[28rem] flex-col gap-1 overflow-y-auto px-3 py-2.5",children:i.map(e=>(0,t.jsxs)("li",{className:"flex items-start gap-2 text-[11px] leading-relaxed",children:[(0,t.jsx)("span",{className:"text-muted-foreground/80 shrink-0 font-mono text-[10px]",children:P(e.createdAt)}),(0,t.jsx)(L,{level:e.level}),(0,t.jsxs)("span",{className:"text-foreground/90 min-w-0 flex-1 break-words whitespace-pre-wrap",children:[e.message,e.detail?(0,t.jsx)("span",{className:"text-muted-foreground/70 mt-0.5 block font-mono text-[10px] whitespace-pre-wrap",children:e.detail}):null]})]},e.id))})}):null]})}function F({status:e}){return"in-progress"===e?null:"success"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-emerald-500",children:[(0,t.jsx)(k.CheckCircle2,{className:"h-3 w-3"})," done"]}):"warn"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-amber-500",children:[(0,t.jsx)(a.AlertTriangle,{className:"h-3 w-3"})," warnings"]}):"failed"===e?(0,t.jsxs)("span",{className:"inline-flex shrink-0 items-center gap-1 text-[10px] text-rose-500",children:[(0,t.jsx)(j.XCircle,{className:"h-3 w-3"})," failed"]}):null}function L({level:e}){return(0,t.jsx)("span",{className:(0,u.cn)("mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full","Error"===e?"bg-rose-500":"Warn"===e?"bg-amber-500":"Debug"===e?"bg-muted-foreground/50":"bg-emerald-500")})}let B="scaffold";function z({featureId:e,applicationId:r,worktreePath:s,initialAgent:o,initialModel:a,initialChatState:l,hideHeader:u,onAllStepsComplete:v,workflowPlaceholder:k,onResumeWorkflow:w,scaffoldingState:S,applicationError:_}){let[C,j]=(0,n.useState)(o),[E,T]=(0,n.useState)(a);(0,n.useEffect)(()=>{C&&E||(0,p.getDefaultAgentAndModel)().then(e=>{j(t=>t??e.agentType),T(t=>t??e.model)})},[]);let[I,A]=(0,n.useState)(!1),N=(0,d.useAttachments)(),M=!!r,R=(0,n.useCallback)(e=>(0,h.composeUserInput)(e,N.completedAttachments.map(e=>({path:e.path,name:e.name,notes:e.notes}))),[N.completedAttachments]),{runtime:P,status:F,clearChat:L,sessionInfo:z,isChatLoading:H,pendingInteraction:V,respondToInteraction:W,stepProgress:K,rawMessages:G,streamingState:J}=(0,m.useChatRuntime)(e,s,{contentTransform:R,onMessageSent:N.clearAttachments,model:E,agentType:C,debugMode:I,initialChatState:l,pinInitialRequest:(k?.length??0)>0,hideAllMessages:M,suppressStreamingIndicator:M}),Q=!!(S?.status==="running"||K.hasPlan&&!K.allDone),Y=(0,y.useTurnGroupsView)(G,F.isRunning&&!Q),X=(()=>{if(Q)return{groups:[],currentTurn:null,hiddenMessageIds:[]};if(!S&&!K.hasPlan)return Y;let e=[...Y.groups];Y.currentTurn&&e.push(Y.currentTurn);let t=e.slice(1),n=null!==Y.currentTurn&&t.length>0?t[t.length-1]:null;return{groups:n?t.slice(0,-1):t,currentTurn:n,hiddenMessageIds:Y.hiddenMessageIds}})(),Z=D(r,"publish"),ee=D(r,"deploy"),et=D(r,"sync"),en=(()=>{let e=[];for(let t of X.groups)e.push({kind:"turn",id:t.id,startedAt:t.startedAt,turn:t});if(X.currentTurn){let t=X.currentTurn;e.push({kind:"turn",id:t.id,startedAt:t.startedAt,turn:t})}for(let t of Z)e.push({kind:"operation",id:`pub-${t.id}`,startedAt:t.startedAt,run:t});for(let t of ee)e.push({kind:"operation",id:`dep-${t.id}`,startedAt:t.startedAt,run:t});for(let t of et)e.push({kind:"operation",id:`syn-${t.id}`,startedAt:t.startedAt,run:t});return e.sort((e,t)=>e.startedAt-t.startedAt),e})(),er=(0,n.useRef)(!1),ei=(0,n.useRef)(v);ei.current=v,(0,n.useEffect)(()=>{K.allDone&&!er.current&&(er.current=!0,ei.current?.())},[K.allDone]);let es=(0,n.useCallback)(async e=>{if(!e.startsWith("placeholder-"))try{let t=await fetch(`/api/workflow-steps/${encodeURIComponent(e)}/force-stop`,{method:"POST"});t.ok||409===t.status||console.warn("[force-stop-step] request failed",t.status)}catch(e){console.warn("[force-stop-step] request error",e)}},[]),eo=(0,n.useCallback)(async()=>{try{let t=await fetch("/api/dialog/pick-files");if(!t.ok)return;let n=await t.json();if(!n.paths?.length)return;for(let t of n.paths){let n=await fetch("/api/attachments/upload-from-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,sessionId:`chat-${e}`})});if(!n.ok)continue;let r=await n.json();N.addAttachment(r)}}catch{}},[e,N.addAttachment]),ea=K.hasPlan?K.steps:(k??[]).filter(e=>e.stepKey!==B).map(e=>({definition:{id:`placeholder-${e.stepKey}`,stepKey:e.stepKey,title:e.title,description:e.description},status:"pending",metadata:null,toolMessages:[],startedAt:null,finishedAt:null})),el=(0,n.useRef)(null);K.hasPlan&&null==el.current&&(el.current=Date.now());let eu=S?{definition:{id:`placeholder-${B}`,stepKey:B,title:"Preparing your project",description:"Scaffolding the project tree and installing dependencies"},status:K.hasPlan?"done":S.status,metadata:S.error?{error:S.error}:null,toolMessages:[],startedAt:S.startedAt,finishedAt:S.finishedAt??(K.hasPlan?el.current:null)}:null,ec=eu?[eu,...ea]:ea,ed=ec.length>0,eh=K.hasPlan&&K.steps.some(e=>"running"===e.status),ep=(0,t.jsx)(g.ChatComposer,{disabled:eh,attachments:N.attachments,isDragOver:N.isDragOver,uploadError:N.uploadError,onDragEnter:N.handleDragEnter,onDragLeave:N.handleDragLeave,onDragOver:N.handleDragOver,onDrop:N.handleDrop,onPaste:N.handlePaste,onRemoveAttachment:N.removeAttachment,onNotesChange:N.updateNotes,onPickFiles:eo,agentPicker:(0,t.jsx)(f.AgentModelPicker,{initialAgentType:C??"",initialModel:E??"",mode:"override",onAgentModelChange:(e,t)=>{j(e),T(t)},className:"w-55",popoverSide:"top"})});return(0,t.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[u?null:(0,t.jsx)(q,{sessionInfo:z,isAgentActive:F.isRunning,onClear:L,debugMode:I,onDebugToggle:void 0}),(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col dark:bg-neutral-900/40",children:H?(0,t.jsx)(U,{}):(0,t.jsx)(i.AssistantRuntimeProvider,{runtime:P,children:(0,t.jsx)(c.Thread,{composer:ep,hideEmpty:ed,hideMessages:M,beforeMessages:(0,t.jsxs)(t.Fragment,{children:[_?(0,t.jsx)($,{state:_,onRetry:w}):null,ed?(0,t.jsx)(b.StepTracker,{steps:ec,collapsedSummary:!0===K.hasPlan&&!0===K.allDone,activeStepId:K.activeStepId,liveStatus:K.liveStatus,onRetry:w,onForceStop:es}):null,M?en.map((e,n)=>"turn"===e.kind&&e.turn?(0,t.jsx)(y.SingleTurnCard,{group:e.turn,allMessages:G,streaming:"in-progress"===e.turn.status?J:void 0},e.id):"operation"===e.kind&&e.run&&r?(0,t.jsx)(O,{applicationId:r,kind:e.run.kind,entries:e.run.entries,runIndex:n},e.id):null):null]}),afterMessages:V?(0,t.jsx)(x.InteractionBubble,{interaction:V,onSubmit:W}):null})})})]})}function $({state:e,onRetry:r}){let[i,s]=(0,n.useState)(!1),o=(0,n.useCallback)(()=>{if(r&&!i){s(!0);try{r()}finally{setTimeout(()=>s(!1),4e3)}}},[r,i]);return(0,t.jsx)("div",{className:(0,u.cn)("animate-in fade-in-0 slide-in-from-top-1 mx-3 my-3 shrink-0 overflow-hidden rounded-lg border shadow-sm duration-200 ease-out","border-red-500/40 bg-red-500/5 dark:bg-red-500/10"),role:"alert",children:(0,t.jsxs)("div",{className:"flex items-start gap-3 px-3 py-3",children:[(0,t.jsx)("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-red-500/15",children:(0,t.jsx)(a.AlertTriangle,{className:"h-3.5 w-3.5 text-red-500"})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("div",{className:"text-[13px] font-semibold text-red-700 dark:text-red-300",children:e.kind}),(0,t.jsx)("div",{className:"text-foreground/80 mt-0.5 text-[12px] leading-relaxed",children:e.message}),e.retryable&&r?(0,t.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[(0,t.jsxs)("button",{type:"button",onClick:o,disabled:i,className:(0,u.cn)("inline-flex h-7 items-center gap-1.5 rounded-md bg-red-500 px-3 text-[11px] font-semibold text-white transition-opacity",i?"cursor-not-allowed opacity-60":"cursor-pointer hover:opacity-90"),children:[(0,t.jsx)(l.RefreshCw,{className:(0,u.cn)("h-3 w-3",i&&"animate-spin")}),i?"Retrying…":"Try again"]}),(0,t.jsx)("span",{className:"text-muted-foreground text-[10px]",children:"Re-runs the last failed step"})]}):null]})]})})}function U(){return(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-3 p-4 pt-6",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-48 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-72 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-36 animate-pulse rounded-lg"})]})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-32 animate-pulse rounded-lg"})]}),(0,t.jsxs)("div",{className:"flex items-start gap-2.5",children:[(0,t.jsx)("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)("div",{className:"bg-muted h-4 w-56 animate-pulse rounded-lg"}),(0,t.jsx)("div",{className:"bg-muted h-4 w-64 animate-pulse rounded-lg"})]})]})]})}function q({sessionInfo:e,isAgentActive:n,onClear:i,debugMode:a,onDebugToggle:l}){let{t:u}=(0,r.useTranslation)("web");return(0,t.jsxs)("div",{className:"flex h-8 shrink-0 items-center border-b px-3",children:[(0,t.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:e?(0,t.jsxs)(t.Fragment,{children:[n?(0,t.jsx)("span",{className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):(0,t.jsx)(o.Cpu,{className:"text-muted-foreground/40 h-3 w-3 shrink-0"}),(0,t.jsxs)("span",{className:"text-muted-foreground font-mono text-[10px]",children:[e.model??"agent",e.sessionId?` \xb7 ${e.sessionId.slice(0,8)}`:""]})]}):(0,t.jsx)("span",{className:"text-muted-foreground/40 text-[11px]",children:u("chat.noSession")})}),(0,t.jsxs)("div",{className:"flex items-center gap-1 ps-2",children:[l?(0,t.jsxs)("label",{className:"text-muted-foreground/60 flex cursor-pointer items-center gap-1 text-[10px]",children:[(0,t.jsx)("input",{type:"checkbox",checked:a,onChange:e=>l(e.target.checked),className:"h-3 w-3 cursor-pointer rounded"}),"Debug"]}):null,(0,t.jsxs)(H,{onClick:()=>{i()},title:u("chat.clearChatHistory"),children:[(0,t.jsx)(s.Trash2,{className:"h-2.5 w-2.5"}),(0,t.jsx)("span",{children:u("chat.clear")})]})]})]})}function H({children:e,onClick:n,title:r,variant:i}){return(0,t.jsx)("button",{type:"button",onClick:n,title:r,className:(0,u.cn)("inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs transition-colors","danger"===i?"text-destructive hover:bg-destructive/10":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:e})}e.s(["APPLICATION_CREATION_PLACEHOLDER_STEPS",0,[{stepKey:"components",title:"Building the pieces",description:"Designing and creating polished reusable parts"},{stepKey:"wire",title:"Connecting everything",description:"Wiring navigation and forms"},{stepKey:"verify",title:"Double-checking",description:"Making sure it runs cleanly"},{stepKey:"commit",title:"Saving a snapshot",description:"Committing the initial build"},{stepKey:"report",title:"Your app is ready",description:"Summary of what was built"}],"SCAFFOLD_STEP_KEY",0,B],561068),e.s(["ChatTab",()=>z],928112)}]);
|