decocms 3.73.1 → 3.74.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 (286) hide show
  1. package/dist/client/assets/{AlertCircle-DMqR3m0L.js → AlertCircle-Ccspj6_x.js} +1 -1
  2. package/dist/client/assets/ArrowRight-DjM-WAe8.js +1 -0
  3. package/dist/client/assets/{ArrowUpRight-DeYzuaJ8.js → ArrowUpRight-tJm1fmd7.js} +1 -1
  4. package/dist/client/assets/Check-D3J8f8u-.js +1 -0
  5. package/dist/client/assets/{CheckCircle-D6b8lFUP.js → CheckCircle-2NPq-6dO.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-CYFvWHpZ.js → ChevronDown-Dilz0yBl.js} +1 -1
  7. package/dist/client/assets/{ChevronLeft-DXSAgzPw.js → ChevronLeft-CJ5DBM3M.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-Dj41DV2U.js → ChevronRight-KEtpzT4P.js} +1 -1
  9. package/dist/client/assets/ChevronUp-B5x1falF.js +1 -0
  10. package/dist/client/assets/{DotsVertical-y5lMfVOQ.js → DotsVertical-BM5d8Pc7.js} +1 -1
  11. package/dist/client/assets/{Eye-D3THRXh6.js → Eye-hHNCwVZ1.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BPeCeYIz.js → FilterLines-DfVdVEBp.js} +1 -1
  13. package/dist/client/assets/{Globe01-BquIL2vg.js → Globe01-DD8UM4Hn.js} +1 -1
  14. package/dist/client/assets/{Globe04-BBRZWdJY.js → Globe04-CHjKQaGv.js} +1 -1
  15. package/dist/client/assets/{HardDrive-DmtpWveq.js → HardDrive-ClhqImrT.js} +1 -1
  16. package/dist/client/assets/{Key01-Lcx9qTy7.js → Key01-BYHEvjL0.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-CkiSxkS_.js → LayoutLeft-BNwcfVCc.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-jwO28Eeb.js → LinkExternal01-BqsD3A6i.js} +1 -1
  19. package/dist/client/assets/{Monitor01-L6hrk62b.js → Monitor01-BqllG5YD.js} +1 -1
  20. package/dist/client/assets/{Palette-ClNyQOQA.js → Palette-CdtyN2t7.js} +1 -1
  21. package/dist/client/assets/{Play-C6QgiUls.js → Play-DpX5JUyA.js} +1 -1
  22. package/dist/client/assets/{Plus-_82_8sq8.js → Plus-BaLwS14l.js} +1 -1
  23. package/dist/client/assets/{SearchMd-C3Pmxf99.js → SearchMd-CJ_dFCp5.js} +1 -1
  24. package/dist/client/assets/{Settings02-B7hO-Tma.js → Settings02-Cg6Yp6Ig.js} +1 -1
  25. package/dist/client/assets/{Shield01-RDE62wRx.js → Shield01-DYwaNnY3.js} +1 -1
  26. package/dist/client/assets/{Star01-BfSEPDRT.js → Star01-D42mJCl7.js} +1 -1
  27. package/dist/client/assets/{Stars01-W6Wl0Pse.js → Stars01-CrB442jN.js} +1 -1
  28. package/dist/client/assets/{Stars02-9vF61uFx.js → Stars02-C2akJW-A.js} +1 -1
  29. package/dist/client/assets/{Sun-BxuJFhF6.js → Sun-CgYYfF85.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-yw5VS97V.js → SwitchHorizontal01-y3DhestF.js} +1 -1
  31. package/dist/client/assets/{Tool01-B4SsemMS.js → Tool01-CI_6KMgQ.js} +1 -1
  32. package/dist/client/assets/{Trash01-CG0gTYx7.js → Trash01-Cd_0JhhN.js} +1 -1
  33. package/dist/client/assets/{Upload01-BlvGy5d-.js → Upload01-ijsbLMSK.js} +1 -1
  34. package/dist/client/assets/{User01-CTuKNCEa.js → User01-BI5RuTWy.js} +1 -1
  35. package/dist/client/assets/{Users01-KXiCgru2.js → Users01-LhAUtJ2l.js} +1 -1
  36. package/dist/client/assets/{Users03-BOvyNEV4.js → Users03-CJf6bBEA.js} +1 -1
  37. package/dist/client/assets/{X-CKIhVHQk.js → X-BmA2kYv-.js} +1 -1
  38. package/dist/client/assets/XCircle-CSVmVGl-.js +1 -0
  39. package/dist/client/assets/{XClose-Ig7y9gcI.js → XClose-BGGuhSdx.js} +1 -1
  40. package/dist/client/assets/{Zap-w60sxAoc.js → Zap-C5OGTH44.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-C7yt7KfQ.js → ZapSquare-Bh6-lHaM.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-DVSwpwUz.js → ZoomOut-xDQo2yr7.js} +1 -1
  43. package/dist/client/assets/{access-gate-CEtgmlCt.js → access-gate-C-eMG1Ta.js} +1 -1
  44. package/dist/client/assets/add-section-modal-DNNafM9O.js +1 -0
  45. package/dist/client/assets/agent-icon-Bcqwo2Wq.js +1 -0
  46. package/dist/client/assets/agents-list-obMS8uxZ.js +1 -0
  47. package/dist/client/assets/ai-providers-apfL_rjp.js +1 -0
  48. package/dist/client/assets/{alert-DIqgQstn.js → alert-B1Ln6zZV.js} +1 -1
  49. package/dist/client/assets/{alert-dialog-BuJSufuR.js → alert-dialog-BZRM5ze7.js} +3 -3
  50. package/dist/client/assets/app-editor-C0jI2dDZ.js +1 -0
  51. package/dist/client/assets/{auth-catchall-CHUZWWSw.js → auth-catchall-s-1qzuNO.js} +1 -1
  52. package/dist/client/assets/auth-entry-CW5gsTiA.js +1 -0
  53. package/dist/client/assets/{auth-tkqpBHf1.js → auth-rl3GT7t8.js} +1 -1
  54. package/dist/client/assets/{auth-split-layout-DRR0KEkj.js → auth-split-layout-BC0lphRW.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-40GibzkL.js → automation-list-row-DefMjeyu.js} +1 -1
  56. package/dist/client/assets/{automation-runs-BEntIYkJ.js → automation-runs-C-Da4MEd.js} +1 -1
  57. package/dist/client/assets/automations-CbOSvhEe.js +1 -0
  58. package/dist/client/assets/{avatar-DfTXVgX9.js → avatar-CXZnLPEU.js} +1 -1
  59. package/dist/client/assets/backoff-CrEUbyZT.js +1 -0
  60. package/dist/client/assets/{badge-an9iff2c.js → badge-DSiiJMKS.js} +1 -1
  61. package/dist/client/assets/{block-document-DZEmtfok.js → block-document-DR_-i1iv.js} +1 -1
  62. package/dist/client/assets/{brand-context-BhD6vM0G.js → brand-context-D385RFi4.js} +1 -1
  63. package/dist/client/assets/buckets-CfLzGo42.js +1 -0
  64. package/dist/client/assets/{calendar-tEWC6_XV.js → calendar-CdvLiXTi.js} +1 -1
  65. package/dist/client/assets/{capability-load-error-BXEh1mp-.js → capability-load-error-Cc0Imt5p.js} +1 -1
  66. package/dist/client/assets/{card-Ckx3Kwvj.js → card-DSDTRgoU.js} +1 -1
  67. package/dist/client/assets/category-editor-sMElZzN1.js +1 -0
  68. package/dist/client/assets/chat-context-DnaexSAo.js +21 -0
  69. package/dist/client/assets/checkbox-CL_5fiO_.js +1 -0
  70. package/dist/client/assets/{cli-auth-success-DWLJa27h.js → cli-auth-success-DV-qTae_.js} +1 -1
  71. package/dist/client/assets/collection-detail-CtoW7iVa.js +1 -0
  72. package/dist/client/assets/collection-display-button-Boq8hl8Q.js +1 -0
  73. package/dist/client/assets/{collection-search-CCzYANV5.js → collection-search-2g11_WBH.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-CBstOc4r.js → collection-tabs-CDMyDuFK.js} +1 -1
  75. package/dist/client/assets/{command-pIEd50-L.js → command-Bw_f0kDn.js} +1 -1
  76. package/dist/client/assets/commerce-onboarding-LL_9usA-.js +1 -0
  77. package/dist/client/assets/connect-desktop-dialog-Dybq2Hx1.js +1 -0
  78. package/dist/client/assets/{connection-card-CqvtHNnU.js → connection-card-DA1t_KQo.js} +1 -1
  79. package/dist/client/assets/connection-detail-C3h6Iqqu.js +1 -0
  80. package/dist/client/assets/{connection-form-helpers-ByFrPc9N.js → connection-form-helpers-BqK6S8Yx.js} +1 -1
  81. package/dist/client/assets/connections-BdIG1myf.js +1 -0
  82. package/dist/client/assets/context-menu-KaWlIbj1.js +1 -0
  83. package/dist/client/assets/{decopilot-D6xQ1qh2.js → decopilot-fUgUe2Eh.js} +1 -1
  84. package/dist/client/assets/decopilot-sse-pool-Dl1x5tdf.js +1 -0
  85. package/dist/client/assets/delay-CnY5UFtP.js +1 -0
  86. package/dist/client/assets/dialog-CQ6B0IwC.js +1 -0
  87. package/dist/client/assets/{domain-settings-DIU6G_-3.js → domain-settings-BvzKBAZm.js} +1 -1
  88. package/dist/client/assets/drawer-mbT59SGx.js +1 -0
  89. package/dist/client/assets/dropdown-menu-bs6nmOyP.js +1 -0
  90. package/dist/client/assets/{empty-state-BrSxZrfZ.js → empty-state-crYivviN.js} +1 -1
  91. package/dist/client/assets/{extract-connection-data-CBzjCfJ2.js → extract-connection-data-D-Y4GRfE.js} +1 -1
  92. package/dist/client/assets/file-explorer-iYX8uF4-.js +2 -0
  93. package/dist/client/assets/{file-type-icon-BOPDPlds.js → file-type-icon-D0ASmNXK.js} +1 -1
  94. package/dist/client/assets/{files-cbAPSaRo.js → files-ENTpyfhv.js} +1 -1
  95. package/dist/client/assets/{form-BZY9ZRz4.js → form-O9DEtf_L.js} +1 -1
  96. package/dist/client/assets/general-BJWZpnpu.js +1 -0
  97. package/dist/client/assets/{github-repo-picker-CrW8szfE.js → github-repo-picker-CHTvfJAD.js} +1 -1
  98. package/dist/client/assets/{hooks-DLdyjUhZ.js → hooks-CSfRJCjt.js} +6 -6
  99. package/dist/client/assets/image-field-BdcHkDRx.js +1 -0
  100. package/dist/client/assets/{import-from-deco-dialog-BVpWCCC9.js → import-from-deco-dialog-Bz8FE0_9.js} +2 -2
  101. package/dist/client/assets/{index-CqHy6432.js → index-7a12TwCl.js} +10 -10
  102. package/dist/client/assets/{index-BBz_54sx.js → index-B4I34F6K.js} +1 -1
  103. package/dist/client/assets/{index-CszBxeF9.js → index-BFeGPSf0.js} +1 -1
  104. package/dist/client/assets/{index-BwhwNs2D.js → index-BK1jVztm.js} +4 -4
  105. package/dist/client/assets/{index-CE8AoMpS.js → index-BPuJ390n.js} +1 -1
  106. package/dist/client/assets/{index-DexxTctJ.js → index-BRnQ22g3.js} +1 -1
  107. package/dist/client/assets/index-B_6khNsr.js +1 -0
  108. package/dist/client/assets/{index-xsAZnQ1t.js → index-BsWl8UuV.js} +1 -1
  109. package/dist/client/assets/index-C9uGIJ2-.js +1 -0
  110. package/dist/client/assets/{index-BY2TC4bG.js → index-CGoh8mx2.js} +2 -2
  111. package/dist/client/assets/{index-C3Ab2DJ2.js → index-D0U_smqt.js} +29 -29
  112. package/dist/client/assets/{index-BQXvSs-s.js → index-DHLJyA5u.js} +3 -3
  113. package/dist/client/assets/{index-C4w1u5Cz.js → index-D_UY8Zf9.js} +1 -1
  114. package/dist/client/assets/{index-WHuW26DU.js → index-DvTimAjS.js} +12 -12
  115. package/dist/client/assets/{index-redirect-DHc9uFFV.js → index-redirect-CPy0Z1T_.js} +1 -1
  116. package/dist/client/assets/{input-BmmiCY6T.js → input-Ccm3ShdT.js} +1 -1
  117. package/dist/client/assets/{integration-icon-CFvT6ZpF.js → integration-icon-BjRqMG3n.js} +1 -1
  118. package/dist/client/assets/label-KRKjsQLR.js +1 -0
  119. package/dist/client/assets/login-B5WUG2bv.js +1 -0
  120. package/dist/client/assets/{mcp-oauth-BGmk7Mi5.js → mcp-oauth-Ccqa98JF.js} +1 -1
  121. package/dist/client/assets/{members-DO2LVAyy.js → members-BwXKPt6c.js} +2 -2
  122. package/dist/client/assets/{monaco-editor-yw8USVwR.js → monaco-editor-DztiaMte.js} +1 -1
  123. package/dist/client/assets/{monitoring-stats-row-BuR-EBQ0.js → monitoring-stats-row-DY_Jk7Qu.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-wtZvQiOu.js → oauth-callback-B5Sy5Cax.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-17H-B-SW.js → oauth-callback-ai-provider-DFLSFrMH.js} +1 -1
  126. package/dist/client/assets/onboarding-tnqH6jke.js +1 -0
  127. package/dist/client/assets/{org-install-e7rNwps-.js → org-install-CMfEhUPU.js} +1 -1
  128. package/dist/client/assets/org-layout-DWTGapvu.js +1 -0
  129. package/dist/client/assets/organization-choice-BhcilQzG.js +1 -0
  130. package/dist/client/assets/{page-seo-form-BgMsVAcV.js → page-seo-form-CworrxTj.js} +1 -1
  131. package/dist/client/assets/page-seo-sheet-CU9OHYe8.js +1 -0
  132. package/dist/client/assets/popover-CQIMDVug.js +1 -0
  133. package/dist/client/assets/post-editor-BgM1RATm.js +1 -0
  134. package/dist/client/assets/preview-dialog-CJENsRWm.js +5 -0
  135. package/dist/client/assets/{primitives-BcfJna5s.js → primitives-qIzOEfAk.js} +1 -1
  136. package/dist/client/assets/profile-B0-E7bKd.js +1 -0
  137. package/dist/client/assets/project-app-view-CMI1MfV-.js +1 -0
  138. package/dist/client/assets/record-editor-DGdCVdoZ.js +1 -0
  139. package/dist/client/assets/registry-D-K5v381.js +2 -0
  140. package/dist/client/assets/{registry-layout-t_GwGR-W.js → registry-layout-Cy0i7eVL.js} +4 -4
  141. package/dist/client/assets/require-capability-D9TOSbgf.js +1 -0
  142. package/dist/client/assets/required-auth-layout-D9FVCOQl.js +1 -0
  143. package/dist/client/assets/{reset-password-CPoVJQh2.js → reset-password-m90-iQba.js} +1 -1
  144. package/dist/client/assets/roles-m5faIEUW.js +1 -0
  145. package/dist/client/assets/save-referenced-block-CtS93Zrw.js +1 -0
  146. package/dist/client/assets/save-status-Dr27404A.js +1 -0
  147. package/dist/client/assets/{schema-form-D8_e7uDj.js → schema-form-Bpex2GV2.js} +1 -1
  148. package/dist/client/assets/{scroll-area-DwqNfKe5.js → scroll-area-DbztbmuO.js} +7 -7
  149. package/dist/client/assets/{search-input-DjHO_xeh.js → search-input-C742tJr8.js} +1 -1
  150. package/dist/client/assets/secrets-DbY4hLUu.js +1 -0
  151. package/dist/client/assets/{sections-editor-D8YHUjur.js → sections-editor-DJuNcR6f.js} +2 -2
  152. package/dist/client/assets/select-COSJe-70.js +1 -0
  153. package/dist/client/assets/{select-model-4ZBcZdkE.js → select-model-Cv_gN_vr.js} +1 -1
  154. package/dist/client/assets/seo-editor-ynZ80zTU.js +1 -0
  155. package/dist/client/assets/settings-layout-D5cpx9f5.js +1 -0
  156. package/dist/client/assets/{settings-section-Dxa_AxFP.js → settings-section-C-zTpCRT.js} +1 -1
  157. package/dist/client/assets/{sheet-COdJ-0Qy.js → sheet-CuyenB5M.js} +1 -1
  158. package/dist/client/assets/shell-controls-fwD6Be98.js +1 -0
  159. package/dist/client/assets/shell-layout-BhblvLd4.js +1 -0
  160. package/dist/client/assets/shell-route-loading-ClsKn-Oj.js +1 -0
  161. package/dist/client/assets/{sidebar-DCgpgzJu.js → sidebar-BYFEz6-7.js} +1 -1
  162. package/dist/client/assets/skeleton-DHas8e4O.js +1 -0
  163. package/dist/client/assets/{sortable.esm-LmSoSdxy.js → sortable.esm-CtBH0PGw.js} +1 -1
  164. package/dist/client/assets/sso-BFO9vLZv.js +1 -0
  165. package/dist/client/assets/{store-Dj11zgxF.js → store-C9F0E0yc.js} +1 -1
  166. package/dist/client/assets/store-registry-D8kCyVob.js +2 -0
  167. package/dist/client/assets/studio-tools-DO12gBMa.js +1 -0
  168. package/dist/client/assets/switch-By8vCxNg.js +1 -0
  169. package/dist/client/assets/table-BgkbBxMz.js +1 -0
  170. package/dist/client/assets/{tabs-BcUIMPwc.js → tabs-DPoZSyfS.js} +1 -1
  171. package/dist/client/assets/{task-status-BfQltC__.js → task-status-D9k3BLzM.js} +1 -1
  172. package/dist/client/assets/textarea-DQwh6y_K.js +1 -0
  173. package/dist/client/assets/{toggle-group-Cp4C3_lM.js → toggle-group-CW5GRzAp.js} +1 -1
  174. package/dist/client/assets/{toolbar-DyjTkAru.js → toolbar-1QmqWl6-.js} +1 -1
  175. package/dist/client/assets/tooltip-DO1R3Vmb.js +1 -0
  176. package/dist/client/assets/{types-7ak1Ve40.js → types-pBNKtzBp.js} +1 -1
  177. package/dist/client/assets/{use-ai-providers-CC3uGtbf.js → use-ai-providers-qobt2OiH.js} +1 -1
  178. package/dist/client/assets/{use-automations-D2hKtMe8.js → use-automations-BwoNV2me.js} +1 -1
  179. package/dist/client/assets/use-capability-C09ZF9_G.js +1 -0
  180. package/dist/client/assets/{use-clock-tick-SbPzFjh0.js → use-clock-tick-_1lW4UqP.js} +1 -1
  181. package/dist/client/assets/{use-collections-DrlB7sAG.js → use-collections-DRgt6Bb8.js} +1 -1
  182. package/dist/client/assets/use-connection-XfA-QrSw.js +1 -0
  183. package/dist/client/assets/use-copy-DyplBFAe.js +1 -0
  184. package/dist/client/assets/use-create-virtual-mcp-BJFWHgGz.js +1 -0
  185. package/dist/client/assets/{use-debounced-autosave-C4B5942u.js → use-debounced-autosave-DqciCJ__.js} +1 -1
  186. package/dist/client/assets/use-deco-credits-CyoNix9p.js +1 -0
  187. package/dist/client/assets/{use-delete-connection-C_lUSAxo.js → use-delete-connection-CweyK7E_.js} +1 -1
  188. package/dist/client/assets/use-file-configs-OLHA7dwa.js +1 -0
  189. package/dist/client/assets/{use-infinite-scroll-CaTJY2LS.js → use-infinite-scroll-BbUZw7ju.js} +1 -1
  190. package/dist/client/assets/{use-join-requests-Bf6--Yng.js → use-join-requests-CHh2Zrhx.js} +1 -1
  191. package/dist/client/assets/use-mcp-client-DilmxmKU.js +10 -0
  192. package/dist/client/assets/{use-mcp-prompts-5xEBY9_7.js → use-mcp-prompts-D2ueJ3CD.js} +1 -1
  193. package/dist/client/assets/{use-mcp-tools-CYtQa-6Z.js → use-mcp-tools-uucJgbkt.js} +1 -1
  194. package/dist/client/assets/{use-members-BWyLHt4a.js → use-members-Y5iRty7v.js} +1 -1
  195. package/dist/client/assets/use-navigate-to-agent-HvaD8xDj.js +1 -0
  196. package/dist/client/assets/{use-org-auth-client-Blpkj8FB.js → use-org-auth-client-Dl_7zTlg.js} +1 -1
  197. package/dist/client/assets/{use-org-sso-CEQ82hSZ.js → use-org-sso-9Z0u5sV3.js} +1 -1
  198. package/dist/client/assets/{use-organization-roles-lBgqu0F4.js → use-organization-roles-C8kGFpoE.js} +1 -1
  199. package/dist/client/assets/use-organization-settings-B5vS3xHV.js +1 -0
  200. package/dist/client/assets/{use-registry-connections-CK9xDmAR.js → use-registry-connections-DhFpf503.js} +1 -1
  201. package/dist/client/assets/use-secrets-DtlQfYRK.js +1 -0
  202. package/dist/client/assets/{use-status-sounds-C5Tq4YPI.js → use-status-sounds-BSqGti4P.js} +1 -1
  203. package/dist/client/assets/{use-view-mode-Dz9A7efZ.js → use-view-mode-Cc4A86jX.js} +1 -1
  204. package/dist/client/assets/{use-virtual-mcp-Bc7GdFZa.js → use-virtual-mcp-cixi9WNo.js} +1 -1
  205. package/dist/client/assets/useInfiniteQuery-C4arjVN1.js +1 -0
  206. package/dist/client/assets/useSuspenseInfiniteQuery-DTlBviqw.js +1 -0
  207. package/dist/client/assets/variant-calendar-BtDF6xbX.js +1 -0
  208. package/dist/client/assets/view-mode-toggle-BNmCyKXO.js +1 -0
  209. package/dist/client/index.html +1 -1
  210. package/dist/server/cli.js +509 -506
  211. package/dist/server/server.js +318 -318
  212. package/package.json +1 -1
  213. package/dist/client/assets/ChevronUp-CiXMtnii.js +0 -1
  214. package/dist/client/assets/XCircle-DRGwo6Em.js +0 -1
  215. package/dist/client/assets/add-section-modal-CwlL6ayr.js +0 -1
  216. package/dist/client/assets/agent-icon-D5EbntAT.js +0 -1
  217. package/dist/client/assets/agents-list-DOj0Fh6v.js +0 -1
  218. package/dist/client/assets/ai-providers-D2FalLjO.js +0 -1
  219. package/dist/client/assets/app-editor-DH47BAx3.js +0 -1
  220. package/dist/client/assets/automations-C8R4Fvhm.js +0 -1
  221. package/dist/client/assets/buckets-BNXQ-vfY.js +0 -1
  222. package/dist/client/assets/category-editor-511TL03p.js +0 -1
  223. package/dist/client/assets/chat-context-BNtznWGC.js +0 -21
  224. package/dist/client/assets/checkbox-I3IyJWnj.js +0 -1
  225. package/dist/client/assets/collection-detail-CqdkHGGR.js +0 -1
  226. package/dist/client/assets/collection-display-button-C3NMWQ0u.js +0 -1
  227. package/dist/client/assets/connect-desktop-dialog-BgIjMJ8k.js +0 -1
  228. package/dist/client/assets/connection-detail-BljhUTi8.js +0 -1
  229. package/dist/client/assets/connections-BxfE7CNZ.js +0 -1
  230. package/dist/client/assets/context-menu-CUB1yHM7.js +0 -1
  231. package/dist/client/assets/decopilot-sse-pool-BkzSWgw-.js +0 -1
  232. package/dist/client/assets/dialog-CyIn0DRx.js +0 -1
  233. package/dist/client/assets/drawer-DFg9xgM4.js +0 -1
  234. package/dist/client/assets/dropdown-menu-kPcoeCiJ.js +0 -1
  235. package/dist/client/assets/file-explorer-DqjZVlFC.js +0 -2
  236. package/dist/client/assets/general-DiEcrxnP.js +0 -1
  237. package/dist/client/assets/image-field-CodUWKZv.js +0 -1
  238. package/dist/client/assets/index-CE5zniob.js +0 -1
  239. package/dist/client/assets/index-DCOB_mfs.js +0 -1
  240. package/dist/client/assets/label-DitP_QKf.js +0 -1
  241. package/dist/client/assets/login-B5Epw0z9.js +0 -1
  242. package/dist/client/assets/onboarding-BoQhKI2i.js +0 -1
  243. package/dist/client/assets/org-layout-BMfkaVCj.js +0 -1
  244. package/dist/client/assets/page-seo-sheet-DeiY4L_a.js +0 -1
  245. package/dist/client/assets/popover-BcAFMnrn.js +0 -1
  246. package/dist/client/assets/post-editor-B7uc8ZWG.js +0 -1
  247. package/dist/client/assets/preview-dialog-CWq_MXwm.js +0 -5
  248. package/dist/client/assets/profile-D0fa1gEu.js +0 -1
  249. package/dist/client/assets/project-app-view-CXpwRwLv.js +0 -1
  250. package/dist/client/assets/record-editor-Ct33qGpE.js +0 -1
  251. package/dist/client/assets/registry-BIqKm9sP.js +0 -2
  252. package/dist/client/assets/require-capability-CoJVffIR.js +0 -1
  253. package/dist/client/assets/required-auth-layout-B3CS-pLH.js +0 -1
  254. package/dist/client/assets/roles-Kqs8iopc.js +0 -1
  255. package/dist/client/assets/save-referenced-block-rb2uyE9z.js +0 -1
  256. package/dist/client/assets/save-status-C9PbQUEN.js +0 -1
  257. package/dist/client/assets/secrets-Dlj_raMe.js +0 -1
  258. package/dist/client/assets/select-Di6xzzYo.js +0 -1
  259. package/dist/client/assets/seo-editor-C9cdDir2.js +0 -1
  260. package/dist/client/assets/settings-layout-DR15Rbl6.js +0 -1
  261. package/dist/client/assets/shell-controls-Cw8j2a_F.js +0 -1
  262. package/dist/client/assets/shell-layout-DmxTk-Cg.js +0 -1
  263. package/dist/client/assets/shell-route-loading-DW_liPbt.js +0 -1
  264. package/dist/client/assets/skeleton-CZ9pOveV.js +0 -1
  265. package/dist/client/assets/sso-BJQWPrvg.js +0 -1
  266. package/dist/client/assets/store-registry-BXdj_bIJ.js +0 -2
  267. package/dist/client/assets/studio-tools-DRut7Wwk.js +0 -1
  268. package/dist/client/assets/switch-sHkW6RUp.js +0 -1
  269. package/dist/client/assets/table-BUxYcsuG.js +0 -1
  270. package/dist/client/assets/textarea-D8B22gmM.js +0 -1
  271. package/dist/client/assets/tooltip-2IhfImXT.js +0 -1
  272. package/dist/client/assets/use-capability-CU6DCnG3.js +0 -1
  273. package/dist/client/assets/use-connection-Dffadu_t.js +0 -1
  274. package/dist/client/assets/use-copy-Btaqep1K.js +0 -1
  275. package/dist/client/assets/use-create-virtual-mcp-D6wTKoFC.js +0 -1
  276. package/dist/client/assets/use-deco-credits-16Jb7c03.js +0 -1
  277. package/dist/client/assets/use-file-configs-qOKR17qO.js +0 -1
  278. package/dist/client/assets/use-mcp-client-BdKIOTso.js +0 -10
  279. package/dist/client/assets/use-navigate-to-agent-BTMo9com.js +0 -1
  280. package/dist/client/assets/use-organization-settings--a-kmsBC.js +0 -1
  281. package/dist/client/assets/use-secrets-B008jqWi.js +0 -1
  282. package/dist/client/assets/useInfiniteQuery-Ca6dlOLl.js +0 -1
  283. package/dist/client/assets/useRouterState-DgLuS94C.js +0 -1
  284. package/dist/client/assets/useSuspenseInfiniteQuery-CZbIaY66.js +0 -1
  285. package/dist/client/assets/variant-calendar-DgzKgoL6.js +0 -1
  286. package/dist/client/assets/view-mode-toggle-Cc6sYskX.js +0 -1
