@saluzi/saluzi-edu 0.2.73 → 0.2.76

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.
Files changed (153) hide show
  1. package/dist/cli.js +48 -48
  2. package/dist/rcs-web/assets/{AdminPanel-DMClbUbi.js → AdminPanel-omPQCGJ3.js} +1 -1
  3. package/{packages/remote-control-server/web/dist/assets/ArtifactView-CUDKNi6z.js → dist/rcs-web/assets/ArtifactView-gpttL9Bm.js} +1 -1
  4. package/dist/rcs-web/assets/ArtifactsGallery-EA1PTLFb.js +431 -0
  5. package/{packages/remote-control-server/web/dist/assets/Claim-BOkou3Kj.js → dist/rcs-web/assets/Claim-CcQDX4V4.js} +1 -1
  6. package/dist/rcs-web/assets/{Dashboard-DxcBkyhD.js → Dashboard-jAe3pVfO.js} +2 -2
  7. package/dist/rcs-web/assets/{Join-DZ_EUsnw.js → Join-z-lybdiB.js} +1 -1
  8. package/dist/rcs-web/assets/{Login-Ct6Z1ih0.js → Login-1UQ7Tsno.js} +1 -1
  9. package/dist/rcs-web/assets/{Register-D3Sub3V4.js → Register-PLzfxLKv.js} +1 -1
  10. package/dist/rcs-web/assets/{SessionDetail-CC1Y-JXz.js → SessionDetail-DLqYCAa1.js} +1 -1
  11. package/dist/rcs-web/assets/{SessionVisibilityBadge-B33i8RLj.js → SessionVisibilityBadge-YYJU7rsU.js} +1 -1
  12. package/dist/rcs-web/assets/{Setup-COecVpRC.js → Setup-eKrRj_Cj.js} +1 -1
  13. package/dist/rcs-web/assets/{ShareLanding-B7ZdGScC.js → ShareLanding-ChhDZDz-.js} +1 -1
  14. package/dist/rcs-web/assets/{TeamCreate-BKeJj9CV.js → TeamCreate-yh6hBIjW.js} +1 -1
  15. package/dist/rcs-web/assets/{TeamDetail-BAG50yxf.js → TeamDetail-V_nG-5yy.js} +2 -2
  16. package/dist/rcs-web/assets/{TeamList-B2kk8eh4.js → TeamList-8zi79KWI.js} +1 -1
  17. package/dist/rcs-web/assets/{TeamSettings-h8JWw1pp.js → TeamSettings-D7NuRKfx.js} +1 -1
  18. package/dist/rcs-web/assets/{UserSearchInput-DSeymf7O.js → UserSearchInput-CH6mJNkv.js} +1 -1
  19. package/dist/rcs-web/assets/{UserSettings-9wOVTete.js → UserSettings--GHQVpb4.js} +1 -1
  20. package/dist/rcs-web/assets/{arc-DBopY3EY.js → arc-CUQyGoJx.js} +1 -1
  21. package/dist/rcs-web/assets/{architectureDiagram-3BPJPVTR-BTnFS82c.js → architectureDiagram-3BPJPVTR-BnfpiA35.js} +1 -1
  22. package/{packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js → dist/rcs-web/assets/blockDiagram-GPEHLZMM-C7EIx897.js} +1 -1
  23. package/dist/rcs-web/assets/{c4Diagram-AAUBKEIU-BIOzYRjo.js → c4Diagram-AAUBKEIU-Bh0NqvyH.js} +1 -1
  24. package/dist/rcs-web/assets/channel-B93czv4n.js +1 -0
  25. package/dist/rcs-web/assets/{chunk-2J33WTMH-Bs-8U7DE.js → chunk-2J33WTMH-vhUevvwB.js} +1 -1
  26. package/dist/rcs-web/assets/{chunk-4BX2VUAB-BnQJ0pbh.js → chunk-4BX2VUAB-a8pkgzR3.js} +1 -1
  27. package/dist/rcs-web/assets/{chunk-55IACEB6-Cxuu3aYy.js → chunk-55IACEB6-BmhX93YQ.js} +1 -1
  28. package/{packages/remote-control-server/web/dist/assets/chunk-727SXJPM-CcLR90xa.js → dist/rcs-web/assets/chunk-727SXJPM-rp7DpY1W.js} +1 -1
  29. package/{packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BwA_vlbi.js → dist/rcs-web/assets/chunk-AQP2D5EJ-BrDELb0G.js} +1 -1
  30. package/dist/rcs-web/assets/{chunk-FMBD7UC4-Clf6X7Ml.js → chunk-FMBD7UC4-BPZWn7Kb.js} +1 -1
  31. package/dist/rcs-web/assets/{chunk-ND2GUHAM-DUVg4YJL.js → chunk-ND2GUHAM-CoV8irx0.js} +1 -1
  32. package/dist/rcs-web/assets/{chunk-QZHKN3VN-mPQkR0NB.js → chunk-QZHKN3VN-BpciLCM_.js} +1 -1
  33. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-N7OHu7DO.js +1 -0
  34. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-N7OHu7DO.js +1 -0
  35. package/dist/rcs-web/assets/{code-block-IT6T5CEO-BAgpDt13.js → code-block-IT6T5CEO-Dh84ckFz.js} +1 -1
  36. package/dist/rcs-web/assets/{copy-BdcZVl_u.js → copy-igOaIr5S.js} +1 -1
  37. package/{packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-B6DjpMte.js → dist/rcs-web/assets/cose-bilkent-S5V4N54A-Bw_9kvTI.js} +1 -1
  38. package/dist/rcs-web/assets/{dagre-BM42HDAG-D_NsO2qH.js → dagre-BM42HDAG-oVTffvvP.js} +1 -1
  39. package/dist/rcs-web/assets/{diagram-2AECGRRQ-B0NVIr-5.js → diagram-2AECGRRQ-DxxksyrF.js} +1 -1
  40. package/dist/rcs-web/assets/{diagram-5GNKFQAL-C21xttLi.js → diagram-5GNKFQAL-CZEaxtlq.js} +1 -1
  41. package/dist/rcs-web/assets/{diagram-KO2AKTUF-D6TKZ2qP.js → diagram-KO2AKTUF-CtIuIGuB.js} +1 -1
  42. package/dist/rcs-web/assets/{diagram-LMA3HP47-DJQYNR0l.js → diagram-LMA3HP47-COKmFGX6.js} +1 -1
  43. package/{packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-DBgsUCQK.js → dist/rcs-web/assets/diagram-OG6HWLK6-DYC75Fm_.js} +1 -1
  44. package/{packages/remote-control-server/web/dist/assets/dialog-niHgO9y4.js → dist/rcs-web/assets/dialog-B6hfoHoV.js} +1 -1
  45. package/{packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-B3MCOL04.js → dist/rcs-web/assets/erDiagram-TEJ5UH35-DEWI8GgR.js} +1 -1
  46. package/dist/rcs-web/assets/{flowDiagram-I6XJVG4X-Ct5UrMg4.js → flowDiagram-I6XJVG4X-By2_StrC.js} +1 -1
  47. package/{packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js → dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CcPteQpG.js} +1 -1
  48. package/{packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js → dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-Cp2tMBlS.js} +1 -1
  49. package/dist/rcs-web/assets/{infoDiagram-5YYISTIA-iVIf58oN.js → infoDiagram-5YYISTIA-BaWOi6s4.js} +1 -1
  50. package/{packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-C8rLSSN0.js → dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-Br83XOr_.js} +1 -1
  51. package/{packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-CCCe44Y_.js → dist/rcs-web/assets/journeyDiagram-JHISSGLW-DKrA-8Jk.js} +1 -1
  52. package/{packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js → dist/rcs-web/assets/kanban-definition-UN3LZRKU-CbeuuPnx.js} +1 -1
  53. package/dist/rcs-web/assets/{linear-jT5e6iMk.js → linear-CL-QXo7Y.js} +1 -1
  54. package/dist/rcs-web/assets/main-B77FMrue.css +1 -0
  55. package/dist/rcs-web/assets/{main-49JlcYCi.js → main-UQZcxx36.js} +21 -21
  56. package/{packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-DLOgnkPH.js → dist/rcs-web/assets/mermaid-VLURNSYL-B7QjpmY_.js} +4 -4
  57. package/dist/rcs-web/assets/{mermaid.core-DfoO5KWy.js → mermaid.core-BkSyhnnE.js} +5 -5
  58. package/{packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js → dist/rcs-web/assets/mindmap-definition-RKZ34NQL-DxjIAXqd.js} +1 -1
  59. package/dist/rcs-web/assets/{pieDiagram-4H26LBE5-CzxhXChG.js → pieDiagram-4H26LBE5-pDbW_3Yv.js} +1 -1
  60. package/dist/rcs-web/assets/{quadrantDiagram-W4KKPZXB-BSF1quon.js → quadrantDiagram-W4KKPZXB-awYUqDtP.js} +1 -1
  61. package/dist/rcs-web/assets/{requirementDiagram-4Y6WPE33-GGLkdBIg.js → requirementDiagram-4Y6WPE33-Ec01jxw-.js} +1 -1
  62. package/{packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js → dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-Bqv5meJU.js} +1 -1
  63. package/dist/rcs-web/assets/{sequenceDiagram-3UESZ5HK-CTMkKLqv.js → sequenceDiagram-3UESZ5HK-4IX2ixGT.js} +1 -1
  64. package/dist/rcs-web/assets/{stateDiagram-AJRCARHV-CsKOZlpT.js → stateDiagram-AJRCARHV-DZKpy9jY.js} +1 -1
  65. package/dist/rcs-web/assets/{stateDiagram-v2-BHNVJYJU-DDEvqYzH.js → stateDiagram-v2-BHNVJYJU-CO21iBgQ.js} +1 -1
  66. package/{packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-Ce-IRZf_.js → dist/rcs-web/assets/timeline-definition-PNZ67QCA-CrjfBCmq.js} +1 -1
  67. package/dist/rcs-web/assets/{vennDiagram-CIIHVFJN-BumbI6qO.js → vennDiagram-CIIHVFJN-BgS-fFrR.js} +1 -1
  68. package/dist/rcs-web/assets/{wardleyDiagram-YWT4CUSO-B5A3bkUP.js → wardleyDiagram-YWT4CUSO-CKwkA8N2.js} +1 -1
  69. package/dist/rcs-web/assets/{xychartDiagram-2RQKCTM6-CNudFFGs.js → xychartDiagram-2RQKCTM6-DOQU-oX2.js} +1 -1
  70. package/dist/rcs-web/index.html +2 -2
  71. package/package.json +1 -1
  72. package/packages/remote-control-server/src/__tests__/artifacts.test.ts +91 -0
  73. package/packages/remote-control-server/src/routes/web/artifacts.ts +21 -1
  74. package/packages/remote-control-server/src/services/artifacts.ts +6 -0
  75. package/packages/remote-control-server/web/dist/assets/{AdminPanel-DMClbUbi.js → AdminPanel-omPQCGJ3.js} +1 -1
  76. package/{dist/rcs-web/assets/ArtifactView-CUDKNi6z.js → packages/remote-control-server/web/dist/assets/ArtifactView-gpttL9Bm.js} +1 -1
  77. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-EA1PTLFb.js +431 -0
  78. package/{dist/rcs-web/assets/Claim-BOkou3Kj.js → packages/remote-control-server/web/dist/assets/Claim-CcQDX4V4.js} +1 -1
  79. package/packages/remote-control-server/web/dist/assets/{Dashboard-DxcBkyhD.js → Dashboard-jAe3pVfO.js} +2 -2
  80. package/packages/remote-control-server/web/dist/assets/{Join-DZ_EUsnw.js → Join-z-lybdiB.js} +1 -1
  81. package/packages/remote-control-server/web/dist/assets/{Login-Ct6Z1ih0.js → Login-1UQ7Tsno.js} +1 -1
  82. package/packages/remote-control-server/web/dist/assets/{Register-D3Sub3V4.js → Register-PLzfxLKv.js} +1 -1
  83. package/packages/remote-control-server/web/dist/assets/{SessionDetail-CC1Y-JXz.js → SessionDetail-DLqYCAa1.js} +1 -1
  84. package/packages/remote-control-server/web/dist/assets/{SessionVisibilityBadge-B33i8RLj.js → SessionVisibilityBadge-YYJU7rsU.js} +1 -1
  85. package/packages/remote-control-server/web/dist/assets/{Setup-COecVpRC.js → Setup-eKrRj_Cj.js} +1 -1
  86. package/packages/remote-control-server/web/dist/assets/{ShareLanding-B7ZdGScC.js → ShareLanding-ChhDZDz-.js} +1 -1
  87. package/packages/remote-control-server/web/dist/assets/{TeamCreate-BKeJj9CV.js → TeamCreate-yh6hBIjW.js} +1 -1
  88. package/packages/remote-control-server/web/dist/assets/{TeamDetail-BAG50yxf.js → TeamDetail-V_nG-5yy.js} +2 -2
  89. package/packages/remote-control-server/web/dist/assets/{TeamList-B2kk8eh4.js → TeamList-8zi79KWI.js} +1 -1
  90. package/packages/remote-control-server/web/dist/assets/{TeamSettings-h8JWw1pp.js → TeamSettings-D7NuRKfx.js} +1 -1
  91. package/packages/remote-control-server/web/dist/assets/{UserSearchInput-DSeymf7O.js → UserSearchInput-CH6mJNkv.js} +1 -1
  92. package/packages/remote-control-server/web/dist/assets/{UserSettings-9wOVTete.js → UserSettings--GHQVpb4.js} +1 -1
  93. package/packages/remote-control-server/web/dist/assets/{arc-DBopY3EY.js → arc-CUQyGoJx.js} +1 -1
  94. package/packages/remote-control-server/web/dist/assets/{architectureDiagram-3BPJPVTR-BTnFS82c.js → architectureDiagram-3BPJPVTR-BnfpiA35.js} +1 -1
  95. package/{dist/rcs-web/assets/blockDiagram-GPEHLZMM-B8Sve1cP.js → packages/remote-control-server/web/dist/assets/blockDiagram-GPEHLZMM-C7EIx897.js} +1 -1
  96. package/packages/remote-control-server/web/dist/assets/{c4Diagram-AAUBKEIU-BIOzYRjo.js → c4Diagram-AAUBKEIU-Bh0NqvyH.js} +1 -1
  97. package/packages/remote-control-server/web/dist/assets/channel-B93czv4n.js +1 -0
  98. package/packages/remote-control-server/web/dist/assets/{chunk-2J33WTMH-Bs-8U7DE.js → chunk-2J33WTMH-vhUevvwB.js} +1 -1
  99. package/packages/remote-control-server/web/dist/assets/{chunk-4BX2VUAB-BnQJ0pbh.js → chunk-4BX2VUAB-a8pkgzR3.js} +1 -1
  100. package/packages/remote-control-server/web/dist/assets/{chunk-55IACEB6-Cxuu3aYy.js → chunk-55IACEB6-BmhX93YQ.js} +1 -1
  101. package/{dist/rcs-web/assets/chunk-727SXJPM-CcLR90xa.js → packages/remote-control-server/web/dist/assets/chunk-727SXJPM-rp7DpY1W.js} +1 -1
  102. package/{dist/rcs-web/assets/chunk-AQP2D5EJ-BwA_vlbi.js → packages/remote-control-server/web/dist/assets/chunk-AQP2D5EJ-BrDELb0G.js} +1 -1
  103. package/packages/remote-control-server/web/dist/assets/{chunk-FMBD7UC4-Clf6X7Ml.js → chunk-FMBD7UC4-BPZWn7Kb.js} +1 -1
  104. package/packages/remote-control-server/web/dist/assets/{chunk-ND2GUHAM-DUVg4YJL.js → chunk-ND2GUHAM-CoV8irx0.js} +1 -1
  105. package/packages/remote-control-server/web/dist/assets/{chunk-QZHKN3VN-mPQkR0NB.js → chunk-QZHKN3VN-BpciLCM_.js} +1 -1
  106. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-N7OHu7DO.js +1 -0
  107. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-N7OHu7DO.js +1 -0
  108. package/packages/remote-control-server/web/dist/assets/{code-block-IT6T5CEO-BAgpDt13.js → code-block-IT6T5CEO-Dh84ckFz.js} +1 -1
  109. package/packages/remote-control-server/web/dist/assets/{copy-BdcZVl_u.js → copy-igOaIr5S.js} +1 -1
  110. package/{dist/rcs-web/assets/cose-bilkent-S5V4N54A-B6DjpMte.js → packages/remote-control-server/web/dist/assets/cose-bilkent-S5V4N54A-Bw_9kvTI.js} +1 -1
  111. package/packages/remote-control-server/web/dist/assets/{dagre-BM42HDAG-D_NsO2qH.js → dagre-BM42HDAG-oVTffvvP.js} +1 -1
  112. package/packages/remote-control-server/web/dist/assets/{diagram-2AECGRRQ-B0NVIr-5.js → diagram-2AECGRRQ-DxxksyrF.js} +1 -1
  113. package/packages/remote-control-server/web/dist/assets/{diagram-5GNKFQAL-C21xttLi.js → diagram-5GNKFQAL-CZEaxtlq.js} +1 -1
  114. package/packages/remote-control-server/web/dist/assets/{diagram-KO2AKTUF-D6TKZ2qP.js → diagram-KO2AKTUF-CtIuIGuB.js} +1 -1
  115. package/packages/remote-control-server/web/dist/assets/{diagram-LMA3HP47-DJQYNR0l.js → diagram-LMA3HP47-COKmFGX6.js} +1 -1
  116. package/{dist/rcs-web/assets/diagram-OG6HWLK6-DBgsUCQK.js → packages/remote-control-server/web/dist/assets/diagram-OG6HWLK6-DYC75Fm_.js} +1 -1
  117. package/{dist/rcs-web/assets/dialog-niHgO9y4.js → packages/remote-control-server/web/dist/assets/dialog-B6hfoHoV.js} +1 -1
  118. package/{dist/rcs-web/assets/erDiagram-TEJ5UH35-B3MCOL04.js → packages/remote-control-server/web/dist/assets/erDiagram-TEJ5UH35-DEWI8GgR.js} +1 -1
  119. package/packages/remote-control-server/web/dist/assets/{flowDiagram-I6XJVG4X-Ct5UrMg4.js → flowDiagram-I6XJVG4X-By2_StrC.js} +1 -1
  120. package/{dist/rcs-web/assets/ganttDiagram-6RSMTGT7-CETj1zUQ.js → packages/remote-control-server/web/dist/assets/ganttDiagram-6RSMTGT7-CcPteQpG.js} +1 -1
  121. package/{dist/rcs-web/assets/gitGraphDiagram-PVQCEYII-CTYvU4m1.js → packages/remote-control-server/web/dist/assets/gitGraphDiagram-PVQCEYII-Cp2tMBlS.js} +1 -1
  122. package/packages/remote-control-server/web/dist/assets/{infoDiagram-5YYISTIA-iVIf58oN.js → infoDiagram-5YYISTIA-BaWOi6s4.js} +1 -1
  123. package/{dist/rcs-web/assets/ishikawaDiagram-YF4QCWOH-C8rLSSN0.js → packages/remote-control-server/web/dist/assets/ishikawaDiagram-YF4QCWOH-Br83XOr_.js} +1 -1
  124. package/{dist/rcs-web/assets/journeyDiagram-JHISSGLW-CCCe44Y_.js → packages/remote-control-server/web/dist/assets/journeyDiagram-JHISSGLW-DKrA-8Jk.js} +1 -1
  125. package/{dist/rcs-web/assets/kanban-definition-UN3LZRKU-D-2jpn6m.js → packages/remote-control-server/web/dist/assets/kanban-definition-UN3LZRKU-CbeuuPnx.js} +1 -1
  126. package/packages/remote-control-server/web/dist/assets/{linear-jT5e6iMk.js → linear-CL-QXo7Y.js} +1 -1
  127. package/packages/remote-control-server/web/dist/assets/main-B77FMrue.css +1 -0
  128. package/packages/remote-control-server/web/dist/assets/{main-49JlcYCi.js → main-UQZcxx36.js} +21 -21
  129. package/{dist/rcs-web/assets/mermaid-VLURNSYL-DLOgnkPH.js → packages/remote-control-server/web/dist/assets/mermaid-VLURNSYL-B7QjpmY_.js} +4 -4
  130. package/packages/remote-control-server/web/dist/assets/{mermaid.core-DfoO5KWy.js → mermaid.core-BkSyhnnE.js} +5 -5
  131. package/{dist/rcs-web/assets/mindmap-definition-RKZ34NQL-COp3rAIF.js → packages/remote-control-server/web/dist/assets/mindmap-definition-RKZ34NQL-DxjIAXqd.js} +1 -1
  132. package/packages/remote-control-server/web/dist/assets/{pieDiagram-4H26LBE5-CzxhXChG.js → pieDiagram-4H26LBE5-pDbW_3Yv.js} +1 -1
  133. package/packages/remote-control-server/web/dist/assets/{quadrantDiagram-W4KKPZXB-BSF1quon.js → quadrantDiagram-W4KKPZXB-awYUqDtP.js} +1 -1
  134. package/packages/remote-control-server/web/dist/assets/{requirementDiagram-4Y6WPE33-GGLkdBIg.js → requirementDiagram-4Y6WPE33-Ec01jxw-.js} +1 -1
  135. package/{dist/rcs-web/assets/sankeyDiagram-5OEKKPKP-ClAqJ5Dt.js → packages/remote-control-server/web/dist/assets/sankeyDiagram-5OEKKPKP-Bqv5meJU.js} +1 -1
  136. package/packages/remote-control-server/web/dist/assets/{sequenceDiagram-3UESZ5HK-CTMkKLqv.js → sequenceDiagram-3UESZ5HK-4IX2ixGT.js} +1 -1
  137. package/packages/remote-control-server/web/dist/assets/{stateDiagram-AJRCARHV-CsKOZlpT.js → stateDiagram-AJRCARHV-DZKpy9jY.js} +1 -1
  138. package/packages/remote-control-server/web/dist/assets/{stateDiagram-v2-BHNVJYJU-DDEvqYzH.js → stateDiagram-v2-BHNVJYJU-CO21iBgQ.js} +1 -1
  139. package/{dist/rcs-web/assets/timeline-definition-PNZ67QCA-Ce-IRZf_.js → packages/remote-control-server/web/dist/assets/timeline-definition-PNZ67QCA-CrjfBCmq.js} +1 -1
  140. package/packages/remote-control-server/web/dist/assets/{vennDiagram-CIIHVFJN-BumbI6qO.js → vennDiagram-CIIHVFJN-BgS-fFrR.js} +1 -1
  141. package/packages/remote-control-server/web/dist/assets/{wardleyDiagram-YWT4CUSO-B5A3bkUP.js → wardleyDiagram-YWT4CUSO-CKwkA8N2.js} +1 -1
  142. package/packages/remote-control-server/web/dist/assets/{xychartDiagram-2RQKCTM6-CNudFFGs.js → xychartDiagram-2RQKCTM6-DOQU-oX2.js} +1 -1
  143. package/packages/remote-control-server/web/dist/index.html +2 -2
  144. package/dist/rcs-web/assets/ArtifactsGallery-B3OCFJ7T.js +0 -344
  145. package/dist/rcs-web/assets/channel-CbznqW4C.js +0 -1
  146. package/dist/rcs-web/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +0 -1
  147. package/dist/rcs-web/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +0 -1
  148. package/dist/rcs-web/assets/main-C1pGF5LM.css +0 -1
  149. package/packages/remote-control-server/web/dist/assets/ArtifactsGallery-B3OCFJ7T.js +0 -344
  150. package/packages/remote-control-server/web/dist/assets/channel-CbznqW4C.js +0 -1
  151. package/packages/remote-control-server/web/dist/assets/classDiagram-4FO5ZUOK-rJ7tuSw-.js +0 -1
  152. package/packages/remote-control-server/web/dist/assets/classDiagram-v2-Q7XG4LA2-rJ7tuSw-.js +0 -1
  153. package/packages/remote-control-server/web/dist/assets/main-C1pGF5LM.css +0 -1
@@ -1,10 +1,10 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-DLOgnkPH.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-DxcBkyhD.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-B33i8RLj.js","assets/dialog-niHgO9y4.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-CC1Y-JXz.js","assets/ArtifactsGallery-B3OCFJ7T.js","assets/copy-BdcZVl_u.js","assets/UserSearchInput-DSeymf7O.js","assets/ShareLanding-B7ZdGScC.js","assets/ArtifactView-CUDKNi6z.js","assets/Claim-BOkou3Kj.js","assets/Login-Ct6Z1ih0.js","assets/Register-D3Sub3V4.js","assets/Setup-COecVpRC.js","assets/Join-DZ_EUsnw.js","assets/UserSettings-9wOVTete.js","assets/TeamList-B2kk8eh4.js","assets/TeamCreate-BKeJj9CV.js","assets/TeamDetail-BAG50yxf.js","assets/TeamSettings-h8JWw1pp.js","assets/AdminPanel-DMClbUbi.js"])))=>i.map(i=>d[i]);
2
- var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>dc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as Gs,b as fc,c as Jr,d as mc}from"./vendor-DE_-CLIE.js";import{_ as Ae}from"./shiki-mEP5vQQu.js";import{m as pc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&o(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function Vs(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Vs(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ks(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Vs(e))&&(o&&(o+=" "),o+=t);return o}const hc=(e,t)=>{const n=new Array(e.length+t.length);for(let o=0;o<e.length;o++)n[o]=e[o];for(let o=0;o<t.length;o++)n[e.length+o]=t[o];return n},gc=(e,t)=>({classGroupId:e,validator:t}),qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Bo=[],xc="arbitrary..",vc=e=>{const t=yc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bc(a);const i=a.split(Mn),m=i[0]===""&&i.length>1?1:0;return Ys(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=o[a],f=n[a];return m?f?hc(f,m):m:f||Bo}return n[a]||Bo}}},Ys=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],s=n.nextPart.get(r);if(s){const f=Ys(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Mn):e.slice(t).join(Mn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},bc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),o=t.slice(0,n);return o?xc+o:void 0})(),yc=e=>{const{theme:t,classGroups:n}=e;return wc(n,t)},wc=(e,t)=>{const n=qs();for(const o in e){const r=e[o];eo(r,n,o,t)}return n},eo=(e,t,n,o)=>{const r=e.length;for(let s=0;s<r;s++){const a=e[s];Cc(a,t,n,o)}},Cc=(e,t,n,o)=>{if(typeof e=="string"){Sc(e,t,n);return}if(typeof e=="function"){kc(e,t,n,o);return}Ec(e,t,n,o)},Sc=(e,t,n)=>{const o=e===""?t:Xs(t,e);o.classGroupId=n},kc=(e,t,n,o)=>{if(_c(e)){eo(e(o),t,n,o);return}t.validators===null&&(t.validators=[]),t.validators.push(gc(n,e))},Ec=(e,t,n,o)=>{const r=Object.entries(e),s=r.length;for(let a=0;a<s;a++){const[i,m]=r[a];eo(m,Xs(t,i),n,o)}},Xs=(e,t)=>{let n=e;const o=t.split(Mn),r=o.length;for(let s=0;s<r;s++){const a=o[s];let i=n.nextPart.get(a);i||(i=qs(),n.nextPart.set(a,i)),n=i}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ac=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),o=Object.create(null);const r=(s,a)=>{n[s]=a,t++,t>e&&(t=0,o=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=o[s])!==void 0)return r(s,a),a},set(s,a){s in n?n[s]=a:r(s,a)}}},Pr="!",Ho=":",jc=[],Wo=(e,t,n,o,r)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:o,isExternal:r}),Tc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let o=r=>{const s=[];let a=0,i=0,m=0,f;const l=r.length;for(let v=0;v<l;v++){const C=r[v];if(a===0&&i===0){if(C===Ho){s.push(r.slice(m,v)),m=v+1;continue}if(C==="/"){f=v;continue}}C==="["?a++:C==="]"?a--:C==="("?i++:C===")"&&i--}const c=s.length===0?r:r.slice(m);let d=c,h=!1;c.endsWith(Pr)?(d=c.slice(0,-1),h=!0):c.startsWith(Pr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Wo(s,h,d,g)};if(t){const r=t+Ho,s=o;o=a=>a.startsWith(r)?s(a.slice(r.length)):Wo(jc,!1,a,void 0,!0)}if(n){const r=o;o=s=>n({className:s,parseClassName:r})}return o},Rc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,o)=>{t.set(n,1e6+o)}),n=>{const o=[];let r=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(r.length>0&&(r.sort(),o.push(...r),r=[]),o.push(a)):r.push(a)}return r.length>0&&(r.sort(),o.push(...r)),o}},Nc=e=>({cache:Ac(e.cacheSize),parseClassName:Tc(e),sortModifiers:Rc(e),postfixLookupClassGroupIds:Ic(e),...vc(e)}),Ic=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let o=0;o<n.length;o++)t[n[o]]=!0;return t},Mc=/\s+/,Pc=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Mc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!C,_;if(b){const j=v.substring(0,C);_=o(j);const x=_&&a[_]?o(v):void 0;x&&x!==_&&(_=x,b=!1)}else _=o(v);if(!_){if(!b){f=c+(f.length>0?" "+f:f);continue}if(_=o(v),!_){f=c+(f.length>0?" "+f:f);continue}b=!1}const A=h.length===0?"":h.length===1?h[0]:s(h).join(":"),E=g?A+Pr:A,L=E+_;if(i.indexOf(L)>-1)continue;i.push(L);const k=r(_,b);for(let j=0;j<k.length;++j){const x=k[j];i.push(E+x)}f=c+(f.length>0?" "+f:f)}return f},Oc=(...e)=>{let t=0,n,o,r="";for(;t<e.length;)(n=e[t++])&&(o=Qs(n))&&(r&&(r+=" "),r+=o);return r},Qs=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=Qs(e[o]))&&(n&&(n+=" "),n+=t);return n},Dc=(e,...t)=>{let n,o,r,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Nc(f),o=n.cache.get,r=n.cache.set,s=i,i(m)},i=m=>{const f=o(m);if(f)return f;const l=Pc(m,n);return r(m,l),l};return s=a,(...m)=>s(Oc(...m))},Lc=[],Ee=e=>{const t=n=>n[e]||Lc;return t.isThemeGetter=!0,t},Zs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$c=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>Fc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),He=e=>!!e&&Number.isInteger(Number(e)),fr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Qe=e=>$c.test(e),ea=()=>!0,Wc=e=>Uc.test(e)&&!zc.test(e),to=()=>!1,Gc=e=>Bc.test(e),Vc=e=>Hc.test(e),Kc=e=>!X(e)&&!Q(e),qc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Yc=e=>pt(e,ra,to),X=e=>Zs.test(e),yt=e=>pt(e,oa,Wc),Go=e=>pt(e,ru,se),Xc=e=>pt(e,aa,ea),Qc=e=>pt(e,sa,to),Vo=e=>pt(e,ta,to),Zc=e=>pt(e,na,Vc),wn=e=>pt(e,ia,Gc),Q=e=>Js.test(e),en=e=>Tt(e,oa),Jc=e=>Tt(e,sa),Ko=e=>Tt(e,ta),eu=e=>Tt(e,ra),tu=e=>Tt(e,na),Cn=e=>Tt(e,ia,!0),nu=e=>Tt(e,aa,!0),pt=(e,t,n)=>{const o=Zs.exec(e);return o?o[1]?t(o[1]):n(o[2]):!1},Tt=(e,t,n=!1)=>{const o=Js.exec(e);return o?o[1]?t(o[1]):n:!1},ta=e=>e==="position"||e==="percentage",na=e=>e==="image"||e==="url",ra=e=>e==="length"||e==="size"||e==="bg-size",oa=e=>e==="length",ru=e=>e==="number",sa=e=>e==="family-name",aa=e=>e==="number"||e==="weight",ia=e=>e==="shadow",ou=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),o=Ee("font-weight"),r=Ee("tracking"),s=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),d=Ee("text-shadow"),h=Ee("drop-shadow"),g=Ee("blur"),v=Ee("perspective"),C=Ee("aspect"),b=Ee("ease"),_=Ee("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...E(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],T=()=>[He,"none","subgrid",Q,X],M=()=>["auto",{span:["full",He,Q,X]},He,Q,X],O=()=>[He,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],w=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],B=()=>[at,"screen","full","dvw","lvw","svw","min","max","fit",...x()],P=()=>[at,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,Q,X],q=()=>[...E(),Ko,Vo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eu,Yc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],H=()=>["",se,en,yt],G=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[se,fr,Ko,Vo],ne=()=>["","none",g,Q,X],Z=()=>["none",se,Q,X],re=()=>["none",se,Q,X],ue=()=>[se,Q,X],be=()=>[at,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qe],breakpoint:[Qe],color:[ea],container:[Qe],"drop-shadow":[Qe],ease:["in","out","in-out"],font:[Kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qe],shadow:[Qe],spacing:["px",se],text:[Qe],"text-shadow":[Qe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",at,X,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[He,"auto",Q,X]}],basis:[{basis:[at,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,at,"auto","initial","none",X]}],grow:[{grow:["",se,Q,X]}],shrink:[{shrink:["",se,Q,X]}],order:[{order:[He,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:w()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...w()]}],"min-w":[{"min-w":[i,"screen","none",...w()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...w()]}],h:[{h:["screen","lh",...w()]}],"min-h":[{"min-h":["screen","lh","none",...w()]}],"max-h":[{"max-h":["screen","lh",...w()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,nu,Xc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fr,X]}],"font-family":[{font:[Jc,Qc,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Go]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[se,"from-font","auto",Q,yt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[se,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[He,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},He,Q,X],radial:["",Q,X],conic:[He,Q,X]},tu,Zc]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,X]}],"outline-w":[{outline:["",se,en,yt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Cn,wn]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Cn,wn]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[se,yt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",d,Cn,wn]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[se,Q,X]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Cn,wn]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",se,Q,X]}],"hue-rotate":[{"hue-rotate":[se,Q,X]}],invert:[{invert:["",se,Q,X]}],saturate:[{saturate:[se,Q,X]}],sepia:[{sepia:["",se,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,X]}],ease:[{ease:["linear","initial",b,Q,X]}],delay:[{delay:[se,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[He,Q,X]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[se,en,yt,Go]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},su=Dc(ou);function ee(...e){return su(Ks(e))}function au(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Eb(e){return e?new Date(e*1e3).toLocaleString():""}function _b(e){return e==="archived"||e==="inactive"}function Ab(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function iu(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function jb(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),iu(t)}function Tb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const lu=/^Remote Control connecting(?:…|\.\.\.)$/;function Rb(e){return typeof e=="string"&&lu.test(e.trim())}/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid-VLURNSYL-B7QjpmY_.js","assets/shiki-mEP5vQQu.js","assets/vendor-DE_-CLIE.js","assets/Dashboard-jAe3pVfO.js","assets/workerType-Bd-zteMi.js","assets/SessionVisibilityBadge-YYJU7rsU.js","assets/dialog-B6hfoHoV.js","assets/motion-BILbV7YQ.js","assets/SessionDetail-DLqYCAa1.js","assets/ArtifactsGallery-EA1PTLFb.js","assets/copy-igOaIr5S.js","assets/UserSearchInput-CH6mJNkv.js","assets/ShareLanding-ChhDZDz-.js","assets/ArtifactView-gpttL9Bm.js","assets/Claim-CcQDX4V4.js","assets/Login-1UQ7Tsno.js","assets/Register-PLzfxLKv.js","assets/Setup-eKrRj_Cj.js","assets/Join-z-lybdiB.js","assets/UserSettings--GHQVpb4.js","assets/TeamList-8zi79KWI.js","assets/TeamCreate-yh6hBIjW.js","assets/TeamDetail-V_nG-5yy.js","assets/TeamSettings-D7NuRKfx.js","assets/AdminPanel-omPQCGJ3.js"])))=>i.map(i=>d[i]);
2
+ var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var oe=(e,t,n)=>dc(e,typeof t!="symbol"?t+"":t,n);import{e as p,a as it,j as u,R as Zr,r as Gs,b as fc,c as Jr,d as mc}from"./vendor-DE_-CLIE.js";import{_ as Ae}from"./shiki-mEP5vQQu.js";import{m as pc}from"./motion-BILbV7YQ.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Vs(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Vs(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ks(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Vs(e))&&(r&&(r+=" "),r+=t);return r}const hc=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},gc=(e,t)=>({classGroupId:e,validator:t}),qs=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Mn="-",Bo=[],xc="arbitrary..",vc=e=>{const t=yc(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return bc(a);const i=a.split(Mn),m=i[0]===""&&i.length>1?1:0;return Ys(i,m,t)},getConflictingClassGroupIds:(a,i)=>{if(i){const m=r[a],f=n[a];return m?f?hc(f,m):m:f||Bo}return n[a]||Bo}}},Ys=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const f=Ys(e,t+1,s);if(f)return f}const a=n.validators;if(a===null)return;const i=t===0?e.join(Mn):e.slice(t).join(Mn),m=a.length;for(let f=0;f<m;f++){const l=a[f];if(l.validator(i))return l.classGroupId}},bc=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?xc+r:void 0})(),yc=e=>{const{theme:t,classGroups:n}=e;return wc(n,t)},wc=(e,t)=>{const n=qs();for(const r in e){const o=e[r];eo(o,n,r,t)}return n},eo=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Cc(a,t,n,r)}},Cc=(e,t,n,r)=>{if(typeof e=="string"){Sc(e,t,n);return}if(typeof e=="function"){kc(e,t,n,r);return}Ec(e,t,n,r)},Sc=(e,t,n)=>{const r=e===""?t:Xs(t,e);r.classGroupId=n},kc=(e,t,n,r)=>{if(_c(e)){eo(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(gc(n,e))},Ec=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[i,m]=o[a];eo(m,Xs(t,i),n,r)}},Xs=(e,t)=>{let n=e;const r=t.split(Mn),o=r.length;for(let s=0;s<o;s++){const a=r[s];let i=n.nextPart.get(a);i||(i=qs(),n.nextPart.set(a,i)),n=i}return n},_c=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ac=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Pr="!",Ho=":",jc=[],Wo=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Tc=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,i=0,m=0,f;const l=o.length;for(let v=0;v<l;v++){const C=o[v];if(a===0&&i===0){if(C===Ho){s.push(o.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?o:o.slice(m);let d=c,h=!1;c.endsWith(Pr)?(d=c.slice(0,-1),h=!0):c.startsWith(Pr)&&(d=c.slice(1),h=!0);const g=f&&f>m?f-m:void 0;return Wo(s,h,d,g)};if(t){const o=t+Ho,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Wo(jc,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Rc=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],i=a[0]==="[",m=t.has(a);i||m?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Nc=e=>({cache:Ac(e.cacheSize),parseClassName:Tc(e),sortModifiers:Rc(e),postfixLookupClassGroupIds:Ic(e),...vc(e)}),Ic=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let r=0;r<n.length;r++)t[n[r]]=!0;return t},Mc=/\s+/,Pc=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=t,i=[],m=e.trim().split(Mc);let f="";for(let l=m.length-1;l>=0;l-=1){const c=m[l],{isExternal:d,modifiers:h,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:C}=n(c);if(d){f=c+(f.length>0?" "+f:f);continue}let b=!!C,_;if(b){const j=v.substring(0,C);_=r(j);const x=_&&a[_]?r(v):void 0;x&&x!==_&&(_=x,b=!1)}else _=r(v);if(!_){if(!b){f=c+(f.length>0?" "+f:f);continue}if(_=r(v),!_){f=c+(f.length>0?" "+f:f);continue}b=!1}const A=h.length===0?"":h.length===1?h[0]:s(h).join(":"),E=g?A+Pr:A,L=E+_;if(i.indexOf(L)>-1)continue;i.push(L);const k=o(_,b);for(let j=0;j<k.length;++j){const x=k[j];i.push(E+x)}f=c+(f.length>0?" "+f:f)}return f},Oc=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Qs(n))&&(o&&(o+=" "),o+=r);return o},Qs=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Qs(e[r]))&&(n&&(n+=" "),n+=t);return n},Dc=(e,...t)=>{let n,r,o,s;const a=m=>{const f=t.reduce((l,c)=>c(l),e());return n=Nc(f),r=n.cache.get,o=n.cache.set,s=i,i(m)},i=m=>{const f=r(m);if(f)return f;const l=Pc(m,n);return o(m,l),l};return s=a,(...m)=>s(Oc(...m))},Lc=[],Ee=e=>{const t=n=>n[e]||Lc;return t.isThemeGetter=!0,t},Zs=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fc=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$c=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uc=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zc=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bc=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hc=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,at=e=>Fc.test(e),se=e=>!!e&&!Number.isNaN(Number(e)),He=e=>!!e&&Number.isInteger(Number(e)),fr=e=>e.endsWith("%")&&se(e.slice(0,-1)),Qe=e=>$c.test(e),ea=()=>!0,Wc=e=>Uc.test(e)&&!zc.test(e),to=()=>!1,Gc=e=>Bc.test(e),Vc=e=>Hc.test(e),Kc=e=>!X(e)&&!Q(e),qc=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),Yc=e=>pt(e,ra,to),X=e=>Zs.test(e),yt=e=>pt(e,oa,Wc),Go=e=>pt(e,ru,se),Xc=e=>pt(e,aa,ea),Qc=e=>pt(e,sa,to),Vo=e=>pt(e,ta,to),Zc=e=>pt(e,na,Vc),wn=e=>pt(e,ia,Gc),Q=e=>Js.test(e),en=e=>Tt(e,oa),Jc=e=>Tt(e,sa),Ko=e=>Tt(e,ta),eu=e=>Tt(e,ra),tu=e=>Tt(e,na),Cn=e=>Tt(e,ia,!0),nu=e=>Tt(e,aa,!0),pt=(e,t,n)=>{const r=Zs.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Tt=(e,t,n=!1)=>{const r=Js.exec(e);return r?r[1]?t(r[1]):n:!1},ta=e=>e==="position"||e==="percentage",na=e=>e==="image"||e==="url",ra=e=>e==="length"||e==="size"||e==="bg-size",oa=e=>e==="length",ru=e=>e==="number",sa=e=>e==="family-name",aa=e=>e==="number"||e==="weight",ia=e=>e==="shadow",ou=()=>{const e=Ee("color"),t=Ee("font"),n=Ee("text"),r=Ee("font-weight"),o=Ee("tracking"),s=Ee("leading"),a=Ee("breakpoint"),i=Ee("container"),m=Ee("spacing"),f=Ee("radius"),l=Ee("shadow"),c=Ee("inset-shadow"),d=Ee("text-shadow"),h=Ee("drop-shadow"),g=Ee("blur"),v=Ee("perspective"),C=Ee("aspect"),b=Ee("ease"),_=Ee("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],L=()=>[...E(),Q,X],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],x=()=>[Q,X,m],y=()=>[at,"full","auto",...x()],T=()=>[He,"none","subgrid",Q,X],M=()=>["auto",{span:["full",He,Q,X]},He,Q,X],O=()=>[He,"auto",Q,X],F=()=>["auto","min","max","fr",Q,X],I=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],z=()=>["start","end","center","stretch","center-safe","end-safe"],S=()=>["auto",...x()],w=()=>[at,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],B=()=>[at,"screen","full","dvw","lvw","svw","min","max","fit",...x()],P=()=>[at,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],U=()=>[e,Q,X],q=()=>[...E(),Ko,Vo,{position:[Q,X]}],N=()=>["no-repeat",{repeat:["","x","y","space","round"]}],D=()=>["auto","cover","contain",eu,Yc,{size:[Q,X]}],$=()=>[fr,en,yt],R=()=>["","none","full",f,Q,X],H=()=>["",se,en,yt],G=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],V=()=>[se,fr,Ko,Vo],ne=()=>["","none",g,Q,X],Z=()=>["none",se,Q,X],re=()=>["none",se,Q,X],ue=()=>[se,Q,X],be=()=>[at,"full",...x()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qe],breakpoint:[Qe],color:[ea],container:[Qe],"drop-shadow":[Qe],ease:["in","out","in-out"],font:[Kc],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qe],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qe],shadow:[Qe],spacing:["px",se],text:[Qe],"text-shadow":[Qe],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",at,X,Q,C]}],container:["container"],"container-type":[{"@container":["","normal","size",Q,X]}],"container-named":[qc],columns:[{columns:[se,X,Q,i]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:L()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:y()}],"inset-x":[{"inset-x":y()}],"inset-y":[{"inset-y":y()}],start:[{"inset-s":y(),start:y()}],end:[{"inset-e":y(),end:y()}],"inset-bs":[{"inset-bs":y()}],"inset-be":[{"inset-be":y()}],top:[{top:y()}],right:[{right:y()}],bottom:[{bottom:y()}],left:[{left:y()}],visibility:["visible","invisible","collapse"],z:[{z:[He,"auto",Q,X]}],basis:[{basis:[at,"full","auto",i,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[se,at,"auto","initial","none",X]}],grow:[{grow:["",se,Q,X]}],shrink:[{shrink:["",se,Q,X]}],order:[{order:[He,"first","last","none",Q,X]}],"grid-cols":[{"grid-cols":T()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":T()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...I(),"normal"]}],"justify-items":[{"justify-items":[...z(),"normal"]}],"justify-self":[{"justify-self":["auto",...z()]}],"align-content":[{content:["normal",...I()]}],"align-items":[{items:[...z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...z(),{baseline:["","last"]}]}],"place-content":[{"place-content":I()}],"place-items":[{"place-items":[...z(),"baseline"]}],"place-self":[{"place-self":["auto",...z()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:S()}],mx:[{mx:S()}],my:[{my:S()}],ms:[{ms:S()}],me:[{me:S()}],mbs:[{mbs:S()}],mbe:[{mbe:S()}],mt:[{mt:S()}],mr:[{mr:S()}],mb:[{mb:S()}],ml:[{ml:S()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:w()}],"inline-size":[{inline:["auto",...B()]}],"min-inline-size":[{"min-inline":["auto",...B()]}],"max-inline-size":[{"max-inline":["none",...B()]}],"block-size":[{block:["auto",...P()]}],"min-block-size":[{"min-block":["auto",...P()]}],"max-block-size":[{"max-block":["none",...P()]}],w:[{w:[i,"screen",...w()]}],"min-w":[{"min-w":[i,"screen","none",...w()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[a]},...w()]}],h:[{h:["screen","lh",...w()]}],"min-h":[{"min-h":["screen","lh","none",...w()]}],"max-h":[{"max-h":["screen","lh",...w()]}],"font-size":[{text:["base",n,en,yt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,nu,Xc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fr,X]}],"font-family":[{font:[Jc,Qc,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,Q,X]}],"line-clamp":[{"line-clamp":[se,"none",Q,Go]}],leading:[{leading:[s,...x()]}],"list-image":[{"list-image":["none",Q,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Q,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[se,"from-font","auto",Q,yt]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[se,"auto",Q,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[He,Q,X]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Q,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Q,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:q()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:D()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},He,Q,X],radial:["",Q,X],conic:[He,Q,X]},tu,Zc]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":H()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[se,Q,X]}],"outline-w":[{outline:["",se,en,yt]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",l,Cn,wn]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",c,Cn,wn]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[se,yt]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",d,Cn,wn]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[se,Q,X]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[se]}],"mask-image-linear-from-pos":[{"mask-linear-from":V()}],"mask-image-linear-to-pos":[{"mask-linear-to":V()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":V()}],"mask-image-t-to-pos":[{"mask-t-to":V()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":V()}],"mask-image-r-to-pos":[{"mask-r-to":V()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":V()}],"mask-image-b-to-pos":[{"mask-b-to":V()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":V()}],"mask-image-l-to-pos":[{"mask-l-to":V()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":V()}],"mask-image-x-to-pos":[{"mask-x-to":V()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":V()}],"mask-image-y-to-pos":[{"mask-y-to":V()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[Q,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":V()}],"mask-image-radial-to-pos":[{"mask-radial-to":V()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[se]}],"mask-image-conic-from-pos":[{"mask-conic-from":V()}],"mask-image-conic-to-pos":[{"mask-conic-to":V()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:q()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:D()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Q,X]}],filter:[{filter:["","none",Q,X]}],blur:[{blur:ne()}],brightness:[{brightness:[se,Q,X]}],contrast:[{contrast:[se,Q,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Cn,wn]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",se,Q,X]}],"hue-rotate":[{"hue-rotate":[se,Q,X]}],invert:[{invert:["",se,Q,X]}],saturate:[{saturate:[se,Q,X]}],sepia:[{sepia:["",se,Q,X]}],"backdrop-filter":[{"backdrop-filter":["","none",Q,X]}],"backdrop-blur":[{"backdrop-blur":ne()}],"backdrop-brightness":[{"backdrop-brightness":[se,Q,X]}],"backdrop-contrast":[{"backdrop-contrast":[se,Q,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",se,Q,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[se,Q,X]}],"backdrop-invert":[{"backdrop-invert":["",se,Q,X]}],"backdrop-opacity":[{"backdrop-opacity":[se,Q,X]}],"backdrop-saturate":[{"backdrop-saturate":[se,Q,X]}],"backdrop-sepia":[{"backdrop-sepia":["",se,Q,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Q,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[se,"initial",Q,X]}],ease:[{ease:["linear","initial",b,Q,X]}],delay:[{delay:[se,Q,X]}],animate:[{animate:["none",_,Q,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[v,Q,X]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:Z()}],"rotate-x":[{"rotate-x":Z()}],"rotate-y":[{"rotate-y":Z()}],"rotate-z":[{"rotate-z":Z()}],scale:[{scale:re()}],"scale-x":[{"scale-x":re()}],"scale-y":[{"scale-y":re()}],"scale-z":[{"scale-z":re()}],"scale-3d":["scale-3d"],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[Q,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],zoom:[{zoom:[He,Q,X]}],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Q,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":U()}],"scrollbar-track-color":[{"scrollbar-track":U()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Q,X]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[se,en,yt,Go]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},su=Dc(ou);function ee(...e){return su(Ks(e))}function au(e){if(!e)return"";const t=String(e),n=document.createElement("div");return n.textContent=t,n.innerHTML}function Eb(e){return e?new Date(e*1e3).toLocaleString():""}function _b(e){return e==="archived"||e==="inactive"}function Ab(e,t){if(!e)return"";const n=String(e);return n.length>t?n.slice(0,t)+"...":n}function iu(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}function jb(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate message UUIDs");const t=new Uint8Array(16);return e.getRandomValues(t),iu(t)}function Tb(e){if(!e||typeof e!="object")return!1;if(e.status==="conversation_cleared")return!0;const t=e.raw;return!!t&&typeof t=="object"&&t.status==="conversation_cleared"}const lu=/^Remote Control connecting(?:…|\.\.\.)$/;function Rb(e){return typeof e=="string"&&lu.test(e.trim())}/**
3
3
  * @license lucide-react v0.555.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const cu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,o)=>o?o.toUpperCase():n.toLowerCase()),qo=e=>{const t=uu(e);return t.charAt(0).toUpperCase()+t.slice(1)},la=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim(),du=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
7
+ */const cu=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uu=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),qo=e=>{const t=uu(e);return t.charAt(0).toUpperCase()+t.slice(1)},la=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),du=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
8
8
  * @license lucide-react v0.555.0 - ISC
9
9
  *
10
10
  * This source code is licensed under the ISC license.
@@ -14,12 +14,12 @@ var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the ISC license.
16
16
  * See the LICENSE file in the root directory of this source tree.
17
- */const mu=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,...fu,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:la("lucide",r),...!s&&!du(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(s)?s:[s]]));/**
17
+ */const mu=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...i},m)=>p.createElement("svg",{ref:m,...fu,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:la("lucide",o),...!s&&!du(i)&&{"aria-hidden":"true"},...i},[...a.map(([f,l])=>p.createElement(f,l)),...Array.isArray(s)?s:[s]]));/**
18
18
  * @license lucide-react v0.555.0 - ISC
19
19
  *
20
20
  * This source code is licensed under the ISC license.
21
21
  * See the LICENSE file in the root directory of this source tree.
22
- */const ae=(e,t)=>{const n=p.forwardRef(({className:o,...r},s)=>p.createElement(mu,{ref:s,iconNode:t,className:la(`lucide-${cu(qo(e))}`,`lucide-${e}`,o),...r}));return n.displayName=qo(e),n};/**
22
+ */const ae=(e,t)=>{const n=p.forwardRef(({className:r,...o},s)=>p.createElement(mu,{ref:s,iconNode:t,className:la(`lucide-${cu(qo(e))}`,`lucide-${e}`,r),...o}));return n.displayName=qo(e),n};/**
23
23
  * @license lucide-react v0.555.0 - ISC
24
24
  *
25
25
  * This source code is licensed under the ISC license.
@@ -204,7 +204,7 @@ var uc=Object.defineProperty;var dc=(e,t,n)=>t in e?uc(e,t,{enumerable:!0,config
204
204
  *
205
205
  * This source code is licensed under the ISC license.
206
206
  * See the LICENSE file in the root directory of this source tree.
207
- */const yd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",yd),ga=p.createContext(void 0),xa="theme";function Yo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(xa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Qo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function wd(){const e=p.useContext(ga);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Cd({children:e,defaultTheme:t="system"}){const[n,o]=p.useState(()=>Xo()||t),[r,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{o(m);try{localStorage.setItem(xa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:r,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const o=e.map(r=>{const s=Zo(r,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let r=0;r<o.length;r++){const s=o[r];typeof s=="function"?s():Zo(e[r],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Sd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function kd(e){return typeof e=="object"&&e!==null&&"then"in e}function va(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Sd&&"_payload"in e&&kd(e._payload)}function ba(e){const t=_d(e),n=p.forwardRef((o,r)=>{let{children:s,...a}=o;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(jd);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}var Ed=ba("Slot");function _d(e){const t=p.forwardRef((n,o)=>{let{children:r,...s}=n;if(va(r)&&typeof Pn=="function"&&(r=Pn(r._payload)),p.isValidElement(r)){const a=Rd(r),i=Td(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ad=Symbol("radix.slottable");function jd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ad}function Td(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Rd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Nd=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return es(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=t,a=Object.keys(r).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return r[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Id=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Rt({className:e,variant:t,size:n,asChild:o=!1,...r}){const s=o?Ed:"button";return u.jsx(s,{"data-slot":"button",className:ee(Id({variant:t,size:n,className:e})),...r})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function Md(e,t){const n=p.createContext(t),o=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};o.displayName=e+"Provider";function r(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,r]}function nt(e,t=[]){let n=[];function o(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,C=p.useMemo(()=>g,Object.values(g));return u.jsx(v.Provider,{value:C,children:h})};f.displayName=s+"Provider";function l(c,d){var v;const h=((v=d==null?void 0:d[e])==null?void 0:v[m])||i,g=p.useContext(h);if(g)return g;if(a!==void 0)return a;throw new Error(`\`${c}\` must be used within \`${s}\``)}return[f,l]}const r=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return r.scopeName=e,[o,Pd(r,...t)]}function Pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const a=o.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Od=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,s,a]=Dd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:r;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${o} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,o])}const f=p.useCallback(l=>{var c;if(i){const d=Ld(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Dd({defaultProp:e,onChange:t}){const[n,o]=p.useState(e),r=p.useRef(n),s=p.useRef(t);return Od(()=>{s.current=t},[t]),p.useEffect(()=>{var a;r.current!==n&&((a=s.current)==null||a.call(s,n),r.current=n)},[n,r]),[n,o,s]}function Ld(e){return typeof e=="function"}function Ht(e){const t=Fd(e),n=p.forwardRef((o,r)=>{const{children:s,...a}=o,i=p.Children.toArray(s),m=i.find(Ud);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:r,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:r,children:s})});return n.displayName=`${e}.Slot`,n}function Fd(e){const t=p.forwardRef((n,o)=>{const{children:r,...s}=n;if(p.isValidElement(r)){const a=Bd(r),i=zd(s,r.props);return r.type!==p.Fragment&&(i.ref=o?qe(o,a):a),p.cloneElement(r,i)}return p.Children.count(r)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ya=Symbol("radix.slottable");function $d(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ya,t}function Ud(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ya}function zd(e,t){const n={...t};for(const o in t){const r=e[o],s=t[o];/^on[A-Z]/.test(o)?r&&s?n[o]=(...i)=>{const m=s(...i);return r(...i),m}:r&&(n[o]=r):o==="style"?n[o]={...r,...s}:o==="className"&&(n[o]=[r,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=Hd.reduce((e,t)=>{const n=Ht(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function wa(e,t){e&&Gs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,o]=nt(t),[r,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,_=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(r,{scope:C,itemMap:A,collectionRef:_,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:_}=v,A=s(i,b),E=ke(C,A.collectionRef);return u.jsx(m,{ref:E,children:_})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:_,...A}=v,E=it.useRef(null),L=ke(C,E),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(E,{ref:E,...A}),()=>void k.itemMap.delete(E))),u.jsx(d,{[c]:"",ref:L,children:_})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const A=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((k,j)=>A.indexOf(k.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,o]}var Wd=p.createContext(void 0);function Sa(e){const t=p.useContext(Wd);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function Gd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Vd="DismissableLayer",Or="dismissableLayer.update",Kd="dismissableLayer.pointerDownOutside",qd="dismissableLayer.focusOutside",ts,ka=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ka),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),_=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=b,L=Qd(j=>{const x=j.target,y=[...f.branches].some(T=>T.contains(x));!E||y||(r==null||r(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),k=Zd(j=>{const x=j.target;[...f.branches].some(T=>T.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return Gd(j=>{_===f.layers.size-1&&(o==null||o(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Vd;var Yd="DismissableLayerBranch",Xd=p.forwardRef((e,t)=>{const n=p.useContext(ka),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:r})});Xd.displayName=Yd;function Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let m=function(){Ea(Kd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=m,t.addEventListener("click",r.current,{once:!0})):m()}else t.removeEventListener("click",r.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function Zd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),o=p.useRef(!1);return p.useEffect(()=>{const r=s=>{s.target&&!o.current&&Ea(qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(e,t,n,{discrete:o}){const r=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?wa(r,s):r.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Jd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(r),l=Je(s),c=p.useRef(null),d=ke(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(o){let v=function(A){if(h.paused||!i)return;const E=A.target;i.contains(E)?c.current=E:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const E=A.relatedTarget;E!==null&&(i.contains(E)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&&lt(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(b);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),_.disconnect()}}},[o,i,h.paused]),p.useEffect(()=>{if(i){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(ef(sf(_a(i)),{select:!0}),document.activeElement===v&&lt(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!o||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const _=v.currentTarget,[A,E]=tf(_);A&&E?!v.shiftKey&&b===E?(v.preventDefault(),n&&lt(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&&lt(E,{select:!0})):b===_&&v.preventDefault()}},[n,o,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Jd;function ef(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(lt(o,{select:t}),document.activeElement!==n)return}function tf(e){const t=_a(e),n=ss(t,e),o=ss(t.reverse(),e);return[n,o]}function _a(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ss(e,t){for(const n of e)if(!nf(n,{upTo:t}))return n}function nf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rf(e){return e instanceof HTMLInputElement&&"select"in e}function lt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rf(e)&&t&&e.select()}}var as=of();function of(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function sf(e){return e.filter(t=>t.tagName!=="A")}var af=Zr[" useId ".trim().toString()]||(()=>{}),lf=0;function Re(e){const[t,n]=p.useState(af());return Ze(()=>{n(o=>o??String(lf++))},[e]),e||(t?`radix-${t}`:"")}const cf=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),uf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Me(e,dt(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function tt(e){return e.split("-")[0]}function qt(e){return e.split("-")[1]}function so(e){return e==="x"?"y":"x"}function ao(e){return e==="y"?"height":"width"}function Ve(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ve(e))}function df(e,t,n){n===void 0&&(n=!1);const o=qt(e),r=io(e),s=ao(r);let a=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function ff(e){const t=Dn(e);return[Lr(e),t,Lr(t)]}function Lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ls=["left","right"],cs=["right","left"],mf=["top","bottom"],pf=["bottom","top"];function hf(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?mf:pf;default:return[]}}function gf(e,t,n,o){const r=qt(e);let s=hf(tt(e),n==="start",o);return r&&(s=s.map(a=>a+"-"+r),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return uf[t]+e.slice(t.length)}function xf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aa(e){return typeof e!="number"?xf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}function us(e,t,n){let{reference:o,floating:r}=e;const s=Ve(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=o.x+o.width/2-r.width/2,c=o.y+o.height/2-r.height/2,d=o[i]/2-r[i]/2;let h;switch(m){case"top":h={x:l,y:o.y-r.height};break;case"bottom":h={x:l,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:c};break;case"left":h={x:o.x-r.width,y:c};break;default:h={x:o.x,y:o.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function vf(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=Aa(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),_=c==="floating"?{x:o,y:r,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:A,strategy:m}):_);return{top:(b.top-L.top+g.top)/E.y,bottom:(L.bottom-b.bottom+g.bottom)/E.y,left:(b.left-L.left+g.left)/E.x,right:(L.right-b.right+g.right)/E.x}}const bf=50,yf=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:r}),{x:l,y:c}=us(f,o,m),d=o,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:_}=C,{x:A,y:E,data:L,reset:k}=await _({x:l,y:c,initialPlacement:o,placement:d,strategy:r,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=E??c,g[b]={...g[b],...L},k&&h<bf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:r,middlewareData:g}},wf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=Aa(l),d={x:n,y:o},h=io(r),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",_=C?"bottom":"right",A=C?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=k?k[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(k)))&&(j=i.floating[A]||s.floating[g]);const x=E/2-L/2,y=j/2-v[g]/2-1,T=dt(c[b],y),M=dt(c[_],y),O=T,F=j-v[g]-M,I=j/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(r)!=null&&I!==z&&s.reference[g]/2-(I<O?T:M)-v[g]/2<0,w=S?I<O?I-O:I-F:0;return{[h]:d[h]+w,data:{[h]:z,centerOffset:I-z-w,...S&&{alignmentOffset:w}},reset:S}}}),Cf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(r),_=Ve(i),A=tt(i)===i,E=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:ff(i)),k=g!=="none";!d&&k&&L.push(...gf(i,v,g,E));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let T=((o=s.flip)==null?void 0:o.overflows)||[];if(l&&y.push(x[b]),c){const I=df(r,a,E);y.push(x[I[0]],x[I[1]])}if(T=[...T,{placement:r,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=j[I];if(z&&(!(c==="alignment"?_!==Ve(z):!1)||T.every(B=>Ve(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:z}};let S=(O=T.filter(w=>w.overflows[0]<=0).sort((w,B)=>w.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const w=(F=T.filter(B=>{if(k){const P=Ve(B.placement);return P===_||P==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((B,P)=>B[1]-P[1])[0])==null?void 0:F[0];w&&(S=w);break}case"initialPlacement":S=i;break}if(r!==S)return{reset:{placement:S}}}return{}}}};function ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fs(e){return cf.some(t=>e[t]>=0)}const Sf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=et(e,t);switch(r){case"referenceHidden":{const a=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await o.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},ja=new Set(["left","top"]);async function kf(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=ja.has(a)?-1:1,l=s&&m?-1:1,c=et(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*l,y:d*f}:{x:d*f,y:h*l}}const Ef=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:a,middlewareData:i}=t,m=await kf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:r+m.x,y:s+m.y,data:{...m,placement:a}}}}},_f=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:_,y:A}=b;return{x:_,y:A}}},...f}=et(e,t),l={x:n,y:o},c=await s.detectOverflow(t,f),d=Ve(tt(r)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",_=h==="y"?"bottom":"right",A=g+c[b],E=g-c[_];g=Dr(A,g,E)}if(i){const b=d==="y"?"top":"left",_=d==="y"?"bottom":"right",A=v+c[b],E=v-c[_];v=Dr(A,v,E)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-o,enabled:{[h]:a,[d]:i}}}}}},Af=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:o},c=Ve(r),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",E=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<E?h=E:h>L&&(h=L)}if(f){var b,_;const A=d==="y"?"width":"height",E=ja.has(tt(r)),L=s.reference[c]-s.floating[A]+(E&&((b=a.offset)==null?void 0:b[c])||0)+(E?0:C.crossAxis),k=s.reference[c]+s.reference[A]+(E?0:((_=a.offset)==null?void 0:_[c])||0)-(E?C.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[d]:h,[c]:g}}}},jf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(r),d=qt(r),h=Ve(r)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const _=v-l.top-l.bottom,A=g-l.left-l.right,E=dt(v-l[C],_),L=dt(g-l[b],A),k=!t.middlewareData.shift;let j=E,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(j=_),k&&!d){const T=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(T!==0||M!==0?T+M:Me(l.left,l.right)):j=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return Ta(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ye(e){var t;return(t=(Ta(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ta(e){return Yn()?e instanceof Node||e instanceof Pe(e).Node:!1}function $e(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:o,display:r}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&r!=="inline"&&r!=="contents"}function Tf(e){return/^(table|td|th)$/.test(Yt(e))}function Xn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Rf=/transform|translate|scale|rotate|perspective|filter/,Nf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!co()&&(wt(t.backdropFilter)||wt(t.filter))||Rf.test(t.willChange||"")||Nf.test(t.contain||"")}function If(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(lo(t))return t;if(Xn(t))return null;t=ft(t)}return null}function co(){return gr==null&&(gr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gr}function Wt(e){return/^(html|body|#document)$/.test(Yt(e))}function Ue(e){return Pe(e).getComputedStyle(e)}function Qn(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Ye(e);return ms(t)?t.host:t}function Ra(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ra(t)}function on(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=Ra(e),s=r===((o=e.ownerDocument)==null?void 0:o.body),a=Pe(r);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(r)?r:[],i&&n?on(i):[])}else return t.concat(r,on(r,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){const t=Ue(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=rt(e),s=r?e.offsetWidth:n,a=r?e.offsetHeight:o,i=On(n)!==s||On(o)!==a;return i&&(n=s,o=a),{width:n,height:o,$:i}}function uo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=Na(t);let a=(s?On(n.width):n.width)/o,i=(s?On(n.height):n.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Mf=Ke(0);function Ia(e){const t=Pe(e);return!co()||!t.visualViewport?Mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function _t(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(o?$e(o)&&(a=Ut(o)):a=Ut(e));const i=Pf(s,n,o)?Ia(s):Ke(0);let m=(r.left+i.x)/a.x,f=(r.top+i.y)/a.y,l=r.width/a.x,c=r.height/a.y;if(s){const d=Pe(s),h=o&&$e(o)?Pe(o):o;let g=d,v=Fr(g);for(;v&&o&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),_=Ue(v),A=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,E=b.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=E,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:_t(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Zn(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function Of(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",a=Ye(o),i=t?Xn(t.floating):!1;if(o===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(o);if((c||!c&&!s)&&((Yt(o)!=="body"||mn(a))&&(m=Qn(o)),c)){const h=_t(o);f=Ut(o),l.x=h.x+o.clientLeft,l.y=h.y+o.clientTop}const d=a&&!c&&!s?Ma(a,m):Ke(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Df(e){return Array.from(e.getClientRects())}function Lf(e){const t=Ye(e),n=Qn(e),o=e.ownerDocument.body,r=Me(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Me(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return Ue(o).direction==="rtl"&&(a+=Me(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:a,y:i}}const ps=25;function Ff(e,t){const n=Pe(e),o=Ye(e),r=n.visualViewport;let s=o.clientWidth,a=o.clientHeight,i=0,m=0;if(r){s=r.width,a=r.height;const l=co();(!l||l&&t==="fixed")&&(i=r.offsetLeft,m=r.offsetTop)}const f=Zn(o);if(f<=0){const l=o.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(o.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function $f(e,t){const n=_t(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=r*s.x,f=o*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let o;if(t==="viewport")o=Ff(e,n);else if(t==="document")o=Lf(Ye(e));else if($e(t))o=$f(t,n);else{const r=Ia(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ln(o)}function Pa(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||Pa(n,t)}function Uf(e,t){const n=t.get(e);if(n)return n;let o=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),r=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=lo(a);!m&&i.position==="fixed"&&(r=null),(s?!m&&!r:!m&&i.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||mn(a)&&!m&&Pa(e,a))?o=o.filter(l=>l!==a):r=i,a=ft(a)}return t.set(e,o),o}function zf(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Uf(t,this._c):[].concat(n),o],i=hs(t,a[0],r);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],r);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Bf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Hf(e,t,n){const o=rt(t),r=Ye(t),s=n==="fixed",a=_t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Zn(r)}if(o||!o&&!s)if((Yt(t)!=="body"||mn(r))&&(i=Qn(t)),o){const h=_t(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else r&&f();s&&!o&&r&&f();const l=r&&!o&&!s?Ma(r,i):Ke(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function xr(e){return Ue(e).position==="static"}function gs(e,t){if(!rt(e)||Ue(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ye(e)===n&&(n=n.ownerDocument.body),n}function Oa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let r=ft(e);for(;r&&!Wt(r);){if($e(r)&&!xr(r))return r;r=ft(r)}return n}let o=gs(e,t);for(;o&&Tf(o)&&xr(o);)o=gs(o,t);return o&&Wt(o)&&xr(o)&&!lo(o)?n:o||If(e)||n}const Wf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,o=await n(e.floating);return{reference:Hf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Gf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Ye,getClippingRect:zf,getOffsetParent:Oa,getElementRects:Wf,getClientRects:Df,getDimensions:Bf,getScale:Ut,isElement:$e,isRTL:Gf};function Da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kf(e,t){let n=null,o;const r=Ye(e);function s(){var i;clearTimeout(o),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(r.clientWidth-(l+d)),C=Sn(r.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let E=!0;function L(k){const j=k[0].intersectionRatio;if(j!==m){if(!E)return a();j?a(!1,j):o=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Da(f,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(L,{...A,root:r.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function qf(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,f=uo(e),l=r||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Kf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[_]=b;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?_t(e):null;m&&C();function C(){const b=_t(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(_=>{r&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Yf=Ef,Xf=_f,Qf=Cf,Zf=jf,Jf=Sf,xs=wf,em=Af,tm=(e,t,n)=>{const o=new Map,r={platform:Vf,...n},s={...r.platform,_c:o};return yf(e,t,{...r,platform:s})};var nm=typeof document<"u",rm=function(){},jn=nm?p.useLayoutEffect:rm;function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Fn(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function La(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=La(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(o);Fn(d,o)||h(o);const[g,v]=p.useState(null),[C,b]=p.useState(null),_=p.useCallback(B=>{B!==k.current&&(k.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),E=s||g,L=a||C,k=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,T=vr(m),M=vr(r),O=vr(f),F=p.useCallback(()=>{if(!k.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};M.current&&(B.platform=M.current),tm(k.current,j.current,B).then(P=>{const U={...P,isPositioned:O.current!==!1};I.current&&!Fn(x.current,U)&&(x.current=U,Gs.flushSync(()=>{c(U)}))})},[d,t,n,M,O]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const I=p.useRef(!1);jn(()=>(I.current=!0,()=>{I.current=!1}),[]),jn(()=>{if(E&&(k.current=E),L&&(j.current=L),E&&L){if(T.current)return T.current(E,L,F);F()}},[E,L,F,T,y]);const z=p.useMemo(()=>({reference:k,floating:j,setReference:_,setFloating:A}),[_,A]),S=p.useMemo(()=>({reference:E,floating:L}),[E,L]),w=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!S.floating)return B;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...B,transform:"translate("+P+"px, "+U+"px)",...La(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:w}),[l,F,z,S,w])}const sm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:o,padding:r}=typeof e=="function"?e(n):e;return o&&t(o)?o.current!=null?xs({element:o.current,padding:r}).fn(n):{}:o?xs({element:o,padding:r}).fn(n):{}}}},am=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=Xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},lm=(e,t)=>({fn:em(e).fn,options:[e,t]}),cm=(e,t)=>{const n=Qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},um=(e,t)=>{const n=Zf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=Jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},fm=(e,t)=>{const n=sm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mm="Arrow",Fa=p.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fa.displayName=mm;var pm=Fa;function hm(e){const[t,n]=p.useState(void 0);return Ze(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let a,i;if("borderBoxSize"in s){const m=s.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var fo="Popper",[$a,Xt]=nt(fo),[gm,Ua]=$a(fo),za=e=>{const{__scopePopper:t,children:n}=e,[o,r]=p.useState(null);return u.jsx(gm,{scope:t,anchor:o,onAnchorChange:r,children:n})};za.displayName=fo;var Ba="PopperAnchor",Ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,s=Ua(Ba,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(o==null?void 0:o.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),o?null:u.jsx(he.div,{...r,ref:i})});Ha.displayName=Ba;var mo="PopperContent",[xm,vm]=$a(mo),Wa=p.forwardRef((e,t)=>{var G,K,V,ne,Z,re;const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=Ua(mo,n),[b,_]=p.useState(null),A=ke(t,ue=>_(ue)),[E,L]=p.useState(null),k=hm(E),j=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=o+(s!=="center"?"-"+s:""),T=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],O=M.length>0,F={padding:T,boundary:M.filter(ym),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:w,middlewareData:B}=om({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>qf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[am({mainAxis:r+x,alignmentAxis:a}),m&&im({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?lm():void 0,...F}),m&&cm({...F}),um({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${ye}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),E&&fm({element:E,padding:i}),wm({arrowWidth:j,arrowHeight:x}),d&&dm({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Je(g);Ze(()=>{w&&(q==null||q())},[w,q]);const N=(G=B.arrow)==null?void 0:G.x,D=(K=B.arrow)==null?void 0:K.y,$=((V=B.arrow)==null?void 0:V.centerOffset)!==0,[R,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:w?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(xm,{scope:n,placedSide:P,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:w?void 0:"none"}})})})});Wa.displayName=mo;var Ga="PopperArrow",bm={top:"bottom",right:"left",bottom:"top",left:"right"},Va=p.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,s=vm(Ga,o),a=bm[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(pm,{...r,ref:n,style:{...r.style,display:"block"}})})});Va.displayName=Ga;function ym(e){return e!==null}var wm=e=>({name:"transformOrigin",options:e,fn(t){var C,b,_;const{placement:n,rects:o,middlewareData:r}=t,a=((C=r.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Ka(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=r.arrow)==null?void 0:b.x)??0)+i/2,h=(((_=r.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${o.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${o.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Ka(e){const[t,n="center"]=e.split("-");return[t,n]}var po=za,Jn=Ha,ho=Wa,go=Va,Cm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...o}=e,[r,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||r&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(he.div,{...o,ref:t}),a):null});pn.displayName=Cm;function Sm(e,t){return p.useReducer((n,o)=>t[n][o]??n,e)}var Oe=e=>{const{present:t,children:n}=e,o=km(t),r=typeof n=="function"?n({present:o.isPresent}):p.Children.only(n),s=ke(o.ref,Em(r));return typeof n=="function"||o.isPresent?p.cloneElement(r,{ref:s}):null};Oe.displayName="Presence";function km(e){const[t,n]=p.useState(),o=p.useRef(null),r=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Sm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(o.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=o.current,l=r.current;if(l!==e){const d=s.current,h=kn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!r.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=kn(o.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{o.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Em(e){var o,r;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",_m={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,Am]=Ca(hn),[jm,Ya]=nt(hn,[Am]),[Tm,Rm]=jm(hn),Xa=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Nm,{...e,ref:t})})}));Xa.displayName=hn;var Nm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=ke(t,d),g=Sa(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,_]=p.useState(!1),A=Je(f),E=qa(n),L=p.useRef(!1),[k,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(Tm,{scope:n,orientation:o,dir:g,loop:r,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:u.jsx(he.div,{tabIndex:b||k===0?-1:0,"data-orientation":o,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const T=new CustomEvent(br,_m);if(x.currentTarget.dispatchEvent(T),!T.defaultPrevented){const M=E().filter(S=>S.focusable),O=M.find(S=>S.active),F=M.find(S=>S.id===v),z=[O,F,...M].filter(Boolean).map(S=>S.ref.current);Ja(z,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>_(!1))})})}),Qa="RovingFocusGroupItem",Za=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Rm(Qa,n),c=l.currentTabStopId===f,d=qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(o)return h(),()=>g()},[o,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:o,active:r,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{o?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Pm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const E=A.indexOf(C.currentTarget);A=l.loop?Om(A,E+1):A.slice(E+1)}setTimeout(()=>Ja(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Za.displayName=Qa;var Im={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Pm(e,t,n){const o=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Im[o]}function Ja(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function Om(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Dm=Xa,Lm=Za,Fm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,En=new WeakMap,_n={},yr=0,ei=function(e){return e&&(e.host||ei(e.parentNode))},$m=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=ei(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Um=function(e,t,n,o){var r=$m(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],a=[],i=new Set,m=new Set(r),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};r.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(o),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&En.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(En.has(c)||c.removeAttribute(o),En.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,En=new WeakMap,_n={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),r=Fm(e);return r?(o.push.apply(o,Array.from(r.querySelectorAll("[aria-live], script"))),Um(o,r,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],zm=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],Bm=[...zm,...ti],Hm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Wm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,Gm,Vm]=Ca(gn),[Nt,ni]=nt(gn,[Vm,Xt,Ya]),er=Xt(),ri=Ya(),[Km,It]=Nt(gn),[qm,xn]=Nt(gn),oi=e=>{const{__scopeMenu:t,open:n=!1,children:o,dir:r,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Sa(r);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),u.jsx(po,{...i,children:u.jsx(Km,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(qm,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:o})})})};oi.displayName=gn;var Ym="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(Jn,{...r,...o,ref:t})});vo.displayName=Ym;var bo="MenuPortal",[Xm,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:o,container:r}=e,s=It(bo,t);return u.jsx(Xm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};ai.displayName=bo;var De="MenuContent",[Qm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Zm,{...r,ref:t}):u.jsx(Jm,{...r,ref:t})})})})}),Zm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),o=p.useRef(null),r=ke(t,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu);return u.jsx(wo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ep=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:o=!1,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),_=er(n),A=ri(n),E=Gm(n),[L,k]=p.useState(null),j=p.useRef(null),x=ke(t,j,C.onContentChange),y=p.useRef(0),T=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Jr:p.Fragment,S=g?{as:ep,allowPinchZoom:!0}:void 0,w=P=>{var G,K;const U=T.current+P,q=E().filter(V=>!V.disabled),N=document.activeElement,D=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=fp($,U,D),H=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){T.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&pp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(Qm,{scope:n,searchRef:T,onItemEnter:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),onItemLeave:p.useCallback(P=>{var U;B(P)||((U=j.current)==null||U.focus(),k(null))},[B]),onTriggerLeave:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:r,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=j.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Dm,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:o,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Si(C.open),"data-radix-menu-content":"",dir:b.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,D=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&D&&w(P.key));const $=j.current;if(P.target!==$||!Bm.includes(P.key))return;P.preventDefault();const H=E().filter(G=>!G.disabled).map(G=>G.ref.current);ti.includes(P.key)&&H.reverse(),up(H)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),T.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=I.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>I.current?"right":"left";F.current=N,I.current=P.clientX}}))})})})})})})});ii.displayName=De;var tp="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"group",...o,ref:t})});Co.displayName=tp;var np="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{...o,ref:t})});li.displayName=np;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:o,...r}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>o==null?void 0:o(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...r,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var ci=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:o=!1,textValue:r,...s}=e,a=yo($n,n),i=ri(n),m=p.useRef(null),f=ke(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:o,textValue:r??d,children:u.jsx(Lm,{asChild:!0,...i,focusable:!o,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),rp="MenuCheckboxItem",ui=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:o,...r}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...r,ref:t,"data-state":ko(n),onSelect:te(r.onSelect,()=>o==null?void 0:o(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ui.displayName=rp;var di="MenuRadioGroup",[op,sp]=Nt(di,{value:void 0,onValueChange:()=>{}}),fi=p.forwardRef((e,t)=>{const{value:n,onValueChange:o,...r}=e,s=Je(o);return u.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...r,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...o}=e,r=sp(mi,e.__scopeMenu),s=n===r.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...o,ref:t,"data-state":ko(s),onSelect:te(o.onSelect,()=>{var a;return(a=r.onValueChange)==null?void 0:a.call(r,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,ap]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:o,...r}=e,s=ap(So,n);return u.jsx(Oe,{present:o||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...r,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ip="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})});xi.displayName=ip;var lp="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...o}=e,r=er(n);return u.jsx(go,{...r,...o,ref:t})});vi.displayName=lp;var cp="MenuSub",[Nb,bi]=Nt(cp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),o=xn(rn,e.__scopeMenu),r=bi(rn,e.__scopeMenu),s=yo(rn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),u.jsx(vo,{asChild:!0,...f,children:u.jsx(ci,{id:r.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":r.contentId,"data-state":Si(n.open),...e,ref:qe(t,r.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,_=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:_,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:_,y:d.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Hm[o.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});yi.displayName=rn;var wi="MenuSubContent",Ci=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:o=n.forceMount,...r}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=bi(wi,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:o||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...r,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Wm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ci.displayName=wi;function Si(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function ko(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function up(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dp(e,t){return e.map((n,o)=>e[(t+o)%e.length])}function fp(e,t,n){const r=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dp(e,Math.max(s,0));r.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(r.toLowerCase()));return m!==n?m:void 0}function mp(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=oi,gp=vo,xp=ai,vp=ii,bp=Co,yp=li,wp=tr,Cp=ui,Sp=fi,kp=pi,Ep=gi,_p=xi,Ap=vi,jp=yi,Tp=Ci,nr="DropdownMenu",[Rp]=nt(nr,[ni]),Ne=ni(),[Np,ki]=Rp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:o,open:r,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:r,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Np,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(hp,{...m,open:l,onOpenChange:c,dir:o,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",Ai=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:o=!1,...r}=e,s=ki(_i,n),a=Ne(n);return u.jsx(gp,{asChild:!0,...a,children:u.jsx(he.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...r,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!o&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{o||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ai.displayName=_i;var Ip="DropdownMenuPortal",ji=e=>{const{__scopeDropdownMenu:t,...n}=e,o=Ne(t);return u.jsx(xp,{...o,...n})};ji.displayName=Ip;var Ti="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=ki(Ti,n),s=Ne(n),a=p.useRef(!1);return u.jsx(vp,{id:r.contentId,"aria-labelledby":r.triggerId,...s,...o,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=r.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!r.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ri.displayName=Ti;var Mp="DropdownMenuGroup",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(bp,{...r,...o,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(yp,{...r,...o,ref:t})});Ni.displayName=Op;var Dp="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(wp,{...r,...o,ref:t})});Ii.displayName=Dp;var Lp="DropdownMenuCheckboxItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Cp,{...r,...o,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuRadioGroup",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Sp,{...r,...o,ref:t})});Up.displayName=$p;var zp="DropdownMenuRadioItem",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(kp,{...r,...o,ref:t})});Bp.displayName=zp;var Hp="DropdownMenuItemIndicator",Wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ep,{...r,...o,ref:t})});Wp.displayName=Hp;var Gp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(_p,{...r,...o,ref:t})});Mi.displayName=Gp;var Vp="DropdownMenuArrow",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Ap,{...r,...o,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSubTrigger",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(jp,{...r,...o,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuSubContent",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...o}=e,r=Ne(n);return u.jsx(Tp,{...r,...o,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qp.displayName=Xp;var Zp=Ei,Jp=Ai,eh=ji,th=Ri,nh=Ni,rh=Ii,oh=Mi;function Pi({...e}){return u.jsx(Zp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Jp,{"data-slot":"dropdown-menu-trigger",...e})}function Di({className:e,sideOffset:t=4,...n}){return u.jsx(eh,{children:u.jsx(th,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Tn({className:e,inset:t,variant:n="default",...o}){return u.jsx(rh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o})}function sh({className:e,inset:t,...n}){return u.jsx(nh,{"data-slot":"dropdown-menu-label","data-inset":t,className:ee("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function ys({className:e,...t}){return u.jsx(oh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const ah=[{value:"light",label:"Light",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(da,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Hu,{className:"h-4 w-4"})}];function ih(){const{theme:e,setTheme:t,resolvedTheme:n}=wd();return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(da,{className:"h-4 w-4"}):u.jsx(pa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Di,{align:"end",children:ah.map(o=>u.jsxs(Tn,{onClick:()=>t(o.value),className:e===o.value?"bg-accent":"",children:[o.icon,u.jsx("span",{className:"ml-2",children:o.label})]},o.value))})]})}const ws={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.description":"输入你的用户名和密码以继续。","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"Artifacts","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建 Artifact","artifacts.empty":'还没有 Artifact。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载 Artifacts 失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"Artifact 不存在或已过期","artifacts.backToGallery":"← 返回 Artifacts","artifacts.create.title":"新建 Artifact","artifacts.editArtifact":"编辑 Artifact","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},lh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.description":"Enter your username and password to continue.","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","user.settings.language":"Language","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Li="rcs_locale";function ch(){try{const t=localStorage.getItem(Li);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=ch();const zr=new Set;function Ib(e){Eo=e;try{localStorage.setItem(Li,e)}catch{}zr.forEach(t=>t())}function uh(e){return zr.add(e),()=>{zr.delete(e)}}function Fi(){return p.useSyncExternalStore(uh,()=>Eo)}function Fe(e){return Eo==="en"?lh[e]??ws[e]??e:ws[e]??e}const dh="";let zn=null;function fh(e){zn=e}function Mb(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function mh(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,o,r){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=o,this.status=r}}async function ve(e,t,n,o){const r={"Content-Type":"application/json"};zn&&(r.Authorization=`Bearer ${zn}`);const s=`${dh}${t}`,a={method:e,headers:r,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!o&&await mh())return ve(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new wr(c,l,i.status)}return m}function Pb(){return ve("GET","/web/sessions/all")}function Ob(e){return ve("GET",`/web/sessions/${e}`)}function Db(e){return ve("GET",`/web/sessions/${e}/history`)}function Lb(){return ve("GET","/web/environments")}function Fb(e,t){return ve("POST",`/web/sessions/${e}/events`,t)}function $b(e,t){return ve("POST",`/web/sessions/${e}/control`,t)}function Ub(e){return ve("POST",`/web/sessions/${e}/interrupt`)}function zb(e){return ve("DELETE",`/web/sessions/${e}`)}function Bb(e){return ve("POST",`/web/sessions/${e}/clear`)}function Hb(e,t){return ve("PATCH",`/web/sessions/${e}`,{title:t})}function Wb(e){return ve("POST","/web/sessions",e)}function Gb(e){return ve("GET",`/web/sessions/s/${e}`)}function Vb(e){return ve("GET",`/web/sessions/${e}/shares`)}function Kb(e,t){return ve("POST",`/web/sessions/${e}/shares`,t)}function qb(e,t){return ve("DELETE",`/web/sessions/${e}/shares/${t}`)}function Yb(e,t){return ve("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Xb(e,t){return ve("DELETE",`/web/teams/${e}/environments/${t}`)}function Qb(e){return ve("POST","/web/environments/claim",{claim_token:e})}function Zb(e){const t=e!=null&&e.session_id?`?session_id=${encodeURIComponent(e.session_id)}`:"";return ve("GET",`/web/artifacts${t}`)}function Jb(e){return ve("GET",`/web/artifacts/${e}`)}function ey(e){return ve("POST","/web/artifacts",e)}function ty(e){return ve("DELETE",`/web/artifacts/${e}`)}const Hr="rcs_active_team";function ph(){try{return localStorage.getItem(Hr)}catch{return null}}let $i=ph();const Wr=new Set;function hh(){for(const e of Wr)e()}function gh(e){return Wr.add(e),()=>Wr.delete(e)}function xh(){return $i}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}$i=e,hh()}function vh(){const[e,t]=p.useState([]),[n,o]=p.useState(!0),r=p.useSyncExternalStore(gh,xh,()=>null),s=p.useCallback(async()=>{o(!0);try{const f=await ve("GET","/web/teams");t(f)}catch{t([])}finally{o(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===r)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await ve("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function bh({className:e}){Fi();const{myTeams:t,activeTeam:n,switchTeam:o,isLoading:r}=vh();return r||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:s=>{const a=s.target.value;o(a||null)},children:[u.jsx("option",{value:"",children:Fe("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Kt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Ui=p.createContext(null);function zi(){const e=p.useContext(Ui);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Dt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function yh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function wh({children:e}){const[t,n]=p.useState(null),[o,r]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),r(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const _=await Dt();n(_),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const _=await Dt();n(_),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>yh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:o,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function Ch({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const o=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(ha,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Di,{align:"end",className:"w-48",children:[u.jsx(sh,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(sd,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(bd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:o,children:[u.jsx($u,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function Sh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:o,onNavigateArtifacts:r}){return Fi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(bh,{}),e?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[u.jsx(wu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:Fe("nav.dashboard"),children:[u.jsx(Du,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),r&&u.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:Fe("artifacts.title"),children:[u.jsx(Ru,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(ih,{}),u.jsx(Ch,{onSettingsClick:o??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ny({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return u.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function kh(e){const t=new TextEncoder().encode(e);let n="";for(const r of t)n+=String.fromCharCode(r);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Bi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const o of this.onConnectionStateChange)o(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.resume)!==null}get supportsSessionList(){var t,n,o,r;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((r=(o=this._agentCapabilities)==null?void 0:o.sessionCapabilities)==null?void 0:r.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const o=new WebSocket(this.settings.proxyUrl,this.settings.token?[kh(this.settings.token)]:void 0);this.ws=o,o.onopen=()=>{if(this.ws!==o){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),o.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},o.onmessage=r=>{if(this.ws===o)try{const s=JSON.parse(r.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},o.onerror=()=>{var r;this.ws===o&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(r=this.connectReject)==null||r.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},o.onclose=r=>{if(this.ws===o){if(console.log("[ACPClient] WebSocket closed",r.code,r.reason),this.connectReject){const s=r.reason||`Connection closed (code: ${r.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(o){this.setState("error",o.message),n(o)}})}handleResponse(t){var n,o,r,s,a,i,m,f,l,c,d,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((o=t.payload)==null?void 0:o.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(r=this.onErrorMessage)==null||r.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const C=(l=t.payload.update)==null?void 0:l.sessionUpdate;if(console.log("[ACPClient] session_update type:",C,"payload:",t.payload),C==="available_commands_update")this._availableCommands=t.payload.update.availableCommands,console.log("[ACPClient] Available commands updated:",this._availableCommands.length,"commands"),(c=this.onAvailableCommandsChanged)==null||c.call(this,this._availableCommands);else if(C==="usage_update"){this._usage=t.payload.update;for(const b of this.onUsageChanged)b(this._usage)}else if(C==="current_mode_update"){this._currentModeId=t.payload.update.currentModeId;for(const b of this.onCurrentModeChanged)b(this._currentModeId)}else if(C==="config_option_update"){this._configOptions=t.payload.update.configOptions;for(const b of this.onConfigOptionsChanged)b(this._configOptions)}(d=this.onSessionUpdate)==null||d.call(this,t.payload.sessionId,t.payload.update);break;case"prompt_complete":(h=this.onPromptComplete)==null||h.call(this,t.payload.stopReason);break;case"permission_request":console.log("[ACPClient] Permission request:",t.payload),(g=this.onPermissionRequest)==null||g.call(this,t.payload);break;case"model_changed":console.log("[ACPClient] Model changed:",t.payload.modelId),this._modelState&&(this._modelState={...this._modelState,currentModelId:t.payload.modelId});for(const b of this.onModelChanged)b(t.payload.modelId);break;case"browser_tool_call":this.handleBrowserToolCall(t.callId,t.params);break;case"pong":this.missedPongs=0,this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null);break}}resetSessionUsageState(){this._usage=null,this._currentModeId=null,this._configOptions=[];for(const t of this.onUsageChanged)t(null);for(const t of this.onCurrentModeChanged)t(null);for(const t of this.onConfigOptionsChanged)t([])}async handleBrowserToolCall(t,n){if(console.log("[ACPClient] Browser tool call:",t,n),!this.onBrowserToolCall){console.error("[ACPClient] No browser tool handler registered"),this.send({type:"browser_tool_result",callId:t,result:{error:"No browser tool handler registered"}});return}try{const o=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:o})}catch(o){console.error("[ACPClient] Browser tool error:",o),this.send({type:"browser_tool_result",callId:t,result:{error:o.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=ct.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},ct.PONG_TIMEOUT_MS)},ct.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const o=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:o,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const o=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:o}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,o)=>{const r=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,o(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:o,timer:r};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(r),this.pendingSessionList=null,o(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:o,timer:r};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionLoad=null,o(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,o)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const r=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,o(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:o,timer:r};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(r),this.pendingSessionTarget=null,this.pendingSessionResume=null,o(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Bi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const o of this.onModelStateChanged)o(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function Eh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(o){if(o!=="default"&&!(o in e)){var r=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:function(){return n[o]}})}}))})),Object.freeze(e)}function Hi(e,t){return new Promise((function(n,o){let r;return _h(e).then((function(s){try{return r=s,n(new Blob([t.slice(0,2),r,t.slice(2)],{type:"image/jpeg"}))}catch(a){return o(a)}}),o)}))}const _h=e=>new Promise(((t,n)=>{const o=new FileReader;o.addEventListener("load",(({target:{result:r}})=>{const s=new DataView(r);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(r.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),o.readAsArrayBuffer(e)}));var Bn={},Ah={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,o={};Ah.exports=o,o.parse=function(r,s){for(var a=o.bin.readUshort,i=o.bin.readUint,m=0,f={},l=new Uint8Array(r),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),_=a(l,m+2),A=a(l,m+4);m+=6;var E=i(l,m+=8);m+=4,m+=b+_+A,o._readLocal(l,E,f,h,C,s)}return f},o._readLocal=function(r,s,a,i,m,f){var l=o.bin.readUshort,c=o.bin.readUint;c(r,s),l(r,s+=4),l(r,s+=2);var d=l(r,s+=2);c(r,s+=2),c(r,s+=4),s+=4;var h=l(r,s+=8),g=l(r,s+=2);s+=2;var v=o.bin.readUTF8(r,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(r.buffer,s);if(d==0)a[v]=new Uint8Array(C.buffer.slice(s,s+i));else{if(d!=8)throw"unknown compression method: "+d;var b=new Uint8Array(m);o.inflateRaw(C,b),a[v]=b}}},o.inflateRaw=function(r,s){return o.F.inflate(r,s)},o.inflate=function(r,s){return r[0],r[1],o.inflateRaw(new Uint8Array(r.buffer,r.byteOffset+2,r.length-6),s)},o.deflate=function(r,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*r.length));i[a]=120,i[a+1]=156,a+=2,a=o.F.deflateRaw(r,i,a,s.level);var m=o.adler(r,0,r.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},o.deflateRaw=function(r,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*r.length)),i=o.F.deflateRaw(r,a,i,s.level);return new Uint8Array(a.buffer,0,i)},o.encode=function(r,s){s==null&&(s=!1);var a=0,i=o.bin.writeUint,m=o.bin.writeUshort,f={};for(var l in r){var c=!o._noNeed(l)&&!s,d=r[l],h=o.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?o.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*o.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=o._writeHeader(g,v,l,b,0)}var _=0,A=v;for(var l in f)b=f[l],C.push(v),v=o._writeHeader(g,v,l,b,1,C[_++]);var E=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,E),i(g,v+=4,A),v+=4,v+=2,g.buffer},o._noNeed=function(r){var s=r.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},o._writeHeader=function(r,s,a,i,m,f){var l=o.bin.writeUint,c=o.bin.writeUshort,d=i.file;return l(r,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(r,s,20),c(r,s+=2,0),c(r,s+=2,i.cpr?8:0),l(r,s+=2,0),l(r,s+=4,i.crc),l(r,s+=4,d.length),l(r,s+=4,i.usize),c(r,s+=4,o.bin.sizeUTF8(a)),c(r,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(r,s+=6,f),s+=4),s+=o.bin.writeUTF8(r,s,a),m==0&&(r.set(d,s),s+=d.length),s},o.crc={table:(function(){for(var r=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;r[s]=a}return r})(),update:function(r,s,a,i){for(var m=0;m<i;m++)r=o.crc.table[255&(r^s[a+m])]^r>>>8;return r},crc:function(r,s,a){return 4294967295^o.crc.update(4294967295,r,s,a)}},o.adler=function(r,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=r[f++];i%=65521,m%=65521}return m<<16|i},o.bin={readUshort:function(r,s){return r[s]|r[s+1]<<8},writeUshort:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255},readUint:function(r,s){return 16777216*r[s+3]+(r[s+2]<<16|r[s+1]<<8|r[s])},writeUint:function(r,s,a){r[s]=255&a,r[s+1]=a>>8&255,r[s+2]=a>>16&255,r[s+3]=a>>24&255},readASCII:function(r,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(r[s+m]);return i},writeASCII:function(r,s,a){for(var i=0;i<a.length;i++)r[s+i]=a.charCodeAt(i)},pad:function(r){return r.length<2?"0"+r:r},readUTF8:function(r,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+o.bin.pad(r[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return o.bin.readASCII(r,s,a)}return i},writeUTF8:function(r,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)r[s+m]=l,m++;else if((4294965248&l)==0)r[s+m]=192|l>>6,r[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)r[s+m]=224|l>>12,r[s+m+1]=128|l>>6&63,r[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";r[s+m]=240|l>>18,r[s+m+1]=128|l>>12&63,r[s+m+2]=128|l>>6&63,r[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(r){for(var s=r.length,a=0,i=0;i<s;i++){var m=r.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},o.F={},o.F.deflateRaw=function(r,s,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=o.F.U,l=o.F._goodIndex;o.F._hash;var c=o.F._putsE,d=0,h=a<<3,g=0,v=r.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=o.F._copyExact(r,d,M,s,h+8),d+=M;return h>>>3}var C=f.lits,b=f.strt,_=f.prev,A=0,E=0,L=0,k=0,j=0,x=0;for(v>2&&(b[x=o.F._hash(r,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=o.F._hash(r,d+1);var y=d+1&32767;_[y]=b[x],b[x]=y}if(g<=d){(A>14e3||E>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(d==v-1||g==v?1:0,C,A,k,r,L,d-L,s,h),A=E=k=0,L=d);var T=0;d<v-2&&(T=o.F._bestMatch(r,d,_,j,Math.min(m[2],v-d),m[3]));var M=T>>>16,O=65535&T;if(T!=0){O=65535&T;var F=l(M=T>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],C[A]=M<<23|d-g,C[A+1]=O<<16|F<<8|I,A+=2,g=d+M}else f.lhst[r[d]]++;E++}}for(L==d&&r.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=o.F._writeBlock(1,C,A,k,r,L,d-L,s,h),A=0,E=0,A=E=k=0,L=d);(7&h)!=0;)h++;return h>>>3},o.F._bestMatch=function(r,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=o.F._hash(r,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||r[s+h]==r[s+h-d]){var C=o.F._howLong(r,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,_=0;_<C-2;_++){var A=s-d+_+32768&32767,E=A-a[A]+32768&32767;E>b&&(b=E,c=A)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},o.F._howLong=function(r,s,a){if(r[s]!=r[s-a]||r[s+1]!=r[s+1-a]||r[s+2]!=r[s+2-a])return 0;var i=s,m=Math.min(r.length,s+258);for(s+=3;s<m&&r[s]==r[s-a];)s++;return s-i},o.F._hash=function(r,s){return(r[s]<<8|r[s+1])+(r[s+2]<<4)&65535},o.saved=0,o.F._writeBlock=function(r,s,a,i,m,f,l,c,d){var h,g,v,C,b,_,A,E,L,k=o.F.U,j=o.F._putsF,x=o.F._putsE;k.lhst[256]++,g=(h=o.F.getTrees())[0],v=h[1],C=h[2],b=h[3],_=h[4],A=h[5],E=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),T=i+o.F.contSize(k.fltree,k.lhst)+o.F.contSize(k.fdtree,k.dhst),M=i+o.F.contSize(k.ltree,k.lhst)+o.F.contSize(k.dtree,k.dhst);M+=14+3*A+o.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<T&&y<M?0:T<M?1:2;if(j(c,d,r),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=o.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){o.F.makeCodes(k.ltree,g),o.F.revCodes(k.ltree,g),o.F.makeCodes(k.dtree,v),o.F.revCodes(k.dtree,v),o.F.makeCodes(k.itree,C),o.F.revCodes(k.itree,C),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,_-1),x(c,d+=5,A-4),d+=4;for(var S=0;S<A;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*A,d=o.F._codeTiny(E,k.itree,c,d),d=o.F._codeTiny(L,k.itree,c,d)}for(var w=f,B=0;B<a;B+=2){for(var P=s[B],U=P>>>23,q=w+(8388607&P);w<q;)d=o.F._writeLit(m[w++],I,c,d);if(U!=0){var N=s[B+1],D=N>>16,$=N>>8&255,R=255&N;x(c,d=o.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],j(c,d=o.F._writeLit(R,z,c,d),D-k.df0[R]),d+=k.dxb[R],w+=U}}d=o.F._writeLit(256,I,c,d)}return d},o.F._copyExact=function(r,s,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(r.buffer,s,a),f),m+(a+4<<3)},o.F.getTrees=function(){for(var r=o.F.U,s=o.F._hufTree(r.lhst,r.ltree,15),a=o.F._hufTree(r.dhst,r.dtree,15),i=[],m=o.F._lenCodes(r.ltree,i),f=[],l=o.F._lenCodes(r.dtree,f),c=0;c<i.length;c+=2)r.ihst[i[c]]++;for(c=0;c<f.length;c+=2)r.ihst[f[c]]++;for(var d=o.F._hufTree(r.ihst,r.itree,7),h=19;h>4&&r.itree[1+(r.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},o.F.getSecond=function(r){for(var s=[],a=0;a<r.length;a+=2)s.push(r[a+1]);return s},o.F.nonZero=function(r){for(var s="",a=0;a<r.length;a+=2)r[a+1]!=0&&(s+=(a>>1)+",");return s},o.F.contSize=function(r,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*r[1+(i<<1)];return a},o.F._codeTiny=function(r,s,a,i){for(var m=0;m<r.length;m+=2){var f=r[m],l=r[m+1];i=o.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(o.F._putsE(a,i,l,c),i+=c)}return i},o.F._lenCodes=function(r,s){for(var a=r.length;a!=2&&r[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=r[i+1],f=i+3<a?r[i+3]:-1,l=i+5<a?r[i+5]:-1,c=i==0?-1:r[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&r[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&r[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},o.F._hufTree=function(r,s,a){var i=[],m=r.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)r[l]!=0&&i.push({lit:l,f:r[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(E,L){return E.f-L.f}));var g=i[0],v=i[1],C=0,b=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=o.F.setDepth(i[b-1],0);for(A>a&&(o.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},o.F.setDepth=function(r,s){return r.lit!=-1?(r.d=s,s):Math.max(o.F.setDepth(r.l,s+1),o.F.setDepth(r.r,s+1))},o.F.restrictDepth=function(r,s,a){var i=0,m=1<<a-s,f=0;for(r.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<r.length&&r[i].d>s;i++){var l=r[i].d;r[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=r[i].d)<s?(r[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)r[i].d==s&&f<0&&(r[i].d--,f++);f!=0&&console.log("debt left")},o.F._goodIndex=function(r,s){var a=0;return s[16|a]<=r&&(a|=16),s[8|a]<=r&&(a|=8),s[4|a]<=r&&(a|=4),s[2|a]<=r&&(a|=2),s[1|a]<=r&&(a|=1),a},o.F._writeLit=function(r,s,a,i){return o.F._putsF(a,i,s[r<<1]),i+s[1+(r<<1)]},o.F.inflate=function(r,s){var a=Uint8Array;if(r[0]==3&&r[1]==0)return s||new a(0);var i=o.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(r.length>>>2<<3));for(var C,b,_=0,A=0,E=0,L=0,k=0,j=0,x=0,y=0,T=0;_==0;)if(_=m(r,T,1),A=m(r,T+1,2),T+=3,A!=0){if(v&&(s=o.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){E=f(r,T,5)+257,L=f(r,T+5,5)+1,k=f(r,T+10,4)+4,T+=14;for(var M=0;M<38;M+=2)g.itree[M]=0,g.itree[M+1]=0;var O=1;for(M=0;M<k;M++){var F=f(r,T+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}T+=3*k,c(g.itree,O),d(g.itree,O,g.imap),C=g.lmap,b=g.dmap,T=l(g.imap,(1<<O)-1,E+L,r,T,g.ttree);var I=i._copyOut(g.ttree,0,E,g.ltree);j=(1<<I)-1;var z=i._copyOut(g.ttree,E,L,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,C),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=C[h(r,T)&j];T+=15&S;var w=S>>>4;if(!(w>>>8))s[y++]=w;else{if(w==256)break;var B=y+w-254;if(w>264){var P=g.ldef[w-257];B=y+(P>>>3)+f(r,T,7&P),T+=7&P}var U=b[h(r,T)&x];T+=15&U;var q=U>>>4,N=g.ddef[q],D=(N>>>4)+m(r,T,15&N);for(T+=15&N,v&&(s=o.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&T)!=0&&(T+=8-(7&T));var $=4+(T>>>3),R=r[$-4]|r[$-3]<<8;v&&(s=o.F._check(s,y+R)),s.set(new a(r.buffer,r.byteOffset+$,R),y),T=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},o.F._check=function(r,s){var a=r.length;if(s<=a)return r;var i=new Uint8Array(Math.max(a<<1,s));return i.set(r,0),i},o.F._decodeTiny=function(r,s,a,i,m,f){for(var l=o.F._bitsE,c=o.F._get17,d=0;d<a;){var h=r[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,C=0;g==16?(C=3+l(i,m,2),m+=2,v=f[d-1]):g==17?(C=3+l(i,m,3),m+=3):g==18&&(C=11+l(i,m,7),m+=7);for(var b=d+C;d<b;)f[d]=v,d++}}return m},o.F._copyOut=function(r,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=r[f+s];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},o.F.makeCodes=function(r,s){for(var a,i,m,f,l=o.F.U,c=r.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[r[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=r[m+1])!=0&&(r[m]=g[f],g[f]++)},o.F.codes2map=function(r,s,a){for(var i=r.length,m=o.F.U.rev15,f=0;f<i;f+=2)if(r[f+1]!=0)for(var l=f>>1,c=r[f+1],d=l<<4|c,h=s-c,g=r[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},o.F.revCodes=function(r,s){for(var a=o.F.U.rev15,i=15-s,m=0;m<r.length;m+=2){var f=r[m]<<s-r[m+1];r[m]=a[f]>>>i}},o.F._putsE=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8},o.F._putsF=function(r,s,a){a<<=7&s;var i=s>>>3;r[i]|=a,r[i+1]|=a>>>8,r[i+2]|=a>>>16},o.F._bitsE=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},o.F._bitsF=function(r,s,a){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},o.F._get17=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16)>>>(7&s)},o.F._get25=function(r,s){return(r[s>>>3]|r[1+(s>>>3)]<<8|r[2+(s>>>3)]<<16|r[3+(s>>>3)]<<24)>>>(7&s)},o.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var r=o.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,r.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)r.ldef[s]=r.of0[s]<<3|r.exb[s],r.ddef[s]=r.df0[s]<<4|r.dxb[s];i(r.fltree,144,8),i(r.fltree,112,9),i(r.fltree,24,7),i(r.fltree,8,8),o.F.makeCodes(r.fltree,9),o.F.codes2map(r.fltree,9,r.flmap),o.F.revCodes(r.fltree,9),i(r.fdtree,32,5),o.F.makeCodes(r.fdtree,5),o.F.codes2map(r.fdtree,5,r.fdmap),o.F.revCodes(r.fdtree,5),i(r.itree,19,0),i(r.ltree,286,0),i(r.dtree,30,0),i(r.ttree,320,0)})()})();var jh=Eh({__proto__:null,default:Bn},[Bn]);const Le=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),_=new Uint32Array(b.buffer),{ctype:A}=h,{depth:E}=h,L=e.readUshort;if(A==6){const P=g<<2;if(E==8)for(var k=0;k<P;k+=4)b[k]=l[k],b[k+1]=l[k+1],b[k+2]=l[k+2],b[k+3]=l[k+3];if(E==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(E==8)for(k=0;k<g;k++){var j=3*k;_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(E==16)for(k=0;k<g;k++)j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=P[0];const U=P[1],q=P[2];if(E==8)for(k=0;k<g;k++){var y=k<<2;j=3*k,_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==U&&l[j+2]==q&&(b[y+3]=0)}if(E==16)for(k=0;k<g;k++)y=k<<2,j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==U&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(E==1)for(var T=0;T<d;T++){var M=T*C,O=T*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(I=l[M+(k>>3)]>>7-((7&k)<<0)&1);b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}if(E==2)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>2)]>>6-((3&k)<<1)&3),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==4)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>1)]>>4-((1&k)<<2)&15),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==8)for(k=0;k<g;k++){var I;y=k<<2,F=3*(I=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}else if(A==4){if(E==8)for(k=0;k<g;k++){y=k<<2;var z=l[S=k<<1];b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+1]}if(E==16)for(k=0;k<g;k++){var S;y=k<<2,z=l[S=k<<2],b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,T=0;T<d;T++){const P=T*C,U=T*c;if(E==1)for(var w=0;w<c;w++){var B=(z=255*(l[P+(w>>>3)]>>>7-(7&w)&1))==255*x?0:255;_[U+w]=B<<24|z<<16|z<<8|z}else if(E==2)for(w=0;w<c;w++)B=(z=85*(l[P+(w>>>2)]>>>6-((3&w)<<1)&3))==85*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==4)for(w=0;w<c;w++)B=(z=17*(l[P+(w>>>1)]>>>4-((1&w)<<2)&15))==17*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==8)for(w=0;w<c;w++)B=(z=l[P+w])==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==16)for(w=0;w<c;w++)z=l[P+(w<<1)],B=L(l,P+(w<<1))==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?r(c,C):o(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(_,A){const E=A.width,L=A.height,k=s(A),j=k>>3,x=Math.ceil(E*k/8),y=new Uint8Array(L*x);let T=0;const M=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const w=F[z],B=I[z];let P=0,U=0,q=M[z];for(;q<L;)q+=w,U++;let N=O[z];for(;N<E;)N+=B,P++;const D=Math.ceil(P*k/8);a(_,A,T,P,U);let $=0,R=M[z];for(;R<L;){let H=O[z],G=T+$*D<<3;for(;H<E;){var S;if(k==1&&(S=(S=_[G>>3])>>7-(7&G)&1,y[R*x+(H>>3)]|=S<<7-((7&H)<<0)),k==2&&(S=(S=_[G>>3])>>6-(7&G)&3,y[R*x+(H>>2)]|=S<<6-((3&H)<<1)),k==4&&(S=(S=_[G>>3])>>4-(7&G)&15,y[R*x+(H>>1)]|=S<<4-((1&H)<<2)),k>=8){const K=R*x+H*j;for(let V=0;V<j;V++)y[K+V]=_[(G>>3)+V]}G+=k,H+=B}$++,R+=w}P*U!=0&&(T+=U*(1+D)),z+=1}return y})(c,l)),c}function o(l,c){return r(new Uint8Array(l.buffer,2,l.length-6),c)}var r=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,_=0,A=0,E=0,L=0,k=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,T=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,w=d==null;for(w&&(d=new h(c.length>>>2<<5));C==0;)if(C=T(c,x,1),b=T(c,x+1,2),x+=3,b!=0){if(w&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=S.J,v=S.h,L=511,k=31),b==2){_=M(c,x,5)+257,A=M(c,x+5,5)+1,E=M(c,x+10,4)+4,x+=14;let P=1;for(var B=0;B<38;B+=2)S.Q[B]=0,S.Q[B+1]=0;for(B=0;B<E;B++){const N=M(c,x+3*B,3);S.Q[1+(S.X[B]<<1)]=N,N>P&&(P=N)}x+=3*E,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,_+A,c,x,S.v);const U=y.V(S.v,0,_,S.C);L=(1<<U)-1;const q=y.V(S.v,_,A,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,v)}for(;;){const P=g[z(c,x)&L];x+=15&P;const U=P>>>4;if(!(U>>>8))d[j++]=U;else{if(U==256)break;{let q=j+U-254;if(U>264){const H=S.q[U-257];q=j+(H>>>3)+M(c,x,7&H),x+=7&H}const N=v[z(c,x)&k];x+=15&N;const D=N>>>4,$=S.c[D],R=($>>>4)+T(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;w&&(d=l.H.W(d,j+U)),d.set(new h(c.buffer,c.byteOffset+P,U),j),x=P+U<<3,j+=U}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,_=l.H.Z;let A=0;for(;A<h;){const E=c[_(g,v)&d];v+=15&E;const L=E>>>4;if(L<=15)C[A]=L,A++;else{let k=0,j=0;L==16?(j=3+b(g,v,2),v+=2,k=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=k,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const _=c[C+d];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,_;const A=h.j;for(var E=0;E<=d;E++)A[E]=0;for(E=1;E<g;E+=2)A[c[E]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)_=c[b+1],_!=0&&(c[b]=L[_],L[_]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,_=c[C+1],A=b<<4|_,E=d-_;let L=c[C]<<E;const k=L+(1<<E);for(;L!=k;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,c.r[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,_;v=Math.ceil(v/8);let A=l[d],E=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(E=v;E<C;E++)l[E+1]=l[E+1]+(l[E+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,_=b+L+1,A=l[_-1],E=0,A==0)for(;E<C;E++)l[b+E]=l[_+E];else if(A==1){for(;E<v;E++)l[b+E]=l[_+E];for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-v]}else if(A==2)for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-C];else if(A==3){for(;E<v;E++)l[b+E]=l[_+E]+(l[b+E-C]>>>1);for(;E<C;E++)l[b+E]=l[_+E]+(l[b+E-C]+l[b+E-v]>>>1)}else{for(;E<v;E++)l[b+E]=l[_+E]+i(0,l[b+E-C],0);for(;E<C;E++)l[b+E]=l[_+E]+i(l[b+E-v],l[b+E-C],l[b+E-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,_){const A=Math.min(c,g),E=Math.min(d,v);let L=0,k=0;for(let z=0;z<E;z++)for(let S=0;S<A;S++)if(C>=0&&b>=0?(L=z*c+S<<2,k=(b+z)*g+C+S<<2):(L=(-b+z)*c-C+S<<2,k=z*g+S<<2),_==0)h[k]=l[L],h[k+1]=l[L+1],h[k+2]=l[L+2],h[k+3]=l[L+3];else if(_==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,T=l[L+2]*j,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const w=1-j,B=j+M*w,P=B==0?0:1/B;h[k+3]=255*B,h[k+0]=(x+O*w)*P,h[k+1]=(y+F*w)*P,h[k+2]=(T+I*w)*P}else if(_==2)j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=y,h[k+2]=T,h[k+3]=j);else if(_==3){if(j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I)continue;if(j<220&&M>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},_=new Uint8Array(d.length);let A,E=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=k[j])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,b);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const w=d.slice(x+2,h+z);let B=null;try{B=o(w)}catch{B=r(w)}b.tabs[S]=B}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(j=0;j<z;j++)_[E+j]=d[h+j];E+=z}else if(S=="acTL")b.tabs[S]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(S=="fcTL"){L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height),L=0);const w={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const P={rect:w,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(j=0;j<z-4;j++)A[L+j]=d[h+j+4];L+=z-4}else if(S=="pHYs")b.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(b.tabs[S]=[],j=0;j<8;j++)b.tabs[S].push(g.readUint(d,h+4*j));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),T=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=o(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][T]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),T=g.readASCII(d,x,y-x);const w=d[x=y+1];var F;d[x+1],x+=2,y=g.nextZero(d,x),g.readASCII(d,x,y-x),x=y+1,y=g.nextZero(d,x),g.readUTF8(d,x,y-x),M=z-((x=y+1)-h),w==0?F=g.readUTF8(d,x,M):(O=o(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][T]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const w=b.tabs.PLTE.length/3;for(b.tabs[S]=[],j=0;j<w;j++)b.tabs[S].push(v(d,h+2*j))}else if(S=="tRNS")b.ctype==3?b.tabs[S]=g.readBytes(d,h,z):b.ctype==0?b.tabs[S]=v(d,h):b.ctype==2&&(b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(S=="gAMA")b.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")b.tabs[S]=d[h];else if(S=="bKGD")b.ctype==0||b.ctype==4?b.tabs[S]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),_=new Uint8Array(v);for(let E=0;E<c.frames.length;E++){const L=c.frames[E],k=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,T=t(L.data,x,y,c);if(E!=0)for(var A=0;A<v;A++)_[A]=C[A];if(L.blend==0?f(T,x,y,C,d,h,k,j,0):L.blend==1&&f(T,x,y,C,d,h,k,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,k,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=_[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var o={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let M=0;M<8;M++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,M){for(let O=0;O<M;O++)x=o.table[255&(x^y[T+O])]^x>>>8;return x},crc:(x,y,T)=>4294967295^o.update(4294967295,x,y,T)};function r(x,y,T,M){y[T]+=x[0]*M>>4,y[T+1]+=x[1]*M>>4,y[T+2]+=x[2]*M>>4,y[T+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const T=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return T*T+M*M+O*O+F*F}function i(x,y,T,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var w=0;w<z;w++){const R=M[w];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(w=0;w<z;w++){let R=4294967295;for(var B=0,P=0;P<z;P++){var U=a(S[w],S[P]);P!=w&&U<R&&(R=U,B=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*T*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(w=0;w<D.length;w++)D[w]=255*((D[w]+.5)/16-.5);for(let R=0;R<T;R++)for(let H=0;H<y;H++){var $;w=4*(R*y+H),I!=2?$=[s(x[w]+N[w]),s(x[w+1]+N[w+1]),s(x[w+2]+N[w+2]),s(x[w+3]+N[w+3])]:(U=D[4*(3&R)+(3&H)],$=[s(x[w]+U),s(x[w+1]+U),s(x[w+2]+U),s(x[w+3]+U)]),B=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,B=P)}const K=S[B],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(H!=y-1&&r(V,N,w+4,7),R!=T-1&&(H!=0&&r(V,N,w+4*y-4,3),r(V,N,w+4*y,5),H!=y-1&&r(V,N,w+4*y+4,1))),F[w>>2]=B,q[w>>2]=M[B]}}function m(x,y,T,M,O){O==null&&(O={});const{crc:F}=o,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let w=8;const B=x.frames.length>1;let P,U=!1,q=33+(B?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(P=pako.deflate(O.iCCP),q+=21+P.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)R[D]=H[D];if(I(R,w,13),w+=4,S(R,w,"IHDR"),w+=4,I(R,w,y),w+=4,I(R,w,T),w+=4,R[w]=x.depth,w++,R[w]=x.ctype,w++,R[w]=0,w++,R[w]=0,w++,R[w]=0,w++,I(R,w,F(R,w-17,17)),w+=4,O.sRGB!=null&&(I(R,w,1),w+=4,S(R,w,"sRGB"),w+=4,R[w]=O.sRGB,w++,I(R,w,F(R,w-5,5)),w+=4),O.iCCP!=null){const V=13+P.length;I(R,w,V),w+=4,S(R,w,"iCCP"),w+=4,S(R,w,"ICC profile"),w+=11,w+=2,R.set(P,w),w+=P.length,I(R,w,F(R,w-(V+4),V+4)),w+=4}if(O.pHYs!=null&&(I(R,w,9),w+=4,S(R,w,"pHYs"),w+=4,I(R,w,O.pHYs[0]),w+=4,I(R,w,O.pHYs[1]),w+=4,R[w]=O.pHYs[2],w++,I(R,w,F(R,w-13,13)),w+=4),B&&(I(R,w,8),w+=4,S(R,w,"acTL"),w+=4,I(R,w,x.frames.length),w+=4,I(R,w,O.loop!=null?O.loop:0),w+=4,I(R,w,F(R,w-12,12)),w+=4),x.ctype==3){for(I(R,w,3*(N=x.plte.length)),w+=4,S(R,w,"PLTE"),w+=4,D=0;D<N;D++){const V=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[w+V+0]=Z,R[w+V+1]=re,R[w+V+2]=ue}if(w+=3*N,I(R,w,F(R,w-3*N-4,3*N+4)),w+=4,U){for(I(R,w,N),w+=4,S(R,w,"tRNS"),w+=4,D=0;D<N;D++)R[w+D]=x.plte[D]>>>24&255;w+=N,I(R,w,F(R,w-N-4,N+4)),w+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(I(R,w,26),w+=4,S(R,w,"fcTL"),w+=4,I(R,w,G++),w+=4,I(R,w,K.rect.width),w+=4,I(R,w,K.rect.height),w+=4,I(R,w,K.rect.x),w+=4,I(R,w,K.rect.y),w+=4,z(R,w,M[$]),w+=2,z(R,w,1e3),w+=2,R[w]=K.dispose,w++,R[w]=K.blend,w++,I(R,w,F(R,w-30,30)),w+=4);const V=K.cimg;I(R,w,(N=V.length)+($==0?0:4)),w+=4;const ne=w;S(R,w,$==0?"IDAT":"fdAT"),w+=4,$!=0&&(I(R,w,G++),w+=4),R.set(V,w),w+=N,I(R,w,F(R,ne,w-ne)),w+=4}return I(R,w,0),w+=4,S(R,w,"IEND"),w+=4,I(R,w,F(R,w-4,4)),w+=4,R.buffer}function f(x,y,T){for(let M=0;M<x.frames.length;M++){const O=x.frames[M];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,y,T)}}function l(x,y,T,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],w=O[4],B=O[5];let P=6,U=8,q=255;for(var N=0;N<x.length;N++){const ye=new Uint8Array(x[N]);for(var D=ye.length,$=0;$<D;$+=4)q&=ye[$+3]}const R=q!=255,H=(function(fe,ie,ge,we,me,_e){const Ce=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Se=0,le=0,xe=ie,Xe=ge,Mt=we?1:0;if(pe!=0){const lc=_e||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<lc;Zt++){var Be=new Uint8Array(fe[pe-1-Zt]);const cc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=cc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Se=ot,le=st,xe=Pt-ot+1,Xe=Jt-st+1)}Be=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),Te=new Uint8Array(xe*Xe*4),e(Be,ie,ge,Te,xe,Xe,-Se,-le,0),Mt=e(J,ie,ge,Te,xe,Xe,-Se,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Se,y:le,width:xe,height:Xe}):e(J,ie,ge,Te,xe,Xe,-Se,-le,0)}else Te=J.slice(0);Ce.push({rect:{x:Se,y:le,width:xe,height:Xe},img:Te,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const J=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),xe={x:Se,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Se,height:Math.max(J.y+J.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,Ce,pe-1,xe,me),c(fe,ie,ge,Ce,pe,xe,me)}let xt=0;if(fe.length!=1)for(var W=0;W<Ce.length;W++){var Y;xt+=(Y=Ce[W]).rect.width*Y.rect.height}return Ce})(x,y,T,F,I,z),G={},K=[],V=[];if(M!=0){const ye=[];for($=0;$<H.length;$++)ye.push(H[$].img.buffer);const fe=(function(me){let _e=0;for(var Ce=0;Ce<me.length;Ce++)_e+=me[Ce].byteLength;const pe=new Uint8Array(_e);let Te=0;for(Ce=0;Ce<me.length;Ce++){const Be=new Uint8Array(me[Ce]),xt=Be.length;for(let W=0;W<xt;W+=4){let Y=Be[W],J=Be[W+1],ce=Be[W+2];const Se=Be[W+3];Se==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Se}Te+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const we=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,ge,we);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=we}}else for(N=0;N<H.length;N++){var Z=H[N];const ye=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=ye.length,ne=new Uint8Array(D),V.push(ne),$=0;$<D;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])ne[$]=ne[$-1];else if($>re&&fe==ye[$-re])ne[$]=ne[$-re];else{let ie=G[fe];if(ie==null&&(G[fe]=ie=K.length,K.push(fe),K.length>=300))break;ne[$]=ie}}}const ue=K.length;for(ue<=256&&w==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&w==0){ie=Math.ceil(U*re/8);var be=new Uint8Array(ie*ye);const we=V[N];for(let me=0;me<ye;me++){$=me*ie;const _e=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[_e+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[_e+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[_e+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[_e+de]<<7-1*(7&de)}fe=be,P=3,ge=1}else if(R==0&&H.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,P=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:P,depth:U,plte:K,frames:H}}function c(x,y,T,M,O,F,I){const z=Uint8Array,S=Uint32Array,w=new z(x[O-1]),B=new S(x[O-1]),P=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let N=y,D=T,$=-1,R=-1;for(let G=0;G<F.height;G++)for(let K=0;K<F.width;K++){const V=F.x+K,ne=F.y+G,Z=ne*y+V,re=q[Z];re==0||M[O-1].dispose==0&&B[Z]==re&&(P==null||P[4*Z+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<D&&(D=ne),ne>R&&(R=ne))}$==-1&&(N=D=$=R=0),I&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:R-D+1};const H=M[O];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(w,y,T,H.img,F.width,F.height,-F.x,-F.y,0),d(U,y,T,H.img,F)):e(U,y,T,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,T,M,O){e(x,y,T,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,T,M,O,F,I){const z=[];let S,w=[0,1,2,3,4];F!=-1?w=[F]:(y*M>5e5||T==1)&&(w=[0]),I&&(S={level:0});const B=jh;for(var P=0;P<w.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,T,w[P]);z.push(B.deflate(O,S))}let U,q=1e9;for(P=0;P<z.length;P++)z[P].length<q&&(U=P,q=z[P].length);return z[U]}function g(x,y,T,M,O,F){const I=T*M;let z=I+T;if(x[z]=F,z++,F==0)if(M<500)for(var S=0;S<M;S++)x[z+S]=y[I+S];else x.set(new Uint8Array(y.buffer,I,M),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[I+S];for(S=O;S<M;S++)x[z+S]=y[I+S]-y[I+S-O]+256&255}else if(T==0){for(S=0;S<O;S++)x[z+S]=y[I+S];if(F==2)for(S=O;S<M;S++)x[z+S]=y[I+S];if(F==3)for(S=O;S<M;S++)x[z+S]=y[I+S]-(y[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<M;S++)x[z+S]=y[I+S]-n(y[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<M;S++)x[z+S]=y[I+S]+256-y[I+S-M]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-(y[I+S-M]>>1)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-(y[I+S-M]+y[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-n(0,y[I+S-M],0)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-n(y[I+S-O],y[I+S-M],y[I+S-O-M])&255}}}function v(x,y){const T=new Uint8Array(x),M=T.slice(0),O=new Uint32Array(M.buffer),F=C(M,y),I=F[0],z=F[1],S=T.length,w=new Uint8Array(S>>2);let B;if(T.length<2e7)for(var P=0;P<S;P+=4)B=b(I,U=T[P]*(1/255),q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255)),w[P>>2]=B.ind,O[P>>2]=B.est.rgba;else for(P=0;P<S;P+=4){var U=T[P]*.00392156862745098,q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255);for(B=I;B.left;)B=_(B.est,U,q,N,D)<=0?B.left:B.right;w[P>>2]=B.ind,O[P>>2]=B.est.rgba}return{abuf:M.buffer,inds:w,plte:z}}function C(x,y,T){T==null&&(T=1e-4);const M=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<T)break;const w=F[S],B=A(x,M,w.i0,w.i1,w.est.e,w.est.eMq255);if(w.i0>=B||w.i1<=B){w.est.L=0;continue}const P={i0:w.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};P.bst=L(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:B,i1:w.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:w.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=w.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=w.bst.m[I]-P.bst.m[I];U.est=k(U.bst),w.left=P,w.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function b(x,y,T,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,D){const $=U-P[0],R=q-P[1],H=N-P[2],G=D-P[3];return $*$+R*R+H*H+G*G})(x.est.q,y,T,M,O),x;const F=_(x.est,y,T,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,T,M,O);if(S.tdst<=F*F)return S;const w=b(z,y,T,M,O);return w.tdst<S.tdst?w:S}function _(x,y,T,M,O){const{e:F}=x;return F[0]*y+F[1]*T+F[2]*M+F[3]*O-x.eMq}function A(x,y,T,M,O,F){for(M-=4;T<M;){for(;E(x,T,O)<=F;)T+=4;for(;E(x,M,O)>F;)M-=4;if(T>=M)break;const I=y[T>>2];y[T>>2]=y[M>>2],y[M>>2]=I,T+=4,M-=4}for(;E(x,T,O)>F;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function L(x,y,T){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=T-y>>2;for(let I=y;I<T;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),w=x[I+2]*(1/255),B=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=w,O[3]+=B,M[0]+=z*z,M[1]+=z*S,M[2]+=z*w,M[3]+=z*B,M[5]+=S*S,M[6]+=S*w,M[7]+=S*B,M[10]+=w*w,M[11]+=w*B,M[15]+=B*B}return M[4]=M[1],M[8]=M[2],M[9]=M[6],M[12]=M[3],M[13]=M[7],M[14]=M[11],{R:M,m:O,N:F}}function k(x){const{R:y}=x,{m:T}=x,{N:M}=x,O=T[0],F=T[1],I=T[2],z=T[3],S=M==0?0:1/M,w=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*I*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*I*S,y[7]-F*z*S,y[8]-I*O*S,y[9]-I*F*S,y[10]-I*I*S,y[11]-I*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*I*S,y[15]-z*z*S],B=w,P=j;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(B,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[O*S,F*S,I*S,z*S];return{Cov:w,q:D,e:U,L:q,eMq255:P.dot(P.sml(255,D),U),eMq:P.dot(U,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,T,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,T,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,T,M,F,I)},Le.encodeLL=function(y,T,M,O,F,I,z,S){const w={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},B=(O+F)*I,P=B*T;for(let U=0;U<y.length;U++)w.frames.push({rect:{x:0,y:0,width:T,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(P/8)});return f(w,0,!0),m(w,T,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Wi={toArrayBuffer(e,t){const n=e.width,o=e.height,r=n<<2,s=e.getContext("2d").getImageData(0,0,n,o),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*o,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,_=0,A=0,E=0;function L(x){c.setUint16(A,x,!0),A+=2}function k(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),k(f),j(4),k(122),k(108),k(n),k(-o>>>0),L(1),L(32),k(3),k(m),k(2835),k(2835),j(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;_<o&&b>0;){for(C=122+_*i,h=0;h<r;)b--,g=a[E++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;_++}E<a.length?(b=d,setTimeout(x,Wi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ie={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Th={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const _o=typeof window<"u",Gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Rh=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vi=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(e,t,n=Date.now()){return new Promise((o=>{const r=e.split(","),s=r[0].match(/:(.*?);/)[1],a=globalThis.atob(r[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,o(f)}))}function Ki(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=()=>t(o.result),o.onerror=r=>n(r),o.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const o=new Image;o.onload=()=>t(o),o.onerror=r=>n(r),o.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function Yi(e,t){const n=St(),o=Th[n];let r=e,s=t,a=r*s;const i=r>s?s/r:r/s;for(;a>o*o;){const m=(o+r)/2,f=(o+s)/2;m<f?(s=f,r=f*i):(s=m*i,r=m),a=r*s}return{width:r,height:s}}function rr(e,t){let n,o;try{if(n=new OffscreenCanvas(e,t),o=n.getContext("2d"),o===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),o=n.getContext("2d")}return n.width=e,n.height=t,[n,o]}function Xi(e,t){const{width:n,height:o}=Yi(e.width,e.height),[r,s]=rr(n,o);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,r.width,r.height)),s.drawImage(e,0,0,r.width,r.height),r}function Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,o){let r,s;var a=function(){try{return s=Xi(r,t.fileType||e.type),n([r,s])}catch(m){return o(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return o(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return r=d,(function(){try{return a()}catch(h){return o(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return o(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return r=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,o,r=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Le.encode([l.buffer],e.width,e.height,4096*r),i=new Blob([c],{type:t}),i.name=n,i.lastModified=o,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=o,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:r}).then((function(c){try{return i=c,i.name=n,i.lastModified=o,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,r),Ao(c,n,o).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ge(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,o,r,s;return $t.cachedResult!==void 0?e($t.cachedResult):Ao("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then((function(a){try{return n=a,Wn(n).then((function(i){try{return o=i[1],Gn(o,n.type,n.name,n.lastModified).then((function(m){try{return r=m,Ge(o),Wn(r).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function Qi(e){return new Promise(((t,n)=>{const o=new Vi;o.onload=r=>{const s=new DataView(r.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},o.onerror=r=>n(r),o.readAsArrayBuffer(e)}))}function Zi(e,t){const{width:n}=e,{height:o}=e,{maxWidthOrHeight:r}=t;let s,a=e;return isFinite(r)&&(n>r||o>r)&&([a,s]=rr(n,o),n>o?(a.width=r,a.height=o/n*r):(a.width=n/o*r,a.height=r),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function Ji(e,t){const{width:n}=e,{height:o}=e,[r,s]=rr(n,o);switch(t>4&&t<9?(r.width=o,r.height=n):(r.width=n,r.height=o),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,o);break;case 4:s.transform(1,0,0,-1,0,o);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,o,0);break;case 7:s.transform(0,-1,-1,0,o,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,o),Ge(e),r}function Ss(e,t,n=0){return new Promise((function(o,r){let s,a,i,m,f,l,c,d,h,g,v,C,b,_,A,E,L,k,j,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function T(M){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(M,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(M){try{return[,m]=M,y(),f=Zi(m,t),y(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return Qi(e).then((function(S){try{return I=S,z.call(this)}catch(w){return F(w)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:Ji(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Gn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(A>i||A>b)){let B,P;return B=x?.95*j.width:j.width,P=x?.95*j.height:j.height,[L,k]=rr(B,P),k.drawImage(j,0,0,B,P),d*=h==="image/png"?.85:.95,Gn(L,h,e.name,e.lastModified,d).then((function(U){try{return E=U,Ge(j),j=L,A=E.size,T(Math.min(99,Math.floor((_-A)/(_-i)*100))),S}catch(q){return r(q)}}),r)}return[1]},w=function(){return Ge(j),Ge(L),Ge(f),Ge(c),Ge(m),T(100),o(E)};if(g=I,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return T(100),o(g);var z;return b=e.size,_=g.size,A=_,j=c,x=!t.alwaysKeepResolution&&v,(z=(function(B){for(;B;){if(B.then)return void B.then(z,r);try{if(B.pop){if(B.length)return B.pop()?w.call(this):B;B=S}else B=B.call(this)}catch(P){return r(P)}}}).bind(this))(S)}}catch(S){return r(S)}}).bind(this),r)}catch(I){return r(I)}}).bind(this),r)}catch(F){return r(F)}}).bind(this),r)}catch(O){return r(O)}}).bind(this),r)}))}const Nh=`
207
+ */const yd=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],dn=ae("x",yd),ga=p.createContext(void 0),xa="theme";function Yo(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Xo(){if(typeof window>"u")return"system";try{const e=localStorage.getItem(xa);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"system"}function Qo(e){const t=document.documentElement;t.classList.remove("light","dark"),t.classList.add(e)}function wd(){const e=p.useContext(ga);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}function Cd({children:e,defaultTheme:t="system"}){const[n,r]=p.useState(()=>Xo()||t),[o,s]=p.useState(()=>{const m=Xo()||t;return m==="system"?Yo():m}),a=p.useCallback(m=>{r(m);try{localStorage.setItem(xa,m)}catch{}},[]);p.useEffect(()=>{const m=n==="system"?Yo():n;s(m),Qo(m)},[n]),p.useEffect(()=>{if(n!=="system")return;const m=window.matchMedia("(prefers-color-scheme: dark)"),f=l=>{const c=l.matches?"dark":"light";s(c),Qo(c)};return m.addEventListener("change",f),()=>m.removeEventListener("change",f)},[n]);const i={theme:n,resolvedTheme:o,setTheme:a};return it.createElement(ga.Provider,{value:i},e)}function Zo(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qe(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Zo(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Zo(e[o],null)}}}}function ke(...e){return p.useCallback(qe(...e),e)}var Sd=Symbol.for("react.lazy"),Pn=Zr[" use ".trim().toString()];function kd(e){return typeof e=="object"&&e!==null&&"then"in e}function va(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Sd&&"_payload"in e&&kd(e._payload)}function ba(e){const t=_d(e),n=p.forwardRef((r,o)=>{let{children:s,...a}=r;va(s)&&typeof Pn=="function"&&(s=Pn(s._payload));const i=p.Children.toArray(s),m=i.find(jd);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ed=ba("Slot");function _d(e){const t=p.forwardRef((n,r)=>{let{children:o,...s}=n;if(va(o)&&typeof Pn=="function"&&(o=Pn(o._payload)),p.isValidElement(o)){const a=Rd(o),i=Td(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ad=Symbol("radix.slottable");function jd(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ad}function Td(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Rd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Jo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,es=Ks,Nd=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return es(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(f=>{const l=n==null?void 0:n[f],c=s==null?void 0:s[f];if(l===null)return null;const d=Jo(l)||Jo(c);return o[f][d]}),i=n&&Object.entries(n).reduce((f,l)=>{let[c,d]=l;return d===void 0||(f[c]=d),f},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((f,l)=>{let{class:c,className:d,...h}=l;return Object.entries(h).every(g=>{let[v,C]=g;return Array.isArray(C)?C.includes({...s,...i}[v]):{...s,...i}[v]===C})?[...f,c,d]:f},[]);return es(e,a,m,n==null?void 0:n.class,n==null?void 0:n.className)},Id=Nd("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function Rt({className:e,variant:t,size:n,asChild:r=!1,...o}){const s=r?Ed:"button";return u.jsx(s,{"data-slot":"button",className:ee(Id({variant:t,size:n,className:e})),...o})}function te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Md(e,t){const n=p.createContext(t),r=s=>{const{children:a,...i}=s,m=p.useMemo(()=>i,Object.values(i));return u.jsx(n.Provider,{value:m,children:a})};r.displayName=e+"Provider";function o(s){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function nt(e,t=[]){let n=[];function r(s,a){const i=p.createContext(a),m=n.length;n=[...n,a];const f=c=>{var b;const{scope:d,children:h,...g}=c,v=((b=d==null?void 0:d[e])==null?void 0:b[m])||i,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 o=()=>{const s=n.map(a=>p.createContext(a));return function(i){const m=(i==null?void 0:i[e])||s;return p.useMemo(()=>({[`__scope${e}`]:{...i,[e]:m}}),[i,m])}};return o.scopeName=e,[r,Pd(o,...t)]}function Pd(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((i,{useScope:m,scopeName:f})=>{const c=m(s)[`__scope${f}`];return{...i,...c}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var Ze=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Od=Zr[" useInsertionEffect ".trim().toString()]||Ze;function ut({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=Dd({defaultProp:t,onChange:n}),i=e!==void 0,m=i?e:o;{const l=p.useRef(e!==void 0);p.useEffect(()=>{const c=l.current;c!==i&&console.warn(`${r} is changing from ${c?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),l.current=i},[i,r])}const f=p.useCallback(l=>{var c;if(i){const d=Ld(l)?l(e):l;d!==e&&((c=a.current)==null||c.call(a,d))}else s(l)},[i,e,s,a]);return[m,f]}function Dd({defaultProp:e,onChange:t}){const[n,r]=p.useState(e),o=p.useRef(n),s=p.useRef(t);return Od(()=>{s.current=t},[t]),p.useEffect(()=>{var a;o.current!==n&&((a=s.current)==null||a.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Ld(e){return typeof e=="function"}function Ht(e){const t=Fd(e),n=p.forwardRef((r,o)=>{const{children:s,...a}=r,i=p.Children.toArray(s),m=i.find(Ud);if(m){const f=m.props.children,l=i.map(c=>c===m?p.Children.count(f)>1?p.Children.only(null):p.isValidElement(f)?f.props.children:null:c);return u.jsx(t,{...a,ref:o,children:p.isValidElement(f)?p.cloneElement(f,void 0,l):null})}return u.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function Fd(e){const t=p.forwardRef((n,r)=>{const{children:o,...s}=n;if(p.isValidElement(o)){const a=Bd(o),i=zd(s,o.props);return o.type!==p.Fragment&&(i.ref=r?qe(r,a):a),p.cloneElement(o,i)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ya=Symbol("radix.slottable");function $d(e){const t=({children:n})=>u.jsx(u.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ya,t}function Ud(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ya}function zd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...i)=>{const m=s(...i);return o(...i),m}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Bd(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Hd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],he=Hd.reduce((e,t)=>{const n=Ht(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wa(e,t){e&&Gs.flushSync(()=>e.dispatchEvent(t))}function Ca(e){const t=e+"CollectionProvider",[n,r]=nt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=v=>{const{scope:C,children:b}=v,_=it.useRef(null),A=it.useRef(new Map).current;return u.jsx(o,{scope:C,itemMap:A,collectionRef:_,children:b})};a.displayName=t;const i=e+"CollectionSlot",m=Ht(i),f=it.forwardRef((v,C)=>{const{scope:b,children:_}=v,A=s(i,b),E=ke(C,A.collectionRef);return u.jsx(m,{ref:E,children:_})});f.displayName=i;const l=e+"CollectionItemSlot",c="data-radix-collection-item",d=Ht(l),h=it.forwardRef((v,C)=>{const{scope:b,children:_,...A}=v,E=it.useRef(null),L=ke(C,E),k=s(l,b);return it.useEffect(()=>(k.itemMap.set(E,{ref:E,...A}),()=>void k.itemMap.delete(E))),u.jsx(d,{[c]:"",ref:L,children:_})});h.displayName=l;function g(v){const C=s(e+"CollectionConsumer",v);return it.useCallback(()=>{const _=C.collectionRef.current;if(!_)return[];const A=Array.from(_.querySelectorAll(`[${c}]`));return Array.from(C.itemMap.values()).sort((k,j)=>A.indexOf(k.ref.current)-A.indexOf(j.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:a,Slot:f,ItemSlot:h},g,r]}var Wd=p.createContext(void 0);function Sa(e){const t=p.useContext(Wd);return e||t||"ltr"}function Je(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Gd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e);p.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Vd="DismissableLayer",Or="dismissableLayer.update",Kd="dismissableLayer.pointerDownOutside",qd="dismissableLayer.focusOutside",ts,ka=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fn=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:i,...m}=e,f=p.useContext(ka),[l,c]=p.useState(null),d=(l==null?void 0:l.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=p.useState({}),g=ke(t,j=>c(j)),v=Array.from(f.layers),[C]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=v.indexOf(C),_=l?v.indexOf(l):-1,A=f.layersWithOutsidePointerEventsDisabled.size>0,E=_>=b,L=Qd(j=>{const x=j.target,y=[...f.branches].some(T=>T.contains(x));!E||y||(o==null||o(j),a==null||a(j),j.defaultPrevented||i==null||i())},d),k=Zd(j=>{const x=j.target;[...f.branches].some(T=>T.contains(x))||(s==null||s(j),a==null||a(j),j.defaultPrevented||i==null||i())},d);return Gd(j=>{_===f.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&i&&(j.preventDefault(),i()))},d),p.useEffect(()=>{if(l)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(ts=d.body.style.pointerEvents,d.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(l)),f.layers.add(l),ns(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(d.body.style.pointerEvents=ts)}},[l,d,n,f]),p.useEffect(()=>()=>{l&&(f.layers.delete(l),f.layersWithOutsidePointerEventsDisabled.delete(l),ns())},[l,f]),p.useEffect(()=>{const j=()=>h({});return document.addEventListener(Or,j),()=>document.removeEventListener(Or,j)},[]),u.jsx(he.div,{...m,ref:g,style:{pointerEvents:A?E?"auto":"none":void 0,...e.style},onFocusCapture:te(e.onFocusCapture,k.onFocusCapture),onBlurCapture:te(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:te(e.onPointerDownCapture,L.onPointerDownCapture)})});fn.displayName=Vd;var Yd="DismissableLayerBranch",Xd=p.forwardRef((e,t)=>{const n=p.useContext(ka),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),u.jsx(he.div,{...e,ref:o})});Xd.displayName=Yd;function Qd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const s=i=>{if(i.target&&!r.current){let m=function(){Ea(Kd,n,f,{discrete:!0})};const f={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Zd(e,t=globalThis==null?void 0:globalThis.document){const n=Je(e),r=p.useRef(!1);return p.useEffect(()=>{const o=s=>{s.target&&!r.current&&Ea(qd,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ns(){const e=new CustomEvent(Or);document.dispatchEvent(e)}function Ea(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?wa(o,s):o.dispatchEvent(s)}var mr=0;function oo(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??rs()),document.body.insertAdjacentElement("beforeend",e[1]??rs()),mr++,()=>{mr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),mr--}},[])}function rs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var pr="focusScope.autoFocusOnMount",hr="focusScope.autoFocusOnUnmount",os={bubbles:!1,cancelable:!0},Jd="FocusScope",qn=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[i,m]=p.useState(null),f=Je(o),l=Je(s),c=p.useRef(null),d=ke(t,v=>m(v)),h=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(A){if(h.paused||!i)return;const E=A.target;i.contains(E)?c.current=E:lt(c.current,{select:!0})},C=function(A){if(h.paused||!i)return;const E=A.relatedTarget;E!==null&&(i.contains(E)||lt(c.current,{select:!0}))},b=function(A){if(document.activeElement===document.body)for(const L of A)L.removedNodes.length>0&&lt(i)};document.addEventListener("focusin",v),document.addEventListener("focusout",C);const _=new MutationObserver(b);return i&&_.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",C),_.disconnect()}}},[r,i,h.paused]),p.useEffect(()=>{if(i){as.add(h);const v=document.activeElement;if(!i.contains(v)){const b=new CustomEvent(pr,os);i.addEventListener(pr,f),i.dispatchEvent(b),b.defaultPrevented||(ef(sf(_a(i)),{select:!0}),document.activeElement===v&&lt(i))}return()=>{i.removeEventListener(pr,f),setTimeout(()=>{const b=new CustomEvent(hr,os);i.addEventListener(hr,l),i.dispatchEvent(b),b.defaultPrevented||lt(v??document.body,{select:!0}),i.removeEventListener(hr,l),as.remove(h)},0)}}},[i,f,l,h]);const g=p.useCallback(v=>{if(!n&&!r||h.paused)return;const C=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,b=document.activeElement;if(C&&b){const _=v.currentTarget,[A,E]=tf(_);A&&E?!v.shiftKey&&b===E?(v.preventDefault(),n&&lt(A,{select:!0})):v.shiftKey&&b===A&&(v.preventDefault(),n&&lt(E,{select:!0})):b===_&&v.preventDefault()}},[n,r,h.paused]);return u.jsx(he.div,{tabIndex:-1,...a,ref:d,onKeyDown:g})});qn.displayName=Jd;function ef(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(lt(r,{select:t}),document.activeElement!==n)return}function tf(e){const t=_a(e),n=ss(t,e),r=ss(t.reverse(),e);return[n,r]}function _a(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ss(e,t){for(const n of e)if(!nf(n,{upTo:t}))return n}function nf(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rf(e){return e instanceof HTMLInputElement&&"select"in e}function lt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&rf(e)&&t&&e.select()}}var as=of();function of(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=is(e,t),e.unshift(t)},remove(t){var n;e=is(e,t),(n=e[0])==null||n.resume()}}}function is(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function sf(e){return e.filter(t=>t.tagName!=="A")}var af=Zr[" useId ".trim().toString()]||(()=>{}),lf=0;function Re(e){const[t,n]=p.useState(af());return Ze(()=>{n(r=>r??String(lf++))},[e]),e||(t?`radix-${t}`:"")}const cf=["top","right","bottom","left"],dt=Math.min,Me=Math.max,On=Math.round,Sn=Math.floor,Ke=e=>({x:e,y:e}),uf={left:"right",right:"left",bottom:"top",top:"bottom"};function Dr(e,t,n){return Me(e,dt(t,n))}function et(e,t){return typeof e=="function"?e(t):e}function tt(e){return e.split("-")[0]}function qt(e){return e.split("-")[1]}function so(e){return e==="x"?"y":"x"}function ao(e){return e==="y"?"height":"width"}function Ve(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function io(e){return so(Ve(e))}function df(e,t,n){n===void 0&&(n=!1);const r=qt(e),o=io(e),s=ao(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=Dn(a)),[a,Dn(a)]}function ff(e){const t=Dn(e);return[Lr(e),t,Lr(t)]}function Lr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ls=["left","right"],cs=["right","left"],mf=["top","bottom"],pf=["bottom","top"];function hf(e,t,n){switch(e){case"top":case"bottom":return n?t?cs:ls:t?ls:cs;case"left":case"right":return t?mf:pf;default:return[]}}function gf(e,t,n,r){const o=qt(e);let s=hf(tt(e),n==="start",r);return o&&(s=s.map(a=>a+"-"+o),t&&(s=s.concat(s.map(Lr)))),s}function Dn(e){const t=tt(e);return uf[t]+e.slice(t.length)}function xf(e){return{top:0,right:0,bottom:0,left:0,...e}}function Aa(e){return typeof e!="number"?xf(e):{top:e,right:e,bottom:e,left:e}}function Ln(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function us(e,t,n){let{reference:r,floating:o}=e;const s=Ve(t),a=io(t),i=ao(a),m=tt(t),f=s==="y",l=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,d=r[i]/2-o[i]/2;let h;switch(m){case"top":h={x:l,y:r.y-o.height};break;case"bottom":h={x:l,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.y}}switch(qt(t)){case"start":h[a]-=d*(n&&f?-1:1);break;case"end":h[a]+=d*(n&&f?-1:1);break}return h}async function vf(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:a,elements:i,strategy:m}=e,{boundary:f="clippingAncestors",rootBoundary:l="viewport",elementContext:c="floating",altBoundary:d=!1,padding:h=0}=et(t,e),g=Aa(h),C=i[d?c==="floating"?"reference":"floating":c],b=Ln(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:f,rootBoundary:l,strategy:m})),_=c==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,A=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),E=await(s.isElement==null?void 0:s.isElement(A))?await(s.getScale==null?void 0:s.getScale(A))||{x:1,y:1}:{x:1,y:1},L=Ln(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:_,offsetParent:A,strategy:m}):_);return{top:(b.top-L.top+g.top)/E.y,bottom:(L.bottom-b.bottom+g.bottom)/E.y,left:(b.left-L.left+g.left)/E.x,right:(L.right-b.right+g.right)/E.x}}const bf=50,yf=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,i=a.detectOverflow?a:{...a,detectOverflow:vf},m=await(a.isRTL==null?void 0:a.isRTL(t));let f=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:l,y:c}=us(f,r,m),d=r,h=0;const g={};for(let v=0;v<s.length;v++){const C=s[v];if(!C)continue;const{name:b,fn:_}=C,{x:A,y:E,data:L,reset:k}=await _({x:l,y:c,initialPlacement:r,placement:d,strategy:o,middlewareData:g,rects:f,platform:i,elements:{reference:e,floating:t}});l=A??l,c=E??c,g[b]={...g[b],...L},k&&h<bf&&(h++,typeof k=="object"&&(k.placement&&(d=k.placement),k.rects&&(f=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:l,y:c}=us(f,d,m)),v=-1)}return{x:l,y:c,placement:d,strategy:o,middlewareData:g}},wf=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:a,elements:i,middlewareData:m}=t,{element:f,padding:l=0}=et(e,t)||{};if(f==null)return{};const c=Aa(l),d={x:n,y:r},h=io(o),g=ao(h),v=await a.getDimensions(f),C=h==="y",b=C?"top":"left",_=C?"bottom":"right",A=C?"clientHeight":"clientWidth",E=s.reference[g]+s.reference[h]-d[h]-s.floating[g],L=d[h]-s.reference[h],k=await(a.getOffsetParent==null?void 0:a.getOffsetParent(f));let j=k?k[A]:0;(!j||!await(a.isElement==null?void 0:a.isElement(k)))&&(j=i.floating[A]||s.floating[g]);const x=E/2-L/2,y=j/2-v[g]/2-1,T=dt(c[b],y),M=dt(c[_],y),O=T,F=j-v[g]-M,I=j/2-v[g]/2+x,z=Dr(O,I,F),S=!m.arrow&&qt(o)!=null&&I!==z&&s.reference[g]/2-(I<O?T:M)-v[g]/2<0,w=S?I<O?I-O:I-F:0;return{[h]:d[h]+w,data:{[h]:z,centerOffset:I-z-w,...S&&{alignmentOffset:w}},reset:S}}}),Cf=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:a,initialPlacement:i,platform:m,elements:f}=t,{mainAxis:l=!0,crossAxis:c=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...C}=et(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=tt(o),_=Ve(i),A=tt(i)===i,E=await(m.isRTL==null?void 0:m.isRTL(f.floating)),L=d||(A||!v?[Dn(i)]:ff(i)),k=g!=="none";!d&&k&&L.push(...gf(i,v,g,E));const j=[i,...L],x=await m.detectOverflow(t,C),y=[];let T=((r=s.flip)==null?void 0:r.overflows)||[];if(l&&y.push(x[b]),c){const I=df(o,a,E);y.push(x[I[0]],x[I[1]])}if(T=[...T,{placement:o,overflows:y}],!y.every(I=>I<=0)){var M,O;const I=(((M=s.flip)==null?void 0:M.index)||0)+1,z=j[I];if(z&&(!(c==="alignment"?_!==Ve(z):!1)||T.every(B=>Ve(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:z}};let S=(O=T.filter(w=>w.overflows[0]<=0).sort((w,B)=>w.overflows[1]-B.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(h){case"bestFit":{var F;const w=(F=T.filter(B=>{if(k){const P=Ve(B.placement);return P===_||P==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(P=>P>0).reduce((P,U)=>P+U,0)]).sort((B,P)=>B[1]-P[1])[0])==null?void 0:F[0];w&&(S=w);break}case"initialPlacement":S=i;break}if(o!==S)return{reset:{placement:S}}}return{}}}};function ds(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fs(e){return cf.some(t=>e[t]>=0)}const Sf=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=et(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...s,elementContext:"reference"}),i=ds(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:fs(i)}}}case"escaped":{const a=await r.detectOverflow(t,{...s,altBoundary:!0}),i=ds(a,n.floating);return{data:{escapedOffsets:i,escaped:fs(i)}}}default:return{}}}}},ja=new Set(["left","top"]);async function kf(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=tt(n),i=qt(n),m=Ve(n)==="y",f=ja.has(a)?-1:1,l=s&&m?-1:1,c=et(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:g}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return i&&typeof g=="number"&&(h=i==="end"?g*-1:g),m?{x:h*l,y:d*f}:{x:d*f,y:h*l}}const Ef=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:a,middlewareData:i}=t,m=await kf(t,e);return a===((n=i.offset)==null?void 0:n.placement)&&(r=i.arrow)!=null&&r.alignmentOffset?{}:{x:o+m.x,y:s+m.y,data:{...m,placement:a}}}}},_f=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:m={fn:b=>{let{x:_,y:A}=b;return{x:_,y:A}}},...f}=et(e,t),l={x:n,y:r},c=await s.detectOverflow(t,f),d=Ve(tt(o)),h=so(d);let g=l[h],v=l[d];if(a){const b=h==="y"?"top":"left",_=h==="y"?"bottom":"right",A=g+c[b],E=g-c[_];g=Dr(A,g,E)}if(i){const b=d==="y"?"top":"left",_=d==="y"?"bottom":"right",A=v+c[b],E=v-c[_];v=Dr(A,v,E)}const C=m.fn({...t,[h]:g,[d]:v});return{...C,data:{x:C.x-n,y:C.y-r,enabled:{[h]:a,[d]:i}}}}}},Af=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:a}=t,{offset:i=0,mainAxis:m=!0,crossAxis:f=!0}=et(e,t),l={x:n,y:r},c=Ve(o),d=so(c);let h=l[d],g=l[c];const v=et(i,t),C=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(m){const A=d==="y"?"height":"width",E=s.reference[d]-s.floating[A]+C.mainAxis,L=s.reference[d]+s.reference[A]-C.mainAxis;h<E?h=E:h>L&&(h=L)}if(f){var b,_;const A=d==="y"?"width":"height",E=ja.has(tt(o)),L=s.reference[c]-s.floating[A]+(E&&((b=a.offset)==null?void 0:b[c])||0)+(E?0:C.crossAxis),k=s.reference[c]+s.reference[A]+(E?0:((_=a.offset)==null?void 0:_[c])||0)-(E?C.crossAxis:0);g<L?g=L:g>k&&(g=k)}return{[d]:h,[c]:g}}}},jf=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:a,elements:i}=t,{apply:m=()=>{},...f}=et(e,t),l=await a.detectOverflow(t,f),c=tt(o),d=qt(o),h=Ve(o)==="y",{width:g,height:v}=s.floating;let C,b;c==="top"||c==="bottom"?(C=c,b=d===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(b=c,C=d==="end"?"top":"bottom");const _=v-l.top-l.bottom,A=g-l.left-l.right,E=dt(v-l[C],_),L=dt(g-l[b],A),k=!t.middlewareData.shift;let j=E,x=L;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(x=A),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(j=_),k&&!d){const T=Me(l.left,0),M=Me(l.right,0),O=Me(l.top,0),F=Me(l.bottom,0);h?x=g-2*(T!==0||M!==0?T+M:Me(l.left,l.right)):j=v-2*(O!==0||F!==0?O+F:Me(l.top,l.bottom))}await m({...t,availableWidth:x,availableHeight:j});const y=await a.getDimensions(i.floating);return g!==y.width||v!==y.height?{reset:{rects:!0}}:{}}}};function Yn(){return typeof window<"u"}function Yt(e){return Ta(e)?(e.nodeName||"").toLowerCase():"#document"}function Pe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ye(e){var t;return(t=(Ta(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ta(e){return Yn()?e instanceof Node||e instanceof Pe(e).Node:!1}function $e(e){return Yn()?e instanceof Element||e instanceof Pe(e).Element:!1}function rt(e){return Yn()?e instanceof HTMLElement||e instanceof Pe(e).HTMLElement:!1}function ms(e){return!Yn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Pe(e).ShadowRoot}function mn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ue(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Tf(e){return/^(table|td|th)$/.test(Yt(e))}function Xn(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Rf=/transform|translate|scale|rotate|perspective|filter/,Nf=/paint|layout|strict|content/,wt=e=>!!e&&e!=="none";let gr;function lo(e){const t=$e(e)?Ue(e):e;return wt(t.transform)||wt(t.translate)||wt(t.scale)||wt(t.rotate)||wt(t.perspective)||!co()&&(wt(t.backdropFilter)||wt(t.filter))||Rf.test(t.willChange||"")||Nf.test(t.contain||"")}function If(e){let t=ft(e);for(;rt(t)&&!Wt(t);){if(lo(t))return t;if(Xn(t))return null;t=ft(t)}return null}function co(){return gr==null&&(gr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gr}function Wt(e){return/^(html|body|#document)$/.test(Yt(e))}function Ue(e){return Pe(e).getComputedStyle(e)}function Qn(e){return $e(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ft(e){if(Yt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Ye(e);return ms(t)?t.host:t}function Ra(e){const t=ft(e);return Wt(t)?e.ownerDocument?e.ownerDocument.body:e.body:rt(t)&&mn(t)?t:Ra(t)}function on(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Ra(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),a=Pe(o);if(s){const i=Fr(a);return t.concat(a,a.visualViewport||[],mn(o)?o:[],i&&n?on(i):[])}else return t.concat(o,on(o,[],n))}function Fr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Na(e){const t=Ue(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=rt(e),s=o?e.offsetWidth:n,a=o?e.offsetHeight:r,i=On(n)!==s||On(r)!==a;return i&&(n=s,r=a),{width:n,height:r,$:i}}function uo(e){return $e(e)?e:e.contextElement}function Ut(e){const t=uo(e);if(!rt(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Na(t);let a=(s?On(n.width):n.width)/r,i=(s?On(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const Mf=Ke(0);function Ia(e){const t=Pe(e);return!co()||!t.visualViewport?Mf:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pf(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Pe(e)?!1:t}function _t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=uo(e);let a=Ke(1);t&&(r?$e(r)&&(a=Ut(r)):a=Ut(e));const i=Pf(s,n,r)?Ia(s):Ke(0);let m=(o.left+i.x)/a.x,f=(o.top+i.y)/a.y,l=o.width/a.x,c=o.height/a.y;if(s){const d=Pe(s),h=r&&$e(r)?Pe(r):r;let g=d,v=Fr(g);for(;v&&r&&h!==g;){const C=Ut(v),b=v.getBoundingClientRect(),_=Ue(v),A=b.left+(v.clientLeft+parseFloat(_.paddingLeft))*C.x,E=b.top+(v.clientTop+parseFloat(_.paddingTop))*C.y;m*=C.x,f*=C.y,l*=C.x,c*=C.y,m+=A,f+=E,g=Pe(v),v=Fr(g)}}return Ln({width:l,height:c,x:m,y:f})}function Zn(e,t){const n=Qn(e).scrollLeft;return t?t.left+n:_t(Ye(e)).left+n}function Ma(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Zn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Of(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",a=Ye(r),i=t?Xn(t.floating):!1;if(r===a||i&&s)return n;let m={scrollLeft:0,scrollTop:0},f=Ke(1);const l=Ke(0),c=rt(r);if((c||!c&&!s)&&((Yt(r)!=="body"||mn(a))&&(m=Qn(r)),c)){const h=_t(r);f=Ut(r),l.x=h.x+r.clientLeft,l.y=h.y+r.clientTop}const d=a&&!c&&!s?Ma(a,m):Ke(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-m.scrollLeft*f.x+l.x+d.x,y:n.y*f.y-m.scrollTop*f.y+l.y+d.y}}function Df(e){return Array.from(e.getClientRects())}function Lf(e){const t=Ye(e),n=Qn(e),r=e.ownerDocument.body,o=Me(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Me(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Zn(e);const i=-n.scrollTop;return Ue(r).direction==="rtl"&&(a+=Me(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:a,y:i}}const ps=25;function Ff(e,t){const n=Pe(e),r=Ye(e),o=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,i=0,m=0;if(o){s=o.width,a=o.height;const l=co();(!l||l&&t==="fixed")&&(i=o.offsetLeft,m=o.offsetTop)}const f=Zn(r);if(f<=0){const l=r.ownerDocument,c=l.body,d=getComputedStyle(c),h=l.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,g=Math.abs(r.clientWidth-c.clientWidth-h);g<=ps&&(s-=g)}else f<=ps&&(s+=f);return{width:s,height:a,x:i,y:m}}function $f(e,t){const n=_t(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=rt(e)?Ut(e):Ke(1),a=e.clientWidth*s.x,i=e.clientHeight*s.y,m=o*s.x,f=r*s.y;return{width:a,height:i,x:m,y:f}}function hs(e,t,n){let r;if(t==="viewport")r=Ff(e,n);else if(t==="document")r=Lf(Ye(e));else if($e(t))r=$f(t,n);else{const o=Ia(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ln(r)}function Pa(e,t){const n=ft(e);return n===t||!$e(n)||Wt(n)?!1:Ue(n).position==="fixed"||Pa(n,t)}function Uf(e,t){const n=t.get(e);if(n)return n;let r=on(e,[],!1).filter(i=>$e(i)&&Yt(i)!=="body"),o=null;const s=Ue(e).position==="fixed";let a=s?ft(e):e;for(;$e(a)&&!Wt(a);){const i=Ue(a),m=lo(a);!m&&i.position==="fixed"&&(o=null),(s?!m&&!o:!m&&i.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||mn(a)&&!m&&Pa(e,a))?r=r.filter(l=>l!==a):o=i,a=ft(a)}return t.set(e,r),r}function zf(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Xn(t)?[]:Uf(t,this._c):[].concat(n),r],i=hs(t,a[0],o);let m=i.top,f=i.right,l=i.bottom,c=i.left;for(let d=1;d<a.length;d++){const h=hs(t,a[d],o);m=Me(h.top,m),f=dt(h.right,f),l=dt(h.bottom,l),c=Me(h.left,c)}return{width:f-c,height:l-m,x:c,y:m}}function Bf(e){const{width:t,height:n}=Na(e);return{width:t,height:n}}function Hf(e,t,n){const r=rt(t),o=Ye(t),s=n==="fixed",a=_t(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const m=Ke(0);function f(){m.x=Zn(o)}if(r||!r&&!s)if((Yt(t)!=="body"||mn(o))&&(i=Qn(t)),r){const h=_t(t,!0,s,t);m.x=h.x+t.clientLeft,m.y=h.y+t.clientTop}else o&&f();s&&!r&&o&&f();const l=o&&!r&&!s?Ma(o,i):Ke(0),c=a.left+i.scrollLeft-m.x-l.x,d=a.top+i.scrollTop-m.y-l.y;return{x:c,y:d,width:a.width,height:a.height}}function xr(e){return Ue(e).position==="static"}function gs(e,t){if(!rt(e)||Ue(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ye(e)===n&&(n=n.ownerDocument.body),n}function Oa(e,t){const n=Pe(e);if(Xn(e))return n;if(!rt(e)){let o=ft(e);for(;o&&!Wt(o);){if($e(o)&&!xr(o))return o;o=ft(o)}return n}let r=gs(e,t);for(;r&&Tf(r)&&xr(r);)r=gs(r,t);return r&&Wt(r)&&xr(r)&&!lo(r)?n:r||If(e)||n}const Wf=async function(e){const t=this.getOffsetParent||Oa,n=this.getDimensions,r=await n(e.floating);return{reference:Hf(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gf(e){return Ue(e).direction==="rtl"}const Vf={convertOffsetParentRelativeRectToViewportRelativeRect:Of,getDocumentElement:Ye,getClippingRect:zf,getOffsetParent:Oa,getElementRects:Wf,getClientRects:Df,getDimensions:Bf,getScale:Ut,isElement:$e,isRTL:Gf};function Da(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Kf(e,t){let n=null,r;const o=Ye(e);function s(){var i;clearTimeout(r),(i=n)==null||i.disconnect(),n=null}function a(i,m){i===void 0&&(i=!1),m===void 0&&(m=1),s();const f=e.getBoundingClientRect(),{left:l,top:c,width:d,height:h}=f;if(i||t(),!d||!h)return;const g=Sn(c),v=Sn(o.clientWidth-(l+d)),C=Sn(o.clientHeight-(c+h)),b=Sn(l),A={rootMargin:-g+"px "+-v+"px "+-C+"px "+-b+"px",threshold:Me(0,dt(1,m))||1};let E=!0;function L(k){const j=k[0].intersectionRatio;if(j!==m){if(!E)return a();j?a(!1,j):r=setTimeout(()=>{a(!1,1e-7)},1e3)}j===1&&!Da(f,e.getBoundingClientRect())&&a(),E=!1}try{n=new IntersectionObserver(L,{...A,root:o.ownerDocument})}catch{n=new IntersectionObserver(L,A)}n.observe(e)}return a(!0),s}function qf(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:m=!1}=r,f=uo(e),l=o||s?[...f?on(f):[],...t?on(t):[]]:[];l.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const c=f&&i?Kf(f,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(b=>{let[_]=b;_&&_.target===f&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(t)})),n()}),f&&!m&&h.observe(f),t&&h.observe(t));let g,v=m?_t(e):null;m&&C();function C(){const b=_t(e);v&&!Da(v,b)&&n(),v=b,g=requestAnimationFrame(C)}return n(),()=>{var b;l.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),c==null||c(),(b=h)==null||b.disconnect(),h=null,m&&cancelAnimationFrame(g)}}const Yf=Ef,Xf=_f,Qf=Cf,Zf=jf,Jf=Sf,xs=wf,em=Af,tm=(e,t,n)=>{const r=new Map,o={platform:Vf,...n},s={...o.platform,_c:r};return yf(e,t,{...o,platform:s})};var nm=typeof document<"u",rm=function(){},jn=nm?p.useLayoutEffect:rm;function Fn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Fn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Fn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function La(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function vs(e,t){const n=La(e);return Math.round(t*n)/n}function vr(e){const t=p.useRef(e);return jn(()=>{t.current=e}),t}function om(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:a}={},transform:i=!0,whileElementsMounted:m,open:f}=e,[l,c]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=p.useState(r);Fn(d,r)||h(r);const[g,v]=p.useState(null),[C,b]=p.useState(null),_=p.useCallback(B=>{B!==k.current&&(k.current=B,v(B))},[]),A=p.useCallback(B=>{B!==j.current&&(j.current=B,b(B))},[]),E=s||g,L=a||C,k=p.useRef(null),j=p.useRef(null),x=p.useRef(l),y=m!=null,T=vr(m),M=vr(o),O=vr(f),F=p.useCallback(()=>{if(!k.current||!j.current)return;const B={placement:t,strategy:n,middleware:d};M.current&&(B.platform=M.current),tm(k.current,j.current,B).then(P=>{const U={...P,isPositioned:O.current!==!1};I.current&&!Fn(x.current,U)&&(x.current=U,Gs.flushSync(()=>{c(U)}))})},[d,t,n,M,O]);jn(()=>{f===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,c(B=>({...B,isPositioned:!1})))},[f]);const I=p.useRef(!1);jn(()=>(I.current=!0,()=>{I.current=!1}),[]),jn(()=>{if(E&&(k.current=E),L&&(j.current=L),E&&L){if(T.current)return T.current(E,L,F);F()}},[E,L,F,T,y]);const z=p.useMemo(()=>({reference:k,floating:j,setReference:_,setFloating:A}),[_,A]),S=p.useMemo(()=>({reference:E,floating:L}),[E,L]),w=p.useMemo(()=>{const B={position:n,left:0,top:0};if(!S.floating)return B;const P=vs(S.floating,l.x),U=vs(S.floating,l.y);return i?{...B,transform:"translate("+P+"px, "+U+"px)",...La(S.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:P,top:U}},[n,i,S.floating,l.x,l.y]);return p.useMemo(()=>({...l,update:F,refs:z,elements:S,floatingStyles:w}),[l,F,z,S,w])}const sm=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?xs({element:r.current,padding:o}).fn(n):{}:r?xs({element:r,padding:o}).fn(n):{}}}},am=(e,t)=>{const n=Yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},im=(e,t)=>{const n=Xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},lm=(e,t)=>({fn:em(e).fn,options:[e,t]}),cm=(e,t)=>{const n=Qf(e);return{name:n.name,fn:n.fn,options:[e,t]}},um=(e,t)=>{const n=Zf(e);return{name:n.name,fn:n.fn,options:[e,t]}},dm=(e,t)=>{const n=Jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},fm=(e,t)=>{const n=sm(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mm="Arrow",Fa=p.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return u.jsx(he.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:u.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fa.displayName=mm;var pm=Fa;function hm(e){const[t,n]=p.useState(void 0);return Ze(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,i;if("borderBoxSize"in s){const m=s.borderBoxSize,f=Array.isArray(m)?m[0]:m;a=f.inlineSize,i=f.blockSize}else a=e.offsetWidth,i=e.offsetHeight;n({width:a,height:i})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var fo="Popper",[$a,Xt]=nt(fo),[gm,Ua]=$a(fo),za=e=>{const{__scopePopper:t,children:n}=e,[r,o]=p.useState(null);return u.jsx(gm,{scope:t,anchor:r,onAnchorChange:o,children:n})};za.displayName=fo;var Ba="PopperAnchor",Ha=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Ua(Ba,n),a=p.useRef(null),i=ke(t,a),m=p.useRef(null);return p.useEffect(()=>{const f=m.current;m.current=(r==null?void 0:r.current)||a.current,f!==m.current&&s.onAnchorChange(m.current)}),r?null:u.jsx(he.div,{...o,ref:i})});Ha.displayName=Ba;var mo="PopperContent",[xm,vm]=$a(mo),Wa=p.forwardRef((e,t)=>{var G,K,V,ne,Z,re;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:m=!0,collisionBoundary:f=[],collisionPadding:l=0,sticky:c="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:g,...v}=e,C=Ua(mo,n),[b,_]=p.useState(null),A=ke(t,ue=>_(ue)),[E,L]=p.useState(null),k=hm(E),j=(k==null?void 0:k.width)??0,x=(k==null?void 0:k.height)??0,y=r+(s!=="center"?"-"+s:""),T=typeof l=="number"?l:{top:0,right:0,bottom:0,left:0,...l},M=Array.isArray(f)?f:[f],O=M.length>0,F={padding:T,boundary:M.filter(ym),altBoundary:O},{refs:I,floatingStyles:z,placement:S,isPositioned:w,middlewareData:B}=om({strategy:"fixed",placement:y,whileElementsMounted:(...ue)=>qf(...ue,{animationFrame:h==="always"}),elements:{reference:C.anchor},middleware:[am({mainAxis:o+x,alignmentAxis:a}),m&&im({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?lm():void 0,...F}),m&&cm({...F}),um({...F,apply:({elements:ue,rects:be,availableWidth:de,availableHeight:ye})=>{const{width:fe,height:ie}=be.reference,ge=ue.floating.style;ge.setProperty("--radix-popper-available-width",`${de}px`),ge.setProperty("--radix-popper-available-height",`${ye}px`),ge.setProperty("--radix-popper-anchor-width",`${fe}px`),ge.setProperty("--radix-popper-anchor-height",`${ie}px`)}}),E&&fm({element:E,padding:i}),wm({arrowWidth:j,arrowHeight:x}),d&&dm({strategy:"referenceHidden",...F})]}),[P,U]=Ka(S),q=Je(g);Ze(()=>{w&&(q==null||q())},[w,q]);const N=(G=B.arrow)==null?void 0:G.x,D=(K=B.arrow)==null?void 0:K.y,$=((V=B.arrow)==null?void 0:V.centerOffset)!==0,[R,H]=p.useState();return Ze(()=>{b&&H(window.getComputedStyle(b).zIndex)},[b]),u.jsx("div",{ref:I.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:w?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:R,"--radix-popper-transform-origin":[(ne=B.transformOrigin)==null?void 0:ne.x,(Z=B.transformOrigin)==null?void 0:Z.y].join(" "),...((re=B.hide)==null?void 0:re.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:u.jsx(xm,{scope:n,placedSide:P,onArrowChange:L,arrowX:N,arrowY:D,shouldHideArrow:$,children:u.jsx(he.div,{"data-side":P,"data-align":U,...v,ref:A,style:{...v.style,animation:w?void 0:"none"}})})})});Wa.displayName=mo;var Ga="PopperArrow",bm={top:"bottom",right:"left",bottom:"top",left:"right"},Va=p.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=vm(Ga,r),a=bm[s.placedSide];return u.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:u.jsx(pm,{...o,ref:n,style:{...o.style,display:"block"}})})});Va.displayName=Ga;function ym(e){return e!==null}var wm=e=>({name:"transformOrigin",options:e,fn(t){var C,b,_;const{placement:n,rects:r,middlewareData:o}=t,a=((C=o.arrow)==null?void 0:C.centerOffset)!==0,i=a?0:e.arrowWidth,m=a?0:e.arrowHeight,[f,l]=Ka(n),c={start:"0%",center:"50%",end:"100%"}[l],d=(((b=o.arrow)==null?void 0:b.x)??0)+i/2,h=(((_=o.arrow)==null?void 0:_.y)??0)+m/2;let g="",v="";return f==="bottom"?(g=a?c:`${d}px`,v=`${-m}px`):f==="top"?(g=a?c:`${d}px`,v=`${r.floating.height+m}px`):f==="right"?(g=`${-m}px`,v=a?c:`${h}px`):f==="left"&&(g=`${r.floating.width+m}px`,v=a?c:`${h}px`),{data:{x:g,y:v}}}});function Ka(e){const[t,n="center"]=e.split("-");return[t,n]}var po=za,Jn=Ha,ho=Wa,go=Va,Cm="Portal",pn=p.forwardRef((e,t)=>{var i;const{container:n,...r}=e,[o,s]=p.useState(!1);Ze(()=>s(!0),[]);const a=n||o&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return a?fc.createPortal(u.jsx(he.div,{...r,ref:t}),a):null});pn.displayName=Cm;function Sm(e,t){return p.useReducer((n,r)=>t[n][r]??n,e)}var Oe=e=>{const{present:t,children:n}=e,r=km(t),o=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),s=ke(r.ref,Em(o));return typeof n=="function"||r.isPresent?p.cloneElement(o,{ref:s}):null};Oe.displayName="Presence";function km(e){const[t,n]=p.useState(),r=p.useRef(null),o=p.useRef(e),s=p.useRef("none"),a=e?"mounted":"unmounted",[i,m]=Sm(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const f=kn(r.current);s.current=i==="mounted"?f:"none"},[i]),Ze(()=>{const f=r.current,l=o.current;if(l!==e){const d=s.current,h=kn(f);e?m("MOUNT"):h==="none"||(f==null?void 0:f.display)==="none"?m("UNMOUNT"):m(l&&d!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),Ze(()=>{if(t){let f;const l=t.ownerDocument.defaultView??window,c=h=>{const v=kn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&v&&(m("ANIMATION_END"),!o.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=l.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},d=h=>{h.target===t&&(s.current=kn(r.current))};return t.addEventListener("animationstart",d),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{l.clearTimeout(f),t.removeEventListener("animationstart",d),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:p.useCallback(f=>{r.current=f?getComputedStyle(f):null,n(f)},[])}}function kn(e){return(e==null?void 0:e.animationName)||"none"}function Em(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var br="rovingFocusGroup.onEntryFocus",_m={bubbles:!1,cancelable:!0},hn="RovingFocusGroup",[$r,qa,Am]=Ca(hn),[jm,Ya]=nt(hn,[Am]),[Tm,Rm]=jm(hn),Xa=p.forwardRef((e,t)=>u.jsx($r.Provider,{scope:e.__scopeRovingFocusGroup,children:u.jsx($r.Slot,{scope:e.__scopeRovingFocusGroup,children:u.jsx(Nm,{...e,ref:t})})}));Xa.displayName=hn;var Nm=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:m,onEntryFocus:f,preventScrollOnEntryFocus:l=!1,...c}=e,d=p.useRef(null),h=ke(t,d),g=Sa(s),[v,C]=ut({prop:a,defaultProp:i??null,onChange:m,caller:hn}),[b,_]=p.useState(!1),A=Je(f),E=qa(n),L=p.useRef(!1),[k,j]=p.useState(0);return p.useEffect(()=>{const x=d.current;if(x)return x.addEventListener(br,A),()=>x.removeEventListener(br,A)},[A]),u.jsx(Tm,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:p.useCallback(x=>C(x),[C]),onItemShiftTab:p.useCallback(()=>_(!0),[]),onFocusableItemAdd:p.useCallback(()=>j(x=>x+1),[]),onFocusableItemRemove:p.useCallback(()=>j(x=>x-1),[]),children:u.jsx(he.div,{tabIndex:b||k===0?-1:0,"data-orientation":r,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:te(e.onMouseDown,()=>{L.current=!0}),onFocus:te(e.onFocus,x=>{const y=!L.current;if(x.target===x.currentTarget&&y&&!b){const T=new CustomEvent(br,_m);if(x.currentTarget.dispatchEvent(T),!T.defaultPrevented){const M=E().filter(S=>S.focusable),O=M.find(S=>S.active),F=M.find(S=>S.id===v),z=[O,F,...M].filter(Boolean).map(S=>S.ref.current);Ja(z,l)}}L.current=!1}),onBlur:te(e.onBlur,()=>_(!1))})})}),Qa="RovingFocusGroupItem",Za=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:a,...i}=e,m=Re(),f=s||m,l=Rm(Qa,n),c=l.currentTabStopId===f,d=qa(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:v}=l;return p.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),u.jsx($r.ItemSlot,{scope:n,id:f,focusable:r,active:o,children:u.jsx(he.span,{tabIndex:c?0:-1,"data-orientation":l.orientation,...i,ref:t,onMouseDown:te(e.onMouseDown,C=>{r?l.onItemFocus(f):C.preventDefault()}),onFocus:te(e.onFocus,()=>l.onItemFocus(f)),onKeyDown:te(e.onKeyDown,C=>{if(C.key==="Tab"&&C.shiftKey){l.onItemShiftTab();return}if(C.target!==C.currentTarget)return;const b=Pm(C,l.orientation,l.dir);if(b!==void 0){if(C.metaKey||C.ctrlKey||C.altKey||C.shiftKey)return;C.preventDefault();let A=d().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")A.reverse();else if(b==="prev"||b==="next"){b==="prev"&&A.reverse();const E=A.indexOf(C.currentTarget);A=l.loop?Om(A,E+1):A.slice(E+1)}setTimeout(()=>Ja(A))}}),children:typeof a=="function"?a({isCurrentTabStop:c,hasTabStop:v!=null}):a})})});Za.displayName=Qa;var Im={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Pm(e,t,n){const r=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Im[r]}function Ja(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Om(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Dm=Xa,Lm=Za,Fm=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ot=new WeakMap,En=new WeakMap,_n={},yr=0,ei=function(e){return e&&(e.host||ei(e.parentNode))},$m=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ei(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},Um=function(e,t,n,r){var o=$m(t,Array.isArray(e)?e:[e]);_n[n]||(_n[n]=new WeakMap);var s=_n[n],a=[],i=new Set,m=new Set(o),f=function(c){!c||i.has(c)||(i.add(c),f(c.parentNode))};o.forEach(f);var l=function(c){!c||m.has(c)||Array.prototype.forEach.call(c.children,function(d){if(i.has(d))l(d);else try{var h=d.getAttribute(r),g=h!==null&&h!=="false",v=(Ot.get(d)||0)+1,C=(s.get(d)||0)+1;Ot.set(d,v),s.set(d,C),a.push(d),v===1&&g&&En.set(d,!0),C===1&&d.setAttribute(n,"true"),g||d.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return l(t),i.clear(),yr++,function(){a.forEach(function(c){var d=Ot.get(c)-1,h=s.get(c)-1;Ot.set(c,d),s.set(c,h),d||(En.has(c)||c.removeAttribute(r),En.delete(c)),h||c.removeAttribute(n)}),yr--,yr||(Ot=new WeakMap,Ot=new WeakMap,En=new WeakMap,_n={})}},xo=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Fm(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Um(r,o,n,"aria-hidden")):function(){return null}},Ur=["Enter"," "],zm=["ArrowDown","PageUp","Home"],ti=["ArrowUp","PageDown","End"],Bm=[...zm,...ti],Hm={ltr:[...Ur,"ArrowRight"],rtl:[...Ur,"ArrowLeft"]},Wm={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gn="Menu",[sn,Gm,Vm]=Ca(gn),[Nt,ni]=nt(gn,[Vm,Xt,Ya]),er=Xt(),ri=Ya(),[Km,It]=Nt(gn),[qm,xn]=Nt(gn),oi=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:s,modal:a=!0}=e,i=er(t),[m,f]=p.useState(null),l=p.useRef(!1),c=Je(s),d=Sa(o);return p.useEffect(()=>{const h=()=>{l.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>l.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),u.jsx(po,{...i,children:u.jsx(Km,{scope:t,open:n,onOpenChange:c,content:m,onContentChange:f,children:u.jsx(qm,{scope:t,onClose:p.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:l,dir:d,modal:a,children:r})})})};oi.displayName=gn;var Ym="MenuAnchor",vo=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(Jn,{...o,...r,ref:t})});vo.displayName=Ym;var bo="MenuPortal",[Xm,si]=Nt(bo,{forceMount:void 0}),ai=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=It(bo,t);return u.jsx(Xm,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};ai.displayName=bo;var De="MenuContent",[Qm,yo]=Nt(De),ii=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:a.modal?u.jsx(Zm,{...o,ref:t}):u.jsx(Jm,{...o,ref:t})})})})}),Zm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu),r=p.useRef(null),o=ke(t,r);return p.useEffect(()=>{const s=r.current;if(s)return xo(s)},[]),u.jsx(wo,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Jm=p.forwardRef((e,t)=>{const n=It(De,e.__scopeMenu);return u.jsx(wo,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),ep=Ht("MenuContent.ScrollLock"),wo=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:s,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:m,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,disableOutsideScroll:g,...v}=e,C=It(De,n),b=xn(De,n),_=er(n),A=ri(n),E=Gm(n),[L,k]=p.useState(null),j=p.useRef(null),x=ke(t,j,C.onContentChange),y=p.useRef(0),T=p.useRef(""),M=p.useRef(0),O=p.useRef(null),F=p.useRef("right"),I=p.useRef(0),z=g?Jr:p.Fragment,S=g?{as:ep,allowPinchZoom:!0}:void 0,w=P=>{var G,K;const U=T.current+P,q=E().filter(V=>!V.disabled),N=document.activeElement,D=(G=q.find(V=>V.ref.current===N))==null?void 0:G.textValue,$=q.map(V=>V.textValue),R=fp($,U,D),H=(K=q.find(V=>V.textValue===R))==null?void 0:K.ref.current;(function V(ne){T.current=ne,window.clearTimeout(y.current),ne!==""&&(y.current=window.setTimeout(()=>V(""),1e3))})(U),H&&setTimeout(()=>H.focus())};p.useEffect(()=>()=>window.clearTimeout(y.current),[]),oo();const B=p.useCallback(P=>{var q,N;return F.current===((q=O.current)==null?void 0:q.side)&&pp(P,(N=O.current)==null?void 0:N.area)},[]);return u.jsx(Qm,{scope:n,searchRef:T,onItemEnter:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),onItemLeave:p.useCallback(P=>{var U;B(P)||((U=j.current)==null||U.focus(),k(null))},[B]),onTriggerLeave:p.useCallback(P=>{B(P)&&P.preventDefault()},[B]),pointerGraceTimerRef:M,onPointerGraceIntentChange:p.useCallback(P=>{O.current=P},[]),children:u.jsx(z,{...S,children:u.jsx(qn,{asChild:!0,trapped:o,onMountAutoFocus:te(s,P=>{var U;P.preventDefault(),(U=j.current)==null||U.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:f,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,onDismiss:h,children:u.jsx(Dm,{asChild:!0,...A,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:L,onCurrentTabStopIdChange:k,onEntryFocus:te(m,P=>{b.isUsingKeyboardRef.current||P.preventDefault()}),preventScrollOnEntryFocus:!0,children:u.jsx(ho,{role:"menu","aria-orientation":"vertical","data-state":Si(C.open),"data-radix-menu-content":"",dir:b.dir,..._,...v,ref:x,style:{outline:"none",...v.style},onKeyDown:te(v.onKeyDown,P=>{const q=P.target.closest("[data-radix-menu-content]")===P.currentTarget,N=P.ctrlKey||P.altKey||P.metaKey,D=P.key.length===1;q&&(P.key==="Tab"&&P.preventDefault(),!N&&D&&w(P.key));const $=j.current;if(P.target!==$||!Bm.includes(P.key))return;P.preventDefault();const H=E().filter(G=>!G.disabled).map(G=>G.ref.current);ti.includes(P.key)&&H.reverse(),up(H)}),onBlur:te(e.onBlur,P=>{P.currentTarget.contains(P.target)||(window.clearTimeout(y.current),T.current="")}),onPointerMove:te(e.onPointerMove,an(P=>{const U=P.target,q=I.current!==P.clientX;if(P.currentTarget.contains(U)&&q){const N=P.clientX>I.current?"right":"left";F.current=N,I.current=P.clientX}}))})})})})})})});ii.displayName=De;var tp="MenuGroup",Co=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(he.div,{role:"group",...r,ref:t})});Co.displayName=tp;var np="MenuLabel",li=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(he.div,{...r,ref:t})});li.displayName=np;var $n="MenuItem",bs="menu.itemSelect",tr=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,s=p.useRef(null),a=xn($n,e.__scopeMenu),i=yo($n,e.__scopeMenu),m=ke(t,s),f=p.useRef(!1),l=()=>{const c=s.current;if(!n&&c){const d=new CustomEvent(bs,{bubbles:!0,cancelable:!0});c.addEventListener(bs,h=>r==null?void 0:r(h),{once:!0}),wa(c,d),d.defaultPrevented?f.current=!1:a.onClose()}};return u.jsx(ci,{...o,ref:m,disabled:n,onClick:te(e.onClick,l),onPointerDown:c=>{var d;(d=e.onPointerDown)==null||d.call(e,c),f.current=!0},onPointerUp:te(e.onPointerUp,c=>{var d;f.current||(d=c.currentTarget)==null||d.click()}),onKeyDown:te(e.onKeyDown,c=>{const d=i.searchRef.current!=="";n||d&&c.key===" "||Ur.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});tr.displayName=$n;var ci=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,a=yo($n,n),i=ri(n),m=p.useRef(null),f=ke(t,m),[l,c]=p.useState(!1),[d,h]=p.useState("");return p.useEffect(()=>{const g=m.current;g&&h((g.textContent??"").trim())},[s.children]),u.jsx(sn.ItemSlot,{scope:n,disabled:r,textValue:o??d,children:u.jsx(Lm,{asChild:!0,...i,focusable:!r,children:u.jsx(he.div,{role:"menuitem","data-highlighted":l?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:f,onPointerMove:te(e.onPointerMove,an(g=>{r?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:te(e.onPointerLeave,an(g=>a.onItemLeave(g))),onFocus:te(e.onFocus,()=>c(!0)),onBlur:te(e.onBlur,()=>c(!1))})})})}),rp="MenuCheckboxItem",ui=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return u.jsx(hi,{scope:e.__scopeMenu,checked:n,children:u.jsx(tr,{role:"menuitemcheckbox","aria-checked":Un(n)?"mixed":n,...o,ref:t,"data-state":ko(n),onSelect:te(o.onSelect,()=>r==null?void 0:r(Un(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ui.displayName=rp;var di="MenuRadioGroup",[op,sp]=Nt(di,{value:void 0,onValueChange:()=>{}}),fi=p.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,s=Je(r);return u.jsx(op,{scope:e.__scopeMenu,value:n,onValueChange:s,children:u.jsx(Co,{...o,ref:t})})});fi.displayName=di;var mi="MenuRadioItem",pi=p.forwardRef((e,t)=>{const{value:n,...r}=e,o=sp(mi,e.__scopeMenu),s=n===o.value;return u.jsx(hi,{scope:e.__scopeMenu,checked:s,children:u.jsx(tr,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":ko(s),onSelect:te(r.onSelect,()=>{var a;return(a=o.onValueChange)==null?void 0:a.call(o,n)},{checkForDefaultPrevented:!1})})})});pi.displayName=mi;var So="MenuItemIndicator",[hi,ap]=Nt(So,{checked:!1}),gi=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,s=ap(So,n);return u.jsx(Oe,{present:r||Un(s.checked)||s.checked===!0,children:u.jsx(he.span,{...o,ref:t,"data-state":ko(s.checked)})})});gi.displayName=So;var ip="MenuSeparator",xi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return u.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});xi.displayName=ip;var lp="MenuArrow",vi=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=er(n);return u.jsx(go,{...o,...r,ref:t})});vi.displayName=lp;var cp="MenuSub",[Nb,bi]=Nt(cp),rn="MenuSubTrigger",yi=p.forwardRef((e,t)=>{const n=It(rn,e.__scopeMenu),r=xn(rn,e.__scopeMenu),o=bi(rn,e.__scopeMenu),s=yo(rn,e.__scopeMenu),a=p.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:m}=s,f={__scopeMenu:e.__scopeMenu},l=p.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return p.useEffect(()=>l,[l]),p.useEffect(()=>{const c=i.current;return()=>{window.clearTimeout(c),m(null)}},[i,m]),u.jsx(vo,{asChild:!0,...f,children:u.jsx(ci,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Si(n.open),...e,ref:qe(t,o.onTriggerChange),onClick:c=>{var d;(d=e.onClick)==null||d.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:te(e.onPointerMove,an(c=>{s.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!a.current&&(s.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),l()},100))})),onPointerLeave:te(e.onPointerLeave,an(c=>{var h,g;l();const d=(h=n.content)==null?void 0:h.getBoundingClientRect();if(d){const v=(g=n.content)==null?void 0:g.dataset.side,C=v==="right",b=C?-5:5,_=d[C?"left":"right"],A=d[C?"right":"left"];s.onPointerGraceIntentChange({area:[{x:c.clientX+b,y:c.clientY},{x:_,y:d.top},{x:A,y:d.top},{x:A,y:d.bottom},{x:_,y:d.bottom}],side:v}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(c),c.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:te(e.onKeyDown,c=>{var h;const d=s.searchRef.current!=="";e.disabled||d&&c.key===" "||Hm[r.dir].includes(c.key)&&(n.onOpenChange(!0),(h=n.content)==null||h.focus(),c.preventDefault())})})})});yi.displayName=rn;var wi="MenuSubContent",Ci=p.forwardRef((e,t)=>{const n=si(De,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,s=It(De,e.__scopeMenu),a=xn(De,e.__scopeMenu),i=bi(wi,e.__scopeMenu),m=p.useRef(null),f=ke(t,m);return u.jsx(sn.Provider,{scope:e.__scopeMenu,children:u.jsx(Oe,{present:r||s.open,children:u.jsx(sn.Slot,{scope:e.__scopeMenu,children:u.jsx(wo,{id:i.contentId,"aria-labelledby":i.triggerId,...o,ref:f,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:l=>{var c;a.isUsingKeyboardRef.current&&((c=m.current)==null||c.focus()),l.preventDefault()},onCloseAutoFocus:l=>l.preventDefault(),onFocusOutside:te(e.onFocusOutside,l=>{l.target!==i.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:te(e.onEscapeKeyDown,l=>{a.onClose(),l.preventDefault()}),onKeyDown:te(e.onKeyDown,l=>{var h;const c=l.currentTarget.contains(l.target),d=Wm[a.dir].includes(l.key);c&&d&&(s.onOpenChange(!1),(h=i.trigger)==null||h.focus(),l.preventDefault())})})})})})});Ci.displayName=wi;function Si(e){return e?"open":"closed"}function Un(e){return e==="indeterminate"}function ko(e){return Un(e)?"indeterminate":e?"checked":"unchecked"}function up(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function dp(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function fp(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let a=dp(e,Math.max(s,0));o.length===1&&(a=a.filter(f=>f!==n));const m=a.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return m!==n?m:void 0}function mp(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function pp(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mp(n,t)}function an(e){return t=>t.pointerType==="mouse"?e(t):void 0}var hp=oi,gp=vo,xp=ai,vp=ii,bp=Co,yp=li,wp=tr,Cp=ui,Sp=fi,kp=pi,Ep=gi,_p=xi,Ap=vi,jp=yi,Tp=Ci,nr="DropdownMenu",[Rp]=nt(nr,[ni]),Ne=ni(),[Np,ki]=Rp(nr),Ei=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:s,onOpenChange:a,modal:i=!0}=e,m=Ne(t),f=p.useRef(null),[l,c]=ut({prop:o,defaultProp:s??!1,onChange:a,caller:nr});return u.jsx(Np,{scope:t,triggerId:Re(),triggerRef:f,contentId:Re(),open:l,onOpenChange:c,onOpenToggle:p.useCallback(()=>c(d=>!d),[c]),modal:i,children:u.jsx(hp,{...m,open:l,onOpenChange:c,dir:r,modal:i,children:n})})};Ei.displayName=nr;var _i="DropdownMenuTrigger",Ai=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,s=ki(_i,n),a=Ne(n);return u.jsx(gp,{asChild:!0,...a,children:u.jsx(he.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:qe(t,s.triggerRef),onPointerDown:te(e.onPointerDown,i=>{!r&&i.button===0&&i.ctrlKey===!1&&(s.onOpenToggle(),s.open||i.preventDefault())}),onKeyDown:te(e.onKeyDown,i=>{r||(["Enter"," "].includes(i.key)&&s.onOpenToggle(),i.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Ai.displayName=_i;var Ip="DropdownMenuPortal",ji=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ne(t);return u.jsx(xp,{...r,...n})};ji.displayName=Ip;var Ti="DropdownMenuContent",Ri=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=ki(Ti,n),s=Ne(n),a=p.useRef(!1);return u.jsx(vp,{id:o.contentId,"aria-labelledby":o.triggerId,...s,...r,ref:t,onCloseAutoFocus:te(e.onCloseAutoFocus,i=>{var m;a.current||(m=o.triggerRef.current)==null||m.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:te(e.onInteractOutside,i=>{const m=i.detail.originalEvent,f=m.button===0&&m.ctrlKey===!0,l=m.button===2||f;(!o.modal||l)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Ri.displayName=Ti;var Mp="DropdownMenuGroup",Pp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(bp,{...o,...r,ref:t})});Pp.displayName=Mp;var Op="DropdownMenuLabel",Ni=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(yp,{...o,...r,ref:t})});Ni.displayName=Op;var Dp="DropdownMenuItem",Ii=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(wp,{...o,...r,ref:t})});Ii.displayName=Dp;var Lp="DropdownMenuCheckboxItem",Fp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Cp,{...o,...r,ref:t})});Fp.displayName=Lp;var $p="DropdownMenuRadioGroup",Up=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Sp,{...o,...r,ref:t})});Up.displayName=$p;var zp="DropdownMenuRadioItem",Bp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(kp,{...o,...r,ref:t})});Bp.displayName=zp;var Hp="DropdownMenuItemIndicator",Wp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ep,{...o,...r,ref:t})});Wp.displayName=Hp;var Gp="DropdownMenuSeparator",Mi=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(_p,{...o,...r,ref:t})});Mi.displayName=Gp;var Vp="DropdownMenuArrow",Kp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Ap,{...o,...r,ref:t})});Kp.displayName=Vp;var qp="DropdownMenuSubTrigger",Yp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(jp,{...o,...r,ref:t})});Yp.displayName=qp;var Xp="DropdownMenuSubContent",Qp=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=Ne(n);return u.jsx(Tp,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Qp.displayName=Xp;var Zp=Ei,Jp=Ai,eh=ji,th=Ri,nh=Ni,rh=Ii,oh=Mi;function Pi({...e}){return u.jsx(Zp,{"data-slot":"dropdown-menu",...e})}function Oi({...e}){return u.jsx(Jp,{"data-slot":"dropdown-menu-trigger",...e})}function Di({className:e,sideOffset:t=4,...n}){return u.jsx(eh,{children:u.jsx(th,{"data-slot":"dropdown-menu-content",sideOffset:t,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...n})})}function Tn({className:e,inset:t,variant:n="default",...r}){return u.jsx(rh,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:ee("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}function sh({className:e,inset:t,...n}){return u.jsx(nh,{"data-slot":"dropdown-menu-label","data-inset":t,className:ee("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...n})}function ys({className:e,...t}){return u.jsx(oh,{"data-slot":"dropdown-menu-separator",className:ee("bg-border -mx-1 my-1 h-px",e),...t})}const ah=[{value:"light",label:"Light",icon:u.jsx(pa,{className:"h-4 w-4"})},{value:"dark",label:"Dark",icon:u.jsx(da,{className:"h-4 w-4"})},{value:"system",label:"System",icon:u.jsx(Hu,{className:"h-4 w-4"})}];function ih(){const{theme:e,setTheme:t,resolvedTheme:n}=wd();return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"icon",className:"h-8 w-8",children:[n==="dark"?u.jsx(da,{className:"h-4 w-4"}):u.jsx(pa,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),u.jsx(Di,{align:"end",children:ah.map(r=>u.jsxs(Tn,{onClick:()=>t(r.value),className:e===r.value?"bg-accent":"",children:[r.icon,u.jsx("span",{className:"ml-2",children:r.label})]},r.value))})]})}const ws={"auth.setup.title":"首次部署","auth.setup.apiKey":"API Key","auth.setup.username":"管理员用户名","auth.setup.password":"密码","auth.setup.confirmPassword":"确认密码","auth.setup.submit":"初始化","auth.setup.passwordMismatch":"两次密码不一致","auth.setup.passwordTooShort":"密码至少 8 个字符","auth.setup.alreadyDone":"初始化已完成,请登录","auth.setup.invalidKey":"API Key 无效","auth.setup.description":"输入 RCS_API_KEYS 之一,并设置管理员账号密码。","auth.login.title":"登录","auth.login.username":"用户名","auth.login.password":"密码","auth.login.submit":"登录","auth.login.failed":"用户名或密码错误","auth.login.description":"输入你的用户名和密码以继续。","auth.join.title":"加入团队","auth.join.welcome":"欢迎加入","auth.join.username":"用户名","auth.join.password":"密码","auth.join.confirmPassword":"确认密码","auth.join.submit":"加入","auth.join.invalidInvite":"邀请链接无效或已过期","auth.join.description":"设置你的用户名和密码以加入团队。","auth.register.title":"注册账号","auth.register.description":"创建一个账号以开始使用。","auth.register.submit":"注册","auth.register.failed":"注册失败","auth.register.backToLogin":"返回登录","auth.login.register":"没有账号?注册","invitation.addExisting":"添加已有用户","invitation.addExistingHint":"通过用户名或用户 ID 搜索并直接添加到团队","invitation.searchUser":"搜索用户","invitation.add":"添加","user.menu.settings":"个人设置","user.menu.logout":"登出","user.settings.title":"个人设置","user.settings.changePassword":"修改密码","user.settings.currentPassword":"当前密码","user.settings.newPassword":"新密码","user.settings.confirmNewPassword":"确认新密码","user.settings.submit":"保存","user.settings.logoutAll":"登出所有会话","user.settings.comingSoon":"此功能即将上线","user.settings.passwordChanged":"密码修改成功","user.settings.changeFailed":"修改密码失败","common.loading":"加载中…","common.error":"出错了","common.cancel":"取消","common.close":"关闭","common.create":"创建","common.creating":"创建中…","common.revoke":"撤销","team.menu.myTeams":"我的团队","team.switcher.label":"切换团队","team.switcher.personal":"个人","team.list.title":"我的团队","team.list.create":"创建团队","team.create.title":"创建团队","team.create.name":"团队名称","team.create.nameHint":"展示用名称,可包含中文、空格,允许重名","team.create.slug":"标识符","team.create.slugHint":"3-32 个小写字母、数字或连字符,用于 URL 路径,全局唯一","team.create.description":"描述(可选)","team.create.submit":"创建团队","team.detail.members":"成员","team.detail.environments":"环境","team.detail.invitations":"邀请","team.settings.title":"团队设置","team.settings.dangerZone":"危险区域","team.settings.delete":"删除团队","team.member.role":"角色","team.member.roleOwner":"所有者","team.member.roleAdmin":"管理员","team.member.roleMember":"成员","team.member.changeRole":"调整角色","team.member.remove":"移出团队","team.member.removeConfirm":"确定将 {name} 移出团队?此操作不可撤销。","team.member.updateFailed":"操作失败","team.member.you":"(你)","share.title":"分享会话","share.grantTo":"授权给","share.user":"用户","share.team":"团队","share.permission":"权限","share.permissionRead":"只读","share.permissionWrite":"读写","share.expiresAt":"过期时间(可选)","share.copy":"复制","share.copied":"已复制!","share.existingShares":"现有分享","share.createShare":"创建分享","share.loading":"加载分享中…","share.none":"暂无分享。","share.linkCreated":"分享链接已创建!","share.revoke":"撤销","share.userIdPlaceholder":"搜索用户名或用户 ID","share.teamIdPlaceholder":"团队 ID(在「团队详情」可查看)","share.selectUser":"选择","share.selectedUser":"已选择","share.copyFailed":"复制失败,请手动选择链接复制","invitation.title":"邀请","invitation.member":"成员","invitation.admin":"管理员","invitation.create":"创建","invitation.creating":"创建中…","invitation.revoke":"撤销","dashboard.title":"仪表盘","dashboard.environments":"环境","dashboard.sessions":"会话","dashboard.newSession":"+ 新会话","dashboard.confirmDelete":"删除会话 {id}?此操作不可恢复。","dashboard.deleteFailed":"删除会话失败","dialog.newSession":"新会话","dialog.titleOptional":"标题(可选)","dialog.titlePlaceholder":"我的会话","dialog.environment":"环境","dialog.none":"-- 无 --","dialog.noBranch":"无分支","dialog.workspaceMode":"工作区模式","dialog.sameDir":"工作区 (same-dir) — 会话共享目录","dialog.worktree":"工作树 (worktree) — 每个会话获得独立的 git worktree","dialog.createFailed":"创建会话失败","dialog.envEmpty":"暂无可用环境","dialog.envPersonal":"个人","dialog.envTeam":"团队","dialog.envDirectory":"目录","dialog.envSelectEnv":"选择环境","nav.dashboard":"仪表盘","nav.remoteControl":"远程控制","session.share":"分享会话","session.loadFailed":"加载会话失败","session.backToDashboard":"← 返回仪表盘","session.loading":"加载会话中…","session.info":"会话信息","session.tasks":"任务","session.metaSession":"会话","session.metaEnvironment":"环境","session.emptyTitle":"开始对话","session.emptyDescription":"输入消息开始聊天","session.closed":"会话已关闭","session.closedSendBlocked":"会话已归档,消息未发送","session.sendFailed":"消息发送失败","session.readOnly":"只读会话,无法发送消息","session.mySessions":"我的会话","session.sharedWithMe":"共享给我的会话","session.inputPlaceholder":"输入消息…","session.connectingAgent":"连接代理中…","session.connectionFailed":"连接失败","user.settings.language":"语言","user.settings.role":"角色","user.settings.backDashboard":"← 仪表盘","artifacts.title":"Artifacts","artifacts.subtitle":"团队共享的交互界面与报告","artifacts.new":"新建 Artifact","artifacts.empty":'还没有 Artifact。让 agent 用 artifact 工具上传,或点击"新建"从模板创建。',"artifacts.loadFailed":"加载 Artifacts 失败","artifacts.delete":"删除","artifacts.deleteFailed":"删除失败","artifacts.openInNewTab":"新窗口打开","artifacts.copyLink":"复制链接","artifacts.copied":"已复制","artifacts.expires":"过期时间","artifacts.version":"版本","artifacts.session":"会话","artifacts.updatedAt":"更新于","artifacts.viewNotFound":"Artifact 不存在或已过期","artifacts.backToGallery":"← 返回 Artifacts","artifacts.create.title":"新建 Artifact","artifacts.editArtifact":"编辑 Artifact","artifacts.edit":"编辑","artifacts.update":"保存更新","artifacts.updateFailed":"更新失败","artifacts.linkNotice":"任何持有链接的人均可访问","artifacts.create.contentRequired":"内容不能为空","artifacts.create.ttl":"有效期","artifacts.create.ttlResetNote":"保存后过期时间将按所选有效期重置","artifacts.create.preview":"实时预览","artifacts.create.template":"模板","artifacts.create.templateBlank":"空白 HTML","artifacts.create.templatePrReview":"PR 审查","artifacts.create.templateIncident":"故障排查时间线","artifacts.create.templateDashboard":"数据看板","artifacts.create.templateChecklist":"发布检查清单","artifacts.create.title.label":"标题","artifacts.create.content":"内容 (HTML 或 Markdown)","artifacts.create.submit":"创建","artifacts.create.failed":"创建失败","artifacts.templateDesc.prReview":"逐文件审查结论、评论与整体状态","artifacts.templateDesc.incident":"按时间线排查故障,标记状态与严重级别","artifacts.templateDesc.dashboard":"KPI 卡片、SVG 图表与数据表","artifacts.templateDesc.checklist":"分阶段发布检查项与进度条","artifacts.create.mode.template":"模板","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI 生成","artifacts.create.markdownHint":"用 Markdown 撰写,提交时自动转为带样式的 HTML 页面","artifacts.create.bindSession":"关联会话(可选)","artifacts.create.noSession":"不关联(仅自己可见)","artifacts.create.sessionHint":"关联后团队成员可通过该会话看到此 artifact","artifacts.create.ai.targetSession":"目标会话","artifacts.create.ai.brief":"需求描述","artifacts.create.ai.briefPlaceholder":"例如:一个展示本周构建成功率的看板,含趋势图与异常列表…","artifacts.create.ai.send":"发送给会话","artifacts.create.ai.sending":"发送中…","artifacts.create.ai.sessionRequired":"请选择目标会话","artifacts.create.ai.briefRequired":"请描述你需要的页面","artifacts.create.ai.sent":"需求已发送。页面生成完成后,该会话的 artifacts 提示会亮起。","artifacts.create.ai.openSession":"前往会话","artifacts.create.ai.noSessions":"没有可用会话。请先在 Code 页开启一个会话,再回来使用 AI 生成。","admin.title":"管理面板","admin.teams":"团队","admin.sessions":"所有会话","admin.orphanSessions":"孤儿会话","admin.noTeams":"暂无团队","admin.noSessions":"暂无会话"},lh={"auth.setup.title":"First-time setup","auth.setup.apiKey":"API Key","auth.setup.username":"Admin username","auth.setup.password":"Password","auth.setup.confirmPassword":"Confirm password","auth.setup.submit":"Initialize","auth.setup.passwordMismatch":"Passwords do not match","auth.setup.passwordTooShort":"Password must be at least 8 characters","auth.setup.alreadyDone":"Setup already completed. Please log in.","auth.setup.invalidKey":"Invalid API key","auth.setup.description":"Enter one of RCS_API_KEYS and set your admin credentials.","auth.login.title":"Login","auth.login.username":"Username","auth.login.password":"Password","auth.login.submit":"Log in","auth.login.failed":"Invalid username or password","auth.login.description":"Enter your username and password to continue.","auth.join.title":"Join team","auth.join.welcome":"Welcome aboard","auth.join.username":"Username","auth.join.password":"Password","auth.join.confirmPassword":"Confirm password","auth.join.submit":"Join","auth.join.invalidInvite":"Invalid or expired invitation","auth.join.description":"Set your username and password to join the team.","auth.register.title":"Create account","auth.register.description":"Sign up to start using the platform.","auth.register.submit":"Register","auth.register.failed":"Registration failed","auth.register.backToLogin":"Back to login","auth.login.register":"No account? Register","invitation.addExisting":"Add existing user","invitation.addExistingHint":"Search by username or user ID and add directly to the team","invitation.searchUser":"Search users","invitation.add":"Add","user.menu.settings":"Settings","user.menu.logout":"Log out","user.settings.title":"Settings","user.settings.changePassword":"Change password","user.settings.currentPassword":"Current password","user.settings.newPassword":"New password","user.settings.confirmNewPassword":"Confirm new password","user.settings.submit":"Save","user.settings.logoutAll":"Log out of all sessions","user.settings.comingSoon":"This feature is coming soon","user.settings.passwordChanged":"Password changed successfully","user.settings.changeFailed":"Failed to change password","common.loading":"Loading...","common.error":"Something went wrong","common.cancel":"Cancel","common.close":"Close","common.create":"Create","common.creating":"Creating...","common.revoke":"Revoke","team.menu.myTeams":"My teams","team.switcher.label":"Switch team","team.switcher.personal":"Personal","team.list.title":"My teams","team.list.create":"Create team","team.create.title":"Create team","team.create.name":"Team Name","team.create.nameHint":"Display name — can include spaces and any characters, duplicates allowed","team.create.slug":"Slug","team.create.slugHint":"3-32 lowercase letters, digits, or hyphens — used in URLs, globally unique","team.create.description":"Description (optional)","team.create.submit":"Create Team","team.detail.members":"Members","team.detail.environments":"Environments","team.detail.invitations":"Invitations","team.settings.title":"Team settings","team.settings.dangerZone":"Danger zone","team.settings.delete":"Delete team","team.member.role":"Role","team.member.roleOwner":"Owner","team.member.roleAdmin":"Admin","team.member.roleMember":"Member","team.member.changeRole":"Change role","team.member.remove":"Remove from team","team.member.removeConfirm":"Remove {name} from team? This cannot be undone.","team.member.updateFailed":"Operation failed","team.member.you":"(you)","share.title":"Share Session","share.grantTo":"Grant to","share.user":"User","share.team":"Team","share.permission":"Permission","share.permissionRead":"Read only","share.permissionWrite":"Read & write","share.expiresAt":"Expires at (optional)","share.copy":"Copy","share.copied":"Copied!","share.existingShares":"Existing Shares","share.createShare":"Create Share","share.loading":"Loading shares...","share.none":"No shares yet.","share.linkCreated":"Share link created!","share.revoke":"Revoke","share.userIdPlaceholder":"Search by username or user ID","share.teamIdPlaceholder":"Team ID (visible in Team Details)","share.selectUser":"Select","share.selectedUser":"Selected","share.copyFailed":"Copy failed — please select the link manually","invitation.title":"Invitations","invitation.member":"Member","invitation.admin":"Admin","invitation.create":"Create","invitation.creating":"Creating...","invitation.revoke":"Revoke","dashboard.title":"Dashboard","dashboard.environments":"Environments","dashboard.sessions":"Sessions","dashboard.newSession":"+ New Session","dashboard.confirmDelete":"Delete session {id}? This cannot be undone.","dashboard.deleteFailed":"Failed to delete session","dialog.newSession":"New Session","dialog.titleOptional":"Title (optional)","dialog.titlePlaceholder":"My session","dialog.environment":"Environment","dialog.none":"-- None --","dialog.noBranch":"no branch","dialog.workspaceMode":"Workspace Mode","dialog.sameDir":"Workspace (same-dir) — sessions share the directory","dialog.worktree":"Worktree (worktree) — each session gets an isolated git worktree","dialog.createFailed":"Failed to create session","dialog.envEmpty":"No environments available","dialog.envPersonal":"Personal","dialog.envTeam":"Team","dialog.envDirectory":"Directory","dialog.envSelectEnv":"Select environment","nav.dashboard":"Dashboard","nav.remoteControl":"Remote Control","session.share":"Share Session","session.loadFailed":"Failed to load session","session.backToDashboard":"← Back to Dashboard","session.loading":"Loading session...","session.info":"Session info","session.tasks":"Tasks","session.metaSession":"Session","session.metaEnvironment":"Environment","session.emptyTitle":"Start a conversation","session.emptyDescription":"Type a message to start chatting","session.closed":"Session closed","session.closedSendBlocked":"Session is archived — message was not sent","session.sendFailed":"Failed to send message","session.readOnly":"Read-only session — cannot send messages","session.mySessions":"My sessions","session.sharedWithMe":"Shared with me","session.inputPlaceholder":"Type a message...","session.connectingAgent":"Connecting to agent...","session.connectionFailed":"Connection Failed","user.settings.language":"Language","user.settings.role":"Role","user.settings.backDashboard":"← Dashboard","artifacts.title":"Artifacts","artifacts.subtitle":"Interactive interfaces & reports shared with your team","artifacts.new":"New Artifact","artifacts.empty":"No artifacts yet. Have the agent upload one with the artifact tool, or start from a template.","artifacts.loadFailed":"Failed to load artifacts","artifacts.delete":"Delete","artifacts.deleteFailed":"Delete failed","artifacts.openInNewTab":"Open in new tab","artifacts.copyLink":"Copy link","artifacts.copied":"Copied","artifacts.expires":"Expires","artifacts.version":"Version","artifacts.session":"Session","artifacts.updatedAt":"Updated","artifacts.viewNotFound":"Artifact not found or expired","artifacts.backToGallery":"← Back to Artifacts","artifacts.create.title":"New Artifact","artifacts.editArtifact":"Edit Artifact","artifacts.edit":"Edit","artifacts.update":"Save update","artifacts.updateFailed":"Update failed","artifacts.linkNotice":"Anyone with the link can view","artifacts.create.contentRequired":"Content is required","artifacts.create.ttl":"Lifetime","artifacts.create.ttlResetNote":"Saving resets the expiry from the chosen lifetime","artifacts.create.preview":"Live preview","artifacts.create.template":"Template","artifacts.create.templateBlank":"Blank HTML","artifacts.create.templatePrReview":"PR Review","artifacts.create.templateIncident":"Incident Timeline","artifacts.create.templateDashboard":"Data Dashboard","artifacts.create.templateChecklist":"Release Checklist","artifacts.create.title.label":"Title","artifacts.create.content":"Content (HTML or Markdown)","artifacts.create.submit":"Create","artifacts.create.failed":"Create failed","artifacts.templateDesc.prReview":"Per-file review verdicts, comments & overall status","artifacts.templateDesc.incident":"Chronological investigation with severity & status markers","artifacts.templateDesc.dashboard":"KPI cards, SVG charts & data tables","artifacts.templateDesc.checklist":"Staged release checks with progress bar","artifacts.create.mode.template":"Template","artifacts.create.mode.markdown":"Markdown","artifacts.create.mode.ai":"AI generate","artifacts.create.markdownHint":"Write Markdown; it is converted to a styled HTML page on submit","artifacts.create.bindSession":"Link to session (optional)","artifacts.create.noSession":"None (visible to you only)","artifacts.create.sessionHint":"Linked artifacts become visible to your team via the session","artifacts.create.ai.targetSession":"Target session","artifacts.create.ai.brief":"Describe what you need","artifacts.create.ai.briefPlaceholder":"e.g. a dashboard of this week’s build success rate, with a trend chart and failure list…","artifacts.create.ai.send":"Send to session","artifacts.create.ai.sending":"Sending…","artifacts.create.ai.sessionRequired":"Select a target session","artifacts.create.ai.briefRequired":"Describe the page you need","artifacts.create.ai.sent":"Request sent. The session’s artifacts badge will light up when the page is ready.","artifacts.create.ai.openSession":"Open session","artifacts.create.ai.noSessions":"No sessions available. Start one on the Code page first, then come back.","admin.title":"Admin Panel","admin.teams":"Teams","admin.sessions":"All Sessions","admin.orphanSessions":"Orphan Sessions","admin.noTeams":"No teams","admin.noSessions":"No sessions"},Li="rcs_locale";function ch(){try{const t=localStorage.getItem(Li);if(t==="zh"||t==="en")return t}catch{}return typeof navigator>"u"||(navigator.language||"").startsWith("zh")?"zh":"en"}let Eo=ch();const zr=new Set;function Ib(e){Eo=e;try{localStorage.setItem(Li,e)}catch{}zr.forEach(t=>t())}function uh(e){return zr.add(e),()=>{zr.delete(e)}}function Fi(){return p.useSyncExternalStore(uh,()=>Eo)}function Fe(e){return Eo==="en"?lh[e]??ws[e]??e:ws[e]??e}const dh="";let zn=null;function fh(e){zn=e}function Mb(){return zn}let Br=null;function Cs(e){Br=e}let tn=null;async function mh(){return tn||(tn=(async()=>{try{return(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok}catch{return!1}finally{tn=null}})(),tn)}class wr extends Error{constructor(n,r,o){super(n);oe(this,"type");oe(this,"status");this.name="ApiError",this.type=r,this.status=o}}async function xe(e,t,n,r){const o={"Content-Type":"application/json"};zn&&(o.Authorization=`Bearer ${zn}`);const s=`${dh}${t}`,a={method:e,headers:o,credentials:"include"};n!==void 0&&(a.body=JSON.stringify(n));const i=await fetch(s,a);if(i.status===401&&!t.startsWith("/web/auth/")){if(!r&&await mh())return xe(e,t,n,!0);Br&&Br()}let m;try{m=await i.json()}catch{throw i.ok?new wr("Invalid JSON response","parse_error",i.status):new wr(i.statusText,"http_error",i.status)}if(!i.ok){const f=m;let l="unknown",c=i.statusText;throw typeof f.error=="string"?(c=f.error,l="http_error"):f.error&&typeof f.error=="object"&&(l=f.error.type||"unknown",c=f.error.message||f.error.type||i.statusText),new wr(c,l,i.status)}return m}function Pb(){return xe("GET","/web/sessions")}function Ob(){return xe("GET","/web/sessions/all")}function Db(e){return xe("GET",`/web/sessions/${e}`)}function Lb(e){return xe("GET",`/web/sessions/${e}/history`)}function Fb(){return xe("GET","/web/environments")}function $b(e,t){return xe("POST",`/web/sessions/${e}/events`,t)}function Ub(e,t){return xe("POST",`/web/sessions/${e}/control`,t)}function zb(e){return xe("POST",`/web/sessions/${e}/interrupt`)}function Bb(e){return xe("DELETE",`/web/sessions/${e}`)}function Hb(e){return xe("POST",`/web/sessions/${e}/clear`)}function Wb(e,t){return xe("PATCH",`/web/sessions/${e}`,{title:t})}function Gb(e){return xe("POST","/web/sessions",e)}function Vb(e){return xe("GET",`/web/sessions/s/${e}`)}function Kb(e){return xe("GET",`/web/sessions/${e}/shares`)}function qb(e,t){return xe("POST",`/web/sessions/${e}/shares`,t)}function Yb(e,t){return xe("DELETE",`/web/sessions/${e}/shares/${t}`)}function Xb(e,t){return xe("POST",`/web/environments/${e}/transfer`,{toTeamId:t})}function Qb(e,t){return xe("DELETE",`/web/teams/${e}/environments/${t}`)}function Zb(e){return xe("POST","/web/environments/claim",{claim_token:e})}function Jb(e){const t=new URLSearchParams;e!=null&&e.session_id&&t.set("session_id",e.session_id),e!=null&&e.team_id&&t.set("team_id",e.team_id),e!=null&&e.scope&&t.set("scope",e.scope);const n=t.toString(),r=n?`?${n}`:"";return xe("GET",`/web/artifacts${r}`)}function ey(e){return xe("GET",`/web/artifacts/${e}`)}function ty(e){return xe("POST","/web/artifacts",e)}function ny(e){return xe("DELETE",`/web/artifacts/${e}`)}const Hr="rcs_active_team";function ph(){try{return localStorage.getItem(Hr)}catch{return null}}let $i=ph();const Wr=new Set;function hh(){for(const e of Wr)e()}function gh(e){return Wr.add(e),()=>Wr.delete(e)}function xh(){return $i}function Ct(e){try{e?localStorage.setItem(Hr,e):localStorage.removeItem(Hr)}catch{}$i=e,hh()}function vh(){const[e,t]=p.useState([]),[n,r]=p.useState(!0),o=p.useSyncExternalStore(gh,xh,()=>null),s=p.useCallback(async()=>{r(!0);try{const f=await xe("GET","/web/teams");t(f)}catch{t([])}finally{r(!1)}},[]);p.useEffect(()=>{s()},[s]);const a=e.find(f=>f.id===o)||null,i=p.useCallback(f=>{Ct(f)},[]),m=p.useCallback(async f=>{const l=await xe("POST","/web/teams",f);return await s(),l},[s]);return{myTeams:e,activeTeam:a,isLoading:n,switchTeam:i,createTeam:m,refetch:s}}function bh({className:e}){Fi();const{myTeams:t,activeTeam:n,switchTeam:r,isLoading:o}=vh();return o||t.length===0?null:u.jsxs("div",{className:ee("relative",e),children:[u.jsxs("select",{className:"appearance-none rounded-md border border-border bg-surface-2 px-3 py-1.5 pr-7 text-sm text-text-primary hover:bg-surface-3 transition-colors cursor-pointer",value:(n==null?void 0:n.id)||"",onChange:s=>{const a=s.target.value;r(a||null)},children:[u.jsx("option",{value:"",children:Fe("team.switcher.personal")}),t.map(s=>u.jsx("option",{value:s.id,children:s.name},s.id))]}),u.jsx(Kt,{className:"absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-text-muted pointer-events-none"})]})}const Ui=p.createContext(null);function zi(){const e=p.useContext(Ui);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}async function Dt(){try{const e=await fetch("/web/auth/me",{credentials:"include"});return e.ok?await e.json():null}catch{return null}}async function yh(){try{const e=await fetch("/web/auth/setup-status",{credentials:"include"});return e.ok?(await e.json()).needsSetup:!1}catch{return!1}}async function An(e){try{return await e.json()}catch{throw new Error(e.statusText||"Server error")}}function wh({children:e}){const[t,n]=p.useState(null),[r,o]=p.useState(!0),[s,a]=p.useState(!0);p.useEffect(()=>{let g=!1;return Dt().then(v=>{g||(n(v),o(!1))}),fetch("/web/auth/register-status",{credentials:"include"}).then(v=>v.json()).then(v=>{g||a(v.allowed===!0)}).catch(()=>{}),Cs(()=>{n(null),Ct(null),window.location.pathname!=="/login"&&window.location.pathname!=="/setup"&&(window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate")))}),()=>{g=!0,Cs(null)}},[]);const i=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/login",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Login failed")}const b=await Dt();n(b),Ct(null)},[]),m=p.useCallback(async()=>{try{await fetch("/web/auth/logout",{method:"POST",credentials:"include"})}catch{}n(null),Ct(null)},[]),f=p.useCallback(async()=>{try{if(!(await fetch("/web/auth/refresh",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).ok)return!1;const v=await Dt();return n(v),!0}catch{return!1}},[]),l=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/setup",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Setup failed")}const _=await Dt();n(_),Ct(null)},[]),c=p.useCallback(async(g,v,C)=>{const b=await fetch("/web/auth/join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({inviteToken:g,username:v,password:C})});if(!b.ok){const A=await An(b);throw new Error(A.error||"Join failed")}const _=await Dt();n(_),Ct(null)},[]),d=p.useCallback(async(g,v)=>{const C=await fetch("/web/auth/register",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:g,password:v})});if(!C.ok){const _=await An(C);throw new Error(_.error||"Registration failed")}const b=await Dt();n(b),Ct(null)},[]),h=p.useCallback(async()=>yh(),[]);return u.jsx(Ui.Provider,{value:{user:t,isLoading:r,login:i,logout:m,refresh:f,setup:l,join:c,register:d,checkSetupStatus:h,registrationAllowed:s},children:e})}function Ch({onSettingsClick:e}){const{user:t,logout:n}=zi();if(!t)return null;const r=async()=>{await n(),window.history.pushState(null,"","/login"),window.dispatchEvent(new PopStateEvent("popstate"))};return u.jsxs(Pi,{children:[u.jsx(Oi,{asChild:!0,children:u.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-primary hover:bg-surface-2 transition-colors",title:t.username,children:[u.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-brand/15 text-brand",children:u.jsx(ha,{className:"h-3.5 w-3.5"})}),u.jsx("span",{className:"hidden sm:inline max-w-20 truncate font-medium",children:t.username})]})}),u.jsxs(Di,{align:"end",className:"w-48",children:[u.jsx(sh,{children:u.jsxs("div",{className:"flex flex-col space-y-0.5",children:[u.jsx("span",{className:"text-sm font-medium",children:t.username}),u.jsx("span",{className:"text-xs text-muted-foreground",children:t.role})]})}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:e,children:[u.jsx(sd,{className:"mr-2 h-4 w-4"}),Fe("user.menu.settings")]}),u.jsxs(Tn,{onClick:()=>{window.history.pushState(null,"","/teams"),window.dispatchEvent(new PopStateEvent("popstate"))},children:[u.jsx(bd,{className:"mr-2 h-4 w-4"}),Fe("team.menu.myTeams")]}),u.jsx(ys,{}),u.jsxs(Tn,{onClick:r,children:[u.jsx($u,{className:"mr-2 h-4 w-4"}),Fe("user.menu.logout")]})]})]})}function Sh({sessionTitle:e,sessionSource:t,onBack:n,onNavigateSettings:r,onNavigateArtifacts:o}){return Fi(),u.jsx("nav",{className:"sticky top-0 z-40 border-b border-border bg-surface-1/80 backdrop-blur-md",children:u.jsxs("div",{className:"mx-auto flex h-11 sm:h-12 max-w-5xl items-center justify-between px-3 sm:px-4",children:[u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[!e&&u.jsx(bh,{}),e?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button",onClick:n,className:"flex items-center gap-1 text-sm text-text-muted hover:text-text-primary transition-colors flex-shrink-0",children:[u.jsx(wu,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),u.jsx("span",{className:"text-text-muted/40",children:"/"}),u.jsx("span",{className:"text-sm font-display font-medium text-text-primary truncate",children:e}),t&&u.jsx("span",{className:"rounded-full bg-brand/15 px-2 py-0.5 text-[10px] font-medium text-brand flex-shrink-0",children:t==="acp"?"ACP":"RCS"})]}):u.jsxs("a",{href:"/code/",className:"flex items-center gap-2 font-display text-lg font-semibold text-text-primary no-underline",children:[u.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",className:"flex-shrink-0",children:u.jsx("path",{d:"M10 1L12.2 7.8L19 10L12.2 12.2L10 19L7.8 12.2L1 10L7.8 7.8L10 1Z",fill:"var(--color-brand)"})}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.remoteControl")})]})]}),u.jsxs("div",{className:"flex items-center gap-0.5 sm:gap-1",children:[!e&&u.jsxs("a",{href:"/code/",className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary no-underline transition-colors",title:Fe("nav.dashboard"),children:[u.jsx(Du,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("nav.dashboard")})]}),o&&u.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 rounded-md px-2 sm:px-3 py-1.5 text-sm text-text-secondary hover:bg-surface-2 hover:text-text-primary transition-colors",title:Fe("artifacts.title"),children:[u.jsx(Ru,{className:"h-4 w-4"}),u.jsx("span",{className:"hidden sm:inline",children:Fe("artifacts.title")})]}),u.jsx(ih,{}),u.jsx(Ch,{onSettingsClick:r??(()=>{window.history.pushState(null,"","/settings"),window.dispatchEvent(new PopStateEvent("popstate"))})})]})]})})}function ry({status:e}){const t={active:"bg-status-active/20 text-status-active",running:"bg-status-running/20 text-status-running",idle:"bg-status-idle/20 text-status-idle",inactive:"bg-text-muted/20 text-text-muted",requires_action:"bg-status-warning/20 text-status-warning",archived:"bg-text-muted/20 text-text-muted",error:"bg-status-error/20 text-status-error"};return u.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",t[e]||"bg-surface-3 text-text-secondary"),children:e})}function kh(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return`rcs.auth.${btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}`}class Bi extends Error{constructor(){super("Disconnect requested"),this.name="DisconnectRequestedError"}}const ct=class ct{constructor(t){oe(this,"ws",null);oe(this,"settings");oe(this,"connectionState","disconnected");oe(this,"sessionId",null);oe(this,"_agentCapabilities",null);oe(this,"_promptCapabilities",null);oe(this,"_modelState",null);oe(this,"_availableCommands",[]);oe(this,"_usage",null);oe(this,"_currentModeId",null);oe(this,"_configOptions",[]);oe(this,"onModelChanged",new Set);oe(this,"onModelStateChanged",new Set);oe(this,"onUsageChanged",new Set);oe(this,"onCurrentModeChanged",new Set);oe(this,"onConfigOptionsChanged",new Set);oe(this,"onAvailableCommandsChanged",null);oe(this,"onSessionLoaded",null);oe(this,"onSessionSwitching",null);oe(this,"onConnectionStateChange",new Set);oe(this,"onSessionUpdate",null);oe(this,"onSessionCreated",null);oe(this,"onPromptComplete",null);oe(this,"onPermissionRequest",null);oe(this,"onBrowserToolCall",null);oe(this,"onErrorMessage",null);oe(this,"onSessionDeleted",null);oe(this,"onSessionRenamed",null);oe(this,"pendingSessionList",null);oe(this,"pendingSessionLoad",null);oe(this,"pendingSessionResume",null);oe(this,"pendingSessionTarget",null);oe(this,"connectResolve",null);oe(this,"connectReject",null);oe(this,"heartbeatInterval",null);oe(this,"heartbeatTimeout",null);oe(this,"missedPongs",0);this.settings=t}updateSettings(t){this.settings=t}setConnectionStateHandler(t){this.onConnectionStateChange.add(t)}removeConnectionStateHandler(t){this.onConnectionStateChange.delete(t)}setSessionUpdateHandler(t){this.onSessionUpdate=t}setSessionCreatedHandler(t){this.onSessionCreated=t}setSessionDeletedHandler(t){this.onSessionDeleted=t}setSessionRenamedHandler(t){this.onSessionRenamed=t}setPromptCompleteHandler(t){this.onPromptComplete=t}setModelChangedHandler(t){this.onModelChanged.add(t)}removeModelChangedHandler(t){this.onModelChanged.delete(t)}setModelStateChangedHandler(t){this.onModelStateChanged.add(t),t(this._modelState)}removeModelStateChangedHandler(t){this.onModelStateChanged.delete(t)}setUsageChangedHandler(t){this.onUsageChanged.add(t),t(this._usage)}removeUsageChangedHandler(t){this.onUsageChanged.delete(t)}setCurrentModeChangedHandler(t){this.onCurrentModeChanged.add(t),t(this._currentModeId)}removeCurrentModeChangedHandler(t){this.onCurrentModeChanged.delete(t)}setConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.add(t),t(this._configOptions)}removeConfigOptionsChangedHandler(t){this.onConfigOptionsChanged.delete(t)}setAvailableCommandsChangedHandler(t){this.onAvailableCommandsChanged=t,t(this._availableCommands)}setPermissionRequestHandler(t){this.onPermissionRequest=t}setBrowserToolCallHandler(t){this.onBrowserToolCall=t}setErrorMessageHandler(t){this.onErrorMessage=t}setSessionSwitchingHandler(t){this.onSessionSwitching=t}setState(t,n){this.connectionState=t;for(const r of this.onConnectionStateChange)r(t,n)}getState(){return this.connectionState}getSessionId(){return this.sessionId}get supportsImages(){var t;return((t=this._promptCapabilities)==null?void 0:t.image)===!0}getPromptCapabilities(){return this._promptCapabilities}get modelState(){return this._modelState}get availableCommands(){return this._availableCommands}get usage(){return this._usage}get currentModeId(){return this._currentModeId}get configOptions(){return this._configOptions}get supportsModelSelection(){return this._modelState!==null&&this._modelState.availableModels.length>0}get agentCapabilities(){return this._agentCapabilities}get supportsLoadSession(){var t;return((t=this._agentCapabilities)==null?void 0:t.loadSession)===!0}get supportsResumeSession(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.resume)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.resume)!==null}get supportsSessionList(){var t,n,r,o;return((n=(t=this._agentCapabilities)==null?void 0:t.sessionCapabilities)==null?void 0:n.list)!==void 0&&((o=(r=this._agentCapabilities)==null?void 0:r.sessionCapabilities)==null?void 0:o.list)!==null}get supportsSessionHistory(){return this.supportsLoadSession||this.supportsResumeSession}async connect(){if(this.ws){const t=this.ws;this.ws=null;try{t.close()}catch{}this.stopHeartbeat(),this.connectResolve=null,this.connectReject=null}return this.setState("connecting"),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n;try{const r=new WebSocket(this.settings.proxyUrl,this.settings.token?[kh(this.settings.token)]:void 0);this.ws=r,r.onopen=()=>{if(this.ws!==r){console.log("[ACPClient] WebSocket opened but already disconnected/replaced, closing stale socket"),r.close();return}console.log("[ACPClient] WebSocket connected, sending connect command"),this.send({type:"connect"})},r.onmessage=o=>{if(this.ws===r)try{const s=JSON.parse(o.data);this.handleResponse(s)}catch(s){console.error("[ACPClient] Failed to parse message:",s)}},r.onerror=()=>{var o;this.ws===r&&(console.error("[ACPClient] WebSocket error"),this.setState("error","WebSocket connection error"),(o=this.connectReject)==null||o.call(this,new Error("WebSocket connection error")),this.connectResolve=null,this.connectReject=null)},r.onclose=o=>{if(this.ws===r){if(console.log("[ACPClient] WebSocket closed",o.code,o.reason),this.connectReject){const s=o.reason||`Connection closed (code: ${o.code})`;this.setState("error",s),this.connectReject(new Error(s)),this.connectResolve=null,this.connectReject=null}else this.setState("disconnected");this.ws=null,this.sessionId=null}}}catch(r){this.setState("error",r.message),n(r)}})}handleResponse(t){var n,r,o,s,a,i,m,f,l,c,d,h,g;switch(console.log("[ACPClient] Received:",t.type),t.type){case"status":t.payload.connected?(this._agentCapabilities=t.payload.capabilities??null,this.setState("connected"),this.startHeartbeat(),(n=this.connectResolve)==null||n.call(this,void 0)):(this.stopHeartbeat(),this.setState("disconnected")),this.connectResolve=null,this.connectReject=null;break;case"error":console.error("[ACPClient] Error:",t.payload);const v=((r=t.payload)==null?void 0:r.message)||JSON.stringify(t.payload);this.pendingSessionTarget=null,this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(new Error(v)),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(new Error(v)),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(new Error(v)),this.pendingSessionResume=null),this.connectReject?(this.connectReject(new Error(v)),this.connectResolve=null,this.connectReject=null):(console.error("[ACPClient] Agent error:",v),(o=this.onErrorMessage)==null||o.call(this,v));break;case"session_created":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session created, promptCapabilities:",this._promptCapabilities,"models:",this._modelState),(s=this.onSessionCreated)==null||s.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_list":console.log("[ACPClient] Session list received:",t.payload.sessions.length,"sessions"),this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.resolve(t.payload),this.pendingSessionList=null);break;case"session_loaded":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session loaded:",t.payload.sessionId),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.resolve(t.payload.sessionId),this.pendingSessionLoad=null),(a=this.onSessionLoaded)==null||a.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_resumed":this.sessionId=t.payload.sessionId,this.pendingSessionTarget=null,this._promptCapabilities=t.payload.promptCapabilities??null,this._modelState=t.payload.models??null,console.log("[ACPClient] Session resumed:",t.payload.sessionId),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.resolve(t.payload.sessionId),this.pendingSessionResume=null),(i=this.onSessionLoaded)==null||i.call(this,t.payload.sessionId);for(const b of this.onModelStateChanged)b(this._modelState);this.resetSessionUsageState();break;case"session_deleted":(m=this.onSessionDeleted)==null||m.call(this,t.payload.sessionId);break;case"session_renamed":(f=this.onSessionRenamed)==null||f.call(this,t.payload.sessionId,t.payload.title);break;case"session_update":const 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 r=await this.onBrowserToolCall(n);this.send({type:"browser_tool_result",callId:t,result:r})}catch(r){console.error("[ACPClient] Browser tool error:",r),this.send({type:"browser_tool_result",callId:t,result:{error:r.message}})}}startHeartbeat(){this.stopHeartbeat(),this.missedPongs=0,this.heartbeatInterval=setInterval(()=>{if(!this.ws||this.ws.readyState!==WebSocket.OPEN){this.stopHeartbeat();return}this.ws.send(JSON.stringify({type:"ping"})),this.heartbeatTimeout=setTimeout(()=>{var t;this.missedPongs++,this.missedPongs>=ct.MAX_MISSED_PONGS&&(console.warn(`[ACPClient] Server unresponsive (${this.missedPongs} missed pongs), closing connection`),this.stopHeartbeat(),(t=this.ws)==null||t.close(4e3,"Heartbeat timeout"))},ct.PONG_TIMEOUT_MS)},ct.HEARTBEAT_INTERVAL_MS)}stopHeartbeat(){this.heartbeatInterval&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null),this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=null)}send(t){if(!this.ws||this.ws.readyState!==WebSocket.OPEN)throw new Error("WebSocket not connected");this.ws.send(JSON.stringify(t))}async createSession(t,n){const r=t??this.settings.cwd;this.send({type:"new_session",payload:{cwd:r,permissionMode:n}})}async sendPrompt(t){if(!this.sessionId)throw new Error("No active session");const n=typeof t=="string"?[{type:"text",text:t}]:t;this.send({type:"prompt",payload:{content:n}})}cancel(){this.send({type:"cancel"})}async setSessionModel(t){if(!this.sessionId)throw new Error("No active session");this.send({type:"set_session_model",payload:{modelId:t}})}deleteSession(t){this.send({type:"delete_session",payload:{sessionId:t}})}renameSession(t,n){this.send({type:"rename_session",payload:{sessionId:t,title:n}})}respondToPermission(t,n){const r=n?{outcome:"selected",optionId:n}:{outcome:"cancelled"};this.send({type:"permission_response",payload:{requestId:t,outcome:r}})}setSessionLoadedHandler(t){this.onSessionLoaded=t}async listSessions(t){if(!this.supportsSessionList)throw new Error("Listing sessions is not supported by this agent");return new Promise((n,r)=>{const o=setTimeout(()=>{this.pendingSessionList&&(this.pendingSessionList=null,r(new Error("List sessions timed out")))},3e4);this.pendingSessionList={resolve:n,reject:r,timer:o};try{this.send({type:"list_sessions",payload:t})}catch(s){clearTimeout(o),this.pendingSessionList=null,r(s)}})}async loadSession(t){if(!this.supportsLoadSession)throw new Error("Loading sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionLoad&&(this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(new Error("Load session timed out")))},6e4);this.pendingSessionLoad={resolve:n,reject:r,timer:o};try{this.send({type:"load_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionLoad=null,r(a)}})}async resumeSession(t){if(!this.supportsResumeSession)throw new Error("Resuming sessions is not supported by this agent");return new Promise((n,r)=>{var s;this.pendingSessionTarget=t.sessionId,(s=this.onSessionSwitching)==null||s.call(this,t.sessionId);const o=setTimeout(()=>{this.pendingSessionResume&&(this.pendingSessionTarget=null,this.pendingSessionResume=null,r(new Error("Resume session timed out")))},3e4);this.pendingSessionResume={resolve:n,reject:r,timer:o};try{this.send({type:"resume_session",payload:t})}catch(a){clearTimeout(o),this.pendingSessionTarget=null,this.pendingSessionResume=null,r(a)}})}disconnect(){var n;this.stopHeartbeat(),this.connectReject&&this.connectReject(new Bi),this.connectResolve=null,this.connectReject=null,this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected"),this.sessionId=null,this.pendingSessionTarget=null,this._modelState=null,this._agentCapabilities=null,this._availableCommands=[];for(const r of this.onModelStateChanged)r(null);(n=this.onAvailableCommandsChanged)==null||n.call(this,[]),this.resetSessionUsageState();const t=new Error("Disconnected");this.pendingSessionList&&(clearTimeout(this.pendingSessionList.timer),this.pendingSessionList.reject(t),this.pendingSessionList=null),this.pendingSessionLoad&&(clearTimeout(this.pendingSessionLoad.timer),this.pendingSessionLoad.reject(t),this.pendingSessionLoad=null),this.pendingSessionResume&&(clearTimeout(this.pendingSessionResume.timer),this.pendingSessionResume.reject(t),this.pendingSessionResume=null)}};oe(ct,"HEARTBEAT_INTERVAL_MS",3e4),oe(ct,"PONG_TIMEOUT_MS",1e4),oe(ct,"MAX_MISSED_PONGS",2);let Gr=ct;function Eh(e,t){return t.forEach((function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach((function(r){if(r!=="default"&&!(r in e)){var o=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:function(){return n[r]}})}}))})),Object.freeze(e)}function Hi(e,t){return new Promise((function(n,r){let o;return _h(e).then((function(s){try{return o=s,n(new Blob([t.slice(0,2),o,t.slice(2)],{type:"image/jpeg"}))}catch(a){return r(a)}}),r)}))}const _h=e=>new Promise(((t,n)=>{const r=new FileReader;r.addEventListener("load",(({target:{result:o}})=>{const s=new DataView(o);let a=0;if(s.getUint16(a)!==65496)return n("not a valid JPEG");for(a+=2;;){const i=s.getUint16(a);if(i===65498)break;const m=s.getUint16(a+2);if(i===65505&&s.getUint32(a+4)===1165519206){const f=a+10;let l;switch(s.getUint16(f)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(s.getUint16(f+2,l)!==42)return n("TIFF header contains invalid version");const c=s.getUint32(f+4,l),d=f+c+2+12*s.getUint16(f+c,l);for(let h=f+c+2;h<d;h+=12)if(s.getUint16(h,l)==274){if(s.getUint16(h+2,l)!==3)return n("Orientation data type is invalid");if(s.getUint32(h+4,l)!==1)return n("Orientation data count is invalid");s.setUint16(h+8,1,l);break}return t(o.slice(a,a+2+m))}a+=2+m}return t(new Blob)})),r.readAsArrayBuffer(e)}));var Bn={},Ah={get exports(){return Bn},set exports(e){Bn=e}};(function(e){var t,n,r={};Ah.exports=r,r.parse=function(o,s){for(var a=r.bin.readUshort,i=r.bin.readUint,m=0,f={},l=new Uint8Array(o),c=l.length-4;i(l,c)!=101010256;)c--;m=c,m+=4;var d=a(l,m+=4);a(l,m+=2);var h=i(l,m+=2),g=i(l,m+=4);m+=4,m=g;for(var v=0;v<d;v++){i(l,m),m+=4,m+=4,m+=4,i(l,m+=4),h=i(l,m+=4);var C=i(l,m+=4),b=a(l,m+=4),_=a(l,m+2),A=a(l,m+4);m+=6;var E=i(l,m+=8);m+=4,m+=b+_+A,r._readLocal(l,E,f,h,C,s)}return f},r._readLocal=function(o,s,a,i,m,f){var l=r.bin.readUshort,c=r.bin.readUint;c(o,s),l(o,s+=4),l(o,s+=2);var d=l(o,s+=2);c(o,s+=2),c(o,s+=4),s+=4;var h=l(o,s+=8),g=l(o,s+=2);s+=2;var v=r.bin.readUTF8(o,s,h);if(s+=h,s+=g,f)a[v]={size:m,csize:i};else{var C=new Uint8Array(o.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);r.inflateRaw(C,b),a[v]=b}}},r.inflateRaw=function(o,s){return r.F.inflate(o,s)},r.inflate=function(o,s){return o[0],o[1],r.inflateRaw(new Uint8Array(o.buffer,o.byteOffset+2,o.length-6),s)},r.deflate=function(o,s){s==null&&(s={level:6});var a=0,i=new Uint8Array(50+Math.floor(1.1*o.length));i[a]=120,i[a+1]=156,a+=2,a=r.F.deflateRaw(o,i,a,s.level);var m=r.adler(o,0,o.length);return i[a+0]=m>>>24&255,i[a+1]=m>>>16&255,i[a+2]=m>>>8&255,i[a+3]=m>>>0&255,new Uint8Array(i.buffer,0,a+4)},r.deflateRaw=function(o,s){s==null&&(s={level:6});var a=new Uint8Array(50+Math.floor(1.1*o.length)),i=r.F.deflateRaw(o,a,i,s.level);return new Uint8Array(a.buffer,0,i)},r.encode=function(o,s){s==null&&(s=!1);var a=0,i=r.bin.writeUint,m=r.bin.writeUshort,f={};for(var l in o){var c=!r._noNeed(l)&&!s,d=o[l],h=r.crc.crc(d,0,d.length);f[l]={cpr:c,usize:d.length,crc:h,file:c?r.deflateRaw(d):d}}for(var l in f)a+=f[l].file.length+30+46+2*r.bin.sizeUTF8(l);a+=22;var g=new Uint8Array(a),v=0,C=[];for(var l in f){var b=f[l];C.push(v),v=r._writeHeader(g,v,l,b,0)}var _=0,A=v;for(var l in f)b=f[l],C.push(v),v=r._writeHeader(g,v,l,b,1,C[_++]);var E=v-A;return i(g,v,101010256),v+=4,m(g,v+=4,_),m(g,v+=2,_),i(g,v+=2,E),i(g,v+=4,A),v+=4,v+=2,g.buffer},r._noNeed=function(o){var s=o.split(".").pop().toLowerCase();return"png,jpg,jpeg,zip".indexOf(s)!=-1},r._writeHeader=function(o,s,a,i,m,f){var l=r.bin.writeUint,c=r.bin.writeUshort,d=i.file;return l(o,s,m==0?67324752:33639248),s+=4,m==1&&(s+=2),c(o,s,20),c(o,s+=2,0),c(o,s+=2,i.cpr?8:0),l(o,s+=2,0),l(o,s+=4,i.crc),l(o,s+=4,d.length),l(o,s+=4,i.usize),c(o,s+=4,r.bin.sizeUTF8(a)),c(o,s+=2,0),s+=2,m==1&&(s+=2,s+=2,l(o,s+=6,f),s+=4),s+=r.bin.writeUTF8(o,s,a),m==0&&(o.set(d,s),s+=d.length),s},r.crc={table:(function(){for(var o=new Uint32Array(256),s=0;s<256;s++){for(var a=s,i=0;i<8;i++)1&a?a=3988292384^a>>>1:a>>>=1;o[s]=a}return o})(),update:function(o,s,a,i){for(var m=0;m<i;m++)o=r.crc.table[255&(o^s[a+m])]^o>>>8;return o},crc:function(o,s,a){return 4294967295^r.crc.update(4294967295,o,s,a)}},r.adler=function(o,s,a){for(var i=1,m=0,f=s,l=s+a;f<l;){for(var c=Math.min(f+5552,l);f<c;)m+=i+=o[f++];i%=65521,m%=65521}return m<<16|i},r.bin={readUshort:function(o,s){return o[s]|o[s+1]<<8},writeUshort:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255},readUint:function(o,s){return 16777216*o[s+3]+(o[s+2]<<16|o[s+1]<<8|o[s])},writeUint:function(o,s,a){o[s]=255&a,o[s+1]=a>>8&255,o[s+2]=a>>16&255,o[s+3]=a>>24&255},readASCII:function(o,s,a){for(var i="",m=0;m<a;m++)i+=String.fromCharCode(o[s+m]);return i},writeASCII:function(o,s,a){for(var i=0;i<a.length;i++)o[s+i]=a.charCodeAt(i)},pad:function(o){return o.length<2?"0"+o:o},readUTF8:function(o,s,a){for(var i,m="",f=0;f<a;f++)m+="%"+r.bin.pad(o[s+f].toString(16));try{i=decodeURIComponent(m)}catch{return r.bin.readASCII(o,s,a)}return i},writeUTF8:function(o,s,a){for(var i=a.length,m=0,f=0;f<i;f++){var l=a.charCodeAt(f);if((4294967168&l)==0)o[s+m]=l,m++;else if((4294965248&l)==0)o[s+m]=192|l>>6,o[s+m+1]=128|l>>0&63,m+=2;else if((4294901760&l)==0)o[s+m]=224|l>>12,o[s+m+1]=128|l>>6&63,o[s+m+2]=128|l>>0&63,m+=3;else{if((4292870144&l)!=0)throw"e";o[s+m]=240|l>>18,o[s+m+1]=128|l>>12&63,o[s+m+2]=128|l>>6&63,o[s+m+3]=128|l>>0&63,m+=4}}return m},sizeUTF8:function(o){for(var s=o.length,a=0,i=0;i<s;i++){var m=o.charCodeAt(i);if((4294967168&m)==0)a++;else if((4294965248&m)==0)a+=2;else if((4294901760&m)==0)a+=3;else{if((4292870144&m)!=0)throw"e";a+=4}}return a}},r.F={},r.F.deflateRaw=function(o,s,a,i){var m=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][i],f=r.F.U,l=r.F._goodIndex;r.F._hash;var c=r.F._putsE,d=0,h=a<<3,g=0,v=o.length;if(i==0){for(;d<v;)c(s,h,d+(M=Math.min(65535,v-d))==v?1:0),h=r.F._copyExact(o,d,M,s,h+8),d+=M;return h>>>3}var C=f.lits,b=f.strt,_=f.prev,A=0,E=0,L=0,k=0,j=0,x=0;for(v>2&&(b[x=r.F._hash(o,0)]=0),d=0;d<v;d++){if(j=x,d+1<v-2){x=r.F._hash(o,d+1);var y=d+1&32767;_[y]=b[x],b[x]=y}if(g<=d){(A>14e3||E>26697)&&v-d>100&&(g<d&&(C[A]=d-g,A+=2,g=d),h=r.F._writeBlock(d==v-1||g==v?1:0,C,A,k,o,L,d-L,s,h),A=E=k=0,L=d);var T=0;d<v-2&&(T=r.F._bestMatch(o,d,_,j,Math.min(m[2],v-d),m[3]));var M=T>>>16,O=65535&T;if(T!=0){O=65535&T;var F=l(M=T>>>16,f.of0);f.lhst[257+F]++;var I=l(O,f.df0);f.dhst[I]++,k+=f.exb[F]+f.dxb[I],C[A]=M<<23|d-g,C[A+1]=O<<16|F<<8|I,A+=2,g=d+M}else f.lhst[o[d]]++;E++}}for(L==d&&o.length!=0||(g<d&&(C[A]=d-g,A+=2,g=d),h=r.F._writeBlock(1,C,A,k,o,L,d-L,s,h),A=0,E=0,A=E=k=0,L=d);(7&h)!=0;)h++;return h>>>3},r.F._bestMatch=function(o,s,a,i,m,f){var l=32767&s,c=a[l],d=l-c+32768&32767;if(c==l||i!=r.F._hash(o,s-d))return 0;for(var h=0,g=0,v=Math.min(32767,s);d<=v&&--f!=0&&c!=l;){if(h==0||o[s+h]==o[s+h-d]){var C=r.F._howLong(o,s,d);if(C>h){if(g=d,(h=C)>=m)break;d+2<C&&(C=d+2);for(var b=0,_=0;_<C-2;_++){var A=s-d+_+32768&32767,E=A-a[A]+32768&32767;E>b&&(b=E,c=A)}}}d+=(l=c)-(c=a[l])+32768&32767}return h<<16|g},r.F._howLong=function(o,s,a){if(o[s]!=o[s-a]||o[s+1]!=o[s+1-a]||o[s+2]!=o[s+2-a])return 0;var i=s,m=Math.min(o.length,s+258);for(s+=3;s<m&&o[s]==o[s-a];)s++;return s-i},r.F._hash=function(o,s){return(o[s]<<8|o[s+1])+(o[s+2]<<4)&65535},r.saved=0,r.F._writeBlock=function(o,s,a,i,m,f,l,c,d){var h,g,v,C,b,_,A,E,L,k=r.F.U,j=r.F._putsF,x=r.F._putsE;k.lhst[256]++,g=(h=r.F.getTrees())[0],v=h[1],C=h[2],b=h[3],_=h[4],A=h[5],E=h[6],L=h[7];var y=32+((d+3&7)==0?0:8-(d+3&7))+(l<<3),T=i+r.F.contSize(k.fltree,k.lhst)+r.F.contSize(k.fdtree,k.dhst),M=i+r.F.contSize(k.ltree,k.lhst)+r.F.contSize(k.dtree,k.dhst);M+=14+3*A+r.F.contSize(k.itree,k.ihst)+(2*k.ihst[16]+3*k.ihst[17]+7*k.ihst[18]);for(var O=0;O<286;O++)k.lhst[O]=0;for(O=0;O<30;O++)k.dhst[O]=0;for(O=0;O<19;O++)k.ihst[O]=0;var F=y<T&&y<M?0:T<M?1:2;if(j(c,d,o),j(c,d+1,F),d+=3,F==0){for(;(7&d)!=0;)d++;d=r.F._copyExact(m,f,l,c,d)}else{var I,z;if(F==1&&(I=k.fltree,z=k.fdtree),F==2){r.F.makeCodes(k.ltree,g),r.F.revCodes(k.ltree,g),r.F.makeCodes(k.dtree,v),r.F.revCodes(k.dtree,v),r.F.makeCodes(k.itree,C),r.F.revCodes(k.itree,C),I=k.ltree,z=k.dtree,x(c,d,b-257),x(c,d+=5,_-1),x(c,d+=5,A-4),d+=4;for(var S=0;S<A;S++)x(c,d+3*S,k.itree[1+(k.ordr[S]<<1)]);d+=3*A,d=r.F._codeTiny(E,k.itree,c,d),d=r.F._codeTiny(L,k.itree,c,d)}for(var w=f,B=0;B<a;B+=2){for(var P=s[B],U=P>>>23,q=w+(8388607&P);w<q;)d=r.F._writeLit(m[w++],I,c,d);if(U!=0){var N=s[B+1],D=N>>16,$=N>>8&255,R=255&N;x(c,d=r.F._writeLit(257+$,I,c,d),U-k.of0[$]),d+=k.exb[$],j(c,d=r.F._writeLit(R,z,c,d),D-k.df0[R]),d+=k.dxb[R],w+=U}}d=r.F._writeLit(256,I,c,d)}return d},r.F._copyExact=function(o,s,a,i,m){var f=m>>>3;return i[f]=a,i[f+1]=a>>>8,i[f+2]=255-i[f],i[f+3]=255-i[f+1],f+=4,i.set(new Uint8Array(o.buffer,s,a),f),m+(a+4<<3)},r.F.getTrees=function(){for(var o=r.F.U,s=r.F._hufTree(o.lhst,o.ltree,15),a=r.F._hufTree(o.dhst,o.dtree,15),i=[],m=r.F._lenCodes(o.ltree,i),f=[],l=r.F._lenCodes(o.dtree,f),c=0;c<i.length;c+=2)o.ihst[i[c]]++;for(c=0;c<f.length;c+=2)o.ihst[f[c]]++;for(var d=r.F._hufTree(o.ihst,o.itree,7),h=19;h>4&&o.itree[1+(o.ordr[h-1]<<1)]==0;)h--;return[s,a,d,m,l,h,i,f]},r.F.getSecond=function(o){for(var s=[],a=0;a<o.length;a+=2)s.push(o[a+1]);return s},r.F.nonZero=function(o){for(var s="",a=0;a<o.length;a+=2)o[a+1]!=0&&(s+=(a>>1)+",");return s},r.F.contSize=function(o,s){for(var a=0,i=0;i<s.length;i++)a+=s[i]*o[1+(i<<1)];return a},r.F._codeTiny=function(o,s,a,i){for(var m=0;m<o.length;m+=2){var f=o[m],l=o[m+1];i=r.F._writeLit(f,s,a,i);var c=f==16?2:f==17?3:7;f>15&&(r.F._putsE(a,i,l,c),i+=c)}return i},r.F._lenCodes=function(o,s){for(var a=o.length;a!=2&&o[a-1]==0;)a-=2;for(var i=0;i<a;i+=2){var m=o[i+1],f=i+3<a?o[i+3]:-1,l=i+5<a?o[i+5]:-1,c=i==0?-1:o[i-1];if(m==0&&f==m&&l==m){for(var d=i+5;d+2<a&&o[d+2]==m;)d+=2;(h=Math.min(d+1-i>>>1,138))<11?s.push(17,h-3):s.push(18,h-11),i+=2*h-2}else if(m==c&&f==m&&l==m){for(d=i+5;d+2<a&&o[d+2]==m;)d+=2;var h=Math.min(d+1-i>>>1,6);s.push(16,h-3),i+=2*h-2}else s.push(m,0)}return a>>>1},r.F._hufTree=function(o,s,a){var i=[],m=o.length,f=s.length,l=0;for(l=0;l<f;l+=2)s[l]=0,s[l+1]=0;for(l=0;l<m;l++)o[l]!=0&&i.push({lit:l,f:o[l]});var c=i.length,d=i.slice(0);if(c==0)return 0;if(c==1){var h=i[0].lit;return d=h==0?1:0,s[1+(h<<1)]=1,s[1+(d<<1)]=1,1}i.sort((function(E,L){return E.f-L.f}));var g=i[0],v=i[1],C=0,b=1,_=2;for(i[0]={lit:-1,f:g.f+v.f,l:g,r:v,d:0};b!=c-1;)g=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],v=C!=b&&(_==c||i[C].f<i[_].f)?i[C++]:i[_++],i[b++]={lit:-1,f:g.f+v.f,l:g,r:v};var A=r.F.setDepth(i[b-1],0);for(A>a&&(r.F.restrictDepth(d,a,A),A=a),l=0;l<c;l++)s[1+(d[l].lit<<1)]=d[l].d;return A},r.F.setDepth=function(o,s){return o.lit!=-1?(o.d=s,s):Math.max(r.F.setDepth(o.l,s+1),r.F.setDepth(o.r,s+1))},r.F.restrictDepth=function(o,s,a){var i=0,m=1<<a-s,f=0;for(o.sort((function(c,d){return d.d==c.d?c.f-d.f:d.d-c.d})),i=0;i<o.length&&o[i].d>s;i++){var l=o[i].d;o[i].d=s,f+=m-(1<<a-l)}for(f>>>=a-s;f>0;)(l=o[i].d)<s?(o[i].d++,f-=1<<s-l-1):i++;for(;i>=0;i--)o[i].d==s&&f<0&&(o[i].d--,f++);f!=0&&console.log("debt left")},r.F._goodIndex=function(o,s){var a=0;return s[16|a]<=o&&(a|=16),s[8|a]<=o&&(a|=8),s[4|a]<=o&&(a|=4),s[2|a]<=o&&(a|=2),s[1|a]<=o&&(a|=1),a},r.F._writeLit=function(o,s,a,i){return r.F._putsF(a,i,s[o<<1]),i+s[1+(o<<1)]},r.F.inflate=function(o,s){var a=Uint8Array;if(o[0]==3&&o[1]==0)return s||new a(0);var i=r.F,m=i._bitsF,f=i._bitsE,l=i._decodeTiny,c=i.makeCodes,d=i.codes2map,h=i._get17,g=i.U,v=s==null;v&&(s=new a(o.length>>>2<<3));for(var C,b,_=0,A=0,E=0,L=0,k=0,j=0,x=0,y=0,T=0;_==0;)if(_=m(o,T,1),A=m(o,T+1,2),T+=3,A!=0){if(v&&(s=r.F._check(s,y+(1<<17))),A==1&&(C=g.flmap,b=g.fdmap,j=511,x=31),A==2){E=f(o,T,5)+257,L=f(o,T+5,5)+1,k=f(o,T+10,4)+4,T+=14;for(var M=0;M<38;M+=2)g.itree[M]=0,g.itree[M+1]=0;var O=1;for(M=0;M<k;M++){var F=f(o,T+3*M,3);g.itree[1+(g.ordr[M]<<1)]=F,F>O&&(O=F)}T+=3*k,c(g.itree,O),d(g.itree,O,g.imap),C=g.lmap,b=g.dmap,T=l(g.imap,(1<<O)-1,E+L,o,T,g.ttree);var I=i._copyOut(g.ttree,0,E,g.ltree);j=(1<<I)-1;var z=i._copyOut(g.ttree,E,L,g.dtree);x=(1<<z)-1,c(g.ltree,I),d(g.ltree,I,C),c(g.dtree,z),d(g.dtree,z,b)}for(;;){var S=C[h(o,T)&j];T+=15&S;var w=S>>>4;if(!(w>>>8))s[y++]=w;else{if(w==256)break;var B=y+w-254;if(w>264){var P=g.ldef[w-257];B=y+(P>>>3)+f(o,T,7&P),T+=7&P}var U=b[h(o,T)&x];T+=15&U;var q=U>>>4,N=g.ddef[q],D=(N>>>4)+m(o,T,15&N);for(T+=15&N,v&&(s=r.F._check(s,y+(1<<17)));y<B;)s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D],s[y]=s[y++-D];y=B}}}else{(7&T)!=0&&(T+=8-(7&T));var $=4+(T>>>3),R=o[$-4]|o[$-3]<<8;v&&(s=r.F._check(s,y+R)),s.set(new a(o.buffer,o.byteOffset+$,R),y),T=$+R<<3,y+=R}return s.length==y?s:s.slice(0,y)},r.F._check=function(o,s){var a=o.length;if(s<=a)return o;var i=new Uint8Array(Math.max(a<<1,s));return i.set(o,0),i},r.F._decodeTiny=function(o,s,a,i,m,f){for(var l=r.F._bitsE,c=r.F._get17,d=0;d<a;){var h=o[c(i,m)&s];m+=15&h;var g=h>>>4;if(g<=15)f[d]=g,d++;else{var v=0,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},r.F._copyOut=function(o,s,a,i){for(var m=0,f=0,l=i.length>>>1;f<a;){var c=o[f+s];i[f<<1]=0,i[1+(f<<1)]=c,c>m&&(m=c),f++}for(;f<l;)i[f<<1]=0,i[1+(f<<1)]=0,f++;return m},r.F.makeCodes=function(o,s){for(var a,i,m,f,l=r.F.U,c=o.length,d=l.bl_count,h=0;h<=s;h++)d[h]=0;for(h=1;h<c;h+=2)d[o[h]]++;var g=l.next_code;for(a=0,d[0]=0,i=1;i<=s;i++)a=a+d[i-1]<<1,g[i]=a;for(m=0;m<c;m+=2)(f=o[m+1])!=0&&(o[m]=g[f],g[f]++)},r.F.codes2map=function(o,s,a){for(var i=o.length,m=r.F.U.rev15,f=0;f<i;f+=2)if(o[f+1]!=0)for(var l=f>>1,c=o[f+1],d=l<<4|c,h=s-c,g=o[f]<<h,v=g+(1<<h);g!=v;)a[m[g]>>>15-s]=d,g++},r.F.revCodes=function(o,s){for(var a=r.F.U.rev15,i=15-s,m=0;m<o.length;m+=2){var f=o[m]<<s-o[m+1];o[m]=a[f]>>>i}},r.F._putsE=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8},r.F._putsF=function(o,s,a){a<<=7&s;var i=s>>>3;o[i]|=a,o[i+1]|=a>>>8,o[i+2]|=a>>>16},r.F._bitsE=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8)>>>(7&s)&(1<<a)-1},r.F._bitsF=function(o,s,a){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)&(1<<a)-1},r.F._get17=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16)>>>(7&s)},r.F._get25=function(o,s){return(o[s>>>3]|o[1+(s>>>3)]<<8|o[2+(s>>>3)]<<16|o[3+(s>>>3)]<<24)>>>(7&s)},r.F.U=(t=Uint16Array,n=Uint32Array,{next_code:new t(16),bl_count:new t(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new t(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new n(32),flmap:new t(512),fltree:[],fdmap:new t(32),fdtree:[],lmap:new t(32768),ltree:[],ttree:[],dmap:new t(32768),dtree:[],imap:new t(512),itree:[],rev15:new t(32768),lhst:new n(286),dhst:new n(30),ihst:new n(19),lits:new n(15e3),strt:new t(65536),prev:new t(32768)}),(function(){for(var o=r.F.U,s=0;s<32768;s++){var a=s;a=(4278255360&(a=(4042322160&(a=(3435973836&(a=(2863311530&a)>>>1|(1431655765&a)<<1))>>>2|(858993459&a)<<2))>>>4|(252645135&a)<<4))>>>8|(16711935&a)<<8,o.rev15[s]=(a>>>16|a<<16)>>>17}function i(m,f,l){for(;f--!=0;)m.push(0,l)}for(s=0;s<32;s++)o.ldef[s]=o.of0[s]<<3|o.exb[s],o.ddef[s]=o.df0[s]<<4|o.dxb[s];i(o.fltree,144,8),i(o.fltree,112,9),i(o.fltree,24,7),i(o.fltree,8,8),r.F.makeCodes(o.fltree,9),r.F.codes2map(o.fltree,9,o.flmap),r.F.revCodes(o.fltree,9),i(o.fdtree,32,5),r.F.makeCodes(o.fdtree,5),r.F.codes2map(o.fdtree,5,o.fdmap),r.F.revCodes(o.fdtree,5),i(o.itree,19,0),i(o.ltree,286,0),i(o.dtree,30,0),i(o.ttree,320,0)})()})();var jh=Eh({__proto__:null,default:Bn},[Bn]);const Le=(function(){var e={nextZero(l,c){for(;l[c]!=0;)c++;return c},readUshort:(l,c)=>l[c]<<8|l[c+1],writeUshort(l,c,d){l[c]=d>>8&255,l[c+1]=255&d},readUint:(l,c)=>16777216*l[c]+(l[c+1]<<16|l[c+2]<<8|l[c+3]),writeUint(l,c,d){l[c]=d>>24&255,l[c+1]=d>>16&255,l[c+2]=d>>8&255,l[c+3]=255&d},readASCII(l,c,d){let h="";for(let g=0;g<d;g++)h+=String.fromCharCode(l[c+g]);return h},writeASCII(l,c,d){for(let h=0;h<d.length;h++)l[c+h]=d.charCodeAt(h)},readBytes(l,c,d){const h=[];for(let g=0;g<d;g++)h.push(l[c+g]);return h},pad:l=>l.length<2?`0${l}`:l,readUTF8(l,c,d){let h,g="";for(let v=0;v<d;v++)g+=`%${e.pad(l[c+v].toString(16))}`;try{h=decodeURIComponent(g)}catch{return e.readASCII(l,c,d)}return h}};function t(l,c,d,h){const g=c*d,v=s(h),C=Math.ceil(c*v/8),b=new Uint8Array(4*g),_=new Uint32Array(b.buffer),{ctype:A}=h,{depth:E}=h,L=e.readUshort;if(A==6){const P=g<<2;if(E==8)for(var k=0;k<P;k+=4)b[k]=l[k],b[k+1]=l[k+1],b[k+2]=l[k+2],b[k+3]=l[k+3];if(E==16)for(k=0;k<P;k++)b[k]=l[k<<1]}else if(A==2){const P=h.tabs.tRNS;if(P==null){if(E==8)for(k=0;k<g;k++){var j=3*k;_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j]}if(E==16)for(k=0;k<g;k++)j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j]}else{var x=P[0];const U=P[1],q=P[2];if(E==8)for(k=0;k<g;k++){var y=k<<2;j=3*k,_[k]=255<<24|l[j+2]<<16|l[j+1]<<8|l[j],l[j]==x&&l[j+1]==U&&l[j+2]==q&&(b[y+3]=0)}if(E==16)for(k=0;k<g;k++)y=k<<2,j=6*k,_[k]=255<<24|l[j+4]<<16|l[j+2]<<8|l[j],L(l,j)==x&&L(l,j+2)==U&&L(l,j+4)==q&&(b[y+3]=0)}}else if(A==3){const P=h.tabs.PLTE,U=h.tabs.tRNS,q=U?U.length:0;if(E==1)for(var T=0;T<d;T++){var M=T*C,O=T*c;for(k=0;k<c;k++){y=O+k<<2;var F=3*(I=l[M+(k>>3)]>>7-((7&k)<<0)&1);b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}if(E==2)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>2)]>>6-((3&k)<<1)&3),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==4)for(T=0;T<d;T++)for(M=T*C,O=T*c,k=0;k<c;k++)y=O+k<<2,F=3*(I=l[M+(k>>1)]>>4-((1&k)<<2)&15),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255;if(E==8)for(k=0;k<g;k++){var I;y=k<<2,F=3*(I=l[k]),b[y]=P[F],b[y+1]=P[F+1],b[y+2]=P[F+2],b[y+3]=I<q?U[I]:255}}else if(A==4){if(E==8)for(k=0;k<g;k++){y=k<<2;var z=l[S=k<<1];b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+1]}if(E==16)for(k=0;k<g;k++){var S;y=k<<2,z=l[S=k<<2],b[y]=z,b[y+1]=z,b[y+2]=z,b[y+3]=l[S+2]}}else if(A==0)for(x=h.tabs.tRNS?h.tabs.tRNS:-1,T=0;T<d;T++){const P=T*C,U=T*c;if(E==1)for(var w=0;w<c;w++){var B=(z=255*(l[P+(w>>>3)]>>>7-(7&w)&1))==255*x?0:255;_[U+w]=B<<24|z<<16|z<<8|z}else if(E==2)for(w=0;w<c;w++)B=(z=85*(l[P+(w>>>2)]>>>6-((3&w)<<1)&3))==85*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==4)for(w=0;w<c;w++)B=(z=17*(l[P+(w>>>1)]>>>4-((1&w)<<2)&15))==17*x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==8)for(w=0;w<c;w++)B=(z=l[P+w])==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z;else if(E==16)for(w=0;w<c;w++)z=l[P+(w<<1)],B=L(l,P+(w<<1))==x?0:255,_[U+w]=B<<24|z<<16|z<<8|z}return b}function n(l,c,d,h){const g=s(l),v=Math.ceil(d*g/8),C=new Uint8Array((v+1+l.interlace)*h);return c=l.tabs.CgBI?o(c,C):r(c,C),l.interlace==0?c=a(c,l,0,d,h):l.interlace==1&&(c=(function(_,A){const E=A.width,L=A.height,k=s(A),j=k>>3,x=Math.ceil(E*k/8),y=new Uint8Array(L*x);let T=0;const M=[0,0,4,0,2,0,1],O=[0,4,0,2,0,1,0],F=[8,8,8,4,4,2,2],I=[8,8,4,4,2,2,1];let z=0;for(;z<7;){const w=F[z],B=I[z];let P=0,U=0,q=M[z];for(;q<L;)q+=w,U++;let N=O[z];for(;N<E;)N+=B,P++;const D=Math.ceil(P*k/8);a(_,A,T,P,U);let $=0,R=M[z];for(;R<L;){let H=O[z],G=T+$*D<<3;for(;H<E;){var S;if(k==1&&(S=(S=_[G>>3])>>7-(7&G)&1,y[R*x+(H>>3)]|=S<<7-((7&H)<<0)),k==2&&(S=(S=_[G>>3])>>6-(7&G)&3,y[R*x+(H>>2)]|=S<<6-((3&H)<<1)),k==4&&(S=(S=_[G>>3])>>4-(7&G)&15,y[R*x+(H>>1)]|=S<<4-((1&H)<<2)),k>=8){const K=R*x+H*j;for(let V=0;V<j;V++)y[K+V]=_[(G>>3)+V]}G+=k,H+=B}$++,R+=w}P*U!=0&&(T+=U*(1+D)),z+=1}return y})(c,l)),c}function r(l,c){return o(new Uint8Array(l.buffer,2,l.length-6),c)}var o=(function(){const l={H:{}};return l.H.N=function(c,d){const h=Uint8Array;let g,v,C=0,b=0,_=0,A=0,E=0,L=0,k=0,j=0,x=0;if(c[0]==3&&c[1]==0)return d||new h(0);const y=l.H,T=y.b,M=y.e,O=y.R,F=y.n,I=y.A,z=y.Z,S=y.m,w=d==null;for(w&&(d=new h(c.length>>>2<<5));C==0;)if(C=T(c,x,1),b=T(c,x+1,2),x+=3,b!=0){if(w&&(d=l.H.W(d,j+(1<<17))),b==1&&(g=S.J,v=S.h,L=511,k=31),b==2){_=M(c,x,5)+257,A=M(c,x+5,5)+1,E=M(c,x+10,4)+4,x+=14;let P=1;for(var B=0;B<38;B+=2)S.Q[B]=0,S.Q[B+1]=0;for(B=0;B<E;B++){const N=M(c,x+3*B,3);S.Q[1+(S.X[B]<<1)]=N,N>P&&(P=N)}x+=3*E,F(S.Q,P),I(S.Q,P,S.u),g=S.w,v=S.d,x=O(S.u,(1<<P)-1,_+A,c,x,S.v);const U=y.V(S.v,0,_,S.C);L=(1<<U)-1;const q=y.V(S.v,_,A,S.D);k=(1<<q)-1,F(S.C,U),I(S.C,U,g),F(S.D,q),I(S.D,q,v)}for(;;){const P=g[z(c,x)&L];x+=15&P;const U=P>>>4;if(!(U>>>8))d[j++]=U;else{if(U==256)break;{let q=j+U-254;if(U>264){const H=S.q[U-257];q=j+(H>>>3)+M(c,x,7&H),x+=7&H}const N=v[z(c,x)&k];x+=15&N;const D=N>>>4,$=S.c[D],R=($>>>4)+T(c,x,15&$);for(x+=15&$;j<q;)d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R],d[j]=d[j++-R];j=q}}}}else{(7&x)!=0&&(x+=8-(7&x));const P=4+(x>>>3),U=c[P-4]|c[P-3]<<8;w&&(d=l.H.W(d,j+U)),d.set(new h(c.buffer,c.byteOffset+P,U),j),x=P+U<<3,j+=U}return d.length==j?d:d.slice(0,j)},l.H.W=function(c,d){const h=c.length;if(d<=h)return c;const g=new Uint8Array(h<<1);return g.set(c,0),g},l.H.R=function(c,d,h,g,v,C){const b=l.H.e,_=l.H.Z;let A=0;for(;A<h;){const E=c[_(g,v)&d];v+=15&E;const L=E>>>4;if(L<=15)C[A]=L,A++;else{let k=0,j=0;L==16?(j=3+b(g,v,2),v+=2,k=C[A-1]):L==17?(j=3+b(g,v,3),v+=3):L==18&&(j=11+b(g,v,7),v+=7);const x=A+j;for(;A<x;)C[A]=k,A++}}return v},l.H.V=function(c,d,h,g){let v=0,C=0;const b=g.length>>>1;for(;C<h;){const _=c[C+d];g[C<<1]=0,g[1+(C<<1)]=_,_>v&&(v=_),C++}for(;C<b;)g[C<<1]=0,g[1+(C<<1)]=0,C++;return v},l.H.n=function(c,d){const h=l.H.m,g=c.length;let v,C,b,_;const A=h.j;for(var E=0;E<=d;E++)A[E]=0;for(E=1;E<g;E+=2)A[c[E]]++;const L=h.K;for(v=0,A[0]=0,C=1;C<=d;C++)v=v+A[C-1]<<1,L[C]=v;for(b=0;b<g;b+=2)_=c[b+1],_!=0&&(c[b]=L[_],L[_]++)},l.H.A=function(c,d,h){const g=c.length,v=l.H.m.r;for(let C=0;C<g;C+=2)if(c[C+1]!=0){const b=C>>1,_=c[C+1],A=b<<4|_,E=d-_;let L=c[C]<<E;const k=L+(1<<E);for(;L!=k;)h[v[L]>>>15-d]=A,L++}},l.H.l=function(c,d){const h=l.H.m.r,g=15-d;for(let v=0;v<c.length;v+=2){const C=c[v]<<d-c[v+1];c[v]=h[C]>>>g}},l.H.M=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8},l.H.I=function(c,d,h){h<<=7&d;const g=d>>>3;c[g]|=h,c[g+1]|=h>>>8,c[g+2]|=h>>>16},l.H.e=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8)>>>(7&d)&(1<<h)-1},l.H.b=function(c,d,h){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)&(1<<h)-1},l.H.Z=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16)>>>(7&d)},l.H.i=function(c,d){return(c[d>>>3]|c[1+(d>>>3)]<<8|c[2+(d>>>3)]<<16|c[3+(d>>>3)]<<24)>>>(7&d)},l.H.m=(function(){const c=Uint16Array,d=Uint32Array;return{K:new c(16),j:new c(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new c(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new d(32),J:new c(512),_:[],h:new c(32),$:[],w:new c(32768),C:[],v:[],d:new c(32768),D:[],u:new c(512),Q:[],r:new c(32768),s:new d(286),Y:new d(30),a:new d(19),t:new d(15e3),k:new c(65536),g:new c(32768)}})(),(function(){const c=l.H.m;for(var d=0;d<32768;d++){let g=d;g=(2863311530&g)>>>1|(1431655765&g)<<1,g=(3435973836&g)>>>2|(858993459&g)<<2,g=(4042322160&g)>>>4|(252645135&g)<<4,g=(4278255360&g)>>>8|(16711935&g)<<8,c.r[d]=(g>>>16|g<<16)>>>17}function h(g,v,C){for(;v--!=0;)g.push(0,C)}for(d=0;d<32;d++)c.q[d]=c.S[d]<<3|c.T[d],c.c[d]=c.p[d]<<4|c.z[d];h(c._,144,8),h(c._,112,9),h(c._,24,7),h(c._,8,8),l.H.n(c._,9),l.H.A(c._,9,c.J),l.H.l(c._,9),h(c.$,32,5),l.H.n(c.$,5),l.H.A(c.$,5,c.h),l.H.l(c.$,5),h(c.Q,19,0),h(c.C,286,0),h(c.D,30,0),h(c.v,320,0)})(),l.H.N})();function s(l){return[1,null,3,1,2,null,4][l.ctype]*l.depth}function a(l,c,d,h,g){let v=s(c);const C=Math.ceil(h*v/8);let b,_;v=Math.ceil(v/8);let A=l[d],E=0;if(A>1&&(l[d]=[0,0,1][A-2]),A==3)for(E=v;E<C;E++)l[E+1]=l[E+1]+(l[E+1-v]>>>1)&255;for(let L=0;L<g;L++)if(b=d+L*C,_=b+L+1,A=l[_-1],E=0,A==0)for(;E<C;E++)l[b+E]=l[_+E];else if(A==1){for(;E<v;E++)l[b+E]=l[_+E];for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-v]}else if(A==2)for(;E<C;E++)l[b+E]=l[_+E]+l[b+E-C];else if(A==3){for(;E<v;E++)l[b+E]=l[_+E]+(l[b+E-C]>>>1);for(;E<C;E++)l[b+E]=l[_+E]+(l[b+E-C]+l[b+E-v]>>>1)}else{for(;E<v;E++)l[b+E]=l[_+E]+i(0,l[b+E-C],0);for(;E<C;E++)l[b+E]=l[_+E]+i(l[b+E-v],l[b+E-C],l[b+E-v-C])}return l}function i(l,c,d){const h=l+c-d,g=h-l,v=h-c,C=h-d;return g*g<=v*v&&g*g<=C*C?l:v*v<=C*C?c:d}function m(l,c,d){d.width=e.readUint(l,c),c+=4,d.height=e.readUint(l,c),c+=4,d.depth=l[c],c++,d.ctype=l[c],c++,d.compress=l[c],c++,d.filter=l[c],c++,d.interlace=l[c],c++}function f(l,c,d,h,g,v,C,b,_){const A=Math.min(c,g),E=Math.min(d,v);let L=0,k=0;for(let z=0;z<E;z++)for(let S=0;S<A;S++)if(C>=0&&b>=0?(L=z*c+S<<2,k=(b+z)*g+C+S<<2):(L=(-b+z)*c-C+S<<2,k=z*g+S<<2),_==0)h[k]=l[L],h[k+1]=l[L+1],h[k+2]=l[L+2],h[k+3]=l[L+3];else if(_==1){var j=l[L+3]*.00392156862745098,x=l[L]*j,y=l[L+1]*j,T=l[L+2]*j,M=h[k+3]*(1/255),O=h[k]*M,F=h[k+1]*M,I=h[k+2]*M;const w=1-j,B=j+M*w,P=B==0?0:1/B;h[k+3]=255*B,h[k+0]=(x+O*w)*P,h[k+1]=(y+F*w)*P,h[k+2]=(T+I*w)*P}else if(_==2)j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I?(h[k]=0,h[k+1]=0,h[k+2]=0,h[k+3]=0):(h[k]=x,h[k+1]=y,h[k+2]=T,h[k+3]=j);else if(_==3){if(j=l[L+3],x=l[L],y=l[L+1],T=l[L+2],M=h[k+3],O=h[k],F=h[k+1],I=h[k+2],j==M&&x==O&&y==F&&T==I)continue;if(j<220&&M>20)return!1}return!0}return{decode:function(c){const d=new Uint8Array(c);let h=8;const g=e,v=g.readUshort,C=g.readUint,b={tabs:{},frames:[]},_=new Uint8Array(d.length);let A,E=0,L=0;const k=[137,80,78,71,13,10,26,10];for(var j=0;j<8;j++)if(d[j]!=k[j])throw"The input is not a PNG file!";for(;h<d.length;){const z=g.readUint(d,h);h+=4;const S=g.readASCII(d,h,4);if(h+=4,S=="IHDR")m(d,h,b);else if(S=="iCCP"){for(var x=h;d[x]!=0;)x++;g.readASCII(d,h,x-h),d[x+1];const w=d.slice(x+2,h+z);let B=null;try{B=r(w)}catch{B=o(w)}b.tabs[S]=B}else if(S=="CgBI")b.tabs[S]=d.slice(h,h+4);else if(S=="IDAT"){for(j=0;j<z;j++)_[E+j]=d[h+j];E+=z}else if(S=="acTL")b.tabs[S]={num_frames:C(d,h),num_plays:C(d,h+4)},A=new Uint8Array(d.length);else if(S=="fcTL"){L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height),L=0);const w={x:C(d,h+12),y:C(d,h+16),width:C(d,h+4),height:C(d,h+8)};let B=v(d,h+22);B=v(d,h+20)/(B==0?100:B);const P={rect:w,delay:Math.round(1e3*B),dispose:d[h+24],blend:d[h+25]};b.frames.push(P)}else if(S=="fdAT"){for(j=0;j<z-4;j++)A[L+j]=d[h+j+4];L+=z-4}else if(S=="pHYs")b.tabs[S]=[g.readUint(d,h),g.readUint(d,h+4),d[h+8]];else if(S=="cHRM")for(b.tabs[S]=[],j=0;j<8;j++)b.tabs[S].push(g.readUint(d,h+4*j));else if(S=="tEXt"||S=="zTXt"){b.tabs[S]==null&&(b.tabs[S]={});var y=g.nextZero(d,h),T=g.readASCII(d,h,y-h),M=h+z-y-1;if(S=="tEXt")F=g.readASCII(d,y+1,M);else{var O=r(d.slice(y+2,y+2+M));F=g.readUTF8(O,0,O.length)}b.tabs[S][T]=F}else if(S=="iTXt"){b.tabs[S]==null&&(b.tabs[S]={}),y=0,x=h,y=g.nextZero(d,x),T=g.readASCII(d,x,y-x);const w=d[x=y+1];var F;d[x+1],x+=2,y=g.nextZero(d,x),g.readASCII(d,x,y-x),x=y+1,y=g.nextZero(d,x),g.readUTF8(d,x,y-x),M=z-((x=y+1)-h),w==0?F=g.readUTF8(d,x,M):(O=r(d.slice(x,x+M)),F=g.readUTF8(O,0,O.length)),b.tabs[S][T]=F}else if(S=="PLTE")b.tabs[S]=g.readBytes(d,h,z);else if(S=="hIST"){const w=b.tabs.PLTE.length/3;for(b.tabs[S]=[],j=0;j<w;j++)b.tabs[S].push(v(d,h+2*j))}else if(S=="tRNS")b.ctype==3?b.tabs[S]=g.readBytes(d,h,z):b.ctype==0?b.tabs[S]=v(d,h):b.ctype==2&&(b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]);else if(S=="gAMA")b.tabs[S]=g.readUint(d,h)/1e5;else if(S=="sRGB")b.tabs[S]=d[h];else if(S=="bKGD")b.ctype==0||b.ctype==4?b.tabs[S]=[v(d,h)]:b.ctype==2||b.ctype==6?b.tabs[S]=[v(d,h),v(d,h+2),v(d,h+4)]:b.ctype==3&&(b.tabs[S]=d[h]);else if(S=="IEND")break;h+=z,g.readUint(d,h),h+=4}var I;return L!=0&&((I=b.frames[b.frames.length-1]).data=n(b,A.slice(0,L),I.rect.width,I.rect.height)),b.data=n(b,_,b.width,b.height),delete b.compress,delete b.interlace,delete b.filter,b},toRGBA8:function(c){const d=c.width,h=c.height;if(c.tabs.acTL==null)return[t(c.data,d,h,c).buffer];const g=[];c.frames[0].data==null&&(c.frames[0].data=c.data);const v=d*h*4,C=new Uint8Array(v),b=new Uint8Array(v),_=new Uint8Array(v);for(let E=0;E<c.frames.length;E++){const L=c.frames[E],k=L.rect.x,j=L.rect.y,x=L.rect.width,y=L.rect.height,T=t(L.data,x,y,c);if(E!=0)for(var A=0;A<v;A++)_[A]=C[A];if(L.blend==0?f(T,x,y,C,d,h,k,j,0):L.blend==1&&f(T,x,y,C,d,h,k,j,1),g.push(C.buffer.slice(0)),L.dispose!=0){if(L.dispose==1)f(b,x,y,C,d,h,k,j,0);else if(L.dispose==2)for(A=0;A<v;A++)C[A]=_[A]}}return g},_paeth:i,_copyTile:f,_bin:e}})();(function(){const{_copyTile:e}=Le,{_bin:t}=Le,n=Le._paeth;var r={table:(function(){const x=new Uint32Array(256);for(let y=0;y<256;y++){let T=y;for(let M=0;M<8;M++)1&T?T=3988292384^T>>>1:T>>>=1;x[y]=T}return x})(),update(x,y,T,M){for(let O=0;O<M;O++)x=r.table[255&(x^y[T+O])]^x>>>8;return x},crc:(x,y,T)=>4294967295^r.update(4294967295,x,y,T)};function o(x,y,T,M){y[T]+=x[0]*M>>4,y[T+1]+=x[1]*M>>4,y[T+2]+=x[2]*M>>4,y[T+3]+=x[3]*M>>4}function s(x){return Math.max(0,Math.min(255,x))}function a(x,y){const T=x[0]-y[0],M=x[1]-y[1],O=x[2]-y[2],F=x[3]-y[3];return T*T+M*M+O*O+F*F}function i(x,y,T,M,O,F,I){I==null&&(I=1);const z=M.length,S=[];for(var w=0;w<z;w++){const R=M[w];S.push([R>>>0&255,R>>>8&255,R>>>16&255,R>>>24&255])}for(w=0;w<z;w++){let R=4294967295;for(var B=0,P=0;P<z;P++){var U=a(S[w],S[P]);P!=w&&U<R&&(R=U,B=P)}}const q=new Uint32Array(O.buffer),N=new Int16Array(y*T*4),D=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(w=0;w<D.length;w++)D[w]=255*((D[w]+.5)/16-.5);for(let R=0;R<T;R++)for(let H=0;H<y;H++){var $;w=4*(R*y+H),I!=2?$=[s(x[w]+N[w]),s(x[w+1]+N[w+1]),s(x[w+2]+N[w+2]),s(x[w+3]+N[w+3])]:(U=D[4*(3&R)+(3&H)],$=[s(x[w]+U),s(x[w+1]+U),s(x[w+2]+U),s(x[w+3]+U)]),B=0;let G=16777215;for(P=0;P<z;P++){const ne=a($,S[P]);ne<G&&(G=ne,B=P)}const K=S[B],V=[$[0]-K[0],$[1]-K[1],$[2]-K[2],$[3]-K[3]];I==1&&(H!=y-1&&o(V,N,w+4,7),R!=T-1&&(H!=0&&o(V,N,w+4*y-4,3),o(V,N,w+4*y,5),H!=y-1&&o(V,N,w+4*y+4,1))),F[w>>2]=B,q[w>>2]=M[B]}}function m(x,y,T,M,O){O==null&&(O={});const{crc:F}=r,I=t.writeUint,z=t.writeUshort,S=t.writeASCII;let w=8;const B=x.frames.length>1;let P,U=!1,q=33+(B?20:0);if(O.sRGB!=null&&(q+=13),O.pHYs!=null&&(q+=21),O.iCCP!=null&&(P=pako.deflate(O.iCCP),q+=21+P.length+4),x.ctype==3){for(var N=x.plte.length,D=0;D<N;D++)x.plte[D]>>>24!=255&&(U=!0);q+=8+3*N+4+(U?8+1*N+4:0)}for(var $=0;$<x.frames.length;$++)B&&(q+=38),q+=(K=x.frames[$]).cimg.length+12,$!=0&&(q+=4);q+=12;const R=new Uint8Array(q),H=[137,80,78,71,13,10,26,10];for(D=0;D<8;D++)R[D]=H[D];if(I(R,w,13),w+=4,S(R,w,"IHDR"),w+=4,I(R,w,y),w+=4,I(R,w,T),w+=4,R[w]=x.depth,w++,R[w]=x.ctype,w++,R[w]=0,w++,R[w]=0,w++,R[w]=0,w++,I(R,w,F(R,w-17,17)),w+=4,O.sRGB!=null&&(I(R,w,1),w+=4,S(R,w,"sRGB"),w+=4,R[w]=O.sRGB,w++,I(R,w,F(R,w-5,5)),w+=4),O.iCCP!=null){const V=13+P.length;I(R,w,V),w+=4,S(R,w,"iCCP"),w+=4,S(R,w,"ICC profile"),w+=11,w+=2,R.set(P,w),w+=P.length,I(R,w,F(R,w-(V+4),V+4)),w+=4}if(O.pHYs!=null&&(I(R,w,9),w+=4,S(R,w,"pHYs"),w+=4,I(R,w,O.pHYs[0]),w+=4,I(R,w,O.pHYs[1]),w+=4,R[w]=O.pHYs[2],w++,I(R,w,F(R,w-13,13)),w+=4),B&&(I(R,w,8),w+=4,S(R,w,"acTL"),w+=4,I(R,w,x.frames.length),w+=4,I(R,w,O.loop!=null?O.loop:0),w+=4,I(R,w,F(R,w-12,12)),w+=4),x.ctype==3){for(I(R,w,3*(N=x.plte.length)),w+=4,S(R,w,"PLTE"),w+=4,D=0;D<N;D++){const V=3*D,ne=x.plte[D],Z=255&ne,re=ne>>>8&255,ue=ne>>>16&255;R[w+V+0]=Z,R[w+V+1]=re,R[w+V+2]=ue}if(w+=3*N,I(R,w,F(R,w-3*N-4,3*N+4)),w+=4,U){for(I(R,w,N),w+=4,S(R,w,"tRNS"),w+=4,D=0;D<N;D++)R[w+D]=x.plte[D]>>>24&255;w+=N,I(R,w,F(R,w-N-4,N+4)),w+=4}}let G=0;for($=0;$<x.frames.length;$++){var K=x.frames[$];B&&(I(R,w,26),w+=4,S(R,w,"fcTL"),w+=4,I(R,w,G++),w+=4,I(R,w,K.rect.width),w+=4,I(R,w,K.rect.height),w+=4,I(R,w,K.rect.x),w+=4,I(R,w,K.rect.y),w+=4,z(R,w,M[$]),w+=2,z(R,w,1e3),w+=2,R[w]=K.dispose,w++,R[w]=K.blend,w++,I(R,w,F(R,w-30,30)),w+=4);const V=K.cimg;I(R,w,(N=V.length)+($==0?0:4)),w+=4;const ne=w;S(R,w,$==0?"IDAT":"fdAT"),w+=4,$!=0&&(I(R,w,G++),w+=4),R.set(V,w),w+=N,I(R,w,F(R,ne,w-ne)),w+=4}return I(R,w,0),w+=4,S(R,w,"IEND"),w+=4,I(R,w,F(R,w-4,4)),w+=4,R.buffer}function f(x,y,T){for(let M=0;M<x.frames.length;M++){const O=x.frames[M];O.rect.width;const F=O.rect.height,I=new Uint8Array(F*O.bpl+F);O.cimg=h(O.img,F,O.bpp,O.bpl,I,y,T)}}function l(x,y,T,M,O){const F=O[0],I=O[1],z=O[2],S=O[3],w=O[4],B=O[5];let P=6,U=8,q=255;for(var N=0;N<x.length;N++){const ye=new Uint8Array(x[N]);for(var D=ye.length,$=0;$<D;$+=4)q&=ye[$+3]}const R=q!=255,H=(function(fe,ie,ge,we,me,_e){const Ce=[];for(var pe=0;pe<fe.length;pe++){const J=new Uint8Array(fe[pe]),ce=new Uint32Array(J.buffer);var Te;let Se=0,le=0,ve=ie,Xe=ge,Mt=we?1:0;if(pe!=0){const lc=_e||we||pe==1||Ce[pe-2].dispose!=0?1:2;let dr=0,Uo=1e9;for(let Zt=0;Zt<lc;Zt++){var Be=new Uint8Array(fe[pe-1-Zt]);const cc=new Uint32Array(fe[pe-1-Zt]);let ot=ie,st=ge,Pt=-1,Jt=-1;for(let vt=0;vt<ge;vt++)for(let bt=0;bt<ie;bt++)ce[W=vt*ie+bt]!=cc[W]&&(bt<ot&&(ot=bt),bt>Pt&&(Pt=bt),vt<st&&(st=vt),vt>Jt&&(Jt=vt));Pt==-1&&(ot=st=Pt=Jt=0),me&&((1&ot)==1&&ot--,(1&st)==1&&st--);const zo=(Pt-ot+1)*(Jt-st+1);zo<Uo&&(Uo=zo,dr=Zt,Se=ot,le=st,ve=Pt-ot+1,Xe=Jt-st+1)}Be=new Uint8Array(fe[pe-1-dr]),dr==1&&(Ce[pe-1].dispose=2),Te=new Uint8Array(ve*Xe*4),e(Be,ie,ge,Te,ve,Xe,-Se,-le,0),Mt=e(J,ie,ge,Te,ve,Xe,-Se,-le,3)?1:0,Mt==1?d(J,ie,ge,Te,{x:Se,y:le,width:ve,height:Xe}):e(J,ie,ge,Te,ve,Xe,-Se,-le,0)}else Te=J.slice(0);Ce.push({rect:{x:Se,y:le,width:ve,height:Xe},img:Te,blend:Mt,dispose:0})}if(we)for(pe=0;pe<Ce.length;pe++){if((Y=Ce[pe]).blend==1)continue;const J=Y.rect,ce=Ce[pe-1].rect,Se=Math.min(J.x,ce.x),le=Math.min(J.y,ce.y),ve={x:Se,y:le,width:Math.max(J.x+J.width,ce.x+ce.width)-Se,height:Math.max(J.y+J.height,ce.y+ce.height)-le};Ce[pe-1].dispose=1,pe-1!=0&&c(fe,ie,ge,Ce,pe-1,ve,me),c(fe,ie,ge,Ce,pe,ve,me)}let xt=0;if(fe.length!=1)for(var W=0;W<Ce.length;W++){var Y;xt+=(Y=Ce[W]).rect.width*Y.rect.height}return Ce})(x,y,T,F,I,z),G={},K=[],V=[];if(M!=0){const ye=[];for($=0;$<H.length;$++)ye.push(H[$].img.buffer);const fe=(function(me){let _e=0;for(var Ce=0;Ce<me.length;Ce++)_e+=me[Ce].byteLength;const pe=new Uint8Array(_e);let Te=0;for(Ce=0;Ce<me.length;Ce++){const Be=new Uint8Array(me[Ce]),xt=Be.length;for(let W=0;W<xt;W+=4){let Y=Be[W],J=Be[W+1],ce=Be[W+2];const Se=Be[W+3];Se==0&&(Y=J=ce=0),pe[Te+W]=Y,pe[Te+W+1]=J,pe[Te+W+2]=ce,pe[Te+W+3]=Se}Te+=xt}return pe.buffer})(ye),ie=v(fe,M);for($=0;$<ie.plte.length;$++)K.push(ie.plte[$].est.rgba);let ge=0;for($=0;$<H.length;$++){const we=(Z=H[$]).img.length;var ne=new Uint8Array(ie.inds.buffer,ge>>2,we>>2);V.push(ne);const me=new Uint8Array(ie.abuf,ge,we);B&&i(Z.img,Z.rect.width,Z.rect.height,K,me,ne),Z.img.set(me),ge+=we}}else for(N=0;N<H.length;N++){var Z=H[N];const ye=new Uint32Array(Z.img.buffer);var re=Z.rect.width;for(D=ye.length,ne=new Uint8Array(D),V.push(ne),$=0;$<D;$++){const fe=ye[$];if($!=0&&fe==ye[$-1])ne[$]=ne[$-1];else if($>re&&fe==ye[$-re])ne[$]=ne[$-re];else{let ie=G[fe];if(ie==null&&(G[fe]=ie=K.length,K.push(fe),K.length>=300))break;ne[$]=ie}}}const ue=K.length;for(ue<=256&&w==0&&(U=ue<=2?1:ue<=4?2:ue<=16?4:8,U=Math.max(U,S)),N=0;N<H.length;N++){(Z=H[N]).rect.x,Z.rect.y,re=Z.rect.width;const ye=Z.rect.height;let fe=Z.img;new Uint32Array(fe.buffer);let ie=4*re,ge=4;if(ue<=256&&w==0){ie=Math.ceil(U*re/8);var be=new Uint8Array(ie*ye);const we=V[N];for(let me=0;me<ye;me++){$=me*ie;const _e=me*re;if(U==8)for(var de=0;de<re;de++)be[$+de]=we[_e+de];else if(U==4)for(de=0;de<re;de++)be[$+(de>>1)]|=we[_e+de]<<4-4*(1&de);else if(U==2)for(de=0;de<re;de++)be[$+(de>>2)]|=we[_e+de]<<6-2*(3&de);else if(U==1)for(de=0;de<re;de++)be[$+(de>>3)]|=we[_e+de]<<7-1*(7&de)}fe=be,P=3,ge=1}else if(R==0&&H.length==1){be=new Uint8Array(re*ye*3);const we=re*ye;for($=0;$<we;$++){const me=3*$,_e=4*$;be[me]=fe[_e],be[me+1]=fe[_e+1],be[me+2]=fe[_e+2]}fe=be,P=2,ge=3,ie=3*re}Z.img=fe,Z.bpl=ie,Z.bpp=ge}return{ctype:P,depth:U,plte:K,frames:H}}function c(x,y,T,M,O,F,I){const z=Uint8Array,S=Uint32Array,w=new z(x[O-1]),B=new S(x[O-1]),P=O+1<x.length?new z(x[O+1]):null,U=new z(x[O]),q=new S(U.buffer);let N=y,D=T,$=-1,R=-1;for(let G=0;G<F.height;G++)for(let K=0;K<F.width;K++){const V=F.x+K,ne=F.y+G,Z=ne*y+V,re=q[Z];re==0||M[O-1].dispose==0&&B[Z]==re&&(P==null||P[4*Z+3]!=0)||(V<N&&(N=V),V>$&&($=V),ne<D&&(D=ne),ne>R&&(R=ne))}$==-1&&(N=D=$=R=0),I&&((1&N)==1&&N--,(1&D)==1&&D--),F={x:N,y:D,width:$-N+1,height:R-D+1};const H=M[O];H.rect=F,H.blend=1,H.img=new Uint8Array(F.width*F.height*4),M[O-1].dispose==0?(e(w,y,T,H.img,F.width,F.height,-F.x,-F.y,0),d(U,y,T,H.img,F)):e(U,y,T,H.img,F.width,F.height,-F.x,-F.y,0)}function d(x,y,T,M,O){e(x,y,T,M,O.width,O.height,-O.x,-O.y,2)}function h(x,y,T,M,O,F,I){const z=[];let S,w=[0,1,2,3,4];F!=-1?w=[F]:(y*M>5e5||T==1)&&(w=[0]),I&&(S={level:0});const B=jh;for(var P=0;P<w.length;P++){for(let N=0;N<y;N++)g(O,x,N,M,T,w[P]);z.push(B.deflate(O,S))}let U,q=1e9;for(P=0;P<z.length;P++)z[P].length<q&&(U=P,q=z[P].length);return z[U]}function g(x,y,T,M,O,F){const I=T*M;let z=I+T;if(x[z]=F,z++,F==0)if(M<500)for(var S=0;S<M;S++)x[z+S]=y[I+S];else x.set(new Uint8Array(y.buffer,I,M),z);else if(F==1){for(S=0;S<O;S++)x[z+S]=y[I+S];for(S=O;S<M;S++)x[z+S]=y[I+S]-y[I+S-O]+256&255}else if(T==0){for(S=0;S<O;S++)x[z+S]=y[I+S];if(F==2)for(S=O;S<M;S++)x[z+S]=y[I+S];if(F==3)for(S=O;S<M;S++)x[z+S]=y[I+S]-(y[I+S-O]>>1)+256&255;if(F==4)for(S=O;S<M;S++)x[z+S]=y[I+S]-n(y[I+S-O],0,0)+256&255}else{if(F==2)for(S=0;S<M;S++)x[z+S]=y[I+S]+256-y[I+S-M]&255;if(F==3){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-(y[I+S-M]>>1)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-(y[I+S-M]+y[I+S-O]>>1)&255}if(F==4){for(S=0;S<O;S++)x[z+S]=y[I+S]+256-n(0,y[I+S-M],0)&255;for(S=O;S<M;S++)x[z+S]=y[I+S]+256-n(y[I+S-O],y[I+S-M],y[I+S-O-M])&255}}}function v(x,y){const T=new Uint8Array(x),M=T.slice(0),O=new Uint32Array(M.buffer),F=C(M,y),I=F[0],z=F[1],S=T.length,w=new Uint8Array(S>>2);let B;if(T.length<2e7)for(var P=0;P<S;P+=4)B=b(I,U=T[P]*(1/255),q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255)),w[P>>2]=B.ind,O[P>>2]=B.est.rgba;else for(P=0;P<S;P+=4){var U=T[P]*.00392156862745098,q=T[P+1]*(1/255),N=T[P+2]*(1/255),D=T[P+3]*(1/255);for(B=I;B.left;)B=_(B.est,U,q,N,D)<=0?B.left:B.right;w[P>>2]=B.ind,O[P>>2]=B.est.rgba}return{abuf:M.buffer,inds:w,plte:z}}function C(x,y,T){T==null&&(T=1e-4);const M=new Uint32Array(x.buffer),O={i0:0,i1:x.length,bst:null,est:null,tdst:0,left:null,right:null};O.bst=L(x,O.i0,O.i1),O.est=k(O.bst);const F=[O];for(;F.length<y;){let z=0,S=0;for(var I=0;I<F.length;I++)F[I].est.L>z&&(z=F[I].est.L,S=I);if(z<T)break;const w=F[S],B=A(x,M,w.i0,w.i1,w.est.e,w.est.eMq255);if(w.i0>=B||w.i1<=B){w.est.L=0;continue}const P={i0:w.i0,i1:B,bst:null,est:null,tdst:0,left:null,right:null};P.bst=L(x,P.i0,P.i1),P.est=k(P.bst);const U={i0:B,i1:w.i1,bst:null,est:null,tdst:0,left:null,right:null};for(U.bst={R:[],m:[],N:w.bst.N-P.bst.N},I=0;I<16;I++)U.bst.R[I]=w.bst.R[I]-P.bst.R[I];for(I=0;I<4;I++)U.bst.m[I]=w.bst.m[I]-P.bst.m[I];U.est=k(U.bst),w.left=P,w.right=U,F[S]=P,F.push(U)}for(F.sort(((z,S)=>S.bst.N-z.bst.N)),I=0;I<F.length;I++)F[I].ind=I;return[O,F]}function b(x,y,T,M,O){if(x.left==null)return x.tdst=(function(P,U,q,N,D){const $=U-P[0],R=q-P[1],H=N-P[2],G=D-P[3];return $*$+R*R+H*H+G*G})(x.est.q,y,T,M,O),x;const F=_(x.est,y,T,M,O);let I=x.left,z=x.right;F>0&&(I=x.right,z=x.left);const S=b(I,y,T,M,O);if(S.tdst<=F*F)return S;const w=b(z,y,T,M,O);return w.tdst<S.tdst?w:S}function _(x,y,T,M,O){const{e:F}=x;return F[0]*y+F[1]*T+F[2]*M+F[3]*O-x.eMq}function A(x,y,T,M,O,F){for(M-=4;T<M;){for(;E(x,T,O)<=F;)T+=4;for(;E(x,M,O)>F;)M-=4;if(T>=M)break;const I=y[T>>2];y[T>>2]=y[M>>2],y[M>>2]=I,T+=4,M-=4}for(;E(x,T,O)>F;)T-=4;return T+4}function E(x,y,T){return x[y]*T[0]+x[y+1]*T[1]+x[y+2]*T[2]+x[y+3]*T[3]}function L(x,y,T){const M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],O=[0,0,0,0],F=T-y>>2;for(let I=y;I<T;I+=4){const z=x[I]*.00392156862745098,S=x[I+1]*(1/255),w=x[I+2]*(1/255),B=x[I+3]*(1/255);O[0]+=z,O[1]+=S,O[2]+=w,O[3]+=B,M[0]+=z*z,M[1]+=z*S,M[2]+=z*w,M[3]+=z*B,M[5]+=S*S,M[6]+=S*w,M[7]+=S*B,M[10]+=w*w,M[11]+=w*B,M[15]+=B*B}return M[4]=M[1],M[8]=M[2],M[9]=M[6],M[12]=M[3],M[13]=M[7],M[14]=M[11],{R:M,m:O,N:F}}function k(x){const{R:y}=x,{m:T}=x,{N:M}=x,O=T[0],F=T[1],I=T[2],z=T[3],S=M==0?0:1/M,w=[y[0]-O*O*S,y[1]-O*F*S,y[2]-O*I*S,y[3]-O*z*S,y[4]-F*O*S,y[5]-F*F*S,y[6]-F*I*S,y[7]-F*z*S,y[8]-I*O*S,y[9]-I*F*S,y[10]-I*I*S,y[11]-I*z*S,y[12]-z*O*S,y[13]-z*F*S,y[14]-z*I*S,y[15]-z*z*S],B=w,P=j;let U=[Math.random(),Math.random(),Math.random(),Math.random()],q=0,N=0;if(M!=0)for(let $=0;$<16&&(U=P.multVec(B,U),N=Math.sqrt(P.dot(U,U)),U=P.sml(1/N,U),!($!=0&&Math.abs(N-q)<1e-9));$++)q=N;const D=[O*S,F*S,I*S,z*S];return{Cov:w,q:D,e:U,L:q,eMq255:P.dot(P.sml(255,D),U),eMq:P.dot(U,D),rgba:(Math.round(255*D[3])<<24|Math.round(255*D[2])<<16|Math.round(255*D[1])<<8|Math.round(255*D[0])<<0)>>>0}}var j={multVec:(x,y)=>[x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],x[4]*y[0]+x[5]*y[1]+x[6]*y[2]+x[7]*y[3],x[8]*y[0]+x[9]*y[1]+x[10]*y[2]+x[11]*y[3],x[12]*y[0]+x[13]*y[1]+x[14]*y[2]+x[15]*y[3]],dot:(x,y)=>x[0]*y[0]+x[1]*y[1]+x[2]*y[2]+x[3]*y[3],sml:(x,y)=>[x*y[0],x*y[1],x*y[2],x*y[3]]};Le.encode=function(y,T,M,O,F,I,z){O==null&&(O=0),z==null&&(z=!1);const S=l(y,T,M,O,[!1,!1,!1,0,z,!1]);return f(S,-1),m(S,T,M,F,I)},Le.encodeLL=function(y,T,M,O,F,I,z,S){const w={ctype:0+(O==1?0:2)+(F==0?0:4),depth:I,frames:[]},B=(O+F)*I,P=B*T;for(let U=0;U<y.length;U++)w.frames.push({rect:{x:0,y:0,width:T,height:M},img:new Uint8Array(y[U]),blend:0,dispose:1,bpp:Math.ceil(B/8),bpl:Math.ceil(P/8)});return f(w,0,!0),m(w,T,M,z,S)},Le.encode.compress=l,Le.encode.dither=i,Le.quantize=v,Le.quantize.getKDtree=C,Le.quantize.getNearest=b})();const Wi={toArrayBuffer(e,t){const n=e.width,r=e.height,o=n<<2,s=e.getContext("2d").getImageData(0,0,n,r),a=new Uint32Array(s.data.buffer),i=(32*n+31)/32<<2,m=i*r,f=122+m,l=new ArrayBuffer(f),c=new DataView(l),d=1<<20;let h,g,v,C,b=d,_=0,A=0,E=0;function L(x){c.setUint16(A,x,!0),A+=2}function k(x){c.setUint32(A,x,!0),A+=4}function j(x){A+=x}L(19778),k(f),j(4),k(122),k(108),k(n),k(-r>>>0),L(1),L(32),k(3),k(m),k(2835),k(2835),j(8),k(16711680),k(65280),k(255),k(4278190080),k(1466527264),(function x(){for(;_<r&&b>0;){for(C=122+_*i,h=0;h<o;)b--,g=a[E++],v=g>>>24,c.setUint32(C+h,g<<8|v),h+=4;_++}E<a.length?(b=d,setTimeout(x,Wi._dly)):t(l)})()},toBlob(e,t){this.toArrayBuffer(e,(n=>{t(new Blob([n],{type:"image/bmp"}))}))},_dly:9};var Ie={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},Th={[Ie.CHROME]:16384,[Ie.FIREFOX]:11180,[Ie.DESKTOP_SAFARI]:16384,[Ie.IE]:8192,[Ie.IOS]:4096,[Ie.ETC]:8192};const _o=typeof window<"u",Gi=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,Hn=_o&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),Rh=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"File")||typeof File<"u"&&File),Vi=(_o||Gi)&&(Hn&&Hn.getOriginalSymbol(window,"FileReader")||typeof FileReader<"u"&&FileReader);function Ao(e,t,n=Date.now()){return new Promise((r=>{const o=e.split(","),s=o[0].match(/:(.*?);/)[1],a=globalThis.atob(o[1]);let i=a.length;const m=new Uint8Array(i);for(;i--;)m[i]=a.charCodeAt(i);const f=new Blob([m],{type:s});f.name=t,f.lastModified=n,r(f)}))}function Ki(e){return new Promise(((t,n)=>{const r=new Vi;r.onload=()=>t(r.result),r.onerror=o=>n(o),r.readAsDataURL(e)}))}function qi(e){return new Promise(((t,n)=>{const r=new Image;r.onload=()=>t(r),r.onerror=o=>n(o),r.src=e}))}function St(){if(St.cachedResult!==void 0)return St.cachedResult;let e=Ie.ETC;const{userAgent:t}=navigator;return/Chrom(e|ium)/i.test(t)?e=Ie.CHROME:/iP(ad|od|hone)/i.test(t)&&/WebKit/i.test(t)?e=Ie.IOS:/Safari/i.test(t)?e=Ie.DESKTOP_SAFARI:/Firefox/i.test(t)?e=Ie.FIREFOX:(/MSIE/i.test(t)||document.documentMode)&&(e=Ie.IE),St.cachedResult=e,St.cachedResult}function Yi(e,t){const n=St(),r=Th[n];let o=e,s=t,a=o*s;const i=o>s?s/o:o/s;for(;a>r*r;){const m=(r+o)/2,f=(r+s)/2;m<f?(s=f,o=f*i):(s=m*i,o=m),a=o*s}return{width:o,height:s}}function rr(e,t){let n,r;try{if(n=new OffscreenCanvas(e,t),r=n.getContext("2d"),r===null)throw new Error("getContext of OffscreenCanvas returns null")}catch{n=document.createElement("canvas"),r=n.getContext("2d")}return n.width=e,n.height=t,[n,r]}function Xi(e,t){const{width:n,height:r}=Yi(e.width,e.height),[o,s]=rr(n,r);return t&&/jpe?g/.test(t)&&(s.fillStyle="white",s.fillRect(0,0,o.width,o.height)),s.drawImage(e,0,0,o.width,o.height),o}function Rn(){return Rn.cachedResult!==void 0||(Rn.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&typeof document<"u"&&"ontouchend"in document),Rn.cachedResult}function Wn(e,t={}){return new Promise((function(n,r){let o,s;var a=function(){try{return s=Xi(o,t.fileType||e.type),n([o,s])}catch(m){return r(m)}},i=function(m){try{var f=function(l){try{throw l}catch(c){return r(c)}};try{let l;return Ki(e).then((function(c){try{return l=c,qi(l).then((function(d){try{return o=d,(function(){try{return a()}catch(h){return r(h)}})()}catch(h){return f(h)}}),f)}catch(d){return f(d)}}),f)}catch(l){f(l)}}catch(l){return r(l)}};try{if(Rn()||[Ie.DESKTOP_SAFARI,Ie.MOBILE_SAFARI].includes(St()))throw new Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then((function(m){try{return o=m,a()}catch{return i()}}),i)}catch{i()}}))}function Gn(e,t,n,r,o=1){return new Promise((function(s,a){let i;if(t==="image/png"){let f,l,c;return f=e.getContext("2d"),{data:l}=f.getImageData(0,0,e.width,e.height),c=Le.encode([l.buffer],e.width,e.height,4096*o),i=new Blob([c],{type:t}),i.name=n,i.lastModified=r,m.call(this)}{let f=function(){return m.call(this)};if(t==="image/bmp")return new Promise((l=>Wi.toBlob(e,l))).then((function(l){try{return i=l,i.name=n,i.lastModified=r,f.call(this)}catch(c){return a(c)}}).bind(this),a);{let l=function(){return f.call(this)};if(typeof OffscreenCanvas=="function"&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:o}).then((function(c){try{return i=c,i.name=n,i.lastModified=r,l.call(this)}catch(d){return a(d)}}).bind(this),a);{let c;return c=e.toDataURL(t,o),Ao(c,n,r).then((function(d){try{return i=d,l.call(this)}catch(h){return a(h)}}).bind(this),a)}}}function m(){return s(i)}}))}function Ge(e){e.width=0,e.height=0}function $t(){return new Promise((function(e,t){let n,r,o,s;return $t.cachedResult!==void 0?e($t.cachedResult):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 r=i[1],Gn(r,n.type,n.name,n.lastModified).then((function(m){try{return o=m,Ge(r),Wn(o).then((function(f){try{return s=f[0],$t.cachedResult=s.width===1&&s.height===2,e($t.cachedResult)}catch(l){return t(l)}}),t)}catch(f){return t(f)}}),t)}catch(m){return t(m)}}),t)}catch(i){return t(i)}}),t)}))}function Qi(e){return new Promise(((t,n)=>{const r=new Vi;r.onload=o=>{const s=new DataView(o.target.result);if(s.getUint16(0,!1)!=65496)return t(-2);const a=s.byteLength;let i=2;for(;i<a;){if(s.getUint16(i+2,!1)<=8)return t(-1);const m=s.getUint16(i,!1);if(i+=2,m==65505){if(s.getUint32(i+=2,!1)!=1165519206)return t(-1);const f=s.getUint16(i+=6,!1)==18761;i+=s.getUint32(i+4,f);const l=s.getUint16(i,f);i+=2;for(let c=0;c<l;c++)if(s.getUint16(i+12*c,f)==274)return t(s.getUint16(i+12*c+8,f))}else{if((65280&m)!=65280)break;i+=s.getUint16(i,!1)}}return t(-1)},r.onerror=o=>n(o),r.readAsArrayBuffer(e)}))}function Zi(e,t){const{width:n}=e,{height:r}=e,{maxWidthOrHeight:o}=t;let s,a=e;return isFinite(o)&&(n>o||r>o)&&([a,s]=rr(n,r),n>r?(a.width=o,a.height=r/n*o):(a.width=n/r*o,a.height=o),s.drawImage(e,0,0,a.width,a.height),Ge(e)),a}function Ji(e,t){const{width:n}=e,{height:r}=e,[o,s]=rr(n,r);switch(t>4&&t<9?(o.width=r,o.height=n):(o.width=n,o.height=r),t){case 2:s.transform(-1,0,0,1,n,0);break;case 3:s.transform(-1,0,0,-1,n,r);break;case 4:s.transform(1,0,0,-1,0,r);break;case 5:s.transform(0,1,1,0,0,0);break;case 6:s.transform(0,1,-1,0,r,0);break;case 7:s.transform(0,-1,-1,0,r,n);break;case 8:s.transform(0,-1,1,0,0,n)}return s.drawImage(e,0,0,n,r),Ge(e),o}function Ss(e,t,n=0){return new Promise((function(r,o){let s,a,i,m,f,l,c,d,h,g,v,C,b,_,A,E,L,k,j,x;function y(M=5){if(t.signal&&t.signal.aborted)throw t.signal.reason;s+=M,t.onProgress(Math.min(s,100))}function T(M){if(t.signal&&t.signal.aborted)throw t.signal.reason;s=Math.min(Math.max(M,s),100),t.onProgress(s)}return s=n,a=t.maxIteration||10,i=1024*t.maxSizeMB*1024,y(),Wn(e,t).then((function(M){try{return[,m]=M,y(),f=Zi(m,t),y(),new Promise((function(O,F){var I;if(!(I=t.exifOrientation))return Qi(e).then((function(S){try{return I=S,z.call(this)}catch(w){return F(w)}}).bind(this),F);function z(){return O(I)}return z.call(this)})).then((function(O){try{return l=O,y(),$t().then((function(F){try{return c=F?f:Ji(f,l),y(),d=t.initialQuality||1,h=t.fileType||e.type,Gn(c,h,e.name,e.lastModified,d).then((function(I){try{{let S=function(){if(a--&&(A>i||A>b)){let B,P;return B=x?.95*j.width:j.width,P=x?.95*j.height:j.height,[L,k]=rr(B,P),k.drawImage(j,0,0,B,P),d*=h==="image/png"?.85:.95,Gn(L,h,e.name,e.lastModified,d).then((function(U){try{return E=U,Ge(j),j=L,A=E.size,T(Math.min(99,Math.floor((_-A)/(_-i)*100))),S}catch(q){return o(q)}}),o)}return[1]},w=function(){return Ge(j),Ge(L),Ge(f),Ge(c),Ge(m),T(100),r(E)};if(g=I,y(),v=g.size>i,C=g.size>e.size,!v&&!C)return T(100),r(g);var z;return b=e.size,_=g.size,A=_,j=c,x=!t.alwaysKeepResolution&&v,(z=(function(B){for(;B;){if(B.then)return void B.then(z,o);try{if(B.pop){if(B.length)return B.pop()?w.call(this):B;B=S}else B=B.call(this)}catch(P){return o(P)}}}).bind(this))(S)}}catch(S){return o(S)}}).bind(this),o)}catch(I){return o(I)}}).bind(this),o)}catch(F){return o(F)}}).bind(this),o)}catch(O){return o(O)}}).bind(this),o)}))}const Nh=`
208
208
  let scriptImported = false
209
209
  self.addEventListener('message', async (e) => {
210
210
  const { file, id, imageCompressionLibUrl, options } = e.data
@@ -223,20 +223,20 @@ self.addEventListener('message', async (e) => {
223
223
  self.postMessage({ error: e.message + '\\n' + e.stack, id })
224
224
  }
225
225
  })
226
- `;let Cr;function Ih(e,t){return new Promise(((n,o)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Nh));const r=new Worker(Cr);r.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)r.terminate();else if(a.data.progress===void 0){if(a.data.error)return o(new Error(a.data.error)),void r.terminate();n(a.data.file),r.terminate()}else t.onProgress(a.data.progress)})),r.addEventListener("error",o),t.signal&&t.signal.addEventListener("abort",(()=>{o(t.signal.reason),r.terminate()})),r.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function je(e,t){return new Promise((function(n,o){let r,s,a,i,m,f;if(r={...t},a=0,{onProgress:i}=r,r.maxSizeMB=r.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof r.useWebWorker!="boolean"||r.useWebWorker,delete r.useWebWorker,r.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Rh))return o(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return o(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,r).then((function(h){try{return s=h,d.call(this)}catch(g){return o(g)}}).bind(this),o);var l=(function(){try{return d.call(this)}catch(h){return o(h)}}).bind(this),c=function(h){try{return Ss(e,r).then((function(g){try{return s=g,l()}catch(v){return o(v)}}),o)}catch(g){return o(g)}};try{return r.libURL=r.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ih(e,r).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{r.preserveExif&&e.type==="image/jpeg"&&(!r.fileType||r.fileType&&r.fileType===e.type)&&(s=Hi(e,s))}catch{}return n(s)}}))}je.getDataUrlFromFile=Ki,je.getFilefromDataUrl=Ao,je.loadImage=qi,je.drawImageInCanvas=Xi,je.drawFileInCanvas=Wn,je.canvasToFile=Gn,je.getExifOrientation=Qi,je.handleMaxWidthOrHeight=Zi,je.followExifOrientation=Ji,je.cleanupCanvasMemory=Ge,je.isAutoOrientationInBrowser=$t,je.approximateBelowMaximumCanvasSizeOfBrowser=Yi,je.copyExifWithoutOrientation=Hi,je.getBrowserName=St,je.version="2.0.2";var Mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Mh.reduce((e,t)=>{const n=ba(`Primitive.${t}`),o=p.forwardRef((r,s)=>{const{asChild:a,...i}=r,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Ph=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Oh="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Ph,...e.style}}));el.displayName=Oh;var Dh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Lh=700,Vr="tooltip.open",[Fh,jo]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Lh,skipDelayDuration:o=300,disableHoverableContent:r=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Fh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:r,children:s})};nl.displayName=tl;var ln="Tooltip",[$h,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:o,defaultOpen:r,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,_]=ut({prop:o,defaultProp:r??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx($h,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():E()},[m.isOpenDelayedRef,k,E]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:E,onClose:L,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,r.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":r.open?r.contentId:void 0,"data-state":r.stateAttribute,...o,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(r.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{r.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{r.open&&r.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||r.onOpen()}),onBlur:te(e.onBlur,r.onClose),onClick:te(e.onClick,r.onClose)})})});ol.displayName=Kr;var To="TooltipPortal",[Uh,zh]=or(To,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:o,container:r}=e,s=vn(To,t);return u.jsx(Uh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};sl.displayName=To;var Gt="TooltipContent",al=p.forwardRef((e,t)=>{const n=zh(Gt,e.__scopeTooltip),{forceMount:o=n.forceMount,side:r="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:o||a.open,children:a.disableHoverableContent?u.jsx(il,{side:r,...s,ref:t}):u.jsx(Bh,{side:r,...s,ref:t})})}),Bh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),o=jo(Gt,e.__scopeTooltip),r=p.useRef(null),s=ke(t,r),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=r.current,{onPointerInTransitChange:c}=o,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},_=Vh(b,C.getBoundingClientRect()),A=Kh(b,_),E=qh(v.getBoundingClientRect()),L=Xh([...A,...E]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!Yh(b,a);_?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Hh,Wh]=or(ln,{isInside:!1}),Gh=$d("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:o,"aria-label":r,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Gt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Vr,l),()=>document.removeEventListener(Vr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(Gh,{children:o}),u.jsx(Hh,{scope:n,isInside:!0,children:u.jsx(Dh,{id:m.contentId,role:"tooltip",children:r||o})})]})})});al.displayName=Gt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...o}=e,r=sr(n);return Wh(ll,n).isInside?null:u.jsx(go,{...r,...o,ref:t})});cl.displayName=ll;function Vh(e,t){const n=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),r=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,o,r,s)){case s:return"left";case r:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function Kh(e,t,n=5){const o=[];switch(t){case"top":o.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":o.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":o.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":o.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return o}function qh(e){const{top:t,right:n,bottom:o,left:r}=e;return[{x:r,y:t},{x:n,y:t},{x:n,y:o},{x:r,y:o}]}function Yh(e,t){const{x:n,y:o}=e;let r=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>o!=d>o&&n<(c-f)*(o-l)/(d-l)+f&&(r=!r)}return r}function Xh(e){const t=e.slice();return t.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),Qh(t)}function Qh(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const r=e[o];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))t.pop();else break}t.push(r)}t.pop();const n=[];for(let o=e.length-1;o>=0;o--){const r=e[o];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(r.y-a.y)>=(s.y-a.y)*(r.x-a.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Zh=nl,Jh=rl,eg=ol,tg=sl,ng=al,rg=cl;function og({delayDuration:e=0,...t}){return u.jsx(Zh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function sg({...e}){return u.jsx(og,{children:u.jsx(Jh,{"data-slot":"tooltip",...e})})}function ag({...e}){return u.jsx(eg,{"data-slot":"tooltip-trigger",...e})}function ig({className:e,sideOffset:t=0,children:n,...o}){return u.jsx(tg,{children:u.jsxs(ng,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...o,children:[n,u.jsx(rg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const lg=p.lazy(()=>Ae(()=>import("./mermaid-VLURNSYL-DLOgnkPH.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Ro=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(lg,{className:ee("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Ro.displayName="MessageResponse";var ar="Collapsible",[cg]=nt(ar),[ug,No]=cg(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:r,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:o,defaultProp:r??!1,onChange:a,caller:ar});return u.jsx(ug,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});ul.displayName=ar;var dl="CollapsibleTrigger",fl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...o}=e,r=No(dl,n);return u.jsx(he.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":Mo(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...o,ref:t,onClick:te(e.onClick,r.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...o}=e,r=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||r.open,children:({present:s})=>u.jsx(dg,{...o,ref:t,present:s})})});ml.displayName=Io;var dg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:o,children:r,...s}=e,a=No(Io,n),[i,m]=p.useState(o),f=p.useRef(null),l=ke(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Ze(()=>{const _=f.current;if(_){b.current=b.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const A=_.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(_.style.transitionDuration=b.current.transitionDuration,_.style.animationName=b.current.animationName),m(o)}},[a.open,o]),u.jsx(he.div,{"data-state":Mo(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!v,...s,ref:l,style:{"--radix-collapsible-content-height":d?`${d}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:v&&r})});function Mo(e){return e?"open":"closed"}var fg=ul;function mg({...e}){return u.jsx(fg,{"data-slot":"collapsible",...e})}function pg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function hg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const gg=({children:e,as:t="p",className:n,duration:o=2})=>{const r=pc.create(t);return u.jsx(r,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:o,ease:"easeInOut"},children:e})},xg=p.memo(gg),pl=p.createContext(null),vg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bg=1e3,yg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:o=!0,onOpenChange:r,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:o,onChange:r}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/yg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&o&&!t&&m&&!d){const _=setTimeout(()=>{f(!1),h(!0)},bg);return()=>clearTimeout(_)}},[t,m,o,f,d,C]);const b=_=>{f(_)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(mg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),wg=(e,t)=>e||t===0?u.jsx(xg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),gl=p.memo(({className:e,children:t,getThinkingMessage:n=wg,...o})=>{const{isStreaming:r,isOpen:s,duration:a}=vg();return u.jsx(pg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...o,children:t??u.jsxs(u.Fragment,{children:[u.jsx(xu,{className:"size-4"}),n(r,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),xl=p.memo(({className:e,children:t,...n})=>u.jsx(hg,{className:ee("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));hl.displayName="Reasoning";gl.displayName="ReasoningTrigger";xl.displayName="ReasoningContent";const Sr=200;function Cg({entry:e}){const[t,n]=p.useState(!1),[o,r]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&r(i.scrollHeight>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(kg,{image:i},m))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>u.jsx(Eg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&o&&`max-h-[${Sr}px]`),style:!t&&o?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&o&&u.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:u.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function Sg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,o)=>{if(n.type==="thought"){const r=o===e.chunks.length-1,s=t&&r;return u.jsxs(hl,{isStreaming:s,children:[u.jsx(gl,{}),u.jsx(xl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},o)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},o)})]})]})}function kg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Eg({attachment:e}){const[t,n]=p.useState(!1),o=(()=>{switch(e.kind){case"text":return u.jsx(Bt,{className:"h-4 w-4"});case"table":return u.jsx(ro,{className:"h-4 w-4"});case"directory":return u.jsx(no,{className:"h-4 w-4"});default:return u.jsx(Bt,{className:"h-4 w-4"})}})(),r=e.size!=null?_g(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[o,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[r&&u.jsx("span",{children:r}),r&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function _g(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ag(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function jg(e){switch(e){case"allow_once":case"allow_always":return u.jsx(un,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(dn,{className:"size-4"});default:return null}}function Tg({requestId:e,options:t,onRespond:n,className:o}){const r=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",o),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ma,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Rt,{variant:Ag(s.kind),size:"sm",onClick:()=>r(s),className:"gap-1.5",children:[jg(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Rg=1e6;function kr({filePath:e,oldString:t,newString:n,label:o}){const r=Ig(t,n),s=_s(r,"add"),a=_s(r,"remove"),i=r.length>ks?r.slice(0,ks):r,m=r.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),o&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:o})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Ng,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ng({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${e.text}`:void 0,className:ee("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Es(e){return e.length===0?[]:e.split(`
227
- `)}function _s(e,t){let n=0;for(const o of e)o.type===t&&n++;return n}function Ig(e,t){const n=Es(e),o=Es(t);let r=0;for(;r<n.length&&r<o.length&&n[r]===o[r];)r++;let s=n.length,a=o.length;for(;s>r&&a>r&&n[s-1]===o[a-1];)s--,a--;const i=[];for(let m=0;m<r;m++)i.push({type:"context",text:n[m]});Mg(n.slice(r,s),o.slice(r,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Mg(e,t,n){const o=e.length,r=t.length;if(o===0&&r===0)return;if(o*r>Rg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=r+1,a=new Uint32Array((o+1)*s);for(let f=o-1;f>=0;f--)for(let l=r-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<o&&m<r;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<o;)n.push({type:"remove",text:e[i]}),i++;for(;m<r;)n.push({type:"add",text:t[m]}),m++}function vl({entries:e,onPermissionRespond:t}){const[n,o]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(As,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const r=Bg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>o(!n),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:r})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(As,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function As({tool:e,compact:t,onPermissionRespond:n}){const[o,r]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Nn(e);return u.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>r(!o),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(Tg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),o&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Ug(e)??u.jsxs(u.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&u.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Et(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(In,{tool:e})]})})]})}const Pg=new Set(["FileEditTool","Edit","SedEdit"]),Og=new Set(["FileWriteTool","Write"]),Dg=new Set(["MultiEdit"]),Lg=new Set(["BashTool","Bash","PowerShellTool"]),Fg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],$g=["output","stdout","stderr","result"];function Ug(e){const t=Wg(e.title),n=e.rawInput??{};if(Pg.has(t)){const o=We(n,["old_string","oldString"]),r=We(n,["new_string","newString"]);return o===void 0||r===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:We(n,["file_path","filePath"])??t,oldString:o,newString:r}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Og.has(t)){const o=We(n,["file_path","filePath"]),r=We(n,["content"]);if(o===void 0||r===void 0)return null;const s=We(e.rawOutput??{},Fg);return u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:o,oldString:s??"",newString:r,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Dg.has(t)){const o=n.edits;if(Array.isArray(o)&&o.length>0){const r=We(n,["file_path","filePath"])??t,s=[];for(let a=0;a<o.length;a++){const i=o[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=We(m,["old_string","oldString"]),l=We(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(kr,{filePath:r,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(In,{tool:e})]})}return null}if(Lg.has(t)){const o=We(n,["command","cmd","script"]),r=Gg(e);return o===void 0&&r.length===0?null:u.jsx(zg,{command:o!==void 0?Et(o,500):void 0,output:r,isError:e.status==="error"})}return null}function zg({command:e,output:t,isError:n}){return u.jsx("div",{className:ee("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:u.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&u.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&u.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Bg(e){const t=new Map;for(const o of e){const r=Hg(o.toolCall.title);t.set(r,(t.get(r)||0)+1)}const n=[];for(const[o,r]of t)n.push(r===1?o:`${r} 次${o}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Hg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Wg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function We(e,t){for(const n of t){const o=e[n];if(typeof o=="string")return o}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function bl(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function Gg(e){const t=bl(e);if(t.length>0)return Et(t.join(`
228
- `),2e3);const n=e.rawOutput;if(n){for(const o of $g){const r=n[o];if(typeof r=="string"&&r.length>0)return Et(r,2e3)}if(Object.keys(n).length>0)return Et(JSON.stringify(n,null,2),2e3)}return""}function In({tool:e}){return u.jsx("pre",{className:ee("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:Vg(e)})}function Vg(e){const t=bl(e);return t.length>0?Et(t.join(`
229
- `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Et(JSON.stringify(e.rawOutput,null,2),2e3):""}function Et(e,t){return e.length>t?e.slice(0,t)+"...":e}function Kg({entry:e}){const[t,n]=p.useState(!1),{entries:o}=e;if(o.length===0)return null;const r=o.filter(i=>i.status==="completed").length,s=o.length,a=s>0?Math.round(r/s*100):0;return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[r,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:ee("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:o.map((i,m)=>u.jsx(qg,{entry:i},m))})]})})}function qg({entry:e}){return u.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[u.jsx("span",{className:"flex-shrink-0 mt-0.5",children:u.jsx(Yg,{status:e.status})}),u.jsx("span",{className:ee("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),u.jsx(Xg,{priority:e.priority})]})}function Yg({status:e}){switch(e){case"completed":return u.jsx(ku,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ua,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(_u,{className:"h-3.5 w-3.5 text-text-muted"})}}function Xg({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return u.jsx("span",{className:ee("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Qg({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
226
+ `;let Cr;function Ih(e,t){return new Promise(((n,r)=>{Cr||(Cr=(function(a){const i=[];return i.push(a),URL.createObjectURL(new Blob(i))})(Nh));const o=new Worker(Cr);o.addEventListener("message",(function(a){if(t.signal&&t.signal.aborted)o.terminate();else if(a.data.progress===void 0){if(a.data.error)return r(new Error(a.data.error)),void o.terminate();n(a.data.file),o.terminate()}else t.onProgress(a.data.progress)})),o.addEventListener("error",r),t.signal&&t.signal.addEventListener("abort",(()=>{r(t.signal.reason),o.terminate()})),o.postMessage({file:e,imageCompressionLibUrl:t.libURL,options:{...t,onProgress:void 0,signal:void 0}})}))}function je(e,t){return new Promise((function(n,r){let o,s,a,i,m,f;if(o={...t},a=0,{onProgress:i}=o,o.maxSizeMB=o.maxSizeMB||Number.POSITIVE_INFINITY,m=typeof o.useWebWorker!="boolean"||o.useWebWorker,delete o.useWebWorker,o.onProgress=h=>{a=h,typeof i=="function"&&i(a)},!(e instanceof Blob||e instanceof Rh))return r(new Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return r(new Error("The file given is not an image"));if(f=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,!m||typeof Worker!="function"||f)return Ss(e,o).then((function(h){try{return s=h,d.call(this)}catch(g){return r(g)}}).bind(this),r);var l=(function(){try{return d.call(this)}catch(h){return r(h)}}).bind(this),c=function(h){try{return Ss(e,o).then((function(g){try{return s=g,l()}catch(v){return r(v)}}),r)}catch(g){return r(g)}};try{return o.libURL=o.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",Ih(e,o).then((function(h){try{return s=h,l()}catch{return c()}}),c)}catch{c()}function d(){try{s.name=e.name,s.lastModified=e.lastModified}catch{}try{o.preserveExif&&e.type==="image/jpeg"&&(!o.fileType||o.fileType&&o.fileType===e.type)&&(s=Hi(e,s))}catch{}return n(s)}}))}je.getDataUrlFromFile=Ki,je.getFilefromDataUrl=Ao,je.loadImage=qi,je.drawImageInCanvas=Xi,je.drawFileInCanvas=Wn,je.canvasToFile=Gn,je.getExifOrientation=Qi,je.handleMaxWidthOrHeight=Zi,je.followExifOrientation=Ji,je.cleanupCanvasMemory=Ge,je.isAutoOrientationInBrowser=$t,je.approximateBelowMaximumCanvasSizeOfBrowser=Yi,je.copyExifWithoutOrientation=Hi,je.getBrowserName=St,je.version="2.0.2";var Mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ht=Mh.reduce((e,t)=>{const n=ba(`Primitive.${t}`),r=p.forwardRef((o,s)=>{const{asChild:a,...i}=o,m=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...i,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Ph=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Oh="VisuallyHidden",el=p.forwardRef((e,t)=>u.jsx(he.span,{...e,ref:t,style:{...Ph,...e.style}}));el.displayName=Oh;var Dh=el,[or]=nt("Tooltip",[Xt]),sr=Xt(),tl="TooltipProvider",Lh=700,Vr="tooltip.open",[Fh,jo]=or(tl),nl=e=>{const{__scopeTooltip:t,delayDuration:n=Lh,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,a=p.useRef(!0),i=p.useRef(!1),m=p.useRef(0);return p.useEffect(()=>{const f=m.current;return()=>window.clearTimeout(f)},[]),u.jsx(Fh,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(m.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(f=>{i.current=f},[]),disableHoverableContent:o,children:s})};nl.displayName=tl;var ln="Tooltip",[$h,vn]=or(ln),rl=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:a,delayDuration:i}=e,m=jo(ln,e.__scopeTooltip),f=sr(t),[l,c]=p.useState(null),d=Re(),h=p.useRef(0),g=a??m.disableHoverableContent,v=i??m.delayDuration,C=p.useRef(!1),[b,_]=ut({prop:r,defaultProp:o??!1,onChange:j=>{j?(m.onOpen(),document.dispatchEvent(new CustomEvent(Vr))):m.onClose(),s==null||s(j)},caller:ln}),A=p.useMemo(()=>b?C.current?"delayed-open":"instant-open":"closed",[b]),E=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,C.current=!1,_(!0)},[_]),L=p.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),k=p.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{C.current=!0,_(!0),h.current=0},v)},[v,_]);return p.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),u.jsx(po,{...f,children:u.jsx($h,{scope:t,contentId:d,open:b,stateAttribute:A,trigger:l,onTriggerChange:c,onTriggerEnter:p.useCallback(()=>{m.isOpenDelayedRef.current?k():E()},[m.isOpenDelayedRef,k,E]),onTriggerLeave:p.useCallback(()=>{g?L():(window.clearTimeout(h.current),h.current=0)},[L,g]),onOpen:E,onClose:L,disableHoverableContent:g,children:n})})};rl.displayName=ln;var Kr="TooltipTrigger",ol=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=vn(Kr,n),s=jo(Kr,n),a=sr(n),i=p.useRef(null),m=ke(t,i,o.onTriggerChange),f=p.useRef(!1),l=p.useRef(!1),c=p.useCallback(()=>f.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),u.jsx(Jn,{asChild:!0,...a,children:u.jsx(he.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:m,onPointerMove:te(e.onPointerMove,d=>{d.pointerType!=="touch"&&!l.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),l.current=!0)}),onPointerLeave:te(e.onPointerLeave,()=>{o.onTriggerLeave(),l.current=!1}),onPointerDown:te(e.onPointerDown,()=>{o.open&&o.onClose(),f.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:te(e.onFocus,()=>{f.current||o.onOpen()}),onBlur:te(e.onBlur,o.onClose),onClick:te(e.onClick,o.onClose)})})});ol.displayName=Kr;var To="TooltipPortal",[Uh,zh]=or(To,{forceMount:void 0}),sl=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=vn(To,t);return u.jsx(Uh,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};sl.displayName=To;var Gt="TooltipContent",al=p.forwardRef((e,t)=>{const n=zh(Gt,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,a=vn(Gt,e.__scopeTooltip);return u.jsx(Oe,{present:r||a.open,children:a.disableHoverableContent?u.jsx(il,{side:o,...s,ref:t}):u.jsx(Bh,{side:o,...s,ref:t})})}),Bh=p.forwardRef((e,t)=>{const n=vn(Gt,e.__scopeTooltip),r=jo(Gt,e.__scopeTooltip),o=p.useRef(null),s=ke(t,o),[a,i]=p.useState(null),{trigger:m,onClose:f}=n,l=o.current,{onPointerInTransitChange:c}=r,d=p.useCallback(()=>{i(null),c(!1)},[c]),h=p.useCallback((g,v)=>{const C=g.currentTarget,b={x:g.clientX,y:g.clientY},_=Vh(b,C.getBoundingClientRect()),A=Kh(b,_),E=qh(v.getBoundingClientRect()),L=Xh([...A,...E]);i(L),c(!0)},[c]);return p.useEffect(()=>()=>d(),[d]),p.useEffect(()=>{if(m&&l){const g=C=>h(C,l),v=C=>h(C,m);return m.addEventListener("pointerleave",g),l.addEventListener("pointerleave",v),()=>{m.removeEventListener("pointerleave",g),l.removeEventListener("pointerleave",v)}}},[m,l,h,d]),p.useEffect(()=>{if(a){const g=v=>{const C=v.target,b={x:v.clientX,y:v.clientY},_=(m==null?void 0:m.contains(C))||(l==null?void 0:l.contains(C)),A=!Yh(b,a);_?d():A&&(d(),f())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[m,l,a,f,d]),u.jsx(il,{...e,ref:s})}),[Hh,Wh]=or(ln,{isInside:!1}),Gh=$d("TooltipContent"),il=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:a,...i}=e,m=vn(Gt,n),f=sr(n),{onClose:l}=m;return p.useEffect(()=>(document.addEventListener(Vr,l),()=>document.removeEventListener(Vr,l)),[l]),p.useEffect(()=>{if(m.trigger){const c=d=>{const h=d.target;h!=null&&h.contains(m.trigger)&&l()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[m.trigger,l]),u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:c=>c.preventDefault(),onDismiss:l,children:u.jsxs(ho,{"data-state":m.stateAttribute,...f,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[u.jsx(Gh,{children:r}),u.jsx(Hh,{scope:n,isInside:!0,children:u.jsx(Dh,{id:m.contentId,role:"tooltip",children:o||r})})]})})});al.displayName=Gt;var ll="TooltipArrow",cl=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=sr(n);return Wh(ll,n).isInside?null:u.jsx(go,{...o,...r,ref:t})});cl.displayName=ll;function Vh(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Kh(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function qh(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Yh(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,a=t.length-1;s<t.length;a=s++){const i=t[s],m=t[a],f=i.x,l=i.y,c=m.x,d=m.y;l>r!=d>r&&n<(c-f)*(r-l)/(d-l)+f&&(o=!o)}return o}function Xh(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Qh(t)}function Qh(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],a=t[t.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(o.y-a.y)>=(s.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Zh=nl,Jh=rl,eg=ol,tg=sl,ng=al,rg=cl;function og({delayDuration:e=0,...t}){return u.jsx(Zh,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function sg({...e}){return u.jsx(og,{children:u.jsx(Jh,{"data-slot":"tooltip",...e})})}function ag({...e}){return u.jsx(eg,{"data-slot":"tooltip-trigger",...e})}function ig({className:e,sideOffset:t=0,children:n,...r}){return u.jsx(tg,{children:u.jsxs(ng,{"data-slot":"tooltip-content",sideOffset:t,className:ee("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,u.jsx(rg,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const lg=p.lazy(()=>Ae(()=>import("./mermaid-VLURNSYL-B7QjpmY_.js").then(e=>e.i),__vite__mapDeps([0,1,2])).then(e=>({default:e.Streamdown})));p.createContext(null);const Ro=p.memo(({className:e,children:t,...n})=>u.jsx(p.Suspense,{fallback:u.jsx("div",{className:ee("whitespace-pre-wrap break-words",e),children:t}),children:u.jsx(lg,{className:ee("size-full break-words [overflow-wrap:anywhere] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...n,children:t})}),(e,t)=>e.children===t.children);Ro.displayName="MessageResponse";var ar="Collapsible",[cg]=nt(ar),[ug,No]=cg(ar),ul=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...i}=e,[m,f]=ut({prop:r,defaultProp:o??!1,onChange:a,caller:ar});return u.jsx(ug,{scope:n,disabled:s,contentId:Re(),open:m,onOpenToggle:p.useCallback(()=>f(l=>!l),[f]),children:u.jsx(he.div,{"data-state":Mo(m),"data-disabled":s?"":void 0,...i,ref:t})})});ul.displayName=ar;var dl="CollapsibleTrigger",fl=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=No(dl,n);return u.jsx(he.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Mo(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:te(e.onClick,o.onOpenToggle)})});fl.displayName=dl;var Io="CollapsibleContent",ml=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=No(Io,e.__scopeCollapsible);return u.jsx(Oe,{present:n||o.open,children:({present:s})=>u.jsx(dg,{...r,ref:t,present:s})})});ml.displayName=Io;var dg=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=No(Io,n),[i,m]=p.useState(r),f=p.useRef(null),l=ke(t,f),c=p.useRef(0),d=c.current,h=p.useRef(0),g=h.current,v=a.open||i,C=p.useRef(v),b=p.useRef(void 0);return p.useEffect(()=>{const _=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(_)},[]),Ze(()=>{const _=f.current;if(_){b.current=b.current||{transitionDuration:_.style.transitionDuration,animationName:_.style.animationName},_.style.transitionDuration="0s",_.style.animationName="none";const A=_.getBoundingClientRect();c.current=A.height,h.current=A.width,C.current||(_.style.transitionDuration=b.current.transitionDuration,_.style.animationName=b.current.animationName),m(r)}},[a.open,r]),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&&o})});function Mo(e){return e?"open":"closed"}var fg=ul;function mg({...e}){return u.jsx(fg,{"data-slot":"collapsible",...e})}function pg({...e}){return u.jsx(fl,{"data-slot":"collapsible-trigger",...e})}function hg({...e}){return u.jsx(ml,{"data-slot":"collapsible-content",...e})}const gg=({children:e,as:t="p",className:n,duration:r=2})=>{const o=pc.create(t);return u.jsx(o,{animate:{opacity:[.5,1,.5]},className:ee("relative inline-block text-muted-foreground",n),transition:{repeat:Number.POSITIVE_INFINITY,duration:r,ease:"easeInOut"},children:e})},xg=p.memo(gg),pl=p.createContext(null),vg=()=>{const e=p.useContext(pl);if(!e)throw new Error("Reasoning components must be used within Reasoning");return e},bg=1e3,yg=1e3,hl=p.memo(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:o,duration:s,children:a,...i})=>{const[m,f]=ut({prop:n,defaultProp:r,onChange:o}),[l,c]=ut({prop:s,defaultProp:void 0}),[d,h]=p.useState(!1),[g,v]=p.useState(null);p.useEffect(()=>{t?g===null&&v(Date.now()):g!==null&&(c(Math.ceil((Date.now()-g)/yg)),v(null))},[t,g,c]);const C=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;p.useEffect(()=>{if(!C&&r&&!t&&m&&!d){const _=setTimeout(()=>{f(!1),h(!0)},bg);return()=>clearTimeout(_)}},[t,m,r,f,d,C]);const b=_=>{f(_)};return u.jsx(pl.Provider,{value:{isStreaming:t,isOpen:m??!1,setIsOpen:f,duration:l},children:u.jsx(mg,{className:ee("not-prose mb-4",e),onOpenChange:b,open:m,...i,children:a})})}),wg=(e,t)=>e||t===0?u.jsx(xg,{duration:1,children:"Thinking..."}):t===void 0?u.jsx("p",{children:"Thought for a few seconds"}):u.jsxs("p",{children:["Thought for ",t," seconds"]}),gl=p.memo(({className:e,children:t,getThinkingMessage:n=wg,...r})=>{const{isStreaming:o,isOpen:s,duration:a}=vg();return u.jsx(pg,{className:ee("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...r,children:t??u.jsxs(u.Fragment,{children:[u.jsx(xu,{className:"size-4"}),n(o,a),u.jsx(Kt,{className:ee("size-4 transition-transform",s?"rotate-180":"rotate-0")})]})})}),xl=p.memo(({className:e,children:t,...n})=>u.jsx(hg,{className:ee("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t}));hl.displayName="Reasoning";gl.displayName="ReasoningTrigger";xl.displayName="ReasoningContent";const Sr=200;function Cg({entry:e}){const[t,n]=p.useState(!1),[r,o]=p.useState(!1),s=p.useRef(null),a=p.useCallback(()=>{const i=s.current;i&&o(i.scrollHeight>Sr+4)},[]);return p.useEffect(()=>{a()},[a,e.content]),u.jsx("div",{className:"flex justify-end",children:u.jsxs("div",{className:"max-w-[85%] sm:max-w-[70%]",children:[e.images&&e.images.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.images.map((i,m)=>u.jsx(kg,{image:i},m))}),e.attachments&&e.attachments.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-2 justify-end",children:e.attachments.map((i,m)=>u.jsx(Eg,{attachment:i},m))}),e.content&&u.jsxs("div",{className:"relative rounded-2xl rounded-br-md bg-user-bubble border border-user-bubble-border overflow-hidden",children:[u.jsx("div",{ref:s,className:ee("px-5 py-3 text-sm text-text-primary whitespace-pre-wrap font-display leading-relaxed",!t&&r&&`max-h-[${Sr}px]`),style:!t&&r?{maxHeight:`${Sr}px`}:void 0,children:au(e.content)}),!t&&r&&u.jsx("div",{className:"absolute bottom-0 inset-x-0 flex flex-col items-center pt-8 bg-gradient-to-t from-user-bubble via-user-bubble/80 to-transparent",children:u.jsxs("button",{type:"button",onClick:()=>n(!0),className:"flex items-center gap-1 px-3 py-1 rounded-full text-xs font-display font-medium text-text-secondary hover:bg-brand/10 transition-colors",children:[u.jsx("span",{children:"展开"}),u.jsx(Kt,{className:"h-3 w-3"})]})})]})]})})}function Sg({entry:e,isStreaming:t}){return u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 mt-0.5 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsxs("div",{className:"flex-1 min-w-0 space-y-4",children:[u.jsx("span",{className:"text-sm font-semibold text-text-primary font-display",children:"Saluzi"}),e.chunks.map((n,r)=>{if(n.type==="thought"){const o=r===e.chunks.length-1,s=t&&o;return u.jsxs(hl,{isStreaming:s,children:[u.jsx(gl,{}),u.jsx(xl,{children:u.jsx("div",{className:"text-sm text-text-secondary leading-relaxed",children:n.text})})]},r)}return u.jsx("div",{className:"message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:n.text})},r)})]})]})}function kg({image:e}){const t=`data:${e.mimeType};base64,${e.data}`;return u.jsx("button",{type:"button",className:"rounded-lg overflow-hidden border border-border hover:border-brand/40 transition-colors cursor-pointer",onClick:()=>{const n=window.open("");n&&n.document.write(`<img src="${t}" style="max-width:100%;max-height:100%" />`)},children:u.jsx("img",{src:t,alt:"Uploaded image",className:"h-20 w-20 object-cover"})})}function Eg({attachment:e}){const[t,n]=p.useState(!1),r=(()=>{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"})}})(),o=e.size!=null?_g(e.size):null,s=e.kind==="directory"&&e.files?e.files.length:null,a=!!e.textContent;return u.jsxs("div",{className:"min-w-[160px] max-w-[300px]",children:[u.jsxs("button",{type:"button",onClick:()=>a&&n(i=>!i),className:ee("w-full flex items-center gap-2 rounded-lg border border-border bg-surface-1/50 px-3 py-2 text-xs text-text-secondary",a?"hover:border-brand/40 hover:bg-surface-1 cursor-pointer":"cursor-default"),children:[r,u.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[u.jsx("div",{className:"truncate font-mono text-text-primary",title:e.name,children:e.name}),u.jsxs("div",{className:"text-[10px] text-text-muted",children:[o&&u.jsx("span",{children:o}),o&&s!=null&&u.jsx("span",{children:" · "}),s!=null&&u.jsxs("span",{children:[s," 个文件"]})]})]}),a&&u.jsx(Kt,{className:ee("h-3.5 w-3.5 flex-shrink-0 transition-transform",t&&"rotate-180")})]}),t&&a&&u.jsx("div",{className:"mt-1 rounded-lg border border-border bg-surface-2 p-3 max-h-[300px] overflow-auto",children:u.jsx("pre",{className:"text-[11px] text-text-secondary font-mono whitespace-pre-wrap break-words",children:e.textContent})})]})}function _g(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Ag(e){switch(e){case"allow_once":case"allow_always":return"default";case"reject_once":case"reject_always":return"destructive";default:return"outline"}}function jg(e){switch(e){case"allow_once":case"allow_always":return u.jsx(un,{className:"size-4"});case"reject_once":case"reject_always":return u.jsx(dn,{className:"size-4"});default:return null}}function Tg({requestId:e,options:t,onRespond:n,className:r}){const o=s=>{n(e,s.optionId,s.kind)};return u.jsxs("div",{className:ee("p-3 border-t border-warning-border/30 bg-warning-bg/50",r),children:[u.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[u.jsx(ma,{className:"size-4 text-warning-text"}),u.jsx("span",{className:"text-xs font-medium text-warning-text",children:"Permission Required"})]}),u.jsx("div",{className:"flex flex-wrap gap-2",children:t.map(s=>u.jsxs(Rt,{variant:Ag(s.kind),size:"sm",onClick:()=>o(s),className:"gap-1.5",children:[jg(s.kind),s.name]},s.optionId))})]})}const ks=1e3,Rg=1e6;function kr({filePath:e,oldString:t,newString:n,label:r}){const o=Ig(t,n),s=_s(o,"add"),a=_s(o,"remove"),i=o.length>ks?o.slice(0,ks):o,m=o.length-i.length;return u.jsxs("div",{className:"rounded-md border border-border overflow-hidden",children:[u.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-surface-2 px-2 py-1",children:[u.jsx("span",{className:"min-w-0 max-w-[60%] truncate font-mono text-[11px] text-text-primary",title:e,children:e}),s>0&&u.jsxs("span",{className:"font-mono text-[10px] text-green-600 dark:text-green-400",children:["+",s]}),a>0&&u.jsxs("span",{className:"font-mono text-[10px] text-red-600 dark:text-red-400",children:["-",a]}),r&&u.jsx("span",{className:"ml-auto flex-shrink-0 font-display text-[10px] text-text-muted",children:r})]}),u.jsxs("div",{role:"list","aria-label":`${e} 的改动预览,${s} 行新增,${a} 行删除`,className:"max-h-48 overflow-auto bg-surface-1/50 py-1 font-mono text-xs",children:[i.map((f,l)=>u.jsx(Ng,{line:f},l)),m>0&&u.jsxs("div",{className:"px-5 py-0.5 font-display text-[10px] text-text-muted",children:["… 还有 ",m," 行未显示"]})]})]})}function Ng({line:e}){const t=e.type==="add"?"+":e.type==="remove"?"-":" ";return u.jsxs("div",{role:e.type==="context"?void 0:"listitem","aria-label":e.type==="add"?`新增行: ${e.text}`:e.type==="remove"?`删除行: ${e.text}`:void 0,className:ee("flex px-1 leading-relaxed",e.type==="add"&&"bg-green-500/10 text-green-700 dark:text-green-300",e.type==="remove"&&"bg-red-500/10 text-red-700 dark:text-red-300",e.type==="context"&&"text-text-secondary"),children:[u.jsx("span",{className:"w-4 flex-shrink-0 select-none text-center",children:t}),u.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words",children:e.text.length>0?e.text:" "})]})}function Es(e){return e.length===0?[]:e.split(`
227
+ `)}function _s(e,t){let n=0;for(const r of e)r.type===t&&n++;return n}function Ig(e,t){const n=Es(e),r=Es(t);let o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o++;let s=n.length,a=r.length;for(;s>o&&a>o&&n[s-1]===r[a-1];)s--,a--;const i=[];for(let m=0;m<o;m++)i.push({type:"context",text:n[m]});Mg(n.slice(o,s),r.slice(o,a),i);for(let m=s;m<n.length;m++)i.push({type:"context",text:n[m]});return i}function Mg(e,t,n){const r=e.length,o=t.length;if(r===0&&o===0)return;if(r*o>Rg){for(const f of e)n.push({type:"remove",text:f});for(const f of t)n.push({type:"add",text:f});return}const s=o+1,a=new Uint32Array((r+1)*s);for(let f=r-1;f>=0;f--)for(let l=o-1;l>=0;l--)a[f*s+l]=e[f]===t[l]?a[(f+1)*s+l+1]+1:Math.max(a[(f+1)*s+l],a[f*s+l+1]);let i=0,m=0;for(;i<r&&m<o;)e[i]===t[m]?(n.push({type:"context",text:e[i]}),i++,m++):a[(i+1)*s+m]>=a[i*s+m+1]?(n.push({type:"remove",text:e[i]}),i++):(n.push({type:"add",text:t[m]}),m++);for(;i<r;)n.push({type:"remove",text:e[i]}),i++;for(;m<o;)n.push({type:"add",text:t[m]}),m++}function vl({entries:e,onPermissionRespond:t}){const[n,r]=p.useState(!1);if(e.length===0)return null;if(e.length===1)return u.jsx("div",{className:"pl-10",children:u.jsx(As,{tool:e[0].toolCall,compact:!0,onPermissionRespond:t})});const o=Bg(e);return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-lg border border-border bg-surface-2/50 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-brand font-bold hover:bg-brand/10 transition-colors",onClick:()=>r(!n),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted",n&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs text-brand font-bold font-display",children:o})]}),n&&u.jsx("div",{className:"border-t border-border divide-y divide-border",children:e.map((s,a)=>u.jsx(As,{tool:s.toolCall,compact:!0,onPermissionRespond:t},s.toolCall.id||a))})]})})}function As({tool:e,compact:t,onPermissionRespond:n}){const[r,o]=p.useState(!t),s=(()=>{switch(e.status){case"running":return u.jsx("span",{className:"text-status-running text-[10px]",children:"▶"});case"complete":return u.jsx("span",{className:"text-status-active text-[10px]",children:"✓"});case"error":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});case"waiting_for_confirmation":return u.jsx("span",{className:"text-brand text-[10px]",children:"⍻"});case"canceled":return u.jsx("span",{className:"text-text-muted text-[10px]",children:"—"});case"rejected":return u.jsx("span",{className:"text-status-error text-[10px]",children:"✕"});default:return null}})(),a=Nn(e);return u.jsxs("div",{className:ee("px-3 py-2",t&&"py-1.5"),children:[u.jsxs("button",{type:"button",className:"flex w-full items-center gap-1.5 text-left group",onClick:()=>o(!r),children:[s,u.jsx("span",{className:"text-xs font-display font-bold text-brand transition-colors truncate",children:e.title}),e.status==="running"&&u.jsx("span",{className:"text-[10px] text-status-running animate-pulse",children:"running"})]}),e.status==="waiting_for_confirmation"&&e.permissionRequest&&u.jsx("div",{className:"mt-1.5 ml-4",children:u.jsx(Tg,{requestId:e.permissionRequest.requestId,options:e.permissionRequest.options,onRespond:n||(()=>{})})}),r&&u.jsx("div",{className:"mt-1.5 ml-4 space-y-1.5",children:Ug(e)??u.jsxs(u.Fragment,{children:[e.rawInput&&Object.keys(e.rawInput).length>0&&u.jsx("pre",{className:"text-[11px] bg-surface-1 rounded-md p-2 overflow-x-auto font-mono max-h-36 text-text-secondary",children:Et(JSON.stringify(e.rawInput,null,2),2e3)}),a&&u.jsx(In,{tool:e})]})})]})}const Pg=new Set(["FileEditTool","Edit","SedEdit"]),Og=new Set(["FileWriteTool","Write"]),Dg=new Set(["MultiEdit"]),Lg=new Set(["BashTool","Bash","PowerShellTool"]),Fg=["old_content","oldContent","old_string","oldString","old_text","oldText","previous_content","previousContent"],$g=["output","stdout","stderr","result"];function Ug(e){const t=Wg(e.title),n=e.rawInput??{};if(Pg.has(t)){const r=We(n,["old_string","oldString"]),o=We(n,["new_string","newString"]);return r===void 0||o===void 0?null:u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:We(n,["file_path","filePath"])??t,oldString:r,newString:o}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Og.has(t)){const r=We(n,["file_path","filePath"]),o=We(n,["content"]);if(r===void 0||o===void 0)return null;const s=We(e.rawOutput??{},Fg);return u.jsxs(u.Fragment,{children:[u.jsx(kr,{filePath:r,oldString:s??"",newString:o,label:s===void 0?"新文件":void 0}),Nn(e)&&u.jsx(In,{tool:e})]})}if(Dg.has(t)){const r=n.edits;if(Array.isArray(r)&&r.length>0){const o=We(n,["file_path","filePath"])??t,s=[];for(let a=0;a<r.length;a++){const i=r[a];if(!i||typeof i!="object"||Array.isArray(i))continue;const m=i,f=We(m,["old_string","oldString"]),l=We(m,["new_string","newString"]);f===void 0||l===void 0||s.push(u.jsx(kr,{filePath:o,oldString:f,newString:l,label:`#${a+1}`},a))}if(s.length>0)return u.jsxs(u.Fragment,{children:[s,Nn(e)&&u.jsx(In,{tool:e})]})}return null}if(Lg.has(t)){const r=We(n,["command","cmd","script"]),o=Gg(e);return r===void 0&&o.length===0?null:u.jsx(zg,{command:r!==void 0?Et(r,500):void 0,output:o,isError:e.status==="error"})}return null}function zg({command:e,output:t,isError:n}){return u.jsx("div",{className:ee("rounded-md border overflow-hidden",n?"border-status-error/50":"border-border"),children:u.jsxs("div",{className:"max-h-36 overflow-auto bg-zinc-900 px-2 py-1.5 font-mono text-xs text-zinc-300",children:[e&&u.jsxs("div",{className:"whitespace-pre-wrap break-words text-zinc-500",children:["$ ",e]}),t.length>0&&u.jsx("div",{className:"whitespace-pre-wrap break-words",children:t})]})})}function Bg(e){const t=new Map;for(const r of e){const o=Hg(r.toolCall.title);t.set(o,(t.get(o)||0)+1)}const n=[];for(const[r,o]of t)n.push(o===1?r:`${o} 次${r}`);return n.length===0?`${e.length} 个工具调用`:n.length===1?n[0]:`${e.length} 个工具: ${n.join("、")}`}function Hg(e){const t=e.match(/^(\w+)/);return t?t[1]:e}function Wg(e){const t=e.match(/^([\w-]+)/);return t?t[1]:e}function We(e,t){for(const n of t){const r=e[n];if(typeof r=="string")return r}}function Nn(e){return e.status!=="running"&&e.status!=="waiting_for_confirmation"&&!!(e.rawOutput||e.content)}function bl(e){return!e.content||e.content.length===0?[]:e.content.filter(t=>t.type==="content").filter(t=>t.content.type==="text"&&"text"in t.content).map(t=>t.content.text)}function Gg(e){const t=bl(e);if(t.length>0)return Et(t.join(`
228
+ `),2e3);const n=e.rawOutput;if(n){for(const r of $g){const o=n[r];if(typeof o=="string"&&o.length>0)return Et(o,2e3)}if(Object.keys(n).length>0)return Et(JSON.stringify(n,null,2),2e3)}return""}function In({tool:e}){return u.jsx("pre",{className:ee("text-[11px] rounded-md p-2 overflow-x-auto font-mono max-h-36",e.status==="error"?"bg-status-error/10 text-status-error":"bg-surface-1 text-text-secondary"),children:Vg(e)})}function Vg(e){const t=bl(e);return t.length>0?Et(t.join(`
229
+ `),2e3):e.rawOutput&&Object.keys(e.rawOutput).length>0?Et(JSON.stringify(e.rawOutput,null,2),2e3):""}function Et(e,t){return e.length>t?e.slice(0,t)+"...":e}function Kg({entry:e}){const[t,n]=p.useState(!1),{entries:r}=e;if(r.length===0)return null;const o=r.filter(i=>i.status==="completed").length,s=r.length,a=s>0?Math.round(o/s*100):0;return u.jsx("div",{className:"pl-10",children:u.jsxs("div",{className:"rounded-xl border border-border bg-brand/5 overflow-hidden",children:[u.jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2.5 text-sm hover:bg-surface-1/50 transition-colors",onClick:()=>n(!t),children:[u.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:ee("transition-transform text-text-muted flex-shrink-0",t&&"rotate-90"),children:u.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",fill:"none"})}),u.jsx("span",{className:"text-xs font-display font-medium text-text-secondary",children:"执行计划"}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[o,"/",s]}),u.jsx("div",{className:"flex-1 h-1 rounded-full bg-surface-1 overflow-hidden ml-1 mr-2",children:u.jsx("div",{className:"h-full rounded-full bg-brand/70 transition-all duration-500",style:{width:`${a}%`}})}),u.jsxs("span",{className:"text-[10px] text-text-muted font-mono",children:[a,"%"]})]}),!t&&u.jsx("div",{className:ee("border-t border-border px-3 py-1.5 space-y-0.5",s>5&&"max-h-64 overflow-y-auto"),children:r.map((i,m)=>u.jsx(qg,{entry:i},m))})]})})}function qg({entry:e}){return u.jsxs("div",{className:"flex items-start gap-2 py-1.5 px-1",children:[u.jsx("span",{className:"flex-shrink-0 mt-0.5",children:u.jsx(Yg,{status:e.status})}),u.jsx("span",{className:ee("text-xs leading-relaxed flex-1",e.status==="completed"?"text-text-muted line-through":"text-text-secondary",e.status==="in_progress"&&"text-text-primary font-medium"),children:e.content}),u.jsx(Xg,{priority:e.priority})]})}function Yg({status:e}){switch(e){case"completed":return u.jsx(ku,{className:"h-3.5 w-3.5 text-status-active"});case"in_progress":return u.jsx(ua,{className:"h-3.5 w-3.5 text-brand animate-spin",style:{animationDuration:"2s"}});case"pending":return u.jsx(_u,{className:"h-3.5 w-3.5 text-text-muted"})}}function Xg({priority:e}){const t={high:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",medium:"bg-brand/10 text-brand dark:bg-brand/20",low:"bg-surface-1 text-text-muted"},n={high:"高",medium:"中",low:"低"};return u.jsx("span",{className:ee("text-[9px] font-display rounded-full px-1.5 py-0.5 flex-shrink-0 leading-none",t[e]),children:n[e]})}function Qg({entry:e}){const t=e.variant==="error";return u.jsxs("div",{className:"w-full",children:[u.jsx("div",{className:ee("border-t-2",t?"border-status-error":"border-border")}),u.jsxs("div",{className:"pt-3",children:[u.jsx("h3",{className:ee("font-bold font-display text-base",t?"text-status-error":"text-brand"),children:e.title}),e.subtitle&&u.jsx("p",{className:"text-sm text-text-muted mt-0.5",children:e.subtitle})]}),u.jsx("div",{className:"py-3 message-content text-text-primary leading-[1.75]",children:u.jsx(Ro,{children:e.outputText})}),u.jsx("div",{className:"pb-1 text-xs text-text-muted italic",children:"命令已执行 · 输入消息继续"})]})}/*!---------------------------------------------------------------------------------------------
230
230
  * Copyright (c) StackBlitz. All rights reserved.
231
231
  * Licensed under the MIT License. See License.txt in the project root for license information.
232
- *--------------------------------------------------------------------------------------------*/const Zg={damping:.7,stiffness:.05,mass:1.25},Jg=70,ex=1e3/60,tx=350;let ir=!1;var Bs;(Bs=globalThis.document)==null||Bs.addEventListener("mousedown",()=>{ir=!0});var Hs;(Hs=globalThis.document)==null||Hs.addEventListener("mouseup",()=>{ir=!1});var Ws;(Ws=globalThis.document)==null||Ws.addEventListener("click",()=>{ir=!1});const nx=(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 E;if(!ir)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const A=_.getRangeAt(0);return A.commonAncestorContainer.contains(C.current)||((E=C.current)==null?void 0:E.contains(A.commonAncestorContainer))},[]),f=p.useCallback(_=>{c.isAtBottom=_,r(_)},[]),l=p.useCallback(_=>{c.escapedFromLock=_,n(_)},[]),c=p.useMemo(()=>{let _;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:E}=getComputedStyle(C.current);E!=="auto"&&(C.current.style.scrollBehavior="auto"),C.current.scrollTop=A,c.ignoreScrollToTop=C.current.scrollTop,E!=="auto"&&(C.current.style.scrollBehavior=E)}},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((_==null?void 0:_.targetScrollTop)===A)return _.calculatedScrollTop;const E=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:C.current,contentElement:b.current}),A),0);return _={targetScrollTop:A,calculatedScrollTop:E},requestAnimationFrame(()=>{_=void 0}),E},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Jg}}},[]),d=p.useCallback((_={})=>{var y;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||f(!0);const A=Date.now()+(Number(_.wait)||0),E=_r(i.current,_.animation),{ignoreEscapes:L=!1}=_;let k,j=c.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{k=Date.now()}):k=A+(_.duration??0);const x=async()=>{const T=new Promise(requestAnimationFrame).then(()=>{var I;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:M}=c,O=performance.now(),F=(O-(c.lastTick??O))/ex;if(c.animation||(c.animation={behavior:E,promise:T,ignoreEscapes:L}),c.animation.behavior===E&&(c.lastTick=O),m()||A>Date.now())return x();if(M<Math.min(j,c.calculatedTargetScrollTop)){if(((I=c.animation)==null?void 0:I.behavior)===E){if(E==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(E.damping*c.velocity+E.stiffness*c.scrollDifference)/E.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==M&&(c.accumulated=0)}return x()}return k>Date.now()?(j=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:_r(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,k-Date.now())||void 0}):c.isAtBottom)});return T.then(M=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),M))};return _.wait!==!0&&(c.animation=void 0),((y=c.animation)==null?void 0:y.behavior)===E?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:_})=>{if(_!==C.current)return;const{scrollTop:A,ignoreScrollToTop:E}=c;let{lastScrollTop:L=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,E&&E>A&&(L=E),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||A===E)return;if(m()){l(!0),f(!1);return}const k=A>L,j=A<L;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=L;return}j&&(l(!0),f(!1)),k&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:_,deltaY:A})=>{var L;let E=_;for(;!["scroll","auto"].includes(getComputedStyle(E).overflow);){if(!E.parentElement)return;E=E.parentElement}E===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(_=>{var A,E;(A=C.current)==null||A.removeEventListener("scroll",g),(E=C.current)==null||E.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),b=js(_=>{var E,L;if((E=c.resizeObserver)==null||E.disconnect(),!_)return;let A;c.resizeObserver=new ResizeObserver(([k])=>{const{height:j}=k.contentRect,x=j-(A??j);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const y=_r(i.current,A?i.current.resize:i.current.initial);d({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:tx})}else c.isNearBottom&&(l(!1),f(!0));A=j,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(L=c.resizeObserver)==null||L.observe(_)},[]);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 Er=new Map;function _r(...e){const t={...Zg};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 Er.has(o)||Er.set(o,Object.freeze(t)),n?"instant":Er.get(o)}/*!---------------------------------------------------------------------------------------------
232
+ *--------------------------------------------------------------------------------------------*/const Zg={damping:.7,stiffness:.05,mass:1.25},Jg=70,ex=1e3/60,tx=350;let ir=!1;var Bs;(Bs=globalThis.document)==null||Bs.addEventListener("mousedown",()=>{ir=!0});var Hs;(Hs=globalThis.document)==null||Hs.addEventListener("mouseup",()=>{ir=!1});var Ws;(Ws=globalThis.document)==null||Ws.addEventListener("click",()=>{ir=!1});const nx=(e={})=>{const[t,n]=p.useState(!1),[r,o]=p.useState(e.initial!==!1),[s,a]=p.useState(!1),i=p.useRef(null);i.current=e;const m=p.useCallback(()=>{var E;if(!ir)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const A=_.getRangeAt(0);return A.commonAncestorContainer.contains(C.current)||((E=C.current)==null?void 0:E.contains(A.commonAncestorContainer))},[]),f=p.useCallback(_=>{c.isAtBottom=_,o(_)},[]),l=p.useCallback(_=>{c.escapedFromLock=_,n(_)},[]),c=p.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:r,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:E}=getComputedStyle(C.current);E!=="auto"&&(C.current.style.scrollBehavior="auto"),C.current.scrollTop=A,c.ignoreScrollToTop=C.current.scrollTop,E!=="auto"&&(C.current.style.scrollBehavior=E)}},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((_==null?void 0:_.targetScrollTop)===A)return _.calculatedScrollTop;const E=Math.max(Math.min(e.targetScrollTop(A,{scrollElement:C.current,contentElement:b.current}),A),0);return _={targetScrollTop:A,calculatedScrollTop:E},requestAnimationFrame(()=>{_=void 0}),E},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Jg}}},[]),d=p.useCallback((_={})=>{var y;typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||f(!0);const A=Date.now()+(Number(_.wait)||0),E=_r(i.current,_.animation),{ignoreEscapes:L=!1}=_;let k,j=c.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{k=Date.now()}):k=A+(_.duration??0);const x=async()=>{const T=new Promise(requestAnimationFrame).then(()=>{var I;if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:M}=c,O=performance.now(),F=(O-(c.lastTick??O))/ex;if(c.animation||(c.animation={behavior:E,promise:T,ignoreEscapes:L}),c.animation.behavior===E&&(c.lastTick=O),m()||A>Date.now())return x();if(M<Math.min(j,c.calculatedTargetScrollTop)){if(((I=c.animation)==null?void 0:I.behavior)===E){if(E==="instant")return c.scrollTop=c.calculatedTargetScrollTop,x();c.velocity=(E.damping*c.velocity+E.stiffness*c.scrollDifference)/E.mass,c.accumulated+=c.velocity*F,c.scrollTop+=c.accumulated,c.scrollTop!==M&&(c.accumulated=0)}return x()}return k>Date.now()?(j=c.calculatedTargetScrollTop,x()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?d({animation:_r(i.current,i.current.resize),ignoreEscapes:L,duration:Math.max(0,k-Date.now())||void 0}):c.isAtBottom)});return T.then(M=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),M))};return _.wait!==!0&&(c.animation=void 0),((y=c.animation)==null?void 0:y.behavior)===E?c.animation.promise:x()},[f,m,c]),h=p.useCallback(()=>{l(!0),f(!1)},[l,f]),g=p.useCallback(({target:_})=>{if(_!==C.current)return;const{scrollTop:A,ignoreScrollToTop:E}=c;let{lastScrollTop:L=A}=c;c.lastScrollTop=A,c.ignoreScrollToTop=void 0,E&&E>A&&(L=E),a(c.isNearBottom),setTimeout(()=>{var x;if(c.resizeDifference||A===E)return;if(m()){l(!0),f(!1);return}const k=A>L,j=A<L;if((x=c.animation)!=null&&x.ignoreEscapes){c.scrollTop=L;return}j&&(l(!0),f(!1)),k&&l(!1),!c.escapedFromLock&&c.isNearBottom&&f(!0)},1)},[l,f,m,c]),v=p.useCallback(({target:_,deltaY:A})=>{var L;let E=_;for(;!["scroll","auto"].includes(getComputedStyle(E).overflow);){if(!E.parentElement)return;E=E.parentElement}E===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(_=>{var A,E;(A=C.current)==null||A.removeEventListener("scroll",g),(E=C.current)==null||E.removeEventListener("wheel",v),_==null||_.addEventListener("scroll",g,{passive:!0}),_==null||_.addEventListener("wheel",v,{passive:!0})},[]),b=js(_=>{var E,L;if((E=c.resizeObserver)==null||E.disconnect(),!_)return;let A;c.resizeObserver=new ResizeObserver(([k])=>{const{height:j}=k.contentRect,x=j-(A??j);if(c.resizeDifference=x,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),a(c.isNearBottom),x>=0){const y=_r(i.current,A?i.current.resize:i.current.initial);d({animation:y,wait:!0,preserveScrollPosition:!0,duration:y==="instant"?void 0:tx})}else c.isNearBottom&&(l(!1),f(!0));A=j,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===x&&(c.resizeDifference=0)},1)})}),(L=c.resizeObserver)==null||L.observe(_)},[]);return{contentRef:b,scrollRef:C,scrollToBottom:d,stopScroll:h,isAtBottom:r||s,isNearBottom:s,escapedFromLock:t,state:c}};function js(e,t){const n=p.useCallback(r=>(n.current=r,e(r)),t);return n}const Er=new Map;function _r(...e){const t={...Zg};let n=!1;for(const o of e){if(o==="instant"){n=!0;continue}typeof o=="object"&&(n=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const r=JSON.stringify(t);return Er.has(r)||Er.set(r,Object.freeze(t)),n?"instant":Er.get(r)}/*!---------------------------------------------------------------------------------------------
233
233
  * Copyright (c) StackBlitz. All rights reserved.
234
234
  * Licensed under the MIT License. See License.txt in the project root for license information.
235
- *--------------------------------------------------------------------------------------------*/const yl=p.createContext(null),rx=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,k)=>{const j=(E==null?void 0:E.targetScrollTop)??i;return(j==null?void 0:j(L,k))??L},[i]),d=nx({mass:r,damping:s,stiffness:a,resize:n,initial:o,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:C,isAtBottom:b,escapedFromLock:_,state:A}=e??d,E=p.useMemo(()=>({scrollToBottom:v,stopScroll:C,scrollRef:h,isAtBottom:b,escapedFromLock:_,contentRef:g,state:A,get targetScrollTop(){return l.current},set targetScrollTop(L){l.current=L}}),[v,b,g,h,C,_,A]);return p.useImperativeHandle(m,()=>E,[E]),rx(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(yl.Provider,{value:E},p.createElement("div",{...f},typeof t=="function"?t(E):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(yl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const ox=({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}),sx=({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}),ax=({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})]})]})}),ix=({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(hu,{className:"size-4"})})},lx="data-last-user-message",cx=({className:e,...t})=>{const n=p.useCallback(()=>{const o=document.querySelector(`[${lx}="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(ha,{className:"size-4"})})},ux=({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(cx,{}),u.jsx(ix,{})]})};function dx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:o="开始对话",emptyDescription:r="输入消息开始聊天"}){var f;const s=px(e),a=e.length>0;let i=-1;for(let l=s.length-1;l>=0;l--){const c=s[l];if(c.type==="single"&&c.entry.type==="user_message"){i=l;break}}const m=t&&e.length>0&&((f=e[e.length-1])==null?void 0:f.type)==="user_message";return u.jsx(ox,{className:"flex-1",children:u.jsxs(sx,{children:[a?u.jsxs(u.Fragment,{children:[s.map((l,c)=>{if(l.type==="single"){const d=l.entry.type==="user_message"&&c===i;return u.jsx("div",{"data-last-user-message":d?"true":void 0,className:ee(fx(e,c)),children:u.jsx(mx,{entry:l.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`)}return u.jsx("div",{className:"-mt-2",children:u.jsx(vl,{entries:l.entries,onPermissionRespond:n})},`group-${c}`)}),m&&u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(ax,{title:o,description:r}),u.jsx(ux,{hasUserMessages:e.some(l=>l.type==="user_message")})]})})}function fx(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 mx({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(Cg,{entry:e});case"assistant_message":return u.jsx(Sg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(vl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(Kg,{entry:e});case"command_output":return u.jsx(Qg,{entry:e});default:return null}}function px(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 hx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function gx({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=>hx(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 kt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const xx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},vx=500*1024,wl=2*1024*1024,Ar=200,Ts=5*1024*1024,bx=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"]),yx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Cl(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return bx.has(t)}function qr(e){const t=cn(e.name);return yx.has(t)}function wx({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,_]=p.useState([]),[A,E]=p.useState([]),[L,k]=p.useState(!1),[j,x]=p.useState(""),[y,T]=p.useState(!1),[M,O]=p.useState(!1),[F,I]=p.useState(!1),[z,S]=p.useState(null),[w,B]=p.useState([]),[P,U]=p.useState(0),q=p.useRef(0),N=p.useRef(null),D=p.useRef(null),$=p.useRef(null),R=p.useRef(null),H=p.useRef(null),G=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{kt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!M)return;const W=Y=>{var le,xe;const J=Y.target,ce=(le=G.current)==null?void 0:le.contains(J),Se=(xe=K.current)==null?void 0:xe.contains(J);!ce&&!Se&&O(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[M]);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(""),_([]),E([]),k(!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||z===null)return;const J=Y.selectionStart??v.length,ce=v.slice(0,J),Se=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Se)return;const le=J-Se[1].length-1,xe=`@${W} `,Xe=v.slice(0,le)+xe+v.slice(J);C(Xe),S(null),B([]),requestAnimationFrame(()=>{const Mt=le+xe.length;Y.focus(),Y.setSelectionRange(Mt,Mt)})},[v,z]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(z!==null&&w.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),U(J=>{const ce=W.key==="ArrowDown"?1:-1;return(J+ce+w.length)%w.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const J=w[P];J&&Z(J);return}if(W.key==="Escape"){W.preventDefault(),S(null),B([]);return}}if(L){if(W.key==="Escape"){W.preventDefault(),k(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),k(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():V())},[V,t,f,m,n,L,z,w,P,Z]),ue=p.useCallback(W=>{const Y=W.target.value;if(C(Y),Y.startsWith("/")&&i&&i.length>0?(k(!0),x(Y.slice(1).split(/\s/)[0]||"")):L&&(k(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Se=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(le){const xe=le[1]||"";S(xe),U(0),ne(xe)}else S(null),B([])}const J=W.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,L,d,ne]),be=p.useCallback(async W=>{if(kt("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(kt("[ChatInput] paste image files",{count:Y.length,types:Y.map(J=>J.type)}),Y.length!==0){W.preventDefault(),I(!0);try{const J=await jr(Y);_(ce=>[...ce,...J])}finally{I(!1)}}},[g]),de=p.useCallback(async()=>{if(!D.current)return;const W=D.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await jr(Array.from(W));_(J=>[...J,...Y])}finally{D.current.value="",I(!1)}}},[]),ye=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Rs(Array.from(W));E(J=>[...J,...Y])}finally{$.current.value="",I(!1)}}},[]),fe=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Ns(Array.from(W));E(J=>[...J,...Y])}finally{R.current.value="",I(!1)}}},[]),ie=p.useCallback(async()=>{if(!H.current)return;const W=H.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Sx(Array.from(W));Y&&E(J=>[...J,Y])}finally{H.current.value="",I(!1)}}},[]),ge=p.useCallback(W=>{_(Y=>Y.filter((J,ce)=>ce!==W))},[]),we=p.useCallback(W=>{E(Y=>Y.filter((J,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var J,ce;k(!1),x("");const Y=`/${W.name}`;(J=W.input)!=null&&J.hint?(C(`${Y} `),(ce=N.current)==null||ce.focus()):V(Y)},[V]),_e=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||T(!0))},[g,y]),Ce=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&T(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),T(!1),I(!0);try{const J=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Se=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&Cl(le));if(J.length>0){const le=await jr(J);_(xe=>[...xe,...le])}if(ce.length>0){const le=await Ns(ce);E(xe=>[...xe,...le])}if(Se.length>0){const le=await Rs(Se);E(xe=>[...xe,...le])}}finally{I(!1)}}},[g]),Te=p.useCallback(()=>{var W;L?(k(!1),x("")):(v.startsWith("/")||C("/"+v),k(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[L,v]),Be=b.length+A.length,xt=(v.trim()||Be>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(gx,{commands:i,filter:j,onSelect:me,onClose:()=>{k(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),z!==null&&w.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",z?`“@${z}”`:""," — ↑↓ 选择,Enter 插入"]}),w.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:J=>{J.preventDefault(),Z(W)},onMouseEnter:()=>U(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===P?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Bt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),M&&g&&u.jsxs("div",{ref:G,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=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(Pu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Bt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(ro,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=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:_e,onDragLeave:Ce,onDrop:pe,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",y&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:b.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>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(Cx,{attachment:W,onRemove:()=>we(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[g&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:K,type:"button",onClick:()=>O(W=>!W),disabled:o||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",M?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Xu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref: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:ye}),u.jsx("input",{ref:R,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(ud,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:be,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(fd,{className:"h-3.5 w-3.5",fill:"currentColor"}):F?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(rd,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(ju,{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 Cx({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 je(n,xx),r="image/jpeg");const s=await kx(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>wl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>vx&&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 Sl(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 Sl(e){const t=await Ae(()=>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}
235
+ *--------------------------------------------------------------------------------------------*/const yl=p.createContext(null),rx=typeof window<"u"?p.useLayoutEffect:p.useEffect;function Vn({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:a,targetScrollTop:i,contextRef:m,...f}){const l=p.useRef(null),c=p.useCallback((L,k)=>{const j=(E==null?void 0:E.targetScrollTop)??i;return(j==null?void 0:j(L,k))??L},[i]),d=nx({mass:o,damping:s,stiffness:a,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:g,scrollToBottom:v,stopScroll:C,isAtBottom:b,escapedFromLock:_,state:A}=e??d,E=p.useMemo(()=>({scrollToBottom:v,stopScroll:C,scrollRef:h,isAtBottom:b,escapedFromLock:_,contentRef:g,state:A,get targetScrollTop(){return l.current},set targetScrollTop(L){l.current=L}}),[v,b,g,h,C,_,A]);return p.useImperativeHandle(m,()=>E,[E]),rx(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),p.createElement(yl.Provider,{value:E},p.createElement("div",{...f},typeof t=="function"?t(E):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Po();return p.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},p.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Vn||(Vn={}));function Po(){const e=p.useContext(yl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const ox=({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}),sx=({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}),ax=({className:e,title:t="No messages yet",description:n="Start a conversation to see messages here",icon:r,children:o,...s})=>u.jsx("div",{className:ee("flex size-full flex-col items-center justify-center gap-4 p-8 text-center",e),...s,children:o??u.jsxs(u.Fragment,{children:[r&&u.jsx("div",{className:"text-text-muted",children:r}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"font-semibold text-base font-display text-text-primary",children:t}),n&&u.jsx("p",{className:"text-text-muted text-sm leading-relaxed max-w-xs",children:n})]})]})}),ix=({className:e,...t})=>{const{scrollToBottom:n}=Po(),r=p.useCallback(()=>{n()},[n]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:r,size:"icon",type:"button",variant:"outline",title:"Scroll to bottom",...t,children:u.jsx(hu,{className:"size-4"})})},lx="data-last-user-message",cx=({className:e,...t})=>{const n=p.useCallback(()=>{const r=document.querySelector(`[${lx}="true"]`);r&&r.scrollIntoView({behavior:"smooth",block:"start"})},[]);return u.jsx(Rt,{className:ee("rounded-full",e),onClick:n,size:"icon",type:"button",variant:"outline",title:"Scroll to last user message",...t,children:u.jsx(ha,{className:"size-4"})})},ux=({className:e,hasUserMessages:t=!1,...n})=>{const{isAtBottom:r}=Po();return r?null:u.jsxs("div",{className:ee("absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-2",e),...n,children:[t&&u.jsx(cx,{}),u.jsx(ix,{})]})};function dx({entries:e,isLoading:t=!1,onPermissionRespond:n,emptyTitle:r="开始对话",emptyDescription:o="输入消息开始聊天"}){var f;const s=px(e),a=e.length>0;let i=-1;for(let l=s.length-1;l>=0;l--){const c=s[l];if(c.type==="single"&&c.entry.type==="user_message"){i=l;break}}const m=t&&e.length>0&&((f=e[e.length-1])==null?void 0:f.type)==="user_message";return u.jsx(ox,{className:"flex-1",children:u.jsxs(sx,{children:[a?u.jsxs(u.Fragment,{children:[s.map((l,c)=>{if(l.type==="single"){const d=l.entry.type==="user_message"&&c===i;return u.jsx("div",{"data-last-user-message":d?"true":void 0,className:ee(fx(e,c)),children:u.jsx(mx,{entry:l.entry,isLoading:t,onPermissionRespond:n})},`entry-${c}`)}return u.jsx("div",{className:"-mt-2",children:u.jsx(vl,{entries:l.entries,onPermissionRespond:n})},`group-${c}`)}),m&&u.jsxs("div",{className:"flex gap-4 items-start",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-brand/8 flex items-center justify-center flex-shrink-0 overflow-hidden",children:u.jsx("img",{src:"/code/pony.svg",alt:"Saluzi",width:28,height:28,className:"object-contain",draggable:!1})}),u.jsx("div",{className:"flex items-center gap-1 pt-2",children:u.jsxs("span",{className:"chat-typing-indicator","aria-hidden":"true",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]})})]})]}):u.jsx(ax,{title:r,description:o}),u.jsx(ux,{hasUserMessages:e.some(l=>l.type==="user_message")})]})})}function fx(e,t){const n=e[t];if((n==null?void 0:n.type)==="user_message")return"pt-10 pb-3";if((n==null?void 0:n.type)==="assistant_message"){const r=e[t+1];return(r==null?void 0:r.type)==="tool_call"?"pt-3 pb-1":"pt-3 pb-8"}return(n==null?void 0:n.type)==="plan"?"pt-3 pb-3":(n==null?void 0:n.type)==="command_output"?"pt-6 pb-3":"py-2"}function mx({entry:e,isLoading:t,onPermissionRespond:n}){switch(e.type){case"user_message":return u.jsx(Cg,{entry:e});case"assistant_message":return u.jsx(Sg,{entry:e,isStreaming:t});case"tool_call":return u.jsx(vl,{entries:[e],onPermissionRespond:n});case"plan":return u.jsx(Kg,{entry:e});case"command_output":return u.jsx(Qg,{entry:e});default:return null}}function px(e){const t=[];let n=[];const r=()=>{n.length===1?t.push({type:"single",entry:n[0]}):n.length>1&&t.push({type:"tool_group",entries:n}),n=[]};for(const o of e)o.type==="tool_call"?n.push(o):(r(),t.push({type:"single",entry:o}));return r(),t}function hx(e,t){return e?t.toLowerCase().startsWith(e.toLowerCase()):!0}function gx({commands:e,filter:t,onSelect:n,onClose:r,className:o}){const s=p.useRef(null),[a,i]=p.useState(0),m=p.useMemo(()=>t?e.filter(f=>hx(t,f.name)):e,[e,t]);return p.useEffect(()=>{i(0)},[t]),p.useEffect(()=>{const f=l=>{s.current&&!s.current.contains(l.target)&&r()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),p.useEffect(()=>{const f=l=>{if(m.length!==0){if(l.key==="ArrowDown")l.preventDefault(),i(c=>(c+1)%m.length);else if(l.key==="ArrowUp")l.preventDefault(),i(c=>(c-1+m.length)%m.length);else if(l.key==="Enter"&&!l.shiftKey){l.preventDefault();const c=m[a];c&&n(c)}}};return document.addEventListener("keydown",f,!0),()=>document.removeEventListener("keydown",f,!0)},[m,a,n]),p.useEffect(()=>{const f=s.current;if(!f)return;const l=f.querySelector("[data-active='true']");l==null||l.scrollIntoView({block:"nearest"})},[a]),u.jsx("div",{ref:s,className:ee("rounded-xl border border-border bg-surface-2 shadow-lg",o),children:u.jsx("div",{className:"max-h-[320px] overflow-y-auto py-1",children:m.length===0?u.jsx("div",{className:"text-xs text-text-muted font-display py-3 text-center",children:"没有匹配的命令"}):m.map((f,l)=>{var c;return u.jsxs("button",{type:"button","data-active":l===a,onClick:()=>n(f),onMouseEnter:()=>i(l),className:ee("flex w-full items-center gap-2 px-3 py-2 cursor-pointer rounded-lg mx-1 text-left","transition-colors",l===a?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1/50"),style:{width:"calc(100% - 8px)"},children:[u.jsxs("span",{className:"text-sm font-display font-medium text-brand",children:["/",f.name]}),u.jsx("span",{className:"text-xs text-text-muted truncate flex-1",children:f.description}),((c=f.input)==null?void 0:c.hint)&&u.jsx("span",{className:"text-[10px] text-text-muted italic",children:f.input.hint})]},f.name)})})})}function kt(e,t){const n=t===void 0?e:`${e}: ${JSON.stringify(t)}`;console.log(n);try{fetch("/code/__debug__",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({label:e,data:t??null})})}catch{}}const xx={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"},vx=500*1024,wl=2*1024*1024,Ar=200,Ts=5*1024*1024,bx=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"]),yx=new Set([".csv",".tsv",".xlsx",".xls"]);function cn(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t).toLowerCase():""}function Cl(e){if(e.type.startsWith("text/"))return!0;const t=cn(e.name);return bx.has(t)}function qr(e){const t=cn(e.name);return yx.has(t)}function wx({onSubmit:e,isLoading:t=!1,onInterrupt:n,disabled:r=!1,placeholder:o="给 Saluzi 发送消息…",supportsAttachments:s,supportsImages:a,commands:i,onCycleMode:m,queueWhileLoading:f,queuedCount:l,onDequeue:c,onSearchFiles:d,className:h}){const g=s??a??!1,[v,C]=p.useState(""),[b,_]=p.useState([]),[A,E]=p.useState([]),[L,k]=p.useState(!1),[j,x]=p.useState(""),[y,T]=p.useState(!1),[M,O]=p.useState(!1),[F,I]=p.useState(!1),[z,S]=p.useState(null),[w,B]=p.useState([]),[P,U]=p.useState(0),q=p.useRef(0),N=p.useRef(null),D=p.useRef(null),$=p.useRef(null),R=p.useRef(null),H=p.useRef(null),G=p.useRef(null),K=p.useRef(null);p.useEffect(()=>{kt("[ChatInput] mount/supportsAttachments change",{supportsAttachments:g,commandsCount:(i==null?void 0:i.length)??0})},[g,i]),p.useEffect(()=>{if(!M)return;const W=Y=>{var le,ve;const J=Y.target,ce=(le=G.current)==null?void 0:le.contains(J),Se=(ve=K.current)==null?void 0:ve.contains(J);!ce&&!Se&&O(!1)};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[M]);const V=p.useCallback(W=>{const Y=(W??v).trim(),J=b.length>0||A.length>0;!Y&&!J||r||F||(e({text:Y,images:b.length>0?b:void 0,attachments:A.length>0?A:void 0}),C(""),_([]),E([]),k(!1),x(""),N.current&&(N.current.style.height="auto"))},[v,b,A,r,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||z===null)return;const J=Y.selectionStart??v.length,ce=v.slice(0,J),Se=/(?:^|\s)@([^\s@]*)$/.exec(ce);if(!Se)return;const le=J-Se[1].length-1,ve=`@${W} `,Xe=v.slice(0,le)+ve+v.slice(J);C(Xe),S(null),B([]),requestAnimationFrame(()=>{const Mt=le+ve.length;Y.focus(),Y.setSelectionRange(Mt,Mt)})},[v,z]),re=p.useCallback(W=>{if(W.key==="Tab"&&W.shiftKey&&m){W.preventDefault(),m();return}if(z!==null&&w.length>0){if(W.key==="ArrowDown"||W.key==="ArrowUp"){W.preventDefault(),U(J=>{const ce=W.key==="ArrowDown"?1:-1;return(J+ce+w.length)%w.length});return}if((W.key==="Enter"||W.key==="Tab")&&!W.shiftKey&&!W.nativeEvent.isComposing){W.preventDefault();const J=w[P];J&&Z(J);return}if(W.key==="Escape"){W.preventDefault(),S(null),B([]);return}}if(L){if(W.key==="Escape"){W.preventDefault(),k(!1);return}if(W.key==="ArrowUp"||W.key==="ArrowDown"||W.key==="Enter"){W.preventDefault();return}if(W.key==="Tab"){W.preventDefault(),k(!1);return}}W.key==="Enter"&&!W.shiftKey&&!W.nativeEvent.isComposing&&(W.preventDefault(),t&&!f?n==null||n():V())},[V,t,f,m,n,L,z,w,P,Z]),ue=p.useCallback(W=>{const Y=W.target.value;if(C(Y),Y.startsWith("/")&&i&&i.length>0?(k(!0),x(Y.slice(1).split(/\s/)[0]||"")):L&&(k(!1),x("")),d){const ce=W.target.selectionStart??Y.length,Se=Y.slice(0,ce),le=/(?:^|\s)@([^\s@]*)$/.exec(Se);if(le){const ve=le[1]||"";S(ve),U(0),ne(ve)}else S(null),B([])}const J=W.target;J.style.height="auto",J.style.height=Math.min(J.scrollHeight,200)+"px"},[i,L,d,ne]),be=p.useCallback(async W=>{if(kt("[ChatInput] paste event",{canAttach:g,files:W.clipboardData.files.length,types:W.clipboardData.types}),!g)return;const Y=Array.from(W.clipboardData.files).filter(J=>J.type.startsWith("image/"));if(kt("[ChatInput] paste image files",{count:Y.length,types:Y.map(J=>J.type)}),Y.length!==0){W.preventDefault(),I(!0);try{const J=await jr(Y);_(ce=>[...ce,...J])}finally{I(!1)}}},[g]),de=p.useCallback(async()=>{if(!D.current)return;const W=D.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await jr(Array.from(W));_(J=>[...J,...Y])}finally{D.current.value="",I(!1)}}},[]),ye=p.useCallback(async()=>{if(!$.current)return;const W=$.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Rs(Array.from(W));E(J=>[...J,...Y])}finally{$.current.value="",I(!1)}}},[]),fe=p.useCallback(async()=>{if(!R.current)return;const W=R.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Ns(Array.from(W));E(J=>[...J,...Y])}finally{R.current.value="",I(!1)}}},[]),ie=p.useCallback(async()=>{if(!H.current)return;const W=H.current.files;if(!(!W||W.length===0)){I(!0);try{const Y=await Sx(Array.from(W));Y&&E(J=>[...J,Y])}finally{H.current.value="",I(!1)}}},[]),ge=p.useCallback(W=>{_(Y=>Y.filter((J,ce)=>ce!==W))},[]),we=p.useCallback(W=>{E(Y=>Y.filter((J,ce)=>ce!==W))},[]),me=p.useCallback(W=>{var J,ce;k(!1),x("");const Y=`/${W.name}`;(J=W.input)!=null&&J.hint?(C(`${Y} `),(ce=N.current)==null||ce.focus()):V(Y)},[V]),_e=p.useCallback(W=>{g&&Array.from(W.dataTransfer.types).includes("Files")&&(W.preventDefault(),W.dataTransfer.dropEffect="copy",y||T(!0))},[g,y]),Ce=p.useCallback(W=>{const Y=W.relatedTarget;(!Y||!W.currentTarget.contains(Y))&&T(!1)},[]),pe=p.useCallback(async W=>{if(!g)return;const Y=Array.from(W.dataTransfer.files);if(Y.length!==0){W.preventDefault(),T(!1),I(!0);try{const J=Y.filter(le=>le.type.startsWith("image/")),ce=Y.filter(le=>!le.type.startsWith("image/")&&qr(le)),Se=Y.filter(le=>!le.type.startsWith("image/")&&!qr(le)&&Cl(le));if(J.length>0){const le=await jr(J);_(ve=>[...ve,...le])}if(ce.length>0){const le=await Ns(ce);E(ve=>[...ve,...le])}if(Se.length>0){const le=await Rs(Se);E(ve=>[...ve,...le])}}finally{I(!1)}}},[g]),Te=p.useCallback(()=>{var W;L?(k(!1),x("")):(v.startsWith("/")||C("/"+v),k(!0),x(v.startsWith("/")&&v.slice(1).split(/\s/)[0]||""),(W=N.current)==null||W.focus())},[L,v]),Be=b.length+A.length,xt=(v.trim()||Be>0)&&!r&&!F;return u.jsxs("div",{className:ee("w-full max-w-3xl mx-auto px-4 sm:px-8 pb-4 pt-2",h),children:[u.jsxs("div",{className:"relative",children:[L&&i&&i.length>0&&u.jsx(gx,{commands:i,filter:j,onSelect:me,onClose:()=>{k(!1),x("")},className:"absolute bottom-full left-0 right-0 mb-1 z-50"}),z!==null&&w.length>0&&u.jsxs("div",{className:"absolute bottom-full left-0 right-0 mb-1 z-50 overflow-hidden rounded-lg border border-border bg-surface-2 shadow-lg",children:[u.jsxs("div",{className:"border-b border-border px-3 py-1.5 text-[11px] text-text-muted",children:["文件匹配 ",z?`“@${z}”`:""," — ↑↓ 选择,Enter 插入"]}),w.map((W,Y)=>u.jsxs("button",{type:"button",onMouseDown:J=>{J.preventDefault(),Z(W)},onMouseEnter:()=>U(Y),className:ee("flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors",Y===P?"bg-brand/10 text-text-primary":"text-text-secondary hover:bg-surface-1"),children:[u.jsx(Bt,{className:"h-3.5 w-3.5 flex-shrink-0 text-text-muted"}),u.jsx("span",{className:"truncate font-mono",children:W})]},W))]}),M&&g&&u.jsxs("div",{ref:G,className:"absolute bottom-full left-3 mb-2 min-w-[180px] rounded-lg border border-border bg-surface-2 shadow-lg py-1 z-50",children:[u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=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(Pu,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"图片"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=$.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(Bt,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"文本文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=R.current)==null||W.click()},className:"w-full flex items-center gap-2.5 px-3 py-2 text-sm text-text-primary hover:bg-surface-1 transition-colors text-left",children:[u.jsx(ro,{className:"h-4 w-4 text-text-muted flex-shrink-0"}),u.jsx("span",{children:"表格文件"})]}),u.jsxs("button",{type:"button",onClick:()=>{var W;O(!1),(W=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:_e,onDragLeave:Ce,onDrop:pe,className:ee("rounded-xl border border-border bg-surface-2 overflow-hidden","focus-within:border-brand/50 focus-within:shadow-[0_0_0_3px_#7D5A8A] transition-all",y&&"border-brand ring-2 ring-brand/40 bg-brand/5"),children:[b.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:b.map((W,Y)=>u.jsxs("div",{className:"relative group",children:[u.jsx("img",{src:`data:${W.mimeType};base64,${W.data}`,alt:`Attached image ${Y+1}`,className:"h-14 w-14 object-cover rounded-lg border border-border"}),u.jsx("button",{type:"button",onClick:()=>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(Cx,{attachment:W,onRemove:()=>we(Y)},Y))}),u.jsxs("div",{className:"flex items-end gap-2 px-3 py-2.5",children:[g&&u.jsxs("div",{className:"relative flex-shrink-0",children:[u.jsxs("button",{ref:K,type:"button",onClick:()=>O(W=>!W),disabled:r||F,className:ee("h-8 w-8 flex items-center justify-center rounded-lg transition-colors",M?"bg-brand/15 text-brand":"text-text-muted hover:text-text-secondary hover:bg-surface-1/50"),children:[u.jsx(Xu,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Attach"})]}),u.jsx("input",{ref: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:ye}),u.jsx("input",{ref:R,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:r,title:"命令列表",children:u.jsx(ud,{className:"h-4 w-4"})}),u.jsx("textarea",{ref:N,value:v,onChange:ue,onKeyDown:re,onPaste:be,placeholder:F?"处理文件中…":o,disabled:r,rows:1,className:ee("flex-1 resize-none border-none bg-transparent outline-none","text-sm text-text-primary placeholder:text-text-muted font-display","max-h-[200px] min-h-[24px] leading-normal")}),u.jsx("button",{type:"button",onClick:t?n:()=>V(),disabled:!t&&!xt,className:ee("flex-shrink-0 h-8 w-8 flex items-center justify-center rounded-lg transition-all",t?"bg-text-primary text-surface-2 hover:bg-text-secondary":xt?"bg-brand text-white hover:bg-brand-light hover:scale-[1.05] active:scale-[0.97]":"bg-surface-1 text-text-muted"),children:t?u.jsx(fd,{className:"h-3.5 w-3.5",fill:"currentColor"}):F?u.jsx("div",{className:"h-3.5 w-3.5 border-2 border-current border-t-transparent rounded-full animate-spin"}):u.jsx(rd,{className:"h-4 w-4"})})]})]})]}),l!=null&&l>0&&u.jsxs("div",{className:"mt-1.5 flex items-center justify-center gap-2 text-[11px] text-text-muted font-display",children:[u.jsx(ju,{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 Cx({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"})}})(),r=e.size!=null?zt(e.size):null,o=e.kind==="directory"&&e.files?e.files.length:null;return u.jsxs("div",{className:"group flex items-center gap-1.5 rounded-lg border border-border bg-surface-1/50 px-2.5 py-1.5 text-xs text-text-secondary",children:[n,u.jsx("span",{className:"max-w-[120px] truncate font-mono",title:e.name,children:e.name}),r&&u.jsx("span",{className:"text-text-muted text-[10px]",children:r}),o!=null&&u.jsxs("span",{className:"text-text-muted text-[10px]",children:[o," 文件"]}),u.jsx("button",{type:"button",onClick:t,className:"ml-0.5 min-h-[20px] min-w-[20px] h-4 w-4 flex items-center justify-center rounded text-text-muted hover:text-text-primary opacity-0 group-hover:opacity-100 transition-opacity","aria-label":`Remove ${e.name}`,children:u.jsx(dn,{className:"h-3 w-3"})})]})}function zt(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}async function jr(e){const t=[];for(const n of e)try{let r=n,o=n.type;n.size>2*1024*1024&&(r=await je(n,xx),o="image/jpeg");const s=await kx(r);t.push({mimeType:o,data:s})}catch(r){console.error("Failed to process image:",r)}return t}async function Rs(e){const t=[];for(const n of e)try{if(n.size>wl){console.warn(`Skipping ${n.name}: too large (${zt(n.size)})`);continue}n.size>vx&&console.warn(`File ${n.name} is large (${zt(n.size)}), may slow down`);const r=await n.text();t.push({kind:"text",name:n.name,size:n.size,textContent:r,mimeType:n.type||"text/plain"})}catch(r){console.error(`Failed to read text file ${n.name}:`,r)}return t}async function Ns(e){const t=[];for(const n of e)try{const r=cn(n.name);if(r===".csv"||r===".tsv"){const o=await n.text();t.push({kind:"table",name:n.name,size:n.size,textContent:o,mimeType:n.type||"text/csv"})}else if(r===".xlsx"||r===".xls"){const o=await n.arrayBuffer(),s=await Sl(o);t.push({kind:"table",name:n.name,size:n.size,textContent:s,mimeType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}}catch(r){console.error(`Failed to process table file ${n.name}:`,r)}return t}async function Sl(e){const t=await Ae(()=>import("./xlsx-CkFp8p6R.js"),[]),n=t.read(e,{type:"array"}),r=[];for(const o of n.SheetNames){const s=n.Sheets[o];if(!s)continue;const a=t.utils.sheet_to_csv(s);n.SheetNames.length>1?r.push(`## Sheet: ${o}
236
236
 
237
- ${a}`):o.push(a)}return o.join(`
237
+ ${a}`):r.push(a)}return r.join(`
238
238
 
239
- `)}async function Sx(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>wl));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),Cl(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 Sl(v)}else g=await d.text();i.push(`
239
+ `)}async function Sx(e){if(e.length===0)return null;const t=e.filter(d=>!(d.name.startsWith(".")||d.size>wl));t.length>Ar&&console.warn(`Directory has ${t.length} files, truncating to ${Ar}`);const n=t.slice(0,Ar);let r=0;for(const d of n)r+=d.size;r>Ts&&console.warn(`Directory total size ${zt(r)} exceeds limit, some files may be truncated`);const o=n[0].webkitRelativePath,s=o&&o.split("/")[0]||"目录",a=[],i=[];let m=0;const f=[...n].sort((d,h)=>{const g=d.webkitRelativePath||d.name,v=h.webkitRelativePath||h.name;return g.localeCompare(v)});for(const d of f){const h=d.webkitRelativePath||d.name;if(a.push(h),Cl(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 Sl(v)}else g=await d.text();i.push(`
240
240
  ### ${h}
241
241
  \`\`\`
242
242
  ${g}
@@ -250,16 +250,16 @@ ${g}
250
250
  ### ${h}
251
251
  (二进制文件,${zt(d.size)})`)}const l=a.join(`
252
252
  `),c=[`# 目录: ${s}`,`共 ${a.length} 个文件`,"","## 文件结构","```",l,"```","","## 文件内容",...i].join(`
253
- `);return{kind:"directory",name:s,size:o,textContent:c,files:a}}async function kx(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 Ex({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(o=>u.jsx(_x,{request:o,onRespond:t},o.requestId))})})}function _x({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(ma,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[u.jsx(un,{className:"h-3.5 w-3.5"}),"允许"]}),u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[u.jsx(dn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Is(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Ms(e){return e<1e3?String(e):e<1e6?`${Is((e/1e3).toFixed(1))}k`:`${Is((e/1e6).toFixed(2))}M`}function Ps(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Ax({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Ps(e.cost)),t.push(`${Ms(e.used)} / ${Ms(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Ps(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var lr="Popover",[kl]=nt(lr,[Xt]),bn=Xt(),[jx,gt]=kl(lr),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(jx,{scope:t,contentId:Re(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};El.displayName=lr;var _l="PopoverAnchor",Tx=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})});Tx.displayName=_l;var Al="PopoverTrigger",jl=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(Al,n),s=bn(n),a=ke(t,r.triggerRef),i=u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Ml(r.open),...o,ref:a,onClick:te(e.onClick,r.onOpenToggle)});return r.hasCustomAnchor?i:u.jsx(Jn,{asChild:!0,...s,children:i})});jl.displayName=Al;var Oo="PopoverPortal",[Rx,Nx]=kl(Oo,{forceMount:void 0}),Tl=e=>{const{__scopePopover:t,forceMount:n,children:o,container:r}=e,s=gt(Oo,t);return u.jsx(Rx,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:r,children:o})})})};Tl.displayName=Oo;var Vt="PopoverContent",Rl=p.forwardRef((e,t)=>{const n=Nx(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(Mx,{...r,ref:t}):u.jsx(Px,{...r,ref:t})})});Rl.displayName=Vt;var Ix=Ht("PopoverContent.RemoveScroll"),Mx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),o=p.useRef(null),r=ke(t,o),s=p.useRef(!1);return p.useEffect(()=>{const a=o.current;if(a)return xo(a)},[]),u.jsx(Jr,{as:Ix,allowPinchZoom:!0,children:u.jsx(Nl,{...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})})})}),Px=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),o=p.useRef(!1),r=p.useRef(!1);return u.jsx(Nl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(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()}})}),Nl=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":Ml(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Il="PopoverClose",Ox=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=gt(Il,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Ox.displayName=Il;var Dx="PopoverArrow",Lx=p.forwardRef((e,t)=>{const{__scopePopover:n,...o}=e,r=bn(n);return u.jsx(go,{...r,...o,ref:t})});Lx.displayName=Dx;function Ml(e){return e?"open":"closed"}var Fx=El,$x=jl,Ux=Tl,zx=Rl;function Pl({...e}){return u.jsx(Fx,{"data-slot":"popover",...e})}function Ol({...e}){return u.jsx($x,{"data-slot":"popover-trigger",...e})}function Dl({className:e,align:t="center",sideOffset:n=4,...o}){return u.jsx(Ux,{children:u.jsx(zx,{"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,Bx=.9,Hx=.8,Wx=.17,Tr=.1,Rr=.999,Gx=.9999,Vx=.99,Kx=/[\\\/_+.#"@\[\(\{&]/,qx=/[\\\/_+.#"@\[\(\{&]/g,Yx=/[\s-]/,Ll=/[\s-]/g;function Yr(e,t,n,o,r,s,a){if(s===t.length)return r===e.length?Os:Vx;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:Kx.test(e.charAt(f-1))?(c*=Hx,h=e.slice(r,f-1).match(qx),h&&r>0&&(c*=Math.pow(Rr,h.length))):Yx.test(e.charAt(f-1))?(c*=Bx,g=e.slice(r,f-1).match(Ll),g&&r>0&&(c*=Math.pow(Rr,g.length))):(c*=Wx,r>0&&(c*=Math.pow(Rr,f-r))),e.charAt(f)!==t.charAt(s)&&(c*=Gx)),(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(Ll," ")}function Xx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Yr(e,t,Ds(e),Ds(t),0,0,{})}var cr="Dialog",[Fl]=nt(cr),[Qx,ze]=Fl(cr),$l=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(Qx,{scope:t,triggerRef:i,contentRef:m,contentId:Re(),titleId:Re(),descriptionId:Re(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};$l.displayName=cr;var Ul="DialogTrigger",Zx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Ul,n),s=ke(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)})});Zx.displayName=Ul;var Do="DialogPortal",[Jx,zl]=Fl(Do,{forceMount:void 0}),Bl=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,s=ze(Do,t);return u.jsx(Jx,{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})}))})};Bl.displayName=Do;var Kn="DialogOverlay",Hl=p.forwardRef((e,t)=>{const n=zl(Kn,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=ze(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:o||s.open,children:u.jsx(tv,{...r,ref:t})}):null});Hl.displayName=Kn;var ev=Ht("DialogOverlay.RemoveScroll"),tv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Kn,n);return u.jsx(Jr,{as:ev,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",Wl=p.forwardRef((e,t)=>{const n=zl(At,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,s=ze(At,e.__scopeDialog);return u.jsx(Oe,{present:o||s.open,children:s.modal?u.jsx(nv,{...r,ref:t}):u.jsx(rv,{...r,ref:t})})});Wl.displayName=At;var nv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),o=p.useRef(null),r=ke(t,n.contentRef,o);return p.useEffect(()=>{const s=o.current;if(s)return xo(s)},[]),u.jsx(Gl,{...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())})}),rv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),o=p.useRef(!1),r=p.useRef(!1);return u.jsx(Gl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(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()}})}),Gl=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:s,...a}=e,i=ze(At,n),m=p.useRef(null),f=ke(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(sv,{titleId:i.titleId}),u.jsx(iv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Lo="DialogTitle",Vl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Lo,n);return u.jsx(he.h2,{id:r.titleId,...o,ref:t})});Vl.displayName=Lo;var Kl="DialogDescription",ov=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(Kl,n);return u.jsx(he.p,{id:r.descriptionId,...o,ref:t})});ov.displayName=Kl;var ql="DialogClose",Yl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=ze(ql,n);return u.jsx(he.button,{type:"button",...o,ref:t,onClick:te(e.onClick,()=>r.onOpenChange(!1))})});Yl.displayName=ql;function Fo(e){return e?"open":"closed"}var Xl="DialogTitleWarning",[ry,Ql]=Md(Xl,{contentName:At,titleName:Lo,docsSlug:"dialog"}),sv=({titleId:e})=>{const t=Ql(Xl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
253
+ `);return{kind:"directory",name:s,size:r,textContent:c,files:a}}async function kx(e){return new Promise((t,n)=>{const r=new FileReader;r.onloadend=()=>{const o=r.result,s=o.indexOf(",");t(s>=0?o.slice(s+1):o)},r.onerror=()=>n(new Error("FileReader error")),r.readAsDataURL(e)})}function Ex({requests:e,onRespond:t,className:n}){return e.length===0?null:u.jsx("div",{className:ee("w-full max-w-3xl mx-auto px-4",n),children:u.jsx("div",{className:"space-y-2",children:e.map(r=>u.jsx(_x,{request:r,onRespond:t},r.requestId))})})}function _x({request:e,onRespond:t}){return u.jsxs("div",{className:"flex items-center gap-3 rounded-xl border border-warning-border/30 bg-warning-bg/50 px-4 py-3",children:[u.jsx(ma,{className:"h-5 w-5 text-warning-text flex-shrink-0"}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-warning-text",children:e.toolName}),e.description&&u.jsx("div",{className:"text-xs text-warning-text/80 mt-0.5 truncate",children:e.description})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!0),className:"h-8 px-3 rounded-lg bg-brand text-white text-xs font-medium hover:bg-brand-light transition-colors flex items-center gap-1.5",children:[u.jsx(un,{className:"h-3.5 w-3.5"}),"允许"]}),u.jsxs("button",{type:"button",onClick:()=>t==null?void 0:t(e.requestId,!1),className:"h-8 px-3 rounded-lg border border-warning-border/30 text-warning-text text-xs font-medium hover:bg-warning-bg transition-colors flex items-center gap-1.5",children:[u.jsx(dn,{className:"h-3.5 w-3.5"}),"拒绝"]})]})]})}function Is(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}function Ms(e){return e<1e3?String(e):e<1e6?`${Is((e/1e3).toFixed(1))}k`:`${Is((e/1e6).toFixed(2))}M`}function Ps(e){return e.currency==="USD"?`$${e.amount.toFixed(2)}`:`${e.amount.toFixed(2)} ${e.currency}`}function Ax({usage:e}){if(!e)return null;const t=[];e.cost!=null&&e.cost.amount>0&&t.push(Ps(e.cost)),t.push(`${Ms(e.used)} / ${Ms(e.size)} tokens`);const n=[`上下文: ${e.used.toLocaleString()} / ${e.size.toLocaleString()} tokens`];return e.cost!=null&&e.cost.amount>0&&n.push(`累计成本: ${Ps(e.cost)}`),u.jsx("span",{className:"h-7 flex items-center text-xs text-text-muted select-none",title:n.join(" · "),children:t.join(" · ")})}var lr="Popover",[kl]=nt(lr,[Xt]),bn=Xt(),[jx,gt]=kl(lr),El=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!1}=e,i=bn(t),m=p.useRef(null),[f,l]=p.useState(!1),[c,d]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:lr});return u.jsx(po,{...i,children:u.jsx(jx,{scope:t,contentId:Re(),triggerRef:m,open:c,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:f,onCustomAnchorAdd:p.useCallback(()=>l(!0),[]),onCustomAnchorRemove:p.useCallback(()=>l(!1),[]),modal:a,children:n})})};El.displayName=lr;var _l="PopoverAnchor",Tx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(_l,n),s=bn(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=o;return p.useEffect(()=>(a(),()=>i()),[a,i]),u.jsx(Jn,{...s,...r,ref:t})});Tx.displayName=_l;var Al="PopoverTrigger",jl=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(Al,n),s=bn(n),a=ke(t,o.triggerRef),i=u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ml(o.open),...r,ref:a,onClick:te(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?i:u.jsx(Jn,{asChild:!0,...s,children:i})});jl.displayName=Al;var Oo="PopoverPortal",[Rx,Nx]=kl(Oo,{forceMount:void 0}),Tl=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=gt(Oo,t);return u.jsx(Rx,{scope:t,forceMount:n,children:u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:r})})})};Tl.displayName=Oo;var Vt="PopoverContent",Rl=p.forwardRef((e,t)=>{const n=Nx(Vt,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=gt(Vt,e.__scopePopover);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(Mx,{...o,ref:t}):u.jsx(Px,{...o,ref:t})})});Rl.displayName=Vt;var Ix=Ht("PopoverContent.RemoveScroll"),Mx=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(null),o=ke(t,r),s=p.useRef(!1);return p.useEffect(()=>{const a=r.current;if(a)return xo(a)},[]),u.jsx(Jr,{as:Ix,allowPinchZoom:!0,children:u.jsx(Nl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,a=>{var i;a.preventDefault(),s.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,m=i.button===0&&i.ctrlKey===!0,f=i.button===2||m;s.current=f},{checkForDefaultPrevented:!1}),onFocusOutside:te(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Px=p.forwardRef((e,t)=>{const n=gt(Vt,e.__scopePopover),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(Nl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Nl=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onInteractOutside:l,...c}=e,d=gt(Vt,n),h=bn(n);return oo(),u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:l,onEscapeKeyDown:i,onPointerDownOutside:m,onFocusOutside:f,onDismiss:()=>d.onOpenChange(!1),children:u.jsx(ho,{"data-state":Ml(d.open),role:"dialog",id:d.contentId,...h,...c,ref:t,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Il="PopoverClose",Ox=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=gt(Il,n);return u.jsx(he.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Ox.displayName=Il;var Dx="PopoverArrow",Lx=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=bn(n);return u.jsx(go,{...o,...r,ref:t})});Lx.displayName=Dx;function Ml(e){return e?"open":"closed"}var Fx=El,$x=jl,Ux=Tl,zx=Rl;function Pl({...e}){return u.jsx(Fx,{"data-slot":"popover",...e})}function Ol({...e}){return u.jsx($x,{"data-slot":"popover-trigger",...e})}function Dl({className:e,align:t="center",sideOffset:n=4,...r}){return u.jsx(Ux,{children:u.jsx(zx,{"data-slot":"popover-content",align:t,sideOffset:n,className:ee("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...r})})}var Os=1,Bx=.9,Hx=.8,Wx=.17,Tr=.1,Rr=.999,Gx=.9999,Vx=.99,Kx=/[\\\/_+.#"@\[\(\{&]/,qx=/[\\\/_+.#"@\[\(\{&]/g,Yx=/[\s-]/,Ll=/[\s-]/g;function Yr(e,t,n,r,o,s,a){if(s===t.length)return o===e.length?Os:Vx;var i=`${o},${s}`;if(a[i]!==void 0)return a[i];for(var m=r.charAt(s),f=n.indexOf(m,o),l=0,c,d,h,g;f>=0;)c=Yr(e,t,n,r,f+1,s+1,a),c>l&&(f===o?c*=Os:Kx.test(e.charAt(f-1))?(c*=Hx,h=e.slice(o,f-1).match(qx),h&&o>0&&(c*=Math.pow(Rr,h.length))):Yx.test(e.charAt(f-1))?(c*=Bx,g=e.slice(o,f-1).match(Ll),g&&o>0&&(c*=Math.pow(Rr,g.length))):(c*=Wx,o>0&&(c*=Math.pow(Rr,f-o))),e.charAt(f)!==t.charAt(s)&&(c*=Gx)),(c<Tr&&n.charAt(f-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(f-1)!==r.charAt(s))&&(d=Yr(e,t,n,r,f+1,s+2,a),d*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(Ll," ")}function Xx(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Yr(e,t,Ds(e),Ds(t),0,0,{})}var cr="Dialog",[Fl]=nt(cr),[Qx,ze]=Fl(cr),$l=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:a=!0}=e,i=p.useRef(null),m=p.useRef(null),[f,l]=ut({prop:r,defaultProp:o??!1,onChange:s,caller:cr});return u.jsx(Qx,{scope:t,triggerRef:i,contentRef:m,contentId:Re(),titleId:Re(),descriptionId:Re(),open:f,onOpenChange:l,onOpenToggle:p.useCallback(()=>l(c=>!c),[l]),modal:a,children:n})};$l.displayName=cr;var Ul="DialogTrigger",Zx=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Ul,n),s=ke(t,o.triggerRef);return u.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Fo(o.open),...r,ref:s,onClick:te(e.onClick,o.onOpenToggle)})});Zx.displayName=Ul;var Do="DialogPortal",[Jx,zl]=Fl(Do,{forceMount:void 0}),Bl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=ze(Do,t);return u.jsx(Jx,{scope:t,forceMount:n,children:p.Children.map(r,a=>u.jsx(Oe,{present:n||s.open,children:u.jsx(pn,{asChild:!0,container:o,children:a})}))})};Bl.displayName=Do;var Kn="DialogOverlay",Hl=p.forwardRef((e,t)=>{const n=zl(Kn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(Kn,e.__scopeDialog);return s.modal?u.jsx(Oe,{present:r||s.open,children:u.jsx(tv,{...o,ref:t})}):null});Hl.displayName=Kn;var ev=Ht("DialogOverlay.RemoveScroll"),tv=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Kn,n);return u.jsx(Jr,{as:ev,allowPinchZoom:!0,shards:[o.contentRef],children:u.jsx(he.div,{"data-state":Fo(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),At="DialogContent",Wl=p.forwardRef((e,t)=>{const n=zl(At,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=ze(At,e.__scopeDialog);return u.jsx(Oe,{present:r||s.open,children:s.modal?u.jsx(nv,{...o,ref:t}):u.jsx(rv,{...o,ref:t})})});Wl.displayName=At;var nv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),r=p.useRef(null),o=ke(t,n.contentRef,r);return p.useEffect(()=>{const s=r.current;if(s)return xo(s)},[]),u.jsx(Gl,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:te(e.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:te(e.onPointerDownOutside,s=>{const a=s.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&s.preventDefault()}),onFocusOutside:te(e.onFocusOutside,s=>s.preventDefault())})}),rv=p.forwardRef((e,t)=>{const n=ze(At,e.__scopeDialog),r=p.useRef(!1),o=p.useRef(!1);return u.jsx(Gl,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,i;(a=e.onCloseAutoFocus)==null||a.call(e,s),s.defaultPrevented||(r.current||(i=n.triggerRef.current)==null||i.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var m,f;(m=e.onInteractOutside)==null||m.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=s.target;((f=n.triggerRef.current)==null?void 0:f.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Gl=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...a}=e,i=ze(At,n),m=p.useRef(null),f=ke(t,m);return oo(),u.jsxs(u.Fragment,{children:[u.jsx(qn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:u.jsx(fn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Fo(i.open),...a,ref:f,onDismiss:()=>i.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(sv,{titleId:i.titleId}),u.jsx(iv,{contentRef:m,descriptionId:i.descriptionId})]})]})}),Lo="DialogTitle",Vl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Lo,n);return u.jsx(he.h2,{id:o.titleId,...r,ref:t})});Vl.displayName=Lo;var Kl="DialogDescription",ov=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(Kl,n);return u.jsx(he.p,{id:o.descriptionId,...r,ref:t})});ov.displayName=Kl;var ql="DialogClose",Yl=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=ze(ql,n);return u.jsx(he.button,{type:"button",...r,ref:t,onClick:te(e.onClick,()=>o.onOpenChange(!1))})});Yl.displayName=ql;function Fo(e){return e?"open":"closed"}var Xl="DialogTitleWarning",[oy,Ql]=Md(Xl,{contentName:At,titleName:Lo,docsSlug:"dialog"}),sv=({titleId:e})=>{const t=Ql(Xl),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
254
254
 
255
255
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
256
256
 
257
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},av="DialogDescriptionWarning",iv=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ql(av).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},lv=$l,cv=Bl,uv=Hl,dv=Wl,oy=Vl,sy=Yl,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',fv='[cmdk-group-heading=""]',Zl='[cmdk-item=""]',Ls=`${Zl}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",mv=(e,t,n)=>Xx(e,t,n),Jl=p.createContext(void 0),yn=()=>p.useContext(Jl),ec=p.createContext(void 0),$o=()=>p.useContext(ec),tc=p.createContext(void 0),nc=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=rc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:C=!0,...b}=e,_=Re(),A=Re(),E=Re(),L=p.useRef(null),k=kv();jt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,j.emit()}},[l]),jt(()=>{k(6,F)},[]);let j=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,D,$)=>{var R,H,G,K;if(!Object.is(n.current[N],D)){if(n.current[N]=D,N==="search")O(),T(),k(1,M);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(E);V?V.focus():(R=document.getElementById(_))==null||R.focus()}if(k(7,()=>{var V;n.current.selectedItemId=(V=I())==null?void 0:V.id,j.emit()}),$||k(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 R;D!==((R=s.current.get(N))==null?void 0:R.value)&&(s.current.set(N,{value:D,keywords:$}),n.current.filtered.items.set(N,y(D,$)),k(2,()=>{T(),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]))),k(3,()=>{O(),T(),n.current.value||M(),j.emit()}),()=>{s.current.delete(N),o.current.delete(N),n.current.filtered.items.delete(N);let $=I();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===N&&M(),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:_,inputId:E,labelId:A,listInnerRef:L}),[]);function y(N,D){var $,R;let H=(R=($=i.current)==null?void 0:$.filter)!=null?R:mv;return N?H(N,n.current.search,D):0}function T(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,D=[];n.current.filtered.groups.forEach(R=>{let H=r.current.get(R),G=0;H.forEach(K=>{let V=N.get(K);G=Math.max(V,G)}),D.push([R,G])});let $=L.current;z().sort((R,H)=>{var G,K;let V=R.getAttribute("id"),ne=H.getAttribute("id");return((G=N.get(ne))!=null?G:0)-((K=N.get(V))!=null?K:0)}).forEach(R=>{let H=R.closest(Nr);H?H.appendChild(R.parentElement===H?R:R.closest(`${Nr} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Nr} > *`))}),D.sort((R,H)=>H[1]-R[1]).forEach(R=>{var H;let G=(H=L.current)==null?void 0:H.querySelector(`${nn}[${Lt}="${encodeURIComponent(R[0])}"]`);G==null||G.parentElement.appendChild(G)})}function M(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),D=N==null?void 0:N.getAttribute(Lt);j.setState("value",D||void 0)}function O(){var N,D,$,R;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=(R=($=s.current.get(G))==null?void 0:$.keywords)!=null?R:[],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 R=I();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(D=R.closest(nn))==null?void 0:D.querySelector(fv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function I(){var N;return(N=L.current)==null?void 0:N.querySelector(`${Zl}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=L.current)==null?void 0:N.querySelectorAll(Ls))||[])}function S(N){let D=z()[N];D&&j.setState("value",D.getAttribute(Lt))}function w(N){var D;let $=I(),R=z(),H=R.findIndex(K=>K===$),G=R[H+N];(D=i.current)!=null&&D.loop&&(G=H+N<0?R[R.length-1]:H+N===R.length?R[0]:R[H+N]),G&&j.setState("value",G.getAttribute(Lt))}function B(N){let D=I(),$=D==null?void 0:D.closest(nn),R;for(;$&&!R;)$=N>0?Cv($,nn):Sv($,nn),R=$==null?void 0:$.querySelector(Ls);R?j.setState("value",R.getAttribute(Lt)):w(N)}let P=()=>S(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?B(1):w(1)},q=N=>{N.preventDefault(),N.metaKey?S(0):N.altKey?B(-1):w(-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&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{C&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),S(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=I();if(R){let H=new Event(Xr);R.dispatchEvent(H)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:_v},m),ur(e,N=>p.createElement(ec.Provider,{value:j},p.createElement(Jl.Provider,{value:x},N))))}),pv=p.forwardRef((e,t)=>{var n,o;let r=Re(),s=p.useRef(null),a=p.useContext(tc),i=yn(),m=rc(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=oc(r,s,[e.value,e.children,s],e.keywords),c=$o(),d=mt(k=>k.value&&k.value===l.current),h=mt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(r)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Xr,g),()=>k.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var k,j;v(),(j=(k=m.current).onSelect)==null||j.call(k,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:C,value:b,onSelect:_,forceMount:A,keywords:E,...L}=e;return p.createElement(ht.div,{ref:qe(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)}),hv=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),[]),oc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:r}),[r]);return p.createElement(ht.div,{ref:qe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),ur(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(tc.Provider,{value:d},h))))}),gv=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:qe(r,t),...o,"cmdk-separator":"",role:"separator"})}),xv=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)}})}),vv=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:qe(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:qe(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),bv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:o,overlayClassName:r,contentClassName:s,container:a,...i}=e;return p.createElement(lv,{open:n,onOpenChange:o},p.createElement(cv,{container:a},p.createElement(uv,{"cmdk-overlay":"",className:r}),p.createElement(dv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(nc,{ref:t,...i}))))}),yv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wv=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(nc,{List:vv,Item:pv,Input:xv,Group:hv,Separator:gv,Dialog:bv,Empty:yv,Loading:wv});function Cv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Sv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rc(e){let t=p.useRef(e);return 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 oc(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 kv=()=>{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 Ev(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ur({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Ev(t),{ref:t.ref},n(t.props.children)):n(t)}var _v={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Av({className:e,...t}){return u.jsx(Qt,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function jv({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(td,{className:"size-4 shrink-0 opacity-50"}),u.jsx(Qt.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Tv({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 Rv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Nv({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 Iv({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 Mv({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(Av,{shouldFilter:!1,value:i,onValueChange:m,children:[o&&u.jsx(jv,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(Tv,{children:[u.jsx(Rv,{children:"No models found."}),u.jsx(Nv,{children:f.map(l=>u.jsxs(Iv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(un,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function sc(e){const[t,n]=p.useState(e.modelState),[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 Pv({client:e,onModelSelect:t}){const[n,o]=p.useState(!1),{supportsModelSelection:r,availableModels:s,currentModel:a,setModel:i,isLoading:m}=sc(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(Pl,{open:n,onOpenChange:f?o:void 0,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(ua,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-72 p-0",align:"end",children:u.jsx(Mv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function Ov(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 ac(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Dv(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return ac(e)}function Lv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!ac(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const 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 Fv=new Set(["clear","new","help","status","model","copy"]),ic=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"}],$v=ic.map(e=>({name:e.name,description:e.desc})),ay=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...$v];function Uv(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 zv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Bv(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 ic)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(`
258
- `)}function Hv(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(`
259
- `)}function Wv(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(`
260
- `)}async function Gv(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||!Fv.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=Bv(t.availableCommands);else if(s==="status")a=Hv({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=Wv(t.availableModels,t.currentModel);else if(s==="copy"){const d=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=d==null?void 0:d.chunks)==null?void 0:c.map(v=>v.text).join(`
261
- `))??"";(h?await Dv(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:Uv(s),subtitle:zv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Vv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Kv(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 qv({mode:e,onModeChange:t}){const[n,o]=p.useState(!1),r=Ir.find(s=>s.value===e)??Ir[0];return u.jsxs(Pl,{open:n,onOpenChange:o,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(ld,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:r.label}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-64 p-1",align:"start",children:Ir.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),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 Yv({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,_]=p.useState(e.usage),[A,E]=p.useState(e.currentModeId),[L,k]=p.useState(!1),{commands:j}=Ov(e),{availableModels:x,currentModel:y,setModel:T}=sc(e);p.useEffect(()=>{l.current=m},[m]);const M=p.useCallback(()=>{o([]),s(!1),i(!1),_(null),E(null)},[]),O=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),k(e.supportsImages),O)try{localStorage.setItem(O,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,O]),I=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),o(D=>{const $=Mr(D,N.toolCall.toolCallId);if($>=0)return D.map((R,H)=>H!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...D,R]}}))},[]),z=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(R=>{const H=R[R.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"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,G]})}else if(D.sessionUpdate==="agent_thought_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(R=>{const H=R[R.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"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,G]})}else if(D.sessionUpdate==="user_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;o(R=>{const H=R[R.length-1];if((H==null?void 0:H.type)==="user_message")return[...R.slice(0,-1),{...H,content:H.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,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(R=>{const H=Mr(R,D.toolCallId);if(H>=0)return R.map((K,V)=>V!==H||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...R,G]})}else D.sessionUpdate==="tool_call_update"?o($=>{const R=Mr($,D.toolCallId);if(R<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!==R||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 R=$.reduce((G,K,V)=>K.type==="plan"?V:G,-1);if(R>=0)return $.map((G,K)=>K===R?{...G,entries:D.entries}:G);const H={type:"plan",id:`plan-${Date.now()}`,entries:D.entries};return[...$,H]}):D.sessionUpdate==="usage_update"?_(D):D.sessionUpdate==="current_mode_update"&&E(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),M()}),e.setSessionUpdateHandler((D,$)=>{z(D,$)}),e.setPromptCompleteHandler(D=>{console.log("[ChatInterface] Prompt complete:",D),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(D=>{console.error("[ChatInterface] Agent error:",D),h(D),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=O?localStorage.getItem(O):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,I,z,M]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),r&&e.cancel(),M(),f(null),e.createSession(void 0,v)},[e,r,M,v]),w=()=>{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 R=$==="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 R?K="rejected":G.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...G.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,D)=>{const $=P.find(G=>G.requestId===N);let R=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&&(R=G.optionId,H=G.kind)}else{const G=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");G&&(R=G.optionId,H=G.kind)}R||(H=D?"allow_once":"reject_once"),B(N,R,H)},[B,P]),q=p.useCallback(async N=>{var ne;const D=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!D&&$.length===0&&R.length===0||!a)return;if(D.startsWith("/")&&$.length===0){kt("[ChatInterface] slash command input",{text:D});const Z=await Gv(D,{sessionId:m,availableCommands:j,availableModels:x,currentModel:y,supportsImages:L,entries:c.current,setModel:T,onNewSession:S}).catch(()=>null);if(Z){if(kt("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){o([]);return}if("newSession"in Z&&Z.newSession){S();return}if("userEntry"in Z){o(re=>[...re,Z.userEntry,Z.cmdEntry]);return}}kt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:D})}kt("[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=Kv(re):ue=await(await fetch(re)).blob();let be=ue,de=Z.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});be=await je(ie,Vv),de="image/jpeg"}const ye=await new Promise((ie,ge)=>{const we=new FileReader;we.onloadend=()=>{const me=we.result,_e=me.indexOf(",");ie(_e>=0?me.slice(_e+1):me)},we.onerror=()=>{var me;return ge(new Error("FileReader error: "+((me=we.error)==null?void 0:me.message)))},we.readAsDataURL(be)}),fe={type:"image",mimeType:de,data:ye};H.push(fe),G.push({mimeType:de,data:ye})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const Z of R)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
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},av="DialogDescriptionWarning",iv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ql(av).contentName}}.`;return p.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},lv=$l,cv=Bl,uv=Hl,dv=Wl,sy=Vl,ay=Yl,nn='[cmdk-group=""]',Nr='[cmdk-group-items=""]',fv='[cmdk-group-heading=""]',Zl='[cmdk-item=""]',Ls=`${Zl}:not([aria-disabled="true"])`,Xr="cmdk-item-select",Lt="data-value",mv=(e,t,n)=>Xx(e,t,n),Jl=p.createContext(void 0),yn=()=>p.useContext(Jl),ec=p.createContext(void 0),$o=()=>p.useContext(ec),tc=p.createContext(void 0),nc=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}}}),r=Ft(()=>new Set),o=Ft(()=>new Map),s=Ft(()=>new Map),a=Ft(()=>new Set),i=rc(e),{label:m,children:f,value:l,onValueChange:c,filter:d,shouldFilter:h,loop:g,disablePointerSelection:v=!1,vimBindings:C=!0,...b}=e,_=Re(),A=Re(),E=Re(),L=p.useRef(null),k=kv();jt(()=>{if(l!==void 0){let N=l.trim();n.current.value=N,j.emit()}},[l]),jt(()=>{k(6,F)},[]);let j=p.useMemo(()=>({subscribe:N=>(a.current.add(N),()=>a.current.delete(N)),snapshot:()=>n.current,setState:(N,D,$)=>{var R,H,G,K;if(!Object.is(n.current[N],D)){if(n.current[N]=D,N==="search")O(),T(),k(1,M);else if(N==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let V=document.getElementById(E);V?V.focus():(R=document.getElementById(_))==null||R.focus()}if(k(7,()=>{var V;n.current.selectedItemId=(V=I())==null?void 0:V.id,j.emit()}),$||k(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 R;D!==((R=s.current.get(N))==null?void 0:R.value)&&(s.current.set(N,{value:D,keywords:$}),n.current.filtered.items.set(N,y(D,$)),k(2,()=>{T(),j.emit()}))},item:(N,D)=>(r.current.add(N),D&&(o.current.has(D)?o.current.get(D).add(N):o.current.set(D,new Set([N]))),k(3,()=>{O(),T(),n.current.value||M(),j.emit()}),()=>{s.current.delete(N),r.current.delete(N),n.current.filtered.items.delete(N);let $=I();k(4,()=>{O(),($==null?void 0:$.getAttribute("id"))===N&&M(),j.emit()})}),group:N=>(o.current.has(N)||o.current.set(N,new Set),()=>{s.current.delete(N),o.current.delete(N)}),filter:()=>i.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:_,inputId:E,labelId:A,listInnerRef:L}),[]);function y(N,D){var $,R;let H=(R=($=i.current)==null?void 0:$.filter)!=null?R:mv;return N?H(N,n.current.search,D):0}function T(){if(!n.current.search||i.current.shouldFilter===!1)return;let N=n.current.filtered.items,D=[];n.current.filtered.groups.forEach(R=>{let H=o.current.get(R),G=0;H.forEach(K=>{let V=N.get(K);G=Math.max(V,G)}),D.push([R,G])});let $=L.current;z().sort((R,H)=>{var G,K;let V=R.getAttribute("id"),ne=H.getAttribute("id");return((G=N.get(ne))!=null?G:0)-((K=N.get(V))!=null?K:0)}).forEach(R=>{let H=R.closest(Nr);H?H.appendChild(R.parentElement===H?R:R.closest(`${Nr} > *`)):$.appendChild(R.parentElement===$?R:R.closest(`${Nr} > *`))}),D.sort((R,H)=>H[1]-R[1]).forEach(R=>{var H;let G=(H=L.current)==null?void 0:H.querySelector(`${nn}[${Lt}="${encodeURIComponent(R[0])}"]`);G==null||G.parentElement.appendChild(G)})}function M(){let N=z().find($=>$.getAttribute("aria-disabled")!=="true"),D=N==null?void 0:N.getAttribute(Lt);j.setState("value",D||void 0)}function O(){var N,D,$,R;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let H=0;for(let G of r.current){let K=(D=(N=s.current.get(G))==null?void 0:N.value)!=null?D:"",V=(R=($=s.current.get(G))==null?void 0:$.keywords)!=null?R:[],ne=y(K,V);n.current.filtered.items.set(G,ne),ne>0&&H++}for(let[G,K]of o.current)for(let V of K)if(n.current.filtered.items.get(V)>0){n.current.filtered.groups.add(G);break}n.current.filtered.count=H}function F(){var N,D,$;let R=I();R&&(((N=R.parentElement)==null?void 0:N.firstChild)===R&&(($=(D=R.closest(nn))==null?void 0:D.querySelector(fv))==null||$.scrollIntoView({block:"nearest"})),R.scrollIntoView({block:"nearest"}))}function I(){var N;return(N=L.current)==null?void 0:N.querySelector(`${Zl}[aria-selected="true"]`)}function z(){var N;return Array.from(((N=L.current)==null?void 0:N.querySelectorAll(Ls))||[])}function S(N){let D=z()[N];D&&j.setState("value",D.getAttribute(Lt))}function w(N){var D;let $=I(),R=z(),H=R.findIndex(K=>K===$),G=R[H+N];(D=i.current)!=null&&D.loop&&(G=H+N<0?R[R.length-1]:H+N===R.length?R[0]:R[H+N]),G&&j.setState("value",G.getAttribute(Lt))}function B(N){let D=I(),$=D==null?void 0:D.closest(nn),R;for(;$&&!R;)$=N>0?Cv($,nn):Sv($,nn),R=$==null?void 0:$.querySelector(Ls);R?j.setState("value",R.getAttribute(Lt)):w(N)}let P=()=>S(z().length-1),U=N=>{N.preventDefault(),N.metaKey?P():N.altKey?B(1):w(1)},q=N=>{N.preventDefault(),N.metaKey?S(0):N.altKey?B(-1):w(-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&&U(N);break}case"ArrowDown":{U(N);break}case"p":case"k":{C&&N.ctrlKey&&q(N);break}case"ArrowUp":{q(N);break}case"Home":{N.preventDefault(),S(0);break}case"End":{N.preventDefault(),P();break}case"Enter":{N.preventDefault();let R=I();if(R){let H=new Event(Xr);R.dispatchEvent(H)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:x.inputId,id:x.labelId,style:_v},m),ur(e,N=>p.createElement(ec.Provider,{value:j},p.createElement(Jl.Provider,{value:x},N))))}),pv=p.forwardRef((e,t)=>{var n,r;let o=Re(),s=p.useRef(null),a=p.useContext(tc),i=yn(),m=rc(e),f=(r=(n=m.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;jt(()=>{if(!f)return i.item(o,a==null?void 0:a.id)},[f]);let l=oc(o,s,[e.value,e.children,s],e.keywords),c=$o(),d=mt(k=>k.value&&k.value===l.current),h=mt(k=>f||i.filter()===!1?!0:k.search?k.filtered.items.get(o)>0:!0);p.useEffect(()=>{let k=s.current;if(!(!k||e.disabled))return k.addEventListener(Xr,g),()=>k.removeEventListener(Xr,g)},[h,e.onSelect,e.disabled]);function g(){var k,j;v(),(j=(k=m.current).onSelect)==null||j.call(k,l.current)}function v(){c.setState("value",l.current,!0)}if(!h)return null;let{disabled:C,value:b,onSelect:_,forceMount:A,keywords:E,...L}=e;return p.createElement(ht.div,{ref:qe(s,t),...L,id:o,"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)}),hv=p.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,a=Re(),i=p.useRef(null),m=p.useRef(null),f=Re(),l=yn(),c=mt(h=>o||l.filter()===!1?!0:h.search?h.filtered.groups.has(a):!0);jt(()=>l.group(a),[]),oc(a,i,[e.value,e.heading,m]);let d=p.useMemo(()=>({id:a,forceMount:o}),[o]);return p.createElement(ht.div,{ref:qe(i,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&p.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:f},n),ur(e,h=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?f:void 0},p.createElement(tc.Provider,{value:d},h))))}),gv=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=p.useRef(null),s=mt(a=>!a.search);return!n&&!s?null:p.createElement(ht.div,{ref:qe(o,t),...r,"cmdk-separator":"",role:"separator"})}),xv=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=$o(),a=mt(f=>f.search),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),p.createElement(ht.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":i,id:m.inputId,type:"text",value:o?e.value:a,onChange:f=>{o||s.setState("search",f.target.value),n==null||n(f.target.value)}})}),vv=p.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=p.useRef(null),a=p.useRef(null),i=mt(f=>f.selectedItemId),m=yn();return p.useEffect(()=>{if(a.current&&s.current){let f=a.current,l=s.current,c,d=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=f.offsetHeight;l.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return d.observe(f),()=>{cancelAnimationFrame(c),d.unobserve(f)}}},[]),p.createElement(ht.div,{ref:qe(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":r,id:m.listId},ur(e,f=>p.createElement("div",{ref:qe(a,m.listInnerRef),"cmdk-list-sizer":""},f)))}),bv=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:a,...i}=e;return p.createElement(lv,{open:n,onOpenChange:r},p.createElement(cv,{container:a},p.createElement(uv,{"cmdk-overlay":"",className:o}),p.createElement(dv,{"aria-label":e.label,"cmdk-dialog":"",className:s},p.createElement(nc,{ref:t,...i}))))}),yv=p.forwardRef((e,t)=>mt(n=>n.filtered.count===0)?p.createElement(ht.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wv=p.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return p.createElement(ht.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},ur(e,a=>p.createElement("div",{"aria-hidden":!0},a)))}),Qt=Object.assign(nc,{List:vv,Item:pv,Input:xv,Group:hv,Separator:gv,Dialog:bv,Empty:yv,Loading:wv});function Cv(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Sv(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rc(e){let t=p.useRef(e);return 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 oc(e,t,n,r=[]){let o=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():o.current}})(),m=r.map(f=>f.trim());s.value(e,i,m),(a=t.current)==null||a.setAttribute(Lt,i),o.current=i}),o}var kv=()=>{let[e,t]=p.useState(),n=Ft(()=>new Map);return jt(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function Ev(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function ur({asChild:e,children:t},n){return e&&p.isValidElement(t)?p.cloneElement(Ev(t),{ref:t.ref},n(t.props.children)):n(t)}var _v={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Av({className:e,...t}){return u.jsx(Qt,{"data-slot":"command",className:ee("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function jv({className:e,...t}){return u.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[u.jsx(td,{className:"size-4 shrink-0 opacity-50"}),u.jsx(Qt.Input,{"data-slot":"command-input",className:ee("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Tv({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 Rv({...e}){return u.jsx(Qt.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Nv({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 Iv({className:e,...t}){return u.jsx(Qt.Item,{"data-slot":"command-item",className:ee("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function Fs(e,t){if(!e)return!0;const n=e.toLowerCase(),r=t.toLowerCase();let o=0;for(let s=0;s<r.length&&o<n.length;s++)r[s]===n[o]&&o++;return o===n.length}function Mv({models:e,currentModelId:t,onSelect:n,showSearch:r=!0,isMobile:o=!1}){const[s,a]=p.useState(""),[i,m]=p.useState(o?"__none__":void 0),f=p.useMemo(()=>s?e.filter(l=>Fs(s,l.name)||Fs(s,l.modelId)):e,[e,s]);return u.jsxs(Av,{shouldFilter:!1,value:i,onValueChange:m,children:[r&&u.jsx(jv,{placeholder:"Select a model…",value:s,onValueChange:a}),u.jsxs(Tv,{children:[u.jsx(Rv,{children:"No models found."}),u.jsx(Nv,{children:f.map(l=>u.jsxs(Iv,{value:l.modelId,onSelect:()=>n(l),className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[u.jsx("span",{className:"truncate font-medium",children:l.name}),l.description&&u.jsx("span",{className:"text-xs text-muted-foreground truncate",children:l.description})]}),u.jsx(un,{className:ee("h-4 w-4 shrink-0",t===l.modelId?"opacity-100":"opacity-0")})]},l.modelId))})]})]})}function sc(e){const[t,n]=p.useState(e.modelState),[r,o]=p.useState(!1);p.useEffect(()=>{const f=c=>{if(n(c),c&&c.availableModels.length>0){const d=localStorage.getItem("acp_model_id");d&&d!==c.currentModelId&&c.availableModels.some(h=>h.modelId===d)&&e.setSessionModel(d).catch(()=>{})}},l=c=>{n(d=>d?{...d,currentModelId:c}:null),o(!1)};return e.setModelStateChangedHandler(f),e.setModelChangedHandler(l),()=>{e.removeModelStateChangedHandler(f),e.removeModelChangedHandler(l)}},[e]);const s=p.useMemo(()=>(t==null?void 0:t.availableModels)??[],[t]),a=(t==null?void 0:t.currentModelId)??null,i=p.useMemo(()=>s.find(f=>f.modelId===a)??null,[s,a]),m=p.useCallback(async f=>{if(!t)throw new Error("Model selection not supported");o(!0);try{await e.setSessionModel(f),localStorage.setItem("acp_model_id",f)}catch(l){throw o(!1),l}},[e,t]);return{supportsModelSelection:t!==null&&s.length>0,availableModels:s,currentModelId:a,currentModel:i,setModel:m,isLoading:r}}function Pv({client:e,onModelSelect:t}){const[n,r]=p.useState(!1),{supportsModelSelection:o,availableModels:s,currentModel:a,setModel:i,isLoading:m}=sc(e),f=o&&s.length>0,l=typeof window<"u"&&window.matchMedia("(hover: none) and (pointer: coarse)").matches,c=async d=>{try{await i(d.modelId),t==null||t(d.modelId),r(!1)}catch(h){console.error("[ModelSelector] Failed to set model:",h)}};return u.jsxs(Pl,{open:n,onOpenChange:f?r:void 0,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",disabled:!f||m,children:[m?u.jsx(ua,{className:"h-3 w-3 animate-spin"}):null,u.jsx("span",{className:"max-w-32 truncate",children:(a==null?void 0:a.name)??"Select Model"}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-72 p-0",align:"end",children:u.jsx(Mv,{models:s,currentModelId:(a==null?void 0:a.modelId)??null,onSelect:c,showSearch:!l,isMobile:l})})]})}function Ov(e){const[t,n]=p.useState(e.availableCommands);p.useEffect(()=>{const o=s=>{n(s)};return e.setAvailableCommandsChangedHandler(o),()=>{e.setAvailableCommandsChangedHandler(()=>{})}},[e]);const r=p.useMemo(()=>t.length>0,[t]);return{commands:t,hasCommands:r}}function ac(e){if(typeof document>"u"||typeof document.createElement!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.opacity="0",document.body.appendChild(t);try{return t.focus(),t.select(),t.setSelectionRange(0,e.length),document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Dv(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return ac(e)}function Lv(){if(typeof navigator>"u")return;const e=navigator.clipboard;if(e&&typeof e.writeText=="function")return;const t={async writeText(n){if(!ac(n))throw new Error("Clipboard write failed (execCommand fallback unavailable)")},async write(n){for(const r of n)try{const o=await r.getType("text/plain");await t.writeText(await o.text());return}catch{}throw new Error("No text/plain clipboard item available")}};try{Object.defineProperty(navigator,"clipboard",{value:t,configurable:!0,writable:!0})}catch{}}const Fv=new Set(["clear","new","help","status","model","copy"]),ic=[{name:"compact",desc:"压缩上下文"},{name:"cost",desc:"查看会话费用"},{name:"summary",desc:"生成会话摘要"}],$v=ic.map(e=>({name:e.name,description:e.desc})),iy=[{name:"clear",description:"清空当前对话"},{name:"new",description:"新建会话"},{name:"help",description:"显示此帮助信息"},{name:"status",description:"显示会话状态"},{name:"model",description:"查看或切换模型",input:{hint:"[id]"}},{name:"copy",description:"复制最后一条助手消息"},...$v];function Uv(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 zv(e){switch(e){case"help":return"可用命令列表";case"status":return"会话状态信息";case"model":return"查看或切换模型";case"copy":return"复制助手消息到剪贴板";default:return""}}function Bv(e){var r;const t=[];t.push("**本地命令**(Web UI 直接执行)"),t.push("");const n=[{name:"clear",desc:"清空当前对话"},{name:"new",desc:"新建会话"},{name:"help",desc:"显示此帮助信息"},{name:"status",desc:"显示会话状态"},{name:"model [id]",desc:"查看或切换模型"},{name:"copy",desc:"复制最后一条助手消息"}];for(const o of n)t.push(`- \`/${o.name}\` — ${o.desc}`);t.push(""),t.push("**Agent 命令**(发给 Saluzi agent 执行)"),t.push("");for(const o of ic)t.push(`- \`/${o.name}\` — ${o.desc}`);if(e.length>0)for(const o of e){const s=(r=o.input)!=null&&r.hint?` ${o.input.hint}`:"";t.push(`- \`/${o.name}${s}\` — ${o.description}`)}return t.join(`
258
+ `)}function Hv(e){var n,r,o;const t=["**会话状态**",""];return t.push(`- 会话 ID: \`${e.sessionId??"无"}\``),t.push(`- 当前模型: ${((n=e.currentModel)==null?void 0:n.name)??((r=e.currentModel)==null?void 0:r.modelId)??"未设置"}`),(o=e.currentModel)!=null&&o.modelId&&t.push(` - ID: \`${e.currentModel.modelId}\``),t.push(`- 可用模型数: ${e.modelCount}`),t.push(`- 图片支持: ${e.supportsImages?"是":"否"}`),t.push(`- 消息条数: ${e.entryCount}`),t.join(`
259
+ `)}function Wv(e,t){if(e.length===0)return"当前 agent 未提供模型选择能力。";const n=["**可用模型**",""];for(const r of e){const o=r.modelId===(t==null?void 0:t.modelId)?" ✓":"";n.push(`- \`${r.modelId}\` — ${r.name}${o}`)}return n.push(""),n.push("使用 `/model <id>` 切换模型。"),n.join(`
260
+ `)}async function Gv(e,t){var c;if(!e.startsWith("/"))return{handled:!1};const[n,...r]=e.slice(1).split(/\s+/),o=r.join(" ").trim(),s=n==null?void 0:n.toLowerCase();if(!s||!Fv.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=Bv(t.availableCommands);else if(s==="status")a=Hv({sessionId:t.sessionId,currentModel:t.currentModel,supportsImages:t.supportsImages,modelCount:t.availableModels.length,entryCount:t.entries.length});else if(s==="model")if(o)try{await t.setModel(o),a=`已请求切换到模型: \`${o}\``}catch(d){a=`切换模型失败: ${d instanceof Error?d.message:String(d)}`,i=!0}else a=Wv(t.availableModels,t.currentModel);else if(s==="copy"){const d=[...t.entries].reverse().find(v=>v.type==="assistant_message"),h=((c=d==null?void 0:d.chunks)==null?void 0:c.map(v=>v.text).join(`
261
+ `))??"";(h?await Dv(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:Uv(s),subtitle:zv(s),outputText:a,variant:i?"error":"default"};return{handled:!0,userEntry:f,cmdEntry:l}}const Vv={maxSizeMB:2,maxWidthOrHeight:2048,useWebWorker:!0,fileType:"image/jpeg"};function Kv(e){const t=e.indexOf(",");if(t===-1)throw new Error("Invalid data URL: missing comma separator");const n=e.slice(0,t),r=e.slice(t+1),o=n.match(/^data:([^;,]+)/),s=o?o[1]:"application/octet-stream",a=atob(r),i=new Uint8Array(a.length);for(let m=0;m<a.length;m++)i[m]=a.charCodeAt(m);return new Blob([i],{type:s})}const Ir=[{value:"default",label:"默认",description:"手动审批权限请求"},{value:"acceptEdits",label:"自动接受编辑",description:"自动允许文件编辑操作"},{value:"bypassPermissions",label:"跳过权限",description:"跳过所有权限检查"},{value:"plan",label:"规划模式",description:"仅规划,不执行工具"},{value:"dontAsk",label:"不询问",description:"不弹出询问,自动拒绝"},{value:"auto",label:"自动判断",description:"AI 自动判断是否批准"}];function qv({mode:e,onModeChange:t}){const[n,r]=p.useState(!1),o=Ir.find(s=>s.value===e)??Ir[0];return u.jsxs(Pl,{open:n,onOpenChange:r,children:[u.jsx(Ol,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"gap-1.5 text-muted-foreground hover:text-foreground h-7 px-2",children:[u.jsx(ld,{className:"h-3 w-3"}),u.jsx("span",{className:"max-w-24 truncate",children:o.label}),n?u.jsx(ca,{className:"h-3 w-3"}):u.jsx(Kt,{className:"h-3 w-3"})]})}),u.jsx(Dl,{className:"w-64 p-1",align:"start",children:Ir.map(s=>u.jsxs("button",{type:"button",onClick:()=>{t(s.value),r(!1)},className:"flex w-full items-start gap-2 rounded-md px-2.5 py-2 text-left hover:bg-surface-2 transition-colors",children:[u.jsx("span",{className:"mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center",children:e===s.value&&u.jsx(un,{className:"h-3.5 w-3.5 text-brand"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-sm font-medium text-text-primary",children:s.label}),u.jsx("div",{className:"text-xs text-text-muted",children:s.description})]})]},s.value))})]})}function $s(e){return e==="completed"?"complete":e==="failed"?"error":"running"}function Mr(e,t){for(let n=e.length-1;n>=0;n--){const r=e[n];if(r&&r.type==="tool_call"&&r.toolCall.id===t)return n}return-1}function Yv({client:e,agentId:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!1),[a,i]=p.useState(!1),[m,f]=p.useState(null),l=p.useRef(null),c=p.useRef(n);c.current=n;const[d,h]=p.useState(null),g=p.useRef(null),[v,C]=p.useState(()=>localStorage.getItem("acp_permission_mode")||"default"),[b,_]=p.useState(e.usage),[A,E]=p.useState(e.currentModeId),[L,k]=p.useState(!1),{commands:j}=Ov(e),{availableModels:x,currentModel:y,setModel:T}=sc(e);p.useEffect(()=>{l.current=m},[m]);const M=p.useCallback(()=>{r([]),s(!1),i(!1),_(null),E(null)},[]),O=t?`acp_last_session_${t}`:null,F=p.useCallback((N,D)=>{if(((D==null?void 0:D.resetEntries)??!0)&&(r([]),s(!1)),f(N),i(!0),k(e.supportsImages),O)try{localStorage.setItem(O,N)}catch{}console.log("[ChatInterface] Active session:",N,"supportsImages:",e.supportsImages)},[e,O]),I=p.useCallback(N=>{l.current&&N.sessionId!==l.current||(console.log("[ChatInterface] Permission request:",N),r(D=>{const $=Mr(D,N.toolCall.toolCallId);if($>=0)return D.map((R,H)=>H!==$||R.type!=="tool_call"||R.toolCall.status!=="running"?R:{type:"tool_call",toolCall:{...R.toolCall,status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options}}});{console.log("[ChatInterface] No matching tool call, creating standalone permission request");const R={type:"tool_call",toolCall:{id:N.toolCall.toolCallId,title:N.toolCall.title||"Permission Request",status:"waiting_for_confirmation",permissionRequest:{requestId:N.requestId,options:N.options},isStandalonePermission:!0}};return[...D,R]}}))},[]),z=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;r(R=>{const H=R[R.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"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"message",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"message",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"message",text:$}]};return[...R,G]})}else if(D.sessionUpdate==="agent_thought_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;r(R=>{const H=R[R.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"?[...R.slice(0,-1),{...H,chunks:[...H.chunks.slice(0,-1),{type:"thought",text:K.text+$}]}]:[...R.slice(0,-1),{...H,chunks:[...H.chunks,{type:"thought",text:$}]}]}const G={type:"assistant_message",id:`assistant-${Date.now()}`,chunks:[{type:"thought",text:$}]};return[...R,G]})}else if(D.sessionUpdate==="user_message_chunk"){const $=D.content.type==="text"&&D.content.text?D.content.text:"";if(!$)return;r(R=>{const H=R[R.length-1];if((H==null?void 0:H.type)==="user_message")return[...R.slice(0,-1),{...H,content:H.content+$}];const G={type:"user_message",id:`user-${Date.now()}`,content:$};return[...R,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};r(R=>{const H=Mr(R,D.toolCallId);if(H>=0)return R.map((K,V)=>V!==H||K.type!=="tool_call"?K:{type:"tool_call",toolCall:{...K.toolCall,...$}});const G={type:"tool_call",toolCall:$};return[...R,G]})}else D.sessionUpdate==="tool_call_update"?r($=>{const R=Mr($,D.toolCallId);if(R<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!==R||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"?r($=>{if(D.entries.length===0)return $.filter(G=>G.type!=="plan");const R=$.reduce((G,K,V)=>K.type==="plan"?V:G,-1);if(R>=0)return $.map((G,K)=>K===R?{...G,entries:D.entries}:G);const H={type:"plan",id:`plan-${Date.now()}`,entries:D.entries};return[...$,H]}):D.sessionUpdate==="usage_update"?_(D):D.sessionUpdate==="current_mode_update"&&E(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),M()}),e.setSessionUpdateHandler((D,$)=>{z(D,$)}),e.setPromptCompleteHandler(D=>{console.log("[ChatInterface] Prompt complete:",D),s(!1)}),e.setPermissionRequestHandler(I),e.setErrorMessageHandler(D=>{console.error("[ChatInterface] Agent error:",D),h(D),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>h(null),5e3)});const N=O?localStorage.getItem(O):null;return N&&(e.supportsLoadSession||e.supportsResumeSession)?(console.log("[ChatInterface] Restoring session:",N),(async()=>{try{e.supportsLoadSession?await e.loadSession({sessionId:N}):await e.resumeSession({sessionId:N})}catch($){console.warn("[ChatInterface] Failed to restore session, creating new one:",$),e.createSession(void 0,v)}})()):e.createSession(void 0,v),()=>{g.current&&clearTimeout(g.current),e.setSessionCreatedHandler(()=>{}),e.setSessionLoadedHandler(()=>{}),e.setSessionSwitchingHandler(null),e.setSessionUpdateHandler(()=>{}),e.setPromptCompleteHandler(()=>{}),e.setPermissionRequestHandler(()=>{}),e.setErrorMessageHandler(()=>{})}},[F,e,I,z,M]);const S=p.useCallback(()=>{console.log("[ChatInterface] Creating new session..."),o&&e.cancel(),M(),f(null),e.createSession(void 0,v)},[e,o,M,v]),w=()=>{console.log("[ChatInterface] Cancel requested"),r(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 R=$==="reject_once"||$==="reject_always"||D===null;r(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 R?K="rejected":G.toolCall.isStandalonePermission?K="complete":K="running",{type:"tool_call",toolCall:{...G.toolCall,status:K,permissionRequest:void 0,isStandalonePermission:void 0}}}))},[e]),P=n.filter(N=>N.type==="tool_call"&&N.toolCall.status==="waiting_for_confirmation"&&!!N.toolCall.permissionRequest).map(N=>({requestId:N.toolCall.permissionRequest.requestId,toolName:N.toolCall.title,toolInput:N.toolCall.rawInput||{},description:N.toolCall.title,options:N.toolCall.permissionRequest.options})),U=p.useCallback((N,D)=>{const $=P.find(G=>G.requestId===N);let R=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&&(R=G.optionId,H=G.kind)}else{const G=$.options.find(K=>K.kind==="reject_once")??$.options.find(K=>K.kind==="reject_always");G&&(R=G.optionId,H=G.kind)}R||(H=D?"allow_once":"reject_once"),B(N,R,H)},[B,P]),q=p.useCallback(async N=>{var ne;const D=N.text.trim(),$=N.images||[],R=N.attachments||[];if(!D&&$.length===0&&R.length===0||!a)return;if(D.startsWith("/")&&$.length===0){kt("[ChatInterface] slash command input",{text:D});const Z=await Gv(D,{sessionId:m,availableCommands:j,availableModels:x,currentModel:y,supportsImages:L,entries:c.current,setModel:T,onNewSession:S}).catch(()=>null);if(Z){if(kt("[ChatInterface] local command handled",Z),"clearEntries"in Z&&Z.clearEntries){r([]);return}if("newSession"in Z&&Z.newSession){S();return}if("userEntry"in Z){r(re=>[...re,Z.userEntry,Z.cmdEntry]);return}}kt("[ChatInterface] slash command NOT in LOCAL_COMMANDS, forwarding to agent",{text:D})}kt("[ChatInterface] forwarding to agent",{text:D,hasImages:$.length>0,sessionReady:a,isLoading:o});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=Kv(re):ue=await(await fetch(re)).blob();let be=ue,de=Z.mimeType;if(ue.size>2*1024*1024){const ie=new File([ue],"image.jpg",{type:ue.type});be=await je(ie,Vv),de="image/jpeg"}const ye=await new Promise((ie,ge)=>{const we=new FileReader;we.onloadend=()=>{const me=we.result,_e=me.indexOf(",");ie(_e>=0?me.slice(_e+1):me)},we.onerror=()=>{var me;return ge(new Error("FileReader error: "+((me=we.error)==null?void 0:me.message)))},we.readAsDataURL(be)}),fe={type:"image",mimeType:de,data:ye};H.push(fe),G.push({mimeType:de,data:ye})}catch(re){console.error("[ChatInterface] Failed to process image:",re)}const K=[];for(const Z of R)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} 个文件)
262
262
  ${Z.textContent}`}else{const ue=Z.size!=null?` (${Xv(Z.size)})`:"";re=`📎 ${Z.name}${ue}
263
263
  \`\`\`
264
264
  ${Z.textContent}
265
- \`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:D,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};o(Z=>[...Z,V]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[r,a,e,j,x,y,L,m,T,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(dx,{entries:n,isLoading:r&&!a?!1:r,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(Ex,{requests:P,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[u.jsx("span",{children:d}),u.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(qv,{mode:A??v,onModeChange:N=>{E(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Pv,{client:e}),u.jsx(Ax,{usage:b})]}),n.length>0&&u.jsxs(sg,{children:[u.jsx(ag,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(fa,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(ig,{children:"New Thread"})]})]}),u.jsx(wx,{onSubmit:q,isLoading:r,onInterrupt:w,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Xv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qv({client:e,agentId:t}){const[n,o]=p.useState(!1),r=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return u.jsxs("div",{className:"flex h-full w-full",children:[u.jsxs("div",{className:ee("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(fa,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>o(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?u.jsx(qu,{className:"h-4 w-4"}):u.jsx(Vu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Zv,{client:e,onSelectSession:r})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Yv,{client:e,agentId:t})})]})}function Zv({client:e,onSelectSession:t}){const[n,o]=p.useState([]),[r,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();o(j.sessions)}catch(j){console.warn("[SidebarSessionList] Failed to load:",j)}finally{s(!1)}},[e]);p.useEffect(()=>{e.getState()==="connected"&&e.supportsSessionList&&v()},[e,v]),p.useEffect(()=>{const j=x=>{x==="connected"&&setTimeout(v,200)};return e.setConnectionStateHandler(j),()=>e.removeConnectionStateHandler(j)},[e,v]),p.useEffect(()=>{const j=setInterval(v,1e4);return()=>clearInterval(j)},[v]),p.useEffect(()=>{e.setSessionDeletedHandler(j=>{v()}),e.setSessionRenamedHandler((j,x)=>{v()})},[e,v]),p.useEffect(()=>{e.setErrorMessageHandler(j=>{/Method not found/i.test(j)&&/session\/(rename|delete)/i.test(j)&&(h(!1),f(null))})},[e]),p.useEffect(()=>{m&&g.current&&(g.current.focus(),g.current.select())},[m]);const C=p.useCallback(j=>{const x=j.title&&j.title.trim()?j.title:j.sessionId.slice(0,8);if(window.confirm(`删除会话 "${x}"?此操作不可恢复。`))try{e.deleteSession(j.sessionId),o(y=>y.filter(T=>T.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),o(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),E=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),A())},[_,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(r&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=Jv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const T=m===y.sessionId;return u.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",y.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(zu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),T?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:E,onBlur:_,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:M=>M.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(y.sessionId),t(y)},className:"flex-1 min-w-0 text-left",title:y.title||y.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:y.title&&y.title.trim()?y.title:"新会话"})}),T?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&b(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(Zu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(gd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Jv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),o=new Date(n.getTime()-864e5),r=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?r[0].sessions.push(s):a>=o?r[1].sessions.push(s):r[2].sessions.push(s)}return r.filter(s=>s.sessions.length>0)}function eb({url:e,token:t,onBack:n}){const[o,r]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Gr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,r(l),l.connect().catch(c=>{c instanceof Bi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,r(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!o&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),o&&s==="connected"&&u.jsx(Qv,{client:o})]})}const Qr="rcs_admin_key";function tb(){try{return localStorage.getItem(Qr)}catch{return null}}function nb(){const[e,t]=p.useState(tb),n=p.useCallback(o=>{const r=o.trim();t(r||null);try{r?localStorage.setItem(Qr,r):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>Ae(()=>import("./Dashboard-DxcBkyhD.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),rb=p.lazy(()=>Ae(()=>import("./SessionDetail-CC1Y-JXz.js"),__vite__mapDeps([8,2,4,6,9,10,5,11,1,7])).then(e=>({default:e.SessionDetail}))),ob=p.lazy(()=>Ae(()=>import("./ShareLanding-B7ZdGScC.js"),__vite__mapDeps([12,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>Ae(()=>import("./ArtifactsGallery-B3OCFJ7T.js").then(e=>e.a),__vite__mapDeps([9,2,6,10])).then(e=>({default:e.ArtifactsGallery}))),sb=p.lazy(()=>Ae(()=>import("./ArtifactView-CUDKNi6z.js"),__vite__mapDeps([13,2,9,6,10,1,7])).then(e=>({default:e.ArtifactView}))),ab=p.lazy(()=>Ae(()=>import("./Claim-BOkou3Kj.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.Claim}))),ib=p.lazy(()=>Ae(()=>import("./Login-Ct6Z1ih0.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Login}))),lb=p.lazy(()=>Ae(()=>import("./Register-D3Sub3V4.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Register}))),cb=p.lazy(()=>Ae(()=>import("./Setup-COecVpRC.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Setup}))),ub=p.lazy(()=>Ae(()=>import("./Join-DZ_EUsnw.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Join}))),db=p.lazy(()=>Ae(()=>import("./UserSettings-9wOVTete.js"),__vite__mapDeps([19,2,10,1,7])).then(e=>({default:e.UserSettings}))),fb=p.lazy(()=>Ae(()=>import("./TeamList-B2kk8eh4.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.TeamList}))),mb=p.lazy(()=>Ae(()=>import("./TeamCreate-BKeJj9CV.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamCreate}))),pb=p.lazy(()=>Ae(()=>import("./TeamDetail-BAG50yxf.js"),__vite__mapDeps([22,2,11,10,4,1,7])).then(e=>({default:e.TeamDetail}))),hb=p.lazy(()=>Ae(()=>import("./TeamSettings-h8JWw1pp.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamSettings}))),gb=p.lazy(()=>Ae(()=>import("./AdminPanel-DMClbUbi.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.AdminPanel}))),xb=new Set(["login","register","setup","join","share"]),vb=new Set(["login","register","setup","join"]);function bb(){return u.jsx(Cd,{defaultTheme:"system",children:u.jsx(wh,{children:u.jsx(yb,{})})})}function yb(){const[e,t]=p.useState("dashboard"),[n,o]=p.useState(null),[r,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=nb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{fh(d)},[d]);const[C,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const _=p.useCallback(()=>{const T=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const N=new URL(window.location.href);N.searchParams.delete("acp"),window.history.replaceState(null,"",N),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=M.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),o(F),f(null),t("session");return}if(T==="/login"){t("login");return}if(T==="/register"){t("register");return}if(T==="/setup"){t("setup");return}if(T==="/join"){t("join");return}if(T==="/settings"){t("settings");return}if(T==="/admin"){t("admin");return}if(T==="/teams/new"){t("team-create");return}if(T.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(T.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(T==="/teams"){t("teams");return}const S=T.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),o(null),s(void 0),t("share");return}const w=T.match(/^\/code\/a\/([^/]+)/);if(w&&w[1]){i(w[1]),o(null),s(void 0),f(null),t("artifact-view");return}if(T==="/code/artifacts"||T==="/code/artifacts/"){i(null),o(null),s(void 0),f(null),t("artifacts");return}const B=T.match(/^\/code\/claim\/([^/]+)/);if(B&&B[1]){t("claim");return}const P=T.match(/^\/code\/([^/]+)/);P&&P[1]?(o(P[1]),s(void 0),f(null),t("session")):(o(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(_(),window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)),[_]);const A=p.useCallback(T=>{window.history.pushState(null,"",`/code/${T}`),o(T),s(void 0),f(null),i(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),o(null),s(void 0),f(null),t("artifacts")},[]),L=p.useCallback(()=>{window.history.pushState(null,"","/code/"),o(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let T=e;return g||(C&&T!=="setup"&&T!=="join"&&(T="setup"),!h&&!xb.has(T)&&(T="login"),h&&(T==="login"||T==="setup")&&(T="dashboard")),T})();if(p.useEffect(()=>{g||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&h&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,h,g]),g)return u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const j=()=>{if(l&&k==="acp")return u.jsx(eb,{url:l.url,token:l.token,onBack:L});switch(k){case"login":return u.jsx(ib,{onSuccess:L,onNavigateRegister:()=>t("register")});case"register":return u.jsx(lb,{onSuccess:L,onBack:()=>t("login")});case"setup":return u.jsx(cb,{onSuccess:L,onAlreadyDone:L});case"join":return u.jsx(ub,{onSuccess:L,onInvalidInvite:L});case"settings":return u.jsx(db,{});case"teams":return u.jsx(fb,{});case"team-create":return u.jsx(mb,{});case"team-detail":return u.jsx(pb,{});case"team-settings":return u.jsx(hb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Fe("nav.dashboard")})]})}):u.jsx(gb,{});case"share":return u.jsx(ob,{});case"claim":return u.jsx(ab,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(sb,{artifactId:a,onBack:E}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(rb,{sessionId:n,onSessionLoaded:T=>s(T.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})})}},x=!vb.has(k),y=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Sh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":r,onBack:n||l||m?L:void 0,onNavigateArtifacts:y?void 0:E}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:j()})]})}Lv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(bb,{})}));export{Ub as $,Gr as A,ve as B,wx as C,Bi as D,Qb as E,Ru as F,Bb as G,ey as H,Wb as I,Kb as J,ty as K,ua as L,Mv as M,zb as N,uv as O,Zu as P,Pb as Q,ay as R,sd as S,oy as T,bd as U,Jb as V,Zb as W,dn as X,Lb as Y,Ob as Z,Db as _,Qv as a,Vb as a0,Hb as a1,Gb as a2,qb as a3,$b as a4,Fb as a5,Yb as a6,Xb as a7,Ks as a8,ee as a9,Dv as aa,ae as ab,kt as ac,au as ad,Eb as ae,jb as af,Mb as ag,ph as ah,Rb as ai,_b as aj,Tb as ak,Ib as al,Fe as am,Ab as an,Gv as ao,su as ap,zi as aq,Fi as ar,vh as as,wr as b,dx as c,un as d,Kt as e,ca as f,ju as g,sy as h,dv as i,Pi as j,Di as k,Tn as l,sh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,cv as t,lv as u,ld as v,fd as w,ny as x,og as y,gd as z};
265
+ \`\`\``}H.push({type:"text",text:re}),K.push(Z)}}catch(re){console.error("[ChatInterface] Failed to process attachment:",re)}if(H.length===0)return;const V={type:"user_message",id:`user-${Date.now()}`,content:D,images:G.length>0?G:void 0,attachments:K.length>0?K:void 0};r(Z=>[...Z,V]),s(!0);try{await e.sendPrompt(H)}catch(Z){console.error("[ChatInterface] Failed to send prompt:",Z),s(!1)}},[o,a,e,j,x,y,L,m,T,S]);return u.jsxs("div",{className:"flex flex-col h-full",children:[u.jsx(dx,{entries:n,isLoading:o&&!a?!1:o,onPermissionRespond:(N,D,$)=>{B(N,D,$)},emptyTitle:a?"开始对话":void 0,emptyDescription:a?"输入消息开始与 ACP agent 聊天":void 0}),u.jsx(Ex,{requests:P,onRespond:U}),d&&u.jsx("div",{className:"mx-auto max-w-3xl w-full px-4 sm:px-8 pb-1",children:u.jsxs("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-sm text-red-700 dark:text-red-300 flex items-center justify-between",children:[u.jsx("span",{children:d}),u.jsx("button",{type:"button",onClick:()=>h(null),className:"ml-2 text-red-500 hover:text-red-700 dark:text-red-400 dark:hover:text-red-200 flex-shrink-0",children:"×"})]})}),u.jsxs("div",{className:"flex-shrink-0",children:[u.jsxs("div",{className:"max-w-3xl mx-auto w-full px-4 sm:px-8 pb-1 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(qv,{mode:A??v,onModeChange:N=>{E(null),C(N),localStorage.setItem("acp_permission_mode",N)}}),u.jsx(Pv,{client:e}),u.jsx(Ax,{usage:b})]}),n.length>0&&u.jsxs(sg,{children:[u.jsx(ag,{asChild:!0,children:u.jsxs(Rt,{variant:"ghost",size:"sm",className:"h-7 text-xs text-text-muted hover:text-brand font-display gap-1",onClick:S,children:[u.jsx(fa,{className:"h-3 w-3"}),"新会话"]})}),u.jsx(ig,{children:"New Thread"})]})]}),u.jsx(wx,{onSubmit:q,isLoading:o,onInterrupt:w,disabled:!a,placeholder:a?"给 Saluzi 发送消息…":"等待会话...",supportsAttachments:L,commands:j.length>0?j:void 0,queueWhileLoading:!0})]})]})}function Xv(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qv({client:e,agentId:t}){const[n,r]=p.useState(!1),o=p.useCallback(async s=>{try{if(e.supportsLoadSession)await e.loadSession({sessionId:s.sessionId,cwd:s.cwd});else if(e.supportsResumeSession)await e.resumeSession({sessionId:s.sessionId,cwd:s.cwd});else throw new Error("Loading or resuming sessions is not supported by this agent.")}catch(a){console.error("Failed to load/resume session:",a)}},[e]);return u.jsxs("div",{className:"flex h-full w-full",children:[u.jsxs("div",{className:ee("hidden md:flex flex-col border-r border-border/60 bg-surface-1/50 transition-all duration-200 flex-shrink-0",n?"w-12":"w-64"),children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-4",children:[!n&&u.jsx("span",{className:"text-xs font-display font-semibold text-text-muted uppercase tracking-widest px-1",children:"会话"}),u.jsxs("div",{className:ee("flex items-center gap-0.5",n&&"mx-auto"),children:[!n&&u.jsx("button",{type:"button",onClick:()=>{},className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"新会话",children:u.jsx(fa,{className:"h-4 w-4"})}),u.jsx("button",{type:"button",onClick:()=>r(!n),className:"h-7 w-7 flex items-center justify-center rounded-lg text-text-muted hover:text-text-primary hover:bg-surface-2 transition-colors",children:n?u.jsx(qu,{className:"h-4 w-4"}):u.jsx(Vu,{className:"h-4 w-4"})})]})]}),!n&&u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Zv,{client:e,onSelectSession:o})})]}),u.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:u.jsx(Yv,{client:e,agentId:t})})]})}function Zv({client:e,onSelectSession:t}){const[n,r]=p.useState([]),[o,s]=p.useState(!0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(""),[d,h]=p.useState(!0),g=p.useRef(null),v=p.useCallback(async()=>{if(!e.supportsSessionList){s(!1);return}s(!0);try{const j=await e.listSessions();r(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),r(y=>y.filter(T=>T.sessionId!==j.sessionId)),a===j.sessionId&&i(null)}catch(y){console.error("[SidebarSessionList] delete failed:",y)}},[e,a]),b=p.useCallback(j=>{f(j.sessionId),c(j.title&&j.title.trim()?j.title:"")},[]),_=p.useCallback(()=>{if(!m)return;const j=l.trim();if(!j){f(null);return}try{e.renameSession(m,j),r(x=>x.map(y=>y.sessionId===m?{...y,title:j}:y))}catch(x){console.error("[SidebarSessionList] rename failed:",x)}f(null)},[e,m,l]),A=p.useCallback(()=>{f(null)},[]),E=p.useCallback(j=>{j.key==="Enter"?(j.preventDefault(),_()):j.key==="Escape"&&(j.preventDefault(),A())},[_,A]),L=p.useMemo(()=>[...n].sort((j,x)=>{const y=j.updatedAt?new Date(j.updatedAt).getTime():0;return(x.updatedAt?new Date(x.updatedAt).getTime():0)-y}),[n]);if(o&&n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"加载中..."})});if(n.length===0)return u.jsx("div",{className:"flex items-center justify-center py-8",children:u.jsx("span",{className:"text-xs text-text-muted font-display",children:"暂无会话"})});const k=Jv(L);return u.jsx("nav",{className:"py-1","aria-label":"历史会话",children:k.map((j,x)=>u.jsxs("div",{children:[x>0&&u.jsx("div",{className:"mx-3 my-2 border-t border-border/40"}),u.jsx("div",{className:"px-4 py-2",children:u.jsx("span",{className:"text-[10px] font-display font-semibold uppercase tracking-widest text-text-muted/70",children:j.label})}),j.sessions.map(y=>{const T=m===y.sessionId;return u.jsxs("div",{className:ee("group relative flex items-center gap-2.5 px-4 py-2 transition-colors",y.sessionId===a?"bg-brand/8 text-text-primary":"text-text-secondary hover:bg-surface-2/60 hover:text-text-primary"),children:[u.jsx(zu,{className:"h-3.5 w-3.5 flex-shrink-0 opacity-50"}),T?u.jsx("input",{ref:g,type:"text",value:l,onChange:M=>c(M.target.value),onKeyDown:E,onBlur:_,className:"flex-1 min-w-0 bg-surface-2 border border-border rounded px-1 py-0.5 text-[13px] font-display text-text-primary outline-none focus:border-brand",onClick:M=>M.stopPropagation()}):u.jsx("button",{type:"button",onClick:()=>{i(y.sessionId),t(y)},className:"flex-1 min-w-0 text-left",title:y.title||y.sessionId,children:u.jsx("span",{className:"text-[13px] font-display truncate leading-snug block",children:y.title&&y.title.trim()?y.title:"新会话"})}),T?u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[u.jsx("button",{type:"button",onClick:_,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-brand hover:bg-brand/10 transition-colors",title:"确认",children:u.jsx(un,{className:"h-3.5 w-3.5"})}),u.jsx("button",{type:"button",onClick:A,className:"h-6 w-6 flex items-center justify-center rounded text-text-muted hover:text-status-error hover:bg-status-error/10 transition-colors",title:"取消",children:u.jsx(dn,{className:"h-3.5 w-3.5"})})]}):u.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",title:d?void 0:"该 agent 不支持会话管理(重命名/删除)",children:[u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&b(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-brand hover:bg-brand/10":"text-text-muted/30 cursor-not-allowed"),title:d?"重命名":"该 agent 不支持会话重命名",children:u.jsx(Zu,{className:"h-3 w-3"})}),u.jsx("button",{type:"button",disabled:!d,onClick:M=>{M.stopPropagation(),d&&C(y)},className:ee("h-6 w-6 flex items-center justify-center rounded transition-colors",d?"text-text-muted hover:text-status-error hover:bg-status-error/10":"text-text-muted/30 cursor-not-allowed"),title:d?"删除":"该 agent 不支持会话删除",children:u.jsx(gd,{className:"h-3 w-3"})})]})]},y.sessionId)})]},j.label))})}function Jv(e){const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r=new Date(n.getTime()-864e5),o=[{label:"今天",sessions:[]},{label:"昨天",sessions:[]},{label:"更早",sessions:[]}];for(const s of e){const a=s.updatedAt?new Date(s.updatedAt):new Date(0);a>=n?o[0].sessions.push(s):a>=r?o[1].sessions.push(s):o[2].sessions.push(s)}return o.filter(s=>s.sessions.length>0)}function eb({url:e,token:t,onBack:n}){const[r,o]=p.useState(null),[s,a]=p.useState("disconnected"),[i,m]=p.useState(null),f=p.useRef(null);return p.useEffect(()=>{const l=new Gr({proxyUrl:e,token:t});return l.setConnectionStateHandler((c,d)=>{a(c),m(d||null)}),f.current=l,o(l),l.connect().catch(c=>{c instanceof Bi||(m(c.message),a("error"))}),()=>{l.disconnect(),f.current=null,o(null),a("disconnected")}},[e,t]),u.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[i&&s==="error"&&u.jsxs("div",{className:"px-4 py-2 bg-status-error/10 text-status-error text-sm border-b",children:[i,u.jsx("button",{onClick:n,className:"ml-3 underline hover:no-underline",children:"Back to Dashboard"})]}),s==="connecting"&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-brand border-t-transparent rounded-full mx-auto mb-3"}),u.jsx("p",{className:"text-text-muted text-sm",children:"Connecting to ACP agent..."})]})}),s==="error"&&!r&&u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"font-medium mb-1",children:"Connection Failed"}),u.jsx("p",{className:"text-text-muted text-sm mb-3",children:i}),u.jsx("button",{onClick:n,className:"rounded-lg bg-brand px-4 py-2 text-sm font-medium text-white hover:bg-brand-light transition-colors",children:"Back to Dashboard"})]})}),r&&s==="connected"&&u.jsx(Qv,{client:r})]})}const Qr="rcs_admin_key";function tb(){try{return localStorage.getItem(Qr)}catch{return null}}function nb(){const[e,t]=p.useState(tb),n=p.useCallback(r=>{const o=r.trim();t(o||null);try{o?localStorage.setItem(Qr,o):localStorage.removeItem(Qr)}catch{}},[]);return{adminKey:e,setAdminKey:n}}const Us=p.lazy(()=>Ae(()=>import("./Dashboard-jAe3pVfO.js"),__vite__mapDeps([3,2,4,5,6,1,7])).then(e=>({default:e.Dashboard}))),rb=p.lazy(()=>Ae(()=>import("./SessionDetail-DLqYCAa1.js"),__vite__mapDeps([8,2,4,6,9,10,5,11,1,7])).then(e=>({default:e.SessionDetail}))),ob=p.lazy(()=>Ae(()=>import("./ShareLanding-ChhDZDz-.js"),__vite__mapDeps([12,2,1,7])).then(e=>({default:e.ShareLanding}))),zs=p.lazy(()=>Ae(()=>import("./ArtifactsGallery-EA1PTLFb.js").then(e=>e.a),__vite__mapDeps([9,2,6,10])).then(e=>({default:e.ArtifactsGallery}))),sb=p.lazy(()=>Ae(()=>import("./ArtifactView-gpttL9Bm.js"),__vite__mapDeps([13,2,9,6,10,1,7])).then(e=>({default:e.ArtifactView}))),ab=p.lazy(()=>Ae(()=>import("./Claim-CcQDX4V4.js"),__vite__mapDeps([14,2,1,7])).then(e=>({default:e.Claim}))),ib=p.lazy(()=>Ae(()=>import("./Login-1UQ7Tsno.js"),__vite__mapDeps([15,2,1,7])).then(e=>({default:e.Login}))),lb=p.lazy(()=>Ae(()=>import("./Register-PLzfxLKv.js"),__vite__mapDeps([16,2,1,7])).then(e=>({default:e.Register}))),cb=p.lazy(()=>Ae(()=>import("./Setup-eKrRj_Cj.js"),__vite__mapDeps([17,2,1,7])).then(e=>({default:e.Setup}))),ub=p.lazy(()=>Ae(()=>import("./Join-z-lybdiB.js"),__vite__mapDeps([18,2,1,7])).then(e=>({default:e.Join}))),db=p.lazy(()=>Ae(()=>import("./UserSettings--GHQVpb4.js"),__vite__mapDeps([19,2,10,1,7])).then(e=>({default:e.UserSettings}))),fb=p.lazy(()=>Ae(()=>import("./TeamList-8zi79KWI.js"),__vite__mapDeps([20,2,1,7])).then(e=>({default:e.TeamList}))),mb=p.lazy(()=>Ae(()=>import("./TeamCreate-yh6hBIjW.js"),__vite__mapDeps([21,2,1,7])).then(e=>({default:e.TeamCreate}))),pb=p.lazy(()=>Ae(()=>import("./TeamDetail-V_nG-5yy.js"),__vite__mapDeps([22,2,11,10,4,1,7])).then(e=>({default:e.TeamDetail}))),hb=p.lazy(()=>Ae(()=>import("./TeamSettings-D7NuRKfx.js"),__vite__mapDeps([23,2,1,7])).then(e=>({default:e.TeamSettings}))),gb=p.lazy(()=>Ae(()=>import("./AdminPanel-omPQCGJ3.js"),__vite__mapDeps([24,2,1,7])).then(e=>({default:e.AdminPanel}))),xb=new Set(["login","register","setup","join","share"]),vb=new Set(["login","register","setup","join"]);function bb(){return u.jsx(Cd,{defaultTheme:"system",children:u.jsx(wh,{children:u.jsx(yb,{})})})}function yb(){const[e,t]=p.useState("dashboard"),[n,r]=p.useState(null),[o,s]=p.useState(void 0),[a,i]=p.useState(null),[m,f]=p.useState(null),[l,c]=p.useState(null),{adminKey:d}=nb(),{user:h,isLoading:g,checkSetupStatus:v}=zi();p.useEffect(()=>{fh(d)},[d]);const[C,b]=p.useState(!1);p.useEffect(()=>{!g&&!h?v().then(b):h&&b(!1)},[g,h,v]);const _=p.useCallback(()=>{const T=window.location.pathname,M=new URLSearchParams(window.location.search);if(M.get("acp")==="1"){const U=sessionStorage.getItem("acp_connection");if(U)try{const q=JSON.parse(U);if(q.url&&q.token){c({url:q.url,token:q.token}),sessionStorage.removeItem("acp_connection");const N=new URL(window.location.href);N.searchParams.delete("acp"),window.history.replaceState(null,"",N),t("acp");return}}catch{sessionStorage.removeItem("acp_connection")}}const F=M.get("sid");if(F){new URL(window.location.href).searchParams.delete("sid"),window.history.replaceState(null,"",`/code/${F}`),r(F),f(null),t("session");return}if(T==="/login"){t("login");return}if(T==="/register"){t("register");return}if(T==="/setup"){t("setup");return}if(T==="/join"){t("join");return}if(T==="/settings"){t("settings");return}if(T==="/admin"){t("admin");return}if(T==="/teams/new"){t("team-create");return}if(T.match(/^\/teams\/([^/]+)\/settings$/)){t("team-settings");return}if(T.match(/^\/teams\/([^/]+)$/)){t("team-detail");return}if(T==="/teams"){t("teams");return}const S=T.match(/^\/code\/s\/([^/]+)/);if(S&&S[1]){f(S[1]),r(null),s(void 0),t("share");return}const w=T.match(/^\/code\/a\/([^/]+)/);if(w&&w[1]){i(w[1]),r(null),s(void 0),f(null),t("artifact-view");return}if(T==="/code/artifacts"||T==="/code/artifacts/"){i(null),r(null),s(void 0),f(null),t("artifacts");return}const B=T.match(/^\/code\/claim\/([^/]+)/);if(B&&B[1]){t("claim");return}const P=T.match(/^\/code\/([^/]+)/);P&&P[1]?(r(P[1]),s(void 0),f(null),t("session")):(r(null),s(void 0),f(null),t("dashboard"))},[]);p.useEffect(()=>(_(),window.addEventListener("popstate",_),()=>window.removeEventListener("popstate",_)),[_]);const A=p.useCallback(T=>{window.history.pushState(null,"",`/code/${T}`),r(T),s(void 0),f(null),i(null),t("session")},[]),E=p.useCallback(()=>{window.history.pushState(null,"","/code/artifacts"),i(null),r(null),s(void 0),f(null),t("artifacts")},[]),L=p.useCallback(()=>{window.history.pushState(null,"","/code/"),r(null),s(void 0),f(null),i(null),c(null),t("dashboard")},[]),k=(()=>{let T=e;return g||(C&&T!=="setup"&&T!=="join"&&(T="setup"),!h&&!xb.has(T)&&(T="login"),h&&(T==="login"||T==="setup")&&(T="dashboard")),T})();if(p.useEffect(()=>{g||(k==="setup"&&window.location.pathname!=="/setup"?window.history.replaceState(null,"","/setup"):k==="login"&&window.location.pathname!=="/login"?window.history.replaceState(null,"","/login"):k==="dashboard"&&h&&window.location.pathname!=="/code/"&&window.history.replaceState(null,"","/code/"))},[k,h,g]),g)return u.jsx("div",{className:"flex h-screen items-center justify-center bg-surface-0 text-text-muted",children:"Loading..."});const j=()=>{if(l&&k==="acp")return u.jsx(eb,{url:l.url,token:l.token,onBack:L});switch(k){case"login":return u.jsx(ib,{onSuccess:L,onNavigateRegister:()=>t("register")});case"register":return u.jsx(lb,{onSuccess:L,onBack:()=>t("login")});case"setup":return u.jsx(cb,{onSuccess:L,onAlreadyDone:L});case"join":return u.jsx(ub,{onSuccess:L,onInvalidInvite:L});case"settings":return u.jsx(db,{});case"teams":return u.jsx(fb,{});case"team-create":return u.jsx(mb,{});case"team-detail":return u.jsx(pb,{});case"team-settings":return u.jsx(hb,{});case"admin":return(h==null?void 0:h.role)!=="admin"?u.jsx("div",{className:"flex flex-1 items-center justify-center",children:u.jsxs("div",{className:"text-center",children:[u.jsx("p",{className:"text-status-error",children:"403 — Admin access required"}),u.jsx("a",{href:"/code/",className:"mt-4 inline-block text-brand hover:underline",children:Fe("nav.dashboard")})]})}):u.jsx(gb,{});case"share":return u.jsx(ob,{});case"claim":return u.jsx(ab,{});case"artifacts":return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"artifact-view":return a?u.jsx(sb,{artifactId:a,onBack:E}):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(zs,{})});case"session":return n?u.jsx(rb,{sessionId:n,onSessionLoaded:T=>s(T.source)},n):u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})});default:return u.jsx("div",{className:"flex-1 overflow-y-auto",children:u.jsx(Us,{onNavigateSession:A})})}},x=!vb.has(k),y=k==="artifact-view";return u.jsxs("div",{className:"flex h-screen flex-col bg-surface-0 text-text-primary",children:[x&&u.jsx(Sh,{sessionTitle:n||(l?"ACP":void 0),sessionSource:l?"acp":o,onBack:n||l||m?L:void 0,onNavigateArtifacts:y?void 0:E}),u.jsx(p.Suspense,{fallback:u.jsx("div",{className:"flex flex-1 items-center justify-center text-text-muted",children:"Loading..."}),children:j()})]})}Lv();mc.createRoot(document.getElementById("root")).render(u.jsx(p.StrictMode,{children:u.jsx(bb,{})}));export{Pb as $,Gr as A,xe as B,wx as C,Bi as D,Zb as E,Ru as F,Hb as G,ty as H,Gb as I,qb as J,ny as K,ua as L,Mv as M,Bb as N,uv as O,Zu as P,Ob as Q,iy as R,sd as S,sy as T,bd as U,ey as V,Jb as W,dn as X,Fb as Y,Db as Z,Lb as _,Qv as a,zb as a0,Kb as a1,Wb as a2,Vb as a3,Yb as a4,Ub as a5,$b as a6,Xb as a7,Qb as a8,Ks as a9,ee as aa,Dv as ab,ae as ac,kt as ad,au as ae,Eb as af,jb as ag,Mb as ah,ph as ai,Rb as aj,_b as ak,Tb as al,Ib as am,Fe as an,Ab as ao,Gv as ap,su as aq,zi as ar,Fi as as,vh as at,wr as b,dx as c,un as d,Kt as e,ca as f,ju as g,ay as h,dv as i,Pi as j,Di as k,Tn as l,sh as m,ys as n,Oi as o,fa as p,Pl as q,Dl as r,Ol as s,cv as t,lv as u,ld as v,fd as w,ry as x,og as y,gd as z};