decocms 4.125.5 → 4.126.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 (269) hide show
  1. package/dist/client/assets/{AlertCircle-1e3-NcEA.js → AlertCircle-Cpl_iMHY.js} +1 -1
  2. package/dist/client/assets/{AreaChart-CB1-fSKl.js → AreaChart-BqFUuFcm.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-B-wHAJWT.js → ArrowRight-NqG0gPh-.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-DI1fyC1G.js → ArrowUp-DMJUikwr.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-BWyzrLQV.js → ArrowUpRight-CtURRnV0.js} +1 -1
  6. package/dist/client/assets/{Check-LKA0FKR0.js → Check-dpauEaNI.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-Dh-3VdHB.js → CheckCircle-zW46MQTo.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-B3fDqERa.js → ChevronDown-BQLnN9E6.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-Dkp8mDOd.js → ChevronRight-CyiD6-MW.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-Cm7VcWLZ.js → ChevronUp-DQvrAigY.js} +1 -1
  11. package/dist/client/assets/{Copy01-uQh3Q5Fv.js → Copy01-DDeCwAgK.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-DKanPfz6.js → DotsVertical-Bj4PS0aF.js} +1 -1
  13. package/dist/client/assets/{Eye-SCLKEZSh.js → Eye-Dfg-461O.js} +1 -1
  14. package/dist/client/assets/{FilterLines-13dE_TWB.js → FilterLines-CxHovx4d.js} +1 -1
  15. package/dist/client/assets/{HardDrive-DViLU95V.js → HardDrive-C67jRlzv.js} +1 -1
  16. package/dist/client/assets/{Key01-CgioJ7nW.js → Key01-D7-mKS4d.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-Yz5NzG-w.js → LayoutLeft-Dnk9I__a.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-Di_tOfr7.js → LinkExternal01-DtG8qR-V.js} +1 -1
  19. package/dist/client/assets/{LogOut01-r12Fp93g.js → LogOut01-Bv49wu0L.js} +1 -1
  20. package/dist/client/assets/{Monitor01-C_dYkXdo.js → Monitor01-DEsYEg9j.js} +1 -1
  21. package/dist/client/assets/Palette-3AyXb_ds.js +1 -0
  22. package/dist/client/assets/{Play-CVGtm9ao.js → Play-C5qDNLgC.js} +1 -1
  23. package/dist/client/assets/{Plus-CLG5QKCr.js → Plus-C7p4TBsq.js} +1 -1
  24. package/dist/client/assets/{SearchLg-CkXJjhdf.js → SearchLg-BP6dxoOu.js} +1 -1
  25. package/dist/client/assets/{SearchMd-DBj7HhoW.js → SearchMd-CFZ8th88.js} +1 -1
  26. package/dist/client/assets/{Settings02-BIGi-T7s.js → Settings02-BRYke4o3.js} +1 -1
  27. package/dist/client/assets/{Shield01-ksb0VZpA.js → Shield01-DObW8vGC.js} +1 -1
  28. package/dist/client/assets/{Star01-lWHLfmir.js → Star01-b06OrJx9.js} +1 -1
  29. package/dist/client/assets/{Stars01-B3jznQQ4.js → Stars01-CwezkrCj.js} +1 -1
  30. package/dist/client/assets/{Stars02-DpsxkqJO.js → Stars02-CV1WX5s1.js} +1 -1
  31. package/dist/client/assets/{Sun-tOsjvEis.js → Sun-BYgqmEv8.js} +1 -1
  32. package/dist/client/assets/{SwitchHorizontal01-Dw_LQc0f.js → SwitchHorizontal01-D9GLmxcG.js} +1 -1
  33. package/dist/client/assets/Tool01-CbNqThfz.js +1 -0
  34. package/dist/client/assets/Tool02-BK6vOVj2.js +1 -0
  35. package/dist/client/assets/{Trash01-CWIa_mDx.js → Trash01-CZfSiRn_.js} +1 -1
  36. package/dist/client/assets/{TrendUp01-CYCVS1zr.js → TrendUp01-CbzGmSk7.js} +1 -1
  37. package/dist/client/assets/{Upload01-CPD95nN4.js → Upload01-OvmEXaXy.js} +1 -1
  38. package/dist/client/assets/{User01-NxrNjn_h.js → User01-mA16LPDW.js} +1 -1
  39. package/dist/client/assets/{Users01-DvtVVxdG.js → Users01-D3kMDHBl.js} +1 -1
  40. package/dist/client/assets/{Users03-3lwc9liE.js → Users03-CMTgzssO.js} +1 -1
  41. package/dist/client/assets/{X-BYXAQs6v.js → X-Ds6dL0ec.js} +1 -1
  42. package/dist/client/assets/{XCircle-B3aYrCCW.js → XCircle-Bw2f1-oB.js} +1 -1
  43. package/dist/client/assets/{XClose-CW0R6bEe.js → XClose-CggKQboo.js} +1 -1
  44. package/dist/client/assets/{Zap-CrMVm5NK.js → Zap-cm7wIsil.js} +1 -1
  45. package/dist/client/assets/{ZapSquare-DGe1cTc7.js → ZapSquare-CULLx7Oa.js} +1 -1
  46. package/dist/client/assets/{access-gate-D11_1kHO.js → access-gate-B5Uu6KI_.js} +1 -1
  47. package/dist/client/assets/{add-section-modal-NM4MqPkB.js → add-section-modal-C0j8sHqV.js} +1 -1
  48. package/dist/client/assets/agent-icon-ZuDh9-Hb.js +1 -0
  49. package/dist/client/assets/agents-list-BwHTZnDL.js +1 -0
  50. package/dist/client/assets/ai-providers-CUGZxUFM.js +1 -0
  51. package/dist/client/assets/{alert-BdtEy3y8.js → alert-DktlcBN9.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-DwnblylQ.js → alert-dialog-iJ0nuAo2.js} +2 -2
  53. package/dist/client/assets/app-editor-DKXC32M1.js +1 -0
  54. package/dist/client/assets/{auth-C4POVeVe.js → auth--O1w_iKV.js} +1 -1
  55. package/dist/client/assets/{auth-catchall-ZDYFC2A8.js → auth-catchall-C66NRByx.js} +1 -1
  56. package/dist/client/assets/{auth-entry-DoyULuRf.js → auth-entry-DKS3G1uz.js} +1 -1
  57. package/dist/client/assets/{auth-split-layout-C2XKKVOK.js → auth-split-layout-DcrydIAL.js} +1 -1
  58. package/dist/client/assets/{authenticate-and-persist-oauth-iHWUIj8u.js → authenticate-and-persist-oauth-BimYrVCh.js} +1 -1
  59. package/dist/client/assets/{automation-list-row-BDIVGPMe.js → automation-list-row-CB0Na4Io.js} +1 -1
  60. package/dist/client/assets/automation-runs-CjoeGDB3.js +180 -0
  61. package/dist/client/assets/automations-5W4kO3k8.js +1 -0
  62. package/dist/client/assets/{avatar-BQF1QGjq.js → avatar-BaVe5mnj.js} +1 -1
  63. package/dist/client/assets/{badge-BbmHyS30.js → badge-rSCRRNZZ.js} +1 -1
  64. package/dist/client/assets/{block-document-TZNj_QYY.js → block-document-BDVs9E35.js} +3 -3
  65. package/dist/client/assets/{brand-context-6vJcLMFN.js → brand-context-DXRoGovW.js} +1 -1
  66. package/dist/client/assets/{buckets-BhsiEut2.js → buckets-iue9Ud7d.js} +1 -1
  67. package/dist/client/assets/bulk-category-panel-DlUIZJ14.js +1 -0
  68. package/dist/client/assets/{calendar-DV0NS9xq.js → calendar-B4BM6mn9.js} +1 -1
  69. package/dist/client/assets/{capability-load-error-ObIFsfE9.js → capability-load-error-C19nQZEJ.js} +1 -1
  70. package/dist/client/assets/{card-DcA1Rwjs.js → card-CCT9DM3i.js} +1 -1
  71. package/dist/client/assets/category-editor-B0T-VrR6.js +1 -0
  72. package/dist/client/assets/chat-context-BBbr98oD.js +36 -0
  73. package/dist/client/assets/{checkbox-DsDzIgcJ.js → checkbox-Bq4_WPl3.js} +1 -1
  74. package/dist/client/assets/{cli-auth-success-CHUsfOPQ.js → cli-auth-success-CNtuqj7e.js} +1 -1
  75. package/dist/client/assets/collection-detail-DQNU4HiQ.js +1 -0
  76. package/dist/client/assets/{collection-display-button-Bs1t2pp4.js → collection-display-button-BXR6o3H2.js} +1 -1
  77. package/dist/client/assets/{collection-search-zQnUIpxo.js → collection-search-BtCuCV16.js} +1 -1
  78. package/dist/client/assets/{collection-table-wrapper-CXRyAsZ4.js → collection-table-wrapper-C_cazobp.js} +1 -1
  79. package/dist/client/assets/{collection-tabs-B-9Urj68.js → collection-tabs-0Qyek4_u.js} +1 -1
  80. package/dist/client/assets/{command-CaEk5uho.js → command-2wvo7x41.js} +1 -1
  81. package/dist/client/assets/commerce-onboarding-CL4fDsdf.js +1 -0
  82. package/dist/client/assets/{companions-core-Bua_v2zd.js → companions-core-D1MZ9B1U.js} +1 -1
  83. package/dist/client/assets/{connect-desktop-dialog-CxqDr22T.js → connect-desktop-dialog-BuM5aUqF.js} +1 -1
  84. package/dist/client/assets/{connect-BNr7HDJf.js → connect-gUMrTotC.js} +1 -1
  85. package/dist/client/assets/{connection-DPLpTOu5.js → connection-B0_6E7Mv.js} +1 -1
  86. package/dist/client/assets/{connection-card-CfMynI7E.js → connection-card-CD-x-wIk.js} +1 -1
  87. package/dist/client/assets/connection-detail-BuJnU9wM.js +1 -0
  88. package/dist/client/assets/{connection-form-helpers-BABNaeU1.js → connection-form-helpers-bxVBlV5J.js} +1 -1
  89. package/dist/client/assets/connections-HgZRNGX4.js +1 -0
  90. package/dist/client/assets/{decopilot-sse-pool-C_GcVLtN.js → decopilot-sse-pool-zU_w0iZh.js} +1 -1
  91. package/dist/client/assets/{dialog-CzDwjrNV.js → dialog-C1Qgh1pV.js} +1 -1
  92. package/dist/client/assets/{domain-settings-B_R_4nb3.js → domain-settings-Dr8-E0BO.js} +1 -1
  93. package/dist/client/assets/{drawer-CSHRJeTj.js → drawer-C-awTSYf.js} +1 -1
  94. package/dist/client/assets/{dropdown-menu-CSgtqrA3.js → dropdown-menu-DnVtnirM.js} +1 -1
  95. package/dist/client/assets/{empty-state-CwB9YNml.js → empty-state-t-xxj99b.js} +1 -1
  96. package/dist/client/assets/{extract-connection-data-ChU9AlhE.js → extract-connection-data-D2Q5eAdA.js} +1 -1
  97. package/dist/client/assets/file-explorer-YJoVbzpR.js +2 -0
  98. package/dist/client/assets/{form-CJlgALpE.js → form-Bcx3Dx5v.js} +1 -1
  99. package/dist/client/assets/{general-KzB4_6Wn.js → general-CTIKCAQW.js} +1 -1
  100. package/dist/client/assets/{github-repo-picker-DeAiQyIc.js → github-repo-picker-CfFhjmhR.js} +1 -1
  101. package/dist/client/assets/{hooks-CvwQxo-K.js → hooks-BRAlfwVg.js} +1 -1
  102. package/dist/client/assets/{index-D8ngUVkT.js → index-25tDLcHQ.js} +1 -1
  103. package/dist/client/assets/{index-CpW_ejWe.js → index-5tHCzznE.js} +1 -1
  104. package/dist/client/assets/index-75oUoREO.js +665 -0
  105. package/dist/client/assets/{index-CSZh49Ui.js → index-BFHC2rlf.js} +2 -2
  106. package/dist/client/assets/{index-DLEyNPFn.js → index-CRfJJjBr.js} +1 -1
  107. package/dist/client/assets/{index-DKhbAOZU.js → index-CTwgLDWF.js} +3 -3
  108. package/dist/client/assets/{index-DaeJeAuV.js → index-C_mT0QTy.js} +1 -1
  109. package/dist/client/assets/{index-Dk9RGAqb.js → index-D0GbPI_R.js} +31 -31
  110. package/dist/client/assets/index-DMXNbwjD.js +1 -0
  111. package/dist/client/assets/{index-BF9tZwJg.js → index-pNi6sXYH.js} +2 -2
  112. package/dist/client/assets/{index-Dm21RzCu.js → index-poTj2wxK.js} +1 -1
  113. package/dist/client/assets/{index-redirect-CiF0eU2o.js → index-redirect-D_UJBrMZ.js} +1 -1
  114. package/dist/client/assets/{input-C-gHIQip.js → input-Bb4p9_ik.js} +1 -1
  115. package/dist/client/assets/{integration-icon-DBUjxWMb.js → integration-icon-bG23TCVO.js} +1 -1
  116. package/dist/client/assets/{invite-member-dialog-CaK4ahsW.js → invite-member-dialog-BSPugAve.js} +1 -1
  117. package/dist/client/assets/{label-D9aEMZqo.js → label-5xpx6MdG.js} +1 -1
  118. package/dist/client/assets/{layout-BrB2JTzM.js → layout-q_JOMITt.js} +1 -1
  119. package/dist/client/assets/{login-Lw37QqB4.js → login-DWFYfzVD.js} +1 -1
  120. package/dist/client/assets/{mcp-oauth-Br5ozXBx.js → mcp-oauth-I-PLDGs0.js} +1 -1
  121. package/dist/client/assets/{members-CBNwHdHU.js → members-DAGQnraC.js} +1 -1
  122. package/dist/client/assets/monaco-editor-3ZmYAdL5.js +19 -0
  123. package/dist/client/assets/{monitoring-stats-row-B0nxijUM.js → monitoring-stats-row-D-FdpFBv.js} +1 -1
  124. package/dist/client/assets/{multi-select-DoaVr0FT.js → multi-select-CCg5PDqH.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-BPUIN1-y.js → oauth-callback-D3gHvTLm.js} +1 -1
  126. package/dist/client/assets/{oauth-callback-ai-provider-DH8liZ11.js → oauth-callback-ai-provider-D0DSENaB.js} +1 -1
  127. package/dist/client/assets/onboarding-Bor5OprO.js +1 -0
  128. package/dist/client/assets/{org-install-DTLkzmIJ.js → org-install-B0gCH-Nk.js} +1 -1
  129. package/dist/client/assets/{org-layout-CFv53iXd.js → org-layout-BWKTyxWj.js} +1 -1
  130. package/dist/client/assets/{organization-choice-D1ddIq9q.js → organization-choice-DWfbtdFz.js} +1 -1
  131. package/dist/client/assets/{orgs-D8ijCQdC.js → orgs-BtRV84O-.js} +1 -1
  132. package/dist/client/assets/{page-seo-form-C7Dzevsc.js → page-seo-form-BFCjEKMU.js} +1 -1
  133. package/dist/client/assets/page-seo-sheet-CgVitSBt.js +1 -0
  134. package/dist/client/assets/{popover-C2fPnPJt.js → popover-BqPUB_i2.js} +1 -1
  135. package/dist/client/assets/post-editor-MaKq00sv.js +1 -0
  136. package/dist/client/assets/{primitives-FVRYsTWJ.js → primitives-DtK7id8m.js} +1 -1
  137. package/dist/client/assets/{profile-gw5qYABl.js → profile-CN9LLarl.js} +1 -1
  138. package/dist/client/assets/project-app-view-D-9tjTDx.js +1 -0
  139. package/dist/client/assets/record-editor-DoN02fjB.js +1 -0
  140. package/dist/client/assets/redirect-editor-D5Na_rRm.js +1 -0
  141. package/dist/client/assets/registry-BA7wbNAk.js +2 -0
  142. package/dist/client/assets/{registry-layout-Bp5nCSQt.js → registry-layout-XctP0_TB.js} +4 -4
  143. package/dist/client/assets/{reports-jd3NPFMI.js → reports-BBeGN80e.js} +2 -2
  144. package/dist/client/assets/{require-capability-L7H5SRt9.js → require-capability-2rozIXBv.js} +1 -1
  145. package/dist/client/assets/{required-auth-layout-BfZFGRtL.js → required-auth-layout-pINrUhAT.js} +1 -1
  146. package/dist/client/assets/{reset-password-HKWCKRZw.js → reset-password-sGF0Deja.js} +1 -1
  147. package/dist/client/assets/roles-CtVuRlNg.js +1 -0
  148. package/dist/client/assets/{search-input-BI1enB-b.js → search-input-DHMmvRu9.js} +1 -1
  149. package/dist/client/assets/{secrets-BfLNMBsl.js → secrets-Cek9nNDM.js} +1 -1
  150. package/dist/client/assets/sections-editor-KKjVHQIb.js +2 -0
  151. package/dist/client/assets/{select-Bd1WKGSJ.js → select-JTf4HMkB.js} +1 -1
  152. package/dist/client/assets/{select-model-BeSzDzZp.js → select-model-DeVAqDr8.js} +2 -2
  153. package/dist/client/assets/{self-tool-result-D85DyOHM.js → self-tool-result-JVOqtq7F.js} +1 -1
  154. package/dist/client/assets/seo-editor-BKn-yjw0.js +1 -0
  155. package/dist/client/assets/settings-layout-0HfTLbLa.js +1 -0
  156. package/dist/client/assets/{settings-section-Dh6zLap9.js → settings-section-Duse8CF5.js} +1 -1
  157. package/dist/client/assets/shell-controls-CjdX-cXs.js +1 -0
  158. package/dist/client/assets/shell-layout-BX_6t6Y4.js +1 -0
  159. package/dist/client/assets/{sidebar-DBzYJLC2.js → sidebar-JCplCzUs.js} +1 -1
  160. package/dist/client/assets/{skeleton-DoNQnm-q.js → skeleton-rG0lAer-.js} +1 -1
  161. package/dist/client/assets/{sso-TkJUyr_G.js → sso-DZif8bEF.js} +1 -1
  162. package/dist/client/assets/{store-DdPYyI-G.js → store-DSniQ8uA.js} +1 -1
  163. package/dist/client/assets/store-registry-7wOo-ziX.js +2 -0
  164. package/dist/client/assets/{studio-tools-CFgWeCBk.js → studio-tools-CVP_bYI3.js} +1 -1
  165. package/dist/client/assets/{switch-J9ypA9K4.js → switch-RfqMPlNx.js} +1 -1
  166. package/dist/client/assets/tab-id-6SxTM-85.js +1 -0
  167. package/dist/client/assets/{table-CIOCQP8H.js → table-CkAONPU-.js} +1 -1
  168. package/dist/client/assets/{tabs-BBm6nSot.js → tabs-C6CALd7M.js} +1 -1
  169. package/dist/client/assets/{textarea-CQzBh7SW.js → textarea-BDUOK9v4.js} +1 -1
  170. package/dist/client/assets/{toggle-group-DaeRkjf6.js → toggle-group-BJ3nTIOw.js} +1 -1
  171. package/dist/client/assets/toolbar-BbjlhC11.js +1 -0
  172. package/dist/client/assets/{tooltip-xp77jFs4.js → tooltip-CZxZ-Bns.js} +1 -1
  173. package/dist/client/assets/{use-ai-providers-Bujq_lmM.js → use-ai-providers-RLFjMIPM.js} +1 -1
  174. package/dist/client/assets/{use-api-keys-CLc8cxOV.js → use-api-keys-Yfc55xX1.js} +1 -1
  175. package/dist/client/assets/{use-automations-m1Zli3xa.js → use-automations-DMIHt0qx.js} +1 -1
  176. package/dist/client/assets/{use-autosave-BT7goSxj.js → use-autosave-CTaJVuYe.js} +1 -1
  177. package/dist/client/assets/{use-capability-DHlRnvUE.js → use-capability-C9LPdJIR.js} +1 -1
  178. package/dist/client/assets/{use-clock-tick-jphDPs9A.js → use-clock-tick-CF0pPFJP.js} +1 -1
  179. package/dist/client/assets/{use-connection-BsS-3rZB.js → use-connection-D67Pe6aW.js} +1 -1
  180. package/dist/client/assets/{use-copy-DmTk3Ltj.js → use-copy-3pbdZZcV.js} +1 -1
  181. package/dist/client/assets/{use-create-virtual-mcp-C2sWKZ2h.js → use-create-virtual-mcp-DOgSWB_T.js} +1 -1
  182. package/dist/client/assets/{use-debounced-autosave-C7P_JRA0.js → use-debounced-autosave-B7CCzcf-.js} +1 -1
  183. package/dist/client/assets/{use-debounced-value-D9jV_d1U.js → use-debounced-value-DSrcUzF-.js} +1 -1
  184. package/dist/client/assets/use-deco-credits-BEDSGMQk.js +1 -0
  185. package/dist/client/assets/{use-decopilot-events-B3KnAJRh.js → use-decopilot-events-DqMtcih3.js} +1 -1
  186. package/dist/client/assets/{use-delete-connection-DqznTHaH.js → use-delete-connection-CeKf58YN.js} +1 -1
  187. package/dist/client/assets/{use-deployment-admin-BFdTIDOz.js → use-deployment-admin-BAJ25R18.js} +1 -1
  188. package/dist/client/assets/{use-file-configs-D6Dg-9sN.js → use-file-configs-eEXpH4IT.js} +1 -1
  189. package/dist/client/assets/{use-infinite-scroll-CbSN3uty.js → use-infinite-scroll-CUTwghko.js} +1 -1
  190. package/dist/client/assets/{use-join-requests-avqI9CYZ.js → use-join-requests-DSCKcWR6.js} +1 -1
  191. package/dist/client/assets/{use-mcp-auth-status-UXgrVZIV.js → use-mcp-auth-status-GN_90IVc.js} +1 -1
  192. package/dist/client/assets/{use-mcp-client-Bzvvd0Df.js → use-mcp-client-2qqsLKMv.js} +1 -1
  193. package/dist/client/assets/{use-mcp-tools-IcUfyh43.js → use-mcp-tools-DYZgnU0f.js} +1 -1
  194. package/dist/client/assets/{use-members-Cf3JeQ7o.js → use-members-BBMl3rpc.js} +1 -1
  195. package/dist/client/assets/{use-mobile-DQ8jManM.js → use-mobile-orl9RI6e.js} +1 -1
  196. package/dist/client/assets/{use-navigate-to-agent-D_vSOLwA.js → use-navigate-to-agent-BL6ciQ9Y.js} +1 -1
  197. package/dist/client/assets/{use-org-auth-client-B1nrzsgv.js → use-org-auth-client-nWz-MFtZ.js} +1 -1
  198. package/dist/client/assets/{use-org-sso-w9j-Ok-z.js → use-org-sso-D-Dpc7wL.js} +1 -1
  199. package/dist/client/assets/{use-organization-roles-DPbFWCpb.js → use-organization-roles-DuvB4P7M.js} +1 -1
  200. package/dist/client/assets/{use-organization-settings-zX_T-3XG.js → use-organization-settings-DcpRbwzw.js} +1 -1
  201. package/dist/client/assets/{use-registry-app-DdwkqhPA.js → use-registry-app-CLQNyM7N.js} +1 -1
  202. package/dist/client/assets/{use-registry-connections-C529xEPn.js → use-registry-connections-BgFdJfUy.js} +1 -1
  203. package/dist/client/assets/{use-secrets-CTWWthzy.js → use-secrets-DuyNYvJ7.js} +1 -1
  204. package/dist/client/assets/{use-status-sounds-D-dtBAQ9.js → use-status-sounds-CO1cS1Qf.js} +1 -1
  205. package/dist/client/assets/{use-view-mode-CQpQIlsB.js → use-view-mode-Ck3q6mF-.js} +1 -1
  206. package/dist/client/assets/{use-virtual-mcp-BP-M67aZ.js → use-virtual-mcp-DYkiFIJC.js} +1 -1
  207. package/dist/client/assets/useInfiniteQuery-DwwDCJAw.js +1 -0
  208. package/dist/client/assets/{useQueries-b2s80Vy2.js → useQueries-DNJ2_DVv.js} +1 -1
  209. package/dist/client/assets/{useRouterState-BE3l9A_t.js → useRouterState-CSvDrQv7.js} +1 -1
  210. package/dist/client/assets/useSuspenseInfiniteQuery-DOVA9lC8.js +1 -0
  211. package/dist/client/assets/{users-BPFw8x87.js → users-NNxyxZtX.js} +1 -1
  212. package/dist/client/assets/variant-calendar-BotkXpCr.js +1 -0
  213. package/dist/client/assets/{view-mode-toggle-Dn7I7z16.js → view-mode-toggle-B0C9EwSq.js} +1 -1
  214. package/dist/client/index.html +1 -1
  215. package/dist/server/cli.js +1 -1
  216. package/dist/server/server.js +1 -1
  217. package/package.json +1 -1
  218. package/dist/client/assets/Globe01-CEh6-y49.js +0 -1
  219. package/dist/client/assets/Globe04-B4VpGXlx.js +0 -1
  220. package/dist/client/assets/Image01-CMEjSR3M.js +0 -1
  221. package/dist/client/assets/Package-R2sM0vCm.js +0 -1
  222. package/dist/client/assets/Palette-CsQxyyrG.js +0 -1
  223. package/dist/client/assets/Tool01-B0759esA.js +0 -1
  224. package/dist/client/assets/Tool02-DPXeBg9E.js +0 -1
  225. package/dist/client/assets/ZoomOut-B-F-8cp0.js +0 -1
  226. package/dist/client/assets/agent-icon-E6ioveGx.js +0 -1
  227. package/dist/client/assets/agents-list-Da5tnSPr.js +0 -1
  228. package/dist/client/assets/ai-providers-BWFFEYZL.js +0 -1
  229. package/dist/client/assets/app-editor-CdLxuu_H.js +0 -1
  230. package/dist/client/assets/automation-runs-CfKwQe7C.js +0 -87
  231. package/dist/client/assets/automations-BCQxf0NT.js +0 -1
  232. package/dist/client/assets/autosend-CMYVBxZV.js +0 -1
  233. package/dist/client/assets/bulk-category-panel-D5jThLH-.js +0 -1
  234. package/dist/client/assets/category-editor-Zpp2vnMR.js +0 -1
  235. package/dist/client/assets/chat-context-BF6sak7i.js +0 -36
  236. package/dist/client/assets/collection-detail-BNdX0SIB.js +0 -1
  237. package/dist/client/assets/commerce-onboarding-CiS9fZfY.js +0 -1
  238. package/dist/client/assets/connection-detail-B0e-9hXG.js +0 -1
  239. package/dist/client/assets/connections-Cy3k4Q8y.js +0 -1
  240. package/dist/client/assets/file-explorer-Brc8sEiI.js +0 -2
  241. package/dist/client/assets/file-type-icon-_JzjFo75.js +0 -94
  242. package/dist/client/assets/files-BVF6I-9K.js +0 -1
  243. package/dist/client/assets/index-CRECkoeT.js +0 -11
  244. package/dist/client/assets/index-CwhgWx3d.js +0 -492
  245. package/dist/client/assets/index-EFMlI3jy.js +0 -174
  246. package/dist/client/assets/index-LUmU4Q-i.js +0 -1
  247. package/dist/client/assets/location-BpLtHjTZ.js +0 -1
  248. package/dist/client/assets/monaco-editor-CIeX3g7j.js +0 -9
  249. package/dist/client/assets/onboarding-Dhh44q6X.js +0 -1
  250. package/dist/client/assets/page-seo-sheet-o_DqZuF2.js +0 -1
  251. package/dist/client/assets/post-editor-Bq8RGMDX.js +0 -1
  252. package/dist/client/assets/project-app-view-CKq51jV9.js +0 -1
  253. package/dist/client/assets/record-editor-aUwWcdAc.js +0 -1
  254. package/dist/client/assets/redirect-editor-CdIq7WyN.js +0 -1
  255. package/dist/client/assets/registry-CuS81odv.js +0 -2
  256. package/dist/client/assets/roles-BfuLXfWh.js +0 -1
  257. package/dist/client/assets/sections-editor-BEWC-c1n.js +0 -2
  258. package/dist/client/assets/seo-editor-Cr0IAZUG.js +0 -1
  259. package/dist/client/assets/settings-layout-nbprtkao.js +0 -1
  260. package/dist/client/assets/shell-controls-DmSPQaRT.js +0 -1
  261. package/dist/client/assets/shell-layout-DCFL_zE0.js +0 -1
  262. package/dist/client/assets/store-registry-B8K0dTh3.js +0 -2
  263. package/dist/client/assets/tab-id-BijBBRwE.js +0 -1
  264. package/dist/client/assets/toolbar-CoHzPWWi.js +0 -1
  265. package/dist/client/assets/toolbar-icon-button-BGQ8DzLo.js +0 -1
  266. package/dist/client/assets/use-deco-credits-BW-cf-qH.js +0 -1
  267. package/dist/client/assets/useInfiniteQuery-64uGdBMx.js +0 -1
  268. package/dist/client/assets/useSuspenseInfiniteQuery-DYsYorpe.js +0 -1
  269. package/dist/client/assets/variant-calendar-DNJKkwIK.js +0 -1
