@saluzi/saluzi-edu 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +67 -67
- package/dist/rcs-web/assets/{AdminPanel-Dw_WcoUm.js → AdminPanel-B9K3CYqS.js} +1 -1
- package/dist/rcs-web/assets/{ArtifactView-1QwTt1_U.js → ArtifactView-xC7kgK6r.js} +2 -2
- package/{packages/remote-control-server/web/dist/assets/ArtifactsGallery-BaqQmrpp.js → dist/rcs-web/assets/ArtifactsGallery-CjliWleX.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/Claim-DbnYUnUa.js → dist/rcs-web/assets/Claim-CXcdrgMT.js} +1 -1
- package/dist/rcs-web/assets/{Dashboard-I2zDQu_C.js → Dashboard-GTUc9fNN.js} +1 -1
- package/dist/rcs-web/assets/{Join-BW_5GOxc.js → Join-BIPrGzjB.js} +1 -1
- package/dist/rcs-web/assets/{Login-DfpBv0-E.js → Login-B3F-J_O_.js} +1 -1
- package/dist/rcs-web/assets/{Register-G3MsHXWX.js → Register-BOMRs2-X.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-D13hMSu2.js +60 -0
- package/dist/rcs-web/assets/{SessionVisibilityBadge-BKEoqr7V.js → SessionVisibilityBadge-CpdH64Ki.js} +1 -1
- package/dist/rcs-web/assets/{Setup-Ba0gdFpo.js → Setup-04VLlDdo.js} +1 -1
- package/dist/rcs-web/assets/{ShareLanding-CD0g9hBP.js → ShareLanding-WwHP77MK.js} +1 -1
- package/dist/rcs-web/assets/{TeamCreate-B95jdnoW.js → TeamCreate-Cgn8TbAD.js} +1 -1
- package/dist/rcs-web/assets/{TeamDetail-B1ez_Vlm.js → TeamDetail-DjCmVq2J.js} +2 -2
- package/dist/rcs-web/assets/{TeamList-Cfbc_pbK.js → TeamList-DkEsaCsT.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-CM3C5h_w.js → TeamSettings-B37TYBAO.js} +1 -1
- package/dist/rcs-web/assets/{UserSearchInput-CXTnk0hA.js → UserSearchInput-CnZL2wJc.js} +1 -1
- package/dist/rcs-web/assets/{UserSettings-Bnq6nvYc.js → UserSettings-IVT2kcbO.js} +1 -1
- package/dist/rcs-web/assets/{arc-BSYwIwEf.js → arc-CC5N7Gnz.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-D3RCYL_1.js → architectureDiagram-3BPJPVTR-CYnwtsAv.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-CHzBQR1p.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-DQz4PRpo.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-BJcaDDLG.js → dist/rcs-web/assets/c4Diagram-AAUBKEIU-CZD52_Kn.js} +1 -1
- package/dist/rcs-web/assets/channel-Ca4tVWtj.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-Bg0Hnyyq.js → chunk-2J33WTMH-Gj2ixi6u.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-DfNc0_mN.js → chunk-4BX2VUAB-CXN22Y7-.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-lSLgeJjv.js → chunk-55IACEB6-xQfT-CuW.js} +1 -1
- package/dist/rcs-web/assets/{chunk-727SXJPM-CLJOi1hb.js → chunk-727SXJPM-BbG-ntwa.js} +1 -1
- package/dist/rcs-web/assets/{chunk-AQP2D5EJ-DTW4EE2i.js → chunk-AQP2D5EJ-D4F7B6E5.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-B57Jsd13.js → chunk-FMBD7UC4-C05UOexr.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-B_msF9ch.js → chunk-ND2GUHAM-CgP_C3YR.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-BKdDyhR-.js → chunk-QZHKN3VN-CEG9thbk.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-BZnm3s8l.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-BZnm3s8l.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-By1Tu8pm.js → code-block-IT6T5CEO-LwZNRjDA.js} +1 -1
- package/dist/rcs-web/assets/{copy-CIv8ifYN.js → copy-VKG2qIBt.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A--virsnmO.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-BDYGEjjT.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-DWHB77EO.js → dagre-BM42HDAG-4fAyUQHo.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-Cngu5yzm.js → diagram-2AECGRRQ-D3NtHIEV.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-KVNmlovi.js → diagram-5GNKFQAL-BKL4sgRR.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-B7VOvyr-.js → diagram-KO2AKTUF-B67rX-ug.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-BhGlWLSy.js → diagram-LMA3HP47-BOKNQw_d.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-B0nF0JCP.js → diagram-OG6HWLK6-C7IEoW-1.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/dialog-D__YHb1u.js → dist/rcs-web/assets/dialog-BkaYnxd7.js} +1 -1
- package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-CEl50M4S.js → erDiagram-TEJ5UH35-Dk3unY1I.js} +1 -1
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-fWBjdCNK.js → flowDiagram-I6XJVG4X-DZJ3rxoR.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-BAL8_-XH.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-Db4jo72X.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BM_6XPU4.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BX3YMZO1.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-DtwjUdP-.js → infoDiagram-5YYISTIA-B3YkgTqr.js} +1 -1
- package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-BwxFByT9.js → ishikawaDiagram-YF4QCWOH-C72E1awT.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-DeWYaHqa.js → journeyDiagram-JHISSGLW-BQtBob5h.js} +1 -1
- package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU-DMLiWipt.js → kanban-definition-UN3LZRKU-u4jbqr1b.js} +1 -1
- package/dist/rcs-web/assets/{linear-DigNGInH.js → linear-BgmGl4it.js} +1 -1
- package/dist/rcs-web/assets/main-DT3Fa5LX.css +1 -0
- package/dist/rcs-web/assets/{main-5C_gChTh.js → main-uW6v3W3M.js} +58 -58
- package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-DiBP7v4h.js → dist/rcs-web/assets/mermaid-VLURNSYL-CbW524nw.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-CQwjc9NW.js → mermaid.core-CHLPnWoP.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-CasTiX1-.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-BJmEA5fB.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-D94TX46C.js → pieDiagram-4H26LBE5-D2yhA9tV.js} +1 -1
- package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-wgKU_sO2.js → quadrantDiagram-W4KKPZXB-OsyuYmxV.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-DYKKTIT3.js → requirementDiagram-4Y6WPE33-DlBCGFrE.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-BCovzmUn.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CRf3tVJL.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-BLtYwGaQ.js → dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-CPMzSwEL.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-jMZaPO--.js → stateDiagram-AJRCARHV-C8aXVxPs.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CoUWNtqD.js → stateDiagram-v2-BHNVJYJU-BtaA-6HM.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-CbqngX3Z.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-D4bpIX_3.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/vennDiagram-CIIHVFJN-F9m0_HxT.js → dist/rcs-web/assets/vennDiagram-CIIHVFJN-BOvGxUBy.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-d_Uua5Ta.js → wardleyDiagram-YWT4CUSO-DOap87Nn.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BDwGBZT6.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BiKOkL9_.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/auth-security.test.ts +5 -7
- package/packages/remote-control-server/src/__tests__/ws-handler.test.ts +74 -0
- package/packages/remote-control-server/src/nodeServer.ts +15 -0
- package/packages/remote-control-server/src/services/transport.ts +23 -0
- package/packages/remote-control-server/src/transport/ws-handler.ts +31 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-Dw_WcoUm.js → AdminPanel-B9K3CYqS.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ArtifactView-1QwTt1_U.js → ArtifactView-xC7kgK6r.js} +2 -2
- package/{dist/rcs-web/assets/ArtifactsGallery-BaqQmrpp.js → packages/remote-control-server/web/dist/assets/ArtifactsGallery-CjliWleX.js} +1 -1
- package/{dist/rcs-web/assets/Claim-DbnYUnUa.js → packages/remote-control-server/web/dist/assets/Claim-CXcdrgMT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Dashboard-I2zDQu_C.js → Dashboard-GTUc9fNN.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Join-BW_5GOxc.js → Join-BIPrGzjB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-DfpBv0-E.js → Login-B3F-J_O_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-G3MsHXWX.js → Register-BOMRs2-X.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-D13hMSu2.js +60 -0
- package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-BKEoqr7V.js → SessionVisibilityBadge-CpdH64Ki.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Setup-Ba0gdFpo.js → Setup-04VLlDdo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ShareLanding-CD0g9hBP.js → ShareLanding-WwHP77MK.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-B95jdnoW.js → TeamCreate-Cgn8TbAD.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-B1ez_Vlm.js → TeamDetail-DjCmVq2J.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{TeamList-Cfbc_pbK.js → TeamList-DkEsaCsT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-CM3C5h_w.js → TeamSettings-B37TYBAO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-CXTnk0hA.js → UserSearchInput-CnZL2wJc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSettings-Bnq6nvYc.js → UserSettings-IVT2kcbO.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-BSYwIwEf.js → arc-CC5N7Gnz.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-D3RCYL_1.js → architectureDiagram-3BPJPVTR-CYnwtsAv.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-CHzBQR1p.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DQz4PRpo.js} +1 -1
- package/{dist/rcs-web/assets/c4Diagram-AAUBKEIU-BJcaDDLG.js → packages/remote-control-server/web/dist/assets/c4Diagram-AAUBKEIU-CZD52_Kn.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-Ca4tVWtj.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Bg0Hnyyq.js → chunk-2J33WTMH-Gj2ixi6u.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-DfNc0_mN.js → chunk-4BX2VUAB-CXN22Y7-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-lSLgeJjv.js → chunk-55IACEB6-xQfT-CuW.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-727SXJPM-CLJOi1hb.js → chunk-727SXJPM-BbG-ntwa.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-DTW4EE2i.js → chunk-AQP2D5EJ-D4F7B6E5.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-B57Jsd13.js → chunk-FMBD7UC4-C05UOexr.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-B_msF9ch.js → chunk-ND2GUHAM-CgP_C3YR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-BKdDyhR-.js → chunk-QZHKN3VN-CEG9thbk.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-BZnm3s8l.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-BZnm3s8l.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-By1Tu8pm.js → code-block-IT6T5CEO-LwZNRjDA.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-CIv8ifYN.js → copy-VKG2qIBt.js} +1 -1
- package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A--virsnmO.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-BDYGEjjT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DWHB77EO.js → dagre-BM42HDAG-4fAyUQHo.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-Cngu5yzm.js → diagram-2AECGRRQ-D3NtHIEV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-KVNmlovi.js → diagram-5GNKFQAL-BKL4sgRR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-B7VOvyr-.js → diagram-KO2AKTUF-B67rX-ug.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-BhGlWLSy.js → diagram-LMA3HP47-BOKNQw_d.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-B0nF0JCP.js → diagram-OG6HWLK6-C7IEoW-1.js} +1 -1
- package/{dist/rcs-web/assets/dialog-D__YHb1u.js → packages/remote-control-server/web/dist/assets/dialog-BkaYnxd7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-CEl50M4S.js → erDiagram-TEJ5UH35-Dk3unY1I.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-fWBjdCNK.js → flowDiagram-I6XJVG4X-DZJ3rxoR.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-BAL8_-XH.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-Db4jo72X.js} +1 -1
- package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-BM_6XPU4.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-BX3YMZO1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-DtwjUdP-.js → infoDiagram-5YYISTIA-B3YkgTqr.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-BwxFByT9.js → ishikawaDiagram-YF4QCWOH-C72E1awT.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-DeWYaHqa.js → journeyDiagram-JHISSGLW-BQtBob5h.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU-DMLiWipt.js → kanban-definition-UN3LZRKU-u4jbqr1b.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-DigNGInH.js → linear-BgmGl4it.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-DT3Fa5LX.css +1 -0
- package/packages/remote-control-server/web/dist/assets/{main-5C_gChTh.js → main-uW6v3W3M.js} +58 -58
- package/{dist/rcs-web/assets/mermaid-VLURNSYL-DiBP7v4h.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-CbW524nw.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-CQwjc9NW.js → mermaid.core-CHLPnWoP.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-CasTiX1-.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-BJmEA5fB.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-D94TX46C.js → pieDiagram-4H26LBE5-D2yhA9tV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-wgKU_sO2.js → quadrantDiagram-W4KKPZXB-OsyuYmxV.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-DYKKTIT3.js → requirementDiagram-4Y6WPE33-DlBCGFrE.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-BCovzmUn.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CRf3tVJL.js} +1 -1
- package/{dist/rcs-web/assets/sequenceDiagram-3UESZ5HK-BLtYwGaQ.js → packages/remote-control-server/web/dist/assets/sequenceDiagram-3UESZ5HK-CPMzSwEL.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-jMZaPO--.js → stateDiagram-AJRCARHV-C8aXVxPs.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CoUWNtqD.js → stateDiagram-v2-BHNVJYJU-BtaA-6HM.js} +1 -1
- package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-CbqngX3Z.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-D4bpIX_3.js} +1 -1
- package/{dist/rcs-web/assets/vennDiagram-CIIHVFJN-F9m0_HxT.js → packages/remote-control-server/web/dist/assets/vennDiagram-CIIHVFJN-BOvGxUBy.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-d_Uua5Ta.js → wardleyDiagram-YWT4CUSO-DOap87Nn.js} +1 -1
- package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BDwGBZT6.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BiKOkL9_.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/SessionDetail-C1D2E27B.js +0 -60
- package/dist/rcs-web/assets/channel-CbFNrUsk.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DjCl6Ad4.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DjCl6Ad4.js +0 -1
- package/dist/rcs-web/assets/main-Bn5YZuiH.css +0 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-C1D2E27B.js +0 -60
- package/packages/remote-control-server/web/dist/assets/channel-CbFNrUsk.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DjCl6Ad4.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DjCl6Ad4.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-Bn5YZuiH.css +0 -1
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-
|
|
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 Jr,r as Gs,b as fc,c as Zr,d as mc}from"./vendor-DE_-CLIE.js";import{_ as _e}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Vs(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Vs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ks(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Vs(e))&&(r&&(r+=" "),r+=t);return r}const hc=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},gc=(e,t)=>({classGroupId:e,validator:t}),qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Ho=[],xc="arbitrary..",vc=e=>{const t=yc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=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=r[a],f=n[a];return m?f?hc(f,m):m:f||Ho}return n[a]||Ho}}},Ys=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);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(":"),r=t.slice(0,n);return r?xc+r:void 0})(),yc=e=>{const{theme:t,classGroups:n}=e;return wc(n,t)},wc=(e,t)=>{const n=qs();for(const r in e){const o=e[r];eo(o,n,r,t)}return n},eo=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Cc(a,t,n,r)}},Cc=(e,t,n,r)=>{if(typeof e=="string"){Sc(e,t,n);return}if(typeof e=="function"){kc(e,t,n,r);return}Ac(e,t,n,r)},Sc=(e,t,n)=>{const r=e===""?t:Xs(t,e);r.classGroupId=n},kc=(e,t,n,r)=>{if(Ec(e)){eo(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(gc(n,e))},Ac=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,m]=o[a];eo(m,Xs(t,i),n,r)}},Xs=(e,t)=>{let n=e;const r=t.split(Mn),o=r.length;for(let s=0;s<o;s++){const a=r[s];let i=n.nextPart.get(a);i||(i=qs(),n.nextPart.set(a,i)),n=i}return n},Ec=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_c=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Pr="!",Bo=":",Tc=[],Wo=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),jc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,i=0,m=0,f;const l=o.length;for(let v=0;v<l;v++){const w=o[v];if(a===0&&i===0){if(w===Bo){s.push(o.slice(m,v)),m=v+1;continue}if(w==="/"){f=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const c=s.length===0?o:o.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 o=t+Bo,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Wo(Tc,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Rc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Nc=e=>({cache:_c(e.cacheSize),parseClassName:jc(e),sortModifiers:Rc(e),postfixLookupClassGroupIds:Ic(e),...vc(e)}),Ic=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Mc=/\s+/,Pc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,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:w}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!w,E;if(b){const T=v.substring(0,w);E=r(T);const x=E&&a[E]?r(v):void 0;x&&x!==E&&(E=x,b=!1)}else E=r(v);if(!E){if(!b){f=c+(f.length>0?" "+f:f);continue}if(E=r(v),!E){f=c+(f.length>0?" "+f:f);continue}b=!1}const _=h.length===0?"":h.length===1?h[0]:s(h).join(":"),A=g?_+Pr:_,D=A+E;if(i.indexOf(D)>-1)continue;i.push(D);const k=o(E,b);for(let T=0;T<k.length;++T){const x=k[T];i.push(A+x)}f=c+(f.length>0?" "+f:f)}return f},Oc=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Qs(n))&&(o&&(o+=" "),o+=r);return o},Qs=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Qs(e[r]))&&(n&&(n+=" "),n+=t);return n},Dc=(e,...t)=>{let n,r,o,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Nc(f),r=n.cache.get,o=n.cache.set,s=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Pc(m,n);return o(m,l),l};return s=a,(...m)=>s(Oc(...m))},Lc=[],Ae=e=>{const t=n=>n[e]||Lc;return t.isThemeGetter=!0,t},Js=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zs=/^\((?:(\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)\(.+\)$/,Hc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>Fc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),Be=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=>Hc.test(e),Vc=e=>Bc.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=>Js.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),Jc=e=>pt(e,na,Vc),wn=e=>pt(e,ia,Gc),Q=e=>Zs.test(e),en=e=>jt(e,oa),Zc=e=>jt(e,sa),Ko=e=>jt(e,ta),eu=e=>jt(e,ra),tu=e=>jt(e,na),Cn=e=>jt(e,ia,!0),nu=e=>jt(e,aa,!0),pt=(e,t,n)=>{const r=Js.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},jt=(e,t,n=!1)=>{const r=Zs.exec(e);return r?r[1]?t(r[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=Ae("color"),t=Ae("font"),n=Ae("text"),r=Ae("font-weight"),o=Ae("tracking"),s=Ae("leading"),a=Ae("breakpoint"),i=Ae("container"),m=Ae("spacing"),f=Ae("radius"),l=Ae("shadow"),c=Ae("inset-shadow"),d=Ae("text-shadow"),h=Ae("drop-shadow"),g=Ae("blur"),v=Ae("perspective"),w=Ae("aspect"),b=Ae("ease"),E=Ae("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],j=()=>[Be,"none","subgrid",Q,X],M=()=>["auto",{span:["full",Be,Q,X]},Be,Q,X],O=()=>[Be,"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()],C=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],H=()=>[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=()=>[...A(),Ko,Vo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",eu,Yc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],B=()=>["",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],J=()=>["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,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset: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:[Be,"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:[Be,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":j()}],"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:C()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,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:[Zc,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:[o,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:[Be,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:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Be,Q,X],radial:["",Q,X],conic:[Be,Q,X]},tu,Jc]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[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:B()}],"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":B()}],"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":A()}],"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:L()}],"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",E,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],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:D()}],"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:[Be,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 Tb(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 Rb(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 Nb(e){return typeof e=="string"&&lu.test(e.trim())}/**
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-CbW524nw.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-GTUc9fNN.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-CpdH64Ki.js","assets/dialog-BkaYnxd7.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-D13hMSu2.js","assets/ArtifactsGallery-CjliWleX.js","assets/copy-VKG2qIBt.js","assets/UserSearchInput-CnZL2wJc.js","assets/ShareLanding-WwHP77MK.js","assets/ArtifactView-xC7kgK6r.js","assets/Claim-CXcdrgMT.js","assets/Login-B3F-J_O_.js","assets/Register-BOMRs2-X.js","assets/Setup-04VLlDdo.js","assets/Join-BIPrGzjB.js","assets/UserSettings-IVT2kcbO.js","assets/TeamList-DkEsaCsT.js","assets/TeamCreate-Cgn8TbAD.js","assets/TeamDetail-DjCmVq2J.js","assets/TeamSettings-B37TYBAO.js","assets/AdminPanel-B9K3CYqS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var mc=Object.defineProperty;var pc=(e,t,n)=>t in e?mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>pc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as qs,b as hc,c as eo,d as gc}from"./vendor-DE_-CLIE.js";import{_ as _e}from"./shiki-mEP5vQQu.js";import{m as xc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Ys(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ys(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Xs(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ys(e))&&(r&&(r+=" "),r+=t);return r}const vc=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},bc=(e,t)=>({classGroupId:e,validator:t}),Qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),In="-",Wo=[],yc="arbitrary..",wc=e=>{const t=Sc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Cc(a);const i=a.split(In),m=i[0]===""&&i.length>1?1:0;return Js(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?vc(f,m):m:f||Wo}return n[a]||Wo}}},Js=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const f=Js(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(In):e.slice(t).join(In),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},Cc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?yc+r:void 0})(),Sc=e=>{const{theme:t,classGroups:n}=e;return kc(n,t)},kc=(e,t)=>{const n=Qs();for(const r in e){const o=e[r];to(o,n,r,t)}return n},to=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Ac(a,t,n,r)}},Ac=(e,t,n,r)=>{if(typeof e=="string"){Ec(e,t,n);return}if(typeof e=="function"){_c(e,t,n,r);return}Tc(e,t,n,r)},Ec=(e,t,n)=>{const r=e===""?t:Zs(t,e);r.classGroupId=n},_c=(e,t,n,r)=>{if(jc(e)){to(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(bc(n,e))},Tc=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,m]=o[a];to(m,Zs(t,i),n,r)}},Zs=(e,t)=>{let n=e;const r=t.split(In),o=r.length;for(let s=0;s<o;s++){const a=r[s];let i=n.nextPart.get(a);i||(i=Qs(),n.nextPart.set(a,i)),n=i}return n},jc=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Rc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Pr="!",Go=":",Nc=[],Vo=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Mc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,i=0,m=0,f;const l=o.length;for(let v=0;v<l;v++){const w=o[v];if(a===0&&i===0){if(w===Go){s.push(o.slice(m,v)),m=v+1;continue}if(w==="/"){f=v;continue}}w==="["?a++:w==="]"?a--:w==="("?i++:w===")"&&i--}const c=s.length===0?o:o.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 Vo(s,h,d,g)};if(t){const o=t+Go,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Vo(Nc,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Ic=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Pc=e=>({cache:Rc(e.cacheSize),parseClassName:Mc(e),sortModifiers:Ic(e),postfixLookupClassGroupIds:Oc(e),...wc(e)}),Oc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Dc=/\s+/,Lc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Dc);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:w}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!w,E;if(b){const T=v.substring(0,w);E=r(T);const x=E&&a[E]?r(v):void 0;x&&x!==E&&(E=x,b=!1)}else E=r(v);if(!E){if(!b){f=c+(f.length>0?" "+f:f);continue}if(E=r(v),!E){f=c+(f.length>0?" "+f:f);continue}b=!1}const _=h.length===0?"":h.length===1?h[0]:s(h).join(":"),A=g?_+Pr:_,D=A+E;if(i.indexOf(D)>-1)continue;i.push(D);const k=o(E,b);for(let T=0;T<k.length;++T){const x=k[T];i.push(A+x)}f=c+(f.length>0?" "+f:f)}return f},Fc=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=ea(n))&&(o&&(o+=" "),o+=r);return o},ea=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=ea(e[r]))&&(n&&(n+=" "),n+=t);return n},$c=(e,...t)=>{let n,r,o,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Pc(f),r=n.cache.get,o=n.cache.set,s=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Lc(m,n);return o(m,l),l};return s=a,(...m)=>s(Fc(...m))},Uc=[],Ae=e=>{const t=n=>n[e]||Uc;return t.isThemeGetter=!0,t},ta=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,na=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Hc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bc=/\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$/,Wc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Gc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Vc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>zc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),Be=e=>!!e&&Number.isInteger(Number(e)),fr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Qe=e=>Hc.test(e),ra=()=>!0,Kc=e=>Bc.test(e)&&!Wc.test(e),no=()=>!1,qc=e=>Gc.test(e),Yc=e=>Vc.test(e),Xc=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)),Jc=e=>pt(e,aa,no),X=e=>ta.test(e),yt=e=>pt(e,ia,Kc),Ko=e=>pt(e,au,se),Zc=e=>pt(e,ca,ra),eu=e=>pt(e,la,no),qo=e=>pt(e,oa,no),tu=e=>pt(e,sa,Yc),wn=e=>pt(e,ua,qc),Q=e=>na.test(e),en=e=>jt(e,ia),nu=e=>jt(e,la),Yo=e=>jt(e,oa),ru=e=>jt(e,aa),ou=e=>jt(e,sa),Cn=e=>jt(e,ua,!0),su=e=>jt(e,ca,!0),pt=(e,t,n)=>{const r=ta.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},jt=(e,t,n=!1)=>{const r=na.exec(e);return r?r[1]?t(r[1]):n:!1},oa=e=>e==="position"||e==="percentage",sa=e=>e==="image"||e==="url",aa=e=>e==="length"||e==="size"||e==="bg-size",ia=e=>e==="length",au=e=>e==="number",la=e=>e==="family-name",ca=e=>e==="number"||e==="weight",ua=e=>e==="shadow",iu=()=>{const e=Ae("color"),t=Ae("font"),n=Ae("text"),r=Ae("font-weight"),o=Ae("tracking"),s=Ae("leading"),a=Ae("breakpoint"),i=Ae("container"),m=Ae("spacing"),f=Ae("radius"),l=Ae("shadow"),c=Ae("inset-shadow"),d=Ae("text-shadow"),h=Ae("drop-shadow"),g=Ae("blur"),v=Ae("perspective"),w=Ae("aspect"),b=Ae("ease"),E=Ae("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],D=()=>[...A(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],j=()=>[Be,"none","subgrid",Q,X],I=()=>["auto",{span:["full",Be,Q,X]},Be,Q,X],O=()=>[Be,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],C=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],H=()=>[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=()=>[...A(),Yo,qo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",ru,Jc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],B=()=>["",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,Yo,qo],ne=()=>["","none",g,Q,X],J=()=>["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:[ra],container:[Qe],"drop-shadow":[Qe],ease:["in","out","in-out"],font:[Xc],"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,w]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[Qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:D()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset: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:[Be,"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:[Be,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":j()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":j()}],"row-start-end":[{row:I()}],"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:[...M(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:C()}],"inline-size":[{inline:["auto",...H()]}],"min-inline-size":[{"min-inline":["auto",...H()]}],"max-inline-size":[{"max-inline":["none",...H()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...C()]}],"min-w":[{"min-w":[i,"screen","none",...C()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...C()]}],h:[{h:["screen","lh",...C()]}],"min-h":[{"min-h":["screen","lh","none",...C()]}],"max-h":[{"max-h":["screen","lh",...C()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,su,Zc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fr,X]}],"font-family":[{font:[nu,eu,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:[o,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Ko]}],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:[Be,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:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Be,Q,X],radial:["",Q,X],conic:[Be,Q,X]},ou,tu]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[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:B()}],"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":B()}],"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":A()}],"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:L()}],"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",E,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":D()}],rotate:[{rotate:J()}],"rotate-x":[{"rotate-x":J()}],"rotate-y":[{"rotate-y":J()}],"rotate-z":[{"rotate-z":J()}],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:D()}],"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:[Be,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,Ko]}],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"]}},lu=$c(iu);function ee(...e){return lu(Xs(e))}function cu(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Tb(e){return e?new Date(e*1e3).toLocaleString():""}function jb(e){return e==="archived"||e==="inactive"}function Rb(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function uu(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 Nb(){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),uu(t)}function Mb(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 du=/^Remote Control connecting(?:…|\.\.\.)$/;function Ib(e){return typeof e=="string"&&du.test(e.trim())}/**
|
|
3
3
|
* @license lucide-react v0.555.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
6
6
|
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const
|
|
7
|
+
*/const fu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),mu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Xo=e=>{const t=mu(e);return t.charAt(0).toUpperCase()+t.slice(1)},da=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),pu=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
8
8
|
* @license lucide-react v0.555.0 - ISC
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the ISC license.
|
|
11
11
|
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var
|
|
12
|
+
*/var hu={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
13
13
|
* @license lucide-react v0.555.0 - ISC
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the ISC license.
|
|
16
16
|
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const
|
|
17
|
+
*/const gu=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...hu,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:da("lucide",o),...!s&&!pu(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(s)?s:[s]]));/**
|
|
18
18
|
* @license lucide-react v0.555.0 - ISC
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the ISC license.
|
|
21
21
|
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const ae=(e,t)=>{const n=p.forwardRef(({className:r,...o},s)=>p.createElement(
|
|
22
|
+
*/const ae=(e,t)=>{const n=p.forwardRef(({className:r,...o},s)=>p.createElement(gu,{ref:s,iconNode:t,className:da(`lucide-${fu(Xo(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Xo(e),n};/**
|
|
23
23
|
* @license lucide-react v0.555.0 - ISC
|
|
24
24
|
*
|
|
25
25
|
* This source code is licensed under the ISC license.
|
|
26
26
|
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const
|
|
27
|
+
*/const xu=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],vu=ae("arrow-down",xu);/**
|
|
28
28
|
* @license lucide-react v0.555.0 - ISC
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
31
31
|
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const
|
|
32
|
+
*/const bu=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],yu=ae("brain",bu);/**
|
|
33
33
|
* @license lucide-react v0.555.0 - ISC
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the ISC license.
|
|
36
36
|
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const
|
|
37
|
+
*/const wu=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],un=ae("check",wu);/**
|
|
38
38
|
* @license lucide-react v0.555.0 - ISC
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const
|
|
42
|
+
*/const Cu=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kt=ae("chevron-down",Cu);/**
|
|
43
43
|
* @license lucide-react v0.555.0 - ISC
|
|
44
44
|
*
|
|
45
45
|
* This source code is licensed under the ISC license.
|
|
46
46
|
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const
|
|
47
|
+
*/const Su=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ku=ae("chevron-left",Su);/**
|
|
48
48
|
* @license lucide-react v0.555.0 - ISC
|
|
49
49
|
*
|
|
50
50
|
* This source code is licensed under the ISC license.
|
|
51
51
|
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const
|
|
52
|
+
*/const Au=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],fa=ae("chevron-up",Au);/**
|
|
53
53
|
* @license lucide-react v0.555.0 - ISC
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the ISC license.
|
|
56
56
|
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const
|
|
57
|
+
*/const Eu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_u=ae("circle-check",Eu);/**
|
|
58
58
|
* @license lucide-react v0.555.0 - ISC
|
|
59
59
|
*
|
|
60
60
|
* This source code is licensed under the ISC license.
|
|
61
61
|
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const
|
|
62
|
+
*/const Tu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ju=ae("circle",Tu);/**
|
|
63
63
|
* @license lucide-react v0.555.0 - ISC
|
|
64
64
|
*
|
|
65
65
|
* This source code is licensed under the ISC license.
|
|
66
66
|
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const
|
|
67
|
+
*/const Ru=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Nu=ae("clock",Ru);/**
|
|
68
68
|
* @license lucide-react v0.555.0 - ISC
|
|
69
69
|
*
|
|
70
70
|
* This source code is licensed under the ISC license.
|
|
71
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const
|
|
72
|
+
*/const Mu=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Iu=ae("file-code-corner",Mu);/**
|
|
73
73
|
* @license lucide-react v0.555.0 - ISC
|
|
74
74
|
*
|
|
75
75
|
* This source code is licensed under the ISC license.
|
|
76
76
|
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const
|
|
77
|
+
*/const Pu=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ht=ae("file-text",Pu);/**
|
|
78
78
|
* @license lucide-react v0.555.0 - ISC
|
|
79
79
|
*
|
|
80
80
|
* This source code is licensed under the ISC license.
|
|
81
81
|
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const
|
|
82
|
+
*/const Ou=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ro=ae("folder-open",Ou);/**
|
|
83
83
|
* @license lucide-react v0.555.0 - ISC
|
|
84
84
|
*
|
|
85
85
|
* This source code is licensed under the ISC license.
|
|
86
86
|
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const
|
|
87
|
+
*/const Du=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Lu=ae("image",Du);/**
|
|
88
88
|
* @license lucide-react v0.555.0 - ISC
|
|
89
89
|
*
|
|
90
90
|
* This source code is licensed under the ISC license.
|
|
91
91
|
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const
|
|
92
|
+
*/const Fu=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],$u=ae("layout-grid",Fu);/**
|
|
93
93
|
* @license lucide-react v0.555.0 - ISC
|
|
94
94
|
*
|
|
95
95
|
* This source code is licensed under the ISC license.
|
|
96
96
|
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const
|
|
97
|
+
*/const Uu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ma=ae("loader-circle",Uu);/**
|
|
98
98
|
* @license lucide-react v0.555.0 - ISC
|
|
99
99
|
*
|
|
100
100
|
* This source code is licensed under the ISC license.
|
|
101
101
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const
|
|
102
|
+
*/const zu=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Hu=ae("log-out",zu);/**
|
|
103
103
|
* @license lucide-react v0.555.0 - ISC
|
|
104
104
|
*
|
|
105
105
|
* This source code is licensed under the ISC license.
|
|
106
106
|
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const
|
|
107
|
+
*/const Bu=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Wu=ae("message-square",Bu);/**
|
|
108
108
|
* @license lucide-react v0.555.0 - ISC
|
|
109
109
|
*
|
|
110
110
|
* This source code is licensed under the ISC license.
|
|
111
111
|
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const
|
|
112
|
+
*/const Gu=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vu=ae("monitor",Gu);/**
|
|
113
113
|
* @license lucide-react v0.555.0 - ISC
|
|
114
114
|
*
|
|
115
115
|
* This source code is licensed under the ISC license.
|
|
116
116
|
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const
|
|
117
|
+
*/const Ku=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],pa=ae("moon",Ku);/**
|
|
118
118
|
* @license lucide-react v0.555.0 - ISC
|
|
119
119
|
*
|
|
120
120
|
* This source code is licensed under the ISC license.
|
|
121
121
|
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const
|
|
122
|
+
*/const qu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Yu=ae("panel-left-close",qu);/**
|
|
123
123
|
* @license lucide-react v0.555.0 - ISC
|
|
124
124
|
*
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
126
126
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const
|
|
127
|
+
*/const Xu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Qu=ae("panel-left",Xu);/**
|
|
128
128
|
* @license lucide-react v0.555.0 - ISC
|
|
129
129
|
*
|
|
130
130
|
* This source code is licensed under the ISC license.
|
|
131
131
|
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const
|
|
132
|
+
*/const Ju=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],Zu=ae("paperclip",Ju);/**
|
|
133
133
|
* @license lucide-react v0.555.0 - ISC
|
|
134
134
|
*
|
|
135
135
|
* This source code is licensed under the ISC license.
|
|
136
136
|
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const
|
|
137
|
+
*/const ed=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],td=ae("pencil",ed);/**
|
|
138
138
|
* @license lucide-react v0.555.0 - ISC
|
|
139
139
|
*
|
|
140
140
|
* This source code is licensed under the ISC license.
|
|
141
141
|
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/const
|
|
142
|
+
*/const nd=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ha=ae("plus",nd);/**
|
|
143
143
|
* @license lucide-react v0.555.0 - ISC
|
|
144
144
|
*
|
|
145
145
|
* This source code is licensed under the ISC license.
|
|
146
146
|
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
-
*/const
|
|
147
|
+
*/const rd=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],od=ae("search",rd);/**
|
|
148
148
|
* @license lucide-react v0.555.0 - ISC
|
|
149
149
|
*
|
|
150
150
|
* This source code is licensed under the ISC license.
|
|
151
151
|
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/const
|
|
152
|
+
*/const sd=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ad=ae("send",sd);/**
|
|
153
153
|
* @license lucide-react v0.555.0 - ISC
|
|
154
154
|
*
|
|
155
155
|
* This source code is licensed under the ISC license.
|
|
156
156
|
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/const
|
|
157
|
+
*/const id=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ld=ae("settings",id);/**
|
|
158
158
|
* @license lucide-react v0.555.0 - ISC
|
|
159
159
|
*
|
|
160
160
|
* This source code is licensed under the ISC license.
|
|
161
161
|
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const
|
|
162
|
+
*/const cd=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ga=ae("shield-alert",cd);/**
|
|
163
163
|
* @license lucide-react v0.555.0 - ISC
|
|
164
164
|
*
|
|
165
165
|
* This source code is licensed under the ISC license.
|
|
166
166
|
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/const
|
|
167
|
+
*/const ud=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],dd=ae("shield",ud);/**
|
|
168
168
|
* @license lucide-react v0.555.0 - ISC
|
|
169
169
|
*
|
|
170
170
|
* This source code is licensed under the ISC license.
|
|
171
171
|
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const
|
|
172
|
+
*/const fd=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],md=ae("slash",fd);/**
|
|
173
173
|
* @license lucide-react v0.555.0 - ISC
|
|
174
174
|
*
|
|
175
175
|
* This source code is licensed under the ISC license.
|
|
176
176
|
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/const
|
|
177
|
+
*/const pd=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],hd=ae("square",pd);/**
|
|
178
178
|
* @license lucide-react v0.555.0 - ISC
|
|
179
179
|
*
|
|
180
180
|
* This source code is licensed under the ISC license.
|
|
181
181
|
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
-
*/const
|
|
182
|
+
*/const gd=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],xa=ae("sun",gd);/**
|
|
183
183
|
* @license lucide-react v0.555.0 - ISC
|
|
184
184
|
*
|
|
185
185
|
* This source code is licensed under the ISC license.
|
|
186
186
|
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
-
*/const
|
|
187
|
+
*/const xd=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],oo=ae("table",xd);/**
|
|
188
188
|
* @license lucide-react v0.555.0 - ISC
|
|
189
189
|
*
|
|
190
190
|
* This source code is licensed under the ISC license.
|
|
191
191
|
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
-
*/const
|
|
192
|
+
*/const vd=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],bd=ae("trash-2",vd);/**
|
|
193
193
|
* @license lucide-react v0.555.0 - ISC
|
|
194
194
|
*
|
|
195
195
|
* This source code is licensed under the ISC license.
|
|
196
196
|
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/const
|
|
197
|
+
*/const yd=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],va=ae("user",yd);/**
|
|
198
198
|
* @license lucide-react v0.555.0 - ISC
|
|
199
199
|
*
|
|
200
200
|
* This source code is licensed under the ISC license.
|
|
201
201
|
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const
|
|
202
|
+
*/const wd=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Cd=ae("users",wd);/**
|
|
203
203
|
* @license lucide-react v0.555.0 - ISC
|
|
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,r]=p.useState(()=>Xo()||t),[o,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{r(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:o,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Jo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Jo(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Jo(e[o],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Sd=Symbol.for("react.lazy"),Pn=Jr[" 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=Ed(e),n=p.forwardRef((r,o)=>{let{children:s,...a}=r;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(Td);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:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ad=ba("Slot");function Ed(e){const t=p.forwardRef((n,r)=>{let{children:o,...s}=n;if(va(o)&&typeof Pn=="function"&&(o=Pn(o._payload)),p.isValidElement(o)){const a=Rd(o),i=jd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _d=Symbol("radix.slottable");function Td(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_d}function jd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Rd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Zo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Nd=(e,t)=>n=>{var r;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:o,defaultVariants:s}=t,a=Object.keys(o).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Zo(l)||Zo(c);return o[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||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,w]=g;return Array.isArray(w)?w.includes({...s,...i}[v]):{...s,...i}[v]===w})?[...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:r=!1,...o}){const s=r?Ad:"button";return u.jsx(s,{"data-slot":"button",className:ee(Id({variant:t,size:n,className:e})),...o})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Md(e,t){const n=p.createContext(t),r=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function o(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[r,o]}function nt(e,t=[]){let n=[];function r(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,w=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:w,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 o=()=>{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 o.scopeName=e,[r,Pd(o,...t)]}function Pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.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 Je=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Od=Jr[" useInsertionEffect ".trim().toString()]||Je;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=Dd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:o;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const 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,r]=p.useState(e),o=p.useRef(n),s=p.useRef(t);return Od(()=>{s.current=t},[t]),p.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Ld(e){return typeof e=="function"}function Bt(e){const t=Fd(e),n=p.forwardRef((r,o)=>{const{children:s,...a}=r,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:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Fd(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const a=Hd(o),i=zd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>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 r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Hd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Bd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Bd.reduce((e,t)=>{const n=Bt(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wa(e,t){e&&Gs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,r]=nt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:b}=v,E=it.useRef(null),_=it.useRef(new Map).current;return u.jsx(o,{scope:w,itemMap:_,collectionRef:E,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Bt(i),f=it.forwardRef((v,w)=>{const{scope:b,children:E}=v,_=s(i,b),A=ke(w,_.collectionRef);return u.jsx(m,{ref:A,children:E})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Bt(l),h=it.forwardRef((v,w)=>{const{scope:b,children:E,..._}=v,A=it.useRef(null),D=ke(w,A),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(A,{ref:A,..._}),()=>void k.itemMap.delete(A))),u.jsx(d,{[c]:"",ref:D,children:E})});h.displayName=l;function g(v){const w=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${c}]`));return Array.from(w.itemMap.values()).sort((k,T)=>_.indexOf(k.ref.current)-_.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,r]}var Wd=p.createContext(void 0);function Sa(e){const t=p.useContext(Wd);return e||t||"ltr"}function Ze(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Gd(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var 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:r,onPointerDownOutside:o,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,T=>c(T)),v=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(w),E=l?v.indexOf(l):-1,_=f.layersWithOutsidePointerEventsDisabled.size>0,A=E>=b,D=Qd(T=>{const x=T.target,y=[...f.branches].some(j=>j.contains(x));!A||y||(o==null||o(T),a==null||a(T),T.defaultPrevented||i==null||i())},d),k=Jd(T=>{const x=T.target;[...f.branches].some(j=>j.contains(x))||(s==null||s(T),a==null||a(T),T.defaultPrevented||i==null||i())},d);return Gd(T=>{E===f.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&i&&(T.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 T=()=>h({});return document.addEventListener(Or,T),()=>document.removeEventListener(Or,T)},[]),u.jsx(ge.div,{...m,ref:g,style:{pointerEvents:_?A?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,D.onPointerDownCapture)})});fn.displayName=Vd;var Yd="DismissableLayerBranch",Xd=p.forwardRef((e,t)=>{const n=p.useContext(ka),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(ge.div,{...e,ref:o})});Xd.displayName=Yd;function Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let m=function(){Aa(Kd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Jd(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e),r=p.useRef(!1);return p.useEffect(()=>{const o=s=>{s.target&&!r.current&&Aa(qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Aa(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?wa(o,s):o.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},Zd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Ze(o),l=Ze(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(r){let v=function(_){if(h.paused||!i)return;const A=_.target;i.contains(A)?c.current=A:lt(c.current,{select:!0})},w=function(_){if(h.paused||!i)return;const A=_.relatedTarget;A!==null&&(i.contains(A)||lt(c.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const D of _)D.removedNodes.length>0&<(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const E=new MutationObserver(b);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),E.disconnect()}}},[r,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(Ea(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&&!r||h.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(w&&b){const E=v.currentTarget,[_,A]=tf(E);_&&A?!v.shiftKey&&b===A?(v.preventDefault(),n&<(_,{select:!0})):v.shiftKey&&b===_&&(v.preventDefault(),n&<(A,{select:!0})):b===E&&v.preventDefault()}},[n,r,h.paused]);return u.jsx(ge.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Zd;function ef(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(lt(r,{select:t}),document.activeElement!==n)return}function tf(e){const t=Ea(e),n=ss(t,e),r=ss(t.reverse(),e);return[n,r]}function Ea(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function 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],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function sf(e){return e.filter(t=>t.tagName!=="A")}var af=Jr[" useId ".trim().toString()]||(()=>{}),lf=0;function Re(e){const[t,n]=p.useState(af());return Je(()=>{n(r=>r??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 r=qt(e),o=io(e),s=ao(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="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,r){const o=qt(e);let s=hf(tt(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),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 _a(e){return typeof e!="number"?xf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function us(e,t,n){let{reference:r,floating:o}=e;const s=Ve(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,d=r[i]/2-o[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.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:r,y:o,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=_a(h),w=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),E=c==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),A=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},D=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:E,offsetParent:_,strategy:m}):E);return{top:(b.top-D.top+g.top)/A.y,bottom:(D.bottom-b.bottom+g.bottom)/A.y,left:(b.left-D.left+g.left)/A.x,right:(D.right-b.right+g.right)/A.x}}const bf=50,yf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="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:o}),{x:l,y:c}=us(f,r,m),d=r,h=0;const g={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:b,fn:E}=w,{x:_,y:A,data:D,reset:k}=await E({x:l,y:c,initialPlacement:r,placement:d,strategy:o,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=_??l,c=A??c,g[b]={...g[b],...D},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:o}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:o,middlewareData:g}},wf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=_a(l),d={x:n,y:r},h=io(o),g=ao(h),v=await a.getDimensions(f),w=h==="y",b=w?"top":"left",E=w?"bottom":"right",_=w?"clientHeight":"clientWidth",A=s.reference[g]+s.reference[h]-d[h]-s.floating[g],D=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let T=k?k[_]:0;(!T||!await(a.isElement==null?void 0:a.isElement(k)))&&(T=i.floating[_]||s.floating[g]);const x=A/2-D/2,y=T/2-v[g]/2-1,j=dt(c[b],y),M=dt(c[E],y),O=j,F=T-v[g]-M,I=T/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(o)!=null&&I!==z&&s.reference[g]/2-(I<O?j:M)-v[g]/2<0,C=S?I<O?I-O:I-F:0;return{[h]:d[h]+C,data:{[h]:z,centerOffset:I-z-C,...S&&{alignmentOffset:C}},reset:S}}}),Cf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,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,...w}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(o),E=Ve(i),_=tt(i)===i,A=await(m.isRTL==null?void 0:m.isRTL(f.floating)),D=d||(_||!v?[Dn(i)]:ff(i)),k=g!=="none";!d&&k&&D.push(...gf(i,v,g,A));const T=[i,...D],x=await m.detectOverflow(t,w),y=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&y.push(x[b]),c){const I=df(o,a,A);y.push(x[I[0]],x[I[1]])}if(j=[...j,{placement:o,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=T[I];if(z&&(!(c==="alignment"?E!==Ve(z):!1)||j.every(H=>Ve(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:I,overflows:j},reset:{placement:z}};let S=(O=j.filter(C=>C.overflows[0]<=0).sort((C,H)=>C.overflows[1]-H.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const C=(F=j.filter(H=>{if(k){const P=Ve(H.placement);return P===E||P==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((H,P)=>H[1]-P[1])[0])==null?void 0:F[0];C&&(S=C);break}case"initialPlacement":S=i;break}if(o!==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:r}=t,{strategy:o="referenceHidden",...s}=et(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},Ta=new Set(["left","top"]);async function kf(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=Ta.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 Af=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,m=await kf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+m.x,y:s+m.y,data:{...m,placement:a}}}}},Ef=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:E,y:_}=b;return{x:E,y:_}}},...f}=et(e,t),l={x:n,y:r},c=await s.detectOverflow(t,f),d=Ve(tt(o)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",E=h==="y"?"bottom":"right",_=g+c[b],A=g-c[E];g=Dr(_,g,A)}if(i){const b=d==="y"?"top":"left",E=d==="y"?"bottom":"right",_=v+c[b],A=v-c[E];v=Dr(_,v,A)}const w=m.fn({...t,[h]:g,[d]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[d]:i}}}}}},_f=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:r},c=Ve(o),d=so(c);let h=l[d],g=l[c];const v=et(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const _=d==="y"?"height":"width",A=s.reference[d]-s.floating[_]+w.mainAxis,D=s.reference[d]+s.reference[_]-w.mainAxis;h<A?h=A:h>D&&(h=D)}if(f){var b,E;const _=d==="y"?"width":"height",A=Ta.has(tt(o)),D=s.reference[c]-s.floating[_]+(A&&((b=a.offset)==null?void 0:b[c])||0)+(A?0:w.crossAxis),k=s.reference[c]+s.reference[_]+(A?0:((E=a.offset)==null?void 0:E[c])||0)-(A?w.crossAxis:0);g<D?g=D:g>k&&(g=k)}return{[d]:h,[c]:g}}}},Tf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(o),d=qt(o),h=Ve(o)==="y",{width:g,height:v}=s.floating;let w,b;c==="top"||c==="bottom"?(w=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,w=d==="end"?"top":"bottom");const E=v-l.top-l.bottom,_=g-l.left-l.right,A=dt(v-l[w],E),D=dt(g-l[b],_),k=!t.middlewareData.shift;let T=A,x=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=E),k&&!d){const j=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(j!==0||M!==0?j+M:Me(l.left,l.right)):T=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:T});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 ja(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=(ja(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ja(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:r,display:o}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function jf(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 r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ra(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=Pe(o);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(o)?o:[],i&&n?on(i):[])}else return t.concat(o,on(o,[],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,r=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=On(n)!==s||On(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$: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:r,height:o,$:s}=Na(t);let a=(s?On(n.width):n.width)/r,i=(s?On(n.height):n.height)/o;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 Et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(r?$e(r)&&(a=Ut(r)):a=Ut(e));const i=Pf(s,n,r)?Ia(s):Ke(0);let m=(o.left+i.x)/a.x,f=(o.top+i.y)/a.y,l=o.width/a.x,c=o.height/a.y;if(s){const d=Pe(s),h=r&&$e(r)?Pe(r):r;let g=d,v=Fr(g);for(;v&&r&&h!==g;){const w=Ut(v),b=v.getBoundingClientRect(),E=Ue(v),_=b.left+(v.clientLeft+parseFloat(E.paddingLeft))*w.x,A=b.top+(v.clientTop+parseFloat(E.paddingTop))*w.y;m*=w.x,f*=w.y,l*=w.x,c*=w.y,m+=_,f+=A,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Jn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:Et(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Of(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ye(r),i=t?Xn(t.floating):!1;if(r===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(r);if((c||!c&&!s)&&((Yt(r)!=="body"||mn(a))&&(m=Qn(r)),c)){const h=Et(r);f=Ut(r),l.x=h.x+r.clientLeft,l.y=h.y+r.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),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Jn(e);const i=-n.scrollTop;return Ue(r).direction==="rtl"&&(a+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}const ps=25;function Ff(e,t){const n=Pe(e),r=Ye(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,m=0;if(o){s=o.width,a=o.height;const l=co();(!l||l&&t==="fixed")&&(i=o.offsetLeft,m=o.offsetTop)}const f=Jn(r);if(f<=0){const l=r.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(r.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=Et(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=o*s.x,f=r*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let r;if(t==="viewport")r=Ff(e,n);else if(t==="document")r=Lf(Ye(e));else if($e(t))r=$f(t,n);else{const o=Ia(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ln(r)}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 r=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),o=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"&&(o=null),(s?!m&&!o:!m&&i.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||mn(a)&&!m&&Pa(e,a))?r=r.filter(l=>l!==a):o=i,a=ft(a)}return t.set(e,r),r}function zf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Uf(t,this._c):[].concat(n),r],i=hs(t,a[0],o);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],o);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 Hf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Bf(e,t,n){const r=rt(t),o=Ye(t),s=n==="fixed",a=Et(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Jn(o)}if(r||!r&&!s)if((Yt(t)!=="body"||mn(o))&&(i=Qn(t)),r){const h=Et(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else o&&f();s&&!r&&o&&f();const l=o&&!r&&!s?Ma(o,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 o=ft(e);for(;o&&!Wt(o);){if($e(o)&&!xr(o))return o;o=ft(o)}return n}let r=gs(e,t);for(;r&&jf(r)&&xr(r);)r=gs(r,t);return r&&Wt(r)&&xr(r)&&!lo(r)?n:r||If(e)||n}const Wf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,r=await n(e.floating);return{reference:Bf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Ye,getClippingRect:zf,getOffsetParent:Oa,getElementRects:Wf,getClientRects:Df,getDimensions:Hf,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,r;const o=Ye(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),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(o.clientWidth-(l+d)),w=Sn(o.clientHeight-(c+h)),b=Sn(l),_={rootMargin:-g+"px "+-v+"px "+-w+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let A=!0;function D(k){const T=k[0].intersectionRatio;if(T!==m){if(!A)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!Da(f,e.getBoundingClientRect())&&a(),A=!1}try{n=new IntersectionObserver(D,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,_)}n.observe(e)}return a(!0),s}function qf(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=uo(e),l=o||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{o&&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[E]=b;E&&E.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?Et(e):null;m&&w();function w(){const b=Et(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(w)}return n(),()=>{var b;l.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Yf=Af,Xf=Ef,Qf=Cf,Jf=Tf,Zf=Sf,xs=wf,em=_f,tm=(e,t,n)=>{const r=new Map,o={platform:Vf,...n},s={...o.platform,_c:r};return yf(e,t,{...o,platform:s})};var nm=typeof document<"u",rm=function(){},Tn=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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!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 Tn(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,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(r);Fn(d,r)||h(r);const[g,v]=p.useState(null),[w,b]=p.useState(null),E=p.useCallback(H=>{H!==k.current&&(k.current=H,v(H))},[]),_=p.useCallback(H=>{H!==T.current&&(T.current=H,b(H))},[]),A=s||g,D=a||w,k=p.useRef(null),T=p.useRef(null),x=p.useRef(l),y=m!=null,j=vr(m),M=vr(o),O=vr(f),F=p.useCallback(()=>{if(!k.current||!T.current)return;const H={placement:t,strategy:n,middleware:d};M.current&&(H.platform=M.current),tm(k.current,T.current,H).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]);Tn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const I=p.useRef(!1);Tn(()=>(I.current=!0,()=>{I.current=!1}),[]),Tn(()=>{if(A&&(k.current=A),D&&(T.current=D),A&&D){if(j.current)return j.current(A,D,F);F()}},[A,D,F,j,y]);const z=p.useMemo(()=>({reference:k,floating:T,setReference:E,setFloating:_}),[E,_]),S=p.useMemo(()=>({reference:A,floating:D}),[A,D]),C=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!S.floating)return H;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...H,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:C}),[l,F,z,S,C])}const sm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?xs({element:r.current,padding:o}).fn(n):{}:r?xs({element:r,padding:o}).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=Jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=Zf(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:r=10,height:o=5,...s}=e;return u.jsx(ge.svg,{...s,ref:t,width:r,height:o,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 Je(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let 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 r.observe(e,{box:"border-box"}),()=>r.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,[r,o]=p.useState(null);return u.jsx(gm,{scope:t,anchor:r,onAnchorChange:o,children:n})};za.displayName=fo;var Ha="PopperAnchor",Ba=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Ua(Ha,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),r?null:u.jsx(ge.div,{...o,ref:i})});Ba.displayName=Ha;var mo="PopperContent",[xm,vm]=$a(mo),Wa=p.forwardRef((e,t)=>{var G,K,V,ne,J,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=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,w=Ua(mo,n),[b,E]=p.useState(null),_=ke(t,ue=>E(ue)),[A,D]=p.useState(null),k=hm(A),T=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=r+(s!=="center"?"-"+s:""),j=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:j,boundary:M.filter(ym),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:C,middlewareData:H}=om({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>qf(...ue,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[am({mainAxis:o+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,xe=ue.floating.style;xe.setProperty("--radix-popper-available-width",`${de}px`),xe.setProperty("--radix-popper-available-height",`${ye}px`),xe.setProperty("--radix-popper-anchor-width",`${fe}px`),xe.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),A&&fm({element:A,padding:i}),wm({arrowWidth:T,arrowHeight:x}),d&&dm({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Ze(g);Je(()=>{C&&(q==null||q())},[C,q]);const N=(G=H.arrow)==null?void 0:G.x,L=(K=H.arrow)==null?void 0:K.y,$=((V=H.arrow)==null?void 0:V.centerOffset)!==0,[R,B]=p.useState();return Je(()=>{b&&B(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=H.transformOrigin)==null?void 0:ne.x,(J=H.transformOrigin)==null?void 0:J.y].join(" "),...((re=H.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(xm,{scope:n,placedSide:P,onArrowChange:D,arrowX:N,arrowY:L,shouldHideArrow:$,children:u.jsx(ge.div,{"data-side":P,"data-align":U,...v,ref:_,style:{...v.style,animation:C?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:r,...o}=t,s=vm(Ga,r),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,{...o,ref:n,style:{...o.style,display:"block"}})})});Va.displayName=Ga;function ym(e){return e!==null}var wm=e=>({name:"transformOrigin",options:e,fn(t){var w,b,E;const{placement:n,rects:r,middlewareData:o}=t,a=((w=o.arrow)==null?void 0:w.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=o.arrow)==null?void 0:b.x)??0)+i/2,h=(((E=o.arrow)==null?void 0:E.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=`${r.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${r.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,Zn=Ba,ho=Wa,go=Va,Cm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,s]=p.useState(!1);Je(()=>s(!0),[]);const a=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(ge.div,{...r,ref:t}),a):null});pn.displayName=Cm;function Sm(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Oe=e=>{const{present:t,children:n}=e,r=km(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=ke(r.ref,Am(o));return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:s}):null};Oe.displayName="Presence";function km(e){const[t,n]=p.useState(),r=p.useRef(null),o=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(r.current);s.current=i==="mounted"?f:"none"},[i]),Je(()=>{const f=r.current,l=o.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"),o.current=e}},[e,m]),Je(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},d=h=>{h.target===t&&(s.current=kn(r.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=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Am(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",Em={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,_m]=Ca(hn),[Tm,Ya]=nt(hn,[_m]),[jm,Rm]=Tm(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:r,loop:o=!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,w]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,E]=p.useState(!1),_=Ze(f),A=qa(n),D=p.useRef(!1),[k,T]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,_),()=>x.removeEventListener(br,_)},[_]),u.jsx(jm,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:p.useCallback(x=>w(x),[w]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>T(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>T(x=>x-1),[]),children:u.jsx(ge.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{D.current=!0}),onFocus:te(e.onFocus,x=>{const y=!D.current;if(x.target===x.currentTarget&&y&&!b){const j=new CustomEvent(br,Em);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const M=A().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);Za(z,l)}}D.current=!1}),onBlur:te(e.onBlur,()=>E(!1))})})}),Qa="RovingFocusGroupItem",Ja=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!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(r)return h(),()=>g()},[r,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(ge.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,w=>{r?l.onItemFocus(f):w.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){l.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const b=Pm(w,l.orientation,l.dir);if(b!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let _=d().filter(A=>A.focusable).map(A=>A.ref.current);if(b==="last")_.reverse();else if(b==="prev"||b==="next"){b==="prev"&&_.reverse();const A=_.indexOf(w.currentTarget);_=l.loop?Om(_,A+1):_.slice(A+1)}setTimeout(()=>Za(_))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Ja.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 r=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Im[r]}function Za(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Om(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dm=Xa,Lm=Ja,Fm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,An=new WeakMap,En={},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 r=ei(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Um=function(e,t,n,r){var o=$m(t,Array.isArray(e)?e:[e]);En[n]||(En[n]=new WeakMap);var s=En[n],a=[],i=new Set,m=new Set(o),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};o.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(r),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,w=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,w),a.push(d),v===1&&g&&An.set(d,!0),w===1&&d.setAttribute(n,"true"),g||d.setAttribute(r,"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||(An.has(c)||c.removeAttribute(r),An.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,An=new WeakMap,En={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Fm(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Um(r,o,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],zm=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],Hm=[...zm,...ti],Bm={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:r,dir:o,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Ze(s),d=Sa(o);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:r})})})};oi.displayName=gn;var Ym="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(Zn,{...o,...r,ref:t})});vo.displayName=Ym;var bo="MenuPortal",[Xm,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=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:o,children:r})})})};ai.displayName=bo;var De="MenuContent",[Qm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Jm,{...o,ref:t}):u.jsx(Zm,{...o,ref:t})})})})}),Jm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Zm=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=Bt("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,w=It(De,n),b=xn(De,n),E=er(n),_=ri(n),A=Gm(n),[D,k]=p.useState(null),T=p.useRef(null),x=ke(t,T,w.onContentChange),y=p.useRef(0),j=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Zr:p.Fragment,S=g?{as:ep,allowPinchZoom:!0}:void 0,C=P=>{var G,K;const U=j.current+P,q=A().filter(V=>!V.disabled),N=document.activeElement,L=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=fp($,U,L),B=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){j.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const H=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:j,onItemEnter:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),onItemLeave:p.useCallback(P=>{var U;H(P)||((U=T.current)==null||U.focus(),k(null))},[H]),onTriggerLeave:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:o,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=T.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,..._,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:D,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(w.open),"data-radix-menu-content":"",dir:b.dir,...E,...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,L=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&L&&C(P.key));const $=T.current;if(P.target!==$||!Hm.includes(P.key))return;P.preventDefault();const B=A().filter(G=>!G.disabled).map(G=>G.ref.current);ti.includes(P.key)&&B.reverse(),up(B)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),j.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,...r}=e;return u.jsx(ge.div,{role:"group",...r,ref:t})});Co.displayName=tp;var np="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{...r,ref:t})});li.displayName=np;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=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=>r==null?void 0:r(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...o,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:r=!1,textValue:o,...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:r,textValue:o??d,children:u.jsx(Lm,{asChild:!0,...i,focusable:!r,children:u.jsx(ge.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{r?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:r,...o}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...o,ref:t,"data-state":ko(n),onSelect:te(o.onSelect,()=>r==null?void 0:r(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:r,...o}=e,s=Ze(r);return u.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...o,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=sp(mi,e.__scopeMenu),s=n===o.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":ko(s),onSelect:te(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,ap]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=ap(So,n);return u.jsx(Oe,{present:r||Un(s.checked)||s.checked===!0,children:u.jsx(ge.span,{...o,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ip="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});xi.displayName=ip;var lp="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(go,{...o,...r,ref:t})});vi.displayName=lp;var cp="MenuSub",[Ib,bi]=Nt(cp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),r=xn(rn,e.__scopeMenu),o=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:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Si(n.open),...e,ref:qe(t,o.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,w=v==="right",b=w?-5:5,E=d[w?"left":"right"],_=d[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:E,y:d.top},{x:_,y:d.top},{x:_,y:d.bottom},{x:E,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===" "||Bm[r.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:r=n.forceMount,...o}=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:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...o,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,r)=>e[(t+r)%e.length])}function fp(e,t,n){const o=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));o.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return m!==n?m:void 0}function mp(e,t){const{x:n,y:r}=e;let o=!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>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}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,Ap=gi,Ep=xi,_p=vi,Tp=yi,jp=Ci,nr="DropdownMenu",[Rp]=nt(nr,[ni]),Ne=ni(),[Np,ki]=Rp(nr),Ai=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:o,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:r,modal:i,children:n})})};Ai.displayName=nr;var Ei="DropdownMenuTrigger",_i=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=ki(Ei,n),a=Ne(n);return u.jsx(gp,{asChild:!0,...a,children:u.jsx(ge.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":r?"":void 0,disabled:r,...o,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});_i.displayName=Ei;var Ip="DropdownMenuPortal",Ti=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return u.jsx(xp,{...r,...n})};Ti.displayName=Ip;var ji="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ki(ji,n),s=Ne(n),a=p.useRef(!1);return u.jsx(vp,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=o.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;(!o.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=ji;var Mp="DropdownMenuGroup",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(bp,{...o,...r,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(yp,{...o,...r,ref:t})});Ni.displayName=Op;var Dp="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(wp,{...o,...r,ref:t})});Ii.displayName=Dp;var Lp="DropdownMenuCheckboxItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Cp,{...o,...r,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuRadioGroup",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Sp,{...o,...r,ref:t})});Up.displayName=$p;var zp="DropdownMenuRadioItem",Hp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(kp,{...o,...r,ref:t})});Hp.displayName=zp;var Bp="DropdownMenuItemIndicator",Wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ap,{...o,...r,ref:t})});Wp.displayName=Bp;var Gp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ep,{...o,...r,ref:t})});Mi.displayName=Gp;var Vp="DropdownMenuArrow",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(_p,{...o,...r,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSubTrigger",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Tp,{...o,...r,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuSubContent",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(jp,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qp.displayName=Xp;var Jp=Ai,Zp=_i,eh=Ti,th=Ri,nh=Ni,rh=Ii,oh=Mi;function Pi({...e}){return u.jsx(Jp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Zp,{"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 jn({className:e,inset:t,variant:n="default",...r}){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),...r})}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(Bu,{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(r=>u.jsxs(jn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,u.jsx("span",{className:"ml-2",children:r.label})]},r.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.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","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":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此 artifact","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的 artifacts 提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此 Artifact,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该 Artifact 关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为 Artifact","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},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.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","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","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},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 Ao=ch();const zr=new Set;function Mb(e){Ao=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,()=>Ao)}function Fe(e){return Ao==="en"?lh[e]??ws[e]??e:ws[e]??e}const dh="";let zn=null;function fh(e){zn=e}function Pb(){return zn}let Hr=null;function Cs(e){Hr=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,r,o){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=r,this.status=o}}async function he(e,t,n,r){const o={"Content-Type":"application/json"};zn&&(o.Authorization=`Bearer ${zn}`);const s=`${dh}${t}`,a={method:e,headers:o,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(!r&&await mh())return he(e,t,n,!0);Hr&&Hr()}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 Ob(){return he("GET","/web/sessions")}function Db(){return he("GET","/web/sessions/all")}function Lb(e){return he("GET",`/web/sessions/${e}`)}function Fb(e){return he("GET",`/web/sessions/${e}/history`)}function $b(e){return he("GET",`/web/sessions/${e}/models`)}function Ub(){return he("GET","/web/environments")}function zb(e,t){return he("POST",`/web/sessions/${e}/events`,t)}function Hb(e,t){return he("POST",`/web/sessions/${e}/control`,t)}function Bb(e){return he("POST",`/web/sessions/${e}/interrupt`)}function Wb(e){return he("DELETE",`/web/sessions/${e}`)}function Gb(e){return he("POST",`/web/sessions/${e}/clear`)}function Vb(e,t){return he("PATCH",`/web/sessions/${e}`,{title:t})}function Kb(e){return he("POST","/web/sessions",e)}function qb(e){return he("GET",`/web/sessions/s/${e}`)}function Yb(e){return he("GET",`/web/sessions/${e}/shares`)}function Xb(e,t){return he("POST",`/web/sessions/${e}/shares`,t)}function Qb(e,t){return he("DELETE",`/web/sessions/${e}/shares/${t}`)}function Jb(e,t){return he("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Zb(e,t){return he("DELETE",`/web/teams/${e}/environments/${t}`)}function ey(e){return he("POST","/web/environments/claim",{claim_token:e})}function ty(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return he("GET",`/web/artifacts${r}`)}function ny(e){return he("GET",`/web/artifacts/${e}`)}function ry(e){return he("POST","/web/artifacts",e)}function oy(e){return he("DELETE",`/web/artifacts/${e}`)}const Br="rcs_active_team";function ph(){try{return localStorage.getItem(Br)}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(Br,e):localStorage.removeItem(Br)}catch{}$i=e,hh()}function vh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),o=p.useSyncExternalStore(gh,xh,()=>null),s=p.useCallback(async()=>{r(!0);try{const f=await he("GET","/web/teams");t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===o)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await he("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:r,isLoading:o}=vh();return o||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;r(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 wh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function _n(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Ch({children:e}){const[t,n]=p.useState(null),[r,o]=p.useState(!0),[s,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let w=!1;return Dt().then(b=>{w||(n(b),o(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(b=>b.json()).then(b=>{w||a(b.allowed===!0)}).catch(()=>{}),wh().then(b=>{w||m(b)}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{w=!0,Cs(null)}},[]);const f=p.useCallback(async(w,b)=>{const E=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:b})});if(!E.ok){const A=await _n(E);throw new Error(A.error||"Login failed")}const _=await Dt();n(_),Ct(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const b=await Dt();return n(b),!0}catch{return!1}},[]),d=p.useCallback(async(w,b,E)=>{const _=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:w,username:b,password:E})});if(!_.ok){const D=await _n(_);throw new Error(D.error||"Setup failed")}const A=await Dt();n(A),Ct(null)},[]),h=p.useCallback(async(w,b,E)=>{const _=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:w,username:b,password:E})});if(!_.ok){const D=await _n(_);throw new Error(D.error||"Join failed")}const A=await Dt();n(A),Ct(null)},[]),g=p.useCallback(async(w,b)=>{const E=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:b})});if(!E.ok){const A=await _n(E);throw new Error(A.error||"Registration failed")}const _=await Dt();n(_),Ct(null)},[]),v=p.useCallback(async()=>yh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:d,join:h,register:g,checkSetupStatus:v,registrationAllowed:s,singleUserMode:i},children:e})}function Sh({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const r=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(jn,{onClick:e,children:[u.jsx(sd,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(jn,{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(jn,{onClick:r,children:[u.jsx($u,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function kh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:o}){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")})]}),o&&u.jsxs("button",{type:"button",onClick:o,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(Sh,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function sy({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 Ah(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Hi 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 r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.resume)!==null}get supportsSessionList(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Ah(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=o=>{if(this.ws===r)try{const s=JSON.parse(o.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},r.onerror=()=>{var o;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(o=this.connectReject)==null||o.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=o=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",o.code,o.reason),this.connectReject){const s=o.reason||`Connection closed (code: ${o.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(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,o,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=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(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),(o=this.onErrorMessage)==null||o.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 w=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",w,"payload:",t.payload),w==="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(w==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(w==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(w==="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 r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=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 r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const o=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:o};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(o),this.pendingSessionList=null,r(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:o};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:o};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Hi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};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(r){if(r!=="default"&&!(r in e)){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Bi(e,t){return new Promise((function(n,r){let o;return _h(e).then((function(s){try{return o=s,n(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const _h=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:o}})=>{const s=new DataView(o);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(o.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Hn={},Th={get exports(){return Hn},set exports(e){Hn=e}};(function(e){var t,n,r={};Th.exports=r,r.parse=function(o,s){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(o),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 w=i(l,m+=4),b=a(l,m+=4),E=a(l,m+2),_=a(l,m+4);m+=6;var A=i(l,m+=8);m+=4,m+=b+E+_,r._readLocal(l,A,f,h,w,s)}return f},r._readLocal=function(o,s,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(o,s),l(o,s+=4),l(o,s+=2);var d=l(o,s+=2);c(o,s+=2),c(o,s+=4),s+=4;var h=l(o,s+=8),g=l(o,s+=2);s+=2;var v=r.bin.readUTF8(o,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var w=new Uint8Array(o.buffer,s);if(d==0)a[v]=new Uint8Array(w.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);r.inflateRaw(w,b),a[v]=b}}},r.inflateRaw=function(o,s){return r.F.inflate(o,s)},r.inflate=function(o,s){return o[0],o[1],r.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),s)},r.deflate=function(o,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*o.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(o,i,a,s.level);var m=r.adler(o,0,o.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(o,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*o.length)),i=r.F.deflateRaw(o,a,i,s.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(o,s){s==null&&(s=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in o){var c=!r._noNeed(l)&&!s,d=o[l],h=r.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?r.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,w=[];for(var l in f){var b=f[l];w.push(v),v=r._writeHeader(g,v,l,b,0)}var E=0,_=v;for(var l in f)b=f[l],w.push(v),v=r._writeHeader(g,v,l,b,1,w[E++]);var A=v-_;return i(g,v,101010256),v+=4,m(g,v+=4,E),m(g,v+=2,E),i(g,v+=2,A),i(g,v+=4,_),v+=4,v+=2,g.buffer},r._noNeed=function(o){var s=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},r._writeHeader=function(o,s,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,d=i.file;return l(o,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(o,s,20),c(o,s+=2,0),c(o,s+=2,i.cpr?8:0),l(o,s+=2,0),l(o,s+=4,i.crc),l(o,s+=4,d.length),l(o,s+=4,i.usize),c(o,s+=4,r.bin.sizeUTF8(a)),c(o,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(o,s+=6,f),s+=4),s+=r.bin.writeUTF8(o,s,a),m==0&&(o.set(d,s),s+=d.length),s},r.crc={table:(function(){for(var o=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;o[s]=a}return o})(),update:function(o,s,a,i){for(var m=0;m<i;m++)o=r.crc.table[255&(o^s[a+m])]^o>>>8;return o},crc:function(o,s,a){return 4294967295^r.crc.update(4294967295,o,s,a)}},r.adler=function(o,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+=o[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(o,s){return o[s]|o[s+1]<<8},writeUshort:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255},readUint:function(o,s){return 16777216*o[s+3]+(o[s+2]<<16|o[s+1]<<8|o[s])},writeUint:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255,o[s+2]=a>>16&255,o[s+3]=a>>24&255},readASCII:function(o,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(o[s+m]);return i},writeASCII:function(o,s,a){for(var i=0;i<a.length;i++)o[s+i]=a.charCodeAt(i)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(o[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(o,s,a)}return i},writeUTF8:function(o,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)o[s+m]=l,m++;else if((4294965248&l)==0)o[s+m]=192|l>>6,o[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)o[s+m]=224|l>>12,o[s+m+1]=128|l>>6&63,o[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";o[s+m]=240|l>>18,o[s+m+1]=128|l>>12&63,o[s+m+2]=128|l>>6&63,o[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(o){for(var s=o.length,a=0,i=0;i<s;i++){var m=o.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(o,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=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,d=0,h=a<<3,g=0,v=o.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=r.F._copyExact(o,d,M,s,h+8),d+=M;return h>>>3}var w=f.lits,b=f.strt,E=f.prev,_=0,A=0,D=0,k=0,T=0,x=0;for(v>2&&(b[x=r.F._hash(o,0)]=0),d=0;d<v;d++){if(T=x,d+1<v-2){x=r.F._hash(o,d+1);var y=d+1&32767;E[y]=b[x],b[x]=y}if(g<=d){(_>14e3||A>26697)&&v-d>100&&(g<d&&(w[_]=d-g,_+=2,g=d),h=r.F._writeBlock(d==v-1||g==v?1:0,w,_,k,o,D,d-D,s,h),_=A=k=0,D=d);var j=0;d<v-2&&(j=r.F._bestMatch(o,d,E,T,Math.min(m[2],v-d),m[3]));var M=j>>>16,O=65535&j;if(j!=0){O=65535&j;var F=l(M=j>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],w[_]=M<<23|d-g,w[_+1]=O<<16|F<<8|I,_+=2,g=d+M}else f.lhst[o[d]]++;A++}}for(D==d&&o.length!=0||(g<d&&(w[_]=d-g,_+=2,g=d),h=r.F._writeBlock(1,w,_,k,o,D,d-D,s,h),_=0,A=0,_=A=k=0,D=d);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(o,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=r.F._hash(o,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||o[s+h]==o[s+h-d]){var w=r.F._howLong(o,s,d);if(w>h){if(g=d,(h=w)>=m)break;d+2<w&&(w=d+2);for(var b=0,E=0;E<w-2;E++){var _=s-d+E+32768&32767,A=_-a[_]+32768&32767;A>b&&(b=A,c=_)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},r.F._howLong=function(o,s,a){if(o[s]!=o[s-a]||o[s+1]!=o[s+1-a]||o[s+2]!=o[s+2-a])return 0;var i=s,m=Math.min(o.length,s+258);for(s+=3;s<m&&o[s]==o[s-a];)s++;return s-i},r.F._hash=function(o,s){return(o[s]<<8|o[s+1])+(o[s+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(o,s,a,i,m,f,l,c,d){var h,g,v,w,b,E,_,A,D,k=r.F.U,T=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(h=r.F.getTrees())[0],v=h[1],w=h[2],b=h[3],E=h[4],_=h[5],A=h[6],D=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),j=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),M=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);M+=14+3*_+r.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<j&&y<M?0:j<M?1:2;if(T(c,d,o),T(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=r.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,v),r.F.revCodes(k.dtree,v),r.F.makeCodes(k.itree,w),r.F.revCodes(k.itree,w),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,E-1),x(c,d+=5,_-4),d+=4;for(var S=0;S<_;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*_,d=r.F._codeTiny(A,k.itree,c,d),d=r.F._codeTiny(D,k.itree,c,d)}for(var C=f,H=0;H<a;H+=2){for(var P=s[H],U=P>>>23,q=C+(8388607&P);C<q;)d=r.F._writeLit(m[C++],I,c,d);if(U!=0){var N=s[H+1],L=N>>16,$=N>>8&255,R=255&N;x(c,d=r.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],T(c,d=r.F._writeLit(R,z,c,d),L-k.df0[R]),d+=k.dxb[R],C+=U}}d=r.F._writeLit(256,I,c,d)}return d},r.F._copyExact=function(o,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(o.buffer,s,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var o=r.F.U,s=r.F._hufTree(o.lhst,o.ltree,15),a=r.F._hufTree(o.dhst,o.dtree,15),i=[],m=r.F._lenCodes(o.ltree,i),f=[],l=r.F._lenCodes(o.dtree,f),c=0;c<i.length;c+=2)o.ihst[i[c]]++;for(c=0;c<f.length;c+=2)o.ihst[f[c]]++;for(var d=r.F._hufTree(o.ihst,o.itree,7),h=19;h>4&&o.itree[1+(o.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},r.F.getSecond=function(o){for(var s=[],a=0;a<o.length;a+=2)s.push(o[a+1]);return s},r.F.nonZero=function(o){for(var s="",a=0;a<o.length;a+=2)o[a+1]!=0&&(s+=(a>>1)+",");return s},r.F.contSize=function(o,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*o[1+(i<<1)];return a},r.F._codeTiny=function(o,s,a,i){for(var m=0;m<o.length;m+=2){var f=o[m],l=o[m+1];i=r.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(o,s){for(var a=o.length;a!=2&&o[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=o[i+1],f=i+3<a?o[i+3]:-1,l=i+5<a?o[i+5]:-1,c=i==0?-1:o[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&o[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&&o[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},r.F._hufTree=function(o,s,a){var i=[],m=o.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++)o[l]!=0&&i.push({lit:l,f:o[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(A,D){return A.f-D.f}));var g=i[0],v=i[1],w=0,b=1,E=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=w!=b&&(E==c||i[w].f<i[E].f)?i[w++]:i[E++],v=w!=b&&(E==c||i[w].f<i[E].f)?i[w++]:i[E++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var _=r.F.setDepth(i[b-1],0);for(_>a&&(r.F.restrictDepth(d,a,_),_=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return _},r.F.setDepth=function(o,s){return o.lit!=-1?(o.d=s,s):Math.max(r.F.setDepth(o.l,s+1),r.F.setDepth(o.r,s+1))},r.F.restrictDepth=function(o,s,a){var i=0,m=1<<a-s,f=0;for(o.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<o.length&&o[i].d>s;i++){var l=o[i].d;o[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=o[i].d)<s?(o[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)o[i].d==s&&f<0&&(o[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(o,s){var a=0;return s[16|a]<=o&&(a|=16),s[8|a]<=o&&(a|=8),s[4|a]<=o&&(a|=4),s[2|a]<=o&&(a|=2),s[1|a]<=o&&(a|=1),a},r.F._writeLit=function(o,s,a,i){return r.F._putsF(a,i,s[o<<1]),i+s[1+(o<<1)]},r.F.inflate=function(o,s){var a=Uint8Array;if(o[0]==3&&o[1]==0)return s||new a(0);var i=r.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(o.length>>>2<<3));for(var w,b,E=0,_=0,A=0,D=0,k=0,T=0,x=0,y=0,j=0;E==0;)if(E=m(o,j,1),_=m(o,j+1,2),j+=3,_!=0){if(v&&(s=r.F._check(s,y+(1<<17))),_==1&&(w=g.flmap,b=g.fdmap,T=511,x=31),_==2){A=f(o,j,5)+257,D=f(o,j+5,5)+1,k=f(o,j+10,4)+4,j+=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(o,j+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}j+=3*k,c(g.itree,O),d(g.itree,O,g.imap),w=g.lmap,b=g.dmap,j=l(g.imap,(1<<O)-1,A+D,o,j,g.ttree);var I=i._copyOut(g.ttree,0,A,g.ltree);T=(1<<I)-1;var z=i._copyOut(g.ttree,A,D,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,w),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=w[h(o,j)&T];j+=15&S;var C=S>>>4;if(!(C>>>8))s[y++]=C;else{if(C==256)break;var H=y+C-254;if(C>264){var P=g.ldef[C-257];H=y+(P>>>3)+f(o,j,7&P),j+=7&P}var U=b[h(o,j)&x];j+=15&U;var q=U>>>4,N=g.ddef[q],L=(N>>>4)+m(o,j,15&N);for(j+=15&N,v&&(s=r.F._check(s,y+(1<<17)));y<H;)s[y]=s[y++-L],s[y]=s[y++-L],s[y]=s[y++-L],s[y]=s[y++-L];y=H}}}else{(7&j)!=0&&(j+=8-(7&j));var $=4+(j>>>3),R=o[$-4]|o[$-3]<<8;v&&(s=r.F._check(s,y+R)),s.set(new a(o.buffer,o.byteOffset+$,R),y),j=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},r.F._check=function(o,s){var a=o.length;if(s<=a)return o;var i=new Uint8Array(Math.max(a<<1,s));return i.set(o,0),i},r.F._decodeTiny=function(o,s,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,d=0;d<a;){var h=o[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,w=0;g==16?(w=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(w=3+l(i,m,3),m+=3):g==18&&(w=11+l(i,m,7),m+=7);for(var b=d+w;d<b;)f[d]=v,d++}}return m},r.F._copyOut=function(o,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=o[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},r.F.makeCodes=function(o,s){for(var a,i,m,f,l=r.F.U,c=o.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[o[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=o[m+1])!=0&&(o[m]=g[f],g[f]++)},r.F.codes2map=function(o,s,a){for(var i=o.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(o[f+1]!=0)for(var l=f>>1,c=o[f+1],d=l<<4|c,h=s-c,g=o[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},r.F.revCodes=function(o,s){for(var a=r.F.U.rev15,i=15-s,m=0;m<o.length;m+=2){var f=o[m]<<s-o[m+1];o[m]=a[f]>>>i}},r.F._putsE=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8},r.F._putsF=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8,o[i+2]|=a>>>16},r.F._bitsE=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},r.F._bitsF=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},r.F._get17=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)},r.F._get25=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16|o[3+(s>>>3)]<<24)>>>(7&s)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=r.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,o.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++)o.ldef[s]=o.of0[s]<<3|o.exb[s],o.ddef[s]=o.df0[s]<<4|o.dxb[s];i(o.fltree,144,8),i(o.fltree,112,9),i(o.fltree,24,7),i(o.fltree,8,8),r.F.makeCodes(o.fltree,9),r.F.codes2map(o.fltree,9,o.flmap),r.F.revCodes(o.fltree,9),i(o.fdtree,32,5),r.F.makeCodes(o.fdtree,5),r.F.codes2map(o.fdtree,5,o.fdmap),r.F.revCodes(o.fdtree,5),i(o.itree,19,0),i(o.ltree,286,0),i(o.dtree,30,0),i(o.ttree,320,0)})()})();var jh=Eh({__proto__:null,default:Hn},[Hn]);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),w=Math.ceil(c*v/8),b=new Uint8Array(4*g),E=new Uint32Array(b.buffer),{ctype:_}=h,{depth:A}=h,D=e.readUshort;if(_==6){const P=g<<2;if(A==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(A==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(_==2){const P=h.tabs.tRNS;if(P==null){if(A==8)for(k=0;k<g;k++){var T=3*k;E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T]}if(A==16)for(k=0;k<g;k++)T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T]}else{var x=P[0];const U=P[1],q=P[2];if(A==8)for(k=0;k<g;k++){var y=k<<2;T=3*k,E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T],l[T]==x&&l[T+1]==U&&l[T+2]==q&&(b[y+3]=0)}if(A==16)for(k=0;k<g;k++)y=k<<2,T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T],D(l,T)==x&&D(l,T+2)==U&&D(l,T+4)==q&&(b[y+3]=0)}}else if(_==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(A==1)for(var j=0;j<d;j++){var M=j*w,O=j*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(A==2)for(j=0;j<d;j++)for(M=j*w,O=j*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(A==4)for(j=0;j<d;j++)for(M=j*w,O=j*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(A==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(_==4){if(A==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(A==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(_==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,j=0;j<d;j++){const P=j*w,U=j*c;if(A==1)for(var C=0;C<c;C++){var H=(z=255*(l[P+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;E[U+C]=H<<24|z<<16|z<<8|z}else if(A==2)for(C=0;C<c;C++)H=(z=85*(l[P+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==4)for(C=0;C<c;C++)H=(z=17*(l[P+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==8)for(C=0;C<c;C++)H=(z=l[P+C])==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==16)for(C=0;C<c;C++)z=l[P+(C<<1)],H=D(l,P+(C<<1))==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),w=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?o(c,w):r(c,w),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(E,_){const A=_.width,D=_.height,k=s(_),T=k>>3,x=Math.ceil(A*k/8),y=new Uint8Array(D*x);let j=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 C=F[z],H=I[z];let P=0,U=0,q=M[z];for(;q<D;)q+=C,U++;let N=O[z];for(;N<A;)N+=H,P++;const L=Math.ceil(P*k/8);a(E,_,j,P,U);let $=0,R=M[z];for(;R<D;){let B=O[z],G=j+$*L<<3;for(;B<A;){var S;if(k==1&&(S=(S=E[G>>3])>>7-(7&G)&1,y[R*x+(B>>3)]|=S<<7-((7&B)<<0)),k==2&&(S=(S=E[G>>3])>>6-(7&G)&3,y[R*x+(B>>2)]|=S<<6-((3&B)<<1)),k==4&&(S=(S=E[G>>3])>>4-(7&G)&15,y[R*x+(B>>1)]|=S<<4-((1&B)<<2)),k>=8){const K=R*x+B*T;for(let V=0;V<T;V++)y[K+V]=E[(G>>3)+V]}G+=k,B+=H}$++,R+=C}P*U!=0&&(j+=U*(1+L)),z+=1}return y})(c,l)),c}function r(l,c){return o(new Uint8Array(l.buffer,2,l.length-6),c)}var o=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,w=0,b=0,E=0,_=0,A=0,D=0,k=0,T=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,j=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,C=d==null;for(C&&(d=new h(c.length>>>2<<5));w==0;)if(w=j(c,x,1),b=j(c,x+1,2),x+=3,b!=0){if(C&&(d=l.H.W(d,T+(1<<17))),b==1&&(g=S.J,v=S.h,D=511,k=31),b==2){E=M(c,x,5)+257,_=M(c,x+5,5)+1,A=M(c,x+10,4)+4,x+=14;let P=1;for(var H=0;H<38;H+=2)S.Q[H]=0,S.Q[H+1]=0;for(H=0;H<A;H++){const N=M(c,x+3*H,3);S.Q[1+(S.X[H]<<1)]=N,N>P&&(P=N)}x+=3*A,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,E+_,c,x,S.v);const U=y.V(S.v,0,E,S.C);D=(1<<U)-1;const q=y.V(S.v,E,_,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)&D];x+=15&P;const U=P>>>4;if(!(U>>>8))d[T++]=U;else{if(U==256)break;{let q=T+U-254;if(U>264){const B=S.q[U-257];q=T+(B>>>3)+M(c,x,7&B),x+=7&B}const N=v[z(c,x)&k];x+=15&N;const L=N>>>4,$=S.c[L],R=($>>>4)+j(c,x,15&$);for(x+=15&$;T<q;)d[T]=d[T++-R],d[T]=d[T++-R],d[T]=d[T++-R],d[T]=d[T++-R];T=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;C&&(d=l.H.W(d,T+U)),d.set(new h(c.buffer,c.byteOffset+P,U),T),x=P+U<<3,T+=U}return d.length==T?d:d.slice(0,T)},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,w){const b=l.H.e,E=l.H.Z;let _=0;for(;_<h;){const A=c[E(g,v)&d];v+=15&A;const D=A>>>4;if(D<=15)w[_]=D,_++;else{let k=0,T=0;D==16?(T=3+b(g,v,2),v+=2,k=w[_-1]):D==17?(T=3+b(g,v,3),v+=3):D==18&&(T=11+b(g,v,7),v+=7);const x=_+T;for(;_<x;)w[_]=k,_++}}return v},l.H.V=function(c,d,h,g){let v=0,w=0;const b=g.length>>>1;for(;w<h;){const E=c[w+d];g[w<<1]=0,g[1+(w<<1)]=E,E>v&&(v=E),w++}for(;w<b;)g[w<<1]=0,g[1+(w<<1)]=0,w++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,w,b,E;const _=h.j;for(var A=0;A<=d;A++)_[A]=0;for(A=1;A<g;A+=2)_[c[A]]++;const D=h.K;for(v=0,_[0]=0,w=1;w<=d;w++)v=v+_[w-1]<<1,D[w]=v;for(b=0;b<g;b+=2)E=c[b+1],E!=0&&(c[b]=D[E],D[E]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let w=0;w<g;w+=2)if(c[w+1]!=0){const b=w>>1,E=c[w+1],_=b<<4|E,A=d-E;let D=c[w]<<A;const k=D+(1<<A);for(;D!=k;)h[v[D]>>>15-d]=_,D++}},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 w=c[v]<<d-c[v+1];c[v]=h[w]>>>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,w){for(;v--!=0;)g.push(0,w)}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 w=Math.ceil(h*v/8);let b,E;v=Math.ceil(v/8);let _=l[d],A=0;if(_>1&&(l[d]=[0,0,1][_-2]),_==3)for(A=v;A<w;A++)l[A+1]=l[A+1]+(l[A+1-v]>>>1)&255;for(let D=0;D<g;D++)if(b=d+D*w,E=b+D+1,_=l[E-1],A=0,_==0)for(;A<w;A++)l[b+A]=l[E+A];else if(_==1){for(;A<v;A++)l[b+A]=l[E+A];for(;A<w;A++)l[b+A]=l[E+A]+l[b+A-v]}else if(_==2)for(;A<w;A++)l[b+A]=l[E+A]+l[b+A-w];else if(_==3){for(;A<v;A++)l[b+A]=l[E+A]+(l[b+A-w]>>>1);for(;A<w;A++)l[b+A]=l[E+A]+(l[b+A-w]+l[b+A-v]>>>1)}else{for(;A<v;A++)l[b+A]=l[E+A]+i(0,l[b+A-w],0);for(;A<w;A++)l[b+A]=l[E+A]+i(l[b+A-v],l[b+A-w],l[b+A-v-w])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,w=h-d;return g*g<=v*v&&g*g<=w*w?l:v*v<=w*w?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,w,b,E){const _=Math.min(c,g),A=Math.min(d,v);let D=0,k=0;for(let z=0;z<A;z++)for(let S=0;S<_;S++)if(w>=0&&b>=0?(D=z*c+S<<2,k=(b+z)*g+w+S<<2):(D=(-b+z)*c-w+S<<2,k=z*g+S<<2),E==0)h[k]=l[D],h[k+1]=l[D+1],h[k+2]=l[D+2],h[k+3]=l[D+3];else if(E==1){var T=l[D+3]*.00392156862745098,x=l[D]*T,y=l[D+1]*T,j=l[D+2]*T,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const C=1-T,H=T+M*C,P=H==0?0:1/H;h[k+3]=255*H,h[k+0]=(x+O*C)*P,h[k+1]=(y+F*C)*P,h[k+2]=(j+I*C)*P}else if(E==2)T=l[D+3],x=l[D],y=l[D+1],j=l[D+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],T==M&&x==O&&y==F&&j==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]=j,h[k+3]=T);else if(E==3){if(T=l[D+3],x=l[D],y=l[D+1],j=l[D+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],T==M&&x==O&&y==F&&j==I)continue;if(T<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,w=g.readUint,b={tabs:{},frames:[]},E=new Uint8Array(d.length);let _,A=0,D=0;const k=[137,80,78,71,13,10,26,10];for(var T=0;T<8;T++)if(d[T]!=k[T])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 C=d.slice(x+2,h+z);let H=null;try{H=r(C)}catch{H=o(C)}b.tabs[S]=H}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(T=0;T<z;T++)E[A+T]=d[h+T];A+=z}else if(S=="acTL")b.tabs[S]={num_frames:w(d,h),num_plays:w(d,h+4)},_=new Uint8Array(d.length);else if(S=="fcTL"){D!=0&&((I=b.frames[b.frames.length-1]).data=n(b,_.slice(0,D),I.rect.width,I.rect.height),D=0);const C={x:w(d,h+12),y:w(d,h+16),width:w(d,h+4),height:w(d,h+8)};let H=v(d,h+22);H=v(d,h+20)/(H==0?100:H);const P={rect:C,delay:Math.round(1e3*H),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(T=0;T<z-4;T++)_[D+T]=d[h+T+4];D+=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]=[],T=0;T<8;T++)b.tabs[S].push(g.readUint(d,h+4*T));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),j=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=r(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][j]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),j=g.readASCII(d,x,y-x);const C=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),C==0?F=g.readUTF8(d,x,M):(O=r(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][j]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const C=b.tabs.PLTE.length/3;for(b.tabs[S]=[],T=0;T<C;T++)b.tabs[S].push(v(d,h+2*T))}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 D!=0&&((I=b.frames[b.frames.length-1]).data=n(b,_.slice(0,D),I.rect.width,I.rect.height)),b.data=n(b,E,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,w=new Uint8Array(v),b=new Uint8Array(v),E=new Uint8Array(v);for(let A=0;A<c.frames.length;A++){const D=c.frames[A],k=D.rect.x,T=D.rect.y,x=D.rect.width,y=D.rect.height,j=t(D.data,x,y,c);if(A!=0)for(var _=0;_<v;_++)E[_]=w[_];if(D.blend==0?f(j,x,y,w,d,h,k,T,0):D.blend==1&&f(j,x,y,w,d,h,k,T,1),g.push(w.buffer.slice(0)),D.dispose!=0){if(D.dispose==1)f(b,x,y,w,d,h,k,T,0);else if(D.dispose==2)for(_=0;_<v;_++)w[_]=E[_]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let j=y;for(let M=0;M<8;M++)1&j?j=3988292384^j>>>1:j>>>=1;x[y]=j}return x})(),update(x,y,j,M){for(let O=0;O<M;O++)x=r.table[255&(x^y[j+O])]^x>>>8;return x},crc:(x,y,j)=>4294967295^r.update(4294967295,x,y,j)};function o(x,y,j,M){y[j]+=x[0]*M>>4,y[j+1]+=x[1]*M>>4,y[j+2]+=x[2]*M>>4,y[j+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const j=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return j*j+M*M+O*O+F*F}function i(x,y,j,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var C=0;C<z;C++){const R=M[C];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(C=0;C<z;C++){let R=4294967295;for(var H=0,P=0;P<z;P++){var U=a(S[C],S[P]);P!=C&&U<R&&(R=U,H=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*j*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<L.length;C++)L[C]=255*((L[C]+.5)/16-.5);for(let R=0;R<j;R++)for(let B=0;B<y;B++){var $;C=4*(R*y+B),I!=2?$=[s(x[C]+N[C]),s(x[C+1]+N[C+1]),s(x[C+2]+N[C+2]),s(x[C+3]+N[C+3])]:(U=L[4*(3&R)+(3&B)],$=[s(x[C]+U),s(x[C+1]+U),s(x[C+2]+U),s(x[C+3]+U)]),H=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,H=P)}const K=S[H],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(B!=y-1&&o(V,N,C+4,7),R!=j-1&&(B!=0&&o(V,N,C+4*y-4,3),o(V,N,C+4*y,5),B!=y-1&&o(V,N,C+4*y+4,1))),F[C>>2]=H,q[C>>2]=M[H]}}function m(x,y,j,M,O){O==null&&(O={});const{crc:F}=r,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let C=8;const H=x.frames.length>1;let P,U=!1,q=33+(H?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,L=0;L<N;L++)x.plte[L]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)H&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)R[L]=B[L];if(I(R,C,13),C+=4,S(R,C,"IHDR"),C+=4,I(R,C,y),C+=4,I(R,C,j),C+=4,R[C]=x.depth,C++,R[C]=x.ctype,C++,R[C]=0,C++,R[C]=0,C++,R[C]=0,C++,I(R,C,F(R,C-17,17)),C+=4,O.sRGB!=null&&(I(R,C,1),C+=4,S(R,C,"sRGB"),C+=4,R[C]=O.sRGB,C++,I(R,C,F(R,C-5,5)),C+=4),O.iCCP!=null){const V=13+P.length;I(R,C,V),C+=4,S(R,C,"iCCP"),C+=4,S(R,C,"ICC profile"),C+=11,C+=2,R.set(P,C),C+=P.length,I(R,C,F(R,C-(V+4),V+4)),C+=4}if(O.pHYs!=null&&(I(R,C,9),C+=4,S(R,C,"pHYs"),C+=4,I(R,C,O.pHYs[0]),C+=4,I(R,C,O.pHYs[1]),C+=4,R[C]=O.pHYs[2],C++,I(R,C,F(R,C-13,13)),C+=4),H&&(I(R,C,8),C+=4,S(R,C,"acTL"),C+=4,I(R,C,x.frames.length),C+=4,I(R,C,O.loop!=null?O.loop:0),C+=4,I(R,C,F(R,C-12,12)),C+=4),x.ctype==3){for(I(R,C,3*(N=x.plte.length)),C+=4,S(R,C,"PLTE"),C+=4,L=0;L<N;L++){const V=3*L,ne=x.plte[L],J=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[C+V+0]=J,R[C+V+1]=re,R[C+V+2]=ue}if(C+=3*N,I(R,C,F(R,C-3*N-4,3*N+4)),C+=4,U){for(I(R,C,N),C+=4,S(R,C,"tRNS"),C+=4,L=0;L<N;L++)R[C+L]=x.plte[L]>>>24&255;C+=N,I(R,C,F(R,C-N-4,N+4)),C+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];H&&(I(R,C,26),C+=4,S(R,C,"fcTL"),C+=4,I(R,C,G++),C+=4,I(R,C,K.rect.width),C+=4,I(R,C,K.rect.height),C+=4,I(R,C,K.rect.x),C+=4,I(R,C,K.rect.y),C+=4,z(R,C,M[$]),C+=2,z(R,C,1e3),C+=2,R[C]=K.dispose,C++,R[C]=K.blend,C++,I(R,C,F(R,C-30,30)),C+=4);const V=K.cimg;I(R,C,(N=V.length)+($==0?0:4)),C+=4;const ne=C;S(R,C,$==0?"IDAT":"fdAT"),C+=4,$!=0&&(I(R,C,G++),C+=4),R.set(V,C),C+=N,I(R,C,F(R,ne,C-ne)),C+=4}return I(R,C,0),C+=4,S(R,C,"IEND"),C+=4,I(R,C,F(R,C-4,4)),C+=4,R.buffer}function f(x,y,j){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,j)}}function l(x,y,j,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],C=O[4],H=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 L=ye.length,$=0;$<L;$+=4)q&=ye[$+3]}const R=q!=255,B=(function(fe,ie,xe,we,me,Ee){const Ce=[];for(var pe=0;pe<fe.length;pe++){const Z=new Uint8Array(fe[pe]),ce=new Uint32Array(Z.buffer);var je;let Se=0,le=0,ve=ie,Xe=xe,Mt=we?1:0;if(pe!=0){const lc=Ee||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Jt=0;Jt<lc;Jt++){var He=new Uint8Array(fe[pe-1-Jt]);const cc=new Uint32Array(fe[pe-1-Jt]);let ot=ie,st=xe,Pt=-1,Zt=-1;for(let vt=0;vt<xe;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>Zt&&(Zt=vt));Pt==-1&&(ot=st=Pt=Zt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Zt-st+1);zo<Uo&&(Uo=zo,dr=Jt,Se=ot,le=st,ve=Pt-ot+1,Xe=Zt-st+1)}He=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),je=new Uint8Array(ve*Xe*4),e(He,ie,xe,je,ve,Xe,-Se,-le,0),Mt=e(Z,ie,xe,je,ve,Xe,-Se,-le,3)?1:0,Mt==1?d(Z,ie,xe,je,{x:Se,y:le,width:ve,height:Xe}):e(Z,ie,xe,je,ve,Xe,-Se,-le,0)}else je=Z.slice(0);Ce.push({rect:{x:Se,y:le,width:ve,height:Xe},img:je,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const Z=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(Z.x,ce.x),le=Math.min(Z.y,ce.y),ve={x:Se,y:le,width:Math.max(Z.x+Z.width,ce.x+ce.width)-Se,height:Math.max(Z.y+Z.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,xe,Ce,pe-1,ve,me),c(fe,ie,xe,Ce,pe,ve,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,j,F,I,z),G={},K=[],V=[];if(M!=0){const ye=[];for($=0;$<B.length;$++)ye.push(B[$].img.buffer);const fe=(function(me){let Ee=0;for(var Ce=0;Ce<me.length;Ce++)Ee+=me[Ce].byteLength;const pe=new Uint8Array(Ee);let je=0;for(Ce=0;Ce<me.length;Ce++){const He=new Uint8Array(me[Ce]),xt=He.length;for(let W=0;W<xt;W+=4){let Y=He[W],Z=He[W+1],ce=He[W+2];const Se=He[W+3];Se==0&&(Y=Z=ce=0),pe[je+W]=Y,pe[je+W+1]=Z,pe[je+W+2]=ce,pe[je+W+3]=Se}je+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let xe=0;for($=0;$<B.length;$++){const we=(J=B[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,xe>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,xe,we);H&&i(J.img,J.rect.width,J.rect.height,K,me,ne),J.img.set(me),xe+=we}}else for(N=0;N<B.length;N++){var J=B[N];const ye=new Uint32Array(J.img.buffer);var re=J.rect.width;for(L=ye.length,ne=new Uint8Array(L),V.push(ne),$=0;$<L;$++){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&&C==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<B.length;N++){(J=B[N]).rect.x,J.rect.y,re=J.rect.width;const ye=J.rect.height;let fe=J.img;new Uint32Array(fe.buffer);let ie=4*re,xe=4;if(ue<=256&&C==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 Ee=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[Ee+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[Ee+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[Ee+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[Ee+de]<<7-1*(7&de)}fe=be,P=3,xe=1}else if(R==0&&B.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,Ee=4*$;be[me]=fe[Ee],be[me+1]=fe[Ee+1],be[me+2]=fe[Ee+2]}fe=be,P=2,xe=3,ie=3*re}J.img=fe,J.bpl=ie,J.bpp=xe}return{ctype:P,depth:U,plte:K,frames:B}}function c(x,y,j,M,O,F,I){const z=Uint8Array,S=Uint32Array,C=new z(x[O-1]),H=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,L=j,$=-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,J=ne*y+V,re=q[J];re==0||M[O-1].dispose==0&&H[J]==re&&(P==null||P[4*J+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<L&&(L=ne),ne>R&&(R=ne))}$==-1&&(N=L=$=R=0),I&&((1&N)==1&&N--,(1&L)==1&&L--),F={x:N,y:L,width:$-N+1,height:R-L+1};const B=M[O];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(C,y,j,B.img,F.width,F.height,-F.x,-F.y,0),d(U,y,j,B.img,F)):e(U,y,j,B.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,j,M,O){e(x,y,j,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,j,M,O,F,I){const z=[];let S,C=[0,1,2,3,4];F!=-1?C=[F]:(y*M>5e5||j==1)&&(C=[0]),I&&(S={level:0});const H=jh;for(var P=0;P<C.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,j,C[P]);z.push(H.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,j,M,O,F){const I=j*M;let z=I+j;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(j==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 j=new Uint8Array(x),M=j.slice(0),O=new Uint32Array(M.buffer),F=w(M,y),I=F[0],z=F[1],S=j.length,C=new Uint8Array(S>>2);let H;if(j.length<2e7)for(var P=0;P<S;P+=4)H=b(I,U=j[P]*(1/255),q=j[P+1]*(1/255),N=j[P+2]*(1/255),L=j[P+3]*(1/255)),C[P>>2]=H.ind,O[P>>2]=H.est.rgba;else for(P=0;P<S;P+=4){var U=j[P]*.00392156862745098,q=j[P+1]*(1/255),N=j[P+2]*(1/255),L=j[P+3]*(1/255);for(H=I;H.left;)H=E(H.est,U,q,N,L)<=0?H.left:H.right;C[P>>2]=H.ind,O[P>>2]=H.est.rgba}return{abuf:M.buffer,inds:C,plte:z}}function w(x,y,j){j==null&&(j=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=D(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<j)break;const C=F[S],H=_(x,M,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=H||C.i1<=H){C.est.L=0;continue}const P={i0:C.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};P.bst=D(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:H,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:C.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=C.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=C.bst.m[I]-P.bst.m[I];U.est=k(U.bst),C.left=P,C.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,j,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,L){const $=U-P[0],R=q-P[1],B=N-P[2],G=L-P[3];return $*$+R*R+B*B+G*G})(x.est.q,y,j,M,O),x;const F=E(x.est,y,j,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,j,M,O);if(S.tdst<=F*F)return S;const C=b(z,y,j,M,O);return C.tdst<S.tdst?C:S}function E(x,y,j,M,O){const{e:F}=x;return F[0]*y+F[1]*j+F[2]*M+F[3]*O-x.eMq}function _(x,y,j,M,O,F){for(M-=4;j<M;){for(;A(x,j,O)<=F;)j+=4;for(;A(x,M,O)>F;)M-=4;if(j>=M)break;const I=y[j>>2];y[j>>2]=y[M>>2],y[M>>2]=I,j+=4,M-=4}for(;A(x,j,O)>F;)j-=4;return j+4}function A(x,y,j){return x[y]*j[0]+x[y+1]*j[1]+x[y+2]*j[2]+x[y+3]*j[3]}function D(x,y,j){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=j-y>>2;for(let I=y;I<j;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),C=x[I+2]*(1/255),H=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=C,O[3]+=H,M[0]+=z*z,M[1]+=z*S,M[2]+=z*C,M[3]+=z*H,M[5]+=S*S,M[6]+=S*C,M[7]+=S*H,M[10]+=C*C,M[11]+=C*H,M[15]+=H*H}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:j}=x,{N:M}=x,O=j[0],F=j[1],I=j[2],z=j[3],S=M==0?0:1/M,C=[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],H=C,P=T;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(H,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const L=[O*S,F*S,I*S,z*S];return{Cov:C,q:L,e:U,L:q,eMq255:P.dot(P.sml(255,L),U),eMq:P.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var T={multVec:(x,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,j,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,j,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,j,M,F,I)},Le.encodeLL=function(y,j,M,O,F,I,z,S){const C={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},H=(O+F)*I,P=H*j;for(let U=0;U<y.length;U++)C.frames.push({rect:{x:0,y:0,width:j,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(P/8)});return f(C,0,!0),m(C,j,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=w,Le.quantize.getNearest=b})();const Wi={toArrayBuffer(e,t){const n=e.width,r=e.height,o=n<<2,s=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,w,b=d,E=0,_=0,A=0;function D(x){c.setUint16(_,x,!0),_+=2}function k(x){c.setUint32(_,x,!0),_+=4}function T(x){_+=x}D(19778),k(f),T(4),k(122),k(108),k(n),k(-r>>>0),D(1),D(32),k(3),k(m),k(2835),k(2835),T(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;E<r&&b>0;){for(w=122+E*i,h=0;h<o;)b--,g=a[A++],v=g>>>24,c.setUint32(w+h,g<<8|v),h+=4;E++}A<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"},Rh={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const Eo=typeof window<"u",Gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Bn=Eo&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Nh=(Eo||Gi)&&(Bn&&Bn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vi=(Eo||Gi)&&(Bn&&Bn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function _o(e,t,n=Date.now()){return new Promise((r=>{const o=e.split(","),s=o[0].match(/:(.*?);/)[1],a=globalThis.atob(o[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,r(f)}))}function Ki(e){return new Promise(((t,n)=>{const r=new Vi;r.onload=()=>t(r.result),r.onerror=o=>n(o),r.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=o=>n(o),r.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(),r=Rh[n];let o=e,s=t,a=o*s;const i=o>s?s/o:o/s;for(;a>r*r;){const m=(r+o)/2,f=(r+s)/2;m<f?(s=f,o=f*i):(s=m*i,o=m),a=o*s}return{width:o,height:s}}function rr(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function Xi(e,t){const{width:n,height:r}=Yi(e.width,e.height),[o,s]=rr(n,r);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,o.width,o.height)),s.drawImage(e,0,0,o.width,o.height),o}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,r){let o,s;var a=function(){try{return s=Xi(o,t.fileType||e.type),n([o,s])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return o=d,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return r(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 o=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,r,o=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*o),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,o),_o(c,n,r).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,r,o,s;return $t.cachedResult!==void 0?e($t.cachedResult):_o("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 r=i[1],Gn(r,n.type,n.name,n.lastModified).then((function(m){try{return o=m,Ge(r),Wn(o).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 r=new Vi;r.onload=o=>{const s=new DataView(o.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)},r.onerror=o=>n(o),r.readAsArrayBuffer(e)}))}function Ji(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:o}=t;let s,a=e;return isFinite(o)&&(n>o||r>o)&&([a,s]=rr(n,r),n>r?(a.width=o,a.height=r/n*o):(a.width=n/r*o,a.height=o),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function Zi(e,t){const{width:n}=e,{height:r}=e,[o,s]=rr(n,r);switch(t>4&&t<9?(o.width=r,o.height=n):(o.width=n,o.height=r),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,r);break;case 4:s.transform(1,0,0,-1,0,r);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,r,0);break;case 7:s.transform(0,-1,-1,0,r,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,r),Ge(e),o}function Ss(e,t,n=0){return new Promise((function(r,o){let s,a,i,m,f,l,c,d,h,g,v,w,b,E,_,A,D,k,T,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function j(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=Ji(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(C){return F(C)}}).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:Zi(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--&&(_>i||_>b)){let H,P;return H=x?.95*T.width:T.width,P=x?.95*T.height:T.height,[D,k]=rr(H,P),k.drawImage(T,0,0,H,P),d*=h==="image/png"?.85:.95,Gn(D,h,e.name,e.lastModified,d).then((function(U){try{return A=U,Ge(T),T=D,_=A.size,j(Math.min(99,Math.floor((E-_)/(E-i)*100))),S}catch(q){return o(q)}}),o)}return[1]},C=function(){return Ge(T),Ge(D),Ge(f),Ge(c),Ge(m),j(100),r(A)};if(g=I,y(),v=g.size>i,w=g.size>e.size,!v&&!w)return j(100),r(g);var z;return b=e.size,E=g.size,_=E,T=c,x=!t.alwaysKeepResolution&&v,(z=(function(H){for(;H;){if(H.then)return void H.then(z,o);try{if(H.pop){if(H.length)return H.pop()?C.call(this):H;H=S}else H=H.call(this)}catch(P){return o(P)}}}).bind(this))(S)}}catch(S){return o(S)}}).bind(this),o)}catch(I){return o(I)}}).bind(this),o)}catch(F){return o(F)}}).bind(this),o)}catch(O){return o(O)}}).bind(this),o)}))}const Ih=`
|
|
207
|
+
*/const Sd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",Sd),ba=p.createContext(void 0),ya="theme";function Qo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Jo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(ya);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Zo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function kd(){const e=p.useContext(ba);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Ad({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>Jo()||t),[o,s]=p.useState(()=>{const m=Jo()||t;return m==="system"?Qo():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(ya,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Qo():n;s(m),Zo(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),Zo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:o,setTheme:a};return it.createElement(ba.Provider,{value:i},e)}function es(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const r=e.map(o=>{const s=es(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():es(e[o],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Ed=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function _d(e){return typeof e=="object"&&e!==null&&"then"in e}function wa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ed&&"_payload"in e&&_d(e._payload)}function Ca(e){const t=jd(e),n=p.forwardRef((r,o)=>{let{children:s,...a}=r;wa(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(Nd);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:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Td=Ca("Slot");function jd(e){const t=p.forwardRef((n,r)=>{let{children:o,...s}=n;if(wa(o)&&typeof Pn=="function"&&(o=Pn(o._payload)),p.isValidElement(o)){const a=Id(o),i=Md(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Rd=Symbol("radix.slottable");function Nd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rd}function Md(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Id(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const ts=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ns=Xs,Pd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ns(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=ts(l)||ts(c);return o[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||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,w]=g;return Array.isArray(w)?w.includes({...s,...i}[v]):{...s,...i}[v]===w})?[...f,c,d]:f},[]);return ns(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Od=Pd("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:r=!1,...o}){const s=r?Td:"button";return u.jsx(s,{"data-slot":"button",className:ee(Od({variant:t,size:n,className:e})),...o})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Dd(e,t){const n=p.createContext(t),r=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function o(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[r,o]}function nt(e,t=[]){let n=[];function r(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,w=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:w,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 o=()=>{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 o.scopeName=e,[r,Ld(o,...t)]}function Ld(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.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 Je=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Fd=Zr[" useInsertionEffect ".trim().toString()]||Je;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=$d({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:o;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const d=Ud(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 $d({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),o=p.useRef(n),s=p.useRef(t);return Fd(()=>{s.current=t},[t]),p.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Ud(e){return typeof e=="function"}function Bt(e){const t=zd(e),n=p.forwardRef((r,o)=>{const{children:s,...a}=r,i=p.Children.toArray(s),m=i.find(Bd);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:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function zd(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const a=Gd(o),i=Wd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sa=Symbol("radix.slottable");function Hd(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Sa,t}function Bd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sa}function Wd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Gd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Vd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ge=Vd.reduce((e,t)=>{const n=Bt(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ka(e,t){e&&qs.flushSync(()=>e.dispatchEvent(t))}function Aa(e){const t=e+"CollectionProvider",[n,r]=nt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:w,children:b}=v,E=it.useRef(null),_=it.useRef(new Map).current;return u.jsx(o,{scope:w,itemMap:_,collectionRef:E,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Bt(i),f=it.forwardRef((v,w)=>{const{scope:b,children:E}=v,_=s(i,b),A=ke(w,_.collectionRef);return u.jsx(m,{ref:A,children:E})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Bt(l),h=it.forwardRef((v,w)=>{const{scope:b,children:E,..._}=v,A=it.useRef(null),D=ke(w,A),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(A,{ref:A,..._}),()=>void k.itemMap.delete(A))),u.jsx(d,{[c]:"",ref:D,children:E})});h.displayName=l;function g(v){const w=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const E=w.collectionRef.current;if(!E)return[];const _=Array.from(E.querySelectorAll(`[${c}]`));return Array.from(w.itemMap.values()).sort((k,T)=>_.indexOf(k.ref.current)-_.indexOf(T.ref.current))},[w.collectionRef,w.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,r]}var Kd=p.createContext(void 0);function Ea(e){const t=p.useContext(Kd);return e||t||"ltr"}function Ze(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function qd(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Yd="DismissableLayer",Or="dismissableLayer.update",Xd="dismissableLayer.pointerDownOutside",Qd="dismissableLayer.focusOutside",rs,_a=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(_a),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,T=>c(T)),v=Array.from(f.layers),[w]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(w),E=l?v.indexOf(l):-1,_=f.layersWithOutsidePointerEventsDisabled.size>0,A=E>=b,D=ef(T=>{const x=T.target,y=[...f.branches].some(j=>j.contains(x));!A||y||(o==null||o(T),a==null||a(T),T.defaultPrevented||i==null||i())},d),k=tf(T=>{const x=T.target;[...f.branches].some(j=>j.contains(x))||(s==null||s(T),a==null||a(T),T.defaultPrevented||i==null||i())},d);return qd(T=>{E===f.layers.size-1&&(r==null||r(T),!T.defaultPrevented&&i&&(T.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(rs=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),os(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=rs)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),os())},[l,f]),p.useEffect(()=>{const T=()=>h({});return document.addEventListener(Or,T),()=>document.removeEventListener(Or,T)},[]),u.jsx(ge.div,{...m,ref:g,style:{pointerEvents:_?A?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,D.onPointerDownCapture)})});fn.displayName=Yd;var Jd="DismissableLayerBranch",Zd=p.forwardRef((e,t)=>{const n=p.useContext(_a),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(ge.div,{...e,ref:o})});Zd.displayName=Jd;function ef(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let m=function(){Ta(Xd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function tf(e,t=globalThis==null?void 0:globalThis.document){const n=Ze(e),r=p.useRef(!1);return p.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ta(Qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function os(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ta(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ka(o,s):o.dispatchEvent(s)}var mr=0;function so(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ss()),document.body.insertAdjacentElement("beforeend",e[1]??ss()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function ss(){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",as={bubbles:!1,cancelable:!0},nf="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Ze(o),l=Ze(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(r){let v=function(_){if(h.paused||!i)return;const A=_.target;i.contains(A)?c.current=A:lt(c.current,{select:!0})},w=function(_){if(h.paused||!i)return;const A=_.relatedTarget;A!==null&&(i.contains(A)||lt(c.current,{select:!0}))},b=function(_){if(document.activeElement===document.body)for(const D of _)D.removedNodes.length>0&<(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",w);const E=new MutationObserver(b);return i&&E.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",w),E.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){ls.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,as);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(rf(cf(ja(i)),{select:!0}),document.activeElement===v&<(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,as);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),ls.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!r||h.paused)return;const w=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(w&&b){const E=v.currentTarget,[_,A]=of(E);_&&A?!v.shiftKey&&b===A?(v.preventDefault(),n&<(_,{select:!0})):v.shiftKey&&b===_&&(v.preventDefault(),n&<(A,{select:!0})):b===E&&v.preventDefault()}},[n,r,h.paused]);return u.jsx(ge.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=nf;function rf(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(lt(r,{select:t}),document.activeElement!==n)return}function of(e){const t=ja(e),n=is(t,e),r=is(t.reverse(),e);return[n,r]}function ja(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function is(e,t){for(const n of e)if(!sf(n,{upTo:t}))return n}function sf(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 af(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&&af(e)&&t&&e.select()}}var ls=lf();function lf(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=cs(e,t),e.unshift(t)},remove(t){var n;e=cs(e,t),(n=e[0])==null||n.resume()}}}function cs(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function cf(e){return e.filter(t=>t.tagName!=="A")}var uf=Zr[" useId ".trim().toString()]||(()=>{}),df=0;function Re(e){const[t,n]=p.useState(uf());return Je(()=>{n(r=>r??String(df++))},[e]),e||(t?`radix-${t}`:"")}const ff=["top","right","bottom","left"],dt=Math.min,Ie=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),mf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Ie(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 ao(e){return e==="x"?"y":"x"}function io(e){return e==="y"?"height":"width"}function Ve(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function lo(e){return ao(Ve(e))}function pf(e,t,n){n===void 0&&(n=!1);const r=qt(e),o=lo(e),s=io(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function hf(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 us=["left","right"],ds=["right","left"],gf=["top","bottom"],xf=["bottom","top"];function vf(e,t,n){switch(e){case"top":case"bottom":return n?t?ds:us:t?us:ds;case"left":case"right":return t?gf:xf;default:return[]}}function bf(e,t,n,r){const o=qt(e);let s=vf(tt(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return mf[t]+e.slice(t.length)}function yf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ra(e){return typeof e!="number"?yf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function fs(e,t,n){let{reference:r,floating:o}=e;const s=Ve(t),a=lo(t),i=io(a),m=tt(t),f=s==="y",l=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,d=r[i]/2-o[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.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 wf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,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=Ra(h),w=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(w)))==null||n?w:w.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),E=c==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),A=await(s.isElement==null?void 0:s.isElement(_))?await(s.getScale==null?void 0:s.getScale(_))||{x:1,y:1}:{x:1,y:1},D=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:E,offsetParent:_,strategy:m}):E);return{top:(b.top-D.top+g.top)/A.y,bottom:(D.bottom-b.bottom+g.bottom)/A.y,left:(b.left-D.left+g.left)/A.x,right:(D.right-b.right+g.right)/A.x}}const Cf=50,Sf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:wf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:c}=fs(f,r,m),d=r,h=0;const g={};for(let v=0;v<s.length;v++){const w=s[v];if(!w)continue;const{name:b,fn:E}=w,{x:_,y:A,data:D,reset:k}=await E({x:l,y:c,initialPlacement:r,placement:d,strategy:o,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=_??l,c=A??c,g[b]={...g[b],...D},k&&h<Cf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:c}=fs(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:o,middlewareData:g}},kf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=Ra(l),d={x:n,y:r},h=lo(o),g=io(h),v=await a.getDimensions(f),w=h==="y",b=w?"top":"left",E=w?"bottom":"right",_=w?"clientHeight":"clientWidth",A=s.reference[g]+s.reference[h]-d[h]-s.floating[g],D=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let T=k?k[_]:0;(!T||!await(a.isElement==null?void 0:a.isElement(k)))&&(T=i.floating[_]||s.floating[g]);const x=A/2-D/2,y=T/2-v[g]/2-1,j=dt(c[b],y),I=dt(c[E],y),O=j,F=T-v[g]-I,M=T/2-v[g]/2+x,z=Dr(O,M,F),S=!m.arrow&&qt(o)!=null&&M!==z&&s.reference[g]/2-(M<O?j:I)-v[g]/2<0,C=S?M<O?M-O:M-F:0;return{[h]:d[h]+C,data:{[h]:z,centerOffset:M-z-C,...S&&{alignmentOffset:C}},reset:S}}}),Af=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,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,...w}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(o),E=Ve(i),_=tt(i)===i,A=await(m.isRTL==null?void 0:m.isRTL(f.floating)),D=d||(_||!v?[Dn(i)]:hf(i)),k=g!=="none";!d&&k&&D.push(...bf(i,v,g,A));const T=[i,...D],x=await m.detectOverflow(t,w),y=[];let j=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&y.push(x[b]),c){const M=pf(o,a,A);y.push(x[M[0]],x[M[1]])}if(j=[...j,{placement:o,overflows:y}],!y.every(M=>M<=0)){var I,O;const M=(((I=s.flip)==null?void 0:I.index)||0)+1,z=T[M];if(z&&(!(c==="alignment"?E!==Ve(z):!1)||j.every(H=>Ve(H.placement)===E?H.overflows[0]>0:!0)))return{data:{index:M,overflows:j},reset:{placement:z}};let S=(O=j.filter(C=>C.overflows[0]<=0).sort((C,H)=>C.overflows[1]-H.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const C=(F=j.filter(H=>{if(k){const P=Ve(H.placement);return P===E||P==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((H,P)=>H[1]-P[1])[0])==null?void 0:F[0];C&&(S=C);break}case"initialPlacement":S=i;break}if(o!==S)return{reset:{placement:S}}}return{}}}};function ms(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ps(e){return ff.some(t=>e[t]>=0)}const Ef=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=et(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),i=ms(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ps(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),i=ms(a,n.floating);return{data:{escapedOffsets:i,escaped:ps(i)}}}default:return{}}}}},Na=new Set(["left","top"]);async function _f(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=Na.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 Tf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,m=await _f(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+m.x,y:s+m.y,data:{...m,placement:a}}}}},jf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:E,y:_}=b;return{x:E,y:_}}},...f}=et(e,t),l={x:n,y:r},c=await s.detectOverflow(t,f),d=Ve(tt(o)),h=ao(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",E=h==="y"?"bottom":"right",_=g+c[b],A=g-c[E];g=Dr(_,g,A)}if(i){const b=d==="y"?"top":"left",E=d==="y"?"bottom":"right",_=v+c[b],A=v-c[E];v=Dr(_,v,A)}const w=m.fn({...t,[h]:g,[d]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[d]:i}}}}}},Rf=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:r},c=Ve(o),d=ao(c);let h=l[d],g=l[c];const v=et(i,t),w=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const _=d==="y"?"height":"width",A=s.reference[d]-s.floating[_]+w.mainAxis,D=s.reference[d]+s.reference[_]-w.mainAxis;h<A?h=A:h>D&&(h=D)}if(f){var b,E;const _=d==="y"?"width":"height",A=Na.has(tt(o)),D=s.reference[c]-s.floating[_]+(A&&((b=a.offset)==null?void 0:b[c])||0)+(A?0:w.crossAxis),k=s.reference[c]+s.reference[_]+(A?0:((E=a.offset)==null?void 0:E[c])||0)-(A?w.crossAxis:0);g<D?g=D:g>k&&(g=k)}return{[d]:h,[c]:g}}}},Nf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(o),d=qt(o),h=Ve(o)==="y",{width:g,height:v}=s.floating;let w,b;c==="top"||c==="bottom"?(w=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,w=d==="end"?"top":"bottom");const E=v-l.top-l.bottom,_=g-l.left-l.right,A=dt(v-l[w],E),D=dt(g-l[b],_),k=!t.middlewareData.shift;let T=A,x=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=_),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(T=E),k&&!d){const j=Ie(l.left,0),I=Ie(l.right,0),O=Ie(l.top,0),F=Ie(l.bottom,0);h?x=g-2*(j!==0||I!==0?j+I:Ie(l.left,l.right)):T=v-2*(O!==0||F!==0?O+F:Ie(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:T});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 Ma(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=(Ma(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ma(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 hs(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Mf(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 If=/transform|translate|scale|rotate|perspective|filter/,Pf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function co(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!uo()&&(wt(t.backdropFilter)||wt(t.filter))||If.test(t.willChange||"")||Pf.test(t.contain||"")}function Of(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(co(t))return t;if(Xn(t))return null;t=ft(t)}return null}function uo(){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||hs(e)&&e.host||Ye(e);return hs(t)?t.host:t}function Ia(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ia(t)}function on(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ia(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=Pe(o);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(o)?o:[],i&&n?on(i):[])}else return t.concat(o,on(o,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pa(e){const t=Ue(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=On(n)!==s||On(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function fo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=fo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Pa(t);let a=(s?On(n.width):n.width)/r,i=(s?On(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Df=Ke(0);function Oa(e){const t=Pe(e);return!uo()||!t.visualViewport?Df:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function Et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=fo(e);let a=Ke(1);t&&(r?$e(r)&&(a=Ut(r)):a=Ut(e));const i=Lf(s,n,r)?Oa(s):Ke(0);let m=(o.left+i.x)/a.x,f=(o.top+i.y)/a.y,l=o.width/a.x,c=o.height/a.y;if(s){const d=Pe(s),h=r&&$e(r)?Pe(r):r;let g=d,v=Fr(g);for(;v&&r&&h!==g;){const w=Ut(v),b=v.getBoundingClientRect(),E=Ue(v),_=b.left+(v.clientLeft+parseFloat(E.paddingLeft))*w.x,A=b.top+(v.clientTop+parseFloat(E.paddingTop))*w.y;m*=w.x,f*=w.y,l*=w.x,c*=w.y,m+=_,f+=A,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Jn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:Et(Ye(e)).left+n}function Da(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Jn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Ff(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ye(r),i=t?Xn(t.floating):!1;if(r===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(r);if((c||!c&&!s)&&((Yt(r)!=="body"||mn(a))&&(m=Qn(r)),c)){const h=Et(r);f=Ut(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const d=a&&!c&&!s?Da(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 $f(e){return Array.from(e.getClientRects())}function Uf(e){const t=Ye(e),n=Qn(e),r=e.ownerDocument.body,o=Ie(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ie(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Jn(e);const i=-n.scrollTop;return Ue(r).direction==="rtl"&&(a+=Ie(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}const gs=25;function zf(e,t){const n=Pe(e),r=Ye(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,m=0;if(o){s=o.width,a=o.height;const l=uo();(!l||l&&t==="fixed")&&(i=o.offsetLeft,m=o.offsetTop)}const f=Jn(r);if(f<=0){const l=r.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(r.clientWidth-c.clientWidth-h);g<=gs&&(s-=g)}else f<=gs&&(s+=f);return{width:s,height:a,x:i,y:m}}function Hf(e,t){const n=Et(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=o*s.x,f=r*s.y;return{width:a,height:i,x:m,y:f}}function xs(e,t,n){let r;if(t==="viewport")r=zf(e,n);else if(t==="document")r=Uf(Ye(e));else if($e(t))r=Hf(t,n);else{const o=Oa(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ln(r)}function La(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||La(n,t)}function Bf(e,t){const n=t.get(e);if(n)return n;let r=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),o=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=co(a);!m&&i.position==="fixed"&&(o=null),(s?!m&&!o:!m&&i.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||mn(a)&&!m&&La(e,a))?r=r.filter(l=>l!==a):o=i,a=ft(a)}return t.set(e,r),r}function Wf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Bf(t,this._c):[].concat(n),r],i=xs(t,a[0],o);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=xs(t,a[d],o);m=Ie(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Ie(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Gf(e){const{width:t,height:n}=Pa(e);return{width:t,height:n}}function Vf(e,t,n){const r=rt(t),o=Ye(t),s=n==="fixed",a=Et(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Jn(o)}if(r||!r&&!s)if((Yt(t)!=="body"||mn(o))&&(i=Qn(t)),r){const h=Et(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else o&&f();s&&!r&&o&&f();const l=o&&!r&&!s?Da(o,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 vs(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 Fa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let o=ft(e);for(;o&&!Wt(o);){if($e(o)&&!xr(o))return o;o=ft(o)}return n}let r=vs(e,t);for(;r&&Mf(r)&&xr(r);)r=vs(r,t);return r&&Wt(r)&&xr(r)&&!co(r)?n:r||Of(e)||n}const Kf=async function(e){const t=this.getOffsetParent||Fa,n=this.getDimensions,r=await n(e.floating);return{reference:Vf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qf(e){return Ue(e).direction==="rtl"}const Yf={convertOffsetParentRelativeRectToViewportRelativeRect:Ff,getDocumentElement:Ye,getClippingRect:Wf,getOffsetParent:Fa,getElementRects:Kf,getClientRects:$f,getDimensions:Gf,getScale:Ut,isElement:$e,isRTL:qf};function $a(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xf(e,t){let n=null,r;const o=Ye(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),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(o.clientWidth-(l+d)),w=Sn(o.clientHeight-(c+h)),b=Sn(l),_={rootMargin:-g+"px "+-v+"px "+-w+"px "+-b+"px",threshold:Ie(0,dt(1,m))||1};let A=!0;function D(k){const T=k[0].intersectionRatio;if(T!==m){if(!A)return a();T?a(!1,T):r=setTimeout(()=>{a(!1,1e-7)},1e3)}T===1&&!$a(f,e.getBoundingClientRect())&&a(),A=!1}try{n=new IntersectionObserver(D,{..._,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,_)}n.observe(e)}return a(!0),s}function Qf(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=fo(e),l=o||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Xf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[E]=b;E&&E.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var _;(_=h)==null||_.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?Et(e):null;m&&w();function w(){const b=Et(e);v&&!$a(v,b)&&n(),v=b,g=requestAnimationFrame(w)}return n(),()=>{var b;l.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Jf=Tf,Zf=jf,em=Af,tm=Nf,nm=Ef,bs=kf,rm=Rf,om=(e,t,n)=>{const r=new Map,o={platform:Yf,...n},s={...o.platform,_c:r};return Sf(e,t,{...o,platform:s})};var sm=typeof document<"u",am=function(){},Tn=sm?p.useLayoutEffect:am;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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ua(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ys(e,t){const n=Ua(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return Tn(()=>{t.current=e}),t}function im(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,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(r);Fn(d,r)||h(r);const[g,v]=p.useState(null),[w,b]=p.useState(null),E=p.useCallback(H=>{H!==k.current&&(k.current=H,v(H))},[]),_=p.useCallback(H=>{H!==T.current&&(T.current=H,b(H))},[]),A=s||g,D=a||w,k=p.useRef(null),T=p.useRef(null),x=p.useRef(l),y=m!=null,j=vr(m),I=vr(o),O=vr(f),F=p.useCallback(()=>{if(!k.current||!T.current)return;const H={placement:t,strategy:n,middleware:d};I.current&&(H.platform=I.current),om(k.current,T.current,H).then(P=>{const U={...P,isPositioned:O.current!==!1};M.current&&!Fn(x.current,U)&&(x.current=U,qs.flushSync(()=>{c(U)}))})},[d,t,n,I,O]);Tn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(H=>({...H,isPositioned:!1})))},[f]);const M=p.useRef(!1);Tn(()=>(M.current=!0,()=>{M.current=!1}),[]),Tn(()=>{if(A&&(k.current=A),D&&(T.current=D),A&&D){if(j.current)return j.current(A,D,F);F()}},[A,D,F,j,y]);const z=p.useMemo(()=>({reference:k,floating:T,setReference:E,setFloating:_}),[E,_]),S=p.useMemo(()=>({reference:A,floating:D}),[A,D]),C=p.useMemo(()=>{const H={position:n,left:0,top:0};if(!S.floating)return H;const P=ys(S.floating,l.x),U=ys(S.floating,l.y);return i?{...H,transform:"translate("+P+"px, "+U+"px)",...Ua(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:C}),[l,F,z,S,C])}const lm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?bs({element:r.current,padding:o}).fn(n):{}:r?bs({element:r,padding:o}).fn(n):{}}}},cm=(e,t)=>{const n=Jf(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)=>({fn:rm(e).fn,options:[e,t]}),fm=(e,t)=>{const n=em(e);return{name:n.name,fn:n.fn,options:[e,t]}},mm=(e,t)=>{const n=tm(e);return{name:n.name,fn:n.fn,options:[e,t]}},pm=(e,t)=>{const n=nm(e);return{name:n.name,fn:n.fn,options:[e,t]}},hm=(e,t)=>{const n=lm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var gm="Arrow",za=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return u.jsx(ge.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});za.displayName=gm;var xm=za;function vm(e){const[t,n]=p.useState(void 0);return Je(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let 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 r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var mo="Popper",[Ha,Xt]=nt(mo),[bm,Ba]=Ha(mo),Wa=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return u.jsx(bm,{scope:t,anchor:r,onAnchorChange:o,children:n})};Wa.displayName=mo;var Ga="PopperAnchor",Va=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Ba(Ga,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),r?null:u.jsx(ge.div,{...o,ref:i})});Va.displayName=Ga;var po="PopperContent",[ym,wm]=Ha(po),Ka=p.forwardRef((e,t)=>{var G,K,V,ne,J,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=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,w=Ba(po,n),[b,E]=p.useState(null),_=ke(t,ue=>E(ue)),[A,D]=p.useState(null),k=vm(A),T=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=r+(s!=="center"?"-"+s:""),j=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},I=Array.isArray(f)?f:[f],O=I.length>0,F={padding:j,boundary:I.filter(Sm),altBoundary:O},{refs:M,floatingStyles:z,placement:S,isPositioned:C,middlewareData:H}=im({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>Qf(...ue,{animationFrame:h==="always"}),elements:{reference:w.anchor},middleware:[cm({mainAxis:o+x,alignmentAxis:a}),m&&um({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?dm():void 0,...F}),m&&fm({...F}),mm({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,xe=ue.floating.style;xe.setProperty("--radix-popper-available-width",`${de}px`),xe.setProperty("--radix-popper-available-height",`${ye}px`),xe.setProperty("--radix-popper-anchor-width",`${fe}px`),xe.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),A&&hm({element:A,padding:i}),km({arrowWidth:T,arrowHeight:x}),d&&pm({strategy:"referenceHidden",...F})]}),[P,U]=Xa(S),q=Ze(g);Je(()=>{C&&(q==null||q())},[C,q]);const N=(G=H.arrow)==null?void 0:G.x,L=(K=H.arrow)==null?void 0:K.y,$=((V=H.arrow)==null?void 0:V.centerOffset)!==0,[R,B]=p.useState();return Je(()=>{b&&B(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:M.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:C?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=H.transformOrigin)==null?void 0:ne.x,(J=H.transformOrigin)==null?void 0:J.y].join(" "),...((re=H.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(ym,{scope:n,placedSide:P,onArrowChange:D,arrowX:N,arrowY:L,shouldHideArrow:$,children:u.jsx(ge.div,{"data-side":P,"data-align":U,...v,ref:_,style:{...v.style,animation:C?void 0:"none"}})})})});Ka.displayName=po;var qa="PopperArrow",Cm={top:"bottom",right:"left",bottom:"top",left:"right"},Ya=p.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=wm(qa,r),a=Cm[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(xm,{...o,ref:n,style:{...o.style,display:"block"}})})});Ya.displayName=qa;function Sm(e){return e!==null}var km=e=>({name:"transformOrigin",options:e,fn(t){var w,b,E;const{placement:n,rects:r,middlewareData:o}=t,a=((w=o.arrow)==null?void 0:w.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Xa(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=o.arrow)==null?void 0:b.x)??0)+i/2,h=(((E=o.arrow)==null?void 0:E.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=`${r.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${r.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Xa(e){const[t,n="center"]=e.split("-");return[t,n]}var ho=Wa,Zn=Va,go=Ka,xo=Ya,Am="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,s]=p.useState(!1);Je(()=>s(!0),[]);const a=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?hc.createPortal(u.jsx(ge.div,{...r,ref:t}),a):null});pn.displayName=Am;function Em(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Oe=e=>{const{present:t,children:n}=e,r=_m(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=ke(r.ref,Tm(o));return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:s}):null};Oe.displayName="Presence";function _m(e){const[t,n]=p.useState(),r=p.useRef(null),o=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Em(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(r.current);s.current=i==="mounted"?f:"none"},[i]),Je(()=>{const f=r.current,l=o.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"),o.current=e}},[e,m]),Je(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!o.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},d=h=>{h.target===t&&(s.current=kn(r.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=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Tm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",jm={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,Qa,Rm]=Aa(hn),[Nm,Ja]=nt(hn,[Rm]),[Mm,Im]=Nm(hn),Za=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Pm,{...e,ref:t})})}));Za.displayName=hn;var Pm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!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=Ea(s),[v,w]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,E]=p.useState(!1),_=Ze(f),A=Qa(n),D=p.useRef(!1),[k,T]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,_),()=>x.removeEventListener(br,_)},[_]),u.jsx(Mm,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:p.useCallback(x=>w(x),[w]),onItemShiftTab:p.useCallback(()=>E(!0),[]),onFocusableItemAdd:p.useCallback(()=>T(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>T(x=>x-1),[]),children:u.jsx(ge.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{D.current=!0}),onFocus:te(e.onFocus,x=>{const y=!D.current;if(x.target===x.currentTarget&&y&&!b){const j=new CustomEvent(br,jm);if(x.currentTarget.dispatchEvent(j),!j.defaultPrevented){const I=A().filter(S=>S.focusable),O=I.find(S=>S.active),F=I.find(S=>S.id===v),z=[O,F,...I].filter(Boolean).map(S=>S.ref.current);ni(z,l)}}D.current=!1}),onBlur:te(e.onBlur,()=>E(!1))})})}),ei="RovingFocusGroupItem",ti=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Im(ei,n),c=l.currentTabStopId===f,d=Qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(ge.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,w=>{r?l.onItemFocus(f):w.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){l.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const b=Lm(w,l.orientation,l.dir);if(b!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let _=d().filter(A=>A.focusable).map(A=>A.ref.current);if(b==="last")_.reverse();else if(b==="prev"||b==="next"){b==="prev"&&_.reverse();const A=_.indexOf(w.currentTarget);_=l.loop?Fm(_,A+1):_.slice(A+1)}setTimeout(()=>ni(_))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});ti.displayName=ei;var Om={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Dm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lm(e,t,n){const r=Dm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Om[r]}function ni(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Fm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var $m=Za,Um=ti,zm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,An=new WeakMap,En={},yr=0,ri=function(e){return e&&(e.host||ri(e.parentNode))},Hm=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ri(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Bm=function(e,t,n,r){var o=Hm(t,Array.isArray(e)?e:[e]);En[n]||(En[n]=new WeakMap);var s=En[n],a=[],i=new Set,m=new Set(o),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};o.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(r),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,w=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,w),a.push(d),v===1&&g&&An.set(d,!0),w===1&&d.setAttribute(n,"true"),g||d.setAttribute(r,"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||(An.has(c)||c.removeAttribute(r),An.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,An=new WeakMap,En={})}},vo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=zm(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Bm(r,o,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],Wm=["ArrowDown","PageUp","Home"],oi=["ArrowUp","PageDown","End"],Gm=[...Wm,...oi],Vm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Km={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,qm,Ym]=Aa(gn),[Nt,si]=nt(gn,[Ym,Xt,Ja]),er=Xt(),ai=Ja(),[Xm,Mt]=Nt(gn),[Qm,xn]=Nt(gn),ii=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Ze(s),d=Ea(o);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(ho,{...i,children:u.jsx(Xm,{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:r})})})};ii.displayName=gn;var Jm="MenuAnchor",bo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(Zn,{...o,...r,ref:t})});bo.displayName=Jm;var yo="MenuPortal",[Zm,li]=Nt(yo,{forceMount:void 0}),ci=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=Mt(yo,t);return u.jsx(Zm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};ci.displayName=yo;var De="MenuContent",[ep,wo]=Nt(De),ui=p.forwardRef((e,t)=>{const n=li(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Mt(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(tp,{...o,ref:t}):u.jsx(np,{...o,ref:t})})})})}),tp=p.forwardRef((e,t)=>{const n=Mt(De,e.__scopeMenu),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return vo(s)},[]),u.jsx(Co,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),np=p.forwardRef((e,t)=>{const n=Mt(De,e.__scopeMenu);return u.jsx(Co,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),rp=Bt("MenuContent.ScrollLock"),Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,w=Mt(De,n),b=xn(De,n),E=er(n),_=ai(n),A=qm(n),[D,k]=p.useState(null),T=p.useRef(null),x=ke(t,T,w.onContentChange),y=p.useRef(0),j=p.useRef(""),I=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),M=p.useRef(0),z=g?eo:p.Fragment,S=g?{as:rp,allowPinchZoom:!0}:void 0,C=P=>{var G,K;const U=j.current+P,q=A().filter(V=>!V.disabled),N=document.activeElement,L=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=hp($,U,L),B=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){j.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),B&&setTimeout(()=>B.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),so();const H=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&xp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(ep,{scope:n,searchRef:j,onItemEnter:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),onItemLeave:p.useCallback(P=>{var U;H(P)||((U=T.current)==null||U.focus(),k(null))},[H]),onTriggerLeave:p.useCallback(P=>{H(P)&&P.preventDefault()},[H]),pointerGraceTimerRef:I,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:o,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=T.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($m,{asChild:!0,..._,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:D,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(go,{role:"menu","aria-orientation":"vertical","data-state":Ei(w.open),"data-radix-menu-content":"",dir:b.dir,...E,...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,L=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&L&&C(P.key));const $=T.current;if(P.target!==$||!Gm.includes(P.key))return;P.preventDefault();const B=A().filter(G=>!G.disabled).map(G=>G.ref.current);oi.includes(P.key)&&B.reverse(),mp(B)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),j.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=M.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>M.current?"right":"left";F.current=N,M.current=P.clientX}}))})})})})})})});ui.displayName=De;var op="MenuGroup",So=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{role:"group",...r,ref:t})});So.displayName=op;var sp="MenuLabel",di=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{...r,ref:t})});di.displayName=sp;var $n="MenuItem",ws="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=wo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(ws,{bubbles:!0,cancelable:!0});c.addEventListener(ws,h=>r==null?void 0:r(h),{once:!0}),ka(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(fi,{...o,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 fi=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=wo($n,n),i=ai(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:r,textValue:o??d,children:u.jsx(Um,{asChild:!0,...i,focusable:!r,children:u.jsx(ge.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{r?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))})})})}),ap="MenuCheckboxItem",mi=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return u.jsx(vi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...o,ref:t,"data-state":Ao(n),onSelect:te(o.onSelect,()=>r==null?void 0:r(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});mi.displayName=ap;var pi="MenuRadioGroup",[ip,lp]=Nt(pi,{value:void 0,onValueChange:()=>{}}),hi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Ze(r);return u.jsx(ip,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(So,{...o,ref:t})})});hi.displayName=pi;var gi="MenuRadioItem",xi=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=lp(gi,e.__scopeMenu),s=n===o.value;return u.jsx(vi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":Ao(s),onSelect:te(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});xi.displayName=gi;var ko="MenuItemIndicator",[vi,cp]=Nt(ko,{checked:!1}),bi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=cp(ko,n);return u.jsx(Oe,{present:r||Un(s.checked)||s.checked===!0,children:u.jsx(ge.span,{...o,ref:t,"data-state":Ao(s.checked)})})});bi.displayName=ko;var up="MenuSeparator",yi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(ge.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});yi.displayName=up;var dp="MenuArrow",wi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(xo,{...o,...r,ref:t})});wi.displayName=dp;var fp="MenuSub",[Pb,Ci]=Nt(fp),rn="MenuSubTrigger",Si=p.forwardRef((e,t)=>{const n=Mt(rn,e.__scopeMenu),r=xn(rn,e.__scopeMenu),o=Ci(rn,e.__scopeMenu),s=wo(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(bo,{asChild:!0,...f,children:u.jsx(fi,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Ei(n.open),...e,ref:qe(t,o.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,w=v==="right",b=w?-5:5,E=d[w?"left":"right"],_=d[w?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:E,y:d.top},{x:_,y:d.top},{x:_,y:d.bottom},{x:E,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===" "||Vm[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});Si.displayName=rn;var ki="MenuSubContent",Ai=p.forwardRef((e,t)=>{const n=li(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=Mt(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=Ci(ki,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(Co,{id:i.contentId,"aria-labelledby":i.triggerId,...o,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=Km[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ai.displayName=ki;function Ei(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function Ao(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function mp(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function pp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function hp(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=pp(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return m!==n?m:void 0}function gp(e,t){const{x:n,y:r}=e;let o=!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>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function xp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return gp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var vp=ii,bp=bo,yp=ci,wp=ui,Cp=So,Sp=di,kp=tr,Ap=mi,Ep=hi,_p=xi,Tp=bi,jp=yi,Rp=wi,Np=Si,Mp=Ai,nr="DropdownMenu",[Ip]=nt(nr,[si]),Ne=si(),[Pp,_i]=Ip(nr),Ti=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:o,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Pp,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(vp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Ti.displayName=nr;var ji="DropdownMenuTrigger",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=_i(ji,n),a=Ne(n);return u.jsx(bp,{asChild:!0,...a,children:u.jsx(ge.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":r?"":void 0,disabled:r,...o,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ri.displayName=ji;var Op="DropdownMenuPortal",Ni=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return u.jsx(yp,{...r,...n})};Ni.displayName=Op;var Mi="DropdownMenuContent",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=_i(Mi,n),s=Ne(n),a=p.useRef(!1);return u.jsx(wp,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=o.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;(!o.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)"}})});Ii.displayName=Mi;var Dp="DropdownMenuGroup",Lp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Cp,{...o,...r,ref:t})});Lp.displayName=Dp;var Fp="DropdownMenuLabel",Pi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Sp,{...o,...r,ref:t})});Pi.displayName=Fp;var $p="DropdownMenuItem",Oi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(kp,{...o,...r,ref:t})});Oi.displayName=$p;var Up="DropdownMenuCheckboxItem",zp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ap,{...o,...r,ref:t})});zp.displayName=Up;var Hp="DropdownMenuRadioGroup",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ep,{...o,...r,ref:t})});Bp.displayName=Hp;var Wp="DropdownMenuRadioItem",Gp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(_p,{...o,...r,ref:t})});Gp.displayName=Wp;var Vp="DropdownMenuItemIndicator",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Tp,{...o,...r,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSeparator",Di=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(jp,{...o,...r,ref:t})});Di.displayName=qp;var Yp="DropdownMenuArrow",Xp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Rp,{...o,...r,ref:t})});Xp.displayName=Yp;var Qp="DropdownMenuSubTrigger",Jp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Np,{...o,...r,ref:t})});Jp.displayName=Qp;var Zp="DropdownMenuSubContent",eh=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Mp,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});eh.displayName=Zp;var th=Ti,nh=Ri,rh=Ni,oh=Ii,sh=Pi,ah=Oi,ih=Di;function Li({...e}){return u.jsx(th,{"data-slot":"dropdown-menu",...e})}function Fi({...e}){return u.jsx(nh,{"data-slot":"dropdown-menu-trigger",...e})}function $i({className:e,sideOffset:t=4,...n}){return u.jsx(rh,{children:u.jsx(oh,{"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 jn({className:e,inset:t,variant:n="default",...r}){return u.jsx(ah,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function lh({className:e,inset:t,...n}){return u.jsx(sh,{"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 Cs({className:e,...t}){return u.jsx(ih,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const ch=[{value:"light",label:"Light",icon:u.jsx(xa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Vu,{className:"h-4 w-4"})}];function uh(){const{theme:e,setTheme:t,resolvedTheme:n}=kd();return u.jsxs(Li,{children:[u.jsx(Fi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(pa,{className:"h-4 w-4"}):u.jsx(xa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx($i,{align:"end",children:ch.map(r=>u.jsxs(jn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,u.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const Ss={"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.login.singleUserHint":"单用户模式:首次部署已自动创建管理员账号","auth.login.singleUserHintFooter":"本地便捷默认密码,登录后建议尽快修改","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","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":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.aiUpdate":"AI 更新","artifacts.edit.mode.html":"编辑 HTML","artifacts.edit.mode.ai":"AI 更新","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此 artifact","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的 artifacts 提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","artifacts.create.ai.model":"模型槽位","artifacts.create.ai.modelCurrent":"当前","artifacts.create.ai.modelHint":"选择非当前模型时,会先切换目标会话的模型再发送需求","artifacts.update.ai.briefPlaceholder":"例如:把本周的数据加进去,趋势图延长到最新一周…","artifacts.update.ai.briefRequired":"请描述需要的更新","artifacts.update.ai.sent":"更新需求已发送。新版本上传后会原位替换此 Artifact,链接保持不变。","artifacts.update.ai.inPlace":"原位更新:链接不变,版本自增","artifacts.update.ai.sessionHint":"默认发送到该 Artifact 关联的会话,也可以选择其它会话","artifacts.ai.archify":"Archify 图表模板","artifacts.ai.archifyDesc":"架构 / 流程 / 时序 / 数据流 / 状态图 — 由 archify 技能生成并校验,再上传为 Artifact","artifacts.ai.archifyHint":"开启后,目标会话的 agent 将运行 archify 技能:编写 JSON 规格并校验(showcase 质量零告警),渲染为自包含交互页面后上传。若会话缺少 archify 运行时,agent 会明确说明并退回手写页面。","artifacts.ai.archifyBriefPlaceholder":"例如:一张架构图 — 请求经网关 → 认证服务 → 业务服务 → 缓存 / 数据库 的调用链…","artifacts.view.liveUpdated":"已自动更新","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},dh={"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.login.singleUserHint":"Single-user mode: an admin account was auto-created on first deployment","auth.login.singleUserHintFooter":"Local convenience default — change the password after first login","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","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","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.aiUpdate":"AI update","artifacts.edit.mode.html":"Edit HTML","artifacts.edit.mode.ai":"AI update","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","artifacts.create.ai.model":"Model slot","artifacts.create.ai.modelCurrent":"current","artifacts.create.ai.modelHint":"Picking a non-current model switches the target session before dispatching the brief","artifacts.update.ai.briefPlaceholder":"e.g. append this week’s data and extend the trend chart to the latest week…","artifacts.update.ai.briefRequired":"Describe the update you need","artifacts.update.ai.sent":"Update request sent. The new version will replace this artifact in place — the link stays the same.","artifacts.update.ai.inPlace":"In-place update: link stays stable, version bumps","artifacts.update.ai.sessionHint":"Defaults to the session this artifact belongs to; you can pick another one","artifacts.ai.archify":"Archify diagram template","artifacts.ai.archifyDesc":"Architecture / workflow / sequence / dataflow / lifecycle — authored and validated by the archify skill, then uploaded as an artifact","artifacts.ai.archifyHint":"When on, the agent in the target session runs the archify skill: it authors a JSON spec, validates it (showcase quality, zero warnings), renders a self-contained interactive page, and uploads it. If the archify runtime is missing, the agent reports that and falls back to a hand-authored page.","artifacts.ai.archifyBriefPlaceholder":"e.g. an architecture diagram — the request path through gateway → auth → service → cache / database…","artifacts.view.liveUpdated":"Auto-updated","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Ui="rcs_locale";function fh(){try{const t=localStorage.getItem(Ui);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=fh();const zr=new Set;function Ob(e){Eo=e;try{localStorage.setItem(Ui,e)}catch{}zr.forEach(t=>t())}function mh(e){return zr.add(e),()=>{zr.delete(e)}}function zi(){return p.useSyncExternalStore(mh,()=>Eo)}function Fe(e){return Eo==="en"?dh[e]??Ss[e]??e:Ss[e]??e}const ph="";let zn=null;function hh(e){zn=e}function Db(){return zn}let Hr=null;function ks(e){Hr=e}let tn=null;async function gh(){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,r,o){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=r,this.status=o}}async function he(e,t,n,r){const o={"Content-Type":"application/json"};zn&&(o.Authorization=`Bearer ${zn}`);const s=`${ph}${t}`,a={method:e,headers:o,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(!r&&await gh())return he(e,t,n,!0);Hr&&Hr()}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 Lb(){return he("GET","/web/sessions")}function Fb(){return he("GET","/web/sessions/all")}function $b(e){return he("GET",`/web/sessions/${e}`)}function Ub(e){return he("GET",`/web/sessions/${e}/history`)}function zb(e){return he("GET",`/web/sessions/${e}/models`)}function Hb(){return he("GET","/web/environments")}function Bb(e,t){return he("POST",`/web/sessions/${e}/events`,t)}function Wb(e,t){return he("POST",`/web/sessions/${e}/control`,t)}function Gb(e){return he("POST",`/web/sessions/${e}/interrupt`)}function Vb(e){return he("DELETE",`/web/sessions/${e}`)}function Kb(e){return he("POST",`/web/sessions/${e}/clear`)}function qb(e,t){return he("PATCH",`/web/sessions/${e}`,{title:t})}function Yb(e){return he("POST","/web/sessions",e)}function Xb(e){return he("GET",`/web/sessions/s/${e}`)}function Qb(e){return he("GET",`/web/sessions/${e}/shares`)}function Jb(e,t){return he("POST",`/web/sessions/${e}/shares`,t)}function Zb(e,t){return he("DELETE",`/web/sessions/${e}/shares/${t}`)}function ey(e,t){return he("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function ty(e,t){return he("DELETE",`/web/teams/${e}/environments/${t}`)}function ny(e){return he("POST","/web/environments/claim",{claim_token:e})}function ry(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return he("GET",`/web/artifacts${r}`)}function oy(e){return he("GET",`/web/artifacts/${e}`)}function sy(e){return he("POST","/web/artifacts",e)}function ay(e){return he("DELETE",`/web/artifacts/${e}`)}const Br="rcs_active_team";function xh(){try{return localStorage.getItem(Br)}catch{return null}}let Hi=xh();const Wr=new Set;function vh(){for(const e of Wr)e()}function bh(e){return Wr.add(e),()=>Wr.delete(e)}function yh(){return Hi}function Ct(e){try{e?localStorage.setItem(Br,e):localStorage.removeItem(Br)}catch{}Hi=e,vh()}function wh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),o=p.useSyncExternalStore(bh,yh,()=>null),s=p.useCallback(async()=>{r(!0);try{const f=await he("GET","/web/teams");t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===o)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await he("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function Ch({className:e}){zi();const{myTeams:t,activeTeam:n,switchTeam:r,isLoading:o}=wh();return o||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;r(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 Bi=p.createContext(null);function Wi(){const e=p.useContext(Bi);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 Sh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function kh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).singleUser===!0:!1}catch{return!1}}async function _n(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function Ah({children:e}){const[t,n]=p.useState(null),[r,o]=p.useState(!0),[s,a]=p.useState(!0),[i,m]=p.useState(!1);p.useEffect(()=>{let w=!1;return Dt().then(b=>{w||(n(b),o(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(b=>b.json()).then(b=>{w||a(b.allowed===!0)}).catch(()=>{}),kh().then(b=>{w||m(b)}),ks(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{w=!0,ks(null)}},[]);const f=p.useCallback(async(w,b)=>{const E=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:b})});if(!E.ok){const A=await _n(E);throw new Error(A.error||"Login failed")}const _=await Dt();n(_),Ct(null)},[]),l=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),c=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const b=await Dt();return n(b),!0}catch{return!1}},[]),d=p.useCallback(async(w,b,E)=>{const _=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:w,username:b,password:E})});if(!_.ok){const D=await _n(_);throw new Error(D.error||"Setup failed")}const A=await Dt();n(A),Ct(null)},[]),h=p.useCallback(async(w,b,E)=>{const _=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:w,username:b,password:E})});if(!_.ok){const D=await _n(_);throw new Error(D.error||"Join failed")}const A=await Dt();n(A),Ct(null)},[]),g=p.useCallback(async(w,b)=>{const E=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:w,password:b})});if(!E.ok){const A=await _n(E);throw new Error(A.error||"Registration failed")}const _=await Dt();n(_),Ct(null)},[]),v=p.useCallback(async()=>Sh(),[]);return u.jsx(Bi.Provider,{value:{user:t,isLoading:r,login:f,logout:l,refresh:c,setup:d,join:h,register:g,checkSetupStatus:v,registrationAllowed:s,singleUserMode:i},children:e})}function Eh({onSettingsClick:e}){const{user:t,logout:n}=Wi();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Li,{children:[u.jsx(Fi,{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(va,{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($i,{align:"end",className:"w-48",children:[u.jsx(lh,{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(Cs,{}),u.jsxs(jn,{onClick:e,children:[u.jsx(ld,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(jn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(Cd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(Cs,{}),u.jsxs(jn,{onClick:r,children:[u.jsx(Hu,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function _h({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:o}){return zi(),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(Ch,{}),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(ku,{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($u,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),o&&u.jsxs("button",{type:"button",onClick:o,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(Iu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(uh,{}),u.jsx(Eh,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function iy({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 Th(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Gi 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 r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.resume)!==null}get supportsSessionList(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[Th(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=o=>{if(this.ws===r)try{const s=JSON.parse(o.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},r.onerror=()=>{var o;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(o=this.connectReject)==null||o.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=o=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",o.code,o.reason),this.connectReject){const s=o.reason||`Connection closed (code: ${o.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(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,o,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=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(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),(o=this.onErrorMessage)==null||o.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 w=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",w,"payload:",t.payload),w==="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(w==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(w==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(w==="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 r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=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 r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const o=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:o};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(o),this.pendingSessionList=null,r(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:o};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:o};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Gi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function jh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Vi(e,t){return new Promise((function(n,r){let o;return Rh(e).then((function(s){try{return o=s,n(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const Rh=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:o}})=>{const s=new DataView(o);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(o.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Hn={},Nh={get exports(){return Hn},set exports(e){Hn=e}};(function(e){var t,n,r={};Nh.exports=r,r.parse=function(o,s){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(o),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 w=i(l,m+=4),b=a(l,m+=4),E=a(l,m+2),_=a(l,m+4);m+=6;var A=i(l,m+=8);m+=4,m+=b+E+_,r._readLocal(l,A,f,h,w,s)}return f},r._readLocal=function(o,s,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(o,s),l(o,s+=4),l(o,s+=2);var d=l(o,s+=2);c(o,s+=2),c(o,s+=4),s+=4;var h=l(o,s+=8),g=l(o,s+=2);s+=2;var v=r.bin.readUTF8(o,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var w=new Uint8Array(o.buffer,s);if(d==0)a[v]=new Uint8Array(w.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);r.inflateRaw(w,b),a[v]=b}}},r.inflateRaw=function(o,s){return r.F.inflate(o,s)},r.inflate=function(o,s){return o[0],o[1],r.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),s)},r.deflate=function(o,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*o.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(o,i,a,s.level);var m=r.adler(o,0,o.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(o,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*o.length)),i=r.F.deflateRaw(o,a,i,s.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(o,s){s==null&&(s=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in o){var c=!r._noNeed(l)&&!s,d=o[l],h=r.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?r.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,w=[];for(var l in f){var b=f[l];w.push(v),v=r._writeHeader(g,v,l,b,0)}var E=0,_=v;for(var l in f)b=f[l],w.push(v),v=r._writeHeader(g,v,l,b,1,w[E++]);var A=v-_;return i(g,v,101010256),v+=4,m(g,v+=4,E),m(g,v+=2,E),i(g,v+=2,A),i(g,v+=4,_),v+=4,v+=2,g.buffer},r._noNeed=function(o){var s=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},r._writeHeader=function(o,s,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,d=i.file;return l(o,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(o,s,20),c(o,s+=2,0),c(o,s+=2,i.cpr?8:0),l(o,s+=2,0),l(o,s+=4,i.crc),l(o,s+=4,d.length),l(o,s+=4,i.usize),c(o,s+=4,r.bin.sizeUTF8(a)),c(o,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(o,s+=6,f),s+=4),s+=r.bin.writeUTF8(o,s,a),m==0&&(o.set(d,s),s+=d.length),s},r.crc={table:(function(){for(var o=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;o[s]=a}return o})(),update:function(o,s,a,i){for(var m=0;m<i;m++)o=r.crc.table[255&(o^s[a+m])]^o>>>8;return o},crc:function(o,s,a){return 4294967295^r.crc.update(4294967295,o,s,a)}},r.adler=function(o,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+=o[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(o,s){return o[s]|o[s+1]<<8},writeUshort:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255},readUint:function(o,s){return 16777216*o[s+3]+(o[s+2]<<16|o[s+1]<<8|o[s])},writeUint:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255,o[s+2]=a>>16&255,o[s+3]=a>>24&255},readASCII:function(o,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(o[s+m]);return i},writeASCII:function(o,s,a){for(var i=0;i<a.length;i++)o[s+i]=a.charCodeAt(i)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(o[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(o,s,a)}return i},writeUTF8:function(o,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)o[s+m]=l,m++;else if((4294965248&l)==0)o[s+m]=192|l>>6,o[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)o[s+m]=224|l>>12,o[s+m+1]=128|l>>6&63,o[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";o[s+m]=240|l>>18,o[s+m+1]=128|l>>12&63,o[s+m+2]=128|l>>6&63,o[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(o){for(var s=o.length,a=0,i=0;i<s;i++){var m=o.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(o,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=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,d=0,h=a<<3,g=0,v=o.length;if(i==0){for(;d<v;)c(s,h,d+(I=Math.min(65535,v-d))==v?1:0),h=r.F._copyExact(o,d,I,s,h+8),d+=I;return h>>>3}var w=f.lits,b=f.strt,E=f.prev,_=0,A=0,D=0,k=0,T=0,x=0;for(v>2&&(b[x=r.F._hash(o,0)]=0),d=0;d<v;d++){if(T=x,d+1<v-2){x=r.F._hash(o,d+1);var y=d+1&32767;E[y]=b[x],b[x]=y}if(g<=d){(_>14e3||A>26697)&&v-d>100&&(g<d&&(w[_]=d-g,_+=2,g=d),h=r.F._writeBlock(d==v-1||g==v?1:0,w,_,k,o,D,d-D,s,h),_=A=k=0,D=d);var j=0;d<v-2&&(j=r.F._bestMatch(o,d,E,T,Math.min(m[2],v-d),m[3]));var I=j>>>16,O=65535&j;if(j!=0){O=65535&j;var F=l(I=j>>>16,f.of0);f.lhst[257+F]++;var M=l(O,f.df0);f.dhst[M]++,k+=f.exb[F]+f.dxb[M],w[_]=I<<23|d-g,w[_+1]=O<<16|F<<8|M,_+=2,g=d+I}else f.lhst[o[d]]++;A++}}for(D==d&&o.length!=0||(g<d&&(w[_]=d-g,_+=2,g=d),h=r.F._writeBlock(1,w,_,k,o,D,d-D,s,h),_=0,A=0,_=A=k=0,D=d);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(o,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=r.F._hash(o,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||o[s+h]==o[s+h-d]){var w=r.F._howLong(o,s,d);if(w>h){if(g=d,(h=w)>=m)break;d+2<w&&(w=d+2);for(var b=0,E=0;E<w-2;E++){var _=s-d+E+32768&32767,A=_-a[_]+32768&32767;A>b&&(b=A,c=_)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},r.F._howLong=function(o,s,a){if(o[s]!=o[s-a]||o[s+1]!=o[s+1-a]||o[s+2]!=o[s+2-a])return 0;var i=s,m=Math.min(o.length,s+258);for(s+=3;s<m&&o[s]==o[s-a];)s++;return s-i},r.F._hash=function(o,s){return(o[s]<<8|o[s+1])+(o[s+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(o,s,a,i,m,f,l,c,d){var h,g,v,w,b,E,_,A,D,k=r.F.U,T=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(h=r.F.getTrees())[0],v=h[1],w=h[2],b=h[3],E=h[4],_=h[5],A=h[6],D=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),j=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),I=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);I+=14+3*_+r.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<j&&y<I?0:j<I?1:2;if(T(c,d,o),T(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=r.F._copyExact(m,f,l,c,d)}else{var M,z;if(F==1&&(M=k.fltree,z=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,v),r.F.revCodes(k.dtree,v),r.F.makeCodes(k.itree,w),r.F.revCodes(k.itree,w),M=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,E-1),x(c,d+=5,_-4),d+=4;for(var S=0;S<_;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*_,d=r.F._codeTiny(A,k.itree,c,d),d=r.F._codeTiny(D,k.itree,c,d)}for(var C=f,H=0;H<a;H+=2){for(var P=s[H],U=P>>>23,q=C+(8388607&P);C<q;)d=r.F._writeLit(m[C++],M,c,d);if(U!=0){var N=s[H+1],L=N>>16,$=N>>8&255,R=255&N;x(c,d=r.F._writeLit(257+$,M,c,d),U-k.of0[$]),d+=k.exb[$],T(c,d=r.F._writeLit(R,z,c,d),L-k.df0[R]),d+=k.dxb[R],C+=U}}d=r.F._writeLit(256,M,c,d)}return d},r.F._copyExact=function(o,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(o.buffer,s,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var o=r.F.U,s=r.F._hufTree(o.lhst,o.ltree,15),a=r.F._hufTree(o.dhst,o.dtree,15),i=[],m=r.F._lenCodes(o.ltree,i),f=[],l=r.F._lenCodes(o.dtree,f),c=0;c<i.length;c+=2)o.ihst[i[c]]++;for(c=0;c<f.length;c+=2)o.ihst[f[c]]++;for(var d=r.F._hufTree(o.ihst,o.itree,7),h=19;h>4&&o.itree[1+(o.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},r.F.getSecond=function(o){for(var s=[],a=0;a<o.length;a+=2)s.push(o[a+1]);return s},r.F.nonZero=function(o){for(var s="",a=0;a<o.length;a+=2)o[a+1]!=0&&(s+=(a>>1)+",");return s},r.F.contSize=function(o,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*o[1+(i<<1)];return a},r.F._codeTiny=function(o,s,a,i){for(var m=0;m<o.length;m+=2){var f=o[m],l=o[m+1];i=r.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(o,s){for(var a=o.length;a!=2&&o[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=o[i+1],f=i+3<a?o[i+3]:-1,l=i+5<a?o[i+5]:-1,c=i==0?-1:o[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&o[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&&o[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},r.F._hufTree=function(o,s,a){var i=[],m=o.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++)o[l]!=0&&i.push({lit:l,f:o[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(A,D){return A.f-D.f}));var g=i[0],v=i[1],w=0,b=1,E=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=w!=b&&(E==c||i[w].f<i[E].f)?i[w++]:i[E++],v=w!=b&&(E==c||i[w].f<i[E].f)?i[w++]:i[E++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var _=r.F.setDepth(i[b-1],0);for(_>a&&(r.F.restrictDepth(d,a,_),_=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return _},r.F.setDepth=function(o,s){return o.lit!=-1?(o.d=s,s):Math.max(r.F.setDepth(o.l,s+1),r.F.setDepth(o.r,s+1))},r.F.restrictDepth=function(o,s,a){var i=0,m=1<<a-s,f=0;for(o.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<o.length&&o[i].d>s;i++){var l=o[i].d;o[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=o[i].d)<s?(o[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)o[i].d==s&&f<0&&(o[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(o,s){var a=0;return s[16|a]<=o&&(a|=16),s[8|a]<=o&&(a|=8),s[4|a]<=o&&(a|=4),s[2|a]<=o&&(a|=2),s[1|a]<=o&&(a|=1),a},r.F._writeLit=function(o,s,a,i){return r.F._putsF(a,i,s[o<<1]),i+s[1+(o<<1)]},r.F.inflate=function(o,s){var a=Uint8Array;if(o[0]==3&&o[1]==0)return s||new a(0);var i=r.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(o.length>>>2<<3));for(var w,b,E=0,_=0,A=0,D=0,k=0,T=0,x=0,y=0,j=0;E==0;)if(E=m(o,j,1),_=m(o,j+1,2),j+=3,_!=0){if(v&&(s=r.F._check(s,y+(1<<17))),_==1&&(w=g.flmap,b=g.fdmap,T=511,x=31),_==2){A=f(o,j,5)+257,D=f(o,j+5,5)+1,k=f(o,j+10,4)+4,j+=14;for(var I=0;I<38;I+=2)g.itree[I]=0,g.itree[I+1]=0;var O=1;for(I=0;I<k;I++){var F=f(o,j+3*I,3);g.itree[1+(g.ordr[I]<<1)]=F,F>O&&(O=F)}j+=3*k,c(g.itree,O),d(g.itree,O,g.imap),w=g.lmap,b=g.dmap,j=l(g.imap,(1<<O)-1,A+D,o,j,g.ttree);var M=i._copyOut(g.ttree,0,A,g.ltree);T=(1<<M)-1;var z=i._copyOut(g.ttree,A,D,g.dtree);x=(1<<z)-1,c(g.ltree,M),d(g.ltree,M,w),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=w[h(o,j)&T];j+=15&S;var C=S>>>4;if(!(C>>>8))s[y++]=C;else{if(C==256)break;var H=y+C-254;if(C>264){var P=g.ldef[C-257];H=y+(P>>>3)+f(o,j,7&P),j+=7&P}var U=b[h(o,j)&x];j+=15&U;var q=U>>>4,N=g.ddef[q],L=(N>>>4)+m(o,j,15&N);for(j+=15&N,v&&(s=r.F._check(s,y+(1<<17)));y<H;)s[y]=s[y++-L],s[y]=s[y++-L],s[y]=s[y++-L],s[y]=s[y++-L];y=H}}}else{(7&j)!=0&&(j+=8-(7&j));var $=4+(j>>>3),R=o[$-4]|o[$-3]<<8;v&&(s=r.F._check(s,y+R)),s.set(new a(o.buffer,o.byteOffset+$,R),y),j=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},r.F._check=function(o,s){var a=o.length;if(s<=a)return o;var i=new Uint8Array(Math.max(a<<1,s));return i.set(o,0),i},r.F._decodeTiny=function(o,s,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,d=0;d<a;){var h=o[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,w=0;g==16?(w=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(w=3+l(i,m,3),m+=3):g==18&&(w=11+l(i,m,7),m+=7);for(var b=d+w;d<b;)f[d]=v,d++}}return m},r.F._copyOut=function(o,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=o[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},r.F.makeCodes=function(o,s){for(var a,i,m,f,l=r.F.U,c=o.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[o[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=o[m+1])!=0&&(o[m]=g[f],g[f]++)},r.F.codes2map=function(o,s,a){for(var i=o.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(o[f+1]!=0)for(var l=f>>1,c=o[f+1],d=l<<4|c,h=s-c,g=o[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},r.F.revCodes=function(o,s){for(var a=r.F.U.rev15,i=15-s,m=0;m<o.length;m+=2){var f=o[m]<<s-o[m+1];o[m]=a[f]>>>i}},r.F._putsE=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8},r.F._putsF=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8,o[i+2]|=a>>>16},r.F._bitsE=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},r.F._bitsF=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},r.F._get17=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)},r.F._get25=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16|o[3+(s>>>3)]<<24)>>>(7&s)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=r.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,o.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++)o.ldef[s]=o.of0[s]<<3|o.exb[s],o.ddef[s]=o.df0[s]<<4|o.dxb[s];i(o.fltree,144,8),i(o.fltree,112,9),i(o.fltree,24,7),i(o.fltree,8,8),r.F.makeCodes(o.fltree,9),r.F.codes2map(o.fltree,9,o.flmap),r.F.revCodes(o.fltree,9),i(o.fdtree,32,5),r.F.makeCodes(o.fdtree,5),r.F.codes2map(o.fdtree,5,o.fdmap),r.F.revCodes(o.fdtree,5),i(o.itree,19,0),i(o.ltree,286,0),i(o.dtree,30,0),i(o.ttree,320,0)})()})();var Mh=jh({__proto__:null,default:Hn},[Hn]);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),w=Math.ceil(c*v/8),b=new Uint8Array(4*g),E=new Uint32Array(b.buffer),{ctype:_}=h,{depth:A}=h,D=e.readUshort;if(_==6){const P=g<<2;if(A==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(A==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(_==2){const P=h.tabs.tRNS;if(P==null){if(A==8)for(k=0;k<g;k++){var T=3*k;E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T]}if(A==16)for(k=0;k<g;k++)T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T]}else{var x=P[0];const U=P[1],q=P[2];if(A==8)for(k=0;k<g;k++){var y=k<<2;T=3*k,E[k]=255<<24|l[T+2]<<16|l[T+1]<<8|l[T],l[T]==x&&l[T+1]==U&&l[T+2]==q&&(b[y+3]=0)}if(A==16)for(k=0;k<g;k++)y=k<<2,T=6*k,E[k]=255<<24|l[T+4]<<16|l[T+2]<<8|l[T],D(l,T)==x&&D(l,T+2)==U&&D(l,T+4)==q&&(b[y+3]=0)}}else if(_==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(A==1)for(var j=0;j<d;j++){var I=j*w,O=j*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(M=l[I+(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]=M<q?U[M]:255}}if(A==2)for(j=0;j<d;j++)for(I=j*w,O=j*c,k=0;k<c;k++)y=O+k<<2,F=3*(M=l[I+(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]=M<q?U[M]:255;if(A==4)for(j=0;j<d;j++)for(I=j*w,O=j*c,k=0;k<c;k++)y=O+k<<2,F=3*(M=l[I+(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]=M<q?U[M]:255;if(A==8)for(k=0;k<g;k++){var M;y=k<<2,F=3*(M=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=M<q?U[M]:255}}else if(_==4){if(A==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(A==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(_==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,j=0;j<d;j++){const P=j*w,U=j*c;if(A==1)for(var C=0;C<c;C++){var H=(z=255*(l[P+(C>>>3)]>>>7-(7&C)&1))==255*x?0:255;E[U+C]=H<<24|z<<16|z<<8|z}else if(A==2)for(C=0;C<c;C++)H=(z=85*(l[P+(C>>>2)]>>>6-((3&C)<<1)&3))==85*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==4)for(C=0;C<c;C++)H=(z=17*(l[P+(C>>>1)]>>>4-((1&C)<<2)&15))==17*x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==8)for(C=0;C<c;C++)H=(z=l[P+C])==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z;else if(A==16)for(C=0;C<c;C++)z=l[P+(C<<1)],H=D(l,P+(C<<1))==x?0:255,E[U+C]=H<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),w=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?o(c,w):r(c,w),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(E,_){const A=_.width,D=_.height,k=s(_),T=k>>3,x=Math.ceil(A*k/8),y=new Uint8Array(D*x);let j=0;const I=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],M=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const C=F[z],H=M[z];let P=0,U=0,q=I[z];for(;q<D;)q+=C,U++;let N=O[z];for(;N<A;)N+=H,P++;const L=Math.ceil(P*k/8);a(E,_,j,P,U);let $=0,R=I[z];for(;R<D;){let B=O[z],G=j+$*L<<3;for(;B<A;){var S;if(k==1&&(S=(S=E[G>>3])>>7-(7&G)&1,y[R*x+(B>>3)]|=S<<7-((7&B)<<0)),k==2&&(S=(S=E[G>>3])>>6-(7&G)&3,y[R*x+(B>>2)]|=S<<6-((3&B)<<1)),k==4&&(S=(S=E[G>>3])>>4-(7&G)&15,y[R*x+(B>>1)]|=S<<4-((1&B)<<2)),k>=8){const K=R*x+B*T;for(let V=0;V<T;V++)y[K+V]=E[(G>>3)+V]}G+=k,B+=H}$++,R+=C}P*U!=0&&(j+=U*(1+L)),z+=1}return y})(c,l)),c}function r(l,c){return o(new Uint8Array(l.buffer,2,l.length-6),c)}var o=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,w=0,b=0,E=0,_=0,A=0,D=0,k=0,T=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,j=y.b,I=y.e,O=y.R,F=y.n,M=y.A,z=y.Z,S=y.m,C=d==null;for(C&&(d=new h(c.length>>>2<<5));w==0;)if(w=j(c,x,1),b=j(c,x+1,2),x+=3,b!=0){if(C&&(d=l.H.W(d,T+(1<<17))),b==1&&(g=S.J,v=S.h,D=511,k=31),b==2){E=I(c,x,5)+257,_=I(c,x+5,5)+1,A=I(c,x+10,4)+4,x+=14;let P=1;for(var H=0;H<38;H+=2)S.Q[H]=0,S.Q[H+1]=0;for(H=0;H<A;H++){const N=I(c,x+3*H,3);S.Q[1+(S.X[H]<<1)]=N,N>P&&(P=N)}x+=3*A,F(S.Q,P),M(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,E+_,c,x,S.v);const U=y.V(S.v,0,E,S.C);D=(1<<U)-1;const q=y.V(S.v,E,_,S.D);k=(1<<q)-1,F(S.C,U),M(S.C,U,g),F(S.D,q),M(S.D,q,v)}for(;;){const P=g[z(c,x)&D];x+=15&P;const U=P>>>4;if(!(U>>>8))d[T++]=U;else{if(U==256)break;{let q=T+U-254;if(U>264){const B=S.q[U-257];q=T+(B>>>3)+I(c,x,7&B),x+=7&B}const N=v[z(c,x)&k];x+=15&N;const L=N>>>4,$=S.c[L],R=($>>>4)+j(c,x,15&$);for(x+=15&$;T<q;)d[T]=d[T++-R],d[T]=d[T++-R],d[T]=d[T++-R],d[T]=d[T++-R];T=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;C&&(d=l.H.W(d,T+U)),d.set(new h(c.buffer,c.byteOffset+P,U),T),x=P+U<<3,T+=U}return d.length==T?d:d.slice(0,T)},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,w){const b=l.H.e,E=l.H.Z;let _=0;for(;_<h;){const A=c[E(g,v)&d];v+=15&A;const D=A>>>4;if(D<=15)w[_]=D,_++;else{let k=0,T=0;D==16?(T=3+b(g,v,2),v+=2,k=w[_-1]):D==17?(T=3+b(g,v,3),v+=3):D==18&&(T=11+b(g,v,7),v+=7);const x=_+T;for(;_<x;)w[_]=k,_++}}return v},l.H.V=function(c,d,h,g){let v=0,w=0;const b=g.length>>>1;for(;w<h;){const E=c[w+d];g[w<<1]=0,g[1+(w<<1)]=E,E>v&&(v=E),w++}for(;w<b;)g[w<<1]=0,g[1+(w<<1)]=0,w++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,w,b,E;const _=h.j;for(var A=0;A<=d;A++)_[A]=0;for(A=1;A<g;A+=2)_[c[A]]++;const D=h.K;for(v=0,_[0]=0,w=1;w<=d;w++)v=v+_[w-1]<<1,D[w]=v;for(b=0;b<g;b+=2)E=c[b+1],E!=0&&(c[b]=D[E],D[E]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let w=0;w<g;w+=2)if(c[w+1]!=0){const b=w>>1,E=c[w+1],_=b<<4|E,A=d-E;let D=c[w]<<A;const k=D+(1<<A);for(;D!=k;)h[v[D]>>>15-d]=_,D++}},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 w=c[v]<<d-c[v+1];c[v]=h[w]>>>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,w){for(;v--!=0;)g.push(0,w)}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 w=Math.ceil(h*v/8);let b,E;v=Math.ceil(v/8);let _=l[d],A=0;if(_>1&&(l[d]=[0,0,1][_-2]),_==3)for(A=v;A<w;A++)l[A+1]=l[A+1]+(l[A+1-v]>>>1)&255;for(let D=0;D<g;D++)if(b=d+D*w,E=b+D+1,_=l[E-1],A=0,_==0)for(;A<w;A++)l[b+A]=l[E+A];else if(_==1){for(;A<v;A++)l[b+A]=l[E+A];for(;A<w;A++)l[b+A]=l[E+A]+l[b+A-v]}else if(_==2)for(;A<w;A++)l[b+A]=l[E+A]+l[b+A-w];else if(_==3){for(;A<v;A++)l[b+A]=l[E+A]+(l[b+A-w]>>>1);for(;A<w;A++)l[b+A]=l[E+A]+(l[b+A-w]+l[b+A-v]>>>1)}else{for(;A<v;A++)l[b+A]=l[E+A]+i(0,l[b+A-w],0);for(;A<w;A++)l[b+A]=l[E+A]+i(l[b+A-v],l[b+A-w],l[b+A-v-w])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,w=h-d;return g*g<=v*v&&g*g<=w*w?l:v*v<=w*w?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,w,b,E){const _=Math.min(c,g),A=Math.min(d,v);let D=0,k=0;for(let z=0;z<A;z++)for(let S=0;S<_;S++)if(w>=0&&b>=0?(D=z*c+S<<2,k=(b+z)*g+w+S<<2):(D=(-b+z)*c-w+S<<2,k=z*g+S<<2),E==0)h[k]=l[D],h[k+1]=l[D+1],h[k+2]=l[D+2],h[k+3]=l[D+3];else if(E==1){var T=l[D+3]*.00392156862745098,x=l[D]*T,y=l[D+1]*T,j=l[D+2]*T,I=h[k+3]*(1/255),O=h[k]*I,F=h[k+1]*I,M=h[k+2]*I;const C=1-T,H=T+I*C,P=H==0?0:1/H;h[k+3]=255*H,h[k+0]=(x+O*C)*P,h[k+1]=(y+F*C)*P,h[k+2]=(j+M*C)*P}else if(E==2)T=l[D+3],x=l[D],y=l[D+1],j=l[D+2],I=h[k+3],O=h[k],F=h[k+1],M=h[k+2],T==I&&x==O&&y==F&&j==M?(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]=j,h[k+3]=T);else if(E==3){if(T=l[D+3],x=l[D],y=l[D+1],j=l[D+2],I=h[k+3],O=h[k],F=h[k+1],M=h[k+2],T==I&&x==O&&y==F&&j==M)continue;if(T<220&&I>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,w=g.readUint,b={tabs:{},frames:[]},E=new Uint8Array(d.length);let _,A=0,D=0;const k=[137,80,78,71,13,10,26,10];for(var T=0;T<8;T++)if(d[T]!=k[T])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 C=d.slice(x+2,h+z);let H=null;try{H=r(C)}catch{H=o(C)}b.tabs[S]=H}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(T=0;T<z;T++)E[A+T]=d[h+T];A+=z}else if(S=="acTL")b.tabs[S]={num_frames:w(d,h),num_plays:w(d,h+4)},_=new Uint8Array(d.length);else if(S=="fcTL"){D!=0&&((M=b.frames[b.frames.length-1]).data=n(b,_.slice(0,D),M.rect.width,M.rect.height),D=0);const C={x:w(d,h+12),y:w(d,h+16),width:w(d,h+4),height:w(d,h+8)};let H=v(d,h+22);H=v(d,h+20)/(H==0?100:H);const P={rect:C,delay:Math.round(1e3*H),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(T=0;T<z-4;T++)_[D+T]=d[h+T+4];D+=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]=[],T=0;T<8;T++)b.tabs[S].push(g.readUint(d,h+4*T));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),j=g.readASCII(d,h,y-h),I=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,I);else{var O=r(d.slice(y+2,y+2+I));F=g.readUTF8(O,0,O.length)}b.tabs[S][j]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),j=g.readASCII(d,x,y-x);const C=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),I=z-((x=y+1)-h),C==0?F=g.readUTF8(d,x,I):(O=r(d.slice(x,x+I)),F=g.readUTF8(O,0,O.length)),b.tabs[S][j]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const C=b.tabs.PLTE.length/3;for(b.tabs[S]=[],T=0;T<C;T++)b.tabs[S].push(v(d,h+2*T))}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 M;return D!=0&&((M=b.frames[b.frames.length-1]).data=n(b,_.slice(0,D),M.rect.width,M.rect.height)),b.data=n(b,E,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,w=new Uint8Array(v),b=new Uint8Array(v),E=new Uint8Array(v);for(let A=0;A<c.frames.length;A++){const D=c.frames[A],k=D.rect.x,T=D.rect.y,x=D.rect.width,y=D.rect.height,j=t(D.data,x,y,c);if(A!=0)for(var _=0;_<v;_++)E[_]=w[_];if(D.blend==0?f(j,x,y,w,d,h,k,T,0):D.blend==1&&f(j,x,y,w,d,h,k,T,1),g.push(w.buffer.slice(0)),D.dispose!=0){if(D.dispose==1)f(b,x,y,w,d,h,k,T,0);else if(D.dispose==2)for(_=0;_<v;_++)w[_]=E[_]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let j=y;for(let I=0;I<8;I++)1&j?j=3988292384^j>>>1:j>>>=1;x[y]=j}return x})(),update(x,y,j,I){for(let O=0;O<I;O++)x=r.table[255&(x^y[j+O])]^x>>>8;return x},crc:(x,y,j)=>4294967295^r.update(4294967295,x,y,j)};function o(x,y,j,I){y[j]+=x[0]*I>>4,y[j+1]+=x[1]*I>>4,y[j+2]+=x[2]*I>>4,y[j+3]+=x[3]*I>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const j=x[0]-y[0],I=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return j*j+I*I+O*O+F*F}function i(x,y,j,I,O,F,M){M==null&&(M=1);const z=I.length,S=[];for(var C=0;C<z;C++){const R=I[C];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(C=0;C<z;C++){let R=4294967295;for(var H=0,P=0;P<z;P++){var U=a(S[C],S[P]);P!=C&&U<R&&(R=U,H=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*j*4),L=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(C=0;C<L.length;C++)L[C]=255*((L[C]+.5)/16-.5);for(let R=0;R<j;R++)for(let B=0;B<y;B++){var $;C=4*(R*y+B),M!=2?$=[s(x[C]+N[C]),s(x[C+1]+N[C+1]),s(x[C+2]+N[C+2]),s(x[C+3]+N[C+3])]:(U=L[4*(3&R)+(3&B)],$=[s(x[C]+U),s(x[C+1]+U),s(x[C+2]+U),s(x[C+3]+U)]),H=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,H=P)}const K=S[H],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];M==1&&(B!=y-1&&o(V,N,C+4,7),R!=j-1&&(B!=0&&o(V,N,C+4*y-4,3),o(V,N,C+4*y,5),B!=y-1&&o(V,N,C+4*y+4,1))),F[C>>2]=H,q[C>>2]=I[H]}}function m(x,y,j,I,O){O==null&&(O={});const{crc:F}=r,M=t.writeUint,z=t.writeUshort,S=t.writeASCII;let C=8;const H=x.frames.length>1;let P,U=!1,q=33+(H?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,L=0;L<N;L++)x.plte[L]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)H&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),B=[137,80,78,71,13,10,26,10];for(L=0;L<8;L++)R[L]=B[L];if(M(R,C,13),C+=4,S(R,C,"IHDR"),C+=4,M(R,C,y),C+=4,M(R,C,j),C+=4,R[C]=x.depth,C++,R[C]=x.ctype,C++,R[C]=0,C++,R[C]=0,C++,R[C]=0,C++,M(R,C,F(R,C-17,17)),C+=4,O.sRGB!=null&&(M(R,C,1),C+=4,S(R,C,"sRGB"),C+=4,R[C]=O.sRGB,C++,M(R,C,F(R,C-5,5)),C+=4),O.iCCP!=null){const V=13+P.length;M(R,C,V),C+=4,S(R,C,"iCCP"),C+=4,S(R,C,"ICC profile"),C+=11,C+=2,R.set(P,C),C+=P.length,M(R,C,F(R,C-(V+4),V+4)),C+=4}if(O.pHYs!=null&&(M(R,C,9),C+=4,S(R,C,"pHYs"),C+=4,M(R,C,O.pHYs[0]),C+=4,M(R,C,O.pHYs[1]),C+=4,R[C]=O.pHYs[2],C++,M(R,C,F(R,C-13,13)),C+=4),H&&(M(R,C,8),C+=4,S(R,C,"acTL"),C+=4,M(R,C,x.frames.length),C+=4,M(R,C,O.loop!=null?O.loop:0),C+=4,M(R,C,F(R,C-12,12)),C+=4),x.ctype==3){for(M(R,C,3*(N=x.plte.length)),C+=4,S(R,C,"PLTE"),C+=4,L=0;L<N;L++){const V=3*L,ne=x.plte[L],J=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[C+V+0]=J,R[C+V+1]=re,R[C+V+2]=ue}if(C+=3*N,M(R,C,F(R,C-3*N-4,3*N+4)),C+=4,U){for(M(R,C,N),C+=4,S(R,C,"tRNS"),C+=4,L=0;L<N;L++)R[C+L]=x.plte[L]>>>24&255;C+=N,M(R,C,F(R,C-N-4,N+4)),C+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];H&&(M(R,C,26),C+=4,S(R,C,"fcTL"),C+=4,M(R,C,G++),C+=4,M(R,C,K.rect.width),C+=4,M(R,C,K.rect.height),C+=4,M(R,C,K.rect.x),C+=4,M(R,C,K.rect.y),C+=4,z(R,C,I[$]),C+=2,z(R,C,1e3),C+=2,R[C]=K.dispose,C++,R[C]=K.blend,C++,M(R,C,F(R,C-30,30)),C+=4);const V=K.cimg;M(R,C,(N=V.length)+($==0?0:4)),C+=4;const ne=C;S(R,C,$==0?"IDAT":"fdAT"),C+=4,$!=0&&(M(R,C,G++),C+=4),R.set(V,C),C+=N,M(R,C,F(R,ne,C-ne)),C+=4}return M(R,C,0),C+=4,S(R,C,"IEND"),C+=4,M(R,C,F(R,C-4,4)),C+=4,R.buffer}function f(x,y,j){for(let I=0;I<x.frames.length;I++){const O=x.frames[I];O.rect.width;const F=O.rect.height,M=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,M,y,j)}}function l(x,y,j,I,O){const F=O[0],M=O[1],z=O[2],S=O[3],C=O[4],H=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 L=ye.length,$=0;$<L;$+=4)q&=ye[$+3]}const R=q!=255,B=(function(fe,ie,xe,we,me,Ee){const Ce=[];for(var pe=0;pe<fe.length;pe++){const Z=new Uint8Array(fe[pe]),ce=new Uint32Array(Z.buffer);var je;let Se=0,le=0,ve=ie,Xe=xe,It=we?1:0;if(pe!=0){const dc=Ee||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Ho=1e9;for(let Jt=0;Jt<dc;Jt++){var He=new Uint8Array(fe[pe-1-Jt]);const fc=new Uint32Array(fe[pe-1-Jt]);let ot=ie,st=xe,Pt=-1,Zt=-1;for(let vt=0;vt<xe;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=fc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Zt&&(Zt=vt));Pt==-1&&(ot=st=Pt=Zt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const Bo=(Pt-ot+1)*(Zt-st+1);Bo<Ho&&(Ho=Bo,dr=Jt,Se=ot,le=st,ve=Pt-ot+1,Xe=Zt-st+1)}He=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),je=new Uint8Array(ve*Xe*4),e(He,ie,xe,je,ve,Xe,-Se,-le,0),It=e(Z,ie,xe,je,ve,Xe,-Se,-le,3)?1:0,It==1?d(Z,ie,xe,je,{x:Se,y:le,width:ve,height:Xe}):e(Z,ie,xe,je,ve,Xe,-Se,-le,0)}else je=Z.slice(0);Ce.push({rect:{x:Se,y:le,width:ve,height:Xe},img:je,blend:It,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const Z=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(Z.x,ce.x),le=Math.min(Z.y,ce.y),ve={x:Se,y:le,width:Math.max(Z.x+Z.width,ce.x+ce.width)-Se,height:Math.max(Z.y+Z.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,xe,Ce,pe-1,ve,me),c(fe,ie,xe,Ce,pe,ve,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,j,F,M,z),G={},K=[],V=[];if(I!=0){const ye=[];for($=0;$<B.length;$++)ye.push(B[$].img.buffer);const fe=(function(me){let Ee=0;for(var Ce=0;Ce<me.length;Ce++)Ee+=me[Ce].byteLength;const pe=new Uint8Array(Ee);let je=0;for(Ce=0;Ce<me.length;Ce++){const He=new Uint8Array(me[Ce]),xt=He.length;for(let W=0;W<xt;W+=4){let Y=He[W],Z=He[W+1],ce=He[W+2];const Se=He[W+3];Se==0&&(Y=Z=ce=0),pe[je+W]=Y,pe[je+W+1]=Z,pe[je+W+2]=ce,pe[je+W+3]=Se}je+=xt}return pe.buffer})(ye),ie=v(fe,I);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let xe=0;for($=0;$<B.length;$++){const we=(J=B[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,xe>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,xe,we);H&&i(J.img,J.rect.width,J.rect.height,K,me,ne),J.img.set(me),xe+=we}}else for(N=0;N<B.length;N++){var J=B[N];const ye=new Uint32Array(J.img.buffer);var re=J.rect.width;for(L=ye.length,ne=new Uint8Array(L),V.push(ne),$=0;$<L;$++){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&&C==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<B.length;N++){(J=B[N]).rect.x,J.rect.y,re=J.rect.width;const ye=J.rect.height;let fe=J.img;new Uint32Array(fe.buffer);let ie=4*re,xe=4;if(ue<=256&&C==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 Ee=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[Ee+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[Ee+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[Ee+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[Ee+de]<<7-1*(7&de)}fe=be,P=3,xe=1}else if(R==0&&B.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,Ee=4*$;be[me]=fe[Ee],be[me+1]=fe[Ee+1],be[me+2]=fe[Ee+2]}fe=be,P=2,xe=3,ie=3*re}J.img=fe,J.bpl=ie,J.bpp=xe}return{ctype:P,depth:U,plte:K,frames:B}}function c(x,y,j,I,O,F,M){const z=Uint8Array,S=Uint32Array,C=new z(x[O-1]),H=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,L=j,$=-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,J=ne*y+V,re=q[J];re==0||I[O-1].dispose==0&&H[J]==re&&(P==null||P[4*J+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<L&&(L=ne),ne>R&&(R=ne))}$==-1&&(N=L=$=R=0),M&&((1&N)==1&&N--,(1&L)==1&&L--),F={x:N,y:L,width:$-N+1,height:R-L+1};const B=I[O];B.rect=F,B.blend=1,B.img=new Uint8Array(F.width*F.height*4),I[O-1].dispose==0?(e(C,y,j,B.img,F.width,F.height,-F.x,-F.y,0),d(U,y,j,B.img,F)):e(U,y,j,B.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,j,I,O){e(x,y,j,I,O.width,O.height,-O.x,-O.y,2)}function h(x,y,j,I,O,F,M){const z=[];let S,C=[0,1,2,3,4];F!=-1?C=[F]:(y*I>5e5||j==1)&&(C=[0]),M&&(S={level:0});const H=Mh;for(var P=0;P<C.length;P++){for(let N=0;N<y;N++)g(O,x,N,I,j,C[P]);z.push(H.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,j,I,O,F){const M=j*I;let z=M+j;if(x[z]=F,z++,F==0)if(I<500)for(var S=0;S<I;S++)x[z+S]=y[M+S];else x.set(new Uint8Array(y.buffer,M,I),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[M+S];for(S=O;S<I;S++)x[z+S]=y[M+S]-y[M+S-O]+256&255}else if(j==0){for(S=0;S<O;S++)x[z+S]=y[M+S];if(F==2)for(S=O;S<I;S++)x[z+S]=y[M+S];if(F==3)for(S=O;S<I;S++)x[z+S]=y[M+S]-(y[M+S-O]>>1)+256&255;if(F==4)for(S=O;S<I;S++)x[z+S]=y[M+S]-n(y[M+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<I;S++)x[z+S]=y[M+S]+256-y[M+S-I]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[M+S]+256-(y[M+S-I]>>1)&255;for(S=O;S<I;S++)x[z+S]=y[M+S]+256-(y[M+S-I]+y[M+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[M+S]+256-n(0,y[M+S-I],0)&255;for(S=O;S<I;S++)x[z+S]=y[M+S]+256-n(y[M+S-O],y[M+S-I],y[M+S-O-I])&255}}}function v(x,y){const j=new Uint8Array(x),I=j.slice(0),O=new Uint32Array(I.buffer),F=w(I,y),M=F[0],z=F[1],S=j.length,C=new Uint8Array(S>>2);let H;if(j.length<2e7)for(var P=0;P<S;P+=4)H=b(M,U=j[P]*(1/255),q=j[P+1]*(1/255),N=j[P+2]*(1/255),L=j[P+3]*(1/255)),C[P>>2]=H.ind,O[P>>2]=H.est.rgba;else for(P=0;P<S;P+=4){var U=j[P]*.00392156862745098,q=j[P+1]*(1/255),N=j[P+2]*(1/255),L=j[P+3]*(1/255);for(H=M;H.left;)H=E(H.est,U,q,N,L)<=0?H.left:H.right;C[P>>2]=H.ind,O[P>>2]=H.est.rgba}return{abuf:I.buffer,inds:C,plte:z}}function w(x,y,j){j==null&&(j=1e-4);const I=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=D(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var M=0;M<F.length;M++)F[M].est.L>z&&(z=F[M].est.L,S=M);if(z<j)break;const C=F[S],H=_(x,I,C.i0,C.i1,C.est.e,C.est.eMq255);if(C.i0>=H||C.i1<=H){C.est.L=0;continue}const P={i0:C.i0,i1:H,bst:null,est:null,tdst:0,left:null,right:null};P.bst=D(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:H,i1:C.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:C.bst.N-P.bst.N},M=0;M<16;M++)U.bst.R[M]=C.bst.R[M]-P.bst.R[M];for(M=0;M<4;M++)U.bst.m[M]=C.bst.m[M]-P.bst.m[M];U.est=k(U.bst),C.left=P,C.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),M=0;M<F.length;M++)F[M].ind=M;return[O,F]}function b(x,y,j,I,O){if(x.left==null)return x.tdst=(function(P,U,q,N,L){const $=U-P[0],R=q-P[1],B=N-P[2],G=L-P[3];return $*$+R*R+B*B+G*G})(x.est.q,y,j,I,O),x;const F=E(x.est,y,j,I,O);let M=x.left,z=x.right;F>0&&(M=x.right,z=x.left);const S=b(M,y,j,I,O);if(S.tdst<=F*F)return S;const C=b(z,y,j,I,O);return C.tdst<S.tdst?C:S}function E(x,y,j,I,O){const{e:F}=x;return F[0]*y+F[1]*j+F[2]*I+F[3]*O-x.eMq}function _(x,y,j,I,O,F){for(I-=4;j<I;){for(;A(x,j,O)<=F;)j+=4;for(;A(x,I,O)>F;)I-=4;if(j>=I)break;const M=y[j>>2];y[j>>2]=y[I>>2],y[I>>2]=M,j+=4,I-=4}for(;A(x,j,O)>F;)j-=4;return j+4}function A(x,y,j){return x[y]*j[0]+x[y+1]*j[1]+x[y+2]*j[2]+x[y+3]*j[3]}function D(x,y,j){const I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=j-y>>2;for(let M=y;M<j;M+=4){const z=x[M]*.00392156862745098,S=x[M+1]*(1/255),C=x[M+2]*(1/255),H=x[M+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=C,O[3]+=H,I[0]+=z*z,I[1]+=z*S,I[2]+=z*C,I[3]+=z*H,I[5]+=S*S,I[6]+=S*C,I[7]+=S*H,I[10]+=C*C,I[11]+=C*H,I[15]+=H*H}return I[4]=I[1],I[8]=I[2],I[9]=I[6],I[12]=I[3],I[13]=I[7],I[14]=I[11],{R:I,m:O,N:F}}function k(x){const{R:y}=x,{m:j}=x,{N:I}=x,O=j[0],F=j[1],M=j[2],z=j[3],S=I==0?0:1/I,C=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*M*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*M*S,y[7]-F*z*S,y[8]-M*O*S,y[9]-M*F*S,y[10]-M*M*S,y[11]-M*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*M*S,y[15]-z*z*S],H=C,P=T;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(I!=0)for(let $=0;$<16&&(U=P.multVec(H,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const L=[O*S,F*S,M*S,z*S];return{Cov:C,q:L,e:U,L:q,eMq255:P.dot(P.sml(255,L),U),eMq:P.dot(U,L),rgba:(Math.round(255*L[3])<<24|Math.round(255*L[2])<<16|Math.round(255*L[1])<<8|Math.round(255*L[0])<<0)>>>0}}var T={multVec:(x,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,j,I,O,F,M,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,j,I,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,j,I,F,M)},Le.encodeLL=function(y,j,I,O,F,M,z,S){const C={ctype:0+(O==1?0:2)+(F==0?0:4),depth:M,frames:[]},H=(O+F)*M,P=H*j;for(let U=0;U<y.length;U++)C.frames.push({rect:{x:0,y:0,width:j,height:I},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(H/8),bpl:Math.ceil(P/8)});return f(C,0,!0),m(C,j,I,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=w,Le.quantize.getNearest=b})();const Ki={toArrayBuffer(e,t){const n=e.width,r=e.height,o=n<<2,s=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,w,b=d,E=0,_=0,A=0;function D(x){c.setUint16(_,x,!0),_+=2}function k(x){c.setUint32(_,x,!0),_+=4}function T(x){_+=x}D(19778),k(f),T(4),k(122),k(108),k(n),k(-r>>>0),D(1),D(32),k(3),k(m),k(2835),k(2835),T(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;E<r&&b>0;){for(w=122+E*i,h=0;h<o;)b--,g=a[A++],v=g>>>24,c.setUint32(w+h,g<<8|v),h+=4;E++}A<a.length?(b=d,setTimeout(x,Ki._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Me={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Ih={[Me.CHROME]:16384,[Me.FIREFOX]:11180,[Me.DESKTOP_SAFARI]:16384,[Me.IE]:8192,[Me.IOS]:4096,[Me.ETC]:8192};const _o=typeof window<"u",qi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Bn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Ph=(_o||qi)&&(Bn&&Bn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Yi=(_o||qi)&&(Bn&&Bn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function To(e,t,n=Date.now()){return new Promise((r=>{const o=e.split(","),s=o[0].match(/:(.*?);/)[1],a=globalThis.atob(o[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,r(f)}))}function Xi(e){return new Promise(((t,n)=>{const r=new Yi;r.onload=()=>t(r.result),r.onerror=o=>n(o),r.readAsDataURL(e)}))}function Qi(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=o=>n(o),r.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Me.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Me.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Me.IOS:/Safari/i.test(t)?e=Me.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Me.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Me.IE),St.cachedResult=e,St.cachedResult}function Ji(e,t){const n=St(),r=Ih[n];let o=e,s=t,a=o*s;const i=o>s?s/o:o/s;for(;a>r*r;){const m=(r+o)/2,f=(r+s)/2;m<f?(s=f,o=f*i):(s=m*i,o=m),a=o*s}return{width:o,height:s}}function rr(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function Zi(e,t){const{width:n,height:r}=Ji(e.width,e.height),[o,s]=rr(n,r);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,o.width,o.height)),s.drawImage(e,0,0,o.width,o.height),o}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,r){let o,s;var a=function(){try{return s=Zi(o,t.fileType||e.type),n([o,s])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return Xi(e).then((function(c){try{return l=c,Qi(l).then((function(d){try{return o=d,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(Rn()||[Me.DESKTOP_SAFARI,Me.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return o=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,r,o=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*o),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Ki.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,o),To(c,n,r).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,r,o,s;return $t.cachedResult!==void 0?e($t.cachedResult):To("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 r=i[1],Gn(r,n.type,n.name,n.lastModified).then((function(m){try{return o=m,Ge(r),Wn(o).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 el(e){return new Promise(((t,n)=>{const r=new Yi;r.onload=o=>{const s=new DataView(o.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)},r.onerror=o=>n(o),r.readAsArrayBuffer(e)}))}function tl(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:o}=t;let s,a=e;return isFinite(o)&&(n>o||r>o)&&([a,s]=rr(n,r),n>r?(a.width=o,a.height=r/n*o):(a.width=n/r*o,a.height=o),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function nl(e,t){const{width:n}=e,{height:r}=e,[o,s]=rr(n,r);switch(t>4&&t<9?(o.width=r,o.height=n):(o.width=n,o.height=r),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,r);break;case 4:s.transform(1,0,0,-1,0,r);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,r,0);break;case 7:s.transform(0,-1,-1,0,r,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,r),Ge(e),o}function As(e,t,n=0){return new Promise((function(r,o){let s,a,i,m,f,l,c,d,h,g,v,w,b,E,_,A,D,k,T,x;function y(I=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=I,t.onProgress(Math.min(s,100))}function j(I){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(I,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(I){try{return[,m]=I,y(),f=tl(m,t),y(),new Promise((function(O,F){var M;if(!(M=t.exifOrientation))return el(e).then((function(S){try{return M=S,z.call(this)}catch(C){return F(C)}}).bind(this),F);function z(){return O(M)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:nl(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Gn(c,h,e.name,e.lastModified,d).then((function(M){try{{let S=function(){if(a--&&(_>i||_>b)){let H,P;return H=x?.95*T.width:T.width,P=x?.95*T.height:T.height,[D,k]=rr(H,P),k.drawImage(T,0,0,H,P),d*=h==="image/png"?.85:.95,Gn(D,h,e.name,e.lastModified,d).then((function(U){try{return A=U,Ge(T),T=D,_=A.size,j(Math.min(99,Math.floor((E-_)/(E-i)*100))),S}catch(q){return o(q)}}),o)}return[1]},C=function(){return Ge(T),Ge(D),Ge(f),Ge(c),Ge(m),j(100),r(A)};if(g=M,y(),v=g.size>i,w=g.size>e.size,!v&&!w)return j(100),r(g);var z;return b=e.size,E=g.size,_=E,T=c,x=!t.alwaysKeepResolution&&v,(z=(function(H){for(;H;){if(H.then)return void H.then(z,o);try{if(H.pop){if(H.length)return H.pop()?C.call(this):H;H=S}else H=H.call(this)}catch(P){return o(P)}}}).bind(this))(S)}}catch(S){return o(S)}}).bind(this),o)}catch(M){return o(M)}}).bind(this),o)}catch(F){return o(F)}}).bind(this),o)}catch(O){return o(O)}}).bind(this),o)}))}const Oh=`
|
|
208
208
|
let scriptImported = false
|
|
209
209
|
self.addEventListener('message', async (e) => {
|
|
210
210
|
const { file, id, imageCompressionLibUrl, options } = e.data
|
|
@@ -223,20 +223,20 @@ self.addEventListener('message', async (e) => {
|
|
|
223
223
|
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
224
224
|
}
|
|
225
225
|
})
|
|
226
|
-
`;let Cr;function Mh(e,t){return new Promise(((n,r)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Ih));const o=new Worker(Cr);o.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)o.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void o.terminate();n(a.data.file),o.terminate()}else t.onProgress(a.data.progress)})),o.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Te(e,t){return new Promise((function(n,r){let o,s,a,i,m,f;if(o={...t},a=0,{onProgress:i}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Nh))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,o).then((function(h){try{return s=h,d.call(this)}catch(g){return r(g)}}).bind(this),r);var l=(function(){try{return d.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return Ss(e,o).then((function(g){try{return s=g,l()}catch(v){return r(v)}}),r)}catch(g){return r(g)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Mh(e,o).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{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(s=Bi(e,s))}catch{}return n(s)}}))}Te.getDataUrlFromFile=Ki,Te.getFilefromDataUrl=_o,Te.loadImage=qi,Te.drawImageInCanvas=Xi,Te.drawFileInCanvas=Wn,Te.canvasToFile=Gn,Te.getExifOrientation=Qi,Te.handleMaxWidthOrHeight=Ji,Te.followExifOrientation=Zi,Te.cleanupCanvasMemory=Ge,Te.isAutoOrientationInBrowser=$t,Te.approximateBelowMaximumCanvasSizeOfBrowser=Yi,Te.copyExifWithoutOrientation=Bi,Te.getBrowserName=St,Te.version="2.0.2";var Ph=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Ph.reduce((e,t)=>{const n=ba(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Oh=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"}),Dh="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(ge.span,{...e,ref:t,style:{...Oh,...e.style}}));el.displayName=Dh;var Lh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Fh=700,Vr="tooltip.open",[$h,To]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Fh,skipDelayDuration:r=300,disableHoverableContent:o=!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($h,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:o,children:s})};nl.displayName=tl;var ln="Tooltip",[Uh,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=To(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,w=p.useRef(!1),[b,E]=ut({prop:r,defaultProp:o??!1,onChange:T=>{T?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(T)},caller:ln}),_=p.useMemo(()=>b?w.current?"delayed-open":"instant-open":"closed",[b]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,E(!0)},[E]),D=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,E(!1)},[E]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,E(!0),h.current=0},v)},[v,E]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx(Uh,{scope:t,contentId:d,open:b,stateAttribute:_,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():A()},[m.isOpenDelayedRef,k,A]),onTriggerLeave:p.useCallback(()=>{g?D():(window.clearTimeout(h.current),h.current=0)},[D,g]),onOpen:A,onClose:D,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=vn(Kr,n),s=To(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,o.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(Zn,{asChild:!0,...a,children:u.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});ol.displayName=Kr;var jo="TooltipPortal",[zh,Hh]=or(jo,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=vn(jo,t);return u.jsx(zh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};sl.displayName=jo;var Gt="TooltipContent",al=p.forwardRef((e,t)=>{const n=Hh(Gt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:r||a.open,children:a.disableHoverableContent?u.jsx(il,{side:o,...s,ref:t}):u.jsx(Bh,{side:o,...s,ref:t})})}),Bh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),r=To(Gt,e.__scopeTooltip),o=p.useRef(null),s=ke(t,o),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=o.current,{onPointerInTransitChange:c}=r,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const w=g.currentTarget,b={x:g.clientX,y:g.clientY},E=Kh(b,w.getBoundingClientRect()),_=qh(b,E),A=Yh(v.getBoundingClientRect()),D=Qh([..._,...A]);i(D),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=w=>h(w,l),v=w=>h(w,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 w=v.target,b={x:v.clientX,y:v.clientY},E=(m==null?void 0:m.contains(w))||(l==null?void 0:l.contains(w)),_=!Xh(b,a);E?d():_&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Wh,Gh]=or(ln,{isInside:!1}),Vh=$d("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,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(Vh,{children:r}),u.jsx(Wh,{scope:n,isInside:!0,children:u.jsx(Lh,{id:m.contentId,role:"tooltip",children:o||r})})]})})});al.displayName=Gt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=sr(n);return Gh(ll,n).isInside?null:u.jsx(go,{...o,...r,ref:t})});cl.displayName=ll;function Kh(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function qh(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Yh(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Xh(e,t){const{x:n,y:r}=e;let o=!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>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function Qh(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Jh(t)}function Jh(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Zh=nl,eg=rl,tg=ol,ng=sl,rg=al,og=cl;function sg({delayDuration:e=0,...t}){return u.jsx(Zh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ag({...e}){return u.jsx(sg,{children:u.jsx(eg,{"data-slot":"tooltip",...e})})}function ig({...e}){return u.jsx(tg,{"data-slot":"tooltip-trigger",...e})}function lg({className:e,sideOffset:t=0,children:n,...r}){return u.jsx(ng,{children:u.jsxs(rg,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,u.jsx(og,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const cg=p.lazy(()=>_e(()=>import("./mermaid-VLURNSYL-DiBP7v4h.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(cg,{className:ee("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Ro.displayName="MessageResponse";var ar="Collapsible",[ug]=nt(ar),[dg,No]=ug(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:r,defaultProp:o??!1,onChange:a,caller:ar});return u.jsx(dg,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(ge.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,...r}=e,o=No(dl,n);return u.jsx(ge.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Mo(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||o.open,children:({present:s})=>u.jsx(fg,{...r,ref:t,present:s})})});ml.displayName=Io;var fg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=No(Io,n),[i,m]=p.useState(r),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,w=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),Je(()=>{const E=f.current;if(E){b.current=b.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const _=E.getBoundingClientRect();c.current=_.height,h.current=_.width,w.current||(E.style.transitionDuration=b.current.transitionDuration,E.style.animationName=b.current.animationName),m(r)}},[a.open,r]),u.jsx(ge.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&&o})});function Mo(e){return e?"open":"closed"}var mg=ul;function pg({...e}){return u.jsx(mg,{"data-slot":"collapsible",...e})}function hg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function gg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const xg=({children:e,as:t="p",className:n,duration:r=2})=>{const o=pc.create(t);return u.jsx(o,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},vg=p.memo(xg),pl=p.createContext(null),bg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},yg=1e3,wg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:o,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:r,onChange:o}),[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)/wg)),v(null))},[t,g,c]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!w&&r&&!t&&m&&!d){const E=setTimeout(()=>{f(!1),h(!0)},yg);return()=>clearTimeout(E)}},[t,m,r,f,d,w]);const b=E=>{f(E)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(pg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),Cg=(e,t)=>e||t===0?u.jsx(vg,{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=Cg,...r})=>{const{isStreaming:o,isOpen:s,duration:a}=bg();return u.jsx(hg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??u.jsxs(u.Fragment,{children:[u.jsx(xu,{className:"size-4"}),n(o,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(gg,{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 Sg({entry:e}){const[t,n]=p.useState(!1),[r,o]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&o(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(Ag,{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&&r&&`max-h-[${Sr}px]`),style:!t&&r?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&r&&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 kg({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,r)=>{if(n.type==="thought"){const o=r===e.chunks.length-1,s=t&&o;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})})]},r)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},r)})]})]})}function Ag({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),r=(()=>{switch(e.kind){case"text":return u.jsx(Ht,{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(Ht,{className:"h-4 w-4"})}})(),o=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:[r,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:[o&&u.jsx("span",{children:o}),o&&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 Tg(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 Rg({requestId:e,options:t,onRespond:n,className:r}){const o=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",r),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:Tg(s.kind),size:"sm",onClick:()=>o(s),className:"gap-1.5",children:[jg(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Ng=1e6;function kr({filePath:e,oldString:t,newString:n,label:r}){const o=Mg(t,n),s=Es(o,"add"),a=Es(o,"remove"),i=o.length>ks?o.slice(0,ks):o,m=o.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]}),r&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),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(Ig,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ig({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 As(e){return e.length===0?[]:e.split(`
|
|
227
|
-
`)}function
|
|
228
|
-
`),2e3);const n=e.rawOutput;if(n){for(const r of
|
|
229
|
-
`),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?At(JSON.stringify(e.rawOutput,null,2),2e3):""}function At(e,t){return e.length>t?e.slice(0,t)+"...":e}function
|
|
226
|
+
`;let Cr;function Dh(e,t){return new Promise(((n,r)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Oh));const o=new Worker(Cr);o.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)o.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void o.terminate();n(a.data.file),o.terminate()}else t.onProgress(a.data.progress)})),o.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Te(e,t){return new Promise((function(n,r){let o,s,a,i,m,f;if(o={...t},a=0,{onProgress:i}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Ph))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return As(e,o).then((function(h){try{return s=h,d.call(this)}catch(g){return r(g)}}).bind(this),r);var l=(function(){try{return d.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return As(e,o).then((function(g){try{return s=g,l()}catch(v){return r(v)}}),r)}catch(g){return r(g)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Dh(e,o).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{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(s=Vi(e,s))}catch{}return n(s)}}))}Te.getDataUrlFromFile=Xi,Te.getFilefromDataUrl=To,Te.loadImage=Qi,Te.drawImageInCanvas=Zi,Te.drawFileInCanvas=Wn,Te.canvasToFile=Gn,Te.getExifOrientation=el,Te.handleMaxWidthOrHeight=tl,Te.followExifOrientation=nl,Te.cleanupCanvasMemory=Ge,Te.isAutoOrientationInBrowser=$t,Te.approximateBelowMaximumCanvasSizeOfBrowser=Ji,Te.copyExifWithoutOrientation=Vi,Te.getBrowserName=St,Te.version="2.0.2";var Lh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Lh.reduce((e,t)=>{const n=Ca(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Fh=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"}),$h="VisuallyHidden",rl=p.forwardRef((e,t)=>u.jsx(ge.span,{...e,ref:t,style:{...Fh,...e.style}}));rl.displayName=$h;var Uh=rl,[or]=nt("Tooltip",[Xt]),sr=Xt(),ol="TooltipProvider",zh=700,Vr="tooltip.open",[Hh,jo]=or(ol),sl=e=>{const{__scopeTooltip:t,delayDuration:n=zh,skipDelayDuration:r=300,disableHoverableContent:o=!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(Hh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:o,children:s})};sl.displayName=ol;var ln="Tooltip",[Bh,vn]=or(ln),al=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,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,w=p.useRef(!1),[b,E]=ut({prop:r,defaultProp:o??!1,onChange:T=>{T?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(T)},caller:ln}),_=p.useMemo(()=>b?w.current?"delayed-open":"instant-open":"closed",[b]),A=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w.current=!1,E(!0)},[E]),D=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,E(!1)},[E]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{w.current=!0,E(!0),h.current=0},v)},[v,E]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(ho,{...f,children:u.jsx(Bh,{scope:t,contentId:d,open:b,stateAttribute:_,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():A()},[m.isOpenDelayedRef,k,A]),onTriggerLeave:p.useCallback(()=>{g?D():(window.clearTimeout(h.current),h.current=0)},[D,g]),onOpen:A,onClose:D,disableHoverableContent:g,children:n})})};al.displayName=ln;var Kr="TooltipTrigger",il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,o.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(Zn,{asChild:!0,...a,children:u.jsx(ge.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});il.displayName=Kr;var Ro="TooltipPortal",[Wh,Gh]=or(Ro,{forceMount:void 0}),ll=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=vn(Ro,t);return u.jsx(Wh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};ll.displayName=Ro;var Gt="TooltipContent",cl=p.forwardRef((e,t)=>{const n=Gh(Gt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:r||a.open,children:a.disableHoverableContent?u.jsx(ul,{side:o,...s,ref:t}):u.jsx(Vh,{side:o,...s,ref:t})})}),Vh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),r=jo(Gt,e.__scopeTooltip),o=p.useRef(null),s=ke(t,o),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=o.current,{onPointerInTransitChange:c}=r,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const w=g.currentTarget,b={x:g.clientX,y:g.clientY},E=Xh(b,w.getBoundingClientRect()),_=Qh(b,E),A=Jh(v.getBoundingClientRect()),D=eg([..._,...A]);i(D),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=w=>h(w,l),v=w=>h(w,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 w=v.target,b={x:v.clientX,y:v.clientY},E=(m==null?void 0:m.contains(w))||(l==null?void 0:l.contains(w)),_=!Zh(b,a);E?d():_&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(ul,{...e,ref:s})}),[Kh,qh]=or(ln,{isInside:!1}),Yh=Hd("TooltipContent"),ul=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,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(go,{"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(Yh,{children:r}),u.jsx(Kh,{scope:n,isInside:!0,children:u.jsx(Uh,{id:m.contentId,role:"tooltip",children:o||r})})]})})});cl.displayName=Gt;var dl="TooltipArrow",fl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=sr(n);return qh(dl,n).isInside?null:u.jsx(xo,{...o,...r,ref:t})});fl.displayName=dl;function Xh(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Qh(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Jh(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Zh(e,t){const{x:n,y:r}=e;let o=!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>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function eg(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),tg(t)}function tg(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ng=sl,rg=al,og=il,sg=ll,ag=cl,ig=fl;function lg({delayDuration:e=0,...t}){return u.jsx(ng,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function cg({...e}){return u.jsx(lg,{children:u.jsx(rg,{"data-slot":"tooltip",...e})})}function ug({...e}){return u.jsx(og,{"data-slot":"tooltip-trigger",...e})}function dg({className:e,sideOffset:t=0,children:n,...r}){return u.jsx(sg,{children:u.jsxs(ag,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,u.jsx(ig,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const fg=p.lazy(()=>_e(()=>import("./mermaid-VLURNSYL-CbW524nw.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const No=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(fg,{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);No.displayName="MessageResponse";var ar="Collapsible",[mg]=nt(ar),[pg,Mo]=mg(ar),ml=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:r,defaultProp:o??!1,onChange:a,caller:ar});return u.jsx(pg,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(ge.div,{"data-state":Po(m),"data-disabled":s?"":void 0,...i,ref:t})})});ml.displayName=ar;var pl="CollapsibleTrigger",hl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Mo(pl,n);return u.jsx(ge.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Po(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});hl.displayName=pl;var Io="CollapsibleContent",gl=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Mo(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||o.open,children:({present:s})=>u.jsx(hg,{...r,ref:t,present:s})})});gl.displayName=Io;var hg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=Mo(Io,n),[i,m]=p.useState(r),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,w=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const E=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(E)},[]),Je(()=>{const E=f.current;if(E){b.current=b.current||{transitionDuration:E.style.transitionDuration,animationName:E.style.animationName},E.style.transitionDuration="0s",E.style.animationName="none";const _=E.getBoundingClientRect();c.current=_.height,h.current=_.width,w.current||(E.style.transitionDuration=b.current.transitionDuration,E.style.animationName=b.current.animationName),m(r)}},[a.open,r]),u.jsx(ge.div,{"data-state":Po(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&&o})});function Po(e){return e?"open":"closed"}var gg=ml;function xg({...e}){return u.jsx(gg,{"data-slot":"collapsible",...e})}function vg({...e}){return u.jsx(hl,{"data-slot":"collapsible-trigger",...e})}function bg({...e}){return u.jsx(gl,{"data-slot":"collapsible-content",...e})}const yg=({children:e,as:t="p",className:n,duration:r=2})=>{const o=xc.create(t);return u.jsx(o,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},wg=p.memo(yg),xl=p.createContext(null),Cg=()=>{const e=p.useContext(xl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},Sg=1e3,kg=1e3,vl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:o,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:r,onChange:o}),[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)/kg)),v(null))},[t,g,c]);const w=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!w&&r&&!t&&m&&!d){const E=setTimeout(()=>{f(!1),h(!0)},Sg);return()=>clearTimeout(E)}},[t,m,r,f,d,w]);const b=E=>{f(E)};return u.jsx(xl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(xg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),Ag=(e,t)=>e||t===0?u.jsx(wg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),bl=p.memo(({className:e,children:t,getThinkingMessage:n=Ag,...r})=>{const{isStreaming:o,isOpen:s,duration:a}=Cg();return u.jsx(vg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??u.jsxs(u.Fragment,{children:[u.jsx(yu,{className:"size-4"}),n(o,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),yl=p.memo(({className:e,children:t,...n})=>u.jsx(bg,{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}));vl.displayName="Reasoning";bl.displayName="ReasoningTrigger";yl.displayName="ReasoningContent";const Sr=200;function Eg({entry:e}){const[t,n]=p.useState(!1),[r,o]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&o(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(Tg,{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(jg,{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&&r&&`max-h-[${Sr}px]`),style:!t&&r?{maxHeight:`${Sr}px`}:void 0,children:cu(e.content)}),!t&&r&&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 _g({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,r)=>{if(n.type==="thought"){const o=r===e.chunks.length-1,s=t&&o;return u.jsxs(vl,{isStreaming:s,children:[u.jsx(bl,{}),u.jsx(yl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(No,{children:n.text})},r)})]})]})}function Tg({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 jg({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{switch(e.kind){case"text":return u.jsx(Ht,{className:"h-4 w-4"});case"table":return u.jsx(oo,{className:"h-4 w-4"});case"directory":return u.jsx(ro,{className:"h-4 w-4"});default:return u.jsx(Ht,{className:"h-4 w-4"})}})(),o=e.size!=null?Rg(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:[r,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:[o&&u.jsx("span",{children:o}),o&&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 Rg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ng(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Mg(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 Ig({requestId:e,options:t,onRespond:n,className:r}){const o=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",r),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ga,{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:Ng(s.kind),size:"sm",onClick:()=>o(s),className:"gap-1.5",children:[Mg(s.kind),s.name]},s.optionId))})]})}const Es=1e3,Pg=1e6;function kr({filePath:e,oldString:t,newString:n,label:r}){const o=Dg(t,n),s=Ts(o,"add"),a=Ts(o,"remove"),i=o.length>Es?o.slice(0,Es):o,m=o.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]}),r&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),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(Og,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Og({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 _s(e){return e.length===0?[]:e.split(`
|
|
227
|
+
`)}function Ts(e,t){let n=0;for(const r of e)r.type===t&&n++;return n}function Dg(e,t){const n=_s(e),r=_s(t);let o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o++;let s=n.length,a=r.length;for(;s>o&&a>o&&n[s-1]===r[a-1];)s--,a--;const i=[];for(let m=0;m<o;m++)i.push({type:"context",text:n[m]});Lg(n.slice(o,s),r.slice(o,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Lg(e,t,n){const r=e.length,o=t.length;if(r===0&&o===0)return;if(r*o>Pg){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=o+1,a=new Uint32Array((r+1)*s);for(let f=r-1;f>=0;f--)for(let l=o-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<r&&m<o;)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<r;)n.push({type:"remove",text:e[i]}),i++;for(;m<o;)n.push({type:"add",text:t[m]}),m++}function wl({entries:e,onPermissionRespond:t}){const[n,r]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(js,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const o=Vg(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:()=>r(!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:o})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(js,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function js({tool:e,compact:t,onPermissionRespond:n}){const[r,o]=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:()=>o(!r),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(Ig,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Wg(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:At(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(Mn,{tool:e})]})})]})}const Fg=new Set(["FileEditTool","Edit","SedEdit"]),$g=new Set(["FileWriteTool","Write"]),Ug=new Set(["MultiEdit"]),zg=new Set(["BashTool","Bash","PowerShellTool"]),Hg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],Bg=["output","stdout","stderr","result"];function Wg(e){const t=qg(e.title),n=e.rawInput??{};if(Fg.has(t)){const r=We(n,["old_string","oldString"]),o=We(n,["new_string","newString"]);return r===void 0||o===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:We(n,["file_path","filePath"])??t,oldString:r,newString:o}),Nn(e)&&u.jsx(Mn,{tool:e})]})}if($g.has(t)){const r=We(n,["file_path","filePath"]),o=We(n,["content"]);if(r===void 0||o===void 0)return null;const s=We(e.rawOutput??{},Hg);return u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:r,oldString:s??"",newString:o,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(Mn,{tool:e})]})}if(Ug.has(t)){const r=n.edits;if(Array.isArray(r)&&r.length>0){const o=We(n,["file_path","filePath"])??t,s=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=We(m,["old_string","oldString"]),l=We(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(kr,{filePath:o,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(Mn,{tool:e})]})}return null}if(zg.has(t)){const r=We(n,["command","cmd","script"]),o=Yg(e);return r===void 0&&o.length===0?null:u.jsx(Gg,{command:r!==void 0?At(r,500):void 0,output:o,isError:e.status==="error"})}return null}function Gg({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 Vg(e){const t=new Map;for(const r of e){const o=Kg(r.toolCall.title);t.set(o,(t.get(o)||0)+1)}const n=[];for(const[r,o]of t)n.push(o===1?r:`${o} 次${r}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Kg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function qg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function We(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function Cl(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 Yg(e){const t=Cl(e);if(t.length>0)return At(t.join(`
|
|
228
|
+
`),2e3);const n=e.rawOutput;if(n){for(const r of Bg){const o=n[r];if(typeof o=="string"&&o.length>0)return At(o,2e3)}if(Object.keys(n).length>0)return At(JSON.stringify(n,null,2),2e3)}return""}function Mn({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:Xg(e)})}function Xg(e){const t=Cl(e);return t.length>0?At(t.join(`
|
|
229
|
+
`),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?At(JSON.stringify(e.rawOutput,null,2),2e3):""}function At(e,t){return e.length>t?e.slice(0,t)+"...":e}function Qg({entry:e}){const[t,n]=p.useState(!1),{entries:r}=e;if(r.length===0)return null;const o=r.filter(i=>i.status==="completed").length,s=r.length,a=s>0?Math.round(o/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:[o,"/",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:r.map((i,m)=>u.jsx(Jg,{entry:i},m))})]})})}function Jg({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(Zg,{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(ex,{priority:e.priority})]})}function Zg({status:e}){switch(e){case"completed":return u.jsx(_u,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ma,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(ju,{className:"h-3.5 w-3.5 text-text-muted"})}}function ex({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 tx({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(No,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
|
|
230
230
|
* Copyright (c) StackBlitz. All rights reserved.
|
|
231
231
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
232
|
-
*--------------------------------------------------------------------------------------------*/const
|
|
232
|
+
*--------------------------------------------------------------------------------------------*/const nx={damping:.7,stiffness:.05,mass:1.25},rx=70,ox=1e3/60,sx=350;let ir=!1;var Gs;(Gs=globalThis.document)==null||Gs.addEventListener("mousedown",()=>{ir=!0});var Vs;(Vs=globalThis.document)==null||Vs.addEventListener("mouseup",()=>{ir=!1});var Ks;(Ks=globalThis.document)==null||Ks.addEventListener("click",()=>{ir=!1});const ax=(e={})=>{const[t,n]=p.useState(!1),[r,o]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var A;if(!ir)return!1;const E=window.getSelection();if(!E||!E.rangeCount)return!1;const _=E.getRangeAt(0);return _.commonAncestorContainer.contains(w.current)||((A=w.current)==null?void 0:A.contains(_.commonAncestorContainer))},[]),f=p.useCallback(E=>{c.isAtBottom=E,o(E)},[]),l=p.useCallback(E=>{c.escapedFromLock=E,n(E)},[]),c=p.useMemo(()=>{let E;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var _;return((_=w.current)==null?void 0:_.scrollTop)??0},set scrollTop(_){if(w.current){const{scrollBehavior:A}=getComputedStyle(w.current);A!=="auto"&&(w.current.style.scrollBehavior="auto"),w.current.scrollTop=_,c.ignoreScrollToTop=w.current.scrollTop,A!=="auto"&&(w.current.style.scrollBehavior=A)}},get targetScrollTop(){return!w.current||!b.current?0:w.current.scrollHeight-1-w.current.clientHeight},get calculatedTargetScrollTop(){if(!w.current||!b.current)return 0;const{targetScrollTop:_}=this;if(!e.targetScrollTop)return _;if((E==null?void 0:E.targetScrollTop)===_)return E.calculatedScrollTop;const A=Math.max(Math.min(e.targetScrollTop(_,{scrollElement:w.current,contentElement:b.current}),_),0);return E={targetScrollTop:_,calculatedScrollTop:A},requestAnimationFrame(()=>{E=void 0}),A},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=rx}}},[]),d=p.useCallback((E={})=>{var y;typeof E=="string"&&(E={animation:E}),E.preserveScrollPosition||f(!0);const _=Date.now()+(Number(E.wait)||0),A=Er(i.current,E.animation),{ignoreEscapes:D=!1}=E;let k,T=c.calculatedTargetScrollTop;E.duration instanceof Promise?E.duration.finally(()=>{k=Date.now()}):k=_+(E.duration??0);const x=async()=>{const j=new Promise(requestAnimationFrame).then(()=>{var M;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:I}=c,O=performance.now(),F=(O-(c.lastTick??O))/ox;if(c.animation||(c.animation={behavior:A,promise:j,ignoreEscapes:D}),c.animation.behavior===A&&(c.lastTick=O),m()||_>Date.now())return x();if(I<Math.min(T,c.calculatedTargetScrollTop)){if(((M=c.animation)==null?void 0:M.behavior)===A){if(A==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(A.damping*c.velocity+A.stiffness*c.scrollDifference)/A.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==I&&(c.accumulated=0)}return x()}return k>Date.now()?(T=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:Er(i.current,i.current.resize),ignoreEscapes:D,duration:Math.max(0,k-Date.now())||void 0}):c.isAtBottom)});return j.then(I=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),I))};return E.wait!==!0&&(c.animation=void 0),((y=c.animation)==null?void 0:y.behavior)===A?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:E})=>{if(E!==w.current)return;const{scrollTop:_,ignoreScrollToTop:A}=c;let{lastScrollTop:D=_}=c;c.lastScrollTop=_,c.ignoreScrollToTop=void 0,A&&A>_&&(D=A),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||_===A)return;if(m()){l(!0),f(!1);return}const k=_>D,T=_<D;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=D;return}T&&(l(!0),f(!1)),k&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:E,deltaY:_})=>{var D;let A=E;for(;!["scroll","auto"].includes(getComputedStyle(A).overflow);){if(!A.parentElement)return;A=A.parentElement}A===w.current&&_<0&&w.current.scrollHeight>w.current.clientHeight&&!((D=c.animation)!=null&&D.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),w=Rs(E=>{var _,A;(_=w.current)==null||_.removeEventListener("scroll",g),(A=w.current)==null||A.removeEventListener("wheel",v),E==null||E.addEventListener("scroll",g,{passive:!0}),E==null||E.addEventListener("wheel",v,{passive:!0})},[]),b=Rs(E=>{var A,D;if((A=c.resizeObserver)==null||A.disconnect(),!E)return;let _;c.resizeObserver=new ResizeObserver(([k])=>{const{height:T}=k.contentRect,x=T-(_??T);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const y=Er(i.current,_?i.current.resize:i.current.initial);d({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:sx})}else c.isNearBottom&&(l(!1),f(!0));_=T,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(D=c.resizeObserver)==null||D.observe(E)},[]);return{contentRef:b,scrollRef:w,scrollToBottom:d,stopScroll:h,isAtBottom:r||s,isNearBottom:s,escapedFromLock:t,state:c}};function Rs(e,t){const n=p.useCallback(r=>(n.current=r,e(r)),t);return n}const Ar=new Map;function Er(...e){const t={...nx};let n=!1;for(const o of e){if(o==="instant"){n=!0;continue}typeof o=="object"&&(n=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const r=JSON.stringify(t);return Ar.has(r)||Ar.set(r,Object.freeze(t)),n?"instant":Ar.get(r)}/*!---------------------------------------------------------------------------------------------
|
|
233
233
|
* Copyright (c) StackBlitz. All rights reserved.
|
|
234
234
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
235
|
-
*--------------------------------------------------------------------------------------------*/const yl=p.createContext(null),ox=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Vn({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((D,k)=>{const T=(A==null?void 0:A.targetScrollTop)??i;return(T==null?void 0:T(D,k))??D},[i]),d=rx({mass:o,damping:s,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:w,isAtBottom:b,escapedFromLock:E,state:_}=e??d,A=p.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:h,isAtBottom:b,escapedFromLock:E,contentRef:g,state:_,get targetScrollTop(){return l.current},set targetScrollTop(D){l.current=D}}),[v,b,g,h,w,E,_]);return p.useImperativeHandle(m,()=>A,[A]),ox(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(yl.Provider,{value:A},p.createElement("div",{...f},typeof t=="function"?t(A):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Po();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Vn||(Vn={}));function Po(){const e=p.useContext(yl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const sx=({className:e,...t})=>u.jsx(Vn,{className:ee("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),ax=({className:e,...t})=>u.jsx(Vn.Content,{className:ee("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),ix=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:o,...s})=>u.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:o??u.jsxs(u.Fragment,{children:[r&&u.jsx("div",{className:"text-text-muted",children:r}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&u.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),lx=({className:e,...t})=>{const{scrollToBottom:n}=Po(),r=p.useCallback(()=>{n()},[n]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(hu,{className:"size-4"})})},cx="data-last-user-message",ux=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${cx}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:u.jsx(ha,{className:"size-4"})})},dx=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Po();return r?null:u.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&u.jsx(ux,{}),u.jsx(lx,{})]})};function fx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r="开始对话",emptyDescription:o="输入消息开始聊天"}){var f;const s=hx(e),a=e.length>0;let i=-1;for(let l=s.length-1;l>=0;l--){const c=s[l];if(c.type==="single"&&c.entry.type==="user_message"){i=l;break}}const m=t&&e.length>0&&((f=e[e.length-1])==null?void 0:f.type)==="user_message";return u.jsx(sx,{className:"flex-1",children:u.jsxs(ax,{children:[a?u.jsxs(u.Fragment,{children:[s.map((l,c)=>{if(l.type==="single"){const d=l.entry.type==="user_message"&&c===i;return u.jsx("div",{"data-last-user-message":d?"true":void 0,className:ee(mx(e,c)),children:u.jsx(px,{entry:l.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`)}return u.jsx("div",{className:"-mt-2",children:u.jsx(vl,{entries:l.entries,onPermissionRespond:n})},`group-${c}`)}),m&&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 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(ix,{title:r,description:o}),u.jsx(dx,{hasUserMessages:e.some(l=>l.type==="user_message")})]})})}function mx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function px({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(Sg,{entry:e});case"assistant_message":return u.jsx(kg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(vl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(qg,{entry:e});case"command_output":return u.jsx(Jg,{entry:e});default:return null}}function hx(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const o of e)o.type==="tool_call"?n.push(o):(r(),t.push({type:"single",entry:o}));return r(),t}function gx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function xx({commands:e,filter:t,onSelect:n,onClose:r,className:o}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>gx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),u.jsx("div",{ref:s,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",o),children:u.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?u.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,l)=>{var c;return u.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[u.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),u.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&u.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function kt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const vx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},bx=500*1024,wl=2*1024*1024,_r=200,js=5*1024*1024,yx=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),wx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Cl(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return yx.has(t)}function qr(e){const t=cn(e.name);return wx.has(t)}function Cx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:o="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:d,className:h}){const g=s??a??!1,[v,w]=p.useState(""),[b,E]=p.useState([]),[_,A]=p.useState([]),[D,k]=p.useState(!1),[T,x]=p.useState(""),[y,j]=p.useState(!1),[M,O]=p.useState(!1),[F,I]=p.useState(!1),[z,S]=p.useState(null),[C,H]=p.useState([]),[P,U]=p.useState(0),q=p.useRef(0),N=p.useRef(null),L=p.useRef(null),$=p.useRef(null),R=p.useRef(null),B=p.useRef(null),G=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{kt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!M)return;const W=Y=>{var le,ve;const Z=Y.target,ce=(le=G.current)==null?void 0:le.contains(Z),Se=(ve=K.current)==null?void 0:ve.contains(Z);!ce&&!Se&&O(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[M]);const V=p.useCallback(W=>{const Y=(W??v).trim(),Z=b.length>0||_.length>0;!Y&&!Z||r||F||(e({text:Y,images:b.length>0?b:void 0,attachments:_.length>0?_:void 0}),w(""),E([]),A([]),k(!1),x(""),N.current&&(N.current.style.height="auto"))},[v,b,_,r,F,e]),ne=p.useCallback(async W=>{if(!d)return;const Y=++q.current;try{const Z=await d(W);q.current===Y&&H(Z.slice(0,8))}catch{q.current===Y&&H([])}},[d]),J=p.useCallback(W=>{const Y=N.current;if(!Y||z===null)return;const Z=Y.selectionStart??v.length,ce=v.slice(0,Z),Se=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Se)return;const le=Z-Se[1].length-1,ve=`@${W} `,Xe=v.slice(0,le)+ve+v.slice(Z);w(Xe),S(null),H([]),requestAnimationFrame(()=>{const Mt=le+ve.length;Y.focus(),Y.setSelectionRange(Mt,Mt)})},[v,z]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(z!==null&&C.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),U(Z=>{const ce=W.key==="ArrowDown"?1:-1;return(Z+ce+C.length)%C.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const Z=C[P];Z&&J(Z);return}if(W.key==="Escape"){W.preventDefault(),S(null),H([]);return}}if(D){if(W.key==="Escape"){W.preventDefault(),k(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),k(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():V())},[V,t,f,m,n,D,z,C,P,J]),ue=p.useCallback(W=>{const Y=W.target.value;if(w(Y),Y.startsWith("/")&&i&&i.length>0&&!/\s/.test(Y.slice(1))?(k(!0),x(Y.slice(1))):D&&(k(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Se=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(le){const ve=le[1]||"";S(ve),U(0),ne(ve)}else S(null),H([])}const Z=W.target;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,200)+"px"},[i,D,d,ne]),be=p.useCallback(async W=>{if(kt("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(Z=>Z.type.startsWith("image/"));if(kt("[ChatInput] paste image files",{count:Y.length,types:Y.map(Z=>Z.type)}),Y.length!==0){W.preventDefault(),I(!0);try{const Z=await Tr(Y);E(ce=>[...ce,...Z])}finally{I(!1)}}},[g]),de=p.useCallback(async()=>{if(!L.current)return;const W=L.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Tr(Array.from(W));E(Z=>[...Z,...Y])}finally{L.current.value="",I(!1)}}},[]),ye=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Rs(Array.from(W));A(Z=>[...Z,...Y])}finally{$.current.value="",I(!1)}}},[]),fe=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Ns(Array.from(W));A(Z=>[...Z,...Y])}finally{R.current.value="",I(!1)}}},[]),ie=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await kx(Array.from(W));Y&&A(Z=>[...Z,Y])}finally{B.current.value="",I(!1)}}},[]),xe=p.useCallback(W=>{E(Y=>Y.filter((Z,ce)=>ce!==W))},[]),we=p.useCallback(W=>{A(Y=>Y.filter((Z,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var Z,ce;k(!1),x("");const Y=`/${W.name}`;(Z=W.input)!=null&&Z.hint?(w(`${Y} `),(ce=N.current)==null||ce.focus()):V(Y)},[V]),Ee=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||j(!0))},[g,y]),Ce=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&j(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),j(!1),I(!0);try{const Z=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Se=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&Cl(le));if(Z.length>0){const le=await Tr(Z);E(ve=>[...ve,...le])}if(ce.length>0){const le=await Ns(ce);A(ve=>[...ve,...le])}if(Se.length>0){const le=await Rs(Se);A(ve=>[...ve,...le])}}finally{I(!1)}}},[g]),je=p.useCallback(()=>{var W;D?(k(!1),x("")):(v.startsWith("/")||w("/"+v),k(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[D,v]),He=b.length+_.length,xt=(v.trim()||He>0)&&!r&&!F;return u.jsxs("div",{className:ee("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",h),children:[u.jsxs("div",{className:"relative",children:[D&&i&&i.length>0&&u.jsx(xx,{commands:i,filter:T,onSelect:me,onClose:()=>{k(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),z!==null&&C.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",z?`“@${z}”`:""," — ↑↓ 选择,Enter 插入"]}),C.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:Z=>{Z.preventDefault(),J(W)},onMouseEnter:()=>U(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===P?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Ht,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),M&&g&&u.jsxs("div",{ref:G,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=L.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Pu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Ht,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(ro,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(no,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"目录"})]})]}),u.jsxs("div",{onDragOver:Ee,onDragLeave:Ce,onDrop:pe,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",y&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:b.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>xe(Y),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${Y+1}`,children:"×"})]},Y))}),_.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:_.map((W,Y)=>u.jsx(Sx,{attachment:W,onRemove:()=>we(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[g&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:K,type:"button",onClick:()=>O(W=>!W),disabled:r||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",M?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Xu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:de}),u.jsx("input",{ref:$,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:ye}),u.jsx("input",{ref:R,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:fe}),u.jsx("input",{ref:B,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ie})]}),i&&i.length>0&&u.jsx("button",{type:"button",onClick:je,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",D?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:r,title:"命令列表",children:u.jsx(ud,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:be,placeholder:F?"处理文件中…":o,disabled:r,rows:1,className:ee("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),u.jsx("button",{type:"button",onClick:t?n:()=>V(),disabled:!t&&!xt,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":xt?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?u.jsx(fd,{className:"h-3.5 w-3.5",fill:"currentColor"}):F?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(rd,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(Tu,{className:"h-3 w-3"}),u.jsxs("span",{children:[l," 条消息排队中,完成后自动发送",c?"(点击取消全部)":""]}),c&&u.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[u.jsx(dn,{className:"h-3 w-3"}),"取消"]})]}),u.jsx("div",{className:"text-center mt-1.5",children:u.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:["Enter 发送,Shift+Enter 换行",d?",@ 补全文件":""]})})]})}function Sx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return u.jsx(Ht,{className:"h-3.5 w-3.5"});case"table":return u.jsx(ro,{className:"h-3.5 w-3.5"});case"directory":return u.jsx(no,{className:"h-3.5 w-3.5"});default:return u.jsx(Ht,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?zt(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null;return u.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,u.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&u.jsx("span",{className:"text-text-muted text-[10px]",children:r}),o!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[o," 文件"]}),u.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:u.jsx(dn,{className:"h-3 w-3"})})]})}function zt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Tr(e){const t=[];for(const n of e)try{let r=n,o=n.type;n.size>2*1024*1024&&(r=await Te(n,vx),o="image/jpeg");const s=await Ax(r);t.push({mimeType:o,data:s})}catch(r){console.error("Failed to process image:",r)}return t}async function Rs(e){const t=[];for(const n of e)try{if(n.size>wl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>bx&&console.warn(`File ${n.name} is large (${zt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Ns(e){const t=[];for(const n of e)try{const r=cn(n.name);if(r===".csv"||r===".tsv"){const o=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const o=await n.arrayBuffer(),s=await Sl(o);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Sl(e){const t=await _e(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const o of n.SheetNames){const s=n.Sheets[o];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?r.push(`## Sheet: ${o}
|
|
235
|
+
*--------------------------------------------------------------------------------------------*/const Sl=p.createContext(null),ix=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Vn({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((D,k)=>{const T=(A==null?void 0:A.targetScrollTop)??i;return(T==null?void 0:T(D,k))??D},[i]),d=ax({mass:o,damping:s,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:w,isAtBottom:b,escapedFromLock:E,state:_}=e??d,A=p.useMemo(()=>({scrollToBottom:v,stopScroll:w,scrollRef:h,isAtBottom:b,escapedFromLock:E,contentRef:g,state:_,get targetScrollTop(){return l.current},set targetScrollTop(D){l.current=D}}),[v,b,g,h,w,E,_]);return p.useImperativeHandle(m,()=>A,[A]),ix(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(Sl.Provider,{value:A},p.createElement("div",{...f},typeof t=="function"?t(A):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Oo();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Vn||(Vn={}));function Oo(){const e=p.useContext(Sl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const lx=({className:e,...t})=>u.jsx(Vn,{className:ee("relative flex-1 overflow-y-hidden overflow-x-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),cx=({className:e,...t})=>u.jsx(Vn.Content,{className:ee("mx-auto flex max-w-3xl flex-col gap-2 px-4 py-8 sm:px-8 sm:py-12 min-w-0",e),...t}),ux=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:o,...s})=>u.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:o??u.jsxs(u.Fragment,{children:[r&&u.jsx("div",{className:"text-text-muted",children:r}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&u.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),dx=({className:e,...t})=>{const{scrollToBottom:n}=Oo(),r=p.useCallback(()=>{n()},[n]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(vu,{className:"size-4"})})},fx="data-last-user-message",mx=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${fx}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:u.jsx(va,{className:"size-4"})})},px=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Oo();return r?null:u.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&u.jsx(mx,{}),u.jsx(dx,{})]})};function hx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r="开始对话",emptyDescription:o="输入消息开始聊天"}){var f;const s=vx(e),a=e.length>0;let i=-1;for(let l=s.length-1;l>=0;l--){const c=s[l];if(c.type==="single"&&c.entry.type==="user_message"){i=l;break}}const m=t&&e.length>0&&((f=e[e.length-1])==null?void 0:f.type)==="user_message";return u.jsx(lx,{className:"flex-1",children:u.jsxs(cx,{children:[a?u.jsxs(u.Fragment,{children:[s.map((l,c)=>{if(l.type==="single"){const d=l.entry.type==="user_message"&&c===i;return u.jsx("div",{"data-last-user-message":d?"true":void 0,className:ee(gx(e,c)),children:u.jsx(xx,{entry:l.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`)}return u.jsx("div",{className:"-mt-2",children:u.jsx(wl,{entries:l.entries,onPermissionRespond:n})},`group-${c}`)}),m&&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 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(ux,{title:r,description:o}),u.jsx(px,{hasUserMessages:e.some(l=>l.type==="user_message")})]})})}function gx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function xx({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(Eg,{entry:e});case"assistant_message":return u.jsx(_g,{entry:e,isStreaming:t});case"tool_call":return u.jsx(wl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(Qg,{entry:e});case"command_output":return u.jsx(tx,{entry:e});default:return null}}function vx(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const o of e)o.type==="tool_call"?n.push(o):(r(),t.push({type:"single",entry:o}));return r(),t}function bx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function yx({commands:e,filter:t,onSelect:n,onClose:r,className:o}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>bx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),u.jsx("div",{ref:s,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",o),children:u.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?u.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,l)=>{var c;return u.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[u.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),u.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&u.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function kt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const wx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},Cx=500*1024,kl=2*1024*1024,_r=200,Ns=5*1024*1024,Sx=new Set([".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".csv",".tsv",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".pyw",".rb",".go",".rs",".java",".kt",".kts",".c",".h",".cc",".cpp",".hpp",".cxx",".cs",".swift",".m",".mm",".sh",".bash",".zsh",".fish",".ps1",".bat",".cmd",".sql",".graphql",".gql",".css",".scss",".sass",".less",".styl",".vue",".svelte",".astro",".lua",".r",".R",".jl",".ex",".exs",".erl",".hs",".ml",".php",".pl",".pm",".dockerfile",".makefile",".cmake",".gitignore",".env",".editorconfig",".prettierrc",".eslintrc",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".thrift",".tf",".hcl",".sol"]),kx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Al(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return Sx.has(t)}function qr(e){const t=cn(e.name);return kx.has(t)}function Ax({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:o="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:d,className:h}){const g=s??a??!1,[v,w]=p.useState(""),[b,E]=p.useState([]),[_,A]=p.useState([]),[D,k]=p.useState(!1),[T,x]=p.useState(""),[y,j]=p.useState(!1),[I,O]=p.useState(!1),[F,M]=p.useState(!1),[z,S]=p.useState(null),[C,H]=p.useState([]),[P,U]=p.useState(0),q=p.useRef(0),N=p.useRef(null),L=p.useRef(null),$=p.useRef(null),R=p.useRef(null),B=p.useRef(null),G=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{kt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!I)return;const W=Y=>{var le,ve;const Z=Y.target,ce=(le=G.current)==null?void 0:le.contains(Z),Se=(ve=K.current)==null?void 0:ve.contains(Z);!ce&&!Se&&O(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[I]);const V=p.useCallback(W=>{const Y=(W??v).trim(),Z=b.length>0||_.length>0;!Y&&!Z||r||F||(e({text:Y,images:b.length>0?b:void 0,attachments:_.length>0?_:void 0}),w(""),E([]),A([]),k(!1),x(""),N.current&&(N.current.style.height="auto"))},[v,b,_,r,F,e]),ne=p.useCallback(async W=>{if(!d)return;const Y=++q.current;try{const Z=await d(W);q.current===Y&&H(Z.slice(0,8))}catch{q.current===Y&&H([])}},[d]),J=p.useCallback(W=>{const Y=N.current;if(!Y||z===null)return;const Z=Y.selectionStart??v.length,ce=v.slice(0,Z),Se=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Se)return;const le=Z-Se[1].length-1,ve=`@${W} `,Xe=v.slice(0,le)+ve+v.slice(Z);w(Xe),S(null),H([]),requestAnimationFrame(()=>{const It=le+ve.length;Y.focus(),Y.setSelectionRange(It,It)})},[v,z]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(z!==null&&C.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),U(Z=>{const ce=W.key==="ArrowDown"?1:-1;return(Z+ce+C.length)%C.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const Z=C[P];Z&&J(Z);return}if(W.key==="Escape"){W.preventDefault(),S(null),H([]);return}}if(D){if(W.key==="Escape"){W.preventDefault(),k(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),k(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():V())},[V,t,f,m,n,D,z,C,P,J]),ue=p.useCallback(W=>{const Y=W.target.value;if(w(Y),Y.startsWith("/")&&i&&i.length>0&&!/\s/.test(Y.slice(1))?(k(!0),x(Y.slice(1))):D&&(k(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Se=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(le){const ve=le[1]||"";S(ve),U(0),ne(ve)}else S(null),H([])}const Z=W.target;Z.style.height="auto",Z.style.height=Math.min(Z.scrollHeight,200)+"px"},[i,D,d,ne]),be=p.useCallback(async W=>{if(kt("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(Z=>Z.type.startsWith("image/"));if(kt("[ChatInput] paste image files",{count:Y.length,types:Y.map(Z=>Z.type)}),Y.length!==0){W.preventDefault(),M(!0);try{const Z=await Tr(Y);E(ce=>[...ce,...Z])}finally{M(!1)}}},[g]),de=p.useCallback(async()=>{if(!L.current)return;const W=L.current.files;if(!(!W||W.length===0)){M(!0);try{const Y=await Tr(Array.from(W));E(Z=>[...Z,...Y])}finally{L.current.value="",M(!1)}}},[]),ye=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){M(!0);try{const Y=await Ms(Array.from(W));A(Z=>[...Z,...Y])}finally{$.current.value="",M(!1)}}},[]),fe=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){M(!0);try{const Y=await Is(Array.from(W));A(Z=>[...Z,...Y])}finally{R.current.value="",M(!1)}}},[]),ie=p.useCallback(async()=>{if(!B.current)return;const W=B.current.files;if(!(!W||W.length===0)){M(!0);try{const Y=await _x(Array.from(W));Y&&A(Z=>[...Z,Y])}finally{B.current.value="",M(!1)}}},[]),xe=p.useCallback(W=>{E(Y=>Y.filter((Z,ce)=>ce!==W))},[]),we=p.useCallback(W=>{A(Y=>Y.filter((Z,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var Z,ce;k(!1),x("");const Y=`/${W.name}`;(Z=W.input)!=null&&Z.hint?(w(`${Y} `),(ce=N.current)==null||ce.focus()):V(Y)},[V]),Ee=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||j(!0))},[g,y]),Ce=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&j(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),j(!1),M(!0);try{const Z=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Se=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&Al(le));if(Z.length>0){const le=await Tr(Z);E(ve=>[...ve,...le])}if(ce.length>0){const le=await Is(ce);A(ve=>[...ve,...le])}if(Se.length>0){const le=await Ms(Se);A(ve=>[...ve,...le])}}finally{M(!1)}}},[g]),je=p.useCallback(()=>{var W;D?(k(!1),x("")):(v.startsWith("/")||w("/"+v),k(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[D,v]),He=b.length+_.length,xt=(v.trim()||He>0)&&!r&&!F;return u.jsxs("div",{className:ee("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",h),children:[u.jsxs("div",{className:"relative",children:[D&&i&&i.length>0&&u.jsx(yx,{commands:i,filter:T,onSelect:me,onClose:()=>{k(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),z!==null&&C.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",z?`“@${z}”`:""," — ↑↓ 选择,Enter 插入"]}),C.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:Z=>{Z.preventDefault(),J(W)},onMouseEnter:()=>U(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===P?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Ht,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),I&&g&&u.jsxs("div",{ref:G,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=L.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Lu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Ht,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(oo,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=B.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(ro,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"目录"})]})]}),u.jsxs("div",{onDragOver:Ee,onDragLeave:Ce,onDrop:pe,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",y&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:b.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>xe(Y),className:"absolute -top-1.5 -right-1.5 min-h-[32px] min-w-[32px] h-5 w-5 rounded-full bg-surface-2 border border-border flex items-center justify-center text-text-muted hover:text-text-primary text-xs opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove image ${Y+1}`,children:"×"})]},Y))}),_.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:_.map((W,Y)=>u.jsx(Ex,{attachment:W,onRemove:()=>we(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[g&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:K,type:"button",onClick:()=>O(W=>!W),disabled:r||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",I?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Zu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref:L,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:de}),u.jsx("input",{ref:$,type:"file",accept:[".txt",".md",".markdown",".rst",".json",".jsonl",".yaml",".yml",".toml",".xml",".html",".htm",".js",".jsx",".ts",".tsx",".mjs",".cjs",".py",".rb",".go",".rs",".java",".kt",".c",".h",".cc",".cpp",".hpp",".cs",".swift",".sh",".bash",".zsh",".sql",".graphql",".gql",".css",".scss",".sass",".less",".vue",".svelte",".lua",".r",".jl",".ex",".exs",".php",".pl",".dockerfile",".makefile",".gitignore",".env",".editorconfig",".log",".diff",".patch",".ini",".cfg",".conf",".proto",".tf",".hcl",".sol","text/*"].join(","),multiple:!0,className:"hidden",onChange:ye}),u.jsx("input",{ref:R,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:fe}),u.jsx("input",{ref:B,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ie})]}),i&&i.length>0&&u.jsx("button",{type:"button",onClick:je,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",D?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:r,title:"命令列表",children:u.jsx(md,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:be,placeholder:F?"处理文件中…":o,disabled:r,rows:1,className:ee("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),u.jsx("button",{type:"button",onClick:t?n:()=>V(),disabled:!t&&!xt,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":xt?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?u.jsx(hd,{className:"h-3.5 w-3.5",fill:"currentColor"}):F?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(ad,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(Nu,{className:"h-3 w-3"}),u.jsxs("span",{children:[l," 条消息排队中,完成后自动发送",c?"(点击取消全部)":""]}),c&&u.jsxs("button",{type:"button",onClick:()=>{for(let W=l-1;W>=0;W--)c(W)},className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:[u.jsx(dn,{className:"h-3 w-3"}),"取消"]})]}),u.jsx("div",{className:"text-center mt-1.5",children:u.jsxs("span",{className:"text-[11px] text-text-muted font-display",children:["Enter 发送,Shift+Enter 换行",d?",@ 补全文件":""]})})]})}function Ex({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return u.jsx(Ht,{className:"h-3.5 w-3.5"});case"table":return u.jsx(oo,{className:"h-3.5 w-3.5"});case"directory":return u.jsx(ro,{className:"h-3.5 w-3.5"});default:return u.jsx(Ht,{className:"h-3.5 w-3.5"})}})(),r=e.size!=null?zt(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null;return u.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,u.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&u.jsx("span",{className:"text-text-muted text-[10px]",children:r}),o!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[o," 文件"]}),u.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:u.jsx(dn,{className:"h-3 w-3"})})]})}function zt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function Tr(e){const t=[];for(const n of e)try{let r=n,o=n.type;n.size>2*1024*1024&&(r=await Te(n,wx),o="image/jpeg");const s=await Tx(r);t.push({mimeType:o,data:s})}catch(r){console.error("Failed to process image:",r)}return t}async function Ms(e){const t=[];for(const n of e)try{if(n.size>kl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>Cx&&console.warn(`File ${n.name} is large (${zt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Is(e){const t=[];for(const n of e)try{const r=cn(n.name);if(r===".csv"||r===".tsv"){const o=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const o=await n.arrayBuffer(),s=await El(o);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function El(e){const t=await _e(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const o of n.SheetNames){const s=n.Sheets[o];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?r.push(`## Sheet: ${o}
|
|
236
236
|
|
|
237
237
|
${a}`):r.push(a)}return r.join(`
|
|
238
238
|
|
|
239
|
-
`)}async function
|
|
239
|
+
`)}async function _x(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>kl));t.length>_r&&console.warn(`Directory has ${t.length} files, truncating to ${_r}`);const n=t.slice(0,_r);let r=0;for(const d of n)r+=d.size;r>Ns&&console.warn(`Directory total size ${zt(r)} exceeds limit, some files may be truncated`);const o=n[0].webkitRelativePath,s=o&&o.split("/")[0]||"目录",a=[],i=[];let m=0;const f=[...n].sort((d,h)=>{const g=d.webkitRelativePath||d.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const d of f){const h=d.webkitRelativePath||d.name;if(a.push(h),Al(d)||qr(d))if(m+d.size<=Ns)try{let g;if(cn(d.name)===".xlsx"||cn(d.name)===".xls"){const v=await d.arrayBuffer();g=await El(v)}else g=await d.text();i.push(`
|
|
240
240
|
### ${h}
|
|
241
241
|
\`\`\`
|
|
242
242
|
${g}
|
|
@@ -250,16 +250,16 @@ ${g}
|
|
|
250
250
|
### ${h}
|
|
251
251
|
(二进制文件,${zt(d.size)})`)}const l=a.join(`
|
|
252
252
|
`),c=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",l,"```","","## 文件内容",...i].join(`
|
|
253
|
-
`);return{kind:"directory",name:s,size:r,textContent:c,files:a}}async function Ax(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const o=r.result,s=o.indexOf(",");t(s>=0?o.slice(s+1):o)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Ex({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(r=>u.jsx(_x,{request:r,onRespond:t},r.requestId))})})}function _x({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(ma,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[u.jsx(un,{className:"h-3.5 w-3.5"}),"允许"]}),u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[u.jsx(dn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Is(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Ms(e){return e<1e3?String(e):e<1e6?`${Is((e/1e3).toFixed(1))}k`:`${Is((e/1e6).toFixed(2))}M`}function Ps(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Tx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Ps(e.cost)),t.push(`${Ms(e.used)} / ${Ms(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Ps(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var lr="Popover",[kl]=nt(lr,[Xt]),bn=Xt(),[jx,gt]=kl(lr),Al=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!1}=e,i=bn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:lr});return u.jsx(po,{...i,children:u.jsx(jx,{scope:t,contentId:Re(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Al.displayName=lr;var El="PopoverAnchor",Rx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(El,n),s=bn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=o;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(Zn,{...s,...r,ref:t})});Rx.displayName=El;var _l="PopoverTrigger",Tl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(_l,n),s=bn(n),a=ke(t,o.triggerRef),i=u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ml(o.open),...r,ref:a,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:u.jsx(Zn,{asChild:!0,...s,children:i})});Tl.displayName=_l;var Oo="PopoverPortal",[Nx,Ix]=kl(Oo,{forceMount:void 0}),jl=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=gt(Oo,t);return u.jsx(Nx,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};jl.displayName=Oo;var Vt="PopoverContent",Rl=p.forwardRef((e,t)=>{const n=Ix(Vt,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=gt(Vt,e.__scopePopover);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(Px,{...o,ref:t}):u.jsx(Ox,{...o,ref:t})})});Rl.displayName=Vt;var Mx=Bt("PopoverContent.RemoveScroll"),Px=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(null),o=ke(t,r),s=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return xo(a)},[]),u.jsx(Zr,{as:Mx,allowPinchZoom:!0,children:u.jsx(Nl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Ox=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(Nl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Nl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,d=gt(Vt,n),h=bn(n);return oo(),u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>d.onOpenChange(!1),children:u.jsx(ho,{"data-state":Ml(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Il="PopoverClose",Dx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(Il,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Dx.displayName=Il;var Lx="PopoverArrow",Fx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=bn(n);return u.jsx(go,{...o,...r,ref:t})});Fx.displayName=Lx;function Ml(e){return e?"open":"closed"}var $x=Al,Ux=Tl,zx=jl,Hx=Rl;function Pl({...e}){return u.jsx($x,{"data-slot":"popover",...e})}function Ol({...e}){return u.jsx(Ux,{"data-slot":"popover-trigger",...e})}function Dl({className:e,align:t="center",sideOffset:n=4,...r}){return u.jsx(zx,{children:u.jsx(Hx,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Os=1,Bx=.9,Wx=.8,Gx=.17,jr=.1,Rr=.999,Vx=.9999,Kx=.99,qx=/[\\\/_+.#"@\[\(\{&]/,Yx=/[\\\/_+.#"@\[\(\{&]/g,Xx=/[\s-]/,Ll=/[\s-]/g;function Yr(e,t,n,r,o,s,a){if(s===t.length)return o===e.length?Os:Kx;var i=`${o},${s}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(s),f=n.indexOf(m,o),l=0,c,d,h,g;f>=0;)c=Yr(e,t,n,r,f+1,s+1,a),c>l&&(f===o?c*=Os:qx.test(e.charAt(f-1))?(c*=Wx,h=e.slice(o,f-1).match(Yx),h&&o>0&&(c*=Math.pow(Rr,h.length))):Xx.test(e.charAt(f-1))?(c*=Bx,g=e.slice(o,f-1).match(Ll),g&&o>0&&(c*=Math.pow(Rr,g.length))):(c*=Gx,o>0&&(c*=Math.pow(Rr,f-o))),e.charAt(f)!==t.charAt(s)&&(c*=Vx)),(c<jr&&n.charAt(f-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(f-1)!==r.charAt(s))&&(d=Yr(e,t,n,r,f+1,s+2,a),d*jr>c&&(c=d*jr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function Ds(e){return e.toLowerCase().replace(Ll," ")}function Qx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Yr(e,t,Ds(e),Ds(t),0,0,{})}var cr="Dialog",[Fl]=nt(cr),[Jx,ze]=Fl(cr),$l=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:cr});return u.jsx(Jx,{scope:t,triggerRef:i,contentRef:m,contentId:Re(),titleId:Re(),descriptionId:Re(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};$l.displayName=cr;var Ul="DialogTrigger",Zx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Ul,n),s=ke(t,o.triggerRef);return u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fo(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)})});Zx.displayName=Ul;var Do="DialogPortal",[ev,zl]=Fl(Do,{forceMount:void 0}),Hl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ze(Do,t);return u.jsx(ev,{scope:t,forceMount:n,children:p.Children.map(r,a=>u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:a})}))})};Hl.displayName=Do;var Kn="DialogOverlay",Bl=p.forwardRef((e,t)=>{const n=zl(Kn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:r||s.open,children:u.jsx(nv,{...o,ref:t})}):null});Bl.displayName=Kn;var tv=Bt("DialogOverlay.RemoveScroll"),nv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Kn,n);return u.jsx(Zr,{as:tv,allowPinchZoom:!0,shards:[o.contentRef],children:u.jsx(ge.div,{"data-state":Fo(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),_t="DialogContent",Wl=p.forwardRef((e,t)=>{const n=zl(_t,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(_t,e.__scopeDialog);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(rv,{...o,ref:t}):u.jsx(ov,{...o,ref:t})})});Wl.displayName=_t;var rv=p.forwardRef((e,t)=>{const n=ze(_t,e.__scopeDialog),r=p.useRef(null),o=ke(t,n.contentRef,r);return p.useEffect(()=>{const s=r.current;if(s)return xo(s)},[]),u.jsx(Gl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault())})}),ov=p.forwardRef((e,t)=>{const n=ze(_t,e.__scopeDialog),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(Gl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Gl=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=ze(_t,n),m=p.useRef(null),f=ke(t,m);return oo(),u.jsxs(u.Fragment,{children:[u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Fo(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(av,{titleId:i.titleId}),u.jsx(lv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Lo="DialogTitle",Vl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Lo,n);return u.jsx(ge.h2,{id:o.titleId,...r,ref:t})});Vl.displayName=Lo;var Kl="DialogDescription",sv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Kl,n);return u.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});sv.displayName=Kl;var ql="DialogClose",Yl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(ql,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Yl.displayName=ql;function Fo(e){return e?"open":"closed"}var Xl="DialogTitleWarning",[ay,Ql]=Md(Xl,{contentName:_t,titleName:Lo,docsSlug:"dialog"}),av=({titleId:e})=>{const t=Ql(Xl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
253
|
+
`);return{kind:"directory",name:s,size:r,textContent:c,files:a}}async function Tx(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const o=r.result,s=o.indexOf(",");t(s>=0?o.slice(s+1):o)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function jx({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(r=>u.jsx(Rx,{request:r,onRespond:t},r.requestId))})})}function Rx({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(ga,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[u.jsx(un,{className:"h-3.5 w-3.5"}),"允许"]}),u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[u.jsx(dn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Ps(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Os(e){return e<1e3?String(e):e<1e6?`${Ps((e/1e3).toFixed(1))}k`:`${Ps((e/1e6).toFixed(2))}M`}function Ds(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Nx({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Ds(e.cost)),t.push(`${Os(e.used)} / ${Os(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Ds(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var lr="Popover",[_l]=nt(lr,[Xt]),bn=Xt(),[Mx,gt]=_l(lr),Tl=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!1}=e,i=bn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:lr});return u.jsx(ho,{...i,children:u.jsx(Mx,{scope:t,contentId:Re(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};Tl.displayName=lr;var jl="PopoverAnchor",Ix=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(jl,n),s=bn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=o;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(Zn,{...s,...r,ref:t})});Ix.displayName=jl;var Rl="PopoverTrigger",Nl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(Rl,n),s=bn(n),a=ke(t,o.triggerRef),i=u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Dl(o.open),...r,ref:a,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:u.jsx(Zn,{asChild:!0,...s,children:i})});Nl.displayName=Rl;var Do="PopoverPortal",[Px,Ox]=_l(Do,{forceMount:void 0}),Ml=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=gt(Do,t);return u.jsx(Px,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};Ml.displayName=Do;var Vt="PopoverContent",Il=p.forwardRef((e,t)=>{const n=Ox(Vt,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=gt(Vt,e.__scopePopover);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(Lx,{...o,ref:t}):u.jsx(Fx,{...o,ref:t})})});Il.displayName=Vt;var Dx=Bt("PopoverContent.RemoveScroll"),Lx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(null),o=ke(t,r),s=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return vo(a)},[]),u.jsx(eo,{as:Dx,allowPinchZoom:!0,children:u.jsx(Pl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Fx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(Pl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Pl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,d=gt(Vt,n),h=bn(n);return so(),u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>d.onOpenChange(!1),children:u.jsx(go,{"data-state":Dl(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Ol="PopoverClose",$x=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(Ol,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});$x.displayName=Ol;var Ux="PopoverArrow",zx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=bn(n);return u.jsx(xo,{...o,...r,ref:t})});zx.displayName=Ux;function Dl(e){return e?"open":"closed"}var Hx=Tl,Bx=Nl,Wx=Ml,Gx=Il;function Ll({...e}){return u.jsx(Hx,{"data-slot":"popover",...e})}function Fl({...e}){return u.jsx(Bx,{"data-slot":"popover-trigger",...e})}function $l({className:e,align:t="center",sideOffset:n=4,...r}){return u.jsx(Wx,{children:u.jsx(Gx,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Ls=1,Vx=.9,Kx=.8,qx=.17,jr=.1,Rr=.999,Yx=.9999,Xx=.99,Qx=/[\\\/_+.#"@\[\(\{&]/,Jx=/[\\\/_+.#"@\[\(\{&]/g,Zx=/[\s-]/,Ul=/[\s-]/g;function Yr(e,t,n,r,o,s,a){if(s===t.length)return o===e.length?Ls:Xx;var i=`${o},${s}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(s),f=n.indexOf(m,o),l=0,c,d,h,g;f>=0;)c=Yr(e,t,n,r,f+1,s+1,a),c>l&&(f===o?c*=Ls:Qx.test(e.charAt(f-1))?(c*=Kx,h=e.slice(o,f-1).match(Jx),h&&o>0&&(c*=Math.pow(Rr,h.length))):Zx.test(e.charAt(f-1))?(c*=Vx,g=e.slice(o,f-1).match(Ul),g&&o>0&&(c*=Math.pow(Rr,g.length))):(c*=qx,o>0&&(c*=Math.pow(Rr,f-o))),e.charAt(f)!==t.charAt(s)&&(c*=Yx)),(c<jr&&n.charAt(f-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(f-1)!==r.charAt(s))&&(d=Yr(e,t,n,r,f+1,s+2,a),d*jr>c&&(c=d*jr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function Fs(e){return e.toLowerCase().replace(Ul," ")}function ev(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Yr(e,t,Fs(e),Fs(t),0,0,{})}var cr="Dialog",[zl]=nt(cr),[tv,ze]=zl(cr),Hl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:cr});return u.jsx(tv,{scope:t,triggerRef:i,contentRef:m,contentId:Re(),titleId:Re(),descriptionId:Re(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};Hl.displayName=cr;var Bl="DialogTrigger",nv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Bl,n),s=ke(t,o.triggerRef);return u.jsx(ge.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":$o(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)})});nv.displayName=Bl;var Lo="DialogPortal",[rv,Wl]=zl(Lo,{forceMount:void 0}),Gl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ze(Lo,t);return u.jsx(rv,{scope:t,forceMount:n,children:p.Children.map(r,a=>u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:a})}))})};Gl.displayName=Lo;var Kn="DialogOverlay",Vl=p.forwardRef((e,t)=>{const n=Wl(Kn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:r||s.open,children:u.jsx(sv,{...o,ref:t})}):null});Vl.displayName=Kn;var ov=Bt("DialogOverlay.RemoveScroll"),sv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Kn,n);return u.jsx(eo,{as:ov,allowPinchZoom:!0,shards:[o.contentRef],children:u.jsx(ge.div,{"data-state":$o(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),_t="DialogContent",Kl=p.forwardRef((e,t)=>{const n=Wl(_t,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(_t,e.__scopeDialog);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(av,{...o,ref:t}):u.jsx(iv,{...o,ref:t})})});Kl.displayName=_t;var av=p.forwardRef((e,t)=>{const n=ze(_t,e.__scopeDialog),r=p.useRef(null),o=ke(t,n.contentRef,r);return p.useEffect(()=>{const s=r.current;if(s)return vo(s)},[]),u.jsx(ql,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault())})}),iv=p.forwardRef((e,t)=>{const n=ze(_t,e.__scopeDialog),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(ql,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),ql=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=ze(_t,n),m=p.useRef(null),f=ke(t,m);return so(),u.jsxs(u.Fragment,{children:[u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":$o(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(cv,{titleId:i.titleId}),u.jsx(dv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Fo="DialogTitle",Yl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Fo,n);return u.jsx(ge.h2,{id:o.titleId,...r,ref:t})});Yl.displayName=Fo;var Xl="DialogDescription",lv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Xl,n);return u.jsx(ge.p,{id:o.descriptionId,...r,ref:t})});lv.displayName=Xl;var Ql="DialogClose",Jl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Ql,n);return u.jsx(ge.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Jl.displayName=Ql;function $o(e){return e?"open":"closed"}var Zl="DialogTitleWarning",[ly,ec]=Dd(Zl,{contentName:_t,titleName:Fo,docsSlug:"dialog"}),cv=({titleId:e})=>{const t=ec(Zl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
254
254
|
|
|
255
255
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
256
256
|
|
|
257
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},iv="DialogDescriptionWarning",lv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ql(iv).contentName}}.`;return p.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},cv=$l,uv=Hl,dv=Bl,fv=Wl,iy=Vl,ly=Yl,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',mv='[cmdk-group-heading=""]',Jl='[cmdk-item=""]',Ls=`${Jl}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",pv=(e,t,n)=>Qx(e,t,n),Zl=p.createContext(void 0),yn=()=>p.useContext(Zl),ec=p.createContext(void 0),$o=()=>p.useContext(ec),tc=p.createContext(void 0),nc=p.forwardRef((e,t)=>{let n=Ft(()=>{var N,L;return{search:"",value:(L=(N=e.value)!=null?N:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ft(()=>new Set),o=Ft(()=>new Map),s=Ft(()=>new Map),a=Ft(()=>new Set),i=rc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:w=!0,...b}=e,E=Re(),_=Re(),A=Re(),D=p.useRef(null),k=Av();Tt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,T.emit()}},[l]),Tt(()=>{k(6,F)},[]);let T=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,L,$)=>{var R,B,G,K;if(!Object.is(n.current[N],L)){if(n.current[N]=L,N==="search")O(),j(),k(1,M);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(A);V?V.focus():(R=document.getElementById(E))==null||R.focus()}if(k(7,()=>{var V;n.current.selectedItemId=(V=I())==null?void 0:V.id,T.emit()}),$||k(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let V=L??"";(K=(G=i.current).onValueChange)==null||K.call(G,V);return}}T.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),x=p.useMemo(()=>({value:(N,L,$)=>{var R;L!==((R=s.current.get(N))==null?void 0:R.value)&&(s.current.set(N,{value:L,keywords:$}),n.current.filtered.items.set(N,y(L,$)),k(2,()=>{j(),T.emit()}))},item:(N,L)=>(r.current.add(N),L&&(o.current.has(L)?o.current.get(L).add(N):o.current.set(L,new Set([N]))),k(3,()=>{O(),j(),n.current.value||M(),T.emit()}),()=>{s.current.delete(N),r.current.delete(N),n.current.filtered.items.delete(N);let $=I();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===N&&M(),T.emit()})}),group:N=>(o.current.has(N)||o.current.set(N,new Set),()=>{s.current.delete(N),o.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:E,inputId:A,labelId:_,listInnerRef:D}),[]);function y(N,L){var $,R;let B=(R=($=i.current)==null?void 0:$.filter)!=null?R:pv;return N?B(N,n.current.search,L):0}function j(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(R=>{let B=o.current.get(R),G=0;B.forEach(K=>{let V=N.get(K);G=Math.max(V,G)}),L.push([R,G])});let $=D.current;z().sort((R,B)=>{var G,K;let V=R.getAttribute("id"),ne=B.getAttribute("id");return((G=N.get(ne))!=null?G:0)-((K=N.get(V))!=null?K:0)}).forEach(R=>{let B=R.closest(Nr);B?B.appendChild(R.parentElement===B?R:R.closest(`${Nr} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Nr} > *`))}),L.sort((R,B)=>B[1]-R[1]).forEach(R=>{var B;let G=(B=D.current)==null?void 0:B.querySelector(`${nn}[${Lt}="${encodeURIComponent(R[0])}"]`);G==null||G.parentElement.appendChild(G)})}function M(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=N==null?void 0:N.getAttribute(Lt);T.setState("value",L||void 0)}function O(){var N,L,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let G of r.current){let K=(L=(N=s.current.get(G))==null?void 0:N.value)!=null?L:"",V=(R=($=s.current.get(G))==null?void 0:$.keywords)!=null?R:[],ne=y(K,V);n.current.filtered.items.set(G,ne),ne>0&&B++}for(let[G,K]of o.current)for(let V of K)if(n.current.filtered.items.get(V)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=B}function F(){var N,L,$;let R=I();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(L=R.closest(nn))==null?void 0:L.querySelector(mv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function I(){var N;return(N=D.current)==null?void 0:N.querySelector(`${Jl}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=D.current)==null?void 0:N.querySelectorAll(Ls))||[])}function S(N){let L=z()[N];L&&T.setState("value",L.getAttribute(Lt))}function C(N){var L;let $=I(),R=z(),B=R.findIndex(K=>K===$),G=R[B+N];(L=i.current)!=null&&L.loop&&(G=B+N<0?R[R.length-1]:B+N===R.length?R[0]:R[B+N]),G&&T.setState("value",G.getAttribute(Lt))}function H(N){let L=I(),$=L==null?void 0:L.closest(nn),R;for(;$&&!R;)$=N>0?Sv($,nn):kv($,nn),R=$==null?void 0:$.querySelector(Ls);R?T.setState("value",R.getAttribute(Lt)):C(N)}let P=()=>S(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?H(1):C(1)},q=N=>{N.preventDefault(),N.metaKey?S(0):N.altKey?H(-1):C(-1)};return p.createElement(ht.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:N=>{var L;(L=b.onKeyDown)==null||L.call(b,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{w&&N.ctrlKey&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{w&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),S(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=I();if(R){let B=new Event(Xr);R.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:_v},m),ur(e,N=>p.createElement(ec.Provider,{value:T},p.createElement(Zl.Provider,{value:x},N))))}),hv=p.forwardRef((e,t)=>{var n,r;let o=Re(),s=p.useRef(null),a=p.useContext(tc),i=yn(),m=rc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Tt(()=>{if(!f)return i.item(o,a==null?void 0:a.id)},[f]);let l=oc(o,s,[e.value,e.children,s],e.keywords),c=$o(),d=mt(k=>k.value&&k.value===l.current),h=mt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Xr,g),()=>k.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var k,T;v(),(T=(k=m.current).onSelect)==null||T.call(k,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:w,value:b,onSelect:E,forceMount:_,keywords:A,...D}=e;return p.createElement(ht.div,{ref:qe(s,t),...D,id:o,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!d,"data-disabled":!!w,"data-selected":!!d,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:g},e.children)}),gv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,a=Re(),i=p.useRef(null),m=p.useRef(null),f=Re(),l=yn(),c=mt(h=>o||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Tt(()=>l.group(a),[]),oc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:o}),[o]);return p.createElement(ht.div,{ref:qe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),ur(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(tc.Provider,{value:d},h))))}),xv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=p.useRef(null),s=mt(a=>!a.search);return!n&&!s?null:p.createElement(ht.div,{ref:qe(o,t),...r,"cmdk-separator":"",role:"separator"})}),vv=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=$o(),a=mt(f=>f.search),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(ht.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:o?e.value:a,onChange:f=>{o||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),bv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=p.useRef(null),a=p.useRef(null),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,l=s.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(f),()=>{cancelAnimationFrame(c),d.unobserve(f)}}},[]),p.createElement(ht.div,{ref:qe(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},ur(e,f=>p.createElement("div",{ref:qe(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),yv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:a,...i}=e;return p.createElement(cv,{open:n,onOpenChange:r},p.createElement(uv,{container:a},p.createElement(dv,{"cmdk-overlay":"",className:o}),p.createElement(fv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(nc,{ref:t,...i}))))}),wv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Cv=p.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return p.createElement(ht.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},ur(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Qt=Object.assign(nc,{List:bv,Item:hv,Input:vv,Group:gv,Separator:xv,Dialog:yv,Empty:wv,Loading:Cv});function Sv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function kv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rc(e){let t=p.useRef(e);return Tt(()=>{t.current=e}),t}var Tt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ft(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function mt(e){let t=$o(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function oc(e,t,n,r=[]){let o=p.useRef(),s=yn();return Tt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():o.current}})(),m=r.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Lt,i),o.current=i}),o}var Av=()=>{let[e,t]=p.useState(),n=Ft(()=>new Map);return Tt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function Ev(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ur({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Ev(t),{ref:t.ref},n(t.props.children)):n(t)}var _v={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Tv({className:e,...t}){return u.jsx(Qt,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function jv({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(td,{className:"size-4 shrink-0 opacity-50"}),u.jsx(Qt.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Rv({className:e,...t}){return u.jsx(Qt.List,{"data-slot":"command-list",className:ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Nv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Iv({className:e,...t}){return u.jsx(Qt.Group,{"data-slot":"command-group",className:ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Mv({className:e,...t}){return u.jsx(Qt.Item,{"data-slot":"command-item",className:ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Fs(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0;for(let s=0;s<r.length&&o<n.length;s++)r[s]===n[o]&&o++;return o===n.length}function Pv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:o=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(o?"__none__":void 0),f=p.useMemo(()=>s?e.filter(l=>Fs(s,l.name)||Fs(s,l.modelId)):e,[e,s]);return u.jsxs(Tv,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&u.jsx(jv,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(Rv,{children:[u.jsx(Nv,{children:"No models found."}),u.jsx(Iv,{children:f.map(l=>u.jsxs(Mv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(un,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function sc(e){const[t,n]=p.useState(e.modelState),[r,o]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const d=localStorage.getItem("acp_model_id");d&&d!==c.currentModelId&&c.availableModels.some(h=>h.modelId===d)&&e.setSessionModel(d).catch(()=>{})}},l=c=>{n(d=>d?{...d,currentModelId:c}:null),o(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");o(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw o(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Ov({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:o,availableModels:s,currentModel:a,setModel:i,isLoading:m}=sc(e),f=o&&s.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async d=>{try{await i(d.modelId),t==null||t(d.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Pl,{open:n,onOpenChange:f?r:void 0,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(ua,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-72 p-0",align:"end",children:u.jsx(Pv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function Dv(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const o=s=>{n(s)};return e.setAvailableCommandsChangedHandler(o),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function ac(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Lv(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return ac(e)}function Fv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!ac(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const o=await r.getType("text/plain");await t.writeText(await o.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const $v=new Set(["clear","new","help","status","model","copy"]),ic=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"}],Uv=ic.map(e=>({name:e.name,description:e.desc})),cy=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...Uv];function zv(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function Hv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Bv(e){var r;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const o of n)t.push(`- \`/${o.name}\` — ${o.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const o of ic)t.push(`- \`/${o.name}\` — ${o.desc}`);if(e.length>0)for(const o of e){const s=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${s}\` — ${o.description}`)}return t.join(`
|
|
258
|
-
`)}function
|
|
259
|
-
`)}function
|
|
260
|
-
`)}async function
|
|
261
|
-
`))??"";(h?await Lv(h):!0)?a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息":(a="复制失败:剪贴板不可用",i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:zv(s),subtitle:Hv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Kv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function qv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),o=n.match(/^data:([^;,]+)/),s=o?o[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:s})}const Ir=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function Yv({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),o=Ir.find(s=>s.value===e)??Ir[0];return u.jsxs(Pl,{open:n,onOpenChange:r,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(ld,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:o.label}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-64 p-1",align:"start",children:Ir.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[u.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&u.jsx(un,{className:"h-3.5 w-3.5 text-brand"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),u.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function $s(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Mr(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function Xv({client:e,agentId:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[d,h]=p.useState(null),g=p.useRef(null),[v,w]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,E]=p.useState(e.usage),[_,A]=p.useState(e.currentModeId),[D,k]=p.useState(!1),{commands:T}=Dv(e),{availableModels:x,currentModel:y,setModel:j}=sc(e);p.useEffect(()=>{l.current=m},[m]);const M=p.useCallback(()=>{r([]),s(!1),i(!1),E(null),A(null)},[]),O=t?`acp_last_session_${t}`:null,F=p.useCallback((N,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(r([]),s(!1)),f(N),i(!0),k(e.supportsImages),O)try{localStorage.setItem(O,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,O]),I=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),r(L=>{const $=Mr(L,N.toolCall.toolCallId);if($>=0)return L.map((R,B)=>B!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...L,R]}}))},[]),z=p.useCallback((N,L)=>{if(!(l.current&&N!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const K=B.chunks[B.chunks.length-1];return(K==null?void 0:K.type)==="message"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,G]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const K=B.chunks[B.chunks.length-1];return(K==null?void 0:K.type)==="thought"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,G]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="user_message")return[...R.slice(0,-1),{...B,content:B.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,G]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:$s(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};r(R=>{const B=Mr(R,L.toolCallId);if(B>=0)return R.map((K,V)=>V!==B||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...R,G]})}else L.sessionUpdate==="tool_call_update"?r($=>{const R=Mr($,L.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,G)=>{if(G!==R||B.type!=="tool_call")return B;const K=L.status?$s(L.status):B.toolCall.status,V=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:K,...L.title&&{title:L.title},content:V,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?r($=>{if(L.entries.length===0)return $.filter(G=>G.type!=="plan");const R=$.reduce((G,K,V)=>K.type==="plan"?V:G,-1);if(R>=0)return $.map((G,K)=>K===R?{...G,entries:L.entries}:G);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?E(L):L.sessionUpdate==="current_mode_update"&&A(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),M()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=O?localStorage.getItem(O):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,I,z,M]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),o&&e.cancel(),M(),f(null),e.createSession(void 0,v)},[e,o,M,v]),C=()=>{console.log("[ChatInterface] Cancel requested"),r(N=>N.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((N,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:L,optionKind:$}),e.respondToPermission(N,L);const R=$==="reject_once"||$==="reject_always"||L===null;r(B=>B.map(G=>{var V;if(G.type!=="tool_call"||((V=G.toolCall.permissionRequest)==null?void 0:V.requestId)!==N)return G;let K;return R?K="rejected":G.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...G.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,L)=>{const $=P.find(G=>G.requestId===N);let R=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const G=$.options.find(K=>K.kind==="allow_once")??$.options.find(K=>K.kind==="allow_always");G&&(R=G.optionId,B=G.kind)}else{const G=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");G&&(R=G.optionId,B=G.kind)}R||(B=L?"allow_once":"reject_once"),H(N,R,B)},[H,P]),q=p.useCallback(async N=>{var ne;const L=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!L&&$.length===0&&R.length===0||!a)return;if(L.startsWith("/")&&$.length===0){kt("[ChatInterface] slash command input",{text:L});const J=await Vv(L,{sessionId:m,availableCommands:T,availableModels:x,currentModel:y,supportsImages:D,entries:c.current,setModel:j,onNewSession:S}).catch(()=>null);if(J){if(kt("[ChatInterface] local command handled",J),"clearEntries"in J&&J.clearEntries){r([]);return}if("newSession"in J&&J.newSession){S();return}if("userEntry"in J){r(re=>[...re,J.userEntry,J.cmdEntry]);return}}kt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}kt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:o});const B=[];L&&B.push({type:"text",text:L});const G=[];for(const J of $)try{const re=`data:${J.mimeType};base64,${J.data}`;let ue;re.startsWith("data:")?ue=qv(re):ue=await(await fetch(re)).blob();let be=ue,de=J.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});be=await Te(ie,Kv),de="image/jpeg"}const ye=await new Promise((ie,xe)=>{const we=new FileReader;we.onloadend=()=>{const me=we.result,Ee=me.indexOf(",");ie(Ee>=0?me.slice(Ee+1):me)},we.onerror=()=>{var me;return xe(new Error("FileReader error: "+((me=we.error)==null?void 0:me.message)))},we.readAsDataURL(be)}),fe={type:"image",mimeType:de,data:ye};B.push(fe),G.push({mimeType:de,data:ye})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const J of R)try{if(J.textContent){let re;if(J.kind==="directory"){const ue=((ne=J.files)==null?void 0:ne.length)??0;re=`📁 目录: ${J.name} (${ue} 个文件)
|
|
262
|
-
${J.textContent}`}else{const ue=J.size!=null?` (${
|
|
257
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uv="DialogDescriptionWarning",dv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ec(uv).contentName}}.`;return p.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},fv=Hl,mv=Gl,pv=Vl,hv=Kl,cy=Yl,uy=Jl,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',gv='[cmdk-group-heading=""]',tc='[cmdk-item=""]',$s=`${tc}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",xv=(e,t,n)=>ev(e,t,n),nc=p.createContext(void 0),yn=()=>p.useContext(nc),rc=p.createContext(void 0),Uo=()=>p.useContext(rc),oc=p.createContext(void 0),sc=p.forwardRef((e,t)=>{let n=Ft(()=>{var N,L;return{search:"",value:(L=(N=e.value)!=null?N:e.defaultValue)!=null?L:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Ft(()=>new Set),o=Ft(()=>new Map),s=Ft(()=>new Map),a=Ft(()=>new Set),i=ac(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:w=!0,...b}=e,E=Re(),_=Re(),A=Re(),D=p.useRef(null),k=Tv();Tt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,T.emit()}},[l]),Tt(()=>{k(6,F)},[]);let T=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,L,$)=>{var R,B,G,K;if(!Object.is(n.current[N],L)){if(n.current[N]=L,N==="search")O(),j(),k(1,I);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(A);V?V.focus():(R=document.getElementById(E))==null||R.focus()}if(k(7,()=>{var V;n.current.selectedItemId=(V=M())==null?void 0:V.id,T.emit()}),$||k(5,F),((B=i.current)==null?void 0:B.value)!==void 0){let V=L??"";(K=(G=i.current).onValueChange)==null||K.call(G,V);return}}T.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),x=p.useMemo(()=>({value:(N,L,$)=>{var R;L!==((R=s.current.get(N))==null?void 0:R.value)&&(s.current.set(N,{value:L,keywords:$}),n.current.filtered.items.set(N,y(L,$)),k(2,()=>{j(),T.emit()}))},item:(N,L)=>(r.current.add(N),L&&(o.current.has(L)?o.current.get(L).add(N):o.current.set(L,new Set([N]))),k(3,()=>{O(),j(),n.current.value||I(),T.emit()}),()=>{s.current.delete(N),r.current.delete(N),n.current.filtered.items.delete(N);let $=M();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===N&&I(),T.emit()})}),group:N=>(o.current.has(N)||o.current.set(N,new Set),()=>{s.current.delete(N),o.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:E,inputId:A,labelId:_,listInnerRef:D}),[]);function y(N,L){var $,R;let B=(R=($=i.current)==null?void 0:$.filter)!=null?R:xv;return N?B(N,n.current.search,L):0}function j(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,L=[];n.current.filtered.groups.forEach(R=>{let B=o.current.get(R),G=0;B.forEach(K=>{let V=N.get(K);G=Math.max(V,G)}),L.push([R,G])});let $=D.current;z().sort((R,B)=>{var G,K;let V=R.getAttribute("id"),ne=B.getAttribute("id");return((G=N.get(ne))!=null?G:0)-((K=N.get(V))!=null?K:0)}).forEach(R=>{let B=R.closest(Nr);B?B.appendChild(R.parentElement===B?R:R.closest(`${Nr} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Nr} > *`))}),L.sort((R,B)=>B[1]-R[1]).forEach(R=>{var B;let G=(B=D.current)==null?void 0:B.querySelector(`${nn}[${Lt}="${encodeURIComponent(R[0])}"]`);G==null||G.parentElement.appendChild(G)})}function I(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),L=N==null?void 0:N.getAttribute(Lt);T.setState("value",L||void 0)}function O(){var N,L,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let B=0;for(let G of r.current){let K=(L=(N=s.current.get(G))==null?void 0:N.value)!=null?L:"",V=(R=($=s.current.get(G))==null?void 0:$.keywords)!=null?R:[],ne=y(K,V);n.current.filtered.items.set(G,ne),ne>0&&B++}for(let[G,K]of o.current)for(let V of K)if(n.current.filtered.items.get(V)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=B}function F(){var N,L,$;let R=M();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(L=R.closest(nn))==null?void 0:L.querySelector(gv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function M(){var N;return(N=D.current)==null?void 0:N.querySelector(`${tc}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=D.current)==null?void 0:N.querySelectorAll($s))||[])}function S(N){let L=z()[N];L&&T.setState("value",L.getAttribute(Lt))}function C(N){var L;let $=M(),R=z(),B=R.findIndex(K=>K===$),G=R[B+N];(L=i.current)!=null&&L.loop&&(G=B+N<0?R[R.length-1]:B+N===R.length?R[0]:R[B+N]),G&&T.setState("value",G.getAttribute(Lt))}function H(N){let L=M(),$=L==null?void 0:L.closest(nn),R;for(;$&&!R;)$=N>0?Ev($,nn):_v($,nn),R=$==null?void 0:$.querySelector($s);R?T.setState("value",R.getAttribute(Lt)):C(N)}let P=()=>S(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?H(1):C(1)},q=N=>{N.preventDefault(),N.metaKey?S(0):N.altKey?H(-1):C(-1)};return p.createElement(ht.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:N=>{var L;(L=b.onKeyDown)==null||L.call(b,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{w&&N.ctrlKey&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{w&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),S(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=M();if(R){let B=new Event(Xr);R.dispatchEvent(B)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:Rv},m),ur(e,N=>p.createElement(rc.Provider,{value:T},p.createElement(nc.Provider,{value:x},N))))}),vv=p.forwardRef((e,t)=>{var n,r;let o=Re(),s=p.useRef(null),a=p.useContext(oc),i=yn(),m=ac(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Tt(()=>{if(!f)return i.item(o,a==null?void 0:a.id)},[f]);let l=ic(o,s,[e.value,e.children,s],e.keywords),c=Uo(),d=mt(k=>k.value&&k.value===l.current),h=mt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Xr,g),()=>k.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var k,T;v(),(T=(k=m.current).onSelect)==null||T.call(k,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:w,value:b,onSelect:E,forceMount:_,keywords:A,...D}=e;return p.createElement(ht.div,{ref:qe(s,t),...D,id:o,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!d,"data-disabled":!!w,"data-selected":!!d,onPointerMove:w||i.getDisablePointerSelection()?void 0:v,onClick:w?void 0:g},e.children)}),bv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,a=Re(),i=p.useRef(null),m=p.useRef(null),f=Re(),l=yn(),c=mt(h=>o||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);Tt(()=>l.group(a),[]),ic(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:o}),[o]);return p.createElement(ht.div,{ref:qe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),ur(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(oc.Provider,{value:d},h))))}),yv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=p.useRef(null),s=mt(a=>!a.search);return!n&&!s?null:p.createElement(ht.div,{ref:qe(o,t),...r,"cmdk-separator":"",role:"separator"})}),wv=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=Uo(),a=mt(f=>f.search),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(ht.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:o?e.value:a,onChange:f=>{o||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),Cv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=p.useRef(null),a=p.useRef(null),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,l=s.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(f),()=>{cancelAnimationFrame(c),d.unobserve(f)}}},[]),p.createElement(ht.div,{ref:qe(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},ur(e,f=>p.createElement("div",{ref:qe(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),Sv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:a,...i}=e;return p.createElement(fv,{open:n,onOpenChange:r},p.createElement(mv,{container:a},p.createElement(pv,{"cmdk-overlay":"",className:o}),p.createElement(hv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(sc,{ref:t,...i}))))}),kv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Av=p.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return p.createElement(ht.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},ur(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Qt=Object.assign(sc,{List:Cv,Item:vv,Input:wv,Group:bv,Separator:yv,Dialog:Sv,Empty:kv,Loading:Av});function Ev(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function _v(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ac(e){let t=p.useRef(e);return Tt(()=>{t.current=e}),t}var Tt=typeof window>"u"?p.useEffect:p.useLayoutEffect;function Ft(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function mt(e){let t=Uo(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function ic(e,t,n,r=[]){let o=p.useRef(),s=yn();return Tt(()=>{var a;let i=(()=>{var f;for(let l of n){if(typeof l=="string")return l.trim();if(typeof l=="object"&&"current"in l)return l.current?(f=l.current.textContent)==null?void 0:f.trim():o.current}})(),m=r.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Lt,i),o.current=i}),o}var Tv=()=>{let[e,t]=p.useState(),n=Ft(()=>new Map);return Tt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function jv(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ur({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(jv(t),{ref:t.ref},n(t.props.children)):n(t)}var Rv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Nv({className:e,...t}){return u.jsx(Qt,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Mv({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(od,{className:"size-4 shrink-0 opacity-50"}),u.jsx(Qt.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Iv({className:e,...t}){return u.jsx(Qt.List,{"data-slot":"command-list",className:ee("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Pv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Ov({className:e,...t}){return u.jsx(Qt.Group,{"data-slot":"command-group",className:ee("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function Dv({className:e,...t}){return u.jsx(Qt.Item,{"data-slot":"command-item",className:ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Us(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0;for(let s=0;s<r.length&&o<n.length;s++)r[s]===n[o]&&o++;return o===n.length}function Lv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:o=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(o?"__none__":void 0),f=p.useMemo(()=>s?e.filter(l=>Us(s,l.name)||Us(s,l.modelId)):e,[e,s]);return u.jsxs(Nv,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&u.jsx(Mv,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(Iv,{children:[u.jsx(Pv,{children:"No models found."}),u.jsx(Ov,{children:f.map(l=>u.jsxs(Dv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(un,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function lc(e){const[t,n]=p.useState(e.modelState),[r,o]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const d=localStorage.getItem("acp_model_id");d&&d!==c.currentModelId&&c.availableModels.some(h=>h.modelId===d)&&e.setSessionModel(d).catch(()=>{})}},l=c=>{n(d=>d?{...d,currentModelId:c}:null),o(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");o(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw o(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Fv({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:o,availableModels:s,currentModel:a,setModel:i,isLoading:m}=lc(e),f=o&&s.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async d=>{try{await i(d.modelId),t==null||t(d.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Ll,{open:n,onOpenChange:f?r:void 0,children:[u.jsx(Fl,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(ma,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(fa,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx($l,{className:"w-72 p-0",align:"end",children:u.jsx(Lv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function $v(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const o=s=>{n(s)};return e.setAvailableCommandsChangedHandler(o),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function cc(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Uv(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return cc(e)}function zv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!cc(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const o=await r.getType("text/plain");await t.writeText(await o.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const zo=new Set(["clear","new","help","status","model","copy"]),Qr=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"},{name:"files",desc:"列出会话追踪的文件"}],uc=Qr.map(e=>({name:e.name,description:e.desc})),Hv=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...uc],zs=new Set(["compact","cost","summary","files"]);function dy(e,t=[]){if(e.length===0&&t.length===0)return Hv;const n=zo,r=new Set,o=[],s=a=>{n.has(a.name)||r.has(a.name)||a.type!=="local-jsx"&&(a.type==="local"&&!zs.has(a.name)||a.type===void 0&&!zs.has(a.name)||(r.add(a.name),o.push({name:a.name,description:a.description||"agent 命令",...a.argumentHint?{input:{hint:a.argumentHint}}:{}})))};for(const a of e)s(a);for(const a of t)s(a);for(const a of uc)r.has(a.name)||(r.add(a.name),o.push(a));return[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...o]}function Bv(e){switch(e){case"help":return"Help";case"status":return"Status";case"model":return"Model";case"copy":return"Copy";default:return e.charAt(0).toUpperCase()+e.slice(1)}}function Wv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Gv(e){var r;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const o of n)t.push(`- \`/${o.name}\` — ${o.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const o of Qr)t.push(`- \`/${o.name}\` — ${o.desc}`);if(e.length>0){const o=new Set([...zo,...Qr.map(s=>s.name)]);for(const s of e){if(o.has(s.name))continue;const a=(r=s.input)!=null&&r.hint?` ${s.input.hint}`:"";t.push(`- \`/${s.name}${a}\` — ${s.description}`)}}return t.join(`
|
|
258
|
+
`)}function Vv(e){var n,r,o;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??"未设置"}`),(o=e.currentModel)!=null&&o.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
|
|
259
|
+
`)}function Kv(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const r of e){const o=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${o}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
|
|
260
|
+
`)}async function qv(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),o=r.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!zo.has(s))return{handled:!1};if(s==="clear")return{handled:!0,clearEntries:!0};if(s==="new")return{handled:!0,newSession:!0};let a="",i=!1;if(s==="help")a=Gv(t.availableCommands);else if(s==="status")a=Vv({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(o)try{await t.setModel(o),a=`已请求切换到模型: \`${o}\``}catch(d){a=`切换模型失败: ${d instanceof Error?d.message:String(d)}`,i=!0}else a=Kv(t.availableModels,t.currentModel);else if(s==="copy"){const d=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=d==null?void 0:d.chunks)==null?void 0:c.map(v=>v.text).join(`
|
|
261
|
+
`))??"";(h?await Uv(h):!0)?a=h?`已复制 ${h.length} 字符到剪贴板`:"没有可复制的助手消息":(a="复制失败:剪贴板不可用",i=!0)}const m=Date.now(),f={type:"user_message",id:`user-${m}`,content:e},l={type:"command_output",id:`cmd-${m}`,commandName:s,inputText:e,title:Bv(s),subtitle:Wv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Yv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Xv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),o=n.match(/^data:([^;,]+)/),s=o?o[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:s})}const Mr=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function Qv({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),o=Mr.find(s=>s.value===e)??Mr[0];return u.jsxs(Ll,{open:n,onOpenChange:r,children:[u.jsx(Fl,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(dd,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:o.label}),n?u.jsx(fa,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx($l,{className:"w-64 p-1",align:"start",children:Mr.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[u.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&u.jsx(un,{className:"h-3.5 w-3.5 text-brand"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),u.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function Hs(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Ir(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function Jv({client:e,agentId:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[d,h]=p.useState(null),g=p.useRef(null),[v,w]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,E]=p.useState(e.usage),[_,A]=p.useState(e.currentModeId),[D,k]=p.useState(!1),{commands:T}=$v(e),{availableModels:x,currentModel:y,setModel:j}=lc(e);p.useEffect(()=>{l.current=m},[m]);const I=p.useCallback(()=>{r([]),s(!1),i(!1),E(null),A(null)},[]),O=t?`acp_last_session_${t}`:null,F=p.useCallback((N,L)=>{if(((L==null?void 0:L.resetEntries)??!0)&&(r([]),s(!1)),f(N),i(!0),k(e.supportsImages),O)try{localStorage.setItem(O,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,O]),M=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),r(L=>{const $=Ir(L,N.toolCall.toolCallId);if($>=0)return L.map((R,B)=>B!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...L,R]}}))},[]),z=p.useCallback((N,L)=>{if(!(l.current&&N!==l.current))if(L.sessionUpdate==="agent_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const K=B.chunks[B.chunks.length-1];return(K==null?void 0:K.type)==="message"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,G]})}else if(L.sessionUpdate==="agent_thought_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="assistant_message"){const K=B.chunks[B.chunks.length-1];return(K==null?void 0:K.type)==="thought"?[...R.slice(0,-1),{...B,chunks:[...B.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...R.slice(0,-1),{...B,chunks:[...B.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,G]})}else if(L.sessionUpdate==="user_message_chunk"){const $=L.content.type==="text"&&L.content.text?L.content.text:"";if(!$)return;r(R=>{const B=R[R.length-1];if((B==null?void 0:B.type)==="user_message")return[...R.slice(0,-1),{...B,content:B.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,G]})}else if(L.sessionUpdate==="tool_call"){const $={id:L.toolCallId,title:L.title,status:Hs(L.status),content:L.content,rawInput:L.rawInput,rawOutput:L.rawOutput};r(R=>{const B=Ir(R,L.toolCallId);if(B>=0)return R.map((K,V)=>V!==B||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...R,G]})}else L.sessionUpdate==="tool_call_update"?r($=>{const R=Ir($,L.toolCallId);if(R<0){console.warn(`[ChatInterface] Tool call not found for update: ${L.toolCallId}`);const B={type:"tool_call",toolCall:{id:L.toolCallId,title:L.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,B]}return $.map((B,G)=>{if(G!==R||B.type!=="tool_call")return B;const K=L.status?Hs(L.status):B.toolCall.status,V=L.content?[...B.toolCall.content||[],...L.content]:B.toolCall.content;return{type:"tool_call",toolCall:{...B.toolCall,status:K,...L.title&&{title:L.title},content:V,...L.rawInput&&{rawInput:L.rawInput},...L.rawOutput&&{rawOutput:L.rawOutput}}}})}):L.sessionUpdate==="plan"?r($=>{if(L.entries.length===0)return $.filter(G=>G.type!=="plan");const R=$.reduce((G,K,V)=>K.type==="plan"?V:G,-1);if(R>=0)return $.map((G,K)=>K===R?{...G,entries:L.entries}:G);const B={type:"plan",id:`plan-${Date.now()}`,entries:L.entries};return[...$,B]}):L.sessionUpdate==="usage_update"?E(L):L.sessionUpdate==="current_mode_update"&&A(L.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(L=>{console.log("[ChatInterface] Session created:",L),F(L)}),e.setSessionLoadedHandler(L=>{console.log("[ChatInterface] Session loaded/resumed:",L),F(L,{resetEntries:!1})}),e.setSessionSwitchingHandler(L=>{console.log("[ChatInterface] Switching to session:",L),f(L),I()}),e.setSessionUpdateHandler((L,$)=>{z(L,$)}),e.setPromptCompleteHandler(L=>{console.log("[ChatInterface] Prompt complete:",L),s(!1)}),e.setPermissionRequestHandler(M),e.setErrorMessageHandler(L=>{console.error("[ChatInterface] Agent error:",L),h(L),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=O?localStorage.getItem(O):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,M,z,I]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),o&&e.cancel(),I(),f(null),e.createSession(void 0,v)},[e,o,I,v]),C=()=>{console.log("[ChatInterface] Cancel requested"),r(N=>N.map(L=>L.type!=="tool_call"||!(L.toolCall.status==="running"||L.toolCall.status==="waiting_for_confirmation")?L:(console.log("[ChatInterface] Marking tool call as canceled:",L.toolCall.id),{type:"tool_call",toolCall:{...L.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},H=p.useCallback((N,L,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:L,optionKind:$}),e.respondToPermission(N,L);const R=$==="reject_once"||$==="reject_always"||L===null;r(B=>B.map(G=>{var V;if(G.type!=="tool_call"||((V=G.toolCall.permissionRequest)==null?void 0:V.requestId)!==N)return G;let K;return R?K="rejected":G.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...G.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,L)=>{const $=P.find(G=>G.requestId===N);let R=null,B=null;if($!=null&&$.options&&$.options.length>0)if(L){const G=$.options.find(K=>K.kind==="allow_once")??$.options.find(K=>K.kind==="allow_always");G&&(R=G.optionId,B=G.kind)}else{const G=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");G&&(R=G.optionId,B=G.kind)}R||(B=L?"allow_once":"reject_once"),H(N,R,B)},[H,P]),q=p.useCallback(async N=>{var ne;const L=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!L&&$.length===0&&R.length===0||!a)return;if(L.startsWith("/")&&$.length===0){kt("[ChatInterface] slash command input",{text:L});const J=await qv(L,{sessionId:m,availableCommands:T,availableModels:x,currentModel:y,supportsImages:D,entries:c.current,setModel:j,onNewSession:S}).catch(()=>null);if(J){if(kt("[ChatInterface] local command handled",J),"clearEntries"in J&&J.clearEntries){r([]);return}if("newSession"in J&&J.newSession){S();return}if("userEntry"in J){r(re=>[...re,J.userEntry,J.cmdEntry]);return}}kt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:L})}kt("[ChatInterface] forwarding to agent",{text:L,hasImages:$.length>0,sessionReady:a,isLoading:o});const B=[];L&&B.push({type:"text",text:L});const G=[];for(const J of $)try{const re=`data:${J.mimeType};base64,${J.data}`;let ue;re.startsWith("data:")?ue=Xv(re):ue=await(await fetch(re)).blob();let be=ue,de=J.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});be=await Te(ie,Yv),de="image/jpeg"}const ye=await new Promise((ie,xe)=>{const we=new FileReader;we.onloadend=()=>{const me=we.result,Ee=me.indexOf(",");ie(Ee>=0?me.slice(Ee+1):me)},we.onerror=()=>{var me;return xe(new Error("FileReader error: "+((me=we.error)==null?void 0:me.message)))},we.readAsDataURL(be)}),fe={type:"image",mimeType:de,data:ye};B.push(fe),G.push({mimeType:de,data:ye})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const J of R)try{if(J.textContent){let re;if(J.kind==="directory"){const ue=((ne=J.files)==null?void 0:ne.length)??0;re=`📁 目录: ${J.name} (${ue} 个文件)
|
|
262
|
+
${J.textContent}`}else{const ue=J.size!=null?` (${Zv(J.size)})`:"";re=`📎 ${J.name}${ue}
|
|
263
263
|
\`\`\`
|
|
264
264
|
${J.textContent}
|
|
265
|
-
\`\`\``}B.push({type:"text",text:re}),K.push(J)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(B.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:L,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};r(J=>[...J,V]),s(!0);try{await e.sendPrompt(B)}catch(J){console.error("[ChatInterface] Failed to send prompt:",J),s(!1)}},[o,a,e,T,x,y,D,m,j,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(fx,{entries:n,isLoading:o&&!a?!1:o,onPermissionRespond:(N,L,$)=>{H(N,L,$)},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(Yv,{mode:_??v,onModeChange:N=>{A(null),w(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Ov,{client:e}),u.jsx(Tx,{usage:b})]}),n.length>0&&u.jsxs(ag,{children:[u.jsx(ig,{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(lg,{children:"New Thread"})]})]}),u.jsx(Cx,{onSubmit:q,isLoading:o,onInterrupt:C,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:D,commands:T.length>0?T:void 0,queueWhileLoading:!0})]})]})}function Qv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Jv({client:e,agentId:t}){const[n,r]=p.useState(!1),o=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:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?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:o})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Xv,{client:e,agentId:t})})]})}function Zv({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[o,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 T=await e.listSessions();r(T.sessions)}catch(T){console.warn("[SidebarSessionList] Failed to load:",T)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const T=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(T),()=>e.removeConnectionStateHandler(T)},[e,v]),p.useEffect(()=>{const T=setInterval(v,1e4);return()=>clearInterval(T)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(T=>{v()}),e.setSessionRenamedHandler((T,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(T=>{/Method not found/i.test(T)&&/session\/(rename|delete)/i.test(T)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const w=p.useCallback(T=>{const x=T.title&&T.title.trim()?T.title:T.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(T.sessionId),r(y=>y.filter(j=>j.sessionId!==T.sessionId)),a===T.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(T=>{f(T.sessionId),c(T.title&&T.title.trim()?T.title:"")},[]),E=p.useCallback(()=>{if(!m)return;const T=l.trim();if(!T){f(null);return}try{e.renameSession(m,T),r(x=>x.map(y=>y.sessionId===m?{...y,title:T}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),_=p.useCallback(()=>{f(null)},[]),A=p.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),E()):T.key==="Escape"&&(T.preventDefault(),_())},[E,_]),D=p.useMemo(()=>[...n].sort((T,x)=>{const y=T.updatedAt?new Date(T.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(o&&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=eb(D);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((T,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:T.label})}),T.sessions.map(y=>{const j=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"}),j?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:A,onBlur:E,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick: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:"新会话"})}),j?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:E,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:_,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(Ju,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&w(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)})]},T.label))})}function eb(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),o=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?o[0].sessions.push(s):a>=r?o[1].sessions.push(s):o[2].sessions.push(s)}return o.filter(s=>s.sessions.length>0)}function tb({url:e,token:t,onBack:n}){const[r,o]=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,o(l),l.connect().catch(c=>{c instanceof Hi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,o(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"&&!r&&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"})]})}),r&&s==="connected"&&u.jsx(Jv,{client:r})]})}const Qr="rcs_admin_key";function nb(){try{return localStorage.getItem(Qr)}catch{return null}}function rb(){const[e,t]=p.useState(nb),n=p.useCallback(r=>{const o=r.trim();t(o||null);try{o?localStorage.setItem(Qr,o):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>_e(()=>import("./Dashboard-I2zDQu_C.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),ob=p.lazy(()=>_e(()=>import("./SessionDetail-C1D2E27B.js"),__vite__mapDeps([8,2,4,6,9,10,5,11,1,7])).then(e=>({default:e.SessionDetail}))),sb=p.lazy(()=>_e(()=>import("./ShareLanding-CD0g9hBP.js"),__vite__mapDeps([12,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>_e(()=>import("./ArtifactsGallery-BaqQmrpp.js").then(e=>e.a),__vite__mapDeps([9,2,6,10])).then(e=>({default:e.ArtifactsGallery}))),ab=p.lazy(()=>_e(()=>import("./ArtifactView-1QwTt1_U.js"),__vite__mapDeps([13,2,9,6,10,1,7])).then(e=>({default:e.ArtifactView}))),ib=p.lazy(()=>_e(()=>import("./Claim-DbnYUnUa.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.Claim}))),lb=p.lazy(()=>_e(()=>import("./Login-DfpBv0-E.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Login}))),cb=p.lazy(()=>_e(()=>import("./Register-G3MsHXWX.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Register}))),ub=p.lazy(()=>_e(()=>import("./Setup-Ba0gdFpo.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Setup}))),db=p.lazy(()=>_e(()=>import("./Join-BW_5GOxc.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Join}))),fb=p.lazy(()=>_e(()=>import("./UserSettings-Bnq6nvYc.js"),__vite__mapDeps([19,2,10,1,7])).then(e=>({default:e.UserSettings}))),mb=p.lazy(()=>_e(()=>import("./TeamList-Cfbc_pbK.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.TeamList}))),pb=p.lazy(()=>_e(()=>import("./TeamCreate-B95jdnoW.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamCreate}))),hb=p.lazy(()=>_e(()=>import("./TeamDetail-B1ez_Vlm.js"),__vite__mapDeps([22,2,11,10,4,1,7])).then(e=>({default:e.TeamDetail}))),gb=p.lazy(()=>_e(()=>import("./TeamSettings-CM3C5h_w.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamSettings}))),xb=p.lazy(()=>_e(()=>import("./AdminPanel-Dw_WcoUm.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.AdminPanel}))),vb=new Set(["login","register","setup","join","share"]),bb=new Set(["login","register","setup","join"]);function yb(){return u.jsx(Cd,{defaultTheme:"system",children:u.jsx(Ch,{children:u.jsx(wb,{})})})}function wb(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[o,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=rb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{fh(d)},[d]);const[w,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const E=p.useCallback(()=>{const j=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}`),r(F),f(null),t("session");return}if(j==="/login"){t("login");return}if(j==="/register"){t("register");return}if(j==="/setup"){t("setup");return}if(j==="/join"){t("join");return}if(j==="/settings"){t("settings");return}if(j==="/admin"){t("admin");return}if(j==="/teams/new"){t("team-create");return}if(j.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(j.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(j==="/teams"){t("teams");return}const S=j.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),r(null),s(void 0),t("share");return}const C=j.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){i(C[1]),r(null),s(void 0),f(null),t("artifact-view");return}if(j==="/code/artifacts"||j==="/code/artifacts/"){i(null),r(null),s(void 0),f(null),t("artifacts");return}const H=j.match(/^\/code\/claim\/([^/]+)/);if(H&&H[1]){t("claim");return}const P=j.match(/^\/code\/([^/]+)/);P&&P[1]?(r(P[1]),s(void 0),f(null),t("session")):(r(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(E(),window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)),[E]);const _=p.useCallback(j=>{window.history.pushState(null,"",`/code/${j}`),r(j),s(void 0),f(null),i(null),t("session")},[]),A=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),r(null),s(void 0),f(null),t("artifacts")},[]),D=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let j=e;return g||(w&&j!=="setup"&&j!=="join"&&(j="setup"),!h&&!vb.has(j)&&(j="login"),h&&(j==="login"||j==="setup")&&(j="dashboard")),j})();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 T=()=>{if(l&&k==="acp")return u.jsx(tb,{url:l.url,token:l.token,onBack:D});switch(k){case"login":return u.jsx(lb,{onSuccess:D,onNavigateRegister:()=>t("register")});case"register":return u.jsx(cb,{onSuccess:D,onBack:()=>t("login")});case"setup":return u.jsx(ub,{onSuccess:D,onAlreadyDone:D});case"join":return u.jsx(db,{onSuccess:D,onInvalidInvite:D});case"settings":return u.jsx(fb,{});case"teams":return u.jsx(mb,{});case"team-create":return u.jsx(pb,{});case"team-detail":return u.jsx(hb,{});case"team-settings":return u.jsx(gb,{});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(xb,{});case"share":return u.jsx(sb,{});case"claim":return u.jsx(ib,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(ab,{artifactId:a,onBack:A}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(ob,{sessionId:n,onSessionLoaded:j=>s(j.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:_})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:_})})}},x=!bb.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(kh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":o,onBack:n||l||m?D:void 0,onNavigateArtifacts:y?void 0:A}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:T()})]})}Fv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(yb,{})}));export{$b as $,Gr as A,he as B,Cx as C,Hi as D,ey as E,Ru as F,Gb as G,ry as H,Kb as I,Xb as J,oy as K,ua as L,Pv as M,Wb as N,dv as O,Ju as P,Db as Q,cy as R,sd as S,iy as T,bd as U,ny as V,ty as W,dn as X,Ub as Y,Lb as Z,Fb as _,Jv as a,Ob as a0,Bb as a1,Yb as a2,Vb as a3,qb as a4,Qb as a5,Hb as a6,zb as a7,Jb as a8,Zb as a9,Ks as aa,ee as ab,Lv as ac,ae as ad,kt as ae,au as af,Eb as ag,jb as ah,Pb as ai,ph as aj,Nb as ak,_b as al,Rb as am,Mb as an,Fe as ao,Tb as ap,Vv as aq,su as ar,zi as as,Fi as at,vh as au,wr as b,fx as c,un as d,Kt as e,ca as f,Tu as g,ly as h,fv as i,Pi as j,Di as k,jn as l,sh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,uv as t,cv as u,ld as v,fd as w,sy as x,sg as y,gd as z};
|
|
265
|
+
\`\`\``}B.push({type:"text",text:re}),K.push(J)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(B.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:L,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};r(J=>[...J,V]),s(!0);try{await e.sendPrompt(B)}catch(J){console.error("[ChatInterface] Failed to send prompt:",J),s(!1)}},[o,a,e,T,x,y,D,m,j,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(hx,{entries:n,isLoading:o&&!a?!1:o,onPermissionRespond:(N,L,$)=>{H(N,L,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(jx,{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:_??v,onModeChange:N=>{A(null),w(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Fv,{client:e}),u.jsx(Nx,{usage:b})]}),n.length>0&&u.jsxs(cg,{children:[u.jsx(ug,{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(ha,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(dg,{children:"New Thread"})]})]}),u.jsx(Ax,{onSubmit:q,isLoading:o,onInterrupt:C,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:D,commands:T.length>0?T:void 0,queueWhileLoading:!0})]})]})}function Zv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function eb({client:e,agentId:t}){const[n,r]=p.useState(!1),o=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(ha,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?u.jsx(Qu,{className:"h-4 w-4"}):u.jsx(Yu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(tb,{client:e,onSelectSession:o})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Jv,{client:e,agentId:t})})]})}function tb({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[o,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 T=await e.listSessions();r(T.sessions)}catch(T){console.warn("[SidebarSessionList] Failed to load:",T)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const T=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(T),()=>e.removeConnectionStateHandler(T)},[e,v]),p.useEffect(()=>{const T=setInterval(v,1e4);return()=>clearInterval(T)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(T=>{v()}),e.setSessionRenamedHandler((T,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(T=>{/Method not found/i.test(T)&&/session\/(rename|delete)/i.test(T)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const w=p.useCallback(T=>{const x=T.title&&T.title.trim()?T.title:T.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(T.sessionId),r(y=>y.filter(j=>j.sessionId!==T.sessionId)),a===T.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(T=>{f(T.sessionId),c(T.title&&T.title.trim()?T.title:"")},[]),E=p.useCallback(()=>{if(!m)return;const T=l.trim();if(!T){f(null);return}try{e.renameSession(m,T),r(x=>x.map(y=>y.sessionId===m?{...y,title:T}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),_=p.useCallback(()=>{f(null)},[]),A=p.useCallback(T=>{T.key==="Enter"?(T.preventDefault(),E()):T.key==="Escape"&&(T.preventDefault(),_())},[E,_]),D=p.useMemo(()=>[...n].sort((T,x)=>{const y=T.updatedAt?new Date(T.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(o&&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=nb(D);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((T,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:T.label})}),T.sessions.map(y=>{const j=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(Wu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),j?u.jsx("input",{ref:g,type:"text",value:l,onChange:I=>c(I.target.value),onKeyDown:A,onBlur:E,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:I=>I.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:"新会话"})}),j?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:E,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:_,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:I=>{I.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(td,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:I=>{I.stopPropagation(),d&&w(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(bd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},T.label))})}function nb(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),o=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?o[0].sessions.push(s):a>=r?o[1].sessions.push(s):o[2].sessions.push(s)}return o.filter(s=>s.sessions.length>0)}function rb({url:e,token:t,onBack:n}){const[r,o]=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,o(l),l.connect().catch(c=>{c instanceof Gi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,o(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"&&!r&&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"})]})}),r&&s==="connected"&&u.jsx(eb,{client:r})]})}const Jr="rcs_admin_key";function ob(){try{return localStorage.getItem(Jr)}catch{return null}}function sb(){const[e,t]=p.useState(ob),n=p.useCallback(r=>{const o=r.trim();t(o||null);try{o?localStorage.setItem(Jr,o):localStorage.removeItem(Jr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Bs=p.lazy(()=>_e(()=>import("./Dashboard-GTUc9fNN.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),ab=p.lazy(()=>_e(()=>import("./SessionDetail-D13hMSu2.js"),__vite__mapDeps([8,2,4,6,9,10,5,11,1,7])).then(e=>({default:e.SessionDetail}))),ib=p.lazy(()=>_e(()=>import("./ShareLanding-WwHP77MK.js"),__vite__mapDeps([12,2,1,7])).then(e=>({default:e.ShareLanding}))),Ws=p.lazy(()=>_e(()=>import("./ArtifactsGallery-CjliWleX.js").then(e=>e.a),__vite__mapDeps([9,2,6,10])).then(e=>({default:e.ArtifactsGallery}))),lb=p.lazy(()=>_e(()=>import("./ArtifactView-xC7kgK6r.js"),__vite__mapDeps([13,2,9,6,10,1,7])).then(e=>({default:e.ArtifactView}))),cb=p.lazy(()=>_e(()=>import("./Claim-CXcdrgMT.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.Claim}))),ub=p.lazy(()=>_e(()=>import("./Login-B3F-J_O_.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Login}))),db=p.lazy(()=>_e(()=>import("./Register-BOMRs2-X.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Register}))),fb=p.lazy(()=>_e(()=>import("./Setup-04VLlDdo.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Setup}))),mb=p.lazy(()=>_e(()=>import("./Join-BIPrGzjB.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Join}))),pb=p.lazy(()=>_e(()=>import("./UserSettings-IVT2kcbO.js"),__vite__mapDeps([19,2,10,1,7])).then(e=>({default:e.UserSettings}))),hb=p.lazy(()=>_e(()=>import("./TeamList-DkEsaCsT.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.TeamList}))),gb=p.lazy(()=>_e(()=>import("./TeamCreate-Cgn8TbAD.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamCreate}))),xb=p.lazy(()=>_e(()=>import("./TeamDetail-DjCmVq2J.js"),__vite__mapDeps([22,2,11,10,4,1,7])).then(e=>({default:e.TeamDetail}))),vb=p.lazy(()=>_e(()=>import("./TeamSettings-B37TYBAO.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamSettings}))),bb=p.lazy(()=>_e(()=>import("./AdminPanel-B9K3CYqS.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.AdminPanel}))),yb=new Set(["login","register","setup","join","share"]),wb=new Set(["login","register","setup","join"]);function Cb(){return u.jsx(Ad,{defaultTheme:"system",children:u.jsx(Ah,{children:u.jsx(Sb,{})})})}function Sb(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[o,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=sb(),{user:h,isLoading:g,checkSetupStatus:v}=Wi();p.useEffect(()=>{hh(d)},[d]);const[w,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const E=p.useCallback(()=>{const j=window.location.pathname,I=new URLSearchParams(window.location.search);if(I.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=I.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),r(F),f(null),t("session");return}if(j==="/login"){t("login");return}if(j==="/register"){t("register");return}if(j==="/setup"){t("setup");return}if(j==="/join"){t("join");return}if(j==="/settings"){t("settings");return}if(j==="/admin"){t("admin");return}if(j==="/teams/new"){t("team-create");return}if(j.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(j.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(j==="/teams"){t("teams");return}const S=j.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),r(null),s(void 0),t("share");return}const C=j.match(/^\/code\/a\/([^/]+)/);if(C&&C[1]){i(C[1]),r(null),s(void 0),f(null),t("artifact-view");return}if(j==="/code/artifacts"||j==="/code/artifacts/"){i(null),r(null),s(void 0),f(null),t("artifacts");return}const H=j.match(/^\/code\/claim\/([^/]+)/);if(H&&H[1]){t("claim");return}const P=j.match(/^\/code\/([^/]+)/);P&&P[1]?(r(P[1]),s(void 0),f(null),t("session")):(r(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(E(),window.addEventListener("popstate",E),()=>window.removeEventListener("popstate",E)),[E]);const _=p.useCallback(j=>{window.history.pushState(null,"",`/code/${j}`),r(j),s(void 0),f(null),i(null),t("session")},[]),A=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),r(null),s(void 0),f(null),t("artifacts")},[]),D=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let j=e;return g||(w&&j!=="setup"&&j!=="join"&&(j="setup"),!h&&!yb.has(j)&&(j="login"),h&&(j==="login"||j==="setup")&&(j="dashboard")),j})();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 T=()=>{if(l&&k==="acp")return u.jsx(rb,{url:l.url,token:l.token,onBack:D});switch(k){case"login":return u.jsx(ub,{onSuccess:D,onNavigateRegister:()=>t("register")});case"register":return u.jsx(db,{onSuccess:D,onBack:()=>t("login")});case"setup":return u.jsx(fb,{onSuccess:D,onAlreadyDone:D});case"join":return u.jsx(mb,{onSuccess:D,onInvalidInvite:D});case"settings":return u.jsx(pb,{});case"teams":return u.jsx(hb,{});case"team-create":return u.jsx(gb,{});case"team-detail":return u.jsx(xb,{});case"team-settings":return u.jsx(vb,{});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(bb,{});case"share":return u.jsx(ib,{});case"claim":return u.jsx(cb,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Ws,{})});case"artifact-view":return a?u.jsx(lb,{artifactId:a,onBack:A}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Ws,{})});case"session":return n?u.jsx(ab,{sessionId:n,onSessionLoaded:j=>s(j.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Bs,{onNavigateSession:_})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Bs,{onNavigateSession:_})})}},x=!wb.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(_h,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":o,onBack:n||l||m?D:void 0,onNavigateArtifacts:y?void 0:A}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:T()})]})}zv();gc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(Cb,{})}));export{zb as $,Gr as A,yu as B,Ax as C,Gi as D,ny as E,Iu as F,Kb as G,sy as H,Yb as I,Jb as J,ay as K,ma as L,Lv as M,Vb as N,pv as O,td as P,Fb as Q,fv as R,ld as S,cy as T,Cd as U,oy as V,ry as W,dn as X,Hb as Y,$b as Z,Ub as _,eb as a,Lb as a0,Gb as a1,Qb as a2,qb as a3,Xb as a4,Zb as a5,Wb as a6,Bb as a7,ey as a8,ty as a9,Xs as aa,ee as ab,Uv as ac,ae as ad,kt as ae,cu as af,Tb as ag,Nb as ah,Db as ai,xh as aj,Ib as ak,jb as al,Mb as am,dy as an,Ob as ao,Fe as ap,Rb as aq,qv as ar,lu as as,Wi as at,zi as au,wh as av,wr as b,hx as c,un as d,Kt as e,fa as f,Nu as g,uy as h,hv as i,Li as j,$i as k,jn as l,lh as m,Cs as n,Fi as o,ha as p,Ll as q,$l as r,Fl as s,mv as t,dd as u,hd as v,iy as w,lg as x,bd as y,he as z};
|