decocms 4.27.0 → 4.28.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 (225) hide show
  1. package/dist/client/assets/{AlertCircle-ByjwYeir.js → AlertCircle-bPFs3KEL.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-CqbeTpGc.js → ArrowUpRight-Cr-8XVVD.js} +1 -1
  3. package/dist/client/assets/{Check-0ZdlfWma.js → Check-DgZ3In7m.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-CilSrYvs.js → CheckCircle-C3XWnj4j.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-OndWepD0.js → ChevronDown--CNgLcjC.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-knT_Aa4i.js → ChevronRight-BWbK6ynD.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-3bfkgUxC.js → ChevronUp-Kv_LvrHV.js} +1 -1
  8. package/dist/client/assets/{Circle-Db6Vd1uq.js → Circle-qJ5BBlYd.js} +1 -1
  9. package/dist/client/assets/{Copy01-Bm3MTJyz.js → Copy01-3GtjKY1N.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-gyHbK0_B.js → DotsVertical-DtK63shY.js} +1 -1
  11. package/dist/client/assets/{Eye-kqhgK17A.js → Eye-DF9e8dvr.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CIX2VZX3.js → FilterLines-B3UlQwDc.js} +1 -1
  13. package/dist/client/assets/{Globe01-BO7OpXM7.js → Globe01-B13h8XtZ.js} +1 -1
  14. package/dist/client/assets/{Globe04-3C7rVANL.js → Globe04-1GZz65ia.js} +1 -1
  15. package/dist/client/assets/{HardDrive-Dn7zY9aQ.js → HardDrive-4yC-BESY.js} +1 -1
  16. package/dist/client/assets/{Key01-CnYTz_f5.js → Key01-CI7N-3nc.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-B6zHq7Nr.js → LayoutLeft-9np6COHp.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-Dcr319Ba.js → LinkExternal01-BPLWMKpP.js} +1 -1
  19. package/dist/client/assets/{List-q5qxU0Zg.js → List-DuUlr1m8.js} +1 -1
  20. package/dist/client/assets/{Loading02-tznIx2K-.js → Loading02-D0nMaQOZ.js} +1 -1
  21. package/dist/client/assets/{Monitor01-BE3Am7tC.js → Monitor01-CoHtWm_B.js} +1 -1
  22. package/dist/client/assets/{Palette-CW_6OdhQ.js → Palette-it9tTFZx.js} +1 -1
  23. package/dist/client/assets/{Play-C72dn0Fj.js → Play-DGqQSguj.js} +1 -1
  24. package/dist/client/assets/{Plus-BqPAYR_l.js → Plus-C4Q0OOCY.js} +1 -1
  25. package/dist/client/assets/{SearchLg-FHuNX79t.js → SearchLg-DbFjcinT.js} +1 -1
  26. package/dist/client/assets/{SearchMd-CHA-7_A7.js → SearchMd-f7WdVWzc.js} +1 -1
  27. package/dist/client/assets/{Settings02-CyWbAzlJ.js → Settings02-C4rR2BwH.js} +1 -1
  28. package/dist/client/assets/{Shield01-BQY4pFHI.js → Shield01-CpnoHxN2.js} +1 -1
  29. package/dist/client/assets/{Star01-BZwT1qKA.js → Star01-Jt5Q2gfx.js} +1 -1
  30. package/dist/client/assets/{Stars01-B7X7AsD2.js → Stars01-DkYIpw1N.js} +1 -1
  31. package/dist/client/assets/{Stars02-BxLez2Aw.js → Stars02-BP1hwbuc.js} +1 -1
  32. package/dist/client/assets/{Sun-C7qp-aqN.js → Sun-BZVZjrLl.js} +1 -1
  33. package/dist/client/assets/{SwitchHorizontal01-E_4bb5Y7.js → SwitchHorizontal01-BDG7IOK2.js} +1 -1
  34. package/dist/client/assets/{Tool01-B-PFUcc7.js → Tool01-BL4kQBIR.js} +1 -1
  35. package/dist/client/assets/{Trash01-D85FZrUl.js → Trash01-DquY3ri8.js} +1 -1
  36. package/dist/client/assets/{Upload01-CLneIdMS.js → Upload01-Bkj-e8t-.js} +1 -1
  37. package/dist/client/assets/{User01-D0EG03RI.js → User01-Cob64tHg.js} +1 -1
  38. package/dist/client/assets/{Users01-DiFayJrv.js → Users01-kXte77jT.js} +1 -1
  39. package/dist/client/assets/{Users03-CPIRGSGa.js → Users03-DPHNxMCn.js} +1 -1
  40. package/dist/client/assets/{X-DAWomg6U.js → X-D42jewIw.js} +1 -1
  41. package/dist/client/assets/{XCircle-B-s_NCPe.js → XCircle-d4Mj_55a.js} +1 -1
  42. package/dist/client/assets/{XClose-28JSukJO.js → XClose-D_lTdEDj.js} +1 -1
  43. package/dist/client/assets/{Zap-3O7242Tr.js → Zap-II5jDxLp.js} +1 -1
  44. package/dist/client/assets/{ZapSquare-p96Mq9QT.js → ZapSquare-Cb2ZjSQ9.js} +1 -1
  45. package/dist/client/assets/{ZoomOut-Csg9je7L.js → ZoomOut-CrZXH-lO.js} +1 -1
  46. package/dist/client/assets/{access-gate-CLchE9Rb.js → access-gate-Dt-CGoo9.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-BwjV4RRX.js → add-section-modal-mGWtRMIQ.js} +1 -1
  48. package/dist/client/assets/{agent-capabilities-DL2-YZHZ.js → agent-capabilities-C8-S9cdW.js} +1 -1
  49. package/dist/client/assets/{agent-icon-C8_WQkjR.js → agent-icon-Da9Da6_T.js} +1 -1
  50. package/dist/client/assets/{agents-list-BSpvrjuH.js → agents-list-By-aOoP1.js} +1 -1
  51. package/dist/client/assets/{ai-providers-DxxmEtny.js → ai-providers-B46vBH0h.js} +1 -1
  52. package/dist/client/assets/{alert-D8f848im.js → alert-B6evt6kR.js} +1 -1
  53. package/dist/client/assets/{alert-dialog-Bbh2yqqj.js → alert-dialog-gasitoEq.js} +1 -1
  54. package/dist/client/assets/{app-editor-CyoiPqYb.js → app-editor-DtBYyVbS.js} +1 -1
  55. package/dist/client/assets/{auth-BZgPbNUM.js → auth-C47SGxHt.js} +1 -1
  56. package/dist/client/assets/{auth-catchall-C8AUzewo.js → auth-catchall-BUB8_LkD.js} +1 -1
  57. package/dist/client/assets/{auth-entry-8qCQlH6j.js → auth-entry-DarNDBpq.js} +1 -1
  58. package/dist/client/assets/{auth-split-layout-Bk3Yor4u.js → auth-split-layout-B5r53A4Z.js} +1 -1
  59. package/dist/client/assets/{authenticate-and-persist-oauth-NWZWbbJs.js → authenticate-and-persist-oauth-CEA-zfJw.js} +1 -1
  60. package/dist/client/assets/{automation-list-row-SE-XVCj7.js → automation-list-row-jGOxjJIf.js} +1 -1
  61. package/dist/client/assets/{automation-runs-BPf4jePf.js → automation-runs-BYvq5zLj.js} +1 -1
  62. package/dist/client/assets/{automations-DMvqgs_Q.js → automations-UAn8KJMc.js} +1 -1
  63. package/dist/client/assets/{avatar-Bgx8CG81.js → avatar-G4lfZ1rm.js} +1 -1
  64. package/dist/client/assets/{badge-BPXHmusI.js → badge-D16FSQ-g.js} +1 -1
  65. package/dist/client/assets/{block-document-DqfUnObE.js → block-document-Bah6aLt6.js} +1 -1
  66. package/dist/client/assets/{brand-context-BlIOCQhP.js → brand-context-Bw4dr7_r.js} +1 -1
  67. package/dist/client/assets/{breadcrumb-B2b8JrR-.js → breadcrumb-BL6L_bSQ.js} +1 -1
  68. package/dist/client/assets/{buckets-DSriBCEX.js → buckets-CBm9y2mr.js} +1 -1
  69. package/dist/client/assets/{bulk-category-panel-DIBMwu0J.js → bulk-category-panel-D7jmb1c_.js} +1 -1
  70. package/dist/client/assets/{capability-load-error-kSoUwWqs.js → capability-load-error-B7Sh2GnA.js} +1 -1
  71. package/dist/client/assets/{card-CDY77mdm.js → card-B-n7RZj8.js} +1 -1
  72. package/dist/client/assets/{category-editor-Cq4bgquJ.js → category-editor-B5mnC1KL.js} +1 -1
  73. package/dist/client/assets/{chat-context-DR8qUzB4.js → chat-context-BYfzrjSg.js} +1 -1
  74. package/dist/client/assets/{checkbox-Dl_uQDiC.js → checkbox-DYEeIzJL.js} +1 -1
  75. package/dist/client/assets/{cli-auth-success-DcMsRJjw.js → cli-auth-success-D3PcSR2u.js} +1 -1
  76. package/dist/client/assets/{collection-detail-D8C7TMMc.js → collection-detail-6V-m6EfP.js} +1 -1
  77. package/dist/client/assets/{collection-display-button-DNznOUk2.js → collection-display-button-2lIAjdeE.js} +1 -1
  78. package/dist/client/assets/{collection-search-CseYh1f6.js → collection-search-iqB-Cu-3.js} +1 -1
  79. package/dist/client/assets/{collection-table-wrapper-CUw_-nnE.js → collection-table-wrapper-rtLc_zsT.js} +1 -1
  80. package/dist/client/assets/{collection-tabs-BziDnQHI.js → collection-tabs-rhGvUIlm.js} +1 -1
  81. package/dist/client/assets/{command-CwilVcwd.js → command-CR6OgyqM.js} +1 -1
  82. package/dist/client/assets/{commerce-onboarding-vFKoJF4j.js → commerce-onboarding-BoTve4Dl.js} +1 -1
  83. package/dist/client/assets/{connect-desktop-dialog-DG5MQFnM.js → connect-desktop-dialog-Bvweozcg.js} +1 -1
  84. package/dist/client/assets/{connection-card-4jC90BOs.js → connection-card-NnU7ECW4.js} +1 -1
  85. package/dist/client/assets/{connection-detail-C8U0XoNS.js → connection-detail-DJ-upi_E.js} +1 -1
  86. package/dist/client/assets/{connection-form-helpers-BrvucQ0G.js → connection-form-helpers-Bm9nknv3.js} +1 -1
  87. package/dist/client/assets/{connections-DDve2BG6.js → connections-CcFwx0aH.js} +1 -1
  88. package/dist/client/assets/{decopilot-BFzm9Lxf.js → decopilot-lLmAldte.js} +1 -1
  89. package/dist/client/assets/{decopilot-sse-pool--TRlxcj1.js → decopilot-sse-pool-By8dFwPK.js} +1 -1
  90. package/dist/client/assets/{dialog-B9Ck6bim.js → dialog-Bnj4VVJm.js} +1 -1
  91. package/dist/client/assets/{domain-settings-B1_HkFk-.js → domain-settings-DYfKBPl1.js} +1 -1
  92. package/dist/client/assets/{drawer-PXWRwUMY.js → drawer-D3mld3mJ.js} +1 -1
  93. package/dist/client/assets/{dropdown-menu-CkHc6C_x.js → dropdown-menu-BKlRxK5y.js} +1 -1
  94. package/dist/client/assets/{empty-state-DrVxyRJZ.js → empty-state-BtpcAucy.js} +1 -1
  95. package/dist/client/assets/{extract-connection-data-nL3XXsx_.js → extract-connection-data-Dr0kvEkl.js} +1 -1
  96. package/dist/client/assets/{file-explorer-C-knXFM7.js → file-explorer-FHGq6O73.js} +1 -1
  97. package/dist/client/assets/{file-type-icon-Dvhcxk4y.js → file-type-icon-4oZPbqxn.js} +1 -1
  98. package/dist/client/assets/{files-D0psdJ1m.js → files-BwJ_5Wub.js} +1 -1
  99. package/dist/client/assets/{form-CqDgKCwK.js → form-OsKubpwl.js} +1 -1
  100. package/dist/client/assets/{general-X7hmt3Ac.js → general-B8ohPBsh.js} +1 -1
  101. package/dist/client/assets/{github-repo-picker-Bsmdzs1g.js → github-repo-picker-QqiEg-YG.js} +1 -1
  102. package/dist/client/assets/{hooks-DyM8E1Re.js → hooks-DRWd8r4q.js} +1 -1
  103. package/dist/client/assets/{index-DDe5qdmE.js → index-AMl_RbKx.js} +1 -1
  104. package/dist/client/assets/{index-BqXgMqeX.js → index-BFfodvon.js} +1 -1
  105. package/dist/client/assets/{index-13GRlMyL.js → index-Bcf0MN_M.js} +1 -1
  106. package/dist/client/assets/{index-BrmYwPif.js → index-Bd3CUq96.js} +1 -1
  107. package/dist/client/assets/{index-Bi3t4Ydq.js → index-Byfr_hzz.js} +1 -1
  108. package/dist/client/assets/index-Bzy6RQIz.css +1 -0
  109. package/dist/client/assets/{index-Dyk5L1Av.js → index-C0nCgkZu.js} +1 -1
  110. package/dist/client/assets/{index-BTYhDHVM.js → index-CbUHywdj.js} +27 -27
  111. package/dist/client/assets/{index-D2vDrf_W.js → index-D-kcgxq7.js} +1 -1
  112. package/dist/client/assets/{index-DoMiY5Rl.js → index-DSDpj2Bj.js} +3 -3
  113. package/dist/client/assets/{index-D2_MPMAP.js → index-DTTOpJGs.js} +1 -1
  114. package/dist/client/assets/{index-CkkKCLPS.js → index-DiQHdGZM.js} +1 -1
  115. package/dist/client/assets/{index-DfimdGQr.js → index-Dn1z4pS9.js} +1 -1
  116. package/dist/client/assets/{index-oQ5XcQ9g.js → index-cVPtQiun.js} +1 -1
  117. package/dist/client/assets/{index-BiyBiDMH.js → index-oFz8diCg.js} +1 -1
  118. package/dist/client/assets/{index-redirect-Cbvg7-l7.js → index-redirect-UdzAJwbB.js} +1 -1
  119. package/dist/client/assets/{input-DiXvIasa.js → input-CYkPya5x.js} +1 -1
  120. package/dist/client/assets/{integration-icon-DyXHe04k.js → integration-icon-CBUlZi7o.js} +1 -1
  121. package/dist/client/assets/{invite-member-dialog-CAt6X9Ru.js → invite-member-dialog-B3es0Bdg.js} +1 -1
  122. package/dist/client/assets/{label-74sJ_nBV.js → label-DCDEQbHw.js} +1 -1
  123. package/dist/client/assets/{library-tab-AqUKgD_Y.js → library-tab-D9496yS1.js} +1 -1
  124. package/dist/client/assets/{login-1FwiKgKi.js → login-BNlqngk5.js} +1 -1
  125. package/dist/client/assets/{mcp-oauth-DQnzsAHX.js → mcp-oauth-DxV8k1O8.js} +1 -1
  126. package/dist/client/assets/{members-DTmXqBGW.js → members-CZq1R1o9.js} +1 -1
  127. package/dist/client/assets/{monaco-editor-CqKzUuNL.js → monaco-editor-SCx_7ctH.js} +1 -1
  128. package/dist/client/assets/{monitoring-stats-row-IeWi3rXa.js → monitoring-stats-row-DkMxLdzC.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-BcFGKAwf.js → oauth-callback-CniVqnjW.js} +1 -1
  130. package/dist/client/assets/{oauth-callback-ai-provider-Cp-67T12.js → oauth-callback-ai-provider-DDC9J3b6.js} +1 -1
  131. package/dist/client/assets/{onboarding-DffBRynt.js → onboarding-ygZy_Yb0.js} +1 -1
  132. package/dist/client/assets/{org-install-D8S_db4v.js → org-install-8oqVUWxa.js} +1 -1
  133. package/dist/client/assets/{org-layout-BP1ZJKDY.js → org-layout-CXeR-1D7.js} +1 -1
  134. package/dist/client/assets/{organization-choice-Ch-JJR5T.js → organization-choice-Cd8lWVie.js} +1 -1
  135. package/dist/client/assets/{page-seo-form-D4eefECk.js → page-seo-form-YFt2GhsQ.js} +1 -1
  136. package/dist/client/assets/page-seo-sheet-S2dX_fhd.js +1 -0
  137. package/dist/client/assets/{popover-TB7KbR-U.js → popover-B9JWOHOx.js} +1 -1
  138. package/dist/client/assets/{post-editor-B6u1Y_px.js → post-editor-BQT3B_Am.js} +1 -1
  139. package/dist/client/assets/{primitives-CtabiC6v.js → primitives-hQK8LPXl.js} +1 -1
  140. package/dist/client/assets/{profile-9QqKT7Ef.js → profile-BTquh82V.js} +1 -1
  141. package/dist/client/assets/project-app-view-CdQilt4g.js +1 -0
  142. package/dist/client/assets/record-editor-DbbIvft0.js +1 -0
  143. package/dist/client/assets/registry-CRc6N9jx.js +2 -0
  144. package/dist/client/assets/{registry-layout-Bd9c9COB.js → registry-layout-Z991cNGF.js} +1 -1
  145. package/dist/client/assets/{require-capability-CPCEn_WX.js → require-capability-BRuEsaxF.js} +1 -1
  146. package/dist/client/assets/{required-auth-layout-CkREiu2L.js → required-auth-layout-BsMqxbKV.js} +1 -1
  147. package/dist/client/assets/{reset-password-Bb-3ptGm.js → reset-password-Lgsn-eRn.js} +1 -1
  148. package/dist/client/assets/{roles-BKHTA08i.js → roles-C1qQ_TV2.js} +1 -1
  149. package/dist/client/assets/{scroll-area-DoFtvYfc.js → scroll-area-CpSDQ9B3.js} +1 -1
  150. package/dist/client/assets/{search-input-CPKs2eaW.js → search-input-BDUV4YsP.js} +1 -1
  151. package/dist/client/assets/{secrets-D6QveeLg.js → secrets-teGvKFHL.js} +1 -1
  152. package/dist/client/assets/{sections-editor-Bf26bJw6.js → sections-editor-Br_A2NRm.js} +1 -1
  153. package/dist/client/assets/{select-DHgoPiFM.js → select-B0TGwXjH.js} +1 -1
  154. package/dist/client/assets/{select-model-OY1Qn8Yf.js → select-model-0sL3XNAt.js} +1 -1
  155. package/dist/client/assets/{seo-editor-CLHJIzeY.js → seo-editor-CT59S1WW.js} +1 -1
  156. package/dist/client/assets/{settings-layout-yfkXFTgs.js → settings-layout-2ZApea8Z.js} +1 -1
  157. package/dist/client/assets/{settings-section-CTt5JrIL.js → settings-section-B6aXXKek.js} +1 -1
  158. package/dist/client/assets/{sheet-BZDF_cJc.js → sheet-CD0P6dVG.js} +1 -1
  159. package/dist/client/assets/{shell-controls-DxJRgaCZ.js → shell-controls-DLvJrQg7.js} +1 -1
  160. package/dist/client/assets/{shell-layout-Du3qnGdi.js → shell-layout-B9LP1BkH.js} +1 -1
  161. package/dist/client/assets/{sidebar-CtQLF6ut.js → sidebar-CA0rQ0cI.js} +1 -1
  162. package/dist/client/assets/{skeleton-CEliEjQ-.js → skeleton-C1UGwqR5.js} +1 -1
  163. package/dist/client/assets/{sso-BmVIP0-i.js → sso-DycskOy5.js} +1 -1
  164. package/dist/client/assets/{store-CuBE57tG.js → store-CcrTz5mI.js} +1 -1
  165. package/dist/client/assets/store-registry-CPxdSm7c.js +2 -0
  166. package/dist/client/assets/{studio-tools-BI4K6zAK.js → studio-tools-Ch4cqriC.js} +1 -1
  167. package/dist/client/assets/{switch-DNgPxOIf.js → switch-wI_LPvG9.js} +1 -1
  168. package/dist/client/assets/{table-CbZG0Yvh.js → table-CPM3_Orl.js} +1 -1
  169. package/dist/client/assets/{tabs-BBpU3KTb.js → tabs-0xOggEmc.js} +1 -1
  170. package/dist/client/assets/{task-row-CjtW-nA9.js → task-row-BX3vL-j_.js} +1 -1
  171. package/dist/client/assets/{task-status-Bdj_-1XP.js → task-status-C0114PFB.js} +1 -1
  172. package/dist/client/assets/{textarea-B3EqjRY_.js → textarea-DN29sT4P.js} +1 -1
  173. package/dist/client/assets/{toggle-group-CW6eHQoh.js → toggle-group-DYIGEIay.js} +1 -1
  174. package/dist/client/assets/{toolbar-B_VUdf8H.js → toolbar-B6-9TSIO.js} +1 -1
  175. package/dist/client/assets/{toolbar-icon-button-Wm9AmFZc.js → toolbar-icon-button-Bh253N_9.js} +1 -1
  176. package/dist/client/assets/{tools-list-9B-Iaaeo.js → tools-list-jzSJNAE9.js} +1 -1
  177. package/dist/client/assets/{tooltip-sQ7x_VKl.js → tooltip-DA3ZHoTy.js} +1 -1
  178. package/dist/client/assets/{types-GFux_3NI.js → types-J4fUU_hs.js} +1 -1
  179. package/dist/client/assets/{use-ai-providers-B2B98FIh.js → use-ai-providers-BYWkMeHm.js} +1 -1
  180. package/dist/client/assets/{use-automations-C9dwNXfl.js → use-automations-BL1tQ5os.js} +1 -1
  181. package/dist/client/assets/{use-capability-Hu-KpQcV.js → use-capability-DoRFc3sU.js} +1 -1
  182. package/dist/client/assets/{use-clock-tick-DeuF2oqR.js → use-clock-tick-xNvYo8xf.js} +1 -1
  183. package/dist/client/assets/{use-collections-B80KpRhI.js → use-collections-82SPyTpX.js} +1 -1
  184. package/dist/client/assets/{use-connection-DCX4A90N.js → use-connection-F0pDuIZV.js} +1 -1
  185. package/dist/client/assets/{use-copy-DkcATHcI.js → use-copy-DQL5kiDG.js} +1 -1
  186. package/dist/client/assets/{use-create-virtual-mcp-4jqR3PG-.js → use-create-virtual-mcp-DYf3GVLW.js} +1 -1
  187. package/dist/client/assets/{use-debounced-autosave-Bkttjwj6.js → use-debounced-autosave-BS89kWU2.js} +1 -1
  188. package/dist/client/assets/{use-debounced-value-CIyxTXgH.js → use-debounced-value-BD2t0Sm8.js} +1 -1
  189. package/dist/client/assets/{use-decopilot-events-DcXxoFOz.js → use-decopilot-events-Cu0CbLk2.js} +1 -1
  190. package/dist/client/assets/{use-delete-connection-BqEWEtkD.js → use-delete-connection-BbG-3tJm.js} +1 -1
  191. package/dist/client/assets/{use-file-configs-CtXOc8GN.js → use-file-configs-Bp7cInfo.js} +1 -1
  192. package/dist/client/assets/{use-infinite-scroll-CrPIHt6n.js → use-infinite-scroll-BjUfY6Ak.js} +1 -1
  193. package/dist/client/assets/{use-join-requests-DbzTu_Xa.js → use-join-requests-DeAr9xsU.js} +1 -1
  194. package/dist/client/assets/{use-mcp-client-DPYZa0sT.js → use-mcp-client-Cq1PuVy-.js} +1 -1
  195. package/dist/client/assets/{use-mcp-prompts-CuBXE7c-.js → use-mcp-prompts-hylROZ-T.js} +1 -1
  196. package/dist/client/assets/{use-mcp-tools-DQzTXmYh.js → use-mcp-tools-DRaDUnOy.js} +1 -1
  197. package/dist/client/assets/{use-members-B6SgYKEo.js → use-members-CRaQbprX.js} +1 -1
  198. package/dist/client/assets/{use-mobile-LnqC27QD.js → use-mobile-BJypeB5n.js} +1 -1
  199. package/dist/client/assets/{use-navigate-to-agent-BFo48Eih.js → use-navigate-to-agent-BsICAYua.js} +1 -1
  200. package/dist/client/assets/{use-org-auth-client-CB5xt651.js → use-org-auth-client-D8NgRY-r.js} +1 -1
  201. package/dist/client/assets/{use-org-sso-DQUCfv8V.js → use-org-sso-BRC0WSR6.js} +1 -1
  202. package/dist/client/assets/{use-organization-roles-CWoLFqd_.js → use-organization-roles-GI8K_qR8.js} +1 -1
  203. package/dist/client/assets/{use-organization-settings-CS_DEHIR.js → use-organization-settings-C6Az1O42.js} +1 -1
  204. package/dist/client/assets/{use-registry-connections-DHEFPXt7.js → use-registry-connections-BUnPYArH.js} +1 -1
  205. package/dist/client/assets/{use-secrets-BgkZnWBs.js → use-secrets-CfQzgPZW.js} +1 -1
  206. package/dist/client/assets/{use-status-sounds-Dc3PRGTj.js → use-status-sounds-aW26IA9a.js} +1 -1
  207. package/dist/client/assets/{use-view-mode-DKyqUXip.js → use-view-mode-DzFDMVFs.js} +1 -1
  208. package/dist/client/assets/{use-virtual-mcp-Da_h_el9.js → use-virtual-mcp-FbrEFCoK.js} +1 -1
  209. package/dist/client/assets/useInfiniteQuery-CKxr4Gfg.js +1 -0
  210. package/dist/client/assets/useSuspenseInfiniteQuery-DgBHsP0y.js +1 -0
  211. package/dist/client/assets/{useSuspenseQueries-Brx8rA5I.js → useSuspenseQueries-BLmcLcIz.js} +1 -1
  212. package/dist/client/assets/{variant-calendar-NASvsGIB.js → variant-calendar-BWQ1mpDd.js} +1 -1
  213. package/dist/client/assets/{view-mode-toggle-vIsUFCcG.js → view-mode-toggle-DbZluR-r.js} +1 -1
  214. package/dist/client/index.html +2 -2
  215. package/dist/server/cli.js +1 -1
  216. package/dist/server/server.js +1 -1
  217. package/package.json +1 -1
  218. package/dist/client/assets/index-CveMeMql.css +0 -1
  219. package/dist/client/assets/page-seo-sheet-BVOrU2vy.js +0 -1
  220. package/dist/client/assets/project-app-view-CF3ke1m2.js +0 -1
  221. package/dist/client/assets/record-editor-DMtSCMzY.js +0 -1
  222. package/dist/client/assets/registry-sNr288g6.js +0 -2
  223. package/dist/client/assets/store-registry-DaCcHZns.js +0 -2
  224. package/dist/client/assets/useInfiniteQuery-C-VIS5rS.js +0 -1
  225. package/dist/client/assets/useSuspenseInfiniteQuery-nSWMrLoD.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as a,a3 as R}from"./index-DoMiY5Rl.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as a,a3 as R}from"./index-DSDpj2Bj.js";function re(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function me(e){if(Array.isArray(e))return e}function be(e,t,r){return(t=Se(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ye(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,o,i,c,s=[],f=!0,p=!1;try{if(i=(r=r.call(e)).next,t!==0)for(;!(f=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);f=!0);}catch(j){p=!0,o=j}finally{try{if(!f&&r.return!=null&&(c=r.return(),Object(c)!==c))return}finally{if(p)throw o}}return s}}function we(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function oe(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ne(Object(r),!0).forEach(function(n){be(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oe(e,t){if(e==null)return{};var r,n,o=je(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function je(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Me(e,t){return me(e)||ye(e,t)||Ee(e,t)||we()}function Pe(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Se(e){var t=Pe(e,"string");return typeof t=="symbol"?t:t+""}function Ee(e,t){if(e){if(typeof e=="string")return re(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?re(e,t):void 0}}function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ie(Object(r),!0).forEach(function(n){Re(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ie(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ie(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(n){return t.reduceRight(function(o,i){return i(o)},n)}}function A(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function F(e){return{}.toString.call(e).includes("Object")}function Te(e){return!Object.keys(e).length}function D(e){return typeof e=="function"}function Ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Le(e,t){return F(t)||P("changeType"),Object.keys(t).some(function(r){return!Ce(e,r)})&&P("changeField"),t}function Ae(e){D(e)||P("selectorType")}function $e(e){D(e)||F(e)||P("handlerType"),F(e)&&Object.values(e).some(function(t){return!D(t)})&&P("handlersType")}function De(e){e||P("initialIsRequired"),F(e)||P("initialType"),Te(e)&&P("initialContent")}function Ve(e,t){throw new Error(e[t]||e.default)}var xe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},P=A(Ve)(xe),q={changes:Le,selector:Ae,handler:$e,initial:De};function Ne(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};q.initial(e),q.handler(t);var r={current:e},n=A(Fe)(r,t),o=A(ze)(r),i=A(q.changes)(e),c=A(qe)(r);function s(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(j){return j};return q.selector(p),p(r.current)}function f(p){Ie(n,o,i,c)(p)}return[s,f]}function qe(e,t){return D(t)?t(e.current):t}function ze(e,t){return e.current=ae(ae({},e.current),t),t}function Fe(e,t,r){return D(t)?t(e.current):Object.keys(r).forEach(function(n){var o;return(o=t[n])===null||o===void 0?void 0:o.call(t,e.current[n])}),r}var Ue={create:Ne},He={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function We(e){return function t(){for(var r=this,n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return o.length>=e.length?e.apply(this,o):function(){for(var c=arguments.length,s=new Array(c),f=0;f<c;f++)s[f]=arguments[f];return t.apply(r,[].concat(o,s))}}}function Be(e){return{}.toString.call(e).includes("Object")}function Ke(e){return e||ue("configIsRequired"),Be(e)||ue("configType"),e.urls?(Ge(),{paths:{vs:e.urls.monacoBase}}):e}function Ge(){console.warn(ce.deprecation)}function Ye(e,t){throw new Error(e[t]||e.default)}var ce={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
