decocms 3.77.0 → 3.78.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 (241) hide show
  1. package/dist/client/assets/{AlertCircle-BYmwGQCf.js → AlertCircle-Caru_t3W.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DpeEXraR.js → ArrowUpRight-B2Dt0814.js} +1 -1
  3. package/dist/client/assets/{CheckCircle-Bf3Z61R3.js → CheckCircle-CpjuZYS5.js} +1 -1
  4. package/dist/client/assets/{ChevronDown-DbkPHjH7.js → ChevronDown-DeW1WG4N.js} +1 -1
  5. package/dist/client/assets/{ChevronLeft-7WikNK_I.js → ChevronLeft-DhtKqfYa.js} +1 -1
  6. package/dist/client/assets/{ChevronRight-CUrrZIqG.js → ChevronRight-DSC2aiCG.js} +1 -1
  7. package/dist/client/assets/{ChevronUp-BT7nyl6k.js → ChevronUp-CiZNoBS5.js} +1 -1
  8. package/dist/client/assets/{DotsVertical-BpkGXLrP.js → DotsVertical-CAFbny0A.js} +1 -1
  9. package/dist/client/assets/{Eye-D3915Vo9.js → Eye-BSAOg3tU.js} +1 -1
  10. package/dist/client/assets/{FilterLines-BDTdg3RE.js → FilterLines-BWsEA6cc.js} +1 -1
  11. package/dist/client/assets/{Globe01-BxZmquSL.js → Globe01-B8cJAk0V.js} +1 -1
  12. package/dist/client/assets/{Globe04-CkBzX8xL.js → Globe04-BHoeDf9U.js} +1 -1
  13. package/dist/client/assets/{HardDrive-Cko4CWL8.js → HardDrive-Ca-rpUZp.js} +1 -1
  14. package/dist/client/assets/{Key01-CAY-Xxyp.js → Key01-hqliL23I.js} +1 -1
  15. package/dist/client/assets/{LayoutLeft-CJuGELXN.js → LayoutLeft-DfLCxQJZ.js} +1 -1
  16. package/dist/client/assets/{LinkExternal01-DluIM9mv.js → LinkExternal01-C-uuQSHY.js} +1 -1
  17. package/dist/client/assets/{Monitor01-bbyGUKmR.js → Monitor01-C4mUj5DO.js} +1 -1
  18. package/dist/client/assets/{Palette-DLCudjOT.js → Palette-BqPdnSvn.js} +1 -1
  19. package/dist/client/assets/{Play-I5x_JKdj.js → Play-u3Xpo-3H.js} +1 -1
  20. package/dist/client/assets/{Plus-DOSjIlBe.js → Plus-e8vsh1yI.js} +1 -1
  21. package/dist/client/assets/{SearchMd-q-mL98uP.js → SearchMd-pbTyIZQ0.js} +1 -1
  22. package/dist/client/assets/{Settings02-C0s-saqA.js → Settings02-1OASYAA8.js} +1 -1
  23. package/dist/client/assets/{Shield01-DA5SmW0P.js → Shield01-BZP4Q_Vm.js} +1 -1
  24. package/dist/client/assets/{Star01-1ZF9aI5Y.js → Star01-BokvC0Yc.js} +1 -1
  25. package/dist/client/assets/{Stars01-CWQtskKI.js → Stars01-CM7BslwP.js} +1 -1
  26. package/dist/client/assets/{Stars02-DMdFpBOz.js → Stars02-DTDItJ62.js} +1 -1
  27. package/dist/client/assets/{Sun-CVp19c6p.js → Sun-CO5Z2lcQ.js} +1 -1
  28. package/dist/client/assets/{SwitchHorizontal01-BMk8DM55.js → SwitchHorizontal01-DCwdrg-O.js} +1 -1
  29. package/dist/client/assets/{Tool01-CHEQOI-w.js → Tool01-BDvWQGEc.js} +1 -1
  30. package/dist/client/assets/{Trash01-jgpaQcTh.js → Trash01-C3khOwsb.js} +1 -1
  31. package/dist/client/assets/{Upload01-DmPHnKxK.js → Upload01-BWq8M5mQ.js} +1 -1
  32. package/dist/client/assets/{User01-CQqeHCY8.js → User01-B5NDreK2.js} +1 -1
  33. package/dist/client/assets/{Users01-3CAb_L9A.js → Users01-BM4ZmEbl.js} +1 -1
  34. package/dist/client/assets/{Users03-BtWBA-oP.js → Users03-DPSOJZh_.js} +1 -1
  35. package/dist/client/assets/{X-BTPYHIvY.js → X-CdcmL6WW.js} +1 -1
  36. package/dist/client/assets/XCircle-YOrPaSTA.js +1 -0
  37. package/dist/client/assets/{XClose-qC8Lq_ms.js → XClose-B1WSb9MQ.js} +1 -1
  38. package/dist/client/assets/{Zap-CVq2f6J2.js → Zap-CJ80I152.js} +1 -1
  39. package/dist/client/assets/{ZapSquare-C3NGLDu-.js → ZapSquare-CgWRLEJy.js} +1 -1
  40. package/dist/client/assets/{ZoomOut-CjZnoT-b.js → ZoomOut-OytsIYD1.js} +1 -1
  41. package/dist/client/assets/{access-gate-CBINLd7U.js → access-gate-DqzudH0L.js} +1 -1
  42. package/dist/client/assets/add-section-modal-kp6f6erO.js +1 -0
  43. package/dist/client/assets/agent-icon-DY5w59uF.js +1 -0
  44. package/dist/client/assets/agents-list-DDHbeg5p.js +1 -0
  45. package/dist/client/assets/{ai-providers-47bmrarJ.js → ai-providers-P8q844Dm.js} +1 -1
  46. package/dist/client/assets/{alert-CHc3FYZF.js → alert-FbljLOaQ.js} +1 -1
  47. package/dist/client/assets/{alert-dialog-D2GL5qBd.js → alert-dialog-BO7X_BMw.js} +1 -1
  48. package/dist/client/assets/app-editor-C4YX8u15.js +1 -0
  49. package/dist/client/assets/{auth-BX6flE6a.js → auth-DpDDb6PJ.js} +1 -1
  50. package/dist/client/assets/{auth-catchall-BpjOaSW9.js → auth-catchall-BwEPZ9sp.js} +1 -1
  51. package/dist/client/assets/{auth-entry-DfGml_TH.js → auth-entry-9rxagxJL.js} +1 -1
  52. package/dist/client/assets/{auth-split-layout-HWtMmGAh.js → auth-split-layout-6kbG-q9M.js} +1 -1
  53. package/dist/client/assets/authenticate-and-persist-oauth-SkR5Q2kF.js +1 -0
  54. package/dist/client/assets/{automation-list-row-CAkQUGBC.js → automation-list-row-BZROLPDh.js} +1 -1
  55. package/dist/client/assets/{automation-runs-BO1vGgx9.js → automation-runs-VqVE_yW9.js} +1 -1
  56. package/dist/client/assets/automations-1DiKFOBq.js +1 -0
  57. package/dist/client/assets/{avatar-BS-jv_DR.js → avatar-C7RfbSV0.js} +1 -1
  58. package/dist/client/assets/{badge-BcU0uhl8.js → badge-S-QCOrNN.js} +1 -1
  59. package/dist/client/assets/{block-document-CF604YR_.js → block-document-CLeG1P-N.js} +1 -1
  60. package/dist/client/assets/brand-context-GZiNd5v6.js +1 -0
  61. package/dist/client/assets/{buckets-DVC4Kohh.js → buckets-DTeRBDWJ.js} +1 -1
  62. package/dist/client/assets/{calendar-CbxSTdbI.js → calendar-katBc34c.js} +1 -1
  63. package/dist/client/assets/{capability-load-error-D-aRp7QN.js → capability-load-error-D72JLeT1.js} +1 -1
  64. package/dist/client/assets/{card-BIfVO_jW.js → card-B0EjU25K.js} +1 -1
  65. package/dist/client/assets/category-editor-C-xyYK6m.js +1 -0
  66. package/dist/client/assets/{chat-context-EpSQJI2R.js → chat-context-DdkEgZ9_.js} +6 -6
  67. package/dist/client/assets/{checkbox-B76UlBUd.js → checkbox-DbzbLYfL.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-BZa-itTp.js → cli-auth-success-C9MRaugF.js} +1 -1
  69. package/dist/client/assets/collection-detail-DU1VM1YR.js +1 -0
  70. package/dist/client/assets/{collection-display-button-BP4c4hrD.js → collection-display-button-BNnw7G4D.js} +1 -1
  71. package/dist/client/assets/{collection-search-DYVCc599.js → collection-search-hESxl20y.js} +1 -1
  72. package/dist/client/assets/{collection-tabs-C0YJH8OQ.js → collection-tabs-99Rq6QsS.js} +1 -1
  73. package/dist/client/assets/{command-Cx31xkYn.js → command-DJiJXkzC.js} +1 -1
  74. package/dist/client/assets/commerce-onboarding-YO2BywhJ.js +1 -0
  75. package/dist/client/assets/{connect-desktop-dialog-C3zpTl9v.js → connect-desktop-dialog-DR4-xhbf.js} +1 -1
  76. package/dist/client/assets/{connection-card-C3_U3j25.js → connection-card-CJjprKft.js} +1 -1
  77. package/dist/client/assets/connection-detail-DZAfgvu2.js +1 -0
  78. package/dist/client/assets/{connection-form-helpers-QpFovVZo.js → connection-form-helpers-DT5c99yt.js} +1 -1
  79. package/dist/client/assets/connections-B3yso__h.js +1 -0
  80. package/dist/client/assets/{context-menu-DX4dPYJO.js → context-menu-B3oZHh4c.js} +1 -1
  81. package/dist/client/assets/{decopilot-DaDKMLey.js → decopilot-KvFscv5D.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-CcKrM-Xv.js → decopilot-sse-pool-C9VeVJ93.js} +1 -1
  83. package/dist/client/assets/{dialog-DGhL6eBy.js → dialog-jX6bYdqO.js} +1 -1
  84. package/dist/client/assets/{domain-settings-C1EU9nuj.js → domain-settings-DSTf_XC1.js} +1 -1
  85. package/dist/client/assets/{drawer-B9Cs5iI_.js → drawer-EgN8HzIq.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-CiC9tTdb.js → dropdown-menu-BOrPFviJ.js} +1 -1
  87. package/dist/client/assets/{empty-state-yOW3dSH7.js → empty-state-BZIY4ETU.js} +1 -1
  88. package/dist/client/assets/{extract-connection-data-Cmd1hHZE.js → extract-connection-data-Dz1SJTDF.js} +1 -1
  89. package/dist/client/assets/file-explorer-CtIkaECZ.js +2 -0
  90. package/dist/client/assets/{file-type-icon-C0VVPUpN.js → file-type-icon-CiTHpOyi.js} +1 -1
  91. package/dist/client/assets/{files-BJZQ0FpY.js → files-D4cQybZ3.js} +1 -1
  92. package/dist/client/assets/{form-CaHcodeJ.js → form-D-Lg2Vno.js} +1 -1
  93. package/dist/client/assets/{general-DvXPbO2X.js → general-BLLTGXVC.js} +1 -1
  94. package/dist/client/assets/github-repo-picker-BtGY0bTC.js +1 -0
  95. package/dist/client/assets/{hooks-DX86YvO8.js → hooks-Bq2gpnHq.js} +1 -1
  96. package/dist/client/assets/{image-field-D_fZia_E.js → image-field-CopsGD8K.js} +1 -1
  97. package/dist/client/assets/{import-from-deco-dialog-Dn6_-blC.js → import-from-deco-dialog-DTeSs8zZ.js} +2 -2
  98. package/dist/client/assets/{index-BbdyUut8.js → index-BIlZxD1s.js} +1 -1
  99. package/dist/client/assets/{index-BdFUyuzp.js → index-BMuKOY-R.js} +1 -1
  100. package/dist/client/assets/{index-CQF6lVUo.js → index-B_T2Tm_n.js} +1 -1
  101. package/dist/client/assets/{index-Cyq8kOmo.js → index-CApC7A2-.js} +1 -1
  102. package/dist/client/assets/index-CpN1_PlS.js +1 -0
  103. package/dist/client/assets/{index-DLBSEic_.js → index-CwCkKeIW.js} +1 -1
  104. package/dist/client/assets/{index-BiSv4wgs.js → index-D9cso_OE.js} +4 -4
  105. package/dist/client/assets/{index-DAfY2rvi.js → index-DJ0Ge3cT.js} +12 -12
  106. package/dist/client/assets/index-DjsYubVL.js +1 -0
  107. package/dist/client/assets/{index-D-jSeUPY.js → index-DsuFa3M3.js} +1 -1
  108. package/dist/client/assets/{index-Bzfd3S0P.js → index-FMQJTdgj.js} +2 -2
  109. package/dist/client/assets/{index-lWXyO72r.js → index-OWX18MdF.js} +2 -2
  110. package/dist/client/assets/{index-m_lmKMTo.js → index-TfVSao84.js} +1 -1
  111. package/dist/client/assets/{index-CS96E1bw.js → index-an-q9BoC.js} +1 -1
  112. package/dist/client/assets/{index-redirect--cQpprvo.js → index-redirect-B5cnslmT.js} +1 -1
  113. package/dist/client/assets/{input-Ta_Y1lvO.js → input-aftZq0qp.js} +1 -1
  114. package/dist/client/assets/{integration-icon-DDugmSqH.js → integration-icon-Dn8UgHow.js} +1 -1
  115. package/dist/client/assets/{label-C8gqICzJ.js → label-BlTB1rsr.js} +1 -1
  116. package/dist/client/assets/{login-15LhOBnr.js → login-DwqD6H9f.js} +1 -1
  117. package/dist/client/assets/{mcp-oauth-D0PDq8qp.js → mcp-oauth-DYo7_iWt.js} +1 -1
  118. package/dist/client/assets/{members-BCHlqZ_l.js → members-BAmGZs_l.js} +2 -2
  119. package/dist/client/assets/{monaco-editor-B83AZ8GN.js → monaco-editor-dFjmNtXr.js} +1 -1
  120. package/dist/client/assets/{monitoring-stats-row-CH_Ju-wa.js → monitoring-stats-row-DXzyXSPo.js} +1 -1
  121. package/dist/client/assets/{oauth-callback-ix708N30.js → oauth-callback-BnUvVOzM.js} +1 -1
  122. package/dist/client/assets/{oauth-callback-ai-provider-BB5BJd2l.js → oauth-callback-ai-provider-CtGpymDw.js} +1 -1
  123. package/dist/client/assets/{onboarding-CMCNAluc.js → onboarding-tHyZv_uW.js} +1 -1
  124. package/dist/client/assets/{org-install-DrK1M64X.js → org-install-BJnctrXU.js} +1 -1
  125. package/dist/client/assets/{org-layout-C6zhzHkR.js → org-layout-DgadVfYy.js} +1 -1
  126. package/dist/client/assets/{organization-choice-B6-OJzO9.js → organization-choice-HfpQcKxS.js} +1 -1
  127. package/dist/client/assets/{page-seo-form-BzBYlYXK.js → page-seo-form-j7a8Z1BY.js} +1 -1
  128. package/dist/client/assets/page-seo-sheet-C5rR31Cs.js +1 -0
  129. package/dist/client/assets/{popover-BlGotCa-.js → popover-D43tJ8in.js} +1 -1
  130. package/dist/client/assets/post-editor-XU3B2wmV.js +1 -0
  131. package/dist/client/assets/{preview-dialog-BTdQ1TvF.js → preview-dialog-BrHmAwG0.js} +1 -1
  132. package/dist/client/assets/{primitives-CKYU8UlB.js → primitives-BRyBxVlk.js} +1 -1
  133. package/dist/client/assets/{profile-B5aimk1S.js → profile-CLM3LuOb.js} +1 -1
  134. package/dist/client/assets/project-app-view-Bojee27q.js +1 -0
  135. package/dist/client/assets/record-editor-Cb2nxa0o.js +1 -0
  136. package/dist/client/assets/registry-DJ2WJB-k.js +2 -0
  137. package/dist/client/assets/{registry-layout-DsXkT4KV.js → registry-layout-pqx5X3wF.js} +4 -4
  138. package/dist/client/assets/{require-capability-XP_1zPNl.js → require-capability-BQ22Wt23.js} +1 -1
  139. package/dist/client/assets/{required-auth-layout-qIDzSGtQ.js → required-auth-layout-wApn6jVI.js} +1 -1
  140. package/dist/client/assets/{reset-password-RZU_bfNW.js → reset-password-deaGgEkO.js} +1 -1
  141. package/dist/client/assets/roles-RG2bRHsu.js +1 -0
  142. package/dist/client/assets/save-referenced-block-B0RkutY2.js +1 -0
  143. package/dist/client/assets/{save-status-Bwyidu0s.js → save-status-BiRx7JAD.js} +1 -1
  144. package/dist/client/assets/{schema-form-CTQz2kTF.js → schema-form-sBBUMk07.js} +1 -1
  145. package/dist/client/assets/{scroll-area-iBbwLoaH.js → scroll-area-BSGl-_zx.js} +7 -7
  146. package/dist/client/assets/{search-input-CHOe8stk.js → search-input-Cn14rzZS.js} +1 -1
  147. package/dist/client/assets/{secrets-DqovOx3Q.js → secrets-D-nSpmHI.js} +1 -1
  148. package/dist/client/assets/{sections-editor-PK5zsI1T.js → sections-editor-NjvzZlHu.js} +1 -1
  149. package/dist/client/assets/{select-D9WchHFw.js → select-BGb-ZPds.js} +1 -1
  150. package/dist/client/assets/{select-model-D4uK7qW2.js → select-model-C_rVNd_q.js} +1 -1
  151. package/dist/client/assets/seo-editor-Bvd2538m.js +1 -0
  152. package/dist/client/assets/{settings-layout-CtPsdD9d.js → settings-layout-CrGAcHuU.js} +1 -1
  153. package/dist/client/assets/{settings-section-XLADU1Ft.js → settings-section-Bc3yjWcB.js} +1 -1
  154. package/dist/client/assets/{sheet-DcscOrN-.js → sheet-HFHR_AuU.js} +1 -1
  155. package/dist/client/assets/{shell-controls-DCNtyoPf.js → shell-controls-HLzK4I7E.js} +1 -1
  156. package/dist/client/assets/{shell-layout-78V1nK9o.js → shell-layout-LI1vyNzj.js} +1 -1
  157. package/dist/client/assets/{shell-route-loading-Drp-Ml9n.js → shell-route-loading-BDOpNoYP.js} +1 -1
  158. package/dist/client/assets/{sidebar-BHU7Y-eK.js → sidebar-BGJoJ5IQ.js} +1 -1
  159. package/dist/client/assets/{skeleton-DYsLWJ4s.js → skeleton-hFHnIcZ0.js} +1 -1
  160. package/dist/client/assets/{sortable.esm-DYnQaz_O.js → sortable.esm-DIVJmvz6.js} +1 -1
  161. package/dist/client/assets/{sso-CUKcu8bh.js → sso-Bn468zRH.js} +1 -1
  162. package/dist/client/assets/{store-D0RG8VnF.js → store-DytIJvdt.js} +1 -1
  163. package/dist/client/assets/store-registry-C32JZ3Yi.js +2 -0
  164. package/dist/client/assets/{studio-tools-B6e1wIqk.js → studio-tools-eP_o-Bzq.js} +1 -1
  165. package/dist/client/assets/{switch-B0g5vIO8.js → switch-DalcHZ66.js} +1 -1
  166. package/dist/client/assets/{table-CuanbdKo.js → table-CnWjZkvw.js} +1 -1
  167. package/dist/client/assets/{tabs-DfpltS-P.js → tabs-BhJfCfA3.js} +1 -1
  168. package/dist/client/assets/task-status-BwSSlnug.js +1 -0
  169. package/dist/client/assets/{textarea-ji5jId4g.js → textarea-DTW1SKGc.js} +1 -1
  170. package/dist/client/assets/{toggle-group-B5UDI72A.js → toggle-group-CRnMovNn.js} +1 -1
  171. package/dist/client/assets/{toolbar-BMWZipjQ.js → toolbar-BVgga9fW.js} +1 -1
  172. package/dist/client/assets/{tooltip-BIAup3vg.js → tooltip-DVHwyu-W.js} +1 -1
  173. package/dist/client/assets/{types-DmsJ1dgA.js → types-B1E3Ybp7.js} +1 -1
  174. package/dist/client/assets/{use-ai-providers-CSwg9ID-.js → use-ai-providers-DP8qFD8W.js} +1 -1
  175. package/dist/client/assets/{use-automations-Cm2EUHDJ.js → use-automations-QBk1wzKE.js} +1 -1
  176. package/dist/client/assets/use-capability-D3mzXNBE.js +1 -0
  177. package/dist/client/assets/{use-clock-tick-BH2ii9Ri.js → use-clock-tick-YCiBQpNz.js} +1 -1
  178. package/dist/client/assets/{use-collections-DYVhZ6LZ.js → use-collections-sgcijgPQ.js} +1 -1
  179. package/dist/client/assets/{use-connection-CYq4sTpp.js → use-connection-CFC8WumP.js} +1 -1
  180. package/dist/client/assets/{use-copy-BL1Gi5Ma.js → use-copy-BVyzmTt4.js} +1 -1
  181. package/dist/client/assets/{use-create-virtual-mcp-BbTDDIhz.js → use-create-virtual-mcp-40n1TbuY.js} +1 -1
  182. package/dist/client/assets/{use-debounced-autosave-BWXIh3Xt.js → use-debounced-autosave-tiHawAIR.js} +1 -1
  183. package/dist/client/assets/use-deco-credits-C1ftH3If.js +1 -0
  184. package/dist/client/assets/{use-delete-connection-BP0n__7X.js → use-delete-connection-CUd76KVl.js} +1 -1
  185. package/dist/client/assets/{use-file-configs-3VHkoOl7.js → use-file-configs-C2ceyi4L.js} +1 -1
  186. package/dist/client/assets/{use-infinite-scroll-CsW5GqEa.js → use-infinite-scroll-CvmJXJdB.js} +1 -1
  187. package/dist/client/assets/{use-join-requests-BtpSJ5cA.js → use-join-requests-CRlCmWm0.js} +1 -1
  188. package/dist/client/assets/{use-mcp-client-BcfXwx2l.js → use-mcp-client-DFe1X8lW.js} +1 -1
  189. package/dist/client/assets/{use-mcp-prompts-h_GWEUu_.js → use-mcp-prompts-4cCmLVZX.js} +1 -1
  190. package/dist/client/assets/{use-mcp-tools-DhZgsJaJ.js → use-mcp-tools-DI9Jj-_Y.js} +1 -1
  191. package/dist/client/assets/{use-members-K1wagpAk.js → use-members-KDk_htTJ.js} +1 -1
  192. package/dist/client/assets/{use-navigate-to-agent-GOxU3Hpn.js → use-navigate-to-agent-D9iFw7Zt.js} +1 -1
  193. package/dist/client/assets/{use-org-auth-client-CMUSTibk.js → use-org-auth-client-SaCcE0Qc.js} +1 -1
  194. package/dist/client/assets/{use-org-sso-BJNpFjMG.js → use-org-sso-4n2o97PC.js} +1 -1
  195. package/dist/client/assets/{use-organization-roles-CnWjq4nf.js → use-organization-roles-BXjlJlvC.js} +1 -1
  196. package/dist/client/assets/use-organization-settings-CJJ_tXSe.js +1 -0
  197. package/dist/client/assets/{use-registry-connections-CQIqYcvJ.js → use-registry-connections-DGZtDiY8.js} +1 -1
  198. package/dist/client/assets/{use-secrets-B69dGKd4.js → use-secrets-DOmnFlDE.js} +1 -1
  199. package/dist/client/assets/{use-status-sounds-B38RTJiB.js → use-status-sounds-C7IKQ0M3.js} +1 -1
  200. package/dist/client/assets/{use-view-mode-DyryORIA.js → use-view-mode-5sHRttq3.js} +1 -1
  201. package/dist/client/assets/{use-virtual-mcp-B9JwuB8w.js → use-virtual-mcp-Dt17nZX7.js} +1 -1
  202. package/dist/client/assets/useInfiniteQuery-LattvRM6.js +1 -0
  203. package/dist/client/assets/useSuspenseInfiniteQuery-JNoud7Ca.js +1 -0
  204. package/dist/client/assets/variant-calendar-DBaInJsx.js +1 -0
  205. package/dist/client/assets/{view-mode-toggle-Bt_jVM0U.js → view-mode-toggle-dVNz8sR0.js} +1 -1
  206. package/dist/client/index.html +1 -1
  207. package/dist/server/cli.js +1 -1
  208. package/package.json +1 -1
  209. package/dist/client/assets/ArrowRight-CvF16wpP.js +0 -1
  210. package/dist/client/assets/XCircle-BODgW7sH.js +0 -1
  211. package/dist/client/assets/add-section-modal-A1TEpk88.js +0 -1
  212. package/dist/client/assets/agent-icon-s6bX_I9L.js +0 -1
  213. package/dist/client/assets/agents-list-yRMR0cF5.js +0 -1
  214. package/dist/client/assets/app-editor-DjZhxnMe.js +0 -1
  215. package/dist/client/assets/automations-DQeUsmtv.js +0 -1
  216. package/dist/client/assets/brand-context-2XxEjOnF.js +0 -1
  217. package/dist/client/assets/category-editor-BfrojdBX.js +0 -1
  218. package/dist/client/assets/collection-detail-BNS2Iwl7.js +0 -1
  219. package/dist/client/assets/commerce-onboarding-Bx2cQDUo.js +0 -1
  220. package/dist/client/assets/connection-detail-DttTci9g.js +0 -1
  221. package/dist/client/assets/connections-4YYDTDW3.js +0 -1
  222. package/dist/client/assets/file-explorer-CRI6MNvr.js +0 -2
  223. package/dist/client/assets/github-repo-picker-CtfOBr8M.js +0 -1
  224. package/dist/client/assets/index-CAejfhLf.js +0 -1
  225. package/dist/client/assets/index-IC_7I4E3.js +0 -1
  226. package/dist/client/assets/page-seo-sheet-BI1e3r-Y.js +0 -1
  227. package/dist/client/assets/post-editor-DayUNdZ0.js +0 -1
  228. package/dist/client/assets/project-app-view-Dnb_LmK_.js +0 -1
  229. package/dist/client/assets/record-editor-BY0yu0r9.js +0 -1
  230. package/dist/client/assets/registry-CcuEWwCn.js +0 -2
  231. package/dist/client/assets/roles-CT6FH28_.js +0 -1
  232. package/dist/client/assets/save-referenced-block-CMl5gaJM.js +0 -1
  233. package/dist/client/assets/seo-editor-Dwigxdky.js +0 -1
  234. package/dist/client/assets/store-registry-l1zQEo3-.js +0 -2
  235. package/dist/client/assets/task-status-B9Z3_U-A.js +0 -1
  236. package/dist/client/assets/use-capability-jAHdTjWn.js +0 -1
  237. package/dist/client/assets/use-deco-credits-CjVry_TJ.js +0 -1
  238. package/dist/client/assets/use-organization-settings-CbMA9tyx.js +0 -1
  239. package/dist/client/assets/useInfiniteQuery-nR5oOHHR.js +0 -1
  240. package/dist/client/assets/useSuspenseInfiniteQuery-mFFPqXZc.js +0 -1
  241. package/dist/client/assets/variant-calendar-CisCsFL5.js +0 -1
