decocms 4.16.0 → 4.17.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 (251) hide show
  1. package/dist/client/assets/{AlertCircle--rPujN3Y.js → AlertCircle-D8gnDqwf.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-6nYdIeA_.js → ArrowUpRight-BlXghneM.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-uEcNv3oG.js → CheckCircle-DCCFCHyS.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DZjF3Thv.js → ChevronDown-BLALKRGM.js} +1 -1
  5. package/dist/client/assets/{ChevronRight-Z0q9tr5K.js → ChevronRight-Gacf5_E2.js} +1 -1
  6. package/dist/client/assets/{ChevronUp-D4D_9neM.js → ChevronUp-DBXbYduj.js} +1 -1
  7. package/dist/client/assets/{DotsVertical-BXAKlKX4.js → DotsVertical-D7ryssxp.js} +1 -1
  8. package/dist/client/assets/{Eye-Cov1iekv.js → Eye-BFLaa-Ve.js} +1 -1
  9. package/dist/client/assets/{FilterLines-CemhGOOA.js → FilterLines-CK4jmUMp.js} +1 -1
  10. package/dist/client/assets/{Globe01-C05BMTjz.js → Globe01-Bx-hz-as.js} +1 -1
  11. package/dist/client/assets/{Globe04-BRwKw7PX.js → Globe04-u6eY2Kop.js} +1 -1
  12. package/dist/client/assets/{HardDrive-DH-7bfsp.js → HardDrive-B06hZ2KP.js} +1 -1
  13. package/dist/client/assets/{Key01-Zbo9TQ6M.js → Key01-D0oVN5CX.js} +1 -1
  14. package/dist/client/assets/{LayoutLeft-DLmY-nUd.js → LayoutLeft-1bN-FR8E.js} +1 -1
  15. package/dist/client/assets/{LinkExternal01-DI4shoup.js → LinkExternal01-D4vA-I3a.js} +1 -1
  16. package/dist/client/assets/{Monitor01-qwfVoWYX.js → Monitor01-DrJKeSJ4.js} +1 -1
  17. package/dist/client/assets/{Palette-BrKsv6mu.js → Palette-CvuWqoBi.js} +1 -1
  18. package/dist/client/assets/{Play-D612TCCW.js → Play-DuOwU6E2.js} +1 -1
  19. package/dist/client/assets/{Plus-DK07_JoD.js → Plus-Bz2JwGOE.js} +1 -1
  20. package/dist/client/assets/{SearchLg-Bn8rNJBm.js → SearchLg-CfwbHNr5.js} +1 -1
  21. package/dist/client/assets/{SearchMd-CF0EzaSp.js → SearchMd-Bn2Kbs9E.js} +1 -1
  22. package/dist/client/assets/{Settings02-CMY7mFtN.js → Settings02-N32UBNZq.js} +1 -1
  23. package/dist/client/assets/{Shield01-TkrC5hLh.js → Shield01-BztOm8mA.js} +1 -1
  24. package/dist/client/assets/{Star01-D_WMzpkz.js → Star01-GFElhP7X.js} +1 -1
  25. package/dist/client/assets/{Stars01-Dgo6ZeEq.js → Stars01-CK-XatBt.js} +1 -1
  26. package/dist/client/assets/{Stars02-D0TDGrAi.js → Stars02-BpRz9194.js} +1 -1
  27. package/dist/client/assets/{Sun-CyYaDPq3.js → Sun-CRJdfBLT.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-CY8rL9G2.js → SwitchHorizontal01-Bcp8nSOf.js} +1 -1
  29. package/dist/client/assets/{Tool01-93CsHV7z.js → Tool01-DrE6CqtR.js} +1 -1
  30. package/dist/client/assets/{Trash01-pwMDa2Co.js → Trash01-kVRWRMat.js} +1 -1
  31. package/dist/client/assets/{Upload01-BIfi-RBp.js → Upload01-TiHLQTwG.js} +1 -1
  32. package/dist/client/assets/{User01-Ck187G2K.js → User01-9o9EbE3X.js} +1 -1
  33. package/dist/client/assets/{Users01-B4dXvjnK.js → Users01-CMbqiB_R.js} +1 -1
  34. package/dist/client/assets/{Users03-DgL-nSvI.js → Users03-K1B4uaw7.js} +1 -1
  35. package/dist/client/assets/{X-BC75c88P.js → X-BQZZQdg0.js} +1 -1
  36. package/dist/client/assets/{XCircle-C30_UXd3.js → XCircle-BOFvuFHl.js} +1 -1
  37. package/dist/client/assets/{XClose-BnLOhLbC.js → XClose-ChRyc7zA.js} +1 -1
  38. package/dist/client/assets/{Zap-CwhZlKhU.js → Zap-RN8PAcZE.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-CiXrDW73.js → ZapSquare-D4RqdrSL.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-CgUBbs0k.js → ZoomOut-CwXzA7X6.js} +1 -1
  41. package/dist/client/assets/{access-gate-Ddakg94Z.js → access-gate-DayZt2qh.js} +1 -1
  42. package/dist/client/assets/{add-section-modal-BEvvmMxn.js → add-section-modal-BgsTQi1S.js} +1 -1
  43. package/dist/client/assets/agent-capabilities-C8WZk9re.js +1 -0
  44. package/dist/client/assets/agent-icon-BRuLsBYY.js +1 -0
  45. package/dist/client/assets/{agents-list-BNcLGGdI.js → agents-list-Bb32bFe0.js} +1 -1
  46. package/dist/client/assets/ai-providers-CtFbvrBB.js +1 -0
  47. package/dist/client/assets/{alert-DQEgpj3F.js → alert-DGlfAxXY.js} +1 -1
  48. package/dist/client/assets/{alert-dialog-B4gO4yN5.js → alert-dialog-D87-BKea.js} +2 -2
  49. package/dist/client/assets/app-editor-BTeZcD9G.js +1 -0
  50. package/dist/client/assets/{auth-catchall-D3JzAW-k.js → auth-catchall-CDZHIENi.js} +1 -1
  51. package/dist/client/assets/{auth-entry-Bwc-RALg.js → auth-entry--IJuST3G.js} +1 -1
  52. package/dist/client/assets/{auth-DLMAAdjO.js → auth-pLLkIszG.js} +1 -1
  53. package/dist/client/assets/{auth-split-layout-BLTOjOLB.js → auth-split-layout-Cm8DpBZy.js} +1 -1
  54. package/dist/client/assets/{authenticate-and-persist-oauth-DakefadM.js → authenticate-and-persist-oauth-VdmVLbtW.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-ipQdiSSm.js → automation-list-row-DJcYtMaz.js} +1 -1
  56. package/dist/client/assets/{automation-runs-C74R9g0x.js → automation-runs-BQZ05VJM.js} +1 -1
  57. package/dist/client/assets/automations-DXzG8kgd.js +1 -0
  58. package/dist/client/assets/{avatar-DS9aYjJt.js → avatar-DxH3BnSs.js} +1 -1
  59. package/dist/client/assets/{badge-wSwvHa02.js → badge-wh5eWpb9.js} +1 -1
  60. package/dist/client/assets/{block-document-BEmcXKPE.js → block-document-OYJ-kskh.js} +2 -2
  61. package/dist/client/assets/{brand-context-DoLXR5-x.js → brand-context-Dkhy-emW.js} +1 -1
  62. package/dist/client/assets/breadcrumb-DZbB5tzN.js +1 -0
  63. package/dist/client/assets/{buckets-B1pMqHCa.js → buckets-DWf7-mkQ.js} +1 -1
  64. package/dist/client/assets/{bulk-category-panel-K9RKoTBZ.js → bulk-category-panel-BfqGc7PR.js} +1 -1
  65. package/dist/client/assets/capability-load-error-B0knfbbl.js +1 -0
  66. package/dist/client/assets/{card-C45fkaVO.js → card-D-LCVQQb.js} +1 -1
  67. package/dist/client/assets/category-editor-dubEmgpx.js +1 -0
  68. package/dist/client/assets/{chat-context-TTwf8MAP.js → chat-context-CIKFBD8u.js} +4 -4
  69. package/dist/client/assets/{checkbox-TzOn0Djh.js → checkbox-CFdij7Ei.js} +1 -1
  70. package/dist/client/assets/{cli-auth-success--q8-44bB.js → cli-auth-success-BJWjcvwa.js} +1 -1
  71. package/dist/client/assets/collection-detail-C8jnHEZw.js +1 -0
  72. package/dist/client/assets/{collection-display-button-DAd8Da4w.js → collection-display-button-DDEI8eBI.js} +1 -1
  73. package/dist/client/assets/{collection-search-DvBi3Q2M.js → collection-search-B0gYtEWh.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-B4wJfJxi.js → collection-tabs-DGDRpyxJ.js} +1 -1
  75. package/dist/client/assets/{command-CCTW1Ytf.js → command-VE4J0WmB.js} +1 -1
  76. package/dist/client/assets/{commerce-onboarding-jLm6p03A.js → commerce-onboarding-DtwhvPKV.js} +1 -1
  77. package/dist/client/assets/{connect-desktop-dialog-B-Qjl-2m.js → connect-desktop-dialog-DRNK5Zqx.js} +1 -1
  78. package/dist/client/assets/{connection-card-B_S6LeLq.js → connection-card-Dzp4nWAC.js} +1 -1
  79. package/dist/client/assets/connection-detail-BnRE6ILz.js +1 -0
  80. package/dist/client/assets/{connection-form-helpers-0vbutknj.js → connection-form-helpers-BKzMCiDP.js} +1 -1
  81. package/dist/client/assets/{connections-CrVC5c7D.js → connections-BPohRO-Z.js} +1 -1
  82. package/dist/client/assets/{decopilot-ByyydzKl.js → decopilot-D_-94MU_.js} +1 -1
  83. package/dist/client/assets/{decopilot-sse-pool-DbAPLrBY.js → decopilot-sse-pool-DA88fFcW.js} +1 -1
  84. package/dist/client/assets/{dialog-Ql8kdDTa.js → dialog-BdIjDk0G.js} +1 -1
  85. package/dist/client/assets/{domain-settings-D1WiqXBP.js → domain-settings-CTC9j3wY.js} +1 -1
  86. package/dist/client/assets/{drawer-CBX0QEUx.js → drawer-D1X6O6Aa.js} +1 -1
  87. package/dist/client/assets/{dropdown-menu-CIAjydh3.js → dropdown-menu-8PMbgM0q.js} +1 -1
  88. package/dist/client/assets/{empty-state-BzX7YwgA.js → empty-state-y_scHUYK.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-CFrqNmH9.js → extract-connection-data-BhI39RpO.js} +1 -1
  90. package/dist/client/assets/file-explorer-BD0vY2dd.js +2 -0
  91. package/dist/client/assets/{file-type-icon-fjgLfwGj.js → file-type-icon-Bx1NX_Gy.js} +1 -1
  92. package/dist/client/assets/{files-B7cjcKYB.js → files-BFgu7BJp.js} +1 -1
  93. package/dist/client/assets/{form-hBMUZ-LI.js → form-P-LOMg0X.js} +1 -1
  94. package/dist/client/assets/{general-SCBmH2JA.js → general-DaU6Yz-f.js} +1 -1
  95. package/dist/client/assets/github-repo-picker-CmustdLW.js +1 -0
  96. package/dist/client/assets/{hooks-wJ9L2q1Z.js → hooks-UY6BFV6z.js} +4 -4
  97. package/dist/client/assets/{import-from-deco-dialog-rnwM3BUn.js → import-from-deco-dialog-CopvXqdM.js} +1 -1
  98. package/dist/client/assets/{index-DbVMhyOM.js → index-BZCHEyhA.js} +1 -1
  99. package/dist/client/assets/{index-D57sxBgv.js → index-BbFfuuHN.js} +1 -1
  100. package/dist/client/assets/{index-DPqZ0lBB.js → index-BgCyOgdF.js} +25 -25
  101. package/dist/client/assets/{index-CRIhXX57.js → index-BrtU3HWl.js} +3 -3
  102. package/dist/client/assets/{index-D7be0Dd5.js → index-BwaOBBZ-.js} +1 -1
  103. package/dist/client/assets/{index-Bl9dJ0nD.js → index-CAQVV5KO.js} +1 -1
  104. package/dist/client/assets/index-Cgz2WBho.js +173 -0
  105. package/dist/client/assets/index-D4EP6iY-.js +1 -0
  106. package/dist/client/assets/{index-B6CxQrCo.js → index-DHTICC_v.js} +12 -12
  107. package/dist/client/assets/{index-9wbmkYIt.js → index-DJMmArQj.js} +1 -1
  108. package/dist/client/assets/index-DStyXwbT.js +1 -0
  109. package/dist/client/assets/index-DTpadbju.js +1 -0
  110. package/dist/client/assets/index-DmMZ0-sF.css +1 -0
  111. package/dist/client/assets/{index-B3lyyZoz.js → index-Dq2Ts3Yi.js} +1 -1
  112. package/dist/client/assets/{index-redirect-JCm2yIgz.js → index-redirect-YHMCgUs4.js} +1 -1
  113. package/dist/client/assets/{input-92IYvOwC.js → input-DgsFOGyM.js} +1 -1
  114. package/dist/client/assets/{integration-icon-BO-UF1BS.js → integration-icon-m6Sa_hcd.js} +1 -1
  115. package/dist/client/assets/{label-ClPdqpUd.js → label-CwMsBEmc.js} +1 -1
  116. package/dist/client/assets/library-tab-DZNwBek9.js +7 -0
  117. package/dist/client/assets/{login-DgOPYAOM.js → login-DDPQBbDq.js} +1 -1
  118. package/dist/client/assets/{mcp-oauth-DTOnM3tW.js → mcp-oauth-SxDhA9AX.js} +1 -1
  119. package/dist/client/assets/{members-DIJN_e3F.js → members-DiR3wVIq.js} +2 -2
  120. package/dist/client/assets/{monaco-editor-Bmt-pGiV.js → monaco-editor-iFVtSMuF.js} +2 -2
  121. package/dist/client/assets/{monitoring-stats-row-5ex8aBKD.js → monitoring-stats-row-D6W0tudn.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-BxJL43IL.js → oauth-callback-Cj-8kU65.js} +1 -1
  123. package/dist/client/assets/{oauth-callback-ai-provider-T3ZxDraC.js → oauth-callback-ai-provider-Dc1dGP3j.js} +1 -1
  124. package/dist/client/assets/{onboarding-CrwoKUAN.js → onboarding-DF_zbux6.js} +1 -1
  125. package/dist/client/assets/{org-install-RobmE1uK.js → org-install-CEMN6R-y.js} +1 -1
  126. package/dist/client/assets/{org-layout-DmAiWQnF.js → org-layout-bk5Xtfa_.js} +1 -1
  127. package/dist/client/assets/{organization-choice-Crc0nA8E.js → organization-choice-CE_aU8pP.js} +1 -1
  128. package/dist/client/assets/{page-seo-form-BEyx98K-.js → page-seo-form-Derb8U-C.js} +1 -1
  129. package/dist/client/assets/page-seo-sheet-BoNARuVh.js +1 -0
  130. package/dist/client/assets/popover-4-S-2t4S.js +1 -0
  131. package/dist/client/assets/post-editor-CHJjQHP8.js +1 -0
  132. package/dist/client/assets/{primitives-Cs1JxLBO.js → primitives-DFOak6EH.js} +1 -1
  133. package/dist/client/assets/{profile--fDEth4Y.js → profile-BNOuWcgq.js} +1 -1
  134. package/dist/client/assets/project-app-view-ChmoDNv-.js +1 -0
  135. package/dist/client/assets/record-editor-CS39Vomm.js +1 -0
  136. package/dist/client/assets/registry-D4tm3ZFm.js +2 -0
  137. package/dist/client/assets/{registry-layout-DmIz6dSp.js → registry-layout-BPKVzNcW.js} +4 -4
  138. package/dist/client/assets/{require-capability-BaKHYhiM.js → require-capability-BJprrccL.js} +1 -1
  139. package/dist/client/assets/{required-auth-layout-BaYXJW0b.js → required-auth-layout-B0YEEBld.js} +1 -1
  140. package/dist/client/assets/{reset-password-AxTehpVn.js → reset-password-CkXuGUs6.js} +1 -1
  141. package/dist/client/assets/roles-lfwag5Tp.js +1 -0
  142. package/dist/client/assets/{scroll-area-CH-368qd.js → scroll-area-C8YtCymQ.js} +54 -54
  143. package/dist/client/assets/{search-input-DZumeAoO.js → search-input-Du_36cRj.js} +1 -1
  144. package/dist/client/assets/{secrets-BPAq0_qo.js → secrets-CnPg0qON.js} +1 -1
  145. package/dist/client/assets/{sections-editor-Crz16gyQ.js → sections-editor-BR6KfAKE.js} +2 -2
  146. package/dist/client/assets/select-DzzBmNmo.js +1 -0
  147. package/dist/client/assets/{select-model-CGEu5pyd.js → select-model-F8Y_Cf3t.js} +1 -1
  148. package/dist/client/assets/seo-editor-gJ1HxoCF.js +1 -0
  149. package/dist/client/assets/settings-layout-CGT7LCro.js +1 -0
  150. package/dist/client/assets/{settings-section-EyCuv06A.js → settings-section-rq7s23q-.js} +1 -1
  151. package/dist/client/assets/{sheet-CTWseyLj.js → sheet-B3q7nz8B.js} +1 -1
  152. package/dist/client/assets/shell-controls-mi9y4ySh.js +1 -0
  153. package/dist/client/assets/{shell-layout-u7hzXt3K.js → shell-layout-QzfqSuxf.js} +1 -1
  154. package/dist/client/assets/shell-route-loading-Bpj8AlnX.js +1 -0
  155. package/dist/client/assets/{sidebar-BaLCxwAl.js → sidebar-D2BmctMK.js} +1 -1
  156. package/dist/client/assets/{skeleton-BpxeXqnd.js → skeleton-f0d6RrIL.js} +1 -1
  157. package/dist/client/assets/{sso-DvvStBWC.js → sso-D4e1TwT3.js} +1 -1
  158. package/dist/client/assets/{store-D8QMJIIY.js → store-DxI78Zhs.js} +1 -1
  159. package/dist/client/assets/store-registry-DKwI23vv.js +2 -0
  160. package/dist/client/assets/{studio-tools-zOdwK0zh.js → studio-tools-D6ANxpFE.js} +1 -1
  161. package/dist/client/assets/switch-BRlkUTqX.js +1 -0
  162. package/dist/client/assets/{tab-id-AX1D_RMI.js → tab-id-DPNwWMUY.js} +1 -1
  163. package/dist/client/assets/{table-BpbB_kJT.js → table-65-g1dd8.js} +1 -1
  164. package/dist/client/assets/tabs-ByVhqny2.js +1 -0
  165. package/dist/client/assets/{task-status-DNPwSqe7.js → task-status-BMnLETgS.js} +1 -1
  166. package/dist/client/assets/{textarea-tv37zNgD.js → textarea-Dp78LmPE.js} +1 -1
  167. package/dist/client/assets/toggle-group-BIoy7tOG.js +1 -0
  168. package/dist/client/assets/{toolbar-NyfHrEzE.js → toolbar-C1WgDWOZ.js} +1 -1
  169. package/dist/client/assets/{toolbar-icon-button-ePdMhfbx.js → toolbar-icon-button-DdAIuoK2.js} +1 -1
  170. package/dist/client/assets/tools-list-BrZf2-sc.js +1 -0
  171. package/dist/client/assets/tooltip-CWNyrHYY.js +1 -0
  172. package/dist/client/assets/{types-DMnh_mjG.js → types-BHL4d6ji.js} +6 -6
  173. package/dist/client/assets/{use-ai-providers-D3giib4c.js → use-ai-providers-CVS8EjHf.js} +1 -1
  174. package/dist/client/assets/{use-automations-DIPQb7eg.js → use-automations-DJ1_UqKB.js} +1 -1
  175. package/dist/client/assets/{use-capability-JneQ7Vlv.js → use-capability-BmznXR_9.js} +1 -1
  176. package/dist/client/assets/{use-clock-tick-CcOZ6R_w.js → use-clock-tick-BXZK-6ig.js} +1 -1
  177. package/dist/client/assets/{use-collections-B43Sol5V.js → use-collections-BnOL5hT8.js} +1 -1
  178. package/dist/client/assets/{use-connection-u7lGziaM.js → use-connection-CRsO-Bab.js} +1 -1
  179. package/dist/client/assets/{use-copy-BHyTm1ci.js → use-copy-DK8lBdjB.js} +1 -1
  180. package/dist/client/assets/{use-create-virtual-mcp-DHdZYJVG.js → use-create-virtual-mcp-C50juX43.js} +1 -1
  181. package/dist/client/assets/{use-debounced-autosave-NW1w5qmo.js → use-debounced-autosave-Q8tZcL7-.js} +1 -1
  182. package/dist/client/assets/{use-debounced-value-DW3gYKw6.js → use-debounced-value-C2hJqHIV.js} +1 -1
  183. package/dist/client/assets/{use-decopilot-events-DMfVXUJv.js → use-decopilot-events-BB7o7ets.js} +1 -1
  184. package/dist/client/assets/{use-delete-connection-TXFJhj7J.js → use-delete-connection-D7WMNDAi.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-D5Wy46KQ.js → use-file-configs-Bxsm4MXe.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-pt1aYNB9.js → use-infinite-scroll-DFBavgZf.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-DmwWk_kt.js → use-join-requests-CNT469hS.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-BKmxEbDP.js → use-mcp-client-DAJmDOVO.js} +2 -2
  189. package/dist/client/assets/{use-mcp-prompts-C9PuaVPO.js → use-mcp-prompts-D3eulxzR.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-C821Tleh.js → use-mcp-tools-AjHzJbIQ.js} +1 -1
  191. package/dist/client/assets/{use-members-CcA5-SWw.js → use-members-BZroloWO.js} +1 -1
  192. package/dist/client/assets/{use-mobile-C77wgjj_.js → use-mobile-BkWraisf.js} +1 -1
  193. package/dist/client/assets/use-navigate-to-agent-Dlhjy-0a.js +1 -0
  194. package/dist/client/assets/{use-org-auth-client-C5YzOJMC.js → use-org-auth-client-BG_aw3vg.js} +1 -1
  195. package/dist/client/assets/{use-org-sso-IHoKz-Sw.js → use-org-sso-CEETlaem.js} +1 -1
  196. package/dist/client/assets/{use-organization-roles-DZZfJv7z.js → use-organization-roles-BrhJCA0y.js} +1 -1
  197. package/dist/client/assets/{use-organization-settings-D4bmJmDV.js → use-organization-settings-D9G2tGsW.js} +1 -1
  198. package/dist/client/assets/{use-registry-connections-zNHTAa1f.js → use-registry-connections-CTTYiKTQ.js} +1 -1
  199. package/dist/client/assets/{use-secrets-DuaBuygY.js → use-secrets-sB7thdOD.js} +1 -1
  200. package/dist/client/assets/{use-status-sounds-BChPDpHE.js → use-status-sounds-DuOBmrHo.js} +1 -1
  201. package/dist/client/assets/{use-view-mode-Bkt4wZfz.js → use-view-mode-CFXBQhh0.js} +1 -1
  202. package/dist/client/assets/{use-virtual-mcp-CsOrbTV4.js → use-virtual-mcp-CJycW-Qv.js} +1 -1
  203. package/dist/client/assets/useInfiniteQuery-Bl42Nudd.js +1 -0
  204. package/dist/client/assets/useSuspenseInfiniteQuery-uA0LQwFa.js +1 -0
  205. package/dist/client/assets/{useSuspenseQueries-DSwCaH3D.js → useSuspenseQueries-DohIOUYY.js} +1 -1
  206. package/dist/client/assets/{variant-calendar-DjuUZNmE.js → variant-calendar-DxXS9CiZ.js} +1 -1
  207. package/dist/client/assets/{view-mode-toggle-zxXxzJo1.js → view-mode-toggle-D2SvIjQW.js} +1 -1
  208. package/dist/client/index.html +2 -2
  209. package/dist/server/cli.js +24 -18
  210. package/dist/server/server.js +12 -12
  211. package/package.json +1 -1
  212. package/dist/client/assets/agent-icon-BvWwsV9-.js +0 -1
  213. package/dist/client/assets/ai-providers-Cc-Qaitu.js +0 -1
  214. package/dist/client/assets/app-editor-b3ZDQT3y.js +0 -1
  215. package/dist/client/assets/automations-DHGV1vHN.js +0 -1
  216. package/dist/client/assets/capability-load-error-ocuq5X52.js +0 -1
  217. package/dist/client/assets/category-editor-BnbZ-tzO.js +0 -1
  218. package/dist/client/assets/collection-detail-DJv60Khn.js +0 -1
  219. package/dist/client/assets/connection-detail-CkHKK3hC.js +0 -1
  220. package/dist/client/assets/context-menu-BukQHkkX.js +0 -1
  221. package/dist/client/assets/file-explorer-CE7vUpn6.js +0 -2
  222. package/dist/client/assets/github-repo-picker-BS2-yyCb.js +0 -1
  223. package/dist/client/assets/index-BpE19-ck.js +0 -1
  224. package/dist/client/assets/index-BvU5lMjs.js +0 -1
  225. package/dist/client/assets/index-D9mYZCKV.css +0 -1
  226. package/dist/client/assets/index-DVXwW1US.js +0 -173
  227. package/dist/client/assets/index-DsqZHRRi.js +0 -3
  228. package/dist/client/assets/index-lxZN2uXp.js +0 -1
  229. package/dist/client/assets/page-seo-sheet-CRRHJ6vi.js +0 -1
  230. package/dist/client/assets/popover-BIbjLTCp.js +0 -1
  231. package/dist/client/assets/post-editor-DeJ4iIDf.js +0 -1
  232. package/dist/client/assets/project-app-view-Bw4pBi_7.js +0 -1
  233. package/dist/client/assets/record-editor-BMbdlgjH.js +0 -1
  234. package/dist/client/assets/registry-D7x-icQ2.js +0 -2
  235. package/dist/client/assets/roles-BOurXkap.js +0 -1
  236. package/dist/client/assets/select-DtrgZFUN.js +0 -1
  237. package/dist/client/assets/seo-editor-D3daX9h9.js +0 -1
  238. package/dist/client/assets/settings-layout-CmO92Idf.js +0 -1
  239. package/dist/client/assets/shell-controls-C3e2T-jB.js +0 -1
  240. package/dist/client/assets/shell-route-loading-COjyAVLN.js +0 -1
  241. package/dist/client/assets/sortable.esm-D3HJ-J2L.js +0 -5
  242. package/dist/client/assets/store-registry-CVCe-t3Q.js +0 -2
  243. package/dist/client/assets/switch-CxpAoaO8.js +0 -1
  244. package/dist/client/assets/tabs-B2YmTAz6.js +0 -1
  245. package/dist/client/assets/toggle-group-B-GnyMpd.js +0 -1
  246. package/dist/client/assets/tools-list-D5fafb0R.js +0 -1
  247. package/dist/client/assets/tooltip-BN4g0v-x.js +0 -1
  248. package/dist/client/assets/use-navigate-to-agent-C9zrAPJx.js +0 -1
  249. package/dist/client/assets/use-org-fs-BToe7wyo.js +0 -1
  250. package/dist/client/assets/useInfiniteQuery-DnUFt-2J.js +0 -1
  251. package/dist/client/assets/useSuspenseInfiniteQuery-CPNNqGjW.js +0 -1
