@truefoundry/trueforge 0.2.1 → 0.3.0

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 (246) hide show
  1. package/dist/_frontend/assets/{AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js → AgentCodeSnippets-JR3K2V5D-CN0sRDyo.js} +1 -1
  2. package/dist/_frontend/assets/AgentCodeSnippets-JR3K2V5D-CN0sRDyo.js.br +0 -0
  3. package/dist/_frontend/assets/AgentCodeSnippets-JR3K2V5D-CN0sRDyo.js.gz +0 -0
  4. package/dist/_frontend/assets/{AgentMetricChart-VDIE3S2P-D_xJ9A8R.js → AgentMetricChart-7YNFN467-VPQT96Rn.js} +1 -1
  5. package/dist/_frontend/assets/AgentMetricChart-7YNFN467-VPQT96Rn.js.br +0 -0
  6. package/dist/_frontend/assets/AgentMetricChart-7YNFN467-VPQT96Rn.js.gz +0 -0
  7. package/dist/_frontend/assets/{AgentOverview-5JIVYXPX-C7wS6H9h.js → AgentOverview-M43ZHZXR-C8JpMKQB.js} +1 -1
  8. package/dist/_frontend/assets/AgentOverview-M43ZHZXR-C8JpMKQB.js.br +0 -0
  9. package/dist/_frontend/assets/AgentOverview-M43ZHZXR-C8JpMKQB.js.gz +0 -0
  10. package/dist/_frontend/assets/{AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js → AgentSessionEventTimeline-6KPF7GAB-GTbNb_3d.js} +1 -1
  11. package/dist/_frontend/assets/AgentSessionEventTimeline-6KPF7GAB-GTbNb_3d.js.br +0 -0
  12. package/dist/_frontend/assets/AgentSessionEventTimeline-6KPF7GAB-GTbNb_3d.js.gz +0 -0
  13. package/dist/_frontend/assets/AgentSessionEventTimelineChart-TX6JSA7I-D7NrVxet.js +1 -0
  14. package/dist/_frontend/assets/AgentSessionEventTimelineChart-TX6JSA7I-D7NrVxet.js.br +0 -0
  15. package/dist/_frontend/assets/AgentSessionEventTimelineChart-TX6JSA7I-D7NrVxet.js.gz +0 -0
  16. package/dist/_frontend/assets/AgentSessions-72DUGY4X-Dy_EUQ-C.js +1 -0
  17. package/dist/_frontend/assets/AgentSessions-72DUGY4X-Dy_EUQ-C.js.br +0 -0
  18. package/dist/_frontend/assets/AgentSessions-72DUGY4X-Dy_EUQ-C.js.gz +0 -0
  19. package/dist/_frontend/assets/{ConnectorSettings-C6MFCKYX-BvX0CZ86.js → ConnectorSettings-OYKNP6QY-D7z4YVGY.js} +1 -1
  20. package/dist/_frontend/assets/ConnectorSettings-OYKNP6QY-D7z4YVGY.js.br +0 -0
  21. package/dist/_frontend/assets/ConnectorSettings-OYKNP6QY-D7z4YVGY.js.gz +0 -0
  22. package/dist/_frontend/assets/{DockLayout-VY7OZ55R-BoHuHGZ4.js → DockLayout-CDGNHPRZ-BuiQ5FSH.js} +1 -1
  23. package/dist/_frontend/assets/DrawerLayout-DDFZOELS-DxJza_w9.js +2 -0
  24. package/dist/_frontend/assets/DrawerLayout-DDFZOELS-DxJza_w9.js.br +0 -0
  25. package/dist/_frontend/assets/DrawerLayout-DDFZOELS-DxJza_w9.js.gz +0 -0
  26. package/dist/_frontend/assets/{ModelSettings-3YAHICJ3-CYXhuUMp.js → ModelSettings-ZL5ITPNM-DIT1YkR8.js} +1 -1
  27. package/dist/_frontend/assets/ModelSettings-ZL5ITPNM-DIT1YkR8.js.br +0 -0
  28. package/dist/_frontend/assets/ModelSettings-ZL5ITPNM-DIT1YkR8.js.gz +0 -0
  29. package/dist/_frontend/assets/SandboxSettings-6JWRHKBS-CEGw9Cjx.js +1 -0
  30. package/dist/_frontend/assets/SandboxSettings-6JWRHKBS-CEGw9Cjx.js.br +0 -0
  31. package/dist/_frontend/assets/SandboxSettings-6JWRHKBS-CEGw9Cjx.js.gz +0 -0
  32. package/dist/_frontend/assets/SchedulesPage-SIJSKRWV-ULgYoypo.js +1 -0
  33. package/dist/_frontend/assets/SchedulesPage-SIJSKRWV-ULgYoypo.js.br +0 -0
  34. package/dist/_frontend/assets/SchedulesPage-SIJSKRWV-ULgYoypo.js.gz +0 -0
  35. package/dist/_frontend/assets/SettingsBuilder-RGEYBYPN-Bij2RoEA.js +2 -0
  36. package/dist/_frontend/assets/SettingsBuilder-RGEYBYPN-Bij2RoEA.js.br +0 -0
  37. package/dist/_frontend/assets/SettingsBuilder-RGEYBYPN-Bij2RoEA.js.gz +0 -0
  38. package/dist/_frontend/assets/ShellRouteSync-VUEPO6BA-CAmMq7_n.js +1 -0
  39. package/dist/_frontend/assets/ShellRouteSync-VUEPO6BA-CAmMq7_n.js.br +0 -0
  40. package/dist/_frontend/assets/ShellRouteSync-VUEPO6BA-CAmMq7_n.js.gz +0 -0
  41. package/dist/_frontend/assets/{SidebarLayout-FKRLGEDB-CqSBeNMU.js → SidebarLayout-CG2YXXJS-B4T_SJF5.js} +2 -2
  42. package/dist/_frontend/assets/SidebarLayout-CG2YXXJS-B4T_SJF5.js.br +0 -0
  43. package/dist/_frontend/assets/SidebarLayout-CG2YXXJS-B4T_SJF5.js.gz +0 -0
  44. package/dist/_frontend/assets/{SkillSettings-E5SJ4U3T-hOs4000P.js → SkillSettings-2Q3S365A-rvOFDDo6.js} +1 -1
  45. package/dist/_frontend/assets/SkillSettings-2Q3S365A-rvOFDDo6.js.br +0 -0
  46. package/dist/_frontend/assets/SkillSettings-2Q3S365A-rvOFDDo6.js.gz +0 -0
  47. package/dist/_frontend/assets/TrueForgeUIWithRouter-BQ7V7K6N-C2t5RFXr.js +1 -0
  48. package/dist/_frontend/assets/WebSearchSettings-IT5FIYZ4-DVIwh7RD.js +1 -0
  49. package/dist/_frontend/assets/WebSearchSettings-IT5FIYZ4-DVIwh7RD.js.br +0 -0
  50. package/dist/_frontend/assets/WebSearchSettings-IT5FIYZ4-DVIwh7RD.js.gz +0 -0
  51. package/dist/_frontend/assets/WidgetLayout-MLAXXZHR-DCXQha_a.js +1 -0
  52. package/dist/_frontend/assets/WidgetLayout-MLAXXZHR-DCXQha_a.js.br +0 -0
  53. package/dist/_frontend/assets/WidgetLayout-MLAXXZHR-DCXQha_a.js.gz +0 -0
  54. package/dist/_frontend/assets/{chunk-62JRHF6Z-DVHPxtc3.js → chunk-62JRHF6Z-ByllQXFT.js} +1 -1
  55. package/dist/_frontend/assets/chunk-62JRHF6Z-ByllQXFT.js.br +0 -0
  56. package/dist/_frontend/assets/chunk-62JRHF6Z-ByllQXFT.js.gz +0 -0
  57. package/dist/_frontend/assets/chunk-BZ2EOR5X-BgN-bqzz.js +1 -0
  58. package/dist/_frontend/assets/chunk-FYQP67GV-C3xcimCk.js +2 -0
  59. package/dist/_frontend/assets/chunk-FYQP67GV-C3xcimCk.js.br +0 -0
  60. package/dist/_frontend/assets/chunk-FYQP67GV-C3xcimCk.js.gz +0 -0
  61. package/dist/_frontend/assets/{chunk-G7BT4OKG-D-wOOnsv.js → chunk-WOPPIMOW-Bxo8Tkcc.js} +1 -1
  62. package/dist/_frontend/assets/chunk-WOPPIMOW-Bxo8Tkcc.js.br +0 -0
  63. package/dist/_frontend/assets/chunk-WOPPIMOW-Bxo8Tkcc.js.gz +0 -0
  64. package/dist/_frontend/assets/{cssMode-BMGYEB3M.js → cssMode-FByrXr3F.js} +1 -1
  65. package/dist/_frontend/assets/cssMode-FByrXr3F.js.br +0 -0
  66. package/dist/_frontend/assets/cssMode-FByrXr3F.js.gz +0 -0
  67. package/dist/_frontend/assets/{freemarker2-By56tpWC.js → freemarker2-Mf_gKtD9.js} +1 -1
  68. package/dist/_frontend/assets/freemarker2-Mf_gKtD9.js.br +0 -0
  69. package/dist/_frontend/assets/freemarker2-Mf_gKtD9.js.gz +0 -0
  70. package/dist/_frontend/assets/{handlebars-cEjR9Fs2.js → handlebars-F-7fAGeV.js} +1 -1
  71. package/dist/_frontend/assets/handlebars-F-7fAGeV.js.br +0 -0
  72. package/dist/_frontend/assets/handlebars-F-7fAGeV.js.gz +0 -0
  73. package/dist/_frontend/assets/{html-tYW1suOW.js → html-C6ePYdtE.js} +1 -1
  74. package/dist/_frontend/assets/html-C6ePYdtE.js.br +0 -0
  75. package/dist/_frontend/assets/html-C6ePYdtE.js.gz +0 -0
  76. package/dist/_frontend/assets/{htmlMode-D8PP1KzI.js → htmlMode-D_49o1ek.js} +1 -1
  77. package/dist/_frontend/assets/htmlMode-D_49o1ek.js.br +0 -0
  78. package/dist/_frontend/assets/htmlMode-D_49o1ek.js.gz +0 -0
  79. package/dist/_frontend/assets/{index-DUFuoecn.js → index-C1JyX_z6.js} +1 -1
  80. package/dist/_frontend/assets/index-C1JyX_z6.js.br +0 -0
  81. package/dist/_frontend/assets/{index-DUFuoecn.js.gz → index-C1JyX_z6.js.gz} +0 -0
  82. package/dist/_frontend/assets/{index-BS4907Xx.js → index-DyoPEH18.js} +3 -3
  83. package/dist/_frontend/assets/index-DyoPEH18.js.br +0 -0
  84. package/dist/_frontend/assets/index-DyoPEH18.js.gz +0 -0
  85. package/dist/_frontend/assets/{index-G7kdtXvB.js → index-v37J5fNr.js} +264 -249
  86. package/dist/_frontend/assets/index-v37J5fNr.js.br +0 -0
  87. package/dist/_frontend/assets/index-v37J5fNr.js.gz +0 -0
  88. package/dist/_frontend/assets/{javascript-osiUQvXx.js → javascript-D2Ls8jsI.js} +1 -1
  89. package/dist/_frontend/assets/{jsonMode-CdMHir1V.js → jsonMode-DBuGlKU6.js} +1 -1
  90. package/dist/_frontend/assets/jsonMode-DBuGlKU6.js.br +0 -0
  91. package/dist/_frontend/assets/jsonMode-DBuGlKU6.js.gz +0 -0
  92. package/dist/_frontend/assets/{liquid-DXwQHd5_.js → liquid-NGNDUbMG.js} +1 -1
  93. package/dist/_frontend/assets/liquid-NGNDUbMG.js.br +0 -0
  94. package/dist/_frontend/assets/liquid-NGNDUbMG.js.gz +0 -0
  95. package/dist/_frontend/assets/{lspLanguageFeatures-CEI6BsAF.js → lspLanguageFeatures-Djvn7LD3.js} +1 -1
  96. package/dist/_frontend/assets/lspLanguageFeatures-Djvn7LD3.js.br +0 -0
  97. package/dist/_frontend/assets/lspLanguageFeatures-Djvn7LD3.js.gz +0 -0
  98. package/dist/_frontend/assets/{mdx-9AQsIt7X.js → mdx-UpzAHslu.js} +1 -1
  99. package/dist/_frontend/assets/mdx-UpzAHslu.js.br +0 -0
  100. package/dist/_frontend/assets/mdx-UpzAHslu.js.gz +0 -0
  101. package/dist/_frontend/assets/{python-OXQa8Ri9.js → python-DcKk9rKg.js} +1 -1
  102. package/dist/_frontend/assets/python-DcKk9rKg.js.br +0 -0
  103. package/dist/_frontend/assets/python-DcKk9rKg.js.gz +0 -0
  104. package/dist/_frontend/assets/{razor-BU90Q8Je.js → razor-BJHsonXn.js} +1 -1
  105. package/dist/_frontend/assets/razor-BJHsonXn.js.br +0 -0
  106. package/dist/_frontend/assets/razor-BJHsonXn.js.gz +0 -0
  107. package/dist/_frontend/assets/{tsMode-B3c5Otu4.js → tsMode-Bd8upFyD.js} +1 -1
  108. package/dist/_frontend/assets/tsMode-Bd8upFyD.js.br +0 -0
  109. package/dist/_frontend/assets/tsMode-Bd8upFyD.js.gz +0 -0
  110. package/dist/_frontend/assets/{typescript-CtOR5Qmc.js → typescript-DkZoxHTU.js} +1 -1
  111. package/dist/_frontend/assets/typescript-DkZoxHTU.js.br +0 -0
  112. package/dist/_frontend/assets/typescript-DkZoxHTU.js.gz +0 -0
  113. package/dist/_frontend/assets/{workers-Dx3N8uH5.js → workers-DFJIt9_n.js} +1 -1
  114. package/dist/_frontend/assets/workers-DFJIt9_n.js.br +0 -0
  115. package/dist/_frontend/assets/workers-DFJIt9_n.js.gz +0 -0
  116. package/dist/_frontend/assets/{xml-DW3BhbEz.js → xml-Du3CXfH4.js} +1 -1
  117. package/dist/_frontend/assets/xml-Du3CXfH4.js.br +0 -0
  118. package/dist/_frontend/assets/xml-Du3CXfH4.js.gz +0 -0
  119. package/dist/_frontend/assets/{yaml-BZ76X4yO.js → yaml-CGATQYZS.js} +1 -1
  120. package/dist/_frontend/assets/yaml-CGATQYZS.js.br +0 -0
  121. package/dist/_frontend/assets/yaml-CGATQYZS.js.gz +0 -0
  122. package/dist/_frontend/index.html +1 -1
  123. package/dist/controller-main.js +365 -42
  124. package/dist/controller-main.js.map +1 -1
  125. package/dist/main.js +2604 -1010
  126. package/dist/main.js.map +1 -1
  127. package/dist/postgres/migrations/20260727_000001_init.js +187 -16
  128. package/dist/postgres/migrations/20260727_000001_init.js.map +1 -1
  129. package/dist/postgres/migrations/20260831_000001_session_external_id.js.map +1 -1
  130. package/dist/postgres/migrations/20260902_000002_agent_external_id.js.map +1 -1
  131. package/dist/postgres/migrations/20260903_000002_created_by_subject.js.map +1 -1
  132. package/dist/postgres/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
  133. package/dist/postgres/migrations/20260904_000002_session_source.js.map +1 -1
  134. package/dist/postgres/migrations/20260904_000003_session_metadata_gin.js.map +1 -1
  135. package/dist/postgres/migrations/20260921_000001_web_search_provider.js +15 -0
  136. package/dist/postgres/migrations/20260921_000001_web_search_provider.js.map +1 -0
  137. package/dist/postgres/migrations/20260924_000001_turn_inbound_events.js +21 -0
  138. package/dist/postgres/migrations/20260924_000001_turn_inbound_events.js.map +1 -0
  139. package/dist/postgres/migrations/20260924_000002_session_shared.js +20 -0
  140. package/dist/postgres/migrations/20260924_000002_session_shared.js.map +1 -0
  141. package/dist/postgres/migrations/20260926_000001_sandbox_environment.js +41 -0
  142. package/dist/postgres/migrations/20260926_000001_sandbox_environment.js.map +1 -0
  143. package/dist/sqlite/migrations/20260831_000001_session_external_id.js.map +1 -1
  144. package/dist/sqlite/migrations/20260902_000001_session_metadata.js.map +1 -1
  145. package/dist/sqlite/migrations/20260902_000002_agent_external_id.js.map +1 -1
  146. package/dist/sqlite/migrations/20260903_000001_drop_agent_metadata.js.map +1 -1
  147. package/dist/sqlite/migrations/20260903_000002_created_by_subject.js.map +1 -1
  148. package/dist/sqlite/migrations/20260904_000001_schedule_agent_id.js.map +1 -1
  149. package/dist/sqlite/migrations/20260904_000002_session_source.js.map +1 -1
  150. package/dist/sqlite/migrations/20260921_000001_web_search_provider.js +25 -0
  151. package/dist/sqlite/migrations/20260921_000001_web_search_provider.js.map +1 -0
  152. package/dist/sqlite/migrations/20260924_000001_turn_inbound_events.js +33 -0
  153. package/dist/sqlite/migrations/20260924_000001_turn_inbound_events.js.map +1 -0
  154. package/dist/sqlite/migrations/20260924_000002_session_shared.js +20 -0
  155. package/dist/sqlite/migrations/20260924_000002_session_shared.js.map +1 -0
  156. package/dist/sqlite/migrations/20260926_000001_sandbox_environment.js +75 -0
  157. package/dist/sqlite/migrations/20260926_000001_sandbox_environment.js.map +1 -0
  158. package/package.json +5 -4
  159. package/dist/_frontend/assets/AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js.br +0 -0
  160. package/dist/_frontend/assets/AgentCodeSnippets-DAZWEBJS-BRFLL3U-.js.gz +0 -0
  161. package/dist/_frontend/assets/AgentMetricChart-VDIE3S2P-D_xJ9A8R.js.br +0 -0
  162. package/dist/_frontend/assets/AgentMetricChart-VDIE3S2P-D_xJ9A8R.js.gz +0 -0
  163. package/dist/_frontend/assets/AgentOverview-5JIVYXPX-C7wS6H9h.js.br +0 -0
  164. package/dist/_frontend/assets/AgentOverview-5JIVYXPX-C7wS6H9h.js.gz +0 -0
  165. package/dist/_frontend/assets/AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js.br +0 -0
  166. package/dist/_frontend/assets/AgentSessionEventTimeline-WELJSS6O-UXUue7Eb.js.gz +0 -0
  167. package/dist/_frontend/assets/AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js +0 -1
  168. package/dist/_frontend/assets/AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js.br +0 -0
  169. package/dist/_frontend/assets/AgentSessionEventTimelineChart-ADB3KICM-Ci7-9UDP.js.gz +0 -0
  170. package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js +0 -1
  171. package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js.br +0 -0
  172. package/dist/_frontend/assets/AgentSessions-NSN4LIGJ-ZjsdJ6V6.js.gz +0 -0
  173. package/dist/_frontend/assets/ConnectorSettings-C6MFCKYX-BvX0CZ86.js.br +0 -0
  174. package/dist/_frontend/assets/ConnectorSettings-C6MFCKYX-BvX0CZ86.js.gz +0 -0
  175. package/dist/_frontend/assets/DrawerLayout-B2UA3CZO-Bnc8xIc0.js +0 -2
  176. package/dist/_frontend/assets/DrawerLayout-B2UA3CZO-Bnc8xIc0.js.br +0 -0
  177. package/dist/_frontend/assets/DrawerLayout-B2UA3CZO-Bnc8xIc0.js.gz +0 -0
  178. package/dist/_frontend/assets/ModelSettings-3YAHICJ3-CYXhuUMp.js.br +0 -0
  179. package/dist/_frontend/assets/ModelSettings-3YAHICJ3-CYXhuUMp.js.gz +0 -0
  180. package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js +0 -1
  181. package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js.br +0 -0
  182. package/dist/_frontend/assets/SandboxSettings-ALR6F5KU-BhpQsOwg.js.gz +0 -0
  183. package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js +0 -1
  184. package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js.br +0 -0
  185. package/dist/_frontend/assets/SchedulesPage-TIS3BH67-CoDDvRbI.js.gz +0 -0
  186. package/dist/_frontend/assets/SettingsBuilder-G5CP5X6Q-XQVNLXzw.js +0 -2
  187. package/dist/_frontend/assets/SettingsBuilder-G5CP5X6Q-XQVNLXzw.js.br +0 -0
  188. package/dist/_frontend/assets/SettingsBuilder-G5CP5X6Q-XQVNLXzw.js.gz +0 -0
  189. package/dist/_frontend/assets/ShellRouteSync-G7IJ5VIW-BoBswHkA.js +0 -1
  190. package/dist/_frontend/assets/ShellRouteSync-G7IJ5VIW-BoBswHkA.js.br +0 -0
  191. package/dist/_frontend/assets/ShellRouteSync-G7IJ5VIW-BoBswHkA.js.gz +0 -0
  192. package/dist/_frontend/assets/SidebarLayout-FKRLGEDB-CqSBeNMU.js.br +0 -0
  193. package/dist/_frontend/assets/SidebarLayout-FKRLGEDB-CqSBeNMU.js.gz +0 -0
  194. package/dist/_frontend/assets/SkillSettings-E5SJ4U3T-hOs4000P.js.br +0 -0
  195. package/dist/_frontend/assets/SkillSettings-E5SJ4U3T-hOs4000P.js.gz +0 -0
  196. package/dist/_frontend/assets/TrueForgeUIWithRouter-WD7O3TWR-rfYDejkx.js +0 -1
  197. package/dist/_frontend/assets/WidgetLayout-KQZTQNE7-CLurTXc-.js +0 -1
  198. package/dist/_frontend/assets/WidgetLayout-KQZTQNE7-CLurTXc-.js.br +0 -0
  199. package/dist/_frontend/assets/WidgetLayout-KQZTQNE7-CLurTXc-.js.gz +0 -0
  200. package/dist/_frontend/assets/chunk-62JRHF6Z-DVHPxtc3.js.br +0 -0
  201. package/dist/_frontend/assets/chunk-62JRHF6Z-DVHPxtc3.js.gz +0 -0
  202. package/dist/_frontend/assets/chunk-B76JC5B2-BMXX-7i9.js +0 -1
  203. package/dist/_frontend/assets/chunk-B76JC5B2-BMXX-7i9.js.br +0 -0
  204. package/dist/_frontend/assets/chunk-B76JC5B2-BMXX-7i9.js.gz +0 -0
  205. package/dist/_frontend/assets/chunk-G7BT4OKG-D-wOOnsv.js.br +0 -0
  206. package/dist/_frontend/assets/chunk-G7BT4OKG-D-wOOnsv.js.gz +0 -0
  207. package/dist/_frontend/assets/chunk-IGYCJIU7-COFxTXYC.js +0 -2
  208. package/dist/_frontend/assets/chunk-IGYCJIU7-COFxTXYC.js.br +0 -0
  209. package/dist/_frontend/assets/chunk-IGYCJIU7-COFxTXYC.js.gz +0 -0
  210. package/dist/_frontend/assets/cssMode-BMGYEB3M.js.br +0 -0
  211. package/dist/_frontend/assets/cssMode-BMGYEB3M.js.gz +0 -0
  212. package/dist/_frontend/assets/freemarker2-By56tpWC.js.br +0 -0
  213. package/dist/_frontend/assets/freemarker2-By56tpWC.js.gz +0 -0
  214. package/dist/_frontend/assets/handlebars-cEjR9Fs2.js.br +0 -0
  215. package/dist/_frontend/assets/handlebars-cEjR9Fs2.js.gz +0 -0
  216. package/dist/_frontend/assets/html-tYW1suOW.js.br +0 -0
  217. package/dist/_frontend/assets/html-tYW1suOW.js.gz +0 -0
  218. package/dist/_frontend/assets/htmlMode-D8PP1KzI.js.br +0 -0
  219. package/dist/_frontend/assets/htmlMode-D8PP1KzI.js.gz +0 -0
  220. package/dist/_frontend/assets/index-BS4907Xx.js.br +0 -0
  221. package/dist/_frontend/assets/index-BS4907Xx.js.gz +0 -0
  222. package/dist/_frontend/assets/index-DUFuoecn.js.br +0 -0
  223. package/dist/_frontend/assets/index-G7kdtXvB.js.br +0 -0
  224. package/dist/_frontend/assets/index-G7kdtXvB.js.gz +0 -0
  225. package/dist/_frontend/assets/jsonMode-CdMHir1V.js.br +0 -0
  226. package/dist/_frontend/assets/jsonMode-CdMHir1V.js.gz +0 -0
  227. package/dist/_frontend/assets/liquid-DXwQHd5_.js.br +0 -0
  228. package/dist/_frontend/assets/liquid-DXwQHd5_.js.gz +0 -0
  229. package/dist/_frontend/assets/lspLanguageFeatures-CEI6BsAF.js.br +0 -0
  230. package/dist/_frontend/assets/lspLanguageFeatures-CEI6BsAF.js.gz +0 -0
  231. package/dist/_frontend/assets/mdx-9AQsIt7X.js.br +0 -0
  232. package/dist/_frontend/assets/mdx-9AQsIt7X.js.gz +0 -0
  233. package/dist/_frontend/assets/python-OXQa8Ri9.js.br +0 -0
  234. package/dist/_frontend/assets/python-OXQa8Ri9.js.gz +0 -0
  235. package/dist/_frontend/assets/razor-BU90Q8Je.js.br +0 -0
  236. package/dist/_frontend/assets/razor-BU90Q8Je.js.gz +0 -0
  237. package/dist/_frontend/assets/tsMode-B3c5Otu4.js.br +0 -0
  238. package/dist/_frontend/assets/tsMode-B3c5Otu4.js.gz +0 -0
  239. package/dist/_frontend/assets/typescript-CtOR5Qmc.js.br +0 -0
  240. package/dist/_frontend/assets/typescript-CtOR5Qmc.js.gz +0 -0
  241. package/dist/_frontend/assets/workers-Dx3N8uH5.js.br +0 -3
  242. package/dist/_frontend/assets/workers-Dx3N8uH5.js.gz +0 -0
  243. package/dist/_frontend/assets/xml-DW3BhbEz.js.br +0 -0
  244. package/dist/_frontend/assets/xml-DW3BhbEz.js.gz +0 -0
  245. package/dist/_frontend/assets/yaml-BZ76X4yO.js.br +0 -0
  246. package/dist/_frontend/assets/yaml-BZ76X4yO.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{aR as Z,q as H,r,aS as B,aZ as G,j as e,S as W,I as N,M as X,Z as R,aU as Y,aV as J,aW as Q,g as ee,aX as te,an as se}from"./index-v37J5fNr.js";var ae={execTimeoutMs:3e5,autoStopIntervalInMinutes:15,autoArchiveIntervalInMinutes:10080,autoDeleteIntervalInMinutes:43200},F=se("h-11 shadow-sm");function K(s){if(s.trim()==="")return null;const l=Number(s);return!Number.isFinite(l)||l<0?null:l}var ne=({open:s,onOpenChange:l,onSave:d,title:g,description:I,initialConfig:D=null,requireApiKey:y=!0,busy:w=!1,error:C})=>{const[m,k]=r.useState(""),[u,x]=r.useState(""),[M,i]=r.useState(""),[b,o]=r.useState(""),[p,f]=r.useState(""),[P,v]=r.useState(!1),S=()=>{k(""),x(""),i(""),o(""),f(""),v(!1)};r.useEffect(()=>{if(!s)return;const a=D??ae;k(String(a.execTimeoutMs)),x(String(a.autoStopIntervalInMinutes)),i(String(a.autoArchiveIntervalInMinutes)),o(String(a.autoDeleteIntervalInMinutes)),f(""),v(!1)},[s,D]);const q=a=>{a||S(),l(a)},h=K(m),A=K(u),T=K(M),z=K(b),O=p.trim(),_=(!y||!!O)&&h!=null&&A!=null&&T!=null&&z!=null,E=async a=>{if(a.preventDefault(),!(!_||w||h==null||A==null||T==null||z==null))try{await d({execTimeoutMs:h,autoStopIntervalInMinutes:A,autoArchiveIntervalInMinutes:T,autoDeleteIntervalInMinutes:z,apiKey:O}),S(),l(!1)}catch{}};return e.jsx(Y,{open:s,onOpenChange:q,title:g,description:I,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(N,{name:"cube",className:"size-6"})}),children:e.jsxs("form",{className:"flex flex-col overflow-y-auto p-5 md:p-6",onSubmit:E,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"sandbox-api-key",className:"mb-1.5 block text-sm font-medium text-text-primary",children:["API key",y?null:e.jsx("span",{className:"font-normal text-text-secondary",children:" (optional)"})]}),e.jsx("input",{id:"sandbox-api-key",type:"password",required:y,value:p,onChange:a=>{f(a.target.value)},placeholder:y?"dtn_...":"Leave blank to keep existing",autoFocus:!0,className:F})]}),e.jsxs(J,{expanded:P,onChange:(a,t)=>v(t),className:"rounded-md border border-border",children:[e.jsx(Q,{className:"px-3 py-2.5",children:e.jsxs("span",{className:"flex w-full items-center justify-between text-sm font-medium text-text-primary",children:["Advanced settings",e.jsx(N,{name:"chevron-down",className:ee("size-4 shrink-0 text-text-secondary transition-transform duration-200",P?"rotate-0":"-rotate-90")})]})}),e.jsxs(te,{className:"space-y-4 border-t border-border px-3 pb-3 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-exec-timeout",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Exec timeout (ms)"}),e.jsx("input",{id:"sandbox-exec-timeout",type:"number",min:0,required:!0,value:m,onChange:a=>{k(a.target.value)},placeholder:"300000",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-stop",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-stop interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-stop",type:"number",min:0,required:!0,value:u,onChange:a=>{x(a.target.value)},placeholder:"15",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-archive",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-archive interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-archive",type:"number",min:0,required:!0,value:M,onChange:a=>{i(a.target.value)},placeholder:"10080",className:F})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"sandbox-auto-delete",className:"mb-1.5 block text-sm font-medium text-text-primary",children:"Auto-delete interval (minutes)"}),e.jsx("input",{id:"sandbox-auto-delete",type:"number",min:0,required:!0,value:b,onChange:a=>{o(a.target.value)},placeholder:"43200",className:F})]})]})]})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[C?e.jsx("p",{className:"text-failure-bg text-sm",children:C}):null,e.jsx(R.Primary,{type:"submit",size:"large",disabled:!_||w,className:"w-full shrink-0",children:"Save"})]})]})})},re=ne,le=1e4,L=({execTimeoutMs:s,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g})=>({execTimeoutMs:s,autoStopIntervalInMinutes:l,autoArchiveIntervalInMinutes:d,autoDeleteIntervalInMinutes:g}),ie=s=>{switch(s){case"pending":return{label:"Syncing image...",className:"text-warning-bg"};case"ready":return{label:"Connected",className:"text-success-bg"};case"failed":return{label:"Sync failed",className:"text-failure-bg"};default:return{label:s,className:"text-text-secondary"}}},oe=()=>{const{sandboxCatalog:s}=Z(),l=H(),[d,g]=r.useState([]),[I,D]=r.useState([]),[y,w]=r.useState(!0),[C,m]=r.useState(null),[k,u]=r.useState(null),[x,M]=r.useState(!1),[i,b]=r.useState(null),[o,p]=r.useState(null),f=r.useCallback(async({quiet:t=!1}={})=>{if(s){t||w(!0),m(null);try{const[n,c]=await Promise.all([s.listSandboxProviders(),s.getSandboxProviderCatalog()]);g(n),D(c)}catch(n){m(B(n,"Failed to load sandbox providers"))}finally{t||w(!1)}}},[s]);r.useEffect(()=>{f()},[f]);const P=d.some(t=>t.snapshotSyncStatus.status==="pending");r.useEffect(()=>{if(!s||!P)return;const t=s;let n=!1,c;function j(){c=window.setTimeout(()=>{$()},le)}async function $(){try{const U=await t.listSandboxProviders();if(n)return;g(U),m(null),U.some(V=>V.snapshotSyncStatus.status==="pending")&&j()}catch(U){if(n)return;m(B(U,"Failed to refresh sandbox providers")),j()}}return j(),()=>{n=!0,c!==void 0&&window.clearTimeout(c)}},[s,P]);const v=d.length>0,S=r.useMemo(()=>{if(v)return[];const t=new Set(d.map(n=>n.data.catalogId));return I.filter(n=>!t.has(n.id))},[I,d,v]),q=r.useMemo(()=>{const t=o??i;return t==null||!G(t)?null:L(t)},[o,i]);if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Sandbox provider catalog is not available."});const h=async(t,n=m)=>{M(!0),m(null);try{await t(),await f({quiet:!0})}catch(c){throw n(B(c,"Request failed")),c}finally{M(!1)}},A=async t=>{i&&(u(null),await h(async()=>{await s.createSandboxProvider({catalogId:i.id,name:i.name,type:i.type,...L(t),apiKey:t.apiKey})},u),b(null),setTimeout(()=>{l==null||l.showSuccess({title:`${i.name} configured`})},0))},T=async t=>{o&&(u(null),await h(async()=>{await s.updateSandboxProvider({id:o.id,...L(t),...t.apiKey?{apiKey:t.apiKey}:{}})},u),p(null),setTimeout(()=>{l==null||l.showSuccess({title:`${o.name} updated`})},0))},z=t=>{G(t)&&h(async()=>{await s.updateSandboxProvider({id:t.id,...L(t)})}).catch(()=>{})},O=t=>{const n=s.deleteSandboxProvider;n&&h(async()=>{await n({id:t.id})}).catch(()=>{})},_=i!=null||o!=null,E=o!=null,a=o?`Update ${o.name}`:i?`Configure ${i.name}`:"Configure sandbox provider";return e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-xl font-semibold tracking-tight text-text-primary",children:"Sandbox providers"}),e.jsx("p",{className:"mt-1 text-sm text-text-secondary",children:"Choose a provider that runs sandboxes for code, files and shell commands. Only one can be active at a time."}),C?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:C}):null,e.jsx("div",{className:"mt-4 flex-1 overflow-y-auto",children:y?e.jsx("p",{className:"text-sm text-text-secondary",children:"Loading sandbox 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(t=>{const n=t.data,c=ie(t.snapshotSyncStatus.status),j=t.snapshotSyncStatus.statusReason,$=e.jsxs("span",{className:`inline-flex items-center gap-1.5 text-sm font-medium ${c.className}`,children:[t.snapshotSyncStatus.status==="pending"?e.jsx(W,{size:16,"aria-label":"Syncing snapshot image"}):t.snapshotSyncStatus.status==="ready"?e.jsx("span",{className:"size-2 rounded-full bg-success-bg","aria-hidden":!0}):t.snapshotSyncStatus.status==="failed"?e.jsx(N,{name:"triangle-exclamation",className:"size-4"}):null,c.label]});return 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(N,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:n.name})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2.5 sm:justify-end",children:[$,j?e.jsx(X,{content:j,children:e.jsx("button",{type:"button","aria-label":"Snapshot sync status details",className:"inline-flex text-text-secondary transition-colors hover:text-text-primary",children:e.jsx(N,{name:"info",className:"size-4"})})}):null,t.snapshotSyncStatus.status==="failed"?e.jsx(R.Ghost,{size:"small",type:"button",disabled:x,onClick:()=>{z(n)},children:"Retry"}):null,e.jsx(R.Secondary,{size:"small",type:"button",disabled:x,onClick:()=>{u(null),b(null),p(n)},children:"Update"}),s.deleteSandboxProvider?e.jsx(R.Ghost,{size:"small",className:"text-text-secondary",type:"button",disabled:x,onClick:()=>{O(n)},children:"Remove"}):null]})]},n.id)})})]}):null,v?null:e.jsxs("section",{children:[e.jsxs("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-text-secondary",children:["Available · ",S.length]}),S.length===0?e.jsx("p",{className:"text-sm text-text-secondary",children:I.length>0?"All catalog providers are configured.":"No sandbox providers in the catalog."}):e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:S.map(t=>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(N,{name:"cube",className:"size-4.5"})}),e.jsx("div",{className:"min-w-0",children:e.jsx("h5",{className:"truncate text-sm font-medium text-text-primary",children:t.name})})]}),e.jsx(R.Secondary,{type:"button",disabled:x,onClick:()=>{u(null),p(null),b(t)},children:"Configure"})]},t.id))})]})]})}),e.jsx(re,{open:_,onOpenChange:t=>{t||(u(null),b(null),p(null))},onSave:E?T:A,title:a,description:E?"Update this sandbox provider. Leave API key blank to keep the existing key.":"Configure this sandbox provider. API key is never stored in the catalog.",initialConfig:q,requireApiKey:!E,busy:x,error:k})]})},ce=oe;export{ce as default};
@@ -0,0 +1 @@
1
+ import{N as fe,O as Re,q as be,r as o,Q as me,R as ke,U as ge,V as We,j as e,P as Qe,W as Ke,X as ce,Y as De,x as Fe,Z as $,I as z,$ as Ye,a0 as Se,a1 as we,a2 as Ze,a3 as Je,a4 as Te,a5 as W,a6 as Xe,a7 as Q,M as Le,a8 as et,a9 as tt,aa as st,ab as at,ac as nt,ad as rt,ae as lt,g as U,d as it,af as ot,ag as ue,f as ct,ah as dt,b as ut,ai as mt,aj as xt,ak as ht,al as ft,am as bt,an as Ce,l as gt,ao as pt}from"./index-v37J5fNr.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 Nt(t){const s=Ie(),r=new Set(Ee.map(l=>l.value));return[...[s,t].flatMap(l=>l==null||l.length===0||r.has(l)?[]:(r.add(l),[{value:l,label:l===s?`${l} (Local)`:l}])),...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"}],jt={"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 yt(t){return jt[t]??t.split("/").pop()??t}function Me(t){return t.toString().padStart(2,"0")}function le({hour:t,minute:s}){const r=t>=12?"PM":"AM",n=t%12===0?12:t%12;return`${String(n)}:${Me(s)} ${r}`}function xe(t){const s=t.minute,r=t.hour;switch(t.recurrence){case"hourly":return`${String(s)} * * * *`;case"daily":return`${String(s)} ${String(r)} * * *`;case"weekly":{const n=[...t.weekdays].sort((c,b)=>c-b),l=n.length>0?n.join(","):"*";return`${String(s)} ${String(r)} * * ${l}`}case"custom":return t.customCron.trim()}}function ae(t){const s=yt(t.timezone),r=t.cron.trim().split(/\s+/);if(r.length!==5)return t.cron;const[n,l,c,b,g]=r;if(c!=="*"||b!=="*")return t.cron;const d=Number(n),m=Number(l);if(l==="*"&&g==="*"&&n!==void 0&&!Number.isNaN(d))return`Hourly at :${Me(d)} ${s}`;if(g==="*"&&l!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(d))return`Daily ${le({hour:m,minute:d})} ${s}`;if(g==="1-5"&&l!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(d))return`Weekdays ${le({hour:m,minute:d})} ${s}`;if(g!=null&&/^\d(?:,\d)*$/.test(g)&&l!==void 0&&n!==void 0&&!Number.isNaN(m)&&!Number.isNaN(d)){const f=g.split(",").map(N=>{var j;return((j=$e.find(i=>i.value===Number(N)))==null?void 0:j.label)??N});return f.length===1?`Every ${f[0]==="Mon"?"Monday":f[0]} ${le({hour:m,minute:d})} ${s}`:`${f.join(", ")} ${le({hour:m,minute:d})} ${s}`}return t.cron}function ze(t){const s=de(),r=t.cron.trim().split(/\s+/);if(r.length!==5)return{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron};const[n,l,c,b,g]=r,d=Number(n),m=Number(l);return c!=="*"||b!=="*"?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"custom",customCron:t.cron}:l==="*"&&g==="*"&&!Number.isNaN(d)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"hourly",minute:d,customCron:t.cron}:g==="*"&&!Number.isNaN(m)&&!Number.isNaN(d)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"daily",hour:m,minute:d,customCron:t.cron}:g!=null&&/^\d(?:,\d)*$/.test(g)&&!Number.isNaN(m)&&!Number.isNaN(d)?{...s,name:t.name,task:t.task,timezone:t.timezone,recurrence:"weekly",hour:m,minute:d,weekdays:g.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(d)?s.minute:d}}function vt(t,s=Date.now()){if(t==null)return"Never";const r=Date.parse(t);if(Number.isNaN(r))return"Never";const n=Math.round((s-r)/1e3);if(n<60)return"just now";const l=Math.round(n/60);if(l<60)return`${String(l)} min ago`;const c=Math.round(l/60);if(c<48)return`${String(c)} hour${c===1?"":"s"} ago`;const b=Math.round(c/24);return`${String(b)} day${b===1?"":"s"} ago`}var kt=[{value:"hourly",label:"Hourly"},{value:"daily",label:"Daily"},{value:"weekly",label:"Weekly"}],St=Array.from({length:24},(t,s)=>({value:String(s),label:s.toString().padStart(2,"0")})),wt=[0,15,30,45].map(t=>({value:String(t),label:`:${t.toString().padStart(2,"0")}`}));function Tt({values:t,onChange:s,agentId:r,agentLabel:n,onAgentIdChange:l,onAgentPicked:c,agentPickerDisabled:b=!1,onBuildAgent:g}){const d=xe(t),m=ae({cron:d,timezone:t.timezone}),f=Nt(t.timezone),N=(i,y)=>{s({...t,[i]:y})},j=i=>{const T=t.weekdays.includes(i)?t.weekdays.filter(x=>x!==i):[...t.weekdays,i];s({...t,weekdays:T.length>0?T:[i]})};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:r,selectedLabel:n,onValueChange:i=>l==null?void 0:l(i),onAgentPicked:c,disabled:b||l==null,onBuildAgent:g})]}),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:i=>N("name",i.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:i=>N("task",i.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:kt.map(i=>{const y=t.recurrence===i.value;return e.jsx("button",{type:"button",className:U("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",i.value),children:i.label},i.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(i=>{const y=t.weekdays.includes(i.value);return e.jsx("button",{type:"button",className:U("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(i.value),children:i.label},i.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(ce,{"aria-label":"Hour",value:String(t.hour),options:St,onValueChange:i=>N("hour",Number(i))})]}):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(ce,{"aria-label":"Minute",value:String(t.minute),options:wt,onValueChange:i=>N("minute",Number(i))})]}):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(ce,{"aria-label":"Timezone",value:t.timezone,options:f,onValueChange:i=>N("timezone",i),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:d||"—"})]})})]})]})}function Ct(t){return t.startsWith("manual-")}function Et(t){return t==="failed"?"failed":"success"}function Oe(t){return t==="failed"?"Failed":t==="triggered"?"Triggered":"Scheduled"}function Be(t){return Ct(t)?"Manual test":"Cron"}function zt(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())?"—":ft(s)}function At({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 Pt={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=Et(t.status),r=he(t.triggeredAt??t.scheduledFor);return e.jsx(Le,{content:e.jsx(At,{run:t}),className:"max-w-sm whitespace-normal",side:"top",children:e.jsx("span",{className:U("inline-flex size-6 shrink-0 items-center justify-center rounded-md border",Pt[s]),"aria-label":`${Oe(t.status)} run at ${r}`,children:e.jsx(z,{name:s==="failed"?"triangle-exclamation":"check",className:"size-3.5"})})})}function Ue({status:t}){const s=t==="active";return e.jsxs("span",{className:U("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-xs font-medium",s?"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":"border-amber-600/30 bg-amber-500/10 text-amber-800 dark:border-amber-400/35 dark:bg-amber-500/15 dark:text-amber-300"),children:[e.jsx("span",{className:U("size-1.5 shrink-0 rounded-full",s?"bg-emerald-600 dark:bg-emerald-400":"bg-amber-600 dark:bg-amber-400"),"aria-hidden":!0}),s?"Active":"Paused"]})}function Rt(t,s){return t.find(r=>r.name===s||r.id===s)??null}function Dt({connector:t,onConnected:s}){return gt()==null?null:e.jsx(pt,{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 Ft({schedule:t,agentName:s,mcpMounts:r,onEditConfiguration:n}){const l=fe(),c=be(),{connectors:b,ensureLoaded:g,refreshConnectors:d,loading:m,error:f}=bt(),[N,j]=o.useState(!1),[i,y]=o.useState(null),T=ae({cron:t.cron,timezone:t.timezone}),x=async()=>{j(!0);try{const w=await l.createScheduleRun({scheduleId:t.id});y(w),c==null||c.showSuccess({title:"Test run started"})}catch(w){c==null||c.showError(w)}finally{j(!1)}};return o.useEffect(()=>{g()},[g]),o.useEffect(()=>{f!=null&&(c==null||c.showError(f))},[f,c]),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"})}),r.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:r.map(w=>{const C=Rt(b,w.name),E=(C==null?void 0:C.authenticated)===!0,K=C==null&&!m;return e.jsxs("li",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:U("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"}):K?e.jsx("span",{className:"text-text-secondary text-xs",children:"Unavailable"}):C!=null&&C.authenticated===!1?e.jsx(Dt,{connector:C,onConnected:d}):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:U("size-3.5",N&&"animate-spin")}),"Run Test"]})]}),i==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:i}),e.jsxs("div",{className:"min-w-0 text-sm",children:[e.jsx("p",{className:"text-text-primary font-medium",children:Be(i.name)}),e.jsx("p",{className:"text-text-secondary",children:vt(i.triggeredAt??i.scheduledFor)})]})]})]})]})}function Lt({open:t,onOpenChange:s,mode:r,schedule:n,initialAgentId:l="",onSaved:c}){const b=fe(),g=Re(),d=ut(),m=be(),[f,N]=o.useState(de),[j,i]=o.useState(l),[y,T]=o.useState(null),[x,w]=o.useState({kind:"form"}),[C,E]=o.useState(!1),[K,A]=o.useState(!1),[H,p]=o.useState(null),Y=o.useRef(j);Y.current=j;const M=x.kind==="form"?x.saved:x.schedule,O=r==="edit"&&x.kind==="form"&&x.saved==null&&n!=null,L=x.kind==="form"&&x.saved!=null,q=r==="create"&&x.kind==="form"&&x.saved==null,{allows:G}=me({resourceType:"agent",resourceIds:j.length===0?[]:[j]});o.useEffect(()=>{if(!t){N(de()),i(l),T(null),p(null),w({kind:"form"}),A(!1);return}if(r==="edit"&&n!=null){N(ze({name:n.name,task:n.task,cron:n.cron,timezone:n.timezone})),i(n.agentId),T(null),w({kind:"form"});return}N(de()),i(l),T(null),w({kind:"form"})},[t,r,n,l]),o.useEffect(()=>{if(!t||r!=="create"||l.length===0)return;let h=!1;const v=l;return mt({server:g,agentKey:v}).then(S=>{h||S==null||Y.current===v&&(T(S),i(Fe(S)))}).catch(()=>{}),()=>{h=!0}},[t,r,l,g]);const B=(y==null?void 0:y.name)??(M==null?void 0:M.agentName)??(n==null?void 0:n.agentName)??(j.length>0?j:""),Z=o.useMemo(()=>{var v;return(((v=y==null?void 0:y.agentSpec)==null?void 0:v.mcpServers)??[]).map(xt).filter(S=>S!=null).map(S=>({name:S}))},[y]),P=o.useMemo(()=>{const h=xe(f);return f.name.trim().length>0&&f.task.trim().length>0&&h.length>0&&j.length>0&&(!q||G(j,"USE"))},[j,G,f,q]),te=h=>{w({kind:"test",schedule:h}),N(ze({name:h.name,task:h.task,cron:h.cron,timezone:h.timezone})),i(h.agentId)},J=async h=>{if(h.preventDefault(),!P)return;const v=xe(f);E(!0),p(null);try{if(O&&n!=null){await b.updateSchedule({id:n.id,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:n.status}),c==null||c(),s(!1);return}if(L&&x.kind==="form"&&x.saved!=null){const _=await b.updateSchedule({id:x.saved.id,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:"paused"});c==null||c(),te(_),m==null||m.showSuccess({title:"Schedule saved as paused",description:ae({cron:_.cron,timezone:_.timezone})});return}const S=await b.createSchedule({agentId:j,name:f.name.trim(),task:f.task.trim(),cron:v,timezone:f.timezone,status:"paused"});c==null||c(),te(S),m==null||m.showSuccess({title:"Schedule saved as paused",description:ae({cron:S.cron,timezone:S.timezone})})}catch(S){const _=S instanceof Error?S.message:"Failed to save schedule";p(_)}finally{E(!1)}},D=async()=>{if(x.kind==="test"){A(!0),p(null);try{await b.updateSchedule({id:x.schedule.id,name:x.schedule.name,task:x.schedule.task,cron:x.schedule.cron,timezone:x.schedule.timezone,status:"active"}),c==null||c(),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)}}},V=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:[H!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:H}):null,e.jsx($.Secondary,{type:"button",className:"w-full",disabled:K,onClick:()=>void D(),children:"Activate Schedule"})]}):F=e.jsxs("div",{className:"flex flex-col gap-2",children:[H!=null?e.jsx("p",{className:"text-failure-bg text-sm",children:H}):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:!P||C,children:"Save"})]})]}),e.jsx(ht,{open:t,onOpenChange:s,title:V,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(Ft,{schedule:x.schedule,agentName:B,mcpMounts:Z,onEditConfiguration:()=>{p(null),w({kind:"form",saved:x.schedule})}}):e.jsx("form",{id:"schedule-form",onSubmit:h=>void J(h),children:e.jsx(Tt,{values:f,onChange:N,agentId:j,agentLabel:B,onAgentIdChange:O||L?void 0:h=>{i(h),h.length===0&&T(null)},onAgentPicked:T,agentPickerDisabled:O||L,onBuildAgent:r==="create"&&(d==null?void 0:d.isComposerEnabled)===!0?()=>{s(!1),d.openAgentBuilder()}:void 0})})})}function Ae(t){return e.jsx(dt,{children:e.jsx(Lt,{...t})})}function It({runs:t}){const s=zt(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(r=>e.jsx(_e,{run:r},r.id))})}var $t=[{value:"all",label:"All statuses"},{value:"active",label:"Active"},{value:"paused",label:"Paused"}],Pe=[10,25];function ie(t){return Math.min(Math.max(t,1),25)}function oe(t){const s=ge(t);return{nameQuery:s.q??"",statusFilter:s.status??"all",agentFilter:s.agent??"all"}}function Mt(t){const s=ge(window.location.search);if(!s.isNew)return{kind:"closed"};const r=t??s.agent;return{kind:"create",...r==null?{}:{agentId:r}}}function Ot({schedule:t,running:s,canManage:r,canDelete:n,onRunNow:l,onEdit:c,onTogglePause:b,onDelete:g}){const d=it("PermissionGuard");return e.jsxs("div",{className:"inline-flex items-center justify-end gap-1.5",children:[e.jsx(d,{allowed:r,children:e.jsxs($.Secondary,{type:"button",disabled:s,"aria-label":`Run now ${t.name}`,size:"large",onClick:l,children:[e.jsx(z,{name:s?"loader":"play",className:U("size-3.5",s&&"animate-spin")}),"Run now"]})}),e.jsxs(ot,{align:"end",trigger:e.jsx("button",{type:"button",className:ct({variant:"ghost",size:"icon"}),"aria-label":`Actions for ${t.name}`,children:e.jsx(z,{name:"ellipsis"})}),children:[e.jsx(d,{allowed:r,children:e.jsxs(ue,{onClick:c,children:[e.jsx(z,{name:"pencil",className:"size-3.5"}),"Edit"]})}),e.jsx(d,{allowed:r,children:e.jsxs(ue,{onClick:b,children:[e.jsx(z,{name:t.status==="active"?"pause":"play",className:"size-3.5"}),t.status==="active"?"Pause":"Resume"]})}),e.jsx(d,{allowed:n,children:e.jsxs(ue,{className:"text-failure-bg focus:text-failure-bg",onClick:g,children:[e.jsx(z,{name:"trash",className:"size-3.5"}),"Delete"]})})]})]})}function _t({agentId:t}){const s=fe(),r=Re(),n=be(),[l,c]=o.useState([]),{allows:b}=me({resourceType:"schedule",resourceIds:l.map(a=>a.id)}),[g,d]=o.useState({}),[m,f]=o.useState(!1),[N,j]=o.useState(()=>new Set),[i,y]=o.useState({}),[T,x]=o.useState(!0),[w,C]=o.useState(null),[E,K]=o.useState(()=>oe(window.location.search).nameQuery),[A,H]=o.useState(()=>oe(window.location.search).statusFilter),[p,Y]=o.useState(()=>t??oe(window.location.search).agentFilter),M=t??(p==="all"?null:p),{allows:O}=me({resourceType:"agent",resourceIds:M==null?[]:[M]}),L=r.permissions==null||M==null||O(M,"USE"),[q,G]=o.useState(()=>Mt(t)),[B,Z]=o.useState(null),[P,te]=o.useState(()=>ie(lt)),[J,D]=o.useState(void 0),[V,ne]=o.useState(void 0),[F,h]=o.useState(void 0),v=o.useRef(0),S=o.useRef(!1),_=o.useCallback(async({rows:a,gen:u})=>{if(a.length===0){u===v.current&&d({});return}f(!0);try{const k=await Promise.allSettled(a.map(R=>s.listScheduleRuns({scheduleId:R.id})));if(u!==v.current)return;d(Object.fromEntries(a.map((R,I)=>{const ee=k[I],Ve=(ee==null?void 0:ee.status)==="fulfilled"?ee.value:[];return[R.id,Ve]})))}finally{u===v.current&&f(!1)}},[s]),X=o.useCallback(async({token:a,size:u,agentId:k})=>{const R=++v.current;x(!0),C(null);try{const I=await s.listSchedules({limit:ie(u),...a===void 0||a===""?{}:{pageToken:a},...k==="all"?{}:{agentIds:[k]}});if(R!==v.current)return;c(I.data),ne(I.nextPageToken),h(I.previousPageToken),_({rows:I.data,gen:R})}catch(I){if(R!==v.current)return;const ee=I instanceof Error?I.message:"Failed to load schedules";C(ee),c([]),d({}),ne(void 0),h(void 0)}finally{R===v.current&&x(!1)}},[s,_]),pe=o.useCallback(a=>{const u=(a==null?void 0:a.size)??P,k=(a==null?void 0:a.agentId)??p;D(void 0),h(void 0),X({token:void 0,size:u,agentId:k})},[p,X,P]);o.useEffect(()=>{ke({agent:t===void 0&&p!=="all"?p:null,status:A==="all"?null:A,q:E.trim().length===0?null:E})},[p,t,A,E]),o.useEffect(()=>{t!==void 0&&Y(a=>a===t?a:(D(void 0),h(void 0),t))},[t]),o.useEffect(()=>{S.current||!ge(window.location.search).isNew||(S.current=!0,ke({isNew:null}))},[]),o.useEffect(()=>{const a=()=>{const u=oe(window.location.search);K(u.nameQuery),H(u.statusFilter),Y(k=>{const R=t??u.agentFilter;return k===R?k:(D(void 0),h(void 0),R)})};return window.addEventListener("popstate",a),()=>{window.removeEventListener("popstate",a)}},[t]),o.useEffect(()=>{X({token:J,size:P,agentId:p})},[p,P,J,X]);const re=o.useMemo(()=>{const a=E.trim().toLowerCase();return l.filter(u=>!(A!=="all"&&u.status!==A||a.length>0&&!u.name.toLowerCase().includes(a)))},[l,E,A]),Ne=We(l),je=F!=null||V!=null,He=async a=>{if(!b(a.id,"MANAGE"))return;const u=a.status==="active"?"paused":"active";try{await s.updateSchedule({...a,status:u}),await X({token:J,size:P,agentId:p})}catch(k){n==null||n.showError(k)}},qe=async a=>{if(b(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});d(k=>({...k,[a.id]:u}))}catch(u){n==null||n.showError(u)}finally{j(u=>{const k=new Set(u);return k.delete(a.id),k})}}},Ge=async a=>{if(b(a.id,"DELETE")){Z(null);try{await s.deleteSchedule({id:a.id}),pe()}catch(u){n==null||n.showError(u)}}},ye=()=>{V!=null&&D(V)},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(Qe,{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(Ke,{query:E,setQuery:K,placeholder:"Search schedules by name"})}),e.jsx(ce,{value:A,onValueChange:H,options:$t,className:"sm:w-40","aria-label":"Filter by status"}),t===void 0?e.jsx(De,{value:p,selectedLabel:p==="all"?"All agents":i[p]??p,onValueChange:a=>{Y(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&&G({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(Ye,{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}):l.length===0?e.jsx(Se,{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(Se,{title:"No Schedules Found",description:"No schedules match your filters.",className:"flex-1"}),je?e.jsx(we,{pageSize:P,rowCount:0,canPrev:F!=null,canNext:V!=null,onPrev:ve,onNext:ye,pageSizeOptions:Pe,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(Ze,{className:"min-w-240",children:[e.jsx(Je,{children:e.jsxs(Te,{className:"hover:bg-transparent",children:[e.jsx(W,{children:"Schedule Name"}),e.jsx(W,{children:"Task"}),Ne?e.jsx(W,{children:"Created by"}):null,e.jsx(W,{children:"Frequency"}),e.jsx(W,{children:"Status"}),e.jsx(W,{children:"Last 5 runs"}),e.jsx(W,{children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx(Xe,{children:re.map(a=>{const u=ae({cron:a.cron,timezone:a.timezone}),k=a.agentName??i[a.agentId]??a.agentId;return e.jsxs(Te,{children:[e.jsxs(Q,{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:k})]})]}),e.jsx(Q,{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(Q,{children:e.jsx(et,{subject:a.createdBySubject})}):null,e.jsx(Q,{children:u}),e.jsx(Q,{children:e.jsx(Ue,{status:a.status})}),e.jsx(Q,{children:m?e.jsx("span",{className:"text-text-secondary text-sm",children:"…"}):e.jsx(It,{runs:g[a.id]??[]})}),e.jsx(Q,{className:"text-right",children:e.jsx(Ot,{schedule:a,running:N.has(a.id),canManage:b(a.id,"MANAGE"),canDelete:b(a.id,"DELETE"),onRunNow:()=>void qe(a),onEdit:()=>{b(a.id,"MANAGE")&&G({kind:"edit",schedule:a})},onTogglePause:()=>void He(a),onDelete:()=>{b(a.id,"DELETE")&&Z(a)}})})]},a.id)})})]}),(re.length>0||je)&&e.jsx(we,{pageSize:P,rowCount:re.length,canPrev:F!=null,canNext:V!=null,onPrev:ve,onNext:ye,pageSizeOptions:Pe,onPageSizeChange:a=>{const u=ie(a);te(u),D(void 0),h(void 0)}})]})}),q.kind==="create"?e.jsx(Ae,{open:!0,mode:"create",initialAgentId:q.agentId??"",onOpenChange:a=>{a||G({kind:"closed"})},onSaved:()=>pe()}):null,q.kind==="edit"?e.jsx(Ae,{open:!0,mode:"edit",schedule:q.schedule,onOpenChange:a=>{a||G({kind:"closed"})},onSaved:()=>void X({token:J,size:P,agentId:p})}):null,B!=null?e.jsxs(tt,{open:!0,onOpenChange:a=>{a||Z(null)},"aria-label":"Delete schedule",className:"max-w-md",children:[e.jsx(st,{children:e.jsxs(at,{children:[e.jsx(nt,{children:"Delete schedule"}),e.jsxs("p",{className:"text-text-secondary text-sm",children:["“",B.name,"” will stop running. This cannot be undone."]})]})}),e.jsxs(rt,{children:[e.jsx($.Secondary,{type:"button",onClick:()=>Z(null),children:"Cancel"}),e.jsx($.Destructive,{type:"button",disabled:!b(B.id,"DELETE"),onClick:()=>void Ge(B),children:"Delete"})]})]}):null]})}export{_t as SchedulesPage};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ModelSettings-ZL5ITPNM-DIT1YkR8.js","./index-v37J5fNr.js","./index-B01pXqvC.css","./ConnectorSettings-OYKNP6QY-D7z4YVGY.js","./SkillSettings-2Q3S365A-rvOFDDo6.js","./SandboxSettings-6JWRHKBS-CEGw9Cjx.js","./WebSearchSettings-IT5FIYZ4-DVIwh7RD.js"])))=>i.map(i=>d[i]);
2
+ import{i as v,l as y,aP as S,am as _,aQ as j,r as l,j as e,P as w,I as h,f as k,g as x,_ as d,S as E}from"./index-v37J5fNr.js";var C=l.lazy(()=>d(()=>import("./ModelSettings-ZL5ITPNM-DIT1YkR8.js"),__vite__mapDeps([0,1,2]),import.meta.url)),N=l.lazy(()=>d(()=>import("./ConnectorSettings-OYKNP6QY-D7z4YVGY.js"),__vite__mapDeps([3,1,2]),import.meta.url)),P=l.lazy(()=>d(()=>import("./SkillSettings-2Q3S365A-rvOFDDo6.js"),__vite__mapDeps([4,1,2]),import.meta.url)),L=l.lazy(()=>d(()=>import("./SandboxSettings-6JWRHKBS-CEGw9Cjx.js"),__vite__mapDeps([5,1,2]),import.meta.url)),O=l.lazy(()=>d(()=>import("./WebSearchSettings-IT5FIYZ4-DVIwh7RD.js"),__vite__mapDeps([6,1,2]),import.meta.url));function D(){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(E,{size:20,className:"text-text-secondary"}),e.jsx("span",{className:"sr-only",children:"Loading"})]})}var I=()=>{const{settingsOpen:n,settingsSection:t,setSettingsOpen:r}=v(),a=y(),f=S(),{refresh:b}=_(),i=j(),o=(a==null?void 0:a.skillCatalog)!=null,c=(a==null?void 0:a.sandboxCatalog)!=null,u=(a==null?void 0:a.webSearchCatalog)!=null,m=l.useCallback(()=>{r(!1)},[r]);l.useEffect(()=>{if(n)return()=>{b(),f==null||f()}},[n,b,f]),l.useEffect(()=>{!o&&t==="skills"&&r(n,"models"),!c&&t==="sandbox"&&r(n,"models"),!u&&t==="web-search"&&r(n,"models")},[o,c,u,t,n,r]),l.useEffect(()=>{if(!n)return;const s=p=>{p.key==="Escape"&&(p.stopImmediatePropagation(),m())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[m,n]);const g=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!n||!a?null:e.jsxs("div",{className:"flex h-full min-h-0 w-full flex-col bg-primary-bg",children:[e.jsx(w,{title:"Settings",start:e.jsx("button",{type:"button","aria-label":"Back",title:"Back",className:k({variant:"ghost",size:"icon"}),onClick:m,children:e.jsx(h,{name:"arrow-left"})})}),e.jsxs("div",{className:x("flex min-h-0 flex-1 flex-col",!i&&"md:flex-row"),children:[e.jsx("nav",{"aria-label":"Settings sections",className:x("flex w-full gap-1 border-b border-border bg-secondary-bg/40 p-2",i?"min-w-0":"justify-center md:w-48 md:flex-col md:justify-start md:border-b-0 md:border-r"),children:g.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 flex-col h-full flex-1 overflow-y-hidden px-6 py-4",children:e.jsx("div",{className:"w-full max-w-210 h-full min-h-0 flex flex-col mx-auto",children:e.jsxs(l.Suspense,{fallback:e.jsx(D,{}),children:[t==="models"?e.jsx(C,{}):null,t==="connectors"?e.jsx(N,{}):null,t==="skills"&&o?e.jsx(P,{}):null,t==="sandbox"&&c?e.jsx(L,{}):null,t==="web-search"&&u?e.jsx(O,{}):null]})})})]})]})},R=I;export{R as default};
@@ -0,0 +1 @@
1
+ import{r as ae}from"./chunk-BZ2EOR5X-BgN-bqzz.js";import{i as ie,k as le,l as ue,m as oe,n as ce,o as ge,p as pe,q as fe,r as a,t as ye,v as he,w as de,x as Se,y as M,z as P,A as Z,B as _}from"./index-v37J5fNr.js";import{u as me,a as be}from"./chunk-62JRHF6Z-ByllQXFT.js";var k="try_agent_name",T="history_agent_name";function x(n){return n!=null&&n.length>0?n:null}function B(n){const i=new URLSearchParams(n.startsWith("?")?n.slice(1):n),l=x(i.get(k));if(l!=null)return{intent:"try-agent",agentName:l};const c=x(i.get(T));return c==null?null:{intent:"history",agentName:c}}function Ae(n,i){n.delete(k),n.delete(T),i!=null&&n.set(i.intent==="try-agent"?k:T,i.agentName)}function ee(n,i){const l=new URLSearchParams(n.startsWith("?")?n.slice(1):n);Ae(l,i);const c=l.toString();return c.length>0?`?${c}`:""}function te(n){const i=n.activeRemoteId??n.pendingSessionId;if(i!=null)return{type:"session",sessionId:i};const{mode:l,agentConfigMode:c}=n;if(l.status==="active"&&l.isMutable&&l.isCreateAgent)return{type:"buildAgent"};if(l.status==="active"&&!l.isMutable&&c!=="SingleAgent"){const e=l.agentName??l.agentId;if(e!=null)return{type:"agent",agentName:e}}return{type:"root"}}function Oe(n){return n.settingsOpen?{type:"settings"}:n.schedulesOpen?{type:"schedules"}:n.sessionsOpen&&n.sharedSessionId!=null?{type:"sharedSession",sessionId:n.sharedSessionId}:n.sessionsOpen?{type:"sessionsBrowser"}:n.libraryOpen&&n.libraryAgentId!=null?{type:"libraryAgent",agentId:n.libraryAgentId}:n.libraryOpen?{type:"library"}:te(n)}function A(n){return n.type==="root"||n.type==="agent"||n.type==="session"}function Ne(n){return n.type==="sessionsBrowser"||n.type==="sharedSession"}function we({routes:n,activeRemoteId:i,initialSettingsOpen:l,onError:c}){var J,V;const e=ie(),S=le(),q=ue(),U=oe(),$=ce(),W=ge(),Y=pe(),H=fe(),L=me(),r=be(),u=a.useMemo(()=>ye({routes:n,catalog:q,capabilities:W,sessions:U,schedules:$}),[n,q,W,U,$]),G=u.settings!=null,ne=[u.settings,u.sessionsBrowser,u.sharedSession,u.libraryAgent,u.schedules].join("\0"),K={settingsOpen:e.settingsOpen,libraryOpen:e.libraryOpen,sessionsOpen:e.sessionsOpen,sharedSessionId:e.sharedSessionId,libraryAgentId:e.libraryAgentId,schedulesOpen:e.schedulesOpen,pendingSessionId:e.pendingSessionId,activeRemoteId:i,mode:e.mode,agentConfigMode:e.agentConfigMode},p=Oe(K),se=JSON.stringify(p),b=a.useRef(null),E=a.useRef(null),O=a.useRef(null),N=a.useRef(!1),R=a.useRef(null),m=a.useRef(null),I=a.useRef(null),f=a.useRef(null),z=a.useRef(!1),Q=a.useRef(!1),v=a.useCallback(()=>{switch(e.setSettingsOpen(!1),e.setLibraryOpen(!1),e.setSchedulesOpen(!1),e.agentConfigMode){case"AgentLibrary":e.openLibraryHome();return;case"AgentComposer":case"AgentLibraryWithComposer":e.openDraft();return;case"SingleAgent":e.clearChat();return}},[e]),j=a.useCallback(t=>{if(I.current=t,S==null){e.openHistorySession({sessionId:t});return}S.getSession({sessionId:t}).then(s=>{I.current===t&&e.openHistorySession({sessionId:t,isMutable:s.isMutable,isCreateAgent:he(s),...s.agentName!=null?{agentName:s.agentName}:{}})}).catch(s=>{I.current===t&&(I.current=null,R.current=null,ae({error:s,...c!=null?{onError:c}:{},...H!=null?{showError:H.showError}:{}}),v())})},[v,c,S,e,H]),h=a.useCallback(t=>{if(t==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}const s=`${t.intent}\0${t.agentName}`,o=e.historyAgentFilter;if((o==null?void 0:o.intent)===t.intent&&o.agentName===t.agentName&&o.agentId!=null){f.current=null;return}f.current=s,e.setHistoryAgentFilter(t),S!=null&&de({server:S,agentName:t.agentName}).then(g=>{if(f.current===s){if(g==null){f.current=null,m.current=null,e.setHistoryAgentFilter(null);return}f.current=null,e.setHistoryAgentFilter({agentId:Se(g),agentName:g.name,intent:t.intent})}}).catch(()=>{f.current===s&&(f.current=null,m.current=null,e.setHistoryAgentFilter(null))})},[S,e]),D=a.useCallback(t=>{e.selectLibraryAgent({isMutable:!1,agentName:t}),h({intent:"try-agent",agentName:t})},[h,e]),F=a.useCallback(t=>{switch(t.type){case"settings":e.setSettingsOpen(!0);return;case"library":e.setLibraryOpen(!0);return;case"sessionsBrowser":e.setSessionsOpen(!0);return;case"sharedSession":e.openSharedSession(t.sessionId);return;case"libraryAgent":e.openLibraryAgent(t.agentId);return;case"schedules":e.setSchedulesOpen(!0);return;case"buildAgent":e.openAgentBuilder();return;case"session":if(e.setLibraryOpen(!1),e.pendingSessionId===t.sessionId||i===t.sessionId)return;j(t.sessionId);return;case"agent":e.setLibraryOpen(!1),D(t.agentName);return;case"root":v();return}},[e,i,v,D,j]);return a.useEffect(()=>{if(N.current)return;const t=M({pathname:r.pathname,search:r.search,routes:n});if(!Y&&(t==null?void 0:t.type)==="settings")return;N.current=!0;const s=M({pathname:r.pathname,search:r.search,routes:u})??{type:"root"},o=s.type==="agent"?{intent:"try-agent",agentName:s.agentName}:A(s)?B(r.search):null;m.current=o,O.current=s;const g=G&&(l||s.type==="settings");if(s.type==="settings")G&&e.setSettingsOpen(!0);else if(s.type==="library")e.setLibraryOpen(!0);else if(s.type==="sessionsBrowser")e.setSessionsOpen(!0);else if(s.type==="libraryAgent")e.openLibraryAgent(s.agentId);else if(s.type==="schedules")e.setSchedulesOpen(!0);else{const C=te(K);P(C,s)||F(s),g&&e.setSettingsOpen(!0)}s.type!=="agent"&&o!=null?h(o):A(s)||h(null);const d=g?{type:"settings"}:s;R.current=P(p,d)?null:d;const y=Z(d,u),w=ee(_(d,r.search),o);E.current=d,y!=null&&(y!==r.pathname||w!==r.search)&&(b.current=y!==r.pathname?y:null,L({pathname:y,search:w,hash:r.hash},{replace:!0}))},[Y]),a.useEffect(()=>{if(!N.current)return;if(!z.current){z.current=!0;return}const t=R.current;if(t!=null){if(!P(p,t))return;R.current=null}const s=Z(p,u);if(s==null)return;const g=`${u.basename.endsWith("/")?u.basename.slice(0,-1):u.basename}${r.pathname}`||"/",d=window.location.pathname===g?window.location.search:r.search,y=A(p),w=y?e.historyAgentFilter==null?m.current:{intent:e.historyAgentFilter.intent,agentName:e.historyAgentFilter.agentName}:null;!y&&e.historyAgentFilter!=null&&(f.current=null,e.setHistoryAgentFilter(null)),e.historyAgentFilter!=null&&(m.current=null);const C=ee(_(p,d),w),X=E.current;if(E.current=p,s===r.pathname&&C===r.search)return;const re=p.type==="session"&&e.pendingSessionId==null&&X!=null&&X.type!=="session";b.current=s!==r.pathname?s:null,L({pathname:s,search:C,hash:r.hash},{replace:re})},[se,ne,(J=e.historyAgentFilter)==null?void 0:J.agentName,(V=e.historyAgentFilter)==null?void 0:V.intent]),a.useEffect(()=>{if(!N.current)return;if(!Q.current){Q.current=!0;return}if(b.current===r.pathname){b.current=null,O.current=p;return}const t=M({pathname:r.pathname,search:r.search,routes:u});if(t==null){const o=u.root,g=_({type:"root"},r.search);b.current=o,L({pathname:o,search:g,hash:r.hash},{replace:!0}),F({type:"root"}),h(B(g));return}const s=O.current;O.current=t,(s==null||!P(s,t))&&(t.type!=="settings"&&e.settingsOpen&&e.setSettingsOpen(!1),t.type!=="library"&&t.type!=="libraryAgent"&&e.libraryOpen&&e.setLibraryOpen(!1),!Ne(t)&&e.sessionsOpen&&e.setSessionsOpen(!1),t.type!=="schedules"&&e.schedulesOpen&&e.setSchedulesOpen(!1),F(t)),t.type!=="agent"&&A(t)?h(B(r.search)):A(t)||h(null)},[r.pathname,r.search]),null}export{we as ShellRouteSync};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-G5CP5X6Q-XQVNLXzw.js","./index-G7kdtXvB.js","./index-B01pXqvC.css","./SchedulesPage-TIS3BH67-CoDDvRbI.js"])))=>i.map(i=>d[i]);
2
- import{bG as _,bH as Vt,u as G,j as r,bI as Xt,r as d,b1 as P,bJ as He,bK as Wt,bL as Ue,bM as Ve,bN as Xe,bO as We,bP as Ye,bQ as Y,bR as Yt,bS as j,bT as qt,bU as Qt,bV as Zt,bW as Jt,bX as en,bY as tn,bZ as nn,b_ as rn,b$ as be,c0 as sn,c1 as on,c2 as le,c3 as an,c4 as cn,c5 as ln,c6 as qe,c7 as De,c8 as ue,c9 as we,ca as oe,cb as ye,cc as Ie,cd as Me,ce as _e,h as Qe,a as ee,c as N,O as un,cf as dn,e as K,N as mn,cg as fn,ch as hn,ci as pn,b as Ce,aT as Ze,ac as gn,U as xn,aj as Ae,I as z,q as vn,d as se,cj as Je,ad as bn,ag as wn,ck as Oe,aX as yn,aq as In,W as ke,s as et,cl as Mn,P as Cn,S as Fe,cm as Sn,cn as Ln,_ as tt,bz as jn}from"./index-G7kdtXvB.js";import{A as Tn,N as Rn,T as Nn,S as Pn}from"./chunk-G7BT4OKG-D-wOOnsv.js";const Se=n=>{const e=_(8),{index:t,archived:s,children:o}=n;let i;e[0]!==s||e[1]!==t?(i=Vt({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=G(a);let u;return e[5]!==l||e[6]!==o?(u=r.jsx(Xt,{value:l,children:o}),e[5]=l,e[6]=o,e[7]=u):u=e[7],u},nt=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(Se,{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);nt.displayName="ThreadListPrimitive.ItemByIndex";const Be=({archived:n,children:e})=>{const t=P(s=>n?s.threads.archivedThreadIds.length:s.threads.threadIds.length);return He(()=>Array.from({length:t},(s,o)=>r.jsx(Se,{index:o,archived:n,children:r.jsx(Wt,{getItemState:i=>i.threads().item({index:o,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},o)),[t,n,e])},rt=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(Be,{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(Be,{archived:i,children:o}),e[5]=i,e[6]=o,e[7]=a):a=e[7],a};rt.displayName="ThreadListPrimitive.Items";const st=n=>{const e=_(2),{fallback:t}=n,s=P(En)||t;let o;return e[0]!==s?(o=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=o):o=e[1],o};st.displayName="ThreadListItemPrimitive.Title";function En(n){return n.threadListItem.title}const Dn=()=>{const n=_(4),e=G();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},_n=()=>{const n=_(4),e=G();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},An=()=>{const n=_(4),e=G();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},On=()=>{const n=_(4),e=G();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},kn=()=>{const n=_(4),e=G();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},Fn=()=>{const n=_(5),e=G(),t=P(Bn);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 Bn(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var Kn=Object.defineProperty,S=(n,e)=>Kn(n,"name",{value:e,configurable:!0}),$n=["Enter"," "],zn=["ArrowDown","PageUp","Home"],ot=["ArrowUp","PageDown","End"],Gn=[...zn,...ot],de="Menu",[ge,Hn,Un]=We(de),[q,at]=Ue(de,[Un,Ve,Xe]),Le=Ve(),it=Xe(),[Vn,ae]=q(de),[Xn,je]=q(de),Wn=S(n=>{const{__scopeMenu:e,open:t=!1,children:s,dir:o,onOpenChange:i,modal:a=!0}=n,l=Le(e),[u,c]=d.useState(null),m=d.useRef(!1),p=on(i),h=le(o);return d.useEffect(()=>{const f=S(()=>{m.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},"handleKeyDown"),x=S(()=>m.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.useEffect(()=>{if(!t)return;const f=S(()=>p(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[t,p]),r.jsx(an,{...l,children:r.jsx(Vn,{scope:e,open:t,onOpenChange:p,content:u,onContentChange:c,children:r.jsx(Xn,{scope:e,onClose:d.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:h,modal:a,children:s})})})},"Menu"),Yn=d.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e,i=Le(s);return r.jsx(cn,{...i,...o,ref:t})},"MenuAnchor")),ct="MenuPortal",[qn,Qn]=q(ct,{forceMount:void 0}),Zn=S(n=>{const{__scopeMenu:e,forceMount:t,children:s,container:o}=n,i=ae(ct,e);return r.jsx(qn,{scope:e,forceMount:t,children:r.jsx(Ye,{present:t||i.open,children:r.jsx(ln,{asChild:!0,container:o,children:s})})})},"MenuPortal"),W="MenuContent",[Jn,lt]=q(W),er=d.forwardRef(S(function(e,t){const s=Qn(W,e.__scopeMenu),{forceMount:o=s.forceMount,...i}=e,a=ae(W,e.__scopeMenu),l=je(W,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(tr,{...i,ref:t}):r.jsx(nr,{...i,ref:t})})})})},"MenuContent")),tr=d.forwardRef(S(function(e,t){const s=ae(W,e.__scopeMenu),o=d.useRef(null),i=Y(t,o);return d.useEffect(()=>{const a=o.current;if(a)return Yt(a)},[]),r.jsx(ut,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:s.open,disableOutsideScroll:!0,onFocusOutside:j(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentModal")),nr=d.forwardRef(S(function(e,t){const s=ae(W,e.__scopeMenu);return r.jsx(ut,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),rr=sn("MenuContent.ScrollLock"),ut=d.forwardRef(S(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:x,disableOutsideScroll:g,...b}=e,y=ae(W,s),M=je(W,s),L=Le(s),R=it(s),O=Hn(s),[F,A]=d.useState(null),E=d.useRef(null),I=Y(t,E,y.onContentChange),T=d.useRef(0),D=d.useRef(""),C=d.useRef(0),k=d.useRef(null),w=d.useRef("right"),Q=d.useRef(0),U=g?Qt:d.Fragment,V=g?{as:rr,allowPinchZoom:!0}:void 0,me=S(v=>{var J,Pe;const B=D.current+v,$=O().filter(H=>!H.disabled),X=document.activeElement,fe=(J=$.find(H=>H.ref.current===X))==null?void 0:J.textValue,he=$.map(H=>H.textValue),Ne=pt(he,B,fe),re=(Pe=$.find(H=>H.textValue===Ne))==null?void 0:Pe.ref.current;S((function H(Ee){D.current=Ee,window.clearTimeout(T.current),Ee!==""&&(T.current=window.setTimeout(()=>H(""),1e3))}),"updateSearch")(B),re&&setTimeout(()=>re.focus())},"handleTypeaheadSearch");d.useEffect(()=>()=>window.clearTimeout(T.current),[]),qt();const Z=d.useCallback(v=>{var $,X;return w.current===(($=k.current)==null?void 0:$.side)&&xt(v,(X=k.current)==null?void 0:X.area)},[]);return r.jsx(Jn,{scope:s,searchRef:D,onItemEnter:d.useCallback(v=>{Z(v)&&v.preventDefault()},[Z]),onItemLeave:d.useCallback(v=>{var B;Z(v)||((B=E.current)==null||B.focus(),A(null))},[Z]),onTriggerLeave:d.useCallback(v=>{Z(v)&&v.preventDefault()},[Z]),pointerGraceTimerRef:C,onPointerGraceIntentChange:d.useCallback(v=>{k.current=v},[]),children:r.jsx(U,{...V,children:r.jsx(Zt,{asChild:!0,trapped:i,onMountAutoFocus:j(a,v=>{var B;v.preventDefault(),(B=E.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(Jt,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:m,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:x,children:r.jsx(en,{asChild:!0,...R,dir:M.dir,orientation:"vertical",loop:o,currentTabStopId:F,onCurrentTabStopIdChange:A,onEntryFocus:j(c,v=>{M.isUsingKeyboardRef.current||v.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(tn,{role:"menu","aria-orientation":"vertical","data-state":dt(y.open),"data-radix-menu-content":"",dir:M.dir,...L,...b,ref:I,style:{outline:"none",...b.style},onKeyDown:j(b.onKeyDown,v=>{const $=v.target.closest("[data-radix-menu-content]")===v.currentTarget,X=v.ctrlKey||v.altKey||v.metaKey,fe=v.key.length===1;$&&(v.key==="Tab"&&v.preventDefault(),!X&&fe&&me(v.key));const he=E.current;if(v.target!==he||!Gn.includes(v.key))return;v.preventDefault();const re=O().filter(J=>!J.disabled).map(J=>J.ref.current);ot.includes(v.key)&&re.reverse(),ft(re)}),onBlur:j(e.onBlur,v=>{v.currentTarget.contains(v.target)||(window.clearTimeout(T.current),D.current="")}),onPointerMove:j(e.onPointerMove,ce(v=>{const B=v.target,$=Q.current!==v.clientX;if(v.currentTarget.contains(B)&&$){const X=v.clientX>Q.current?"right":"left";w.current=X,Q.current=v.clientX}}))})})})})})})},"MenuContentImpl")),xe="MenuItem",Ke="menu.itemSelect",sr=d.forwardRef(S(function(e,t){const{disabled:s=!1,onSelect:o,...i}=e,a=d.useRef(null),l=je(xe,e.__scopeMenu),u=lt(xe,e.__scopeMenu),c=Y(t,a),m=d.useRef(!1),p=S(()=>{const h=a.current;if(!s&&h){const f=new CustomEvent(Ke,{bubbles:!0,cancelable:!0});h.addEventListener(Ke,x=>o==null?void 0:o(x),{once:!0}),nn(h,f),f.defaultPrevented?m.current=!1:l.onClose()}},"handleSelect");return r.jsx(or,{...i,ref:c,disabled:s,onClick:j(e.onClick,p),onPointerDown:h=>{var f;(f=e.onPointerDown)==null||f.call(e,h),m.current=!0},onPointerUp:j(e.onPointerUp,h=>{var f;m.current||(f=h.currentTarget)==null||f.click()}),onKeyDown:j(e.onKeyDown,h=>{s||h.target!==h.currentTarget||u.searchRef.current!==""&&h.key===" "||$n.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),or=d.forwardRef(S(function(e,t){const{__scopeMenu:s,disabled:o=!1,textValue:i,...a}=e,l=lt(xe,s),u=it(s),c=d.useRef(null),m=Y(t,c),[p,h]=d.useState(!1),[f,x]=d.useState("");return d.useEffect(()=>{const g=c.current;g&&x((g.textContent??"").trim())},[a.children]),r.jsx(ge.ItemSlot,{scope:s,disabled:o,textValue:i??f,children:r.jsx(rn,{asChild:!0,...u,focusable:!o,children:r.jsx(be.div,{role:"menuitem","data-highlighted":p?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...a,ref:m,onPointerMove:j(e.onPointerMove,ce(g=>{o?l.onItemLeave(g):(l.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:j(e.onPointerLeave,ce(g=>l.onItemLeave(g))),onFocus:j(e.onFocus,()=>h(!0)),onBlur:j(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),ar="MenuRadioGroup",[ls,us]=q(ar,{value:void 0,onValueChange:S(()=>{},"onValueChange")}),ir="MenuItemIndicator",[ds,ms]=q(ir,{checked:!1}),cr=d.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e;return r.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})},"MenuSeparator")),lr="MenuSub",[fs,hs]=q(lr);function dt(n){return n?"open":"closed"}S(dt,"getOpenState");function mt(n){return n==="indeterminate"}S(mt,"isIndeterminate");function ur(n){return mt(n)?"indeterminate":n?"checked":"unchecked"}S(ur,"getCheckedState");function ft(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}S(ft,"focusFirst");function ht(n,e){return n.map((t,s)=>n[(e+s)%n.length])}S(ht,"wrapArray");function pt(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=ht(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}S(pt,"getNextMatch");function gt(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}S(gt,"isPointInPolygon");function xt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return gt(t,e)}S(xt,"isPointerInGraceArea");function ce(n){return e=>e.pointerType==="mouse"?n(e):void 0}S(ce,"whenMouse");var dr=Wn,mr=Yn,fr=Zn,hr=er,pr=sr,gr=cr,xr=Object.defineProperty,te=(n,e)=>xr(n,"name",{value:e,configurable:!0}),Te="DropdownMenu",[vr,vt]=Ue(Te,[at]),ne=at(),[br,bt]=vr(Te),wt=te(n=>{const{__scopeDropdownMenu:e,children:t,dir:s,open:o,defaultOpen:i,onOpenChange:a,modal:l=!0}=n,u=ne(e),c=d.useRef(null),[m,p]=qe({prop:o,defaultProp:i??!1,onChange:a,caller:Te});return r.jsx(br,{scope:e,triggerId:De(),triggerRef:c,contentId:De(),open:m,onOpenChange:p,onOpenToggle:d.useCallback(()=>p(h=>!h),[p]),modal:l,children:r.jsx(dr,{...u,open:m,onOpenChange:p,dir:s,modal:l,children:t})})},"DropdownMenu"),wr="DropdownMenuTrigger",yt=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,disabled:o=!1,...i}=e,a=bt(wr,s),l=ne(s),u=Y(t,a.triggerRef);return r.jsx(mr,{asChild:!0,...l,children:r.jsx(be.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:j(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(a.onOpenToggle(),a.open||c.preventDefault())}),onKeyDown:j(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&a.onOpenToggle(),c.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),It=te(n=>{const{__scopeDropdownMenu:e,...t}=n,s=ne(e);return r.jsx(fr,{...s,...t})},"DropdownMenuPortal"),yr="DropdownMenuContent",Mt=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=bt(yr,s),a=ne(s),l=d.useRef(!1);return r.jsx(hr,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...o,ref:t,onCloseAutoFocus:j(e.onCloseAutoFocus,u=>{var c;l.current||(c=i.triggerRef.current)==null||c.focus(),l.current=!1,u.preventDefault()}),onInteractOutside:j(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")),Ct=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=ne(s);return r.jsx(pr,{...i,...o,ref:t})},"DropdownMenuItem")),St=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=ne(s);return r.jsx(gr,{...i,...o,ref:t})},"DropdownMenuSeparator")),Lt=wt,jt=yt,Ir=It,Tt=Mt,Rt=Ct,Nt=St;const Mr=Object.freeze(Object.defineProperty({__proto__:null,Content:Tt,DropdownMenu:wt,DropdownMenuContent:Mt,DropdownMenuItem:Ct,DropdownMenuPortal:It,DropdownMenuSeparator:St,DropdownMenuTrigger:yt,Item:Rt,Portal:Ir,Root:Lt,Separator:Nt,Trigger:jt,createDropdownMenuScope:vt},Symbol.toStringTag,{value:"Module"})),Cr=ue(jt),Sr=ue(Tt),Lr=ue(Rt),jr=ue(Nt),Pt=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(Tr),{switchToNewThread:l}=kn();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=j(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(we.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});Pt.displayName="ThreadListPrimitive.New";function Tr(n){return n.threads.newThreadId===n.threads.mainThreadId}const Rr=()=>{const{loadMore:n,disabled:e}=Fn();return e?null:n},Nr=oe("ThreadListPrimitive.LoadMore",Rr),[Pr,Er]=We("ThreadList"),ve=Pr,Et=Ie(null),Dr=Et.Provider,Re=()=>ye(Et),Dt=d.forwardRef((n,e)=>{const t=_(3);let s;return t[0]!==n||t[1]!==e?(s=r.jsx(ve.Provider,{scope:void 0,children:r.jsx(ve.Slot,{scope:void 0,children:r.jsx(we.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=s):s=t[2],s});Dt.displayName="ThreadListPrimitive.Root";var _r=Me({ItemByIndex:()=>nt,Items:()=>rt,LoadMore:()=>Nr,New:()=>Pt,Root:()=>Dt});const _t=d.forwardRef((n,e)=>{const t=P(c=>c.threads.mainThreadId===c.threadListItem.id),s=_e(null),o=_e(null),i=He(()=>({triggerRef:s,moreRef:o}),[]),a=Er(void 0),l=le(),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 x=a().map(b=>b.ref.current).filter(b=>b!==null),g=x[x.indexOf(h)+(c.key==="ArrowDown"?1:-1)];g&&(g.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(Dr,{value:i,children:r.jsx(we.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:j(n.onKeyDown,u),ref:e})})});_t.displayName="ThreadListItemPrimitive.Root";const Ar=()=>{const{archive:n}=Dn();return n},Or=oe("ThreadListItemPrimitive.Archive",Ar),kr=()=>{const{unarchive:n}=An();return n},Fr=oe("ThreadListItemPrimitive.Unarchive",kr),Br=()=>{const{delete:n}=_n();return n},Kr=oe("ThreadListItemPrimitive.Delete",Br),$r=()=>{const{switchTo:n}=On();return n},zr=oe("ThreadListItemPrimitive.Trigger",$r),At=d.forwardRef((n,e)=>{var i;const t=_(3),s=Y(e,(i=Re())==null?void 0:i.triggerRef);let o;return t[0]!==n||t[1]!==s?(o=r.jsx(ve.ItemSlot,{scope:void 0,children:r.jsx(zr,{...n,ref:s})}),t[0]=n,t[1]=s,t[2]=o):o=t[2],o});At.displayName="ThreadListItemPrimitive.Trigger";var Ot=Me({Archive:()=>Or,Delete:()=>Kr,Root:()=>_t,Title:()=>st,Trigger:()=>At,Unarchive:()=>Fr});const ie=vt(),kt=Ie(()=>{}),Ft=()=>ye(kt),Bt=Ie(!1),Kt=()=>ye(Bt),$t=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=ie(t),h=s??!1;let f;e[8]!==i?(f=i?{onChange:i}:{},e[8]=i,e[9]=f):f=e[9];let x;e[10]!==a||e[11]!==h||e[12]!==f?(x={prop:a,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...f},e[10]=a,e[11]=h,e[12]=f,e[13]=x):x=e[13];const[g,b]=qe(x);let y;e[14]!==m||e[15]!==g||e[16]!==l||e[17]!==p||e[18]!==b?(y=r.jsx(Lt,{...p,...l,modal:m,open:g,onOpenChange:b}),e[14]=m,e[15]=g,e[16]=l,e[17]=p,e[18]=b,e[19]=y):y=e[19];let M;e[20]!==b||e[21]!==y?(M=r.jsx(kt.Provider,{value:b,children:y}),e[20]=b,e[21]=y,e[22]=M):M=e[22];let L;return e[23]!==c||e[24]!==M?(L=r.jsx(Bt.Provider,{value:c,children:M}),e[23]=c,e[24]=M,e[25]=L):L=e[25],L};$t.displayName="ThreadListItemMorePrimitive.Root";const zt=d.forwardRef((n,e)=>{const t=_(10),{__scopeThreadListItemMore:s,...o}=n,i=ie(s),a=Re(),l=Ft(),u=Kt(),c=Y(e,a==null?void 0:a.moreRef),m=le()==="rtl"?"ArrowLeft":"ArrowRight",p=Cr;let h;t[0]!==m||t[1]!==l||t[2]!==u?(h=g=>{!u||g.key!==m||(g.preventDefault(),l(!0))},t[0]=m,t[1]=l,t[2]=u,t[3]=h):h=t[3];const f=j(o.onKeyDown,h);let x;return t[4]!==p||t[5]!==c||t[6]!==o||t[7]!==i||t[8]!==f?(x=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]=x):x=t[9],x});zt.displayName="ThreadListItemMorePrimitive.Trigger";const Gt=d.forwardRef((n,e)=>{const t=_(21),{__scopeThreadListItemMore:s,portalProps:o,sideOffset:i,...a}=n,l=i===void 0?4:i,u=ie(s),c=Ft(),m=Re(),p=Kt(),h=le()==="rtl"?"ArrowRight":"ArrowLeft",f=Mr,x=Sr;let g;t[0]!==h||t[1]!==(m==null?void 0:m.moreRef)||t[2]!==c||t[3]!==p?(g=O=>{var F;!p||O.key!==h||(O.preventDefault(),c(!1),(F=m==null?void 0:m.moreRef.current)==null||F.focus())},t[0]=h,t[1]=m==null?void 0:m.moreRef,t[2]=c,t[3]=p,t[4]=g):g=t[4];const b=j(a.onKeyDown,g);let y;t[5]!==(m==null?void 0:m.moreRef)||t[6]!==p?(y=()=>{var O;p&&((O=m==null?void 0:m.moreRef.current)==null||O.focus())},t[5]=m==null?void 0:m.moreRef,t[6]=p,t[7]=y):y=t[7];const M=j(a.onEscapeKeyDown,y);let L;t[8]!==x||t[9]!==e||t[10]!==a||t[11]!==u||t[12]!==l||t[13]!==b||t[14]!==M?(L=r.jsx(x,{...u,...a,onKeyDown:b,onEscapeKeyDown:M,ref:e,sideOffset:l}),t[8]=x,t[9]=e,t[10]=a,t[11]=u,t[12]=l,t[13]=b,t[14]=M,t[15]=L):L=t[15];let R;return t[16]!==o||t[17]!==u||t[18]!==f.Portal||t[19]!==L?(R=r.jsx(f.Portal,{...u,...o,children:L}),t[16]=o,t[17]=u,t[18]=f.Portal,t[19]=L,t[20]=R):R=t[20],R});Gt.displayName="ThreadListItemMorePrimitive.Content";const Ht=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=ie(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Lr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Ht.displayName="ThreadListItemMorePrimitive.Item";const Ut=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=ie(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(jr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Ut.displayName="ThreadListItemMorePrimitive.Separator";var pe=Me({Content:()=>Gt,Item:()=>Ht,Root:()=>$t,Separator:()=>Ut,Trigger:()=>zt});function Gr(){const n=ee(),e=Qe(),t=Ce(),s=Ze(),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(),x=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,g=(n==null?void 0:n.historyAgentFilter)??null;d.useEffect(()=>{i||u("")},[i]);const{agents:b,isInitialLoading:y,isSearching:M,loadingMore:L,hasMore:R,listRef:O,sentinelRef:F}=gn({enabled:i&&x,query:l});if(d.useLayoutEffect(()=>{if(!i||o){m(null);return}const I=()=>{var D;const T=(D=p.current)==null?void 0:D.getBoundingClientRect();T&&m({top:T.top,left:T.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=T=>{var C,k;const D=T.target;(C=p.current)!=null&&C.contains(D)||(k=h.current)!=null&&k.contains(D)||a(!1)};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[i,o]),!x)return null;const A=I=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(I),a(!1)},E=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-1",onMouseDown:I=>I.stopPropagation(),children:[r.jsx(xn,{query:l,setQuery:u,placeholder:"Search agents"}),M?r.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),r.jsxs("div",{ref:O,className:K("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(Ae,{className:K("justify-between",g==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>A(null),children:["All chats",g==null?r.jsx(z,{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…"}):b.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:[b.map(I=>{const T=vn(I),D=(g==null?void 0:g.agentId)===T;return r.jsxs(Ae,{className:K("justify-between gap-2 text-left",D&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>A({agentId:T,agentName:I.name,intent:"history"}),children:[r.jsx("span",{className:"min-w-0 truncate",children:I.name}),D?r.jsx(z,{name:"check",className:"size-3.5 shrink-0"}):null]},T)}),R?r.jsx("div",{ref:F,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":g!=null?`Filter chat history by agent (${g.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:se({variant:"ghost",size:"icon",className:K("relative size-7 shrink-0 text-text-secondary hover:bg-ghost-button-hover hover:text-ghost-button-text",g!=null&&"text-text-primary")}),onClick:()=>a(I=>!I),children:[r.jsx(z,{name:"funnel",className:"size-3.5"}),g!=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:E})}):null,!o&&i&&c!=null?bn.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:E}),wn(p.current)):null]})}function Hr({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<=Oe&&!t,p=()=>{m&&o(u)},h=f=>{t||s(f)};return r.jsx(yn,{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(ke.Secondary,{type:"button",disabled:t,onClick:()=>h(!1),children:"Cancel"}),r.jsx(ke.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:Oe,className:In("h-9"),onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),p())}})})})}var Ur="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",Vr="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 Xr({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:s,onRename:o}){const i=N("PermissionGuard"),a=Ze(),l=Ce(),[u,c]=d.useState(!1),[m,p]=d.useState(),h=l||a,f=d.useCallback(y=>{const M=y==null?void 0:y.closest(".aui-theme-root");p(M instanceof HTMLElement?M:void 0)},[]),x=se({variant:"ghost",size:"icon",className:"size-7 shrink-0 text-text-secondary hover:bg-transparent hover:text-text-primary"}),g=n?r.jsx(i,{allowed:!e,children:r.jsxs("button",{type:"button",className:Ur,disabled:e,onClick:()=>{e||(c(!1),o())},children:[r.jsx(z,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,b=t?r.jsx(i,{allowed:!s,children:r.jsxs(Ot.Delete,{className:Vr,onClick:()=>{s||c(!1)},children:[r.jsx(z,{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:x,onClick:()=>c(!0),children:r.jsx(z,{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:[g,b]})}):null]}):r.jsxs(pe.Root,{sharedFocusGroup:!0,children:[r.jsx(pe.Trigger,{ref:f,"aria-label":"Session actions",title:"Session actions",className:x,children:r.jsx(z,{name:"ellipsis",className:"size-3.5"})}),r.jsxs(pe.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:[g,b]})]})}function Wr({onThreadOpen:n,canRenameSession:e,canDeleteSession:t,canManageResource:s,canDeleteResource:o}){const i=G(),a=ee(),l=mn(),u=N("ThreadListRow"),c=P(C=>C.threadListItem.id),m=P(C=>C.threadListItem.remoteId),p=P(C=>C.threadListItem.title),h=P(C=>C.threadListItem.lastMessageAt),f=P(C=>C.threadListItem.custom),x=P(C=>C.threads.mainThreadId),g=fn(f),b=e&&m!=null,y=t&&m!=null,M=b||y,L=m!=null&&!s(m),R=m!=null&&!o(m),O=(a==null?void 0:a.libraryOpen)===!0||(a==null?void 0:a.sessionsOpen)===!0||(a==null?void 0:a.schedulesOpen)===!0,[F,A]=d.useState(!1),[E,I]=d.useState(!1),T=p??"New Chat",D=async C=>{if(C===(p??"").trim()){A(!1);return}I(!0);try{await i.threadListItem().rename(C),A(!1)}catch(k){l==null||l.showError(k)}finally{I(!1)}};return r.jsxs(Ot.Root,{className:"min-w-0",children:[r.jsx(u,{title:T,active:c===x&&!O,agentName:g,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);const C=hn(f),k=!C&&(a==null?void 0:a.mode.status)==="active"&&!a.mode.isMutable&&(g==null?a.mode.agentName==null&&a.mode.agentId==null:a.mode.agentName===g||a.mode.agentId===g),w=pn({sessionMutable:C,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((k||w)&&m!=null){Promise.resolve(i.threads().switchToThread(c)).catch(()=>{});return}if(m!=null){a==null||a.openHistorySession({sessionId:m,isMutable:C,...g!=null?{agentName:g}:{}});return}Promise.resolve(i.threads().switchToThread(c)).catch(()=>{})},actions:M?r.jsx(Xr,{canRename:b,renameDisabled:L,canDelete:y,deleteDisabled:R,onRename:()=>A(!0)}):void 0}),r.jsx(Hr,{open:F,initialTitle:p??"",saving:E,onOpenChange:A,onSave:C=>{D(C)}})]})}function Yr(n){const e=P(s=>s.threads.threadIds),t=P(s=>s.threads.threadItems);return d.useMemo(()=>{const s=dn({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 qr({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(Se,{index:l,archived:!1,children:r.jsx(Wr,{onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i})},u)})})}var Qr="aui_thread-list-viewport",Zr=80;function Jr({children:n,viewportRef:e,hideScrollbar:t}){var u;const s=ee(),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(Gr,{}):null]}),r.jsx("div",{ref:e,"data-slot":Qr,className:K("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function es({onThreadOpen:n,variant:e="default"}={}){const t=G(),s=Qe(),o=P(w=>w.threads.isLoading),i=P(w=>w.threads.isLoadingMore),a=P(w=>w.threads.hasMore),l=P(w=>w.threads.threadIds),u=P(w=>w.threads.threadItems),c=ee(),m=N("ThreadListShell"),p=N("ThreadListNewButton"),h=N("AgentsLibraryButton"),f=N("SessionsBrowserButton"),x=N("SchedulesButton"),g=N("ThreadListRowSkeleton"),b=N("ThreadListEmptyState"),y=Yr(e),M=d.useRef(null),L=d.useRef(a),R=d.useRef(t);L.current=a,R.current=t;const O=(c==null?void 0:c.isNewChatEnabled)!==!1,F=(c==null?void 0:c.mode.status)==="idle",A=e==="recent-history",E=typeof(s==null?void 0:s.renameSession)=="function",I=typeof(s==null?void 0:s.deleteSession)=="function",T=d.useMemo(()=>u.flatMap(w=>w.remoteId==null?[]:[w.remoteId]),[u]),{allows:D}=un({resourceType:"session",resourceIds:T});d.useEffect(()=>{if(F||o||i)return;const w=M.current;if(!w)return;let Q=!1;const U=()=>{if(Q||!L.current||w.clientHeight<=0)return;const me=w.scrollHeight-w.scrollTop-w.clientHeight;w.scrollHeight>w.clientHeight&&me>Zr||R.current.threads().loadMore()};w.addEventListener("scroll",U,{passive:!0});const V=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>U());return V?V.observe(w):window.addEventListener("resize",U),U(),()=>{Q=!0,w.removeEventListener("scroll",U),V==null||V.disconnect(),V||window.removeEventListener("resize",U)}},[a,F,o,i,l.length]);const C=()=>{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),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let k;return F?k=r.jsx(b,{message:A?"No recent chats":void 0}):o?k=r.jsx(g,{}):y.length===0?k=r.jsx(b,{message:A?"No recent chats":void 0}):k=r.jsx(_r.Root,{className:"flex min-h-0 flex-col gap-0.5",children:r.jsx(qr,{indices:y,onThreadOpen:n,canRenameSession:E,canDeleteSession:I,canManageResource:w=>D(w,"MANAGE"),canDeleteResource:w=>D(w,"DELETE")})}),r.jsx(m,{header:A?null:r.jsxs("div",{className:"flex flex-col gap-1",children:[O?r.jsx(p,{onClick:C}):null,r.jsx(h,{}),r.jsx(f,{}),r.jsx(x,{})]}),children:r.jsxs(Jr,{viewportRef:M,hideScrollbar:A,children:[k,!F&&a?r.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var ts=d.lazy(()=>tt(()=>import("./SettingsBuilder-G5CP5X6Q-XQVNLXzw.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ns=d.lazy(()=>tt(()=>import("./SchedulesPage-TIS3BH67-CoDDvRbI.js"),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),rs="h-5 w-5 max-w-40 shrink-0 object-contain",ss="w-20",$e=K(jn,"text-sidebar-text"),ze="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function os({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function as(){var h;const n=G(),e=ee(),t=N("AgentsLibraryButton"),s=N("SessionsBrowserButton"),o=N("SchedulesButton"),i=(e==null?void 0:e.isNewChatEnabled)!==!1,a=(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,l=e==null?void 0:e.mode,u=!a&&(l==null?void 0:l.status)==="active"&&!l.isCreateAgent&&((h=e==null?void 0:e.historyAgentFilter)==null?void 0:h.intent)!=="try-agent",c=!a&&l!=null&&et(l),m=()=>{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),Promise.resolve(n.threads().switchToNewThread()).catch(()=>{})},p=()=>{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:[i?r.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":u?"page":void 0,className:se({variant:"ghost",className:K($e,u&&ze)}),onClick:m,children:[r.jsx(z,{name:"square-pen",size:14}),r.jsx("span",{className:"text-center",children:"New Chat"})]}):null,i&&(e!=null&&e.isComposerEnabled)?r.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":c?"page":void 0,className:se({variant:"ghost",className:K($e,c&&ze)}),onClick:p,children:[r.jsx(z,{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})]})}function Ge({onNavigate:n,className:e,railRef:t,...s}){const o=Sn(),i=Ln(o),a=N("BrandLogo"),l=N("UserAvatar");return r.jsxs("aside",{ref:t,className:K(ss,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",e),onClick:u=>{if(n==null)return;const c=u.target;c instanceof Element&&c.closest("button")!=null&&n()},...s,children:[r.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:r.jsx(a,{variant:i.collapsedVariant,className:rs})}),r.jsx(as,{}),r.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[r.jsx(Pn,{labeled:!0,className:"flex-col"}),r.jsx(l,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function ps({className:n}){const e=ee(),t=Ce(),s=N("AgentDetailsPage"),o=N("AgentsLibrary"),i=N("SessionsPage"),a=N("ClearChatButton"),l=N("SaveAgentButton"),u=N("SelectAgentEmptyState"),[c,m]=d.useState(!1),p=d.useRef(null),h=d.useRef(null),f=d.useRef(null),x=d.useRef(!1),g=(e==null?void 0:e.mode.status)==="idle",b=(e==null?void 0:e.settingsOpen)===!0,y=(e==null?void 0:e.libraryOpen)===!0,M=(e==null?void 0:e.sessionsOpen)===!0,L=(e==null?void 0:e.schedulesOpen)===!0,R=b||y||M||L,O=e!=null&&et(e.mode)&&!R&&(!t||e.agentConfigOpen),F=os({overlayOpen:R,mode:e==null?void 0:e.mode}),A=Mn();return d.useEffect(()=>{if(!c)return;const E=I=>{I.key==="Escape"&&m(!1)};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[c]),d.useEffect(()=>{var I,T;const E=f.current;if(c){x.current=!0,E&&(E.inert=!0),(I=h.current)==null||I.focus();return}x.current&&(E&&(E.inert=!1),(T=p.current)==null||T.focus(),x.current=!1)},[c]),r.jsxs("div",{className:K("relative flex h-full min-h-0 w-full min-w-0",n),children:[r.jsx(Ge,{className:"hidden md:flex"}),O?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(Tn,{showClose:t})}):null,r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[r.jsx(Cn,{className:K("bg-topbar-bg",(R||g||!A)&&"md:hidden"),start:R?null:r.jsx("button",{ref:p,type:"button","aria-label":"Navigation","aria-expanded":c,className:K(se({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>m(!0),children:r.jsx(z,{name:"bars"})}),title:R?null:r.jsx(Rn,{}),end:R?null:r.jsxs(r.Fragment,{children:[r.jsx(a,{}),r.jsx(l,{})]})}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[F?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(es,{variant:"recent-history"})}):null,r.jsx("div",{ref:f,className:"min-h-0 min-w-0 flex-1",children: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(Fe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ts,{})}):M?r.jsx(i,{}):y&&(e==null?void 0:e.libraryAgentId)!=null?r.jsx(s,{agentId:e.libraryAgentId},e.libraryAgentId):y?r.jsx(o,{onSelectAgent:()=>m(!1)}):L?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(Fe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ns,{})}):g?r.jsx(u,{}):r.jsx(Nn,{})})]})]}),c?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close navigation",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:()=>m(!1)}),r.jsx(Ge,{railRef:h,role:"dialog","aria-label":"Navigation",tabIndex:-1,onNavigate:()=>m(!1),className:"absolute inset-y-0 left-0 z-10 shadow-lg outline-none md:hidden"})]}):null]})}export{ps as SidebarLayout};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-RGEYBYPN-Bij2RoEA.js","./index-v37J5fNr.js","./index-B01pXqvC.css","./SchedulesPage-SIJSKRWV-ULgYoypo.js"])))=>i.map(i=>d[i]);
2
+ import{bF as D,bG as Vt,u as G,j as r,bH as Wt,r as d,a$ as E,bI as He,bJ as Xt,bK as Ue,bL as Ve,bM as We,bN as Xe,bO as Ye,bP as Y,bQ as Yt,bR as T,bS as qt,bT as Qt,bU as Zt,bV as Jt,bW as en,bX as tn,bY as nn,bZ as rn,b_ as be,b$ as sn,c0 as on,c1 as le,c2 as an,c3 as cn,c4 as ln,c5 as qe,c6 as De,c7 as ue,c8 as we,c9 as oe,ca as ye,cb as Ie,cc as Me,cd as _e,k as Qe,b as ee,d as N,Q as un,ce as dn,g as $,q as mn,cf as fn,cg as hn,ch as pn,c as Ce,aQ as Ze,ci as xn,W as gn,ag as Ae,I as z,x as vn,f as se,cj as Je,ck as bn,cl as wn,cm as Oe,aU as yn,an as In,Z as ke,s as et,cn as Mn,P as Cn,S as Fe,co as Sn,cp as Ln,_ as tt,bx as jn}from"./index-v37J5fNr.js";import{A as Tn,N as Rn,T as Pn,S as Nn}from"./chunk-WOPPIMOW-Bxo8Tkcc.js";const Se=n=>{const e=D(8),{index:t,archived:s,children:o}=n;let i;e[0]!==s||e[1]!==t?(i=Vt({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=G(a);let u;return e[5]!==l||e[6]!==o?(u=r.jsx(Wt,{value:l,children:o}),e[5]=l,e[6]=o,e[7]=u):u=e[7],u},nt=d.memo(n=>{const e=D(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(Se,{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);nt.displayName="ThreadListPrimitive.ItemByIndex";const Be=({archived:n,children:e})=>{const t=E(s=>n?s.threads.archivedThreadIds.length:s.threads.threadIds.length);return He(()=>Array.from({length:t},(s,o)=>r.jsx(Se,{index:o,archived:n,children:r.jsx(Xt,{getItemState:i=>i.threads().item({index:o,archived:n}).getState(),children:i=>e({get threadListItem(){return i()}})})},o)),[t,n,e])},rt=n=>{const e=D(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(Be,{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(Be,{archived:i,children:o}),e[5]=i,e[6]=o,e[7]=a):a=e[7],a};rt.displayName="ThreadListPrimitive.Items";const st=n=>{const e=D(2),{fallback:t}=n,s=E(En)||t;let o;return e[0]!==s?(o=r.jsx(r.Fragment,{children:s}),e[0]=s,e[1]=o):o=e[1],o};st.displayName="ThreadListItemPrimitive.Title";function En(n){return n.threadListItem.title}const Dn=()=>{const n=D(4),e=G();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},_n=()=>{const n=D(4),e=G();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},An=()=>{const n=D(4),e=G();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},On=()=>{const n=D(4),e=G();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},kn=()=>{const n=D(4),e=G();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},Fn=()=>{const n=D(5),e=G(),t=E(Bn);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 Bn(n){return!n.threads.hasMore||n.threads.isLoading||n.threads.isLoadingMore}var $n=Object.defineProperty,S=(n,e)=>$n(n,"name",{value:e,configurable:!0}),Kn=["Enter"," "],zn=["ArrowDown","PageUp","Home"],ot=["ArrowUp","PageDown","End"],Gn=[...zn,...ot],de="Menu",[xe,Hn,Un]=Xe(de),[q,at]=Ue(de,[Un,Ve,We]),Le=Ve(),it=We(),[Vn,ae]=q(de),[Wn,je]=q(de),Xn=S(n=>{const{__scopeMenu:e,open:t=!1,children:s,dir:o,onOpenChange:i,modal:a=!0}=n,l=Le(e),[u,c]=d.useState(null),m=d.useRef(!1),p=on(i),h=le(o);return d.useEffect(()=>{const f=S(()=>{m.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},"handleKeyDown"),g=S(()=>m.current=!1,"handlePointer");return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),d.useEffect(()=>{if(!t)return;const f=S(()=>p(!1),"handleBlur");return window.addEventListener("blur",f),()=>window.removeEventListener("blur",f)},[t,p]),r.jsx(an,{...l,children:r.jsx(Vn,{scope:e,open:t,onOpenChange:p,content:u,onContentChange:c,children:r.jsx(Wn,{scope:e,onClose:d.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:m,dir:h,modal:a,children:s})})})},"Menu"),Yn=d.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e,i=Le(s);return r.jsx(cn,{...i,...o,ref:t})},"MenuAnchor")),ct="MenuPortal",[qn,Qn]=q(ct,{forceMount:void 0}),Zn=S(n=>{const{__scopeMenu:e,forceMount:t,children:s,container:o}=n,i=ae(ct,e);return r.jsx(qn,{scope:e,forceMount:t,children:r.jsx(Ye,{present:t||i.open,children:r.jsx(ln,{asChild:!0,container:o,children:s})})})},"MenuPortal"),X="MenuContent",[Jn,lt]=q(X),er=d.forwardRef(S(function(e,t){const s=Qn(X,e.__scopeMenu),{forceMount:o=s.forceMount,...i}=e,a=ae(X,e.__scopeMenu),l=je(X,e.__scopeMenu);return r.jsx(xe.Provider,{scope:e.__scopeMenu,children:r.jsx(Ye,{present:o||a.open,children:r.jsx(xe.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(tr,{...i,ref:t}):r.jsx(nr,{...i,ref:t})})})})},"MenuContent")),tr=d.forwardRef(S(function(e,t){const s=ae(X,e.__scopeMenu),o=d.useRef(null),i=Y(t,o);return d.useEffect(()=>{const a=o.current;if(a)return Yt(a)},[]),r.jsx(ut,{...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")),nr=d.forwardRef(S(function(e,t){const s=ae(X,e.__scopeMenu);return r.jsx(ut,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>s.onOpenChange(!1)})},"MenuRootContentNonModal")),rr=sn("MenuContent.ScrollLock"),ut=d.forwardRef(S(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:g,disableOutsideScroll:x,...b}=e,I=ae(X,s),M=je(X,s),L=Le(s),A=it(s),R=Hn(s),[k,_]=d.useState(null),F=d.useRef(null),w=Y(t,F,I.onContentChange),j=d.useRef(0),P=d.useRef(""),C=d.useRef(0),O=d.useRef(null),y=d.useRef("right"),Q=d.useRef(0),U=x?Qt:d.Fragment,V=x?{as:rr,allowPinchZoom:!0}:void 0,me=S(v=>{var J,Ne;const B=P.current+v,K=R().filter(H=>!H.disabled),W=document.activeElement,fe=(J=K.find(H=>H.ref.current===W))==null?void 0:J.textValue,he=K.map(H=>H.textValue),Pe=pt(he,B,fe),re=(Ne=K.find(H=>H.textValue===Pe))==null?void 0:Ne.ref.current;S((function H(Ee){P.current=Ee,window.clearTimeout(j.current),Ee!==""&&(j.current=window.setTimeout(()=>H(""),1e3))}),"updateSearch")(B),re&&setTimeout(()=>re.focus())},"handleTypeaheadSearch");d.useEffect(()=>()=>window.clearTimeout(j.current),[]),qt();const Z=d.useCallback(v=>{var K,W;return y.current===((K=O.current)==null?void 0:K.side)&&gt(v,(W=O.current)==null?void 0:W.area)},[]);return r.jsx(Jn,{scope:s,searchRef:P,onItemEnter:d.useCallback(v=>{Z(v)&&v.preventDefault()},[Z]),onItemLeave:d.useCallback(v=>{var B;Z(v)||((B=F.current)==null||B.focus(),_(null))},[Z]),onTriggerLeave:d.useCallback(v=>{Z(v)&&v.preventDefault()},[Z]),pointerGraceTimerRef:C,onPointerGraceIntentChange:d.useCallback(v=>{O.current=v},[]),children:r.jsx(U,{...V,children:r.jsx(Zt,{asChild:!0,trapped:i,onMountAutoFocus:T(a,v=>{var B;v.preventDefault(),(B=F.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(Jt,{asChild:!0,disableOutsidePointerEvents:u,onEscapeKeyDown:m,onPointerDownOutside:p,onFocusOutside:h,onInteractOutside:f,onDismiss:g,children:r.jsx(en,{asChild:!0,...A,dir:M.dir,orientation:"vertical",loop:o,currentTabStopId:k,onCurrentTabStopIdChange:_,onEntryFocus:T(c,v=>{M.isUsingKeyboardRef.current||v.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(tn,{role:"menu","aria-orientation":"vertical","data-state":dt(I.open),"data-radix-menu-content":"",dir:M.dir,...L,...b,ref:w,style:{outline:"none",...b.style},onKeyDown:T(b.onKeyDown,v=>{const K=v.target.closest("[data-radix-menu-content]")===v.currentTarget,W=v.ctrlKey||v.altKey||v.metaKey,fe=v.key.length===1;K&&(v.key==="Tab"&&v.preventDefault(),!W&&fe&&me(v.key));const he=F.current;if(v.target!==he||!Gn.includes(v.key))return;v.preventDefault();const re=R().filter(J=>!J.disabled).map(J=>J.ref.current);ot.includes(v.key)&&re.reverse(),ft(re)}),onBlur:T(e.onBlur,v=>{v.currentTarget.contains(v.target)||(window.clearTimeout(j.current),P.current="")}),onPointerMove:T(e.onPointerMove,ce(v=>{const B=v.target,K=Q.current!==v.clientX;if(v.currentTarget.contains(B)&&K){const W=v.clientX>Q.current?"right":"left";y.current=W,Q.current=v.clientX}}))})})})})})})},"MenuContentImpl")),ge="MenuItem",$e="menu.itemSelect",sr=d.forwardRef(S(function(e,t){const{disabled:s=!1,onSelect:o,...i}=e,a=d.useRef(null),l=je(ge,e.__scopeMenu),u=lt(ge,e.__scopeMenu),c=Y(t,a),m=d.useRef(!1),p=S(()=>{const h=a.current;if(!s&&h){const f=new CustomEvent($e,{bubbles:!0,cancelable:!0});h.addEventListener($e,g=>o==null?void 0:o(g),{once:!0}),nn(h,f),f.defaultPrevented?m.current=!1:l.onClose()}},"handleSelect");return r.jsx(or,{...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===" "||Kn.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})},"MenuItem")),or=d.forwardRef(S(function(e,t){const{__scopeMenu:s,disabled:o=!1,textValue:i,...a}=e,l=lt(ge,s),u=it(s),c=d.useRef(null),m=Y(t,c),[p,h]=d.useState(!1),[f,g]=d.useState("");return d.useEffect(()=>{const x=c.current;x&&g((x.textContent??"").trim())},[a.children]),r.jsx(xe.ItemSlot,{scope:s,disabled:o,textValue:i??f,children:r.jsx(rn,{asChild:!0,...u,focusable:!o,children:r.jsx(be.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,ce(x=>{o?l.onItemLeave(x):(l.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:T(e.onPointerLeave,ce(x=>l.onItemLeave(x))),onFocus:T(e.onFocus,()=>h(!0)),onBlur:T(e.onBlur,()=>h(!1))})})})},"MenuItemImpl")),ar="MenuRadioGroup",[ls,us]=q(ar,{value:void 0,onValueChange:S(()=>{},"onValueChange")}),ir="MenuItemIndicator",[ds,ms]=q(ir,{checked:!1}),cr=d.forwardRef(S(function(e,t){const{__scopeMenu:s,...o}=e;return r.jsx(be.div,{role:"separator","aria-orientation":"horizontal",...o,ref:t})},"MenuSeparator")),lr="MenuSub",[fs,hs]=q(lr);function dt(n){return n?"open":"closed"}S(dt,"getOpenState");function mt(n){return n==="indeterminate"}S(mt,"isIndeterminate");function ur(n){return mt(n)?"indeterminate":n?"checked":"unchecked"}S(ur,"getCheckedState");function ft(n){const e=document.activeElement;for(const t of n)if(t===e||(t.focus(),document.activeElement!==e))return}S(ft,"focusFirst");function ht(n,e){return n.map((t,s)=>n[(e+s)%n.length])}S(ht,"wrapArray");function pt(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=ht(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}S(pt,"getNextMatch");function xt(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}S(xt,"isPointInPolygon");function gt(n,e){if(!e)return!1;const t={x:n.clientX,y:n.clientY};return xt(t,e)}S(gt,"isPointerInGraceArea");function ce(n){return e=>e.pointerType==="mouse"?n(e):void 0}S(ce,"whenMouse");var dr=Xn,mr=Yn,fr=Zn,hr=er,pr=sr,xr=cr,gr=Object.defineProperty,te=(n,e)=>gr(n,"name",{value:e,configurable:!0}),Te="DropdownMenu",[vr,vt]=Ue(Te,[at]),ne=at(),[br,bt]=vr(Te),wt=te(n=>{const{__scopeDropdownMenu:e,children:t,dir:s,open:o,defaultOpen:i,onOpenChange:a,modal:l=!0}=n,u=ne(e),c=d.useRef(null),[m,p]=qe({prop:o,defaultProp:i??!1,onChange:a,caller:Te});return r.jsx(br,{scope:e,triggerId:De(),triggerRef:c,contentId:De(),open:m,onOpenChange:p,onOpenToggle:d.useCallback(()=>p(h=>!h),[p]),modal:l,children:r.jsx(dr,{...u,open:m,onOpenChange:p,dir:s,modal:l,children:t})})},"DropdownMenu"),wr="DropdownMenuTrigger",yt=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,disabled:o=!1,...i}=e,a=bt(wr,s),l=ne(s),u=Y(t,a.triggerRef);return r.jsx(mr,{asChild:!0,...l,children:r.jsx(be.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")),It=te(n=>{const{__scopeDropdownMenu:e,...t}=n,s=ne(e);return r.jsx(fr,{...s,...t})},"DropdownMenuPortal"),yr="DropdownMenuContent",Mt=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=bt(yr,s),a=ne(s),l=d.useRef(!1);return r.jsx(hr,{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")),Ct=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=ne(s);return r.jsx(pr,{...i,...o,ref:t})},"DropdownMenuItem")),St=d.forwardRef(te(function(e,t){const{__scopeDropdownMenu:s,...o}=e,i=ne(s);return r.jsx(xr,{...i,...o,ref:t})},"DropdownMenuSeparator")),Lt=wt,jt=yt,Ir=It,Tt=Mt,Rt=Ct,Pt=St;const Mr=Object.freeze(Object.defineProperty({__proto__:null,Content:Tt,DropdownMenu:wt,DropdownMenuContent:Mt,DropdownMenuItem:Ct,DropdownMenuPortal:It,DropdownMenuSeparator:St,DropdownMenuTrigger:yt,Item:Rt,Portal:Ir,Root:Lt,Separator:Pt,Trigger:jt,createDropdownMenuScope:vt},Symbol.toStringTag,{value:"Module"})),Cr=ue(jt),Sr=ue(Tt),Lr=ue(Rt),jr=ue(Pt),Nt=d.forwardRef((n,e)=>{const t=D(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=E(Tr),{switchToNewThread:l}=kn();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(we.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});Nt.displayName="ThreadListPrimitive.New";function Tr(n){return n.threads.newThreadId===n.threads.mainThreadId}const Rr=()=>{const{loadMore:n,disabled:e}=Fn();return e?null:n},Pr=oe("ThreadListPrimitive.LoadMore",Rr),[Nr,Er]=Xe("ThreadList"),ve=Nr,Et=Ie(null),Dr=Et.Provider,Re=()=>ye(Et),Dt=d.forwardRef((n,e)=>{const t=D(3);let s;return t[0]!==n||t[1]!==e?(s=r.jsx(ve.Provider,{scope:void 0,children:r.jsx(ve.Slot,{scope:void 0,children:r.jsx(we.div,{...n,ref:e})})}),t[0]=n,t[1]=e,t[2]=s):s=t[2],s});Dt.displayName="ThreadListPrimitive.Root";var _r=Me({ItemByIndex:()=>nt,Items:()=>rt,LoadMore:()=>Pr,New:()=>Nt,Root:()=>Dt});const _t=d.forwardRef((n,e)=>{const t=E(c=>c.threads.mainThreadId===c.threadListItem.id),s=_e(null),o=_e(null),i=He(()=>({triggerRef:s,moreRef:o}),[]),a=Er(void 0),l=le(),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 g=a().map(b=>b.ref.current).filter(b=>b!==null),x=g[g.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(Dr,{value:i,children:r.jsx(we.div,{...t?{"data-active":"true","aria-current":"true"}:null,...n,onKeyDown:T(n.onKeyDown,u),ref:e})})});_t.displayName="ThreadListItemPrimitive.Root";const Ar=()=>{const{archive:n}=Dn();return n},Or=oe("ThreadListItemPrimitive.Archive",Ar),kr=()=>{const{unarchive:n}=An();return n},Fr=oe("ThreadListItemPrimitive.Unarchive",kr),Br=()=>{const{delete:n}=_n();return n},$r=oe("ThreadListItemPrimitive.Delete",Br),Kr=()=>{const{switchTo:n}=On();return n},zr=oe("ThreadListItemPrimitive.Trigger",Kr),At=d.forwardRef((n,e)=>{var i;const t=D(3),s=Y(e,(i=Re())==null?void 0:i.triggerRef);let o;return t[0]!==n||t[1]!==s?(o=r.jsx(ve.ItemSlot,{scope:void 0,children:r.jsx(zr,{...n,ref:s})}),t[0]=n,t[1]=s,t[2]=o):o=t[2],o});At.displayName="ThreadListItemPrimitive.Trigger";var Ot=Me({Archive:()=>Or,Delete:()=>$r,Root:()=>_t,Title:()=>st,Trigger:()=>At,Unarchive:()=>Fr});const ie=vt(),kt=Ie(()=>{}),Ft=()=>ye(kt),Bt=Ie(!1),$t=()=>ye(Bt),Kt=n=>{const e=D(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=ie(t),h=s??!1;let f;e[8]!==i?(f=i?{onChange:i}:{},e[8]=i,e[9]=f):f=e[9];let g;e[10]!==a||e[11]!==h||e[12]!==f?(g={prop:a,defaultProp:h,caller:"ThreadListItemMorePrimitive.Root",...f},e[10]=a,e[11]=h,e[12]=f,e[13]=g):g=e[13];const[x,b]=qe(g);let I;e[14]!==m||e[15]!==x||e[16]!==l||e[17]!==p||e[18]!==b?(I=r.jsx(Lt,{...p,...l,modal:m,open:x,onOpenChange:b}),e[14]=m,e[15]=x,e[16]=l,e[17]=p,e[18]=b,e[19]=I):I=e[19];let M;e[20]!==b||e[21]!==I?(M=r.jsx(kt.Provider,{value:b,children:I}),e[20]=b,e[21]=I,e[22]=M):M=e[22];let L;return e[23]!==c||e[24]!==M?(L=r.jsx(Bt.Provider,{value:c,children:M}),e[23]=c,e[24]=M,e[25]=L):L=e[25],L};Kt.displayName="ThreadListItemMorePrimitive.Root";const zt=d.forwardRef((n,e)=>{const t=D(10),{__scopeThreadListItemMore:s,...o}=n,i=ie(s),a=Re(),l=Ft(),u=$t(),c=Y(e,a==null?void 0:a.moreRef),m=le()==="rtl"?"ArrowLeft":"ArrowRight",p=Cr;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 g;return t[4]!==p||t[5]!==c||t[6]!==o||t[7]!==i||t[8]!==f?(g=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]=g):g=t[9],g});zt.displayName="ThreadListItemMorePrimitive.Trigger";const Gt=d.forwardRef((n,e)=>{const t=D(21),{__scopeThreadListItemMore:s,portalProps:o,sideOffset:i,...a}=n,l=i===void 0?4:i,u=ie(s),c=Ft(),m=Re(),p=$t(),h=le()==="rtl"?"ArrowRight":"ArrowLeft",f=Mr,g=Sr;let x;t[0]!==h||t[1]!==(m==null?void 0:m.moreRef)||t[2]!==c||t[3]!==p?(x=R=>{var k;!p||R.key!==h||(R.preventDefault(),c(!1),(k=m==null?void 0:m.moreRef.current)==null||k.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 b=T(a.onKeyDown,x);let I;t[5]!==(m==null?void 0:m.moreRef)||t[6]!==p?(I=()=>{var R;p&&((R=m==null?void 0:m.moreRef.current)==null||R.focus())},t[5]=m==null?void 0:m.moreRef,t[6]=p,t[7]=I):I=t[7];const M=T(a.onEscapeKeyDown,I);let L;t[8]!==g||t[9]!==e||t[10]!==a||t[11]!==u||t[12]!==l||t[13]!==b||t[14]!==M?(L=r.jsx(g,{...u,...a,onKeyDown:b,onEscapeKeyDown:M,ref:e,sideOffset:l}),t[8]=g,t[9]=e,t[10]=a,t[11]=u,t[12]=l,t[13]=b,t[14]=M,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});Gt.displayName="ThreadListItemMorePrimitive.Content";const Ht=d.forwardRef((n,e)=>{const t=D(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=ie(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(Lr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Ht.displayName="ThreadListItemMorePrimitive.Item";const Ut=d.forwardRef((n,e)=>{const t=D(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=ie(s);let a;return t[3]!==e||t[4]!==o||t[5]!==i?(a=r.jsx(jr,{...i,...o,ref:e}),t[3]=e,t[4]=o,t[5]=i,t[6]=a):a=t[6],a});Ut.displayName="ThreadListItemMorePrimitive.Separator";var pe=Me({Content:()=>Gt,Item:()=>Ht,Root:()=>Kt,Separator:()=>Ut,Trigger:()=>zt});function Gr(){const n=ee(),e=Qe(),t=Ce(),s=Ze(),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(),g=(n==null?void 0:n.isLibraryEnabled)===!0&&e!=null,x=(n==null?void 0:n.historyAgentFilter)??null;d.useEffect(()=>{i||u("")},[i]);const{agents:b,isInitialLoading:I,isSearching:M,loadingMore:L,hasMore:A,listRef:R,sentinelRef:k}=xn({enabled:i&&g,query:l});if(d.useLayoutEffect(()=>{if(!i||o){m(null);return}const w=()=>{var P;const j=(P=p.current)==null?void 0:P.getBoundingClientRect();j&&m({top:j.top,left:j.right+4})};return w(),window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[i,o]),d.useEffect(()=>{if(!i||o)return;const w=j=>{var C,O;const P=j.target;(C=p.current)!=null&&C.contains(P)||(O=h.current)!=null&&O.contains(P)||a(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[i,o]),!g)return null;const _=w=>{(n==null?void 0:n.isComposerEnabled)===!0?n.openDraft():n==null||n.openLibraryHome(),n==null||n.setHistoryAgentFilter(w),a(!1)},F=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"p-1",onMouseDown:w=>w.stopPropagation(),children:[r.jsx(gn,{query:l,setQuery:u,placeholder:"Search agents"}),M?r.jsx("p",{className:"text-text-secondary px-1 pt-1 text-[11px]",role:"status",children:"Searching…"}):null]}),r.jsxs("div",{ref:R,className:$("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(Ae,{className:$("justify-between",x==null&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>_(null),children:["All chats",x==null?r.jsx(z,{name:"check",className:"size-3.5 shrink-0"}):null]}):null,I?r.jsx("p",{className:"px-2 py-3 text-center text-xs text-text-secondary",children:"Loading…"}):b.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:[b.map(w=>{const j=vn(w),P=(x==null?void 0:x.agentId)===j;return r.jsxs(Ae,{className:$("justify-between gap-2 text-left",P&&"bg-dropdown-selected-item-bg text-dropdown-selected-item-text"),onClick:()=>_({agentId:j,agentName:w.name,intent:"history"}),children:[r.jsx("span",{className:"min-w-0 truncate",children:w.name}),P?r.jsx(z,{name:"check",className:"size-3.5 shrink-0"}):null]},j)}),A?r.jsx("div",{ref:k,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:se({variant:"ghost",size:"icon",className:$("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(w=>!w),children:[r.jsx(z,{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:F})}):null,!o&&i&&c!=null?bn.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:F}),wn(p.current)):null]})}function Hr({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<=Oe&&!t,p=()=>{m&&o(u)},h=f=>{t||s(f)};return r.jsx(yn,{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(ke.Secondary,{type:"button",disabled:t,onClick:()=>h(!1),children:"Cancel"}),r.jsx(ke.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:Oe,className:In("h-9"),onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),p())}})})})}var Ur="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",Vr="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 Wr({canRename:n,renameDisabled:e,canDelete:t,deleteDisabled:s,onRename:o}){const i=N("PermissionGuard"),a=Ze(),l=Ce(),[u,c]=d.useState(!1),[m,p]=d.useState(),h=l||a,f=d.useCallback(I=>{const M=I==null?void 0:I.closest(".aui-theme-root");p(M instanceof HTMLElement?M:void 0)},[]),g=se({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:Ur,disabled:e,onClick:()=>{e||(c(!1),o())},children:[r.jsx(z,{name:"pencil",className:"size-3.5"}),"Rename"]})}):null,b=t?r.jsx(i,{allowed:!s,children:r.jsxs(Ot.Delete,{className:Vr,onClick:()=>{s||c(!1)},children:[r.jsx(z,{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:g,onClick:()=>c(!0),children:r.jsx(z,{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,b]})}):null]}):r.jsxs(pe.Root,{sharedFocusGroup:!0,children:[r.jsx(pe.Trigger,{ref:f,"aria-label":"Session actions",title:"Session actions",className:g,children:r.jsx(z,{name:"ellipsis",className:"size-3.5"})}),r.jsxs(pe.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,b]})]})}function Xr({onThreadOpen:n,canRenameSession:e,canDeleteSession:t,canManageResource:s,canDeleteResource:o}){const i=G(),a=ee(),l=mn(),u=N("ThreadListRow"),c=E(C=>C.threadListItem.id),m=E(C=>C.threadListItem.remoteId),p=E(C=>C.threadListItem.title),h=E(C=>C.threadListItem.lastMessageAt),f=E(C=>C.threadListItem.custom),g=E(C=>C.threads.mainThreadId),x=fn(f),b=e&&m!=null,I=t&&m!=null,M=b||I,L=m!=null&&!s(m),A=m!=null&&!o(m),R=(a==null?void 0:a.libraryOpen)===!0||(a==null?void 0:a.sessionsOpen)===!0||(a==null?void 0:a.schedulesOpen)===!0,[k,_]=d.useState(!1),[F,w]=d.useState(!1),j=p??"New Chat",P=async C=>{if(C===(p??"").trim()){_(!1);return}w(!0);try{await i.threadListItem().rename(C),_(!1)}catch(O){l==null||l.showError(O)}finally{w(!1)}};return r.jsxs(Ot.Root,{className:"min-w-0",children:[r.jsx(u,{title:j,active:c===g&&!R,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);const C=hn(f),O=!C&&(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),y=pn({sessionMutable:C,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||y)&&m!=null){Promise.resolve(i.threads().switchToThread(c)).catch(()=>{});return}if(m!=null){a==null||a.openHistorySession({sessionId:m,isMutable:C,...x!=null?{agentName:x}:{}});return}Promise.resolve(i.threads().switchToThread(c)).catch(()=>{})},actions:M?r.jsx(Wr,{canRename:b,renameDisabled:L,canDelete:I,deleteDisabled:A,onRename:()=>_(!0)}):void 0}),r.jsx(Hr,{open:k,initialTitle:p??"",saving:F,onOpenChange:_,onSave:C=>{P(C)}})]})}function Yr(n){const e=E(s=>s.threads.threadIds),t=E(s=>s.threads.threadItems);return d.useMemo(()=>{const s=dn({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 qr({indices:n,onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i}){const a=E(l=>l.threads.threadIds);return r.jsx(r.Fragment,{children:n.map(l=>{const u=a[l]??String(l);return r.jsx(Se,{index:l,archived:!1,children:r.jsx(Xr,{onThreadOpen:e,canRenameSession:t,canDeleteSession:s,canManageResource:o,canDeleteResource:i})},u)})})}var Qr="aui_thread-list-viewport",Zr=80;function Jr({children:n,viewportRef:e,hideScrollbar:t}){var u;const s=ee(),o=E(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(Gr,{}):null]}),r.jsx("div",{ref:e,"data-slot":Qr,className:$("flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto",t&&"aui-scrollbar-hidden"),children:n})]})}function es({onThreadOpen:n,variant:e="default"}={}){const t=G(),s=Qe(),o=E(y=>y.threads.isLoading),i=E(y=>y.threads.isLoadingMore),a=E(y=>y.threads.hasMore),l=E(y=>y.threads.threadIds),u=E(y=>y.threads.threadItems),c=ee(),m=N("ThreadListShell"),p=N("ThreadListNewButton"),h=N("AgentsLibraryButton"),f=N("SessionsBrowserButton"),g=N("SchedulesButton"),x=N("ThreadListRowSkeleton"),b=N("ThreadListEmptyState"),I=Yr(e),M=d.useRef(null),L=d.useRef(a),A=d.useRef(t);L.current=a,A.current=t;const R=(c==null?void 0:c.isNewChatEnabled)!==!1,k=(c==null?void 0:c.mode.status)==="idle",_=e==="recent-history",F=typeof(s==null?void 0:s.renameSession)=="function",w=typeof(s==null?void 0:s.deleteSession)=="function",j=d.useMemo(()=>u.flatMap(y=>y.remoteId==null?[]:[y.remoteId]),[u]),{allows:P}=un({resourceType:"session",resourceIds:j});d.useEffect(()=>{if(k||o||i)return;const y=M.current;if(!y)return;let Q=!1;const U=()=>{if(Q||!L.current||y.clientHeight<=0)return;const me=y.scrollHeight-y.scrollTop-y.clientHeight;y.scrollHeight>y.clientHeight&&me>Zr||A.current.threads().loadMore()};y.addEventListener("scroll",U,{passive:!0});const V=typeof ResizeObserver>"u"?void 0:new ResizeObserver(()=>U());return V?V.observe(y):window.addEventListener("resize",U),U(),()=>{Q=!0,y.removeEventListener("scroll",U),V==null||V.disconnect(),V||window.removeEventListener("resize",U)}},[a,k,o,i,l.length]);const C=()=>{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),Promise.resolve(t.threads().switchToNewThread()).catch(()=>{})};let O;return k?O=r.jsx(b,{message:_?"No recent chats":void 0}):o?O=r.jsx(x,{}):I.length===0?O=r.jsx(b,{message:_?"No recent chats":void 0}):O=r.jsx(_r.Root,{className:"flex min-h-0 flex-col gap-0.5",children:r.jsx(qr,{indices:I,onThreadOpen:n,canRenameSession:F,canDeleteSession:w,canManageResource:y=>P(y,"MANAGE"),canDeleteResource:y=>P(y,"DELETE")})}),r.jsx(m,{header:_?null:r.jsxs("div",{className:"flex flex-col gap-1",children:[R?r.jsx(p,{onClick:C}):null,r.jsx(h,{}),r.jsx(f,{}),r.jsx(g,{})]}),children:r.jsxs(Jr,{viewportRef:M,hideScrollbar:_,children:[O,!k&&a?r.jsx("div",{className:"h-4 shrink-0","aria-hidden":!0}):null]})})}var ts=d.lazy(()=>tt(()=>import("./SettingsBuilder-RGEYBYPN-Bij2RoEA.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ns=d.lazy(()=>tt(()=>import("./SchedulesPage-SIJSKRWV-ULgYoypo.js"),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage}))),rs="h-5 w-5 max-w-40 shrink-0 object-contain",ss="w-20",Ke=$(jn,"text-sidebar-text"),ze="bg-primary-button-bg font-medium text-primary-button-text hover:bg-primary-button-hover hover:text-primary-button-text";function os({overlayOpen:n,mode:e}){return!n&&(e==null?void 0:e.status)==="active"&&!e.isCreateAgent}function as(){var h;const n=G(),e=ee(),t=N("AgentsLibraryButton"),s=N("SessionsBrowserButton"),o=N("SchedulesButton"),i=(e==null?void 0:e.isNewChatEnabled)!==!1,a=(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,l=e==null?void 0:e.mode,u=!a&&(l==null?void 0:l.status)==="active"&&!l.isCreateAgent&&((h=e==null?void 0:e.historyAgentFilter)==null?void 0:h.intent)!=="try-agent",c=!a&&l!=null&&et(l),m=()=>{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),Promise.resolve(n.threads().switchToNewThread()).catch(()=>{})},p=()=>{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:[i?r.jsxs("button",{type:"button","aria-label":"Start new chat",title:"New chat","aria-current":u?"page":void 0,className:se({variant:"ghost",className:$(Ke,u&&ze)}),onClick:m,children:[r.jsx(z,{name:"square-pen",size:14}),r.jsx("span",{className:"text-center",children:"New Chat"})]}):null,i&&(e!=null&&e.isComposerEnabled)?r.jsxs("button",{type:"button","aria-label":"Start new agent",title:"New Agent","aria-current":c?"page":void 0,className:se({variant:"ghost",className:$(Ke,c&&ze)}),onClick:p,children:[r.jsx(z,{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})]})}function Ge({onNavigate:n,className:e,railRef:t,...s}){const o=Sn(),i=Ln(o),a=N("BrandLogo"),l=N("UserAvatar");return r.jsxs("aside",{ref:t,className:$(ss,"flex min-h-0 shrink-0 flex-col border-r border-border bg-sidebar-bg",e),onClick:u=>{if(n==null)return;const c=u.target;c instanceof Element&&c.closest("button")!=null&&n()},...s,children:[r.jsx("div",{className:"flex h-14 w-full shrink-0 items-center justify-center text-text-primary",children:r.jsx(a,{variant:i.collapsedVariant,className:rs})}),r.jsx(as,{}),r.jsxs("footer",{className:"flex shrink-0 flex-col items-center border-border p-2",children:[r.jsx(Nn,{labeled:!0,className:"flex-col"}),r.jsx(l,{labeled:!0,className:"mt-2 py-1.5"})]})]})}function ps({className:n}){const e=ee(),t=Ce(),s=N("AgentDetailsPage"),o=N("AgentsLibrary"),i=N("SessionsPage"),a=N("ShareChatButton"),l=N("ClearChatButton"),u=N("SaveAgentButton"),c=N("SelectAgentEmptyState"),[m,p]=d.useState(!1),h=d.useRef(null),f=d.useRef(null),g=d.useRef(null),x=d.useRef(!1),b=(e==null?void 0:e.mode.status)==="idle",I=(e==null?void 0:e.settingsOpen)===!0,M=(e==null?void 0:e.libraryOpen)===!0,L=(e==null?void 0:e.sessionsOpen)===!0,A=(e==null?void 0:e.schedulesOpen)===!0,R=I||M||L||A,k=e!=null&&et(e.mode)&&!R&&(!t||e.agentConfigOpen),_=os({overlayOpen:R,mode:e==null?void 0:e.mode}),F=Mn();return d.useEffect(()=>{if(!m)return;const w=j=>{j.key==="Escape"&&p(!1)};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[m]),d.useEffect(()=>{var j,P;const w=g.current;if(m){x.current=!0,w&&(w.inert=!0),(j=f.current)==null||j.focus();return}x.current&&(w&&(w.inert=!1),(P=h.current)==null||P.focus(),x.current=!1)},[m]),r.jsxs("div",{className:$("relative flex h-full min-h-0 w-full min-w-0",n),children:[r.jsx(Ge,{className:"hidden md:flex"}),k?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(Tn,{showClose:t})}):null,r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-primary-bg",children:[r.jsx(Cn,{className:$("bg-topbar-bg",(R||b||!F)&&"md:hidden"),start:R?null:r.jsx("button",{ref:h,type:"button","aria-label":"Navigation","aria-expanded":m,className:$(se({variant:"ghost",size:"icon"}),"md:hidden"),onClick:()=>p(!0),children:r.jsx(z,{name:"bars"})}),title:R?null:r.jsx(Rn,{}),end:R?null:r.jsxs(r.Fragment,{children:[r.jsx(a,{}),r.jsx(l,{}),r.jsx(u,{})]})}),r.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1",children:[_?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(es,{variant:"recent-history"})}):null,r.jsx("div",{ref:g,className:"min-h-0 min-w-0 flex-1",children:I?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(Fe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ts,{})}):L?r.jsx(i,{}):M&&(e==null?void 0:e.libraryAgentId)!=null?r.jsx(s,{agentId:e.libraryAgentId},e.libraryAgentId):M?r.jsx(o,{onSelectAgent:()=>p(!1)}):A?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(Fe,{size:28,className:"text-text-primary"}),r.jsx("span",{className:"sr-only",children:"Loading"})]}),children:r.jsx(ns,{})}):b?r.jsx(c,{}):r.jsx(Pn,{})})]})]}),m?r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close navigation",className:"absolute inset-0 z-[9] cursor-pointer bg-[var(--overlay)] md:hidden",onClick:()=>p(!1)}),r.jsx(Ge,{railRef:f,role:"dialog","aria-label":"Navigation",tabIndex:-1,onNavigate:()=>p(!1),className:"absolute inset-y-0 left-0 z-10 shadow-lg outline-none md:hidden"})]}):null]})}export{ps as SidebarLayout};
@@ -1 +1 @@
1
- import{aU as $,N as P,r as a,aV as U,j as e,U as Q,W as I,I as z,aX as _,aq as k}from"./index-G7kdtXvB.js";var K=({open:s,onOpenChange:o,onImport:c,busy:v=!1,error:d})=>{const[p,g]=a.useState(""),[b,m]=a.useState(""),[u,j]=a.useState(""),[i,S]=a.useState(""),[n,x]=a.useState(""),N=()=>{g(""),m(""),j(""),S(""),x("")},h=()=>{N(),o(!1)},R=async l=>{if(l.preventDefault(),!(!p.trim()||!b.trim()||!u.trim()||!i.trim()||!n.trim()||v))try{await c({name:p.trim(),description:b.trim(),repoURL:u.trim(),path:i.trim(),ref:n.trim()}),h()}catch{}},L=!!(p.trim()&&b.trim()&&u.trim()&&i.trim()&&n.trim())&&!v;return e.jsx(_,{open:s,onOpenChange:l=>{l||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(z,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:l=>void R(l),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:l=>{g(l.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:k("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:l=>{m(l.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:k("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:u,onChange:l=>{j(l.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:k("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:l=>{S(l.target.value)},placeholder:"skills/release-notes",required:!0,className:k("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:l=>{x(l.target.value)},placeholder:"main",required:!0,className:k("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[d?e.jsx("p",{className:"text-failure-bg text-sm",children:d}):null,e.jsx(I.Primary,{type:"submit",disabled:!L,className:"w-full",children:"Import"})]})]})})})},T=K,q=(s,o,c)=>!s||o.toLowerCase().includes(s)||c.toLowerCase().includes(s),A=s=>"catalogId"in s;function V(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var W=()=>{const{skillCatalog:s}=$(),o=P(),[c,v]=a.useState(""),[d,p]=a.useState([]),[g,b]=a.useState([]),[m,u]=a.useState(!0),[j,i]=a.useState(null),[S,n]=a.useState(null),[x,N]=a.useState(!1),[h,R]=a.useState(!1),[L,l]=a.useState(!1),E=a.useCallback(async()=>{if(s){u(!0),i(null);try{const[t,r]=await Promise.all([s.listSkills(),s.getSkillCatalog()]);p(t),b(r)}catch(t){i(U(t,"Failed to load skills"))}finally{u(!1)}}},[s]);a.useEffect(()=>{E()},[E]);const y=c.trim().toLowerCase(),w=a.useMemo(()=>d.filter(t=>q(y,t.name,t.description)),[d,y]),C=a.useMemo(()=>{const t=new Set(d.flatMap(r=>A(r)?[r.catalogId]:[]));return g.filter(r=>!t.has(r.id)&&q(y,r.name,r.description))},[g,d,y]),F=async(t,r=i)=>{N(!0),i(null);try{await t(),await E()}catch(f){throw V(f)&&R(!0),r(U(f,"Request failed")),f}finally{N(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const G=t=>{F(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref})}).catch(()=>{})},B=t=>{const r=s.deleteSkill;r&&F(async()=>{await r({id:t.id})}).catch(()=>{})},O=async t=>{n(null),await F(async()=>{await s.createSkill(t)},n),setTimeout(()=>{o==null||o.showSuccess({title:`${t.name} imported`})},0)},M=({key:t,name:r,description:f,action:H})=>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(z,{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]}),H]},t),D=w.length>0||C.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(Q,{query:c,setQuery:v,placeholder:"Search skills"})}),e.jsxs(I.Secondary,{type:"button",className:"shrink-0",disabled:x||h,onClick:()=>{n(null),l(!0)},children:[e.jsx(z,{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:[m?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!m&&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=>M({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Remove ${t.name}`,onClick:()=>{B(t)},children:"Remove"}):null}))})]}):null,!m&&C.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 · ",C.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:C.map(t=>M({key:t.id,name:t.name,description:t.description,action:e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Enable ${t.name}`,onClick:()=>{G(t)},children:"Enable"})}))})]}):null,!m&&!D?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:y?`No skills match “${c.trim()}”.`:"No skills yet."}):null]})]}),e.jsx(T,{open:L,onOpenChange:t=>{l(t),t||n(null)},onImport:O,busy:x||h,error:S})]})},J=W;export{J as default};
1
+ import{aR as $,q as P,r as a,aS as U,j as e,W as Q,Z as I,I as z,aU as _,an as k}from"./index-v37J5fNr.js";var K=({open:s,onOpenChange:o,onImport:c,busy:v=!1,error:d})=>{const[p,g]=a.useState(""),[b,m]=a.useState(""),[u,j]=a.useState(""),[i,S]=a.useState(""),[n,x]=a.useState(""),N=()=>{g(""),m(""),j(""),S(""),x("")},h=()=>{N(),o(!1)},R=async l=>{if(l.preventDefault(),!(!p.trim()||!b.trim()||!u.trim()||!i.trim()||!n.trim()||v))try{await c({name:p.trim(),description:b.trim(),repoURL:u.trim(),path:i.trim(),ref:n.trim()}),h()}catch{}},L=!!(p.trim()&&b.trim()&&u.trim()&&i.trim()&&n.trim())&&!v;return e.jsx(_,{open:s,onOpenChange:l=>{l||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(z,{name:"github",className:"size-5"})}),contentSized:!0,className:"md:max-w-2xl",children:e.jsx("form",{onSubmit:l=>void R(l),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:l=>{g(l.target.value)},placeholder:"release-notes",autoFocus:!0,required:!0,className:k("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:l=>{m(l.target.value)},placeholder:"Generate release notes from merged pull requests",required:!0,rows:3,className:k("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:u,onChange:l=>{j(l.target.value)},placeholder:"https://github.com/org/repo",required:!0,className:k("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:l=>{S(l.target.value)},placeholder:"skills/release-notes",required:!0,className:k("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:l=>{x(l.target.value)},placeholder:"main",required:!0,className:k("h-11")})]}),e.jsxs("div",{className:"space-y-3",children:[d?e.jsx("p",{className:"text-failure-bg text-sm",children:d}):null,e.jsx(I.Primary,{type:"submit",disabled:!L,className:"w-full",children:"Import"})]})]})})})},T=K,q=(s,o,c)=>!s||o.toLowerCase().includes(s)||c.toLowerCase().includes(s),A=s=>"catalogId"in s;function W(s){return typeof s=="object"&&s!==null&&Reflect.get(s,"statusCode")===424}var Z=()=>{const{skillCatalog:s}=$(),o=P(),[c,v]=a.useState(""),[d,p]=a.useState([]),[g,b]=a.useState([]),[m,u]=a.useState(!0),[j,i]=a.useState(null),[S,n]=a.useState(null),[x,N]=a.useState(!1),[h,R]=a.useState(!1),[L,l]=a.useState(!1),E=a.useCallback(async()=>{if(s){u(!0),i(null);try{const[t,r]=await Promise.all([s.listSkills(),s.getSkillCatalog()]);p(t),b(r)}catch(t){i(U(t,"Failed to load skills"))}finally{u(!1)}}},[s]);a.useEffect(()=>{E()},[E]);const y=c.trim().toLowerCase(),w=a.useMemo(()=>d.filter(t=>q(y,t.name,t.description)),[d,y]),C=a.useMemo(()=>{const t=new Set(d.flatMap(r=>A(r)?[r.catalogId]:[]));return g.filter(r=>!t.has(r.id)&&q(y,r.name,r.description))},[g,d,y]),F=async(t,r=i)=>{N(!0),i(null);try{await t(),await E()}catch(f){throw W(f)&&R(!0),r(U(f,"Request failed")),f}finally{N(!1)}};if(!s)return e.jsx("p",{className:"text-sm text-text-secondary",children:"Skills catalog is not available."});const G=t=>{F(async()=>{await s.createSkill({catalogId:t.id,name:t.name,description:t.description,repoURL:t.repoURL,path:t.path,ref:t.ref})}).catch(()=>{})},B=t=>{const r=s.deleteSkill;r&&F(async()=>{await r({id:t.id})}).catch(()=>{})},O=async t=>{n(null),await F(async()=>{await s.createSkill(t)},n),setTimeout(()=>{o==null||o.showSuccess({title:`${t.name} imported`})},0)},M=({key:t,name:r,description:f,action:H})=>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(z,{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]}),H]},t),D=w.length>0||C.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(Q,{query:c,setQuery:v,placeholder:"Search skills"})}),e.jsxs(I.Secondary,{type:"button",className:"shrink-0",disabled:x||h,onClick:()=>{n(null),l(!0)},children:[e.jsx(z,{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:[m?e.jsx("p",{className:"py-8 text-center text-sm text-text-secondary",children:"Loading…"}):null,!m&&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=>M({key:t.id,name:t.name,description:t.description,action:s.deleteSkill?e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Remove ${t.name}`,onClick:()=>{B(t)},children:"Remove"}):null}))})]}):null,!m&&C.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 · ",C.length]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card-bg",children:C.map(t=>M({key:t.id,name:t.name,description:t.description,action:e.jsx(I.Secondary,{size:"small",type:"button",disabled:x||h,"aria-label":`Enable ${t.name}`,onClick:()=>{G(t)},children:"Enable"})}))})]}):null,!m&&!D?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:y?`No skills match “${c.trim()}”.`:"No skills yet."}):null]})]}),e.jsx(T,{open:L,onOpenChange:t=>{l(t),t||n(null)},onImport:O,busy:x||h,error:S})]})},V=Z;export{V as default};
@@ -0,0 +1 @@
1
+ import{r as t,a,j as o,T as n}from"./index-v37J5fNr.js";import{B as u}from"./chunk-62JRHF6Z-ByllQXFT.js";function l({routes:e,...s}){const r=t.useMemo(()=>a(e),[e]);return o.jsx(u,{basename:r.basename||void 0,children:o.jsx(n,{...s,resolvedRoutes:r})})}export{l as TrueForgeUIWithRouter};
@@ -0,0 +1 @@
1
+ import{aR as A,q as B,r as a,aS as z,j as e,I as P,Z as E,aU as L,an as M}from"./index-v37J5fNr.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,R=()=>{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})]})},q=R;export{q as default};
@@ -0,0 +1 @@
1
+ import{S as m}from"./chunk-FYQP67GV-C3xcimCk.js";import{d as x,h as f,r,j as e,C as p,I as b,f as h,g as v}from"./index-v37J5fNr.js";import"./chunk-WOPPIMOW-Bxo8Tkcc.js";function j({className:u}){const d=x("BrandLogo"),{open:a,setOpen:n}=f(),l=r.useRef(null),s=r.useRef(null),i=r.useRef(!1);return r.useEffect(()=>{if(!a)return;const t=o=>{var c;o.key==="Escape"&&!((c=s.current)!=null&&c.querySelector("dialog[open]"))&&n(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,n]),r.useEffect(()=>{var t,o;if(a){i.current=!0,(t=s.current)==null||t.focus();return}i.current&&((o=l.current)==null||o.focus(),i.current=!1)},[a]),e.jsxs("div",{className:v("pointer-events-none relative h-full min-h-0 w-full",u),children:[a?e.jsx("div",{ref:s,"data-aui-compact-layout":!0,className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[calc(5.25rem+env(safe-area-inset-bottom,0px))] z-[19] flex h-[min(560px,calc(100%-6.5rem-env(safe-area-inset-bottom,0px)))] max-h-[calc(100%-6.5rem)] w-[min(380px,calc(100%-2.5rem))] flex-col overflow-hidden rounded-xl border border-border bg-primary-bg shadow-[0_16px_48px_color-mix(in_oklab,var(--shadow-color)_14%,transparent)] outline-none",role:"dialog","aria-modal":!0,"aria-label":"Chat",tabIndex:-1,children:e.jsx(p,{children:e.jsx(m,{threadHeaderEnd:e.jsx("button",{type:"button","aria-label":"Close",title:"Close",className:h({variant:"ghost",size:"icon"}),onClick:()=>n(!1),children:e.jsx(b,{name:"xmark"})})})})}):null,e.jsx("button",{ref:l,type:"button",className:"pointer-events-auto absolute right-[max(1.25rem,env(safe-area-inset-right,0px))] bottom-[max(1.25rem,env(safe-area-inset-bottom,0px))] z-20 flex size-14 cursor-pointer items-center justify-center rounded-full text-sm font-medium shadow-[0_8px_24px_color-mix(in_oklab,var(--primary-button-bg)_45%,transparent)]",style:{backgroundColor:"var(--primary-button-bg)",color:"var(--primary-button-text)"},"aria-expanded":a,"aria-label":a?"Close chat":"Open chat",onClick:()=>n(t=>!t),children:a?e.jsx("span",{"aria-hidden":!0,className:"text-xl leading-none",children:"×"}):e.jsx(d,{variant:"icon",className:"size-6"})})]})}export{j as WidgetLayout};
@@ -1,4 +1,4 @@
1
- import{r as i}from"./index-G7kdtXvB.js";/**
1
+ import{r as i}from"./index-v37J5fNr.js";/**
2
2
  * react-router v7.18.2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
@@ -0,0 +1 @@
1
+ function n({error:o,onError:r,showError:c}){const s=r??c;s==null||s(o)}export{n as r};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./SettingsBuilder-RGEYBYPN-Bij2RoEA.js","./index-v37J5fNr.js","./index-B01pXqvC.css","./SchedulesPage-SIJSKRWV-ULgYoypo.js"])))=>i.map(i=>d[i]);
2
+ import{u as P,b as E,d as t,e as _,r as a,j as s,S as x,P as B,I as c,f as l,g as L,_ as m}from"./index-v37J5fNr.js";import{N as I,T,S as k,A as z}from"./chunk-WOPPIMOW-Bxo8Tkcc.js";var D=a.lazy(()=>m(()=>import("./SettingsBuilder-RGEYBYPN-Bij2RoEA.js"),__vite__mapDeps([0,1,2]),import.meta.url)),V=a.lazy(()=>m(()=>import("./SchedulesPage-SIJSKRWV-ULgYoypo.js"),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>({default:n.SchedulesPage})));function H({className:n,threadHeaderEnd:p}){const r=P(),e=E(),j=t("ClearChatButton"),f=t("AgentDetailsPage"),g=t("AgentsLibrary"),b=t("SessionsPage"),h=t("ShareChatButton"),v=t("SaveAgentButton"),N=t("SelectAgentEmptyState"),y=t("UserAvatar"),i=(e==null?void 0:e.mode.status)==="idle",A=(e==null?void 0:e.settingsOpen)===!0,o=(e==null?void 0:e.libraryOpen)===!0,S=(e==null?void 0:e.sessionsOpen)===!0,d=(e==null?void 0:e.schedulesOpen)===!0,C=_(),u=(e==null?void 0:e.isNewChatEnabled)!==!1;a.useEffect(()=>{i||Promise.resolve(r.threads().switchToNewThread()).catch(()=>{})},[r,i]);const O=()=>{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),Promise.resolve(r.threads().switchToNewThread()).catch(()=>{})},w=()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSessionsOpen(!1),e!=null&&e.isComposerEnabled&&e.openAgentBuilder()};return s.jsxs("div",{className:L("relative flex h-full min-h-0 flex-col",n),children:[A?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(x,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(D,{})})}):S?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(b,{})}):o&&(e==null?void 0:e.libraryAgentId)!=null?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(f,{agentId:e.libraryAgentId},e.libraryAgentId)}):o?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(g,{})}):d?s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(a.Suspense,{fallback:s.jsxs("div",{className:"flex h-full items-center justify-center",role:"status","aria-live":"polite","aria-busy":"true",children:[s.jsx(x,{size:28,className:"text-text-primary"}),s.jsx("span",{className:"sr-only",children:"Loading"})]}),children:s.jsx(V,{})})}):s.jsxs(s.Fragment,{children:[s.jsx(B,{start:s.jsxs(s.Fragment,{children:[u&&!C?s.jsx("button",{type:"button","aria-label":"New Chat",title:"New Chat",className:l({variant:"ghost",size:"icon"}),onClick:O,children:s.jsx(c,{name:"square-pen"})}):null,u&&(e!=null&&e.isComposerEnabled)?s.jsx("button",{type:"button","aria-label":"New Agent",title:"New Agent",className:l({variant:"ghost",size:"icon"}),onClick:w,children:s.jsx(c,{name:"agent-2"})}):null]}),title:s.jsx(I,{}),end:s.jsxs(s.Fragment,{children:[s.jsx(h,{}),s.jsx(j,{}),s.jsx(v,{}),p]})}),s.jsx("div",{className:"min-h-0 flex-1",children:i?s.jsx(N,{}):s.jsx(T,{})})]}),s.jsxs("footer",{className:"flex shrink-0 items-center justify-between border-t border-border px-2 py-1.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1",children:[o||d?s.jsxs("button",{type:"button",className:l({variant:"ghost",size:"small"}),onClick:()=>{e==null||e.setLibraryOpen(!1),e==null||e.setSchedulesOpen(!1)},children:[s.jsx(c,{name:"arrow-left"}),"Back to chat"]}):null,s.jsx(y,{})]}),s.jsx(k,{},"shell-actions")]}),e!=null&&e.agentConfigOpen?s.jsx("aside",{role:"dialog","aria-label":"Agent Config",className:"absolute inset-0 z-20 border-l border-border shadow-xl",children:s.jsx(z,{showClose:!0})}):null]})}export{H as S};