@saluzi/saluzi-edu 0.2.72 → 0.2.73
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 +50 -50
- package/dist/rcs-web/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DMClbUbi.js} +1 -1
- package/dist/rcs-web/assets/ArtifactView-CUDKNi6z.js +6 -0
- package/dist/rcs-web/assets/{ArtifactsGallery-DQj98ptl.js → ArtifactsGallery-B3OCFJ7T.js} +17 -12
- package/{packages/remote-control-server/web/dist/assets/Claim-Dfdhnggp.js → dist/rcs-web/assets/Claim-BOkou3Kj.js} +1 -1
- package/dist/rcs-web/assets/{Dashboard-DnLE2gtW.js → Dashboard-DxcBkyhD.js} +1 -1
- package/dist/rcs-web/assets/{Join-Cgq7v-Sb.js → Join-DZ_EUsnw.js} +1 -1
- package/dist/rcs-web/assets/{Login-CpRVSamw.js → Login-Ct6Z1ih0.js} +1 -1
- package/dist/rcs-web/assets/{Register-CvCuP-ww.js → Register-D3Sub3V4.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-CC1Y-JXz.js +60 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-B33i8RLj.js} +1 -1
- package/dist/rcs-web/assets/{Setup-DH5NCalW.js → Setup-COecVpRC.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-B48Z1tak.js → ShareLanding-B7ZdGScC.js} +1 -1
- package/dist/rcs-web/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-BKeJj9CV.js} +1 -1
- package/dist/rcs-web/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-BAG50yxf.js} +1 -1
- package/dist/rcs-web/assets/{TeamList-DylGNt59.js → TeamList-B2kk8eh4.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-CoBx_q55.js → TeamSettings-h8JWw1pp.js} +1 -1
- package/dist/rcs-web/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-DSeymf7O.js} +1 -1
- package/dist/rcs-web/assets/{UserSettings-CxuLje2z.js → UserSettings-9wOVTete.js} +1 -1
- package/dist/rcs-web/assets/{arc-BrQup1CU.js → arc-DBopY3EY.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-BTnFS82c.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-BIOzYRjo.js} +1 -1
- package/dist/rcs-web/assets/channel-CbznqW4C.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-Bs-8U7DE.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-BnQJ0pbh.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-Cxuu3aYy.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-DCD6b_gA.js → dist/rcs-web/assets/chunk-727SXJPM-CcLR90xa.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-ByLnKNaa.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BwA_vlbi.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-Clf6X7Ml.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-DUVg4YJL.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-mPQkR0NB.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-BAgpDt13.js} +1 -1
- package/dist/rcs-web/assets/{copy-BFkM6GS4.js → copy-BdcZVl_u.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-B6DjpMte.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-Dy0qgRIV.js → dist/rcs-web/assets/dagre-BM42HDAG-D_NsO2qH.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-B0NVIr-5.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-C21xttLi.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-D6TKZ2qP.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJQYNR0l.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-DBgsUCQK.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dialog-aHICCHyK.js → dist/rcs-web/assets/dialog-niHgO9y4.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-B3MCOL04.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-Ct5UrMg4.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-iVIf58oN.js} +1 -1
- package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-C8rLSSN0.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-CCCe44Y_.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-C5rnfLlw.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js} +1 -1
- package/dist/rcs-web/assets/{linear-BkfmaOFV.js → linear-jT5e6iMk.js} +1 -1
- package/dist/rcs-web/assets/{main-2FF76CHO.js → main-49JlcYCi.js} +4 -4
- package/dist/rcs-web/assets/main-C1pGF5LM.css +1 -0
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-DLOgnkPH.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-DfoO5KWy.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-CzxhXChG.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-BSF1quon.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-GGLkdBIg.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-CTMkKLqv.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-CsKOZlpT.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-DDEvqYzH.js} +1 -1
- package/dist/rcs-web/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-Ce-IRZf_.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BumbI6qO.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-B5A3bkUP.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CNudFFGs.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +3 -2
- package/packages/remote-control-server/src/__tests__/artifacts.test.ts +211 -0
- package/packages/remote-control-server/src/routes/web/artifacts.ts +57 -5
- package/packages/remote-control-server/src/services/artifacts.ts +51 -4
- package/packages/remote-control-server/src/services/event-persistence.ts +13 -4
- package/packages/remote-control-server/src/services/transport.ts +10 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-8HNxSZw0.js → AdminPanel-DMClbUbi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-CUDKNi6z.js +6 -0
- package/packages/remote-control-server/web/dist/assets/{ArtifactsGallery-DQj98ptl.js → ArtifactsGallery-B3OCFJ7T.js} +17 -12
- package/{dist/rcs-web/assets/Claim-Dfdhnggp.js → packages/remote-control-server/web/dist/assets/Claim-BOkou3Kj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Dashboard-DnLE2gtW.js → Dashboard-DxcBkyhD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Join-Cgq7v-Sb.js → Join-DZ_EUsnw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-CpRVSamw.js → Login-Ct6Z1ih0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-CvCuP-ww.js → Register-D3Sub3V4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-CC1Y-JXz.js +60 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-7ElYQ4hP.js → SessionVisibilityBadge-B33i8RLj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Setup-DH5NCalW.js → Setup-COecVpRC.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-B48Z1tak.js → ShareLanding-B7ZdGScC.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-tXM5yKmq.js → TeamCreate-BKeJj9CV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-3jPhrX5z.js → TeamDetail-BAG50yxf.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamList-DylGNt59.js → TeamList-B2kk8eh4.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-CoBx_q55.js → TeamSettings-h8JWw1pp.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-DM6V0r1B.js → UserSearchInput-DSeymf7O.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSettings-CxuLje2z.js → UserSettings-9wOVTete.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-BrQup1CU.js → arc-DBopY3EY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-l1NuwJAC.js → architectureDiagram-3BPJPVTR-BTnFS82c.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CVNyoBQm.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-C8IgW5pQ.js → c4Diagram-AAUBKEIU-BIOzYRjo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-CbznqW4C.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Cz-fnX8Q.js → chunk-2J33WTMH-Bs-8U7DE.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-s0k1FsPS.js → chunk-4BX2VUAB-BnQJ0pbh.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-k7MztSxj.js → chunk-55IACEB6-Cxuu3aYy.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-DCD6b_gA.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CcLR90xa.js} +1 -1
- package/{dist/rcs-web/assets/chunk-AQP2D5EJ-ByLnKNaa.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BwA_vlbi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DnoA9fQr.js → chunk-FMBD7UC4-Clf6X7Ml.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-BsbvPHC6.js → chunk-ND2GUHAM-DUVg4YJL.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-DnHGOmkn.js → chunk-QZHKN3VN-mPQkR0NB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-Br6udBTB.js → code-block-IT6T5CEO-BAgpDt13.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-BFkM6GS4.js → copy-BdcZVl_u.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-ChN-rm-T.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-B6DjpMte.js} +1 -1
- package/{dist/rcs-web/assets/dagre-BM42HDAG-Dy0qgRIV.js → packages/remote-control-server/web/dist/assets/dagre-BM42HDAG-D_NsO2qH.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-ByiBm-x4.js → diagram-2AECGRRQ-B0NVIr-5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-rGbxhf-H.js → diagram-5GNKFQAL-C21xttLi.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-COdwodvi.js → diagram-KO2AKTUF-D6TKZ2qP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-EjqjzeZY.js → diagram-LMA3HP47-DJQYNR0l.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DSPVSdmJ.js → diagram-OG6HWLK6-DBgsUCQK.js} +1 -1
- package/{dist/rcs-web/assets/dialog-aHICCHyK.js → packages/remote-control-server/web/dist/assets/dialog-niHgO9y4.js} +1 -1
- package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-DZBAaLMb.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-B3MCOL04.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-DJHAIGo5.js → flowDiagram-I6XJVG4X-Ct5UrMg4.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-DEXe0aC6.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-D35WJeQv.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-n-NVaNrp.js → infoDiagram-5YYISTIA-iVIf58oN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-D7nU29iu.js → ishikawaDiagram-YF4QCWOH-C8rLSSN0.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-De0htrHG.js → journeyDiagram-JHISSGLW-CCCe44Y_.js} +1 -1
- package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-C5rnfLlw.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-BkfmaOFV.js → linear-jT5e6iMk.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{main-2FF76CHO.js → main-49JlcYCi.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/main-C1pGF5LM.css +1 -0
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-CAb8MsJr.js → mermaid-VLURNSYL-DLOgnkPH.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-dT6jK4cB.js → mermaid.core-DfoO5KWy.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-KBR776rc.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-aGUqFGVT.js → pieDiagram-4H26LBE5-CzxhXChG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-DbWbBGjW.js → quadrantDiagram-W4KKPZXB-BSF1quon.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-CRIIsSnh.js → requirementDiagram-4Y6WPE33-GGLkdBIg.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-C1fZEOgo.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-DpwCRJwm.js → sequenceDiagram-3UESZ5HK-CTMkKLqv.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-Dx-tpSSo.js → stateDiagram-AJRCARHV-CsKOZlpT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-DTEk3-eZ.js → stateDiagram-v2-BHNVJYJU-DDEvqYzH.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{timeline-definition-PNZ67QCA-CUVrbUF6.js → timeline-definition-PNZ67QCA-Ce-IRZf_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-Bjoy1hva.js → vennDiagram-CIIHVFJN-BumbI6qO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Xv7_ml_a.js → wardleyDiagram-YWT4CUSO-B5A3bkUP.js} +1 -1
- package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-CMv6nVsy.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-CNudFFGs.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/ArtifactView-2di4r0Cr.js +0 -6
- package/dist/rcs-web/assets/SessionDetail-CTa4JN6V.js +0 -60
- package/dist/rcs-web/assets/channel-DqfyWDcz.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
- package/dist/rcs-web/assets/external-link-Cb0Qh2uy.js +0 -6
- package/dist/rcs-web/assets/main-C2O-g177.css +0 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-2di4r0Cr.js +0 -6
- package/packages/remote-control-server/web/dist/assets/SessionDetail-CTa4JN6V.js +0 -60
- package/packages/remote-control-server/web/dist/assets/channel-DqfyWDcz.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BC1-yHO5.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BC1-yHO5.js +0 -1
- package/packages/remote-control-server/web/dist/assets/external-link-Cb0Qh2uy.js +0 -6
- package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +0 -1
package/packages/remote-control-server/web/dist/assets/{main-2FF76CHO.js → main-49JlcYCi.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-DLOgnkPH.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-DxcBkyhD.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-B33i8RLj.js","assets/dialog-niHgO9y4.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-CC1Y-JXz.js","assets/ArtifactsGallery-B3OCFJ7T.js","assets/copy-BdcZVl_u.js","assets/UserSearchInput-DSeymf7O.js","assets/ShareLanding-B7ZdGScC.js","assets/ArtifactView-CUDKNi6z.js","assets/Claim-BOkou3Kj.js","assets/Login-Ct6Z1ih0.js","assets/Register-D3Sub3V4.js","assets/Setup-COecVpRC.js","assets/Join-DZ_EUsnw.js","assets/UserSettings-9wOVTete.js","assets/TeamList-B2kk8eh4.js","assets/TeamCreate-BKeJj9CV.js","assets/TeamDetail-BAG50yxf.js","assets/TeamSettings-h8JWw1pp.js","assets/AdminPanel-DMClbUbi.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>dc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as Gs,b as fc,c as Jr,d as mc}from"./vendor-DE_-CLIE.js";import{_ as Ae}from"./shiki-mEP5vQQu.js";import{m as pc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function Vs(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Vs(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ks(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Vs(e))&&(o&&(o+=" "),o+=t);return o}const hc=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},gc=(e,t)=>({classGroupId:e,validator:t}),qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Bo=[],xc="arbitrary..",vc=e=>{const t=yc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bc(a);const i=a.split(Mn),m=i[0]===""&&i.length>1?1:0;return Ys(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?hc(f,m):m:f||Bo}return n[a]||Bo}}},Ys=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=Ys(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Mn):e.slice(t).join(Mn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},bc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?xc+o:void 0})(),yc=e=>{const{theme:t,classGroups:n}=e;return wc(n,t)},wc=(e,t)=>{const n=qs();for(const o in e){const r=e[o];eo(r,n,o,t)}return n},eo=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];Cc(a,t,n,o)}},Cc=(e,t,n,o)=>{if(typeof e=="string"){Sc(e,t,n);return}if(typeof e=="function"){kc(e,t,n,o);return}Ec(e,t,n,o)},Sc=(e,t,n)=>{const o=e===""?t:Xs(t,e);o.classGroupId=n},kc=(e,t,n,o)=>{if(_c(e)){eo(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(gc(n,e))},Ec=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];eo(m,Xs(t,i),n,o)}},Xs=(e,t)=>{let n=e;const o=t.split(Mn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=qs(),n.nextPart.set(a,i)),n=i}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ac=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const r=(s,a)=>{n[s]=a,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=o[s])!==void 0)return r(s,a),a},set(s,a){s in n?n[s]=a:r(s,a)}}},Pr="!",Ho=":",jc=[],Wo=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Tc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const l=r.length;for(let v=0;v<l;v++){const C=r[v];if(a===0&&i===0){if(C===Ho){s.push(r.slice(m,v)),m=v+1;continue}if(C==="/"){f=v;continue}}C==="["?a++:C==="]"?a--:C==="("?i++:C===")"&&i--}const c=s.length===0?r:r.slice(m);let d=c,h=!1;c.endsWith(Pr)?(d=c.slice(0,-1),h=!0):c.startsWith(Pr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Wo(s,h,d,g)};if(t){const r=t+Ho,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):Wo(jc,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Rc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let r=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(a)):r.push(a)}return r.length>0&&(r.sort(),o.push(...r)),o}},Nc=e=>({cache:Ac(e.cacheSize),parseClassName:Tc(e),sortModifiers:Rc(e),postfixLookupClassGroupIds:Ic(e),...vc(e)}),Ic=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},Mc=/\s+/,Pc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Mc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!C,_;if(b){const j=v.substring(0,C);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,b=!1)}else _=o(v);if(!_){if(!b){f=c+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=c+(f.length>0?" "+f:f);continue}b=!1}const A=h.length===0?"":h.length===1?h[0]:s(h).join(":"),E=g?A+Pr:A,L=E+_;if(i.indexOf(L)>-1)continue;i.push(L);const k=r(_,b);for(let j=0;j<k.length;++j){const x=k[j];i.push(E+x)}f=c+(f.length>0?" "+f:f)}return f},Oc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Qs(n))&&(r&&(r+=" "),r+=o);return r},Qs=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Qs(e[o]))&&(n&&(n+=" "),n+=t);return n},Dc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Nc(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const l=Pc(m,n);return r(m,l),l};return s=a,(...m)=>s(Oc(...m))},Lc=[],Ee=e=>{const t=n=>n[e]||Lc;return t.isThemeGetter=!0,t},Zs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$c=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\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$/,zc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>Fc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),He=e=>!!e&&Number.isInteger(Number(e)),fr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Qe=e=>$c.test(e),ea=()=>!0,Wc=e=>Uc.test(e)&&!zc.test(e),to=()=>!1,Gc=e=>Bc.test(e),Vc=e=>Hc.test(e),Kc=e=>!X(e)&&!Q(e),qc=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)),Yc=e=>pt(e,ra,to),X=e=>Zs.test(e),yt=e=>pt(e,oa,Wc),Go=e=>pt(e,ru,se),Xc=e=>pt(e,aa,ea),Qc=e=>pt(e,sa,to),Vo=e=>pt(e,ta,to),Zc=e=>pt(e,na,Vc),wn=e=>pt(e,ia,Gc),Q=e=>Js.test(e),en=e=>Tt(e,oa),Jc=e=>Tt(e,sa),Ko=e=>Tt(e,ta),eu=e=>Tt(e,ra),tu=e=>Tt(e,na),Cn=e=>Tt(e,ia,!0),nu=e=>Tt(e,aa,!0),pt=(e,t,n)=>{const o=Zs.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Tt=(e,t,n=!1)=>{const o=Js.exec(e);return o?o[1]?t(o[1]):n:!1},ta=e=>e==="position"||e==="percentage",na=e=>e==="image"||e==="url",ra=e=>e==="length"||e==="size"||e==="bg-size",oa=e=>e==="length",ru=e=>e==="number",sa=e=>e==="family-name",aa=e=>e==="number"||e==="weight",ia=e=>e==="shadow",ou=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),o=Ee("font-weight"),r=Ee("tracking"),s=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),d=Ee("text-shadow"),h=Ee("drop-shadow"),g=Ee("blur"),v=Ee("perspective"),C=Ee("aspect"),b=Ee("ease"),_=Ee("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...E(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],T=()=>[He,"none","subgrid",Q,X],M=()=>["auto",{span:["full",He,Q,X]},He,Q,X],O=()=>[He,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],w=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],B=()=>[at,"screen","full","dvw","lvw","svw","min","max","fit",...x()],P=()=>[at,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,Q,X],q=()=>[...E(),Ko,Vo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eu,Yc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],H=()=>["",se,en,yt],G=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[se,fr,Ko,Vo],ne=()=>["","none",g,Q,X],Z=()=>["none",se,Q,X],re=()=>["none",se,Q,X],ue=()=>[se,Q,X],be=()=>[at,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qe],breakpoint:[Qe],color:[ea],container:[Qe],"drop-shadow":[Qe],ease:["in","out","in-out"],font:[Kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qe],shadow:[Qe],spacing:["px",se],text:[Qe],"text-shadow":[Qe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",at,X,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[He,"auto",Q,X]}],basis:[{basis:[at,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,at,"auto","initial","none",X]}],grow:[{grow:["",se,Q,X]}],shrink:[{shrink:["",se,Q,X]}],order:[{order:[He,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"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:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"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:w()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...w()]}],"min-w":[{"min-w":[i,"screen","none",...w()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...w()]}],h:[{h:["screen","lh",...w()]}],"min-h":[{"min-h":["screen","lh","none",...w()]}],"max-h":[{"max-h":["screen","lh",...w()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,nu,Xc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fr,X]}],"font-family":[{font:[Jc,Qc,t]}],"font-features":[{"font-features":[X]}],"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:[r,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Go]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"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:[se,"from-font","auto",Q,yt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[se,"auto",Q,X]}],"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:[He,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],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",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},He,Q,X],radial:["",Q,X],conic:[He,Q,X]},tu,Zc]}],"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:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...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":[se,Q,X]}],"outline-w":[{outline:["",se,en,yt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Cn,wn]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Cn,wn]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[se,yt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",d,Cn,wn]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[se,Q,X]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"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":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"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":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"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":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"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":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"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":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"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":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"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":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"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":E()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"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:q()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Cn,wn]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",se,Q,X]}],"hue-rotate":[{"hue-rotate":[se,Q,X]}],invert:[{invert:["",se,Q,X]}],saturate:[{saturate:[se,Q,X]}],sepia:[{sepia:["",se,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,X]}],"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",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,X]}],ease:[{ease:["linear","initial",b,Q,X]}],delay:[{delay:[se,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"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:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[Q,X,"","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:[He,Q,X]}],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",Q,X]}],"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",Q,X]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[se,en,yt,Go]}],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"]}},su=Dc(ou);function ee(...e){return su(Ks(e))}function au(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Eb(e){return e?new Date(e*1e3).toLocaleString():""}function _b(e){return e==="archived"||e==="inactive"}function Ab(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function iu(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 jb(){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),iu(t)}function Tb(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 lu=/^Remote Control connecting(?:…|\.\.\.)$/;function Rb(e){return typeof e=="string"&&lu.test(e.trim())}/**
|
|
3
3
|
* @license lucide-react v0.555.0 - ISC
|
|
4
4
|
*
|
|
@@ -204,7 +204,7 @@ var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(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 yd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",yd),ga=p.createContext(void 0),xa="theme";function Yo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(xa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Qo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function wd(){const e=p.useContext(ga);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Cd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Xo()||t),[r,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(xa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Zo(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Zo(e[r],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Sd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function kd(e){return typeof e=="object"&&e!==null&&"then"in e}function va(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Sd&&"_payload"in e&&kd(e._payload)}function ba(e){const t=_d(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(jd);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 u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ed=ba("Slot");function _d(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(va(r)&&typeof Pn=="function"&&(r=Pn(r._payload)),p.isValidElement(r)){const a=Rd(r),i=Td(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ad=Symbol("radix.slottable");function jd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ad}function Td(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Nd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return es(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return r[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Id=Nd("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 Rt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?Ed:"button";return u.jsx(s,{"data-slot":"button",className:ee(Id({variant:t,size:n,className:e})),...r})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Md(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function nt(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,C=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function l(c,d){var v;const h=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,Pd(r,...t)]}function Pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Od=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Dd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${o} 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,o])}const f=p.useCallback(l=>{var c;if(i){const d=Ld(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Dd({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Od(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function Ld(e){return typeof e=="function"}function Ht(e){const t=Fd(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(Ud);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 u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Fd(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=Bd(r),i=zd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ya=Symbol("radix.slottable");function $d(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ya,t}function Ud(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ya}function zd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=Hd.reduce((e,t)=>{const n=Ht(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function wa(e,t){e&&Gs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,o]=nt(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,_=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(r,{scope:C,itemMap:A,collectionRef:_,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:_}=v,A=s(i,b),E=ke(C,A.collectionRef);return u.jsx(m,{ref:E,children:_})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:_,...A}=v,E=it.useRef(null),L=ke(C,E),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(E,{ref:E,...A}),()=>void k.itemMap.delete(E))),u.jsx(d,{[c]:"",ref:L,children:_})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const A=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((k,j)=>A.indexOf(k.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Wd=p.createContext(void 0);function Sa(e){const t=p.useContext(Wd);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function Gd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Vd="DismissableLayer",Or="dismissableLayer.update",Kd="dismissableLayer.pointerDownOutside",qd="dismissableLayer.focusOutside",ts,ka=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ka),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),_=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=b,L=Qd(j=>{const x=j.target,y=[...f.branches].some(T=>T.contains(x));!E||y||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),k=Zd(j=>{const x=j.target;[...f.branches].some(T=>T.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return Gd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Vd;var Yd="DismissableLayerBranch",Xd=p.forwardRef((e,t)=>{const n=p.useContext(ka),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:r})});Xd.displayName=Yd;function Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){Ea(Kd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Zd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&Ea(qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?wa(r,s):r.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){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 pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Jd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(r),l=Je(s),c=p.useRef(null),d=ke(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(A){if(h.paused||!i)return;const E=A.target;i.contains(E)?c.current=E:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const E=A.relatedTarget;E!==null&&(i.contains(E)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&<(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(b);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),_.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(ef(sf(_a(i)),{select:!0}),document.activeElement===v&<(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const _=v.currentTarget,[A,E]=tf(_);A&&E?!v.shiftKey&&b===E?(v.preventDefault(),n&<(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&<(E,{select:!0})):b===_&&v.preventDefault()}},[n,o,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Jd;function ef(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(lt(o,{select:t}),document.activeElement!==n)return}function tf(e){const t=_a(e),n=ss(t,e),o=ss(t.reverse(),e);return[n,o]}function _a(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ss(e,t){for(const n of e)if(!nf(n,{upTo:t}))return n}function nf(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 rf(e){return e instanceof HTMLInputElement&&"select"in e}function lt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rf(e)&&t&&e.select()}}var as=of();function of(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function sf(e){return e.filter(t=>t.tagName!=="A")}var af=Zr[" useId ".trim().toString()]||(()=>{}),lf=0;function Re(e){const[t,n]=p.useState(af());return Ze(()=>{n(o=>o??String(lf++))},[e]),e||(t?`radix-${t}`:"")}const cf=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),uf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Me(e,dt(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function tt(e){return e.split("-")[0]}function qt(e){return e.split("-")[1]}function so(e){return e==="x"?"y":"x"}function ao(e){return e==="y"?"height":"width"}function Ve(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ve(e))}function df(e,t,n){n===void 0&&(n=!1);const o=qt(e),r=io(e),s=ao(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function ff(e){const t=Dn(e);return[Lr(e),t,Lr(t)]}function Lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ls=["left","right"],cs=["right","left"],mf=["top","bottom"],pf=["bottom","top"];function hf(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?mf:pf;default:return[]}}function gf(e,t,n,o){const r=qt(e);let s=hf(tt(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return uf[t]+e.slice(t.length)}function xf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aa(e){return typeof e!="number"?xf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function us(e,t,n){let{reference:o,floating:r}=e;const s=Ve(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=o.x+o.width/2-r.width/2,c=o.y+o.height/2-r.height/2,d=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:c};break;case"left":h={x:o.x-r.width,y:c};break;default:h={x:o.x,y:o.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function vf(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=Aa(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),_=c==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:A,strategy:m}):_);return{top:(b.top-L.top+g.top)/E.y,bottom:(L.bottom-b.bottom+g.bottom)/E.y,left:(b.left-L.left+g.left)/E.x,right:(L.right-b.right+g.right)/E.x}}const bf=50,yf=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=us(f,o,m),d=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:_}=C,{x:A,y:E,data:L,reset:k}=await _({x:l,y:c,initialPlacement:o,placement:d,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=E??c,g[b]={...g[b],...L},k&&h<bf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:r,middlewareData:g}},wf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=Aa(l),d={x:n,y:o},h=io(r),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",_=C?"bottom":"right",A=C?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=k?k[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(k)))&&(j=i.floating[A]||s.floating[g]);const x=E/2-L/2,y=j/2-v[g]/2-1,T=dt(c[b],y),M=dt(c[_],y),O=T,F=j-v[g]-M,I=j/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(r)!=null&&I!==z&&s.reference[g]/2-(I<O?T:M)-v[g]/2<0,w=S?I<O?I-O:I-F:0;return{[h]:d[h]+w,data:{[h]:z,centerOffset:I-z-w,...S&&{alignmentOffset:w}},reset:S}}}),Cf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(r),_=Ve(i),A=tt(i)===i,E=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:ff(i)),k=g!=="none";!d&&k&&L.push(...gf(i,v,g,E));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(l&&y.push(x[b]),c){const I=df(r,a,E);y.push(x[I[0]],x[I[1]])}if(T=[...T,{placement:r,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=j[I];if(z&&(!(c==="alignment"?_!==Ve(z):!1)||T.every(B=>Ve(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:z}};let S=(O=T.filter(w=>w.overflows[0]<=0).sort((w,B)=>w.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const w=(F=T.filter(B=>{if(k){const P=Ve(B.placement);return P===_||P==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((B,P)=>B[1]-P[1])[0])==null?void 0:F[0];w&&(S=w);break}case"initialPlacement":S=i;break}if(r!==S)return{reset:{placement:S}}}return{}}}};function ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fs(e){return cf.some(t=>e[t]>=0)}const Sf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=et(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},ja=new Set(["left","top"]);async function kf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=ja.has(a)?-1:1,l=s&&m?-1:1,c=et(t,e);let{mainAxis:d,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:d*f}:{x:d*f,y:h*l}}const Ef=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,m=await kf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+m.x,y:s+m.y,data:{...m,placement:a}}}}},_f=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:_,y:A}=b;return{x:_,y:A}}},...f}=et(e,t),l={x:n,y:o},c=await s.detectOverflow(t,f),d=Ve(tt(r)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",_=h==="y"?"bottom":"right",A=g+c[b],E=g-c[_];g=Dr(A,g,E)}if(i){const b=d==="y"?"top":"left",_=d==="y"?"bottom":"right",A=v+c[b],E=v-c[_];v=Dr(A,v,E)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[d]:i}}}}}},Af=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:o},c=Ve(r),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",E=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<E?h=E:h>L&&(h=L)}if(f){var b,_;const A=d==="y"?"width":"height",E=ja.has(tt(r)),L=s.reference[c]-s.floating[A]+(E&&((b=a.offset)==null?void 0:b[c])||0)+(E?0:C.crossAxis),k=s.reference[c]+s.reference[A]+(E?0:((_=a.offset)==null?void 0:_[c])||0)-(E?C.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[d]:h,[c]:g}}}},jf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(r),d=qt(r),h=Ve(r)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const _=v-l.top-l.bottom,A=g-l.left-l.right,E=dt(v-l[C],_),L=dt(g-l[b],A),k=!t.middlewareData.shift;let j=E,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),k&&!d){const T=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(T!==0||M!==0?T+M:Me(l.left,l.right)):j=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return Ta(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ye(e){var t;return(t=(Ta(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ta(e){return Yn()?e instanceof Node||e instanceof Pe(e).Node:!1}function $e(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Tf(e){return/^(table|td|th)$/.test(Yt(e))}function Xn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Rf=/transform|translate|scale|rotate|perspective|filter/,Nf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!co()&&(wt(t.backdropFilter)||wt(t.filter))||Rf.test(t.willChange||"")||Nf.test(t.contain||"")}function If(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(lo(t))return t;if(Xn(t))return null;t=ft(t)}return null}function co(){return gr==null&&(gr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gr}function Wt(e){return/^(html|body|#document)$/.test(Yt(e))}function Ue(e){return Pe(e).getComputedStyle(e)}function Qn(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Ye(e);return ms(t)?t.host:t}function Ra(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ra(t)}function on(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ra(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Pe(r);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(r)?r:[],i&&n?on(i):[])}else return t.concat(r,on(r,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){const t=Ue(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=rt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=On(n)!==s||On(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function uo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Na(t);let a=(s?On(n.width):n.width)/o,i=(s?On(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Mf=Ke(0);function Ia(e){const t=Pe(e);return!co()||!t.visualViewport?Mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function _t(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(o?$e(o)&&(a=Ut(o)):a=Ut(e));const i=Pf(s,n,o)?Ia(s):Ke(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(s){const d=Pe(s),h=o&&$e(o)?Pe(o):o;let g=d,v=Fr(g);for(;v&&o&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),_=Ue(v),A=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,E=b.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=E,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:_t(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Zn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Of(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=Ye(o),i=t?Xn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(o);if((c||!c&&!s)&&((Yt(o)!=="body"||mn(a))&&(m=Qn(o)),c)){const h=_t(o);f=Ut(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const d=a&&!c&&!s?Ma(a,m):Ke(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Df(e){return Array.from(e.getClientRects())}function Lf(e){const t=Ye(e),n=Qn(e),o=e.ownerDocument.body,r=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return Ue(o).direction==="rtl"&&(a+=Me(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const ps=25;function Ff(e,t){const n=Pe(e),o=Ye(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const l=co();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Zn(o);if(f<=0){const l=o.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function $f(e,t){const n=_t(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let o;if(t==="viewport")o=Ff(e,n);else if(t==="document")o=Lf(Ye(e));else if($e(t))o=$f(t,n);else{const r=Ia(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ln(o)}function Pa(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||Pa(n,t)}function Uf(e,t){const n=t.get(e);if(n)return n;let o=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),r=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=lo(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||mn(a)&&!m&&Pa(e,a))?o=o.filter(l=>l!==a):r=i,a=ft(a)}return t.set(e,o),o}function zf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Uf(t,this._c):[].concat(n),o],i=hs(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],r);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Bf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Hf(e,t,n){const o=rt(t),r=Ye(t),s=n==="fixed",a=_t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Zn(r)}if(o||!o&&!s)if((Yt(t)!=="body"||mn(r))&&(i=Qn(t)),o){const h=_t(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const l=r&&!o&&!s?Ma(r,i):Ke(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function xr(e){return Ue(e).position==="static"}function gs(e,t){if(!rt(e)||Ue(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ye(e)===n&&(n=n.ownerDocument.body),n}function Oa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let r=ft(e);for(;r&&!Wt(r);){if($e(r)&&!xr(r))return r;r=ft(r)}return n}let o=gs(e,t);for(;o&&Tf(o)&&xr(o);)o=gs(o,t);return o&&Wt(o)&&xr(o)&&!lo(o)?n:o||If(e)||n}const Wf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,o=await n(e.floating);return{reference:Hf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Gf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Ye,getClippingRect:zf,getOffsetParent:Oa,getElementRects:Wf,getClientRects:Df,getDimensions:Bf,getScale:Ut,isElement:$e,isRTL:Gf};function Da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kf(e,t){let n=null,o;const r=Ye(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(r.clientWidth-(l+d)),C=Sn(r.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let E=!0;function L(k){const j=k[0].intersectionRatio;if(j!==m){if(!E)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Da(f,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function qf(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,f=uo(e),l=r||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Kf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[_]=b;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?_t(e):null;m&&C();function C(){const b=_t(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Yf=Ef,Xf=_f,Qf=Cf,Zf=jf,Jf=Sf,xs=wf,em=Af,tm=(e,t,n)=>{const o=new Map,r={platform:Vf,...n},s={...r.platform,_c:o};return yf(e,t,{...r,platform:s})};var nm=typeof document<"u",rm=function(){},jn=nm?p.useLayoutEffect:rm;function Fn(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,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Fn(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function La(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=La(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,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}),[d,h]=p.useState(o);Fn(d,o)||h(o);const[g,v]=p.useState(null),[C,b]=p.useState(null),_=p.useCallback(B=>{B!==k.current&&(k.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),E=s||g,L=a||C,k=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,T=vr(m),M=vr(r),O=vr(f),F=p.useCallback(()=>{if(!k.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};M.current&&(B.platform=M.current),tm(k.current,j.current,B).then(P=>{const U={...P,isPositioned:O.current!==!1};I.current&&!Fn(x.current,U)&&(x.current=U,Gs.flushSync(()=>{c(U)}))})},[d,t,n,M,O]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const I=p.useRef(!1);jn(()=>(I.current=!0,()=>{I.current=!1}),[]),jn(()=>{if(E&&(k.current=E),L&&(j.current=L),E&&L){if(T.current)return T.current(E,L,F);F()}},[E,L,F,T,y]);const z=p.useMemo(()=>({reference:k,floating:j,setReference:_,setFloating:A}),[_,A]),S=p.useMemo(()=>({reference:E,floating:L}),[E,L]),w=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!S.floating)return B;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...B,transform:"translate("+P+"px, "+U+"px)",...La(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:w}),[l,F,z,S,w])}const sm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?xs({element:o.current,padding:r}).fn(n):{}:o?xs({element:o,padding:r}).fn(n):{}}}},am=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=Xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},lm=(e,t)=>({fn:em(e).fn,options:[e,t]}),cm=(e,t)=>{const n=Qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},um=(e,t)=>{const n=Zf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=Jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},fm=(e,t)=>{const n=sm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mm="Arrow",Fa=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fa.displayName=mm;var pm=Fa;function hm(e){const[t,n]=p.useState(void 0);return Ze(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const m=s.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 o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var fo="Popper",[$a,Xt]=nt(fo),[gm,Ua]=$a(fo),za=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return u.jsx(gm,{scope:t,anchor:o,onAnchorChange:r,children:n})};za.displayName=fo;var Ba="PopperAnchor",Ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Ua(Ba,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:u.jsx(he.div,{...r,ref:i})});Ha.displayName=Ba;var mo="PopperContent",[xm,vm]=$a(mo),Wa=p.forwardRef((e,t)=>{var G,K,V,ne,Z,re;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=Ua(mo,n),[b,_]=p.useState(null),A=ke(t,ue=>_(ue)),[E,L]=p.useState(null),k=hm(E),j=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=o+(s!=="center"?"-"+s:""),T=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],O=M.length>0,F={padding:T,boundary:M.filter(ym),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:w,middlewareData:B}=om({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>qf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[am({mainAxis:r+x,alignmentAxis:a}),m&&im({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?lm():void 0,...F}),m&&cm({...F}),um({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${ye}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),E&&fm({element:E,padding:i}),wm({arrowWidth:j,arrowHeight:x}),d&&dm({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Je(g);Ze(()=>{w&&(q==null||q())},[w,q]);const N=(G=B.arrow)==null?void 0:G.x,D=(K=B.arrow)==null?void 0:K.y,$=((V=B.arrow)==null?void 0:V.centerOffset)!==0,[R,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:w?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(xm,{scope:n,placedSide:P,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:w?void 0:"none"}})})})});Wa.displayName=mo;var Ga="PopperArrow",bm={top:"bottom",right:"left",bottom:"top",left:"right"},Va=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=vm(Ga,o),a=bm[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(pm,{...r,ref:n,style:{...r.style,display:"block"}})})});Va.displayName=Ga;function ym(e){return e!==null}var wm=e=>({name:"transformOrigin",options:e,fn(t){var C,b,_;const{placement:n,rects:o,middlewareData:r}=t,a=((C=r.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Ka(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=r.arrow)==null?void 0:b.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Ka(e){const[t,n="center"]=e.split("-");return[t,n]}var po=za,Jn=Ha,ho=Wa,go=Va,Cm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(he.div,{...o,ref:t}),a):null});pn.displayName=Cm;function Sm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Oe=e=>{const{present:t,children:n}=e,o=km(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=ke(o.ref,Em(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Oe.displayName="Presence";function km(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Sm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(o.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=o.current,l=r.current;if(l!==e){const d=s.current,h=kn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=kn(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Em(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",_m={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,Am]=Ca(hn),[jm,Ya]=nt(hn,[Am]),[Tm,Rm]=jm(hn),Xa=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Nm,{...e,ref:t})})}));Xa.displayName=hn;var Nm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=ke(t,d),g=Sa(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,_]=p.useState(!1),A=Je(f),E=qa(n),L=p.useRef(!1),[k,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(Tm,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:u.jsx(he.div,{tabIndex:b||k===0?-1:0,"data-orientation":o,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const T=new CustomEvent(br,_m);if(x.currentTarget.dispatchEvent(T),!T.defaultPrevented){const M=E().filter(S=>S.focusable),O=M.find(S=>S.active),F=M.find(S=>S.id===v),z=[O,F,...M].filter(Boolean).map(S=>S.ref.current);Ja(z,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>_(!1))})})}),Qa="RovingFocusGroupItem",Za=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Rm(Qa,n),c=l.currentTabStopId===f,d=qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{o?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Pm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const E=A.indexOf(C.currentTarget);A=l.loop?Om(A,E+1):A.slice(E+1)}setTimeout(()=>Ja(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Za.displayName=Qa;var Im={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Pm(e,t,n){const o=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Im[o]}function Ja(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Om(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Dm=Xa,Lm=Za,Fm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,En=new WeakMap,_n={},yr=0,ei=function(e){return e&&(e.host||ei(e.parentNode))},$m=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ei(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Um=function(e,t,n,o){var r=$m(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(o),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&En.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(En.has(c)||c.removeAttribute(o),En.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,En=new WeakMap,_n={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Fm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Um(o,r,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],zm=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],Bm=[...zm,...ti],Hm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Wm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,Gm,Vm]=Ca(gn),[Nt,ni]=nt(gn,[Vm,Xt,Ya]),er=Xt(),ri=Ya(),[Km,It]=Nt(gn),[qm,xn]=Nt(gn),oi=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Sa(r);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})}},[]),u.jsx(po,{...i,children:u.jsx(Km,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(qm,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:o})})})};oi.displayName=gn;var Ym="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(Jn,{...r,...o,ref:t})});vo.displayName=Ym;var bo="MenuPortal",[Xm,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=It(bo,t);return u.jsx(Xm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};ai.displayName=bo;var De="MenuContent",[Qm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Zm,{...r,ref:t}):u.jsx(Jm,{...r,ref:t})})})})}),Zm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu);return u.jsx(wo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ep=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),_=er(n),A=ri(n),E=Gm(n),[L,k]=p.useState(null),j=p.useRef(null),x=ke(t,j,C.onContentChange),y=p.useRef(0),T=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Jr:p.Fragment,S=g?{as:ep,allowPinchZoom:!0}:void 0,w=P=>{var G,K;const U=T.current+P,q=E().filter(V=>!V.disabled),N=document.activeElement,D=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=fp($,U,D),H=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){T.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&pp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(Qm,{scope:n,searchRef:T,onItemEnter:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),onItemLeave:p.useCallback(P=>{var U;B(P)||((U=j.current)==null||U.focus(),k(null))},[B]),onTriggerLeave:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:r,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=j.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Dm,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Si(C.open),"data-radix-menu-content":"",dir:b.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,D=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&D&&w(P.key));const $=j.current;if(P.target!==$||!Bm.includes(P.key))return;P.preventDefault();const H=E().filter(G=>!G.disabled).map(G=>G.ref.current);ti.includes(P.key)&&H.reverse(),up(H)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),T.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=I.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>I.current?"right":"left";F.current=N,I.current=P.clientX}}))})})})})})})});ii.displayName=De;var tp="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"group",...o,ref:t})});Co.displayName=tp;var np="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{...o,ref:t})});li.displayName=np;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>o==null?void 0:o(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...r,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var ci=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=yo($n,n),i=ri(n),m=p.useRef(null),f=ke(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:o,textValue:r??d,children:u.jsx(Lm,{asChild:!0,...i,focusable:!o,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),rp="MenuCheckboxItem",ui=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...r,ref:t,"data-state":ko(n),onSelect:te(r.onSelect,()=>o==null?void 0:o(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ui.displayName=rp;var di="MenuRadioGroup",[op,sp]=Nt(di,{value:void 0,onValueChange:()=>{}}),fi=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Je(o);return u.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...r,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=sp(mi,e.__scopeMenu),s=n===r.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":ko(s),onSelect:te(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,ap]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=ap(So,n);return u.jsx(Oe,{present:o||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...r,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ip="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});xi.displayName=ip;var lp="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(go,{...r,...o,ref:t})});vi.displayName=lp;var cp="MenuSub",[Nb,bi]=Nt(cp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),o=xn(rn,e.__scopeMenu),r=bi(rn,e.__scopeMenu),s=yo(rn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,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]),u.jsx(vo,{asChild:!0,...f,children:u.jsx(ci,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Si(n.open),...e,ref:qe(t,r.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,_=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:_,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:_,y:d.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Hm[o.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});yi.displayName=rn;var wi="MenuSubContent",Ci=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=bi(wi,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...r,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:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Wm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ci.displayName=wi;function Si(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function ko(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function up(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dp(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function fp(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dp(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function mp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=oi,gp=vo,xp=ai,vp=ii,bp=Co,yp=li,wp=tr,Cp=ui,Sp=fi,kp=pi,Ep=gi,_p=xi,Ap=vi,jp=yi,Tp=Ci,nr="DropdownMenu",[Rp]=nt(nr,[ni]),Ne=ni(),[Np,ki]=Rp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:r,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Np,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(hp,{...m,open:l,onOpenChange:c,dir:o,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",Ai=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ki(_i,n),a=Ne(n);return u.jsx(gp,{asChild:!0,...a,children:u.jsx(he.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ai.displayName=_i;var Ip="DropdownMenuPortal",ji=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ne(t);return u.jsx(xp,{...o,...n})};ji.displayName=Ip;var Ti="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ki(Ti,n),s=Ne(n),a=p.useRef(!1);return u.jsx(vp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.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)"}})});Ri.displayName=Ti;var Mp="DropdownMenuGroup",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(bp,{...r,...o,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(yp,{...r,...o,ref:t})});Ni.displayName=Op;var Dp="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(wp,{...r,...o,ref:t})});Ii.displayName=Dp;var Lp="DropdownMenuCheckboxItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Cp,{...r,...o,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuRadioGroup",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Sp,{...r,...o,ref:t})});Up.displayName=$p;var zp="DropdownMenuRadioItem",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(kp,{...r,...o,ref:t})});Bp.displayName=zp;var Hp="DropdownMenuItemIndicator",Wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ep,{...r,...o,ref:t})});Wp.displayName=Hp;var Gp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(_p,{...r,...o,ref:t})});Mi.displayName=Gp;var Vp="DropdownMenuArrow",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ap,{...r,...o,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSubTrigger",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(jp,{...r,...o,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuSubContent",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Tp,{...r,...o,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)"}})});Qp.displayName=Xp;var Zp=Ei,Jp=Ai,eh=ji,th=Ri,nh=Ni,rh=Ii,oh=Mi;function Pi({...e}){return u.jsx(Zp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Jp,{"data-slot":"dropdown-menu-trigger",...e})}function Di({className:e,sideOffset:t=4,...n}){return u.jsx(eh,{children:u.jsx(th,{"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 Tn({className:e,inset:t,variant:n="default",...o}){return u.jsx(rh,{"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),...o})}function sh({className:e,inset:t,...n}){return u.jsx(nh,{"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 ys({className:e,...t}){return u.jsx(oh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const ah=[{value:"light",label:"Light",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(da,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Hu,{className:"h-4 w-4"})}];function ih(){const{theme:e,setTheme:t,resolvedTheme:n}=wd();return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(da,{className:"h-4 w-4"}):u.jsx(pa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Di,{align:"end",children:ah.map(o=>u.jsxs(Tn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,u.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const ws={"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.description":"输入你的用户名和密码以继续。","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":"删除会话失败","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":"连接失败","user.settings.language":"语言","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.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":"分阶段发布检查项与进度条","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},lh={"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.description":"Enter your username and password to continue.","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","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","user.settings.language":"Language","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.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","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Li="rcs_locale";function ch(){try{const t=localStorage.getItem(Li);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=ch();const zr=new Set;function Ib(e){Eo=e;try{localStorage.setItem(Li,e)}catch{}zr.forEach(t=>t())}function uh(e){return zr.add(e),()=>{zr.delete(e)}}function Fi(){return p.useSyncExternalStore(uh,()=>Eo)}function Fe(e){return Eo==="en"?lh[e]??ws[e]??e:ws[e]??e}const dh="";let zn=null;function fh(e){zn=e}function Mb(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function mh(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,o,r){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function ve(e,t,n,o){const r={"Content-Type":"application/json"};zn&&(r.Authorization=`Bearer ${zn}`);const s=`${dh}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!o&&await mh())return ve(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(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 wr(c,l,i.status)}return m}function Pb(){return ve("GET","/web/sessions/all")}function Ob(e){return ve("GET",`/web/sessions/${e}`)}function Db(e){return ve("GET",`/web/sessions/${e}/history`)}function Lb(){return ve("GET","/web/environments")}function Fb(e,t){return ve("POST",`/web/sessions/${e}/events`,t)}function $b(e,t){return ve("POST",`/web/sessions/${e}/control`,t)}function Ub(e){return ve("POST",`/web/sessions/${e}/interrupt`)}function zb(e){return ve("DELETE",`/web/sessions/${e}`)}function Bb(e){return ve("POST",`/web/sessions/${e}/clear`)}function Hb(e,t){return ve("PATCH",`/web/sessions/${e}`,{title:t})}function Wb(e){return ve("POST","/web/sessions",e)}function Gb(e){return ve("GET",`/web/sessions/s/${e}`)}function Vb(e){return ve("GET",`/web/sessions/${e}/shares`)}function Kb(e,t){return ve("POST",`/web/sessions/${e}/shares`,t)}function qb(e,t){return ve("DELETE",`/web/sessions/${e}/shares/${t}`)}function Yb(e,t){return ve("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Xb(e,t){return ve("DELETE",`/web/teams/${e}/environments/${t}`)}function Qb(e){return ve("POST","/web/environments/claim",{claim_token:e})}function Zb(e){const t=e!=null&&e.session_id?`?session_id=${encodeURIComponent(e.session_id)}`:"";return ve("GET",`/web/artifacts${t}`)}function Jb(e){return ve("GET",`/web/artifacts/${e}`)}function ey(e){return ve("POST","/web/artifacts",e)}function ty(e){return ve("DELETE",`/web/artifacts/${e}`)}const Hr="rcs_active_team";function ph(){try{return localStorage.getItem(Hr)}catch{return null}}let $i=ph();const Wr=new Set;function hh(){for(const e of Wr)e()}function gh(e){return Wr.add(e),()=>Wr.delete(e)}function xh(){return $i}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}$i=e,hh()}function vh(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(gh,xh,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await ve("GET","/web/teams");t(f)}catch{t([])}finally{o(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===r)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await ve("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function bh({className:e}){Fi();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=vh();return r||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.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:s=>{const a=s.target.value;o(a||null)},children:[u.jsx("option",{value:"",children:Fe("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Kt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Ui=p.createContext(null);function zi(){const e=p.useContext(Ui);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Dt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function yh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function wh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=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 Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const _=await Dt();n(_),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const _=await Dt();n(_),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>yh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:o,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function Ch({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.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:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(ha,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Di,{align:"end",className:"w-48",children:[u.jsx(sh,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(sd,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(bd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:o,children:[u.jsx($u,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function Sh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o,onNavigateArtifacts:r}){return Fi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(bh,{}),e?u.jsxs(u.Fragment,{children:[u.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:[u.jsx(wu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.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:Fe("nav.dashboard"),children:[u.jsx(Du,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),r&&u.jsxs("button",{type:"button",onClick:r,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:Fe("artifacts.title"),children:[u.jsx(Ru,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(ih,{}),u.jsx(Ch,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ny({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return u.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function kh(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Bi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(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 o of this.onConnectionStateChange)o(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,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.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 o=new WebSocket(this.settings.proxyUrl,this.settings.token?[kh(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,l,c,d,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 v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));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),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(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 b of this.onModelStateChanged)b(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 b of this.onModelStateChanged)b(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 C=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",C,"payload:",t.payload),C==="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(C==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(C==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(C==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const b of this.onConfigOptionsChanged)b(this._configOptions)}(d=this.onSessionUpdate)==null||d.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 b of this.onModelChanged)b(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 o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.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>=ct.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"))},ct.PONG_TIMEOUT_MS)},ct.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 o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,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 o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}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,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Bi),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 o of this.onModelStateChanged)o(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)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function Eh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function Hi(e,t){return new Promise((function(n,o){let r;return _h(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const _h=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Bn={},Ah={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,o={};Ah.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=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 v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),_=a(l,m+2),A=a(l,m+4);m+=6;var E=i(l,m+=8);m+=4,m+=b+_+A,o._readLocal(l,E,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var l=o.bin.readUshort,c=o.bin.readUint;c(r,s),l(r,s+=4),l(r,s+=2);var d=l(r,s+=2);c(r,s+=2),c(r,s+=4),s+=4;var h=l(r,s+=8),g=l(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(r.buffer,s);if(d==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);o.inflateRaw(C,b),a[v]=b}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.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)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var l in r){var c=!o._noNeed(l)&&!s,d=r[l],h=o.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?o.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*o.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=o._writeHeader(g,v,l,b,0)}var _=0,A=v;for(var l in f)b=f[l],C.push(v),v=o._writeHeader(g,v,l,b,1,C[_++]);var E=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,E),i(g,v+=4,A),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var l=o.bin.writeUint,c=o.bin.writeUshort,d=i.file;return l(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(r,s,20),c(r,s+=2,0),c(r,s+=2,i.cpr?8:0),l(r,s+=2,0),l(r,s+=4,i.crc),l(r,s+=4,d.length),l(r,s+=4,i.usize),c(r,s+=4,o.bin.sizeUTF8(a)),c(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(d,s),s+=d.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)r[s+m]=l,m++;else if((4294965248&l)==0)r[s+m]=192|l>>6,r[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[s+m]=224|l>>12,r[s+m+1]=128|l>>6&63,r[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[s+m]=240|l>>18,r[s+m+1]=128|l>>12&63,r[s+m+2]=128|l>>6&63,r[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.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}},o.F={},o.F.deflateRaw=function(r,s,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=o.F.U,l=o.F._goodIndex;o.F._hash;var c=o.F._putsE,d=0,h=a<<3,g=0,v=r.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=o.F._copyExact(r,d,M,s,h+8),d+=M;return h>>>3}var C=f.lits,b=f.strt,_=f.prev,A=0,E=0,L=0,k=0,j=0,x=0;for(v>2&&(b[x=o.F._hash(r,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=o.F._hash(r,d+1);var y=d+1&32767;_[y]=b[x],b[x]=y}if(g<=d){(A>14e3||E>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(d==v-1||g==v?1:0,C,A,k,r,L,d-L,s,h),A=E=k=0,L=d);var T=0;d<v-2&&(T=o.F._bestMatch(r,d,_,j,Math.min(m[2],v-d),m[3]));var M=T>>>16,O=65535&T;if(T!=0){O=65535&T;var F=l(M=T>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],C[A]=M<<23|d-g,C[A+1]=O<<16|F<<8|I,A+=2,g=d+M}else f.lhst[r[d]]++;E++}}for(L==d&&r.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(1,C,A,k,r,L,d-L,s,h),A=0,E=0,A=E=k=0,L=d);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=o.F._hash(r,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||r[s+h]==r[s+h-d]){var C=o.F._howLong(r,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,_=0;_<C-2;_++){var A=s-d+_+32768&32767,E=A-a[A]+32768&32767;E>b&&(b=E,c=A)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,l,c,d){var h,g,v,C,b,_,A,E,L,k=o.F.U,j=o.F._putsF,x=o.F._putsE;k.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],b=h[3],_=h[4],A=h[5],E=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),T=i+o.F.contSize(k.fltree,k.lhst)+o.F.contSize(k.fdtree,k.dhst),M=i+o.F.contSize(k.ltree,k.lhst)+o.F.contSize(k.dtree,k.dhst);M+=14+3*A+o.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<T&&y<M?0:T<M?1:2;if(j(c,d,r),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=o.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){o.F.makeCodes(k.ltree,g),o.F.revCodes(k.ltree,g),o.F.makeCodes(k.dtree,v),o.F.revCodes(k.dtree,v),o.F.makeCodes(k.itree,C),o.F.revCodes(k.itree,C),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,_-1),x(c,d+=5,A-4),d+=4;for(var S=0;S<A;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*A,d=o.F._codeTiny(E,k.itree,c,d),d=o.F._codeTiny(L,k.itree,c,d)}for(var w=f,B=0;B<a;B+=2){for(var P=s[B],U=P>>>23,q=w+(8388607&P);w<q;)d=o.F._writeLit(m[w++],I,c,d);if(U!=0){var N=s[B+1],D=N>>16,$=N>>8&255,R=255&N;x(c,d=o.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],j(c,d=o.F._writeLit(R,z,c,d),D-k.df0[R]),d+=k.dxb[R],w+=U}}d=o.F._writeLit(256,I,c,d)}return d},o.F._copyExact=function(r,s,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(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],l=o.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var d=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],l=r[m+1];i=o.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,l,c),i+=c)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&r[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&r[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(E,L){return E.f-L.f}));var g=i[0],v=i[1],C=0,b=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=o.F.setDepth(i[b-1],0);for(A>a&&(o.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<r.length&&r[i].d>s;i++){var l=r[i].d;r[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=r[i].d)<s?(r[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,b,_=0,A=0,E=0,L=0,k=0,j=0,x=0,y=0,T=0;_==0;)if(_=m(r,T,1),A=m(r,T+1,2),T+=3,A!=0){if(v&&(s=o.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){E=f(r,T,5)+257,L=f(r,T+5,5)+1,k=f(r,T+10,4)+4,T+=14;for(var M=0;M<38;M+=2)g.itree[M]=0,g.itree[M+1]=0;var O=1;for(M=0;M<k;M++){var F=f(r,T+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}T+=3*k,c(g.itree,O),d(g.itree,O,g.imap),C=g.lmap,b=g.dmap,T=l(g.imap,(1<<O)-1,E+L,r,T,g.ttree);var I=i._copyOut(g.ttree,0,E,g.ltree);j=(1<<I)-1;var z=i._copyOut(g.ttree,E,L,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,C),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=C[h(r,T)&j];T+=15&S;var w=S>>>4;if(!(w>>>8))s[y++]=w;else{if(w==256)break;var B=y+w-254;if(w>264){var P=g.ldef[w-257];B=y+(P>>>3)+f(r,T,7&P),T+=7&P}var U=b[h(r,T)&x];T+=15&U;var q=U>>>4,N=g.ddef[q],D=(N>>>4)+m(r,T,15&N);for(T+=15&N,v&&(s=o.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&T)!=0&&(T+=8-(7&T));var $=4+(T>>>3),R=r[$-4]|r[$-3]<<8;v&&(s=o.F._check(s,y+R)),s.set(new a(r.buffer,r.byteOffset+$,R),y),T=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var l=o.F._bitsE,c=o.F._get17,d=0;d<a;){var h=r[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,C=0;g==16?(C=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(C=3+l(i,m,3),m+=3):g==18&&(C=11+l(i,m,7),m+=7);for(var b=d+C;d<b;)f[d]=v,d++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+s];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},o.F.makeCodes=function(r,s){for(var a,i,m,f,l=o.F.U,c=r.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[r[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var l=f>>1,c=r[f+1],d=l<<4|c,h=s-c,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.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 r=o.F.U,s=0;s<32768;s++){var a=s;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,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var jh=Eh({__proto__:null,default:Bn},[Bn]);const Le=(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,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),_=new Uint32Array(b.buffer),{ctype:A}=h,{depth:E}=h,L=e.readUshort;if(A==6){const P=g<<2;if(E==8)for(var k=0;k<P;k+=4)b[k]=l[k],b[k+1]=l[k+1],b[k+2]=l[k+2],b[k+3]=l[k+3];if(E==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(E==8)for(k=0;k<g;k++){var j=3*k;_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(E==16)for(k=0;k<g;k++)j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=P[0];const U=P[1],q=P[2];if(E==8)for(k=0;k<g;k++){var y=k<<2;j=3*k,_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==U&&l[j+2]==q&&(b[y+3]=0)}if(E==16)for(k=0;k<g;k++)y=k<<2,j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==U&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(E==1)for(var T=0;T<d;T++){var M=T*C,O=T*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(I=l[M+(k>>3)]>>7-((7&k)<<0)&1);b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}if(E==2)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>2)]>>6-((3&k)<<1)&3),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==4)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>1)]>>4-((1&k)<<2)&15),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==8)for(k=0;k<g;k++){var I;y=k<<2,F=3*(I=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}else if(A==4){if(E==8)for(k=0;k<g;k++){y=k<<2;var z=l[S=k<<1];b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+1]}if(E==16)for(k=0;k<g;k++){var S;y=k<<2,z=l[S=k<<2],b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,T=0;T<d;T++){const P=T*C,U=T*c;if(E==1)for(var w=0;w<c;w++){var B=(z=255*(l[P+(w>>>3)]>>>7-(7&w)&1))==255*x?0:255;_[U+w]=B<<24|z<<16|z<<8|z}else if(E==2)for(w=0;w<c;w++)B=(z=85*(l[P+(w>>>2)]>>>6-((3&w)<<1)&3))==85*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==4)for(w=0;w<c;w++)B=(z=17*(l[P+(w>>>1)]>>>4-((1&w)<<2)&15))==17*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==8)for(w=0;w<c;w++)B=(z=l[P+w])==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==16)for(w=0;w<c;w++)z=l[P+(w<<1)],B=L(l,P+(w<<1))==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,C):o(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(_,A){const E=A.width,L=A.height,k=s(A),j=k>>3,x=Math.ceil(E*k/8),y=new Uint8Array(L*x);let T=0;const M=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const w=F[z],B=I[z];let P=0,U=0,q=M[z];for(;q<L;)q+=w,U++;let N=O[z];for(;N<E;)N+=B,P++;const D=Math.ceil(P*k/8);a(_,A,T,P,U);let $=0,R=M[z];for(;R<L;){let H=O[z],G=T+$*D<<3;for(;H<E;){var S;if(k==1&&(S=(S=_[G>>3])>>7-(7&G)&1,y[R*x+(H>>3)]|=S<<7-((7&H)<<0)),k==2&&(S=(S=_[G>>3])>>6-(7&G)&3,y[R*x+(H>>2)]|=S<<6-((3&H)<<1)),k==4&&(S=(S=_[G>>3])>>4-(7&G)&15,y[R*x+(H>>1)]|=S<<4-((1&H)<<2)),k>=8){const K=R*x+H*j;for(let V=0;V<j;V++)y[K+V]=_[(G>>3)+V]}G+=k,H+=B}$++,R+=w}P*U!=0&&(T+=U*(1+D)),z+=1}return y})(c,l)),c}function o(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,_=0,A=0,E=0,L=0,k=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,T=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,w=d==null;for(w&&(d=new h(c.length>>>2<<5));C==0;)if(C=T(c,x,1),b=T(c,x+1,2),x+=3,b!=0){if(w&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=S.J,v=S.h,L=511,k=31),b==2){_=M(c,x,5)+257,A=M(c,x+5,5)+1,E=M(c,x+10,4)+4,x+=14;let P=1;for(var B=0;B<38;B+=2)S.Q[B]=0,S.Q[B+1]=0;for(B=0;B<E;B++){const N=M(c,x+3*B,3);S.Q[1+(S.X[B]<<1)]=N,N>P&&(P=N)}x+=3*E,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,_+A,c,x,S.v);const U=y.V(S.v,0,_,S.C);L=(1<<U)-1;const q=y.V(S.v,_,A,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,v)}for(;;){const P=g[z(c,x)&L];x+=15&P;const U=P>>>4;if(!(U>>>8))d[j++]=U;else{if(U==256)break;{let q=j+U-254;if(U>264){const H=S.q[U-257];q=j+(H>>>3)+M(c,x,7&H),x+=7&H}const N=v[z(c,x)&k];x+=15&N;const D=N>>>4,$=S.c[D],R=($>>>4)+T(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;w&&(d=l.H.W(d,j+U)),d.set(new h(c.buffer,c.byteOffset+P,U),j),x=P+U<<3,j+=U}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,_=l.H.Z;let A=0;for(;A<h;){const E=c[_(g,v)&d];v+=15&E;const L=E>>>4;if(L<=15)C[A]=L,A++;else{let k=0,j=0;L==16?(j=3+b(g,v,2),v+=2,k=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=k,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const _=c[C+d];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,_;const A=h.j;for(var E=0;E<=d;E++)A[E]=0;for(E=1;E<g;E+=2)A[c[E]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)_=c[b+1],_!=0&&(c[b]=L[_],L[_]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,_=c[C+1],A=b<<4|_,E=d-_;let L=c[C]<<E;const k=L+(1<<E);for(;L!=k;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=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 d(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 d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;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[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];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 s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,_;v=Math.ceil(v/8);let A=l[d],E=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(E=v;E<C;E++)l[E+1]=l[E+1]+(l[E+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,_=b+L+1,A=l[_-1],E=0,A==0)for(;E<C;E++)l[b+E]=l[_+E];else if(A==1){for(;E<v;E++)l[b+E]=l[_+E];for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-v]}else if(A==2)for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-C];else if(A==3){for(;E<v;E++)l[b+E]=l[_+E]+(l[b+E-C]>>>1);for(;E<C;E++)l[b+E]=l[_+E]+(l[b+E-C]+l[b+E-v]>>>1)}else{for(;E<v;E++)l[b+E]=l[_+E]+i(0,l[b+E-C],0);for(;E<C;E++)l[b+E]=l[_+E]+i(l[b+E-v],l[b+E-C],l[b+E-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,_){const A=Math.min(c,g),E=Math.min(d,v);let L=0,k=0;for(let z=0;z<E;z++)for(let S=0;S<A;S++)if(C>=0&&b>=0?(L=z*c+S<<2,k=(b+z)*g+C+S<<2):(L=(-b+z)*c-C+S<<2,k=z*g+S<<2),_==0)h[k]=l[L],h[k+1]=l[L+1],h[k+2]=l[L+2],h[k+3]=l[L+3];else if(_==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,T=l[L+2]*j,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const w=1-j,B=j+M*w,P=B==0?0:1/B;h[k+3]=255*B,h[k+0]=(x+O*w)*P,h[k+1]=(y+F*w)*P,h[k+2]=(T+I*w)*P}else if(_==2)j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=y,h[k+2]=T,h[k+3]=j);else if(_==3){if(j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I)continue;if(j<220&&M>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},_=new Uint8Array(d.length);let A,E=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=k[j])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,b);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const w=d.slice(x+2,h+z);let B=null;try{B=o(w)}catch{B=r(w)}b.tabs[S]=B}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(j=0;j<z;j++)_[E+j]=d[h+j];E+=z}else if(S=="acTL")b.tabs[S]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(S=="fcTL"){L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height),L=0);const w={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const P={rect:w,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(j=0;j<z-4;j++)A[L+j]=d[h+j+4];L+=z-4}else if(S=="pHYs")b.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(b.tabs[S]=[],j=0;j<8;j++)b.tabs[S].push(g.readUint(d,h+4*j));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),T=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=o(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][T]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),T=g.readASCII(d,x,y-x);const w=d[x=y+1];var F;d[x+1],x+=2,y=g.nextZero(d,x),g.readASCII(d,x,y-x),x=y+1,y=g.nextZero(d,x),g.readUTF8(d,x,y-x),M=z-((x=y+1)-h),w==0?F=g.readUTF8(d,x,M):(O=o(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][T]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const w=b.tabs.PLTE.length/3;for(b.tabs[S]=[],j=0;j<w;j++)b.tabs[S].push(v(d,h+2*j))}else if(S=="tRNS")b.ctype==3?b.tabs[S]=g.readBytes(d,h,z):b.ctype==0?b.tabs[S]=v(d,h):b.ctype==2&&(b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(S=="gAMA")b.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")b.tabs[S]=d[h];else if(S=="bKGD")b.ctype==0||b.ctype==4?b.tabs[S]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),_=new Uint8Array(v);for(let E=0;E<c.frames.length;E++){const L=c.frames[E],k=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,T=t(L.data,x,y,c);if(E!=0)for(var A=0;A<v;A++)_[A]=C[A];if(L.blend==0?f(T,x,y,C,d,h,k,j,0):L.blend==1&&f(T,x,y,C,d,h,k,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,k,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=_[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let M=0;M<8;M++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,M){for(let O=0;O<M;O++)x=o.table[255&(x^y[T+O])]^x>>>8;return x},crc:(x,y,T)=>4294967295^o.update(4294967295,x,y,T)};function r(x,y,T,M){y[T]+=x[0]*M>>4,y[T+1]+=x[1]*M>>4,y[T+2]+=x[2]*M>>4,y[T+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const T=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return T*T+M*M+O*O+F*F}function i(x,y,T,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var w=0;w<z;w++){const R=M[w];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(w=0;w<z;w++){let R=4294967295;for(var B=0,P=0;P<z;P++){var U=a(S[w],S[P]);P!=w&&U<R&&(R=U,B=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*T*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(w=0;w<D.length;w++)D[w]=255*((D[w]+.5)/16-.5);for(let R=0;R<T;R++)for(let H=0;H<y;H++){var $;w=4*(R*y+H),I!=2?$=[s(x[w]+N[w]),s(x[w+1]+N[w+1]),s(x[w+2]+N[w+2]),s(x[w+3]+N[w+3])]:(U=D[4*(3&R)+(3&H)],$=[s(x[w]+U),s(x[w+1]+U),s(x[w+2]+U),s(x[w+3]+U)]),B=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,B=P)}const K=S[B],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(H!=y-1&&r(V,N,w+4,7),R!=T-1&&(H!=0&&r(V,N,w+4*y-4,3),r(V,N,w+4*y,5),H!=y-1&&r(V,N,w+4*y+4,1))),F[w>>2]=B,q[w>>2]=M[B]}}function m(x,y,T,M,O){O==null&&(O={});const{crc:F}=o,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let w=8;const B=x.frames.length>1;let P,U=!1,q=33+(B?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(P=pako.deflate(O.iCCP),q+=21+P.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)R[D]=H[D];if(I(R,w,13),w+=4,S(R,w,"IHDR"),w+=4,I(R,w,y),w+=4,I(R,w,T),w+=4,R[w]=x.depth,w++,R[w]=x.ctype,w++,R[w]=0,w++,R[w]=0,w++,R[w]=0,w++,I(R,w,F(R,w-17,17)),w+=4,O.sRGB!=null&&(I(R,w,1),w+=4,S(R,w,"sRGB"),w+=4,R[w]=O.sRGB,w++,I(R,w,F(R,w-5,5)),w+=4),O.iCCP!=null){const V=13+P.length;I(R,w,V),w+=4,S(R,w,"iCCP"),w+=4,S(R,w,"ICC profile"),w+=11,w+=2,R.set(P,w),w+=P.length,I(R,w,F(R,w-(V+4),V+4)),w+=4}if(O.pHYs!=null&&(I(R,w,9),w+=4,S(R,w,"pHYs"),w+=4,I(R,w,O.pHYs[0]),w+=4,I(R,w,O.pHYs[1]),w+=4,R[w]=O.pHYs[2],w++,I(R,w,F(R,w-13,13)),w+=4),B&&(I(R,w,8),w+=4,S(R,w,"acTL"),w+=4,I(R,w,x.frames.length),w+=4,I(R,w,O.loop!=null?O.loop:0),w+=4,I(R,w,F(R,w-12,12)),w+=4),x.ctype==3){for(I(R,w,3*(N=x.plte.length)),w+=4,S(R,w,"PLTE"),w+=4,D=0;D<N;D++){const V=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[w+V+0]=Z,R[w+V+1]=re,R[w+V+2]=ue}if(w+=3*N,I(R,w,F(R,w-3*N-4,3*N+4)),w+=4,U){for(I(R,w,N),w+=4,S(R,w,"tRNS"),w+=4,D=0;D<N;D++)R[w+D]=x.plte[D]>>>24&255;w+=N,I(R,w,F(R,w-N-4,N+4)),w+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(I(R,w,26),w+=4,S(R,w,"fcTL"),w+=4,I(R,w,G++),w+=4,I(R,w,K.rect.width),w+=4,I(R,w,K.rect.height),w+=4,I(R,w,K.rect.x),w+=4,I(R,w,K.rect.y),w+=4,z(R,w,M[$]),w+=2,z(R,w,1e3),w+=2,R[w]=K.dispose,w++,R[w]=K.blend,w++,I(R,w,F(R,w-30,30)),w+=4);const V=K.cimg;I(R,w,(N=V.length)+($==0?0:4)),w+=4;const ne=w;S(R,w,$==0?"IDAT":"fdAT"),w+=4,$!=0&&(I(R,w,G++),w+=4),R.set(V,w),w+=N,I(R,w,F(R,ne,w-ne)),w+=4}return I(R,w,0),w+=4,S(R,w,"IEND"),w+=4,I(R,w,F(R,w-4,4)),w+=4,R.buffer}function f(x,y,T){for(let M=0;M<x.frames.length;M++){const O=x.frames[M];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,y,T)}}function l(x,y,T,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],w=O[4],B=O[5];let P=6,U=8,q=255;for(var N=0;N<x.length;N++){const ye=new Uint8Array(x[N]);for(var D=ye.length,$=0;$<D;$+=4)q&=ye[$+3]}const R=q!=255,H=(function(fe,ie,ge,we,me,_e){const Ce=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Se=0,le=0,xe=ie,Xe=ge,Mt=we?1:0;if(pe!=0){const lc=_e||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<lc;Zt++){var Be=new Uint8Array(fe[pe-1-Zt]);const cc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=cc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Se=ot,le=st,xe=Pt-ot+1,Xe=Jt-st+1)}Be=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),Te=new Uint8Array(xe*Xe*4),e(Be,ie,ge,Te,xe,Xe,-Se,-le,0),Mt=e(J,ie,ge,Te,xe,Xe,-Se,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Se,y:le,width:xe,height:Xe}):e(J,ie,ge,Te,xe,Xe,-Se,-le,0)}else Te=J.slice(0);Ce.push({rect:{x:Se,y:le,width:xe,height:Xe},img:Te,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const J=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),xe={x:Se,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Se,height:Math.max(J.y+J.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,Ce,pe-1,xe,me),c(fe,ie,ge,Ce,pe,xe,me)}let xt=0;if(fe.length!=1)for(var W=0;W<Ce.length;W++){var Y;xt+=(Y=Ce[W]).rect.width*Y.rect.height}return Ce})(x,y,T,F,I,z),G={},K=[],V=[];if(M!=0){const ye=[];for($=0;$<H.length;$++)ye.push(H[$].img.buffer);const fe=(function(me){let _e=0;for(var Ce=0;Ce<me.length;Ce++)_e+=me[Ce].byteLength;const pe=new Uint8Array(_e);let Te=0;for(Ce=0;Ce<me.length;Ce++){const Be=new Uint8Array(me[Ce]),xt=Be.length;for(let W=0;W<xt;W+=4){let Y=Be[W],J=Be[W+1],ce=Be[W+2];const Se=Be[W+3];Se==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Se}Te+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const we=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,ge,we);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=we}}else for(N=0;N<H.length;N++){var Z=H[N];const ye=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=ye.length,ne=new Uint8Array(D),V.push(ne),$=0;$<D;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])ne[$]=ne[$-1];else if($>re&&fe==ye[$-re])ne[$]=ne[$-re];else{let ie=G[fe];if(ie==null&&(G[fe]=ie=K.length,K.push(fe),K.length>=300))break;ne[$]=ie}}}const ue=K.length;for(ue<=256&&w==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&w==0){ie=Math.ceil(U*re/8);var be=new Uint8Array(ie*ye);const we=V[N];for(let me=0;me<ye;me++){$=me*ie;const _e=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[_e+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[_e+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[_e+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[_e+de]<<7-1*(7&de)}fe=be,P=3,ge=1}else if(R==0&&H.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,P=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:P,depth:U,plte:K,frames:H}}function c(x,y,T,M,O,F,I){const z=Uint8Array,S=Uint32Array,w=new z(x[O-1]),B=new S(x[O-1]),P=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let N=y,D=T,$=-1,R=-1;for(let G=0;G<F.height;G++)for(let K=0;K<F.width;K++){const V=F.x+K,ne=F.y+G,Z=ne*y+V,re=q[Z];re==0||M[O-1].dispose==0&&B[Z]==re&&(P==null||P[4*Z+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<D&&(D=ne),ne>R&&(R=ne))}$==-1&&(N=D=$=R=0),I&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:R-D+1};const H=M[O];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(w,y,T,H.img,F.width,F.height,-F.x,-F.y,0),d(U,y,T,H.img,F)):e(U,y,T,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,T,M,O){e(x,y,T,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,T,M,O,F,I){const z=[];let S,w=[0,1,2,3,4];F!=-1?w=[F]:(y*M>5e5||T==1)&&(w=[0]),I&&(S={level:0});const B=jh;for(var P=0;P<w.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,T,w[P]);z.push(B.deflate(O,S))}let U,q=1e9;for(P=0;P<z.length;P++)z[P].length<q&&(U=P,q=z[P].length);return z[U]}function g(x,y,T,M,O,F){const I=T*M;let z=I+T;if(x[z]=F,z++,F==0)if(M<500)for(var S=0;S<M;S++)x[z+S]=y[I+S];else x.set(new Uint8Array(y.buffer,I,M),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[I+S];for(S=O;S<M;S++)x[z+S]=y[I+S]-y[I+S-O]+256&255}else if(T==0){for(S=0;S<O;S++)x[z+S]=y[I+S];if(F==2)for(S=O;S<M;S++)x[z+S]=y[I+S];if(F==3)for(S=O;S<M;S++)x[z+S]=y[I+S]-(y[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<M;S++)x[z+S]=y[I+S]-n(y[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<M;S++)x[z+S]=y[I+S]+256-y[I+S-M]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-(y[I+S-M]>>1)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-(y[I+S-M]+y[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-n(0,y[I+S-M],0)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-n(y[I+S-O],y[I+S-M],y[I+S-O-M])&255}}}function v(x,y){const T=new Uint8Array(x),M=T.slice(0),O=new Uint32Array(M.buffer),F=C(M,y),I=F[0],z=F[1],S=T.length,w=new Uint8Array(S>>2);let B;if(T.length<2e7)for(var P=0;P<S;P+=4)B=b(I,U=T[P]*(1/255),q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255)),w[P>>2]=B.ind,O[P>>2]=B.est.rgba;else for(P=0;P<S;P+=4){var U=T[P]*.00392156862745098,q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255);for(B=I;B.left;)B=_(B.est,U,q,N,D)<=0?B.left:B.right;w[P>>2]=B.ind,O[P>>2]=B.est.rgba}return{abuf:M.buffer,inds:w,plte:z}}function C(x,y,T){T==null&&(T=1e-4);const M=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<T)break;const w=F[S],B=A(x,M,w.i0,w.i1,w.est.e,w.est.eMq255);if(w.i0>=B||w.i1<=B){w.est.L=0;continue}const P={i0:w.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};P.bst=L(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:B,i1:w.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:w.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=w.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=w.bst.m[I]-P.bst.m[I];U.est=k(U.bst),w.left=P,w.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function b(x,y,T,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,D){const $=U-P[0],R=q-P[1],H=N-P[2],G=D-P[3];return $*$+R*R+H*H+G*G})(x.est.q,y,T,M,O),x;const F=_(x.est,y,T,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,T,M,O);if(S.tdst<=F*F)return S;const w=b(z,y,T,M,O);return w.tdst<S.tdst?w:S}function _(x,y,T,M,O){const{e:F}=x;return F[0]*y+F[1]*T+F[2]*M+F[3]*O-x.eMq}function A(x,y,T,M,O,F){for(M-=4;T<M;){for(;E(x,T,O)<=F;)T+=4;for(;E(x,M,O)>F;)M-=4;if(T>=M)break;const I=y[T>>2];y[T>>2]=y[M>>2],y[M>>2]=I,T+=4,M-=4}for(;E(x,T,O)>F;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function L(x,y,T){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=T-y>>2;for(let I=y;I<T;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),w=x[I+2]*(1/255),B=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=w,O[3]+=B,M[0]+=z*z,M[1]+=z*S,M[2]+=z*w,M[3]+=z*B,M[5]+=S*S,M[6]+=S*w,M[7]+=S*B,M[10]+=w*w,M[11]+=w*B,M[15]+=B*B}return M[4]=M[1],M[8]=M[2],M[9]=M[6],M[12]=M[3],M[13]=M[7],M[14]=M[11],{R:M,m:O,N:F}}function k(x){const{R:y}=x,{m:T}=x,{N:M}=x,O=T[0],F=T[1],I=T[2],z=T[3],S=M==0?0:1/M,w=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*I*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*I*S,y[7]-F*z*S,y[8]-I*O*S,y[9]-I*F*S,y[10]-I*I*S,y[11]-I*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*I*S,y[15]-z*z*S],B=w,P=j;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(B,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[O*S,F*S,I*S,z*S];return{Cov:w,q:D,e:U,L:q,eMq255:P.dot(P.sml(255,D),U),eMq:P.dot(U,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,T,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,T,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,T,M,F,I)},Le.encodeLL=function(y,T,M,O,F,I,z,S){const w={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},B=(O+F)*I,P=B*T;for(let U=0;U<y.length;U++)w.frames.push({rect:{x:0,y:0,width:T,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(P/8)});return f(w,0,!0),m(w,T,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Wi={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,_=0,A=0,E=0;function L(x){c.setUint16(A,x,!0),A+=2}function k(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),k(f),j(4),k(122),k(108),k(n),k(-o>>>0),L(1),L(32),k(3),k(m),k(2835),k(2835),j(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;_<o&&b>0;){for(C=122+_*i,h=0;h<r;)b--,g=a[E++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;_++}E<a.length?(b=d,setTimeout(x,Wi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ie={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Th={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const _o=typeof window<"u",Gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Rh=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vi=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,o(f)}))}function Ki(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function Yi(e,t){const n=St(),o=Th[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function rr(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function Xi(e,t){const{width:n,height:o}=Yi(e.width,e.height),[r,s]=rr(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Xi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return o(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return r=d,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return o(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,o,r=1){return new Promise((function(s,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=Le.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=o,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:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=o,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),Ao(c,n,o).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ge(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,o,r,s;return $t.cachedResult!==void 0?e($t.cachedResult):Ao("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Wn(n).then((function(i){try{return o=i[1],Gn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Ge(o),Wn(r).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.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 Qi(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Zi(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=rr(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function Ji(e,t){const{width:n}=e,{height:o}=e,[r,s]=rr(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),Ge(e),r}function Ss(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,l,c,d,h,g,v,C,b,_,A,E,L,k,j,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function T(M){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(M,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(M){try{return[,m]=M,y(),f=Zi(m,t),y(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return Qi(e).then((function(S){try{return I=S,z.call(this)}catch(w){return F(w)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:Ji(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Gn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(A>i||A>b)){let B,P;return B=x?.95*j.width:j.width,P=x?.95*j.height:j.height,[L,k]=rr(B,P),k.drawImage(j,0,0,B,P),d*=h==="image/png"?.85:.95,Gn(L,h,e.name,e.lastModified,d).then((function(U){try{return E=U,Ge(j),j=L,A=E.size,T(Math.min(99,Math.floor((_-A)/(_-i)*100))),S}catch(q){return r(q)}}),r)}return[1]},w=function(){return Ge(j),Ge(L),Ge(f),Ge(c),Ge(m),T(100),o(E)};if(g=I,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return T(100),o(g);var z;return b=e.size,_=g.size,A=_,j=c,x=!t.alwaysKeepResolution&&v,(z=(function(B){for(;B;){if(B.then)return void B.then(z,r);try{if(B.pop){if(B.length)return B.pop()?w.call(this):B;B=S}else B=B.call(this)}catch(P){return r(P)}}}).bind(this))(S)}}catch(S){return r(S)}}).bind(this),r)}catch(I){return r(I)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(O){return r(O)}}).bind(this),r)}))}const Nh=`
|
|
207
|
+
*/const yd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",yd),ga=p.createContext(void 0),xa="theme";function Yo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(xa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Qo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function wd(){const e=p.useContext(ga);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Cd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Xo()||t),[r,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(xa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Zo(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Zo(e[r],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Sd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function kd(e){return typeof e=="object"&&e!==null&&"then"in e}function va(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Sd&&"_payload"in e&&kd(e._payload)}function ba(e){const t=_d(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(jd);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 u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ed=ba("Slot");function _d(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(va(r)&&typeof Pn=="function"&&(r=Pn(r._payload)),p.isValidElement(r)){const a=Rd(r),i=Td(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ad=Symbol("radix.slottable");function jd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ad}function Td(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Nd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return es(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return r[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Id=Nd("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 Rt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?Ed:"button";return u.jsx(s,{"data-slot":"button",className:ee(Id({variant:t,size:n,className:e})),...r})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Md(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function nt(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,C=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function l(c,d){var v;const h=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,Pd(r,...t)]}function Pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Od=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Dd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${o} 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,o])}const f=p.useCallback(l=>{var c;if(i){const d=Ld(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Dd({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Od(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function Ld(e){return typeof e=="function"}function Ht(e){const t=Fd(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(Ud);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 u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Fd(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=Bd(r),i=zd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ya=Symbol("radix.slottable");function $d(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ya,t}function Ud(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ya}function zd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=Hd.reduce((e,t)=>{const n=Ht(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function wa(e,t){e&&Gs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,o]=nt(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,_=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(r,{scope:C,itemMap:A,collectionRef:_,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:_}=v,A=s(i,b),E=ke(C,A.collectionRef);return u.jsx(m,{ref:E,children:_})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:_,...A}=v,E=it.useRef(null),L=ke(C,E),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(E,{ref:E,...A}),()=>void k.itemMap.delete(E))),u.jsx(d,{[c]:"",ref:L,children:_})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const A=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((k,j)=>A.indexOf(k.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Wd=p.createContext(void 0);function Sa(e){const t=p.useContext(Wd);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function Gd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Vd="DismissableLayer",Or="dismissableLayer.update",Kd="dismissableLayer.pointerDownOutside",qd="dismissableLayer.focusOutside",ts,ka=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ka),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),_=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=b,L=Qd(j=>{const x=j.target,y=[...f.branches].some(T=>T.contains(x));!E||y||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),k=Zd(j=>{const x=j.target;[...f.branches].some(T=>T.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return Gd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Vd;var Yd="DismissableLayerBranch",Xd=p.forwardRef((e,t)=>{const n=p.useContext(ka),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:r})});Xd.displayName=Yd;function Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){Ea(Kd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Zd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&Ea(qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?wa(r,s):r.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){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 pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Jd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(r),l=Je(s),c=p.useRef(null),d=ke(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(A){if(h.paused||!i)return;const E=A.target;i.contains(E)?c.current=E:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const E=A.relatedTarget;E!==null&&(i.contains(E)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&<(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(b);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),_.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(ef(sf(_a(i)),{select:!0}),document.activeElement===v&<(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const _=v.currentTarget,[A,E]=tf(_);A&&E?!v.shiftKey&&b===E?(v.preventDefault(),n&<(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&<(E,{select:!0})):b===_&&v.preventDefault()}},[n,o,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Jd;function ef(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(lt(o,{select:t}),document.activeElement!==n)return}function tf(e){const t=_a(e),n=ss(t,e),o=ss(t.reverse(),e);return[n,o]}function _a(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ss(e,t){for(const n of e)if(!nf(n,{upTo:t}))return n}function nf(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 rf(e){return e instanceof HTMLInputElement&&"select"in e}function lt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rf(e)&&t&&e.select()}}var as=of();function of(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function sf(e){return e.filter(t=>t.tagName!=="A")}var af=Zr[" useId ".trim().toString()]||(()=>{}),lf=0;function Re(e){const[t,n]=p.useState(af());return Ze(()=>{n(o=>o??String(lf++))},[e]),e||(t?`radix-${t}`:"")}const cf=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),uf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Me(e,dt(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function tt(e){return e.split("-")[0]}function qt(e){return e.split("-")[1]}function so(e){return e==="x"?"y":"x"}function ao(e){return e==="y"?"height":"width"}function Ve(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ve(e))}function df(e,t,n){n===void 0&&(n=!1);const o=qt(e),r=io(e),s=ao(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function ff(e){const t=Dn(e);return[Lr(e),t,Lr(t)]}function Lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ls=["left","right"],cs=["right","left"],mf=["top","bottom"],pf=["bottom","top"];function hf(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?mf:pf;default:return[]}}function gf(e,t,n,o){const r=qt(e);let s=hf(tt(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return uf[t]+e.slice(t.length)}function xf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aa(e){return typeof e!="number"?xf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function us(e,t,n){let{reference:o,floating:r}=e;const s=Ve(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=o.x+o.width/2-r.width/2,c=o.y+o.height/2-r.height/2,d=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:c};break;case"left":h={x:o.x-r.width,y:c};break;default:h={x:o.x,y:o.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function vf(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=Aa(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),_=c==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:A,strategy:m}):_);return{top:(b.top-L.top+g.top)/E.y,bottom:(L.bottom-b.bottom+g.bottom)/E.y,left:(b.left-L.left+g.left)/E.x,right:(L.right-b.right+g.right)/E.x}}const bf=50,yf=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=us(f,o,m),d=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:_}=C,{x:A,y:E,data:L,reset:k}=await _({x:l,y:c,initialPlacement:o,placement:d,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=E??c,g[b]={...g[b],...L},k&&h<bf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:r,middlewareData:g}},wf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=Aa(l),d={x:n,y:o},h=io(r),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",_=C?"bottom":"right",A=C?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=k?k[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(k)))&&(j=i.floating[A]||s.floating[g]);const x=E/2-L/2,y=j/2-v[g]/2-1,T=dt(c[b],y),M=dt(c[_],y),O=T,F=j-v[g]-M,I=j/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(r)!=null&&I!==z&&s.reference[g]/2-(I<O?T:M)-v[g]/2<0,w=S?I<O?I-O:I-F:0;return{[h]:d[h]+w,data:{[h]:z,centerOffset:I-z-w,...S&&{alignmentOffset:w}},reset:S}}}),Cf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(r),_=Ve(i),A=tt(i)===i,E=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:ff(i)),k=g!=="none";!d&&k&&L.push(...gf(i,v,g,E));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(l&&y.push(x[b]),c){const I=df(r,a,E);y.push(x[I[0]],x[I[1]])}if(T=[...T,{placement:r,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=j[I];if(z&&(!(c==="alignment"?_!==Ve(z):!1)||T.every(B=>Ve(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:z}};let S=(O=T.filter(w=>w.overflows[0]<=0).sort((w,B)=>w.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const w=(F=T.filter(B=>{if(k){const P=Ve(B.placement);return P===_||P==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((B,P)=>B[1]-P[1])[0])==null?void 0:F[0];w&&(S=w);break}case"initialPlacement":S=i;break}if(r!==S)return{reset:{placement:S}}}return{}}}};function ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fs(e){return cf.some(t=>e[t]>=0)}const Sf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=et(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},ja=new Set(["left","top"]);async function kf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=ja.has(a)?-1:1,l=s&&m?-1:1,c=et(t,e);let{mainAxis:d,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:d*f}:{x:d*f,y:h*l}}const Ef=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,m=await kf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+m.x,y:s+m.y,data:{...m,placement:a}}}}},_f=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:_,y:A}=b;return{x:_,y:A}}},...f}=et(e,t),l={x:n,y:o},c=await s.detectOverflow(t,f),d=Ve(tt(r)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",_=h==="y"?"bottom":"right",A=g+c[b],E=g-c[_];g=Dr(A,g,E)}if(i){const b=d==="y"?"top":"left",_=d==="y"?"bottom":"right",A=v+c[b],E=v-c[_];v=Dr(A,v,E)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[d]:i}}}}}},Af=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:o},c=Ve(r),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",E=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<E?h=E:h>L&&(h=L)}if(f){var b,_;const A=d==="y"?"width":"height",E=ja.has(tt(r)),L=s.reference[c]-s.floating[A]+(E&&((b=a.offset)==null?void 0:b[c])||0)+(E?0:C.crossAxis),k=s.reference[c]+s.reference[A]+(E?0:((_=a.offset)==null?void 0:_[c])||0)-(E?C.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[d]:h,[c]:g}}}},jf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(r),d=qt(r),h=Ve(r)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const _=v-l.top-l.bottom,A=g-l.left-l.right,E=dt(v-l[C],_),L=dt(g-l[b],A),k=!t.middlewareData.shift;let j=E,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),k&&!d){const T=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(T!==0||M!==0?T+M:Me(l.left,l.right)):j=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return Ta(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ye(e){var t;return(t=(Ta(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ta(e){return Yn()?e instanceof Node||e instanceof Pe(e).Node:!1}function $e(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Tf(e){return/^(table|td|th)$/.test(Yt(e))}function Xn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Rf=/transform|translate|scale|rotate|perspective|filter/,Nf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!co()&&(wt(t.backdropFilter)||wt(t.filter))||Rf.test(t.willChange||"")||Nf.test(t.contain||"")}function If(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(lo(t))return t;if(Xn(t))return null;t=ft(t)}return null}function co(){return gr==null&&(gr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gr}function Wt(e){return/^(html|body|#document)$/.test(Yt(e))}function Ue(e){return Pe(e).getComputedStyle(e)}function Qn(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Ye(e);return ms(t)?t.host:t}function Ra(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ra(t)}function on(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ra(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Pe(r);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(r)?r:[],i&&n?on(i):[])}else return t.concat(r,on(r,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){const t=Ue(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=rt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=On(n)!==s||On(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function uo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Na(t);let a=(s?On(n.width):n.width)/o,i=(s?On(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Mf=Ke(0);function Ia(e){const t=Pe(e);return!co()||!t.visualViewport?Mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function _t(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(o?$e(o)&&(a=Ut(o)):a=Ut(e));const i=Pf(s,n,o)?Ia(s):Ke(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(s){const d=Pe(s),h=o&&$e(o)?Pe(o):o;let g=d,v=Fr(g);for(;v&&o&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),_=Ue(v),A=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,E=b.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=E,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:_t(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Zn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Of(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=Ye(o),i=t?Xn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(o);if((c||!c&&!s)&&((Yt(o)!=="body"||mn(a))&&(m=Qn(o)),c)){const h=_t(o);f=Ut(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const d=a&&!c&&!s?Ma(a,m):Ke(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Df(e){return Array.from(e.getClientRects())}function Lf(e){const t=Ye(e),n=Qn(e),o=e.ownerDocument.body,r=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return Ue(o).direction==="rtl"&&(a+=Me(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const ps=25;function Ff(e,t){const n=Pe(e),o=Ye(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const l=co();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Zn(o);if(f<=0){const l=o.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function $f(e,t){const n=_t(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let o;if(t==="viewport")o=Ff(e,n);else if(t==="document")o=Lf(Ye(e));else if($e(t))o=$f(t,n);else{const r=Ia(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ln(o)}function Pa(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||Pa(n,t)}function Uf(e,t){const n=t.get(e);if(n)return n;let o=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),r=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=lo(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||mn(a)&&!m&&Pa(e,a))?o=o.filter(l=>l!==a):r=i,a=ft(a)}return t.set(e,o),o}function zf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Uf(t,this._c):[].concat(n),o],i=hs(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],r);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Bf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Hf(e,t,n){const o=rt(t),r=Ye(t),s=n==="fixed",a=_t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Zn(r)}if(o||!o&&!s)if((Yt(t)!=="body"||mn(r))&&(i=Qn(t)),o){const h=_t(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const l=r&&!o&&!s?Ma(r,i):Ke(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function xr(e){return Ue(e).position==="static"}function gs(e,t){if(!rt(e)||Ue(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ye(e)===n&&(n=n.ownerDocument.body),n}function Oa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let r=ft(e);for(;r&&!Wt(r);){if($e(r)&&!xr(r))return r;r=ft(r)}return n}let o=gs(e,t);for(;o&&Tf(o)&&xr(o);)o=gs(o,t);return o&&Wt(o)&&xr(o)&&!lo(o)?n:o||If(e)||n}const Wf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,o=await n(e.floating);return{reference:Hf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Gf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Ye,getClippingRect:zf,getOffsetParent:Oa,getElementRects:Wf,getClientRects:Df,getDimensions:Bf,getScale:Ut,isElement:$e,isRTL:Gf};function Da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kf(e,t){let n=null,o;const r=Ye(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(r.clientWidth-(l+d)),C=Sn(r.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let E=!0;function L(k){const j=k[0].intersectionRatio;if(j!==m){if(!E)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Da(f,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function qf(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,f=uo(e),l=r||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Kf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[_]=b;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?_t(e):null;m&&C();function C(){const b=_t(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Yf=Ef,Xf=_f,Qf=Cf,Zf=jf,Jf=Sf,xs=wf,em=Af,tm=(e,t,n)=>{const o=new Map,r={platform:Vf,...n},s={...r.platform,_c:o};return yf(e,t,{...r,platform:s})};var nm=typeof document<"u",rm=function(){},jn=nm?p.useLayoutEffect:rm;function Fn(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,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Fn(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function La(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=La(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,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}),[d,h]=p.useState(o);Fn(d,o)||h(o);const[g,v]=p.useState(null),[C,b]=p.useState(null),_=p.useCallback(B=>{B!==k.current&&(k.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),E=s||g,L=a||C,k=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,T=vr(m),M=vr(r),O=vr(f),F=p.useCallback(()=>{if(!k.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};M.current&&(B.platform=M.current),tm(k.current,j.current,B).then(P=>{const U={...P,isPositioned:O.current!==!1};I.current&&!Fn(x.current,U)&&(x.current=U,Gs.flushSync(()=>{c(U)}))})},[d,t,n,M,O]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const I=p.useRef(!1);jn(()=>(I.current=!0,()=>{I.current=!1}),[]),jn(()=>{if(E&&(k.current=E),L&&(j.current=L),E&&L){if(T.current)return T.current(E,L,F);F()}},[E,L,F,T,y]);const z=p.useMemo(()=>({reference:k,floating:j,setReference:_,setFloating:A}),[_,A]),S=p.useMemo(()=>({reference:E,floating:L}),[E,L]),w=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!S.floating)return B;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...B,transform:"translate("+P+"px, "+U+"px)",...La(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:w}),[l,F,z,S,w])}const sm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?xs({element:o.current,padding:r}).fn(n):{}:o?xs({element:o,padding:r}).fn(n):{}}}},am=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=Xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},lm=(e,t)=>({fn:em(e).fn,options:[e,t]}),cm=(e,t)=>{const n=Qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},um=(e,t)=>{const n=Zf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=Jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},fm=(e,t)=>{const n=sm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mm="Arrow",Fa=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fa.displayName=mm;var pm=Fa;function hm(e){const[t,n]=p.useState(void 0);return Ze(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const m=s.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 o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var fo="Popper",[$a,Xt]=nt(fo),[gm,Ua]=$a(fo),za=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return u.jsx(gm,{scope:t,anchor:o,onAnchorChange:r,children:n})};za.displayName=fo;var Ba="PopperAnchor",Ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Ua(Ba,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:u.jsx(he.div,{...r,ref:i})});Ha.displayName=Ba;var mo="PopperContent",[xm,vm]=$a(mo),Wa=p.forwardRef((e,t)=>{var G,K,V,ne,Z,re;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=Ua(mo,n),[b,_]=p.useState(null),A=ke(t,ue=>_(ue)),[E,L]=p.useState(null),k=hm(E),j=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=o+(s!=="center"?"-"+s:""),T=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],O=M.length>0,F={padding:T,boundary:M.filter(ym),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:w,middlewareData:B}=om({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>qf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[am({mainAxis:r+x,alignmentAxis:a}),m&&im({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?lm():void 0,...F}),m&&cm({...F}),um({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${ye}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),E&&fm({element:E,padding:i}),wm({arrowWidth:j,arrowHeight:x}),d&&dm({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Je(g);Ze(()=>{w&&(q==null||q())},[w,q]);const N=(G=B.arrow)==null?void 0:G.x,D=(K=B.arrow)==null?void 0:K.y,$=((V=B.arrow)==null?void 0:V.centerOffset)!==0,[R,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:w?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(xm,{scope:n,placedSide:P,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:w?void 0:"none"}})})})});Wa.displayName=mo;var Ga="PopperArrow",bm={top:"bottom",right:"left",bottom:"top",left:"right"},Va=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=vm(Ga,o),a=bm[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(pm,{...r,ref:n,style:{...r.style,display:"block"}})})});Va.displayName=Ga;function ym(e){return e!==null}var wm=e=>({name:"transformOrigin",options:e,fn(t){var C,b,_;const{placement:n,rects:o,middlewareData:r}=t,a=((C=r.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Ka(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=r.arrow)==null?void 0:b.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Ka(e){const[t,n="center"]=e.split("-");return[t,n]}var po=za,Jn=Ha,ho=Wa,go=Va,Cm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(he.div,{...o,ref:t}),a):null});pn.displayName=Cm;function Sm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Oe=e=>{const{present:t,children:n}=e,o=km(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=ke(o.ref,Em(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Oe.displayName="Presence";function km(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Sm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(o.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=o.current,l=r.current;if(l!==e){const d=s.current,h=kn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=kn(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Em(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",_m={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,Am]=Ca(hn),[jm,Ya]=nt(hn,[Am]),[Tm,Rm]=jm(hn),Xa=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Nm,{...e,ref:t})})}));Xa.displayName=hn;var Nm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=ke(t,d),g=Sa(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,_]=p.useState(!1),A=Je(f),E=qa(n),L=p.useRef(!1),[k,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(Tm,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:u.jsx(he.div,{tabIndex:b||k===0?-1:0,"data-orientation":o,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const T=new CustomEvent(br,_m);if(x.currentTarget.dispatchEvent(T),!T.defaultPrevented){const M=E().filter(S=>S.focusable),O=M.find(S=>S.active),F=M.find(S=>S.id===v),z=[O,F,...M].filter(Boolean).map(S=>S.ref.current);Ja(z,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>_(!1))})})}),Qa="RovingFocusGroupItem",Za=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Rm(Qa,n),c=l.currentTabStopId===f,d=qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{o?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Pm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const E=A.indexOf(C.currentTarget);A=l.loop?Om(A,E+1):A.slice(E+1)}setTimeout(()=>Ja(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Za.displayName=Qa;var Im={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Pm(e,t,n){const o=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Im[o]}function Ja(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Om(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Dm=Xa,Lm=Za,Fm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,En=new WeakMap,_n={},yr=0,ei=function(e){return e&&(e.host||ei(e.parentNode))},$m=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ei(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Um=function(e,t,n,o){var r=$m(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(o),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&En.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(En.has(c)||c.removeAttribute(o),En.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,En=new WeakMap,_n={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Fm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Um(o,r,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],zm=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],Bm=[...zm,...ti],Hm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Wm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,Gm,Vm]=Ca(gn),[Nt,ni]=nt(gn,[Vm,Xt,Ya]),er=Xt(),ri=Ya(),[Km,It]=Nt(gn),[qm,xn]=Nt(gn),oi=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Sa(r);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})}},[]),u.jsx(po,{...i,children:u.jsx(Km,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(qm,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:o})})})};oi.displayName=gn;var Ym="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(Jn,{...r,...o,ref:t})});vo.displayName=Ym;var bo="MenuPortal",[Xm,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=It(bo,t);return u.jsx(Xm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};ai.displayName=bo;var De="MenuContent",[Qm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Zm,{...r,ref:t}):u.jsx(Jm,{...r,ref:t})})})})}),Zm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu);return u.jsx(wo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ep=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),_=er(n),A=ri(n),E=Gm(n),[L,k]=p.useState(null),j=p.useRef(null),x=ke(t,j,C.onContentChange),y=p.useRef(0),T=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Jr:p.Fragment,S=g?{as:ep,allowPinchZoom:!0}:void 0,w=P=>{var G,K;const U=T.current+P,q=E().filter(V=>!V.disabled),N=document.activeElement,D=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=fp($,U,D),H=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){T.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&pp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(Qm,{scope:n,searchRef:T,onItemEnter:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),onItemLeave:p.useCallback(P=>{var U;B(P)||((U=j.current)==null||U.focus(),k(null))},[B]),onTriggerLeave:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:r,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=j.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Dm,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Si(C.open),"data-radix-menu-content":"",dir:b.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,D=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&D&&w(P.key));const $=j.current;if(P.target!==$||!Bm.includes(P.key))return;P.preventDefault();const H=E().filter(G=>!G.disabled).map(G=>G.ref.current);ti.includes(P.key)&&H.reverse(),up(H)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),T.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=I.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>I.current?"right":"left";F.current=N,I.current=P.clientX}}))})})})})})})});ii.displayName=De;var tp="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"group",...o,ref:t})});Co.displayName=tp;var np="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{...o,ref:t})});li.displayName=np;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>o==null?void 0:o(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...r,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var ci=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=yo($n,n),i=ri(n),m=p.useRef(null),f=ke(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:o,textValue:r??d,children:u.jsx(Lm,{asChild:!0,...i,focusable:!o,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),rp="MenuCheckboxItem",ui=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...r,ref:t,"data-state":ko(n),onSelect:te(r.onSelect,()=>o==null?void 0:o(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ui.displayName=rp;var di="MenuRadioGroup",[op,sp]=Nt(di,{value:void 0,onValueChange:()=>{}}),fi=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Je(o);return u.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...r,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=sp(mi,e.__scopeMenu),s=n===r.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":ko(s),onSelect:te(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,ap]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=ap(So,n);return u.jsx(Oe,{present:o||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...r,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ip="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});xi.displayName=ip;var lp="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(go,{...r,...o,ref:t})});vi.displayName=lp;var cp="MenuSub",[Nb,bi]=Nt(cp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),o=xn(rn,e.__scopeMenu),r=bi(rn,e.__scopeMenu),s=yo(rn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,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]),u.jsx(vo,{asChild:!0,...f,children:u.jsx(ci,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Si(n.open),...e,ref:qe(t,r.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,_=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:_,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:_,y:d.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Hm[o.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});yi.displayName=rn;var wi="MenuSubContent",Ci=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=bi(wi,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...r,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:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Wm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ci.displayName=wi;function Si(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function ko(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function up(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dp(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function fp(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dp(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function mp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=oi,gp=vo,xp=ai,vp=ii,bp=Co,yp=li,wp=tr,Cp=ui,Sp=fi,kp=pi,Ep=gi,_p=xi,Ap=vi,jp=yi,Tp=Ci,nr="DropdownMenu",[Rp]=nt(nr,[ni]),Ne=ni(),[Np,ki]=Rp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:r,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Np,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(hp,{...m,open:l,onOpenChange:c,dir:o,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",Ai=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ki(_i,n),a=Ne(n);return u.jsx(gp,{asChild:!0,...a,children:u.jsx(he.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ai.displayName=_i;var Ip="DropdownMenuPortal",ji=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ne(t);return u.jsx(xp,{...o,...n})};ji.displayName=Ip;var Ti="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ki(Ti,n),s=Ne(n),a=p.useRef(!1);return u.jsx(vp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.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)"}})});Ri.displayName=Ti;var Mp="DropdownMenuGroup",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(bp,{...r,...o,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(yp,{...r,...o,ref:t})});Ni.displayName=Op;var Dp="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(wp,{...r,...o,ref:t})});Ii.displayName=Dp;var Lp="DropdownMenuCheckboxItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Cp,{...r,...o,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuRadioGroup",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Sp,{...r,...o,ref:t})});Up.displayName=$p;var zp="DropdownMenuRadioItem",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(kp,{...r,...o,ref:t})});Bp.displayName=zp;var Hp="DropdownMenuItemIndicator",Wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ep,{...r,...o,ref:t})});Wp.displayName=Hp;var Gp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(_p,{...r,...o,ref:t})});Mi.displayName=Gp;var Vp="DropdownMenuArrow",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ap,{...r,...o,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSubTrigger",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(jp,{...r,...o,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuSubContent",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Tp,{...r,...o,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)"}})});Qp.displayName=Xp;var Zp=Ei,Jp=Ai,eh=ji,th=Ri,nh=Ni,rh=Ii,oh=Mi;function Pi({...e}){return u.jsx(Zp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Jp,{"data-slot":"dropdown-menu-trigger",...e})}function Di({className:e,sideOffset:t=4,...n}){return u.jsx(eh,{children:u.jsx(th,{"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 Tn({className:e,inset:t,variant:n="default",...o}){return u.jsx(rh,{"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),...o})}function sh({className:e,inset:t,...n}){return u.jsx(nh,{"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 ys({className:e,...t}){return u.jsx(oh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const ah=[{value:"light",label:"Light",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(da,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Hu,{className:"h-4 w-4"})}];function ih(){const{theme:e,setTheme:t,resolvedTheme:n}=wd();return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(da,{className:"h-4 w-4"}):u.jsx(pa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Di,{align:"end",children:ah.map(o=>u.jsxs(Tn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,u.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const ws={"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.description":"输入你的用户名和密码以继续。","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":"删除会话失败","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":"连接失败","user.settings.language":"语言","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":"分阶段发布检查项与进度条","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},lh={"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.description":"Enter your username and password to continue.","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","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","user.settings.language":"Language","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","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Li="rcs_locale";function ch(){try{const t=localStorage.getItem(Li);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=ch();const zr=new Set;function Ib(e){Eo=e;try{localStorage.setItem(Li,e)}catch{}zr.forEach(t=>t())}function uh(e){return zr.add(e),()=>{zr.delete(e)}}function Fi(){return p.useSyncExternalStore(uh,()=>Eo)}function Fe(e){return Eo==="en"?lh[e]??ws[e]??e:ws[e]??e}const dh="";let zn=null;function fh(e){zn=e}function Mb(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function mh(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,o,r){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function ve(e,t,n,o){const r={"Content-Type":"application/json"};zn&&(r.Authorization=`Bearer ${zn}`);const s=`${dh}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!o&&await mh())return ve(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(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 wr(c,l,i.status)}return m}function Pb(){return ve("GET","/web/sessions/all")}function Ob(e){return ve("GET",`/web/sessions/${e}`)}function Db(e){return ve("GET",`/web/sessions/${e}/history`)}function Lb(){return ve("GET","/web/environments")}function Fb(e,t){return ve("POST",`/web/sessions/${e}/events`,t)}function $b(e,t){return ve("POST",`/web/sessions/${e}/control`,t)}function Ub(e){return ve("POST",`/web/sessions/${e}/interrupt`)}function zb(e){return ve("DELETE",`/web/sessions/${e}`)}function Bb(e){return ve("POST",`/web/sessions/${e}/clear`)}function Hb(e,t){return ve("PATCH",`/web/sessions/${e}`,{title:t})}function Wb(e){return ve("POST","/web/sessions",e)}function Gb(e){return ve("GET",`/web/sessions/s/${e}`)}function Vb(e){return ve("GET",`/web/sessions/${e}/shares`)}function Kb(e,t){return ve("POST",`/web/sessions/${e}/shares`,t)}function qb(e,t){return ve("DELETE",`/web/sessions/${e}/shares/${t}`)}function Yb(e,t){return ve("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Xb(e,t){return ve("DELETE",`/web/teams/${e}/environments/${t}`)}function Qb(e){return ve("POST","/web/environments/claim",{claim_token:e})}function Zb(e){const t=e!=null&&e.session_id?`?session_id=${encodeURIComponent(e.session_id)}`:"";return ve("GET",`/web/artifacts${t}`)}function Jb(e){return ve("GET",`/web/artifacts/${e}`)}function ey(e){return ve("POST","/web/artifacts",e)}function ty(e){return ve("DELETE",`/web/artifacts/${e}`)}const Hr="rcs_active_team";function ph(){try{return localStorage.getItem(Hr)}catch{return null}}let $i=ph();const Wr=new Set;function hh(){for(const e of Wr)e()}function gh(e){return Wr.add(e),()=>Wr.delete(e)}function xh(){return $i}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}$i=e,hh()}function vh(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(gh,xh,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await ve("GET","/web/teams");t(f)}catch{t([])}finally{o(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===r)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await ve("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function bh({className:e}){Fi();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=vh();return r||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.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:s=>{const a=s.target.value;o(a||null)},children:[u.jsx("option",{value:"",children:Fe("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Kt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Ui=p.createContext(null);function zi(){const e=p.useContext(Ui);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Dt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function yh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function wh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=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 Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const _=await Dt();n(_),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const _=await Dt();n(_),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>yh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:o,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function Ch({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.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:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(ha,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Di,{align:"end",className:"w-48",children:[u.jsx(sh,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(sd,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(bd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:o,children:[u.jsx($u,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function Sh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o,onNavigateArtifacts:r}){return Fi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(bh,{}),e?u.jsxs(u.Fragment,{children:[u.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:[u.jsx(wu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.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:Fe("nav.dashboard"),children:[u.jsx(Du,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),r&&u.jsxs("button",{type:"button",onClick:r,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:Fe("artifacts.title"),children:[u.jsx(Ru,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(ih,{}),u.jsx(Ch,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ny({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return u.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function kh(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Bi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(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 o of this.onConnectionStateChange)o(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,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.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 o=new WebSocket(this.settings.proxyUrl,this.settings.token?[kh(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,l,c,d,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 v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));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),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(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 b of this.onModelStateChanged)b(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 b of this.onModelStateChanged)b(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 C=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",C,"payload:",t.payload),C==="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(C==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(C==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(C==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const b of this.onConfigOptionsChanged)b(this._configOptions)}(d=this.onSessionUpdate)==null||d.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 b of this.onModelChanged)b(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 o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.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>=ct.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"))},ct.PONG_TIMEOUT_MS)},ct.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 o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,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 o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}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,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Bi),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 o of this.onModelStateChanged)o(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)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function Eh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function Hi(e,t){return new Promise((function(n,o){let r;return _h(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const _h=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Bn={},Ah={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,o={};Ah.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=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 v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),_=a(l,m+2),A=a(l,m+4);m+=6;var E=i(l,m+=8);m+=4,m+=b+_+A,o._readLocal(l,E,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var l=o.bin.readUshort,c=o.bin.readUint;c(r,s),l(r,s+=4),l(r,s+=2);var d=l(r,s+=2);c(r,s+=2),c(r,s+=4),s+=4;var h=l(r,s+=8),g=l(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(r.buffer,s);if(d==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);o.inflateRaw(C,b),a[v]=b}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.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)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var l in r){var c=!o._noNeed(l)&&!s,d=r[l],h=o.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?o.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*o.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=o._writeHeader(g,v,l,b,0)}var _=0,A=v;for(var l in f)b=f[l],C.push(v),v=o._writeHeader(g,v,l,b,1,C[_++]);var E=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,E),i(g,v+=4,A),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var l=o.bin.writeUint,c=o.bin.writeUshort,d=i.file;return l(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(r,s,20),c(r,s+=2,0),c(r,s+=2,i.cpr?8:0),l(r,s+=2,0),l(r,s+=4,i.crc),l(r,s+=4,d.length),l(r,s+=4,i.usize),c(r,s+=4,o.bin.sizeUTF8(a)),c(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(d,s),s+=d.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)r[s+m]=l,m++;else if((4294965248&l)==0)r[s+m]=192|l>>6,r[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[s+m]=224|l>>12,r[s+m+1]=128|l>>6&63,r[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[s+m]=240|l>>18,r[s+m+1]=128|l>>12&63,r[s+m+2]=128|l>>6&63,r[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.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}},o.F={},o.F.deflateRaw=function(r,s,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=o.F.U,l=o.F._goodIndex;o.F._hash;var c=o.F._putsE,d=0,h=a<<3,g=0,v=r.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=o.F._copyExact(r,d,M,s,h+8),d+=M;return h>>>3}var C=f.lits,b=f.strt,_=f.prev,A=0,E=0,L=0,k=0,j=0,x=0;for(v>2&&(b[x=o.F._hash(r,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=o.F._hash(r,d+1);var y=d+1&32767;_[y]=b[x],b[x]=y}if(g<=d){(A>14e3||E>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(d==v-1||g==v?1:0,C,A,k,r,L,d-L,s,h),A=E=k=0,L=d);var T=0;d<v-2&&(T=o.F._bestMatch(r,d,_,j,Math.min(m[2],v-d),m[3]));var M=T>>>16,O=65535&T;if(T!=0){O=65535&T;var F=l(M=T>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],C[A]=M<<23|d-g,C[A+1]=O<<16|F<<8|I,A+=2,g=d+M}else f.lhst[r[d]]++;E++}}for(L==d&&r.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(1,C,A,k,r,L,d-L,s,h),A=0,E=0,A=E=k=0,L=d);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=o.F._hash(r,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||r[s+h]==r[s+h-d]){var C=o.F._howLong(r,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,_=0;_<C-2;_++){var A=s-d+_+32768&32767,E=A-a[A]+32768&32767;E>b&&(b=E,c=A)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,l,c,d){var h,g,v,C,b,_,A,E,L,k=o.F.U,j=o.F._putsF,x=o.F._putsE;k.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],b=h[3],_=h[4],A=h[5],E=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),T=i+o.F.contSize(k.fltree,k.lhst)+o.F.contSize(k.fdtree,k.dhst),M=i+o.F.contSize(k.ltree,k.lhst)+o.F.contSize(k.dtree,k.dhst);M+=14+3*A+o.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<T&&y<M?0:T<M?1:2;if(j(c,d,r),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=o.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){o.F.makeCodes(k.ltree,g),o.F.revCodes(k.ltree,g),o.F.makeCodes(k.dtree,v),o.F.revCodes(k.dtree,v),o.F.makeCodes(k.itree,C),o.F.revCodes(k.itree,C),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,_-1),x(c,d+=5,A-4),d+=4;for(var S=0;S<A;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*A,d=o.F._codeTiny(E,k.itree,c,d),d=o.F._codeTiny(L,k.itree,c,d)}for(var w=f,B=0;B<a;B+=2){for(var P=s[B],U=P>>>23,q=w+(8388607&P);w<q;)d=o.F._writeLit(m[w++],I,c,d);if(U!=0){var N=s[B+1],D=N>>16,$=N>>8&255,R=255&N;x(c,d=o.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],j(c,d=o.F._writeLit(R,z,c,d),D-k.df0[R]),d+=k.dxb[R],w+=U}}d=o.F._writeLit(256,I,c,d)}return d},o.F._copyExact=function(r,s,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(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],l=o.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var d=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],l=r[m+1];i=o.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,l,c),i+=c)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&r[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&r[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(E,L){return E.f-L.f}));var g=i[0],v=i[1],C=0,b=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=o.F.setDepth(i[b-1],0);for(A>a&&(o.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<r.length&&r[i].d>s;i++){var l=r[i].d;r[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=r[i].d)<s?(r[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,b,_=0,A=0,E=0,L=0,k=0,j=0,x=0,y=0,T=0;_==0;)if(_=m(r,T,1),A=m(r,T+1,2),T+=3,A!=0){if(v&&(s=o.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){E=f(r,T,5)+257,L=f(r,T+5,5)+1,k=f(r,T+10,4)+4,T+=14;for(var M=0;M<38;M+=2)g.itree[M]=0,g.itree[M+1]=0;var O=1;for(M=0;M<k;M++){var F=f(r,T+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}T+=3*k,c(g.itree,O),d(g.itree,O,g.imap),C=g.lmap,b=g.dmap,T=l(g.imap,(1<<O)-1,E+L,r,T,g.ttree);var I=i._copyOut(g.ttree,0,E,g.ltree);j=(1<<I)-1;var z=i._copyOut(g.ttree,E,L,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,C),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=C[h(r,T)&j];T+=15&S;var w=S>>>4;if(!(w>>>8))s[y++]=w;else{if(w==256)break;var B=y+w-254;if(w>264){var P=g.ldef[w-257];B=y+(P>>>3)+f(r,T,7&P),T+=7&P}var U=b[h(r,T)&x];T+=15&U;var q=U>>>4,N=g.ddef[q],D=(N>>>4)+m(r,T,15&N);for(T+=15&N,v&&(s=o.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&T)!=0&&(T+=8-(7&T));var $=4+(T>>>3),R=r[$-4]|r[$-3]<<8;v&&(s=o.F._check(s,y+R)),s.set(new a(r.buffer,r.byteOffset+$,R),y),T=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var l=o.F._bitsE,c=o.F._get17,d=0;d<a;){var h=r[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,C=0;g==16?(C=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(C=3+l(i,m,3),m+=3):g==18&&(C=11+l(i,m,7),m+=7);for(var b=d+C;d<b;)f[d]=v,d++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+s];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},o.F.makeCodes=function(r,s){for(var a,i,m,f,l=o.F.U,c=r.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[r[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var l=f>>1,c=r[f+1],d=l<<4|c,h=s-c,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.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 r=o.F.U,s=0;s<32768;s++){var a=s;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,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var jh=Eh({__proto__:null,default:Bn},[Bn]);const Le=(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,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),_=new Uint32Array(b.buffer),{ctype:A}=h,{depth:E}=h,L=e.readUshort;if(A==6){const P=g<<2;if(E==8)for(var k=0;k<P;k+=4)b[k]=l[k],b[k+1]=l[k+1],b[k+2]=l[k+2],b[k+3]=l[k+3];if(E==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(E==8)for(k=0;k<g;k++){var j=3*k;_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(E==16)for(k=0;k<g;k++)j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=P[0];const U=P[1],q=P[2];if(E==8)for(k=0;k<g;k++){var y=k<<2;j=3*k,_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==U&&l[j+2]==q&&(b[y+3]=0)}if(E==16)for(k=0;k<g;k++)y=k<<2,j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==U&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(E==1)for(var T=0;T<d;T++){var M=T*C,O=T*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(I=l[M+(k>>3)]>>7-((7&k)<<0)&1);b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}if(E==2)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>2)]>>6-((3&k)<<1)&3),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==4)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>1)]>>4-((1&k)<<2)&15),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==8)for(k=0;k<g;k++){var I;y=k<<2,F=3*(I=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}else if(A==4){if(E==8)for(k=0;k<g;k++){y=k<<2;var z=l[S=k<<1];b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+1]}if(E==16)for(k=0;k<g;k++){var S;y=k<<2,z=l[S=k<<2],b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,T=0;T<d;T++){const P=T*C,U=T*c;if(E==1)for(var w=0;w<c;w++){var B=(z=255*(l[P+(w>>>3)]>>>7-(7&w)&1))==255*x?0:255;_[U+w]=B<<24|z<<16|z<<8|z}else if(E==2)for(w=0;w<c;w++)B=(z=85*(l[P+(w>>>2)]>>>6-((3&w)<<1)&3))==85*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==4)for(w=0;w<c;w++)B=(z=17*(l[P+(w>>>1)]>>>4-((1&w)<<2)&15))==17*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==8)for(w=0;w<c;w++)B=(z=l[P+w])==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==16)for(w=0;w<c;w++)z=l[P+(w<<1)],B=L(l,P+(w<<1))==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,C):o(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(_,A){const E=A.width,L=A.height,k=s(A),j=k>>3,x=Math.ceil(E*k/8),y=new Uint8Array(L*x);let T=0;const M=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const w=F[z],B=I[z];let P=0,U=0,q=M[z];for(;q<L;)q+=w,U++;let N=O[z];for(;N<E;)N+=B,P++;const D=Math.ceil(P*k/8);a(_,A,T,P,U);let $=0,R=M[z];for(;R<L;){let H=O[z],G=T+$*D<<3;for(;H<E;){var S;if(k==1&&(S=(S=_[G>>3])>>7-(7&G)&1,y[R*x+(H>>3)]|=S<<7-((7&H)<<0)),k==2&&(S=(S=_[G>>3])>>6-(7&G)&3,y[R*x+(H>>2)]|=S<<6-((3&H)<<1)),k==4&&(S=(S=_[G>>3])>>4-(7&G)&15,y[R*x+(H>>1)]|=S<<4-((1&H)<<2)),k>=8){const K=R*x+H*j;for(let V=0;V<j;V++)y[K+V]=_[(G>>3)+V]}G+=k,H+=B}$++,R+=w}P*U!=0&&(T+=U*(1+D)),z+=1}return y})(c,l)),c}function o(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,_=0,A=0,E=0,L=0,k=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,T=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,w=d==null;for(w&&(d=new h(c.length>>>2<<5));C==0;)if(C=T(c,x,1),b=T(c,x+1,2),x+=3,b!=0){if(w&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=S.J,v=S.h,L=511,k=31),b==2){_=M(c,x,5)+257,A=M(c,x+5,5)+1,E=M(c,x+10,4)+4,x+=14;let P=1;for(var B=0;B<38;B+=2)S.Q[B]=0,S.Q[B+1]=0;for(B=0;B<E;B++){const N=M(c,x+3*B,3);S.Q[1+(S.X[B]<<1)]=N,N>P&&(P=N)}x+=3*E,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,_+A,c,x,S.v);const U=y.V(S.v,0,_,S.C);L=(1<<U)-1;const q=y.V(S.v,_,A,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,v)}for(;;){const P=g[z(c,x)&L];x+=15&P;const U=P>>>4;if(!(U>>>8))d[j++]=U;else{if(U==256)break;{let q=j+U-254;if(U>264){const H=S.q[U-257];q=j+(H>>>3)+M(c,x,7&H),x+=7&H}const N=v[z(c,x)&k];x+=15&N;const D=N>>>4,$=S.c[D],R=($>>>4)+T(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;w&&(d=l.H.W(d,j+U)),d.set(new h(c.buffer,c.byteOffset+P,U),j),x=P+U<<3,j+=U}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,_=l.H.Z;let A=0;for(;A<h;){const E=c[_(g,v)&d];v+=15&E;const L=E>>>4;if(L<=15)C[A]=L,A++;else{let k=0,j=0;L==16?(j=3+b(g,v,2),v+=2,k=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=k,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const _=c[C+d];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,_;const A=h.j;for(var E=0;E<=d;E++)A[E]=0;for(E=1;E<g;E+=2)A[c[E]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)_=c[b+1],_!=0&&(c[b]=L[_],L[_]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,_=c[C+1],A=b<<4|_,E=d-_;let L=c[C]<<E;const k=L+(1<<E);for(;L!=k;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=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 d(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 d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;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[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];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 s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,_;v=Math.ceil(v/8);let A=l[d],E=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(E=v;E<C;E++)l[E+1]=l[E+1]+(l[E+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,_=b+L+1,A=l[_-1],E=0,A==0)for(;E<C;E++)l[b+E]=l[_+E];else if(A==1){for(;E<v;E++)l[b+E]=l[_+E];for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-v]}else if(A==2)for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-C];else if(A==3){for(;E<v;E++)l[b+E]=l[_+E]+(l[b+E-C]>>>1);for(;E<C;E++)l[b+E]=l[_+E]+(l[b+E-C]+l[b+E-v]>>>1)}else{for(;E<v;E++)l[b+E]=l[_+E]+i(0,l[b+E-C],0);for(;E<C;E++)l[b+E]=l[_+E]+i(l[b+E-v],l[b+E-C],l[b+E-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,_){const A=Math.min(c,g),E=Math.min(d,v);let L=0,k=0;for(let z=0;z<E;z++)for(let S=0;S<A;S++)if(C>=0&&b>=0?(L=z*c+S<<2,k=(b+z)*g+C+S<<2):(L=(-b+z)*c-C+S<<2,k=z*g+S<<2),_==0)h[k]=l[L],h[k+1]=l[L+1],h[k+2]=l[L+2],h[k+3]=l[L+3];else if(_==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,T=l[L+2]*j,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const w=1-j,B=j+M*w,P=B==0?0:1/B;h[k+3]=255*B,h[k+0]=(x+O*w)*P,h[k+1]=(y+F*w)*P,h[k+2]=(T+I*w)*P}else if(_==2)j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=y,h[k+2]=T,h[k+3]=j);else if(_==3){if(j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I)continue;if(j<220&&M>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},_=new Uint8Array(d.length);let A,E=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=k[j])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,b);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const w=d.slice(x+2,h+z);let B=null;try{B=o(w)}catch{B=r(w)}b.tabs[S]=B}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(j=0;j<z;j++)_[E+j]=d[h+j];E+=z}else if(S=="acTL")b.tabs[S]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(S=="fcTL"){L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height),L=0);const w={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const P={rect:w,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(j=0;j<z-4;j++)A[L+j]=d[h+j+4];L+=z-4}else if(S=="pHYs")b.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(b.tabs[S]=[],j=0;j<8;j++)b.tabs[S].push(g.readUint(d,h+4*j));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),T=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=o(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][T]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),T=g.readASCII(d,x,y-x);const w=d[x=y+1];var F;d[x+1],x+=2,y=g.nextZero(d,x),g.readASCII(d,x,y-x),x=y+1,y=g.nextZero(d,x),g.readUTF8(d,x,y-x),M=z-((x=y+1)-h),w==0?F=g.readUTF8(d,x,M):(O=o(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][T]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const w=b.tabs.PLTE.length/3;for(b.tabs[S]=[],j=0;j<w;j++)b.tabs[S].push(v(d,h+2*j))}else if(S=="tRNS")b.ctype==3?b.tabs[S]=g.readBytes(d,h,z):b.ctype==0?b.tabs[S]=v(d,h):b.ctype==2&&(b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(S=="gAMA")b.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")b.tabs[S]=d[h];else if(S=="bKGD")b.ctype==0||b.ctype==4?b.tabs[S]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),_=new Uint8Array(v);for(let E=0;E<c.frames.length;E++){const L=c.frames[E],k=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,T=t(L.data,x,y,c);if(E!=0)for(var A=0;A<v;A++)_[A]=C[A];if(L.blend==0?f(T,x,y,C,d,h,k,j,0):L.blend==1&&f(T,x,y,C,d,h,k,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,k,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=_[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let M=0;M<8;M++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,M){for(let O=0;O<M;O++)x=o.table[255&(x^y[T+O])]^x>>>8;return x},crc:(x,y,T)=>4294967295^o.update(4294967295,x,y,T)};function r(x,y,T,M){y[T]+=x[0]*M>>4,y[T+1]+=x[1]*M>>4,y[T+2]+=x[2]*M>>4,y[T+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const T=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return T*T+M*M+O*O+F*F}function i(x,y,T,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var w=0;w<z;w++){const R=M[w];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(w=0;w<z;w++){let R=4294967295;for(var B=0,P=0;P<z;P++){var U=a(S[w],S[P]);P!=w&&U<R&&(R=U,B=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*T*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(w=0;w<D.length;w++)D[w]=255*((D[w]+.5)/16-.5);for(let R=0;R<T;R++)for(let H=0;H<y;H++){var $;w=4*(R*y+H),I!=2?$=[s(x[w]+N[w]),s(x[w+1]+N[w+1]),s(x[w+2]+N[w+2]),s(x[w+3]+N[w+3])]:(U=D[4*(3&R)+(3&H)],$=[s(x[w]+U),s(x[w+1]+U),s(x[w+2]+U),s(x[w+3]+U)]),B=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,B=P)}const K=S[B],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(H!=y-1&&r(V,N,w+4,7),R!=T-1&&(H!=0&&r(V,N,w+4*y-4,3),r(V,N,w+4*y,5),H!=y-1&&r(V,N,w+4*y+4,1))),F[w>>2]=B,q[w>>2]=M[B]}}function m(x,y,T,M,O){O==null&&(O={});const{crc:F}=o,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let w=8;const B=x.frames.length>1;let P,U=!1,q=33+(B?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(P=pako.deflate(O.iCCP),q+=21+P.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)R[D]=H[D];if(I(R,w,13),w+=4,S(R,w,"IHDR"),w+=4,I(R,w,y),w+=4,I(R,w,T),w+=4,R[w]=x.depth,w++,R[w]=x.ctype,w++,R[w]=0,w++,R[w]=0,w++,R[w]=0,w++,I(R,w,F(R,w-17,17)),w+=4,O.sRGB!=null&&(I(R,w,1),w+=4,S(R,w,"sRGB"),w+=4,R[w]=O.sRGB,w++,I(R,w,F(R,w-5,5)),w+=4),O.iCCP!=null){const V=13+P.length;I(R,w,V),w+=4,S(R,w,"iCCP"),w+=4,S(R,w,"ICC profile"),w+=11,w+=2,R.set(P,w),w+=P.length,I(R,w,F(R,w-(V+4),V+4)),w+=4}if(O.pHYs!=null&&(I(R,w,9),w+=4,S(R,w,"pHYs"),w+=4,I(R,w,O.pHYs[0]),w+=4,I(R,w,O.pHYs[1]),w+=4,R[w]=O.pHYs[2],w++,I(R,w,F(R,w-13,13)),w+=4),B&&(I(R,w,8),w+=4,S(R,w,"acTL"),w+=4,I(R,w,x.frames.length),w+=4,I(R,w,O.loop!=null?O.loop:0),w+=4,I(R,w,F(R,w-12,12)),w+=4),x.ctype==3){for(I(R,w,3*(N=x.plte.length)),w+=4,S(R,w,"PLTE"),w+=4,D=0;D<N;D++){const V=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[w+V+0]=Z,R[w+V+1]=re,R[w+V+2]=ue}if(w+=3*N,I(R,w,F(R,w-3*N-4,3*N+4)),w+=4,U){for(I(R,w,N),w+=4,S(R,w,"tRNS"),w+=4,D=0;D<N;D++)R[w+D]=x.plte[D]>>>24&255;w+=N,I(R,w,F(R,w-N-4,N+4)),w+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(I(R,w,26),w+=4,S(R,w,"fcTL"),w+=4,I(R,w,G++),w+=4,I(R,w,K.rect.width),w+=4,I(R,w,K.rect.height),w+=4,I(R,w,K.rect.x),w+=4,I(R,w,K.rect.y),w+=4,z(R,w,M[$]),w+=2,z(R,w,1e3),w+=2,R[w]=K.dispose,w++,R[w]=K.blend,w++,I(R,w,F(R,w-30,30)),w+=4);const V=K.cimg;I(R,w,(N=V.length)+($==0?0:4)),w+=4;const ne=w;S(R,w,$==0?"IDAT":"fdAT"),w+=4,$!=0&&(I(R,w,G++),w+=4),R.set(V,w),w+=N,I(R,w,F(R,ne,w-ne)),w+=4}return I(R,w,0),w+=4,S(R,w,"IEND"),w+=4,I(R,w,F(R,w-4,4)),w+=4,R.buffer}function f(x,y,T){for(let M=0;M<x.frames.length;M++){const O=x.frames[M];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,y,T)}}function l(x,y,T,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],w=O[4],B=O[5];let P=6,U=8,q=255;for(var N=0;N<x.length;N++){const ye=new Uint8Array(x[N]);for(var D=ye.length,$=0;$<D;$+=4)q&=ye[$+3]}const R=q!=255,H=(function(fe,ie,ge,we,me,_e){const Ce=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Se=0,le=0,xe=ie,Xe=ge,Mt=we?1:0;if(pe!=0){const lc=_e||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<lc;Zt++){var Be=new Uint8Array(fe[pe-1-Zt]);const cc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=cc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Se=ot,le=st,xe=Pt-ot+1,Xe=Jt-st+1)}Be=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),Te=new Uint8Array(xe*Xe*4),e(Be,ie,ge,Te,xe,Xe,-Se,-le,0),Mt=e(J,ie,ge,Te,xe,Xe,-Se,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Se,y:le,width:xe,height:Xe}):e(J,ie,ge,Te,xe,Xe,-Se,-le,0)}else Te=J.slice(0);Ce.push({rect:{x:Se,y:le,width:xe,height:Xe},img:Te,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const J=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),xe={x:Se,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Se,height:Math.max(J.y+J.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,Ce,pe-1,xe,me),c(fe,ie,ge,Ce,pe,xe,me)}let xt=0;if(fe.length!=1)for(var W=0;W<Ce.length;W++){var Y;xt+=(Y=Ce[W]).rect.width*Y.rect.height}return Ce})(x,y,T,F,I,z),G={},K=[],V=[];if(M!=0){const ye=[];for($=0;$<H.length;$++)ye.push(H[$].img.buffer);const fe=(function(me){let _e=0;for(var Ce=0;Ce<me.length;Ce++)_e+=me[Ce].byteLength;const pe=new Uint8Array(_e);let Te=0;for(Ce=0;Ce<me.length;Ce++){const Be=new Uint8Array(me[Ce]),xt=Be.length;for(let W=0;W<xt;W+=4){let Y=Be[W],J=Be[W+1],ce=Be[W+2];const Se=Be[W+3];Se==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Se}Te+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const we=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,ge,we);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=we}}else for(N=0;N<H.length;N++){var Z=H[N];const ye=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=ye.length,ne=new Uint8Array(D),V.push(ne),$=0;$<D;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])ne[$]=ne[$-1];else if($>re&&fe==ye[$-re])ne[$]=ne[$-re];else{let ie=G[fe];if(ie==null&&(G[fe]=ie=K.length,K.push(fe),K.length>=300))break;ne[$]=ie}}}const ue=K.length;for(ue<=256&&w==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&w==0){ie=Math.ceil(U*re/8);var be=new Uint8Array(ie*ye);const we=V[N];for(let me=0;me<ye;me++){$=me*ie;const _e=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[_e+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[_e+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[_e+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[_e+de]<<7-1*(7&de)}fe=be,P=3,ge=1}else if(R==0&&H.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,P=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:P,depth:U,plte:K,frames:H}}function c(x,y,T,M,O,F,I){const z=Uint8Array,S=Uint32Array,w=new z(x[O-1]),B=new S(x[O-1]),P=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let N=y,D=T,$=-1,R=-1;for(let G=0;G<F.height;G++)for(let K=0;K<F.width;K++){const V=F.x+K,ne=F.y+G,Z=ne*y+V,re=q[Z];re==0||M[O-1].dispose==0&&B[Z]==re&&(P==null||P[4*Z+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<D&&(D=ne),ne>R&&(R=ne))}$==-1&&(N=D=$=R=0),I&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:R-D+1};const H=M[O];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(w,y,T,H.img,F.width,F.height,-F.x,-F.y,0),d(U,y,T,H.img,F)):e(U,y,T,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,T,M,O){e(x,y,T,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,T,M,O,F,I){const z=[];let S,w=[0,1,2,3,4];F!=-1?w=[F]:(y*M>5e5||T==1)&&(w=[0]),I&&(S={level:0});const B=jh;for(var P=0;P<w.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,T,w[P]);z.push(B.deflate(O,S))}let U,q=1e9;for(P=0;P<z.length;P++)z[P].length<q&&(U=P,q=z[P].length);return z[U]}function g(x,y,T,M,O,F){const I=T*M;let z=I+T;if(x[z]=F,z++,F==0)if(M<500)for(var S=0;S<M;S++)x[z+S]=y[I+S];else x.set(new Uint8Array(y.buffer,I,M),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[I+S];for(S=O;S<M;S++)x[z+S]=y[I+S]-y[I+S-O]+256&255}else if(T==0){for(S=0;S<O;S++)x[z+S]=y[I+S];if(F==2)for(S=O;S<M;S++)x[z+S]=y[I+S];if(F==3)for(S=O;S<M;S++)x[z+S]=y[I+S]-(y[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<M;S++)x[z+S]=y[I+S]-n(y[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<M;S++)x[z+S]=y[I+S]+256-y[I+S-M]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-(y[I+S-M]>>1)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-(y[I+S-M]+y[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-n(0,y[I+S-M],0)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-n(y[I+S-O],y[I+S-M],y[I+S-O-M])&255}}}function v(x,y){const T=new Uint8Array(x),M=T.slice(0),O=new Uint32Array(M.buffer),F=C(M,y),I=F[0],z=F[1],S=T.length,w=new Uint8Array(S>>2);let B;if(T.length<2e7)for(var P=0;P<S;P+=4)B=b(I,U=T[P]*(1/255),q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255)),w[P>>2]=B.ind,O[P>>2]=B.est.rgba;else for(P=0;P<S;P+=4){var U=T[P]*.00392156862745098,q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255);for(B=I;B.left;)B=_(B.est,U,q,N,D)<=0?B.left:B.right;w[P>>2]=B.ind,O[P>>2]=B.est.rgba}return{abuf:M.buffer,inds:w,plte:z}}function C(x,y,T){T==null&&(T=1e-4);const M=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<T)break;const w=F[S],B=A(x,M,w.i0,w.i1,w.est.e,w.est.eMq255);if(w.i0>=B||w.i1<=B){w.est.L=0;continue}const P={i0:w.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};P.bst=L(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:B,i1:w.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:w.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=w.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=w.bst.m[I]-P.bst.m[I];U.est=k(U.bst),w.left=P,w.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function b(x,y,T,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,D){const $=U-P[0],R=q-P[1],H=N-P[2],G=D-P[3];return $*$+R*R+H*H+G*G})(x.est.q,y,T,M,O),x;const F=_(x.est,y,T,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,T,M,O);if(S.tdst<=F*F)return S;const w=b(z,y,T,M,O);return w.tdst<S.tdst?w:S}function _(x,y,T,M,O){const{e:F}=x;return F[0]*y+F[1]*T+F[2]*M+F[3]*O-x.eMq}function A(x,y,T,M,O,F){for(M-=4;T<M;){for(;E(x,T,O)<=F;)T+=4;for(;E(x,M,O)>F;)M-=4;if(T>=M)break;const I=y[T>>2];y[T>>2]=y[M>>2],y[M>>2]=I,T+=4,M-=4}for(;E(x,T,O)>F;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function L(x,y,T){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=T-y>>2;for(let I=y;I<T;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),w=x[I+2]*(1/255),B=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=w,O[3]+=B,M[0]+=z*z,M[1]+=z*S,M[2]+=z*w,M[3]+=z*B,M[5]+=S*S,M[6]+=S*w,M[7]+=S*B,M[10]+=w*w,M[11]+=w*B,M[15]+=B*B}return M[4]=M[1],M[8]=M[2],M[9]=M[6],M[12]=M[3],M[13]=M[7],M[14]=M[11],{R:M,m:O,N:F}}function k(x){const{R:y}=x,{m:T}=x,{N:M}=x,O=T[0],F=T[1],I=T[2],z=T[3],S=M==0?0:1/M,w=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*I*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*I*S,y[7]-F*z*S,y[8]-I*O*S,y[9]-I*F*S,y[10]-I*I*S,y[11]-I*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*I*S,y[15]-z*z*S],B=w,P=j;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(B,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[O*S,F*S,I*S,z*S];return{Cov:w,q:D,e:U,L:q,eMq255:P.dot(P.sml(255,D),U),eMq:P.dot(U,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,T,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,T,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,T,M,F,I)},Le.encodeLL=function(y,T,M,O,F,I,z,S){const w={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},B=(O+F)*I,P=B*T;for(let U=0;U<y.length;U++)w.frames.push({rect:{x:0,y:0,width:T,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(P/8)});return f(w,0,!0),m(w,T,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Wi={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,_=0,A=0,E=0;function L(x){c.setUint16(A,x,!0),A+=2}function k(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),k(f),j(4),k(122),k(108),k(n),k(-o>>>0),L(1),L(32),k(3),k(m),k(2835),k(2835),j(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;_<o&&b>0;){for(C=122+_*i,h=0;h<r;)b--,g=a[E++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;_++}E<a.length?(b=d,setTimeout(x,Wi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ie={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Th={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const _o=typeof window<"u",Gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Rh=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vi=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,o(f)}))}function Ki(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function Yi(e,t){const n=St(),o=Th[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function rr(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function Xi(e,t){const{width:n,height:o}=Yi(e.width,e.height),[r,s]=rr(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Xi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return o(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return r=d,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return o(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,o,r=1){return new Promise((function(s,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=Le.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=o,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:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=o,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),Ao(c,n,o).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ge(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,o,r,s;return $t.cachedResult!==void 0?e($t.cachedResult):Ao("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Wn(n).then((function(i){try{return o=i[1],Gn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Ge(o),Wn(r).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.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 Qi(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Zi(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=rr(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function Ji(e,t){const{width:n}=e,{height:o}=e,[r,s]=rr(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),Ge(e),r}function Ss(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,l,c,d,h,g,v,C,b,_,A,E,L,k,j,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function T(M){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(M,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(M){try{return[,m]=M,y(),f=Zi(m,t),y(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return Qi(e).then((function(S){try{return I=S,z.call(this)}catch(w){return F(w)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:Ji(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Gn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(A>i||A>b)){let B,P;return B=x?.95*j.width:j.width,P=x?.95*j.height:j.height,[L,k]=rr(B,P),k.drawImage(j,0,0,B,P),d*=h==="image/png"?.85:.95,Gn(L,h,e.name,e.lastModified,d).then((function(U){try{return E=U,Ge(j),j=L,A=E.size,T(Math.min(99,Math.floor((_-A)/(_-i)*100))),S}catch(q){return r(q)}}),r)}return[1]},w=function(){return Ge(j),Ge(L),Ge(f),Ge(c),Ge(m),T(100),o(E)};if(g=I,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return T(100),o(g);var z;return b=e.size,_=g.size,A=_,j=c,x=!t.alwaysKeepResolution&&v,(z=(function(B){for(;B;){if(B.then)return void B.then(z,r);try{if(B.pop){if(B.length)return B.pop()?w.call(this):B;B=S}else B=B.call(this)}catch(P){return r(P)}}}).bind(this))(S)}}catch(S){return r(S)}}).bind(this),r)}catch(I){return r(I)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(O){return r(O)}}).bind(this),r)}))}const Nh=`
|
|
208
208
|
let scriptImported = false
|
|
209
209
|
self.addEventListener('message', async (e) => {
|
|
210
210
|
const { file, id, imageCompressionLibUrl, options } = e.data
|
|
@@ -223,7 +223,7 @@ self.addEventListener('message', async (e) => {
|
|
|
223
223
|
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
224
224
|
}
|
|
225
225
|
})
|
|
226
|
-
`;let Cr;function Ih(e,t){return new Promise(((n,o)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Nh));const r=new Worker(Cr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function je(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Rh))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,r).then((function(h){try{return s=h,d.call(this)}catch(g){return o(g)}}).bind(this),o);var l=(function(){try{return d.call(this)}catch(h){return o(h)}}).bind(this),c=function(h){try{return Ss(e,r).then((function(g){try{return s=g,l()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ih(e,r).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=Hi(e,s))}catch{}return n(s)}}))}je.getDataUrlFromFile=Ki,je.getFilefromDataUrl=Ao,je.loadImage=qi,je.drawImageInCanvas=Xi,je.drawFileInCanvas=Wn,je.canvasToFile=Gn,je.getExifOrientation=Qi,je.handleMaxWidthOrHeight=Zi,je.followExifOrientation=Ji,je.cleanupCanvasMemory=Ge,je.isAutoOrientationInBrowser=$t,je.approximateBelowMaximumCanvasSizeOfBrowser=Yi,je.copyExifWithoutOrientation=Hi,je.getBrowserName=St,je.version="2.0.2";var Mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Mh.reduce((e,t)=>{const n=ba(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ph=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"}),Oh="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Ph,...e.style}}));el.displayName=Oh;var Dh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Lh=700,Vr="tooltip.open",[Fh,jo]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Lh,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Fh,{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,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:s})};nl.displayName=tl;var ln="Tooltip",[$h,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,_]=ut({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx($h,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():E()},[m.isOpenDelayedRef,k,E]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:E,onClose:L,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:te(e.onBlur,r.onClose),onClick:te(e.onClick,r.onClose)})})});ol.displayName=Kr;var To="TooltipPortal",[Uh,zh]=or(To,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=vn(To,t);return u.jsx(Uh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};sl.displayName=To;var Gt="TooltipContent",al=p.forwardRef((e,t)=>{const n=zh(Gt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:o||a.open,children:a.disableHoverableContent?u.jsx(il,{side:r,...s,ref:t}):u.jsx(Bh,{side:r,...s,ref:t})})}),Bh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),o=jo(Gt,e.__scopeTooltip),r=p.useRef(null),s=ke(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=o,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},_=Vh(b,C.getBoundingClientRect()),A=Kh(b,_),E=qh(v.getBoundingClientRect()),L=Xh([...A,...E]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!Yh(b,a);_?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Hh,Wh]=or(ln,{isInside:!1}),Gh=$d("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Gt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Vr,l),()=>document.removeEventListener(Vr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"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:[u.jsx(Gh,{children:o}),u.jsx(Hh,{scope:n,isInside:!0,children:u.jsx(Dh,{id:m.contentId,role:"tooltip",children:r||o})})]})})});al.displayName=Gt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=sr(n);return Wh(ll,n).isInside?null:u.jsx(go,{...r,...o,ref:t})});cl.displayName=ll;function Vh(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Kh(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function qh(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Yh(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function Xh(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),Qh(t)}function Qh(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}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 Zh=nl,Jh=rl,eg=ol,tg=sl,ng=al,rg=cl;function og({delayDuration:e=0,...t}){return u.jsx(Zh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function sg({...e}){return u.jsx(og,{children:u.jsx(Jh,{"data-slot":"tooltip",...e})})}function ag({...e}){return u.jsx(eg,{"data-slot":"tooltip-trigger",...e})}function ig({className:e,sideOffset:t=0,children:n,...o}){return u.jsx(tg,{children:u.jsxs(ng,{"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),...o,children:[n,u.jsx(rg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const lg=p.lazy(()=>Ae(()=>import("./mermaid-VLURNSYL-CAb8MsJr.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Ro=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(lg,{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);Ro.displayName="MessageResponse";var ar="Collapsible",[cg]=nt(ar),[ug,No]=cg(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:o,defaultProp:r??!1,onChange:a,caller:ar});return u.jsx(ug,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});ul.displayName=ar;var dl="CollapsibleTrigger",fl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=No(dl,n);return u.jsx(he.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Mo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||r.open,children:({present:s})=>u.jsx(dg,{...o,ref:t,present:s})})});ml.displayName=Io;var dg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=No(Io,n),[i,m]=p.useState(o),f=p.useRef(null),l=ke(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Ze(()=>{const _=f.current;if(_){b.current=b.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const A=_.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(_.style.transitionDuration=b.current.transitionDuration,_.style.animationName=b.current.animationName),m(o)}},[a.open,o]),u.jsx(he.div,{"data-state":Mo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function Mo(e){return e?"open":"closed"}var fg=ul;function mg({...e}){return u.jsx(fg,{"data-slot":"collapsible",...e})}function pg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function hg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const gg=({children:e,as:t="p",className:n,duration:o=2})=>{const r=pc.create(t);return u.jsx(r,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},xg=p.memo(gg),pl=p.createContext(null),vg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bg=1e3,yg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:o,onChange:r}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/yg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!d){const _=setTimeout(()=>{f(!1),h(!0)},bg);return()=>clearTimeout(_)}},[t,m,o,f,d,C]);const b=_=>{f(_)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(mg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),wg=(e,t)=>e||t===0?u.jsx(xg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),gl=p.memo(({className:e,children:t,getThinkingMessage:n=wg,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=vg();return u.jsx(pg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??u.jsxs(u.Fragment,{children:[u.jsx(xu,{className:"size-4"}),n(r,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),xl=p.memo(({className:e,children:t,...n})=>u.jsx(hg,{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}));hl.displayName="Reasoning";gl.displayName="ReasoningTrigger";xl.displayName="ReasoningContent";const Sr=200;function Cg({entry:e}){const[t,n]=p.useState(!1),[o,r]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(kg,{image:i},m))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>u.jsx(Eg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${Sr}px]`),style:!t&&o?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&o&&u.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:u.jsxs("button",{type:"button",onClick:()=>n(!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:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function Sg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.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:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return u.jsxs(hl,{isStreaming:s,children:[u.jsx(gl,{}),u.jsx(xl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},o)})]})]})}function kg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.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:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Eg({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-4 w-4"});case"table":return u.jsx(ro,{className:"h-4 w-4"});case"directory":return u.jsx(no,{className:"h-4 w-4"});default:return u.jsx(Bt,{className:"h-4 w-4"})}})(),r=e.size!=null?_g(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.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:[o,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&u.jsx("span",{children:r}),r&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function _g(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ag(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function jg(e){switch(e){case"allow_once":case"allow_always":return u.jsx(un,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(dn,{className:"size-4"});default:return null}}function Tg({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ma,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Rt,{variant:Ag(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[jg(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Rg=1e6;function kr({filePath:e,oldString:t,newString:n,label:o}){const r=Ig(t,n),s=_s(r,"add"),a=_s(r,"remove"),i=r.length>ks?r.slice(0,ks):r,m=r.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),o&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:o})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Ng,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ng({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${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:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Es(e){return e.length===0?[]:e.split(`
|
|
226
|
+
`;let Cr;function Ih(e,t){return new Promise(((n,o)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Nh));const r=new Worker(Cr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function je(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Rh))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,r).then((function(h){try{return s=h,d.call(this)}catch(g){return o(g)}}).bind(this),o);var l=(function(){try{return d.call(this)}catch(h){return o(h)}}).bind(this),c=function(h){try{return Ss(e,r).then((function(g){try{return s=g,l()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ih(e,r).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=Hi(e,s))}catch{}return n(s)}}))}je.getDataUrlFromFile=Ki,je.getFilefromDataUrl=Ao,je.loadImage=qi,je.drawImageInCanvas=Xi,je.drawFileInCanvas=Wn,je.canvasToFile=Gn,je.getExifOrientation=Qi,je.handleMaxWidthOrHeight=Zi,je.followExifOrientation=Ji,je.cleanupCanvasMemory=Ge,je.isAutoOrientationInBrowser=$t,je.approximateBelowMaximumCanvasSizeOfBrowser=Yi,je.copyExifWithoutOrientation=Hi,je.getBrowserName=St,je.version="2.0.2";var Mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Mh.reduce((e,t)=>{const n=ba(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ph=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"}),Oh="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Ph,...e.style}}));el.displayName=Oh;var Dh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Lh=700,Vr="tooltip.open",[Fh,jo]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Lh,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Fh,{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,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:s})};nl.displayName=tl;var ln="Tooltip",[$h,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,_]=ut({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx($h,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():E()},[m.isOpenDelayedRef,k,E]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:E,onClose:L,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:te(e.onBlur,r.onClose),onClick:te(e.onClick,r.onClose)})})});ol.displayName=Kr;var To="TooltipPortal",[Uh,zh]=or(To,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=vn(To,t);return u.jsx(Uh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};sl.displayName=To;var Gt="TooltipContent",al=p.forwardRef((e,t)=>{const n=zh(Gt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:o||a.open,children:a.disableHoverableContent?u.jsx(il,{side:r,...s,ref:t}):u.jsx(Bh,{side:r,...s,ref:t})})}),Bh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),o=jo(Gt,e.__scopeTooltip),r=p.useRef(null),s=ke(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=o,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},_=Vh(b,C.getBoundingClientRect()),A=Kh(b,_),E=qh(v.getBoundingClientRect()),L=Xh([...A,...E]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!Yh(b,a);_?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Hh,Wh]=or(ln,{isInside:!1}),Gh=$d("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Gt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Vr,l),()=>document.removeEventListener(Vr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"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:[u.jsx(Gh,{children:o}),u.jsx(Hh,{scope:n,isInside:!0,children:u.jsx(Dh,{id:m.contentId,role:"tooltip",children:r||o})})]})})});al.displayName=Gt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=sr(n);return Wh(ll,n).isInside?null:u.jsx(go,{...r,...o,ref:t})});cl.displayName=ll;function Vh(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Kh(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function qh(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Yh(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function Xh(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),Qh(t)}function Qh(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}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 Zh=nl,Jh=rl,eg=ol,tg=sl,ng=al,rg=cl;function og({delayDuration:e=0,...t}){return u.jsx(Zh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function sg({...e}){return u.jsx(og,{children:u.jsx(Jh,{"data-slot":"tooltip",...e})})}function ag({...e}){return u.jsx(eg,{"data-slot":"tooltip-trigger",...e})}function ig({className:e,sideOffset:t=0,children:n,...o}){return u.jsx(tg,{children:u.jsxs(ng,{"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),...o,children:[n,u.jsx(rg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const lg=p.lazy(()=>Ae(()=>import("./mermaid-VLURNSYL-DLOgnkPH.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Ro=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(lg,{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);Ro.displayName="MessageResponse";var ar="Collapsible",[cg]=nt(ar),[ug,No]=cg(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:o,defaultProp:r??!1,onChange:a,caller:ar});return u.jsx(ug,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});ul.displayName=ar;var dl="CollapsibleTrigger",fl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=No(dl,n);return u.jsx(he.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Mo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||r.open,children:({present:s})=>u.jsx(dg,{...o,ref:t,present:s})})});ml.displayName=Io;var dg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=No(Io,n),[i,m]=p.useState(o),f=p.useRef(null),l=ke(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Ze(()=>{const _=f.current;if(_){b.current=b.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const A=_.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(_.style.transitionDuration=b.current.transitionDuration,_.style.animationName=b.current.animationName),m(o)}},[a.open,o]),u.jsx(he.div,{"data-state":Mo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function Mo(e){return e?"open":"closed"}var fg=ul;function mg({...e}){return u.jsx(fg,{"data-slot":"collapsible",...e})}function pg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function hg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const gg=({children:e,as:t="p",className:n,duration:o=2})=>{const r=pc.create(t);return u.jsx(r,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},xg=p.memo(gg),pl=p.createContext(null),vg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bg=1e3,yg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:o,onChange:r}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/yg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!d){const _=setTimeout(()=>{f(!1),h(!0)},bg);return()=>clearTimeout(_)}},[t,m,o,f,d,C]);const b=_=>{f(_)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(mg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),wg=(e,t)=>e||t===0?u.jsx(xg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),gl=p.memo(({className:e,children:t,getThinkingMessage:n=wg,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=vg();return u.jsx(pg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??u.jsxs(u.Fragment,{children:[u.jsx(xu,{className:"size-4"}),n(r,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),xl=p.memo(({className:e,children:t,...n})=>u.jsx(hg,{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}));hl.displayName="Reasoning";gl.displayName="ReasoningTrigger";xl.displayName="ReasoningContent";const Sr=200;function Cg({entry:e}){const[t,n]=p.useState(!1),[o,r]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(kg,{image:i},m))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>u.jsx(Eg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${Sr}px]`),style:!t&&o?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&o&&u.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:u.jsxs("button",{type:"button",onClick:()=>n(!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:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function Sg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.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:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return u.jsxs(hl,{isStreaming:s,children:[u.jsx(gl,{}),u.jsx(xl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},o)})]})]})}function kg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.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:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Eg({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-4 w-4"});case"table":return u.jsx(ro,{className:"h-4 w-4"});case"directory":return u.jsx(no,{className:"h-4 w-4"});default:return u.jsx(Bt,{className:"h-4 w-4"})}})(),r=e.size!=null?_g(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.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:[o,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&u.jsx("span",{children:r}),r&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function _g(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ag(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function jg(e){switch(e){case"allow_once":case"allow_always":return u.jsx(un,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(dn,{className:"size-4"});default:return null}}function Tg({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ma,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Rt,{variant:Ag(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[jg(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Rg=1e6;function kr({filePath:e,oldString:t,newString:n,label:o}){const r=Ig(t,n),s=_s(r,"add"),a=_s(r,"remove"),i=r.length>ks?r.slice(0,ks):r,m=r.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),o&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:o})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Ng,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ng({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${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:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Es(e){return e.length===0?[]:e.split(`
|
|
227
227
|
`)}function _s(e,t){let n=0;for(const o of e)o.type===t&&n++;return n}function Ig(e,t){const n=Es(e),o=Es(t);let r=0;for(;r<n.length&&r<o.length&&n[r]===o[r];)r++;let s=n.length,a=o.length;for(;s>r&&a>r&&n[s-1]===o[a-1];)s--,a--;const i=[];for(let m=0;m<r;m++)i.push({type:"context",text:n[m]});Mg(n.slice(r,s),o.slice(r,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Mg(e,t,n){const o=e.length,r=t.length;if(o===0&&r===0)return;if(o*r>Rg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=r+1,a=new Uint32Array((o+1)*s);for(let f=o-1;f>=0;f--)for(let l=r-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<o&&m<r;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<o;)n.push({type:"remove",text:e[i]}),i++;for(;m<r;)n.push({type:"add",text:t[m]}),m++}function vl({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(As,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=Bg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(As,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function As({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Nn(e);return u.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(Tg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Ug(e)??u.jsxs(u.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&u.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Et(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(In,{tool:e})]})})]})}const Pg=new Set(["FileEditTool","Edit","SedEdit"]),Og=new Set(["FileWriteTool","Write"]),Dg=new Set(["MultiEdit"]),Lg=new Set(["BashTool","Bash","PowerShellTool"]),Fg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],$g=["output","stdout","stderr","result"];function Ug(e){const t=Wg(e.title),n=e.rawInput??{};if(Pg.has(t)){const o=We(n,["old_string","oldString"]),r=We(n,["new_string","newString"]);return o===void 0||r===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:We(n,["file_path","filePath"])??t,oldString:o,newString:r}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Og.has(t)){const o=We(n,["file_path","filePath"]),r=We(n,["content"]);if(o===void 0||r===void 0)return null;const s=We(e.rawOutput??{},Fg);return u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:o,oldString:s??"",newString:r,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Dg.has(t)){const o=n.edits;if(Array.isArray(o)&&o.length>0){const r=We(n,["file_path","filePath"])??t,s=[];for(let a=0;a<o.length;a++){const i=o[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=We(m,["old_string","oldString"]),l=We(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(kr,{filePath:r,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(In,{tool:e})]})}return null}if(Lg.has(t)){const o=We(n,["command","cmd","script"]),r=Gg(e);return o===void 0&&r.length===0?null:u.jsx(zg,{command:o!==void 0?Et(o,500):void 0,output:r,isError:e.status==="error"})}return null}function zg({command:e,output:t,isError:n}){return u.jsx("div",{className:ee("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:u.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&&u.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&u.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Bg(e){const t=new Map;for(const o of e){const r=Hg(o.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[o,r]of t)n.push(r===1?o:`${r} 次${o}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Hg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Wg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function We(e,t){for(const n of t){const o=e[n];if(typeof o=="string")return o}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function bl(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 Gg(e){const t=bl(e);if(t.length>0)return Et(t.join(`
|
|
228
228
|
`),2e3);const n=e.rawOutput;if(n){for(const o of $g){const r=n[o];if(typeof r=="string"&&r.length>0)return Et(r,2e3)}if(Object.keys(n).length>0)return Et(JSON.stringify(n,null,2),2e3)}return""}function In({tool:e}){return u.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:Vg(e)})}function Vg(e){const t=bl(e);return t.length>0?Et(t.join(`
|
|
229
229
|
`),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Et(JSON.stringify(e.rawOutput,null,2),2e3):""}function Et(e,t){return e.length>t?e.slice(0,t)+"...":e}function Kg({entry:e}){const[t,n]=p.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.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:[u.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:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:ee("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,m)=>u.jsx(qg,{entry:i},m))})]})})}function qg({entry:e}){return u.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[u.jsx("span",{className:"flex-shrink-0 mt-0.5",children:u.jsx(Yg,{status:e.status})}),u.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}),u.jsx(Xg,{priority:e.priority})]})}function Yg({status:e}){switch(e){case"completed":return u.jsx(ku,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ua,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(_u,{className:"h-3.5 w-3.5 text-text-muted"})}}function Xg({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 dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return u.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 Qg({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
|
|
@@ -262,4 +262,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
262
262
|
${Z.textContent}`}else{const ue=Z.size!=null?` (${Xv(Z.size)})`:"";re=`📎 ${Z.name}${ue}
|
|
263
263
|
\`\`\`
|
|
264
264
|
${Z.textContent}
|
|
265
|
-
\`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:D,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};o(Z=>[...Z,V]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[r,a,e,j,x,y,L,m,T,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(dx,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(Ex,{requests:P,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.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:[u.jsx("span",{children:d}),u.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:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(qv,{mode:A??v,onModeChange:N=>{E(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Pv,{client:e}),u.jsx(Ax,{usage:b})]}),n.length>0&&u.jsxs(sg,{children:[u.jsx(ag,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(fa,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(ig,{children:"New Thread"})]})]}),u.jsx(wx,{onSubmit:q,isLoading:r,onInterrupt:w,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Xv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qv({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.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 u.jsxs("div",{className:"flex h-full w-full",children:[u.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:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(fa,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>o(!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?u.jsx(qu,{className:"h-4 w-4"}):u.jsx(Vu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Zv,{client:e,onSelectSession:r})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Yv,{client:e,agentId:t})})]})}function Zv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const C=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(y=>y.filter(T=>T.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),E=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),A())},[_,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(r&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=Jv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const T=m===y.sessionId;return u.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",y.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(zu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),T?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:E,onBlur:_,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:M=>M.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(y.sessionId),t(y)},className:"flex-1 min-w-0 text-left",title:y.title||y.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:y.title&&y.title.trim()?y.title:"新会话"})}),T?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,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:"取消",children:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&b(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(Zu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(gd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Jv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function eb({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Gr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof Bi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.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"})]})}),o&&s==="connected"&&u.jsx(Qv,{client:o})]})}const Qr="rcs_admin_key";function tb(){try{return localStorage.getItem(Qr)}catch{return null}}function nb(){const[e,t]=p.useState(tb),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Qr,r):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>Ae(()=>import("./Dashboard-DnLE2gtW.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),rb=p.lazy(()=>Ae(()=>import("./SessionDetail-CTa4JN6V.js"),__vite__mapDeps([8,2,4,6,9,5,10,11,12,1,7])).then(e=>({default:e.SessionDetail}))),ob=p.lazy(()=>Ae(()=>import("./ShareLanding-B48Z1tak.js"),__vite__mapDeps([13,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>Ae(()=>import("./ArtifactsGallery-DQj98ptl.js"),__vite__mapDeps([11,2,6,9,12,1,7])).then(e=>({default:e.ArtifactsGallery}))),sb=p.lazy(()=>Ae(()=>import("./ArtifactView-2di4r0Cr.js"),__vite__mapDeps([14,2,12,9,1,7])).then(e=>({default:e.ArtifactView}))),ab=p.lazy(()=>Ae(()=>import("./Claim-Dfdhnggp.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Claim}))),ib=p.lazy(()=>Ae(()=>import("./Login-CpRVSamw.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Login}))),lb=p.lazy(()=>Ae(()=>import("./Register-CvCuP-ww.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Register}))),cb=p.lazy(()=>Ae(()=>import("./Setup-DH5NCalW.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Setup}))),ub=p.lazy(()=>Ae(()=>import("./Join-Cgq7v-Sb.js"),__vite__mapDeps([19,2,1,7])).then(e=>({default:e.Join}))),db=p.lazy(()=>Ae(()=>import("./UserSettings-CxuLje2z.js"),__vite__mapDeps([20,2,12,1,7])).then(e=>({default:e.UserSettings}))),fb=p.lazy(()=>Ae(()=>import("./TeamList-DylGNt59.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamList}))),mb=p.lazy(()=>Ae(()=>import("./TeamCreate-tXM5yKmq.js"),__vite__mapDeps([22,2,1,7])).then(e=>({default:e.TeamCreate}))),pb=p.lazy(()=>Ae(()=>import("./TeamDetail-3jPhrX5z.js"),__vite__mapDeps([23,2,10,12,4,1,7])).then(e=>({default:e.TeamDetail}))),hb=p.lazy(()=>Ae(()=>import("./TeamSettings-CoBx_q55.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.TeamSettings}))),gb=p.lazy(()=>Ae(()=>import("./AdminPanel-8HNxSZw0.js"),__vite__mapDeps([25,2,1,7])).then(e=>({default:e.AdminPanel}))),xb=new Set(["login","register","setup","join","share"]),vb=new Set(["login","register","setup","join"]);function bb(){return u.jsx(Cd,{defaultTheme:"system",children:u.jsx(wh,{children:u.jsx(yb,{})})})}function yb(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=nb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{fh(d)},[d]);const[C,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const _=p.useCallback(()=>{const T=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const N=new URL(window.location.href);N.searchParams.delete("acp"),window.history.replaceState(null,"",N),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=M.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),o(F),f(null),t("session");return}if(T==="/login"){t("login");return}if(T==="/register"){t("register");return}if(T==="/setup"){t("setup");return}if(T==="/join"){t("join");return}if(T==="/settings"){t("settings");return}if(T==="/admin"){t("admin");return}if(T==="/teams/new"){t("team-create");return}if(T.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(T.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(T==="/teams"){t("teams");return}const S=T.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),o(null),s(void 0),t("share");return}const w=T.match(/^\/code\/a\/([^/]+)/);if(w&&w[1]){i(w[1]),o(null),s(void 0),f(null),t("artifact-view");return}if(T==="/code/artifacts"||T==="/code/artifacts/"){i(null),o(null),s(void 0),f(null),t("artifacts");return}const B=T.match(/^\/code\/claim\/([^/]+)/);if(B&&B[1]){t("claim");return}const P=T.match(/^\/code\/([^/]+)/);P&&P[1]?(o(P[1]),s(void 0),f(null),t("session")):(o(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(_(),window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)),[_]);const A=p.useCallback(T=>{window.history.pushState(null,"",`/code/${T}`),o(T),s(void 0),f(null),i(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),o(null),s(void 0),f(null),t("artifacts")},[]),L=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let T=e;return g||(C&&T!=="setup"&&T!=="join"&&(T="setup"),!h&&!xb.has(T)&&(T="login"),h&&(T==="login"||T==="setup")&&(T="dashboard")),T})();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 u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const j=()=>{if(l&&k==="acp")return u.jsx(eb,{url:l.url,token:l.token,onBack:L});switch(k){case"login":return u.jsx(ib,{onSuccess:L,onNavigateRegister:()=>t("register")});case"register":return u.jsx(lb,{onSuccess:L,onBack:()=>t("login")});case"setup":return u.jsx(cb,{onSuccess:L,onAlreadyDone:L});case"join":return u.jsx(ub,{onSuccess:L,onInvalidInvite:L});case"settings":return u.jsx(db,{});case"teams":return u.jsx(fb,{});case"team-create":return u.jsx(mb,{});case"team-detail":return u.jsx(pb,{});case"team-settings":return u.jsx(hb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Fe("nav.dashboard")})]})}):u.jsx(gb,{});case"share":return u.jsx(ob,{});case"claim":return u.jsx(ab,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(sb,{artifactId:a,onBack:E}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(rb,{sessionId:n,onSessionLoaded:T=>s(T.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})})}},x=!vb.has(k),y=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Sh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":r,onBack:n||l||m?L:void 0,onNavigateArtifacts:y?void 0:E}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:j()})]})}Lv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(bb,{})}));export{Ub as $,Gr as A,ve as B,wx as C,Bi as D,Qb as E,Ru as F,Bb as G,ey as H,Wb as I,Kb as J,ty as K,ua as L,Mv as M,zb as N,uv as O,Zu as P,Pb as Q,ay as R,sd as S,oy as T,bd as U,Jb as V,Zb as W,dn as X,Lb as Y,Ob as Z,Db as _,Qv as a,Vb as a0,Hb as a1,Gb as a2,qb as a3,$b as a4,Fb as a5,Yb as a6,Xb as a7,Ks as a8,ee as a9,Dv as aa,ae as ab,kt as ac,au as ad,Eb as ae,jb as af,Mb as ag,ph as ah,Rb as ai,_b as aj,Tb as ak,Ib as al,Fe as am,Ab as an,Gv as ao,su as ap,zi as aq,Fi as ar,vh as as,wr as b,dx as c,un as d,Kt as e,ca as f,ju as g,sy as h,dv as i,Pi as j,Di as k,Tn as l,sh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,cv as t,lv as u,ld as v,fd as w,ny as x,og as y,gd as z};
|
|
265
|
+
\`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:D,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};o(Z=>[...Z,V]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[r,a,e,j,x,y,L,m,T,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(dx,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(Ex,{requests:P,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.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:[u.jsx("span",{children:d}),u.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:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(qv,{mode:A??v,onModeChange:N=>{E(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Pv,{client:e}),u.jsx(Ax,{usage:b})]}),n.length>0&&u.jsxs(sg,{children:[u.jsx(ag,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(fa,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(ig,{children:"New Thread"})]})]}),u.jsx(wx,{onSubmit:q,isLoading:r,onInterrupt:w,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Xv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qv({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.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 u.jsxs("div",{className:"flex h-full w-full",children:[u.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:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(fa,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>o(!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?u.jsx(qu,{className:"h-4 w-4"}):u.jsx(Vu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Zv,{client:e,onSelectSession:r})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Yv,{client:e,agentId:t})})]})}function Zv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const C=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(y=>y.filter(T=>T.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),E=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),A())},[_,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(r&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=Jv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const T=m===y.sessionId;return u.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",y.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(zu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),T?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:E,onBlur:_,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:M=>M.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(y.sessionId),t(y)},className:"flex-1 min-w-0 text-left",title:y.title||y.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:y.title&&y.title.trim()?y.title:"新会话"})}),T?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,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:"取消",children:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&b(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(Zu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(gd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Jv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function eb({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Gr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof Bi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.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"})]})}),o&&s==="connected"&&u.jsx(Qv,{client:o})]})}const Qr="rcs_admin_key";function tb(){try{return localStorage.getItem(Qr)}catch{return null}}function nb(){const[e,t]=p.useState(tb),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Qr,r):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>Ae(()=>import("./Dashboard-DxcBkyhD.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),rb=p.lazy(()=>Ae(()=>import("./SessionDetail-CC1Y-JXz.js"),__vite__mapDeps([8,2,4,6,9,10,5,11,1,7])).then(e=>({default:e.SessionDetail}))),ob=p.lazy(()=>Ae(()=>import("./ShareLanding-B7ZdGScC.js"),__vite__mapDeps([12,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>Ae(()=>import("./ArtifactsGallery-B3OCFJ7T.js").then(e=>e.a),__vite__mapDeps([9,2,6,10])).then(e=>({default:e.ArtifactsGallery}))),sb=p.lazy(()=>Ae(()=>import("./ArtifactView-CUDKNi6z.js"),__vite__mapDeps([13,2,9,6,10,1,7])).then(e=>({default:e.ArtifactView}))),ab=p.lazy(()=>Ae(()=>import("./Claim-BOkou3Kj.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.Claim}))),ib=p.lazy(()=>Ae(()=>import("./Login-Ct6Z1ih0.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Login}))),lb=p.lazy(()=>Ae(()=>import("./Register-D3Sub3V4.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Register}))),cb=p.lazy(()=>Ae(()=>import("./Setup-COecVpRC.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Setup}))),ub=p.lazy(()=>Ae(()=>import("./Join-DZ_EUsnw.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Join}))),db=p.lazy(()=>Ae(()=>import("./UserSettings-9wOVTete.js"),__vite__mapDeps([19,2,10,1,7])).then(e=>({default:e.UserSettings}))),fb=p.lazy(()=>Ae(()=>import("./TeamList-B2kk8eh4.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.TeamList}))),mb=p.lazy(()=>Ae(()=>import("./TeamCreate-BKeJj9CV.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamCreate}))),pb=p.lazy(()=>Ae(()=>import("./TeamDetail-BAG50yxf.js"),__vite__mapDeps([22,2,11,10,4,1,7])).then(e=>({default:e.TeamDetail}))),hb=p.lazy(()=>Ae(()=>import("./TeamSettings-h8JWw1pp.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamSettings}))),gb=p.lazy(()=>Ae(()=>import("./AdminPanel-DMClbUbi.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.AdminPanel}))),xb=new Set(["login","register","setup","join","share"]),vb=new Set(["login","register","setup","join"]);function bb(){return u.jsx(Cd,{defaultTheme:"system",children:u.jsx(wh,{children:u.jsx(yb,{})})})}function yb(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=nb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{fh(d)},[d]);const[C,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const _=p.useCallback(()=>{const T=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const N=new URL(window.location.href);N.searchParams.delete("acp"),window.history.replaceState(null,"",N),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=M.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),o(F),f(null),t("session");return}if(T==="/login"){t("login");return}if(T==="/register"){t("register");return}if(T==="/setup"){t("setup");return}if(T==="/join"){t("join");return}if(T==="/settings"){t("settings");return}if(T==="/admin"){t("admin");return}if(T==="/teams/new"){t("team-create");return}if(T.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(T.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(T==="/teams"){t("teams");return}const S=T.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),o(null),s(void 0),t("share");return}const w=T.match(/^\/code\/a\/([^/]+)/);if(w&&w[1]){i(w[1]),o(null),s(void 0),f(null),t("artifact-view");return}if(T==="/code/artifacts"||T==="/code/artifacts/"){i(null),o(null),s(void 0),f(null),t("artifacts");return}const B=T.match(/^\/code\/claim\/([^/]+)/);if(B&&B[1]){t("claim");return}const P=T.match(/^\/code\/([^/]+)/);P&&P[1]?(o(P[1]),s(void 0),f(null),t("session")):(o(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(_(),window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)),[_]);const A=p.useCallback(T=>{window.history.pushState(null,"",`/code/${T}`),o(T),s(void 0),f(null),i(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),o(null),s(void 0),f(null),t("artifacts")},[]),L=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let T=e;return g||(C&&T!=="setup"&&T!=="join"&&(T="setup"),!h&&!xb.has(T)&&(T="login"),h&&(T==="login"||T==="setup")&&(T="dashboard")),T})();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 u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const j=()=>{if(l&&k==="acp")return u.jsx(eb,{url:l.url,token:l.token,onBack:L});switch(k){case"login":return u.jsx(ib,{onSuccess:L,onNavigateRegister:()=>t("register")});case"register":return u.jsx(lb,{onSuccess:L,onBack:()=>t("login")});case"setup":return u.jsx(cb,{onSuccess:L,onAlreadyDone:L});case"join":return u.jsx(ub,{onSuccess:L,onInvalidInvite:L});case"settings":return u.jsx(db,{});case"teams":return u.jsx(fb,{});case"team-create":return u.jsx(mb,{});case"team-detail":return u.jsx(pb,{});case"team-settings":return u.jsx(hb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Fe("nav.dashboard")})]})}):u.jsx(gb,{});case"share":return u.jsx(ob,{});case"claim":return u.jsx(ab,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(sb,{artifactId:a,onBack:E}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(rb,{sessionId:n,onSessionLoaded:T=>s(T.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})})}},x=!vb.has(k),y=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Sh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":r,onBack:n||l||m?L:void 0,onNavigateArtifacts:y?void 0:E}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:j()})]})}Lv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(bb,{})}));export{Ub as $,Gr as A,ve as B,wx as C,Bi as D,Qb as E,Ru as F,Bb as G,ey as H,Wb as I,Kb as J,ty as K,ua as L,Mv as M,zb as N,uv as O,Zu as P,Pb as Q,ay as R,sd as S,oy as T,bd as U,Jb as V,Zb as W,dn as X,Lb as Y,Ob as Z,Db as _,Qv as a,Vb as a0,Hb as a1,Gb as a2,qb as a3,$b as a4,Fb as a5,Yb as a6,Xb as a7,Ks as a8,ee as a9,Dv as aa,ae as ab,kt as ac,au as ad,Eb as ae,jb as af,Mb as ag,ph as ah,Rb as ai,_b as aj,Tb as ak,Ib as al,Fe as am,Ab as an,Gv as ao,su as ap,zi as aq,Fi as ar,vh as as,wr as b,dx as c,un as d,Kt as e,ca as f,ju as g,sy as h,dv as i,Pi as j,Di as k,Tn as l,sh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,cv as t,lv as u,ld as v,fd as w,ny as x,og as y,gd as z};
|