decocms 3.3.2 → 3.4.1

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 (268) hide show
  1. package/dist/client/assets/{AlertCircle-f1EMyhcF.js → AlertCircle-Bc3r3AGq.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-DDOS_CqL.js → ArrowUpRight-DfEIENBd.js} +1 -1
  3. package/dist/client/assets/{Check-CtI-OH3k.js → Check--VLhXi5l.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-Dk0E48Vj.js → CheckCircle-7xc6-R3M.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-BL2fNdeZ.js → ChevronDown-66ErjaPf.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-ItYaMHNU.js → ChevronLeft-DyW6EtsM.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-TMlXoq-Z.js → ChevronRight-C87PRbBa.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-O10NbvHe.js → ChevronUp-BuPeXu8C.js} +1 -1
  9. package/dist/client/assets/{Container-B1sUXs1U.js → Container-cZo3l6OX.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-DNPNHBpl.js → DotsVertical-CQgc8nSx.js} +1 -1
  11. package/dist/client/assets/{Eye-DWIY-6KS.js → Eye-DHHjYDbX.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CWRo79Yt.js → FilterLines-CWR_eJ7z.js} +1 -1
  13. package/dist/client/assets/{Globe01-Cjaw-3jR.js → Globe01-B10jCcNH.js} +1 -1
  14. package/dist/client/assets/{HardDrive-Ddx5WtDi.js → HardDrive-7KMC69UH.js} +1 -1
  15. package/dist/client/assets/{Key01-ChvR9ujt.js → Key01-CTKRB2Cd.js} +1 -1
  16. package/dist/client/assets/LayoutLeft-SQH1HcmI.js +1 -0
  17. package/dist/client/assets/{LinkExternal01-Bo28LxVY.js → LinkExternal01-CjT-4hM8.js} +1 -1
  18. package/dist/client/assets/{Monitor01-Cx9Nl0mU.js → Monitor01-svtG00ql.js} +1 -1
  19. package/dist/client/assets/{Palette-DkgVQjRz.js → Palette-CA_16qMN.js} +1 -1
  20. package/dist/client/assets/{Play-VGEgQ-36.js → Play-CrdarOgl.js} +1 -1
  21. package/dist/client/assets/{Plus-DXVOsj8b.js → Plus-C9icoBmX.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-CxP3kNii.js → RefreshCcw01-D1tvoH2_.js} +1 -1
  23. package/dist/client/assets/{SearchMd-B9xeWi0e.js → SearchMd-Di6_vvQ1.js} +1 -1
  24. package/dist/client/assets/{Settings02-DYlioLKt.js → Settings02-BylJiOHK.js} +1 -1
  25. package/dist/client/assets/{Shield01-CLHpjaQL.js → Shield01-CDSs18-B.js} +1 -1
  26. package/dist/client/assets/{Star01-BT882_xb.js → Star01-D1DEXGAi.js} +1 -1
  27. package/dist/client/assets/{Stars01-DDxsFd_C.js → Stars01-UWs0NZ30.js} +1 -1
  28. package/dist/client/assets/{Stars02-lM9wDOP9.js → Stars02-CXAcgX2g.js} +1 -1
  29. package/dist/client/assets/{Sun-CNIfXy2-.js → Sun-CCiXRotp.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-Den03c4j.js → SwitchHorizontal01-BU3C5ze8.js} +1 -1
  31. package/dist/client/assets/{Tool01-D7SzxWeU.js → Tool01-BMk00CcA.js} +1 -1
  32. package/dist/client/assets/{Trash01-C2MDqKmR.js → Trash01-MTKniuxn.js} +1 -1
  33. package/dist/client/assets/{Upload01-BTsf5tML.js → Upload01-DsrMMWgf.js} +1 -1
  34. package/dist/client/assets/{User01-B1vfX-f8.js → User01-DShN8gQ-.js} +1 -1
  35. package/dist/client/assets/{Users01-dpqTHJ7Y.js → Users01-Bvh39Ydu.js} +1 -1
  36. package/dist/client/assets/{Users03-e9b5gRLu.js → Users03--pQkY_Pm.js} +1 -1
  37. package/dist/client/assets/{X-DvNDI9Zw.js → X-D-FyhysP.js} +1 -1
  38. package/dist/client/assets/{XCircle-DBS00WN3.js → XCircle-Pgrh_mFJ.js} +1 -1
  39. package/dist/client/assets/{XClose-BdAeKt9F.js → XClose-CXixB7oH.js} +1 -1
  40. package/dist/client/assets/{Zap-aFVcxgaa.js → Zap-BcF-Iz_3.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-CC0ClMfp.js → ZapSquare-BH297b52.js} +1 -1
  42. package/dist/client/assets/ZoomOut-qupe1GUj.js +1 -0
  43. package/dist/client/assets/{access-gate-B8AAPT1T.js → access-gate-b8qBeVwB.js} +1 -1
  44. package/dist/client/assets/{accordion-BFQ7Yu8X.js → accordion-bX483Ztz.js} +1 -1
  45. package/dist/client/assets/add-section-modal-wMptfoHV.js +1 -0
  46. package/dist/client/assets/{agent-capabilities-BE7hHGoA.js → agent-capabilities-ADaK_qqp.js} +1 -1
  47. package/dist/client/assets/agent-icon-6l7Nwe2K.js +1 -0
  48. package/dist/client/assets/{agent-icons-UJTit2wi.js → agent-icons-BDS9BBHh.js} +1 -1
  49. package/dist/client/assets/agents-list-BdFiPs3r.js +1 -0
  50. package/dist/client/assets/ai-providers-lM-GGoBl.js +1 -0
  51. package/dist/client/assets/{alert-DkX6LwPv.js → alert-Ta86Z4_L.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DKXzP7Bt.js → alert-dialog-_2G9ccD7.js} +1 -1
  53. package/dist/client/assets/app-editor-BJ_HJXFs.js +1 -0
  54. package/dist/client/assets/{auth-catchall-CmwVLqj-.js → auth-catchall-BdHpJwKo.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-COIVkHnQ.js → auth-split-layout-DVUC3dWq.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-c065EJtO.js → automation-list-row-BNHDxEG_.js} +1 -1
  57. package/dist/client/assets/{automation-runs-CPH-3xtw.js → automation-runs-BbNb5m5Z.js} +1 -1
  58. package/dist/client/assets/automations-ChMgB7Hm.js +1 -0
  59. package/dist/client/assets/{avatar-ETg7Q-GU.js → avatar-KTqg6Pir.js} +1 -1
  60. package/dist/client/assets/{badge-C8j1DE3m.js → badge-jK5_JNPO.js} +1 -1
  61. package/dist/client/assets/brand-context-D1YLW65X.js +1 -0
  62. package/dist/client/assets/buckets-CZodJDYe.js +1 -0
  63. package/dist/client/assets/{calendar-CLbDOOHw.js → calendar-DFy-BKZq.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-DVzMymKs.js → capability-load-error-DUP-Lw9V.js} +1 -1
  65. package/dist/client/assets/{card-lOxFSSkP.js → card-Ce7y-Nqu.js} +1 -1
  66. package/dist/client/assets/chat-context-CpKbwwmM.js +20 -0
  67. package/dist/client/assets/{checkbox-DWa4G7u9.js → checkbox-MO2_GITU.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-BGZNVK0p.js → cli-auth-success-XZzsr92m.js} +1 -1
  69. package/dist/client/assets/collection-detail-Bv6I7A_k.js +1 -0
  70. package/dist/client/assets/{collection-display-button-NMk2O1lx.js → collection-display-button-DzXqmtbd.js} +1 -1
  71. package/dist/client/assets/{collection-search-BPGQygd8.js → collection-search-CPYfTi84.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-BXPnPT96.js → collection-table-wrapper-DgzLrzuP.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-C_qWo2-y.js → collection-tabs-CIsqNrxU.js} +1 -1
  74. package/dist/client/assets/{collections-NKJwWp8f.js → collections-B-PXiD2Y.js} +1 -1
  75. package/dist/client/assets/{command-B3U7wd2O.js → command-BHmAxNRB.js} +1 -1
  76. package/dist/client/assets/{connect-desktop-dialog-CqBwflr-.js → connect-desktop-dialog-BQZD1I8n.js} +1 -1
  77. package/dist/client/assets/{connection-card-DG_N0P2G.js → connection-card-BHzG8ppu.js} +1 -1
  78. package/dist/client/assets/connection-detail-BlmixFGl.js +1 -0
  79. package/dist/client/assets/{connection-form-helpers-D79c5tFA.js → connection-form-helpers-CgKn2eM9.js} +1 -1
  80. package/dist/client/assets/connections-D5zy3mYf.js +1 -0
  81. package/dist/client/assets/{constants-Oykg5_q9.js → constants-DI_u-hVk.js} +1 -1
  82. package/dist/client/assets/{decopilot-sse-pool-02ukeQqS.js → decopilot-sse-pool-DPWhf2bX.js} +1 -1
  83. package/dist/client/assets/{dialog-DCjJZndp.js → dialog-Bt3zXcK6.js} +1 -1
  84. package/dist/client/assets/{domain-settings-Jn9iDH8k.js → domain-settings-CZnFXOwr.js} +1 -1
  85. package/dist/client/assets/{drawer-BTJhbpa8.js → drawer-DeHC5s3g.js} +1 -1
  86. package/dist/client/assets/{dropdown-menu-BnsK64En.js → dropdown-menu-SwrAlbwN.js} +1 -1
  87. package/dist/client/assets/dynamic-plugin-layout-WDrQTfck.js +1 -0
  88. package/dist/client/assets/{empty-state-C-NWO5ph.js → empty-state-BJFB-AwN.js} +1 -1
  89. package/dist/client/assets/{empty-state-CKyi-9Wl.js → empty-state-DlCayRAK.js} +1 -1
  90. package/dist/client/assets/{extract-connection-data-AirIeyvr.js → extract-connection-data-CrMYEI5i.js} +1 -1
  91. package/dist/client/assets/features-BgkDxOlu.js +1 -0
  92. package/dist/client/assets/file-explorer-DrueRu5k.js +2 -0
  93. package/dist/client/assets/{file-type-icon-DM9XMqae.js → file-type-icon-BHF_Ovux.js} +1 -1
  94. package/dist/client/assets/{files-BuO1w5Lh.js → files-BCcd3t2S.js} +1 -1
  95. package/dist/client/assets/{form-DMPH0FOJ.js → form-8jBGaVW7.js} +1 -1
  96. package/dist/client/assets/general-BJkPBrz3.js +1 -0
  97. package/dist/client/assets/{generate-id-i1xx8q5L.js → generate-id-Bfx7nOJH.js} +1 -1
  98. package/dist/client/assets/{github-repo-picker-CTcBo2fn.js → github-repo-picker-F4vLHgJ-.js} +1 -1
  99. package/dist/client/assets/header-tab-button-DCSg63Wl.js +5 -0
  100. package/dist/client/assets/{hover-card-CxtN1xCB.js → hover-card-DcJvwauT.js} +1 -1
  101. package/dist/client/assets/{image-field-HoCNk-1B.js → image-field-cind3dwC.js} +1 -1
  102. package/dist/client/assets/index-BIANv7ur.js +1 -0
  103. package/dist/client/assets/{index-DtSBWsbe.js → index-Bac2tQWh.js} +1 -1
  104. package/dist/client/assets/{index-CALXjj7d.js → index-BrIVZCzt.js} +1 -1
  105. package/dist/client/assets/index-BzoFvbIH.js +1 -0
  106. package/dist/client/assets/{index-C7oVr4Gj.js → index-C0t_9xyr.js} +1 -1
  107. package/dist/client/assets/{index-N_rB2zyq.js → index-C1kxS2Io.js} +1 -1
  108. package/dist/client/assets/index-C3tcbzRj.js +3 -0
  109. package/dist/client/assets/{index-Bja6OpPs.js → index-C_oSBqFD.js} +3 -3
  110. package/dist/client/assets/index-CfGIr4vM.js +310 -0
  111. package/dist/client/assets/index-ChzbgMa2.js +1 -0
  112. package/dist/client/assets/index-D5dv4kfs.css +1 -0
  113. package/dist/client/assets/{index-CB2ubqvZ.js → index-DEWYXjIf.js} +3 -3
  114. package/dist/client/assets/{index-lU9yS_Jh.js → index-DML39Lt-.js} +1 -1
  115. package/dist/client/assets/{index-xAwaYY9z.js → index-DQj7btfC.js} +15 -15
  116. package/dist/client/assets/{index-C6M-_40T.js → index-DlcvFOU2.js} +1 -1
  117. package/dist/client/assets/{index-DUzjuDnX.js → index-d7-A3CDs.js} +1 -1
  118. package/dist/client/assets/{index-redirect-Bh1l7WCU.js → index-redirect-KnAJlqvx.js} +1 -1
  119. package/dist/client/assets/{infiniteQueryObserver-DFB-ygfX.js → infiniteQueryObserver-w8EJyyrI.js} +1 -1
  120. package/dist/client/assets/{input-D9gxUyjr.js → input-Ct22kLSY.js} +1 -1
  121. package/dist/client/assets/{integration-icon-BffTGZN4.js → integration-icon-CNf7sZ5b.js} +1 -1
  122. package/dist/client/assets/{label-BL0BsZ1B.js → label-CvDTa89d.js} +1 -1
  123. package/dist/client/assets/{layout-CfSS4bsq.js → layout-Dkxj2bFg.js} +1 -1
  124. package/dist/client/assets/{login-BuZSwsso.js → login-Dv6Rz1bY.js} +1 -1
  125. package/dist/client/assets/{members-D7WrKG_A.js → members-BQXsk1m4.js} +2 -2
  126. package/dist/client/assets/{monaco-editor-DtMcxLSi.js → monaco-editor-DR4yoUjc.js} +1 -1
  127. package/dist/client/assets/{monitoring-stats-row-fp6agr8k.js → monitoring-stats-row-Co70p3-n.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-d6LUyXrn.js → oauth-callback-CQPHoHy-.js} +1 -1
  129. package/dist/client/assets/{oauth-callback-ai-provider-CkKiZhn4.js → oauth-callback-ai-provider-BJeYyFlX.js} +1 -1
  130. package/dist/client/assets/{onboarding-DfbOcrIX.js → onboarding-CzNreyu4.js} +1 -1
  131. package/dist/client/assets/{org-install-CFDYPwCg.js → org-install-aZxuYxoI.js} +1 -1
  132. package/dist/client/assets/{org-layout-WeQp4B6-.js → org-layout-CR6iFjC9.js} +1 -1
  133. package/dist/client/assets/org-plugin-layout-Ah6P36_M.js +1 -0
  134. package/dist/client/assets/{page-seo-form-BAg1yciU.js → page-seo-form-BzX1ts5p.js} +1 -1
  135. package/dist/client/assets/page-seo-sheet-v7xZnlYi.js +1 -0
  136. package/dist/client/assets/pair--AN1yq4g.js +39 -0
  137. package/dist/client/assets/{plugin-empty-state-9CxATRN3.js → plugin-empty-state-CIZ1bBrP.js} +1 -1
  138. package/dist/client/assets/{plugin-header-7GRdizIh.js → plugin-header-CExvgCKI.js} +1 -1
  139. package/dist/client/assets/{plugin-layout-CJOy-tZB.js → plugin-layout-DS-orBC-.js} +1 -1
  140. package/dist/client/assets/{popover-OiarPewu.js → popover-DXn7orE4.js} +1 -1
  141. package/dist/client/assets/{post-editor-BQ_9KZ48.js → post-editor-bszZQHpg.js} +3 -3
  142. package/dist/client/assets/{primitives-pd_yvF0S.js → primitives-CIXky-Gt.js} +1 -1
  143. package/dist/client/assets/profile-CZWeJMEP.js +1 -0
  144. package/dist/client/assets/project-app-view-DJMvDwFa.js +1 -0
  145. package/dist/client/assets/record-editor-C5KWfSLg.js +1 -0
  146. package/dist/client/assets/registry-CX2hi2E3.js +2 -0
  147. package/dist/client/assets/{registry-layout-D6FuqVAe.js → registry-layout-DjFUi3yC.js} +1 -1
  148. package/dist/client/assets/{require-capability-DVkbMmft.js → require-capability-DDbNSPG5.js} +1 -1
  149. package/dist/client/assets/{required-auth-layout-CRGKVRTF.js → required-auth-layout-Bpv6G5uE.js} +1 -1
  150. package/dist/client/assets/{reset-password-DsVXpYD9.js → reset-password-D1T0PiTj.js} +1 -1
  151. package/dist/client/assets/{resizable-a1gJgrB1.js → resizable-Bi3jkg9o.js} +1 -1
  152. package/dist/client/assets/roles-BBWw8puD.js +1 -0
  153. package/dist/client/assets/{save-status-DRXktsXS.js → save-status-PzXq6KUK.js} +1 -1
  154. package/dist/client/assets/{schema-form-DvpyibqS.js → schema-form-CM7pfylQ.js} +1 -1
  155. package/dist/client/assets/{scroll-area-Ds73tc0J.js → scroll-area-BNzrPnq5.js} +1 -1
  156. package/dist/client/assets/{search-input-BNN911DE.js → search-input-C76EA-t6.js} +1 -1
  157. package/dist/client/assets/secrets-DMEa7GIW.js +1 -0
  158. package/dist/client/assets/{sections-editor-6P4Yegkk.js → sections-editor--GuZPQzC.js} +2 -2
  159. package/dist/client/assets/{select-fwtyEN3G.js → select-D_4UU9rK.js} +1 -1
  160. package/dist/client/assets/{select-model-D7RFa4up.js → select-model-cV_VUU8G.js} +1 -1
  161. package/dist/client/assets/seo-editor-fhccoPNR.js +1 -0
  162. package/dist/client/assets/settings-layout-DH37q17x.js +1 -0
  163. package/dist/client/assets/{settings-section-T0fDyncu.js → settings-section-DsXtuKDY.js} +1 -1
  164. package/dist/client/assets/sheet-D01YX9h0.js +1 -0
  165. package/dist/client/assets/shell-controls-CNVI6ZJJ.js +1 -0
  166. package/dist/client/assets/{shell-layout-I9tl7R9J.js → shell-layout-xPMsY5hC.js} +1 -1
  167. package/dist/client/assets/{shell-route-loading-CdGn4Kpm.js → shell-route-loading-jPQ9XajT.js} +1 -1
  168. package/dist/client/assets/sidebar-CJNdWlwy.js +1 -0
  169. package/dist/client/assets/{skeleton-CM-Pi0cm.js → skeleton-DEf5lpEA.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-KFDeRhD3.js → sortable.esm-KhkNVCRe.js} +1 -1
  171. package/dist/client/assets/{spinner-D4UjUyLz.js → spinner-srK7FwNe.js} +1 -1
  172. package/dist/client/assets/sso-BLXKmxlD.js +1 -0
  173. package/dist/client/assets/store-DydXTg6V.js +1 -0
  174. package/dist/client/assets/store-registry-BJqdtxTv.js +2 -0
  175. package/dist/client/assets/{switch-DB7mlnDa.js → switch-Cbu6JSI9.js} +1 -1
  176. package/dist/client/assets/{tab-id-BFVzx5fb.js → tab-id-CbYpEVAZ.js} +11 -11
  177. package/dist/client/assets/{table-Cd_YQk4M.js → table-dr9K2jWM.js} +1 -1
  178. package/dist/client/assets/{tabs-Dsmq9_wP.js → tabs-CJU0nxr6.js} +1 -1
  179. package/dist/client/assets/{task-status-C990ALOP.js → task-status-Dyf8qaxz.js} +1 -1
  180. package/dist/client/assets/{textarea-DGZy_omr.js → textarea-BquesfD_.js} +1 -1
  181. package/dist/client/assets/{toggle-group-BkLJ1frl.js → toggle-group-m3q7pubc.js} +1 -1
  182. package/dist/client/assets/{toolbar-Bnt0c2J3.js → toolbar-Bkxu3n7s.js} +1 -1
  183. package/dist/client/assets/{tools-list-Dpd5zOg1.js → tools-list-CG_BLK1j.js} +1 -1
  184. package/dist/client/assets/{tooltip-BvIsFjJR.js → tooltip-Bm-whGHF.js} +1 -1
  185. package/dist/client/assets/{types-Dn1K45P2.js → types-Bkz2p_os.js} +1 -1
  186. package/dist/client/assets/{use-ai-providers-BQwBnNI3.js → use-ai-providers-B82V9Np8.js} +1 -1
  187. package/dist/client/assets/{use-automations-BEPg-aek.js → use-automations-B5qTxkL8.js} +1 -1
  188. package/dist/client/assets/{use-capability-rrurYBXm.js → use-capability-DpFGw1TU.js} +1 -1
  189. package/dist/client/assets/{use-collections-e25i0NM-.js → use-collections-iUV-5kFm.js} +1 -1
  190. package/dist/client/assets/{use-connection-BQxCYR_o.js → use-connection-DTKE65yR.js} +1 -1
  191. package/dist/client/assets/{use-copy-BKbXbMuY.js → use-copy-Dr7XRETN.js} +1 -1
  192. package/dist/client/assets/{use-create-virtual-mcp-trxCQUHO.js → use-create-virtual-mcp-DlMteKXP.js} +1 -1
  193. package/dist/client/assets/{use-debounced-autosave-Oryp4cAP.js → use-debounced-autosave-DFapff8c.js} +1 -1
  194. package/dist/client/assets/{use-delete-connection-DEEK0oTT.js → use-delete-connection-CU96IyMZ.js} +1 -1
  195. package/dist/client/assets/{use-file-configs-Qrd6eZyZ.js → use-file-configs-C8ipJXZL.js} +1 -1
  196. package/dist/client/assets/{use-infinite-scroll-DcQNoJ7_.js → use-infinite-scroll-KU0QCoEE.js} +1 -1
  197. package/dist/client/assets/{use-list-state-BoOb09L9.js → use-list-state-DtwRJx6R.js} +1 -1
  198. package/dist/client/assets/{use-mcp-prompts-D9JZQ88U.js → use-mcp-prompts-aLA3FcF_.js} +1 -1
  199. package/dist/client/assets/{use-mcp-tools-DkcEQK3V.js → use-mcp-tools-CK1DUQVb.js} +1 -1
  200. package/dist/client/assets/{use-members-DERsL77r.js → use-members-C9apz-8a.js} +1 -1
  201. package/dist/client/assets/{use-navigate-to-agent-sJoZ-Wbv.js → use-navigate-to-agent-DRRtr51U.js} +1 -1
  202. package/dist/client/assets/{use-org-auth-client-CF8P1btO.js → use-org-auth-client-CI8XyYuM.js} +1 -1
  203. package/dist/client/assets/{use-org-sso-D2JNbrnR.js → use-org-sso-CYBgAyDV.js} +1 -1
  204. package/dist/client/assets/{use-organization-roles-Ca1byRHM.js → use-organization-roles-C5ABG30J.js} +1 -1
  205. package/dist/client/assets/{use-organization-settings-CVmm-jyI.js → use-organization-settings-B4ywx3QZ.js} +1 -1
  206. package/dist/client/assets/{use-registry-connections-B6OVBI_G.js → use-registry-connections-B-c9LId-.js} +1 -1
  207. package/dist/client/assets/{use-secrets-_k7d1I4Z.js → use-secrets-D3irvtLI.js} +1 -1
  208. package/dist/client/assets/{use-status-sounds-gVglgYnC.js → use-status-sounds-BEbMXd3N.js} +1 -1
  209. package/dist/client/assets/{use-view-mode-DdD0TD2N.js → use-view-mode-Jd_CE1Mx.js} +1 -1
  210. package/dist/client/assets/{use-virtual-mcp-BNfSbQBW.js → use-virtual-mcp-DsdNWb58.js} +1 -1
  211. package/dist/client/assets/useInfiniteQuery-DrZL_IGs.js +1 -0
  212. package/dist/client/assets/{useRouterState-CI4Wmw4H.js → useRouterState-CU2GqlKv.js} +1 -1
  213. package/dist/client/assets/useSuspenseInfiniteQuery-CN1mQR7i.js +1 -0
  214. package/dist/client/assets/{user-ChT4iOGQ.js → user-sLZtiN2i.js} +1 -1
  215. package/dist/client/assets/{view-mode-toggle-DCljG_Km.js → view-mode-toggle-DSmCr2tD.js} +1 -1
  216. package/dist/client/assets/workflow-BK9KKo6T.js +1 -0
  217. package/dist/client/assets/workflow-detail-DzASvQVR.js +1 -0
  218. package/dist/client/deck-runtime/v1/deck-viewer.js +1516 -0
  219. package/dist/client/index.html +2 -2
  220. package/dist/server/cli.js +542 -539
  221. package/dist/server/migrate.js +90 -90
  222. package/dist/server/server.js +287 -287
  223. package/package.json +1 -1
  224. package/dist/client/assets/ZoomOut-Bj5jamAx.js +0 -1
  225. package/dist/client/assets/add-section-modal-BmCzDi10.js +0 -1
  226. package/dist/client/assets/agent-icon-D4vfmbIE.js +0 -1
  227. package/dist/client/assets/agents-list-LpRFwfeM.js +0 -1
  228. package/dist/client/assets/ai-providers-BqYvRcM4.js +0 -1
  229. package/dist/client/assets/app-editor-CIaq7eCO.js +0 -1
  230. package/dist/client/assets/automations-jHIRR-Gp.js +0 -1
  231. package/dist/client/assets/brand-context-pJc99xfz.js +0 -1
  232. package/dist/client/assets/buckets-CD20kw5y.js +0 -1
  233. package/dist/client/assets/chat-context-Bnval_3z.js +0 -20
  234. package/dist/client/assets/collection-detail-BQV4fFQi.js +0 -1
  235. package/dist/client/assets/connection-detail-BxZdoV6Y.js +0 -1
  236. package/dist/client/assets/connections-BKRkcjPX.js +0 -1
  237. package/dist/client/assets/dynamic-plugin-layout-DI1tAQQN.js +0 -1
  238. package/dist/client/assets/features-CCh1HKhB.js +0 -1
  239. package/dist/client/assets/file-explorer-BQmgDEDi.js +0 -2
  240. package/dist/client/assets/general-BorJGZAV.js +0 -1
  241. package/dist/client/assets/header-tab-button-CJMFloVi.js +0 -3
  242. package/dist/client/assets/index-BNc5J02Q.js +0 -1
  243. package/dist/client/assets/index-CTo6iOJE.js +0 -1
  244. package/dist/client/assets/index-DRkA4nnL.js +0 -3
  245. package/dist/client/assets/index-DzP6PZZ7.css +0 -1
  246. package/dist/client/assets/index-tZSWGe84.js +0 -1
  247. package/dist/client/assets/index-t_7wQBv1.js +0 -310
  248. package/dist/client/assets/org-plugin-layout-CtY6eOb7.js +0 -1
  249. package/dist/client/assets/page-seo-sheet-CG4OfDmr.js +0 -1
  250. package/dist/client/assets/pair-CCKXkNYO.js +0 -39
  251. package/dist/client/assets/profile-BQDabc6t.js +0 -1
  252. package/dist/client/assets/project-app-view-B6xEMwDB.js +0 -1
  253. package/dist/client/assets/record-editor-DeENCgCd.js +0 -1
  254. package/dist/client/assets/registry-C8DHcJ9B.js +0 -2
  255. package/dist/client/assets/roles-CX312B39.js +0 -1
  256. package/dist/client/assets/secrets-BeeL9rnH.js +0 -1
  257. package/dist/client/assets/seo-editor-CsFpa8ZP.js +0 -1
  258. package/dist/client/assets/settings-layout-DwCpTLea.js +0 -1
  259. package/dist/client/assets/sheet-IM6_8Cdx.js +0 -1
  260. package/dist/client/assets/shell-controls-VlzjU05Z.js +0 -1
  261. package/dist/client/assets/sidebar-CAkfGpdS.js +0 -1
  262. package/dist/client/assets/sso-B5mHZmOT.js +0 -1
  263. package/dist/client/assets/store-DVYNpmdS.js +0 -1
  264. package/dist/client/assets/store-registry-DRdcwU2X.js +0 -2
  265. package/dist/client/assets/useInfiniteQuery-Bj3r3xlf.js +0 -1
  266. package/dist/client/assets/useSuspenseInfiniteQuery-BbAiO9h1.js +0 -1
  267. package/dist/client/assets/workflow-BbaQXvps.js +0 -1
  268. package/dist/client/assets/workflow-detail-CU9YTyf_.js +0 -1
