@saluzi/saluzi-edu 0.5.21 → 0.5.22
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/dist/cli.js +67 -63
- package/dist/guide/guide-data.json +174 -174
- package/dist/rcs-web/assets/AdminPanel-w39uutIr.js +1 -0
- package/dist/rcs-web/assets/ArtifactView-wUyXqsCU.js +1 -0
- package/dist/rcs-web/assets/{ArtifactsGallery-B63LTThv.js → ArtifactsGallery-DxVwQ8Wh.js} +15 -15
- package/dist/rcs-web/assets/Claim-D7HLQsN_.js +1 -0
- package/dist/rcs-web/assets/Dashboard-Bz-0-u1i.js +31 -0
- package/dist/rcs-web/assets/{Join-zelwrNDz.js → Join-CIaF_Ohx.js} +1 -1
- package/dist/rcs-web/assets/{Login-BmYeCfbw.js → Login-DNiG6cNe.js} +1 -1
- package/dist/rcs-web/assets/{Register-Dfw4S_A0.js → Register-CZ5iK6MO.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-HEE0RVF6.js +73 -0
- package/dist/rcs-web/assets/SessionVisibilityBadge-BY5tHU7b.js +16 -0
- package/dist/rcs-web/assets/{Setup-BTTET7Rk.js → Setup-CJerwA76.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-DaLDc5iV.js → ShareLanding-CgkypqyR.js} +1 -1
- package/dist/rcs-web/assets/TeamDetail-ChdJxhFx.js +6 -0
- package/dist/rcs-web/assets/TeamList-lVbIAJts.js +1 -0
- package/dist/rcs-web/assets/TeamSettings-Bk3T7qB1.js +1 -0
- package/dist/rcs-web/assets/UserSearchInput-nQ2jQJmj.js +6 -0
- package/dist/rcs-web/assets/UserSettings-BZP7lYFA.js +1 -0
- package/dist/rcs-web/assets/{arc-CPhgreP8.js → arc-BLA5f37u.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-CpAi-qzk.js → architectureDiagram-3BPJPVTR-GM4VEh2Q.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DcsxgO1K.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-C1u0Ojfk.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-BQ5cjzbZ.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-1cul6feX.js} +1 -1
- package/dist/rcs-web/assets/channel-C0wRu8mS.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-wa-oCiR6.js → chunk-2J33WTMH-CmySrkX6.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-D2ybEyPG.js → chunk-4BX2VUAB-EzctfdX5.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-CQGtwyGQ.js → chunk-55IACEB6-ClG1aobM.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D0ITaMeP.js → dist/rcs-web/assets/chunk-727SXJPM-D7CCqdxe.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BWRrcP1d.js → dist/rcs-web/assets/chunk-AQP2D5EJ-C12KuaNz.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-C-CaLwfI.js → chunk-FMBD7UC4-WFInUvtG.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-OPpmIsi8.js → chunk-ND2GUHAM-79eEElwS.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-Bq6R2yM7.js → chunk-QZHKN3VN-B2q3R-jr.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DdKmm0r6.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DdKmm0r6.js +1 -0
- package/{packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-BQf-xjVa.js → dist/rcs-web/assets/code-block-IT6T5CEO-BxkGH7r3.js} +1 -1
- package/dist/rcs-web/assets/{copy-lzYYFmlH.js → copy-CJUB1OCZ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-CuUSRgoZ.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-D77W33NX.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-BP4ZP_3D.js → dist/rcs-web/assets/dagre-BM42HDAG-DWSpM1Pp.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-XQnH0b9k.js → diagram-2AECGRRQ-BmjFx9zx.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-BnuYmMPD.js → diagram-5GNKFQAL-XJL0kjUS.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-LymV4oAW.js → dist/rcs-web/assets/diagram-KO2AKTUF-BD-qltFe.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-NSg5NWFp.js → diagram-LMA3HP47-CC9yXUQZ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-kVTMFgtZ.js → dist/rcs-web/assets/diagram-OG6HWLK6-CM4_62w2.js} +1 -1
- package/dist/rcs-web/assets/dialog-BnhKhSaK.js +1 -0
- package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-BJBTtX2s.js → erDiagram-TEJ5UH35-CLCbQ9SN.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-CcQXZNID.js → flowDiagram-I6XJVG4X-BRJxpd6c.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DW8iKyq_.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Q9D0n7zY.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BTBYx3LF.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-DfDoy86d.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-BRZAYc6t.js → infoDiagram-5YYISTIA-56dRcjZy.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-BYMQtEeD.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-BHdffIkI.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-aqx7w1db.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-CsEp1AVc.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-BxEHfP4O.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-_RE82LM5.js} +1 -1
- package/dist/rcs-web/assets/{linear-Chjw8hPE.js → linear-DDo4ZKYf.js} +1 -1
- package/dist/rcs-web/assets/main-BKohkTQG.css +1 -0
- package/dist/rcs-web/assets/{main-Dh-rPGBg.js → main-bwawHmb2.js} +15 -15
- package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-CrqI4db6.js → dist/rcs-web/assets/mermaid-VLURNSYL-BAWTa5p7.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-EjsI3GC3.js → mermaid.core-Bk3OUzLn.js} +5 -5
- package/dist/rcs-web/assets/{mindmap-definition-RKZ34NQL-D2rO_fGA.js → mindmap-definition-RKZ34NQL-Dn3-IrmG.js} +1 -1
- package/dist/rcs-web/assets/{notifications-WMIbgYDP.js → notifications-BV1MotN8.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-DDwJZfoh.js → pieDiagram-4H26LBE5-BevMVM81.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DDtqMwKx.js → quadrantDiagram-W4KKPZXB-ChsIQYAl.js} +1 -1
- package/dist/rcs-web/assets/{refresh-cw-l0u8pxJi.js → refresh-cw-CKRHMYj-.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-BtSk2-5u.js → dist/rcs-web/assets/requirementDiagram-4Y6WPE33-dsySOh5e.js} +1 -1
- package/dist/rcs-web/assets/{sankeyDiagram-5OEKKPKP-SDLDMxUT.js → sankeyDiagram-5OEKKPKP-DNR-vE3O.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-D7iAclg1.js → sequenceDiagram-3UESZ5HK-D3qAxHng.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Bxx23fZH.js → stateDiagram-AJRCARHV-BWhyLeMU.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-z1g82auz.js → stateDiagram-v2-BHNVJYJU-Cr7eEfN-.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-C8kBbm_V.js → timeline-definition-PNZ67QCA-iel9USPs.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CPldb1-R.js → vennDiagram-CIIHVFJN--VRUq03V.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-MCHB2fG7.js → dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-Mbg_c9zq.js} +1 -1
- package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-CHj-KmL6.js → xychartDiagram-2RQKCTM6-475G72ds.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/client-ip.test.ts +67 -0
- package/packages/remote-control-server/src/__tests__/teams.test.ts +44 -0
- package/packages/remote-control-server/src/client-ip.ts +57 -0
- package/packages/remote-control-server/src/db/sqlite.ts +22 -0
- package/packages/remote-control-server/src/routes/v1/environments.ts +4 -0
- package/packages/remote-control-server/src/routes/web/teams.ts +12 -1
- package/packages/remote-control-server/src/services/environment.ts +12 -0
- package/packages/remote-control-server/src/store.ts +37 -8
- package/packages/remote-control-server/src/types/api.ts +7 -0
- package/packages/remote-control-server/web/dist/assets/AdminPanel-w39uutIr.js +1 -0
- package/packages/remote-control-server/web/dist/assets/ArtifactView-wUyXqsCU.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-B63LTThv.js → ArtifactsGallery-DxVwQ8Wh.js} +15 -15
- package/packages/remote-control-server/web/dist/assets/Claim-D7HLQsN_.js +1 -0
- package/packages/remote-control-server/web/dist/assets/Dashboard-Bz-0-u1i.js +31 -0
- package/packages/remote-control-server/web/dist/assets/{Join-zelwrNDz.js → Join-CIaF_Ohx.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-BmYeCfbw.js → Login-DNiG6cNe.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-Dfw4S_A0.js → Register-CZ5iK6MO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-HEE0RVF6.js +73 -0
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-BY5tHU7b.js +16 -0
- package/packages/remote-control-server/web/dist/assets/{Setup-BTTET7Rk.js → Setup-CJerwA76.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-DaLDc5iV.js → ShareLanding-CgkypqyR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/TeamDetail-ChdJxhFx.js +6 -0
- package/packages/remote-control-server/web/dist/assets/TeamList-lVbIAJts.js +1 -0
- package/packages/remote-control-server/web/dist/assets/TeamSettings-Bk3T7qB1.js +1 -0
- package/packages/remote-control-server/web/dist/assets/UserSearchInput-nQ2jQJmj.js +6 -0
- package/packages/remote-control-server/web/dist/assets/UserSettings-BZP7lYFA.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{arc-CPhgreP8.js → arc-BLA5f37u.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-CpAi-qzk.js → architectureDiagram-3BPJPVTR-GM4VEh2Q.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-DcsxgO1K.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-C1u0Ojfk.js} +1 -1
- package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-BQ5cjzbZ.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-1cul6feX.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-C0wRu8mS.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-wa-oCiR6.js → chunk-2J33WTMH-CmySrkX6.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-D2ybEyPG.js → chunk-4BX2VUAB-EzctfdX5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-CQGtwyGQ.js → chunk-55IACEB6-ClG1aobM.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-D0ITaMeP.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-D7CCqdxe.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-BWRrcP1d.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-C12KuaNz.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-C-CaLwfI.js → chunk-FMBD7UC4-WFInUvtG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-OPpmIsi8.js → chunk-ND2GUHAM-79eEElwS.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-Bq6R2yM7.js → chunk-QZHKN3VN-B2q3R-jr.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DdKmm0r6.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DdKmm0r6.js +1 -0
- package/{dist/rcs-web/assets/code-block-IT6T5CEO-BQf-xjVa.js → packages/remote-control-server/web/dist/assets/code-block-IT6T5CEO-BxkGH7r3.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-lzYYFmlH.js → copy-CJUB1OCZ.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-CuUSRgoZ.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-D77W33NX.js} +1 -1
- package/{dist/rcs-web/assets/dagre-BM42HDAG-BP4ZP_3D.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-DWSpM1Pp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-XQnH0b9k.js → diagram-2AECGRRQ-BmjFx9zx.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BnuYmMPD.js → diagram-5GNKFQAL-XJL0kjUS.js} +1 -1
- package/{dist/rcs-web/assets/diagram-KO2AKTUF-LymV4oAW.js → packages/remote-control-server/web/dist/assets/diagram-KO2AKTUF-BD-qltFe.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-NSg5NWFp.js → diagram-LMA3HP47-CC9yXUQZ.js} +1 -1
- package/{dist/rcs-web/assets/diagram-OG6HWLK6-kVTMFgtZ.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-CM4_62w2.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/dialog-BnhKhSaK.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-BJBTtX2s.js → erDiagram-TEJ5UH35-CLCbQ9SN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-CcQXZNID.js → flowDiagram-I6XJVG4X-BRJxpd6c.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DW8iKyq_.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Q9D0n7zY.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BTBYx3LF.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-DfDoy86d.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-BRZAYc6t.js → infoDiagram-5YYISTIA-56dRcjZy.js} +1 -1
- package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-BYMQtEeD.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-BHdffIkI.js} +1 -1
- package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-aqx7w1db.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-CsEp1AVc.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-BxEHfP4O.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-_RE82LM5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-Chjw8hPE.js → linear-DDo4ZKYf.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-BKohkTQG.css +1 -0
- package/packages/remote-control-server/web/dist/assets/{main-Dh-rPGBg.js → main-bwawHmb2.js} +15 -15
- package/{dist/rcs-web/assets/mermaid-VLURNSYL-CrqI4db6.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-BAWTa5p7.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-EjsI3GC3.js → mermaid.core-Bk3OUzLn.js} +5 -5
- package/packages/remote-control-server/web/dist/assets/{mindmap-definition-RKZ34NQL-D2rO_fGA.js → mindmap-definition-RKZ34NQL-Dn3-IrmG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{notifications-WMIbgYDP.js → notifications-BV1MotN8.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-DDwJZfoh.js → pieDiagram-4H26LBE5-BevMVM81.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DDtqMwKx.js → quadrantDiagram-W4KKPZXB-ChsIQYAl.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{refresh-cw-l0u8pxJi.js → refresh-cw-CKRHMYj-.js} +1 -1
- package/{dist/rcs-web/assets/requirementDiagram-4Y6WPE33-BtSk2-5u.js → packages/remote-control-server/web/dist/assets/requirementDiagram-4Y6WPE33-dsySOh5e.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sankeyDiagram-5OEKKPKP-SDLDMxUT.js → sankeyDiagram-5OEKKPKP-DNR-vE3O.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-D7iAclg1.js → sequenceDiagram-3UESZ5HK-D3qAxHng.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Bxx23fZH.js → stateDiagram-AJRCARHV-BWhyLeMU.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-z1g82auz.js → stateDiagram-v2-BHNVJYJU-Cr7eEfN-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-C8kBbm_V.js → timeline-definition-PNZ67QCA-iel9USPs.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CPldb1-R.js → vennDiagram-CIIHVFJN--VRUq03V.js} +1 -1
- package/{dist/rcs-web/assets/wardleyDiagram-YWT4CUSO-MCHB2fG7.js → packages/remote-control-server/web/dist/assets/wardleyDiagram-YWT4CUSO-Mbg_c9zq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-CHj-KmL6.js → xychartDiagram-2RQKCTM6-475G72ds.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/AdminPanel-fsacwgfK.js +0 -1
- package/dist/rcs-web/assets/ArtifactView-DmMwrTRk.js +0 -1
- package/dist/rcs-web/assets/Claim-hOGNTz-n.js +0 -1
- package/dist/rcs-web/assets/Dashboard-BBIlAMpr.js +0 -6
- package/dist/rcs-web/assets/SessionDetail-zXHv84SV.js +0 -83
- package/dist/rcs-web/assets/SessionVisibilityBadge-DA_Sg1dx.js +0 -11
- package/dist/rcs-web/assets/TeamCreate-BWtaB-_Z.js +0 -1
- package/dist/rcs-web/assets/TeamDetail-Crmn6PaC.js +0 -6
- package/dist/rcs-web/assets/TeamList-B8Rob6VK.js +0 -1
- package/dist/rcs-web/assets/TeamSettings-CfRHolhe.js +0 -1
- package/dist/rcs-web/assets/UserSearchInput-DkaGgR76.js +0 -1
- package/dist/rcs-web/assets/UserSettings-D1oW7oVv.js +0 -1
- package/dist/rcs-web/assets/channel-DHj-rIRW.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DsAw9J1B.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DsAw9J1B.js +0 -1
- package/dist/rcs-web/assets/dialog-DrDf89nL.js +0 -1
- package/dist/rcs-web/assets/main-CJvwpIVn.css +0 -1
- package/packages/remote-control-server/web/dist/assets/AdminPanel-fsacwgfK.js +0 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-DmMwrTRk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Claim-hOGNTz-n.js +0 -1
- package/packages/remote-control-server/web/dist/assets/Dashboard-BBIlAMpr.js +0 -6
- package/packages/remote-control-server/web/dist/assets/SessionDetail-zXHv84SV.js +0 -83
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-DA_Sg1dx.js +0 -11
- package/packages/remote-control-server/web/dist/assets/TeamCreate-BWtaB-_Z.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamDetail-Crmn6PaC.js +0 -6
- package/packages/remote-control-server/web/dist/assets/TeamList-B8Rob6VK.js +0 -1
- package/packages/remote-control-server/web/dist/assets/TeamSettings-CfRHolhe.js +0 -1
- package/packages/remote-control-server/web/dist/assets/UserSearchInput-DkaGgR76.js +0 -1
- package/packages/remote-control-server/web/dist/assets/UserSettings-D1oW7oVv.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-DHj-rIRW.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DsAw9J1B.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DsAw9J1B.js +0 -1
- package/packages/remote-control-server/web/dist/assets/dialog-DrDf89nL.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-CJvwpIVn.css +0 -1
package/packages/remote-control-server/web/dist/assets/{main-Dh-rPGBg.js → main-bwawHmb2.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-
|
|
2
|
-
var yc=Object.defineProperty;var wc=(e,t,n)=>t in e?yc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>wc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as ft,j as d,R as sr,r as Qo,b as Cc,c as rr,d as Sc}from"./vendor-DE_-CLIE.js";import{_ as Ne}from"./preload-helper-BiaRt2Oj.js";import{m as kc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Jo(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Jo(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Zo(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Jo(e))&&(r&&(r+=" "),r+=t);return r}const Ac=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ec=(e,t)=>({classGroupId:e,validator:t}),ea=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fn="-",Gr=[],_c="arbitrary..",Tc=e=>{const t=Nc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Rc(a);const i=a.split(Fn),m=i[0]===""&&i.length>1?1:0;return ta(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?Ac(f,m):m:f||Gr}return n[a]||Gr}}},ta=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const f=ta(e,t+1,o);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Fn):e.slice(t).join(Fn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},Rc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?_c+r:void 0})(),Nc=e=>{const{theme:t,classGroups:n}=e;return jc(n,t)},jc=(e,t)=>{const n=ea();for(const r in e){const s=e[r];or(s,n,r,t)}return n},or=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const a=e[o];Mc(a,t,n,r)}},Mc=(e,t,n,r)=>{if(typeof e=="string"){Ic(e,t,n);return}if(typeof e=="function"){Pc(e,t,n,r);return}Dc(e,t,n,r)},Ic=(e,t,n)=>{const r=e===""?t:na(t,e);r.classGroupId=n},Pc=(e,t,n,r)=>{if(Oc(e)){or(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ec(n,e))},Dc=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let a=0;a<o;a++){const[i,m]=s[a];or(m,na(t,i),n,r)}},na=(e,t)=>{let n=e;const r=t.split(Fn),s=r.length;for(let o=0;o<s;o++){const a=r[o];let i=n.nextPart.get(a);i||(i=ea(),n.nextPart.set(a,i)),n=i}return n},Oc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Lc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return s(o,a),a},set(o,a){o in n?n[o]=a:s(o,a)}}},Ls="!",qr=":",Fc=[],Kr=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),$c=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let a=0,i=0,m=0,f;const l=s.length;for(let b=0;b<l;b++){const y=s[b];if(a===0&&i===0){if(y===qr){o.push(s.slice(m,b)),m=b+1;continue}if(y==="/"){f=b;continue}}y==="["?a++:y==="]"?a--:y==="("?i++:y===")"&&i--}const c=o.length===0?s:s.slice(m);let u=c,h=!1;c.endsWith(Ls)?(u=c.slice(0,-1),h=!0):c.startsWith(Ls)&&(u=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Kr(o,h,u,g)};if(t){const s=t+qr,o=r;r=a=>a.startsWith(s)?o(a.slice(s.length)):Kr(Fc,!1,a,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},Uc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const a=n[o],i=a[0]==="[",m=t.has(a);i||m?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},zc=e=>({cache:Lc(e.cacheSize),parseClassName:$c(e),sortModifiers:Uc(e),postfixLookupClassGroupIds:Hc(e),...Tc(e)}),Hc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Bc=/\s+/,Wc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Bc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:u,modifiers:h,hasImportantModifier:g,baseClassName:b,maybePostfixModifierPosition:y}=n(c);if(u){f=c+(f.length>0?" "+f:f);continue}let v=!!y,E;if(v){const T=b.substring(0,y);E=r(T);const x=E&&a[E]?r(b):void 0;x&&x!==E&&(E=x,v=!1)}else E=r(b);if(!E){if(!v){f=c+(f.length>0?" "+f:f);continue}if(E=r(b),!E){f=c+(f.length>0?" "+f:f);continue}v=!1}const _=h.length===0?"":h.length===1?h[0]:o(h).join(":"),A=g?_+Ls:_,O=A+E;if(i.indexOf(O)>-1)continue;i.push(O);const k=s(E,v);for(let T=0;T<k.length;++T){const x=k[T];i.push(A+x)}f=c+(f.length>0?" "+f:f)}return f},Vc=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=sa(n))&&(s&&(s+=" "),s+=r);return s},sa=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=sa(e[r]))&&(n&&(n+=" "),n+=t);return n},Gc=(e,...t)=>{let n,r,s,o;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=zc(f),r=n.cache.get,s=n.cache.set,o=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Wc(m,n);return s(m,l),l};return o=a,(...m)=>o(Vc(...m))},qc=[],Ee=e=>{const t=n=>n[e]||qc;return t.isThemeGetter=!0,t},ra=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Yc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ut=e=>Kc.test(e),ae=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),gs=e=>e.endsWith("%")&&ae(e.slice(0,-1)),tt=e=>Yc.test(e),aa=()=>!0,ed=e=>Xc.test(e)&&!Qc.test(e),ar=()=>!1,td=e=>Jc.test(e),nd=e=>Zc.test(e),sd=e=>!Q(e)&&!J(e),rd=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),od=e=>bt(e,ca,ar),Q=e=>ra.test(e),kt=e=>bt(e,da,ed),Yr=e=>bt(e,md,ae),ad=e=>bt(e,fa,aa),id=e=>bt(e,ua,ar),Xr=e=>bt(e,ia,ar),ld=e=>bt(e,la,nd),En=e=>bt(e,ma,td),J=e=>oa.test(e),rn=e=>It(e,da),cd=e=>It(e,ua),Qr=e=>It(e,ia),dd=e=>It(e,ca),ud=e=>It(e,la),_n=e=>It(e,ma,!0),fd=e=>It(e,fa,!0),bt=(e,t,n)=>{const r=ra.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},It=(e,t,n=!1)=>{const r=oa.exec(e);return r?r[1]?t(r[1]):n:!1},ia=e=>e==="position"||e==="percentage",la=e=>e==="image"||e==="url",ca=e=>e==="length"||e==="size"||e==="bg-size",da=e=>e==="length",md=e=>e==="number",ua=e=>e==="family-name",fa=e=>e==="number"||e==="weight",ma=e=>e==="shadow",pd=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),r=Ee("font-weight"),s=Ee("tracking"),o=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),u=Ee("text-shadow"),h=Ee("drop-shadow"),g=Ee("blur"),b=Ee("perspective"),y=Ee("aspect"),v=Ee("ease"),E=Ee("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...A(),J,Q],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],x=()=>[J,Q,m],w=()=>[ut,"full","auto",...x()],R=()=>[qe,"none","subgrid",J,Q],P=()=>["auto",{span:["full",qe,J,Q]},qe,J,Q],D=()=>[qe,"auto",J,Q],F=()=>["auto","min","max","fr",J,Q],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],C=()=>[ut,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],H=()=>[ut,"screen","full","dvw","lvw","svw","min","max","fit",...x()],I=()=>[ut,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,J,Q],Y=()=>[...A(),Qr,Xr,{position:[J,Q]}],j=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",dd,od,{size:[J,Q]}],$=()=>[gs,rn,kt],N=()=>["","none","full",f,J,Q],B=()=>["",ae,rn,kt],G=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[ae,gs,Qr,Xr],oe=()=>["","none",g,J,Q],Z=()=>["none",ae,J,Q],se=()=>["none",ae,J,Q],le=()=>[ae,J,Q],be=()=>[ut,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tt],breakpoint:[tt],color:[aa],container:[tt],"drop-shadow":[tt],ease:["in","out","in-out"],font:[sd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tt],shadow:[tt],spacing:["px",ae],text:[tt],"text-shadow":[tt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ut,Q,J,y]}],container:["container"],"container-type":[{"@container":["","normal","size",J,Q]}],"container-named":[rd],columns:[{columns:[ae,Q,J,i]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[qe,"auto",J,Q]}],basis:[{basis:[ut,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ae,ut,"auto","initial","none",Q]}],grow:[{grow:["",ae,J,Q]}],shrink:[{shrink:["",ae,J,Q]}],order:[{order:[qe,"first","last","none",J,Q]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...I()]}],"min-block-size":[{"min-block":["auto",...I()]}],"max-block-size":[{"max-block":["none",...I()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,rn,kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,fd,ad]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gs,Q]}],"font-family":[{font:[cd,id,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,J,Q]}],"line-clamp":[{"line-clamp":[ae,"none",J,Yr]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",J,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",J,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ae,"from-font","auto",J,kt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ae,"auto",J,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[qe,J,Q]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",J,Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",J,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:j()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,J,Q],radial:["",J,Q],conic:[qe,J,Q]},ud,ld]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ae,J,Q]}],"outline-w":[{outline:["",ae,rn,kt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,_n,En]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,_n,En]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ae,kt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",u,_n,En]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ae,J,Q]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[J,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:j()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",J,Q]}],filter:[{filter:["","none",J,Q]}],blur:[{blur:oe()}],brightness:[{brightness:[ae,J,Q]}],contrast:[{contrast:[ae,J,Q]}],"drop-shadow":[{"drop-shadow":["","none",h,_n,En]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ae,J,Q]}],"hue-rotate":[{"hue-rotate":[ae,J,Q]}],invert:[{invert:["",ae,J,Q]}],saturate:[{saturate:[ae,J,Q]}],sepia:[{sepia:["",ae,J,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",J,Q]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[ae,J,Q]}],"backdrop-contrast":[{"backdrop-contrast":[ae,J,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ae,J,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ae,J,Q]}],"backdrop-invert":[{"backdrop-invert":["",ae,J,Q]}],"backdrop-opacity":[{"backdrop-opacity":[ae,J,Q]}],"backdrop-saturate":[{"backdrop-saturate":[ae,J,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",ae,J,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",J,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ae,"initial",J,Q]}],ease:[{ease:["linear","initial",v,J,Q]}],delay:[{delay:[ae,J,Q]}],animate:[{animate:["none",E,J,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,J,Q]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[J,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[qe,J,Q]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",J,Q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",J,Q]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ae,rn,kt,Yr]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hd=Gc(pd);function ee(...e){return hd(Zo(e))}function gd(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Bb(e){return e?new Date(e*1e3).toLocaleString():""}function Wb(e){return e==="archived"||e==="inactive"}function Vb(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function xd(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function Gb(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),xd(t)}function qb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const vd=/^Remote Control connecting(?:…|\.\.\.)$/;function Kb(e){return typeof e=="string"&&vd.test(e.trim())}/**
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-BAWTa5p7.js","assets/preload-helper-BiaRt2Oj.js","assets/vendor-DE_-CLIE.js","assets/shiki-ChKhlm5h.js","assets/Dashboard-Bz-0-u1i.js","assets/SessionVisibilityBadge-BY5tHU7b.js","assets/workerType-BOi1t0TG.js","assets/dialog-BnhKhSaK.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-HEE0RVF6.js","assets/refresh-cw-CKRHMYj-.js","assets/UserSearchInput-nQ2jQJmj.js","assets/copy-CJUB1OCZ.js","assets/ArtifactsGallery-DxVwQ8Wh.js","assets/notifications-BV1MotN8.js","assets/ShareLanding-CgkypqyR.js","assets/ArtifactView-wUyXqsCU.js","assets/Claim-D7HLQsN_.js","assets/Login-DNiG6cNe.js","assets/Register-CZ5iK6MO.js","assets/Setup-CJerwA76.js","assets/Join-CIaF_Ohx.js","assets/UserSettings-BZP7lYFA.js","assets/TeamList-lVbIAJts.js","assets/TeamDetail-ChdJxhFx.js","assets/TeamSettings-Bk3T7qB1.js","assets/AdminPanel-w39uutIr.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var yc=Object.defineProperty;var wc=(e,t,n)=>t in e?yc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var re=(e,t,n)=>wc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as ft,j as d,R as sr,r as Qo,b as Cc,c as rr,d as Sc}from"./vendor-DE_-CLIE.js";import{_ as Me}from"./preload-helper-BiaRt2Oj.js";import{m as kc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function Jo(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Jo(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Zo(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Jo(e))&&(r&&(r+=" "),r+=t);return r}const Ac=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ec=(e,t)=>({classGroupId:e,validator:t}),ea=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Fn="-",Gr=[],_c="arbitrary..",Tc=e=>{const t=Nc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Rc(a);const i=a.split(Fn),m=i[0]===""&&i.length>1?1:0;return ta(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?Ac(f,m):m:f||Gr}return n[a]||Gr}}},ta=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const f=ta(e,t+1,o);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Fn):e.slice(t).join(Fn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},Rc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?_c+r:void 0})(),Nc=e=>{const{theme:t,classGroups:n}=e;return jc(n,t)},jc=(e,t)=>{const n=ea();for(const r in e){const s=e[r];or(s,n,r,t)}return n},or=(e,t,n,r)=>{const s=e.length;for(let o=0;o<s;o++){const a=e[o];Mc(a,t,n,r)}},Mc=(e,t,n,r)=>{if(typeof e=="string"){Ic(e,t,n);return}if(typeof e=="function"){Pc(e,t,n,r);return}Dc(e,t,n,r)},Ic=(e,t,n)=>{const r=e===""?t:na(t,e);r.classGroupId=n},Pc=(e,t,n,r)=>{if(Oc(e)){or(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ec(n,e))},Dc=(e,t,n,r)=>{const s=Object.entries(e),o=s.length;for(let a=0;a<o;a++){const[i,m]=s[a];or(m,na(t,i),n,r)}},na=(e,t)=>{let n=e;const r=t.split(Fn),s=r.length;for(let o=0;o<s;o++){const a=r[o];let i=n.nextPart.get(a);i||(i=ea(),n.nextPart.set(a,i)),n=i}return n},Oc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Lc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const s=(o,a)=>{n[o]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(o){let a=n[o];if(a!==void 0)return a;if((a=r[o])!==void 0)return s(o,a),a},set(o,a){o in n?n[o]=a:s(o,a)}}},Ls="!",qr=":",Fc=[],Kr=(e,t,n,r,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),$c=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=s=>{const o=[];let a=0,i=0,m=0,f;const l=s.length;for(let b=0;b<l;b++){const y=s[b];if(a===0&&i===0){if(y===qr){o.push(s.slice(m,b)),m=b+1;continue}if(y==="/"){f=b;continue}}y==="["?a++:y==="]"?a--:y==="("?i++:y===")"&&i--}const c=o.length===0?s:s.slice(m);let u=c,h=!1;c.endsWith(Ls)?(u=c.slice(0,-1),h=!0):c.startsWith(Ls)&&(u=c.slice(1),h=!0);const x=f&&f>m?f-m:void 0;return Kr(o,h,u,x)};if(t){const s=t+qr,o=r;r=a=>a.startsWith(s)?o(a.slice(s.length)):Kr(Fc,!1,a,void 0,!0)}if(n){const s=r;r=o=>n({className:o,parseClassName:s})}return r},Uc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let o=0;o<n.length;o++){const a=n[o],i=a[0]==="[",m=t.has(a);i||m?(s.length>0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},zc=e=>({cache:Lc(e.cacheSize),parseClassName:$c(e),sortModifiers:Uc(e),postfixLookupClassGroupIds:Hc(e),...Tc(e)}),Hc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Bc=/\s+/,Wc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:o,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Bc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:u,modifiers:h,hasImportantModifier:x,baseClassName:b,maybePostfixModifierPosition:y}=n(c);if(u){f=c+(f.length>0?" "+f:f);continue}let v=!!y,E;if(v){const T=b.substring(0,y);E=r(T);const g=E&&a[E]?r(b):void 0;g&&g!==E&&(E=g,v=!1)}else E=r(b);if(!E){if(!v){f=c+(f.length>0?" "+f:f);continue}if(E=r(b),!E){f=c+(f.length>0?" "+f:f);continue}v=!1}const _=h.length===0?"":h.length===1?h[0]:o(h).join(":"),k=x?_+Ls:_,L=k+E;if(i.indexOf(L)>-1)continue;i.push(L);const A=s(E,v);for(let T=0;T<A.length;++T){const g=A[T];i.push(k+g)}f=c+(f.length>0?" "+f:f)}return f},Vc=(...e)=>{let t=0,n,r,s="";for(;t<e.length;)(n=e[t++])&&(r=sa(n))&&(s&&(s+=" "),s+=r);return s},sa=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=sa(e[r]))&&(n&&(n+=" "),n+=t);return n},Gc=(e,...t)=>{let n,r,s,o;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=zc(f),r=n.cache.get,s=n.cache.set,o=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Wc(m,n);return s(m,l),l};return o=a,(...m)=>o(Vc(...m))},qc=[],Ee=e=>{const t=n=>n[e]||qc;return t.isThemeGetter=!0,t},ra=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oa=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Yc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Xc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Qc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Jc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Zc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ut=e=>Kc.test(e),ae=e=>!!e&&!Number.isNaN(Number(e)),qe=e=>!!e&&Number.isInteger(Number(e)),gs=e=>e.endsWith("%")&&ae(e.slice(0,-1)),tt=e=>Yc.test(e),aa=()=>!0,ed=e=>Xc.test(e)&&!Qc.test(e),ar=()=>!1,td=e=>Jc.test(e),nd=e=>Zc.test(e),sd=e=>!Q(e)&&!J(e),rd=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),od=e=>bt(e,ca,ar),Q=e=>ra.test(e),kt=e=>bt(e,da,ed),Yr=e=>bt(e,md,ae),ad=e=>bt(e,fa,aa),id=e=>bt(e,ua,ar),Xr=e=>bt(e,ia,ar),ld=e=>bt(e,la,nd),En=e=>bt(e,ma,td),J=e=>oa.test(e),rn=e=>It(e,da),cd=e=>It(e,ua),Qr=e=>It(e,ia),dd=e=>It(e,ca),ud=e=>It(e,la),_n=e=>It(e,ma,!0),fd=e=>It(e,fa,!0),bt=(e,t,n)=>{const r=ra.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},It=(e,t,n=!1)=>{const r=oa.exec(e);return r?r[1]?t(r[1]):n:!1},ia=e=>e==="position"||e==="percentage",la=e=>e==="image"||e==="url",ca=e=>e==="length"||e==="size"||e==="bg-size",da=e=>e==="length",md=e=>e==="number",ua=e=>e==="family-name",fa=e=>e==="number"||e==="weight",ma=e=>e==="shadow",pd=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),r=Ee("font-weight"),s=Ee("tracking"),o=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),u=Ee("text-shadow"),h=Ee("drop-shadow"),x=Ee("blur"),b=Ee("perspective"),y=Ee("aspect"),v=Ee("ease"),E=Ee("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...k(),J,Q],A=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],g=()=>[J,Q,m],w=()=>[ut,"full","auto",...g()],N=()=>[qe,"none","subgrid",J,Q],P=()=>["auto",{span:["full",qe,J,Q]},qe,J,Q],D=()=>[qe,"auto",J,Q],F=()=>["auto","min","max","fr",J,Q],j=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...g()],C=()=>[ut,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...g()],H=()=>[ut,"screen","full","dvw","lvw","svw","min","max","fit",...g()],I=()=>[ut,"screen","full","lh","dvh","lvh","svh","min","max","fit",...g()],U=()=>[e,J,Q],Y=()=>[...k(),Qr,Xr,{position:[J,Q]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],O=()=>["auto","cover","contain",dd,od,{size:[J,Q]}],$=()=>[gs,rn,kt],R=()=>["","none","full",f,J,Q],B=()=>["",ae,rn,kt],G=()=>["solid","dashed","dotted","double"],q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>[ae,gs,Qr,Xr],oe=()=>["","none",x,J,Q],Z=()=>["none",ae,J,Q],se=()=>["none",ae,J,Q],le=()=>[ae,J,Q],be=()=>[ut,"full",...g()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tt],breakpoint:[tt],color:[aa],container:[tt],"drop-shadow":[tt],ease:["in","out","in-out"],font:[sd],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tt],shadow:[tt],spacing:["px",ae],text:[tt],"text-shadow":[tt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ut,Q,J,y]}],container:["container"],"container-type":[{"@container":["","normal","size",J,Q]}],"container-named":[rd],columns:[{columns:[ae,Q,J,i]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:w()}],"inset-x":[{"inset-x":w()}],"inset-y":[{"inset-y":w()}],start:[{"inset-s":w(),start:w()}],end:[{"inset-e":w(),end:w()}],"inset-bs":[{"inset-bs":w()}],"inset-be":[{"inset-be":w()}],top:[{top:w()}],right:[{right:w()}],bottom:[{bottom:w()}],left:[{left:w()}],visibility:["visible","invisible","collapse"],z:[{z:[qe,"auto",J,Q]}],basis:[{basis:[ut,"full","auto",i,...g()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ae,ut,"auto","initial","none",Q]}],grow:[{grow:["",ae,J,Q]}],shrink:[{shrink:["",ae,J,Q]}],order:[{order:[qe,"first","last","none",J,Q]}],"grid-cols":[{"grid-cols":N()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":N()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:g()}],"gap-x":[{"gap-x":g()}],"gap-y":[{"gap-y":g()}],"justify-content":[{justify:[...j(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...j()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":j()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:g()}],px:[{px:g()}],py:[{py:g()}],ps:[{ps:g()}],pe:[{pe:g()}],pbs:[{pbs:g()}],pbe:[{pbe:g()}],pt:[{pt:g()}],pr:[{pr:g()}],pb:[{pb:g()}],pl:[{pl:g()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":g()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":g()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...I()]}],"min-block-size":[{"min-block":["auto",...I()]}],"max-block-size":[{"max-block":["none",...I()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,rn,kt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,fd,ad]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gs,Q]}],"font-family":[{font:[cd,id,t]}],"font-features":[{"font-features":[Q]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,J,Q]}],"line-clamp":[{"line-clamp":[ae,"none",J,Yr]}],leading:[{leading:[o,...g()]}],"list-image":[{"list-image":["none",J,Q]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",J,Q]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ae,"from-font","auto",J,kt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[ae,"auto",J,Q]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:g()}],"tab-size":[{tab:[qe,J,Q]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",J,Q]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",J,Q]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:O()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qe,J,Q],radial:["",J,Q],conic:[qe,J,Q]},ud,ld]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ae,J,Q]}],"outline-w":[{outline:["",ae,rn,kt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,_n,En]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,_n,En]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[ae,kt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",u,_n,En]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[ae,J,Q]}],"mix-blend":[{"mix-blend":[...q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ae]}],"mask-image-linear-from-pos":[{"mask-linear-from":K()}],"mask-image-linear-to-pos":[{"mask-linear-to":K()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":K()}],"mask-image-t-to-pos":[{"mask-t-to":K()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":K()}],"mask-image-r-to-pos":[{"mask-r-to":K()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":K()}],"mask-image-b-to-pos":[{"mask-b-to":K()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":K()}],"mask-image-l-to-pos":[{"mask-l-to":K()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":K()}],"mask-image-x-to-pos":[{"mask-x-to":K()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":K()}],"mask-image-y-to-pos":[{"mask-y-to":K()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[J,Q]}],"mask-image-radial-from-pos":[{"mask-radial-from":K()}],"mask-image-radial-to-pos":[{"mask-radial-to":K()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[ae]}],"mask-image-conic-from-pos":[{"mask-conic-from":K()}],"mask-image-conic-to-pos":[{"mask-conic-to":K()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:O()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",J,Q]}],filter:[{filter:["","none",J,Q]}],blur:[{blur:oe()}],brightness:[{brightness:[ae,J,Q]}],contrast:[{contrast:[ae,J,Q]}],"drop-shadow":[{"drop-shadow":["","none",h,_n,En]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",ae,J,Q]}],"hue-rotate":[{"hue-rotate":[ae,J,Q]}],invert:[{invert:["",ae,J,Q]}],saturate:[{saturate:[ae,J,Q]}],sepia:[{sepia:["",ae,J,Q]}],"backdrop-filter":[{"backdrop-filter":["","none",J,Q]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[ae,J,Q]}],"backdrop-contrast":[{"backdrop-contrast":[ae,J,Q]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ae,J,Q]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ae,J,Q]}],"backdrop-invert":[{"backdrop-invert":["",ae,J,Q]}],"backdrop-opacity":[{"backdrop-opacity":[ae,J,Q]}],"backdrop-saturate":[{"backdrop-saturate":[ae,J,Q]}],"backdrop-sepia":[{"backdrop-sepia":["",ae,J,Q]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":g()}],"border-spacing-x":[{"border-spacing-x":g()}],"border-spacing-y":[{"border-spacing-y":g()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",J,Q]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ae,"initial",J,Q]}],ease:[{ease:["linear","initial",v,J,Q]}],delay:[{delay:[ae,J,Q]}],animate:[{animate:["none",E,J,Q]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,J,Q]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:se()}],"scale-x":[{"scale-x":se()}],"scale-y":[{"scale-y":se()}],"scale-z":[{"scale-z":se()}],"scale-3d":["scale-3d"],skew:[{skew:le()}],"skew-x":[{"skew-x":le()}],"skew-y":[{"skew-y":le()}],transform:[{transform:[J,Q,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[qe,J,Q]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",J,Q]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":g()}],"scroll-mx":[{"scroll-mx":g()}],"scroll-my":[{"scroll-my":g()}],"scroll-ms":[{"scroll-ms":g()}],"scroll-me":[{"scroll-me":g()}],"scroll-mbs":[{"scroll-mbs":g()}],"scroll-mbe":[{"scroll-mbe":g()}],"scroll-mt":[{"scroll-mt":g()}],"scroll-mr":[{"scroll-mr":g()}],"scroll-mb":[{"scroll-mb":g()}],"scroll-ml":[{"scroll-ml":g()}],"scroll-p":[{"scroll-p":g()}],"scroll-px":[{"scroll-px":g()}],"scroll-py":[{"scroll-py":g()}],"scroll-ps":[{"scroll-ps":g()}],"scroll-pe":[{"scroll-pe":g()}],"scroll-pbs":[{"scroll-pbs":g()}],"scroll-pbe":[{"scroll-pbe":g()}],"scroll-pt":[{"scroll-pt":g()}],"scroll-pr":[{"scroll-pr":g()}],"scroll-pb":[{"scroll-pb":g()}],"scroll-pl":[{"scroll-pl":g()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",J,Q]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[ae,rn,kt,Yr]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},hd=Gc(pd);function ee(...e){return hd(Zo(e))}function gd(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Hb(e){return e?new Date(e*1e3).toLocaleString():""}function Bb(e){return e==="archived"||e==="inactive"}function Wb(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function xd(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function Vb(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),xd(t)}function Gb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const vd=/^Remote Control connecting(?:…|\.\.\.)$/;function qb(e){return typeof e=="string"&&vd.test(e.trim())}/**
|
|
3
3
|
* @license lucide-react v0.555.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -204,13 +204,13 @@ var yc=Object.defineProperty;var wc=(e,t,n)=>t in e?yc(e,t,{enumerable:!0,config
|
|
|
204
204
|
*
|
|
205
205
|
* This source code is licensed under the ISC license.
|
|
206
206
|
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
-
*/const Ru=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],hn=ie("x",Ru),Sa=p.createContext(void 0),ka="theme";function Zr(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function eo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(ka);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function to(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Nu(){const e=p.useContext(Sa);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function ju({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>eo()||t),[s,o]=p.useState(()=>{const m=eo()||t;return m==="system"?Zr():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(ka,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Zr():n;o(m),to(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";o(c),to(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:s,setTheme:a};return ft.createElement(Sa.Provider,{value:i},e)}function no(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Je(...e){return t=>{let n=!1;const r=e.map(s=>{const o=no(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():no(e[s],null)}}}}function Ae(...e){return p.useCallback(Je(...e),e)}var Mu=Symbol.for("react.lazy"),$n=sr[" use ".trim().toString()];function Iu(e){return typeof e=="object"&&e!==null&&"then"in e}function Aa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Mu&&"_payload"in e&&Iu(e._payload)}function Ea(e){const t=Du(e),n=p.forwardRef((r,s)=>{let{children:o,...a}=r;Aa(o)&&typeof $n=="function"&&(o=$n(o._payload));const i=p.Children.toArray(o),m=i.find(Lu);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Pu=Ea("Slot");function Du(e){const t=p.forwardRef((n,r)=>{let{children:s,...o}=n;if(Aa(s)&&typeof $n=="function"&&(s=$n(s._payload)),p.isValidElement(s)){const a=$u(s),i=Fu(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ou=Symbol("radix.slottable");function Lu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ou}function Fu(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $u(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const so=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ro=Zo,Uu=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ro(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,a=Object.keys(s).map(f=>{const l=n==null?void 0:n[f],c=o==null?void 0:o[f];if(l===null)return null;const u=so(l)||so(c);return s[f][u]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,u]=l;return u===void 0||(f[c]=u),f},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:u,...h}=l;return Object.entries(h).every(g=>{let[b,y]=g;return Array.isArray(y)?y.includes({...o,...i}[b]):{...o,...i}[b]===y})?[...f,c,u]:f},[]);return ro(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},zu=Uu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Pt({className:e,variant:t,size:n,asChild:r=!1,...s}){const o=r?Pu:"button";return d.jsx(o,{"data-slot":"button",className:ee(zu({variant:t,size:n,className:e})),...s})}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Hu(e,t){const n=p.createContext(t),r=o=>{const{children:a,...i}=o,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function s(o){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function at(e,t=[]){let n=[];function r(o,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var v;const{scope:u,children:h,...g}=c,b=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,y=p.useMemo(()=>g,Object.values(g));return d.jsx(b.Provider,{value:y,children:h})};f.displayName=o+"Provider";function l(c,u){var b;const h=((b=u==null?void 0:u[e])==null?void 0:b[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${o}\``)}return[f,l]}const s=()=>{const o=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return s.scopeName=e,[r,Bu(s,...t)]}function Bu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=r.reduce((i,{useScope:m,scopeName:f})=>{const c=m(o)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var nt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Wu=sr[" useInsertionEffect ".trim().toString()]||nt;function ht({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,a]=Vu({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:s;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const u=Gu(l)?l(e):l;u!==e&&((c=a.current)==null||c.call(a,u))}else o(l)},[i,e,o,a]);return[m,f]}function Vu({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return Wu(()=>{o.current=t},[t]),p.useEffect(()=>{var a;s.current!==n&&((a=o.current)==null||a.call(o,n),s.current=n)},[n,s]),[n,r,o]}function Gu(e){return typeof e=="function"}function qt(e){const t=qu(e),n=p.forwardRef((r,s)=>{const{children:o,...a}=r,i=p.Children.toArray(o),m=i.find(Yu);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function qu(e){const t=p.forwardRef((n,r)=>{const{children:s,...o}=n;if(p.isValidElement(s)){const a=Qu(s),i=Xu(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _a=Symbol("radix.slottable");function Ku(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_a,t}function Yu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_a}function Xu(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Qu(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ju=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xe=Ju.reduce((e,t)=>{const n=qt(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ta(e,t){e&&Qo.flushSync(()=>e.dispatchEvent(t))}function Ra(e){const t=e+"CollectionProvider",[n,r]=at(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=b=>{const{scope:y,children:v}=b,E=ft.useRef(null),_=ft.useRef(new Map).current;return d.jsx(s,{scope:y,itemMap:_,collectionRef:E,children:v})};a.displayName=t;const i=e+"CollectionSlot",m=qt(i),f=ft.forwardRef((b,y)=>{const{scope:v,children:E}=b,_=o(i,v),A=Ae(y,_.collectionRef);return d.jsx(m,{ref:A,children:E})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",u=qt(l),h=ft.forwardRef((b,y)=>{const{scope:v,children:E,..._}=b,A=ft.useRef(null),O=Ae(y,A),k=o(l,v);return ft.useEffect(()=>(k.itemMap.set(A,{ref:A,..._}),()=>void k.itemMap.delete(A))),d.jsx(u,{[c]:"",ref:O,children:E})});h.displayName=l;function g(b){const y=o(e+"CollectionConsumer",b);return ft.useCallback(()=>{const E=y.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${c}]`));return Array.from(y.itemMap.values()).sort((k,T)=>_.indexOf(k.ref.current)-_.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,r]}var Zu=p.createContext(void 0);function Na(e){const t=p.useContext(Zu);return e||t||"ltr"}function st(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ef(e,t=globalThis==null?void 0:globalThis.document){const n=st(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tf="DismissableLayer",Fs="dismissableLayer.update",nf="dismissableLayer.pointerDownOutside",sf="dismissableLayer.focusOutside",oo,ja=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ja),[l,c]=p.useState(null),u=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=Ae(t,T=>c(T)),b=Array.from(f.layers),[y]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),E=l?b.indexOf(l):-1,_=f.layersWithOutsidePointerEventsDisabled.size>0,A=E>=v,O=af(T=>{const x=T.target,w=[...f.branches].some(R=>R.contains(x));!A||w||(s==null||s(T),a==null||a(T),T.defaultPrevented||i==null||i())},u),k=lf(T=>{const x=T.target;[...f.branches].some(R=>R.contains(x))||(o==null||o(T),a==null||a(T),T.defaultPrevented||i==null||i())},u);return ef(T=>{E===f.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&i&&(T.preventDefault(),i()))},u),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(oo=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ao(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=oo)}},[l,u,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ao())},[l,f]),p.useEffect(()=>{const T=()=>h({});return document.addEventListener(Fs,T),()=>document.removeEventListener(Fs,T)},[]),d.jsx(xe.div,{...m,ref:g,style:{pointerEvents:_?A?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,k.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,O.onPointerDownCapture)})});gn.displayName=tf;var rf="DismissableLayerBranch",of=p.forwardRef((e,t)=>{const n=p.useContext(ja),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(xe.div,{...e,ref:s})});of.displayName=rf;function af(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=i=>{if(i.target&&!r.current){let m=function(){Ma(nf,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Ma(sf,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ao(){const e=new CustomEvent(Fs);document.dispatchEvent(e)}function Ma(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Ta(s,o):s.dispatchEvent(o)}var xs=0;function cr(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??io()),document.body.insertAdjacentElement("beforeend",e[1]??io()),xs++,()=>{xs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xs--}},[])}function io(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var vs="focusScope.autoFocusOnMount",bs="focusScope.autoFocusOnUnmount",lo={bubbles:!1,cancelable:!0},cf="FocusScope",Zn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[i,m]=p.useState(null),f=st(s),l=st(o),c=p.useRef(null),u=Ae(t,b=>m(b)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let b=function(_){if(h.paused||!i)return;const A=_.target;i.contains(A)?c.current=A:mt(c.current,{select:!0})},y=function(_){if(h.paused||!i)return;const A=_.relatedTarget;A!==null&&(i.contains(A)||mt(c.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const O of _)O.removedNodes.length>0&&mt(i)};document.addEventListener("focusin",b),document.addEventListener("focusout",y);const E=new MutationObserver(v);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",y),E.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){uo.add(h);const b=document.activeElement;if(!i.contains(b)){const v=new CustomEvent(vs,lo);i.addEventListener(vs,f),i.dispatchEvent(v),v.defaultPrevented||(df(hf(Ia(i)),{select:!0}),document.activeElement===b&&mt(i))}return()=>{i.removeEventListener(vs,f),setTimeout(()=>{const v=new CustomEvent(bs,lo);i.addEventListener(bs,l),i.dispatchEvent(v),v.defaultPrevented||mt(b??document.body,{select:!0}),i.removeEventListener(bs,l),uo.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(b=>{if(!n&&!r||h.paused)return;const y=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(y&&v){const E=b.currentTarget,[_,A]=uf(E);_&&A?!b.shiftKey&&v===A?(b.preventDefault(),n&&mt(_,{select:!0})):b.shiftKey&&v===_&&(b.preventDefault(),n&&mt(A,{select:!0})):v===E&&b.preventDefault()}},[n,r,h.paused]);return d.jsx(xe.div,{tabIndex:-1,...a,ref:u,onKeyDown:g})});Zn.displayName=cf;function df(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mt(r,{select:t}),document.activeElement!==n)return}function uf(e){const t=Ia(e),n=co(t,e),r=co(t.reverse(),e);return[n,r]}function Ia(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function co(e,t){for(const n of e)if(!ff(n,{upTo:t}))return n}function ff(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mf(e){return e instanceof HTMLInputElement&&"select"in e}function mt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mf(e)&&t&&e.select()}}var uo=pf();function pf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fo(e,t),e.unshift(t)},remove(t){var n;e=fo(e,t),(n=e[0])==null||n.resume()}}}function fo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hf(e){return e.filter(t=>t.tagName!=="A")}var gf=sr[" useId ".trim().toString()]||(()=>{}),xf=0;function Pe(e){const[t,n]=p.useState(gf());return nt(()=>{n(r=>r??String(xf++))},[e]),e||(t?`radix-${t}`:"")}const vf=["top","right","bottom","left"],gt=Math.min,Fe=Math.max,Un=Math.round,Tn=Math.floor,Qe=e=>({x:e,y:e}),bf={left:"right",right:"left",bottom:"top",top:"bottom"};function $s(e,t,n){return Fe(e,gt(t,n))}function rt(e,t){return typeof e=="function"?e(t):e}function ot(e){return e.split("-")[0]}function Jt(e){return e.split("-")[1]}function dr(e){return e==="x"?"y":"x"}function ur(e){return e==="y"?"height":"width"}function Xe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fr(e){return dr(Xe(e))}function yf(e,t,n){n===void 0&&(n=!1);const r=Jt(e),s=fr(e),o=ur(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=zn(a)),[a,zn(a)]}function wf(e){const t=zn(e);return[Us(e),t,Us(t)]}function Us(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const mo=["left","right"],po=["right","left"],Cf=["top","bottom"],Sf=["bottom","top"];function kf(e,t,n){switch(e){case"top":case"bottom":return n?t?po:mo:t?mo:po;case"left":case"right":return t?Cf:Sf;default:return[]}}function Af(e,t,n,r){const s=Jt(e);let o=kf(ot(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(Us)))),o}function zn(e){const t=ot(e);return bf[t]+e.slice(t.length)}function Ef(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pa(e){return typeof e!="number"?Ef(e):{top:e,right:e,bottom:e,left:e}}function Hn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function ho(e,t,n){let{reference:r,floating:s}=e;const o=Xe(t),a=fr(t),i=ur(a),m=ot(t),f=o==="y",l=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,u=r[i]/2-s[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-s.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-s.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Jt(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function _f(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:u=!1,padding:h=0}=rt(t,e),g=Pa(h),y=i[u?c==="floating"?"reference":"floating":c],v=Hn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),E=c==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(i.floating)),A=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},O=Hn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:E,offsetParent:_,strategy:m}):E);return{top:(v.top-O.top+g.top)/A.y,bottom:(O.bottom-v.bottom+g.bottom)/A.y,left:(v.left-O.left+g.left)/A.x,right:(O.right-v.right+g.right)/A.x}}const Tf=50,Rf=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:_f},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:l,y:c}=ho(f,r,m),u=r,h=0;const g={};for(let b=0;b<o.length;b++){const y=o[b];if(!y)continue;const{name:v,fn:E}=y,{x:_,y:A,data:O,reset:k}=await E({x:l,y:c,initialPlacement:r,placement:u,strategy:s,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=_??l,c=A??c,g[v]={...g[v],...O},k&&h<Tf&&(h++,typeof k=="object"&&(k.placement&&(u=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):k.rects),{x:l,y:c}=ho(f,u,m)),b=-1)}return{x:l,y:c,placement:u,strategy:s,middlewareData:g}},Nf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=rt(e,t)||{};if(f==null)return{};const c=Pa(l),u={x:n,y:r},h=fr(s),g=ur(h),b=await a.getDimensions(f),y=h==="y",v=y?"top":"left",E=y?"bottom":"right",_=y?"clientHeight":"clientWidth",A=o.reference[g]+o.reference[h]-u[h]-o.floating[g],O=u[h]-o.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let T=k?k[_]:0;(!T||!await(a.isElement==null?void 0:a.isElement(k)))&&(T=i.floating[_]||o.floating[g]);const x=A/2-O/2,w=T/2-b[g]/2-1,R=gt(c[v],w),P=gt(c[E],w),D=R,F=T-b[g]-P,M=T/2-b[g]/2+x,z=$s(D,M,F),S=!m.arrow&&Jt(s)!=null&&M!==z&&o.reference[g]/2-(M<D?R:P)-b[g]/2<0,C=S?M<D?M-D:M-F:0;return{[h]:u[h]+C,data:{[h]:z,centerOffset:M-z-C,...S&&{alignmentOffset:C}},reset:S}}}),jf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...y}=rt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=ot(s),E=Xe(i),_=ot(i)===i,A=await(m.isRTL==null?void 0:m.isRTL(f.floating)),O=u||(_||!b?[zn(i)]:wf(i)),k=g!=="none";!u&&k&&O.push(...Af(i,b,g,A));const T=[i,...O],x=await m.detectOverflow(t,y),w=[];let R=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&w.push(x[v]),c){const M=yf(s,a,A);w.push(x[M[0]],x[M[1]])}if(R=[...R,{placement:s,overflows:w}],!w.every(M=>M<=0)){var P,D;const M=(((P=o.flip)==null?void 0:P.index)||0)+1,z=T[M];if(z&&(!(c==="alignment"?E!==Xe(z):!1)||R.every(H=>Xe(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:M,overflows:R},reset:{placement:z}};let S=(D=R.filter(C=>C.overflows[0]<=0).sort((C,H)=>C.overflows[1]-H.overflows[1])[0])==null?void 0:D.placement;if(!S)switch(h){case"bestFit":{var F;const C=(F=R.filter(H=>{if(k){const I=Xe(H.placement);return I===E||I==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(I=>I>0).reduce((I,U)=>I+U,0)]).sort((H,I)=>H[1]-I[1])[0])==null?void 0:F[0];C&&(S=C);break}case"initialPlacement":S=i;break}if(s!==S)return{reset:{placement:S}}}return{}}}};function go(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xo(e){return vf.some(t=>e[t]>=0)}const Mf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=rt(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...o,elementContext:"reference"}),i=go(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:xo(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...o,altBoundary:!0}),i=go(a,n.floating);return{data:{escapedOffsets:i,escaped:xo(i)}}}default:return{}}}}},Da=new Set(["left","top"]);async function If(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ot(n),i=Jt(n),m=Xe(n)==="y",f=Da.has(a)?-1:1,l=o&&m?-1:1,c=rt(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*l,y:u*f}:{x:u*f,y:h*l}}const Pf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:i}=t,m=await If(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:a}}}}},Df=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:v=>{let{x:E,y:_}=v;return{x:E,y:_}}},...f}=rt(e,t),l={x:n,y:r},c=await o.detectOverflow(t,f),u=Xe(ot(s)),h=dr(u);let g=l[h],b=l[u];if(a){const v=h==="y"?"top":"left",E=h==="y"?"bottom":"right",_=g+c[v],A=g-c[E];g=$s(_,g,A)}if(i){const v=u==="y"?"top":"left",E=u==="y"?"bottom":"right",_=b+c[v],A=b-c[E];b=$s(_,b,A)}const y=m.fn({...t,[h]:g,[u]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:a,[u]:i}}}}}},Of=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=rt(e,t),l={x:n,y:r},c=Xe(s),u=dr(c);let h=l[u],g=l[c];const b=rt(i,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(m){const _=u==="y"?"height":"width",A=o.reference[u]-o.floating[_]+y.mainAxis,O=o.reference[u]+o.reference[_]-y.mainAxis;h<A?h=A:h>O&&(h=O)}if(f){var v,E;const _=u==="y"?"width":"height",A=Da.has(ot(s)),O=o.reference[c]-o.floating[_]+(A&&((v=a.offset)==null?void 0:v[c])||0)+(A?0:y.crossAxis),k=o.reference[c]+o.reference[_]+(A?0:((E=a.offset)==null?void 0:E[c])||0)-(A?y.crossAxis:0);g<O?g=O:g>k&&(g=k)}return{[u]:h,[c]:g}}}},Lf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:a,elements:i}=t,{apply:m=()=>{},...f}=rt(e,t),l=await a.detectOverflow(t,f),c=ot(s),u=Jt(s),h=Xe(s)==="y",{width:g,height:b}=o.floating;let y,v;c==="top"||c==="bottom"?(y=c,v=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(v=c,y=u==="end"?"top":"bottom");const E=b-l.top-l.bottom,_=g-l.left-l.right,A=gt(b-l[y],E),O=gt(g-l[v],_),k=!t.middlewareData.shift;let T=A,x=O;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=E),k&&!u){const R=Fe(l.left,0),P=Fe(l.right,0),D=Fe(l.top,0),F=Fe(l.bottom,0);h?x=g-2*(R!==0||P!==0?R+P:Fe(l.left,l.right)):T=b-2*(D!==0||F!==0?D+F:Fe(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:T});const w=await a.getDimensions(i.floating);return g!==w.width||b!==w.height?{reset:{rects:!0}}:{}}}};function es(){return typeof window<"u"}function Zt(e){return Oa(e)?(e.nodeName||"").toLowerCase():"#document"}function $e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ze(e){var t;return(t=(Oa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Oa(e){return es()?e instanceof Node||e instanceof $e(e).Node:!1}function Be(e){return es()?e instanceof Element||e instanceof $e(e).Element:!1}function it(e){return es()?e instanceof HTMLElement||e instanceof $e(e).HTMLElement:!1}function vo(e){return!es()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $e(e).ShadowRoot}function xn(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Ff(e){return/^(table|td|th)$/.test(Zt(e))}function ts(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $f=/transform|translate|scale|rotate|perspective|filter/,Uf=/paint|layout|strict|content/,At=e=>!!e&&e!=="none";let ys;function mr(e){const t=Be(e)?We(e):e;return At(t.transform)||At(t.translate)||At(t.scale)||At(t.rotate)||At(t.perspective)||!pr()&&(At(t.backdropFilter)||At(t.filter))||$f.test(t.willChange||"")||Uf.test(t.contain||"")}function zf(e){let t=xt(e);for(;it(t)&&!Kt(t);){if(mr(t))return t;if(ts(t))return null;t=xt(t)}return null}function pr(){return ys==null&&(ys=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ys}function Kt(e){return/^(html|body|#document)$/.test(Zt(e))}function We(e){return $e(e).getComputedStyle(e)}function ns(e){return Be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if(Zt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vo(e)&&e.host||Ze(e);return vo(t)?t.host:t}function La(e){const t=xt(e);return Kt(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&xn(t)?t:La(t)}function cn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=La(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=$e(s);if(o){const i=zs(a);return t.concat(a,a.visualViewport||[],xn(s)?s:[],i&&n?cn(i):[])}else return t.concat(s,cn(s,[],n))}function zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fa(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=it(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,i=Un(n)!==o||Un(r)!==a;return i&&(n=o,r=a),{width:n,height:r,$:i}}function hr(e){return Be(e)?e:e.contextElement}function Wt(e){const t=hr(e);if(!it(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Fa(t);let a=(o?Un(n.width):n.width)/r,i=(o?Un(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Hf=Qe(0);function $a(e){const t=$e(e);return!pr()||!t.visualViewport?Hf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==$e(e)?!1:t}function Nt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=hr(e);let a=Qe(1);t&&(r?Be(r)&&(a=Wt(r)):a=Wt(e));const i=Bf(o,n,r)?$a(o):Qe(0);let m=(s.left+i.x)/a.x,f=(s.top+i.y)/a.y,l=s.width/a.x,c=s.height/a.y;if(o){const u=$e(o),h=r&&Be(r)?$e(r):r;let g=u,b=zs(g);for(;b&&r&&h!==g;){const y=Wt(b),v=b.getBoundingClientRect(),E=We(b),_=v.left+(b.clientLeft+parseFloat(E.paddingLeft))*y.x,A=v.top+(b.clientTop+parseFloat(E.paddingTop))*y.y;m*=y.x,f*=y.y,l*=y.x,c*=y.y,m+=_,f+=A,g=$e(b),b=zs(g)}}return Hn({width:l,height:c,x:m,y:f})}function ss(e,t){const n=ns(e).scrollLeft;return t?t.left+n:Nt(Ze(e)).left+n}function Ua(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ss(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Wf(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=Ze(r),i=t?ts(t.floating):!1;if(r===a||i&&o)return n;let m={scrollLeft:0,scrollTop:0},f=Qe(1);const l=Qe(0),c=it(r);if((c||!c&&!o)&&((Zt(r)!=="body"||xn(a))&&(m=ns(r)),c)){const h=Nt(r);f=Wt(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const u=a&&!c&&!o?Ua(a,m):Qe(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+u.x,y:n.y*f.y-m.scrollTop*f.y+l.y+u.y}}function Vf(e){return Array.from(e.getClientRects())}function Gf(e){const t=Ze(e),n=ns(e),r=e.ownerDocument.body,s=Fe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Fe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ss(e);const i=-n.scrollTop;return We(r).direction==="rtl"&&(a+=Fe(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:i}}const bo=25;function qf(e,t){const n=$e(e),r=Ze(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,i=0,m=0;if(s){o=s.width,a=s.height;const l=pr();(!l||l&&t==="fixed")&&(i=s.offsetLeft,m=s.offsetTop)}const f=ss(r);if(f<=0){const l=r.ownerDocument,c=l.body,u=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,g=Math.abs(r.clientWidth-c.clientWidth-h);g<=bo&&(o-=g)}else f<=bo&&(o+=f);return{width:o,height:a,x:i,y:m}}function Kf(e,t){const n=Nt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=it(e)?Wt(e):Qe(1),a=e.clientWidth*o.x,i=e.clientHeight*o.y,m=s*o.x,f=r*o.y;return{width:a,height:i,x:m,y:f}}function yo(e,t,n){let r;if(t==="viewport")r=qf(e,n);else if(t==="document")r=Gf(Ze(e));else if(Be(t))r=Kf(t,n);else{const s=$a(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Hn(r)}function za(e,t){const n=xt(e);return n===t||!Be(n)||Kt(n)?!1:We(n).position==="fixed"||za(n,t)}function Yf(e,t){const n=t.get(e);if(n)return n;let r=cn(e,[],!1).filter(i=>Be(i)&&Zt(i)!=="body"),s=null;const o=We(e).position==="fixed";let a=o?xt(e):e;for(;Be(a)&&!Kt(a);){const i=We(a),m=mr(a);!m&&i.position==="fixed"&&(s=null),(o?!m&&!s:!m&&i.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||xn(a)&&!m&&za(e,a))?r=r.filter(l=>l!==a):s=i,a=xt(a)}return t.set(e,r),r}function Xf(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?ts(t)?[]:Yf(t,this._c):[].concat(n),r],i=yo(t,a[0],s);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let u=1;u<a.length;u++){const h=yo(t,a[u],s);m=Fe(h.top,m),f=gt(h.right,f),l=gt(h.bottom,l),c=Fe(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Qf(e){const{width:t,height:n}=Fa(e);return{width:t,height:n}}function Jf(e,t,n){const r=it(t),s=Ze(t),o=n==="fixed",a=Nt(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const m=Qe(0);function f(){m.x=ss(s)}if(r||!r&&!o)if((Zt(t)!=="body"||xn(s))&&(i=ns(t)),r){const h=Nt(t,!0,o,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else s&&f();o&&!r&&s&&f();const l=s&&!r&&!o?Ua(s,i):Qe(0),c=a.left+i.scrollLeft-m.x-l.x,u=a.top+i.scrollTop-m.y-l.y;return{x:c,y:u,width:a.width,height:a.height}}function ws(e){return We(e).position==="static"}function wo(e,t){if(!it(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ze(e)===n&&(n=n.ownerDocument.body),n}function Ha(e,t){const n=$e(e);if(ts(e))return n;if(!it(e)){let s=xt(e);for(;s&&!Kt(s);){if(Be(s)&&!ws(s))return s;s=xt(s)}return n}let r=wo(e,t);for(;r&&Ff(r)&&ws(r);)r=wo(r,t);return r&&Kt(r)&&ws(r)&&!mr(r)?n:r||zf(e)||n}const Zf=async function(e){const t=this.getOffsetParent||Ha,n=this.getDimensions,r=await n(e.floating);return{reference:Jf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function em(e){return We(e).direction==="rtl"}const tm={convertOffsetParentRelativeRectToViewportRelativeRect:Wf,getDocumentElement:Ze,getClippingRect:Xf,getOffsetParent:Ha,getElementRects:Zf,getClientRects:Vf,getDimensions:Qf,getScale:Wt,isElement:Be,isRTL:em};function Ba(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nm(e,t){let n=null,r;const s=Ze(e);function o(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),o();const f=e.getBoundingClientRect(),{left:l,top:c,width:u,height:h}=f;if(i||t(),!u||!h)return;const g=Tn(c),b=Tn(s.clientWidth-(l+u)),y=Tn(s.clientHeight-(c+h)),v=Tn(l),_={rootMargin:-g+"px "+-b+"px "+-y+"px "+-v+"px",threshold:Fe(0,gt(1,m))||1};let A=!0;function O(k){const T=k[0].intersectionRatio;if(T!==m){if(!A)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!Ba(f,e.getBoundingClientRect())&&a(),A=!1}try{n=new IntersectionObserver(O,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(O,_)}n.observe(e)}return a(!0),o}function sm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=hr(e),l=s||o?[...f?cn(f):[],...t?cn(t):[]]:[];l.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const c=f&&i?nm(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(v=>{let[E]=v;E&&E.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,b=m?Nt(e):null;m&&y();function y(){const v=Nt(e);b&&!Ba(b,v)&&n(),b=v,g=requestAnimationFrame(y)}return n(),()=>{var v;l.forEach(E=>{s&&E.removeEventListener("scroll",n),o&&E.removeEventListener("resize",n)}),c==null||c(),(v=h)==null||v.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const rm=Pf,om=Df,am=jf,im=Lf,lm=Mf,Co=Nf,cm=Of,dm=(e,t,n)=>{const r=new Map,s={platform:tm,...n},o={...s.platform,_c:r};return Rf(e,t,{...s,platform:o})};var um=typeof document<"u",fm=function(){},Pn=um?p.useLayoutEffect:fm;function Bn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bn(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Bn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Wa(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function So(e,t){const n=Wa(e);return Math.round(t*n)/n}function Cs(e){const t=p.useRef(e);return Pn(()=>{t.current=e}),t}function mm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(r);Bn(u,r)||h(r);const[g,b]=p.useState(null),[y,v]=p.useState(null),E=p.useCallback(H=>{H!==k.current&&(k.current=H,b(H))},[]),_=p.useCallback(H=>{H!==T.current&&(T.current=H,v(H))},[]),A=o||g,O=a||y,k=p.useRef(null),T=p.useRef(null),x=p.useRef(l),w=m!=null,R=Cs(m),P=Cs(s),D=Cs(f),F=p.useCallback(()=>{if(!k.current||!T.current)return;const H={placement:t,strategy:n,middleware:u};P.current&&(H.platform=P.current),dm(k.current,T.current,H).then(I=>{const U={...I,isPositioned:D.current!==!1};M.current&&!Bn(x.current,U)&&(x.current=U,Qo.flushSync(()=>{c(U)}))})},[u,t,n,P,D]);Pn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const M=p.useRef(!1);Pn(()=>(M.current=!0,()=>{M.current=!1}),[]),Pn(()=>{if(A&&(k.current=A),O&&(T.current=O),A&&O){if(R.current)return R.current(A,O,F);F()}},[A,O,F,R,w]);const z=p.useMemo(()=>({reference:k,floating:T,setReference:E,setFloating:_}),[E,_]),S=p.useMemo(()=>({reference:A,floating:O}),[A,O]),C=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!S.floating)return H;const I=So(S.floating,l.x),U=So(S.floating,l.y);return i?{...H,transform:"translate("+I+"px, "+U+"px)",...Wa(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:C}),[l,F,z,S,C])}const pm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Co({element:r.current,padding:s}).fn(n):{}:r?Co({element:r,padding:s}).fn(n):{}}}},hm=(e,t)=>{const n=rm(e);return{name:n.name,fn:n.fn,options:[e,t]}},gm=(e,t)=>{const n=om(e);return{name:n.name,fn:n.fn,options:[e,t]}},xm=(e,t)=>({fn:cm(e).fn,options:[e,t]}),vm=(e,t)=>{const n=am(e);return{name:n.name,fn:n.fn,options:[e,t]}},bm=(e,t)=>{const n=im(e);return{name:n.name,fn:n.fn,options:[e,t]}},ym=(e,t)=>{const n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{const n=pm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Cm="Arrow",Va=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return d.jsx(xe.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});Va.displayName=Cm;var Sm=Va;function km(e){const[t,n]=p.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,i;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var gr="Popper",[Ga,en]=at(gr),[Am,qa]=Ga(gr),Ka=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return d.jsx(Am,{scope:t,anchor:r,onAnchorChange:s,children:n})};Ka.displayName=gr;var Ya="PopperAnchor",Xa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=qa(Ya,n),a=p.useRef(null),i=Ae(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&o.onAnchorChange(m.current)}),r?null:d.jsx(xe.div,{...s,ref:i})});Xa.displayName=Ya;var xr="PopperContent",[Em,_m]=Ga(xr),Qa=p.forwardRef((e,t)=>{var G,q,K,oe,Z,se;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:g,...b}=e,y=qa(xr,n),[v,E]=p.useState(null),_=Ae(t,le=>E(le)),[A,O]=p.useState(null),k=km(A),T=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,w=r+(o!=="center"?"-"+o:""),R=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},P=Array.isArray(f)?f:[f],D=P.length>0,F={padding:R,boundary:P.filter(Rm),altBoundary:D},{refs:M,floatingStyles:z,placement:S,isPositioned:C,middlewareData:H}=mm({strategy:"fixed",placement:w,whileElementsMounted:(...le)=>sm(...le,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[hm({mainAxis:s+x,alignmentAxis:a}),m&&gm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?xm():void 0,...F}),m&&vm({...F}),bm({...F,apply:({elements:le,rects:be,availableWidth:ue,availableHeight:ye})=>{const{width:fe,height:ce}=be.reference,ve=le.floating.style;ve.setProperty("--radix-popper-available-width",`${ue}px`),ve.setProperty("--radix-popper-available-height",`${ye}px`),ve.setProperty("--radix-popper-anchor-width",`${fe}px`),ve.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),A&&wm({element:A,padding:i}),Nm({arrowWidth:T,arrowHeight:x}),u&&ym({strategy:"referenceHidden",...F})]}),[I,U]=ei(S),Y=st(g);nt(()=>{C&&(Y==null||Y())},[C,Y]);const j=(G=H.arrow)==null?void 0:G.x,L=(q=H.arrow)==null?void 0:q.y,$=((K=H.arrow)==null?void 0:K.centerOffset)!==0,[N,B]=p.useState();return nt(()=>{v&&B(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:N,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(Z=H.transformOrigin)==null?void 0:Z.y].join(" "),...((se=H.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Em,{scope:n,placedSide:I,onArrowChange:O,arrowX:j,arrowY:L,shouldHideArrow:$,children:d.jsx(xe.div,{"data-side":I,"data-align":U,...b,ref:_,style:{...b.style,animation:C?void 0:"none"}})})})});Qa.displayName=xr;var Ja="PopperArrow",Tm={top:"bottom",right:"left",bottom:"top",left:"right"},Za=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=_m(Ja,r),a=Tm[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(Sm,{...s,ref:n,style:{...s.style,display:"block"}})})});Za.displayName=Ja;function Rm(e){return e!==null}var Nm=e=>({name:"transformOrigin",options:e,fn(t){var y,v,E;const{placement:n,rects:r,middlewareData:s}=t,a=((y=s.arrow)==null?void 0:y.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=ei(n),c={start:"0%",center:"50%",end:"100%"}[l],u=(((v=s.arrow)==null?void 0:v.x)??0)+i/2,h=(((E=s.arrow)==null?void 0:E.y)??0)+m/2;let g="",b="";return f==="bottom"?(g=a?c:`${u}px`,b=`${-m}px`):f==="top"?(g=a?c:`${u}px`,b=`${r.floating.height+m}px`):f==="right"?(g=`${-m}px`,b=a?c:`${h}px`):f==="left"&&(g=`${r.floating.width+m}px`,b=a?c:`${h}px`),{data:{x:g,y:b}}}});function ei(e){const[t,n="center"]=e.split("-");return[t,n]}var vr=Ka,rs=Xa,br=Qa,yr=Za,jm="Portal",vn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[s,o]=p.useState(!1);nt(()=>o(!0),[]);const a=n||s&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Cc.createPortal(d.jsx(xe.div,{...r,ref:t}),a):null});vn.displayName=jm;function Mm(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Ue=e=>{const{present:t,children:n}=e,r=Im(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=Ae(r.ref,Pm(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Ue.displayName="Presence";function Im(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Mm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=Rn(r.current);o.current=i==="mounted"?f:"none"},[i]),nt(()=>{const f=r.current,l=s.current;if(l!==e){const u=o.current,h=Rn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&u!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),nt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const b=Rn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&b&&(m("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},u=h=>{h.target===t&&(o.current=Rn(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Rn(e){return(e==null?void 0:e.animationName)||"none"}function Pm(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ss="rovingFocusGroup.onEntryFocus",Dm={bubbles:!1,cancelable:!0},bn="RovingFocusGroup",[Hs,ti,Om]=Ra(bn),[Lm,ni]=at(bn,[Om]),[Fm,$m]=Lm(bn),si=p.forwardRef((e,t)=>d.jsx(Hs.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Hs.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Um,{...e,ref:t})})}));si.displayName=bn;var Um=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,u=p.useRef(null),h=Ae(t,u),g=Na(o),[b,y]=ht({prop:a,defaultProp:i??null,onChange:m,caller:bn}),[v,E]=p.useState(!1),_=st(f),A=ti(n),O=p.useRef(!1),[k,T]=p.useState(0);return p.useEffect(()=>{const x=u.current;if(x)return x.addEventListener(Ss,_),()=>x.removeEventListener(Ss,_)},[_]),d.jsx(Fm,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:b,onItemFocus:p.useCallback(x=>y(x),[y]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>T(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>T(x=>x-1),[]),children:d.jsx(xe.div,{tabIndex:v||k===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{O.current=!0}),onFocus:ne(e.onFocus,x=>{const w=!O.current;if(x.target===x.currentTarget&&w&&!v){const R=new CustomEvent(Ss,Dm);if(x.currentTarget.dispatchEvent(R),!R.defaultPrevented){const P=A().filter(S=>S.focusable),D=P.find(S=>S.active),F=P.find(S=>S.id===b),z=[D,F,...P].filter(Boolean).map(S=>S.ref.current);ai(z,l)}}O.current=!1}),onBlur:ne(e.onBlur,()=>E(!1))})})}),ri="RovingFocusGroupItem",oi=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:a,...i}=e,m=Pe(),f=o||m,l=$m(ri,n),c=l.currentTabStopId===f,u=ti(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:b}=l;return p.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),d.jsx(Hs.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:d.jsx(xe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,y=>{r?l.onItemFocus(f):y.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:ne(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Bm(y,l.orientation,l.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=u().filter(A=>A.focusable).map(A=>A.ref.current);if(v==="last")_.reverse();else if(v==="prev"||v==="next"){v==="prev"&&_.reverse();const A=_.indexOf(y.currentTarget);_=l.loop?Wm(_,A+1):_.slice(A+1)}setTimeout(()=>ai(_))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:b!=null}):a})})});oi.displayName=ri;var zm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Bm(e,t,n){const r=Hm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zm[r]}function ai(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vm=si,Gm=oi,qm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$t=new WeakMap,Nn=new WeakMap,jn={},ks=0,ii=function(e){return e&&(e.host||ii(e.parentNode))},Km=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ii(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ym=function(e,t,n,r){var s=Km(t,Array.isArray(e)?e:[e]);jn[n]||(jn[n]=new WeakMap);var o=jn[n],a=[],i=new Set,m=new Set(s),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};s.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(u){if(i.has(u))l(u);else try{var h=u.getAttribute(r),g=h!==null&&h!=="false",b=($t.get(u)||0)+1,y=(o.get(u)||0)+1;$t.set(u,b),o.set(u,y),a.push(u),b===1&&g&&Nn.set(u,!0),y===1&&u.setAttribute(n,"true"),g||u.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",u,v)}})};return l(t),i.clear(),ks++,function(){a.forEach(function(c){var u=$t.get(c)-1,h=o.get(c)-1;$t.set(c,u),o.set(c,h),u||(Nn.has(c)||c.removeAttribute(r),Nn.delete(c)),h||c.removeAttribute(n)}),ks--,ks||($t=new WeakMap,$t=new WeakMap,Nn=new WeakMap,jn={})}},wr=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=qm(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Ym(r,s,n,"aria-hidden")):function(){return null}},Bs=["Enter"," "],Xm=["ArrowDown","PageUp","Home"],li=["ArrowUp","PageDown","End"],Qm=[...Xm,...li],Jm={ltr:[...Bs,"ArrowRight"],rtl:[...Bs,"ArrowLeft"]},Zm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yn="Menu",[dn,ep,tp]=Ra(yn),[Dt,ci]=at(yn,[tp,en,ni]),os=en(),di=ni(),[np,Ot]=Dt(yn),[sp,wn]=Dt(yn),ui=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:a=!0}=e,i=os(t),[m,f]=p.useState(null),l=p.useRef(!1),c=st(o),u=Na(s);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.jsx(vr,{...i,children:d.jsx(np,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:d.jsx(sp,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:u,modal:a,children:r})})})};ui.displayName=yn;var rp="MenuAnchor",Cr=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=os(n);return d.jsx(rs,{...s,...r,ref:t})});Cr.displayName=rp;var Sr="MenuPortal",[op,fi]=Dt(Sr,{forceMount:void 0}),mi=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Ot(Sr,t);return d.jsx(op,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};mi.displayName=Sr;var ze="MenuContent",[ap,kr]=Dt(ze),pi=p.forwardRef((e,t)=>{const n=fi(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Ot(ze,e.__scopeMenu),a=wn(ze,e.__scopeMenu);return d.jsx(dn.Provider,{scope:e.__scopeMenu,children:d.jsx(Ue,{present:r||o.open,children:d.jsx(dn.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(ip,{...s,ref:t}):d.jsx(lp,{...s,ref:t})})})})}),ip=p.forwardRef((e,t)=>{const n=Ot(ze,e.__scopeMenu),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return wr(o)},[]),d.jsx(Ar,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lp=p.forwardRef((e,t)=>{const n=Ot(ze,e.__scopeMenu);return d.jsx(Ar,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cp=qt("MenuContent.ScrollLock"),Ar=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,disableOutsideScroll:g,...b}=e,y=Ot(ze,n),v=wn(ze,n),E=os(n),_=di(n),A=ep(n),[O,k]=p.useState(null),T=p.useRef(null),x=Ae(t,T,y.onContentChange),w=p.useRef(0),R=p.useRef(""),P=p.useRef(0),D=p.useRef(null),F=p.useRef("right"),M=p.useRef(0),z=g?rr:p.Fragment,S=g?{as:cp,allowPinchZoom:!0}:void 0,C=I=>{var G,q;const U=R.current+I,Y=A().filter(K=>!K.disabled),j=document.activeElement,L=(G=Y.find(K=>K.ref.current===j))==null?void 0:G.textValue,$=Y.map(K=>K.textValue),N=wp($,U,L),B=(q=Y.find(K=>K.textValue===N))==null?void 0:q.ref.current;(function K(oe){R.current=oe,window.clearTimeout(w.current),oe!==""&&(w.current=window.setTimeout(()=>K(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(w.current),[]),cr();const H=p.useCallback(I=>{var Y,j;return F.current===((Y=D.current)==null?void 0:Y.side)&&Sp(I,(j=D.current)==null?void 0:j.area)},[]);return d.jsx(ap,{scope:n,searchRef:R,onItemEnter:p.useCallback(I=>{H(I)&&I.preventDefault()},[H]),onItemLeave:p.useCallback(I=>{var U;H(I)||((U=T.current)==null||U.focus(),k(null))},[H]),onTriggerLeave:p.useCallback(I=>{H(I)&&I.preventDefault()},[H]),pointerGraceTimerRef:P,onPointerGraceIntentChange:p.useCallback(I=>{D.current=I},[]),children:d.jsx(z,{...S,children:d.jsx(Zn,{asChild:!0,trapped:s,onMountAutoFocus:ne(o,I=>{var U;I.preventDefault(),(U=T.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,children:d.jsx(Vm,{asChild:!0,..._,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:O,onCurrentTabStopIdChange:k,onEntryFocus:ne(m,I=>{v.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(br,{role:"menu","aria-orientation":"vertical","data-state":Ni(y.open),"data-radix-menu-content":"",dir:v.dir,...E,...b,ref:x,style:{outline:"none",...b.style},onKeyDown:ne(b.onKeyDown,I=>{const Y=I.target.closest("[data-radix-menu-content]")===I.currentTarget,j=I.ctrlKey||I.altKey||I.metaKey,L=I.key.length===1;Y&&(I.key==="Tab"&&I.preventDefault(),!j&&L&&C(I.key));const $=T.current;if(I.target!==$||!Qm.includes(I.key))return;I.preventDefault();const B=A().filter(G=>!G.disabled).map(G=>G.ref.current);li.includes(I.key)&&B.reverse(),bp(B)}),onBlur:ne(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(w.current),R.current="")}),onPointerMove:ne(e.onPointerMove,un(I=>{const U=I.target,Y=M.current!==I.clientX;if(I.currentTarget.contains(U)&&Y){const j=I.clientX>M.current?"right":"left";F.current=j,M.current=I.clientX}}))})})})})})})});pi.displayName=ze;var dp="MenuGroup",Er=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{role:"group",...r,ref:t})});Er.displayName=dp;var up="MenuLabel",hi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{...r,ref:t})});hi.displayName=up;var Wn="MenuItem",ko="menu.itemSelect",as=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),a=wn(Wn,e.__scopeMenu),i=kr(Wn,e.__scopeMenu),m=Ae(t,o),f=p.useRef(!1),l=()=>{const c=o.current;if(!n&&c){const u=new CustomEvent(ko,{bubbles:!0,cancelable:!0});c.addEventListener(ko,h=>r==null?void 0:r(h),{once:!0}),Ta(c,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(gi,{...s,ref:m,disabled:n,onClick:ne(e.onClick,l),onPointerDown:c=>{var u;(u=e.onPointerDown)==null||u.call(e,c),f.current=!0},onPointerUp:ne(e.onPointerUp,c=>{var u;f.current||(u=c.currentTarget)==null||u.click()}),onKeyDown:ne(e.onKeyDown,c=>{const u=i.searchRef.current!=="";n||u&&c.key===" "||Bs.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});as.displayName=Wn;var gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,a=kr(Wn,n),i=di(n),m=p.useRef(null),f=Ae(t,m),[l,c]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[o.children]),d.jsx(dn.ItemSlot,{scope:n,disabled:r,textValue:s??u,children:d.jsx(Gm,{asChild:!0,...i,focusable:!r,children:d.jsx(xe.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:ne(e.onPointerMove,un(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,un(g=>a.onItemLeave(g))),onFocus:ne(e.onFocus,()=>c(!0)),onBlur:ne(e.onBlur,()=>c(!1))})})})}),fp="MenuCheckboxItem",xi=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return d.jsx(Ci,{scope:e.__scopeMenu,checked:n,children:d.jsx(as,{role:"menuitemcheckbox","aria-checked":Vn(n)?"mixed":n,...s,ref:t,"data-state":Tr(n),onSelect:ne(s.onSelect,()=>r==null?void 0:r(Vn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});xi.displayName=fp;var vi="MenuRadioGroup",[mp,pp]=Dt(vi,{value:void 0,onValueChange:()=>{}}),bi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=st(r);return d.jsx(mp,{scope:e.__scopeMenu,value:n,onValueChange:o,children:d.jsx(Er,{...s,ref:t})})});bi.displayName=vi;var yi="MenuRadioItem",wi=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=pp(yi,e.__scopeMenu),o=n===s.value;return d.jsx(Ci,{scope:e.__scopeMenu,checked:o,children:d.jsx(as,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Tr(o),onSelect:ne(r.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,n)},{checkForDefaultPrevented:!1})})})});wi.displayName=yi;var _r="MenuItemIndicator",[Ci,hp]=Dt(_r,{checked:!1}),Si=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=hp(_r,n);return d.jsx(Ue,{present:r||Vn(o.checked)||o.checked===!0,children:d.jsx(xe.span,{...s,ref:t,"data-state":Tr(o.checked)})})});Si.displayName=_r;var gp="MenuSeparator",ki=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ki.displayName=gp;var xp="MenuArrow",Ai=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=os(n);return d.jsx(yr,{...s,...r,ref:t})});Ai.displayName=xp;var vp="MenuSub",[Yb,Ei]=Dt(vp),ln="MenuSubTrigger",_i=p.forwardRef((e,t)=>{const n=Ot(ln,e.__scopeMenu),r=wn(ln,e.__scopeMenu),s=Ei(ln,e.__scopeMenu),o=kr(ln,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),d.jsx(Cr,{asChild:!0,...f,children:d.jsx(gi,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Ni(n.open),...e,ref:Je(t,s.onTriggerChange),onClick:c=>{var u;(u=e.onClick)==null||u.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,un(c=>{o.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:ne(e.onPointerLeave,un(c=>{var h,g;l();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const b=(g=n.content)==null?void 0:g.dataset.side,y=b==="right",v=y?-5:5,E=u[y?"left":"right"],_=u[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:c.clientX+v,y:c.clientY},{x:E,y:u.top},{x:_,y:u.top},{x:_,y:u.bottom},{x:E,y:u.bottom}],side:b}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(c),c.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,c=>{var h;const u=o.searchRef.current!=="";e.disabled||u&&c.key===" "||Jm[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});_i.displayName=ln;var Ti="MenuSubContent",Ri=p.forwardRef((e,t)=>{const n=fi(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Ot(ze,e.__scopeMenu),a=wn(ze,e.__scopeMenu),i=Ei(Ti,e.__scopeMenu),m=p.useRef(null),f=Ae(t,m);return d.jsx(dn.Provider,{scope:e.__scopeMenu,children:d.jsx(Ue,{present:r||o.open,children:d.jsx(dn.Slot,{scope:e.__scopeMenu,children:d.jsx(Ar,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:ne(e.onFocusOutside,l=>{l.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:ne(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),u=Zm[a.dir].includes(l.key);c&&u&&(o.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ri.displayName=Ti;function Ni(e){return e?"open":"closed"}function Vn(e){return e==="indeterminate"}function Tr(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function bp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function wp(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=yp(e,Math.max(o,0));s.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return m!==n?m:void 0}function Cp(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function Sp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Cp(n,t)}function un(e){return t=>t.pointerType==="mouse"?e(t):void 0}var kp=ui,Ap=Cr,Ep=mi,_p=pi,Tp=Er,Rp=hi,Np=as,jp=xi,Mp=bi,Ip=wi,Pp=Si,Dp=ki,Op=Ai,Lp=_i,Fp=Ri,is="DropdownMenu",[$p]=at(is,[ci]),De=ci(),[Up,ji]=$p(is),Mi=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,m=De(t),f=p.useRef(null),[l,c]=ht({prop:s,defaultProp:o??!1,onChange:a,caller:is});return d.jsx(Up,{scope:t,triggerId:Pe(),triggerRef:f,contentId:Pe(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(u=>!u),[c]),modal:i,children:d.jsx(kp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Mi.displayName=is;var Ii="DropdownMenuTrigger",Pi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=ji(Ii,n),a=De(n);return d.jsx(Ap,{asChild:!0,...a,children:d.jsx(xe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Je(t,o.triggerRef),onPointerDown:ne(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:ne(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Pi.displayName=Ii;var zp="DropdownMenuPortal",Di=e=>{const{__scopeDropdownMenu:t,...n}=e,r=De(t);return d.jsx(Ep,{...r,...n})};Di.displayName=zp;var Oi="DropdownMenuContent",Li=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ji(Oi,n),o=De(n),a=p.useRef(!1);return d.jsx(_p,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var m;a.current||(m=s.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!s.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Li.displayName=Oi;var Hp="DropdownMenuGroup",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Tp,{...s,...r,ref:t})});Bp.displayName=Hp;var Wp="DropdownMenuLabel",Fi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Rp,{...s,...r,ref:t})});Fi.displayName=Wp;var Vp="DropdownMenuItem",$i=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Np,{...s,...r,ref:t})});$i.displayName=Vp;var Gp="DropdownMenuCheckboxItem",qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(jp,{...s,...r,ref:t})});qp.displayName=Gp;var Kp="DropdownMenuRadioGroup",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Mp,{...s,...r,ref:t})});Yp.displayName=Kp;var Xp="DropdownMenuRadioItem",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Ip,{...s,...r,ref:t})});Qp.displayName=Xp;var Jp="DropdownMenuItemIndicator",Zp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Pp,{...s,...r,ref:t})});Zp.displayName=Jp;var eh="DropdownMenuSeparator",Ui=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Dp,{...s,...r,ref:t})});Ui.displayName=eh;var th="DropdownMenuArrow",nh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Op,{...s,...r,ref:t})});nh.displayName=th;var sh="DropdownMenuSubTrigger",rh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Lp,{...s,...r,ref:t})});rh.displayName=sh;var oh="DropdownMenuSubContent",ah=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Fp,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ah.displayName=oh;var ih=Mi,lh=Pi,ch=Di,dh=Li,uh=Fi,fh=$i,mh=Ui;function zi({...e}){return d.jsx(ih,{"data-slot":"dropdown-menu",...e})}function Hi({...e}){return d.jsx(lh,{"data-slot":"dropdown-menu-trigger",...e})}function Bi({className:e,sideOffset:t=4,...n}){return d.jsx(ch,{children:d.jsx(dh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Dn({className:e,inset:t,variant:n="default",...r}){return d.jsx(fh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function ph({className:e,inset:t,...n}){return d.jsx(uh,{"data-slot":"dropdown-menu-label","data-inset":t,className:ee("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Ao({className:e,...t}){return d.jsx(mh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const hh=[{value:"light",label:"Light",icon:d.jsx(wa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(xa,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(Zd,{className:"h-4 w-4"})}];function gh(){const{theme:e,setTheme:t,resolvedTheme:n}=Nu();return d.jsxs(zi,{children:[d.jsx(Hi,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(xa,{className:"h-4 w-4"}):d.jsx(wa,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(Bi,{align:"end",children:hh.map(r=>d.jsxs(Dn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,d.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Eo={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.unreachable":"无法连接服务器——请确认服务正在运行,且界面与 API 同源访问。","auth.login.rateLimited":"登录尝试过于频繁,请稍后再试。","auth.login.csrfBlocked":"请求来源校验失败(CSRF)——请从服务本身提供的地址打开界面。","auth.login.failedWithReason":"登录失败:{message}","auth.login.description":"输入你的用户名和密码以继续。","auth.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dashboard.emptySessionsTitle":"暂无会话","dashboard.emptySessionsHint":"点右上角「+ 新会话」开一条,或等 worker 上报会话。","dashboard.emptyEnvironmentsTitle":"暂无环境","dashboard.emptyEnvironmentsHint":"worker 经 RCS 注册后,环境会落到这条线上。","dashboard.emptyMarker":"无记录","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","session.sseReconnecting":"与服务器的实时连接中断,正在自动重连…(期间消息可能延迟显示)","session.sseFailed":"实时连接重连失败,请刷新页面恢复","user.settings.language":"语言","dashboard.searchAction":"搜索会话","dashboard.searchPlaceholder":"搜索所有会话内容…","dashboard.searchNoResults":"没有匹配的会话","dashboard.closeSearch":"收起搜索","user.settings.notifications":"浏览器通知","user.settings.notificationsDesc":"会话需要审批或回合完成时通知(仅页面处于后台时)","user.settings.notificationsDenied":"通知权限已被拒绝 — 请在浏览器设置中允许","user.settings.notificationsUnsupported":"当前环境不支持通知(需要 HTTPS 或 localhost)","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"Artifacts","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建 Artifact","artifacts.empty":'还没有 Artifact。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载 Artifacts 失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"Artifact 不存在或已过期","artifacts.backToGallery":"← 返回 Artifacts","artifacts.create.title":"新建 Artifact","artifacts.editArtifact":"编辑 Artifact","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此 artifact","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的 artifacts 提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此 Artifact,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该 Artifact 关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为 Artifact","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话","permission.title":"权限请求","permission.required":"需要权限","permission.approve":"允许","permission.alwaysAllow":"始终允许","permission.alwaysAllowHint":"允许并记住规则:{rule}","permission.reject":"拒绝","dashboard.searching":"搜索中…","dashboard.nMatches":"{n} 处匹配","dashboard.nameMatch":"标题/ID 匹配","session.mode.title":"权限模式(Shift+Tab 循环)","session.mode.default":"默认","session.mode.defaultDesc":"手动审批权限请求","session.mode.acceptEdits":"自动接受编辑","session.mode.acceptEditsDesc":"自动允许文件编辑操作","session.mode.plan":"规划模式","session.mode.planDesc":"仅规划,不执行工具","session.mode.bypass":"跳过权限","session.mode.bypassDesc":"跳过所有权限检查","session.mode.switchFailedRequest":"模式切换请求发送失败: {message}","session.mode.switchFailed":"模式切换失败","session.thinking.title":"思考预算","session.thinking.off":"关闭思考","session.thinking.offDesc":"不使用扩展思考","session.thinking.on":"默认思考","session.thinking.onDesc":"开启,使用默认预算","session.thinking.fallback":"思考","session.thinking.failedRequest":"思考预算请求发送失败: {message}","session.thinking.failed":"思考预算切换失败","session.effort.title":"Effort 档位","session.effort.auto":"自动","session.effort.autoDesc":"使用模型默认 effort","session.effort.lowDesc":"低推理力度","session.effort.mediumDesc":"中推理力度","session.effort.highDesc":"高推理力度","session.effort.xhighDesc":"超高推理力度","session.effort.maxDesc":"最大推理力度","session.effort.fallback":"自动","session.effort.failedRequest":"Effort 切换请求发送失败: {message}","session.effort.failed":"Effort 切换失败","session.model.title":"选择模型","session.context.tooltip":"上下文用量:{used} / {max} tokens","session.context.deferredSuffix":"(延迟加载)","session.usage.total":"会话累计用量(input 含缓存读写)","session.resume.title":"恢复历史对话","session.resume.currentBlocked":"不能恢复当前会话自身","session.resume.restoring":"正在恢复「{title}」…","session.resume.restored":"已恢复 {count} 条消息","session.resume.restoredWithTitle":"已恢复 {count} 条消息:{title}","session.resume.failed":"恢复失败:{message}","session.resume.unsupported":"当前 worker 不支持 /resume(需要 spawn 模式 worker:slz rc)","session.resumeInNew":"在新会话中继续此对话(/resume)","session.createFailedWithReason":"创建会话失败:{message}","session.rewind.confirmEdit":"回退到这条消息并编辑?","session.rewind.confirm":"回退到这条消息?","session.rewind.confirmBody":"之后的对话将移除,已修改的文件将恢复到当时的状态(若有快照)。","session.rewind.failed":"回退失败: {message}","session.rename.title":"重命名会话","session.rename.failed":"重命名失败","session.sideQuestion.title":"旁路提问 — 针对会话上下文提问,不进入主对话","session.search.title":"搜索会话内容","session.mcp.title":"MCP 服务器","session.settings.title":"会话设置","session.search.placeholder":"搜索会话内容…","session.search.noResults":"无结果","session.stopTask.failed":"停止任务失败","settings.unset":"(未设置)","settings.loadFailed":"获取设置失败 — worker 可能不支持","settings.writeFailed":"写入失败","settings.loading":"加载设置…","settings.model":"模型","settings.defaultModel":"(默认)","settings.hint":"布尔开关写入会话级 flag 层(apply_flag_settings);只读项点击查看详情。","settings.back":"返回设置列表","settings.copied":"已复制","settings.copyValue":"复制值","settings.searchPlaceholder":"搜索设置项…","settings.noMatch":"没有匹配的设置项","settings.togglable":"可设置({n})","settings.readOnly":"只读({n})","settings.turnOff":"关闭(写入 false)","settings.turnOn":"开启(写入 true)","settings.viewDetail":"查看详情","mcp.status.connected":"已连接","mcp.status.failed":"失败","mcp.status.needsAuth":"待认证","mcp.status.pending":"连接中","mcp.status.disabled":"已禁用","mcp.loadFailed":"获取 MCP 状态失败 — worker 可能不支持","mcp.toggleFailed":"切换失败","mcp.reconnectFailed":"重连失败","mcp.loading":"加载 MCP 状态…","mcp.empty":"没有配置 MCP 服务器","mcp.toolCount":"{n} 工具","mcp.reconnect":"重连","mcp.enable":"启用","mcp.disable":"禁用","resume.loading":"正在加载本地会话列表…","resume.empty":"没有可恢复的历史对话","resume.today":"今天","resume.yesterday":"昨天","resume.earlier":"更早","sideQuestion.title":"旁路提问","sideQuestion.desc":"针对当前会话上下文提问,不进入主对话、不消耗会话历史 — 适合「这个会话干了什么」式的快速核对。","sideQuestion.empty":"还没有提问。在下方输入你的问题。","sideQuestion.noAnswer":"没有获得回答(超时或 worker 不支持)","sideQuestion.placeholder":"问点什么…","sideQuestion.send":"提问(Enter)","elicitation.title":"MCP 请求输入","elicitation.required":"必填","elicitation.submit":"提交","elicitation.decline":"拒绝","elicitation.done":"完成","subagent.stop":"停止此任务","task.endConfirm":"结束 worker 会话?正在进行的回合将被中止,会话随后归档。","task.endHint":"通知 worker 中止在途回合并退出,随后归档会话","permission.writeUnknown":"待写入","permission.requestAria":"权限请求:{tool}","user.settings.notificationsOn":"已开启","user.settings.notificationsOff":"已关闭","artifacts.create.markdownPlaceholder":`# 周报
|
|
207
|
+
*/const Ru=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],hn=ie("x",Ru),Sa=p.createContext(void 0),ka="theme";function Zr(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function eo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(ka);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function to(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function Nu(){const e=p.useContext(Sa);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function ju({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>eo()||t),[s,o]=p.useState(()=>{const m=eo()||t;return m==="system"?Zr():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(ka,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Zr():n;o(m),to(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";o(c),to(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:s,setTheme:a};return ft.createElement(Sa.Provider,{value:i},e)}function no(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Je(...e){return t=>{let n=!1;const r=e.map(s=>{const o=no(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<r.length;s++){const o=r[s];typeof o=="function"?o():no(e[s],null)}}}}function Ae(...e){return p.useCallback(Je(...e),e)}var Mu=Symbol.for("react.lazy"),$n=sr[" use ".trim().toString()];function Iu(e){return typeof e=="object"&&e!==null&&"then"in e}function Aa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Mu&&"_payload"in e&&Iu(e._payload)}function Ea(e){const t=Du(e),n=p.forwardRef((r,s)=>{let{children:o,...a}=r;Aa(o)&&typeof $n=="function"&&(o=$n(o._payload));const i=p.Children.toArray(o),m=i.find(Lu);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var Pu=Ea("Slot");function Du(e){const t=p.forwardRef((n,r)=>{let{children:s,...o}=n;if(Aa(s)&&typeof $n=="function"&&(s=$n(s._payload)),p.isValidElement(s)){const a=$u(s),i=Fu(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ou=Symbol("radix.slottable");function Lu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ou}function Fu(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function $u(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const so=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ro=Zo,Uu=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ro(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,a=Object.keys(s).map(f=>{const l=n==null?void 0:n[f],c=o==null?void 0:o[f];if(l===null)return null;const u=so(l)||so(c);return s[f][u]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,u]=l;return u===void 0||(f[c]=u),f},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:u,...h}=l;return Object.entries(h).every(x=>{let[b,y]=x;return Array.isArray(y)?y.includes({...o,...i}[b]):{...o,...i}[b]===y})?[...f,c,u]:f},[]);return ro(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},zu=Uu("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Pt({className:e,variant:t,size:n,asChild:r=!1,...s}){const o=r?Pu:"button";return d.jsx(o,{"data-slot":"button",className:ee(zu({variant:t,size:n,className:e})),...s})}function ne(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function Hu(e,t){const n=p.createContext(t),r=o=>{const{children:a,...i}=o,m=p.useMemo(()=>i,Object.values(i));return d.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function s(o){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[r,s]}function at(e,t=[]){let n=[];function r(o,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var v;const{scope:u,children:h,...x}=c,b=((v=u==null?void 0:u[e])==null?void 0:v[m])||i,y=p.useMemo(()=>x,Object.values(x));return d.jsx(b.Provider,{value:y,children:h})};f.displayName=o+"Provider";function l(c,u){var b;const h=((b=u==null?void 0:u[e])==null?void 0:b[m])||i,x=p.useContext(h);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${o}\``)}return[f,l]}const s=()=>{const o=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return s.scopeName=e,[r,Bu(s,...t)]}function Bu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=r.reduce((i,{useScope:m,scopeName:f})=>{const c=m(o)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var nt=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Wu=sr[" useInsertionEffect ".trim().toString()]||nt;function ht({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[s,o,a]=Vu({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:s;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const u=Gu(l)?l(e):l;u!==e&&((c=a.current)==null||c.call(a,u))}else o(l)},[i,e,o,a]);return[m,f]}function Vu({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),s=p.useRef(n),o=p.useRef(t);return Wu(()=>{o.current=t},[t]),p.useEffect(()=>{var a;s.current!==n&&((a=o.current)==null||a.call(o,n),s.current=n)},[n,s]),[n,r,o]}function Gu(e){return typeof e=="function"}function qt(e){const t=qu(e),n=p.forwardRef((r,s)=>{const{children:o,...a}=r,i=p.Children.toArray(o),m=i.find(Yu);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return d.jsx(t,{...a,ref:s,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return d.jsx(t,{...a,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function qu(e){const t=p.forwardRef((n,r)=>{const{children:s,...o}=n;if(p.isValidElement(s)){const a=Qu(s),i=Xu(o,s.props);return s.type!==p.Fragment&&(i.ref=r?Je(r,a):a),p.cloneElement(s,i)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _a=Symbol("radix.slottable");function Ku(e){const t=({children:n})=>d.jsx(d.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_a,t}function Yu(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_a}function Xu(e,t){const n={...t};for(const r in t){const s=e[r],o=t[r];/^on[A-Z]/.test(r)?s&&o?n[r]=(...i)=>{const m=o(...i);return s(...i),m}:s&&(n[r]=s):r==="style"?n[r]={...s,...o}:r==="className"&&(n[r]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Qu(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ju=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xe=Ju.reduce((e,t)=>{const n=qt(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Ta(e,t){e&&Qo.flushSync(()=>e.dispatchEvent(t))}function Ra(e){const t=e+"CollectionProvider",[n,r]=at(t),[s,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=b=>{const{scope:y,children:v}=b,E=ft.useRef(null),_=ft.useRef(new Map).current;return d.jsx(s,{scope:y,itemMap:_,collectionRef:E,children:v})};a.displayName=t;const i=e+"CollectionSlot",m=qt(i),f=ft.forwardRef((b,y)=>{const{scope:v,children:E}=b,_=o(i,v),k=Ae(y,_.collectionRef);return d.jsx(m,{ref:k,children:E})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",u=qt(l),h=ft.forwardRef((b,y)=>{const{scope:v,children:E,..._}=b,k=ft.useRef(null),L=Ae(y,k),A=o(l,v);return ft.useEffect(()=>(A.itemMap.set(k,{ref:k,..._}),()=>void A.itemMap.delete(k))),d.jsx(u,{[c]:"",ref:L,children:E})});h.displayName=l;function x(b){const y=o(e+"CollectionConsumer",b);return ft.useCallback(()=>{const E=y.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${c}]`));return Array.from(y.itemMap.values()).sort((A,T)=>_.indexOf(A.ref.current)-_.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},x,r]}var Zu=p.createContext(void 0);function Na(e){const t=p.useContext(Zu);return e||t||"ltr"}function st(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ef(e,t=globalThis==null?void 0:globalThis.document){const n=st(e);p.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tf="DismissableLayer",Fs="dismissableLayer.update",nf="dismissableLayer.pointerDownOutside",sf="dismissableLayer.focusOutside",oo,ja=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),gn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ja),[l,c]=p.useState(null),u=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),x=Ae(t,T=>c(T)),b=Array.from(f.layers),[y]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),v=b.indexOf(y),E=l?b.indexOf(l):-1,_=f.layersWithOutsidePointerEventsDisabled.size>0,k=E>=v,L=af(T=>{const g=T.target,w=[...f.branches].some(N=>N.contains(g));!k||w||(s==null||s(T),a==null||a(T),T.defaultPrevented||i==null||i())},u),A=lf(T=>{const g=T.target;[...f.branches].some(N=>N.contains(g))||(o==null||o(T),a==null||a(T),T.defaultPrevented||i==null||i())},u);return ef(T=>{E===f.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&i&&(T.preventDefault(),i()))},u),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(oo=u.body.style.pointerEvents,u.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ao(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(u.body.style.pointerEvents=oo)}},[l,u,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ao())},[l,f]),p.useEffect(()=>{const T=()=>h({});return document.addEventListener(Fs,T),()=>document.removeEventListener(Fs,T)},[]),d.jsx(xe.div,{...m,ref:x,style:{pointerEvents:_?k?"auto":"none":void 0,...e.style},onFocusCapture:ne(e.onFocusCapture,A.onFocusCapture),onBlurCapture:ne(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ne(e.onPointerDownCapture,L.onPointerDownCapture)})});gn.displayName=tf;var rf="DismissableLayerBranch",of=p.forwardRef((e,t)=>{const n=p.useContext(ja),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),d.jsx(xe.div,{...e,ref:s})});of.displayName=rf;function af(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const o=i=>{if(i.target&&!r.current){let m=function(){Ma(nf,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function lf(e,t=globalThis==null?void 0:globalThis.document){const n=st(e),r=p.useRef(!1);return p.useEffect(()=>{const s=o=>{o.target&&!r.current&&Ma(sf,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ao(){const e=new CustomEvent(Fs);document.dispatchEvent(e)}function Ma(e,t,n,{discrete:r}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?Ta(s,o):s.dispatchEvent(o)}var xs=0;function cr(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??io()),document.body.insertAdjacentElement("beforeend",e[1]??io()),xs++,()=>{xs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xs--}},[])}function io(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var vs="focusScope.autoFocusOnMount",bs="focusScope.autoFocusOnUnmount",lo={bubbles:!1,cancelable:!0},cf="FocusScope",Zn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[i,m]=p.useState(null),f=st(s),l=st(o),c=p.useRef(null),u=Ae(t,b=>m(b)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let b=function(_){if(h.paused||!i)return;const k=_.target;i.contains(k)?c.current=k:mt(c.current,{select:!0})},y=function(_){if(h.paused||!i)return;const k=_.relatedTarget;k!==null&&(i.contains(k)||mt(c.current,{select:!0}))},v=function(_){if(document.activeElement===document.body)for(const L of _)L.removedNodes.length>0&&mt(i)};document.addEventListener("focusin",b),document.addEventListener("focusout",y);const E=new MutationObserver(v);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",y),E.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){uo.add(h);const b=document.activeElement;if(!i.contains(b)){const v=new CustomEvent(vs,lo);i.addEventListener(vs,f),i.dispatchEvent(v),v.defaultPrevented||(df(hf(Ia(i)),{select:!0}),document.activeElement===b&&mt(i))}return()=>{i.removeEventListener(vs,f),setTimeout(()=>{const v=new CustomEvent(bs,lo);i.addEventListener(bs,l),i.dispatchEvent(v),v.defaultPrevented||mt(b??document.body,{select:!0}),i.removeEventListener(bs,l),uo.remove(h)},0)}}},[i,f,l,h]);const x=p.useCallback(b=>{if(!n&&!r||h.paused)return;const y=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(y&&v){const E=b.currentTarget,[_,k]=uf(E);_&&k?!b.shiftKey&&v===k?(b.preventDefault(),n&&mt(_,{select:!0})):b.shiftKey&&v===_&&(b.preventDefault(),n&&mt(k,{select:!0})):v===E&&b.preventDefault()}},[n,r,h.paused]);return d.jsx(xe.div,{tabIndex:-1,...a,ref:u,onKeyDown:x})});Zn.displayName=cf;function df(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(mt(r,{select:t}),document.activeElement!==n)return}function uf(e){const t=Ia(e),n=co(t,e),r=co(t.reverse(),e);return[n,r]}function Ia(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function co(e,t){for(const n of e)if(!ff(n,{upTo:t}))return n}function ff(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mf(e){return e instanceof HTMLInputElement&&"select"in e}function mt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mf(e)&&t&&e.select()}}var uo=pf();function pf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=fo(e,t),e.unshift(t)},remove(t){var n;e=fo(e,t),(n=e[0])==null||n.resume()}}}function fo(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hf(e){return e.filter(t=>t.tagName!=="A")}var gf=sr[" useId ".trim().toString()]||(()=>{}),xf=0;function Pe(e){const[t,n]=p.useState(gf());return nt(()=>{n(r=>r??String(xf++))},[e]),e||(t?`radix-${t}`:"")}const vf=["top","right","bottom","left"],gt=Math.min,Fe=Math.max,Un=Math.round,Tn=Math.floor,Qe=e=>({x:e,y:e}),bf={left:"right",right:"left",bottom:"top",top:"bottom"};function $s(e,t,n){return Fe(e,gt(t,n))}function rt(e,t){return typeof e=="function"?e(t):e}function ot(e){return e.split("-")[0]}function Jt(e){return e.split("-")[1]}function dr(e){return e==="x"?"y":"x"}function ur(e){return e==="y"?"height":"width"}function Xe(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function fr(e){return dr(Xe(e))}function yf(e,t,n){n===void 0&&(n=!1);const r=Jt(e),s=fr(e),o=ur(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=zn(a)),[a,zn(a)]}function wf(e){const t=zn(e);return[Us(e),t,Us(t)]}function Us(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const mo=["left","right"],po=["right","left"],Cf=["top","bottom"],Sf=["bottom","top"];function kf(e,t,n){switch(e){case"top":case"bottom":return n?t?po:mo:t?mo:po;case"left":case"right":return t?Cf:Sf;default:return[]}}function Af(e,t,n,r){const s=Jt(e);let o=kf(ot(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(Us)))),o}function zn(e){const t=ot(e);return bf[t]+e.slice(t.length)}function Ef(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pa(e){return typeof e!="number"?Ef(e):{top:e,right:e,bottom:e,left:e}}function Hn(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function ho(e,t,n){let{reference:r,floating:s}=e;const o=Xe(t),a=fr(t),i=ur(a),m=ot(t),f=o==="y",l=r.x+r.width/2-s.width/2,c=r.y+r.height/2-s.height/2,u=r[i]/2-s[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-s.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-s.width,y:c};break;default:h={x:r.x,y:r.y}}switch(Jt(t)){case"start":h[a]-=u*(n&&f?-1:1);break;case"end":h[a]+=u*(n&&f?-1:1);break}return h}async function _f(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:u=!1,padding:h=0}=rt(t,e),x=Pa(h),y=i[u?c==="floating"?"reference":"floating":c],v=Hn(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(y)))==null||n?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),E=c==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(i.floating)),k=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},L=Hn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:E,offsetParent:_,strategy:m}):E);return{top:(v.top-L.top+x.top)/k.y,bottom:(L.bottom-v.bottom+x.bottom)/k.y,left:(v.left-L.left+x.left)/k.x,right:(L.right-v.right+x.right)/k.x}}const Tf=50,Rf=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:_f},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:l,y:c}=ho(f,r,m),u=r,h=0;const x={};for(let b=0;b<o.length;b++){const y=o[b];if(!y)continue;const{name:v,fn:E}=y,{x:_,y:k,data:L,reset:A}=await E({x:l,y:c,initialPlacement:r,placement:u,strategy:s,middlewareData:x,rects:f,platform:i,elements:{reference:e,floating:t}});l=_??l,c=k??c,x[v]={...x[v],...L},A&&h<Tf&&(h++,typeof A=="object"&&(A.placement&&(u=A.placement),A.rects&&(f=A.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):A.rects),{x:l,y:c}=ho(f,u,m)),b=-1)}return{x:l,y:c,placement:u,strategy:s,middlewareData:x}},Nf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=rt(e,t)||{};if(f==null)return{};const c=Pa(l),u={x:n,y:r},h=fr(s),x=ur(h),b=await a.getDimensions(f),y=h==="y",v=y?"top":"left",E=y?"bottom":"right",_=y?"clientHeight":"clientWidth",k=o.reference[x]+o.reference[h]-u[h]-o.floating[x],L=u[h]-o.reference[h],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let T=A?A[_]:0;(!T||!await(a.isElement==null?void 0:a.isElement(A)))&&(T=i.floating[_]||o.floating[x]);const g=k/2-L/2,w=T/2-b[x]/2-1,N=gt(c[v],w),P=gt(c[E],w),D=N,F=T-b[x]-P,j=T/2-b[x]/2+g,z=$s(D,j,F),S=!m.arrow&&Jt(s)!=null&&j!==z&&o.reference[x]/2-(j<D?N:P)-b[x]/2<0,C=S?j<D?j-D:j-F:0;return{[h]:u[h]+C,data:{[h]:z,centerOffset:j-z-C,...S&&{alignmentOffset:C}},reset:S}}}),jf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:u,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...y}=rt(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const v=ot(s),E=Xe(i),_=ot(i)===i,k=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=u||(_||!b?[zn(i)]:wf(i)),A=x!=="none";!u&&A&&L.push(...Af(i,b,x,k));const T=[i,...L],g=await m.detectOverflow(t,y),w=[];let N=((r=o.flip)==null?void 0:r.overflows)||[];if(l&&w.push(g[v]),c){const j=yf(s,a,k);w.push(g[j[0]],g[j[1]])}if(N=[...N,{placement:s,overflows:w}],!w.every(j=>j<=0)){var P,D;const j=(((P=o.flip)==null?void 0:P.index)||0)+1,z=T[j];if(z&&(!(c==="alignment"?E!==Xe(z):!1)||N.every(H=>Xe(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:j,overflows:N},reset:{placement:z}};let S=(D=N.filter(C=>C.overflows[0]<=0).sort((C,H)=>C.overflows[1]-H.overflows[1])[0])==null?void 0:D.placement;if(!S)switch(h){case"bestFit":{var F;const C=(F=N.filter(H=>{if(A){const I=Xe(H.placement);return I===E||I==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(I=>I>0).reduce((I,U)=>I+U,0)]).sort((H,I)=>H[1]-I[1])[0])==null?void 0:F[0];C&&(S=C);break}case"initialPlacement":S=i;break}if(s!==S)return{reset:{placement:S}}}return{}}}};function go(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xo(e){return vf.some(t=>e[t]>=0)}const Mf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:s="referenceHidden",...o}=rt(e,t);switch(s){case"referenceHidden":{const a=await r.detectOverflow(t,{...o,elementContext:"reference"}),i=go(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:xo(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...o,altBoundary:!0}),i=go(a,n.floating);return{data:{escapedOffsets:i,escaped:xo(i)}}}default:return{}}}}},Da=new Set(["left","top"]);async function If(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ot(n),i=Jt(n),m=Xe(n)==="y",f=Da.has(a)?-1:1,l=o&&m?-1:1,c=rt(t,e);let{mainAxis:u,crossAxis:h,alignmentAxis:x}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof x=="number"&&(h=i==="end"?x*-1:x),m?{x:h*l,y:u*f}:{x:u*f,y:h*l}}const Pf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:i}=t,m=await If(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:s+m.x,y:o+m.y,data:{...m,placement:a}}}}},Df=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:v=>{let{x:E,y:_}=v;return{x:E,y:_}}},...f}=rt(e,t),l={x:n,y:r},c=await o.detectOverflow(t,f),u=Xe(ot(s)),h=dr(u);let x=l[h],b=l[u];if(a){const v=h==="y"?"top":"left",E=h==="y"?"bottom":"right",_=x+c[v],k=x-c[E];x=$s(_,x,k)}if(i){const v=u==="y"?"top":"left",E=u==="y"?"bottom":"right",_=b+c[v],k=b-c[E];b=$s(_,b,k)}const y=m.fn({...t,[h]:x,[u]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[h]:a,[u]:i}}}}}},Of=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:o,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=rt(e,t),l={x:n,y:r},c=Xe(s),u=dr(c);let h=l[u],x=l[c];const b=rt(i,t),y=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(m){const _=u==="y"?"height":"width",k=o.reference[u]-o.floating[_]+y.mainAxis,L=o.reference[u]+o.reference[_]-y.mainAxis;h<k?h=k:h>L&&(h=L)}if(f){var v,E;const _=u==="y"?"width":"height",k=Da.has(ot(s)),L=o.reference[c]-o.floating[_]+(k&&((v=a.offset)==null?void 0:v[c])||0)+(k?0:y.crossAxis),A=o.reference[c]+o.reference[_]+(k?0:((E=a.offset)==null?void 0:E[c])||0)-(k?y.crossAxis:0);x<L?x=L:x>A&&(x=A)}return{[u]:h,[c]:x}}}},Lf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:o,platform:a,elements:i}=t,{apply:m=()=>{},...f}=rt(e,t),l=await a.detectOverflow(t,f),c=ot(s),u=Jt(s),h=Xe(s)==="y",{width:x,height:b}=o.floating;let y,v;c==="top"||c==="bottom"?(y=c,v=u===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(v=c,y=u==="end"?"top":"bottom");const E=b-l.top-l.bottom,_=x-l.left-l.right,k=gt(b-l[y],E),L=gt(x-l[v],_),A=!t.middlewareData.shift;let T=k,g=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(g=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=E),A&&!u){const N=Fe(l.left,0),P=Fe(l.right,0),D=Fe(l.top,0),F=Fe(l.bottom,0);h?g=x-2*(N!==0||P!==0?N+P:Fe(l.left,l.right)):T=b-2*(D!==0||F!==0?D+F:Fe(l.top,l.bottom))}await m({...t,availableWidth:g,availableHeight:T});const w=await a.getDimensions(i.floating);return x!==w.width||b!==w.height?{reset:{rects:!0}}:{}}}};function es(){return typeof window<"u"}function Zt(e){return Oa(e)?(e.nodeName||"").toLowerCase():"#document"}function $e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ze(e){var t;return(t=(Oa(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Oa(e){return es()?e instanceof Node||e instanceof $e(e).Node:!1}function Be(e){return es()?e instanceof Element||e instanceof $e(e).Element:!1}function it(e){return es()?e instanceof HTMLElement||e instanceof $e(e).HTMLElement:!1}function vo(e){return!es()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $e(e).ShadowRoot}function xn(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=We(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Ff(e){return/^(table|td|th)$/.test(Zt(e))}function ts(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $f=/transform|translate|scale|rotate|perspective|filter/,Uf=/paint|layout|strict|content/,At=e=>!!e&&e!=="none";let ys;function mr(e){const t=Be(e)?We(e):e;return At(t.transform)||At(t.translate)||At(t.scale)||At(t.rotate)||At(t.perspective)||!pr()&&(At(t.backdropFilter)||At(t.filter))||$f.test(t.willChange||"")||Uf.test(t.contain||"")}function zf(e){let t=xt(e);for(;it(t)&&!Kt(t);){if(mr(t))return t;if(ts(t))return null;t=xt(t)}return null}function pr(){return ys==null&&(ys=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ys}function Kt(e){return/^(html|body|#document)$/.test(Zt(e))}function We(e){return $e(e).getComputedStyle(e)}function ns(e){return Be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xt(e){if(Zt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vo(e)&&e.host||Ze(e);return vo(t)?t.host:t}function La(e){const t=xt(e);return Kt(t)?e.ownerDocument?e.ownerDocument.body:e.body:it(t)&&xn(t)?t:La(t)}function cn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=La(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=$e(s);if(o){const i=zs(a);return t.concat(a,a.visualViewport||[],xn(s)?s:[],i&&n?cn(i):[])}else return t.concat(s,cn(s,[],n))}function zs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Fa(e){const t=We(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=it(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,i=Un(n)!==o||Un(r)!==a;return i&&(n=o,r=a),{width:n,height:r,$:i}}function hr(e){return Be(e)?e:e.contextElement}function Wt(e){const t=hr(e);if(!it(t))return Qe(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=Fa(t);let a=(o?Un(n.width):n.width)/r,i=(o?Un(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Hf=Qe(0);function $a(e){const t=$e(e);return!pr()||!t.visualViewport?Hf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Bf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==$e(e)?!1:t}function Nt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=hr(e);let a=Qe(1);t&&(r?Be(r)&&(a=Wt(r)):a=Wt(e));const i=Bf(o,n,r)?$a(o):Qe(0);let m=(s.left+i.x)/a.x,f=(s.top+i.y)/a.y,l=s.width/a.x,c=s.height/a.y;if(o){const u=$e(o),h=r&&Be(r)?$e(r):r;let x=u,b=zs(x);for(;b&&r&&h!==x;){const y=Wt(b),v=b.getBoundingClientRect(),E=We(b),_=v.left+(b.clientLeft+parseFloat(E.paddingLeft))*y.x,k=v.top+(b.clientTop+parseFloat(E.paddingTop))*y.y;m*=y.x,f*=y.y,l*=y.x,c*=y.y,m+=_,f+=k,x=$e(b),b=zs(x)}}return Hn({width:l,height:c,x:m,y:f})}function ss(e,t){const n=ns(e).scrollLeft;return t?t.left+n:Nt(Ze(e)).left+n}function Ua(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-ss(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Wf(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=Ze(r),i=t?ts(t.floating):!1;if(r===a||i&&o)return n;let m={scrollLeft:0,scrollTop:0},f=Qe(1);const l=Qe(0),c=it(r);if((c||!c&&!o)&&((Zt(r)!=="body"||xn(a))&&(m=ns(r)),c)){const h=Nt(r);f=Wt(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const u=a&&!c&&!o?Ua(a,m):Qe(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+u.x,y:n.y*f.y-m.scrollTop*f.y+l.y+u.y}}function Vf(e){return Array.from(e.getClientRects())}function Gf(e){const t=Ze(e),n=ns(e),r=e.ownerDocument.body,s=Fe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=Fe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ss(e);const i=-n.scrollTop;return We(r).direction==="rtl"&&(a+=Fe(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:i}}const bo=25;function qf(e,t){const n=$e(e),r=Ze(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,i=0,m=0;if(s){o=s.width,a=s.height;const l=pr();(!l||l&&t==="fixed")&&(i=s.offsetLeft,m=s.offsetTop)}const f=ss(r);if(f<=0){const l=r.ownerDocument,c=l.body,u=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(u.marginLeft)+parseFloat(u.marginRight)||0,x=Math.abs(r.clientWidth-c.clientWidth-h);x<=bo&&(o-=x)}else f<=bo&&(o+=f);return{width:o,height:a,x:i,y:m}}function Kf(e,t){const n=Nt(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=it(e)?Wt(e):Qe(1),a=e.clientWidth*o.x,i=e.clientHeight*o.y,m=s*o.x,f=r*o.y;return{width:a,height:i,x:m,y:f}}function yo(e,t,n){let r;if(t==="viewport")r=qf(e,n);else if(t==="document")r=Gf(Ze(e));else if(Be(t))r=Kf(t,n);else{const s=$a(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Hn(r)}function za(e,t){const n=xt(e);return n===t||!Be(n)||Kt(n)?!1:We(n).position==="fixed"||za(n,t)}function Yf(e,t){const n=t.get(e);if(n)return n;let r=cn(e,[],!1).filter(i=>Be(i)&&Zt(i)!=="body"),s=null;const o=We(e).position==="fixed";let a=o?xt(e):e;for(;Be(a)&&!Kt(a);){const i=We(a),m=mr(a);!m&&i.position==="fixed"&&(s=null),(o?!m&&!s:!m&&i.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||xn(a)&&!m&&za(e,a))?r=r.filter(l=>l!==a):s=i,a=xt(a)}return t.set(e,r),r}function Xf(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?ts(t)?[]:Yf(t,this._c):[].concat(n),r],i=yo(t,a[0],s);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let u=1;u<a.length;u++){const h=yo(t,a[u],s);m=Fe(h.top,m),f=gt(h.right,f),l=gt(h.bottom,l),c=Fe(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Qf(e){const{width:t,height:n}=Fa(e);return{width:t,height:n}}function Jf(e,t,n){const r=it(t),s=Ze(t),o=n==="fixed",a=Nt(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const m=Qe(0);function f(){m.x=ss(s)}if(r||!r&&!o)if((Zt(t)!=="body"||xn(s))&&(i=ns(t)),r){const h=Nt(t,!0,o,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else s&&f();o&&!r&&s&&f();const l=s&&!r&&!o?Ua(s,i):Qe(0),c=a.left+i.scrollLeft-m.x-l.x,u=a.top+i.scrollTop-m.y-l.y;return{x:c,y:u,width:a.width,height:a.height}}function ws(e){return We(e).position==="static"}function wo(e,t){if(!it(e)||We(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ze(e)===n&&(n=n.ownerDocument.body),n}function Ha(e,t){const n=$e(e);if(ts(e))return n;if(!it(e)){let s=xt(e);for(;s&&!Kt(s);){if(Be(s)&&!ws(s))return s;s=xt(s)}return n}let r=wo(e,t);for(;r&&Ff(r)&&ws(r);)r=wo(r,t);return r&&Kt(r)&&ws(r)&&!mr(r)?n:r||zf(e)||n}const Zf=async function(e){const t=this.getOffsetParent||Ha,n=this.getDimensions,r=await n(e.floating);return{reference:Jf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function em(e){return We(e).direction==="rtl"}const tm={convertOffsetParentRelativeRectToViewportRelativeRect:Wf,getDocumentElement:Ze,getClippingRect:Xf,getOffsetParent:Ha,getElementRects:Zf,getClientRects:Vf,getDimensions:Qf,getScale:Wt,isElement:Be,isRTL:em};function Ba(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nm(e,t){let n=null,r;const s=Ze(e);function o(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),o();const f=e.getBoundingClientRect(),{left:l,top:c,width:u,height:h}=f;if(i||t(),!u||!h)return;const x=Tn(c),b=Tn(s.clientWidth-(l+u)),y=Tn(s.clientHeight-(c+h)),v=Tn(l),_={rootMargin:-x+"px "+-b+"px "+-y+"px "+-v+"px",threshold:Fe(0,gt(1,m))||1};let k=!0;function L(A){const T=A[0].intersectionRatio;if(T!==m){if(!k)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!Ba(f,e.getBoundingClientRect())&&a(),k=!1}try{n=new IntersectionObserver(L,{..._,root:s.ownerDocument})}catch{n=new IntersectionObserver(L,_)}n.observe(e)}return a(!0),o}function sm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=hr(e),l=s||o?[...f?cn(f):[],...t?cn(t):[]]:[];l.forEach(v=>{s&&v.addEventListener("scroll",n,{passive:!0}),o&&v.addEventListener("resize",n)});const c=f&&i?nm(f,n):null;let u=-1,h=null;a&&(h=new ResizeObserver(v=>{let[E]=v;E&&E.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let x,b=m?Nt(e):null;m&&y();function y(){const v=Nt(e);b&&!Ba(b,v)&&n(),b=v,x=requestAnimationFrame(y)}return n(),()=>{var v;l.forEach(E=>{s&&E.removeEventListener("scroll",n),o&&E.removeEventListener("resize",n)}),c==null||c(),(v=h)==null||v.disconnect(),h=null,m&&cancelAnimationFrame(x)}}const rm=Pf,om=Df,am=jf,im=Lf,lm=Mf,Co=Nf,cm=Of,dm=(e,t,n)=>{const r=new Map,s={platform:tm,...n},o={...s.platform,_c:r};return Rf(e,t,{...s,platform:o})};var um=typeof document<"u",fm=function(){},Pn=um?p.useLayoutEffect:fm;function Bn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Bn(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!Bn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Wa(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function So(e,t){const n=Wa(e);return Math.round(t*n)/n}function Cs(e){const t=p.useRef(e);return Pn(()=>{t.current=e}),t}function mm(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,h]=p.useState(r);Bn(u,r)||h(r);const[x,b]=p.useState(null),[y,v]=p.useState(null),E=p.useCallback(H=>{H!==A.current&&(A.current=H,b(H))},[]),_=p.useCallback(H=>{H!==T.current&&(T.current=H,v(H))},[]),k=o||x,L=a||y,A=p.useRef(null),T=p.useRef(null),g=p.useRef(l),w=m!=null,N=Cs(m),P=Cs(s),D=Cs(f),F=p.useCallback(()=>{if(!A.current||!T.current)return;const H={placement:t,strategy:n,middleware:u};P.current&&(H.platform=P.current),dm(A.current,T.current,H).then(I=>{const U={...I,isPositioned:D.current!==!1};j.current&&!Bn(g.current,U)&&(g.current=U,Qo.flushSync(()=>{c(U)}))})},[u,t,n,P,D]);Pn(()=>{f===!1&&g.current.isPositioned&&(g.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const j=p.useRef(!1);Pn(()=>(j.current=!0,()=>{j.current=!1}),[]),Pn(()=>{if(k&&(A.current=k),L&&(T.current=L),k&&L){if(N.current)return N.current(k,L,F);F()}},[k,L,F,N,w]);const z=p.useMemo(()=>({reference:A,floating:T,setReference:E,setFloating:_}),[E,_]),S=p.useMemo(()=>({reference:k,floating:L}),[k,L]),C=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!S.floating)return H;const I=So(S.floating,l.x),U=So(S.floating,l.y);return i?{...H,transform:"translate("+I+"px, "+U+"px)",...Wa(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:C}),[l,F,z,S,C])}const pm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Co({element:r.current,padding:s}).fn(n):{}:r?Co({element:r,padding:s}).fn(n):{}}}},hm=(e,t)=>{const n=rm(e);return{name:n.name,fn:n.fn,options:[e,t]}},gm=(e,t)=>{const n=om(e);return{name:n.name,fn:n.fn,options:[e,t]}},xm=(e,t)=>({fn:cm(e).fn,options:[e,t]}),vm=(e,t)=>{const n=am(e);return{name:n.name,fn:n.fn,options:[e,t]}},bm=(e,t)=>{const n=im(e);return{name:n.name,fn:n.fn,options:[e,t]}},ym=(e,t)=>{const n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}},wm=(e,t)=>{const n=pm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var Cm="Arrow",Va=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...o}=e;return d.jsx(xe.svg,{...o,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});Va.displayName=Cm;var Sm=Va;function km(e){const[t,n]=p.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,i;if("borderBoxSize"in o){const m=o.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var gr="Popper",[Ga,en]=at(gr),[Am,qa]=Ga(gr),Ka=e=>{const{__scopePopper:t,children:n}=e,[r,s]=p.useState(null);return d.jsx(Am,{scope:t,anchor:r,onAnchorChange:s,children:n})};Ka.displayName=gr;var Ya="PopperAnchor",Xa=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,o=qa(Ya,n),a=p.useRef(null),i=Ae(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&o.onAnchorChange(m.current)}),r?null:d.jsx(xe.div,{...s,ref:i})});Xa.displayName=Ya;var xr="PopperContent",[Em,_m]=Ga(xr),Qa=p.forwardRef((e,t)=>{var G,q,K,oe,Z,se;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:u=!1,updatePositionStrategy:h="optimized",onPlaced:x,...b}=e,y=qa(xr,n),[v,E]=p.useState(null),_=Ae(t,le=>E(le)),[k,L]=p.useState(null),A=km(k),T=(A==null?void 0:A.width)??0,g=(A==null?void 0:A.height)??0,w=r+(o!=="center"?"-"+o:""),N=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},P=Array.isArray(f)?f:[f],D=P.length>0,F={padding:N,boundary:P.filter(Rm),altBoundary:D},{refs:j,floatingStyles:z,placement:S,isPositioned:C,middlewareData:H}=mm({strategy:"fixed",placement:w,whileElementsMounted:(...le)=>sm(...le,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[hm({mainAxis:s+g,alignmentAxis:a}),m&&gm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?xm():void 0,...F}),m&&vm({...F}),bm({...F,apply:({elements:le,rects:be,availableWidth:ue,availableHeight:ye})=>{const{width:fe,height:ce}=be.reference,ve=le.floating.style;ve.setProperty("--radix-popper-available-width",`${ue}px`),ve.setProperty("--radix-popper-available-height",`${ye}px`),ve.setProperty("--radix-popper-anchor-width",`${fe}px`),ve.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),k&&wm({element:k,padding:i}),Nm({arrowWidth:T,arrowHeight:g}),u&&ym({strategy:"referenceHidden",...F})]}),[I,U]=ei(S),Y=st(x);nt(()=>{C&&(Y==null||Y())},[C,Y]);const M=(G=H.arrow)==null?void 0:G.x,O=(q=H.arrow)==null?void 0:q.y,$=((K=H.arrow)==null?void 0:K.centerOffset)!==0,[R,B]=p.useState();return nt(()=>{v&&B(window.getComputedStyle(v).zIndex)},[v]),d.jsx("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(oe=H.transformOrigin)==null?void 0:oe.x,(Z=H.transformOrigin)==null?void 0:Z.y].join(" "),...((se=H.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Em,{scope:n,placedSide:I,onArrowChange:L,arrowX:M,arrowY:O,shouldHideArrow:$,children:d.jsx(xe.div,{"data-side":I,"data-align":U,...b,ref:_,style:{...b.style,animation:C?void 0:"none"}})})})});Qa.displayName=xr;var Ja="PopperArrow",Tm={top:"bottom",right:"left",bottom:"top",left:"right"},Za=p.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,o=_m(Ja,r),a=Tm[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(Sm,{...s,ref:n,style:{...s.style,display:"block"}})})});Za.displayName=Ja;function Rm(e){return e!==null}var Nm=e=>({name:"transformOrigin",options:e,fn(t){var y,v,E;const{placement:n,rects:r,middlewareData:s}=t,a=((y=s.arrow)==null?void 0:y.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=ei(n),c={start:"0%",center:"50%",end:"100%"}[l],u=(((v=s.arrow)==null?void 0:v.x)??0)+i/2,h=(((E=s.arrow)==null?void 0:E.y)??0)+m/2;let x="",b="";return f==="bottom"?(x=a?c:`${u}px`,b=`${-m}px`):f==="top"?(x=a?c:`${u}px`,b=`${r.floating.height+m}px`):f==="right"?(x=`${-m}px`,b=a?c:`${h}px`):f==="left"&&(x=`${r.floating.width+m}px`,b=a?c:`${h}px`),{data:{x,y:b}}}});function ei(e){const[t,n="center"]=e.split("-");return[t,n]}var vr=Ka,rs=Xa,br=Qa,yr=Za,jm="Portal",vn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[s,o]=p.useState(!1);nt(()=>o(!0),[]);const a=n||s&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?Cc.createPortal(d.jsx(xe.div,{...r,ref:t}),a):null});vn.displayName=jm;function Mm(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Ue=e=>{const{present:t,children:n}=e,r=Im(t),s=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=Ae(r.ref,Pm(s));return typeof n=="function"||r.isPresent?p.cloneElement(s,{ref:o}):null};Ue.displayName="Presence";function Im(e){const[t,n]=p.useState(),r=p.useRef(null),s=p.useRef(e),o=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Mm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=Rn(r.current);o.current=i==="mounted"?f:"none"},[i]),nt(()=>{const f=r.current,l=s.current;if(l!==e){const u=o.current,h=Rn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&u!==h?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),nt(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const b=Rn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&b&&(m("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},u=h=>{h.target===t&&(o.current=Rn(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function Rn(e){return(e==null?void 0:e.animationName)||"none"}function Pm(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ss="rovingFocusGroup.onEntryFocus",Dm={bubbles:!1,cancelable:!0},bn="RovingFocusGroup",[Hs,ti,Om]=Ra(bn),[Lm,ni]=at(bn,[Om]),[Fm,$m]=Lm(bn),si=p.forwardRef((e,t)=>d.jsx(Hs.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Hs.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Um,{...e,ref:t})})}));si.displayName=bn;var Um=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,u=p.useRef(null),h=Ae(t,u),x=Na(o),[b,y]=ht({prop:a,defaultProp:i??null,onChange:m,caller:bn}),[v,E]=p.useState(!1),_=st(f),k=ti(n),L=p.useRef(!1),[A,T]=p.useState(0);return p.useEffect(()=>{const g=u.current;if(g)return g.addEventListener(Ss,_),()=>g.removeEventListener(Ss,_)},[_]),d.jsx(Fm,{scope:n,orientation:r,dir:x,loop:s,currentTabStopId:b,onItemFocus:p.useCallback(g=>y(g),[y]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>T(g=>g+1),[]),onFocusableItemRemove:p.useCallback(()=>T(g=>g-1),[]),children:d.jsx(xe.div,{tabIndex:v||A===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ne(e.onMouseDown,()=>{L.current=!0}),onFocus:ne(e.onFocus,g=>{const w=!L.current;if(g.target===g.currentTarget&&w&&!v){const N=new CustomEvent(Ss,Dm);if(g.currentTarget.dispatchEvent(N),!N.defaultPrevented){const P=k().filter(S=>S.focusable),D=P.find(S=>S.active),F=P.find(S=>S.id===b),z=[D,F,...P].filter(Boolean).map(S=>S.ref.current);ai(z,l)}}L.current=!1}),onBlur:ne(e.onBlur,()=>E(!1))})})}),ri="RovingFocusGroupItem",oi=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:o,children:a,...i}=e,m=Pe(),f=o||m,l=$m(ri,n),c=l.currentTabStopId===f,u=ti(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:b}=l;return p.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),d.jsx(Hs.ItemSlot,{scope:n,id:f,focusable:r,active:s,children:d.jsx(xe.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:ne(e.onMouseDown,y=>{r?l.onItemFocus(f):y.preventDefault()}),onFocus:ne(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:ne(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){l.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const v=Bm(y,l.orientation,l.dir);if(v!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let _=u().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")_.reverse();else if(v==="prev"||v==="next"){v==="prev"&&_.reverse();const k=_.indexOf(y.currentTarget);_=l.loop?Wm(_,k+1):_.slice(k+1)}setTimeout(()=>ai(_))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:b!=null}):a})})});oi.displayName=ri;var zm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Hm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Bm(e,t,n){const r=Hm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return zm[r]}function ai(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Vm=si,Gm=oi,qm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},$t=new WeakMap,Nn=new WeakMap,jn={},ks=0,ii=function(e){return e&&(e.host||ii(e.parentNode))},Km=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ii(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Ym=function(e,t,n,r){var s=Km(t,Array.isArray(e)?e:[e]);jn[n]||(jn[n]=new WeakMap);var o=jn[n],a=[],i=new Set,m=new Set(s),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};s.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(u){if(i.has(u))l(u);else try{var h=u.getAttribute(r),x=h!==null&&h!=="false",b=($t.get(u)||0)+1,y=(o.get(u)||0)+1;$t.set(u,b),o.set(u,y),a.push(u),b===1&&x&&Nn.set(u,!0),y===1&&u.setAttribute(n,"true"),x||u.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",u,v)}})};return l(t),i.clear(),ks++,function(){a.forEach(function(c){var u=$t.get(c)-1,h=o.get(c)-1;$t.set(c,u),o.set(c,h),u||(Nn.has(c)||c.removeAttribute(r),Nn.delete(c)),h||c.removeAttribute(n)}),ks--,ks||($t=new WeakMap,$t=new WeakMap,Nn=new WeakMap,jn={})}},wr=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=qm(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live], script"))),Ym(r,s,n,"aria-hidden")):function(){return null}},Bs=["Enter"," "],Xm=["ArrowDown","PageUp","Home"],li=["ArrowUp","PageDown","End"],Qm=[...Xm,...li],Jm={ltr:[...Bs,"ArrowRight"],rtl:[...Bs,"ArrowLeft"]},Zm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yn="Menu",[dn,ep,tp]=Ra(yn),[Dt,ci]=at(yn,[tp,en,ni]),os=en(),di=ni(),[np,Ot]=Dt(yn),[sp,wn]=Dt(yn),ui=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:o,modal:a=!0}=e,i=os(t),[m,f]=p.useState(null),l=p.useRef(!1),c=st(o),u=Na(s);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.jsx(vr,{...i,children:d.jsx(np,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:d.jsx(sp,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:u,modal:a,children:r})})})};ui.displayName=yn;var rp="MenuAnchor",Cr=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=os(n);return d.jsx(rs,{...s,...r,ref:t})});Cr.displayName=rp;var Sr="MenuPortal",[op,fi]=Dt(Sr,{forceMount:void 0}),mi=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,o=Ot(Sr,t);return d.jsx(op,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};mi.displayName=Sr;var ze="MenuContent",[ap,kr]=Dt(ze),pi=p.forwardRef((e,t)=>{const n=fi(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Ot(ze,e.__scopeMenu),a=wn(ze,e.__scopeMenu);return d.jsx(dn.Provider,{scope:e.__scopeMenu,children:d.jsx(Ue,{present:r||o.open,children:d.jsx(dn.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(ip,{...s,ref:t}):d.jsx(lp,{...s,ref:t})})})})}),ip=p.forwardRef((e,t)=>{const n=Ot(ze,e.__scopeMenu),r=p.useRef(null),s=Ae(t,r);return p.useEffect(()=>{const o=r.current;if(o)return wr(o)},[]),d.jsx(Ar,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),lp=p.forwardRef((e,t)=>{const n=Ot(ze,e.__scopeMenu);return d.jsx(Ar,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),cp=qt("MenuContent.ScrollLock"),Ar=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,disableOutsideScroll:x,...b}=e,y=Ot(ze,n),v=wn(ze,n),E=os(n),_=di(n),k=ep(n),[L,A]=p.useState(null),T=p.useRef(null),g=Ae(t,T,y.onContentChange),w=p.useRef(0),N=p.useRef(""),P=p.useRef(0),D=p.useRef(null),F=p.useRef("right"),j=p.useRef(0),z=x?rr:p.Fragment,S=x?{as:cp,allowPinchZoom:!0}:void 0,C=I=>{var G,q;const U=N.current+I,Y=k().filter(K=>!K.disabled),M=document.activeElement,O=(G=Y.find(K=>K.ref.current===M))==null?void 0:G.textValue,$=Y.map(K=>K.textValue),R=wp($,U,O),B=(q=Y.find(K=>K.textValue===R))==null?void 0:q.ref.current;(function K(oe){N.current=oe,window.clearTimeout(w.current),oe!==""&&(w.current=window.setTimeout(()=>K(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(w.current),[]),cr();const H=p.useCallback(I=>{var Y,M;return F.current===((Y=D.current)==null?void 0:Y.side)&&Sp(I,(M=D.current)==null?void 0:M.area)},[]);return d.jsx(ap,{scope:n,searchRef:N,onItemEnter:p.useCallback(I=>{H(I)&&I.preventDefault()},[H]),onItemLeave:p.useCallback(I=>{var U;H(I)||((U=T.current)==null||U.focus(),A(null))},[H]),onTriggerLeave:p.useCallback(I=>{H(I)&&I.preventDefault()},[H]),pointerGraceTimerRef:P,onPointerGraceIntentChange:p.useCallback(I=>{D.current=I},[]),children:d.jsx(z,{...S,children:d.jsx(Zn,{asChild:!0,trapped:s,onMountAutoFocus:ne(o,I=>{var U;I.preventDefault(),(U=T.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,onDismiss:h,children:d.jsx(Vm,{asChild:!0,..._,dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:A,onEntryFocus:ne(m,I=>{v.isUsingKeyboardRef.current||I.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(br,{role:"menu","aria-orientation":"vertical","data-state":Ni(y.open),"data-radix-menu-content":"",dir:v.dir,...E,...b,ref:g,style:{outline:"none",...b.style},onKeyDown:ne(b.onKeyDown,I=>{const Y=I.target.closest("[data-radix-menu-content]")===I.currentTarget,M=I.ctrlKey||I.altKey||I.metaKey,O=I.key.length===1;Y&&(I.key==="Tab"&&I.preventDefault(),!M&&O&&C(I.key));const $=T.current;if(I.target!==$||!Qm.includes(I.key))return;I.preventDefault();const B=k().filter(G=>!G.disabled).map(G=>G.ref.current);li.includes(I.key)&&B.reverse(),bp(B)}),onBlur:ne(e.onBlur,I=>{I.currentTarget.contains(I.target)||(window.clearTimeout(w.current),N.current="")}),onPointerMove:ne(e.onPointerMove,un(I=>{const U=I.target,Y=j.current!==I.clientX;if(I.currentTarget.contains(U)&&Y){const M=I.clientX>j.current?"right":"left";F.current=M,j.current=I.clientX}}))})})})})})})});pi.displayName=ze;var dp="MenuGroup",Er=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{role:"group",...r,ref:t})});Er.displayName=dp;var up="MenuLabel",hi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{...r,ref:t})});hi.displayName=up;var Wn="MenuItem",ko="menu.itemSelect",as=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,o=p.useRef(null),a=wn(Wn,e.__scopeMenu),i=kr(Wn,e.__scopeMenu),m=Ae(t,o),f=p.useRef(!1),l=()=>{const c=o.current;if(!n&&c){const u=new CustomEvent(ko,{bubbles:!0,cancelable:!0});c.addEventListener(ko,h=>r==null?void 0:r(h),{once:!0}),Ta(c,u),u.defaultPrevented?f.current=!1:a.onClose()}};return d.jsx(gi,{...s,ref:m,disabled:n,onClick:ne(e.onClick,l),onPointerDown:c=>{var u;(u=e.onPointerDown)==null||u.call(e,c),f.current=!0},onPointerUp:ne(e.onPointerUp,c=>{var u;f.current||(u=c.currentTarget)==null||u.click()}),onKeyDown:ne(e.onKeyDown,c=>{const u=i.searchRef.current!=="";n||u&&c.key===" "||Bs.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});as.displayName=Wn;var gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...o}=e,a=kr(Wn,n),i=di(n),m=p.useRef(null),f=Ae(t,m),[l,c]=p.useState(!1),[u,h]=p.useState("");return p.useEffect(()=>{const x=m.current;x&&h((x.textContent??"").trim())},[o.children]),d.jsx(dn.ItemSlot,{scope:n,disabled:r,textValue:s??u,children:d.jsx(Gm,{asChild:!0,...i,focusable:!r,children:d.jsx(xe.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:f,onPointerMove:ne(e.onPointerMove,un(x=>{r?a.onItemLeave(x):(a.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ne(e.onPointerLeave,un(x=>a.onItemLeave(x))),onFocus:ne(e.onFocus,()=>c(!0)),onBlur:ne(e.onBlur,()=>c(!1))})})})}),fp="MenuCheckboxItem",xi=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return d.jsx(Ci,{scope:e.__scopeMenu,checked:n,children:d.jsx(as,{role:"menuitemcheckbox","aria-checked":Vn(n)?"mixed":n,...s,ref:t,"data-state":Tr(n),onSelect:ne(s.onSelect,()=>r==null?void 0:r(Vn(n)?!0:!n),{checkForDefaultPrevented:!1})})})});xi.displayName=fp;var vi="MenuRadioGroup",[mp,pp]=Dt(vi,{value:void 0,onValueChange:()=>{}}),bi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,o=st(r);return d.jsx(mp,{scope:e.__scopeMenu,value:n,onValueChange:o,children:d.jsx(Er,{...s,ref:t})})});bi.displayName=vi;var yi="MenuRadioItem",wi=p.forwardRef((e,t)=>{const{value:n,...r}=e,s=pp(yi,e.__scopeMenu),o=n===s.value;return d.jsx(Ci,{scope:e.__scopeMenu,checked:o,children:d.jsx(as,{role:"menuitemradio","aria-checked":o,...r,ref:t,"data-state":Tr(o),onSelect:ne(r.onSelect,()=>{var a;return(a=s.onValueChange)==null?void 0:a.call(s,n)},{checkForDefaultPrevented:!1})})})});wi.displayName=yi;var _r="MenuItemIndicator",[Ci,hp]=Dt(_r,{checked:!1}),Si=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,o=hp(_r,n);return d.jsx(Ue,{present:r||Vn(o.checked)||o.checked===!0,children:d.jsx(xe.span,{...s,ref:t,"data-state":Tr(o.checked)})})});Si.displayName=_r;var gp="MenuSeparator",ki=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return d.jsx(xe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});ki.displayName=gp;var xp="MenuArrow",Ai=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=os(n);return d.jsx(yr,{...s,...r,ref:t})});Ai.displayName=xp;var vp="MenuSub",[Kb,Ei]=Dt(vp),ln="MenuSubTrigger",_i=p.forwardRef((e,t)=>{const n=Ot(ln,e.__scopeMenu),r=wn(ln,e.__scopeMenu),s=Ei(ln,e.__scopeMenu),o=kr(ln,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=o,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),d.jsx(Cr,{asChild:!0,...f,children:d.jsx(gi,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":Ni(n.open),...e,ref:Je(t,s.onTriggerChange),onClick:c=>{var u;(u=e.onClick)==null||u.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:ne(e.onPointerMove,un(c=>{o.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:ne(e.onPointerLeave,un(c=>{var h,x;l();const u=(h=n.content)==null?void 0:h.getBoundingClientRect();if(u){const b=(x=n.content)==null?void 0:x.dataset.side,y=b==="right",v=y?-5:5,E=u[y?"left":"right"],_=u[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:c.clientX+v,y:c.clientY},{x:E,y:u.top},{x:_,y:u.top},{x:_,y:u.bottom},{x:E,y:u.bottom}],side:b}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(c),c.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:ne(e.onKeyDown,c=>{var h;const u=o.searchRef.current!=="";e.disabled||u&&c.key===" "||Jm[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});_i.displayName=ln;var Ti="MenuSubContent",Ri=p.forwardRef((e,t)=>{const n=fi(ze,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,o=Ot(ze,e.__scopeMenu),a=wn(ze,e.__scopeMenu),i=Ei(Ti,e.__scopeMenu),m=p.useRef(null),f=Ae(t,m);return d.jsx(dn.Provider,{scope:e.__scopeMenu,children:d.jsx(Ue,{present:r||o.open,children:d.jsx(dn.Slot,{scope:e.__scopeMenu,children:d.jsx(Ar,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:ne(e.onFocusOutside,l=>{l.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:ne(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:ne(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),u=Zm[a.dir].includes(l.key);c&&u&&(o.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ri.displayName=Ti;function Ni(e){return e?"open":"closed"}function Vn(e){return e==="indeterminate"}function Tr(e){return Vn(e)?"indeterminate":e?"checked":"unchecked"}function bp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function wp(e,t,n){const s=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=yp(e,Math.max(o,0));s.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(s.toLowerCase()));return m!==n?m:void 0}function Cp(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function Sp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Cp(n,t)}function un(e){return t=>t.pointerType==="mouse"?e(t):void 0}var kp=ui,Ap=Cr,Ep=mi,_p=pi,Tp=Er,Rp=hi,Np=as,jp=xi,Mp=bi,Ip=wi,Pp=Si,Dp=ki,Op=Ai,Lp=_i,Fp=Ri,is="DropdownMenu",[$p]=at(is,[ci]),De=ci(),[Up,ji]=$p(is),Mi=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,m=De(t),f=p.useRef(null),[l,c]=ht({prop:s,defaultProp:o??!1,onChange:a,caller:is});return d.jsx(Up,{scope:t,triggerId:Pe(),triggerRef:f,contentId:Pe(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(u=>!u),[c]),modal:i,children:d.jsx(kp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Mi.displayName=is;var Ii="DropdownMenuTrigger",Pi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,o=ji(Ii,n),a=De(n);return d.jsx(Ap,{asChild:!0,...a,children:d.jsx(xe.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Je(t,o.triggerRef),onPointerDown:ne(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:ne(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Pi.displayName=Ii;var zp="DropdownMenuPortal",Di=e=>{const{__scopeDropdownMenu:t,...n}=e,r=De(t);return d.jsx(Ep,{...r,...n})};Di.displayName=zp;var Oi="DropdownMenuContent",Li=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=ji(Oi,n),o=De(n),a=p.useRef(!1);return d.jsx(_p,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...r,ref:t,onCloseAutoFocus:ne(e.onCloseAutoFocus,i=>{var m;a.current||(m=s.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:ne(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!s.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Li.displayName=Oi;var Hp="DropdownMenuGroup",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Tp,{...s,...r,ref:t})});Bp.displayName=Hp;var Wp="DropdownMenuLabel",Fi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Rp,{...s,...r,ref:t})});Fi.displayName=Wp;var Vp="DropdownMenuItem",$i=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Np,{...s,...r,ref:t})});$i.displayName=Vp;var Gp="DropdownMenuCheckboxItem",qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(jp,{...s,...r,ref:t})});qp.displayName=Gp;var Kp="DropdownMenuRadioGroup",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Mp,{...s,...r,ref:t})});Yp.displayName=Kp;var Xp="DropdownMenuRadioItem",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Ip,{...s,...r,ref:t})});Qp.displayName=Xp;var Jp="DropdownMenuItemIndicator",Zp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Pp,{...s,...r,ref:t})});Zp.displayName=Jp;var eh="DropdownMenuSeparator",Ui=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Dp,{...s,...r,ref:t})});Ui.displayName=eh;var th="DropdownMenuArrow",nh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Op,{...s,...r,ref:t})});nh.displayName=th;var sh="DropdownMenuSubTrigger",rh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Lp,{...s,...r,ref:t})});rh.displayName=sh;var oh="DropdownMenuSubContent",ah=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=De(n);return d.jsx(Fp,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ah.displayName=oh;var ih=Mi,lh=Pi,ch=Di,dh=Li,uh=Fi,fh=$i,mh=Ui;function zi({...e}){return d.jsx(ih,{"data-slot":"dropdown-menu",...e})}function Hi({...e}){return d.jsx(lh,{"data-slot":"dropdown-menu-trigger",...e})}function Bi({className:e,sideOffset:t=4,...n}){return d.jsx(ch,{children:d.jsx(dh,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Dn({className:e,inset:t,variant:n="default",...r}){return d.jsx(fh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function ph({className:e,inset:t,...n}){return d.jsx(uh,{"data-slot":"dropdown-menu-label","data-inset":t,className:ee("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function Ao({className:e,...t}){return d.jsx(mh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const hh=[{value:"light",label:"Light",icon:d.jsx(wa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:d.jsx(xa,{className:"h-4 w-4"})},{value:"system",label:"System",icon:d.jsx(Zd,{className:"h-4 w-4"})}];function gh(){const{theme:e,setTheme:t,resolvedTheme:n}=Nu();return d.jsxs(zi,{children:[d.jsx(Hi,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?d.jsx(xa,{className:"h-4 w-4"}):d.jsx(wa,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),d.jsx(Bi,{align:"end",children:hh.map(r=>d.jsxs(Dn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,d.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Eo={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.unreachable":"无法连接服务器——请确认服务正在运行,且界面与 API 同源访问。","auth.login.rateLimited":"登录尝试过于频繁,请稍后再试。","auth.login.csrfBlocked":"请求来源校验失败(CSRF)——请从服务本身提供的地址打开界面。","auth.login.failedWithReason":"登录失败:{message}","auth.login.description":"输入你的用户名和密码以继续。","auth.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.list.empty":"创建你的第一个团队,开始协作。","team.list.count":"{n} 个团队","team.list.noDescription":"暂无描述","team.list.kicker":"协作名册","team.list.lede":"把机台、会话与工件收进同一个协作域。","team.list.founded":"创立于","team.list.delete":"删除团队","team.list.deleteConfirm":"确定删除团队「{name}」?团队环境需先转移,此操作不可撤销。","team.list.deleteFailed":"删除团队失败","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.create.failed":"创建团队失败","team.detail.back":"返回团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dashboard.emptySessionsTitle":"暂无会话","dashboard.emptySessionsHint":"点右上角「+ 新会话」开一条,或等 worker 上报会话。","dashboard.emptyEnvironmentsTitle":"暂无环境","dashboard.emptyEnvironmentsHint":"worker 经 RCS 注册后,环境会落到这条线上。","dashboard.emptyMarker":"无记录","dashboard.envOwner":"创建者","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.metaStatus":"状态","session.metaWorker":"Worker","session.metaCreated":"创建时间","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","session.sseReconnecting":"与服务器的实时连接中断,正在自动重连…(期间消息可能延迟显示)","session.sseFailed":"实时连接重连失败,请刷新页面恢复","user.settings.language":"语言","dashboard.searchAction":"搜索会话","dashboard.searchPlaceholder":"搜索所有会话内容…","dashboard.searchNoResults":"没有匹配的会话","dashboard.closeSearch":"收起搜索","user.settings.notifications":"浏览器通知","user.settings.notificationsDesc":"会话需要审批或回合完成时通知(仅页面处于后台时)","user.settings.notificationsDenied":"通知权限已被拒绝 — 请在浏览器设置中允许","user.settings.notificationsUnsupported":"当前环境不支持通知(需要 HTTPS 或 localhost)","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"工件","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建工件","artifacts.empty":'还没有工件。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载工件失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"工件不存在或已过期","artifacts.backToGallery":"← 返回工件","artifacts.create.title":"新建工件","artifacts.editArtifact":"编辑工件","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此工件","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的工件提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此工件,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该工件关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为工件","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话","permission.title":"权限请求","permission.required":"需要权限","permission.approve":"允许","permission.alwaysAllow":"始终允许","permission.alwaysAllowHint":"允许并记住规则:{rule}","permission.reject":"拒绝","dashboard.searching":"搜索中…","dashboard.nMatches":"{n} 处匹配","dashboard.nameMatch":"标题/ID 匹配","session.mode.title":"权限模式(Shift+Tab 循环)","session.mode.default":"默认","session.mode.defaultDesc":"手动审批权限请求","session.mode.acceptEdits":"自动接受编辑","session.mode.acceptEditsDesc":"自动允许文件编辑操作","session.mode.plan":"规划模式","session.mode.planDesc":"仅规划,不执行工具","session.mode.bypass":"跳过权限","session.mode.bypassDesc":"跳过所有权限检查","session.mode.switchFailedRequest":"模式切换请求发送失败: {message}","session.mode.switchFailed":"模式切换失败","session.thinking.title":"思考预算","session.thinking.off":"关闭思考","session.thinking.offDesc":"不使用扩展思考","session.thinking.on":"默认思考","session.thinking.onDesc":"开启,使用默认预算","session.thinking.fallback":"思考","session.thinking.failedRequest":"思考预算请求发送失败: {message}","session.thinking.failed":"思考预算切换失败","session.effort.title":"Effort 档位","session.effort.auto":"自动","session.effort.autoDesc":"使用模型默认 effort","session.effort.lowDesc":"低推理力度","session.effort.mediumDesc":"中推理力度","session.effort.highDesc":"高推理力度","session.effort.xhighDesc":"超高推理力度","session.effort.maxDesc":"最大推理力度","session.effort.fallback":"自动","session.effort.failedRequest":"Effort 切换请求发送失败: {message}","session.effort.failed":"Effort 切换失败","session.model.title":"选择模型","session.context.tooltip":"上下文用量:{used} / {max} tokens","session.context.deferredSuffix":"(延迟加载)","session.usage.total":"会话累计用量(input 含缓存读写)","session.resume.title":"恢复历史对话","session.resume.currentBlocked":"不能恢复当前会话自身","session.resume.restoring":"正在恢复「{title}」…","session.resume.restored":"已恢复 {count} 条消息","session.resume.restoredWithTitle":"已恢复 {count} 条消息:{title}","session.resume.failed":"恢复失败:{message}","session.resume.unsupported":"当前 worker 不支持 /resume(需要 spawn 模式 worker:slz rc)","session.resumeInNew":"在新会话中继续此对话(/resume)","session.createFailedWithReason":"创建会话失败:{message}","session.rewind.confirmEdit":"回退到这条消息并编辑?","session.rewind.confirm":"回退到这条消息?","session.rewind.confirmBody":"之后的对话将移除,已修改的文件将恢复到当时的状态(若有快照)。","session.rewind.failed":"回退失败: {message}","session.rename.title":"重命名会话","session.rename.failed":"重命名失败","session.sideQuestion.title":"旁路提问 — 针对会话上下文提问,不进入主对话","session.search.title":"搜索会话内容","session.mcp.title":"MCP 服务器","session.settings.title":"会话设置","session.search.placeholder":"搜索会话内容…","session.search.noResults":"无结果","session.stopTask.failed":"停止任务失败","settings.unset":"(未设置)","settings.loadFailed":"获取设置失败 — worker 可能不支持","settings.writeFailed":"写入失败","settings.loading":"加载设置…","settings.model":"模型","settings.defaultModel":"(默认)","settings.hint":"布尔开关写入会话级 flag 层(apply_flag_settings);只读项点击查看详情。","settings.back":"返回设置列表","settings.copied":"已复制","settings.copyValue":"复制值","settings.searchPlaceholder":"搜索设置项…","settings.noMatch":"没有匹配的设置项","settings.togglable":"可设置({n})","settings.readOnly":"只读({n})","settings.turnOff":"关闭(写入 false)","settings.turnOn":"开启(写入 true)","settings.viewDetail":"查看详情","mcp.status.connected":"已连接","mcp.status.failed":"失败","mcp.status.needsAuth":"待认证","mcp.status.pending":"连接中","mcp.status.disabled":"已禁用","mcp.loadFailed":"获取 MCP 状态失败 — worker 可能不支持","mcp.toggleFailed":"切换失败","mcp.reconnectFailed":"重连失败","mcp.loading":"加载 MCP 状态…","mcp.empty":"没有配置 MCP 服务器","mcp.toolCount":"{n} 工具","mcp.reconnect":"重连","mcp.enable":"启用","mcp.disable":"禁用","resume.loading":"正在加载本地会话列表…","resume.empty":"没有可恢复的历史对话","resume.today":"今天","resume.yesterday":"昨天","resume.earlier":"更早","sideQuestion.title":"旁路提问","sideQuestion.desc":"针对当前会话上下文提问,不进入主对话、不消耗会话历史 — 适合「这个会话干了什么」式的快速核对。","sideQuestion.empty":"还没有提问。在下方输入你的问题。","sideQuestion.noAnswer":"没有获得回答(超时或 worker 不支持)","sideQuestion.placeholder":"问点什么…","sideQuestion.send":"提问(Enter)","elicitation.title":"MCP 请求输入","elicitation.required":"必填","elicitation.submit":"提交","elicitation.decline":"拒绝","elicitation.done":"完成","subagent.stop":"停止此任务","task.endConfirm":"结束 worker 会话?正在进行的回合将被中止,会话随后归档。","task.endHint":"通知 worker 中止在途回合并退出,随后归档会话","permission.writeUnknown":"待写入","permission.requestAria":"权限请求:{tool}","user.settings.notificationsOn":"已开启","user.settings.notificationsOff":"已关闭","artifacts.create.markdownPlaceholder":`# 周报
|
|
208
208
|
|
|
209
209
|
- 进度…
|
|
210
|
-
- 风险…`,"cmd.desc.compact":"压缩上下文","cmd.desc.cost":"查看会话费用","cmd.desc.summary":"生成会话摘要","cmd.desc.files":"列出会话追踪的文件","cmd.desc.clear":"清空当前对话","cmd.desc.new":"新建会话","cmd.desc.help":"显示此帮助信息","cmd.desc.status":"显示会话状态","cmd.desc.model":"查看或切换模型","cmd.desc.copy":"复制最后一条助手消息","cmd.desc.resume":"恢复一个历史对话到当前会话","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[会话id]","cmd.desc.agentFallback":"agent 命令","cmd.subtitle.help":"可用命令列表","cmd.subtitle.status":"会话状态信息","cmd.subtitle.model":"查看或切换模型","cmd.subtitle.copy":"复制助手消息到剪贴板","cmd.subtitle.resume":"选择并恢复一个历史对话","cmd.help.localHeader":"**本地命令**(Web UI 直接执行)","cmd.help.agentHeader":"**Agent 命令**(发给 Saluzi agent 执行)","cmd.status.header":"**会话状态**","cmd.status.sessionId":"会话 ID","cmd.status.none":"无","cmd.status.currentModel":"当前模型","cmd.status.unset":"未设置","cmd.status.modelCount":"可用模型数","cmd.status.imageSupport":"图片支持","cmd.status.yes":"是","cmd.status.no":"否","cmd.status.messageCount":"消息条数","cmd.model.none":"当前 agent 未提供模型选择能力。","cmd.model.available":"**可用模型**","cmd.model.hint":"使用 `/model <id>` 切换模型。","cmd.model.switched":"已请求切换到模型: `{id}`","cmd.model.switchFailed":"切换模型失败: {message}","cmd.copy.failed":"复制失败:剪贴板不可用","cmd.copy.copied":"已复制 {n} 字符到剪贴板","cmd.copy.nothing":"没有可复制的助手消息","notify.permission.title":"需要审批","notify.permission.body":"{session} — agent 正在等待权限批准","notify.turnComplete.title":"回合完成","notify.turnComplete.body":"{session} — agent 已完成当前回合","adapter.workerCrashed":"Worker 进程异常退出","adapter.stopTimeout":"停止请求超时","adapter.stopFailed":"停止请求失败","adapter.requestTimeout":"请求超时","attach.emptyFile":"(空文件)","attach.emptyDirectory":"(空目录)","attach.directoryHeader":"📁 目录: {name}","attach.fileCount":"({n} 个文件)","attach.readFailed":"(读取失败)","attach.tooLarge":"(文件过大,已跳过)","attach.imageFile":"(图片文件,{size})","attach.binaryFile":"(二进制文件,{size})","attach.dumpHeader":"# 目录: {name}","attach.dumpCount":"共 {n} 个文件","attach.structure":"## 文件结构","attach.contents":"## 文件内容","acp.sessions":"会话","acp.newSession":"新会话","acp.confirmDelete":'删除会话 "{label}"?此操作不可恢复。',"acp.emptySessions":"暂无会话","acp.historyNav":"历史会话","acp.confirm":"确认","acp.noSessionManagement":"该 agent 不支持会话管理(重命名/删除)","acp.rename":"重命名","acp.renameUnsupported":"该 agent 不支持会话重命名","acp.delete":"删除","acp.deleteUnsupported":"该 agent 不支持会话删除","acp.mode.default":"默认","acp.mode.defaultDesc":"手动审批权限请求","acp.mode.acceptEdits":"自动接受编辑","acp.mode.acceptEditsDesc":"自动允许文件编辑操作","acp.mode.bypass":"跳过权限","acp.mode.bypassDesc":"跳过所有权限检查","acp.mode.plan":"规划模式","acp.mode.planDesc":"仅规划,不执行工具","acp.mode.dontAsk":"不询问","acp.mode.dontAskDesc":"不弹出询问,自动拒绝","acp.mode.auto":"自动判断","acp.mode.autoDesc":"AI 自动判断是否批准","acp.emptyDescription":"输入消息开始与 ACP agent 聊天","acp.inputPlaceholder":"给 Saluzi 发送消息…","acp.waitingPlaceholder":"等待会话...","chat.fileMatchHint":"文件匹配 {query} — ↑↓ 选择,Enter 插入","chat.picker.image":"图片","chat.picker.textFile":"文本文件","chat.picker.sheet":"表格文件","chat.picker.directory":"目录","chat.commandList":"命令列表","chat.processingFile":"处理文件中…","chat.queued":"{n} 条消息排队中,完成后自动发送","chat.queuedCancel":"(点击取消全部)","chat.inputHint":"Enter 发送,Shift+Enter 换行","chat.inputHintSuffix":",/ 唤出命令,@ 补全文件","chat.fileCount":"{n} 个文件","chat.directory":"目录","chat.noCommands":"没有匹配的命令","chat.cmdDone":"命令已执行 · 输入消息继续","plan.title":"执行计划","plan.priority.high":"高","plan.priority.medium":"中","plan.priority.low":"低","tool.newFile":"新文件","tool.callTimes":"{n} 次{name}","tool.summaryCalls":"{n} 个工具调用","tool.summaryTools":"{n} 个工具: {names}","usage.context":"上下文: {used} / {size} tokens","usage.totalCost":"累计成本: {cost}","diff.aria":"{path} 的改动预览,{added} 行新增,{removed} 行删除","diff.hidden":"… 还有 {n} 行未显示","diff.addedLine":"新增行: {text}","diff.removedLine":"删除行: {text}","common.emptyTitle":"暂无消息","common.emptyDescription":"开始对话后消息会显示在这里","message.rewindHere":"回退到这里(对话与文件)","message.rewindEdit":"回退并编辑这条消息","message.expand":"展开"},xh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.unreachable":"Cannot reach the server — make sure it is running and that the UI and API share one origin.","auth.login.rateLimited":"Too many login attempts. Try again later.","auth.login.csrfBlocked":"Request origin check failed (CSRF) — open the UI from the address the server itself serves.","auth.login.failedWithReason":"Login failed: {message}","auth.login.description":"Enter your username and password to continue.","auth.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dashboard.emptySessionsTitle":"No sessions yet","dashboard.emptySessionsHint":"Start one from “+ New Session”, or wait for a worker to report in.","dashboard.emptyEnvironmentsTitle":"No environments yet","dashboard.emptyEnvironmentsHint":"An environment lands on this wire once a worker registers over RCS.","dashboard.emptyMarker":"No records","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","session.sseReconnecting":"Live connection lost — reconnecting… (messages may be delayed)","session.sseFailed":"Live connection failed — refresh the page to recover","user.settings.language":"Language","dashboard.searchAction":"Search sessions","dashboard.searchPlaceholder":"Search across all sessions…","dashboard.searchNoResults":"No matching sessions","dashboard.closeSearch":"Close search","user.settings.notifications":"Browser notifications","user.settings.notificationsDesc":"Notify when a session needs approval or completes a turn (only while the page is in the background)","user.settings.notificationsDenied":"Notification permission denied — allow it in your browser settings","user.settings.notificationsUnsupported":"Notifications unavailable in this context (HTTPS or localhost required)","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions","permission.title":"Permission Request","permission.required":"Permission Required","permission.approve":"Approve","permission.alwaysAllow":"Always allow","permission.alwaysAllowHint":"Allow and remember rule: {rule}","permission.reject":"Reject","dashboard.searching":"Searching…","dashboard.nMatches":"{n} matches","dashboard.nameMatch":"Title/ID match","session.mode.title":"Permission mode (Shift+Tab to cycle)","session.mode.default":"Default","session.mode.defaultDesc":"Approve permission requests manually","session.mode.acceptEdits":"Auto-accept edits","session.mode.acceptEditsDesc":"Automatically allow file edits","session.mode.plan":"Plan mode","session.mode.planDesc":"Plan only — no tool execution","session.mode.bypass":"Bypass permissions","session.mode.bypassDesc":"Skip all permission checks","session.mode.switchFailedRequest":"Failed to send mode switch request: {message}","session.mode.switchFailed":"Failed to switch mode","session.thinking.title":"Thinking budget","session.thinking.off":"Thinking off","session.thinking.offDesc":"No extended thinking","session.thinking.on":"Default thinking","session.thinking.onDesc":"On with the default budget","session.thinking.fallback":"Thinking","session.thinking.failedRequest":"Failed to send thinking budget request: {message}","session.thinking.failed":"Failed to switch thinking budget","session.effort.title":"Effort level","session.effort.auto":"Auto","session.effort.autoDesc":"Use the model default effort","session.effort.lowDesc":"Low reasoning effort","session.effort.mediumDesc":"Medium reasoning effort","session.effort.highDesc":"High reasoning effort","session.effort.xhighDesc":"Very high reasoning effort","session.effort.maxDesc":"Maximum reasoning effort","session.effort.fallback":"Auto","session.effort.failedRequest":"Failed to send effort request: {message}","session.effort.failed":"Failed to switch effort","session.model.title":"Select model","session.context.tooltip":"Context usage: {used} / {max} tokens","session.context.deferredSuffix":" (deferred)","session.usage.total":"Session totals (input includes cache reads/writes)","session.resume.title":"Resume conversation","session.resume.currentBlocked":"Cannot resume the current session itself","session.resume.restoring":'Restoring "{title}"…',"session.resume.restored":"Restored {count} messages","session.resume.restoredWithTitle":"Restored {count} messages: {title}","session.resume.failed":"Resume failed: {message}","session.resume.unsupported":"This worker does not support /resume (requires a spawn-mode worker: slz rc)","session.resumeInNew":"Continue this conversation in a new session (/resume)","session.createFailedWithReason":"Failed to create session: {message}","session.rewind.confirmEdit":"Rewind to this message and edit?","session.rewind.confirm":"Rewind to this message?","session.rewind.confirmBody":"The later conversation will be removed; modified files will be restored to their state at that point (if a snapshot exists).","session.rewind.failed":"Rewind failed: {message}","session.rename.title":"Rename session","session.rename.failed":"Rename failed","session.sideQuestion.title":"Side question — ask about the session context without entering the main conversation","session.search.title":"Search conversation","session.mcp.title":"MCP servers","session.settings.title":"Session settings","session.search.placeholder":"Search conversation…","session.search.noResults":"No results","session.stopTask.failed":"Failed to stop task","settings.unset":"(not set)","settings.loadFailed":"Failed to load settings — worker may not support it","settings.writeFailed":"Write failed","settings.loading":"Loading settings…","settings.model":"Model","settings.defaultModel":"(default)","settings.hint":"Boolean toggles write to the session flag layer (apply_flag_settings); click read-only items for details.","settings.back":"Back to settings","settings.copied":"Copied","settings.copyValue":"Copy value","settings.searchPlaceholder":"Search settings…","settings.noMatch":"No matching settings","settings.togglable":"Editable ({n})","settings.readOnly":"Read-only ({n})","settings.turnOff":"Turn off (writes false)","settings.turnOn":"Turn on (writes true)","settings.viewDetail":"View details","mcp.status.connected":"Connected","mcp.status.failed":"Failed","mcp.status.needsAuth":"Needs auth","mcp.status.pending":"Connecting","mcp.status.disabled":"Disabled","mcp.loadFailed":"Failed to load MCP status — worker may not support it","mcp.toggleFailed":"Toggle failed","mcp.reconnectFailed":"Reconnect failed","mcp.loading":"Loading MCP status…","mcp.empty":"No MCP servers configured","mcp.toolCount":"{n} tools","mcp.reconnect":"Reconnect","mcp.enable":"Enable","mcp.disable":"Disable","resume.loading":"Loading local sessions…","resume.empty":"No resumable conversations","resume.today":"Today","resume.yesterday":"Yesterday","resume.earlier":"Earlier","sideQuestion.title":"Side question","sideQuestion.desc":'Ask about the current session context without entering the main conversation or consuming session history — good for a quick "what did this session do" check.',"sideQuestion.empty":"No questions yet. Type your question below.","sideQuestion.noAnswer":"No answer received (timeout or worker unsupported)","sideQuestion.placeholder":"Ask something…","sideQuestion.send":"Ask (Enter)","elicitation.title":"MCP input request","elicitation.required":"Required","elicitation.submit":"Submit","elicitation.decline":"Decline","elicitation.done":"Done","subagent.stop":"Stop this task","task.endConfirm":"End the worker session? The in-flight turn will be aborted and the session archived.","task.endHint":"Tells the worker to abort the in-flight turn, exit, and archive the session","permission.writeUnknown":"Pending write","permission.requestAria":"Permission request: {tool}","user.settings.notificationsOn":"On","user.settings.notificationsOff":"Off","artifacts.create.markdownPlaceholder":`# Weekly report
|
|
210
|
+
- 风险…`,"cmd.desc.compact":"压缩上下文","cmd.desc.cost":"查看会话费用","cmd.desc.summary":"生成会话摘要","cmd.desc.files":"列出会话追踪的文件","cmd.desc.clear":"清空当前对话","cmd.desc.new":"新建会话","cmd.desc.help":"显示此帮助信息","cmd.desc.status":"显示会话状态","cmd.desc.model":"查看或切换模型","cmd.desc.copy":"复制最后一条助手消息","cmd.desc.resume":"恢复一个历史对话到当前会话","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[会话id]","cmd.desc.agentFallback":"agent 命令","cmd.subtitle.help":"可用命令列表","cmd.subtitle.status":"会话状态信息","cmd.subtitle.model":"查看或切换模型","cmd.subtitle.copy":"复制助手消息到剪贴板","cmd.subtitle.resume":"选择并恢复一个历史对话","cmd.help.localHeader":"**本地命令**(Web UI 直接执行)","cmd.help.agentHeader":"**Agent 命令**(发给 Saluzi agent 执行)","cmd.status.header":"**会话状态**","cmd.status.sessionId":"会话 ID","cmd.status.none":"无","cmd.status.currentModel":"当前模型","cmd.status.unset":"未设置","cmd.status.modelCount":"可用模型数","cmd.status.imageSupport":"图片支持","cmd.status.yes":"是","cmd.status.no":"否","cmd.status.messageCount":"消息条数","cmd.model.none":"当前 agent 未提供模型选择能力。","cmd.model.available":"**可用模型**","cmd.model.hint":"使用 `/model <id>` 切换模型。","cmd.model.switched":"已请求切换到模型: `{id}`","cmd.model.switchFailed":"切换模型失败: {message}","cmd.copy.failed":"复制失败:剪贴板不可用","cmd.copy.copied":"已复制 {n} 字符到剪贴板","cmd.copy.nothing":"没有可复制的助手消息","notify.permission.title":"需要审批","notify.permission.body":"{session} — agent 正在等待权限批准","notify.turnComplete.title":"回合完成","notify.turnComplete.body":"{session} — agent 已完成当前回合","adapter.workerCrashed":"Worker 进程异常退出","adapter.stopTimeout":"停止请求超时","adapter.stopFailed":"停止请求失败","adapter.requestTimeout":"请求超时","attach.emptyFile":"(空文件)","attach.emptyDirectory":"(空目录)","attach.directoryHeader":"📁 目录: {name}","attach.fileCount":"({n} 个文件)","attach.readFailed":"(读取失败)","attach.tooLarge":"(文件过大,已跳过)","attach.imageFile":"(图片文件,{size})","attach.binaryFile":"(二进制文件,{size})","attach.dumpHeader":"# 目录: {name}","attach.dumpCount":"共 {n} 个文件","attach.structure":"## 文件结构","attach.contents":"## 文件内容","acp.sessions":"会话","acp.newSession":"新会话","acp.confirmDelete":'删除会话 "{label}"?此操作不可恢复。',"acp.emptySessions":"暂无会话","acp.historyNav":"历史会话","acp.confirm":"确认","acp.noSessionManagement":"该 agent 不支持会话管理(重命名/删除)","acp.rename":"重命名","acp.renameUnsupported":"该 agent 不支持会话重命名","acp.delete":"删除","acp.deleteUnsupported":"该 agent 不支持会话删除","acp.mode.default":"默认","acp.mode.defaultDesc":"手动审批权限请求","acp.mode.acceptEdits":"自动接受编辑","acp.mode.acceptEditsDesc":"自动允许文件编辑操作","acp.mode.bypass":"跳过权限","acp.mode.bypassDesc":"跳过所有权限检查","acp.mode.plan":"规划模式","acp.mode.planDesc":"仅规划,不执行工具","acp.mode.dontAsk":"不询问","acp.mode.dontAskDesc":"不弹出询问,自动拒绝","acp.mode.auto":"自动判断","acp.mode.autoDesc":"AI 自动判断是否批准","acp.emptyDescription":"输入消息开始与 ACP agent 聊天","acp.inputPlaceholder":"给 Saluzi 发送消息…","acp.waitingPlaceholder":"等待会话...","chat.fileMatchHint":"文件匹配 {query} — ↑↓ 选择,Enter 插入","chat.picker.image":"图片","chat.picker.textFile":"文本文件","chat.picker.sheet":"表格文件","chat.picker.directory":"目录","chat.commandList":"命令列表","chat.processingFile":"处理文件中…","chat.queued":"{n} 条消息排队中,完成后自动发送","chat.queuedCancel":"(点击取消全部)","chat.inputHint":"Enter 发送,Shift+Enter 换行","chat.inputHintSuffix":",/ 唤出命令,@ 补全文件","chat.fileCount":"{n} 个文件","chat.directory":"目录","chat.noCommands":"没有匹配的命令","chat.cmdDone":"命令已执行 · 输入消息继续","plan.title":"执行计划","plan.priority.high":"高","plan.priority.medium":"中","plan.priority.low":"低","tool.newFile":"新文件","tool.callTimes":"{n} 次{name}","tool.summaryCalls":"{n} 个工具调用","tool.summaryTools":"{n} 个工具: {names}","usage.context":"上下文: {used} / {size} tokens","usage.totalCost":"累计成本: {cost}","diff.aria":"{path} 的改动预览,{added} 行新增,{removed} 行删除","diff.hidden":"… 还有 {n} 行未显示","diff.addedLine":"新增行: {text}","diff.removedLine":"删除行: {text}","common.emptyTitle":"暂无消息","common.emptyDescription":"开始对话后消息会显示在这里","message.rewindHere":"回退到这里(对话与文件)","message.rewindEdit":"回退并编辑这条消息","message.expand":"展开"},xh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.unreachable":"Cannot reach the server — make sure it is running and that the UI and API share one origin.","auth.login.rateLimited":"Too many login attempts. Try again later.","auth.login.csrfBlocked":"Request origin check failed (CSRF) — open the UI from the address the server itself serves.","auth.login.failedWithReason":"Login failed: {message}","auth.login.description":"Enter your username and password to continue.","auth.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.list.empty":"Create your first team to start collaborating.","team.list.count":"{n} teams","team.list.noDescription":"No description","team.list.kicker":"Roster","team.list.lede":"Gather machines, sessions, and artifacts under one shared domain.","team.list.founded":"Founded","team.list.delete":"Delete team","team.list.deleteConfirm":'Delete team "{name}"? Environments must be transferred first. This cannot be undone.',"team.list.deleteFailed":"Failed to delete team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.create.failed":"Failed to create team","team.detail.back":"Back to teams","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dashboard.emptySessionsTitle":"No sessions yet","dashboard.emptySessionsHint":"Start one from “+ New Session”, or wait for a worker to report in.","dashboard.emptyEnvironmentsTitle":"No environments yet","dashboard.emptyEnvironmentsHint":"An environment lands on this wire once a worker registers over RCS.","dashboard.emptyMarker":"No records","dashboard.envOwner":"Created by","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.metaStatus":"Status","session.metaWorker":"Worker","session.metaCreated":"Created","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","session.sseReconnecting":"Live connection lost — reconnecting… (messages may be delayed)","session.sseFailed":"Live connection failed — refresh the page to recover","user.settings.language":"Language","dashboard.searchAction":"Search sessions","dashboard.searchPlaceholder":"Search across all sessions…","dashboard.searchNoResults":"No matching sessions","dashboard.closeSearch":"Close search","user.settings.notifications":"Browser notifications","user.settings.notificationsDesc":"Notify when a session needs approval or completes a turn (only while the page is in the background)","user.settings.notificationsDenied":"Notification permission denied — allow it in your browser settings","user.settings.notificationsUnsupported":"Notifications unavailable in this context (HTTPS or localhost required)","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions","permission.title":"Permission Request","permission.required":"Permission Required","permission.approve":"Approve","permission.alwaysAllow":"Always allow","permission.alwaysAllowHint":"Allow and remember rule: {rule}","permission.reject":"Reject","dashboard.searching":"Searching…","dashboard.nMatches":"{n} matches","dashboard.nameMatch":"Title/ID match","session.mode.title":"Permission mode (Shift+Tab to cycle)","session.mode.default":"Default","session.mode.defaultDesc":"Approve permission requests manually","session.mode.acceptEdits":"Auto-accept edits","session.mode.acceptEditsDesc":"Automatically allow file edits","session.mode.plan":"Plan mode","session.mode.planDesc":"Plan only — no tool execution","session.mode.bypass":"Bypass permissions","session.mode.bypassDesc":"Skip all permission checks","session.mode.switchFailedRequest":"Failed to send mode switch request: {message}","session.mode.switchFailed":"Failed to switch mode","session.thinking.title":"Thinking budget","session.thinking.off":"Thinking off","session.thinking.offDesc":"No extended thinking","session.thinking.on":"Default thinking","session.thinking.onDesc":"On with the default budget","session.thinking.fallback":"Thinking","session.thinking.failedRequest":"Failed to send thinking budget request: {message}","session.thinking.failed":"Failed to switch thinking budget","session.effort.title":"Effort level","session.effort.auto":"Auto","session.effort.autoDesc":"Use the model default effort","session.effort.lowDesc":"Low reasoning effort","session.effort.mediumDesc":"Medium reasoning effort","session.effort.highDesc":"High reasoning effort","session.effort.xhighDesc":"Very high reasoning effort","session.effort.maxDesc":"Maximum reasoning effort","session.effort.fallback":"Auto","session.effort.failedRequest":"Failed to send effort request: {message}","session.effort.failed":"Failed to switch effort","session.model.title":"Select model","session.context.tooltip":"Context usage: {used} / {max} tokens","session.context.deferredSuffix":" (deferred)","session.usage.total":"Session totals (input includes cache reads/writes)","session.resume.title":"Resume conversation","session.resume.currentBlocked":"Cannot resume the current session itself","session.resume.restoring":'Restoring "{title}"…',"session.resume.restored":"Restored {count} messages","session.resume.restoredWithTitle":"Restored {count} messages: {title}","session.resume.failed":"Resume failed: {message}","session.resume.unsupported":"This worker does not support /resume (requires a spawn-mode worker: slz rc)","session.resumeInNew":"Continue this conversation in a new session (/resume)","session.createFailedWithReason":"Failed to create session: {message}","session.rewind.confirmEdit":"Rewind to this message and edit?","session.rewind.confirm":"Rewind to this message?","session.rewind.confirmBody":"The later conversation will be removed; modified files will be restored to their state at that point (if a snapshot exists).","session.rewind.failed":"Rewind failed: {message}","session.rename.title":"Rename session","session.rename.failed":"Rename failed","session.sideQuestion.title":"Side question — ask about the session context without entering the main conversation","session.search.title":"Search conversation","session.mcp.title":"MCP servers","session.settings.title":"Session settings","session.search.placeholder":"Search conversation…","session.search.noResults":"No results","session.stopTask.failed":"Failed to stop task","settings.unset":"(not set)","settings.loadFailed":"Failed to load settings — worker may not support it","settings.writeFailed":"Write failed","settings.loading":"Loading settings…","settings.model":"Model","settings.defaultModel":"(default)","settings.hint":"Boolean toggles write to the session flag layer (apply_flag_settings); click read-only items for details.","settings.back":"Back to settings","settings.copied":"Copied","settings.copyValue":"Copy value","settings.searchPlaceholder":"Search settings…","settings.noMatch":"No matching settings","settings.togglable":"Editable ({n})","settings.readOnly":"Read-only ({n})","settings.turnOff":"Turn off (writes false)","settings.turnOn":"Turn on (writes true)","settings.viewDetail":"View details","mcp.status.connected":"Connected","mcp.status.failed":"Failed","mcp.status.needsAuth":"Needs auth","mcp.status.pending":"Connecting","mcp.status.disabled":"Disabled","mcp.loadFailed":"Failed to load MCP status — worker may not support it","mcp.toggleFailed":"Toggle failed","mcp.reconnectFailed":"Reconnect failed","mcp.loading":"Loading MCP status…","mcp.empty":"No MCP servers configured","mcp.toolCount":"{n} tools","mcp.reconnect":"Reconnect","mcp.enable":"Enable","mcp.disable":"Disable","resume.loading":"Loading local sessions…","resume.empty":"No resumable conversations","resume.today":"Today","resume.yesterday":"Yesterday","resume.earlier":"Earlier","sideQuestion.title":"Side question","sideQuestion.desc":'Ask about the current session context without entering the main conversation or consuming session history — good for a quick "what did this session do" check.',"sideQuestion.empty":"No questions yet. Type your question below.","sideQuestion.noAnswer":"No answer received (timeout or worker unsupported)","sideQuestion.placeholder":"Ask something…","sideQuestion.send":"Ask (Enter)","elicitation.title":"MCP input request","elicitation.required":"Required","elicitation.submit":"Submit","elicitation.decline":"Decline","elicitation.done":"Done","subagent.stop":"Stop this task","task.endConfirm":"End the worker session? The in-flight turn will be aborted and the session archived.","task.endHint":"Tells the worker to abort the in-flight turn, exit, and archive the session","permission.writeUnknown":"Pending write","permission.requestAria":"Permission request: {tool}","user.settings.notificationsOn":"On","user.settings.notificationsOff":"Off","artifacts.create.markdownPlaceholder":`# Weekly report
|
|
211
211
|
|
|
212
212
|
- Progress…
|
|
213
|
-
- Risks…`,"cmd.desc.compact":"Compact the context","cmd.desc.cost":"View session cost","cmd.desc.summary":"Generate a session summary","cmd.desc.files":"List files tracked by the session","cmd.desc.clear":"Clear the conversation","cmd.desc.new":"Start a new session","cmd.desc.help":"Show this help","cmd.desc.status":"Show session status","cmd.desc.model":"View or switch models","cmd.desc.copy":"Copy the last assistant message","cmd.desc.resume":"Resume a past conversation into this session","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[session id]","cmd.desc.agentFallback":"agent command","cmd.subtitle.help":"Available commands","cmd.subtitle.status":"Session status","cmd.subtitle.model":"View or switch models","cmd.subtitle.copy":"Copy the assistant message to the clipboard","cmd.subtitle.resume":"Pick and resume a past conversation","cmd.help.localHeader":"**Local commands** (executed by the Web UI)","cmd.help.agentHeader":"**Agent commands** (sent to the Saluzi agent)","cmd.status.header":"**Session status**","cmd.status.sessionId":"Session ID","cmd.status.none":"none","cmd.status.currentModel":"Current model","cmd.status.unset":"not set","cmd.status.modelCount":"Available models","cmd.status.imageSupport":"Image support","cmd.status.yes":"yes","cmd.status.no":"no","cmd.status.messageCount":"Messages","cmd.model.none":"The agent does not expose model selection.","cmd.model.available":"**Available models**","cmd.model.hint":"Use `/model <id>` to switch models.","cmd.model.switched":"Requested switch to model: `{id}`","cmd.model.switchFailed":"Failed to switch model: {message}","cmd.copy.failed":"Copy failed: clipboard unavailable","cmd.copy.copied":"Copied {n} characters to the clipboard","cmd.copy.nothing":"No assistant message to copy","notify.permission.title":"Approval needed","notify.permission.body":"{session} — the agent is waiting for approval","notify.turnComplete.title":"Turn complete","notify.turnComplete.body":"{session} — the agent finished the current turn","adapter.workerCrashed":"Worker process exited unexpectedly","adapter.stopTimeout":"Stop request timed out","adapter.stopFailed":"Stop request failed","adapter.requestTimeout":"Request timed out","attach.emptyFile":"(empty file)","attach.emptyDirectory":"(empty directory)","attach.directoryHeader":"📁 Directory: {name}","attach.fileCount":"({n} files)","attach.readFailed":"(failed to read)","attach.tooLarge":"(file too large, skipped)","attach.imageFile":"(image file, {size})","attach.binaryFile":"(binary file, {size})","attach.dumpHeader":"# Directory: {name}","attach.dumpCount":"{n} files total","attach.structure":"## File structure","attach.contents":"## File contents","acp.sessions":"Sessions","acp.newSession":"New session","acp.confirmDelete":'Delete session "{label}"? This cannot be undone.',"acp.emptySessions":"No sessions","acp.historyNav":"Session history","acp.confirm":"Confirm","acp.noSessionManagement":"This agent does not support session management (rename/delete)","acp.rename":"Rename","acp.renameUnsupported":"This agent does not support session rename","acp.delete":"Delete","acp.deleteUnsupported":"This agent does not support session deletion","acp.mode.default":"Default","acp.mode.defaultDesc":"Approve permission requests manually","acp.mode.acceptEdits":"Auto-accept edits","acp.mode.acceptEditsDesc":"Automatically allow file edits","acp.mode.bypass":"Bypass permissions","acp.mode.bypassDesc":"Skip all permission checks","acp.mode.plan":"Plan mode","acp.mode.planDesc":"Plan only — no tool execution","acp.mode.dontAsk":"Don’t ask","acp.mode.dontAskDesc":"No prompts — reject automatically","acp.mode.auto":"Auto decide","acp.mode.autoDesc":"The AI decides whether to approve","acp.emptyDescription":"Type a message to start chatting with the ACP agent","acp.inputPlaceholder":"Message Saluzi…","acp.waitingPlaceholder":"Waiting for session...","chat.fileMatchHint":"File matches {query} — ↑↓ to select, Enter to insert","chat.picker.image":"Images","chat.picker.textFile":"Text files","chat.picker.sheet":"Spreadsheets","chat.picker.directory":"Directories","chat.commandList":"Command list","chat.processingFile":"Processing files…","chat.queued":"{n} messages queued — sent automatically when the turn completes","chat.queuedCancel":" (click to cancel all)","chat.inputHint":"Enter to send, Shift+Enter for a new line","chat.inputHintSuffix":", / for commands, @ completes file paths","chat.fileCount":"{n} files","chat.directory":"Directory","chat.noCommands":"No matching commands","chat.cmdDone":"Command executed · type a message to continue","plan.title":"Plan","plan.priority.high":"High","plan.priority.medium":"Medium","plan.priority.low":"Low","tool.newFile":"New file","tool.callTimes":"{name} ×{n}","tool.summaryCalls":"{n} tool calls","tool.summaryTools":"{n} tools: {names}","usage.context":"Context: {used} / {size} tokens","usage.totalCost":"Total cost: {cost}","diff.aria":"Diff preview for {path}, {added} additions, {removed} deletions","diff.hidden":"… {n} more lines hidden","diff.addedLine":"Added line: {text}","diff.removedLine":"Removed line: {text}","common.emptyTitle":"No messages yet","common.emptyDescription":"Start a conversation to see messages here","message.rewindHere":"Rewind here (conversation and files)","message.rewindEdit":"Rewind and edit this message","message.expand":"Expand"},Wi="rcs_locale";function vh(){try{const t=localStorage.getItem(Wi);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Rr=vh();const Ws=new Set;function Xb(e){Rr=e;try{localStorage.setItem(Wi,e)}catch{}Ws.forEach(t=>t())}function bh(e){return Ws.add(e),()=>{Ws.delete(e)}}function tn(){return p.useSyncExternalStore(bh,()=>Rr)}function V(e){return Rr==="en"?xh[e]??Eo[e]??e:Eo[e]??e}function we(e,t){let n=V(e);for(const[r,s]of Object.entries(t))n=n.split(`{${r}}`).join(String(s));return n}function yh({className:e}){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:e,children:d.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"currentColor"})})}const wh="";let Gn=null;function Ch(e){Gn=e}function Qb(){return Gn}let Vs=null;function _o(e){Vs=e}let on=null;async function Sh(){return on||(on=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{on=null}})(),on)}class As extends Error{constructor(n,r,s){super(n);re(this,"type");re(this,"status");this.name="ApiError",this.type=r,this.status=s}}async function he(e,t,n,r){const s={"Content-Type":"application/json"};Gn&&(s.Authorization=`Bearer ${Gn}`);const o=`${wh}${t}`,a={method:e,headers:s,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(o,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!r&&await Sh())return he(e,t,n,!0);Vs&&Vs()}let m;try{m=await i.json()}catch{throw i.ok?new As("Invalid JSON response","parse_error",i.status):new As(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new As(c,l,i.status)}return m}function Jb(){return he("GET","/web/sessions")}function Zb(){return he("GET","/web/sessions/all")}function ey(e){return he("GET",`/web/sessions/${e}`)}function ty(e){return he("GET",`/web/sessions/${e}/history`)}function ny(e){return he("GET",`/web/sessions/${e}/models`)}function sy(){return he("GET","/web/environments")}function ry(e,t=20){const n=encodeURIComponent(e);return he("GET",`/web/search?q=${n}&limit=${t}`)}function oy(e,t){return he("POST",`/web/sessions/${e}/events`,t)}function ay(e,t){return he("POST",`/web/sessions/${e}/rewind`,{target_event_id:t})}function iy(e,t){return he("POST",`/web/sessions/${e}/control`,t)}function ly(e){return he("POST",`/web/sessions/${e}/interrupt`)}function cy(e){return he("DELETE",`/web/sessions/${e}`)}function dy(e){return he("POST",`/web/sessions/${e}/clear`)}function uy(e,t){return he("PATCH",`/web/sessions/${e}`,{title:t})}function fy(e){return he("POST","/web/sessions",e)}function my(e){return he("GET",`/web/sessions/s/${e}`)}function py(e){return he("GET",`/web/sessions/${e}/shares`)}function hy(e,t){return he("POST",`/web/sessions/${e}/shares`,t)}function gy(e,t){return he("DELETE",`/web/sessions/${e}/shares/${t}`)}function xy(e,t){return he("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function vy(e,t){return he("DELETE",`/web/teams/${e}/environments/${t}`)}function by(e){return he("POST","/web/environments/claim",{claim_token:e})}function yy(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return he("GET",`/web/artifacts${r}`)}function wy(e){return he("GET",`/web/artifacts/${e}`)}function Cy(e){return he("POST","/web/artifacts",e)}function Sy(e){return he("DELETE",`/web/artifacts/${e}`)}const Gs="rcs_active_team";function kh(){try{return localStorage.getItem(Gs)}catch{return null}}let Vi=kh();const qs=new Set;function Ah(){for(const e of qs)e()}function Eh(e){return qs.add(e),()=>qs.delete(e)}function _h(){return Vi}function Et(e){try{e?localStorage.setItem(Gs,e):localStorage.removeItem(Gs)}catch{}Vi=e,Ah()}let Mn=null;function Th(){return Mn||(Mn=he("GET","/web/teams").finally(()=>{Mn=null})),Mn}function Rh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),s=p.useSyncExternalStore(Eh,_h,()=>null),o=p.useCallback(async()=>{r(!0);try{const f=await Th();t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{o()},[o]);const a=e.find(f=>f.id===s)||null,i=p.useCallback(f=>{Et(f)},[]),m=p.useCallback(async f=>{const l=await he("POST","/web/teams",f);return await o(),l},[o]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:o}}function Nh({className:e}){tn();const{myTeams:t,activeTeam:n,switchTeam:r,isLoading:s}=Rh();return s||t.length===0?null:d.jsxs("div",{className:ee("relative",e),children:[d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:o=>{const a=o.target.value;r(a||null)},children:[d.jsx("option",{value:"",children:V("team.switcher.personal")}),t.map(o=>d.jsx("option",{value:o.id,children:o.name},o.id))]}),d.jsx(Qt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Gi=p.createContext(null);function qi(){const e=p.useContext(Gi);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Ut(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function jh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function Mh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function In(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Ih({children:e}){const[t,n]=p.useState(null),[r,s]=p.useState(!0),[o,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let y=!1;return Ut().then(v=>{y||(n(v),s(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{y||a(v.allowed===!0)}).catch(()=>{}),Mh().then(v=>{y||m(v)}),_o(()=>{n(null),Et(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{y=!0,_o(null)}},[]);const f=p.useCallback(async(y,v)=>{const E=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!E.ok){const A=await In(E);throw new Error(A.error||"Login failed")}const _=await Ut();n(_),Et(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Et(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Ut();return n(v),!0}catch{return!1}},[]),u=p.useCallback(async(y,v,E)=>{const _=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:y,username:v,password:E})});if(!_.ok){const O=await In(_);throw new Error(O.error||"Setup failed")}const A=await Ut();n(A),Et(null)},[]),h=p.useCallback(async(y,v,E)=>{const _=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:y,username:v,password:E})});if(!_.ok){const O=await In(_);throw new Error(O.error||"Join failed")}const A=await Ut();n(A),Et(null)},[]),g=p.useCallback(async(y,v)=>{const E=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!E.ok){const A=await In(E);throw new Error(A.error||"Registration failed")}const _=await Ut();n(_),Et(null)},[]),b=p.useCallback(async()=>jh(),[]);return d.jsx(Gi.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:u,join:h,register:g,checkSetupStatus:b,registrationAllowed:o,singleUserMode:i},children:e})}function Ph({onSettingsClick:e}){const{user:t,logout:n}=qi();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return d.jsxs(zi,{children:[d.jsx(Hi,{asChild:!0,children:d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[d.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand-text",children:d.jsx(Ca,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),d.jsxs(Bi,{align:"end",className:"w-48",children:[d.jsx(ph,{children:d.jsxs("div",{className:"flex flex-col space-y-0.5",children:[d.jsx("span",{className:"text-sm font-medium",children:t.username}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),d.jsx(Ao,{}),d.jsxs(Dn,{onClick:e,children:[d.jsx(pu,{className:"mr-2 h-4 w-4"}),V("user.menu.settings")]}),d.jsxs(Dn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[d.jsx(Tu,{className:"mr-2 h-4 w-4"}),V("team.menu.myTeams")]}),d.jsx(Ao,{}),d.jsxs(Dn,{onClick:r,children:[d.jsx(Yd,{className:"mr-2 h-4 w-4"}),V("user.menu.logout")]})]})]})}function Dh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:s}){return tn(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:e?"mx-auto page-measure flex h-11 sm:h-12 items-center justify-between px-4 sm:px-8":"ds-nav-bleed flex h-11 sm:h-12 items-center justify-between",children:[d.jsxs("div",{className:"ds-nav-brand flex items-center gap-2 min-w-0",children:[!e&&d.jsx(Nh,{}),e?d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(jd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx(yh,{className:"h-5 w-5 flex-shrink-0 text-brand"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.remoteControl")})]})]}),d.jsxs("div",{className:"ds-nav-actions flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:V("nav.dashboard"),children:[d.jsx(Gd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.dashboard")})]}),s&&d.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("artifacts.title"),children:[d.jsx(Ud,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("artifacts.title")})]}),d.jsx(gh,{}),d.jsx(Ph,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}const Oh={running:{pill:"bg-status-running/15 text-status-running font-medium",dot:"bg-status-running pulse-dot"},active:{pill:"bg-status-active/15 text-status-active",dot:"bg-status-active"},idle:{pill:"bg-surface-2 text-text-muted"},requires_action:{pill:"bg-status-warning/15 text-status-warning",dot:"bg-status-warning"},error:{pill:"bg-status-error/15 text-status-error",dot:"bg-status-error"},inactive:{pill:"bg-surface-3 text-text-muted"},archived:{pill:"bg-surface-3 text-text-muted"}};function ky({status:e}){const t=Oh[e];return d.jsxs("span",{className:ee("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs",t?t.pill:"bg-surface-3 text-text-secondary"),children:[(t==null?void 0:t.dot)&&d.jsx("span",{className:ee("h-1.5 w-1.5 rounded-full",t.dot)}),e]})}function Lh(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Ki extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const pt=class pt{constructor(t){re(this,"ws",null);re(this,"settings");re(this,"connectionState","disconnected");re(this,"sessionId",null);re(this,"_agentCapabilities",null);re(this,"_promptCapabilities",null);re(this,"_modelState",null);re(this,"_availableCommands",[]);re(this,"_usage",null);re(this,"_currentModeId",null);re(this,"_configOptions",[]);re(this,"onModelChanged",new Set);re(this,"onModelStateChanged",new Set);re(this,"onUsageChanged",new Set);re(this,"onCurrentModeChanged",new Set);re(this,"onConfigOptionsChanged",new Set);re(this,"onAvailableCommandsChanged",null);re(this,"onSessionLoaded",null);re(this,"onSessionSwitching",null);re(this,"onConnectionStateChange",new Set);re(this,"onSessionUpdate",null);re(this,"onSessionCreated",null);re(this,"onPromptComplete",null);re(this,"onPermissionRequest",null);re(this,"onBrowserToolCall",null);re(this,"onErrorMessage",null);re(this,"onSessionDeleted",null);re(this,"onSessionRenamed",null);re(this,"pendingSessionList",null);re(this,"pendingSessionLoad",null);re(this,"pendingSessionResume",null);re(this,"pendingSessionTarget",null);re(this,"connectResolve",null);re(this,"connectReject",null);re(this,"heartbeatInterval",null);re(this,"heartbeatTimeout",null);re(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.resume)!==null}get supportsSessionList(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Lh(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=s=>{if(this.ws===r)try{const o=JSON.parse(s.data);this.handleResponse(o)}catch(o){console.error("[ACPClient] Failed to parse message:",o)}},r.onerror=()=>{var s;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(s=this.connectReject)==null||s.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=s=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",s.code,s.reason),this.connectReject){const o=s.reason||`Connection closed (code: ${s.code})`;this.setState("error",o),this.connectReject(new Error(o)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,s,o,a,i,m,f,l,c,u,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const b=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(b)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(b)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(b)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(b)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",b),(s=this.onErrorMessage)==null||s.call(this,b));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(o=this.onSessionCreated)==null||o.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const y=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",y,"payload:",t.payload),y==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(y==="usage_update"){this._usage=t.payload.update;for(const v of this.onUsageChanged)v(this._usage)}else if(y==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const v of this.onCurrentModeChanged)v(this._currentModeId)}else if(y==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const v of this.onConfigOptionsChanged)v(this._configOptions)}(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const v of this.onModelChanged)v(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=pt.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},pt.PONG_TIMEOUT_MS)},pt.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const s=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:s};try{this.send({type:"list_sessions",payload:t})}catch(o){clearTimeout(s),this.pendingSessionList=null,r(o)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:s};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:s};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Ki),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};re(pt,"HEARTBEAT_INTERVAL_MS",3e4),re(pt,"PONG_TIMEOUT_MS",1e4),re(pt,"MAX_MISSED_PONGS",2);let Ks=pt;function Fh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Yi(e,t){return new Promise((function(n,r){let s;return $h(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const $h=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let a=0;if(o.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=o.getUint16(a);if(i===65498)break;const m=o.getUint16(a+2);if(i===65505&&o.getUint32(a+4)===1165519206){const f=a+10;let l;switch(o.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=o.getUint32(f+4,l),u=f+c+2+12*o.getUint16(f+c,l);for(let h=f+c+2;h<u;h+=12)if(o.getUint16(h,l)==274){if(o.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(o.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");o.setUint16(h+8,1,l);break}return t(s.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var qn={},Uh={get exports(){return qn},set exports(e){qn=e}};(function(e){var t,n,r={};Uh.exports=r,r.parse=function(s,o){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(s),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var u=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var b=0;b<u;b++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var y=i(l,m+=4),v=a(l,m+=4),E=a(l,m+2),_=a(l,m+4);m+=6;var A=i(l,m+=8);m+=4,m+=v+E+_,r._readLocal(l,A,f,h,y,o)}return f},r._readLocal=function(s,o,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(s,o),l(s,o+=4),l(s,o+=2);var u=l(s,o+=2);c(s,o+=2),c(s,o+=4),o+=4;var h=l(s,o+=8),g=l(s,o+=2);o+=2;var b=r.bin.readUTF8(s,o,h);if(o+=h,o+=g,f)a[b]={size:m,csize:i};else{var y=new Uint8Array(s.buffer,o);if(u==0)a[b]=new Uint8Array(y.buffer.slice(o,o+i));else{if(u!=8)throw"unknown compression method: "+u;var v=new Uint8Array(m);r.inflateRaw(y,v),a[b]=v}}},r.inflateRaw=function(s,o){return r.F.inflate(s,o)},r.inflate=function(s,o){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),o)},r.deflate=function(s,o){o==null&&(o={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*s.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(s,i,a,o.level);var m=r.adler(s,0,s.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var a=new Uint8Array(50+Math.floor(1.1*s.length)),i=r.F.deflateRaw(s,a,i,o.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(s,o){o==null&&(o=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in s){var c=!r._noNeed(l)&&!o,u=s[l],h=r.crc.crc(u,0,u.length);f[l]={cpr:c,usize:u.length,crc:h,file:c?r.deflateRaw(u):u}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),b=0,y=[];for(var l in f){var v=f[l];y.push(b),b=r._writeHeader(g,b,l,v,0)}var E=0,_=b;for(var l in f)v=f[l],y.push(b),b=r._writeHeader(g,b,l,v,1,y[E++]);var A=b-_;return i(g,b,101010256),b+=4,m(g,b+=4,E),m(g,b+=2,E),i(g,b+=2,A),i(g,b+=4,_),b+=4,b+=2,g.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,u=i.file;return l(s,o,m==0?67324752:33639248),o+=4,m==1&&(o+=2),c(s,o,20),c(s,o+=2,0),c(s,o+=2,i.cpr?8:0),l(s,o+=2,0),l(s,o+=4,i.crc),l(s,o+=4,u.length),l(s,o+=4,i.usize),c(s,o+=4,r.bin.sizeUTF8(a)),c(s,o+=2,0),o+=2,m==1&&(o+=2,o+=2,l(s,o+=6,f),o+=4),o+=r.bin.writeUTF8(s,o,a),m==0&&(s.set(u,o),o+=u.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var a=o,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;s[o]=a}return s})(),update:function(s,o,a,i){for(var m=0;m<i;m++)s=r.crc.table[255&(s^o[a+m])]^s>>>8;return s},crc:function(s,o,a){return 4294967295^r.crc.update(4294967295,s,o,a)}},r.adler=function(s,o,a){for(var i=1,m=0,f=o,l=o+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=s[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(s,o){return s[o]|s[o+1]<<8},writeUshort:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255,s[o+2]=a>>16&255,s[o+3]=a>>24&255},readASCII:function(s,o,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(s[o+m]);return i},writeASCII:function(s,o,a){for(var i=0;i<a.length;i++)s[o+i]=a.charCodeAt(i)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,o,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(s[o+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(s,o,a)}return i},writeUTF8:function(s,o,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)s[o+m]=l,m++;else if((4294965248&l)==0)s[o+m]=192|l>>6,s[o+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)s[o+m]=224|l>>12,s[o+m+1]=128|l>>6&63,s[o+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";s[o+m]=240|l>>18,s[o+m+1]=128|l>>12&63,s[o+m+2]=128|l>>6&63,s[o+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(s){for(var o=s.length,a=0,i=0;i<o;i++){var m=s.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(s,o,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,u=0,h=a<<3,g=0,b=s.length;if(i==0){for(;u<b;)c(o,h,u+(P=Math.min(65535,b-u))==b?1:0),h=r.F._copyExact(s,u,P,o,h+8),u+=P;return h>>>3}var y=f.lits,v=f.strt,E=f.prev,_=0,A=0,O=0,k=0,T=0,x=0;for(b>2&&(v[x=r.F._hash(s,0)]=0),u=0;u<b;u++){if(T=x,u+1<b-2){x=r.F._hash(s,u+1);var w=u+1&32767;E[w]=v[x],v[x]=w}if(g<=u){(_>14e3||A>26697)&&b-u>100&&(g<u&&(y[_]=u-g,_+=2,g=u),h=r.F._writeBlock(u==b-1||g==b?1:0,y,_,k,s,O,u-O,o,h),_=A=k=0,O=u);var R=0;u<b-2&&(R=r.F._bestMatch(s,u,E,T,Math.min(m[2],b-u),m[3]));var P=R>>>16,D=65535&R;if(R!=0){D=65535&R;var F=l(P=R>>>16,f.of0);f.lhst[257+F]++;var M=l(D,f.df0);f.dhst[M]++,k+=f.exb[F]+f.dxb[M],y[_]=P<<23|u-g,y[_+1]=D<<16|F<<8|M,_+=2,g=u+P}else f.lhst[s[u]]++;A++}}for(O==u&&s.length!=0||(g<u&&(y[_]=u-g,_+=2,g=u),h=r.F._writeBlock(1,y,_,k,s,O,u-O,o,h),_=0,A=0,_=A=k=0,O=u);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(s,o,a,i,m,f){var l=32767&o,c=a[l],u=l-c+32768&32767;if(c==l||i!=r.F._hash(s,o-u))return 0;for(var h=0,g=0,b=Math.min(32767,o);u<=b&&--f!=0&&c!=l;){if(h==0||s[o+h]==s[o+h-u]){var y=r.F._howLong(s,o,u);if(y>h){if(g=u,(h=y)>=m)break;u+2<y&&(y=u+2);for(var v=0,E=0;E<y-2;E++){var _=o-u+E+32768&32767,A=_-a[_]+32768&32767;A>v&&(v=A,c=_)}}}u+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},r.F._howLong=function(s,o,a){if(s[o]!=s[o-a]||s[o+1]!=s[o+1-a]||s[o+2]!=s[o+2-a])return 0;var i=o,m=Math.min(s.length,o+258);for(o+=3;o<m&&s[o]==s[o-a];)o++;return o-i},r.F._hash=function(s,o){return(s[o]<<8|s[o+1])+(s[o+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,o,a,i,m,f,l,c,u){var h,g,b,y,v,E,_,A,O,k=r.F.U,T=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(h=r.F.getTrees())[0],b=h[1],y=h[2],v=h[3],E=h[4],_=h[5],A=h[6],O=h[7];var w=32+((u+3&7)==0?0:8-(u+3&7))+(l<<3),R=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),P=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);P+=14+3*_+r.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var D=0;D<286;D++)k.lhst[D]=0;for(D=0;D<30;D++)k.dhst[D]=0;for(D=0;D<19;D++)k.ihst[D]=0;var F=w<R&&w<P?0:R<P?1:2;if(T(c,u,s),T(c,u+1,F),u+=3,F==0){for(;(7&u)!=0;)u++;u=r.F._copyExact(m,f,l,c,u)}else{var M,z;if(F==1&&(M=k.fltree,z=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,b),r.F.revCodes(k.dtree,b),r.F.makeCodes(k.itree,y),r.F.revCodes(k.itree,y),M=k.ltree,z=k.dtree,x(c,u,v-257),x(c,u+=5,E-1),x(c,u+=5,_-4),u+=4;for(var S=0;S<_;S++)x(c,u+3*S,k.itree[1+(k.ordr[S]<<1)]);u+=3*_,u=r.F._codeTiny(A,k.itree,c,u),u=r.F._codeTiny(O,k.itree,c,u)}for(var C=f,H=0;H<a;H+=2){for(var I=o[H],U=I>>>23,Y=C+(8388607&I);C<Y;)u=r.F._writeLit(m[C++],M,c,u);if(U!=0){var j=o[H+1],L=j>>16,$=j>>8&255,N=255&j;x(c,u=r.F._writeLit(257+$,M,c,u),U-k.of0[$]),u+=k.exb[$],T(c,u=r.F._writeLit(N,z,c,u),L-k.df0[N]),u+=k.dxb[N],C+=U}}u=r.F._writeLit(256,M,c,u)}return u},r.F._copyExact=function(s,o,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(s.buffer,o,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),a=r.F._hufTree(s.dhst,s.dtree,15),i=[],m=r.F._lenCodes(s.ltree,i),f=[],l=r.F._lenCodes(s.dtree,f),c=0;c<i.length;c+=2)s.ihst[i[c]]++;for(c=0;c<f.length;c+=2)s.ihst[f[c]]++;for(var u=r.F._hufTree(s.ihst,s.itree,7),h=19;h>4&&s.itree[1+(s.ordr[h-1]<<1)]==0;)h--;return[o,a,u,m,l,h,i,f]},r.F.getSecond=function(s){for(var o=[],a=0;a<s.length;a+=2)o.push(s[a+1]);return o},r.F.nonZero=function(s){for(var o="",a=0;a<s.length;a+=2)s[a+1]!=0&&(o+=(a>>1)+",");return o},r.F.contSize=function(s,o){for(var a=0,i=0;i<o.length;i++)a+=o[i]*s[1+(i<<1)];return a},r.F._codeTiny=function(s,o,a,i){for(var m=0;m<s.length;m+=2){var f=s[m],l=s[m+1];i=r.F._writeLit(f,o,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(s,o){for(var a=s.length;a!=2&&s[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=s[i+1],f=i+3<a?s[i+3]:-1,l=i+5<a?s[i+5]:-1,c=i==0?-1:s[i-1];if(m==0&&f==m&&l==m){for(var u=i+5;u+2<a&&s[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?o.push(17,h-3):o.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(u=i+5;u+2<a&&s[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);o.push(16,h-3),i+=2*h-2}else o.push(m,0)}return a>>>1},r.F._hufTree=function(s,o,a){var i=[],m=s.length,f=o.length,l=0;for(l=0;l<f;l+=2)o[l]=0,o[l+1]=0;for(l=0;l<m;l++)s[l]!=0&&i.push({lit:l,f:s[l]});var c=i.length,u=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return u=h==0?1:0,o[1+(h<<1)]=1,o[1+(u<<1)]=1,1}i.sort((function(A,O){return A.f-O.f}));var g=i[0],b=i[1],y=0,v=1,E=2;for(i[0]={lit:-1,f:g.f+b.f,l:g,r:b,d:0};v!=c-1;)g=y!=v&&(E==c||i[y].f<i[E].f)?i[y++]:i[E++],b=y!=v&&(E==c||i[y].f<i[E].f)?i[y++]:i[E++],i[v++]={lit:-1,f:g.f+b.f,l:g,r:b};var _=r.F.setDepth(i[v-1],0);for(_>a&&(r.F.restrictDepth(u,a,_),_=a),l=0;l<c;l++)o[1+(u[l].lit<<1)]=u[l].d;return _},r.F.setDepth=function(s,o){return s.lit!=-1?(s.d=o,o):Math.max(r.F.setDepth(s.l,o+1),r.F.setDepth(s.r,o+1))},r.F.restrictDepth=function(s,o,a){var i=0,m=1<<a-o,f=0;for(s.sort((function(c,u){return u.d==c.d?c.f-u.f:u.d-c.d})),i=0;i<s.length&&s[i].d>o;i++){var l=s[i].d;s[i].d=o,f+=m-(1<<a-l)}for(f>>>=a-o;f>0;)(l=s[i].d)<o?(s[i].d++,f-=1<<o-l-1):i++;for(;i>=0;i--)s[i].d==o&&f<0&&(s[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var a=0;return o[16|a]<=s&&(a|=16),o[8|a]<=s&&(a|=8),o[4|a]<=s&&(a|=4),o[2|a]<=s&&(a|=2),o[1|a]<=s&&(a|=1),a},r.F._writeLit=function(s,o,a,i){return r.F._putsF(a,i,o[s<<1]),i+o[1+(s<<1)]},r.F.inflate=function(s,o){var a=Uint8Array;if(s[0]==3&&s[1]==0)return o||new a(0);var i=r.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,u=i.codes2map,h=i._get17,g=i.U,b=o==null;b&&(o=new a(s.length>>>2<<3));for(var y,v,E=0,_=0,A=0,O=0,k=0,T=0,x=0,w=0,R=0;E==0;)if(E=m(s,R,1),_=m(s,R+1,2),R+=3,_!=0){if(b&&(o=r.F._check(o,w+(1<<17))),_==1&&(y=g.flmap,v=g.fdmap,T=511,x=31),_==2){A=f(s,R,5)+257,O=f(s,R+5,5)+1,k=f(s,R+10,4)+4,R+=14;for(var P=0;P<38;P+=2)g.itree[P]=0,g.itree[P+1]=0;var D=1;for(P=0;P<k;P++){var F=f(s,R+3*P,3);g.itree[1+(g.ordr[P]<<1)]=F,F>D&&(D=F)}R+=3*k,c(g.itree,D),u(g.itree,D,g.imap),y=g.lmap,v=g.dmap,R=l(g.imap,(1<<D)-1,A+O,s,R,g.ttree);var M=i._copyOut(g.ttree,0,A,g.ltree);T=(1<<M)-1;var z=i._copyOut(g.ttree,A,O,g.dtree);x=(1<<z)-1,c(g.ltree,M),u(g.ltree,M,y),c(g.dtree,z),u(g.dtree,z,v)}for(;;){var S=y[h(s,R)&T];R+=15&S;var C=S>>>4;if(!(C>>>8))o[w++]=C;else{if(C==256)break;var H=w+C-254;if(C>264){var I=g.ldef[C-257];H=w+(I>>>3)+f(s,R,7&I),R+=7&I}var U=v[h(s,R)&x];R+=15&U;var Y=U>>>4,j=g.ddef[Y],L=(j>>>4)+m(s,R,15&j);for(R+=15&j,b&&(o=r.F._check(o,w+(1<<17)));w<H;)o[w]=o[w++-L],o[w]=o[w++-L],o[w]=o[w++-L],o[w]=o[w++-L];w=H}}}else{(7&R)!=0&&(R+=8-(7&R));var $=4+(R>>>3),N=s[$-4]|s[$-3]<<8;b&&(o=r.F._check(o,w+N)),o.set(new a(s.buffer,s.byteOffset+$,N),w),R=$+N<<3,w+=N}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var a=s.length;if(o<=a)return s;var i=new Uint8Array(Math.max(a<<1,o));return i.set(s,0),i},r.F._decodeTiny=function(s,o,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,u=0;u<a;){var h=s[c(i,m)&o];m+=15&h;var g=h>>>4;if(g<=15)f[u]=g,u++;else{var b=0,y=0;g==16?(y=3+l(i,m,2),m+=2,b=f[u-1]):g==17?(y=3+l(i,m,3),m+=3):g==18&&(y=11+l(i,m,7),m+=7);for(var v=u+y;u<v;)f[u]=b,u++}}return m},r.F._copyOut=function(s,o,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=s[f+o];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},r.F.makeCodes=function(s,o){for(var a,i,m,f,l=r.F.U,c=s.length,u=l.bl_count,h=0;h<=o;h++)u[h]=0;for(h=1;h<c;h+=2)u[s[h]]++;var g=l.next_code;for(a=0,u[0]=0,i=1;i<=o;i++)a=a+u[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=s[m+1])!=0&&(s[m]=g[f],g[f]++)},r.F.codes2map=function(s,o,a){for(var i=s.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(s[f+1]!=0)for(var l=f>>1,c=s[f+1],u=l<<4|c,h=o-c,g=s[f]<<h,b=g+(1<<h);g!=b;)a[m[g]>>>15-o]=u,g++},r.F.revCodes=function(s,o){for(var a=r.F.U.rev15,i=15-o,m=0;m<s.length;m+=2){var f=s[m]<<o-s[m+1];s[m]=a[f]>>>i}},r.F._putsE=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8},r.F._putsF=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8,s[i+2]|=a>>>16},r.F._bitsE=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<<a)-1},r.F._bitsF=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<<a)-1},r.F._get17=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var a=o;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,s.rev15[o]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];i(s.fltree,144,8),i(s.fltree,112,9),i(s.fltree,24,7),i(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),i(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),i(s.itree,19,0),i(s.ltree,286,0),i(s.dtree,30,0),i(s.ttree,320,0)})()})();var zh=Fh({__proto__:null,default:qn},[qn]);const He=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,u){l[c]=u>>8&255,l[c+1]=255&u},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,u){l[c]=u>>24&255,l[c+1]=u>>16&255,l[c+2]=u>>8&255,l[c+3]=255&u},readASCII(l,c,u){let h="";for(let g=0;g<u;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,u){for(let h=0;h<u.length;h++)l[c+h]=u.charCodeAt(h)},readBytes(l,c,u){const h=[];for(let g=0;g<u;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,u){let h,g="";for(let b=0;b<u;b++)g+=`%${e.pad(l[c+b].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,u)}return h}};function t(l,c,u,h){const g=c*u,b=o(h),y=Math.ceil(c*b/8),v=new Uint8Array(4*g),E=new Uint32Array(v.buffer),{ctype:_}=h,{depth:A}=h,O=e.readUshort;if(_==6){const I=g<<2;if(A==8)for(var k=0;k<I;k+=4)v[k]=l[k],v[k+1]=l[k+1],v[k+2]=l[k+2],v[k+3]=l[k+3];if(A==16)for(k=0;k<I;k++)v[k]=l[k<<1]}else if(_==2){const I=h.tabs.tRNS;if(I==null){if(A==8)for(k=0;k<g;k++){var T=3*k;E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T]}if(A==16)for(k=0;k<g;k++)T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T]}else{var x=I[0];const U=I[1],Y=I[2];if(A==8)for(k=0;k<g;k++){var w=k<<2;T=3*k,E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T],l[T]==x&&l[T+1]==U&&l[T+2]==Y&&(v[w+3]=0)}if(A==16)for(k=0;k<g;k++)w=k<<2,T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T],O(l,T)==x&&O(l,T+2)==U&&O(l,T+4)==Y&&(v[w+3]=0)}}else if(_==3){const I=h.tabs.PLTE,U=h.tabs.tRNS,Y=U?U.length:0;if(A==1)for(var R=0;R<u;R++){var P=R*y,D=R*c;for(k=0;k<c;k++){w=D+k<<2;var F=3*(M=l[P+(k>>3)]>>7-((7&k)<<0)&1);v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=M<Y?U[M]:255}}if(A==2)for(R=0;R<u;R++)for(P=R*y,D=R*c,k=0;k<c;k++)w=D+k<<2,F=3*(M=l[P+(k>>2)]>>6-((3&k)<<1)&3),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=M<Y?U[M]:255;if(A==4)for(R=0;R<u;R++)for(P=R*y,D=R*c,k=0;k<c;k++)w=D+k<<2,F=3*(M=l[P+(k>>1)]>>4-((1&k)<<2)&15),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=M<Y?U[M]:255;if(A==8)for(k=0;k<g;k++){var M;w=k<<2,F=3*(M=l[k]),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=M<Y?U[M]:255}}else if(_==4){if(A==8)for(k=0;k<g;k++){w=k<<2;var z=l[S=k<<1];v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+1]}if(A==16)for(k=0;k<g;k++){var S;w=k<<2,z=l[S=k<<2],v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+2]}}else if(_==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,R=0;R<u;R++){const I=R*y,U=R*c;if(A==1)for(var C=0;C<c;C++){var H=(z=255*(l[I+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;E[U+C]=H<<24|z<<16|z<<8|z}else if(A==2)for(C=0;C<c;C++)H=(z=85*(l[I+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==4)for(C=0;C<c;C++)H=(z=17*(l[I+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==8)for(C=0;C<c;C++)H=(z=l[I+C])==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==16)for(C=0;C<c;C++)z=l[I+(C<<1)],H=O(l,I+(C<<1))==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z}return v}function n(l,c,u,h){const g=o(l),b=Math.ceil(u*g/8),y=new Uint8Array((b+1+l.interlace)*h);return c=l.tabs.CgBI?s(c,y):r(c,y),l.interlace==0?c=a(c,l,0,u,h):l.interlace==1&&(c=(function(E,_){const A=_.width,O=_.height,k=o(_),T=k>>3,x=Math.ceil(A*k/8),w=new Uint8Array(O*x);let R=0;const P=[0,0,4,0,2,0,1],D=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],M=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const C=F[z],H=M[z];let I=0,U=0,Y=P[z];for(;Y<O;)Y+=C,U++;let j=D[z];for(;j<A;)j+=H,I++;const L=Math.ceil(I*k/8);a(E,_,R,I,U);let $=0,N=P[z];for(;N<O;){let B=D[z],G=R+$*L<<3;for(;B<A;){var S;if(k==1&&(S=(S=E[G>>3])>>7-(7&G)&1,w[N*x+(B>>3)]|=S<<7-((7&B)<<0)),k==2&&(S=(S=E[G>>3])>>6-(7&G)&3,w[N*x+(B>>2)]|=S<<6-((3&B)<<1)),k==4&&(S=(S=E[G>>3])>>4-(7&G)&15,w[N*x+(B>>1)]|=S<<4-((1&B)<<2)),k>=8){const q=N*x+B*T;for(let K=0;K<T;K++)w[q+K]=E[(G>>3)+K]}G+=k,B+=H}$++,N+=C}I*U!=0&&(R+=U*(1+L)),z+=1}return w})(c,l)),c}function r(l,c){return s(new Uint8Array(l.buffer,2,l.length-6),c)}var s=(function(){const l={H:{}};return l.H.N=function(c,u){const h=Uint8Array;let g,b,y=0,v=0,E=0,_=0,A=0,O=0,k=0,T=0,x=0;if(c[0]==3&&c[1]==0)return u||new h(0);const w=l.H,R=w.b,P=w.e,D=w.R,F=w.n,M=w.A,z=w.Z,S=w.m,C=u==null;for(C&&(u=new h(c.length>>>2<<5));y==0;)if(y=R(c,x,1),v=R(c,x+1,2),x+=3,v!=0){if(C&&(u=l.H.W(u,T+(1<<17))),v==1&&(g=S.J,b=S.h,O=511,k=31),v==2){E=P(c,x,5)+257,_=P(c,x+5,5)+1,A=P(c,x+10,4)+4,x+=14;let I=1;for(var H=0;H<38;H+=2)S.Q[H]=0,S.Q[H+1]=0;for(H=0;H<A;H++){const j=P(c,x+3*H,3);S.Q[1+(S.X[H]<<1)]=j,j>I&&(I=j)}x+=3*A,F(S.Q,I),M(S.Q,I,S.u),g=S.w,b=S.d,x=D(S.u,(1<<I)-1,E+_,c,x,S.v);const U=w.V(S.v,0,E,S.C);O=(1<<U)-1;const Y=w.V(S.v,E,_,S.D);k=(1<<Y)-1,F(S.C,U),M(S.C,U,g),F(S.D,Y),M(S.D,Y,b)}for(;;){const I=g[z(c,x)&O];x+=15&I;const U=I>>>4;if(!(U>>>8))u[T++]=U;else{if(U==256)break;{let Y=T+U-254;if(U>264){const B=S.q[U-257];Y=T+(B>>>3)+P(c,x,7&B),x+=7&B}const j=b[z(c,x)&k];x+=15&j;const L=j>>>4,$=S.c[L],N=($>>>4)+R(c,x,15&$);for(x+=15&$;T<Y;)u[T]=u[T++-N],u[T]=u[T++-N],u[T]=u[T++-N],u[T]=u[T++-N];T=Y}}}}else{(7&x)!=0&&(x+=8-(7&x));const I=4+(x>>>3),U=c[I-4]|c[I-3]<<8;C&&(u=l.H.W(u,T+U)),u.set(new h(c.buffer,c.byteOffset+I,U),T),x=I+U<<3,T+=U}return u.length==T?u:u.slice(0,T)},l.H.W=function(c,u){const h=c.length;if(u<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,u,h,g,b,y){const v=l.H.e,E=l.H.Z;let _=0;for(;_<h;){const A=c[E(g,b)&u];b+=15&A;const O=A>>>4;if(O<=15)y[_]=O,_++;else{let k=0,T=0;O==16?(T=3+v(g,b,2),b+=2,k=y[_-1]):O==17?(T=3+v(g,b,3),b+=3):O==18&&(T=11+v(g,b,7),b+=7);const x=_+T;for(;_<x;)y[_]=k,_++}}return b},l.H.V=function(c,u,h,g){let b=0,y=0;const v=g.length>>>1;for(;y<h;){const E=c[y+u];g[y<<1]=0,g[1+(y<<1)]=E,E>b&&(b=E),y++}for(;y<v;)g[y<<1]=0,g[1+(y<<1)]=0,y++;return b},l.H.n=function(c,u){const h=l.H.m,g=c.length;let b,y,v,E;const _=h.j;for(var A=0;A<=u;A++)_[A]=0;for(A=1;A<g;A+=2)_[c[A]]++;const O=h.K;for(b=0,_[0]=0,y=1;y<=u;y++)b=b+_[y-1]<<1,O[y]=b;for(v=0;v<g;v+=2)E=c[v+1],E!=0&&(c[v]=O[E],O[E]++)},l.H.A=function(c,u,h){const g=c.length,b=l.H.m.r;for(let y=0;y<g;y+=2)if(c[y+1]!=0){const v=y>>1,E=c[y+1],_=v<<4|E,A=u-E;let O=c[y]<<A;const k=O+(1<<A);for(;O!=k;)h[b[O]>>>15-u]=_,O++}},l.H.l=function(c,u){const h=l.H.m.r,g=15-u;for(let b=0;b<c.length;b+=2){const y=c[b]<<u-c[b+1];c[b]=h[y]>>>g}},l.H.M=function(c,u,h){h<<=7&u;const g=u>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,u,h){h<<=7&u;const g=u>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},l.H.b=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},l.H.Z=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)},l.H.i=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16|c[3+(u>>>3)]<<24)>>>(7&u)},l.H.m=(function(){const c=Uint16Array,u=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var u=0;u<32768;u++){let g=u;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,c.r[u]=(g>>>16|g<<16)>>>17}function h(g,b,y){for(;b--!=0;)g.push(0,y)}for(u=0;u<32;u++)c.q[u]=c.S[u]<<3|c.T[u],c.c[u]=c.p[u]<<4|c.z[u];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function o(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,u,h,g){let b=o(c);const y=Math.ceil(h*b/8);let v,E;b=Math.ceil(b/8);let _=l[u],A=0;if(_>1&&(l[u]=[0,0,1][_-2]),_==3)for(A=b;A<y;A++)l[A+1]=l[A+1]+(l[A+1-b]>>>1)&255;for(let O=0;O<g;O++)if(v=u+O*y,E=v+O+1,_=l[E-1],A=0,_==0)for(;A<y;A++)l[v+A]=l[E+A];else if(_==1){for(;A<b;A++)l[v+A]=l[E+A];for(;A<y;A++)l[v+A]=l[E+A]+l[v+A-b]}else if(_==2)for(;A<y;A++)l[v+A]=l[E+A]+l[v+A-y];else if(_==3){for(;A<b;A++)l[v+A]=l[E+A]+(l[v+A-y]>>>1);for(;A<y;A++)l[v+A]=l[E+A]+(l[v+A-y]+l[v+A-b]>>>1)}else{for(;A<b;A++)l[v+A]=l[E+A]+i(0,l[v+A-y],0);for(;A<y;A++)l[v+A]=l[E+A]+i(l[v+A-b],l[v+A-y],l[v+A-b-y])}return l}function i(l,c,u){const h=l+c-u,g=h-l,b=h-c,y=h-u;return g*g<=b*b&&g*g<=y*y?l:b*b<=y*y?c:u}function m(l,c,u){u.width=e.readUint(l,c),c+=4,u.height=e.readUint(l,c),c+=4,u.depth=l[c],c++,u.ctype=l[c],c++,u.compress=l[c],c++,u.filter=l[c],c++,u.interlace=l[c],c++}function f(l,c,u,h,g,b,y,v,E){const _=Math.min(c,g),A=Math.min(u,b);let O=0,k=0;for(let z=0;z<A;z++)for(let S=0;S<_;S++)if(y>=0&&v>=0?(O=z*c+S<<2,k=(v+z)*g+y+S<<2):(O=(-v+z)*c-y+S<<2,k=z*g+S<<2),E==0)h[k]=l[O],h[k+1]=l[O+1],h[k+2]=l[O+2],h[k+3]=l[O+3];else if(E==1){var T=l[O+3]*.00392156862745098,x=l[O]*T,w=l[O+1]*T,R=l[O+2]*T,P=h[k+3]*(1/255),D=h[k]*P,F=h[k+1]*P,M=h[k+2]*P;const C=1-T,H=T+P*C,I=H==0?0:1/H;h[k+3]=255*H,h[k+0]=(x+D*C)*I,h[k+1]=(w+F*C)*I,h[k+2]=(R+M*C)*I}else if(E==2)T=l[O+3],x=l[O],w=l[O+1],R=l[O+2],P=h[k+3],D=h[k],F=h[k+1],M=h[k+2],T==P&&x==D&&w==F&&R==M?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=w,h[k+2]=R,h[k+3]=T);else if(E==3){if(T=l[O+3],x=l[O],w=l[O+1],R=l[O+2],P=h[k+3],D=h[k],F=h[k+1],M=h[k+2],T==P&&x==D&&w==F&&R==M)continue;if(T<220&&P>20)return!1}return!0}return{decode:function(c){const u=new Uint8Array(c);let h=8;const g=e,b=g.readUshort,y=g.readUint,v={tabs:{},frames:[]},E=new Uint8Array(u.length);let _,A=0,O=0;const k=[137,80,78,71,13,10,26,10];for(var T=0;T<8;T++)if(u[T]!=k[T])throw"The input is not a PNG file!";for(;h<u.length;){const z=g.readUint(u,h);h+=4;const S=g.readASCII(u,h,4);if(h+=4,S=="IHDR")m(u,h,v);else if(S=="iCCP"){for(var x=h;u[x]!=0;)x++;g.readASCII(u,h,x-h),u[x+1];const C=u.slice(x+2,h+z);let H=null;try{H=r(C)}catch{H=s(C)}v.tabs[S]=H}else if(S=="CgBI")v.tabs[S]=u.slice(h,h+4);else if(S=="IDAT"){for(T=0;T<z;T++)E[A+T]=u[h+T];A+=z}else if(S=="acTL")v.tabs[S]={num_frames:y(u,h),num_plays:y(u,h+4)},_=new Uint8Array(u.length);else if(S=="fcTL"){O!=0&&((M=v.frames[v.frames.length-1]).data=n(v,_.slice(0,O),M.rect.width,M.rect.height),O=0);const C={x:y(u,h+12),y:y(u,h+16),width:y(u,h+4),height:y(u,h+8)};let H=b(u,h+22);H=b(u,h+20)/(H==0?100:H);const I={rect:C,delay:Math.round(1e3*H),dispose:u[h+24],blend:u[h+25]};v.frames.push(I)}else if(S=="fdAT"){for(T=0;T<z-4;T++)_[O+T]=u[h+T+4];O+=z-4}else if(S=="pHYs")v.tabs[S]=[g.readUint(u,h),g.readUint(u,h+4),u[h+8]];else if(S=="cHRM")for(v.tabs[S]=[],T=0;T<8;T++)v.tabs[S].push(g.readUint(u,h+4*T));else if(S=="tEXt"||S=="zTXt"){v.tabs[S]==null&&(v.tabs[S]={});var w=g.nextZero(u,h),R=g.readASCII(u,h,w-h),P=h+z-w-1;if(S=="tEXt")F=g.readASCII(u,w+1,P);else{var D=r(u.slice(w+2,w+2+P));F=g.readUTF8(D,0,D.length)}v.tabs[S][R]=F}else if(S=="iTXt"){v.tabs[S]==null&&(v.tabs[S]={}),w=0,x=h,w=g.nextZero(u,x),R=g.readASCII(u,x,w-x);const C=u[x=w+1];var F;u[x+1],x+=2,w=g.nextZero(u,x),g.readASCII(u,x,w-x),x=w+1,w=g.nextZero(u,x),g.readUTF8(u,x,w-x),P=z-((x=w+1)-h),C==0?F=g.readUTF8(u,x,P):(D=r(u.slice(x,x+P)),F=g.readUTF8(D,0,D.length)),v.tabs[S][R]=F}else if(S=="PLTE")v.tabs[S]=g.readBytes(u,h,z);else if(S=="hIST"){const C=v.tabs.PLTE.length/3;for(v.tabs[S]=[],T=0;T<C;T++)v.tabs[S].push(b(u,h+2*T))}else if(S=="tRNS")v.ctype==3?v.tabs[S]=g.readBytes(u,h,z):v.ctype==0?v.tabs[S]=b(u,h):v.ctype==2&&(v.tabs[S]=[b(u,h),b(u,h+2),b(u,h+4)]);else if(S=="gAMA")v.tabs[S]=g.readUint(u,h)/1e5;else if(S=="sRGB")v.tabs[S]=u[h];else if(S=="bKGD")v.ctype==0||v.ctype==4?v.tabs[S]=[b(u,h)]:v.ctype==2||v.ctype==6?v.tabs[S]=[b(u,h),b(u,h+2),b(u,h+4)]:v.ctype==3&&(v.tabs[S]=u[h]);else if(S=="IEND")break;h+=z,g.readUint(u,h),h+=4}var M;return O!=0&&((M=v.frames[v.frames.length-1]).data=n(v,_.slice(0,O),M.rect.width,M.rect.height)),v.data=n(v,E,v.width,v.height),delete v.compress,delete v.interlace,delete v.filter,v},toRGBA8:function(c){const u=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,u,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const b=u*h*4,y=new Uint8Array(b),v=new Uint8Array(b),E=new Uint8Array(b);for(let A=0;A<c.frames.length;A++){const O=c.frames[A],k=O.rect.x,T=O.rect.y,x=O.rect.width,w=O.rect.height,R=t(O.data,x,w,c);if(A!=0)for(var _=0;_<b;_++)E[_]=y[_];if(O.blend==0?f(R,x,w,y,u,h,k,T,0):O.blend==1&&f(R,x,w,y,u,h,k,T,1),g.push(y.buffer.slice(0)),O.dispose!=0){if(O.dispose==1)f(v,x,w,y,u,h,k,T,0);else if(O.dispose==2)for(_=0;_<b;_++)y[_]=E[_]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=He,{_bin:t}=He,n=He._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let w=0;w<256;w++){let R=w;for(let P=0;P<8;P++)1&R?R=3988292384^R>>>1:R>>>=1;x[w]=R}return x})(),update(x,w,R,P){for(let D=0;D<P;D++)x=r.table[255&(x^w[R+D])]^x>>>8;return x},crc:(x,w,R)=>4294967295^r.update(4294967295,x,w,R)};function s(x,w,R,P){w[R]+=x[0]*P>>4,w[R+1]+=x[1]*P>>4,w[R+2]+=x[2]*P>>4,w[R+3]+=x[3]*P>>4}function o(x){return Math.max(0,Math.min(255,x))}function a(x,w){const R=x[0]-w[0],P=x[1]-w[1],D=x[2]-w[2],F=x[3]-w[3];return R*R+P*P+D*D+F*F}function i(x,w,R,P,D,F,M){M==null&&(M=1);const z=P.length,S=[];for(var C=0;C<z;C++){const N=P[C];S.push([N>>>0&255,N>>>8&255,N>>>16&255,N>>>24&255])}for(C=0;C<z;C++){let N=4294967295;for(var H=0,I=0;I<z;I++){var U=a(S[C],S[I]);I!=C&&U<N&&(N=U,H=I)}}const Y=new Uint32Array(D.buffer),j=new Int16Array(w*R*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<L.length;C++)L[C]=255*((L[C]+.5)/16-.5);for(let N=0;N<R;N++)for(let B=0;B<w;B++){var $;C=4*(N*w+B),M!=2?$=[o(x[C]+j[C]),o(x[C+1]+j[C+1]),o(x[C+2]+j[C+2]),o(x[C+3]+j[C+3])]:(U=L[4*(3&N)+(3&B)],$=[o(x[C]+U),o(x[C+1]+U),o(x[C+2]+U),o(x[C+3]+U)]),H=0;let G=16777215;for(I=0;I<z;I++){const oe=a($,S[I]);oe<G&&(G=oe,H=I)}const q=S[H],K=[$[0]-q[0],$[1]-q[1],$[2]-q[2],$[3]-q[3]];M==1&&(B!=w-1&&s(K,j,C+4,7),N!=R-1&&(B!=0&&s(K,j,C+4*w-4,3),s(K,j,C+4*w,5),B!=w-1&&s(K,j,C+4*w+4,1))),F[C>>2]=H,Y[C>>2]=P[H]}}function m(x,w,R,P,D){D==null&&(D={});const{crc:F}=r,M=t.writeUint,z=t.writeUshort,S=t.writeASCII;let C=8;const H=x.frames.length>1;let I,U=!1,Y=33+(H?20:0);if(D.sRGB!=null&&(Y+=13),D.pHYs!=null&&(Y+=21),D.iCCP!=null&&(I=pako.deflate(D.iCCP),Y+=21+I.length+4),x.ctype==3){for(var j=x.plte.length,L=0;L<j;L++)x.plte[L]>>>24!=255&&(U=!0);Y+=8+3*j+4+(U?8+1*j+4:0)}for(var $=0;$<x.frames.length;$++)H&&(Y+=38),Y+=(q=x.frames[$]).cimg.length+12,$!=0&&(Y+=4);Y+=12;const N=new Uint8Array(Y),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)N[L]=B[L];if(M(N,C,13),C+=4,S(N,C,"IHDR"),C+=4,M(N,C,w),C+=4,M(N,C,R),C+=4,N[C]=x.depth,C++,N[C]=x.ctype,C++,N[C]=0,C++,N[C]=0,C++,N[C]=0,C++,M(N,C,F(N,C-17,17)),C+=4,D.sRGB!=null&&(M(N,C,1),C+=4,S(N,C,"sRGB"),C+=4,N[C]=D.sRGB,C++,M(N,C,F(N,C-5,5)),C+=4),D.iCCP!=null){const K=13+I.length;M(N,C,K),C+=4,S(N,C,"iCCP"),C+=4,S(N,C,"ICC profile"),C+=11,C+=2,N.set(I,C),C+=I.length,M(N,C,F(N,C-(K+4),K+4)),C+=4}if(D.pHYs!=null&&(M(N,C,9),C+=4,S(N,C,"pHYs"),C+=4,M(N,C,D.pHYs[0]),C+=4,M(N,C,D.pHYs[1]),C+=4,N[C]=D.pHYs[2],C++,M(N,C,F(N,C-13,13)),C+=4),H&&(M(N,C,8),C+=4,S(N,C,"acTL"),C+=4,M(N,C,x.frames.length),C+=4,M(N,C,D.loop!=null?D.loop:0),C+=4,M(N,C,F(N,C-12,12)),C+=4),x.ctype==3){for(M(N,C,3*(j=x.plte.length)),C+=4,S(N,C,"PLTE"),C+=4,L=0;L<j;L++){const K=3*L,oe=x.plte[L],Z=255&oe,se=oe>>>8&255,le=oe>>>16&255;N[C+K+0]=Z,N[C+K+1]=se,N[C+K+2]=le}if(C+=3*j,M(N,C,F(N,C-3*j-4,3*j+4)),C+=4,U){for(M(N,C,j),C+=4,S(N,C,"tRNS"),C+=4,L=0;L<j;L++)N[C+L]=x.plte[L]>>>24&255;C+=j,M(N,C,F(N,C-j-4,j+4)),C+=4}}let G=0;for($=0;$<x.frames.length;$++){var q=x.frames[$];H&&(M(N,C,26),C+=4,S(N,C,"fcTL"),C+=4,M(N,C,G++),C+=4,M(N,C,q.rect.width),C+=4,M(N,C,q.rect.height),C+=4,M(N,C,q.rect.x),C+=4,M(N,C,q.rect.y),C+=4,z(N,C,P[$]),C+=2,z(N,C,1e3),C+=2,N[C]=q.dispose,C++,N[C]=q.blend,C++,M(N,C,F(N,C-30,30)),C+=4);const K=q.cimg;M(N,C,(j=K.length)+($==0?0:4)),C+=4;const oe=C;S(N,C,$==0?"IDAT":"fdAT"),C+=4,$!=0&&(M(N,C,G++),C+=4),N.set(K,C),C+=j,M(N,C,F(N,oe,C-oe)),C+=4}return M(N,C,0),C+=4,S(N,C,"IEND"),C+=4,M(N,C,F(N,C-4,4)),C+=4,N.buffer}function f(x,w,R){for(let P=0;P<x.frames.length;P++){const D=x.frames[P];D.rect.width;const F=D.rect.height,M=new Uint8Array(F*D.bpl+F);D.cimg=h(D.img,F,D.bpp,D.bpl,M,w,R)}}function l(x,w,R,P,D){const F=D[0],M=D[1],z=D[2],S=D[3],C=D[4],H=D[5];let I=6,U=8,Y=255;for(var j=0;j<x.length;j++){const ye=new Uint8Array(x[j]);for(var L=ye.length,$=0;$<L;$+=4)Y&=ye[$+3]}const N=Y!=255,B=(function(fe,ce,ve,Ce,me,_e){const Se=[];for(var ge=0;ge<fe.length;ge++){const je=new Uint8Array(fe[ge]),Oe=new Uint32Array(je.buffer);var Ie;let W=0,X=0,te=ce,de=ve,ke=Ce?1:0;if(ge!=0){const pe=_e||Ce||ge==1||Se[ge-2].dispose!=0?1:2;let Re=0,An=1e9;for(let lt=0;lt<pe;lt++){var Ge=new Uint8Array(fe[ge-1-lt]);const bc=new Uint32Array(fe[ge-1-lt]);let ct=ce,dt=ve,Ft=-1,sn=-1;for(let Ct=0;Ct<ve;Ct++)for(let St=0;St<ce;St++)Oe[Te=Ct*ce+St]!=bc[Te]&&(St<ct&&(ct=St),St>Ft&&(Ft=St),Ct<dt&&(dt=Ct),Ct>sn&&(sn=Ct));Ft==-1&&(ct=dt=Ft=sn=0),me&&((1&ct)==1&&ct--,(1&dt)==1&&dt--);const Vr=(Ft-ct+1)*(sn-dt+1);Vr<An&&(An=Vr,Re=lt,W=ct,X=dt,te=Ft-ct+1,de=sn-dt+1)}Ge=new Uint8Array(fe[ge-1-Re]),Re==1&&(Se[ge-1].dispose=2),Ie=new Uint8Array(te*de*4),e(Ge,ce,ve,Ie,te,de,-W,-X,0),ke=e(je,ce,ve,Ie,te,de,-W,-X,3)?1:0,ke==1?u(je,ce,ve,Ie,{x:W,y:X,width:te,height:de}):e(je,ce,ve,Ie,te,de,-W,-X,0)}else Ie=je.slice(0);Se.push({rect:{x:W,y:X,width:te,height:de},img:Ie,blend:ke,dispose:0})}if(Ce)for(ge=0;ge<Se.length;ge++){if((et=Se[ge]).blend==1)continue;const je=et.rect,Oe=Se[ge-1].rect,W=Math.min(je.x,Oe.x),X=Math.min(je.y,Oe.y),te={x:W,y:X,width:Math.max(je.x+je.width,Oe.x+Oe.width)-W,height:Math.max(je.y+je.height,Oe.y+Oe.height)-X};Se[ge-1].dispose=1,ge-1!=0&&c(fe,ce,ve,Se,ge-1,te,me),c(fe,ce,ve,Se,ge,te,me)}let Lt=0;if(fe.length!=1)for(var Te=0;Te<Se.length;Te++){var et;Lt+=(et=Se[Te]).rect.width*et.rect.height}return Se})(x,w,R,F,M,z),G={},q=[],K=[];if(P!=0){const ye=[];for($=0;$<B.length;$++)ye.push(B[$].img.buffer);const fe=(function(me){let _e=0;for(var Se=0;Se<me.length;Se++)_e+=me[Se].byteLength;const ge=new Uint8Array(_e);let Ie=0;for(Se=0;Se<me.length;Se++){const Ge=new Uint8Array(me[Se]),Lt=Ge.length;for(let Te=0;Te<Lt;Te+=4){let et=Ge[Te],je=Ge[Te+1],Oe=Ge[Te+2];const W=Ge[Te+3];W==0&&(et=je=Oe=0),ge[Ie+Te]=et,ge[Ie+Te+1]=je,ge[Ie+Te+2]=Oe,ge[Ie+Te+3]=W}Ie+=Lt}return ge.buffer})(ye),ce=b(fe,P);for($=0;$<ce.plte.length;$++)q.push(ce.plte[$].est.rgba);let ve=0;for($=0;$<B.length;$++){const Ce=(Z=B[$]).img.length;var oe=new Uint8Array(ce.inds.buffer,ve>>2,Ce>>2);K.push(oe);const me=new Uint8Array(ce.abuf,ve,Ce);H&&i(Z.img,Z.rect.width,Z.rect.height,q,me,oe),Z.img.set(me),ve+=Ce}}else for(j=0;j<B.length;j++){var Z=B[j];const ye=new Uint32Array(Z.img.buffer);var se=Z.rect.width;for(L=ye.length,oe=new Uint8Array(L),K.push(oe),$=0;$<L;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])oe[$]=oe[$-1];else if($>se&&fe==ye[$-se])oe[$]=oe[$-se];else{let ce=G[fe];if(ce==null&&(G[fe]=ce=q.length,q.push(fe),q.length>=300))break;oe[$]=ce}}}const le=q.length;for(le<=256&&C==0&&(U=le<=2?1:le<=4?2:le<=16?4:8,U=Math.max(U,S)),j=0;j<B.length;j++){(Z=B[j]).rect.x,Z.rect.y,se=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ce=4*se,ve=4;if(le<=256&&C==0){ce=Math.ceil(U*se/8);var be=new Uint8Array(ce*ye);const Ce=K[j];for(let me=0;me<ye;me++){$=me*ce;const _e=me*se;if(U==8)for(var ue=0;ue<se;ue++)be[$+ue]=Ce[_e+ue];else if(U==4)for(ue=0;ue<se;ue++)be[$+(ue>>1)]|=Ce[_e+ue]<<4-4*(1&ue);else if(U==2)for(ue=0;ue<se;ue++)be[$+(ue>>2)]|=Ce[_e+ue]<<6-2*(3&ue);else if(U==1)for(ue=0;ue<se;ue++)be[$+(ue>>3)]|=Ce[_e+ue]<<7-1*(7&ue)}fe=be,I=3,ve=1}else if(N==0&&B.length==1){be=new Uint8Array(se*ye*3);const Ce=se*ye;for($=0;$<Ce;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,I=2,ve=3,ce=3*se}Z.img=fe,Z.bpl=ce,Z.bpp=ve}return{ctype:I,depth:U,plte:q,frames:B}}function c(x,w,R,P,D,F,M){const z=Uint8Array,S=Uint32Array,C=new z(x[D-1]),H=new S(x[D-1]),I=D+1<x.length?new z(x[D+1]):null,U=new z(x[D]),Y=new S(U.buffer);let j=w,L=R,$=-1,N=-1;for(let G=0;G<F.height;G++)for(let q=0;q<F.width;q++){const K=F.x+q,oe=F.y+G,Z=oe*w+K,se=Y[Z];se==0||P[D-1].dispose==0&&H[Z]==se&&(I==null||I[4*Z+3]!=0)||(K<j&&(j=K),K>$&&($=K),oe<L&&(L=oe),oe>N&&(N=oe))}$==-1&&(j=L=$=N=0),M&&((1&j)==1&&j--,(1&L)==1&&L--),F={x:j,y:L,width:$-j+1,height:N-L+1};const B=P[D];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),P[D-1].dispose==0?(e(C,w,R,B.img,F.width,F.height,-F.x,-F.y,0),u(U,w,R,B.img,F)):e(U,w,R,B.img,F.width,F.height,-F.x,-F.y,0)}function u(x,w,R,P,D){e(x,w,R,P,D.width,D.height,-D.x,-D.y,2)}function h(x,w,R,P,D,F,M){const z=[];let S,C=[0,1,2,3,4];F!=-1?C=[F]:(w*P>5e5||R==1)&&(C=[0]),M&&(S={level:0});const H=zh;for(var I=0;I<C.length;I++){for(let j=0;j<w;j++)g(D,x,j,P,R,C[I]);z.push(H.deflate(D,S))}let U,Y=1e9;for(I=0;I<z.length;I++)z[I].length<Y&&(U=I,Y=z[I].length);return z[U]}function g(x,w,R,P,D,F){const M=R*P;let z=M+R;if(x[z]=F,z++,F==0)if(P<500)for(var S=0;S<P;S++)x[z+S]=w[M+S];else x.set(new Uint8Array(w.buffer,M,P),z);else if(F==1){for(S=0;S<D;S++)x[z+S]=w[M+S];for(S=D;S<P;S++)x[z+S]=w[M+S]-w[M+S-D]+256&255}else if(R==0){for(S=0;S<D;S++)x[z+S]=w[M+S];if(F==2)for(S=D;S<P;S++)x[z+S]=w[M+S];if(F==3)for(S=D;S<P;S++)x[z+S]=w[M+S]-(w[M+S-D]>>1)+256&255;if(F==4)for(S=D;S<P;S++)x[z+S]=w[M+S]-n(w[M+S-D],0,0)+256&255}else{if(F==2)for(S=0;S<P;S++)x[z+S]=w[M+S]+256-w[M+S-P]&255;if(F==3){for(S=0;S<D;S++)x[z+S]=w[M+S]+256-(w[M+S-P]>>1)&255;for(S=D;S<P;S++)x[z+S]=w[M+S]+256-(w[M+S-P]+w[M+S-D]>>1)&255}if(F==4){for(S=0;S<D;S++)x[z+S]=w[M+S]+256-n(0,w[M+S-P],0)&255;for(S=D;S<P;S++)x[z+S]=w[M+S]+256-n(w[M+S-D],w[M+S-P],w[M+S-D-P])&255}}}function b(x,w){const R=new Uint8Array(x),P=R.slice(0),D=new Uint32Array(P.buffer),F=y(P,w),M=F[0],z=F[1],S=R.length,C=new Uint8Array(S>>2);let H;if(R.length<2e7)for(var I=0;I<S;I+=4)H=v(M,U=R[I]*(1/255),Y=R[I+1]*(1/255),j=R[I+2]*(1/255),L=R[I+3]*(1/255)),C[I>>2]=H.ind,D[I>>2]=H.est.rgba;else for(I=0;I<S;I+=4){var U=R[I]*.00392156862745098,Y=R[I+1]*(1/255),j=R[I+2]*(1/255),L=R[I+3]*(1/255);for(H=M;H.left;)H=E(H.est,U,Y,j,L)<=0?H.left:H.right;C[I>>2]=H.ind,D[I>>2]=H.est.rgba}return{abuf:P.buffer,inds:C,plte:z}}function y(x,w,R){R==null&&(R=1e-4);const P=new Uint32Array(x.buffer),D={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};D.bst=O(x,D.i0,D.i1),D.est=k(D.bst);const F=[D];for(;F.length<w;){let z=0,S=0;for(var M=0;M<F.length;M++)F[M].est.L>z&&(z=F[M].est.L,S=M);if(z<R)break;const C=F[S],H=_(x,P,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=H||C.i1<=H){C.est.L=0;continue}const I={i0:C.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};I.bst=O(x,I.i0,I.i1),I.est=k(I.bst);const U={i0:H,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:C.bst.N-I.bst.N},M=0;M<16;M++)U.bst.R[M]=C.bst.R[M]-I.bst.R[M];for(M=0;M<4;M++)U.bst.m[M]=C.bst.m[M]-I.bst.m[M];U.est=k(U.bst),C.left=I,C.right=U,F[S]=I,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),M=0;M<F.length;M++)F[M].ind=M;return[D,F]}function v(x,w,R,P,D){if(x.left==null)return x.tdst=(function(I,U,Y,j,L){const $=U-I[0],N=Y-I[1],B=j-I[2],G=L-I[3];return $*$+N*N+B*B+G*G})(x.est.q,w,R,P,D),x;const F=E(x.est,w,R,P,D);let M=x.left,z=x.right;F>0&&(M=x.right,z=x.left);const S=v(M,w,R,P,D);if(S.tdst<=F*F)return S;const C=v(z,w,R,P,D);return C.tdst<S.tdst?C:S}function E(x,w,R,P,D){const{e:F}=x;return F[0]*w+F[1]*R+F[2]*P+F[3]*D-x.eMq}function _(x,w,R,P,D,F){for(P-=4;R<P;){for(;A(x,R,D)<=F;)R+=4;for(;A(x,P,D)>F;)P-=4;if(R>=P)break;const M=w[R>>2];w[R>>2]=w[P>>2],w[P>>2]=M,R+=4,P-=4}for(;A(x,R,D)>F;)R-=4;return R+4}function A(x,w,R){return x[w]*R[0]+x[w+1]*R[1]+x[w+2]*R[2]+x[w+3]*R[3]}function O(x,w,R){const P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D=[0,0,0,0],F=R-w>>2;for(let M=w;M<R;M+=4){const z=x[M]*.00392156862745098,S=x[M+1]*(1/255),C=x[M+2]*(1/255),H=x[M+3]*(1/255);D[0]+=z,D[1]+=S,D[2]+=C,D[3]+=H,P[0]+=z*z,P[1]+=z*S,P[2]+=z*C,P[3]+=z*H,P[5]+=S*S,P[6]+=S*C,P[7]+=S*H,P[10]+=C*C,P[11]+=C*H,P[15]+=H*H}return P[4]=P[1],P[8]=P[2],P[9]=P[6],P[12]=P[3],P[13]=P[7],P[14]=P[11],{R:P,m:D,N:F}}function k(x){const{R:w}=x,{m:R}=x,{N:P}=x,D=R[0],F=R[1],M=R[2],z=R[3],S=P==0?0:1/P,C=[w[0]-D*D*S,w[1]-D*F*S,w[2]-D*M*S,w[3]-D*z*S,w[4]-F*D*S,w[5]-F*F*S,w[6]-F*M*S,w[7]-F*z*S,w[8]-M*D*S,w[9]-M*F*S,w[10]-M*M*S,w[11]-M*z*S,w[12]-z*D*S,w[13]-z*F*S,w[14]-z*M*S,w[15]-z*z*S],H=C,I=T;let U=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,j=0;if(P!=0)for(let $=0;$<16&&(U=I.multVec(H,U),j=Math.sqrt(I.dot(U,U)),U=I.sml(1/j,U),!($!=0&&Math.abs(j-Y)<1e-9));$++)Y=j;const L=[D*S,F*S,M*S,z*S];return{Cov:C,q:L,e:U,L:Y,eMq255:I.dot(I.sml(255,L),U),eMq:I.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var T={multVec:(x,w)=>[x[0]*w[0]+x[1]*w[1]+x[2]*w[2]+x[3]*w[3],x[4]*w[0]+x[5]*w[1]+x[6]*w[2]+x[7]*w[3],x[8]*w[0]+x[9]*w[1]+x[10]*w[2]+x[11]*w[3],x[12]*w[0]+x[13]*w[1]+x[14]*w[2]+x[15]*w[3]],dot:(x,w)=>x[0]*w[0]+x[1]*w[1]+x[2]*w[2]+x[3]*w[3],sml:(x,w)=>[x*w[0],x*w[1],x*w[2],x*w[3]]};He.encode=function(w,R,P,D,F,M,z){D==null&&(D=0),z==null&&(z=!1);const S=l(w,R,P,D,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,R,P,F,M)},He.encodeLL=function(w,R,P,D,F,M,z,S){const C={ctype:0+(D==1?0:2)+(F==0?0:4),depth:M,frames:[]},H=(D+F)*M,I=H*R;for(let U=0;U<w.length;U++)C.frames.push({rect:{x:0,y:0,width:R,height:P},img:new Uint8Array(w[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(I/8)});return f(C,0,!0),m(C,R,P,z,S)},He.encode.compress=l,He.encode.dither=i,He.quantize=b,He.quantize.getKDtree=y,He.quantize.getNearest=v})();const Xi={toArrayBuffer(e,t){const n=e.width,r=e.height,s=n<<2,o=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(o.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),u=1<<20;let h,g,b,y,v=u,E=0,_=0,A=0;function O(x){c.setUint16(_,x,!0),_+=2}function k(x){c.setUint32(_,x,!0),_+=4}function T(x){_+=x}O(19778),k(f),T(4),k(122),k(108),k(n),k(-r>>>0),O(1),O(32),k(3),k(m),k(2835),k(2835),T(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;E<r&&v>0;){for(y=122+E*i,h=0;h<s;)v--,g=a[A++],b=g>>>24,c.setUint32(y+h,g<<8|b),h+=4;E++}A<a.length?(v=u,setTimeout(x,Xi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Le={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Hh={[Le.CHROME]:16384,[Le.FIREFOX]:11180,[Le.DESKTOP_SAFARI]:16384,[Le.IE]:8192,[Le.IOS]:4096,[Le.ETC]:8192};const Nr=typeof window<"u",Qi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Kn=Nr&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Bh=(Nr||Qi)&&(Kn&&Kn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Ji=(Nr||Qi)&&(Kn&&Kn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function jr(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],a=globalThis.atob(s[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:o});f.name=t,f.lastModified=n,r(f)}))}function Zi(e){return new Promise(((t,n)=>{const r=new Ji;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function el(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function _t(){if(_t.cachedResult!==void 0)return _t.cachedResult;let e=Le.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Le.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Le.IOS:/Safari/i.test(t)?e=Le.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Le.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Le.IE),_t.cachedResult=e,_t.cachedResult}function tl(e,t){const n=_t(),r=Hh[n];let s=e,o=t,a=s*o;const i=s>o?o/s:s/o;for(;a>r*r;){const m=(r+s)/2,f=(r+o)/2;m<f?(o=f,s=f*i):(o=m*i,s=m),a=s*o}return{width:s,height:o}}function ls(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function nl(e,t){const{width:n,height:r}=tl(e.width,e.height),[s,o]=ls(n,r);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,s.width,s.height)),o.drawImage(e,0,0,s.width,s.height),s}function On(){return On.cachedResult!==void 0||(On.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),On.cachedResult}function Yn(e,t={}){return new Promise((function(n,r){let s,o;var a=function(){try{return o=nl(s,t.fileType||e.type),n([s,o])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return Zi(e).then((function(c){try{return l=c,el(l).then((function(u){try{return s=u,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(On()||[Le.DESKTOP_SAFARI,Le.MOBILE_SAFARI].includes(_t()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return s=m,a()}catch{return i()}}),i)}catch{i()}}))}function Xn(e,t,n,r,s=1){return new Promise((function(o,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=He.encode([l.buffer],e.width,e.height,4096*s),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Xi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(u){return a(u)}}).bind(this),a);{let c;return c=e.toDataURL(t,s),jr(c,n,r).then((function(u){try{return i=u,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return o(i)}}))}function Ye(e){e.width=0,e.height=0}function Bt(){return new Promise((function(e,t){let n,r,s,o;return Bt.cachedResult!==void 0?e(Bt.cachedResult):jr("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Yn(n).then((function(i){try{return r=i[1],Xn(r,n.type,n.name,n.lastModified).then((function(m){try{return s=m,Ye(r),Yn(s).then((function(f){try{return o=f[0],Bt.cachedResult=o.width===1&&o.height===2,e(Bt.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function sl(e){return new Promise(((t,n)=>{const r=new Ji;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const a=o.byteLength;let i=2;for(;i<a;){if(o.getUint16(i+2,!1)<=8)return t(-1);const m=o.getUint16(i,!1);if(i+=2,m==65505){if(o.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=o.getUint16(i+=6,!1)==18761;i+=o.getUint32(i+4,f);const l=o.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(o.getUint16(i+12*c,f)==274)return t(o.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=o.getUint16(i,!1)}}return t(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(e)}))}function rl(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,a=e;return isFinite(s)&&(n>s||r>s)&&([a,o]=ls(n,r),n>r?(a.width=s,a.height=r/n*s):(a.width=n/r*s,a.height=s),o.drawImage(e,0,0,a.width,a.height),Ye(e)),a}function ol(e,t){const{width:n}=e,{height:r}=e,[s,o]=ls(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Ye(e),s}function To(e,t,n=0){return new Promise((function(r,s){let o,a,i,m,f,l,c,u,h,g,b,y,v,E,_,A,O,k,T,x;function w(P=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=P,t.onProgress(Math.min(o,100))}function R(P){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(P,o),100),t.onProgress(o)}return o=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,w(),Yn(e,t).then((function(P){try{return[,m]=P,w(),f=rl(m,t),w(),new Promise((function(D,F){var M;if(!(M=t.exifOrientation))return sl(e).then((function(S){try{return M=S,z.call(this)}catch(C){return F(C)}}).bind(this),F);function z(){return D(M)}return z.call(this)})).then((function(D){try{return l=D,w(),Bt().then((function(F){try{return c=F?f:ol(f,l),w(),u=t.initialQuality||1,h=t.fileType||e.type,Xn(c,h,e.name,e.lastModified,u).then((function(M){try{{let S=function(){if(a--&&(_>i||_>v)){let H,I;return H=x?.95*T.width:T.width,I=x?.95*T.height:T.height,[O,k]=ls(H,I),k.drawImage(T,0,0,H,I),u*=h==="image/png"?.85:.95,Xn(O,h,e.name,e.lastModified,u).then((function(U){try{return A=U,Ye(T),T=O,_=A.size,R(Math.min(99,Math.floor((E-_)/(E-i)*100))),S}catch(Y){return s(Y)}}),s)}return[1]},C=function(){return Ye(T),Ye(O),Ye(f),Ye(c),Ye(m),R(100),r(A)};if(g=M,w(),b=g.size>i,y=g.size>e.size,!b&&!y)return R(100),r(g);var z;return v=e.size,E=g.size,_=E,T=c,x=!t.alwaysKeepResolution&&b,(z=(function(H){for(;H;){if(H.then)return void H.then(z,s);try{if(H.pop){if(H.length)return H.pop()?C.call(this):H;H=S}else H=H.call(this)}catch(I){return s(I)}}}).bind(this))(S)}}catch(S){return s(S)}}).bind(this),s)}catch(M){return s(M)}}).bind(this),s)}catch(F){return s(F)}}).bind(this),s)}catch(D){return s(D)}}).bind(this),s)}))}const Wh=`
|
|
213
|
+
- Risks…`,"cmd.desc.compact":"Compact the context","cmd.desc.cost":"View session cost","cmd.desc.summary":"Generate a session summary","cmd.desc.files":"List files tracked by the session","cmd.desc.clear":"Clear the conversation","cmd.desc.new":"Start a new session","cmd.desc.help":"Show this help","cmd.desc.status":"Show session status","cmd.desc.model":"View or switch models","cmd.desc.copy":"Copy the last assistant message","cmd.desc.resume":"Resume a past conversation into this session","cmd.hint.modelId":"[id]","cmd.hint.sessionId":"[session id]","cmd.desc.agentFallback":"agent command","cmd.subtitle.help":"Available commands","cmd.subtitle.status":"Session status","cmd.subtitle.model":"View or switch models","cmd.subtitle.copy":"Copy the assistant message to the clipboard","cmd.subtitle.resume":"Pick and resume a past conversation","cmd.help.localHeader":"**Local commands** (executed by the Web UI)","cmd.help.agentHeader":"**Agent commands** (sent to the Saluzi agent)","cmd.status.header":"**Session status**","cmd.status.sessionId":"Session ID","cmd.status.none":"none","cmd.status.currentModel":"Current model","cmd.status.unset":"not set","cmd.status.modelCount":"Available models","cmd.status.imageSupport":"Image support","cmd.status.yes":"yes","cmd.status.no":"no","cmd.status.messageCount":"Messages","cmd.model.none":"The agent does not expose model selection.","cmd.model.available":"**Available models**","cmd.model.hint":"Use `/model <id>` to switch models.","cmd.model.switched":"Requested switch to model: `{id}`","cmd.model.switchFailed":"Failed to switch model: {message}","cmd.copy.failed":"Copy failed: clipboard unavailable","cmd.copy.copied":"Copied {n} characters to the clipboard","cmd.copy.nothing":"No assistant message to copy","notify.permission.title":"Approval needed","notify.permission.body":"{session} — the agent is waiting for approval","notify.turnComplete.title":"Turn complete","notify.turnComplete.body":"{session} — the agent finished the current turn","adapter.workerCrashed":"Worker process exited unexpectedly","adapter.stopTimeout":"Stop request timed out","adapter.stopFailed":"Stop request failed","adapter.requestTimeout":"Request timed out","attach.emptyFile":"(empty file)","attach.emptyDirectory":"(empty directory)","attach.directoryHeader":"📁 Directory: {name}","attach.fileCount":"({n} files)","attach.readFailed":"(failed to read)","attach.tooLarge":"(file too large, skipped)","attach.imageFile":"(image file, {size})","attach.binaryFile":"(binary file, {size})","attach.dumpHeader":"# Directory: {name}","attach.dumpCount":"{n} files total","attach.structure":"## File structure","attach.contents":"## File contents","acp.sessions":"Sessions","acp.newSession":"New session","acp.confirmDelete":'Delete session "{label}"? This cannot be undone.',"acp.emptySessions":"No sessions","acp.historyNav":"Session history","acp.confirm":"Confirm","acp.noSessionManagement":"This agent does not support session management (rename/delete)","acp.rename":"Rename","acp.renameUnsupported":"This agent does not support session rename","acp.delete":"Delete","acp.deleteUnsupported":"This agent does not support session deletion","acp.mode.default":"Default","acp.mode.defaultDesc":"Approve permission requests manually","acp.mode.acceptEdits":"Auto-accept edits","acp.mode.acceptEditsDesc":"Automatically allow file edits","acp.mode.bypass":"Bypass permissions","acp.mode.bypassDesc":"Skip all permission checks","acp.mode.plan":"Plan mode","acp.mode.planDesc":"Plan only — no tool execution","acp.mode.dontAsk":"Don’t ask","acp.mode.dontAskDesc":"No prompts — reject automatically","acp.mode.auto":"Auto decide","acp.mode.autoDesc":"The AI decides whether to approve","acp.emptyDescription":"Type a message to start chatting with the ACP agent","acp.inputPlaceholder":"Message Saluzi…","acp.waitingPlaceholder":"Waiting for session...","chat.fileMatchHint":"File matches {query} — ↑↓ to select, Enter to insert","chat.picker.image":"Images","chat.picker.textFile":"Text files","chat.picker.sheet":"Spreadsheets","chat.picker.directory":"Directories","chat.commandList":"Command list","chat.processingFile":"Processing files…","chat.queued":"{n} messages queued — sent automatically when the turn completes","chat.queuedCancel":" (click to cancel all)","chat.inputHint":"Enter to send, Shift+Enter for a new line","chat.inputHintSuffix":", / for commands, @ completes file paths","chat.fileCount":"{n} files","chat.directory":"Directory","chat.noCommands":"No matching commands","chat.cmdDone":"Command executed · type a message to continue","plan.title":"Plan","plan.priority.high":"High","plan.priority.medium":"Medium","plan.priority.low":"Low","tool.newFile":"New file","tool.callTimes":"{name} ×{n}","tool.summaryCalls":"{n} tool calls","tool.summaryTools":"{n} tools: {names}","usage.context":"Context: {used} / {size} tokens","usage.totalCost":"Total cost: {cost}","diff.aria":"Diff preview for {path}, {added} additions, {removed} deletions","diff.hidden":"… {n} more lines hidden","diff.addedLine":"Added line: {text}","diff.removedLine":"Removed line: {text}","common.emptyTitle":"No messages yet","common.emptyDescription":"Start a conversation to see messages here","message.rewindHere":"Rewind here (conversation and files)","message.rewindEdit":"Rewind and edit this message","message.expand":"Expand"},Wi="rcs_locale";function vh(){try{const t=localStorage.getItem(Wi);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Rr=vh();const Ws=new Set;function Yb(e){Rr=e;try{localStorage.setItem(Wi,e)}catch{}Ws.forEach(t=>t())}function bh(e){return Ws.add(e),()=>{Ws.delete(e)}}function tn(){return p.useSyncExternalStore(bh,()=>Rr)}function V(e){return Rr==="en"?xh[e]??Eo[e]??e:Eo[e]??e}function we(e,t){let n=V(e);for(const[r,s]of Object.entries(t))n=n.split(`{${r}}`).join(String(s));return n}function yh({className:e}){return d.jsx("svg",{viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:e,children:d.jsx("path",{d:"M7.8 1.6H12.2L12.4 7.6L18.4 7.8V12.2L12.4 12.4L12.2 18.4H7.8L7.6 12.4L1.6 12.2V7.8L7.6 7.6ZM10 7.4L12.6 10L10 12.6L7.4 10Z",fill:"currentColor",fillRule:"evenodd"})})}const wh="";let Gn=null;function Ch(e){Gn=e}function Xb(){return Gn}let Vs=null;function _o(e){Vs=e}let on=null;async function Sh(){return on||(on=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{on=null}})(),on)}class As extends Error{constructor(n,r,s){super(n);re(this,"type");re(this,"status");this.name="ApiError",this.type=r,this.status=s}}async function he(e,t,n,r){const s={"Content-Type":"application/json"};Gn&&(s.Authorization=`Bearer ${Gn}`);const o=`${wh}${t}`,a={method:e,headers:s,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(o,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!r&&await Sh())return he(e,t,n,!0);Vs&&Vs()}let m;try{m=await i.json()}catch{throw i.ok?new As("Invalid JSON response","parse_error",i.status):new As(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new As(c,l,i.status)}return m}function Qb(){return he("GET","/web/sessions")}function Jb(){return he("GET","/web/sessions/all")}function Zb(e){return he("GET",`/web/sessions/${e}`)}function ey(e){return he("GET",`/web/sessions/${e}/history`)}function ty(e){return he("GET",`/web/sessions/${e}/models`)}function ny(){return he("GET","/web/environments")}function sy(e,t=20){const n=encodeURIComponent(e);return he("GET",`/web/search?q=${n}&limit=${t}`)}function ry(e,t){return he("POST",`/web/sessions/${e}/events`,t)}function oy(e,t){return he("POST",`/web/sessions/${e}/rewind`,{target_event_id:t})}function ay(e,t){return he("POST",`/web/sessions/${e}/control`,t)}function iy(e){return he("POST",`/web/sessions/${e}/interrupt`)}function ly(e){return he("DELETE",`/web/sessions/${e}`)}function cy(e){return he("POST",`/web/sessions/${e}/clear`)}function dy(e,t){return he("PATCH",`/web/sessions/${e}`,{title:t})}function uy(e){return he("POST","/web/sessions",e)}function fy(e){return he("GET",`/web/sessions/s/${e}`)}function my(e){return he("GET",`/web/sessions/${e}/shares`)}function py(e,t){return he("POST",`/web/sessions/${e}/shares`,t)}function hy(e,t){return he("DELETE",`/web/sessions/${e}/shares/${t}`)}function gy(e,t){return he("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function xy(e,t){return he("DELETE",`/web/teams/${e}/environments/${t}`)}function vy(e){return he("POST","/web/environments/claim",{claim_token:e})}function by(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return he("GET",`/web/artifacts${r}`)}function yy(e){return he("GET",`/web/artifacts/${e}`)}function wy(e){return he("POST","/web/artifacts",e)}function Cy(e){return he("DELETE",`/web/artifacts/${e}`)}const Gs="rcs_active_team";function kh(){try{return localStorage.getItem(Gs)}catch{return null}}let Vi=kh();const qs=new Set;function Ah(){for(const e of qs)e()}function Eh(e){return qs.add(e),()=>qs.delete(e)}function _h(){return Vi}function Et(e){try{e?localStorage.setItem(Gs,e):localStorage.removeItem(Gs)}catch{}Vi=e,Ah()}let Mn=null;function Th(){return Mn||(Mn=he("GET","/web/teams").finally(()=>{Mn=null})),Mn}function Rh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),s=p.useSyncExternalStore(Eh,_h,()=>null),o=p.useCallback(async()=>{r(!0);try{const f=await Th();t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{o()},[o]);const a=e.find(f=>f.id===s)||null,i=p.useCallback(f=>{Et(f)},[]),m=p.useCallback(async f=>{const l=await he("POST","/web/teams",f);return await o(),l},[o]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:o}}function Nh({className:e}){tn();const{myTeams:t,activeTeam:n,switchTeam:r,isLoading:s}=Rh();return s||t.length===0?null:d.jsxs("div",{className:ee("relative",e),children:[d.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:o=>{const a=o.target.value;r(a||null)},children:[d.jsx("option",{value:"",children:V("team.switcher.personal")}),t.map(o=>d.jsx("option",{value:o.id,children:o.name},o.id))]}),d.jsx(Qt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Gi=p.createContext(null);function qi(){const e=p.useContext(Gi);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Ut(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function jh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function Mh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function In(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Ih({children:e}){const[t,n]=p.useState(null),[r,s]=p.useState(!0),[o,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let y=!1;return Ut().then(v=>{y||(n(v),s(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{y||a(v.allowed===!0)}).catch(()=>{}),Mh().then(v=>{y||m(v)}),_o(()=>{n(null),Et(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{y=!0,_o(null)}},[]);const f=p.useCallback(async(y,v)=>{const E=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!E.ok){const k=await In(E);throw new Error(k.error||"Login failed")}const _=await Ut();n(_),Et(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Et(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Ut();return n(v),!0}catch{return!1}},[]),u=p.useCallback(async(y,v,E)=>{const _=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:y,username:v,password:E})});if(!_.ok){const L=await In(_);throw new Error(L.error||"Setup failed")}const k=await Ut();n(k),Et(null)},[]),h=p.useCallback(async(y,v,E)=>{const _=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:y,username:v,password:E})});if(!_.ok){const L=await In(_);throw new Error(L.error||"Join failed")}const k=await Ut();n(k),Et(null)},[]),x=p.useCallback(async(y,v)=>{const E=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:y,password:v})});if(!E.ok){const k=await In(E);throw new Error(k.error||"Registration failed")}const _=await Ut();n(_),Et(null)},[]),b=p.useCallback(async()=>jh(),[]);return d.jsx(Gi.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:u,join:h,register:x,checkSetupStatus:b,registrationAllowed:o,singleUserMode:i},children:e})}function Ph({onSettingsClick:e}){const{user:t,logout:n}=qi();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return d.jsxs(zi,{children:[d.jsx(Hi,{asChild:!0,children:d.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[d.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand-text",children:d.jsx(Ca,{className:"h-3.5 w-3.5"})}),d.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),d.jsxs(Bi,{align:"end",className:"w-48",children:[d.jsx(ph,{children:d.jsxs("div",{className:"flex flex-col space-y-0.5",children:[d.jsx("span",{className:"text-sm font-medium",children:t.username}),d.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),d.jsx(Ao,{}),d.jsxs(Dn,{onClick:e,children:[d.jsx(pu,{className:"mr-2 h-4 w-4"}),V("user.menu.settings")]}),d.jsxs(Dn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[d.jsx(Tu,{className:"mr-2 h-4 w-4"}),V("team.menu.myTeams")]}),d.jsx(Ao,{}),d.jsxs(Dn,{onClick:r,children:[d.jsx(Yd,{className:"mr-2 h-4 w-4"}),V("user.menu.logout")]})]})]})}function Dh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:s}){return tn(),d.jsx("nav",{className:"sticky top-0 z-40 border-b border-nav-rule bg-surface-1/80 backdrop-blur-md",children:d.jsxs("div",{className:e?"mx-auto page-measure flex h-11 sm:h-12 items-center justify-between px-4 sm:px-8":"ds-nav-bleed flex h-11 sm:h-12 items-center justify-between",children:[d.jsxs("div",{className:"ds-nav-brand flex items-center gap-2 min-w-0",children:[!e&&d.jsx(Nh,{}),e?d.jsxs(d.Fragment,{children:[d.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[d.jsx(jd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.dashboard")})]}),d.jsx("span",{className:"text-text-muted/40",children:"/"}),d.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&d.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand-text flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):d.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[d.jsx(yh,{className:"h-5 w-5 flex-shrink-0 text-brand"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.remoteControl")})]})]}),d.jsxs("div",{className:"ds-nav-actions flex items-center gap-0.5 sm:gap-1",children:[!e&&d.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:V("nav.dashboard"),children:[d.jsx(Gd,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("nav.dashboard")})]}),s&&d.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("artifacts.title"),children:[d.jsx(Ud,{className:"h-4 w-4"}),d.jsx("span",{className:"hidden sm:inline",children:V("artifacts.title")})]}),d.jsx(gh,{}),d.jsx(Ph,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}const Oh={running:{pill:"bg-status-running/15 text-status-running font-medium",dot:"bg-status-running pulse-dot"},active:{pill:"bg-status-active/15 text-status-active",dot:"bg-status-active"},idle:{pill:"bg-surface-2 text-text-muted"},requires_action:{pill:"bg-status-warning/15 text-status-warning",dot:"bg-status-warning"},error:{pill:"bg-status-error/15 text-status-error",dot:"bg-status-error"},inactive:{pill:"bg-surface-3 text-text-muted"},archived:{pill:"bg-surface-3 text-text-muted"}};function Sy({status:e}){const t=Oh[e];return d.jsxs("span",{className:ee("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs",t?t.pill:"bg-surface-3 text-text-secondary"),children:[(t==null?void 0:t.dot)&&d.jsx("span",{className:ee("h-1.5 w-1.5 rounded-full",t.dot)}),e]})}function Lh(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Ki extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const pt=class pt{constructor(t){re(this,"ws",null);re(this,"settings");re(this,"connectionState","disconnected");re(this,"sessionId",null);re(this,"_agentCapabilities",null);re(this,"_promptCapabilities",null);re(this,"_modelState",null);re(this,"_availableCommands",[]);re(this,"_usage",null);re(this,"_currentModeId",null);re(this,"_configOptions",[]);re(this,"onModelChanged",new Set);re(this,"onModelStateChanged",new Set);re(this,"onUsageChanged",new Set);re(this,"onCurrentModeChanged",new Set);re(this,"onConfigOptionsChanged",new Set);re(this,"onAvailableCommandsChanged",null);re(this,"onSessionLoaded",null);re(this,"onSessionSwitching",null);re(this,"onConnectionStateChange",new Set);re(this,"onSessionUpdate",null);re(this,"onSessionCreated",null);re(this,"onPromptComplete",null);re(this,"onPermissionRequest",null);re(this,"onBrowserToolCall",null);re(this,"onErrorMessage",null);re(this,"onSessionDeleted",null);re(this,"onSessionRenamed",null);re(this,"pendingSessionList",null);re(this,"pendingSessionLoad",null);re(this,"pendingSessionResume",null);re(this,"pendingSessionTarget",null);re(this,"connectResolve",null);re(this,"connectReject",null);re(this,"heartbeatInterval",null);re(this,"heartbeatTimeout",null);re(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.resume)!==null}get supportsSessionList(){var t,n,r,s;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((s=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:s.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Lh(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=s=>{if(this.ws===r)try{const o=JSON.parse(s.data);this.handleResponse(o)}catch(o){console.error("[ACPClient] Failed to parse message:",o)}},r.onerror=()=>{var s;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(s=this.connectReject)==null||s.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=s=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",s.code,s.reason),this.connectReject){const o=s.reason||`Connection closed (code: ${s.code})`;this.setState("error",o),this.connectReject(new Error(o)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,s,o,a,i,m,f,l,c,u,h,x;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const b=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(b)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(b)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(b)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(b)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",b),(s=this.onErrorMessage)==null||s.call(this,b));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(o=this.onSessionCreated)==null||o.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const v of this.onModelStateChanged)v(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const y=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",y,"payload:",t.payload),y==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(y==="usage_update"){this._usage=t.payload.update;for(const v of this.onUsageChanged)v(this._usage)}else if(y==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const v of this.onCurrentModeChanged)v(this._currentModeId)}else if(y==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const v of this.onConfigOptionsChanged)v(this._configOptions)}(u=this.onSessionUpdate)==null||u.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(x=this.onPermissionRequest)==null||x.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const v of this.onModelChanged)v(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=pt.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},pt.PONG_TIMEOUT_MS)},pt.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const s=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:s};try{this.send({type:"list_sessions",payload:t})}catch(o){clearTimeout(s),this.pendingSessionList=null,r(o)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:s};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var o;this.pendingSessionTarget=t.sessionId,(o=this.onSessionSwitching)==null||o.call(this,t.sessionId);const s=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:s};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(s),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Ki),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};re(pt,"HEARTBEAT_INTERVAL_MS",3e4),re(pt,"PONG_TIMEOUT_MS",1e4),re(pt,"MAX_MISSED_PONGS",2);let Ks=pt;function Fh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var s=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,s.get?s:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Yi(e,t){return new Promise((function(n,r){let s;return $h(e).then((function(o){try{return s=o,n(new Blob([t.slice(0,2),s,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const $h=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:s}})=>{const o=new DataView(s);let a=0;if(o.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=o.getUint16(a);if(i===65498)break;const m=o.getUint16(a+2);if(i===65505&&o.getUint32(a+4)===1165519206){const f=a+10;let l;switch(o.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(o.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=o.getUint32(f+4,l),u=f+c+2+12*o.getUint16(f+c,l);for(let h=f+c+2;h<u;h+=12)if(o.getUint16(h,l)==274){if(o.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(o.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");o.setUint16(h+8,1,l);break}return t(s.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var qn={},Uh={get exports(){return qn},set exports(e){qn=e}};(function(e){var t,n,r={};Uh.exports=r,r.parse=function(s,o){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(s),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var u=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),x=i(l,m+=4);m+=4,m=x;for(var b=0;b<u;b++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var y=i(l,m+=4),v=a(l,m+=4),E=a(l,m+2),_=a(l,m+4);m+=6;var k=i(l,m+=8);m+=4,m+=v+E+_,r._readLocal(l,k,f,h,y,o)}return f},r._readLocal=function(s,o,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(s,o),l(s,o+=4),l(s,o+=2);var u=l(s,o+=2);c(s,o+=2),c(s,o+=4),o+=4;var h=l(s,o+=8),x=l(s,o+=2);o+=2;var b=r.bin.readUTF8(s,o,h);if(o+=h,o+=x,f)a[b]={size:m,csize:i};else{var y=new Uint8Array(s.buffer,o);if(u==0)a[b]=new Uint8Array(y.buffer.slice(o,o+i));else{if(u!=8)throw"unknown compression method: "+u;var v=new Uint8Array(m);r.inflateRaw(y,v),a[b]=v}}},r.inflateRaw=function(s,o){return r.F.inflate(s,o)},r.inflate=function(s,o){return s[0],s[1],r.inflateRaw(new Uint8Array(s.buffer,s.byteOffset+2,s.length-6),o)},r.deflate=function(s,o){o==null&&(o={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*s.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(s,i,a,o.level);var m=r.adler(s,0,s.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(s,o){o==null&&(o={level:6});var a=new Uint8Array(50+Math.floor(1.1*s.length)),i=r.F.deflateRaw(s,a,i,o.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(s,o){o==null&&(o=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in s){var c=!r._noNeed(l)&&!o,u=s[l],h=r.crc.crc(u,0,u.length);f[l]={cpr:c,usize:u.length,crc:h,file:c?r.deflateRaw(u):u}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var x=new Uint8Array(a),b=0,y=[];for(var l in f){var v=f[l];y.push(b),b=r._writeHeader(x,b,l,v,0)}var E=0,_=b;for(var l in f)v=f[l],y.push(b),b=r._writeHeader(x,b,l,v,1,y[E++]);var k=b-_;return i(x,b,101010256),b+=4,m(x,b+=4,E),m(x,b+=2,E),i(x,b+=2,k),i(x,b+=4,_),b+=4,b+=2,x.buffer},r._noNeed=function(s){var o=s.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(o)!=-1},r._writeHeader=function(s,o,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,u=i.file;return l(s,o,m==0?67324752:33639248),o+=4,m==1&&(o+=2),c(s,o,20),c(s,o+=2,0),c(s,o+=2,i.cpr?8:0),l(s,o+=2,0),l(s,o+=4,i.crc),l(s,o+=4,u.length),l(s,o+=4,i.usize),c(s,o+=4,r.bin.sizeUTF8(a)),c(s,o+=2,0),o+=2,m==1&&(o+=2,o+=2,l(s,o+=6,f),o+=4),o+=r.bin.writeUTF8(s,o,a),m==0&&(s.set(u,o),o+=u.length),o},r.crc={table:(function(){for(var s=new Uint32Array(256),o=0;o<256;o++){for(var a=o,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;s[o]=a}return s})(),update:function(s,o,a,i){for(var m=0;m<i;m++)s=r.crc.table[255&(s^o[a+m])]^s>>>8;return s},crc:function(s,o,a){return 4294967295^r.crc.update(4294967295,s,o,a)}},r.adler=function(s,o,a){for(var i=1,m=0,f=o,l=o+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=s[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(s,o){return s[o]|s[o+1]<<8},writeUshort:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255},readUint:function(s,o){return 16777216*s[o+3]+(s[o+2]<<16|s[o+1]<<8|s[o])},writeUint:function(s,o,a){s[o]=255&a,s[o+1]=a>>8&255,s[o+2]=a>>16&255,s[o+3]=a>>24&255},readASCII:function(s,o,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(s[o+m]);return i},writeASCII:function(s,o,a){for(var i=0;i<a.length;i++)s[o+i]=a.charCodeAt(i)},pad:function(s){return s.length<2?"0"+s:s},readUTF8:function(s,o,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(s[o+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(s,o,a)}return i},writeUTF8:function(s,o,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)s[o+m]=l,m++;else if((4294965248&l)==0)s[o+m]=192|l>>6,s[o+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)s[o+m]=224|l>>12,s[o+m+1]=128|l>>6&63,s[o+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";s[o+m]=240|l>>18,s[o+m+1]=128|l>>12&63,s[o+m+2]=128|l>>6&63,s[o+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(s){for(var o=s.length,a=0,i=0;i<o;i++){var m=s.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(s,o,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,u=0,h=a<<3,x=0,b=s.length;if(i==0){for(;u<b;)c(o,h,u+(P=Math.min(65535,b-u))==b?1:0),h=r.F._copyExact(s,u,P,o,h+8),u+=P;return h>>>3}var y=f.lits,v=f.strt,E=f.prev,_=0,k=0,L=0,A=0,T=0,g=0;for(b>2&&(v[g=r.F._hash(s,0)]=0),u=0;u<b;u++){if(T=g,u+1<b-2){g=r.F._hash(s,u+1);var w=u+1&32767;E[w]=v[g],v[g]=w}if(x<=u){(_>14e3||k>26697)&&b-u>100&&(x<u&&(y[_]=u-x,_+=2,x=u),h=r.F._writeBlock(u==b-1||x==b?1:0,y,_,A,s,L,u-L,o,h),_=k=A=0,L=u);var N=0;u<b-2&&(N=r.F._bestMatch(s,u,E,T,Math.min(m[2],b-u),m[3]));var P=N>>>16,D=65535&N;if(N!=0){D=65535&N;var F=l(P=N>>>16,f.of0);f.lhst[257+F]++;var j=l(D,f.df0);f.dhst[j]++,A+=f.exb[F]+f.dxb[j],y[_]=P<<23|u-x,y[_+1]=D<<16|F<<8|j,_+=2,x=u+P}else f.lhst[s[u]]++;k++}}for(L==u&&s.length!=0||(x<u&&(y[_]=u-x,_+=2,x=u),h=r.F._writeBlock(1,y,_,A,s,L,u-L,o,h),_=0,k=0,_=k=A=0,L=u);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(s,o,a,i,m,f){var l=32767&o,c=a[l],u=l-c+32768&32767;if(c==l||i!=r.F._hash(s,o-u))return 0;for(var h=0,x=0,b=Math.min(32767,o);u<=b&&--f!=0&&c!=l;){if(h==0||s[o+h]==s[o+h-u]){var y=r.F._howLong(s,o,u);if(y>h){if(x=u,(h=y)>=m)break;u+2<y&&(y=u+2);for(var v=0,E=0;E<y-2;E++){var _=o-u+E+32768&32767,k=_-a[_]+32768&32767;k>v&&(v=k,c=_)}}}u+=(l=c)-(c=a[l])+32768&32767}return h<<16|x},r.F._howLong=function(s,o,a){if(s[o]!=s[o-a]||s[o+1]!=s[o+1-a]||s[o+2]!=s[o+2-a])return 0;var i=o,m=Math.min(s.length,o+258);for(o+=3;o<m&&s[o]==s[o-a];)o++;return o-i},r.F._hash=function(s,o){return(s[o]<<8|s[o+1])+(s[o+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(s,o,a,i,m,f,l,c,u){var h,x,b,y,v,E,_,k,L,A=r.F.U,T=r.F._putsF,g=r.F._putsE;A.lhst[256]++,x=(h=r.F.getTrees())[0],b=h[1],y=h[2],v=h[3],E=h[4],_=h[5],k=h[6],L=h[7];var w=32+((u+3&7)==0?0:8-(u+3&7))+(l<<3),N=i+r.F.contSize(A.fltree,A.lhst)+r.F.contSize(A.fdtree,A.dhst),P=i+r.F.contSize(A.ltree,A.lhst)+r.F.contSize(A.dtree,A.dhst);P+=14+3*_+r.F.contSize(A.itree,A.ihst)+(2*A.ihst[16]+3*A.ihst[17]+7*A.ihst[18]);for(var D=0;D<286;D++)A.lhst[D]=0;for(D=0;D<30;D++)A.dhst[D]=0;for(D=0;D<19;D++)A.ihst[D]=0;var F=w<N&&w<P?0:N<P?1:2;if(T(c,u,s),T(c,u+1,F),u+=3,F==0){for(;(7&u)!=0;)u++;u=r.F._copyExact(m,f,l,c,u)}else{var j,z;if(F==1&&(j=A.fltree,z=A.fdtree),F==2){r.F.makeCodes(A.ltree,x),r.F.revCodes(A.ltree,x),r.F.makeCodes(A.dtree,b),r.F.revCodes(A.dtree,b),r.F.makeCodes(A.itree,y),r.F.revCodes(A.itree,y),j=A.ltree,z=A.dtree,g(c,u,v-257),g(c,u+=5,E-1),g(c,u+=5,_-4),u+=4;for(var S=0;S<_;S++)g(c,u+3*S,A.itree[1+(A.ordr[S]<<1)]);u+=3*_,u=r.F._codeTiny(k,A.itree,c,u),u=r.F._codeTiny(L,A.itree,c,u)}for(var C=f,H=0;H<a;H+=2){for(var I=o[H],U=I>>>23,Y=C+(8388607&I);C<Y;)u=r.F._writeLit(m[C++],j,c,u);if(U!=0){var M=o[H+1],O=M>>16,$=M>>8&255,R=255&M;g(c,u=r.F._writeLit(257+$,j,c,u),U-A.of0[$]),u+=A.exb[$],T(c,u=r.F._writeLit(R,z,c,u),O-A.df0[R]),u+=A.dxb[R],C+=U}}u=r.F._writeLit(256,j,c,u)}return u},r.F._copyExact=function(s,o,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(s.buffer,o,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var s=r.F.U,o=r.F._hufTree(s.lhst,s.ltree,15),a=r.F._hufTree(s.dhst,s.dtree,15),i=[],m=r.F._lenCodes(s.ltree,i),f=[],l=r.F._lenCodes(s.dtree,f),c=0;c<i.length;c+=2)s.ihst[i[c]]++;for(c=0;c<f.length;c+=2)s.ihst[f[c]]++;for(var u=r.F._hufTree(s.ihst,s.itree,7),h=19;h>4&&s.itree[1+(s.ordr[h-1]<<1)]==0;)h--;return[o,a,u,m,l,h,i,f]},r.F.getSecond=function(s){for(var o=[],a=0;a<s.length;a+=2)o.push(s[a+1]);return o},r.F.nonZero=function(s){for(var o="",a=0;a<s.length;a+=2)s[a+1]!=0&&(o+=(a>>1)+",");return o},r.F.contSize=function(s,o){for(var a=0,i=0;i<o.length;i++)a+=o[i]*s[1+(i<<1)];return a},r.F._codeTiny=function(s,o,a,i){for(var m=0;m<s.length;m+=2){var f=s[m],l=s[m+1];i=r.F._writeLit(f,o,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(s,o){for(var a=s.length;a!=2&&s[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=s[i+1],f=i+3<a?s[i+3]:-1,l=i+5<a?s[i+5]:-1,c=i==0?-1:s[i-1];if(m==0&&f==m&&l==m){for(var u=i+5;u+2<a&&s[u+2]==m;)u+=2;(h=Math.min(u+1-i>>>1,138))<11?o.push(17,h-3):o.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(u=i+5;u+2<a&&s[u+2]==m;)u+=2;var h=Math.min(u+1-i>>>1,6);o.push(16,h-3),i+=2*h-2}else o.push(m,0)}return a>>>1},r.F._hufTree=function(s,o,a){var i=[],m=s.length,f=o.length,l=0;for(l=0;l<f;l+=2)o[l]=0,o[l+1]=0;for(l=0;l<m;l++)s[l]!=0&&i.push({lit:l,f:s[l]});var c=i.length,u=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return u=h==0?1:0,o[1+(h<<1)]=1,o[1+(u<<1)]=1,1}i.sort((function(k,L){return k.f-L.f}));var x=i[0],b=i[1],y=0,v=1,E=2;for(i[0]={lit:-1,f:x.f+b.f,l:x,r:b,d:0};v!=c-1;)x=y!=v&&(E==c||i[y].f<i[E].f)?i[y++]:i[E++],b=y!=v&&(E==c||i[y].f<i[E].f)?i[y++]:i[E++],i[v++]={lit:-1,f:x.f+b.f,l:x,r:b};var _=r.F.setDepth(i[v-1],0);for(_>a&&(r.F.restrictDepth(u,a,_),_=a),l=0;l<c;l++)o[1+(u[l].lit<<1)]=u[l].d;return _},r.F.setDepth=function(s,o){return s.lit!=-1?(s.d=o,o):Math.max(r.F.setDepth(s.l,o+1),r.F.setDepth(s.r,o+1))},r.F.restrictDepth=function(s,o,a){var i=0,m=1<<a-o,f=0;for(s.sort((function(c,u){return u.d==c.d?c.f-u.f:u.d-c.d})),i=0;i<s.length&&s[i].d>o;i++){var l=s[i].d;s[i].d=o,f+=m-(1<<a-l)}for(f>>>=a-o;f>0;)(l=s[i].d)<o?(s[i].d++,f-=1<<o-l-1):i++;for(;i>=0;i--)s[i].d==o&&f<0&&(s[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(s,o){var a=0;return o[16|a]<=s&&(a|=16),o[8|a]<=s&&(a|=8),o[4|a]<=s&&(a|=4),o[2|a]<=s&&(a|=2),o[1|a]<=s&&(a|=1),a},r.F._writeLit=function(s,o,a,i){return r.F._putsF(a,i,o[s<<1]),i+o[1+(s<<1)]},r.F.inflate=function(s,o){var a=Uint8Array;if(s[0]==3&&s[1]==0)return o||new a(0);var i=r.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,u=i.codes2map,h=i._get17,x=i.U,b=o==null;b&&(o=new a(s.length>>>2<<3));for(var y,v,E=0,_=0,k=0,L=0,A=0,T=0,g=0,w=0,N=0;E==0;)if(E=m(s,N,1),_=m(s,N+1,2),N+=3,_!=0){if(b&&(o=r.F._check(o,w+(1<<17))),_==1&&(y=x.flmap,v=x.fdmap,T=511,g=31),_==2){k=f(s,N,5)+257,L=f(s,N+5,5)+1,A=f(s,N+10,4)+4,N+=14;for(var P=0;P<38;P+=2)x.itree[P]=0,x.itree[P+1]=0;var D=1;for(P=0;P<A;P++){var F=f(s,N+3*P,3);x.itree[1+(x.ordr[P]<<1)]=F,F>D&&(D=F)}N+=3*A,c(x.itree,D),u(x.itree,D,x.imap),y=x.lmap,v=x.dmap,N=l(x.imap,(1<<D)-1,k+L,s,N,x.ttree);var j=i._copyOut(x.ttree,0,k,x.ltree);T=(1<<j)-1;var z=i._copyOut(x.ttree,k,L,x.dtree);g=(1<<z)-1,c(x.ltree,j),u(x.ltree,j,y),c(x.dtree,z),u(x.dtree,z,v)}for(;;){var S=y[h(s,N)&T];N+=15&S;var C=S>>>4;if(!(C>>>8))o[w++]=C;else{if(C==256)break;var H=w+C-254;if(C>264){var I=x.ldef[C-257];H=w+(I>>>3)+f(s,N,7&I),N+=7&I}var U=v[h(s,N)&g];N+=15&U;var Y=U>>>4,M=x.ddef[Y],O=(M>>>4)+m(s,N,15&M);for(N+=15&M,b&&(o=r.F._check(o,w+(1<<17)));w<H;)o[w]=o[w++-O],o[w]=o[w++-O],o[w]=o[w++-O],o[w]=o[w++-O];w=H}}}else{(7&N)!=0&&(N+=8-(7&N));var $=4+(N>>>3),R=s[$-4]|s[$-3]<<8;b&&(o=r.F._check(o,w+R)),o.set(new a(s.buffer,s.byteOffset+$,R),w),N=$+R<<3,w+=R}return o.length==w?o:o.slice(0,w)},r.F._check=function(s,o){var a=s.length;if(o<=a)return s;var i=new Uint8Array(Math.max(a<<1,o));return i.set(s,0),i},r.F._decodeTiny=function(s,o,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,u=0;u<a;){var h=s[c(i,m)&o];m+=15&h;var x=h>>>4;if(x<=15)f[u]=x,u++;else{var b=0,y=0;x==16?(y=3+l(i,m,2),m+=2,b=f[u-1]):x==17?(y=3+l(i,m,3),m+=3):x==18&&(y=11+l(i,m,7),m+=7);for(var v=u+y;u<v;)f[u]=b,u++}}return m},r.F._copyOut=function(s,o,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=s[f+o];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},r.F.makeCodes=function(s,o){for(var a,i,m,f,l=r.F.U,c=s.length,u=l.bl_count,h=0;h<=o;h++)u[h]=0;for(h=1;h<c;h+=2)u[s[h]]++;var x=l.next_code;for(a=0,u[0]=0,i=1;i<=o;i++)a=a+u[i-1]<<1,x[i]=a;for(m=0;m<c;m+=2)(f=s[m+1])!=0&&(s[m]=x[f],x[f]++)},r.F.codes2map=function(s,o,a){for(var i=s.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(s[f+1]!=0)for(var l=f>>1,c=s[f+1],u=l<<4|c,h=o-c,x=s[f]<<h,b=x+(1<<h);x!=b;)a[m[x]>>>15-o]=u,x++},r.F.revCodes=function(s,o){for(var a=r.F.U.rev15,i=15-o,m=0;m<s.length;m+=2){var f=s[m]<<o-s[m+1];s[m]=a[f]>>>i}},r.F._putsE=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8},r.F._putsF=function(s,o,a){a<<=7&o;var i=o>>>3;s[i]|=a,s[i+1]|=a>>>8,s[i+2]|=a>>>16},r.F._bitsE=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8)>>>(7&o)&(1<<a)-1},r.F._bitsF=function(s,o,a){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)&(1<<a)-1},r.F._get17=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16)>>>(7&o)},r.F._get25=function(s,o){return(s[o>>>3]|s[1+(o>>>3)]<<8|s[2+(o>>>3)]<<16|s[3+(o>>>3)]<<24)>>>(7&o)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var s=r.F.U,o=0;o<32768;o++){var a=o;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,s.rev15[o]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(o=0;o<32;o++)s.ldef[o]=s.of0[o]<<3|s.exb[o],s.ddef[o]=s.df0[o]<<4|s.dxb[o];i(s.fltree,144,8),i(s.fltree,112,9),i(s.fltree,24,7),i(s.fltree,8,8),r.F.makeCodes(s.fltree,9),r.F.codes2map(s.fltree,9,s.flmap),r.F.revCodes(s.fltree,9),i(s.fdtree,32,5),r.F.makeCodes(s.fdtree,5),r.F.codes2map(s.fdtree,5,s.fdmap),r.F.revCodes(s.fdtree,5),i(s.itree,19,0),i(s.ltree,286,0),i(s.dtree,30,0),i(s.ttree,320,0)})()})();var zh=Fh({__proto__:null,default:qn},[qn]);const He=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,u){l[c]=u>>8&255,l[c+1]=255&u},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,u){l[c]=u>>24&255,l[c+1]=u>>16&255,l[c+2]=u>>8&255,l[c+3]=255&u},readASCII(l,c,u){let h="";for(let x=0;x<u;x++)h+=String.fromCharCode(l[c+x]);return h},writeASCII(l,c,u){for(let h=0;h<u.length;h++)l[c+h]=u.charCodeAt(h)},readBytes(l,c,u){const h=[];for(let x=0;x<u;x++)h.push(l[c+x]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,u){let h,x="";for(let b=0;b<u;b++)x+=`%${e.pad(l[c+b].toString(16))}`;try{h=decodeURIComponent(x)}catch{return e.readASCII(l,c,u)}return h}};function t(l,c,u,h){const x=c*u,b=o(h),y=Math.ceil(c*b/8),v=new Uint8Array(4*x),E=new Uint32Array(v.buffer),{ctype:_}=h,{depth:k}=h,L=e.readUshort;if(_==6){const I=x<<2;if(k==8)for(var A=0;A<I;A+=4)v[A]=l[A],v[A+1]=l[A+1],v[A+2]=l[A+2],v[A+3]=l[A+3];if(k==16)for(A=0;A<I;A++)v[A]=l[A<<1]}else if(_==2){const I=h.tabs.tRNS;if(I==null){if(k==8)for(A=0;A<x;A++){var T=3*A;E[A]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T]}if(k==16)for(A=0;A<x;A++)T=6*A,E[A]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T]}else{var g=I[0];const U=I[1],Y=I[2];if(k==8)for(A=0;A<x;A++){var w=A<<2;T=3*A,E[A]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T],l[T]==g&&l[T+1]==U&&l[T+2]==Y&&(v[w+3]=0)}if(k==16)for(A=0;A<x;A++)w=A<<2,T=6*A,E[A]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T],L(l,T)==g&&L(l,T+2)==U&&L(l,T+4)==Y&&(v[w+3]=0)}}else if(_==3){const I=h.tabs.PLTE,U=h.tabs.tRNS,Y=U?U.length:0;if(k==1)for(var N=0;N<u;N++){var P=N*y,D=N*c;for(A=0;A<c;A++){w=D+A<<2;var F=3*(j=l[P+(A>>3)]>>7-((7&A)<<0)&1);v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=j<Y?U[j]:255}}if(k==2)for(N=0;N<u;N++)for(P=N*y,D=N*c,A=0;A<c;A++)w=D+A<<2,F=3*(j=l[P+(A>>2)]>>6-((3&A)<<1)&3),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=j<Y?U[j]:255;if(k==4)for(N=0;N<u;N++)for(P=N*y,D=N*c,A=0;A<c;A++)w=D+A<<2,F=3*(j=l[P+(A>>1)]>>4-((1&A)<<2)&15),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=j<Y?U[j]:255;if(k==8)for(A=0;A<x;A++){var j;w=A<<2,F=3*(j=l[A]),v[w]=I[F],v[w+1]=I[F+1],v[w+2]=I[F+2],v[w+3]=j<Y?U[j]:255}}else if(_==4){if(k==8)for(A=0;A<x;A++){w=A<<2;var z=l[S=A<<1];v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+1]}if(k==16)for(A=0;A<x;A++){var S;w=A<<2,z=l[S=A<<2],v[w]=z,v[w+1]=z,v[w+2]=z,v[w+3]=l[S+2]}}else if(_==0)for(g=h.tabs.tRNS?h.tabs.tRNS:-1,N=0;N<u;N++){const I=N*y,U=N*c;if(k==1)for(var C=0;C<c;C++){var H=(z=255*(l[I+(C>>>3)]>>>7-(7&C)&1))==255*g?0:255;E[U+C]=H<<24|z<<16|z<<8|z}else if(k==2)for(C=0;C<c;C++)H=(z=85*(l[I+(C>>>2)]>>>6-((3&C)<<1)&3))==85*g?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(k==4)for(C=0;C<c;C++)H=(z=17*(l[I+(C>>>1)]>>>4-((1&C)<<2)&15))==17*g?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(k==8)for(C=0;C<c;C++)H=(z=l[I+C])==g?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(k==16)for(C=0;C<c;C++)z=l[I+(C<<1)],H=L(l,I+(C<<1))==g?0:255,E[U+C]=H<<24|z<<16|z<<8|z}return v}function n(l,c,u,h){const x=o(l),b=Math.ceil(u*x/8),y=new Uint8Array((b+1+l.interlace)*h);return c=l.tabs.CgBI?s(c,y):r(c,y),l.interlace==0?c=a(c,l,0,u,h):l.interlace==1&&(c=(function(E,_){const k=_.width,L=_.height,A=o(_),T=A>>3,g=Math.ceil(k*A/8),w=new Uint8Array(L*g);let N=0;const P=[0,0,4,0,2,0,1],D=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],j=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const C=F[z],H=j[z];let I=0,U=0,Y=P[z];for(;Y<L;)Y+=C,U++;let M=D[z];for(;M<k;)M+=H,I++;const O=Math.ceil(I*A/8);a(E,_,N,I,U);let $=0,R=P[z];for(;R<L;){let B=D[z],G=N+$*O<<3;for(;B<k;){var S;if(A==1&&(S=(S=E[G>>3])>>7-(7&G)&1,w[R*g+(B>>3)]|=S<<7-((7&B)<<0)),A==2&&(S=(S=E[G>>3])>>6-(7&G)&3,w[R*g+(B>>2)]|=S<<6-((3&B)<<1)),A==4&&(S=(S=E[G>>3])>>4-(7&G)&15,w[R*g+(B>>1)]|=S<<4-((1&B)<<2)),A>=8){const q=R*g+B*T;for(let K=0;K<T;K++)w[q+K]=E[(G>>3)+K]}G+=A,B+=H}$++,R+=C}I*U!=0&&(N+=U*(1+O)),z+=1}return w})(c,l)),c}function r(l,c){return s(new Uint8Array(l.buffer,2,l.length-6),c)}var s=(function(){const l={H:{}};return l.H.N=function(c,u){const h=Uint8Array;let x,b,y=0,v=0,E=0,_=0,k=0,L=0,A=0,T=0,g=0;if(c[0]==3&&c[1]==0)return u||new h(0);const w=l.H,N=w.b,P=w.e,D=w.R,F=w.n,j=w.A,z=w.Z,S=w.m,C=u==null;for(C&&(u=new h(c.length>>>2<<5));y==0;)if(y=N(c,g,1),v=N(c,g+1,2),g+=3,v!=0){if(C&&(u=l.H.W(u,T+(1<<17))),v==1&&(x=S.J,b=S.h,L=511,A=31),v==2){E=P(c,g,5)+257,_=P(c,g+5,5)+1,k=P(c,g+10,4)+4,g+=14;let I=1;for(var H=0;H<38;H+=2)S.Q[H]=0,S.Q[H+1]=0;for(H=0;H<k;H++){const M=P(c,g+3*H,3);S.Q[1+(S.X[H]<<1)]=M,M>I&&(I=M)}g+=3*k,F(S.Q,I),j(S.Q,I,S.u),x=S.w,b=S.d,g=D(S.u,(1<<I)-1,E+_,c,g,S.v);const U=w.V(S.v,0,E,S.C);L=(1<<U)-1;const Y=w.V(S.v,E,_,S.D);A=(1<<Y)-1,F(S.C,U),j(S.C,U,x),F(S.D,Y),j(S.D,Y,b)}for(;;){const I=x[z(c,g)&L];g+=15&I;const U=I>>>4;if(!(U>>>8))u[T++]=U;else{if(U==256)break;{let Y=T+U-254;if(U>264){const B=S.q[U-257];Y=T+(B>>>3)+P(c,g,7&B),g+=7&B}const M=b[z(c,g)&A];g+=15&M;const O=M>>>4,$=S.c[O],R=($>>>4)+N(c,g,15&$);for(g+=15&$;T<Y;)u[T]=u[T++-R],u[T]=u[T++-R],u[T]=u[T++-R],u[T]=u[T++-R];T=Y}}}}else{(7&g)!=0&&(g+=8-(7&g));const I=4+(g>>>3),U=c[I-4]|c[I-3]<<8;C&&(u=l.H.W(u,T+U)),u.set(new h(c.buffer,c.byteOffset+I,U),T),g=I+U<<3,T+=U}return u.length==T?u:u.slice(0,T)},l.H.W=function(c,u){const h=c.length;if(u<=h)return c;const x=new Uint8Array(h<<1);return x.set(c,0),x},l.H.R=function(c,u,h,x,b,y){const v=l.H.e,E=l.H.Z;let _=0;for(;_<h;){const k=c[E(x,b)&u];b+=15&k;const L=k>>>4;if(L<=15)y[_]=L,_++;else{let A=0,T=0;L==16?(T=3+v(x,b,2),b+=2,A=y[_-1]):L==17?(T=3+v(x,b,3),b+=3):L==18&&(T=11+v(x,b,7),b+=7);const g=_+T;for(;_<g;)y[_]=A,_++}}return b},l.H.V=function(c,u,h,x){let b=0,y=0;const v=x.length>>>1;for(;y<h;){const E=c[y+u];x[y<<1]=0,x[1+(y<<1)]=E,E>b&&(b=E),y++}for(;y<v;)x[y<<1]=0,x[1+(y<<1)]=0,y++;return b},l.H.n=function(c,u){const h=l.H.m,x=c.length;let b,y,v,E;const _=h.j;for(var k=0;k<=u;k++)_[k]=0;for(k=1;k<x;k+=2)_[c[k]]++;const L=h.K;for(b=0,_[0]=0,y=1;y<=u;y++)b=b+_[y-1]<<1,L[y]=b;for(v=0;v<x;v+=2)E=c[v+1],E!=0&&(c[v]=L[E],L[E]++)},l.H.A=function(c,u,h){const x=c.length,b=l.H.m.r;for(let y=0;y<x;y+=2)if(c[y+1]!=0){const v=y>>1,E=c[y+1],_=v<<4|E,k=u-E;let L=c[y]<<k;const A=L+(1<<k);for(;L!=A;)h[b[L]>>>15-u]=_,L++}},l.H.l=function(c,u){const h=l.H.m.r,x=15-u;for(let b=0;b<c.length;b+=2){const y=c[b]<<u-c[b+1];c[b]=h[y]>>>x}},l.H.M=function(c,u,h){h<<=7&u;const x=u>>>3;c[x]|=h,c[x+1]|=h>>>8},l.H.I=function(c,u,h){h<<=7&u;const x=u>>>3;c[x]|=h,c[x+1]|=h>>>8,c[x+2]|=h>>>16},l.H.e=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8)>>>(7&u)&(1<<h)-1},l.H.b=function(c,u,h){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)&(1<<h)-1},l.H.Z=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16)>>>(7&u)},l.H.i=function(c,u){return(c[u>>>3]|c[1+(u>>>3)]<<8|c[2+(u>>>3)]<<16|c[3+(u>>>3)]<<24)>>>(7&u)},l.H.m=(function(){const c=Uint16Array,u=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new u(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new u(286),Y:new u(30),a:new u(19),t:new u(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var u=0;u<32768;u++){let x=u;x=(2863311530&x)>>>1|(1431655765&x)<<1,x=(3435973836&x)>>>2|(858993459&x)<<2,x=(4042322160&x)>>>4|(252645135&x)<<4,x=(4278255360&x)>>>8|(16711935&x)<<8,c.r[u]=(x>>>16|x<<16)>>>17}function h(x,b,y){for(;b--!=0;)x.push(0,y)}for(u=0;u<32;u++)c.q[u]=c.S[u]<<3|c.T[u],c.c[u]=c.p[u]<<4|c.z[u];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function o(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,u,h,x){let b=o(c);const y=Math.ceil(h*b/8);let v,E;b=Math.ceil(b/8);let _=l[u],k=0;if(_>1&&(l[u]=[0,0,1][_-2]),_==3)for(k=b;k<y;k++)l[k+1]=l[k+1]+(l[k+1-b]>>>1)&255;for(let L=0;L<x;L++)if(v=u+L*y,E=v+L+1,_=l[E-1],k=0,_==0)for(;k<y;k++)l[v+k]=l[E+k];else if(_==1){for(;k<b;k++)l[v+k]=l[E+k];for(;k<y;k++)l[v+k]=l[E+k]+l[v+k-b]}else if(_==2)for(;k<y;k++)l[v+k]=l[E+k]+l[v+k-y];else if(_==3){for(;k<b;k++)l[v+k]=l[E+k]+(l[v+k-y]>>>1);for(;k<y;k++)l[v+k]=l[E+k]+(l[v+k-y]+l[v+k-b]>>>1)}else{for(;k<b;k++)l[v+k]=l[E+k]+i(0,l[v+k-y],0);for(;k<y;k++)l[v+k]=l[E+k]+i(l[v+k-b],l[v+k-y],l[v+k-b-y])}return l}function i(l,c,u){const h=l+c-u,x=h-l,b=h-c,y=h-u;return x*x<=b*b&&x*x<=y*y?l:b*b<=y*y?c:u}function m(l,c,u){u.width=e.readUint(l,c),c+=4,u.height=e.readUint(l,c),c+=4,u.depth=l[c],c++,u.ctype=l[c],c++,u.compress=l[c],c++,u.filter=l[c],c++,u.interlace=l[c],c++}function f(l,c,u,h,x,b,y,v,E){const _=Math.min(c,x),k=Math.min(u,b);let L=0,A=0;for(let z=0;z<k;z++)for(let S=0;S<_;S++)if(y>=0&&v>=0?(L=z*c+S<<2,A=(v+z)*x+y+S<<2):(L=(-v+z)*c-y+S<<2,A=z*x+S<<2),E==0)h[A]=l[L],h[A+1]=l[L+1],h[A+2]=l[L+2],h[A+3]=l[L+3];else if(E==1){var T=l[L+3]*.00392156862745098,g=l[L]*T,w=l[L+1]*T,N=l[L+2]*T,P=h[A+3]*(1/255),D=h[A]*P,F=h[A+1]*P,j=h[A+2]*P;const C=1-T,H=T+P*C,I=H==0?0:1/H;h[A+3]=255*H,h[A+0]=(g+D*C)*I,h[A+1]=(w+F*C)*I,h[A+2]=(N+j*C)*I}else if(E==2)T=l[L+3],g=l[L],w=l[L+1],N=l[L+2],P=h[A+3],D=h[A],F=h[A+1],j=h[A+2],T==P&&g==D&&w==F&&N==j?(h[A]=0,h[A+1]=0,h[A+2]=0,h[A+3]=0):(h[A]=g,h[A+1]=w,h[A+2]=N,h[A+3]=T);else if(E==3){if(T=l[L+3],g=l[L],w=l[L+1],N=l[L+2],P=h[A+3],D=h[A],F=h[A+1],j=h[A+2],T==P&&g==D&&w==F&&N==j)continue;if(T<220&&P>20)return!1}return!0}return{decode:function(c){const u=new Uint8Array(c);let h=8;const x=e,b=x.readUshort,y=x.readUint,v={tabs:{},frames:[]},E=new Uint8Array(u.length);let _,k=0,L=0;const A=[137,80,78,71,13,10,26,10];for(var T=0;T<8;T++)if(u[T]!=A[T])throw"The input is not a PNG file!";for(;h<u.length;){const z=x.readUint(u,h);h+=4;const S=x.readASCII(u,h,4);if(h+=4,S=="IHDR")m(u,h,v);else if(S=="iCCP"){for(var g=h;u[g]!=0;)g++;x.readASCII(u,h,g-h),u[g+1];const C=u.slice(g+2,h+z);let H=null;try{H=r(C)}catch{H=s(C)}v.tabs[S]=H}else if(S=="CgBI")v.tabs[S]=u.slice(h,h+4);else if(S=="IDAT"){for(T=0;T<z;T++)E[k+T]=u[h+T];k+=z}else if(S=="acTL")v.tabs[S]={num_frames:y(u,h),num_plays:y(u,h+4)},_=new Uint8Array(u.length);else if(S=="fcTL"){L!=0&&((j=v.frames[v.frames.length-1]).data=n(v,_.slice(0,L),j.rect.width,j.rect.height),L=0);const C={x:y(u,h+12),y:y(u,h+16),width:y(u,h+4),height:y(u,h+8)};let H=b(u,h+22);H=b(u,h+20)/(H==0?100:H);const I={rect:C,delay:Math.round(1e3*H),dispose:u[h+24],blend:u[h+25]};v.frames.push(I)}else if(S=="fdAT"){for(T=0;T<z-4;T++)_[L+T]=u[h+T+4];L+=z-4}else if(S=="pHYs")v.tabs[S]=[x.readUint(u,h),x.readUint(u,h+4),u[h+8]];else if(S=="cHRM")for(v.tabs[S]=[],T=0;T<8;T++)v.tabs[S].push(x.readUint(u,h+4*T));else if(S=="tEXt"||S=="zTXt"){v.tabs[S]==null&&(v.tabs[S]={});var w=x.nextZero(u,h),N=x.readASCII(u,h,w-h),P=h+z-w-1;if(S=="tEXt")F=x.readASCII(u,w+1,P);else{var D=r(u.slice(w+2,w+2+P));F=x.readUTF8(D,0,D.length)}v.tabs[S][N]=F}else if(S=="iTXt"){v.tabs[S]==null&&(v.tabs[S]={}),w=0,g=h,w=x.nextZero(u,g),N=x.readASCII(u,g,w-g);const C=u[g=w+1];var F;u[g+1],g+=2,w=x.nextZero(u,g),x.readASCII(u,g,w-g),g=w+1,w=x.nextZero(u,g),x.readUTF8(u,g,w-g),P=z-((g=w+1)-h),C==0?F=x.readUTF8(u,g,P):(D=r(u.slice(g,g+P)),F=x.readUTF8(D,0,D.length)),v.tabs[S][N]=F}else if(S=="PLTE")v.tabs[S]=x.readBytes(u,h,z);else if(S=="hIST"){const C=v.tabs.PLTE.length/3;for(v.tabs[S]=[],T=0;T<C;T++)v.tabs[S].push(b(u,h+2*T))}else if(S=="tRNS")v.ctype==3?v.tabs[S]=x.readBytes(u,h,z):v.ctype==0?v.tabs[S]=b(u,h):v.ctype==2&&(v.tabs[S]=[b(u,h),b(u,h+2),b(u,h+4)]);else if(S=="gAMA")v.tabs[S]=x.readUint(u,h)/1e5;else if(S=="sRGB")v.tabs[S]=u[h];else if(S=="bKGD")v.ctype==0||v.ctype==4?v.tabs[S]=[b(u,h)]:v.ctype==2||v.ctype==6?v.tabs[S]=[b(u,h),b(u,h+2),b(u,h+4)]:v.ctype==3&&(v.tabs[S]=u[h]);else if(S=="IEND")break;h+=z,x.readUint(u,h),h+=4}var j;return L!=0&&((j=v.frames[v.frames.length-1]).data=n(v,_.slice(0,L),j.rect.width,j.rect.height)),v.data=n(v,E,v.width,v.height),delete v.compress,delete v.interlace,delete v.filter,v},toRGBA8:function(c){const u=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,u,h,c).buffer];const x=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const b=u*h*4,y=new Uint8Array(b),v=new Uint8Array(b),E=new Uint8Array(b);for(let k=0;k<c.frames.length;k++){const L=c.frames[k],A=L.rect.x,T=L.rect.y,g=L.rect.width,w=L.rect.height,N=t(L.data,g,w,c);if(k!=0)for(var _=0;_<b;_++)E[_]=y[_];if(L.blend==0?f(N,g,w,y,u,h,A,T,0):L.blend==1&&f(N,g,w,y,u,h,A,T,1),x.push(y.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(v,g,w,y,u,h,A,T,0);else if(L.dispose==2)for(_=0;_<b;_++)y[_]=E[_]}}return x},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=He,{_bin:t}=He,n=He._paeth;var r={table:(function(){const g=new Uint32Array(256);for(let w=0;w<256;w++){let N=w;for(let P=0;P<8;P++)1&N?N=3988292384^N>>>1:N>>>=1;g[w]=N}return g})(),update(g,w,N,P){for(let D=0;D<P;D++)g=r.table[255&(g^w[N+D])]^g>>>8;return g},crc:(g,w,N)=>4294967295^r.update(4294967295,g,w,N)};function s(g,w,N,P){w[N]+=g[0]*P>>4,w[N+1]+=g[1]*P>>4,w[N+2]+=g[2]*P>>4,w[N+3]+=g[3]*P>>4}function o(g){return Math.max(0,Math.min(255,g))}function a(g,w){const N=g[0]-w[0],P=g[1]-w[1],D=g[2]-w[2],F=g[3]-w[3];return N*N+P*P+D*D+F*F}function i(g,w,N,P,D,F,j){j==null&&(j=1);const z=P.length,S=[];for(var C=0;C<z;C++){const R=P[C];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(C=0;C<z;C++){let R=4294967295;for(var H=0,I=0;I<z;I++){var U=a(S[C],S[I]);I!=C&&U<R&&(R=U,H=I)}}const Y=new Uint32Array(D.buffer),M=new Int16Array(w*N*4),O=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<O.length;C++)O[C]=255*((O[C]+.5)/16-.5);for(let R=0;R<N;R++)for(let B=0;B<w;B++){var $;C=4*(R*w+B),j!=2?$=[o(g[C]+M[C]),o(g[C+1]+M[C+1]),o(g[C+2]+M[C+2]),o(g[C+3]+M[C+3])]:(U=O[4*(3&R)+(3&B)],$=[o(g[C]+U),o(g[C+1]+U),o(g[C+2]+U),o(g[C+3]+U)]),H=0;let G=16777215;for(I=0;I<z;I++){const oe=a($,S[I]);oe<G&&(G=oe,H=I)}const q=S[H],K=[$[0]-q[0],$[1]-q[1],$[2]-q[2],$[3]-q[3]];j==1&&(B!=w-1&&s(K,M,C+4,7),R!=N-1&&(B!=0&&s(K,M,C+4*w-4,3),s(K,M,C+4*w,5),B!=w-1&&s(K,M,C+4*w+4,1))),F[C>>2]=H,Y[C>>2]=P[H]}}function m(g,w,N,P,D){D==null&&(D={});const{crc:F}=r,j=t.writeUint,z=t.writeUshort,S=t.writeASCII;let C=8;const H=g.frames.length>1;let I,U=!1,Y=33+(H?20:0);if(D.sRGB!=null&&(Y+=13),D.pHYs!=null&&(Y+=21),D.iCCP!=null&&(I=pako.deflate(D.iCCP),Y+=21+I.length+4),g.ctype==3){for(var M=g.plte.length,O=0;O<M;O++)g.plte[O]>>>24!=255&&(U=!0);Y+=8+3*M+4+(U?8+1*M+4:0)}for(var $=0;$<g.frames.length;$++)H&&(Y+=38),Y+=(q=g.frames[$]).cimg.length+12,$!=0&&(Y+=4);Y+=12;const R=new Uint8Array(Y),B=[137,80,78,71,13,10,26,10];for(O=0;O<8;O++)R[O]=B[O];if(j(R,C,13),C+=4,S(R,C,"IHDR"),C+=4,j(R,C,w),C+=4,j(R,C,N),C+=4,R[C]=g.depth,C++,R[C]=g.ctype,C++,R[C]=0,C++,R[C]=0,C++,R[C]=0,C++,j(R,C,F(R,C-17,17)),C+=4,D.sRGB!=null&&(j(R,C,1),C+=4,S(R,C,"sRGB"),C+=4,R[C]=D.sRGB,C++,j(R,C,F(R,C-5,5)),C+=4),D.iCCP!=null){const K=13+I.length;j(R,C,K),C+=4,S(R,C,"iCCP"),C+=4,S(R,C,"ICC profile"),C+=11,C+=2,R.set(I,C),C+=I.length,j(R,C,F(R,C-(K+4),K+4)),C+=4}if(D.pHYs!=null&&(j(R,C,9),C+=4,S(R,C,"pHYs"),C+=4,j(R,C,D.pHYs[0]),C+=4,j(R,C,D.pHYs[1]),C+=4,R[C]=D.pHYs[2],C++,j(R,C,F(R,C-13,13)),C+=4),H&&(j(R,C,8),C+=4,S(R,C,"acTL"),C+=4,j(R,C,g.frames.length),C+=4,j(R,C,D.loop!=null?D.loop:0),C+=4,j(R,C,F(R,C-12,12)),C+=4),g.ctype==3){for(j(R,C,3*(M=g.plte.length)),C+=4,S(R,C,"PLTE"),C+=4,O=0;O<M;O++){const K=3*O,oe=g.plte[O],Z=255&oe,se=oe>>>8&255,le=oe>>>16&255;R[C+K+0]=Z,R[C+K+1]=se,R[C+K+2]=le}if(C+=3*M,j(R,C,F(R,C-3*M-4,3*M+4)),C+=4,U){for(j(R,C,M),C+=4,S(R,C,"tRNS"),C+=4,O=0;O<M;O++)R[C+O]=g.plte[O]>>>24&255;C+=M,j(R,C,F(R,C-M-4,M+4)),C+=4}}let G=0;for($=0;$<g.frames.length;$++){var q=g.frames[$];H&&(j(R,C,26),C+=4,S(R,C,"fcTL"),C+=4,j(R,C,G++),C+=4,j(R,C,q.rect.width),C+=4,j(R,C,q.rect.height),C+=4,j(R,C,q.rect.x),C+=4,j(R,C,q.rect.y),C+=4,z(R,C,P[$]),C+=2,z(R,C,1e3),C+=2,R[C]=q.dispose,C++,R[C]=q.blend,C++,j(R,C,F(R,C-30,30)),C+=4);const K=q.cimg;j(R,C,(M=K.length)+($==0?0:4)),C+=4;const oe=C;S(R,C,$==0?"IDAT":"fdAT"),C+=4,$!=0&&(j(R,C,G++),C+=4),R.set(K,C),C+=M,j(R,C,F(R,oe,C-oe)),C+=4}return j(R,C,0),C+=4,S(R,C,"IEND"),C+=4,j(R,C,F(R,C-4,4)),C+=4,R.buffer}function f(g,w,N){for(let P=0;P<g.frames.length;P++){const D=g.frames[P];D.rect.width;const F=D.rect.height,j=new Uint8Array(F*D.bpl+F);D.cimg=h(D.img,F,D.bpp,D.bpl,j,w,N)}}function l(g,w,N,P,D){const F=D[0],j=D[1],z=D[2],S=D[3],C=D[4],H=D[5];let I=6,U=8,Y=255;for(var M=0;M<g.length;M++){const ye=new Uint8Array(g[M]);for(var O=ye.length,$=0;$<O;$+=4)Y&=ye[$+3]}const R=Y!=255,B=(function(fe,ce,ve,Ce,me,_e){const Se=[];for(var ge=0;ge<fe.length;ge++){const Ne=new Uint8Array(fe[ge]),Oe=new Uint32Array(Ne.buffer);var Ie;let W=0,X=0,te=ce,de=ve,ke=Ce?1:0;if(ge!=0){const pe=_e||Ce||ge==1||Se[ge-2].dispose!=0?1:2;let Re=0,An=1e9;for(let lt=0;lt<pe;lt++){var Ge=new Uint8Array(fe[ge-1-lt]);const bc=new Uint32Array(fe[ge-1-lt]);let ct=ce,dt=ve,Ft=-1,sn=-1;for(let Ct=0;Ct<ve;Ct++)for(let St=0;St<ce;St++)Oe[Te=Ct*ce+St]!=bc[Te]&&(St<ct&&(ct=St),St>Ft&&(Ft=St),Ct<dt&&(dt=Ct),Ct>sn&&(sn=Ct));Ft==-1&&(ct=dt=Ft=sn=0),me&&((1&ct)==1&&ct--,(1&dt)==1&&dt--);const Vr=(Ft-ct+1)*(sn-dt+1);Vr<An&&(An=Vr,Re=lt,W=ct,X=dt,te=Ft-ct+1,de=sn-dt+1)}Ge=new Uint8Array(fe[ge-1-Re]),Re==1&&(Se[ge-1].dispose=2),Ie=new Uint8Array(te*de*4),e(Ge,ce,ve,Ie,te,de,-W,-X,0),ke=e(Ne,ce,ve,Ie,te,de,-W,-X,3)?1:0,ke==1?u(Ne,ce,ve,Ie,{x:W,y:X,width:te,height:de}):e(Ne,ce,ve,Ie,te,de,-W,-X,0)}else Ie=Ne.slice(0);Se.push({rect:{x:W,y:X,width:te,height:de},img:Ie,blend:ke,dispose:0})}if(Ce)for(ge=0;ge<Se.length;ge++){if((et=Se[ge]).blend==1)continue;const Ne=et.rect,Oe=Se[ge-1].rect,W=Math.min(Ne.x,Oe.x),X=Math.min(Ne.y,Oe.y),te={x:W,y:X,width:Math.max(Ne.x+Ne.width,Oe.x+Oe.width)-W,height:Math.max(Ne.y+Ne.height,Oe.y+Oe.height)-X};Se[ge-1].dispose=1,ge-1!=0&&c(fe,ce,ve,Se,ge-1,te,me),c(fe,ce,ve,Se,ge,te,me)}let Lt=0;if(fe.length!=1)for(var Te=0;Te<Se.length;Te++){var et;Lt+=(et=Se[Te]).rect.width*et.rect.height}return Se})(g,w,N,F,j,z),G={},q=[],K=[];if(P!=0){const ye=[];for($=0;$<B.length;$++)ye.push(B[$].img.buffer);const fe=(function(me){let _e=0;for(var Se=0;Se<me.length;Se++)_e+=me[Se].byteLength;const ge=new Uint8Array(_e);let Ie=0;for(Se=0;Se<me.length;Se++){const Ge=new Uint8Array(me[Se]),Lt=Ge.length;for(let Te=0;Te<Lt;Te+=4){let et=Ge[Te],Ne=Ge[Te+1],Oe=Ge[Te+2];const W=Ge[Te+3];W==0&&(et=Ne=Oe=0),ge[Ie+Te]=et,ge[Ie+Te+1]=Ne,ge[Ie+Te+2]=Oe,ge[Ie+Te+3]=W}Ie+=Lt}return ge.buffer})(ye),ce=b(fe,P);for($=0;$<ce.plte.length;$++)q.push(ce.plte[$].est.rgba);let ve=0;for($=0;$<B.length;$++){const Ce=(Z=B[$]).img.length;var oe=new Uint8Array(ce.inds.buffer,ve>>2,Ce>>2);K.push(oe);const me=new Uint8Array(ce.abuf,ve,Ce);H&&i(Z.img,Z.rect.width,Z.rect.height,q,me,oe),Z.img.set(me),ve+=Ce}}else for(M=0;M<B.length;M++){var Z=B[M];const ye=new Uint32Array(Z.img.buffer);var se=Z.rect.width;for(O=ye.length,oe=new Uint8Array(O),K.push(oe),$=0;$<O;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])oe[$]=oe[$-1];else if($>se&&fe==ye[$-se])oe[$]=oe[$-se];else{let ce=G[fe];if(ce==null&&(G[fe]=ce=q.length,q.push(fe),q.length>=300))break;oe[$]=ce}}}const le=q.length;for(le<=256&&C==0&&(U=le<=2?1:le<=4?2:le<=16?4:8,U=Math.max(U,S)),M=0;M<B.length;M++){(Z=B[M]).rect.x,Z.rect.y,se=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ce=4*se,ve=4;if(le<=256&&C==0){ce=Math.ceil(U*se/8);var be=new Uint8Array(ce*ye);const Ce=K[M];for(let me=0;me<ye;me++){$=me*ce;const _e=me*se;if(U==8)for(var ue=0;ue<se;ue++)be[$+ue]=Ce[_e+ue];else if(U==4)for(ue=0;ue<se;ue++)be[$+(ue>>1)]|=Ce[_e+ue]<<4-4*(1&ue);else if(U==2)for(ue=0;ue<se;ue++)be[$+(ue>>2)]|=Ce[_e+ue]<<6-2*(3&ue);else if(U==1)for(ue=0;ue<se;ue++)be[$+(ue>>3)]|=Ce[_e+ue]<<7-1*(7&ue)}fe=be,I=3,ve=1}else if(R==0&&B.length==1){be=new Uint8Array(se*ye*3);const Ce=se*ye;for($=0;$<Ce;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,I=2,ve=3,ce=3*se}Z.img=fe,Z.bpl=ce,Z.bpp=ve}return{ctype:I,depth:U,plte:q,frames:B}}function c(g,w,N,P,D,F,j){const z=Uint8Array,S=Uint32Array,C=new z(g[D-1]),H=new S(g[D-1]),I=D+1<g.length?new z(g[D+1]):null,U=new z(g[D]),Y=new S(U.buffer);let M=w,O=N,$=-1,R=-1;for(let G=0;G<F.height;G++)for(let q=0;q<F.width;q++){const K=F.x+q,oe=F.y+G,Z=oe*w+K,se=Y[Z];se==0||P[D-1].dispose==0&&H[Z]==se&&(I==null||I[4*Z+3]!=0)||(K<M&&(M=K),K>$&&($=K),oe<O&&(O=oe),oe>R&&(R=oe))}$==-1&&(M=O=$=R=0),j&&((1&M)==1&&M--,(1&O)==1&&O--),F={x:M,y:O,width:$-M+1,height:R-O+1};const B=P[D];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),P[D-1].dispose==0?(e(C,w,N,B.img,F.width,F.height,-F.x,-F.y,0),u(U,w,N,B.img,F)):e(U,w,N,B.img,F.width,F.height,-F.x,-F.y,0)}function u(g,w,N,P,D){e(g,w,N,P,D.width,D.height,-D.x,-D.y,2)}function h(g,w,N,P,D,F,j){const z=[];let S,C=[0,1,2,3,4];F!=-1?C=[F]:(w*P>5e5||N==1)&&(C=[0]),j&&(S={level:0});const H=zh;for(var I=0;I<C.length;I++){for(let M=0;M<w;M++)x(D,g,M,P,N,C[I]);z.push(H.deflate(D,S))}let U,Y=1e9;for(I=0;I<z.length;I++)z[I].length<Y&&(U=I,Y=z[I].length);return z[U]}function x(g,w,N,P,D,F){const j=N*P;let z=j+N;if(g[z]=F,z++,F==0)if(P<500)for(var S=0;S<P;S++)g[z+S]=w[j+S];else g.set(new Uint8Array(w.buffer,j,P),z);else if(F==1){for(S=0;S<D;S++)g[z+S]=w[j+S];for(S=D;S<P;S++)g[z+S]=w[j+S]-w[j+S-D]+256&255}else if(N==0){for(S=0;S<D;S++)g[z+S]=w[j+S];if(F==2)for(S=D;S<P;S++)g[z+S]=w[j+S];if(F==3)for(S=D;S<P;S++)g[z+S]=w[j+S]-(w[j+S-D]>>1)+256&255;if(F==4)for(S=D;S<P;S++)g[z+S]=w[j+S]-n(w[j+S-D],0,0)+256&255}else{if(F==2)for(S=0;S<P;S++)g[z+S]=w[j+S]+256-w[j+S-P]&255;if(F==3){for(S=0;S<D;S++)g[z+S]=w[j+S]+256-(w[j+S-P]>>1)&255;for(S=D;S<P;S++)g[z+S]=w[j+S]+256-(w[j+S-P]+w[j+S-D]>>1)&255}if(F==4){for(S=0;S<D;S++)g[z+S]=w[j+S]+256-n(0,w[j+S-P],0)&255;for(S=D;S<P;S++)g[z+S]=w[j+S]+256-n(w[j+S-D],w[j+S-P],w[j+S-D-P])&255}}}function b(g,w){const N=new Uint8Array(g),P=N.slice(0),D=new Uint32Array(P.buffer),F=y(P,w),j=F[0],z=F[1],S=N.length,C=new Uint8Array(S>>2);let H;if(N.length<2e7)for(var I=0;I<S;I+=4)H=v(j,U=N[I]*(1/255),Y=N[I+1]*(1/255),M=N[I+2]*(1/255),O=N[I+3]*(1/255)),C[I>>2]=H.ind,D[I>>2]=H.est.rgba;else for(I=0;I<S;I+=4){var U=N[I]*.00392156862745098,Y=N[I+1]*(1/255),M=N[I+2]*(1/255),O=N[I+3]*(1/255);for(H=j;H.left;)H=E(H.est,U,Y,M,O)<=0?H.left:H.right;C[I>>2]=H.ind,D[I>>2]=H.est.rgba}return{abuf:P.buffer,inds:C,plte:z}}function y(g,w,N){N==null&&(N=1e-4);const P=new Uint32Array(g.buffer),D={i0:0,i1:g.length,bst:null,est:null,tdst:0,left:null,right:null};D.bst=L(g,D.i0,D.i1),D.est=A(D.bst);const F=[D];for(;F.length<w;){let z=0,S=0;for(var j=0;j<F.length;j++)F[j].est.L>z&&(z=F[j].est.L,S=j);if(z<N)break;const C=F[S],H=_(g,P,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=H||C.i1<=H){C.est.L=0;continue}const I={i0:C.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};I.bst=L(g,I.i0,I.i1),I.est=A(I.bst);const U={i0:H,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:C.bst.N-I.bst.N},j=0;j<16;j++)U.bst.R[j]=C.bst.R[j]-I.bst.R[j];for(j=0;j<4;j++)U.bst.m[j]=C.bst.m[j]-I.bst.m[j];U.est=A(U.bst),C.left=I,C.right=U,F[S]=I,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),j=0;j<F.length;j++)F[j].ind=j;return[D,F]}function v(g,w,N,P,D){if(g.left==null)return g.tdst=(function(I,U,Y,M,O){const $=U-I[0],R=Y-I[1],B=M-I[2],G=O-I[3];return $*$+R*R+B*B+G*G})(g.est.q,w,N,P,D),g;const F=E(g.est,w,N,P,D);let j=g.left,z=g.right;F>0&&(j=g.right,z=g.left);const S=v(j,w,N,P,D);if(S.tdst<=F*F)return S;const C=v(z,w,N,P,D);return C.tdst<S.tdst?C:S}function E(g,w,N,P,D){const{e:F}=g;return F[0]*w+F[1]*N+F[2]*P+F[3]*D-g.eMq}function _(g,w,N,P,D,F){for(P-=4;N<P;){for(;k(g,N,D)<=F;)N+=4;for(;k(g,P,D)>F;)P-=4;if(N>=P)break;const j=w[N>>2];w[N>>2]=w[P>>2],w[P>>2]=j,N+=4,P-=4}for(;k(g,N,D)>F;)N-=4;return N+4}function k(g,w,N){return g[w]*N[0]+g[w+1]*N[1]+g[w+2]*N[2]+g[w+3]*N[3]}function L(g,w,N){const P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],D=[0,0,0,0],F=N-w>>2;for(let j=w;j<N;j+=4){const z=g[j]*.00392156862745098,S=g[j+1]*(1/255),C=g[j+2]*(1/255),H=g[j+3]*(1/255);D[0]+=z,D[1]+=S,D[2]+=C,D[3]+=H,P[0]+=z*z,P[1]+=z*S,P[2]+=z*C,P[3]+=z*H,P[5]+=S*S,P[6]+=S*C,P[7]+=S*H,P[10]+=C*C,P[11]+=C*H,P[15]+=H*H}return P[4]=P[1],P[8]=P[2],P[9]=P[6],P[12]=P[3],P[13]=P[7],P[14]=P[11],{R:P,m:D,N:F}}function A(g){const{R:w}=g,{m:N}=g,{N:P}=g,D=N[0],F=N[1],j=N[2],z=N[3],S=P==0?0:1/P,C=[w[0]-D*D*S,w[1]-D*F*S,w[2]-D*j*S,w[3]-D*z*S,w[4]-F*D*S,w[5]-F*F*S,w[6]-F*j*S,w[7]-F*z*S,w[8]-j*D*S,w[9]-j*F*S,w[10]-j*j*S,w[11]-j*z*S,w[12]-z*D*S,w[13]-z*F*S,w[14]-z*j*S,w[15]-z*z*S],H=C,I=T;let U=[Math.random(),Math.random(),Math.random(),Math.random()],Y=0,M=0;if(P!=0)for(let $=0;$<16&&(U=I.multVec(H,U),M=Math.sqrt(I.dot(U,U)),U=I.sml(1/M,U),!($!=0&&Math.abs(M-Y)<1e-9));$++)Y=M;const O=[D*S,F*S,j*S,z*S];return{Cov:C,q:O,e:U,L:Y,eMq255:I.dot(I.sml(255,O),U),eMq:I.dot(U,O),rgba:(Math.round(255*O[3])<<24|Math.round(255*O[2])<<16|Math.round(255*O[1])<<8|Math.round(255*O[0])<<0)>>>0}}var T={multVec:(g,w)=>[g[0]*w[0]+g[1]*w[1]+g[2]*w[2]+g[3]*w[3],g[4]*w[0]+g[5]*w[1]+g[6]*w[2]+g[7]*w[3],g[8]*w[0]+g[9]*w[1]+g[10]*w[2]+g[11]*w[3],g[12]*w[0]+g[13]*w[1]+g[14]*w[2]+g[15]*w[3]],dot:(g,w)=>g[0]*w[0]+g[1]*w[1]+g[2]*w[2]+g[3]*w[3],sml:(g,w)=>[g*w[0],g*w[1],g*w[2],g*w[3]]};He.encode=function(w,N,P,D,F,j,z){D==null&&(D=0),z==null&&(z=!1);const S=l(w,N,P,D,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,N,P,F,j)},He.encodeLL=function(w,N,P,D,F,j,z,S){const C={ctype:0+(D==1?0:2)+(F==0?0:4),depth:j,frames:[]},H=(D+F)*j,I=H*N;for(let U=0;U<w.length;U++)C.frames.push({rect:{x:0,y:0,width:N,height:P},img:new Uint8Array(w[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(I/8)});return f(C,0,!0),m(C,N,P,z,S)},He.encode.compress=l,He.encode.dither=i,He.quantize=b,He.quantize.getKDtree=y,He.quantize.getNearest=v})();const Xi={toArrayBuffer(e,t){const n=e.width,r=e.height,s=n<<2,o=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(o.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),u=1<<20;let h,x,b,y,v=u,E=0,_=0,k=0;function L(g){c.setUint16(_,g,!0),_+=2}function A(g){c.setUint32(_,g,!0),_+=4}function T(g){_+=g}L(19778),A(f),T(4),A(122),A(108),A(n),A(-r>>>0),L(1),L(32),A(3),A(m),A(2835),A(2835),T(8),A(16711680),A(65280),A(255),A(4278190080),A(1466527264),(function g(){for(;E<r&&v>0;){for(y=122+E*i,h=0;h<s;)v--,x=a[k++],b=x>>>24,c.setUint32(y+h,x<<8|b),h+=4;E++}k<a.length?(v=u,setTimeout(g,Xi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Le={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Hh={[Le.CHROME]:16384,[Le.FIREFOX]:11180,[Le.DESKTOP_SAFARI]:16384,[Le.IE]:8192,[Le.IOS]:4096,[Le.ETC]:8192};const Nr=typeof window<"u",Qi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Kn=Nr&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Bh=(Nr||Qi)&&(Kn&&Kn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Ji=(Nr||Qi)&&(Kn&&Kn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function jr(e,t,n=Date.now()){return new Promise((r=>{const s=e.split(","),o=s[0].match(/:(.*?);/)[1],a=globalThis.atob(s[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:o});f.name=t,f.lastModified=n,r(f)}))}function Zi(e){return new Promise(((t,n)=>{const r=new Ji;r.onload=()=>t(r.result),r.onerror=s=>n(s),r.readAsDataURL(e)}))}function el(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=s=>n(s),r.src=e}))}function _t(){if(_t.cachedResult!==void 0)return _t.cachedResult;let e=Le.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Le.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Le.IOS:/Safari/i.test(t)?e=Le.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Le.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Le.IE),_t.cachedResult=e,_t.cachedResult}function tl(e,t){const n=_t(),r=Hh[n];let s=e,o=t,a=s*o;const i=s>o?o/s:s/o;for(;a>r*r;){const m=(r+s)/2,f=(r+o)/2;m<f?(o=f,s=f*i):(o=m*i,s=m),a=s*o}return{width:s,height:o}}function ls(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function nl(e,t){const{width:n,height:r}=tl(e.width,e.height),[s,o]=ls(n,r);return t&&/jpe?g/.test(t)&&(o.fillStyle="white",o.fillRect(0,0,s.width,s.height)),o.drawImage(e,0,0,s.width,s.height),s}function On(){return On.cachedResult!==void 0||(On.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),On.cachedResult}function Yn(e,t={}){return new Promise((function(n,r){let s,o;var a=function(){try{return o=nl(s,t.fileType||e.type),n([s,o])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return Zi(e).then((function(c){try{return l=c,el(l).then((function(u){try{return s=u,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(u){return f(u)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(On()||[Le.DESKTOP_SAFARI,Le.MOBILE_SAFARI].includes(_t()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return s=m,a()}catch{return i()}}),i)}catch{i()}}))}function Xn(e,t,n,r,s=1){return new Promise((function(o,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=He.encode([l.buffer],e.width,e.height,4096*s),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Xi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:s}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(u){return a(u)}}).bind(this),a);{let c;return c=e.toDataURL(t,s),jr(c,n,r).then((function(u){try{return i=u,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return o(i)}}))}function Ye(e){e.width=0,e.height=0}function Bt(){return new Promise((function(e,t){let n,r,s,o;return Bt.cachedResult!==void 0?e(Bt.cachedResult):jr("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Yn(n).then((function(i){try{return r=i[1],Xn(r,n.type,n.name,n.lastModified).then((function(m){try{return s=m,Ye(r),Yn(s).then((function(f){try{return o=f[0],Bt.cachedResult=o.width===1&&o.height===2,e(Bt.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function sl(e){return new Promise(((t,n)=>{const r=new Ji;r.onload=s=>{const o=new DataView(s.target.result);if(o.getUint16(0,!1)!=65496)return t(-2);const a=o.byteLength;let i=2;for(;i<a;){if(o.getUint16(i+2,!1)<=8)return t(-1);const m=o.getUint16(i,!1);if(i+=2,m==65505){if(o.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=o.getUint16(i+=6,!1)==18761;i+=o.getUint32(i+4,f);const l=o.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(o.getUint16(i+12*c,f)==274)return t(o.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=o.getUint16(i,!1)}}return t(-1)},r.onerror=s=>n(s),r.readAsArrayBuffer(e)}))}function rl(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:s}=t;let o,a=e;return isFinite(s)&&(n>s||r>s)&&([a,o]=ls(n,r),n>r?(a.width=s,a.height=r/n*s):(a.width=n/r*s,a.height=s),o.drawImage(e,0,0,a.width,a.height),Ye(e)),a}function ol(e,t){const{width:n}=e,{height:r}=e,[s,o]=ls(n,r);switch(t>4&&t<9?(s.width=r,s.height=n):(s.width=n,s.height=r),t){case 2:o.transform(-1,0,0,1,n,0);break;case 3:o.transform(-1,0,0,-1,n,r);break;case 4:o.transform(1,0,0,-1,0,r);break;case 5:o.transform(0,1,1,0,0,0);break;case 6:o.transform(0,1,-1,0,r,0);break;case 7:o.transform(0,-1,-1,0,r,n);break;case 8:o.transform(0,-1,1,0,0,n)}return o.drawImage(e,0,0,n,r),Ye(e),s}function To(e,t,n=0){return new Promise((function(r,s){let o,a,i,m,f,l,c,u,h,x,b,y,v,E,_,k,L,A,T,g;function w(P=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;o+=P,t.onProgress(Math.min(o,100))}function N(P){if(t.signal&&t.signal.aborted)throw t.signal.reason;o=Math.min(Math.max(P,o),100),t.onProgress(o)}return o=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,w(),Yn(e,t).then((function(P){try{return[,m]=P,w(),f=rl(m,t),w(),new Promise((function(D,F){var j;if(!(j=t.exifOrientation))return sl(e).then((function(S){try{return j=S,z.call(this)}catch(C){return F(C)}}).bind(this),F);function z(){return D(j)}return z.call(this)})).then((function(D){try{return l=D,w(),Bt().then((function(F){try{return c=F?f:ol(f,l),w(),u=t.initialQuality||1,h=t.fileType||e.type,Xn(c,h,e.name,e.lastModified,u).then((function(j){try{{let S=function(){if(a--&&(_>i||_>v)){let H,I;return H=g?.95*T.width:T.width,I=g?.95*T.height:T.height,[L,A]=ls(H,I),A.drawImage(T,0,0,H,I),u*=h==="image/png"?.85:.95,Xn(L,h,e.name,e.lastModified,u).then((function(U){try{return k=U,Ye(T),T=L,_=k.size,N(Math.min(99,Math.floor((E-_)/(E-i)*100))),S}catch(Y){return s(Y)}}),s)}return[1]},C=function(){return Ye(T),Ye(L),Ye(f),Ye(c),Ye(m),N(100),r(k)};if(x=j,w(),b=x.size>i,y=x.size>e.size,!b&&!y)return N(100),r(x);var z;return v=e.size,E=x.size,_=E,T=c,g=!t.alwaysKeepResolution&&b,(z=(function(H){for(;H;){if(H.then)return void H.then(z,s);try{if(H.pop){if(H.length)return H.pop()?C.call(this):H;H=S}else H=H.call(this)}catch(I){return s(I)}}}).bind(this))(S)}}catch(S){return s(S)}}).bind(this),s)}catch(j){return s(j)}}).bind(this),s)}catch(F){return s(F)}}).bind(this),s)}catch(D){return s(D)}}).bind(this),s)}))}const Wh=`
|
|
214
214
|
let scriptImported = false
|
|
215
215
|
self.addEventListener('message', async (e) => {
|
|
216
216
|
const { file, id, imageCompressionLibUrl, options } = e.data
|
|
@@ -229,27 +229,27 @@ self.addEventListener('message', async (e) => {
|
|
|
229
229
|
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
230
230
|
}
|
|
231
231
|
})
|
|
232
|
-
`;let Es;function Vh(e,t){return new Promise(((n,r)=>{Es||(Es=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Wh));const s=new Worker(Es);s.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)s.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void s.terminate();n(a.data.file),s.terminate()}else t.onProgress(a.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function
|
|
232
|
+
`;let Es;function Vh(e,t){return new Promise(((n,r)=>{Es||(Es=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Wh));const s=new Worker(Es);s.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)s.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void s.terminate();n(a.data.file),s.terminate()}else t.onProgress(a.data.progress)})),s.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),s.terminate()})),s.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function je(e,t){return new Promise((function(n,r){let s,o,a,i,m,f;if(s={...t},a=0,{onProgress:i}=s,s.maxSizeMB=s.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof s.useWebWorker!="boolean"||s.useWebWorker,delete s.useWebWorker,s.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Bh))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return To(e,s).then((function(h){try{return o=h,u.call(this)}catch(x){return r(x)}}).bind(this),r);var l=(function(){try{return u.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return To(e,s).then((function(x){try{return o=x,l()}catch(b){return r(b)}}),r)}catch(x){return r(x)}};try{return s.libURL=s.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Vh(e,s).then((function(h){try{return o=h,l()}catch{return c()}}),c)}catch{c()}function u(){try{o.name=e.name,o.lastModified=e.lastModified}catch{}try{s.preserveExif&&e.type==="image/jpeg"&&(!s.fileType||s.fileType&&s.fileType===e.type)&&(o=Yi(e,o))}catch{}return n(o)}}))}je.getDataUrlFromFile=Zi,je.getFilefromDataUrl=jr,je.loadImage=el,je.drawImageInCanvas=nl,je.drawFileInCanvas=Yn,je.canvasToFile=Xn,je.getExifOrientation=sl,je.handleMaxWidthOrHeight=rl,je.followExifOrientation=ol,je.cleanupCanvasMemory=Ye,je.isAutoOrientationInBrowser=Bt,je.approximateBelowMaximumCanvasSizeOfBrowser=tl,je.copyExifWithoutOrientation=Yi,je.getBrowserName=_t,je.version="2.0.2";function Ln(e){return e.type==="tool_call"?e.toolCall.id:e.id}function Gh(e){switch(e.type){case"user_message":return e.content;case"assistant_message":return e.chunks.map(t=>"text"in t?t.text:"").join(`
|
|
233
233
|
`);case"tool_call":{const t=[e.toolCall.title];try{e.toolCall.rawInput&&t.push(JSON.stringify(e.toolCall.rawInput)),e.toolCall.rawOutput&&t.push(JSON.stringify(e.toolCall.rawOutput))}catch{}return t.join(`
|
|
234
234
|
`)}case"plan":return e.entries.map(t=>t.content).join(`
|
|
235
235
|
`);case"command_output":return`${e.inputText}
|
|
236
|
-
${e.outputText}`;default:return""}}function Ay(e,t){const n=t.trim();if(!n)return{matchIds:new Set,orderedMatchIds:[]};const r=n.toLowerCase(),s=[];for(const o of e)Gh(o).toLowerCase().includes(r)&&s.push(Ln(o));return{matchIds:new Set(s),orderedMatchIds:s}}var qh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yt=qh.reduce((e,t)=>{const n=Ea(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Kh=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Yh="VisuallyHidden",al=p.forwardRef((e,t)=>d.jsx(xe.span,{...e,ref:t,style:{...Kh,...e.style}}));al.displayName=Yh;var Xh=al,[cs]=at("Tooltip",[en]),ds=en(),il="TooltipProvider",Qh=700,Ys="tooltip.open",[Jh,Mr]=cs(il),ll=e=>{const{__scopeTooltip:t,delayDuration:n=Qh,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(Jh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:s,children:o})};ll.displayName=il;var fn="Tooltip",[Zh,Cn]=cs(fn),cl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,m=Mr(fn,e.__scopeTooltip),f=ds(t),[l,c]=p.useState(null),u=Pe(),h=p.useRef(0),g=a??m.disableHoverableContent,b=i??m.delayDuration,y=p.useRef(!1),[v,E]=ht({prop:r,defaultProp:s??!1,onChange:T=>{T?(m.onOpen(),document.dispatchEvent(new CustomEvent(Ys))):m.onClose(),o==null||o(T)},caller:fn}),_=p.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,E(!0)},[E]),O=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,E(!1)},[E]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,E(!0),h.current=0},b)},[b,E]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(vr,{...f,children:d.jsx(Zh,{scope:t,contentId:u,open:v,stateAttribute:_,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():A()},[m.isOpenDelayedRef,k,A]),onTriggerLeave:p.useCallback(()=>{g?O():(window.clearTimeout(h.current),h.current=0)},[O,g]),onOpen:A,onClose:O,disableHoverableContent:g,children:n})})};cl.displayName=fn;var Xs="TooltipTrigger",dl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Cn(Xs,n),o=Mr(Xs,n),a=ds(n),i=p.useRef(null),m=Ae(t,i,s.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),d.jsx(rs,{asChild:!0,...a,children:d.jsx(xe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:m,onPointerMove:ne(e.onPointerMove,u=>{u.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),l.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{s.onTriggerLeave(),l.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:ne(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:ne(e.onBlur,s.onClose),onClick:ne(e.onClick,s.onClose)})})});dl.displayName=Xs;var Ir="TooltipPortal",[eg,tg]=cs(Ir,{forceMount:void 0}),ul=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=Cn(Ir,t);return d.jsx(eg,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};ul.displayName=Ir;var Yt="TooltipContent",fl=p.forwardRef((e,t)=>{const n=tg(Yt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,a=Cn(Yt,e.__scopeTooltip);return d.jsx(Ue,{present:r||a.open,children:a.disableHoverableContent?d.jsx(ml,{side:s,...o,ref:t}):d.jsx(ng,{side:s,...o,ref:t})})}),ng=p.forwardRef((e,t)=>{const n=Cn(Yt,e.__scopeTooltip),r=Mr(Yt,e.__scopeTooltip),s=p.useRef(null),o=Ae(t,s),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=s.current,{onPointerInTransitChange:c}=r,u=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,b)=>{const y=g.currentTarget,v={x:g.clientX,y:g.clientY},E=ag(v,y.getBoundingClientRect()),_=ig(v,E),A=lg(b.getBoundingClientRect()),O=dg([..._,...A]);i(O),c(!0)},[c]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&l){const g=y=>h(y,l),b=y=>h(y,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",b),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",b)}}},[m,l,h,u]),p.useEffect(()=>{if(a){const g=b=>{const y=b.target,v={x:b.clientX,y:b.clientY},E=(m==null?void 0:m.contains(y))||(l==null?void 0:l.contains(y)),_=!cg(v,a);E?u():_&&(u(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,u]),d.jsx(ml,{...e,ref:o})}),[sg,rg]=cs(fn,{isInside:!1}),og=Ku("TooltipContent"),ml=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,m=Cn(Yt,n),f=ds(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Ys,l),()=>document.removeEventListener(Ys,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:d.jsxs(br,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(og,{children:r}),d.jsx(sg,{scope:n,isInside:!0,children:d.jsx(Xh,{id:m.contentId,role:"tooltip",children:s||r})})]})})});fl.displayName=Yt;var pl="TooltipArrow",hl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ds(n);return rg(pl,n).isInside?null:d.jsx(yr,{...s,...r,ref:t})});hl.displayName=pl;function ag(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ig(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lg(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function cg(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function dg(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ug(t)}function ug(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var fg=ll,mg=cl,pg=dl,hg=ul,gg=fl,xg=hl;function vg({delayDuration:e=0,...t}){return d.jsx(fg,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function bg({...e}){return d.jsx(vg,{children:d.jsx(mg,{"data-slot":"tooltip",...e})})}function yg({...e}){return d.jsx(pg,{"data-slot":"tooltip-trigger",...e})}function wg({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(hg,{children:d.jsxs(gg,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,d.jsx(xg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Cg=p.lazy(()=>Ne(()=>import("./mermaid-VLURNSYL-CrqI4db6.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Streamdown})));p.createContext(null);const Pr=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(Cg,{className:ee("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Pr.displayName="MessageResponse";var us="Collapsible",[Sg]=at(us),[kg,Dr]=Sg(us),gl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:a,...i}=e,[m,f]=ht({prop:r,defaultProp:s??!1,onChange:a,caller:us});return d.jsx(kg,{scope:n,disabled:o,contentId:Pe(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:d.jsx(xe.div,{"data-state":Lr(m),"data-disabled":o?"":void 0,...i,ref:t})})});gl.displayName=us;var xl="CollapsibleTrigger",vl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Dr(xl,n);return d.jsx(xe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Lr(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ne(e.onClick,s.onOpenToggle)})});vl.displayName=xl;var Or="CollapsibleContent",bl=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Dr(Or,e.__scopeCollapsible);return d.jsx(Ue,{present:n||s.open,children:({present:o})=>d.jsx(Ag,{...r,ref:t,present:o})})});bl.displayName=Or;var Ag=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,a=Dr(Or,n),[i,m]=p.useState(r),f=p.useRef(null),l=Ae(t,f),c=p.useRef(0),u=c.current,h=p.useRef(0),g=h.current,b=a.open||i,y=p.useRef(b),v=p.useRef(void 0);return p.useEffect(()=>{const E=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(E)},[]),nt(()=>{const E=f.current;if(E){v.current=v.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const _=E.getBoundingClientRect();c.current=_.height,h.current=_.width,y.current||(E.style.transitionDuration=v.current.transitionDuration,E.style.animationName=v.current.animationName),m(r)}},[a.open,r]),d.jsx(xe.div,{"data-state":Lr(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!b,...o,ref:l,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:b&&s})});function Lr(e){return e?"open":"closed"}var Eg=gl;function _g({...e}){return d.jsx(Eg,{"data-slot":"collapsible",...e})}function Tg({...e}){return d.jsx(vl,{"data-slot":"collapsible-trigger",...e})}function Rg({...e}){return d.jsx(bl,{"data-slot":"collapsible-content",...e})}const Ng=({children:e,as:t="p",className:n,duration:r=2})=>{const s=kc.create(t);return d.jsx(s,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},jg=p.memo(Ng),yl=p.createContext(null),Mg=()=>{const e=p.useContext(yl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Ig=1e3,Pg=1e3,wl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:s,duration:o,children:a,...i})=>{const[m,f]=ht({prop:n,defaultProp:r,onChange:s}),[l,c]=ht({prop:o,defaultProp:void 0}),[u,h]=p.useState(!1),[g,b]=p.useState(null);p.useEffect(()=>{t?g===null&&b(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/Pg)),b(null))},[t,g,c]);const y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!y&&r&&!t&&m&&!u){const E=setTimeout(()=>{f(!1),h(!0)},Ig);return()=>clearTimeout(E)}},[t,m,r,f,u,y]);const v=E=>{f(E)};return d.jsx(yl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:d.jsx(_g,{className:ee("not-prose mb-4",e),onOpenChange:v,open:m,...i,children:a})})}),Dg=(e,t)=>e||t===0?d.jsx(jg,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),Cl=p.memo(({className:e,children:t,getThinkingMessage:n=Dg,...r})=>{const{isStreaming:s,isOpen:o,duration:a}=Mg();return d.jsx(Tg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??d.jsxs(d.Fragment,{children:[d.jsx(_d,{className:"size-4"}),n(s,a),d.jsx(Qt,{className:ee("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),Sl=p.memo(({className:e,children:t,...n})=>d.jsx(Rg,{className:ee("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));wl.displayName="Reasoning";Cl.displayName="ReasoningTrigger";Sl.displayName="ReasoningContent";const _s=200;function Og({entry:e,onRewind:t,onRewindAndEdit:n}){const[r,s]=p.useState(!1),[o,a]=p.useState(!1),i=p.useRef(null),m=p.useCallback(()=>{const f=i.current;f&&a(f.scrollHeight>_s+4)},[]);return p.useEffect(()=>{m()},[m,e.content]),d.jsxs("div",{className:"group/user flex justify-end items-start gap-2",children:[(t||n)&&d.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/user:opacity-100",children:[t&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("message.rewindHere"),children:d.jsx(Au,{className:"h-3.5 w-3.5"})}),n&&d.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("message.rewindEdit"),children:d.jsx(va,{className:"h-3.5 w-3.5"})})]}),d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((f,l)=>d.jsx(Fg,{image:f},l))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((f,l)=>d.jsx($g,{attachment:f},l))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:i,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!r&&o&&`max-h-[${_s}px]`),style:!r&&o?{maxHeight:`${_s}px`}:void 0,children:gd(e.content)}),!r&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:V("message.expand")}),d.jsx(Qt,{className:"h-3 w-3"})]})})]})]})]})}function Lg({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const s=r===e.chunks.length-1,o=t&&s;return d.jsxs(wl,{isStreaming:o,children:[d.jsx(Cl,{}),d.jsx(Sl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(Pr,{children:n.text})},r)})]})]})}function Fg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function $g({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{switch(e.kind){case"text":return d.jsx(Gt,{className:"h-4 w-4"});case"table":return d.jsx(lr,{className:"h-4 w-4"});case"directory":return d.jsx(ir,{className:"h-4 w-4"});default:return d.jsx(Gt,{className:"h-4 w-4"})}})(),s=e.size!=null?Ug(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[s&&d.jsx("span",{children:s}),s&&o!=null&&d.jsx("span",{children:" · "}),o!=null&&d.jsx("span",{children:we("chat.fileCount",{n:o})})]})]}),a&&d.jsx(Qt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Ug(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const zg=new Set(["FileEditTool","Edit","SedEdit"]),Hg=new Set(["FileWriteTool","Write"]),Bg=new Set(["MultiEdit"]),Wg=new Set(["BashTool","Bash","PowerShellTool"]);function Vg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function Ke(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function Gg(e,t,n={}){if(zg.has(e)){const r=Ke(t,["old_string","oldString"]),s=Ke(t,["new_string","newString"]);return r===void 0||s===void 0?null:[{filePath:Ke(t,["file_path","filePath"])??e,oldString:r,newString:s}]}if(Hg.has(e)){const r=Ke(t,["file_path","filePath"]),s=Ke(t,["content"]);if(r===void 0||s===void 0)return null;const o=n.writeOldContent;return[{filePath:r,oldString:o??"",newString:s,label:o===void 0?n.writeUnknownLabel:void 0}]}if(Bg.has(e)){const r=t.edits;if(!Array.isArray(r)||r.length===0)return null;const s=Ke(t,["file_path","filePath"])??e,o=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=Ke(m,["old_string","oldString"]),l=Ke(m,["new_string","newString"]);f===void 0||l===void 0||o.push({filePath:s,oldString:f,newString:l,label:`#${a+1}`})}return o.length>0?o:null}return null}function qg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Kg(e){switch(e){case"allow_once":case"allow_always":return"bg-approve text-white hover:bg-approve-hover";default:return""}}function Yg(e){switch(e){case"allow_once":case"allow_always":return d.jsx(pn,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(hn,{className:"size-4"});default:return null}}function Xg({requestId:e,options:t,onRespond:n,className:r}){tn();const s=o=>{n(e,o.optionId,o.kind)};return d.jsxs("div",{className:ee("p-3 border-t border-approve/30 bg-approve/5",r),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(ya,{className:"size-4 text-approve-text"}),d.jsx("span",{className:"text-xs font-medium font-display text-approve-text",children:V("permission.required")})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(o=>d.jsxs(Pt,{variant:qg(o.kind),size:"sm",onClick:()=>s(o),className:ee("gap-1.5 font-display",Kg(o.kind)),children:[Yg(o.kind),o.name]},o.optionId))})]})}const Ro=1e3,Qg=1e6;function Jg({filePath:e,oldString:t,newString:n,label:r}){const s=ex(t,n),o=jo(s,"add"),a=jo(s,"remove"),i=s.length>Ro?s.slice(0,Ro):s,m=s.length-i.length;return d.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[d.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),o>0&&d.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",o]}),a>0&&d.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),r&&d.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),d.jsxs("div",{role:"list","aria-label":we("diff.aria",{path:e,added:o,removed:a}),className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>d.jsx(Zg,{line:f},l)),m>0&&d.jsx("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:we("diff.hidden",{n:m})})]})]})}function Zg({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return d.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?we("diff.addedLine",{text:e.text}):e.type==="remove"?we("diff.removedLine",{text:e.text}):void 0,className:ee("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[d.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),d.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function No(e){return e.length===0?[]:e.split(`
|
|
236
|
+
${e.outputText}`;default:return""}}function ky(e,t){const n=t.trim();if(!n)return{matchIds:new Set,orderedMatchIds:[]};const r=n.toLowerCase(),s=[];for(const o of e)Gh(o).toLowerCase().includes(r)&&s.push(Ln(o));return{matchIds:new Set(s),orderedMatchIds:s}}var qh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yt=qh.reduce((e,t)=>{const n=Ea(`Primitive.${t}`),r=p.forwardRef((s,o)=>{const{asChild:a,...i}=s,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(m,{...i,ref:o})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Kh=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Yh="VisuallyHidden",al=p.forwardRef((e,t)=>d.jsx(xe.span,{...e,ref:t,style:{...Kh,...e.style}}));al.displayName=Yh;var Xh=al,[cs]=at("Tooltip",[en]),ds=en(),il="TooltipProvider",Qh=700,Ys="tooltip.open",[Jh,Mr]=cs(il),ll=e=>{const{__scopeTooltip:t,delayDuration:n=Qh,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:o}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),d.jsx(Jh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:s,children:o})};ll.displayName=il;var fn="Tooltip",[Zh,Cn]=cs(fn),cl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:o,disableHoverableContent:a,delayDuration:i}=e,m=Mr(fn,e.__scopeTooltip),f=ds(t),[l,c]=p.useState(null),u=Pe(),h=p.useRef(0),x=a??m.disableHoverableContent,b=i??m.delayDuration,y=p.useRef(!1),[v,E]=ht({prop:r,defaultProp:s??!1,onChange:T=>{T?(m.onOpen(),document.dispatchEvent(new CustomEvent(Ys))):m.onClose(),o==null||o(T)},caller:fn}),_=p.useMemo(()=>v?y.current?"delayed-open":"instant-open":"closed",[v]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,E(!0)},[E]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,E(!1)},[E]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,E(!0),h.current=0},b)},[b,E]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(vr,{...f,children:d.jsx(Zh,{scope:t,contentId:u,open:v,stateAttribute:_,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?A():k()},[m.isOpenDelayedRef,A,k]),onTriggerLeave:p.useCallback(()=>{x?L():(window.clearTimeout(h.current),h.current=0)},[L,x]),onOpen:k,onClose:L,disableHoverableContent:x,children:n})})};cl.displayName=fn;var Xs="TooltipTrigger",dl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Cn(Xs,n),o=Mr(Xs,n),a=ds(n),i=p.useRef(null),m=Ae(t,i,s.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),d.jsx(rs,{asChild:!0,...a,children:d.jsx(xe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:m,onPointerMove:ne(e.onPointerMove,u=>{u.pointerType!=="touch"&&!l.current&&!o.isPointerInTransitRef.current&&(s.onTriggerEnter(),l.current=!0)}),onPointerLeave:ne(e.onPointerLeave,()=>{s.onTriggerLeave(),l.current=!1}),onPointerDown:ne(e.onPointerDown,()=>{s.open&&s.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:ne(e.onFocus,()=>{f.current||s.onOpen()}),onBlur:ne(e.onBlur,s.onClose),onClick:ne(e.onClick,s.onClose)})})});dl.displayName=Xs;var Ir="TooltipPortal",[eg,tg]=cs(Ir,{forceMount:void 0}),ul=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,o=Cn(Ir,t);return d.jsx(eg,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};ul.displayName=Ir;var Yt="TooltipContent",fl=p.forwardRef((e,t)=>{const n=tg(Yt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...o}=e,a=Cn(Yt,e.__scopeTooltip);return d.jsx(Ue,{present:r||a.open,children:a.disableHoverableContent?d.jsx(ml,{side:s,...o,ref:t}):d.jsx(ng,{side:s,...o,ref:t})})}),ng=p.forwardRef((e,t)=>{const n=Cn(Yt,e.__scopeTooltip),r=Mr(Yt,e.__scopeTooltip),s=p.useRef(null),o=Ae(t,s),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=s.current,{onPointerInTransitChange:c}=r,u=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((x,b)=>{const y=x.currentTarget,v={x:x.clientX,y:x.clientY},E=ag(v,y.getBoundingClientRect()),_=ig(v,E),k=lg(b.getBoundingClientRect()),L=dg([..._,...k]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>u(),[u]),p.useEffect(()=>{if(m&&l){const x=y=>h(y,l),b=y=>h(y,m);return m.addEventListener("pointerleave",x),l.addEventListener("pointerleave",b),()=>{m.removeEventListener("pointerleave",x),l.removeEventListener("pointerleave",b)}}},[m,l,h,u]),p.useEffect(()=>{if(a){const x=b=>{const y=b.target,v={x:b.clientX,y:b.clientY},E=(m==null?void 0:m.contains(y))||(l==null?void 0:l.contains(y)),_=!cg(v,a);E?u():_&&(u(),f())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[m,l,a,f,u]),d.jsx(ml,{...e,ref:o})}),[sg,rg]=cs(fn,{isInside:!1}),og=Ku("TooltipContent"),ml=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:o,onPointerDownOutside:a,...i}=e,m=Cn(Yt,n),f=ds(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Ys,l),()=>document.removeEventListener(Ys,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=u=>{const h=u.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:d.jsxs(br,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(og,{children:r}),d.jsx(sg,{scope:n,isInside:!0,children:d.jsx(Xh,{id:m.contentId,role:"tooltip",children:s||r})})]})})});fl.displayName=Yt;var pl="TooltipArrow",hl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=ds(n);return rg(pl,n).isInside?null:d.jsx(yr,{...s,...r,ref:t})});hl.displayName=pl;function ag(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,s,o)){case o:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ig(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function lg(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function cg(e,t){const{x:n,y:r}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],m=t[a],f=i.x,l=i.y,c=m.x,u=m.y;l>r!=u>r&&n<(c-f)*(r-l)/(u-l)+f&&(s=!s)}return s}function dg(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ug(t)}function ug(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const o=t[t.length-1],a=t[t.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const o=n[n.length-1],a=n[n.length-2];if((o.x-a.x)*(s.y-a.y)>=(o.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var fg=ll,mg=cl,pg=dl,hg=ul,gg=fl,xg=hl;function vg({delayDuration:e=0,...t}){return d.jsx(fg,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function bg({...e}){return d.jsx(vg,{children:d.jsx(mg,{"data-slot":"tooltip",...e})})}function yg({...e}){return d.jsx(pg,{"data-slot":"tooltip-trigger",...e})}function wg({className:e,sideOffset:t=0,children:n,...r}){return d.jsx(hg,{children:d.jsxs(gg,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,d.jsx(xg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Cg=p.lazy(()=>Me(()=>import("./mermaid-VLURNSYL-BAWTa5p7.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.Streamdown})));p.createContext(null);const Pr=p.memo(({className:e,children:t,...n})=>d.jsx(p.Suspense,{fallback:d.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:d.jsx(Cg,{className:ee("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Pr.displayName="MessageResponse";var us="Collapsible",[Sg]=at(us),[kg,Dr]=Sg(us),gl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:o,onOpenChange:a,...i}=e,[m,f]=ht({prop:r,defaultProp:s??!1,onChange:a,caller:us});return d.jsx(kg,{scope:n,disabled:o,contentId:Pe(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:d.jsx(xe.div,{"data-state":Lr(m),"data-disabled":o?"":void 0,...i,ref:t})})});gl.displayName=us;var xl="CollapsibleTrigger",vl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=Dr(xl,n);return d.jsx(xe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Lr(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:ne(e.onClick,s.onOpenToggle)})});vl.displayName=xl;var Or="CollapsibleContent",bl=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Dr(Or,e.__scopeCollapsible);return d.jsx(Ue,{present:n||s.open,children:({present:o})=>d.jsx(Ag,{...r,ref:t,present:o})})});bl.displayName=Or;var Ag=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...o}=e,a=Dr(Or,n),[i,m]=p.useState(r),f=p.useRef(null),l=Ae(t,f),c=p.useRef(0),u=c.current,h=p.useRef(0),x=h.current,b=a.open||i,y=p.useRef(b),v=p.useRef(void 0);return p.useEffect(()=>{const E=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(E)},[]),nt(()=>{const E=f.current;if(E){v.current=v.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const _=E.getBoundingClientRect();c.current=_.height,h.current=_.width,y.current||(E.style.transitionDuration=v.current.transitionDuration,E.style.animationName=v.current.animationName),m(r)}},[a.open,r]),d.jsx(xe.div,{"data-state":Lr(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!b,...o,ref:l,style:{"--radix-collapsible-content-height":u?`${u}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:b&&s})});function Lr(e){return e?"open":"closed"}var Eg=gl;function _g({...e}){return d.jsx(Eg,{"data-slot":"collapsible",...e})}function Tg({...e}){return d.jsx(vl,{"data-slot":"collapsible-trigger",...e})}function Rg({...e}){return d.jsx(bl,{"data-slot":"collapsible-content",...e})}const Ng=({children:e,as:t="p",className:n,duration:r=2})=>{const s=kc.create(t);return d.jsx(s,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},jg=p.memo(Ng),yl=p.createContext(null),Mg=()=>{const e=p.useContext(yl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Ig=1e3,Pg=1e3,wl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:s,duration:o,children:a,...i})=>{const[m,f]=ht({prop:n,defaultProp:r,onChange:s}),[l,c]=ht({prop:o,defaultProp:void 0}),[u,h]=p.useState(!1),[x,b]=p.useState(null);p.useEffect(()=>{t?x===null&&b(Date.now()):x!==null&&(c(Math.ceil((Date.now()-x)/Pg)),b(null))},[t,x,c]);const y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!y&&r&&!t&&m&&!u){const E=setTimeout(()=>{f(!1),h(!0)},Ig);return()=>clearTimeout(E)}},[t,m,r,f,u,y]);const v=E=>{f(E)};return d.jsx(yl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:d.jsx(_g,{className:ee("not-prose mb-4",e),onOpenChange:v,open:m,...i,children:a})})}),Dg=(e,t)=>e||t===0?d.jsx(jg,{duration:1,children:"Thinking..."}):t===void 0?d.jsx("p",{children:"Thought for a few seconds"}):d.jsxs("p",{children:["Thought for ",t," seconds"]}),Cl=p.memo(({className:e,children:t,getThinkingMessage:n=Dg,...r})=>{const{isStreaming:s,isOpen:o,duration:a}=Mg();return d.jsx(Tg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??d.jsxs(d.Fragment,{children:[d.jsx(_d,{className:"size-4"}),n(s,a),d.jsx(Qt,{className:ee("size-4 transition-transform",o?"rotate-180":"rotate-0")})]})})}),Sl=p.memo(({className:e,children:t,...n})=>d.jsx(Rg,{className:ee("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));wl.displayName="Reasoning";Cl.displayName="ReasoningTrigger";Sl.displayName="ReasoningContent";const _s=200;function Og({entry:e,onRewind:t,onRewindAndEdit:n}){const[r,s]=p.useState(!1),[o,a]=p.useState(!1),i=p.useRef(null),m=p.useCallback(()=>{const f=i.current;f&&a(f.scrollHeight>_s+4)},[]);return p.useEffect(()=>{m()},[m,e.content]),d.jsxs("div",{className:"group/user flex justify-end items-start gap-2",children:[(t||n)&&d.jsxs("div",{className:"mt-1 flex items-center gap-0.5 opacity-0 transition-opacity group-hover/user:opacity-100",children:[t&&d.jsx("button",{type:"button",onClick:t,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("message.rewindHere"),children:d.jsx(Au,{className:"h-3.5 w-3.5"})}),n&&d.jsx("button",{type:"button",onClick:n,className:"rounded-md p-1.5 text-text-muted hover:bg-surface-2 hover:text-text-primary transition-colors",title:V("message.rewindEdit"),children:d.jsx(va,{className:"h-3.5 w-3.5"})})]}),d.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((f,l)=>d.jsx(Fg,{image:f},l))}),e.attachments&&e.attachments.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((f,l)=>d.jsx($g,{attachment:f},l))}),e.content&&d.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[d.jsx("div",{ref:i,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!r&&o&&`max-h-[${_s}px]`),style:!r&&o?{maxHeight:`${_s}px`}:void 0,children:gd(e.content)}),!r&&o&&d.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:d.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[d.jsx("span",{children:V("message.expand")}),d.jsx(Qt,{className:"h-3 w-3"})]})})]})]})]})}function Lg({entry:e,isStreaming:t}){return d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[d.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const s=r===e.chunks.length-1,o=t&&s;return d.jsxs(wl,{isStreaming:o,children:[d.jsx(Cl,{}),d.jsx(Sl,{children:d.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return d.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:d.jsx(Pr,{children:n.text})},r)})]})]})}function Fg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return d.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:d.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function $g({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{switch(e.kind){case"text":return d.jsx(Gt,{className:"h-4 w-4"});case"table":return d.jsx(lr,{className:"h-4 w-4"});case"directory":return d.jsx(ir,{className:"h-4 w-4"});default:return d.jsx(Gt,{className:"h-4 w-4"})}})(),s=e.size!=null?Ug(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return d.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[d.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,d.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[d.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),d.jsxs("div",{className:"text-[10px] text-text-muted",children:[s&&d.jsx("span",{children:s}),s&&o!=null&&d.jsx("span",{children:" · "}),o!=null&&d.jsx("span",{children:we("chat.fileCount",{n:o})})]})]}),a&&d.jsx(Qt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&d.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:d.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Ug(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const zg=new Set(["FileEditTool","Edit","SedEdit"]),Hg=new Set(["FileWriteTool","Write"]),Bg=new Set(["MultiEdit"]),Wg=new Set(["BashTool","Bash","PowerShellTool"]);function Vg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function Ke(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function Gg(e,t,n={}){if(zg.has(e)){const r=Ke(t,["old_string","oldString"]),s=Ke(t,["new_string","newString"]);return r===void 0||s===void 0?null:[{filePath:Ke(t,["file_path","filePath"])??e,oldString:r,newString:s}]}if(Hg.has(e)){const r=Ke(t,["file_path","filePath"]),s=Ke(t,["content"]);if(r===void 0||s===void 0)return null;const o=n.writeOldContent;return[{filePath:r,oldString:o??"",newString:s,label:o===void 0?n.writeUnknownLabel:void 0}]}if(Bg.has(e)){const r=t.edits;if(!Array.isArray(r)||r.length===0)return null;const s=Ke(t,["file_path","filePath"])??e,o=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=Ke(m,["old_string","oldString"]),l=Ke(m,["new_string","newString"]);f===void 0||l===void 0||o.push({filePath:s,oldString:f,newString:l,label:`#${a+1}`})}return o.length>0?o:null}return null}function qg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Kg(e){switch(e){case"allow_once":case"allow_always":return"bg-approve text-white hover:bg-approve-hover";default:return""}}function Yg(e){switch(e){case"allow_once":case"allow_always":return d.jsx(pn,{className:"size-4"});case"reject_once":case"reject_always":return d.jsx(hn,{className:"size-4"});default:return null}}function Xg({requestId:e,options:t,onRespond:n,className:r}){tn();const s=o=>{n(e,o.optionId,o.kind)};return d.jsxs("div",{className:ee("p-3 border-t border-approve/30 bg-approve/5",r),children:[d.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[d.jsx(ya,{className:"size-4 text-approve-text"}),d.jsx("span",{className:"text-xs font-medium font-display text-approve-text",children:V("permission.required")})]}),d.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(o=>d.jsxs(Pt,{variant:qg(o.kind),size:"sm",onClick:()=>s(o),className:ee("gap-1.5 font-display",Kg(o.kind)),children:[Yg(o.kind),o.name]},o.optionId))})]})}const Ro=1e3,Qg=1e6;function Jg({filePath:e,oldString:t,newString:n,label:r}){const s=ex(t,n),o=jo(s,"add"),a=jo(s,"remove"),i=s.length>Ro?s.slice(0,Ro):s,m=s.length-i.length;return d.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[d.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[d.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),o>0&&d.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",o]}),a>0&&d.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),r&&d.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),d.jsxs("div",{role:"list","aria-label":we("diff.aria",{path:e,added:o,removed:a}),className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>d.jsx(Zg,{line:f},l)),m>0&&d.jsx("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:we("diff.hidden",{n:m})})]})]})}function Zg({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return d.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?we("diff.addedLine",{text:e.text}):e.type==="remove"?we("diff.removedLine",{text:e.text}):void 0,className:ee("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[d.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),d.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function No(e){return e.length===0?[]:e.split(`
|
|
237
237
|
`)}function jo(e,t){let n=0;for(const r of e)r.type===t&&n++;return n}function ex(e,t){const n=No(e),r=No(t);let s=0;for(;s<n.length&&s<r.length&&n[s]===r[s];)s++;let o=n.length,a=r.length;for(;o>s&&a>s&&n[o-1]===r[a-1];)o--,a--;const i=[];for(let m=0;m<s;m++)i.push({type:"context",text:n[m]});tx(n.slice(s,o),r.slice(s,a),i);for(let m=o;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function tx(e,t,n){const r=e.length,s=t.length;if(r===0&&s===0)return;if(r*s>Qg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const o=s+1,a=new Uint32Array((r+1)*o);for(let f=r-1;f>=0;f--)for(let l=s-1;l>=0;l--)a[f*o+l]=e[f]===t[l]?a[(f+1)*o+l+1]+1:Math.max(a[(f+1)*o+l],a[f*o+l+1]);let i=0,m=0;for(;i<r&&m<s;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*o+m]>=a[i*o+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<r;)n.push({type:"remove",text:e[i]}),i++;for(;m<s;)n.push({type:"add",text:t[m]}),m++}function kl({entries:e,onPermissionRespond:t}){const[n,r]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return d.jsx("div",{className:"pl-10",children:d.jsx(Mo,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const s=ax(e);return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand-text font-bold hover:bg-brand/10 transition-colors",onClick:()=>r(!n),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs text-brand-text font-bold font-display",children:s})]}),n&&d.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((o,a)=>d.jsx(Mo,{tool:o.toolCall,compact:!0,onPermissionRespond:t},o.toolCall.id||a))})]})})}function Mo({tool:e,compact:t,onPermissionRespond:n}){const[r,s]=p.useState(!t),o=(()=>{switch(e.status){case"running":return d.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return d.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return d.jsx("span",{className:"text-brand-text text-[10px]",children:"⍻"});case"canceled":return d.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return d.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Al(e);return d.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[d.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>s(!r),children:[o,d.jsx("span",{className:"text-xs font-display font-bold text-brand-text transition-colors truncate",children:e.title}),e.status==="running"&&d.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&d.jsx("div",{className:"mt-1.5 ml-4",children:d.jsx(Xg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&d.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:rx(e)??d.jsxs(d.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&d.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Rt(JSON.stringify(e.rawInput,null,2),2e3)}),a&&d.jsx(_l,{tool:e})]})})]})}const nx=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],sx=["output","stdout","stderr","result"];function rx(e){const t=Vg(e.title),n=e.rawInput??{},r=Gg(t,n,{writeOldContent:Ke(e.rawOutput??{},nx),writeUnknownLabel:V("tool.newFile")});if(r)return d.jsxs(d.Fragment,{children:[r.map((s,o)=>d.jsx(Jg,{filePath:s.filePath,oldString:s.oldString,newString:s.newString,label:s.label},o)),Al(e)&&d.jsx(_l,{tool:e})]});if(Wg.has(t)){const s=Ke(n,["command","cmd","script"]),o=lx(e);return s===void 0&&o.length===0?null:d.jsx(ox,{command:s!==void 0?Rt(s,500):void 0,output:o,isError:e.status==="error"})}return null}function ox({command:e,output:t,isError:n}){return d.jsx("div",{className:ee("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:d.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&d.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&d.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function ax(e){const t=new Map;for(const r of e){const s=ix(r.toolCall.title);t.set(s,(t.get(s)||0)+1)}const n=[];for(const[r,s]of t)n.push(s===1?r:we("tool.callTimes",{n:s,name:r}));return n.length===0?we("tool.summaryCalls",{n:e.length}):n.length===1?n[0]:we("tool.summaryTools",{n:e.length,names:n.join("、")})}function ix(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Al(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function El(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function lx(e){const t=El(e);if(t.length>0)return Rt(t.join(`
|
|
238
238
|
`),2e3);const n=e.rawOutput;if(n){for(const r of sx){const s=n[r];if(typeof s=="string"&&s.length>0)return Rt(s,2e3)}if(Object.keys(n).length>0)return Rt(JSON.stringify(n,null,2),2e3)}return""}function _l({tool:e}){return d.jsx("pre",{className:ee("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:cx(e)})}function cx(e){const t=El(e);return t.length>0?Rt(t.join(`
|
|
239
239
|
`),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Rt(JSON.stringify(e.rawOutput,null,2),2e3):""}function Rt(e,t){return e.length>t?e.slice(0,t)+"...":e}function dx({entry:e}){const[t,n]=p.useState(!1),{entries:r}=e;if(r.length===0)return null;const s=r.filter(i=>i.status==="completed").length,o=r.length,a=o>0?Math.round(s/o*100):0;return d.jsx("div",{className:"pl-10",children:d.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[d.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[d.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:d.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),d.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:V("plan.title")}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[s,"/",o]}),d.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:d.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),d.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&d.jsx("div",{className:ee("border-t border-border px-3 py-1.5 space-y-0.5",o>5&&"max-h-64 overflow-y-auto"),children:r.map((i,m)=>d.jsx(ux,{entry:i},m))})]})})}function ux({entry:e}){return d.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[d.jsx("span",{className:"flex-shrink-0 mt-0.5",children:d.jsx(fx,{status:e.status})}),d.jsx("span",{className:ee("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),d.jsx(mx,{priority:e.priority})]})}function fx({status:e}){switch(e){case"completed":return d.jsx(Pd,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return d.jsx(ga,{className:"h-3.5 w-3.5 text-brand-text animate-spin",style:{animationDuration:"2s"}});case"pending":return d.jsx(Od,{className:"h-3.5 w-3.5 text-text-muted"})}}function mx({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand-text dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:V("plan.priority.high"),medium:V("plan.priority.medium"),low:V("plan.priority.low")};return d.jsx("span",{className:ee("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function px({entry:e}){const t=e.variant==="error";return d.jsxs("div",{className:"w-full",children:[d.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),d.jsxs("div",{className:"pt-3",children:[d.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand-text"),children:e.title}),e.subtitle&&d.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),d.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:d.jsx(Pr,{children:e.outputText})}),d.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:V("chat.cmdDone")})]})}/*!---------------------------------------------------------------------------------------------
|
|
240
240
|
* Copyright (c) StackBlitz. All rights reserved.
|
|
241
241
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
242
|
-
*--------------------------------------------------------------------------------------------*/const hx={damping:.7,stiffness:.05,mass:1.25},gx=70,xx=1e3/60,vx=350;let fs=!1;var Ko;(Ko=globalThis.document)==null||Ko.addEventListener("mousedown",()=>{fs=!0});var Yo;(Yo=globalThis.document)==null||Yo.addEventListener("mouseup",()=>{fs=!1});var Xo;(Xo=globalThis.document)==null||Xo.addEventListener("click",()=>{fs=!1});const bx=(e={})=>{const[t,n]=p.useState(!1),[r,s]=p.useState(e.initial!==!1),[o,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var
|
|
242
|
+
*--------------------------------------------------------------------------------------------*/const hx={damping:.7,stiffness:.05,mass:1.25},gx=70,xx=1e3/60,vx=350;let fs=!1;var Ko;(Ko=globalThis.document)==null||Ko.addEventListener("mousedown",()=>{fs=!0});var Yo;(Yo=globalThis.document)==null||Yo.addEventListener("mouseup",()=>{fs=!1});var Xo;(Xo=globalThis.document)==null||Xo.addEventListener("click",()=>{fs=!1});const bx=(e={})=>{const[t,n]=p.useState(!1),[r,s]=p.useState(e.initial!==!1),[o,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var k;if(!fs)return!1;const E=window.getSelection();if(!E||!E.rangeCount)return!1;const _=E.getRangeAt(0);return _.commonAncestorContainer.contains(y.current)||((k=y.current)==null?void 0:k.contains(_.commonAncestorContainer))},[]),f=p.useCallback(E=>{c.isAtBottom=E,s(E)},[]),l=p.useCallback(E=>{c.escapedFromLock=E,n(E)},[]),c=p.useMemo(()=>{let E;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var _;return((_=y.current)==null?void 0:_.scrollTop)??0},set scrollTop(_){if(y.current){const{scrollBehavior:k}=getComputedStyle(y.current);k!=="auto"&&(y.current.style.scrollBehavior="auto"),y.current.scrollTop=_,c.ignoreScrollToTop=y.current.scrollTop,k!=="auto"&&(y.current.style.scrollBehavior=k)}},get targetScrollTop(){return!y.current||!v.current?0:y.current.scrollHeight-1-y.current.clientHeight},get calculatedTargetScrollTop(){if(!y.current||!v.current)return 0;const{targetScrollTop:_}=this;if(!e.targetScrollTop)return _;if((E==null?void 0:E.targetScrollTop)===_)return E.calculatedScrollTop;const k=Math.max(Math.min(e.targetScrollTop(_,{scrollElement:y.current,contentElement:v.current}),_),0);return E={targetScrollTop:_,calculatedScrollTop:k},requestAnimationFrame(()=>{E=void 0}),k},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=gx}}},[]),u=p.useCallback((E={})=>{var w;typeof E=="string"&&(E={animation:E}),E.preserveScrollPosition||f(!0);const _=Date.now()+(Number(E.wait)||0),k=Rs(i.current,E.animation),{ignoreEscapes:L=!1}=E;let A,T=c.calculatedTargetScrollTop;E.duration instanceof Promise?E.duration.finally(()=>{A=Date.now()}):A=_+(E.duration??0);const g=async()=>{const N=new Promise(requestAnimationFrame).then(()=>{var j;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:P}=c,D=performance.now(),F=(D-(c.lastTick??D))/xx;if(c.animation||(c.animation={behavior:k,promise:N,ignoreEscapes:L}),c.animation.behavior===k&&(c.lastTick=D),m()||_>Date.now())return g();if(P<Math.min(T,c.calculatedTargetScrollTop)){if(((j=c.animation)==null?void 0:j.behavior)===k){if(k==="instant")return c.scrollTop=c.calculatedTargetScrollTop,g();c.velocity=(k.damping*c.velocity+k.stiffness*c.scrollDifference)/k.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==P&&(c.accumulated=0)}return g()}return A>Date.now()?(T=c.calculatedTargetScrollTop,g()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?u({animation:Rs(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,A-Date.now())||void 0}):c.isAtBottom)});return N.then(P=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),P))};return E.wait!==!0&&(c.animation=void 0),((w=c.animation)==null?void 0:w.behavior)===k?c.animation.promise:g()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),x=p.useCallback(({target:E})=>{if(E!==y.current)return;const{scrollTop:_,ignoreScrollToTop:k}=c;let{lastScrollTop:L=_}=c;c.lastScrollTop=_,c.ignoreScrollToTop=void 0,k&&k>_&&(L=k),a(c.isNearBottom),setTimeout(()=>{var g;if(c.resizeDifference||_===k)return;if(m()){l(!0),f(!1);return}const A=_>L,T=_<L;if((g=c.animation)!=null&&g.ignoreEscapes){c.scrollTop=L;return}T&&(l(!0),f(!1)),A&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),b=p.useCallback(({target:E,deltaY:_})=>{var L;let k=E;for(;!["scroll","auto"].includes(getComputedStyle(k).overflow);){if(!k.parentElement)return;k=k.parentElement}k===y.current&&_<0&&y.current.scrollHeight>y.current.clientHeight&&!((L=c.animation)!=null&&L.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),y=Io(E=>{var _,k;(_=y.current)==null||_.removeEventListener("scroll",x),(k=y.current)==null||k.removeEventListener("wheel",b),E==null||E.addEventListener("scroll",x,{passive:!0}),E==null||E.addEventListener("wheel",b,{passive:!0})},[]),v=Io(E=>{var k,L;if((k=c.resizeObserver)==null||k.disconnect(),!E)return;let _;c.resizeObserver=new ResizeObserver(([A])=>{const{height:T}=A.contentRect,g=T-(_??T);if(c.resizeDifference=g,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),g>=0){const w=Rs(i.current,_?i.current.resize:i.current.initial);u({animation:w,wait:!0,preserveScrollPosition:!0,duration:w==="instant"?void 0:vx})}else c.isNearBottom&&(l(!1),f(!0));_=T,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===g&&(c.resizeDifference=0)},1)})}),(L=c.resizeObserver)==null||L.observe(E)},[]);return{contentRef:v,scrollRef:y,scrollToBottom:u,stopScroll:h,isAtBottom:r||o,isNearBottom:o,escapedFromLock:t,state:c}};function Io(e,t){const n=p.useCallback(r=>(n.current=r,e(r)),t);return n}const Ts=new Map;function Rs(...e){const t={...hx};let n=!1;for(const s of e){if(s==="instant"){n=!0;continue}typeof s=="object"&&(n=!1,t.damping=s.damping??t.damping,t.stiffness=s.stiffness??t.stiffness,t.mass=s.mass??t.mass)}const r=JSON.stringify(t);return Ts.has(r)||Ts.set(r,Object.freeze(t)),n?"instant":Ts.get(r)}/*!---------------------------------------------------------------------------------------------
|
|
243
243
|
* Copyright (c) StackBlitz. All rights reserved.
|
|
244
244
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
245
|
-
*--------------------------------------------------------------------------------------------*/const Tl=p.createContext(null),yx=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Qn({instance:e,children:t,resize:n,initial:r,mass:s,damping:o,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((O,k)=>{const T=(A==null?void 0:A.targetScrollTop)??i;return(T==null?void 0:T(O,k))??O},[i]),u=bx({mass:s,damping:o,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:b,stopScroll:y,isAtBottom:v,escapedFromLock:E,state:_}=e??u,A=p.useMemo(()=>({scrollToBottom:b,stopScroll:y,scrollRef:h,isAtBottom:v,escapedFromLock:E,contentRef:g,state:_,get targetScrollTop(){return l.current},set targetScrollTop(O){l.current=O}}),[b,v,g,h,y,E,_]);return p.useImperativeHandle(m,()=>A,[A]),yx(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Tl.Provider,{value:A},p.createElement("div",{...f},typeof t=="function"?t(A):t))}(function(e){function t({children:n,scrollClassName:r,...s}){const o=Fr();return p.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...s,ref:o.contentRef},typeof n=="function"?n(o):n))}e.Content=t})(Qn||(Qn={}));function Fr(){const e=p.useContext(Tl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const wx=({className:e,...t})=>d.jsx(Qn,{className:ee("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Cx=({className:e,...t})=>d.jsx(Qn.Content,{className:ee("mx-auto flex page-measure flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),Sx=({className:e,title:t=V("common.emptyTitle"),description:n=V("common.emptyDescription"),icon:r,children:s,...o})=>d.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...o,children:s??d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:"text-text-muted",children:r}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),kx=({className:e,...t})=>{const{scrollToBottom:n}=Fr(),r=p.useCallback(()=>{n()},[n]);return d.jsx(Pt,{className:ee("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Ad,{className:"size-4"})})},Ax="data-last-user-message",Ex=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${Ax}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(Pt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(Ca,{className:"size-4"})})},_x=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Fr();return r?null:d.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(Ex,{}),d.jsx(kx,{})]})};function Tx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r,emptyDescription:s,searchMatchIds:o,onRewindEntry:a}){var h;const i=jx(e),m=e.length>0;let f=-1;for(let g=i.length-1;g>=0;g--){const b=i[g];if(b.type==="single"&&b.entry.type==="user_message"){f=g;break}}const l=t&&e.length>0&&((h=e[e.length-1])==null?void 0:h.type)==="user_message",c=!!o&&o.size>0,u=g=>c&&!o.has(Ln(g));return d.jsx(wx,{className:"flex-1",children:d.jsxs(Cx,{children:[m?d.jsxs(d.Fragment,{children:[i.map((g,b)=>{if(g.type==="single"){const v=g.entry.type==="user_message"&&b===f;return d.jsx("div",{"data-last-user-message":v?"true":void 0,"data-entry-id":Ln(g.entry),className:ee(Rx(e,b),u(g.entry)&&"opacity-40"),children:d.jsx(Nx,{entry:g.entry,isLoading:t,onPermissionRespond:n,onRewindEntry:a})},`entry-${b}`)}const y=g.entries.every(u);return d.jsx("div",{"data-entry-id":Ln(g.entries[0]),className:ee("-mt-2",y&&"opacity-40"),children:d.jsx(kl,{entries:g.entries,onPermissionRespond:n})},`group-${b}`)}),l&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx("div",{className:"flex items-center gap-1 pt-2",children:d.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]})})]})]}):d.jsx(Sx,{title:r,description:s}),d.jsx(_x,{hasUserMessages:e.some(g=>g.type==="user_message")})]})})}function Rx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function Nx({entry:e,isLoading:t,onPermissionRespond:n,onRewindEntry:r}){switch(e.type){case"user_message":return d.jsx(Og,{entry:e,onRewind:r?()=>r(e,"rewind"):void 0,onRewindAndEdit:r?()=>r(e,"edit"):void 0});case"assistant_message":return d.jsx(Lg,{entry:e,isStreaming:t});case"tool_call":return d.jsx(kl,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(dx,{entry:e});case"command_output":return d.jsx(px,{entry:e});default:return null}}function jx(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const s of e)s.type==="tool_call"?n.push(s):(r(),t.push({type:"single",entry:s}));return r(),t}function Mx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Ix({commands:e,filter:t,onSelect:n,onClose:r,className:s}){const o=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Mx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=o.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:o,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",s),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:V("chat.noCommands")}):m.map((f,l)=>{var c;return d.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand-text",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function Tt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const Rl="rcs_input_history_";function Nl(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function Qs(e,t=Nl()){if(!t||!e)return[];try{const n=t.getItem(Rl+e);if(!n)return[];const r=JSON.parse(n);return Array.isArray(r)?r.filter(s=>typeof s=="string"):[]}catch{return[]}}function Px(e,t,n=Nl()){const r=t.trim();if(!n||!e||!r)return Qs(e,n);const s=Qs(e,n);if(s[s.length-1]===r)return s;s.push(r);const o=s.slice(-100);try{n.setItem(Rl+e,JSON.stringify(o))}catch{}return o}class Dx{constructor(){re(this,"entries",[]);re(this,"draft","");re(this,"cursor",-1)}get active(){return this.cursor>=0}begin(t,n){this.entries=t,this.draft=n,this.cursor=-1}up(){return this.entries.length===0?null:(this.cursor===-1?this.cursor=this.entries.length-1:this.cursor>0&&(this.cursor-=1),this.entries[this.cursor]??null)}down(){return this.cursor===-1?null:this.cursor>=this.entries.length-1?(this.cursor=-1,this.draft):(this.cursor+=1,this.entries[this.cursor]??null)}reset(){this.cursor=-1,this.entries=[],this.draft=""}}const Ox={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Lx=500*1024,jl=2*1024*1024,Ns=200,Po=5*1024*1024,Fx=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),$x=new Set([".csv",".tsv",".xlsx",".xls"]);function mn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Ml(e){if(e.type.startsWith("text/"))return!0;const t=mn(e.name);return Fx.has(t)}function Js(e){const t=mn(e.name);return $x.has(t)}function Ux({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:s,supportsAttachments:o,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:u,historyKey:h,draftOverride:g,className:b}){const y=o??a??!1,[v,E]=p.useState(""),[_,A]=p.useState([]),[O,k]=p.useState([]),[T,x]=p.useState(!1),[w,R]=p.useState(""),[P,D]=p.useState(!1),[F,M]=p.useState(!1),[z,S]=p.useState(!1),[C,H]=p.useState(null),[I,U]=p.useState([]),[Y,j]=p.useState(0),L=p.useRef(0),$=p.useRef(null),N=p.useRef(null),B=p.useRef(null),G=p.useRef(null),q=p.useRef(null),K=p.useRef(null),oe=p.useRef(null),Z=p.useRef(new Dx),se=p.useRef(h);se.current=h,p.useEffect(()=>{Tt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:y,commandsCount:(i==null?void 0:i.length)??0})},[y,i]),p.useEffect(()=>{!g||g.nonce===0||(E(g.text),Z.current.reset(),requestAnimationFrame(()=>{var W;return(W=$.current)==null?void 0:W.focus()}))},[g]),p.useEffect(()=>{if(!F)return;const W=X=>{var pe,Re;const te=X.target,de=(pe=K.current)==null?void 0:pe.contains(te),ke=(Re=oe.current)==null?void 0:Re.contains(te);!de&&!ke&&M(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[F]);const le=p.useCallback(W=>{const X=(W??v).trim(),te=_.length>0||O.length>0;!X&&!te||r||z||(e({text:X,images:_.length>0?_:void 0,attachments:O.length>0?O:void 0}),se.current&&X&&Px(se.current,X),Z.current.reset(),E(""),A([]),k([]),x(!1),R(""),$.current&&($.current.style.height="auto"))},[v,_,O,r,z,e]),be=p.useCallback(W=>{const X=se.current;if(!X)return!1;const te=Z.current;if(W==="up"){if(v!=="")return!1;te.active||te.begin(Qs(X),v);const ke=te.up();return ke===null?!1:(E(ke),requestAnimationFrame(()=>{const pe=$.current;pe&&(pe.focus(),pe.setSelectionRange(ke.length,ke.length))}),!0)}if(!te.active)return!1;const de=te.down();return de===null?!1:(E(de),requestAnimationFrame(()=>{const ke=$.current;ke&&(ke.focus(),ke.setSelectionRange(de.length,de.length))}),!0)},[v]),ue=p.useCallback(async W=>{if(!u)return;const X=++L.current;try{const te=await u(W);L.current===X&&U(te.slice(0,8))}catch{L.current===X&&U([])}},[u]),ye=p.useCallback(W=>{const X=$.current;if(!X||C===null)return;const te=X.selectionStart??v.length,de=v.slice(0,te),ke=/(?:^|\s)@([^\s@]*)$/.exec(de);if(!ke)return;const pe=te-ke[1].length-1,Re=`@${W} `,An=v.slice(0,pe)+Re+v.slice(te);E(An),H(null),U([]),requestAnimationFrame(()=>{const lt=pe+Re.length;X.focus(),X.setSelectionRange(lt,lt)})},[v,C]),fe=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(C!==null&&I.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),j(te=>{const de=W.key==="ArrowDown"?1:-1;return(te+de+I.length)%I.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const te=I[Y];te&&ye(te);return}if(W.key==="Escape"){W.preventDefault(),H(null),U([]);return}}if(T){if(W.key==="Escape"){W.preventDefault(),x(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),x(!1);return}}if(W.key==="ArrowUp"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&be("up")){W.preventDefault();return}if(W.key==="ArrowDown"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&be("down")){W.preventDefault();return}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():le())},[le,t,f,m,n,T,C,I,Y,ye,be]),ce=p.useCallback(W=>{const X=W.target.value;if(E(X),Z.current.reset(),X.startsWith("/")&&i&&i.length>0&&!/\s/.test(X.slice(1))?(x(!0),R(X.slice(1))):T&&(x(!1),R("")),u){const de=W.target.selectionStart??X.length,ke=X.slice(0,de),pe=/(?:^|\s)@([^\s@]*)$/.exec(ke);if(pe){const Re=pe[1]||"";H(Re),j(0),ue(Re)}else H(null),U([])}const te=W.target;te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px"},[i,T,u,ue]),ve=p.useCallback(async W=>{if(Tt("[ChatInput] paste event",{canAttach:y,files:W.clipboardData.files.length,types:W.clipboardData.types}),!y)return;const X=Array.from(W.clipboardData.files).filter(te=>te.type.startsWith("image/"));if(Tt("[ChatInput] paste image files",{count:X.length,types:X.map(te=>te.type)}),X.length!==0){W.preventDefault(),S(!0);try{const te=await js(X);A(de=>[...de,...te])}finally{S(!1)}}},[y]),Ce=p.useCallback(async()=>{if(!N.current)return;const W=N.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await js(Array.from(W));A(te=>[...te,...X])}finally{N.current.value="",S(!1)}}},[]),me=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Do(Array.from(W));k(te=>[...te,...X])}finally{B.current.value="",S(!1)}}},[]),_e=p.useCallback(async()=>{if(!G.current)return;const W=G.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Oo(Array.from(W));k(te=>[...te,...X])}finally{G.current.value="",S(!1)}}},[]),Se=p.useCallback(async()=>{if(!q.current)return;const W=q.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Hx(Array.from(W));X&&k(te=>[...te,X])}finally{q.current.value="",S(!1)}}},[]),ge=p.useCallback(W=>{A(X=>X.filter((te,de)=>de!==W))},[]),Ie=p.useCallback(W=>{k(X=>X.filter((te,de)=>de!==W))},[]),Ge=p.useCallback(W=>{var te,de;x(!1),R("");const X=`/${W.name}`;(te=W.input)!=null&&te.hint?(E(`${X} `),(de=$.current)==null||de.focus()):le(X)},[le]),Lt=p.useCallback(W=>{y&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",P||D(!0))},[y,P]),Te=p.useCallback(W=>{const X=W.relatedTarget;(!X||!W.currentTarget.contains(X))&&D(!1)},[]),et=p.useCallback(async W=>{if(!y)return;const X=Array.from(W.dataTransfer.files);if(X.length!==0){W.preventDefault(),D(!1),S(!0);try{const te=X.filter(pe=>pe.type.startsWith("image/")),de=X.filter(pe=>!pe.type.startsWith("image/")&&Js(pe)),ke=X.filter(pe=>!pe.type.startsWith("image/")&&!Js(pe)&&Ml(pe));if(te.length>0){const pe=await js(te);A(Re=>[...Re,...pe])}if(de.length>0){const pe=await Oo(de);k(Re=>[...Re,...pe])}if(ke.length>0){const pe=await Do(ke);k(Re=>[...Re,...pe])}}finally{S(!1)}}},[y]),je=_.length+O.length,Oe=(v.trim()||je>0)&&!r&&!z;return d.jsxs("div",{className:ee("w-full page-measure mx-auto px-4 sm:px-8 pb-4 pt-2",b),children:[d.jsxs("div",{className:"relative",children:[T&&i&&i.length>0&&d.jsx(Ix,{commands:i,filter:w,onSelect:Ge,onClose:()=>{x(!1),R("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),C!==null&&I.length>0&&d.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[d.jsx("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:we("chat.fileMatchHint",{query:C?`“@${C}”`:""})}),I.map((W,X)=>d.jsxs("button",{type:"button",onMouseDown:te=>{te.preventDefault(),ye(W)},onMouseEnter:()=>j(X),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",X===Y?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[d.jsx(Gt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),d.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),F&&y&&d.jsxs("div",{ref:K,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;M(!1),(W=N.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Wd,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.image")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;M(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Gt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.textFile")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;M(!1),(W=G.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(lr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.sheet")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;M(!1),(W=q.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(ir,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.directory")})]})]}),d.jsxs("div",{onDragOver:Lt,onDragLeave:Te,onDrop:et,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",P&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[_.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:_.map((W,X)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${X+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>ge(X),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${X+1}`,children:"×"})]},X))}),O.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:O.map((W,X)=>d.jsx(zx,{attachment:W,onRemove:()=>Ie(X)},X))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[y&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:oe,type:"button",onClick:()=>M(W=>!W),disabled:r||z,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",F?"bg-brand/15 text-brand-text":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(au,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:N,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ce}),d.jsx("input",{ref:B,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:me}),d.jsx("input",{ref:G,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:_e}),d.jsx("input",{ref:q,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:Se})]}),d.jsx("textarea",{ref:$,value:v,onChange:ce,onKeyDown:fe,onPaste:ve,placeholder:z?V("chat.processingFile"):s,disabled:r,rows:1,className:ee("flex-1 resize-none border-none bg-transparent outline-none self-center","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>le(),disabled:!t&&!Oe,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":Oe?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(bu,{className:"h-3.5 w-3.5",fill:"currentColor"}):z?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(fu,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&d.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[d.jsx(Fd,{className:"h-3 w-3"}),d.jsxs("span",{children:[we("chat.queued",{n:l}),c?V("chat.queuedCancel"):""]}),c&&d.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[d.jsx(hn,{className:"h-3 w-3"}),V("common.cancel")]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:[V("chat.inputHint"),u?V("chat.inputHintSuffix"):""]})})]})}function zx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Gt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(lr,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(ir,{className:"h-3.5 w-3.5"});default:return d.jsx(Gt,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?Vt(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&d.jsx("span",{className:"text-text-muted text-[10px]",children:r}),s!=null&&d.jsx("span",{className:"text-text-muted text-[10px]",children:we("chat.fileCount",{n:s})}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(hn,{className:"h-3 w-3"})})]})}function Vt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function js(e){const t=[];for(const n of e)try{let r=n,s=n.type;n.size>2*1024*1024&&(r=await Me(n,Ox),s="image/jpeg");const o=await Bx(r);t.push({mimeType:s,data:o})}catch(r){console.error("Failed to process image:",r)}return t}async function Do(e){const t=[];for(const n of e)try{if(n.size>jl){console.warn(`Skipping ${n.name}: too large (${Vt(n.size)})`);continue}n.size>Lx&&console.warn(`File ${n.name} is large (${Vt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Oo(e){const t=[];for(const n of e)try{const r=mn(n.name);if(r===".csv"||r===".tsv"){const s=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const s=await n.arrayBuffer(),o=await Il(s);t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Il(e){const t=await Ne(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const s of n.SheetNames){const o=n.Sheets[s];if(!o)continue;const a=t.utils.sheet_to_csv(o);n.SheetNames.length>1?r.push(`## Sheet: ${s}
|
|
245
|
+
*--------------------------------------------------------------------------------------------*/const Tl=p.createContext(null),yx=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Qn({instance:e,children:t,resize:n,initial:r,mass:s,damping:o,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((L,A)=>{const T=(k==null?void 0:k.targetScrollTop)??i;return(T==null?void 0:T(L,A))??L},[i]),u=bx({mass:s,damping:o,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:x,scrollToBottom:b,stopScroll:y,isAtBottom:v,escapedFromLock:E,state:_}=e??u,k=p.useMemo(()=>({scrollToBottom:b,stopScroll:y,scrollRef:h,isAtBottom:v,escapedFromLock:E,contentRef:x,state:_,get targetScrollTop(){return l.current},set targetScrollTop(L){l.current=L}}),[b,v,x,h,y,E,_]);return p.useImperativeHandle(m,()=>k,[k]),yx(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Tl.Provider,{value:k},p.createElement("div",{...f},typeof t=="function"?t(k):t))}(function(e){function t({children:n,scrollClassName:r,...s}){const o=Fr();return p.createElement("div",{ref:o.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...s,ref:o.contentRef},typeof n=="function"?n(o):n))}e.Content=t})(Qn||(Qn={}));function Fr(){const e=p.useContext(Tl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const wx=({className:e,...t})=>d.jsx(Qn,{className:ee("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Cx=({className:e,...t})=>d.jsx(Qn.Content,{className:ee("mx-auto flex page-measure flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),Sx=({className:e,title:t=V("common.emptyTitle"),description:n=V("common.emptyDescription"),icon:r,children:s,...o})=>d.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...o,children:s??d.jsxs(d.Fragment,{children:[r&&d.jsx("div",{className:"text-text-muted",children:r}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&d.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),kx=({className:e,...t})=>{const{scrollToBottom:n}=Fr(),r=p.useCallback(()=>{n()},[n]);return d.jsx(Pt,{className:ee("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:d.jsx(Ad,{className:"size-4"})})},Ax="data-last-user-message",Ex=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${Ax}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return d.jsx(Pt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:d.jsx(Ca,{className:"size-4"})})},_x=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Fr();return r?null:d.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&d.jsx(Ex,{}),d.jsx(kx,{})]})};function Tx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r,emptyDescription:s,searchMatchIds:o,onRewindEntry:a}){var h;const i=jx(e),m=e.length>0;let f=-1;for(let x=i.length-1;x>=0;x--){const b=i[x];if(b.type==="single"&&b.entry.type==="user_message"){f=x;break}}const l=t&&e.length>0&&((h=e[e.length-1])==null?void 0:h.type)==="user_message",c=!!o&&o.size>0,u=x=>c&&!o.has(Ln(x));return d.jsx(wx,{className:"flex-1",children:d.jsxs(Cx,{children:[m?d.jsxs(d.Fragment,{children:[i.map((x,b)=>{if(x.type==="single"){const v=x.entry.type==="user_message"&&b===f;return d.jsx("div",{"data-last-user-message":v?"true":void 0,"data-entry-id":Ln(x.entry),className:ee(Rx(e,b),u(x.entry)&&"opacity-40"),children:d.jsx(Nx,{entry:x.entry,isLoading:t,onPermissionRespond:n,onRewindEntry:a})},`entry-${b}`)}const y=x.entries.every(u);return d.jsx("div",{"data-entry-id":Ln(x.entries[0]),className:ee("-mt-2",y&&"opacity-40"),children:d.jsx(kl,{entries:x.entries,onPermissionRespond:n})},`group-${b}`)}),l&&d.jsxs("div",{className:"flex gap-4 items-start",children:[d.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:d.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),d.jsx("div",{className:"flex items-center gap-1 pt-2",children:d.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[d.jsx("span",{}),d.jsx("span",{}),d.jsx("span",{})]})})]})]}):d.jsx(Sx,{title:r,description:s}),d.jsx(_x,{hasUserMessages:e.some(x=>x.type==="user_message")})]})})}function Rx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function Nx({entry:e,isLoading:t,onPermissionRespond:n,onRewindEntry:r}){switch(e.type){case"user_message":return d.jsx(Og,{entry:e,onRewind:r?()=>r(e,"rewind"):void 0,onRewindAndEdit:r?()=>r(e,"edit"):void 0});case"assistant_message":return d.jsx(Lg,{entry:e,isStreaming:t});case"tool_call":return d.jsx(kl,{entries:[e],onPermissionRespond:n});case"plan":return d.jsx(dx,{entry:e});case"command_output":return d.jsx(px,{entry:e});default:return null}}function jx(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const s of e)s.type==="tool_call"?n.push(s):(r(),t.push({type:"single",entry:s}));return r(),t}function Mx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function Ix({commands:e,filter:t,onSelect:n,onClose:r,className:s}){const o=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>Mx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{o.current&&!o.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=o.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),d.jsx("div",{ref:o,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",s),children:d.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?d.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:V("chat.noCommands")}):m.map((f,l)=>{var c;return d.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[d.jsxs("span",{className:"text-sm font-display font-medium text-brand-text",children:["/",f.name]}),d.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&d.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function Tt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const Rl="rcs_input_history_";function Nl(){try{if(typeof localStorage<"u")return localStorage}catch{}return null}function Qs(e,t=Nl()){if(!t||!e)return[];try{const n=t.getItem(Rl+e);if(!n)return[];const r=JSON.parse(n);return Array.isArray(r)?r.filter(s=>typeof s=="string"):[]}catch{return[]}}function Px(e,t,n=Nl()){const r=t.trim();if(!n||!e||!r)return Qs(e,n);const s=Qs(e,n);if(s[s.length-1]===r)return s;s.push(r);const o=s.slice(-100);try{n.setItem(Rl+e,JSON.stringify(o))}catch{}return o}class Dx{constructor(){re(this,"entries",[]);re(this,"draft","");re(this,"cursor",-1)}get active(){return this.cursor>=0}begin(t,n){this.entries=t,this.draft=n,this.cursor=-1}up(){return this.entries.length===0?null:(this.cursor===-1?this.cursor=this.entries.length-1:this.cursor>0&&(this.cursor-=1),this.entries[this.cursor]??null)}down(){return this.cursor===-1?null:this.cursor>=this.entries.length-1?(this.cursor=-1,this.draft):(this.cursor+=1,this.entries[this.cursor]??null)}reset(){this.cursor=-1,this.entries=[],this.draft=""}}const Ox={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Lx=500*1024,jl=2*1024*1024,Ns=200,Po=5*1024*1024,Fx=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),$x=new Set([".csv",".tsv",".xlsx",".xls"]);function mn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Ml(e){if(e.type.startsWith("text/"))return!0;const t=mn(e.name);return Fx.has(t)}function Js(e){const t=mn(e.name);return $x.has(t)}function Ux({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:s,supportsAttachments:o,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:u,historyKey:h,draftOverride:x,className:b}){const y=o??a??!1,[v,E]=p.useState(""),[_,k]=p.useState([]),[L,A]=p.useState([]),[T,g]=p.useState(!1),[w,N]=p.useState(""),[P,D]=p.useState(!1),[F,j]=p.useState(!1),[z,S]=p.useState(!1),[C,H]=p.useState(null),[I,U]=p.useState([]),[Y,M]=p.useState(0),O=p.useRef(0),$=p.useRef(null),R=p.useRef(null),B=p.useRef(null),G=p.useRef(null),q=p.useRef(null),K=p.useRef(null),oe=p.useRef(null),Z=p.useRef(new Dx),se=p.useRef(h);se.current=h,p.useEffect(()=>{Tt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:y,commandsCount:(i==null?void 0:i.length)??0})},[y,i]),p.useEffect(()=>{!x||x.nonce===0||(E(x.text),Z.current.reset(),requestAnimationFrame(()=>{var W;return(W=$.current)==null?void 0:W.focus()}))},[x]),p.useEffect(()=>{if(!F)return;const W=X=>{var pe,Re;const te=X.target,de=(pe=K.current)==null?void 0:pe.contains(te),ke=(Re=oe.current)==null?void 0:Re.contains(te);!de&&!ke&&j(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[F]);const le=p.useCallback(W=>{const X=(W??v).trim(),te=_.length>0||L.length>0;!X&&!te||r||z||(e({text:X,images:_.length>0?_:void 0,attachments:L.length>0?L:void 0}),se.current&&X&&Px(se.current,X),Z.current.reset(),E(""),k([]),A([]),g(!1),N(""),$.current&&($.current.style.height="auto"))},[v,_,L,r,z,e]),be=p.useCallback(W=>{const X=se.current;if(!X)return!1;const te=Z.current;if(W==="up"){if(v!=="")return!1;te.active||te.begin(Qs(X),v);const ke=te.up();return ke===null?!1:(E(ke),requestAnimationFrame(()=>{const pe=$.current;pe&&(pe.focus(),pe.setSelectionRange(ke.length,ke.length))}),!0)}if(!te.active)return!1;const de=te.down();return de===null?!1:(E(de),requestAnimationFrame(()=>{const ke=$.current;ke&&(ke.focus(),ke.setSelectionRange(de.length,de.length))}),!0)},[v]),ue=p.useCallback(async W=>{if(!u)return;const X=++O.current;try{const te=await u(W);O.current===X&&U(te.slice(0,8))}catch{O.current===X&&U([])}},[u]),ye=p.useCallback(W=>{const X=$.current;if(!X||C===null)return;const te=X.selectionStart??v.length,de=v.slice(0,te),ke=/(?:^|\s)@([^\s@]*)$/.exec(de);if(!ke)return;const pe=te-ke[1].length-1,Re=`@${W} `,An=v.slice(0,pe)+Re+v.slice(te);E(An),H(null),U([]),requestAnimationFrame(()=>{const lt=pe+Re.length;X.focus(),X.setSelectionRange(lt,lt)})},[v,C]),fe=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(C!==null&&I.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),M(te=>{const de=W.key==="ArrowDown"?1:-1;return(te+de+I.length)%I.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const te=I[Y];te&&ye(te);return}if(W.key==="Escape"){W.preventDefault(),H(null),U([]);return}}if(T){if(W.key==="Escape"){W.preventDefault(),g(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),g(!1);return}}if(W.key==="ArrowUp"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&be("up")){W.preventDefault();return}if(W.key==="ArrowDown"&&!W.shiftKey&&!W.metaKey&&!W.ctrlKey&&!W.altKey&&be("down")){W.preventDefault();return}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():le())},[le,t,f,m,n,T,C,I,Y,ye,be]),ce=p.useCallback(W=>{const X=W.target.value;if(E(X),Z.current.reset(),X.startsWith("/")&&i&&i.length>0&&!/\s/.test(X.slice(1))?(g(!0),N(X.slice(1))):T&&(g(!1),N("")),u){const de=W.target.selectionStart??X.length,ke=X.slice(0,de),pe=/(?:^|\s)@([^\s@]*)$/.exec(ke);if(pe){const Re=pe[1]||"";H(Re),M(0),ue(Re)}else H(null),U([])}const te=W.target;te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px"},[i,T,u,ue]),ve=p.useCallback(async W=>{if(Tt("[ChatInput] paste event",{canAttach:y,files:W.clipboardData.files.length,types:W.clipboardData.types}),!y)return;const X=Array.from(W.clipboardData.files).filter(te=>te.type.startsWith("image/"));if(Tt("[ChatInput] paste image files",{count:X.length,types:X.map(te=>te.type)}),X.length!==0){W.preventDefault(),S(!0);try{const te=await js(X);k(de=>[...de,...te])}finally{S(!1)}}},[y]),Ce=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await js(Array.from(W));k(te=>[...te,...X])}finally{R.current.value="",S(!1)}}},[]),me=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Do(Array.from(W));A(te=>[...te,...X])}finally{B.current.value="",S(!1)}}},[]),_e=p.useCallback(async()=>{if(!G.current)return;const W=G.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Oo(Array.from(W));A(te=>[...te,...X])}finally{G.current.value="",S(!1)}}},[]),Se=p.useCallback(async()=>{if(!q.current)return;const W=q.current.files;if(!(!W||W.length===0)){S(!0);try{const X=await Hx(Array.from(W));X&&A(te=>[...te,X])}finally{q.current.value="",S(!1)}}},[]),ge=p.useCallback(W=>{k(X=>X.filter((te,de)=>de!==W))},[]),Ie=p.useCallback(W=>{A(X=>X.filter((te,de)=>de!==W))},[]),Ge=p.useCallback(W=>{var te,de;g(!1),N("");const X=`/${W.name}`;(te=W.input)!=null&&te.hint?(E(`${X} `),(de=$.current)==null||de.focus()):le(X)},[le]),Lt=p.useCallback(W=>{y&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",P||D(!0))},[y,P]),Te=p.useCallback(W=>{const X=W.relatedTarget;(!X||!W.currentTarget.contains(X))&&D(!1)},[]),et=p.useCallback(async W=>{if(!y)return;const X=Array.from(W.dataTransfer.files);if(X.length!==0){W.preventDefault(),D(!1),S(!0);try{const te=X.filter(pe=>pe.type.startsWith("image/")),de=X.filter(pe=>!pe.type.startsWith("image/")&&Js(pe)),ke=X.filter(pe=>!pe.type.startsWith("image/")&&!Js(pe)&&Ml(pe));if(te.length>0){const pe=await js(te);k(Re=>[...Re,...pe])}if(de.length>0){const pe=await Oo(de);A(Re=>[...Re,...pe])}if(ke.length>0){const pe=await Do(ke);A(Re=>[...Re,...pe])}}finally{S(!1)}}},[y]),Ne=_.length+L.length,Oe=(v.trim()||Ne>0)&&!r&&!z;return d.jsxs("div",{className:ee("w-full page-measure mx-auto px-4 sm:px-8 pb-4 pt-2",b),children:[d.jsxs("div",{className:"relative",children:[T&&i&&i.length>0&&d.jsx(Ix,{commands:i,filter:w,onSelect:Ge,onClose:()=>{g(!1),N("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),C!==null&&I.length>0&&d.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[d.jsx("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:we("chat.fileMatchHint",{query:C?`“@${C}”`:""})}),I.map((W,X)=>d.jsxs("button",{type:"button",onMouseDown:te=>{te.preventDefault(),ye(W)},onMouseEnter:()=>M(X),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",X===Y?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[d.jsx(Gt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),d.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),F&&y&&d.jsxs("div",{ref:K,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Wd,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.image")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(Gt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.textFile")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=G.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(lr,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.sheet")})]}),d.jsxs("button",{type:"button",onClick:()=>{var W;j(!1),(W=q.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[d.jsx(ir,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),d.jsx("span",{children:V("chat.picker.directory")})]})]}),d.jsxs("div",{onDragOver:Lt,onDragLeave:Te,onDrop:et,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",P&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[_.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:_.map((W,X)=>d.jsxs("div",{className:"relative group",children:[d.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${X+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),d.jsx("button",{type:"button",onClick:()=>ge(X),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${X+1}`,children:"×"})]},X))}),L.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:L.map((W,X)=>d.jsx(zx,{attachment:W,onRemove:()=>Ie(X)},X))}),d.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[y&&d.jsxs("div",{className:"relative flex-shrink-0",children:[d.jsxs("button",{ref:oe,type:"button",onClick:()=>j(W=>!W),disabled:r||z,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",F?"bg-brand/15 text-brand-text":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[d.jsx(au,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Attach"})]}),d.jsx("input",{ref:R,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ce}),d.jsx("input",{ref:B,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:me}),d.jsx("input",{ref:G,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:_e}),d.jsx("input",{ref:q,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:Se})]}),d.jsx("textarea",{ref:$,value:v,onChange:ce,onKeyDown:fe,onPaste:ve,placeholder:z?V("chat.processingFile"):s,disabled:r,rows:1,className:ee("flex-1 resize-none border-none bg-transparent outline-none self-center","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),d.jsx("button",{type:"button",onClick:t?n:()=>le(),disabled:!t&&!Oe,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":Oe?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?d.jsx(bu,{className:"h-3.5 w-3.5",fill:"currentColor"}):z?d.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):d.jsx(fu,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&d.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[d.jsx(Fd,{className:"h-3 w-3"}),d.jsxs("span",{children:[we("chat.queued",{n:l}),c?V("chat.queuedCancel"):""]}),c&&d.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[d.jsx(hn,{className:"h-3 w-3"}),V("common.cancel")]})]}),d.jsx("div",{className:"text-center mt-1.5",children:d.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:[V("chat.inputHint"),u?V("chat.inputHintSuffix"):""]})})]})}function zx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return d.jsx(Gt,{className:"h-3.5 w-3.5"});case"table":return d.jsx(lr,{className:"h-3.5 w-3.5"});case"directory":return d.jsx(ir,{className:"h-3.5 w-3.5"});default:return d.jsx(Gt,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?Vt(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null;return d.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,d.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&d.jsx("span",{className:"text-text-muted text-[10px]",children:r}),s!=null&&d.jsx("span",{className:"text-text-muted text-[10px]",children:we("chat.fileCount",{n:s})}),d.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:d.jsx(hn,{className:"h-3 w-3"})})]})}function Vt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function js(e){const t=[];for(const n of e)try{let r=n,s=n.type;n.size>2*1024*1024&&(r=await je(n,Ox),s="image/jpeg");const o=await Bx(r);t.push({mimeType:s,data:o})}catch(r){console.error("Failed to process image:",r)}return t}async function Do(e){const t=[];for(const n of e)try{if(n.size>jl){console.warn(`Skipping ${n.name}: too large (${Vt(n.size)})`);continue}n.size>Lx&&console.warn(`File ${n.name} is large (${Vt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Oo(e){const t=[];for(const n of e)try{const r=mn(n.name);if(r===".csv"||r===".tsv"){const s=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const s=await n.arrayBuffer(),o=await Il(s);t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Il(e){const t=await Me(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const s of n.SheetNames){const o=n.Sheets[s];if(!o)continue;const a=t.utils.sheet_to_csv(o);n.SheetNames.length>1?r.push(`## Sheet: ${s}
|
|
246
246
|
|
|
247
247
|
${a}`):r.push(a)}return r.join(`
|
|
248
248
|
|
|
249
|
-
`)}async function Hx(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>jl));t.length>Ns&&console.warn(`Directory has ${t.length} files, truncating to ${Ns}`);const n=t.slice(0,Ns);let r=0;for(const u of n)r+=u.size;r>Po&&console.warn(`Directory total size ${Vt(r)} exceeds limit, some files may be truncated`);const s=n[0].webkitRelativePath,o=s&&s.split("/")[0]||V("chat.directory"),a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const
|
|
249
|
+
`)}async function Hx(e){if(e.length===0)return null;const t=e.filter(u=>!(u.name.startsWith(".")||u.size>jl));t.length>Ns&&console.warn(`Directory has ${t.length} files, truncating to ${Ns}`);const n=t.slice(0,Ns);let r=0;for(const u of n)r+=u.size;r>Po&&console.warn(`Directory total size ${Vt(r)} exceeds limit, some files may be truncated`);const s=n[0].webkitRelativePath,o=s&&s.split("/")[0]||V("chat.directory"),a=[],i=[];let m=0;const f=[...n].sort((u,h)=>{const x=u.webkitRelativePath||u.name,b=h.webkitRelativePath||h.name;return x.localeCompare(b)});for(const u of f){const h=u.webkitRelativePath||u.name;if(a.push(h),Ml(u)||Js(u))if(m+u.size<=Po)try{let x;if(mn(u.name)===".xlsx"||mn(u.name)===".xls"){const b=await u.arrayBuffer();x=await Il(b)}else x=await u.text();i.push(`
|
|
250
250
|
### ${h}
|
|
251
251
|
\`\`\`
|
|
252
|
-
${
|
|
252
|
+
${x}
|
|
253
253
|
\`\`\``),m+=u.size}catch{i.push(`
|
|
254
254
|
### ${h}
|
|
255
255
|
${V("attach.readFailed")}`)}else i.push(`
|
|
@@ -260,16 +260,16 @@ ${we("attach.imageFile",{size:Vt(u.size)})}`):i.push(`
|
|
|
260
260
|
### ${h}
|
|
261
261
|
${we("attach.binaryFile",{size:Vt(u.size)})}`)}const l=a.join(`
|
|
262
262
|
`),c=[we("attach.dumpHeader",{name:o}),we("attach.dumpCount",{n:a.length}),"",V("attach.structure"),"```",l,"```","",V("attach.contents"),...i].join(`
|
|
263
|
-
`);return{kind:"directory",name:o,size:r,textContent:c,files:a}}async function Bx(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const s=r.result,o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Wx({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(r=>d.jsx(Vx,{request:r,onRespond:t},r.requestId))})})}function Vx({request:e,onRespond:t}){return tn(),d.jsxs("div",{role:"group","aria-label":we("permission.requestAria",{tool:e.toolName}),className:"flex items-center gap-3 rounded-xl border border-approve/30 bg-approve/5 px-4 py-3",children:[d.jsx(ya,{className:"h-5 w-5 text-approve-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-bold font-display text-approve-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-text-secondary mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-approve text-white text-xs font-medium font-display hover:bg-approve-hover transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(pn,{className:"h-3.5 w-3.5"}),V("permission.approve")]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-status-error/40 text-status-error text-xs font-medium font-display hover:bg-status-error/10 transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(hn,{className:"h-3.5 w-3.5"}),V("permission.reject")]})]})]})}function Lo(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Fo(e){return e<1e3?String(e):e<1e6?`${Lo((e/1e3).toFixed(1))}k`:`${Lo((e/1e6).toFixed(2))}M`}function $o(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Gx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push($o(e.cost)),t.push(`${Fo(e.used)} / ${Fo(e.size)} tokens`);const n=[we("usage.context",{used:e.used.toLocaleString(),size:e.size.toLocaleString()})];return e.cost!=null&&e.cost.amount>0&&n.push(we("usage.totalCost",{cost:$o(e.cost)})),d.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var ms="Popover",[Pl]=at(ms,[en]),Sn=en(),[qx,wt]=Pl(ms),Dl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!1}=e,i=Sn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,u]=ht({prop:r,defaultProp:s??!1,onChange:o,caller:ms});return d.jsx(vr,{...i,children:d.jsx(qx,{scope:t,contentId:Pe(),triggerRef:m,open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Dl.displayName=ms;var Ol="PopoverAnchor",Kx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Ol,n),o=Sn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=s;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(rs,{...o,...r,ref:t})});Kx.displayName=Ol;var Ll="PopoverTrigger",Fl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Ll,n),o=Sn(n),a=Ae(t,s.triggerRef),i=d.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Bl(s.open),...r,ref:a,onClick:ne(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?i:d.jsx(rs,{asChild:!0,...o,children:i})});Fl.displayName=Ll;var $r="PopoverPortal",[Yx,Xx]=Pl($r,{forceMount:void 0}),$l=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=wt($r,t);return d.jsx(Yx,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};$l.displayName=$r;var Xt="PopoverContent",Ul=p.forwardRef((e,t)=>{const n=Xx(Xt,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=wt(Xt,e.__scopePopover);return d.jsx(Ue,{present:r||o.open,children:o.modal?d.jsx(Jx,{...s,ref:t}):d.jsx(Zx,{...s,ref:t})})});Ul.displayName=Xt;var Qx=qt("PopoverContent.RemoveScroll"),Jx=p.forwardRef((e,t)=>{const n=wt(Xt,e.__scopePopover),r=p.useRef(null),s=Ae(t,r),o=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return wr(a)},[]),d.jsx(rr,{as:Qx,allowPinchZoom:!0,children:d.jsx(zl,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Zx=p.forwardRef((e,t)=>{const n=wt(Xt,e.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(zl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),zl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,u=wt(Xt,n),h=Sn(n);return cr(),d.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(br,{"data-state":Bl(u.open),role:"dialog",id:u.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hl="PopoverClose",ev=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Hl,n);return d.jsx(xe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});ev.displayName=Hl;var tv="PopoverArrow",nv=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Sn(n);return d.jsx(yr,{...s,...r,ref:t})});nv.displayName=tv;function Bl(e){return e?"open":"closed"}var sv=Dl,rv=Fl,ov=$l,av=Ul;function Wl({...e}){return d.jsx(sv,{"data-slot":"popover",...e})}function Vl({...e}){return d.jsx(rv,{"data-slot":"popover-trigger",...e})}function Gl({className:e,align:t="center",sideOffset:n=4,...r}){return d.jsx(ov,{children:d.jsx(av,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Uo=1,iv=.9,lv=.8,cv=.17,Ms=.1,Is=.999,dv=.9999,uv=.99,fv=/[\\\/_+.#"@\[\(\{&]/,mv=/[\\\/_+.#"@\[\(\{&]/g,pv=/[\s-]/,ql=/[\s-]/g;function Zs(e,t,n,r,s,o,a){if(o===t.length)return s===e.length?Uo:uv;var i=`${s},${o}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(o),f=n.indexOf(m,s),l=0,c,u,h,g;f>=0;)c=Zs(e,t,n,r,f+1,o+1,a),c>l&&(f===s?c*=Uo:fv.test(e.charAt(f-1))?(c*=lv,h=e.slice(s,f-1).match(mv),h&&s>0&&(c*=Math.pow(Is,h.length))):pv.test(e.charAt(f-1))?(c*=iv,g=e.slice(s,f-1).match(ql),g&&s>0&&(c*=Math.pow(Is,g.length))):(c*=cv,s>0&&(c*=Math.pow(Is,f-s))),e.charAt(f)!==t.charAt(o)&&(c*=dv)),(c<Ms&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(u=Zs(e,t,n,r,f+1,o+2,a),u*Ms>c&&(c=u*Ms)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function zo(e){return e.toLowerCase().replace(ql," ")}function hv(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Zs(e,t,zo(e),zo(t),0,0,{})}var ps="Dialog",[Kl]=at(ps),[gv,Ve]=Kl(ps),Yl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ht({prop:r,defaultProp:s??!1,onChange:o,caller:ps});return d.jsx(gv,{scope:t,triggerRef:i,contentRef:m,contentId:Pe(),titleId:Pe(),descriptionId:Pe(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};Yl.displayName=ps;var Xl="DialogTrigger",xv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Xl,n),o=Ae(t,s.triggerRef);return d.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Hr(s.open),...r,ref:o,onClick:ne(e.onClick,s.onOpenToggle)})});xv.displayName=Xl;var Ur="DialogPortal",[vv,Ql]=Kl(Ur,{forceMount:void 0}),Jl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Ve(Ur,t);return d.jsx(vv,{scope:t,forceMount:n,children:p.Children.map(r,a=>d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:a})}))})};Jl.displayName=Ur;var Jn="DialogOverlay",Zl=p.forwardRef((e,t)=>{const n=Ql(Jn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(Jn,e.__scopeDialog);return o.modal?d.jsx(Ue,{present:r||o.open,children:d.jsx(yv,{...s,ref:t})}):null});Zl.displayName=Jn;var bv=qt("DialogOverlay.RemoveScroll"),yv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Jn,n);return d.jsx(rr,{as:bv,allowPinchZoom:!0,shards:[s.contentRef],children:d.jsx(xe.div,{"data-state":Hr(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),jt="DialogContent",ec=p.forwardRef((e,t)=>{const n=Ql(jt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(jt,e.__scopeDialog);return d.jsx(Ue,{present:r||o.open,children:o.modal?d.jsx(wv,{...s,ref:t}):d.jsx(Cv,{...s,ref:t})})});ec.displayName=jt;var wv=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(null),s=Ae(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return wr(o)},[]),d.jsx(tc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault())})}),Cv=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(tc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),tc=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,i=Ve(jt,n),m=p.useRef(null),f=Ae(t,m);return cr(),d.jsxs(d.Fragment,{children:[d.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(gn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Hr(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(kv,{titleId:i.titleId}),d.jsx(Ev,{contentRef:m,descriptionId:i.descriptionId})]})]})}),zr="DialogTitle",nc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(zr,n);return d.jsx(xe.h2,{id:s.titleId,...r,ref:t})});nc.displayName=zr;var sc="DialogDescription",Sv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(sc,n);return d.jsx(xe.p,{id:s.descriptionId,...r,ref:t})});Sv.displayName=sc;var rc="DialogClose",oc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(rc,n);return d.jsx(xe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});oc.displayName=rc;function Hr(e){return e?"open":"closed"}var ac="DialogTitleWarning",[Ey,ic]=Hu(ac,{contentName:jt,titleName:zr,docsSlug:"dialog"}),kv=({titleId:e})=>{const t=ic(ac),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
263
|
+
`);return{kind:"directory",name:o,size:r,textContent:c,files:a}}async function Bx(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const s=r.result,o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Wx({requests:e,onRespond:t,className:n}){return e.length===0?null:d.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:d.jsx("div",{className:"space-y-2",children:e.map(r=>d.jsx(Vx,{request:r,onRespond:t},r.requestId))})})}function Vx({request:e,onRespond:t}){return tn(),d.jsxs("div",{role:"group","aria-label":we("permission.requestAria",{tool:e.toolName}),className:"flex items-center gap-3 rounded-xl border border-approve/30 bg-approve/5 px-4 py-3",children:[d.jsx(ya,{className:"h-5 w-5 text-approve-text flex-shrink-0"}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-bold font-display text-approve-text",children:e.toolName}),e.description&&d.jsx("div",{className:"text-xs text-text-secondary mt-0.5 truncate",children:e.description})]}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-approve text-white text-xs font-medium font-display hover:bg-approve-hover transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(pn,{className:"h-3.5 w-3.5"}),V("permission.approve")]}),d.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-status-error/40 text-status-error text-xs font-medium font-display hover:bg-status-error/10 transition-colors flex items-center gap-1.5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-surface-1",children:[d.jsx(hn,{className:"h-3.5 w-3.5"}),V("permission.reject")]})]})]})}function Lo(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Fo(e){return e<1e3?String(e):e<1e6?`${Lo((e/1e3).toFixed(1))}k`:`${Lo((e/1e6).toFixed(2))}M`}function $o(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Gx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push($o(e.cost)),t.push(`${Fo(e.used)} / ${Fo(e.size)} tokens`);const n=[we("usage.context",{used:e.used.toLocaleString(),size:e.size.toLocaleString()})];return e.cost!=null&&e.cost.amount>0&&n.push(we("usage.totalCost",{cost:$o(e.cost)})),d.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var ms="Popover",[Pl]=at(ms,[en]),Sn=en(),[qx,wt]=Pl(ms),Dl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!1}=e,i=Sn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,u]=ht({prop:r,defaultProp:s??!1,onChange:o,caller:ms});return d.jsx(vr,{...i,children:d.jsx(qx,{scope:t,contentId:Pe(),triggerRef:m,open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(h=>!h),[u]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Dl.displayName=ms;var Ol="PopoverAnchor",Kx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Ol,n),o=Sn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=s;return p.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(rs,{...o,...r,ref:t})});Kx.displayName=Ol;var Ll="PopoverTrigger",Fl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Ll,n),o=Sn(n),a=Ae(t,s.triggerRef),i=d.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Bl(s.open),...r,ref:a,onClick:ne(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?i:d.jsx(rs,{asChild:!0,...o,children:i})});Fl.displayName=Ll;var $r="PopoverPortal",[Yx,Xx]=Pl($r,{forceMount:void 0}),$l=e=>{const{__scopePopover:t,forceMount:n,children:r,container:s}=e,o=wt($r,t);return d.jsx(Yx,{scope:t,forceMount:n,children:d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:r})})})};$l.displayName=$r;var Xt="PopoverContent",Ul=p.forwardRef((e,t)=>{const n=Xx(Xt,e.__scopePopover),{forceMount:r=n.forceMount,...s}=e,o=wt(Xt,e.__scopePopover);return d.jsx(Ue,{present:r||o.open,children:o.modal?d.jsx(Jx,{...s,ref:t}):d.jsx(Zx,{...s,ref:t})})});Ul.displayName=Xt;var Qx=qt("PopoverContent.RemoveScroll"),Jx=p.forwardRef((e,t)=>{const n=wt(Xt,e.__scopePopover),r=p.useRef(null),s=Ae(t,r),o=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return wr(a)},[]),d.jsx(rr,{as:Qx,allowPinchZoom:!0,children:d.jsx(zl,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;o.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:ne(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Zx=p.forwardRef((e,t)=>{const n=wt(Xt,e.__scopePopover),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(zl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),zl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,u=wt(Xt,n),h=Sn(n);return cr(),d.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(gn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>u.onOpenChange(!1),children:d.jsx(br,{"data-state":Bl(u.open),role:"dialog",id:u.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Hl="PopoverClose",ev=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=wt(Hl,n);return d.jsx(xe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});ev.displayName=Hl;var tv="PopoverArrow",nv=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,s=Sn(n);return d.jsx(yr,{...s,...r,ref:t})});nv.displayName=tv;function Bl(e){return e?"open":"closed"}var sv=Dl,rv=Fl,ov=$l,av=Ul;function Wl({...e}){return d.jsx(sv,{"data-slot":"popover",...e})}function Vl({...e}){return d.jsx(rv,{"data-slot":"popover-trigger",...e})}function Gl({className:e,align:t="center",sideOffset:n=4,...r}){return d.jsx(ov,{children:d.jsx(av,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Uo=1,iv=.9,lv=.8,cv=.17,Ms=.1,Is=.999,dv=.9999,uv=.99,fv=/[\\\/_+.#"@\[\(\{&]/,mv=/[\\\/_+.#"@\[\(\{&]/g,pv=/[\s-]/,ql=/[\s-]/g;function Zs(e,t,n,r,s,o,a){if(o===t.length)return s===e.length?Uo:uv;var i=`${s},${o}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(o),f=n.indexOf(m,s),l=0,c,u,h,x;f>=0;)c=Zs(e,t,n,r,f+1,o+1,a),c>l&&(f===s?c*=Uo:fv.test(e.charAt(f-1))?(c*=lv,h=e.slice(s,f-1).match(mv),h&&s>0&&(c*=Math.pow(Is,h.length))):pv.test(e.charAt(f-1))?(c*=iv,x=e.slice(s,f-1).match(ql),x&&s>0&&(c*=Math.pow(Is,x.length))):(c*=cv,s>0&&(c*=Math.pow(Is,f-s))),e.charAt(f)!==t.charAt(o)&&(c*=dv)),(c<Ms&&n.charAt(f-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(f-1)!==r.charAt(o))&&(u=Zs(e,t,n,r,f+1,o+2,a),u*Ms>c&&(c=u*Ms)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function zo(e){return e.toLowerCase().replace(ql," ")}function hv(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Zs(e,t,zo(e),zo(t),0,0,{})}var ps="Dialog",[Kl]=at(ps),[gv,Ve]=Kl(ps),Yl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ht({prop:r,defaultProp:s??!1,onChange:o,caller:ps});return d.jsx(gv,{scope:t,triggerRef:i,contentRef:m,contentId:Pe(),titleId:Pe(),descriptionId:Pe(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};Yl.displayName=ps;var Xl="DialogTrigger",xv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Xl,n),o=Ae(t,s.triggerRef);return d.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Hr(s.open),...r,ref:o,onClick:ne(e.onClick,s.onOpenToggle)})});xv.displayName=Xl;var Ur="DialogPortal",[vv,Ql]=Kl(Ur,{forceMount:void 0}),Jl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,o=Ve(Ur,t);return d.jsx(vv,{scope:t,forceMount:n,children:p.Children.map(r,a=>d.jsx(Ue,{present:n||o.open,children:d.jsx(vn,{asChild:!0,container:s,children:a})}))})};Jl.displayName=Ur;var Jn="DialogOverlay",Zl=p.forwardRef((e,t)=>{const n=Ql(Jn,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(Jn,e.__scopeDialog);return o.modal?d.jsx(Ue,{present:r||o.open,children:d.jsx(yv,{...s,ref:t})}):null});Zl.displayName=Jn;var bv=qt("DialogOverlay.RemoveScroll"),yv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(Jn,n);return d.jsx(rr,{as:bv,allowPinchZoom:!0,shards:[s.contentRef],children:d.jsx(xe.div,{"data-state":Hr(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),jt="DialogContent",ec=p.forwardRef((e,t)=>{const n=Ql(jt,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,o=Ve(jt,e.__scopeDialog);return d.jsx(Ue,{present:r||o.open,children:o.modal?d.jsx(wv,{...s,ref:t}):d.jsx(Cv,{...s,ref:t})})});ec.displayName=jt;var wv=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(null),s=Ae(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return wr(o)},[]),d.jsx(tc,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ne(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ne(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:ne(e.onFocusOutside,o=>o.preventDefault())})}),Cv=p.forwardRef((e,t)=>{const n=Ve(jt,e.__scopeDialog),r=p.useRef(!1),s=p.useRef(!1);return d.jsx(tc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,o),o.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:o=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),tc=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,i=Ve(jt,n),m=p.useRef(null),f=Ae(t,m);return cr(),d.jsxs(d.Fragment,{children:[d.jsx(Zn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(gn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Hr(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(kv,{titleId:i.titleId}),d.jsx(Ev,{contentRef:m,descriptionId:i.descriptionId})]})]})}),zr="DialogTitle",nc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(zr,n);return d.jsx(xe.h2,{id:s.titleId,...r,ref:t})});nc.displayName=zr;var sc="DialogDescription",Sv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(sc,n);return d.jsx(xe.p,{id:s.descriptionId,...r,ref:t})});Sv.displayName=sc;var rc="DialogClose",oc=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=Ve(rc,n);return d.jsx(xe.button,{type:"button",...r,ref:t,onClick:ne(e.onClick,()=>s.onOpenChange(!1))})});oc.displayName=rc;function Hr(e){return e?"open":"closed"}var ac="DialogTitleWarning",[Ay,ic]=Hu(ac,{contentName:jt,titleName:zr,docsSlug:"dialog"}),kv=({titleId:e})=>{const t=ic(ac),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
264
264
|
|
|
265
265
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
266
266
|
|
|
267
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Av="DialogDescriptionWarning",Ev=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ic(Av).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_v=Yl,Tv=Jl,Rv=Zl,Nv=ec,_y=nc,Ty=oc,an='[cmdk-group=""]',Ps='[cmdk-group-items=""]',jv='[cmdk-group-heading=""]',lc='[cmdk-item=""]',Ho=`${lc}:not([aria-disabled="true"])`,er="cmdk-item-select",zt="data-value",Mv=(e,t,n)=>hv(e,t,n),cc=p.createContext(void 0),kn=()=>p.useContext(cc),dc=p.createContext(void 0),Br=()=>p.useContext(dc),uc=p.createContext(void 0),fc=p.forwardRef((e,t)=>{let n=Ht(()=>{var j,L;return{search:"",value:(L=(j=e.value)!=null?j:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ht(()=>new Set),s=Ht(()=>new Map),o=Ht(()=>new Map),a=Ht(()=>new Set),i=mc(e),{label:m,children:f,value:l,onValueChange:c,filter:u,shouldFilter:h,loop:g,disablePointerSelection:b=!1,vimBindings:y=!0,...v}=e,E=Pe(),_=Pe(),A=Pe(),O=p.useRef(null),k=Bv();Mt(()=>{if(l!==void 0){let j=l.trim();n.current.value=j,T.emit()}},[l]),Mt(()=>{k(6,F)},[]);let T=p.useMemo(()=>({subscribe:j=>(a.current.add(j),()=>a.current.delete(j)),snapshot:()=>n.current,setState:(j,L,$)=>{var N,B,G,q;if(!Object.is(n.current[j],L)){if(n.current[j]=L,j==="search")D(),R(),k(1,P);else if(j==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(A);K?K.focus():(N=document.getElementById(E))==null||N.focus()}if(k(7,()=>{var K;n.current.selectedItemId=(K=M())==null?void 0:K.id,T.emit()}),$||k(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let K=L??"";(q=(G=i.current).onValueChange)==null||q.call(G,K);return}}T.emit()}},emit:()=>{a.current.forEach(j=>j())}}),[]),x=p.useMemo(()=>({value:(j,L,$)=>{var N;L!==((N=o.current.get(j))==null?void 0:N.value)&&(o.current.set(j,{value:L,keywords:$}),n.current.filtered.items.set(j,w(L,$)),k(2,()=>{R(),T.emit()}))},item:(j,L)=>(r.current.add(j),L&&(s.current.has(L)?s.current.get(L).add(j):s.current.set(L,new Set([j]))),k(3,()=>{D(),R(),n.current.value||P(),T.emit()}),()=>{o.current.delete(j),r.current.delete(j),n.current.filtered.items.delete(j);let $=M();k(4,()=>{D(),($==null?void 0:$.getAttribute("id"))===j&&P(),T.emit()})}),group:j=>(s.current.has(j)||s.current.set(j,new Set),()=>{o.current.delete(j),s.current.delete(j)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:E,inputId:A,labelId:_,listInnerRef:O}),[]);function w(j,L){var $,N;let B=(N=($=i.current)==null?void 0:$.filter)!=null?N:Mv;return j?B(j,n.current.search,L):0}function R(){if(!n.current.search||i.current.shouldFilter===!1)return;let j=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(N=>{let B=s.current.get(N),G=0;B.forEach(q=>{let K=j.get(q);G=Math.max(K,G)}),L.push([N,G])});let $=O.current;z().sort((N,B)=>{var G,q;let K=N.getAttribute("id"),oe=B.getAttribute("id");return((G=j.get(oe))!=null?G:0)-((q=j.get(K))!=null?q:0)}).forEach(N=>{let B=N.closest(Ps);B?B.appendChild(N.parentElement===B?N:N.closest(`${Ps} > *`)):$.appendChild(N.parentElement===$?N:N.closest(`${Ps} > *`))}),L.sort((N,B)=>B[1]-N[1]).forEach(N=>{var B;let G=(B=O.current)==null?void 0:B.querySelector(`${an}[${zt}="${encodeURIComponent(N[0])}"]`);G==null||G.parentElement.appendChild(G)})}function P(){let j=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=j==null?void 0:j.getAttribute(zt);T.setState("value",L||void 0)}function D(){var j,L,$,N;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let G of r.current){let q=(L=(j=o.current.get(G))==null?void 0:j.value)!=null?L:"",K=(N=($=o.current.get(G))==null?void 0:$.keywords)!=null?N:[],oe=w(q,K);n.current.filtered.items.set(G,oe),oe>0&&B++}for(let[G,q]of s.current)for(let K of q)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=B}function F(){var j,L,$;let N=M();N&&(((j=N.parentElement)==null?void 0:j.firstChild)===N&&(($=(L=N.closest(an))==null?void 0:L.querySelector(jv))==null||$.scrollIntoView({block:"nearest"})),N.scrollIntoView({block:"nearest"}))}function M(){var j;return(j=O.current)==null?void 0:j.querySelector(`${lc}[aria-selected="true"]`)}function z(){var j;return Array.from(((j=O.current)==null?void 0:j.querySelectorAll(Ho))||[])}function S(j){let L=z()[j];L&&T.setState("value",L.getAttribute(zt))}function C(j){var L;let $=M(),N=z(),B=N.findIndex(q=>q===$),G=N[B+j];(L=i.current)!=null&&L.loop&&(G=B+j<0?N[N.length-1]:B+j===N.length?N[0]:N[B+j]),G&&T.setState("value",G.getAttribute(zt))}function H(j){let L=M(),$=L==null?void 0:L.closest(an),N;for(;$&&!N;)$=j>0?zv($,an):Hv($,an),N=$==null?void 0:$.querySelector(Ho);N?T.setState("value",N.getAttribute(zt)):C(j)}let I=()=>S(z().length-1),U=j=>{j.preventDefault(),j.metaKey?I():j.altKey?H(1):C(1)},Y=j=>{j.preventDefault(),j.metaKey?S(0):j.altKey?H(-1):C(-1)};return p.createElement(yt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:j=>{var L;(L=v.onKeyDown)==null||L.call(v,j);let $=j.nativeEvent.isComposing||j.keyCode===229;if(!(j.defaultPrevented||$))switch(j.key){case"n":case"j":{y&&j.ctrlKey&&U(j);break}case"ArrowDown":{U(j);break}case"p":case"k":{y&&j.ctrlKey&&Y(j);break}case"ArrowUp":{Y(j);break}case"Home":{j.preventDefault(),S(0);break}case"End":{j.preventDefault(),I();break}case"Enter":{j.preventDefault();let N=M();if(N){let B=new Event(er);N.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:Vv},m),hs(e,j=>p.createElement(dc.Provider,{value:T},p.createElement(cc.Provider,{value:x},j))))}),Iv=p.forwardRef((e,t)=>{var n,r;let s=Pe(),o=p.useRef(null),a=p.useContext(uc),i=kn(),m=mc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Mt(()=>{if(!f)return i.item(s,a==null?void 0:a.id)},[f]);let l=pc(s,o,[e.value,e.children,o],e.keywords),c=Br(),u=vt(k=>k.value&&k.value===l.current),h=vt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(s)>0:!0);p.useEffect(()=>{let k=o.current;if(!(!k||e.disabled))return k.addEventListener(er,g),()=>k.removeEventListener(er,g)},[h,e.onSelect,e.disabled]);function g(){var k,T;b(),(T=(k=m.current).onSelect)==null||T.call(k,l.current)}function b(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:y,value:v,onSelect:E,forceMount:_,keywords:A,...O}=e;return p.createElement(yt.div,{ref:Je(o,t),...O,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!u,"data-disabled":!!y,"data-selected":!!u,onPointerMove:y||i.getDisablePointerSelection()?void 0:b,onClick:y?void 0:g},e.children)}),Pv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,a=Pe(),i=p.useRef(null),m=p.useRef(null),f=Pe(),l=kn(),c=vt(h=>s||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Mt(()=>l.group(a),[]),pc(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:s}),[s]);return p.createElement(yt.div,{ref:Je(i,t),...o,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),hs(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(uc.Provider,{value:u},h))))}),Dv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=p.useRef(null),o=vt(a=>!a.search);return!n&&!o?null:p.createElement(yt.div,{ref:Je(s,t),...r,"cmdk-separator":"",role:"separator"})}),Ov=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Br(),a=vt(f=>f.search),i=vt(f=>f.selectedItemId),m=kn();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement(yt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:s?e.value:a,onChange:f=>{s||o.setState("search",f.target.value),n==null||n(f.target.value)}})}),Lv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=p.useRef(null),a=p.useRef(null),i=vt(f=>f.selectedItemId),m=kn();return p.useEffect(()=>{if(a.current&&o.current){let f=a.current,l=o.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(c),u.unobserve(f)}}},[]),p.createElement(yt.div,{ref:Je(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},hs(e,f=>p.createElement("div",{ref:Je(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),Fv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:a,...i}=e;return p.createElement(_v,{open:n,onOpenChange:r},p.createElement(Tv,{container:a},p.createElement(Rv,{"cmdk-overlay":"",className:s}),p.createElement(Nv,{"aria-label":e.label,"cmdk-dialog":"",className:o},p.createElement(fc,{ref:t,...i}))))}),$v=p.forwardRef((e,t)=>vt(n=>n.filtered.count===0)?p.createElement(yt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Uv=p.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return p.createElement(yt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},hs(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),nn=Object.assign(fc,{List:Lv,Item:Iv,Input:Ov,Group:Pv,Separator:Dv,Dialog:Fv,Empty:$v,Loading:Uv});function zv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Hv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mc(e){let t=p.useRef(e);return Mt(()=>{t.current=e}),t}var Mt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ht(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function vt(e){let t=Br(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function pc(e,t,n,r=[]){let s=p.useRef(),o=kn();return Mt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():s.current}})(),m=r.map(f=>f.trim());o.value(e,i,m),(a=t.current)==null||a.setAttribute(zt,i),s.current=i}),s}var Bv=()=>{let[e,t]=p.useState(),n=Ht(()=>new Map);return Mt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function Wv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function hs({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Wv(t),{ref:t.ref},n(t.props.children)):n(t)}var Vv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Gv({className:e,...t}){return d.jsx(nn,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function qv({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(du,{className:"size-4 shrink-0 opacity-50"}),d.jsx(nn.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Kv({className:e,...t}){return d.jsx(nn.List,{"data-slot":"command-list",className:ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Yv({...e}){return d.jsx(nn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Xv({className:e,...t}){return d.jsx(nn.Group,{"data-slot":"command-group",className:ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Qv({className:e,...t}){return d.jsx(nn.Item,{"data-slot":"command-item",className:ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Bo(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let s=0;for(let o=0;o<r.length&&s<n.length;o++)r[o]===n[s]&&s++;return s===n.length}function Jv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:s=!1}){const[o,a]=p.useState(""),[i,m]=p.useState(s?"__none__":void 0),f=p.useMemo(()=>o?e.filter(l=>Bo(o,l.name)||Bo(o,l.modelId)):e,[e,o]);return d.jsxs(Gv,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&d.jsx(qv,{placeholder:"Select a model…",value:o,onValueChange:a}),d.jsxs(Kv,{children:[d.jsx(Yv,{children:"No models found."}),d.jsx(Xv,{children:f.map(l=>d.jsxs(Qv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),d.jsx(pn,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function hc(e){const[t,n]=p.useState(e.modelState),[r,s]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==c.currentModelId&&c.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},l=c=>{n(u=>u?{...u,currentModelId:c}:null),s(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const o=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>o.find(f=>f.modelId===a)??null,[o,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");s(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw s(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&o.length>0,availableModels:o,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Zv({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:s,availableModels:o,currentModel:a,setModel:i,isLoading:m}=hc(e),f=s&&o.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async u=>{try{await i(u.modelId),t==null||t(u.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(Wl,{open:n,onOpenChange:f?r:void 0,children:[d.jsx(Vl,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(ga,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(ha,{className:"h-3 w-3"}):d.jsx(Qt,{className:"h-3 w-3"})]})}),d.jsx(Gl,{className:"w-72 p-0",align:"end",children:d.jsx(Jv,{models:o,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function eb(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const s=o=>{n(o)};return e.setAvailableCommandsChangedHandler(s),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function gc(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function tb(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return gc(e)}function nb(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!gc(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const s=await r.getType("text/plain");await t.writeText(await s.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Wr=new Set(["clear","new","help","status","model","copy","resume"]);function tr(){return[{name:"compact",desc:V("cmd.desc.compact")},{name:"cost",desc:V("cmd.desc.cost")},{name:"summary",desc:V("cmd.desc.summary")},{name:"files",desc:V("cmd.desc.files")}]}function xc(){return tr().map(e=>({name:e.name,description:e.desc}))}function vc(){return[{name:"clear",description:V("cmd.desc.clear")},{name:"new",description:V("cmd.desc.new")},{name:"help",description:V("cmd.desc.help")},{name:"status",description:V("cmd.desc.status")},{name:"model",description:V("cmd.desc.model"),input:{hint:V("cmd.hint.modelId")}},{name:"copy",description:V("cmd.desc.copy")},{name:"resume",description:V("cmd.desc.resume"),input:{hint:V("cmd.hint.sessionId")}}]}function sb(){return[...vc(),...xc()]}const Wo=new Set(["compact","cost","summary","files"]);function Ry(e,t=[]){if(e.length===0&&t.length===0)return sb();const n=Wr,r=new Set,s=[],o=a=>{n.has(a.name)||r.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!Wo.has(a.name)||a.type===void 0&&!Wo.has(a.name)||(r.add(a.name),s.push({name:a.name,description:a.description||V("cmd.desc.agentFallback"),...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)o(a);for(const a of t)o(a);for(const a of xc())r.has(a.name)||(r.add(a.name),s.push(a));return[...vc(),...s]}function rb(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";case"resume":return"Resume";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function ob(e){switch(e){case"help":return V("cmd.subtitle.help");case"status":return V("cmd.subtitle.status");case"model":return V("cmd.subtitle.model");case"copy":return V("cmd.subtitle.copy");case"resume":return V("cmd.subtitle.resume");default:return""}}function ab(e){var r;const t=[];t.push(V("cmd.help.localHeader")),t.push("");const n=[{name:"clear",desc:V("cmd.desc.clear")},{name:"new",desc:V("cmd.desc.new")},{name:"help",desc:V("cmd.desc.help")},{name:"status",desc:V("cmd.desc.status")},{name:"model [id]",desc:V("cmd.desc.model")},{name:"copy",desc:V("cmd.desc.copy")},{name:"resume [会话id]",desc:V("cmd.desc.resume")}];for(const s of n)t.push(`- \`/${s.name}\` — ${s.desc}`);t.push(""),t.push(V("cmd.help.agentHeader")),t.push("");for(const s of tr())t.push(`- \`/${s.name}\` — ${s.desc}`);if(e.length>0){const s=new Set([...Wr,...tr().map(o=>o.name)]);for(const o of e){if(s.has(o.name))continue;const a=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${a}\` — ${o.description}`)}}return t.join(`
|
|
267
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Av="DialogDescriptionWarning",Ev=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ic(Av).contentName}}.`;return p.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_v=Yl,Tv=Jl,Rv=Zl,Nv=ec,Ey=nc,_y=oc,an='[cmdk-group=""]',Ps='[cmdk-group-items=""]',jv='[cmdk-group-heading=""]',lc='[cmdk-item=""]',Ho=`${lc}:not([aria-disabled="true"])`,er="cmdk-item-select",zt="data-value",Mv=(e,t,n)=>hv(e,t,n),cc=p.createContext(void 0),kn=()=>p.useContext(cc),dc=p.createContext(void 0),Br=()=>p.useContext(dc),uc=p.createContext(void 0),fc=p.forwardRef((e,t)=>{let n=Ht(()=>{var M,O;return{search:"",value:(O=(M=e.value)!=null?M:e.defaultValue)!=null?O:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ht(()=>new Set),s=Ht(()=>new Map),o=Ht(()=>new Map),a=Ht(()=>new Set),i=mc(e),{label:m,children:f,value:l,onValueChange:c,filter:u,shouldFilter:h,loop:x,disablePointerSelection:b=!1,vimBindings:y=!0,...v}=e,E=Pe(),_=Pe(),k=Pe(),L=p.useRef(null),A=Bv();Mt(()=>{if(l!==void 0){let M=l.trim();n.current.value=M,T.emit()}},[l]),Mt(()=>{A(6,F)},[]);let T=p.useMemo(()=>({subscribe:M=>(a.current.add(M),()=>a.current.delete(M)),snapshot:()=>n.current,setState:(M,O,$)=>{var R,B,G,q;if(!Object.is(n.current[M],O)){if(n.current[M]=O,M==="search")D(),N(),A(1,P);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let K=document.getElementById(k);K?K.focus():(R=document.getElementById(E))==null||R.focus()}if(A(7,()=>{var K;n.current.selectedItemId=(K=j())==null?void 0:K.id,T.emit()}),$||A(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let K=O??"";(q=(G=i.current).onValueChange)==null||q.call(G,K);return}}T.emit()}},emit:()=>{a.current.forEach(M=>M())}}),[]),g=p.useMemo(()=>({value:(M,O,$)=>{var R;O!==((R=o.current.get(M))==null?void 0:R.value)&&(o.current.set(M,{value:O,keywords:$}),n.current.filtered.items.set(M,w(O,$)),A(2,()=>{N(),T.emit()}))},item:(M,O)=>(r.current.add(M),O&&(s.current.has(O)?s.current.get(O).add(M):s.current.set(O,new Set([M]))),A(3,()=>{D(),N(),n.current.value||P(),T.emit()}),()=>{o.current.delete(M),r.current.delete(M),n.current.filtered.items.delete(M);let $=j();A(4,()=>{D(),($==null?void 0:$.getAttribute("id"))===M&&P(),T.emit()})}),group:M=>(s.current.has(M)||s.current.set(M,new Set),()=>{o.current.delete(M),s.current.delete(M)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:E,inputId:k,labelId:_,listInnerRef:L}),[]);function w(M,O){var $,R;let B=(R=($=i.current)==null?void 0:$.filter)!=null?R:Mv;return M?B(M,n.current.search,O):0}function N(){if(!n.current.search||i.current.shouldFilter===!1)return;let M=n.current.filtered.items,O=[];n.current.filtered.groups.forEach(R=>{let B=s.current.get(R),G=0;B.forEach(q=>{let K=M.get(q);G=Math.max(K,G)}),O.push([R,G])});let $=L.current;z().sort((R,B)=>{var G,q;let K=R.getAttribute("id"),oe=B.getAttribute("id");return((G=M.get(oe))!=null?G:0)-((q=M.get(K))!=null?q:0)}).forEach(R=>{let B=R.closest(Ps);B?B.appendChild(R.parentElement===B?R:R.closest(`${Ps} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Ps} > *`))}),O.sort((R,B)=>B[1]-R[1]).forEach(R=>{var B;let G=(B=L.current)==null?void 0:B.querySelector(`${an}[${zt}="${encodeURIComponent(R[0])}"]`);G==null||G.parentElement.appendChild(G)})}function P(){let M=z().find($=>$.getAttribute("aria-disabled")!=="true"),O=M==null?void 0:M.getAttribute(zt);T.setState("value",O||void 0)}function D(){var M,O,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let G of r.current){let q=(O=(M=o.current.get(G))==null?void 0:M.value)!=null?O:"",K=(R=($=o.current.get(G))==null?void 0:$.keywords)!=null?R:[],oe=w(q,K);n.current.filtered.items.set(G,oe),oe>0&&B++}for(let[G,q]of s.current)for(let K of q)if(n.current.filtered.items.get(K)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=B}function F(){var M,O,$;let R=j();R&&(((M=R.parentElement)==null?void 0:M.firstChild)===R&&(($=(O=R.closest(an))==null?void 0:O.querySelector(jv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function j(){var M;return(M=L.current)==null?void 0:M.querySelector(`${lc}[aria-selected="true"]`)}function z(){var M;return Array.from(((M=L.current)==null?void 0:M.querySelectorAll(Ho))||[])}function S(M){let O=z()[M];O&&T.setState("value",O.getAttribute(zt))}function C(M){var O;let $=j(),R=z(),B=R.findIndex(q=>q===$),G=R[B+M];(O=i.current)!=null&&O.loop&&(G=B+M<0?R[R.length-1]:B+M===R.length?R[0]:R[B+M]),G&&T.setState("value",G.getAttribute(zt))}function H(M){let O=j(),$=O==null?void 0:O.closest(an),R;for(;$&&!R;)$=M>0?zv($,an):Hv($,an),R=$==null?void 0:$.querySelector(Ho);R?T.setState("value",R.getAttribute(zt)):C(M)}let I=()=>S(z().length-1),U=M=>{M.preventDefault(),M.metaKey?I():M.altKey?H(1):C(1)},Y=M=>{M.preventDefault(),M.metaKey?S(0):M.altKey?H(-1):C(-1)};return p.createElement(yt.div,{ref:t,tabIndex:-1,...v,"cmdk-root":"",onKeyDown:M=>{var O;(O=v.onKeyDown)==null||O.call(v,M);let $=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||$))switch(M.key){case"n":case"j":{y&&M.ctrlKey&&U(M);break}case"ArrowDown":{U(M);break}case"p":case"k":{y&&M.ctrlKey&&Y(M);break}case"ArrowUp":{Y(M);break}case"Home":{M.preventDefault(),S(0);break}case"End":{M.preventDefault(),I();break}case"Enter":{M.preventDefault();let R=j();if(R){let B=new Event(er);R.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:g.inputId,id:g.labelId,style:Vv},m),hs(e,M=>p.createElement(dc.Provider,{value:T},p.createElement(cc.Provider,{value:g},M))))}),Iv=p.forwardRef((e,t)=>{var n,r;let s=Pe(),o=p.useRef(null),a=p.useContext(uc),i=kn(),m=mc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Mt(()=>{if(!f)return i.item(s,a==null?void 0:a.id)},[f]);let l=pc(s,o,[e.value,e.children,o],e.keywords),c=Br(),u=vt(A=>A.value&&A.value===l.current),h=vt(A=>f||i.filter()===!1?!0:A.search?A.filtered.items.get(s)>0:!0);p.useEffect(()=>{let A=o.current;if(!(!A||e.disabled))return A.addEventListener(er,x),()=>A.removeEventListener(er,x)},[h,e.onSelect,e.disabled]);function x(){var A,T;b(),(T=(A=m.current).onSelect)==null||T.call(A,l.current)}function b(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:y,value:v,onSelect:E,forceMount:_,keywords:k,...L}=e;return p.createElement(yt.div,{ref:Je(o,t),...L,id:s,"cmdk-item":"",role:"option","aria-disabled":!!y,"aria-selected":!!u,"data-disabled":!!y,"data-selected":!!u,onPointerMove:y||i.getDisablePointerSelection()?void 0:b,onClick:y?void 0:x},e.children)}),Pv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:s,...o}=e,a=Pe(),i=p.useRef(null),m=p.useRef(null),f=Pe(),l=kn(),c=vt(h=>s||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Mt(()=>l.group(a),[]),pc(a,i,[e.value,e.heading,m]);let u=p.useMemo(()=>({id:a,forceMount:s}),[s]);return p.createElement(yt.div,{ref:Je(i,t),...o,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),hs(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(uc.Provider,{value:u},h))))}),Dv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,s=p.useRef(null),o=vt(a=>!a.search);return!n&&!o?null:p.createElement(yt.div,{ref:Je(s,t),...r,"cmdk-separator":"",role:"separator"})}),Ov=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,s=e.value!=null,o=Br(),a=vt(f=>f.search),i=vt(f=>f.selectedItemId),m=kn();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement(yt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:s?e.value:a,onChange:f=>{s||o.setState("search",f.target.value),n==null||n(f.target.value)}})}),Lv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...s}=e,o=p.useRef(null),a=p.useRef(null),i=vt(f=>f.selectedItemId),m=kn();return p.useEffect(()=>{if(a.current&&o.current){let f=a.current,l=o.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return u.observe(f),()=>{cancelAnimationFrame(c),u.unobserve(f)}}},[]),p.createElement(yt.div,{ref:Je(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},hs(e,f=>p.createElement("div",{ref:Je(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),Fv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:o,container:a,...i}=e;return p.createElement(_v,{open:n,onOpenChange:r},p.createElement(Tv,{container:a},p.createElement(Rv,{"cmdk-overlay":"",className:s}),p.createElement(Nv,{"aria-label":e.label,"cmdk-dialog":"",className:o},p.createElement(fc,{ref:t,...i}))))}),$v=p.forwardRef((e,t)=>vt(n=>n.filtered.count===0)?p.createElement(yt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Uv=p.forwardRef((e,t)=>{let{progress:n,children:r,label:s="Loading...",...o}=e;return p.createElement(yt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},hs(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),nn=Object.assign(fc,{List:Lv,Item:Iv,Input:Ov,Group:Pv,Separator:Dv,Dialog:Fv,Empty:$v,Loading:Uv});function zv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Hv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function mc(e){let t=p.useRef(e);return Mt(()=>{t.current=e}),t}var Mt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ht(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function vt(e){let t=Br(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function pc(e,t,n,r=[]){let s=p.useRef(),o=kn();return Mt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():s.current}})(),m=r.map(f=>f.trim());o.value(e,i,m),(a=t.current)==null||a.setAttribute(zt,i),s.current=i}),s}var Bv=()=>{let[e,t]=p.useState(),n=Ht(()=>new Map);return Mt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,s)=>{n.current.set(r,s),t({})}};function Wv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function hs({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Wv(t),{ref:t.ref},n(t.props.children)):n(t)}var Vv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Gv({className:e,...t}){return d.jsx(nn,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function qv({className:e,...t}){return d.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[d.jsx(du,{className:"size-4 shrink-0 opacity-50"}),d.jsx(nn.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Kv({className:e,...t}){return d.jsx(nn.List,{"data-slot":"command-list",className:ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Yv({...e}){return d.jsx(nn.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Xv({className:e,...t}){return d.jsx(nn.Group,{"data-slot":"command-group",className:ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Qv({className:e,...t}){return d.jsx(nn.Item,{"data-slot":"command-item",className:ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Bo(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let s=0;for(let o=0;o<r.length&&s<n.length;o++)r[o]===n[s]&&s++;return s===n.length}function Jv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:s=!1}){const[o,a]=p.useState(""),[i,m]=p.useState(s?"__none__":void 0),f=p.useMemo(()=>o?e.filter(l=>Bo(o,l.name)||Bo(o,l.modelId)):e,[e,o]);return d.jsxs(Gv,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&d.jsx(qv,{placeholder:"Select a model…",value:o,onValueChange:a}),d.jsxs(Kv,{children:[d.jsx(Yv,{children:"No models found."}),d.jsx(Xv,{children:f.map(l=>d.jsxs(Qv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[d.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[d.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&d.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),d.jsx(pn,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function hc(e){const[t,n]=p.useState(e.modelState),[r,s]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const u=localStorage.getItem("acp_model_id");u&&u!==c.currentModelId&&c.availableModels.some(h=>h.modelId===u)&&e.setSessionModel(u).catch(()=>{})}},l=c=>{n(u=>u?{...u,currentModelId:c}:null),s(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const o=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>o.find(f=>f.modelId===a)??null,[o,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");s(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw s(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&o.length>0,availableModels:o,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Zv({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:s,availableModels:o,currentModel:a,setModel:i,isLoading:m}=hc(e),f=s&&o.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async u=>{try{await i(u.modelId),t==null||t(u.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return d.jsxs(Wl,{open:n,onOpenChange:f?r:void 0,children:[d.jsx(Vl,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?d.jsx(ga,{className:"h-3 w-3 animate-spin"}):null,d.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?d.jsx(ha,{className:"h-3 w-3"}):d.jsx(Qt,{className:"h-3 w-3"})]})}),d.jsx(Gl,{className:"w-72 p-0",align:"end",children:d.jsx(Jv,{models:o,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function eb(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const s=o=>{n(o)};return e.setAvailableCommandsChangedHandler(s),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function gc(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function tb(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return gc(e)}function nb(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!gc(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const s=await r.getType("text/plain");await t.writeText(await s.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Wr=new Set(["clear","new","help","status","model","copy","resume"]);function tr(){return[{name:"compact",desc:V("cmd.desc.compact")},{name:"cost",desc:V("cmd.desc.cost")},{name:"summary",desc:V("cmd.desc.summary")},{name:"files",desc:V("cmd.desc.files")}]}function xc(){return tr().map(e=>({name:e.name,description:e.desc}))}function vc(){return[{name:"clear",description:V("cmd.desc.clear")},{name:"new",description:V("cmd.desc.new")},{name:"help",description:V("cmd.desc.help")},{name:"status",description:V("cmd.desc.status")},{name:"model",description:V("cmd.desc.model"),input:{hint:V("cmd.hint.modelId")}},{name:"copy",description:V("cmd.desc.copy")},{name:"resume",description:V("cmd.desc.resume"),input:{hint:V("cmd.hint.sessionId")}}]}function sb(){return[...vc(),...xc()]}const Wo=new Set(["compact","cost","summary","files"]);function Ty(e,t=[]){if(e.length===0&&t.length===0)return sb();const n=Wr,r=new Set,s=[],o=a=>{n.has(a.name)||r.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!Wo.has(a.name)||a.type===void 0&&!Wo.has(a.name)||(r.add(a.name),s.push({name:a.name,description:a.description||V("cmd.desc.agentFallback"),...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)o(a);for(const a of t)o(a);for(const a of xc())r.has(a.name)||(r.add(a.name),s.push(a));return[...vc(),...s]}function rb(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";case"resume":return"Resume";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function ob(e){switch(e){case"help":return V("cmd.subtitle.help");case"status":return V("cmd.subtitle.status");case"model":return V("cmd.subtitle.model");case"copy":return V("cmd.subtitle.copy");case"resume":return V("cmd.subtitle.resume");default:return""}}function ab(e){var r;const t=[];t.push(V("cmd.help.localHeader")),t.push("");const n=[{name:"clear",desc:V("cmd.desc.clear")},{name:"new",desc:V("cmd.desc.new")},{name:"help",desc:V("cmd.desc.help")},{name:"status",desc:V("cmd.desc.status")},{name:"model [id]",desc:V("cmd.desc.model")},{name:"copy",desc:V("cmd.desc.copy")},{name:"resume [会话id]",desc:V("cmd.desc.resume")}];for(const s of n)t.push(`- \`/${s.name}\` — ${s.desc}`);t.push(""),t.push(V("cmd.help.agentHeader")),t.push("");for(const s of tr())t.push(`- \`/${s.name}\` — ${s.desc}`);if(e.length>0){const s=new Set([...Wr,...tr().map(o=>o.name)]);for(const o of e){if(s.has(o.name))continue;const a=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${a}\` — ${o.description}`)}}return t.join(`
|
|
268
268
|
`)}function ib(e){var n,r,s;const t=[V("cmd.status.header"),""];return t.push(`- ${V("cmd.status.sessionId")}: \`${e.sessionId??V("cmd.status.none")}\``),t.push(`- ${V("cmd.status.currentModel")}: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??V("cmd.status.unset")}`),(s=e.currentModel)!=null&&s.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- ${V("cmd.status.modelCount")}: ${e.modelCount}`),t.push(`- ${V("cmd.status.imageSupport")}: ${e.supportsImages?V("cmd.status.yes"):V("cmd.status.no")}`),t.push(`- ${V("cmd.status.messageCount")}: ${e.entryCount}`),t.join(`
|
|
269
269
|
`)}function lb(e,t){if(e.length===0)return V("cmd.model.none");const n=[V("cmd.model.available"),""];for(const r of e){const s=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${s}`)}return n.push(""),n.push(V("cmd.model.hint")),n.join(`
|
|
270
270
|
`)}async function cb(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),s=r.join(" ").trim(),o=n==null?void 0:n.toLowerCase();if(!o||!Wr.has(o))return{handled:!1};if(o==="clear")return{handled:!0,clearEntries:!0};if(o==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(o==="help")a=ab(t.availableCommands);else if(o==="status")a=ib({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(o==="model")if(s)try{await t.setModel(s),a=we("cmd.model.switched",{id:s})}catch(u){a=we("cmd.model.switchFailed",{message:u instanceof Error?u.message:String(u)}),i=!0}else a=lb(t.availableModels,t.currentModel);else if(o==="copy"){const u=[...t.entries].reverse().find(b=>b.type==="assistant_message"),h=((c=u==null?void 0:u.chunks)==null?void 0:c.map(b=>b.text).join(`
|
|
271
|
-
`))??"";(h?await tb(h):!0)?a=h?we("cmd.copy.copied",{n:h.length}):V("cmd.copy.nothing"):(a=V("cmd.copy.failed"),i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:o,inputText:e,title:rb(o),subtitle:ob(o),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const db={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function ub(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),s=n.match(/^data:([^;,]+)/),o=s?s[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:o})}const Ds=[{value:"default",labelKey:"acp.mode.default",descKey:"acp.mode.defaultDesc"},{value:"acceptEdits",labelKey:"acp.mode.acceptEdits",descKey:"acp.mode.acceptEditsDesc"},{value:"bypassPermissions",labelKey:"acp.mode.bypass",descKey:"acp.mode.bypassDesc"},{value:"plan",labelKey:"acp.mode.plan",descKey:"acp.mode.planDesc"},{value:"dontAsk",labelKey:"acp.mode.dontAsk",descKey:"acp.mode.dontAskDesc"},{value:"auto",labelKey:"acp.mode.auto",descKey:"acp.mode.autoDesc"}];function fb({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),s=Ds.find(o=>o.value===e)??Ds[0];return d.jsxs(Wl,{open:n,onOpenChange:r,children:[d.jsx(Vl,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(xu,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:V(s.labelKey)}),n?d.jsx(ha,{className:"h-3 w-3"}):d.jsx(Qt,{className:"h-3 w-3"})]})}),d.jsx(Gl,{className:"w-64 p-1",align:"start",children:Ds.map(o=>d.jsxs("button",{type:"button",onClick:()=>{t(o.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===o.value&&d.jsx(pn,{className:"h-3.5 w-3.5 text-brand-text"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:V(o.labelKey)}),d.jsx("div",{className:"text-xs text-text-muted",children:V(o.descKey)})]})]},o.value))})]})}function Vo(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Os(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function mb({client:e,agentId:t}){tn();const[n,r]=p.useState([]),[s,o]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[u,h]=p.useState(null),g=p.useRef(null),[b,y]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[v,E]=p.useState(e.usage),[_,A]=p.useState(e.currentModeId),[O,k]=p.useState(!1),{commands:T}=eb(e),{availableModels:x,currentModel:w,setModel:R}=hc(e);p.useEffect(()=>{l.current=m},[m]);const P=p.useCallback(()=>{r([]),o(!1),i(!1),E(null),A(null)},[]),D=t?`acp_last_session_${t}`:null,F=p.useCallback((j,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(r([]),o(!1)),f(j),i(!0),k(e.supportsImages),D)try{localStorage.setItem(D,j)}catch{}console.log("[ChatInterface] Active session:",j,"supportsImages:",e.supportsImages)},[e,D]),M=p.useCallback(j=>{l.current&&j.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",j),r(L=>{const $=Os(L,j.toolCall.toolCallId);if($>=0)return L.map((N,B)=>B!==$||N.type!=="tool_call"||N.toolCall.status!=="running"?N:{type:"tool_call",toolCall:{...N.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:j.requestId,options:j.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const N={type:"tool_call",toolCall:{id:j.toolCall.toolCallId,title:j.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:j.requestId,options:j.options},isStandalonePermission:!0}};return[...L,N]}}))},[]),z=p.useCallback((j,L)=>{if(!(l.current&&j!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="message"?[...N.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:q.text+$}]}]:[...N.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...N,G]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="thought"?[...N.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:q.text+$}]}]:[...N.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...N,G]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(N=>{const B=N[N.length-1];if((B==null?void 0:B.type)==="user_message")return[...N.slice(0,-1),{...B,content:B.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...N,G]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:Vo(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};r(N=>{const B=Os(N,L.toolCallId);if(B>=0)return N.map((q,K)=>K!==B||q.type!=="tool_call"?q:{type:"tool_call",toolCall:{...q.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...N,G]})}else L.sessionUpdate==="tool_call_update"?r($=>{const N=Os($,L.toolCallId);if(N<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,G)=>{if(G!==N||B.type!=="tool_call")return B;const q=L.status?Vo(L.status):B.toolCall.status,K=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:q,...L.title&&{title:L.title},content:K,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?r($=>{if(L.entries.length===0)return $.filter(G=>G.type!=="plan");const N=$.reduce((G,q,K)=>q.type==="plan"?K:G,-1);if(N>=0)return $.map((G,q)=>q===N?{...G,entries:L.entries}:G);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?E(L):L.sessionUpdate==="current_mode_update"&&A(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),P()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),o(!1)}),e.setPermissionRequestHandler(M),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const j=D?localStorage.getItem(D):null;return j&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",j),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:j}):await e.resumeSession({sessionId:j})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,b)}})()):e.createSession(void 0,b),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,M,z,P]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),s&&e.cancel(),P(),f(null),e.createSession(void 0,b)},[e,s,P,b]),C=()=>{console.log("[ChatInterface] Cancel requested"),r(j=>j.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((j,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:j,optionId:L,optionKind:$}),e.respondToPermission(j,L);const N=$==="reject_once"||$==="reject_always"||L===null;r(B=>B.map(G=>{var K;if(G.type!=="tool_call"||((K=G.toolCall.permissionRequest)==null?void 0:K.requestId)!==j)return G;let q;return N?q="rejected":G.toolCall.isStandalonePermission?q="complete":q="running",{type:"tool_call",toolCall:{...G.toolCall,status:q,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),I=n.filter(j=>j.type==="tool_call"&&j.toolCall.status==="waiting_for_confirmation"&&!!j.toolCall.permissionRequest).map(j=>({requestId:j.toolCall.permissionRequest.requestId,toolName:j.toolCall.title,toolInput:j.toolCall.rawInput||{},description:j.toolCall.title,options:j.toolCall.permissionRequest.options})),U=p.useCallback((j,L)=>{const $=I.find(G=>G.requestId===j);let N=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const G=$.options.find(q=>q.kind==="allow_once")??$.options.find(q=>q.kind==="allow_always");G&&(N=G.optionId,B=G.kind)}else{const G=$.options.find(q=>q.kind==="reject_once")??$.options.find(q=>q.kind==="reject_always");G&&(N=G.optionId,B=G.kind)}N||(B=L?"allow_once":"reject_once"),H(j,N,B)},[H,I]),Y=p.useCallback(async j=>{var oe;const L=j.text.trim(),$=j.images||[],N=j.attachments||[];if(!L&&$.length===0&&N.length===0||!a)return;if(L.startsWith("/")&&$.length===0){Tt("[ChatInterface] slash command input",{text:L});const Z=await cb(L,{sessionId:m,availableCommands:T,availableModels:x,currentModel:w,supportsImages:O,entries:c.current,setModel:R,onNewSession:S}).catch(()=>null);if(Z){if(Tt("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){r([]);return}if("newSession"in Z&&Z.newSession){S();return}if("userEntry"in Z){r(se=>[...se,Z.userEntry,Z.cmdEntry]);return}}Tt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}Tt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:s});const B=[];L&&B.push({type:"text",text:L});const G=[];for(const Z of $)try{const se=`data:${Z.mimeType};base64,${Z.data}`;let le;se.startsWith("data:")?le=ub(se):le=await(await fetch(se)).blob();let be=le,ue=Z.mimeType;if(le.size>2*1024*1024){const ce=new File([le],"image.jpg",{type:le.type});be=await Me(ce,db),ue="image/jpeg"}const ye=await new Promise((ce,ve)=>{const Ce=new FileReader;Ce.onloadend=()=>{const me=Ce.result,_e=me.indexOf(",");ce(_e>=0?me.slice(_e+1):me)},Ce.onerror=()=>{var me;return ve(new Error("FileReader error: "+((me=Ce.error)==null?void 0:me.message)))},Ce.readAsDataURL(be)}),fe={type:"image",mimeType:ue,data:ye};B.push(fe),G.push({mimeType:ue,data:ye})}catch(se){console.error("[ChatInterface] Failed to process image:",se)}const q=[];for(const Z of N)try{if(Z.textContent){let se;if(Z.kind==="directory"){const le=((oe=Z.files)==null?void 0:oe.length)??0;se=`${we("attach.directoryHeader",{name:Z.name})} ${we("attach.fileCount",{n:le})}
|
|
271
|
+
`))??"";(h?await tb(h):!0)?a=h?we("cmd.copy.copied",{n:h.length}):V("cmd.copy.nothing"):(a=V("cmd.copy.failed"),i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:o,inputText:e,title:rb(o),subtitle:ob(o),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const db={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function ub(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),s=n.match(/^data:([^;,]+)/),o=s?s[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:o})}const Ds=[{value:"default",labelKey:"acp.mode.default",descKey:"acp.mode.defaultDesc"},{value:"acceptEdits",labelKey:"acp.mode.acceptEdits",descKey:"acp.mode.acceptEditsDesc"},{value:"bypassPermissions",labelKey:"acp.mode.bypass",descKey:"acp.mode.bypassDesc"},{value:"plan",labelKey:"acp.mode.plan",descKey:"acp.mode.planDesc"},{value:"dontAsk",labelKey:"acp.mode.dontAsk",descKey:"acp.mode.dontAskDesc"},{value:"auto",labelKey:"acp.mode.auto",descKey:"acp.mode.autoDesc"}];function fb({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),s=Ds.find(o=>o.value===e)??Ds[0];return d.jsxs(Wl,{open:n,onOpenChange:r,children:[d.jsx(Vl,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[d.jsx(xu,{className:"h-3 w-3"}),d.jsx("span",{className:"max-w-24 truncate",children:V(s.labelKey)}),n?d.jsx(ha,{className:"h-3 w-3"}):d.jsx(Qt,{className:"h-3 w-3"})]})}),d.jsx(Gl,{className:"w-64 p-1",align:"start",children:Ds.map(o=>d.jsxs("button",{type:"button",onClick:()=>{t(o.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[d.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===o.value&&d.jsx(pn,{className:"h-3.5 w-3.5 text-brand-text"})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("div",{className:"text-sm font-medium text-text-primary",children:V(o.labelKey)}),d.jsx("div",{className:"text-xs text-text-muted",children:V(o.descKey)})]})]},o.value))})]})}function Vo(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Os(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function mb({client:e,agentId:t}){tn();const[n,r]=p.useState([]),[s,o]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[u,h]=p.useState(null),x=p.useRef(null),[b,y]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[v,E]=p.useState(e.usage),[_,k]=p.useState(e.currentModeId),[L,A]=p.useState(!1),{commands:T}=eb(e),{availableModels:g,currentModel:w,setModel:N}=hc(e);p.useEffect(()=>{l.current=m},[m]);const P=p.useCallback(()=>{r([]),o(!1),i(!1),E(null),k(null)},[]),D=t?`acp_last_session_${t}`:null,F=p.useCallback((M,O)=>{if(((O==null?void 0:O.resetEntries)??!0)&&(r([]),o(!1)),f(M),i(!0),A(e.supportsImages),D)try{localStorage.setItem(D,M)}catch{}console.log("[ChatInterface] Active session:",M,"supportsImages:",e.supportsImages)},[e,D]),j=p.useCallback(M=>{l.current&&M.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",M),r(O=>{const $=Os(O,M.toolCall.toolCallId);if($>=0)return O.map((R,B)=>B!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:M.requestId,options:M.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:M.toolCall.toolCallId,title:M.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:M.requestId,options:M.options},isStandalonePermission:!0}};return[...O,R]}}))},[]),z=p.useCallback((M,O)=>{if(!(l.current&&M!==l.current))if(O.sessionUpdate==="agent_message_chunk"){const $=O.content.type==="text"&&O.content.text?O.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="message"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,G]})}else if(O.sessionUpdate==="agent_thought_chunk"){const $=O.content.type==="text"&&O.content.text?O.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const q=B.chunks[B.chunks.length-1];return(q==null?void 0:q.type)==="thought"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:q.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,G]})}else if(O.sessionUpdate==="user_message_chunk"){const $=O.content.type==="text"&&O.content.text?O.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="user_message")return[...R.slice(0,-1),{...B,content:B.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,G]})}else if(O.sessionUpdate==="tool_call"){const $={id:O.toolCallId,title:O.title,status:Vo(O.status),content:O.content,rawInput:O.rawInput,rawOutput:O.rawOutput};r(R=>{const B=Os(R,O.toolCallId);if(B>=0)return R.map((q,K)=>K!==B||q.type!=="tool_call"?q:{type:"tool_call",toolCall:{...q.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...R,G]})}else O.sessionUpdate==="tool_call_update"?r($=>{const R=Os($,O.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${O.toolCallId}`);const B={type:"tool_call",toolCall:{id:O.toolCallId,title:O.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,G)=>{if(G!==R||B.type!=="tool_call")return B;const q=O.status?Vo(O.status):B.toolCall.status,K=O.content?[...B.toolCall.content||[],...O.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:q,...O.title&&{title:O.title},content:K,...O.rawInput&&{rawInput:O.rawInput},...O.rawOutput&&{rawOutput:O.rawOutput}}}})}):O.sessionUpdate==="plan"?r($=>{if(O.entries.length===0)return $.filter(G=>G.type!=="plan");const R=$.reduce((G,q,K)=>q.type==="plan"?K:G,-1);if(R>=0)return $.map((G,q)=>q===R?{...G,entries:O.entries}:G);const B={type:"plan",id:`plan-${Date.now()}`,entries:O.entries};return[...$,B]}):O.sessionUpdate==="usage_update"?E(O):O.sessionUpdate==="current_mode_update"&&k(O.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(O=>{console.log("[ChatInterface] Session created:",O),F(O)}),e.setSessionLoadedHandler(O=>{console.log("[ChatInterface] Session loaded/resumed:",O),F(O,{resetEntries:!1})}),e.setSessionSwitchingHandler(O=>{console.log("[ChatInterface] Switching to session:",O),f(O),P()}),e.setSessionUpdateHandler((O,$)=>{z(O,$)}),e.setPromptCompleteHandler(O=>{console.log("[ChatInterface] Prompt complete:",O),o(!1)}),e.setPermissionRequestHandler(j),e.setErrorMessageHandler(O=>{console.error("[ChatInterface] Agent error:",O),h(O),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>h(null),5e3)});const M=D?localStorage.getItem(D):null;return M&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",M),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:M}):await e.resumeSession({sessionId:M})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,b)}})()):e.createSession(void 0,b),()=>{x.current&&clearTimeout(x.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,j,z,P]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),s&&e.cancel(),P(),f(null),e.createSession(void 0,b)},[e,s,P,b]),C=()=>{console.log("[ChatInterface] Cancel requested"),r(M=>M.map(O=>O.type!=="tool_call"||!(O.toolCall.status==="running"||O.toolCall.status==="waiting_for_confirmation")?O:(console.log("[ChatInterface] Marking tool call as canceled:",O.toolCall.id),{type:"tool_call",toolCall:{...O.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((M,O,$)=>{console.log("[ChatInterface] Permission response:",{requestId:M,optionId:O,optionKind:$}),e.respondToPermission(M,O);const R=$==="reject_once"||$==="reject_always"||O===null;r(B=>B.map(G=>{var K;if(G.type!=="tool_call"||((K=G.toolCall.permissionRequest)==null?void 0:K.requestId)!==M)return G;let q;return R?q="rejected":G.toolCall.isStandalonePermission?q="complete":q="running",{type:"tool_call",toolCall:{...G.toolCall,status:q,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),I=n.filter(M=>M.type==="tool_call"&&M.toolCall.status==="waiting_for_confirmation"&&!!M.toolCall.permissionRequest).map(M=>({requestId:M.toolCall.permissionRequest.requestId,toolName:M.toolCall.title,toolInput:M.toolCall.rawInput||{},description:M.toolCall.title,options:M.toolCall.permissionRequest.options})),U=p.useCallback((M,O)=>{const $=I.find(G=>G.requestId===M);let R=null,B=null;if($!=null&&$.options&&$.options.length>0)if(O){const G=$.options.find(q=>q.kind==="allow_once")??$.options.find(q=>q.kind==="allow_always");G&&(R=G.optionId,B=G.kind)}else{const G=$.options.find(q=>q.kind==="reject_once")??$.options.find(q=>q.kind==="reject_always");G&&(R=G.optionId,B=G.kind)}R||(B=O?"allow_once":"reject_once"),H(M,R,B)},[H,I]),Y=p.useCallback(async M=>{var oe;const O=M.text.trim(),$=M.images||[],R=M.attachments||[];if(!O&&$.length===0&&R.length===0||!a)return;if(O.startsWith("/")&&$.length===0){Tt("[ChatInterface] slash command input",{text:O});const Z=await cb(O,{sessionId:m,availableCommands:T,availableModels:g,currentModel:w,supportsImages:L,entries:c.current,setModel:N,onNewSession:S}).catch(()=>null);if(Z){if(Tt("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){r([]);return}if("newSession"in Z&&Z.newSession){S();return}if("userEntry"in Z){r(se=>[...se,Z.userEntry,Z.cmdEntry]);return}}Tt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:O})}Tt("[ChatInterface] forwarding to agent",{text:O,hasImages:$.length>0,sessionReady:a,isLoading:s});const B=[];O&&B.push({type:"text",text:O});const G=[];for(const Z of $)try{const se=`data:${Z.mimeType};base64,${Z.data}`;let le;se.startsWith("data:")?le=ub(se):le=await(await fetch(se)).blob();let be=le,ue=Z.mimeType;if(le.size>2*1024*1024){const ce=new File([le],"image.jpg",{type:le.type});be=await je(ce,db),ue="image/jpeg"}const ye=await new Promise((ce,ve)=>{const Ce=new FileReader;Ce.onloadend=()=>{const me=Ce.result,_e=me.indexOf(",");ce(_e>=0?me.slice(_e+1):me)},Ce.onerror=()=>{var me;return ve(new Error("FileReader error: "+((me=Ce.error)==null?void 0:me.message)))},Ce.readAsDataURL(be)}),fe={type:"image",mimeType:ue,data:ye};B.push(fe),G.push({mimeType:ue,data:ye})}catch(se){console.error("[ChatInterface] Failed to process image:",se)}const q=[];for(const Z of R)try{if(Z.textContent){let se;if(Z.kind==="directory"){const le=((oe=Z.files)==null?void 0:oe.length)??0;se=`${we("attach.directoryHeader",{name:Z.name})} ${we("attach.fileCount",{n:le})}
|
|
272
272
|
${Z.textContent}`}else{const le=Z.size!=null?` (${pb(Z.size)})`:"";se=`📎 ${Z.name}${le}
|
|
273
273
|
\`\`\`
|
|
274
274
|
${Z.textContent}
|
|
275
|
-
\`\`\``}B.push({type:"text",text:se}),q.push(Z)}}catch(se){console.error("[ChatInterface] Failed to process attachment:",se)}if(B.length===0)return;const K={type:"user_message",id:`user-${Date.now()}`,content:L,images:G.length>0?G:void 0,attachments:q.length>0?q:void 0};r(Z=>[...Z,K]),o(!0);try{await e.sendPrompt(B)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),o(!1)}},[s,a,e,T,x,w,O,m,R,S]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(Tx,{entries:n,isLoading:s&&!a?!1:s,onPermissionRespond:(j,L,$)=>{H(j,L,$)},emptyTitle:a?V("session.emptyTitle"):void 0,emptyDescription:a?V("acp.emptyDescription"):void 0}),d.jsx(Wx,{requests:I,onRespond:U}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(fb,{mode:_??b,onModeChange:j=>{A(null),y(j),localStorage.setItem("acp_permission_mode",j)}}),d.jsx(Zv,{client:e}),d.jsx(Gx,{usage:v})]}),n.length>0&&d.jsxs(bg,{children:[d.jsx(yg,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand-text font-display gap-1",onClick:S,children:[d.jsx(ba,{className:"h-3 w-3"}),V("acp.newSession")]})}),d.jsx(wg,{children:"New Thread"})]})]}),d.jsx(Ux,{onSubmit:Y,isLoading:s,onInterrupt:C,disabled:!a,placeholder:V(a?"acp.inputPlaceholder":"acp.waitingPlaceholder"),supportsAttachments:O,commands:T.length>0?T:void 0,queueWhileLoading:!0})]})]})}function pb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function hb({client:e,agentId:t}){tn();const[n,r]=p.useState(!1),s=p.useCallback(async o=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:o.sessionId,cwd:o.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:o.sessionId,cwd:o.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:ee("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:V("acp.sessions")}),d.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:V("acp.newSession"),children:d.jsx(ba,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(ru,{className:"h-4 w-4"}):d.jsx(nu,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(gb,{client:e,onSelectSession:s})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(mb,{client:e,agentId:t})})]})}function gb({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[s,o]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState(!0),g=p.useRef(null),b=p.useCallback(async()=>{if(!e.supportsSessionList){o(!1);return}o(!0);try{const T=await e.listSessions();r(T.sessions)}catch(T){console.warn("[SidebarSessionList] Failed to load:",T)}finally{o(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&b()},[e,b]),p.useEffect(()=>{const T=x=>{x==="connected"&&setTimeout(b,200)};return e.setConnectionStateHandler(T),()=>e.removeConnectionStateHandler(T)},[e,b]),p.useEffect(()=>{const T=setInterval(b,1e4);return()=>clearInterval(T)},[b]),p.useEffect(()=>{e.setSessionDeletedHandler(T=>{b()}),e.setSessionRenamedHandler((T,x)=>{b()})},[e,b]),p.useEffect(()=>{e.setErrorMessageHandler(T=>{/Method not found/i.test(T)&&/session\/(rename|delete)/i.test(T)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const y=p.useCallback(T=>{const x=T.title&&T.title.trim()?T.title:T.sessionId.slice(0,8);if(window.confirm(we("acp.confirmDelete",{label:x})))try{e.deleteSession(T.sessionId),r(w=>w.filter(R=>R.sessionId!==T.sessionId)),a===T.sessionId&&i(null)}catch(w){console.error("[SidebarSessionList] delete failed:",w)}},[e,a]),v=p.useCallback(T=>{f(T.sessionId),c(T.title&&T.title.trim()?T.title:"")},[]),E=p.useCallback(()=>{if(!m)return;const T=l.trim();if(!T){f(null);return}try{e.renameSession(m,T),r(x=>x.map(w=>w.sessionId===m?{...w,title:T}:w))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),_=p.useCallback(()=>{f(null)},[]),A=p.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),E()):T.key==="Escape"&&(T.preventDefault(),_())},[E,_]),O=p.useMemo(()=>[...n].sort((T,x)=>{const w=T.updatedAt?new Date(T.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-w}),[n]);if(s&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:V("common.loading")})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:V("acp.emptySessions")})});const k=xb(O);return d.jsx("nav",{className:"py-1","aria-label":V("acp.historyNav"),children:k.map((T,x)=>d.jsxs("div",{children:[x>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:T.label})}),T.sessions.map(w=>{const R=m===w.sessionId;return d.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",w.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(Qd,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),R?d.jsx("input",{ref:g,type:"text",value:l,onChange:P=>c(P.target.value),onKeyDown:A,onBlur:E,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:P=>P.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(w.sessionId),t(w)},className:"flex-1 min-w-0 text-left",title:w.title||w.sessionId,children:d.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:w.title&&w.title.trim()?w.title:V("acp.newSession")})}),R?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:E,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:V("acp.confirm"),children:d.jsx(pn,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:V("common.cancel"),children:d.jsx(hn,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:V("acp.noSessionManagement"),children:[d.jsx("button",{type:"button",disabled:!u,onClick:P=>{P.stopPropagation(),u&&v(w)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand-text hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:V(u?"acp.rename":"acp.renameUnsupported"),children:d.jsx(va,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:P=>{P.stopPropagation(),u&&y(w)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:V(u?"acp.delete":"acp.deleteUnsupported"),children:d.jsx(Su,{className:"h-3 w-3"})})]})]},w.sessionId)})]},T.label))})}function xb(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),s=[{label:V("resume.today"),sessions:[]},{label:V("resume.yesterday"),sessions:[]},{label:V("resume.earlier"),sessions:[]}];for(const o of e){const a=o.updatedAt?new Date(o.updatedAt):new Date(0);a>=n?s[0].sessions.push(o):a>=r?s[1].sessions.push(o):s[2].sessions.push(o)}return s.filter(o=>o.sessions.length>0)}function vb({url:e,token:t,onBack:n}){const[r,s]=p.useState(null),[o,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Ks({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,u)=>{a(c),m(u||null)}),f.current=l,s(l),l.connect().catch(c=>{c instanceof Ki||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,s(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&o==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),o==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),o==="error"&&!r&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&o==="connected"&&d.jsx(hb,{client:r})]})}const nr="rcs_admin_key";function bb(){try{return localStorage.getItem(nr)}catch{return null}}function yb(){const[e,t]=p.useState(bb),n=p.useCallback(r=>{const s=r.trim();t(s||null);try{s?localStorage.setItem(nr,s):localStorage.removeItem(nr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Go=p.lazy(()=>Ne(()=>import("./Dashboard-BBIlAMpr.js"),__vite__mapDeps([4,2,5,6,7,1,8])).then(e=>({default:e.Dashboard}))),wb=p.lazy(()=>Ne(()=>import("./SessionDetail-zXHv84SV.js"),__vite__mapDeps([9,2,5,7,10,11,12,6,13,14,1,8])).then(e=>({default:e.SessionDetail}))),Cb=p.lazy(()=>Ne(()=>import("./ShareLanding-DaLDc5iV.js"),__vite__mapDeps([15,2,1,8])).then(e=>({default:e.ShareLanding}))),qo=p.lazy(()=>Ne(()=>import("./ArtifactsGallery-B63LTThv.js").then(e=>e.a),__vite__mapDeps([12,2,7,11])).then(e=>({default:e.ArtifactsGallery}))),Sb=p.lazy(()=>Ne(()=>import("./ArtifactView-DmMwrTRk.js"),__vite__mapDeps([16,2,12,7,11,10,1,8])).then(e=>({default:e.ArtifactView}))),kb=p.lazy(()=>Ne(()=>import("./Claim-hOGNTz-n.js"),__vite__mapDeps([17,2,1,8])).then(e=>({default:e.Claim}))),Ab=p.lazy(()=>Ne(()=>import("./Login-BmYeCfbw.js"),__vite__mapDeps([18,2,1,8])).then(e=>({default:e.Login}))),Eb=p.lazy(()=>Ne(()=>import("./Register-Dfw4S_A0.js"),__vite__mapDeps([19,2,1,8])).then(e=>({default:e.Register}))),_b=p.lazy(()=>Ne(()=>import("./Setup-BTTET7Rk.js"),__vite__mapDeps([20,2,1,8])).then(e=>({default:e.Setup}))),Tb=p.lazy(()=>Ne(()=>import("./Join-zelwrNDz.js"),__vite__mapDeps([21,2,1,8])).then(e=>({default:e.Join}))),Rb=p.lazy(()=>Ne(()=>import("./UserSettings-D1oW7oVv.js"),__vite__mapDeps([22,2,14,11,1,8])).then(e=>({default:e.UserSettings}))),Nb=p.lazy(()=>Ne(()=>import("./TeamList-B8Rob6VK.js"),__vite__mapDeps([23,2,1,8])).then(e=>({default:e.TeamList}))),jb=p.lazy(()=>Ne(()=>import("./TeamCreate-BWtaB-_Z.js"),__vite__mapDeps([24,2,1,8])).then(e=>({default:e.TeamCreate}))),Mb=p.lazy(()=>Ne(()=>import("./TeamDetail-Crmn6PaC.js"),__vite__mapDeps([25,2,13,11,5,1,8])).then(e=>({default:e.TeamDetail}))),Ib=p.lazy(()=>Ne(()=>import("./TeamSettings-CfRHolhe.js"),__vite__mapDeps([26,2,1,8])).then(e=>({default:e.TeamSettings}))),Pb=p.lazy(()=>Ne(()=>import("./AdminPanel-fsacwgfK.js"),__vite__mapDeps([27,2,1,8])).then(e=>({default:e.AdminPanel}))),Db=new Set(["login","register","setup","join","share"]),Ob=new Set(["login","register","setup","join"]);function Lb(){return d.jsx(ju,{defaultTheme:"system",children:d.jsx(Ih,{children:d.jsx(Fb,{})})})}function Fb(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[s,o]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:u}=yb(),{user:h,isLoading:g,checkSetupStatus:b}=qi();p.useEffect(()=>{Ch(u)},[u]);const[y,v]=p.useState(!1);p.useEffect(()=>{!g&&!h?b().then(v):h&&v(!1)},[g,h,b]);const E=p.useCallback(()=>{const R=window.location.pathname,P=new URLSearchParams(window.location.search);if(P.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const Y=JSON.parse(U);if(Y.url&&Y.token){c({url:Y.url,token:Y.token}),sessionStorage.removeItem("acp_connection");const j=new URL(window.location.href);j.searchParams.delete("acp"),window.history.replaceState(null,"",j),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=P.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),r(F),f(null),t("session");return}if(R==="/login"){t("login");return}if(R==="/register"){t("register");return}if(R==="/setup"){t("setup");return}if(R==="/join"){t("join");return}if(R==="/settings"){t("settings");return}if(R==="/admin"){t("admin");return}if(R==="/teams/new"){t("team-create");return}if(R.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(R.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(R==="/teams"){t("teams");return}const S=R.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),r(null),o(void 0),t("share");return}const C=R.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){i(C[1]),r(null),o(void 0),f(null),t("artifact-view");return}if(R==="/code/artifacts"||R==="/code/artifacts/"){i(null),r(null),o(void 0),f(null),t("artifacts");return}const H=R.match(/^\/code\/claim\/([^/]+)/);if(H&&H[1]){t("claim");return}const I=R.match(/^\/code\/([^/]+)/);I&&I[1]?(r(I[1]),o(void 0),f(null),t("session")):(r(null),o(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(E(),window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)),[E]);const _=p.useCallback(R=>{window.history.pushState(null,"",`/code/${R}`),r(R),o(void 0),f(null),i(null),t("session")},[]),A=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),r(null),o(void 0),f(null),t("artifacts")},[]),O=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),o(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let R=e;return g||(y&&R!=="setup"&&R!=="join"&&(R="setup"),!h&&!Db.has(R)&&(R="login"),h&&(R==="login"||R==="setup")&&(R="dashboard")),R})();if(p.useEffect(()=>{g||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&h&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,h,g]),g)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const T=()=>{if(l&&k==="acp")return d.jsx(vb,{url:l.url,token:l.token,onBack:O});switch(k){case"login":return d.jsx(Ab,{onSuccess:O,onNavigateRegister:()=>t("register")});case"register":return d.jsx(Eb,{onSuccess:O,onBack:()=>t("login")});case"setup":return d.jsx(_b,{onSuccess:O,onAlreadyDone:O});case"join":return d.jsx(Tb,{onSuccess:O,onInvalidInvite:O});case"settings":return d.jsx(Rb,{});case"teams":return d.jsx(Nb,{});case"team-create":return d.jsx(jb,{});case"team-detail":return d.jsx(Mb,{});case"team-settings":return d.jsx(Ib,{});case"admin":return(h==null?void 0:h.role)!=="admin"?d.jsx("div",{className:"flex flex-1 items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),d.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:V("nav.dashboard")})]})}):d.jsx(Pb,{});case"share":return d.jsx(Cb,{});case"claim":return d.jsx(kb,{});case"artifacts":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(qo,{})});case"artifact-view":return a?d.jsx(Sb,{artifactId:a,onBack:A}):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(qo,{})});case"session":return n?d.jsx(wb,{sessionId:n,onSessionLoaded:R=>o(R.source)},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Go,{onNavigateSession:_})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Go,{onNavigateSession:_})})}},x=!Ob.has(k),w=k==="artifact-view";return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&d.jsx(Dh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":s,onBack:n||l||m?O:void 0,onNavigateArtifacts:w?void 0:A}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:T()})]})}nb();Sc.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(Lb,{})}));export{Zb as $,Ks as A,_d as B,Ux as C,Jg as D,yh as E,Ud as F,bu as G,ky as H,vg as I,Su as J,he as K,ga as L,Pr as M,by as N,Rv as O,va as P,dy as Q,_v as R,du as S,_y as T,Tu as U,Cy as V,fy as W,hn as X,hy as Y,Sy as Z,cy as _,hb as a,wy as a0,yy as a1,sy as a2,ey as a3,ty as a4,ny as a5,Jb as a6,ly as a7,py as a8,uy as a9,V as aA,we as aB,Vg as aC,Vb as aD,cb as aE,Sh as aF,hd as aG,qi as aH,tn as aI,Rh as aJ,my as aa,gy as ab,ay as ac,ry as ad,iy as ae,oy as af,xy as ag,vy as ah,Zo as ai,ee as aj,tb as ak,ie as al,Tt as am,gd as an,Gg as ao,Bb as ap,Gb as aq,Qb as ar,kh as as,Ln as at,Kb as au,Wb as av,qb as aw,Ry as ax,Ay as ay,Xb as az,As as b,Tx as c,pn as d,Qt as e,ha as f,Fd as g,Ty as h,Nv as i,Ki as j,zi as k,Bi as l,Dn as m,ph as n,Ao as o,Hi as p,Jv as q,ba as r,Wl as s,Gl as t,Vl as u,Tv as v,fu as w,pu as x,xu as y,ya as z};
|
|
275
|
+
\`\`\``}B.push({type:"text",text:se}),q.push(Z)}}catch(se){console.error("[ChatInterface] Failed to process attachment:",se)}if(B.length===0)return;const K={type:"user_message",id:`user-${Date.now()}`,content:O,images:G.length>0?G:void 0,attachments:q.length>0?q:void 0};r(Z=>[...Z,K]),o(!0);try{await e.sendPrompt(B)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),o(!1)}},[s,a,e,T,g,w,L,m,N,S]);return d.jsxs("div",{className:"flex flex-col h-full",children:[d.jsx(Tx,{entries:n,isLoading:s&&!a?!1:s,onPermissionRespond:(M,O,$)=>{H(M,O,$)},emptyTitle:a?V("session.emptyTitle"):void 0,emptyDescription:a?V("acp.emptyDescription"):void 0}),d.jsx(Wx,{requests:I,onRespond:U}),u&&d.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:d.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[d.jsx("span",{children:u}),d.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),d.jsxs("div",{className:"flex-shrink-0",children:[d.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsx(fb,{mode:_??b,onModeChange:M=>{k(null),y(M),localStorage.setItem("acp_permission_mode",M)}}),d.jsx(Zv,{client:e}),d.jsx(Gx,{usage:v})]}),n.length>0&&d.jsxs(bg,{children:[d.jsx(yg,{asChild:!0,children:d.jsxs(Pt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand-text font-display gap-1",onClick:S,children:[d.jsx(ba,{className:"h-3 w-3"}),V("acp.newSession")]})}),d.jsx(wg,{children:"New Thread"})]})]}),d.jsx(Ux,{onSubmit:Y,isLoading:s,onInterrupt:C,disabled:!a,placeholder:V(a?"acp.inputPlaceholder":"acp.waitingPlaceholder"),supportsAttachments:L,commands:T.length>0?T:void 0,queueWhileLoading:!0})]})]})}function pb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function hb({client:e,agentId:t}){tn();const[n,r]=p.useState(!1),s=p.useCallback(async o=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:o.sessionId,cwd:o.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:o.sessionId,cwd:o.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return d.jsxs("div",{className:"flex h-full w-full",children:[d.jsxs("div",{className:ee("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[d.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&d.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:V("acp.sessions")}),d.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&d.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:V("acp.newSession"),children:d.jsx(ba,{className:"h-4 w-4"})}),d.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?d.jsx(ru,{className:"h-4 w-4"}):d.jsx(nu,{className:"h-4 w-4"})})]})]}),!n&&d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(gb,{client:e,onSelectSession:s})})]}),d.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:d.jsx(mb,{client:e,agentId:t})})]})}function gb({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[s,o]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[u,h]=p.useState(!0),x=p.useRef(null),b=p.useCallback(async()=>{if(!e.supportsSessionList){o(!1);return}o(!0);try{const T=await e.listSessions();r(T.sessions)}catch(T){console.warn("[SidebarSessionList] Failed to load:",T)}finally{o(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&b()},[e,b]),p.useEffect(()=>{const T=g=>{g==="connected"&&setTimeout(b,200)};return e.setConnectionStateHandler(T),()=>e.removeConnectionStateHandler(T)},[e,b]),p.useEffect(()=>{const T=setInterval(b,1e4);return()=>clearInterval(T)},[b]),p.useEffect(()=>{e.setSessionDeletedHandler(T=>{b()}),e.setSessionRenamedHandler((T,g)=>{b()})},[e,b]),p.useEffect(()=>{e.setErrorMessageHandler(T=>{/Method not found/i.test(T)&&/session\/(rename|delete)/i.test(T)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select())},[m]);const y=p.useCallback(T=>{const g=T.title&&T.title.trim()?T.title:T.sessionId.slice(0,8);if(window.confirm(we("acp.confirmDelete",{label:g})))try{e.deleteSession(T.sessionId),r(w=>w.filter(N=>N.sessionId!==T.sessionId)),a===T.sessionId&&i(null)}catch(w){console.error("[SidebarSessionList] delete failed:",w)}},[e,a]),v=p.useCallback(T=>{f(T.sessionId),c(T.title&&T.title.trim()?T.title:"")},[]),E=p.useCallback(()=>{if(!m)return;const T=l.trim();if(!T){f(null);return}try{e.renameSession(m,T),r(g=>g.map(w=>w.sessionId===m?{...w,title:T}:w))}catch(g){console.error("[SidebarSessionList] rename failed:",g)}f(null)},[e,m,l]),_=p.useCallback(()=>{f(null)},[]),k=p.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),E()):T.key==="Escape"&&(T.preventDefault(),_())},[E,_]),L=p.useMemo(()=>[...n].sort((T,g)=>{const w=T.updatedAt?new Date(T.updatedAt).getTime():0;return(g.updatedAt?new Date(g.updatedAt).getTime():0)-w}),[n]);if(s&&n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:V("common.loading")})});if(n.length===0)return d.jsx("div",{className:"flex items-center justify-center py-8",children:d.jsx("span",{className:"text-xs text-text-muted font-display",children:V("acp.emptySessions")})});const A=xb(L);return d.jsx("nav",{className:"py-1","aria-label":V("acp.historyNav"),children:A.map((T,g)=>d.jsxs("div",{children:[g>0&&d.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),d.jsx("div",{className:"px-4 py-2",children:d.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:T.label})}),T.sessions.map(w=>{const N=m===w.sessionId;return d.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",w.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[d.jsx(Qd,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),N?d.jsx("input",{ref:x,type:"text",value:l,onChange:P=>c(P.target.value),onKeyDown:k,onBlur:E,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:P=>P.stopPropagation()}):d.jsx("button",{type:"button",onClick:()=>{i(w.sessionId),t(w)},className:"flex-1 min-w-0 text-left",title:w.title||w.sessionId,children:d.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:w.title&&w.title.trim()?w.title:V("acp.newSession")})}),N?d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[d.jsx("button",{type:"button",onClick:E,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand-text hover:bg-brand/10 transition-colors",title:V("acp.confirm"),children:d.jsx(pn,{className:"h-3.5 w-3.5"})}),d.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:V("common.cancel"),children:d.jsx(hn,{className:"h-3.5 w-3.5"})})]}):d.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:u?void 0:V("acp.noSessionManagement"),children:[d.jsx("button",{type:"button",disabled:!u,onClick:P=>{P.stopPropagation(),u&&v(w)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-brand-text hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:V(u?"acp.rename":"acp.renameUnsupported"),children:d.jsx(va,{className:"h-3 w-3"})}),d.jsx("button",{type:"button",disabled:!u,onClick:P=>{P.stopPropagation(),u&&y(w)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",u?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:V(u?"acp.delete":"acp.deleteUnsupported"),children:d.jsx(Su,{className:"h-3 w-3"})})]})]},w.sessionId)})]},T.label))})}function xb(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),s=[{label:V("resume.today"),sessions:[]},{label:V("resume.yesterday"),sessions:[]},{label:V("resume.earlier"),sessions:[]}];for(const o of e){const a=o.updatedAt?new Date(o.updatedAt):new Date(0);a>=n?s[0].sessions.push(o):a>=r?s[1].sessions.push(o):s[2].sessions.push(o)}return s.filter(o=>o.sessions.length>0)}function vb({url:e,token:t,onBack:n}){const[r,s]=p.useState(null),[o,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Ks({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,u)=>{a(c),m(u||null)}),f.current=l,s(l),l.connect().catch(c=>{c instanceof Ki||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,s(null),a("disconnected")}},[e,t]),d.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&o==="error"&&d.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,d.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),o==="connecting"&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),d.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),o==="error"&&!r&&d.jsx("div",{className:"flex-1 flex items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),d.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),d.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&o==="connected"&&d.jsx(hb,{client:r})]})}const nr="rcs_admin_key";function bb(){try{return localStorage.getItem(nr)}catch{return null}}function yb(){const[e,t]=p.useState(bb),n=p.useCallback(r=>{const s=r.trim();t(s||null);try{s?localStorage.setItem(nr,s):localStorage.removeItem(nr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Go=p.lazy(()=>Me(()=>import("./Dashboard-Bz-0-u1i.js"),__vite__mapDeps([4,2,5,6,7,1,8])).then(e=>({default:e.Dashboard}))),wb=p.lazy(()=>Me(()=>import("./SessionDetail-HEE0RVF6.js"),__vite__mapDeps([9,2,6,7,5,10,11,12,13,14,1,8])).then(e=>({default:e.SessionDetail}))),Cb=p.lazy(()=>Me(()=>import("./ShareLanding-CgkypqyR.js"),__vite__mapDeps([15,2,1,8])).then(e=>({default:e.ShareLanding}))),qo=p.lazy(()=>Me(()=>import("./ArtifactsGallery-DxVwQ8Wh.js").then(e=>e.a),__vite__mapDeps([13,2,7,12])).then(e=>({default:e.ArtifactsGallery}))),Sb=p.lazy(()=>Me(()=>import("./ArtifactView-wUyXqsCU.js"),__vite__mapDeps([16,2,13,7,12,10,1,8])).then(e=>({default:e.ArtifactView}))),kb=p.lazy(()=>Me(()=>import("./Claim-D7HLQsN_.js"),__vite__mapDeps([17,2,1,8])).then(e=>({default:e.Claim}))),Ab=p.lazy(()=>Me(()=>import("./Login-DNiG6cNe.js"),__vite__mapDeps([18,2,1,8])).then(e=>({default:e.Login}))),Eb=p.lazy(()=>Me(()=>import("./Register-CZ5iK6MO.js"),__vite__mapDeps([19,2,1,8])).then(e=>({default:e.Register}))),_b=p.lazy(()=>Me(()=>import("./Setup-CJerwA76.js"),__vite__mapDeps([20,2,1,8])).then(e=>({default:e.Setup}))),Tb=p.lazy(()=>Me(()=>import("./Join-CIaF_Ohx.js"),__vite__mapDeps([21,2,1,8])).then(e=>({default:e.Join}))),Rb=p.lazy(()=>Me(()=>import("./UserSettings-BZP7lYFA.js"),__vite__mapDeps([22,2,14,12,1,8])).then(e=>({default:e.UserSettings}))),Nb=p.lazy(()=>Me(()=>import("./TeamList-lVbIAJts.js"),__vite__mapDeps([23,2,7,1,8])).then(e=>({default:e.TeamList}))),jb=p.lazy(()=>Me(()=>import("./TeamDetail-ChdJxhFx.js"),__vite__mapDeps([24,2,11,12,6,1,8])).then(e=>({default:e.TeamDetail}))),Mb=p.lazy(()=>Me(()=>import("./TeamSettings-Bk3T7qB1.js"),__vite__mapDeps([25,2,1,8])).then(e=>({default:e.TeamSettings}))),Ib=p.lazy(()=>Me(()=>import("./AdminPanel-w39uutIr.js"),__vite__mapDeps([26,2,1,8])).then(e=>({default:e.AdminPanel}))),Pb=new Set(["login","register","setup","join","share"]),Db=new Set(["login","register","setup","join"]);function Ob(){return d.jsx(ju,{defaultTheme:"system",children:d.jsx(Ih,{children:d.jsx(Lb,{})})})}function Lb(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[s,o]=p.useState(null),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:l}=yb(),{user:c,isLoading:u,checkSetupStatus:h}=qi();p.useEffect(()=>{Ch(l)},[l]);const[x,b]=p.useState(!1);p.useEffect(()=>{!u&&!c?h().then(b):c&&b(!1)},[u,c,h]);const y=p.useCallback(()=>{const g=window.location.pathname,w=new URLSearchParams(window.location.search);if(w.get("acp")==="1"){const H=sessionStorage.getItem("acp_connection");if(H)try{const I=JSON.parse(H);if(I.url&&I.token){f({url:I.url,token:I.token}),sessionStorage.removeItem("acp_connection");const U=new URL(window.location.href);U.searchParams.delete("acp"),window.history.replaceState(null,"",U),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const P=w.get("sid");if(P){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${P}`),r(P),i(null),t("session");return}if(g==="/login"){t("login");return}if(g==="/register"){t("register");return}if(g==="/setup"){t("setup");return}if(g==="/join"){t("join");return}if(g==="/settings"){t("settings");return}if(g==="/admin"){t("admin");return}if(g.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(g.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(g==="/teams"){t("teams");return}const j=g.match(/^\/code\/s\/([^/]+)/);if(j&&j[1]){i(j[1]),r(null),t("share");return}const z=g.match(/^\/code\/a\/([^/]+)/);if(z&&z[1]){o(z[1]),r(null),i(null),t("artifact-view");return}if(g==="/code/artifacts"||g==="/code/artifacts/"){o(null),r(null),i(null),t("artifacts");return}const S=g.match(/^\/code\/claim\/([^/]+)/);if(S&&S[1]){t("claim");return}const C=g.match(/^\/code\/([^/]+)/);C&&C[1]?(r(C[1]),i(null),t("session")):(r(null),i(null),t("dashboard"))},[]);p.useEffect(()=>(y(),window.addEventListener("popstate",y),()=>window.removeEventListener("popstate",y)),[y]);const v=p.useCallback(g=>{window.history.pushState(null,"",`/code/${g}`),r(g),i(null),o(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),o(null),r(null),i(null),t("artifacts")},[]),_=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),i(null),o(null),f(null),t("dashboard")},[]),k=(()=>{let g=e;return u||(x&&g!=="setup"&&g!=="join"&&(g="setup"),!c&&!Pb.has(g)&&(g="login"),c&&(g==="login"||g==="setup")&&(g="dashboard")),g})();if(p.useEffect(()=>{u||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&c&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,c,u]),u)return d.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const L=()=>{if(m&&k==="acp")return d.jsx(vb,{url:m.url,token:m.token,onBack:_});switch(k){case"login":return d.jsx(Ab,{onSuccess:_,onNavigateRegister:()=>t("register")});case"register":return d.jsx(Eb,{onSuccess:_,onBack:()=>t("login")});case"setup":return d.jsx(_b,{onSuccess:_,onAlreadyDone:_});case"join":return d.jsx(Tb,{onSuccess:_,onInvalidInvite:_});case"settings":return d.jsx(Rb,{});case"teams":return d.jsx(Nb,{});case"team-detail":return d.jsx(jb,{});case"team-settings":return d.jsx(Mb,{});case"admin":return(c==null?void 0:c.role)!=="admin"?d.jsx("div",{className:"flex flex-1 items-center justify-center",children:d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),d.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand-text hover:underline",children:V("nav.dashboard")})]})}):d.jsx(Ib,{});case"share":return d.jsx(Cb,{});case"claim":return d.jsx(kb,{});case"artifacts":return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(qo,{})});case"artifact-view":return s?d.jsx(Sb,{artifactId:s,onBack:E}):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(qo,{})});case"session":return n?d.jsx(wb,{sessionId:n,onBack:_},n):d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Go,{onNavigateSession:v})});default:return d.jsx("div",{className:"flex-1 overflow-y-auto",children:d.jsx(Go,{onNavigateSession:v})})}},A=!Db.has(k)&&k!=="session",T=k==="artifact-view";return d.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[A&&d.jsx(Dh,{sessionTitle:m?"ACP":void 0,sessionSource:m?"acp":void 0,onBack:m||a?_:void 0,onNavigateArtifacts:T?void 0:E}),d.jsx(p.Suspense,{fallback:d.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:L()})]})}nb();Sc.createRoot(document.getElementById("root")).render(d.jsx(p.StrictMode,{children:d.jsx(Ob,{})}));export{uy as $,Ks as A,_d as B,Ux as C,Jg as D,ya as E,Ud as F,yh as G,bu as H,Sy as I,Ey as J,vg as K,ga as L,Pr as M,Su as N,Rv as O,va as P,Ph as Q,_v as R,du as S,gh as T,Ca as U,Tu as V,he as W,hn as X,vy as Y,cy as Z,wy as _,hb as a,py as a0,Cy as a1,ly as a2,Jb as a3,yy as a4,by as a5,ny as a6,Zb as a7,ey as a8,ty as a9,Gb as aA,Ty as aB,ky as aC,Yb as aD,V as aE,we as aF,Vg as aG,Wb as aH,cb as aI,Sh as aJ,hd as aK,qi as aL,tn as aM,Rh as aN,Qb as aa,iy as ab,my as ac,dy as ad,fy as ae,hy as af,oy as ag,sy as ah,ay as ai,ry as aj,gy as ak,xy as al,Zo as am,ee as an,tb as ao,ie as ap,Tt as aq,gd as ar,Gg as as,Hb as at,Vb as au,Xb as av,kh as aw,Ln as ax,qb as ay,Bb as az,As as b,Tx as c,pn as d,Qt as e,ha as f,Od as g,Fd as h,_y as i,Nv as j,Ki as k,zi as l,Bi as m,Dn as n,ph as o,Ao as p,Hi as q,Jv as r,ba as s,Wl as t,Gl as u,Vl as v,Tv as w,fu as x,pu as y,xu as z};
|