@saluzi/saluzi-edu 0.2.65 → 0.2.67
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 +534 -349
- package/dist/guide/guide-data.json +8 -0
- package/dist/rcs-schema.sql +23 -0
- package/dist/rcs-web/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
- package/dist/rcs-web/assets/ArtifactView-CT0Fu4U5.js +6 -0
- package/dist/rcs-web/assets/ArtifactsGallery-DgK1CSno.js +339 -0
- package/{packages/remote-control-server/web/dist/assets/Claim-BvfARQ6Q.js → dist/rcs-web/assets/Claim-C7V1Q01Y.js} +1 -1
- package/dist/rcs-web/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
- package/{packages/remote-control-server/web/dist/assets/Join-PPDYBhsJ.js → dist/rcs-web/assets/Join-BhjsvbAP.js} +1 -1
- package/dist/rcs-web/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
- package/dist/rcs-web/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
- package/dist/rcs-web/assets/SessionDetail-3P77L-sJ.js +60 -0
- package/dist/rcs-web/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
- package/dist/rcs-web/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
- package/dist/rcs-web/assets/ShareLanding-DG5JbaWg.js +1 -0
- package/dist/rcs-web/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
- package/dist/rcs-web/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
- package/dist/rcs-web/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
- package/dist/rcs-web/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
- package/dist/rcs-web/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
- package/dist/rcs-web/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
- package/dist/rcs-web/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
- package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
- package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
- package/dist/rcs-web/assets/channel-N4W03sy5.js +1 -0
- package/dist/rcs-web/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
- package/dist/rcs-web/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
- package/dist/rcs-web/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CoXI1FIy.js → dist/rcs-web/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
- package/dist/rcs-web/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
- package/dist/rcs-web/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
- package/dist/rcs-web/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
- package/dist/rcs-web/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
- package/dist/rcs-web/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
- package/dist/rcs-web/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
- package/dist/rcs-web/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
- package/dist/rcs-web/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
- package/dist/rcs-web/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
- package/dist/rcs-web/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
- package/dist/rcs-web/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
- package/dist/rcs-web/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
- package/dist/rcs-web/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
- package/dist/rcs-web/assets/dialog-DympH6_o.js +1 -0
- package/dist/rcs-web/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
- package/dist/rcs-web/assets/external-link-J-x6ty1h.js +6 -0
- package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
- package/dist/rcs-web/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
- package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
- package/dist/rcs-web/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
- package/dist/rcs-web/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
- package/dist/rcs-web/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
- package/dist/rcs-web/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
- package/dist/rcs-web/assets/main-B8hkVvfg.js +265 -0
- package/dist/rcs-web/assets/main-C2O-g177.css +1 -0
- package/dist/rcs-web/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
- package/dist/rcs-web/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
- package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
- package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
- package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
- package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
- package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
- package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
- package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
- package/{packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → dist/rcs-web/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
- package/dist/rcs-web/index.html +2 -2
- package/package.json +1 -1
- package/packages/remote-control-server/src/__tests__/artifacts.test.ts +370 -0
- package/packages/remote-control-server/src/__tests__/attach-wait.test.ts +54 -0
- package/packages/remote-control-server/src/__tests__/attach.test.ts +37 -0
- package/packages/remote-control-server/src/__tests__/helpers/mock-config.ts +1 -0
- package/packages/remote-control-server/src/__tests__/low-priority-fixes.test.ts +95 -0
- package/packages/remote-control-server/src/__tests__/routes.test.ts +69 -0
- package/packages/remote-control-server/src/config.ts +6 -0
- package/packages/remote-control-server/src/db/rcs-schema.sql +23 -0
- package/packages/remote-control-server/src/index.ts +9 -0
- package/packages/remote-control-server/src/registerRoutes.ts +8 -0
- package/packages/remote-control-server/src/routes/v1/artifacts.ts +179 -0
- package/packages/remote-control-server/src/routes/v1/environments.ts +17 -9
- package/packages/remote-control-server/src/routes/v1/environments.work.ts +2 -2
- package/packages/remote-control-server/src/routes/v1/sessions.ts +39 -9
- package/packages/remote-control-server/src/routes/web/artifacts.ts +249 -0
- package/packages/remote-control-server/src/routes/web/sessions.ts +25 -22
- package/packages/remote-control-server/src/services/artifacts.ts +378 -0
- package/packages/remote-control-server/src/services/environment.ts +25 -0
- package/packages/remote-control-server/web/dist/assets/{AdminPanel-CqP_94xa.js → AdminPanel-94uchXH7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/ArtifactView-CT0Fu4U5.js +6 -0
- package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-DgK1CSno.js +339 -0
- package/{dist/rcs-web/assets/Claim-BvfARQ6Q.js → packages/remote-control-server/web/dist/assets/Claim-C7V1Q01Y.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Dashboard-BDGi4XpN.js → Dashboard-NLM7Kgm8.js} +2 -2
- package/{dist/rcs-web/assets/Join-PPDYBhsJ.js → packages/remote-control-server/web/dist/assets/Join-BhjsvbAP.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Login-JprQIEpr.js → Login-DRFE4F-F.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{Register-cuGuAE83.js → Register-FgLOFB4h.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/SessionDetail-3P77L-sJ.js +60 -0
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-raEV1sW8.js +11 -0
- package/packages/remote-control-server/web/dist/assets/{Setup-Buwa9Y3M.js → Setup-DDJHMu0z.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/ShareLanding-DG5JbaWg.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{TeamCreate-CaoinTSG.js → TeamCreate-D_AnatYF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamDetail-D5ahen24.js → TeamDetail-C1FFiAj2.js} +2 -2
- package/packages/remote-control-server/web/dist/assets/{TeamList-qCuKKSH3.js → TeamList-tfsnwvZG.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{TeamSettings-BaIwImrp.js → TeamSettings-FeTuY9_I.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSearchInput-BxcYR_HU.js → UserSearchInput-Bu3RXDYh.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{UserSettings-zfGfcuWs.js → UserSettings-BrjmELAZ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{arc-DwAbF6eM.js → arc-Di9w8tGK.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-uMOwOwiN.js → architectureDiagram-3BPJPVTR-FT-IsfVA.js} +1 -1
- package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-B5BqFTkP.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-DryBvbP3.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-D6eienz2.js → c4Diagram-AAUBKEIU-HWAmxH56.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/channel-N4W03sy5.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-DqVxv8yW.js → chunk-2J33WTMH-AdjHpC7B.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-X5o4x8om.js → chunk-4BX2VUAB-CpZ-59LR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-D7G25_Y5.js → chunk-55IACEB6-BBSmURaz.js} +1 -1
- package/{dist/rcs-web/assets/chunk-727SXJPM-CoXI1FIy.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-1k6tgn8s.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-AQP2D5EJ-C73Crhqe.js → chunk-AQP2D5EJ-im0ij4Kj.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-DVzxIsSE.js → chunk-FMBD7UC4-Cs3z8_hw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-C6_oEhLf.js → chunk-ND2GUHAM-BA9iE2wc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-COvH7k5r.js → chunk-QZHKN3VN-DbvzoKsw.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-CcBgewcu.js +1 -0
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-CcBgewcu.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-CE-2f_-K.js → code-block-IT6T5CEO-wgmiR0vF.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{copy-9pzb1Po6.js → copy-BD6qrRfd.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{cose-bilkent-S5V4N54A-B9sMDFRe.js → cose-bilkent-S5V4N54A-DT4C5Yz2.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-DB1jXylM.js → dagre-BM42HDAG-CRf1H6Hv.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-MNuqSRmg.js → diagram-2AECGRRQ-BChRpS-u.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-BZwhvaEY.js → diagram-5GNKFQAL-BicbIYus.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-3Wp2PnI2.js → diagram-KO2AKTUF-DCfQNjGq.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-CTcV1SBj.js → diagram-LMA3HP47-mMyd4aUd.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{diagram-OG6HWLK6-DzXhSQDC.js → diagram-OG6HWLK6-DUWhyWTm.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/dialog-DympH6_o.js +1 -0
- package/packages/remote-control-server/web/dist/assets/{erDiagram-TEJ5UH35-CwSihkB8.js → erDiagram-TEJ5UH35-DnBH3GMK.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/external-link-J-x6ty1h.js +6 -0
- package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-BSuXctT4.js → flowDiagram-I6XJVG4X-Ba7lo6ds.js} +1 -1
- package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-B87oxjmY.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CKkj67eu.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{gitGraphDiagram-PVQCEYII-BRrwOi3C.js → gitGraphDiagram-PVQCEYII-205YdSRe.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-B-8QXS0n.js → infoDiagram-5YYISTIA-CpPvGigJ.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{ishikawaDiagram-YF4QCWOH-Bau9MU6C.js → ishikawaDiagram-YF4QCWOH-D0ZEWQy7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{journeyDiagram-JHISSGLW-D_tAp--R.js → journeyDiagram-JHISSGLW-DVl0M9a7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{kanban-definition-UN3LZRKU---UIvjMZ.js → kanban-definition-UN3LZRKU-Dkr8uJC-.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{linear-CIDLjd5h.js → linear-CIdvseqY.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/main-B8hkVvfg.js +265 -0
- package/packages/remote-control-server/web/dist/assets/main-C2O-g177.css +1 -0
- package/packages/remote-control-server/web/dist/assets/{mermaid-VLURNSYL-Cu5A5sMk.js → mermaid-VLURNSYL-DdTSeoZS.js} +4 -4
- package/packages/remote-control-server/web/dist/assets/{mermaid.core-CEJOtCGw.js → mermaid.core-CtvzCSq2.js} +5 -5
- package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-ldyccyCP.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-CMlDCaV_.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-CmghofeF.js → pieDiagram-4H26LBE5-C6xMizTL.js} +1 -1
- package/{dist/rcs-web/assets/quadrantDiagram-W4KKPZXB-B-2N2UHr.js → packages/remote-control-server/web/dist/assets/quadrantDiagram-W4KKPZXB-D6epraE1.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-39jlO9Y8.js → requirementDiagram-4Y6WPE33-BHmML6bk.js} +1 -1
- package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-DdY7KNFB.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-CIKij54Y.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-D2k5rX6x.js → sequenceDiagram-3UESZ5HK-CY0y5zdR.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CP9N457o.js → stateDiagram-AJRCARHV-FBhNz1Lc.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-CPhZYlL0.js → stateDiagram-v2-BHNVJYJU-m7ruBTu5.js} +1 -1
- package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-DSEPBO8O.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-CJopHs1x.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-CkNMwCJ3.js → vennDiagram-CIIHVFJN-DF_uHOP7.js} +1 -1
- package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-Cxd-F60s.js → wardleyDiagram-YWT4CUSO-DQmjIZJA.js} +1 -1
- package/{dist/rcs-web/assets/xychartDiagram-2RQKCTM6-BLL105NN.js → packages/remote-control-server/web/dist/assets/xychartDiagram-2RQKCTM6-v8zL-j4G.js} +1 -1
- package/packages/remote-control-server/web/dist/index.html +2 -2
- package/dist/rcs-web/assets/SessionDetail-D-xhkyLo.js +0 -65
- package/dist/rcs-web/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
- package/dist/rcs-web/assets/ShareLanding-DhwgJb6V.js +0 -1
- package/dist/rcs-web/assets/channel-CCfqpGSl.js +0 -1
- package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
- package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
- package/dist/rcs-web/assets/main-DhbquBXW.css +0 -1
- package/dist/rcs-web/assets/main-N3GYCdLF.js +0 -260
- package/packages/remote-control-server/web/dist/assets/SessionDetail-D-xhkyLo.js +0 -65
- package/packages/remote-control-server/web/dist/assets/SessionVisibilityBadge-91WyR9K6.js +0 -11
- package/packages/remote-control-server/web/dist/assets/ShareLanding-DhwgJb6V.js +0 -1
- package/packages/remote-control-server/web/dist/assets/channel-CCfqpGSl.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-DzNdVs3v.js +0 -1
- package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-DzNdVs3v.js +0 -1
- package/packages/remote-control-server/web/dist/assets/main-DhbquBXW.css +0 -1
- package/packages/remote-control-server/web/dist/assets/main-N3GYCdLF.js +0 -260
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-Cu5A5sMk.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-BDGi4XpN.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-91WyR9K6.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-D-xhkyLo.js","assets/UserSearchInput-BxcYR_HU.js","assets/ShareLanding-DhwgJb6V.js","assets/Claim-BvfARQ6Q.js","assets/Login-JprQIEpr.js","assets/Register-cuGuAE83.js","assets/Setup-Buwa9Y3M.js","assets/Join-PPDYBhsJ.js","assets/UserSettings-zfGfcuWs.js","assets/copy-9pzb1Po6.js","assets/TeamList-qCuKKSH3.js","assets/TeamCreate-CaoinTSG.js","assets/TeamDetail-D5ahen24.js","assets/TeamSettings-BaIwImrp.js","assets/AdminPanel-CqP_94xa.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var cc=Object.defineProperty;var uc=(e,t,n)=>t in e?cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>uc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as Ws,b as dc,c as Jr,d as fc}from"./vendor-DE_-CLIE.js";import{_ as je}from"./shiki-mEP5vQQu.js";import{m as mc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function Gs(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Gs(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Vs(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Gs(e))&&(o&&(o+=" "),o+=t);return o}const pc=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},hc=(e,t)=>({classGroupId:e,validator:t}),Ks=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Bo=[],gc="arbitrary..",xc=e=>{const t=bc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return vc(a);const i=a.split(Mn),m=i[0]===""&&i.length>1?1:0;return qs(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?pc(f,m):m:f||Bo}return n[a]||Bo}}},qs=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=qs(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}},vc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?gc+o:void 0})(),bc=e=>{const{theme:t,classGroups:n}=e;return yc(n,t)},yc=(e,t)=>{const n=Ks();for(const o in e){const r=e[o];eo(r,n,o,t)}return n},eo=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];wc(a,t,n,o)}},wc=(e,t,n,o)=>{if(typeof e=="string"){Cc(e,t,n);return}if(typeof e=="function"){Sc(e,t,n,o);return}Ec(e,t,n,o)},Cc=(e,t,n)=>{const o=e===""?t:Ys(t,e);o.classGroupId=n},Sc=(e,t,n,o)=>{if(_c(e)){eo(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(hc(n,e))},Ec=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];eo(m,Ys(t,i),n,o)}},Ys=(e,t)=>{let n=e;const o=t.split(Mn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=Ks(),n.nextPart.set(a,i)),n=i}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,kc=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const r=(s,a)=>{n[s]=a,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=o[s])!==void 0)return r(s,a),a},set(s,a){s in n?n[s]=a:r(s,a)}}},Pr="!",Ho=":",Ac=[],Wo=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),jc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const l=r.length;for(let v=0;v<l;v++){const C=r[v];if(a===0&&i===0){if(C===Ho){s.push(r.slice(m,v)),m=v+1;continue}if(C==="/"){f=v;continue}}C==="["?a++:C==="]"?a--:C==="("?i++:C===")"&&i--}const c=s.length===0?r:r.slice(m);let d=c,h=!1;c.endsWith(Pr)?(d=c.slice(0,-1),h=!0):c.startsWith(Pr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Wo(s,h,d,g)};if(t){const r=t+Ho,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):Wo(Ac,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Tc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let r=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(a)):r.push(a)}return r.length>0&&(r.sort(),o.push(...r)),o}},Rc=e=>({cache:kc(e.cacheSize),parseClassName:jc(e),sortModifiers:Tc(e),postfixLookupClassGroupIds:Nc(e),...xc(e)}),Nc=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},Ic=/\s+/,Mc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Ic);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!C,k;if(b){const j=v.substring(0,C);k=o(j);const x=k&&a[k]?o(v):void 0;x&&x!==k&&(k=x,b=!1)}else k=o(v);if(!k){if(!b){f=c+(f.length>0?" "+f:f);continue}if(k=o(v),!k){f=c+(f.length>0?" "+f:f);continue}b=!1}const A=h.length===0?"":h.length===1?h[0]:s(h).join(":"),_=g?A+Pr:A,L=_+k;if(i.indexOf(L)>-1)continue;i.push(L);const w=r(k,b);for(let j=0;j<w.length;++j){const x=w[j];i.push(_+x)}f=c+(f.length>0?" "+f:f)}return f},Pc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Xs(n))&&(r&&(r+=" "),r+=o);return r},Xs=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Xs(e[o]))&&(n&&(n+=" "),n+=t);return n},Oc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Rc(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const l=Mc(m,n);return r(m,l),l};return s=a,(...m)=>s(Pc(...m))},Dc=[],_e=e=>{const t=n=>n[e]||Dc;return t.isThemeGetter=!0,t},Qs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Zs=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fc=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$c=/\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$/,Uc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zc=/^(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=>Lc.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)),Xe=e=>Fc.test(e),Js=()=>!0,Hc=e=>$c.test(e)&&!Uc.test(e),to=()=>!1,Wc=e=>zc.test(e),Gc=e=>Bc.test(e),Vc=e=>!X(e)&&!Q(e),Kc=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)),qc=e=>pt(e,na,to),X=e=>Qs.test(e),yt=e=>pt(e,ra,Hc),Go=e=>pt(e,nu,se),Yc=e=>pt(e,sa,Js),Xc=e=>pt(e,oa,to),Vo=e=>pt(e,ea,to),Qc=e=>pt(e,ta,Gc),wn=e=>pt(e,aa,Wc),Q=e=>Zs.test(e),en=e=>Tt(e,ra),Zc=e=>Tt(e,oa),Ko=e=>Tt(e,ea),Jc=e=>Tt(e,na),eu=e=>Tt(e,ta),Cn=e=>Tt(e,aa,!0),tu=e=>Tt(e,sa,!0),pt=(e,t,n)=>{const o=Qs.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Tt=(e,t,n=!1)=>{const o=Zs.exec(e);return o?o[1]?t(o[1]):n:!1},ea=e=>e==="position"||e==="percentage",ta=e=>e==="image"||e==="url",na=e=>e==="length"||e==="size"||e==="bg-size",ra=e=>e==="length",nu=e=>e==="number",oa=e=>e==="family-name",sa=e=>e==="number"||e==="weight",aa=e=>e==="shadow",ru=()=>{const e=_e("color"),t=_e("font"),n=_e("text"),o=_e("font-weight"),r=_e("tracking"),s=_e("leading"),a=_e("breakpoint"),i=_e("container"),m=_e("spacing"),f=_e("radius"),l=_e("shadow"),c=_e("inset-shadow"),d=_e("text-shadow"),h=_e("drop-shadow"),g=_e("blur"),v=_e("perspective"),C=_e("aspect"),b=_e("ease"),k=_e("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[..._(),Q,X],w=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],I=()=>[Be,"none","subgrid",Q,X],P=()=>["auto",{span:["full",Be,Q,X]},Be,Q,X],M=()=>[Be,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],R=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],E=()=>["auto",...x()],S=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],B=()=>[at,"screen","full","dvw","lvw","svw","min","max","fit",...x()],O=()=>[at,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],z=()=>[e,Q,X],q=()=>[..._(),Ko,Vo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",Jc,qc,{size:[Q,X]}],$=()=>[fr,en,yt],T=()=>["","none","full",f,Q,X],H=()=>["",se,en,yt],G=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[se,fr,Ko,Vo],ne=()=>["","none",g,Q,X],Z=()=>["none",se,Q,X],re=()=>["none",se,Q,X],ue=()=>[se,Q,X],ve=()=>[at,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xe],breakpoint:[Xe],color:[Js],container:[Xe],"drop-shadow":[Xe],ease:["in","out","in-out"],font:[Vc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xe],shadow:[Xe],spacing:["px",se],text:[Xe],"text-shadow":[Xe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",at,X,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[Kc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[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":I()}],"col-start-end":[{col:P()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:P()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"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:[...R(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],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:E()}],mx:[{mx:E()}],my:[{my:E()}],ms:[{ms:E()}],me:[{me:E()}],mbs:[{mbs:E()}],mbe:[{mbe:E()}],mt:[{mt:E()}],mr:[{mr:E()}],mb:[{mb:E()}],ml:[{ml:E()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:S()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...O()]}],"min-block-size":[{"min-block":["auto",...O()]}],"max-block-size":[{"max-block":["none",...O()]}],w:[{w:[i,"screen",...S()]}],"min-w":[{"min-w":[i,"screen","none",...S()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...S()]}],h:[{h:["screen","lh",...S()]}],"min-h":[{"min-h":["screen","lh","none",...S()]}],"max-h":[{"max-h":["screen","lh",...S()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,tu,Yc]}],"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,Xc,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Go]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"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:z()}],"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:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Be,Q,X],radial:["",Q,X],conic:[Be,Q,X]},eu,Qc]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:T()}],"rounded-s":[{"rounded-s":T()}],"rounded-e":[{"rounded-e":T()}],"rounded-t":[{"rounded-t":T()}],"rounded-r":[{"rounded-r":T()}],"rounded-b":[{"rounded-b":T()}],"rounded-l":[{"rounded-l":T()}],"rounded-ss":[{"rounded-ss":T()}],"rounded-se":[{"rounded-se":T()}],"rounded-ee":[{"rounded-ee":T()}],"rounded-es":[{"rounded-es":T()}],"rounded-tl":[{"rounded-tl":T()}],"rounded-tr":[{"rounded-tr":T()}],"rounded-br":[{"rounded-br":T()}],"rounded-bl":[{"rounded-bl":T()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,X]}],"outline-w":[{outline:["",se,en,yt]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",l,Cn,wn]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",c,Cn,wn]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[se,yt]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",d,Cn,wn]}],"text-shadow-color":[{"text-shadow":z()}],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":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"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":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"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":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"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":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"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":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"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":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"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":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"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":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"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":_()}],"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":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Cn,wn]}],"drop-shadow-color":[{"drop-shadow":z()}],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",k,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ve()}],"translate-x":[{"translate-x":ve()}],"translate-y":[{"translate-y":ve()}],"translate-z":[{"translate-z":ve()}],"translate-none":["translate-none"],zoom:[{zoom:[Be,Q,X]}],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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":z()}],"scrollbar-track-color":[{"scrollbar-track":z()}],"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",...z()]}],"stroke-w":[{stroke:[se,en,yt,Go]}],stroke:[{stroke:["none",...z()]}],"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"]}},ou=Oc(ru);function ee(...e){return ou(Vs(e))}function su(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function yb(e){return e?new Date(e*1e3).toLocaleString():""}function wb(e){return e==="archived"||e==="inactive"}function Cb(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function au(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 Sb(){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),au(t)}function Eb(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"}/**
|
|
3
|
-
* @license lucide-react v0.555.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const iu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),lu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),qo=e=>{const t=lu(e);return t.charAt(0).toUpperCase()+t.slice(1)},ia=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),cu=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
8
|
-
* @license lucide-react v0.555.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/var uu={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
|
-
* @license lucide-react v0.555.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const du=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:r="",children:s,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...uu,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:ia("lucide",r),...!s&&!cu(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(s)?s:[s]]));/**
|
|
18
|
-
* @license lucide-react v0.555.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const ae=(e,t)=>{const n=p.forwardRef(({className:o,...r},s)=>p.createElement(du,{ref:s,iconNode:t,className:ia(`lucide-${iu(qo(e))}`,`lucide-${e}`,o),...r}));return n.displayName=qo(e),n};/**
|
|
23
|
-
* @license lucide-react v0.555.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const fu=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],mu=ae("arrow-down",fu);/**
|
|
28
|
-
* @license lucide-react v0.555.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const pu=[["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"}]],hu=ae("brain",pu);/**
|
|
33
|
-
* @license lucide-react v0.555.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const gu=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],un=ae("check",gu);/**
|
|
38
|
-
* @license lucide-react v0.555.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const xu=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Kt=ae("chevron-down",xu);/**
|
|
43
|
-
* @license lucide-react v0.555.0 - ISC
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the ISC license.
|
|
46
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/const vu=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],bu=ae("chevron-left",vu);/**
|
|
48
|
-
* @license lucide-react v0.555.0 - ISC
|
|
49
|
-
*
|
|
50
|
-
* This source code is licensed under the ISC license.
|
|
51
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
52
|
-
*/const yu=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],la=ae("chevron-up",yu);/**
|
|
53
|
-
* @license lucide-react v0.555.0 - ISC
|
|
54
|
-
*
|
|
55
|
-
* This source code is licensed under the ISC license.
|
|
56
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/const wu=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cu=ae("circle-check",wu);/**
|
|
58
|
-
* @license lucide-react v0.555.0 - ISC
|
|
59
|
-
*
|
|
60
|
-
* This source code is licensed under the ISC license.
|
|
61
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const Su=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Eu=ae("circle",Su);/**
|
|
63
|
-
* @license lucide-react v0.555.0 - ISC
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the ISC license.
|
|
66
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const _u=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ku=ae("clock",_u);/**
|
|
68
|
-
* @license lucide-react v0.555.0 - ISC
|
|
69
|
-
*
|
|
70
|
-
* This source code is licensed under the ISC license.
|
|
71
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const Au=[["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"}]],Bt=ae("file-text",Au);/**
|
|
73
|
-
* @license lucide-react v0.555.0 - ISC
|
|
74
|
-
*
|
|
75
|
-
* This source code is licensed under the ISC license.
|
|
76
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const ju=[["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"}]],no=ae("folder-open",ju);/**
|
|
78
|
-
* @license lucide-react v0.555.0 - ISC
|
|
79
|
-
*
|
|
80
|
-
* This source code is licensed under the ISC license.
|
|
81
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
-
*/const Tu=[["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"}]],Ru=ae("image",Tu);/**
|
|
83
|
-
* @license lucide-react v0.555.0 - ISC
|
|
84
|
-
*
|
|
85
|
-
* This source code is licensed under the ISC license.
|
|
86
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const Nu=[["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"}]],Iu=ae("layout-grid",Nu);/**
|
|
88
|
-
* @license lucide-react v0.555.0 - ISC
|
|
89
|
-
*
|
|
90
|
-
* This source code is licensed under the ISC license.
|
|
91
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const Mu=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ca=ae("loader-circle",Mu);/**
|
|
93
|
-
* @license lucide-react v0.555.0 - ISC
|
|
94
|
-
*
|
|
95
|
-
* This source code is licensed under the ISC license.
|
|
96
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const Pu=[["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"}]],Ou=ae("log-out",Pu);/**
|
|
98
|
-
* @license lucide-react v0.555.0 - ISC
|
|
99
|
-
*
|
|
100
|
-
* This source code is licensed under the ISC license.
|
|
101
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const Du=[["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"}]],Lu=ae("message-square",Du);/**
|
|
103
|
-
* @license lucide-react v0.555.0 - ISC
|
|
104
|
-
*
|
|
105
|
-
* This source code is licensed under the ISC license.
|
|
106
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const Fu=[["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"}]],$u=ae("monitor",Fu);/**
|
|
108
|
-
* @license lucide-react v0.555.0 - ISC
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the ISC license.
|
|
111
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const Uu=[["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"}]],ua=ae("moon",Uu);/**
|
|
113
|
-
* @license lucide-react v0.555.0 - ISC
|
|
114
|
-
*
|
|
115
|
-
* This source code is licensed under the ISC license.
|
|
116
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const zu=[["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"}]],Bu=ae("panel-left-close",zu);/**
|
|
118
|
-
* @license lucide-react v0.555.0 - ISC
|
|
119
|
-
*
|
|
120
|
-
* This source code is licensed under the ISC license.
|
|
121
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const Hu=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],Wu=ae("panel-left",Hu);/**
|
|
123
|
-
* @license lucide-react v0.555.0 - ISC
|
|
124
|
-
*
|
|
125
|
-
* This source code is licensed under the ISC license.
|
|
126
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const Gu=[["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"}]],Vu=ae("paperclip",Gu);/**
|
|
128
|
-
* @license lucide-react v0.555.0 - ISC
|
|
129
|
-
*
|
|
130
|
-
* This source code is licensed under the ISC license.
|
|
131
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const Ku=[["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"}]],qu=ae("pencil",Ku);/**
|
|
133
|
-
* @license lucide-react v0.555.0 - ISC
|
|
134
|
-
*
|
|
135
|
-
* This source code is licensed under the ISC license.
|
|
136
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const Yu=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],da=ae("plus",Yu);/**
|
|
138
|
-
* @license lucide-react v0.555.0 - ISC
|
|
139
|
-
*
|
|
140
|
-
* This source code is licensed under the ISC license.
|
|
141
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/const Xu=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qu=ae("search",Xu);/**
|
|
143
|
-
* @license lucide-react v0.555.0 - ISC
|
|
144
|
-
*
|
|
145
|
-
* This source code is licensed under the ISC license.
|
|
146
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
-
*/const Zu=[["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"}]],Ju=ae("send",Zu);/**
|
|
148
|
-
* @license lucide-react v0.555.0 - ISC
|
|
149
|
-
*
|
|
150
|
-
* This source code is licensed under the ISC license.
|
|
151
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/const ed=[["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"}]],td=ae("settings",ed);/**
|
|
153
|
-
* @license lucide-react v0.555.0 - ISC
|
|
154
|
-
*
|
|
155
|
-
* This source code is licensed under the ISC license.
|
|
156
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/const nd=[["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"}]],fa=ae("shield-alert",nd);/**
|
|
158
|
-
* @license lucide-react v0.555.0 - ISC
|
|
159
|
-
*
|
|
160
|
-
* This source code is licensed under the ISC license.
|
|
161
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const rd=[["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"}]],od=ae("shield",rd);/**
|
|
163
|
-
* @license lucide-react v0.555.0 - ISC
|
|
164
|
-
*
|
|
165
|
-
* This source code is licensed under the ISC license.
|
|
166
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/const sd=[["path",{d:"M22 2 2 22",key:"y4kqgn"}]],ad=ae("slash",sd);/**
|
|
168
|
-
* @license lucide-react v0.555.0 - ISC
|
|
169
|
-
*
|
|
170
|
-
* This source code is licensed under the ISC license.
|
|
171
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const id=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],ld=ae("square",id);/**
|
|
173
|
-
* @license lucide-react v0.555.0 - ISC
|
|
174
|
-
*
|
|
175
|
-
* This source code is licensed under the ISC license.
|
|
176
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
-
*/const cd=[["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"}]],ma=ae("sun",cd);/**
|
|
178
|
-
* @license lucide-react v0.555.0 - ISC
|
|
179
|
-
*
|
|
180
|
-
* This source code is licensed under the ISC license.
|
|
181
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
-
*/const ud=[["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"}]],ro=ae("table",ud);/**
|
|
183
|
-
* @license lucide-react v0.555.0 - ISC
|
|
184
|
-
*
|
|
185
|
-
* This source code is licensed under the ISC license.
|
|
186
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
-
*/const dd=[["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"}]],fd=ae("trash-2",dd);/**
|
|
188
|
-
* @license lucide-react v0.555.0 - ISC
|
|
189
|
-
*
|
|
190
|
-
* This source code is licensed under the ISC license.
|
|
191
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
-
*/const md=[["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"}]],pa=ae("user",md);/**
|
|
193
|
-
* @license lucide-react v0.555.0 - ISC
|
|
194
|
-
*
|
|
195
|
-
* This source code is licensed under the ISC license.
|
|
196
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
-
*/const pd=[["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"}]],hd=ae("users",pd);/**
|
|
198
|
-
* @license lucide-react v0.555.0 - ISC
|
|
199
|
-
*
|
|
200
|
-
* This source code is licensed under the ISC license.
|
|
201
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
-
*/const gd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",gd),ha=p.createContext(void 0),ga="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(ga);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 xd(){const e=p.useContext(ha);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function vd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Xo()||t),[r,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(ga,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return it.createElement(ha.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ke(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Zo(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Zo(e[r],null)}}}}function Se(...e){return p.useCallback(Ke(...e),e)}var bd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function yd(e){return typeof e=="object"&&e!==null&&"then"in e}function xa(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===bd&&"_payload"in e&&yd(e._payload)}function va(e){const t=Cd(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;xa(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(Ed);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var wd=va("Slot");function Cd(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(xa(r)&&typeof Pn=="function"&&(r=Pn(r._payload)),p.isValidElement(r)){const a=kd(r),i=_d(s,r.props);return r.type!==p.Fragment&&(i.ref=o?Ke(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sd=Symbol("radix.slottable");function Ed(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sd}function _d(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function kd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Vs,Ad=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return es(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return r[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},jd=Ad("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Rt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?wd:"button";return u.jsx(s,{"data-slot":"button",className:ee(jd({variant:t,size:n,className:e})),...r})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Td(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function nt(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,C=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function l(c,d){var v;const h=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,Rd(r,...t)]}function Rd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Nd=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Id({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${o} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,o])}const f=p.useCallback(l=>{var c;if(i){const d=Md(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 Id({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Nd(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function Md(e){return typeof e=="function"}function Ht(e){const t=Pd(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(Dd);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Pd(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=Fd(r),i=Ld(s,r.props);return r.type!==p.Fragment&&(i.ref=o?Ke(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ba=Symbol("radix.slottable");function Od(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ba,t}function Dd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ba}function Ld(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Fd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=$d.reduce((e,t)=>{const n=Ht(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function ya(e,t){e&&Ws.flushSync(()=>e.dispatchEvent(t))}function wa(e){const t=e+"CollectionProvider",[n,o]=nt(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,k=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(r,{scope:C,itemMap:A,collectionRef:k,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:k}=v,A=s(i,b),_=Se(C,A.collectionRef);return u.jsx(m,{ref:_,children:k})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:k,...A}=v,_=it.useRef(null),L=Se(C,_),w=s(l,b);return it.useEffect(()=>(w.itemMap.set(_,{ref:_,...A}),()=>void w.itemMap.delete(_))),u.jsx(d,{[c]:"",ref:L,children:k})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const k=C.collectionRef.current;if(!k)return[];const A=Array.from(k.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((w,j)=>A.indexOf(w.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Ud=p.createContext(void 0);function Ca(e){const t=p.useContext(Ud);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function zd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Bd="DismissableLayer",Or="dismissableLayer.update",Hd="dismissableLayer.pointerDownOutside",Wd="dismissableLayer.focusOutside",ts,Sa=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(Sa),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=Se(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),k=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,_=k>=b,L=Kd(j=>{const x=j.target,y=[...f.branches].some(I=>I.contains(x));!_||y||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),w=qd(j=>{const x=j.target;[...f.branches].some(I=>I.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return zd(j=>{k===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?_?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,w.onFocusCapture),onBlurCapture:te(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Bd;var Gd="DismissableLayerBranch",Vd=p.forwardRef((e,t)=>{const n=p.useContext(Sa),o=p.useRef(null),r=Se(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:r})});Vd.displayName=Gd;function Kd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){Ea(Hd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&Ea(Wd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?ya(r,s):r.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Yd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(r),l=Je(s),c=p.useRef(null),d=Se(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(A){if(h.paused||!i)return;const _=A.target;i.contains(_)?c.current=_:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const _=A.relatedTarget;_!==null&&(i.contains(_)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&<(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const k=new MutationObserver(b);return i&&k.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),k.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(Xd(tf(_a(i)),{select:!0}),document.activeElement===v&<(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const k=v.currentTarget,[A,_]=Qd(k);A&&_?!v.shiftKey&&b===_?(v.preventDefault(),n&<(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&<(_,{select:!0})):b===k&&v.preventDefault()}},[n,o,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Yd;function Xd(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(lt(o,{select:t}),document.activeElement!==n)return}function Qd(e){const t=_a(e),n=ss(t,e),o=ss(t.reverse(),e);return[n,o]}function _a(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ss(e,t){for(const n of e)if(!Zd(n,{upTo:t}))return n}function Zd(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 Jd(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&&Jd(e)&&t&&e.select()}}var as=ef();function ef(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function tf(e){return e.filter(t=>t.tagName!=="A")}var nf=Zr[" useId ".trim().toString()]||(()=>{}),rf=0;function Re(e){const[t,n]=p.useState(nf());return Ze(()=>{n(o=>o??String(rf++))},[e]),e||(t?`radix-${t}`:"")}const of=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ve=e=>({x:e,y:e}),sf={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 Ge(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ge(e))}function af(e,t,n){n===void 0&&(n=!1);const o=qt(e),r=io(e),s=ao(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function lf(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"],cf=["top","bottom"],uf=["bottom","top"];function df(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?cf:uf;default:return[]}}function ff(e,t,n,o){const r=qt(e);let s=df(tt(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return sf[t]+e.slice(t.length)}function mf(e){return{top:0,right:0,bottom:0,left:0,...e}}function ka(e){return typeof e!="number"?mf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function us(e,t,n){let{reference:o,floating:r}=e;const s=Ge(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=o.x+o.width/2-r.width/2,c=o.y+o.height/2-r.height/2,d=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:c};break;case"left":h={x:o.x-r.width,y:c};break;default:h={x:o.x,y:o.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function pf(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=ka(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),k=c==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),_=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:k,offsetParent:A,strategy:m}):k);return{top:(b.top-L.top+g.top)/_.y,bottom:(L.bottom-b.bottom+g.bottom)/_.y,left:(b.left-L.left+g.left)/_.x,right:(L.right-b.right+g.right)/_.x}}const hf=50,gf=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:pf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=us(f,o,m),d=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:k}=C,{x:A,y:_,data:L,reset:w}=await k({x:l,y:c,initialPlacement:o,placement:d,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=_??c,g[b]={...g[b],...L},w&&h<hf&&(h++,typeof w=="object"&&(w.placement&&(d=w.placement),w.rects&&(f=w.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):w.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:r,middlewareData:g}},xf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=ka(l),d={x:n,y:o},h=io(r),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",k=C?"bottom":"right",A=C?"clientHeight":"clientWidth",_=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=w?w[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(w)))&&(j=i.floating[A]||s.floating[g]);const x=_/2-L/2,y=j/2-v[g]/2-1,I=dt(c[b],y),P=dt(c[k],y),M=I,F=j-v[g]-P,R=j/2-v[g]/2+x,U=Dr(M,R,F),E=!m.arrow&&qt(r)!=null&&R!==U&&s.reference[g]/2-(R<M?I:P)-v[g]/2<0,S=E?R<M?R-M:R-F:0;return{[h]:d[h]+S,data:{[h]:U,centerOffset:R-U-S,...E&&{alignmentOffset:S}},reset:E}}}),vf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(r),k=Ge(i),A=tt(i)===i,_=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:lf(i)),w=g!=="none";!d&&w&&L.push(...ff(i,v,g,_));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let I=((o=s.flip)==null?void 0:o.overflows)||[];if(l&&y.push(x[b]),c){const R=af(r,a,_);y.push(x[R[0]],x[R[1]])}if(I=[...I,{placement:r,overflows:y}],!y.every(R=>R<=0)){var P,M;const R=(((P=s.flip)==null?void 0:P.index)||0)+1,U=j[R];if(U&&(!(c==="alignment"?k!==Ge(U):!1)||I.every(B=>Ge(B.placement)===k?B.overflows[0]>0:!0)))return{data:{index:R,overflows:I},reset:{placement:U}};let E=(M=I.filter(S=>S.overflows[0]<=0).sort((S,B)=>S.overflows[1]-B.overflows[1])[0])==null?void 0:M.placement;if(!E)switch(h){case"bestFit":{var F;const S=(F=I.filter(B=>{if(w){const O=Ge(B.placement);return O===k||O==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(O=>O>0).reduce((O,z)=>O+z,0)]).sort((B,O)=>B[1]-O[1])[0])==null?void 0:F[0];S&&(E=S);break}case"initialPlacement":E=i;break}if(r!==E)return{reset:{placement:E}}}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 of.some(t=>e[t]>=0)}const bf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=et(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},Aa=new Set(["left","top"]);async function yf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=tt(n),i=qt(n),m=Ge(n)==="y",f=Aa.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 wf=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,m=await yf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+m.x,y:s+m.y,data:{...m,placement:a}}}}},Cf=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:k,y:A}=b;return{x:k,y:A}}},...f}=et(e,t),l={x:n,y:o},c=await s.detectOverflow(t,f),d=Ge(tt(r)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",k=h==="y"?"bottom":"right",A=g+c[b],_=g-c[k];g=Dr(A,g,_)}if(i){const b=d==="y"?"top":"left",k=d==="y"?"bottom":"right",A=v+c[b],_=v-c[k];v=Dr(A,v,_)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[d]:i}}}}}},Sf=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:o},c=Ge(r),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",_=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<_?h=_:h>L&&(h=L)}if(f){var b,k;const A=d==="y"?"width":"height",_=Aa.has(tt(r)),L=s.reference[c]-s.floating[A]+(_&&((b=a.offset)==null?void 0:b[c])||0)+(_?0:C.crossAxis),w=s.reference[c]+s.reference[A]+(_?0:((k=a.offset)==null?void 0:k[c])||0)-(_?C.crossAxis:0);g<L?g=L:g>w&&(g=w)}return{[d]:h,[c]:g}}}},Ef=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(r),d=qt(r),h=Ge(r)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const k=v-l.top-l.bottom,A=g-l.left-l.right,_=dt(v-l[C],k),L=dt(g-l[b],A),w=!t.middlewareData.shift;let j=_,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=k),w&&!d){const I=Me(l.left,0),P=Me(l.right,0),M=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(I!==0||P!==0?I+P:Me(l.left,l.right)):j=v-2*(M!==0||F!==0?M+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return ja(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qe(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 Fe(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function _f(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 kf=/transform|translate|scale|rotate|perspective|filter/,Af=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=Fe(e)?$e(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))||kf.test(t.willChange||"")||Af.test(t.contain||"")}function jf(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 $e(e){return Pe(e).getComputedStyle(e)}function Qn(e){return Fe(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||qe(e);return ms(t)?t.host:t}function Ta(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ta(t)}function on(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ta(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Pe(r);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(r)?r:[],i&&n?on(i):[])}else return t.concat(r,on(r,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ra(e){const t=$e(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=rt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=On(n)!==s||On(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function uo(e){return Fe(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ve(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Ra(t);let a=(s?On(n.width):n.width)/o,i=(s?On(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Tf=Ve(0);function Na(e){const t=Pe(e);return!co()||!t.visualViewport?Tf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function kt(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=uo(e);let a=Ve(1);t&&(o?Fe(o)&&(a=Ut(o)):a=Ut(e));const i=Rf(s,n,o)?Na(s):Ve(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(s){const d=Pe(s),h=o&&Fe(o)?Pe(o):o;let g=d,v=Fr(g);for(;v&&o&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),k=$e(v),A=b.left+(v.clientLeft+parseFloat(k.paddingLeft))*C.x,_=b.top+(v.clientTop+parseFloat(k.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=_,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:kt(qe(e)).left+n}function Ia(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Zn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Nf(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=qe(o),i=t?Xn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ve(1);const l=Ve(0),c=rt(o);if((c||!c&&!s)&&((Yt(o)!=="body"||mn(a))&&(m=Qn(o)),c)){const h=kt(o);f=Ut(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const d=a&&!c&&!s?Ia(a,m):Ve(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 If(e){return Array.from(e.getClientRects())}function Mf(e){const t=qe(e),n=Qn(e),o=e.ownerDocument.body,r=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return $e(o).direction==="rtl"&&(a+=Me(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const ps=25;function Pf(e,t){const n=Pe(e),o=qe(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const l=co();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Zn(o);if(f<=0){const l=o.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function Of(e,t){const n=kt(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=rt(e)?Ut(e):Ve(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let o;if(t==="viewport")o=Pf(e,n);else if(t==="document")o=Mf(qe(e));else if(Fe(t))o=Of(t,n);else{const r=Na(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ln(o)}function Ma(e,t){const n=ft(e);return n===t||!Fe(n)||Wt(n)?!1:$e(n).position==="fixed"||Ma(n,t)}function Df(e,t){const n=t.get(e);if(n)return n;let o=on(e,[],!1).filter(i=>Fe(i)&&Yt(i)!=="body"),r=null;const s=$e(e).position==="fixed";let a=s?ft(e):e;for(;Fe(a)&&!Wt(a);){const i=$e(a),m=lo(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||mn(a)&&!m&&Ma(e,a))?o=o.filter(l=>l!==a):r=i,a=ft(a)}return t.set(e,o),o}function Lf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Df(t,this._c):[].concat(n),o],i=hs(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],r);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Ff(e){const{width:t,height:n}=Ra(e);return{width:t,height:n}}function $f(e,t,n){const o=rt(t),r=qe(t),s=n==="fixed",a=kt(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ve(0);function f(){m.x=Zn(r)}if(o||!o&&!s)if((Yt(t)!=="body"||mn(r))&&(i=Qn(t)),o){const h=kt(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const l=r&&!o&&!s?Ia(r,i):Ve(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 $e(e).position==="static"}function gs(e,t){if(!rt(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qe(e)===n&&(n=n.ownerDocument.body),n}function Pa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let r=ft(e);for(;r&&!Wt(r);){if(Fe(r)&&!xr(r))return r;r=ft(r)}return n}let o=gs(e,t);for(;o&&_f(o)&&xr(o);)o=gs(o,t);return o&&Wt(o)&&xr(o)&&!lo(o)?n:o||jf(e)||n}const Uf=async function(e){const t=this.getOffsetParent||Pa,n=this.getDimensions,o=await n(e.floating);return{reference:$f(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function zf(e){return $e(e).direction==="rtl"}const Bf={convertOffsetParentRelativeRectToViewportRelativeRect:Nf,getDocumentElement:qe,getClippingRect:Lf,getOffsetParent:Pa,getElementRects:Uf,getClientRects:If,getDimensions:Ff,getScale:Ut,isElement:Fe,isRTL:zf};function Oa(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hf(e,t){let n=null,o;const r=qe(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(r.clientWidth-(l+d)),C=Sn(r.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let _=!0;function L(w){const j=w[0].intersectionRatio;if(j!==m){if(!_)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Oa(f,e.getBoundingClientRect())&&a(),_=!1}try{n=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function Wf(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,f=uo(e),l=r||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Hf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[k]=b;k&&k.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?kt(e):null;m&&C();function C(){const b=kt(e);v&&!Oa(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(k=>{r&&k.removeEventListener("scroll",n),s&&k.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Gf=wf,Vf=Cf,Kf=vf,qf=Ef,Yf=bf,xs=xf,Xf=Sf,Qf=(e,t,n)=>{const o=new Map,r={platform:Bf,...n},s={...r.platform,_c:o};return gf(e,t,{...r,platform:s})};var Zf=typeof document<"u",Jf=function(){},jn=Zf?p.useLayoutEffect:Jf;function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Fn(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Da(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=Da(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function em(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(o);Fn(d,o)||h(o);const[g,v]=p.useState(null),[C,b]=p.useState(null),k=p.useCallback(B=>{B!==w.current&&(w.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),_=s||g,L=a||C,w=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,I=vr(m),P=vr(r),M=vr(f),F=p.useCallback(()=>{if(!w.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};P.current&&(B.platform=P.current),Qf(w.current,j.current,B).then(O=>{const z={...O,isPositioned:M.current!==!1};R.current&&!Fn(x.current,z)&&(x.current=z,Ws.flushSync(()=>{c(z)}))})},[d,t,n,P,M]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const R=p.useRef(!1);jn(()=>(R.current=!0,()=>{R.current=!1}),[]),jn(()=>{if(_&&(w.current=_),L&&(j.current=L),_&&L){if(I.current)return I.current(_,L,F);F()}},[_,L,F,I,y]);const U=p.useMemo(()=>({reference:w,floating:j,setReference:k,setFloating:A}),[k,A]),E=p.useMemo(()=>({reference:_,floating:L}),[_,L]),S=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!E.floating)return B;const O=vs(E.floating,l.x),z=vs(E.floating,l.y);return i?{...B,transform:"translate("+O+"px, "+z+"px)",...Da(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:O,top:z}},[n,i,E.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:U,elements:E,floatingStyles:S}),[l,F,U,E,S])}const tm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?xs({element:o.current,padding:r}).fn(n):{}:o?xs({element:o,padding:r}).fn(n):{}}}},nm=(e,t)=>{const n=Gf(e);return{name:n.name,fn:n.fn,options:[e,t]}},rm=(e,t)=>{const n=Vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},om=(e,t)=>({fn:Xf(e).fn,options:[e,t]}),sm=(e,t)=>{const n=Kf(e);return{name:n.name,fn:n.fn,options:[e,t]}},am=(e,t)=>{const n=qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},lm=(e,t)=>{const n=tm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var cm="Arrow",La=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});La.displayName=cm;var um=La;function dm(e){const[t,n]=p.useState(void 0);return Ze(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const m=s.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var fo="Popper",[Fa,Xt]=nt(fo),[fm,$a]=Fa(fo),Ua=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return u.jsx(fm,{scope:t,anchor:o,onAnchorChange:r,children:n})};Ua.displayName=fo;var za="PopperAnchor",Ba=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=$a(za,n),a=p.useRef(null),i=Se(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:u.jsx(he.div,{...r,ref:i})});Ba.displayName=za;var mo="PopperContent",[mm,pm]=Fa(mo),Ha=p.forwardRef((e,t)=>{var G,K,V,ne,Z,re;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=$a(mo,n),[b,k]=p.useState(null),A=Se(t,ue=>k(ue)),[_,L]=p.useState(null),w=dm(_),j=(w==null?void 0:w.width)??0,x=(w==null?void 0:w.height)??0,y=o+(s!=="center"?"-"+s:""),I=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},P=Array.isArray(f)?f:[f],M=P.length>0,F={padding:I,boundary:P.filter(gm),altBoundary:M},{refs:R,floatingStyles:U,placement:E,isPositioned:S,middlewareData:B}=em({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>Wf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[nm({mainAxis:r+x,alignmentAxis:a}),m&&rm({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?om():void 0,...F}),m&&sm({...F}),am({...F,apply:({elements:ue,rects:ve,availableWidth:de,availableHeight:be})=>{const{width:fe,height:ie}=ve.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${be}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),_&&lm({element:_,padding:i}),xm({arrowWidth:j,arrowHeight:x}),d&&im({strategy:"referenceHidden",...F})]}),[O,z]=Va(E),q=Je(g);Ze(()=>{S&&(q==null||q())},[S,q]);const N=(G=B.arrow)==null?void 0:G.x,D=(K=B.arrow)==null?void 0:K.y,$=((V=B.arrow)==null?void 0:V.centerOffset)!==0,[T,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:S?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:T,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(mm,{scope:n,placedSide:O,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":O,"data-align":z,...v,ref:A,style:{...v.style,animation:S?void 0:"none"}})})})});Ha.displayName=mo;var Wa="PopperArrow",hm={top:"bottom",right:"left",bottom:"top",left:"right"},Ga=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=pm(Wa,o),a=hm[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(um,{...r,ref:n,style:{...r.style,display:"block"}})})});Ga.displayName=Wa;function gm(e){return e!==null}var xm=e=>({name:"transformOrigin",options:e,fn(t){var C,b,k;const{placement:n,rects:o,middlewareData:r}=t,a=((C=r.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Va(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=r.arrow)==null?void 0:b.x)??0)+i/2,h=(((k=r.arrow)==null?void 0:k.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Va(e){const[t,n="center"]=e.split("-");return[t,n]}var po=Ua,Jn=Ba,ho=Ha,go=Ga,vm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?dc.createPortal(u.jsx(he.div,{...o,ref:t}),a):null});pn.displayName=vm;function bm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Oe=e=>{const{present:t,children:n}=e,o=ym(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=Se(o.ref,wm(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Oe.displayName="Presence";function ym(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=bm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=En(o.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=o.current,l=r.current;if(l!==e){const d=s.current,h=En(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=En(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=En(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function En(e){return(e==null?void 0:e.animationName)||"none"}function wm(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",Cm={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,Ka,Sm]=wa(hn),[Em,qa]=nt(hn,[Sm]),[_m,km]=Em(hn),Ya=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Am,{...e,ref:t})})}));Ya.displayName=hn;var Am=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=Se(t,d),g=Ca(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,k]=p.useState(!1),A=Je(f),_=Ka(n),L=p.useRef(!1),[w,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(_m,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>k(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:u.jsx(he.div,{tabIndex:b||w===0?-1:0,"data-orientation":o,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const I=new CustomEvent(br,Cm);if(x.currentTarget.dispatchEvent(I),!I.defaultPrevented){const P=_().filter(E=>E.focusable),M=P.find(E=>E.active),F=P.find(E=>E.id===v),U=[M,F,...P].filter(Boolean).map(E=>E.ref.current);Za(U,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>k(!1))})})}),Xa="RovingFocusGroupItem",Qa=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=km(Xa,n),c=l.currentTabStopId===f,d=Ka(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{o?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Rm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(_=>_.focusable).map(_=>_.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const _=A.indexOf(C.currentTarget);A=l.loop?Nm(A,_+1):A.slice(_+1)}setTimeout(()=>Za(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Qa.displayName=Xa;var jm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Tm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Rm(e,t,n){const o=Tm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return jm[o]}function Za(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Nm(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Im=Ya,Mm=Qa,Pm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,_n=new WeakMap,kn={},yr=0,Ja=function(e){return e&&(e.host||Ja(e.parentNode))},Om=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=Ja(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Dm=function(e,t,n,o){var r=Om(t,Array.isArray(e)?e:[e]);kn[n]||(kn[n]=new WeakMap);var s=kn[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(o),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&_n.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(_n.has(c)||c.removeAttribute(o),_n.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,_n=new WeakMap,kn={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Pm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Dm(o,r,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],Lm=["ArrowDown","PageUp","Home"],ei=["ArrowUp","PageDown","End"],Fm=[...Lm,...ei],$m={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Um={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,zm,Bm]=wa(gn),[Nt,ti]=nt(gn,[Bm,Xt,qa]),er=Xt(),ni=qa(),[Hm,It]=Nt(gn),[Wm,xn]=Nt(gn),ri=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Ca(r);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),u.jsx(po,{...i,children:u.jsx(Hm,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(Wm,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:o})})})};ri.displayName=gn;var Gm="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(Jn,{...r,...o,ref:t})});vo.displayName=Gm;var bo="MenuPortal",[Vm,oi]=Nt(bo,{forceMount:void 0}),si=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=It(bo,t);return u.jsx(Vm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};si.displayName=bo;var De="MenuContent",[Km,yo]=Nt(De),ai=p.forwardRef((e,t)=>{const n=oi(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(qm,{...r,ref:t}):u.jsx(Ym,{...r,ref:t})})})})}),qm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),o=p.useRef(null),r=Se(t,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ym=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)})}),Xm=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),k=er(n),A=ni(n),_=zm(n),[L,w]=p.useState(null),j=p.useRef(null),x=Se(t,j,C.onContentChange),y=p.useRef(0),I=p.useRef(""),P=p.useRef(0),M=p.useRef(null),F=p.useRef("right"),R=p.useRef(0),U=g?Jr:p.Fragment,E=g?{as:Xm,allowPinchZoom:!0}:void 0,S=O=>{var G,K;const z=I.current+O,q=_().filter(V=>!V.disabled),N=document.activeElement,D=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),T=lp($,z,D),H=(K=q.find(V=>V.textValue===T))==null?void 0:K.ref.current;(function V(ne){I.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(z),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(O=>{var q,N;return F.current===((q=M.current)==null?void 0:q.side)&&up(O,(N=M.current)==null?void 0:N.area)},[]);return u.jsx(Km,{scope:n,searchRef:I,onItemEnter:p.useCallback(O=>{B(O)&&O.preventDefault()},[B]),onItemLeave:p.useCallback(O=>{var z;B(O)||((z=j.current)==null||z.focus(),w(null))},[B]),onTriggerLeave:p.useCallback(O=>{B(O)&&O.preventDefault()},[B]),pointerGraceTimerRef:P,onPointerGraceIntentChange:p.useCallback(O=>{M.current=O},[]),children:u.jsx(U,{...E,children:u.jsx(qn,{asChild:!0,trapped:r,onMountAutoFocus:te(s,O=>{var z;O.preventDefault(),(z=j.current)==null||z.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(Im,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:w,onEntryFocus:te(m,O=>{b.isUsingKeyboardRef.current||O.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Ci(C.open),"data-radix-menu-content":"",dir:b.dir,...k,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,O=>{const q=O.target.closest("[data-radix-menu-content]")===O.currentTarget,N=O.ctrlKey||O.altKey||O.metaKey,D=O.key.length===1;q&&(O.key==="Tab"&&O.preventDefault(),!N&&D&&S(O.key));const $=j.current;if(O.target!==$||!Fm.includes(O.key))return;O.preventDefault();const H=_().filter(G=>!G.disabled).map(G=>G.ref.current);ei.includes(O.key)&&H.reverse(),ap(H)}),onBlur:te(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(y.current),I.current="")}),onPointerMove:te(e.onPointerMove,an(O=>{const z=O.target,q=R.current!==O.clientX;if(O.currentTarget.contains(z)&&q){const N=O.clientX>R.current?"right":"left";F.current=N,R.current=O.clientX}}))})})})})})})});ai.displayName=De;var Qm="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"group",...o,ref:t})});Co.displayName=Qm;var Zm="MenuLabel",ii=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{...o,ref:t})});ii.displayName=Zm;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=Se(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>o==null?void 0:o(h),{once:!0}),ya(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(li,{...r,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var li=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=yo($n,n),i=ni(n),m=p.useRef(null),f=Se(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:o,textValue:r??d,children:u.jsx(Mm,{asChild:!0,...i,focusable:!o,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),Jm="MenuCheckboxItem",ci=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return u.jsx(pi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...r,ref:t,"data-state":Eo(n),onSelect:te(r.onSelect,()=>o==null?void 0:o(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ci.displayName=Jm;var ui="MenuRadioGroup",[ep,tp]=Nt(ui,{value:void 0,onValueChange:()=>{}}),di=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Je(o);return u.jsx(ep,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...r,ref:t})})});di.displayName=ui;var fi="MenuRadioItem",mi=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=tp(fi,e.__scopeMenu),s=n===r.value;return u.jsx(pi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":Eo(s),onSelect:te(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});mi.displayName=fi;var So="MenuItemIndicator",[pi,np]=Nt(So,{checked:!1}),hi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=np(So,n);return u.jsx(Oe,{present:o||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...r,ref:t,"data-state":Eo(s.checked)})})});hi.displayName=So;var rp="MenuSeparator",gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});gi.displayName=rp;var op="MenuArrow",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(go,{...r,...o,ref:t})});xi.displayName=op;var sp="MenuSub",[_b,vi]=Nt(sp),rn="MenuSubTrigger",bi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),o=xn(rn,e.__scopeMenu),r=vi(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(li,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Ci(n.open),...e,ref:Ke(t,r.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,k=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:k,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:k,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===" "||$m[o.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});bi.displayName=rn;var yi="MenuSubContent",wi=p.forwardRef((e,t)=>{const n=oi(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=vi(yi,e.__scopeMenu),m=p.useRef(null),f=Se(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Um[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});wi.displayName=yi;function Ci(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function Eo(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function ap(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ip(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function lp(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=ip(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function cp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function up(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return cp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var dp=ri,fp=vo,mp=si,pp=ai,hp=Co,gp=ii,xp=tr,vp=ci,bp=di,yp=mi,wp=hi,Cp=gi,Sp=xi,Ep=bi,_p=wi,nr="DropdownMenu",[kp]=nt(nr,[ti]),Ne=ti(),[Ap,Si]=kp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:r,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Ap,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(dp,{...m,open:l,onOpenChange:c,dir:o,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",ki=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=Si(_i,n),a=Ne(n);return u.jsx(fp,{asChild:!0,...a,children:u.jsx(he.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:Ke(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});ki.displayName=_i;var jp="DropdownMenuPortal",Ai=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ne(t);return u.jsx(mp,{...o,...n})};Ai.displayName=jp;var ji="DropdownMenuContent",Ti=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Si(ji,n),s=Ne(n),a=p.useRef(!1);return u.jsx(pp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ti.displayName=ji;var Tp="DropdownMenuGroup",Rp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(hp,{...r,...o,ref:t})});Rp.displayName=Tp;var Np="DropdownMenuLabel",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(gp,{...r,...o,ref:t})});Ri.displayName=Np;var Ip="DropdownMenuItem",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(xp,{...r,...o,ref:t})});Ni.displayName=Ip;var Mp="DropdownMenuCheckboxItem",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(vp,{...r,...o,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuRadioGroup",Dp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(bp,{...r,...o,ref:t})});Dp.displayName=Op;var Lp="DropdownMenuRadioItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(yp,{...r,...o,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuItemIndicator",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(wp,{...r,...o,ref:t})});Up.displayName=$p;var zp="DropdownMenuSeparator",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Cp,{...r,...o,ref:t})});Ii.displayName=zp;var Bp="DropdownMenuArrow",Hp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Sp,{...r,...o,ref:t})});Hp.displayName=Bp;var Wp="DropdownMenuSubTrigger",Gp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ep,{...r,...o,ref:t})});Gp.displayName=Wp;var Vp="DropdownMenuSubContent",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(_p,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Kp.displayName=Vp;var qp=Ei,Yp=ki,Xp=Ai,Qp=Ti,Zp=Ri,Jp=Ni,eh=Ii;function Mi({...e}){return u.jsx(qp,{"data-slot":"dropdown-menu",...e})}function Pi({...e}){return u.jsx(Yp,{"data-slot":"dropdown-menu-trigger",...e})}function Oi({className:e,sideOffset:t=4,...n}){return u.jsx(Xp,{children:u.jsx(Qp,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Tn({className:e,inset:t,variant:n="default",...o}){return u.jsx(Jp,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}function th({className:e,inset:t,...n}){return u.jsx(Zp,{"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(eh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const nh=[{value:"light",label:"Light",icon:u.jsx(ma,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(ua,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx($u,{className:"h-4 w-4"})}];function rh(){const{theme:e,setTheme:t,resolvedTheme:n}=xd();return u.jsxs(Mi,{children:[u.jsx(Pi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(ua,{className:"h-4 w-4"}):u.jsx(ma,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Oi,{align:"end",children:nh.map(o=>u.jsxs(Tn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,u.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const ws={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.description":"输入你的用户名和密码以继续。","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},oh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.description":"Enter your username and password to continue.","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.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","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Di="rcs_locale";function sh(){try{const t=localStorage.getItem(Di);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let _o=sh();const zr=new Set;function kb(e){_o=e;try{localStorage.setItem(Di,e)}catch{}zr.forEach(t=>t())}function ah(e){return zr.add(e),()=>{zr.delete(e)}}function Li(){return p.useSyncExternalStore(ah,()=>_o)}function Qe(e){return _o==="en"?oh[e]??ws[e]??e:ws[e]??e}const ih="";let zn=null;function lh(e){zn=e}function Ab(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function ch(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,o,r){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function Ee(e,t,n,o){const r={"Content-Type":"application/json"};zn&&(r.Authorization=`Bearer ${zn}`);const s=`${ih}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!o&&await ch())return Ee(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new wr(c,l,i.status)}return m}function jb(){return Ee("GET","/web/sessions/all")}function Tb(e){return Ee("GET",`/web/sessions/${e}`)}function Rb(e){return Ee("GET",`/web/sessions/${e}/history`)}function Nb(){return Ee("GET","/web/environments")}function Ib(e,t){return Ee("POST",`/web/sessions/${e}/events`,t)}function Mb(e,t){return Ee("POST",`/web/sessions/${e}/control`,t)}function Pb(e){return Ee("POST",`/web/sessions/${e}/interrupt`)}function Ob(e){return Ee("DELETE",`/web/sessions/${e}`)}function Db(e){return Ee("POST",`/web/sessions/${e}/clear`)}function Lb(e,t){return Ee("PATCH",`/web/sessions/${e}`,{title:t})}function Fb(e){return Ee("POST","/web/sessions",e)}function $b(e){return Ee("GET",`/web/sessions/s/${e}`)}function Ub(e){return Ee("GET",`/web/sessions/${e}/shares`)}function zb(e,t){return Ee("POST",`/web/sessions/${e}/shares`,t)}function Bb(e,t){return Ee("DELETE",`/web/sessions/${e}/shares/${t}`)}function Hb(e,t){return Ee("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Wb(e,t){return Ee("DELETE",`/web/teams/${e}/environments/${t}`)}function Gb(e){return Ee("POST","/web/environments/claim",{claim_token:e})}const Hr="rcs_active_team";function uh(){try{return localStorage.getItem(Hr)}catch{return null}}let Fi=uh();const Wr=new Set;function dh(){for(const e of Wr)e()}function fh(e){return Wr.add(e),()=>Wr.delete(e)}function mh(){return Fi}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}Fi=e,dh()}function ph(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(fh,mh,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await Ee("GET","/web/teams");t(f)}catch{t([])}finally{o(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===r)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await Ee("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function hh({className:e}){Li();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=ph();return r||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:s=>{const a=s.target.value;o(a||null)},children:[u.jsx("option",{value:"",children:Qe("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 $i=p.createContext(null);function Ui(){const e=p.useContext($i);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 gh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function xh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const k=await An(C);throw new Error(k.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const k=await Dt();n(k),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const k=await Dt();n(k),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const k=await An(C);throw new Error(k.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>gh(),[]);return u.jsx($i.Provider,{value:{user:t,isLoading:o,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function vh({onSettingsClick:e}){const{user:t,logout:n}=Ui();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Mi,{children:[u.jsx(Pi,{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(pa,{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(Oi,{align:"end",className:"w-48",children:[u.jsx(th,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(td,{className:"mr-2 h-4 w-4"}),Qe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(hd,{className:"mr-2 h-4 w-4"}),Qe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:o,children:[u.jsx(Ou,{className:"mr-2 h-4 w-4"}),Qe("user.menu.logout")]})]})]})}function bh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o}){return Li(),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(hh,{}),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(bu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Qe("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:Qe("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:Qe("nav.dashboard"),children:[u.jsx(Iu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Qe("nav.dashboard")})]}),u.jsx(rh,{}),u.jsx(vh,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function Vb({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 yh(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class zi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const o of this.onConnectionStateChange)o(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const o=new WebSocket(this.settings.proxyUrl,this.settings.token?[yh(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,l,c,d,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const C=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",C,"payload:",t.payload),C==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(C==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(C==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(C==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const b of this.onConfigOptionsChanged)b(this._configOptions)}(d=this.onSessionUpdate)==null||d.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const b of this.onModelChanged)b(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=ct.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},ct.PONG_TIMEOUT_MS)},ct.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new zi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const o of this.onModelStateChanged)o(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function wh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function Bi(e,t){return new Promise((function(n,o){let r;return Ch(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const Ch=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Bn={},Sh={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,o={};Sh.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),k=a(l,m+2),A=a(l,m+4);m+=6;var _=i(l,m+=8);m+=4,m+=b+k+A,o._readLocal(l,_,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var l=o.bin.readUshort,c=o.bin.readUint;c(r,s),l(r,s+=4),l(r,s+=2);var d=l(r,s+=2);c(r,s+=2),c(r,s+=4),s+=4;var h=l(r,s+=8),g=l(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(r.buffer,s);if(d==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);o.inflateRaw(C,b),a[v]=b}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var l in r){var c=!o._noNeed(l)&&!s,d=r[l],h=o.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?o.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*o.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=o._writeHeader(g,v,l,b,0)}var k=0,A=v;for(var l in f)b=f[l],C.push(v),v=o._writeHeader(g,v,l,b,1,C[k++]);var _=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,k),m(g,v+=2,k),i(g,v+=2,_),i(g,v+=4,A),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var l=o.bin.writeUint,c=o.bin.writeUshort,d=i.file;return l(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(r,s,20),c(r,s+=2,0),c(r,s+=2,i.cpr?8:0),l(r,s+=2,0),l(r,s+=4,i.crc),l(r,s+=4,d.length),l(r,s+=4,i.usize),c(r,s+=4,o.bin.sizeUTF8(a)),c(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(d,s),s+=d.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)r[s+m]=l,m++;else if((4294965248&l)==0)r[s+m]=192|l>>6,r[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[s+m]=224|l>>12,r[s+m+1]=128|l>>6&63,r[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[s+m]=240|l>>18,r[s+m+1]=128|l>>12&63,r[s+m+2]=128|l>>6&63,r[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},o.F={},o.F.deflateRaw=function(r,s,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=o.F.U,l=o.F._goodIndex;o.F._hash;var c=o.F._putsE,d=0,h=a<<3,g=0,v=r.length;if(i==0){for(;d<v;)c(s,h,d+(P=Math.min(65535,v-d))==v?1:0),h=o.F._copyExact(r,d,P,s,h+8),d+=P;return h>>>3}var C=f.lits,b=f.strt,k=f.prev,A=0,_=0,L=0,w=0,j=0,x=0;for(v>2&&(b[x=o.F._hash(r,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=o.F._hash(r,d+1);var y=d+1&32767;k[y]=b[x],b[x]=y}if(g<=d){(A>14e3||_>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(d==v-1||g==v?1:0,C,A,w,r,L,d-L,s,h),A=_=w=0,L=d);var I=0;d<v-2&&(I=o.F._bestMatch(r,d,k,j,Math.min(m[2],v-d),m[3]));var P=I>>>16,M=65535&I;if(I!=0){M=65535&I;var F=l(P=I>>>16,f.of0);f.lhst[257+F]++;var R=l(M,f.df0);f.dhst[R]++,w+=f.exb[F]+f.dxb[R],C[A]=P<<23|d-g,C[A+1]=M<<16|F<<8|R,A+=2,g=d+P}else f.lhst[r[d]]++;_++}}for(L==d&&r.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(1,C,A,w,r,L,d-L,s,h),A=0,_=0,A=_=w=0,L=d);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=o.F._hash(r,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||r[s+h]==r[s+h-d]){var C=o.F._howLong(r,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,k=0;k<C-2;k++){var A=s-d+k+32768&32767,_=A-a[A]+32768&32767;_>b&&(b=_,c=A)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,l,c,d){var h,g,v,C,b,k,A,_,L,w=o.F.U,j=o.F._putsF,x=o.F._putsE;w.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],b=h[3],k=h[4],A=h[5],_=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),I=i+o.F.contSize(w.fltree,w.lhst)+o.F.contSize(w.fdtree,w.dhst),P=i+o.F.contSize(w.ltree,w.lhst)+o.F.contSize(w.dtree,w.dhst);P+=14+3*A+o.F.contSize(w.itree,w.ihst)+(2*w.ihst[16]+3*w.ihst[17]+7*w.ihst[18]);for(var M=0;M<286;M++)w.lhst[M]=0;for(M=0;M<30;M++)w.dhst[M]=0;for(M=0;M<19;M++)w.ihst[M]=0;var F=y<I&&y<P?0:I<P?1:2;if(j(c,d,r),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=o.F._copyExact(m,f,l,c,d)}else{var R,U;if(F==1&&(R=w.fltree,U=w.fdtree),F==2){o.F.makeCodes(w.ltree,g),o.F.revCodes(w.ltree,g),o.F.makeCodes(w.dtree,v),o.F.revCodes(w.dtree,v),o.F.makeCodes(w.itree,C),o.F.revCodes(w.itree,C),R=w.ltree,U=w.dtree,x(c,d,b-257),x(c,d+=5,k-1),x(c,d+=5,A-4),d+=4;for(var E=0;E<A;E++)x(c,d+3*E,w.itree[1+(w.ordr[E]<<1)]);d+=3*A,d=o.F._codeTiny(_,w.itree,c,d),d=o.F._codeTiny(L,w.itree,c,d)}for(var S=f,B=0;B<a;B+=2){for(var O=s[B],z=O>>>23,q=S+(8388607&O);S<q;)d=o.F._writeLit(m[S++],R,c,d);if(z!=0){var N=s[B+1],D=N>>16,$=N>>8&255,T=255&N;x(c,d=o.F._writeLit(257+$,R,c,d),z-w.of0[$]),d+=w.exb[$],j(c,d=o.F._writeLit(T,U,c,d),D-w.df0[T]),d+=w.dxb[T],S+=z}}d=o.F._writeLit(256,R,c,d)}return d},o.F._copyExact=function(r,s,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],l=o.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var d=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],l=r[m+1];i=o.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,l,c),i+=c)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&r[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&r[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(_,L){return _.f-L.f}));var g=i[0],v=i[1],C=0,b=1,k=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(k==c||i[C].f<i[k].f)?i[C++]:i[k++],v=C!=b&&(k==c||i[C].f<i[k].f)?i[C++]:i[k++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=o.F.setDepth(i[b-1],0);for(A>a&&(o.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<r.length&&r[i].d>s;i++){var l=r[i].d;r[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=r[i].d)<s?(r[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,b,k=0,A=0,_=0,L=0,w=0,j=0,x=0,y=0,I=0;k==0;)if(k=m(r,I,1),A=m(r,I+1,2),I+=3,A!=0){if(v&&(s=o.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){_=f(r,I,5)+257,L=f(r,I+5,5)+1,w=f(r,I+10,4)+4,I+=14;for(var P=0;P<38;P+=2)g.itree[P]=0,g.itree[P+1]=0;var M=1;for(P=0;P<w;P++){var F=f(r,I+3*P,3);g.itree[1+(g.ordr[P]<<1)]=F,F>M&&(M=F)}I+=3*w,c(g.itree,M),d(g.itree,M,g.imap),C=g.lmap,b=g.dmap,I=l(g.imap,(1<<M)-1,_+L,r,I,g.ttree);var R=i._copyOut(g.ttree,0,_,g.ltree);j=(1<<R)-1;var U=i._copyOut(g.ttree,_,L,g.dtree);x=(1<<U)-1,c(g.ltree,R),d(g.ltree,R,C),c(g.dtree,U),d(g.dtree,U,b)}for(;;){var E=C[h(r,I)&j];I+=15&E;var S=E>>>4;if(!(S>>>8))s[y++]=S;else{if(S==256)break;var B=y+S-254;if(S>264){var O=g.ldef[S-257];B=y+(O>>>3)+f(r,I,7&O),I+=7&O}var z=b[h(r,I)&x];I+=15&z;var q=z>>>4,N=g.ddef[q],D=(N>>>4)+m(r,I,15&N);for(I+=15&N,v&&(s=o.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&I)!=0&&(I+=8-(7&I));var $=4+(I>>>3),T=r[$-4]|r[$-3]<<8;v&&(s=o.F._check(s,y+T)),s.set(new a(r.buffer,r.byteOffset+$,T),y),I=$+T<<3,y+=T}return s.length==y?s:s.slice(0,y)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var l=o.F._bitsE,c=o.F._get17,d=0;d<a;){var h=r[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,C=0;g==16?(C=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(C=3+l(i,m,3),m+=3):g==18&&(C=11+l(i,m,7),m+=7);for(var b=d+C;d<b;)f[d]=v,d++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+s];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},o.F.makeCodes=function(r,s){for(var a,i,m,f,l=o.F.U,c=r.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[r[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var l=f>>1,c=r[f+1],d=l<<4|c,h=s-c,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=o.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var Eh=wh({__proto__:null,default:Bn},[Bn]);const Le=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),k=new Uint32Array(b.buffer),{ctype:A}=h,{depth:_}=h,L=e.readUshort;if(A==6){const O=g<<2;if(_==8)for(var w=0;w<O;w+=4)b[w]=l[w],b[w+1]=l[w+1],b[w+2]=l[w+2],b[w+3]=l[w+3];if(_==16)for(w=0;w<O;w++)b[w]=l[w<<1]}else if(A==2){const O=h.tabs.tRNS;if(O==null){if(_==8)for(w=0;w<g;w++){var j=3*w;k[w]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(_==16)for(w=0;w<g;w++)j=6*w,k[w]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=O[0];const z=O[1],q=O[2];if(_==8)for(w=0;w<g;w++){var y=w<<2;j=3*w,k[w]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==z&&l[j+2]==q&&(b[y+3]=0)}if(_==16)for(w=0;w<g;w++)y=w<<2,j=6*w,k[w]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==z&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const O=h.tabs.PLTE,z=h.tabs.tRNS,q=z?z.length:0;if(_==1)for(var I=0;I<d;I++){var P=I*C,M=I*c;for(w=0;w<c;w++){y=M+w<<2;var F=3*(R=l[P+(w>>3)]>>7-((7&w)<<0)&1);b[y]=O[F],b[y+1]=O[F+1],b[y+2]=O[F+2],b[y+3]=R<q?z[R]:255}}if(_==2)for(I=0;I<d;I++)for(P=I*C,M=I*c,w=0;w<c;w++)y=M+w<<2,F=3*(R=l[P+(w>>2)]>>6-((3&w)<<1)&3),b[y]=O[F],b[y+1]=O[F+1],b[y+2]=O[F+2],b[y+3]=R<q?z[R]:255;if(_==4)for(I=0;I<d;I++)for(P=I*C,M=I*c,w=0;w<c;w++)y=M+w<<2,F=3*(R=l[P+(w>>1)]>>4-((1&w)<<2)&15),b[y]=O[F],b[y+1]=O[F+1],b[y+2]=O[F+2],b[y+3]=R<q?z[R]:255;if(_==8)for(w=0;w<g;w++){var R;y=w<<2,F=3*(R=l[w]),b[y]=O[F],b[y+1]=O[F+1],b[y+2]=O[F+2],b[y+3]=R<q?z[R]:255}}else if(A==4){if(_==8)for(w=0;w<g;w++){y=w<<2;var U=l[E=w<<1];b[y]=U,b[y+1]=U,b[y+2]=U,b[y+3]=l[E+1]}if(_==16)for(w=0;w<g;w++){var E;y=w<<2,U=l[E=w<<2],b[y]=U,b[y+1]=U,b[y+2]=U,b[y+3]=l[E+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,I=0;I<d;I++){const O=I*C,z=I*c;if(_==1)for(var S=0;S<c;S++){var B=(U=255*(l[O+(S>>>3)]>>>7-(7&S)&1))==255*x?0:255;k[z+S]=B<<24|U<<16|U<<8|U}else if(_==2)for(S=0;S<c;S++)B=(U=85*(l[O+(S>>>2)]>>>6-((3&S)<<1)&3))==85*x?0:255,k[z+S]=B<<24|U<<16|U<<8|U;else if(_==4)for(S=0;S<c;S++)B=(U=17*(l[O+(S>>>1)]>>>4-((1&S)<<2)&15))==17*x?0:255,k[z+S]=B<<24|U<<16|U<<8|U;else if(_==8)for(S=0;S<c;S++)B=(U=l[O+S])==x?0:255,k[z+S]=B<<24|U<<16|U<<8|U;else if(_==16)for(S=0;S<c;S++)U=l[O+(S<<1)],B=L(l,O+(S<<1))==x?0:255,k[z+S]=B<<24|U<<16|U<<8|U}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,C):o(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(k,A){const _=A.width,L=A.height,w=s(A),j=w>>3,x=Math.ceil(_*w/8),y=new Uint8Array(L*x);let I=0;const P=[0,0,4,0,2,0,1],M=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],R=[8,8,4,4,2,2,1];let U=0;for(;U<7;){const S=F[U],B=R[U];let O=0,z=0,q=P[U];for(;q<L;)q+=S,z++;let N=M[U];for(;N<_;)N+=B,O++;const D=Math.ceil(O*w/8);a(k,A,I,O,z);let $=0,T=P[U];for(;T<L;){let H=M[U],G=I+$*D<<3;for(;H<_;){var E;if(w==1&&(E=(E=k[G>>3])>>7-(7&G)&1,y[T*x+(H>>3)]|=E<<7-((7&H)<<0)),w==2&&(E=(E=k[G>>3])>>6-(7&G)&3,y[T*x+(H>>2)]|=E<<6-((3&H)<<1)),w==4&&(E=(E=k[G>>3])>>4-(7&G)&15,y[T*x+(H>>1)]|=E<<4-((1&H)<<2)),w>=8){const K=T*x+H*j;for(let V=0;V<j;V++)y[K+V]=k[(G>>3)+V]}G+=w,H+=B}$++,T+=S}O*z!=0&&(I+=z*(1+D)),U+=1}return y})(c,l)),c}function o(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,k=0,A=0,_=0,L=0,w=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,I=y.b,P=y.e,M=y.R,F=y.n,R=y.A,U=y.Z,E=y.m,S=d==null;for(S&&(d=new h(c.length>>>2<<5));C==0;)if(C=I(c,x,1),b=I(c,x+1,2),x+=3,b!=0){if(S&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=E.J,v=E.h,L=511,w=31),b==2){k=P(c,x,5)+257,A=P(c,x+5,5)+1,_=P(c,x+10,4)+4,x+=14;let O=1;for(var B=0;B<38;B+=2)E.Q[B]=0,E.Q[B+1]=0;for(B=0;B<_;B++){const N=P(c,x+3*B,3);E.Q[1+(E.X[B]<<1)]=N,N>O&&(O=N)}x+=3*_,F(E.Q,O),R(E.Q,O,E.u),g=E.w,v=E.d,x=M(E.u,(1<<O)-1,k+A,c,x,E.v);const z=y.V(E.v,0,k,E.C);L=(1<<z)-1;const q=y.V(E.v,k,A,E.D);w=(1<<q)-1,F(E.C,z),R(E.C,z,g),F(E.D,q),R(E.D,q,v)}for(;;){const O=g[U(c,x)&L];x+=15&O;const z=O>>>4;if(!(z>>>8))d[j++]=z;else{if(z==256)break;{let q=j+z-254;if(z>264){const H=E.q[z-257];q=j+(H>>>3)+P(c,x,7&H),x+=7&H}const N=v[U(c,x)&w];x+=15&N;const D=N>>>4,$=E.c[D],T=($>>>4)+I(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-T],d[j]=d[j++-T],d[j]=d[j++-T],d[j]=d[j++-T];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const O=4+(x>>>3),z=c[O-4]|c[O-3]<<8;S&&(d=l.H.W(d,j+z)),d.set(new h(c.buffer,c.byteOffset+O,z),j),x=O+z<<3,j+=z}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,k=l.H.Z;let A=0;for(;A<h;){const _=c[k(g,v)&d];v+=15&_;const L=_>>>4;if(L<=15)C[A]=L,A++;else{let w=0,j=0;L==16?(j=3+b(g,v,2),v+=2,w=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=w,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const k=c[C+d];g[C<<1]=0,g[1+(C<<1)]=k,k>v&&(v=k),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,k;const A=h.j;for(var _=0;_<=d;_++)A[_]=0;for(_=1;_<g;_+=2)A[c[_]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)k=c[b+1],k!=0&&(c[b]=L[k],L[k]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,k=c[C+1],A=b<<4|k,_=d-k;let L=c[C]<<_;const w=L+(1<<_);for(;L!=w;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,c.r[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,k;v=Math.ceil(v/8);let A=l[d],_=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(_=v;_<C;_++)l[_+1]=l[_+1]+(l[_+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,k=b+L+1,A=l[k-1],_=0,A==0)for(;_<C;_++)l[b+_]=l[k+_];else if(A==1){for(;_<v;_++)l[b+_]=l[k+_];for(;_<C;_++)l[b+_]=l[k+_]+l[b+_-v]}else if(A==2)for(;_<C;_++)l[b+_]=l[k+_]+l[b+_-C];else if(A==3){for(;_<v;_++)l[b+_]=l[k+_]+(l[b+_-C]>>>1);for(;_<C;_++)l[b+_]=l[k+_]+(l[b+_-C]+l[b+_-v]>>>1)}else{for(;_<v;_++)l[b+_]=l[k+_]+i(0,l[b+_-C],0);for(;_<C;_++)l[b+_]=l[k+_]+i(l[b+_-v],l[b+_-C],l[b+_-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,k){const A=Math.min(c,g),_=Math.min(d,v);let L=0,w=0;for(let U=0;U<_;U++)for(let E=0;E<A;E++)if(C>=0&&b>=0?(L=U*c+E<<2,w=(b+U)*g+C+E<<2):(L=(-b+U)*c-C+E<<2,w=U*g+E<<2),k==0)h[w]=l[L],h[w+1]=l[L+1],h[w+2]=l[L+2],h[w+3]=l[L+3];else if(k==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,I=l[L+2]*j,P=h[w+3]*(1/255),M=h[w]*P,F=h[w+1]*P,R=h[w+2]*P;const S=1-j,B=j+P*S,O=B==0?0:1/B;h[w+3]=255*B,h[w+0]=(x+M*S)*O,h[w+1]=(y+F*S)*O,h[w+2]=(I+R*S)*O}else if(k==2)j=l[L+3],x=l[L],y=l[L+1],I=l[L+2],P=h[w+3],M=h[w],F=h[w+1],R=h[w+2],j==P&&x==M&&y==F&&I==R?(h[w]=0,h[w+1]=0,h[w+2]=0,h[w+3]=0):(h[w]=x,h[w+1]=y,h[w+2]=I,h[w+3]=j);else if(k==3){if(j=l[L+3],x=l[L],y=l[L+1],I=l[L+2],P=h[w+3],M=h[w],F=h[w+1],R=h[w+2],j==P&&x==M&&y==F&&I==R)continue;if(j<220&&P>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},k=new Uint8Array(d.length);let A,_=0,L=0;const w=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=w[j])throw"The input is not a PNG file!";for(;h<d.length;){const U=g.readUint(d,h);h+=4;const E=g.readASCII(d,h,4);if(h+=4,E=="IHDR")m(d,h,b);else if(E=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const S=d.slice(x+2,h+U);let B=null;try{B=o(S)}catch{B=r(S)}b.tabs[E]=B}else if(E=="CgBI")b.tabs[E]=d.slice(h,h+4);else if(E=="IDAT"){for(j=0;j<U;j++)k[_+j]=d[h+j];_+=U}else if(E=="acTL")b.tabs[E]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(E=="fcTL"){L!=0&&((R=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),R.rect.width,R.rect.height),L=0);const S={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const O={rect:S,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(O)}else if(E=="fdAT"){for(j=0;j<U-4;j++)A[L+j]=d[h+j+4];L+=U-4}else if(E=="pHYs")b.tabs[E]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(E=="cHRM")for(b.tabs[E]=[],j=0;j<8;j++)b.tabs[E].push(g.readUint(d,h+4*j));else if(E=="tEXt"||E=="zTXt"){b.tabs[E]==null&&(b.tabs[E]={});var y=g.nextZero(d,h),I=g.readASCII(d,h,y-h),P=h+U-y-1;if(E=="tEXt")F=g.readASCII(d,y+1,P);else{var M=o(d.slice(y+2,y+2+P));F=g.readUTF8(M,0,M.length)}b.tabs[E][I]=F}else if(E=="iTXt"){b.tabs[E]==null&&(b.tabs[E]={}),y=0,x=h,y=g.nextZero(d,x),I=g.readASCII(d,x,y-x);const S=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),P=U-((x=y+1)-h),S==0?F=g.readUTF8(d,x,P):(M=o(d.slice(x,x+P)),F=g.readUTF8(M,0,M.length)),b.tabs[E][I]=F}else if(E=="PLTE")b.tabs[E]=g.readBytes(d,h,U);else if(E=="hIST"){const S=b.tabs.PLTE.length/3;for(b.tabs[E]=[],j=0;j<S;j++)b.tabs[E].push(v(d,h+2*j))}else if(E=="tRNS")b.ctype==3?b.tabs[E]=g.readBytes(d,h,U):b.ctype==0?b.tabs[E]=v(d,h):b.ctype==2&&(b.tabs[E]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(E=="gAMA")b.tabs[E]=g.readUint(d,h)/1e5;else if(E=="sRGB")b.tabs[E]=d[h];else if(E=="bKGD")b.ctype==0||b.ctype==4?b.tabs[E]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[E]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[E]=d[h]);else if(E=="IEND")break;h+=U,g.readUint(d,h),h+=4}var R;return L!=0&&((R=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),R.rect.width,R.rect.height)),b.data=n(b,k,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),k=new Uint8Array(v);for(let _=0;_<c.frames.length;_++){const L=c.frames[_],w=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,I=t(L.data,x,y,c);if(_!=0)for(var A=0;A<v;A++)k[A]=C[A];if(L.blend==0?f(I,x,y,C,d,h,w,j,0):L.blend==1&&f(I,x,y,C,d,h,w,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,w,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=k[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let I=y;for(let P=0;P<8;P++)1&I?I=3988292384^I>>>1:I>>>=1;x[y]=I}return x})(),update(x,y,I,P){for(let M=0;M<P;M++)x=o.table[255&(x^y[I+M])]^x>>>8;return x},crc:(x,y,I)=>4294967295^o.update(4294967295,x,y,I)};function r(x,y,I,P){y[I]+=x[0]*P>>4,y[I+1]+=x[1]*P>>4,y[I+2]+=x[2]*P>>4,y[I+3]+=x[3]*P>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const I=x[0]-y[0],P=x[1]-y[1],M=x[2]-y[2],F=x[3]-y[3];return I*I+P*P+M*M+F*F}function i(x,y,I,P,M,F,R){R==null&&(R=1);const U=P.length,E=[];for(var S=0;S<U;S++){const T=P[S];E.push([T>>>0&255,T>>>8&255,T>>>16&255,T>>>24&255])}for(S=0;S<U;S++){let T=4294967295;for(var B=0,O=0;O<U;O++){var z=a(E[S],E[O]);O!=S&&z<T&&(T=z,B=O)}}const q=new Uint32Array(M.buffer),N=new Int16Array(y*I*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(S=0;S<D.length;S++)D[S]=255*((D[S]+.5)/16-.5);for(let T=0;T<I;T++)for(let H=0;H<y;H++){var $;S=4*(T*y+H),R!=2?$=[s(x[S]+N[S]),s(x[S+1]+N[S+1]),s(x[S+2]+N[S+2]),s(x[S+3]+N[S+3])]:(z=D[4*(3&T)+(3&H)],$=[s(x[S]+z),s(x[S+1]+z),s(x[S+2]+z),s(x[S+3]+z)]),B=0;let G=16777215;for(O=0;O<U;O++){const ne=a($,E[O]);ne<G&&(G=ne,B=O)}const K=E[B],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];R==1&&(H!=y-1&&r(V,N,S+4,7),T!=I-1&&(H!=0&&r(V,N,S+4*y-4,3),r(V,N,S+4*y,5),H!=y-1&&r(V,N,S+4*y+4,1))),F[S>>2]=B,q[S>>2]=P[B]}}function m(x,y,I,P,M){M==null&&(M={});const{crc:F}=o,R=t.writeUint,U=t.writeUshort,E=t.writeASCII;let S=8;const B=x.frames.length>1;let O,z=!1,q=33+(B?20:0);if(M.sRGB!=null&&(q+=13),M.pHYs!=null&&(q+=21),M.iCCP!=null&&(O=pako.deflate(M.iCCP),q+=21+O.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(z=!0);q+=8+3*N+4+(z?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const T=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)T[D]=H[D];if(R(T,S,13),S+=4,E(T,S,"IHDR"),S+=4,R(T,S,y),S+=4,R(T,S,I),S+=4,T[S]=x.depth,S++,T[S]=x.ctype,S++,T[S]=0,S++,T[S]=0,S++,T[S]=0,S++,R(T,S,F(T,S-17,17)),S+=4,M.sRGB!=null&&(R(T,S,1),S+=4,E(T,S,"sRGB"),S+=4,T[S]=M.sRGB,S++,R(T,S,F(T,S-5,5)),S+=4),M.iCCP!=null){const V=13+O.length;R(T,S,V),S+=4,E(T,S,"iCCP"),S+=4,E(T,S,"ICC profile"),S+=11,S+=2,T.set(O,S),S+=O.length,R(T,S,F(T,S-(V+4),V+4)),S+=4}if(M.pHYs!=null&&(R(T,S,9),S+=4,E(T,S,"pHYs"),S+=4,R(T,S,M.pHYs[0]),S+=4,R(T,S,M.pHYs[1]),S+=4,T[S]=M.pHYs[2],S++,R(T,S,F(T,S-13,13)),S+=4),B&&(R(T,S,8),S+=4,E(T,S,"acTL"),S+=4,R(T,S,x.frames.length),S+=4,R(T,S,M.loop!=null?M.loop:0),S+=4,R(T,S,F(T,S-12,12)),S+=4),x.ctype==3){for(R(T,S,3*(N=x.plte.length)),S+=4,E(T,S,"PLTE"),S+=4,D=0;D<N;D++){const V=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;T[S+V+0]=Z,T[S+V+1]=re,T[S+V+2]=ue}if(S+=3*N,R(T,S,F(T,S-3*N-4,3*N+4)),S+=4,z){for(R(T,S,N),S+=4,E(T,S,"tRNS"),S+=4,D=0;D<N;D++)T[S+D]=x.plte[D]>>>24&255;S+=N,R(T,S,F(T,S-N-4,N+4)),S+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(R(T,S,26),S+=4,E(T,S,"fcTL"),S+=4,R(T,S,G++),S+=4,R(T,S,K.rect.width),S+=4,R(T,S,K.rect.height),S+=4,R(T,S,K.rect.x),S+=4,R(T,S,K.rect.y),S+=4,U(T,S,P[$]),S+=2,U(T,S,1e3),S+=2,T[S]=K.dispose,S++,T[S]=K.blend,S++,R(T,S,F(T,S-30,30)),S+=4);const V=K.cimg;R(T,S,(N=V.length)+($==0?0:4)),S+=4;const ne=S;E(T,S,$==0?"IDAT":"fdAT"),S+=4,$!=0&&(R(T,S,G++),S+=4),T.set(V,S),S+=N,R(T,S,F(T,ne,S-ne)),S+=4}return R(T,S,0),S+=4,E(T,S,"IEND"),S+=4,R(T,S,F(T,S-4,4)),S+=4,T.buffer}function f(x,y,I){for(let P=0;P<x.frames.length;P++){const M=x.frames[P];M.rect.width;const F=M.rect.height,R=new Uint8Array(F*M.bpl+F);M.cimg=h(M.img,F,M.bpp,M.bpl,R,y,I)}}function l(x,y,I,P,M){const F=M[0],R=M[1],U=M[2],E=M[3],S=M[4],B=M[5];let O=6,z=8,q=255;for(var N=0;N<x.length;N++){const be=new Uint8Array(x[N]);for(var D=be.length,$=0;$<D;$+=4)q&=be[$+3]}const T=q!=255,H=(function(fe,ie,ge,ye,me,ke){const we=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Ce=0,le=0,xe=ie,Ye=ge,Mt=ye?1:0;if(pe!=0){const ic=ke||ye||pe==1||we[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<ic;Zt++){var ze=new Uint8Array(fe[pe-1-Zt]);const lc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=lc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Ce=ot,le=st,xe=Pt-ot+1,Ye=Jt-st+1)}ze=new Uint8Array(fe[pe-1-dr]),dr==1&&(we[pe-1].dispose=2),Te=new Uint8Array(xe*Ye*4),e(ze,ie,ge,Te,xe,Ye,-Ce,-le,0),Mt=e(J,ie,ge,Te,xe,Ye,-Ce,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Ce,y:le,width:xe,height:Ye}):e(J,ie,ge,Te,xe,Ye,-Ce,-le,0)}else Te=J.slice(0);we.push({rect:{x:Ce,y:le,width:xe,height:Ye},img:Te,blend:Mt,dispose:0})}if(ye)for(pe=0;pe<we.length;pe++){if((Y=we[pe]).blend==1)continue;const J=Y.rect,ce=we[pe-1].rect,Ce=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),xe={x:Ce,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Ce,height:Math.max(J.y+J.height,ce.y+ce.height)-le};we[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,we,pe-1,xe,me),c(fe,ie,ge,we,pe,xe,me)}let xt=0;if(fe.length!=1)for(var W=0;W<we.length;W++){var Y;xt+=(Y=we[W]).rect.width*Y.rect.height}return we})(x,y,I,F,R,U),G={},K=[],V=[];if(P!=0){const be=[];for($=0;$<H.length;$++)be.push(H[$].img.buffer);const fe=(function(me){let ke=0;for(var we=0;we<me.length;we++)ke+=me[we].byteLength;const pe=new Uint8Array(ke);let Te=0;for(we=0;we<me.length;we++){const ze=new Uint8Array(me[we]),xt=ze.length;for(let W=0;W<xt;W+=4){let Y=ze[W],J=ze[W+1],ce=ze[W+2];const Ce=ze[W+3];Ce==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Ce}Te+=xt}return pe.buffer})(be),ie=v(fe,P);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const ye=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,ye>>2);V.push(ne);const me=new Uint8Array(ie.abuf,ge,ye);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=ye}}else for(N=0;N<H.length;N++){var Z=H[N];const be=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=be.length,ne=new Uint8Array(D),V.push(ne),$=0;$<D;$++){const fe=be[$];if($!=0&&fe==be[$-1])ne[$]=ne[$-1];else if($>re&&fe==be[$-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&&S==0&&(z=ue<=2?1:ue<=4?2:ue<=16?4:8,z=Math.max(z,E)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const be=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&S==0){ie=Math.ceil(z*re/8);var ve=new Uint8Array(ie*be);const ye=V[N];for(let me=0;me<be;me++){$=me*ie;const ke=me*re;if(z==8)for(var de=0;de<re;de++)ve[$+de]=ye[ke+de];else if(z==4)for(de=0;de<re;de++)ve[$+(de>>1)]|=ye[ke+de]<<4-4*(1&de);else if(z==2)for(de=0;de<re;de++)ve[$+(de>>2)]|=ye[ke+de]<<6-2*(3&de);else if(z==1)for(de=0;de<re;de++)ve[$+(de>>3)]|=ye[ke+de]<<7-1*(7&de)}fe=ve,O=3,ge=1}else if(T==0&&H.length==1){ve=new Uint8Array(re*be*3);const ye=re*be;for($=0;$<ye;$++){const me=3*$,ke=4*$;ve[me]=fe[ke],ve[me+1]=fe[ke+1],ve[me+2]=fe[ke+2]}fe=ve,O=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:O,depth:z,plte:K,frames:H}}function c(x,y,I,P,M,F,R){const U=Uint8Array,E=Uint32Array,S=new U(x[M-1]),B=new E(x[M-1]),O=M+1<x.length?new U(x[M+1]):null,z=new U(x[M]),q=new E(z.buffer);let N=y,D=I,$=-1,T=-1;for(let G=0;G<F.height;G++)for(let K=0;K<F.width;K++){const V=F.x+K,ne=F.y+G,Z=ne*y+V,re=q[Z];re==0||P[M-1].dispose==0&&B[Z]==re&&(O==null||O[4*Z+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<D&&(D=ne),ne>T&&(T=ne))}$==-1&&(N=D=$=T=0),R&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:T-D+1};const H=P[M];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),P[M-1].dispose==0?(e(S,y,I,H.img,F.width,F.height,-F.x,-F.y,0),d(z,y,I,H.img,F)):e(z,y,I,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,I,P,M){e(x,y,I,P,M.width,M.height,-M.x,-M.y,2)}function h(x,y,I,P,M,F,R){const U=[];let E,S=[0,1,2,3,4];F!=-1?S=[F]:(y*P>5e5||I==1)&&(S=[0]),R&&(E={level:0});const B=Eh;for(var O=0;O<S.length;O++){for(let N=0;N<y;N++)g(M,x,N,P,I,S[O]);U.push(B.deflate(M,E))}let z,q=1e9;for(O=0;O<U.length;O++)U[O].length<q&&(z=O,q=U[O].length);return U[z]}function g(x,y,I,P,M,F){const R=I*P;let U=R+I;if(x[U]=F,U++,F==0)if(P<500)for(var E=0;E<P;E++)x[U+E]=y[R+E];else x.set(new Uint8Array(y.buffer,R,P),U);else if(F==1){for(E=0;E<M;E++)x[U+E]=y[R+E];for(E=M;E<P;E++)x[U+E]=y[R+E]-y[R+E-M]+256&255}else if(I==0){for(E=0;E<M;E++)x[U+E]=y[R+E];if(F==2)for(E=M;E<P;E++)x[U+E]=y[R+E];if(F==3)for(E=M;E<P;E++)x[U+E]=y[R+E]-(y[R+E-M]>>1)+256&255;if(F==4)for(E=M;E<P;E++)x[U+E]=y[R+E]-n(y[R+E-M],0,0)+256&255}else{if(F==2)for(E=0;E<P;E++)x[U+E]=y[R+E]+256-y[R+E-P]&255;if(F==3){for(E=0;E<M;E++)x[U+E]=y[R+E]+256-(y[R+E-P]>>1)&255;for(E=M;E<P;E++)x[U+E]=y[R+E]+256-(y[R+E-P]+y[R+E-M]>>1)&255}if(F==4){for(E=0;E<M;E++)x[U+E]=y[R+E]+256-n(0,y[R+E-P],0)&255;for(E=M;E<P;E++)x[U+E]=y[R+E]+256-n(y[R+E-M],y[R+E-P],y[R+E-M-P])&255}}}function v(x,y){const I=new Uint8Array(x),P=I.slice(0),M=new Uint32Array(P.buffer),F=C(P,y),R=F[0],U=F[1],E=I.length,S=new Uint8Array(E>>2);let B;if(I.length<2e7)for(var O=0;O<E;O+=4)B=b(R,z=I[O]*(1/255),q=I[O+1]*(1/255),N=I[O+2]*(1/255),D=I[O+3]*(1/255)),S[O>>2]=B.ind,M[O>>2]=B.est.rgba;else for(O=0;O<E;O+=4){var z=I[O]*.00392156862745098,q=I[O+1]*(1/255),N=I[O+2]*(1/255),D=I[O+3]*(1/255);for(B=R;B.left;)B=k(B.est,z,q,N,D)<=0?B.left:B.right;S[O>>2]=B.ind,M[O>>2]=B.est.rgba}return{abuf:P.buffer,inds:S,plte:U}}function C(x,y,I){I==null&&(I=1e-4);const P=new Uint32Array(x.buffer),M={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};M.bst=L(x,M.i0,M.i1),M.est=w(M.bst);const F=[M];for(;F.length<y;){let U=0,E=0;for(var R=0;R<F.length;R++)F[R].est.L>U&&(U=F[R].est.L,E=R);if(U<I)break;const S=F[E],B=A(x,P,S.i0,S.i1,S.est.e,S.est.eMq255);if(S.i0>=B||S.i1<=B){S.est.L=0;continue}const O={i0:S.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=w(O.bst);const z={i0:B,i1:S.i1,bst:null,est:null,tdst:0,left:null,right:null};for(z.bst={R:[],m:[],N:S.bst.N-O.bst.N},R=0;R<16;R++)z.bst.R[R]=S.bst.R[R]-O.bst.R[R];for(R=0;R<4;R++)z.bst.m[R]=S.bst.m[R]-O.bst.m[R];z.est=w(z.bst),S.left=O,S.right=z,F[E]=O,F.push(z)}for(F.sort(((U,E)=>E.bst.N-U.bst.N)),R=0;R<F.length;R++)F[R].ind=R;return[M,F]}function b(x,y,I,P,M){if(x.left==null)return x.tdst=(function(O,z,q,N,D){const $=z-O[0],T=q-O[1],H=N-O[2],G=D-O[3];return $*$+T*T+H*H+G*G})(x.est.q,y,I,P,M),x;const F=k(x.est,y,I,P,M);let R=x.left,U=x.right;F>0&&(R=x.right,U=x.left);const E=b(R,y,I,P,M);if(E.tdst<=F*F)return E;const S=b(U,y,I,P,M);return S.tdst<E.tdst?S:E}function k(x,y,I,P,M){const{e:F}=x;return F[0]*y+F[1]*I+F[2]*P+F[3]*M-x.eMq}function A(x,y,I,P,M,F){for(P-=4;I<P;){for(;_(x,I,M)<=F;)I+=4;for(;_(x,P,M)>F;)P-=4;if(I>=P)break;const R=y[I>>2];y[I>>2]=y[P>>2],y[P>>2]=R,I+=4,P-=4}for(;_(x,I,M)>F;)I-=4;return I+4}function _(x,y,I){return x[y]*I[0]+x[y+1]*I[1]+x[y+2]*I[2]+x[y+3]*I[3]}function L(x,y,I){const P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],M=[0,0,0,0],F=I-y>>2;for(let R=y;R<I;R+=4){const U=x[R]*.00392156862745098,E=x[R+1]*(1/255),S=x[R+2]*(1/255),B=x[R+3]*(1/255);M[0]+=U,M[1]+=E,M[2]+=S,M[3]+=B,P[0]+=U*U,P[1]+=U*E,P[2]+=U*S,P[3]+=U*B,P[5]+=E*E,P[6]+=E*S,P[7]+=E*B,P[10]+=S*S,P[11]+=S*B,P[15]+=B*B}return P[4]=P[1],P[8]=P[2],P[9]=P[6],P[12]=P[3],P[13]=P[7],P[14]=P[11],{R:P,m:M,N:F}}function w(x){const{R:y}=x,{m:I}=x,{N:P}=x,M=I[0],F=I[1],R=I[2],U=I[3],E=P==0?0:1/P,S=[y[0]-M*M*E,y[1]-M*F*E,y[2]-M*R*E,y[3]-M*U*E,y[4]-F*M*E,y[5]-F*F*E,y[6]-F*R*E,y[7]-F*U*E,y[8]-R*M*E,y[9]-R*F*E,y[10]-R*R*E,y[11]-R*U*E,y[12]-U*M*E,y[13]-U*F*E,y[14]-U*R*E,y[15]-U*U*E],B=S,O=j;let z=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(P!=0)for(let $=0;$<16&&(z=O.multVec(B,z),N=Math.sqrt(O.dot(z,z)),z=O.sml(1/N,z),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[M*E,F*E,R*E,U*E];return{Cov:S,q:D,e:z,L:q,eMq255:O.dot(O.sml(255,D),z),eMq:O.dot(z,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,I,P,M,F,R,U){M==null&&(M=0),U==null&&(U=!1);const E=l(y,I,P,M,[!1,!1,!1,0,U,!1]);return f(E,-1),m(E,I,P,F,R)},Le.encodeLL=function(y,I,P,M,F,R,U,E){const S={ctype:0+(M==1?0:2)+(F==0?0:4),depth:R,frames:[]},B=(M+F)*R,O=B*I;for(let z=0;z<y.length;z++)S.frames.push({rect:{x:0,y:0,width:I,height:P},img:new Uint8Array(y[z]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(O/8)});return f(S,0,!0),m(S,I,P,U,E)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Hi={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,k=0,A=0,_=0;function L(x){c.setUint16(A,x,!0),A+=2}function w(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),w(f),j(4),w(122),w(108),w(n),w(-o>>>0),L(1),L(32),w(3),w(m),w(2835),w(2835),j(8),w(16711680),w(65280),w(255),w(4278190080),w(1466527264),(function x(){for(;k<o&&b>0;){for(C=122+k*i,h=0;h<r;)b--,g=a[_++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;k++}_<a.length?(b=d,setTimeout(x,Hi._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"},_h={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const ko=typeof window<"u",Wi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=ko&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),kh=(ko||Wi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Gi=(ko||Wi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,o(f)}))}function Vi(e){return new Promise(((t,n)=>{const o=new Gi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function Ki(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function qi(e,t){const n=St(),o=_h[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function rr(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function Yi(e,t){const{width:n,height:o}=qi(e.width,e.height),[r,s]=rr(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Yi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return o(c)}};try{let l;return Vi(e).then((function(c){try{return l=c,Ki(l).then((function(d){try{return r=d,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return o(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Le.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Hi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=o,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=o,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),Ao(c,n,o).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function We(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,o,r,s;return $t.cachedResult!==void 0?e($t.cachedResult):Ao("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Wn(n).then((function(i){try{return o=i[1],Gn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,We(o),Wn(r).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function Xi(e){return new Promise(((t,n)=>{const o=new Gi;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Qi(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=rr(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),We(e)),a}function Zi(e,t){const{width:n}=e,{height:o}=e,[r,s]=rr(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),We(e),r}function Ss(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,l,c,d,h,g,v,C,b,k,A,_,L,w,j,x;function y(P=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=P,t.onProgress(Math.min(s,100))}function I(P){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(P,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(P){try{return[,m]=P,y(),f=Qi(m,t),y(),new Promise((function(M,F){var R;if(!(R=t.exifOrientation))return Xi(e).then((function(E){try{return R=E,U.call(this)}catch(S){return F(S)}}).bind(this),F);function U(){return M(R)}return U.call(this)})).then((function(M){try{return l=M,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(R){try{{let E=function(){if(a--&&(A>i||A>b)){let B,O;return B=x?.95*j.width:j.width,O=x?.95*j.height:j.height,[L,w]=rr(B,O),w.drawImage(j,0,0,B,O),d*=h==="image/png"?.85:.95,Gn(L,h,e.name,e.lastModified,d).then((function(z){try{return _=z,We(j),j=L,A=_.size,I(Math.min(99,Math.floor((k-A)/(k-i)*100))),E}catch(q){return r(q)}}),r)}return[1]},S=function(){return We(j),We(L),We(f),We(c),We(m),I(100),o(_)};if(g=R,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return I(100),o(g);var U;return b=e.size,k=g.size,A=k,j=c,x=!t.alwaysKeepResolution&&v,(U=(function(B){for(;B;){if(B.then)return void B.then(U,r);try{if(B.pop){if(B.length)return B.pop()?S.call(this):B;B=E}else B=B.call(this)}catch(O){return r(O)}}}).bind(this))(E)}}catch(E){return r(E)}}).bind(this),r)}catch(R){return r(R)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(M){return r(M)}}).bind(this),r)}))}const Ah=`
|
|
203
|
-
let scriptImported = false
|
|
204
|
-
self.addEventListener('message', async (e) => {
|
|
205
|
-
const { file, id, imageCompressionLibUrl, options } = e.data
|
|
206
|
-
options.onProgress = (progress) => self.postMessage({ progress, id })
|
|
207
|
-
try {
|
|
208
|
-
if (!scriptImported) {
|
|
209
|
-
// console.log('[worker] importScripts', imageCompressionLibUrl)
|
|
210
|
-
self.importScripts(imageCompressionLibUrl)
|
|
211
|
-
scriptImported = true
|
|
212
|
-
}
|
|
213
|
-
// console.log('[worker] self', self)
|
|
214
|
-
const compressedFile = await imageCompression(file, options)
|
|
215
|
-
self.postMessage({ file: compressedFile, id })
|
|
216
|
-
} catch (e) {
|
|
217
|
-
// console.error('[worker] error', e)
|
|
218
|
-
self.postMessage({ error: e.message + '\\n' + e.stack, id })
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
`;let Cr;function jh(e,t){return new Promise(((n,o)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Ah));const r=new Worker(Cr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function Ae(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof kh))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,r).then((function(h){try{return s=h,d.call(this)}catch(g){return o(g)}}).bind(this),o);var l=(function(){try{return d.call(this)}catch(h){return o(h)}}).bind(this),c=function(h){try{return Ss(e,r).then((function(g){try{return s=g,l()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",jh(e,r).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=Bi(e,s))}catch{}return n(s)}}))}Ae.getDataUrlFromFile=Vi,Ae.getFilefromDataUrl=Ao,Ae.loadImage=Ki,Ae.drawImageInCanvas=Yi,Ae.drawFileInCanvas=Wn,Ae.canvasToFile=Gn,Ae.getExifOrientation=Xi,Ae.handleMaxWidthOrHeight=Qi,Ae.followExifOrientation=Zi,Ae.cleanupCanvasMemory=We,Ae.isAutoOrientationInBrowser=$t,Ae.approximateBelowMaximumCanvasSizeOfBrowser=qi,Ae.copyExifWithoutOrientation=Bi,Ae.getBrowserName=St,Ae.version="2.0.2";var Th=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Th.reduce((e,t)=>{const n=va(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Rh=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"}),Nh="VisuallyHidden",Ji=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Rh,...e.style}}));Ji.displayName=Nh;var Ih=Ji,[or]=nt("Tooltip",[Xt]),sr=Xt(),el="TooltipProvider",Mh=700,Vr="tooltip.open",[Ph,jo]=or(el),tl=e=>{const{__scopeTooltip:t,delayDuration:n=Mh,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Ph,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:s})};tl.displayName=el;var ln="Tooltip",[Oh,vn]=or(ln),nl=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,k]=ut({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),_=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,k(!0)},[k]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,k(!1)},[k]),w=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,k(!0),h.current=0},v)},[v,k]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx(Oh,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?w():_()},[m.isOpenDelayedRef,w,_]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:_,onClose:L,disableHoverableContent:g,children:n})})};nl.displayName=ln;var Kr="TooltipTrigger",rl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=Se(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:te(e.onBlur,r.onClose),onClick:te(e.onClick,r.onClose)})})});rl.displayName=Kr;var To="TooltipPortal",[Dh,Lh]=or(To,{forceMount:void 0}),ol=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=vn(To,t);return u.jsx(Dh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};ol.displayName=To;var Gt="TooltipContent",sl=p.forwardRef((e,t)=>{const n=Lh(Gt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:o||a.open,children:a.disableHoverableContent?u.jsx(al,{side:r,...s,ref:t}):u.jsx(Fh,{side:r,...s,ref:t})})}),Fh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),o=jo(Gt,e.__scopeTooltip),r=p.useRef(null),s=Se(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=o,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},k=Bh(b,C.getBoundingClientRect()),A=Hh(b,k),_=Wh(v.getBoundingClientRect()),L=Vh([...A,..._]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},k=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!Gh(b,a);k?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(al,{...e,ref:s})}),[$h,Uh]=or(ln,{isInside:!1}),zh=Od("TooltipContent"),al=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Gt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Vr,l),()=>document.removeEventListener(Vr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(zh,{children:o}),u.jsx($h,{scope:n,isInside:!0,children:u.jsx(Ih,{id:m.contentId,role:"tooltip",children:r||o})})]})})});sl.displayName=Gt;var il="TooltipArrow",ll=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=sr(n);return Uh(il,n).isInside?null:u.jsx(go,{...r,...o,ref:t})});ll.displayName=il;function Bh(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Hh(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function Wh(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Gh(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function Vh(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),Kh(t)}function Kh(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var qh=tl,Yh=nl,Xh=rl,Qh=ol,Zh=sl,Jh=ll;function eg({delayDuration:e=0,...t}){return u.jsx(qh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function tg({...e}){return u.jsx(eg,{children:u.jsx(Yh,{"data-slot":"tooltip",...e})})}function ng({...e}){return u.jsx(Xh,{"data-slot":"tooltip-trigger",...e})}function rg({className:e,sideOffset:t=0,children:n,...o}){return u.jsx(Qh,{children:u.jsxs(Zh,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...o,children:[n,u.jsx(Jh,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const og=p.lazy(()=>je(()=>import("./mermaid-VLURNSYL-Cu5A5sMk.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(og,{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",[sg]=nt(ar),[ag,No]=sg(ar),cl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:o,defaultProp:r??!1,onChange:a,caller:ar});return u.jsx(ag,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});cl.displayName=ar;var ul="CollapsibleTrigger",dl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=No(ul,n);return u.jsx(he.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Mo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});dl.displayName=ul;var Io="CollapsibleContent",fl=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||r.open,children:({present:s})=>u.jsx(ig,{...o,ref:t,present:s})})});fl.displayName=Io;var ig=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=No(Io,n),[i,m]=p.useState(o),f=p.useRef(null),l=Se(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const k=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(k)},[]),Ze(()=>{const k=f.current;if(k){b.current=b.current||{transitionDuration:k.style.transitionDuration,animationName:k.style.animationName},k.style.transitionDuration="0s",k.style.animationName="none";const A=k.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(k.style.transitionDuration=b.current.transitionDuration,k.style.animationName=b.current.animationName),m(o)}},[a.open,o]),u.jsx(he.div,{"data-state":Mo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function Mo(e){return e?"open":"closed"}var lg=cl;function cg({...e}){return u.jsx(lg,{"data-slot":"collapsible",...e})}function ug({...e}){return u.jsx(dl,{"data-slot":"collapsible-trigger",...e})}function dg({...e}){return u.jsx(fl,{"data-slot":"collapsible-content",...e})}const fg=({children:e,as:t="p",className:n,duration:o=2})=>{const r=mc.create(t);return u.jsx(r,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},mg=p.memo(fg),ml=p.createContext(null),pg=()=>{const e=p.useContext(ml);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},hg=1e3,gg=1e3,pl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:o,onChange:r}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/gg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!d){const k=setTimeout(()=>{f(!1),h(!0)},hg);return()=>clearTimeout(k)}},[t,m,o,f,d,C]);const b=k=>{f(k)};return u.jsx(ml.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(cg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),xg=(e,t)=>e||t===0?u.jsx(mg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),hl=p.memo(({className:e,children:t,getThinkingMessage:n=xg,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=pg();return u.jsx(ug,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??u.jsxs(u.Fragment,{children:[u.jsx(hu,{className:"size-4"}),n(r,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),gl=p.memo(({className:e,children:t,...n})=>u.jsx(dg,{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}));pl.displayName="Reasoning";hl.displayName="ReasoningTrigger";gl.displayName="ReasoningContent";const Sr=200;function vg({entry:e}){const[t,n]=p.useState(!1),[o,r]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(yg,{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(wg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${Sr}px]`),style:!t&&o?{maxHeight:`${Sr}px`}:void 0,children:su(e.content)}),!t&&o&&u.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:u.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function bg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return u.jsxs(pl,{isStreaming:s,children:[u.jsx(hl,{}),u.jsx(gl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},o)})]})]})}function yg({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 wg({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-4 w-4"});case"table":return u.jsx(ro,{className:"h-4 w-4"});case"directory":return u.jsx(no,{className:"h-4 w-4"});default:return u.jsx(Bt,{className:"h-4 w-4"})}})(),r=e.size!=null?Cg(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[o,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&u.jsx("span",{children:r}),r&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function Cg(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Sg(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function Eg(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 _g({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(fa,{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:Sg(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[Eg(s.kind),s.name]},s.optionId))})]})}const Es=1e3,kg=1e6;function Er({filePath:e,oldString:t,newString:n,label:o}){const r=jg(t,n),s=ks(r,"add"),a=ks(r,"remove"),i=r.length>Es?r.slice(0,Es):r,m=r.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),o&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:o})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Ag,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ag({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(`
|
|
222
|
-
`)}function ks(e,t){let n=0;for(const o of e)o.type===t&&n++;return n}function jg(e,t){const n=_s(e),o=_s(t);let r=0;for(;r<n.length&&r<o.length&&n[r]===o[r];)r++;let s=n.length,a=o.length;for(;s>r&&a>r&&n[s-1]===o[a-1];)s--,a--;const i=[];for(let m=0;m<r;m++)i.push({type:"context",text:n[m]});Tg(n.slice(r,s),o.slice(r,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Tg(e,t,n){const o=e.length,r=t.length;if(o===0&&r===0)return;if(o*r>kg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=r+1,a=new Uint32Array((o+1)*s);for(let f=o-1;f>=0;f--)for(let l=r-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<o&&m<r;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<o;)n.push({type:"remove",text:e[i]}),i++;for(;m<r;)n.push({type:"add",text:t[m]}),m++}function xl({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(As,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=Fg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(As,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function As({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Nn(e);return u.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(_g,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Dg(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:_t(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(In,{tool:e})]})})]})}const Rg=new Set(["FileEditTool","Edit","SedEdit"]),Ng=new Set(["FileWriteTool","Write"]),Ig=new Set(["MultiEdit"]),Mg=new Set(["BashTool","Bash","PowerShellTool"]),Pg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],Og=["output","stdout","stderr","result"];function Dg(e){const t=Ug(e.title),n=e.rawInput??{};if(Rg.has(t)){const o=He(n,["old_string","oldString"]),r=He(n,["new_string","newString"]);return o===void 0||r===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(Er,{filePath:He(n,["file_path","filePath"])??t,oldString:o,newString:r}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Ng.has(t)){const o=He(n,["file_path","filePath"]),r=He(n,["content"]);if(o===void 0||r===void 0)return null;const s=He(e.rawOutput??{},Pg);return u.jsxs(u.Fragment,{children:[u.jsx(Er,{filePath:o,oldString:s??"",newString:r,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Ig.has(t)){const o=n.edits;if(Array.isArray(o)&&o.length>0){const r=He(n,["file_path","filePath"])??t,s=[];for(let a=0;a<o.length;a++){const i=o[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=He(m,["old_string","oldString"]),l=He(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(Er,{filePath:r,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(In,{tool:e})]})}return null}if(Mg.has(t)){const o=He(n,["command","cmd","script"]),r=zg(e);return o===void 0&&r.length===0?null:u.jsx(Lg,{command:o!==void 0?_t(o,500):void 0,output:r,isError:e.status==="error"})}return null}function Lg({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 Fg(e){const t=new Map;for(const o of e){const r=$g(o.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[o,r]of t)n.push(r===1?o:`${r} 次${o}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function $g(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Ug(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function He(e,t){for(const n of t){const o=e[n];if(typeof o=="string")return o}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function vl(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 zg(e){const t=vl(e);if(t.length>0)return _t(t.join(`
|
|
223
|
-
`),2e3);const n=e.rawOutput;if(n){for(const o of Og){const r=n[o];if(typeof r=="string"&&r.length>0)return _t(r,2e3)}if(Object.keys(n).length>0)return _t(JSON.stringify(n,null,2),2e3)}return""}function In({tool:e}){return u.jsx("pre",{className:ee("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:Bg(e)})}function Bg(e){const t=vl(e);return t.length>0?_t(t.join(`
|
|
224
|
-
`),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?_t(JSON.stringify(e.rawOutput,null,2),2e3):""}function _t(e,t){return e.length>t?e.slice(0,t)+"...":e}function Hg({entry:e}){const[t,n]=p.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:ee("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,m)=>u.jsx(Wg,{entry:i},m))})]})})}function Wg({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(Gg,{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(Vg,{priority:e.priority})]})}function Gg({status:e}){switch(e){case"completed":return u.jsx(Cu,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ca,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(Eu,{className:"h-3.5 w-3.5 text-text-muted"})}}function Vg({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 Kg({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
|
|
225
|
-
* Copyright (c) StackBlitz. All rights reserved.
|
|
226
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
227
|
-
*--------------------------------------------------------------------------------------------*/const qg={damping:.7,stiffness:.05,mass:1.25},Yg=70,Xg=1e3/60,Qg=350;let ir=!1;var zs;(zs=globalThis.document)==null||zs.addEventListener("mousedown",()=>{ir=!0});var Bs;(Bs=globalThis.document)==null||Bs.addEventListener("mouseup",()=>{ir=!1});var Hs;(Hs=globalThis.document)==null||Hs.addEventListener("click",()=>{ir=!1});const Zg=(e={})=>{const[t,n]=p.useState(!1),[o,r]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var _;if(!ir)return!1;const k=window.getSelection();if(!k||!k.rangeCount)return!1;const A=k.getRangeAt(0);return A.commonAncestorContainer.contains(C.current)||((_=C.current)==null?void 0:_.contains(A.commonAncestorContainer))},[]),f=p.useCallback(k=>{c.isAtBottom=k,r(k)},[]),l=p.useCallback(k=>{c.escapedFromLock=k,n(k)},[]),c=p.useMemo(()=>{let k;return{escapedFromLock:t,isAtBottom:o,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){var A;return((A=C.current)==null?void 0:A.scrollTop)??0},set scrollTop(A){if(C.current){const{scrollBehavior:_}=getComputedStyle(C.current);_!=="auto"&&(C.current.style.scrollBehavior="auto"),C.current.scrollTop=A,c.ignoreScrollToTop=C.current.scrollTop,_!=="auto"&&(C.current.style.scrollBehavior=_)}},get targetScrollTop(){return!C.current||!b.current?0:C.current.scrollHeight-1-C.current.clientHeight},get calculatedTargetScrollTop(){if(!C.current||!b.current)return 0;const{targetScrollTop:A}=this;if(!e.targetScrollTop)return A;if((k==null?void 0:k.targetScrollTop)===A)return k.calculatedScrollTop;const _=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:C.current,contentElement:b.current}),A),0);return k={targetScrollTop:A,calculatedScrollTop:_},requestAnimationFrame(()=>{k=void 0}),_},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Yg}}},[]),d=p.useCallback((k={})=>{var y;typeof k=="string"&&(k={animation:k}),k.preserveScrollPosition||f(!0);const A=Date.now()+(Number(k.wait)||0),_=kr(i.current,k.animation),{ignoreEscapes:L=!1}=k;let w,j=c.calculatedTargetScrollTop;k.duration instanceof Promise?k.duration.finally(()=>{w=Date.now()}):w=A+(k.duration??0);const x=async()=>{const I=new Promise(requestAnimationFrame).then(()=>{var R;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:P}=c,M=performance.now(),F=(M-(c.lastTick??M))/Xg;if(c.animation||(c.animation={behavior:_,promise:I,ignoreEscapes:L}),c.animation.behavior===_&&(c.lastTick=M),m()||A>Date.now())return x();if(P<Math.min(j,c.calculatedTargetScrollTop)){if(((R=c.animation)==null?void 0:R.behavior)===_){if(_==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(_.damping*c.velocity+_.stiffness*c.scrollDifference)/_.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==P&&(c.accumulated=0)}return x()}return w>Date.now()?(j=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:kr(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,w-Date.now())||void 0}):c.isAtBottom)});return I.then(P=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),P))};return k.wait!==!0&&(c.animation=void 0),((y=c.animation)==null?void 0:y.behavior)===_?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:k})=>{if(k!==C.current)return;const{scrollTop:A,ignoreScrollToTop:_}=c;let{lastScrollTop:L=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,_&&_>A&&(L=_),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||A===_)return;if(m()){l(!0),f(!1);return}const w=A>L,j=A<L;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=L;return}j&&(l(!0),f(!1)),w&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:k,deltaY:A})=>{var L;let _=k;for(;!["scroll","auto"].includes(getComputedStyle(_).overflow);){if(!_.parentElement)return;_=_.parentElement}_===C.current&&A<0&&C.current.scrollHeight>C.current.clientHeight&&!((L=c.animation)!=null&&L.ignoreEscapes)&&(l(!0),f(!1))},[l,f,c]),C=js(k=>{var A,_;(A=C.current)==null||A.removeEventListener("scroll",g),(_=C.current)==null||_.removeEventListener("wheel",v),k==null||k.addEventListener("scroll",g,{passive:!0}),k==null||k.addEventListener("wheel",v,{passive:!0})},[]),b=js(k=>{var _,L;if((_=c.resizeObserver)==null||_.disconnect(),!k)return;let A;c.resizeObserver=new ResizeObserver(([w])=>{const{height:j}=w.contentRect,x=j-(A??j);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const y=kr(i.current,A?i.current.resize:i.current.initial);d({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:Qg})}else c.isNearBottom&&(l(!1),f(!0));A=j,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(L=c.resizeObserver)==null||L.observe(k)},[]);return{contentRef:b,scrollRef:C,scrollToBottom:d,stopScroll:h,isAtBottom:o||s,isNearBottom:s,escapedFromLock:t,state:c}};function js(e,t){const n=p.useCallback(o=>(n.current=o,e(o)),t);return n}const _r=new Map;function kr(...e){const t={...qg};let n=!1;for(const r of e){if(r==="instant"){n=!0;continue}typeof r=="object"&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}const o=JSON.stringify(t);return _r.has(o)||_r.set(o,Object.freeze(t)),n?"instant":_r.get(o)}/*!---------------------------------------------------------------------------------------------
|
|
228
|
-
* Copyright (c) StackBlitz. All rights reserved.
|
|
229
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
230
|
-
*--------------------------------------------------------------------------------------------*/const bl=p.createContext(null),Jg=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Vn({instance:e,children:t,resize:n,initial:o,mass:r,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((L,w)=>{const j=(_==null?void 0:_.targetScrollTop)??i;return(j==null?void 0:j(L,w))??L},[i]),d=Zg({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:C,isAtBottom:b,escapedFromLock:k,state:A}=e??d,_=p.useMemo(()=>({scrollToBottom:v,stopScroll:C,scrollRef:h,isAtBottom:b,escapedFromLock:k,contentRef:g,state:A,get targetScrollTop(){return l.current},set targetScrollTop(L){l.current=L}}),[v,b,g,h,C,k,A]);return p.useImperativeHandle(m,()=>_,[_]),Jg(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(bl.Provider,{value:_},p.createElement("div",{...f},typeof t=="function"?t(_):t))}(function(e){function t({children:n,scrollClassName:o,...r}){const s=Po();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:o},p.createElement("div",{...r,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Vn||(Vn={}));function Po(){const e=p.useContext(bl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const ex=({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}),tx=({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}),nx=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:o,children:r,...s})=>u.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:r??u.jsxs(u.Fragment,{children:[o&&u.jsx("div",{className:"text-text-muted",children:o}),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})]})]})}),rx=({className:e,...t})=>{const{scrollToBottom:n}=Po(),o=p.useCallback(()=>{n()},[n]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(mu,{className:"size-4"})})},ox="data-last-user-message",sx=({className:e,...t})=>{const n=p.useCallback(()=>{const o=document.querySelector(`[${ox}="true"]`);o&&o.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(pa,{className:"size-4"})})},ax=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:o}=Po();return o?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(sx,{}),u.jsx(rx,{})]})};function ix({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var m;const s=ux(e),a=e.length>0,i=t&&e.length>0&&((m=e[e.length-1])==null?void 0:m.type)==="user_message";return u.jsx(ex,{className:"flex-1",children:u.jsxs(tx,{children:[a?u.jsxs(u.Fragment,{children:[s.map((f,l)=>f.type==="single"?u.jsx("div",{className:ee(lx(e,l)),children:u.jsx(cx,{entry:f.entry,isLoading:t,onPermissionRespond:n})},`entry-${l}`):u.jsx("div",{className:"-mt-2",children:u.jsx(xl,{entries:f.entries,onPermissionRespond:n})},`group-${l}`)),i&&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(nx,{title:o,description:r}),u.jsx(ax,{hasUserMessages:e.some(f=>f.type==="user_message")})]})})}function lx(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 o=e[t+1];return(o==null?void 0:o.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 cx({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(vg,{entry:e});case"assistant_message":return u.jsx(bg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(xl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(Hg,{entry:e});case"command_output":return u.jsx(Kg,{entry:e});default:return null}}function ux(e){const t=[];let n=[];const o=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const r of e)r.type==="tool_call"?n.push(r):(o(),t.push({type:"single",entry:r}));return o(),t}function dx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function fx({commands:e,filter:t,onSelect:n,onClose:o,className:r}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>dx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&o()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[o]),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",r),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 Et(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 mx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},px=500*1024,yl=2*1024*1024,Ar=200,Ts=5*1024*1024,hx=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"]),gx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function wl(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return hx.has(t)}function qr(e){const t=cn(e.name);return gx.has(t)}function xx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:o=!1,placeholder:r="给 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,C]=p.useState(""),[b,k]=p.useState([]),[A,_]=p.useState([]),[L,w]=p.useState(!1),[j,x]=p.useState(""),[y,I]=p.useState(!1),[P,M]=p.useState(!1),[F,R]=p.useState(!1),[U,E]=p.useState(null),[S,B]=p.useState([]),[O,z]=p.useState(0),q=p.useRef(0),N=p.useRef(null),D=p.useRef(null),$=p.useRef(null),T=p.useRef(null),H=p.useRef(null),G=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{Et("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!P)return;const W=Y=>{var le,xe;const J=Y.target,ce=(le=G.current)==null?void 0:le.contains(J),Ce=(xe=K.current)==null?void 0:xe.contains(J);!ce&&!Ce&&M(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[P]);const V=p.useCallback(W=>{const Y=(W??v).trim(),J=b.length>0||A.length>0;!Y&&!J||o||F||(e({text:Y,images:b.length>0?b:void 0,attachments:A.length>0?A:void 0}),C(""),k([]),_([]),w(!1),x(""),N.current&&(N.current.style.height="auto"))},[v,b,A,o,F,e]),ne=p.useCallback(async W=>{if(!d)return;const Y=++q.current;try{const J=await d(W);q.current===Y&&B(J.slice(0,8))}catch{q.current===Y&&B([])}},[d]),Z=p.useCallback(W=>{const Y=N.current;if(!Y||U===null)return;const J=Y.selectionStart??v.length,ce=v.slice(0,J),Ce=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Ce)return;const le=J-Ce[1].length-1,xe=`@${W} `,Ye=v.slice(0,le)+xe+v.slice(J);C(Ye),E(null),B([]),requestAnimationFrame(()=>{const Mt=le+xe.length;Y.focus(),Y.setSelectionRange(Mt,Mt)})},[v,U]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(U!==null&&S.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),z(J=>{const ce=W.key==="ArrowDown"?1:-1;return(J+ce+S.length)%S.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const J=S[O];J&&Z(J);return}if(W.key==="Escape"){W.preventDefault(),E(null),B([]);return}}if(L){if(W.key==="Escape"){W.preventDefault(),w(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),w(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():V())},[V,t,f,m,n,L,U,S,O,Z]),ue=p.useCallback(W=>{const Y=W.target.value;if(C(Y),Y.startsWith("/")&&i&&i.length>0?(w(!0),x(Y.slice(1).split(/\s/)[0]||"")):L&&(w(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Ce=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Ce);if(le){const xe=le[1]||"";E(xe),z(0),ne(xe)}else E(null),B([])}const J=W.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,L,d,ne]),ve=p.useCallback(async W=>{if(Et("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(Et("[ChatInput] paste image files",{count:Y.length,types:Y.map(J=>J.type)}),Y.length!==0){W.preventDefault(),R(!0);try{const J=await jr(Y);k(ce=>[...ce,...J])}finally{R(!1)}}},[g]),de=p.useCallback(async()=>{if(!D.current)return;const W=D.current.files;if(!(!W||W.length===0)){R(!0);try{const Y=await jr(Array.from(W));k(J=>[...J,...Y])}finally{D.current.value="",R(!1)}}},[]),be=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){R(!0);try{const Y=await Rs(Array.from(W));_(J=>[...J,...Y])}finally{$.current.value="",R(!1)}}},[]),fe=p.useCallback(async()=>{if(!T.current)return;const W=T.current.files;if(!(!W||W.length===0)){R(!0);try{const Y=await Ns(Array.from(W));_(J=>[...J,...Y])}finally{T.current.value="",R(!1)}}},[]),ie=p.useCallback(async()=>{if(!H.current)return;const W=H.current.files;if(!(!W||W.length===0)){R(!0);try{const Y=await bx(Array.from(W));Y&&_(J=>[...J,Y])}finally{H.current.value="",R(!1)}}},[]),ge=p.useCallback(W=>{k(Y=>Y.filter((J,ce)=>ce!==W))},[]),ye=p.useCallback(W=>{_(Y=>Y.filter((J,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var J,ce;w(!1),x("");const Y=`/${W.name}`;(J=W.input)!=null&&J.hint?(C(`${Y} `),(ce=N.current)==null||ce.focus()):V(Y)},[V]),ke=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||I(!0))},[g,y]),we=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&I(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),I(!1),R(!0);try{const J=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Ce=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&wl(le));if(J.length>0){const le=await jr(J);k(xe=>[...xe,...le])}if(ce.length>0){const le=await Ns(ce);_(xe=>[...xe,...le])}if(Ce.length>0){const le=await Rs(Ce);_(xe=>[...xe,...le])}}finally{R(!1)}}},[g]),Te=p.useCallback(()=>{var W;L?(w(!1),x("")):(v.startsWith("/")||C("/"+v),w(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[L,v]),ze=b.length+A.length,xt=(v.trim()||ze>0)&&!o&&!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:[L&&i&&i.length>0&&u.jsx(fx,{commands:i,filter:j,onSelect:me,onClose:()=>{w(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),U!==null&&S.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:["文件匹配 ",U?`“@${U}”`:""," — ↑↓ 选择,Enter 插入"]}),S.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:J=>{J.preventDefault(),Z(W)},onMouseEnter:()=>z(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===O?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Bt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),P&&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;M(!1),(W=D.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(Ru,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;M(!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(Bt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;M(!1),(W=T.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;M(!1),(W=H.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:ke,onDragLeave:we,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:()=>ge(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))}),A.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:A.map((W,Y)=>u.jsx(vx,{attachment:W,onRemove:()=>ye(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:()=>M(W=>!W),disabled:o||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",P?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Vu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref:D,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:be}),u.jsx("input",{ref:T,type:"file",accept:".csv,.tsv,.xlsx,.xls",multiple:!0,className:"hidden",onChange:fe}),u.jsx("input",{ref:H,type:"file",webkitdirectory:"",directory:"",multiple:!0,className:"hidden",onChange:ie})]}),i&&i.length>0&&u.jsx("button",{type:"button",onClick:Te,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-colors",L?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),disabled:o,title:"命令列表",children:u.jsx(ad,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:ve,placeholder:F?"处理文件中…":r,disabled:o,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(ld,{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(Ju,{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(ku,{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 vx({attachment:e,onRemove:t}){const n=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{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(Bt,{className:"h-3.5 w-3.5"})}})(),o=e.size!=null?zt(e.size):null,r=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}),o&&u.jsx("span",{className:"text-text-muted text-[10px]",children:o}),r!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[r," 文件"]}),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 jr(e){const t=[];for(const n of e)try{let o=n,r=n.type;n.size>2*1024*1024&&(o=await Ae(n,mx),r="image/jpeg");const s=await yx(o);t.push({mimeType:r,data:s})}catch(o){console.error("Failed to process image:",o)}return t}async function Rs(e){const t=[];for(const n of e)try{if(n.size>yl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>px&&console.warn(`File ${n.name} is large (${zt(n.size)}), may slow down`);const o=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/plain"})}catch(o){console.error(`Failed to read text file ${n.name}:`,o)}return t}async function Ns(e){const t=[];for(const n of e)try{const o=cn(n.name);if(o===".csv"||o===".tsv"){const r=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/csv"})}else if(o===".xlsx"||o===".xls"){const r=await n.arrayBuffer(),s=await Cl(r);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(o){console.error(`Failed to process table file ${n.name}:`,o)}return t}async function Cl(e){const t=await je(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),o=[];for(const r of n.SheetNames){const s=n.Sheets[r];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?o.push(`## Sheet: ${r}
|
|
231
|
-
|
|
232
|
-
${a}`):o.push(a)}return o.join(`
|
|
233
|
-
|
|
234
|
-
`)}async function bx(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>yl));t.length>Ar&&console.warn(`Directory has ${t.length} files, truncating to ${Ar}`);const n=t.slice(0,Ar);let o=0;for(const d of n)o+=d.size;o>Ts&&console.warn(`Directory total size ${zt(o)} exceeds limit, some files may be truncated`);const r=n[0].webkitRelativePath,s=r&&r.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),wl(d)||qr(d))if(m+d.size<=Ts)try{let g;if(cn(d.name)===".xlsx"||cn(d.name)===".xls"){const v=await d.arrayBuffer();g=await Cl(v)}else g=await d.text();i.push(`
|
|
235
|
-
### ${h}
|
|
236
|
-
\`\`\`
|
|
237
|
-
${g}
|
|
238
|
-
\`\`\``),m+=d.size}catch{i.push(`
|
|
239
|
-
### ${h}
|
|
240
|
-
(读取失败)`)}else i.push(`
|
|
241
|
-
### ${h}
|
|
242
|
-
(文件过大,已跳过)`);else d.type.startsWith("image/")?i.push(`
|
|
243
|
-
### ${h}
|
|
244
|
-
(图片文件,${zt(d.size)})`):i.push(`
|
|
245
|
-
### ${h}
|
|
246
|
-
(二进制文件,${zt(d.size)})`)}const l=a.join(`
|
|
247
|
-
`),c=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",l,"```","","## 文件内容",...i].join(`
|
|
248
|
-
`);return{kind:"directory",name:s,size:o,textContent:c,files:a}}async function yx(e){return new Promise((t,n)=>{const o=new FileReader;o.onloadend=()=>{const r=o.result,s=r.indexOf(",");t(s>=0?r.slice(s+1):r)},o.onerror=()=>n(new Error("FileReader error")),o.readAsDataURL(e)})}function wx({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(o=>u.jsx(Cx,{request:o,onRespond:t},o.requestId))})})}function Cx({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(fa,{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 Sx({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",[Sl]=nt(lr,[Xt]),bn=Xt(),[Ex,gt]=Sl(lr),El=e=>{const{__scopePopover:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!1}=e,i=bn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=ut({prop:o,defaultProp:r??!1,onChange:s,caller:lr});return u.jsx(po,{...i,children:u.jsx(Ex,{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})})};El.displayName=lr;var _l="PopoverAnchor",_x=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(_l,n),s=bn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=r;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(Jn,{...s,...o,ref:t})});_x.displayName=_l;var kl="PopoverTrigger",Al=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(kl,n),s=bn(n),a=Se(t,r.triggerRef),i=u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Il(r.open),...o,ref:a,onClick:te(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:u.jsx(Jn,{asChild:!0,...s,children:i})});Al.displayName=kl;var Oo="PopoverPortal",[kx,Ax]=Sl(Oo,{forceMount:void 0}),jl=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=gt(Oo,t);return u.jsx(kx,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};jl.displayName=Oo;var Vt="PopoverContent",Tl=p.forwardRef((e,t)=>{const n=Ax(Vt,e.__scopePopover),{forceMount:o=n.forceMount,...r}=e,s=gt(Vt,e.__scopePopover);return u.jsx(Oe,{present:o||s.open,children:s.modal?u.jsx(Tx,{...r,ref:t}):u.jsx(Rx,{...r,ref:t})})});Tl.displayName=Vt;var jx=Ht("PopoverContent.RemoveScroll"),Tx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),o=p.useRef(null),r=Se(t,o),s=p.useRef(!1);return p.useEffect(()=>{const a=o.current;if(a)return xo(a)},[]),u.jsx(Jr,{as:jx,allowPinchZoom:!0,children:u.jsx(Rl,{...e,ref:r,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})})})}),Rx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),o=p.useRef(!1),r=p.useRef(!1);return u.jsx(Rl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Rl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:o,onOpenAutoFocus:r,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:o,onMountAutoFocus:r,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":Il(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)"}})})})}),Nl="PopoverClose",Nx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(Nl,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Nx.displayName=Nl;var Ix="PopoverArrow",Mx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=bn(n);return u.jsx(go,{...r,...o,ref:t})});Mx.displayName=Ix;function Il(e){return e?"open":"closed"}var Px=El,Ox=Al,Dx=jl,Lx=Tl;function Ml({...e}){return u.jsx(Px,{"data-slot":"popover",...e})}function Pl({...e}){return u.jsx(Ox,{"data-slot":"popover-trigger",...e})}function Ol({className:e,align:t="center",sideOffset:n=4,...o}){return u.jsx(Dx,{children:u.jsx(Lx,{"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),...o})})}var Os=1,Fx=.9,$x=.8,Ux=.17,Tr=.1,Rr=.999,zx=.9999,Bx=.99,Hx=/[\\\/_+.#"@\[\(\{&]/,Wx=/[\\\/_+.#"@\[\(\{&]/g,Gx=/[\s-]/,Dl=/[\s-]/g;function Yr(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?Os:Bx;var i=`${r},${s}`;if(a[i]!==void 0)return a[i];for(var m=o.charAt(s),f=n.indexOf(m,r),l=0,c,d,h,g;f>=0;)c=Yr(e,t,n,o,f+1,s+1,a),c>l&&(f===r?c*=Os:Hx.test(e.charAt(f-1))?(c*=$x,h=e.slice(r,f-1).match(Wx),h&&r>0&&(c*=Math.pow(Rr,h.length))):Gx.test(e.charAt(f-1))?(c*=Fx,g=e.slice(r,f-1).match(Dl),g&&r>0&&(c*=Math.pow(Rr,g.length))):(c*=Ux,r>0&&(c*=Math.pow(Rr,f-r))),e.charAt(f)!==t.charAt(s)&&(c*=zx)),(c<Tr&&n.charAt(f-1)===o.charAt(s+1)||o.charAt(s+1)===o.charAt(s)&&n.charAt(f-1)!==o.charAt(s))&&(d=Yr(e,t,n,o,f+1,s+2,a),d*Tr>c&&(c=d*Tr)),c>l&&(l=c),f=n.indexOf(m,f+1);return a[i]=l,l}function Ds(e){return e.toLowerCase().replace(Dl," ")}function Vx(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",[Ll]=nt(cr),[Kx,Ue]=Ll(cr),Fl=e=>{const{__scopeDialog:t,children:n,open:o,defaultOpen:r,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ut({prop:o,defaultProp:r??!1,onChange:s,caller:cr});return u.jsx(Kx,{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})};Fl.displayName=cr;var $l="DialogTrigger",qx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Ue($l,n),s=Se(t,r.triggerRef);return u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Fo(r.open),...o,ref:s,onClick:te(e.onClick,r.onOpenToggle)})});qx.displayName=$l;var Do="DialogPortal",[Yx,Ul]=Ll(Do,{forceMount:void 0}),zl=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=Ue(Do,t);return u.jsx(Yx,{scope:t,forceMount:n,children:p.Children.map(o,a=>u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:a})}))})};zl.displayName=Do;var Kn="DialogOverlay",Bl=p.forwardRef((e,t)=>{const n=Ul(Kn,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Ue(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:o||s.open,children:u.jsx(Qx,{...r,ref:t})}):null});Bl.displayName=Kn;var Xx=Ht("DialogOverlay.RemoveScroll"),Qx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Ue(Kn,n);return u.jsx(Jr,{as:Xx,allowPinchZoom:!0,shards:[r.contentRef],children:u.jsx(he.div,{"data-state":Fo(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),At="DialogContent",Hl=p.forwardRef((e,t)=>{const n=Ul(At,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=Ue(At,e.__scopeDialog);return u.jsx(Oe,{present:o||s.open,children:s.modal?u.jsx(Zx,{...r,ref:t}):u.jsx(Jx,{...r,ref:t})})});Hl.displayName=At;var Zx=p.forwardRef((e,t)=>{const n=Ue(At,e.__scopeDialog),o=p.useRef(null),r=Se(t,n.contentRef,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(Wl,{...e,ref:r,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())})}),Jx=p.forwardRef((e,t)=>{const n=Ue(At,e.__scopeDialog),o=p.useRef(!1),r=p.useRef(!1);return u.jsx(Wl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(o.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Wl=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=Ue(At,n),m=p.useRef(null),f=Se(t,m);return oo(),u.jsxs(u.Fragment,{children:[u.jsx(qn,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,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(tv,{titleId:i.titleId}),u.jsx(rv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Lo="DialogTitle",Gl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Ue(Lo,n);return u.jsx(he.h2,{id:r.titleId,...o,ref:t})});Gl.displayName=Lo;var Vl="DialogDescription",ev=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Ue(Vl,n);return u.jsx(he.p,{id:r.descriptionId,...o,ref:t})});ev.displayName=Vl;var Kl="DialogClose",ql=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=Ue(Kl,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});ql.displayName=Kl;function Fo(e){return e?"open":"closed"}var Yl="DialogTitleWarning",[Kb,Xl]=Td(Yl,{contentName:At,titleName:Lo,docsSlug:"dialog"}),tv=({titleId:e})=>{const t=Xl(Yl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
249
|
-
|
|
250
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
251
|
-
|
|
252
|
-
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},nv="DialogDescriptionWarning",rv=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xl(nv).contentName}}.`;return p.useEffect(()=>{var s;const r=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},ov=Fl,sv=zl,av=Bl,iv=Hl,qb=Gl,Yb=ql,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',lv='[cmdk-group-heading=""]',Ql='[cmdk-item=""]',Ls=`${Ql}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",cv=(e,t,n)=>Vx(e,t,n),Zl=p.createContext(void 0),yn=()=>p.useContext(Zl),Jl=p.createContext(void 0),$o=()=>p.useContext(Jl),ec=p.createContext(void 0),tc=p.forwardRef((e,t)=>{let n=Ft(()=>{var N,D;return{search:"",value:(D=(N=e.value)!=null?N:e.defaultValue)!=null?D:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),o=Ft(()=>new Set),r=Ft(()=>new Map),s=Ft(()=>new Map),a=Ft(()=>new Set),i=nc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:C=!0,...b}=e,k=Re(),A=Re(),_=Re(),L=p.useRef(null),w=yv();jt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,j.emit()}},[l]),jt(()=>{w(6,F)},[]);let j=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,D,$)=>{var T,H,G,K;if(!Object.is(n.current[N],D)){if(n.current[N]=D,N==="search")M(),I(),w(1,P);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(_);V?V.focus():(T=document.getElementById(k))==null||T.focus()}if(w(7,()=>{var V;n.current.selectedItemId=(V=R())==null?void 0:V.id,j.emit()}),$||w(5,F),((H=i.current)==null?void 0:H.value)!==void 0){let V=D??"";(K=(G=i.current).onValueChange)==null||K.call(G,V);return}}j.emit()}},emit:()=>{a.current.forEach(N=>N())}}),[]),x=p.useMemo(()=>({value:(N,D,$)=>{var T;D!==((T=s.current.get(N))==null?void 0:T.value)&&(s.current.set(N,{value:D,keywords:$}),n.current.filtered.items.set(N,y(D,$)),w(2,()=>{I(),j.emit()}))},item:(N,D)=>(o.current.add(N),D&&(r.current.has(D)?r.current.get(D).add(N):r.current.set(D,new Set([N]))),w(3,()=>{M(),I(),n.current.value||P(),j.emit()}),()=>{s.current.delete(N),o.current.delete(N),n.current.filtered.items.delete(N);let $=R();w(4,()=>{M(),($==null?void 0:$.getAttribute("id"))===N&&P(),j.emit()})}),group:N=>(r.current.has(N)||r.current.set(N,new Set),()=>{s.current.delete(N),r.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:k,inputId:_,labelId:A,listInnerRef:L}),[]);function y(N,D){var $,T;let H=(T=($=i.current)==null?void 0:$.filter)!=null?T:cv;return N?H(N,n.current.search,D):0}function I(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,D=[];n.current.filtered.groups.forEach(T=>{let H=r.current.get(T),G=0;H.forEach(K=>{let V=N.get(K);G=Math.max(V,G)}),D.push([T,G])});let $=L.current;U().sort((T,H)=>{var G,K;let V=T.getAttribute("id"),ne=H.getAttribute("id");return((G=N.get(ne))!=null?G:0)-((K=N.get(V))!=null?K:0)}).forEach(T=>{let H=T.closest(Nr);H?H.appendChild(T.parentElement===H?T:T.closest(`${Nr} > *`)):$.appendChild(T.parentElement===$?T:T.closest(`${Nr} > *`))}),D.sort((T,H)=>H[1]-T[1]).forEach(T=>{var H;let G=(H=L.current)==null?void 0:H.querySelector(`${nn}[${Lt}="${encodeURIComponent(T[0])}"]`);G==null||G.parentElement.appendChild(G)})}function P(){let N=U().find($=>$.getAttribute("aria-disabled")!=="true"),D=N==null?void 0:N.getAttribute(Lt);j.setState("value",D||void 0)}function M(){var N,D,$,T;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=o.current.size;return}n.current.filtered.groups=new Set;let H=0;for(let G of o.current){let K=(D=(N=s.current.get(G))==null?void 0:N.value)!=null?D:"",V=(T=($=s.current.get(G))==null?void 0:$.keywords)!=null?T:[],ne=y(K,V);n.current.filtered.items.set(G,ne),ne>0&&H++}for(let[G,K]of r.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=H}function F(){var N,D,$;let T=R();T&&(((N=T.parentElement)==null?void 0:N.firstChild)===T&&(($=(D=T.closest(nn))==null?void 0:D.querySelector(lv))==null||$.scrollIntoView({block:"nearest"})),T.scrollIntoView({block:"nearest"}))}function R(){var N;return(N=L.current)==null?void 0:N.querySelector(`${Ql}[aria-selected="true"]`)}function U(){var N;return Array.from(((N=L.current)==null?void 0:N.querySelectorAll(Ls))||[])}function E(N){let D=U()[N];D&&j.setState("value",D.getAttribute(Lt))}function S(N){var D;let $=R(),T=U(),H=T.findIndex(K=>K===$),G=T[H+N];(D=i.current)!=null&&D.loop&&(G=H+N<0?T[T.length-1]:H+N===T.length?T[0]:T[H+N]),G&&j.setState("value",G.getAttribute(Lt))}function B(N){let D=R(),$=D==null?void 0:D.closest(nn),T;for(;$&&!T;)$=N>0?vv($,nn):bv($,nn),T=$==null?void 0:$.querySelector(Ls);T?j.setState("value",T.getAttribute(Lt)):S(N)}let O=()=>E(U().length-1),z=N=>{N.preventDefault(),N.metaKey?O():N.altKey?B(1):S(1)},q=N=>{N.preventDefault(),N.metaKey?E(0):N.altKey?B(-1):S(-1)};return p.createElement(ht.div,{ref:t,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:N=>{var D;(D=b.onKeyDown)==null||D.call(b,N);let $=N.nativeEvent.isComposing||N.keyCode===229;if(!(N.defaultPrevented||$))switch(N.key){case"n":case"j":{C&&N.ctrlKey&&z(N);break}case"ArrowDown":{z(N);break}case"p":case"k":{C&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),E(0);break}case"End":{N.preventDefault(),O();break}case"Enter":{N.preventDefault();let T=R();if(T){let H=new Event(Xr);T.dispatchEvent(H)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:Cv},m),ur(e,N=>p.createElement(Jl.Provider,{value:j},p.createElement(Zl.Provider,{value:x},N))))}),uv=p.forwardRef((e,t)=>{var n,o;let r=Re(),s=p.useRef(null),a=p.useContext(ec),i=yn(),m=nc(e),f=(o=(n=m.current)==null?void 0:n.forceMount)!=null?o:a==null?void 0:a.forceMount;jt(()=>{if(!f)return i.item(r,a==null?void 0:a.id)},[f]);let l=rc(r,s,[e.value,e.children,s],e.keywords),c=$o(),d=mt(w=>w.value&&w.value===l.current),h=mt(w=>f||i.filter()===!1?!0:w.search?w.filtered.items.get(r)>0:!0);p.useEffect(()=>{let w=s.current;if(!(!w||e.disabled))return w.addEventListener(Xr,g),()=>w.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var w,j;v(),(j=(w=m.current).onSelect)==null||j.call(w,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:C,value:b,onSelect:k,forceMount:A,keywords:_,...L}=e;return p.createElement(ht.div,{ref:Ke(s,t),...L,id:r,"cmdk-item":"",role:"option","aria-disabled":!!C,"aria-selected":!!d,"data-disabled":!!C,"data-selected":!!d,onPointerMove:C||i.getDisablePointerSelection()?void 0:v,onClick:C?void 0:g},e.children)}),dv=p.forwardRef((e,t)=>{let{heading:n,children:o,forceMount:r,...s}=e,a=Re(),i=p.useRef(null),m=p.useRef(null),f=Re(),l=yn(),c=mt(h=>r||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);jt(()=>l.group(a),[]),rc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(ht.div,{ref:Ke(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(ec.Provider,{value:d},h))))}),fv=p.forwardRef((e,t)=>{let{alwaysRender:n,...o}=e,r=p.useRef(null),s=mt(a=>!a.search);return!n&&!s?null:p.createElement(ht.div,{ref:Ke(r,t),...o,"cmdk-separator":"",role:"separator"})}),mv=p.forwardRef((e,t)=>{let{onValueChange:n,...o}=e,r=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,...o,"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:r?e.value:a,onChange:f=>{r||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),pv=p.forwardRef((e,t)=>{let{children:n,label:o="Suggestions",...r}=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:Ke(s,t),...r,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":o,id:m.listId},ur(e,f=>p.createElement("div",{ref:Ke(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),hv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return p.createElement(ov,{open:n,onOpenChange:o},p.createElement(sv,{container:a},p.createElement(av,{"cmdk-overlay":"",className:r}),p.createElement(iv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(tc,{ref:t,...i}))))}),gv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),xv=p.forwardRef((e,t)=>{let{progress:n,children:o,label:r="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":r},ur(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Qt=Object.assign(tc,{List:pv,Item:uv,Input:mv,Group:dv,Separator:fv,Dialog:hv,Empty:gv,Loading:xv});function vv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function bv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function nc(e){let t=p.useRef(e);return jt(()=>{t.current=e}),t}var jt=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 rc(e,t,n,o=[]){let r=p.useRef(),s=yn();return jt(()=>{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():r.current}})(),m=o.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Lt,i),r.current=i}),r}var yv=()=>{let[e,t]=p.useState(),n=Ft(()=>new Map);return jt(()=>{n.current.forEach(o=>o()),n.current=new Map},[e]),(o,r)=>{n.current.set(o,r),t({})}};function wv(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(wv(t),{ref:t.ref},n(t.props.children)):n(t)}var Cv={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Sv({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 Ev({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(Qu,{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 _v({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 kv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Av({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 jv({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(),o=t.toLowerCase();let r=0;for(let s=0;s<o.length&&r<n.length;s++)o[s]===n[r]&&r++;return r===n.length}function Tv({models:e,currentModelId:t,onSelect:n,showSearch:o=!0,isMobile:r=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(r?"__none__":void 0),f=p.useMemo(()=>s?e.filter(l=>Fs(s,l.name)||Fs(s,l.modelId)):e,[e,s]);return u.jsxs(Sv,{shouldFilter:!1,value:i,onValueChange:m,children:[o&&u.jsx(Ev,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(_v,{children:[u.jsx(kv,{children:"No models found."}),u.jsx(Av,{children:f.map(l=>u.jsxs(jv,{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 oc(e){const[t,n]=p.useState(e.modelState),[o,r]=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),r(!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");r(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw r(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:o}}function Rv({client:e,onModelSelect:t}){const[n,o]=p.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:m}=oc(e),f=r&&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),o(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Ml,{open:n,onOpenChange:f?o:void 0,children:[u.jsx(Pl,{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(ca,{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(la,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Ol,{className:"w-72 p-0",align:"end",children:u.jsx(Tv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function Nv(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const r=s=>{n(s)};return e.setAvailableCommandsChangedHandler(r),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const o=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:o}}function sc(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 Iv(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 sc(e)}function Mv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!sc(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const o of n)try{const r=await o.getType("text/plain");await t.writeText(await r.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 Pv=new Set(["clear","new","help","status","model","copy"]),ac=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"}],Ov=ac.map(e=>({name:e.name,description:e.desc})),Xb=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...Ov];function Dv(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 Lv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Fv(e){var o;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 r of n)t.push(`- \`/${r.name}\` — ${r.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const r of ac)t.push(`- \`/${r.name}\` — ${r.desc}`);if(e.length>0)for(const r of e){const s=(o=r.input)!=null&&o.hint?` ${r.input.hint}`:"";t.push(`- \`/${r.name}${s}\` — ${r.description}`)}return t.join(`
|
|
253
|
-
`)}function $v(e){var n,o,r;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((o=e.currentModel)==null?void 0:o.modelId)??"未设置"}`),(r=e.currentModel)!=null&&r.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
|
|
254
|
-
`)}function Uv(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const o of e){const r=o.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${o.modelId}\` — ${o.name}${r}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
|
|
255
|
-
`)}async function zv(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...o]=e.slice(1).split(/\s+/),r=o.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!Pv.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=Fv(t.availableCommands);else if(s==="status")a=$v({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(r)try{await t.setModel(r),a=`已请求切换到模型: \`${r}\``}catch(d){a=`切换模型失败: ${d instanceof Error?d.message:String(d)}`,i=!0}else a=Uv(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(`
|
|
256
|
-
`))??"";(h?await Iv(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:Dv(s),subtitle:Lv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Bv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Hv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),o=e.slice(t+1),r=n.match(/^data:([^;,]+)/),s=r?r[1]:"application/octet-stream",a=atob(o),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 Wv({mode:e,onModeChange:t}){const[n,o]=p.useState(!1),r=Ir.find(s=>s.value===e)??Ir[0];return u.jsxs(Ml,{open:n,onOpenChange:o,children:[u.jsx(Pl,{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(od,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?u.jsx(la,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Ol,{className:"w-64 p-1",align:"start",children:Ir.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),o(!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 o=e[n];if(o&&o.type==="tool_call"&&o.toolCall.id===t)return n}return-1}function Gv({client:e,agentId:t}){const[n,o]=p.useState([]),[r,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,C]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,k]=p.useState(e.usage),[A,_]=p.useState(e.currentModeId),[L,w]=p.useState(!1),{commands:j}=Nv(e),{availableModels:x,currentModel:y,setModel:I}=oc(e);p.useEffect(()=>{l.current=m},[m]);const P=p.useCallback(()=>{o([]),s(!1),i(!1),k(null),_(null)},[]),M=t?`acp_last_session_${t}`:null,F=p.useCallback((N,D)=>{if(((D==null?void 0:D.resetEntries)??!0)&&(o([]),s(!1)),f(N),i(!0),w(e.supportsImages),M)try{localStorage.setItem(M,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,M]),R=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),o(D=>{const $=Mr(D,N.toolCall.toolCallId);if($>=0)return D.map((T,H)=>H!==$||T.type!=="tool_call"||T.toolCall.status!=="running"?T:{type:"tool_call",toolCall:{...T.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const T={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[...D,T]}}))},[]),U=p.useCallback((N,D)=>{if(!(l.current&&N!==l.current))if(D.sessionUpdate==="agent_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(T=>{const H=T[T.length-1];if((H==null?void 0:H.type)==="assistant_message"){const K=H.chunks[H.chunks.length-1];return(K==null?void 0:K.type)==="message"?[...T.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...T.slice(0,-1),{...H,chunks:[...H.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...T,G]})}else if(D.sessionUpdate==="agent_thought_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(T=>{const H=T[T.length-1];if((H==null?void 0:H.type)==="assistant_message"){const K=H.chunks[H.chunks.length-1];return(K==null?void 0:K.type)==="thought"?[...T.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...T.slice(0,-1),{...H,chunks:[...H.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...T,G]})}else if(D.sessionUpdate==="user_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(T=>{const H=T[T.length-1];if((H==null?void 0:H.type)==="user_message")return[...T.slice(0,-1),{...H,content:H.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...T,G]})}else if(D.sessionUpdate==="tool_call"){const $={id:D.toolCallId,title:D.title,status:$s(D.status),content:D.content,rawInput:D.rawInput,rawOutput:D.rawOutput};o(T=>{const H=Mr(T,D.toolCallId);if(H>=0)return T.map((K,V)=>V!==H||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...T,G]})}else D.sessionUpdate==="tool_call_update"?o($=>{const T=Mr($,D.toolCallId);if(T<0){console.warn(`[ChatInterface] Tool call not found for update: ${D.toolCallId}`);const H={type:"tool_call",toolCall:{id:D.toolCallId,title:D.title||"Tool call not found",status:"error",content:[{type:"content",content:{type:"text",text:"Tool call not found"}}]}};return[...$,H]}return $.map((H,G)=>{if(G!==T||H.type!=="tool_call")return H;const K=D.status?$s(D.status):H.toolCall.status,V=D.content?[...H.toolCall.content||[],...D.content]:H.toolCall.content;return{type:"tool_call",toolCall:{...H.toolCall,status:K,...D.title&&{title:D.title},content:V,...D.rawInput&&{rawInput:D.rawInput},...D.rawOutput&&{rawOutput:D.rawOutput}}}})}):D.sessionUpdate==="plan"?o($=>{if(D.entries.length===0)return $.filter(G=>G.type!=="plan");const T=$.reduce((G,K,V)=>K.type==="plan"?V:G,-1);if(T>=0)return $.map((G,K)=>K===T?{...G,entries:D.entries}:G);const H={type:"plan",id:`plan-${Date.now()}`,entries:D.entries};return[...$,H]}):D.sessionUpdate==="usage_update"?k(D):D.sessionUpdate==="current_mode_update"&&_(D.currentModeId)},[]);p.useEffect(()=>{e.setSessionCreatedHandler(D=>{console.log("[ChatInterface] Session created:",D),F(D)}),e.setSessionLoadedHandler(D=>{console.log("[ChatInterface] Session loaded/resumed:",D),F(D,{resetEntries:!1})}),e.setSessionSwitchingHandler(D=>{console.log("[ChatInterface] Switching to session:",D),f(D),P()}),e.setSessionUpdateHandler((D,$)=>{U(D,$)}),e.setPromptCompleteHandler(D=>{console.log("[ChatInterface] Prompt complete:",D),s(!1)}),e.setPermissionRequestHandler(R),e.setErrorMessageHandler(D=>{console.error("[ChatInterface] Agent error:",D),h(D),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=M?localStorage.getItem(M):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,R,U,P]);const E=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),P(),f(null),e.createSession(void 0,v)},[e,r,P,v]),S=()=>{console.log("[ChatInterface] Cancel requested"),o(N=>N.map(D=>D.type!=="tool_call"||!(D.toolCall.status==="running"||D.toolCall.status==="waiting_for_confirmation")?D:(console.log("[ChatInterface] Marking tool call as canceled:",D.toolCall.id),{type:"tool_call",toolCall:{...D.toolCall,status:"canceled",permissionRequest:void 0}}))),e.cancel()},B=p.useCallback((N,D,$)=>{console.log("[ChatInterface] Permission response:",{requestId:N,optionId:D,optionKind:$}),e.respondToPermission(N,D);const T=$==="reject_once"||$==="reject_always"||D===null;o(H=>H.map(G=>{var V;if(G.type!=="tool_call"||((V=G.toolCall.permissionRequest)==null?void 0:V.requestId)!==N)return G;let K;return T?K="rejected":G.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...G.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),O=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})),z=p.useCallback((N,D)=>{const $=O.find(G=>G.requestId===N);let T=null,H=null;if($!=null&&$.options&&$.options.length>0)if(D){const G=$.options.find(K=>K.kind==="allow_once")??$.options.find(K=>K.kind==="allow_always");G&&(T=G.optionId,H=G.kind)}else{const G=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");G&&(T=G.optionId,H=G.kind)}T||(H=D?"allow_once":"reject_once"),B(N,T,H)},[B,O]),q=p.useCallback(async N=>{var ne;const D=N.text.trim(),$=N.images||[],T=N.attachments||[];if(!D&&$.length===0&&T.length===0||!a)return;if(D.startsWith("/")&&$.length===0){Et("[ChatInterface] slash command input",{text:D});const Z=await zv(D,{sessionId:m,availableCommands:j,availableModels:x,currentModel:y,supportsImages:L,entries:c.current,setModel:I,onNewSession:E}).catch(()=>null);if(Z){if(Et("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){o([]);return}if("newSession"in Z&&Z.newSession){E();return}if("userEntry"in Z){o(re=>[...re,Z.userEntry,Z.cmdEntry]);return}}Et("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:D})}Et("[ChatInterface] forwarding to agent",{text:D,hasImages:$.length>0,sessionReady:a,isLoading:r});const H=[];D&&H.push({type:"text",text:D});const G=[];for(const Z of $)try{const re=`data:${Z.mimeType};base64,${Z.data}`;let ue;re.startsWith("data:")?ue=Hv(re):ue=await(await fetch(re)).blob();let ve=ue,de=Z.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});ve=await Ae(ie,Bv),de="image/jpeg"}const be=await new Promise((ie,ge)=>{const ye=new FileReader;ye.onloadend=()=>{const me=ye.result,ke=me.indexOf(",");ie(ke>=0?me.slice(ke+1):me)},ye.onerror=()=>{var me;return ge(new Error("FileReader error: "+((me=ye.error)==null?void 0:me.message)))},ye.readAsDataURL(ve)}),fe={type:"image",mimeType:de,data:be};H.push(fe),G.push({mimeType:de,data:be})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const Z of T)try{if(Z.textContent){let re;if(Z.kind==="directory"){const ue=((ne=Z.files)==null?void 0:ne.length)??0;re=`📁 目录: ${Z.name} (${ue} 个文件)
|
|
257
|
-
${Z.textContent}`}else{const ue=Z.size!=null?` (${Vv(Z.size)})`:"";re=`📎 ${Z.name}${ue}
|
|
258
|
-
\`\`\`
|
|
259
|
-
${Z.textContent}
|
|
260
|
-
\`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:D,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};o(Z=>[...Z,V]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[r,a,e,j,x,y,L,m,I,E]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(ix,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(wx,{requests:O,onRespond:z}),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(Wv,{mode:A??v,onModeChange:N=>{_(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Rv,{client:e}),u.jsx(Sx,{usage:b})]}),n.length>0&&u.jsxs(tg,{children:[u.jsx(ng,{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:E,children:[u.jsx(da,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(rg,{children:"New Thread"})]})]}),u.jsx(xx,{onSubmit:q,isLoading:r,onInterrupt:S,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Vv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Kv({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return u.jsxs("div",{className:"flex h-full w-full",children:[u.jsxs("div",{className:ee("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(da,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>o(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?u.jsx(Wu,{className:"h-4 w-4"}):u.jsx(Bu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(qv,{client:e,onSelectSession:r})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Gv,{client:e,agentId:t})})]})}function qv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const C=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(y=>y.filter(I=>I.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),k=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),_=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),k()):j.key==="Escape"&&(j.preventDefault(),A())},[k,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(r&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const w=Yv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:w.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const I=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(Lu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),I?u.jsx("input",{ref:g,type:"text",value:l,onChange:P=>c(P.target.value),onKeyDown:_,onBlur:k,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:P=>P.stopPropagation()}):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:"新会话"})}),I?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:k,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:P=>{P.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(qu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:P=>{P.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(fd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Yv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function Xv({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Gr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof zi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),o&&s==="connected"&&u.jsx(Kv,{client:o})]})}const Qr="rcs_admin_key";function Qv(){try{return localStorage.getItem(Qr)}catch{return null}}function Zv(){const[e,t]=p.useState(Qv),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Qr,r):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>je(()=>import("./Dashboard-BDGi4XpN.js"),__vite__mapDeps([3,2,4,5,1,6])).then(e=>({default:e.Dashboard}))),Jv=p.lazy(()=>je(()=>import("./SessionDetail-D-xhkyLo.js"),__vite__mapDeps([7,2,4,5,8,1,6])).then(e=>({default:e.SessionDetail}))),eb=p.lazy(()=>je(()=>import("./ShareLanding-DhwgJb6V.js"),__vite__mapDeps([9,2,1,6])).then(e=>({default:e.ShareLanding}))),tb=p.lazy(()=>je(()=>import("./Claim-BvfARQ6Q.js"),__vite__mapDeps([10,2,1,6])).then(e=>({default:e.Claim}))),nb=p.lazy(()=>je(()=>import("./Login-JprQIEpr.js"),__vite__mapDeps([11,2,1,6])).then(e=>({default:e.Login}))),rb=p.lazy(()=>je(()=>import("./Register-cuGuAE83.js"),__vite__mapDeps([12,2,1,6])).then(e=>({default:e.Register}))),ob=p.lazy(()=>je(()=>import("./Setup-Buwa9Y3M.js"),__vite__mapDeps([13,2,1,6])).then(e=>({default:e.Setup}))),sb=p.lazy(()=>je(()=>import("./Join-PPDYBhsJ.js"),__vite__mapDeps([14,2,1,6])).then(e=>({default:e.Join}))),ab=p.lazy(()=>je(()=>import("./UserSettings-zfGfcuWs.js"),__vite__mapDeps([15,2,16,1,6])).then(e=>({default:e.UserSettings}))),ib=p.lazy(()=>je(()=>import("./TeamList-qCuKKSH3.js"),__vite__mapDeps([17,2,1,6])).then(e=>({default:e.TeamList}))),lb=p.lazy(()=>je(()=>import("./TeamCreate-CaoinTSG.js"),__vite__mapDeps([18,2,1,6])).then(e=>({default:e.TeamCreate}))),cb=p.lazy(()=>je(()=>import("./TeamDetail-D5ahen24.js"),__vite__mapDeps([19,2,8,16,4,1,6])).then(e=>({default:e.TeamDetail}))),ub=p.lazy(()=>je(()=>import("./TeamSettings-BaIwImrp.js"),__vite__mapDeps([20,2,1,6])).then(e=>({default:e.TeamSettings}))),db=p.lazy(()=>je(()=>import("./AdminPanel-CqP_94xa.js"),__vite__mapDeps([21,2,1,6])).then(e=>({default:e.AdminPanel}))),fb=new Set(["login","register","setup","join","share"]),mb=new Set(["login","register","setup","join"]);function pb(){return u.jsx(vd,{defaultTheme:"system",children:u.jsx(xh,{children:u.jsx(hb,{})})})}function hb(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),{adminKey:l}=Zv(),{user:c,isLoading:d,checkSetupStatus:h}=Ui();p.useEffect(()=>{lh(l)},[l]);const[g,v]=p.useState(!1);p.useEffect(()=>{!d&&!c?h().then(v):c&&v(!1)},[d,c,h]);const C=p.useCallback(()=>{const w=window.location.pathname,j=new URLSearchParams(window.location.search);if(j.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const E=JSON.parse(U);if(E.url&&E.token){f({url:E.url,token:E.token}),sessionStorage.removeItem("acp_connection");const S=new URL(window.location.href);S.searchParams.delete("acp"),window.history.replaceState(null,"",S),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const y=j.get("sid");if(y){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${y}`),o(y),i(null),t("session");return}if(w==="/login"){t("login");return}if(w==="/register"){t("register");return}if(w==="/setup"){t("setup");return}if(w==="/join"){t("join");return}if(w==="/settings"){t("settings");return}if(w==="/admin"){t("admin");return}if(w==="/teams/new"){t("team-create");return}if(w.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(w.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(w==="/teams"){t("teams");return}const M=w.match(/^\/code\/s\/([^/]+)/);if(M&&M[1]){i(M[1]),o(null),s(void 0),t("share");return}const F=w.match(/^\/code\/claim\/([^/]+)/);if(F&&F[1]){t("claim");return}const R=w.match(/^\/code\/([^/]+)/);R&&R[1]?(o(R[1]),s(void 0),i(null),t("session")):(o(null),s(void 0),i(null),t("dashboard"))},[]);p.useEffect(()=>(C(),window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)),[C]);const b=p.useCallback(w=>{window.history.pushState(null,"",`/code/${w}`),o(w),s(void 0),i(null),t("session")},[]),k=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),i(null),f(null),t("dashboard")},[]),A=(()=>{let w=e;return d||(g&&w!=="setup"&&w!=="join"&&(w="setup"),!c&&!fb.has(w)&&(w="login"),c&&(w==="login"||w==="setup")&&(w="dashboard")),w})();if(p.useEffect(()=>{d||(A==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):A==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):A==="dashboard"&&c&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[A,c,d]),d)return u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const _=()=>{if(m&&A==="acp")return u.jsx(Xv,{url:m.url,token:m.token,onBack:k});switch(A){case"login":return u.jsx(nb,{onSuccess:k,onNavigateRegister:()=>t("register")});case"register":return u.jsx(rb,{onSuccess:k,onBack:()=>t("login")});case"setup":return u.jsx(ob,{onSuccess:k,onAlreadyDone:k});case"join":return u.jsx(sb,{onSuccess:k,onInvalidInvite:k});case"settings":return u.jsx(ab,{});case"teams":return u.jsx(ib,{});case"team-create":return u.jsx(lb,{});case"team-detail":return u.jsx(cb,{});case"team-settings":return u.jsx(ub,{});case"admin":return(c==null?void 0:c.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:Qe("nav.dashboard")})]})}):u.jsx(db,{});case"share":return u.jsx(eb,{});case"claim":return u.jsx(tb,{});case"session":return n?u.jsx(Jv,{sessionId:n,onSessionLoaded:w=>s(w.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:b})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:b})})}},L=!mb.has(A);return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[L&&u.jsx(bh,{sessionTitle:n||(m?"ACP":void 0),sessionSource:m?"acp":r,onBack:n||m||a?k:void 0}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:_()})]})}Mv();fc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(pb,{})}));export{Mb as $,Gr as A,Ee as B,xx as C,zi as D,Gb as E,Db as F,Fb as G,zb as H,Ob as I,jb as J,Nb as K,ca as L,Tv as M,Tb as N,av as O,qu as P,Rb as Q,Xb as R,td as S,qb as T,hd as U,Pb as V,Ub as W,dn as X,Lb as Y,$b as Z,Bb as _,Kv as a,Ib as a0,Hb as a1,Wb as a2,Vs as a3,ee as a4,ae as a5,Et as a6,su as a7,yb as a8,Sb as a9,Ab as aa,uh as ab,wb as ac,Eb as ad,kb as ae,Qe as af,Cb as ag,zv as ah,ou as ai,Ui as aj,Li as ak,ph as al,wr as b,ix as c,un as d,Kt as e,la as f,ku as g,Yb as h,iv as i,Mi as j,Oi as k,Tn as l,th as m,ys as n,Pi as o,da as p,Ml as q,Ol as r,Pl as s,sv as t,ov as u,od as v,ld as w,Vb as x,eg as y,fd as z};
|