@@ -1 +0,0 @@
1
- import{c as B,j as o,b as D,F as M,d as $,r as q,B as F,p as R}from"./index-Dk9RGAqb.js";import{s as V}from"./Plus-CLG5QKCr.js";import{i as S}from"./Zap-CrMVm5NK.js";import{S as G}from"./search-input-BI1enB-b.js";import{P as d}from"./index-D8ngUVkT.js";import{E as T}from"./empty-state-CwB9YNml.js";import{c as H}from"./use-automations-m1Zli3xa.js";import{c as J}from"./use-navigate-to-agent-D_vSOLwA.js";import{A as K}from"./automation-list-row-BDIVGPMe.js";import{q as O}from"./use-mcp-client-Bzvvd0Df.js";import{a as Q}from"./use-virtual-mcp-BP-M67aZ.js";import{R as U}from"./require-capability-L7H5SRt9.js";import"./SearchMd-DBj7HhoW.js";import"./sidebar-DBzYJLC2.js";import"./LayoutLeft-Yz5NzG-w.js";import"./use-mobile-DQ8jManM.js";import"./X-BYXAQs6v.js";import"./tooltip-xp77jFs4.js";import"./studio-tools-CFgWeCBk.js";import"./hooks-CvwQxo-K.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-C_GcVLtN.js";import"./reusable-new-chat-CouMjkYR.js";import"./alert-dialog-DwnblylQ.js";import"./dropdown-menu-CSgtqrA3.js";import"./Check-LKA0FKR0.js";import"./ChevronRight-Dkp8mDOd.js";import"./DotsVertical-DKanPfz6.js";import"./Stars02-DpsxkqJO.js";import"./Trash01-CWIa_mDx.js";import"./agent-icon-E6ioveGx.js";import"./AlertCircle-1e3-NcEA.js";import"./Tool01-B0759esA.js";import"./ArrowUp-DI1fyC1G.js";import"./Settings02-BIGi-T7s.js";import"./Tool02-DPXeBg9E.js";import"./ArrowRight-B-wHAJWT.js";import"./ArrowUpRight-BWyzrLQV.js";import"./TrendUp01-CYCVS1zr.js";import"./ZapSquare-DGe1cTc7.js";import"./ZoomOut-B-F-8cp0.js";import"./Users03-3lwc9liE.js";import"./CheckCircle-Dh-3VdHB.js";import"./ChevronDown-B3fDqERa.js";import"./ChevronUp-Cm7VcWLZ.js";import"./Copy01-uQh3Q5Fv.js";import"./Globe01-CEh6-y49.js";import"./Eye-SCLKEZSh.js";import"./FilterLines-13dE_TWB.js";import"./Star01-lWHLfmir.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./Key01-CgioJ7nW.js";import"./XCircle-B3aYrCCW.js";import"./LinkExternal01-Di_tOfr7.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./Play-CVGtm9ao.js";import"./SearchLg-CkXJjhdf.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Upload01-CPD95nN4.js";import"./User01-NxrNjn_h.js";import"./Users01-DvtVVxdG.js";import"./XClose-CW0R6bEe.js";import"./auth-C4POVeVe.js";import"./use-capability-DHlRnvUE.js";import"./access-gate-D11_1kHO.js";import"./capability-load-error-ObIFsfE9.js";function W(){const t=B.c(20),i=D(),{org:c}=M(),{data:C}=H(void 0),g=C===void 0?[]:C,k=Q(),P=J(),f=$(),[x,E]=q.useState(""),h=x.toLowerCase(),A=new Map(k.map(X)),b=g.filter(e=>{if(!h||e.name.toLowerCase().includes(h))return!0;if(e.virtual_mcp_id){const p=A.get(e.virtual_mcp_id);if(p&&p.title.toLowerCase().includes(h))return!0}return!1}),z=(e,p)=>{const N=p&&A.has(p)?p:O(c.id);R("automations_list_row_clicked",{automation_id:e,agent_id:N,source:"settings_automations"}),P(N,{search:{main:"automation:"+e}})};let l;t[0]!==f||t[1]!==c.slug?(l=()=>{R("automations_empty_state_browse_agents_clicked"),f({to:"/$org/settings/agents",params:{org:c.slug}})},t[0]=f,t[1]=c.slug,t[2]=l):l=t[2];const L=l,j=d,v=d,w=d;let s;t[3]!==i?(s=i("settings.automations.pageTitle"),t[3]=i,t[4]=s):s=t[4];let r;t[5]!==s?(r=o.jsx(d.Title,{children:s}),t[5]=s,t[6]=r):r=t[6];const _=g.length>0&&o.jsx(G,{value:x,onChange:E,placeholder:i("settings.automations.searchPlaceholder"),className:"w-full md:w-[375px]"});let m;t[7]!==r||t[8]!==_?(m=o.jsxs("div",{className:"flex flex-col gap-6",children:[r,_]}),t[7]=r,t[8]=_,t[9]=m):m=t[9];const y=g.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(T,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:i("settings.automations.emptyTitle"),description:i("settings.automations.emptyDescription"),actions:o.jsxs(F,{size:"sm",onClick:L,children:[o.jsx(V,{size:14}),i("settings.automations.browseAgentsButton")]})})}):b.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(T,{image:o.jsx(S,{size:48,className:"text-muted-foreground"}),title:i("settings.automations.noResultsTitle"),description:i("settings.automations.noResultsDescription",{search:x})})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:b.map(e=>o.jsx(K,{automation:e,showAgent:!0,onClick:()=>z(e.id,e.virtual_mcp_id)},e.id))});let n;t[10]!==w.Body||t[11]!==m||t[12]!==y?(n=o.jsxs(w.Body,{children:[m,y]}),t[10]=w.Body,t[11]=m,t[12]=y,t[13]=n):n=t[13];let a;t[14]!==v.Content||t[15]!==n?(a=o.jsx(v.Content,{children:n}),t[14]=v.Content,t[15]=n,t[16]=a):a=t[16];let u;return t[17]!==j||t[18]!==a?(u=o.jsx(j,{children:a}),t[17]=j,t[18]=a,t[19]=u):u=t[19],u}function X(t){return[t.id,t]}function vo(){const t=B.c(1);let i;return t[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(U,{capability:"automations:manage",area:"automations",children:o.jsx(W,{})}),t[0]=i):i=t[0],i}export{vo as default};
@@ -1 +0,0 @@
1
- import{G as a}from"./index-Dk9RGAqb.js";const i=1e4,m="true";function s(e,t){return a.chatAutosend(e,t)}function d(e){return e==="pending"||e==="sending"}function c(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}return!t||typeof t!="object"||typeof t.createdAt!="number"||typeof t.message!="object"||!d(t.status)?null:t}function A(e,t,r,o,u=Date.now()){const n={message:o,createdAt:u,status:"pending"};return e.setItem(s(t,r),JSON.stringify(n)),n}function f(e,t,r){const o=s(t,r),u=c(e.getItem(o));return u||(e.removeItem(o),null)}function S(e,t,r,o=Date.now()){const u=s(t,r),n=f(e,t,r);return!n||n.status!=="pending"?null:o-n.createdAt>=i?(e.removeItem(u),null):(e.setItem(u,JSON.stringify({...n,status:"sending"})),{message:n.message,createdAt:n.createdAt})}function p(e,t,r){e.removeItem(s(t,r))}export{m as A,p as a,S as c,A as w};
@@ -1 +0,0 @@
1
- import{c as he,b as je,r as de,j as t,k as ye,B as ne}from"./index-Dk9RGAqb.js";import{b as ue}from"./ZoomOut-B-F-8cp0.js";import{i as Ne}from"./X-BYXAQs6v.js";import{L as ce}from"./label-D9aEMZqo.js";import{a1 as xe,a2 as ke}from"./index-CwhgWx3d.js";import{S as Ce,a as Pe,b as Se,c as ve,d as _e}from"./select-Bd1WKGSJ.js";import{T as Te,a as we,c as Be}from"./tooltip-xp77jFs4.js";import"./ArrowUp-DI1fyC1G.js";import"./chat-context-BF6sak7i.js";import"./autosend-CMYVBxZV.js";import"./hooks-CvwQxo-K.js";import"./use-mcp-client-Bzvvd0Df.js";import"./auth-C4POVeVe.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-C_GcVLtN.js";import"./studio-tools-CFgWeCBk.js";import"./use-virtual-mcp-BP-M67aZ.js";import"./use-ai-providers-Bujq_lmM.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-B3KnAJRh.js";import"./use-organization-settings-zX_T-3XG.js";import"./automation-runs-CfKwQe7C.js";import"./useInfiniteQuery-64uGdBMx.js";import"./use-infinite-scroll-CbSN3uty.js";import"./use-connection-BsS-3rZB.js";import"./card-DcA1Rwjs.js";import"./sidebar-DBzYJLC2.js";import"./LayoutLeft-Yz5NzG-w.js";import"./use-mobile-DQ8jManM.js";import"./table-CIOCQP8H.js";import"./empty-state-CwB9YNml.js";import"./use-members-Cf3JeQ7o.js";import"./use-org-auth-client-B1nrzsgv.js";import"./use-clock-tick-jphDPs9A.js";import"./AlertCircle-1e3-NcEA.js";import"./CheckCircle-Dh-3VdHB.js";import"./DotsVertical-DKanPfz6.js";import"./agent-icon-E6ioveGx.js";import"./Tool01-B0759esA.js";import"./Settings02-BIGi-T7s.js";import"./Tool02-DPXeBg9E.js";import"./ArrowRight-B-wHAJWT.js";import"./ArrowUpRight-BWyzrLQV.js";import"./TrendUp01-CYCVS1zr.js";import"./ZapSquare-DGe1cTc7.js";import"./Users03-3lwc9liE.js";import"./Check-LKA0FKR0.js";import"./ChevronDown-B3fDqERa.js";import"./ChevronRight-Dkp8mDOd.js";import"./ChevronUp-Cm7VcWLZ.js";import"./Stars02-DpsxkqJO.js";import"./Copy01-uQh3Q5Fv.js";import"./Globe01-CEh6-y49.js";import"./Eye-SCLKEZSh.js";import"./FilterLines-13dE_TWB.js";import"./Star01-lWHLfmir.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./Key01-CgioJ7nW.js";import"./XCircle-B3aYrCCW.js";import"./LinkExternal01-Di_tOfr7.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./Play-CVGtm9ao.js";import"./Plus-CLG5QKCr.js";import"./SearchLg-CkXJjhdf.js";import"./SearchMd-DBj7HhoW.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Trash01-CWIa_mDx.js";import"./Upload01-CPD95nN4.js";import"./User01-NxrNjn_h.js";import"./Users01-DvtVVxdG.js";import"./XClose-CW0R6bEe.js";import"./Zap-CrMVm5NK.js";import"./use-automations-m1Zli3xa.js";import"./useSuspenseInfiniteQuery-DYsYorpe.js";import"./avatar-BQF1QGjq.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-DmTk3Ltj.js";import"./file-type-icon-_JzjFo75.js";import"./dialog-CzDwjrNV.js";import"./monaco-editor-CIeX3g7j.js";import"./index-CRECkoeT.js";import"./index-DaeJeAuV.js";import"./calendar-DV0NS9xq.js";import"./shell-layout-DCFL_zE0.js";import"./required-auth-layout-BfZFGRtL.js";import"./use-org-sso-w9j-Ok-z.js";import"./integration-icon-DBUjxWMb.js";import"./use-navigate-to-agent-D_vSOLwA.js";import"./reusable-new-chat-CouMjkYR.js";import"./AreaChart-CB1-fSKl.js";import"./form-CJlgALpE.js";import"./input-C-gHIQip.js";import"./drawer-CSHRJeTj.js";import"./collection-search-zQnUIpxo.js";import"./index-DKhbAOZU.js";import"./get-initials-D-f_fDFw.js";import"./popover-C2fPnPJt.js";import"./use-registry-app-DdwkqhPA.js";import"./use-mcp-tools-IcUfyh43.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-iHWUIj8u.js";import"./mcp-oauth-Br5ozXBx.js";import"./extract-connection-data-ChU9AlhE.js";import"./metadata-dUsYcpuu.js";import"./dropdown-menu-CSgtqrA3.js";import"./command-CaEk5uho.js";import"./index-DLEyNPFn.js";import"./companions-core-Bua_v2zd.js";import"./tabs-BBm6nSot.js";import"./toggle-group-DaeRkjf6.js";import"./use-deco-credits-BW-cf-qH.js";import"./alert-dialog-DwnblylQ.js";import"./toolbar-icon-button-BGQ8DzLo.js";import"./skeleton-DoNQnm-q.js";import"./github-repo-picker-DeAiQyIc.js";import"./use-debounced-value-D9jV_d1U.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./connection-card-CfMynI7E.js";import"./use-registry-connections-C529xEPn.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./textarea-CQzBh7SW.js";import"./connection-form-helpers-BABNaeU1.js";import"./collection-tabs-B-9Urj68.js";import"./badge-BbmHyS30.js";import"./connect-desktop-dialog-CxqDr22T.js";import"./select-model-BeSzDzZp.js";import"./checkbox-DsDzIgcJ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dh6zLap9.js";import"./index-EFMlI3jy.js";import"./toolbar-CoHzPWWi.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-D-dtBAQ9.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-DHlRnvUE.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-UXgrVZIV.js";import"./use-debounced-autosave-C7P_JRA0.js";import"./index-D8ngUVkT.js";import"./search-input-BI1enB-b.js";import"./switch-J9ypA9K4.js";import"./use-secrets-CTWWthzy.js";import"./useQueries-b2s80Vy2.js";import"./use-file-configs-D6Dg-9sN.js";import"./automation-list-row-BDIVGPMe.js";function wi(i){const e=he.c(121),{posts:X,categories:l,initialSlug:re,isPending:s,onApply:le,onClose:p}=i,o=je(),[m,fe]=de.useState(re&&l.some(a=>a.slug===re)?re:l[0]?.slug??""),[n,be]=de.useState("add");let Y;if(e[0]!==l||e[1]!==m){let a;e[3]!==m?(a=ge=>ge.slug===m,e[3]=m,e[4]=a):a=e[4],Y=l.find(a),e[0]=l,e[1]=m,e[2]=Y}else Y=e[2];const c=Y,r=X.length,me=String(r);let d;e[5]!==o||e[6]!==me?(d=o("sandbox.bulkCategoryPanel.selectedCount",{count:me}),e[5]=o,e[6]=me,e[7]=d):d=e[7];let x;e[8]!==d?(x=t.jsx("span",{className:"truncate text-sm font-medium",children:d}),e[8]=d,e[9]=x):x=e[9];let u;e[10]!==o?(u=o("sandbox.bulkCategoryPanel.exitSelection"),e[10]=o,e[11]=u):u=e[11];let Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=t.jsx(Ne,{size:14}),e[12]=Z):Z=e[12];let f;e[13]!==s||e[14]!==p||e[15]!==u?(f=t.jsx(Te,{asChild:!0,children:t.jsx(ne,{type:"button",variant:"ghost",size:"icon",disabled:s,onClick:p,"aria-label":u,children:Z})}),e[13]=s,e[14]=p,e[15]=u,e[16]=f):f=e[16];let b;e[17]!==o?(b=o("sandbox.bulkCategoryPanel.exitSelection"),e[17]=o,e[18]=b):b=e[18];let g;e[19]!==b?(g=t.jsx(we,{side:"bottom",children:b}),e[19]=b,e[20]=g):g=e[20];let h;e[21]!==f||e[22]!==g?(h=t.jsxs(Be,{children:[f,g]}),e[21]=f,e[22]=g,e[23]=h):h=e[23];let j;e[24]!==h||e[25]!==x?(j=t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[x,h]}),e[24]=h,e[25]=x,e[26]=j):j=e[26];let y;e[27]!==o?(y=o("sandbox.bulkCategoryPanel.title"),e[27]=o,e[28]=y):y=e[28];let N;e[29]!==y?(N=t.jsx("h2",{className:"text-2xl font-bold text-foreground",children:y}),e[29]=y,e[30]=N):N=e[30];let k;e[31]!==r||e[32]!==o?(k=r===0?o("sandbox.bulkCategoryPanel.descriptionEmpty"):o("sandbox.bulkCategoryPanel.descriptionWithCount",{count:String(r)}),e[31]=r,e[32]=o,e[33]=k):k=e[33];let C;e[34]!==k?(C=t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:k}),e[34]=k,e[35]=C):C=e[35];let P;e[36]!==o?(P=o("sandbox.bulkCategoryPanel.categoryLabel"),e[36]=o,e[37]=P):P=e[37];let S;e[38]!==P?(S=t.jsx(ce,{children:P}),e[38]=P,e[39]=S):S=e[39];let v;e[40]!==l||e[41]!==m||e[42]!==o?(v=l.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:o("sandbox.bulkCategoryPanel.noCategoriesMessage")}):t.jsxs(Ce,{value:m,onValueChange:fe,children:[t.jsx(Pe,{className:"w-full",children:t.jsx(Se,{placeholder:o("sandbox.bulkCategoryPanel.selectCategoryPlaceholder")})}),t.jsx(ve,{children:l.map(ze)})]}),e[40]=l,e[41]=m,e[42]=o,e[43]=v):v=e[43];let _;e[44]!==S||e[45]!==v?(_=t.jsxs("div",{className:"space-y-2",children:[S,v]}),e[44]=S,e[45]=v,e[46]=_):_=e[46];let ee;e[47]===Symbol.for("react.memo_cache_sentinel")?(ee=a=>be(a),e[47]=ee):ee=e[47];let te;e[48]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx(xe,{value:"add",id:"cat-mode-add",className:"mt-0.5"}),e[48]=te):te=e[48];let T;e[49]!==o?(T=o("sandbox.bulkCategoryPanel.modeAddTitle"),e[49]=o,e[50]=T):T=e[50];let w;e[51]!==T?(w=t.jsx("span",{className:"block text-sm font-medium",children:T}),e[51]=T,e[52]=w):w=e[52];let B;e[53]!==o?(B=o("sandbox.bulkCategoryPanel.modeAddDescription"),e[53]=o,e[54]=B):B=e[54];let R;e[55]!==B?(R=t.jsx("span",{className:"block text-xs text-muted-foreground",children:B}),e[55]=B,e[56]=R):R=e[56];let z;e[57]!==w||e[58]!==R?(z=t.jsxs(ce,{htmlFor:"cat-mode-add",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[te,t.jsxs("span",{className:"space-y-0.5",children:[w,R]})]}),e[57]=w,e[58]=R,e[59]=z):z=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=t.jsx(xe,{value:"replace",id:"cat-mode-replace",className:"mt-0.5"}),e[60]=oe):oe=e[60];let E;e[61]!==o?(E=o("sandbox.bulkCategoryPanel.modeReplaceTitle"),e[61]=o,e[62]=E):E=e[62];let L;e[63]!==E?(L=t.jsx("span",{className:"block text-sm font-medium",children:E}),e[63]=E,e[64]=L):L=e[64];let A;e[65]!==o?(A=o("sandbox.bulkCategoryPanel.modeReplaceDescription"),e[65]=o,e[66]=A):A=e[66];let F;e[67]!==A?(F=t.jsx("span",{className:"block text-xs text-muted-foreground",children:A}),e[67]=A,e[68]=F):F=e[68];let M;e[69]!==L||e[70]!==F?(M=t.jsxs(ce,{htmlFor:"cat-mode-replace",className:"flex cursor-pointer items-start gap-2.5 rounded-lg border p-3",children:[oe,t.jsxs("span",{className:"space-y-0.5",children:[L,F]})]}),e[69]=L,e[70]=F,e[71]=M):M=e[71];let V;e[72]!==n||e[73]!==z||e[74]!==M?(V=t.jsxs(ke,{value:n,onValueChange:ee,className:"gap-2",children:[z,M]}),e[72]=n,e[73]=z,e[74]=M,e[75]=V):V=e[75];let $;e[76]!==o?($=o("sandbox.bulkCategoryPanel.cancelButton"),e[76]=o,e[77]=$):$=e[77];let D;e[78]!==s||e[79]!==p||e[80]!==$?(D=t.jsx(ne,{type:"button",variant:"outline",onClick:p,disabled:s,children:$}),e[78]=s,e[79]=p,e[80]=$,e[81]=D):D=e[81];const ae=!c||s||r===0;let G;e[82]!==n||e[83]!==le||e[84]!==c?(G=()=>c&&le(n,{name:c.name,slug:c.slug}),e[82]=n,e[83]=le,e[84]=c,e[85]=G):G=e[85];let I;e[86]!==s||e[87]!==o?(I=s?t.jsxs(t.Fragment,{children:[t.jsx(ye,{size:14,className:"animate-spin"}),o("sandbox.bulkCategoryPanel.updatingButton")]}):o("sandbox.bulkCategoryPanel.applyButton"),e[86]=s,e[87]=o,e[88]=I):I=e[88];let W;e[89]!==ae||e[90]!==G||e[91]!==I?(W=t.jsx(ne,{type:"button",disabled:ae,onClick:G,children:I}),e[89]=ae,e[90]=G,e[91]=I,e[92]=W):W=e[92];let q;e[93]!==D||e[94]!==W?(q=t.jsxs("div",{className:"flex justify-end gap-2",children:[D,W]}),e[93]=D,e[94]=W,e[95]=q):q=e[95];let H;e[96]!==_||e[97]!==V||e[98]!==q?(H=t.jsxs("div",{className:"mt-6 space-y-4",children:[_,V,q]}),e[96]=_,e[97]=V,e[98]=q,e[99]=H):H=e[99];let ie;e[100]===Symbol.for("react.memo_cache_sentinel")?(ie=t.jsx(ue,{size:16,className:"shrink-0 text-muted-foreground"}),e[100]=ie):ie=e[100];const pe=String(r);let J;e[101]!==o||e[102]!==pe?(J=o("sandbox.bulkCategoryPanel.selectedPostsLabel",{count:pe}),e[101]=o,e[102]=pe,e[103]=J):J=e[103];let K;e[104]!==J?(K=t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3",children:[ie,t.jsx("span",{className:"text-sm",children:J})]}),e[104]=J,e[105]=K):K=e[105];let O;e[106]!==r||e[107]!==X||e[108]!==o?(O=r===0?t.jsx("p",{className:"border-t bg-background px-4 py-3 text-sm text-muted-foreground",children:o("sandbox.bulkCategoryPanel.noPostsSelectedMessage")}):t.jsx("ul",{className:"divide-y border-t bg-background",children:X.map(Re)}),e[106]=r,e[107]=X,e[108]=o,e[109]=O):O=e[109];let Q;e[110]!==K||e[111]!==O?(Q=t.jsxs("div",{className:"mt-8 overflow-hidden rounded-lg border bg-muted/30",children:[K,O]}),e[110]=K,e[111]=O,e[112]=Q):Q=e[112];let U;e[113]!==N||e[114]!==C||e[115]!==H||e[116]!==Q?(U=t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-2xl px-8 py-8",children:[N,C,H,Q]})}),e[113]=N,e[114]=C,e[115]=H,e[116]=Q,e[117]=U):U=e[117];let se;return e[118]!==j||e[119]!==U?(se=t.jsxs("div",{className:"flex h-full flex-col",children:[j,U]}),e[118]=j,e[119]=U,e[120]=se):se=e[120],se}function Re(i){return t.jsxs("li",{className:"flex items-center gap-2.5 px-4 py-2.5",children:[t.jsx(ue,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm",children:i.title}),i.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:i.slug})]})]},i.key)}function ze(i){return t.jsx(_e,{value:i.slug,children:t.jsx("span",{className:"truncate",children:i.name})},i.slug)}export{wi as BulkCategoryPanel};
@@ -1 +0,0 @@
1
- import{c as J,r as w,m as V,j as t,b as X,B as $,k as Y,t as I}from"./index-Dk9RGAqb.js";import{i as Z}from"./ArrowRight-B-wHAJWT.js";import{b as U}from"./ZoomOut-B-F-8cp0.js";import{n as _}from"./LinkExternal01-Di_tOfr7.js";import{aQ as K}from"./agent-icon-E6ioveGx.js";import{A as tt,a as ot,b as et,c as rt,d as it,e as st,f as at,g as nt}from"./alert-dialog-DwnblylQ.js";import{I as W}from"./input-C-gHIQip.js";import{L as q}from"./label-D9aEMZqo.js";import{w as mt,v as lt,x as pt,$ as ct,o as dt,z as B,C as gt,a0 as ut,A as xt}from"./index-CwhgWx3d.js";import{c as ft,B as ht,a as yt}from"./block-document-TZNj_QYY.js";import{u as bt}from"./use-autosave-BT7goSxj.js";import{t as jt}from"./ChevronDown-B3fDqERa.js";import{p as vt,q as Et,o as Ct}from"./automation-runs-CfKwQe7C.js";import{s as b,E as Nt}from"./primitives-FVRYsTWJ.js";import"./AlertCircle-1e3-NcEA.js";import"./Tool01-B0759esA.js";import"./ArrowUp-DI1fyC1G.js";import"./Settings02-BIGi-T7s.js";import"./Tool02-DPXeBg9E.js";import"./ArrowUpRight-BWyzrLQV.js";import"./TrendUp01-CYCVS1zr.js";import"./ZapSquare-DGe1cTc7.js";import"./Users03-3lwc9liE.js";import"./CheckCircle-Dh-3VdHB.js";import"./Check-LKA0FKR0.js";import"./ChevronRight-Dkp8mDOd.js";import"./ChevronUp-Cm7VcWLZ.js";import"./DotsVertical-DKanPfz6.js";import"./Stars02-DpsxkqJO.js";import"./Copy01-uQh3Q5Fv.js";import"./Globe01-CEh6-y49.js";import"./Eye-SCLKEZSh.js";import"./FilterLines-13dE_TWB.js";import"./Star01-lWHLfmir.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./Key01-CgioJ7nW.js";import"./LayoutLeft-Yz5NzG-w.js";import"./XCircle-B3aYrCCW.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./Play-CVGtm9ao.js";import"./Plus-CLG5QKCr.js";import"./SearchLg-CkXJjhdf.js";import"./SearchMd-DBj7HhoW.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Trash01-CWIa_mDx.js";import"./Upload01-CPD95nN4.js";import"./User01-NxrNjn_h.js";import"./Users01-DvtVVxdG.js";import"./XClose-CW0R6bEe.js";import"./X-BYXAQs6v.js";import"./Zap-CrMVm5NK.js";import"./chat-context-BF6sak7i.js";import"./autosend-CMYVBxZV.js";import"./hooks-CvwQxo-K.js";import"./use-mcp-client-Bzvvd0Df.js";import"./auth-C4POVeVe.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-C_GcVLtN.js";import"./studio-tools-CFgWeCBk.js";import"./use-virtual-mcp-BP-M67aZ.js";import"./use-ai-providers-Bujq_lmM.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-B3KnAJRh.js";import"./use-organization-settings-zX_T-3XG.js";import"./tooltip-xp77jFs4.js";import"./dialog-CzDwjrNV.js";import"./drawer-CSHRJeTj.js";import"./collection-search-zQnUIpxo.js";import"./use-mobile-DQ8jManM.js";import"./AreaChart-CB1-fSKl.js";import"./index-DaeJeAuV.js";import"./calendar-DV0NS9xq.js";import"./shell-layout-DCFL_zE0.js";import"./avatar-BQF1QGjq.js";import"./required-auth-layout-BfZFGRtL.js";import"./use-org-sso-w9j-Ok-z.js";import"./index-DKhbAOZU.js";import"./get-initials-D-f_fDFw.js";import"./popover-C2fPnPJt.js";import"./use-registry-app-DdwkqhPA.js";import"./use-mcp-tools-IcUfyh43.js";import"./use-connection-BsS-3rZB.js";import"./github-repo-scope-DjMZbiKa.js";import"./authenticate-and-persist-oauth-iHWUIj8u.js";import"./mcp-oauth-Br5ozXBx.js";import"./extract-connection-data-ChU9AlhE.js";import"./metadata-dUsYcpuu.js";import"./use-members-Cf3JeQ7o.js";import"./use-org-auth-client-B1nrzsgv.js";import"./format-time-BnbuEtat.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./dropdown-menu-CSgtqrA3.js";import"./use-copy-DmTk3Ltj.js";import"./command-CaEk5uho.js";import"./index-DLEyNPFn.js";import"./companions-core-Bua_v2zd.js";import"./form-CJlgALpE.js";import"./select-Bd1WKGSJ.js";import"./tabs-BBm6nSot.js";import"./toggle-group-DaeRkjf6.js";import"./use-deco-credits-BW-cf-qH.js";import"./sidebar-DBzYJLC2.js";import"./toolbar-icon-button-BGQ8DzLo.js";import"./skeleton-DoNQnm-q.js";import"./github-repo-picker-DeAiQyIc.js";import"./use-debounced-value-D9jV_d1U.js";import"./use-navigate-to-agent-D_vSOLwA.js";import"./reusable-new-chat-CouMjkYR.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./connection-card-CfMynI7E.js";import"./use-registry-connections-C529xEPn.js";import"./useInfiniteQuery-64uGdBMx.js";import"./use-infinite-scroll-CbSN3uty.js";import"./retry-CErkP7V6.js";import"./connection-slug-eyAPH6o3.js";import"./card-DcA1Rwjs.js";import"./integration-icon-DBUjxWMb.js";import"./textarea-CQzBh7SW.js";import"./connection-form-helpers-BABNaeU1.js";import"./collection-tabs-B-9Urj68.js";import"./badge-BbmHyS30.js";import"./useSuspenseInfiniteQuery-DYsYorpe.js";import"./connect-desktop-dialog-CxqDr22T.js";import"./select-model-BeSzDzZp.js";import"./checkbox-DsDzIgcJ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-Dh6zLap9.js";import"./index-EFMlI3jy.js";import"./file-type-icon-_JzjFo75.js";import"./toolbar-CoHzPWWi.js";import"./index-CRECkoeT.js";import"./question-004-sINsf4GQ.js";import"./use-status-sounds-D-dtBAQ9.js";import"./empty-state-CwB9YNml.js";import"./deco-site-production-url-CaKZ7xBn.js";import"./use-capability-DHlRnvUE.js";import"./pt-BR-CLy76QW2.js";import"./use-mcp-auth-status-UXgrVZIV.js";import"./use-debounced-autosave-C7P_JRA0.js";import"./index-D8ngUVkT.js";import"./search-input-BI1enB-b.js";import"./switch-J9ypA9K4.js";import"./use-secrets-CTWWthzy.js";import"./useQueries-b2s80Vy2.js";import"./monaco-editor-CIeX3g7j.js";import"./use-file-configs-D6Dg-9sN.js";import"./use-automations-m1Zli3xa.js";import"./automation-list-row-BDIVGPMe.js";import"./table-CIOCQP8H.js";import"./use-clock-tick-jphDPs9A.js";function St(j){const o=J.c(18),{icon:x,title:m,defaultOpen:v,children:u}=j,k=v===void 0?!1:v,[f,P]=w.useState(k);let l;o[0]!==x?(l=t.jsx(x,{size:15}),o[0]=x,o[1]=l):l=o[1];let r;o[2]!==m?(r=t.jsx("span",{className:"flex-1 text-left",children:m}),o[2]=m,o[3]=r):r=o[3];const a=f&&"rotate-180";let p;o[4]!==a?(p=V("transition-transform",a),o[4]=a,o[5]=p):p=o[5];let i;o[6]!==p?(i=t.jsx(jt,{size:15,className:p}),o[6]=p,o[7]=i):i=o[7];let c;o[8]!==l||o[9]!==r||o[10]!==i?(c=t.jsx(vt,{asChild:!0,children:t.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground cursor-pointer",children:[l,r,i]})}),o[8]=l,o[9]=r,o[10]=i,o[11]=c):c=o[11];let d;o[12]!==u?(d=t.jsx(Et,{className:"px-2 pt-4",children:u}),o[12]=u,o[13]=d):d=o[13];let n;return o[14]!==f||o[15]!==c||o[16]!==d?(n=t.jsxs(Ct,{open:f,onOpenChange:P,className:"mt-4",children:[c,d]}),o[14]=f,o[15]=c,o[16]=d,o[17]=n):n=o[17],n}function Sr({orgSlug:j,virtualMcpId:o,branch:x,blockKey:m,block:v,decofile:u,meta:k,onManagePosts:f,onOpenPost:P,previewBaseUrl:l}){const r=X(),a=mt({orgSlug:j,virtualMcpId:o,branch:x,packagePath:lt(o)}),p=pt(v,"categories"),[i,c,d]=bt(p,e=>{a.mutate({blockKey:m,data:B(m,"categories",e)})}),n=(e,S)=>c({...i,[e]:S}),A=ft({decofile:u,category:i,previewBaseUrl:l}),s=b(i.slug),[D,y]=w.useState(s),[g,E]=w.useState(null),[C,z]=w.useState(!1),T=s?ct(u).filter(e=>e.categorySlugs.includes(s)):[],N=T.length,H=e=>n("slug",e),M=async(e,S)=>{const G=b(i.name);z(!0);try{let h=0;for(const{key:R,payload:O}of gt(u,"posts")){const L=ut(O,e,{name:G,slug:S});L!==O&&(await a.mutateAsync({blockKey:R,data:B(R,"posts",xt(L))}),h+=1)}const F={...i,slug:S};await a.mutateAsync({blockKey:m,data:B(m,"categories",F)}),d(F),I.success(h>0?r("sandbox.categoryEditor.renameSuccessWithPosts",{count:String(h)}):r("sandbox.categoryEditor.renameSuccessNoPosts")),E(null)}catch(h){y(e),E(null),I.error(h instanceof Error?h.message:r("sandbox.categoryEditor.renameFailed"))}finally{z(!1)}},Q=()=>{const e=D.trim();if(e===s){D!==e&&y(e);return}if(!e){y(s);return}if(N===0){H(e);return}E({oldSlug:s,newSlug:e,count:N})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col",children:[t.jsxs("div",{className:"flex h-12 shrink-0 items-center justify-between border-b px-6",children:[t.jsx("span",{className:"truncate text-sm font-medium",children:b(i.name)||r("sandbox.categoryEditor.untitledCategory")}),t.jsxs("div",{className:"flex shrink-0 items-center gap-3",children:[t.jsx(dt,{isPending:a.isPending,isError:a.isError}),A&&t.jsxs($,{type:"button",variant:"outline",size:"sm",title:r("sandbox.categoryEditor.previewTooltip"),onClick:()=>window.open(A,"_blank","noopener,noreferrer"),children:[t.jsx(_,{size:14}),r("sandbox.categoryEditor.seeCategoryPreview")]})]})]}),t.jsx("div",{className:"min-w-0 flex-1 overflow-y-auto",children:t.jsxs("div",{className:"mx-auto max-w-4xl px-8 py-8",children:[t.jsx(Nt,{value:b(i.name),onChange:e=>n("name",e),placeholder:r("sandbox.categoryEditor.categoryNamePlaceholder"),className:"py-1 text-3xl font-bold text-foreground"}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(q,{htmlFor:"category-slug",children:r("sandbox.categoryEditor.slugLabel")}),t.jsx(W,{id:"category-slug",value:D,onChange:e=>y(e.target.value),onBlur:Q,placeholder:r("sandbox.categoryEditor.slugPlaceholder"),className:"h-10"})]}),t.jsxs("div",{className:"mt-4 space-y-2",children:[t.jsx(q,{htmlFor:"category-description",children:r("sandbox.categoryEditor.descriptionLabel")}),t.jsx(W,{id:"category-description",value:b(i.description),onChange:e=>n("description",e.target.value),placeholder:r("sandbox.categoryEditor.descriptionPlaceholder"),className:"h-10"})]}),t.jsx(St,{icon:K,title:r("sandbox.categoryEditor.contentTitle"),defaultOpen:!0,children:t.jsx(ht,{value:yt(i.sections),onChange:e=>n("sections",e),meta:k,sandboxRef:{orgSlug:j,virtualMcpId:o,branch:x},emptyMessage:r("sandbox.categoryEditor.noContentEmpty")})}),t.jsxs("div",{className:"mt-6 overflow-hidden rounded-lg border bg-muted/30",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsx(U,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:r("sandbox.categoryEditor.postsInCategory",{count:String(N)})})]}),t.jsxs($,{type:"button",variant:"outline",size:"sm",disabled:!s,title:r(s?"sandbox.categoryEditor.pickPostsTooltip":"sandbox.categoryEditor.setSlugTooltip"),onClick:()=>f(s),children:[r("sandbox.categoryEditor.addPostsButton"),t.jsx(Z,{size:14})]})]}),N>0&&t.jsx("ul",{className:"divide-y border-t bg-background",children:T.map(e=>t.jsx("li",{children:t.jsxs("button",{type:"button",onClick:()=>P(e.key),className:"flex w-full items-center gap-2.5 px-4 py-2.5 text-left transition-colors hover:bg-muted cursor-pointer",children:[t.jsx(U,{size:14,className:"shrink-0 text-muted-foreground"}),t.jsxs("span",{className:"min-w-0 flex-1",children:[t.jsx("span",{className:"block truncate text-sm",children:e.title||r("sandbox.categoryEditor.untitledPost")}),e.slug&&t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e.slug})]})]})},e.key))})]})]})})]}),t.jsx(tt,{open:!!g,onOpenChange:e=>{e||C||(y(s),E(null))},children:t.jsxs(ot,{children:[t.jsxs(et,{children:[t.jsx(rt,{children:r("sandbox.categoryEditor.renameDialogTitle")}),t.jsx(it,{children:g?r("sandbox.categoryEditor.renameDialogDescription",{oldSlug:g.oldSlug,newSlug:g.newSlug,count:String(g.count)}):null})]}),t.jsxs(st,{children:[t.jsx(at,{disabled:C,children:r("sandbox.categoryEditor.cancelButton")}),t.jsx(nt,{onClick:e=>{e.preventDefault(),g&&M(g.oldSlug,g.newSlug)},disabled:C,children:C?t.jsxs(t.Fragment,{children:[t.jsx(Y,{size:14,className:"animate-spin"}),r("sandbox.categoryEditor.renamingLabel")]}):r("sandbox.categoryEditor.renameActionButton")})]})]})})]})}export{Sr as CategoryEditor};
@@ -1,36 +0,0 @@
1
- import{W as x,a1 as C,X as i,a4 as Ee,a2 as re,a3 as xe,aG as Se,co as St,ba as Le,a$ as ot,c as le,m as kt,bt as It,j as G,F as ee,K as ge,n as wt,J as st,u as Ne,o as it,t as ie,I as me,G as fe,d as rt,f as Ct,r as v,b as De,p as Mt,a as Tt,v as At,a8 as Pt}from"./index-Dk9RGAqb.js";import{A as lt,c as Rt,a as _t,w as Et}from"./autosend-CMYVBxZV.js";import{S as Dt,u as Ot,d as $t,b as Lt}from"./hooks-CvwQxo-K.js";import{u as Ut}from"./studio-tools-CFgWeCBk.js";import{a as Nt,u as Ft,S as jt}from"./use-mcp-client-Bzvvd0Df.js";import{u as qt}from"./use-virtual-mcp-BP-M67aZ.js";import{u as Kt,a as ye}from"./use-ai-providers-Bujq_lmM.js";import{o as Vt,b as Ht}from"./location-BpLtHjTZ.js";import{d as Qt,q as Bt,n as Wt}from"./tab-id-BijBBRwE.js";import{u as Gt}from"./use-decopilot-events-B3KnAJRh.js";import{e as zt}from"./use-organization-settings-zX_T-3XG.js";const ve=x({connection_id:i().describe("Connection ID"),selected_tools:C(i()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:C(i()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:C(i()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),ct=ve.extend({selected_tools:ve.shape.selected_tools.optional(),selected_resources:ve.shape.selected_resources.optional(),selected_prompts:ve.shape.selected_prompts.optional()}),Xt=x({connectionId:i(),toolName:i(),label:i(),icon:i().nullable().optional()}),Zt=x({id:i().describe("Stable id; used as React key and ?tab= value"),title:i().describe("Tab label"),icon:i().optional().describe("Optional lucide icon name"),view:x({type:Le("ext-app"),appId:i(),args:xe(i(),ot()).optional()})}),Yt=x({defaultMainView:x({type:i(),id:i().optional(),toolName:i().optional()}).nullable().optional(),chatDefaultOpen:Ee().nullable().optional(),tabs:C(Zt).optional()}),Ze=x({tileId:i().optional(),connectionId:i().optional().describe("Connection that owns the resource — the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:i().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:i().optional().describe("Tool name — identifies which tool's inputSchema to display when editing tile props."),toolInput:xe(i(),ot()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:Se().int().positive().optional(),maxHeight:Se().int().positive().optional()}),Fe=x({banner:i().nullable().optional(),bannerColor:i().nullable().optional(),icon:i().nullable().optional(),themeColor:i().nullable().optional(),pinnedViews:C(Xt).nullable().optional(),layout:Yt.nullable().optional(),homeTile:Ze.nullable().optional(),homeTiles:C(Ze).nullable().optional(),homePrompts:C(i()).nullable().optional()});function la(t){const e=t?.homeTiles;if(Array.isArray(e)&&e.length>0)return e;const n=t?.homeTile;return n?[n]:[]}const Jt=/^[A-Za-z_][A-Za-z0-9_]*$/,Ye=i().min(1).regex(Jt,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),en=St("kind",[x({key:Ye,kind:Le("literal"),value:i()}),x({key:Ye,kind:Le("secret"),secretId:i().min(1)})]),tn=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,nn=x({host:i().min(1).regex(tn).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:i().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),je=x({selected:i().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:i().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:i().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:C(en).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:C(nn).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),qe=x({url:i().describe("GitHub repository URL"),owner:i().describe("Repository owner"),name:i().describe("Repository name"),installationId:Se().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:i().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials.")}),an=re(["agent-sandbox","user-desktop"]),on=re(["agent-sandbox","user-desktop","cluster"]);function Ke(t){return t==="cluster"?"agent-sandbox":t}const dt={sandboxHandle:i().describe("Provider-specific handle"),previewUrl:i().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:i().nullable().optional().describe("Daemon's public URL — what cluster→daemon RPCs target. Equal to previewUrl for user-desktop; null/absent for the agent-sandbox provider (routes through hosted ingress)."),sandboxProviderKind:an.optional(),createdAt:Se().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:x({packageManager:i().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:i().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:i().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},ut=x(dt),sn=x({...dt,sandboxProviderKind:on.optional()});function rn(t){const e=sn.parse(t);return ut.parse({...e,sandboxProviderKind:e.sandboxProviderKind?Ke(e.sandboxProviderKind):void 0})}function ca(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const e=t,n={};for(const[a,o]of Object.entries(e)){if(!o||typeof o!="object"||a!=="cluster"&&a!=="agent-sandbox"&&a!=="user-desktop")continue;const s=Ke(a);try{if(a==="cluster"&&n[s])continue;n[s]=rn(o)}catch{}}return n}const Ve=xe(i().describe("userId"),xe(i().describe("branch"),xe(i().describe("sandboxProviderKind"),ut))),ln=x({id:i().describe("Stable identifier for this knowledge file"),name:i().describe("File name shown in the UI"),kind:re(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:i().describe("Org filesystem (Library) volume the file lives in"),path:i().describe("Path within the volume"),url:i().describe("Same-origin URL to read the file (display/download)"),contentType:i().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:Se().nullable().optional().describe("File size in bytes"),addedAt:i().describe("ISO timestamp when the file was attached")}),He=C(ln).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),cn=re(["smart","code-review","open"]),Qe=cn.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),da=x({id:i().describe("Unique identifier"),title:i().describe("Human-readable name"),description:i().nullable().describe("Description"),icon:i().nullable().describe("Icon URL"),created_at:i().describe("Creation timestamp"),updated_at:i().describe("Last update timestamp"),created_by:i().describe("User ID who created this item"),updated_by:i().optional().describe("User ID who last updated this item"),organization_id:i().describe("Organization ID this item belongs to"),status:re(["active","inactive"]).describe("Current status"),pinned:Ee().describe("Whether this space is pinned to the sidebar"),metadata:x({instructions:i().nullable().describe("Instructions also used as system prompt"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Fe.nullable().optional().describe("UI customization settings"),githubRepo:qe.nullable().optional().describe("Linked GitHub repository"),runtime:je.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:Ve.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:He,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Qe,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking.")}).loose().describe("Metadata"),connections:C(ve).describe("Connections with their selected tools, resources, and prompts")}),pt=x({title:i().min(1).max(120).describe("Short label shown on the chip"),description:i().max(280).optional().describe("One-line subtitle shown under the title"),text:i().min(1).describe("The message sent to the agent when the prompt is clicked")});x({title:i().min(1).max(255).describe("Name for the virtual MCP"),description:i().nullable().optional().describe("Optional description"),icon:i().nullish().describe("Optional icon URL"),status:re(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:Ee().optional().default(!1).describe("Pin to sidebar"),metadata:x({instructions:i().nullable().optional().describe("MCP server instructions"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Fe.nullable().optional().describe("UI customization settings"),githubRepo:qe.nullable().optional().describe("Linked GitHub repository"),runtime:je.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:Ve.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:He,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Qe,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking.")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C(ct).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:C(pt).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")});x({title:i().min(1).max(255).optional().describe("New name"),description:i().nullable().optional().describe("New description (null to clear)"),icon:i().nullish().describe("New icon URL"),status:re(["active","inactive"]).optional().describe("New status"),pinned:Ee().optional().describe("Pin/unpin from sidebar"),metadata:x({instructions:i().nullable().optional().describe("MCP server instructions"),enabled_plugins:C(i()).nullable().optional().describe("List of enabled plugin IDs"),subAgents:C(i()).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:i().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Fe.nullable().optional().describe("UI customization settings"),githubRepo:qe.nullable().optional().describe("Linked GitHub repository"),runtime:je.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),sandboxMap:Ve.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }"),knowledge:He,siteSlug:i().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Qe,productionUrl:i().nullable().optional().describe("Live production URL of the linked site (e.g. https://acme.com). Painted in the preview iframe while the sandbox dev server is waking.")}).loose().nullable().optional().describe("Additional metadata including MCP server instructions"),connections:C(ct).optional().describe("New connections (replaces existing)"),prompts:C(pt).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")});const dn={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"],llmapi:["claude-haiku-4-5","claude-haiku","gpt-4o-mini"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.6-luna"]},un={anthropic:["claude-sonnet-5","claude-sonnet"],openrouter:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-5","anthropic/claude-sonnet","anthropic/claude"],llmapi:["claude-sonnet-4-6","claude-sonnet"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.6-terra"]},pn={anthropic:["claude-opus-4-8","claude-sonnet-5","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8:extended","anthropic/claude-opus-4.8","anthropic/claude-sonnet-5:extended","anthropic/claude-sonnet-5","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],llmapi:["claude-opus-4-8","claude-opus","claude-sonnet-4-6"],google:["gemini-3-pro"],"claude-code":["claude-code:opus-1m","claude-code:opus","claude-code:sonnet"],codex:["codex:gpt-5.6-sol"]},hn={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],llmapi:["gemini-2.5-flash-image","gpt-image-1"],google:["gemini-2.0-flash-image"]},mn={openrouter:["perplexity/sonar","perplexity/sonar-pro"],deco:["perplexity/sonar","perplexity/sonar-pro"]},fn={openrouter:["perplexity/deep-research","perplexity/sonar-pro"],deco:["perplexity/deep-research","perplexity/sonar-pro"]};function ht(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function gn(t){return ht(t).includes("deepresearch")}const bn=["sonar","searchpreview","online"];function mt(t){const e=ht(t);return e.includes("deepresearch")?!1:bn.some(n=>e.includes(n))}function ft(t){return t.asyncResearch!==!0&&mt(t.modelId)}function gt(t){return t.asyncResearch===!0||gn(t.modelId)||mt(t.modelId)}function pe(t,e,n,a){for(const o of n){const s=t.find(r=>r.modelId===o);if(s)return{keyId:e,modelId:s.modelId,title:s.title}}for(const o of n){const s=t.find(r=>r.modelId.includes(o));if(s)return{keyId:e,modelId:s.modelId,title:s.title}}if(a){const o=t.find(a);if(o)return{keyId:e,modelId:o.modelId,title:o.title}}return null}function yn(t,e){const n={chat:{fast:null,smart:null,thinking:null},image:null,webSearch:null,deepResearch:null};for(const a of t){const o=e[a.id]??[],s=a.providerId;n.chat.fast||(n.chat.fast=pe(o,a.id,dn[s]??[])),n.chat.smart||(n.chat.smart=pe(o,a.id,un[s]??[])),n.chat.thinking||(n.chat.thinking=pe(o,a.id,pn[s]??[])),n.image||(n.image=pe(o,a.id,hn[s]??[],r=>r.capabilities?.includes("image")===!0)),n.webSearch||(n.webSearch=pe(o,a.id,mn[s]??[],ft)),n.deepResearch||(n.deepResearch=pe(o,a.id,fn[s]??[],gt))}return n}const vn=It("animate-spin",{variants:{variant:{default:"fill-primary text-gray-200",destructive:"fill-destructive text-gray-200",secondary:"fill-secondary text-gray-200",success:"fill-success text-gray-200",special:"fill-special text-background"},size:{default:"h-7 w-7",sm:"h-6 w-6",lg:"h-8 w-8",icon:"h-6 w-6",xs:"h-4 w-4"}},defaultVariants:{variant:"default",size:"default"}});function ua(t){const e=le.c(10),{variant:n,size:a}=t;let o;e[0]!==a||e[1]!==n?(o=kt(vn({variant:n,size:a})),e[0]=a,e[1]=n,e[2]=o):o=e[2];let s,r;e[3]===Symbol.for("react.memo_cache_sentinel")?(s=G.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),r=G.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"}),e[3]=s,e[4]=r):(s=e[3],r=e[4]);let l;e[5]!==o?(l=G.jsxs("svg",{"aria-hidden":"true",className:o,viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s,r]}),e[5]=o,e[6]=l):l=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=G.jsx("span",{className:"sr-only",children:"Loading..."}),e[7]=p):p=e[7];let u;return e[8]!==l?(u=G.jsxs("div",{role:"status",children:[l,p]}),e[8]=l,e[9]=u):u=e[9],u}const Je={online:!1,capabilities:[],ready:!1};function xn(t){const e=le.c(9),{org:n}=ee(),a=Ut(),o=t?.fast??!1;let s;e[0]!==n.id?(s=ge.currentLink(n.id),e[0]=n.id,e[1]=s):s=e[1];let r;e[2]!==a?(r=async()=>{const I=await a.call("LINK_CURRENT_GET",{});return I?{...I,ready:!0}:{...Je,ready:!0}},e[2]=a,e[3]=r):r=e[3];const l=o?1e3:1e4,p=o?2e3:15e3;let u;e[4]!==s||e[5]!==r||e[6]!==l||e[7]!==p?(u={queryKey:s,queryFn:r,staleTime:l,refetchInterval:p,refetchOnWindowFocus:!0},e[4]=s,e[5]=r,e[6]=l,e[7]=p,e[8]=u):u=e[8];const{data:y}=wt(u);return y??Je}function Sn(t,e=[]){return t==="stop"?e.filter(o=>o.type==="text"&&o.text).map(o=>o.text).join(`
2
- `).replace(/https?:\/\/[^\s)>\]]+/g,"").includes("?")?"requires_action":"completed":t==="tool-calls"?e.some(a=>a.type==="tool-user_ask"&&a.state==="input-available"||a.state==="approval-requested")?"requires_action":"completed":"failed"}const Re={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function kn(t,e){if(!t)return null;const n=e?Ke(e):null;if(t==="decopilot"&&n===null)return"decopilot";for(const[a,o]of Object.entries(Re))if(o.harness===t&&o.sandbox===n)return a;return null}function pa(t){return t.claudeCode?"claude-code-desktop":t.codex?"codex-desktop":null}function In(t,e){return e&&t&&Re[t].sandbox==="user-desktop"?"decopilot":t}function wn(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function Cn(t){const e=le.c(21);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=n):n=e[0];const a=st(n);let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},e[1]=o):o=e[1];const s=Ne(o);let r;e[2]!==s.brand||e[3]!==s.main||e[4]!==s.preview||e[5]!==s.skill?(r=(typeof s.main=="string"?Qt(s.main)?.path:void 0)??s.preview??s.skill??s.brand??null,e[2]=s.brand,e[3]=s.main,e[4]=s.preview,e[5]=s.skill,e[6]=r):r=e[6];const l=r;let p;if(e[7]!==a?.params.appSlug||e[8]!==a?.params.collectionName||e[9]!==a?.params.itemId||e[10]!==l||e[11]!==t){if(p=[],t&&p.push(`### Selected Agent
3
- - ID: ${t}`),l){let y;e[13]!==l?(y=Vt(l),e[13]=l,e[14]=y):y=e[14];const I=y;let R;e[15]!==l?(R=Ht(l),e[15]=l,e[16]=R):R=e[16],p.push(`### Currently Open File
4
- The user has this file open in the Library and is most likely referring to it:
5
- - Name: ${R}
6
- - Library path: ${l}${I?`
7
- - Read/edit it with your file tools at: \`${I}\``:""}
8
-
9
- When a request is ambiguous about which file or resource it targets (e.g. "change the h1", "fix this", "what's in this file", "update the title"), assume it means this file unless the user clearly indicates otherwise.`)}let u;e[17]!==a?.params.appSlug||e[18]!==a?.params.collectionName||e[19]!==a?.params.itemId?(u=[],a?.params.appSlug&&u.push(`- Connection ID: ${a?.params.appSlug}`),a?.params.collectionName&&u.push(`- Collection: ${a?.params.collectionName}`),a?.params.itemId&&u.push(`- Item ID: ${a?.params.itemId}`),e[17]=a?.params.appSlug,e[18]=a?.params.collectionName,e[19]=a?.params.itemId,e[20]=u):u=e[20],u.length>0&&p.push(`### Current Resource
10
- The user is viewing the following resource:
11
- ${u.join(`
12
- `)}
13
-
14
- Help the user understand and work with this resource.`),e[7]=a?.params.appSlug,e[8]=a?.params.collectionName,e[9]=a?.params.itemId,e[10]=l,e[11]=t,e[12]=p}else p=e[12];return p.join(`
15
-
16
- `)}function Mn(){const t=le.c(5),e=it(),{org:n}=ee();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=a):a=t[0];const o=st(a);let s;return t[1]!==o?.params||t[2]!==n||t[3]!==e?(s=r=>{const p=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!p||!p[1])return;const u=p[1],y=o?.params.appSlug;if(!y)return;e.invalidateQueries({queryKey:ge.collection(n.slug,y,u)});const I=u.toLowerCase().replace(/_/g," ");ie.success(`${I} updated`)},t[1]=o?.params,t[2]=n,t[3]=e,t[4]=s):s=t[4],s}function Tn(){const t=le.c(4),{org:e,project:n}=ee(),a=`${e.id}/${n.id}`;let o;t[0]!==a?(o=fe.taskLastViewed(a),t[0]=a,t[1]=o):o=t[1];const[,s]=me(o,An);let r;return t[2]!==s?(r={markTaskRead:p=>{s(u=>({...u,[p]:new Date().toISOString()}))}},t[2]=s,t[3]=r):r=t[3],r}function An(t){return t??{}}function bt(){const t=rt(),{org:e}=ee(),n=Ne({strict:!1}),a=Ct({strict:!1}),o=n.virtualmcpid??Nt(e.id).id,s=(p,u)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:p},search:y=>{const I={},R=u?.virtualMcpId??y.virtualmcpid;R&&(I.virtualmcpid=R);const b=y.main;return b&&typeof b=="string"&&!Bt(b)&&(I.main=b),(y.sidepanel==="chat"||y.sidepanel===0)&&(I.sidepanel=y.sidepanel),u?.autosend&&(I.autosend=lt),I}})},r=v.useRef(crypto.randomUUID()),l=a.taskId??r.current;return{virtualMcpId:o,taskId:l,navigateToTask:s}}function Pn(t,e){const{mimeType:n,data:a}=t;if(n.startsWith("text/"))try{const o=new TextDecoder().decode(Uint8Array.from(atob(a),s=>s.charCodeAt(0)));return[{type:"text",text:`${e}
17
- ${o}`}]}catch(o){console.error("Failed to decode text file:",o)}return[{type:"file",url:`data:${n};base64,${a}`,filename:e,mediaType:n}]}function et(t,e){const n=[];for(const a of t)!a||typeof a!="object"||("text"in a&&a.text?n.push({type:"text",text:`[${e}]
18
- ${a.text}`}):"blob"in a&&a.blob&&a.mimeType&&n.push({type:"file",url:`data:${a.mimeType};base64,${a.blob}`,filename:String(a.uri),mediaType:String(a.mimeType)}));return n}function Rn(t,e){const n=(t.files??[]).filter(r=>r.content?.trim()),a=t.omittedPaths??[];if(n.length===0&&a.length===0)return[];const o=n.map(r=>`<skill-file path="${r.relPath}">
19
- ${r.content.trim()}
20
- </skill-file>`).join(`
21
-
22
- `),s=a.length>0?`
23
-
24
- Other files in \`${t.sandboxPath}/\`: ${a.join(", ")}`:"";return[{type:"text",text:`[${e}]
25
- ${o}${s}`}]}function _n(t,e){const n=[];for(const a of t){if(a.role!=="user"||!a.content)continue;const o=Array.isArray(a.content)?a.content:[a.content];for(const s of o)switch(s.type){case"text":{const r=s.text?.trim();if(!r)continue;n.push({type:"text",text:`[${e}]
26
- ${r}`});break}case"image":case"audio":{if(!s.data||!s.mimeType)continue;n.push({type:"file",url:`data:${s.mimeType};base64,${s.data}`,mediaType:s.mimeType});break}case"resource":{const r=s.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?n.push({type:"text",text:`[${e}]
27
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&n.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return n}function yt(t){if(!t)return[];const e=[];let n="";const a=o=>{if(o){if(o.type==="text"&&"text"in o&&typeof o.text=="string")n+=o.text;else if(o.type==="mention"&&o.attrs){const s=o.attrs.char??"/",r=`${s}${o.attrs.name}`;if(o.attrs.kind==="task"){const l=o.attrs.metadata,p=l?.title??o.attrs.name??"",u=l?.context?.trim()||[p,l?.description?.trim()].filter(Boolean).join(`
28
-
29
- `);u&&e.push({type:"text",text:u});return}if(n+=r,s==="@"){const l=o.attrs.metadata;l&&typeof l=="object"&&!Array.isArray(l)&&"agentId"in l?e.push({type:"text",text:`[DELEGATE TO AGENT: ${l.title??o.attrs.name} (agent_id: ${l.agentId})]
30
- 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(l)&&e.push(...et(l,r))}else if(o.attrs.kind==="skill"){const l=o.attrs.metadata;l&&!Array.isArray(l)&&Array.isArray(l.files)&&e.push(...Rn(l,r))}else{const l=o.attrs.metadata||o.attrs.prompts||[];Array.isArray(l)&&l.length>0&&typeof l[0]=="object"&&l[0]!==null&&"role"in l[0]?e.push(..._n(l,r)):Array.isArray(l)&&e.push(...et(l,r))}}else if(o.type==="file"&&o.attrs){const s=o.attrs,r=`[file:://${encodeURIComponent(s.name)}]`;n+=r,e.push(...Pn(s,r))}if("content"in o&&Array.isArray(o.content))for(const s of o.content)a(s)}};return a(t),n.trim()&&e.unshift({type:"text",text:n.trim()}),e}function ha(t){const e=yt(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}function ma(t){return new Set(t.filter(e=>e.status==="queued").map(e=>e.messageId))}function En(t){return(t??[]).map(e=>e?.type==="text"&&typeof e.text=="string"?e.text:"").join("").trim()}function fa(t){return t.filter(e=>e.status==="queued").sort((e,n)=>e.enqueuedAt-n.enqueuedAt)}function Dn(t,e){return t.some(n=>n.messageId===e.messageId)?t:[...t,e]}function On(t,e){return t.filter(n=>n.messageId!==e)}const tt=new Map,Be=new Set;function $n(t){Be.add(t)}function Ln(t){return Be.has(t)}function Un(t){Be.delete(t)}function ke(t){let e=tt.get(t);return e||(e=new Dt([]),tt.set(t,e)),e}function vt(t,e){ke(t).update(n=>Dn(n,e))}function Ue(t,e){ke(t).update(n=>On(n,e))}function Nn(t,e){ke(t).set(e)}const _e=new Map;function Fn(t,e){_e.set(`${t}:${e.id}`,e)}function jn(t,e){const n=`${t}:${e}`,a=_e.get(n);return _e.delete(n),a}function nt(t,e){_e.delete(`${t}:${e}`)}async function J(t,e){try{const n=await fetch(`/api/${encodeURIComponent(t)}/decopilot/queue/${encodeURIComponent(e)}`,{credentials:"include"});if(!n.ok)return;const a=await n.json();Nn(e,a.items??[])}catch{}}function ga(t){const e=le.c(2);let n;e[0]!==t?(n=ke(t),e[0]=t,e[1]=n):n=e[1];const a=n;return v.useSyncExternalStore(a.subscribe,a.get,a.get)}function qn(){const{org:t}=ee();return{enqueue:vt,refresh:e=>J(t.slug,e),cancel:async(e,n)=>{const a=`thread-run:${e}:${n}`;Ue(e,n);try{const o=await fetch(`/api/${encodeURIComponent(t.slug)}/decopilot/queue/${encodeURIComponent(e)}/cancel/${encodeURIComponent(a)}`,{method:"POST",credentials:"include"});if(!o.ok&&o.status!==404)throw new Error(`Cancel failed: ${o.status}`);return!0}catch(o){return ie.error(o instanceof Error?o.message:"Failed to cancel"),!1}finally{await J(t.slug,e)}}}}function oe(t,e,n,a){if(!t)return null;const o=e.find(r=>r.id===t.keyId);if(!o)return null;const s=n.find(r=>r.modelId===t.modelId);return s?{...s,keyId:t.keyId}:{modelId:t.modelId,title:a??t.modelId,keyId:t.keyId,providerId:o.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function Kn(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function Vn(t,e,n,a){if(!n||a.length===0)return null;const o=e.find(p=>p.id===n);if(!o)return null;const s=yn([o],{[n]:a}),r=t==="fast"?s.chat.fast:t==="thinking"?s.chat.thinking:s.chat.smart;if(!r)return null;const l=a.find(p=>p.modelId===r.modelId);return l?{...l,keyId:n}:null}const at=new Set,se=new Set;function he(t){return v.useSyncExternalStore(t.subscribe,t.get,t.get)}function Hn(t){return t.kind==="loading"?"ready":t.kind}const Qn=1e4,Bn=10,We=v.createContext(null),Ge=v.createContext(null),ze=v.createContext(null),xt=v.createContext(null);function Wn({children:t}){const{locator:e}=ee(),{virtualMcpId:n}=bt(),[a,o]=me(fe.chatSelectedImageModel(e),null),[s,r]=me(fe.chatSelectedWebSearchModel(e),null),[l,p]=me(fe.chatSelectedDeepResearchModel(e),null),[u,y]=v.useState(null),[I,R]=v.useState("default"),b=zt(),[$,X]=me(fe.chatSimpleModeTier(e),null),V=Kn($),w=Kt(),M=b.tiers[V],U=u&&w.some(c=>c.id===u)?u:M?.keyId??w[0]?.id??null,{models:N,isLoading:A}=ye(U??void 0),{models:H}=ye(M?.keyId),{models:te}=ye(b.tiers.image?.keyId),{models:ne}=ye(b.tiers.web_search?.keyId),{models:F}=ye(b.tiers.deep_research?.keyId),Z=oe(M,w,H,M?.title)??Vn(V,w,U,N),z=A,Q=N.filter(c=>c.capabilities?.includes("image")),j=oe(a,w,Q),Y=oe(b.tiers.image,w,te,b.tiers.image?.title)??j??Q[0]??null,m=N.filter(ft),L=oe(s,w,m),B=m.find(c=>c.modelId==="perplexity/sonar")??m[0]??null,W=oe(b.tiers.web_search,w,ne,b.tiers.web_search?.title)??L??B,q=N.filter(gt),T=oe(l,w,q),K=q.find(c=>c.modelId==="perplexity/deep-research")??q.find(c=>c.asyncResearch===!0)??q[0]??null,E=oe(b.tiers.deep_research,w,F,b.tiers.deep_research?.title)??T??K,Oe=qt(n)??{id:n,title:"",description:null,icon:null},[we,Ce]=v.useState({}),Me=(c,f)=>{const O=[];for(const k of f.content??[])k.type==="text"&&k.text?.trim()&&O.push(k.text.trim());const P=O.join(`
31
- `);if(!P){be(c);return}new TextEncoder().encode(P).length>Qn||Ce(k=>Object.keys(k).length>=Bn&&!(c in k)?k:{...k,[c]:P})},be=c=>{Ce(f=>{const{[c]:O,...P}=f;return P})},[Te,ce]=me(fe.chatLastAgentOption(e),c=>c&&c in Re?c:null),ae=Xn(),$e=ae?.isThreadLocked&&ae.lockedHarness!=null?kn(ae.lockedHarness,ae.lockedSandbox):null,Ae=xn(),Xe=In(Te,Ae.ready&&!Ae.online),de=ae?.isThreadLocked?$e:Xe,Pe=de?Re[de]:null,d=Pe?.harness??null,h=Pe?.sandbox??null,[_,D]=v.useState(void 0),g=v.useRef(_);g.current=_;const S={selectedModel:Z,setModel:()=>{},credentialId:U,setCredentialId:y,allModelsConnections:w,isModelsLoading:z,selectedVirtualMcp:Oe,imageModel:Y,setImageModel:c=>{o(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},webSearchModel:W,setWebSearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:E,setDeepResearchModel:c=>{p(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:I,setChatMode:R,appContexts:we,setAppContext:Me,clearAppContext:be,tiptapDoc:_,setTiptapDoc:D,tiptapDocRef:g,resetInteraction:()=>{},simpleModeTier:V,setSimpleModeTier:c=>X(c),pendingAgentOption:de,setPendingAgentOption:ce,pendingHarnessId:d,pendingSandboxProviderKind:h};return G.jsx(ze.Provider,{value:S,children:t})}function ba(t){const e=le.c(39),{virtualMcpId:n,task:a,children:o}=t,{locator:s}=ee(),{data:r}=Tt.useSession(),l=r?.user??null,{taskId:p,virtualMcpId:u,navigateToTask:y}=bt(),[I]=At(),{markTaskRead:R}=Tn(),b=Lt(),$=p,X=u,V=Cn(X);let w;e[0]!==R||e[1]!==y?(w=(T,K)=>{R(T),y(T,{virtualMcpId:K?.virtualMcpId,autosend:K?.autosend})},e[0]=R,e[1]=y,e[2]=w):w=e[2];const M=w,U=$&&a?.id===$?a:null,N=U?.harness_id??null,A=U?.sandbox_provider_kind??null,H=U?.branch??null,te=N!=null,ne=H;let F;e[3]!==M||e[4]!==b||e[5]!==n?(F=()=>{const T=crypto.randomUUID();return b.create({id:T,virtual_mcp_id:n}).then(()=>M(T)).catch(()=>{M(T)}),T},e[3]=M,e[4]=b,e[5]=n,e[6]=F):F=e[6];const Z=F;let z;e[7]!==s||e[8]!==M||e[9]!==b||e[10]!==n?(z=T=>{const K=crypto.randomUUID(),E=T.virtualMcpId??n;Et(sessionStorage,s,K,T.message),b.create({id:K,virtual_mcp_id:E}).then(()=>M(K,{virtualMcpId:T.virtualMcpId,autosend:!0})).catch(()=>{M(K,{virtualMcpId:T.virtualMcpId,autosend:!0})})},e[7]=s,e[8]=M,e[9]=b,e[10]=n,e[11]=z):z=e[11];const Q=z;let j;e[12]!==$||e[13]!==b?(j=T=>{$&&b.setBranch($,T)},e[12]=$,e[13]=b,e[14]=j):j=e[14];let Y;e[15]!==U||e[16]!==Z||e[17]!==Q||e[18]!==ne||e[19]!==$||e[20]!==X||e[21]!==te||e[22]!==H||e[23]!==N||e[24]!==A||e[25]!==M||e[26]!==j?(Y={virtualMcpId:X,taskId:$,openTask:M,createTask:Z,createTaskWithMessage:Q,activeTask:U,isThreadLocked:te,lockedHarness:N,lockedSandbox:A,lockedBranch:H,currentBranch:ne,setCurrentTaskBranch:j},e[15]=U,e[16]=Z,e[17]=Q,e[18]=ne,e[19]=$,e[20]=X,e[21]=te,e[22]=H,e[23]=N,e[24]=A,e[25]=M,e[26]=j,e[27]=Y):Y=e[27];const m=Y;let L;e[28]!==V||e[29]!==I||e[30]!==y||e[31]!==l?(L={user:l,contextPrompt:V,preferences:I,rawNavigateToTask:y},e[28]=V,e[29]=I,e[30]=y,e[31]=l,e[32]=L):L=e[32];const B=L;let W;e[33]!==o||e[34]!==B?(W=G.jsx(Wn,{children:G.jsx(xt.Provider,{value:B,children:o})}),e[33]=o,e[34]=B,e[35]=W):W=e[35];let q;return e[36]!==W||e[37]!==m?(q=G.jsx(Ge.Provider,{value:m,children:W}),e[36]=W,e[37]=m,e[38]=q):q=e[38],q}function ya({taskId:t,children:e}){const n=De(),{virtualMcpId:a,activeTask:o,currentBranch:s}=Gn();t&&!at.has(t)&&(at.add(t),Mt("chat_opened",{thread_id:t}));const{imageModel:r,webSearchModel:l,deepResearchModel:p,chatMode:u,setChatMode:y,appContexts:I,setTiptapDoc:R,simpleModeTier:b,pendingSandboxProviderKind:$,pendingHarnessId:X}=zn(),V=v.useContext(xt);if(!V)throw new Error(n("chat.chatContext.activeTaskProviderMissingContext"));const{user:w,contextPrompt:M,preferences:U,rawNavigateToTask:N}=V,{org:A,locator:H}=ee(),te=qn(),[ne,F]=v.useState(null),Z=Mn(),z=it(),Q=Ot(),j=rt(),Y=Ft({connectionId:jt,orgId:A.id,orgSlug:A.slug}),m=$t(A.slug,t,{client:Y});v.use(m.ready);const L=he(m.messages),B=he(m.status),W=he(m.finishReason),q=he(m.runStatusStage),T=he(m.hasMoreOlder),K=he(m.isFetchingOlder),E=v.useRef({onToolCall:Z,queryClient:z,rawNavigateToTask:N,taskId:t,manager:Q,navigate:j,orgId:A.id,orgSlug:A.slug});E.current={onToolCall:Z,queryClient:z,rawNavigateToTask:N,taskId:t,manager:Q,navigate:j,orgId:A.id,orgSlug:A.slug},Gt({orgSlug:A.slug,taskId:t,onTaskStatus:d=>{const h=E.current,_=d.data.message_id;if(d.data.status==="in_progress"&&_){Ue(h.taskId,_);const D=jn(h.taskId,_);D&&m.applyLocalMessage(D),J(h.orgSlug,h.taskId)}Ln(h.taskId)&&(async()=>(await J(h.orgSlug,h.taskId),await m.reconcileFromServer()&&ke(h.taskId).get().length===0&&Un(h.taskId)))()}}),v.useEffect(()=>{const d={onData:g=>{if(g.type==="data-thread-title"){const S=g.data;if(!S?.title)return;const c=E.current;if(!c.taskId)return;c.manager.patchThread({id:c.taskId,title:S.title,updated_at:new Date().toISOString()});return}if(g.type==="data-deck-updated"){const S=g.data;if(!S?.path)return;const c=S.path,f=E.current;f.queryClient.invalidateQueries({queryKey:ge.orgFsStat(f.orgId,"home",c)}),f.queryClient.invalidateQueries({queryKey:ge.orgFsRecent(f.orgId)}),f.navigate({to:".",search:O=>({...O,main:Wt(c)}),replace:!0});return}if(g.type==="data-open-preview"){const S=g.data,c=E.current,f=c.taskId;if(f){const O=c.manager.threads.get().find(P=>P.id===f);c.manager.patchThread({id:f,...S?.branch?{branch:S.branch}:{},...S?.sandboxProviderKind?{sandbox_provider_kind:S.sandboxProviderKind}:{},metadata:{...O?.metadata??{},...S?.githubRepo?{githubRepo:S.githubRepo}:{},...S?.sandboxMap?{sandboxMap:S.sandboxMap}:{}}})}c.navigate({to:".",search:O=>({...O,main:"preview"}),replace:!0});return}},onFinish:(g,S,c)=>{const f=E.current;f.taskId&&J(f.orgSlug,f.taskId),f.taskId&&f.manager.patchThread({id:f.taskId,status:Sn(c,g.parts),updated_at:new Date().toISOString()});const O=g.parts?.some(k=>{const ue=k;return(ue.type==="tool-share_with_user"||ue.type==="tool-bash"||ue.type==="tool-write")&&ue.state==="output-available"});if(f.taskId&&O){const k=ge.threadOutputs(f.taskId);for(const ue of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{f.queryClient.invalidateQueries({queryKey:k})},ue)}f.queryClient.invalidateQueries({queryKey:ge.homeNextActions(f.orgSlug)});const P=g.metadata?.thread_id;P&&P!==f.taskId&&f.rawNavigateToTask(P)},onError:g=>{F(g),console.error("[chat] Error",g)},onToolCall:g=>E.current.onToolCall(g)};m.observer=d,J(E.current.orgSlug,E.current.taskId);const h=g=>g==="submitted"||g==="streaming";let _=h(m.status.get().kind);const D=m.status.subscribe(()=>{const g=h(m.status.get().kind);if(g===_)return;_=g;const S=E.current;J(S.orgSlug,S.taskId)});return()=>{m.observer===d&&(m.observer=null),D()}},[m]);const Ie=B.kind==="submitted"||B.kind==="streaming",Oe=L.length===0,we=L.at(-1),Ce=!Ie&&we?.role==="assistant"&&we.parts.some(d=>"state"in d&&d.state==="approval-requested"),Me=o,be=(Me?.status==="in_progress"||Me?.status==="expired")&&B.kind==="ready"&&L.length>0;async function Te(d){const h=t,_=a,D=Object.entries(I),g=D.length>0?D.map(([P,k])=>`### App Context: ${P}
32
- ${k}`).join(`
33
-
34
- `):"",S=[M,g].filter(Boolean).join(`
35
-
36
- `);let c=u;c==="gen-image"&&!r&&(c="default"),c==="web-search"&&!l&&(c="default"),c==="deep-research"&&!p&&(c="default"),(c==="web-search"||c==="deep-research")&&y("default");const f=wn({thread:o?{harness_id:o.harness_id??null,sandbox_provider_kind:o.sandbox_provider_kind??null,branch:o.branch??null}:null,globals:{harnessId:X??void 0,sandboxProviderKind:$??void 0,branch:s}});o?.harness_id||Q.patchThread({id:h,harness_id:f.harnessId??"decopilot",sandbox_provider_kind:f.sandboxProviderKind??null,updated_at:new Date().toISOString()});const O={tier:b,mode:c,toolApprovalLevel:U.toolApprovalLevel??Pt(),system:S||void 0,agent:{id:_},thread_id:h,...f};try{if(Ie||be){let P=!0;try{Fn(h,d),await m.enqueue(d,O),vt(h,{workflowId:`thread-run:${h}:${d.id}`,messageId:d.id,text:En(d.parts),hasAttachments:d.parts.some(k=>k.type==="file"),status:"queued",enqueuedAt:Date.now(),optimistic:!0}),$n(h)}catch(k){P=!1,nt(h,d.id),Ue(h,d.id),F(k instanceof Error?k:new Error(String(k))),ie.error(k instanceof Error?k.message:n("chat.chatContext.failedToQueueMessage"))}return J(A.slug,h),P}return await m.submit({kind:"message",message:d},O),!0}finally{se.delete(h)}}async function ce(d){const h=d.parts??yt(d.tiptapDoc);if(h.length===0||se.has(t))return;se.add(t),F(null),R(void 0);const _={tiptapDoc:d.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:w?.image??void 0,name:w?.name??"you"}},D={id:crypto.randomUUID(),role:"user",parts:h,metadata:_};await Te(D)}async function ae(d,h){if(se.has(t))return ie.info(n("chat.chatContext.stillSendingPreviousMessage")),!1;if(se.add(t),!await te.cancel(t,d))return se.delete(t),ie.error(n("chat.chatContext.couldNotRemoveOriginalMessage")),!1;nt(t,d),m.removeLocalMessage(d);const D={id:crypto.randomUUID(),role:"user",parts:[{type:"text",text:h}],metadata:{created_at:new Date().toISOString(),user:{avatar:w?.image??void 0,name:w?.name??"you"}}};try{return await Te(D)}catch(g){return ie.error(g instanceof Error?g.message:n("chat.chatContext.failedToSendEditedMessage")),!1}}const $e=async()=>{m.stop();try{const d=await fetch(`/api/${A.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(d.status===404)return;if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.message??n("chat.chatContext.cancelFailedStatus",{status:d.status}))}}catch(d){const h=d instanceof Error?d.message:n("chat.chatContext.failedToCancel");ie.error(h),console.error("[chat] cancelRun",d)}},Ae=d=>d&&typeof d=="object"&&"type"in d?ce({tiptapDoc:d}):ce(d),de=Ne({strict:!1}).autosend===lt;v.useEffect(()=>{if(!de||L.length>0)return;const d=Rt(sessionStorage,H,t);d&&ce(d.message).then(()=>{_t(sessionStorage,H,t)})},[de,L.length,H,t,ce]);const Pe={messages:L,status:Hn(B),sendMessage:Ae,editQueuedMessage:ae,stop:()=>{$e()},submit:(d,h)=>m.submit(d,h),removeLocalMessage:d=>m.removeLocalMessage(d),isSendInFlight:()=>se.has(t),error:ne,clearError:()=>F(null),finishReason:W,runStatusStage:q,clearFinishReason:()=>m.finishReason.set(null),isStreaming:Ie,isChatEmpty:Oe,isWaitingForApprovals:Ce??!1,isRunInProgress:be,hasMoreOlder:T,isFetchingOlder:K,fetchOlderMessages:m.fetchOlderMessages.bind(m)};return G.jsx(We.Provider,{value:Pe,children:e})}function va(){const t=De(),e=v.useContext(We);if(!e)throw new Error(t("chat.chatContext.useChatStreamMissingContext"));return e}function xa(){return v.useContext(We)}function Gn(){const t=De(),e=v.useContext(Ge);if(!e)throw new Error(t("chat.chatContext.useChatTaskMissingContext"));return e}function zn(){const t=De(),e=v.useContext(ze);if(!e)throw new Error(t("chat.chatContext.useChatPrefsMissingContext"));return e}function Sa(){return v.useContext(ze)}function Xn(){return v.useContext(Ge)}export{ya as A,Wn as C,Jt as E,ua as S,da as V,zn as a,va as b,Xn as c,Gn as d,ga as e,qn as f,nt as g,xa as h,ba as i,ma as j,ca as k,tn as l,la as m,yt as n,bt as o,pa as p,Sa as q,ft as r,fa as s,ha as t,xn as u,gt as v,yn as w};
@@ -1 +0,0 @@
1
- import{c as k,j as t,B as K,k as oe,W as Ye,X as re,b as Q,E as Ee,r as E,F as fe,b3 as Ze,b4 as Oe,Z as Ge,m as W,b5 as et,u as tt,L as te,t as st,f as he,aV as Re}from"./index-Dk9RGAqb.js";import{E as Fe}from"./empty-state-CwB9YNml.js";import{u as ge}from"./use-mcp-client-Bzvvd0Df.js";import{F as ae,a as lt,b as ce,d as de}from"./form-CJlgALpE.js";import{I as pe}from"./input-C-gHIQip.js";import{T as xe}from"./textarea-CQzBh7SW.js";import{a as ot,b as nt,V as je,O as it,M as rt}from"./index-CSZh49Ui.js";import{aB as at,T as ct,aC as dt,$ as mt,a9 as ut,aD as pt,a2 as ye}from"./agent-icon-E6ioveGx.js";import{g as xt,M as ft,a as we}from"./index-DaeJeAuV.js";import{A as ht,a as gt,b as jt}from"./alert-BdtEy3y8.js";import{S as Ce,a as Ie,b as $e,c as Te,d as me}from"./select-Bd1WKGSJ.js";import{b as bt,c as Pe,T as ke,a as Ae}from"./tooltip-xp77jFs4.js";import{i as Nt}from"./AlertCircle-1e3-NcEA.js";import{s as vt}from"./Stars02-DpsxkqJO.js";import{a as St}from"./Copy01-uQh3Q5Fv.js";import{i as yt}from"./Play-CVGtm9ao.js";import{i as wt}from"./ChevronRight-Dkp8mDOd.js";import{g as Ct}from"./connection-slug-eyAPH6o3.js";import{u as It,T as $t}from"./use-mcp-auth-status-UXgrVZIV.js";import{a as ze,u as Me}from"./use-connection-BsS-3rZB.js";import{a as Tt}from"./use-mcp-tools-IcUfyh43.js";import{M as Pt,c as kt}from"./monaco-editor-CIeX3g7j.js";import{I as De}from"./integration-icon-DBUjxWMb.js";import{h as At,q as Dt}from"./chat-context-BF6sak7i.js";import{u as Et}from"./shell-layout-DCFL_zE0.js";import{n as Ot}from"./Tool02-DPXeBg9E.js";import"./auth-C4POVeVe.js";import"./label-D9aEMZqo.js";import"./index-D8ngUVkT.js";import"./sidebar-DBzYJLC2.js";import"./LayoutLeft-Yz5NzG-w.js";import"./use-mobile-DQ8jManM.js";import"./X-BYXAQs6v.js";import"./ZoomOut-B-F-8cp0.js";import"./Key01-CgioJ7nW.js";import"./extract-connection-data-ChU9AlhE.js";import"./metadata-dUsYcpuu.js";import"./use-registry-connections-C529xEPn.js";import"./use-organization-settings-zX_T-3XG.js";import"./studio-tools-CFgWeCBk.js";import"./Plus-CLG5QKCr.js";import"./index-DLEyNPFn.js";import"./popover-C2fPnPJt.js";import"./use-virtual-mcp-BP-M67aZ.js";import"./Check-LKA0FKR0.js";import"./SearchMd-DBj7HhoW.js";import"./Users03-3lwc9liE.js";import"./use-create-virtual-mcp-C2sWKZ2h.js";import"./use-navigate-to-agent-D_vSOLwA.js";import"./hooks-CvwQxo-K.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-C_GcVLtN.js";import"./reusable-new-chat-CouMjkYR.js";import"./Tool01-B0759esA.js";import"./ArrowUp-DI1fyC1G.js";import"./Settings02-BIGi-T7s.js";import"./ArrowRight-B-wHAJWT.js";import"./ArrowUpRight-BWyzrLQV.js";import"./TrendUp01-CYCVS1zr.js";import"./ZapSquare-DGe1cTc7.js";import"./CheckCircle-Dh-3VdHB.js";import"./ChevronDown-B3fDqERa.js";import"./ChevronUp-Cm7VcWLZ.js";import"./DotsVertical-DKanPfz6.js";import"./Globe01-CEh6-y49.js";import"./Eye-SCLKEZSh.js";import"./FilterLines-13dE_TWB.js";import"./Star01-lWHLfmir.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./XCircle-B3aYrCCW.js";import"./LinkExternal01-Di_tOfr7.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./SearchLg-CkXJjhdf.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Trash01-CWIa_mDx.js";import"./Upload01-CPD95nN4.js";import"./User01-NxrNjn_h.js";import"./Users01-DvtVVxdG.js";import"./XClose-CW0R6bEe.js";import"./Zap-CrMVm5NK.js";import"./badge-BbmHyS30.js";import"./mcp-oauth-Br5ozXBx.js";import"./index-CRECkoeT.js";import"./autosend-CMYVBxZV.js";import"./use-ai-providers-Bujq_lmM.js";import"./location-BpLtHjTZ.js";import"./tab-id-BijBBRwE.js";import"./use-decopilot-events-B3KnAJRh.js";import"./avatar-BQF1QGjq.js";import"./dialog-CzDwjrNV.js";import"./required-auth-layout-BfZFGRtL.js";import"./use-org-sso-w9j-Ok-z.js";function Rt(s){const e=k.c(15),{onSave:n,onUndo:l,isDirty:o,isSaving:i,saveLabel:r,undoLabel:c}=s,d=r===void 0?"Save":r,a=c===void 0?"Undo":c;if(!o)return null;let x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(at,{size:14}),e[0]=x):x=e[0];let h;e[1]!==i||e[2]!==l||e[3]!==a?(h=t.jsxs(K,{variant:"outline",size:"sm",onClick:l,disabled:i,"aria-label":a,children:[x,a]}),e[1]=i,e[2]=l,e[3]=a,e[4]=h):h=e[4];let m;e[5]!==i?(m=i?t.jsx(oe,{size:14,className:"animate-spin"}):t.jsx(ct,{size:14}),e[5]=i,e[6]=m):m=e[6];let f;e[7]!==i||e[8]!==n||e[9]!==d||e[10]!==m?(f=t.jsxs(K,{variant:"default",size:"sm",onClick:n,disabled:i,"aria-label":d,children:[m,d]}),e[7]=i,e[8]=n,e[9]=d,e[10]=m,e[11]=f):f=e[11];let p;return e[12]!==h||e[13]!==f?(p=t.jsxs(t.Fragment,{children:[h,f]}),e[12]=h,e[13]=f,e[14]=p):p=e[14],p}Ye({title:re().min(1),description:re().nullable(),body:re()});function ue(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Ft(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(l=>l==="mcps"),n=e>=0?s[e+1]:void 0;return n?decodeURIComponent(n):void 0}function zt(s){const e=k.c(43),{form:n}=s,l=Q();let o;e[0]!==l?(o=l("details.prompt.details"),e[0]=l,e[1]=o):o=e[1];let i;e[2]!==o?(i=t.jsx("div",{className:"text-sm font-medium text-foreground",children:o}),e[2]=o,e[3]=i):i=e[3];let r;e[4]!==l?(r=w=>{const{field:N}=w;return t.jsxs(ce,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:l("details.prompt.title")}),t.jsx(de,{children:t.jsx(pe,{...N,placeholder:l("details.prompt.titlePlaceholder"),className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})},e[4]=l,e[5]=r):r=e[5];let c;e[6]!==n.control||e[7]!==r?(c=t.jsx(ae,{control:n.control,name:"title",render:r}),e[6]=n.control,e[7]=r,e[8]=c):c=e[8];let d;e[9]!==l?(d=w=>{const{field:N}=w;return t.jsxs(ce,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:l("details.prompt.description")}),t.jsx(de,{children:t.jsx(pe,{...N,value:N.value??"",placeholder:l("details.prompt.descriptionPlaceholder"),className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})},e[9]=l,e[10]=d):d=e[10];let a;e[11]!==n.control||e[12]!==d?(a=t.jsx(ae,{control:n.control,name:"description",render:d}),e[11]=n.control,e[12]=d,e[13]=a):a=e[13];let x;e[14]!==c||e[15]!==a?(x=t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[c,a]}),e[14]=c,e[15]=a,e[16]=x):x=e[16];let h;e[17]!==i||e[18]!==x?(h=t.jsxs("div",{className:"flex flex-col gap-4",children:[i,x]}),e[17]=i,e[18]=x,e[19]=h):h=e[19];let m;e[20]!==l?(m=l("details.prompt.message"),e[20]=l,e[21]=m):m=e[21];let f;e[22]!==m?(f=t.jsx("div",{className:"text-sm font-medium text-foreground",children:m}),e[22]=m,e[23]=f):f=e[23];let p;e[24]!==l?(p=l("details.prompt.messageDescription"),e[24]=l,e[25]=p):p=e[25];let g;e[26]!==p?(g=t.jsx("div",{className:"text-xs text-muted-foreground",children:p}),e[26]=p,e[27]=g):g=e[27];let b;e[28]!==l?(b=w=>{const{field:N}=w;return t.jsx(ce,{children:t.jsx(de,{children:t.jsx(xe,{...N,value:N.value??"",placeholder:l("details.prompt.bodyPlaceholder"),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"})})})},e[28]=l,e[29]=b):b=e[29];let S;e[30]!==n.control||e[31]!==b?(S=t.jsx(ae,{control:n.control,name:"body",render:b}),e[30]=n.control,e[31]=b,e[32]=S):S=e[32];let T;e[33]!==f||e[34]!==g||e[35]!==S?(T=t.jsxs("div",{className:"flex flex-col gap-2",children:[f,g,S]}),e[33]=f,e[34]=g,e[35]=S,e[36]=T):T=e[36];let y;e[37]!==T||e[38]!==h?(y=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:[h,T]}),e[37]=T,e[38]=h,e[39]=y):y=e[39];let P;return e[40]!==n||e[41]!==y?(P=t.jsx(lt,{...n,children:y}),e[40]=n,e[41]=y,e[42]=P):P=e[42],P}function Mt(s){const e=k.c(42),{providerId:n,promptId:l}=s,o=Q(),{org:i}=fe(),r=n||null;let c;e[0]!==i.id||e[1]!==i.slug||e[2]!==r?(c={connectionId:r,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=r,e[3]=c):c=e[3];const d=ge(c),a=Ze(n,"PROMPT",l,d),x=Oe(n,"PROMPT",d),h=x.update.isPending;let m;e[4]!==a?(m=a?{title:a.title,description:a.description??null,body:ue(a)}:void 0,e[4]=a,e[5]=m):m=e[5];let f;e[6]!==m?(f={values:m},e[6]=m,e[7]=f):f=e[7];const p=Ge(f);let g;e[8]!==p||e[9]!==a?(g=()=>{a&&p.reset({title:a.title,description:a.description??null,body:ue(a)})},e[8]=p,e[9]=a,e[10]=g):g=e[10];const b=g;let S;e[11]!==x.update||e[12]!==p||e[13]!==l?(S=p.handleSubmit(async C=>{const I=await x.update.mutateAsync({id:l,data:{title:C.title,description:C.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:C.body}}]}});p.reset({title:I.title,description:I.description??null,body:ue(I)})}),e[11]=x.update,e[12]=p,e[13]=l,e[14]=S):S=e[14];const T=S;if(!a){let C;e[15]!==o?(C=o("details.prompt.notFoundTitle"),e[15]=o,e[16]=C):C=e[16];let I;e[17]!==o?(I=o("details.prompt.notFoundDescription"),e[17]=o,e[18]=I):I=e[18];let R;return e[19]!==C||e[20]!==I?(R=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Fe,{title:C,description:I})}),e[19]=C,e[20]=I,e[21]=R):R=e[21],R}let y;e[22]!==a.title?(y=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:a.title}),e[22]=a.title,e[23]=y):y=e[23];let P;e[24]!==a.description?(P=a.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:a.description})]}):null,e[24]=a.description,e[25]=P):P=e[25];let w;e[26]!==y||e[27]!==P?(w=t.jsx(nt,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,P]})}),e[26]=y,e[27]=P,e[28]=w):w=e[28];let N;e[29]!==T?(N=()=>{T()},e[29]=T,e[30]=N):N=e[30];let A;e[31]!==p.formState.isDirty||e[32]!==h||e[33]!==b||e[34]!==N?(A=t.jsx(ot,{children:t.jsx(Rt,{onSave:N,onUndo:b,isDirty:p.formState.isDirty,isSaving:h})}),e[31]=p.formState.isDirty,e[32]=h,e[33]=b,e[34]=N,e[35]=A):A=e[35];let D;e[36]!==p?(D=t.jsx("div",{className:"h-full",children:t.jsx(zt,{form:p})}),e[36]=p,e[37]=D):D=e[37];let O;return e[38]!==A||e[39]!==D||e[40]!==w?(O=t.jsxs(je,{children:[w,A,D]}),e[38]=A,e[39]=D,e[40]=w,e[41]=O):O=e[41],O}function Lt(s){const e=k.c(10),{itemId:n}=s,l=Q();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=Ft(),e[0]=o):o=e[0];const i=o;if(!i){let c;e[1]!==l?(c=l("details.prompt.notFoundTitle"),e[1]=l,e[2]=c):c=e[2];let d;e[3]!==l?(d=l("details.prompt.missingConnectionDescription"),e[3]=l,e[4]=d):d=e[4];let a;return e[5]!==c||e[6]!==d?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Fe,{title:c,description:d})}),e[5]=c,e[6]=d,e[7]=a):a=e[7],a}let r;return e[8]!==n?(r=t.jsx(Ee,{children:t.jsx(E.Suspense,{fallback:null,children:t.jsx(Mt,{providerId:i,promptId:n})})}),e[8]=n,e[9]=r):r=e[9],r}function Le(s){const e=k.c(8);let n,l;e[0]!==s?({className:n,...l}=s,e[0]=s,e[1]=n,e[2]=l):(n=e[1],l=e[2]);let o;e[3]!==n?(o=W("min-w-0 overflow-hidden",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==l||e[6]!==o?(i=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:o,...l}),e[5]=l,e[6]=o,e[7]=i):i=e[7],i}function Be(s){const e=k.c(8);let n,l;e[0]!==s?({className:n,...l}=s,e[0]=s,e[1]=n,e[2]=l):(n=e[1],l=e[2]);let o;e[3]!==n?(o=W("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==l||e[6]!==o?(i=t.jsx("ol",{"data-slot":"breadcrumb-list",className:o,...l}),e[5]=l,e[6]=o,e[7]=i):i=e[7],i}function Y(s){const e=k.c(8);let n,l;e[0]!==s?({className:n,...l}=s,e[0]=s,e[1]=n,e[2]=l):(n=e[1],l=e[2]);let o;e[3]!==n?(o=W("inline-flex items-center gap-1.5 min-w-0",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==l||e[6]!==o?(i=t.jsx("li",{"data-slot":"breadcrumb-item",className:o,...l}),e[5]=l,e[6]=o,e[7]=i):i=e[7],i}function se(s){const e=k.c(10);let n,l,o;e[0]!==s?({asChild:n,className:l,...o}=s,e[0]=s,e[1]=n,e[2]=l,e[3]=o):(n=e[1],l=e[2],o=e[3]);const i=n?et:"a";let r;e[4]!==l?(r=W("hover:text-foreground transition-colors truncate",l),e[4]=l,e[5]=r):r=e[5];let c;return e[6]!==i||e[7]!==o||e[8]!==r?(c=t.jsx(i,{"data-slot":"breadcrumb-link",className:r,...o}),e[6]=i,e[7]=o,e[8]=r,e[9]=c):c=e[9],c}function Ue(s){const e=k.c(8);let n,l;e[0]!==s?({className:n,...l}=s,e[0]=s,e[1]=n,e[2]=l):(n=e[1],l=e[2]);let o;e[3]!==n?(o=W("text-foreground font-medium truncate",n),e[3]=n,e[4]=o):o=e[4];let i;return e[5]!==l||e[6]!==o?(i=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:o,...l}),e[5]=l,e[6]=o,e[7]=i):i=e[7],i}function le(s){const e=k.c(12);let n,l,o;e[0]!==s?({children:n,className:l,...o}=s,e[0]=s,e[1]=n,e[2]=l,e[3]=o):(n=e[1],l=e[2],o=e[3]);let i;e[4]!==l?(i=W("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",l),e[4]=l,e[5]=i):i=e[5];let r;e[6]!==n?(r=n??t.jsx(wt,{}),e[6]=n,e[7]=r):r=e[7];let c;return e[8]!==o||e[9]!==i||e[10]!==r?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:i,...o,children:r}),e[8]=o,e[9]=i,e[10]=r,e[11]=c):c=e[11],c}const Bt=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Ut(s){const e=k.c(12),{toolName:n,connectionId:l,siblings:o,onSelectInstance:i,onBack:r}=s,c=Q();let d;e[0]!==l?(d={connectionId:l},e[0]=l,e[1]=d):d=e[1];const a=It(d);if(!a.isAuthenticated){let m;return e[2]!==a.supportsOAuth||e[3]!==r||e[4]!==c?(m=t.jsx("div",{className:"flex h-full items-center justify-center",children:a.supportsOAuth?t.jsx(it,{onAuthenticate:()=>r(),buttonText:c("details.tool.goBackToAuthenticate")}):t.jsx(rt,{hasReadme:!1})}),e[2]=a.supportsOAuth,e[3]=r,e[4]=c,e[5]=m):m=e[5],m}const x=`${l}:${n}`;let h;return e[6]!==l||e[7]!==i||e[8]!==o||e[9]!==x||e[10]!==n?(h=t.jsx(Vt,{toolName:n,connectionId:l,siblings:o,onSelectInstance:i},x),e[6]=l,e[7]=i,e[8]=o,e[9]=x,e[10]=n,e[11]=h):h=e[11],h}function Vt({toolName:s,connectionId:e,siblings:n,onSelectInstance:l}){const o=Q(),{replayId:i}=tt({strict:!1}),r=(()=>{if(!i)return null;const u=`replay-${i}`,j=sessionStorage.getItem(u);if(!j)return null;sessionStorage.removeItem(u);try{return JSON.parse(j)}catch{return null}})(),c=(()=>{if(!r)return null;const u={};for(const[j,$]of Object.entries(r))$!==null&&typeof $=="object"?u[j]=JSON.stringify($,null,2):u[j]=$;return u})(),[d,a]=E.useState(c??{}),[x,h]=E.useState(r?JSON.stringify(r,null,2):"{}"),[m,f]=E.useState(null),[p,g]=E.useState(null),[b,S]=E.useState(null),[T,y]=E.useState(null),[P,w]=E.useState(!1),[N,A]=E.useState(null),{org:D}=fe(),O=ze(e),C=At(),I=Dt(),{openSidePanel:R}=Et(),U=`${e}:${s}`,z=ge({connectionId:e,orgId:D.id,orgSlug:D.slug}),V=Tt({client:z}),v=V.data?.tools?.find(u=>u.name===s),F=xt(v?._meta),J=u=>{if(!C)return;const j=kt(u.content);j.content.length>0&&(R("chat"),C.sendMessage({tiptapDoc:j}))},[M,L]=E.useState("json"),[q,X]=E.useState(!1);F&&!q&&(L("ui"),X(!0));const _=v?.inputSchema?.properties,be=_?Object.keys(_):[],Z=be.length>0,G={};if(Z&&v?.inputSchema?.properties)for(const u of be)G[u]=v.inputSchema.required?.includes(u)?"":void 0;const ne=u=>Object.prototype.hasOwnProperty.call(d,u),Ve=async()=>{w(!0),y(null),f(null),g(null),S(null),A(null);const u=performance.now();try{if(!z)throw new Error("MCP client is not available");const j=Z?{...G,...d}:(()=>{const B=x.trim();if(!B)return{};const H=JSON.parse(B);if(H&&typeof H=="object")return H;throw new Error("Raw JSON input must be an object.")})();Z&&v?.inputSchema?.properties&&Object.entries(v.inputSchema.properties).forEach(([B,H])=>{if((H.type==="object"||H.type==="array")&&typeof j[B]=="string")try{j[B]=JSON.parse(j[B])}catch{}else if((H.type==="number"||H.type==="integer")&&typeof j[B]=="string"&&j[B]!==""){const Se=Number(j[B]);Number.isNaN(Se)||(j[B]=Se)}});const $=await z.callTool({name:s,arguments:j}),ee=$.structuredContent??$,We=performance.now(),Qe=Math.round(We-u);f(ee),g($),S(j);const Xe=JSON.stringify(ee),ve=new TextEncoder().encode(Xe).length;A({duration:`${Qe}ms`,bytes:`${ve} bytes`,tokens:`~${Math.ceil(ve/4)} tokens`,cost:"$0.0000"})}catch(j){const $=j instanceof Error?j.message:String(j);y($||"Unknown error occurred");const ee=performance.now();A({duration:`${Math.round(ee-u)}ms`})}finally{w(!1)}},ie=(u,j)=>{a($=>({...$,[u]:j}))},_e=()=>{f(null),g(null),S(null),y(null),A(null)},Je=v?.name??Bt(s),qe=t.jsx(Le,{children:t.jsxs(Be,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections",params:{org:D.slug},children:o("details.tool.connections")})})}),t.jsx(le,{}),O&&t.jsxs(t.Fragment,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections/$appSlug",params:{org:D.slug,appSlug:Ct(O)},search:{tab:"tools"},children:O.title})})}),t.jsx(le,{})]}),t.jsx(Y,{children:t.jsx(Ue,{children:Je})})]})}),Ne=n.length>1&&t.jsxs(Ce,{value:e,onValueChange:l,children:[t.jsx(Ie,{className:"h-8 w-auto min-w-[200px]",children:t.jsx($e,{})}),t.jsx(Te,{children:n.map(u=>t.jsx(me,{value:u.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(De,{icon:u.icon,name:u.title,size:"xs",className:"shrink-0"}),u.title]})},u.id))})]}),He=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:o("details.tool.parameters")}),v?.inputSchema?.required&&v.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-destructive",children:"*"})," ",o("details.tool.required")]})]}),t.jsx("div",{className:"space-y-4",children:Z&&v?.inputSchema?.properties?Object.entries(v.inputSchema.properties).map(([u,j])=>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:[u,v.inputSchema?.required?.includes(u)&&t.jsx("span",{className:"text-destructive text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:j.type})]}),j.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:j.description}),j.type==="object"||j.type==="array"?t.jsx(xe,{className:"font-mono text-xs",value:ne(u)?d[u]??"":G[u]??"",onChange:$=>ie(u,$.target.value),placeholder:o("details.tool.enterAsJson",{key:u}),rows:3}):j.type==="boolean"?t.jsxs(Ce,{value:ne(u)?String(d[u]??""):"",onValueChange:$=>ie(u,$==="true"),children:[t.jsx(Ie,{children:t.jsx($e,{placeholder:o("details.tool.selectTrueOrFalse")})}),t.jsxs(Te,{children:[t.jsx(me,{value:"true",children:"true"}),t.jsx(me,{value:"false",children:"false"})]})]}):t.jsx(pe,{value:ne(u)?d[u]??"":G[u]??"",onChange:$=>ie(u,$.target.value),placeholder:o("details.tool.enter",{key:u})})]},u)):v?.inputSchema&&!Z?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:o("details.tool.rawJsonInput")}),t.jsx(xe,{className:"font-mono text-xs min-h-[120px]",value:x,onChange:u=>h(u.target.value),placeholder:o("details.tool.rawJsonExample")})]}):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:o("details.tool.noParametersRequired")})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:P?t.jsxs(K,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:_e,children:[t.jsx(dt,{className:"h-3.5 w-3.5"}),o("details.tool.cancel")]}):t.jsxs(K,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:Ve,children:[t.jsx(yt,{className:"h-3.5 w-3.5 fill-current"}),o("details.tool.executeTool")]})})]}),Ke=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:o("details.tool.result")}),t.jsxs("div",{className:"flex items-center gap-3",children:[N&&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(vt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:N.duration})]}),N.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(mt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:N.tokens})]}),N.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ut,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:N.bytes})]}),N.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:N.cost})})]}),F&&t.jsx(bt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(Pe,{children:[t.jsx(ke,{asChild:!0,children:t.jsx(K,{size:"icon",variant:M==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>L("ui"),children:t.jsx(pt,{size:14})})}),t.jsx(Ae,{children:o("details.tool.interactiveView")})]}),t.jsxs(Pe,{children:[t.jsx(ke,{asChild:!0,children:t.jsx(K,{size:"icon",variant:M==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>L("json"),children:t.jsx(ye,{size:14})})}),t.jsx(Ae,{children:o("details.tool.jsonView")})]})]})})]})]}),T&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(ht,{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(Nt,{className:"h-4 w-4"}),t.jsx(gt,{className:"mb-0",children:o("details.tool.executionFailed")})]}),t.jsx(jt,{className:"text-xs text-destructive",children:T})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:F&&M==="ui"&&z?t.jsx(E.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:o("details.tool.loadingApp")})]})}),children:t.jsx(ft,{resourceURI:F,toolInfo:v?{tool:v}:void 0,toolInput:b??void 0,toolResult:p??void 0,displayMode:"fullscreen",minHeight:we.view.minHeight,maxHeight:we.view.maxHeight,client:z,onMessage:J,onUpdateModelContext:u=>I?.setAppContext(U,u),onTeardown:()=>I?.clearAppContext(U),className:"h-full"})}):m?t.jsxs(t.Fragment,{children:[t.jsx(Pt,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(K,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(m,null,2)),st.success(o("details.tool.copiedToClipboard"))},children:t.jsx(St,{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(ye,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:o("details.tool.runToolToSeeResults")})]})})]});return t.jsx(je,{breadcrumb:qe,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(De,{icon:O?.icon||null,name:O?.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:[V.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-success animate-pulse shrink-0"}):V.isLoading?t.jsx(oe,{size:10,className:"animate-spin text-warning shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-destructive shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:V.isSuccess?"ready":V.isLoading?"connecting":"error"})]}),t.jsx($t,{annotations:v?.annotations,_meta:v?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:Ne})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:v?.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:o("details.tool.instance")}),Ne]}),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:He}),Ke]})})]})})}function _t(s){const e=k.c(20),{itemId:n,siblings:l,onBack:o}=s,i=Q(),[r,c]=E.useState(l[0]?.id??"");let d;e[0]!==r||e[1]!==l?(d=l.find(f=>f.id===r)?.id??l[0]?.id??"",e[0]=r,e[1]=l,e[2]=d):d=e[2];const a=d;if(!ze(a||void 0)||!a){let f;e[3]!==i?(f=i("details.tool.connectionNotFound"),e[3]=i,e[4]=f):f=e[4];let p;e[5]!==f?(p=t.jsx("h3",{className:"text-lg font-semibold",children:f}),e[5]=f,e[6]=p):p=e[6];let g;e[7]!==i?(g=i("details.tool.connectionNotFoundMessage"),e[7]=i,e[8]=g):g=e[8];let b;e[9]!==g?(b=t.jsx("p",{className:"text-sm text-muted-foreground",children:g}),e[9]=g,e[10]=b):b=e[10];let S;return e[11]!==p||e[12]!==b?(S=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:[p,b]})}),e[11]=p,e[12]=b,e[13]=S):S=e[13],S}let h;e[14]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(oe,{size:32,className:"animate-spin text-muted-foreground"})}),e[14]=h):h=e[14];let m;return e[15]!==a||e[16]!==o||e[17]!==l||e[18]!==n?(m=t.jsx(E.Suspense,{fallback:h,children:t.jsx(Ut,{toolName:n,connectionId:a,siblings:l,onSelectInstance:c,onBack:o})}),e[15]=a,e[16]=o,e[17]=l,e[18]=n,e[19]=m):m=e[19],m}function Jt(s){const e=k.c(21),{icon:n,illustration:l,title:o,description:i,buttonProps:r,buttonComponent:c,className:d,children:a}=s;let x;e[0]!==d?(x=W("flex flex-col items-center justify-center py-16 text-center",d),e[0]=d,e[1]=x):x=e[1];let h;e[2]!==n||e[3]!==l?(h=l?t.jsx("div",{className:"mb-4 text-muted-foreground/50",children:l}):n?t.jsx("div",{className:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-muted/50 text-muted-foreground",children:n}):null,e[2]=n,e[3]=l,e[4]=h):h=e[4];let m;e[5]!==o?(m=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:o}),e[5]=o,e[6]=m):m=e[6];let f;e[7]!==i?(f=i&&t.jsx("div",{className:"text-sm text-muted-foreground",children:i}),e[7]=i,e[8]=f):f=e[8];let p;e[9]!==m||e[10]!==f?(p=t.jsxs("div",{className:"flex flex-col items-center gap-1 max-w-sm",children:[m,f]}),e[9]=m,e[10]=f,e[11]=p):p=e[11];let g;e[12]!==c||e[13]!==r?(g=(c??r)&&t.jsx("div",{className:"mt-4",children:c??(r&&t.jsx(K,{size:"sm",className:W(r?.className),...r}))}),e[12]=c,e[13]=r,e[14]=g):g=e[14];let b;return e[15]!==a||e[16]!==x||e[17]!==h||e[18]!==p||e[19]!==g?(b=t.jsxs("div",{className:x,children:[h,p,g,a]}),e[15]=a,e[16]=x,e[17]=h,e[18]=p,e[19]=g,e[20]=b):b=e[20],b}const qt={prompt:Lt};function Ht(){const s=k.c(9),e=Re();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 l=he(n),o=decodeURIComponent(l.itemId);let i;s[1]!==l.appSlug?(i={slug:l.appSlug},s[1]=l.appSlug,s[2]=i):i=s[2];const r=Me(i);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const d=c,a=Kt;let x;return s[5]!==d||s[6]!==o||s[7]!==r?(x=t.jsx(_t,{itemId:o,siblings:r,onBack:d,onUpdate:a}),s[5]=d,s[6]=o,s[7]=r,s[8]=x):x=s[8],x}async function Kt(s){return Promise.resolve()}function Wt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=k.c(52),e=Re();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 l=he(n),o=Q(),i=decodeURIComponent(l.collectionName),r=decodeURIComponent(l.itemId);let c;s[1]!==e.history?(c=()=>{e.history.back()},s[1]=e.history,s[2]=c):c=s[2];const d=c,{org:a}=fe();let x;s[3]!==l.appSlug?(x={slug:l.appSlug},s[3]=l.appSlug,s[4]=x):x=s[4];const m=Me(x)[0]??null,f=m?.id??"",p=f||"no-connection",g=f??null;let b;s[5]!==a.id||s[6]!==a.slug||s[7]!==g?(b={connectionId:g,orgId:a.id,orgSlug:a.slug},s[5]=a.id,s[6]=a.slug,s[7]=g,s[8]=b):b=s[8];const S=ge(b),T=Oe(p,i,S);let y;s[9]!==T||s[10]!==r?(y=async _=>{r&&await T.update.mutateAsync({id:r,data:_})},s[9]=T,s[10]=r,s[11]=y):y=s[11];const P=y;let w;s[12]!==i?(w=i?.toLowerCase(),s[12]=i,s[13]=w):w=s[13];const N=w,A=N&&qt[N];let D;s[14]!==i?(D=Wt(i),s[14]=i,s[15]=D):D=s[15];const O=D;let C;s[16]!==a.slug?(C=t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections",params:{org:a.slug},children:"Connections"})})}),s[16]=a.slug,s[17]=C):C=s[17];let I;s[18]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(le,{}),s[18]=I):I=s[18];let R;s[19]!==i||s[20]!==m||s[21]!==a.slug||s[22]!==l.appSlug?(R=m&&t.jsxs(t.Fragment,{children:[t.jsx(Y,{children:t.jsx(se,{asChild:!0,children:t.jsx(te,{to:"/$org/settings/connections/$appSlug",params:{org:a.slug,appSlug:l.appSlug},search:{tab:i},children:m.title})})}),t.jsx(le,{})]}),s[19]=i,s[20]=m,s[21]=a.slug,s[22]=l.appSlug,s[23]=R):R=s[23];let U;s[24]!==O?(U=t.jsx(Y,{children:t.jsx(Ue,{children:O})}),s[24]=O,s[25]=U):U=s[25];let z;s[26]!==R||s[27]!==U||s[28]!==C?(z=t.jsx(Le,{children:t.jsxs(Be,{children:[C,I,R,U]})}),s[26]=R,s[27]=U,s[28]=C,s[29]=z):z=s[29];const V=z;if(A){let _;return s[30]!==A||s[31]!==d||s[32]!==P||s[33]!==r?(_=t.jsx(A,{itemId:r,onBack:d,onUpdate:P}),s[30]=A,s[31]=d,s[32]=P,s[33]=r,s[34]=_):_=s[34],_}let v;s[35]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx(Ot,{size:36,className:"text-muted-foreground"}),s[35]=v):v=s[35];let F;s[36]!==o?(F=o("orgs.collectionDetail.noComponentDefinedTitle"),s[36]=o,s[37]=F):F=s[37];let J;s[38]!==o?(J=o("orgs.collectionDetail.noComponentDefinedDescription"),s[38]=o,s[39]=J):J=s[39];let M;s[40]!==o?(M=o("orgs.collectionDetail.goBackButton"),s[40]=o,s[41]=M):M=s[41];let L;s[42]!==d||s[43]!==M?(L={onClick:d,children:M},s[42]=d,s[43]=M,s[44]=L):L=s[44];let q;s[45]!==F||s[46]!==J||s[47]!==L?(q=t.jsx(Jt,{icon:v,title:F,description:J,buttonProps:L}),s[45]=F,s[46]=J,s[47]=L,s[48]=q):q=s[48];let X;return s[49]!==V||s[50]!==q?(X=t.jsx(je,{breadcrumb:V,children:q}),s[49]=V,s[50]=q,s[51]=X):X=s[51],X}function Xt(){const s=k.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=he(e);if(decodeURIComponent(n.collectionName)==="tools"){let r;return s[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(Ht,{}),s[1]=r):r=s[1],r}let i;return s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Qt,{}),s[2]=i):i=s[2],i}function Jl(){const s=k.c(7),e=Q();let n;s[0]!==e?(n=e("orgs.collectionDetail.loadingAriaLabel"),s[0]=e,s[1]=n):n=s[1];let l;s[2]!==n?(l=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(oe,{size:32,className:"animate-spin text-muted-foreground","aria-label":n})}),s[2]=n,s[3]=l):l=s[3];let o;s[4]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(Xt,{}),s[4]=o):o=s[4];let i;return s[5]!==l?(i=t.jsx(Ee,{children:t.jsx(E.Suspense,{fallback:l,children:o})}),s[5]=l,s[6]=i):i=s[6],i}export{Jl as default};
@@ -1 +0,0 @@
1
- import{c as E,b as $,j as i,m as Le,p as se,B as ve,u as Ge,q as it,r as B,a as Te,d as ot,s as st,e as Ye,v as Se,w as Je,Q as nt,E as lt,K as Fe,x as $e,N as at}from"./index-Dk9RGAqb.js";import{L as ct,s as ke,S as He,i as mt,n as Ie,C as Xe,p as Re}from"./self-tool-result-D85DyOHM.js";import{A as dt}from"./auth-entry-DoyULuRf.js";import{A as ut}from"./auth-split-layout-C2XKKVOK.js";import{O as Be}from"./organization-choice-D1ddIq9q.js";import{I as gt}from"./input-C-gHIQip.js";import{D as ft,a as We,b as pt,c as ht}from"./dropdown-menu-CSgtqrA3.js";import{S as bt,u as xt,W as yt,g as jt,a as Ct}from"./use-mcp-client-Bzvvd0Df.js";import{i as Ot}from"./ArrowRight-B-wHAJWT.js";import{i as vt}from"./ArrowUpRight-BWyzrLQV.js";import"./integration-icon-DBUjxWMb.js";import"./Tool02-DPXeBg9E.js";import"./agent-icon-E6ioveGx.js";import"./AlertCircle-1e3-NcEA.js";import"./Tool01-B0759esA.js";import"./ArrowUp-DI1fyC1G.js";import"./Settings02-BIGi-T7s.js";import"./TrendUp01-CYCVS1zr.js";import"./ZapSquare-DGe1cTc7.js";import"./ZoomOut-B-F-8cp0.js";import"./Users03-3lwc9liE.js";import"./CheckCircle-Dh-3VdHB.js";import"./Check-LKA0FKR0.js";import"./ChevronDown-B3fDqERa.js";import"./ChevronRight-Dkp8mDOd.js";import"./ChevronUp-Cm7VcWLZ.js";import"./DotsVertical-DKanPfz6.js";import"./Stars02-DpsxkqJO.js";import"./Copy01-uQh3Q5Fv.js";import"./Globe01-CEh6-y49.js";import"./Eye-SCLKEZSh.js";import"./FilterLines-13dE_TWB.js";import"./Star01-lWHLfmir.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./Key01-CgioJ7nW.js";import"./LayoutLeft-Yz5NzG-w.js";import"./XCircle-B3aYrCCW.js";import"./LinkExternal01-Di_tOfr7.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./Play-CVGtm9ao.js";import"./Plus-CLG5QKCr.js";import"./SearchLg-CkXJjhdf.js";import"./SearchMd-DBj7HhoW.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Trash01-CWIa_mDx.js";import"./Upload01-CPD95nN4.js";import"./User01-NxrNjn_h.js";import"./Users01-DvtVVxdG.js";import"./XClose-CW0R6bEe.js";import"./X-BYXAQs6v.js";import"./Zap-CrMVm5NK.js";import"./dialog-CzDwjrNV.js";import"./tooltip-xp77jFs4.js";import"./companions-core-Bua_v2zd.js";import"./extract-connection-data-ChU9AlhE.js";import"./metadata-dUsYcpuu.js";import"./github-repo-scope-DjMZbiKa.js";import"./form-CJlgALpE.js";import"./label-D9aEMZqo.js";import"./use-debounced-value-D9jV_d1U.js";import"./provision-repo-scoped-github-connection-2iDn-wQ1.js";import"./useQueries-b2s80Vy2.js";import"./authenticate-and-persist-oauth-iHWUIj8u.js";import"./mcp-oauth-Br5ozXBx.js";import"./auth-C4POVeVe.js";import"./retry-CErkP7V6.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./avatar-BQF1QGjq.js";const qe={"pt-BR":"https://decocms.com/agendar",en:"https://www.decocms.com/en/schedule"},Ve=["https://decoims.com/image?src=decocms%2Fb07a1c19-0cd6-49c8-b326-86055ee78605%2Fauthor-1763423987973-baby.jpeg&quality=original&fit=cover&width=200&height=200","https://decoims.com/decocms/07c2daf4-a3c2-485e-a1a8-341585a06e3b/cecilia.png","https://decoims.com/decocms/48013ca2-3277-464b-b0f1-dd5f1f08d986/tavano.png"],St="var(--brand-green-dark)";function Me({siteUrl:t,email:e,locale:o}){const s=(o&&qe[o])??qe["pt-BR"]??"https://decocms.com/agendar",r=new URL(s);return t&&r.searchParams.set("siteUrl",t),e&&r.searchParams.set("email",e),r.toString()}function _t(t){const e=E.c(15),{href:o,size:s,className:r,orgId:a}=t,l=s===void 0?"lg":s,n=$();let c;e[0]!==r?(c=Le("w-full",r),e[0]=r,e[1]=c):c=e[1];let m;e[2]!==a?(m=()=>se("commerce_onboarding_meeting_cta_clicked",{placement:"visual_card",organization_id:a}),e[2]=a,e[3]=m):m=e[3];let u;e[4]!==n?(u=n("routes.commerceOnboarding.scheduleMeeting.scheduleButton"),e[4]=n,e[5]=u):u=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(vt,{size:16}),e[6]=d):d=e[6];let g;e[7]!==o||e[8]!==m||e[9]!==u?(g=i.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",onClick:m,children:[u,d]}),e[7]=o,e[8]=m,e[9]=u,e[10]=g):g=e[10];let p;return e[11]!==l||e[12]!==c||e[13]!==g?(p=i.jsx(ve,{asChild:!0,variant:"outline",size:l,className:c,children:g}),e[11]=l,e[12]=c,e[13]=g,e[14]=p):p=e[14],p}function wt(t){const e=E.c(13),{size:o}=t,s=o===void 0?72:o,r=$();let a;e[0]!==r?(a=r("routes.commerceOnboarding.scheduleMeeting.expertAlt"),e[0]=r,e[1]=a):a=e[1];const l=a;let n;e[2]!==s?(n=Math.round(s*.3),e[2]=s,e[3]=n):n=e[3];const c=n;let m;e[4]!==s?(m={height:s},e[4]=s,e[5]=m):m=e[5];let u;e[6]!==l||e[7]!==c||e[8]!==s?(u=Ve.map((g,p)=>i.jsxs("div",{className:"relative shrink-0",style:{width:s,height:s,marginLeft:p===0?0:-c,zIndex:Ve.length-p},children:[i.jsx("div",{className:"h-full w-full overflow-hidden rounded-full border-4 border-card bg-muted",children:i.jsx("img",{src:g,alt:l,className:"h-full w-full object-cover",loading:"lazy"})}),p===0&&i.jsxs("span",{className:"absolute bottom-1.5 right-1.5 flex h-3.5 w-3.5",children:[i.jsx("span",{className:"absolute inline-flex h-full w-full rounded-full bg-success opacity-60 motion-safe:animate-ping","aria-hidden":!0}),i.jsx("span",{className:"relative inline-flex h-3.5 w-3.5 rounded-full border-2 border-card bg-success"})]})]},g)),e[6]=l,e[7]=c,e[8]=s,e[9]=u):u=e[9];let d;return e[10]!==m||e[11]!==u?(d=i.jsx("div",{className:"flex items-end",style:m,children:u}),e[10]=m,e[11]=u,e[12]=d):d=e[12],d}function De(t){const e=E.c(19),{href:o,orgId:s}=t,r=$();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=i.jsx("div",{className:"h-20",style:{backgroundColor:St}}),e[0]=a):a=e[0];let l;e[1]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx("div",{className:"-mt-9 mb-4",children:i.jsx(wt,{})}),e[1]=l):l=e[1];let n;e[2]!==r?(n=r("routes.commerceOnboarding.scheduleMeeting.headline"),e[2]=r,e[3]=n):n=e[3];let c;e[4]!==n?(c=i.jsx("h2",{className:"text-lg font-medium leading-6 text-foreground",children:n}),e[4]=n,e[5]=c):c=e[5];let m;e[6]!==r?(m=r("routes.commerceOnboarding.scheduleMeeting.body"),e[6]=r,e[7]=m):m=e[7];let u;e[8]!==m?(u=i.jsx("p",{className:"text-sm leading-5 text-muted-foreground",children:m}),e[8]=m,e[9]=u):u=e[9];let d;e[10]!==c||e[11]!==u?(d=i.jsxs("div",{className:"grid gap-1.5",children:[c,u]}),e[10]=c,e[11]=u,e[12]=d):d=e[12];let g;e[13]!==o||e[14]!==s?(g=i.jsx(_t,{href:o,size:"lg",className:"mt-6",orgId:s}),e[13]=o,e[14]=s,e[15]=g):g=e[15];let p;return e[16]!==d||e[17]!==g?(p=i.jsx("div",{className:"relative flex h-full w-full items-center justify-center p-10",children:i.jsxs("div",{className:"w-full max-w-[440px] overflow-hidden rounded-3xl border border-border bg-card card-shadow",children:[a,i.jsxs("div",{className:"px-8 pb-8",children:[l,d,g]})]})}),e[16]=d,e[17]=g,e[18]=p):p=e[18],p}function Ze(t){const e=E.c(10),{host:o}=t,s=`https://www.google.com/s2/favicons?domain=${o}&sz=128`;let r,a,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-7 w-7 dark:hidden"}),a=i.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-7 w-7 hidden dark:block"}),l=i.jsx("div",{className:"h-6 w-px rotate-12 bg-border","aria-hidden":"true"}),e[0]=r,e[1]=a,e[2]=l):(r=e[0],a=e[1],l=e[2]);let n;e[3]!==s?(n=i.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-border bg-white",children:i.jsx("img",{src:s,alt:"",className:"h-5 w-5",loading:"lazy"})}),e[3]=s,e[4]=n):n=e[4];let c;e[5]!==o?(c=i.jsx("span",{className:"text-lg font-medium text-foreground",children:o}),e[5]=o,e[6]=c):c=e[6];let m;return e[7]!==n||e[8]!==c?(m=i.jsxs("div",{className:"flex items-center gap-3",children:[r,a,l,n,c]}),e[7]=n,e[8]=c,e[9]=m):m=e[9],m}function Ae(t){const e=E.c(5),{variant:o}=t,s=$();let r;e[0]!==s||e[1]!==o?(r=s(o==="workspace"?"routes.commerceOnboarding.loading.preparingWorkspace":"routes.commerceOnboarding.loading.preparing"),e[0]=s,e[1]=o,e[2]=r):r=e[2];const a=r;let l;return e[3]!==a?(l=i.jsx("div",{className:"flex justify-center py-4",role:"status","aria-live":"polite",children:i.jsx(ct,{label:a,className:"text-muted-foreground"})}),e[3]=a,e[4]=l):l=e[4],l}function ci(){const t=E.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(It,{}),t[0]=e):e=t[0],e}const et=B.createContext(null),tt=()=>B.useContext(et);function Nt(){const t=E.c(22),[e,o]=Se(),s=e.language==="pt-BR"?"PT-BR":"EN";let r;t[0]!==s?(r=i.jsx(ft,{asChild:!0,children:i.jsx("button",{className:"text-sm font-medium text-foreground/70 hover:text-foreground transition-colors",type:"button",children:s})}),t[0]=s,t[1]=r):r=t[1];let a;t[2]!==o?(a=()=>{o(Ut)},t[2]=o,t[3]=a):a=t[3];const l=e.language==="en"&&"bg-accent";let n;t[4]!==l?(n=Le(l),t[4]=l,t[5]=n):n=t[5];let c;t[6]!==a||t[7]!==n?(c=i.jsx(We,{onClick:a,className:n,children:"English"}),t[6]=a,t[7]=n,t[8]=c):c=t[8];let m;t[9]!==o?(m=()=>{o(Et)},t[9]=o,t[10]=m):m=t[10];const u=e.language==="pt-BR"&&"bg-accent";let d;t[11]!==u?(d=Le(u),t[11]=u,t[12]=d):d=t[12];let g;t[13]!==m||t[14]!==d?(g=i.jsx(We,{onClick:m,className:d,children:"Português (Brasil)"}),t[13]=m,t[14]=d,t[15]=g):g=t[15];let p;t[16]!==c||t[17]!==g?(p=i.jsxs(pt,{align:"end",children:[c,g]}),t[16]=c,t[17]=g,t[18]=p):p=t[18];let v;return t[19]!==r||t[20]!==p?(v=i.jsxs(ht,{children:[r,p]}),t[19]=r,t[20]=p,t[21]=v):v=t[21],v}function Et(t){return{...t,language:"pt-BR"}}function Ut(t){return{...t,language:"en"}}function T(t){const e=E.c(17);let o,s,r;e[0]!==t?({visual:r,children:o,...s}=t,e[0]=t,e[1]=o,e[2]=s,e[3]=r):(o=e[1],s=e[2],r=e[3]);let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/commerce-onboarding"},e[4]=a):a=e[4];const l=Ge(a),{data:n}=Te.useSession(),[c]=Se(),m=n?.user?.email;let u;e[5]!==c.language||e[6]!==l.siteUrl||e[7]!==m?(u=Me({siteUrl:l.siteUrl,email:m,locale:c.language}),e[5]=c.language,e[6]=l.siteUrl,e[7]=m,e[8]=u):u=e[8];const d=u;let g;e[9]!==d||e[10]!==r?(g=r??i.jsx(De,{href:d}),e[9]=d,e[10]=r,e[11]=g):g=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=i.jsxs("div",{className:"flex justify-between items-start mb-8",children:[i.jsx("div",{}),i.jsx(Nt,{})]}),e[12]=p):p=e[12];let v;return e[13]!==o||e[14]!==s||e[15]!==g?(v=i.jsxs(ut,{...s,visual:g,children:[p,o]}),e[13]=o,e[14]=s,e[15]=g,e[16]=v):v=e[16],v}function Pt(t){return{signUpFailed:t("routes.commerceOnboarding.authCopy.signUpFailed"),signInFailed:t("routes.commerceOnboarding.authCopy.signInFailed"),authenticationFailed:t("routes.commerceOnboarding.authCopy.authenticationFailed"),resetEmailFailed:t("routes.commerceOnboarding.authCopy.resetEmailFailed"),otpSendFailed:t("routes.commerceOnboarding.authCopy.otpSendFailed"),invalidCode:t("routes.commerceOnboarding.authCopy.invalidCode"),invalidEmail:t("routes.commerceOnboarding.authCopy.invalidEmail"),invalidEmailOrPassword:t("routes.commerceOnboarding.authCopy.invalidEmailOrPassword"),accountExists:t("routes.commerceOnboarding.authCopy.accountExists"),networkError:t("routes.commerceOnboarding.authCopy.networkError"),tooManyAttempts:t("routes.commerceOnboarding.authCopy.tooManyAttempts"),invalidOrExpiredCode:t("routes.commerceOnboarding.authCopy.invalidOrExpiredCode"),genericError:t("routes.commerceOnboarding.authCopy.genericError"),resetPasswordTitle:t("routes.commerceOnboarding.authCopy.resetPasswordTitle"),verificationCodeTitle:t("routes.commerceOnboarding.authCopy.verificationCodeTitle"),welcomeTitle:t("routes.commerceOnboarding.authCopy.welcomeTitle"),resetPasswordSubtitle:t("routes.commerceOnboarding.authCopy.resetPasswordSubtitle"),codeSentTo:e=>t("routes.commerceOnboarding.authCopy.codeSentTo",{email:e}),defaultSubtitle:t("routes.commerceOnboarding.authCopy.defaultSubtitle"),resetEmailSent:t("routes.commerceOnboarding.authCopy.resetEmailSent"),continueWith:e=>t("routes.commerceOnboarding.authCopy.continueWith",{provider:e}),divider:t("routes.commerceOnboarding.authCopy.divider"),emailLabel:t("routes.commerceOnboarding.authCopy.emailLabel"),emailPlaceholder:t("routes.commerceOnboarding.authCopy.emailPlaceholder"),sending:t("routes.commerceOnboarding.authCopy.sending"),sendCode:t("routes.commerceOnboarding.authCopy.sendCode"),verificationCodeLabel:t("routes.commerceOnboarding.authCopy.verificationCodeLabel"),enterCodePlaceholder:t("routes.commerceOnboarding.authCopy.enterCodePlaceholder"),verifying:t("routes.commerceOnboarding.authCopy.verifying"),verify:t("routes.commerceOnboarding.authCopy.verify"),useDifferentEmail:t("routes.commerceOnboarding.authCopy.useDifferentEmail"),sendResetLink:t("routes.commerceOnboarding.authCopy.sendResetLink"),nameLabel:t("routes.commerceOnboarding.authCopy.nameLabel"),namePlaceholder:t("routes.commerceOnboarding.authCopy.namePlaceholder"),passwordLabel:t("routes.commerceOnboarding.authCopy.passwordLabel"),forgotPassword:t("routes.commerceOnboarding.authCopy.forgotPassword"),creatingAccount:t("routes.commerceOnboarding.authCopy.creatingAccount"),signingIn:t("routes.commerceOnboarding.authCopy.signingIn"),continue:t("routes.commerceOnboarding.authCopy.continue"),backToSignIn:t("routes.commerceOnboarding.authCopy.backToSignIn"),signInWithPassword:t("routes.commerceOnboarding.authCopy.signInWithPassword"),alreadyHaveAccount:t("routes.commerceOnboarding.authCopy.alreadyHaveAccount"),dontHaveAccount:t("routes.commerceOnboarding.authCopy.dontHaveAccount"),signIn:t("routes.commerceOnboarding.authCopy.signIn"),signUp:t("routes.commerceOnboarding.authCopy.signUp"),signInWithEmailCode:t("routes.commerceOnboarding.authCopy.signInWithEmailCode")}}function Ke(t,e){switch(e){case"Enter a website URL.":return t("routes.commerceOnboarding.siteUrl.enterUrl");case"Use an HTTP or HTTPS website URL.":return t("routes.commerceOnboarding.siteUrl.useHttpOrHttps");case"Enter a valid website URL.":return t("routes.commerceOnboarding.siteUrl.enterValidUrl");case"__configurationFailed":return t("routes.commerceOnboarding.configurationFailed");default:return e}}let Qe=!1;function It(){const t=Ge({from:"/commerce-onboarding"}),{org:e,siteUrl:o}=t,s=ke(o);return!Qe&&it()&&(Qe=!0,se("commerce_onboarding_viewed",{site_url:o,domain:s??void 0,...s?{$set:{last_scanned_domain:s}}:{}})),i.jsx(et.Provider,{value:s,children:i.jsx(Rt,{requestedOrgSlug:e,siteUrl:o})})}function Rt(t){const e=E.c(14),{requestedOrgSlug:o,siteUrl:s}=t,r=$(),{data:a,isPending:l}=Te.useSession(),n=tt();if(l){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(T,{children:i.jsx(Ae,{variant:"generic"})}),e[0]=m):m=e[0],m}if(!a){const m=typeof window>"u"?"/commerce-onboarding":`${window.location.pathname}${window.location.search}`;let u;e[1]!==r?(u=r("routes.commerceOnboarding.unlockDiagnostic"),e[1]=r,e[2]=u):u=e[2];let d;e[3]!==n?(d=n?i.jsx(Ze,{host:n}):void 0,e[3]=n,e[4]=d):d=e[4];let g;e[5]!==r?(g=Pt(r),e[5]=r,e[6]=g):g=e[6];let p;return e[7]!==u||e[8]!==d||e[9]!==g?(p=i.jsx(T,{children:i.jsx(dt,{callbackUrl:m,allowAutoLogin:!1,title:u,subtitle:null,brand:d,copy:g})}),e[7]=u,e[8]=d,e[9]=g,e[10]=p):p=e[10],p}let c;return e[11]!==o||e[12]!==s?(c=i.jsx(zt,{requestedOrgSlug:o,siteUrl:s}),e[11]=o,e[12]=s,e[13]=c):c=e[13],c}function zt(t){const e=E.c(95),{requestedOrgSlug:o,siteUrl:s}=t,r=$(),a=ot(),l=st(),[n,c]=B.useState(null),[m,u]=B.useState(null),d=l.data?.map(kt)??[];let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g={mutationFn:Lt,retry:!1,onSuccess:f=>{u(f)}},e[0]=g):g=e[0];const p=Ye(g);if(l.isPending){let f;return e[1]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(T,{children:i.jsx(Ae,{variant:"workspace"})}),e[1]=f):f=e[1],f}if(l.error){let f;e[2]!==r?(f=r("routes.commerceOnboarding.couldNotLoadOrgs"),e[2]=r,e[3]=f):f=e[3];let h;e[4]!==r?(h=r("routes.commerceOnboarding.retryToConfigureCommerce"),e[4]=r,e[5]=h):h=e[5];let x;e[6]!==r?(x=r("routes.commerceOnboarding.retryAgain"),e[6]=r,e[7]=x):x=e[7];let j;e[8]!==l?(j=()=>l.refetch(),e[8]=l,e[9]=j):j=e[9];let O;return e[10]!==f||e[11]!==h||e[12]!==x||e[13]!==j?(O=i.jsx(Ce,{title:f,description:h,actionLabel:x,onRetry:j}),e[10]=f,e[11]=h,e[12]=x,e[13]=j,e[14]=O):O=e[14],O}const v=o?d.find(f=>f.slug===o):null;if(v){let f;return e[15]!==v||e[16]!==s?(f=i.jsx(je,{org:v,initialSiteUrl:s}),e[15]=v,e[16]=s,e[17]=f):f=e[17],f}if(o){let f;e[18]!==r?(f=r("routes.commerceOnboarding.orgNotFound"),e[18]=r,e[19]=f):f=e[19];let h;e[20]!==r?(h=r("routes.commerceOnboarding.couldNotFindOrg"),e[20]=r,e[21]=h):h=e[21];let x;e[22]!==r?(x=r("routes.commerceOnboarding.retryAgain"),e[22]=r,e[23]=x):x=e[23];let j;e[24]!==l?(j=()=>l.refetch(),e[24]=l,e[25]=j):j=e[25];let O;return e[26]!==f||e[27]!==h||e[28]!==x||e[29]!==j?(O=i.jsx(Ce,{title:f,description:h,actionLabel:x,onRetry:j}),e[26]=f,e[27]=h,e[28]=x,e[29]=j,e[30]=O):O=e[30],O}if(n){let f;return e[31]!==n||e[32]!==s?(f=i.jsx(je,{org:n,initialSiteUrl:s}),e[31]=n,e[32]=s,e[33]=f):f=e[33],f}if(d.length===1&&d[0]){let f;return e[34]!==d[0]||e[35]!==s?(f=i.jsx(je,{org:d[0],initialSiteUrl:s}),e[34]=d[0],e[35]=s,e[36]=f):f=e[36],f}if(d.length>1){let f;e[37]!==r?(f=r("routes.commerceOnboarding.chooseOrg"),e[37]=r,e[38]=f):f=e[38];let h;e[39]!==r?(h=r("routes.commerceOnboarding.selectWhereCommerceContinues"),e[39]=r,e[40]=h):h=e[40];let x;e[41]!==f||e[42]!==h?(x=i.jsx(W,{title:f,description:h}),e[41]=f,e[42]=h,e[43]=x):x=e[43];let j;e[44]!==r?(j=r("routes.commerceOnboarding.authCopy.continue"),e[44]=r,e[45]=j):j=e[45];let O;e[46]!==a||e[47]!==s?(O=V=>a({to:"/commerce-onboarding",search:{org:V.slug,siteUrl:s}}),e[46]=a,e[47]=s,e[48]=O):O=e[48];let C;e[49]!==d||e[50]!==j||e[51]!==O?(C=i.jsx(He,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:i.jsx(Be,{organizations:d,selectLabel:j,onSelected:O})}),e[49]=d,e[50]=j,e[51]=O,e[52]=C):C=e[52];let D;return e[53]!==x||e[54]!==C?(D=i.jsx(T,{children:i.jsxs("div",{className:"grid gap-10",children:[x,C]})}),e[53]=x,e[54]=C,e[55]=D):D=e[55],D}if(!m){let f;e[56]!==p?(f=()=>{p.reset(),p.mutate()},e[56]=p,e[57]=f):f=e[57];let h;return e[58]!==p||e[59]!==f?(h=i.jsx(Tt,{mutation:p,onRetry:f}),e[58]=p,e[59]=f,e[60]=h):h=e[60],h}const b=m;if(b?.success&&(b.status==="created"||b.status==="joined"||b.status==="already_has_organization")&&b.organization){let f;return e[61]!==b.organization||e[62]!==s?(f=i.jsx(je,{org:b.organization,initialSiteUrl:s}),e[61]=b.organization,e[62]=s,e[63]=f):f=e[63],f}if(b?.status==="ambiguous"&&b.organizations&&b.organizations.length>0){let f;e[64]!==r?(f=r("routes.commerceOnboarding.chooseOrg"),e[64]=r,e[65]=f):f=e[65];let h;e[66]!==r?(h=r("routes.commerceOnboarding.emailAccessMultipleOrgs"),e[66]=r,e[67]=h):h=e[67];let x;e[68]!==f||e[69]!==h?(x=i.jsx(W,{title:f,description:h}),e[68]=f,e[69]=h,e[70]=x):x=e[70];const j=b.domain??void 0;let O;e[71]!==a||e[72]!==s?(O=(V,q)=>{Je(),c({...V,slug:q}),a({to:"/commerce-onboarding",search:{org:q,siteUrl:s}})},e[71]=a,e[72]=s,e[73]=O):O=e[73];let C;e[74]!==b.organizations||e[75]!==j||e[76]!==O?(C=i.jsx(He,{className:"-mx-1 max-h-[60vh] overflow-y-auto px-1",children:i.jsx(Be,{organizations:b.organizations,domain:j,onJoined:O})}),e[74]=b.organizations,e[75]=j,e[76]=O,e[77]=C):C=e[77];let D;return e[78]!==x||e[79]!==C?(D=i.jsx(T,{children:i.jsxs("div",{className:"grid gap-10",children:[x,C]})}),e[78]=x,e[79]=C,e[80]=D):D=e[80],D}let w;e[81]!==r?(w=r("routes.commerceOnboarding.onboardingNeedsSupport"),e[81]=r,e[82]=w):w=e[82];let N;e[83]!==b?.error||e[84]!==r?(N=b?.error??r("routes.commerceOnboarding.couldNotDetermineOrg"),e[83]=b?.error,e[84]=r,e[85]=N):N=e[85];let P;e[86]!==r?(P=r("routes.commerceOnboarding.retryAgain"),e[86]=r,e[87]=P):P=e[87];let U;e[88]!==p?(U=()=>{u(null),p.reset()},e[88]=p,e[89]=U):U=e[89];let M;return e[90]!==w||e[91]!==N||e[92]!==P||e[93]!==U?(M=i.jsx(Ce,{title:w,description:N,actionLabel:P,onRetry:U}),e[90]=w,e[91]=N,e[92]=P,e[93]=U,e[94]=M):M=e[94],M}async function Lt(){const e=await(await fetch("/api/auth/custom/ensure-organization",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}})).json();return e.success&&(e.status==="created"||e.status==="joined"||e.status==="already_has_organization")&&e.organization&&Je(),e}function kt(t){return{id:t.id,name:t.name,slug:t.slug,logo:t.logo??null}}function Tt(t){const e=E.c(16),{mutation:o,onRetry:s}=t,r=$(),a=B.useRef(!1);let l;e[0]!==o?(l=u=>{!u||a.current||(a.current=!0,o.mutate())},e[0]=o,e[1]=l):l=e[1];const n=l;if(o.error){let u;e[2]!==r?(u=r("routes.commerceOnboarding.onboardingUnavailable"),e[2]=r,e[3]=u):u=e[3];let d;e[4]!==r?(d=r("routes.commerceOnboarding.couldNotPrepareOrg"),e[4]=r,e[5]=d):d=e[5];let g;e[6]!==r?(g=r("routes.commerceOnboarding.retryAgain"),e[6]=r,e[7]=g):g=e[7];let p;return e[8]!==s||e[9]!==u||e[10]!==d||e[11]!==g?(p=i.jsx(Ce,{title:u,description:d,actionLabel:g,onRetry:s}),e[8]=s,e[9]=u,e[10]=d,e[11]=g,e[12]=p):p=e[12],p}let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c=i.jsx(Ae,{variant:"generic"}),e[13]=c):c=e[13];let m;return e[14]!==n?(m=i.jsx(T,{children:i.jsx("div",{ref:n,children:c})}),e[14]=n,e[15]=m):m=e[15],m}function W(t){const e=E.c(8),{title:o,description:s}=t,r=tt();let a;e[0]!==r?(a=r?i.jsx(Ze,{host:r}):i.jsxs("div",{children:[i.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"h-12 w-12 dark:hidden"}),i.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"h-12 w-12 hidden dark:block"})]}),e[0]=r,e[1]=a):a=e[1];let l;e[2]!==s||e[3]!==o?(l=(o||s)&&i.jsxs("div",{className:"space-y-2",children:[o&&i.jsx("h1",{className:"text-2xl font-medium leading-8",children:o}),s&&i.jsx("p",{className:"text-base text-muted-foreground leading-6",children:s})]}),e[2]=s,e[3]=o,e[4]=l):l=e[4];let n;return e[5]!==a||e[6]!==l?(n=i.jsxs("div",{className:"grid gap-10",children:[a,l]}),e[5]=a,e[6]=l,e[7]=n):n=e[7],n}function Ce(t){const e=E.c(9),{title:o,description:s,actionLabel:r,onRetry:a}=t;let l;e[0]!==s||e[1]!==o?(l=i.jsx(W,{title:o,description:s}),e[0]=s,e[1]=o,e[2]=l):l=e[2];let n;e[3]!==r||e[4]!==a?(n=i.jsx(ve,{type:"button",size:"xl",className:"w-full",onClick:a,children:r}),e[3]=r,e[4]=a,e[5]=n):n=e[5];let c;return e[6]!==l||e[7]!==n?(c=i.jsx(T,{children:i.jsxs("div",{className:"grid gap-10",children:[l,n]})}),e[6]=l,e[7]=n,e[8]=c):c=e[8],c}function je(t){const e=E.c(13),{org:o,initialSiteUrl:s}=t,r=$(),{data:a}=Te.useSession(),[l]=Se(),n=a?.user?.email;let c;e[0]!==s||e[1]!==l.language||e[2]!==n?(c=Me({siteUrl:s,email:n,locale:l.language}),e[0]=s,e[1]=l.language,e[2]=n,e[3]=c):c=e[3];const m=c;let u;e[4]!==m||e[5]!==o.id?(u=i.jsx(De,{href:m,orgId:o.id}),e[4]=m,e[5]=o.id,e[6]=u):u=e[6];const d=u;let g;return e[7]!==s||e[8]!==d||e[9]!==o||e[10]!==a?.user?.email||e[11]!==r?(g=i.jsx(nt,{children:p=>{const{reset:v}=p;return i.jsx(lt,{fallback:b=>{const{error:w,resetError:N}=b;return i.jsx(T,{visual:d,children:i.jsx(Mt,{orgName:o.name,message:w instanceof Error?w.message:r("routes.commerceOnboarding.couldNotVerifyCommerceSetting"),onRetry:()=>{v(),N()}})})},children:i.jsx(B.Suspense,{fallback:i.jsx(rt,{visual:d}),children:i.jsx(Dt,{org:o,initialSiteUrl:s,sessionEmail:a?.user?.email},`${o.id}:${s??""}`)})})}}),e[7]=s,e[8]=d,e[9]=o,e[10]=a?.user?.email,e[11]=r,e[12]=g):g=e[12],g}function rt(t){const e=E.c(3),{visual:o}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=i.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-6 md:grid md:gap-4",children:[i.jsx(W,{}),i.jsx(Xe,{})]}),e[0]=s):s=e[0];let r;return e[1]!==o?(r=i.jsx(T,{align:"fill",visual:o,children:s}),e[1]=o,e[2]=r):r=e[2],r}function Mt(t){const e=E.c(19),{orgName:o,message:s,onRetry:r}=t,a=$();let l;e[0]!==a?(l=a("routes.commerceOnboarding.commerceDiagnostic"),e[0]=a,e[1]=l):l=e[1];let n;e[2]!==o||e[3]!==a?(n=a("routes.commerceOnboarding.configurationWillContinueIn",{orgName:o}),e[2]=o,e[3]=a,e[4]=n):n=e[4];let c;e[5]!==l||e[6]!==n?(c=i.jsx(W,{title:l,description:n}),e[5]=l,e[6]=n,e[7]=c):c=e[7];let m;e[8]!==s?(m=i.jsx(Oe,{message:s}),e[8]=s,e[9]=m):m=e[9];let u;e[10]!==a?(u=a("routes.commerceOnboarding.retryAgain"),e[10]=a,e[11]=u):u=e[11];let d;e[12]!==r||e[13]!==u?(d=i.jsx(ve,{type:"button",size:"xl",className:"w-full",onClick:r,children:u}),e[12]=r,e[13]=u,e[14]=d):d=e[14];let g;return e[15]!==c||e[16]!==m||e[17]!==d?(g=i.jsxs("div",{className:"grid gap-10",children:[c,m,d]}),e[15]=c,e[16]=m,e[17]=d,e[18]=g):g=e[18],g}function Dt(t){const e=E.c(135),{org:o,initialSiteUrl:s,sessionEmail:r}=t;let a;e[0]!==o.id||e[1]!==o.slug?(a={connectionId:bt,orgId:o.id,orgSlug:o.slug},e[0]=o.id,e[1]=o.slug,e[2]=a):a=e[2];const l=xt(a),[n,c]=B.useState(s??""),[m,u]=B.useState(null),d=B.useRef(!1),g=yt.COMMERCE_DISCOVERY(o.id),p=jt(o.id),v=Fe.commerceDiscoveryConnection(o.id,g);let b;e[3]!==g||e[4]!==l?(b=async()=>{const y=await l.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:g}});return Re(y)},e[3]=g,e[4]=l,e[5]=b):b=e[5];let w;e[6]!==v||e[7]!==b?(w={queryKey:v,queryFn:b,retry:!1},e[6]=v,e[7]=b,e[8]=w):w=e[8];const N=$e(w),P=Fe.commerceDiscoveryVirtualMcp(o.id,p);let U;e[9]!==l||e[10]!==p?(U=async()=>{const y=await l.callTool({name:"COLLECTION_VIRTUAL_MCP_GET",arguments:{id:p}});return Re(y)},e[9]=l,e[10]=p,e[11]=U):U=e[11];let M;e[12]!==P||e[13]!==U?(M={queryKey:P,queryFn:U,retry:!1},e[12]=P,e[13]=U,e[14]=M):M=e[14];const f=$e(M);let h;e[15]!==l?(h=async y=>{const S=await l.callTool({name:"COMMERCE_DISCOVERY_SETUP",arguments:{siteUrl:y}});return Re(S)},e[15]=l,e[16]=h):h=e[16];let x;e[17]!==N||e[18]!==o.id||e[19]!==f?(x=(y,S)=>{se("commerce_onboarding_setup_succeeded",{domain:ke(S)??void 0,organization_id:o.id}),u(null),N.refetch(),f.refetch()},e[17]=N,e[18]=o.id,e[19]=f,e[20]=x):x=e[20];let j;e[21]!==o.id?(j=(y,S)=>{se("commerce_onboarding_setup_failed",{domain:ke(S)??void 0,organization_id:o.id,error:y instanceof Error?y.message:String(y)}),u(y instanceof Error?y.message:"__configurationFailed")},e[21]=o.id,e[22]=j):j=e[22];let O;e[23]!==j||e[24]!==h||e[25]!==x?(O={mutationFn:h,retry:!1,onSuccess:x,onError:j},e[23]=j,e[24]=h,e[25]=x,e[26]=O):O=e[26];const C=Ye(O),D=!!N.data.item&&!!f.data.item,V=N.data.item,q=typeof V?.metadata?.siteUrl=="string"?V.metadata.siteUrl:void 0,_e=s||n||"";let ne;e[27]!==q||e[28]!==_e?(ne=mt(_e,q),e[27]=q,e[28]=_e,e[29]=ne):ne=e[29];const le=D&&ne,ae=s||n||q||"",_=$(),[we]=Se();let ce;e[30]!==ae||e[31]!==we.language||e[32]!==r?(ce=Me({siteUrl:ae,email:r,locale:we.language}),e[30]=ae,e[31]=we.language,e[32]=r,e[33]=ce):ce=e[33];const Ne=ce;let me;e[34]!==Ne||e[35]!==o.id?(me=i.jsx(De,{href:Ne,orgId:o.id}),e[34]=Ne,e[35]=o.id,e[36]=me):me=e[36];const L=me;let de;e[37]!==m||e[38]!==_?(de=m?Ke(_,m):null,e[37]=m,e[38]=_,e[39]=de):de=e[39];const k=de;let ue;e[40]!==C?(ue=y=>{const S=Ie(y);if(!S.ok){u(S.error);return}u(null),C.mutate(S.value)},e[40]=C,e[41]=ue):ue=e[41];const K=ue;let ge;e[42]!==s||e[43]!==K||e[44]!==le?(ge=y=>{!y||d.current||le||!s||(d.current=!0,K(s))},e[42]=s,e[43]=K,e[44]=le,e[45]=ge):ge=e[45];const Ee=ge;let fe;e[46]!==o.id||e[47]!==K||e[48]!==n?(fe=y=>{y.preventDefault();const S=Ie(n);S.ok&&se("commerce_onboarding_site_url_submitted",{domain:new URL(S.value).hostname,organization_id:o.id}),K(n)},e[46]=o.id,e[47]=K,e[48]=n,e[49]=fe):fe=e[49];const A=fe;if(le){const y=o.slug;let S;e[50]===Symbol.for("react.memo_cache_sentinel")?(S=crypto.randomUUID(),e[50]=S):S=e[50];let I;e[51]!==o.slug?(I={org:y,taskId:S},e[51]=o.slug,e[52]=I):I=e[52];let R;e[53]!==o.id?(R=Ct(o.id),e[53]=o.id,e[54]=R):R=e[54];const H=ae||void 0;let z;e[55]!==R.id||e[56]!==H?(z={virtualmcpid:R.id,connect:"1",siteUrl:H},e[55]=R.id,e[56]=H,e[57]=z):z=e[57];let F;return e[58]!==I||e[59]!==z?(F=i.jsx(at,{to:"/$org/$taskId",params:I,search:z,replace:!0}),e[58]=I,e[59]=z,e[60]=F):F=e[60],F}if(C.isPending){let y;return e[61]!==L?(y=i.jsx(rt,{visual:L}),e[61]=L,e[62]=y):y=e[62],y}if(s){let y,S,I,R,H,z,F,Z;if(e[63]!==L||e[64]!==A||e[65]!==s||e[66]!==o.name||e[67]!==C.isPending||e[68]!==n||e[69]!==_||e[70]!==k||e[71]!==Ee){Z=Symbol.for("react.early_return_sentinel");e:{const Ue=Ie(s);if(!Ue.ok){let ie;e[80]!==_?(ie=_("routes.commerceOnboarding.commerceDiagnostic"),e[80]=_,e[81]=ie):ie=e[81];let oe;e[82]!==o.name||e[83]!==_?(oe=_("routes.commerceOnboarding.configurationWillContinueIn",{orgName:o.name}),e[82]=o.name,e[83]=_,e[84]=oe):oe=e[84];let be;e[85]!==ie||e[86]!==oe?(be=i.jsx(W,{title:ie,description:oe}),e[85]=ie,e[86]=oe,e[87]=be):be=e[87];let xe;e[88]!==A||e[89]!==C.isPending||e[90]!==n||e[91]!==k?(xe=i.jsx(ze,{siteUrl:n,error:k,isSubmitting:C.isPending,onSiteUrlChange:c,onSubmit:A}),e[88]=A,e[89]=C.isPending,e[90]=n,e[91]=k,e[92]=xe):xe=e[92];const Pe=i.jsxs("div",{className:"grid gap-10",children:[be,i.jsx(Oe,{message:Ke(_,Ue.error)}),xe]});let ye;e[93]!==L||e[94]!==Pe?(ye=i.jsx(T,{visual:L,children:Pe}),e[93]=L,e[94]=Pe,e[95]=ye):ye=e[95],Z=ye;break e}S=T,F=L,H=Ee,z="grid gap-10",y=W,e[96]!==_?(I=_("routes.commerceOnboarding.commerceDiagnostic"),e[96]=_,e[97]=I):I=e[97],R=_("routes.commerceOnboarding.commerceDiscoveryBeingPrepared",{url:Ue.value})}e[63]=L,e[64]=A,e[65]=s,e[66]=o.name,e[67]=C.isPending,e[68]=n,e[69]=_,e[70]=k,e[71]=Ee,e[72]=y,e[73]=S,e[74]=I,e[75]=R,e[76]=H,e[77]=z,e[78]=F,e[79]=Z}else y=e[72],S=e[73],I=e[74],R=e[75],H=e[76],z=e[77],F=e[78],Z=e[79];if(Z!==Symbol.for("react.early_return_sentinel"))return Z;let ee;e[98]!==y||e[99]!==I||e[100]!==R?(ee=i.jsx(y,{title:I,description:R}),e[98]=y,e[99]=I,e[100]=R,e[101]=ee):ee=e[101];let te;e[102]!==A||e[103]!==C.isPending||e[104]!==n||e[105]!==k?(te=k?i.jsxs(i.Fragment,{children:[i.jsx(Oe,{message:k}),i.jsx(ze,{siteUrl:n,error:null,isSubmitting:C.isPending,onSiteUrlChange:c,onSubmit:A})]}):i.jsx(Xe,{}),e[102]=A,e[103]=C.isPending,e[104]=n,e[105]=k,e[106]=te):te=e[106];let re;e[107]!==H||e[108]!==z||e[109]!==ee||e[110]!==te?(re=i.jsxs("div",{ref:H,className:z,children:[ee,te]}),e[107]=H,e[108]=z,e[109]=ee,e[110]=te,e[111]=re):re=e[111];let he;return e[112]!==S||e[113]!==F||e[114]!==re?(he=i.jsx(S,{visual:F,children:re}),e[112]=S,e[113]=F,e[114]=re,e[115]=he):he=e[115],he}let Q;e[116]!==_?(Q=_("routes.commerceOnboarding.commerceDiagnostic"),e[116]=_,e[117]=Q):Q=e[117];let G;e[118]!==o.name||e[119]!==_?(G=_("routes.commerceOnboarding.configurationWillContinueIn",{orgName:o.name}),e[118]=o.name,e[119]=_,e[120]=G):G=e[120];let Y;e[121]!==Q||e[122]!==G?(Y=i.jsx(W,{title:Q,description:G}),e[121]=Q,e[122]=G,e[123]=Y):Y=e[123];let J;e[124]!==A||e[125]!==C.isPending||e[126]!==n||e[127]!==k?(J=i.jsx(ze,{siteUrl:n,error:k,isSubmitting:C.isPending,onSiteUrlChange:c,onSubmit:A}),e[124]=A,e[125]=C.isPending,e[126]=n,e[127]=k,e[128]=J):J=e[128];let X;e[129]!==Y||e[130]!==J?(X=i.jsxs("div",{className:"grid gap-10",children:[Y,J]}),e[129]=Y,e[130]=J,e[131]=X):X=e[131];let pe;return e[132]!==L||e[133]!==X?(pe=i.jsx(T,{visual:L,children:X}),e[132]=L,e[133]=X,e[134]=pe):pe=e[134],pe}function ze(t){const e=E.c(30),{siteUrl:o,error:s,isSubmitting:r,onSiteUrlChange:a,onSubmit:l}=t,n=$();let c;e[0]!==n?(c=n("routes.commerceOnboarding.siteUrlLabel"),e[0]=n,e[1]=c):c=e[1];let m;e[2]!==c?(m=i.jsx("label",{className:"text-sm font-medium",htmlFor:"commerce-site-url",children:c}),e[2]=c,e[3]=m):m=e[3];let u;e[4]!==a?(u=M=>a(M.target.value),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==n?(d=n("routes.commerceOnboarding.siteUrlPlaceholder"),e[6]=n,e[7]=d):d=e[7];const g=!!s;let p;e[8]!==r||e[9]!==o||e[10]!==u||e[11]!==d||e[12]!==g?(p=i.jsx(gt,{id:"commerce-site-url",type:"text",inputMode:"url",value:o,onChange:u,placeholder:d,"aria-invalid":g,disabled:r}),e[8]=r,e[9]=o,e[10]=u,e[11]=d,e[12]=g,e[13]=p):p=e[13];let v;e[14]!==s?(v=s?i.jsx(Oe,{message:s}):null,e[14]=s,e[15]=v):v=e[15];let b;e[16]!==m||e[17]!==p||e[18]!==v?(b=i.jsxs("div",{className:"grid gap-2",children:[m,p,v]}),e[16]=m,e[17]=p,e[18]=v,e[19]=b):b=e[19];let w;e[20]!==n?(w=n("routes.commerceOnboarding.authCopy.continue"),e[20]=n,e[21]=w):w=e[21];let N;e[22]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(Ot,{size:16}),e[22]=N):N=e[22];let P;e[23]!==r||e[24]!==w?(P=i.jsxs(ve,{type:"submit",size:"xl",className:"w-full",disabled:r,children:[w,N]}),e[23]=r,e[24]=w,e[25]=P):P=e[25];let U;return e[26]!==l||e[27]!==P||e[28]!==b?(U=i.jsxs("form",{className:"grid gap-4",onSubmit:l,children:[b,P]}),e[26]=l,e[27]=P,e[28]=b,e[29]=U):U=e[29],U}function Oe(t){const e=E.c(2),{message:o}=t;let s;return e[0]!==o?(s=i.jsx("p",{className:"text-sm leading-5 text-destructive",role:"alert",children:o}),e[0]=o,e[1]=s):s=e[1],s}export{ci as default};
@@ -1 +0,0 @@
1
- import{W as be,a3 as $e,a$ as De,X as me,a1 as Oe,c as R,b as H,j as t,k as ve,B,r as Z,m as Ne,F as te,x as Me,K as ae,d as se,at as ue,D as ze,E as Ee,f as Ue,b0 as Re,o as Ve,Z as Fe,Y as Le,t as J}from"./index-Dk9RGAqb.js";import{g as Be}from"./extract-connection-data-ChU9AlhE.js";import{E as Se}from"./empty-state-CwB9YNml.js";import{E as He,c as qe,r as Xe,b as Ge,d as Ke}from"./connection-form-helpers-BABNaeU1.js";import{c as Qe,S as We,V as Ye}from"./index-CSZh49Ui.js";import{u as ye,T as Je}from"./use-mcp-auth-status-UXgrVZIV.js";import{u as Ze}from"./use-members-Cf3JeQ7o.js";import{A as et}from"./avatar-BQF1QGjq.js";import{a as Ce,b as _e,u as tt}from"./use-connection-BsS-3rZB.js";import{u as we}from"./use-mcp-client-Bzvvd0Df.js";import{a as st}from"./use-mcp-tools-IcUfyh43.js";import{c as nt,C as it,a as ot,d as at}from"./AreaChart-CB1-fSKl.js";import{i as lt,a as rt}from"./mcp-oauth-Br5ozXBx.js";import{I as le}from"./integration-icon-DBUjxWMb.js";import{s as ct}from"./Plus-CLG5QKCr.js";import{S as dt,a as mt,aA as ut,c as xt}from"./agent-icon-E6ioveGx.js";import{a as ke,s as pt}from"./Settings02-BIGi-T7s.js";import{s as ce}from"./Trash01-CWIa_mDx.js";import{q as ft,p as ht,o as gt,m as jt,n as bt}from"./sidebar-DBzYJLC2.js";import{F as G,b as K,c as Q,d as L,e as W,f as vt,a as Nt}from"./form-CJlgALpE.js";import{I as Y}from"./input-C-gHIQip.js";import{u as St,D as yt}from"./use-delete-connection-DqznTHaH.js";import{c as Ct,B as _t,a as wt,C as kt}from"./monitoring-stats-row-B0nxijUM.js";import{u as It}from"./studio-tools-CFgWeCBk.js";import{a as Tt}from"./use-virtual-mcp-BP-M67aZ.js";import{i as Ie}from"./ChevronRight-Dkp8mDOd.js";import{a as Te}from"./Users03-3lwc9liE.js";import{b as ne,c as At,T as ie,a as Pt}from"./tabs-BBm6nSot.js";import{g as Ae}from"./connection-slug-eyAPH6o3.js";import{n as $t}from"./ZapSquare-DGe1cTc7.js";import{c as Dt}from"./Tool01-B0759esA.js";import{g as de,M as Ot}from"./index-DaeJeAuV.js";import{C as Mt}from"./collection-search-zQnUIpxo.js";import{C as zt}from"./card-DcA1Rwjs.js";import{B as Et}from"./badge-BbmHyS30.js";import{c as Ut,D as Rt,b as Vt,a as xe}from"./dropdown-menu-CSgtqrA3.js";import{S as pe,a as fe,b as he,c as ge,d as X}from"./select-Bd1WKGSJ.js";import{i as Ft}from"./CheckCircle-Dh-3VdHB.js";import{t as Lt}from"./ChevronDown-B3fDqERa.js";import{n as Bt}from"./Tool02-DPXeBg9E.js";import{s as oe}from"./Star01-lWHLfmir.js";import{s as Ht}from"./XClose-CW0R6bEe.js";import{p as qt,i as Xt}from"./connection-DPLpTOu5.js";import"./metadata-dUsYcpuu.js";import"./index-D8ngUVkT.js";import"./ZoomOut-B-F-8cp0.js";import"./Key01-CgioJ7nW.js";import"./auth-C4POVeVe.js";import"./use-registry-connections-C529xEPn.js";import"./use-organization-settings-zX_T-3XG.js";import"./index-DLEyNPFn.js";import"./popover-C2fPnPJt.js";import"./tooltip-xp77jFs4.js";import"./Check-LKA0FKR0.js";import"./SearchMd-DBj7HhoW.js";import"./use-mobile-DQ8jManM.js";import"./use-create-virtual-mcp-C2sWKZ2h.js";import"./use-navigate-to-agent-D_vSOLwA.js";import"./hooks-CvwQxo-K.js";import"./delay-CnY5UFtP.js";import"./backoff-CrEUbyZT.js";import"./decopilot-sse-pool-C_GcVLtN.js";import"./reusable-new-chat-CouMjkYR.js";import"./Eye-SCLKEZSh.js";import"./use-org-auth-client-B1nrzsgv.js";import"./User01-NxrNjn_h.js";import"./AlertCircle-1e3-NcEA.js";import"./ArrowUp-DI1fyC1G.js";import"./ArrowRight-B-wHAJWT.js";import"./ArrowUpRight-BWyzrLQV.js";import"./TrendUp01-CYCVS1zr.js";import"./ChevronUp-Cm7VcWLZ.js";import"./DotsVertical-DKanPfz6.js";import"./Stars02-DpsxkqJO.js";import"./Copy01-uQh3Q5Fv.js";import"./Globe01-CEh6-y49.js";import"./FilterLines-13dE_TWB.js";import"./Globe04-B4VpGXlx.js";import"./SwitchHorizontal01-Dw_LQc0f.js";import"./HardDrive-DViLU95V.js";import"./Image01-CMEjSR3M.js";import"./LayoutLeft-Yz5NzG-w.js";import"./XCircle-B3aYrCCW.js";import"./LinkExternal01-Di_tOfr7.js";import"./LogOut01-r12Fp93g.js";import"./Monitor01-C_dYkXdo.js";import"./Sun-tOsjvEis.js";import"./Package-R2sM0vCm.js";import"./Palette-CsQxyyrG.js";import"./Play-CVGtm9ao.js";import"./SearchLg-CkXJjhdf.js";import"./Shield01-ksb0VZpA.js";import"./Stars01-B3jznQQ4.js";import"./Upload01-CPD95nN4.js";import"./Users01-DvtVVxdG.js";import"./X-BYXAQs6v.js";import"./Zap-CrMVm5NK.js";import"./label-D9aEMZqo.js";import"./alert-dialog-DwnblylQ.js";const Gt=be({scopes:Oe(me()).describe("List of scopes available"),stateSchema:$e(me(),De()).describe("JSON Schema (draft-07) defining the state structure")}),Kt=[{name:"MCP_CONFIGURATION",inputSchema:be({}),outputSchema:Gt}];function Qt(s){const e=R.c(61),{instance:n,onConfigure:c,onAuthenticate:a,onDelete:i,onToggleStatus:l}=s,o=H();let r;e[0]!==n.id?(r={connectionId:n.id},e[0]=n.id,e[1]=r):r=e[1];const m=ye(r),d=!(n.connection_type==="VIRTUAL")&&m.supportsOAuth&&!m.isAuthenticated,f=n.status!=="active",u=d||f?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==u?(h=Ne("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",u),e[2]=u,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let N;e[7]!==n.title?(N=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=N):N=e[8];let S;e[9]!==n.status||e[10]!==f||e[11]!==d||e[12]!==o?(S=d?t.jsx("span",{className:"text-xs text-destructive font-medium",children:o("details.connectionInstancesPanel.needsAuthorization")}):f?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?o("details.connectionInstancesPanel.disabledError"):o("details.connectionInstancesPanel.disabled")}):null,e[9]=n.status,e[10]=f,e[11]=d,e[12]=o,e[13]=S):S=e[13];let b;e[14]!==N||e[15]!==S?(b=t.jsxs("div",{className:"flex-1 min-w-0",children:[N,S]}),e[14]=N,e[15]=S,e[16]=b):b=e[16];let y;e[17]!==n||e[18]!==d||e[19]!==a||e[20]!==o?(y=d&&t.jsx(B,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>a(n),children:o("details.connectionInstancesPanel.authorize")}),e[17]=n,e[18]=d,e[19]=a,e[20]=o,e[21]=y):y=e[21];let P;e[22]!==n||e[23]!==f||e[24]!==l||e[25]!==o?(P=f?t.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>l(n,"active"),children:[t.jsx(dt,{size:13}),o("details.connectionInstancesPanel.enable")]}):t.jsx(B,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>l(n,"inactive"),title:o("details.connectionInstancesPanel.disable"),"aria-label":o("details.connectionInstancesPanel.disable"),children:t.jsx(mt,{size:13})}),e[22]=n,e[23]=f,e[24]=l,e[25]=o,e[26]=P):P=e[26];let $;e[27]!==n||e[28]!==c?($=()=>c(n),e[27]=n,e[28]=c,e[29]=$):$=e[29];let _;e[30]!==o?(_=o("details.connectionInstancesPanel.configure"),e[30]=o,e[31]=_):_=e[31];let M;e[32]!==o?(M=o("details.connectionInstancesPanel.configure"),e[32]=o,e[33]=M):M=e[33];let T;e[34]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx(ke,{size:13}),e[34]=T):T=e[34];let D;e[35]!==$||e[36]!==_||e[37]!==M?(D=t.jsx(B,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:$,title:_,"aria-label":M,children:T}),e[35]=$,e[36]=_,e[37]=M,e[38]=D):D=e[38];let I;e[39]!==n||e[40]!==i?(I=()=>i(n),e[39]=n,e[40]=i,e[41]=I):I=e[41];let v;e[42]!==o?(v=o("details.connectionInstancesPanel.delete"),e[42]=o,e[43]=v):v=e[43];let j;e[44]!==o?(j=o("details.connectionInstancesPanel.delete"),e[44]=o,e[45]=j):j=e[45];let E;e[46]===Symbol.for("react.memo_cache_sentinel")?(E=t.jsx(ce,{size:13}),e[46]=E):E=e[46];let z;e[47]!==I||e[48]!==v||e[49]!==j?(z=t.jsx(B,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:I,title:v,"aria-label":j,children:E}),e[47]=I,e[48]=v,e[49]=j,e[50]=z):z=e[50];let k;e[51]!==D||e[52]!==z||e[53]!==y||e[54]!==P?(k=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[y,P,D,z]}),e[51]=D,e[52]=z,e[53]=y,e[54]=P,e[55]=k):k=e[55];let A;return e[56]!==k||e[57]!==h||e[58]!==g||e[59]!==b?(A=t.jsxs("div",{className:h,children:[g,b,k]}),e[56]=k,e[57]=h,e[58]=g,e[59]=b,e[60]=A):A=e[60],A}function Wt(s){const e=R.c(21),{instance:n,onConfigure:c}=s,a=H();let i;e[0]!==n.icon||e[1]!==n.title?(i=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=i):i=e[2];let l;e[3]!==n.title?(l=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]=l):l=e[4];let o;e[5]!==n||e[6]!==c?(o=()=>c(n),e[5]=n,e[6]=c,e[7]=o):o=e[7];let r;e[8]!==a?(r=a("details.connectionInstancesPanel.configure"),e[8]=a,e[9]=r):r=e[9];let m;e[10]!==a?(m=a("details.connectionInstancesPanel.configure"),e[10]=a,e[11]=m):m=e[11];let p;e[12]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ke,{size:13}),e[12]=p):p=e[12];let d;e[13]!==o||e[14]!==r||e[15]!==m?(d=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(B,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:o,title:r,"aria-label":m,children:p})}),e[13]=o,e[14]=r,e[15]=m,e[16]=d):d=e[16];let f;return e[17]!==i||e[18]!==l||e[19]!==d?(f=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[i,l,d]}),e[17]=i,e[18]=l,e[19]=d,e[20]=f):f=e[20],f}function Yt(s){const e=R.c(33),{instances:n,onConfigure:c,onAuthenticate:a,onDelete:i,onToggleStatus:l,onAdd:o,isAdding:r}=s,m=H();if(n.length===0)return null;let p;e[0]!==n.length||e[1]!==m?(p=n.length===1?m("details.connectionInstancesPanel.instance"):m("details.connectionInstancesPanel.instances"),e[0]=n.length,e[1]=m,e[2]=p):p=e[2];let d;e[3]!==p?(d=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:p}),e[3]=p,e[4]=d):d=e[4];let f;e[5]!==r?(f=r?t.jsx(ve,{size:13,className:"animate-spin"}):t.jsx(ct,{size:13}),e[5]=r,e[6]=f):f=e[6];let u;e[7]!==m?(u=m("details.connectionInstancesPanel.addInstance"),e[7]=m,e[8]=u):u=e[8];let h;e[9]!==r||e[10]!==o||e[11]!==f||e[12]!==u?(h=t.jsxs(B,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:o,disabled:r,children:[f,u]}),e[9]=r,e[10]=o,e[11]=f,e[12]=u,e[13]=h):h=e[13];let g;e[14]!==d||e[15]!==h?(g=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[d,h]}),e[14]=d,e[15]=h,e[16]=g):g=e[16];let N;if(e[17]!==n||e[18]!==a||e[19]!==c||e[20]!==i||e[21]!==l){let y;e[23]!==a||e[24]!==c||e[25]!==i||e[26]!==l?(y=P=>t.jsx(Z.Suspense,{fallback:t.jsx(Wt,{instance:P,onConfigure:c}),children:t.jsx(Qt,{instance:P,onConfigure:c,onAuthenticate:a,onDelete:i,onToggleStatus:l})},P.id),e[23]=a,e[24]=c,e[25]=i,e[26]=l,e[27]=y):y=e[27],N=n.map(y),e[17]=n,e[18]=a,e[19]=c,e[20]=i,e[21]=l,e[22]=N}else N=e[22];let S;e[28]!==N?(S=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:N}),e[28]=N,e[29]=S):S=e[29];let b;return e[30]!==g||e[31]!==S?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[g,S]}),e[30]=g,e[31]=S,e[32]=b):b=e[32],b}function Jt(s,e=3){const n=new Map;for(const c of s){if(!c.isError)continue;const a=(c.errorMessage??"").trim()||"Unknown error";n.set(a,(n.get(a)??0)+1)}return[...n.entries()].map(([c,a])=>({message:c,count:a})).sort((c,a)=>a.count-c.count).slice(0,e)}const Zt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function es(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 ts={calls:{label:"Tool calls"},errors:{label:"Errors"}};function ss(s){const e=R.c(4),{connectionId:n,orgId:c,timeframe:a}=s,i=H(),l=It(),o=es(a),{data:r}=Me({queryKey:ae.connectionActivity(n,a,c),queryFn:async()=>await l.call("MONITORING_LOGS_LIST",{startDate:o.startDate.toISOString(),endDate:o.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}),staleTime:3e5}),m=Ct(r?.logs??[],o),p=m.data,d=m.totalCalls>0,f=Jt(r?.logs??[]),u=m.totalCalls>0?Math.round(m.totalErrors/m.totalCalls*100):0;let h;e[0]!==i?(h=i("details.connectionActivity.toolCalls"),e[0]=i,e[1]=h):h=e[1];let g;return e[2]!==h?(g=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:h}),e[2]=h,e[3]=g):g=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:m.totalCalls.toLocaleString()}),g]}),m.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:m.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("details.connectionActivity.errors")})]}),m.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(m.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i("details.connectionActivity.avgLatency")})]})]}),d?t.jsxs("div",{children:[t.jsx(nt,{config:ts,className:"h-16 w-full",children:t.jsxs(_t,{data:p,barCategoryGap:"4%",children:[t.jsx(it,{content:t.jsx(ot,{labelFormatter:os}),cursor:{fill:"var(--muted)"}}),t.jsx(wt,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:p.map(is)})]})}),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:i("details.connectionActivity.noActivityInThisPeriod")})}),f.length>0&&t.jsxs("div",{className:"px-5 py-4 border-t border-border",children:[t.jsxs("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:[i("details.connectionActivity.topErrors"),u>0?` · ${i("details.connectionActivity.errorRatePercentage",{errorRate:u.toString()})}`:""]}),t.jsx("ul",{className:"space-y-1.5",children:f.map(ns)})]})]})}function ns(s){return t.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[t.jsxs("span",{className:"tabular-nums text-destructive font-medium shrink-0",children:[s.count.toLocaleString(),"×"]}),t.jsx("span",{className:"text-muted-foreground truncate",title:s.message,children:s.message})]},s.message)}function is(s,e){return t.jsx(kt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function os(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function as(){const s=R.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 ls(s){const e=R.c(19),{connectionId:n}=s,c=H(),[a,i]=Z.useState("14d"),{org:l}=te();let o;e[0]!==c?(o=c("details.connectionActivity.activity"),e[0]=c,e[1]=o):o=e[1];let r;e[2]!==o?(r=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:o})}),e[2]=o,e[3]=r):r=e[3];let m;e[4]!==a?(m=Zt.map(g=>t.jsx("button",{type:"button",onClick:()=>i(g.value),className:Ne("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===g.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:g.label},g.value)),e[4]=a,e[5]=m):m=e[5];let p;e[6]!==m?(p=t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:m}),e[6]=m,e[7]=p):p=e[7];let d;e[8]!==r||e[9]!==p?(d=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[r,p]}),e[8]=r,e[9]=p,e[10]=d):d=e[10];let f;e[11]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(as,{}),e[11]=f):f=e[11];let u;e[12]!==n||e[13]!==l.id||e[14]!==a?(u=t.jsx(Z.Suspense,{fallback:f,children:t.jsx(ss,{connectionId:n,orgId:l.id,timeframe:a})}),e[12]=n,e[13]=l.id,e[14]=a,e[15]=u):u=e[15];let h;return e[16]!==d||e[17]!==u?(h=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,u]}),e[16]=d,e[17]=u,e[18]=h):h=e[18],h}function rs(s){const e=R.c(15),{virtualMcp:n,org:c}=s,a=se();let i;e[0]!==a||e[1]!==c||e[2]!==n.id?(i=()=>{const d=crypto.randomUUID();a({to:"/$org/$taskId",params:{org:c,taskId:d},search:{virtualmcpid:n.id}})},e[0]=a,e[1]=c,e[2]=n.id,e[3]=i):i=e[3];let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(Te,{size:16}),e[4]=l):l=e[4];let o;e[5]!==n.icon||e[6]!==n.title?(o=t.jsx(le,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:l}),e[5]=n.icon,e[6]=n.title,e[7]=o):o=e[7];let r;e[8]!==n.title?(r=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=r):r=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(Ie,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=m):m=e[10];let p;return e[11]!==i||e[12]!==o||e[13]!==r?(p=t.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[o,r,m]}),e[11]=i,e[12]=o,e[13]=r,e[14]=p):p=e[14],p}function cs(s){const e=R.c(7),{virtualMcps:n,org:c}=s;let a;if(e[0]!==c||e[1]!==n){let l;e[3]!==c?(l=o=>t.jsx(rs,{virtualMcp:o,org:c},o.id),e[3]=c,e[4]=l):l=e[4],a=n.map(l),e[0]=c,e[1]=n,e[2]=a}else a=e[2];let i;return e[5]!==a?(i=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]=i):i=e[6],i}function ds(s){const e=R.c(7),{connection:n}=s,{org:c}=te();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 i=Tt(a);if(!(i.length>0)){let m;return e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(t.Fragment,{}),e[2]=m):m=e[2],m}let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=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]=o):o=e[3];let r;return e[4]!==c.slug||e[5]!==i?(r=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[o,t.jsx("div",{className:"px-5 py-4",children:t.jsx(cs,{virtualMcps:i,org:c.slug})})]}),e[4]=c.slug,e[5]=i,e[6]=r):r=e[6],r}function ms(s){const e=R.c(35),{tools:n,connectionId:c,org:a}=s,i=H(),l=se(),{org:o}=te();let r;e[0]!==c||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:c,orgId:o.id,orgSlug:o.slug},e[0]=c,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const m=we(r),p=Ce(c);let d;e[4]!==p||e[5]!==c?(d=p?Ae(p):c,e[4]=p,e[5]=c,e[6]=d):d=e[6];const f=d,[u,h]=Z.useState("");let g,N,S,b;if(e[7]!==f||e[8]!==m||e[9]!==l||e[10]!==a||e[11]!==u||e[12]!==i||e[13]!==n){const $=(n??[]).filter(us),_=u.toLowerCase().trim(),M=_?$.filter(j=>j.name.toLowerCase().includes(_)||j.description&&j.description.toLowerCase().includes(_)):$;let T;e[18]!==f||e[19]!==l||e[20]!==a?(T=j=>{l({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:a,appSlug:f,collectionName:"tools",itemId:encodeURIComponent(j.name)}})},e[18]=f,e[19]=l,e[20]=a,e[21]=T):T=e[21];const D=T;S="flex flex-col h-full overflow-hidden";let I;e[22]!==i?(I=i("details.connectionUiTab.searchAppsPlaceholder"),e[22]=i,e[23]=I):I=e[23];let v;e[24]===Symbol.for("react.memo_cache_sentinel")?(v=j=>{j.key==="Escape"&&(h(""),j.target.blur())},e[24]=v):v=e[24],e[25]!==u||e[26]!==I?(b=t.jsx(Mt,{value:u,onChange:h,placeholder:I,onKeyDown:v}),e[25]=u,e[26]=I,e[27]=b):b=e[27],g="flex-1 overflow-auto p-5",N=M.length===0?t.jsx(Se,{image:null,title:i(u?"details.connectionUiTab.noAppsFound":"details.connectionUiTab.noAppsAvailable"),description:i(u?"details.connectionUiTab.adjustSearchTerms":"details.connectionUiTab.noInteractiveUis")}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:M.map(j=>{const E=de(j._meta);return t.jsxs(zt,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>D(j),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx(Ot,{resourceURI:E,toolInfo:{tool:j},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:j.name}),t.jsx(Je,{annotations:j.annotations,_meta:j._meta})]}),j.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:j.description})]})]},j.name)})}),e[7]=f,e[8]=m,e[9]=l,e[10]=a,e[11]=u,e[12]=i,e[13]=n,e[14]=g,e[15]=N,e[16]=S,e[17]=b}else g=e[14],N=e[15],S=e[16],b=e[17];let y;e[28]!==g||e[29]!==N?(y=t.jsx("div",{className:g,children:N}),e[28]=g,e[29]=N,e[30]=y):y=e[30];let P;return e[31]!==S||e[32]!==b||e[33]!==y?(P=t.jsxs("div",{className:S,children:[b,y]}),e[31]=S,e[32]=b,e[33]=y,e[34]=P):P=e[34],P}function us(s){return!!de(s._meta)}function Pe(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=l=>l.charAt(0).toUpperCase()+l.slice(1),c=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),a=e.map(n),i=e[e.length-1];return a.length>=2&&i&&c.has(i)?[a.pop(),...a].join(" "):a.join(" ")}function re(s){const e=R.c(5),{label:n}=s,c=H();let a;e[0]!==n||e[1]!==c?(a=c("details.connectionCapabilities.noItemsAvailable",{item:n}),e[0]=n,e[1]=c,e[2]=a):a=e[2];let i;return e[3]!==a?(i=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:a})}),e[3]=a,e[4]=i):i=e[4],i}function xs(s){const e=R.c(72),{tools:n,prompts:c,resources:a,connectionId:i,org:l}=s;let o;e[0]!==c?(o=c===void 0?[]:c,e[0]=c,e[1]=o):o=e[1];const r=o;let m;e[2]!==a?(m=a===void 0?[]:a,e[2]=a,e[3]=m):m=e[3];const p=m,d=H(),f=se(),u=Ce(i??"");let h;e[4]!==u||e[5]!==i?(h=u?Ae(u):i,e[4]=u,e[5]=i,e[6]=h):h=e[6];const g=h;let N;e[7]!==g||e[8]!==i||e[9]!==f||e[10]!==l?(N=function(V){!i||!l||f({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:l,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(V)}})},e[7]=g,e[8]=i,e[9]=f,e[10]=l,e[11]=N):N=e[11];const S=N;let b;e[12]!==i||e[13]!==l||e[14]!==n?(b=i&&l&&n.some(hs),e[12]=i,e[13]=l,e[14]=n,e[15]=b):b=e[15];const y=b;if(n.length+r.length+p.length===0){let C;e[16]!==d?(C=d("details.connectionCapabilities.capabilities"),e[16]=d,e[17]=C):C=e[17];let V;e[18]!==C?(V=t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:C}),e[18]=C,e[19]=V):V=e[19];let q;e[20]!==d?(q=d("details.connectionCapabilities.noCapabilitiesDiscovered"),e[20]=d,e[21]=q):q=e[21];let F;e[22]!==q?(F=t.jsx("p",{className:"text-sm text-muted-foreground",children:q}),e[22]=q,e[23]=F):F=e[23];let ee;return e[24]!==F||e[25]!==V?(ee=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[V,F]}),e[24]=F,e[25]=V,e[26]=ee):ee=e[26],ee}let $;e[27]!==d||e[28]!==n.length?($=d("details.connectionCapabilities.toolsTab",{count:n.length}),e[27]=d,e[28]=n.length,e[29]=$):$=e[29];let _;e[30]!==$?(_=t.jsx(ne,{value:"tools",variant:"underline",children:$}),e[30]=$,e[31]=_):_=e[31];let M;e[32]!==y||e[33]!==d?(M=y&&t.jsx(ne,{value:"apps",variant:"underline",children:d("details.connectionCapabilities.uiTab")}),e[32]=y,e[33]=d,e[34]=M):M=e[34];let T;e[35]!==d?(T=d("details.connectionCapabilities.promptsTab"),e[35]=d,e[36]=T):T=e[36];let D;e[37]!==T?(D=t.jsx(ne,{value:"prompts",variant:"underline",children:T}),e[37]=T,e[38]=D):D=e[38];let I;e[39]!==d?(I=d("details.connectionCapabilities.resourcesTab"),e[39]=d,e[40]=I):I=e[40];let v;e[41]!==I?(v=t.jsx(ne,{value:"resources",variant:"underline",children:I}),e[41]=I,e[42]=v):v=e[42];let j;e[43]!==M||e[44]!==D||e[45]!==v||e[46]!==_?(j=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(At,{variant:"underline",className:"gap-1",children:[_,M,D,v]})}),e[43]=M,e[44]=D,e[45]=v,e[46]=_,e[47]=j):j=e[47];let E;e[48]!==S||e[49]!==n?(E=n.length>0?n.map(C=>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:()=>S(C.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(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(C.name)}),C.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:C.description})]}),t.jsx(Ie,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},C.name)):t.jsx(re,{label:"tools"}),e[48]=S,e[49]=n,e[50]=E):E=e[50];let z;e[51]!==E?(z=t.jsx(ie,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:E})}),e[51]=E,e[52]=z):z=e[52];let k;e[53]!==i||e[54]!==y||e[55]!==l||e[56]!==n?(k=y&&t.jsx(ie,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(ms,{tools:n,connectionId:i,org:l})}),e[53]=i,e[54]=y,e[55]=l,e[56]=n,e[57]=k):k=e[57];let A;e[58]!==r?(A=r.length>0?r.map(fs):t.jsx(re,{label:"prompts"}),e[58]=r,e[59]=A):A=e[59];let U;e[60]!==A?(U=t.jsx(ie,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[60]=A,e[61]=U):U=e[61];let x;e[62]!==p?(x=p.length>0?p.map(ps):t.jsx(re,{label:"resources"}),e[62]=p,e[63]=x):x=e[63];let w;e[64]!==x?(w=t.jsx(ie,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:x})}),e[64]=x,e[65]=w):w=e[65];let O;return e[66]!==j||e[67]!==z||e[68]!==k||e[69]!==U||e[70]!==w?(O=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(Pt,{defaultValue:"tools",variant:"underline",children:[j,z,k,U,w]})}),e[66]=j,e[67]=z,e[68]=k,e[69]=U,e[70]=w,e[71]=O):O=e[71],O}function ps(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(ut,{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 fs(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($t,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Pe(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 hs(s){return de(s._meta)}function gs(s){const e=R.c(13),{connection:n,displayTitle:c}=s,a=c??n.title;let i;e[0]!==n.icon||e[1]!==a?(i=t.jsx(le,{icon:n.icon,name:a,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=a,e[2]=i):i=e[2];let l;e[3]!==a?(l=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]=l):l=e[4];let o;e[5]!==n.description?(o=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]=o):o=e[6];let r;e[7]!==l||e[8]!==o?(r=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,o]}),e[7]=l,e[8]=o,e[9]=r):r=e[9];let m;return e[10]!==i||e[11]!==r?(m=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:[i,r]}),e[10]=i,e[11]=r,e[12]=m):m=e[12],m}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:c,onRemoveOAuth:a}){const i=H(),l=ue({control:s.control,name:"ui_type"}),o=ue({control:s.control,name:"connection_url"}),{stdioEnabled:r}=ze(),m=(()=>{if(typeof o!="string"||!o)return!1;try{const u=new URL(o);return u.hostname==="api.githubcopilot.com"&&u.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),p=r||e.connection_type==="STDIO",d=e.connection_type==="VIRTUAL",f=d?qt(e.connection_url):null;return d?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:i("details.connectionSidebar.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(Te,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:i("details.connectionSidebar.virtualMcp")})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("details.connectionSidebar.virtualMcpDescription")})]}),f&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.virtualMcpId")}),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:f})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(G,{control:s.control,name:"ui_type",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.connection")}),l!=="NPX"&&l!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(pe,{value:u.value,onValueChange:u.onChange,children:[t.jsx(L,{children:t.jsxs(fe,{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(oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(he,{})]})}),t.jsxs(ge,{children:[t.jsx(X,{value:"HTTP",children:i("details.connectionSidebar.http")}),t.jsx(X,{value:"SSE",children:i("details.connectionSidebar.sse")}),t.jsx(X,{value:"Websocket",children:i("details.connectionSidebar.websocket")}),p&&t.jsxs(t.Fragment,{children:[t.jsx(X,{value:"NPX",children:i("details.connectionSidebar.npxPackage")}),t.jsx(X,{value:"STDIO",children:i("details.connectionSidebar.customCommand")})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(G,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(K,{className:"flex-1 min-w-0",children:t.jsx(L,{children:t.jsx(Y,{placeholder:i("details.connectionSidebar.urlPlaceholder"),...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(pe,{value:u.value,onValueChange:u.onChange,children:[t.jsx(L,{children:t.jsx(fe,{className:"h-10",children:t.jsx(he,{})})}),t.jsxs(ge,{children:[t.jsx(X,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(oe,{className:"w-4 h-4"}),i("details.connectionSidebar.http")]})}),t.jsx(X,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(oe,{className:"w-4 h-4"}),i("details.connectionSidebar.sse")]})}),t.jsx(X,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(oe,{className:"w-4 h-4"}),i("details.connectionSidebar.websocket")]})}),p&&t.jsxs(t.Fragment,{children:[t.jsx(X,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Bt,{className:"w-4 h-4"}),i("details.connectionSidebar.npxPackage")]})}),t.jsx(X,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(xt,{className:"w-4 h-4"}),i("details.connectionSidebar.customCommand")]})})]})]})]}),t.jsx(W,{})]})}),l==="NPX"&&t.jsx(G,{control:s.control,name:"npx_package",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.npmPackage")}),t.jsx(L,{children:t.jsx(Y,{placeholder:i("details.connectionSidebar.npmPackagePlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),l==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(G,{control:s.control,name:"stdio_command",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.command")}),t.jsx(L,{children:t.jsx(Y,{placeholder:i("details.connectionSidebar.commandPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(G,{control:s.control,name:"stdio_args",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.arguments")}),t.jsx(L,{children:t.jsx(Y,{placeholder:i("details.connectionSidebar.argumentsPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("details.connectionSidebar.spaceSeparatedArguments")}),t.jsx(W,{})]})})]}),t.jsx(G,{control:s.control,name:"stdio_cwd",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.workingDirectory")}),t.jsx(L,{children:t.jsx(Y,{placeholder:i("details.connectionSidebar.workingDirectoryPlaceholder"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(l==="NPX"||l==="STDIO")&&t.jsx(G,{control:s.control,name:"env_vars",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i("details.connectionSidebar.environmentVariables")}),t.jsx(L,{children:t.jsx(He,{value:u.value??[],onChange:u.onChange})}),t.jsx(W,{})]})}),l!=="NPX"&&l!=="STDIO"&&t.jsx(G,{control:s.control,name:"connection_token",render:({field:u})=>t.jsxs(K,{className:"flex flex-col gap-3",children:[t.jsx(Q,{className:"text-xs text-muted-foreground font-medium",children:i(m?"details.connectionSidebar.githubPersonalAccessToken":"details.connectionSidebar.token")}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Ut,{children:[t.jsx(Rt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Et,{variant:"success",className:"gap-1.5",children:[t.jsx(Ft,{size:12}),i("details.connectionSidebar.authenticatedViaOAuth"),t.jsx(Lt,{size:12})]})})}),t.jsxs(Vt,{align:"start",children:[t.jsxs(xe,{onClick:c,children:[t.jsx(pt,{size:16}),i("details.connectionSidebar.reauthenticate")]}),t.jsxs(xe,{variant:"destructive",onClick:a,children:[t.jsx(ce,{size:16}),i("details.connectionSidebar.removeOAuth")]})]})]})}):e.connection_token&&u.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:()=>u.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:i("details.connectionSidebar.clearAndReplaceToken"),"aria-label":i("details.connectionSidebar.clearAndReplaceToken"),children:t.jsx(Ht,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(L,{children:t.jsx(Y,{type:"password",placeholder:i(m?"details.connectionSidebar.pasteYourGitHubPat":"details.connectionSidebar.enterAccessToken"),...u,value:u.value||"",className:"h-10 rounded-lg"})}),m&&t.jsxs(vt,{children:[i("details.connectionSidebar.createAPatAt")," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function bs(s){return s.command==="npx"}function vs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Ns(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function je(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"&&Xt(s.connection_headers)){const c=s.connection_headers,a=Xe(c.envVars);if(bs(c)){const l=vs(c);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:a}}const i=Ns(c);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:i.command,stdio_args:i.args,stdio_cwd:i.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 Ss(s){let e,n=null,c=null,a=null;return s.ui_type==="NPX"?(e="STDIO",n="",a=Ge(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",a=Ke(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",c=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...c&&{connection_token:c},...a&&{connection_headers:a},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function ys({connection:s,connectionId:e,org:n,isUpdating:c,tools:a,prompts:i,resources:l,siblings:o}){const r=H(),m=se({from:"/$org/settings/connections/$appSlug"}),p=Ve(),d=_e(),{org:f}=te(),u=St({onSuccess:()=>{o.length<=1&&m({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=Z.useState(null),[N,S]=Z.useState(!1),b=ye({connectionId:e}),{data:y}=Ze(),P=y?.data?.members??[],$=h??s,_=P.find(x=>x.userId===$.created_by),T=s?.connection_type==="VIRTUAL"||b.isAuthenticated,D={...s,tools:a},I=Qe(D,Kt),v=Fe({resolver:Le(qe),values:je(h??s)}),j=v.formState.isDirty,E=async()=>{if(!await v.trigger())return;const w=v.getValues(),O=Ss(w),C=h?.id??e;await d.update.mutateAsync({id:C,data:O}),v.reset(w)},z=()=>{v.reset(je(h??s))},k=async x=>{const w=s.configuration_scopes?.length?s.configuration_scopes.join(" "):void 0,{token:O,tokenInfo:C,error:V}=await rt({connectionId:x,orgSlug:f.slug,...w?{scope:w}:{}});if(V||!O){J.error(r("details.connection.authFailed",{error:V??""}));return}if(C)try{const F=await fetch(`/api/${f.slug}/connections/${x}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:C.accessToken,refreshToken:C.refreshToken,expiresIn:C.expiresIn,scope:C.scope,clientId:C.clientId,clientSecret:C.clientSecret,tokenEndpoint:C.tokenEndpoint})});if(!F.ok)console.error("Failed to save OAuth token:",await F.text()),await d.update.mutateAsync({id:x,data:{connection_token:O}});else try{await d.update.mutateAsync({id:x,data:{}})}catch(ee){console.warn("Failed to refresh connection tools after OAuth:",ee)}}catch(F){console.error("Error saving OAuth token:",F),await d.update.mutateAsync({id:x,data:{connection_token:O}})}else await d.update.mutateAsync({id:x,data:{connection_token:O}});const q=new URL(`/api/${f.slug}/mcp/${x}`,window.location.origin);await p.invalidateQueries({queryKey:ae.isMCPAuthenticated(q.href,null)}),await p.invalidateQueries({queryKey:ae.mcpClientPrefix()}),J.success(r("details.connection.authSuccess"))},A=()=>k(s.id),U=async()=>{try{const x=await fetch(`/api/${f.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!x.ok){const O=await x.text();J.error(r("details.connection.failedRemoveOAuth",{error:O}));return}const w=new URL(`/api/${f.slug}/mcp/${s.id}`,window.location.origin);await p.invalidateQueries({queryKey:ae.isMCPAuthenticated(w.href,null)}),J.success(r("details.connection.oauthRemoved"))}catch(x){console.error("Error removing OAuth token:",x),J.error(r("details.connection.failedRemoveOAuthError"))}};return t.jsxs(t.Fragment,{children:[t.jsx(yt,{...u}),t.jsx(ft,{open:h!==null,onOpenChange:x=>{x||g(null)},children:t.jsxs(ht,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(gt,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(jt,{className:"text-base",children:h?.title??s.title}),t.jsx(bt,{className:"text-xs",children:r("details.connection.settingsDescription")}),_&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:r("details.connection.connectedBy")}),t.jsx(et,{url:_.user?.image??void 0,fallback:_.user?.name??_.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:_.user?.name||_.user?.email})]})]}),t.jsxs(Nt,{...v,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(G,{control:v.control,name:"title",render:({field:x})=>t.jsxs(K,{children:[t.jsx(Q,{children:r("details.connection.nameLabel")}),t.jsx(L,{children:t.jsx(Y,{...x})}),t.jsx(W,{})]})}),t.jsx(G,{control:v.control,name:"description",render:({field:x})=>t.jsxs(K,{children:[t.jsx(Q,{children:r("details.connection.descriptionLabel")}),t.jsx(L,{children:t.jsx(Y,{...x,value:x.value||""})}),t.jsx(W,{})]})})]}),t.jsx(js,{form:v,connection:h??s,hasOAuthToken:b.hasOAuthToken,onReauthenticate:A,onRemoveOAuth:U}),t.jsx(We,{connection:h??s,form:v,hasMcpBinding:I,isMCPAuthenticated:T,supportsOAuth:b.supportsOAuth,isServerError:b.isServerError,onAuthenticate:A,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(B,{onClick:E,disabled:!j||c,className:"flex-1",children:r(c?"details.connection.savingButton":"details.connection.saveButton")}),j&&t.jsx(B,{variant:"outline",onClick:z,children:r("details.connection.undoButton")}),t.jsxs(B,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const x=h??s;g(null),u.requestDelete(x)},children:[t.jsx(ce,{size:15}),r("details.connection.deleteButton")]})]})]},h?.id??s.id)]})}),t.jsx(Ye,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(gs,{connection:s,displayTitle:(()=>{const x=o[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(ls,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Yt,{instances:o,onConfigure:x=>g(x),onAuthenticate:x=>k(x.id),onDelete:x=>u.requestDelete(x),onToggleStatus:async(x,w)=>{try{await d.update.mutateAsync({id:x.id,data:{status:w}}),J.success(r(w==="active"?"details.connection.connectionEnabled":"details.connection.connectionDisabled"))}catch{J.error(r("details.connection.failedUpdateConnection"))}},isAdding:N,onAdd:async()=>{S(!0);try{const x=o[0]??s,w=x.title.replace(/\s*\(\d+\)\s*$/,""),O=o.length+1,C=`${w} (${O})`,V=Be("conn");await d.create.mutateAsync({id:V,title:C,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/${f.slug}/mcp/${V}`,window.location.origin),F=await lt({url:q.href,token:null,orgId:f.id});F.supportsOAuth&&!F.isAuthenticated&&await k(V)}finally{S(!1)}}}),t.jsx(ds,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(xs,{tools:a,prompts:i,resources:l,connectionId:e,org:n})})]})})]})})]})}function Cs(){const s=R.c(52),e=H();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/$org/settings/connections/$appSlug"},s[0]=n):n=s[0];const c=se(n);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:i,org:l}=Ue(a),{org:o}=te(),r=_e();let m;s[2]!==i?(m={slug:i},s[2]=i,s[3]=m):m=s[3];const p=tt(m),d=p[0]??null,f=d?.id??"",u=f||null;let h;s[4]!==o.id||s[5]!==o.slug||s[6]!==u?(h={connectionId:u,orgId:o.id,orgSlug:o.slug},s[4]=o.id,s[5]=o.slug,s[6]=u,s[7]=h):h=s[7];const g=we(h);let N;s[8]!==g?(N={client:g},s[8]=g,s[9]=N):N=s[9];const{data:S}=st(N);let b;if(s[10]!==d?.tools||s[11]!==f||s[12]!==p||s[13]!==S){const k=S?S.tools.map(As):(d?.tools??[]).map(Ts);e:{if(p.length<=1){b=k;break e}const A=new Set,U=[],x=ks;for(const w of p){const O=w.id===f?k:x(w.tools);for(const C of O)A.has(C.name)||(A.add(C.name),U.push(C))}b=U.length>0?U:k}s[10]=d?.tools,s[11]=f,s[12]=p,s[13]=S,s[14]=b}else b=s[14];const y=b;let P;s[15]!==g?(P={client:g},s[15]=g,s[16]=P):P=s[16];const{data:$}=at(P);let _;s[17]!==g?(_={client:g},s[17]=g,s[18]=_):_=s[18];const{data:M}=Re(_);let T;s[19]!==$?.prompts?(T=$?.prompts??[],s[19]=$?.prompts,s[20]=T):T=s[20];let D;s[21]!==T?(D=T.map(ws),s[21]=T,s[22]=D):D=s[22];const I=D;let v;s[23]!==M?.resources?(v=M?.resources??[],s[23]=M?.resources,s[24]=v):v=s[24];let j;s[25]!==v?(j=v.map(_s),s[25]=v,s[26]=j):j=s[26];const E=j;if(!d){let k;s[27]!==e?(k=e("details.connection.notFoundTitle"),s[27]=e,s[28]=k):k=s[28];let A;s[29]!==e?(A=e("details.connection.notFoundDescription"),s[29]=e,s[30]=A):A=s[30];let U;s[31]!==c||s[32]!==l?(U=()=>c({to:"/$org/settings/connections",params:{org:l}}),s[31]=c,s[32]=l,s[33]=U):U=s[33];let x;s[34]!==e?(x=e("details.connection.backButton"),s[34]=e,s[35]=x):x=s[35];let w;s[36]!==U||s[37]!==x?(w=t.jsx(B,{variant:"outline",onClick:U,children:x}),s[36]=U,s[37]=x,s[38]=w):w=s[38];let O;return s[39]!==k||s[40]!==A||s[41]!==w?(O=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Se,{title:k,description:A,actions:w})}),s[39]=k,s[40]=A,s[41]=w,s[42]=O):O=s[42],O}let z;return s[43]!==r.update.isPending||s[44]!==y||s[45]!==d||s[46]!==f||s[47]!==l||s[48]!==I||s[49]!==E||s[50]!==p?(z=t.jsx(ys,{org:l,connection:d,connectionId:f,isUpdating:r.update.isPending,tools:y,prompts:I,resources:E,siblings:p}),s[43]=r.update.isPending,s[44]=y,s[45]=d,s[46]=f,s[47]=l,s[48]=I,s[49]=E,s[50]=p,s[51]=z):z=s[51],z}function _s(s){return{name:s.name,description:s.description,uri:s.uri}}function ws(s){return{name:s.name,description:s.description}}function ks(s){return(s??[]).map(Is)}function Is(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ts(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function As(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ps(){const s=R.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ee,{children:t.jsx(Z.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(ve,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Cs,{})})}),s[0]=e):e=s[0],e}function Ci(){const s=R.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Ps,{}),s[0]=e):e=s[0],e}export{Ci as default};