@@ -1 +0,0 @@
1
- import{c as se,j as s,B as Z,s as me,r as Y,p as v,t as de}from"./index-BiSv4wgs.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-CiC9tTdb.js";import{s as pe}from"./Star01-1ZF9aI5Y.js";import{a as fe}from"./Users03-BtWBA-oP.js";import{a as ge,G as ue}from"./github-repo-picker-CtfOBr8M.js";import{S as he,u as xe,H as ie,W as oe,I as je}from"./import-from-deco-dialog-Dn6_-blC.js";import{u as _e,b as Ce,c as be}from"./use-virtual-mcp-B9JwuB8w.js";import{P as K}from"./index-D-jSeUPY.js";import{a as ye}from"./DotsVertical-BpkGXLrP.js";import{a as Ne}from"./Settings02-C0s-saqA.js";import{s as Se}from"./Trash01-jgpaQcTh.js";import{A as De,al as ve}from"./agent-icon-s6bX_I9L.js";import{m as Ae}from"./use-navigate-to-agent-GOxU3Hpn.js";import{C as ke}from"./card-BIfVO_jW.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-jAHdTjWn.js";import{E as Te}from"./empty-state-yOW3dSH7.js";import{u as ze}from"./use-create-virtual-mcp-BbTDDIhz.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-D2GL5qBd.js";import{S as $e}from"./search-input-CHOe8stk.js";import{s as le}from"./Plus-DOSjIlBe.js";import"./ChevronUp-BT7nyl6k.js";import"./ChevronRight-CUrrZIqG.js";import"./dialog-DGhL6eBy.js";import"./X-BTPYHIvY.js";import"./checkbox-B76UlBUd.js";import"./collection-search-DYVCc599.js";import"./SearchMd-q-mL98uP.js";import"./use-connection-CYq4sTpp.js";import"./use-collections-DYVhZ6LZ.js";import"./use-mcp-client-BcfXwx2l.js";import"./auth-BX6flE6a.js";import"./mcp-oauth-D0PDq8qp.js";import"./use-mcp-tools-DhZgsJaJ.js";import"./extract-connection-data-Cmd1hHZE.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./tooltip-BIAup3vg.js";import"./sheet-DcscOrN-.js";import"./AlertCircle-BYmwGQCf.js";import"./Tool01-CHEQOI-w.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./XCircle-BODgW7sH.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronDown-DbkPHjH7.js";import"./ChevronLeft-7WikNK_I.js";import"./Stars02-DMdFpBOz.js";import"./Eye-D3915Vo9.js";import"./ZoomOut-CjZnoT-b.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./Key01-CAY-Xxyp.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./XClose-qC8Lq_ms.js";import"./Zap-CVq2f6J2.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 rs(){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{rs as default};
@@ -1 +0,0 @@
1
- import{c as gt,r as w,j as o,l as St,t as ut,i as yt}from"./index-BiSv4wgs.js";import{i as jt}from"./ChevronRight-CUrrZIqG.js";import{S as kt}from"./scroll-area-iBbwLoaH.js";import{AddSectionModal as _t}from"./add-section-modal-A1TEpk88.js";import{ah as wt,ai as Bt,f as Nt,g as Rt,aj as At}from"./index-DAfY2rvi.js";import{c as Ct}from"./save-referenced-block-CMl5gaJM.js";import{d as Et,b as Kt}from"./schema-form-CTQz2kTF.js";import{S as Ft}from"./save-status-Bwyidu0s.js";import"./agent-icon-s6bX_I9L.js";import"./AlertCircle-BYmwGQCf.js";import"./Tool01-CHEQOI-w.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./Settings02-C0s-saqA.js";import"./XCircle-BODgW7sH.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./Users03-BtWBA-oP.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronUp-BT7nyl6k.js";import"./ChevronDown-DbkPHjH7.js";import"./ChevronLeft-7WikNK_I.js";import"./DotsVertical-BpkGXLrP.js";import"./Stars02-DMdFpBOz.js";import"./Eye-D3915Vo9.js";import"./ZoomOut-CjZnoT-b.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Star01-1ZF9aI5Y.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./Key01-CAY-Xxyp.js";import"./LayoutLeft-CJuGELXN.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Plus-DOSjIlBe.js";import"./SearchMd-q-mL98uP.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Trash01-jgpaQcTh.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./XClose-qC8Lq_ms.js";import"./X-BTPYHIvY.js";import"./Zap-CVq2f6J2.js";import"./use-clock-tick-BH2ii9Ri.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BL1Gi5Ma.js";import"./tooltip-BIAup3vg.js";import"./file-type-icon-C0VVPUpN.js";import"./dialog-DGhL6eBy.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-DmsJ1dgA.js";import"./use-mcp-client-BcfXwx2l.js";import"./auth-BX6flE6a.js";import"./chat-context-EpSQJI2R.js";import"./hooks-DX86YvO8.js";import"./decopilot-sse-pool-CcKrM-Xv.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-B9JwuB8w.js";import"./use-collections-DYVhZ6LZ.js";import"./use-ai-providers-CSwg9ID-.js";import"./studio-tools-B6e1wIqk.js";import"./use-organization-settings-CbMA9tyx.js";import"./shell-layout-78V1nK9o.js";import"./avatar-BS-jv_DR.js";import"./required-auth-layout-qIDzSGtQ.js";import"./use-org-sso-BJNpFjMG.js";import"./sheet-DcscOrN-.js";import"./integration-icon-DDugmSqH.js";import"./use-navigate-to-agent-GOxU3Hpn.js";import"./use-connection-CYq4sTpp.js";import"./use-mcp-prompts-h_GWEUu_.js";import"./form-CaHcodeJ.js";import"./label-C8gqICzJ.js";import"./input-Ta_Y1lvO.js";import"./select-D9WchHFw.js";import"./index-lWXyO72r.js";import"./drawer-B9Cs5iI_.js";import"./collection-search-DYVCc599.js";import"./tabs-DfpltS-P.js";import"./toggle-group-B5UDI72A.js";import"./use-deco-credits-CjVry_TJ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-C3_U3j25.js";import"./use-registry-connections-CQIqYcvJ.js";import"./useInfiniteQuery-nR5oOHHR.js";import"./use-infinite-scroll-CsW5GqEa.js";import"./extract-connection-data-Cmd1hHZE.js";import"./card-BIfVO_jW.js";import"./collection-tabs-C0YJH8OQ.js";import"./badge-BcU0uhl8.js";import"./textarea-ji5jId4g.js";import"./connection-form-helpers-QpFovVZo.js";import"./useSuspenseInfiniteQuery-mFFPqXZc.js";import"./mcp-oauth-D0PDq8qp.js";import"./connect-desktop-dialog-C3zpTl9v.js";import"./decopilot-DaDKMLey.js";import"./checkbox-B76UlBUd.js";import"./skeleton-DYsLWJ4s.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-XLADU1Ft.js";import"./popover-BlGotCa-.js";import"./command-Cx31xkYn.js";import"./index-DLBSEic_.js";import"./dropdown-menu-CiC9tTdb.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-B38RTJiB.js";import"./empty-state-yOW3dSH7.js";import"./toolbar-BMWZipjQ.js";import"./preview-dialog-BTdQ1TvF.js";import"./index-BbdyUut8.js";import"./use-mcp-tools-DhZgsJaJ.js";import"./use-capability-jAHdTjWn.js";import"./shell-route-loading-Drp-Ml9n.js";import"./index-Cyq8kOmo.js";import"./alert-dialog-D2GL5qBd.js";import"./switch-B0g5vIO8.js";import"./use-debounced-autosave-BWXIh3Xt.js";import"./index-D-jSeUPY.js";import"./sidebar-BHU7Y-eK.js";import"./search-input-CHOe8stk.js";import"./github-repo-picker-CtfOBr8M.js";import"./use-secrets-B69dGKd4.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-Bt_jVM0U.js";import"./select-model-D4uK7qW2.js";import"./use-automations-Cm2EUHDJ.js";import"./monaco-editor-B83AZ8GN.js";import"./automation-runs-BO1vGgx9.js";import"./table-CuanbdKo.js";import"./use-members-K1wagpAk.js";import"./use-org-auth-client-CMUSTibk.js";import"./task-status-B9Z3_U-A.js";import"./automation-list-row-CAkQUGBC.js";import"./calendar-CbxSTdbI.js";import"./sortable.esm-DYnQaz_O.js";import"./image-field-D_fZia_E.js";import"./use-file-configs-3VHkoOl7.js";function Sr(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{Sr as AppEditor};
@@ -1 +0,0 @@
1
- import{c as B,j as o,s as L,b as T,r as $,B as M,p as N}from"./index-BiSv4wgs.js";import{s as q}from"./Plus-DOSjIlBe.js";import{i as S}from"./Zap-CVq2f6J2.js";import{S as D}from"./search-input-CHOe8stk.js";import{P as l}from"./index-D-jSeUPY.js";import{E as b}from"./empty-state-yOW3dSH7.js";import{c as O}from"./use-automations-Cm2EUHDJ.js";import{m as V}from"./use-navigate-to-agent-GOxU3Hpn.js";import{A as F}from"./automation-list-row-CAkQUGBC.js";import{o as G}from"./use-mcp-client-BcfXwx2l.js";import{u as H}from"./use-virtual-mcp-B9JwuB8w.js";import{R as J}from"./require-capability-XP_1zPNl.js";import"./SearchMd-q-mL98uP.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./tooltip-BIAup3vg.js";import"./sheet-DcscOrN-.js";import"./X-BTPYHIvY.js";import"./studio-tools-B6e1wIqk.js";import"./alert-dialog-D2GL5qBd.js";import"./dropdown-menu-CiC9tTdb.js";import"./ChevronUp-BT7nyl6k.js";import"./ChevronRight-CUrrZIqG.js";import"./DotsVertical-BpkGXLrP.js";import"./Stars02-DMdFpBOz.js";import"./Trash01-jgpaQcTh.js";import"./agent-icon-s6bX_I9L.js";import"./AlertCircle-BYmwGQCf.js";import"./Tool01-CHEQOI-w.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./Settings02-C0s-saqA.js";import"./XCircle-BODgW7sH.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./Users03-BtWBA-oP.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronDown-DbkPHjH7.js";import"./ChevronLeft-7WikNK_I.js";import"./Eye-D3915Vo9.js";import"./ZoomOut-CjZnoT-b.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Star01-1ZF9aI5Y.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./Key01-CAY-Xxyp.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./XClose-qC8Lq_ms.js";import"./auth-BX6flE6a.js";import"./use-collections-DYVhZ6LZ.js";import"./use-capability-jAHdTjWn.js";import"./access-gate-CBINLd7U.js";import"./capability-load-error-D-aRp7QN.js";function K(){const t=B.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,R=H(),k=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(R.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const a=y.get(e.virtual_mcp_id);if(a&&a.title.toLowerCase().includes(g))return!0}return!1}),P=(e,a)=>{const A=a&&y.has(a)?a:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),k(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 m;t[10]!==h.Content||t[11]!==s?(m=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=m):m=t[12];let c;return t[13]!==x||t[14]!==m?(c=o.jsx(x,{children:m}),t[13]=x,t[14]=m,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function io(){const t=B.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{io as default};
@@ -1 +0,0 @@
1
- import{c as K,v as ze,s as Ie,I as Le,K as Oe,k as Ke,d as ge,j as n,B as Ae,p as H,t as L,r as Te,C as Ue,l as _e,ad as fe}from"./index-BiSv4wgs.js";import{t as Xe}from"./ChevronDown-DbkPHjH7.js";import{i as He}from"./ChevronRight-CUrrZIqG.js";import{s as qe,t as Me}from"./Star01-1ZF9aI5Y.js";import{n as Ve}from"./LinkExternal01-DluIM9mv.js";import{s as Re}from"./Plus-DOSjIlBe.js";import{s as Qe}from"./Trash01-jgpaQcTh.js";import{i as Ge}from"./Zap-CVq2f6J2.js";import{c as Ye,b as Je,d as We,A as Ze,g as et,e as tt,a as st,f as nt}from"./alert-dialog-D2GL5qBd.js";import{I as ue}from"./input-Ta_Y1lvO.js";import{T as lt}from"./textarea-ji5jId4g.js";import{P as Ne}from"./index-D-jSeUPY.js";import{u as $e}from"./studio-tools-B6e1wIqk.js";import{u as ot}from"./use-debounced-autosave-BWXIh3Xt.js";import{R as rt}from"./require-capability-XP_1zPNl.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./tooltip-BIAup3vg.js";import"./sheet-DcscOrN-.js";import"./X-BTPYHIvY.js";import"./use-capability-jAHdTjWn.js";import"./access-gate-CBINLd7U.js";import"./capability-load-error-D-aRp7QN.js";function we(t){const e=K.c(8),{title:s,children:o,className:l}=t;let r;e[0]!==l?(r=_e("rounded-2xl border border-border/60 bg-background p-5",l),e[0]=l,e[1]=r):r=e[1];let c;e[2]!==s?(c=n.jsx("div",{className:"mb-4",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s})}),e[2]=s,e[3]=c):c=e[3];let f;return e[4]!==o||e[5]!==r||e[6]!==c?(f=n.jsxs("div",{className:r,children:[c,o]}),e[4]=o,e[5]=r,e[6]=c,e[7]=f):f=e[7],f}function at(t){const e=K.c(25),{onExtract:s,isExtracting:o}=t,[l,r]=Te.useState("");let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10",children:n.jsx(Ge,{size:18,className:"text-primary"})}),e[0]=c):c=e[0];let f,g;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-extract brand context"}),g=n.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Enter your website URL and we'll automatically extract your brand colors, fonts, logos, and company overview."}),e[1]=f,e[2]=g):(f=e[1],g=e[2]);let b;e[3]===Symbol.for("react.memo_cache_sentinel")?(b=m=>r(m.target.value),e[3]=b):b=e[3];let p;e[4]!==l||e[5]!==o||e[6]!==s?(p=m=>{m.key==="Enter"&&l.trim()&&!o&&s(l.trim())},e[4]=l,e[5]=o,e[6]=s,e[7]=p):p=e[7];let d;e[8]!==l||e[9]!==p?(d=n.jsx(ue,{placeholder:"acme.com",value:l,onChange:b,className:"max-w-xs",onKeyDown:p}),e[8]=l,e[9]=p,e[10]=d):d=e[10];let a;e[11]!==l||e[12]!==o?(a=!l.trim()||o,e[11]=l,e[12]=o,e[13]=a):a=e[13];let i;e[14]!==l||e[15]!==s?(i=()=>s(l.trim()),e[14]=l,e[15]=s,e[16]=i):i=e[16];let u;e[17]===Symbol.for("react.memo_cache_sentinel")?(u=n.jsx(qe,{size:14}),e[17]=u):u=e[17];const h=o?"Extracting...":"Extract";let x;e[18]!==h||e[19]!==a||e[20]!==i?(x=n.jsxs(Ae,{variant:"outline",disabled:a,onClick:i,children:[u,h]}),e[18]=h,e[19]=a,e[20]=i,e[21]=x):x=e[21];let v;return e[22]!==x||e[23]!==d?(v=n.jsx("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-5",children:n.jsxs("div",{className:"flex items-start gap-4",children:[c,n.jsxs("div",{className:"flex-1",children:[f,g,n.jsxs("div",{className:"mt-3 flex gap-2",children:[d,x]})]})]})}),e[22]=x,e[23]=d,e[24]=v):v=e[24],v}function it(t){const e=K.c(36),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s?(r=s.watch("domain"),e[0]=s,e[1]=r):r=e[1];const c=r;let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Company name"}),e[2]=f):f=e[2];let g;e[3]!==o||e[4]!==l?(g=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Acme Corp"})},e[3]=o,e[4]=l,e[5]=g):g=e[5];let b;e[6]!==s.control||e[7]!==g?(b=n.jsxs("div",{children:[f,n.jsx(fe,{control:s.control,name:"name",render:g})]}),e[6]=s.control,e[7]=g,e[8]=b):b=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=n.jsx("span",{children:"Domain"}),e[9]=p):p=e[9];let d;e[10]!==c?(d=c&&n.jsxs("a",{href:`https://${c}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:text-foreground",children:[n.jsx(Ve,{size:10}),"open"]}),e[10]=c,e[11]=d):d=e[11];let a;e[12]!==d?(a=n.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[p,d]}),e[12]=d,e[13]=a):a=e[13];let i;e[14]!==o||e[15]!==l?(i=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"acme.com"})},e[14]=o,e[15]=l,e[16]=i):i=e[16];let u;e[17]!==s.control||e[18]!==i?(u=n.jsx(fe,{control:s.control,name:"domain",render:i}),e[17]=s.control,e[18]=i,e[19]=u):u=e[19];let h;e[20]!==a||e[21]!==u?(h=n.jsxs("div",{children:[a,u]}),e[20]=a,e[21]=u,e[22]=h):h=e[22];let x;e[23]!==h||e[24]!==b?(x=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[b,h]}),e[23]=h,e[24]=b,e[25]=x):x=e[25];let v;e[26]===Symbol.for("react.memo_cache_sentinel")?(v=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Overview"}),e[26]=v):v=e[26];let m;e[27]!==o||e[28]!==l?(m=D=>{const{field:y}=D;return n.jsx(lt,{...y,onChange:_=>{y.onChange(_),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Brief description of what the company does...",rows:3})},e[27]=o,e[28]=l,e[29]=m):m=e[29];let C;e[30]!==s.control||e[31]!==m?(C=n.jsxs("div",{children:[v,n.jsx(fe,{control:s.control,name:"overview",render:m})]}),e[30]=s.control,e[31]=m,e[32]=C):C=e[32];let k;return e[33]!==x||e[34]!==C?(k=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[x,C]})}),e[33]=x,e[34]=C,e[35]=k):k=e[35],k}const ct={backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"8px 8px",backgroundPosition:"0 0, 4px 4px",backgroundColor:"#fff"};function Se(t){const e=K.c(22),{form:s,name:o,label:l,imgClassName:r,onFieldChange:c,onFieldCommit:f}=t,g=r===void 0?"h-full w-full object-contain p-3":r;let b;e[0]!==s||e[1]!==o?(b=s.watch(o),e[0]=s,e[1]=o,e[2]=b):b=e[2];const p=b;let d;e[3]!==g||e[4]!==l||e[5]!==p?(d=n.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:ct,children:p?n.jsx("img",{src:p,alt:l,className:g,loading:"lazy"}):n.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:["No ",l.toLowerCase()]})}),e[3]=g,e[4]=l,e[5]=p,e[6]=d):d=e[6];let a;e[7]!==l?(a=n.jsxs("label",{className:"mb-1 block text-xs text-muted-foreground",children:[l," URL"]}),e[7]=l,e[8]=a):a=e[8];let i;e[9]!==c||e[10]!==f?(i=v=>{const{field:m}=v;return n.jsx(ue,{...m,onChange:C=>{m.onChange(C),c()},onBlur:()=>{m.onBlur(),f()},placeholder:"https://..."})},e[9]=c,e[10]=f,e[11]=i):i=e[11];let u;e[12]!==s.control||e[13]!==o||e[14]!==i?(u=n.jsx(fe,{control:s.control,name:o,render:i}),e[12]=s.control,e[13]=o,e[14]=i,e[15]=u):u=e[15];let h;e[16]!==a||e[17]!==u?(h=n.jsxs("div",{className:"flex-1",children:[a,u]}),e[16]=a,e[17]=u,e[18]=h):h=e[18];let x;return e[19]!==d||e[20]!==h?(x=n.jsxs("div",{className:"flex items-start gap-3",children:[d,h]}),e[19]=d,e[20]=h,e[21]=x):x=e[21],x}function dt(t){const e=K.c(4),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;return e[0]!==s||e[1]!==o||e[2]!==l?(r=n.jsx(we,{title:"Logos & Images",children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(Se,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Se,{form:s,name:"ogImage",label:"SEO / OG image",imgClassName:"h-full w-full object-contain",onFieldChange:o,onFieldCommit:l})]})}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3],r}const mt=[{key:"heading",label:"Headings"},{key:"body",label:"Body"},{key:"code",label:"Code"}];function ft(t){const e=K.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=mt.map(f=>{const{key:g,label:b}=f,p=`fonts.${g}`,d=s.watch(p);return n.jsxs("div",{children:[n.jsxs("label",{className:"mb-1 flex items-center gap-3 text-xs text-muted-foreground",children:[n.jsx("span",{className:"w-7 text-base font-medium leading-none text-foreground",children:"Aa"}),n.jsx("span",{children:b}),d&&n.jsx("span",{className:"ml-auto truncate text-foreground",style:{fontFamily:d},children:d})]}),n.jsx(fe,{control:s.control,name:p,render:a=>{const{field:i}=a;return n.jsx(ue,{...i,value:i.value??"",onChange:u=>{i.onChange(u),o()},onBlur:()=>{i.onBlur(),l()},placeholder:`Font family for ${b.toLowerCase()}`})}})]},g)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let c;return e[4]!==r?(c=n.jsx(we,{title:"Fonts",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=c):c=e[5],c}const ut=[{key:"primary",label:"Primary"},{key:"secondary",label:"Secondary"},{key:"accent",label:"Accent"},{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}];function xt(t){const e=K.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=ut.map(f=>{const{key:g,label:b}=f,p=`colors.${g}`;return n.jsx(fe,{control:s.control,name:p,render:d=>{const{field:a}=d;return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:a.value??"#000000",onChange:i=>{a.onChange(i.target.value),o()},onBlur:()=>{a.onBlur(),l()},className:"h-9 w-9 shrink-0 cursor-pointer rounded-lg border border-border bg-transparent p-0.5"}),n.jsx(ue,{value:a.value??"",onChange:i=>{a.onChange(i.target.value),o()},onBlur:()=>{a.onBlur(),l()},placeholder:"#000000",className:"w-28"}),n.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:b})]})}},g)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let c;return e[4]!==r?(c=n.jsx(we,{title:"Colors",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=c):c=e[5],c}function gt(t){const e=K.c(127),{brand:s,onChanged:o}=t,l=$e(),[r,c]=Te.useState(s.isDefault??!1),[f,g]=Te.useState(!1),b=s.name??"",p=s.domain??"",d=s.overview??"",a=s.logo??"",i=s.favicon??"",u=s.ogImage??"";let h;e[0]!==s.fonts?(h=s.fonts??{},e[0]=s.fonts,e[1]=h):h=e[1];let x;e[2]!==s.colors?(x=s.colors??{},e[2]=s.colors,e[3]=x):x=e[3];let v;e[4]!==b||e[5]!==p||e[6]!==d||e[7]!==a||e[8]!==i||e[9]!==u||e[10]!==h||e[11]!==x?(v={values:{name:b,domain:p,overview:d,logo:a,favicon:i,ogImage:u,fonts:h,colors:x}},e[4]=b,e[5]=p,e[6]=d,e[7]=a,e[8]=i,e[9]=u,e[10]=h,e[11]=x,e[12]=v):v=e[12];const m=Ue(v);let C;e[13]!==s.id||e[14]!==l?(C={mutationFn:async j=>{const ve=Object.values(j.fonts).some(wt),Ce=Object.values(j.colors).some(_t);await l.call("BRAND_CONTEXT_UPDATE",{id:s.id,name:j.name,domain:j.domain,overview:j.overview,logo:j.logo||null,favicon:j.favicon||null,ogImage:j.ogImage||null,fonts:ve?j.fonts:null,colors:Ce?j.colors:null})},onError:Nt},e[13]=s.id,e[14]=l,e[15]=C):C=e[15];const k=ge(C);let D;e[16]!==s.id||e[17]!==m||e[18]!==o||e[19]!==k?(D={delayMs:500,save:async()=>{const j=m.control._formState.dirtyFields,ve=Object.keys(j);if(ve.length===0)return;const Ce=m.getValues(),Pe=m.control._defaultValues;m.reset(Ce,{keepValues:!0});try{await k.mutateAsync(Ce),H("brand_updated",{brand_id:s.id,fields:ve}),L.success("Brand context updated successfully"),o()}catch{m.reset(Pe,{keepValues:!0})}}},e[16]=s.id,e[17]=m,e[18]=o,e[19]=k,e[20]=D):D=e[20];const{schedule:y,flush:_}=ot(D);let $;e[21]!==s.id||e[22]!==l?($=async()=>{await l.call("BRAND_CONTEXT_DELETE",{id:s.id})},e[21]=s.id,e[22]=l,e[23]=$):$=e[23];let P;e[24]!==s.id||e[25]!==o?(P=()=>{H("brand_deleted",{brand_id:s.id}),g(!1),o(),L.success("Brand deleted")},e[24]=s.id,e[25]=o,e[26]=P):P=e[26];let q;e[27]!==$||e[28]!==P?(q={mutationFn:$,onSuccess:P,onError:Ct},e[27]=$,e[28]=P,e[29]=q):q=e[29];const{mutate:U,isPending:N}=ge(q);let A;e[30]!==s.id||e[31]!==s.isDefault||e[32]!==l?(A=async()=>{await l.call("BRAND_CONTEXT_UPDATE",{id:s.id,isDefault:!s.isDefault})},e[30]=s.id,e[31]=s.isDefault,e[32]=l,e[33]=A):A=e[33];let B;e[34]!==s.id||e[35]!==s.isDefault||e[36]!==o?(B=()=>{H(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),o(),L.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[34]=s.id,e[35]=s.isDefault,e[36]=o,e[37]=B):B=e[37];let T;e[38]!==A||e[39]!==B?(T={mutationFn:A,onSuccess:B,onError:vt},e[38]=A,e[39]=B,e[40]=T):T=e[40];const{mutate:X}=ge(T),xe=s.isDefault?"border-primary/30":"border-border/60";let O;e[41]!==xe?(O=_e("rounded-2xl border bg-background",xe),e[41]=xe,e[42]=O):O=e[42];let z;e[43]!==r?(z=()=>c(!r),e[43]=r,e[44]=z):z=e[44];let E;e[45]!==r?(E=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(Xe,{size:14}):n.jsx(He,{size:14})}),e[45]=r,e[46]=E):E=e[46];let F;e[47]!==s.logo||e[48]!==s.name?(F=s.logo?n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-lg",style:{backgroundImage:"linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%), linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%)",backgroundSize:"6px 6px",backgroundPosition:"0 0, 3px 3px",backgroundColor:"#fff"},children:n.jsx("img",{src:s.logo,alt:"",className:"h-full w-full object-contain p-1",onError:yt})}):n.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:n.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s.name?.charAt(0)?.toUpperCase()||"?"})}),e[47]=s.logo,e[48]=s.name,e[49]=F):F=e[49];const I=s.name||"Untitled Brand";let S;e[50]!==I?(S=n.jsx("span",{className:"text-sm font-medium text-foreground",children:I}),e[50]=I,e[51]=S):S=e[51];let R;e[52]!==s.domain?(R=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[52]=s.domain,e[53]=R):R=e[53];let w;e[54]!==S||e[55]!==R?(w=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[S,R]}),e[54]=S,e[55]=R,e[56]=w):w=e[56];let M;e[57]!==s.colors||e[58]!==r?(M=!r&&s.colors&&Object.values(s.colors).some(jt)&&n.jsx("div",{className:"flex shrink-0 gap-1",children:Object.entries(s.colors).filter(bt).map(pt)}),e[57]=s.colors,e[58]=r,e[59]=M):M=e[59];let V;e[60]!==s.fonts||e[61]!==r?(V=!r&&s.fonts&&Object.values(s.fonts).some(ht)&&n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Object.values(s.fonts).filter(Boolean).join(", ")}),e[60]=s.fonts,e[61]=r,e[62]=V):V=e[62];const De=s.isDefault?"opacity-100":"opacity-0 hover:bg-muted group-hover:opacity-100";let Q;e[63]!==De?(Q=_e("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-opacity",De),e[63]=De,e[64]=Q):Q=e[64];let G,Y;e[65]!==X?(G=j=>{j.stopPropagation(),X()},Y=j=>{j.key==="Enter"&&(j.stopPropagation(),X())},e[65]=X,e[66]=G,e[67]=Y):(G=e[66],Y=e[67]);const ke=s.isDefault?"Unset as default":"Set as default",Be=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let J;e[68]!==Be?(J=_e(Be),e[68]=Be,e[69]=J):J=e[69];let W;e[70]!==J?(W=n.jsx(Me,{size:13,className:J}),e[70]=J,e[71]=W):W=e[71];let Z;e[72]!==Q||e[73]!==G||e[74]!==Y||e[75]!==ke||e[76]!==W?(Z=n.jsx("span",{role:"button",tabIndex:0,className:Q,onClick:G,onKeyDown:Y,title:ke,children:W}),e[72]=Q,e[73]=G,e[74]=Y,e[75]=ke,e[76]=W,e[77]=Z):Z=e[77];let he,pe;e[78]===Symbol.for("react.memo_cache_sentinel")?(he=j=>{j.stopPropagation(),g(!0)},pe=j=>{j.key==="Enter"&&(j.stopPropagation(),g(!0))},e[78]=he,e[79]=pe):(he=e[78],pe=e[79]);let be;e[80]===Symbol.for("react.memo_cache_sentinel")?(be=n.jsx("span",{role:"button",tabIndex:0,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg opacity-0 transition-opacity hover:bg-destructive/10 group-hover:opacity-100",onClick:he,onKeyDown:pe,title:"Delete brand",children:n.jsx(Qe,{size:13,className:"text-muted-foreground"})}),e[80]=be):be=e[80];let ee;e[81]!==z||e[82]!==E||e[83]!==F||e[84]!==w||e[85]!==M||e[86]!==V||e[87]!==Z?(ee=n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-5",onClick:z,children:[E,F,w,M,V,Z,be]}),e[81]=z,e[82]=E,e[83]=F,e[84]=w,e[85]=M,e[86]=V,e[87]=Z,e[88]=ee):ee=e[88];let te;e[89]!==r||e[90]!==_||e[91]!==m||e[92]!==y?(te=r&&n.jsxs("div",{className:"space-y-3 px-5 pb-5",children:[n.jsx(it,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsx(dt,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(xt,{form:m,onFieldChange:y,onFieldCommit:_}),n.jsx(ft,{form:m,onFieldChange:y,onFieldCommit:_})]})]}),e[89]=r,e[90]=_,e[91]=m,e[92]=y,e[93]=te):te=e[93];let se;e[94]!==N?(se=j=>{!j&&!N&&g(!1)},e[94]=N,e[95]=se):se=e[95];let je;e[96]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(Ye,{children:"Delete brand?"}),e[96]=je):je=e[96];const Ee=s.name||"this brand";let ne;e[97]!==Ee?(ne=n.jsxs("p",{children:["This will permanently delete"," ",n.jsx("span",{className:"font-medium text-foreground",children:Ee}),". This action cannot be undone."]}),e[97]=Ee,e[98]=ne):ne=e[98];let le;e[99]!==s.isDefault?(le=s.isDefault&&n.jsxs("p",{className:"mt-2 rounded-lg border border-destructive/30 bg-destructive/5 p-2 text-destructive",children:[n.jsx("span",{className:"font-medium",children:"Heads up:"})," this is your organization's default brand. Deleting it will leave your organization without a default brand until you set another."]}),e[99]=s.isDefault,e[100]=le):le=e[100];let oe;e[101]!==ne||e[102]!==le?(oe=n.jsxs(Je,{children:[je,n.jsx(We,{asChild:!0,children:n.jsxs("div",{children:[ne,le]})})]}),e[101]=ne,e[102]=le,e[103]=oe):oe=e[103];let re;e[104]!==N?(re=n.jsx(Ze,{disabled:N,children:"Cancel"}),e[104]=N,e[105]=re):re=e[105];let ae;e[106]!==U?(ae=j=>{j.preventDefault(),U()},e[106]=U,e[107]=ae):ae=e[107];const Fe=N?"Deleting...":"Delete";let ie;e[108]!==N||e[109]!==ae||e[110]!==Fe?(ie=n.jsx(et,{onClick:ae,disabled:N,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[108]=N,e[109]=ae,e[110]=Fe,e[111]=ie):ie=e[111];let ce;e[112]!==re||e[113]!==ie?(ce=n.jsxs(tt,{children:[re,ie]}),e[112]=re,e[113]=ie,e[114]=ce):ce=e[114];let de;e[115]!==oe||e[116]!==ce?(de=n.jsxs(st,{children:[oe,ce]}),e[115]=oe,e[116]=ce,e[117]=de):de=e[117];let me;e[118]!==f||e[119]!==se||e[120]!==de?(me=n.jsx(nt,{open:f,onOpenChange:se,children:de}),e[118]=f,e[119]=se,e[120]=de,e[121]=me):me=e[121];let ye;return e[122]!==O||e[123]!==ee||e[124]!==te||e[125]!==me?(ye=n.jsxs("div",{className:O,children:[ee,te,me]}),e[122]=O,e[123]=ee,e[124]=te,e[125]=me,e[126]=ye):ye=e[126],ye}function ht(t){return t}function pt(t){const[e,s]=t;return n.jsx("div",{className:"h-5 w-5 rounded-full border border-border/40",style:{backgroundColor:s},title:`${e}: ${s}`},e)}function bt(t){const[,e]=t;return e}function jt(t){return t}function yt(t){t.target.style.display="none"}function vt(){return L.error("Failed to update default brand")}function Ct(){return L.error("Failed to delete brand")}function Nt(){return L.error("Failed to save brand context")}function _t(t){return t?.trim()}function wt(t){return t?.trim()}function Dt(){const t=K.c(53),{brandExtractEnabled:e}=ze(),{org:s}=Ie(),o=$e(),l=Le();let r;t[0]!==s.id?(r=Oe.brandContext(s.id),t[0]=s.id,t[1]=r):r=t[1];let c;t[2]!==o?(c=async()=>{const{items:w}=await o.call("BRAND_CONTEXT_LIST",{includeArchived:!1});return w},t[2]=o,t[3]=c):c=t[3];let f;t[4]!==r||t[5]!==c?(f={queryKey:r,queryFn:c},t[4]=r,t[5]=c,t[6]=f):f=t[6];const{data:g}=Ke(f),p=(g===void 0?[]:g).filter(Et);let d;t[7]!==s.id||t[8]!==l?(d=()=>l.invalidateQueries({queryKey:Oe.brandContext(s.id),refetchType:"all"}),t[7]=s.id,t[8]=l,t[9]=d):d=t[9];const a=d;let i;t[10]!==o?(i=async()=>{await o.call("BRAND_CONTEXT_CREATE",{name:"New Brand",domain:"example.com",overview:""})},t[10]=o,t[11]=i):i=t[11];let u;t[12]!==a?(u=()=>{H("brand_created"),a(),L.success("Brand created")},t[12]=a,t[13]=u):u=t[13];let h;t[14]!==i||t[15]!==u?(h={mutationFn:i,onSuccess:u,onError:Bt},t[14]=i,t[15]=u,t[16]=h):h=t[16];const{mutate:x,isPending:v}=ge(h);let m;t[17]!==o?(m=async w=>{H("brand_extract_started",{domain:w}),await o.call("BRAND_CONTEXT_EXTRACT",{domain:w})},t[17]=o,t[18]=m):m=t[18];let C;t[19]!==a?(C=()=>{H("brand_extract_succeeded"),a(),L.success("Brand extracted successfully")},t[19]=a,t[20]=C):C=t[20];let k;t[21]!==m||t[22]!==C?(k={mutationFn:m,onSuccess:C,onError:kt},t[21]=m,t[22]=C,t[23]=k):k=t[23];const{mutate:D,isPending:y}=ge(k),_=Ne,$=Ne,P=Ne,q="flex flex-col gap-6";let U;t[24]===Symbol.for("react.memo_cache_sentinel")?(U=n.jsxs("div",{children:[n.jsx(Ne.Title,{children:"Brand Context"}),n.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Define your brand profiles. Each brand is available as an MCP prompt for AI clients."})]}),t[24]=U):U=t[24];let N;t[25]!==x?(N=()=>x(),t[25]=x,t[26]=N):N=t[26];let A;t[27]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(Re,{size:14}),t[27]=A):A=t[27];let B;t[28]!==v||t[29]!==N?(B=n.jsxs("div",{className:"flex items-center justify-between",children:[U,n.jsxs(Ae,{variant:"outline",onClick:N,disabled:v,children:[A,"Add Brand"]})]}),t[28]=v,t[29]=N,t[30]=B):B=t[30];let T;t[31]!==e||t[32]!==D||t[33]!==y?(T=e&&n.jsx(at,{onExtract:w=>D(w),isExtracting:y}),t[31]=e,t[32]=D,t[33]=y,t[34]=T):T=t[34];const X=p.length===0&&n.jsxs("div",{className:"rounded-2xl border border-dashed border-border bg-muted/30 p-8 text-center",children:[n.jsx("p",{className:"text-sm text-muted-foreground",children:"No brands configured yet."}),n.jsxs(Ae,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>x(),disabled:v,children:[n.jsx(Re,{size:14}),"Add your first brand"]})]}),xe="group space-y-3";let O;t[35]!==a?(O=w=>n.jsx(gt,{brand:w,onChanged:a},w.id),t[35]=a,t[36]=O):O=t[36];const z=p.map(O);let E;t[37]!==z?(E=n.jsx("div",{className:xe,children:z}),t[37]=z,t[38]=E):E=t[38];let F;t[39]!==B||t[40]!==T||t[41]!==X||t[42]!==E?(F=n.jsxs("div",{className:q,children:[B,T,X,E]}),t[39]=B,t[40]=T,t[41]=X,t[42]=E,t[43]=F):F=t[43];let I;t[44]!==P.Body||t[45]!==F?(I=n.jsx(P.Body,{children:F}),t[44]=P.Body,t[45]=F,t[46]=I):I=t[46];let S;t[47]!==$.Content||t[48]!==I?(S=n.jsx($.Content,{children:I}),t[47]=$.Content,t[48]=I,t[49]=S):S=t[49];let R;return t[50]!==_||t[51]!==S?(R=n.jsx(_,{children:S}),t[50]=_,t[51]=S,t[52]=R):R=t[52],R}function kt(t){H("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),L.error(t instanceof Error?t.message:"Failed to extract brand")}function Bt(){return L.error("Failed to create brand")}function Et(t){return!t.archivedAt}function Zt(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(rt,{capability:"org:manage",area:"brand context",children:n.jsx(Dt,{})}),t[0]=e):e=t[0],e}export{Zt as default};
@@ -1 +0,0 @@
1
- import{c as st,j as e,B as mt}from"./index-BiSv4wgs.js";import{i as pt}from"./ArrowRight-CvF16wpP.js";import{N as lt}from"./agent-icon-s6bX_I9L.js";import{I as tt}from"./input-Ta_Y1lvO.js";import{L as et}from"./label-C8gqICzJ.js";import{ak as at,al as nt,ar as ct,am as ft}from"./index-DAfY2rvi.js";import{u as dt,s as M,I as gt}from"./primitives-CKYU8UlB.js";import{S as ut}from"./save-status-Bwyidu0s.js";import{a as xt,B as ht,b as yt}from"./block-document-CF604YR_.js";import"./AlertCircle-BYmwGQCf.js";import"./Tool01-CHEQOI-w.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./Settings02-C0s-saqA.js";import"./XCircle-BODgW7sH.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./Users03-BtWBA-oP.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronUp-BT7nyl6k.js";import"./ChevronDown-DbkPHjH7.js";import"./ChevronLeft-7WikNK_I.js";import"./ChevronRight-CUrrZIqG.js";import"./DotsVertical-BpkGXLrP.js";import"./Stars02-DMdFpBOz.js";import"./Eye-D3915Vo9.js";import"./ZoomOut-CjZnoT-b.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Star01-1ZF9aI5Y.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./Key01-CAY-Xxyp.js";import"./LayoutLeft-CJuGELXN.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Plus-DOSjIlBe.js";import"./SearchMd-q-mL98uP.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Trash01-jgpaQcTh.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./XClose-qC8Lq_ms.js";import"./X-BTPYHIvY.js";import"./Zap-CVq2f6J2.js";import"./index-lWXyO72r.js";import"./chat-context-EpSQJI2R.js";import"./hooks-DX86YvO8.js";import"./use-mcp-client-BcfXwx2l.js";import"./auth-BX6flE6a.js";import"./decopilot-sse-pool-CcKrM-Xv.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-virtual-mcp-B9JwuB8w.js";import"./use-collections-DYVhZ6LZ.js";import"./use-ai-providers-CSwg9ID-.js";import"./studio-tools-B6e1wIqk.js";import"./tab-id-BptcWVWa.js";import"./use-organization-settings-CbMA9tyx.js";import"./scroll-area-iBbwLoaH.js";import"./use-clock-tick-BH2ii9Ri.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BL1Gi5Ma.js";import"./tooltip-BIAup3vg.js";import"./file-type-icon-C0VVPUpN.js";import"./dialog-DGhL6eBy.js";import"./content-blocks-o63cs2vh.js";import"./types-DmsJ1dgA.js";import"./shell-layout-78V1nK9o.js";import"./avatar-BS-jv_DR.js";import"./required-auth-layout-qIDzSGtQ.js";import"./use-org-sso-BJNpFjMG.js";import"./sheet-DcscOrN-.js";import"./integration-icon-DDugmSqH.js";import"./use-navigate-to-agent-GOxU3Hpn.js";import"./use-connection-CYq4sTpp.js";import"./use-mcp-prompts-h_GWEUu_.js";import"./form-CaHcodeJ.js";import"./select-D9WchHFw.js";import"./drawer-B9Cs5iI_.js";import"./collection-search-DYVCc599.js";import"./tabs-DfpltS-P.js";import"./toggle-group-B5UDI72A.js";import"./use-deco-credits-CjVry_TJ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-C3_U3j25.js";import"./use-registry-connections-CQIqYcvJ.js";import"./useInfiniteQuery-nR5oOHHR.js";import"./use-infinite-scroll-CsW5GqEa.js";import"./extract-connection-data-Cmd1hHZE.js";import"./card-BIfVO_jW.js";import"./collection-tabs-C0YJH8OQ.js";import"./badge-BcU0uhl8.js";import"./textarea-ji5jId4g.js";import"./connection-form-helpers-QpFovVZo.js";import"./useSuspenseInfiniteQuery-mFFPqXZc.js";import"./mcp-oauth-D0PDq8qp.js";import"./connect-desktop-dialog-C3zpTl9v.js";import"./decopilot-DaDKMLey.js";import"./checkbox-B76UlBUd.js";import"./skeleton-DYsLWJ4s.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-XLADU1Ft.js";import"./popover-BlGotCa-.js";import"./command-Cx31xkYn.js";import"./index-DLBSEic_.js";import"./dropdown-menu-CiC9tTdb.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-B38RTJiB.js";import"./empty-state-yOW3dSH7.js";import"./toolbar-BMWZipjQ.js";import"./preview-dialog-BTdQ1TvF.js";import"./index-BbdyUut8.js";import"./use-mcp-tools-DhZgsJaJ.js";import"./use-capability-jAHdTjWn.js";import"./shell-route-loading-Drp-Ml9n.js";import"./index-Cyq8kOmo.js";import"./alert-dialog-D2GL5qBd.js";import"./switch-B0g5vIO8.js";import"./use-debounced-autosave-BWXIh3Xt.js";import"./index-D-jSeUPY.js";import"./sidebar-BHU7Y-eK.js";import"./search-input-CHOe8stk.js";import"./github-repo-picker-CtfOBr8M.js";import"./use-secrets-B69dGKd4.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./view-mode-toggle-Bt_jVM0U.js";import"./select-model-D4uK7qW2.js";import"./use-automations-Cm2EUHDJ.js";import"./monaco-editor-B83AZ8GN.js";import"./automation-runs-BO1vGgx9.js";import"./table-CuanbdKo.js";import"./use-members-K1wagpAk.js";import"./use-org-auth-client-CMUSTibk.js";import"./task-status-B9Z3_U-A.js";import"./automation-list-row-CAkQUGBC.js";import"./sortable.esm-DYnQaz_O.js";import"./schema-form-CTQz2kTF.js";import"./calendar-CbxSTdbI.js";import"./image-field-D_fZia_E.js";import"./use-file-configs-3VHkoOl7.js";function io(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{io as CategoryEditor};
@@ -1 +0,0 @@
1
- import{c as y,j as t,B as F,i as X,x as Ge,y as se,a2 as Pe,r as T,s as ie,C as Qe,l as V,be as Ye,u as Xe,w as G,t as Ze,e as ae,b0 as ke}from"./index-BiSv4wgs.js";import{E as Ae}from"./empty-state-yOW3dSH7.js";import{u as et,a as Ee}from"./use-collections-DYVhZ6LZ.js";import{u as ce}from"./use-mcp-client-BcfXwx2l.js";import{F as ne,a as tt,b as de,d as me}from"./form-CaHcodeJ.js";import{I as ue}from"./input-Ta_Y1lvO.js";import{T as re}from"./textarea-ji5jId4g.js";import{a as st,b as nt,V as xe,O as ot,M as lt}from"./index-BdFUyuzp.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-s6bX_I9L.js";import{g as ut,M as xt,a as Ne}from"./types-DmsJ1dgA.js";import{A as pt,a as ft,b as ht}from"./alert-CHc3FYZF.js";import{d as ve,b as Se,c as ye,S as we,a as oe}from"./select-D9WchHFw.js";import{c as gt,b as Ce,T as Ie,a as $e}from"./tooltip-BIAup3vg.js";import{i as jt}from"./AlertCircle-BYmwGQCf.js";import{s as bt}from"./Stars02-DMdFpBOz.js";import{a as Nt}from"./Eye-D3915Vo9.js";import{i as vt}from"./Play-I5x_JKdj.js";import{i as St}from"./ChevronRight-CUrrZIqG.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./index-Cyq8kOmo.js";import{a as Oe,u as Re}from"./use-connection-CYq4sTpp.js";import{a as It}from"./use-mcp-tools-DhZgsJaJ.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as Te}from"./integration-icon-DDugmSqH.js";import{f as Tt,h as Pt}from"./chat-context-EpSQJI2R.js";import{b as kt}from"./shell-layout-78V1nK9o.js";import{M as At}from"./monaco-editor-B83AZ8GN.js";import{n as Et}from"./XCircle-BODgW7sH.js";import"./auth-BX6flE6a.js";import"./label-C8gqICzJ.js";import"./index-D-jSeUPY.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./sheet-DcscOrN-.js";import"./X-BTPYHIvY.js";import"./ZoomOut-CjZnoT-b.js";import"./Key01-CAY-Xxyp.js";import"./extract-connection-data-Cmd1hHZE.js";import"./use-registry-connections-CQIqYcvJ.js";import"./use-organization-settings-CbMA9tyx.js";import"./studio-tools-B6e1wIqk.js";import"./Plus-DOSjIlBe.js";import"./index-CQF6lVUo.js";import"./index-DLBSEic_.js";import"./popover-BlGotCa-.js";import"./use-virtual-mcp-B9JwuB8w.js";import"./ChevronUp-BT7nyl6k.js";import"./SearchMd-q-mL98uP.js";import"./Users03-BtWBA-oP.js";import"./use-create-virtual-mcp-BbTDDIhz.js";import"./use-navigate-to-agent-GOxU3Hpn.js";import"./Tool01-CHEQOI-w.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./Settings02-C0s-saqA.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronDown-DbkPHjH7.js";import"./ChevronLeft-7WikNK_I.js";import"./DotsVertical-BpkGXLrP.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Star01-1ZF9aI5Y.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Trash01-jgpaQcTh.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./XClose-qC8Lq_ms.js";import"./Zap-CVq2f6J2.js";import"./mcp-oauth-D0PDq8qp.js";import"./badge-BcU0uhl8.js";import"./hooks-DX86YvO8.js";import"./decopilot-sse-pool-CcKrM-Xv.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./use-ai-providers-CSwg9ID-.js";import"./tab-id-BptcWVWa.js";import"./avatar-BS-jv_DR.js";import"./dialog-DGhL6eBy.js";import"./required-auth-layout-qIDzSGtQ.js";import"./use-org-sso-BJNpFjMG.js";import"./index-BbdyUut8.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 Mn(){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{Mn as default};
@@ -1 +0,0 @@
1
- import{c as O,j as t,u as ve,a as Re,b as Se,m as Ee,r as L,d as ye,i as Ce,n as be,K as pe,k as he,B as le,L as Ne}from"./index-BiSv4wgs.js";import{A as ze}from"./auth-entry-DfGml_TH.js";import{A}from"./auth-split-layout-HWtMmGAh.js";import{O as xe}from"./organization-choice-B6-OJzO9.js";import{f as Te}from"./tab-id-BptcWVWa.js";import{I as Oe}from"./input-Ta_Y1lvO.js";import{S as we,u as Ie,W as Pe,g as Ue,C as Le}from"./use-mcp-client-BcfXwx2l.js";import{i as _e}from"./ArrowRight-CvF16wpP.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-BS-jv_DR.js";import"./User01-CQqeHCY8.js";import"./auth-BX6flE6a.js";const Ae=/^[a-zA-Z][a-zA-Z\d+.-]*:/,$e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//,Me=/^[^\s/:?#]+\.[^\s/:?#]+:\d+(?:[/?#]|$)/,ke=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;function je(o){const e=o.trim();if(!e)return{ok:!1,error:"Enter a website URL."};const i=Ae.test(e),s=$e.test(e),a=Me.test(e);if(i&&!s&&!a)return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const c=s?e:`https://${e}`;let r;try{r=new URL(c)}catch{return{ok:!1,error:"Enter a valid website URL."}}if(r.protocol!=="http:"&&r.protocol!=="https:")return{ok:!1,error:"Use an HTTP or HTTPS website URL."};const l=r.hostname.split(".");return l.length<2||l.some(m=>!m||!ke.test(m))?{ok:!1,error:"Enter a valid website URL."}:(r.protocol="https:",{ok:!0,value:r.origin})}function lt(){const o=O.c(1);let e;return o[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(De,{}),o[0]=e):e=o[0],e}function De(){const o=O.c(6);let e;o[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/commerce-onboarding"},o[0]=e):e=o[0];const i=ve(e),{org:s,siteUrl:a}=i,{data:c,isPending:r}=Re.useSession();if(r){let m;return o[1]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(A,{children:t.jsx(Y,{label:"Preparing commerce onboarding..."})}),o[1]=m):m=o[1],m}if(!c){const m=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let f;return o[2]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(A,{children:t.jsx(ze,{callbackUrl:m,allowAutoLogin:!1})}),o[2]=f):f=o[2],f}let l;return o[3]!==s||o[4]!==a?(l=t.jsx(He,{requestedOrgSlug:s,siteUrl:a}),o[3]=s,o[4]=a,o[5]=l):l=o[5],l}function He(o){const e=O.c(40),{requestedOrgSlug:i,siteUrl:s}=o,a=Se(),c=Ee(),[r,l]=L.useState(null),[m,f]=L.useState(null),p=c.data?.map(Fe)??[];let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={mutationFn:We,retry:!1,onSuccess:n=>{f(n)}},e[0]=g):g=e[0];const x=ye(g);if(c.isPending){let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(A,{children:t.jsx(Y,{label:"Preparing commerce onboarding..."})}),e[1]=n):n=e[1],n}if(c.error){let n;return e[2]!==c?(n=t.jsx(re,{title:"We could not load your organizations",description:"Retry to continue commerce setup from this page.",actionLabel:"Retry",onRetry:()=>c.refetch()}),e[2]=c,e[3]=n):n=e[3],n}const _=i?p.find(n=>n.slug===i):null;if(_){let n;return e[4]!==_||e[5]!==s?(n=t.jsx(ne,{org:_,initialSiteUrl:s}),e[4]=_,e[5]=s,e[6]=n):n=e[6],n}if(i){let n;return e[7]!==c?(n=t.jsx(re,{title:"Organization not found",description:"We could not find that organization for your account.",actionLabel:"Retry",onRetry:()=>c.refetch()}),e[7]=c,e[8]=n):n=e[8],n}if(r){let n;return e[9]!==r||e[10]!==s?(n=t.jsx(ne,{org:r,initialSiteUrl:s}),e[9]=r,e[10]=s,e[11]=n):n=e[11],n}if(p.length===1&&p[0]){let n;return e[12]!==p[0]||e[13]!==s?(n=t.jsx(ne,{org:p[0],initialSiteUrl:s}),e[12]=p[0],e[13]=s,e[14]=n):n=e[14],n}if(p.length>1){let n;e[15]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(U,{title:"Choose an organization",description:"Select where commerce diagnostics should continue."}),e[15]=n):n=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=v=>l(v),e[16]=h):h=e[16];let C;return e[17]!==p?(C=t.jsx(A,{children:t.jsxs("div",{className:"grid gap-10",children:[n,t.jsx("div",{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(xe,{organizations:p,selectLabel:"Continue",onSelected:h})})]})}),e[17]=p,e[18]=C):C=e[18],C}if(!m){let n;e[19]!==x?(n=()=>{x.reset(),x.mutate()},e[19]=x,e[20]=n):n=e[20];let h;return e[21]!==x||e[22]!==n?(h=t.jsx(qe,{mutation:x,onRetry:n}),e[21]=x,e[22]=n,e[23]=h):h=e[23],h}const d=m;if(d?.success&&(d.status==="created"||d.status==="joined"||d.status==="already_has_organization")&&d.organization){let n;return e[24]!==d.organization||e[25]!==s?(n=t.jsx(ne,{org:d.organization,initialSiteUrl:s}),e[24]=d.organization,e[25]=s,e[26]=n):n=e[26],n}if(d?.status==="ambiguous"&&d.organizations&&d.organizations.length>0){let n;e[27]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(U,{title:"Choose an organization",description:"Your email can access more than one organization. Choose where commerce setup should continue."}),e[27]=n):n=e[27];const h=d.domain??void 0;let C;e[28]!==a||e[29]!==s?(C=($,N)=>{be(),l({...$,slug:N}),a({to:"/commerce-onboarding",search:{org:N,siteUrl:s}})},e[28]=a,e[29]=s,e[30]=C):C=e[30];let v;return e[31]!==d.organizations||e[32]!==h||e[33]!==C?(v=t.jsx(A,{children:t.jsxs("div",{className:"grid gap-10",children:[n,t.jsx("div",{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:t.jsx(xe,{organizations:d.organizations,domain:h,onJoined:C})})]})}),e[31]=d.organizations,e[32]=h,e[33]=C,e[34]=v):v=e[34],v}const y=d?.error??"We could not determine a commerce organization for this account.";let E;e[35]!==x?(E=()=>{f(null),x.reset()},e[35]=x,e[36]=E):E=e[36];let w;return e[37]!==y||e[38]!==E?(w=t.jsx(re,{title:"Commerce onboarding needs support",description:y,actionLabel:"Try again",onRetry:E}),e[37]=y,e[38]=E,e[39]=w):w=e[39],w}async function We(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&be(),e}function Fe(o){return{id:o.id,name:o.name,slug:o.slug,logo:o.logo??null}}function qe(o){const e=O.c(7),{mutation:i,onRetry:s}=o,a=L.useRef(!1);let c;e[0]!==i?(c=f=>{!f||a.current||(a.current=!0,i.mutate())},e[0]=i,e[1]=c):c=e[1];const r=c;if(i.error){let f;return e[2]!==s?(f=t.jsx(re,{title:"Commerce onboarding is unavailable",description:"We could not prepare an organization for commerce setup. Retry from this page or contact support.",actionLabel:"Retry",onRetry:s}),e[2]=s,e[3]=f):f=e[3],f}let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Y,{label:"Preparing your commerce workspace..."}),e[4]=l):l=e[4];let m;return e[5]!==r?(m=t.jsx(A,{children:t.jsx("div",{ref:r,children:l})}),e[5]=r,e[6]=m):m=e[6],m}function U(o){const e=O.c(9),{title:i,description:s}=o;let a,c;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),c=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"}),e[0]=a,e[1]=c):(a=e[0],c=e[1]);let r;e[2]!==i?(r=t.jsx("h1",{className:"text-2xl font-medium leading-8",children:i}),e[2]=i,e[3]=r):r=e[3];let l;e[4]!==s?(l=t.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s}),e[4]=s,e[5]=l):l=e[5];let m;return e[6]!==r||e[7]!==l?(m=t.jsxs("div",{className:"grid gap-10",children:[a,c,t.jsxs("div",{className:"space-y-2",children:[r,l]})]}),e[6]=r,e[7]=l,e[8]=m):m=e[8],m}function Y(o){const e=O.c(3),{label:i}=o;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Ce,{size:14,className:"animate-spin text-muted-foreground"}),e[0]=s):s=e[0];let a;return e[1]!==i?(a=t.jsxs("div",{className:"flex items-center gap-2 py-4",role:"status","aria-live":"polite",children:[s,t.jsx("span",{className:"text-sm text-muted-foreground",children:i})]}),e[1]=i,e[2]=a):a=e[2],a}function re(o){const e=O.c(9),{title:i,description:s,actionLabel:a,onRetry:c}=o;let r;e[0]!==s||e[1]!==i?(r=t.jsx(U,{title:i,description:s}),e[0]=s,e[1]=i,e[2]=r):r=e[2];let l;e[3]!==a||e[4]!==c?(l=t.jsx(le,{type:"button",size:"xl",className:"w-full",onClick:c,children:a}),e[3]=a,e[4]=c,e[5]=l):l=e[5];let m;return e[6]!==r||e[7]!==l?(m=t.jsx(A,{children:t.jsxs("div",{className:"grid gap-10",children:[r,l]})}),e[6]=r,e[7]=l,e[8]=m):m=e[8],m}function Ve(o){return o.content?.find(e=>e.text)?.text??"Commerce Discovery setup failed."}function fe(o){const e=o;if(e.isError)throw new Error(Ve(e));return e.structuredContent??o}function ne(o){const e=O.c(5),{org:i,initialSiteUrl:s}=o;let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Y,{label:"Connecting workspace..."}),e[0]=a):a=e[0];const c=`${i.id}:${s??""}`;let r;return e[1]!==s||e[2]!==i||e[3]!==c?(r=t.jsx(A,{children:t.jsx(L.Suspense,{fallback:a,children:t.jsx(Ye,{org:i,initialSiteUrl:s},c)})}),e[1]=s,e[2]=i,e[3]=c,e[4]=r):r=e[4],r}function Ye(o){const e=O.c(100),{org:i,initialSiteUrl:s}=o,a=Se();let c;e[0]!==i.id||e[1]!==i.slug?(c={connectionId:we,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=c):c=e[2];const r=Ie(c),[l,m]=L.useState(s??""),[f,p]=L.useState(null),[g,x]=L.useState(null),_=L.useRef(!1),d=Pe.COMMERCE_DISCOVERY(i.id),y=Ue(i.id),E=pe.commerceDiscoveryConnection(i.id,d);let w;e[3]!==d||e[4]!==r?(w=async()=>{const u=await r.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:d}});return fe(u)},e[3]=d,e[4]=r,e[5]=w):w=e[5];let n;e[6]!==E||e[7]!==w?(n={queryKey:E,queryFn:w,retry:!1},e[6]=E,e[7]=w,e[8]=n):n=e[8];const h=he(n),C=pe.commerceDiscoveryVirtualMcp(i.id,y);let v;e[9]!==r||e[10]!==y?(v=async()=>{const u=await r.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:y}});return fe(u)},e[9]=r,e[10]=y,e[11]=v):v=e[11];let $;e[12]!==C||e[13]!==v?($={queryKey:C,queryFn:v,retry:!1},e[12]=C,e[13]=v,e[14]=$):$=e[14];const N=he($);let M;e[15]!==r?(M=async u=>{const j=await r.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:u}});return fe(j)},e[15]=r,e[16]=M):M=e[16];let k;e[17]!==h||e[18]!==N?(k=u=>{p(u),x(null),h.refetch(),N.refetch()},e[17]=h,e[18]=N,e[19]=k):k=e[19];let K;e[20]===Symbol.for("react.memo_cache_sentinel")?(K=u=>{x(u instanceof Error?u.message:"Commerce Discovery setup failed.")},e[20]=K):K=e[20];let Q;e[21]!==M||e[22]!==k?(Q={mutationFn:M,retry:!1,onSuccess:k,onError:K},e[21]=M,e[22]=k,e[23]=Q):Q=e[23];const z=ye(Q),B=h.isPending||N.isPending,ae=h.error??N.error,Z=!!h.data?.item&&!!N.data?.item;let G;e[24]!==z?(G=u=>{const j=je(u);if(!j.ok){x(j.error);return}x(null),z.mutate(j.value)},e[24]=z,e[25]=G):G=e[25];const D=G;let J;e[26]!==s||e[27]!==D||e[28]!==B||e[29]!==Z?(J=u=>{!u||_.current||B||Z||!s||(_.current=!0,D(s))},e[26]=s,e[27]=D,e[28]=B,e[29]=Z,e[30]=J):J=e[30];const ce=J;let X;e[31]!==D||e[32]!==l?(X=u=>{u.preventDefault(),D(l)},e[31]=D,e[32]=l,e[33]=X):X=e[33];const I=X;let ee;e[34]!==d||e[35]!==f?.reportApp||e[36]!==y?(ee=f?.reportApp??{connectionId:d,virtualMcpId:y,toolName:Le},e[34]=d,e[35]=f?.reportApp,e[36]=y,e[37]=ee):ee=e[37];const T=ee;let te;e[38]!==a||e[39]!==i.slug||e[40]!==T.connectionId||e[41]!==T.toolName||e[42]!==T.virtualMcpId?(te=()=>{localStorage.setItem(Ne.sidebarOpen(),JSON.stringify(!1)),a({to:"/$org/$taskId",params:{org:i.slug,taskId:crypto.randomUUID()},search:{virtualmcpid:T.virtualMcpId,main:Te(T.connectionId,T.toolName),chat:0}})},e[38]=a,e[39]=i.slug,e[40]=T.connectionId,e[41]=T.toolName,e[42]=T.virtualMcpId,e[43]=te):te=e[43];const me=te;if(B){const u=`Commerce setup will continue for ${i.name}.`;let j;e[44]!==u?(j=t.jsx(U,{title:"Commerce diagnostics",description:u}),e[44]=u,e[45]=j):j=e[45];let b;e[46]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Y,{label:"Checking Commerce Discovery setup..."}),e[46]=b):b=e[46];let S;return e[47]!==j?(S=t.jsxs("div",{className:"grid gap-10",children:[j,b]}),e[47]=j,e[48]=S):S=e[48],S}if(ae){const u=ae instanceof Error?ae.message:"We could not check Commerce Discovery setup.",j=`Commerce setup will continue for ${i.name}.`;let b;e[49]!==j?(b=t.jsx(U,{title:"Commerce diagnostics",description:j}),e[49]=j,e[50]=b):b=e[50];let S;e[51]!==u?(S=t.jsx(oe,{message:u}),e[51]=u,e[52]=S):S=e[52];let R;e[53]!==h||e[54]!==N?(R=t.jsx(le,{type:"button",size:"xl",className:"w-full",onClick:()=>{h.refetch(),N.refetch()},children:"Retry"}),e[53]=h,e[54]=N,e[55]=R):R=e[55];let P;return e[56]!==b||e[57]!==S||e[58]!==R?(P=t.jsxs("div",{className:"grid gap-10",children:[b,S,R]}),e[56]=b,e[57]=S,e[58]=R,e[59]=P):P=e[59],P}if(Z){let u;return e[60]!==me||e[61]!==i||e[62]!==T?(u=t.jsx(Ke,{org:i,reportApp:T,onOpenReport:me}),e[60]=me,e[61]=i,e[62]=T,e[63]=u):u=e[63],u}if(s){let u;e[64]!==s?(u=je(s),e[64]=s,e[65]=u):u=e[65];const j=u;if(!j.ok){const de=`Commerce setup will continue for ${i.name}.`;let F;e[66]!==de?(F=t.jsx(U,{title:"Commerce diagnostics",description:de}),e[66]=de,e[67]=F):F=e[67];let q;e[68]!==j.error?(q=t.jsx(oe,{message:j.error}),e[68]=j.error,e[69]=q):q=e[69];let V;e[70]!==I||e[71]!==g||e[72]!==z.isPending||e[73]!==l?(V=t.jsx(ge,{siteUrl:l,error:g,isSubmitting:z.isPending,onSiteUrlChange:m,onSubmit:I}),e[70]=I,e[71]=g,e[72]=z.isPending,e[73]=l,e[74]=V):V=e[74];let ie;return e[75]!==F||e[76]!==q||e[77]!==V?(ie=t.jsxs("div",{className:"grid gap-10",children:[F,q,V]}),e[75]=F,e[76]=q,e[77]=V,e[78]=ie):ie=e[78],ie}const b=`Commerce Discovery is being prepared for ${j.value}.`;let S;e[79]!==b?(S=t.jsx(U,{title:"Commerce diagnostics",description:b}),e[79]=b,e[80]=S):S=e[80];let R;e[81]!==I||e[82]!==g||e[83]!==z||e[84]!==l?(R=g?t.jsxs(t.Fragment,{children:[t.jsx(oe,{message:g}),t.jsx(ge,{siteUrl:l,error:null,isSubmitting:z.isPending,onSiteUrlChange:m,onSubmit:I})]}):t.jsx(Y,{label:"Setting up Commerce Discovery..."}),e[81]=I,e[82]=g,e[83]=z,e[84]=l,e[85]=R):R=e[85];let P;return e[86]!==S||e[87]!==R||e[88]!==ce?(P=t.jsxs("div",{ref:ce,className:"grid gap-10",children:[S,R]}),e[86]=S,e[87]=R,e[88]=ce,e[89]=P):P=e[89],P}const ue=`Commerce setup will continue for ${i.name}.`;let H;e[90]!==ue?(H=t.jsx(U,{title:"Commerce diagnostics",description:ue}),e[90]=ue,e[91]=H):H=e[91];let W;e[92]!==I||e[93]!==g||e[94]!==z.isPending||e[95]!==l?(W=t.jsx(ge,{siteUrl:l,error:g,isSubmitting:z.isPending,onSiteUrlChange:m,onSubmit:I}),e[92]=I,e[93]=g,e[94]=z.isPending,e[95]=l,e[96]=W):W=e[96];let se;return e[97]!==H||e[98]!==W?(se=t.jsxs("div",{className:"grid gap-10",children:[H,W]}),e[97]=H,e[98]=W,e[99]=se):se=e[99],se}function ge(o){const e=O.c(22),{siteUrl:i,error:s,isSubmitting:a,onSiteUrlChange:c,onSubmit:r}=o;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:"Website URL"}),e[0]=l):l=e[0];let m;e[1]!==c?(m=E=>c(E.target.value),e[1]=c,e[2]=m):m=e[2];const f=!!s;let p;e[3]!==a||e[4]!==i||e[5]!==m||e[6]!==f?(p=t.jsx(Oe,{id:"commerce-site-url",type:"text",inputMode:"url",value:i,onChange:m,placeholder:"https://example.com","aria-invalid":f,disabled:a}),e[3]=a,e[4]=i,e[5]=m,e[6]=f,e[7]=p):p=e[7];let g;e[8]!==s?(g=s?t.jsx(oe,{message:s}):null,e[8]=s,e[9]=g):g=e[9];let x;e[10]!==p||e[11]!==g?(x=t.jsxs("div",{className:"grid gap-2",children:[l,p,g]}),e[10]=p,e[11]=g,e[12]=x):x=e[12];let _;e[13]!==a?(_=a?t.jsxs(t.Fragment,{children:[t.jsx(Ce,{size:14,className:"animate-spin"}),"Setting up"]}):t.jsxs(t.Fragment,{children:["Continue",t.jsx(_e,{size:16})]}),e[13]=a,e[14]=_):_=e[14];let d;e[15]!==a||e[16]!==_?(d=t.jsx(le,{type:"submit",size:"xl",className:"w-full",disabled:a,children:_}),e[15]=a,e[16]=_,e[17]=d):d=e[17];let y;return e[18]!==r||e[19]!==x||e[20]!==d?(y=t.jsxs("form",{className:"grid gap-4",onSubmit:r,children:[x,d]}),e[18]=r,e[19]=x,e[20]=d,e[21]=y):y=e[21],y}function Ke(o){const e=O.c(10),{org:i,reportApp:s,onOpenReport:a}=o,c=`Commerce Discovery is connected for ${i.name}.`;let r;e[0]!==c?(r=t.jsx(U,{title:"Commerce Discovery",description:c}),e[0]=c,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("div",{className:"grid gap-3",children:t.jsxs("div",{className:"rounded-xl card-shadow bg-background dark:bg-input/30 p-4",children:[t.jsx("p",{className:"text-sm font-medium",children:"Companion MCPs"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground leading-5",children:"Commerce Discovery requires platform integrations such as VTEX. These companion MCP requirements will be available soon."})]})}),e[2]=l):l=e[2];const m=!s.virtualMcpId;let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(_e,{size:16}),e[3]=f):f=e[3];let p;e[4]!==a||e[5]!==m?(p=t.jsxs(le,{type:"button",size:"xl",className:"w-full",onClick:a,disabled:m,children:["See full report",f]}),e[4]=a,e[5]=m,e[6]=p):p=e[6];let g;return e[7]!==r||e[8]!==p?(g=t.jsxs("div",{className:"grid gap-10",children:[r,l,p]}),e[7]=r,e[8]=p,e[9]=g):g=e[9],g}function oe(o){const e=O.c(2),{message:i}=o;let s;return e[0]!==i?(s=t.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:i}),e[0]=i,e[1]=s):s=e[1],s}export{lt as default};
@@ -1 +0,0 @@
1
- import{x as fe,aD as Ie,b5 as Ae,y as le,aB as De,c as P,j as t,i as ge,B as E,r as q,l as je,s as J,a5 as $e,K as ne,b as Y,a9 as ce,o as Pe,b6 as Oe,a2 as ze,e as Me,b7 as Ve,I as Ee,C as Ue,z as Fe,t as G,b8 as Re}from"./index-BiSv4wgs.js";import{g as Le}from"./extract-connection-data-Cmd1hHZE.js";import{E as ve}from"./empty-state-yOW3dSH7.js";import{E as Be,c as He,r as We,b as Xe,d as Ge}from"./connection-form-helpers-QpFovVZo.js";import{c as qe,S as Ke,V as Qe}from"./index-BdFUyuzp.js";import{u as be,T as Je}from"./index-Cyq8kOmo.js";import{u as Ye}from"./use-members-K1wagpAk.js";import{A as Ze}from"./avatar-BS-jv_DR.js";import{a as Ne,b as ye,u as et}from"./use-connection-CYq4sTpp.js";import{u as _e}from"./use-mcp-client-BcfXwx2l.js";import{a as tt}from"./use-mcp-tools-DhZgsJaJ.js";import{a as st}from"./use-mcp-prompts-h_GWEUu_.js";import{i as nt,a as ot}from"./mcp-oauth-D0PDq8qp.js";import{I as oe}from"./integration-icon-DDugmSqH.js";import{s as it}from"./Plus-DOSjIlBe.js";import{z as at,C as rt,a8 as lt,Z as ct}from"./agent-icon-s6bX_I9L.js";import{a as Ce,s as dt}from"./Settings02-C0s-saqA.js";import{s as ae}from"./Trash01-jgpaQcTh.js";import{d as mt,c as ut,b as xt,S as pt,a as ht}from"./sheet-DcscOrN-.js";import{F as L,b as B,c as H,d as V,f as W,e as ft,a as gt}from"./form-CaHcodeJ.js";import{I as X}from"./input-Ta_Y1lvO.js";import{u as jt,D as vt}from"./use-delete-connection-BP0n__7X.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-CH_Ju-wa.js";import{u as kt}from"./studio-tools-B6e1wIqk.js";import{u as Tt}from"./use-virtual-mcp-B9JwuB8w.js";import{i as Se}from"./ChevronRight-CUrrZIqG.js";import{a as we}from"./Users03-BtWBA-oP.js";import{T as ee,a as It,b as te,c as At}from"./tabs-DfpltS-P.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as Dt}from"./ZapSquare-C3NGLDu-.js";import{b as $t}from"./Tool01-CHEQOI-w.js";import{g as re,M as Pt}from"./types-DmsJ1dgA.js";import{C as Ot}from"./collection-search-DYVCc599.js";import{C as zt}from"./card-BIfVO_jW.js";import{B as Mt}from"./badge-BcU0uhl8.js";import{D as Vt,a as Et,b as Ut,c as de}from"./dropdown-menu-CiC9tTdb.js";import{d as me,b as ue,c as xe,S as pe,a as R}from"./select-D9WchHFw.js";import{i as Ft}from"./CheckCircle-Bf3Z61R3.js";import{t as Rt}from"./ChevronDown-DbkPHjH7.js";import{n as Lt}from"./XCircle-BODgW7sH.js";import{s as se}from"./Star01-1ZF9aI5Y.js";import{s as Bt}from"./XClose-qC8Lq_ms.js";import"./index-D-jSeUPY.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./tooltip-BIAup3vg.js";import"./ZoomOut-CjZnoT-b.js";import"./Key01-CAY-Xxyp.js";import"./auth-BX6flE6a.js";import"./use-registry-connections-CQIqYcvJ.js";import"./use-organization-settings-CbMA9tyx.js";import"./index-CQF6lVUo.js";import"./index-DLBSEic_.js";import"./popover-BlGotCa-.js";import"./ChevronUp-BT7nyl6k.js";import"./SearchMd-q-mL98uP.js";import"./use-create-virtual-mcp-BbTDDIhz.js";import"./use-navigate-to-agent-GOxU3Hpn.js";import"./Eye-D3915Vo9.js";import"./use-org-auth-client-CMUSTibk.js";import"./User01-CQqeHCY8.js";import"./use-collections-DYVhZ6LZ.js";import"./AlertCircle-BYmwGQCf.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ChevronLeft-7WikNK_I.js";import"./DotsVertical-BpkGXLrP.js";import"./Stars02-DMdFpBOz.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Upload01-DmPHnKxK.js";import"./Users01-3CAb_L9A.js";import"./X-BTPYHIvY.js";import"./Zap-CVq2f6J2.js";import"./label-C8gqICzJ.js";import"./alert-dialog-D2GL5qBd.js";const Ht=fe({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:fe({}),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 f;e[2]!==d?(f=je("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",d),e[2]=d,e[3]=f):f=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 h;e[36]!==I||e[37]!==C||e[38]!==N||e[39]!==T?(h=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]=h):h=e[40];let w;return e[41]!==h||e[42]!==f||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:f,children:[g,j,h]}),e[41]=h,e[42]=f,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 f;e[8]!==x||e[9]!==d?(f=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]=f):f=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]!==f||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[f,v]}),e[24]=f,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,f]=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(h=>h.name.toLowerCase().includes(y)||h.description&&h.description.toLowerCase().includes(y)):S;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.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=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=C):C=e[21],e[22]!==d?(j=t.jsx(Ot,{value:d,onChange:f,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(h=>{const w=re(h._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Pt,{resourceURI:w,toolInfo:{tool:h},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:h.name}),t.jsx(Je,{annotations:h.annotations,_meta:h._meta})]}),h.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:h.description})]})]},h.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 f;e[4]!==d||e[5]!==o?(f=d?ke(d):o,e[4]=d,e[5]=o,e[6]=f):f=e[6];const g=f;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 h;e[29]!==C?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:C})}),e[29]=C,e[30]=h):h=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]!==h||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,h,w,O,M]})}),e[44]=k,e[45]=h,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:f})=>t.jsx(B,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(X,{placeholder:"https://example.com/mcp",...f,value:f.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(ft,{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 hs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function fs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(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=hs(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=fs(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}})}}),[f,g]=q.useState(null),[v,b]=q.useState(!1),j=be({connectionId:e}),{data:N}=Ye(),T=N?.data?.members??[],S=f??s,y=T.find(m=>m.userId===S.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},C=qe(k,Wt),h=Ue({resolver:Fe(He),values:he(f??s)}),w=h.formState.isDirty,z=async()=>{if(!await h.trigger())return;const D=h.getValues(),$=gs(D),F=f?.id??e;await x.update.mutateAsync({id:F,data:$}),h.reset(D)},O=()=>{h.reset(he(f??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:f!==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:f?.title??s.title}),t.jsx(ht,{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,{...h,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:h.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:h.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:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:M,onRemoveOAuth:U}),t.jsx(Ke,{connection:f??s,form:h,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=f??s;g(null),d.requestDelete(m)},children:[t.jsx(ae,{size:15}),"Delete"]})]})]},f?.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 f;s[4]!==i.id||s[5]!==i.slug||s[6]!==d?(f={connectionId:d,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=d,s[7]=f):f=s[7];const g=_e(f);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 h;s[23]!==I?.resources?(h=I?.resources??[],s[23]=I?.resources,s[24]=h):h=s[24];let w;s[25]!==h?(w=h.map(bs),s[25]=h,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 ao(){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{ao as default};
@@ -1 +0,0 @@
1
- import{r as E,c as ie,j as t,a2 as tt,i as le,s as ke,b as De,u as nt,a as Ae,o as st,q as ot,L as it,C as rt,z as at,B as U,p as ne,I as ct,l as de,t as X,K as lt}from"./index-BiSv4wgs.js";import{g as dt,a as we,b as ut,e as mt}from"./extract-connection-data-Cmd1hHZE.js";import{C as pt}from"./collection-display-button-BP4c4hrD.js";import{S as ht}from"./search-input-CHOe8stk.js";import{C as gt}from"./collection-tabs-C0YJH8OQ.js";import{u as xt,a as Te,g as ft,C as ve}from"./connection-card-C3_U3j25.js";import{E as jt}from"./empty-state-yOW3dSH7.js";import{I as yt}from"./integration-icon-DDugmSqH.js";import{P as pe}from"./index-D-jSeUPY.js";import{u as Ct,D as vt}from"./use-delete-connection-BP0n__7X.js";import{u as Ce}from"./use-capability-jAHdTjWn.js";import{u as St}from"./use-infinite-scroll-CsW5GqEa.js";import{u as bt}from"./use-view-mode-DyryORIA.js";import{g as ge}from"./connection-slug-eyAPH6o3.js";import{c as Ie,d as Pe,b as $e,A as Le,e as Oe,g as Fe,a as Me,f as ze}from"./alert-dialog-D2GL5qBd.js";import{C as Ve}from"./checkbox-B76UlBUd.js";import{d as Ee,c as Be,D as Ke,a as Ue,b as Re,e as He}from"./dialog-DGhL6eBy.js";import{D as _t,a as Nt,c as kt,b as Dt,d as At,e as wt,f as Tt}from"./drawer-B9Cs5iI_.js";import{u as It}from"./tooltip-BIAup3vg.js";import{D as We,a as Xe,b as qe,c as ae}from"./dropdown-menu-CiC9tTdb.js";import{F as J,b as Y,c as Z,d as ee,f as te,a as _e}from"./form-CaHcodeJ.js";import{I as re}from"./input-Ta_Y1lvO.js";import{d as Pt,b as $t,c as Lt,S as Ot,a as ce}from"./select-D9WchHFw.js";import{T as Ft}from"./textarea-ji5jId4g.js";import{b as Ge,u as Mt}from"./use-connection-CYq4sTpp.js";import{u as zt}from"./use-virtual-mcp-B9JwuB8w.js";import{i as Vt,a as Et}from"./mcp-oauth-D0PDq8qp.js";import{u as Bt}from"./studio-tools-B6e1wIqk.js";import{Z as Kt,a7 as Ut,C as Rt,z as Ht}from"./agent-icon-s6bX_I9L.js";import{n as xe}from"./XCircle-BODgW7sH.js";import{a as Qe}from"./DotsVertical-BpkGXLrP.js";import{s as Je}from"./Eye-D3915Vo9.js";import{s as ye}from"./Star01-1ZF9aI5Y.js";import{s as Ye}from"./Plus-DOSjIlBe.js";import{s as Ze}from"./Trash01-jgpaQcTh.js";import{s as et}from"./XClose-qC8Lq_ms.js";import{i as he,a as Ne,E as Wt,c as Xt,p as qt,b as Gt,d as Qt}from"./connection-form-helpers-QpFovVZo.js";import"./use-mcp-client-BcfXwx2l.js";import"./auth-BX6flE6a.js";import"./SwitchHorizontal01-BMk8DM55.js";import"./ChevronUp-BT7nyl6k.js";import"./view-mode-toggle-Bt_jVM0U.js";import"./badge-BcU0uhl8.js";import"./SearchMd-q-mL98uP.js";import"./use-registry-connections-CQIqYcvJ.js";import"./use-organization-settings-CbMA9tyx.js";import"./useInfiniteQuery-nR5oOHHR.js";import"./card-BIfVO_jW.js";import"./sidebar-BHU7Y-eK.js";import"./LayoutLeft-CJuGELXN.js";import"./sheet-DcscOrN-.js";import"./X-BTPYHIvY.js";import"./ChevronRight-CUrrZIqG.js";import"./label-C8gqICzJ.js";import"./ChevronDown-DbkPHjH7.js";import"./use-collections-DYVhZ6LZ.js";import"./AlertCircle-BYmwGQCf.js";import"./Tool01-CHEQOI-w.js";import"./Settings02-C0s-saqA.js";import"./ArrowRight-CvF16wpP.js";import"./ArrowUpRight-DpeEXraR.js";import"./ZapSquare-C3NGLDu-.js";import"./Users03-BtWBA-oP.js";import"./CheckCircle-Bf3Z61R3.js";import"./ChevronLeft-7WikNK_I.js";import"./Stars02-DMdFpBOz.js";import"./ZoomOut-CjZnoT-b.js";import"./Globe01-BxZmquSL.js";import"./FilterLines-BDTdg3RE.js";import"./Globe04-CkBzX8xL.js";import"./HardDrive-Cko4CWL8.js";import"./Key01-CAY-Xxyp.js";import"./LinkExternal01-DluIM9mv.js";import"./Monitor01-bbyGUKmR.js";import"./Sun-CVp19c6p.js";import"./Palette-DLCudjOT.js";import"./Play-I5x_JKdj.js";import"./Shield01-DA5SmW0P.js";import"./Stars01-CWQtskKI.js";import"./Upload01-DmPHnKxK.js";import"./User01-CQqeHCY8.js";import"./Users01-3CAb_L9A.js";import"./Zap-CVq2f6J2.js";function Jt(j){const e=`deco-filters-${j}`,[n,p]=E.useState(()=>{try{const o=globalThis.localStorage?.getItem(e);if(o)return JSON.parse(o)}catch(o){console.error("Failed to parse stored filters:",o)}return[]});return[n,o=>{p(o);try{globalThis.localStorage?.setItem(e,JSON.stringify(o))}catch(i){console.error("Failed to save filters:",i)}}]}function Yt(j){const e=ie.c(7),[n,p]=E.useState(j),[a,o]=E.useState(j?"desc":null);let i;e[0]!==a||e[1]!==n?(i=y=>{n!==y?(p(y),o("asc")):a==="asc"?o("desc"):a==="desc"&&(p(void 0),o(null))},e[0]=a,e[1]=n,e[2]=i):i=e[2];const g=i;let h;return e[3]!==g||e[4]!==a||e[5]!==n?(h={sortKey:n,sortDirection:a,handleSort:g},e[3]=g,e[4]=a,e[5]=n,e[6]=h):h=e[6],h}function Zt(j){const e=ie.c(20),{namespace:n,resource:p,defaultSortKey:a,defaultViewMode:o}=j,i=a===void 0?"title":a,g=o===void 0?"table":o,[h,y]=E.useState(""),x=E.useDeferredValue(h),N=`${n}-${p}`,[b,c]=Jt(N),f=`mesh-${p}-filter-visible-${n}`;let u;e[0]!==f?(u=()=>globalThis.localStorage?.getItem(f)==="true",e[0]=f,e[1]=u):u=e[1];const[v,_]=E.useState(u);let k;e[2]!==f?(k=T=>{_(T),globalThis.localStorage?.setItem(f,String(T))},e[2]=f,e[3]=k):k=e[3];const $=k;let O;e[4]!==v||e[5]!==$?(O=()=>{$(!v)},e[4]=v,e[5]=$,e[6]=O):O=e[6];const s=O,[A,F]=bt(`mesh-${p}-${n}`,g),{sortKey:M,sortDirection:w,handleSort:P}=Yt(i),z=M;let C;return e[7]!==v||e[8]!==b||e[9]!==P||e[10]!==h||e[11]!==x||e[12]!==$||e[13]!==c||e[14]!==F||e[15]!==w||e[16]!==z||e[17]!==s||e[18]!==A?(C={search:h,searchTerm:x,setSearch:y,filters:b,setFilters:c,filterBarVisible:v,setFilterBarVisible:$,toggleFilterBar:s,viewMode:A,setViewMode:F,sortKey:z,sortDirection:w,handleSort:P},e[7]=v,e[8]=b,e[9]=P,e[10]=h,e[11]=x,e[12]=$,e[13]=c,e[14]=F,e[15]=w,e[16]=z,e[17]=s,e[18]=A,e[19]=C):C=e[19],C}function en(j){const e=ie.c(51),{group:n,onOpen:p,selectionMode:a,selectedIds:o,onToggleSelect:i}=j;let g;if(e[0]!==n.connections||e[1]!==o){let C;e[3]!==o?(C=T=>o.has(T.id),e[3]=o,e[4]=C):C=e[4],g=n.connections.every(C),e[0]=n.connections,e[1]=o,e[2]=g}else g=e[2];const h=g;let y;if(e[5]!==n.connections||e[6]!==o){let C;e[8]!==o?(C=T=>o.has(T.id),e[8]=o,e[9]=C):C=e[9],y=n.connections.some(C),e[5]=n.connections,e[6]=o,e[7]=y}else y=e[7];const x=y,N=`${n.connections.length} instances`;let b;e[10]!==n.icon||e[11]!==n.title||e[12]!==N?(b={title:n.title,icon:n.icon,description:N},e[10]=n.icon,e[11]=n.title,e[12]=N,e[13]=b):b=e[13];let c;e[14]!==h||e[15]!==n.connections||e[16]!==p||e[17]!==i||e[18]!==o||e[19]!==a?(c=()=>a?(()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)})():p(),e[14]=h,e[15]=n.connections,e[16]=p,e[17]=i,e[18]=o,e[19]=a,e[20]=c):c=e[20];const f=a&&h&&"ring-2 ring-primary",u=a&&x&&!h&&"ring-1 ring-primary/50";let v;e[21]!==f||e[22]!==u?(v=de(f,u),e[21]=f,e[22]=u,e[23]=v):v=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(xe,{}),e[24]=_):_=e[24];let k;e[25]!==h||e[26]!==n.connections||e[27]!==i||e[28]!==o||e[29]!==a||e[30]!==x?(k=a?t.jsx(Ve,{checked:h?!0:x?"indeterminate":!1,onCheckedChange:()=>{for(const C of n.connections)h?o.has(C.id)&&i(C.id):o.has(C.id)||i(C.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=h,e[26]=n.connections,e[27]=i,e[28]=o,e[29]=a,e[30]=x,e[31]=k):k=e[31];const $=a?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let O;e[32]!==$?(O=de("overflow-hidden transition-all duration-150 ease-out",$),e[32]=$,e[33]=O):O=e[33];let s;e[34]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Xe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:nn,children:t.jsx(Qe,{size:20})})}),e[34]=s):s=e[34];let A;e[35]!==p?(A=C=>{C.stopPropagation(),p()},e[35]=p,e[36]=A):A=e[36];let F;e[37]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(Je,{size:16}),e[37]=F):F=e[37];let M;e[38]!==A?(M=t.jsxs(We,{children:[s,t.jsx(qe,{align:"end",onClick:tn,children:t.jsxs(ae,{onClick:A,children:[F,"Open"]})})]}),e[38]=A,e[39]=M):M=e[39];let w;e[40]!==O||e[41]!==M?(w=t.jsx("div",{className:O,children:M}),e[40]=O,e[41]=M,e[42]=w):w=e[42];let P;e[43]!==k||e[44]!==w?(P=t.jsxs("div",{className:"flex items-center gap-1",children:[k,w]}),e[43]=k,e[44]=w,e[45]=P):P=e[45];let z;return e[46]!==P||e[47]!==b||e[48]!==c||e[49]!==v?(z=t.jsx(t.Fragment,{children:t.jsx(ve,{connection:b,onClick:c,className:v,fallbackIcon:_,headerActionsAlwaysVisible:!0,headerActions:P})}),e[46]=P,e[47]=b,e[48]=c,e[49]=v,e[50]=z):z=e[50],z}function tn(j){return j.stopPropagation()}function nn(j){return j.stopPropagation()}function sn(j){const e=ie.c(23),{count:n,total:p,canManage:a,canManageAgents:o,onSelectAll:i,onDeselectAll:g,onDelete:h,onAddToAgent:y,onToggleStatus:x,onCancel:N}=j;if(n===0)return null;let b;e[0]!==n?(b=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=b):b=e[1];let c;e[2]!==n||e[3]!==g||e[4]!==i||e[5]!==p?(c=n<p?t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:i,children:["Select all (",p,")"]}):t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:g,children:"Clear selection"}),e[2]=n,e[3]=g,e[4]=i,e[5]=p,e[6]=c):c=e[6];let f;e[7]!==o||e[8]!==y?(f=o&&t.jsxs(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:y,children:[t.jsx(Ye,{size:13}),"Add to Agent"]}),e[7]=o,e[8]=y,e[9]=f):f=e[9];let u;e[10]!==a||e[11]!==h||e[12]!==x?(u=a&&t.jsxs(t.Fragment,{children:[t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>x("active"),children:"Enable"}),t.jsx(U,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>x("inactive"),children:"Disable"}),t.jsxs(U,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:[t.jsx(Ze,{size:13}),"Delete"]})]}),e[10]=a,e[11]=h,e[12]=x,e[13]=u):u=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(et,{size:13}),e[14]=v):v=e[14];let _;e[15]!==N?(_=t.jsx(U,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:N,children:v}),e[15]=N,e[16]=_):_=e[16];let k;return e[17]!==b||e[18]!==c||e[19]!==f||e[20]!==u||e[21]!==_?(k=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[b,c,f,u,_]})}),e[17]=b,e[18]=c,e[19]=f,e[20]=u,e[21]=_,e[22]=k):k=e[22],k}function on(j){const e=ie.c(25),{open:n,onOpenChange:p,agents:a,onConfirm:o}=j,[i,g]=E.useState(null);let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsxs(Ke,{children:[t.jsx(Ue,{children:"Add to Agent"}),t.jsx(Re,{children:"Select an agent to add the selected connections to."})]}),e[0]=h):h=e[0];let y;e[1]!==a||e[2]!==i?(y=a.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):a.map(k=>t.jsxs("button",{type:"button",onClick:()=>g(k.id),className:de("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",i===k.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(yt,{icon:k.icon,name:k.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.title}),k.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.description})]})]},k.id)),e[1]=a,e[2]=i,e[3]=y):y=e[3];let x;e[4]!==y?(x=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:y}),e[4]=y,e[5]=x):x=e[5];let N;e[6]!==p?(N=t.jsx(U,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e[6]=p,e[7]=N):N=e[7];const b=!i;let c;e[8]!==o||e[9]!==p||e[10]!==i?(c=()=>{i&&(o(i),p(!1),g(null))},e[8]=o,e[9]=p,e[10]=i,e[11]=c):c=e[11];let f;e[12]!==b||e[13]!==c?(f=t.jsx(U,{disabled:b,onClick:c,children:"Add"}),e[12]=b,e[13]=c,e[14]=f):f=e[14];let u;e[15]!==N||e[16]!==f?(u=t.jsxs(He,{children:[N,f]}),e[15]=N,e[16]=f,e[17]=u):u=e[17];let v;e[18]!==x||e[19]!==u?(v=t.jsxs(Be,{className:"sm:max-w-[400px]",children:[h,x,u]}),e[18]=x,e[19]=u,e[20]=v):v=e[20];let _;return e[21]!==p||e[22]!==n||e[23]!==v?(_=t.jsx(Ee,{open:n,onOpenChange:p,children:v}),e[21]=p,e[22]=n,e[23]=v,e[24]=_):_=e[24],_}function rn(j){const e=ie.c(20),{open:n,onOpenChange:p,count:a,onConfirm:o}=j,i=a!==1?"s":"";let g;e[0]!==a||e[1]!==i?(g=t.jsxs(Ie,{children:["Delete ",a," connection",i,"?"]}),e[0]=a,e[1]=i,e[2]=g):g=e[2];const h=a!==1?"s":"";let y;e[3]!==h?(y=t.jsxs(Pe,{children:["This will permanently delete the selected connection",h,". This action cannot be undone."]}),e[3]=h,e[4]=y):y=e[4];let x;e[5]!==g||e[6]!==y?(x=t.jsxs($e,{children:[g,y]}),e[5]=g,e[6]=y,e[7]=x):x=e[7];let N;e[8]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(Le,{children:"Cancel"}),e[8]=N):N=e[8];const b=a!==1?"s":"";let c;e[9]!==a||e[10]!==o||e[11]!==b?(c=t.jsxs(Oe,{children:[N,t.jsxs(Fe,{onClick:o,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",a," connection",b]})]}),e[9]=a,e[10]=o,e[11]=b,e[12]=c):c=e[12];let f;e[13]!==x||e[14]!==c?(f=t.jsxs(Me,{children:[x,c]}),e[13]=x,e[14]=c,e[15]=f):f=e[15];let u;return e[16]!==p||e[17]!==n||e[18]!==f?(u=t.jsx(ze,{open:n,onOpenChange:p,children:f}),e[16]=p,e[17]=n,e[18]=f,e[19]=u):u=e[19],u}function an(j){return j._registryId?.includes("community-registry")===!0}function cn(j){const e=ie.c(58),{item:n,canManage:p,allConnections:a,connectedAppNames:o,connectingItemId:i,onNavigateConnected:g,onConnect:h}=j,[y,x]=E.useState(!1),[N,b]=E.useState(null);let c,f;e[0]!==o||e[1]!==n?(c=we(n)??"",f=o.has(c),e[0]=o,e[1]=n,e[2]=c,e[3]=f):(c=e[2],f=e[3]);const u=f,v=n._meta?.["mcp.mesh"],_=v?.friendlyName||v?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",k=n.server?.description||n.description||null;let $;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?($=n.server?.icons?.[0]?.src||ut(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=$):$=e[6];const O=$;let s;if(e[7]!==a||e[8]!==c){let D;e[10]!==c?(D=se=>se.connection_type!=="VIRTUAL"&&se.app_name===c,e[10]=c,e[11]=D):D=e[11],s=a.filter(D),e[7]=a,e[8]=c,e[9]=s}else s=e[9];const A=s;let F;e[12]!==n?(F=an(n),e[12]=n,e[13]=F):F=e[13];const M=F;let w,P;e[14]!==A||e[15]!==p||e[16]!==M||e[17]!==u||e[18]!==n||e[19]!==h||e[20]!==g?(w=()=>{if(u){const D=A[0];D&&g(D);return}p&&P()},P=()=>{M?(b("connect"),x(!0)):h(n)},e[14]=A,e[15]=p,e[16]=M,e[17]=u,e[18]=n,e[19]=h,e[20]=g,e[21]=w,e[22]=P):(w=e[21],P=e[22]);let z;e[23]!==n||e[24]!==h||e[25]!==N?(z=()=>{ne("connections_community_warning_confirmed",{registry_item_id:n.id}),x(!1),N==="connect"&&h(n),b(null)},e[23]=n,e[24]=h,e[25]=N,e[26]=z):z=e[26];const C=z;let T;e[27]!==k||e[28]!==O||e[29]!==_?(T={title:_,description:k,icon:O},e[27]=k,e[28]=O,e[29]=_,e[30]=T):T=e[30];let Q;e[31]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(xe,{}),e[31]=Q):Q=e[31];let H;e[32]!==M||e[33]!==n._sourceIcon?(H=M&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=M,e[33]=n._sourceIcon,e[34]=H):H=e[34];let q;e[35]!==p||e[36]!==i||e[37]!==P||e[38]!==u||e[39]!==n.id?(q=u?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):p&&t.jsx(U,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:i!==null,onClick:D=>{D.stopPropagation(),P()},children:i===n.id?t.jsx(le,{size:14,className:"animate-spin"}):"Connect"}),e[35]=p,e[36]=i,e[37]=P,e[38]=u,e[39]=n.id,e[40]=q):q=e[40];let l;e[41]!==H||e[42]!==q?(l=t.jsxs("div",{className:"flex items-center gap-2",children:[H,q]}),e[41]=H,e[42]=q,e[43]=l):l=e[43];let S;e[44]!==w||e[45]!==l||e[46]!==T?(S=t.jsx(ve,{connection:T,fallbackIcon:Q,onClick:w,headerActionsAlwaysVisible:!0,headerActions:l}),e[44]=w,e[45]=l,e[46]=T,e[47]=S):S=e[47];let V;e[48]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs($e,{children:[t.jsx(Ie,{children:"Community MCP Server"}),t.jsx(Pe,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=V):V=e[48];let R;e[49]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx(Le,{children:"Cancel"}),e[49]=R):R=e[49];let B;e[50]!==C?(B=t.jsxs(Me,{children:[V,t.jsxs(Oe,{children:[R,t.jsx(Fe,{onClick:C,children:"Continue"})]})]}),e[50]=C,e[51]=B):B=e[51];let m;e[52]!==y||e[53]!==B?(m=t.jsx(ze,{open:y,onOpenChange:x,children:B}),e[52]=y,e[53]=B,e[54]=m):m=e[54];let L;return e[55]!==S||e[56]!==m?(L=t.jsxs(t.Fragment,{children:[S,m]}),e[55]=S,e[56]=m,e[57]=L):L=e[57],L}function ln({listState:j,activeTab:e,typeFilter:n,statusFilter:p,registryFilter:a,enabledRegistries:o}){const{org:i}=ke(),g=ct(),h=De(),{data:y}=Ae.useSession(),x=Ge(),N=Mt(j),b=Ct(),{granted:c}=Ce("connections:manage"),{granted:f}=Ce("agents:manage"),[u,v]=E.useState(new Set),_=u.size>0,[k,$]=E.useState(!1),[O,s]=E.useState(!1),[A,F]=E.useState(null),M=zt(),w=N.filter(r=>!(n!=="ALL"&&r.connection_type!==n||p!=="ALL"&&r.status!==p)),P=ft(w),z=r=>{v(d=>{const K=new Set(d);return K.has(r)?K.delete(r):K.add(r),K})},C=()=>{v(new Set)},T=Te(o,j.searchTerm),Q=T.items,H=St(T.loadMore,T.hasMore,T.isLoadingMore),q=new Set(N.filter(r=>r.app_name).map(r=>r.app_name)),l=a==="ALL"||o.some(r=>r.id===a)?a:"ALL",S=j.search.length>0,V=e==="all"||S?Q.filter(r=>{if(l!=="ALL"&&r._registryId!==l)return!1;if(S){const d=we(r);if(d&&q.has(d))return!1}return!0}):[],R=e==="connected"||S?P:[],B=async r=>{if(!(!i||!y?.user?.id)){ne("connection_add_clicked",{action:"connect_new",registry_item_id:r.id,source:"connections_page"}),F(r.id);try{const d=mt(r,i.id,y.user.id,{remoteIndex:0}),K=d.connection_type==="STDIO",I=!!d.connection_url,G=K&&d.connection_headers&&typeof d.connection_headers=="object"&&"command"in d.connection_headers;if(!I&&!G){X.error("This MCP Server cannot be connected: no connection method available"),F(null);return}const{id:W}=await x.create.mutateAsync(d),Se=new URL(`/api/${i.slug}/mcp/${W}`,window.location.origin),be=await Vt({url:Se.href,token:null,orgId:i.id});if(be.supportsOAuth&&!be.isAuthenticated){const{token:me,tokenInfo:oe,error:je}=await Et({connectionId:W,orgSlug:i.slug,scope:"offline_access"});if(je||!me){ne("connection_oauth_failed",{connection_id:W,flow:"connections_page_connect",error:je??"no_token"}),X.error(`Authentication failed: ${je??"no token received"}`);return}else{if(ne("connection_oauth_succeeded",{connection_id:W,flow:"connections_page_connect"}),oe)try{(await fetch(`/api/${i.slug}/connections/${W}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:oe.accessToken,refreshToken:oe.refreshToken,expiresIn:oe.expiresIn,scope:oe.scope,clientId:oe.clientId,clientSecret:oe.clientSecret,tokenEndpoint:oe.tokenEndpoint})})).ok?await x.update.mutateAsync({id:W,data:{}}):await x.update.mutateAsync({id:W,data:{connection_token:me}})}catch{await x.update.mutateAsync({id:W,data:{connection_token:me}})}else await x.update.mutateAsync({id:W,data:{connection_token:me}});await g.invalidateQueries({queryKey:lt.isMCPAuthenticated(Se.href,null)}),X.success("Authentication successful")}}X.success("Connected successfully")}catch(d){X.error(`Failed to connect: ${d instanceof Error?d.message:String(d)}`)}finally{F(null)}}},m=Bt(),L=()=>{g.invalidateQueries({predicate:r=>{const d=r.queryKey;return d[1]===i.id&&d[3]==="collection"&&d[4]==="CONNECTIONS"}})},D=async()=>{$(!1);const r=[...u];ne("connections_bulk_delete",{count:r.length});let d=0;for(const K of r)try{await m.call("COLLECTION_CONNECTIONS_DELETE",{id:K,force:!0}),d++}catch{}L(),X.success(`Deleted ${d} connection${d!==1?"s":""}`),C()},se=async(r,d)=>{try{await x.update.mutateAsync({id:r,data:{status:d}}),L(),X.success(d==="active"?"Connection enabled":"Connection disabled")}catch{X.error("Failed to update connection")}},fe=async r=>{const d=[...u];ne("connections_bulk_status_toggled",{count:d.length,to_status:r});let K=0;for(const I of d)try{await x.update.mutateAsync({id:I,data:{status:r}}),K++}catch{}L(),X.success(`${r==="active"?"Enabled":"Disabled"} ${K} connection${K!==1?"s":""}`),C()},ue=async r=>{const d=M.find(G=>G.id===r);if(!d)return;ne("connections_bulk_add_to_agent",{agent_id:r,count:u.size});const K=new Set(d.connections.map(G=>G.connection_id)),I=[...u].filter(G=>!K.has(G)).map(G=>({connection_id:G,selected_tools:null,selected_resources:null,selected_prompts:null}));if(I.length===0){X.info("All selected connections are already in that agent");return}try{await m.call("COLLECTION_VIRTUAL_MCP_UPDATE",{id:r,data:{connections:[...d.connections,...I]}}),g.invalidateQueries({predicate:G=>{const W=G.queryKey;return W[1]===i.id&&W[3]==="collection"&&W[4]==="VIRTUAL_MCP"}}),X.success(`Added ${I.length} connection${I.length!==1?"s":""} to "${d.title}"`),C()}catch{X.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...b}),t.jsx(rn,{open:k,onOpenChange:$,count:u.size,onConfirm:D}),t.jsx(on,{open:O,onOpenChange:s,agents:M,onConfirm:ue}),T.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(S?V.length===0&&w.length===0:e==="all"?V.length===0:w.length===0)?t.jsx(jt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:j.search?`No Connections match "${j.search}"`:c?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[R.map(r=>{if(r.type==="group")return t.jsx(en,{group:r,onOpen:()=>{h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:r.key}})},selectionMode:_,selectedIds:u,onToggleSelect:z},r.key);const d=r.connection,K=u.has(d.id);return t.jsx(ve,{connection:d,fallbackIcon:t.jsx(xe,{}),onClick:()=>_?z(d.id):h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ge(d)}}),className:de(K&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[_?t.jsx(Ve,{checked:K,onCheckedChange:()=>z(d.id),onClick:I=>I.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:de("overflow-hidden transition-all duration-150 ease-out",_?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(We,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:I=>I.stopPropagation(),children:t.jsx(Qe,{size:20})})}),t.jsxs(qe,{align:"end",onClick:I=>I.stopPropagation(),children:[t.jsxs(ae,{onClick:I=>{I.stopPropagation(),h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ge(d)}})},children:[t.jsx(Je,{size:16}),"Open"]}),(c||f)&&t.jsxs(ae,{onClick:I=>{I.stopPropagation(),z(d.id)},children:[t.jsx(Ut,{size:16}),"Select"]}),c&&(d.status==="active"?t.jsxs(ae,{onClick:I=>{I.stopPropagation(),se(d.id,"inactive")},children:[t.jsx(Rt,{size:16}),"Disable"]}):t.jsxs(ae,{onClick:I=>{I.stopPropagation(),se(d.id,"active")},children:[t.jsx(Ht,{size:16}),"Enable"]})),c&&t.jsxs(ae,{variant:"destructive",onClick:I=>{I.stopPropagation(),b.requestDelete(d)},children:[t.jsx(Ze,{size:16}),"Delete"]})]})]})})]})},d.id)}),V.map(r=>t.jsx(cn,{item:r,canManage:c,allConnections:N,connectedAppNames:q,connectingItemId:A,onNavigateConnected:d=>h({to:"/$org/settings/connections/$appSlug",params:{org:i.slug,appSlug:ge(d)}}),onConnect:B},`catalog-${r._registryId}:${r.id}`)),(e==="all"||S)&&o.length>0&&t.jsx("div",{ref:H,className:"col-span-full h-4"}),(e==="all"||S)&&T.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(le,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(sn,{count:u.size,total:w.length,canManage:c,canManageAgents:f,onSelectAll:()=>{v(new Set(w.map(r=>r.id)))},onDeselectAll:()=>v(new Set),onDelete:()=>$(!0),onAddToAgent:()=>s(!0),onToggleStatus:fe,onCancel:C})]})}function dn(){const{org:j}=ke(),e=De(),n=nt({strict:!1}),{data:p}=Ae.useSession(),{stdioEnabled:a}=st(),o=It(),{granted:i}=Ce("connections:manage"),g=Zt({namespace:j.slug,resource:"connections"}),h=Ge(),[y,x]=ot(it.connectionsTab(j.slug),l=>n.tab==="all"||n.tab==="connected"?n.tab:l??"all"),[N,b]=E.useState("ALL"),[c,f]=E.useState("ALL"),[u,v]=E.useState("ALL"),_=xt(),$=Te(_,g.searchTerm).items,O=g.search!==g.searchTerm,s=rt({resolver:at(Xt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),A=s.watch("ui_type"),F=s.watch("connection_url"),M=s.watch("npx_package"),w=he({uiType:A,connectionUrl:F??"",npxPackage:M??""})??Ne({uiType:A,connectionUrl:F??"",registryItems:$}),P=i&&n.action==="create",z=()=>{ne("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:j.slug},search:{action:"create"}})},C=()=>{e({to:"/$org/settings/connections",params:{org:j.slug},search:{}})},T=async l=>{let S,V=null,R=null,B=null;l.ui_type==="NPX"?(S="STDIO",V="",B=Gt(l.npx_package||"",l.env_vars||[])):l.ui_type==="STDIO"?(S="STDIO",V="",B=Qt(l.stdio_command||"",l.stdio_args||"",l.stdio_cwd,l.env_vars||[])):(S=l.ui_type,V=l.connection_url||"",R=l.connection_token||null);const m=dt("conn");ne("connection_custom_created",{connection_type:S,ui_type:l.ui_type}),await h.create.mutateAsync({id:m,title:l.title,description:l.description||null,connection_type:S,connection_url:V,connection_token:R,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:j.id,icon:l.icon??null,app_name:null,app_id:null,connection_headers:B,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),C(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:ge({app_name:null,connection_url:V,title:l.title,id:m})}})},Q=l=>{l||(P&&C(),s.reset())},H=l=>{const S=l.trim();if(!S)return;const V=!!s.formState.dirtyFields.title,R=!!s.formState.dirtyFields.description,B=!!s.formState.dirtyFields.env_vars,m=D=>{if(D&&(!V&&!s.getValues("title").trim()&&D.title&&s.setValue("title",D.title,{shouldDirty:!1}),!R&&!(s.getValues("description")??"").trim()&&D.description&&s.setValue("description",D.description,{shouldDirty:!1}),!B&&D.envVarKeys?.length)){const se=s.getValues("env_vars")??[],fe=new Set(se.map(r=>r.key)),ue=D.envVarKeys.filter(r=>!fe.has(r));ue.length>0&&s.setValue("env_vars",[...se,...ue.map(r=>({key:r,value:""}))],{shouldDirty:!0})}},L=qt(S);if(L&&a){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",L.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),m(he({uiType:"NPX",npxPackage:L.packageName}));return}if(S.startsWith("http://")||S.startsWith("https://")){const D=A==="HTTP"||A==="SSE"||A==="Websocket"?A:"HTTP";s.setValue("ui_type",D,{shouldDirty:!0}),s.setValue("connection_url",S,{shouldDirty:!0}),m(he({uiType:D,connectionUrl:S})??Ne({uiType:D,connectionUrl:S,registryItems:$}));return}A==="NPX"&&m(he({uiType:"NPX",npxPackage:S}))},q=i?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(U,{variant:"outline",onClick:z,children:[t.jsx(Ye,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(pe,{children:[(()=>{const l="Create Connection",S="Create a custom connection in your organization. Fill in the details below.",V=s.formState.isSubmitting?"Saving...":"Create Connection",R=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(J,{control:s.control,name:"ui_type",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Type *"}),t.jsxs(Pt,{value:m.value,onValueChange:m.onChange,children:[t.jsx(ee,{children:t.jsx($t,{children:t.jsx(Lt,{})})}),t.jsxs(Ot,{children:[t.jsx(ce,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(ce,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(ce,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"Websocket"]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(ce,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(xe,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(ce,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Kt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(te,{})]})}),A==="NPX"&&t.jsx(J,{control:s.control,name:"npx_package",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"NPM Package *"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"@perplexity-ai/mcp-server",...m,value:m.value??"",onPaste:L=>{const D=L.clipboardData.getData("text");D&&(L.preventDefault(),s.setValue("npx_package",D.trim(),{shouldDirty:!0}),H(D))},onBlur:L=>{H(L.target.value),m.onBlur()}})}),t.jsx(te,{})]})}),A==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(J,{control:s.control,name:"stdio_command",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Command *"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"node, bun, python...",...m,value:m.value??""})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"stdio_args",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Arguments"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"arg1 arg2 --flag value",...m,value:m.value??""})}),t.jsx(te,{})]})})]}),t.jsx(J,{control:s.control,name:"stdio_cwd",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Working Directory"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"/path/to/project (optional)",...m,value:m.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(te,{})]})})]}),(A==="NPX"||A==="STDIO")&&t.jsx(J,{control:s.control,name:"env_vars",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Environment Variables"}),t.jsx(ee,{children:t.jsx(Wt,{value:m.value??[],onChange:m.onChange})}),t.jsx(te,{})]})}),A!=="NPX"&&A!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(J,{control:s.control,name:"connection_url",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"URL *"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"https://example.com/mcp",...m,value:m.value??"",onPaste:L=>{const D=L.clipboardData.getData("text");D&&(L.preventDefault(),s.setValue("connection_url",D.trim(),{shouldDirty:!0}),H(D))},onBlur:L=>{H(L.target.value),m.onBlur()}})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"connection_token",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:w?.token?.label??"Token (optional)"}),t.jsx(ee,{children:t.jsx(re,{type:"password",placeholder:w?.token?.placeholder??"Bearer token or API key",...m,value:m.value??""})}),w?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.token.helperText,w.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(te,{})]})})]}),t.jsx(J,{control:s.control,name:"title",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Name *"}),t.jsx(ee,{children:t.jsx(re,{placeholder:"My Connection",...m})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"description",render:({field:m})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Description"}),t.jsx(ee,{children:t.jsx(Ft,{placeholder:"A brief description of this connection",rows:3,...m,value:m.value??""})}),t.jsx(te,{})]})})]}),B=P;return o?t.jsx(_t,{open:B,onOpenChange:Q,children:t.jsxs(Nt,{className:"max-h-[90vh]",children:[t.jsx(kt,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(Dt,{children:l}),t.jsx(At,{className:"mt-1",children:S})]}),t.jsx(wt,{asChild:!0,children:t.jsx(U,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(et,{size:16})})})]})}),t.jsx(_e,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:R}),t.jsx(Tt,{children:t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:V})})]})})]})}):t.jsx(Ee,{open:B,onOpenChange:Q,children:t.jsxs(Be,{className:"sm:max-w-[525px]",children:[t.jsxs(Ke,{children:[t.jsx(Ue,{children:l}),t.jsx(Re,{children:S})]}),t.jsx(_e,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(T),children:[t.jsx("div",{className:"py-4",children:R}),t.jsxs(He,{children:[t.jsx(U,{type:"button",variant:"outline",onClick:()=>Q(!1),children:"Cancel"}),t.jsx(U,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:V})]})]})})]})})})(),t.jsx(pe.Content,{children:t.jsx(pe.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(pe.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ht,{value:g.search,onChange:g.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:l=>{l.key==="Escape"&&(g.setSearch(""),l.target.blur())}}),t.jsx(pt,{sortKey:g.sortKey,sortDirection:g.sortDirection,onSort:g.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:N,onChange:l=>b(l||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:c,onChange:l=>f(l||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:u,onChange:l=>v(l||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(l=>({id:l.id,label:l.id.includes("community-registry")?"Community MCP Registry":l.title}))]}]:[]]})]}),q]}),t.jsx(gt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:y,onTabChange:l=>{const S=l;S!==y&&ne("connections_page_tab_changed",{to_tab:S}),x(S)}}),t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:O?.5:1,transition:O?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:O?"none":"auto"},children:t.jsx(ln,{listState:g,activeTab:y,typeFilter:N,statusFilter:c,registryFilter:u,enabledRegistries:_})})})]})})})]})})}function Bs(){const j=ie.c(1);let e;return j[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tt,{children:t.jsx(E.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(dn,{})})}),j[0]=e):e=j[0],e}export{Bs as default};