@truefoundry/trueforge 0.177.0-rc.4 → 0.178.0-rc.1

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 (226) hide show
  1. package/dist/_frontend/assets/{AgentCodeSnippets-EKIN7ZIE-dOqmAa8Q.js → AgentCodeSnippets-DKA74SI3-C2P2xphc.js} +1 -1
  2. package/dist/_frontend/assets/AgentCodeSnippets-DKA74SI3-C2P2xphc.js.br +0 -0
  3. package/dist/_frontend/assets/AgentCodeSnippets-DKA74SI3-C2P2xphc.js.gz +0 -0
  4. package/dist/_frontend/assets/{AgentMetricChart-ULFKK6JR-oRmx7mu0.js → AgentMetricChart-63ZRCTNR-615ecqfN.js} +1 -1
  5. package/dist/_frontend/assets/AgentMetricChart-63ZRCTNR-615ecqfN.js.br +0 -0
  6. package/dist/_frontend/assets/AgentMetricChart-63ZRCTNR-615ecqfN.js.gz +0 -0
  7. package/dist/_frontend/assets/{AgentOverview-NGCJR4UF-DAIDFsz9.js → AgentOverview-7W5GOPD6-5y2reLPs.js} +1 -1
  8. package/dist/_frontend/assets/AgentOverview-7W5GOPD6-5y2reLPs.js.br +0 -0
  9. package/dist/_frontend/assets/AgentOverview-7W5GOPD6-5y2reLPs.js.gz +0 -0
  10. package/dist/_frontend/assets/{AgentSessionEventTimeline-NDDZQZ2R-BOX-0vGu.js → AgentSessionEventTimeline-ONESE5X3-aKuWxk8m.js} +1 -1
  11. package/dist/_frontend/assets/AgentSessionEventTimeline-ONESE5X3-aKuWxk8m.js.br +0 -0
  12. package/dist/_frontend/assets/AgentSessionEventTimeline-ONESE5X3-aKuWxk8m.js.gz +0 -0
  13. package/dist/_frontend/assets/{AgentSessionEventTimelineChart-5AY5YW4U-CWnxR-xs.js → AgentSessionEventTimelineChart-ARBD6JZP-DMzLBiQT.js} +1 -1
  14. package/dist/_frontend/assets/AgentSessionEventTimelineChart-ARBD6JZP-DMzLBiQT.js.br +0 -0
  15. package/dist/_frontend/assets/AgentSessionEventTimelineChart-ARBD6JZP-DMzLBiQT.js.gz +0 -0
  16. package/dist/_frontend/assets/AgentSessions-DXPVINTL-Cgeq6RVn.js +1 -0
  17. package/dist/_frontend/assets/AgentSessions-DXPVINTL-Cgeq6RVn.js.br +0 -0
  18. package/dist/_frontend/assets/AgentSessions-DXPVINTL-Cgeq6RVn.js.gz +0 -0
  19. package/dist/_frontend/assets/ConnectorSettings-577VW3QM-DsBlk3uo.js +1 -0
  20. package/dist/_frontend/assets/ConnectorSettings-577VW3QM-DsBlk3uo.js.br +0 -0
  21. package/dist/_frontend/assets/ConnectorSettings-577VW3QM-DsBlk3uo.js.gz +0 -0
  22. package/dist/_frontend/assets/{DockLayout-ELMFMPFZ-h7W78kYm.js → DockLayout-UUNWARXJ-xCtCDovt.js} +1 -1
  23. package/dist/_frontend/assets/{DrawerLayout-SYUH47FF-CpDQ95yI.js → DrawerLayout-PQMMP5DR-B04fGweM.js} +2 -2
  24. package/dist/_frontend/assets/DrawerLayout-PQMMP5DR-B04fGweM.js.br +0 -0
  25. package/dist/_frontend/assets/DrawerLayout-PQMMP5DR-B04fGweM.js.gz +0 -0
  26. package/dist/_frontend/assets/EnvironmentsPage-PQZWQZCO-Dr2xxFfN.js +3 -0
  27. package/dist/_frontend/assets/EnvironmentsPage-PQZWQZCO-Dr2xxFfN.js.br +0 -0
  28. package/dist/_frontend/assets/EnvironmentsPage-PQZWQZCO-Dr2xxFfN.js.gz +0 -0
  29. package/dist/_frontend/assets/ModelSettings-VXSENL34-B3igr5Gm.js +1 -0
  30. package/dist/_frontend/assets/ModelSettings-VXSENL34-B3igr5Gm.js.br +0 -0
  31. package/dist/_frontend/assets/ModelSettings-VXSENL34-B3igr5Gm.js.gz +0 -0
  32. package/dist/_frontend/assets/SandboxSettings-EVTKZHMI-DxsDJ9f2.js +1 -0
  33. package/dist/_frontend/assets/SandboxSettings-EVTKZHMI-DxsDJ9f2.js.br +0 -0
  34. package/dist/_frontend/assets/SandboxSettings-EVTKZHMI-DxsDJ9f2.js.gz +0 -0
  35. package/dist/_frontend/assets/SchedulesPage-GE5HOH5X-BqUWx1Up.js +1 -0
  36. package/dist/_frontend/assets/SchedulesPage-GE5HOH5X-BqUWx1Up.js.br +0 -0
  37. package/dist/_frontend/assets/SchedulesPage-GE5HOH5X-BqUWx1Up.js.gz +0 -0
  38. package/dist/_frontend/assets/SettingsBuilder-L4U6XN5B-BjdzxqSN.js +2 -0
  39. package/dist/_frontend/assets/SettingsBuilder-L4U6XN5B-BjdzxqSN.js.br +0 -0
  40. package/dist/_frontend/assets/SettingsBuilder-L4U6XN5B-BjdzxqSN.js.gz +0 -0
  41. package/dist/_frontend/assets/{ShellRouteSync-M5WTXCX5-BMqebF_Z.js → ShellRouteSync-AVUH4WJ4-0FBneogo.js} +1 -1
  42. package/dist/_frontend/assets/ShellRouteSync-AVUH4WJ4-0FBneogo.js.br +0 -0
  43. package/dist/_frontend/assets/ShellRouteSync-AVUH4WJ4-0FBneogo.js.gz +0 -0
  44. package/dist/_frontend/assets/SidebarLayout-MJJUMCYA-BRw3Ei0O.js +2 -0
  45. package/dist/_frontend/assets/SidebarLayout-MJJUMCYA-BRw3Ei0O.js.br +0 -0
  46. package/dist/_frontend/assets/SidebarLayout-MJJUMCYA-BRw3Ei0O.js.gz +0 -0
  47. package/dist/_frontend/assets/SkillSettings-B755K6CA-BI4qn_Eo.js +1 -0
  48. package/dist/_frontend/assets/SkillSettings-B755K6CA-BI4qn_Eo.js.br +0 -0
  49. package/dist/_frontend/assets/SkillSettings-B755K6CA-BI4qn_Eo.js.gz +0 -0
  50. package/dist/_frontend/assets/{TrueForgeUIWithRouter-VAVREKS2-DcaNt4At.js → TrueForgeUIWithRouter-MNNZC3ZW-CWK4gyZK.js} +1 -1
  51. package/dist/_frontend/assets/WebSearchSettings-BJCW6BFI-CbGfcmvV.js +1 -0
  52. package/dist/_frontend/assets/WebSearchSettings-BJCW6BFI-CbGfcmvV.js.br +0 -0
  53. package/dist/_frontend/assets/WebSearchSettings-BJCW6BFI-CbGfcmvV.js.gz +0 -0
  54. package/dist/_frontend/assets/{WidgetLayout-CJYOCWXG-CmkhefQM.js → WidgetLayout-6XVTKSOW-YdgTHyGh.js} +1 -1
  55. package/dist/_frontend/assets/WidgetLayout-6XVTKSOW-YdgTHyGh.js.br +0 -0
  56. package/dist/_frontend/assets/WidgetLayout-6XVTKSOW-YdgTHyGh.js.gz +0 -0
  57. package/dist/_frontend/assets/chunk-5GSHR4L4-Cxh1Q_oM.js +1 -0
  58. package/dist/_frontend/assets/chunk-5GSHR4L4-Cxh1Q_oM.js.br +0 -0
  59. package/dist/_frontend/assets/chunk-5GSHR4L4-Cxh1Q_oM.js.gz +0 -0
  60. package/dist/_frontend/assets/{chunk-X2GIDKWH-CkM7LiBi.js → chunk-5LPC6X3J-uDPAksEb.js} +2 -2
  61. package/dist/_frontend/assets/chunk-5LPC6X3J-uDPAksEb.js.br +0 -0
  62. package/dist/_frontend/assets/chunk-5LPC6X3J-uDPAksEb.js.gz +0 -0
  63. package/dist/_frontend/assets/{chunk-EGUH4WJX-8KVKzdgH.js → chunk-ERF3RQBH-bc2AFBrP.js} +1 -1
  64. package/dist/_frontend/assets/chunk-ERF3RQBH-bc2AFBrP.js.br +0 -0
  65. package/dist/_frontend/assets/chunk-ERF3RQBH-bc2AFBrP.js.gz +0 -0
  66. package/dist/_frontend/assets/{chunk-OB3PAWPO-ChI7I4rW.js → chunk-OB3PAWPO-buV69Da_.js} +1 -1
  67. package/dist/_frontend/assets/chunk-OB3PAWPO-buV69Da_.js.br +0 -0
  68. package/dist/_frontend/assets/{chunk-OB3PAWPO-ChI7I4rW.js.gz → chunk-OB3PAWPO-buV69Da_.js.gz} +0 -0
  69. package/dist/_frontend/assets/{chunk-C5376XWU-DnMpocno.js → chunk-SBJYYOBH-9LXSopYV.js} +1 -1
  70. package/dist/_frontend/assets/{cssMode-B2O3WgDw.js → cssMode-CUwc-wOz.js} +1 -1
  71. package/dist/_frontend/assets/cssMode-CUwc-wOz.js.br +5 -0
  72. package/dist/_frontend/assets/cssMode-CUwc-wOz.js.gz +0 -0
  73. package/dist/_frontend/assets/{freemarker2-BwErGNl5.js → freemarker2-CnV8a3_0.js} +1 -1
  74. package/dist/_frontend/assets/freemarker2-CnV8a3_0.js.br +0 -0
  75. package/dist/_frontend/assets/freemarker2-CnV8a3_0.js.gz +0 -0
  76. package/dist/_frontend/assets/{handlebars-Dd-TVeIL.js → handlebars-C-TYdyge.js} +1 -1
  77. package/dist/_frontend/assets/handlebars-C-TYdyge.js.br +0 -0
  78. package/dist/_frontend/assets/handlebars-C-TYdyge.js.gz +0 -0
  79. package/dist/_frontend/assets/{html-DtetIX_W.js → html-C0OUO-_o.js} +1 -1
  80. package/dist/_frontend/assets/html-C0OUO-_o.js.br +0 -0
  81. package/dist/_frontend/assets/html-C0OUO-_o.js.gz +0 -0
  82. package/dist/_frontend/assets/{htmlMode-DKM7kaPN.js → htmlMode-BnXdhyXH.js} +1 -1
  83. package/dist/_frontend/assets/htmlMode-BnXdhyXH.js.br +0 -0
  84. package/dist/_frontend/assets/htmlMode-BnXdhyXH.js.gz +0 -0
  85. package/dist/_frontend/assets/{index-CG1biynV.js → index-BAccPIjI.js} +3 -3
  86. package/dist/_frontend/assets/index-BAccPIjI.js.br +0 -0
  87. package/dist/_frontend/assets/index-BAccPIjI.js.gz +0 -0
  88. package/dist/_frontend/assets/{index-BMbujGVF.js → index-CK_pY4oG.js} +1 -1
  89. package/dist/_frontend/assets/index-CK_pY4oG.js.br +0 -0
  90. package/dist/_frontend/assets/index-CK_pY4oG.js.gz +0 -0
  91. package/dist/_frontend/assets/index-DT_x37xf.js +1000 -0
  92. package/dist/_frontend/assets/index-DT_x37xf.js.br +0 -0
  93. package/dist/_frontend/assets/index-DT_x37xf.js.gz +0 -0
  94. package/dist/_frontend/assets/{javascript-Bema_gse.js → javascript-Cf9Bcm6Z.js} +1 -1
  95. package/dist/_frontend/assets/{jsonMode-CCmSaJ3B.js → jsonMode-Cdvgg8vs.js} +1 -1
  96. package/dist/_frontend/assets/jsonMode-Cdvgg8vs.js.br +0 -0
  97. package/dist/_frontend/assets/jsonMode-Cdvgg8vs.js.gz +0 -0
  98. package/dist/_frontend/assets/{liquid-SdwGTdmD.js → liquid-BTqXerrw.js} +1 -1
  99. package/dist/_frontend/assets/liquid-BTqXerrw.js.br +0 -0
  100. package/dist/_frontend/assets/liquid-BTqXerrw.js.gz +0 -0
  101. package/dist/_frontend/assets/{lspLanguageFeatures-CET8ZB_H.js → lspLanguageFeatures-ytnPsDYx.js} +1 -1
  102. package/dist/_frontend/assets/lspLanguageFeatures-ytnPsDYx.js.br +0 -0
  103. package/dist/_frontend/assets/lspLanguageFeatures-ytnPsDYx.js.gz +0 -0
  104. package/dist/_frontend/assets/{mdx-JMLFyU1U.js → mdx-Cy7YF5TA.js} +1 -1
  105. package/dist/_frontend/assets/mdx-Cy7YF5TA.js.br +0 -0
  106. package/dist/_frontend/assets/mdx-Cy7YF5TA.js.gz +0 -0
  107. package/dist/_frontend/assets/{python-O8I7D9EW.js → python-BfsHYybY.js} +1 -1
  108. package/dist/_frontend/assets/python-BfsHYybY.js.br +0 -0
  109. package/dist/_frontend/assets/python-BfsHYybY.js.gz +0 -0
  110. package/dist/_frontend/assets/{razor-DG0d0JKU.js → razor-BDLxWgPZ.js} +1 -1
  111. package/dist/_frontend/assets/razor-BDLxWgPZ.js.br +0 -0
  112. package/dist/_frontend/assets/razor-BDLxWgPZ.js.gz +0 -0
  113. package/dist/_frontend/assets/{tsMode-DqV_su_u.js → tsMode-BxS0zbXq.js} +1 -1
  114. package/dist/_frontend/assets/tsMode-BxS0zbXq.js.br +0 -0
  115. package/dist/_frontend/assets/tsMode-BxS0zbXq.js.gz +0 -0
  116. package/dist/_frontend/assets/{typescript-BOcOXNsD.js → typescript-zS28nDMH.js} +1 -1
  117. package/dist/_frontend/assets/typescript-zS28nDMH.js.br +0 -0
  118. package/dist/_frontend/assets/typescript-zS28nDMH.js.gz +0 -0
  119. package/dist/_frontend/assets/{workers-BIrSmuuV.js → workers-D9MU6Ded.js} +1 -1
  120. package/dist/_frontend/assets/workers-D9MU6Ded.js.br +0 -0
  121. package/dist/_frontend/assets/workers-D9MU6Ded.js.gz +0 -0
  122. package/dist/_frontend/assets/{xml-BvQIwO_b.js → xml-XJYCuhJK.js} +1 -1
  123. package/dist/_frontend/assets/xml-XJYCuhJK.js.br +0 -0
  124. package/dist/_frontend/assets/xml-XJYCuhJK.js.gz +0 -0
  125. package/dist/_frontend/assets/{yaml-do4_JNaE.js → yaml-CgdBed-B.js} +1 -1
  126. package/dist/_frontend/assets/yaml-CgdBed-B.js.br +0 -0
  127. package/dist/_frontend/assets/yaml-CgdBed-B.js.gz +0 -0
  128. package/dist/_frontend/index.html +1 -1
  129. package/dist/controller-main.js +3 -3
  130. package/dist/controller-main.js.map +1 -1
  131. package/dist/main.js +3 -3
  132. package/dist/main.js.map +1 -1
  133. package/package.json +3 -3
  134. package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-dOqmAa8Q.js.br +0 -0
  135. package/dist/_frontend/assets/AgentCodeSnippets-EKIN7ZIE-dOqmAa8Q.js.gz +0 -0
  136. package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-oRmx7mu0.js.br +0 -0
  137. package/dist/_frontend/assets/AgentMetricChart-ULFKK6JR-oRmx7mu0.js.gz +0 -0
  138. package/dist/_frontend/assets/AgentOverview-NGCJR4UF-DAIDFsz9.js.br +0 -0
  139. package/dist/_frontend/assets/AgentOverview-NGCJR4UF-DAIDFsz9.js.gz +0 -0
  140. package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-BOX-0vGu.js.br +0 -0
  141. package/dist/_frontend/assets/AgentSessionEventTimeline-NDDZQZ2R-BOX-0vGu.js.gz +0 -0
  142. package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-CWnxR-xs.js.br +0 -0
  143. package/dist/_frontend/assets/AgentSessionEventTimelineChart-5AY5YW4U-CWnxR-xs.js.gz +0 -0
  144. package/dist/_frontend/assets/AgentSessions-AJF4A3MH-Cq2taufD.js +0 -1
  145. package/dist/_frontend/assets/AgentSessions-AJF4A3MH-Cq2taufD.js.br +0 -0
  146. package/dist/_frontend/assets/AgentSessions-AJF4A3MH-Cq2taufD.js.gz +0 -0
  147. package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-Cw2Lz9YF.js +0 -1
  148. package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-Cw2Lz9YF.js.br +0 -0
  149. package/dist/_frontend/assets/ConnectorSettings-NIHX4DYV-Cw2Lz9YF.js.gz +0 -0
  150. package/dist/_frontend/assets/DrawerLayout-SYUH47FF-CpDQ95yI.js.br +0 -0
  151. package/dist/_frontend/assets/DrawerLayout-SYUH47FF-CpDQ95yI.js.gz +0 -0
  152. package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-Bd6RGp02.js +0 -131
  153. package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-Bd6RGp02.js.br +0 -0
  154. package/dist/_frontend/assets/EnvironmentsPage-YV2D2VMM-Bd6RGp02.js.gz +0 -0
  155. package/dist/_frontend/assets/ModelSettings-KMU4MUTS-rEUEfKny.js +0 -1
  156. package/dist/_frontend/assets/ModelSettings-KMU4MUTS-rEUEfKny.js.br +0 -0
  157. package/dist/_frontend/assets/ModelSettings-KMU4MUTS-rEUEfKny.js.gz +0 -0
  158. package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-CC48CiIJ.js +0 -1
  159. package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-CC48CiIJ.js.br +0 -0
  160. package/dist/_frontend/assets/SandboxSettings-XYOVCK6J-CC48CiIJ.js.gz +0 -0
  161. package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-u3WcJt5Z.js +0 -1
  162. package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-u3WcJt5Z.js.br +0 -0
  163. package/dist/_frontend/assets/SchedulesPage-UNS7BDS6-u3WcJt5Z.js.gz +0 -0
  164. package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-S7QVus7g.js +0 -2
  165. package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-S7QVus7g.js.br +0 -0
  166. package/dist/_frontend/assets/SettingsBuilder-OU3B7YHU-S7QVus7g.js.gz +0 -0
  167. package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-BMqebF_Z.js.br +0 -0
  168. package/dist/_frontend/assets/ShellRouteSync-M5WTXCX5-BMqebF_Z.js.gz +0 -0
  169. package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-ubVUYkb_.js +0 -2
  170. package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-ubVUYkb_.js.br +0 -0
  171. package/dist/_frontend/assets/SidebarLayout-MGDOLVJB-ubVUYkb_.js.gz +0 -0
  172. package/dist/_frontend/assets/SkillSettings-QPZ43BZT-4Ijtrfmx.js +0 -1
  173. package/dist/_frontend/assets/SkillSettings-QPZ43BZT-4Ijtrfmx.js.br +0 -0
  174. package/dist/_frontend/assets/SkillSettings-QPZ43BZT-4Ijtrfmx.js.gz +0 -0
  175. package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-BY6NbQO2.js +0 -1
  176. package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-BY6NbQO2.js.br +0 -0
  177. package/dist/_frontend/assets/WebSearchSettings-VOFJUVYH-BY6NbQO2.js.gz +0 -0
  178. package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-CmkhefQM.js.br +0 -0
  179. package/dist/_frontend/assets/WidgetLayout-CJYOCWXG-CmkhefQM.js.gz +0 -0
  180. package/dist/_frontend/assets/chunk-EGUH4WJX-8KVKzdgH.js.br +0 -0
  181. package/dist/_frontend/assets/chunk-EGUH4WJX-8KVKzdgH.js.gz +0 -0
  182. package/dist/_frontend/assets/chunk-OB3PAWPO-ChI7I4rW.js.br +0 -0
  183. package/dist/_frontend/assets/chunk-RO36YFVR-BQ4Ajb8a.js +0 -1
  184. package/dist/_frontend/assets/chunk-RO36YFVR-BQ4Ajb8a.js.br +0 -0
  185. package/dist/_frontend/assets/chunk-RO36YFVR-BQ4Ajb8a.js.gz +0 -0
  186. package/dist/_frontend/assets/chunk-X2GIDKWH-CkM7LiBi.js.br +0 -0
  187. package/dist/_frontend/assets/chunk-X2GIDKWH-CkM7LiBi.js.gz +0 -0
  188. package/dist/_frontend/assets/cssMode-B2O3WgDw.js.br +0 -0
  189. package/dist/_frontend/assets/cssMode-B2O3WgDw.js.gz +0 -0
  190. package/dist/_frontend/assets/freemarker2-BwErGNl5.js.br +0 -0
  191. package/dist/_frontend/assets/freemarker2-BwErGNl5.js.gz +0 -0
  192. package/dist/_frontend/assets/handlebars-Dd-TVeIL.js.br +0 -0
  193. package/dist/_frontend/assets/handlebars-Dd-TVeIL.js.gz +0 -0
  194. package/dist/_frontend/assets/html-DtetIX_W.js.br +0 -0
  195. package/dist/_frontend/assets/html-DtetIX_W.js.gz +0 -0
  196. package/dist/_frontend/assets/htmlMode-DKM7kaPN.js.br +0 -0
  197. package/dist/_frontend/assets/htmlMode-DKM7kaPN.js.gz +0 -0
  198. package/dist/_frontend/assets/index-BJYXg0vg.js +0 -978
  199. package/dist/_frontend/assets/index-BJYXg0vg.js.br +0 -0
  200. package/dist/_frontend/assets/index-BJYXg0vg.js.gz +0 -0
  201. package/dist/_frontend/assets/index-BMbujGVF.js.br +0 -0
  202. package/dist/_frontend/assets/index-BMbujGVF.js.gz +0 -0
  203. package/dist/_frontend/assets/index-CG1biynV.js.br +0 -0
  204. package/dist/_frontend/assets/index-CG1biynV.js.gz +0 -0
  205. package/dist/_frontend/assets/jsonMode-CCmSaJ3B.js.br +0 -0
  206. package/dist/_frontend/assets/jsonMode-CCmSaJ3B.js.gz +0 -0
  207. package/dist/_frontend/assets/liquid-SdwGTdmD.js.br +0 -0
  208. package/dist/_frontend/assets/liquid-SdwGTdmD.js.gz +0 -0
  209. package/dist/_frontend/assets/lspLanguageFeatures-CET8ZB_H.js.br +0 -0
  210. package/dist/_frontend/assets/lspLanguageFeatures-CET8ZB_H.js.gz +0 -0
  211. package/dist/_frontend/assets/mdx-JMLFyU1U.js.br +0 -0
  212. package/dist/_frontend/assets/mdx-JMLFyU1U.js.gz +0 -0
  213. package/dist/_frontend/assets/python-O8I7D9EW.js.br +0 -0
  214. package/dist/_frontend/assets/python-O8I7D9EW.js.gz +0 -0
  215. package/dist/_frontend/assets/razor-DG0d0JKU.js.br +0 -0
  216. package/dist/_frontend/assets/razor-DG0d0JKU.js.gz +0 -0
  217. package/dist/_frontend/assets/tsMode-DqV_su_u.js.br +0 -0
  218. package/dist/_frontend/assets/tsMode-DqV_su_u.js.gz +0 -0
  219. package/dist/_frontend/assets/typescript-BOcOXNsD.js.br +0 -0
  220. package/dist/_frontend/assets/typescript-BOcOXNsD.js.gz +0 -0
  221. package/dist/_frontend/assets/workers-BIrSmuuV.js.br +0 -0
  222. package/dist/_frontend/assets/workers-BIrSmuuV.js.gz +0 -0
  223. package/dist/_frontend/assets/xml-BvQIwO_b.js.br +0 -0
  224. package/dist/_frontend/assets/xml-BvQIwO_b.js.gz +0 -0
  225. package/dist/_frontend/assets/yaml-do4_JNaE.js.br +0 -0
  226. package/dist/_frontend/assets/yaml-do4_JNaE.js.gz +0 -0