3
3
  You are using deprecated way of configuration.
4
4
 
@@ -1 +1 @@
1
- import{c as z,D as ke,k as Re,m as Ue,d as Ne,K as De,r as P,l as K,j as s,B as ve,i as Pe}from"./index-DoMiY5Rl.js";import{A as ue}from"./avatar-Bgx8CG81.js";import{B as _e}from"./badge-BPXHmusI.js";import{i as Ke,n as Fe}from"./Loading02-tznIx2K-.js";import{i as Qe}from"./List-q5qxU0Zg.js";import{s as qe}from"./Plus-BqPAYR_l.js";import{u as Ae}from"./use-members-B6SgYKEo.js";import{u as Be}from"./studio-tools-BI4K6zAK.js";import{f as Ee}from"./format-time-Cy7tTmZp.js";import{i as Ge}from"./AlertCircle-ByjwYeir.js";import{i as Ye}from"./CheckCircle-CilSrYvs.js";import{i as He}from"./Circle-Db6Vd1uq.js";import{s as Je}from"./Eye-kqhgK17A.js";import{d as Ve,e as We,a as Xe}from"./dialog-B9Ck6bim.js";import{b as ye,D as Ce,c as je,a as Se}from"./dropdown-menu-CkHc6C_x.js";import{t as Ie}from"./ChevronDown-OndWepD0.js";import{s as Ze}from"./Trash01-D85FZrUl.js";import{s as et}from"./User01-D0EG03RI.js";import"./use-org-auth-client-CB5xt651.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./X-DAWomg6U.js";import"./Check-0ZdlfWma.js";import"./ChevronRight-knT_Aa4i.js";function tt(){const t=z.c(13),{locator:e}=ke(),o=Be();let l;t[0]!==e?(l=De.taskBoardItems(e),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==o?(a=async()=>(await o.call("TASK_BOARD_ITEM_LIST",{})).items,t[2]=o,t[3]=a):a=t[3];let n;t[4]!==l||t[5]!==a?(n={queryKey:l,queryFn:a},t[4]=l,t[5]=a,t[6]=n):n=t[6];const c=Re(n);let i;t[7]!==c.data?(i=c.data??[],t[7]=c.data,t[8]=i):i=t[8];let r;return t[9]!==c.error||t[10]!==c.isLoading||t[11]!==i?(r={items:i,isLoading:c.isLoading,error:c.error},t[9]=c.error,t[10]=c.isLoading,t[11]=i,t[12]=r):r=t[12],r}function st(){const t=z.c(30),{locator:e}=ke(),o=Be(),l=Ue();let a;t[0]!==e?(a=De.taskBoardItems(e),t[0]=e,t[1]=a):a=t[1];const n=a;let c;t[2]!==l||t[3]!==n?(c=()=>l.invalidateQueries({queryKey:n}),t[2]=l,t[3]=n,t[4]=c):c=t[4];const i=c;let r;t[5]!==o?(r=j=>o.call("TASK_BOARD_ITEM_CREATE",j),t[5]=o,t[6]=r):r=t[6];let u;t[7]!==i||t[8]!==r?(u={mutationFn:r,onSuccess:i},t[7]=i,t[8]=r,t[9]=u):u=t[9];const d=Ne(u);let f;t[10]!==o?(f=j=>o.call("TASK_BOARD_ITEM_UPDATE",j),t[10]=o,t[11]=f):f=t[11];let x,g;t[12]!==l||t[13]!==n?(x=async j=>{await l.cancelQueries({queryKey:n});const A=l.getQueryData(n);return l.setQueryData(n,C=>C?.map(S=>S.id===j.id?{...S,...j}:S)),{previous:A}},g=(j,A,C)=>{C?.previous&&l.setQueryData(n,C.previous)},t[12]=l,t[13]=n,t[14]=x,t[15]=g):(x=t[14],g=t[15]);let m;t[16]!==i||t[17]!==f||t[18]!==x||t[19]!==g?(m={mutationFn:f,onMutate:x,onError:g,onSettled:i},t[16]=i,t[17]=f,t[18]=x,t[19]=g,t[20]=m):m=t[20];const p=Ne(m);let b;t[21]!==o?(b=j=>o.call("TASK_BOARD_ITEM_DELETE",{id:j}),t[21]=o,t[22]=b):b=t[22];let h;t[23]!==i||t[24]!==b?(h={mutationFn:b,onSuccess:i},t[23]=i,t[24]=b,t[25]=h):h=t[25];const y=Ne(h);let I;return t[26]!==d||t[27]!==y||t[28]!==p?(I={create:d,update:p,remove:y},t[26]=d,t[27]=y,t[28]=p,t[29]=I):I=t[29],I}const lt=["triage","todo","in_progress","in_review","done"],Oe={triage:{label:"Triage",icon:Ge,iconClassName:"text-muted-foreground"},todo:{label:"To Do",icon:He,iconClassName:"text-muted-foreground"},in_progress:{label:"In Progress",icon:Ke,iconClassName:"text-blue-500"},in_review:{label:"In Review",icon:Je,iconClassName:"text-amber-500"},done:{label:"Done",icon:Ye,iconClassName:"text-green-600"}},at=["low","medium","high","urgent"],F={low:{label:"Low",badgeClassName:"bg-muted text-muted-foreground"},medium:{label:"Medium",badgeClassName:"bg-blue-500/10 text-blue-600"},high:{label:"High",badgeClassName:"bg-orange-500/10 text-orange-600"},urgent:{label:"Urgent",badgeClassName:"bg-red-500/10 text-red-600"}};function Te(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ot(t){const e=z.c(87),{open:o,onClose:l,item:a,onSubmit:n,onDelete:c,isSaving:i}=t,{data:r}=Ae(),u=r?.data?.members??[],[d,f]=P.useState(a?.title??""),[x,g]=P.useState(a?.description??""),[m,p]=P.useState(a?.priority??"medium"),[b,h]=P.useState(a?.assigneeId??null);let y;e[0]!==a?.assigneeId||e[1]!==a?.description||e[2]!==a?.priority||e[3]!==a?.title||e[4]!==h?(y=()=>{f(a?.title??""),g(a?.description??""),p(a?.priority??"medium"),h(a?.assigneeId??null)},e[0]=a?.assigneeId,e[1]=a?.description,e[2]=a?.priority,e[3]=a?.title,e[4]=h,e[5]=y):y=e[5];const I=y;let j;e[6]!==l||e[7]!==I?(j=()=>{l(),I()},e[6]=l,e[7]=I,e[8]=j):j=e[8];const A=j;let C;e[9]!==b||e[10]!==x||e[11]!==n||e[12]!==m||e[13]!==d?(C=()=>{const v=d.trim();v&&n({title:v,description:x.trim()||null,priority:m,assigneeId:b})},e[9]=b,e[10]=x,e[11]=n,e[12]=m,e[13]=d,e[14]=C):C=e[14];const S=C;let L;e[15]!==b?(L=v=>v.userId===b,e[15]=b,e[16]=L):L=e[16];const $=u.find(L),B=We;let T;e[17]!==A?(T=v=>!v&&A(),e[17]=A,e[18]=T):T=e[18];const E=Ve,M="gap-0 overflow-hidden p-0 sm:max-w-[560px]",ie="hidden",R=a?"Edit task":"New task";let O;e[19]!==R?(O=s.jsx(Xe,{className:"sr-only",children:R}),e[19]=R,e[20]=O):O=e[20];let U;e[21]===Symbol.for("react.memo_cache_sentinel")?(U=v=>f(v.target.value),e[21]=U):U=e[21];let w;e[22]!==d?(w=s.jsx("input",{value:d,onChange:U,placeholder:"Task title",autoFocus:!0,className:"w-full border-0 bg-transparent text-base font-medium text-foreground outline-none placeholder:text-muted-foreground/70"}),e[22]=d,e[23]=w):w=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=v=>g(v.target.value),e[24]=D):D=e[24];let k;e[25]!==x?(k=s.jsx("textarea",{value:x,onChange:D,placeholder:"Add a description…",className:"min-h-[96px] w-full resize-none border-0 bg-transparent text-sm leading-relaxed text-foreground outline-none placeholder:text-muted-foreground/70"}),e[25]=x,e[26]=k):k=e[26];let _;e[27]!==w||e[28]!==k?(_=s.jsxs("div",{className:"flex flex-col gap-3 px-4 pt-4",children:[w,k]}),e[27]=w,e[28]=k,e[29]=_):_=e[29];const N="flex items-center gap-2 border-t border-border px-4 py-3",ne=F[m];let Q;e[30]!==ne.badgeClassName?(Q=K("size-2 rounded-full",ne.badgeClassName),e[30]=ne.badgeClassName,e[31]=Q):Q=e[31];let q;e[32]!==Q?(q=s.jsx("span",{className:Q}),e[32]=Q,e[33]=q):q=e[33];const fe=F[m];let re;e[34]===Symbol.for("react.memo_cache_sentinel")?(re=s.jsx(Ie,{size:12,className:"text-muted-foreground"}),e[34]=re):re=e[34];let G;e[35]!==q||e[36]!==fe.label?(G=s.jsx(ye,{asChild:!0,children:s.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted",children:[q,fe.label,re]})}),e[35]=q,e[36]=fe.label,e[37]=G):G=e[37];let ce;e[38]===Symbol.for("react.memo_cache_sentinel")?(ce=s.jsx(Ce,{align:"start",className:"w-40",children:at.map(v=>s.jsx(je,{onSelect:()=>p(v),children:F[v].label},v))}),e[38]=ce):ce=e[38];let Y;e[39]!==G?(Y=s.jsxs(Se,{children:[G,ce]}),e[39]=G,e[40]=Y):Y=e[40];const xe=Se,ge=ye,ze=!0,Le="button",Me="inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted",pe=$?s.jsx(ue,{url:$.user?.image??void 0,fallback:Te($.user?.name),shape:"circle",size:"2xs"}):s.jsx(et,{size:13,className:"text-muted-foreground"}),be=$?.user?.name??"Unassigned";let de;e[41]===Symbol.for("react.memo_cache_sentinel")?(de=s.jsx(Ie,{size:12,className:"text-muted-foreground"}),e[41]=de):de=e[41];let H;e[42]!==pe||e[43]!==be?(H=s.jsxs("button",{type:Le,className:Me,children:[pe,be,de]}),e[42]=pe,e[43]=be,e[44]=H):H=e[44];let J;e[45]!==ge||e[46]!==H?(J=s.jsx(ge,{asChild:ze,children:H}),e[45]=ge,e[46]=H,e[47]=J):J=e[47];let V;e[48]!==h?(V=s.jsx(je,{onSelect:()=>h(null),children:"Unassigned"}),e[48]=h,e[49]=V):V=e[49];let W;if(e[50]!==u||e[51]!==h){let v;e[53]!==h?(v=oe=>s.jsxs(je,{onSelect:()=>h(oe.userId),className:"gap-2",children:[s.jsx(ue,{url:oe.user?.image??void 0,fallback:Te(oe.user?.name),shape:"circle",size:"2xs"}),s.jsx("span",{className:"truncate",children:oe.user?.name??oe.userId})]},oe.userId),e[53]=h,e[54]=v):v=e[54],W=u.map(v),e[50]=u,e[51]=h,e[52]=W}else W=e[52];let X;e[55]!==V||e[56]!==W?(X=s.jsxs(Ce,{align:"start",className:"w-56",children:[V,W]}),e[55]=V,e[56]=W,e[57]=X):X=e[57];let Z;e[58]!==xe||e[59]!==J||e[60]!==X?(Z=s.jsxs(xe,{children:[J,X]}),e[58]=xe,e[59]=J,e[60]=X,e[61]=Z):Z=e[61];let ee;e[62]!==a||e[63]!==c?(ee=a&&c&&s.jsx(ve,{variant:"ghost",size:"icon","aria-label":"Delete task",className:"ml-0 text-muted-foreground hover:text-destructive",onClick:c,children:s.jsx(Ze,{size:14})}),e[62]=a,e[63]=c,e[64]=ee):ee=e[64];let te;e[65]!==i||e[66]!==d?(te=!d.trim()||i,e[65]=i,e[66]=d,e[67]=te):te=e[67];const he=a?"Save":"Create task";let se;e[68]!==S||e[69]!==te||e[70]!==he?(se=s.jsx(ve,{size:"sm",className:"ml-auto",disabled:te,onClick:S,children:he}),e[68]=S,e[69]=te,e[70]=he,e[71]=se):se=e[71];let le;e[72]!==Y||e[73]!==Z||e[74]!==ee||e[75]!==se?(le=s.jsxs("div",{className:N,children:[Y,Z,ee,se]}),e[72]=Y,e[73]=Z,e[74]=ee,e[75]=se,e[76]=le):le=e[76];let ae;e[77]!==E||e[78]!==_||e[79]!==le||e[80]!==O?(ae=s.jsxs(E,{className:M,closeButtonClassName:ie,children:[O,_,le]}),e[77]=E,e[78]=_,e[79]=le,e[80]=O,e[81]=ae):ae=e[81];let me;return e[82]!==B||e[83]!==o||e[84]!==ae||e[85]!==T?(me=s.jsx(B,{open:o,onOpenChange:T,children:ae}),e[82]=B,e[83]=o,e[84]=ae,e[85]=T,e[86]=me):me=e[86],me}function Ot(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:s.jsx("div",{className:"h-full p-0.5 pt-0.25",children:s.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:s.jsx(it,{})})})}),t[0]=e):e=t[0],e}function $e(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function it(){const t=z.c(45),{items:e,isLoading:o}=tt(),l=st(),{data:a}=Ae();let n;if(t[0]!==a?.data?.members){const N=a?.data?.members??[];n=new Map(N.map(nt)),t[0]=a?.data?.members,t[1]=n}else n=t[1];const c=n,[i,r]=P.useState("board"),[u,d]=P.useState(!1),[f,x]=P.useState(null);let g;t[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{x(null),d(!0)},t[2]=g):g=t[2];const m=g;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{x(N),d(!0)},t[3]=p):p=t[3];const b=p;if(o&&e.length===0){let N;return t[4]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(Pe,{size:20,className:"animate-spin text-muted-foreground"})}),t[4]=N):N=t[4],N}const h=i==="board"?"max-w-[1400px]":"max-w-[900px]";let y;t[5]!==h?(y=K("mx-auto flex w-full flex-col gap-6 px-10 pt-10 pb-16",h),t[5]=h,t[6]=y):y=t[6];let I;t[7]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("h1",{className:"text-xl font-medium text-foreground",children:"Board"}),t[7]=I):I=t[7];let j;t[8]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs(ve,{size:"sm",onClick:m,children:[s.jsx(qe,{size:16}),"New task"]}),t[8]=j):j=t[8];const A=i==="list";let C;t[9]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r("list"),t[9]=C):C=t[9];let S;t[10]!==A?(S=s.jsx(we,{active:A,onClick:C,icon:Qe,label:"List"}),t[10]=A,t[11]=S):S=t[11];const L=i==="board";let $;t[12]===Symbol.for("react.memo_cache_sentinel")?($=()=>r("board"),t[12]=$):$=t[12];let B;t[13]!==L?(B=s.jsx(we,{active:L,onClick:$,icon:Fe,label:"Board"}),t[13]=L,t[14]=B):B=t[14];let T;t[15]!==B||t[16]!==S?(T=s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,s.jsxs("div",{className:"ml-auto inline-flex rounded-lg bg-muted p-0.5",children:[S,B]})]}),t[15]=B,t[16]=S,t[17]=T):T=t[17];let E;t[18]!==l.update||t[19]!==e||t[20]!==i||t[21]!==c?(E=e.length===0?s.jsx("div",{className:"rounded-xl border border-border bg-card px-4 py-12 text-center text-sm text-muted-foreground",children:"No tasks yet. Start one with New task."}):i==="board"?s.jsx(rt,{items:e,memberByUserId:c,onOpen:b,onMove:(N,ne)=>l.update.mutate({id:N,status:ne})}):s.jsx("div",{className:"flex flex-col gap-2",children:e.map(N=>s.jsx(dt,{item:N,assignee:N.assigneeId?c.get(N.assigneeId):void 0,onOpen:()=>b(N)},N.id))}),t[18]=l.update,t[19]=e,t[20]=i,t[21]=c,t[22]=E):E=t[22];let M;t[23]!==T||t[24]!==E||t[25]!==y?(M=s.jsxs("div",{className:y,children:[I,T,E]}),t[23]=T,t[24]=E,t[25]=y,t[26]=M):M=t[26];const ie=u?f?.id??"new":"closed";let R;t[27]===Symbol.for("react.memo_cache_sentinel")?(R=()=>d(!1),t[27]=R):R=t[27];const O=f??void 0,U=l.create.isPending||l.update.isPending;let w;t[28]!==l.create||t[29]!==l.update||t[30]!==f?(w=N=>{f?l.update.mutate({id:f.id,...N}):l.create.mutate(N),d(!1)},t[28]=l.create,t[29]=l.update,t[30]=f,t[31]=w):w=t[31];let D;t[32]!==l.remove||t[33]!==f?(D=f?()=>{l.remove.mutate(f.id),d(!1)}:void 0,t[32]=l.remove,t[33]=f,t[34]=D):D=t[34];let k;t[35]!==u||t[36]!==ie||t[37]!==O||t[38]!==U||t[39]!==w||t[40]!==D?(k=s.jsx(ot,{open:u,onClose:R,item:O,isSaving:U,onSubmit:w,onDelete:D},ie),t[35]=u,t[36]=ie,t[37]=O,t[38]=U,t[39]=w,t[40]=D,t[41]=k):k=t[41];let _;return t[42]!==M||t[43]!==k?(_=s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[M,k]}),t[42]=M,t[43]=k,t[44]=_):_=t[44],_}function nt(t){return[t.userId,t]}function we(t){const e=z.c(11),{active:o,onClick:l,icon:a,label:n}=t,c=`${n} view`,i=o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground";let r;e[0]!==i?(r=K("flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",i),e[0]=i,e[1]=r):r=e[1];let u;e[2]!==a?(u=s.jsx(a,{size:14}),e[2]=a,e[3]=u):u=e[3];let d;return e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c||e[8]!==r||e[9]!==u?(d=s.jsxs("button",{type:"button",onClick:l,"aria-label":c,"aria-pressed":o,className:r,children:[u,n]}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=r,e[9]=u,e[10]=d):d=e[10],d}function rt(t){const e=z.c(8),{items:o,memberByUserId:l,onOpen:a,onMove:n}=t,[c,i]=P.useState(null);let r;e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==a||e[4]!==c?(r=lt.map(d=>{const f=o.filter(m=>m.status===d),x=Oe[d],g=x.icon;return s.jsxs("div",{onDragOver:m=>{m.preventDefault(),i(d)},onDragLeave:m=>{m.currentTarget.contains(m.relatedTarget)||i(null)},onDrop:m=>{m.preventDefault();const p=m.dataTransfer.getData("text/plain");p&&n(p,d),i(null)},className:K("flex flex-col rounded-xl p-1 transition-colors",c===d&&"bg-muted/50"),children:[s.jsxs("div",{className:"flex items-center gap-2 p-2",children:[s.jsx(g,{size:14,className:K("shrink-0",x.iconClassName)}),s.jsx("span",{className:"text-xs text-foreground",children:x.label}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:f.length})]}),s.jsx("div",{className:"flex min-h-12 flex-col gap-2",children:f.map(m=>s.jsx(ct,{item:m,assignee:m.assigneeId?l.get(m.assigneeId):void 0,onOpen:()=>a(m)},m.id))})]},d)}),e[0]=o,e[1]=l,e[2]=n,e[3]=a,e[4]=c,e[5]=r):r=e[5];let u;return e[6]!==r?(u=s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5",children:r}),e[6]=r,e[7]=u):u=e[7],u}function ct(t){const e=z.c(26),{item:o,assignee:l,onOpen:a}=t;let n;e[0]!==o.id?(n=h=>{h.dataTransfer.setData("text/plain",o.id),h.dataTransfer.effectAllowed="move"},e[0]=o.id,e[1]=n):n=e[1];let c;e[2]!==o.title?(c=s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium leading-snug text-foreground",children:o.title}),e[2]=o.title,e[3]=c):c=e[3];let i;e[4]!==l?(i=l&&s.jsx(ue,{url:l.user?.image??void 0,fallback:$e(l.user?.name),shape:"circle",size:"2xs"}),e[4]=l,e[5]=i):i=e[5];let r;e[6]!==c||e[7]!==i?(r=s.jsxs("div",{className:"flex items-start gap-2",children:[c,i]}),e[6]=c,e[7]=i,e[8]=r):r=e[8];const u=F[o.priority];let d;e[9]!==u.badgeClassName?(d=K("text-[10px]",u.badgeClassName),e[9]=u.badgeClassName,e[10]=d):d=e[10];const f=F[o.priority];let x;e[11]!==d||e[12]!==f.label?(x=s.jsx(_e,{className:d,children:f.label}),e[11]=d,e[12]=f.label,e[13]=x):x=e[13];let g;e[14]!==o.createdAt?(g=Ee(new Date(o.createdAt)),e[14]=o.createdAt,e[15]=g):g=e[15];let m;e[16]!==g?(m=s.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:g}),e[16]=g,e[17]=m):m=e[17];let p;e[18]!==m||e[19]!==x?(p=s.jsxs("div",{className:"flex items-center gap-2",children:[x,m]}),e[18]=m,e[19]=x,e[20]=p):p=e[20];let b;return e[21]!==a||e[22]!==n||e[23]!==p||e[24]!==r?(b=s.jsxs("button",{type:"button",draggable:!0,onDragStart:n,onClick:a,className:"flex cursor-grab flex-col gap-3 rounded-[10px] border border-border bg-card px-3.5 py-3 text-left transition-colors hover:border-ring/40 active:cursor-grabbing",children:[r,p]}),e[21]=a,e[22]=n,e[23]=p,e[24]=r,e[25]=b):b=e[25],b}function dt(t){const e=z.c(25),{item:o,assignee:l,onOpen:a}=t,n=Oe[o.status],c=n.icon;let i;e[0]!==n.iconClassName?(i=K("shrink-0",n.iconClassName),e[0]=n.iconClassName,e[1]=i):i=e[1];let r;e[2]!==c||e[3]!==i?(r=s.jsx(c,{size:15,className:i}),e[2]=c,e[3]=i,e[4]=r):r=e[4];let u;e[5]!==o.title?(u=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:o.title}),e[5]=o.title,e[6]=u):u=e[6];const d=F[o.priority];let f;e[7]!==d.badgeClassName?(f=K("shrink-0 text-[10px]",d.badgeClassName),e[7]=d.badgeClassName,e[8]=f):f=e[8];const x=F[o.priority];let g;e[9]!==f||e[10]!==x.label?(g=s.jsx(_e,{className:f,children:x.label}),e[9]=f,e[10]=x.label,e[11]=g):g=e[11];let m;e[12]!==l?(m=l&&s.jsx(ue,{url:l.user?.image??void 0,fallback:$e(l.user?.name),shape:"circle",size:"2xs"}),e[12]=l,e[13]=m):m=e[13];let p;e[14]!==o.createdAt?(p=Ee(new Date(o.createdAt)),e[14]=o.createdAt,e[15]=p):p=e[15];let b;e[16]!==p?(b=s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground/70",children:p}),e[16]=p,e[17]=b):b=e[17];let h;return e[18]!==a||e[19]!==b||e[20]!==r||e[21]!==u||e[22]!==g||e[23]!==m?(h=s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 text-left transition-colors hover:border-ring/40",children:[r,u,g,m,b]}),e[18]=a,e[19]=b,e[20]=r,e[21]=u,e[22]=g,e[23]=m,e[24]=h):h=e[24],h}export{Ot as default};
1
+ import{c as z,D as ke,k as Re,m as Ue,d as Ne,K as De,r as P,l as K,j as s,B as ve,i as Pe}from"./index-DSDpj2Bj.js";import{A as ue}from"./avatar-G4lfZ1rm.js";import{B as _e}from"./badge-D16FSQ-g.js";import{i as Ke,n as Fe}from"./Loading02-D0nMaQOZ.js";import{i as Qe}from"./List-DuUlr1m8.js";import{s as qe}from"./Plus-C4Q0OOCY.js";import{u as Ae}from"./use-members-CRaQbprX.js";import{u as Be}from"./studio-tools-Ch4cqriC.js";import{f as Ee}from"./format-time-Cy7tTmZp.js";import{i as Ge}from"./AlertCircle-bPFs3KEL.js";import{i as Ye}from"./CheckCircle-C3XWnj4j.js";import{i as He}from"./Circle-qJ5BBlYd.js";import{s as Je}from"./Eye-DF9e8dvr.js";import{d as Ve,e as We,a as Xe}from"./dialog-Bnj4VVJm.js";import{b as ye,D as Ce,c as je,a as Se}from"./dropdown-menu-BKlRxK5y.js";import{t as Ie}from"./ChevronDown--CNgLcjC.js";import{s as Ze}from"./Trash01-DquY3ri8.js";import{s as et}from"./User01-Cob64tHg.js";import"./use-org-auth-client-D8NgRY-r.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./X-D42jewIw.js";import"./Check-DgZ3In7m.js";import"./ChevronRight-BWbK6ynD.js";function tt(){const t=z.c(13),{locator:e}=ke(),o=Be();let l;t[0]!==e?(l=De.taskBoardItems(e),t[0]=e,t[1]=l):l=t[1];let a;t[2]!==o?(a=async()=>(await o.call("TASK_BOARD_ITEM_LIST",{})).items,t[2]=o,t[3]=a):a=t[3];let n;t[4]!==l||t[5]!==a?(n={queryKey:l,queryFn:a},t[4]=l,t[5]=a,t[6]=n):n=t[6];const c=Re(n);let i;t[7]!==c.data?(i=c.data??[],t[7]=c.data,t[8]=i):i=t[8];let r;return t[9]!==c.error||t[10]!==c.isLoading||t[11]!==i?(r={items:i,isLoading:c.isLoading,error:c.error},t[9]=c.error,t[10]=c.isLoading,t[11]=i,t[12]=r):r=t[12],r}function st(){const t=z.c(30),{locator:e}=ke(),o=Be(),l=Ue();let a;t[0]!==e?(a=De.taskBoardItems(e),t[0]=e,t[1]=a):a=t[1];const n=a;let c;t[2]!==l||t[3]!==n?(c=()=>l.invalidateQueries({queryKey:n}),t[2]=l,t[3]=n,t[4]=c):c=t[4];const i=c;let r;t[5]!==o?(r=j=>o.call("TASK_BOARD_ITEM_CREATE",j),t[5]=o,t[6]=r):r=t[6];let u;t[7]!==i||t[8]!==r?(u={mutationFn:r,onSuccess:i},t[7]=i,t[8]=r,t[9]=u):u=t[9];const d=Ne(u);let f;t[10]!==o?(f=j=>o.call("TASK_BOARD_ITEM_UPDATE",j),t[10]=o,t[11]=f):f=t[11];let x,g;t[12]!==l||t[13]!==n?(x=async j=>{await l.cancelQueries({queryKey:n});const A=l.getQueryData(n);return l.setQueryData(n,C=>C?.map(S=>S.id===j.id?{...S,...j}:S)),{previous:A}},g=(j,A,C)=>{C?.previous&&l.setQueryData(n,C.previous)},t[12]=l,t[13]=n,t[14]=x,t[15]=g):(x=t[14],g=t[15]);let m;t[16]!==i||t[17]!==f||t[18]!==x||t[19]!==g?(m={mutationFn:f,onMutate:x,onError:g,onSettled:i},t[16]=i,t[17]=f,t[18]=x,t[19]=g,t[20]=m):m=t[20];const p=Ne(m);let b;t[21]!==o?(b=j=>o.call("TASK_BOARD_ITEM_DELETE",{id:j}),t[21]=o,t[22]=b):b=t[22];let h;t[23]!==i||t[24]!==b?(h={mutationFn:b,onSuccess:i},t[23]=i,t[24]=b,t[25]=h):h=t[25];const y=Ne(h);let I;return t[26]!==d||t[27]!==y||t[28]!==p?(I={create:d,update:p,remove:y},t[26]=d,t[27]=y,t[28]=p,t[29]=I):I=t[29],I}const lt=["triage","todo","in_progress","in_review","done"],Oe={triage:{label:"Triage",icon:Ge,iconClassName:"text-muted-foreground"},todo:{label:"To Do",icon:He,iconClassName:"text-muted-foreground"},in_progress:{label:"In Progress",icon:Ke,iconClassName:"text-blue-500"},in_review:{label:"In Review",icon:Je,iconClassName:"text-amber-500"},done:{label:"Done",icon:Ye,iconClassName:"text-green-600"}},at=["low","medium","high","urgent"],F={low:{label:"Low",badgeClassName:"bg-muted text-muted-foreground"},medium:{label:"Medium",badgeClassName:"bg-blue-500/10 text-blue-600"},high:{label:"High",badgeClassName:"bg-orange-500/10 text-orange-600"},urgent:{label:"Urgent",badgeClassName:"bg-red-500/10 text-red-600"}};function Te(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function ot(t){const e=z.c(87),{open:o,onClose:l,item:a,onSubmit:n,onDelete:c,isSaving:i}=t,{data:r}=Ae(),u=r?.data?.members??[],[d,f]=P.useState(a?.title??""),[x,g]=P.useState(a?.description??""),[m,p]=P.useState(a?.priority??"medium"),[b,h]=P.useState(a?.assigneeId??null);let y;e[0]!==a?.assigneeId||e[1]!==a?.description||e[2]!==a?.priority||e[3]!==a?.title||e[4]!==h?(y=()=>{f(a?.title??""),g(a?.description??""),p(a?.priority??"medium"),h(a?.assigneeId??null)},e[0]=a?.assigneeId,e[1]=a?.description,e[2]=a?.priority,e[3]=a?.title,e[4]=h,e[5]=y):y=e[5];const I=y;let j;e[6]!==l||e[7]!==I?(j=()=>{l(),I()},e[6]=l,e[7]=I,e[8]=j):j=e[8];const A=j;let C;e[9]!==b||e[10]!==x||e[11]!==n||e[12]!==m||e[13]!==d?(C=()=>{const v=d.trim();v&&n({title:v,description:x.trim()||null,priority:m,assigneeId:b})},e[9]=b,e[10]=x,e[11]=n,e[12]=m,e[13]=d,e[14]=C):C=e[14];const S=C;let L;e[15]!==b?(L=v=>v.userId===b,e[15]=b,e[16]=L):L=e[16];const $=u.find(L),B=We;let T;e[17]!==A?(T=v=>!v&&A(),e[17]=A,e[18]=T):T=e[18];const E=Ve,M="gap-0 overflow-hidden p-0 sm:max-w-[560px]",ie="hidden",R=a?"Edit task":"New task";let O;e[19]!==R?(O=s.jsx(Xe,{className:"sr-only",children:R}),e[19]=R,e[20]=O):O=e[20];let U;e[21]===Symbol.for("react.memo_cache_sentinel")?(U=v=>f(v.target.value),e[21]=U):U=e[21];let w;e[22]!==d?(w=s.jsx("input",{value:d,onChange:U,placeholder:"Task title",autoFocus:!0,className:"w-full border-0 bg-transparent text-base font-medium text-foreground outline-none placeholder:text-muted-foreground/70"}),e[22]=d,e[23]=w):w=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=v=>g(v.target.value),e[24]=D):D=e[24];let k;e[25]!==x?(k=s.jsx("textarea",{value:x,onChange:D,placeholder:"Add a description…",className:"min-h-[96px] w-full resize-none border-0 bg-transparent text-sm leading-relaxed text-foreground outline-none placeholder:text-muted-foreground/70"}),e[25]=x,e[26]=k):k=e[26];let _;e[27]!==w||e[28]!==k?(_=s.jsxs("div",{className:"flex flex-col gap-3 px-4 pt-4",children:[w,k]}),e[27]=w,e[28]=k,e[29]=_):_=e[29];const N="flex items-center gap-2 border-t border-border px-4 py-3",ne=F[m];let Q;e[30]!==ne.badgeClassName?(Q=K("size-2 rounded-full",ne.badgeClassName),e[30]=ne.badgeClassName,e[31]=Q):Q=e[31];let q;e[32]!==Q?(q=s.jsx("span",{className:Q}),e[32]=Q,e[33]=q):q=e[33];const fe=F[m];let re;e[34]===Symbol.for("react.memo_cache_sentinel")?(re=s.jsx(Ie,{size:12,className:"text-muted-foreground"}),e[34]=re):re=e[34];let G;e[35]!==q||e[36]!==fe.label?(G=s.jsx(ye,{asChild:!0,children:s.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted",children:[q,fe.label,re]})}),e[35]=q,e[36]=fe.label,e[37]=G):G=e[37];let ce;e[38]===Symbol.for("react.memo_cache_sentinel")?(ce=s.jsx(Ce,{align:"start",className:"w-40",children:at.map(v=>s.jsx(je,{onSelect:()=>p(v),children:F[v].label},v))}),e[38]=ce):ce=e[38];let Y;e[39]!==G?(Y=s.jsxs(Se,{children:[G,ce]}),e[39]=G,e[40]=Y):Y=e[40];const xe=Se,ge=ye,ze=!0,Le="button",Me="inline-flex items-center gap-1.5 rounded-lg border border-border bg-background px-2.5 py-1.5 text-xs text-foreground transition-colors hover:bg-muted",pe=$?s.jsx(ue,{url:$.user?.image??void 0,fallback:Te($.user?.name),shape:"circle",size:"2xs"}):s.jsx(et,{size:13,className:"text-muted-foreground"}),be=$?.user?.name??"Unassigned";let de;e[41]===Symbol.for("react.memo_cache_sentinel")?(de=s.jsx(Ie,{size:12,className:"text-muted-foreground"}),e[41]=de):de=e[41];let H;e[42]!==pe||e[43]!==be?(H=s.jsxs("button",{type:Le,className:Me,children:[pe,be,de]}),e[42]=pe,e[43]=be,e[44]=H):H=e[44];let J;e[45]!==ge||e[46]!==H?(J=s.jsx(ge,{asChild:ze,children:H}),e[45]=ge,e[46]=H,e[47]=J):J=e[47];let V;e[48]!==h?(V=s.jsx(je,{onSelect:()=>h(null),children:"Unassigned"}),e[48]=h,e[49]=V):V=e[49];let W;if(e[50]!==u||e[51]!==h){let v;e[53]!==h?(v=oe=>s.jsxs(je,{onSelect:()=>h(oe.userId),className:"gap-2",children:[s.jsx(ue,{url:oe.user?.image??void 0,fallback:Te(oe.user?.name),shape:"circle",size:"2xs"}),s.jsx("span",{className:"truncate",children:oe.user?.name??oe.userId})]},oe.userId),e[53]=h,e[54]=v):v=e[54],W=u.map(v),e[50]=u,e[51]=h,e[52]=W}else W=e[52];let X;e[55]!==V||e[56]!==W?(X=s.jsxs(Ce,{align:"start",className:"w-56",children:[V,W]}),e[55]=V,e[56]=W,e[57]=X):X=e[57];let Z;e[58]!==xe||e[59]!==J||e[60]!==X?(Z=s.jsxs(xe,{children:[J,X]}),e[58]=xe,e[59]=J,e[60]=X,e[61]=Z):Z=e[61];let ee;e[62]!==a||e[63]!==c?(ee=a&&c&&s.jsx(ve,{variant:"ghost",size:"icon","aria-label":"Delete task",className:"ml-0 text-muted-foreground hover:text-destructive",onClick:c,children:s.jsx(Ze,{size:14})}),e[62]=a,e[63]=c,e[64]=ee):ee=e[64];let te;e[65]!==i||e[66]!==d?(te=!d.trim()||i,e[65]=i,e[66]=d,e[67]=te):te=e[67];const he=a?"Save":"Create task";let se;e[68]!==S||e[69]!==te||e[70]!==he?(se=s.jsx(ve,{size:"sm",className:"ml-auto",disabled:te,onClick:S,children:he}),e[68]=S,e[69]=te,e[70]=he,e[71]=se):se=e[71];let le;e[72]!==Y||e[73]!==Z||e[74]!==ee||e[75]!==se?(le=s.jsxs("div",{className:N,children:[Y,Z,ee,se]}),e[72]=Y,e[73]=Z,e[74]=ee,e[75]=se,e[76]=le):le=e[76];let ae;e[77]!==E||e[78]!==_||e[79]!==le||e[80]!==O?(ae=s.jsxs(E,{className:M,closeButtonClassName:ie,children:[O,_,le]}),e[77]=E,e[78]=_,e[79]=le,e[80]=O,e[81]=ae):ae=e[81];let me;return e[82]!==B||e[83]!==o||e[84]!==ae||e[85]!==T?(me=s.jsx(B,{open:o,onOpenChange:T,children:ae}),e[82]=B,e[83]=o,e[84]=ae,e[85]=T,e[86]=me):me=e[86],me}function Ot(){const t=z.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"min-h-0 flex-1 pt-0 pr-1 pb-1 pl-0",children:s.jsx("div",{className:"h-full p-0.5 pt-0.25",children:s.jsx("div",{className:"card-shadow flex h-full flex-col overflow-hidden rounded-[0.75rem] bg-background",children:s.jsx(it,{})})})}),t[0]=e):e=t[0],e}function $e(t){return t?t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}function it(){const t=z.c(45),{items:e,isLoading:o}=tt(),l=st(),{data:a}=Ae();let n;if(t[0]!==a?.data?.members){const N=a?.data?.members??[];n=new Map(N.map(nt)),t[0]=a?.data?.members,t[1]=n}else n=t[1];const c=n,[i,r]=P.useState("board"),[u,d]=P.useState(!1),[f,x]=P.useState(null);let g;t[2]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{x(null),d(!0)},t[2]=g):g=t[2];const m=g;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=N=>{x(N),d(!0)},t[3]=p):p=t[3];const b=p;if(o&&e.length===0){let N;return t[4]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(Pe,{size:20,className:"animate-spin text-muted-foreground"})}),t[4]=N):N=t[4],N}const h=i==="board"?"max-w-[1400px]":"max-w-[900px]";let y;t[5]!==h?(y=K("mx-auto flex w-full flex-col gap-6 px-10 pt-10 pb-16",h),t[5]=h,t[6]=y):y=t[6];let I;t[7]===Symbol.for("react.memo_cache_sentinel")?(I=s.jsx("h1",{className:"text-xl font-medium text-foreground",children:"Board"}),t[7]=I):I=t[7];let j;t[8]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs(ve,{size:"sm",onClick:m,children:[s.jsx(qe,{size:16}),"New task"]}),t[8]=j):j=t[8];const A=i==="list";let C;t[9]===Symbol.for("react.memo_cache_sentinel")?(C=()=>r("list"),t[9]=C):C=t[9];let S;t[10]!==A?(S=s.jsx(we,{active:A,onClick:C,icon:Qe,label:"List"}),t[10]=A,t[11]=S):S=t[11];const L=i==="board";let $;t[12]===Symbol.for("react.memo_cache_sentinel")?($=()=>r("board"),t[12]=$):$=t[12];let B;t[13]!==L?(B=s.jsx(we,{active:L,onClick:$,icon:Fe,label:"Board"}),t[13]=L,t[14]=B):B=t[14];let T;t[15]!==B||t[16]!==S?(T=s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[j,s.jsxs("div",{className:"ml-auto inline-flex rounded-lg bg-muted p-0.5",children:[S,B]})]}),t[15]=B,t[16]=S,t[17]=T):T=t[17];let E;t[18]!==l.update||t[19]!==e||t[20]!==i||t[21]!==c?(E=e.length===0?s.jsx("div",{className:"rounded-xl border border-border bg-card px-4 py-12 text-center text-sm text-muted-foreground",children:"No tasks yet. Start one with New task."}):i==="board"?s.jsx(rt,{items:e,memberByUserId:c,onOpen:b,onMove:(N,ne)=>l.update.mutate({id:N,status:ne})}):s.jsx("div",{className:"flex flex-col gap-2",children:e.map(N=>s.jsx(dt,{item:N,assignee:N.assigneeId?c.get(N.assigneeId):void 0,onOpen:()=>b(N)},N.id))}),t[18]=l.update,t[19]=e,t[20]=i,t[21]=c,t[22]=E):E=t[22];let M;t[23]!==T||t[24]!==E||t[25]!==y?(M=s.jsxs("div",{className:y,children:[I,T,E]}),t[23]=T,t[24]=E,t[25]=y,t[26]=M):M=t[26];const ie=u?f?.id??"new":"closed";let R;t[27]===Symbol.for("react.memo_cache_sentinel")?(R=()=>d(!1),t[27]=R):R=t[27];const O=f??void 0,U=l.create.isPending||l.update.isPending;let w;t[28]!==l.create||t[29]!==l.update||t[30]!==f?(w=N=>{f?l.update.mutate({id:f.id,...N}):l.create.mutate(N),d(!1)},t[28]=l.create,t[29]=l.update,t[30]=f,t[31]=w):w=t[31];let D;t[32]!==l.remove||t[33]!==f?(D=f?()=>{l.remove.mutate(f.id),d(!1)}:void 0,t[32]=l.remove,t[33]=f,t[34]=D):D=t[34];let k;t[35]!==u||t[36]!==ie||t[37]!==O||t[38]!==U||t[39]!==w||t[40]!==D?(k=s.jsx(ot,{open:u,onClose:R,item:O,isSaving:U,onSubmit:w,onDelete:D},ie),t[35]=u,t[36]=ie,t[37]=O,t[38]=U,t[39]=w,t[40]=D,t[41]=k):k=t[41];let _;return t[42]!==M||t[43]!==k?(_=s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[M,k]}),t[42]=M,t[43]=k,t[44]=_):_=t[44],_}function nt(t){return[t.userId,t]}function we(t){const e=z.c(11),{active:o,onClick:l,icon:a,label:n}=t,c=`${n} view`,i=o?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground";let r;e[0]!==i?(r=K("flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium transition-colors",i),e[0]=i,e[1]=r):r=e[1];let u;e[2]!==a?(u=s.jsx(a,{size:14}),e[2]=a,e[3]=u):u=e[3];let d;return e[4]!==o||e[5]!==n||e[6]!==l||e[7]!==c||e[8]!==r||e[9]!==u?(d=s.jsxs("button",{type:"button",onClick:l,"aria-label":c,"aria-pressed":o,className:r,children:[u,n]}),e[4]=o,e[5]=n,e[6]=l,e[7]=c,e[8]=r,e[9]=u,e[10]=d):d=e[10],d}function rt(t){const e=z.c(8),{items:o,memberByUserId:l,onOpen:a,onMove:n}=t,[c,i]=P.useState(null);let r;e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==a||e[4]!==c?(r=lt.map(d=>{const f=o.filter(m=>m.status===d),x=Oe[d],g=x.icon;return s.jsxs("div",{onDragOver:m=>{m.preventDefault(),i(d)},onDragLeave:m=>{m.currentTarget.contains(m.relatedTarget)||i(null)},onDrop:m=>{m.preventDefault();const p=m.dataTransfer.getData("text/plain");p&&n(p,d),i(null)},className:K("flex flex-col rounded-xl p-1 transition-colors",c===d&&"bg-muted/50"),children:[s.jsxs("div",{className:"flex items-center gap-2 p-2",children:[s.jsx(g,{size:14,className:K("shrink-0",x.iconClassName)}),s.jsx("span",{className:"text-xs text-foreground",children:x.label}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:f.length})]}),s.jsx("div",{className:"flex min-h-12 flex-col gap-2",children:f.map(m=>s.jsx(ct,{item:m,assignee:m.assigneeId?l.get(m.assigneeId):void 0,onOpen:()=>a(m)},m.id))})]},d)}),e[0]=o,e[1]=l,e[2]=n,e[3]=a,e[4]=c,e[5]=r):r=e[5];let u;return e[6]!==r?(u=s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5",children:r}),e[6]=r,e[7]=u):u=e[7],u}function ct(t){const e=z.c(26),{item:o,assignee:l,onOpen:a}=t;let n;e[0]!==o.id?(n=h=>{h.dataTransfer.setData("text/plain",o.id),h.dataTransfer.effectAllowed="move"},e[0]=o.id,e[1]=n):n=e[1];let c;e[2]!==o.title?(c=s.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium leading-snug text-foreground",children:o.title}),e[2]=o.title,e[3]=c):c=e[3];let i;e[4]!==l?(i=l&&s.jsx(ue,{url:l.user?.image??void 0,fallback:$e(l.user?.name),shape:"circle",size:"2xs"}),e[4]=l,e[5]=i):i=e[5];let r;e[6]!==c||e[7]!==i?(r=s.jsxs("div",{className:"flex items-start gap-2",children:[c,i]}),e[6]=c,e[7]=i,e[8]=r):r=e[8];const u=F[o.priority];let d;e[9]!==u.badgeClassName?(d=K("text-[10px]",u.badgeClassName),e[9]=u.badgeClassName,e[10]=d):d=e[10];const f=F[o.priority];let x;e[11]!==d||e[12]!==f.label?(x=s.jsx(_e,{className:d,children:f.label}),e[11]=d,e[12]=f.label,e[13]=x):x=e[13];let g;e[14]!==o.createdAt?(g=Ee(new Date(o.createdAt)),e[14]=o.createdAt,e[15]=g):g=e[15];let m;e[16]!==g?(m=s.jsx("span",{className:"text-[11px] text-muted-foreground/70",children:g}),e[16]=g,e[17]=m):m=e[17];let p;e[18]!==m||e[19]!==x?(p=s.jsxs("div",{className:"flex items-center gap-2",children:[x,m]}),e[18]=m,e[19]=x,e[20]=p):p=e[20];let b;return e[21]!==a||e[22]!==n||e[23]!==p||e[24]!==r?(b=s.jsxs("button",{type:"button",draggable:!0,onDragStart:n,onClick:a,className:"flex cursor-grab flex-col gap-3 rounded-[10px] border border-border bg-card px-3.5 py-3 text-left transition-colors hover:border-ring/40 active:cursor-grabbing",children:[r,p]}),e[21]=a,e[22]=n,e[23]=p,e[24]=r,e[25]=b):b=e[25],b}function dt(t){const e=z.c(25),{item:o,assignee:l,onOpen:a}=t,n=Oe[o.status],c=n.icon;let i;e[0]!==n.iconClassName?(i=K("shrink-0",n.iconClassName),e[0]=n.iconClassName,e[1]=i):i=e[1];let r;e[2]!==c||e[3]!==i?(r=s.jsx(c,{size:15,className:i}),e[2]=c,e[3]=i,e[4]=r):r=e[4];let u;e[5]!==o.title?(u=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:o.title}),e[5]=o.title,e[6]=u):u=e[6];const d=F[o.priority];let f;e[7]!==d.badgeClassName?(f=K("shrink-0 text-[10px]",d.badgeClassName),e[7]=d.badgeClassName,e[8]=f):f=e[8];const x=F[o.priority];let g;e[9]!==f||e[10]!==x.label?(g=s.jsx(_e,{className:f,children:x.label}),e[9]=f,e[10]=x.label,e[11]=g):g=e[11];let m;e[12]!==l?(m=l&&s.jsx(ue,{url:l.user?.image??void 0,fallback:$e(l.user?.name),shape:"circle",size:"2xs"}),e[12]=l,e[13]=m):m=e[13];let p;e[14]!==o.createdAt?(p=Ee(new Date(o.createdAt)),e[14]=o.createdAt,e[15]=p):p=e[15];let b;e[16]!==p?(b=s.jsx("span",{className:"shrink-0 text-[11px] text-muted-foreground/70",children:p}),e[16]=p,e[17]=b):b=e[17];let h;return e[18]!==a||e[19]!==b||e[20]!==r||e[21]!==u||e[22]!==g||e[23]!==m?(h=s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card px-4 py-3 text-left transition-colors hover:border-ring/40",children:[r,u,g,m,b]}),e[18]=a,e[19]=b,e[20]=r,e[21]=u,e[22]=g,e[23]=m,e[24]=h):h=e[24],h}export{Ot as default};
@@ -1 +1 @@
1
- import{c as k,j as n,r as A,D as J,m as xe,l as Q,i as le,ag as Z,t as K,K as te,k as se,B as Y,d as nt,W as it,E as ot,a as rt,b as lt,u as at}from"./index-DoMiY5Rl.js";import{u as ge}from"./use-mobile-LnqC27QD.js";import{u as ct}from"./useSuspenseQueries-Brx8rA5I.js";import{u as ae,m as dt}from"./use-mcp-client-DPYZa0sT.js";import{i as mt,a as ut,S as ft}from"./constants-nH3qQ_1f.js";import{u as pt,b as ht,v as xt,a as gt}from"./use-virtual-mcp-Da_h_el9.js";import{i as bt}from"./Check-0ZdlfWma.js";import{b as Pe,a as Se}from"./ZoomOut-Csg9je7L.js";import{i as yt,A as ce,t as vt,ai as jt,H as Nt,l as wt}from"./agent-icon-C8_WQkjR.js";import{s as be}from"./Plus-BqPAYR_l.js";import{i as ye}from"./X-DAWomg6U.js";import{p as St}from"./index-BiyBiDMH.js";import{b as Me,c as oe,K as Ee,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 Mt,C as re,L as Et,k as zt}from"./library-tab-AqUKgD_Y.js";import{f as Lt,d as Ot}from"./tab-id-Bgchl1bv.js";import{b as Dt}from"./chat-context-DR8qUzB4.js";import{N as Ht}from"./decopilot-BFzm9Lxf.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-DL2-YZHZ.js";import{a as Oe,b as De,o as Vt}from"./use-organization-settings-CS_DEHIR.js";import{c as ve,b as Kt,h as Wt}from"./shell-layout-Du3qnGdi.js";import{I as He}from"./input-DiXvIasa.js";import{S as qt,t as je,P as Gt,k as Qt,s as Jt,g as Xt}from"./scroll-area-DoFtvYfc.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-BZDF_cJc.js";import{S as V}from"./skeleton-CEliEjQ-.js";import{t as Re}from"./ChevronDown-OndWepD0.js";import{g as Fe,M as ns}from"./types-GFux_3NI.js";import{I as Ue}from"./integration-icon-DyXHe04k.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-DHgoPiFM.js";import{T as as}from"./textarea-B3EqjRY_.js";import{u as Be}from"./studio-tools-BI4K6zAK.js";import{a as cs}from"./use-mcp-tools-DQzTXmYh.js";import{i as ds}from"./XCircle-B-s_NCPe.js";import{g as ms}from"./use-mcp-prompts-CuBXE7c-.js";import{b as us,w as fs}from"./hooks-DyM8E1Re.js";import{b as ps,d as hs,c as xs,D as gs,a as bs}from"./dropdown-menu-CkHc6C_x.js";import{s as ys}from"./Trash01-D85FZrUl.js";import{a as vs,u as js}from"./use-ai-providers-B2B98FIh.js";import{u as Ns}from"./connect-desktop-dialog-DG5MQFnM.js";import{T as ws}from"./toolbar-B_VUdf8H.js";import"./auth-BZgPbNUM.js";import"./use-collections-B80KpRhI.js";import"./AlertCircle-ByjwYeir.js";import"./Tool01-B-PFUcc7.js";import"./SwitchHorizontal01-E_4bb5Y7.js";import"./Settings02-CyWbAzlJ.js";import"./ArrowUpRight-CqbeTpGc.js";import"./ZapSquare-p96Mq9QT.js";import"./Users03-CPIRGSGa.js";import"./CheckCircle-CilSrYvs.js";import"./ChevronRight-knT_Aa4i.js";import"./ChevronUp-3bfkgUxC.js";import"./Circle-Db6Vd1uq.js";import"./Stars02-BxLez2Aw.js";import"./Loading02-tznIx2K-.js";import"./Copy01-Bm3MTJyz.js";import"./DotsVertical-gyHbK0_B.js";import"./Globe01-BO7OpXM7.js";import"./Eye-kqhgK17A.js";import"./FilterLines-CIX2VZX3.js";import"./Star01-BZwT1qKA.js";import"./Globe04-3C7rVANL.js";import"./HardDrive-Dn7zY9aQ.js";import"./Key01-CnYTz_f5.js";import"./LayoutLeft-B6zHq7Nr.js";import"./LinkExternal01-Dcr319Ba.js";import"./List-q5qxU0Zg.js";import"./Monitor01-BE3Am7tC.js";import"./Sun-C7qp-aqN.js";import"./Palette-CW_6OdhQ.js";import"./Play-C72dn0Fj.js";import"./SearchLg-FHuNX79t.js";import"./SearchMd-CHA-7_A7.js";import"./Shield01-BQY4pFHI.js";import"./Stars01-B7X7AsD2.js";import"./Upload01-CLneIdMS.js";import"./User01-D0EG03RI.js";import"./Users01-DiFayJrv.js";import"./XClose-28JSukJO.js";import"./Zap-3O7242Tr.js";import"./alert-dialog-Bbh2yqqj.js";import"./dialog-B9Ck6bim.js";import"./file-type-icon-Dvhcxk4y.js";import"./use-debounced-value-CIyxTXgH.js";import"./popover-TB7KbR-U.js";import"./tooltip-sQ7x_VKl.js";import"./index-D2_MPMAP.js";import"./drawer-PXWRwUMY.js";import"./collection-search-CseYh1f6.js";import"./form-CqDgKCwK.js";import"./label-74sJ_nBV.js";import"./tabs-BBpU3KTb.js";import"./toggle-group-CW6eHQoh.js";import"./command-CwilVcwd.js";import"./index-13GRlMyL.js";import"./useInfiniteQuery-C-VIS5rS.js";import"./use-infinite-scroll-CrPIHt6n.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-DcXxoFOz.js";import"./decopilot-sse-pool--TRlxcj1.js";import"./backoff-CrEUbyZT.js";import"./checkbox-Dl_uQDiC.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-Bgx8CG81.js";import"./settings-section-CTt5JrIL.js";import"./card-CDY77mdm.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-4jC90BOs.js";import"./use-registry-connections-DHEFPXt7.js";import"./use-connection-DCX4A90N.js";import"./extract-connection-data-nL3XXsx_.js";import"./collection-tabs-BziDnQHI.js";import"./badge-BPXHmusI.js";import"./connection-form-helpers-BrvucQ0G.js";import"./authenticate-and-persist-oauth-NWZWbbJs.js";import"./mcp-oauth-DQnzsAHX.js";import"./useSuspenseInfiniteQuery-nSWMrLoD.js";import"./required-auth-layout-CkREiu2L.js";import"./use-org-sso-DQUCfv8V.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DkcATHcI.js";import"./content-blocks-o63cs2vh.js";import"./use-clock-tick-DeuF2oqR.js";import"./use-navigate-to-agent-BFo48Eih.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 j=N;let v;e[16]!==a?(v=_=>a.apply(()=>_),e[16]=a,e[17]=v):v=e[17];const x=v;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]!==j||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:j,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=j,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=j=>!d||j.title?.toLowerCase().includes(d);l=a.homeIds.map(j=>g.get(j)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=j=>!a.isOnHome(j.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(j=>!y.has(j.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(Ms,{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&&!mt(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 Ms(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=Me(oe(ze,i),oe(Ee,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(Es),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 Es(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,j=f&&"shadow-lg";let v;e[9]!==j?(v=Q("rounded-lg border border-border bg-card",j),e[9]=j,e[10]=v):v=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 E;e[22]!==p?(E=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=E):E=e[23];let z;e[24]!==P||e[25]!==E?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,E]}),e[24]=P,e[25]=E,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 M;e[40]!==$||e[41]!==R?(M=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]=M):M=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==M?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,M]}),e[43]=S,e[44]=U,e[45]=M,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]!==v?(W=n.jsxs("div",{ref:m,style:N,className:v,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=v,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 j=Ge(c,o.inputSchema.properties);if(!j){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(j).length>0&&(g=j)}const y=Z(t.metadata?.ui).map(j=>(i.tileId?j.tileId===i.tileId:j===i)?{...j,toolInput:g}:j),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:je(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(vt,{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:je(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(jt,{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=ve(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 j=N;let v;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==j?(v=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:j.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=j,e[31]=v):v=e[31],v}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??je(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(),j=fe(N.value);return Ce(t,j),j},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 j;e[10]!==r||e[11]!==i?(j=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=j):j=e[12];const v=j;let x;e[13]!==v||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:v},e[13]=v,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),j={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:" "}]}]},v=crypto.randomUUID();fs(sessionStorage,s,v,{tiptapDoc:j}),await i({id:v,virtual_mcp_id:t}),r(v,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=Me(oe(ze,h),oe(Ee)),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 j=N;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=$=>{u(String($.active.id)),p(j())},e[2]=v):v=e[2];const x=v;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??j();if(u(null),p(null),!O||O.cellWidth<=0)return;const M=s.find(W=>W.id===R);if(!M)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:M.x+F,y:M.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=M=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(M)})},M.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,E,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 M;e[33]!==R||e[34]!==O?(M={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=M):M=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]!==M||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:M,children:[F,B]}),e[53]=M,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?(E={width:W,height:de},e[57]=W,e[58]=de,e[59]=E):E=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]=E,e[30]=z,e[31]=H,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],E=e[29],z=e[30],H=e[31],L=e[32];let D;e[60]!==T||e[61]!==P||e[62]!==E||e[63]!==z?(D=n.jsx(T,{dropAnimation:P,style:E,children:z}),e[60]=T,e[61]=P,e[62]=E,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}=Mt(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,j=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=N&&"opacity-30";let x;e[3]!==j||e[4]!==v?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",j,v),e[3]=j,e[4]=v,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,j)=>{const v=j+1,x=y+1,w=v<i||x<r,S=v<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${v} by ${x}`,onPointerEnter:()=>d({w:v,h:x}),onClick:()=>o({w:v,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")},`${v}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 vn(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=v=>v.pinned||!a.has(v.id),e[7]=a,e[8]=N):N=e[8];const j=t.filter(N);d=new Map;for(const v of t)v.minSize&&d.set(v.id,v.minSize);for(const v of j){const x=s.tiles[v.id];if(!x)continue;const w=d.get(v.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:v.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const v of j){if(l.some(C=>C.id===v.id))continue;const x=v.defaultSize??dn,w=d.get(v.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:v.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(jn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,j)=>{const v={};for(const x of N)v[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:v,hidden:j.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,j)=>{const v=l.find(S=>S.id===N);if(!v)return;const x=ue(j.x,j.y,v.w);if(x.x===v.x&&x.y===v.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,j)=>{const v=l.find(I=>I.id===N);if(!v)return;const x=d.get(N),{w,h:S}=me(j.w,j.h,x);if(w===v.w&&S===v.h)return;const T={...v,w,h:S,x:ue(v.x,v.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 j=l.filter(v=>v.id!==N);f(j,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 jn(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=dt({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 j;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(j=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]=j):j=e[28];let v;return e[29]!==r||e[30]!==j?(v=n.jsxs(n.Fragment,{children:[j,r]}),e[29]=r,e[30]=j,e[31]=v):v=e[31],v}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(Mn),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(En,{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 j;e[10]!==y||e[11]!==N?(j=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=j):j=e[12];let v;return e[13]!==m||e[14]!==h||e[15]!==j?(v=n.jsxs("div",{className:p,children:[h,j,m]}),e[13]=m,e[14]=h,e[15]=j,e[16]=v):v=e[16],v}function Mn(t){return!!t.promptName}function En(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}=ve(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=vn(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)}},j=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:j,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Hn(t){const e=k.c(2),{prompts:s,tiles:o}=ve(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=vs(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=js(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:j,isInitialFreeCredit:v,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&&v&&x!=null,E=N&&j&&w;let z;t[24]!==x||t[25]!==P||t[26]!==E?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):E?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=E,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 j=N;let v;e[5]===Symbol.for("react.memo_cache_sentinel")?(v={kind:"component",Component:Se},e[5]=v):v=e[5];let x;e[6]!==y||e[7]!==j?(x=()=>j(y?void 0:"files"),e[6]=y,e[7]=j,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:v,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 E;e[25]!==P?(E=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=E):E=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]!==E||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:E,children:[U,$]})})]}),e[39]=E,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==j?(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:()=>j(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(Et,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=j,e[46]=O):O=e[46];let M;e[47]!==R||e[48]!==O?(M=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=M):M=e[49];let F;return e[50]!==C||e[51]!==M||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,M]}),e[50]=C,e[51]=M,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 lr(){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{lr as default};
1
+ import{c as k,j as n,r as A,D as J,m as xe,l as Q,i as le,ag as Z,t as K,K as te,k as se,B as Y,d as nt,W as it,E as ot,a as rt,b as lt,u as at}from"./index-DSDpj2Bj.js";import{u as ge}from"./use-mobile-BJypeB5n.js";import{u as ct}from"./useSuspenseQueries-BLmcLcIz.js";import{u as ae,m as dt}from"./use-mcp-client-Cq1PuVy-.js";import{i as mt,a as ut,S as ft}from"./constants-nH3qQ_1f.js";import{u as pt,b as ht,v as xt,a as gt}from"./use-virtual-mcp-FbrEFCoK.js";import{i as bt}from"./Check-DgZ3In7m.js";import{b as Pe,a as Se}from"./ZoomOut-CrZXH-lO.js";import{i as yt,A as ce,t as vt,ai as jt,H as Nt,l as wt}from"./agent-icon-Da9Da6_T.js";import{s as be}from"./Plus-C4Q0OOCY.js";import{i as ye}from"./X-D42jewIw.js";import{p as St}from"./index-oFz8diCg.js";import{b as Me,c as oe,K as Ee,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 Mt,C as re,L as Et,k as zt}from"./library-tab-D9496yS1.js";import{f as Lt,d as Ot}from"./tab-id-Bgchl1bv.js";import{b as Dt}from"./chat-context-BYfzrjSg.js";import{N as Ht}from"./decopilot-lLmAldte.js";import{g as Rt,u as Ft,c as Ut,h as Bt}from"./agent-capabilities-C8-S9cdW.js";import{a as Oe,b as De,o as Vt}from"./use-organization-settings-C6Az1O42.js";import{c as ve,b as Kt,h as Wt}from"./shell-layout-B9LP1BkH.js";import{I as He}from"./input-CYkPya5x.js";import{S as qt,t as je,P as Gt,k as Qt,s as Jt,g as Xt}from"./scroll-area-CpSDQ9B3.js";import{S as Zt,a as Yt,b as es,c as ts,d as ss}from"./sheet-CD0P6dVG.js";import{S as V}from"./skeleton-C1UGwqR5.js";import{t as Re}from"./ChevronDown--CNgLcjC.js";import{g as Fe,M as ns}from"./types-J4fUU_hs.js";import{I as Ue}from"./integration-icon-CBUlZi7o.js";import{S as is,a as os,b as rs,c as _e,d as ls}from"./select-B0TGwXjH.js";import{T as as}from"./textarea-DN29sT4P.js";import{u as Be}from"./studio-tools-Ch4cqriC.js";import{a as cs}from"./use-mcp-tools-DRaDUnOy.js";import{i as ds}from"./XCircle-d4Mj_55a.js";import{g as ms}from"./use-mcp-prompts-hylROZ-T.js";import{b as us,w as fs}from"./hooks-DRWd8r4q.js";import{b as ps,d as hs,c as xs,D as gs,a as bs}from"./dropdown-menu-BKlRxK5y.js";import{s as ys}from"./Trash01-DquY3ri8.js";import{a as vs,u as js}from"./use-ai-providers-BYWkMeHm.js";import{u as Ns}from"./connect-desktop-dialog-Bvweozcg.js";import{T as ws}from"./toolbar-B6-9TSIO.js";import"./auth-C47SGxHt.js";import"./use-collections-82SPyTpX.js";import"./AlertCircle-bPFs3KEL.js";import"./Tool01-BL4kQBIR.js";import"./SwitchHorizontal01-BDG7IOK2.js";import"./Settings02-C4rR2BwH.js";import"./ArrowUpRight-Cr-8XVVD.js";import"./ZapSquare-Cb2ZjSQ9.js";import"./Users03-DPHNxMCn.js";import"./CheckCircle-C3XWnj4j.js";import"./ChevronRight-BWbK6ynD.js";import"./ChevronUp-Kv_LvrHV.js";import"./Circle-qJ5BBlYd.js";import"./Stars02-BP1hwbuc.js";import"./Loading02-D0nMaQOZ.js";import"./Copy01-3GtjKY1N.js";import"./DotsVertical-DtK63shY.js";import"./Globe01-B13h8XtZ.js";import"./Eye-DF9e8dvr.js";import"./FilterLines-B3UlQwDc.js";import"./Star01-Jt5Q2gfx.js";import"./Globe04-1GZz65ia.js";import"./HardDrive-4yC-BESY.js";import"./Key01-CI7N-3nc.js";import"./LayoutLeft-9np6COHp.js";import"./LinkExternal01-BPLWMKpP.js";import"./List-DuUlr1m8.js";import"./Monitor01-CoHtWm_B.js";import"./Sun-BZVZjrLl.js";import"./Palette-it9tTFZx.js";import"./Play-DGqQSguj.js";import"./SearchLg-DbFjcinT.js";import"./SearchMd-f7WdVWzc.js";import"./Shield01-CpnoHxN2.js";import"./Stars01-DkYIpw1N.js";import"./Upload01-Bkj-e8t-.js";import"./User01-Cob64tHg.js";import"./Users01-kXte77jT.js";import"./XClose-D_lTdEDj.js";import"./Zap-II5jDxLp.js";import"./alert-dialog-gasitoEq.js";import"./dialog-Bnj4VVJm.js";import"./file-type-icon-4oZPbqxn.js";import"./use-debounced-value-BD2t0Sm8.js";import"./popover-B9JWOHOx.js";import"./tooltip-DA3ZHoTy.js";import"./index-DTTOpJGs.js";import"./drawer-D3mld3mJ.js";import"./collection-search-iqB-Cu-3.js";import"./form-OsKubpwl.js";import"./label-DCDEQbHw.js";import"./tabs-0xOggEmc.js";import"./toggle-group-DYIGEIay.js";import"./command-CR6OgyqM.js";import"./index-Bcf0MN_M.js";import"./useInfiniteQuery-CKxr4Gfg.js";import"./use-infinite-scroll-BjUfY6Ak.js";import"./question-004-sINsf4GQ.js";import"./use-decopilot-events-Cu0CbLk2.js";import"./decopilot-sse-pool-By8dFwPK.js";import"./backoff-CrEUbyZT.js";import"./checkbox-DYEeIzJL.js";import"./ai-providers-logos-DD3qZ33J.js";import"./avatar-G4lfZ1rm.js";import"./settings-section-B6aXXKek.js";import"./card-B-n7RZj8.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-NnU7ECW4.js";import"./use-registry-connections-BUnPYArH.js";import"./use-connection-F0pDuIZV.js";import"./extract-connection-data-Dr0kvEkl.js";import"./collection-tabs-rhGvUIlm.js";import"./badge-D16FSQ-g.js";import"./connection-form-helpers-Bm9nknv3.js";import"./authenticate-and-persist-oauth-CEA-zfJw.js";import"./mcp-oauth-DxV8k1O8.js";import"./useSuspenseInfiniteQuery-DgBHsP0y.js";import"./required-auth-layout-BsMqxbKV.js";import"./use-org-sso-BRC0WSR6.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DQL5kiDG.js";import"./content-blocks-o63cs2vh.js";import"./use-clock-tick-xNvYo8xf.js";import"./use-navigate-to-agent-BsICAYua.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 j=N;let v;e[16]!==a?(v=_=>a.apply(()=>_),e[16]=a,e[17]=v):v=e[17];const x=v;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]!==j||e[29]!==x||e[30]!==S?(T={homeIds:r,isOnHome:f,atLimit:g,addAgent:y,removeAgent:j,reorder:x,saveAgentMetadata:S},e[24]=y,e[25]=g,e[26]=r,e[27]=f,e[28]=j,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=j=>!d||j.title?.toLowerCase().includes(d);l=a.homeIds.map(j=>g.get(j)).filter($s).filter(b);const y=Rt(i);let N;e[9]!==a?(N=j=>!a.isOnHome(j.id),e[9]=a,e[10]=N):N=e[10],m=i.filter(ks).filter(j=>!y.has(j.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(Ms,{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&&!mt(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 Ms(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=Me(oe(ze,i),oe(Ee,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(Es),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 Es(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,j=f&&"shadow-lg";let v;e[9]!==j?(v=Q("rounded-lg border border-border bg-card",j),e[9]=j,e[10]=v):v=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 E;e[22]!==p?(E=n.jsx("div",{className:"truncate text-xs text-muted-foreground",children:p}),e[22]=p,e[23]=E):E=e[23];let z;e[24]!==P||e[25]!==E?(z=n.jsxs("div",{className:"min-w-0 flex-1",children:[P,E]}),e[24]=P,e[25]=E,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 M;e[40]!==$||e[41]!==R?(M=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]=M):M=e[42];let F;e[43]!==S||e[44]!==U||e[45]!==M?(F=n.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-2.5",children:[S,U,M]}),e[43]=S,e[44]=U,e[45]=M,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]!==v?(W=n.jsxs("div",{ref:m,style:N,className:v,children:[F,B]}),e[51]=m,e[52]=N,e[53]=F,e[54]=B,e[55]=v,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 j=Ge(c,o.inputSchema.properties);if(!j){K.error("Invalid JSON in one of the fields — please fix it."),a(!1);return}Object.keys(j).length>0&&(g=j)}const y=Z(t.metadata?.ui).map(j=>(i.tileId?j.tileId===i.tileId:j===i)?{...j,toolInput:g}:j),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:je(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(vt,{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:je(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(jt,{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=ve(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 j=N;let v;return e[27]!==s||e[28]!==o||e[29]!==b||e[30]!==j?(v=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:j.has(x.name)},x.name))}),e[27]=s,e[28]=o,e[29]=b,e[30]=j,e[31]=v):v=e[31],v}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??je(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(),j=fe(N.value);return Ce(t,j),j},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 j;e[10]!==r||e[11]!==i?(j=S=>{r?l(S):i.save(S)},e[10]=r,e[11]=i,e[12]=j):j=e[12];const v=j;let x;e[13]!==v||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:v},e[13]=v,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),j={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:" "}]}]},v=crypto.randomUUID();fs(sessionStorage,s,v,{tiptapDoc:j}),await i({id:v,virtual_mcp_id:t}),r(v,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=Me(oe(ze,h),oe(Ee)),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 j=N;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=$=>{u(String($.active.id)),p(j())},e[2]=v):v=e[2];const x=v;let w;e[3]!==f||e[4]!==r||e[5]!==s?(w=$=>{const R=String($.active.id),O=f??j();if(u(null),p(null),!O||O.cellWidth<=0)return;const M=s.find(W=>W.id===R);if(!M)return;const F=Math.round($.delta.x/O.cellWidth),B=Math.round($.delta.y/O.cellHeight);F===0&&B===0||r(R,{x:M.x+F,y:M.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=M=>n.jsx("div",{className:"group bg-card card-shadow rounded-2xl overflow-hidden",style:{minHeight:G},children:n.jsx(pe,{children:i(M)})},M.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,E,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 M;e[33]!==R||e[34]!==O?(M={height:R,minHeight:O},e[33]=R,e[34]=O,e[35]=M):M=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]!==M||e[54]!==F||e[55]!==B?(I=n.jsxs("div",{ref:m,className:"relative w-full",style:M,children:[F,B]}),e[53]=M,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?(E={width:W,height:de},e[57]=W,e[58]=de,e[59]=E):E=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]=E,e[30]=z,e[31]=H,e[32]=L}else T=e[24],_=e[25],C=e[26],I=e[27],P=e[28],E=e[29],z=e[30],H=e[31],L=e[32];let D;e[60]!==T||e[61]!==P||e[62]!==E||e[63]!==z?(D=n.jsx(T,{dropAnimation:P,style:E,children:z}),e[60]=T,e[61]=P,e[62]=E,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}=Mt(m),h=`${s.x/q*100}%`,g=`${s.w/q*100}%`,b=s.y*G,y=s.h*G,N=p||i,j=!N&&"transition-[left,top,width,height,opacity] duration-200 ease-out",v=N&&"opacity-30";let x;e[3]!==j||e[4]!==v?(x=Q("absolute p-1 will-change-[left,top,width,height,opacity]",j,v),e[3]=j,e[4]=v,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,j)=>{const v=j+1,x=y+1,w=v<i||x<r,S=v<=m.w&&x<=m.h;return n.jsx("button",{type:"button",disabled:w,"aria-label":`${v} by ${x}`,onPointerEnter:()=>d({w:v,h:x}),onClick:()=>o({w:v,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")},`${v}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 vn(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=v=>v.pinned||!a.has(v.id),e[7]=a,e[8]=N):N=e[8];const j=t.filter(N);d=new Map;for(const v of t)v.minSize&&d.set(v.id,v.minSize);for(const v of j){const x=s.tiles[v.id];if(!x)continue;const w=d.get(v.id),{w:S,h:T}=me(x.w,x.h,w),{x:_,y:C}=ue(x.x,x.y,S);l.push({id:v.id,x:_,y:C,w:S,h:T,minW:w?.w,minH:w?.h})}for(const v of j){if(l.some(C=>C.id===v.id))continue;const x=v.defaultSize??dn,w=d.get(v.id),{w:S,h:T}=me(x.w,x.h,w),_=he(l,S,T);l.push({id:v.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(jn)),e[9]=t,e[10]=m):m=e[10];const c=m;let u;e[11]!==c||e[12]!==i?(u=(N,j)=>{const v={};for(const x of N)v[x.id]={x:x.x,y:x.y,w:x.w,h:x.h};i({version:ee,tiles:v,hidden:j.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,j)=>{const v=l.find(S=>S.id===N);if(!v)return;const x=ue(j.x,j.y,v.w);if(x.x===v.x&&x.y===v.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,j)=>{const v=l.find(I=>I.id===N);if(!v)return;const x=d.get(N),{w,h:S}=me(j.w,j.h,x);if(w===v.w&&S===v.h)return;const T={...v,w,h:S,x:ue(v.x,v.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 j=l.filter(v=>v.id!==N);f(j,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 jn(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=dt({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 j;e[21]!==a||e[22]!==d||e[23]!==y||e[24]!==N||e[25]!==l||e[26]!==f||e[27]!==p?(j=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]=j):j=e[28];let v;return e[29]!==r||e[30]!==j?(v=n.jsxs(n.Fragment,{children:[j,r]}),e[29]=r,e[30]=j,e[31]=v):v=e[31],v}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(Mn),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(En,{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 j;e[10]!==y||e[11]!==N?(j=n.jsxs("div",{className:g,children:[y,N]}),e[10]=y,e[11]=N,e[12]=j):j=e[12];let v;return e[13]!==m||e[14]!==h||e[15]!==j?(v=n.jsxs("div",{className:p,children:[h,j,m]}),e[13]=m,e[14]=h,e[15]=j,e[16]=v):v=e[16],v}function Mn(t){return!!t.promptName}function En(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}=ve(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=vn(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)}},j=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:j,onMove:g.moveTile,onResize:g.resizeTile,onRemove:N})})}function Hn(t){const e=k.c(2),{prompts:s,tiles:o}=ve(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=vs(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=js(),y=gt(l.id),{hasDecoKey:N,isZeroBalance:j,isInitialFreeCredit:v,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&&v&&x!=null,E=N&&j&&w;let z;t[24]!==x||t[25]!==P||t[26]!==E?(z=P?n.jsx(re.CreditsEyebrow,{balanceDollars:x}):E?n.jsx(re.NoCreditsEyebrow,{}):null,t[24]=x,t[25]=P,t[26]=E,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 j=N;let v;e[5]===Symbol.for("react.memo_cache_sentinel")?(v={kind:"component",Component:Se},e[5]=v):v=e[5];let x;e[6]!==y||e[7]!==j?(x=()=>j(y?void 0:"files"),e[6]=y,e[7]=j,e[8]=x):x=e[8];let w;e[9]!==y||e[10]!==x?(w=n.jsx(St,{title:"Library",icon:v,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 E;e[25]!==P?(E=Q("relative flex flex-col items-center px-10 pb-4",P),e[25]=P,e[26]=E):E=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]!==E||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:E,children:[U,$]})})]}),e[39]=E,e[40]=U,e[41]=$,e[42]=R):R=e[42];let O;e[43]!==b||e[44]!==y||e[45]!==j?(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:()=>j(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(Et,{path:b.path}):n.jsx(zt,{})})]}),e[43]=b,e[44]=y,e[45]=j,e[46]=O):O=e[46];let M;e[47]!==R||e[48]!==O?(M=n.jsxs("div",{className:"flex-1 relative flex flex-row min-h-0",children:[R,O]}),e[47]=R,e[48]=O,e[49]=M):M=e[49];let F;return e[50]!==C||e[51]!==M||e[52]!==_?(F=n.jsxs(n.Fragment,{children:[_,C,M]}),e[50]=C,e[51]=M,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 lr(){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{lr as default};
@@ -1 +1 @@
1
- import{r as s,a9 as L,a7 as B,j as d,b5 as q,a4 as x,a8 as E,b3 as K,aa as C,b4 as _,b6 as T,a6 as w,bE as U,bD as V}from"./index-DoMiY5Rl.js";var I="Radio",[z,P]=w(I),[H,W]=z(I),k=s.forwardRef((a,c)=>{const{__scopeRadio:o,name:n,checked:e=!1,required:r,disabled:t,value:l="on",onCheck:f,form:R,...v}=a,[p,m]=s.useState(null),i=E(c,h=>m(h)),u=s.useRef(!1),b=p?R||!!p.closest("form"):!0;return d.jsxs(H,{scope:o,checked:e,disabled:t,children:[d.jsx(x.button,{type:"button",role:"radio","aria-checked":e,"data-state":A(e),"data-disabled":t?"":void 0,disabled:t,value:l,...v,ref:i,onClick:C(a.onClick,h=>{e||f?.(),b&&(u.current=h.isPropagationStopped(),u.current||h.stopPropagation())})}),b&&d.jsx(S,{control:p,bubbles:!u.current,name:n,value:l,checked:e,required:r,disabled:t,form:R,style:{transform:"translateX(-100%)"}})]})});k.displayName=I;var g="RadioIndicator",G=s.forwardRef((a,c)=>{const{__scopeRadio:o,forceMount:n,...e}=a,r=W(g,o);return d.jsx(T,{present:n||r.checked,children:d.jsx(x.span,{"data-state":A(r.checked),"data-disabled":r.disabled?"":void 0,...e,ref:c})})});G.displayName=g;var X="RadioBubbleInput",S=s.forwardRef(({__scopeRadio:a,control:c,checked:o,bubbles:n=!0,...e},r)=>{const t=s.useRef(null),l=E(t,r),f=U(o),R=V(c);return s.useEffect(()=>{const v=t.current;if(!v)return;const p=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(p,"checked").set;if(f!==o&&i){const u=new Event("click",{bubbles:n});i.call(v,o),v.dispatchEvent(u)}},[f,o,n]),d.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...e,tabIndex:-1,ref:l,style:{...e.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});S.displayName=X;function A(a){return a?"checked":"unchecked"}var Y=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],y="RadioGroup",[J]=w(y,[_,P]),j=_(),N=P(),[Q,Z]=J(y),D=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,name:n,defaultValue:e,value:r,required:t=!1,disabled:l=!1,orientation:f,dir:R,loop:v=!0,onValueChange:p,...m}=a,i=j(o),u=L(R),[b,h]=B({prop:r,defaultProp:e??null,onChange:p,caller:y});return d.jsx(Q,{scope:o,name:n,required:t,disabled:l,value:b,onValueChange:h,children:d.jsx(q,{asChild:!0,...i,orientation:f,dir:u,loop:v,children:d.jsx(x.div,{role:"radiogroup","aria-required":t,"aria-orientation":f,"data-disabled":l?"":void 0,dir:u,...m,ref:c})})})});D.displayName=y;var M="RadioGroupItem",O=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,disabled:n,...e}=a,r=Z(M,o),t=r.disabled||n,l=j(o),f=N(o),R=s.useRef(null),v=E(c,R),p=r.value===e.value,m=s.useRef(!1);return s.useEffect(()=>{const i=b=>{Y.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",i),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",u)}},[]),d.jsx(K,{asChild:!0,...l,focusable:!t,active:p,children:d.jsx(k,{disabled:t,required:r.required,checked:p,...f,...e,name:r.name,ref:v,onCheck:()=>r.onValueChange(e.value),onKeyDown:C(i=>{i.key==="Enter"&&i.preventDefault()}),onFocus:C(e.onFocus,()=>{m.current&&R.current?.click()})})})});O.displayName=M;var $="RadioGroupIndicator",F=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,...n}=a,e=N(o);return d.jsx(G,{...e,...n,ref:c})});F.displayName=$;var oe=D,re=O,ae=F;export{re as I,oe as R,ae as a};
1
+ import{r as s,a9 as L,a7 as B,j as d,b5 as q,a4 as x,a8 as E,b3 as K,aa as C,b4 as _,b6 as T,a6 as w,bE as U,bD as V}from"./index-DSDpj2Bj.js";var I="Radio",[z,P]=w(I),[H,W]=z(I),k=s.forwardRef((a,c)=>{const{__scopeRadio:o,name:n,checked:e=!1,required:r,disabled:t,value:l="on",onCheck:f,form:R,...v}=a,[p,m]=s.useState(null),i=E(c,h=>m(h)),u=s.useRef(!1),b=p?R||!!p.closest("form"):!0;return d.jsxs(H,{scope:o,checked:e,disabled:t,children:[d.jsx(x.button,{type:"button",role:"radio","aria-checked":e,"data-state":A(e),"data-disabled":t?"":void 0,disabled:t,value:l,...v,ref:i,onClick:C(a.onClick,h=>{e||f?.(),b&&(u.current=h.isPropagationStopped(),u.current||h.stopPropagation())})}),b&&d.jsx(S,{control:p,bubbles:!u.current,name:n,value:l,checked:e,required:r,disabled:t,form:R,style:{transform:"translateX(-100%)"}})]})});k.displayName=I;var g="RadioIndicator",G=s.forwardRef((a,c)=>{const{__scopeRadio:o,forceMount:n,...e}=a,r=W(g,o);return d.jsx(T,{present:n||r.checked,children:d.jsx(x.span,{"data-state":A(r.checked),"data-disabled":r.disabled?"":void 0,...e,ref:c})})});G.displayName=g;var X="RadioBubbleInput",S=s.forwardRef(({__scopeRadio:a,control:c,checked:o,bubbles:n=!0,...e},r)=>{const t=s.useRef(null),l=E(t,r),f=U(o),R=V(c);return s.useEffect(()=>{const v=t.current;if(!v)return;const p=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(p,"checked").set;if(f!==o&&i){const u=new Event("click",{bubbles:n});i.call(v,o),v.dispatchEvent(u)}},[f,o,n]),d.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:o,...e,tabIndex:-1,ref:l,style:{...e.style,...R,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});S.displayName=X;function A(a){return a?"checked":"unchecked"}var Y=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],y="RadioGroup",[J]=w(y,[_,P]),j=_(),N=P(),[Q,Z]=J(y),D=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,name:n,defaultValue:e,value:r,required:t=!1,disabled:l=!1,orientation:f,dir:R,loop:v=!0,onValueChange:p,...m}=a,i=j(o),u=L(R),[b,h]=B({prop:r,defaultProp:e??null,onChange:p,caller:y});return d.jsx(Q,{scope:o,name:n,required:t,disabled:l,value:b,onValueChange:h,children:d.jsx(q,{asChild:!0,...i,orientation:f,dir:u,loop:v,children:d.jsx(x.div,{role:"radiogroup","aria-required":t,"aria-orientation":f,"data-disabled":l?"":void 0,dir:u,...m,ref:c})})})});D.displayName=y;var M="RadioGroupItem",O=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,disabled:n,...e}=a,r=Z(M,o),t=r.disabled||n,l=j(o),f=N(o),R=s.useRef(null),v=E(c,R),p=r.value===e.value,m=s.useRef(!1);return s.useEffect(()=>{const i=b=>{Y.includes(b.key)&&(m.current=!0)},u=()=>m.current=!1;return document.addEventListener("keydown",i),document.addEventListener("keyup",u),()=>{document.removeEventListener("keydown",i),document.removeEventListener("keyup",u)}},[]),d.jsx(K,{asChild:!0,...l,focusable:!t,active:p,children:d.jsx(k,{disabled:t,required:r.required,checked:p,...f,...e,name:r.name,ref:v,onCheck:()=>r.onValueChange(e.value),onKeyDown:C(i=>{i.key==="Enter"&&i.preventDefault()}),onFocus:C(e.onFocus,()=>{m.current&&R.current?.click()})})})});O.displayName=M;var $="RadioGroupIndicator",F=s.forwardRef((a,c)=>{const{__scopeRadioGroup:o,...n}=a,e=N(o);return d.jsx(G,{...e,...n,ref:c})});F.displayName=$;var oe=D,re=O,ae=F;export{re as I,oe as R,ae as a};