@@ -1 +0,0 @@
1
- import{e as se,j as s,B as Z,q as me,r as Y,t as v,o as de}from"./index-Bja6OpPs.js";import{c as k,b as ne,a as ee,D as te}from"./dropdown-menu-BnsK64En.js";import{s as pe}from"./Star01-BT882_xb.js";import{a as fe}from"./Users03-e9b5gRLu.js";import{S as ge,G as ue,u as he,H as ie,W as oe,a as xe,I as je}from"./github-repo-picker-CTcBo2fn.js";import{a as _e,b as Ce,c as be}from"./use-virtual-mcp-BNfSbQBW.js";import{P as q}from"./index-N_rB2zyq.js";import{i as ye}from"./DotsVertical-DNPNHBpl.js";import{a as Ne}from"./Settings02-DYlioLKt.js";import{s as Se}from"./Trash01-C2MDqKmR.js";import{A as De,an as ve}from"./agent-icon-D4vfmbIE.js";import{k as Ae}from"./use-navigate-to-agent-sJoZ-Wbv.js";import{C as ke}from"./card-lOxFSSkP.js";import{f as re}from"./formatDistanceToNow-Cb2QZZJn.js";import{u as we}from"./use-capability-rrurYBXm.js";import{E as Te}from"./empty-state-CKyi-9Wl.js";import{u as ze}from"./use-create-virtual-mcp-trxCQUHO.js";import{c as Ie,b as Pe,d as He,f as Ee,e as Me,g as Oe,a as Be,A as Ge}from"./alert-dialog-DKXzP7Bt.js";import{S as $e}from"./search-input-BNN911DE.js";import{s as le}from"./Plus-DXVOsj8b.js";import"./Check-CtI-OH3k.js";import"./ChevronRight-TMlXoq-Z.js";import"./use-connection-BQxCYR_o.js";import"./use-collections-e25i0NM-.js";import"./constants-Oykg5_q9.js";import"./dialog-DCjJZndp.js";import"./X-DvNDI9Zw.js";import"./RefreshCcw01-CxP3kNii.js";import"./collection-search-BPGQygd8.js";import"./SearchMd-B9xeWi0e.js";import"./checkbox-DWa4G7u9.js";import"./use-mcp-tools-DkcEQK3V.js";import"./extract-connection-data-AirIeyvr.js";import"./generate-id-i1xx8q5L.js";import"./collections-NKJwWp8f.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./tooltip-BvIsFjJR.js";import"./AlertCircle-f1EMyhcF.js";import"./Tool01-D7SzxWeU.js";import"./SwitchHorizontal01-Den03c4j.js";import"./XCircle-DBS00WN3.js";import"./ArrowUpRight-DDOS_CqL.js";import"./ZapSquare-CC0ClMfp.js";import"./CheckCircle-Dk0E48Vj.js";import"./ChevronDown-BL2fNdeZ.js";import"./ChevronLeft-ItYaMHNU.js";import"./ChevronUp-O10NbvHe.js";import"./Container-B1sUXs1U.js";import"./Eye-DWIY-6KS.js";import"./ZoomOut-Bj5jamAx.js";import"./Globe01-Cjaw-3jR.js";import"./FilterLines-CWRo79Yt.js";import"./Palette-DkgVQjRz.js";import"./HardDrive-Ddx5WtDi.js";import"./Stars02-lM9wDOP9.js";import"./Key01-ChvR9ujt.js";import"./LinkExternal01-Bo28LxVY.js";import"./Monitor01-Cx9Nl0mU.js";import"./Sun-CNIfXy2-.js";import"./Play-VGEgQ-36.js";import"./Shield01-CLHpjaQL.js";import"./Stars01-DDxsFd_C.js";import"./Upload01-BTsf5tML.js";import"./User01-B1vfX-f8.js";import"./Users01-dpqTHJ7Y.js";import"./XClose-BdAeKt9F.js";import"./Zap-aFVcxgaa.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:ge,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(ue,{className:"size-3.5"}),e[12]=N):N=e[12];let r;e[13]!==u?(r=u&&s.jsx("span",{className:"ml-auto text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Beta"}),e[13]=u,e[14]=r):r=e[14];let C;e[15]!==S||e[16]!==r?(C=s.jsxs(k,{onClick:S,children:[N,"Import from GitHub",r]}),e[15]=S,e[16]=r,e[17]=C):C=e[17];let p;e[18]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"deco.cx",className:"size-3.5"}),e[18]=p):p=e[18];let m;e[19]!==f?(m=s.jsxs(k,{onClick:f,children:[p,"Import from deco.cx"]}),e[19]=f,e[20]=m):m=e[20];let b;return e[21]!==h||e[22]!==g||e[23]!==C||e[24]!==m||e[25]!==a||e[26]!==n||e[27]!==c?(b=s.jsxs(ne,{side:g,align:h,className:"w-48",children:[a,n,c,C,m]}),e[21]=h,e[22]=g,e[23]=C,e[24]=m,e[25]=a,e[26]=n,e[27]=c,e[28]=b):b=e[28],b}function Fe(t){const e=se.c(45),{project:i,lastUsedAt:D,onDeleteClick:l}=t,S=Ae();let f;e[0]!==S||e[1]!==i.id?(f=()=>S(i.id),e[0]=S,e[1]=i.id,e[2]=f):f=e[2];let o;e[3]!==i.title||e[4]!==f?(o=s.jsx("button",{type:"button",onClick:f,className:"absolute inset-0 z-0","aria-label":i.title}),e[3]=i.title,e[4]=f,e[5]=o):o=e[5];let y;e[6]!==i.icon||e[7]!==i.title?(y=s.jsx(De,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0 shadow-sm"}),e[6]=i.icon,e[7]=i.title,e[8]=y):y=e[8];let g;e[9]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(ee,{asChild:!0,children:s.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:s.jsx(ye,{size:20})})}),e[9]=g):g=e[9];let u;e[10]!==S||e[11]!==i.id?(u=()=>S(i.id,{search:{main:"settings"}}),e[10]=S,e[11]=i.id,e[12]=u):u=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(Ne,{size:16}),e[13]=h):h=e[13];let x;e[14]!==u?(x=s.jsxs(k,{onClick:u,children:[h,"Settings"]}),e[14]=u,e[15]=x):x=e[15];let a;e[16]!==l?(a=l&&s.jsxs(k,{variant:"destructive",onClick:w=>{w.stopPropagation(),l(w)},children:[s.jsx(Se,{size:16}),"Delete"]}),e[16]=l,e[17]=a):a=e[17];let j;e[18]!==x||e[19]!==a?(j=s.jsx("div",{className:"relative z-10 pointer-events-auto transition-opacity sm:opacity-0 sm:group-hover:opacity-100",children:s.jsxs(te,{children:[g,s.jsxs(ne,{align:"end",children:[x,a]})]})}),e[18]=x,e[19]=a,e[20]=j):j=e[20];let n;e[21]!==y||e[22]!==j?(n=s.jsxs("div",{className:"flex items-start justify-between",children:[y,j]}),e[21]=y,e[22]=j,e[23]=n):n=e[23];let _;e[24]!==i.title?(_=s.jsx("h3",{className:"text-sm font-medium text-foreground truncate",children:i.title}),e[24]=i.title,e[25]=_):_=e[25];const c=i.description||"No description";let N;e[26]!==c?(N=s.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:c}),e[26]=c,e[27]=N):N=e[27];let r;e[28]!==_||e[29]!==N?(r=s.jsxs("div",{className:"flex flex-col gap-1",children:[_,N]}),e[28]=_,e[29]=N,e[30]=r):r=e[30];let C;e[31]!==n||e[32]!==r?(C=s.jsxs("div",{className:"flex flex-col gap-3 p-4.5",children:[n,r]}),e[31]=n,e[32]=r,e[33]=C):C=e[33];let p;e[34]!==D||e[35]!==i.updated_at?(p=D?`Last used ${re(new Date(D),{addSuffix:!0})}`:`Updated ${re(new Date(i.updated_at),{addSuffix:!0})}`,e[34]=D,e[35]=i.updated_at,e[36]=p):p=e[36];let m;e[37]!==p?(m=s.jsx("div",{className:"border-t border-border mt-auto",children:s.jsx("div",{className:"h-10 flex items-center px-4.5",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:p})})}),e[37]=p,e[38]=m):m=e[38];let b;e[39]!==C||e[40]!==m?(b=s.jsxs("div",{className:"flex flex-col flex-1 pointer-events-none",children:[C,m]}),e[39]=C,e[40]=m,e[41]=b):b=e[41];let A;return e[42]!==b||e[43]!==o?(A=s.jsxs(ke,{className:"relative transition-colors group overflow-hidden flex flex-col h-full hover:bg-muted/50",children:[o,b]}),e[42]=b,e[43]=o,e[44]=A):A=e[44],A}function os(){const t=se.c(48),{org:e}=me(),i=_e(),D=Ce(),[l,S]=Y.useState("");let f;t[0]===Symbol.for("react.memo_cache_sentinel")?(f={navigateOnCreate:!0},t[0]=f):f=t[0];const{createVirtualMCP:o,isCreating:y}=ze(f),{createFromTemplate:g,isCreating:u}=he(),[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=q,A=q,w=q;let F;t[4]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(q.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 K=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]!==K?(P=s.jsxs(w.Body,{children:[I,K,J]}),t[17]=J,t[18]=w.Body,t[19]=I,t[20]=K,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(xe,{open:n,onOpenChange:_}),t[25]=n,t[26]=E):E=t[26];let M;t[27]!==a?(M=s.jsx(je,{open:a,onOpenChange:j}),t[27]=a,t[28]=M):M=t[28];const Q=!!h;let W;t[29]===Symbol.for("react.memo_cache_sentinel")?(W=d=>!d&&x(null),t[29]=W):W=t[29];let R;t[30]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(Ie,{children:"Delete Agent?"}),t[30]=R):R=t[30];const X=h?.title;let O;t[31]!==X?(O=s.jsxs(Pe,{children:[R,s.jsxs(He,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:X}),"."]})]}),t[31]=X,t[32]=O):O=t[32];let U;t[33]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(Ee,{children:"Cancel"}),t[33]=U):U=t[33];let B;t[34]!==m?(B=s.jsxs(Me,{children:[U,s.jsx(Oe,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[34]=m,t[35]=B):B=t[35];let G;t[36]!==O||t[37]!==B?(G=s.jsxs(Be,{children:[O,B]}),t[36]=O,t[37]=B,t[38]=G):G=t[38];let $;t[39]!==Q||t[40]!==G?($=s.jsx(Ge,{open:Q,onOpenChange:W,children:G}),t[39]=Q,t[40]=G,t[41]=$):$=t[41];let V;return t[42]!==b||t[43]!==H||t[44]!==E||t[45]!==M||t[46]!==$?(V=s.jsxs(b,{children:[H,E,M,$]}),t[42]=b,t[43]=H,t[44]=E,t[45]=M,t[46]=$,t[47]=V):V=t[47],V}function Le(t){return t.id}export{os as default};
@@ -1 +0,0 @@
1
- import{R as G,U as C,aG as ce,aI as ae,aJ as be,aH as ye,b6 as pe,e as M,H as ve,G as je,r as O,j as s,C as $e,o as Q,z as _e,q as H,F as ne,a as ee,K as B,n as Se,c as ge,B as V,t as Ie,E as Oe}from"./index-Bja6OpPs.js";import{i as Te}from"./AlertCircle-f1EMyhcF.js";import{P as oe}from"./index-N_rB2zyq.js";import{S as de}from"./skeleton-CM-Pi0cm.js";import{b as ke,a as me,S as ue,c as Me}from"./settings-section-T0fDyncu.js";import{u as te,b as re,c as Ce}from"./use-ai-providers-BQwBnNI3.js";import{i as Ue}from"./CheckCircle-Dk0E48Vj.js";import{p as ze}from"./chat-context-Bnval_3z.js";import{e as Le,f as qe}from"./use-organization-settings-CVmm-jyI.js";import{M as Ve}from"./select-model-D7RFa4up.js";import{u as Ge}from"./use-debounced-autosave-Oryp4cAP.js";import{I as le}from"./input-D9gxUyjr.js";import{a as he,T as Be}from"./toggle-group-BkLJ1frl.js";import{b as Ne,c as we,d as Pe,f as Ae,a as De,e as Ke,g as Ee,A as Fe}from"./alert-dialog-DKXzP7Bt.js";import{S as J,u as X}from"./constants-Oykg5_q9.js";import{s as Qe}from"./Plus-DXVOsj8b.js";import{i as Ye}from"./Tool01-D7SzxWeU.js";import{s as We}from"./Trash01-C2MDqKmR.js";import{A as He}from"./avatar-ETg7Q-GU.js";import{O as Re,P as Je,c as xe}from"./agent-icons-UJTit2wi.js";import{a as Xe}from"./RefreshCcw01-CxP3kNii.js";import{s as Ze}from"./Eye-DWIY-6KS.js";import{d as et,b as tt,c as st,a as it,D as ot}from"./dialog-DCjJZndp.js";import{S as rt}from"./spinner-D4UjUyLz.js";import{f as lt}from"./formatDistanceToNow-Cb2QZZJn.js";import{R as nt}from"./require-capability-DVkbMmft.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./X-DvNDI9Zw.js";import"./tooltip-BvIsFjJR.js";import"./card-lOxFSSkP.js";import"./ArrowUpRight-DDOS_CqL.js";import"./tab-id-BFVzx5fb.js";import"./decopilot-sse-pool-02ukeQqS.js";import"./create-sse-subscription-BS5983N4.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-virtual-mcp-BNfSbQBW.js";import"./use-collections-e25i0NM-.js";import"./drawer-BTJhbpa8.js";import"./User01-B1vfX-f8.js";import"./checkbox-DWa4G7u9.js";import"./Check-CtI-OH3k.js";import"./select-fwtyEN3G.js";import"./ChevronDown-BL2fNdeZ.js";import"./ChevronUp-O10NbvHe.js";import"./Key01-ChvR9ujt.js";import"./SearchMd-B9xeWi0e.js";import"./Settings02-DYlioLKt.js";import"./ai-providers-logos-DD3qZ33J.js";import"./Monitor01-Cx9Nl0mU.js";import"./ChevronRight-TMlXoq-Z.js";import"./connect-desktop-dialog-CqBwflr-.js";import"./Stars01-DDxsFd_C.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-capability-rrurYBXm.js";import"./access-gate-B8AAPT1T.js";import"./capability-load-error-DVzMymKs.js";G({title:C(),url:C(),icon:C()});G({registries:ae(C(),G({enabled:be()})).describe("Per-registry enabled/disabled state. Key is connection ID. Absent registries are treated as enabled."),blockedMcps:ce(C()).describe("List of MCP app_name or app_id values to hide from the store.")});const Z=G({keyId:C(),modelId:C(),title:C().optional()}).nullable();ye(["fast","smart","thinking","image","web_research"]);ye(["fast","smart","thinking"]);const at=G({tiers:G({fast:Z,smart:Z,thinking:Z,image:Z,web_research:Z})});G({ids:ce(C()).describe("Ordered list of custom virtual MCP agent ids to show on the home view.")});G({id:C().describe("Brand context ID"),name:C().describe("Company name"),domain:C().describe("Company domain (e.g. example.com)"),overview:C().describe("Company overview / description"),logo:C().nullable().optional().describe("Logo URL"),favicon:C().nullable().optional().describe("Favicon URL"),ogImage:C().nullable().optional().describe("OG image URL"),fonts:G({heading:C().optional().describe("Font family for headings"),body:C().optional().describe("Font family for body text"),code:C().optional().describe("Font family for code / monospace")}).nullable().optional().describe("Font families by semantic role"),colors:G({primary:C().optional().describe("Primary brand color (hex)"),secondary:C().optional().describe("Secondary brand color (hex)"),accent:C().optional().describe("Accent / highlight color (hex)"),background:C().optional().describe("Background color (hex)"),foreground:C().optional().describe("Foreground / text color (hex)")}).nullable().optional().describe("Semantic color palette"),images:ce(ae(C(),pe())).nullable().optional().describe("Brand images"),metadata:ae(C(),pe()).nullable().optional().describe("Extra design tokens (typography, components, spacing, layout, tone, etc.)"),archivedAt:C().nullable().optional().describe("Archive timestamp (null to unarchive)"),isDefault:be().optional().describe("Whether this is the default brand for the organization")});const ct=e=>e.capabilities?.includes("image")===!0,dt=e=>{if(e.asyncResearch===!0)return!0;const t=e.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return t.includes("sonar")||t.includes("deepresearch")},mt=[{key:"fast",label:"Fast",description:"Fastest responses, best for quick tasks",filter:void 0},{key:"smart",label:"Smart",description:"Balanced speed and capability",filter:void 0},{key:"thinking",label:"Thinking",description:"Most capable, best for complex tasks",filter:void 0},{key:"image",label:"Image",description:"Image generation",filter:ct},{key:"web_research",label:"Web research",description:"Web search and deep research",filter:dt}];function ut(e){const t=M.c(20),{slot:i,onSlotChange:l,filterModels:o,defaultKeyId:a}=e,r=te(),[n,p]=O.useState(i?.keyId??a);let y;t[0]!==i?(y=()=>{i?.keyId&&p(i.keyId)},t[0]=i,t[1]=y):y=t[1];const S=i?.keyId;let h;t[2]!==S?(h=[S],t[2]=S,t[3]=h):h=t[3],O.useEffect(y,h);const c=n??a;let u;t[4]!==c||t[5]!==r?(u=c?r.find(d=>d.id===c):null,t[4]=c,t[5]=r,t[6]=u):u=t[6];const k=u,{models:m,isLoading:I}=re(o?c??void 0:void 0),v=o?I||m.some(o):!0;let g;t[7]!==i||t[8]!==k?.providerId?(g=i?{modelId:i.modelId,title:i.title??i.modelId,keyId:i.keyId,providerId:k?.providerId??"deco",description:null,logo:null,capabilities:[],limits:null,costs:null}:null,t[7]=i,t[8]=k?.providerId,t[9]=g):g=t[9];const x=g;if(o&&!v){let d;return t[10]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Not available with current provider"}),t[10]=d):d=t[10],d}let b;t[11]===Symbol.for("react.memo_cache_sentinel")?(b=d=>p(d),t[11]=b):b=t[11];let j;t[12]!==c||t[13]!==l?(j=d=>{const w=d.keyId??c??"";p(w),l({keyId:w,modelId:d.modelId,title:d.title})},t[12]=c,t[13]=l,t[14]=j):j=t[14];let f;return t[15]!==c||t[16]!==o||t[17]!==x||t[18]!==j?(f=s.jsx(Ve,{variant:"bordered",placeholder:"Pick model",model:x,credentialId:c,filterModels:o,onCredentialChange:b,onModelChange:j}),t[15]=c,t[16]=o,t[17]=x,t[18]=j,t[19]=f):f=t[19],f}function ft(e){const t=M.c(2),{isPending:i,showSaved:l}=e;if(i){let o;return t[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(_e,{size:12,className:"animate-spin"}),"Saving…"]}),t[0]=o):o=t[0],o}if(l){let o;return t[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(Ue,{size:12}),"Saved"]}),t[1]=o):o=t[1],o}return null}function pt(){const e=M.c(42),t=te(),i=Le(),l=t.length>0;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=ve(at),e[0]=o):o=e[0];let a;e[1]!==i?(a={resolver:o,values:i,mode:"onChange"},e[1]=i,e[2]=a):a=e[2];const r=je(a),{mutate:n,isPending:p,isSuccess:y}=qe(),S=r.formState.isDirty;let h;e[3]!==r||e[4]!==i||e[5]!==n?(h={delayMs:250,save:async()=>{const _=r.getValues();n(_,{onSuccess:()=>r.reset(_,{keepValues:!0}),onError:F=>{r.reset(i),Q.error(`Failed to save: ${F.message}`)}})}},e[3]=r,e[4]=i,e[5]=n,e[6]=h):h=e[6];const{schedule:c}=Ge(h),u=t[0],k=t[1],m=t[2],{models:I}=re(u?.id),{models:v}=re(k?.id),{models:g}=re(m?.id);let x,b;e[7]!==r||e[8]!==l?(x=()=>{l||r.reset({tiers:{fast:null,smart:null,thinking:null,image:null,web_research:null}})},b=[l,r],e[7]=r,e[8]=l,e[9]=x,e[10]=b):(x=e[9],b=e[10]),O.useEffect(x,b);let j;e[11]!==t||e[12]!==r||e[13]!==u||e[14]!==k||e[15]!==m||e[16]!==I||e[17]!==v||e[18]!==g?(j=()=>{const _=r.getValues(),F=new Set(t.map(gt)),P={};u?.id&&(P[u.id]=I),k?.id&&(P[k.id]=v),m?.id&&(P[m.id]=g);const E=Y=>Y!=null&&!F.has(Y.keyId),N={fast:E(_.tiers.fast)?null:_.tiers.fast,smart:E(_.tiers.smart)?null:_.tiers.smart,thinking:E(_.tiers.thinking)?null:_.tiers.thinking,image:E(_.tiers.image)?null:_.tiers.image,web_research:E(_.tiers.web_research)?null:_.tiers.web_research},L=!N.fast||!N.smart||!N.thinking||!N.image||!N.web_research,q=N.fast===_.tiers.fast&&N.smart===_.tiers.smart&&N.thinking===_.tiers.thinking&&N.image===_.tiers.image&&N.web_research===_.tiers.web_research;if(!L&&q)return;const R=ze(t,P);r.reset({tiers:{fast:N.fast??R.chat.fast,smart:N.smart??R.chat.smart,thinking:N.thinking??R.chat.thinking,image:N.image??R.image,web_research:N.web_research??R.webResearch}},{keepDirty:!0})},e[11]=t,e[12]=r,e[13]=u,e[14]=k,e[15]=m,e[16]=I,e[17]=v,e[18]=g,e[19]=j):j=e[19];const f=u?.id,d=k?.id,w=m?.id;let U;e[20]!==t||e[21]!==r||e[22]!==I||e[23]!==v||e[24]!==g||e[25]!==f||e[26]!==d||e[27]!==w?(U=[r,t,I,v,g,f,d,w],e[20]=t,e[21]=r,e[22]=I,e[23]=v,e[24]=g,e[25]=f,e[26]=d,e[27]=w,e[28]=U):U=e[28],O.useEffect(j,U);let T;e[29]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsx("p",{className:"text-sm text-muted-foreground",children:"These models power chat, automations, and tools across your organization."}),e[29]=T):T=e[29];const z=y&&!S;let A;e[30]!==p||e[31]!==z?(A=s.jsxs("div",{className:"flex items-center justify-between -mt-2 mb-2",children:[T,s.jsx(ft,{isPending:p,showSaved:z})]}),e[30]=p,e[31]=z,e[32]=A):A=e[32];let D;e[33]!==t[0]?.id||e[34]!==r.control||e[35]!==c?(D=mt.map(_=>s.jsx($e,{control:r.control,name:`tiers.${_.key}`,render:F=>{const{field:P}=F;return s.jsx(ke,{title:_.label,description:_.description,action:s.jsx(ut,{slot:P.value,defaultKeyId:t[0]?.id??null,filterModels:_.filter,onSlotChange:E=>{P.onChange(E),c()}})})}},_.key)),e[33]=t[0]?.id,e[34]=r.control,e[35]=c,e[36]=D):D=e[36];let K;e[37]!==D?(K=s.jsx(me,{children:D}),e[37]=D,e[38]=K):K=e[38];let $;return e[39]!==A||e[40]!==K?($=s.jsxs(ue,{title:"Default models",headerClassName:"pl-0",children:[A,K]}),e[39]=A,e[40]=K,e[41]=$):$=e[41],$}function gt(e){return e.id}const ht={usd:[10,20,100],brl:[50,100,500]};function xt(){const e=M.c(29),{org:t}=H();let i;e[0]!==t.id||e[1]!==t.slug?(i={connectionId:J,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=i):i=e[2];const l=X(i),[o,a]=O.useState(!1),{mutate:r,isPending:n}=ee({mutationFn:async d=>{const w=await l.callTool({name:"AI_PROVIDER_TOPUP_URL",arguments:{providerId:"deco",amountCents:d,currency:c}});if(w?.isError)throw new Error(w.content?.[0]?.text??"Failed to get top-up URL");return w.structuredContent?.url},onSuccess:yt,onError:bt}),[p,y]=O.useState(""),[S,h]=O.useState("usd"),c=S,u=parseFloat(p),k=!isNaN(u)&&u>=1,m=c==="brl"?"R$":"$";let I;e[3]!==h?(I=d=>{d&&h(d)},e[3]=h,e[4]=I):I=e[4];let v,g;e[5]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(he,{value:"usd",className:"px-3.5 text-sm",children:"USD"}),g=s.jsx(he,{value:"brl",className:"px-3.5 text-sm",children:"BRL"}),e[5]=v,e[6]=g):(v=e[5],g=e[6]);let x;e[7]!==c||e[8]!==I?(x=s.jsxs(Be,{type:"single",variant:"outline",size:"default",value:c,onValueChange:I,children:[v,g]}),e[7]=c,e[8]=I,e[9]=x):x=e[9];let b;e[10]!==c||e[11]!==m||e[12]!==o||e[13]!==n||e[14]!==r?(b=!o&&s.jsxs(s.Fragment,{children:[ht[c].map(d=>s.jsxs(V,{variant:"outline",className:"h-10 px-4 text-sm font-medium tabular-nums",disabled:n,onClick:()=>r(d*100),children:[m,d]},d)),s.jsx(V,{variant:"ghost",className:"h-10 px-4 text-sm text-muted-foreground",onClick:()=>a(!0),disabled:n,children:"Custom"})]}),e[10]=c,e[11]=m,e[12]=o,e[13]=n,e[14]=r,e[15]=b):b=e[15];let j;e[16]!==m||e[17]!==p||e[18]!==u||e[19]!==o||e[20]!==k||e[21]!==n||e[22]!==y||e[23]!==r?(j=o&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative max-w-[140px]",children:[s.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground select-none",children:m}),s.jsx(le,{type:"number",min:"1",step:"1",placeholder:"50",value:p,onChange:d=>y(d.target.value),className:"h-10 text-sm pl-7",autoFocus:!0})]}),s.jsx(V,{className:"h-10",disabled:!k||n,onClick:()=>r(Math.round(u*100)),children:n?"...":"Add"}),s.jsx(V,{variant:"ghost",className:"h-10 text-sm text-muted-foreground",onClick:()=>{a(!1),y("")},children:"Cancel"})]}),e[16]=m,e[17]=p,e[18]=u,e[19]=o,e[20]=k,e[21]=n,e[22]=y,e[23]=r,e[24]=j):j=e[24];let f;return e[25]!==x||e[26]!==b||e[27]!==j?(f=s.jsx("div",{className:"flex flex-col gap-2.5",children:s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x,b,j]})}),e[25]=x,e[26]=b,e[27]=j,e[28]=f):f=e[28],f}function bt(e){Q.error(`Top-up failed: ${e.message}`)}function yt(e){e&&window.open(e,"_blank","noopener,noreferrer")}function vt(e){return e<=0?"text-destructive":e<=1?"text-amber-500 dark:text-amber-400":"text-foreground"}function jt(){const e=M.c(61),{org:t}=H();let i;e[0]!==t.id||e[1]!==t.slug?(i={connectionId:J,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=i):i=e[2];const l=X(i),o=ne(),a=te();let r;e[3]!==a?(r=a.find(St),e[3]=a,e[4]=r):r=e[4];const n=r,[p,y]=O.useState(!1);let S;e[5]!==l||e[6]!==n?(S=async()=>{n&&await l.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:n.id}})},e[5]=l,e[6]=n,e[7]=S):S=e[7];let h;e[8]!==t.id||e[9]!==o?(h=()=>{o.invalidateQueries({queryKey:B.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:B.aiProviders(t.id)}),Q.success("Deco AI Gateway disconnected"),y(!1)},e[8]=t.id,e[9]=o,e[10]=h):h=e[10];let c;e[11]!==S||e[12]!==h?(c={mutationFn:S,onSuccess:h,onError:_t},e[11]=S,e[12]=h,e[13]=c):c=e[13];const{mutate:u,isPending:k}=ee(c);let m;e[14]!==t.id?(m=B.aiProviderCredits(t.id,"deco"),e[14]=t.id,e[15]=m):m=e[15];const I=!!n;let v;e[16]!==l?(v=async()=>{const fe=await l.callTool({name:"AI_PROVIDER_CREDITS",arguments:{providerId:"deco"}});return fe?.isError?null:fe.structuredContent??null},e[16]=l,e[17]=v):v=e[17];let g;e[18]!==m||e[19]!==I||e[20]!==v?(g={queryKey:m,enabled:I,staleTime:6e4,queryFn:v},e[18]=m,e[19]=I,e[20]=v,e[21]=g):g=e[21];const{data:x,isLoading:b,refetch:j,isFetching:f}=Se(g);if(!n)return null;const d=x?.balanceCents!=null?x.balanceCents/100:null;let w;e[22]!==d?(w=d!=null?`$${d.toFixed(2)}`:"—",e[22]=d,e[23]=w):w=e[23];const U=w;let T;e[24]===Symbol.for("react.memo_cache_sentinel")?(T=s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-9 rounded-lg object-contain dark:bg-white dark:p-0.5"}),s.jsx("div",{children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Access to 100+ models"})})]}),e[24]=T):T=e[24];let z;e[25]===Symbol.for("react.memo_cache_sentinel")?(z=()=>y(!0),e[25]=z):z=e[25];let A;e[26]!==k?(A=s.jsxs("div",{className:"flex items-center justify-between",children:[T,s.jsx(V,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground hover:text-destructive",onClick:z,disabled:k,children:"Disconnect"})]}),e[26]=k,e[27]=A):A=e[27];let D;e[28]===Symbol.for("react.memo_cache_sentinel")?(D=s.jsxs(Ne,{children:[s.jsx(we,{children:"Disconnect Deco AI Gateway"}),s.jsx(Pe,{children:"This will remove the Deco AI Gateway from this workspace. Your credit balance is preserved and will be available if you reconnect."})]}),e[28]=D):D=e[28];let K;e[29]===Symbol.for("react.memo_cache_sentinel")?(K=s.jsx(Ae,{children:"Cancel"}),e[29]=K):K=e[29];let $;e[30]!==u?($=s.jsxs(De,{children:[D,s.jsxs(Ke,{children:[K,s.jsx(Ee,{onClick:()=>u(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]}),e[30]=u,e[31]=$):$=e[31];let _;e[32]!==p||e[33]!==$?(_=s.jsx(Fe,{open:p,onOpenChange:y,children:$}),e[32]=p,e[33]=$,e[34]=_):_=e[34];let F;e[35]!==d||e[36]!==U||e[37]!==f||e[38]!==b?(F=b||f?s.jsx(de,{className:"h-9 w-24"}):s.jsx("span",{className:ge("text-3xl font-semibold tabular-nums tracking-tight",d!=null&&vt(d)),children:U}),e[35]=d,e[36]=U,e[37]=f,e[38]=b,e[39]=F):F=e[39];let P;e[40]!==j?(P=()=>j(),e[40]=j,e[41]=P):P=e[41];const E=f&&"animate-spin";let N;e[42]!==E?(N=ge(E),e[42]=E,e[43]=N):N=e[43];let L;e[44]!==N?(L=s.jsx(_e,{size:14,className:N}),e[44]=N,e[45]=L):L=e[45];let q;e[46]!==f||e[47]!==P||e[48]!==L?(q=s.jsx("button",{type:"button",onClick:P,disabled:f,className:"text-muted-foreground hover:text-foreground disabled:opacity-50 transition-colors p-1 rounded-md hover:bg-muted/50","aria-label":"Refresh balance",children:L}),e[46]=f,e[47]=P,e[48]=L,e[49]=q):q=e[49];let R;e[50]!==F||e[51]!==q?(R=s.jsxs("div",{className:"flex items-baseline gap-2",children:[F,q]}),e[50]=F,e[51]=q,e[52]=R):R=e[52];let Y;e[53]===Symbol.for("react.memo_cache_sentinel")?(Y=s.jsx("p",{className:"text-xs text-muted-foreground",children:"Available credit balance"}),e[53]=Y):Y=e[53];let W;e[54]!==R?(W=s.jsxs("div",{className:"flex flex-col gap-2 pt-2",children:[R,Y]}),e[54]=R,e[55]=W):W=e[55];let se;e[56]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsxs("div",{className:"pt-4 border-t border-border/60",children:[s.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2.5",children:"Add credits"}),s.jsx(xt,{})]}),e[56]=se):se=e[56];let ie;return e[57]!==A||e[58]!==_||e[59]!==W?(ie=s.jsx(ue,{title:"Deco AI Gateway",children:s.jsx(me,{children:s.jsxs("div",{className:"px-5 py-5 flex flex-col gap-5",children:[A,_,W,se]})})}),e[57]=A,e[58]=_,e[59]=W,e[60]=ie):ie=e[60],ie}function _t(e){Q.error(`Failed to disconnect: ${e.message}`)}function St(e){return e.providerId==="deco"}function It(){const e=M.c(11),{org:t}=H();let i;e[0]!==t.id||e[1]!==t.slug?(i={connectionId:J,orgId:t.id,orgSlug:t.slug},e[0]=t.id,e[1]=t.slug,e[2]=i):i=e[2];const l=X(i),o=ne();let a;e[3]!==l?(a=async()=>{const p=await l.callTool({name:"AI_PROVIDER_PROVISION_KEY",arguments:{providerId:"deco"}});if(p?.isError)throw new Error(p.content?.[0]?.text??"Key provisioning failed")},e[3]=l,e[4]=a):a=e[4];let r;e[5]!==t.id||e[6]!==o?(r=()=>{Ie("ai_provider_provision_succeeded",{provider_id:"deco"}),o.invalidateQueries({queryKey:B.aiProviderKeys(t.id)}),o.invalidateQueries({queryKey:B.aiProviders(t.id)}),Q.success("Deco AI Gateway connected successfully")},e[5]=t.id,e[6]=o,e[7]=r):r=e[7];let n;return e[8]!==a||e[9]!==r?(n={mutationFn:a,onSuccess:r,onError:kt},e[8]=a,e[9]=r,e[10]=n):n=e[10],ee(n)}function kt(e){Ie("ai_provider_provision_failed",{provider_id:"deco",error:e.message}),Q.error(`Failed to connect Deco AI Gateway: ${e.message}`)}function Ct(){const e=M.c(10),{mutate:t,isPending:i}=It();let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=["radial-gradient(ellipse 50% 150% at -15% 50%, rgba(165,149,255,0.14) 0%, transparent 60%)","radial-gradient(ellipse 50% 150% at 115% 50%, rgba(208,236,26,0.11) 0%, transparent 60%)"],e[0]=l):l=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{backgroundImage:l.join(", ")}}),e[1]=o):o=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("img",{src:"/logos/deco%20logo.svg",alt:"Deco AI Gateway",className:"size-12 shrink-0 rounded-xl object-contain dark:bg-white dark:p-1"}),e[2]=a):a=e[2];let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("p",{className:"text-base font-semibold",children:"Deco AI Gateway"}),s.jsx("span",{className:"rounded-full border border-border/60 bg-background/60 px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Recommended"})]}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"100+ models, one connection — pay as you go, no API keys to juggle."})]}),e[3]=r):r=e[3];let n;e[4]!==t?(n=()=>t(),e[4]=t,e[5]=n):n=e[5];const p=i?"Connecting…":"Connect Deco";let y;return e[6]!==i||e[7]!==n||e[8]!==p?(y=s.jsxs("div",{className:"relative rounded-xl border border-border overflow-hidden",children:[o,s.jsxs("div",{className:"relative flex items-center gap-5 px-6 py-5",children:[a,r,s.jsx(V,{variant:"outline",disabled:i,onClick:n,children:p})]})]}),e[6]=i,e[7]=n,e[8]=p,e[9]=y):y=e[9],y}const Nt=G({label:C().min(1,"Label is required").max(100),apiKey:C().optional(),baseUrl:C().optional()});function wt({providerKey:e,provider:t,preset:i,maskedKey:l,currentLabel:o,currentBaseUrl:a,onCancel:r,onSuccess:n}){const{org:p}=H(),y=X({connectionId:J,orgId:p.id,orgSlug:p.slug}),S=ne(),[h,c]=O.useState(!1),u=t.id==="openai-compatible",k=t.supportedMethods.includes("api-key"),{register:m,handleSubmit:I,watch:v,formState:{errors:g}}=je({resolver:ve(Nt),defaultValues:{label:o,apiKey:"",baseUrl:a??""}}),x=v("apiKey")??"",{mutate:b,isPending:j}=ee({mutationFn:async f=>{let d;f.apiKey?u?d=JSON.stringify({baseUrl:f.baseUrl||a||"",apiKey:f.apiKey}):d=f.apiKey:u&&f.baseUrl&&f.baseUrl!==a&&(d=JSON.stringify({baseUrl:f.baseUrl,apiKey:""})),await y.callTool({name:"AI_PROVIDER_KEY_UPDATE",arguments:{keyId:e.id,label:f.label,...d!==void 0?{apiKey:d}:{}}})},onSuccess:()=>{S.invalidateQueries({queryKey:B.aiProviderKeys(p.id)}),S.invalidateQueries({queryKey:B.aiProviders(p.id)}),Q.success("Provider updated"),n()},onError:f=>Q.error(`Failed to update: ${f.message}`)});return s.jsxs("form",{onSubmit:I(f=>b(f)),className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Label"}),s.jsx(le,{placeholder:"e.g. Personal key",...m("label"),className:"h-8 text-sm"}),g.label&&s.jsx("p",{className:"text-xs text-destructive",children:g.label.message})]}),u&&!i?.defaultBaseUrl&&s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Base URL"}),s.jsx(le,{type:"url",placeholder:i?.baseUrlPlaceholder??"http://localhost:4000/v1",...m("baseUrl"),className:"h-8 text-sm"})]}),k&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["API key"," ",s.jsx("span",{className:"text-muted-foreground/60",children:"(leave blank to keep current)"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(le,{type:h&&x?"text":"password",placeholder:l,...m("apiKey"),className:"ph-no-capture h-8 text-sm pr-8"}),x&&s.jsx("button",{type:"button",onClick:()=>c(!h),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h?s.jsx(Xe,{size:14}):s.jsx(Ze,{size:14})})]})]}),i?.helpText&&s.jsx("p",{className:"text-xs text-muted-foreground",children:i.helpText}),s.jsxs(et,{children:[s.jsx(V,{type:"button",variant:"ghost",size:"sm",onClick:r,disabled:j,children:"Cancel"}),s.jsx(V,{type:"submit",size:"sm",disabled:j,children:j?"Saving...":"Save"})]})]})}function Pt(e){const t=M.c(31),{providerKey:i,provider:l,open:o,onOpenChange:a}=e,{org:r}=H();let n;t[0]!==r.id||t[1]!==r.slug?(n={connectionId:J,orgId:r.id,orgSlug:r.slug},t[0]=r.id,t[1]=r.slug,t[2]=n):n=t[2];const p=X(n);let y;t[3]!==l.id||t[4]!==i.presetId?(y=l.id==="openai-compatible"&&i.presetId?Re.find(j=>j.id===i.presetId):void 0,t[3]=l.id,t[4]=i.presetId,t[5]=y):y=t[5];const S=y,h=S?.name??l.name;let c;t[6]!==i.id?(c=B.aiProviderKeyPreview(i.id),t[6]=i.id,t[7]=c):c=t[7];let u;t[8]!==p||t[9]!==i.id?(u=async()=>(await p.callTool({name:"AI_PROVIDER_KEY_PREVIEW",arguments:{keyId:i.id}})).structuredContent,t[8]=p,t[9]=i.id,t[10]=u):u=t[10];let k;t[11]!==o||t[12]!==c||t[13]!==u?(k={queryKey:c,queryFn:u,enabled:o,staleTime:0},t[11]=o,t[12]=c,t[13]=u,t[14]=k):k=t[14];const{data:m,isLoading:I}=Se(k);let v;t[15]!==h?(v=s.jsx(tt,{children:s.jsxs(st,{children:["Edit ",h]})}),t[15]=h,t[16]=v):v=t[16];let g;t[17]!==I||t[18]!==a||t[19]!==S||t[20]!==m||t[21]!==l||t[22]!==i?(g=I||!m?s.jsx("div",{className:"flex justify-center py-8",children:s.jsx(rt,{})}):s.jsx(wt,{providerKey:i,provider:l,preset:S,maskedKey:m.maskedKey,currentLabel:m.label,currentBaseUrl:m.baseUrl,onCancel:()=>a(!1),onSuccess:()=>a(!1)}),t[17]=I,t[18]=a,t[19]=S,t[20]=m,t[21]=l,t[22]=i,t[23]=g):g=t[23];let x;t[24]!==v||t[25]!==g?(x=s.jsxs(it,{className:"sm:max-w-md",children:[v,g]}),t[24]=v,t[25]=g,t[26]=x):x=t[26];let b;return t[27]!==a||t[28]!==o||t[29]!==x?(b=s.jsx(ot,{open:o,onOpenChange:a,children:x}),t[27]=a,t[28]=o,t[29]=x,t[30]=b):b=t[30],b}function At(e){const t=M.c(51),{providerKey:i,provider:l}=e,{org:o}=H();let a;t[0]!==o.id||t[1]!==o.slug?(a={connectionId:J,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=a):a=t[2];const r=X(a),n=ne(),[p,y]=O.useState(!1),[S,h]=O.useState(!1),c=l.id==="openai-compatible";let u;t[3]!==c||t[4]!==i.presetId?(u=c&&i.presetId?Re.find(q=>q.id===i.presetId):void 0,t[3]=c,t[4]=i.presetId,t[5]=u):u=t[5];const k=u,m=k?k.name:c?"Custom OpenAI-compatible":l.name,I=k?.logo??l.logo;let v;e:{if(c){v=i.label;break e}const q=i.label;let R;t[6]!==i.createdAt?(R=lt(new Date(i.createdAt)),t[6]=i.createdAt,t[7]=R):R=t[7],v=`${q} · added ${R} ago`}const g=v;let x;t[8]!==r||t[9]!==i.id?(x=async()=>{await r.callTool({name:"AI_PROVIDER_KEY_DELETE",arguments:{keyId:i.id}})},t[8]=r,t[9]=i.id,t[10]=x):x=t[10];let b;t[11]!==o.id||t[12]!==i.id||t[13]!==n?(b=()=>{n.invalidateQueries({queryKey:B.aiProviderKeys(o.id)}),n.invalidateQueries({queryKey:B.aiProviders(o.id)}),n.invalidateQueries({queryKey:B.aiProviderModels(o.id,i.id)}),Q.success("Key deleted"),y(!1)},t[11]=o.id,t[12]=i.id,t[13]=n,t[14]=b):b=t[14];let j;t[15]!==x||t[16]!==b?(j={mutationFn:x,onSuccess:b,onError:Dt},t[15]=x,t[16]=b,t[17]=j):j=t[17];const{mutate:f,isPending:d}=ee(j);let w;t[18]!==m||t[19]!==I?(w=I?s.jsx("img",{src:I,alt:m,className:"size-8 rounded-md object-contain dark:bg-white dark:p-0.5"}):s.jsx(He,{fallback:m.charAt(0),className:"size-8 bg-primary/10 text-primary"}),t[18]=m,t[19]=I,t[20]=w):w=t[20];let U;t[21]===Symbol.for("react.memo_cache_sentinel")?(U=s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>h(!0),children:s.jsx(Ye,{size:14})}),t[21]=U):U=t[21];let T,z;t[22]===Symbol.for("react.memo_cache_sentinel")?(z=()=>y(!0),T=s.jsx(We,{size:14}),t[22]=T,t[23]=z):(T=t[22],z=t[23]);let A;t[24]!==d?(A=s.jsxs("div",{className:"flex items-center gap-0.5",children:[U,s.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",disabled:d,onClick:z,children:T})]}),t[24]=d,t[25]=A):A=t[25];let D;t[26]!==g||t[27]!==m||t[28]!==A||t[29]!==w?(D=s.jsx(ke,{icon:w,title:m,description:g,action:A}),t[26]=g,t[27]=m,t[28]=A,t[29]=w,t[30]=D):D=t[30];let K;t[31]!==S||t[32]!==l||t[33]!==i?(K=s.jsx(Pt,{providerKey:i,provider:l,open:S,onOpenChange:h}),t[31]=S,t[32]=l,t[33]=i,t[34]=K):K=t[34];let $;t[35]===Symbol.for("react.memo_cache_sentinel")?($=s.jsx(we,{children:"Delete API key"}),t[35]=$):$=t[35];let _;t[36]!==i.label?(_=s.jsxs(Ne,{children:[$,s.jsxs(Pe,{children:["This action cannot be undone. This will permanently delete"," ",s.jsx("span",{className:"font-medium text-foreground",children:i.label}),"."]})]}),t[36]=i.label,t[37]=_):_=t[37];let F;t[38]===Symbol.for("react.memo_cache_sentinel")?(F=s.jsx(Ae,{children:"Cancel"}),t[38]=F):F=t[38];let P;t[39]!==f?(P=s.jsxs(Ke,{children:[F,s.jsx(Ee,{onClick:()=>f(),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]}),t[39]=f,t[40]=P):P=t[40];let E;t[41]!==_||t[42]!==P?(E=s.jsxs(De,{children:[_,P]}),t[41]=_,t[42]=P,t[43]=E):E=t[43];let N;t[44]!==p||t[45]!==E?(N=s.jsx(Fe,{open:p,onOpenChange:y,children:E}),t[44]=p,t[45]=E,t[46]=N):N=t[46];let L;return t[47]!==D||t[48]!==K||t[49]!==N?(L=s.jsxs(s.Fragment,{children:[D,K,N]}),t[47]=D,t[48]=K,t[49]=N,t[50]=L):L=t[50],L}function Dt(e){return Q.error(`Failed to delete key: ${e.message}`)}function Kt(e){const t=M.c(11),{onConnectClick:i}=e,l=te(),o=Ce();let a;t[0]!==o?.providers?(a=o?.providers??[],t[0]=o?.providers,t[1]=a):a=t[1];const r=a;let n;if(t[2]!==l||t[3]!==i||t[4]!==r){let p;t[6]!==r?(p=c=>({key:c,provider:r.find(u=>u.id===c.providerId)}),t[6]=r,t[7]=p):p=t[7];const y=l.filter(Rt).map(p).filter(Ft);let S;t[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Qe,{size:14}),t[8]=S):S=t[8];let h;t[9]!==i?(h=s.jsxs(V,{size:"sm",onClick:i,children:[S,"Connect provider"]}),t[9]=i,t[10]=h):h=t[10],n=s.jsx(ue,{title:"Connected providers",headerClassName:"px-0",actions:h,children:y.length===0?s.jsx("p",{className:"text-sm text-muted-foreground px-1",children:"Bring your own keys to use specific models alongside Deco's gateway."}):s.jsx(me,{children:y.map(Et)})}),t[2]=l,t[3]=i,t[4]=r,t[5]=n}else n=t[5];return n}function Et(e){const{key:t,provider:i}=e;return s.jsx(At,{providerKey:t,provider:i},t.id)}function Ft(e){return e.provider!==void 0}function Rt(e){return e.providerId!=="deco"}function $t(e){const t=M.c(3),{error:i}=e;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(Te,{size:16}),t[0]=l):l=t[0];let o;return t[1]!==i.message?(o=s.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[l,s.jsxs("span",{className:"text-sm font-medium",children:["Failed to load AI providers: ",i.message]})]}),t[1]=i.message,t[2]=o):o=t[2],o}function Ot(){const e=M.c(23),t=te();let i;e[0]!==t?(i=t.some(Tt),e[0]=t,e[1]=i):i=e[1];const l=i,o=t.length>0,[a,r]=O.useState(!1),[n,p]=O.useState(null),y=Ce();let S;e[2]!==y?.providers?(S=y?.providers??[],e[2]=y?.providers,e[3]=S):S=e[3];const h=S;if(!o){let v;e[4]===Symbol.for("react.memo_cache_sentinel")?(v=()=>r(!0),e[4]=v):v=e[4];let g;e[5]!==h?(g=s.jsx(Je,{providers:h,onSelect:p,onShowAll:v}),e[5]=h,e[6]=g):g=e[6];const x=n!==null||a;let b;e[7]===Symbol.for("react.memo_cache_sentinel")?(b=w=>{w||(p(null),r(!1))},e[7]=b):b=e[7];const j=n??void 0;let f;e[8]!==x||e[9]!==j?(f=s.jsx(xe,{open:x,onOpenChange:b,initialProvider:j}),e[8]=x,e[9]=j,e[10]=f):f=e[10];let d;return e[11]!==g||e[12]!==f?(d=s.jsxs(s.Fragment,{children:[g,f]}),e[11]=g,e[12]=f,e[13]=d):d=e[13],d}let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(O.Suspense,{fallback:s.jsx(de,{className:"h-16 w-full"}),children:s.jsx(pt,{})}),e[14]=c):c=e[14];let u;e[15]!==l?(u=l?s.jsx(jt,{}):s.jsx(Ct,{}),e[15]=l,e[16]=u):u=e[16];let k;e[17]===Symbol.for("react.memo_cache_sentinel")?(k=s.jsx(Kt,{onConnectClick:()=>r(!0)}),e[17]=k):k=e[17];let m;e[18]!==a?(m=s.jsx(xe,{open:a,onOpenChange:r}),e[18]=a,e[19]=m):m=e[19];let I;return e[20]!==u||e[21]!==m?(I=s.jsxs(s.Fragment,{children:[c,u,k,m]}),e[20]=u,e[21]=m,e[22]=I):I=e[22],I}function Tt(e){return e.providerId==="deco"}function Mt(){const e=M.c(2);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(oe.Title,{children:"AI Providers"}),e[0]=t):t=e[0];let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(oe,{children:s.jsx(oe.Content,{children:s.jsx(oe.Body,{children:s.jsxs(Me,{children:[t,s.jsx(Oe,{fallback:Ut,children:s.jsx(O.Suspense,{fallback:s.jsx(de,{className:"h-64 w-full"}),children:s.jsx(Ot,{})})})]})})})}),e[1]=i):i=e[1],i}function Ut(e){const{error:t}=e;return s.jsx($t,{error:t??new Error("Failed to load AI providers")})}function Vs(){const e=M.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=s.jsx(nt,{capability:"ai-providers:manage",area:"AI providers",children:s.jsx(Mt,{})}),e[0]=t):t=e[0],t}export{Vs as default};
@@ -1 +0,0 @@
1
- import{e as M,r as S,j as o,l as q}from"./index-Bja6OpPs.js";import{S as G}from"./scroll-area-Ds73tc0J.js";import{j as H,a4 as J,d as Q}from"./index-t_7wQBv1.js";import{S as U}from"./schema-form-DvpyibqS.js";import{S as W}from"./save-status-DRXktsXS.js";import"./select-fwtyEN3G.js";import"./tooltip-BvIsFjJR.js";import"./Check-CtI-OH3k.js";import"./ChevronDown-BL2fNdeZ.js";import"./ChevronUp-O10NbvHe.js";import"./agent-capabilities-BE7hHGoA.js";import"./pair-CCKXkNYO.js";import"./agent-icon-D4vfmbIE.js";import"./AlertCircle-f1EMyhcF.js";import"./Tool01-D7SzxWeU.js";import"./SwitchHorizontal01-Den03c4j.js";import"./RefreshCcw01-CxP3kNii.js";import"./XCircle-DBS00WN3.js";import"./ArrowUpRight-DDOS_CqL.js";import"./ZapSquare-CC0ClMfp.js";import"./Users03-e9b5gRLu.js";import"./CheckCircle-Dk0E48Vj.js";import"./ChevronLeft-ItYaMHNU.js";import"./ChevronRight-TMlXoq-Z.js";import"./DotsVertical-DNPNHBpl.js";import"./Container-B1sUXs1U.js";import"./Eye-DWIY-6KS.js";import"./ZoomOut-Bj5jamAx.js";import"./Globe01-Cjaw-3jR.js";import"./FilterLines-CWRo79Yt.js";import"./Star01-BT882_xb.js";import"./Palette-DkgVQjRz.js";import"./HardDrive-Ddx5WtDi.js";import"./Stars02-lM9wDOP9.js";import"./Key01-ChvR9ujt.js";import"./sheet-IM6_8Cdx.js";import"./X-DvNDI9Zw.js";import"./LinkExternal01-Bo28LxVY.js";import"./Monitor01-Cx9Nl0mU.js";import"./Sun-CNIfXy2-.js";import"./Play-VGEgQ-36.js";import"./Plus-DXVOsj8b.js";import"./SearchMd-B9xeWi0e.js";import"./Settings02-DYlioLKt.js";import"./Shield01-CLHpjaQL.js";import"./Stars01-DDxsFd_C.js";import"./Trash01-C2MDqKmR.js";import"./Upload01-BTsf5tML.js";import"./User01-B1vfX-f8.js";import"./Users01-dpqTHJ7Y.js";import"./XClose-BdAeKt9F.js";import"./Zap-aFVcxgaa.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-BKbXbMuY.js";import"./file-type-icon-DM9XMqae.js";import"./dialog-DCjJZndp.js";import"./content-blocks-o63cs2vh.js";import"./types-Dn1K45P2.js";import"./constants-Oykg5_q9.js";import"./chat-context-Bnval_3z.js";import"./tab-id-BFVzx5fb.js";import"./decopilot-sse-pool-02ukeQqS.js";import"./create-sse-subscription-BS5983N4.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-virtual-mcp-BNfSbQBW.js";import"./use-collections-e25i0NM-.js";import"./use-ai-providers-BQwBnNI3.js";import"./use-organization-settings-CVmm-jyI.js";import"./shell-layout-I9tl7R9J.js";import"./avatar-ETg7Q-GU.js";import"./required-auth-layout-CRGKVRTF.js";import"./useRouterState-CI4Wmw4H.js";import"./use-org-sso-D2JNbrnR.js";import"./integration-icon-BffTGZN4.js";import"./use-navigate-to-agent-sJoZ-Wbv.js";import"./use-connection-BQxCYR_o.js";import"./use-mcp-prompts-D9JZQ88U.js";import"./form-DMPH0FOJ.js";import"./label-BL0BsZ1B.js";import"./input-D9gxUyjr.js";import"./spinner-D4UjUyLz.js";import"./drawer-BTJhbpa8.js";import"./collection-search-BPGQygd8.js";import"./tabs-Dsmq9_wP.js";import"./toggle-group-BkLJ1frl.js";import"./connect-desktop-dialog-CqBwflr-.js";import"./agent-icons-UJTit2wi.js";import"./checkbox-DWa4G7u9.js";import"./skeleton-CM-Pi0cm.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-T0fDyncu.js";import"./card-lOxFSSkP.js";import"./popover-OiarPewu.js";import"./command-B3U7wd2O.js";import"./index-DtSBWsbe.js";import"./useInfiniteQuery-Bj3r3xlf.js";import"./infiniteQueryObserver-DFB-ygfX.js";import"./sortable.esm-KFDeRhD3.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-DG_N0P2G.js";import"./use-registry-connections-B6OVBI_G.js";import"./extract-connection-data-AirIeyvr.js";import"./generate-id-i1xx8q5L.js";import"./collections-NKJwWp8f.js";import"./collection-tabs-C_qWo2-y.js";import"./badge-C8j1DE3m.js";import"./textarea-DGZy_omr.js";import"./connection-form-helpers-D79c5tFA.js";import"./use-infinite-scroll-DcQNoJ7_.js";import"./useSuspenseInfiniteQuery-BbAiO9h1.js";import"./index-lU9yS_Jh.js";import"./dropdown-menu-BnsK64En.js";import"./question-004-sINsf4GQ.js";import"./shell-route-loading-CdGn4Kpm.js";import"./sidebar-CAkfGpdS.js";import"./toolbar-Bnt0c2J3.js";import"./use-create-virtual-mcp-trxCQUHO.js";import"./github-repo-picker-CTcBo2fn.js";import"./use-mcp-tools-DkcEQK3V.js";import"./alert-dialog-DKXzP7Bt.js";import"./index-C7oVr4Gj.js";import"./use-org-auth-client-CF8P1btO.js";import"./hover-card-CxtN1xCB.js";import"./task-status-C990ALOP.js";import"./use-status-sounds-gVglgYnC.js";import"./empty-state-CKyi-9Wl.js";import"./resizable-a1gJgrB1.js";import"./use-capability-rrurYBXm.js";import"./header-tab-button-CJMFloVi.js";import"./index-CALXjj7d.js";import"./user-ChT4iOGQ.js";import"./tools-list-Dpd5zOg1.js";import"./switch-DB7mlnDa.js";import"./use-debounced-autosave-Oryp4cAP.js";import"./index-N_rB2zyq.js";import"./search-input-BNN911DE.js";import"./use-secrets-_k7d1I4Z.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-BFQ7Yu8X.js";import"./view-mode-toggle-DCljG_Km.js";import"./select-model-D7RFa4up.js";import"./use-automations-BEPg-aek.js";import"./monaco-editor-DtMcxLSi.js";import"./automation-runs-CPH-3xtw.js";import"./table-Cd_YQk4M.js";import"./use-members-DERsL77r.js";import"./automation-list-row-c065EJtO.js";import"./calendar-CLbDOOHw.js";import"./image-field-HoCNk-1B.js";import"./use-file-configs-Qrd6eZyZ.js";function Mo(g){const t=M.c(38),{orgSlug:N,virtualMcpId:_,branch:k,blockKey:r,block:i,meta:m,title:E,excludeFields:n,schemaPending:C}=g,P=C===void 0?!1:C,e=typeof i?.__resolveType=="string"?i.__resolveType:"";let d;if(t[0]!==n||t[1]!==m||t[2]!==e){const c=e?H(e,m):null;d=c&&n?.length?{...c,properties:Object.fromEntries(Object.entries(c.properties??{}).filter(y=>{const[I]=y;return!n.includes(I)}))}:c,t[0]=n,t[1]=m,t[2]=e,t[3]=d}else d=t[3];const f=d;let u;t[4]!==i||t[5]!==r||t[6]!==m||t[7]!==E?(u=E??(i?J(r,i,m):r),t[4]=i,t[5]=r,t[6]=m,t[7]=E,t[8]=u):u=t[8];const B=u;let x;t[9]!==k||t[10]!==N||t[11]!==_?(x={orgSlug:N,virtualMcpId:_,branch:k},t[9]=k,t[10]=N,t[11]=_,t[12]=x):x=t[12];const{save:K,isPending:R}=Q(x),[A,L]=S.useState(r),[z,O]=S.useState(null),[V,D]=S.useState(0);let h;t[13]===Symbol.for("react.memo_cache_sentinel")?(h=[],t[13]=h):h=t[13];const[w,$]=S.useState(h);A!==r&&(L(r),O(null),D(X),$([]));let v;t[14]!==i?(v=i??{},t[14]=i,t[15]=v):v=t[15];const F=z??v;let b;t[16]!==r||t[17]!==e||t[18]!==K?(b=c=>{const y=c;O(y),K(r,{...y,__resolveType:e})},t[16]=r,t[17]=e,t[18]=K,t[19]=b):b=t[19];const T=b;let p;t[20]!==B?(p=o.jsx("span",{className:"text-sm font-medium",children:B}),t[20]=B,t[21]=p):p=t[21];let s;t[22]!==R?(s=o.jsx(W,{isPending:R,isError:!1}),t[22]=R,t[23]=s):s=t[23];let l;t[24]!==p||t[25]!==s?(l=o.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[p,s]}),t[24]=p,t[25]=s,t[26]=l):l=t[26];let a;t[27]!==r||t[28]!==w||t[29]!==F||t[30]!==V||t[31]!==T||t[32]!==f||t[33]!==P?(a=o.jsx(G,{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:f?o.jsx(U,{schema:f,value:F,onChange:T,basePath:"",breadcrumbPath:w,onBreadcrumbChange:$},`${r}:${V}`):P?o.jsxs("div",{className:"flex flex-col items-center gap-2 py-6 text-center text-xs text-muted-foreground",children:[o.jsx(q,{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[27]=r,t[28]=w,t[29]=F,t[30]=V,t[31]=T,t[32]=f,t[33]=P,t[34]=a):a=t[34];let j;return t[35]!==l||t[36]!==a?(j=o.jsxs("div",{className:"flex h-full flex-col",children:[l,a]}),t[35]=l,t[36]=a,t[37]=j):j=t[37],j}function X(g){return g+1}export{Mo as AppEditor};
@@ -1 +0,0 @@
1
- import{e as k,j as o,q as L,f as T,r as $,B as M,t as N}from"./index-Bja6OpPs.js";import{s as q}from"./Plus-DXVOsj8b.js";import{i as S}from"./Zap-aFVcxgaa.js";import{S as D}from"./search-input-BNN911DE.js";import{P as l}from"./index-N_rB2zyq.js";import{E as b}from"./empty-state-CKyi-9Wl.js";import{c as O}from"./use-automations-BEPg-aek.js";import{k as V}from"./use-navigate-to-agent-sJoZ-Wbv.js";import{A as F}from"./automation-list-row-c065EJtO.js";import{h as G}from"./constants-Oykg5_q9.js";import{a as H}from"./use-virtual-mcp-BNfSbQBW.js";import{R as J}from"./require-capability-DVkbMmft.js";import"./SearchMd-B9xeWi0e.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./X-DvNDI9Zw.js";import"./tooltip-BvIsFjJR.js";import"./alert-dialog-DKXzP7Bt.js";import"./dropdown-menu-BnsK64En.js";import"./Check-CtI-OH3k.js";import"./ChevronRight-TMlXoq-Z.js";import"./DotsVertical-DNPNHBpl.js";import"./agent-icon-D4vfmbIE.js";import"./AlertCircle-f1EMyhcF.js";import"./Tool01-D7SzxWeU.js";import"./SwitchHorizontal01-Den03c4j.js";import"./RefreshCcw01-CxP3kNii.js";import"./XCircle-DBS00WN3.js";import"./ArrowUpRight-DDOS_CqL.js";import"./ZapSquare-CC0ClMfp.js";import"./Users03-e9b5gRLu.js";import"./CheckCircle-Dk0E48Vj.js";import"./ChevronDown-BL2fNdeZ.js";import"./ChevronLeft-ItYaMHNU.js";import"./ChevronUp-O10NbvHe.js";import"./Container-B1sUXs1U.js";import"./Eye-DWIY-6KS.js";import"./ZoomOut-Bj5jamAx.js";import"./Globe01-Cjaw-3jR.js";import"./FilterLines-CWRo79Yt.js";import"./Star01-BT882_xb.js";import"./Palette-DkgVQjRz.js";import"./HardDrive-Ddx5WtDi.js";import"./Stars02-lM9wDOP9.js";import"./Key01-ChvR9ujt.js";import"./LinkExternal01-Bo28LxVY.js";import"./Monitor01-Cx9Nl0mU.js";import"./Sun-CNIfXy2-.js";import"./Play-VGEgQ-36.js";import"./Settings02-DYlioLKt.js";import"./Shield01-CLHpjaQL.js";import"./Stars01-DDxsFd_C.js";import"./Trash01-C2MDqKmR.js";import"./Upload01-BTsf5tML.js";import"./User01-B1vfX-f8.js";import"./Users01-dpqTHJ7Y.js";import"./XClose-BdAeKt9F.js";import"./use-collections-e25i0NM-.js";import"./use-capability-rrurYBXm.js";import"./access-gate-B8AAPT1T.js";import"./capability-load-error-DVzMymKs.js";function K(){const t=k.c(16),{org:i}=L(),{data:w}=O(void 0),u=w===void 0?[]:w,B=H(),R=V(),d=T(),[f,E]=$.useState(""),g=f.toLowerCase(),y=new Map(B.map(Q)),C=u.filter(e=>{if(!g||e.name.toLowerCase().includes(g))return!0;if(e.virtual_mcp_id){const m=y.get(e.virtual_mcp_id);if(m&&m.title.toLowerCase().includes(g))return!0}return!1}),P=(e,m)=>{const A=m&&y.has(m)?m:G(i.id);N("automations_list_row_clicked",{automation_id:e,agent_id:A,source:"settings_automations"}),R(A,{search:{main:"automation:"+e}})};let n;t[0]!==d||t[1]!==i.slug?(n=()=>{N("automations_empty_state_browse_agents_clicked"),d({to:"/$org/settings/agents",params:{org:i.slug}})},t[0]=d,t[1]=i.slug,t[2]=n):n=t[2];const z=n,x=l,h=l,j=l;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(l.Title,{children:"Automations"}),t[3]=p):p=t[3];const _=u.length>0&&o.jsx(D,{value:f,onChange:E,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let r;t[4]!==_?(r=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,_]}),t[4]=_,t[5]=r):r=t[5];const v=u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Automations are created per agent. Open an agent and add one from its Automations tab.",actions:o.jsxs(M,{size:"sm",onClick:z,children:[o.jsx(q,{size:14}),"Browse agents"]})})}):C.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(b,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${f}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:C.map(e=>o.jsx(F,{automation:e,showAgent:!0,onClick:()=>P(e.id,e.virtual_mcp_id)},e.id))});let s;t[6]!==j.Body||t[7]!==r||t[8]!==v?(s=o.jsxs(j.Body,{children:[r,v]}),t[6]=j.Body,t[7]=r,t[8]=v,t[9]=s):s=t[9];let a;t[10]!==h.Content||t[11]!==s?(a=o.jsx(h.Content,{children:s}),t[10]=h.Content,t[11]=s,t[12]=a):a=t[12];let c;return t[13]!==x||t[14]!==a?(c=o.jsx(x,{children:a}),t[13]=x,t[14]=a,t[15]=c):c=t[15],c}function Q(t){return[t.id,t]}function oo(){const t=k.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(J,{capability:"automations:manage",area:"automations",children:o.jsx(K,{})}),t[0]=i):i=t[0],i}export{oo as default};
@@ -1 +0,0 @@
1
- import{e as X,W as Ie,q as ze,F as Le,K as Re,n as Ke,a as ge,j as n,B as Te,t as V,o as U,r as Oe,G as Ue,c as _e,C as fe}from"./index-Bja6OpPs.js";import{S as Xe,u as qe}from"./constants-Oykg5_q9.js";import{t as He}from"./ChevronDown-BL2fNdeZ.js";import{i as Me}from"./ChevronRight-TMlXoq-Z.js";import{s as Ve,t as Ge}from"./Star01-BT882_xb.js";import{n as Qe}from"./LinkExternal01-Bo28LxVY.js";import{s as Pe}from"./Plus-DXVOsj8b.js";import{s as We}from"./Trash01-C2MDqKmR.js";import{i as Ye}from"./Zap-aFVcxgaa.js";import{c as Je,b as Ze,d as et,f as tt,g as st,e as nt,a as lt,A as ot}from"./alert-dialog-DKXzP7Bt.js";import{I as ue}from"./input-D9gxUyjr.js";import{T as rt}from"./textarea-DGZy_omr.js";import{P as Ne}from"./index-N_rB2zyq.js";import{u as $e}from"./unwrap-tool-result-BYXdCQMg.js";import{u as at}from"./use-debounced-autosave-Oryp4cAP.js";import{R as it}from"./require-capability-DVkbMmft.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./X-DvNDI9Zw.js";import"./tooltip-BvIsFjJR.js";import"./use-capability-rrurYBXm.js";import"./access-gate-B8AAPT1T.js";import"./capability-load-error-DVzMymKs.js";function we(t){const e=X.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 i;e[2]!==s?(i=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]=i):i=e[3];let d;return e[4]!==o||e[5]!==r||e[6]!==i?(d=n.jsxs("div",{className:r,children:[i,o]}),e[4]=o,e[5]=r,e[6]=i,e[7]=d):d=e[7],d}function ct(t){const e=X.c(25),{onExtract:s,isExtracting:o}=t,[l,r]=Oe.useState("");let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=n.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10",children:n.jsx(Ye,{size:18,className:"text-primary"})}),e[0]=i):i=e[0];let d,u;e[1]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("p",{className:"text-sm font-medium text-foreground",children:"Auto-extract brand context"}),u=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]=d,e[2]=u):(d=e[1],u=e[2]);let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=f=>r(f.target.value),e[3]=p):p=e[3];let b;e[4]!==l||e[5]!==o||e[6]!==s?(b=f=>{f.key==="Enter"&&l.trim()&&!o&&s(l.trim())},e[4]=l,e[5]=o,e[6]=s,e[7]=b):b=e[7];let m;e[8]!==l||e[9]!==b?(m=n.jsx(ue,{placeholder:"acme.com",value:l,onChange:p,className:"max-w-xs",onKeyDown:b}),e[8]=l,e[9]=b,e[10]=m):m=e[10];let c;e[11]!==l||e[12]!==o?(c=!l.trim()||o,e[11]=l,e[12]=o,e[13]=c):c=e[13];let a;e[14]!==l||e[15]!==s?(a=()=>s(l.trim()),e[14]=l,e[15]=s,e[16]=a):a=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(Ve,{size:14}),e[17]=x):x=e[17];const g=o?"Extracting...":"Extract";let h;e[18]!==g||e[19]!==c||e[20]!==a?(h=n.jsxs(Te,{variant:"outline",disabled:c,onClick:a,children:[x,g]}),e[18]=g,e[19]=c,e[20]=a,e[21]=h):h=e[21];let v;return e[22]!==h||e[23]!==m?(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:[i,n.jsxs("div",{className:"flex-1",children:[d,u,n.jsxs("div",{className:"mt-3 flex gap-2",children:[m,h]})]})]})}),e[22]=h,e[23]=m,e[24]=v):v=e[24],v}function dt(t){const e=X.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 i=r;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=n.jsx("label",{className:"mb-1 block text-xs text-muted-foreground",children:"Company name"}),e[2]=d):d=e[2];let u;e[3]!==o||e[4]!==l?(u=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Acme Corp"})},e[3]=o,e[4]=l,e[5]=u):u=e[5];let p;e[6]!==s.control||e[7]!==u?(p=n.jsxs("div",{children:[d,n.jsx(fe,{control:s.control,name:"name",render:u})]}),e[6]=s.control,e[7]=u,e[8]=p):p=e[8];let b;e[9]===Symbol.for("react.memo_cache_sentinel")?(b=n.jsx("span",{children:"Domain"}),e[9]=b):b=e[9];let m;e[10]!==i?(m=i&&n.jsxs("a",{href:`https://${i}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 transition-colors hover:text-foreground",children:[n.jsx(Qe,{size:10}),"open"]}),e[10]=i,e[11]=m):m=e[11];let c;e[12]!==m?(c=n.jsxs("label",{className:"mb-1 flex items-center justify-between text-xs text-muted-foreground",children:[b,m]}),e[12]=m,e[13]=c):c=e[13];let a;e[14]!==o||e[15]!==l?(a=D=>{const{field:y}=D;return n.jsx(ue,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"acme.com"})},e[14]=o,e[15]=l,e[16]=a):a=e[16];let x;e[17]!==s.control||e[18]!==a?(x=n.jsx(fe,{control:s.control,name:"domain",render:a}),e[17]=s.control,e[18]=a,e[19]=x):x=e[19];let g;e[20]!==c||e[21]!==x?(g=n.jsxs("div",{children:[c,x]}),e[20]=c,e[21]=x,e[22]=g):g=e[22];let h;e[23]!==g||e[24]!==p?(h=n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p,g]}),e[23]=g,e[24]=p,e[25]=h):h=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 f;e[27]!==o||e[28]!==l?(f=D=>{const{field:y}=D;return n.jsx(rt,{...y,onChange:N=>{y.onChange(N),o()},onBlur:()=>{y.onBlur(),l()},placeholder:"Brief description of what the company does...",rows:3})},e[27]=o,e[28]=l,e[29]=f):f=e[29];let C;e[30]!==s.control||e[31]!==f?(C=n.jsxs("div",{children:[v,n.jsx(fe,{control:s.control,name:"overview",render:f})]}),e[30]=s.control,e[31]=f,e[32]=C):C=e[32];let w;return e[33]!==h||e[34]!==C?(w=n.jsx(we,{title:"Company Overview",children:n.jsxs("div",{className:"space-y-3",children:[h,C]})}),e[33]=h,e[34]=C,e[35]=w):w=e[35],w}const mt={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 Ae(t){const e=X.c(22),{form:s,name:o,label:l,imgClassName:r,onFieldChange:i,onFieldCommit:d}=t,u=r===void 0?"h-full w-full object-contain p-3":r;let p;e[0]!==s||e[1]!==o?(p=s.watch(o),e[0]=s,e[1]=o,e[2]=p):p=e[2];const b=p;let m;e[3]!==u||e[4]!==l||e[5]!==b?(m=n.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-xl",style:mt,children:b?n.jsx("img",{src:b,alt:l,className:u,loading:"lazy"}):n.jsxs("span",{className:"text-[10px] text-muted-foreground/70",children:["No ",l.toLowerCase()]})}),e[3]=u,e[4]=l,e[5]=b,e[6]=m):m=e[6];let c;e[7]!==l?(c=n.jsxs("label",{className:"mb-1 block text-xs text-muted-foreground",children:[l," URL"]}),e[7]=l,e[8]=c):c=e[8];let a;e[9]!==i||e[10]!==d?(a=v=>{const{field:f}=v;return n.jsx(ue,{...f,onChange:C=>{f.onChange(C),i()},onBlur:()=>{f.onBlur(),d()},placeholder:"https://..."})},e[9]=i,e[10]=d,e[11]=a):a=e[11];let x;e[12]!==s.control||e[13]!==o||e[14]!==a?(x=n.jsx(fe,{control:s.control,name:o,render:a}),e[12]=s.control,e[13]=o,e[14]=a,e[15]=x):x=e[15];let g;e[16]!==c||e[17]!==x?(g=n.jsxs("div",{className:"flex-1",children:[c,x]}),e[16]=c,e[17]=x,e[18]=g):g=e[18];let h;return e[19]!==m||e[20]!==g?(h=n.jsxs("div",{className:"flex items-start gap-3",children:[m,g]}),e[19]=m,e[20]=g,e[21]=h):h=e[21],h}function ft(t){const e=X.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(Ae,{form:s,name:"logo",label:"Logo",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{form:s,name:"favicon",label:"Favicon",imgClassName:"h-12 w-12 object-contain",onFieldChange:o,onFieldCommit:l}),n.jsx(Ae,{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 ut=[{key:"heading",label:"Headings"},{key:"body",label:"Body"},{key:"code",label:"Code"}];function xt(t){const e=X.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=ut.map(d=>{const{key:u,label:p}=d,b=`fonts.${u}`,m=s.watch(b);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:p}),m&&n.jsx("span",{className:"ml-auto truncate text-foreground",style:{fontFamily:m},children:m})]}),n.jsx(fe,{control:s.control,name:b,render:c=>{const{field:a}=c;return n.jsx(ue,{...a,value:a.value??"",onChange:x=>{a.onChange(x),o()},onBlur:()=>{a.onBlur(),l()},placeholder:`Font family for ${p.toLowerCase()}`})}})]},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Fonts",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}const gt=[{key:"primary",label:"Primary"},{key:"secondary",label:"Secondary"},{key:"accent",label:"Accent"},{key:"background",label:"Background"},{key:"foreground",label:"Foreground"}];function ht(t){const e=X.c(6),{form:s,onFieldChange:o,onFieldCommit:l}=t;let r;e[0]!==s||e[1]!==o||e[2]!==l?(r=gt.map(d=>{const{key:u,label:p}=d,b=`colors.${u}`;return n.jsx(fe,{control:s.control,name:b,render:m=>{const{field:c}=m;return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"color",value:c.value??"#000000",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.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:c.value??"",onChange:a=>{c.onChange(a.target.value),o()},onBlur:()=>{c.onBlur(),l()},placeholder:"#000000",className:"w-28"}),n.jsx("span",{className:"flex-1 text-xs text-muted-foreground",children:p})]})}},u)}),e[0]=s,e[1]=o,e[2]=l,e[3]=r):r=e[3];let i;return e[4]!==r?(i=n.jsx(we,{title:"Colors",children:n.jsx("div",{className:"space-y-2",children:r})}),e[4]=r,e[5]=i):i=e[5],i}function pt(t){const e=X.c(128),{brand:s,client:o,onChanged:l}=t,[r,i]=Oe.useState(s.isDefault??!1),[d,u]=Oe.useState(!1),p=s.name??"",b=s.domain??"",m=s.overview??"",c=s.logo??"",a=s.favicon??"",x=s.ogImage??"";let g;e[0]!==s.fonts?(g=s.fonts??{},e[0]=s.fonts,e[1]=g):g=e[1];let h;e[2]!==s.colors?(h=s.colors??{},e[2]=s.colors,e[3]=h):h=e[3];let v;e[4]!==p||e[5]!==b||e[6]!==m||e[7]!==c||e[8]!==a||e[9]!==x||e[10]!==g||e[11]!==h?(v={values:{name:p,domain:b,overview:m,logo:c,favicon:a,ogImage:x,fonts:g,colors:h}},e[4]=p,e[5]=b,e[6]=m,e[7]=c,e[8]=a,e[9]=x,e[10]=g,e[11]=h,e[12]=v):v=e[12];const f=Ue(v);let C;e[13]!==s.id||e[14]!==s.images||e[15]!==o?(C={mutationFn:async j=>{const ve=Object.values(j.fonts).some(kt),Ce=Object.values(j.colors).some(Dt),Se={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,images:s.images};await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:Se})},onError:wt},e[13]=s.id,e[14]=s.images,e[15]=o,e[16]=C):C=e[16];const w=ge(C);let D;e[17]!==s.id||e[18]!==f||e[19]!==l||e[20]!==w?(D={delayMs:500,save:async()=>{const j=f.control._formState.dirtyFields,ve=Object.keys(j);if(ve.length===0)return;const Ce=f.getValues(),Se=f.control._defaultValues;f.reset(Ce,{keepValues:!0});try{await w.mutateAsync(Ce),V("brand_updated",{brand_id:s.id,fields:ve}),U.success("Brand context updated successfully"),l()}catch{f.reset(Se,{keepValues:!0})}}},e[17]=s.id,e[18]=f,e[19]=l,e[20]=w,e[21]=D):D=e[21];const{schedule:y,flush:N}=at(D);let I;e[22]!==s.id||e[23]!==o?(I=async()=>{await o.callTool({name:"BRAND_CONTEXT_DELETE",arguments:{id:s.id}})},e[22]=s.id,e[23]=o,e[24]=I):I=e[24];let z;e[25]!==s.id||e[26]!==l?(z=()=>{V("brand_deleted",{brand_id:s.id}),u(!1),l(),U.success("Brand deleted")},e[25]=s.id,e[26]=l,e[27]=z):z=e[27];let q;e[28]!==I||e[29]!==z?(q={mutationFn:I,onSuccess:z,onError:_t},e[28]=I,e[29]=z,e[30]=q):q=e[30];const{mutate:xe,isPending:k}=ge(q);let B;e[31]!==s.id||e[32]!==s.isDefault||e[33]!==o?(B=async()=>{await o.callTool({name:"BRAND_CONTEXT_UPDATE",arguments:{id:s.id,isDefault:!s.isDefault}})},e[31]=s.id,e[32]=s.isDefault,e[33]=o,e[34]=B):B=e[34];let A;e[35]!==s.id||e[36]!==s.isDefault||e[37]!==l?(A=()=>{V(s.isDefault?"brand_unset_as_default":"brand_set_as_default",{brand_id:s.id}),l(),U.success(s.isDefault?"Removed as default brand":"Set as default brand")},e[35]=s.id,e[36]=s.isDefault,e[37]=l,e[38]=A):A=e[38];let T;e[39]!==B||e[40]!==A?(T={mutationFn:B,onSuccess:A,onError:Nt},e[39]=B,e[40]=A,e[41]=T):T=e[41];const{mutate:O}=ge(T),M=s.isDefault?"border-primary/30":"border-border/60";let H;e[42]!==M?(H=_e("rounded-2xl border bg-background",M),e[42]=M,e[43]=H):H=e[43];let R;e[44]!==r?(R=()=>i(!r),e[44]=r,e[45]=R):R=e[45];let L;e[46]!==r?(L=n.jsx("span",{className:"shrink-0 text-muted-foreground",children:r?n.jsx(He,{size:14}):n.jsx(Me,{size:14})}),e[46]=r,e[47]=L):L=e[47];let E;e[48]!==s.logo||e[49]!==s.name?(E=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:Ct})}):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[48]=s.logo,e[49]=s.name,e[50]=E):E=e[50];const K=s.name||"Untitled Brand";let F;e[51]!==K?(F=n.jsx("span",{className:"text-sm font-medium text-foreground",children:K}),e[51]=K,e[52]=F):F=e[52];let S;e[53]!==s.domain?(S=s.domain&&n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s.domain}),e[53]=s.domain,e[54]=S):S=e[54];let P;e[55]!==F||e[56]!==S?(P=n.jsxs("div",{className:"flex flex-1 flex-col items-start gap-0.5 overflow-hidden text-left",children:[F,S]}),e[55]=F,e[56]=S,e[57]=P):P=e[57];let _;e[58]!==s.colors||e[59]!==r?(_=!r&&s.colors&&Object.values(s.colors).some(vt)&&n.jsx("div",{className:"flex shrink-0 gap-1",children:Object.entries(s.colors).filter(yt).map(jt)}),e[58]=s.colors,e[59]=r,e[60]=_):_=e[60];let $;e[61]!==s.fonts||e[62]!==r?($=!r&&s.fonts&&Object.values(s.fonts).some(bt)&&n.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:Object.values(s.fonts).filter(Boolean).join(", ")}),e[61]=s.fonts,e[62]=r,e[63]=$):$=e[63];const De=s.isDefault?"opacity-100":"opacity-0 hover:bg-muted group-hover:opacity-100";let G;e[64]!==De?(G=_e("flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-opacity",De),e[64]=De,e[65]=G):G=e[65];let Q,W;e[66]!==O?(Q=j=>{j.stopPropagation(),O()},W=j=>{j.key==="Enter"&&(j.stopPropagation(),O())},e[66]=O,e[67]=Q,e[68]=W):(Q=e[67],W=e[68]);const ke=s.isDefault?"Unset as default":"Set as default",Be=s.isDefault?"text-primary fill-primary":"text-muted-foreground";let Y;e[69]!==Be?(Y=_e(Be),e[69]=Be,e[70]=Y):Y=e[70];let J;e[71]!==Y?(J=n.jsx(Ge,{size:13,className:Y}),e[71]=Y,e[72]=J):J=e[72];let Z;e[73]!==G||e[74]!==Q||e[75]!==W||e[76]!==ke||e[77]!==J?(Z=n.jsx("span",{role:"button",tabIndex:0,className:G,onClick:Q,onKeyDown:W,title:ke,children:J}),e[73]=G,e[74]=Q,e[75]=W,e[76]=ke,e[77]=J,e[78]=Z):Z=e[78];let he,pe;e[79]===Symbol.for("react.memo_cache_sentinel")?(he=j=>{j.stopPropagation(),u(!0)},pe=j=>{j.key==="Enter"&&(j.stopPropagation(),u(!0))},e[79]=he,e[80]=pe):(he=e[79],pe=e[80]);let be;e[81]===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(We,{size:13,className:"text-muted-foreground"})}),e[81]=be):be=e[81];let ee;e[82]!==R||e[83]!==L||e[84]!==E||e[85]!==P||e[86]!==_||e[87]!==$||e[88]!==Z?(ee=n.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-5",onClick:R,children:[L,E,P,_,$,Z,be]}),e[82]=R,e[83]=L,e[84]=E,e[85]=P,e[86]=_,e[87]=$,e[88]=Z,e[89]=ee):ee=e[89];let te;e[90]!==r||e[91]!==N||e[92]!==f||e[93]!==y?(te=r&&n.jsxs("div",{className:"space-y-3 px-5 pb-5",children:[n.jsx(dt,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(ft,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(ht,{form:f,onFieldChange:y,onFieldCommit:N}),n.jsx(xt,{form:f,onFieldChange:y,onFieldCommit:N})]})]}),e[90]=r,e[91]=N,e[92]=f,e[93]=y,e[94]=te):te=e[94];let se;e[95]!==k?(se=j=>{!j&&!k&&u(!1)},e[95]=k,e[96]=se):se=e[96];let je;e[97]===Symbol.for("react.memo_cache_sentinel")?(je=n.jsx(Je,{children:"Delete brand?"}),e[97]=je):je=e[97];const Ee=s.name||"this brand";let ne;e[98]!==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[98]=Ee,e[99]=ne):ne=e[99];let le;e[100]!==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[100]=s.isDefault,e[101]=le):le=e[101];let oe;e[102]!==ne||e[103]!==le?(oe=n.jsxs(Ze,{children:[je,n.jsx(et,{asChild:!0,children:n.jsxs("div",{children:[ne,le]})})]}),e[102]=ne,e[103]=le,e[104]=oe):oe=e[104];let re;e[105]!==k?(re=n.jsx(tt,{disabled:k,children:"Cancel"}),e[105]=k,e[106]=re):re=e[106];let ae;e[107]!==xe?(ae=j=>{j.preventDefault(),xe()},e[107]=xe,e[108]=ae):ae=e[108];const Fe=k?"Deleting...":"Delete";let ie;e[109]!==k||e[110]!==ae||e[111]!==Fe?(ie=n.jsx(st,{onClick:ae,disabled:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:Fe}),e[109]=k,e[110]=ae,e[111]=Fe,e[112]=ie):ie=e[112];let ce;e[113]!==re||e[114]!==ie?(ce=n.jsxs(nt,{children:[re,ie]}),e[113]=re,e[114]=ie,e[115]=ce):ce=e[115];let de;e[116]!==oe||e[117]!==ce?(de=n.jsxs(lt,{children:[oe,ce]}),e[116]=oe,e[117]=ce,e[118]=de):de=e[118];let me;e[119]!==d||e[120]!==se||e[121]!==de?(me=n.jsx(ot,{open:d,onOpenChange:se,children:de}),e[119]=d,e[120]=se,e[121]=de,e[122]=me):me=e[122];let ye;return e[123]!==H||e[124]!==ee||e[125]!==te||e[126]!==me?(ye=n.jsxs("div",{className:H,children:[ee,te,me]}),e[123]=H,e[124]=ee,e[125]=te,e[126]=me,e[127]=ye):ye=e[127],ye}function bt(t){return t}function jt(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 yt(t){const[,e]=t;return e}function vt(t){return t}function Ct(t){t.target.style.display="none"}function Nt(){return U.error("Failed to update default brand")}function _t(){return U.error("Failed to delete brand")}function wt(){return U.error("Failed to save brand context")}function Dt(t){return t?.trim()}function kt(t){return t?.trim()}function Bt(){const t=X.c(57),{brandExtractEnabled:e}=Ie(),{org:s}=ze();let o;t[0]!==s.id||t[1]!==s.slug?(o={connectionId:Xe,orgId:s.id,orgSlug:s.slug},t[0]=s.id,t[1]=s.slug,t[2]=o):o=t[2];const l=qe(o),r=Le();let i;t[3]!==s.id?(i=Re.brandContext(s.id),t[3]=s.id,t[4]=i):i=t[4];let d;t[5]!==l?(d=async()=>{const _=await l.callTool({name:"BRAND_CONTEXT_LIST",arguments:{includeArchived:!1}}),$=$e(_);return Array.isArray($?.items)?$.items:[]},t[5]=l,t[6]=d):d=t[6];let u;t[7]!==i||t[8]!==d?(u={queryKey:i,queryFn:d},t[7]=i,t[8]=d,t[9]=u):u=t[9];const{data:p}=Ke(u),m=(p===void 0?[]:p).filter(St);let c;t[10]!==s.id||t[11]!==r?(c=()=>r.invalidateQueries({queryKey:Re.brandContext(s.id),refetchType:"all"}),t[10]=s.id,t[11]=r,t[12]=c):c=t[12];const a=c;let x;t[13]!==l?(x=async()=>{await l.callTool({name:"BRAND_CONTEXT_CREATE",arguments:{name:"New Brand",domain:"example.com",overview:""}})},t[13]=l,t[14]=x):x=t[14];let g;t[15]!==a?(g=()=>{V("brand_created"),a(),U.success("Brand created")},t[15]=a,t[16]=g):g=t[16];let h;t[17]!==x||t[18]!==g?(h={mutationFn:x,onSuccess:g,onError:Ft},t[17]=x,t[18]=g,t[19]=h):h=t[19];const{mutate:v,isPending:f}=ge(h);let C;t[20]!==l?(C=async _=>{V("brand_extract_started",{domain:_});const $=await l.callTool({name:"BRAND_CONTEXT_EXTRACT",arguments:{domain:_}});$e($)},t[20]=l,t[21]=C):C=t[21];let w;t[22]!==a?(w=()=>{V("brand_extract_succeeded"),a(),U.success("Brand extracted successfully")},t[22]=a,t[23]=w):w=t[23];let D;t[24]!==w||t[25]!==C?(D={mutationFn:C,onSuccess:w,onError:Et},t[24]=w,t[25]=C,t[26]=D):D=t[26];const{mutate:y,isPending:N}=ge(D),I=Ne,z=Ne,q=Ne,xe="flex flex-col gap-6";let k;t[27]===Symbol.for("react.memo_cache_sentinel")?(k=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[27]=k):k=t[27];let B;t[28]!==v?(B=()=>v(),t[28]=v,t[29]=B):B=t[29];let A;t[30]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(Pe,{size:14}),t[30]=A):A=t[30];let T;t[31]!==f||t[32]!==B?(T=n.jsxs("div",{className:"flex items-center justify-between",children:[k,n.jsxs(Te,{variant:"outline",onClick:B,disabled:f,children:[A,"Add Brand"]})]}),t[31]=f,t[32]=B,t[33]=T):T=t[33];let O;t[34]!==e||t[35]!==y||t[36]!==N?(O=e&&n.jsx(ct,{onExtract:_=>y(_),isExtracting:N}),t[34]=e,t[35]=y,t[36]=N,t[37]=O):O=t[37];const M=m.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(Te,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>v(),disabled:f,children:[n.jsx(Pe,{size:14}),"Add your first brand"]})]}),H="group space-y-3";let R;t[38]!==l||t[39]!==a?(R=_=>n.jsx(pt,{brand:_,client:l,onChanged:a},_.id),t[38]=l,t[39]=a,t[40]=R):R=t[40];const L=m.map(R);let E;t[41]!==L?(E=n.jsx("div",{className:H,children:L}),t[41]=L,t[42]=E):E=t[42];let K;t[43]!==T||t[44]!==O||t[45]!==M||t[46]!==E?(K=n.jsxs("div",{className:xe,children:[T,O,M,E]}),t[43]=T,t[44]=O,t[45]=M,t[46]=E,t[47]=K):K=t[47];let F;t[48]!==q.Body||t[49]!==K?(F=n.jsx(q.Body,{children:K}),t[48]=q.Body,t[49]=K,t[50]=F):F=t[50];let S;t[51]!==z.Content||t[52]!==F?(S=n.jsx(z.Content,{children:F}),t[51]=z.Content,t[52]=F,t[53]=S):S=t[53];let P;return t[54]!==I||t[55]!==S?(P=n.jsx(I,{children:S}),t[54]=I,t[55]=S,t[56]=P):P=t[56],P}function Et(t){V("brand_extract_failed",{error:t instanceof Error?t.message:"unknown"}),U.error(t instanceof Error?t.message:"Failed to extract brand")}function Ft(){return U.error("Failed to create brand")}function St(t){return!t.archivedAt}function ts(){const t=X.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(it,{capability:"org:manage",area:"brand context",children:n.jsx(Bt,{})}),t[0]=e):e=t[0],e}export{ts as default};
@@ -1 +0,0 @@
1
- import{e as D,j as t,E as q,r as v,B as A,o as P}from"./index-Bja6OpPs.js";import{i as O}from"./AlertCircle-f1EMyhcF.js";import{i as $}from"./HardDrive-Ddx5WtDi.js";import{s as E}from"./Plus-DXVOsj8b.js";import{s as T}from"./Trash01-C2MDqKmR.js";import{f as L,g as K,c as G,b as M,d as W,e as H,a as J,A as Q}from"./alert-dialog-DKXzP7Bt.js";import{D as V,a as X,b as Y,c as Z,e as ee,d as te}from"./dialog-DCjJZndp.js";import{I as N}from"./input-D9gxUyjr.js";import{L as k}from"./label-BL0BsZ1B.js";import{S as se}from"./switch-DB7mlnDa.js";import{S as ie}from"./skeleton-CM-Pi0cm.js";import{T as re}from"./textarea-DGZy_omr.js";import{P as _}from"./index-N_rB2zyq.js";import{c as ne}from"./settings-section-T0fDyncu.js";import{u as le,a as oe,b as ae}from"./use-file-configs-Qrd6eZyZ.js";import{R as ce}from"./require-capability-DVkbMmft.js";import"./X-DvNDI9Zw.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./tooltip-BvIsFjJR.js";import"./card-lOxFSSkP.js";import"./ArrowUpRight-DDOS_CqL.js";import"./constants-Oykg5_q9.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-capability-rrurYBXm.js";import"./access-gate-B8AAPT1T.js";import"./capability-load-error-DVzMymKs.js";function de(s,e){if(!(s instanceof Error))return e;const i=s.message.match(/\[\s*\{[\s\S]*\}\s*\]/);if(i)try{const r=JSON.parse(i[0])[0];if(r?.message){const l=r.path?.join(".");return l?`${l}: ${r.message}`:r.message}}catch{}return s.message||e}function me(s){const e=D.c(3),{error:i}=s;let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx(O,{size:16}),e[0]=n):n=e[0];let r;return e[1]!==i.message?(r=t.jsxs("div",{className:"p-4 rounded-md bg-destructive/10 text-destructive flex items-center gap-2",children:[n,t.jsxs("span",{className:"text-sm font-medium",children:["Failed to load file configurations: ",i.message]})]}),e[1]=i.message,e[2]=r):r=e[2],r}function fe(s){const e=D.c(41),{config:i,onDelete:n}=s;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"size-9 rounded-md bg-muted flex items-center justify-center shrink-0",children:t.jsx($,{size:16,className:"text-muted-foreground"})}),e[0]=r):r=e[0];let l;e[1]!==i.name?(l=t.jsx("span",{className:"font-medium text-sm truncate",children:i.name}),e[1]=i.name,e[2]=l):l=e[2];let o;e[3]!==i.bucket||e[4]!==i.region?(o=t.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:[i.bucket," · ",i.region]}),e[3]=i.bucket,e[4]=i.region,e[5]=o):o=e[5];let p;e[6]!==l||e[7]!==o?(p=t.jsxs("div",{className:"flex items-center gap-2",children:[l,o]}),e[6]=l,e[7]=o,e[8]=p):p=e[8];let a;e[9]!==i.description?(a=i.description?t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:i.description}):null,e[9]=i.description,e[10]=a):a=e[10];let j;e[11]!==i.endpoint||e[12]!==i.forcePathStyle?(j=i.endpoint?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:[i.endpoint,i.forcePathStyle?" (path-style)":""]}):null,e[11]=i.endpoint,e[12]=i.forcePathStyle,e[13]=j):j=e[13];let h;e[14]!==i.prefix?(h=i.prefix?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["prefix: ",i.prefix]}):null,e[14]=i.prefix,e[15]=h):h=e[15];let c;e[16]!==i.publicUrlBase?(c=i.publicUrlBase?t.jsxs("p",{className:"text-xs text-muted-foreground/80 mt-0.5 truncate font-mono",children:["public: ",i.publicUrlBase]}):null,e[16]=i.publicUrlBase,e[17]=c):c=e[17];let d;e[18]!==p||e[19]!==a||e[20]!==j||e[21]!==h||e[22]!==c?(d=t.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[r,t.jsxs("div",{className:"min-w-0",children:[p,a,j,h,c]})]}),e[18]=p,e[19]=a,e[20]=j,e[21]=h,e[22]=c,e[23]=d):d=e[23];let g;e[24]!==i.createdAt?(g=new Date(i.createdAt).toLocaleDateString(),e[24]=i.createdAt,e[25]=g):g=e[25];let x;e[26]!==g?(x=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[26]=g,e[27]=x):x=e[27];let m;e[28]!==i||e[29]!==n?(m=()=>n(i),e[28]=i,e[29]=n,e[30]=m):m=e[30];const y=`Delete ${i.name}`;let f;e[31]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(T,{size:14}),e[31]=f):f=e[31];let u;e[32]!==m||e[33]!==y?(u=t.jsx(A,{variant:"ghost",size:"sm",onClick:m,"aria-label":y,children:f}),e[32]=m,e[33]=y,e[34]=u):u=e[34];let S;e[35]!==x||e[36]!==u?(S=t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[x,u]}),e[35]=x,e[36]=u,e[37]=S):S=e[37];let C;return e[38]!==S||e[39]!==d?(C=t.jsxs("div",{className:"flex items-start justify-between gap-4 py-3 border-b border-border/60 last:border-b-0",children:[d,S]}),e[38]=S,e[39]=d,e[40]=C):C=e[40],C}function ue(s){const e=D.c(5),{onCreate:i}=s;let n,r;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsx("div",{className:"size-12 rounded-full bg-muted flex items-center justify-center",children:t.jsx($,{size:20,className:"text-muted-foreground"})}),r=t.jsxs("div",{children:[t.jsx("p",{className:"font-medium text-sm",children:"No buckets configured"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-1 max-w-sm",children:"Add an S3-compatible bucket (AWS S3, Cloudflare R2, Google Cloud Storage, MinIO). Access keys are encrypted at rest and never returned over the API."})]}),e[0]=n,e[1]=r):(n=e[0],r=e[1]);let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(E,{size:14}),e[2]=l):l=e[2];let o;return e[3]!==i?(o=t.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 p-10 flex flex-col items-center justify-center text-center gap-3",children:[n,r,t.jsxs(A,{onClick:i,size:"sm",className:"mt-2",children:[l,"Add bucket"]})]}),e[3]=i,e[4]=o):o=e[4],o}function B({open:s,onOpenChange:e}){const[i,n]=v.useState(""),[r,l]=v.useState(""),[o,p]=v.useState(""),[a,j]=v.useState(""),[h,c]=v.useState(""),[d,g]=v.useState(!1),[x,m]=v.useState(""),[y,f]=v.useState(""),[u,S]=v.useState(""),[C,w]=v.useState(""),F=oe();function R(){n(""),l(""),p(""),j(""),c(""),g(!1),m(""),f(""),S(""),w("")}async function z(b){if(b.preventDefault(),!(!i.trim()||!o.trim()||!a.trim())&&!(!u||!C))try{await F.mutateAsync({name:i.trim(),description:r.trim()||void 0,bucket:o.trim(),region:a.trim(),endpoint:h.trim()||void 0,forcePathStyle:d,prefix:x.trim()||void 0,publicUrlBase:y.trim()||void 0,accessKeyId:u,secretAccessKey:C}),P.success(`Bucket "${i.trim()}" added`),R(),e(!1)}catch(I){P.error(de(I,"Failed to add bucket"))}}const U=F.isPending||!i.trim()||!o.trim()||!a.trim()||!u||!C;return t.jsx(V,{open:s,onOpenChange:e,children:t.jsxs(X,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[t.jsxs(Y,{children:[t.jsx(Z,{children:"Add S3 bucket"}),t.jsx(ee,{children:"Credentials are encrypted at rest and never returned over the API. For Cloudflare R2, Google Cloud Storage, or MinIO, set a custom endpoint."})]}),t.jsxs("form",{onSubmit:z,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-name",children:"Name"}),t.jsx(N,{id:"file-config-name",value:i,onChange:b=>n(b.target.value),placeholder:"production-uploads",autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters, digits, underscore, dot, hyphen. Unique within the organization."})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-bucket",children:"Bucket"}),t.jsx(N,{id:"file-config-bucket",value:o,onChange:b=>p(b.target.value),placeholder:"my-bucket",autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-region",children:"Region"}),t.jsx(N,{id:"file-config-region",value:a,onChange:b=>j(b.target.value),placeholder:"us-east-1",autoComplete:"off",required:!0})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-endpoint",children:"Endpoint (optional)"}),t.jsx(N,{id:"file-config-endpoint",type:"url",value:h,onChange:b=>c(b.target.value),placeholder:"https://<account>.r2.cloudflarestorage.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Required for non-AWS providers (R2, GCS, MinIO)."})]}),t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/60 p-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx(k,{htmlFor:"file-config-path-style",className:"text-sm",children:"Force path-style URLs"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Required for Google Cloud Storage and most MinIO setups."})]}),t.jsx(se,{id:"file-config-path-style",checked:d,onCheckedChange:g})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-prefix",children:"Key prefix (optional)"}),t.jsx(N,{id:"file-config-prefix",value:x,onChange:b=>m(b.target.value),placeholder:"tenants/acme/",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"All object keys are written under this prefix. Useful for multi-tenant buckets or credentials scoped to a sub-path. A trailing slash is added automatically."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-public-url-base",children:"Public URL base (optional)"}),t.jsx(N,{id:"file-config-public-url-base",type:"url",value:y,onChange:b=>f(b.target.value),placeholder:"https://pub-xxxx.r2.dev or https://cdn.example.com",autoComplete:"off"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Host used to build public URLs returned by the picker (R2 dev domain, CDN, custom host). Leave blank to use the bucket's S3 host (AWS default)."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-access-key",children:"Access key ID"}),t.jsx(N,{id:"file-config-access-key",value:u,onChange:b=>S(b.target.value),autoComplete:"off",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-secret-key",children:"Secret access key"}),t.jsx(N,{id:"file-config-secret-key",type:"password",value:C,onChange:b=>w(b.target.value),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(k,{htmlFor:"file-config-description",children:"Description (optional)"}),t.jsx(re,{id:"file-config-description",value:r,onChange:b=>l(b.target.value),rows:2,placeholder:"What is this bucket used for?"})]}),t.jsxs(te,{children:[t.jsx(A,{type:"button",variant:"outline",onClick:()=>{R(),e(!1)},disabled:F.isPending,children:"Cancel"}),t.jsx(A,{type:"submit",disabled:U,children:F.isPending?"Adding…":"Add bucket"})]})]})]})})}function xe(s){const e=D.c(25),{config:i,onClose:n}=s,r=ae();let l;e[0]!==i||e[1]!==r||e[2]!==n?(l=async function(){if(i)try{await r.mutateAsync(i.id),P.success(`Bucket "${i.name}" removed`),n()}catch(S){const C=S;P.error(C instanceof Error?C.message:"Failed to remove bucket")}},e[0]=i,e[1]=r,e[2]=n,e[3]=l):l=e[3];const o=l,p=i!==null;let a;e[4]!==n?(a=u=>!u&&n(),e[4]=n,e[5]=a):a=e[5];let j;e[6]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(G,{children:"Remove bucket configuration?"}),e[6]=j):j=e[6];const h=i?.name;let c;e[7]!==h?(c=t.jsxs(M,{children:[j,t.jsxs(W,{children:["This deletes the encrypted credentials for"," ",t.jsx("span",{className:"font-medium",children:h}),". The bucket itself is not affected. This cannot be undone."]})]}),e[7]=h,e[8]=c):c=e[8];let d;e[9]!==r.isPending?(d=t.jsx(L,{disabled:r.isPending,children:"Cancel"}),e[9]=r.isPending,e[10]=d):d=e[10];const g=r.isPending?"Removing…":"Remove";let x;e[11]!==r.isPending||e[12]!==o||e[13]!==g?(x=t.jsx(K,{onClick:o,disabled:r.isPending,children:g}),e[11]=r.isPending,e[12]=o,e[13]=g,e[14]=x):x=e[14];let m;e[15]!==d||e[16]!==x?(m=t.jsxs(H,{children:[d,x]}),e[15]=d,e[16]=x,e[17]=m):m=e[17];let y;e[18]!==m||e[19]!==c?(y=t.jsxs(J,{children:[c,m]}),e[18]=m,e[19]=c,e[20]=y):y=e[20];let f;return e[21]!==y||e[22]!==p||e[23]!==a?(f=t.jsx(Q,{open:p,onOpenChange:a,children:y}),e[21]=y,e[22]=p,e[23]=a,e[24]=f):f=e[24],f}function pe(){const s=D.c(25),e=le(),[i,n]=v.useState(!1),[r,l]=v.useState(null);if(e.length===0){let f;s[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ue,{onCreate:()=>n(!0)}),s[0]=f):f=s[0];let u;return s[1]!==i?(u=t.jsxs(t.Fragment,{children:[f,t.jsx(B,{open:i,onOpenChange:n})]}),s[1]=i,s[2]=u):u=s[2],u}const o=e.length===1?"":"s";let p;s[3]!==e.length||s[4]!==o?(p=t.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.length," bucket",o," configured"]}),s[3]=e.length,s[4]=o,s[5]=p):p=s[5];let a;s[6]===Symbol.for("react.memo_cache_sentinel")?(a=()=>n(!0),s[6]=a):a=s[6];let j;s[7]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs(A,{onClick:a,size:"sm",children:[t.jsx(E,{size:14}),"Add bucket"]}),s[7]=j):j=s[7];let h;s[8]!==p?(h=t.jsxs("div",{className:"flex items-center justify-between",children:[p,j]}),s[8]=p,s[9]=h):h=s[9];let c;if(s[10]!==e){let f;s[12]===Symbol.for("react.memo_cache_sentinel")?(f=u=>t.jsx(fe,{config:u,onDelete:l},u.id),s[12]=f):f=s[12],c=e.map(f),s[10]=e,s[11]=c}else c=s[11];let d;s[13]!==c?(d=t.jsx("section",{className:"rounded-2xl border border-border/60 bg-background p-5",children:t.jsx("div",{children:c})}),s[13]=c,s[14]=d):d=s[14];let g;s[15]!==i?(g=t.jsx(B,{open:i,onOpenChange:n}),s[15]=i,s[16]=g):g=s[16];let x;s[17]===Symbol.for("react.memo_cache_sentinel")?(x=()=>l(null),s[17]=x):x=s[17];let m;s[18]!==r?(m=t.jsx(xe,{config:r,onClose:x}),s[18]=r,s[19]=m):m=s[19];let y;return s[20]!==h||s[21]!==d||s[22]!==g||s[23]!==m?(y=t.jsxs(t.Fragment,{children:[h,d,g,m]}),s[20]=h,s[21]=d,s[22]=g,s[23]=m,s[24]=y):y=s[24],y}function he(){const s=D.c(2);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(_.Title,{children:"Buckets"}),s[0]=e):e=s[0];let i;return s[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(_,{children:t.jsx(_.Content,{children:t.jsx(_.Body,{children:t.jsxs(ne,{children:[e,t.jsx(q,{fallback:ge,children:t.jsx(v.Suspense,{fallback:t.jsx(ie,{className:"h-32 w-full"}),children:t.jsx(pe,{})})})]})})})}),s[1]=i):i=s[1],i}function ge(s){const{error:e}=s;return t.jsx(me,{error:e??new Error("Failed to load file configs")})}function Me(){const s=D.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ce,{capability:"file-configs:manage",area:"files",children:t.jsx(he,{})}),s[0]=e):e=s[0],e}export{Me as default};
@@ -1,20 +0,0 @@
1
- import{ce as De,e as J,q as X,K as de,n as Ne,W as Le,$ as Te,F as Ce,o as ve,p as ae,L as re,f as Se,d as Me,g as Fe,r as p,j as ie,t as je,b as Ue,a0 as Ke,aM as qe}from"./index-Bja6OpPs.js";import{q as Ve,A as Ee,c as Be,s as Ge,v as He,x as We,u as Qe,w as ze}from"./tab-id-BFVzx5fb.js";import{S as Ae,u as _e,g as Xe}from"./constants-Oykg5_q9.js";import{u as Ye}from"./unwrap-tool-result-BYXdCQMg.js";import{u as Ze}from"./use-virtual-mcp-BNfSbQBW.js";import{u as Je,b as le}from"./use-ai-providers-BQwBnNI3.js";import{e as et}from"./use-organization-settings-CVmm-jyI.js";const tt={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.4-mini"]},nt={anthropic:["claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.4"]},st={anthropic:["claude-fable-5","claude-opus-4-8","claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-fable-5","anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6:extended","anthropic/claude-sonnet-4.6","google/gemini-3-pro"],deco:["anthropic/claude-fable","anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet"],google:["gemini-3-pro"],"claude-code":["claude-code:fable","claude-code:sonnet"],codex:["codex:gpt-5.5"]},ot={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],google:["gemini-2.0-flash-image"]},at={openrouter:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"],deco:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"]};function ne(t,e,o,n){for(const s of o){const a=t.find(r=>r.modelId===s);if(a)return{keyId:e,modelId:a.modelId,title:a.title}}for(const s of o){const a=t.find(r=>r.modelId.includes(s));if(a)return{keyId:e,modelId:a.modelId,title:a.title}}if(n){const s=t.find(n);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}return null}function rt(t,e){const o={chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null};for(const n of t){const s=e[n.id]??[],a=n.providerId;o.chat.fast||(o.chat.fast=ne(s,n.id,tt[a]??[])),o.chat.smart||(o.chat.smart=ne(s,n.id,nt[a]??[])),o.chat.thinking||(o.chat.thinking=ne(s,n.id,st[a]??[])),o.image||(o.image=ne(s,n.id,ot[a]??[],r=>r.capabilities?.includes("image")===!0)),o.webResearch||(o.webResearch=ne(s,n.id,at[a]??[],r=>{const i=r.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return i.includes("sonar")||i.includes("deepresearch")}))}return o}const he={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"decopilot-desktop":{harness:"decopilot",sandbox:"user-desktop"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function it(t,e){if(!t)return null;const o=e?De(e):null;if(t==="decopilot"&&o===null)return"decopilot";for(const[n,s]of Object.entries(he))if(s.harness===t&&s.sandbox===o)return n;return null}function Ie(t,e){switch(t){case"decopilot":return e.agentSandbox;case"decopilot-desktop":return e.userDesktop;case"claude-code-desktop":return e.userDesktop&&e.claudeCode;case"codex-desktop":return e.userDesktop&&e.codex}}const ct=["decopilot","decopilot-desktop","claude-code-desktop","codex-desktop"];function lt(t,e){return t==null?null:Ie(t,e)?t:ct.find(o=>Ie(o,e))??null}const be={online:!1,capabilities:[],ready:!1};function dt(){const t=J.c(10),{org:e}=X();let o;t[0]!==e.id||t[1]!==e.slug?(o={connectionId:Ae,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=o):o=t[2];const n=_e(o);let s;t[3]!==e.id?(s=de.currentLink(e.id),t[3]=e.id,t[4]=s):s=t[4];let a;t[5]!==n?(a=async()=>{const h=await n.callTool({name:"LINK_CURRENT_GET",arguments:{}}),k=Ye(h);return k?{...k,ready:!0}:{...be,ready:!0}},t[5]=n,t[6]=a):a=t[6];let r;t[7]!==s||t[8]!==a?(r={queryKey:s,queryFn:a,staleTime:1e4,refetchInterval:15e3,refetchOnWindowFocus:!0},t[7]=s,t[8]=a,t[9]=r):r=t[9];const{data:i}=Ne(r);return i??be}function ut(){const t=J.c(11),e=dt(),o=Le();let n;t[0]!==e.capabilities||t[1]!==e.online?(n=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=n):n=t[2];let s;t[3]!==e.capabilities||t[4]!==e.online?(s=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=s):s=t[5];let a;return t[6]!==e.online||t[7]!==o.runtime.agentSandbox||t[8]!==n||t[9]!==s?(a={agentSandbox:o.runtime.agentSandbox,userDesktop:e.online,claudeCode:n,codex:s},t[6]=e.online,t[7]=o.runtime.agentSandbox,t[8]=n,t[9]=s,t[10]=a):a=t[10],a}function pt(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function ft(t){const e=J.c(10);let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=o):o=e[0];const n=Te(o);let s;if(e[1]!==n?.params.appSlug||e[2]!==n?.params.collectionName||e[3]!==n?.params.itemId||e[4]!==t){s=[],t&&s.push(`### Selected Agent
2
- - ID: ${t}`);let a;e[6]!==n?.params.appSlug||e[7]!==n?.params.collectionName||e[8]!==n?.params.itemId?(a=[],n?.params.appSlug&&a.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&a.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&a.push(`- Item ID: ${n?.params.itemId}`),e[6]=n?.params.appSlug,e[7]=n?.params.collectionName,e[8]=n?.params.itemId,e[9]=a):a=e[9],a.length>0&&s.push(`### Current Resource
3
- The user is viewing the following resource:
4
- ${a.join(`
5
- `)}
6
-
7
- Help the user understand and work with this resource.`),e[1]=n?.params.appSlug,e[2]=n?.params.collectionName,e[3]=n?.params.itemId,e[4]=t,e[5]=s}else s=e[5];return s.join(`
8
-
9
- `)}function ht(){const t=J.c(5),e=Ce(),{org:o}=X();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const s=Te(n);let a;return t[1]!==s?.params||t[2]!==o||t[3]!==e?(a=r=>{const h=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!h||!h[1])return;const k=h[1],m=s?.params.appSlug;if(!m)return;e.invalidateQueries({queryKey:de.collection(o.slug,m,k)});const f=k.toLowerCase().replace(/_/g," ");ve.success(`${f} updated`)},t[1]=s?.params,t[2]=o,t[3]=e,t[4]=a):a=t[4],a}function mt(){const t=J.c(4),{org:e,project:o}=X(),n=`${e.id}/${o.id}`;let s;t[0]!==n?(s=re.taskLastViewed(n),t[0]=n,t[1]=s):s=t[1];const[,a]=ae(s,gt);let r;return t[2]!==a?(r={markTaskRead:h=>{a(k=>({...k,[h]:new Date().toISOString()}))}},t[2]=a,t[3]=r):r=t[3],r}function gt(t){return t??{}}function we(){const t=Se(),{org:e}=X(),o=Me({strict:!1}),n=Fe({strict:!1}),s=o.virtualmcpid??Xe(e.id).id,a=(h,k)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:h},search:m=>{const f={},R=k?.virtualMcpId??m.virtualmcpid;R&&(f.virtualmcpid=R);const g=m.main;return g&&typeof g=="string"&&!Ve(g)&&(f.main=g),m.chat&&(f.chat=m.chat),k?.autosend&&(f.autosend=Ee),f}})},r=p.useRef(crypto.randomUUID()),i=n.taskId??r.current;return{virtualMcpId:s,taskId:i,navigateToTask:a}}function xt(t,e){const{mimeType:o,data:n}=t;if(o.startsWith("text/"))try{const s=new TextDecoder().decode(Uint8Array.from(atob(n),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
10
- ${s}`}]}catch(s){console.error("Failed to decode text file:",s)}return[{type:"file",url:`data:${o};base64,${n}`,filename:e,mediaType:o}]}function ye(t,e){const o=[];for(const n of t)"text"in n&&n.text?o.push({type:"text",text:`[${e}]
11
- ${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&o.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)});return o}function It(t,e){const o=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const s=Array.isArray(n.content)?n.content:[n.content];for(const a of s)switch(a.type){case"text":{const r=a.text?.trim();if(!r)continue;o.push({type:"text",text:`[${e}]
12
- ${r}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;o.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const r=a.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?o.push({type:"text",text:`[${e}]
13
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&o.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return o}function Pe(t){if(!t)return[];const e=[];let o="";const n=s=>{if(s){if(s.type==="text"&&"text"in s&&typeof s.text=="string")o+=s.text;else if(s.type==="mention"&&s.attrs){const a=s.attrs.char??"/",r=`${a}${s.attrs.name}`;if(o+=r,a==="@"){const i=s.attrs.metadata;i&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??s.attrs.name} (agent_id: ${i.agentId})]
14
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...ye(i,r))}else{const i=s.attrs.metadata||s.attrs.prompts||[];Array.isArray(i)&&i.length>0&&"role"in i[0]?e.push(...It(i,r)):Array.isArray(i)&&e.push(...ye(i,r))}}else if(s.type==="file"&&s.attrs){const a=s.attrs,r=`[file:://${encodeURIComponent(a.name)}]`;o+=r,e.push(...xt(a,r))}if("content"in s&&Array.isArray(s.content))for(const a of s.content)n(a)}};return n(t),o.trim()&&e.unshift({type:"text",text:o.trim()}),e}function Dt(t){const e=Pe(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const ke=new Set;function se(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function bt(t){return t.kind==="loading"?"ready":t.kind}function oe(t,e,o,n){if(!t)return null;const s=e.find(r=>r.id===t.keyId);if(!s)return null;const a=o.find(r=>r.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:s.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function yt(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function kt(t,e,o,n){if(!o||n.length===0)return null;const s=e.find(h=>h.id===o);if(!s)return null;const a=rt([s],{[o]:n}),r=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!r)return null;const i=n.find(h=>h.modelId===r.modelId);return i?{...i,keyId:o}:null}const Tt=1e4,Ct=10,me=p.createContext(null),ge=p.createContext(null),xe=p.createContext(null),Re=p.createContext(null);function vt({children:t}){const{locator:e}=X(),{virtualMcpId:o}=we(),[n,s]=ae(re.chatSelectedImageModel(e),null),[a,r]=ae(re.chatSelectedDeepResearchModel(e),null),[i,h]=p.useState(null),[k,m]=p.useState("default"),f=et(),[R,g]=ae(re.chatSimpleModeTier(e),null),T=yt(R),b=Je(),$=f.tiers[T],O=i&&b.some(c=>c.id===i)?i:$?.keyId??b[0]?.id??null,{models:x,isLoading:C}=le(O??void 0),{models:D}=le($?.keyId),{models:B}=le(f.tiers.image?.keyId),{models:N}=le(f.tiers.web_research?.keyId),K=oe($,b,D,$?.title)??kt(T,b,O,x),v=C,L=x.filter(c=>c.capabilities?.includes("image")),q=oe(n,b,L),V=oe(f.tiers.image,b,B,f.tiers.image?.title)??q??L[0]??null,u=x.filter(c=>{const M=c.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return M.includes("sonar")||M.includes("deepresearch")}),S=oe(a,b,u),P=u.find(c=>c.modelId==="perplexity/sonar")??u[0]??null,G=oe(f.tiers.web_research,b,N,f.tiers.web_research?.title)??S??P,W=Ze(o)??{id:o,title:"",description:null,icon:null},[E,F]=p.useState({}),I=(c,M)=>{const te=[];for(const j of M.content??[])j.type==="text"&&j.text?.trim()&&te.push(j.text.trim());const w=te.join(`
15
- `);if(!w){A(c);return}new TextEncoder().encode(w).length>Tt||F(j=>Object.keys(j).length>=Ct&&!(c in j)?j:{...j,[c]:w})},A=c=>{F(M=>{const{[c]:te,...w}=M;return w})},[Y,Q]=ae(re.chatLastAgentOption(e),c=>c&&c in he?c:null),z=Et(),Z=z?.isThreadLocked&&z.lockedHarness!=null?it(z.lockedHarness,z.lockedSandbox):null,ue=ut(),pe=lt(Y,ue),ce=z?.isThreadLocked?Z:pe,ee=ce?he[ce]:null,fe=ee?.harness??null,l=ee?.sandbox??null,[d,y]=p.useState(void 0),_=p.useRef(d);_.current=d;const U={selectedModel:K,setModel:()=>{},credentialId:O,setCredentialId:h,allModelsConnections:b,isModelsLoading:v,selectedVirtualMcp:W,imageModel:V,setImageModel:c=>{s(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:G,setDeepResearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:k,setChatMode:m,appContexts:E,setAppContext:I,clearAppContext:A,tiptapDoc:d,setTiptapDoc:y,tiptapDocRef:_,resetInteraction:()=>{},simpleModeTier:T,setSimpleModeTier:c=>g(c),pendingAgentOption:ce,setPendingAgentOption:Q,pendingHarnessId:fe,pendingSandboxProviderKind:l};return ie.jsx(xe.Provider,{value:U,children:t})}function Nt(t){const e=J.c(41),{virtualMcpId:o,task:n,children:s}=t,{locator:a}=X(),{data:r}=Ue.useSession(),i=r?.user??null,{taskId:h,virtualMcpId:k,navigateToTask:m}=we(),[f]=Ke(),{markTaskRead:R}=mt(),g=Qe(),T=h,b=k,$=ft(b);let O;e[0]!==R||e[1]!==m?(O=(I,A)=>{R(I),m(I,{virtualMcpId:A?.virtualMcpId,autosend:A?.autosend})},e[0]=R,e[1]=m,e[2]=O):O=e[2];const x=O,C=T&&n?.id===T?n:null,D=C?.harness_id??null,B=C?.sandbox_provider_kind??null,N=C?.branch??null,K=D!=null,v=N;let L;e[3]!==v||e[4]!==x||e[5]!==g||e[6]!==o?(L=()=>{const I=crypto.randomUUID();return g.create({id:I,virtual_mcp_id:o,...v?{branch:v}:{}}).then(()=>x(I)).catch(()=>{x(I)}),I},e[3]=v,e[4]=x,e[5]=g,e[6]=o,e[7]=L):L=e[7];const q=L;let V;e[8]!==v||e[9]!==a||e[10]!==x||e[11]!==g||e[12]!==o?(V=I=>{const A=crypto.randomUUID(),Y=I.virtualMcpId??o,Q=Y===o?v:null;ze(sessionStorage,a,A,I.message),g.create({id:A,virtual_mcp_id:Y,...Q?{branch:Q}:{}}).then(()=>x(A,{virtualMcpId:I.virtualMcpId,autosend:!0})).catch(()=>{x(A,{virtualMcpId:I.virtualMcpId,autosend:!0})})},e[8]=v,e[9]=a,e[10]=x,e[11]=g,e[12]=o,e[13]=V):V=e[13];const u=V;let S;e[14]!==T||e[15]!==g?(S=I=>{T&&g.setBranch(T,I)},e[14]=T,e[15]=g,e[16]=S):S=e[16];let P;e[17]!==C||e[18]!==q||e[19]!==u||e[20]!==v||e[21]!==T||e[22]!==b||e[23]!==K||e[24]!==N||e[25]!==D||e[26]!==B||e[27]!==x||e[28]!==S?(P={virtualMcpId:b,taskId:T,openTask:x,createTask:q,createTaskWithMessage:u,activeTask:C,isThreadLocked:K,lockedHarness:D,lockedSandbox:B,lockedBranch:N,currentBranch:v,setCurrentTaskBranch:S},e[17]=C,e[18]=q,e[19]=u,e[20]=v,e[21]=T,e[22]=b,e[23]=K,e[24]=N,e[25]=D,e[26]=B,e[27]=x,e[28]=S,e[29]=P):P=e[29];const G=P;let H;e[30]!==$||e[31]!==f||e[32]!==m||e[33]!==i?(H={user:i,contextPrompt:$,preferences:f,rawNavigateToTask:m},e[30]=$,e[31]=f,e[32]=m,e[33]=i,e[34]=H):H=e[34];const W=H;let E;e[35]!==s||e[36]!==W?(E=ie.jsx(vt,{children:ie.jsx(Re.Provider,{value:W,children:s})}),e[35]=s,e[36]=W,e[37]=E):E=e[37];let F;return e[38]!==E||e[39]!==G?(F=ie.jsx(ge.Provider,{value:G,children:E}),e[38]=E,e[39]=G,e[40]=F):F=e[40],F}function Lt({taskId:t,children:e}){const{virtualMcpId:o,activeTask:n,currentBranch:s}=St();t&&!ke.has(t)&&(ke.add(t),je("chat_opened",{thread_id:t}));const{imageModel:a,deepResearchModel:r,chatMode:i,setChatMode:h,appContexts:k,setTiptapDoc:m,simpleModeTier:f,pendingSandboxProviderKind:R,pendingHarnessId:g}=Mt(),T=p.useContext(Re);if(!T)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:b,contextPrompt:$,preferences:O,rawNavigateToTask:x}=T,{org:C,locator:D}=X(),[B,N]=p.useState(null),K=ht(),v=Ce(),L=Be(),q=Se(),V=_e({connectionId:Ae,orgId:C.id,orgSlug:C.slug}),u=Ge(C.slug,t,{client:V});p.use(u.ready);const S=se(u.messages),P=se(u.status),G=se(u.finishReason),H=se(u.hasMoreOlder),W=se(u.isFetchingOlder),E=p.useRef({onToolCall:K,queryClient:v,rawNavigateToTask:x,taskId:t,manager:L,navigate:q,orgSlug:C.slug});E.current={onToolCall:K,queryClient:v,rawNavigateToTask:x,taskId:t,manager:L,navigate:q,orgSlug:C.slug},p.useEffect(()=>{const l={onData:d=>{if(d.type==="data-thread-title"){const y=d.data;if(!y?.title)return;const _=E.current;if(!_.taskId)return;_.manager.patchThread({id:_.taskId,title:y.title,updated_at:new Date().toISOString()});return}if(d.type==="data-html-page-published"){const y=d.data;if(!y?.slug)return;const _=y.slug;E.current.navigate({to:".",search:U=>({...U,main:`web-page:${_}`}),replace:!0});return}},onFinish:d=>{const y=E.current,_=d.parts?.some(c=>{const M=c;return(M.type==="tool-share_with_user"||M.type==="tool-bash"||M.type==="tool-write")&&M.state==="output-available"});if(y.taskId&&_){const c=de.threadOutputs(y.taskId);for(const M of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{y.queryClient.invalidateQueries({queryKey:c})},M)}y.queryClient.invalidateQueries({queryKey:de.homeNextActions(y.orgSlug)});const U=d.metadata?.thread_id;U&&U!==y.taskId&&y.rawNavigateToTask(U)},onError:d=>{N(d),console.error("[chat] Error",d)},onToolCall:d=>E.current.onToolCall(d)};return u.observer=l,()=>{u.observer===l&&(u.observer=null)}},[u]);const F=P.kind==="submitted"||P.kind==="streaming",I=S.length===0,A=S.at(-1),Y=!F&&A?.role==="assistant"&&A.parts.some(l=>"state"in l&&l.state==="approval-requested"),Q=n,z=(Q?.status==="in_progress"||Q?.status==="expired")&&P.kind==="ready"&&S.length>0;async function Z(l){const d=l.parts??Pe(l.tiptapDoc);if(d.length===0)return;const y=t,_=o;N(null),m(void 0);const U={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:b?.image??void 0,name:b?.name??"you"}},c=Object.entries(k),M=c.length>0?c.map(([$e,Oe])=>`### App Context: ${$e}
16
- ${Oe}`).join(`
17
-
18
- `):"",te=[$,M].filter(Boolean).join(`
19
-
20
- `);let w=i;w==="gen-image"&&!a&&(w="default"),w==="web-search"&&!r&&(w="default"),w==="web-search"&&h("default");const j={id:crypto.randomUUID(),role:"user",parts:d,metadata:U};await u.submit({kind:"message",message:j},{tier:f,mode:w,toolApprovalLevel:O.toolApprovalLevel??qe(),system:te||void 0,agent:{id:_},thread_id:y,...pt({thread:n?{harness_id:n.harness_id??null,sandbox_provider_kind:n.sandbox_provider_kind??null,branch:n.branch??null}:null,globals:{harnessId:g??void 0,sandboxProviderKind:R??void 0,branch:s}})})}const ue=async()=>{u.stop();try{const l=await fetch(`/api/${C.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.message??`Cancel failed: ${l.status}`)}}catch(l){const d=l instanceof Error?l.message:"Failed to cancel";ve.error(d),console.error("[chat] cancelRun",l)}},pe=l=>l&&typeof l=="object"&&"type"in l?Z({tiptapDoc:l}):Z(l),ee=Me({strict:!1}).autosend===Ee;p.useEffect(()=>{if(!ee||S.length>0)return;const l=He(sessionStorage,D,t);l&&Z(l.message).then(()=>{We(sessionStorage,D,t)})},[ee,S.length,D,t,Z]);const fe={messages:S,status:bt(P),sendMessage:pe,stop:()=>{ue()},submit:(l,d)=>u.submit(l,d),error:B,clearError:()=>N(null),finishReason:G,clearFinishReason:()=>u.finishReason.set(null),isStreaming:F,isChatEmpty:I,isWaitingForApprovals:Y??!1,isRunInProgress:z,hasMoreOlder:H,isFetchingOlder:W,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return ie.jsx(me.Provider,{value:fe,children:e})}function Ft(){const t=p.useContext(me);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function jt(){return p.useContext(me)}function St(){const t=p.useContext(ge);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function Mt(){const t=p.useContext(xe);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function Ut(){return p.useContext(xe)}function Et(){return p.useContext(ge)}export{Lt as A,vt as C,Ft as a,St as b,Mt as c,Et as d,Pe as e,jt as f,ut as g,Nt as h,Ut as i,rt as p,Dt as t,dt as u};
@@ -1 +0,0 @@
1
- import{R as Ke,U as te,e as C,j as t,E as Te,r as w,q as ie,G as Ge,c as J,bg as Qe,l as le,d as Ye,M as G,B as W,o as Xe,g as ae,bh as ke}from"./index-Bja6OpPs.js";import{E as Pe}from"./empty-state-CKyi-9Wl.js";import{u as Ze,a as Ee}from"./use-collections-e25i0NM-.js";import{u as ce}from"./constants-Oykg5_q9.js";import{F as se,a as et,b as de,d as me}from"./form-DMPH0FOJ.js";import{I as ue}from"./input-D9gxUyjr.js";import{T as re}from"./textarea-DGZy_omr.js";import{a as tt,b as st,V as pe}from"./layout-CfSS4bsq.js";import{S as ot,W as nt,a as rt}from"./index-DUzjuDnX.js";import{g as it,M as lt,b as je}from"./types-Dn1K45P2.js";import{A as at,a as ct,b as dt}from"./alert-DkX6LwPv.js";import{d as be,S as Ne,a as ve,b as Se,c as oe}from"./select-fwtyEN3G.js";import{c as mt,b as ye,T as we,a as Ce}from"./tooltip-BvIsFjJR.js";import{i as ut}from"./AlertCircle-f1EMyhcF.js";import{R as pt,P as xt,a5 as ft,M as ht,a6 as gt,E as Ie}from"./agent-icon-D4vfmbIE.js";import{a as jt}from"./Eye-DWIY-6KS.js";import{i as bt}from"./Play-VGEgQ-36.js";import{i as Nt}from"./ChevronRight-TMlXoq-Z.js";import{O as vt,M as St}from"./index-CTo6iOJE.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./tools-list-Dpd5zOg1.js";import{a as Re,u as _e}from"./use-connection-BQxCYR_o.js";import{b as It}from"./use-mcp-tools-DkcEQK3V.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as $e}from"./integration-icon-BffTGZN4.js";import{f as Tt,i as kt}from"./chat-context-Bnval_3z.js";import{u as Pt}from"./shell-layout-I9tl7R9J.js";import{M as Et}from"./monaco-editor-DtMcxLSi.js";import{E as Rt}from"./empty-state-C-NWO5ph.js";import{n as _t}from"./Container-B1sUXs1U.js";import"./label-BL0BsZ1B.js";import"./index-N_rB2zyq.js";import"./sidebar-CAkfGpdS.js";import"./sheet-IM6_8Cdx.js";import"./X-DvNDI9Zw.js";import"./index-xAwaYY9z.js";import"./collections-NKJwWp8f.js";import"./index-C6M-_40T.js";import"./use-virtual-mcp-BNfSbQBW.js";import"./resizable-a1gJgrB1.js";import"./ZoomOut-Bj5jamAx.js";import"./badge-C8j1DE3m.js";import"./spinner-D4UjUyLz.js";import"./view-mode-toggle-DCljG_Km.js";import"./dialog-DCjJZndp.js";import"./scroll-area-Ds73tc0J.js";import"./index-lU9yS_Jh.js";import"./hover-card-CxtN1xCB.js";import"./dropdown-menu-BnsK64En.js";import"./Check-CtI-OH3k.js";import"./DotsVertical-DNPNHBpl.js";import"./Plus-DXVOsj8b.js";import"./Tool01-D7SzxWeU.js";import"./XClose-BdAeKt9F.js";import"./accordion-BFQ7Yu8X.js";import"./index-C7oVr4Gj.js";import"./create-sse-subscription-BS5983N4.js";import"./ChevronDown-BL2fNdeZ.js";import"./ChevronUp-O10NbvHe.js";import"./SwitchHorizontal01-Den03c4j.js";import"./RefreshCcw01-CxP3kNii.js";import"./XCircle-DBS00WN3.js";import"./ArrowUpRight-DDOS_CqL.js";import"./ZapSquare-CC0ClMfp.js";import"./Users03-e9b5gRLu.js";import"./CheckCircle-Dk0E48Vj.js";import"./ChevronLeft-ItYaMHNU.js";import"./Globe01-Cjaw-3jR.js";import"./FilterLines-CWRo79Yt.js";import"./Star01-BT882_xb.js";import"./Palette-DkgVQjRz.js";import"./HardDrive-Ddx5WtDi.js";import"./Stars02-lM9wDOP9.js";import"./Key01-ChvR9ujt.js";import"./LinkExternal01-Bo28LxVY.js";import"./Monitor01-Cx9Nl0mU.js";import"./Sun-CNIfXy2-.js";import"./SearchMd-B9xeWi0e.js";import"./Settings02-DYlioLKt.js";import"./Shield01-CLHpjaQL.js";import"./Stars01-DDxsFd_C.js";import"./Trash01-C2MDqKmR.js";import"./Upload01-BTsf5tML.js";import"./User01-B1vfX-f8.js";import"./Users01-dpqTHJ7Y.js";import"./Zap-aFVcxgaa.js";import"./extract-connection-data-AirIeyvr.js";import"./generate-id-i1xx8q5L.js";import"./use-registry-connections-B6OVBI_G.js";import"./use-organization-settings-CVmm-jyI.js";import"./index-DtSBWsbe.js";import"./popover-OiarPewu.js";import"./use-create-virtual-mcp-trxCQUHO.js";import"./use-navigate-to-agent-sJoZ-Wbv.js";import"./tab-id-BFVzx5fb.js";import"./decopilot-sse-pool-02ukeQqS.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-ai-providers-BQwBnNI3.js";import"./avatar-ETg7Q-GU.js";import"./required-auth-layout-CRGKVRTF.js";import"./useRouterState-CI4Wmw4H.js";import"./use-org-sso-D2JNbrnR.js";import"./index-CALXjj7d.js";Ke({title:te().min(1),description:te().nullable(),body:te()});function ne(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function At(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(o=>o==="mcps"),n=e>=0?s[e+1]:void 0;return n?decodeURIComponent(n):void 0}function Ot(s){const e=C.c(13),{form:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=o):o=e[0];let r;e[1]!==n.control?(r=t.jsxs("div",{className:"flex flex-col gap-4",children:[o,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(se,{control:n.control,name:"title",render:Ut}),t.jsx(se,{control:n.control,name:"description",render:Dt})]})]}),e[1]=n.control,e[2]=r):r=e[2];let i,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=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]=i,e[4]=a):(i=e[3],a=e[4]);let c;e[5]!==n.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[i,a,t.jsx(se,{control:n.control,name:"body",render:Mt})]}),e[5]=n.control,e[6]=c):c=e[6];let l;e[7]!==r||e[8]!==c?(l=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:[r,c]}),e[7]=r,e[8]=c,e[9]=l):l=e[9];let p;return e[10]!==n||e[11]!==l?(p=t.jsx(et,{...n,children:l}),e[10]=n,e[11]=l,e[12]=p):p=e[12],p}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 Ut(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 zt(s){const e=C.c(36),{providerId:n,promptId:o}=s,{org:r}=ie(),i=n||null;let a;e[0]!==r.id||e[1]!==r.slug||e[2]!==i?(a={connectionId:i,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=i,e[3]=a):a=e[3];const c=ce(a),l=Ze(n,"PROMPT",o,c),p=Ee(n,"PROMPT",c),f=p.update.isPending;let u;e[4]!==l?(u=l?{title:l.title,description:l.description??null,body:ne(l)}:void 0,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==u?(h={values:u},e[6]=u,e[7]=h):h=e[7];const N=Ge(h);let T;e[8]!==N||e[9]!==l?(T=()=>{l&&N.reset({title:l.title,description:l.description??null,body:ne(l)})},e[8]=N,e[9]=l,e[10]=T):T=e[10];const R=T;let _;e[11]!==p.update||e[12]!==N||e[13]!==o?(_=N.handleSubmit(async j=>{const P=await p.update.mutateAsync({id:o,data:{title:j.title,description:j.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:j.body}}]}});N.reset({title:P.title,description:P.description??null,body:ne(P)})}),e[11]=p.update,e[12]=N,e[13]=o,e[14]=_):_=e[14];const A=_;if(!l){let j;return e[15]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pe,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=j):j=e[15],j}let y;e[16]!==l.title?(y=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:l.title}),e[16]=l.title,e[17]=y):y=e[17];let k;e[18]!==l.description?(k=l.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:l.description})]}):null,e[18]=l.description,e[19]=k):k=e[19];let I;e[20]!==y||e[21]!==k?(I=t.jsx(st,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,k]})}),e[20]=y,e[21]=k,e[22]=I):I=e[22];let g;e[23]!==A?(g=()=>{A()},e[23]=A,e[24]=g):g=e[24];let v;e[25]!==N.formState.isDirty||e[26]!==f||e[27]!==R||e[28]!==g?(v=t.jsx(tt,{children:t.jsx(ot,{onSave:g,onUndo:R,isDirty:N.formState.isDirty,isSaving:f})}),e[25]=N.formState.isDirty,e[26]=f,e[27]=R,e[28]=g,e[29]=v):v=e[29];let S;e[30]!==N?(S=t.jsx("div",{className:"h-full",children:t.jsx(Ot,{form:N})}),e[30]=N,e[31]=S):S=e[31];let $;return e[32]!==v||e[33]!==S||e[34]!==I?($=t.jsxs(pe,{children:[I,v,S]}),e[32]=v,e[33]=S,e[34]=I,e[35]=$):$=e[35],$}function Bt(s){const e=C.c(4),{itemId:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=At(),e[0]=o):o=e[0];const r=o;if(!r){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(Pe,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let i;return e[2]!==n?(i=t.jsx(Te,{children:t.jsx(w.Suspense,{fallback:null,children:t.jsx(zt,{providerId:r,promptId:n})})}),e[2]=n,e[3]=i):i=e[3],i}function Ae(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("min-w-0 overflow-hidden",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Oe(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("ol",{"data-slot":"breadcrumb-list",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function V(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("inline-flex items-center gap-1.5 min-w-0",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("li",{"data-slot":"breadcrumb-item",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Q(s){const e=C.c(10);let n,o,r;e[0]!==s?({asChild:n,className:o,...r}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=r):(n=e[1],o=e[2],r=e[3]);const i=n?Qe:"a";let a;e[4]!==o?(a=J("hover:text-foreground transition-colors truncate",o),e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==i||e[7]!==r||e[8]!==a?(c=t.jsx(i,{"data-slot":"breadcrumb-link",className:a,...r}),e[6]=i,e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function Me(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("text-foreground font-medium truncate",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Y(s){const e=C.c(12);let n,o,r;e[0]!==s?({children:n,className:o,...r}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=r):(n=e[1],o=e[2],r=e[3]);let i;e[4]!==o?(i=J("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",o),e[4]=o,e[5]=i):i=e[5];let a;e[6]!==n?(a=n??t.jsx(Nt,{}),e[6]=n,e[7]=a):a=e[7];let c;return e[8]!==r||e[9]!==i||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:i,...r,children:a}),e[8]=r,e[9]=i,e[10]=a,e[11]=c):c=e[11],c}const Lt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ft(s){const e=C.c(11),{toolName:n,connectionId:o,siblings:r,onSelectInstance:i,onBack:a}=s;let c;e[0]!==o?(c={connectionId:o},e[0]=o,e[1]=c):c=e[1];const l=wt(c);if(!l.isAuthenticated){let u;return e[2]!==l.supportsOAuth||e[3]!==a?(u=t.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?t.jsx(vt,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(St,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=a,e[4]=u):u=e[4],u}const p=`${o}:${n}`;let f;return e[5]!==o||e[6]!==i||e[7]!==r||e[8]!==p||e[9]!==n?(f=t.jsx(Vt,{toolName:n,connectionId:o,siblings:r,onSelectInstance:i},p),e[5]=o,e[6]=i,e[7]=r,e[8]=p,e[9]=n,e[10]=f):f=e[10],f}function Vt({toolName:s,connectionId:e,siblings:n,onSelectInstance:o}){const{replayId:r}=Ye({strict:!1}),i=(()=>{if(!r)return null;const d=`replay-${r}`,m=sessionStorage.getItem(d);if(!m)return null;sessionStorage.removeItem(d);try{return JSON.parse(m)}catch{return null}})(),a=(()=>{if(!i)return null;const d={};for(const[m,b]of Object.entries(i))b!==null&&typeof b=="object"?d[m]=JSON.stringify(b,null,2):d[m]=b;return d})(),[c,l]=w.useState(a??{}),[p,f]=w.useState(i?JSON.stringify(i,null,2):"{}"),[u,h]=w.useState(null),[N,T]=w.useState(null),[R,_]=w.useState(null),[A,y]=w.useState(null),[k,I]=w.useState(!1),[g,v]=w.useState(null),{org:S}=ie(),$=Re(e),j=Tt(),P=kt(),{setChatOpen:z}=Pt(),D=`${e}:${s}`,O=ce({connectionId:e,orgId:S.id,orgSlug:S.slug}),U=It({client:O}),x=U.data?.tools?.find(d=>d.name===s),E=it(x?._meta),B=d=>{if(!j)return;const m=$t(d.content);m.content.length>0&&(z(!0),j.sendMessage({tiptapDoc:m}))},[M,X]=w.useState("json"),[De,Ue]=w.useState(!1);E&&!De&&(X("ui"),Ue(!0));const xe=x?.inputSchema?.properties,fe=xe?Object.keys(xe):[],q=fe.length>0,H={};if(q&&x?.inputSchema?.properties)for(const d of fe)H[d]=x.inputSchema.required?.includes(d)?"":void 0;const Z=d=>Object.prototype.hasOwnProperty.call(c,d),ze=async()=>{I(!0),y(null),h(null),T(null),_(null),v(null);const d=performance.now();try{if(!O)throw new Error("MCP client is not available");const m=q?{...H,...c}:(()=>{const L=p.trim();if(!L)return{};const F=JSON.parse(L);if(F&&typeof F=="object")return F;throw new Error("Raw JSON input must be an object.")})();q&&x?.inputSchema?.properties&&Object.entries(x.inputSchema.properties).forEach(([L,F])=>{if((F.type==="object"||F.type==="array")&&typeof m[L]=="string")try{m[L]=JSON.parse(m[L])}catch{}});const b=await O.callTool({name:s,arguments:m}),K=b.structuredContent??b,qe=performance.now(),We=Math.round(qe-d);h(K),T(b),_(m);const He=JSON.stringify(K),ge=new TextEncoder().encode(He).length;v({duration:`${We}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(m){const b=m instanceof Error?m.message:String(m);y(b||"Unknown error occurred");const K=performance.now();v({duration:`${Math.round(K-d)}ms`})}finally{I(!1)}},ee=(d,m)=>{l(b=>({...b,[d]:m}))},Be=()=>{h(null),T(null),_(null),y(null),v(null)},Le=x?.name??Lt(s),Fe=t.jsx(Ae,{children:t.jsxs(Oe,{children:[t.jsx(V,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:S.slug},children:"Connections"})})}),t.jsx(Y,{}),$&&t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:S.slug,appSlug:yt($)},search:{tab:"tools"},children:$.title})})}),t.jsx(Y,{})]}),t.jsx(V,{children:t.jsx(Me,{children:Le})})]})}),he=n.length>1&&t.jsxs(be,{value:e,onValueChange:o,children:[t.jsx(Ne,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ve,{})}),t.jsx(Se,{children:n.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($e,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Ve=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"}),x?.inputSchema?.required&&x.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:q&&x?.inputSchema?.properties?Object.entries(x.inputSchema.properties).map(([d,m])=>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,x.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:m.type})]}),m.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:m.description}),m.type==="object"||m.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:Z(d)?c[d]??"":H[d]??"",onChange:b=>ee(d,b.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):m.type==="boolean"?t.jsxs(be,{value:Z(d)?String(c[d]??""):"",onValueChange:b=>ee(d,b==="true"),children:[t.jsx(Ne,{children:t.jsx(ve,{placeholder:"Select true or false..."})}),t.jsxs(Se,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:Z(d)?c[d]??"":H[d]??"",onChange:b=>ee(d,b.target.value),placeholder:`Enter ${d}...`})]},d)):x?.inputSchema&&!q?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:p,onChange:d=>f(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:k?t.jsxs(W,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(pt,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(W,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:ze,children:[t.jsx(bt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),Je=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:[g&&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(xt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.duration})]}),g.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ft,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.tokens})]}),g.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ht,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.bytes})]}),g.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:g.cost})})]}),E&&t.jsx(mt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(gt,{size:14})})}),t.jsx(Ce,{children:"Interactive view"})]}),t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(Ie,{size:14})})}),t.jsx(Ce,{children:"JSON view"})]})]})})]})]}),A&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(at,{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(ut,{className:"h-4 w-4"}),t.jsx(ct,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(dt,{className:"text-xs text-destructive",children:A})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:E&&M==="ui"&&O?t.jsx(w.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(lt,{resourceURI:E,toolInfo:x?{tool:x}:void 0,toolInput:R??void 0,toolResult:N??void 0,displayMode:"fullscreen",minHeight:je.view.minHeight,maxHeight:je.view.maxHeight,client:O,onMessage:B,onUpdateModelContext:d=>P?.setAppContext(D,d),onTeardown:()=>P?.clearAppContext(D),className:"h-full"})}):u?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(u,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(W,{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(u,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(jt,{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(Ie,{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(pe,{breadcrumb:Fe,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($e,{icon:$?.icon||null,name:$?.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:[U.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):U.isLoading?t.jsx(le,{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:U.isSuccess?"ready":U.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:x?.annotations,_meta:x?._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:x?.description||"No description available"})]}),n.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:Ve}),Je]})})]})})}function Jt(s){const e=C.c(10),{itemId:n,siblings:o,onBack:r}=s,[i,a]=w.useState(o[0]?.id??"");let c;e[0]!==i||e[1]!==o?(c=o.find(h=>h.id===i)?.id??o[0]?.id??"",e[0]=i,e[1]=o,e[2]=c):c=e[2];const l=c;if(!Re(l||void 0)||!l){let h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(h=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]=h):h=e[3],h}let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=f):f=e[4];let u;return e[5]!==l||e[6]!==r||e[7]!==o||e[8]!==n?(u=t.jsx(w.Suspense,{fallback:f,children:t.jsx(Ft,{toolName:n,connectionId:l,siblings:o,onSelectInstance:a,onBack:r})}),e[5]=l,e[6]=r,e[7]=o,e[8]=n,e[9]=u):u=e[9],u}const qt={workflow:rt,workflow_execution:nt,prompt:Bt};function Wt(){const s=C.c(9),e=ke();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=n):n=s[0];const o=ae(n),r=decodeURIComponent(o.itemId);let i;s[1]!==o.appSlug?(i={slug:o.appSlug},s[1]=o.appSlug,s[2]=i):i=s[2];const a=_e(i);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const l=c,p=Ht;let f;return s[5]!==l||s[6]!==r||s[7]!==a?(f=t.jsx(Jt,{itemId:r,siblings:a,onBack:l,onUpdate:p}),s[5]=l,s[6]=r,s[7]=a,s[8]=f):f=s[8],f}async function Ht(s){return Promise.resolve()}function Kt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Gt(){const s=C.c(41),e=ke();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=n):n=s[0];const o=ae(n),r=decodeURIComponent(o.collectionName),i=decodeURIComponent(o.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:l}=ie();let p;s[3]!==o.appSlug?(p={slug:o.appSlug},s[3]=o.appSlug,s[4]=p):p=s[4];const u=_e(p)[0]??null,h=u?.id??"",N=h||"no-connection",T=h??null;let R;s[5]!==l.id||s[6]!==l.slug||s[7]!==T?(R={connectionId:T,orgId:l.id,orgSlug:l.slug},s[5]=l.id,s[6]=l.slug,s[7]=T,s[8]=R):R=s[8];const _=ce(R),A=Ee(N,r,_);let y;s[9]!==A||s[10]!==i?(y=async M=>{i&&await A.update.mutateAsync({id:i,data:M})},s[9]=A,s[10]=i,s[11]=y):y=s[11];const k=y;let I;s[12]!==r?(I=r?.toLowerCase(),s[12]=r,s[13]=I):I=s[13];const g=I,v=g&&qt[g];let S;s[14]!==r?(S=Kt(r),s[14]=r,s[15]=S):S=s[15];const $=S;let j;s[16]!==l.slug?(j=t.jsx(V,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections",params:{org:l.slug},children:"Connections"})})}),s[16]=l.slug,s[17]=j):j=s[17];let P;s[18]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Y,{}),s[18]=P):P=s[18];let z;s[19]!==r||s[20]!==u||s[21]!==l.slug||s[22]!==o.appSlug?(z=u&&t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(Q,{asChild:!0,children:t.jsx(G,{to:"/$org/settings/connections/$appSlug",params:{org:l.slug,appSlug:o.appSlug},search:{tab:r},children:u.title})})}),t.jsx(Y,{})]}),s[19]=r,s[20]=u,s[21]=l.slug,s[22]=o.appSlug,s[23]=z):z=s[23];let D;s[24]!==$?(D=t.jsx(V,{children:t.jsx(Me,{children:$})}),s[24]=$,s[25]=D):D=s[25];let O;s[26]!==z||s[27]!==D||s[28]!==j?(O=t.jsx(Ae,{children:t.jsxs(Oe,{children:[j,P,z,D]})}),s[26]=z,s[27]=D,s[28]=j,s[29]=O):O=s[29];const U=O;if(v){let M;return s[30]!==v||s[31]!==c||s[32]!==k||s[33]!==i?(M=t.jsx(v,{itemId:i,onBack:c,onUpdate:k}),s[30]=v,s[31]=c,s[32]=k,s[33]=i,s[34]=M):M=s[34],M}let x;s[35]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(_t,{size:36,className:"text-muted-foreground"}),s[35]=x):x=s[35];let E;s[36]!==c?(E=t.jsx(Rt,{icon:x,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=E):E=s[37];let B;return s[38]!==U||s[39]!==E?(B=t.jsx(pe,{breadcrumb:U,children:E}),s[38]=U,s[39]=E,s[40]=B):B=s[40],B}function Qt(){const s=C.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 n=ae(e);if(decodeURIComponent(n.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 i;return s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Gt,{}),s[2]=i):i=s[2],i}function Ho(){const s=C.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Te,{children:t.jsx(w.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(Qt,{})})}),s[0]=e):e=s[0],e}export{Ho as default};
@@ -1 +0,0 @@
1
- import{R as ge,aI as Ie,b6 as Ae,U as ce,aG as $e,e as P,j as t,l as je,B as G,r as X,c as ve,q as J,s as De,K as ne,f as Y,w as de,u as Pe,b7 as Oe,E as Me,g as ze,F as Ve,G as Ee,H as Ue,J as Fe,b8 as Re,o as K,I as Le}from"./index-Bja6OpPs.js";import{g as He}from"./generate-id-i1xx8q5L.js";import{E as be}from"./empty-state-CKyi-9Wl.js";import{E as Be,c as Ge,r as We,b as Xe,d as qe}from"./connection-form-helpers-D79c5tFA.js";import{c as Qe,S as Ke}from"./index-CTo6iOJE.js";import{u as Ne,T as Je}from"./tools-list-Dpd5zOg1.js";import{u as Ye}from"./use-members-DERsL77r.js";import{A as Ze}from"./avatar-ETg7Q-GU.js";import{a as ye,b as _e,u as et}from"./use-connection-BQxCYR_o.js";import{u as re,S as tt}from"./constants-Oykg5_q9.js";import{b as st}from"./use-mcp-tools-DkcEQK3V.js";import{g as ae,M as nt,a as ot}from"./types-Dn1K45P2.js";import{a as it}from"./use-mcp-prompts-D9JZQ88U.js";import{I as oe}from"./integration-icon-BffTGZN4.js";import{s as rt}from"./Plus-DXVOsj8b.js";import{a as Se}from"./Settings02-DYlioLKt.js";import{s as le}from"./Trash01-C2MDqKmR.js";import{b as at,a as lt,d as ct,S as dt,c as mt}from"./sheet-IM6_8Cdx.js";import{F as R,b as L,c as H,d as V,f as B,e as ut,a as xt}from"./form-DMPH0FOJ.js";import{I as W}from"./input-D9gxUyjr.js";import{u as pt,D as ft}from"./use-delete-connection-DEEK0oTT.js";import{V as ht}from"./layout-CfSS4bsq.js";import{c as gt,C as jt,B as vt,a as bt,b as Nt,d as yt,e as _t}from"./monitoring-stats-row-fp6agr8k.js";import{a as St}from"./use-virtual-mcp-BNfSbQBW.js";import{i as Ce}from"./ChevronRight-TMlXoq-Z.js";import{a as we}from"./Users03-e9b5gRLu.js";import{T as ee,a as Ct,b as te,c as wt}from"./tabs-Dsmq9_wP.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as kt}from"./ZapSquare-CC0ClMfp.js";import{a4 as Tt,Q as It}from"./agent-icon-D4vfmbIE.js";import{b as At}from"./Tool01-D7SzxWeU.js";import{C as $t}from"./collection-search-BPGQygd8.js";import{C as Dt}from"./card-lOxFSSkP.js";import{B as Pt}from"./badge-C8j1DE3m.js";import{D as Ot,a as Mt,b as zt,c as me}from"./dropdown-menu-BnsK64En.js";import{d as ue,S as xe,a as pe,b as fe,c as F}from"./select-fwtyEN3G.js";import{i as Vt}from"./CheckCircle-Dk0E48Vj.js";import{t as Et}from"./ChevronDown-BL2fNdeZ.js";import{n as Ut}from"./Container-B1sUXs1U.js";import{s as se}from"./Star01-BT882_xb.js";import{s as Ft}from"./RefreshCcw01-CxP3kNii.js";import{s as Rt}from"./XClose-BdAeKt9F.js";import"./collections-NKJwWp8f.js";import"./Key01-ChvR9ujt.js";import"./index-xAwaYY9z.js";import"./index-C6M-_40T.js";import"./extract-connection-data-AirIeyvr.js";import"./use-registry-connections-B6OVBI_G.js";import"./use-organization-settings-CVmm-jyI.js";import"./index-DtSBWsbe.js";import"./popover-OiarPewu.js";import"./tooltip-BvIsFjJR.js";import"./Check-CtI-OH3k.js";import"./SearchMd-B9xeWi0e.js";import"./use-create-virtual-mcp-trxCQUHO.js";import"./use-navigate-to-agent-sJoZ-Wbv.js";import"./Eye-DWIY-6KS.js";import"./use-org-auth-client-CF8P1btO.js";import"./User01-B1vfX-f8.js";import"./use-collections-e25i0NM-.js";import"./X-DvNDI9Zw.js";import"./label-BL0BsZ1B.js";import"./alert-dialog-DKXzP7Bt.js";import"./index-N_rB2zyq.js";import"./sidebar-CAkfGpdS.js";import"./AlertCircle-f1EMyhcF.js";import"./SwitchHorizontal01-Den03c4j.js";import"./XCircle-DBS00WN3.js";import"./ArrowUpRight-DDOS_CqL.js";import"./ChevronLeft-ItYaMHNU.js";import"./ChevronUp-O10NbvHe.js";import"./DotsVertical-DNPNHBpl.js";import"./ZoomOut-Bj5jamAx.js";import"./Globe01-Cjaw-3jR.js";import"./FilterLines-CWRo79Yt.js";import"./Palette-DkgVQjRz.js";import"./HardDrive-Ddx5WtDi.js";import"./Stars02-lM9wDOP9.js";import"./LinkExternal01-Bo28LxVY.js";import"./Monitor01-Cx9Nl0mU.js";import"./Sun-CNIfXy2-.js";import"./Play-VGEgQ-36.js";import"./Shield01-CLHpjaQL.js";import"./Stars01-DDxsFd_C.js";import"./Upload01-BTsf5tML.js";import"./Users01-dpqTHJ7Y.js";import"./Zap-aFVcxgaa.js";const Lt=ge({scopes:$e(ce()).describe("List of scopes available"),stateSchema:Ie(ce(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Ht=[{name:"MCP_CONFIGURATION",inputSchema:ge({}),outputSchema:Lt}];function Bt(s){const e=P.c(39),{instance:n,onConfigure:i,onAuthenticate:a,onDelete:o}=s;let r;e[0]!==n.id?(r={connectionId:n.id},e[0]=n.id,e[1]=r):r=e[1];const c=Ne(r),d=!(n.connection_type==="VIRTUAL")&&c.supportsOAuth&&!c.isAuthenticated,u=d?"border-destructive/50 bg-destructive/5":"border-transparent";let p;e[2]!==u?(p=ve("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",u),e[2]=u,e[3]=p):p=e[3];let l;e[4]!==n.icon||e[5]!==n.title?(l=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=l):l=e[6];let f;e[7]!==n.title?(f=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=f):f=e[8];let g;e[9]!==d?(g=d&&t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}),e[9]=d,e[10]=g):g=e[10];let v;e[11]!==f||e[12]!==g?(v=t.jsxs("div",{className:"flex-1 min-w-0",children:[f,g]}),e[11]=f,e[12]=g,e[13]=v):v=e[13];let b;e[14]!==n||e[15]!==d||e[16]!==a?(b=d&&t.jsx(G,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>a(n),children:"Authorize"}),e[14]=n,e[15]=d,e[16]=a,e[17]=b):b=e[17];let j;e[18]!==n||e[19]!==i?(j=()=>i(n),e[18]=n,e[19]=i,e[20]=j):j=e[20];let _;e[21]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(Se,{size:13}),e[21]=_):_=e[21];let w;e[22]!==j?(w=t.jsx(G,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:j,title:"Configure",children:_}),e[22]=j,e[23]=w):w=e[23];let S;e[24]!==n||e[25]!==o?(S=()=>o(n),e[24]=n,e[25]=o,e[26]=S):S=e[26];let N;e[27]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(le,{size:13}),e[27]=N):N=e[27];let k;e[28]!==S?(k=t.jsx(G,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:S,title:"Delete",children:N}),e[28]=S,e[29]=k):k=e[29];let y;e[30]!==w||e[31]!==k||e[32]!==b?(y=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[b,w,k]}),e[30]=w,e[31]=k,e[32]=b,e[33]=y):y=e[33];let C;return e[34]!==y||e[35]!==p||e[36]!==l||e[37]!==v?(C=t.jsxs("div",{className:p,children:[l,v,y]}),e[34]=y,e[35]=p,e[36]=l,e[37]=v,e[38]=C):C=e[38],C}function Gt(s){const e=P.c(15),{instance:n,onConfigure:i}=s;let a;e[0]!==n.icon||e[1]!==n.title?(a=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=a):a=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 r;e[5]!==n||e[6]!==i?(r=()=>i(n),e[5]=n,e[6]=i,e[7]=r):r=e[7];let c;e[8]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(Se,{size:13}),e[8]=c):c=e[8];let m;e[9]!==r?(m=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(G,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:r,title:"Configure",children:c})}),e[9]=r,e[10]=m):m=e[10];let d;return e[11]!==a||e[12]!==o||e[13]!==m?(d=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[a,o,m]}),e[11]=a,e[12]=o,e[13]=m,e[14]=d):d=e[14],d}function Wt(s){const e=P.c(25),{instances:n,onConfigure:i,onAuthenticate:a,onDelete:o,onAdd:r,isAdding:c}=s;if(n.length===0)return null;const m=n.length===1?"Instance":"Instances";let d;e[0]!==m?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:m}),e[0]=m,e[1]=d):d=e[1];let u;e[2]!==c?(u=c?t.jsx(je,{size:13,className:"animate-spin"}):t.jsx(rt,{size:13}),e[2]=c,e[3]=u):u=e[3];let p;e[4]!==c||e[5]!==r||e[6]!==u?(p=t.jsxs(G,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:r,disabled:c,children:[u,"Add instance"]}),e[4]=c,e[5]=r,e[6]=u,e[7]=p):p=e[7];let l;e[8]!==d||e[9]!==p?(l=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,p]}),e[8]=d,e[9]=p,e[10]=l):l=e[10];let f;if(e[11]!==n||e[12]!==a||e[13]!==i||e[14]!==o){let b;e[16]!==a||e[17]!==i||e[18]!==o?(b=j=>t.jsx(X.Suspense,{fallback:t.jsx(Gt,{instance:j,onConfigure:i}),children:t.jsx(Bt,{instance:j,onConfigure:i,onAuthenticate:a,onDelete:o})},j.id),e[16]=a,e[17]=i,e[18]=o,e[19]=b):b=e[19],f=n.map(b),e[11]=n,e[12]=a,e[13]=i,e[14]=o,e[15]=f}else f=e[15];let g;e[20]!==f?(g=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:f}),e[20]=f,e[21]=g):g=e[21];let v;return e[22]!==l||e[23]!==g?(v=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,g]}),e[22]=l,e[23]=g,e[24]=v):v=e[24],v}const Xt=[{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 Qt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Kt(s){const e=P.c(4),{connectionId:n,orgId:i,orgSlug:a,timeframe:o}=s;let r;e[0]!==i||e[1]!==a?(r={connectionId:tt,orgId:i,orgSlug:a},e[0]=i,e[1]=a,e[2]=r):r=e[2];const c=re(r),m=qt(o),{data:d}=De({queryKey:ne.connectionActivity(n,o,i),queryFn:async()=>{const g=await c.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:m.startDate.toISOString(),endDate:m.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return g.structuredContent??g},staleTime:3e5}),u=gt(d?.logs??[],m),p=u.data,l=u.totalCalls>0;let f;return e[3]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[3]=f):f=e[3],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:u.totalCalls.toLocaleString()}),f]}),u.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:u.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),u.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(u.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),l?t.jsxs("div",{children:[t.jsx(jt,{config:Qt,className:"h-16 w-full",children:t.jsxs(vt,{data:p,barCategoryGap:"4%",children:[t.jsx(bt,{content:t.jsx(Nt,{labelFormatter:Yt}),cursor:{fill:"var(--muted)"}}),t.jsx(yt,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:p.map(Jt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[p.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 Jt(s,e){return t.jsx(_t,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function Yt(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function Zt(){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 es(s){const e=P.c(14),{connectionId:n}=s,[i,a]=X.useState("14d"),{org:o}=J();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=r):r=e[0];let c;e[1]!==i?(c=Xt.map(l=>t.jsx("button",{type:"button",onClick:()=>a(l.value),className:ve("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",i===l.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:l.label},l.value)),e[1]=i,e[2]=c):c=e[2];let m;e[3]!==c?(m=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[r,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:c})]}),e[3]=c,e[4]=m):m=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Zt,{}),e[5]=d):d=e[5];let u;e[6]!==n||e[7]!==o.id||e[8]!==o.slug||e[9]!==i?(u=t.jsx(X.Suspense,{fallback:d,children:t.jsx(Kt,{connectionId:n,orgId:o.id,orgSlug:o.slug,timeframe:i})}),e[6]=n,e[7]=o.id,e[8]=o.slug,e[9]=i,e[10]=u):u=e[10];let p;return e[11]!==m||e[12]!==u?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[m,u]}),e[11]=m,e[12]=u,e[13]=p):p=e[13],p}function ts(s){const e=P.c(15),{virtualMcp:n,org:i}=s,a=Y();let o;e[0]!==a||e[1]!==i||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:i,taskId:p},search:{virtualmcpid:n.id}})},e[0]=a,e[1]=i,e[2]=n.id,e[3]=o):o=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(we,{size:16}),e[4]=r):r=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:r}),e[5]=n.icon,e[6]=n.title,e[7]=c):c=e[7];let m;e[8]!==n.title?(m=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=d):d=e[10];let u;return e[11]!==o||e[12]!==c||e[13]!==m?(u=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,m,d]}),e[11]=o,e[12]=c,e[13]=m,e[14]=u):u=e[14],u}function ss(s){const e=P.c(7),{virtualMcps:n,org:i}=s;let a;if(e[0]!==i||e[1]!==n){let r;e[3]!==i?(r=c=>t.jsx(ts,{virtualMcp:c,org:i},c.id),e[3]=i,e[4]=r):r=e[4],a=n.map(r),e[0]=i,e[1]=n,e[2]=a}else a=e[2];let o;return e[5]!==a?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:a})}),e[5]=a,e[6]=o):o=e[6],o}function ns(s){const e=P.c(7),{connection:n}=s,{org:i}=J();let a;e[0]!==n.id?(a={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=a):a=e[1];const o=St(a);if(!(o.length>0)){let d;return e[2]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(t.Fragment,{}),e[2]=d):d=e[2],d}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 m;return e[4]!==i.slug||e[5]!==o?(m=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(ss,{virtualMcps:o,org:i.slug})})]}),e[4]=i.slug,e[5]=o,e[6]=m):m=e[6],m}function os(s){const e=P.c(31),{tools:n,connectionId:i,org:a}=s,o=Y(),{org:r}=J();let c;e[0]!==i||e[1]!==r.id||e[2]!==r.slug?(c={connectionId:i,orgId:r.id,orgSlug:r.slug},e[0]=i,e[1]=r.id,e[2]=r.slug,e[3]=c):c=e[3];const m=re(c),d=ye(i);let u;e[4]!==d||e[5]!==i?(u=d?ke(d):i,e[4]=d,e[5]=i,e[6]=u):u=e[6];const p=u,[l,f]=X.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==m||e[9]!==o||e[10]!==a||e[11]!==l||e[12]!==n){const S=(n??[]).filter(is),N=l.toLowerCase().trim(),k=N?S.filter(h=>h.name.toLowerCase().includes(N)||h.description&&h.description.toLowerCase().includes(N)):S;let y;e[17]!==p||e[18]!==o||e[19]!==a?(y=h=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(h.name)}})},e[17]=p,e[18]=o,e[19]=a,e[20]=y):y=e[20];const C=y;b="flex flex-col h-full overflow-hidden";let I;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=h=>{h.key==="Escape"&&(f(""),h.target.blur())},e[21]=I):I=e[21],e[22]!==l?(j=t.jsx($t,{value:l,onChange:f,placeholder:"Search apps...",onKeyDown:I}),e[22]=l,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=k.length===0?t.jsx(be,{image:null,title:l?"No apps found":"No apps available",description:l?"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:k.map(h=>{const A=ae(h._meta);return t.jsxs(Dt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>C(h),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(nt,{resourceURI:A,toolInfo:{tool:h},displayMode:"inline",minHeight:200,maxHeight:200,client:m})}),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]=m,e[9]=o,e[10]=a,e[11]=l,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 _;e[24]!==g||e[25]!==v?(_=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=_):_=e[26];let w;return e[27]!==b||e[28]!==j||e[29]!==_?(w=t.jsxs("div",{className:b,children:[j,_]}),e[27]=b,e[28]=j,e[29]=_,e[30]=w):w=e[30],w}function is(s){return!!ae(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=r=>r.charAt(0).toUpperCase()+r.slice(1),i=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),a=e.map(n),o=e[e.length-1];return a.length>=2&&o&&i.has(o)?[a.pop(),...a].join(" "):a.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let i;return e[0]!==n?(i=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]=i):i=e[1],i}function rs(s){const e=P.c(50),{tools:n,prompts:i,resources:a,connectionId:o,org:r}=s;let c;e[0]!==i?(c=i===void 0?[]:i,e[0]=i,e[1]=c):c=e[1];const m=c;let d;e[2]!==a?(d=a===void 0?[]:a,e[2]=a,e[3]=d):d=e[3];const u=d,p=Y(),l=ye(o??"");let f;e[4]!==l||e[5]!==o?(f=l?ke(l):o,e[4]=l,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]!==r?(v=function($){!o||!r||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:g,collectionName:"tools",itemId:encodeURIComponent($)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=r,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==r||e[14]!==n?(j=o&&r&&n.some(cs),e[12]=o,e[13]=r,e[14]=n,e[15]=j):j=e[15];const _=j;if(n.length+m.length+u.length===0){let x;return e[16]===Symbol.for("react.memo_cache_sentinel")?(x=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]=x):x=e[16],x}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 N;e[19]!==_?(N=_&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=_,e[20]=N):N=e[20];let k,y;e[21]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),y=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=k,e[22]=y):(k=e[21],y=e[22]);let C;e[23]!==S||e[24]!==N?(C=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(Ct,{variant:"underline",className:"gap-1",children:[S,N,k,y]})}),e[23]=S,e[24]=N,e[25]=C):C=e[25];let I;e[26]!==b||e[27]!==n?(I=n.length>0?n.map(x=>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(x.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(At,{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(x.name)}),x.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:x.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},x.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=I):I=e[28];let h;e[29]!==I?(h=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:I})}),e[29]=I,e[30]=h):h=e[30];let A;e[31]!==o||e[32]!==_||e[33]!==r||e[34]!==n?(A=_&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(os,{tools:n,connectionId:o,org:r})}),e[31]=o,e[32]=_,e[33]=r,e[34]=n,e[35]=A):A=e[35];let M;e[36]!==m?(M=m.length>0?m.map(ls):t.jsx(ie,{label:"prompts"}),e[36]=m,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let T;e[40]!==u?(T=u.length>0?u.map(as):t.jsx(ie,{label:"resources"}),e[40]=u,e[41]=T):T=e[41];let z;e[42]!==T?(z=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:T})}),e[42]=T,e[43]=z):z=e[43];let E;return e[44]!==C||e[45]!==h||e[46]!==A||e[47]!==O||e[48]!==z?(E=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(wt,{defaultValue:"tools",variant:"underline",children:[C,h,A,O,z]})}),e[44]=C,e[45]=h,e[46]=A,e[47]=O,e[48]=z,e[49]=E):E=e[49],E}function as(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(Tt,{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 ls(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(kt,{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 cs(s){return ae(s._meta)}function ds(s){const e=P.c(13),{connection:n,displayTitle:i}=s,a=i??n.title;let o;e[0]!==n.icon||e[1]!==a?(o=t.jsx(oe,{icon:n.icon,name:a,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=a,e[2]=o):o=e[2];let r;e[3]!==a?(r=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:a})}),e[3]=a,e[4]=r):r=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 m;e[7]!==r||e[8]!==c?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[r,c]}),e[7]=r,e[8]=c,e[9]=m):m=e[9];let d;return e[10]!==o||e[11]!==m?(d=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,m]}),e[10]=o,e[11]=m,e[12]=d):d=e[12],d}function ms({form:s,connection:e,hasOAuthToken:n,onReauthenticate:i,onRemoveOAuth:a}){const o=de({control:s.control,name:"ui_type"}),r=de({control:s.control,name:"connection_url"}),{stdioEnabled:c}=Pe(),m=(()=>{if(typeof r!="string"||!r)return!1;try{const l=new URL(r);return l.hostname==="api.githubcopilot.com"&&l.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),d=c||e.connection_type==="STDIO",u=e.connection_type==="VIRTUAL",p=u?Oe(e.connection_url):null;return u?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(R,{control:s.control,name:"ui_type",render:({field:l})=>t.jsxs(L,{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(ue,{value:l.value,onValueChange:l.onChange,children:[t.jsx(V,{children:t.jsxs(xe,{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(pe,{})]})}),t.jsxs(fe,{children:[t.jsx(F,{value:"HTTP",children:"HTTP"}),t.jsx(F,{value:"SSE",children:"SSE"}),t.jsx(F,{value:"Websocket",children:"Websocket"}),d&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:"NPX Package"}),t.jsx(F,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(R,{control:s.control,name:"connection_url",render:({field:f})=>t.jsx(L,{className:"flex-1 min-w-0",children:t.jsx(V,{children:t.jsx(W,{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(ue,{value:l.value,onValueChange:l.onChange,children:[t.jsx(V,{children:t.jsx(xe,{className:"h-10",children:t.jsx(pe,{})})}),t.jsxs(fe,{children:[t.jsx(F,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(F,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(F,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),d&&t.jsxs(t.Fragment,{children:[t.jsx(F,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ut,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(F,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(It,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(B,{})]})}),o==="NPX"&&t.jsx(R,{control:s.control,name:"npx_package",render:({field:l})=>t.jsxs(L,{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(W,{placeholder:"@perplexity-ai/mcp-server",...l,value:l.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(R,{control:s.control,name:"stdio_command",render:({field:l})=>t.jsxs(L,{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(W,{placeholder:"node, bun, python...",...l,value:l.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})}),t.jsx(R,{control:s.control,name:"stdio_args",render:({field:l})=>t.jsxs(L,{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(W,{placeholder:"arg1 arg2 --flag value",...l,value:l.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(B,{})]})})]}),t.jsx(R,{control:s.control,name:"stdio_cwd",render:({field:l})=>t.jsxs(L,{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(W,{placeholder:"/path/to/project (optional)",...l,value:l.value||"",className:"h-10 rounded-lg"})}),t.jsx(B,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(R,{control:s.control,name:"env_vars",render:({field:l})=>t.jsxs(L,{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:l.value??[],onChange:l.onChange})}),t.jsx(B,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(R,{control:s.control,name:"connection_token",render:({field:l})=>t.jsxs(L,{className:"flex flex-col gap-3",children:[t.jsx(H,{className:"text-xs text-muted-foreground font-medium",children:m?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Ot,{children:[t.jsx(Mt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Pt,{variant:"success",className:"gap-1.5",children:[t.jsx(Vt,{size:12}),"Authenticated via OAuth",t.jsx(Et,{size:12})]})})}),t.jsxs(zt,{align:"start",children:[t.jsxs(me,{onClick:i,children:[t.jsx(Ft,{size:16}),"Re-authenticate"]}),t.jsxs(me,{variant:"destructive",onClick:a,children:[t.jsx(le,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&l.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:()=>l.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(Rt,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(W,{type:"password",placeholder:m?"Paste your GitHub PAT":"Enter access token...",...l,value:l.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(ut,{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(B,{})]})})]})}function us(s){return s.command==="npx"}function xs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function ps(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 i=s.connection_headers,a=We(i.envVars);if(us(i)){const r=xs(i);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:r,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:a}}const o=ps(i);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:a}}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 fs(s){let e,n=null,i=null,a=null;return s.ui_type==="NPX"?(e="STDIO",n="",a=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",a=qe(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",i=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...i&&{connection_token:i},...a&&{connection_headers:a},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function hs({connection:s,connectionId:e,org:n,isUpdating:i,tools:a,prompts:o,resources:r,siblings:c}){const m=Y({from:"/$org/settings/connections/$appSlug"}),d=Ve(),u=_e(),{org:p}=J(),l=pt({onSuccess:()=>{c.length<=1&&m({to:"/$org/settings/connections",params:{org:n}})}}),[f,g]=X.useState(null),[v,b]=X.useState(!1),j=Ne({connectionId:e}),{data:_}=Ye(),w=_?.data?.members??[],S=f??s,N=w.find(x=>x.userId===S.created_by),y=s?.connection_type==="VIRTUAL"||j.isAuthenticated,C={...s,tools:a},I=Qe(C,Ht),h=Ee({resolver:Ue(Ge),values:he(f??s)}),A=h.formState.isDirty,M=async()=>{if(!await h.trigger())return;const $=h.getValues(),D=fs($),U=f?.id??e;await u.update.mutateAsync({id:U,data:D}),h.reset($)},O=()=>{h.reset(he(f??s))},T=async x=>{const{token:$,tokenInfo:D,error:U}=await Le({connectionId:x,orgSlug:p.slug,scope:"offline_access"});if(U||!$){K.error(`Authentication failed: ${U}`);return}if(D)try{const q=await fetch(`/api/${p.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:D.accessToken,refreshToken:D.refreshToken,expiresIn:D.expiresIn,scope:D.scope,clientId:D.clientId,clientSecret:D.clientSecret,tokenEndpoint:D.tokenEndpoint})});if(!q.ok)console.error("Failed to save OAuth token:",await q.text()),await u.update.mutateAsync({id:x,data:{connection_token:$}});else try{await u.update.mutateAsync({id:x,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(q){console.error("Error saving OAuth token:",q),await u.update.mutateAsync({id:x,data:{connection_token:$}})}else await u.update.mutateAsync({id:x,data:{connection_token:$}});const Q=new URL(`/api/${p.slug}/mcp/${x}`,window.location.origin);await d.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await d.invalidateQueries({queryKey:ne.mcpClientPrefix()}),K.success("Authentication successful")},z=()=>T(s.id),E=async()=>{try{const x=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!x.ok){const D=await x.text();K.error(`Failed to remove OAuth: ${D}`);return}const $=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await d.invalidateQueries({queryKey:ne.isMCPAuthenticated($.href,null)}),K.success("OAuth removed. You can now re-authenticate with a different account.")}catch(x){console.error("Error removing OAuth token:",x),K.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(ft,{...l}),t.jsx(at,{open:f!==null,onOpenChange:x=>{x||g(null)},children:t.jsxs(lt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(ct,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(dt,{className:"text-base",children:f?.title??s.title}),t.jsx(mt,{className:"text-xs",children:"Update URL, authentication, and other settings"}),N&&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:N.user?.image??void 0,fallback:N.user?.name??N.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.user?.name||N.user?.email})]})]}),t.jsxs(xt,{...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(R,{control:h.control,name:"title",render:({field:x})=>t.jsxs(L,{children:[t.jsx(H,{children:"Name"}),t.jsx(V,{children:t.jsx(W,{...x})}),t.jsx(B,{})]})}),t.jsx(R,{control:h.control,name:"description",render:({field:x})=>t.jsxs(L,{children:[t.jsx(H,{children:"Description"}),t.jsx(V,{children:t.jsx(W,{...x,value:x.value||""})}),t.jsx(B,{})]})})]}),t.jsx(ms,{form:h,connection:f??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:E}),t.jsx(Ke,{connection:f??s,form:h,hasMcpBinding:I,isMCPAuthenticated:y,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(G,{onClick:M,disabled:!A||i,className:"flex-1",children:i?"Saving…":"Save changes"}),A&&t.jsx(G,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(G,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const x=f??s;g(null),l.requestDelete(x)},children:[t.jsx(le,{size:15}),"Delete"]})]})]},f?.id??s.id)]})}),t.jsx(ht,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(ds,{connection:s,displayTitle:(()=>{const x=c[0]??s;return x.app_name?x.title.replace(/\s*\(\d+\)\s*$/,""):x.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(es,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Wt,{instances:c,onConfigure:x=>g(x),onAuthenticate:x=>T(x.id),onDelete:x=>l.requestDelete(x),isAdding:v,onAdd:async()=>{b(!0);try{const x=c[0]??s,$=x.title.replace(/\s*\(\d+\)\s*$/,""),D=c.length+1,U=`${$} (${D})`,Q=He("conn");await u.create.mutateAsync({id:Q,title:U,description:x.description??null,connection_type:x.connection_type,connection_url:x.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:x.created_by,organization_id:x.organization_id,icon:x.icon??null,app_name:x.app_name??null,app_id:x.app_id??null,connection_headers:x.connection_headers??null,oauth_config:null,configuration_state:x.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const q=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await Fe({url:q.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await T(Q)}finally{b(!1)}}}),t.jsx(ns,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(rs,{tools:a,prompts:o,resources:r,connectionId:e,org:n})})]})})]})})]})}function gs(){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 i;s[1]===Symbol.for("react.memo_cache_sentinel")?(i={from:"/shell/$org/settings/connections/$appSlug"},s[1]=i):i=s[1];const{appSlug:a,org:o}=ze(i),{org:r}=J(),c=_e();let m;s[2]!==a?(m={slug:a},s[2]=a,s[3]=m):m=s[3];const d=et(m),u=d[0]??null,p=u?.id??"",l=p||null;let f;s[4]!==r.id||s[5]!==r.slug||s[6]!==l?(f={connectionId:l,orgId:r.id,orgSlug:r.slug},s[4]=r.id,s[5]=r.slug,s[6]=l,s[7]=f):f=s[7];const g=re(f);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=st(v);let j;if(s[10]!==u?.tools||s[11]!==p||s[12]!==d||s[13]!==b){const T=b?b.tools.map(_s):(u?.tools??[]).map(ys);e:{if(d.length<=1){j=T;break e}const z=new Set,E=[],x=bs;for(const $ of d){const D=$.id===p?T:x($.tools);for(const U of D)z.has(U.name)||(z.add(U.name),E.push(U))}j=E.length>0?E:T}s[10]=u?.tools,s[11]=p,s[12]=d,s[13]=b,s[14]=j}else j=s[14];const _=j;let w;s[15]!==g?(w={client:g},s[15]=g,s[16]=w):w=s[16];const{data:S}=it(w);let N;s[17]!==g?(N={client:g},s[17]=g,s[18]=N):N=s[18];const{data:k}=ot(N);let y;s[19]!==S?.prompts?(y=S?.prompts??[],s[19]=S?.prompts,s[20]=y):y=s[20];let C;s[21]!==y?(C=y.map(vs),s[21]=y,s[22]=C):C=s[22];const I=C;let h;s[23]!==k?.resources?(h=k?.resources??[],s[23]=k?.resources,s[24]=h):h=s[24];let A;s[25]!==h?(A=h.map(js),s[25]=h,s[26]=A):A=s[26];const M=A;if(!u){let T;return s[27]!==n||s[28]!==o?(T=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(be,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(G,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=T):T=s[29],T}let O;return s[30]!==c.update.isPending||s[31]!==_||s[32]!==u||s[33]!==p||s[34]!==o||s[35]!==I||s[36]!==M||s[37]!==d?(O=t.jsx(hs,{org:o,connection:u,connectionId:p,isUpdating:c.update.isPending,tools:_,prompts:I,resources:M,siblings:d}),s[30]=c.update.isPending,s[31]=_,s[32]=u,s[33]=p,s[34]=o,s[35]=I,s[36]=M,s[37]=d,s[38]=O):O=s[38],O}function js(s){return{name:s.name,description:s.description,uri:s.uri}}function vs(s){return{name:s.name,description:s.description}}function bs(s){return(s??[]).map(Ns)}function Ns(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Me,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(je,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(gs,{})})}),s[0]=e):e=s[0],e}function io(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ss,{}),s[0]=e):e=s[0],e}export{io as default};