@@ -1 +0,0 @@
1
- import{B as We}from"./chunk-EGUH4WJX-8KVKzdgH.js";import{Q as fe,R as Pe,t as ge,r as c,U as me,V as Se,W as be,X as Qe,j as e,P as Ke,Y as Ye,Z as oe,$ as De,y as Fe,a0 as $,I as z,a1 as Ze,a2 as ke,a3 as we,a4 as Je,a5 as Xe,a6 as Te,a7 as V,a8 as et,a9 as W,O as Le,aa as tt,ab as st,ac as at,ad as nt,ae as rt,af as lt,ag as it,d as ct,g as ee,ah as ot,ai as ue,f as dt,aj as ut,b as mt,ak as xt,al as ht,am as ft,an as gt,ao as bt,ap as Ce,l as pt,aq as Nt,ar as jt}from"./index-BJYXg0vg.js";var Ee=[{value:"America/New_York",label:"America/New_York (ET)"},{value:"America/Chicago",label:"America/Chicago (CT)"},{value:"America/Denver",label:"America/Denver (MT)"},{value:"America/Los_Angeles",label:"America/Los_Angeles (PT)"},{value:"UTC",label:"UTC"},{value:"Europe/London",label:"Europe/London (GMT/BST)"},{value:"Europe/Berlin",label:"Europe/Berlin (CET)"},{value:"Asia/Kolkata",label:"Asia/Kolkata (IST)"},{value:"Asia/Tokyo",label:"Asia/Tokyo (JST)"}];function Ie(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function yt(t){const s=Ie(),l=new Set(Ee.map(i=>i.value));return[...[s,t].flatMap(i=>i==null||i.length===0||l.has(i)?[]:(l.add(i),[{value:i,label:i===s?`${i} (Local)`:i}])),...Ee]}var $e=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],vt={"America/New_York":"ET","America/Chicago":"CT","America/Denver":"MT","America/Los_Angeles":"PT",UTC:"UTC","Europe/London":"GMT","Europe/Berlin":"CET","Asia/Kolkata":"IST","Asia/Tokyo":"JST"};function de(){return{name:"",task:"",recurrence:"daily",hour:9,minute:0,weekdays:[1],customCron:"0 9 * * *",timezone:Ie()}}function St(t){return vt[t]??t.split("/").pop()??t}function Me(t){return t.toString().padStart(2,"0")}function le({hour:t,minute:s}){const l=t>=12?"PM":"AM",n=t%12===0?12:t%12;return`${String(n)}:${Me(s)} ${l}`}function xe(t){const s=t.minute,l=t.hour;switch(t.recurrence){case"hourly":return`${String(s)} * * * *`;case"daily":return`${String(s)} ${String(l)} * * *`;case"weekly":{const n=[...t.weekdays].sort((d,g)=>d-g),i=n.length>0?n.join(","):"*";return`${String(s)} ${String(l)} * * ${i}`}case"custom":return t.customCron.trim()}}function ae(t){const s=St(t.timezone),l=t.cron.trim().split(/\s+/);if(l.length!==5)return t.cron;const[n,i,d,g,b]=l;if(d!=="*"||g!=="*")return t.cron;const o=Number(n),m=Number(i);if(i==="*"&&b==="*"&&n!==void 0&&!Number.isNaN(o))return`Hourly at :${Me(o)} ${s}`;if(b==="*"&&i!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(o))return`Daily ${le({hour:m,minute:o})} ${s}`;if(b==="1-5"&&i!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(o))return`Weekdays ${le({hour:m,minute:o})} ${s}`;if(b!=null&&/^\d(?:,\d)*$/.test(b)&&i!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(o)){const f=b.split(",").map(N=>{var j;return((j=$e.find(r=>r.value===Number(N)))==null?void 0:j.label)??N});return f.length===1?`Every ${f[0]==="Mon"?"Monday":f[0]} ${le({hour:m,minute:o})} ${s}`:`${f.join(", ")} ${le({hour:m,minute:o})} ${s}`}return t.cron}function ze(t){const s=de(),l=t.cron.trim().split(/\s+/);if(l.length!==5)return{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[n,i,d,g,b]=l,o=Number(n),m=Number(i);return d!=="*"||g!=="*"?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:i==="*"&&b==="*"&&!Number.isNaN(o)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:o,customCron:t.cron}:b==="*"&&!Number.isNaN(m)&&!Number.isNaN(o)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:m,minute:o,customCron:t.cron}:b!=null&&/^\d(?:,\d)*$/.test(b)&&!Number.isNaN(m)&&!Number.isNaN(o)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:m,minute:o,weekdays:b.split(",").map(Number),customCron:t.cron}:{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron,hour:Number.isNaN(m)?s.hour:m,minute:Number.isNaN(o)?s.minute:o}}function kt(t,s=Date.now()){return jt(t,{fallback:"Never",nowMs:s})}var wt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],Tt=Array.from({length:24},(t,s)=>({value:String(s),label:s.toString().padStart(2,"0")})),Ct=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Et({values:t,onChange:s,agentId:l,agentLabel:n,onAgentIdChange:i,onAgentPicked:d,agentPickerDisabled:g=!1,onBuildAgent:b}){const o=xe(t),m=ae({cron:o,timezone:t.timezone}),f=yt(t.timezone),N=(r,y)=>{s({...t,[r]:y})},j=r=>{const T=t.weekdays.includes(r)?t.weekdays.filter(x=>x!==r):[...t.weekdays,r];s({...t,weekdays:T.length>0?T:[r]})};return e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("div",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Agent"}),e.jsx(De,{"aria-label":"Agent",placeholder:"Search agent",value:l,selectedLabel:n,onValueChange:r=>i==null?void 0:i(r),onAgentPicked:d,disabled:g||i==null,onBuildAgent:b})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Name"}),e.jsx("input",{value:t.name,onChange:r=>N("name",r.target.value),placeholder:"harness-daily-digest",className:Ce("h-8"),required:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Task"}),e.jsx("textarea",{value:t.task,onChange:r=>N("task",r.target.value),rows:3,placeholder:"Summarise yesterday's harness runs and post the digest…",className:Ce("resize-y py-2"),required:!0})]}),e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Frequency"}),e.jsx("div",{className:"rounded-t-lg border border-border p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("div",{className:"grid grid-cols-3 gap-1 rounded-lg border border-border bg-primary-bg p-1",children:wt.map(r=>{const y=t.recurrence===r.value;return e.jsx("button",{type:"button",className:ee("rounded-md border px-2 py-2 text-sm font-medium transition-colors",y?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-transparent text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":y,onClick:()=>N("recurrence",r.value),children:r.label},r.value)})}),t.recurrence==="custom"?e.jsxs("div",{className:"rounded-md border border-border bg-secondary-bg/40 px-3 py-2",children:[e.jsx("span",{className:"block text-xs text-text-secondary",children:"Existing custom schedule"}),e.jsx("code",{className:"mt-1 block font-mono text-sm text-text-primary",children:t.customCron}),e.jsx("span",{className:"mt-1 block text-xs text-text-secondary",children:"Select Hourly, Daily, or Weekly to replace this schedule."})]}):null,t.recurrence==="weekly"?e.jsxs("fieldset",{children:[e.jsx("legend",{className:"mb-2 text-sm font-medium",children:"Days"}),e.jsx("div",{className:"flex gap-2",children:$e.map(r=>{const y=t.weekdays.includes(r.value);return e.jsx("button",{type:"button",className:ee("min-w-0 flex-1 rounded-md border px-3 py-2 text-[0.8125rem] font-medium",y?"border-primary-button-bg/40 bg-primary-button-bg/10 font-semibold text-primary-button-bg":"border-border text-text-secondary hover:bg-ghost-button-hover"),"aria-pressed":y,onClick:()=>j(r.value),children:r.label},r.value)})})]}):null,e.jsxs("div",{className:"flex gap-4",children:[t.recurrence==="daily"||t.recurrence==="weekly"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Hour"}),e.jsx(oe,{"aria-label":"Hour",value:String(t.hour),options:Tt,onValueChange:r=>N("hour",Number(r))})]}):null,t.recurrence!=="custom"?e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Minute"}),e.jsx(oe,{"aria-label":"Minute",value:String(t.minute),options:Ct,onValueChange:r=>N("minute",Number(r))})]}):null,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"mb-1.5 block text-sm font-medium",children:"Timezone"}),e.jsx(oe,{"aria-label":"Timezone",value:t.timezone,options:f,onValueChange:r=>N("timezone",r),menuClassName:"w-full min-w-0"})]})]})]})}),e.jsx("div",{className:"rounded-b-lg border border-t-0 border-border bg-primary-button-bg/10 px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(z,{name:"clock",className:"size-4 shrink-0 text-primary-button-bg"}),e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-secondary",children:"Schedule"}),e.jsx("p",{className:"min-w-0 flex-1 truncate text-sm text-text-primary",children:m||"—"}),e.jsx("code",{className:"shrink-0 whitespace-nowrap font-mono text-[0.8125rem] font-bold text-text-secondary",children:o||"—"})]})})]})]})}function zt(t){return t.startsWith("manual-")}function At(t){return t==="failed"?"failed":"success"}function Oe(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Be(t){return zt(t)?"Manual test":"Cron"}function Rt(t,s=5){return t.filter(n=>n.status!=="scheduled").slice(0,s).reverse()}function he(t){if(t==null)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?"—":gt(s)}function Pt({run:t}){return e.jsxs("div",{className:"flex flex-col gap-1 text-left text-xs",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Oe(t.status)}),e.jsx("p",{className:"text-text-secondary",children:Be(t.name)}),e.jsxs("p",{className:"text-text-secondary",children:["Scheduled for: ",he(t.scheduledFor)]}),t.triggeredAt!=null?e.jsxs("p",{className:"text-text-secondary",children:["Triggered at: ",he(t.triggeredAt)]}):null,e.jsxs("p",{className:"text-text-secondary",children:["Triggered by: ",t.triggeredBy]}),t.status==="failed"&&t.reason?e.jsxs("p",{className:"text-text-secondary",children:["Reason: ",t.reason]}):null]})}var Dt={success:"border-emerald-600/30 bg-emerald-500/10 text-emerald-700 dark:border-emerald-400/35 dark:bg-emerald-500/15 dark:text-emerald-300",failed:"border-red-600/30 bg-red-500/10 text-red-700 dark:border-red-400/35 dark:bg-red-500/15 dark:text-red-300"};function _e({run:t}){const s=At(t.status),l=he(t.triggeredAt??t.scheduledFor);return e.jsx(Le,{content:e.jsx(Pt,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:e.jsx("span",{className:ee("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",Dt[s]),"aria-label":`${Oe(t.status)} run at ${l}`,children:e.jsx(z,{name:s==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function Ue({status:t}){const s=t==="active";return e.jsx(We,{variant:s?"success":"warning",shape:"pill",size:"md",dot:!0,children:s?"Active":"Paused"})}function Ft(t,s){return t.find(l=>l.name===s||l.id===s)??null}function Lt({connector:t,onConnected:s}){return pt()==null?null:e.jsx(Nt,{connector:t,onConnected:s})}function se({label:t,children:s}){return e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-3 py-2.5 last:border-b-0",children:[e.jsx("span",{className:"text-text-secondary shrink-0 text-[10px] font-semibold tracking-wide uppercase",children:t}),e.jsx("div",{className:"min-w-0 text-right text-sm text-text-primary",children:s})]})}function It({schedule:t,agentName:s,mcpMounts:l,onEditConfiguration:n}){const i=fe(),d=ge(),{connectors:g,ensureLoaded:b,refreshConnectors:o,loading:m,error:f}=bt(),[N,j]=c.useState(!1),[r,y]=c.useState(null),T=ae({cron:t.cron,timezone:t.timezone}),x=async()=>{j(!0);try{const w=await i.createScheduleRun({scheduleId:t.id});y(w),d==null||d.showSuccess({title:"Test run started"})}catch(w){d==null||d.showError(w)}finally{j(!1)}};return c.useEffect(()=>{b()},[b]),c.useEffect(()=>{f!=null&&(d==null||d.showError(f))},[f,d]),e.jsxs("div",{className:"flex flex-col gap-4 px-5 py-4",children:[e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx(se,{label:"Agent",children:s}),e.jsx(se,{label:"Name",children:t.name}),e.jsx(se,{label:"Status",children:e.jsx(Ue,{status:t.status})}),e.jsx(se,{label:"Task",children:e.jsx("span",{className:"whitespace-pre-wrap break-words",children:t.task})}),e.jsx(se,{label:"Frequency",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-1.5",children:[e.jsx("span",{children:T}),e.jsx("code",{className:"text-text-secondary font-mono text-xs",children:t.cron})]})}),e.jsx("div",{className:"flex justify-end px-3 py-2.5",children:e.jsxs($.Secondary,{type:"button",size:"small",onClick:n,children:[e.jsx(z,{name:"pencil",className:"size-3.5"}),"Edit Configuration"]})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsx("div",{className:"border-b border-border px-3 py-2",children:e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Tool Authorization"})}),l.length===0?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"No MCP connectors configured for this agent."}):e.jsx("ul",{className:"divide-y divide-border",children:l.map(w=>{const C=Ft(g,w.name),E=(C==null?void 0:C.authenticated)===!0,Q=C==null&&!m;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:ee("inline-flex size-4 shrink-0 items-center justify-center rounded-full border",E?"border-emerald-600/40 bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"border-border text-transparent"),"aria-hidden":!0,children:E?e.jsx(z,{name:"check",className:"size-3"}):null}),e.jsx("span",{className:"text-text-primary min-w-0 flex-1 truncate text-sm",children:w.name}),E?e.jsx("span",{className:"text-success-bg text-xs font-medium",children:"Connected"}):Q?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):C!=null&&C.authenticated===!1?e.jsx(Lt,{connector:C,onConnected:o}):m?e.jsx("span",{className:"text-text-secondary text-xs",children:"Loading…"}):null]},w.name)})})]}),e.jsxs("section",{className:"overflow-hidden rounded-lg border border-border bg-card-bg",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[e.jsx("h3",{className:"text-text-secondary text-[10px] font-semibold tracking-wide uppercase",children:"Test Run"}),e.jsxs($.Primary,{type:"button",disabled:N,size:"small",onClick:()=>void x(),children:[e.jsx(z,{name:N?"loader":"play",className:ee("size-3.5",N&&"animate-spin")}),"Run Test"]})]}),r==null?e.jsx("p",{className:"text-text-secondary px-3 py-3 text-sm",children:"Run a one-off test using the schedule task. This does not change the cron pending run."}):e.jsxs("div",{className:"flex items-center gap-3 px-3 py-3",children:[e.jsx(_e,{run:r}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Be(r.name)}),e.jsx("p",{className:"text-text-secondary",children:kt(r.triggeredAt??r.scheduledFor)})]})]})]})]})}function $t({open:t,onOpenChange:s,mode:l,schedule:n,initialAgentId:i="",onSaved:d}){const g=fe(),b=Pe(),o=mt(),m=ge(),[f,N]=c.useState(de),[j,r]=c.useState(i),[y,T]=c.useState(null),[x,w]=c.useState({kind:"form"}),[C,E]=c.useState(!1),[Q,A]=c.useState(!1),[U,p]=c.useState(null),K=c.useRef(j);K.current=j;const M=x.kind==="form"?x.saved:x.schedule,O=l==="edit"&&x.kind==="form"&&x.saved==null&&n!=null,L=x.kind==="form"&&x.saved!=null,H=l==="create"&&x.kind==="form"&&x.saved==null,{allows:q}=me({resourceType:"agent",resourceIds:j.length===0?[]:[j]});c.useEffect(()=>{if(!t){N(de()),r(i),T(null),p(null),w({kind:"form"}),A(!1);return}if(l==="edit"&&n!=null){N(ze({name:n.name,task:n.task,cron:n.cron,timezone:n.timezone})),r(n.agentId),T(null),w({kind:"form"});return}N(de()),r(i),T(null),w({kind:"form"})},[t,l,n,i]),c.useEffect(()=>{if(!t||l!=="create"||i.length===0)return;let h=!1;const v=i;return xt({server:b,agentKey:v}).then(k=>{h||k==null||K.current===v&&(T(k),r(Fe(k)))}).catch(()=>{}),()=>{h=!0}},[t,l,i,b]);const B=(y==null?void 0:y.name)??(M==null?void 0:M.agentName)??(n==null?void 0:n.agentName)??(j.length>0?j:""),Y=c.useMemo(()=>{var v;return(((v=y==null?void 0:y.agentSpec)==null?void 0:v.mcpServers)??[]).map(ht).filter(k=>k!=null).map(k=>({name:k}))},[y]),R=c.useMemo(()=>{const h=xe(f);return f.name.trim().length>0&&f.task.trim().length>0&&h.length>0&&j.length>0&&(!H||q(j,"USE"))},[j,q,f,H]),te=h=>{w({kind:"test",schedule:h}),N(ze({name:h.name,task:h.task,cron:h.cron,timezone:h.timezone})),r(h.agentId)},Z=async h=>{if(h.preventDefault(),!R)return;const v=xe(f);E(!0),p(null);try{if(O&&n!=null){await g.updateSchedule({id:n.id,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:n.status}),d==null||d(),s(!1);return}if(L&&x.kind==="form"&&x.saved!=null){const _=await g.updateSchedule({id:x.saved.id,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:"paused"});d==null||d(),te(_),m==null||m.showSuccess({title:"Schedule saved as paused",description:ae({cron:_.cron,timezone:_.timezone})});return}const k=await g.createSchedule({agentId:j,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:"paused"});d==null||d(),te(k),m==null||m.showSuccess({title:"Schedule saved as paused",description:ae({cron:k.cron,timezone:k.timezone})})}catch(k){const _=k instanceof Error?k.message:"Failed to save schedule";p(_)}finally{E(!1)}},D=async()=>{if(x.kind==="test"){A(!0),p(null);try{await g.updateSchedule({id:x.schedule.id,name:x.schedule.name,task:x.schedule.task,cron:x.schedule.cron,timezone:x.schedule.timezone,status:"active"}),d==null||d(),m==null||m.showSuccess({title:"Schedule activated"}),s(!1)}catch(h){const v=h instanceof Error?h.message:"Failed to activate schedule";p(v),m==null||m.showError(h)}finally{A(!1)}}},G=x.kind==="test"?"Test Schedule":O||L?"Edit Schedule":"New Schedule",ne=x.kind==="test"?`Recurring unattended runs of ${B}.`:O||L?"Update cadence and task for this schedule.":"Create a recurring unattended run for an agent.";let F;return x.kind==="test"?F=e.jsxs("div",{className:"flex flex-col gap-2",children:[U!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:U}):null,e.jsx($.Secondary,{type:"button",className:"w-full",disabled:Q,onClick:()=>void D(),children:"Activate Schedule"})]}):F=e.jsxs("div",{className:"flex flex-col gap-2",children:[U!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:U}):null,e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx($.Secondary,{type:"button",onClick:()=>s(!1),disabled:C,children:"Cancel"}),e.jsx($.Primary,{type:"submit",form:"schedule-form",disabled:!R||C,children:"Save"})]})]}),e.jsx(ft,{open:t,onOpenChange:s,title:G,description:ne,anchor:"right",size:"xl",headerIcon:e.jsx("span",{className:"text-primary-button-bg inline-flex size-8 items-center justify-center",children:e.jsx(z,{name:x.kind==="test"||O||L?"calendar":"calendar-plus",className:"size-5"})}),footer:F,children:x.kind==="test"?e.jsx(It,{schedule:x.schedule,agentName:B,mcpMounts:Y,onEditConfiguration:()=>{p(null),w({kind:"form",saved:x.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:h=>void Z(h),children:e.jsx(Et,{values:f,onChange:N,agentId:j,agentLabel:B,onAgentIdChange:O||L?void 0:h=>{r(h),h.length===0&&T(null)},onAgentPicked:T,agentPickerDisabled:O||L,onBuildAgent:l==="create"&&(o==null?void 0:o.isComposerEnabled)===!0?()=>{s(!1),o.openAgentBuilder()}:void 0})})})}function Ae(t){return e.jsx(ut,{children:e.jsx($t,{...t})})}function Mt({runs:t}){const s=Rt(t);return s.length===0?e.jsx("span",{className:"text-text-secondary text-sm",children:"—"}):e.jsx("div",{className:"flex items-center gap-1",children:s.map(l=>e.jsx(_e,{run:l},l.id))})}var Ot=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],Re=[10,25];function ie(t){return Math.min(Math.max(t,1),25)}function ce(t){const s=be(t);return{nameQuery:s.q??"",statusFilter:s.status??"all",agentFilter:s.agent??"all"}}function Bt(t){const s=be(window.location.search);if(!s.isNew)return{kind:"closed"};const l=t??s.agent;return{kind:"create",...l==null?{}:{agentId:l}}}function _t({schedule:t,running:s,canManage:l,canDelete:n,onRunNow:i,onEdit:d,onTogglePause:g,onDelete:b}){const o=ct("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(o,{allowed:l,children:e.jsxs($.Secondary,{type:"button",disabled:s,"aria-label":`Run now ${t.name}`,size:"large",onClick:i,children:[e.jsx(z,{name:s?"loader":"play",className:ee("size-3.5",s&&"animate-spin")}),"Run now"]})}),e.jsxs(ot,{align:"end",trigger:e.jsx("button",{type:"button",className:dt({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(z,{name:"ellipsis"})}),children:[e.jsx(o,{allowed:l,children:e.jsxs(ue,{onClick:d,children:[e.jsx(z,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(o,{allowed:l,children:e.jsxs(ue,{onClick:g,children:[e.jsx(z,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(o,{allowed:n,children:e.jsxs(ue,{className:"text-failure-bg focus:text-failure-bg",onClick:b,children:[e.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function qt({agentId:t}){const s=fe(),l=Pe(),n=ge(),[i,d]=c.useState([]),{allows:g}=me({resourceType:"schedule",resourceIds:i.map(a=>a.id)}),[b,o]=c.useState({}),[m,f]=c.useState(!1),[N,j]=c.useState(()=>new Set),[r,y]=c.useState({}),[T,x]=c.useState(!0),[w,C]=c.useState(null),[E,Q]=c.useState(()=>ce(window.location.search).nameQuery),[A,U]=c.useState(()=>ce(window.location.search).statusFilter),[p,K]=c.useState(()=>t??ce(window.location.search).agentFilter),M=t??(p==="all"?null:p),{allows:O}=me({resourceType:"agent",resourceIds:M==null?[]:[M]}),L=l.permissions==null||M==null||O(M,"USE"),[H,q]=c.useState(()=>Bt(t)),[B,Y]=c.useState(null),[R,te]=c.useState(()=>ie(it)),[Z,D]=c.useState(void 0),[G,ne]=c.useState(void 0),[F,h]=c.useState(void 0),v=c.useRef(0),k=c.useRef(!1),_=c.useCallback(async({rows:a,gen:u})=>{if(a.length===0){u===v.current&&o({});return}f(!0);try{const S=await Promise.allSettled(a.map(P=>s.listScheduleRuns({scheduleId:P.id})));if(u!==v.current)return;o(Object.fromEntries(a.map((P,I)=>{const X=S[I],Ve=(X==null?void 0:X.status)==="fulfilled"?X.value:[];return[P.id,Ve]})))}finally{u===v.current&&f(!1)}},[s]),J=c.useCallback(async({token:a,size:u,agentId:S})=>{const P=++v.current;x(!0),C(null);try{const I=await s.listSchedules({limit:ie(u),...a===void 0||a===""?{}:{pageToken:a},...S==="all"?{}:{agentIds:[S]}});if(P!==v.current)return;d(I.data),ne(I.nextPageToken),h(I.previousPageToken),_({rows:I.data,gen:P})}catch(I){if(P!==v.current)return;const X=I instanceof Error?I.message:"Failed to load schedules";C(X),d([]),o({}),ne(void 0),h(void 0)}finally{P===v.current&&x(!1)}},[s,_]),pe=c.useCallback(a=>{const u=(a==null?void 0:a.size)??R,S=(a==null?void 0:a.agentId)??p;D(void 0),h(void 0),J({token:void 0,size:u,agentId:S})},[p,J,R]);c.useEffect(()=>{Se({agent:t===void 0&&p!=="all"?p:null,status:A==="all"?null:A,q:E.trim().length===0?null:E})},[p,t,A,E]),c.useEffect(()=>{t!==void 0&&K(a=>a===t?a:(D(void 0),h(void 0),t))},[t]),c.useEffect(()=>{k.current||!be(window.location.search).isNew||(k.current=!0,Se({isNew:null}))},[]),c.useEffect(()=>{const a=()=>{const u=ce(window.location.search);Q(u.nameQuery),U(u.statusFilter),K(S=>{const P=t??u.agentFilter;return S===P?S:(D(void 0),h(void 0),P)})};return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t]),c.useEffect(()=>{J({token:Z,size:R,agentId:p})},[p,R,Z,J]);const re=c.useMemo(()=>{const a=E.trim().toLowerCase();return i.filter(u=>!(A!=="all"&&u.status!==A||a.length>0&&!u.name.toLowerCase().includes(a)))},[i,E,A]),Ne=Qe(i),je=F!=null||G!=null,He=async a=>{if(!g(a.id,"MANAGE"))return;const u=a.status==="active"?"paused":"active";try{await s.updateSchedule({...a,status:u}),await J({token:Z,size:R,agentId:p})}catch(S){n==null||n.showError(S)}},qe=async a=>{if(g(a.id,"MANAGE")){j(u=>new Set(u).add(a.id));try{await s.createScheduleRun({scheduleId:a.id}),n==null||n.showSuccess({title:"Run started"});const u=await s.listScheduleRuns({scheduleId:a.id});o(S=>({...S,[a.id]:u}))}catch(u){n==null||n.showError(u)}finally{j(u=>{const S=new Set(u);return S.delete(a.id),S})}}},Ge=async a=>{if(g(a.id,"DELETE")){Y(null);try{await s.deleteSchedule({id:a.id}),pe()}catch(u){n==null||n.showError(u)}}},ye=()=>{G!=null&&D(G)},ve=()=>{F==null||F===""||D(F)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-primary-bg",children:[e.jsx(Ke,{title:t===void 0?"Agent Schedules":void 0,end:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-full sm:w-60",children:e.jsx(Ye,{query:E,setQuery:Q,placeholder:"Search schedules by name"})}),e.jsx(oe,{value:A,onValueChange:U,options:Ot,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(De,{value:p,selectedLabel:p==="all"?"All agents":r[p]??p,onValueChange:a=>{K(a),D(void 0),h(void 0)},onAgentPicked:a=>{y(u=>({...u,[Fe(a)]:a.name}))},allOption:{value:"all",label:"All agents"},className:"sm:w-48","aria-label":"Filter by agent",placeholder:"Search agent"}):null,e.jsxs($.Primary,{type:"button",disabled:!L,onClick:()=>L&&q({kind:"create",agentId:p!=="all"?p:void 0}),children:[e.jsx(z,{name:"plus",className:"size-3.5"}),"New Schedule"]})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-4",children:T?e.jsx("div",{className:"flex flex-col gap-2",role:"status","aria-label":"Loading schedules",children:Array.from({length:5},(a,u)=>e.jsx(Ze,{className:"h-12 w-full rounded-md"},u))}):w!=null?e.jsx("p",{className:"text-failure-bg px-3 py-8 text-center text-sm",children:w}):i.length===0?e.jsx(ke,{title:"No Schedules Found",description:"Create one to get started.",className:"min-h-full"}):re.length===0?e.jsxs("div",{className:"flex min-h-full flex-col",children:[e.jsx(ke,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),je?e.jsx(we,{pageSize:R,rowCount:0,canPrev:F!=null,canNext:G!=null,onPrev:ve,onNext:ye,pageSizeOptions:Re,onPageSizeChange:a=>{const u=ie(a);te(u),D(void 0),h(void 0)}}):null]}):e.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[e.jsxs(Je,{className:"min-w-240",children:[e.jsx(Xe,{children:e.jsxs(Te,{className:"hover:bg-transparent",children:[e.jsx(V,{children:"Schedule Name"}),e.jsx(V,{children:"Task"}),Ne?e.jsx(V,{children:"Created by"}):null,e.jsx(V,{children:"Frequency"}),e.jsx(V,{children:"Status"}),e.jsx(V,{children:"Last 5 runs"}),e.jsx(V,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(et,{children:re.map(a=>{const u=ae({cron:a.cron,timezone:a.timezone}),S=a.agentName??r[a.agentId]??a.agentId;return e.jsxs(Te,{children:[e.jsxs(W,{className:"w-48 max-w-48",children:[e.jsx("span",{className:"text-text-primary block truncate font-medium",children:a.name}),e.jsxs("span",{className:"mt-1 flex min-w-0 items-center gap-1 text-xs",children:[e.jsx(z,{name:"agent-2",className:"size-3 shrink-0"}),e.jsx("span",{className:"truncate",children:S})]})]}),e.jsx(W,{className:"w-64 max-w-64",children:e.jsx(Le,{content:a.task,className:"max-w-sm whitespace-normal text-left",triggerClassName:"block min-w-0 w-full max-w-full",children:e.jsx("span",{className:"block truncate",children:a.task})})}),Ne?e.jsx(W,{children:e.jsx(tt,{subject:a.createdBySubject})}):null,e.jsx(W,{children:u}),e.jsx(W,{children:e.jsx(Ue,{status:a.status})}),e.jsx(W,{children:m?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(Mt,{runs:b[a.id]??[]})}),e.jsx(W,{className:"text-right",children:e.jsx(_t,{schedule:a,running:N.has(a.id),canManage:g(a.id,"MANAGE"),canDelete:g(a.id,"DELETE"),onRunNow:()=>void qe(a),onEdit:()=>{g(a.id,"MANAGE")&&q({kind:"edit",schedule:a})},onTogglePause:()=>void He(a),onDelete:()=>{g(a.id,"DELETE")&&Y(a)}})})]},a.id)})})]}),(re.length>0||je)&&e.jsx(we,{pageSize:R,rowCount:re.length,canPrev:F!=null,canNext:G!=null,onPrev:ve,onNext:ye,pageSizeOptions:Re,onPageSizeChange:a=>{const u=ie(a);te(u),D(void 0),h(void 0)}})]})}),H.kind==="create"?e.jsx(Ae,{open:!0,mode:"create",initialAgentId:H.agentId??"",onOpenChange:a=>{a||q({kind:"closed"})},onSaved:()=>pe()}):null,H.kind==="edit"?e.jsx(Ae,{open:!0,mode:"edit",schedule:H.schedule,onOpenChange:a=>{a||q({kind:"closed"})},onSaved:()=>void J({token:Z,size:R,agentId:p})}):null,B!=null?e.jsxs(st,{open:!0,onOpenChange:a=>{a||Y(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(at,{children:e.jsxs(nt,{children:[e.jsx(rt,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",B.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(lt,{children:[e.jsx($.Secondary,{type:"button",onClick:()=>Y(null),children:"Cancel"}),e.jsx($.Destructive,{type:"button",disabled:!g(B.id,"DELETE"),onClick:()=>void Ge(B),children:"Delete"})]})]}):null]})}export{qt as SchedulesPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-KMU4MUTS-rEUEfKny.js","./chunk-C5376XWU-DnMpocno.js","./index-BJYXg0vg.js","./index-B01pXqvC.css","./ConnectorSettings-NIHX4DYV-Cw2Lz9YF.js","./SkillSettings-QPZ43BZT-4Ijtrfmx.js","./SandboxSettings-XYOVCK6J-CC48CiIJ.js","./WebSearchSettings-VOFJUVYH-BY6NbQO2.js"])))=>i.map(i=>d[i]);
2
- import{i as S,l as _,aU as j,ao as k,aV as E,c as C,r as l,j as e,P as N,I as h,f as L,g as x,aW as O,_ as d,S as D}from"./index-BJYXg0vg.js";var I=l.lazy(()=>d(()=>import("./ModelSettings-KMU4MUTS-rEUEfKny.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),P=l.lazy(()=>d(()=>import("./ConnectorSettings-NIHX4DYV-Cw2Lz9YF.js"),__vite__mapDeps([4,1,2,3]),import.meta.url)),z=l.lazy(()=>d(()=>import("./SkillSettings-QPZ43BZT-4Ijtrfmx.js"),__vite__mapDeps([5,1,2,3]),import.meta.url)),M=l.lazy(()=>d(()=>import("./SandboxSettings-XYOVCK6J-CC48CiIJ.js"),__vite__mapDeps([6,1,2,3]),import.meta.url)),R=l.lazy(()=>d(()=>import("./WebSearchSettings-VOFJUVYH-BY6NbQO2.js"),__vite__mapDeps([7,2,3]),import.meta.url));function T(){return e.jsxs("div",{className:"flex flex-1 items-center justify-center py-8",role:"status","aria-live":"polite","aria-busy":"true",children:[e.jsx(D,{size:20,className:"text-text-secondary"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}var V=({headerStart:g}={})=>{const{settingsOpen:a,settingsSection:t,setSettingsOpen:r}=S(),n=_(),m=j(),{refresh:b}=k(),v=E(),w=C(),i=v||w,o=(n==null?void 0:n.skillCatalog)!=null,c=(n==null?void 0:n.sandboxCatalog)!=null,u=(n==null?void 0:n.webSearchCatalog)!=null,f=l.useCallback(()=>{r(!1)},[r]);l.useEffect(()=>{if(a)return()=>{b(),m==null||m()}},[a,b,m]),l.useEffect(()=>{!o&&t==="skills"&&r(a,"models"),!c&&t==="sandbox"&&r(a,"models"),!u&&t==="web-search"&&r(a,"models")},[o,c,u,t,a,r]),l.useEffect(()=>{if(!a)return;const s=p=>{p.key==="Escape"&&(O()||(p.stopImmediatePropagation(),f()))};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[f,a]);const y=l.useMemo(()=>{const s=[{id:"models",label:"Models",icon:"cpu"},{id:"connectors",label:"Connectors",icon:"plug"}];return o&&s.push({id:"skills",label:"Skills",icon:"lightbulb"}),c&&s.push({id:"sandbox",label:"Sandbox providers",icon:"cube"}),u&&s.push({id:"web-search",label:"Web search",icon:"search"}),s},[o,c,u]);return!a||!n?null:e.jsxs("div",{className:"flex h-full min-h-0 w-full min-w-0 flex-col overflow-x-hidden bg-primary-bg",children:[e.jsx(N,{title:"Settings",start:g??e.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:L({variant:"ghost",size:"icon"}),onClick:f,children:e.jsx(h,{name:"arrow-left"})})}),e.jsxs("div",{className:x("flex min-h-0 min-w-0 flex-1 flex-col",!i&&"md:flex-row"),children:[e.jsx("nav",{"aria-label":"Settings sections",className:x("flex w-full min-w-0 gap-1 border-b border-border bg-secondary-bg/40 p-2",i?"overflow-x-auto":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:y.map(s=>e.jsxs("button",{type:"button","aria-current":t===s.id?"page":void 0,...i?{title:s.label}:{},className:x("flex min-h-9 items-center gap-2 rounded-md px-3 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring",i?"min-w-0 flex-1 justify-center gap-1.5 px-1.5":"shrink-0",t===s.id?"bg-primary-button-bg/10 text-primary-button-bg":"text-text-secondary hover:bg-ghost-button-hover/60 hover:text-text-primary"),onClick:()=>{r(!0,s.id)},children:[e.jsx(h,{name:s.icon,className:"h-4 w-4 shrink-0"}),i?e.jsx("span",{className:"truncate",children:s.label}):s.label]},s.id))}),e.jsx("section",{className:"flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden overflow-y-hidden px-4 py-4 sm:px-6",children:e.jsx("div",{className:"mx-auto flex h-full min-h-0 w-full min-w-0 max-w-210 flex-col",children:e.jsxs(l.Suspense,{fallback:e.jsx(T,{}),children:[t==="models"?e.jsx(I,{}):null,t==="connectors"?e.jsx(P,{}):null,t==="skills"&&o?e.jsx(z,{}):null,t==="sandbox"&&c?e.jsx(M,{}):null,t==="web-search"&&u?e.jsx(R,{}):null]})})})]})]})},B=V;export{B as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-OU3B7YHU-S7QVus7g.js","./index-BJYXg0vg.js","./index-B01pXqvC.css","./SchedulesPage-UNS7BDS6-u3WcJt5Z.js","./chunk-EGUH4WJX-8KVKzdgH.js","./EnvironmentsPage-YV2D2VMM-Bd6RGp02.js"])))=>i.map(i=>d[i]);
2
- import{bT as _,bU as Yt,u as W,j as r,bV as qt,r as d,b5 as P,bW as Ue,bX as Zt,bY as He,bZ as Ve,b_ as We,b$ as Xe,c0 as Ye,c1 as Q,c2 as Qt,c3 as T,c4 as Jt,c5 as en,c6 as tn,c7 as nn,c8 as rn,c9 as sn,ca as on,cb as an,cc as we,cd as cn,ce as ln,cf as ue,cg as un,ch as dn,ci as mn,cj as qe,ck as Ae,cl as de,cm as ye,cn as ae,co as Ie,cp as je,cq as Me,cr as Oe,k as Ze,b as ne,d as S,U as fn,cs as hn,g as z,t as pn,ct as xn,cu as gn,cv as vn,c as Ce,aV as Qe,cw as bn,Y as wn,ai as ke,I as U,y as yn,f as te,cx as Je,cy as In,cz as jn,cA as Be,a_ as Mn,ap as Cn,a0 as Fe,s as et,cB as Sn,P as Ln,cC as Tn,S as pe,D as Rn,cD as tt,cE as nt,bh as Nn,_ as Se,cF as Pn,bK as En}from"./index-BJYXg0vg.js";import{A as Dn,N as _n,T as An,S as rt}from"./chunk-RO36YFVR-BQ4Ajb8a.js";const Le=n=>{const e=_(8),{index:t,archived:s,children:o}=n;let i;e[0]!==s||e[1]!==t?(i=Yt({source:"threads",query:{type:"index",index:t,archived:s},get:c=>c.threads().item({index:t,archived:s})}),e[0]=s,e[1]=t,e[2]=i):i=e[2];let a;e[3]!==i?(a={threadListItem:i},e[3]=i,e[4]=a):a=e[4];const l=W(a);let u;return e[5]!==l||e[6]!==o?(u=r.jsx(qt,{value:l,children:o}),e[5]=l,e[6]=o,e[7]=u):u=e[7],u},st=d.memo(n=>{const e=_(6),{index:t,archived:s,components:o}=n,i=s===void 0?!1:s,a=o.ThreadListItem;let l;e[0]!==a?(l=r.jsx(a,{}),e[0]=a,e[1]=l):l=e[1];let u;return e[2]!==i||e[3]!==t||e[4]!==l?(u=r.jsx(Le,{index:t,archived:i,children:l}),e[2]=i,e[3]=t,e[4]=l,e[5]=u):u=e[5],u},(n,e)=>n.index===e.index&&n.archived===e.archived&&n.components.ThreadListItem===e.components.ThreadListItem);st.displayName="ThreadListPrimitive.ItemByIndex";const Ke=({archived:n,children:e})=>{const t=P(s=>n?s.threads.archivedThreadIds.length:s.threads.threadIds.length);return Ue(()=>Array.from({length:t},(s,o)=>r.jsx(Le,{index:o,archived:n,children:r.jsx(Zt,{getItemState:i=>i.threads().item({index:o,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},o)),[t,n,e])},ot=n=>{const e=_(8),{archived:t,components:s,children:o}=n,i=t===void 0?!1:t;if(s){const l=s.ThreadListItem;let u;e[0]!==l?(u=()=>r.jsx(l,{}),e[0]=l,e[1]=u):u=e[1];let c;return e[2]!==i||e[3]!==u?(c=r.jsx(Ke,{archived:i,children:u}),e[2]=i,e[3]=u,e[4]=c):c=e[4],c}let a;return e[5]!==i||e[6]!==o?(a=r.jsx(Ke,{archived:i,children:o}),e[5]=i,e[6]=o,e[7]=a):a=e[7],a};ot.displayName="ThreadListPrimitive.Items";const at=n=>{const e=_(2),{fallback:t}=n,s=P(On)||t;let o;return e[0]!==s?(o=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=o):o=e[1],o};at.displayName="ThreadListItemPrimitive.Title";function On(n){return n.threadListItem.title}const kn=()=>{const n=_(4),e=W();let t;n[0]!==e?(t=()=>{e.threadListItem().archive()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={archive:s},n[2]=s,n[3]=o):o=n[3],o},Bn=()=>{const n=_(4),e=W();let t;n[0]!==e?(t=()=>{e.threadListItem().delete()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={delete:s},n[2]=s,n[3]=o):o=n[3],o},Fn=()=>{const n=_(4),e=W();let t;n[0]!==e?(t=()=>{e.threadListItem().unarchive()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={unarchive:s},n[2]=s,n[3]=o):o=n[3],o},Kn=()=>{const n=_(4),e=W();let t;n[0]!==e?(t=()=>{e.threadListItem().switchTo()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={switchTo:s},n[2]=s,n[3]=o):o=n[3],o},$n=()=>{const n=_(4),e=W();let t;n[0]!==e?(t=()=>{e.threads().switchToNewThread()},n[0]=e,n[1]=t):t=n[1];const s=t;let o;return n[2]!==s?(o={switchToNewThread:s},n[2]=s,n[3]=o):o=n[3],o},zn=()=>{const n=_(5),e=W(),t=P(Gn);let s;n[0]!==e?(s=()=>{e.threads().loadMore()},n[0]=e,n[1]=s):s=n[1];const o=s;let i;return n[2]!==t||n[3]!==o?(i={loadMore:o,disabled:t},n[2]=t,n[3]=o,n[4]=i):i=n[4],i};function Gn(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var Un=Object.defineProperty,C=(n,e)=>Un(n,"name",{value:e,configurable:!0}),Hn=["Enter"," "],Vn=["ArrowDown","PageUp","Home"],it=["ArrowUp","PageDown","End"],Wn=[...Vn,...it],me="Menu",[ge,Xn,Yn]=Xe(me),[J,ct]=He(me,[Yn,Ve,We]),Te=Ve(),lt=We(),[qn,ie]=J(me),[Zn,Re]=J(me),Qn=C(n=>{const{__scopeMenu:e,open:t=!1,children:s,dir:o,onOpenChange:i,modal:a=!0}=n,l=Te(e),[u,c]=d.useState(null),m=d.useRef(!1),p=ln(i),h=ue(o);return d.useEffect(()=>{const f=C(()=>{m.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},"handleKeyDown"),v=C(()=>m.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),d.useEffect(()=>{if(!t)return;const f=C(()=>p(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[t,p]),r.jsx(un,{...l,children:r.jsx(qn,{scope:e,open:t,onOpenChange:p,content:u,onContentChange:c,children:r.jsx(Zn,{scope:e,onClose:d.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:h,modal:a,children:s})})})},"Menu"),Jn=d.forwardRef(C(function(e,t){const{__scopeMenu:s,...o}=e,i=Te(s);return r.jsx(dn,{...i,...o,ref:t})},"MenuAnchor")),ut="MenuPortal",[er,tr]=J(ut,{forceMount:void 0}),nr=C(n=>{const{__scopeMenu:e,forceMount:t,children:s,container:o}=n,i=ie(ut,e);return r.jsx(er,{scope:e,forceMount:t,children:r.jsx(Ye,{present:t||i.open,children:r.jsx(mn,{asChild:!0,container:o,children:s})})})},"MenuPortal"),q="MenuContent",[rr,dt]=J(q),sr=d.forwardRef(C(function(e,t){const s=tr(q,e.__scopeMenu),{forceMount:o=s.forceMount,...i}=e,a=ie(q,e.__scopeMenu),l=Re(q,e.__scopeMenu);return r.jsx(ge.Provider,{scope:e.__scopeMenu,children:r.jsx(Ye,{present:o||a.open,children:r.jsx(ge.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(or,{...i,ref:t}):r.jsx(ar,{...i,ref:t})})})})},"MenuContent")),or=d.forwardRef(C(function(e,t){const s=ie(q,e.__scopeMenu),o=d.useRef(null),i=Q(t,o);return d.useEffect(()=>{const a=o.current;if(a)return Qt(a)},[]),r.jsx(mt,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:T(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentModal")),ar=d.forwardRef(C(function(e,t){const s=ie(q,e.__scopeMenu);return r.jsx(mt,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),ir=cn("MenuContent.ScrollLock"),mt=d.forwardRef(C(function(e,t){const{__scopeMenu:s,loop:o=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:l,disableOutsidePointerEvents:u,onEntryFocus:c,onEscapeKeyDown:m,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:v,disableOutsideScroll:x,...w}=e,y=ie(q,s),j=Re(q,s),L=Te(s),A=lt(s),E=Xn(s),[B,R]=d.useState(null),k=d.useRef(null),I=Q(t,k,y.onContentChange),N=d.useRef(0),D=d.useRef(""),M=d.useRef(0),O=d.useRef(null),H=d.useRef("right"),K=d.useRef(0),G=x?en:d.Fragment,b=x?{as:ir,allowPinchZoom:!0}:void 0,Z=C(g=>{var ee,De;const F=D.current+g,V=E().filter(X=>!X.disabled),Y=document.activeElement,fe=(ee=V.find(X=>X.ref.current===Y))==null?void 0:ee.textValue,he=V.map(X=>X.textValue),Ee=gt(he,F,fe),oe=(De=V.find(X=>X.textValue===Ee))==null?void 0:De.ref.current;C((function X(_e){D.current=_e,window.clearTimeout(N.current),_e!==""&&(N.current=window.setTimeout(()=>X(""),1e3))}),"updateSearch")(F),oe&&setTimeout(()=>oe.focus())},"handleTypeaheadSearch");d.useEffect(()=>()=>window.clearTimeout(N.current),[]),Jt();const $=d.useCallback(g=>{var V,Y;return H.current===((V=O.current)==null?void 0:V.side)&&bt(g,(Y=O.current)==null?void 0:Y.area)},[]);return r.jsx(rr,{scope:s,searchRef:D,onItemEnter:d.useCallback(g=>{$(g)&&g.preventDefault()},[$]),onItemLeave:d.useCallback(g=>{var F;$(g)||((F=k.current)==null||F.focus(),R(null))},[$]),onTriggerLeave:d.useCallback(g=>{$(g)&&g.preventDefault()},[$]),pointerGraceTimerRef:M,onPointerGraceIntentChange:d.useCallback(g=>{O.current=g},[]),children:r.jsx(G,{...b,children:r.jsx(tn,{asChild:!0,trapped:i,onMountAutoFocus:T(a,g=>{var F;g.preventDefault(),(F=k.current)==null||F.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(nn,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:m,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:v,children:r.jsx(rn,{asChild:!0,...A,dir:j.dir,orientation:"vertical",loop:o,currentTabStopId:B,onCurrentTabStopIdChange:R,onEntryFocus:T(c,g=>{j.isUsingKeyboardRef.current||g.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(sn,{role:"menu","aria-orientation":"vertical","data-state":ft(y.open),"data-radix-menu-content":"",dir:j.dir,...L,...w,ref:I,style:{outline:"none",...w.style},onKeyDown:T(w.onKeyDown,g=>{const V=g.target.closest("[data-radix-menu-content]")===g.currentTarget,Y=g.ctrlKey||g.altKey||g.metaKey,fe=g.key.length===1;V&&(g.key==="Tab"&&g.preventDefault(),!Y&&fe&&Z(g.key));const he=k.current;if(g.target!==he||!Wn.includes(g.key))return;g.preventDefault();const oe=E().filter(ee=>!ee.disabled).map(ee=>ee.ref.current);it.includes(g.key)&&oe.reverse(),pt(oe)}),onBlur:T(e.onBlur,g=>{g.currentTarget.contains(g.target)||(window.clearTimeout(N.current),D.current="")}),onPointerMove:T(e.onPointerMove,le(g=>{const F=g.target,V=K.current!==g.clientX;if(g.currentTarget.contains(F)&&V){const Y=g.clientX>K.current?"right":"left";H.current=Y,K.current=g.clientX}}))})})})})})})},"MenuContentImpl")),ve="MenuItem",$e="menu.itemSelect",cr=d.forwardRef(C(function(e,t){const{disabled:s=!1,onSelect:o,...i}=e,a=d.useRef(null),l=Re(ve,e.__scopeMenu),u=dt(ve,e.__scopeMenu),c=Q(t,a),m=d.useRef(!1),p=C(()=>{const h=a.current;if(!s&&h){const f=new CustomEvent($e,{bubbles:!0,cancelable:!0});h.addEventListener($e,v=>o==null?void 0:o(v),{once:!0}),on(h,f),f.defaultPrevented?m.current=!1:l.onClose()}},"handleSelect");return r.jsx(lr,{...i,ref:c,disabled:s,onClick:T(e.onClick,p),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),m.current=!0},onPointerUp:T(e.onPointerUp,h=>{var f;m.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:T(e.onKeyDown,h=>{s||h.target!==h.currentTarget||u.searchRef.current!==""&&h.key===" "||Hn.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),lr=d.forwardRef(C(function(e,t){const{__scopeMenu:s,disabled:o=!1,textValue:i,...a}=e,l=dt(ve,s),u=lt(s),c=d.useRef(null),m=Q(t,c),[p,h]=d.useState(!1),[f,v]=d.useState("");return d.useEffect(()=>{const x=c.current;x&&v((x.textContent??"").trim())},[a.children]),r.jsx(ge.ItemSlot,{scope:s,disabled:o,textValue:i??f,children:r.jsx(an,{asChild:!0,...u,focusable:!o,children:r.jsx(we.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...a,ref:m,onPointerMove:T(e.onPointerMove,le(x=>{o?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:T(e.onPointerLeave,le(x=>l.onItemLeave(x))),onFocus:T(e.onFocus,()=>h(!0)),onBlur:T(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),ur="MenuRadioGroup",[bs,ws]=J(ur,{value:void 0,onValueChange:C(()=>{},"onValueChange")}),dr="MenuItemIndicator",[ys,Is]=J(dr,{checked:!1}),mr=d.forwardRef(C(function(e,t){const{__scopeMenu:s,...o}=e;return r.jsx(we.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})},"MenuSeparator")),fr="MenuSub",[js,Ms]=J(fr);function ft(n){return n?"open":"closed"}C(ft,"getOpenState");function ht(n){return n==="indeterminate"}C(ht,"isIndeterminate");function hr(n){return ht(n)?"indeterminate":n?"checked":"unchecked"}C(hr,"getCheckedState");function pt(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}C(pt,"focusFirst");function xt(n,e){return n.map((t,s)=>n[(e+s)%n.length])}C(xt,"wrapArray");function gt(n,e,t){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=t?n.indexOf(t):-1;let a=xt(n,Math.max(i,0));o.length===1&&(a=a.filter(c=>c!==t));const u=a.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return u!==t?u:void 0}C(gt,"getNextMatch");function vt(n,e){const{x:t,y:s}=n;let o=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){const l=e[i],u=e[a],c=l.x,m=l.y,p=u.x,h=u.y;m>s!=h>s&&t<(p-c)*(s-m)/(h-m)+c&&(o=!o)}return o}C(vt,"isPointInPolygon");function bt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return vt(t,e)}C(bt,"isPointerInGraceArea");function le(n){return e=>e.pointerType==="mouse"?n(e):void 0}C(le,"whenMouse");var pr=Qn,xr=Jn,gr=nr,vr=sr,br=cr,wr=mr,yr=Object.defineProperty,re=(n,e)=>yr(n,"name",{value:e,configurable:!0}),Ne="DropdownMenu",[Ir,wt]=He(Ne,[ct]),se=ct(),[jr,yt]=Ir(Ne),It=re(n=>{const{__scopeDropdownMenu:e,children:t,dir:s,open:o,defaultOpen:i,onOpenChange:a,modal:l=!0}=n,u=se(e),c=d.useRef(null),[m,p]=qe({prop:o,defaultProp:i??!1,onChange:a,caller:Ne});return r.jsx(jr,{scope:e,triggerId:Ae(),triggerRef:c,contentId:Ae(),open:m,onOpenChange:p,onOpenToggle:d.useCallback(()=>p(h=>!h),[p]),modal:l,children:r.jsx(pr,{...u,open:m,onOpenChange:p,dir:s,modal:l,children:t})})},"DropdownMenu"),Mr="DropdownMenuTrigger",jt=d.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,disabled:o=!1,...i}=e,a=yt(Mr,s),l=se(s),u=Q(t,a.triggerRef);return r.jsx(xr,{asChild:!0,...l,children:r.jsx(we.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:u,onPointerDown:T(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(a.onOpenToggle(),a.open||c.preventDefault())}),onKeyDown:T(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&a.onOpenToggle(),c.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),Mt=re(n=>{const{__scopeDropdownMenu:e,...t}=n,s=se(e);return r.jsx(gr,{...s,...t})},"DropdownMenuPortal"),Cr="DropdownMenuContent",Ct=d.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=yt(Cr,s),a=se(s),l=d.useRef(!1);return r.jsx(vr,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...o,ref:t,onCloseAutoFocus:T(e.onCloseAutoFocus,u=>{var c;l.current||(c=i.triggerRef.current)==null||c.focus(),l.current=!1,u.preventDefault()}),onInteractOutside:T(e.onInteractOutside,u=>{const c=u.detail.originalEvent,m=c.button===0&&c.ctrlKey===!0,p=c.button===2||m;(!i.modal||p)&&(l.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)"}})},"DropdownMenuContent")),St=d.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=se(s);return r.jsx(br,{...i,...o,ref:t})},"DropdownMenuItem")),Lt=d.forwardRef(re(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=se(s);return r.jsx(wr,{...i,...o,ref:t})},"DropdownMenuSeparator")),Tt=It,Rt=jt,Sr=Mt,Nt=Ct,Pt=St,Et=Lt;const Lr=Object.freeze(Object.defineProperty({__proto__:null,Content:Nt,DropdownMenu:It,DropdownMenuContent:Ct,DropdownMenuItem:St,DropdownMenuPortal:Mt,DropdownMenuSeparator:Lt,DropdownMenuTrigger:jt,Item:Pt,Portal:Sr,Root:Tt,Separator:Et,Trigger:Rt,createDropdownMenuScope:wt},Symbol.toStringTag,{value:"Module"})),Tr=de(Rt),Rr=de(Nt),Nr=de(Pt),Pr=de(Et),Dt=d.forwardRef((n,e)=>{const t=_(15);let s,o,i;t[0]!==n?({onClick:o,disabled:s,...i}=n,t[0]=n,t[1]=s,t[2]=o,t[3]=i):(s=t[1],o=t[2],i=t[3]);const a=P(Er),{switchToNewThread:l}=$n();let u;t[4]!==a?(u=a?{"data-active":"true","aria-current":"true"}:null,t[4]=a,t[5]=u):u=t[5];let c;t[6]!==o||t[7]!==l?(c=T(o,l),t[6]=o,t[7]=l,t[8]=c):c=t[8];let m;return t[9]!==s||t[10]!==e||t[11]!==i||t[12]!==u||t[13]!==c?(m=r.jsx(ye.button,{type:"button",...u,...i,ref:e,disabled:s,onClick:c}),t[9]=s,t[10]=e,t[11]=i,t[12]=u,t[13]=c,t[14]=m):m=t[14],m});Dt.displayName="ThreadListPrimitive.New";function Er(n){return n.threads.newThreadId===n.threads.mainThreadId}const Dr=()=>{const{loadMore:n,disabled:e}=zn();return e?null:n},_r=ae("ThreadListPrimitive.LoadMore",Dr),[Ar,Or]=Xe("ThreadList"),be=Ar,_t=je(null),kr=_t.Provider,Pe=()=>Ie(_t),At=d.forwardRef((n,e)=>{const t=_(3);let s;return t[0]!==n||t[1]!==e?(s=r.jsx(be.Provider,{scope:void 0,children:r.jsx(be.Slot,{scope:void 0,children:r.jsx(ye.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=s):s=t[2],s});At.displayName="ThreadListPrimitive.Root";var Br=Me({ItemByIndex:()=>st,Items:()=>ot,LoadMore:()=>_r,New:()=>Dt,Root:()=>At});const Ot=d.forwardRef((n,e)=>{const t=P(c=>c.threads.mainThreadId===c.threadListItem.id),s=Oe(null),o=Oe(null),i=Ue(()=>({triggerRef:s,moreRef:o}),[]),a=Or(void 0),l=ue(),u=c=>{const m=l==="rtl"?"ArrowLeft":"ArrowRight",p=l==="rtl"?"ArrowRight":"ArrowLeft",h=s.current,f=o.current;if(h&&c.target===h)if(c.key==="ArrowDown"||c.key==="ArrowUp"){const v=a().map(w=>w.ref.current).filter(w=>w!==null),x=v[v.indexOf(h)+(c.key==="ArrowDown"?1:-1)];x&&(x.focus(),c.preventDefault())}else c.key===m&&f&&(f.focus(),c.preventDefault());else f&&c.target===f&&c.key===p&&(h==null||h.focus(),c.preventDefault())};return r.jsx(kr,{value:i,children:r.jsx(ye.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:T(n.onKeyDown,u),ref:e})})});Ot.displayName="ThreadListItemPrimitive.Root";const Fr=()=>{const{archive:n}=kn();return n},Kr=ae("ThreadListItemPrimitive.Archive",Fr),$r=()=>{const{unarchive:n}=Fn();return n},zr=ae("ThreadListItemPrimitive.Unarchive",$r),Gr=()=>{const{delete:n}=Bn();return n},Ur=ae("ThreadListItemPrimitive.Delete",Gr),Hr=()=>{const{switchTo:n}=Kn();return n},Vr=ae("ThreadListItemPrimitive.Trigger",Hr),kt=d.forwardRef((n,e)=>{var i;const t=_(3),s=Q(e,(i=Pe())==null?void 0:i.triggerRef);let o;return t[0]!==n||t[1]!==s?(o=r.jsx(be.ItemSlot,{scope:void 0,children:r.jsx(Vr,{...n,ref:s})}),t[0]=n,t[1]=s,t[2]=o):o=t[2],o});kt.displayName="ThreadListItemPrimitive.Trigger";var Bt=Me({Archive:()=>Kr,Delete:()=>Ur,Root:()=>Ot,Title:()=>at,Trigger:()=>kt,Unarchive:()=>zr});const ce=wt(),Ft=je(()=>{}),Kt=()=>Ie(Ft),$t=je(!1),zt=()=>Ie($t),Gt=n=>{const e=_(26);let t,s,o,i,a,l,u;e[0]!==n?({__scopeThreadListItemMore:t,open:a,defaultOpen:s,onOpenChange:i,sharedFocusGroup:u,modal:o,...l}=n,e[0]=n,e[1]=t,e[2]=s,e[3]=o,e[4]=i,e[5]=a,e[6]=l,e[7]=u):(t=e[1],s=e[2],o=e[3],i=e[4],a=e[5],l=e[6],u=e[7]);const c=u===void 0?!1:u,m=c?!1:o??!0,p=ce(t),h=s??!1;let f;e[8]!==i?(f=i?{onChange:i}:{},e[8]=i,e[9]=f):f=e[9];let v;e[10]!==a||e[11]!==h||e[12]!==f?(v={prop:a,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...f},e[10]=a,e[11]=h,e[12]=f,e[13]=v):v=e[13];const[x,w]=qe(v);let y;e[14]!==m||e[15]!==x||e[16]!==l||e[17]!==p||e[18]!==w?(y=r.jsx(Tt,{...p,...l,modal:m,open:x,onOpenChange:w}),e[14]=m,e[15]=x,e[16]=l,e[17]=p,e[18]=w,e[19]=y):y=e[19];let j;e[20]!==w||e[21]!==y?(j=r.jsx(Ft.Provider,{value:w,children:y}),e[20]=w,e[21]=y,e[22]=j):j=e[22];let L;return e[23]!==c||e[24]!==j?(L=r.jsx($t.Provider,{value:c,children:j}),e[23]=c,e[24]=j,e[25]=L):L=e[25],L};Gt.displayName="ThreadListItemMorePrimitive.Root";const Ut=d.forwardRef((n,e)=>{const t=_(10),{__scopeThreadListItemMore:s,...o}=n,i=ce(s),a=Pe(),l=Kt(),u=zt(),c=Q(e,a==null?void 0:a.moreRef),m=ue()==="rtl"?"ArrowLeft":"ArrowRight",p=Tr;let h;t[0]!==m||t[1]!==l||t[2]!==u?(h=x=>{!u||x.key!==m||(x.preventDefault(),l(!0))},t[0]=m,t[1]=l,t[2]=u,t[3]=h):h=t[3];const f=T(o.onKeyDown,h);let v;return t[4]!==p||t[5]!==c||t[6]!==o||t[7]!==i||t[8]!==f?(v=r.jsx(p,{...i,...o,onKeyDown:f,ref:c}),t[4]=p,t[5]=c,t[6]=o,t[7]=i,t[8]=f,t[9]=v):v=t[9],v});Ut.displayName="ThreadListItemMorePrimitive.Trigger";const Ht=d.forwardRef((n,e)=>{const t=_(21),{__scopeThreadListItemMore:s,portalProps:o,sideOffset:i,...a}=n,l=i===void 0?4:i,u=ce(s),c=Kt(),m=Pe(),p=zt(),h=ue()==="rtl"?"ArrowRight":"ArrowLeft",f=Lr,v=Rr;let x;t[0]!==h||t[1]!==(m==null?void 0:m.moreRef)||t[2]!==c||t[3]!==p?(x=E=>{var B;!p||E.key!==h||(E.preventDefault(),c(!1),(B=m==null?void 0:m.moreRef.current)==null||B.focus())},t[0]=h,t[1]=m==null?void 0:m.moreRef,t[2]=c,t[3]=p,t[4]=x):x=t[4];const w=T(a.onKeyDown,x);let y;t[5]!==(m==null?void 0:m.moreRef)||t[6]!==p?(y=()=>{var E;p&&((E=m==null?void 0:m.moreRef.current)==null||E.focus())},t[5]=m==null?void 0:m.moreRef,t[6]=p,t[7]=y):y=t[7];const j=T(a.onEscapeKeyDown,y);let L;t[8]!==v||t[9]!==e||t[10]!==a||t[11]!==u||t[12]!==l||t[13]!==w||t[14]!==j?(L=r.jsx(v,{...u,...a,onKeyDown:w,onEscapeKeyDown:j,ref:e,sideOffset:l}),t[8]=v,t[9]=e,t[10]=a,t[11]=u,t[12]=l,t[13]=w,t[14]=j,t[15]=L):L=t[15];let A;return t[16]!==o||t[17]!==u||t[18]!==f.Portal||t[19]!==L?(A=r.jsx(f.Portal,{...u,...o,children:L}),t[16]=o,t[17]=u,t[18]=f.Portal,t[19]=L,t[20]=A):A=t[20],A});Ht.displayName="ThreadListItemMorePrimitive.Content";const Vt=d.forwardRef((n,e)=>{const t=_(7);let s,o;t[0]!==n?({__scopeThreadListItemMore:s,...o}=n,t[0]=n,t[1]=s,t[2]=o):(s=t[1],o=t[2]);const i=ce(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Nr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Vt.displayName="ThreadListItemMorePrimitive.Item";const Wt=d.forwardRef((n,e)=>{const t=_(7);let s,o;t[0]!==n?({__scopeThreadListItemMore:s,...o}=n,t[0]=n,t[1]=s,t[2]=o):(s=t[1],o=t[2]);const i=ce(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Pr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Wt.displayName="ThreadListItemMorePrimitive.Separator";var xe=Me({Content:()=>Ht,Item:()=>Vt,Root:()=>Gt,Separator:()=>Wt,Trigger:()=>Ut});function Wr(){const n=ne(),e=Ze(),t=Ce(),s=Qe(),o=t||s,[i,a]=d.useState(!1),[l,u]=d.useState(""),[c,m]=d.useState(null),p=d.useRef(null),h=d.useRef(null),f=d.useId(),v=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,x=(n==null?void 0:n.historyAgentFilter)??null;d.useEffect(()=>{i||u("")},[i]);const{agents:w,isInitialLoading:y,isSearching:j,loadingMore:L,hasMore:A,listRef:E,sentinelRef:B}=bn({enabled:i&&v,query:l});if(d.useLayoutEffect(()=>{if(!i||o){m(null);return}const I=()=>{var D;const N=(D=p.current)==null?void 0:D.getBoundingClientRect();N&&m({top:N.top,left:N.right+4})};return I(),window.addEventListener("resize",I),window.addEventListener("scroll",I,!0),()=>{window.removeEventListener("resize",I),window.removeEventListener("scroll",I,!0)}},[i,o]),d.useEffect(()=>{if(!i||o)return;const I=N=>{var M,O;const D=N.target;(M=p.current)!=null&&M.contains(D)||(O=h.current)!=null&&O.contains(D)||a(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[i,o]),!v)return null;const R=I=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(I),a(!1)},k=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-1",onMouseDown:I=>I.stopPropagation(),children:[r.jsx(wn,{query:l,setQuery:u,placeholder:"Search agents"}),j?r.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),r.jsxs("div",{ref:E,className:z("mt-1 overflow-y-auto",o?"min-h-0 flex-1 px-1 pb-2":"min-h-48 max-h-64"),children:[l.trim()===""?r.jsxs(ke,{className:z("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>R(null),children:["All chats",x==null?r.jsx(U,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,y?r.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):w.length===0?r.jsx("p",{className:"text-text-secondary px-2 py-6 text-center text-xs",role:"status",children:l.trim()?`No agents match "${l.trim()}".`:"No agents yet."}):r.jsxs(r.Fragment,{children:[w.map(I=>{const N=yn(I),D=(x==null?void 0:x.agentId)===N;return r.jsxs(ke,{className:z("justify-between gap-2 text-left",D&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>R({agentId:N,agentName:I.name,intent:"history"}),children:[r.jsx("span",{className:"min-w-0 truncate",children:I.name}),D?r.jsx(U,{name:"check",className:"size-3.5 shrink-0"}):null]},N)}),A?r.jsx("div",{ref:B,className:"flex h-6 shrink-0 items-center justify-center","aria-hidden":!0,children:L?r.jsx("span",{className:"text-text-secondary text-[11px]",role:"status",children:"Loading more…"}):null}):null]})]})]});return r.jsxs("div",{className:"relative shrink-0",children:[r.jsxs("button",{ref:p,type:"button","aria-label":x!=null?`Filter chat history by agent (${x.agentName})`:"Filter chat history by agent","aria-haspopup":o?"dialog":"menu","aria-expanded":i,"aria-controls":i?f:void 0,title:"Filter by agent",className:te({variant:"ghost",size:"icon",className:z("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",x!=null&&"text-text-primary")}),onClick:()=>a(I=>!I),children:[r.jsx(U,{name:"funnel",className:"size-3.5"}),x!=null?r.jsx("span",{className:"bg-primary-button-bg absolute top-1 right-1 size-1.5 rounded-full","aria-hidden":!0,"data-testid":"history-filter-active-dot"}):null]}),o&&i?r.jsx(Je,{open:!0,onOpenChange:a,id:f,"aria-label":"Filter agents",children:r.jsx("div",{className:"flex min-h-0 flex-1 flex-col p-2",role:"menu",children:k})}):null,!o&&i&&c!=null?In.createPortal(r.jsx("div",{ref:h,id:f,role:"menu","aria-label":"Filter agents",style:{top:c.top,left:c.left},className:"aui-popup-enter font-sans-flex fixed z-50 w-56 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md",children:k}),jn(p.current)):null]})}function Xr({open:n,initialTitle:e,saving:t=!1,onOpenChange:s,onSave:o}){const[i,a]=d.useState(e),l=d.useRef(null);d.useEffect(()=>{n&&a(e)},[n,e]),d.useEffect(()=>{if(!n)return;const f=l.current;f!=null&&(f.focus(),f.select())},[n]);const u=i.trim(),m=u.length>0&&u.length<=Be&&!t,p=()=>{m&&o(u)},h=f=>{t||s(f)};return r.jsx(Mn,{open:n,onOpenChange:h,title:"Rename session",contentSized:!0,"aria-label":"Rename session",footer:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(Fe.Secondary,{type:"button",disabled:t,onClick:()=>h(!1),children:"Cancel"}),r.jsx(Fe.Primary,{type:"button",disabled:!m,onClick:p,children:"Save"})]}),children:r.jsx("div",{className:"px-5 py-4",children:r.jsx("input",{ref:l,"aria-label":"Session title",value:i,readOnly:t,maxLength:Be,className:Cn("h-9"),onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),p())}})})})}var Yr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium outline-none transition-colors hover:bg-ghost-button-hover focus:bg-ghost-button-hover data-[highlighted]:bg-ghost-button-hover",qr="flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-failure-bg outline-none transition-colors hover:bg-failure-bg/12 hover:text-failure-bg focus:bg-failure-bg/12 focus:text-failure-bg data-[highlighted]:bg-failure-bg/12 data-[highlighted]:text-failure-bg";function Zr({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:s,onRename:o}){const i=S("PermissionGuard"),a=Qe(),l=Ce(),[u,c]=d.useState(!1),[m,p]=d.useState(),h=l||a,f=d.useCallback(y=>{const j=y==null?void 0:y.closest(".aui-theme-root");p(j instanceof HTMLElement?j:void 0)},[]),v=te({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),x=n?r.jsx(i,{allowed:!e,children:r.jsxs("button",{type:"button",className:Yr,disabled:e,onClick:()=>{e||(c(!1),o())},children:[r.jsx(U,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,w=t?r.jsx(i,{allowed:!s,children:r.jsxs(Bt.Delete,{className:qr,onClick:()=>{s||c(!1)},children:[r.jsx(U,{name:"trash",className:"size-3.5"}),"Delete"]})}):null;return h?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Session actions",title:"Session actions","aria-haspopup":"dialog","aria-expanded":u,className:v,onClick:()=>c(!0),children:r.jsx(U,{name:"ellipsis",className:"size-3.5"})}),u?r.jsx(Je,{open:!0,onOpenChange:c,"aria-label":"Session actions",children:r.jsxs("div",{className:"flex flex-col gap-1 p-2 *:w-full",role:"menu",children:[x,w]})}):null]}):r.jsxs(xe.Root,{sharedFocusGroup:!0,children:[r.jsx(xe.Trigger,{ref:f,"aria-label":"Session actions",title:"Session actions",className:v,children:r.jsx(U,{name:"ellipsis",className:"size-3.5"})}),r.jsxs(xe.Content,{portalProps:{container:m},align:"end",sideOffset:4,className:"aui-popup-enter font-sans-flex z-50 min-w-32 rounded-md border border-border bg-card-bg p-1 text-text-primary shadow-md *:w-full",children:[x,w]})]})}function Qr({onThreadOpen:n,canRenameSession:e,canDeleteSession:t,canManageResource:s,canDeleteResource:o}){const i=W(),a=ne(),l=pn(),u=S("ThreadListRow"),c=P(M=>M.threadListItem.id),m=P(M=>M.threadListItem.remoteId),p=P(M=>M.threadListItem.title),h=P(M=>M.threadListItem.lastMessageAt),f=P(M=>M.threadListItem.custom),v=P(M=>M.threads.mainThreadId),x=xn(f),w=e&&m!=null,y=t&&m!=null,j=w||y,L=m!=null&&!s(m),A=m!=null&&!o(m),E=(a==null?void 0:a.libraryOpen)===!0||(a==null?void 0:a.sessionsOpen)===!0||(a==null?void 0:a.schedulesOpen)===!0||(a==null?void 0:a.environmentsOpen)===!0,[B,R]=d.useState(!1),[k,I]=d.useState(!1),N=p??"New Chat",D=async M=>{if(M===(p??"").trim()){R(!1);return}I(!0);try{await i.threadListItem().rename(M),R(!1)}catch(O){l==null||l.showError(O)}finally{I(!1)}};return r.jsxs(Bt.Root,{className:"min-w-0",children:[r.jsx(u,{title:N,active:c===v&&!E,agentName:x,lastMessageAt:h,onSelect:()=>{n==null||n(),a==null||a.setSettingsOpen(!1),a==null||a.setLibraryOpen(!1),a==null||a.setSessionsOpen(!1),a==null||a.setSchedulesOpen(!1),a==null||a.setEnvironmentsOpen(!1);const M=gn(f),O=!M&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(x==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===x||a.mode.agentId===x),H=vn({sessionMutable:M,shellMutable:(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable,...(a==null?void 0:a.mode.status)==="active"&&a.mode.isMutable?{shellAgentName:a.mode.agentName,shellAgentId:a.mode.agentId}:{},remoteId:m,pendingSessionId:a==null?void 0:a.pendingSessionId});if((O||H)&&m!=null){Promise.resolve(i.threads().switchToThread(c)).catch(()=>{});return}if(m!=null){a==null||a.openHistorySession({sessionId:m,isMutable:M,...x!=null?{agentName:x}:{}});return}Promise.resolve(i.threads().switchToThread(c)).catch(()=>{})},actions:j?r.jsx(Zr,{canRename:w,renameDisabled:L,canDelete:y,deleteDisabled:A,onRename:()=>R(!0)}):void 0}),r.jsx(Xr,{open:B,initialTitle:p??"",saving:k,onOpenChange:R,onSave:M=>{D(M)}})]})}function Jr(n){const e=P(s=>s.threads.threadIds),t=P(s=>s.threads.threadItems);return d.useMemo(()=>{const s=hn({threadIds:e,threadItems:t});if(n==="default")return s;const o=new Map;for(const i of t)o.set(i.id,i),i.remoteId!=null&&o.set(i.remoteId,i);return s.filter(i=>{const a=e[i];if(a===void 0)return!1;const l=o.get(a);return(l==null?void 0:l.remoteId)!=null})},[e,t,n])}function es(n){return n==="recent-history"||n==="mobile-drawer"}function ts({indices:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i}){const a=P(l=>l.threads.threadIds);return r.jsx(r.Fragment,{children:n.map(l=>{const u=a[l]??String(l);return r.jsx(Le,{index:l,archived:!1,children:r.jsx(Qr,{onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i})},u)})})}var ns="aui_thread-list-viewport",rs=80;function ss({children:n,viewportRef:e,hideScrollbar:t}){var u;const s=ne(),o=P(c=>c.threadListItem.remoteId),i=(u=s==null?void 0:s.historyAgentFilter)==null?void 0:u.intent,a=(s==null?void 0:s.isLibraryEnabled)===!0&&i!=="try-agent"&&(i==="history"||s.mode.status!=="active"||s.mode.isMutable||s.pendingSessionId!=null||o!=null),l=(s==null?void 0:s.historyAgentFilter)==null?"Chat History":`Chats for ${s.historyAgentFilter.agentName}`;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-1 py-1",children:[r.jsx("h2",{className:"min-w-0 flex-1 truncate px-1.5 py-1 text-sm font-medium text-text-secondary",children:l}),a?r.jsx(Wr,{}):null]}),r.jsx("div",{ref:e,"data-slot":ns,className:z("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function Xt({onThreadOpen:n,variant:e="default"}={}){const t=W(),s=Ze(),o=P(b=>b.threads.isLoading),i=P(b=>b.threads.isLoadingMore),a=P(b=>b.threads.hasMore),l=P(b=>b.threads.threadIds),u=P(b=>b.threads.threadItems),c=ne(),m=S("ThreadListShell"),p=S("ThreadListNewButton"),h=S("AgentsLibraryButton"),f=S("SessionsBrowserButton"),v=S("SchedulesButton"),x=S("EnvironmentsButton"),w=S("ThreadListRowSkeleton"),y=S("ThreadListEmptyState"),j=Jr(e),L=d.useRef(null),A=d.useRef(a),E=d.useRef(t);A.current=a,E.current=t;const B=(c==null?void 0:c.isNewChatEnabled)!==!1,R=(c==null?void 0:c.mode.status)==="idle",k=es(e),I=e==="mobile-drawer",N=typeof(s==null?void 0:s.renameSession)=="function",D=typeof(s==null?void 0:s.deleteSession)=="function",M=d.useMemo(()=>u.flatMap(b=>b.remoteId==null?[]:[b.remoteId]),[u]),{allows:O}=fn({resourceType:"session",resourceIds:M});d.useEffect(()=>{if(R||o||i)return;const b=L.current;if(!b)return;let Z=!1;const $=()=>{if(Z||!A.current||b.clientHeight<=0)return;const F=b.scrollHeight-b.scrollTop-b.clientHeight;b.scrollHeight>b.clientHeight&&F>rs||E.current.threads().loadMore()};b.addEventListener("scroll",$,{passive:!0});const g=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>$());return g?g.observe(b):window.addEventListener("resize",$),$(),()=>{Z=!0,b.removeEventListener("scroll",$),g==null||g.disconnect(),g||window.removeEventListener("resize",$)}},[a,R,o,i,l.length]);const H=()=>{if(n==null||n(),c==null||c.setLibraryOpen(!1),c==null||c.setSessionsOpen(!1),c!=null&&c.isComposerEnabled){c.openDraft();return}c==null||c.setSettingsOpen(!1),c==null||c.setSchedulesOpen(!1),c==null||c.setEnvironmentsOpen(!1),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let K;R?K=r.jsx(y,{message:k?"No recent chats":void 0}):o?K=r.jsx(w,{}):j.length===0?K=r.jsx(y,{message:k?"No recent chats":void 0}):K=r.jsx(Br.Root,{className:"flex min-h-0 flex-col gap-0.5",children:r.jsx(ts,{indices:j,onThreadOpen:n,canRenameSession:N,canDeleteSession:D,canManageResource:b=>O(b,"MANAGE"),canDeleteResource:b=>O(b,"DELETE")})});const G=e==="recent-history"?null:r.jsxs("div",{className:"flex flex-col gap-1",children:[B?r.jsx(p,{onClick:H}):null,r.jsx("div",{className:"contents",onClick:()=>{I&&(n==null||n())},children:r.jsx(h,{})}),I?null:r.jsxs(r.Fragment,{children:[r.jsx(f,{}),r.jsx(v,{}),r.jsx(x,{})]})]});return r.jsx(m,{header:G,children:r.jsxs(ss,{viewportRef:L,hideScrollbar:k,children:[K,!R&&a?r.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var os=d.lazy(()=>Se(()=>import("./SettingsBuilder-OU3B7YHU-S7QVus7g.js"),__vite__mapDeps([0,1,2]),import.meta.url)),as=d.lazy(()=>Se(()=>import("./SchedulesPage-UNS7BDS6-u3WcJt5Z.js"),__vite__mapDeps([3,4,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),is=d.lazy(()=>Se(()=>import("./EnvironmentsPage-YV2D2VMM-Bd6RGp02.js"),__vite__mapDeps([5,4,1,2]),import.meta.url).then(n=>({default:n.EnvironmentsPage}))),cs="h-5 w-5 max-w-40 shrink-0 object-contain",ls="h-5 max-w-40 shrink-0 object-contain",us="w-20",ds="w-80",ze=z(En,"text-sidebar-text"),Ge="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function ms({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function fs(){return Nn().presentation==="full"?null:r.jsx("aside",{"aria-label":"Recent chats",className:"hidden min-h-0 w-64 shrink-0 border-r border-border bg-sidebar-bg md:flex",children:r.jsx(Xt,{variant:"recent-history"})})}function hs(){var f;const n=W(),e=ne(),t=S("AgentsLibraryButton"),s=S("SessionsBrowserButton"),o=S("SchedulesButton"),i=S("EnvironmentsButton"),a=(e==null?void 0:e.isNewChatEnabled)!==!1,l=(e==null?void 0:e.settingsOpen)===!0||(e==null?void 0:e.libraryOpen)===!0||(e==null?void 0:e.sessionsOpen)===!0||(e==null?void 0:e.schedulesOpen)===!0||(e==null?void 0:e.environmentsOpen)===!0,u=e==null?void 0:e.mode,c=!l&&(u==null?void 0:u.status)==="active"&&!u.isCreateAgent&&((f=e==null?void 0:e.historyAgentFilter)==null?void 0:f.intent)!=="try-agent",m=!l&&u!=null&&et(u),p=()=>{if(e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled){e.openDraft();return}e==null||e.setSettingsOpen(!1),e==null||e.setSchedulesOpen(!1),e==null||e.setEnvironmentsOpen(!1),Promise.resolve(n.threads().switchToNewThread()).catch(()=>{})},h=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return r.jsxs("nav",{className:"flex min-h-0 flex-1 flex-col items-center gap-1 p-1","aria-label":"Sidebar",children:[a?r.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":c?"page":void 0,className:te({variant:"ghost",className:z(ze,c&&Ge)}),onClick:p,children:[r.jsx(U,{name:"square-pen",size:14}),r.jsx("span",{className:"text-center",children:"New Chat"})]}):null,a&&(e!=null&&e.isComposerEnabled)?r.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":m?"page":void 0,className:te({variant:"ghost",className:z(ze,m&&Ge)}),onClick:h,children:[r.jsx(U,{name:"agent-2",size:14}),r.jsx("span",{className:"text-center whitespace-nowrap",children:"Build Agent"})]}):null,r.jsx(t,{compact:!0}),r.jsx(s,{compact:!0}),r.jsx(o,{compact:!0}),r.jsx(i,{compact:!0})]})}function ps({className:n,railRef:e,...t}){const s=tt(),o=nt(s),i=S("BrandLogo"),a=S("UserAvatar");return r.jsxs("aside",{ref:e,className:z(us,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",n),...t,children:[r.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:r.jsx(i,{variant:o.collapsedVariant,className:cs})}),r.jsx(hs,{}),r.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[r.jsx(rt,{labeled:!0,className:"flex-col"}),r.jsx(a,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function xs({drawerRef:n,onClose:e}){const t=tt(),s=nt(t),o=Pn(),i=S("BrandLogo"),a=S("UserAvatar");return r.jsxs("aside",{ref:n,role:"dialog","aria-label":"Navigation",tabIndex:-1,className:z(ds,"absolute inset-y-0 left-0 z-10 flex min-h-0 flex-col border-r border-border bg-sidebar-bg shadow-lg outline-none md:hidden"),children:[r.jsxs("div",{className:"flex h-14 w-full shrink-0 items-center gap-2 border-b border-border px-3 text-text-primary",children:[r.jsx(i,{variant:s.expandedVariant,className:ls}),s.showTitle&&o!=null?r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:o}):r.jsx("span",{className:"min-w-0 flex-1"}),r.jsx("button",{type:"button","aria-label":"Close navigation",className:te({variant:"ghost",size:"icon"}),onClick:e,children:r.jsx(U,{name:"xmark"})})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Xt,{variant:"mobile-drawer",onThreadOpen:e})}),r.jsxs("footer",{className:"flex shrink-0 items-center justify-around gap-1 border-t border-border p-2 text-sidebar-text",children:[r.jsx(rt,{labeled:!0,onAction:e,className:"contents"}),r.jsx(a,{labeled:!0})]})]})}function Cs({className:n}){const e=ne(),t=Ce(),s=S("AgentDetailsPage"),o=S("AgentsLibrary"),i=S("SessionsPage"),a=S("ShareChatButton"),l=S("ClearChatButton"),u=S("SaveAgentButton"),c=S("SelectAgentEmptyState"),[m,p]=d.useState(!1),h=d.useRef(null),f=d.useRef(null),v=d.useRef(null),x=d.useRef(!1),w=(e==null?void 0:e.mode.status)==="idle",y=(e==null?void 0:e.settingsOpen)===!0,j=(e==null?void 0:e.libraryOpen)===!0,L=j&&(e==null?void 0:e.libraryAgentId)==null,A=(e==null?void 0:e.sessionsOpen)===!0,E=(e==null?void 0:e.schedulesOpen)===!0,B=(e==null?void 0:e.environmentsOpen)===!0,R=y||j||A||E||B,k=e!=null&&et(e.mode),I=t&&(A||E||B||k&&!y&&!j),N=k&&!R&&!t,D=ms({overlayOpen:R,mode:e==null?void 0:e.mode}),M=Sn(),O=t&&(y||L),H=()=>p(!1),K=r.jsx("button",{ref:h,type:"button","aria-label":"Navigation","aria-expanded":m,className:z(te({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>p(!0),children:r.jsx(U,{name:"panel-left"})});return d.useEffect(()=>{if(!m)return;const G=b=>{b.key==="Escape"&&(b.stopImmediatePropagation(),p(!1))};return window.addEventListener("keydown",G,!0),()=>window.removeEventListener("keydown",G,!0)},[m]),d.useEffect(()=>{var b,Z;const G=v.current;if(m){x.current=!0,G&&(G.inert=!0),(b=f.current)==null||b.focus();return}x.current&&(G&&(G.inert=!1),(Z=h.current)==null||Z.focus(),x.current=!1)},[m]),r.jsxs("div",{className:z("relative flex h-full min-h-0 w-full min-w-0",n),children:[r.jsx(ps,{className:"hidden md:flex"}),N?r.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-y-0 left-0 z-20 w-full max-w-sm border-r border-border shadow-xl md:static md:z-auto md:max-w-140 md:flex-1 md:shadow-none 2xl:max-w-150",children:r.jsx(Dn,{})}):null,r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[O?null:r.jsx(Ln,{className:z("bg-topbar-bg",(R||w||!M||I)&&"md:hidden"),start:K,title:!R&&!I?r.jsx(_n,{}):null,end:!R&&!I?r.jsxs(r.Fragment,{children:[r.jsx(a,{}),r.jsx(l,{}),r.jsx(u,{})]}):null}),r.jsx(Tn,{children:r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[D?r.jsx(fs,{}):null,r.jsx("div",{ref:v,className:"min-h-0 min-w-0 flex-1",children:y?r.jsx(d.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(pe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(os,{...O?{headerStart:K}:{}})}):I?r.jsx(Rn,{}):A?r.jsx(i,{}):j&&(e==null?void 0:e.libraryAgentId)!=null?r.jsx(s,{agentId:e.libraryAgentId},e.libraryAgentId):j?r.jsx(o,{onSelectAgent:H,...O?{headerStart:K}:{}}):E?r.jsx(d.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(pe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(as,{})}):B?r.jsx(d.Suspense,{fallback:r.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[r.jsx(pe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(is,{})}):w?r.jsx(c,{}):r.jsx(An,{})})]})})]}),m?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close navigation backdrop",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:H}),r.jsx(xs,{drawerRef:f,onClose:H})]}):null]})}export{Cs as SidebarLayout};
@@ -1 +0,0 @@
1
- import{C as T}from"./chunk-C5376XWU-DnMpocno.js";import{aX as Y,t as A,r as s,aY as q,j as e,Y as X,a0 as I,I as G,a_ as J,ap as y}from"./index-BJYXg0vg.js";var V=({open:l,onOpenChange:c,onImport:d,busy:k=!1,error:m})=>{const[p,g]=s.useState(""),[b,u]=s.useState(""),[x,j]=s.useState(""),[i,S]=s.useState(""),[n,o]=s.useState(""),N=()=>{g(""),u(""),j(""),S(""),o("")},h=()=>{N(),c(!1)},E=async a=>{if(a.preventDefault(),!(!p.trim()||!b.trim()||!x.trim()||!i.trim()||!n.trim()||k))try{await d({name:p.trim(),description:b.trim(),repoURL:x.trim(),path:i.trim(),ref:n.trim()}),h()}catch{}},L=!!(p.trim()&&b.trim()&&x.trim()&&i.trim()&&n.trim())&&!k;return e.jsx(J,{open:l,onOpenChange:a=>{a||h()},title:"Import from GitHub",description:"Import a skill from a SKILL.md file in a GitHub repository.",headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary",children:e.jsx(G,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:a=>void E(a),children:e.jsxs("div",{className:"space-y-5 px-5 py-5 md:px-6",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-name",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Name"}),e.jsx("input",{id:"skill-name",value:p,onChange:a=>{g(a.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-description",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Description"}),e.jsx("textarea",{id:"skill-description",value:b,onChange:a=>{u(a.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:y("resize-y py-2.5")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-repo-url",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Repository URL"}),e.jsx("input",{id:"skill-repo-url",type:"url",value:x,onChange:a=>{j(a.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-path",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Folder containing the SKILL.md"}),e.jsx("input",{id:"skill-path",value:i,onChange:a=>{S(a.target.value)},placeholder:"skills/release-notes",required:!0,className:y("h-11")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"skill-ref",className:"mb-2 block text-sm font-semibold text-text-primary",children:"Branch"}),e.jsx("input",{id:"skill-ref",value:n,onChange:a=>{o(a.target.value)},placeholder:"main",required:!0,className:y("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[m?e.jsx("p",{className:"text-failure-bg text-sm",children:m}):null,e.jsx(I.Primary,{type:"submit",disabled:!L,className:"w-full",children:"Import"})]})]})})})},W=V,B=(l,c,d)=>!l||c.toLowerCase().includes(l)||d.toLowerCase().includes(l),Z=l=>"catalogId"in l;function ee(l){return typeof l=="object"&&l!==null&&Reflect.get(l,"statusCode")===424}var te=()=>{const{skillCatalog:l}=Y(),c=A(),[d,k]=s.useState(""),[m,p]=s.useState([]),[g,b]=s.useState([]),[u,x]=s.useState(!0),[j,i]=s.useState(null),[S,n]=s.useState(null),[o,N]=s.useState(!1),[h,E]=s.useState(!1),[L,a]=s.useState(!1),[F,z]=s.useState(null),[O,C]=s.useState(null),M=s.useCallback(async()=>{if(l){x(!0),i(null);try{const[t,r]=await Promise.all([l.listSkills(),l.getSkillCatalog()]);p(t),b(r)}catch(t){i(q(t,"Failed to load skills"))}finally{x(!1)}}},[l]);s.useEffect(()=>{M()},[M]);const v=d.trim().toLowerCase(),w=s.useMemo(()=>m.filter(t=>B(v,t.name,t.description)),[m,v]),R=s.useMemo(()=>{const t=new Set(m.flatMap(r=>Z(r)?[r.catalogId]:[]));return g.filter(r=>!t.has(r.id)&&B(v,r.name,r.description))},[g,m,v]),D=async(t,r=i)=>{N(!0),i(null);try{await t(),await M()}catch(f){throw ee(f)&&E(!0),r(q(f,"Request failed")),f}finally{N(!1)}};if(!l)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const _=t=>{D(async()=>{await l.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref})}).catch(()=>{})},$=()=>{o||(z(null),C(null))},H=t=>{const r=l.deleteSkill;r&&(C(null),D(async()=>{await r({id:t.id}),z(null)},C).catch(()=>{}))},P=async t=>{n(null),await D(async()=>{await l.createSkill(t)},n),setTimeout(()=>{c==null||c.showSuccess({title:`${t.name} imported`})},0)},U=({key:t,name:r,description:f,action:K})=>e.jsxs("article",{className:"flex min-h-16 items-center gap-3 border-b border-border p-3 last:border-b-0",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg","aria-hidden":!0,children:e.jsx(G,{name:"lightbulb",className:"size-4.5 text-text-primary"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:r}),f?e.jsx("p",{className:"mt-0.5 truncate text-sm text-text-secondary",children:f}):null]}),K]},t),Q=w.length>0||R.length>0;return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Skills"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Use built-in skills or import custom skills from GitHub."}),j?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:j}):null,e.jsxs("div",{className:"mt-4 flex min-h-0 flex-1 flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx(X,{query:d,setQuery:k,placeholder:"Search skills"})}),e.jsxs(I.Secondary,{type:"button",className:"shrink-0",disabled:o||h,onClick:()=>{n(null),a(!0)},children:[e.jsx(G,{name:"github",className:"size-4"}),"Import from GitHub"]})]}),e.jsxs("div",{className:"flex flex-1 flex-col gap-5 overflow-y-auto pb-1",children:[u?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!u&&w.length>0?e.jsxs("section",{"aria-labelledby":"enabled-skills-heading",children:[e.jsxs("h4",{id:"enabled-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Enabled · ",w.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:w.map(t=>U({key:t.id,name:t.name,description:t.description,action:l.deleteSkill?e.jsx(I.Secondary,{size:"small",type:"button",disabled:o||h,"aria-label":`Remove ${t.name}`,onClick:()=>{C(null),z(t)},children:"Remove"}):null}))})]}):null,!u&&R.length>0?e.jsxs("section",{"aria-labelledby":"available-skills-heading",children:[e.jsxs("h4",{id:"available-skills-heading",className:"mb-2 text-[0.8125rem] font-semibold uppercase text-text-secondary",children:["Available · ",R.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:R.map(t=>U({key:t.id,name:t.name,description:t.description,action:e.jsx(I.Secondary,{size:"small",type:"button",disabled:o||h,"aria-label":`Enable ${t.name}`,onClick:()=>{_(t)},children:"Enable"})}))})]}):null,!u&&!Q?e.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed border-border p-8 text-center text-sm text-text-secondary",children:v?`No skills match “${d.trim()}”.`:"No skills yet."}):null]})]}),F?e.jsx(T,{title:"Remove skill?",description:`“${F.name}” will no longer be available to your agents.`,busy:o,error:O,onCancel:$,onConfirm:()=>{H(F)}}):null,e.jsx(W,{open:L,onOpenChange:t=>{a(t),t||n(null)},onImport:P,busy:o||h,error:S})]})},ae=te;export{ae as default};
@@ -1 +0,0 @@
1
- import{aX as A,t as B,r as a,aY as z,j as e,I as P,a0 as E,a_ as L,ap as M}from"./index-BJYXg0vg.js";var O=M("h-11 shadow-sm"),T=({open:t,onOpenChange:n,onSave:d,title:N,description:h,requireApiKey:u=!0,busy:g=!1,error:b})=>{const[p,o]=a.useState(""),y=()=>{o("")};a.useEffect(()=>{t&&o("")},[t]);const i=r=>{r||y(),n(r)},x=p.trim(),f=!u||!!x,l=async r=>{if(r.preventDefault(),!(!f||g))try{await d({apiKey:x}),y(),n(!1)}catch{}};return e.jsx(L,{open:t,onOpenChange:i,title:N,description:h,contentSized:!0,headerIcon:e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(P,{name:"search",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:l,children:[e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"web-search-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",u?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"web-search-api-key",type:"password",required:u,value:p,onChange:r=>{o(r.target.value)},placeholder:u?"Parallel API key":"Leave blank to keep existing",autoFocus:!0,className:O})]})}),e.jsxs("div",{className:"mt-6 space-y-3",children:[b?e.jsx("p",{className:"text-failure-bg text-sm",children:b}):null,e.jsx(E.Primary,{type:"submit",size:"large",disabled:!f||g,className:"w-full shrink-0",children:"Save"})]})]})})},$=T,_=()=>{const{webSearchCatalog:t}=A(),n=B(),[d,N]=a.useState([]),[h,u]=a.useState([]),[g,b]=a.useState(!0),[p,o]=a.useState(null),[y,i]=a.useState(null),[x,f]=a.useState(!1),[l,r]=a.useState(null),[m,j]=a.useState(null),w=a.useCallback(async({quiet:s=!1}={})=>{if(t){s||b(!0),o(null);try{const[c,v]=await Promise.all([t.listWebSearchProviders(),t.getWebSearchProviderCatalog()]);N(c),u(v)}catch(c){o(z(c,"Failed to load web search providers"))}finally{s||b(!1)}}},[t]);a.useEffect(()=>{w()},[w]);const S=d.length>0,C=a.useMemo(()=>{if(S)return[];const s=new Set(d.map(c=>c.catalogId));return h.filter(c=>!s.has(c.id))},[h,d,S]);if(!t)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Web search provider catalog is not available."});const I=async(s,c=o)=>{f(!0),o(null);try{await s(),await w({quiet:!0})}catch(v){throw c(z(v,"Request failed")),v}finally{f(!1)}},W=async s=>{l&&(i(null),await I(async()=>{await t.createWebSearchProvider({catalogId:l.id,name:l.name,type:l.type,apiKey:s.apiKey})},i),r(null),setTimeout(()=>{n==null||n.showSuccess({title:`${l.name} configured`})},0))},F=async s=>{m&&(i(null),await I(async()=>{await t.updateWebSearchProvider({id:m.id,...s.apiKey?{apiKey:s.apiKey}:{}})},i),j(null),setTimeout(()=>{n==null||n.showSuccess({title:`${m.name} updated`})},0))},K=l!=null||m!=null,k=m!=null,U=m?`Update ${m.name}`:l?`Configure ${l.name}`:"Configure web search provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Web search"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Configure a provider so agents can search the web. Only one can be active at a time."}),p?e.jsx("p",{className:"mt-3 rounded-md border border-failure-bg/30 bg-failure-bg/10 px-3 py-2 text-sm text-failure-bg",children:p}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:g?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading web search providers…"}):e.jsxs("div",{className:"space-y-6",children:[d.length>0?e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Configured · ",d.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:d.map(s=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(P,{name:"search",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:s.name}),e.jsx("p",{className:"truncate text-xs text-text-secondary",children:"Parallel web search"})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-success-bg",children:[e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}),"Connected"]}),e.jsx(E.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{i(null),r(null),j(s)},children:"Update"})]})]},s.id))})]}):null,S?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",C.length]}),C.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:h.length>0?"All catalog providers are configured.":"No web search providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:C.map(s=>e.jsxs("article",{className:"flex flex-col gap-3 border-b border-border p-3 last:border-b-0 sm:flex-row sm:items-center",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border bg-secondary-bg text-text-primary","aria-hidden":!0,children:e.jsx(P,{name:"search",className:"size-4.5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:s.name}),e.jsx("p",{className:"truncate text-xs text-text-secondary",children:"Parallel web search"})]})]}),e.jsx(E.Secondary,{type:"button",disabled:x,onClick:()=>{i(null),j(null),r(s)},children:"Configure"})]},s.id))})]})]})}),e.jsx($,{open:K,onOpenChange:s=>{s||(i(null),r(null),j(null))},onSave:k?F:W,title:U,description:k?"Update this web search provider. Leave API key blank to keep the existing key.":"Configure this web search provider. API key is never stored in the catalog.",requireApiKey:!k,busy:x,error:y})]})},D=_;export{D as default};
@@ -1 +0,0 @@
1
- import{j as e,r as u,b4 as ae,b as B,d as x,b5 as I,b6 as ie,b7 as le,b8 as ce,b9 as ue,ba as L,bb as z,k as X,u as $,bc as P,bd as de,be as me,bf as fe,bg as pe,bh as ge,aV as he,c as xe,t as be,bi as ve,bj as V,bk as Z,bl as ee,bm as Ce,l as te,bn as Q,bo as K,aj as Se,bp as je,bq as we,br as ye,bs as ke,bt as N,a0 as G,bu as Ie,bv as Me,bw as Re,bx as Ae,b2 as Ne,ao as ne,by as Te,bz as se,bA as Pe,bB as Ee,bC as De,bD as Le,bE as Oe,bF as Fe,i as _e,U as Be,p as oe,s as Ue,bG as He,bH as ze,bI as Ve,bJ as We,I as _,f as U,g as T,bK as H,bL as qe,O as Qe,bM as Ke}from"./index-BJYXg0vg.js";function Ge(){var f;const{pending:s}=Z(),t=Te(),[n,i]=u.useState({approvalId:null,index:0}),l=u.useRef(null),a=s.length,d=n.approvalId==null?-1:s.findIndex(p=>p.approvalId===n.approvalId),c=d>=0?d:a===0?0:Math.min(n.index,a-1),o=(f=s[c])==null?void 0:f.approvalId;u.useEffect(()=>{const p=o??null;n.approvalId===p&&n.index===c||i({approvalId:p,index:c})},[o,c,n.approvalId,n.index]),u.useEffect(()=>{if(o==null||t==null){o==null&&(l.current=null);return}l.current!==o&&(l.current=o,t.focus(o))},[o,t]);const r=u.useCallback(()=>{var b;const p=Math.max(0,c-1);i({approvalId:((b=s[p])==null?void 0:b.approvalId)??null,index:p})},[s,c]),m=u.useCallback(()=>{var b;const p=Math.min(Math.max(a-1,0),c+1);i({approvalId:((b=s[p])==null?void 0:b.approvalId)??null,index:p})},[a,s,c]),g=u.useCallback(()=>{o==null||t==null||t.focus(o)},[o,t]);return{count:a,index:c,canPrev:c>0,canNext:c<a-1,goPrev:r,goNext:m,focusCurrent:g}}function Je(){const s=x("ApprovalNavBanner"),{count:t,index:n,canPrev:i,canNext:l,goPrev:a,goNext:d,focusCurrent:c}=Ge();return t===0?null:e.jsx(s,{total:t,current:n+1,canPrev:i,canNext:l,onPrev:a,onNext:d,onFocusCurrent:c})}var O={radioValue:"",custom:""};function Ye({disabled:s=!1}){const t=x("AskUserPrompt"),{pending:n,respond:i}=V(),l=P(),a=n[0],d=u.useMemo(()=>a==null?[]:[{id:a.toolCallId,question:a.question??"Answer required",options:a.options??[]}],[a]),[c,o]=u.useState(0),[r,m]=u.useState({});u.useEffect(()=>{o(0),m({})},[a==null?void 0:a.toolCallId]);const g=Math.min(c,Math.max(d.length-1,0)),f=d[g],p=f==null?O:r[f.id]??O,b=u.useCallback(y=>{const M=r[y]??O;return M.radioValue===Q?M.custom.trim():M.radioValue.trim()},[r]),w=u.useMemo(()=>d.every(y=>b(y.id)),[b,d]),h=p.radioValue===Q?p.custom.trim():p.radioValue.trim(),S=l||s||f==null||h.length===0,j=S||!w,k=u.useCallback((y,M)=>{m(C=>({...C,[y]:{...C[y]??O,...M}}))},[]),A=u.useCallback(()=>{if(s||a==null||!w)return;const y=b(a.toolCallId);y&&i({toolCallId:a.toolCallId,content:y})},[w,s,b,a,i]);return a==null||f==null?null:e.jsx(t,{questions:d,readOnly:l||s,currentQuestion:f,currentQuestionIndex:g,currentAnswer:p,totalQuestions:d.length,isMultiQuestion:d.length>1,isLastQuestion:g===d.length-1,allQuestionsAnswered:w,isSubmitDisabled:S,isSubmitAllDisabled:j,onCurrentQuestionIndexChange:o,onCurrentAnswerChange:k,onSubmit:A})}function Xe(s){var i,l,a;const t=s.thread.messages,n=t[t.length-1];return(n==null?void 0:n.role)!=="assistant"||((i=n.status)==null?void 0:i.type)!=="requires-action"?!1:((a=(l=n.metadata)==null?void 0:l.custom)==null?void 0:a.pendingMcpAuth)===!0}function $e(){const s=I(Xe),{pending:t}=V(),{pending:n}=Z(),i=ee();if(s)return{kind:"mcp"};const l=t[0];if(l!=null){const a=l.toolName;return a!=null&&(i==null?void 0:i[a])!=null?{kind:"custom",toolName:a}:{kind:"ask-user"}}return n.length>0?{kind:"approval"}:{kind:"compose"}}function Ze({disabled:s=!1}){const t=ee(),{pending:n,respond:i}=V(),l=P(),a=n[0],d=u.useCallback(o=>{if(s||a==null)return;const r=o.trim();r&&i({toolCallId:a.toolCallId,content:r})},[s,a,i]);if(a==null||a.toolName==null)return null;const c=t==null?void 0:t[a.toolName];return c==null?null:e.jsx(c,{args:a.args??{},disabled:l||s,onSubmit:d})}function et({servers:s,onContinue:t,readOnly:n}){const i=x("McpAuthPrompt"),{handleAuthorize:l}=Ne(),{refreshConnectors:a}=ne(),[d,c]=u.useState(()=>new Set),o=u.useRef(d),[r,m]=u.useState(!1),g=u.useRef(!1),f=u.useRef(0);u.useEffect(()=>()=>{f.current+=1},[]);const p=()=>{n||g.current||(g.current=!0,m(!0),t().catch(()=>{g.current=!1,m(!1)}))},b=w=>{const h=f.current;l(w,S=>{if(h!==f.current||!S)return;const j=new Set([...o.current,w]);o.current=j,c(j),a(),s.every(k=>j.has(k.id))&&p()})};return e.jsx(i,{servers:s,connectedServerIds:d,continueLoading:r,onConnect:b,onContinue:p,readOnly:n})}function tt({disabled:s=!1}){const t=x("McpAuthPrompt"),{pending:n,resume:i}=Ce(),l=P(),a=te();if(!n)return null;if(a){const c=JSON.stringify(n.mcpServers.map(o=>o.id));return e.jsx(et,{servers:n.mcpServers,onContinue:i,readOnly:l||s},c)}const d=c=>{const o=n.mcpServers.find(r=>r.id===c);o!=null&&o.authUrl&&window.open(o.authUrl,"_blank","noopener,noreferrer")};return e.jsx(t,{servers:n.mcpServers,onConnect:d,onContinue:()=>{s||i()},readOnly:l||s})}function nt({disabled:s,hasText:t,hasAttachments:n,requiresModel:i,hasModel:l}){return!s&&(t||n)&&(!i||l)}function J({placeholder:s,connectedToBanner:t=!1}){var y,M;const n=x("ComposerShell"),i=$(),l=B(),a=I(C=>C.composer.text.trim().length>0),d=I(C=>C.composer.attachments.length>0),c=a||d,{agentSpec:o}=se(),r=l==null||l.mode.status==="active"&&l.mode.isMutable,m=!!((M=(y=o==null?void 0:o.model)==null?void 0:y.name)!=null&&M.trim()),{isBusy:g,send:f,resetBusy:p}=Pe(),b=z(),w=Ee(),h=u.useRef(null),S=!b,j=nt({disabled:S,hasText:a,hasAttachments:d,requiresModel:r,hasModel:m}),k=()=>{j&&f(()=>i.composer().send())},A=C=>{C.key!=="Enter"||C.shiftKey||C.nativeEvent.isComposing||j&&(C.preventDefault(),k())};return e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:h,type:"file",multiple:!0,hidden:!0,onChange:C=>{const E=C.target.files;if(E)for(const D of E)i.composer().addAttachment(D);C.target.value=""}}),e.jsx(N.AttachmentDropzone,{disabled:S,"data-slot":"aui_composer-attachment-dropzone",className:"w-full rounded-[0.75rem] transition-[box-shadow] data-[dragging=true]:ring-focus-ring/20 data-[dragging=true]:ring-3",children:e.jsx(N.Root,{"data-slot":"aui_composer-root",className:"w-full",onSubmit:C=>{C.preventDefault(),k()},children:e.jsx(n,{className:t?"rounded-t-none border-t-0 focus-within:ring-0":void 0,attachments:e.jsx(De,{}),input:e.jsx(N.Input,{"data-slot":"aui_composer-input",placeholder:s,disabled:S,submitMode:"enter",onKeyDown:A,"aria-label":"Message input",className:"text-text-primary placeholder:text-text-secondary/80 max-h-[10lh] min-h-10 w-full resize-none overflow-y-auto rounded-lg border-none bg-transparent px-1 py-1 text-base leading-normal shadow-none outline-none disabled:cursor-not-allowed"}),disabled:S,canSubmit:j,hasContent:c,isRunning:g,onSubmit:k,onCancel:b?()=>{p(),w()}:void 0,onAttach:b?()=>{var C;return(C=h.current)==null?void 0:C.click()}:void 0})})})]})}function F({placeholder:s,connectedToBanner:t=!1}){const n=B(),i=x("ComposerLeftSection"),l=x("ComposerRightSection"),a=K("ComposerLeftSection"),d=K("ComposerRightSection"),c=x("DraftComposerLeftSection"),o=x("DraftComposerRightSection");return(n==null?void 0:n.mode.status)==="active"&&n.mode.isMutable?e.jsx(Se,{children:e.jsx(je,{overrides:{ComposerLeftSection:a?c:i,ComposerRightSection:d?o:l},children:e.jsx(J,{placeholder:s,connectedToBanner:t})})}):e.jsx(J,{placeholder:s,connectedToBanner:t})}function st({placeholder:s="Ask anything... (Shift+Enter for new line)"}){const t=$e(),n=z(),i=t.kind==="mcp"?e.jsx(tt,{disabled:!n}):t.kind==="custom"?e.jsx(Ze,{disabled:!n}):t.kind==="ask-user"?e.jsx(Ye,{disabled:!n}):t.kind==="approval"?e.jsx(Je,{}):null;return i==null?e.jsx(F,{placeholder:s}):t.kind==="approval"?e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"flex w-full flex-col",children:[i,e.jsx(F,{placeholder:s,connectedToBanner:!0})]}):t.kind==="mcp"?e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"relative flex w-full flex-col",children:[e.jsx("div",{className:"pb-2",children:i}),e.jsx("div",{className:"relative z-10 -mt-3",children:e.jsx(F,{placeholder:s})})]}):e.jsxs("div",{"data-slot":"aui_composer-pause","data-pause-kind":t.kind,className:"flex w-full flex-col",children:[i,e.jsx("div",{className:"relative z-10 -mt-1",children:e.jsx(F,{placeholder:s})})]})}var ot=200,Y='[data-slot="aui_thread-viewport"]';function rt(){const s=x("HistoryLoader"),{hasOlderHistory:t,isLoadingOlderHistory:n,loadOlderHistory:i}=de(),[l,a]=u.useState(null),d=u.useRef(!1),c=u.useCallback(async()=>{if(d.current)return;d.current=!0;const o=(l==null?void 0:l.closest(Y))??null,r=(o==null?void 0:o.scrollHeight)??0,m=(o==null?void 0:o.scrollTop)??0;try{await i(),requestAnimationFrame(()=>{if(o==null)return;const g=o.scrollHeight-r;g>0&&o.scrollTo({top:m+g,behavior:"instant"})})}catch{}finally{d.current=!1}},[l,i]);return u.useEffect(()=>{if(l==null||!t)return;const o=l.closest(Y),r=new IntersectionObserver(m=>{m.some(g=>g.isIntersecting)&&c()},{root:o,rootMargin:`${ot}px 0px 0px 0px`});return r.observe(l),()=>r.disconnect()},[l,t,c]),t?e.jsx(s,{ref:a,isLoading:n}):null}function at(){const s=x("ResumeUnavailable");return pe()?e.jsx(s,{}):null}function it(){return I(t=>{var n;return(((n=t.message.attachments)==null?void 0:n.length)??0)>0})?e.jsx("div",{className:"pointer-events-none mb-2 opacity-90",children:e.jsx(Le,{})}):null}function lt(){const s=x("UserMessageEdit"),t=x("MessageTimestamp"),n=P(),i=z(),l=I(o=>o.message.createdAt),{cancel:a,disabled:d}=we(),{disabled:c}=ye();return e.jsx(ke.Root,{"data-role":"user",children:e.jsx(N.Root,{"data-slot":"aui_user-edit-composer-root",className:"fade-in slide-in-from-bottom-1 animate-in flex w-full justify-end px-2 duration-150",children:e.jsx(s,{timestamp:e.jsx(t,{createdAt:l}),attachments:e.jsx(it,{}),input:e.jsx("div",{className:"mt-1 rounded border border-border bg-secondary-bg p-2 text-text-primary",children:e.jsx(N.Input,{"data-slot":"aui_user-edit-input",disabled:n||!i,submitMode:"enter","aria-label":"Edit message",className:"max-h-32 min-h-10 w-full resize-none border-none bg-transparent p-0 text-base leading-[1.34] outline-none focus:shadow-none"})}),footer:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(G.Secondary,{type:"button",disabled:d,onClick:a,children:"Cancel"}),e.jsx(N.Send,{asChild:!0,children:e.jsx(G.Primary,{type:"submit",disabled:c||n||!i,children:"Save & Rerun"})})]})})})})}function ct(){const s=X(),t=$(),n=I(c=>c.threadListItem.remoteId),i=I(c=>c.threadListItem.title),l=P(),a=u.useRef(!1),d=u.useRef(void 0);u.useEffect(()=>{d.current=void 0},[n]),u.useEffect(()=>{const c=a.current&&!l;if(a.current=l,!c||s==null||n==null||d.current===n)return;if(i!=null&&i.trim()!==""){d.current=n;return}let o=!1;return s.getSession({sessionId:n}).then(r=>{if(o)return;const m=typeof r.title=="string"?r.title.trim():"";if(m.length!==0)return d.current=n,t.threadListItem().rename(m)}).catch(()=>{}),()=>{o=!0}},[t,l,n,s,i])}var re="trueforge.file-preview-width";function ut(){try{const s=sessionStorage.getItem(re);if(s==null)return null;const t=Number(s);return Number.isFinite(t)?t:null}catch{return null}}function dt(s){try{sessionStorage.setItem(re,String(Math.round(s)))}catch{}}function mt(){const s=ge(),t=x("FilePreviewPanel"),n=he(),i=xe(),l=be(),[a,d]=u.useState(0),[c,o]=u.useState(!1),[r,m]=u.useState(ut),g=ve(s.target,a),f=s.target,p=s.presentation==="full"?"full":n||i?"overlay":"side";if(u.useLayoutEffect(()=>{var j;if(f==null||p!=="side")return;const h=((j=document.querySelector('[data-slot="aui_file-preview-row"]'))==null?void 0:j.getBoundingClientRect().width)??0;if(h<=0)return;const S=r==null?Ie(h):Me({requested:r,rowWidth:h});(r==null||Math.abs(S-r)>1)&&m(S)},[p,f,r]),f==null)return null;const b=g.view.status==="error",w=()=>{c||(o(!0),(async()=>{try{const h=g.blob??await f.load();Re(h,Ae(f.path))}catch(h){l!=null?l.showError(h):console.error("Failed to download sandbox file",h)}finally{o(!1)}})())};return e.jsx(t,{name:f.name,placement:p,view:g.view,onClose:s.close,onDownload:w,onEnterFullPage:()=>s.setPresentation("full"),onExitFullPage:()=>s.setPresentation("panel"),downloadBusy:c,...p==="side"&&r!=null?{widthPx:r}:{},...p==="side"?{onWidthChange:h=>{m(h),dt(h)}}:{},...b?{onRetry:()=>d(h=>h+1)}:{}})}function ft({children:s}){return e.jsx("div",{className:"animate-in fade-in slide-in-from-bottom-1 fill-mode-both duration-200",children:s})}function pt({isEditing:s}){return I(n=>n.message.role)==="user"?s?e.jsx(lt,{}):e.jsx(me,{}):e.jsx(fe,{})}function gt({composer:s}){u.useEffect(()=>{ae()},[]),ct();const t=B(),n=x("WelcomeScreen"),i=x("MessageListSkeleton"),l=x("ScrollToBottomButton"),a=x("MessageGroup"),d=x("ThreadComposerAreaShell"),c=x("ThreadRootShell"),o=x("ThreadViewportShell"),r=I(ie),m=I(f=>f.thread.isLoading),g=(t==null?void 0:t.mode.status)==="active"?t.mode.agentName!=null&&t.mode.agentName.length>0?t.mode.agentName:t.mode.isMutable&&t.mode.isCreateAgent?"Start building a new Agent":void 0:void 0;return e.jsx(le,{children:e.jsx(ce,{children:e.jsx(ue,{children:e.jsx(L.Root,{asChild:!0,children:e.jsx(c,{children:e.jsxs("div",{"data-slot":"aui_file-preview-row",className:"relative flex min-h-0 w-full min-w-0 flex-1",children:[e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(L.Viewport,{asChild:!0,autoScroll:!0,children:e.jsxs(o,{isEmpty:r,children:[r&&e.jsx(n,{heading:g}),r&&!m&&s,m?e.jsx(i,{}):!r&&e.jsxs(e.Fragment,{children:[e.jsx(rt,{}),e.jsxs(a,{children:[e.jsx(L.Messages,{children:({message:f})=>e.jsx(ft,{children:e.jsx(pt,{isEditing:f.role==="user"&&f.composer.isEditing})})}),e.jsx(at,{})]})]})]})}),!m&&!r&&e.jsxs(d,{isEmpty:r,children:[e.jsx(L.ScrollToBottom,{asChild:!0,children:e.jsx(l,{})}),s]})]}),e.jsx(mt,{})]})})})})})})}function xt(){return e.jsx(gt,{composer:e.jsx(st,{})})}function bt({className:s}){const t=qe(),n=I(a=>a.threadListItem.title);if(t===null)return null;const i=(n==null?void 0:n.trim())??"",l=t.allowThreadTitle&&i.length>0?i:t.name;return e.jsxs("h1",{className:T("flex min-w-0 items-center gap-1.5",Ke,s),children:[e.jsx("span",{className:"truncate",title:l,children:l}),t.isEditing?e.jsx(Qe,{content:"Try changes here, then choose Update agent to save.",side:"bottom",children:e.jsxs("span",{className:"border-warning-bg/40 bg-warning-bg/10 text-warning-bg inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",children:[e.jsx(_,{name:"pencil",className:"size-3"}),"Editing"]})}):null]})}function vt({className:s,labeled:t=!1,onAction:n}){const i=B(),l=te(),a=oe(),{mode:d,setTheme:c}=Ve(),o=x("ShellActionsActionSlot"),r=d==="dark",m=r?"Light":"Dark",g=We({catalog:l,capabilities:a}),f="hover:bg-secondary-button-hover hover:text-ghost-button-text";return e.jsxs("div",{className:T("flex shrink-0 items-center gap-1",t?"w-full flex-col items-center gap-1 text-sidebar-text":"text-text-primary",s),children:[e.jsxs("a",{href:"https://trueforge.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"Documentation",title:"Documentation",className:U({variant:"ghost",size:t?void 0:"icon",className:T(f,t&&H)}),onClick:()=>n==null?void 0:n(),children:[e.jsx(_,{name:"book-open",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:"Docs"}):null]}),e.jsxs("button",{type:"button","aria-label":r?"Switch to light theme":"Switch to dark theme",title:r?"Light theme":"Dark theme",className:U({variant:"ghost",size:t?void 0:"icon",className:T(f,t&&H)}),onClick:()=>{c(r?"light":"dark"),n==null||n()},children:[e.jsx(_,{name:r?"sun":"moon",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:m}):null]}),i!=null&&g?e.jsxs("button",{type:"button","aria-label":"Settings",title:"Settings","aria-expanded":i.settingsOpen,"aria-current":i.settingsOpen?"page":void 0,className:U({variant:"ghost",size:t?void 0:"icon",className:T(f,t&&H,i.settingsOpen&&"bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text")}),onClick:()=>{i.setSettingsOpen(!0),n==null||n()},children:[e.jsx(_,{name:"settings",size:t?14:void 0}),t?e.jsx("span",{className:"text-center",children:"Settings"}):null]}):null,e.jsx(o,{})]})}function Ct({showClose:s=!1}){var D,W;const{agentSpec:t}=se(),n=Oe(),i=Fe(),l=_e(),a=l.mode.status==="active"?l.mode.agentId:void 0,{allows:d}=Be({resourceType:"agent",resourceIds:a==null?[]:[a]}),c=d(a,"MANAGE"),o=X(),r=oe(),m=ne(),g=x("AgentConfigPanel"),f=x("AgentConfigEditors"),[p,b]=u.useState(null),w=Ue(l.mode),{draft:h,flush:S}=He(),j=u.useCallback(()=>{S(),i(),l.setAgentConfigOpen(!1)},[i,S,l]);u.useEffect(()=>{w&&m.ensureLoaded()},[m,w]),u.useEffect(()=>{c||b(null)},[c]),u.useEffect(()=>{if(!s||!l.agentConfigOpen)return;const v=R=>{!R.defaultPrevented&&R.key==="Escape"&&p===null&&document.querySelector("dialog[open]")===null&&j()};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[j,p,l.agentConfigOpen,s]),u.useEffect(()=>()=>{S();try{i()}catch{}},[i,S]);const k=u.useCallback(({next:v,instructions:R})=>{var q;if(c){if(v.skills&&v.skills.length>0&&(r==null?void 0:r.sandbox.enabled)===!0){n==null||n({...v,instructions:R||void 0,config:{...v.config,sandbox:{...(q=v.config)==null?void 0:q.sandbox,enabled:!0}}});return}n==null||n({...v,instructions:R||void 0})}},[c,r==null?void 0:r.sandbox.enabled,n]),A=u.useCallback(v=>{k({next:v,instructions:h})},[k,h]),y=u.useCallback(v=>{t!==null&&k({next:ze({spec:t,messages:v.messages}),instructions:v.instructions})},[t,k]),M=u.useCallback(async v=>(o==null?void 0:o.getMcpTools)===void 0?[]:o.getMcpTools({connectorId:v}),[o]),C=u.useCallback(async v=>{var R;return(R=o==null?void 0:o.getMcpConnector)==null?void 0:R.call(o,{connectorId:v})},[o]);if(!w||t===null||s&&!l.agentConfigOpen)return null;const E=m.models.find(v=>v.name===t.model.name);return e.jsxs(e.Fragment,{children:[e.jsx(g,{spec:t,model:E,models:m.models,modelsLoading:m.loading,modelsError:m.error,skills:m.skills,skillsAvailable:(r==null?void 0:r.skill.enabled)===!0,webSearchAvailable:((D=r==null?void 0:r.webSearch)==null?void 0:D.enabled)===!0,instructions:h,onOpenEditor:v=>{c&&b(v)},onChange:A,disabled:!c,onClose:s?j:void 0}),e.jsx(f,{editor:p,spec:t,models:m.models,connectors:m.connectors,skills:m.skills,loading:m.loading,error:m.error,skillsDisabled:(r==null?void 0:r.skill.enabled)!==!0,sandboxAvailable:(r==null?void 0:r.sandbox.enabled)===!0,webSearchAvailable:((W=r==null?void 0:r.webSearch)==null?void 0:W.enabled)===!0,instructions:h,onInstructionsSave:y,...(o==null?void 0:o.getMcpConnector)===void 0?{}:{loadMcpConnector:C},loadMcpTools:M,onRefreshConnectors:m.refreshConnectors,onChange:A,onClose:()=>b(null)})]})}export{Ct as A,bt as N,vt as S,xt as T};