@@ -1 +1 @@
1
- import{bz as _}from"./index-B6CxQrCo.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
1
+ import{bs as _}from"./index-DHTICC_v.js";var S={exports:{}},r={};var $;function I(){if($)return r;$=1;var m=Symbol.for("react.element"),y=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),f=Symbol.for("react.context"),x=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),l=Symbol.for("react.suspense_list"),a=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),b;b=Symbol.for("react.module.reference");function t(e){if(typeof e=="object"&&e!==null){var d=e.$$typeof;switch(d){case m:switch(e=e.type,e){case o:case s:case n:case i:case l:return e;default:switch(e=e&&e.$$typeof,e){case x:case f:case u:case p:case a:case c:return e;default:return d}}case y:return d}}}return r.ContextConsumer=f,r.ContextProvider=c,r.Element=m,r.ForwardRef=u,r.Fragment=o,r.Lazy=p,r.Memo=a,r.Portal=y,r.Profiler=s,r.StrictMode=n,r.Suspense=i,r.SuspenseList=l,r.isAsyncMode=function(){return!1},r.isConcurrentMode=function(){return!1},r.isContextConsumer=function(e){return t(e)===f},r.isContextProvider=function(e){return t(e)===c},r.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===m},r.isForwardRef=function(e){return t(e)===u},r.isFragment=function(e){return t(e)===o},r.isLazy=function(e){return t(e)===p},r.isMemo=function(e){return t(e)===a},r.isPortal=function(e){return t(e)===y},r.isProfiler=function(e){return t(e)===s},r.isStrictMode=function(e){return t(e)===n},r.isSuspense=function(e){return t(e)===i},r.isSuspenseList=function(e){return t(e)===l},r.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===o||e===s||e===n||e===i||e===l||e===R||typeof e=="object"&&e!==null&&(e.$$typeof===p||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===u||e.$$typeof===b||e.getModuleId!==void 0)},r.typeOf=t,r}var v;function C(){return v||(v=1,S.exports=I()),S.exports}var g=C();const h=_(g);export{h as R,g as r};
@@ -0,0 +1 @@
1
+ import{c as k,j as n,r as A,G as J,m as xe,l as Q,i as le,af as Z,t as K,K as te,k as se,B as Y,d as nt,V as it,E as ot,a as rt,b as lt,u as at}from"./index-DHTICC_v.js";import{u as ge}from"./use-mobile-BkWraisf.js";import{u as ct}from"./useSuspenseQueries-DohIOUYY.js";import{i as dt,u as ae,m as mt,a as ut,S as ft}from"./use-mcp-client-DAJmDOVO.js";import{a as pt,b as ht,v as xt,u as gt}from"./use-virtual-mcp-CJycW-Qv.js";import{i as bt}from"./ChevronUp-DBXbYduj.js";import{b as Pe,a as Se}from"./ZoomOut-CwXzA7X6.js";import{i as yt,A as ce,t as jt,ad as vt,E as Nt,h as wt}from"./agent-icon-BRuLsBYY.js";import{s as be}from"./Plus-Bz2JwGOE.js";import{i as ye}from"./X-BQZZQdg0.js";import{p as St}from"./index-Cgz2WBho.js";import{b as Ee,c as oe,K as Me,P as ze,D as Le,d as _t,S as Ct,v as It,g as Tt,h as kt,i as $t,f as At,e as Pt,n as Et,C as re,L as Mt,k as zt}from"./library-tab-DZNwBek9.js";import{f as Lt,d as Ot}from"./tab-id-DPNwWMUY.js";import{b as Dt}from"./chat-context-CIKFBD8u.js";import{N as Ht}from"./decopilot-D_-94MU_.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-C8WZk9re.js";import{u as Oe,a as De,o as Vt}from"./use-organization-settings-D9G2tGsW.js";import{c as je,b as Kt,h as Wt}from"./shell-layout-QzfqSuxf.js";import{I as He}from"./input-DgsFOGyM.js";import{S as qt,t as ve,P as Gt,j as Qt,s as Jt,g as Xt}from"./scroll-area-C8YtCymQ.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-B3q7nz8B.js";import{S as V}from"./skeleton-f0d6RrIL.js";import{t as Re}from"./ChevronDown-BLALKRGM.js";import{g as Fe,M as ns}from"./types-BHL4d6ji.js";import{I as Ue}from"./integration-icon-m6Sa_hcd.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-DzzBmNmo.js";import{T as as}from"./textarea-Dp78LmPE.js";import{u as Be}from"./studio-tools-D6ANxpFE.js";import{a as cs}from"./use-mcp-tools-AjHzJbIQ.js";import{i as ds}from"./XCircle-BOFvuFHl.js";import{g as ms}from"./use-mcp-prompts-D3eulxzR.js";import{b as us,w as fs}from"./hooks-UY6BFV6z.js";import{a as ps,g as hs,c as xs,b as gs,D as bs}from"./dropdown-menu-8PMbgM0q.js";import{s as ys}from"./Trash01-kVRWRMat.js";import{a as js,u as vs}from"./use-ai-providers-CVS8EjHf.js";import{u as Ns}from"./connect-desktop-dialog-DRNK5Zqx.js";import{T as ws}from"./toolbar-C1WgDWOZ.js";import"./auth-pLLkIszG.js";import"./use-collections-BnOL5hT8.js";import"./AlertCircle-D8gnDqwf.js";import"./Tool01-DrE6CqtR.js";import"./SwitchHorizontal01-Bcp8nSOf.js";import"./Settings02-N32UBNZq.js";import"./ArrowUpRight-BlXghneM.js";import"./ZapSquare-D4RqdrSL.js";import"./Users03-K1B4uaw7.js";import"./CheckCircle-DCCFCHyS.js";import"./ChevronRight-Gacf5_E2.js";import"./DotsVertical-D7ryssxp.js";import"./Stars02-BpRz9194.js";import"./Eye-BFLaa-Ve.js";import"./Globe01-Bx-hz-as.js";import"./FilterLines-CK4jmUMp.js";import"./Star01-GFElhP7X.js";import"./Globe04-u6eY2Kop.js";import"./HardDrive-B06hZ2KP.js";import"./Key01-D0oVN5CX.js";import"./LayoutLeft-1bN-FR8E.js";import"./LinkExternal01-D4vA-I3a.js";import"./Monitor01-DrJKeSJ4.js";import"./Sun-CRJdfBLT.js";import"./Palette-CvuWqoBi.js";import"./Play-DuOwU6E2.js";import"./SearchLg-CfwbHNr5.js";import"./SearchMd-Bn2Kbs9E.js";import"./Shield01-BztOm8mA.js";import"./Stars01-CK-XatBt.js";import"./Upload01-TiHLQTwG.js";import"./User01-9o9EbE3X.js";import"./Users01-CMbqiB_R.js";import"./XClose-ChRyc7zA.js";import"./Zap-RN8PAcZE.js";import"./alert-dialog-D87-BKea.js";import"./dialog-BdIjDk0G.js";import"./file-type-icon-Bx1NX_Gy.js";import"./use-debounced-value-C2hJqHIV.js";import"./popover-4-S-2t4S.js";import"./tooltip-CWNyrHYY.js";import"./index-BwaOBBZ-.js";import"./drawer-D1X6O6Aa.js";import"./collection-search-B0gYtEWh.js";import"./form-P-LOMg0X.js";import"./label-CwMsBEmc.js";import"./tabs-ByVhqny2.js";import"./toggle-group-BIoy7tOG.js";import"./command-VE4J0WmB.js";import"./index-BbFfuuHN.js";import"./useInfiniteQuery-Bl42Nudd.js";import"./use-infinite-scroll-DFBavgZf.js";import"./question-004-sINsf4GQ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-Dzp4nWAC.js";import"./use-registry-connections-CTTYiKTQ.js";import"./use-connection-CRsO-Bab.js";import"./extract-connection-data-BhI39RpO.js";import"./card-D-LCVQQb.js";import"./collection-tabs-DGDRpyxJ.js";import"./badge-wh5eWpb9.js";import"./connection-form-helpers-BKzMCiDP.js";import"./authenticate-and-persist-oauth-VdmVLbtW.js";import"./mcp-oauth-SxDhA9AX.js";import"./useSuspenseInfiniteQuery-uA0LQwFa.js";import"./use-decopilot-events-BB7o7ets.js";import"./decopilot-sse-pool-DA88fFcW.js";import"./backoff-CrEUbyZT.js";import"./checkbox-CFdij7Ei.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-DxH3BnSs.js";import"./settings-section-rq7s23q-.js";import"./required-auth-layout-B0YEEBld.js";import"./use-org-sso-CEETlaem.js";import"./use-clock-tick-BXZK-6ig.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DK8lBdjB.js";import"./content-blocks-o63cs2vh.js";import"./use-navigate-to-agent-Dlhjy-0a.js";import"./delay-CnY5UFtP.js";function Ve(t){const e=k.c(11),{properties:s,required:o,values:i,onChange:r}=t;let a;e[0]!==o?(a=o??[],e[0]=o,e[1]=a):a=e[1];let d;e[2]!==a?(d=new Set(a),e[2]=a,e[3]=d):d=e[3];const l=d;let m;e[4]!==s?(m=Object.entries(s),e[4]=s,e[5]=m):m=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==m||e[9]!==i?(c=n.jsx("div",{className:"flex flex-col gap-2",children:m.map(u=>{const[f,p]=u;return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsxs("label",{className:"text-xs font-medium leading-none flex items-center gap-1",children:[f,l.has(f)&&n.jsx("span",{className:"text-red-500 text-[10px]",children:"*"})]}),n.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:p.type})]}),p.description&&n.jsx("p",{className:"text-[10px] text-muted-foreground leading-snug",children:p.description}),n.jsx(Ss,{type:p.type,fieldKey:f,value:i[f],onChange:h=>r(f,h)})]},f)})}),e[6]=r,e[7]=l,e[8]=m,e[9]=i,e[10]=c):c=e[10],c}function Ss(t){const e=k.c(19),{type:s,fieldKey:o,value:i,onChange:r}=t;if(s==="object"||s==="array"){const c=i??"";let u;e[0]!==r?(u=h=>r(h.target.value),e[0]=r,e[1]=u):u=e[1];const f=`Enter ${o} as JSON…`;let p;return e[2]!==c||e[3]!==u||e[4]!==f?(p=n.jsx(as,{className:"font-mono text-xs h-16",value:c,onChange:u,placeholder:f,rows:2}),e[2]=c,e[3]=u,e[4]=f,e[5]=p):p=e[5],p}if(s==="boolean"){const c=i!=null?String(i):"";let u;e[6]!==r?(u=g=>r(g==="true"),e[6]=r,e[7]=u):u=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(is,{className:"h-7 text-xs",children:n.jsx(os,{placeholder:"Select…"})}),e[8]=f):f=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsxs(rs,{children:[n.jsx(_e,{value:"true",children:"true"}),n.jsx(_e,{value:"false",children:"false"})]}),e[9]=p):p=e[9];let h;return e[10]!==c||e[11]!==u?(h=n.jsxs(ls,{value:c,onValueChange:u,children:[f,p]}),e[10]=c,e[11]=u,e[12]=h):h=e[12],h}const a=i??"";let d;e[13]!==r?(d=c=>r(c.target.value),e[13]=r,e[14]=d):d=e[14];const l=`Enter ${o}…`;let m;return e[15]!==a||e[16]!==d||e[17]!==l?(m=n.jsx(He,{className:"h-7 text-xs",value:a,onChange:d,placeholder:l}),e[15]=a,e[16]=d,e[17]=l,e[18]=m):m=e[18],m}const ne=8;function _s(t){const e=k.c(16),{open:s,onOpenChange:o}=t,[i,r]=A.useState("");let a,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx(Zt,{children:"Manage home"}),d=n.jsx(Yt,{children:"Add agents to the home board and pin their interactive UIs or prompts."}),e[0]=a,e[1]=d):(a=e[0],d=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(yt,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none","aria-hidden":!0}),e[2]=l):l=e[2];let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=g=>r(g.target.value),e[3]=m):m=e[3];let c;e[4]!==i?(c=n.jsxs(es,{className:"px-5 py-4 border-b border-border",children:[a,d,n.jsxs("div",{className:"relative mt-3",children:[l,n.jsx(He,{value:i,onChange:m,placeholder:"Search agents…",className:"pl-8 h-8 text-sm"})]})]}),e[4]=i,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(tn,{}),e[6]=u):u=e[6];let f;e[7]!==i?(f=n.jsx(qt,{className:"flex-1 min-h-0 [&_[data-slot=scroll-area-viewport]>div]:!block",children:n.jsx("div",{className:"p-3 flex flex-col gap-4",children:n.jsx(A.Suspense,{fallback:u,children:n.jsx(Is,{search:i})})})}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==c||e[10]!==f?(p=n.jsxs(ts,{side:"right",className:"w-full sm:max-w-md p-0 flex flex-col",children:[c,f]}),e[9]=c,e[10]=f,e[11]=p):p=e[11];let h;return e[12]!==o||e[13]!==s||e[14]!==p?(h=n.jsx(ss,{open:s,onOpenChange:o,children:p}),e[12]=o,e[13]=s,e[14]=p,e[15]=h):h=e[15],h}function Cs(t){const e=k.c(32),{org:s}=J(),o=Oe();let i;e[0]!==o?.ids?(i=o?.ids??[],e[0]=o?.ids,e[1]=i):i=e[1];const r=i,a=De(),d=ht(),l=xe();let m;e[2]!==s||e[3]!==l?(m=()=>l.refetchQueries({queryKey:te.homeNextActions(s.slug),type:"active"}),e[2]=s,e[3]=l,e[4]=m):m=e[4];const c=m;let u;e[5]!==r?(u=_=>r.includes(_),e[5]=r,e[6]=u):u=e[6];const f=u;let p;e[7]!==r||e[8]!==t?(p=t?r.filter(_=>t.has(_)).length:r.length,e[7]=r,e[8]=t,e[9]=p):p=e[9];const g=p>=ne;let b;e[10]!==g||e[11]!==f||e[12]!==a?(b=_=>f(_)||g?Promise.resolve():a.apply(C=>C.includes(_)?null:[...C,_]),e[10]=g,e[11]=f,e[12]=a,e[13]=b):b=e[13];const y=b;let N;e[14]!==a?(N=_=>a.apply(C=>C.filter(I=>I!==_)),e[14]=a,e[15]=N):N=e[15];const v=N;let j;e[16]!==a?(j=_=>a.apply(()=>_),e[16]=a,e[17]=j):j=e[17];const x=j;let w;e[18]!==d||e[19]!==g||e[20]!==f||e[21]!==c||e[22]!==a?(w=async(_,C)=>{await d.update.mutateAsync({id:_.id,data:{metadata:C}}),!f(_.id)&&!g&&await a.apply(I=>I.includes(_.id)?null:[...I,_.id]),await c()},e[18]=d,e[19]=g,e[20]=f,e[21]=c,e[22]=a,e[23]=w):w=e[23];const S=w;let T;return e[24]!==y||e[25]!==g||e[26]!==r||e[27]!==f||e[28]!==v||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:v,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=v,e[29]=x,e[30]=S,e[31]=T):T=e[31],T}function Is(t){const e=k.c(21),{search:s}=t;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={pageSize:1e3},e[0]=o):o=e[0];const i=pt(o);let r;e[1]!==i?(r=new Set(i.map(Ps)),e[1]=i,e[2]=r):r=e[2];const a=Cs(r);let d,l,m;if(e[3]!==i||e[4]!==a||e[5]!==s){const g=new Map(i.map(As));d=s.trim().toLowerCase();const b=v=>!d||v.title?.toLowerCase().includes(d);l=a.homeIds.map(v=>g.get(v)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=v=>!a.isOnHome(v.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(v=>!y.has(v.id)).filter(N).filter(b).sort(Ts),e[3]=i,e[4]=a,e[5]=s,e[6]=d,e[7]=l,e[8]=m}else d=e[6],l=e[7],m=e[8];const c=m;let u;e[11]!==a||e[12]!==l?(u=n.jsx(Es,{home:a,agents:l}),e[11]=a,e[12]=l,e[13]=u):u=e[13];const f=!!d;let p;e[14]!==c||e[15]!==a||e[16]!==f?(p=n.jsx(Ls,{home:a,agents:c,hasSearch:f}),e[14]=c,e[15]=a,e[16]=f,e[17]=p):p=e[17];let h;return e[18]!==u||e[19]!==p?(h=n.jsxs(n.Fragment,{children:[u,p]}),e[18]=u,e[19]=p,e[20]=h):h=e[20],h}function Ts(t,e){return(t.title??"").localeCompare(e.title??"")}function ks(t){return t.id&&!dt(t.id)}function $s(t){return!!t}function As(t){return[t.id,t]}function Ps(t){return t.id}function Ke(t){const e=k.c(7),{title:s,hint:o}=t;let i;e[0]!==s?(i=n.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s}),e[0]=s,e[1]=i):i=e[1];let r;e[2]!==o?(r=o&&n.jsx("span",{className:"text-xs text-muted-foreground",children:o}),e[2]=o,e[3]=r):r=e[3];let a;return e[4]!==i||e[5]!==r?(a=n.jsxs("div",{className:"flex items-center justify-between px-1",children:[i,r]}),e[4]=i,e[5]=r,e[6]=a):a=e[6],a}function Es(t){const e=k.c(14),{home:s,agents:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={activationConstraint:{distance:5}},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r={coordinateGetter:$t},e[1]=r):r=e[1];const a=Ee(oe(ze,i),oe(Me,r));let d;e[2]!==s?(d=p=>{const{active:h,over:g}=p;if(!g||h.id===g.id)return;const b=s.homeIds,y=b.indexOf(h.id),N=b.indexOf(g.id);y===-1||N===-1||s.reorder(At([...b],y,N)).catch(zs)},e[2]=s,e[3]=d):d=e[3];const l=d,m=`${s.homeIds.length}/${ne}`;let c;e[4]!==m?(c=n.jsx(Ke,{title:"On home",hint:m}),e[4]=m,e[5]=c):c=e[5];let u;e[6]!==o||e[7]!==l||e[8]!==s||e[9]!==a?(u=o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:"No agents on the home yet."}):n.jsx(Le,{sensors:a,collisionDetection:_t,onDragEnd:l,children:n.jsx(Ct,{items:o.map(Ms),strategy:It,children:n.jsx("div",{className:"flex flex-col gap-1",children:o.map(p=>n.jsx(Ds,{agent:p,home:s},p.id))})})}),e[6]=o,e[7]=l,e[8]=s,e[9]=a,e[10]=u):u=e[10];let f;return e[11]!==c||e[12]!==u?(f=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[c,u]}),e[11]=c,e[12]=u,e[13]=f):f=e[13],f}function Ms(t){return t.id}function zs(){return K.error("Couldn't reorder home — please try again.")}function Ls(t){const e=k.c(6),{home:s,agents:o,hasSearch:i}=t,[r,a]=A.useState(20);let d;if(e[0]!==o||e[1]!==i||e[2]!==s||e[3]!==r){const l=o.slice(0,r);let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx(Ke,{title:"Add to home"}),e[5]=m):m=e[5],d=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,o.length===0?n.jsx("p",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:i?"No agents match.":"Every agent is on the home."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-col gap-1",children:l.map(c=>n.jsx(Fs,{agent:c,home:s},c.id))}),o.length>r&&n.jsxs("button",{type:"button",onClick:()=>a(Os),className:"mt-1 self-center rounded-md px-3 py-1.5 text-xs text-muted-foreground hover:bg-accent/40 hover:text-foreground",children:["Load more (",o.length-r,")"]})]})]}),e[0]=o,e[1]=i,e[2]=s,e[3]=r,e[4]=d}else d=e[4];return d}function Os(t){return t+20}function We(t){const e=Z(t.metadata?.ui).filter(r=>!!r.resourceUri).length,s=t.metadata?.ui?.homePrompts,o=Array.isArray(s)?s.length:null,i=[];return e>0&&i.push(`${e} tile${e===1?"":"s"}`),o!==null&&o>0&&i.push(`${o} prompt${o===1?"":"s"}`),o===0&&i.push("prompts off"),i.join(" · ")}function Ds(t){const e=k.c(57),{agent:s,home:o}=t,[i,r]=A.useState(!1);let a;e[0]!==s.id?(a={id:s.id},e[0]=s.id,e[1]=a):a=e[1];const{attributes:d,listeners:l,setNodeRef:m,transform:c,transition:u,isDragging:f}=Tt(a),p=We(s)||"Quick access";let h;e[2]!==c?(h=kt.Transform.toString(c),e[2]=c,e[3]=h):h=e[3];const g=f?.5:void 0,b=f?100:void 0;let y;e[4]!==h||e[5]!==g||e[6]!==b||e[7]!==u?(y={transform:h,transition:u,opacity:g,zIndex:b},e[4]=h,e[5]=g,e[6]=b,e[7]=u,e[8]=y):y=e[8];const N=y,v=f&&"shadow-lg";let j;e[9]!==v?(j=Q("rounded-lg border border-border bg-card",v),e[9]=v,e[10]=j):j=e[10];const x=`Drag to reorder ${s.title??s.id}`;let w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w=n.jsx(Pe,{size:14}),e[11]=w):w=e[11];let S;e[12]!==d||e[13]!==l||e[14]!==x?(S=n.jsx("button",{type:"button",...d,...l,className:"shrink-0 text-muted-foreground hover:text-foreground cursor-grab active:cursor-grabbing outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":x,children:w}),e[12]=d,e[13]=l,e[14]=x,e[15]=S):S=e[15];let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=()=>r(Rs),e[16]=T):T=e[16];const _=s.title??s.id;let C;e[17]!==s.icon||e[18]!==_?(C=n.jsx(ce,{icon:s.icon,name:_,size:"sm"}),e[17]=s.icon,e[18]=_,e[19]=C):C=e[19];const I=s.title??s.id;let P;e[20]!==I?(P=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:I}),e[20]=I,e[21]=P):P=e[21];let M;e[22]!==p?(M=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=M):M=e[23];let z;e[24]!==P||e[25]!==M?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,M]}),e[24]=P,e[25]=M,e[26]=z):z=e[26];const H=i&&"rotate-180";let L;e[27]!==H?(L=Q("shrink-0 text-muted-foreground transition-transform",H),e[27]=H,e[28]=L):L=e[28];let D;e[29]!==L?(D=n.jsx(Re,{size:16,className:L}),e[29]=L,e[30]=D):D=e[30];let U;e[31]!==i||e[32]!==C||e[33]!==z||e[34]!==D?(U=n.jsxs("button",{type:"button",onClick:T,className:"flex min-w-0 flex-1 items-center gap-2.5 text-left outline-none","aria-expanded":i,children:[C,z,D]}),e[31]=i,e[32]=C,e[33]=z,e[34]=D,e[35]=U):U=e[35];let $;e[36]!==s.id||e[37]!==o?($=()=>o.removeAgent(s.id).catch(Hs),e[36]=s.id,e[37]=o,e[38]=$):$=e[38];const R=`Remove ${s.title??s.id} from home`;let O;e[39]===Symbol.for("react.memo_cache_sentinel")?(O=n.jsx(ye,{size:14}),e[39]=O):O=e[39];let E;e[40]!==$||e[41]!==R?(E=n.jsx("button",{type:"button",onClick:$,"aria-label":R,title:"Remove from home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive",children:O}),e[40]=$,e[41]=R,e[42]=E):E=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==E?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,E]}),e[43]=S,e[44]=U,e[45]=E,e[46]=F):F=e[46];let B;e[47]!==s||e[48]!==i||e[49]!==o?(B=i&&n.jsx(qe,{agent:s,home:o}),e[47]=s,e[48]=i,e[49]=o,e[50]=B):B=e[50];let W;return e[51]!==m||e[52]!==N||e[53]!==F||e[54]!==B||e[55]!==j?(W=n.jsxs("div",{ref:m,style:N,className:j,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=j,e[56]=W):W=e[56],W}function Hs(){return K.error("Couldn't remove from home — please try again.")}function Rs(t){return!t}function Fs({agent:t,home:e}){const[s,o]=A.useState(!1),[i,r]=A.useState(!1),a=We(t),d=async()=>{if(!e.atLimit){r(!0);try{await e.addAgent(t.id)}catch{K.error("Couldn't add to home — please try again.")}finally{r(!1)}}};return n.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[n.jsxs("button",{type:"button",onClick:()=>o(l=>!l),className:"flex min-w-0 flex-1 items-center gap-3 text-left outline-none","aria-expanded":s,children:[n.jsx(ce,{icon:t.icon,name:t.title??t.id,size:"sm"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.title??t.id}),a&&n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:a})]}),n.jsx(Re,{size:16,className:Q("shrink-0 text-muted-foreground transition-transform",s&&"rotate-180")})]}),n.jsx("button",{type:"button",onClick:d,disabled:i||e.atLimit,"aria-label":"Add to home",title:e.atLimit?`Home is full (${ne}) — remove an agent first`:"Add to home",className:"shrink-0 inline-flex size-7 items-center justify-center rounded-md bg-foreground text-background text-xs hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:i?n.jsx(le,{size:12,className:"animate-spin"}):n.jsx(be,{size:14})})]}),s&&n.jsx(qe,{agent:t,home:e})]})}function qe(t){const e=k.c(17),{agent:s,home:o}=t,i=s.metadata?.ui;let r;e[0]!==i?(r=Z(i),e[0]=i,e[1]=r):r=e[1];const a=r;let d;e[2]!==s.connections?(d=(s.connections??[]).map(Us).sort(),e[2]=s.connections,e[3]=d):d=e[3];const l=d,m=s.metadata?.ui?.homePrompts;let c;e[4]!==s||e[5]!==l||e[6]!==o||e[7]!==a?(c=n.jsx(Vs,{agent:s,home:o,connectionIds:l,pinnedTiles:a}),e[4]=s,e[5]=l,e[6]=o,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(Bs,{}),e[9]=u):u=e[9];const f=m??null;let p;e[10]!==s||e[11]!==o||e[12]!==f?(p=n.jsx(A.Suspense,{fallback:u,children:n.jsx(Qs,{agent:s,home:o,curated:f})}),e[10]=s,e[11]=o,e[12]=f,e[13]=p):p=e[13];let h;return e[14]!==c||e[15]!==p?(h=n.jsxs("div",{className:"border-t border-border px-3 py-2 flex flex-col gap-3",children:[c,p]}),e[14]=c,e[15]=p,e[16]=h):h=e[16],h}function Us(t){return t.connection_id}function Bs(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex flex-col gap-2 py-1",children:[n.jsx(V,{className:"h-8 w-full"}),n.jsx(V,{className:"h-8 w-2/3"})]}),t[0]=e):e=t[0],e}function Vs({agent:t,home:e,connectionIds:s,pinnedTiles:o}){const i=Be(),{data:r,isLoading:a}=se({queryKey:te.projectConnectionDetails(t.id,s),enabled:s.length>0,queryFn:async()=>(await Promise.all(s.map(async u=>{try{const{item:f}=await i.call("COLLECTION_CONNECTIONS_GET",{id:u}),p=(f?.tools??[]).flatMap(h=>{const g=Fe(h._meta);return g?[{name:h.name,description:h.description,resourceUri:g,inputSchema:h.inputSchema}]:[]});return{id:u,title:f?.title??u,icon:f?.icon??null,uiTools:p}}catch{return{id:u,title:u,icon:null,uiTools:[]}}}))).filter(u=>u.uiTools.length>0)});if(s.length===0)return null;if(a)return n.jsxs("div",{className:"flex flex-col gap-1 py-0.5",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]});if(!r||r.length===0)return null;const d=new Map;for(const c of r)for(const u of c.uiTools)d.set(`${c.id}:${u.name}`,{conn:c,tool:u});const l=c=>{if(c.toolName&&c.connectionId)return d.get(`${c.connectionId}:${c.toolName}`);for(const[,u]of d)if(u.conn.id===c.connectionId&&u.tool.resourceUri===c.resourceUri)return u},m=o.some(c=>!!l(c));return n.jsxs("div",{className:"flex flex-col gap-2",children:[m&&n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Pinned tiles"}),o.map(c=>{const u=l(c);return u?n.jsx(qs,{agent:t,home:e,connection:u.conn,tool:u.tool,tile:c},c.tileId??`${c.connectionId}:${c.resourceUri}:${c.toolName}`):null})]}),n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsx("span",{className:"text-[10px] font-medium uppercase tracking-wide text-muted-foreground px-2",children:"Add tile"}),r.map(c=>c.uiTools.map(u=>n.jsx(Gs,{agent:t,home:e,connection:c,tool:u},`add:${c.id}:${u.name}`)))]})]})}function Ge(t,e){const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;if((r==="object"||r==="array")&&typeof i=="string"){if(!i.trim())continue;try{s[o]=JSON.parse(i)}catch{return null}}else if((r==="number"||r==="integer")&&typeof i=="string"){if(!i.trim())continue;s[o]=Number(i)}else i!==""&&i!=null&&(s[o]=i)}return s}function Ks(t,e){if(!t||!e)return{};const s={};for(const[o,i]of Object.entries(t)){const r=e[o]?.type;(r==="object"||r==="array")&&i!=null&&typeof i!="string"?s[o]=JSON.stringify(i,null,2):s[o]=i}return s}function Ws(t){if(!t)return"";const e=Object.entries(t).filter(([,s])=>s!=null&&s!=="");return e.length===0?"":e.slice(0,3).map(([s,o])=>{const i=typeof o=="object"?JSON.stringify(o):String(o);return`${s}=${i.length>20?`${i.slice(0,20)}…`:i}`}).join(", ")}function qs({agent:t,home:e,connection:s,tool:o,tile:i}){const[r,a]=A.useState(!1),[d,l]=A.useState(!1),m=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[c,u]=A.useState(()=>Ks(i.toolInput,o.inputSchema?.properties)),f=async()=>{a(!0);try{const g=Z(t.metadata?.ui),b=i.tileId?g.filter(N=>N.tileId!==i.tileId):g.filter(N=>N!==i),y={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:b}};await e.saveAgentMetadata(t,y),l(!1)}catch(g){console.error("[home-tiles] failed to remove tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},p=async()=>{a(!0);try{let g;if(m&&o.inputSchema?.properties){const v=Ge(c,o.inputSchema.properties);if(!v){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(v).length>0&&(g=v)}const y=Z(t.metadata?.ui).map(v=>(i.tileId?v.tileId===i.tileId:v===i)?{...v,toolInput:g}:v),N={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:y}};await e.saveAgentMetadata(t,N),l(!1)}catch(g){console.error("[home-tiles] failed to save tile",g),K.error("Couldn't update home — please try again.")}finally{a(!1)}},h=Ws(i.toolInput);return n.jsxs("div",{className:"flex flex-col rounded-md bg-accent/20",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate text-sm text-foreground",children:ve(o.name)}),h&&n.jsx("div",{className:"truncate text-[10px] text-muted-foreground font-mono",children:h})]}),m&&n.jsx("button",{type:"button",onClick:()=>l(g=>!g),"aria-label":"Configure tile props",title:"Configure tile props",className:"inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-accent/60",children:n.jsx(jt,{size:14})}),n.jsx(Ne,{isPinned:!0,submitting:r,onClick:f,label:"Remove from home"})]}),d&&m&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:c,onChange:(g,b)=>u(y=>({...y,[g]:b}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>l(!1),children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:r,onClick:p,children:r?n.jsx(le,{size:12,className:"animate-spin"}):"Save"})]})]})]})}function Gs({agent:t,home:e,connection:s,tool:o}){const[i,r]=A.useState(!1),[a,d]=A.useState(!1),l=o.inputSchema?.properties&&Object.keys(o.inputSchema.properties).length>0,[m,c]=A.useState({}),u=async()=>{if(l&&!a){d(!0);return}if(!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}await f()},f=async()=>{r(!0);try{let p;if(l&&o.inputSchema?.properties){const y=Ge(m,o.inputSchema.properties);if(!y){K.error("Invalid JSON in one of the fields — please fix it."),r(!1);return}Object.keys(y).length>0&&(p=y)}const g=[...Z(t.metadata?.ui),{tileId:crypto.randomUUID(),connectionId:s.id,resourceUri:o.resourceUri,toolName:o.name,...p?{toolInput:p}:{}}],b={...t.metadata??{},ui:{...t.metadata?.ui??{},homeTile:null,homeTiles:g}};await e.saveAgentMetadata(t,b),d(!1),c({})}catch(p){console.error("[home-tiles] failed to add tile",p),K.error("Couldn't update home — please try again.")}finally{r(!1)}};return n.jsxs("div",{className:"flex flex-col rounded-md hover:bg-accent/40",children:[n.jsxs("div",{className:"flex items-center gap-2.5 px-2 py-1",children:[n.jsx(Ue,{icon:s.icon,name:s.title,size:"xs"}),n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:ve(o.name)}),n.jsx(Ne,{isPinned:!1,submitting:i,onClick:u,label:"Add to home"})]}),a&&l&&o.inputSchema?.properties&&n.jsxs("div",{className:"px-3 pb-2 pt-1 flex flex-col gap-2",children:[n.jsx(Ve,{properties:o.inputSchema.properties,required:o.inputSchema.required,values:m,onChange:(p,h)=>c(g=>({...g,[p]:h}))}),n.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[n.jsx(Y,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>{d(!1),c({})},children:"Cancel"}),n.jsx(Y,{size:"sm",className:"h-7 text-xs",disabled:i,onClick:f,children:i?n.jsx(le,{size:12,className:"animate-spin"}):"Pin"})]})]})]})}function Ne(t){const e=k.c(11),{isPinned:s,submitting:o,onClick:i,label:r}=t,a=s?"text-muted-foreground hover:bg-destructive/10 hover:text-destructive":"bg-foreground text-background hover:opacity-90";let d;e[0]!==a?(d=Q("inline-flex size-7 shrink-0 items-center justify-center rounded-md text-xs transition-colors disabled:opacity-50 disabled:cursor-progress",a),e[0]=a,e[1]=d):d=e[1];let l;e[2]!==s||e[3]!==o?(l=o?n.jsx(le,{size:12,className:"animate-spin"}):s?n.jsx(vt,{size:14}):n.jsx(be,{size:14}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let m;return e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==d||e[9]!==l?(m=n.jsx("button",{type:"button",onClick:i,disabled:o,"aria-label":r,title:r,className:d,children:l}),e[5]=r,e[6]=i,e[7]=o,e[8]=d,e[9]=l,e[10]=m):m=e[10],m}function Qs(t){const e=k.c(32),{agent:s,home:o,curated:i}=t,{org:r}=J();let a;e[0]!==s.id||e[1]!==r.id||e[2]!==r.slug?(a={connectionId:s.id,orgId:r.id,orgSlug:r.slug},e[0]=s.id,e[1]=r.id,e[2]=r.slug,e[3]=a):a=e[3];const d=ae(a);let l;e[4]!==s.id||e[5]!==r.id?(l=te.agentPrompts(r.id,s.id),e[4]=s.id,e[5]=r.id,e[6]=l):l=e[6];let m;e[7]!==d?(m=async()=>{const{prompts:x}=await d.listPrompts();return x.map(Ys)},e[7]=d,e[8]=m):m=e[8];let c;e[9]!==l||e[10]!==m?(c={queryKey:l,queryFn:m,staleTime:3e4,retry:!1},e[9]=l,e[10]=m,e[11]=c):c=e[11];const{data:u,isLoading:f,error:p}=se(c),h=je(r.slug);let g,b;if(e[12]!==s.id||e[13]!==u||e[14]!==h.prompts){let x;e[17]!==s.id?(x=S=>S.agentId===s.id&&S.promptName,e[17]=s.id,e[18]=x):x=e[18],g=h.prompts.filter(x).map(Zs);let w;e[19]!==u?(w=u??[],e[19]=u,e[20]=w):w=e[20],b=[...w];for(const S of g)b.some(T=>T.name===S.name)||b.push(S);e[12]=s.id,e[13]=u,e[14]=h.prompts,e[15]=g,e[16]=b}else g=e[15],b=e[16];if(f&&g.length===0){let x;return e[21]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx(V,{className:"h-7 w-full"}),n.jsx(V,{className:"h-7 w-2/3"})]}),e[21]=x):x=e[21],x}if(p&&g.length===0)return console.error("[home-tiles] listPrompts failed for agent",s.id,p),null;if(b.length===0)return null;let y;e[22]!==i||e[23]!==b?(y=i??b.map(Xs),e[22]=i,e[23]=b,e[24]=y):y=e[24];let N;e[25]!==y?(N=new Set(y),e[25]=y,e[26]=N):N=e[26];const v=N;let j;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==v?(j=n.jsx("div",{className:"flex flex-col gap-0.5",children:b.map(x=>n.jsx(en,{agent:s,home:o,prompt:x,allPromptNames:b.map(Js),isPinned:v.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=v,e[31]=j):j=e[31],j}function Js(t){return t.name}function Xs(t){return t.name}function Zs(t){return{name:t.promptName,title:t.title,description:t.description}}function Ys(t){return{name:t.name,title:t.title,description:t.description}}function en({agent:t,home:e,prompt:s,allPromptNames:o,isPinned:i}){const[r,a]=A.useState(!1),d=async()=>{if(!i&&!e.isOnHome(t.id)&&e.atLimit){K.error(`Home is full (${ne}) — remove an agent first`);return}a(!0);try{const l=t.metadata?.ui?.homePrompts;let m;Array.isArray(l)?m=i?l.filter(u=>u!==s.name):[...l,s.name]:m=i?o.filter(u=>u!==s.name):o;const c={...t.metadata??{},ui:{...t.metadata?.ui??{},homePrompts:m}};await e.saveAgentMetadata(t,c)}catch(l){console.error("[home-tiles] failed to toggle prompt",l),K.error("Couldn't update home — please try again.")}finally{a(!1)}};return n.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1 hover:bg-accent/40",children:[n.jsx("div",{className:"min-w-0 flex-1 truncate text-sm text-foreground",children:s.title??ve(s.name)}),n.jsx(Ne,{isPinned:i,submitting:r,onClick:d,label:i?"Remove from home":"Add to home"})]})}function tn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"flex flex-col gap-2 p-2",children:Array.from({length:4},sn)}),t[0]=e):e=t[0],e}function sn(t,e){return n.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border p-2.5",children:[n.jsx(V,{className:"size-8 rounded-md"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},e)}const ee=1,Qe=`home-board.layout.v${ee}`;function Je(t){return`home-board.layout.v${ee}.${t}`}const Xe={version:ee,tiles:{},hidden:[]};function fe(t){return!t||t.version!==ee?Xe:{version:ee,tiles:t.tiles??{},hidden:Array.isArray(t.hidden)?t.hidden:[]}}function nn(t){return Object.keys(t.tiles).length>0||t.hidden.length>0}function on(t){try{const e=localStorage.getItem(Je(t));return e?fe(JSON.parse(e)):void 0}catch{return}}function Ce(t,e){try{localStorage.setItem(Je(t),JSON.stringify(e))}catch{}}async function Ie(t,e){if(!(await fetch(`/api/${t}/kv/${Qe}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save board layout")}function rn(t){const e=k.c(24),s=xe();let o;e[0]!==t?(o=te.boardLayout(t),e[0]=t,e[1]=o):o=e[1];const i=o;let r;e[2]!==t?(r=on(t),e[2]=t,e[3]=r):r=e[3];const a=r;let d;e[4]!==a||e[5]!==t?(d=async()=>{const y=await fetch(`/api/${t}/kv/${Qe}`);if(y.status===404)return a&&nn(a)?(await Ie(t,a),a):Xe;if(!y.ok)throw new Error("Failed to load board layout");const N=await y.json(),v=fe(N.value);return Ce(t,v),v},e[4]=a,e[5]=t,e[6]=d):d=e[6];let l;e[7]!==a||e[8]!==i||e[9]!==d?(l={queryKey:i,queryFn:d,initialData:a,staleTime:0,refetchOnWindowFocus:!1},e[7]=a,e[8]=i,e[9]=d,e[10]=l):l=e[10];const{data:m,isLoading:c}=se(l);let u;e[11]!==t?(u={mutationFn:y=>Ie(t,y)},e[11]=t,e[12]=u):u=e[12];const f=nt(u);let p;e[13]!==f||e[14]!==t||e[15]!==s||e[16]!==i?(p=y=>{Ce(t,y),s.setQueryData(i,y),f.mutate(y)},e[13]=f,e[14]=t,e[15]=s,e[16]=i,e[17]=p):p=e[17];const h=p;let g;e[18]!==m?(g=fe(m),e[18]=m,e[19]=g):g=e[19];let b;return e[20]!==c||e[21]!==h||e[22]!==g?(b={layout:g,isLoading:c,save:h},e[20]=c,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}const Ze=A.createContext(null);function ln(t){const e=k.c(24),{children:s}=t,{org:o}=J(),i=rn(o.slug),[r,a]=A.useState(!1),[d,l]=A.useState(null);let m;e[0]!==i.layout?(m=()=>{l(i.layout),a(!0)},e[0]=i.layout,e[1]=m):m=e[1];const c=m;let u;e[2]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{l(null),a(!1)},e[2]=u):u=e[2];const f=u;let p;e[3]!==d||e[4]!==i?(p=()=>{d&&i.save(d),l(null),a(!1)},e[3]=d,e[4]=i,e[5]=p):p=e[5];const h=p,g=r&&d!==null,b=g?d:i.layout;let y;e[6]!==d||e[7]!==g||e[8]!==i.layout?(y=g?JSON.stringify(d)!==JSON.stringify(i.layout):!1,e[6]=d,e[7]=g,e[8]=i.layout,e[9]=y):y=e[9];const N=y;let v;e[10]!==r||e[11]!==i?(v=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=v):v=e[12];const j=v;let x;e[13]!==j||e[14]!==c||e[15]!==N||e[16]!==r||e[17]!==b||e[18]!==h||e[19]!==i.isLoading?(x={isEditMode:r,enter:c,cancel:f,save:h,hasChanges:N,layout:b,isLayoutLoading:i.isLoading,commitLayout:j},e[13]=j,e[14]=c,e[15]=N,e[16]=r,e[17]=b,e[18]=h,e[19]=i.isLoading,e[20]=x):x=e[20];let w;return e[21]!==s||e[22]!==x?(w=n.jsx(Ze.Provider,{value:x,children:s}),e[21]=s,e[22]=x,e[23]=w):w=e[23],w}function Ye(){const t=A.useContext(Ze);if(!t)throw new Error("useHomeEdit must be used within a HomeEditProvider");return t}function an({agentId:t}){const{org:e,locator:s}=J(),o=ae({connectionId:t,orgId:e.id,orgSlug:e.slug}),{create:i}=us(),{setTaskId:r}=Kt(),[a,d]=A.useState(null),[l,m]=A.useState(!1),c=A.useRef(!1),u=async(b,y)=>{if(!o){K.error("MCP client not available");return}if(!c.current){c.current=!0,m(!0);try{const N=await ms(o,b.name,y),v={type:"doc",content:[{type:"paragraph",content:[Qt({id:b.name,name:Jt(b.name,Xt(b._meta)),metadata:N.messages,char:"/",kind:"prompt",args:y}),{type:"text",text:" "}]}]},j=crypto.randomUUID();fs(sessionStorage,s,j,{tiptapDoc:v}),await i({id:j,virtual_mcp_id:t}),r(j,t,{autosend:!0})}catch(N){console.error("[start-thread-from-prompt] failed",N),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},f=async b=>{if(!c.current){if(b.arguments&&b.arguments.length>0){d(b);return}await u(b)}},p=async b=>{if(!a)return;const y=a;d(null),await u(y,b)};return{start:f,startBlank:async b=>{if(!c.current){c.current=!0,m(!0);try{const y=crypto.randomUUID();await i({id:y,virtual_mcp_id:t}),r(y,t,b?.main?{main:b.main}:void 0)}catch(y){console.error("[start-thread-from-prompt] startBlank failed",y),K.error("Failed to start thread. Please try again.")}finally{c.current=!1,m(!1)}}},dialog:n.jsx(Gt,{prompt:a,setPrompt:b=>d(b),onSubmit:p}),dialogPrompt:a,starting:l}}const q=4,G=100,Te=12,cn=5,dn={w:2,h:2};class pe extends A.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,message:e instanceof Error?e.message:"Unknown error"}}componentDidCatch(e,s){console.error("[home-tiles] tile crashed:",e,s.componentStack)}render(){return this.state.hasError?n.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center",children:[n.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-destructive/10 text-destructive",children:n.jsx(it,{size:16})}),n.jsx("p",{className:"text-sm font-medium text-foreground",children:"This tile crashed"}),n.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:this.state.message??"Something went wrong rendering this tile."})]}):this.props.children}}function mn(t){const e=k.c(72),{tiles:s,isEditMode:o,renderTile:i,onMove:r,onResize:a,onRemove:d}=t,l=ge(),m=A.useRef(null),[c,u]=A.useState(null),[f,p]=A.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activationConstraint:{distance:4}},e[0]=h):h=e[0];const g=Ee(oe(ze,h),oe(Me)),b=s.reduce(un,0),y=o?Math.max(b+2,4):Math.max(b,1);let N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=()=>{const $=m.current?.getBoundingClientRect();return $?{cellWidth:$.width/q,cellHeight:G}:null},e[1]=N):N=e[1];const v=N;let j;e[2]===Symbol.for("react.memo_cache_sentinel")?(j=$=>{u(String($.active.id)),p(v())},e[2]=j):j=e[2];const x=j;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??v();if(u(null),p(null),!O||O.cellWidth<=0)return;const E=s.find(W=>W.id===R);if(!E)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:E.x+F,y:E.y+B})},e[3]=f,e[4]=r,e[5]=s,e[6]=w):w=e[6];const S=w;if(l){let $;if(e[7]!==i||e[8]!==s){let O;e[10]!==i?(O=E=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(E)})},E.id),e[10]=i,e[11]=O):O=e[11],$=s.map(O),e[7]=i,e[8]=s,e[9]=$}else $=e[9];let R;return e[12]!==$?(R=n.jsx("div",{className:"flex flex-col gap-3 px-4 pb-8",children:$}),e[12]=$,e[13]=R):R=e[13],R}let T,_,C,I,P,M,z,H,L;if(e[14]!==c||e[15]!==f||e[16]!==o||e[17]!==S||e[18]!==d||e[19]!==a||e[20]!==i||e[21]!==g||e[22]!==s||e[23]!==y){const $=c?s.find(X=>X.id===c):null;_=Le,H=g,L=x,C=S;const R=y*G,O=o?G*4:G;let E;e[33]!==R||e[34]!==O?(E={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=E):E=e[35];let F;e[36]!==o||e[37]!==s||e[38]!==y?(F=o&&n.jsx(fn,{rows:y,tiles:s}),e[36]=o,e[37]=s,e[38]=y,e[39]=F):F=e[39];let B;if(e[40]!==c||e[41]!==o||e[42]!==d||e[43]!==a||e[44]!==i||e[45]!==s){let X;e[47]!==c||e[48]!==o||e[49]!==d||e[50]!==a||e[51]!==i?(X=ie=>n.jsx(hn,{tile:ie,isEditMode:o,isDragging:c===ie.id,onResize:a,onRemove:d,children:i(ie)},ie.id),e[47]=c,e[48]=o,e[49]=d,e[50]=a,e[51]=i,e[52]=X):X=e[52],B=s.map(X),e[40]=c,e[41]=o,e[42]=d,e[43]=a,e[44]=i,e[45]=s,e[46]=B}else B=e[46];e[53]!==E||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:E,children:[F,B]}),e[53]=E,e[54]=F,e[55]=B,e[56]=I):I=e[56],T=Pt,P=null;const W=$&&f?$.w*f.cellWidth-Te:void 0,de=$&&f?$.h*f.cellHeight-Te:void 0;e[57]!==W||e[58]!==de?(M={width:W,height:de},e[57]=W,e[58]=de,e[59]=M):M=e[59],z=$&&n.jsx("div",{className:"bg-card card-shadow rounded-2xl shadow-2xl ring-2 ring-primary/40 h-full overflow-hidden opacity-95",children:n.jsx(pe,{children:i($)})}),e[14]=c,e[15]=f,e[16]=o,e[17]=S,e[18]=d,e[19]=a,e[20]=i,e[21]=g,e[22]=s,e[23]=y,e[24]=T,e[25]=_,e[26]=C,e[27]=I,e[28]=P,e[29]=M,e[30]=z,e[31]=H,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],M=e[29],z=e[30],H=e[31],L=e[32];let D;e[60]!==T||e[61]!==P||e[62]!==M||e[63]!==z?(D=n.jsx(T,{dropAnimation:P,style:M,children:z}),e[60]=T,e[61]=P,e[62]=M,e[63]=z,e[64]=D):D=e[64];let U;return e[65]!==_||e[66]!==C||e[67]!==I||e[68]!==D||e[69]!==H||e[70]!==L?(U=n.jsxs(_,{sensors:H,onDragStart:L,onDragEnd:C,children:[I,D]}),e[65]=_,e[66]=C,e[67]=I,e[68]=D,e[69]=H,e[70]=L,e[71]=U):U=e[71],U}function un(t,e){return Math.max(t,e.y+e.h)}function fn(t){const e=k.c(7),{rows:s,tiles:o}=t;let i;e[0]!==o?(i=(l,m)=>o.some(c=>l>=c.x&&l<c.x+c.w&&m>=c.y&&m<c.y+c.h),e[0]=o,e[1]=i):i=e[1];const r=i;let a;if(e[2]!==r||e[3]!==s){a=[];for(let l=0;l<s;l++)for(let m=0;m<q;m++)r(m,l)||a.push({x:m,y:l});e[2]=r,e[3]=s,e[4]=a}else a=e[4];let d;return e[5]!==a?(d=n.jsx("div",{className:"absolute inset-0 pointer-events-none",children:a.map(pn)}),e[5]=a,e[6]=d):d=e[6],d}function pn(t){return n.jsx("div",{className:"absolute p-1",style:{left:`${t.x/q*100}%`,top:t.y*G,width:`${1/q*100}%`,height:G},children:n.jsx("div",{className:"h-full w-full rounded-2xl border border-dashed border-border/60"})},`${t.x}-${t.y}`)}function hn(t){const e=k.c(31),{tile:s,isEditMode:o,isDragging:i,onResize:r,onRemove:a,children:d}=t,l=!o;let m;e[0]!==l||e[1]!==s.id?(m={id:s.id,disabled:l},e[0]=l,e[1]=s.id,e[2]=m):m=e[2];const{setNodeRef:c,attributes:u,listeners:f,isDragging:p}=Et(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,v=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",j=N&&"opacity-30";let x;e[3]!==v||e[4]!==j?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",v,j),e[3]=v,e[4]=j,e[5]=x):x=e[5];let w;e[6]!==y||e[7]!==h||e[8]!==b||e[9]!==g?(w={left:h,top:b,width:g,height:y},e[6]=y,e[7]=h,e[8]=b,e[9]=g,e[10]=w):w=e[10];const S=o&&"outline outline-1 outline-transparent hover:outline-primary/40";let T;e[11]!==S?(T=Q("group relative h-full bg-card card-shadow rounded-2xl overflow-hidden",S),e[11]=S,e[12]=T):T=e[12];let _;e[13]!==u||e[14]!==o||e[15]!==f||e[16]!==a||e[17]!==r||e[18]!==s?(_=o&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",...u,...f,className:"absolute top-2 left-2 z-10 flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted cursor-grab active:cursor-grabbing","aria-label":"Drag tile",children:n.jsx(Pe,{size:16})}),n.jsx("div",{className:"absolute top-2 right-2 z-10 flex items-center gap-1",children:n.jsx(xn,{tile:s,onResize:r,onRemove:a})})]}),e[13]=u,e[14]=o,e[15]=f,e[16]=a,e[17]=r,e[18]=s,e[19]=_):_=e[19];let C;e[20]!==d?(C=n.jsx("div",{className:"h-full overflow-hidden",children:n.jsx(pe,{children:d})}),e[20]=d,e[21]=C):C=e[21];let I;e[22]!==C||e[23]!==T||e[24]!==_?(I=n.jsxs("div",{className:T,children:[_,C]}),e[22]=C,e[23]=T,e[24]=_,e[25]=I):I=e[25];let P;return e[26]!==c||e[27]!==I||e[28]!==x||e[29]!==w?(P=n.jsx("div",{ref:c,className:x,style:w,children:I}),e[26]=c,e[27]=I,e[28]=x,e[29]=w,e[30]=P):P=e[30],P}function xn(t){const e=k.c(20),{tile:s,onResize:o,onRemove:i}=t,[r,a]=A.useState(!1);let d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx(ps,{asChild:!0,children:n.jsx("button",{type:"button",className:"flex size-8 items-center justify-center rounded-md bg-background/90 border border-border text-muted-foreground hover:text-foreground hover:bg-muted","aria-label":"Tile options",children:n.jsx(Nt,{size:16})})}),e[0]=d):d=e[0];let l;e[1]!==o||e[2]!==s.id?(l=b=>{o(s.id,b),a(!1)},e[1]=o,e[2]=s.id,e[3]=l):l=e[3];let m;e[4]!==l||e[5]!==s?(m=n.jsx(gn,{tile:s,onPick:l}),e[4]=l,e[5]=s,e[6]=m):m=e[6];let c;e[7]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(hs,{}),e[7]=c):c=e[7];let u;e[8]!==i||e[9]!==s.id?(u=()=>i(s.id),e[8]=i,e[9]=s.id,e[10]=u):u=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ys,{size:14,className:"mr-2"}),e[11]=f):f=e[11];let p;e[12]!==u?(p=n.jsxs(xs,{onSelect:u,className:"text-destructive focus:text-destructive",children:[f,"Remove tile"]}),e[12]=u,e[13]=p):p=e[13];let h;e[14]!==m||e[15]!==p?(h=n.jsxs(gs,{align:"end",className:"w-auto",children:[m,c,p]}),e[14]=m,e[15]=p,e[16]=h):h=e[16];let g;return e[17]!==r||e[18]!==h?(g=n.jsxs(bs,{open:r,onOpenChange:a,children:[d,h]}),e[17]=r,e[18]=h,e[19]=g):g=e[19],g}function gn(t){const e=k.c(19),{tile:s,onPick:o}=t,i=s.minW??1,r=s.minH??1,[a,d]=A.useState(null);let l;e[0]!==a||e[1]!==s.h||e[2]!==s.w?(l=a??{w:s.w,h:s.h},e[0]=a,e[1]=s.h,e[2]=s.w,e[3]=l):l=e[3];const m=l;let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("span",{className:"text-xs text-muted-foreground",children:"Size"}),e[4]=c):c=e[4];let u;e[5]!==m.h||e[6]!==m.w?(u=n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-4",children:[c,n.jsxs("span",{className:"text-xs font-medium tabular-nums",children:[m.w," × ",m.h]})]}),e[5]=m.h,e[6]=m.w,e[7]=u):u=e[7];let f,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(f={gridTemplateColumns:`repeat(${q}, 1.25rem)`},p=()=>d(null),e[8]=f,e[9]=p):(f=e[8],p=e[9]);let h;e[10]!==m.h||e[11]!==m.w||e[12]!==r||e[13]!==i||e[14]!==o?(h=n.jsx("div",{className:"grid w-max gap-1",style:f,onPointerLeave:p,children:Array.from({length:cn},(b,y)=>Array.from({length:q},(N,v)=>{const j=v+1,x=y+1,w=j<i||x<r,S=j<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${j} by ${x}`,onPointerEnter:()=>d({w:j,h:x}),onClick:()=>o({w:j,h:x}),className:Q("size-5 rounded-sm border transition-colors",S?"border-primary bg-primary/30":"border-border bg-muted",w?"cursor-not-allowed opacity-40":"cursor-pointer hover:border-primary/60")},`${j}x${x}`)}))}),e[10]=m.h,e[11]=m.w,e[12]=r,e[13]=i,e[14]=o,e[15]=h):h=e[15];let g;return e[16]!==u||e[17]!==h?(g=n.jsxs("div",{className:"px-2 py-1.5",children:[u,h]}),e[16]=u,e[17]=h,e[18]=g):g=e[18],g}function bn(t,e,s){return t.some(o=>e>=o.x&&e<o.x+o.w&&s>=o.y&&s<o.y+o.h)}function he(t,e,s){for(let o=0;o<100;o++)for(let i=0;i<=q-e;i++){let r=!0;for(let a=0;a<s&&r;a++)for(let d=0;d<e&&r;d++)bn(t,i+d,o+a)&&(r=!1);if(r)return{x:i,y:o}}return{x:0,y:0}}function me(t,e,s={w:1,h:1}){const o=Math.max(s.w,Math.min(q,t)),i=Math.max(s.h,Math.min(6,e));return{w:o,h:i}}function ue(t,e,s){const o=Math.max(0,Math.min(q-s,t)),i=Math.max(0,e);return{x:o,y:i}}function yn(t,e,s){const o=t.find(l=>l.id===e);if(!o)return t;const i=t.filter(l=>l.id!==e),r=i.find(l=>s.x>=l.x&&s.x<l.x+l.w&&s.y>=l.y&&s.y<l.y+l.h);if(r&&r.w===o.w&&r.h===o.h)return t.map(l=>l.id===e?{...l,x:r.x,y:r.y}:l.id===r.id?{...l,x:o.x,y:o.y}:l);const d=[{...o,x:s.x,y:s.y}];for(const l of i){const m=he(d,l.w,l.h);d.push({...l,x:m.x,y:m.y})}return d}function jn(t){const e=k.c(35),{layout:s,isLayoutLoading:o,commitLayout:i}=Ye();let r;e[0]!==s.hidden?(r=new Set(s.hidden),e[0]=s.hidden,e[1]=r):r=e[1];const a=r;let d,l;if(e[2]!==t||e[3]!==a||e[4]!==s.tiles){l=[];let N;e[7]!==a?(N=j=>j.pinned||!a.has(j.id),e[7]=a,e[8]=N):N=e[8];const v=t.filter(N);d=new Map;for(const j of t)j.minSize&&d.set(j.id,j.minSize);for(const j of v){const x=s.tiles[j.id];if(!x)continue;const w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:j.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const j of v){if(l.some(C=>C.id===j.id))continue;const x=j.defaultSize??dn,w=d.get(j.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:j.id,x:_.x,y:_.y,w:S,h:T,minW:w?.w,minH:w?.h})}e[2]=t,e[3]=a,e[4]=s.tiles,e[5]=d,e[6]=l}else d=e[5],l=e[6];let m;e[9]!==t?(m=new Set(t.map(vn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,v)=>{const j={};for(const x of N)j[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:j,hidden:v.filter(x=>c.has(x))})},e[11]=c,e[12]=i,e[13]=u):u=e[13];const f=u;let p;e[14]!==l?(p={visible:l},e[14]=l,e[15]=p):p=e[15];let h;e[16]!==f||e[17]!==s||e[18]!==l?(h=(N,v)=>{const j=l.find(S=>S.id===N);if(!j)return;const x=ue(v.x,v.y,j.w);if(x.x===j.x&&x.y===j.y)return;const w=yn(l,N,x);f(w,s.hidden)},e[16]=f,e[17]=s,e[18]=l,e[19]=h):h=e[19];let g;e[20]!==f||e[21]!==s||e[22]!==d||e[23]!==l?(g=(N,v)=>{const j=l.find(I=>I.id===N);if(!j)return;const x=d.get(N),{w,h:S}=me(v.w,v.h,x);if(w===j.w&&S===j.h)return;const T={...j,w,h:S,x:ue(j.x,j.y,w).x},_=l.filter(I=>I.id!==N),C=[T];for(const I of _){const P=he(C,I.w,I.h);C.push({...I,x:P.x,y:P.y})}f(C,s.hidden)},e[20]=f,e[21]=s,e[22]=d,e[23]=l,e[24]=g):g=e[24];let b;e[25]!==f||e[26]!==s||e[27]!==l?(b=N=>{const v=l.filter(j=>j.id!==N);f(v,Array.from(new Set([...s.hidden,N])))},e[25]=f,e[26]=s,e[27]=l,e[28]=b):b=e[28];let y;return e[29]!==o||e[30]!==p||e[31]!==h||e[32]!==g||e[33]!==b?(y={snapshot:p,isLoading:o,moveTile:h,resizeTile:g,hideTile:b},e[29]=o,e[30]=p,e[31]=h,e[32]=g,e[33]=b,e[34]=y):y=e[34],y}function vn(t){return t.id}const Nn={w:2,h:4},wn={w:1,h:2},Sn={w:1,h:1};function _n(t){return`prompt:${t.agentId}:${t.promptName||"blank"}`}function Cn(t){return t.tileId?`tile:${t.tileId}`:`tile:${t.agentId}:${t.resourceUri}`}function In(t){return t.promptName?t.agentName:t.description}function Tn(t){return{name:t.promptName,title:t.title,description:t.description,arguments:t.arguments,_meta:t._meta}}function et(t){const e=k.c(14),{org:s}=J();let o;e[0]!==s.id||e[1]!==s.slug||e[2]!==t.connectionId?(o=mt({connectionId:t.connectionId,orgId:s.id,orgSlug:s.slug}),e[0]=s.id,e[1]=s.slug,e[2]=t.connectionId,e[3]=o):o=e[3];const{data:i}=se(o),r=!!i&&!t.toolName;let a;e[4]!==i||e[5]!==r?(a={client:i,enabled:r},e[4]=i,e[5]=r,e[6]=a):a=e[6];const{data:d}=cs(a);let l;e[7]!==t.resourceUri||e[8]!==t.toolName||e[9]!==d?.tools?(l=t.toolName??d?.tools.find(u=>Fe(u._meta)===t.resourceUri)?.name,e[7]=t.resourceUri,e[8]=t.toolName,e[9]=d?.tools,e[10]=l):l=e[10];const m=l;let c;return e[11]!==t.connectionId||e[12]!==m?(c=m?Lt(t.connectionId,m):void 0,e[11]=t.connectionId,e[12]=m,e[13]=c):c=e[13],c}function we(t){const e=k.c(10);let s;e[0]!==t?(s={agentId:t},e[0]=t,e[1]=s):s=e[1];const{start:o,startBlank:i,dialog:r,starting:a}=an(s);let d;e[2]!==o||e[3]!==i?(d=c=>{if(!c.promptName){i();return}o(Tn(c))},e[2]=o,e[3]=i,e[4]=d):d=e[4];const l=d;let m;return e[5]!==r||e[6]!==l||e[7]!==i||e[8]!==a?(m={open:l,startBlank:i,dialog:r,starting:a},e[5]=r,e[6]=l,e[7]=i,e[8]=a,e[9]=m):m=e[9],m}function kn(t){const e=k.c(32),{entry:s,isEditMode:o}=t,{open:i,dialog:r,starting:a}=we(s.agentId);let d;e[0]!==s||e[1]!==i?(d=()=>i(s),e[0]=s,e[1]=i,e[2]=d):d=e[2];const l=a||o,m=!o&&"cursor-pointer transition-colors hover:bg-accent/40",c=o&&"cursor-default pl-12",u=a&&"opacity-60";let f;e[3]!==m||e[4]!==c||e[5]!==u?(f=Q("group/tile relative flex h-full w-full items-center gap-3 px-4 py-3 text-left bg-card",m,c,u),e[3]=m,e[4]=c,e[5]=u,e[6]=f):f=e[6];let p;e[7]!==s.agentIcon||e[8]!==s.agentName?(p=n.jsx(ce,{icon:s.agentIcon,name:s.agentName,size:"sm+"}),e[7]=s.agentIcon,e[8]=s.agentName,e[9]=p):p=e[9];let h;e[10]!==s.title?(h=n.jsx("div",{className:"line-clamp-2 text-sm font-medium text-foreground leading-snug",children:s.title}),e[10]=s.title,e[11]=h):h=e[11];let g;e[12]!==s?(g=In(s),e[12]=s,e[13]=g):g=e[13];let b;e[14]!==g?(b=n.jsx("div",{className:"truncate text-xs text-muted-foreground mt-0.5",children:g}),e[14]=g,e[15]=b):b=e[15];let y;e[16]!==b||e[17]!==h?(y=n.jsxs("div",{className:"min-w-0 flex-1",children:[h,b]}),e[16]=b,e[17]=h,e[18]=y):y=e[18];let N;e[19]!==o?(N=!o&&n.jsx(ds,{size:16,className:"shrink-0 text-muted-foreground opacity-0 -translate-x-1 transition-all duration-200 group-hover/tile:opacity-100 group-hover/tile:translate-x-0","aria-hidden":!0}),e[19]=o,e[20]=N):N=e[20];let v;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(v=n.jsxs("button",{type:"button",onClick:d,disabled:l,"aria-busy":a,className:f,children:[p,y,N]}),e[21]=a,e[22]=d,e[23]=y,e[24]=N,e[25]=l,e[26]=f,e[27]=p,e[28]=v):v=e[28];let j;return e[29]!==r||e[30]!==v?(j=n.jsxs(n.Fragment,{children:[v,r]}),e[29]=r,e[30]=v,e[31]=j):j=e[31],j}function $n(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("div",{className:"mt-4 grid w-full grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:3},An)}),t[0]=e):e=t[0],e}function An(t,e){return n.jsxs("div",{className:"flex w-full items-center gap-3 rounded-2xl bg-card card-shadow px-3 py-2.5",children:[n.jsx(V,{className:"size-10 rounded-xl"}),n.jsxs("div",{className:"flex-1 space-y-1.5",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-2.5 w-1/3"})]})]},`chip-skeleton-${e}`)}function Pn(t){const e=k.c(17),{tile:s,prompts:o,isEditMode:i,tileWidth:r}=t,{org:a}=J(),{open:d,startBlank:l,dialog:m,starting:c}=we(s.agentId),u=o.filter(En),f=et(s),p="relative flex h-full w-full flex-col p-3";let h;e[0]!==i||e[1]!==f||e[2]!==l||e[3]!==c?(h=!i&&n.jsx("button",{type:"button",onClick:()=>{l(f?{main:f}:void 0)},disabled:c,"aria-busy":c,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[0]=i,e[1]=f,e[2]=l,e[3]=c,e[4]=h):h=e[4];const g="flex min-h-0 flex-1 gap-3 overflow-hidden";let b;e[5]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx(zn,{}),e[5]=b):b=e[5];let y;e[6]!==a.id||e[7]!==a.slug||e[8]!==s?(y=n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden rounded-lg border border-border",children:n.jsx(A.Suspense,{fallback:b,children:n.jsx(Mn,{tile:s,orgId:a.id,orgSlug:a.slug})})}),e[6]=a.id,e[7]=a.slug,e[8]=s,e[9]=y):y=e[9];const N=u.length>0&&!i&&r>=2&&n.jsx("div",{className:"flex w-44 shrink-0 flex-col gap-2 overflow-hidden",children:u.map(x=>n.jsx("button",{type:"button",onClick:()=>d(x),disabled:c,className:"shrink-0 rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:x.title})},x.promptName))});let v;e[10]!==y||e[11]!==N?(v=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=v):v=e[12];let j;return e[13]!==m||e[14]!==h||e[15]!==v?(j=n.jsxs("div",{className:p,children:[h,v,m]}),e[13]=m,e[14]=h,e[15]=v,e[16]=j):j=e[16],j}function En(t){return!!t.promptName}function Mn(t){const e=k.c(13),{tile:s,orgId:o,orgSlug:i}=t;let r;e[0]!==o||e[1]!==i||e[2]!==s.connectionId?(r={connectionId:s.connectionId,orgId:o,orgSlug:i},e[0]=o,e[1]=i,e[2]=s.connectionId,e[3]=r):r=e[3];const a=ae(r),d=s.minHeight??200,l=s.maxHeight??4e3;let m;return e[4]!==a||e[5]!==o||e[6]!==i||e[7]!==d||e[8]!==l||e[9]!==s.connectionId||e[10]!==s.resourceUri||e[11]!==s.toolInput?(m=n.jsx(ns,{resourceURI:s.resourceUri,orgId:o,orgSlug:i,connectionId:s.connectionId,client:a,toolInput:s.toolInput,displayMode:"fullscreen",minHeight:d,maxHeight:l,className:"h-full"}),e[4]=a,e[5]=o,e[6]=i,e[7]=d,e[8]=l,e[9]=s.connectionId,e[10]=s.resourceUri,e[11]=s.toolInput,e[12]=m):m=e[12],m}function zn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-4",children:[n.jsx(V,{className:"h-3 w-2/3"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"mt-1 h-full w-full rounded-md"})]}),t[0]=e):e=t[0],e}function Ln(t){const e=k.c(14),{icon:s,name:o}=t;let i;e[0]!==s||e[1]!==o?(i=n.jsx(ce,{icon:s,name:o,size:"sm+"}),e[0]=s,e[1]=o,e[2]=i):i=e[2];let r;e[3]!==o?(r=n.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:o}),e[3]=o,e[4]=r):r=e[4];let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:"Loading tile…"}),e[5]=a):a=e[5];let d;e[6]!==r?(d=n.jsxs("div",{className:"min-w-0 flex-1",children:[r,a]}),e[6]=r,e[7]=d):d=e[7];let l;e[8]!==i||e[9]!==d?(l=n.jsxs("div",{className:"flex items-center gap-2.5",children:[i,d]}),e[8]=i,e[9]=d,e[10]=l):l=e[10];let m;e[11]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsxs("div",{className:"flex flex-1 flex-col gap-2 pt-1",children:[n.jsx(V,{className:"h-3 w-3/4"}),n.jsx(V,{className:"h-3 w-1/2"}),n.jsx(V,{className:"h-3 w-2/3"})]}),e[11]=m):m=e[11];let c;return e[12]!==l?(c=n.jsxs("div",{className:"flex h-full w-full flex-col gap-3 p-5 opacity-60",children:[l,m]}),e[12]=l,e[13]=c):c=e[13],c}function On(t){const e=k.c(10),{tile:s,prompts:o,isEditMode:i}=t,{open:r,startBlank:a,dialog:d,starting:l}=we(s.agentId),m=o.filter(Dn),c=et(s),u="flex h-full w-full flex-col gap-3 p-4";let f;e[0]!==c||e[1]!==a?(f=()=>{a(c?{main:c}:void 0)},e[0]=c,e[1]=a,e[2]=f):f=e[2];const p=l||i;let h;e[3]!==f||e[4]!==p?(h=n.jsx("button",{type:"button",onClick:f,disabled:p,className:"mb-1 self-start rounded-md px-2 py-1 text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:"Open chat"}),e[3]=f,e[4]=p,e[5]=h):h=e[5];const g=m.length>0&&!i&&n.jsx("div",{className:"grid grid-cols-1 gap-2 overflow-hidden sm:grid-cols-2",children:m.map(y=>n.jsx("button",{type:"button",onClick:()=>!i&&r(y),disabled:l,className:"rounded-lg border border-border bg-background px-2.5 py-2 text-left text-xs leading-snug text-foreground transition-colors hover:bg-accent/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-progress disabled:opacity-60",children:n.jsx("span",{className:"line-clamp-2",children:y.title})},y.promptName))});let b;return e[6]!==d||e[7]!==h||e[8]!==g?(b=n.jsxs("div",{className:u,children:[h,g,d]}),e[6]=d,e[7]=h,e[8]=g,e[9]=b):b=e[9],b}function Dn(t){return!!t.promptName}function tt({isEditMode:t}){const{org:e}=J(),{isLoading:s,prompts:o,tiles:i}=je(e.slug),r=Oe()?.ids??[],a=new Set(r),d=De(),l=Be(),m=xe(),c=new Set(i.map(x=>x.agentId)),u=new Map;for(const x of o){const w=u.get(x.agentId);w?w.push(x):u.set(x.agentId,[x])}const f=o.filter(x=>!c.has(x.agentId)),p=[...i.map(x=>({kind:"tile",id:Cn(x),data:x})),...f.map(x=>({kind:"prompt",id:_n(x),data:x}))],h=new Map(p.map(x=>[x.id,x])),g=jn(p.map(x=>({id:x.id,defaultSize:x.kind==="tile"?Nn:Sn,minSize:x.kind==="tile"?wn:void 0,pinned:a.has(x.data.agentId)}))),b=x=>{d.apply(w=>w.filter(S=>S!==x)).catch(()=>K.error("Couldn't remove from home — please try again."))},y=async x=>{if(i.filter(S=>S.agentId===x.agentId).length<=1){b(x.agentId);return}try{const T=(await l.call("COLLECTION_VIRTUAL_MCP_GET",{id:x.agentId})).item;if(!T)throw new Error("Agent not found");const _=Z(T.metadata?.ui),C=x.tileId?_.filter(I=>I.tileId!==x.tileId):_.filter(I=>I.connectionId!==x.connectionId||I.resourceUri!==x.resourceUri);await l.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:x.agentId,data:{metadata:{...T.metadata??{},ui:{...T.metadata?.ui??{},homeTile:null,homeTiles:C}}}}),m.invalidateQueries({queryKey:te.homeNextActions(e.slug)})}catch{K.error("Couldn't remove tile — please try again.")}},N=x=>{const w=h.get(x);if(w){if(!a.has(w.data.agentId)){g.hideTile(x);return}w.kind==="tile"?y(w.data):b(w.data.agentId)}},v=x=>{const w=h.get(x.id);if(!w)return null;if(w.kind==="tile"){const S=u.get(w.data.agentId)??[];return n.jsx(ot,{fallback:n.jsx(On,{tile:w.data,prompts:S,isEditMode:t}),children:n.jsx(A.Suspense,{fallback:n.jsx(Ln,{icon:w.data.agentIcon,name:w.data.agentName}),children:n.jsx(Pn,{tile:w.data,prompts:S,isEditMode:t,tileWidth:x.w})})})}return n.jsx(kn,{entry:w.data,isEditMode:t})};return s||g.isLoading?n.jsx($n,{}):g.snapshot.visible.length===0&&!t?null:n.jsx("div",{className:"mt-4 flex w-full max-w-7xl flex-col gap-4",children:n.jsx(mn,{tiles:g.snapshot.visible,isEditMode:t,renderTile:v,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Hn(t){const e=k.c(2),{prompts:s,tiles:o}=je(t),i=o.length>0||s.length>0;let r;return e[0]!==i?(r={hasVisibleTiles:i},e[0]=i,e[1]=r):r=e[1],r}const ke=420,$e=305;function st(){const t=k.c(4);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/bg-top-left.svg",alt:"",className:"absolute top-0 left-0 h-auto select-none opacity-80 dark:hidden",style:{width:ke}}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("img",{src:"/home/bg-top-left-dark.svg",alt:"",className:"absolute top-0 left-0 hidden h-auto select-none opacity-80 dark:block",style:{width:ke}}),t[1]=s):s=t[1];let o;t[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("img",{src:"/home/bg-bottom-right.svg",alt:"",className:"absolute bottom-0 right-0 h-auto select-none opacity-80 dark:hidden",style:{width:$e}}),t[2]=o):o=t[2];let i;return t[3]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden",children:[e,s,o,n.jsx("img",{src:"/home/bg-bottom-right-dark.svg",alt:"",className:"absolute bottom-0 right-0 hidden h-auto select-none opacity-80 dark:block",style:{width:$e}})]}),t[3]=i):i=t[3],i}function Ae(){const t=k.c(33),{data:e}=rt.useSession(),{org:s}=J(),o=ge(),i=Ns(),{selectedVirtualMcp:r}=Dt();let a;t[0]!==s.id?(a=ut(s.id),t[0]=s.id,t[1]=a):a=t[1];const l=r??a;let m;t[2]!==s.slug?(m=Wt(s.slug),t[2]=s.slug,t[3]=m):m=t[3],se(m);let c;t[4]!==s.id||t[5]!==s.slug?(c={connectionId:ft,orgId:s.id,orgSlug:s.slug},t[4]=s.id,t[5]=s.slug,t[6]=c):c=t[6];const u=ae(c);let f;t[7]!==s.id||t[8]!==s.slug?(f=js(s.slug,s.id),t[7]=s.id,t[8]=s.slug,t[9]=f):f=t[9];let p;t[10]!==s.id||t[11]!==s.slug?(p=Vt(s.slug,s.id),t[10]=s.id,t[11]=s.slug,t[12]=p):p=t[12];let h;t[13]!==l.id||t[14]!==s.id||t[15]!==u?(h=xt(s.id,l.id,u),t[13]=l.id,t[14]=s.id,t[15]=u,t[16]=h):h=t[16];let g;t[17]!==f||t[18]!==p||t[19]!==h?(g={queries:[f,p,h]},t[17]=f,t[18]=p,t[19]=h,t[20]=g):g=t[20],ct(g);const b=vs(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:v,isInitialFreeCredit:j,balanceDollars:x,hasOnlyDecoProvider:w}=Ft(),{hasVisibleTiles:S}=Hn(s.slug),T=Ut(y?.metadata);if(b.length===0&&!(T&&Bt(i))){let D;return t[21]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsx("div",{className:"min-h-full flex items-center justify-center px-4 py-10",children:n.jsx(Ht,{})})}),t[21]=D):D=t[21],D}let C;t[22]!==e?.user?.name?(C=e?.user?.name?.split(" ")[0]||"there",t[22]=e?.user?.name,t[23]=C):C=t[23];const I=C,P=N&&j&&x!=null,M=N&&v&&w;let z;t[24]!==x||t[25]!==P||t[26]!==M?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):M?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=M,t[27]=z):z=t[27];const H=z;let L;return t[28]!==H||t[29]!==S||t[30]!==o||t[31]!==I?(L=n.jsx(ln,{children:o?n.jsx(Rn,{eyebrow:H,userName:I}):n.jsx(Fn,{eyebrow:H,userName:I,hasVisibleTiles:S})}),t[28]=H,t[29]=S,t[30]=o,t[31]=I,t[32]=L):L=t[32],L}function Rn(t){const e=k.c(12),{eyebrow:s,userName:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx(st,{}),e[0]=i):i=e[0];let r;e[1]!==s?(r=s&&n.jsx("div",{className:"mb-4",children:s}),e[1]=s,e[2]=r):r=e[2];let a;e[3]!==o?(a=n.jsxs("p",{className:"text-3xl font-medium text-foreground text-center max-w-[280px]",children:["What's on your mind, ",o,"?"]}),e[3]=o,e[4]=a):a=e[4];let d;e[5]!==r||e[6]!==a?(d=n.jsxs("div",{className:"relative flex flex-col items-center justify-center w-full pt-28 pb-8 px-4",children:[r,a]}),e[5]=r,e[6]=a,e[7]=d):d=e[7];let l;e[8]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx("div",{className:"relative w-full flex flex-col gap-4 pb-8 px-4",children:n.jsx(re.Input,{showConnectionsBanner:!0})}),e[8]=l):l=e[8];let m;e[9]===Symbol.for("react.memo_cache_sentinel")?(m=n.jsx("div",{className:"relative w-full px-4 pb-8",children:n.jsx(tt,{isEditMode:!1})}),e[9]=m):m=e[9];let c;return e[10]!==d?(c=n.jsxs("div",{className:"flex-1 relative flex flex-col items-center overflow-y-auto",children:[i,d,l,m]}),e[10]=d,e[11]=c):c=e[11],c}function Fn(t){const e=k.c(54),{eyebrow:s,userName:o,hasVisibleTiles:i}=t,{isEditMode:r,enter:a,save:d,cancel:l,hasChanges:m}=Ye(),[c,u]=A.useState(!1),f=lt();let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={strict:!1},e[0]=p):p=e[0];const{main:h}=at(p);let g;e[1]!==h?(g=h?Ot(h):null,e[1]=h,e[2]=g):g=e[2];const b=g,y=h==="files"||!!b;let N;e[3]!==f?(N=B=>f({to:".",search:W=>({...W,main:B}),replace:!0}),e[3]=f,e[4]=N):N=e[4];const v=N;let j;e[5]===Symbol.for("react.memo_cache_sentinel")?(j={kind:"component",Component:Se},e[5]=j):j=e[5];let x;e[6]!==y||e[7]!==v?(x=()=>v(y?void 0:"files"),e[6]=y,e[7]=v,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:j,active:y,onClick:x}),e[9]=y,e[10]=x,e[11]=w):w=e[11];let S;e[12]===Symbol.for("react.memo_cache_sentinel")?(S=()=>u(!0),e[12]=S):S=e[12];let T;e[13]!==l||e[14]!==a||e[15]!==m||e[16]!==r||e[17]!==d?(T=n.jsx(Un,{isEditMode:r,hasChanges:m,onEnter:a,onSave:d,onCancel:l,onAddTile:S}),e[13]=l,e[14]=a,e[15]=m,e[16]=r,e[17]=d,e[18]=T):T=e[18];let _;e[19]!==w||e[20]!==T?(_=n.jsxs(ws.Right,{children:[w,T]}),e[19]=w,e[20]=T,e[21]=_):_=e[21];let C;e[22]!==c?(C=n.jsx(_s,{open:c,onOpenChange:u}),e[22]=c,e[23]=C):C=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=n.jsx(st,{}),e[24]=I):I=e[24];const P=i||r?"pt-32":"flex-1 justify-center";let M;e[25]!==P?(M=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=M):M=e[26];let z;e[27]!==s?(z=s&&n.jsx("div",{className:"mb-4",children:s}),e[27]=s,e[28]=z):z=e[28];let H;e[29]!==o?(H=n.jsxs("p",{className:"text-3xl font-medium text-foreground",children:["What's on your mind, ",o,"?"]}),e[29]=o,e[30]=H):H=e[30];let L;e[31]!==z||e[32]!==H?(L=n.jsxs("div",{className:"text-center mb-10",children:[z,H]}),e[31]=z,e[32]=H,e[33]=L):L=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=n.jsxs("div",{className:"relative w-full",children:[n.jsx(Bn,{}),n.jsx(re.Input,{showConnectionsBanner:!0})]}),e[34]=D):D=e[34];let U;e[35]!==L?(U=n.jsxs("div",{className:"flex flex-col items-center w-full max-w-[672px]",children:[L,D]}),e[35]=L,e[36]=U):U=e[36];let $;e[37]!==r?($=n.jsx("div",{className:"relative w-full mt-10 mx-auto max-w-[1280px] px-2 pb-16",children:n.jsx(tt,{isEditMode:r})}),e[37]=r,e[38]=$):$=e[38];let R;e[39]!==M||e[40]!==U||e[41]!==$?(R=n.jsxs("div",{className:"flex-1 min-w-0 relative flex flex-col",children:[I,n.jsx("div",{className:"flex-1 relative flex flex-col overflow-y-auto",children:n.jsxs("div",{className:M,children:[U,$]})})]}),e[39]=M,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==v?(O=y&&n.jsxs("div",{className:"w-[45%] max-w-[680px] min-w-[380px] shrink-0 flex flex-col min-h-0 border-l border-border bg-background",children:[n.jsxs("div",{className:"h-10 shrink-0 flex items-center justify-between px-3 border-b border-border",children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[n.jsx(Se,{size:16}),"Library"]}),n.jsx("button",{type:"button",onClick:()=>v(void 0),"aria-label":"Close Library panel",className:"flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:n.jsx(ye,{size:16})})]}),n.jsx("div",{className:"flex-1 min-h-0",children:b?n.jsx(Mt,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=v,e[46]=O):O=e[46];let E;e[47]!==R||e[48]!==O?(E=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=E):E=e[49];let F;return e[50]!==C||e[51]!==E||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,E]}),e[50]=C,e[51]=E,e[52]=_,e[53]=F):F=e[53],F}function Un(t){const e=k.c(17),{isEditMode:s,hasChanges:o,onEnter:i,onSave:r,onCancel:a,onAddTile:d}=t;if(s){let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(be,{size:14}),e[0]=c):c=e[0];let u;e[1]!==d?(u=n.jsxs("button",{type:"button",onClick:d,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Add a tile from any agent",children:[c,"Add tile"]}),e[1]=d,e[2]=u):u=e[2];let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx(ye,{size:14}),e[3]=f):f=e[3];let p;e[4]!==a?(p=n.jsxs(Y,{size:"sm",variant:"ghost",onClick:a,className:"gap-1.5 h-7 text-xs",children:[f,"Cancel"]}),e[4]=a,e[5]=p):p=e[5];const h=!o;let g;e[6]===Symbol.for("react.memo_cache_sentinel")?(g=n.jsx(bt,{size:14}),e[6]=g):g=e[6];let b;e[7]!==r||e[8]!==h?(b=n.jsxs(Y,{size:"sm",onClick:r,disabled:h,className:"gap-1.5 h-7 text-xs",children:[g,"Save"]}),e[7]=r,e[8]=h,e[9]=b):b=e[9];let y;return e[10]!==u||e[11]!==p||e[12]!==b?(y=n.jsxs(n.Fragment,{children:[u,p,b]}),e[10]=u,e[11]=p,e[12]=b,e[13]=y):y=e[13],y}let l;e[14]===Symbol.for("react.memo_cache_sentinel")?(l=n.jsx(wt,{size:14}),e[14]=l):l=e[14];let m;return e[15]!==i?(m=n.jsxs("button",{type:"button",onClick:i,className:"flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors",title:"Customize your home",children:[l,"Customize"]}),e[15]=i,e[16]=m):m=e[16],m}function Bn(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx("img",{src:"/home/capybara.png",alt:"","aria-hidden":!0,className:"pointer-events-none absolute -top-16 right-6 z-20 h-20 w-auto select-none"}),t[0]=e):e=t[0],e}function er(){const t=k.c(2);if(ge()){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("div",{className:"flex-1 min-h-0 flex flex-col bg-background overflow-hidden",children:n.jsx(Ae,{})}),t[0]=o):o=t[0],o}let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=n.jsx("div",{className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",children:n.jsx("div",{className:"h-full p-0.5 pt-0.25",children:n.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:n.jsx(Ae,{})})})}),t[1]=s):s=t[1],s}export{er as default};
@@ -0,0 +1 @@
1
+ import{c as w,j as s,C as We,r as O,l as F,v as ae,D as Dt,F as Cs,a as be,G as de,b as he,H as ws,I as ks,t as ge,J as Is,M as zs,m as $s,B as Te,y as As,P as Ts,K as Ot,k as Mt,i as Pt,e as ot,u as it,E as Et,o as Ds,s as Os,n as Ms,p as Ps,d as Es,x as Fs,R as Ft,O as Rs}from"./index-DHTICC_v.js";import{u as Ce,S as at,a as ct,b as _e,c as ue,d as se,e as Rt,f as Lt,g as Ls,h as Bs,i as tt,j as Hs,k as Us,l as Gs}from"./sidebar-D2BmctMK.js";import{u as dt}from"./use-mobile-BkWraisf.js";import{S as fe}from"./skeleton-f0d6RrIL.js";import{i as Bt}from"./LayoutLeft-1bN-FR8E.js";import{T as xe}from"./toolbar-icon-button-DdAIuoK2.js";import{P as Pe,a as Ne,b as Ee}from"./popover-4-S-2t4S.js";import{D as Ht,a as Ut,b as Gt}from"./drawer-D1X6O6Aa.js";import{A as Me}from"./avatar-DxH3BnSs.js";import{a as je,b as ve,c as st,T as ye}from"./tooltip-CWNyrHYY.js";import{a as ht}from"./Eye-BFLaa-Ve.js";import{n as qs,i as Ws}from"./Globe01-Bx-hz-as.js";import{i as Ks}from"./ZoomOut-CwXzA7X6.js";import{i as Vs}from"./ZapSquare-D4RqdrSL.js";import{i as qt}from"./Monitor01-DrJKeSJ4.js";import{n as Xs,a as Qs}from"./Sun-CRJdfBLT.js";import{a as Ke,b as Ys}from"./Settings02-N32UBNZq.js";import{i as Js}from"./Shield01-BztOm8mA.js";import{a as Zs}from"./Users03-K1B4uaw7.js";import{a as pt,b as gt,c as Wt,A as De,d as bt,i as en,s as tn,e as sn}from"./agent-icon-BRuLsBYY.js";import"./index-Dq2Ts3Yi.js";import{n as Ve}from"./Stars02-BpRz9194.js";import{u as nn,v as rn,C as ln}from"./connect-desktop-dialog-DRNK5Zqx.js";import{i as Xe}from"./ChevronUp-DBXbYduj.js";import{s as Kt}from"./XClose-ChRyc7zA.js";import{u as on,a as an}from"./use-join-requests-CNT469hS.js";import{i as Vt}from"./ChevronRight-Gacf5_E2.js";import{u as cn,R as dn,a as mn,b as mt,r as un}from"./shell-layout-QzfqSuxf.js";import{u as Xt,g as fn}from"./agent-capabilities-C8WZk9re.js";import{i as xn}from"./FilterLines-CK4jmUMp.js";import{T as hn,a as pn}from"./toggle-group-BIoy7tOG.js";import{u as gn,S as bn,a as Ge,i as jn}from"./use-mcp-client-DAJmDOVO.js";import{u as Qt,a as Yt}from"./use-virtual-mcp-CJycW-Qv.js";import{u as vn,a as ut,b as Jt,T as yn}from"./hooks-UY6BFV6z.js";import{c as Sn,a as Nn,b as _n,d as Cn,e as wn}from"./dialog-BdIjDk0G.js";import{C as kn,a as In,b as zn,c as $n,d as An}from"./command-VE4J0WmB.js";import{u as Zt}from"./studio-tools-D6ANxpFE.js";import{i as Tn}from"./Zap-RN8PAcZE.js";import{S as es,M as Dn}from"./shell-controls-mi9y4ySh.js";import{T as ts,S as On}from"./shell-route-loading-Bpj8AlnX.js";import{t as ft}from"./ChevronDown-BLALKRGM.js";import{S as Mn}from"./task-status-BMnLETgS.js";import{S as ss,u as Pn,g as En,a as Fn,b as Rn}from"./use-navigate-to-agent-Dlhjy-0a.js";import{S as Ln,C as Bn}from"./chat-context-CIKFBD8u.js";import{B as jt,a as Hn,b as Un,c as Gn}from"./breadcrumb-DZbB5tzN.js";import{T as te}from"./toolbar-C1WgDWOZ.js";import{s as Ae}from"./Plus-Bz2JwGOE.js";import{i as ns}from"./SearchMd-Bn2Kbs9E.js";import{A as qn,a as Wn,b as Kn,c as Vn,d as Xn,e as Qn,f as Yn}from"./alert-dialog-D87-BKea.js";import{F as Jn,a as Zn,b as er,c as tr,d as sr,f as nr,e as rr}from"./form-P-LOMg0X.js";import{I as lr}from"./input-DgsFOGyM.js";import{s as or}from"./Star01-GFElhP7X.js";import{u as ir}from"./use-create-virtual-mcp-C50juX43.js";import{I as ar,u as cr,W as dr}from"./import-from-deco-dialog-CopvXqdM.js";import{G as mr,a as ur}from"./github-repo-picker-CmustdLW.js";import"./sheet-B3q7nz8B.js";import"./X-BQZZQdg0.js";import"./User01-9o9EbE3X.js";import"./AlertCircle-D8gnDqwf.js";import"./Tool01-DrE6CqtR.js";import"./SwitchHorizontal01-Bcp8nSOf.js";import"./XCircle-BOFvuFHl.js";import"./ArrowUpRight-BlXghneM.js";import"./CheckCircle-DCCFCHyS.js";import"./DotsVertical-D7ryssxp.js";import"./Globe04-u6eY2Kop.js";import"./HardDrive-B06hZ2KP.js";import"./Key01-D0oVN5CX.js";import"./LinkExternal01-D4vA-I3a.js";import"./Palette-CvuWqoBi.js";import"./Play-DuOwU6E2.js";import"./SearchLg-CfwbHNr5.js";import"./Stars01-CK-XatBt.js";import"./Trash01-kVRWRMat.js";import"./Upload01-TiHLQTwG.js";import"./Users01-CMbqiB_R.js";import"./use-capability-BmznXR_9.js";import"./required-auth-layout-B0YEEBld.js";import"./tab-id-DPNwWMUY.js";import"./use-organization-settings-D9G2tGsW.js";import"./use-org-sso-CEETlaem.js";import"./use-ai-providers-CVS8EjHf.js";import"./auth-pLLkIszG.js";import"./use-collections-BnOL5hT8.js";import"./decopilot-sse-pool-DA88fFcW.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./index-BbFfuuHN.js";import"./use-clock-tick-BXZK-6ig.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-decopilot-events-BB7o7ets.js";import"./label-CwMsBEmc.js";import"./use-connection-CRsO-Bab.js";import"./github-installations-DzN1UQ4x.js";import"./collection-search-B0gYtEWh.js";import"./checkbox-CFdij7Ei.js";import"./use-debounced-value-C2hJqHIV.js";import"./authenticate-and-persist-oauth-VdmVLbtW.js";import"./mcp-oauth-SxDhA9AX.js";import"./use-mcp-tools-AjHzJbIQ.js";import"./extract-connection-data-BhI39RpO.js";function fr(t){const e=w.c(5),{onPointerDown:n,onDoubleClick:r}=t,{state:l,isMobile:o}=Ce();if(o||l==="collapsed")return null;let i,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={left:"var(--sidebar-width)"},a=s.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-transparent transition-colors duration-150 group-hover/resize:bg-border group-active/resize:bg-border"}),e[0]=i,e[1]=a):(i=e[0],a=e[1]);let c;return e[2]!==r||e[3]!==n?(c=s.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize sidebar",title:"Drag to resize, double-click to reset",onPointerDown:n,onDoubleClick:r,className:"group/resize absolute top-0 z-20 h-full w-2 -translate-x-1/2 cursor-col-resize",style:i,children:a}),e[2]=r,e[3]=n,e[4]=c):c=e[4],c}const xt=240,xr=400,hr="sidebar.width";function Oe(t){return Math.max(xt,Math.min(xr,t))}function pr(){const t=w.c(11),[e,n]=We(hr,gr),r=O.useRef(null);let l;t[0]!==n||t[1]!==e?(l=m=>{m.preventDefault();const u=m.clientX,f=Oe(e),h=r.current??(typeof document<"u"?document.querySelector('[data-slot="sidebar-wrapper"]'):null),p=h?Array.from(h.querySelectorAll('[data-slot="sidebar"], [data-slot="sidebar-container"]')):[];for(const b of p)b.style.transition="none";const x=b=>{const j=Oe(f+(b.clientX-u));h?.style.setProperty("--sidebar-width",`${j}px`)},g=b=>{const j=Oe(f+(b.clientX-u));n(j);for(const v of p)v.style.transition="";window.removeEventListener("pointermove",x),window.removeEventListener("pointerup",g),document.body.style.userSelect="",document.body.style.cursor=""};document.body.style.userSelect="none",document.body.style.cursor="col-resize",window.addEventListener("pointermove",x),window.addEventListener("pointerup",g)},t[0]=n,t[1]=e,t[2]=l):l=t[2];const o=l;let i;t[3]!==n?(i=()=>{n(xt)},t[3]=n,t[4]=i):i=t[4];const a=i;let c;t[5]!==e?(c=Oe(e),t[5]=e,t[6]=c):c=t[6];let d;return t[7]!==o||t[8]!==a||t[9]!==c?(d={width:c,wrapperRef:r,onStartResize:o,resetWidth:a},t[7]=o,t[8]=a,t[9]=c,t[10]=d):d=t[10],d}function gr(t){return typeof t=="number"?Oe(t):xt}function rs(){return[]}function ls(t){const e=w.c(3),{children:n}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex h-6 items-center",children:s.jsx("div",{className:"h-0.5 w-16 rounded-full bg-sidebar-foreground/15"})}),e[0]=r):r=e[0];let l;return e[1]!==n?(l=s.jsxs(at,{className:"pt-0 pr-0 pb-2 pl-0 mt-2",children:[r,s.jsx(ct,{children:s.jsx(_e,{className:"gap-0.5",children:n})})]}),e[1]=n,e[2]=l):l=e[2],l}function os(t){const e=w.c(18),{item:n}=t,{isMobile:r,setOpenMobile:l}=Ce();let o;e[0]!==r||e[1]!==n||e[2]!==l?(o=()=>{ae("nav_item_clicked",{nav_key:n.key,nav_label:n.label,is_active:!!n.isActive,is_mobile:r}),n.onClick?.(),r&&l(!1)},e[0]=r,e[1]=n,e[2]=l,e[3]=o):o=e[3];const i=o,a=n.key,c=n.isActive&&"z-10";let d;e[4]!==c?(d=F(c),e[4]=c,e[5]=d):d=e[5];let m;e[6]!==n.label?(m=s.jsx("span",{children:n.label}),e[6]=n.label,e[7]=m):m=e[7];let u;e[8]!==i||e[9]!==n.icon||e[10]!==n.isActive||e[11]!==n.label||e[12]!==m?(u=s.jsxs(ue,{onClick:i,isActive:n.isActive,tooltip:n.label,children:[n.icon,m]}),e[8]=i,e[9]=n.icon,e[10]=n.isActive,e[11]=n.label,e[12]=m,e[13]=u):u=e[13];let f;return e[14]!==n.key||e[15]!==d||e[16]!==u?(f=s.jsx(se,{className:d,children:u},a),e[14]=n.key,e[15]=d,e[16]=u,e[17]=f):f=e[17],f}function br(t){const e=w.c(12),{section:n}=t;switch(n.type){case"divider":{let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Rt,{className:"my-2"}),e[0]=r):r=e[0],r}case"spacer":{let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"flex-1"}),e[1]=r):r=e[1],r}case"group":{const r=n.group.label,l=n.group.defaultExpanded;let o;e[2]!==n.group.items?(o=n.group.items.map(vr),e[2]=n.group.items,e[3]=o):o=e[3];let i;return e[4]!==n.group.defaultExpanded||e[5]!==n.group.label||e[6]!==o?(i=s.jsx(ls,{label:r,defaultExpanded:l,children:o}),e[4]=n.group.defaultExpanded,e[5]=n.group.label,e[6]=o,e[7]=i):i=e[7],i}case"items":{let r;e[8]!==n.items?(r=n.items.map(jr),e[8]=n.items,e[9]=r):r=e[9];let l;return e[10]!==r?(l=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(_e,{className:"gap-1.5",children:r})})}),e[10]=r,e[11]=l):l=e[11],l}case"custom":return n.content}}function jr(t){return s.jsx(os,{item:t},t.key)}function vr(t){return s.jsx(os,{item:t},t.key)}function yr(t){const e=w.c(14),{sections:n,footer:r,additionalContent:l,variant:o,contentClassName:i}=t,a=o===void 0?"sidebar":o;let c;e[0]!==i?(c=F("flex flex-col flex-1 px-2 py-2 gap-0.5",i),e[0]=i,e[1]=c):c=e[1];let d;e[2]!==n?(d=n.map(Sr),e[2]=n,e[3]=d):d=e[3];let m;e[4]!==l?(m=l&&s.jsx("div",{className:"flex flex-col flex-1 min-h-0 group-data-[state=collapsed]/sidebar:mt-1 group-data-[state=expanded]/sidebar:mt-2",children:l}),e[4]=l,e[5]=m):m=e[5];let u;e[6]!==c||e[7]!==d||e[8]!==m?(u=s.jsxs(Lt,{className:c,children:[d,m]}),e[6]=c,e[7]=d,e[8]=m,e[9]=u):u=e[9];let f;return e[10]!==r||e[11]!==u||e[12]!==a?(f=s.jsxs(Ls,{variant:a,children:[u,r]}),e[10]=r,e[11]=u,e[12]=a,e[13]=f):f=e[13],f}function Sr(t,e){return s.jsx(br,{section:t},e)}function is(t){const e=w.c(2);let n;return e[0]!==t?(n=s.jsx(yr,{...t}),e[0]=t,e[1]=n):n=e[1],n}is.Skeleton=function(){return s.jsx("div",{className:"flex flex-col gap-0.5",children:Array.from({length:8}).map((e,n)=>s.jsx("div",{className:"w-full h-8",children:s.jsx(fe,{className:"h-full bg-sidebar-accent rounded-md"})},n))})};function Nr(t){const e=w.c(16),{onToggle:n,className:r}=t,o=Dt().logo??Cs,i=typeof o=="string"?o:o.light,a=typeof o=="string"?o:o.dark;let c;e[0]!==r?(c=F("flex flex-row items-center gap-2 md:gap-0.5 shrink-0 h-12 pl-1 pr-2 pt-0.25 pb-0","group-data-[collapsible=icon]/sidebar:hidden",r),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==i?(d=s.jsx("img",{src:i,alt:"Logo",className:"size-6 object-contain dark:hidden"}),e[2]=i,e[3]=d):d=e[3];let m;e[4]!==a?(m=s.jsx("img",{src:a,alt:"Logo",className:"size-6 object-contain hidden dark:block"}),e[4]=a,e[5]=m):m=e[5];let u;e[6]!==d||e[7]!==m?(u=s.jsx("span",{className:"flex items-center shrink-0 pl-1",children:s.jsxs("span",{className:"flex items-center shrink-0 px-2",children:[d,m]})}),e[6]=d,e[7]=m,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Bt,{size:16}),e[9]=f):f=e[9];let h;e[10]!==n?(h=s.jsx(xe,{onClick:n,"aria-label":"Toggle sidebar",children:f}),e[10]=n,e[11]=h):h=e[11];let p;return e[12]!==c||e[13]!==u||e[14]!==h?(p=s.jsxs(Bs,{className:c,children:[u,h]}),e[12]=c,e[13]=u,e[14]=h,e[15]=p):p=e[15],p}function vt(t){const e=w.c(18),{item:n,onClose:r}=t,l=n.isActive&&"z-10";let o;e[0]!==l?(o=F(l),e[0]=l,e[1]=o):o=e[1];let i;e[2]!==n||e[3]!==r?(i=()=>{n.onClick?.(),r()},e[2]=n,e[3]=r,e[4]=i):i=e[4];let a;e[5]!==n.icon?(a=s.jsx("span",{className:"[&>svg]:size-5 shrink-0",children:n.icon}),e[5]=n.icon,e[6]=a):a=e[6];let c;e[7]!==n.label?(c=s.jsx("span",{children:n.label}),e[7]=n.label,e[8]=c):c=e[8];let d;e[9]!==n.isActive||e[10]!==n.label||e[11]!==i||e[12]!==a||e[13]!==c?(d=s.jsxs(ue,{onClick:i,isActive:n.isActive,tooltip:n.label,className:"h-10! text-sm!",children:[a,c]}),e[9]=n.isActive,e[10]=n.label,e[11]=i,e[12]=a,e[13]=c,e[14]=d):d=e[14];let m;return e[15]!==o||e[16]!==d?(m=s.jsx(se,{className:o,children:d}),e[15]=o,e[16]=d,e[17]=m):m=e[17],m}function _r(t){const e=w.c(18),{section:n,onClose:r}=t;switch(n.type){case"divider":{let l;return e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Rt,{className:"my-2"}),e[0]=l):l=e[0],l}case"spacer":{let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1"}),e[1]=l):l=e[1],l}case"group":{const l=n.group.label,o=n.group.defaultExpanded;let i;if(e[2]!==r||e[3]!==n.group.items){let c;e[5]!==r?(c=d=>s.jsx(vt,{item:d,onClose:r},d.key),e[5]=r,e[6]=c):c=e[6],i=n.group.items.map(c),e[2]=r,e[3]=n.group.items,e[4]=i}else i=e[4];let a;return e[7]!==n.group.defaultExpanded||e[8]!==n.group.label||e[9]!==i?(a=s.jsx(ls,{label:l,defaultExpanded:o,children:i}),e[7]=n.group.defaultExpanded,e[8]=n.group.label,e[9]=i,e[10]=a):a=e[10],a}case"items":{let l;if(e[11]!==r||e[12]!==n.items){let i;e[14]!==r?(i=a=>s.jsx(vt,{item:a,onClose:r},a.key),e[14]=r,e[15]=i):i=e[15],l=n.items.map(i),e[11]=r,e[12]=n.items,e[13]=l}else l=e[13];let o;return e[16]!==l?(o=s.jsx(at,{className:"pt-0 pr-0 pb-0 pl-0",children:s.jsx(ct,{children:s.jsx(_e,{className:"gap-1.5",children:l})})}),e[16]=l,e[17]=o):o=e[17],o}case"custom":return n.content}}function Cr(t){const e=w.c(17),{sections:n,onClose:r,footer:l,additionalContent:o}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx("div",{className:"h-12 shrink-0"}),e[0]=i):i=e[0];let a;e[1]!==r?(a=s.jsx(O.Suspense,{fallback:i,children:s.jsx(Nr,{onToggle:r})}),e[1]=r,e[2]=a):a=e[2];let c;if(e[3]!==r||e[4]!==n){let f;e[6]!==r?(f=(h,p)=>s.jsx(_r,{section:h,onClose:r},p),e[6]=r,e[7]=f):f=e[7],c=n.map(f),e[3]=r,e[4]=n,e[5]=c}else c=e[5];let d;e[8]!==o?(d=o&&s.jsx("div",{className:"mt-3 flex flex-col flex-1 min-h-0",children:o}),e[8]=o,e[9]=d):d=e[9];let m;e[10]!==c||e[11]!==d?(m=s.jsxs(Lt,{className:"flex flex-col flex-1 px-2 py-2 gap-0",children:[c,d]}),e[10]=c,e[11]=d,e[12]=m):m=e[12];let u;return e[13]!==l||e[14]!==a||e[15]!==m?(u=s.jsxs("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:[a,m,l]}),e[13]=l,e[14]=a,e[15]=m,e[16]=u):u=e[16],u}function Be(t){const e=w.c(22),{item:n,onClose:r}=t;if(n.href){const c=n.external?"_blank":void 0,d=n.external?"noopener noreferrer":void 0;let m;e[0]!==n.icon?(m=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[0]=n.icon,e[1]=m):m=e[1];let u;e[2]!==n.label?(u=s.jsx("span",{className:"flex-1",children:n.label}),e[2]=n.label,e[3]=u):u=e[3];let f;return e[4]!==n.href||e[5]!==r||e[6]!==c||e[7]!==d||e[8]!==m||e[9]!==u?(f=s.jsxs("a",{href:n.href,target:c,rel:d,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",onClick:r,children:[m,u]}),e[4]=n.href,e[5]=r,e[6]=c,e[7]=d,e[8]=m,e[9]=u,e[10]=f):f=e[10],f}let l;e[11]!==n||e[12]!==r?(l=()=>{n.onClick?.(),r()},e[11]=n,e[12]=r,e[13]=l):l=e[13];let o;e[14]!==n.icon?(o=s.jsx("span",{className:"shrink-0 text-muted-foreground",children:n.icon}),e[14]=n.icon,e[15]=o):o=e[15];let i;e[16]!==n.label?(i=s.jsx("span",{className:"flex-1",children:n.label}),e[16]=n.label,e[17]=i):i=e[17];let a;return e[18]!==l||e[19]!==o||e[20]!==i?(a=s.jsxs("button",{type:"button",onClick:l,className:"flex items-center gap-2.5 px-3 py-2 rounded-md text-sm text-left w-full transition-colors text-foreground/80 hover:bg-sidebar-accent hover:text-foreground",children:[o,i]}),e[18]=l,e[19]=o,e[20]=i,e[21]=a):a=e[21],a}function yt(t){const e=w.c(126),{user:n,userImage:r,menuItems:l,signOutItem:o,themeOptions:i,preferences:a,setPreferences:c,close:d,isMobile:m}=t;if(m){const L=n?.name??"U";let H;e[0]!==L||e[1]!==r?(H=s.jsx(Me,{url:r,fallback:L,shape:"circle",size:"sm",className:"shrink-0"}),e[0]=L,e[1]=r,e[2]=H):H=e[2];const Z=n?.name??"User";let K;e[3]!==Z?(K=s.jsx("p",{className:"text-sm font-medium truncate",children:Z}),e[3]=Z,e[4]=K):K=e[4];const ee=n?.email;let G;e[5]!==ee?(G=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:ee}),e[5]=ee,e[6]=G):G=e[6];let le;e[7]!==K||e[8]!==G?(le=s.jsxs("div",{className:"flex-1 min-w-0",children:[K,G]}),e[7]=K,e[8]=G,e[9]=le):le=e[9];let ce;e[10]!==n?(ce=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(zr)},e[10]=n,e[11]=ce):ce=e[11];let V;e[12]===Symbol.for("react.memo_cache_sentinel")?(V=s.jsx(ht,{size:14}),e[12]=V):V=e[12];let J;e[13]!==ce?(J=s.jsx(je,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:ce,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:V})}),e[13]=ce,e[14]=J):J=e[14];let me;e[15]===Symbol.for("react.memo_cache_sentinel")?(me=s.jsx(ve,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[15]=me):me=e[15];let I;e[16]!==J?(I=s.jsx(st,{delayDuration:300,children:s.jsxs(ye,{children:[J,me]})}),e[16]=J,e[17]=I):I=e[17];let D;e[18]!==I||e[19]!==H||e[20]!==le?(D=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-4 border-b border-border",children:[H,le,I]}),e[18]=I,e[19]=H,e[20]=le,e[21]=D):D=e[21];let B;if(e[22]!==d||e[23]!==l){let pe;e[25]!==d?(pe=Le=>s.jsx(Be,{item:Le,onClose:d},Le.key),e[25]=d,e[26]=pe):pe=e[26],B=l.map(pe),e[22]=d,e[23]=l,e[24]=B}else B=e[24];let P;e[27]!==d||e[28]!==o?(P=s.jsx(Be,{item:o,onClose:d}),e[27]=d,e[28]=o,e[29]=P):P=e[29];let X;e[30]!==B||e[31]!==P?(X=s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:s.jsxs("nav",{className:"flex flex-col px-2 pt-2 pb-2 gap-0.5",children:[B,P]})}),e[30]=B,e[31]=P,e[32]=X):X=e[32];let oe;if(e[33]!==a.theme||e[34]!==c||e[35]!==i){let pe;e[37]!==a.theme||e[38]!==c?(pe=Le=>{const{value:Je,icon:Ss,label:Ns}=Le;return s.jsx("button",{type:"button","aria-label":Ns,onClick:()=>c(_s=>({..._s,theme:Je})),className:F("size-8 rounded-md flex items-center justify-center transition-colors",a.theme===Je?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:Ss},Je)},e[37]=a.theme,e[38]=c,e[39]=pe):pe=e[39],oe=i.map(pe),e[33]=a.theme,e[34]=c,e[35]=i,e[36]=oe}else oe=e[36];let ie;e[40]!==oe?(ie=s.jsx("div",{className:"flex items-center gap-0.5",children:oe}),e[40]=oe,e[41]=ie):ie=e[41];const Se=a.enableSounds?"Disable sounds":"Enable sounds";let U;e[42]!==c?(U=()=>c(Ir),e[42]=c,e[43]=U):U=e[43];const Ye=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let we;e[44]!==Ye?(we=F("size-8 rounded-md flex items-center justify-center transition-colors",Ye),e[44]=Ye,e[45]=we):we=e[45];let ke;e[46]!==a.enableSounds?(ke=a.enableSounds?s.jsx(pt,{size:14}):s.jsx(gt,{size:14}),e[46]=a.enableSounds,e[47]=ke):ke=e[47];let Ie;e[48]!==Se||e[49]!==U||e[50]!==we||e[51]!==ke?(Ie=s.jsx("button",{type:"button","aria-label":Se,onClick:U,className:we,children:ke}),e[48]=Se,e[49]=U,e[50]=we,e[51]=ke,e[52]=Ie):Ie=e[52];let Fe;e[53]===Symbol.for("react.memo_cache_sentinel")?(Fe=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.17.0"]}),e[53]=Fe):Fe=e[53];let ze;e[54]!==Ie?(ze=s.jsxs("div",{className:"flex items-center gap-2",children:[Ie,Fe]}),e[54]=Ie,e[55]=ze):ze=e[55];let $e;e[56]!==ie||e[57]!==ze?($e=s.jsxs("div",{className:"flex items-center justify-between px-3 py-3 border-t border-border/50",children:[ie,ze]}),e[56]=ie,e[57]=ze,e[58]=$e):$e=e[58];let Re;return e[59]!==D||e[60]!==X||e[61]!==$e?(Re=s.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[D,X,$e]}),e[59]=D,e[60]=X,e[61]=$e,e[62]=Re):Re=e[62],Re}const u=n?.name??"U";let f;e[63]!==u||e[64]!==r?(f=s.jsx(Me,{url:r,fallback:u,shape:"circle",size:"sm",className:"shrink-0"}),e[63]=u,e[64]=r,e[65]=f):f=e[65];const h=n?.name??"User";let p;e[66]!==h?(p=s.jsx("p",{className:"text-sm font-medium truncate",children:h}),e[66]=h,e[67]=p):p=e[67];const x=n?.email;let g;e[68]!==x?(g=s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:x}),e[68]=x,e[69]=g):g=e[69];let b;e[70]!==p||e[71]!==g?(b=s.jsxs("div",{className:"flex-1 min-w-0",children:[p,g]}),e[70]=p,e[71]=g,e[72]=b):b=e[72];let j;e[73]!==n?(j=()=>{n?.id&&navigator.clipboard.writeText(n.id).then(kr)},e[73]=n,e[74]=j):j=e[74];let v;e[75]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(ht,{size:14}),e[75]=v):v=e[75];let y;e[76]!==j?(y=s.jsx(je,{asChild:!0,children:s.jsx("button",{type:"button",tabIndex:-1,onClick:j,className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:v})}),e[76]=j,e[77]=y):y=e[77];let _;e[78]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(ve,{side:"right",children:s.jsx("p",{className:"text-xs",children:"Copy user ID"})}),e[78]=_):_=e[78];let k;e[79]!==y?(k=s.jsx(st,{delayDuration:300,children:s.jsxs(ye,{children:[y,_]})}),e[79]=y,e[80]=k):k=e[80];let N;e[81]!==k||e[82]!==f||e[83]!==b?(N=s.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 mx-1 mt-1",children:[f,b,k]}),e[81]=k,e[82]=f,e[83]=b,e[84]=N):N=e[84];let C;if(e[85]!==d||e[86]!==l){let L;e[88]!==d?(L=H=>s.jsx(Be,{item:H,onClose:d},H.key),e[88]=d,e[89]=L):L=e[89],C=l.map(L),e[85]=d,e[86]=l,e[87]=C}else C=e[87];let S;e[90]!==d||e[91]!==o?(S=s.jsx(Be,{item:o,onClose:d}),e[90]=d,e[91]=o,e[92]=S):S=e[92];let z;e[93]!==C||e[94]!==S?(z=s.jsxs("nav",{className:"flex-1 flex flex-col px-2 pt-1 overflow-y-auto",children:[C,S]}),e[93]=C,e[94]=S,e[95]=z):z=e[95];let T;if(e[96]!==a.theme||e[97]!==c||e[98]!==i){let L;e[100]!==a.theme||e[101]!==c?(L=H=>{const{value:Z,icon:K,label:ee}=H;return s.jsx("button",{type:"button","aria-label":ee,onClick:()=>c(G=>({...G,theme:Z})),className:F("size-7 rounded-md flex items-center justify-center transition-colors",a.theme===Z?"bg-sidebar-accent text-foreground":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground"),children:K},Z)},e[100]=a.theme,e[101]=c,e[102]=L):L=e[102],T=i.map(L),e[96]=a.theme,e[97]=c,e[98]=i,e[99]=T}else T=e[99];let A;e[103]!==T?(A=s.jsx("div",{className:"flex items-center gap-0.5",children:T}),e[103]=T,e[104]=A):A=e[104];const $=a.enableSounds?"Disable sounds":"Enable sounds";let E;e[105]!==c?(E=()=>c(wr),e[105]=c,e[106]=E):E=e[106];const W=a.enableSounds?"text-foreground hover:bg-sidebar-accent/50":"text-muted-foreground hover:bg-sidebar-accent/50 hover:text-foreground";let M;e[107]!==W?(M=F("size-7 rounded-md flex items-center justify-center transition-colors",W),e[107]=W,e[108]=M):M=e[108];let q;e[109]!==a.enableSounds?(q=a.enableSounds?s.jsx(pt,{size:14}):s.jsx(gt,{size:14}),e[109]=a.enableSounds,e[110]=q):q=e[110];let R;e[111]!==$||e[112]!==E||e[113]!==M||e[114]!==q?(R=s.jsx("button",{type:"button","aria-label":$,onClick:E,className:M,children:q}),e[111]=$,e[112]=E,e[113]=M,e[114]=q,e[115]=R):R=e[115];let Q;e[116]===Symbol.for("react.memo_cache_sentinel")?(Q=s.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["v","4.17.0"]}),e[116]=Q):Q=e[116];let Y;e[117]!==R?(Y=s.jsxs("div",{className:"flex items-center gap-2",children:[R,Q]}),e[117]=R,e[118]=Y):Y=e[118];let ne;e[119]!==A||e[120]!==Y?(ne=s.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 border-t border-border/50",children:[A,Y]}),e[119]=A,e[120]=Y,e[121]=ne):ne=e[121];let re;return e[122]!==N||e[123]!==z||e[124]!==ne?(re=s.jsx("div",{className:"flex w-full flex-col overflow-hidden",children:s.jsxs("div",{className:"flex flex-col",children:[N,z,ne]})}),e[122]=N,e[123]=z,e[124]=ne,e[125]=re):re=e[125],re}function wr(t){return{...t,enableSounds:!t.enableSounds}}function kr(){ge.success("User ID copied")}function Ir(t){return{...t,enableSounds:!t.enableSounds}}function zr(){ge.success("User ID copied")}function nt(){const t=w.c(34),{data:e}=be.useSession(),{org:n}=de(),r=he();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l={from:"/shell/$org",shouldThrow:!1},t[0]=l):l=t[0];const i=ws(l)?.params.org,[a,c]=ks(),d=dt(),[m,u]=O.useState(!1),f=e?.user,h=f?.image;let p;t[1]===Symbol.for("react.memo_cache_sentinel")?(p=()=>u(!1),t[1]=p):p=t[1];const x=p;let g;t[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ke,{size:16}),t[2]=g):g=t[2];let b;t[3]!==r||t[4]!==i?(b={key:"preferences",label:"Preferences",icon:g,onClick:()=>{r({to:"/$org/settings/profile",params:{org:i??""}})}},t[3]=r,t[4]=i,t[5]=b):b=t[5];let j;t[6]!==n||t[7]!==r?(j=n?[{key:"install-app",label:"Add to Home Screen",icon:s.jsx(qs,{size:16}),onClick:()=>{r({to:"/$org/install",params:{org:n.slug}})}}]:[],t[6]=n,t[7]=r,t[8]=j):j=t[8];let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v={key:"terms",label:"Terms of Use",icon:s.jsx(Ks,{size:16}),href:"https://www.decocms.com/terms-of-use",external:!0},t[9]=v):v=t[9];let y;t[10]===Symbol.for("react.memo_cache_sentinel")?(y={key:"privacy",label:"Privacy Policy",icon:s.jsx(Js,{size:16}),href:"https://www.decocms.com/privacy-policy",external:!0},t[10]=y):y=t[10];let _;t[11]===Symbol.for("react.memo_cache_sentinel")?(_={key:"github",label:"decocms/studio",icon:s.jsx(Is,{className:"w-4 h-4"}),href:"https://github.com/decocms/studio",external:!0},t[11]=_):_=t[11];let k;t[12]===Symbol.for("react.memo_cache_sentinel")?(k={key:"community",label:"Community",icon:s.jsx(Zs,{size:16}),href:"https://decocms.com/discord",external:!0},t[12]=k):k=t[12];let N;t[13]===Symbol.for("react.memo_cache_sentinel")?(N={key:"homepage",label:"Homepage",icon:s.jsx(Ws,{size:16}),href:"https://decocms.com",external:!0},t[13]=N):N=t[13];let C;t[14]!==b||t[15]!==j?(C=[b,...j,v,y,_,k,N],t[14]=b,t[15]=j,t[16]=C):C=t[16];const S=C;let z;t[17]===Symbol.for("react.memo_cache_sentinel")?(z={key:"logout",label:"Sign out",icon:s.jsx(Vs,{size:16}),onClick:Ar},t[17]=z):z=t[17];const T=z;let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A={value:"light",icon:s.jsx(Xs,{size:14}),label:"Light theme"},t[18]=A):A=t[18];let $;t[19]===Symbol.for("react.memo_cache_sentinel")?($={value:"dark",icon:s.jsx(Qs,{size:14}),label:"Dark theme"},t[19]=$):$=t[19];let E;t[20]===Symbol.for("react.memo_cache_sentinel")?(E=[A,$,{value:"system",icon:s.jsx(qt,{size:14}),label:"System theme"}],t[20]=E):E=t[20];const W=E;let M;t[21]!==d||t[22]!==S||t[23]!==a||t[24]!==c||t[25]!==f||t[26]!==h?(M={user:f,userImage:h,menuItems:S,signOutItem:T,themeOptions:W,preferences:a,setPreferences:c,close:x,isMobile:d},t[21]=d,t[22]=S,t[23]=a,t[24]=c,t[25]=f,t[26]=h,t[27]=M):M=t[27];const q=M;let R;return t[28]!==d||t[29]!==m||t[30]!==q||t[31]!==f?.name||t[32]!==h?(R=s.jsx(s.Fragment,{children:d?s.jsxs(Ht,{open:m,onOpenChange:u,direction:"bottom",children:[s.jsxs("button",{type:"button",onClick:()=>u(!0),className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx(Me,{url:h,fallback:f?.name??"U",shape:"circle",size:"2xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]}),s.jsxs(Ut,{className:"h-[80dvh] p-0",children:[s.jsx(Gt,{className:"sr-only",children:"Account"}),s.jsx(yt,{...q})]})]}):s.jsxs(Pe,{open:m,onOpenChange:u,children:[s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:f?.name??"Account",className:"rounded-md",children:[s.jsx(Me,{url:h,fallback:f?.name??"U",shape:"circle",size:"xs",className:"shrink-0"}),s.jsx("span",{className:"truncate",children:f?.name??"Account"})]})}),s.jsx(Ee,{side:"right",align:"end",sideOffset:18,collisionPadding:16,className:"w-[280px] p-0 flex flex-col max-h-[520px]",onCloseAutoFocus:$r,children:s.jsx(yt,{...q})})]})}),t[28]=d,t[29]=m,t[30]=q,t[31]=f?.name,t[32]=h,t[33]=R):R=t[33],R}function $r(t){return t.preventDefault()}function Ar(){ae("signed_out",{source:"account_popover"}),zs(),be.signOut()}function rt(){const t=w.c(22),e=nn(),[n,r]=O.useState(!1);let l;if(t[0]!==e.capabilities||t[1]!==e.hostname||t[2]!==e.machineId||t[3]!==e.online){const x=rn(e.capabilities);l=e.online?s.jsxs("div",{className:"flex flex-col gap-0.5 text-xs",children:[s.jsx("span",{className:"font-medium",children:e.hostname??e.machineId??"Desktop linked"}),s.jsx("span",{className:"text-muted-foreground",children:x.length>0?`Available: ${x.join(", ")}`:"No CLI agents detected"})]}):s.jsx("span",{className:"text-xs",children:"Desktop disconnected"}),t[0]=e.capabilities,t[1]=e.hostname,t[2]=e.machineId,t[3]=e.online,t[4]=l}else l=t[4];const o=l;let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=()=>r(!0),t[5]=i):i=t[5];const a=e.online?"Desktop linked":"Connect your desktop";let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(qt,{size:16}),t[6]=c):c=t[6];let d;t[7]!==e.online?(d=e.online&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-success ring-2 ring-background animate-pulse"}),t[7]=e.online,t[8]=d):d=t[8];let m;t[9]!==a||t[10]!==d?(m=s.jsx(je,{asChild:!0,children:s.jsxs(xe,{onClick:i,"aria-label":a,children:[c,d]})}),t[9]=a,t[10]=d,t[11]=m):m=t[11];let u;t[12]!==o?(u=s.jsx(ve,{side:"bottom",children:o}),t[12]=o,t[13]=u):u=t[13];let f;t[14]!==m||t[15]!==u?(f=s.jsxs(ye,{children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16];let h;t[17]!==n?(h=s.jsx(ln,{open:n,onOpenChange:r}),t[17]=n,t[18]=h):h=t[18];let p;return t[19]!==f||t[20]!==h?(p=s.jsxs(s.Fragment,{children:[f,h]}),t[19]=f,t[20]=h,t[21]=p):p=t[21],p}function Tr({invitation:t}){const[e,n]=O.useState(!1),[r,l]=O.useState(!1),o=$s(),i=async()=>{n(!0);try{const d=await be.organization.acceptInvitation({invitationId:t.id});if(d.error){ge.error(d.error.message),n(!1);return}}catch{ge.error("Failed to accept invitation"),n(!1);return}ge.success("Invitation accepted!"),As();let c;try{c=(await be.organization.getFullOrganization({query:{organizationId:t.organizationId}}))?.data?.slug}catch{}window.location.href=c?`/${c}`:"/"},a=async()=>{l(!0);try{const c=await be.organization.rejectInvitation({invitationId:t.id});c.error?(ge.error(c.error.message),l(!1)):(ge.success("Invitation declined"),o.invalidateQueries())}catch{ge.error("Failed to decline invitation"),l(!1)}};return s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"You've been invited to join"}),s.jsx("p",{className:"text-sm font-medium truncate",children:t.organizationName??"Unknown organization"})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:i,disabled:e||r,"aria-label":"Accept invitation",children:s.jsx(Xe,{size:14})}),s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:a,disabled:e||r,"aria-label":"Decline invitation",children:s.jsx(Kt,{size:14})})]})]})}function Dr(t){const e=w.c(29),{request:n}=t,{approve:r,deny:l}=on(),o=r.isPending||l.isPending,i=n.user?.name??n.user?.email??n.userId,a=n.user?.image??void 0;let c;e[0]!==i?(c=i.charAt(0).toUpperCase(),e[0]=i,e[1]=c):c=e[1];let d;e[2]!==a||e[3]!==c?(d=s.jsx(Me,{url:a,fallback:c,shape:"circle",size:"sm"}),e[2]=a,e[3]=c,e[4]=d):d=e[4];let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Requested to join"}),e[5]=m):m=e[5];let u;e[6]!==i?(u=s.jsxs("div",{className:"flex-1 min-w-0",children:[m,s.jsx("p",{className:"text-sm font-medium truncate",children:i})]}),e[6]=i,e[7]=u):u=e[7];let f;e[8]!==r||e[9]!==n.id?(f=()=>r.mutate(n.id),e[8]=r,e[9]=n.id,e[10]=f):f=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Xe,{size:14}),e[11]=h):h=e[11];let p;e[12]!==o||e[13]!==f?(p=s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-green-600 hover:text-green-700 hover:bg-green-50 dark:hover:bg-green-950",onClick:f,disabled:o,"aria-label":"Approve join request",children:h}),e[12]=o,e[13]=f,e[14]=p):p=e[14];let x;e[15]!==l||e[16]!==n.id?(x=()=>l.mutate(n.id),e[15]=l,e[16]=n.id,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Kt,{size:14}),e[18]=g):g=e[18];let b;e[19]!==o||e[20]!==x?(b=s.jsx(Te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground hover:text-destructive hover:bg-destructive/10",onClick:x,disabled:o,"aria-label":"Deny join request",children:g}),e[19]=o,e[20]=x,e[21]=b):b=e[21];let j;e[22]!==b||e[23]!==p?(j=s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[p,b]}),e[22]=b,e[23]=p,e[24]=j):j=e[24];let v;return e[25]!==j||e[26]!==d||e[27]!==u?(v=s.jsxs("div",{className:"flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors",children:[d,u,j]}),e[25]=j,e[26]=d,e[27]=u,e[28]=v):v=e[28],v}function Or(t){const e=w.c(14),{release:n,isSeen:r,onSelect:l}=t;let o;e[0]!==r?(o=!r&&s.jsx("span",{"aria-label":"New release",className:"absolute left-2 top-1/2 -translate-y-1/2 size-1.5 rounded-full bg-primary"}),e[0]=r,e[1]=o):o=e[1];let i;e[2]!==n.eyebrow?(i=n.eyebrow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.eyebrow}),e[2]=n.eyebrow,e[3]=i):i=e[3];let a;e[4]!==n.title?(a=s.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:n.title}),e[4]=n.title,e[5]=a):a=e[5];let c;e[6]!==i||e[7]!==a?(c=s.jsxs("div",{className:"flex-1 min-w-0",children:[i,a]}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Vt,{size:16,className:"text-muted-foreground shrink-0"}),e[9]=d):d=e[9];let m;return e[10]!==l||e[11]!==o||e[12]!==c?(m=s.jsxs("button",{type:"button",onClick:l,className:"relative w-full flex items-center gap-3 px-5 py-4 border-b border-border last:border-0 hover:bg-muted/25 transition-colors text-left",children:[o,c,d]}),e[10]=l,e[11]=o,e[12]=c,e[13]=m):m=e[13],m}function Mr(){const t=O.useContext(Ts),{data:e}=t.hooks.useListUserInvitations();return(e??[]).filter(r=>r.status==="pending"&&new Date(r.expiresAt)>new Date)}function as(){const t=w.c(11),{isSeen:e,markSeen:n,unseenCount:r}=cn(),l=Mr(),o=an();let i;if(t[0]!==e||t[1]!==l||t[2]!==o){const d=[...o].sort(Lr).map(Rr),m=[...l].sort(Fr).map(Er);let u;t[4]!==e?(u=h=>({type:"release",release:h,isSeen:e(h.id)}),t[4]=e,t[5]=u):u=t[5];const f=[...dn].sort(Pr).map(u);i=[...d,...m,...f],t[0]=e,t[1]=l,t[2]=o,t[3]=i}else i=t[3];const a=r+l.length+o.length;let c;return t[6]!==n||t[7]!==l||t[8]!==i||t[9]!==a?(c={items:i,pendingInvitations:l,redDotCount:a,markReleaseSeen:n},t[6]=n,t[7]=l,t[8]=i,t[9]=a,t[10]=c):c=t[10],c}function Pr(t,e){return new Date(e.date).getTime()-new Date(t.date).getTime()}function Er(t){return{type:"invitation",invitation:t}}function Fr(t,e){return new Date(t.expiresAt).getTime()-new Date(e.expiresAt).getTime()}function Rr(t){return{type:"join-request",request:t}}function Lr(t,e){return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}class cs extends O.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,n){}render(){return this.state.hasError?null:this.props.children}}function ds(t){return t<=1?"text-destructive":t<=5?"text-amber-500 dark:text-amber-400":"text-foreground/70"}function Br(){const t=w.c(17),e=he(),{org:n}=de(),{hasDecoKey:r,balanceDollars:l}=Xt();if(!r)return null;let o;t[0]!==l?(o=l!=null?`Credits: $${l.toFixed(2)}`:"Credits",t[0]=l,t[1]=o):o=t[1];let i;t[2]!==l?(i=F(l!=null&&ds(l)),t[2]=l,t[3]=i):i=t[3];let a;t[4]!==e||t[5]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[4]=e,t[5]=n.slug,t[6]=a):a=t[6];let c;t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(Wt,{}),t[7]=c):c=t[7];let d;t[8]!==l?(d=l!=null?`$${l.toFixed(2)}`:"Credits",t[8]=l,t[9]=d):d=t[9];let m;t[10]!==d?(m=s.jsx("span",{children:d}),t[10]=d,t[11]=m):m=t[11];let u;return t[12]!==o||t[13]!==i||t[14]!==a||t[15]!==m?(u=s.jsx(_e,{children:s.jsx(se,{children:s.jsxs(ue,{tooltip:o,className:i,onClick:a,children:[c,m]})})}),t[12]=o,t[13]=i,t[14]=a,t[15]=m,t[16]=u):u=t[16],u}function Hr(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(cs,{children:s.jsx(O.Suspense,{fallback:null,children:s.jsx(Br,{})})}),t[0]=e):e=t[0],e}function Ur(){const t=w.c(17),e=he(),{org:n}=de(),{hasDecoKey:r,balanceDollars:l}=Xt();if(!r)return null;let o;t[0]!==l?(o=l!=null?`Credits: $${l.toFixed(2)}`:"Credits",t[0]=l,t[1]=o):o=t[1];const i=o;let a;t[2]!==e||t[3]!==n.slug?(a=()=>e({to:"/$org/settings/ai-providers",params:{org:n.slug}}),t[2]=e,t[3]=n.slug,t[4]=a):a=t[4];let c;t[5]!==l?(c=F(l!=null&&ds(l)),t[5]=l,t[6]=c):c=t[6];let d;t[7]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Wt,{className:"size-4"}),t[7]=d):d=t[7];let m;t[8]!==a||t[9]!==c||t[10]!==i?(m=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":i,onClick:a,className:c,children:d})}),t[8]=a,t[9]=c,t[10]=i,t[11]=m):m=t[11];let u;t[12]!==i?(u=s.jsx(ve,{side:"top",children:i}),t[12]=i,t[13]=u):u=t[13];let f;return t[14]!==m||t[15]!==u?(f=s.jsxs(ye,{delayDuration:300,children:[m,u]}),t[14]=m,t[15]=u,t[16]=f):f=t[16],f}function Gr(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(cs,{children:s.jsx(O.Suspense,{fallback:null,children:s.jsx(Ur,{})})}),t[0]=e):e=t[0],e}function ms(t){const e=w.c(15),{children:n}=t,{items:r,markReleaseSeen:l}=as(),[o,i]=O.useState(null);let a;if(e[0]!==r||e[1]!==o){let x;e[3]!==o?(x=g=>g.type==="release"&&g.release.id===o,e[3]=o,e[4]=x):x=e[4],a=r.find(x),e[0]=r,e[1]=o,e[2]=a}else a=e[2];const c=a,d=c?.type==="release"?c.release:null;let m;e[5]!==l?(m=x=>{i(x),l(x)},e[5]=l,e[6]=m):m=e[6];const u=m;let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=x=>{x||i(null)},e[7]=f):f=e[7];let h;e[8]!==u||e[9]!==r||e[10]!==d?(h=s.jsx(Ee,{side:"right",align:"start",sideOffset:16,collisionPadding:16,className:"w-[min(400px,calc(100vw-2rem))] p-0 h-[min(650px,calc(100dvh-4rem))] flex flex-col",children:d?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b border-border shrink-0",children:[s.jsx(Te,{size:"icon",variant:"ghost","aria-label":"Back to inbox",className:"size-7 text-muted-foreground",onClick:()=>i(null),children:s.jsx(Ys,{size:16})}),s.jsx("h3",{className:"text-sm font-medium truncate",children:d.title})]}),s.jsx("div",{className:"overflow-y-auto flex-1 p-5",children:s.jsx(mn,{release:d})})]}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-4 py-3 border-b border-border shrink-0",children:s.jsx("h3",{className:"text-sm font-medium",children:"Inbox"})}),r.length===0?s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 px-6 text-center",children:[s.jsx(Ve,{size:24,className:"text-muted-foreground/50"}),s.jsx("p",{className:"text-sm font-medium text-foreground",children:"Nothing here yet"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Invitations, join requests, and release updates will appear here"})]}):s.jsx("div",{className:"overflow-y-auto flex-1",children:r.map(x=>x.type==="join-request"?s.jsx(Dr,{request:x.request},`req-${x.request.id}`):x.type==="invitation"?s.jsx(Tr,{invitation:x.invitation},`inv-${x.invitation.id}`):s.jsx(Or,{release:x.release,isSeen:x.isSeen,onSelect:()=>u(x.release.id)},`rel-${x.release.id}`))})]})}),e[8]=u,e[9]=r,e[10]=d,e[11]=h):h=e[11];let p;return e[12]!==n||e[13]!==h?(p=s.jsxs(Pe,{onOpenChange:f,children:[n,h]}),e[12]=n,e[13]=h,e[14]=p):p=e[14],p}function us(){const{redDotCount:t}=as();return t>0}function qr(){const t=w.c(6),e=us();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-1 right-1 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("span",{children:"Inbox"}),t[3]=l):l=t[3];let o;return t[4]!==r?(o=s.jsx(ms,{children:s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:"Inbox",className:"relative",children:[n,r,l]})})}),t[4]=r,t[5]=o):o=t[5],o}function Wr(){const t=w.c(8),e=us();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Ve,{className:"size-4"}),t[0]=n):n=t[0];let r;t[1]!==e?(r=e&&s.jsx("span",{className:"absolute top-0.5 right-0.5 size-2 rounded-full bg-red-500 pointer-events-none"}),t[1]=e,t[2]=r):r=t[2];let l;t[3]!==r?(l=s.jsx(Ne,{asChild:!0,children:s.jsx(je,{asChild:!0,children:s.jsxs(xe,{"aria-label":"Inbox",children:[n,r]})})}),t[3]=r,t[4]=l):l=t[4];let o;t[5]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(ve,{side:"top",children:"Inbox"}),t[5]=o):o=t[5];let i;return t[6]!==l?(i=s.jsx(ms,{children:s.jsxs(ye,{delayDuration:300,children:[l,o]})}),t[6]=l,t[7]=i):i=t[7],i}function Kr(){const t=w.c(7),e=he(),{org:n}=de();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let l,o;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ke,{}),o=s.jsx("span",{children:"Settings"}),t[3]=l,t[4]=o):(l=t[3],o=t[4]);let i;return t[5]!==r?(i=s.jsxs(ue,{tooltip:"Settings",onClick:r,children:[l,o]}),t[5]=r,t[6]=i):i=t[6],i}function Vr(){const t=w.c(9),e=he(),{org:n}=de();let r;t[0]!==e||t[1]!==n.slug?(r=()=>e({to:"/$org/settings",params:{org:n.slug}}),t[0]=e,t[1]=n.slug,t[2]=r):r=t[2];let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Ke,{className:"size-4"}),t[3]=l):l=t[3];let o;t[4]!==r?(o=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":"Settings",onClick:r,children:l})}),t[4]=r,t[5]=o):o=t[5];let i;t[6]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(ve,{side:"top",children:"Settings"}),t[6]=i):i=t[6];let a;return t[7]!==o?(a=s.jsxs(ye,{delayDuration:300,children:[o,i]}),t[7]=o,t[8]=a):a=t[8],a}function Xr(){const t=w.c(6),{state:e}=Ce();if(e==="collapsed"){let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Hr,{}),t[0]=l):l=t[0];let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(se,{children:s.jsx("div",{className:"flex justify-center",children:s.jsx(rt,{})})}),t[1]=o):o=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(se,{children:s.jsx(qr,{})}),t[2]=i):i=t[2];let a;t[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(se,{children:s.jsx(Kr,{})}),t[3]=a):a=t[3];let c;return t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(tt,{className:"px-2 pb-3 gap-1",children:[l,s.jsxs(_e,{children:[o,i,a,s.jsx(se,{children:s.jsx(nt,{})})]})]}),t[4]=c):c=t[4],c}let r;return t[5]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(tt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(_e,{children:s.jsx(se,{children:s.jsx(nt,{})})})}),s.jsx(Vr,{}),s.jsx(Wr,{}),s.jsx(rt,{}),s.jsx(Gr,{})]})}),t[5]=r):r=t[5],r}function Qr(){const t=w.c(8),e=he(),{org:n}=de(),{setOpenMobile:r}=Ce();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx(_e,{children:s.jsx(se,{children:s.jsx(nt,{})})})}),t[0]=l):l=t[0];let o;t[1]!==e||t[2]!==n.slug||t[3]!==r?(o=()=>{e({to:"/$org/settings",params:{org:n.slug}}),r(!1)},t[1]=e,t[2]=n.slug,t[3]=r,t[4]=o):o=t[4];let i;t[5]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(Ke,{className:"size-4"}),t[5]=i):i=t[5];let a;return t[6]!==o?(a=s.jsx(tt,{className:"px-2 pb-3",children:s.jsxs("div",{className:"flex items-center gap-1",children:[l,s.jsx(xe,{"aria-label":"Settings",onClick:o,children:i})]})}),t[6]=o,t[7]=a):a=t[7],a}function St(t){const e=w.c(15),{className:n,wrapperClassName:r,children:l}=t,[o,i]=O.useState(!1);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=b=>{b&&i(b.scrollHeight>b.clientHeight+1)},e[0]=a):a=e[0];const c=a;let d;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=b=>{const j=b.currentTarget;i(j.scrollHeight-j.scrollTop>j.clientHeight+1)},e[1]=d):d=e[1];const m=d;let u;e[2]!==r?(u=F("relative",r),e[2]=r,e[3]=u):u=e[3];let f;e[4]!==l||e[5]!==n?(f=s.jsx("div",{ref:c,onScroll:m,className:n,children:l}),e[4]=l,e[5]=n,e[6]=f):f=e[6];const h=o?"opacity-100":"opacity-0";let p;e[7]!==h?(p=F("pointer-events-none absolute right-0 bottom-0 left-0 h-10 bg-gradient-to-t from-sidebar to-transparent transition-opacity duration-150",h),e[7]=h,e[8]=p):p=e[8];let x;e[9]!==p?(x=s.jsx("div",{"aria-hidden":!0,className:p}),e[9]=p,e[10]=x):x=e[10];let g;return e[11]!==u||e[12]!==f||e[13]!==x?(g=s.jsxs("div",{className:u,children:[f,x]}),e[11]=u,e[12]=f,e[13]=x,e[14]=g):g=e[14],g}function Yr(t){const e=w.c(8),{virtualMcpId:n,size:r,showAutomationBadge:l}=t,o=r===void 0?"sm":r;let i;e[0]!==o||e[1]!==n?(i=n?s.jsx(Jr,{virtualMcpId:n,size:o}):s.jsx(De,{icon:null,name:"?",size:o}),e[0]=o,e[1]=n,e[2]=i):i=e[2];let a;e[3]!==l?(a=l&&s.jsx("span",{"aria-label":"Automation-triggered",className:"absolute -bottom-0.5 -right-0.5 flex size-4 items-center justify-center rounded-full bg-blue-500 border border-blue-600 text-white",children:s.jsx(Tn,{size:10,className:"text-white"})}),e[3]=l,e[4]=a):a=e[4];let c;return e[5]!==i||e[6]!==a?(c=s.jsxs("div",{className:"relative shrink-0",children:[i,a]}),e[5]=i,e[6]=a,e[7]=c):c=e[7],c}function Jr(t){const e=w.c(6),{virtualMcpId:n,size:r}=t,l=Qt(n);if(!l){let a;return e[0]!==r?(a=s.jsx(De,{icon:null,name:"?",size:r}),e[0]=r,e[1]=a):a=e[1],a}const o=l.icon??null;let i;return e[2]!==l.title||e[3]!==r||e[4]!==o?(i=s.jsx(De,{icon:o,name:l.title,size:r}),e[2]=l.title,e[3]=r,e[4]=o,e[5]=i):i=e[5],i}function Nt(t){const e=w.c(36),{open:n,onOpenChange:r}=t,[l,o]=O.useState(""),{org:i}=de(),{setTaskId:a}=mt(),c=Zt();let d,m,u;e[0]!==i.id||e[1]!==l?(u=l.trim(),m=Mt,d=Ot.globalSearch(i.id,u),e[0]=i.id,e[1]=l,e[2]=d,e[3]=m,e[4]=u):(d=e[2],m=e[3],u=e[4]);const f=n&&u.length>0;let h;e[5]!==c||e[6]!==u?(h=async()=>await c.call("GLOBAL_SEARCH",{query:u,limit:20}),e[5]=c,e[6]=u,e[7]=h):h=e[7];let p;e[8]!==d||e[9]!==f||e[10]!==h?(p={queryKey:d,enabled:f,queryFn:h,staleTime:1e4},e[8]=d,e[9]=f,e[10]=h,e[11]=p):p=e[11];const{data:x,isFetching:g}=m(p);let b;e[12]!==x?.items?(b=x?.items??[],e[12]=x?.items,e[13]=b):b=e[13];const j=b;let v;e[14]!==r?(v=$=>{$||o(""),r($)},e[14]=r,e[15]=v):v=e[15];const y=v;let _;e[16]!==y||e[17]!==a?(_=$=>{y(!1),a($.id,$.virtual_mcp_id??void 0)},e[16]=y,e[17]=a,e[18]=_):_=e[18];const k=_;let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsxs(Sn,{className:"sr-only",children:[s.jsx(Nn,{children:"Search"}),s.jsx(_n,{children:"Search across your organization's resources."})]}),e[19]=N):N=e[19];let C;e[20]!==l?(C=s.jsx(zn,{value:l,onValueChange:o,placeholder:"Search..."}),e[20]=l,e[21]=C):C=e[21];let S;e[22]!==k||e[23]!==g||e[24]!==j||e[25]!==u?(S=u?g&&j.length===0?s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching…"}):j.length===0?s.jsx(kn,{children:"No results."}):j.map($=>$.type==="thread"?s.jsxs(In,{value:`thread:${$.id}:${$.title}`,onSelect:()=>k($),className:"gap-2.5",children:[s.jsx(Yr,{virtualMcpId:$.virtual_mcp_id,size:"xs"}),s.jsx("div",{className:"flex-1 min-w-0",children:s.jsx("div",{className:"text-sm text-foreground truncate",children:$.title||"Untitled thread"})}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:new Date($.updated_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]},`thread:${$.id}`):null):s.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Start typing to search."}),e[22]=k,e[23]=g,e[24]=j,e[25]=u,e[26]=S):S=e[26];let z;e[27]!==S?(z=s.jsx($n,{children:S}),e[27]=S,e[28]=z):z=e[28];let T;e[29]!==C||e[30]!==z?(T=s.jsxs(Cn,{className:"overflow-hidden p-0",closeButtonClassName:"hidden",children:[N,s.jsxs(An,{shouldFilter:!1,className:"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:[C,z]})]}),e[29]=C,e[30]=z,e[31]=T):T=e[31];let A;return e[32]!==y||e[33]!==n||e[34]!==T?(A=s.jsx(wn,{open:n,onOpenChange:y,children:T}),e[32]=y,e[33]=n,e[34]=T,e[35]=A):A=e[35],A}const _t=["requires_action","in_progress","failed","expired","completed"];function Zr(t){const e=new Map(_t.map(n=>[n,[]]));for(const n of t){const r=n.status??"completed";(e.get(r)??e.get("completed")).push(n)}return _t.map(n=>({status:n,threads:e.get(n)}))}const el="sidebar.group.expanded.";function tl(t,e){const n=w.c(3),[r,l]=We(`${el}${t}`,e);let o;return n[0]!==r||n[1]!==l?(o=[r,l],n[0]=r,n[1]=l,n[2]=o):o=n[2],o}function fs(t){const e=w.c(12),{onClick:n,isFetching:r,indented:l}=t,o=l?"-ml-4 pl-6 pr-2":"px-2";let i;e[0]!==o?(i=F("flex items-center gap-2 py-1.5 rounded-md text-sm text-muted-foreground",o,"hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50","transition-colors disabled:cursor-progress disabled:opacity-60"),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==r?(a=r&&s.jsx(Pt,{size:14,className:"animate-spin"}),e[2]=r,e[3]=a):a=e[3];const c=r?"Loading…":"Show more";let d;e[4]!==c?(d=s.jsx("span",{children:c}),e[4]=c,e[5]=d):d=e[5];let m;return e[6]!==r||e[7]!==n||e[8]!==i||e[9]!==a||e[10]!==d?(m=s.jsxs("button",{type:"button","aria-label":"Show more tasks",onClick:n,disabled:r,className:i,children:[a,d]}),e[6]=r,e[7]=n,e[8]=i,e[9]=a,e[10]=d,e[11]=m):m=e[11],m}function sl(t,e,n,r){return[t,e,n,r.type,r.member,r.currentUserId??""].join("|")}function nl(t){return t.member==="mine"&&!t.currentUserId}const xs=4;let Ue=0;const lt=[];function rl(){for(;Ue<xs&&lt.length>0;){const t=lt.shift();t&&t()}}function hs(t){return new Promise((e,n)=>{const r=()=>{Ue++,t().then(e,n).finally(()=>{Ue--,rl()})};Ue<xs?r():lt.push(r)})}const Qe=10;function Ct(t,e,n,r,l){const o={hidden:!1};r.member==="mine"&&r.currentUserId&&(o.created_by=r.currentUserId),r.type==="automation"&&(o.has_trigger=!0),r.type==="manual"&&(o.has_trigger=!1);const i={where:o,limit:l,offset:n,orderBy:[{field:["updated_at"],direction:"desc"}]};return i.status=e,i}function ll(t,e,n,r){let l=0;for(const o of t)ps(o,e,n,r)&&l++;return l}function Ze(t,e,n,r){return ll(t,e,n,r)}function ol(t,e){return!!(t>=Qe||t===0&&e)}function wt(t,e){return t<e}function il(t,e){return e===!1?!1:e===!0?!0:t}function ps(t,e,n,r){return!(t.hidden||(t.status??"completed")!==n||r.member==="mine"&&r.currentUserId&&t.created_by!==r.currentUserId||r.type==="automation"&&!t.trigger_id||r.type==="manual"&&t.trigger_id)}const qe=new Map,He=new Map;function al(t,e){return e?t>=Qe?!0:null:!1}function kt(t){return qe.get(t)}function cl(t,e){qe.set(t,e)}function dl(t,e,n){const r=qe.get(t);if(r!==void 0){n(r);return}let l=He.get(t);l||(l=hs(e).then(o=>(qe.set(t,o),He.delete(t),o)).catch(()=>(He.delete(t),Promise.reject(new Error("group probe failed")))),He.set(t,l)),l.then(n,()=>n(!1))}function It(t){const e=t,n=Array.isArray(e.items)?e.items:[];return{items:n,hasMore:e.hasMore??n.length===Qe,totalCount:typeof e.totalCount=="number"?e.totalCount:void 0}}function ml(t,e,n,r,l){let o=0;for(const i of t)e.has(i.id)||ps(i,n,r,l)&&o++;return o}function ul(t,e,n,r){const l=w.c(8),{org:o}=de(),i=sl(o.id,t,e,n);let a;l[0]!==n?(a=nl(n),l[0]=n,l[1]=a):a=l[1];const c=a,[d,m]=O.useState({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:null,serverHasMore:null});d.identity!==i&&m({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:null,serverHasMore:null});const u=vn(),{threads:f,hasMore:h}=ut(),p=Ze(f,t,e,n),x=ol(p,h),g=al(p,h),b=Zt();if(d.identity===i&&d.serverHasMore===null){const N=g??kt(i);N!==void 0&&m({isFetching:!1,isProbing:!1,identity:i,probeSubscribedIdentity:d.probeSubscribedIdentity,serverHasMore:N})}!c&&d.identity===i&&d.serverHasMore===null&&g===null&&kt(i)===void 0&&d.probeSubscribedIdentity!==i&&(m(N=>N.identity===i?{...N,isProbing:!0,probeSubscribedIdentity:i}:N),dl(i,async()=>{const N=Ct(t,e,0,n,1),C=await b.call("COLLECTION_THREADS_LIST",N),{totalCount:S}=It(C),z=Ze(u.threads.get(),t,e,n);return S===void 0?!1:wt(z,S)},N=>{m(C=>C.identity!==i?C:{...C,isProbing:!1,serverHasMore:N})}));const v=async function(){if(d.isFetching||d.isProbing||c)return;const C=i;m(S=>S.identity===C?{...S,isFetching:!0}:S);try{const S=Ze(f,t,e,n),z=Ct(t,e,S,n,Qe),T=await hs(()=>b.call("COLLECTION_THREADS_LIST",z)),{items:A,hasMore:$,totalCount:E}=It(T),W=new Set(f.map(fl)),M=ml(A,W,t,e,n),q=S;u.mergeThreads(A),m(R=>{if(R.identity!==C)return R;let Q;return E!==void 0?Q=wt(q+M,E):Q=A.length===0||M===0?!1:$,cl(C,Q),{...R,isFetching:!1,serverHasMore:Q}})}catch(S){const z=S,T=z instanceof Error?z.message:String(z);ge.error(`Could not load more tasks: ${T}`),m(A=>A.identity===C?{...A,isFetching:!1}:A)}},y=d.isFetching||d.isProbing,_=!c&&!y&&il(x,d.serverHasMore);let k;return l[2]!==y||l[3]!==v||l[4]!==_||l[5]!==d.isProbing||l[6]!==d.serverHasMore?(k={hasMore:_,isFetching:y,isProbing:d.isProbing,serverHasMore:d.serverHasMore,loadMore:v},l[2]=y,l[3]=v,l[4]=_,l[5]=d.isProbing,l[6]=d.serverHasMore,l[7]=k):k=l[7],k}function fl(t){return t.id}function xl(t){const e=w.c(18),{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a}=t,{isFetching:c,isProbing:d,loadMore:m,hasMore:u,serverHasMore:f}=ul("status",n,a),[h,p]=O.useState(!1);!h&&r.length===0&&f===!0&&!c&&!d&&(p(!0),queueMicrotask(()=>{m()}));let x;if(e[0]!==l||e[1]!==a||e[2]!==i||e[3]!==o||e[4]!==r){let j;e[6]!==l||e[7]!==a||e[8]!==i||e[9]!==o?(j=v=>s.jsx(ts,{task:v,isActive:l===v.id,onClick:()=>o(v),onArchive:v.created_by===a.currentUserId?()=>i(v):void 0,showAutomationBadge:!!v.trigger_id,showAgentIcon:!0,hideStatusIdle:!0,indented:!0},v.id),e[6]=l,e[7]=a,e[8]=i,e[9]=o,e[10]=j):j=e[10],x=r.map(j),e[0]=l,e[1]=a,e[2]=i,e[3]=o,e[4]=r,e[5]=x}else x=e[5];let g;e[11]!==u||e[12]!==c||e[13]!==m?(g=(u||c)&&s.jsx(fs,{onClick:()=>{m()},isFetching:c,indented:!0}),e[11]=u,e[12]=c,e[13]=m,e[14]=g):g=e[14];let b;return e[15]!==x||e[16]!==g?(b=s.jsxs(s.Fragment,{children:[x,g]}),e[15]=x,e[16]=g,e[17]=b):b=e[17],b}function hl(t){const e=w.c(35),{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a}=t,c=Mn[n],d=c.icon,[m,u]=tl(`status-${n}`,!1);let f;e[0]!==m||e[1]!==u?(f=function(){u(!m)},e[0]=m,e[1]=u,e[2]=f):f=e[2];const h=f;let p;e[3]!==h?(p=N=>{N.target===N.currentTarget&&(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),h())},e[3]=h,e[4]=p):p=e[4];let x;e[5]!==d||e[6]!==c.iconClassName?(x=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center transition-opacity group-hover/group:opacity-0",children:s.jsx(d,{size:12,className:c.iconClassName})}),e[5]=d,e[6]=c.iconClassName,e[7]=x):x=e[7];let g;e[8]!==m?(g=s.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground opacity-0 transition-opacity group-hover/group:opacity-100",children:m?s.jsx(ft,{size:14}):s.jsx(Vt,{size:14})}),e[8]=m,e[9]=g):g=e[9];let b;e[10]!==x||e[11]!==g?(b=s.jsxs("div",{className:"relative size-5 shrink-0 flex items-center justify-center",children:[x,g]}),e[10]=x,e[11]=g,e[12]=b):b=e[12];let j;e[13]!==c.label?(j=s.jsx("span",{className:"flex-1 truncate",children:c.label}),e[13]=c.label,e[14]=j):j=e[14];let v;e[15]!==r.length?(v=s.jsx("div",{className:"size-5 shrink-0 flex items-center justify-center",children:s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:r.length})}),e[15]=r.length,e[16]=v):v=e[16];let y;e[17]!==m||e[18]!==h||e[19]!==p||e[20]!==b||e[21]!==j||e[22]!==v?(y=s.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":m,onClick:h,onKeyDown:p,className:"group/group flex items-center gap-2 px-2 py-1.5 rounded-md text-sm font-medium text-foreground cursor-pointer hover:bg-accent/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 transition-colors",children:[b,j,v]}),e[17]=m,e[18]=h,e[19]=p,e[20]=b,e[21]=j,e[22]=v,e[23]=y):y=e[23];let _;e[24]!==l||e[25]!==m||e[26]!==a||e[27]!==i||e[28]!==o||e[29]!==n||e[30]!==r?(_=m&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:s.jsx(xl,{status:n,threads:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a})}),e[24]=l,e[25]=m,e[26]=a,e[27]=i,e[28]=o,e[29]=n,e[30]=r,e[31]=_):_=e[31];let k;return e[32]!==y||e[33]!==_?(k=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[y,_]}),e[32]=y,e[33]=_,e[34]=k):k=e[34],k}function zt(t){const e=w.c(34),{threads:n,groupBy:r,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a,hasMore:c,isFetchingMore:d,onLoadMore:m,filtersActive:u}=t;if(n.length===0&&!c&&!d){let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(Ve,{className:"size-6 opacity-60"}),e[0]=x):x=e[0];const g=u?"No threads match your filters":"No threads yet";let b;return e[1]!==g?(b=s.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 px-4 py-12 text-center text-muted-foreground",children:[x,s.jsx("p",{className:"text-sm",children:g})]}),e[1]=g,e[2]=b):b=e[2],b}if(r==="status"){let x;if(e[3]!==l||e[4]!==a||e[5]!==i||e[6]!==o||e[7]!==n){let b;e[9]!==l||e[10]!==a||e[11]!==i||e[12]!==o?(b=j=>s.jsx(hl,{status:j.status,threads:j.threads,activeTaskId:l,onSelectTask:o,onArchiveTask:i,filters:a},j.status),e[9]=l,e[10]=a,e[11]=i,e[12]=o,e[13]=b):b=e[13],x=Zr(n).map(b),e[3]=l,e[4]=a,e[5]=i,e[6]=o,e[7]=n,e[8]=x}else x=e[8];let g;return e[14]!==x?(g=s.jsx(s.Fragment,{children:x}),e[14]=x,e[15]=g):g=e[15],g}let f;if(e[16]!==l||e[17]!==a||e[18]!==i||e[19]!==o||e[20]!==n){let x;e[22]!==l||e[23]!==a||e[24]!==i||e[25]!==o?(x=g=>s.jsx(ts,{task:g,isActive:l===g.id,onClick:()=>o(g),onArchive:g.created_by===a.currentUserId?()=>i(g):void 0,showAutomationBadge:!!g.trigger_id,showAgentIcon:!0},g.id),e[22]=l,e[23]=a,e[24]=i,e[25]=o,e[26]=x):x=e[26],f=n.map(x),e[16]=l,e[17]=a,e[18]=i,e[19]=o,e[20]=n,e[21]=f}else f=e[21];let h;e[27]!==c||e[28]!==d||e[29]!==m?(h=(c||d)&&s.jsx(fs,{onClick:m,isFetching:d}),e[27]=c,e[28]=d,e[29]=m,e[30]=h):h=e[30];let p;return e[31]!==f||e[32]!==h?(p=s.jsxs(s.Fragment,{children:[f,h]}),e[31]=f,e[32]=h,e[33]=p):p=e[33],p}function $t(t){const e=w.c(17),{label:n,onClick:r,active:l,children:o}=t,[i,a]=O.useState(!1);let c,d,m,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>a(!0),d=()=>a(!1),m=()=>a(!0),u=()=>a(!1),e[0]=c,e[1]=d,e[2]=m,e[3]=u):(c=e[0],d=e[1],m=e[2],u=e[3]);const f=l&&"bg-sidebar-accent text-foreground";let h;e[4]!==f?(h=F(f),e[4]=f,e[5]=h):h=e[5];let p;e[6]!==o||e[7]!==n||e[8]!==r||e[9]!==h?(p=s.jsx(je,{asChild:!0,children:s.jsx(xe,{"aria-label":n,onClick:r,onPointerEnter:c,onPointerLeave:d,onFocus:m,onBlur:u,className:h,children:o})}),e[6]=o,e[7]=n,e[8]=r,e[9]=h,e[10]=p):p=e[10];let x;e[11]!==n?(x=s.jsx(ve,{side:"bottom",children:n}),e[11]=n,e[12]=x):x=e[12];let g;return e[13]!==i||e[14]!==p||e[15]!==x?(g=s.jsxs(ye,{open:i,children:[p,x]}),e[13]=i,e[14]=p,e[15]=x,e[16]=g):g=e[16],g}function et(t){const e=w.c(13),{label:n,value:r,onChange:l,options:o}=t;let i;e[0]!==n?(i=s.jsx("span",{className:"text-sm text-muted-foreground",children:n}),e[0]=n,e[1]=i):i=e[1];let a;e[2]!==l?(a=u=>u&&l(u),e[2]=l,e[3]=a):a=e[3];let c;e[4]!==o?(c=o.map(pl),e[4]=o,e[5]=c):c=e[5];let d;e[6]!==a||e[7]!==c||e[8]!==r?(d=s.jsx(pn,{type:"single",size:"sm",value:r,onValueChange:a,className:"gap-0.5 rounded-lg border border-border bg-muted/50 p-0.5",children:c}),e[6]=a,e[7]=c,e[8]=r,e[9]=d):d=e[9];let m;return e[10]!==i||e[11]!==d?(m=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i,d]}),e[10]=i,e[11]=d,e[12]=m):m=e[12],m}function pl(t){return s.jsxs(hn,{value:t.value,className:"h-6 gap-1.5 rounded-md border border-transparent px-2 text-xs font-medium text-muted-foreground hover:bg-transparent data-[state=on]:border-border data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm",children:[t.icon,t.label]},t.value)}function gs({onNavigate:t}={}){const{data:e}=be.useSession(),n=e?.user?.id,{org:r}=de(),l=gn({connectionId:bn,orgId:r.id,orgSlug:r.slug}),o=Ge(r.id).id,i=Yt(),{threads:a,hasMore:c,isFetchingMore:d,fetchNextPage:m}=ut(),u=a.filter(I=>!I.hidden),{hide:f}=Jt(),h=he(),{setTaskId:p,createNewTask:x}=mt(),g=ot({strict:!1}),b=it({strict:!1}),j=g.taskId??null,v=b.virtualmcpid??a.find(I=>I.id===j)?.virtual_mcp_id??null,y=()=>{t?.()},_=[...u].sort((I,D)=>(D.updated_at??"").localeCompare(I.updated_at??"")),[k,N]=O.useState("all"),[C,S]=O.useState("flat"),[z,T]=We("sidebar-threads-scope-all",!1),[A,$]=O.useState(!1),[E,W]=O.useState(!1),M={type:k,member:"mine",currentUserId:n??null},q=I=>n?I.filter(D=>D.created_by===n):[],R=I=>k==="automation"?I.filter(D=>!!D.trigger_id):k==="manual"?I.filter(D=>!D.trigger_id):I,Q=q(_),Y=R(Q),ne=R(_),re=z?ne:Y,L=I=>{if(n&&I.created_by&&I.created_by!==n)return;const D=I.id===j;if(f(I.id),!D)return;const B=Q.find(P=>P.id!==I.id&&P.virtual_mcp_id===I.virtual_mcp_id);y(),B?p(B.id,B.virtual_mcp_id):h({to:"/$org",params:{org:r.slug}})},H=I=>{y(),p(I.id,I.virtual_mcp_id)},Z=async I=>{try{const D=await l.callTool({name:"COLLECTION_THREAD_MESSAGES_LIST",arguments:{thread_id:I,limit:1,offset:0}});return((D.structuredContent??D).items?.length??0)===0}catch{return!1}},K=async()=>{const I=v??o;ae("sidebar_new_thread_clicked",{virtual_mcp_id:I});const D=Q.find(B=>B.virtual_mcp_id===I&&B.title==="New chat");if(D&&await Z(D.id)){y(),p(D.id,I);return}y(),x(I)},{state:ee,isMobile:G,toggleSidebar:le}=Ce();if(ee==="collapsed"&&!G){const I=Ge(r.id),D=new Map((i??[]).map(P=>[P.id,P])),B=P=>(P?D.get(P):void 0)??(P===o?I:void 0);return s.jsxs(_e,{className:"min-h-0 gap-1.5 overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:[s.jsx(se,{children:s.jsx(ue,{"aria-label":"Toggle sidebar",tooltip:"Toggle sidebar",onClick:le,children:s.jsx(Bt,{size:16})})}),s.jsx(se,{children:s.jsx(ue,{tooltip:"New thread",onClick:()=>{K()},children:s.jsx(bt,{size:16})})}),re.map(P=>{const X=B(P.virtual_mcp_id);return s.jsx(se,{children:s.jsx(ue,{tooltip:P.title||"New chat",isActive:P.id===j,onClick:()=>H(P),children:s.jsx(De,{icon:X?.icon??null,name:X?.title??"Agent",size:"2xs"})})},P.id)})]})}const V=C!=="flat"||k!=="all"||z===!0,J=s.jsxs(Pe,{children:[s.jsxs(ye,{children:[s.jsx(je,{asChild:!0,children:s.jsx(Ne,{asChild:!0,children:s.jsxs(xe,{"aria-label":"Filter threads",active:V,children:[s.jsx(xn,{size:16}),V&&s.jsx("span",{className:"absolute right-1 top-1 size-1.5 rounded-full bg-primary ring-2 ring-sidebar"})]})})}),s.jsx(ve,{side:"bottom",children:"Filter threads"})]}),s.jsxs(Ee,{align:"start",className:"w-64 flex flex-col gap-3 p-3",children:[s.jsx(et,{label:"View",value:C,onChange:I=>{ae("tasks_panel_group_by_changed",{to_value:I}),S(I)},options:[{value:"flat",label:"List",icon:s.jsx(tn,{size:13})},{value:"status",label:"Status",icon:s.jsx(sn,{size:13})}]}),s.jsx(et,{label:"Type",value:k,onChange:I=>{ae("tasks_panel_filter_changed",{to_value:I}),N(I)},options:[{value:"all",label:"All"},{value:"manual",label:"Chats"},{value:"automation",label:"Auto"}]}),s.jsx(et,{label:"Scope",value:z?"team":"mine",onChange:I=>T(I==="team"),options:[{value:"mine",label:"Mine"},{value:"team",label:"Team"}]})]})]}),me=I=>s.jsx(st,{delayDuration:300,children:s.jsxs("div",{className:F("shrink-0 px-1 flex items-center justify-between",I?"h-10":"h-10 md:h-7 mb-2"),children:[s.jsxs("div",{className:"flex items-center gap-0.5",children:[!I&&s.jsx(es,{}),J]}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($t,{label:"Search threads",onClick:()=>{ae("tasks_panel_search_opened"),W(!0),$(!0)},children:s.jsx(en,{size:16})}),s.jsx($t,{label:"New thread",onClick:()=>{K()},children:s.jsx(bt,{size:16})})]})]})});return G?s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[me(!0),s.jsx(St,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain px-1 h-full",children:s.jsx(zt,{threads:re,groupBy:C,activeTaskId:j,onSelectTask:H,onArchiveTask:L,filters:M,hasMore:c,isFetchingMore:d,onLoadMore:()=>{m()},filtersActive:V})}),E&&s.jsx(Nt,{open:A,onOpenChange:$})]}):s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[me(!1),s.jsx("div",{className:"flex-1 min-h-0 flex flex-col gap-0.5 -mr-2 pr-2",children:s.jsx(St,{wrapperClassName:"flex-1 min-h-0",className:"flex flex-col gap-0.5 overflow-y-auto overscroll-contain h-full",children:s.jsx(zt,{threads:re,groupBy:C,activeTaskId:j,onSelectTask:H,onArchiveTask:L,filters:M,hasMore:c,isFetchingMore:d,onLoadMore:()=>{m()},filtersActive:V})})}),E&&s.jsx(Nt,{open:A,onOpenChange:$})]})}const gl=5,bl=[{nameWidth:"w-24",taskRows:2},{nameWidth:"w-28",taskRows:0},{nameWidth:"w-20",taskRows:1},{nameWidth:"w-32",taskRows:0},{nameWidth:"w-24",taskRows:0}];function bs(){const t=w.c(3),{state:e}=Ce();if(e==="collapsed"){let l;return t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex flex-col gap-1.5",children:Array.from({length:gl}).map(yl)}),t[0]=l):l=t[0],l}let n;t[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsxs("div",{className:"shrink-0 px-1 h-10 md:h-7 mb-2 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(fe,{className:"size-6 rounded-md"}),s.jsx(fe,{className:"size-6 rounded-md"}),s.jsx(fe,{className:"size-6 rounded-md"})]}),s.jsx(fe,{className:"h-6 w-20 rounded-md"})]}),t[1]=n):n=t[1];let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[n,s.jsx("div",{className:"flex flex-col gap-0.5",children:bl.map(jl)})]}),t[2]=r):r=t[2],r}function jl(t,e){return s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5",children:[s.jsx(fe,{className:"size-5 rounded-full shrink-0"}),s.jsx(fe,{className:F("h-3",t.nameWidth,"rounded-sm")})]}),t.taskRows>0&&s.jsx("div",{className:"flex flex-col gap-0.5 pb-1 pl-4",children:Array.from({length:t.taskRows}).map(vl)})]},e)}function vl(t,e){return s.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5",children:s.jsx(fe,{className:"h-3 flex-1 rounded-sm"})},e)}function yl(t,e){return s.jsx(fe,{className:"size-10 rounded-lg mx-auto"},e)}function Sl(){const t=w.c(4),e=rs();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(Xr,{}),t[0]=n):n=t[0];let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Et,{children:s.jsx(O.Suspense,{fallback:s.jsx(bs,{}),children:s.jsx(gs,{})})}),t[1]=r):r=t[1];let l;return t[2]!==e?(l=s.jsx(ss,{children:s.jsx(is,{sections:e,footer:n,additionalContent:r})}),t[2]=e,t[3]=l):l=t[3],l}function Nl(t){const e=w.c(8),{onClose:n}=t,r=rs();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Qr,{}),e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(bs,{}),e[1]=o):o=e[1];let i;e[2]!==n?(i=s.jsx(Et,{children:s.jsx(O.Suspense,{fallback:o,children:s.jsx(gs,{onNavigate:n})})}),e[2]=n,e[3]=i):i=e[3];let a;return e[4]!==n||e[5]!==r||e[6]!==i?(a=s.jsx(ss,{children:s.jsx(Cr,{sections:r,onClose:n,footer:l,additionalContent:i})}),e[4]=n,e[5]=r,e[6]=i,e[7]=a):a=e[7],a}function js(t){return t.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const _l=Ds({name:Os().min(2,"Organization name is required")});function Cl(t){const e=w.c(41),{open:n,onOpenChange:r}=t;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={resolver:Ms(_l),defaultValues:{name:""}},e[0]=l):l=e[0];const o=Ps(l);let i;e[1]===Symbol.for("react.memo_cache_sentinel")?(i={mutationFn:kl,onSuccess:wl},e[1]=i):i=e[1];const a=Es(i),c=a.error instanceof Error?a.error.message:a.error?"Failed to create organization.":null;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs(Kn,{children:[s.jsx(Vn,{children:"Create a new organization"}),s.jsx(Xn,{children:"Set up a new organization to collaborate with others."})]}),e[2]=d):d=e[2];let m;if(e[3]!==a||e[4]!==o){let N;e[6]!==a?(N=C=>a.mutateAsync(C),e[6]=a,e[7]=N):N=e[7],m=o.handleSubmit(N),e[3]=a,e[4]=o,e[5]=m}else m=e[5];let u;e[8]!==o.formState.isSubmitting?(u=N=>{const{field:C}=N;return s.jsxs(er,{children:[s.jsx(tr,{children:"Organization Name"}),s.jsx(sr,{children:s.jsx(lr,{...C,placeholder:"Acme Inc.",disabled:o.formState.isSubmitting})}),s.jsx(nr,{children:"The name of your company or organization"}),C.value&&s.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",s.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",js(C.value)]})]}),s.jsx(rr,{})]})},e[8]=o.formState.isSubmitting,e[9]=u):u=e[9];let f;e[10]!==o.control||e[11]!==u?(f=s.jsx(Jn,{control:o.control,name:"name",render:u}),e[10]=o.control,e[11]=u,e[12]=f):f=e[12];let h;e[13]!==c?(h=c&&s.jsx("div",{className:"text-destructive text-sm mt-2",children:c}),e[13]=c,e[14]=h):h=e[14];let p;e[15]!==a||e[16]!==o?(p=()=>{a.reset(),o.reset()},e[15]=a,e[16]=o,e[17]=p):p=e[17];let x;e[18]!==o.formState.isSubmitting||e[19]!==p?(x=s.jsx(qn,{disabled:o.formState.isSubmitting,onClick:p,children:"Cancel"}),e[18]=o.formState.isSubmitting,e[19]=p,e[20]=x):x=e[20];const g=!o.formState.isValid||o.formState.isSubmitting;let b;e[21]!==o.formState.isSubmitting?(b=o.formState.isSubmitting?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx(Ln,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=o.formState.isSubmitting,e[22]=b):b=e[22];let j;e[23]!==g||e[24]!==b?(j=s.jsx(Te,{type:"submit",variant:"default",disabled:g,children:b}),e[23]=g,e[24]=b,e[25]=j):j=e[25];let v;e[26]!==j||e[27]!==x?(v=s.jsxs(Qn,{children:[x,j]}),e[26]=j,e[27]=x,e[28]=v):v=e[28];let y;e[29]!==v||e[30]!==m||e[31]!==f||e[32]!==h?(y=s.jsxs("form",{className:"space-y-6",onSubmit:m,autoComplete:"off",children:[f,h,v]}),e[29]=v,e[30]=m,e[31]=f,e[32]=h,e[33]=y):y=e[33];let _;e[34]!==o||e[35]!==y?(_=s.jsxs(Wn,{children:[d,s.jsx(Zn,{...o,children:y})]}),e[34]=o,e[35]=y,e[36]=_):_=e[36];let k;return e[37]!==r||e[38]!==n||e[39]!==_?(k=s.jsx(Yn,{open:n,onOpenChange:r,children:_}),e[37]=r,e[38]=n,e[39]=_,e[40]=k):k=e[40],k}function wl(t){const{orgSlug:e}=t;window.location.href=`/${e}`}async function kl(t){const e=js(t.name);if(!e)throw new Error("Organization slug is invalid");const n=await be.organization.create({name:t.name,slug:e});if(n?.error)throw new Error(n.error.message||"Failed to create organization");const r=n?.data?.slug??e;if(!r)throw new Error("Failed to create organization");return{orgSlug:r}}function Il(t){let e=0;for(let r=0;r<t.length;r++)e=t.charCodeAt(r)+((e<<5)-e);const n=Math.abs(e)%360;return{backgroundColor:`hsl(${n} 55% 70%)`,color:`hsl(${n} 55% 20%)`}}function vs(t){const e=w.c(13),{org:n,size:r}=t,l=r===void 0?"sm":r,o=l==="xs"?"size-5":"size-6",i=l==="xs"?"text-[9px]":"text-xs";let a;e[0]!==o?(a=F(o,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=o,e[1]=a):a=e[1];let c;e[2]!==n.logo||e[3]!==n.name?(c=n.logo?void 0:Il(n.name),e[2]=n.logo,e[3]=n.name,e[4]=c):c=e[4];let d;e[5]!==n.logo||e[6]!==n.name||e[7]!==i?(d=n.logo?s.jsx("img",{src:n.logo,alt:"",className:"size-full object-cover"}):s.jsx("span",{className:F("font-semibold leading-none",i),children:n.name.slice(0,2).toUpperCase()}),e[5]=n.logo,e[6]=n.name,e[7]=i,e[8]=d):d=e[8];let m;return e[9]!==a||e[10]!==c||e[11]!==d?(m=s.jsx("div",{className:a,style:c,children:d}),e[9]=a,e[10]=c,e[11]=d,e[12]=m):m=e[12],m}function zl(t){const e=w.c(24),{orgParam:n,onSelectOrg:r,onCreateOrg:l}=t,{data:o}=Fs();let i;e[0]!==n?(i=(S,z)=>S.slug===n?-1:z.slug===n?1:S.name.localeCompare(z.name),e[0]=n,e[1]=i):i=e[1];const a=[...o??[]].sort(i),[c,d]=O.useState(""),m=c.toLowerCase(),u=m?a.filter(S=>S.name.toLowerCase().includes(m)||S.slug.toLowerCase().includes(m)):a;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ns,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=f):f=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=S=>d(S.target.value),e[3]=h):h=e[3];let p;e[4]!==c?(p=S=>S.key==="Escape"&&c&&d(""),e[4]=c,e[5]=p):p=e[5];let x;e[6]!==c||e[7]!==p?(x=s.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:c,onChange:h,onKeyDown:p,placeholder:"Search organizations...",className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[6]=c,e[7]=p,e[8]=x):x=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(Ae,{size:16}),e[9]=g):g=e[9];let b;e[10]!==l?(b=s.jsx("button",{type:"button",onClick:l,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:g}),e[10]=l,e[11]=b):b=e[11];let j;e[12]!==x||e[13]!==b?(j=s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[f,x,b]}),e[12]=x,e[13]=b,e[14]=j):j=e[14];const v="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1",y=u.length===0&&s.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:c?`No organizations match "${c}"`:"No organizations available"});let _;e[15]!==r||e[16]!==n?(_=S=>s.jsxs("button",{type:"button",onClick:()=>r(S.slug),className:F("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",S.slug===n?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[s.jsx(vs,{org:S,size:"sm"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:S.name}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:S.slug})]}),S.slug===n&&s.jsx(Xe,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},S.id),e[15]=r,e[16]=n,e[17]=_):_=e[17];const k=u.map(_);let N;e[18]!==y||e[19]!==k?(N=s.jsxs("div",{className:v,children:[y,k]}),e[18]=y,e[19]=k,e[20]=N):N=e[20];let C;return e[21]!==N||e[22]!==j?(C=s.jsxs(s.Fragment,{children:[j,N]}),e[21]=N,e[22]=j,e[23]=C):C=e[23],C}function $l(t){const e=w.c(22),{trigger:n,orgParam:r,align:l,side:o}=t,i=l===void 0?"start":l,a=o===void 0?"bottom":o,c=he(),[d,m]=O.useState(!1),[u,f]=O.useState(!1);let h;e[0]!==n?(h=s.jsx(Ne,{asChild:!0,children:n}),e[0]=n,e[1]=h):h=e[1];const p=String(d);let x;e[2]!==c?(x=k=>{m(!1),c({to:"/$org",params:{org:k}})},e[2]=c,e[3]=x):x=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),f(!0)},e[4]=g):g=e[4];let b;e[5]!==r||e[6]!==p||e[7]!==x?(b=s.jsx(zl,{orgParam:r,onSelectOrg:x,onCreateOrg:g},p),e[5]=r,e[6]=p,e[7]=x,e[8]=b):b=e[8];let j;e[9]!==i||e[10]!==a||e[11]!==b?(j=s.jsx(Ee,{side:a,align:i,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:Tl,onCloseAutoFocus:Al,children:b}),e[9]=i,e[10]=a,e[11]=b,e[12]=j):j=e[12];let v;e[13]!==d||e[14]!==h||e[15]!==j?(v=s.jsxs(Pe,{open:d,onOpenChange:m,children:[h,j]}),e[13]=d,e[14]=h,e[15]=j,e[16]=v):v=e[16];let y;e[17]!==u?(y=s.jsx(Cl,{open:u,onOpenChange:f}),e[17]=u,e[18]=y):y=e[18];let _;return e[19]!==y||e[20]!==v?(_=s.jsxs(s.Fragment,{children:[v,y]}),e[19]=y,e[20]=v,e[21]=_):_=e[21],_}function Al(t){return t.preventDefault()}function Tl(t){t.preventDefault(),t.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function Dl(t){const e=w.c(21),{value:n,onChange:r,placeholder:l,onKeyDown:o,className:i,isSearching:a,disabled:c}=t,d=l===void 0?"Search...":l;let m;e[0]!==i?(m=F("shrink-0 w-full border-b border-border h-12",i),e[0]=i,e[1]=m):m=e[1];const u=c?"cursor-not-allowed opacity-50":"cursor-text";let f;e[2]!==u?(f=F("flex items-center gap-2.5 h-12 px-4",u),e[2]=u,e[3]=f):f=e[3];let h;e[4]!==a?(h=a?s.jsx(Pt,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):s.jsx(ns,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=a,e[5]=h):h=e[5];let p;e[6]!==r?(p=j=>r(j.target.value),e[6]=r,e[7]=p):p=e[7];let x;e[8]!==c||e[9]!==o||e[10]!==d||e[11]!==p||e[12]!==n?(x=s.jsx("input",{type:"text",value:n,onChange:p,onKeyDown:o,placeholder:d,disabled:c,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=c,e[9]=o,e[10]=d,e[11]=p,e[12]=n,e[13]=x):x=e[13];let g;e[14]!==f||e[15]!==h||e[16]!==x?(g=s.jsxs("label",{className:f,children:[h,x]}),e[14]=f,e[15]=h,e[16]=x,e[17]=g):g=e[17];let b;return e[18]!==m||e[19]!==g?(b=s.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=b):b=e[20],b}const Ol="Select an existing agent";function Ml(t){const e=w.c(5),{children:n}=t;let r;e[0]!==n?(r=s.jsx(je,{asChild:!0,children:n}),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(ve,{side:"right",sideOffset:8,children:Ol}),e[2]=l):l=e[2];let o;return e[3]!==r?(o=s.jsxs(ye,{defaultOpen:!0,delayDuration:0,children:[r,l]}),e[3]=r,e[4]=o):o=e[4],o}function Pl(){const t=w.c(5),{enableDecoImport:e}=Dt(),{data:n}=be.useSession();let r;t[0]!==n?.user?.email?(r=Ot.decoProfile(n?.user?.email),t[0]=n?.user?.email,t[1]=r):r=t[1];const l=!!e&&!!n?.user?.email;let o;t[2]!==r||t[3]!==l?(o={queryKey:r,queryFn:El,enabled:l,staleTime:3e5},t[2]=r,t[3]=l,t[4]=o):o=t[4];const{data:i}=Mt(o);return i?.isDecoUser??!1}async function El(){const t=await fetch("/api/deco-sites/profile");return t.ok?t.json():{isDecoUser:!1}}function Fl(t){const e=he(),{create:n}=Jt(),{locator:r}=de(),l=ot({strict:!1}),o=it({strict:!1});return async i=>{const a=crypto.randomUUID(),c=i===o.virtualmcpid?un(t,r,l.taskId??""):null;try{await n({id:a,virtual_mcp_id:i,...c?{branch:c}:{}})}catch{}e({to:"/$org/$taskId",params:{org:t,taskId:a},search:{virtualmcpid:i}})}}function At(t){const e=w.c(17),{agent:n,selected:r,onClick:l}=t,o=r?"bg-accent":"hover:bg-accent";let i;e[0]!==o?(i=F("flex flex-col items-center gap-2 p-3 rounded-xl transition-colors cursor-pointer group",o),e[0]=o,e[1]=i):i=e[1];let a;e[2]!==n.icon||e[3]!==n.title?(a=s.jsx(De,{icon:n.icon,name:n.title,size:"md",className:"transition-transform group-hover:scale-105"}),e[2]=n.icon,e[3]=n.title,e[4]=a):a=e[4];let c;e[5]!==r?(c=r&&s.jsx("span",{className:"absolute -bottom-1 -right-1 flex size-4 items-center justify-center rounded-full border border-border bg-background",children:s.jsx(Xe,{size:10,className:"text-foreground"})}),e[5]=r,e[6]=c):c=e[6];let d;e[7]!==a||e[8]!==c?(d=s.jsxs("div",{className:"relative",children:[a,c]}),e[7]=a,e[8]=c,e[9]=d):d=e[9];let m;e[10]!==n.title?(m=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground line-clamp-2 w-full",children:n.title}),e[10]=n.title,e[11]=m):m=e[11];let u;return e[12]!==l||e[13]!==i||e[14]!==d||e[15]!==m?(u=s.jsxs("button",{type:"button",onClick:l,className:i,children:[d,m]}),e[12]=l,e[13]=i,e[14]=d,e[15]=m,e[16]=u):u=e[16],u}function Rl(t){const e=w.c(60),{onClose:n,onOpenImportDeco:r,onOpenGithubImport:l,onSelectAgent:o,selectedAgentId:i}=t,[a,c]=O.useState(""),d=Yt(),m=d??[],{org:u}=de(),{data:f}=be.useSession(),h=f?.user?.id??"anon",p=En(d),x=Fn();let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={navigateOnCreate:!0},e[0]=g):g=e[0];const{createVirtualMCP:b,isCreating:j}=ir(g),{createFromTemplate:v,isCreating:y}=cr(),_=Pl(),k=Fl(u.slug),N=fn(d),C=a.toLowerCase(),S=m.filter(Ll).filter(U=>!N.has(U.id)).filter(U=>!a||U.title.toLowerCase().includes(C)),z=Ge(u.id),T=!a||z.title.toLowerCase().includes(C);let A;e[1]!==n||e[2]!==o?(A=()=>{o?.(null),n(),c("")},e[1]=n,e[2]=o,e[3]=A):A=e[3];const $=A,E=U=>{if(o){o(U.id),n(),c("");return}Rn({orgId:u.id,userId:h},U.id,p),x(),n(),c(""),k(U.id)},W="flex flex-col max-h-[min(640px,80dvh)]";let M;e[4]!==a?(M=s.jsx(Dl,{value:a,onChange:c,placeholder:"Search agents..."}),e[4]=a,e[5]=M):M=e[5];const q="overflow-y-auto flex-1 min-h-0 px-3 pb-3";let R;e[6]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx("div",{className:"px-1 pt-3 pb-2",children:s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Agents"})}),e[6]=R):R=e[6];const Q="grid grid-cols-3 gap-1";let Y;e[7]!==b||e[8]!==n?(Y=async()=>{ae("agent_create_new_clicked",{source:"browse_popover"}),await b(),n()},e[7]=b,e[8]=n,e[9]=Y):Y=e[9];let ne,re;e[10]===Symbol.for("react.memo_cache_sentinel")?(re=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-dashed border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(Ae,{size:16,className:"text-muted-foreground"})}),ne=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Create new"}),e[10]=ne,e[11]=re):(ne=e[10],re=e[11]);let L;e[12]!==j||e[13]!==Y?(L=s.jsxs("button",{type:"button",disabled:j,onClick:Y,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[re,ne]}),e[12]=j,e[13]=Y,e[14]=L):L=e[14];let H;e[15]!==v||e[16]!==n?(H=async()=>{ae("agent_create_clicked",{source:"browse_popover",method:"website"}),await v(dr),n()},e[15]=v,e[16]=n,e[17]=H):H=e[17];let Z,K;e[18]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(or,{className:"size-5 text-muted-foreground"})}),K=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Start Website"}),e[18]=Z,e[19]=K):(Z=e[18],K=e[19]);let ee;e[20]!==y||e[21]!==H?(ee=s.jsxs("button",{type:"button",disabled:y,onClick:H,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group disabled:opacity-50 disabled:cursor-not-allowed",children:[Z,K]}),e[20]=y,e[21]=H,e[22]=ee):ee=e[22];let G;e[23]!==n||e[24]!==l?(G=()=>{ae("agent_import_clicked",{source:"github"}),l(),n()},e[23]=n,e[24]=l,e[25]=G):G=e[25];let le,ce;e[26]===Symbol.for("react.memo_cache_sentinel")?(le=s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx(ur,{className:"size-5 text-muted-foreground"})}),ce=s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import GitHub"}),e[26]=le,e[27]=ce):(le=e[26],ce=e[27]);let V;e[28]!==G?(V=s.jsxs("button",{type:"button",onClick:G,className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[le,ce]}),e[28]=G,e[29]=V):V=e[29];let J;e[30]!==_||e[31]!==n||e[32]!==r?(J=_&&s.jsxs("button",{type:"button",onClick:()=>{ae("agent_import_clicked",{source:"deco"}),r(),n()},className:"flex flex-col items-center gap-2 p-3 rounded-xl transition-colors hover:bg-accent cursor-pointer group",children:[s.jsx("div",{className:"w-12 h-12 rounded-xl border-2 border-border flex items-center justify-center shrink-0 transition-transform group-hover:scale-105",children:s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"",className:"size-5 object-contain"})}),s.jsx("span",{className:"text-xs leading-tight text-center text-muted-foreground group-hover:text-foreground",children:"Import deco.cx"})]}),e[30]=_,e[31]=n,e[32]=r,e[33]=J):J=e[33];const me=o&&T&&z&&s.jsx(At,{agent:z,selected:!i||i===z.id,onClick:$}),I=S.map(U=>s.jsx(At,{agent:U,selected:o?i===U.id:void 0,onClick:()=>E(U)},U.id));let D;e[34]!==L||e[35]!==ee||e[36]!==V||e[37]!==J||e[38]!==me||e[39]!==I?(D=s.jsxs("div",{className:Q,children:[L,ee,V,J,me,I]}),e[34]=L,e[35]=ee,e[36]=V,e[37]=J,e[38]=me,e[39]=I,e[40]=D):D=e[40];let B;e[41]!==j||e[42]!==a||e[43]!==S.length?(B=S.length===0&&!j&&s.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:a?"No agents found":"No agents yet"}),e[41]=j,e[42]=a,e[43]=S.length,e[44]=B):B=e[44];let P;e[45]!==D||e[46]!==B||e[47]!==R?(P=s.jsxs("div",{className:q,children:[R,D,B]}),e[45]=D,e[46]=B,e[47]=R,e[48]=P):P=e[48];let X;e[49]!==u.slug?(X={org:u.slug},e[49]=u.slug,e[50]=X):X=e[50];let oe;e[51]!==n?(oe=()=>n(),e[51]=n,e[52]=oe):oe=e[52];let ie;e[53]!==X||e[54]!==oe?(ie=s.jsx("div",{className:"border-t border-border px-3 py-2.5",children:s.jsx(Ft,{to:"/$org/settings/agents",params:X,onClick:oe,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:"See all agents"})}),e[53]=X,e[54]=oe,e[55]=ie):ie=e[55];let Se;return e[56]!==P||e[57]!==ie||e[58]!==M?(Se=s.jsxs("div",{className:W,children:[M,P,ie]}),e[56]=P,e[57]=ie,e[58]=M,e[59]=Se):Se=e[59],Se}function Ll(t){return!jn(t.id)}function Bl(t){const e=w.c(31);let n;e[0]!==t?(n=t===void 0?{}:t,e[0]=t,e[1]=n):n=e[1];const{compact:r,trigger:l,onSelectAgent:o,selectedAgentId:i,side:a,align:c}=n,d=r===void 0?!1:r,m=a===void 0?"right":a,u=c===void 0?"start":c,[f,h]=O.useState(!1),[p,x]=O.useState(!1),[g,b]=O.useState(!1),j=dt(),{setOpenMobile:v}=Ce(),y=Pn(),_=y?"border border-border":void 0;let k;e[2]!==y?(k=M=>y?s.jsx(Ml,{children:M}):M,e[2]=y,e[3]=k):k=e[3];const N=k;let C;e[4]!==j||e[5]!==v?(C=()=>{h(!1),j&&v(!1)},e[4]=j,e[5]=v,e[6]=C):C=e[6];const S=C;let z;e[7]!==S||e[8]!==o||e[9]!==f||e[10]!==i?(z=f&&s.jsx(O.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx(fe,{className:"h-4 w-24"})}),children:s.jsx(Rl,{onClose:S,onOpenImportDeco:()=>x(!0),onOpenGithubImport:()=>{b(!0),S()},onSelectAgent:o,selectedAgentId:i})}),e[7]=S,e[8]=o,e[9]=f,e[10]=i,e[11]=z):z=e[11];const T=z;let A;e[12]!==u||e[13]!==d||e[14]!==_||e[15]!==y||e[16]!==j||e[17]!==f||e[18]!==T||e[19]!==m||e[20]!==l||e[21]!==N?(A=j?s.jsxs(s.Fragment,{children:[l?s.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:l}):d?N(s.jsx(xe,{"aria-label":"Browse agents",className:F(_),onClick:()=>{ae("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:s.jsx(Ae,{className:"size-4"})})):s.jsx(se,{children:N(s.jsxs(ue,{tooltip:y?void 0:"Browse agents",className:F(_),onClick:()=>{ae("agent_browser_opened",{surface:"mobile_drawer"}),h(!0)},children:[s.jsx(Ae,{}),s.jsx("span",{children:"New agent"})]}))}),s.jsx(Ht,{open:f,onOpenChange:h,direction:"bottom",children:s.jsxs(Ut,{className:"max-h-[85dvh] p-0",children:[s.jsx(Gt,{className:"sr-only",children:"Browse agents"}),T]})})]}):s.jsxs(Pe,{open:f,onOpenChange:M=>{M&&!f&&ae("agent_browser_opened",{surface:"desktop_popover"}),h(M)},children:[l?s.jsx(Ne,{asChild:!0,children:l}):d?N(s.jsx(Ne,{asChild:!0,children:s.jsx(xe,{"aria-label":"Browse agents",className:F(_),children:s.jsx(Ae,{className:"size-4"})})})):s.jsx(se,{children:N(s.jsx(Ne,{asChild:!0,children:s.jsxs(ue,{tooltip:y?void 0:"Browse agents",className:F(_),children:[s.jsx(Ae,{}),s.jsx("span",{children:"New agent"})]})}))}),s.jsx(Ee,{className:"w-[380px] p-0 overflow-hidden",side:m,align:u,children:T})]}),e[12]=u,e[13]=d,e[14]=_,e[15]=y,e[16]=j,e[17]=f,e[18]=T,e[19]=m,e[20]=l,e[21]=N,e[22]=A):A=e[22];let $;e[23]!==p?($=s.jsx(ar,{open:p,onOpenChange:x}),e[23]=p,e[24]=$):$=e[24];let E;e[25]!==g?(E=s.jsx(mr,{open:g,onOpenChange:b}),e[25]=g,e[26]=E):E=e[26];let W;return e[27]!==E||e[28]!==A||e[29]!==$?(W=s.jsxs(s.Fragment,{children:[A,$,E]}),e[27]=E,e[28]=A,e[29]=$,e[30]=W):W=e[30],W}const ys="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md px-1.5 py-1 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function Hl(t){const e=w.c(19),{agentId:n,onOpenHome:r,onPick:l}=t,o=Qt(n),i=o?.title??"Decopilot",a=`Open ${i} home`,c=o?.icon??null;let d;e[0]!==c||e[1]!==i?(d=s.jsx(De,{icon:c,name:i,size:"2xs"}),e[0]=c,e[1]=i,e[2]=d):d=e[2];let m;e[3]!==r||e[4]!==a||e[5]!==d?(m=s.jsx("button",{type:"button",onClick:r,"aria-label":a,className:"wco-no-drag flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:d}),e[3]=r,e[4]=a,e[5]=d,e[6]=m):m=e[6];let u;e[7]!==i?(u=s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:i}),e[7]=i,e[8]=u):u=e[8];let f;e[9]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(ft,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=f):f=e[9];let h;e[10]!==u?(h=s.jsxs("button",{type:"button",className:ys,children:[u,f]}),e[10]=u,e[11]=h):h=e[11];let p;e[12]!==n||e[13]!==l||e[14]!==h?(p=s.jsx(Bl,{side:"bottom",align:"start",selectedAgentId:n,onSelectAgent:l,trigger:h}),e[12]=n,e[13]=l,e[14]=h,e[15]=p):p=e[15];let x;return e[16]!==m||e[17]!==p?(x=s.jsxs("div",{className:"flex items-center gap-0.5",children:[m,p]}),e[16]=m,e[17]=p,e[18]=x):x=e[18],x}function Tt(){const t=w.c(34),{org:e}=de(),{state:n}=Ce(),r=n==="collapsed",l=he();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},t[0]=o):o=t[0];const i=ot(o);let a;t[1]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},t[1]=a):a=t[1];const c=it(a),{threads:d}=ut(),{setTaskId:m,createNewTask:u}=mt();let f;t[2]!==e.id?(f=Ge(e.id),t[2]=e.id,t[3]=f):f=t[3];const h=f.id,p=i.taskId?c.virtualmcpid??h:h;let x;t[4]!==u||t[5]!==h||t[6]!==l||t[7]!==e.slug||t[8]!==m||t[9]!==d?(x=T=>{if(!T||T===h){l({to:"/$org",params:{org:e.slug}});return}const A=d.find($=>!$.hidden&&$.virtual_mcp_id===T&&$.title==="New chat"&&(!$.status||$.status==="in_progress"));A?m(A.id,T):u(T)},t[4]=u,t[5]=h,t[6]=l,t[7]=e.slug,t[8]=m,t[9]=d,t[10]=x):x=t[10];const g=x;let b;t[11]!==e.slug?(b={org:e.slug},t[11]=e.slug,t[12]=b):b=t[12];let j;t[13]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(te.Logo,{}),t[13]=j):j=t[13];let v;t[14]!==b?(v=s.jsx(Ft,{to:"/$org",params:b,"aria-label":"Organization home",title:"Home",className:"wco-no-drag flex items-center shrink-0 cursor-pointer rounded-md px-1 hover:bg-accent/60 transition-colors",children:j}),t[14]=b,t[15]=v):v=t[15];let y;t[16]!==e||t[17]!==r?(y=!r&&s.jsx($l,{orgParam:e.slug,trigger:s.jsxs("button",{type:"button",className:ys,children:[s.jsx(vs,{org:e,size:"xs"}),s.jsx("span",{className:"truncate font-medium max-w-[10rem]",children:e.name}),s.jsx(ft,{size:14,className:"shrink-0 text-muted-foreground opacity-70"})]})}),t[16]=e,t[17]=r,t[18]=y):y=t[18];let _;t[19]!==v||t[20]!==y?(_=s.jsxs(jt,{className:"gap-0.5",children:[v,y]}),t[19]=v,t[20]=y,t[21]=_):_=t[21];let k;t[22]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Hn,{}),t[22]=k):k=t[22];let N;t[23]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("span",{className:"h-4 w-24 rounded bg-muted animate-pulse"}),t[23]=N):N=t[23];let C;t[24]!==p||t[25]!==g?(C=()=>g(p),t[24]=p,t[25]=g,t[26]=C):C=t[26];let S;t[27]!==p||t[28]!==g||t[29]!==C?(S=s.jsx(jt,{children:s.jsx(O.Suspense,{fallback:N,children:s.jsx(Hl,{agentId:p,onOpenHome:C,onPick:g})})}),t[27]=p,t[28]=g,t[29]=C,t[30]=S):S=t[30];let z;return t[31]!==S||t[32]!==_?(z=s.jsx(Un,{className:"wco-no-drag",children:s.jsxs(Gn,{className:"flex-nowrap",children:[_,k,S]})}),t[31]=S,t[32]=_,t[33]=z):z=t[33],z}const Ul="sidebar.open";function Gl(){const t=w.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(On,{}),t[0]=e):e=t[0],e}function Li(){const t=w.c(24),e=dt(),[n,r]=We(Ul,!1),{width:l,wrapperRef:o,onStartResize:i,resetWidth:a}=pr();let c;t[0]!==e?(c=e?s.jsxs(te.Header,{className:"grid-cols-1 px-1 pr-1",children:[s.jsxs("div",{className:"grid w-full grid-cols-[auto_auto_auto_1fr_auto_auto] items-center gap-2",children:[s.jsx(es,{}),s.jsx(Tt,{}),s.jsx(rt,{}),s.jsx("div",{"aria-hidden":!0,className:"min-w-0"}),s.jsx(te.TogglesSlot,{}),s.jsx(te.TabsSlot,{className:"min-w-0 justify-self-end"})]}),s.jsx(te.CenterSlot,{}),s.jsx(te.RightSlot,{})]}):s.jsxs(te.Header,{children:[s.jsx(te.LeftColumn,{children:s.jsx(Tt,{})}),s.jsx(te.CenterSlot,{}),s.jsxs(te.RightColumn,{children:[s.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] flex justify-end",children:s.jsx(te.TabsSlot,{})}),s.jsx(te.RightSlot,{}),s.jsx(te.TogglesSlot,{})]})]}),t[0]=e,t[1]=c):c=t[1];const d=`${l}px`;let m;t[2]!==d?(m={"--sidebar-width":d,"--sidebar-width-icon":"3.5rem"},t[2]=d,t[3]=m):m=t[3];const u=m;let f;t[4]!==e||t[5]!==i||t[6]!==a?(f=!e&&s.jsxs(s.Fragment,{children:[s.jsx(Sl,{}),s.jsx(fr,{onPointerDown:i,onDoubleClick:a})]}),t[4]=e,t[5]=i,t[6]=a,t[7]=f):f=t[7];let h;t[8]===Symbol.for("react.memo_cache_sentinel")?(h={background:"transparent",containerType:"inline-size"},t[8]=h):h=t[8];let p;t[9]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(Hs,{className:"flex flex-col",style:h,children:s.jsx("div",{className:"flex flex-col h-full min-h-0",children:s.jsx("div",{className:"relative flex-1 min-h-0 flex flex-row",children:s.jsx(O.Suspense,{fallback:s.jsx(Gl,{}),children:s.jsx(Rs,{})})})})}),t[9]=p):p=t[9];let x;t[10]!==u||t[11]!==f||t[12]!==o?(x=s.jsxs(Us,{ref:o,className:"flex-1 bg-sidebar relative min-h-0",style:u,children:[f,p]}),t[10]=u,t[11]=f,t[12]=o,t[13]=x):x=t[13];let g;t[14]!==e?(g=e&&s.jsx(Dn,{renderSidebar:ql}),t[14]=e,t[15]=g):g=t[15];let b;t[16]!==c||t[17]!==x||t[18]!==g?(b=s.jsx(Bn,{children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[c,x,g]})}),t[16]=c,t[17]=x,t[18]=g,t[19]=b):b=t[19];let j;return t[20]!==r||t[21]!==n||t[22]!==b?(j=s.jsx(yn,{children:s.jsx(te.Provider,{children:s.jsx(Gs,{open:n,onOpenChange:r,children:b})})}),t[20]=r,t[21]=n,t[22]=b,t[23]=j):j=t[23],j}function ql(t){const{onClose:e}=t;return s.jsx("div",{className:"flex h-full",children:s.jsx("div",{className:"w-full bg-sidebar flex flex-col overflow-y-auto group/sidebar","data-state":"expanded",children:s.jsx(Nl,{onClose:e})})})}export{Li as default};