@@ -1 +0,0 @@
1
- import{e as se,j as s,B as Z,p as me,r as Y,t as v,n as de}from"./index-C3Ab2DJ2.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-kPcoeCiJ.js";import{s as pe}from"./Star01-BfSEPDRT.js";import{a as fe}from"./Users03-BOvyNEV4.js";import{a as ge,G as ue}from"./github-repo-picker-CrW8szfE.js";import{S as he,u as xe,H as ie,W as oe,I as je}from"./import-from-deco-dialog-BVpWCCC9.js";import{u as _e,b as Ce,c as be}from"./use-virtual-mcp-Bc7GdFZa.js";import{P as K}from"./index-CszBxeF9.js";import{a as ye}from"./DotsVertical-y5lMfVOQ.js";import{a as Ne}from"./Settings02-B7hO-Tma.js";import{s as Se}from"./Trash01-CG0gTYx7.js";import{A as De,al as ve}from"./agent-icon-D5EbntAT.js";import{m as Ae}from"./use-navigate-to-agent-BTMo9com.js";import{C as ke}from"./card-Ckx3Kwvj.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-CU6DCnG3.js";import{E as Te}from"./empty-state-BrSxZrfZ.js";import{u as ze}from"./use-create-virtual-mcp-D6wTKoFC.js";import{c as Ie,b as Pe,d as He,A as Ee,e as Me,g as Oe,a as Be,f as Ge}from"./alert-dialog-BuJSufuR.js";import{S as $e}from"./search-input-DjHO_xeh.js";import{s as le}from"./Plus-_82_8sq8.js";import"./ChevronUp-CiXMtnii.js";import"./ChevronRight-Dj41DV2U.js";import"./dialog-CyIn0DRx.js";import"./X-CKIhVHQk.js";import"./checkbox-I3IyJWnj.js";import"./collection-search-CCzYANV5.js";import"./SearchMd-C3Pmxf99.js";import"./use-connection-Dffadu_t.js";import"./use-collections-DrlB7sAG.js";import"./use-mcp-client-BdKIOTso.js";import"./auth-tkqpBHf1.js";import"./mcp-oauth-BGmk7Mi5.js";import"./use-mcp-tools-CYtQa-6Z.js";import"./extract-connection-data-CBzjCfJ2.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./tooltip-2IhfImXT.js";import"./sheet-COdJ-0Qy.js";import"./AlertCircle-DMqR3m0L.js";import"./Tool01-B4SsemMS.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./XCircle-DRGwo6Em.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ZapSquare-C7yt7KfQ.js";import"./CheckCircle-D6b8lFUP.js";import"./ChevronDown-CYFvWHpZ.js";import"./ChevronLeft-DXSAgzPw.js";import"./Stars02-9vF61uFx.js";import"./Eye-D3THRXh6.js";import"./ZoomOut-DVSwpwUz.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./Key01-Lcx9qTy7.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Play-C6QgiUls.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Upload01-BlvGy5d-.js";import"./User01-CTuKNCEa.js";import"./Users01-KXiCgru2.js";import"./XClose-Ig7y9gcI.js";import"./Zap-w60sxAoc.js";import"./differenceInSeconds-NQ4PDo0z.js";function ae(t){const e=se.c(29),{onCreateFromScratch:i,onCreateWebsite:D,onCreateHydrogenStore:l,onImportGitHub:S,onImportDeco:f,isCreating:o,align:y,side:g,showBetaBadge:u}=t,h=y===void 0?"end":y;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(fe,{size:14}),e[0]=x):x=e[0];let a;e[1]!==o||e[2]!==i?(a=s.jsxs(k,{disabled:o,onClick:i,children:[x,"Create from scratch"]}),e[1]=o,e[2]=i,e[3]=a):a=e[3];let j;e[4]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(pe,{size:14}),e[4]=j):j=e[4];let n;e[5]!==o||e[6]!==D?(n=s.jsxs(k,{disabled:o,onClick:D,children:[j,"Start Website"]}),e[5]=o,e[6]=D,e[7]=n):n=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx("img",{src:he,alt:"",className:"size-3.5 object-contain"}),e[8]=_):_=e[8];let c;e[9]!==o||e[10]!==l?(c=s.jsxs(k,{disabled:o,onClick:l,children:[_,"Create Shopify Headless Store"]}),e[9]=o,e[10]=l,e[11]=c):c=e[11];let N;e[12]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(ge,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(k,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(k,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(k,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(k,{variant:"destructive",onClick:w=>{w.stopPropagation(),l(w)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(ke,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function os(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=xe(),[h,x]=Y.useState(null),[a,j]=Y.useState(!1),[n,_]=Y.useState(!1),{granted:c}=we("agents:manage"),N=l.toLowerCase(),r=i.filter(d=>d.id!==e.id&&(d.title.toLowerCase().includes(N)||d.description?.toLowerCase().includes(N))),{data:C}=be(r.map(Le));let p;t[1]!==D||t[2]!==h?(p=async()=>{if(!h)return;const{id:d,title:ce}=h;x(null);try{await D.delete.mutateAsync(d),v("agent_deleted",{agent_id:d,source:"agents_list"}),de.success(`Deleted "${ce}"`)}catch{}},t[1]=D,t[2]=h,t[3]=p):p=t[3];const m=p,b=K,A=K,w=K;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(K.Title,{children:"Agents"}),t[4]=F):F=t[4];let L;t[5]===Symbol.for("react.memo_cache_sentinel")?(L=d=>{d.key==="Escape"&&(S(""),d.target.blur())},t[5]=L):L=t[5];let T;t[6]!==l?(T=s.jsx($e,{value:l,onChange:S,placeholder:"Search for an agent...",className:"w-full md:w-[375px]",onKeyDown:L}),t[6]=l,t[7]=T):T=t[7];let z;t[8]!==c||t[9]!==g||t[10]!==o||t[11]!==y||t[12]!==u?(z=c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list",method:"deco"}),j(!0)},isCreating:y||u,align:"end"})]}),t[8]=c,t[9]=g,t[10]=o,t[11]=y,t[12]=u,t[13]=z):z=t[13];let I;t[14]!==T||t[15]!==z?(I=s.jsxs("div",{className:"flex flex-col gap-6",children:[F,s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[T,z]})]}),t[14]=T,t[15]=z,t[16]=I):I=t[16];const q=r.length===0&&s.jsx("div",{className:"flex items-center justify-center py-20",children:s.jsx(Te,{image:s.jsx(ve,{size:48,className:"text-muted-foreground"}),title:l?"No agents found":"No agents yet",description:l?`No agents match "${l}"`:c?"Create an agent to get started.":"Ask an organization admin to create one.",actions:!l&&c&&s.jsxs(te,{children:[s.jsx(ee,{asChild:!0,children:s.jsxs(Z,{size:"sm",children:[s.jsx(le,{size:14}),"Create Agent"]})}),s.jsx(ae,{onCreateFromScratch:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"scratch"}),o()},onCreateWebsite:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"website"}),g(oe)},onCreateHydrogenStore:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"hydrogen"}),g(ie)},onImportGitHub:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"github"}),_(!0)},onImportDeco:()=>{v("agent_create_clicked",{source:"agents_list_empty",method:"deco"}),j(!0)},isCreating:y||u,align:"center",showBetaBadge:!0})]})})}),J=r.length>0&&s.jsxs("div",{className:"mt-6 @container",children:[s.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3",children:"Agents"}),s.jsx("div",{className:"grid grid-cols-1 @lg:grid-cols-2 @4xl:grid-cols-3 @6xl:grid-cols-4 gap-4",children:r.map(d=>s.jsx(Fe,{project:d,lastUsedAt:C?.get(d.id)?.last_used_at,onDeleteClick:c?()=>x({id:d.id,title:d.title}):void 0},d.id))})]});let P;t[17]!==J||t[18]!==w.Body||t[19]!==I||t[20]!==q?(P=s.jsxs(w.Body,{children:[I,q,J]}),t[17]=J,t[18]=w.Body,t[19]=I,t[20]=q,t[21]=P):P=t[21];let H;t[22]!==P||t[23]!==A.Content?(H=s.jsx(A.Content,{children:P}),t[22]=P,t[23]=A.Content,t[24]=H):H=t[24];let E;t[25]!==n?(E=s.jsx(ue,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{os as default};
@@ -1 +0,0 @@
1
- import{s as B,v as N,aB as ae,aD as le,aE as he,aC as xe,b2 as me,e as U,w as ge,x as be,r as O,j as s,ad as Ee,n as G,ac as ye,p as re,F as oe,a as J,K as Q,m as ve,c as ue,B as V,t as je,a1 as $e}from"./index-C3Ab2DJ2.js";import{i as Fe}from"./AlertCircle-DMqR3m0L.js";import{P as te}from"./index-CszBxeF9.js";import{S as ne}from"./skeleton-CZ9pOveV.js";import{b as _e,a as ce,S as de,c as Re}from"./settings-section-Dxa_AxFP.js";import{u as X,b as se,c as Se}from"./use-ai-providers-CC3uGtbf.js";import{i as Oe}from"./CheckCircle-D6b8lFUP.js";import{i as Me,j as Te,p as Ue,S as ze}from"./chat-context-BNtznWGC.js";import{d as qe,e as Le}from"./use-organization-settings--a-kmsBC.js";import{M as Ve}from"./select-model-4ZBcZdkE.js";import{u as Be}from"./use-debounced-autosave-C4B5942u.js";import{I as ie}from"./input-BmmiCY6T.js";import{a as fe,T as Qe}from"./toggle-group-Cp4C3_lM.js";import{b as ke,c as Ie,d as Ce,A as Ne,a as Pe,e as we,g as De,f as Ae}from"./alert-dialog-BuJSufuR.js";import{u as H}from"./studio-tools-DRut7Wwk.js";import{s as Ge}from"./Plus-_82_8sq8.js";import{i as Ye}from"./Tool01-B4SsemMS.js";import{s as We}from"./Trash01-CG0gTYx7.js";import{A as He}from"./avatar-DfTXVgX9.js";import{O as Ke,P as Je,C as pe}from"./decopilot-D6xQ1qh2.js";import{b as Xe}from"./Settings02-B7hO-Tma.js";import{s as Ze}from"./Eye-D3THRXh6.js";import{e as et,D as tt,a as st,c as it,d as rt}from"./dialog-CyIn0DRx.js";import{f as ot}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as lt}from"./require-capability-CoJVffIR.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./tooltip-2IhfImXT.js";import"./sheet-COdJ-0Qy.js";import"./X-CKIhVHQk.js";import"./card-Ckx3Kwvj.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./hooks-DLdyjUhZ.js";import"./use-mcp-client-BdKIOTso.js";import"./auth-tkqpBHf1.js";import"./decopilot-sse-pool-BkzSWgw-.js";import"./use-virtual-mcp-Bc7GdFZa.js";import"./use-collections-DrlB7sAG.js";import"./tab-id-BptcWVWa.js";import"./drawer-DFg9xgM4.js";import"./connect-desktop-dialog-BgIjMJ8k.js";import"./ChevronUp-CiXMtnii.js";import"./User01-CTuKNCEa.js";import"./checkbox-I3IyJWnj.js";import"./select-Di6xzzYo.js";import"./ChevronDown-CYFvWHpZ.js";import"./Key01-Lcx9qTy7.js";import"./SearchMd-C3Pmxf99.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-L6hrk62b.js";import"./ChevronRight-Dj41DV2U.js";import"./Stars01-W6Wl0Pse.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-CU6DCnG3.js";import"./access-gate-CEtgmlCt.js";import"./capability-load-error-BXEh1mp-.js";B({title:N(),url:N(),icon:N()});B({registries:le(N(),B({enabled:he()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ae(N()).describe("List of MCP app_name or app_id values to hide from the store.")});const W=B({keyId:N(),modelId:N(),title:N().optional()}).nullable();xe(["fast","smart","thinking","image","web_search","deep_research"]);xe(["fast","smart","thinking"]);const at=B({tiers:B({fast:W,smart:W,thinking:W,image:W,web_search:W,deep_research:W})});B({ids:ae(N()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});B({id:N().describe("Brand context ID"),name:N().describe("Company name"),domain:N().describe("Company domain (e.g. example.com)"),overview:N().describe("Company overview / description"),logo:N().nullable().optional().describe("Logo URL"),favicon:N().nullable().optional().describe("Favicon URL"),ogImage:N().nullable().optional().describe("OG image URL"),fonts:B({heading:N().optional().describe("Font family for headings"),body:N().optional().describe("Font family for body text"),code:N().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:B({primary:N().optional().describe("Primary brand color (hex)"),secondary:N().optional().describe("Secondary brand color (hex)"),accent:N().optional().describe("Accent / highlight color (hex)"),background:N().optional().describe("Background color (hex)"),foreground:N().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ae(le(N(),me())).nullable().optional().describe("Brand images"),metadata:le(N(),me()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:N().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:he().optional().describe("Whether this is the default brand for the organization")});const nt=e=>e.capabilities?.includes("image")===!0,ct=e=>Me(e),dt=e=>Te(e),mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:nt},{key:"web_search",label:"Web search",description:"Quick, up-to-date answers from the web",filter:ct},{key:"deep_research",label:"Deep research",description:"In-depth, multi-source research reports",filter:dt}];function ut(e){const t=U.c(20),{slot:i,onSlotChange:a,filterModels:r,defaultKeyId:l}=e,o=X(),[x,S]=O.useState(i?.keyId??l);let b;t[0]!==i?(b=()=>{i?.keyId&&S(i.keyId)},t[0]=i,t[1]=b):b=t[1];const d=i?.keyId;let n;t[2]!==d?(n=[d],t[2]=d,t[3]=n):n=t[3],O.useEffect(b,n);const m=x??l;let c;t[4]!==m||t[5]!==o?(c=m?o.find(y=>y.id===m):null,t[4]=m,t[5]=o,t[6]=c):c=t[6];const u=c,{models:g,isLoading:j}=se(r?m??void 0:void 0),_=r?j||g.some(r):!0;let f;t[7]!==i||t[8]!==u?.providerId?(f=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:u?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=u?.providerId,t[9]=f):f=t[9];const k=f;if(r&&!_){let y;return t[10]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=y):y=t[10],y}let I;t[11]===Symbol.for("react.memo_cache_sentinel")?(I=y=>S(y),t[11]=I):I=t[11];let h;t[12]!==m||t[13]!==a?(h=y=>{const F=y.keyId??m??"";S(F),a({keyId:F,modelId:y.modelId,title:y.title})},t[12]=m,t[13]=a,t[14]=h):h=t[14];let p;return t[15]!==m||t[16]!==r||t[17]!==k||t[18]!==h?(p=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:k,credentialId:m,filterModels:r,onCredentialChange:I,onModelChange:h}),t[15]=m,t[16]=r,t[17]=k,t[18]=h,t[19]=p):p=t[19],p}function ft(e){const t=U.c(2),{isPending:i,showSaved:a}=e;if(i){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(ye,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=r):r=t[0],r}if(a){let r;return t[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Oe,{size:12}),"Saved"]}),t[1]=r):r=t[1],r}return null}function pt(){const e=U.c(42),t=X(),i=qe(),a=t.length>0;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=ge(at),e[0]=r):r=e[0];let l;e[1]!==i?(l={resolver:r,values:i,mode:"onChange"},e[1]=i,e[2]=l):l=e[2];const o=be(l),{mutate:x,isPending:S,isSuccess:b}=Le(),d=o.formState.isDirty;let n;e[3]!==o||e[4]!==i||e[5]!==x?(n={delayMs:250,save:async()=>{const v=o.getValues();x(v,{onSuccess:()=>o.reset(v,{keepValues:!0}),onError:w=>{o.reset(i),G.error(`Failed to save: ${w.message}`)}})}},e[3]=o,e[4]=i,e[5]=x,e[6]=n):n=e[6];const{schedule:m}=Be(n),c=t[0],u=t[1],g=t[2],{models:j}=se(c?.id),{models:_}=se(u?.id),{models:f}=se(g?.id);let k,I;e[7]!==o||e[8]!==a?(k=()=>{a||o.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}})},I=[a,o],e[7]=o,e[8]=a,e[9]=k,e[10]=I):(k=e[9],I=e[10]),O.useEffect(k,I);let h;e[11]!==t||e[12]!==o||e[13]!==c||e[14]!==u||e[15]!==g||e[16]!==j||e[17]!==_||e[18]!==f?(h=()=>{const v=o.getValues(),w=new Set(t.map(ht)),$={};c?.id&&($[c.id]=j),u?.id&&($[u.id]=_),g?.id&&($[g.id]=f);const P=Y=>Y!=null&&!w.has(Y.keyId),C={fast:P(v.tiers.fast)?null:v.tiers.fast,smart:P(v.tiers.smart)?null:v.tiers.smart,thinking:P(v.tiers.thinking)?null:v.tiers.thinking,image:P(v.tiers.image)?null:v.tiers.image,web_search:P(v.tiers.web_search)?null:v.tiers.web_search,deep_research:P(v.tiers.deep_research)?null:v.tiers.deep_research},q=!C.fast||!C.smart||!C.thinking||!C.image||!C.web_search||!C.deep_research,z=C.fast===v.tiers.fast&&C.smart===v.tiers.smart&&C.thinking===v.tiers.thinking&&C.image===v.tiers.image&&C.web_search===v.tiers.web_search&&C.deep_research===v.tiers.deep_research;if(!q&&z)return;const L=Ue(t,$);o.reset({tiers:{fast:C.fast??L.chat.fast,smart:C.smart??L.chat.smart,thinking:C.thinking??L.chat.thinking,image:C.image??L.image,web_search:C.web_search??L.webSearch,deep_research:C.deep_research??L.deepResearch}},{keepDirty:!0})},e[11]=t,e[12]=o,e[13]=c,e[14]=u,e[15]=g,e[16]=j,e[17]=_,e[18]=f,e[19]=h):h=e[19];const p=c?.id,y=u?.id,F=g?.id;let M;e[20]!==t||e[21]!==o||e[22]!==j||e[23]!==_||e[24]!==f||e[25]!==p||e[26]!==y||e[27]!==F?(M=[o,t,j,_,f,p,y,F],e[20]=t,e[21]=o,e[22]=j,e[23]=_,e[24]=f,e[25]=p,e[26]=y,e[27]=F,e[28]=M):M=e[28],O.useEffect(h,M);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const R=b&&!d;let D;e[30]!==S||e[31]!==R?(D=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(ft,{isPending:S,showSaved:R})]}),e[30]=S,e[31]=R,e[32]=D):D=e[32];let A;e[33]!==t[0]?.id||e[34]!==o.control||e[35]!==m?(A=mt.map(v=>s.jsx(Ee,{control:o.control,name:`tiers.${v.key}`,render:w=>{const{field:$}=w;return s.jsx(_e,{title:v.label,description:v.description,action:s.jsx(ut,{slot:$.value,defaultKeyId:t[0]?.id??null,filterModels:v.filter,onSlotChange:P=>{$.onChange(P),m()}})})}},v.key)),e[33]=t[0]?.id,e[34]=o.control,e[35]=m,e[36]=A):A=e[36];let K;e[37]!==A?(K=s.jsx(ce,{children:A}),e[37]=A,e[38]=K):K=e[38];let E;return e[39]!==D||e[40]!==K?(E=s.jsxs(de,{title:"Default models",headerClassName:"pl-0",children:[D,K]}),e[39]=D,e[40]=K,e[41]=E):E=e[41],E}function ht(e){return e.id}const xt={usd:[10,20,100],brl:[50,100,500]};function gt(){const e=U.c(26),t=H(),[i,a]=O.useState(!1),{mutate:r,isPending:l}=J({mutationFn:async h=>{const{url:p}=await t.call("AI_PROVIDER_TOPUP_URL",{providerId:"deco",amountCents:h,currency:d});return p},onSuccess:yt,onError:bt}),[o,x]=O.useState(""),[S,b]=O.useState("usd"),d=S,n=parseFloat(o),m=!isNaN(n)&&n>=1,c=d==="brl"?"R$":"$";let u;e[0]!==b?(u=h=>{h&&b(h)},e[0]=b,e[1]=u):u=e[1];let g,j;e[2]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(fe,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),j=s.jsx(fe,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[2]=g,e[3]=j):(g=e[2],j=e[3]);let _;e[4]!==d||e[5]!==u?(_=s.jsxs(Qe,{type:"single",variant:"outline",size:"default",value:d,onValueChange:u,children:[g,j]}),e[4]=d,e[5]=u,e[6]=_):_=e[6];let f;e[7]!==d||e[8]!==c||e[9]!==i||e[10]!==l||e[11]!==r?(f=!i&&s.jsxs(s.Fragment,{children:[xt[d].map(h=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:l,onClick:()=>r(h*100),children:[c,h]},h)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:l,children:"Custom"})]}),e[7]=d,e[8]=c,e[9]=i,e[10]=l,e[11]=r,e[12]=f):f=e[12];let k;e[13]!==c||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==m||e[18]!==l||e[19]!==x||e[20]!==r?(k=i&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:c}),s.jsx(ie,{type:"number",min:"1",step:"1",placeholder:"50",value:o,onChange:h=>x(h.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!m||l,onClick:()=>r(Math.round(n*100)),children:l?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),x("")},children:"Cancel"})]}),e[13]=c,e[14]=o,e[15]=n,e[16]=i,e[17]=m,e[18]=l,e[19]=x,e[20]=r,e[21]=k):k=e[21];let I;return e[22]!==_||e[23]!==f||e[24]!==k?(I=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[_,f,k]})}),e[22]=_,e[23]=f,e[24]=k,e[25]=I):I=e[25],I}function bt(e){G.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function jt(){const e=U.c(58),{org:t}=re(),i=H(),a=oe(),r=X();let l;e[0]!==r?(l=r.find(St),e[0]=r,e[1]=l):l=e[1];const o=l,[x,S]=O.useState(!1);let b;e[2]!==o||e[3]!==i?(b=async()=>{o&&await i.call("AI_PROVIDER_KEY_DELETE",{keyId:o.id})},e[2]=o,e[3]=i,e[4]=b):b=e[4];let d;e[5]!==t.id||e[6]!==a?(d=()=>{a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway disconnected"),S(!1)},e[5]=t.id,e[6]=a,e[7]=d):d=e[7];let n;e[8]!==b||e[9]!==d?(n={mutationFn:b,onSuccess:d,onError:_t},e[8]=b,e[9]=d,e[10]=n):n=e[10];const{mutate:m,isPending:c}=J(n);let u;e[11]!==t.id?(u=Q.aiProviderCredits(t.id,"deco"),e[11]=t.id,e[12]=u):u=e[12];const g=!!o;let j;e[13]!==i?(j=async()=>{try{return await i.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}},e[13]=i,e[14]=j):j=e[14];let _;e[15]!==u||e[16]!==g||e[17]!==j?(_={queryKey:u,enabled:g,staleTime:6e4,queryFn:j},e[15]=u,e[16]=g,e[17]=j,e[18]=_):_=e[18];const{data:f,isLoading:k,refetch:I,isFetching:h}=ve(_);if(!o)return null;const p=f?.balanceCents!=null?f.balanceCents/100:null;let y;e[19]!==p?(y=p!=null?`$${p.toFixed(2)}`:"—",e[19]=p,e[20]=y):y=e[20];const F=y;let M;e[21]===Symbol.for("react.memo_cache_sentinel")?(M=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[21]=M):M=e[21];let T;e[22]===Symbol.for("react.memo_cache_sentinel")?(T=()=>S(!0),e[22]=T):T=e[22];let R;e[23]!==c?(R=s.jsxs("div",{className:"flex items-center justify-between",children:[M,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:T,disabled:c,children:"Disconnect"})]}),e[23]=c,e[24]=R):R=e[24];let D;e[25]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(ke,{children:[s.jsx(Ie,{children:"Disconnect Deco AI Gateway"}),s.jsx(Ce,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[25]=D):D=e[25];let A;e[26]===Symbol.for("react.memo_cache_sentinel")?(A=s.jsx(Ne,{children:"Cancel"}),e[26]=A):A=e[26];let K;e[27]!==m?(K=s.jsxs(Pe,{children:[D,s.jsxs(we,{children:[A,s.jsx(De,{onClick:()=>m(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[27]=m,e[28]=K):K=e[28];let E;e[29]!==x||e[30]!==K?(E=s.jsx(Ae,{open:x,onOpenChange:S,children:K}),e[29]=x,e[30]=K,e[31]=E):E=e[31];let v;e[32]!==p||e[33]!==F||e[34]!==h||e[35]!==k?(v=k||h?s.jsx(ne,{className:"h-9 w-24"}):s.jsx("span",{className:ue("text-3xl font-semibold tabular-nums tracking-tight",p!=null&&vt(p)),children:F}),e[32]=p,e[33]=F,e[34]=h,e[35]=k,e[36]=v):v=e[36];let w;e[37]!==I?(w=()=>I(),e[37]=I,e[38]=w):w=e[38];const $=h&&"animate-spin";let P;e[39]!==$?(P=ue($),e[39]=$,e[40]=P):P=e[40];let C;e[41]!==P?(C=s.jsx(ye,{size:14,className:P}),e[41]=P,e[42]=C):C=e[42];let q;e[43]!==h||e[44]!==w||e[45]!==C?(q=s.jsx("button",{type:"button",onClick:w,disabled:h,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:C}),e[43]=h,e[44]=w,e[45]=C,e[46]=q):q=e[46];let z;e[47]!==v||e[48]!==q?(z=s.jsxs("div",{className:"flex items-baseline gap-2",children:[v,q]}),e[47]=v,e[48]=q,e[49]=z):z=e[49];let L;e[50]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[50]=L):L=e[50];let Y;e[51]!==z?(Y=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[z,L]}),e[51]=z,e[52]=Y):Y=e[52];let Z;e[53]===Symbol.for("react.memo_cache_sentinel")?(Z=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(gt,{})]}),e[53]=Z):Z=e[53];let ee;return e[54]!==R||e[55]!==E||e[56]!==Y?(ee=s.jsx(de,{title:"Deco AI Gateway",children:s.jsx(ce,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[R,E,Y,Z]})})}),e[54]=R,e[55]=E,e[56]=Y,e[57]=ee):ee=e[57],ee}function _t(e){G.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function kt(){const e=U.c(8),{org:t}=re(),i=H(),a=oe();let r;e[0]!==i?(r=async()=>{await i.call("AI_PROVIDER_PROVISION_KEY",{providerId:"deco"})},e[0]=i,e[1]=r):r=e[1];let l;e[2]!==t||e[3]!==a?(l=()=>{je("ai_provider_provision_succeeded",{provider_id:"deco"}),a.invalidateQueries({queryKey:Q.aiProviderKeys(t.id)}),a.invalidateQueries({queryKey:Q.aiProviders(t.id)}),G.success("Deco AI Gateway connected successfully")},e[2]=t,e[3]=a,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o={mutationFn:r,onSuccess:l,onError:It},e[5]=r,e[6]=l,e[7]=o):o=e[7],J(o)}function It(e){je("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),G.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=U.c(10),{mutate:t,isPending:i}=kt();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=a):a=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:a.join(", ")}}),e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=l):l=e[2];let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=o):o=e[3];let x;e[4]!==t?(x=()=>t(),e[4]=t,e[5]=x):x=e[5];const S=i?"Connecting…":"Connect Deco";let b;return e[6]!==i||e[7]!==x||e[8]!==S?(b=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[r,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[l,o,s.jsx(V,{variant:"outline",disabled:i,onClick:x,children:S})]})]}),e[6]=i,e[7]=x,e[8]=S,e[9]=b):b=e[9],b}const Nt=B({label:N().min(1,"Label is required").max(100),apiKey:N().optional(),baseUrl:N().optional()});function Pt({providerKey:e,provider:t,preset:i,maskedKey:a,currentLabel:r,currentBaseUrl:l,onCancel:o,onSuccess:x}){const{org:S}=re(),b=H(),d=oe(),[n,m]=O.useState(!1),c=t.id==="openai-compatible",u=t.supportedMethods.includes("api-key"),{register:g,handleSubmit:j,watch:_,formState:{errors:f}}=be({resolver:ge(Nt),defaultValues:{label:r,apiKey:"",baseUrl:l??""}}),k=_("apiKey")??"",{mutate:I,isPending:h}=J({mutationFn:async p=>{let y;p.apiKey?c?y=JSON.stringify({baseUrl:p.baseUrl||l||"",apiKey:p.apiKey}):y=p.apiKey:c&&p.baseUrl&&p.baseUrl!==l&&(y=JSON.stringify({baseUrl:p.baseUrl,apiKey:""})),await b.call("AI_PROVIDER_KEY_UPDATE",{keyId:e.id,label:p.label,...y!==void 0?{apiKey:y}:{}})},onSuccess:()=>{d.invalidateQueries({queryKey:Q.aiProviderKeys(S.id)}),d.invalidateQueries({queryKey:Q.aiProviders(S.id)}),G.success("Provider updated"),x()},onError:p=>G.error(`Failed to update: ${p.message}`)});return s.jsxs("form",{onSubmit:j(p=>I(p)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(ie,{placeholder:"e.g. Personal key",...g("label"),className:"h-8 text-sm"}),f.label&&s.jsx("p",{className:"text-xs text-destructive",children:f.label.message})]}),c&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(ie,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...g("baseUrl"),className:"h-8 text-sm"})]}),u&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(ie,{type:n&&k?"text":"password",placeholder:a,...g("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),k&&s.jsx("button",{type:"button",onClick:()=>m(!n),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:n?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:h,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:h,children:h?"Saving...":"Save"})]})]})}function wt(e){const t=U.c(28),{providerKey:i,provider:a,open:r,onOpenChange:l}=e,o=H();let x;t[0]!==a.id||t[1]!==i.presetId?(x=a.id==="openai-compatible"&&i.presetId?Ke.find(k=>k.id===i.presetId):void 0,t[0]=a.id,t[1]=i.presetId,t[2]=x):x=t[2];const S=x,b=S?.name??a.name;let d;t[3]!==i.id?(d=Q.aiProviderKeyPreview(i.id),t[3]=i.id,t[4]=d):d=t[4];let n;t[5]!==i.id||t[6]!==o?(n=()=>o.call("AI_PROVIDER_KEY_PREVIEW",{keyId:i.id}),t[5]=i.id,t[6]=o,t[7]=n):n=t[7];let m;t[8]!==r||t[9]!==d||t[10]!==n?(m={queryKey:d,queryFn:n,enabled:r,staleTime:0},t[8]=r,t[9]=d,t[10]=n,t[11]=m):m=t[11];const{data:c,isLoading:u}=ve(m);let g;t[12]!==b?(g=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",b]})}),t[12]=b,t[13]=g):g=t[13];let j;t[14]!==u||t[15]!==l||t[16]!==S||t[17]!==c||t[18]!==a||t[19]!==i?(j=u||!c?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(ze,{})}):s.jsx(Pt,{providerKey:i,provider:a,preset:S,maskedKey:c.maskedKey,currentLabel:c.label,currentBaseUrl:c.baseUrl,onCancel:()=>l(!1),onSuccess:()=>l(!1)}),t[14]=u,t[15]=l,t[16]=S,t[17]=c,t[18]=a,t[19]=i,t[20]=j):j=t[20];let _;t[21]!==g||t[22]!==j?(_=s.jsxs(it,{className:"sm:max-w-md",children:[g,j]}),t[21]=g,t[22]=j,t[23]=_):_=t[23];let f;return t[24]!==l||t[25]!==r||t[26]!==_?(f=s.jsx(rt,{open:r,onOpenChange:l,children:_}),t[24]=l,t[25]=r,t[26]=_,t[27]=f):f=t[27],f}function Dt(e){const t=U.c(48),{providerKey:i,provider:a}=e,{org:r}=re(),l=H(),o=oe(),[x,S]=O.useState(!1),[b,d]=O.useState(!1),n=a.id==="openai-compatible";let m;t[0]!==n||t[1]!==i.presetId?(m=n&&i.presetId?Ke.find(q=>q.id===i.presetId):void 0,t[0]=n,t[1]=i.presetId,t[2]=m):m=t[2];const c=m,u=c?c.name:n?"Custom OpenAI-compatible":a.name,g=c?.logo??a.logo;let j;e:{if(n){j=i.label;break e}const q=i.label;let z;t[3]!==i.createdAt?(z=ot(new Date(i.createdAt)),t[3]=i.createdAt,t[4]=z):z=t[4],j=`${q} · added ${z} ago`}const _=j;let f;t[5]!==i.id||t[6]!==l?(f=async()=>{await l.call("AI_PROVIDER_KEY_DELETE",{keyId:i.id})},t[5]=i.id,t[6]=l,t[7]=f):f=t[7];let k;t[8]!==r||t[9]!==i.id||t[10]!==o?(k=()=>{o.invalidateQueries({queryKey:Q.aiProviderKeys(r.id)}),o.invalidateQueries({queryKey:Q.aiProviders(r.id)}),o.invalidateQueries({queryKey:Q.aiProviderModels(r.id,i.id)}),G.success("Key deleted"),S(!1)},t[8]=r,t[9]=i.id,t[10]=o,t[11]=k):k=t[11];let I;t[12]!==f||t[13]!==k?(I={mutationFn:f,onSuccess:k,onError:At},t[12]=f,t[13]=k,t[14]=I):I=t[14];const{mutate:h,isPending:p}=J(I);let y;t[15]!==u||t[16]!==g?(y=g?s.jsx("img",{src:g,alt:u,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(He,{fallback:u.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[15]=u,t[16]=g,t[17]=y):y=t[17];let F;t[18]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>d(!0),children:s.jsx(Ye,{size:14})}),t[18]=F):F=t[18];let M,T;t[19]===Symbol.for("react.memo_cache_sentinel")?(M=()=>S(!0),T=s.jsx(We,{size:14}),t[19]=M,t[20]=T):(M=t[19],T=t[20]);let R;t[21]!==p?(R=s.jsxs("div",{className:"flex items-center gap-0.5",children:[F,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:p,onClick:M,children:T})]}),t[21]=p,t[22]=R):R=t[22];let D;t[23]!==_||t[24]!==u||t[25]!==R||t[26]!==y?(D=s.jsx(_e,{icon:y,title:u,description:_,action:R}),t[23]=_,t[24]=u,t[25]=R,t[26]=y,t[27]=D):D=t[27];let A;t[28]!==b||t[29]!==a||t[30]!==i?(A=s.jsx(wt,{providerKey:i,provider:a,open:b,onOpenChange:d}),t[28]=b,t[29]=a,t[30]=i,t[31]=A):A=t[31];let K;t[32]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ie,{children:"Delete API key"}),t[32]=K):K=t[32];let E;t[33]!==i.label?(E=s.jsxs(ke,{children:[K,s.jsxs(Ce,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[33]=i.label,t[34]=E):E=t[34];let v;t[35]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Ne,{children:"Cancel"}),t[35]=v):v=t[35];let w;t[36]!==h?(w=s.jsxs(we,{children:[v,s.jsx(De,{onClick:()=>h(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[36]=h,t[37]=w):w=t[37];let $;t[38]!==E||t[39]!==w?($=s.jsxs(Pe,{children:[E,w]}),t[38]=E,t[39]=w,t[40]=$):$=t[40];let P;t[41]!==x||t[42]!==$?(P=s.jsx(Ae,{open:x,onOpenChange:S,children:$}),t[41]=x,t[42]=$,t[43]=P):P=t[43];let C;return t[44]!==D||t[45]!==A||t[46]!==P?(C=s.jsxs(s.Fragment,{children:[D,A,P]}),t[44]=D,t[45]=A,t[46]=P,t[47]=C):C=t[47],C}function At(e){return G.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=U.c(11),{onConnectClick:i}=e,a=X(),r=Se();let l;t[0]!==r?.providers?(l=r?.providers??[],t[0]=r?.providers,t[1]=l):l=t[1];const o=l;let x;if(t[2]!==a||t[3]!==i||t[4]!==o){let S;t[6]!==o?(S=m=>({key:m,provider:o.find(c=>c.id===m.providerId)}),t[6]=o,t[7]=S):S=t[7];const b=a.filter(Ft).map(S).filter($t);let d;t[8]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(Ge,{size:14}),t[8]=d):d=t[8];let n;t[9]!==i?(n=s.jsxs(V,{size:"sm",onClick:i,children:[d,"Connect provider"]}),t[9]=i,t[10]=n):n=t[10],x=s.jsx(de,{title:"Connected providers",headerClassName:"px-0",actions:n,children:b.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(ce,{children:b.map(Et)})}),t[2]=a,t[3]=i,t[4]=o,t[5]=x}else x=t[5];return x}function Et(e){const{key:t,provider:i}=e;return s.jsx(Dt,{providerKey:t,provider:i},t.id)}function $t(e){return e.provider!==void 0}function Ft(e){return e.providerId!=="deco"}function Rt(e){const t=U.c(3),{error:i}=e;let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(Fe,{size:16}),t[0]=a):a=t[0];let r;return t[1]!==i.message?(r=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[a,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=r):r=t[2],r}function Ot(){const e=U.c(23),t=X();let i;e[0]!==t?(i=t.some(Mt),e[0]=t,e[1]=i):i=e[1];const a=i,r=t.length>0,[l,o]=O.useState(!1),[x,S]=O.useState(null),b=Se();let d;e[2]!==b?.providers?(d=b?.providers??[],e[2]=b?.providers,e[3]=d):d=e[3];const n=d;if(!r){let _;e[4]===Symbol.for("react.memo_cache_sentinel")?(_=()=>o(!0),e[4]=_):_=e[4];let f;e[5]!==n?(f=s.jsx(Je,{providers:n,onSelect:S,onShowAll:_}),e[5]=n,e[6]=f):f=e[6];const k=x!==null||l;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=F=>{F||(S(null),o(!1))},e[7]=I):I=e[7];const h=x??void 0;let p;e[8]!==k||e[9]!==h?(p=s.jsx(pe,{open:k,onOpenChange:I,initialProvider:h}),e[8]=k,e[9]=h,e[10]=p):p=e[10];let y;return e[11]!==f||e[12]!==p?(y=s.jsxs(s.Fragment,{children:[f,p]}),e[11]=f,e[12]=p,e[13]=y):y=e[13],y}let m;e[14]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-16 w-full"}),children:s.jsx(pt,{})}),e[14]=m):m=e[14];let c;e[15]!==a?(c=a?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=a,e[16]=c):c=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Kt,{onConnectClick:()=>o(!0)}),e[17]=u):u=e[17];let g;e[18]!==l?(g=s.jsx(pe,{open:l,onOpenChange:o}),e[18]=l,e[19]=g):g=e[19];let j;return e[20]!==c||e[21]!==g?(j=s.jsxs(s.Fragment,{children:[m,c,u,g]}),e[20]=c,e[21]=g,e[22]=j):j=e[22],j}function Mt(e){return e.providerId==="deco"}function Tt(){const e=U.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(te.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(te,{children:s.jsx(te.Content,{children:s.jsx(te.Body,{children:s.jsxs(Re,{children:[t,s.jsx($e,{fallback:Ut,children:s.jsx(O.Suspense,{fallback:s.jsx(ne,{className:"h-64 w-full"}),children:s.jsx(Ot,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx(Rt,{error:t??new Error("Failed to load AI providers")})}function Ls(){const e=U.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(lt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Tt,{})}),e[0]=t):t=e[0],t}export{Ls as default};
@@ -1 +0,0 @@
1
- import{e as gt,r as w,j as o,c as St,n as ut,l as yt}from"./index-C3Ab2DJ2.js";import{i as jt}from"./ChevronRight-Dj41DV2U.js";import{S as kt}from"./scroll-area-DwqNfKe5.js";import{AddSectionModal as _t}from"./add-section-modal-CwlL6ayr.js";import{ah as wt,ai as Bt,f as Nt,g as Rt,aj as At}from"./index-WHuW26DU.js";import{c as Ct}from"./save-referenced-block-rb2uyE9z.js";import{d as Et,b as Kt}from"./schema-form-D8_e7uDj.js";import{S as Ft}from"./save-status-C9PbQUEN.js";import"./agent-icon-D5EbntAT.js";import"./AlertCircle-DMqR3m0L.js";import"./Tool01-B4SsemMS.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./Settings02-B7hO-Tma.js";import"./XCircle-DRGwo6Em.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ZapSquare-C7yt7KfQ.js";import"./Users03-BOvyNEV4.js";import"./CheckCircle-D6b8lFUP.js";import"./ChevronUp-CiXMtnii.js";import"./ChevronDown-CYFvWHpZ.js";import"./ChevronLeft-DXSAgzPw.js";import"./DotsVertical-y5lMfVOQ.js";import"./Stars02-9vF61uFx.js";import"./Eye-D3THRXh6.js";import"./ZoomOut-DVSwpwUz.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Star01-BfSEPDRT.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./Key01-Lcx9qTy7.js";import"./LayoutLeft-CkiSxkS_.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Play-C6QgiUls.js";import"./Plus-_82_8sq8.js";import"./SearchMd-C3Pmxf99.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Trash01-CG0gTYx7.js";import"./Upload01-BlvGy5d-.js";import"./User01-CTuKNCEa.js";import"./Users01-KXiCgru2.js";import"./XClose-Ig7y9gcI.js";import"./X-CKIhVHQk.js";import"./Zap-w60sxAoc.js";import"./use-clock-tick-SbPzFjh0.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Btaqep1K.js";import"./tooltip-2IhfImXT.js";import"./file-type-icon-BOPDPlds.js";import"./dialog-CyIn0DRx.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-7ak1Ve40.js";import"./use-mcp-client-BdKIOTso.js";import"./auth-tkqpBHf1.js";import"./chat-context-BNtznWGC.js";import"./hooks-DLdyjUhZ.js";import"./decopilot-sse-pool-BkzSWgw-.js";import"./use-virtual-mcp-Bc7GdFZa.js";import"./use-collections-DrlB7sAG.js";import"./use-ai-providers-CC3uGtbf.js";import"./studio-tools-DRut7Wwk.js";import"./use-organization-settings--a-kmsBC.js";import"./shell-layout-DmxTk-Cg.js";import"./avatar-DfTXVgX9.js";import"./required-auth-layout-B3CS-pLH.js";import"./useRouterState-DgLuS94C.js";import"./use-org-sso-CEQ82hSZ.js";import"./sheet-COdJ-0Qy.js";import"./integration-icon-CFvT6ZpF.js";import"./use-navigate-to-agent-BTMo9com.js";import"./use-connection-Dffadu_t.js";import"./use-mcp-prompts-5xEBY9_7.js";import"./form-BZY9ZRz4.js";import"./label-DitP_QKf.js";import"./input-BmmiCY6T.js";import"./select-Di6xzzYo.js";import"./index-BY2TC4bG.js";import"./drawer-DFg9xgM4.js";import"./collection-search-CCzYANV5.js";import"./tabs-BcUIMPwc.js";import"./toggle-group-Cp4C3_lM.js";import"./use-deco-credits-16Jb7c03.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CqvtHNnU.js";import"./use-registry-connections-CK9xDmAR.js";import"./useInfiniteQuery-Ca6dlOLl.js";import"./use-infinite-scroll-CaTJY2LS.js";import"./extract-connection-data-CBzjCfJ2.js";import"./card-Ckx3Kwvj.js";import"./collection-tabs-CBstOc4r.js";import"./badge-an9iff2c.js";import"./textarea-D8B22gmM.js";import"./connection-form-helpers-ByFrPc9N.js";import"./useSuspenseInfiniteQuery-CZbIaY66.js";import"./mcp-oauth-BGmk7Mi5.js";import"./connect-desktop-dialog-BgIjMJ8k.js";import"./decopilot-D6xQ1qh2.js";import"./checkbox-I3IyJWnj.js";import"./skeleton-CZ9pOveV.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dxa_AxFP.js";import"./popover-BcAFMnrn.js";import"./command-pIEd50-L.js";import"./index-DexxTctJ.js";import"./dropdown-menu-kPcoeCiJ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-C5Tq4YPI.js";import"./empty-state-BrSxZrfZ.js";import"./toolbar-DyjTkAru.js";import"./preview-dialog-CWq_MXwm.js";import"./index-xsAZnQ1t.js";import"./use-mcp-tools-CYtQa-6Z.js";import"./use-capability-CU6DCnG3.js";import"./shell-route-loading-DW_liPbt.js";import"./index-C4w1u5Cz.js";import"./alert-dialog-BuJSufuR.js";import"./switch-sHkW6RUp.js";import"./use-debounced-autosave-C4B5942u.js";import"./index-CszBxeF9.js";import"./sidebar-DCgpgzJu.js";import"./search-input-DjHO_xeh.js";import"./github-repo-picker-CrW8szfE.js";import"./use-secrets-B008jqWi.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-Cc6sYskX.js";import"./select-model-4ZBcZdkE.js";import"./use-automations-D2hKtMe8.js";import"./monaco-editor-yw8USVwR.js";import"./automation-runs-BEntIYkJ.js";import"./table-BUxYcsuG.js";import"./use-members-BWyLHt4a.js";import"./use-org-auth-client-Blpkj8FB.js";import"./task-status-BfQltC__.js";import"./automation-list-row-40GibzkL.js";import"./calendar-tEWC6_XV.js";import"./sortable.esm-LmSoSdxy.js";import"./image-field-CodUWKZv.js";import"./use-file-configs-qOKR17qO.js";function br(B){const t=gt.c(77),{orgSlug:d,virtualMcpId:f,branch:u,blockKey:i,block:p,meta:m,decofile:l,title:H,excludeFields:G,schemaPending:at,previewBaseUrl:nt}=B,J=at===void 0?!1:at,n=nt===void 0?null:nt,h=typeof p?.__resolveType=="string"?p.__resolveType:"";let A;t[0]!==G||t[1]!==m||t[2]!==h?(A=wt(h,m,G),t[0]=G,t[1]=m,t[2]=h,t[3]=A):A=t[3];const c=A;let C;t[4]!==c?(C=!!c&&Object.keys(c.properties??{}).length>0,t[4]=c,t[5]=C):C=t[5];const Q=C;let E;t[6]!==p||t[7]!==i||t[8]!==m||t[9]!==H?(E=H??(p?Bt(i,p,m):i),t[6]=p,t[7]=i,t[8]=m,t[9]=H,t[10]=E):E=t[10];const x=E;let K;t[11]!==u||t[12]!==d||t[13]!==f?(K={orgSlug:d,virtualMcpId:f,branch:u},t[11]=u,t[12]=d,t[13]=f,t[14]=K):K=t[14];const{save:v,flush:W,isPending:X}=Nt(K);let F;t[15]!==u||t[16]!==d||t[17]!==f?(F={orgSlug:d,virtualMcpId:f,branch:u},t[15]=u,t[16]=d,t[17]=f,t[18]=F):F=t[18];const Y=Rt(F);let $;t[19]!==v?($=Ct((e,r)=>v(e,r)),t[19]=v,t[20]=$):$=t[20];const Z=$,[ht,xt]=w.useState(i),[tt,ct]=w.useState(null),[et,dt]=w.useState(0);let P;t[21]===Symbol.for("react.memo_cache_sentinel")?(P=[],t[21]=P):P=t[21];const[s,ft]=w.useState(P),[ot,rt]=w.useState(!1),O=w.useRef(null);ht!==i&&(xt(i),ct(null),dt(Pt),ft([]));let T;t[22]!==p?(T=p??{},t[22]=p,t[23]=T):T=t[23];const it=T;let b;t[24]!==tt?(b=tt??{},t[24]=tt,t[25]=b):b=t[25];let V;t[26]!==it||t[27]!==b?(V={...it,...b},t[26]=it,t[27]=b,t[28]=V):V=t[28];const mt=V;let I;t[29]!==i||t[30]!==h||t[31]!==v?(I=e=>{const r=e;ct(r),v(i,{...r,__resolveType:h})},t[29]=i,t[30]=h,t[31]=v,t[32]=I):I=t[32];const st=I;let L;t[33]===Symbol.for("react.memo_cache_sentinel")?(L=e=>{ft(e)},t[33]=L):L=t[33];const pt=L;let q;t[34]!==l||t[35]!==W||t[36]!==Y?(q=async(e,r)=>{try{const{blockKey:a,data:R}=At(e,l);await Y.mutateAsync({blockKey:a,data:R}),ut.success(`Created section "${a}"`),r({__resolveType:a}),W()}catch(a){const R=a,bt=R instanceof Error?R.message:"Could not add section";throw ut.error(bt),R}},t[34]=l,t[35]=W,t[36]=Y,t[37]=q):q=t[37];const g=q;let z;t[38]===Symbol.for("react.memo_cache_sentinel")?(z=e=>{O.current=e.append,rt(!0)},t[38]=z):z=t[38];const vt=z;let M;t[39]!==g?(M=async e=>{const r=O.current;if(r)try{await g(e,a=>{r(a),rt(!1),O.current=null})}catch{}},t[39]=g,t[40]=M):M=t[40];const lt=M;let U;t[41]!==s||t[42]!==x?(U=s.length>0?[x,...s]:[],t[41]=s,t[42]=x,t[43]=U):U=t[43];const N=U;let S;t[44]!==s||t[45]!==N||t[46]!==x?(S=N.length>0?o.jsx("nav",{"aria-label":"Editing breadcrumb",className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm",children:N.map((e,r)=>{const a=r===N.length-1;return o.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden",children:[r>0&&o.jsx(jt,{className:"size-3 shrink-0 text-muted-foreground/60"}),o.jsx("button",{type:"button",onClick:()=>{pt(r===0?[]:Et(s,r)),dt($t)},title:e,className:St("min-w-0 truncate rounded-md px-1 py-0.5 text-left transition-colors",a?"font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:e})]},`${e}-${r}`)})}):o.jsx("span",{className:"text-sm font-medium",children:x}),t[44]=s,t[45]=N,t[46]=x,t[47]=S):S=t[47];let y;t[48]!==X?(y=o.jsx(Ft,{isPending:X,isError:!1}),t[48]=X,t[49]=y):y=t[49];let j;t[50]!==S||t[51]!==y?(j=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[S,y]}),t[50]=S,t[51]=y,t[52]=j):j=t[52];let k;t[53]!==i||t[54]!==s||t[55]!==l||t[56]!==mt||t[57]!==et||t[58]!==g||t[59]!==st||t[60]!==Q||t[61]!==m||t[62]!==n||t[63]!==Z||t[64]!==c||t[65]!==J?(k=o.jsx(kt,{className:"min-w-0 flex-1 [&_[data-slot=scroll-area-viewport]>div]:!block",children:o.jsx("div",{className:"px-6 py-6",children:o.jsx("div",{className:"mx-auto max-w-xl",children:Q?o.jsx(Kt,{schema:c,value:mt,onChange:st,basePath:"",breadcrumbPath:s,onBreadcrumbChange:pt,decofile:l,meta:m,onSaveReferencedBlock:Z,previewBaseUrl:n,onAddSectionItem:g,onRequestAddSection:vt},`${i}:${et}`):J?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(yt,{size:16,className:"animate-spin"}),"Loading app schema…"]}):o.jsx("div",{className:"py-6 text-center text-xs text-muted-foreground",children:"No editable schema found for this app."})})})}),t[53]=i,t[54]=s,t[55]=l,t[56]=mt,t[57]=et,t[58]=g,t[59]=st,t[60]=Q,t[61]=m,t[62]=n,t[63]=Z,t[64]=c,t[65]=J,t[66]=k):k=t[66];let _;t[67]!==ot||t[68]!==l||t[69]!==lt||t[70]!==m||t[71]!==n?(_=n&&o.jsx(_t,{open:ot,onOpenChange:e=>{rt(e),e||(O.current=null)},meta:m,decofile:l,previewBaseUrl:n,onSelect:e=>{lt(e)}}),t[67]=ot,t[68]=l,t[69]=lt,t[70]=m,t[71]=n,t[72]=_):_=t[72];let D;return t[73]!==j||t[74]!==k||t[75]!==_?(D=o.jsxs("div",{className:"flex h-full flex-col",children:[j,k,_]}),t[73]=j,t[74]=k,t[75]=_,t[76]=D):D=t[76],D}function $t(B){return B+1}function Pt(B){return B+1}export{br as AppEditor};
@@ -1 +0,0 @@
1
- import{e as k,j as o,p as L,f as T,r as $,B as M,t as N}from"./index-C3Ab2DJ2.js";import{s as q}from"./Plus-_82_8sq8.js";import{i as S}from"./Zap-w60sxAoc.js";import{S as D}from"./search-input-DjHO_xeh.js";import{P as l}from"./index-CszBxeF9.js";import{E as b}from"./empty-state-BrSxZrfZ.js";import{c as O}from"./use-automations-D2hKtMe8.js";import{m as V}from"./use-navigate-to-agent-BTMo9com.js";import{A as F}from"./automation-list-row-40GibzkL.js";import{k as G}from"./use-mcp-client-BdKIOTso.js";import{u as H}from"./use-virtual-mcp-Bc7GdFZa.js";import{R as J}from"./require-capability-CoJVffIR.js";import"./SearchMd-C3Pmxf99.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./tooltip-2IhfImXT.js";import"./sheet-COdJ-0Qy.js";import"./X-CKIhVHQk.js";import"./studio-tools-DRut7Wwk.js";import"./alert-dialog-BuJSufuR.js";import"./dropdown-menu-kPcoeCiJ.js";import"./ChevronUp-CiXMtnii.js";import"./ChevronRight-Dj41DV2U.js";import"./DotsVertical-y5lMfVOQ.js";import"./Stars02-9vF61uFx.js";import"./Trash01-CG0gTYx7.js";import"./agent-icon-D5EbntAT.js";import"./AlertCircle-DMqR3m0L.js";import"./Tool01-B4SsemMS.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./Settings02-B7hO-Tma.js";import"./XCircle-DRGwo6Em.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ZapSquare-C7yt7KfQ.js";import"./Users03-BOvyNEV4.js";import"./CheckCircle-D6b8lFUP.js";import"./ChevronDown-CYFvWHpZ.js";import"./ChevronLeft-DXSAgzPw.js";import"./Eye-D3THRXh6.js";import"./ZoomOut-DVSwpwUz.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Star01-BfSEPDRT.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./Key01-Lcx9qTy7.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Play-C6QgiUls.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Upload01-BlvGy5d-.js";import"./User01-CTuKNCEa.js";import"./Users01-KXiCgru2.js";import"./XClose-Ig7y9gcI.js";import"./auth-tkqpBHf1.js";import"./use-collections-DrlB7sAG.js";import"./use-capability-CU6DCnG3.js";import"./access-gate-CEtgmlCt.js";import"./capability-load-error-BXEh1mp-.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function eo(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{eo as default};
@@ -1 +0,0 @@
1
- import{e as D,j as t,a1 as V,r as v,B as F,n as _}from"./index-C3Ab2DJ2.js";import{i as J}from"./AlertCircle-DMqR3m0L.js";import{i as O}from"./HardDrive-DmtpWveq.js";import{s as L}from"./Plus-_82_8sq8.js";import{s as Q}from"./Trash01-CG0gTYx7.js";import{A as X,g as Y,c as Z,b as ee,d as te,e as se,a as ie,f as re}from"./alert-dialog-BuJSufuR.js";import{d as ne,c as le,D as ae,a as oe,b as ce,e as de}from"./dialog-CyIn0DRx.js";import{I as N}from"./input-BmmiCY6T.js";import{L as C}from"./label-DitP_QKf.js";import{d as me,b as ue,c as fe,S as pe,a as q}from"./select-Di6xzzYo.js";import{S as xe}from"./switch-sHkW6RUp.js";import{S as he}from"./skeleton-CZ9pOveV.js";import{T as ge}from"./textarea-D8B22gmM.js";import{P}from"./index-CszBxeF9.js";import{c as je}from"./settings-section-Dxa_AxFP.js";import{u as ye,a as be,b as ve}from"./use-file-configs-qOKR17qO.js";import{R as Se}from"./require-capability-CoJVffIR.js";import"./X-CKIhVHQk.js";import"./tooltip-2IhfImXT.js";import"./ChevronUp-CiXMtnii.js";import"./ChevronDown-CYFvWHpZ.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./sheet-COdJ-0Qy.js";import"./card-Ckx3Kwvj.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./studio-tools-DRut7Wwk.js";import"./use-capability-CU6DCnG3.js";import"./access-gate-CEtgmlCt.js";import"./capability-load-error-BXEh1mp-.js";function Ce(s,e){if(!(s instanceof Error))return e;const i=s.message.match(/\[\s*\{[\s\S]*\}\s*\]/);if(i)try{const r=JSON.parse(i[0])[0];if(r?.message){const l=r.path?.join(".");return l?`${l}: ${r.message}`:r.message}}catch{}return s.message||e}function ke(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(J,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load file configurations: ",i.message]})]}),e[1]=i.message,e[2]=r):r=e[2],r}function Ne(s){const e=D.c(44),{config:i,onDelete:n}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx(O,{size:16,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let l;e[1]!==i.name?(l=t.jsx("span",{className:"font-medium text-sm truncate",children:i.name}),e[1]=i.name,e[2]=l):l=e[2];let o;e[3]!==i.credentialType?(o=i.credentialType==="sts-session"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"STS"}):i.credentialType==="managed"?t.jsx("span",{className:"text-[10px] uppercase tracking-wide font-medium px-1.5 py-0.5 rounded bg-muted text-muted-foreground shrink-0",children:"Managed"}):null,e[3]=i.credentialType,e[4]=o):o=e[4];let g;e[5]!==i.bucket||e[6]!==i.region?(g=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[5]=i.bucket,e[6]=i.region,e[7]=g):g=e[7];let c;e[8]!==l||e[9]!==o||e[10]!==g?(c=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o,g]}),e[8]=l,e[9]=o,e[10]=g,e[11]=c):c=e[11];let b;e[12]!==i.description?(b=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[12]=i.description,e[13]=b):b=e[13];let j;e[14]!==i.endpoint||e[15]!==i.forcePathStyle?(j=i.endpoint?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:[i.endpoint,i.forcePathStyle?" (path-style)":""]}):null,e[14]=i.endpoint,e[15]=i.forcePathStyle,e[16]=j):j=e[16];let d;e[17]!==i.prefix?(d=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[17]=i.prefix,e[18]=d):d=e[18];let m;e[19]!==i.publicUrlBase?(m=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[19]=i.publicUrlBase,e[20]=m):m=e[20];let y;e[21]!==c||e[22]!==b||e[23]!==j||e[24]!==d||e[25]!==m?(y=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[c,b,j,d,m]})]}),e[21]=c,e[22]=b,e[23]=j,e[24]=d,e[25]=m,e[26]=y):y=e[26];let f;e[27]!==i.createdAt?(f=new Date(i.createdAt).toLocaleDateString(),e[27]=i.createdAt,e[28]=f):f=e[28];let u;e[29]!==f?(u=t.jsx("span",{className:"text-xs text-muted-foreground",children:f}),e[29]=f,e[30]=u):u=e[30];let p;e[31]!==i||e[32]!==n?(p=()=>n(i),e[31]=i,e[32]=n,e[33]=p):p=e[33];const x=`Delete ${i.name}`;let h;e[34]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(Q,{size:14}),e[34]=h):h=e[34];let k;e[35]!==p||e[36]!==x?(k=t.jsx(F,{variant:"ghost",size:"sm",onClick:p,"aria-label":x,children:h}),e[35]=p,e[36]=x,e[37]=k):k=e[37];let S;e[38]!==u||e[39]!==k?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[u,k]}),e[38]=u,e[39]=k,e[40]=S):S=e[40];let A;return e[41]!==y||e[42]!==S?(A=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[y,S]}),e[41]=y,e[42]=S,e[43]=A):A=e[43],A}function Ae(s){const e=D.c(5),{onCreate:i}=s;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx(O,{size:20,className:"text-muted-foreground"})}),r=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No buckets configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket (AWS S3, Cloudflare R2, Google Cloud Storage, MinIO). Access keys are encrypted at rest and never returned over the API."})]}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(L,{size:14}),e[2]=l):l=e[2];let o;return e[3]!==i?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[n,r,t.jsxs(F,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function K({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,g]=v.useState(""),[c,b]=v.useState(""),[j,d]=v.useState(""),[m,y]=v.useState(!1),[f,u]=v.useState(""),[p,x]=v.useState(""),[h,k]=v.useState("static"),[S,A]=v.useState(""),[R,I]=v.useState(""),[T,U]=v.useState(""),[B,$]=v.useState(""),w=be();function E(){n(""),l(""),g(""),b(""),d(""),y(!1),u(""),x(""),k("static"),A(""),I(""),U(""),$("")}const z=h==="sts-session"?!!(T.trim()&&B.trim()):!!(S&&R);async function M(a){if(a.preventDefault(),!i.trim()||!o.trim()||!c.trim()||!z)return;const W=h==="sts-session"?{credentialType:"sts-session",refreshUrl:T.trim(),apiKey:B.trim()}:{credentialType:"static",accessKeyId:S,secretAccessKey:R};try{await w.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:c.trim(),endpoint:j.trim()||void 0,forcePathStyle:m,prefix:f.trim()||void 0,publicUrlBase:p.trim()||void 0,...W}),_.success(`Bucket "${i.trim()}" added`),E(),e(!1)}catch(H){_.error(Ce(H,"Failed to add bucket"))}}const G=w.isPending||!i.trim()||!o.trim()||!c.trim()||!z;return t.jsx(ne,{open:s,onOpenChange:e,children:t.jsxs(le,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(ae,{children:[t.jsx(oe,{children:"Add S3 bucket"}),t.jsx(ce,{children:"Credentials are encrypted at rest and never returned over the API. For Cloudflare R2, Google Cloud Storage, or MinIO, set a custom endpoint."})]}),t.jsxs("form",{onSubmit:M,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:a=>n(a.target.value),placeholder:"production-uploads",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Unique within the organization."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:a=>g(a.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:c,onChange:a=>b(a.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:j,onChange:a=>d(a.target.value),placeholder:"https://<account>.r2.cloudflarestorage.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for non-AWS providers (R2, GCS, MinIO)."})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/60 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(C,{htmlFor:"file-config-path-style",className:"text-sm",children:"Force path-style URLs"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Required for Google Cloud Storage and most MinIO setups."})]}),t.jsx(xe,{id:"file-config-path-style",checked:m,onCheckedChange:y})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:f,onChange:a=>u(a.target.value),placeholder:"tenants/acme/",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"All object keys are written under this prefix. Useful for multi-tenant buckets or credentials scoped to a sub-path. A trailing slash is added automatically."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:p,onChange:a=>x(a.target.value),placeholder:"https://pub-xxxx.r2.dev or https://cdn.example.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Host used to build public URLs returned by the picker (R2 dev domain, CDN, custom host). Leave blank to use the bucket's S3 host (AWS default)."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-credential-type",children:"Credentials"}),t.jsxs(me,{value:h,onValueChange:a=>k(a),children:[t.jsx(ue,{id:"file-config-credential-type",className:"w-full",children:t.jsx(fe,{})}),t.jsxs(pe,{children:[t.jsx(q,{value:"static",children:"Static key pair (long-lived)"}),t.jsx(q,{value:"sts-session",children:"Temporary session (STS, auto-refreshed)"})]})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:h==="sts-session"?"Stores only a refresh endpoint + API key; short-lived credentials are fetched on demand and refreshed automatically.":"A long-lived access key ID and secret, used as-is."})]}),h==="static"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:S,onChange:a=>A(a.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:R,onChange:a=>I(a.target.value),autoComplete:"new-password",required:!0})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-refresh-url",children:"Refresh URL"}),t.jsx(N,{id:"file-config-refresh-url",type:"url",value:T,onChange:a=>U(a.target.value),placeholder:"https://admin.example.com/api/acme/s3-credentials",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Endpoint POSTed (with the API key below) to vend temporary credentials. Must return accessKeyId, secretAccessKey, sessionToken, and expiration."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-api-key",children:"API key"}),t.jsx(N,{id:"file-config-api-key",type:"password",value:B,onChange:a=>$(a.target.value),autoComplete:"new-password",required:!0}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent as the ",t.jsx("code",{children:"x-api-key"})," header on each refresh call."]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(C,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(ge,{id:"file-config-description",value:r,onChange:a=>l(a.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(de,{children:[t.jsx(F,{type:"button",variant:"outline",onClick:()=>{E(),e(!1)},disabled:w.isPending,children:"Cancel"}),t.jsx(F,{type:"submit",disabled:G,children:w.isPending?"Adding…":"Add bucket"})]})]})]})})}function De(s){const e=D.c(25),{config:i,onClose:n}=s,r=ve();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),_.success(`Bucket "${i.name}" removed`),n()}catch(k){const S=k;_.error(S instanceof Error?S.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,g=i!==null;let c;e[4]!==n?(c=h=>!h&&n(),e[4]=n,e[5]=c):c=e[5];let b;e[6]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Z,{children:"Remove bucket configuration?"}),e[6]=b):b=e[6];const j=i?.name;let d;e[7]!==j?(d=t.jsxs(ee,{children:[b,t.jsxs(te,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:j}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=j,e[8]=d):d=e[8];let m;e[9]!==r.isPending?(m=t.jsx(X,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=m):m=e[10];const y=r.isPending?"Removing…":"Remove";let f;e[11]!==r.isPending||e[12]!==o||e[13]!==y?(f=t.jsx(Y,{onClick:o,disabled:r.isPending,children:y}),e[11]=r.isPending,e[12]=o,e[13]=y,e[14]=f):f=e[14];let u;e[15]!==m||e[16]!==f?(u=t.jsxs(se,{children:[m,f]}),e[15]=m,e[16]=f,e[17]=u):u=e[17];let p;e[18]!==u||e[19]!==d?(p=t.jsxs(ie,{children:[d,u]}),e[18]=u,e[19]=d,e[20]=p):p=e[20];let x;return e[21]!==p||e[22]!==g||e[23]!==c?(x=t.jsx(re,{open:g,onOpenChange:c,children:p}),e[21]=p,e[22]=g,e[23]=c,e[24]=x):x=e[24],x}function Fe(){const s=D.c(25),e=ye(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let x;s[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Ae,{onCreate:()=>n(!0)}),s[0]=x):x=s[0];let h;return s[1]!==i?(h=t.jsxs(t.Fragment,{children:[x,t.jsx(K,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=h):h=s[2],h}const o=e.length===1?"":"s";let g;s[3]!==e.length||s[4]!==o?(g=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=g):g=s[5];let c;s[6]===Symbol.for("react.memo_cache_sentinel")?(c=()=>n(!0),s[6]=c):c=s[6];let b;s[7]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsxs(F,{onClick:c,size:"sm",children:[t.jsx(L,{size:14}),"Add bucket"]}),s[7]=b):b=s[7];let j;s[8]!==g?(j=t.jsxs("div",{className:"flex items-center justify-between",children:[g,b]}),s[8]=g,s[9]=j):j=s[9];let d;if(s[10]!==e){let x;s[12]===Symbol.for("react.memo_cache_sentinel")?(x=h=>t.jsx(Ne,{config:h,onDelete:l},h.id),s[12]=x):x=s[12],d=e.map(x),s[10]=e,s[11]=d}else d=s[11];let m;s[13]!==d?(m=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:d})}),s[13]=d,s[14]=m):m=s[14];let y;s[15]!==i?(y=t.jsx(K,{open:i,onOpenChange:n}),s[15]=i,s[16]=y):y=s[16];let f;s[17]===Symbol.for("react.memo_cache_sentinel")?(f=()=>l(null),s[17]=f):f=s[17];let u;s[18]!==r?(u=t.jsx(De,{config:r,onClose:f}),s[18]=r,s[19]=u):u=s[19];let p;return s[20]!==j||s[21]!==m||s[22]!==y||s[23]!==u?(p=t.jsxs(t.Fragment,{children:[j,m,y,u]}),s[20]=j,s[21]=m,s[22]=y,s[23]=u,s[24]=p):p=s[24],p}function we(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(P.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(P,{children:t.jsx(P.Content,{children:t.jsx(P.Body,{children:t.jsxs(je,{children:[e,t.jsx(V,{fallback:Pe,children:t.jsx(v.Suspense,{fallback:t.jsx(he,{className:"h-32 w-full"}),children:t.jsx(Fe,{})})})]})})})}),s[1]=i):i=s[1],i}function Pe(s){const{error:e}=s;return t.jsx(ke,{error:e??new Error("Failed to load file configs")})}function at(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Se,{capability:"file-configs:manage",area:"files",children:t.jsx(we,{})}),s[0]=e):e=s[0],e}export{at as default};
@@ -1 +0,0 @@
1
- import{e as st,j as e,B as mt}from"./index-C3Ab2DJ2.js";import{a as pt}from"./XCircle-DRGwo6Em.js";import{N as lt}from"./agent-icon-D5EbntAT.js";import{I as tt}from"./input-BmmiCY6T.js";import{L as et}from"./label-DitP_QKf.js";import{ak as at,al as nt,ar as ct,am as ft}from"./index-WHuW26DU.js";import{u as dt,s as M,I as gt}from"./primitives-BcfJna5s.js";import{S as ut}from"./save-status-C9PbQUEN.js";import{a as xt,B as ht,b as yt}from"./block-document-DZEmtfok.js";import"./AlertCircle-DMqR3m0L.js";import"./Tool01-B4SsemMS.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./Settings02-B7hO-Tma.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ZapSquare-C7yt7KfQ.js";import"./Users03-BOvyNEV4.js";import"./CheckCircle-D6b8lFUP.js";import"./ChevronUp-CiXMtnii.js";import"./ChevronDown-CYFvWHpZ.js";import"./ChevronLeft-DXSAgzPw.js";import"./ChevronRight-Dj41DV2U.js";import"./DotsVertical-y5lMfVOQ.js";import"./Stars02-9vF61uFx.js";import"./Eye-D3THRXh6.js";import"./ZoomOut-DVSwpwUz.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Star01-BfSEPDRT.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./Key01-Lcx9qTy7.js";import"./LayoutLeft-CkiSxkS_.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Play-C6QgiUls.js";import"./Plus-_82_8sq8.js";import"./SearchMd-C3Pmxf99.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Trash01-CG0gTYx7.js";import"./Upload01-BlvGy5d-.js";import"./User01-CTuKNCEa.js";import"./Users01-KXiCgru2.js";import"./XClose-Ig7y9gcI.js";import"./X-CKIhVHQk.js";import"./Zap-w60sxAoc.js";import"./index-BY2TC4bG.js";import"./chat-context-BNtznWGC.js";import"./hooks-DLdyjUhZ.js";import"./use-mcp-client-BdKIOTso.js";import"./auth-tkqpBHf1.js";import"./decopilot-sse-pool-BkzSWgw-.js";import"./use-virtual-mcp-Bc7GdFZa.js";import"./use-collections-DrlB7sAG.js";import"./use-ai-providers-CC3uGtbf.js";import"./studio-tools-DRut7Wwk.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings--a-kmsBC.js";import"./scroll-area-DwqNfKe5.js";import"./use-clock-tick-SbPzFjh0.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-Btaqep1K.js";import"./tooltip-2IhfImXT.js";import"./file-type-icon-BOPDPlds.js";import"./dialog-CyIn0DRx.js";import"./content-blocks-o63cs2vh.js";import"./types-7ak1Ve40.js";import"./shell-layout-DmxTk-Cg.js";import"./avatar-DfTXVgX9.js";import"./required-auth-layout-B3CS-pLH.js";import"./useRouterState-DgLuS94C.js";import"./use-org-sso-CEQ82hSZ.js";import"./sheet-COdJ-0Qy.js";import"./integration-icon-CFvT6ZpF.js";import"./use-navigate-to-agent-BTMo9com.js";import"./use-connection-Dffadu_t.js";import"./use-mcp-prompts-5xEBY9_7.js";import"./form-BZY9ZRz4.js";import"./select-Di6xzzYo.js";import"./drawer-DFg9xgM4.js";import"./collection-search-CCzYANV5.js";import"./tabs-BcUIMPwc.js";import"./toggle-group-Cp4C3_lM.js";import"./use-deco-credits-16Jb7c03.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-CqvtHNnU.js";import"./use-registry-connections-CK9xDmAR.js";import"./useInfiniteQuery-Ca6dlOLl.js";import"./use-infinite-scroll-CaTJY2LS.js";import"./extract-connection-data-CBzjCfJ2.js";import"./card-Ckx3Kwvj.js";import"./collection-tabs-CBstOc4r.js";import"./badge-an9iff2c.js";import"./textarea-D8B22gmM.js";import"./connection-form-helpers-ByFrPc9N.js";import"./useSuspenseInfiniteQuery-CZbIaY66.js";import"./mcp-oauth-BGmk7Mi5.js";import"./connect-desktop-dialog-BgIjMJ8k.js";import"./decopilot-D6xQ1qh2.js";import"./checkbox-I3IyJWnj.js";import"./skeleton-CZ9pOveV.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dxa_AxFP.js";import"./popover-BcAFMnrn.js";import"./command-pIEd50-L.js";import"./index-DexxTctJ.js";import"./dropdown-menu-kPcoeCiJ.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-C5Tq4YPI.js";import"./empty-state-BrSxZrfZ.js";import"./toolbar-DyjTkAru.js";import"./preview-dialog-CWq_MXwm.js";import"./index-xsAZnQ1t.js";import"./use-mcp-tools-CYtQa-6Z.js";import"./use-capability-CU6DCnG3.js";import"./shell-route-loading-DW_liPbt.js";import"./index-C4w1u5Cz.js";import"./alert-dialog-BuJSufuR.js";import"./switch-sHkW6RUp.js";import"./use-debounced-autosave-C4B5942u.js";import"./index-CszBxeF9.js";import"./sidebar-DCgpgzJu.js";import"./search-input-DjHO_xeh.js";import"./github-repo-picker-CrW8szfE.js";import"./use-secrets-B008jqWi.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-Cc6sYskX.js";import"./select-model-4ZBcZdkE.js";import"./use-automations-D2hKtMe8.js";import"./monaco-editor-yw8USVwR.js";import"./automation-runs-BEntIYkJ.js";import"./table-BUxYcsuG.js";import"./use-members-BWyLHt4a.js";import"./use-org-auth-client-Blpkj8FB.js";import"./task-status-BfQltC__.js";import"./automation-list-row-40GibzkL.js";import"./sortable.esm-LmSoSdxy.js";import"./schema-form-D8_e7uDj.js";import"./calendar-tEWC6_XV.js";import"./image-field-CodUWKZv.js";import"./use-file-configs-qOKR17qO.js";function to(it){const t=st.c(87),{orgSlug:p,virtualMcpId:l,branch:a,blockKey:z,block:G,decofile:H,meta:O,onManagePosts:Q}=it;let F;t[0]!==a||t[1]!==p||t[2]!==l?(F={orgSlug:p,virtualMcpId:l,branch:a},t[0]=a,t[1]=p,t[2]=l,t[3]=F):F=t[3];const m=at(F);let D;t[4]!==G?(D=nt(G,"categories"),t[4]=G,t[5]=D):D=t[5];const ot=D;let L;t[6]!==z||t[7]!==m?(L=o=>{m.mutate({blockKey:z,data:ft(z,"categories",o)})},t[6]=z,t[7]=m,t[8]=L):L=t[8];const[i,V]=dt(ot,L);let R;t[9]!==i||t[10]!==V?(R=(o,rt)=>V({...i,[o]:rt}),t[9]=i,t[10]=V,t[11]=R):R=t[11];const r=R;let s,T;t[12]!==i.slug||t[13]!==H?(s=M(i.slug),T=s?ct(H).filter(o=>o.categorySlugs.includes(s)).length:0,t[12]=i.slug,t[13]=H,t[14]=s,t[15]=T):(s=t[14],T=t[15]);const U=T;let n;t[16]!==i.name?(n=M(i.name)||"Untitled category",t[16]=i.name,t[17]=n):n=t[17];let c;t[18]!==n?(c=e.jsx("span",{className:"truncate text-sm font-medium",children:n}),t[18]=n,t[19]=c):c=t[19];let f;t[20]!==m.isError||t[21]!==m.isPending?(f=e.jsx(ut,{isPending:m.isPending,isError:m.isError}),t[20]=m.isError,t[21]=m.isPending,t[22]=f):f=t[22];let d;t[23]!==c||t[24]!==f?(d=e.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[c,f]}),t[23]=c,t[24]=f,t[25]=d):d=t[25];let g;t[26]!==i.name?(g=M(i.name),t[26]=i.name,t[27]=g):g=t[27];let u;t[28]!==r?(u=o=>r("name",o),t[28]=r,t[29]=u):u=t[29];let x;t[30]!==g||t[31]!==u?(x=e.jsx(gt,{value:g,onChange:u,placeholder:"Category name",className:"py-1 text-3xl font-bold text-foreground"}),t[30]=g,t[31]=u,t[32]=x):x=t[32];let $;t[33]===Symbol.for("react.memo_cache_sentinel")?($=e.jsx(et,{htmlFor:"category-slug",children:"Slug"}),t[33]=$):$=t[33];let h;t[34]!==i.slug?(h=M(i.slug),t[34]=i.slug,t[35]=h):h=t[35];let y;t[36]!==r?(y=o=>r("slug",o.target.value),t[36]=r,t[37]=y):y=t[37];let j;t[38]!==h||t[39]!==y?(j=e.jsxs("div",{className:"mt-4 space-y-2",children:[$,e.jsx(tt,{id:"category-slug",value:h,onChange:y,placeholder:"my-category",className:"h-10"})]}),t[38]=h,t[39]=y,t[40]=j):j=t[40];let A;t[41]===Symbol.for("react.memo_cache_sentinel")?(A=e.jsx(et,{htmlFor:"category-description",children:"Description"}),t[41]=A):A=t[41];let b;t[42]!==i.description?(b=M(i.description),t[42]=i.description,t[43]=b):b=t[43];let v;t[44]!==r?(v=o=>r("description",o.target.value),t[44]=r,t[45]=v):v=t[45];let N;t[46]!==b||t[47]!==v?(N=e.jsxs("div",{className:"mt-4 space-y-2",children:[A,e.jsx(tt,{id:"category-description",value:b,onChange:v,placeholder:"Short description for this category",className:"h-10"})]}),t[46]=b,t[47]=v,t[48]=N):N=t[48];let J;t[49]===Symbol.for("react.memo_cache_sentinel")?(J=e.jsx(lt,{size:16,className:"shrink-0 text-muted-foreground"}),t[49]=J):J=t[49];const X=U===1?"post":"posts";let S;t[50]!==U||t[51]!==X?(S=e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[J,e.jsxs("span",{className:"text-sm",children:[U," ",X," in this category"]})]}),t[50]=U,t[51]=X,t[52]=S):S=t[52];const Y=!s,Z=s?"Jump to the posts list filtered by this category":"Set a slug to manage this category's posts";let k;t[53]!==Q||t[54]!==s?(k=()=>Q(s),t[53]=Q,t[54]=s,t[55]=k):k=t[55];let K;t[56]===Symbol.for("react.memo_cache_sentinel")?(K=e.jsx(pt,{size:14}),t[56]=K):K=t[56];let B;t[57]!==Y||t[58]!==Z||t[59]!==k?(B=e.jsxs(mt,{type:"button",variant:"outline",size:"sm",disabled:Y,title:Z,onClick:k,children:["Manage posts",K]}),t[57]=Y,t[58]=Z,t[59]=k,t[60]=B):B=t[60];let _;t[61]!==S||t[62]!==B?(_=e.jsxs("div",{className:"mt-6 flex items-center justify-between gap-3 rounded-lg border bg-muted/30 px-4 py-3",children:[S,B]}),t[61]=S,t[62]=B,t[63]=_):_=t[63];let W;t[64]===Symbol.for("react.memo_cache_sentinel")?(W=e.jsx("div",{className:"mt-6 border-t"}),t[64]=W):W=t[64];let C;t[65]!==i.sections?(C=xt(i.sections),t[65]=i.sections,t[66]=C):C=t[66];let P;t[67]!==r?(P=o=>r("sections",o),t[67]=r,t[68]=P):P=t[68];let E;t[69]!==O||t[70]!==C||t[71]!==P?(E=e.jsx(ht,{value:C,onChange:P,meta:O,emptyMessage:"This category has no content yet. Use ⊕ to add your first block."}),t[69]=O,t[70]=C,t[71]=P,t[72]=E):E=t[72];let w;t[73]!==x||t[74]!==j||t[75]!==N||t[76]!==_||t[77]!==E?(w=e.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"mx-auto max-w-3xl px-8 py-8",children:[x,j,N,_,W,E]})}),t[73]=x,t[74]=j,t[75]=N,t[76]=_,t[77]=E,t[78]=w):w=t[78];let I;t[79]!==w||t[80]!==d?(I=e.jsxs("div",{className:"flex h-full flex-col",children:[d,w]}),t[79]=w,t[80]=d,t[81]=I):I=t[81];let q;return t[82]!==a||t[83]!==p||t[84]!==I||t[85]!==l?(q=e.jsx(yt,{orgSlug:p,virtualMcpId:l,branch:a,children:I}),t[82]=a,t[83]=p,t[84]=I,t[85]=l,t[86]=q):q=t[86],q}export{to as CategoryEditor};
@@ -1,21 +0,0 @@
1
- import{e as pe,c as Fe,bC as Ue,j as L,ct as qe,y as Me,F as Ee,p as re,K as ue,n as _e,o as oe,a2 as ae,f as Ae,d as we,g as Ke,r as h,t as Ve,b as We,z as He,aH as Qe}from"./index-C3Ab2DJ2.js";import{A as Re,a as Be,d as ze,e as Ge,f as Xe,u as Ze,w as Ye}from"./hooks-DLdyjUhZ.js";import{g as Je,u as et,S as tt}from"./use-mcp-client-BdKIOTso.js";import{a as nt}from"./use-virtual-mcp-Bc7GdFZa.js";import{u as st,b as de}from"./use-ai-providers-CC3uGtbf.js";import{n as ot,k as at}from"./tab-id-BptcWVWa.js";import{d as rt}from"./use-organization-settings--a-kmsBC.js";const it={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.4-mini"]},ct={anthropic:["claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.4"]},lt={anthropic:["claude-opus-4-8","claude-sonnet-4-6","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6:extended","anthropic/claude-sonnet-4.6","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],google:["gemini-3-pro"],"claude-code":["claude-code:opus-1m","claude-code:opus","claude-code:sonnet"],codex:["codex:gpt-5.5"]},dt={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],google:["gemini-2.0-flash-image"]},ut={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},pt={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function Pe(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function ht(t){return Pe(t).includes("deepresearch")}const ft=["sonar","searchpreview","online"];function De(t){const e=Pe(t);return e.includes("deepresearch")?!1:ft.some(o=>e.includes(o))}function $e(t){return t.asyncResearch!==!0&&De(t.modelId)}function Oe(t){return t.asyncResearch===!0||ht(t.modelId)||De(t.modelId)}function ne(t,e,o,n){for(const s of o){const a=t.find(r=>r.modelId===s);if(a)return{keyId:e,modelId:a.modelId,title:a.title}}for(const s of o){const a=t.find(r=>r.modelId.includes(s));if(a)return{keyId:e,modelId:a.modelId,title:a.title}}if(n){const s=t.find(n);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}return null}function mt(t,e){const o={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const n of t){const s=e[n.id]??[],a=n.providerId;o.chat.fast||(o.chat.fast=ne(s,n.id,it[a]??[])),o.chat.smart||(o.chat.smart=ne(s,n.id,ct[a]??[])),o.chat.thinking||(o.chat.thinking=ne(s,n.id,lt[a]??[])),o.image||(o.image=ne(s,n.id,dt[a]??[],r=>r.capabilities?.includes("image")===!0)),o.webSearch||(o.webSearch=ne(s,n.id,ut[a]??[],$e)),o.deepResearch||(o.deepResearch=ne(s,n.id,pt[a]??[],Oe))}return o}const gt=Ue("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function Kt(t){const e=pe.c(10),{variant:o,size:n}=t;let s;e[0]!==n||e[1]!==o?(s=Fe(gt({variant:o,size:n})),e[0]=n,e[1]=o,e[2]=s):s=e[2];let a,r;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=L.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),r=L.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=a,e[4]=r):(a=e[3],r=e[4]);let i;e[5]!==s?(i=L.jsxs("svg",{"aria-hidden":"true",className:s,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a,r]}),e[5]=s,e[6]=i):i=e[6];let f;e[7]===Symbol.for("react.memo_cache_sentinel")?(f=L.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=f):f=e[7];let g;return e[8]!==i?(g=L.jsxs("div",{role:"status",children:[i,f]}),e[8]=i,e[9]=g):g=e[9],g}function xt(t,e=[]){return t==="stop"?e.filter(s=>s.type==="text"&&s.text).map(s=>s.text).join(`
2
- `).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed":t==="tool-calls"?e.some(n=>n.type==="tool-user_ask"&&n.state==="input-available"||n.state==="approval-requested")?"requires_action":"completed":"failed"}const Se={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"decopilot-desktop":{harness:"decopilot",sandbox:"user-desktop"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function yt(t,e){if(!t)return null;const o=e?qe(e):null;if(t==="decopilot"&&o===null)return"decopilot";for(const[n,s]of Object.entries(Se))if(s.harness===t&&s.sandbox===o)return n;return null}function St(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function Ct(t){const e=pe.c(10);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=o):o=e[0];const n=Me(o);let s;if(e[1]!==n?.params.appSlug||e[2]!==n?.params.collectionName||e[3]!==n?.params.itemId||e[4]!==t){s=[],t&&s.push(`### Selected Agent
3
- - ID: ${t}`);let a;e[6]!==n?.params.appSlug||e[7]!==n?.params.collectionName||e[8]!==n?.params.itemId?(a=[],n?.params.appSlug&&a.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&a.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&a.push(`- Item ID: ${n?.params.itemId}`),e[6]=n?.params.appSlug,e[7]=n?.params.collectionName,e[8]=n?.params.itemId,e[9]=a):a=e[9],a.length>0&&s.push(`### Current Resource
4
- The user is viewing the following resource:
5
- ${a.join(`
6
- `)}
7
-
8
- Help the user understand and work with this resource.`),e[1]=n?.params.appSlug,e[2]=n?.params.collectionName,e[3]=n?.params.itemId,e[4]=t,e[5]=s}else s=e[5];return s.join(`
9
-
10
- `)}function It(){const t=pe.c(5),e=Ee(),{org:o}=re();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const s=Me(n);let a;return t[1]!==s?.params||t[2]!==o||t[3]!==e?(a=r=>{const f=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!f||!f[1])return;const g=f[1],y=s?.params.appSlug;if(!y)return;e.invalidateQueries({queryKey:ue.collection(o.slug,y,g)});const b=g.toLowerCase().replace(/_/g," ");_e.success(`${b} updated`)},t[1]=s?.params,t[2]=o,t[3]=e,t[4]=a):a=t[4],a}function vt(){const t=pe.c(4),{org:e,project:o}=re(),n=`${e.id}/${o.id}`;let s;t[0]!==n?(s=ae.taskLastViewed(n),t[0]=n,t[1]=s):s=t[1];const[,a]=oe(s,bt);let r;return t[2]!==a?(r={markTaskRead:f=>{a(g=>({...g,[f]:new Date().toISOString()}))}},t[2]=a,t[3]=r):r=t[3],r}function bt(t){return t??{}}function Ne(){const t=Ae(),{org:e}=re(),o=we({strict:!1}),n=Ke({strict:!1}),s=o.virtualmcpid??Je(e.id).id,a=(f,g)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:f},search:y=>{const b={},D=g?.virtualMcpId??y.virtualmcpid;D&&(b.virtualmcpid=D);const d=y.main;return d&&typeof d=="string"&&!ot(d)&&(b.main=d),y.chat&&(b.chat=y.chat),g?.autosend&&(b.autosend=Re),b}})},r=h.useRef(crypto.randomUUID()),i=n.taskId??r.current;return{virtualMcpId:s,taskId:i,navigateToTask:a}}function kt(t,e){const{mimeType:o,data:n}=t;if(o.startsWith("text/"))try{const s=new TextDecoder().decode(Uint8Array.from(atob(n),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
11
- ${s}`}]}catch(s){console.error("Failed to decode text file:",s)}return[{type:"file",url:`data:${o};base64,${n}`,filename:e,mediaType:o}]}function ke(t,e){const o=[];for(const n of t)"text"in n&&n.text?o.push({type:"text",text:`[${e}]
12
- ${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&o.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)});return o}function Tt(t,e){const o=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const s=Array.isArray(n.content)?n.content:[n.content];for(const a of s)switch(a.type){case"text":{const r=a.text?.trim();if(!r)continue;o.push({type:"text",text:`[${e}]
13
- ${r}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;o.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const r=a.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?o.push({type:"text",text:`[${e}]
14
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&o.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return o}function Le(t){if(!t)return[];const e=[];let o="";const n=s=>{if(s){if(s.type==="text"&&"text"in s&&typeof s.text=="string")o+=s.text;else if(s.type==="mention"&&s.attrs){const a=s.attrs.char??"/",r=`${a}${s.attrs.name}`;if(o+=r,a==="@"){const i=s.attrs.metadata;i&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??s.attrs.name} (agent_id: ${i.agentId})]
15
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...ke(i,r))}else{const i=s.attrs.metadata||s.attrs.prompts||[];Array.isArray(i)&&i.length>0&&"role"in i[0]?e.push(...Tt(i,r)):Array.isArray(i)&&e.push(...ke(i,r))}}else if(s.type==="file"&&s.attrs){const a=s.attrs,r=`[file:://${encodeURIComponent(a.name)}]`;o+=r,e.push(...kt(a,r))}if("content"in s&&Array.isArray(s.content))for(const a of s.content)n(a)}};return n(t),o.trim()&&e.unshift({type:"text",text:o.trim()}),e}function Vt(t){const e=Le(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const Te=new Set;function se(t){return h.useSyncExternalStore(t.subscribe,t.get,t.get)}function Mt(t){return t.kind==="loading"?"ready":t.kind}function Y(t,e,o,n){if(!t)return null;const s=e.find(r=>r.id===t.keyId);if(!s)return null;const a=o.find(r=>r.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:s.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function Et(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function _t(t,e,o,n){if(!o||n.length===0)return null;const s=e.find(f=>f.id===o);if(!s)return null;const a=mt([s],{[o]:n}),r=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!r)return null;const i=n.find(f=>f.modelId===r.modelId);return i?{...i,keyId:o}:null}const At=1e4,wt=10,Ce=h.createContext(null),Ie=h.createContext(null),ve=h.createContext(null),je=h.createContext(null);function Rt({children:t}){const{locator:e}=re(),{virtualMcpId:o}=Ne(),[n,s]=oe(ae.chatSelectedImageModel(e),null),[a,r]=oe(ae.chatSelectedWebSearchModel(e),null),[i,f]=oe(ae.chatSelectedDeepResearchModel(e),null),[g,y]=h.useState(null),[b,D]=h.useState("default"),d=rt(),[T,j]=oe(ae.chatSimpleModeTier(e),null),$=Et(T),S=st(),C=d.tiers[$],M=g&&S.some(c=>c.id===g)?g:C?.keyId??S[0]?.id??null,{models:I,isLoading:F}=de(M??void 0),{models:V}=de(C?.keyId),{models:U}=de(d.tiers.image?.keyId),{models:k}=de(d.tiers.web_search?.keyId),{models:q}=de(d.tiers.deep_research?.keyId),W=Y(C,S,V,C?.title)??_t($,S,M,I),K=F,H=I.filter(c=>c.capabilities?.includes("image")),u=Y(n,S,H),E=Y(d.tiers.image,S,U,d.tiers.image?.title)??u??H[0]??null,_=I.filter($e),Q=Y(a,S,_),X=_.find(c=>c.modelId==="perplexity/sonar")??_[0]??null,O=Y(d.tiers.web_search,S,k,d.tiers.web_search?.title)??Q??X,R=I.filter(Oe),m=Y(i,S,R),A=R.find(c=>c.modelId==="perplexity/deep-research")??R.find(c=>c.asyncResearch===!0)??R[0]??null,J=Y(d.tiers.deep_research,S,q,d.tiers.deep_research?.title)??m??A,ge=nt(o)??{id:o,title:"",description:null,icon:null},[he,fe]=h.useState({}),te=(c,ie)=>{const ce=[];for(const G of ie.content??[])G.type==="text"&&G.text?.trim()&&ce.push(G.text.trim());const le=ce.join(`
16
- `);if(!le){me(c);return}new TextEncoder().encode(le).length>At||fe(G=>Object.keys(G).length>=wt&&!(c in G)?G:{...G,[c]:le})},me=c=>{fe(ie=>{const{[c]:ce,...le}=ie;return le})},[xe,be]=oe(ae.chatLastAgentOption(e),c=>c&&c in Se?c:null),B=$t(),ye=B?.isThreadLocked&&B.lockedHarness!=null?yt(B.lockedHarness,B.lockedSandbox):null,l=xe,p=B?.isThreadLocked?ye:l,P=p?Se[p]:null,w=P?.harness??null,x=P?.sandbox??null,[N,Z]=h.useState(void 0),z=h.useRef(N);z.current=N;const v={selectedModel:W,setModel:()=>{},credentialId:M,setCredentialId:y,allModelsConnections:S,isModelsLoading:K,selectedVirtualMcp:ge,imageModel:E,setImageModel:c=>{s(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},webSearchModel:O,setWebSearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:J,setDeepResearchModel:c=>{f(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:b,setChatMode:D,appContexts:he,setAppContext:te,clearAppContext:me,tiptapDoc:N,setTiptapDoc:Z,tiptapDocRef:z,resetInteraction:()=>{},simpleModeTier:$,setSimpleModeTier:c=>j(c),pendingAgentOption:p,setPendingAgentOption:be,pendingHarnessId:w,pendingSandboxProviderKind:x};return L.jsx(ve.Provider,{value:v,children:t})}function Wt(t){const e=pe.c(41),{virtualMcpId:o,task:n,children:s}=t,{locator:a}=re(),{data:r}=We.useSession(),i=r?.user??null,{taskId:f,virtualMcpId:g,navigateToTask:y}=Ne(),[b]=He(),{markTaskRead:D}=vt(),d=Ze(),T=f,j=g,$=Ct(j);let S;e[0]!==D||e[1]!==y?(S=(m,A)=>{D(m),y(m,{virtualMcpId:A?.virtualMcpId,autosend:A?.autosend})},e[0]=D,e[1]=y,e[2]=S):S=e[2];const C=S,M=T&&n?.id===T?n:null,I=M?.harness_id??null,F=M?.sandbox_provider_kind??null,V=M?.branch??null,U=I!=null,k=V;let q;e[3]!==k||e[4]!==C||e[5]!==d||e[6]!==o?(q=()=>{const m=crypto.randomUUID();return d.create({id:m,virtual_mcp_id:o,...k?{branch:k}:{}}).then(()=>C(m)).catch(()=>{C(m)}),m},e[3]=k,e[4]=C,e[5]=d,e[6]=o,e[7]=q):q=e[7];const W=q;let K;e[8]!==k||e[9]!==a||e[10]!==C||e[11]!==d||e[12]!==o?(K=m=>{const A=crypto.randomUUID(),J=m.virtualMcpId??o,ee=J===o?k:null;Ye(sessionStorage,a,A,m.message),d.create({id:A,virtual_mcp_id:J,...ee?{branch:ee}:{}}).then(()=>C(A,{virtualMcpId:m.virtualMcpId,autosend:!0})).catch(()=>{C(A,{virtualMcpId:m.virtualMcpId,autosend:!0})})},e[8]=k,e[9]=a,e[10]=C,e[11]=d,e[12]=o,e[13]=K):K=e[13];const H=K;let u;e[14]!==T||e[15]!==d?(u=m=>{T&&d.setBranch(T,m)},e[14]=T,e[15]=d,e[16]=u):u=e[16];let E;e[17]!==M||e[18]!==W||e[19]!==H||e[20]!==k||e[21]!==T||e[22]!==j||e[23]!==U||e[24]!==V||e[25]!==I||e[26]!==F||e[27]!==C||e[28]!==u?(E={virtualMcpId:j,taskId:T,openTask:C,createTask:W,createTaskWithMessage:H,activeTask:M,isThreadLocked:U,lockedHarness:I,lockedSandbox:F,lockedBranch:V,currentBranch:k,setCurrentTaskBranch:u},e[17]=M,e[18]=W,e[19]=H,e[20]=k,e[21]=T,e[22]=j,e[23]=U,e[24]=V,e[25]=I,e[26]=F,e[27]=C,e[28]=u,e[29]=E):E=e[29];const _=E;let Q;e[30]!==$||e[31]!==b||e[32]!==y||e[33]!==i?(Q={user:i,contextPrompt:$,preferences:b,rawNavigateToTask:y},e[30]=$,e[31]=b,e[32]=y,e[33]=i,e[34]=Q):Q=e[34];const X=Q;let O;e[35]!==s||e[36]!==X?(O=L.jsx(Rt,{children:L.jsx(je.Provider,{value:X,children:s})}),e[35]=s,e[36]=X,e[37]=O):O=e[37];let R;return e[38]!==O||e[39]!==_?(R=L.jsx(Ie.Provider,{value:_,children:O}),e[38]=O,e[39]=_,e[40]=R):R=e[40],R}function Ht({taskId:t,children:e}){const{virtualMcpId:o,activeTask:n,currentBranch:s}=Pt();t&&!Te.has(t)&&(Te.add(t),Ve("chat_opened",{thread_id:t}));const{imageModel:a,webSearchModel:r,deepResearchModel:i,chatMode:f,setChatMode:g,appContexts:y,setTiptapDoc:b,simpleModeTier:D,pendingSandboxProviderKind:d,pendingHarnessId:T}=Dt(),j=h.useContext(je);if(!j)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:$,contextPrompt:S,preferences:C,rawNavigateToTask:M}=j,{org:I,locator:F}=re(),[V,U]=h.useState(null),k=It(),q=Ee(),W=Be(),K=Ae(),H=et({connectionId:tt,orgId:I.id,orgSlug:I.slug}),u=ze(I.slug,t,{client:H});h.use(u.ready);const E=se(u.messages),_=se(u.status),Q=se(u.finishReason),X=se(u.runStatusStage),O=se(u.hasMoreOlder),R=se(u.isFetchingOlder),m=h.useRef({onToolCall:k,queryClient:q,rawNavigateToTask:M,taskId:t,manager:W,navigate:K,orgId:I.id,orgSlug:I.slug});m.current={onToolCall:k,queryClient:q,rawNavigateToTask:M,taskId:t,manager:W,navigate:K,orgId:I.id,orgSlug:I.slug},h.useEffect(()=>{const l={onData:p=>{if(p.type==="data-thread-title"){const P=p.data;if(!P?.title)return;const w=m.current;if(!w.taskId)return;w.manager.patchThread({id:w.taskId,title:P.title,updated_at:new Date().toISOString()});return}if(p.type==="data-deck-updated"){const P=p.data;if(!P?.path)return;const w=P.path,x=m.current;x.queryClient.invalidateQueries({queryKey:ue.orgFsStat(x.orgId,"home",w)}),x.queryClient.invalidateQueries({queryKey:ue.orgFsRecent(x.orgId)}),x.navigate({to:".",search:N=>({...N,main:at(w)}),replace:!0});return}},onFinish:(p,P,w)=>{const x=m.current;x.taskId&&x.manager.patchThread({id:x.taskId,status:xt(w,p.parts),updated_at:new Date().toISOString()});const N=p.parts?.some(z=>{const v=z;return(v.type==="tool-share_with_user"||v.type==="tool-bash"||v.type==="tool-write")&&v.state==="output-available"});if(x.taskId&&N){const z=ue.threadOutputs(x.taskId);for(const v of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{x.queryClient.invalidateQueries({queryKey:z})},v)}x.queryClient.invalidateQueries({queryKey:ue.homeNextActions(x.orgSlug)});const Z=p.metadata?.thread_id;Z&&Z!==x.taskId&&x.rawNavigateToTask(Z)},onError:p=>{U(p),console.error("[chat] Error",p)},onToolCall:p=>m.current.onToolCall(p)};return u.observer=l,()=>{u.observer===l&&(u.observer=null)}},[u]);const A=_.kind==="submitted"||_.kind==="streaming",J=E.length===0,ee=E.at(-1),ge=!A&&ee?.role==="assistant"&&ee.parts.some(l=>"state"in l&&l.state==="approval-requested"),he=n,fe=(he?.status==="in_progress"||he?.status==="expired")&&_.kind==="ready"&&E.length>0;async function te(l){const p=l.parts??Le(l.tiptapDoc);if(p.length===0)return;const P=t,w=o;U(null),b(void 0);const x={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:$?.image??void 0,name:$?.name??"you"}},N=Object.entries(y),Z=N.length>0?N.map(([ie,ce])=>`### App Context: ${ie}
17
- ${ce}`).join(`
18
-
19
- `):"",z=[S,Z].filter(Boolean).join(`
20
-
21
- `);let v=f;v==="gen-image"&&!a&&(v="default"),v==="web-search"&&!r&&(v="default"),v==="deep-research"&&!i&&(v="default"),(v==="web-search"||v==="deep-research")&&g("default");const c={id:crypto.randomUUID(),role:"user",parts:p,metadata:x};await u.submit({kind:"message",message:c},{tier:D,mode:v,toolApprovalLevel:C.toolApprovalLevel??Qe(),system:z||void 0,agent:{id:w},thread_id:P,...St({thread:n?{harness_id:n.harness_id??null,sandbox_provider_kind:n.sandbox_provider_kind??null,branch:n.branch??null}:null,globals:{harnessId:T??void 0,sandboxProviderKind:d??void 0,branch:s}})})}const me=async()=>{u.stop();try{const l=await fetch(`/api/${I.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const p=await l.json().catch(()=>({}));throw new Error(p.message??`Cancel failed: ${l.status}`)}}catch(l){const p=l instanceof Error?l.message:"Failed to cancel";_e.error(p),console.error("[chat] cancelRun",l)}},xe=l=>l&&typeof l=="object"&&"type"in l?te({tiptapDoc:l}):te(l),B=we({strict:!1}).autosend===Re;h.useEffect(()=>{if(!B||E.length>0)return;const l=Ge(sessionStorage,F,t);l&&te(l.message).then(()=>{Xe(sessionStorage,F,t)})},[B,E.length,F,t,te]);const ye={messages:E,status:Mt(_),sendMessage:xe,stop:()=>{me()},submit:(l,p)=>u.submit(l,p),error:V,clearError:()=>U(null),finishReason:Q,runStatusStage:X,clearFinishReason:()=>u.finishReason.set(null),isStreaming:A,isChatEmpty:J,isWaitingForApprovals:ge??!1,isRunInProgress:fe,hasMoreOlder:O,isFetchingOlder:R,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return L.jsx(Ce.Provider,{value:ye,children:e})}function Qt(){const t=h.useContext(Ce);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function Bt(){return h.useContext(Ce)}function Pt(){const t=h.useContext(Ie);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function Dt(){const t=h.useContext(ve);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function zt(){return h.useContext(ve)}function $t(){return h.useContext(Ie)}export{Ht as A,Rt as C,Kt as S,Pt as a,Dt as b,$t as c,Le as d,yt as e,Bt as f,Wt as g,zt as h,$e as i,Oe as j,mt as p,Vt as t,Qt as u};
@@ -1 +0,0 @@
1
- import{e as n,c as d,j as c,bD as l,bE as b}from"./index-C3Ab2DJ2.js";import{i as m}from"./ChevronUp-CiXMtnii.js";function u(o){const e=n.c(9);let r,i;e[0]!==o?({className:r,...i}=o,e[0]=o,e[1]=r,e[2]=i):(r=e[1],i=e[2]);let a;e[3]!==r?(a=d("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[2px] disabled:opacity-50",r),e[3]=r,e[4]=a):a=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(b,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(m,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==i||e[7]!==a?(s=c.jsx(l,{"data-slot":"checkbox",className:a,...i,children:t}),e[6]=i,e[7]=a,e[8]=s):s=e[8],s}export{u as C};
@@ -1 +0,0 @@
1
- import{e as y,j as t,B as F,l as X,s as Ge,v as se,a1 as Pe,r as T,p as ie,x as Qe,c as V,bb as Ye,d as Xe,L as G,n as Ze,g as ae,bc as ke}from"./index-C3Ab2DJ2.js";import{E as Ae}from"./empty-state-BrSxZrfZ.js";import{u as et,a as Ee}from"./use-collections-DrlB7sAG.js";import{u as ce}from"./use-mcp-client-BdKIOTso.js";import{F as ne,a as tt,b as de,d as me}from"./form-BZY9ZRz4.js";import{I as ue}from"./input-BmmiCY6T.js";import{T as re}from"./textarea-D8B22gmM.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-CqHy6432.js";import{a9 as rt,x as it,_ as at,aa as ct,W as dt,ab as mt,M as be}from"./agent-icon-D5EbntAT.js";import{g as ut,M as xt,a as Ne}from"./types-7ak1Ve40.js";import{A as pt,a as ft,b as ht}from"./alert-DIqgQstn.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-Di6xzzYo.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-2IhfImXT.js";import{i as jt}from"./AlertCircle-DMqR3m0L.js";import{s as bt}from"./Stars02-9vF61uFx.js";import{a as Nt}from"./Eye-D3THRXh6.js";import{i as vt}from"./Play-C6QgiUls.js";import{i as St}from"./ChevronRight-Dj41DV2U.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-C4w1u5Cz.js";import{a as Oe,u as Re}from"./use-connection-Dffadu_t.js";import{a as It}from"./use-mcp-tools-CYtQa-6Z.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-CFvT6ZpF.js";import{f as Tt,h as Pt}from"./chat-context-BNtznWGC.js";import{b as kt}from"./shell-layout-DmxTk-Cg.js";import{M as At}from"./monaco-editor-yw8USVwR.js";import{n as Et}from"./XCircle-DRGwo6Em.js";import"./auth-tkqpBHf1.js";import"./label-DitP_QKf.js";import"./index-CszBxeF9.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./sheet-COdJ-0Qy.js";import"./X-CKIhVHQk.js";import"./ZoomOut-DVSwpwUz.js";import"./Key01-Lcx9qTy7.js";import"./extract-connection-data-CBzjCfJ2.js";import"./use-registry-connections-CK9xDmAR.js";import"./use-organization-settings--a-kmsBC.js";import"./studio-tools-DRut7Wwk.js";import"./Plus-_82_8sq8.js";import"./index-CE8AoMpS.js";import"./index-DexxTctJ.js";import"./popover-BcAFMnrn.js";import"./use-virtual-mcp-Bc7GdFZa.js";import"./ChevronUp-CiXMtnii.js";import"./SearchMd-C3Pmxf99.js";import"./Users03-BOvyNEV4.js";import"./use-create-virtual-mcp-D6wTKoFC.js";import"./use-navigate-to-agent-BTMo9com.js";import"./Tool01-B4SsemMS.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./Settings02-B7hO-Tma.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ZapSquare-C7yt7KfQ.js";import"./CheckCircle-D6b8lFUP.js";import"./ChevronDown-CYFvWHpZ.js";import"./ChevronLeft-DXSAgzPw.js";import"./DotsVertical-y5lMfVOQ.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Star01-BfSEPDRT.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Trash01-CG0gTYx7.js";import"./Upload01-BlvGy5d-.js";import"./User01-CTuKNCEa.js";import"./Users01-KXiCgru2.js";import"./XClose-Ig7y9gcI.js";import"./Zap-w60sxAoc.js";import"./mcp-oauth-BGmk7Mi5.js";import"./badge-an9iff2c.js";import"./hooks-DLdyjUhZ.js";import"./decopilot-sse-pool-BkzSWgw-.js";import"./use-ai-providers-CC3uGtbf.js";import"./tab-id-BptcWVWa.js";import"./avatar-DfTXVgX9.js";import"./dialog-CyIn0DRx.js";import"./required-auth-layout-B3CS-pLH.js";import"./useRouterState-DgLuS94C.js";import"./use-org-sso-CEQ82hSZ.js";import"./index-xsAZnQ1t.js";function Ot(s){const e=y.c(15),{onSave:o,onUndo:n,isDirty:l,isSaving:r,saveLabel:a,undoLabel:c}=s,i=a===void 0?"Save":a,u=c===void 0?"Undo":c;if(!l)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(rt,{size:14}),e[0]=x):x=e[0];let m;e[1]!==r||e[2]!==n||e[3]!==u?(m=t.jsxs(F,{variant:"outline",size:"sm",onClick:n,disabled:r,"aria-label":u,children:[x,u]}),e[1]=r,e[2]=n,e[3]=u,e[4]=m):m=e[4];let p;e[5]!==r?(p=r?t.jsx(X,{size:14,className:"animate-spin"}):t.jsx(it,{size:14}),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==r||e[8]!==o||e[9]!==i||e[10]!==p?(f=t.jsxs(F,{variant:"default",size:"sm",onClick:o,disabled:r,"aria-label":i,children:[p,i]}),e[7]=r,e[8]=o,e[9]=i,e[10]=p,e[11]=f):f=e[11];let g;return e[12]!==m||e[13]!==f?(g=t.jsxs(t.Fragment,{children:[m,f]}),e[12]=m,e[13]=f,e[14]=g):g=e[14],g}Ge({title:se().min(1),description:se().nullable(),body:se()});function le(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Rt(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(n=>n==="mcps"),o=e>=0?s[e+1]:void 0;return o?decodeURIComponent(o):void 0}function _t(s){const e=y.c(13),{form:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=n):n=e[0];let l;e[1]!==o.control?(l=t.jsxs("div",{className:"flex flex-col gap-4",children:[n,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(ne,{control:o.control,name:"title",render:zt}),t.jsx(ne,{control:o.control,name:"description",render:Dt})]})]}),e[1]=o.control,e[2]=l):l=e[2];let r,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=a):(r=e[3],a=e[4]);let c;e[5]!==o.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[r,a,t.jsx(ne,{control:o.control,name:"body",render:Mt})]}),e[5]=o.control,e[6]=c):c=e[6];let i;e[7]!==l||e[8]!==c?(i=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[l,c]}),e[7]=l,e[8]=c,e[9]=i):i=e[9];let u;return e[10]!==o||e[11]!==i?(u=t.jsx(tt,{...o,children:i}),e[10]=o,e[11]=i,e[12]=u):u=e[12],u}function Mt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Dt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Lt(s){const e=y.c(36),{providerId:o,promptId:n}=s,{org:l}=ie(),r=o||null;let a;e[0]!==l.id||e[1]!==l.slug||e[2]!==r?(a={connectionId:r,orgId:l.id,orgSlug:l.slug},e[0]=l.id,e[1]=l.slug,e[2]=r,e[3]=a):a=e[3];const c=ce(a),i=et(o,"PROMPT",n,c),u=Ee(o,"PROMPT",c),x=u.update.isPending;let m;e[4]!==i?(m=i?{title:i.title,description:i.description??null,body:le(i)}:void 0,e[4]=i,e[5]=m):m=e[5];let p;e[6]!==m?(p={values:m},e[6]=m,e[7]=p):p=e[7];const f=Qe(p);let g;e[8]!==f||e[9]!==i?(g=()=>{i&&f.reset({title:i.title,description:i.description??null,body:le(i)})},e[8]=f,e[9]=i,e[10]=g):g=e[10];const S=g;let I;e[11]!==u.update||e[12]!==f||e[13]!==n?(I=f.handleSubmit(async N=>{const E=await u.update.mutateAsync({id:n,data:{title:N.title,description:N.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:N.body}}]}});f.reset({title:E.title,description:E.description??null,body:le(E)})}),e[11]=u.update,e[12]=f,e[13]=n,e[14]=I):I=e[14];const R=I;if(!i){let N;return e[15]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ae,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=N):N=e[15],N}let $;e[16]!==i.title?($=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[16]=i.title,e[17]=$):$=e[17];let A;e[18]!==i.description?(A=i.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:i.description})]}):null,e[18]=i.description,e[19]=A):A=e[19];let P;e[20]!==$||e[21]!==A?(P=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[$,A]})}),e[20]=$,e[21]=A,e[22]=P):P=e[22];let b;e[23]!==R?(b=()=>{R()},e[23]=R,e[24]=b):b=e[24];let w;e[25]!==f.formState.isDirty||e[26]!==x||e[27]!==S||e[28]!==b?(w=t.jsx(st,{children:t.jsx(Ot,{onSave:b,onUndo:S,isDirty:f.formState.isDirty,isSaving:x})}),e[25]=f.formState.isDirty,e[26]=x,e[27]=S,e[28]=b,e[29]=w):w=e[29];let C;e[30]!==f?(C=t.jsx("div",{className:"h-full",children:t.jsx(_t,{form:f})}),e[30]=f,e[31]=C):C=e[31];let k;return e[32]!==w||e[33]!==C||e[34]!==P?(k=t.jsxs(xe,{children:[P,w,C]}),e[32]=w,e[33]=C,e[34]=P,e[35]=k):k=e[35],k}function Ut(s){const e=y.c(4),{itemId:o}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Rt(),e[0]=n):n=e[0];const l=n;if(!l){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Ae,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let r;return e[2]!==o?(r=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:null,children:t.jsx(Lt,{providerId:l,promptId:o})})}),e[2]=o,e[3]=r):r=e[3],r}function _e(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("min-w-0 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Me(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("ol",{"data-slot":"breadcrumb-list",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function q(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("inline-flex items-center gap-1.5 min-w-0",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("li",{"data-slot":"breadcrumb-item",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Q(s){const e=y.c(10);let o,n,l;e[0]!==s?({asChild:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);const r=o?Ye:"a";let a;e[4]!==n?(a=V("hover:text-foreground transition-colors truncate",n),e[4]=n,e[5]=a):a=e[5];let c;return e[6]!==r||e[7]!==l||e[8]!==a?(c=t.jsx(r,{"data-slot":"breadcrumb-link",className:a,...l}),e[6]=r,e[7]=l,e[8]=a,e[9]=c):c=e[9],c}function De(s){const e=y.c(8);let o,n;e[0]!==s?({className:o,...n}=s,e[0]=s,e[1]=o,e[2]=n):(o=e[1],n=e[2]);let l;e[3]!==o?(l=V("text-foreground font-medium truncate",o),e[3]=o,e[4]=l):l=e[4];let r;return e[5]!==n||e[6]!==l?(r=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:l,...n}),e[5]=n,e[6]=l,e[7]=r):r=e[7],r}function Y(s){const e=y.c(12);let o,n,l;e[0]!==s?({children:o,className:n,...l}=s,e[0]=s,e[1]=o,e[2]=n,e[3]=l):(o=e[1],n=e[2],l=e[3]);let r;e[4]!==n?(r=V("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",n),e[4]=n,e[5]=r):r=e[5];let a;e[6]!==o?(a=o??t.jsx(St,{}),e[6]=o,e[7]=a):a=e[7];let c;return e[8]!==l||e[9]!==r||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:r,...l,children:a}),e[8]=l,e[9]=r,e[10]=a,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=y.c(11),{toolName:o,connectionId:n,siblings:l,onSelectInstance:r,onBack:a}=s;let c;e[0]!==n?(c={connectionId:n},e[0]=n,e[1]=c):c=e[1];const i=wt(c);if(!i.isAuthenticated){let m;return e[2]!==i.supportsOAuth||e[3]!==a?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:i.supportsOAuth?t.jsx(ot,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(lt,{hasReadme:!1})}),e[2]=i.supportsOAuth,e[3]=a,e[4]=m):m=e[4],m}const u=`${n}:${o}`;let x;return e[5]!==n||e[6]!==r||e[7]!==l||e[8]!==u||e[9]!==o?(x=t.jsx(Vt,{toolName:o,connectionId:n,siblings:l,onSelectInstance:r},u),e[5]=n,e[6]=r,e[7]=l,e[8]=u,e[9]=o,e[10]=x):x=e[10],x}function Vt({toolName:s,connectionId:e,siblings:o,onSelectInstance:n}){const{replayId:l}=Xe({strict:!1}),r=(()=>{if(!l)return null;const d=`replay-${l}`,h=sessionStorage.getItem(d);if(!h)return null;sessionStorage.removeItem(d);try{return JSON.parse(h)}catch{return null}})(),a=(()=>{if(!r)return null;const d={};for(const[h,v]of Object.entries(r))v!==null&&typeof v=="object"?d[h]=JSON.stringify(v,null,2):d[h]=v;return d})(),[c,i]=T.useState(a??{}),[u,x]=T.useState(r?JSON.stringify(r,null,2):"{}"),[m,p]=T.useState(null),[f,g]=T.useState(null),[S,I]=T.useState(null),[R,$]=T.useState(null),[A,P]=T.useState(!1),[b,w]=T.useState(null),{org:C}=ie(),k=Oe(e),N=Tt(),E=Pt(),{setChatOpen:U}=kt(),z=`${e}:${s}`,_=ce({connectionId:e,orgId:C.id,orgSlug:C.slug}),L=It({client:_}),j=L.data?.tools?.find(d=>d.name===s),O=ut(j?._meta),J=d=>{if(!N)return;const h=$t(d.content);h.content.length>0&&(U(!0),N.sendMessage({tiptapDoc:h}))},[M,Z]=T.useState("json"),[ze,Le]=T.useState(!1);O&&!ze&&(Z("ui"),Le(!0));const pe=j?.inputSchema?.properties,fe=pe?Object.keys(pe):[],H=fe.length>0,W={};if(H&&j?.inputSchema?.properties)for(const d of fe)W[d]=j.inputSchema.required?.includes(d)?"":void 0;const ee=d=>Object.prototype.hasOwnProperty.call(c,d),Ue=async()=>{P(!0),$(null),p(null),g(null),I(null),w(null);const d=performance.now();try{if(!_)throw new Error("MCP client is not available");const h=H?{...W,...c}:(()=>{const D=u.trim();if(!D)return{};const B=JSON.parse(D);if(B&&typeof B=="object")return B;throw new Error("Raw JSON input must be an object.")})();H&&j?.inputSchema?.properties&&Object.entries(j.inputSchema.properties).forEach(([D,B])=>{if((B.type==="object"||B.type==="array")&&typeof h[D]=="string")try{h[D]=JSON.parse(h[D])}catch{}else if((B.type==="number"||B.type==="integer")&&typeof h[D]=="string"&&h[D]!==""){const je=Number(h[D]);Number.isNaN(je)||(h[D]=je)}});const v=await _.callTool({name:s,arguments:h}),K=v.structuredContent??v,He=performance.now(),We=Math.round(He-d);p(K),g(v),I(h);const Ke=JSON.stringify(K),ge=new TextEncoder().encode(Ke).length;w({duration:`${We}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(h){const v=h instanceof Error?h.message:String(h);$(v||"Unknown error occurred");const K=performance.now();w({duration:`${Math.round(K-d)}ms`})}finally{P(!1)}},te=(d,h)=>{i(v=>({...v,[d]:h}))},Be=()=>{p(null),g(null),I(null),$(null),w(null)},Fe=j?.name??Bt(s),Ve=t.jsx(_e,{children:t.jsxs(Me,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:C.slug},children:"Connections"})})}),t.jsx(Y,{}),k&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:C.slug,appSlug:yt(k)},search:{tab:"tools"},children:k.title})})}),t.jsx(Y,{})]}),t.jsx(q,{children:t.jsx(De,{children:Fe})})]})}),he=o.length>1&&t.jsxs(ve,{value:e,onValueChange:n,children:[t.jsx(Se,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ye,{})}),t.jsx(we,{children:o.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Te,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Je=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),j?.inputSchema?.required&&j.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:H&&j?.inputSchema?.properties?Object.entries(j.inputSchema.properties).map(([d,h])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,j.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:h.type})]}),h.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:h.description}),h.type==="object"||h.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:ee(d)?c[d]??"":W[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):h.type==="boolean"?t.jsxs(ve,{value:ee(d)?String(c[d]??""):"",onValueChange:v=>te(d,v==="true"),children:[t.jsx(Se,{children:t.jsx(ye,{placeholder:"Select true or false..."})}),t.jsxs(we,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:ee(d)?c[d]??"":W[d]??"",onChange:v=>te(d,v.target.value),placeholder:`Enter ${d}...`})]},d)):j?.inputSchema&&!H?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:d=>x(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:A?t.jsxs(F,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(at,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(F,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ue,children:[t.jsx(vt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),qe=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[b&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(bt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ct,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(dt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]}),O&&t.jsx(gt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("ui"),children:t.jsx(mt,{size:14})})}),t.jsx($e,{children:"Interactive view"})]}),t.jsxs(Ce,{children:[t.jsx(Ie,{asChild:!0,children:t.jsx(F,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>Z("json"),children:t.jsx(be,{size:14})})}),t.jsx($e,{children:"JSON view"})]})]})})]})]}),R&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(pt,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(jt,{className:"h-4 w-4"}),t.jsx(ft,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(ht,{className:"text-xs text-destructive",children:R})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:O&&M==="ui"&&_?t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(xt,{resourceURI:O,toolInfo:j?{tool:j}:void 0,toolInput:S??void 0,toolResult:f??void 0,displayMode:"fullscreen",minHeight:Ne.view.minHeight,maxHeight:Ne.view.maxHeight,client:_,onMessage:J,onUpdateModelContext:d=>E?.setAppContext(z,d),onTeardown:()=>E?.clearAppContext(z),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(At,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(F,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),Ze.success("Copied to clipboard")},children:t.jsx(Nt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(be,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(xe,{breadcrumb:Ve,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx(Te,{icon:k?.icon||null,name:k?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[L.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):L.isLoading?t.jsx(X,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:L.isSuccess?"ready":L.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:j?.annotations,_meta:j?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:j?.description||"No description available"})]}),o.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Je}),qe]})})]})})}function Jt(s){const e=y.c(10),{itemId:o,siblings:n,onBack:l}=s,[r,a]=T.useState(n[0]?.id??"");let c;e[0]!==r||e[1]!==n?(c=n.find(p=>p.id===r)?.id??n[0]?.id??"",e[0]=r,e[1]=n,e[2]=c):c=e[2];const i=c;if(!Oe(i||void 0)||!i){let p;return e[3]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=p):p=e[3],p}let x;e[4]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=x):x=e[4];let m;return e[5]!==i||e[6]!==l||e[7]!==n||e[8]!==o?(m=t.jsx(T.Suspense,{fallback:x,children:t.jsx(Ft,{toolName:o,connectionId:i,siblings:n,onSelectInstance:a,onBack:l})}),e[5]=i,e[6]=l,e[7]=n,e[8]=o,e[9]=m):m=e[9],m}function qt(s){const e=y.c(21),{icon:o,illustration:n,title:l,description:r,buttonProps:a,buttonComponent:c,className:i,children:u}=s;let x;e[0]!==i?(x=V("flex flex-col items-center justify-center py-16 text-center",i),e[0]=i,e[1]=x):x=e[1];let m;e[2]!==o||e[3]!==n?(m=n?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:n}):o?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:o}):null,e[2]=o,e[3]=n,e[4]=m):m=e[4];let p;e[5]!==l?(p=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:l}),e[5]=l,e[6]=p):p=e[6];let f;e[7]!==r?(f=r&&t.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e[7]=r,e[8]=f):f=e[8];let g;e[9]!==p||e[10]!==f?(g=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[p,f]}),e[9]=p,e[10]=f,e[11]=g):g=e[11];let S;e[12]!==c||e[13]!==a?(S=(c??a)&&t.jsx("div",{className:"mt-4",children:c??(a&&t.jsx(F,{size:"sm",className:V(a?.className),...a}))}),e[12]=c,e[13]=a,e[14]=S):S=e[14];let I;return e[15]!==u||e[16]!==x||e[17]!==m||e[18]!==g||e[19]!==S?(I=t.jsxs("div",{className:x,children:[m,g,S,u]}),e[15]=u,e[16]=x,e[17]=m,e[18]=g,e[19]=S,e[20]=I):I=e[20],I}const Ht={prompt:Ut};function Wt(){const s=y.c(9),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.itemId);let r;s[1]!==n.appSlug?(r={slug:n.appSlug},s[1]=n.appSlug,s[2]=r):r=s[2];const a=Re(r);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const i=c,u=Kt;let x;return s[5]!==i||s[6]!==l||s[7]!==a?(x=t.jsx(Jt,{itemId:l,siblings:a,onBack:i,onUpdate:u}),s[5]=i,s[6]=l,s[7]=a,s[8]=x):x=s[8],x}async function Kt(s){return Promise.resolve()}function Gt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=y.c(41),e=ke();let o;s[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=o):o=s[0];const n=ae(o),l=decodeURIComponent(n.collectionName),r=decodeURIComponent(n.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:i}=ie();let u;s[3]!==n.appSlug?(u={slug:n.appSlug},s[3]=n.appSlug,s[4]=u):u=s[4];const m=Re(u)[0]??null,p=m?.id??"",f=p||"no-connection",g=p??null;let S;s[5]!==i.id||s[6]!==i.slug||s[7]!==g?(S={connectionId:g,orgId:i.id,orgSlug:i.slug},s[5]=i.id,s[6]=i.slug,s[7]=g,s[8]=S):S=s[8];const I=ce(S),R=Ee(f,l,I);let $;s[9]!==R||s[10]!==r?($=async M=>{r&&await R.update.mutateAsync({id:r,data:M})},s[9]=R,s[10]=r,s[11]=$):$=s[11];const A=$;let P;s[12]!==l?(P=l?.toLowerCase(),s[12]=l,s[13]=P):P=s[13];const b=P,w=b&&Ht[b];let C;s[14]!==l?(C=Gt(l),s[14]=l,s[15]=C):C=s[15];const k=C;let N;s[16]!==i.slug?(N=t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:i.slug},children:"Connections"})})}),s[16]=i.slug,s[17]=N):N=s[17];let E;s[18]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(Y,{}),s[18]=E):E=s[18];let U;s[19]!==l||s[20]!==m||s[21]!==i.slug||s[22]!==n.appSlug?(U=m&&t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:n.appSlug},search:{tab:l},children:m.title})})}),t.jsx(Y,{})]}),s[19]=l,s[20]=m,s[21]=i.slug,s[22]=n.appSlug,s[23]=U):U=s[23];let z;s[24]!==k?(z=t.jsx(q,{children:t.jsx(De,{children:k})}),s[24]=k,s[25]=z):z=s[25];let _;s[26]!==U||s[27]!==z||s[28]!==N?(_=t.jsx(_e,{children:t.jsxs(Me,{children:[N,E,U,z]})}),s[26]=U,s[27]=z,s[28]=N,s[29]=_):_=s[29];const L=_;if(w){let M;return s[30]!==w||s[31]!==c||s[32]!==A||s[33]!==r?(M=t.jsx(w,{itemId:r,onBack:c,onUpdate:A}),s[30]=w,s[31]=c,s[32]=A,s[33]=r,s[34]=M):M=s[34],M}let j;s[35]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(Et,{size:36,className:"text-muted-foreground"}),s[35]=j):j=s[35];let O;s[36]!==c?(O=t.jsx(qt,{icon:j,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=O):O=s[37];let J;return s[38]!==L||s[39]!==O?(J=t.jsx(xe,{breadcrumb:L,children:O}),s[38]=L,s[39]=O,s[40]=J):J=s[40],J}function Yt(){const s=y.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const o=ae(e);if(decodeURIComponent(o.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Wt,{}),s[1]=a):a=s[1],a}let r;return s[2]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Qt,{}),s[2]=r):r=s[2],r}function Rn(){const s=y.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Pe,{children:t.jsx(T.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(X,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Yt,{})})}),s[0]=e):e=s[0],e}export{Rn as default};
@@ -1 +0,0 @@
1
- import{e as B,j as s,c as M,B as V}from"./index-C3Ab2DJ2.js";import{c as z,a as _,b as $,D as E}from"./dropdown-menu-kPcoeCiJ.js";import{i as L,n as O,b as R,d as A,c as F}from"./SwitchHorizontal01-yw5VS97V.js";import{i as S}from"./ChevronUp-CiXMtnii.js";import{T as I,a as K,c as P,b as W}from"./tooltip-2IhfImXT.js";import{V as q}from"./view-mode-toggle-Cc6sYskX.js";import{B as G}from"./badge-an9iff2c.js";function te(t){const e=B.c(31),{viewMode:r,onViewModeChange:m,sortKey:T,sortDirection:p,onSort:f,sortOptions:u,filters:h}=t;let g;e[0]!==u?(g=u===void 0?[]:u,e[0]=u,e[1]=g):g=e[1];const j=g;let b;e[2]!==h?(b=h===void 0?[]:h,e[2]=h,e[3]=b):b=e[3];const l=b;let v;e[4]!==l?(v=l.filter(J),e[4]=l,e[5]=v):v=e[5];const N=v.length;let w;e[6]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(R,{size:16}),e[6]=w):w=e[6];let i;e[7]!==N?(i=N>0&&s.jsx(G,{variant:"default",className:"absolute -top-1.5 -right-1.5 h-4 min-w-4 px-1 text-[10px] leading-none",children:N}),e[7]=N,e[8]=i):i=e[8];let o;e[9]!==i?(o=s.jsx(I,{asChild:!0,children:s.jsx(_,{asChild:!0,children:s.jsxs(V,{variant:"outline",size:"icon",className:"relative",children:[w,i]})})}),e[9]=i,e[10]=o):o=e[10];let C;e[11]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(K,{children:"Display & filters"}),e[11]=C):C=e[11];let n;e[12]!==o?(n=s.jsx(P,{children:s.jsxs(W,{children:[o,C]})}),e[12]=o,e[13]=n):n=e[13];let a;e[14]!==m||e[15]!==r?(a=m&&r&&s.jsx("div",{className:"p-2 border-b border-border",children:s.jsx(q,{value:r,onValueChange:m,fullWidth:!0,options:[{value:"table",icon:s.jsx(A,{})},{value:"cards",icon:s.jsx(F,{})}]})}),e[14]=m,e[15]=r,e[16]=a):a=e[16];let c;e[17]!==f||e[18]!==p||e[19]!==T||e[20]!==j?(c=j.length>0&&f&&s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),j.map(y=>{const D=T===y.id;return s.jsx(z,{onClick:()=>f(y.id),className:M("h-8 px-2 py-0 cursor-pointer",D&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[D&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!D&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:y.label}),D&&p&&(p==="asc"?s.jsx(L,{size:16,className:"text-foreground shrink-0"}):s.jsx(O,{size:16,className:"text-foreground shrink-0"}))]})},y.id)})]}),e[17]=f,e[18]=p,e[19]=T,e[20]=j,e[21]=c):c=e[21];let d;e[22]!==l?(d=l.map(H),e[22]=l,e[23]=d):d=e[23];let x;e[24]!==a||e[25]!==c||e[26]!==d?(x=s.jsxs($,{align:"end",className:"w-[200px] p-0 gap-0",children:[a,c,d]}),e[24]=a,e[25]=c,e[26]=d,e[27]=x):x=e[27];let k;return e[28]!==n||e[29]!==x?(k=s.jsxs(E,{children:[n,x]}),e[28]=n,e[29]=x,e[30]=k):k=e[30],k}function H(t){return s.jsxs("div",{className:"p-1 flex flex-col gap-0.5 border-b border-border last:border-b-0",children:[s.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:t.label}),t.options.map(e=>{const r=t.value===e.id;return s.jsx(z,{onClick:()=>t.onChange(e.id),className:M("h-8 px-2 py-0 cursor-pointer",r&&"bg-accent"),children:s.jsxs("div",{className:"flex items-center gap-2 w-full",children:[r&&s.jsx(S,{size:16,className:"text-foreground shrink-0"}),!r&&s.jsx("div",{className:"w-4 shrink-0"}),s.jsx("span",{className:"text-sm text-foreground flex-1",children:e.label})]})},e.id)})]},t.label)}function J(t){return t.value!=="ALL"}export{te as C};
@@ -1 +0,0 @@
1
- import{e as b,p as w,K as k,m as z,j as s,r as M,B as T,c as v}from"./index-C3Ab2DJ2.js";import{a as I,b as S,D,c as E,d as R}from"./dialog-CyIn0DRx.js";import{S as _}from"./chat-context-BNtznWGC.js";import{i as $}from"./ChevronUp-CiXMtnii.js";import{a as A}from"./Eye-D3THRXh6.js";import{u as B}from"./studio-tools-DRut7Wwk.js";const L={online:!1,capabilities:[],ready:!1};function F(){const i=b.c(7),{org:e}=w(),l=B();let o;i[0]!==e.id?(o=k.currentLink(e.id),i[0]=e.id,i[1]=o):o=i[1];let t;i[2]!==l?(t=async()=>{const f=await l.call("LINK_CURRENT_GET",{});return f?{...f,ready:!0}:{...L,ready:!0}},i[2]=l,i[3]=t):t=i[3];let n;i[4]!==o||i[5]!==t?(n={queryKey:o,queryFn:t,staleTime:4e3,refetchInterval:5e3,refetchOnWindowFocus:!0},i[4]=o,i[5]=t,i[6]=n):n=i[6];const{data:p}=z(n);return p??L}function K(i){const e=b.c(3),{size:l}=i,o=l===void 0?16:l;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("path",{d:"M13 12L18.5 5M7.63965 3L12.5 12L13.6865 3M4.48381 6.71679L11.9872 12M3 12L11.9872 12.473M12.2244 13.177L7 20M4.84194 16.8682L11.2824 12.9758M11.5 21L12.665 13.177M21 14L13.1846 12.668M21 10.5788L13 12.3223M16.779 19.646L12.8876 13.3772M19.3566 18.207L13.313 12.9893"}),e[0]=t):t=e[0];let n;return e[1]!==o?(n=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),e[1]=o,e[2]=n):n=e[2],n}function O(i){const e=b.c(3),{size:l}=i,o=l===void 0?16:l;let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx("path",{clipRule:"evenodd",d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"}),e[0]=t):t=e[0];let n;return e[1]!==o?(n=s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:o,height:o,fill:"currentColor",fillRule:"evenodd","aria-hidden":"true",children:t}),e[1]=o,e[2]=n):n=e[2],n}const y="bunx decocms@latest link",N=[{capability:"claude-code",label:"Claude Code",description:"Runs through the Claude Code CLI",icon:s.jsx(K,{size:18})},{capability:"codex",label:"Codex",description:"Runs through the Codex CLI",icon:s.jsx(O,{size:18})}];function Q(i){return N.filter(e=>i.includes(e.capability)).map(e=>e.label)}function U(i){const e=b.c(21),{open:l,onOpenChange:o}=i,t=F(),[n,p]=M.useState(!1),f=t.hostname??t.machineId??"Your desktop",j=t.online?`Connected to ${f}`:"Connect your desktop";let a;e[0]!==j?(a=s.jsx(I,{children:j}),e[0]=j,e[1]=a):a=e[1];const C=t.online?"This machine provides the following local agents.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let r;e[2]!==C?(r=s.jsx(S,{children:C}),e[2]=C,e[3]=r):r=e[3];let c;e[4]!==a||e[5]!==r?(c=s.jsxs(D,{children:[a,r]}),e[4]=a,e[5]=r,e[6]=c):c=e[6];let d;e[7]!==n||e[8]!==t.online?(d=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:y}),s.jsx(T,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(y),p(!0),setTimeout(()=>p(!1),1500)},children:n?s.jsx($,{size:14}):s.jsx(A,{size:14})})]}),e[7]=n,e[8]=t.online,e[9]=d):d=e[9];let u;e[10]!==t.capabilities||e[11]!==t.online?(u=t.online?s.jsx("div",{className:"flex flex-col gap-3 text-sm",children:s.jsx("div",{className:"flex flex-col gap-2",children:N.map(x=>{const g=t.capabilities.includes(x.capability);return s.jsxs("div",{className:v("flex items-center gap-3 rounded-md border px-3 py-2",g?"border-border bg-background text-foreground":"border-border/60 bg-muted/40 text-muted-foreground"),children:[s.jsx("div",{className:v("flex size-6 items-center justify-center",g?"text-foreground":"text-muted-foreground"),children:x.icon}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-medium",children:x.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:g?x.description:"Not detected"})]}),s.jsx("span",{className:v("size-2 rounded-full",g?"bg-success":"bg-muted-foreground/30")})]},x.capability)})})}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(_,{size:"sm"}),"Waiting for desktop…"]}),e[10]=t.capabilities,e[11]=t.online,e[12]=u):u=e[12];let m;e[13]!==c||e[14]!==d||e[15]!==u?(m=s.jsxs(E,{className:"sm:max-w-md",children:[c,d,u]}),e[13]=c,e[14]=d,e[15]=u,e[16]=m):m=e[16];let h;return e[17]!==o||e[18]!==l||e[19]!==m?(h=s.jsx(R,{open:l,onOpenChange:o,children:m}),e[17]=o,e[18]=l,e[19]=m,e[20]=h):h=e[20],h}export{U as C,K as a,O as b,F as u,Q as v};
@@ -1 +0,0 @@
1
- import{s as he,aD as Ie,b2 as Ae,v as le,aB as De,e as P,j as t,l as ge,B as E,r as q,c as je,p as J,a5 as $e,K as ne,f as Y,a9 as ce,u as Pe,b3 as Oe,a1 as ze,g as Me,b4 as Ve,F as Ee,x as Ue,w as Fe,n as G,b5 as Re}from"./index-C3Ab2DJ2.js";import{g as Le}from"./extract-connection-data-CBzjCfJ2.js";import{E as ve}from"./empty-state-BrSxZrfZ.js";import{E as Be,c as He,r as We,b as Xe,d as Ge}from"./connection-form-helpers-ByFrPc9N.js";import{c as qe,S as Ke,V as Qe}from"./index-CqHy6432.js";import{u as be,T as Je}from"./index-C4w1u5Cz.js";import{u as Ye}from"./use-members-BWyLHt4a.js";import{A as Ze}from"./avatar-DfTXVgX9.js";import{a as Ne,b as ye,u as et}from"./use-connection-Dffadu_t.js";import{u as _e}from"./use-mcp-client-BdKIOTso.js";import{a as tt}from"./use-mcp-tools-CYtQa-6Z.js";import{a as st}from"./use-mcp-prompts-5xEBY9_7.js";import{i as nt,a as ot}from"./mcp-oauth-BGmk7Mi5.js";import{I as oe}from"./integration-icon-CFvT6ZpF.js";import{s as it}from"./Plus-_82_8sq8.js";import{z as at,C as rt,a8 as lt,Z as ct}from"./agent-icon-D5EbntAT.js";import{a as Ce,s as dt}from"./Settings02-B7hO-Tma.js";import{s as ae}from"./Trash01-CG0gTYx7.js";import{d as mt,c as ut,b as xt,S as pt,a as ft}from"./sheet-COdJ-0Qy.js";import{F as L,b as B,c as H,d as V,f as W,e as ht,a as gt}from"./form-BZY9ZRz4.js";import{I as X}from"./input-BmmiCY6T.js";import{u as jt,D as vt}from"./use-delete-connection-C_lUSAxo.js";import{c as bt,C as Nt,B as yt,a as _t,b as Ct,d as St,e as wt}from"./monitoring-stats-row-BuR-EBQ0.js";import{u as kt}from"./studio-tools-DRut7Wwk.js";import{u as Tt}from"./use-virtual-mcp-Bc7GdFZa.js";import{i as Se}from"./ChevronRight-Dj41DV2U.js";import{a as we}from"./Users03-BOvyNEV4.js";import{T as ee,a as It,b as te,c as At}from"./tabs-BcUIMPwc.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-C7yt7KfQ.js";import{b as $t}from"./Tool01-B4SsemMS.js";import{g as re,M as Pt}from"./types-7ak1Ve40.js";import{C as Ot}from"./collection-search-CCzYANV5.js";import{C as zt}from"./card-Ckx3Kwvj.js";import{B as Mt}from"./badge-an9iff2c.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-kPcoeCiJ.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-Di6xzzYo.js";import{i as Ft}from"./CheckCircle-D6b8lFUP.js";import{t as Rt}from"./ChevronDown-CYFvWHpZ.js";import{n as Lt}from"./XCircle-DRGwo6Em.js";import{s as se}from"./Star01-BfSEPDRT.js";import{s as Bt}from"./XClose-Ig7y9gcI.js";import"./index-CszBxeF9.js";import"./sidebar-DCgpgzJu.js";import"./LayoutLeft-CkiSxkS_.js";import"./tooltip-2IhfImXT.js";import"./ZoomOut-DVSwpwUz.js";import"./Key01-Lcx9qTy7.js";import"./auth-tkqpBHf1.js";import"./use-registry-connections-CK9xDmAR.js";import"./use-organization-settings--a-kmsBC.js";import"./index-CE8AoMpS.js";import"./index-DexxTctJ.js";import"./popover-BcAFMnrn.js";import"./ChevronUp-CiXMtnii.js";import"./SearchMd-C3Pmxf99.js";import"./use-create-virtual-mcp-D6wTKoFC.js";import"./use-navigate-to-agent-BTMo9com.js";import"./Eye-D3THRXh6.js";import"./use-org-auth-client-Blpkj8FB.js";import"./User01-CTuKNCEa.js";import"./use-collections-DrlB7sAG.js";import"./AlertCircle-DMqR3m0L.js";import"./SwitchHorizontal01-yw5VS97V.js";import"./ArrowUpRight-DeYzuaJ8.js";import"./ChevronLeft-DXSAgzPw.js";import"./DotsVertical-y5lMfVOQ.js";import"./Stars02-9vF61uFx.js";import"./Globe01-BquIL2vg.js";import"./FilterLines-BPeCeYIz.js";import"./Globe04-BBRZWdJY.js";import"./HardDrive-DmtpWveq.js";import"./LinkExternal01-jwO28Eeb.js";import"./Monitor01-L6hrk62b.js";import"./Sun-BxuJFhF6.js";import"./Palette-ClNyQOQA.js";import"./Play-C6QgiUls.js";import"./Shield01-RDE62wRx.js";import"./Stars01-W6Wl0Pse.js";import"./Upload01-BlvGy5d-.js";import"./Users01-KXiCgru2.js";import"./X-CKIhVHQk.js";import"./Zap-w60sxAoc.js";import"./label-DitP_QKf.js";import"./alert-dialog-BuJSufuR.js";const Ht=he({scopes:De(le()).describe("List of scopes available"),stateSchema:Ie(le(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:he({}),outputSchema:Ht}];function Xt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let c;e[0]!==n.id?(c={connectionId:n.id},e[0]=n.id,e[1]=c):c=e[1];const l=be(c),x=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",d=x||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==d?(h=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==x?(b=x?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=x,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==x||e[18]!==r?(N=x&&t.jsx(E,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=x,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(E,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let S;e[24]!==n||e[25]!==a?(S=()=>a(n),e[24]=n,e[25]=a,e[26]=S):S=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Ce,{size:13}),e[27]=y):y=e[27];let I;e[28]!==S?(I=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:S,title:"Configure",children:y}),e[28]=S,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ae,{size:13}),e[33]=k):k=e[33];let C;e[34]!==_?(C=t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=C):C=e[35];let f;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,C]}),e[36]=I,e[37]=C,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Gt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Ce,{size:13}),e[8]=c):c=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(E,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:c})}),e[9]=i,e[10]=l):l=e[10];let u;return e[11]!==r||e[12]!==o||e[13]!==l?(u=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=u):u=e[14],u}function qt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:c,isAdding:l}=s;if(n.length===0)return null;const u=n.length===1?"Instance":"Instances";let x;e[0]!==u?(x=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[0]=u,e[1]=x):x=e[1];let p;e[2]!==l?(p=l?t.jsx(ge,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let d;e[4]!==l||e[5]!==c||e[6]!==p?(d=t.jsxs(E,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:c,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=c,e[6]=p,e[7]=d):d=e[7];let h;e[8]!==x||e[9]!==d?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[x,d]}),e[8]=x,e[9]=d,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(q.Suspense,{fallback:t.jsx(Gt,{instance:N,onConfigure:a}),children:t.jsx(Xt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(1),{connectionId:n,orgId:a,timeframe:r}=s,o=kt(),i=Qt(r),{data:c}=$e({queryKey:ne.connectionActivity(n,r,a),queryFn:async()=>await o.call("MONITORING_LOGS_LIST",{startDate:i.startDate.toISOString(),endDate:i.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),l=bt(c?.logs??[],i),u=l.data,x=l.totalCalls>0;let p;return e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[0]=p):p=e[0],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:l.totalCalls.toLocaleString()}),p]}),l.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:l.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),l.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(l.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),x?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:u,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(Ct,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(St,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:u.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:u[u.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ss(s){const e=P.c(13),{connectionId:n}=s,[a,r]=q.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let c;e[1]!==a?(c=Kt.map(d=>t.jsx("button",{type:"button",onClick:()=>r(d.value),className:je("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:d.label},d.value)),e[1]=a,e[2]=c):c=e[2];let l;e[3]!==c?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=l):l=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(ts,{}),e[5]=u):u=e[5];let x;e[6]!==n||e[7]!==o.id||e[8]!==a?(x=t.jsx(q.Suspense,{fallback:u,children:t.jsx(Yt,{connectionId:n,orgId:o.id,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=a,e[9]=x):x=e[9];let p;return e[10]!==l||e[11]!==x?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,x]}),e[10]=l,e[11]=x,e[12]=p):p=e[12],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let c;e[5]!==n.icon||e[6]!==n.title?(c=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(Se,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=u):u=e[10];let x;return e[11]!==o||e[12]!==c||e[13]!==l?(x=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[c,l,u]}),e[11]=o,e[12]=c,e[13]=l,e[14]=x):x=e[14],x}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=c=>t.jsx(ns,{virtualMcp:c,org:a},c.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=Tt(r);if(!(o.length>0)){let u;return e[2]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(t.Fragment,{}),e[2]=u):u=e[2],u}let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=c):c=e[3];let l;return e[4]!==a.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[c,t.jsx("div",{className:"px-5 py-4",children:t.jsx(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let c;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(c={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=c):c=e[3];const l=_e(c),u=Ne(a);let x;e[4]!==u||e[5]!==a?(x=u?ke(u):a,e[4]=u,e[5]=a,e[6]=x):x=e[6];const p=x,[d,h]=q.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==d||e[12]!==n){const S=(n??[]).filter(rs),y=d.toLowerCase().trim(),I=y?S.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=C):C=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:h,placeholder:"Search apps...",onKeyDown:C}),e[22]=d,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(ve,{image:null,title:d?"No apps found":"No apps available",description:d?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=re(f._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Je,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=d,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!re(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let c;e[0]!==a?(c=a===void 0?[]:a,e[0]=a,e[1]=c):c=e[1];const l=c;let u;e[2]!==r?(u=r===void 0?[]:r,e[2]=r,e[3]=u):u=e[3];const x=u,p=Y(),d=Ne(o??"");let h;e[4]!==d||e[5]!==o?(h=d?ke(d):o,e[4]=d,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+x.length===0){let m;return e[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=m):m=e[16],m}let S;e[17]!==n.length?(S=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=S):S=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==S||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(It,{variant:"underline",className:"gap-1",children:[S,y,I,_]})}),e[23]=S,e[24]=y,e[25]=k):k=e[25];let C;e[26]!==b||e[27]!==n?(C=n.length>0?n.map(m=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(m.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(m.name)}),m.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:m.description})]}),t.jsx(Se,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},m.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=C):C=e[28];let f;e[29]!==C?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let z;e[36]!==l?(z=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=z):z=e[37];let O;e[38]!==z?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:z})}),e[38]=z,e[39]=O):O=e[39];let A;e[40]!==x?(A=x.length>0?x.map(cs):t.jsx(ie,{label:"resources"}),e[40]=x,e[41]=A):A=e[41];let M;e[42]!==A?(M=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=M):M=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==M?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(At,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,M]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=M,e[49]=U):U=e[49],U}function cs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function ds(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ms(s){return re(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let c;e[5]!==n.description?(c=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=c):c=e[6];let l;e[7]!==i||e[8]!==c?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,c]}),e[7]=i,e[8]=c,e[9]=l):l=e[9];let u;return e[10]!==o||e[11]!==l?(u=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=u):u=e[12],u}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=ce({control:s.control,name:"ui_type"}),i=ce({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const d=new URL(i);return d.hostname==="api.githubcopilot.com"&&d.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),u=c||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",p=x?Oe(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsxs(ue,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(xe,{})]})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(me,{value:d.value,onValueChange:d.onChange,children:[t.jsx(V,{children:t.jsx(ue,{className:"h-10",children:t.jsx(xe,{})})}),t.jsxs(pe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Lt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(V,{children:t.jsx(X,{placeholder:"@perplexity-ai/mcp-server",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(V,{children:t.jsx(X,{placeholder:"node, bun, python...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(V,{children:t.jsx(X,{placeholder:"arg1 arg2 --flag value",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(V,{children:t.jsx(X,{placeholder:"/path/to/project (optional)",...d,value:d.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(V,{children:t.jsx(Be,{value:d.value??[],onChange:d.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:d})=>t.jsxs(B,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Vt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),"Authenticated via OAuth",t.jsx(Rt,{size:12})]})})}),t.jsxs(Ut,{align:"start",children:[t.jsxs(de,{onClick:a,children:[t.jsx(dt,{size:16}),"Re-authenticate"]}),t.jsxs(de,{variant:"destructive",onClick:r,children:[t.jsx(ae,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&d.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>d.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Bt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(X,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...d,value:d.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ht,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function ps(s){return s.command==="npx"}function fs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function fe(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Re(s.connection_headers)){const a=s.connection_headers,r=We(a.envVars);if(ps(a)){const i=fs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=hs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ge(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:c}){const l=Y({from:"/$org/settings/connections/$appSlug"}),u=Ee(),x=ye(),{org:p}=J(),d=jt({onSuccess:()=>{c.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=q.useState(null),[v,b]=q.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=h??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=qe(k,Wt),f=Ue({resolver:Fe(He),values:fe(h??s)}),w=f.formState.isDirty,z=async()=>{if(!await f.trigger())return;const D=f.getValues(),$=gs(D),F=h?.id??e;await x.update.mutateAsync({id:F,data:$}),f.reset(D)},O=()=>{f.reset(fe(h??s))},A=async m=>{const{token:D,tokenInfo:$,error:F}=await ot({connectionId:m,orgSlug:p.slug,scope:"offline_access"});if(F||!D){G.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${m}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await x.update.mutateAsync({id:m,data:{connection_token:D}});else try{await x.update.mutateAsync({id:m,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await x.update.mutateAsync({id:m,data:{connection_token:D}})}else await x.update.mutateAsync({id:m,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${m}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await u.invalidateQueries({queryKey:ne.mcpClientPrefix()}),G.success("Authentication successful")},M=()=>A(s.id),U=async()=>{try{const m=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!m.ok){const $=await m.text();G.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await u.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),G.success("OAuth removed. You can now re-authenticate with a different account.")}catch(m){console.error("Error removing OAuth token:",m),G.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...d}),t.jsx(mt,{open:h!==null,onOpenChange:m=>{m||g(null)},children:t.jsxs(ut,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(xt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(pt,{className:"text-base",children:h?.title??s.title}),t.jsx(ft,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(Ze,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(gt,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(X,{...m})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:m})=>t.jsxs(B,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(X,{...m,value:m.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:h??s,form:f,hasMcpBinding:C,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:M,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(E,{onClick:z,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(E,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(E,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const m=h??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(Qe,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const m=c[0]??s;return m.app_name?m.title.replace(/\s*\(\d+\)\s*$/,""):m.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(qt,{instances:c,onConfigure:m=>g(m),onAuthenticate:m=>A(m.id),onDelete:m=>d.requestDelete(m),onToggleStatus:async(m,D)=>{try{await x.update.mutateAsync({id:m.id,data:{status:D}}),G.success(D==="active"?"Connection enabled":"Connection disabled")}catch{G.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const m=c[0]??s,D=m.title.replace(/\s*\(\d+\)\s*$/,""),$=c.length+1,F=`${D} (${$})`,Q=Le("conn");await x.create.mutateAsync({id:Q,title:F,description:m.description??null,connection_type:m.connection_type,connection_url:m.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:m.created_by,organization_id:m.organization_id,icon:m.icon??null,app_name:m.app_name??null,app_id:m.app_id??null,connection_headers:m.connection_headers??null,oauth_config:null,configuration_state:m.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await nt({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=Me(a),{org:i}=J(),c=ye();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const u=et(l),x=u[0]??null,p=x?.id??"",d=p||null;let h;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(h={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=h):h=s[7];const g=_e(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=tt(v);let j;if(s[10]!==x?.tools||s[11]!==p||s[12]!==u||s[13]!==b){const A=b?b.tools.map(Ss):(x?.tools??[]).map(Cs);e:{if(u.length<=1){j=A;break e}const M=new Set,U=[],m=ys;for(const D of u){const $=D.id===p?A:m(D.tools);for(const F of $)M.has(F.name)||(M.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=x?.tools,s[11]=p,s[12]=u,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:S}=st(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ve(y);let _;s[19]!==S?.prompts?(_=S?.prompts??[],s[19]=S?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const C=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(bs),s[25]=f,s[26]=w):w=s[26];const z=w;if(!x){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ve,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(E,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==c.update.isPending||s[31]!==N||s[32]!==x||s[33]!==p||s[34]!==o||s[35]!==C||s[36]!==z||s[37]!==u?(O=t.jsx(js,{org:o,connection:x,connectionId:p,isUpdating:c.update.isPending,tools:N,prompts:C,resources:z,siblings:u}),s[30]=c.update.isPending,s[31]=N,s[32]=x,s[33]=p,s[34]=o,s[35]=C,s[36]=z,s[37]=u,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ze,{children:t.jsx(q.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ge,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function io(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{io as default};