decocms 4.415.0 → 4.415.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 (350) hide show
  1. package/dist/client/assets/{AlertCircle-CvaSOOO8.js → AlertCircle-Bqol85qP.js} +1 -1
  2. package/dist/client/assets/{AreaChart-C1zWMN3A.js → AreaChart-dnE7B6T2.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-BsqlBCdi.js → ArrowLeft-CZdQboxt.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-B6VZdTtP.js → ArrowRight-C8iQ6E3r.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-C1c3cSMN.js → ArrowUp-Bnu1QNUF.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-DT33HVeq.js → CartesianChart-GhIj77hH.js} +1 -1
  7. package/dist/client/assets/{Check-ClKm876e.js → Check-BSlvOf7_.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-B38I9lsp.js → CheckCircle-CZJznvqf.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-BBBSFlle.js → ChevronUp-73K8mm8O.js} +1 -1
  10. package/dist/client/assets/{Copy01-kb1901QR.js → Copy01-TAU83rpm.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-DkYuXaNf.js → CreditCard01-C1MMT-pt.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-OXZ2C8qE.js → DotsVertical-D_1q-hun.js} +1 -1
  13. package/dist/client/assets/{ErrorBarContext-CSFQ9ttu.js → ErrorBarContext-Bfx3MhL2.js} +1 -1
  14. package/dist/client/assets/{Image01-xbxm22_Y.js → Image01-D1A2pgAE.js} +1 -1
  15. package/dist/client/assets/{Key01-ZIYydTtn.js → Key01-DLn9A4zc.js} +1 -1
  16. package/dist/client/assets/{Line-C_txxRhK.js → Line-D5C39_DJ.js} +1 -1
  17. package/dist/client/assets/{Link01-cXYRJQde.js → Link01-EhpAe5I7.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-UxTfoueY.js → LinkExternal01-DrnuQ7il.js} +1 -1
  19. package/dist/client/assets/{Monitor01-CINH3FWT.js → Monitor01-BKyPX68x.js} +1 -1
  20. package/dist/client/assets/{Palette-C2svjF4J.js → Palette-BSZveuhh.js} +1 -1
  21. package/dist/client/assets/{Plus-Bv10xzXZ.js → Plus-ho6b-a71.js} +1 -1
  22. package/dist/client/assets/{SearchMd-DRAIsS0-.js → SearchMd-CSaF80bm.js} +1 -1
  23. package/dist/client/assets/{Sector-TihpQ2pX.js → Sector-CAAElJSY.js} +1 -1
  24. package/dist/client/assets/{ShoppingBag01-DsBku-zP.js → ShoppingBag01-BDEy6t0O.js} +1 -1
  25. package/dist/client/assets/{Sun-CJOAGa8i.js → Sun-Dhz2yLmo.js} +1 -1
  26. package/dist/client/assets/{Tool01-gY-gdMF4.js → Tool01-BjGNbYgZ.js} +1 -1
  27. package/dist/client/assets/{Trash01-DUhLvzYZ.js → Trash01-DC_GXkbG.js} +1 -1
  28. package/dist/client/assets/{Upload01-BsdejHE0.js → Upload01-DgOQWkJ-.js} +1 -1
  29. package/dist/client/assets/{User01-B4dCU7oy.js → User01-XDft3hB1.js} +1 -1
  30. package/dist/client/assets/{UserSquare-BA1qsXhU.js → UserSquare-CQDuMh03.js} +1 -1
  31. package/dist/client/assets/{Users01-BLSNtVXz.js → Users01-C_VfPREJ.js} +1 -1
  32. package/dist/client/assets/{X-BTpPaU7c.js → X-DR8wuPFF.js} +1 -1
  33. package/dist/client/assets/{XAxis-Cj_1oR4W.js → XAxis-DjIPVnRF.js} +1 -1
  34. package/dist/client/assets/{XClose-DnZUIdlK.js → XClose-Bd7dO8fP.js} +1 -1
  35. package/dist/client/assets/{ZoomOut-DvQpsf4w.js → ZoomOut-BKR2rudO.js} +1 -1
  36. package/dist/client/assets/{access-gate-BYf0rE33.js → access-gate-CQd8T6G1.js} +1 -1
  37. package/dist/client/assets/{add-connection-dialog-BdXnmDrQ.js → add-connection-dialog-C8LGEpWI.js} +1 -1
  38. package/dist/client/assets/{agent-analytics-DQZgiL7L.js → agent-analytics-BU9_Gzsk.js} +1 -1
  39. package/dist/client/assets/agent-app-DWLFcLCh.js +1 -0
  40. package/dist/client/assets/{agent-assets-B-r7ioGn.js → agent-assets-BIeQoJSs.js} +1 -1
  41. package/dist/client/assets/{agent-automation-BkxL2BIZ.js → agent-automation-DuDKfO9s.js} +1 -1
  42. package/dist/client/assets/{agent-automations-pf_bDZZ5.js → agent-automations-CYw0bf3z.js} +1 -1
  43. package/dist/client/assets/{agent-connect-sources-Do412j4U.js → agent-connect-sources-CUjIaQKw.js} +1 -1
  44. package/dist/client/assets/agent-deck-EdKUX8Oe.js +1 -0
  45. package/dist/client/assets/{agent-e2e-Db1tY-Py.js → agent-e2e-x7Wg7IKg.js} +1 -1
  46. package/dist/client/assets/{agent-experiments-a-194CZ0.js → agent-experiments-Cefwpq5-.js} +1 -1
  47. package/dist/client/assets/{agent-file-DcPThm01.js → agent-file-BF6EjoG0.js} +1 -1
  48. package/dist/client/assets/{agent-git-I5DAbFxV.js → agent-git-DxXGctfG.js} +1 -1
  49. package/dist/client/assets/{agent-hosting-8wURqYK1.js → agent-hosting-JyjeJBB2.js} +1 -1
  50. package/dist/client/assets/{agent-icon-BvDKYGuI.js → agent-icon-Rfg09hGF.js} +1 -1
  51. package/dist/client/assets/agent-library-Ducf9hH_.js +1 -0
  52. package/dist/client/assets/agent-library-file-DGGK_4Kw.js +1 -0
  53. package/dist/client/assets/{agent-monitor-DU5E9xAR.js → agent-monitor-CmxOkFa1.js} +1 -1
  54. package/dist/client/assets/{agent-overview-BBH7XkKk.js → agent-overview-VRKCc4yk.js} +1 -1
  55. package/dist/client/assets/agent-settings-BykcKxgx.js +1 -0
  56. package/dist/client/assets/{agent-site-editor-DSbFppgh.js → agent-site-editor-Dv4jIAEQ.js} +1 -1
  57. package/dist/client/assets/agent-site-editor-code-CvH60LKP.js +2 -0
  58. package/dist/client/assets/{agent-site-editor-content-C6CyUicz.js → agent-site-editor-content-BQxlxFb9.js} +3 -3
  59. package/dist/client/assets/{agent-site-editor-preview-Bm6vi5GO.js → agent-site-editor-preview-BgrJifUR.js} +3 -3
  60. package/dist/client/assets/agent-view-BwSRK-TG.js +1 -0
  61. package/dist/client/assets/{agent-view-guard-BHFZQ084.js → agent-view-guard-q4rJmoWz.js} +1 -1
  62. package/dist/client/assets/{agents-list-BmcrOH9K.js → agents-list-BHmfxRsv.js} +1 -1
  63. package/dist/client/assets/{ai-providers-D07lihCf.js → ai-providers-WROSK0tx.js} +1 -1
  64. package/dist/client/assets/{alert-CbVRyYdn.js → alert-BrT7FI8U.js} +1 -1
  65. package/dist/client/assets/{alert-dialog-D5AYweb7.js → alert-dialog-C_ia0v-T.js} +1 -1
  66. package/dist/client/assets/{analytics-sections-C7kQuinp.js → analytics-sections-DKdBpWqu.js} +1 -1
  67. package/dist/client/assets/api-keys-CSq24AGj.js +1 -0
  68. package/dist/client/assets/{api-keys-CRcL5tuf.js → api-keys-CyqgAi9e.js} +1 -1
  69. package/dist/client/assets/app-editor-3o544TQ0.js +1 -0
  70. package/dist/client/assets/{asset-utils-DxlUH6fM.js → asset-utils-C26a2JHG.js} +1 -1
  71. package/dist/client/assets/{auth-DqmsEfIB.js → auth-Cfwd0y9y.js} +1 -1
  72. package/dist/client/assets/{auth-catchall-BMmDsnzK.js → auth-catchall-CY2-LIZW.js} +1 -1
  73. package/dist/client/assets/{auth-entry-B26Aq39u.js → auth-entry-Buo-1j2Q.js} +1 -1
  74. package/dist/client/assets/{auth-split-layout-D5nNb-G8.js → auth-split-layout-B17wOE6U.js} +1 -1
  75. package/dist/client/assets/{authenticate-and-persist-oauth-CtghXoSr.js → authenticate-and-persist-oauth-CCVjqHA9.js} +1 -1
  76. package/dist/client/assets/{automation-list-row-CkyFpQMb.js → automation-list-row-Doy8t1lJ.js} +1 -1
  77. package/dist/client/assets/{automation-runs-CoqjOPyS.js → automation-runs-Nik2sL36.js} +1 -1
  78. package/dist/client/assets/{automations-2UeJll3f.js → automations-DMTamZeN.js} +1 -1
  79. package/dist/client/assets/{autosend-D__v3v-c.js → autosend-lDvHtcmx.js} +1 -1
  80. package/dist/client/assets/{avatar-JoRElFKl.js → avatar-Bq5gB0rE.js} +1 -1
  81. package/dist/client/assets/{badge-B0yp_bFb.js → badge-B-ifLvy2.js} +1 -1
  82. package/dist/client/assets/{block-document-iObAvspI.js → block-document-C9d5VuS4.js} +1 -1
  83. package/dist/client/assets/{blocks-preview-workspace-context-CroMcTkl.js → blocks-preview-workspace-context-CXY-HArE.js} +1 -1
  84. package/dist/client/assets/{buckets-CdF9xMMp.js → buckets-D-lmwYFz.js} +1 -1
  85. package/dist/client/assets/{build-improve-prompt-doc-CXnpM7kh.js → build-improve-prompt-doc-DygJIQv6.js} +1 -1
  86. package/dist/client/assets/{calendar-_lAvk6Nt.js → calendar-HyqP8AXI.js} +1 -1
  87. package/dist/client/assets/{capability-load-error-8qZRldzC.js → capability-load-error-DidLkEv2.js} +1 -1
  88. package/dist/client/assets/{category-editor-fWmRfYwN.js → category-editor-zz5fkuKU.js} +1 -1
  89. package/dist/client/assets/{chart-B8A_E9YA.js → chart-CiFQ4o9k.js} +1 -1
  90. package/dist/client/assets/{chat-context-DCpRbJmR.js → chat-context-Cdshwjxx.js} +1 -1
  91. package/dist/client/assets/{chat-draft-BiPOqsxD.js → chat-draft-Dtd_y636.js} +1 -1
  92. package/dist/client/assets/{checkbox-DYn5BX_y.js → checkbox-A9vbl5N2.js} +1 -1
  93. package/dist/client/assets/{choose-editor-9psJgCK3.js → choose-editor-DWSnTY1q.js} +1 -1
  94. package/dist/client/assets/{claim-phase-copy-CaNBNXR7.js → claim-phase-copy-CSmlBy_u.js} +1 -1
  95. package/dist/client/assets/{cli-auth-success-B-HmvL0Z.js → cli-auth-success-uGPt4RR5.js} +1 -1
  96. package/dist/client/assets/{client-icons-DRAmgBv8.js → client-icons-DCdKqKh7.js} +1 -1
  97. package/dist/client/assets/{collapsible-Bg1MAa8S.js → collapsible-BNlD6piJ.js} +1 -1
  98. package/dist/client/assets/{collection-detail-CzcE81KP.js → collection-detail-DIQIXcws.js} +1 -1
  99. package/dist/client/assets/{collection-display-button-BbOo6z7N.js → collection-display-button-B4F4NuGj.js} +1 -1
  100. package/dist/client/assets/{collection-search-EssCGlF9.js → collection-search-BM2Lz3HG.js} +1 -1
  101. package/dist/client/assets/{collection-table-wrapper-BktaVXNL.js → collection-table-wrapper-BBbRZ-sE.js} +1 -1
  102. package/dist/client/assets/{collection-tabs-C2dMZ-Yz.js → collection-tabs-B96E7Ndf.js} +1 -1
  103. package/dist/client/assets/{combobox-DnOhf0WD.js → combobox-CNmGZtRX.js} +1 -1
  104. package/dist/client/assets/{command-DljL6hzf.js → command-DqzoonN7.js} +1 -1
  105. package/dist/client/assets/{companion-mcps-section-DHfjmvo2.js → companion-mcps-section-DaaOLCKh.js} +1 -1
  106. package/dist/client/assets/{config-BRt8XM2Q.js → config-DhLzGz0Q.js} +1 -1
  107. package/dist/client/assets/{connect-COAAkNAe.js → connect-BLNaAUsr.js} +1 -1
  108. package/dist/client/assets/{connect-layout-D_XB9JJD.js → connect-layout-DyUvah3K.js} +1 -1
  109. package/dist/client/assets/{connection-DZucsf0o.js → connection-Capqx7Hm.js} +1 -1
  110. package/dist/client/assets/{connection-card-DrvsNBSo.js → connection-card-Bh68fEmz.js} +1 -1
  111. package/dist/client/assets/{connection-detail-DELb5RqN.js → connection-detail-4EeLDzCY.js} +1 -1
  112. package/dist/client/assets/{connection-form-helpers-BOYwqVWG.js → connection-form-helpers-RXL-2Q9h.js} +1 -1
  113. package/dist/client/assets/{connections-BTjmigpS.js → connections-DrGAyi4a.js} +1 -1
  114. package/dist/client/assets/{context-t3HzYqzN.js → context-DYxH7qKk.js} +1 -1
  115. package/dist/client/assets/{create-organization-dialog-BCIcZ5Ce.js → create-organization-dialog-BdEaQLKC.js} +1 -1
  116. package/dist/client/assets/{decopilot-BbS9GPYA.js → decopilot-ZrvnUxTe.js} +1 -1
  117. package/dist/client/assets/{dialog-CfIoHDlJ.js → dialog-Ba2vgagi.js} +1 -1
  118. package/dist/client/assets/{discover-C6NL6AwE.js → discover-BzGhO68G.js} +1 -1
  119. package/dist/client/assets/{domain-settings-I8HFU1tc.js → domain-settings-Cxh7ABQR.js} +1 -1
  120. package/dist/client/assets/{download-app-dialog-bvP5yIID.js → download-app-dialog-CakfWg8s.js} +1 -1
  121. package/dist/client/assets/{drawer-gbdrTv3r.js → drawer-DXEx5yyN.js} +1 -1
  122. package/dist/client/assets/{editor-CUtbeyZe.js → editor-uqwCXw8d.js} +1 -1
  123. package/dist/client/assets/{empty-state-B7JCSTCX.js → empty-state-0ljd3qMo.js} +1 -1
  124. package/dist/client/assets/{empty-state-B_xAVz84.js → empty-state-B8yQ4LTw.js} +1 -1
  125. package/dist/client/assets/{extract-connection-data-CHpjURut.js → extract-connection-data-CRiVhO97.js} +1 -1
  126. package/dist/client/assets/{feature-gate-CSCbG-02.js → feature-gate-BaKUeg7M.js} +1 -1
  127. package/dist/client/assets/{feature-paywall-BK6fjPbO.js → feature-paywall-BvvNBNus.js} +1 -1
  128. package/dist/client/assets/{file-explorer-BEA-kxcu.js → file-explorer-BiKuKWne.js} +1 -1
  129. package/dist/client/assets/{file-preview-Bk7_4BhT.js → file-preview-ir4qboU4.js} +1 -1
  130. package/dist/client/assets/{file-share-button-CtEMEEnP.js → file-share-button-BFKMx0qi.js} +1 -1
  131. package/dist/client/assets/{file-type-icon-C_2K-vjQ.js → file-type-icon-SChsqlUb.js} +1 -1
  132. package/dist/client/assets/flat-project-Csc8OGw5.js +1 -0
  133. package/dist/client/assets/{folder-icon-D2srQ6r8.js → folder-icon-BmfCCiyY.js} +1 -1
  134. package/dist/client/assets/{form-Bw-12Nua.js → form-ha0IykgA.js} +1 -1
  135. package/dist/client/assets/{gateway-client-DDRZPNgE.js → gateway-client-B_QMUgPU.js} +1 -1
  136. package/dist/client/assets/{general-DFurEwpf.js → general-Da57Idav.js} +1 -1
  137. package/dist/client/assets/{github-repo-22x8y8Tm.js → github-repo-DTfdF7MX.js} +1 -1
  138. package/dist/client/assets/{home-BEfet_Bo.js → home-BX15tlba.js} +1 -1
  139. package/dist/client/assets/{index-CBJQH72Z.js → index--xKwr46l.js} +1 -1
  140. package/dist/client/assets/{index-BBn8QmOY.js → index-B1pbiLcT.js} +1 -1
  141. package/dist/client/assets/{index-BBClJhS5.js → index-BBvi5ZKp.js} +1 -1
  142. package/dist/client/assets/{index-BGw3HTPr.js → index-BuJdLyY2.js} +1 -1
  143. package/dist/client/assets/{index-DRvgWruv.js → index-C4QCa7dU.js} +1 -1
  144. package/dist/client/assets/{index-CP9MPNu2.js → index-CJYm3aw9.js} +1 -1
  145. package/dist/client/assets/{index-B1gW_UZi.js → index-CP014nih.js} +1 -1
  146. package/dist/client/assets/{index-DTVMnS9R.js → index-CWQlXxCn.js} +1 -1
  147. package/dist/client/assets/{index-CdYIy8eY.js → index-CXHXXhYp.js} +1 -1
  148. package/dist/client/assets/{index-C23QqnY4.js → index-CheJ8E2q.js} +1 -1
  149. package/dist/client/assets/{index-Ccktnu9A.js → index-DTZ19s2b.js} +1 -1
  150. package/dist/client/assets/{index-oPco2Z7Q.js → index-DYh8jrbk.js} +2 -2
  151. package/dist/client/assets/{index-Ty5Jzwnf.js → index-DZMv998-.js} +3 -3
  152. package/dist/client/assets/{index-Cc_Zqhkn.js → index-DcaY_K7p.js} +1 -1
  153. package/dist/client/assets/{index-TvCpAFy_.js → index-DijCA0CZ.js} +1 -1
  154. package/dist/client/assets/{index-redirect-D8rObEfr.js → index-redirect-Cuulz0gD.js} +1 -1
  155. package/dist/client/assets/{infiniteQueryObserver-BiKAGWol.js → infiniteQueryObserver-BkKvUns9.js} +1 -1
  156. package/dist/client/assets/{infra-billing-DM30eRIB.js → infra-billing-BtNHn-1d.js} +1 -1
  157. package/dist/client/assets/{input-MYwET4H0.js → input-BNlT9quL.js} +1 -1
  158. package/dist/client/assets/{input-ZcuegaFq.js → input-DsFifC6J.js} +1 -1
  159. package/dist/client/assets/{input-Dk8ExXFi.js → input-syo4eEVO.js} +1 -1
  160. package/dist/client/assets/{integration-icon-cSotbhTg.js → integration-icon-DZnTns_u.js} +1 -1
  161. package/dist/client/assets/{label-9S9F78nK.js → label-BWDINIlA.js} +1 -1
  162. package/dist/client/assets/{last-preview-page-BqZ-yKjx.js → last-preview-page-CTMIe7ab.js} +1 -1
  163. package/dist/client/assets/{layout-XmYuHyUp.js → layout-DKGxdDJD.js} +1 -1
  164. package/dist/client/assets/{legacy-agents-deep-Cos55l5T.js → legacy-agents-deep-D0vSEzFX.js} +1 -1
  165. package/dist/client/assets/{legacy-main-redirect-SvbBzQfx.js → legacy-main-redirect-BMywkj-T.js} +1 -1
  166. package/dist/client/assets/library-DzzbMujS.js +1 -0
  167. package/dist/client/assets/{library-tab-jc2e6zcQ.js → library-tab-gan-tNS0.js} +1 -1
  168. package/dist/client/assets/{login-Dk9tmaQV.js → login-BoK-SeZU.js} +1 -1
  169. package/dist/client/assets/{markdown-D8NZ8Hcx.js → markdown-C3jerHNB.js} +1 -1
  170. package/dist/client/assets/{mcp-app-renderer-CMM_xZGY.js → mcp-app-renderer-CC_S_a_B.js} +1 -1
  171. package/dist/client/assets/{mcp-oauth-Rwm2gO51.js → mcp-oauth-BtZRk9Yo.js} +1 -1
  172. package/dist/client/assets/{members-C7CWAgRC.js → members-VzW9_ePb.js} +1 -1
  173. package/dist/client/assets/{message-templates-LZ9bQOkh.js → message-templates-aCabPzWH.js} +1 -1
  174. package/dist/client/assets/{mini-report-page-Djd5YLq-.js → mini-report-page-CedFoFlA.js} +1 -1
  175. package/dist/client/assets/{mock-board-wLpRW8bx.js → mock-board-CUf2GEkF.js} +1 -1
  176. package/dist/client/assets/{monaco-editor-gMJT6cpK.js → monaco-editor-d7DnpOxG.js} +1 -1
  177. package/dist/client/assets/{monitoring-stats-row-DGiOnVB-.js → monitoring-stats-row-Koy58Lui.js} +1 -1
  178. package/dist/client/assets/{multi-select-CgJiEc6d.js → multi-select-B0hrvhs6.js} +1 -1
  179. package/dist/client/assets/{mustache-C_QlIzWy.js → mustache-DuBkSpdL.js} +1 -1
  180. package/dist/client/assets/{new-project-dialog-BaZdnvse.js → new-project-dialog-DRIWpl2f.js} +1 -1
  181. package/dist/client/assets/{oauth-callback-DKlgv_Gu.js → oauth-callback-BCfigflG.js} +1 -1
  182. package/dist/client/assets/{oauth-callback-ai-provider-bpHWEFSR.js → oauth-callback-ai-provider-BslAlxmv.js} +1 -1
  183. package/dist/client/assets/{onboarding-BCfoU2BS.js → onboarding-DliDyH0Q.js} +1 -1
  184. package/dist/client/assets/{optimistic-project-sidebar-views-CmwJxzI1.js → optimistic-project-sidebar-views-BREwX6ob.js} +1 -1
  185. package/dist/client/assets/{org-file-open-context-Bv73tl5K.js → org-file-open-context-CU_S-C_X.js} +1 -1
  186. package/dist/client/assets/{organization-choice-1eorpCYU.js → organization-choice-B6xcF8-0.js} +1 -1
  187. package/dist/client/assets/{orgs-zhbMCzP-.js → orgs-JaNeDlTV.js} +1 -1
  188. package/dist/client/assets/{page-seo-form-CshajZtl.js → page-seo-form-COUSOoCz.js} +1 -1
  189. package/dist/client/assets/{pair-C-k8zr2J.js → pair-_VplT8eM.js} +1 -1
  190. package/dist/client/assets/{plan-ladder-BlKhVXlg.js → plan-ladder-EZ5r6Ch6.js} +1 -1
  191. package/dist/client/assets/{popover-BgkxtrX7.js → popover-mQuRv-90.js} +1 -1
  192. package/dist/client/assets/{post-calendar-B-WdFfky.js → post-calendar-DXTz5WNR.js} +1 -1
  193. package/dist/client/assets/{post-editor-CsDksmyM.js → post-editor-bgMqyE6Y.js} +1 -1
  194. package/dist/client/assets/{preview-content-C6mifSrd.js → preview-content-B1hRpwwD.js} +1 -1
  195. package/dist/client/assets/{preview-dialog-CIYvMHEx.js → preview-dialog-Ck_kyk_m.js} +1 -1
  196. package/dist/client/assets/{profile-C0w8Yfz5.js → profile-BOFOVvX4.js} +1 -1
  197. package/dist/client/assets/{project-app-view-Sevz3SK2.js → project-app-view-BqduDxdj.js} +1 -1
  198. package/dist/client/assets/{project-feed-BMtZcRjf.js → project-feed-D_vVsrME.js} +1 -1
  199. package/dist/client/assets/{project-icon-C29pLjaM.js → project-icon-BuYXFzTe.js} +1 -1
  200. package/dist/client/assets/project-reports-Bk7FUrOx.js +1 -0
  201. package/dist/client/assets/project-tasks-C3w3D-o_.js +1 -0
  202. package/dist/client/assets/{projects-B_9wM2AG.js → projects-Cl4R05so.js} +1 -1
  203. package/dist/client/assets/{projects-empty-state-D2roHEQS.js → projects-empty-state-Cg2vcAzM.js} +1 -1
  204. package/dist/client/assets/{prompts-SqPXo2ej.js → prompts-Cg76SeKd.js} +1 -1
  205. package/dist/client/assets/record-editor-6YmiCLt4.js +1 -0
  206. package/dist/client/assets/{redirect-editor-BROySec3.js → redirect-editor-Xxu0v32-.js} +1 -1
  207. package/dist/client/assets/{reports-BAoHRlcZ.js → reports-C20QDwQR.js} +1 -1
  208. package/dist/client/assets/reports-_K0Dl6Nr.js +1 -0
  209. package/dist/client/assets/{reports-onboarding-DuXWRm1J.js → reports-onboarding-Bylm0eKe.js} +1 -1
  210. package/dist/client/assets/{reports-tab-BTG8fjPp.js → reports-tab-9vFBtepP.js} +2 -2
  211. package/dist/client/assets/{repositories-dyiTYnan.js → repositories-vQ9Vb9Ky.js} +1 -1
  212. package/dist/client/assets/{repository-import-picker-OR5DGZp9.js → repository-import-picker-BZwQ92-3.js} +1 -1
  213. package/dist/client/assets/{repository-picker-BSwi4b8i.js → repository-picker-BWH2DKse.js} +1 -1
  214. package/dist/client/assets/{require-capability-Bqc8OMTK.js → require-capability-Cd4opY5J.js} +1 -1
  215. package/dist/client/assets/{required-auth-layout-Byop8Zzr.js → required-auth-layout-DkNhaT70.js} +1 -1
  216. package/dist/client/assets/{reset-password-BJ7ek2C_.js → reset-password-CouVezNl.js} +1 -1
  217. package/dist/client/assets/{resizable-3VTCAPsm.js → resizable-CD43QXeP.js} +1 -1
  218. package/dist/client/assets/{resolve-tab-icon-CmlW-pVX.js → resolve-tab-icon-BI2IAC-a.js} +1 -1
  219. package/dist/client/assets/{review-settings-DV0Kgix-.js → review-settings-DB4qaq4O.js} +1 -1
  220. package/dist/client/assets/{rich-text-link-control-DHguSqou.js → rich-text-link-control-ZEvlqv9c.js} +1 -1
  221. package/dist/client/assets/{roles-BddVa5rc.js → roles-B-jUOObz.js} +1 -1
  222. package/dist/client/assets/{route-Dv07Kl62.js → route-Cl2J3vbL.js} +1 -1
  223. package/dist/client/assets/{route-BTyvu5tm.js → route-DJUoPoGA.js} +1 -1
  224. package/dist/client/assets/route-HQLXY5ju.js +1 -0
  225. package/dist/client/assets/{runnable-block-editor-Do2tVSLe.js → runnable-block-editor-LZ2NV8Ax.js} +1 -1
  226. package/dist/client/assets/{sandbox-lifecycle-context-DqykpNrC.js → sandbox-lifecycle-context-CNw-li2a.js} +1 -1
  227. package/dist/client/assets/{schema-DN-s_HG6.js → schema-o_jhA4fR.js} +1 -1
  228. package/dist/client/assets/{scroll-area--yTJQfnp.js → scroll-area-CZS9UzKT.js} +1 -1
  229. package/dist/client/assets/{search-input-BNUWPEYj.js → search-input-DwpeRojH.js} +1 -1
  230. package/dist/client/assets/{search-toggle-QxOnD3UE.js → search-toggle-SbhljuuK.js} +1 -1
  231. package/dist/client/assets/{secret-picker-B-IAzUKw.js → secret-picker-BM9Rpe3x.js} +1 -1
  232. package/dist/client/assets/{secrets-BfsxO5FG.js → secrets-Bbtk8tx8.js} +1 -1
  233. package/dist/client/assets/{sections-editor-BSMpRRaP.js → sections-editor-9mM0W4lG.js} +1 -1
  234. package/dist/client/assets/{select-BSSRUEpK.js → select-CESqWIsK.js} +1 -1
  235. package/dist/client/assets/{select-model-BpoA_wtD.js → select-model-ALBeFPxg.js} +1 -1
  236. package/dist/client/assets/{seo-editor-BLMg-jAb.js → seo-editor-B-_AisIc.js} +1 -1
  237. package/dist/client/assets/{separator-B-ZEExAQ.js → separator-DOKdBZ38.js} +1 -1
  238. package/dist/client/assets/{settings-tab-Bjk0NW75.js → settings-tab-DsUBZNY_.js} +1 -1
  239. package/dist/client/assets/{sheet--8zhfSHm.js → sheet-B_2FUYhi.js} +1 -1
  240. package/dist/client/assets/{shell-layout-DE5WStxe.js → shell-layout-BCElSRO4.js} +1 -1
  241. package/dist/client/assets/{skills-5oEukgyq.js → skills-VqbDXx4d.js} +1 -1
  242. package/dist/client/assets/{sso-p_1To1BG.js → sso-BPZ6dOPM.js} +1 -1
  243. package/dist/client/assets/{suggestion-tikPUWB4.js → suggestion-CfXuQ4pU.js} +1 -1
  244. package/dist/client/assets/{switch-XXcZ9CO9.js → switch-_C4M_ZrZ.js} +1 -1
  245. package/dist/client/assets/{synced-repos-6N09TwCW.js → synced-repos-_o0lz_iq.js} +1 -1
  246. package/dist/client/assets/{tab-icon-glyph-Cg30pNjq.js → tab-icon-glyph-OR8dA_Kn.js} +1 -1
  247. package/dist/client/assets/{table-UDk1rGCz.js → table-HoIyclpJ.js} +1 -1
  248. package/dist/client/assets/{tabs-DddEqGpk.js → tabs-IWApKLiP.js} +1 -1
  249. package/dist/client/assets/{task-board-BQC0qjBI.js → task-board-rnBU3FLl.js} +1 -1
  250. package/dist/client/assets/{task-route-BIVpLzI_.js → task-route-DUF0m5P8.js} +1 -1
  251. package/dist/client/assets/{task-status-5qx4S30L.js → task-status-D51dYEPZ.js} +1 -1
  252. package/dist/client/assets/{taskboard-analytics-BUkhCXum.js → taskboard-analytics-BTH8IzxR.js} +1 -1
  253. package/dist/client/assets/tasks-CC_4v7F1.js +1 -0
  254. package/dist/client/assets/{tasks-B2IZJpCB.js → tasks-CpFp-zAc.js} +1 -1
  255. package/dist/client/assets/{textarea-mkcrN5g-.js → textarea-CXlCMzII.js} +1 -1
  256. package/dist/client/assets/{thread-analytics-BL_w94D4.js → thread-analytics-CM8AbRlg.js} +1 -1
  257. package/dist/client/assets/{thread-button-DwWAsFW7.js → thread-button-CUHBmoeS.js} +1 -1
  258. package/dist/client/assets/{thread-intent-1MB6k5b2.js → thread-intent-C1H9D-w3.js} +1 -1
  259. package/dist/client/assets/{thread-route-CRhZ1osu.js → thread-route-6FYoSQS4.js} +1 -1
  260. package/dist/client/assets/{thread-route-BCeXxLYH.js → thread-route-DZziHzlw.js} +1 -1
  261. package/dist/client/assets/{thread-sheet-body-Bo7LPBv_.js → thread-sheet-body-Cxn5Bxw_.js} +1 -1
  262. package/dist/client/assets/{toggle-group-Cz7RSOBM.js → toggle-group-ulsVl8zq.js} +1 -1
  263. package/dist/client/assets/{toolbar-icon-button-CiJmHymh.js → toolbar-icon-button-45s1dUbT.js} +1 -1
  264. package/dist/client/assets/{tooltip-CF6AcK-h.js → tooltip-DU10eEii.js} +1 -1
  265. package/dist/client/assets/{track-OWWDrnQ-.js → track-d6psVZBn.js} +1 -1
  266. package/dist/client/assets/{types-C-gwtfMH.js → types-Czpy3NYR.js} +1 -1
  267. package/dist/client/assets/{usage-stats-CBSbrOk_.js → usage-stats-DbKesrc3.js} +1 -1
  268. package/dist/client/assets/{use-ai-providers-B1JZFVlj.js → use-ai-providers-Dn4jlMQb.js} +1 -1
  269. package/dist/client/assets/{use-automations-D_9NQm3c.js → use-automations-DT5ENulf.js} +1 -1
  270. package/dist/client/assets/{use-autosave-DlgDe-Tc.js → use-autosave-BULQgUfB.js} +1 -1
  271. package/dist/client/assets/{use-chat-layout-state-D4JUtDU_.js → use-chat-layout-state-aruazlXE.js} +1 -1
  272. package/dist/client/assets/{use-connect-companion-DeEhFjbg.js → use-connect-companion-BzEl1w7X.js} +1 -1
  273. package/dist/client/assets/{use-connection-BSRKwy2j.js → use-connection-Bn3u4YFa.js} +1 -1
  274. package/dist/client/assets/{use-copy-BOgEqZMm.js → use-copy-C_Wew7Mn.js} +1 -1
  275. package/dist/client/assets/{use-create-virtual-mcp-zRgZOr46.js → use-create-virtual-mcp-SSR12wYH.js} +1 -1
  276. package/dist/client/assets/{use-date-fns-locale-DLQqaR-J.js → use-date-fns-locale-BkKND_24.js} +1 -1
  277. package/dist/client/assets/{use-debounced-autosave-D_28bChm.js → use-debounced-autosave-DB41iTRk.js} +1 -1
  278. package/dist/client/assets/{use-debounced-value-DD9mnPT_.js → use-debounced-value-Bq9LfhRE.js} +1 -1
  279. package/dist/client/assets/{use-deco-credits-BVTpTeQe.js → use-deco-credits-32GU51-w.js} +1 -1
  280. package/dist/client/assets/{use-decopilot-events-DrrVrYNR.js → use-decopilot-events-DHVidSSW.js} +1 -1
  281. package/dist/client/assets/{use-delete-connection-XxANt-J1.js → use-delete-connection-DbQuawQj.js} +1 -1
  282. package/dist/client/assets/{use-deployment-admin-2URfC53G.js → use-deployment-admin-QeMz2iFG.js} +1 -1
  283. package/dist/client/assets/{use-fast-preview-draft-url-DEazNknV.js → use-fast-preview-draft-url-DQZYiNRY.js} +1 -1
  284. package/dist/client/assets/{use-file-configs-CoaidzsY.js → use-file-configs-BNOKbqVK.js} +1 -1
  285. package/dist/client/assets/{use-infinite-scroll-BPqj-R_X.js → use-infinite-scroll-2J1tSu4c.js} +1 -1
  286. package/dist/client/assets/{use-join-requests-Drw7IeW0.js → use-join-requests-BQ507A6R.js} +1 -1
  287. package/dist/client/assets/{use-main-panel-tabs-qFkwsuao.js → use-main-panel-tabs-BE2crGLJ.js} +1 -1
  288. package/dist/client/assets/{use-mcp-auth-status-CZ-0Pvu1.js → use-mcp-auth-status-DVpm61QU.js} +1 -1
  289. package/dist/client/assets/{use-mcp-client-DDH2Tr05.js → use-mcp-client-DBWYx08Y.js} +1 -1
  290. package/dist/client/assets/{use-mcp-prompts-CogjK1bQ.js → use-mcp-prompts-D3a-zrUV.js} +1 -1
  291. package/dist/client/assets/{use-mcp-tools-B7MXLlq3.js → use-mcp-tools-DpzBxN7Q.js} +1 -1
  292. package/dist/client/assets/{use-members-BLvVhz4X.js → use-members-Dx-JJjXk.js} +1 -1
  293. package/dist/client/assets/{use-mobile-BCSnRACa.js → use-mobile-ykFv5E3U.js} +1 -1
  294. package/dist/client/assets/{use-navigate-to-agent-DYNDpstL.js → use-navigate-to-agent-CC80E6EN.js} +1 -1
  295. package/dist/client/assets/use-new-blocks-editor-DjHyMTUf.js +1 -0
  296. package/dist/client/assets/{use-open-billing-url-Dq7moyEm.js → use-open-billing-url-BYK9KI-H.js} +1 -1
  297. package/dist/client/assets/{use-org-auth-client-BaoVl8Zl.js → use-org-auth-client-DJDEA4cQ.js} +1 -1
  298. package/dist/client/assets/{use-org-fs-gM-Wauv_.js → use-org-fs-GZosBvnR.js} +1 -1
  299. package/dist/client/assets/{use-org-repo-syncs-DFgGELdf.js → use-org-repo-syncs-BmH0-tVJ.js} +1 -1
  300. package/dist/client/assets/{use-org-sso-GwZiS-qS.js → use-org-sso-DDf1oeLj.js} +1 -1
  301. package/dist/client/assets/{use-organization-roles-CqvDOd51.js → use-organization-roles-DJLh2PW3.js} +1 -1
  302. package/dist/client/assets/{use-organization-settings-mKOaKHuY.js → use-organization-settings-xOFyKmIY.js} +1 -1
  303. package/dist/client/assets/{use-panel-navigate-CQHE_TAW.js → use-panel-navigate-BzX6F8y5.js} +1 -1
  304. package/dist/client/assets/{use-project-native-view-presence-CjADt2wx.js → use-project-native-view-presence-B9zdY3NQ.js} +1 -1
  305. package/dist/client/assets/{use-project-scope-UozAP0t-.js → use-project-scope-DkA7Grxb.js} +1 -1
  306. package/dist/client/assets/{use-releases-D-iqlxR6.js → use-releases-C-Ta-7vs.js} +1 -1
  307. package/dist/client/assets/{use-reports-diagnostic-CknaDfb_.js → use-reports-diagnostic-BFVOD9v5.js} +1 -1
  308. package/dist/client/assets/{use-secrets-Bl8vA-cD.js → use-secrets-DmpswS6q.js} +1 -1
  309. package/dist/client/assets/{use-section-preview-base-BqbdcWw1.js → use-section-preview-base-hMfmG-cI.js} +1 -1
  310. package/dist/client/assets/{use-session-runtime-B5XfJc8H.js → use-session-runtime-B4UjKYp3.js} +1 -1
  311. package/dist/client/assets/{use-tags-C0g04rDb.js → use-tags-CWMa80Uq.js} +1 -1
  312. package/dist/client/assets/{use-task-board-analytics-DQMIr-R3.js → use-task-board-analytics-CL7Mh6SQ.js} +1 -1
  313. package/dist/client/assets/{use-task-metadata--2QUxhiK.js → use-task-metadata-CRQNmyQD.js} +1 -1
  314. package/dist/client/assets/{use-thread-analytics-CVoZDp6i.js → use-thread-analytics-C_F4Tt7K.js} +1 -1
  315. package/dist/client/assets/{use-thread-outputs-CYriWIIs.js → use-thread-outputs-Bo2DQFtV.js} +1 -1
  316. package/dist/client/assets/useInfiniteQuery-CpktDy71.js +1 -0
  317. package/dist/client/assets/{useQueries-tUSXojRG.js → useQueries-8as0tXSz.js} +1 -1
  318. package/dist/client/assets/useSuspenseInfiniteQuery-9HixzRgg.js +1 -0
  319. package/dist/client/assets/{users-DFvmfIoV.js → users-DEhVIHhI.js} +1 -1
  320. package/dist/client/assets/{utils-BaPwSBi2.js → utils-R5Z0jv6u.js} +1 -1
  321. package/dist/client/assets/{variant-calendar-sxqpD_Oi.js → variant-calendar-CuMVPUo6.js} +1 -1
  322. package/dist/client/assets/{variant-matcher-override-C-94qzoj.js → variant-matcher-override-Ea2ccMaX.js} +1 -1
  323. package/dist/client/assets/{view-mode-toggle-DrlZskFH.js → view-mode-toggle-CyYOjvOb.js} +1 -1
  324. package/dist/client/assets/{virtual-mcp-DBFF2brO.js → virtual-mcp-De5MSXcr.js} +1 -1
  325. package/dist/client/index.html +1 -1
  326. package/dist/server/cli.js +143 -143
  327. package/dist/server/migrate-dbos.js +1 -1
  328. package/dist/server/migrate.js +5 -5
  329. package/dist/server/server.js +134 -134
  330. package/package.json +1 -1
  331. package/dist/client/assets/agent-app-C7k2151J.js +0 -1
  332. package/dist/client/assets/agent-deck-CYuHMzf-.js +0 -1
  333. package/dist/client/assets/agent-library-DP9jULfe.js +0 -1
  334. package/dist/client/assets/agent-library-file-C2CuO8zG.js +0 -1
  335. package/dist/client/assets/agent-settings-DBkRHp58.js +0 -1
  336. package/dist/client/assets/agent-site-editor-code-CGBlhTFD.js +0 -2
  337. package/dist/client/assets/agent-view-iS5vUDqd.js +0 -1
  338. package/dist/client/assets/api-keys-DrGX-MFg.js +0 -1
  339. package/dist/client/assets/app-editor-BH13ZfO_.js +0 -1
  340. package/dist/client/assets/flat-project-Bp2uxu0m.js +0 -1
  341. package/dist/client/assets/library-DwuPF4v9.js +0 -1
  342. package/dist/client/assets/project-reports-DLR8Px_E.js +0 -1
  343. package/dist/client/assets/project-tasks-BpKda9bF.js +0 -1
  344. package/dist/client/assets/record-editor-DwoOuklP.js +0 -1
  345. package/dist/client/assets/reports-7388ESEV.js +0 -1
  346. package/dist/client/assets/route-wKh3eUlH.js +0 -1
  347. package/dist/client/assets/tasks-JL_Q5QmF.js +0 -1
  348. package/dist/client/assets/use-new-blocks-editor-DGdBBbiW.js +0 -1
  349. package/dist/client/assets/useInfiniteQuery-U12d5VJc.js +0 -1
  350. package/dist/client/assets/useSuspenseInfiniteQuery-B912YJiX.js +0 -1
@@ -1,4 +1,4 @@
1
- import{c as H,b as X,r as G,j as t,B as se,h as Xe,l as fe,I as gs,F as vs,H as bs,G as Ke,aR as Ut,aS as Yt,aT as Bt,t as re,X as Ae,E as Re,Z as js,e_ as en,L as ys,ab as tn,s as sn,dX as He,af as Kt,aa as nn,dW as Le,dV as Be,a2 as ot,m as an,K as ws,e$ as ln,f0 as rn,f1 as on,aU as he,f2 as Ce,n as ze,P as cn,d as Mt,u as dn,q as ge,c$ as un,ai as mn,eJ as fn,f3 as pn,aP as hn,a as xn,f4 as Ss,f5 as gn,aE as vn,a6 as bn,o as jn,an as yn,am as wn,f6 as Sn,as as Nn}from"./index-oPco2Z7Q.js";import{g as Cn}from"./extract-connection-data-CHpjURut.js";import{a as Mn}from"./chat-context-DCpRbJmR.js";import{U as _n,b as kn}from"./build-improve-prompt-doc-CXnpM7kh.js";import{E as Tn}from"./empty-state-B_xAVz84.js";import{a as Dn}from"./shell-layout-DE5WStxe.js";import{g as ct,n as Vn,a as Wt,e as An,u as In,f as On}from"./use-date-fns-locale-DLQqaR-J.js";import{a as _t,b as Ns,u as Pn}from"./use-connection-BSRKwy2j.js";import{b as Cs,a as Ms,e as _s,g as ks,k as $n}from"./github-repo-22x8y8Tm.js";import{a as En,i as Gt}from"./mcp-oauth-Rwm2gO51.js";import{f as Fn,e as zn,b as Rn,A as Ln,a as Un,d as Yn,c as Bn,g as Kn}from"./alert-dialog-D5AYweb7.js";import{D as Je,b as Ze,c as dt,d as ut,e as Ts,h as Wn}from"./dialog-CfIoHDlJ.js";import{T as it}from"./textarea-mkcrN5g-.js";import{b as je,T as ye,a as we}from"./tooltip-CF6AcK-h.js";import{n as Gn}from"./LinkExternal01-UxTfoueY.js";import{b8 as Hn,l as qn,b9 as Qn,ba as Xn,aL as Jn,au as Zn,aA as kt,bb as Tt,bc as Ds,ah as Dt,bd as wt,j as ei,g as Vs,m as Ht,n as ti,q as si,p as ni,f as As,be as qt,bf as ii,bg as Is,bh as gt,bi as Qt,A as Xt,E as ai,bj as li,bk as ri,N as oi,W as ci,aJ as di,a7 as ui,an as mi}from"./agent-icon-BvDKYGuI.js";import{s as $e}from"./Plus-Bv10xzXZ.js";import{t as nt,a as fi}from"./Tool01-gY-gdMF4.js";import{s as Vt}from"./Trash01-DUhLvzYZ.js";import{u as Jt}from"./use-debounced-autosave-D_28bChm.js";import{A as pi}from"./add-connection-dialog-BdXnmDrQ.js";import{i as at}from"./SearchMd-DRAIsS0-.js";import{F as Zt}from"./file-type-icon-C_2K-vjQ.js";import{i as hi,h as xi,m as gi,o as vi}from"./use-org-fs-gM-Wauv_.js";import{I as Ge}from"./integration-icon-cSotbhTg.js";import{C as Os}from"./checkbox-DYn5BX_y.js";import{S as bi}from"./search-input-BNUWPEYj.js";import{b as ke,a as Te,c as xe,d as De,S as Ve}from"./select-BSSRUEpK.js";import{s as At}from"./XClose-DnZUIdlK.js";import{C as ji}from"./collection-tabs-C2dMZ-Yz.js";import{T as Ps,u as $s}from"./use-mcp-auth-status-CZ-0Pvu1.js";import{u as mt}from"./use-mcp-client-DDH2Tr05.js";import{a as Es}from"./use-mcp-tools-B7MXLlq3.js";import{u as yi}from"./use-mcp-prompts-CogjK1bQ.js";import{g as wi}from"./connection-slug-CITJ0kGN.js";import{t as St}from"./utils-CVEq3hMx.js";import{I as Me}from"./input-MYwET4H0.js";import{S as ft}from"./switch-XXcZ9CO9.js";import{P as It,a as Ot,b as Pt}from"./popover-BgkxtrX7.js";import{S as Fs}from"./scroll-area--yTJQfnp.js";import{i as Si}from"./DotsVertical-OXZ2C8qE.js";import{a as Ni}from"./Image01-xbxm22_Y.js";import{i as Ci}from"./Monitor01-CINH3FWT.js";import{g as Mi}from"./types-C-gwtfMH.js";import{b as lt,g as _i,d as ki}from"./use-project-scope-UozAP0t-.js";import{a as Ti}from"./use-panel-navigate-CQHE_TAW.js";import{u as Di}from"./use-project-native-view-presence-CjADt2wx.js";import{e as Nt,r as Ct,p as Vi,j as Ai,s as Ii,k as Oi,l as Pi,a as $i}from"./use-chat-layout-state-D4JUtDU_.js";import{a as zs,u as Ei,i as Fi,o as zi,r as es,p as Ri,w as Li,b as ts}from"./optimistic-project-sidebar-views-CmwJxzI1.js";import{i as Ui}from"./Upload01-BsdejHE0.js";import{i as Yi}from"./Link01-cXYRJQde.js";import{V as Bi,E as pt,r as Rs,C as Ki,w as Wi}from"./virtual-mcp-DBFF2brO.js";import{s as Ls}from"./slugify-CEUa2lfQ.js";import{b as Gi,a as Hi,D as qi}from"./drawer-gbdrTv3r.js";import{u as Qi}from"./use-mobile-BCSnRACa.js";import{i as et}from"./Check-ClKm876e.js";import{a as ht}from"./Copy01-kb1901QR.js";import{i as $t}from"./Key01-ZIYydTtn.js";import{d as tt}from"./backoff-8mStPHYB.js";import{R as Xi}from"./repository-import-picker-OR5DGZp9.js";import{b as Ji}from"./sandbox-url-D3mC8qhT.js";import{L as ve}from"./label-9S9F78nK.js";import{S as Zi,a as ea,b as ta}from"./secret-picker-B-IAzUKw.js";import{u as sa,a as na}from"./use-secrets-Bl8vA-cD.js";import{o as ss}from"./omit-sandbox-map-jj4lCB2U.js";import{G as ia}from"./repository-picker-BSwi4b8i.js";import{p as aa,s as la,f as ra}from"./thread-intent-1MB6k5b2.js";import{r as oa}from"./serial-task-queue-CGOeQgpr.js";import{t as Ie,c as We,m as ca,a as Us}from"./differenceInSeconds-C3x8sHUj.js";function Qe(a,e){const n=ct(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ie(a,e?.in),l=i.getDay(),o=(l<s?7:0)+l-s;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function rt(a,e){return Qe(a,{...e,weekStartsOn:1})}function Ys(a,e){const n=Ie(a,e?.in),s=n.getFullYear(),i=We(n,0);i.setFullYear(s+1,0,4),i.setHours(0,0,0,0);const l=rt(i),o=We(n,0);o.setFullYear(s,0,4),o.setHours(0,0,0,0);const r=rt(o);return n.getTime()>=l.getTime()?s+1:n.getTime()>=r.getTime()?s:s-1}function ns(a,e){const n=Ie(a,e?.in);return n.setHours(0,0,0,0),n}function da(a,e,n){const[s,i]=Vn(n?.in,a,e),l=ns(s),o=ns(i),r=+l-Wt(l),h=+o-Wt(o);return Math.round((r-h)/ca)}function ua(a,e){const n=Ys(a,e),s=We(a,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),rt(s)}function ma(a){return a instanceof Date||typeof a=="object"&&Object.prototype.toString.call(a)==="[object Date]"}function fa(a){return!(!ma(a)&&typeof a!="number"||isNaN(+Ie(a)))}function pa(a,e){const n=Ie(a,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ha(a,e){const n=Ie(a,e?.in);return da(n,pa(n))+1}function xa(a,e){const n=Ie(a,e?.in),s=+rt(n)-+ua(n);return Math.round(s/Us)+1}function Bs(a,e){const n=Ie(a,e?.in),s=n.getFullYear(),i=ct(),l=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=We(e?.in||a,0);o.setFullYear(s+1,0,l),o.setHours(0,0,0,0);const r=Qe(o,e),h=We(e?.in||a,0);h.setFullYear(s,0,l),h.setHours(0,0,0,0);const c=Qe(h,e);return+n>=+r?s+1:+n>=+c?s:s-1}function ga(a,e){const n=ct(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Bs(a,e),l=We(e?.in||a,0);return l.setFullYear(i,0,s),l.setHours(0,0,0,0),Qe(l,e)}function va(a,e){const n=Ie(a,e?.in),s=+Qe(n,e)-+ga(n,e);return Math.round(s/Us)+1}function le(a,e){const n=a<0?"-":"",s=Math.abs(a).toString().padStart(e,"0");return n+s}const Pe={y(a,e){const n=a.getFullYear(),s=n>0?n:1-n;return le(e==="yy"?s%100:s,e.length)},M(a,e){const n=a.getMonth();return e==="M"?String(n+1):le(n+1,2)},d(a,e){return le(a.getDate(),e.length)},a(a,e){const n=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(a,e){return le(a.getHours()%12||12,e.length)},H(a,e){return le(a.getHours(),e.length)},m(a,e){return le(a.getMinutes(),e.length)},s(a,e){return le(a.getSeconds(),e.length)},S(a,e){const n=e.length,s=a.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return le(i,e.length)}},Ye={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},is={G:function(a,e,n){const s=a.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});default:return n.era(s,{width:"wide"})}},y:function(a,e,n){if(e==="yo"){const s=a.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return Pe.y(a,e)},Y:function(a,e,n,s){const i=Bs(a,s),l=i>0?i:1-i;if(e==="YY"){const o=l%100;return le(o,2)}return e==="Yo"?n.ordinalNumber(l,{unit:"year"}):le(l,e.length)},R:function(a,e){const n=Ys(a);return le(n,e.length)},u:function(a,e){const n=a.getFullYear();return le(n,e.length)},Q:function(a,e,n){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return le(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(a,e,n){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return le(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(a,e,n){const s=a.getMonth();switch(e){case"M":case"MM":return Pe.M(a,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(a,e,n){const s=a.getMonth();switch(e){case"L":return String(s+1);case"LL":return le(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(a,e,n,s){const i=va(a,s);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):le(i,e.length)},I:function(a,e,n){const s=xa(a);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):le(s,e.length)},d:function(a,e,n){return e==="do"?n.ordinalNumber(a.getDate(),{unit:"date"}):Pe.d(a,e)},D:function(a,e,n){const s=ha(a);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):le(s,e.length)},E:function(a,e,n){const s=a.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(a,e,n,s){const i=a.getDay(),l=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(l);case"ee":return le(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(a,e,n,s){const i=a.getDay(),l=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(l);case"cc":return le(l,e.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(a,e,n){const s=a.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return le(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(a,e,n){const i=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(a,e,n){const s=a.getHours();let i;switch(s===12?i=Ye.noon:s===0?i=Ye.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(a,e,n){const s=a.getHours();let i;switch(s>=17?i=Ye.evening:s>=12?i=Ye.afternoon:s>=4?i=Ye.morning:i=Ye.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(a,e,n){if(e==="ho"){let s=a.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Pe.h(a,e)},H:function(a,e,n){return e==="Ho"?n.ordinalNumber(a.getHours(),{unit:"hour"}):Pe.H(a,e)},K:function(a,e,n){const s=a.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):le(s,e.length)},k:function(a,e,n){let s=a.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):le(s,e.length)},m:function(a,e,n){return e==="mo"?n.ordinalNumber(a.getMinutes(),{unit:"minute"}):Pe.m(a,e)},s:function(a,e,n){return e==="so"?n.ordinalNumber(a.getSeconds(),{unit:"second"}):Pe.s(a,e)},S:function(a,e){return Pe.S(a,e)},X:function(a,e,n){const s=a.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return ls(s);case"XXXX":case"XX":return Fe(s);default:return Fe(s,":")}},x:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"x":return ls(s);case"xxxx":case"xx":return Fe(s);default:return Fe(s,":")}},O:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+as(s,":");default:return"GMT"+Fe(s,":")}},z:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+as(s,":");default:return"GMT"+Fe(s,":")}},t:function(a,e,n){const s=Math.trunc(+a/1e3);return le(s,e.length)},T:function(a,e,n){return le(+a,e.length)}};function as(a,e=""){const n=a>0?"-":"+",s=Math.abs(a),i=Math.trunc(s/60),l=s%60;return l===0?n+String(i):n+String(i)+e+le(l,2)}function ls(a,e){return a%60===0?(a>0?"-":"+")+le(Math.abs(a)/60,2):Fe(a,e)}function Fe(a,e=""){const n=a>0?"-":"+",s=Math.abs(a),i=le(Math.trunc(s/60),2),l=le(s%60,2);return n+i+e+l}const rs=(a,e)=>{switch(a){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Ks=(a,e)=>{switch(a){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},ba=(a,e)=>{const n=a.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return rs(a,e);let l;switch(s){case"P":l=e.dateTime({width:"short"});break;case"PP":l=e.dateTime({width:"medium"});break;case"PPP":l=e.dateTime({width:"long"});break;default:l=e.dateTime({width:"full"});break}return l.replace("{{date}}",rs(s,e)).replace("{{time}}",Ks(i,e))},ja={p:Ks,P:ba},ya=/^D+$/,wa=/^Y+$/,Sa=["D","DD","YY","YYYY"];function Na(a){return ya.test(a)}function Ca(a){return wa.test(a)}function Ma(a,e,n){const s=_a(a,e,n);if(console.warn(s),Sa.includes(a))throw new RangeError(s)}function _a(a,e,n){const s=a[0]==="Y"?"years":"days of the month";return`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ka=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ta=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Da=/^'([^]*?)'?$/,Va=/''/g,Aa=/[a-zA-Z]/;function Ia(a,e,n){const s=ct(),i=n?.locale??s.locale??An,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,r=Ie(a,n?.in);if(!fa(r))throw new RangeError("Invalid time value");let h=e.match(Ta).map(m=>{const f=m[0];if(f==="p"||f==="P"){const u=ja[f];return u(m,i.formatLong)}return m}).join("").match(ka).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const f=m[0];if(f==="'")return{isToken:!1,value:Oa(m)};if(is[f])return{isToken:!0,value:m};if(f.match(Aa))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(h=i.localize.preprocessor(r,h));const c={firstWeekContainsDate:l,weekStartsOn:o,locale:i};return h.map(m=>{if(!m.isToken)return m.value;const f=m.value;(!n?.useAdditionalWeekYearTokens&&Ca(f)||!n?.useAdditionalDayOfYearTokens&&Na(f))&&Ma(f,e,String(a));const u=is[f[0]];return u(r,f,i.localize,c)}).join("")}function Oa(a){const e=a.match(Da);return e?e[1].replace(Va,"'"):a}const Ws=25*1024*1024,vt="home",bt="knowledge";function os(a){return a==null?"":a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(0)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Ee(a){return a.split("/").pop()??a}function Pa(a){const e=H.c(64),{form:n}=a,s=X(),{upload:i}=hi(vt),l=xi(),o=G.useRef(null),[r,h]=G.useState(!1),[c,m]=G.useState(""),[f,u]=G.useState(!1);let d;e[0]!==r?(d={enabled:r},e[0]=r,e[1]=d):d=e[1];const{data:p}=gi(60,d),x=p===void 0?[]:p;let g;e[2]!==r?(g={enabled:r},e[2]=r,e[3]=g):g=e[3];const{data:b}=vi(g),y=b===void 0?[]:b;let j;e[4]!==n?(j=()=>n.getValues("metadata.knowledge")??[],e[4]=n,e[5]=j):j=e[5];const[v,S]=G.useState(j);let C;e[6]!==n?(C=P=>{S(P),n.setValue("metadata.knowledge",P,{shouldDirty:!0})},e[6]=n,e[7]=C):C=e[7];const M=C;let w;e[8]!==l||e[9]!==v||e[10]!==M||e[11]!==s||e[12]!==i?(w=async P=>{if(!P||P.length===0)return;const Z=Array.from(P),oe=Z.filter(Ua),Ne=Z.filter(La);if(Ne.length>0&&re.warning(s("virtualMcp.filesSection.fileTooLargeTitle"),{description:s("virtualMcp.filesSection.fileTooLargeDescription",{names:Ne.map(Ra).join(", ")})}),oe.length!==0){try{await i.mutateAsync({dir:bt,files:oe})}catch(be){const Oe=be;re.error(Oe instanceof Error?Oe.message:s("virtualMcp.filesSection.failedUploadFile"));return}M([...v,...oe.map(be=>({id:crypto.randomUUID(),name:be.name,volume:vt,path:`${bt}/${be.name}`,url:l(vt,`${bt}/${be.name}`),contentType:be.type||null,size:be.size,addedAt:new Date().toISOString()}))])}},e[8]=l,e[9]=v,e[10]=M,e[11]=s,e[12]=i,e[13]=w):w=e[13];const N=w;let _;e[14]!==l||e[15]!==v||e[16]!==M?(_=P=>{v.some(Z=>Z.volume===P.volume&&Z.path===P.path)||(M([...v,{id:crypto.randomUUID(),name:Ee(P.path),volume:P.volume,path:P.path,url:l(P.volume,P.path),contentType:null,size:P.size??null,addedAt:new Date().toISOString()}]),h(!1))},e[14]=l,e[15]=v,e[16]=M,e[17]=_):_=e[17];const D=_;let T;e[18]!==l||e[19]!==v||e[20]!==M?(T=P=>{v.some(Z=>Z.volume===P.volume&&Z.path===P.path)||(M([...v,{id:crypto.randomUUID(),name:Ee(P.path),kind:"skill",volume:P.volume,path:P.path,url:l(P.volume,P.path),contentType:null,size:null,addedAt:new Date().toISOString()}]),h(!1))},e[18]=l,e[19]=v,e[20]=M,e[21]=T):T=e[21];const A=T;let V;e[22]!==v||e[23]!==M?(V=P=>{M(v.filter(Z=>Z.id!==P))},e[22]=v,e[23]=M,e[24]=V):V=e[24];const F=V;let I;e[25]===Symbol.for("react.memo_cache_sentinel")?(I=P=>{h(P),P&&m("")},e[25]=I):I=e[25];const O=I;let z;e[26]!==v?(z=new Set(v.map(za)),e[26]=v,e[27]=z):z=e[27];const q=z,Y=c.toLowerCase();let K;e[28]!==q?(K=P=>!q.has(`${P.volume}/${P.path}`),e[28]=q,e[29]=K):K=e[29];const L=x.filter(Fa).filter(K).filter(P=>Ee(P.path).toLowerCase().includes(Y)).slice(0,5);let k;e[30]!==q?(k=P=>!q.has(`${P.volume}/${P.path}`),e[30]=q,e[31]=k):k=e[31];const $=y.filter(k).filter(P=>Ee(P.path).toLowerCase().includes(Y)).slice(0,5),W=P=>t.jsxs(gs,{open:r,onOpenChange:O,children:[t.jsx(vs,{asChild:!0,children:P}),t.jsxs(bs,{align:"end",className:"w-56",children:[t.jsxs(Ke,{onSelect:()=>{o.current?.click()},children:[t.jsx(Hn,{size:16}),s("virtualMcp.filesSection.uploadFile")]}),t.jsxs(Ut,{children:[t.jsxs(Yt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(qn,{size:16}),s("virtualMcp.filesSection.selectFileOrFolder")]}),t.jsxs(Bt,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(at,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:c,onChange:Z=>m(Z.target.value),onKeyDown:Ea,placeholder:s("virtualMcp.filesSection.searchFilesPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:L.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:s("virtualMcp.filesSection.noFilesFound")}):L.map(Z=>t.jsxs(Ke,{onSelect:()=>D(Z),children:[t.jsx(Zt,{filename:Ee(Z.path),className:"h-5 w-4 shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ee(Z.path)}),Z.size!=null&&t.jsx("span",{className:"text-xs text-muted-foreground",children:os(Z.size)})]},`${Z.volume}/${Z.path}`))})]})]}),t.jsxs(Ut,{children:[t.jsxs(Yt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(nt,{size:16}),s("virtualMcp.filesSection.selectSkill")]}),t.jsxs(Bt,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(at,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:c,onChange:Z=>m(Z.target.value),onKeyDown:$a,placeholder:s("virtualMcp.filesSection.searchSkillsPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:$.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:s("virtualMcp.filesSection.noSkillsFound")}):$.map(Z=>t.jsxs(Ke,{onSelect:()=>A(Z),children:[t.jsx(nt,{size:16,className:"shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ee(Z.path)})]},`${Z.volume}/${Z.path}`))})]})]})]})]}),U="flex flex-col gap-3";let R;e[32]!==s?(R=s("virtualMcp.filesSection.filesAndSkills"),e[32]=s,e[33]=R):R=e[33];let B;e[34]!==R?(B=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:R}),e[34]=R,e[35]=B):B=e[35];let J;e[36]!==s?(J=s("virtualMcp.filesSection.description"),e[36]=s,e[37]=J):J=e[37];let ie;e[38]!==J?(ie=t.jsx("p",{className:"text-sm text-muted-foreground",children:J}),e[38]=J,e[39]=ie):ie=e[39];let ee;e[40]!==B||e[41]!==ie?(ee=t.jsxs("div",{className:"flex flex-col gap-1",children:[B,ie]}),e[40]=B,e[41]=ie,e[42]=ee):ee=e[42];const ce=v.length>0&&W(t.jsxs(se,{variant:"outline",size:"sm",disabled:i.isPending,children:[i.isPending?t.jsx(Xe,{size:"xs"}):t.jsx($e,{size:14}),s("virtualMcp.filesSection.add")]}));let de;e[43]!==ee||e[44]!==ce?(de=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[ee,ce]}),e[43]=ee,e[44]=ce,e[45]=de):de=e[45];let ue;e[46]!==N?(ue=t.jsx("input",{ref:o,type:"file",multiple:!0,className:"hidden",onChange:P=>{N(P.target.files),P.target.value=""}}),e[46]=N,e[47]=ue):ue=e[47];let te,pe;e[48]===Symbol.for("react.memo_cache_sentinel")?(te=P=>{P.preventDefault(),u(!0)},pe=()=>u(!1),e[48]=te,e[49]=pe):(te=e[48],pe=e[49]);let me;e[50]!==N?(me=P=>{P.preventDefault(),P.stopPropagation(),u(!1),N(P.dataTransfer.files)},e[50]=N,e[51]=me):me=e[51];const Se=f&&"outline outline-2 outline-dashed outline-primary";let E;e[52]!==Se?(E=fe("flex flex-col gap-2 rounded-lg",Se),e[52]=Se,e[53]=E):E=e[53];const ne=v.length===0?W(t.jsxs("button",{type:"button",className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx($e,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:s("virtualMcp.filesSection.noFilesOrSkillsYet")})]})):v.map(P=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-card",children:[P.kind==="skill"?t.jsx("div",{className:"flex items-center justify-center h-8 w-6.5 shrink-0 rounded-md bg-muted text-muted-foreground",children:t.jsx(nt,{size:16})}):t.jsx(Zt,{filename:P.name,className:"h-8 w-6.5 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:P.kind==="skill"?s("virtualMcp.filesSection.kindSkill"):P.size!=null?os(P.size):s("virtualMcp.filesSection.kindFile")})]}),t.jsx(se,{variant:"ghost",size:"icon",onClick:()=>F(P.id),"aria-label":s("virtualMcp.filesSection.removeAriaLabel",{name:P.name}),children:t.jsx(Vt,{size:16})})]},P.id));let Q;e[54]!==te||e[55]!==pe||e[56]!==me||e[57]!==E||e[58]!==ne?(Q=t.jsx("div",{onDragOver:te,onDragLeave:pe,onDrop:me,className:E,children:ne}),e[54]=te,e[55]=pe,e[56]=me,e[57]=E,e[58]=ne,e[59]=Q):Q=e[59];let ae;return e[60]!==de||e[61]!==ue||e[62]!==Q?(ae=t.jsxs("section",{className:U,children:[de,ue,Q]}),e[60]=de,e[61]=ue,e[62]=Q,e[63]=ae):ae=e[63],ae}function $a(a){return a.stopPropagation()}function Ea(a){return a.stopPropagation()}function Fa(a){return a.kind!=="dir"}function za(a){return`${a.volume}/${a.path}`}function Ra(a){return a.name}function La(a){return a.size>Ws}function Ua(a){return a.size<=Ws}function Ya(a){return a==null?"all":a.length===0?"self":"selected"}function Ba(a){const e=H.c(88),{form:n,currentAgentId:s}=a,i=X(),{org:l}=Ae(),o=Cs(),[r,h]=G.useState(!1);let c;e[0]!==n?(c=n.getValues("metadata.subAgents")??null,e[0]=n,e[1]=c):c=e[1];const m=c;let f;e[2]!==m?(f=()=>Ya(m),e[2]=m,e[3]=f):f=e[3];const[u,d]=G.useState(f);let p;e[4]!==m?(p=m??[],e[4]=m,e[5]=p):p=e[5];const[x,g]=G.useState(p);let b,y,j,v,S,C;if(e[6]!==o||e[7]!==s||e[8]!==n||e[9]!==u||e[10]!==l||e[11]!==x||e[12]!==i){let _;e[19]!==s||e[20]!==l?(_=te=>te.id!==s&&te.id!==l.id&&te.status==="active",e[19]=s,e[20]=l,e[21]=_):_=e[21],b=o.filter(_);let D;e[22]!==x?(D=te=>x.includes(te.id),e[22]=x,e[23]=D):D=e[23];const T=b.filter(D);let A;e[24]!==n?(A=(te,pe)=>n.setValue("metadata.subAgents",te==="all"?null:te==="self"?[]:pe,{shouldDirty:!0}),e[24]=n,e[25]=A):A=e[25];const V=A;let F;e[26]!==V||e[27]!==x?(F=te=>{d(te),V(te,x)},e[26]=V,e[27]=x,e[28]=F):F=e[28];const I=F;let O;e[29]!==V||e[30]!==x?(O=te=>{const pe=x.includes(te)?x.filter(me=>me!==te):[...x,te];g(pe),V("selected",pe)},e[29]=V,e[30]=x,e[31]=O):O=e[31],y=O,S="flex flex-col gap-3";let z;e[32]!==i?(z=i("virtualMcp.subAgentsSection.title"),e[32]=i,e[33]=z):z=e[33];let q;e[34]!==z?(q=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:z}),e[34]=z,e[35]=q):q=e[35];let Y;e[36]!==u||e[37]!==i?(Y=u==="all"&&t.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canDelegateToAnyAgent")}),e[36]=u,e[37]=i,e[38]=Y):Y=e[38];let K;e[39]!==u||e[40]!==i?(K=u==="self"&&t.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canOnlyDelegateToItself")}),e[39]=u,e[40]=i,e[41]=K):K=e[41];let L;e[42]!==q||e[43]!==Y||e[44]!==K?(L=t.jsxs("div",{className:"flex flex-col gap-1",children:[q,Y,K]}),e[42]=q,e[43]=Y,e[44]=K,e[45]=L):L=e[45];const k=u==="selected"&&T.length>0&&t.jsxs(se,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[t.jsx($e,{size:14}),i("virtualMcp.subAgentsSection.addSubAgent")]});let $;e[46]!==I?($=te=>I(te),e[46]=I,e[47]=$):$=e[47];let W;e[48]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx(ke,{size:"sm",className:"w-auto",children:t.jsx(Te,{})}),e[48]=W):W=e[48];let U;e[49]!==i?(U=i("virtualMcp.subAgentsSection.anyAgent"),e[49]=i,e[50]=U):U=e[50];let R;e[51]!==U?(R=t.jsx(xe,{value:"all",children:U}),e[51]=U,e[52]=R):R=e[52];let B;e[53]!==i?(B=i("virtualMcp.subAgentsSection.specificAgents"),e[53]=i,e[54]=B):B=e[54];let J;e[55]!==B?(J=t.jsx(xe,{value:"selected",children:B}),e[55]=B,e[56]=J):J=e[56];let ie;e[57]!==i?(ie=i("virtualMcp.subAgentsSection.onlyItself"),e[57]=i,e[58]=ie):ie=e[58];let ee;e[59]!==ie?(ee=t.jsx(xe,{value:"self",children:ie}),e[59]=ie,e[60]=ee):ee=e[60];let ce;e[61]!==R||e[62]!==J||e[63]!==ee?(ce=t.jsxs(De,{align:"end",children:[R,J,ee]}),e[61]=R,e[62]=J,e[63]=ee,e[64]=ce):ce=e[64];let de;e[65]!==u||e[66]!==$||e[67]!==ce?(de=t.jsxs(Ve,{value:u,onValueChange:$,children:[W,ce]}),e[65]=u,e[66]=$,e[67]=ce,e[68]=de):de=e[68];let ue;e[69]!==k||e[70]!==de?(ue=t.jsxs("div",{className:"flex items-center gap-2",children:[k,de]}),e[69]=k,e[70]=de,e[71]=ue):ue=e[71],e[72]!==L||e[73]!==ue?(C=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[L,ue]}),e[72]=L,e[73]=ue,e[74]=C):C=e[74],j="flex flex-col gap-2",v=u==="selected"&&(T.length>0?T.map(te=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-background",children:[t.jsx(Ge,{icon:te.icon,name:te.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:te.title}),te.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:te.description})]}),t.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y(te.id),children:t.jsx(At,{size:16})})]},te.id)):t.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx($e,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.emptyStateMessage")})]})),e[6]=o,e[7]=s,e[8]=n,e[9]=u,e[10]=l,e[11]=x,e[12]=i,e[13]=b,e[14]=y,e[15]=j,e[16]=v,e[17]=S,e[18]=C}else b=e[13],y=e[14],j=e[15],v=e[16],S=e[17],C=e[18];let M;e[75]!==j||e[76]!==v?(M=t.jsx("div",{className:j,children:v}),e[75]=j,e[76]=v,e[77]=M):M=e[77];let w;e[78]!==b||e[79]!==y||e[80]!==r||e[81]!==x?(w=t.jsx(Ka,{open:r,onOpenChange:h,candidates:b,selectedIds:x,onToggle:y}),e[78]=b,e[79]=y,e[80]=r,e[81]=x,e[82]=w):w=e[82];let N;return e[83]!==S||e[84]!==C||e[85]!==M||e[86]!==w?(N=t.jsxs("section",{className:S,children:[C,M,w]}),e[83]=S,e[84]=C,e[85]=M,e[86]=w,e[87]=N):N=e[87],N}function Ka(a){const e=H.c(39),{open:n,onOpenChange:s,candidates:i,selectedIds:l,onToggle:o}=a,r=X(),[h,c]=G.useState("");let m,f,u,d,p,x,g,b,y;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==h||e[5]!==l||e[6]!==r){const C=h.toLowerCase(),M=i.filter(_=>_.title.toLowerCase().includes(C)||_.description?.toLowerCase().includes(C));f=Je,b=n,y=s,m=Ze,p="max-w-md";let w;e[16]!==r?(w=r("virtualMcp.subAgentsSection.title"),e[16]=r,e[17]=w):w=e[17],e[18]!==w?(x=t.jsx(dt,{children:t.jsx(ut,{children:w})}),e[18]=w,e[19]=x):x=e[19];let N;e[20]!==r?(N=r("virtualMcp.subAgentsSection.searchPlaceholder"),e[20]=r,e[21]=N):N=e[21],e[22]!==h||e[23]!==N?(g=t.jsx(bi,{value:h,onChange:c,placeholder:N,className:"w-full"}),e[22]=h,e[23]=N,e[24]=g):g=e[24],u="flex flex-col gap-1 max-h-80 overflow-y-auto",d=M.length===0?t.jsx("p",{className:"text-sm text-muted-foreground px-1 py-4 text-center",children:r("virtualMcp.subAgentsSection.noAgentsFound")}):M.map(_=>t.jsxs("button",{type:"button",onClick:()=>o(_.id),className:"flex items-center gap-3 px-2 py-2 rounded-lg hover:bg-accent/50 transition-colors cursor-pointer w-full text-left",children:[t.jsx(Os,{checked:l.includes(_.id),className:"pointer-events-none",tabIndex:-1}),t.jsx(Ge,{icon:_.icon,name:_.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:_.title}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.description})]})]},_.id)),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=h,e[5]=l,e[6]=r,e[7]=m,e[8]=f,e[9]=u,e[10]=d,e[11]=p,e[12]=x,e[13]=g,e[14]=b,e[15]=y}else m=e[7],f=e[8],u=e[9],d=e[10],p=e[11],x=e[12],g=e[13],b=e[14],y=e[15];let j;e[25]!==u||e[26]!==d?(j=t.jsx("div",{className:u,children:d}),e[25]=u,e[26]=d,e[27]=j):j=e[27];let v;e[28]!==m||e[29]!==p||e[30]!==x||e[31]!==g||e[32]!==j?(v=t.jsxs(m,{className:p,children:[x,g,j]}),e[28]=m,e[29]=p,e[30]=x,e[31]=g,e[32]=j,e[33]=v):v=e[33];let S;return e[34]!==f||e[35]!==b||e[36]!==y||e[37]!==v?(S=t.jsx(f,{open:b,onOpenChange:y,children:v}),e[34]=f,e[35]=b,e[36]=y,e[37]=v,e[38]=S):S=e[38],S}function qe(){const a=H.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Xe,{className:"size-6 text-muted-foreground"})}),a[0]=e):e=a[0],e}function st(a,e){return({error:n})=>n?.message?.includes("Method not found")||n?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:a})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(js,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:e("virtualMcp.dependencySelectionDialog.somethingWentWrong")}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:n?.message?n.message.length>200?`${n.message.slice(0,200)}...`:n.message:e("virtualMcp.dependencySelectionDialog.unexpectedError")})]})]})}function Gs(a){const e=H.c(23),{item:n,isSelected:s,onToggle:i,disabled:l}=a,o=l?"cursor-not-allowed opacity-50":"cursor-pointer",r=s?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==o||e[1]!==r?(h=fe("flex items-start gap-3 p-4 rounded-lg transition-colors",o,r),e[0]=o,e[1]=r,e[2]=h):h=e[2];let c;e[3]!==n.name?(c=t.jsx("p",{className:"text-sm font-medium leading-none truncate",children:n.name}),e[3]=n.name,e[4]=c):c=e[4];let m;e[5]!==n.tags?(m=n.tags&&t.jsx("span",{className:"shrink-0",children:n.tags}),e[5]=n.tags,e[6]=m):m=e[6];let f;e[7]!==c||e[8]!==m?(f=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,m]}),e[7]=c,e[8]=m,e[9]=f):f=e[9];let u;e[10]!==n.description?(u=n.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:n.description}),e[10]=n.description,e[11]=u):u=e[11];let d;e[12]!==f||e[13]!==u?(d=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[f,u]}),e[12]=f,e[13]=u,e[14]=d):d=e[14];let p;e[15]!==l||e[16]!==s||e[17]!==i?(p=t.jsx(Os,{checked:s,onCheckedChange:i,disabled:l,className:"mt-0.5"}),e[15]=l,e[16]=s,e[17]=i,e[18]=p):p=e[18];let x;return e[19]!==h||e[20]!==d||e[21]!==p?(x=t.jsxs("label",{className:h,children:[d,p]}),e[19]=h,e[20]=d,e[21]=p,e[22]=x):x=e[22],x}function Wa(a){const e=H.c(35),{activeTab:n,onTabChange:s,showSelectAll:i,isAllSelected:l,handleSelectAll:o}=a,r=X();let h;e[0]!==r?(h=r("virtualMcp.dependencySelectionDialog.tabTools"),e[0]=r,e[1]=h):h=e[1];let c;e[2]!==h?(c={id:"tools",label:h},e[2]=h,e[3]=c):c=e[3];let m;e[4]!==r?(m=r("virtualMcp.dependencySelectionDialog.tabActive"),e[4]=r,e[5]=m):m=e[5];let f;e[6]!==m?(f={id:"active",label:m},e[6]=m,e[7]=f):f=e[7];let u;e[8]!==r?(u=r("virtualMcp.dependencySelectionDialog.tabResources"),e[8]=r,e[9]=u):u=e[9];let d;e[10]!==u?(d={id:"resources",label:u},e[10]=u,e[11]=d):d=e[11];let p;e[12]!==r?(p=r("virtualMcp.dependencySelectionDialog.tabPrompts"),e[12]=r,e[13]=p):p=e[13];let x;e[14]!==p?(x={id:"prompts",label:p},e[14]=p,e[15]=x):x=e[15];let g;e[16]!==c||e[17]!==f||e[18]!==d||e[19]!==x?(g=[c,f,d,x],e[16]=c,e[17]=f,e[18]=d,e[19]=x,e[20]=g):g=e[20];let b;e[21]!==s?(b=S=>s(S),e[21]=s,e[22]=b):b=e[22];let y;e[23]!==n||e[24]!==b||e[25]!==g?(y=t.jsx(ji,{tabs:g,activeTab:n,onTabChange:b}),e[23]=n,e[24]=b,e[25]=g,e[26]=y):y=e[26];let j;e[27]!==o||e[28]!==l||e[29]!==i||e[30]!==r?(j=i&&t.jsx("button",{type:"button",onClick:o,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r(l?"virtualMcp.dependencySelectionDialog.deselectAll":"virtualMcp.dependencySelectionDialog.selectAll")}),e[27]=o,e[28]=l,e[29]=i,e[30]=r,e[31]=j):j=e[31];let v;return e[32]!==y||e[33]!==j?(v=t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[y,j]}),e[32]=y,e[33]=j,e[34]=v):v=e[34],v}function Et(a){const e=H.c(13),{items:n,selections:s,onToggle:i,emptyMessage:l,disabled:o}=a;let r,h,c;if(e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const f=n.map(Ga);if(n.length===0){let u;e[8]!==l?(u=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:l})}),e[8]=l,e[9]=u):u=e[9],c=u;break e}r="flex-1 overflow-auto px-4 py-3 space-y-1",h=n.map(u=>t.jsx(Gs,{item:u,isSelected:s===null||s?.includes(u.id),onToggle:()=>i(u.id,f),disabled:o},u.id))}e[0]=o,e[1]=l,e[2]=n,e[3]=i,e[4]=s,e[5]=r,e[6]=h,e[7]=c}else r=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let m;return e[10]!==r||e[11]!==h?(m=t.jsx("div",{className:r,children:h}),e[10]=r,e[11]=h,e[12]=m):m=e[12],m}function Ga(a){return a.id}function Ha(a){const e=H.c(22),{connectionId:n,toolSelections:s,onToggleTool:i}=a,l=X(),{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=Es(c),f=m.tools;let u,d,p;if(e[6]!==m.tools||e[7]!==i||e[8]!==l||e[9]!==s){p=Symbol.for("react.early_return_sentinel");e:{const g=f.map(Qa);let b;e[13]!==s?(b=v=>s===null||s.includes(v.name),e[13]=s,e[14]=b):b=e[14];const j=m.tools.filter(b).map(qa);if(j.length===0){let v;e[15]!==l?(v=l("virtualMcp.dependencySelectionDialog.noActiveToolsSelected"),e[15]=l,e[16]=v):v=e[16];let S;e[17]!==v?(S=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:v})}),e[17]=v,e[18]=S):S=e[18],p=S;break e}u="flex-1 overflow-auto px-4 py-3 space-y-1",d=j.map(v=>t.jsx(Gs,{item:v,isSelected:!0,onToggle:()=>i(v.id,g)},v.id))}e[6]=m.tools,e[7]=i,e[8]=l,e[9]=s,e[10]=u,e[11]=d,e[12]=p}else u=e[10],d=e[11],p=e[12];if(p!==Symbol.for("react.early_return_sentinel"))return p;let x;return e[19]!==u||e[20]!==d?(x=t.jsx("div",{className:u,children:d}),e[19]=u,e[20]=d,e[21]=x):x=e[21],x}function qa(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Ps,{annotations:a.annotations,_meta:a._meta})}}function Qa(a){return a.name}function Xa(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=Es(c);let f;e[6]!==m.tools?(f=m.tools.map(Ja),e[6]=m.tools,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noToolsAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function Ja(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Ps,{annotations:a.annotations,_meta:a._meta})}}function Za(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=en(c);let f;e[6]!==m.resources?(f=m.resources.map(el),e[6]=m.resources,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noResourcesAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function el(a){return{id:a.name||a.uri,name:a.name||a.uri,description:a.description}}function tl(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=yi(c);let f;e[6]!==m.prompts?(f=m.prompts.map(sl),e[6]=m.prompts,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noPromptsAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function sl(a){return{id:a.name,name:a.name,description:a.description}}function nl(a){const e=H.c(58),{currentConnection:n,activeTab:s,selectedId:i,formData:l,toggleTool:o,toggleResource:r,togglePrompt:h,toggleAllTools:c,toggleAllResources:m,toggleAllPrompts:f,onTabChange:u}=a,d=X(),p=l[i],x=s==="tools"?p?.tools===null:s==="resources"?p?.resources===null:s==="prompts"?p?.prompts===null:!1,g=s!=="active";let b;e[0]!==s||e[1]!==i||e[2]!==f||e[3]!==m||e[4]!==c?(b=()=>{s==="tools"?c(i):s==="resources"?m(i):s==="prompts"&&f(i)},e[0]=s,e[1]=i,e[2]=f,e[3]=m,e[4]=c,e[5]=b):b=e[5];const y=b;let j;e[6]!==n.icon||e[7]!==n.title?(j=t.jsx(Ge,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0"}),e[6]=n.icon,e[7]=n.title,e[8]=j):j=e[8];let v;e[9]!==n.title?(v=t.jsx("h2",{className:"text-base font-semibold truncate",children:n.title}),e[9]=n.title,e[10]=v):v=e[10];let S;e[11]!==n.description?(S=n.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[11]=n.description,e[12]=S):S=e[12];let C;e[13]!==v||e[14]!==S?(C=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,S]}),e[13]=v,e[14]=S,e[15]=C):C=e[15];let M;e[16]!==j||e[17]!==C?(M=t.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[j,C]})}),e[16]=j,e[17]=C,e[18]=M):M=e[18];let w;e[19]!==s||e[20]!==y||e[21]!==x||e[22]!==u||e[23]!==g?(w=t.jsx(Wa,{activeTab:s,onTabChange:u,showSelectAll:g,isAllSelected:x,handleSelectAll:y}),e[19]=s,e[20]=y,e[21]=x,e[22]=u,e[23]=g,e[24]=w):w=e[24];let N;e[25]!==s||e[26]!==l||e[27]!==i||e[28]!==d||e[29]!==o?(N=s==="active"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.toolsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Ha,{connectionId:i,toolSelections:l[i]?l[i].tools:[],onToggleTool:(F,I)=>o(i,F,I)})})}),e[25]=s,e[26]=l,e[27]=i,e[28]=d,e[29]=o,e[30]=N):N=e[30];let _;e[31]!==s||e[32]!==l||e[33]!==i||e[34]!==d||e[35]!==o?(_=s==="tools"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.toolsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Xa,{connectionId:i,selections:l[i]?l[i].tools:[],onToggle:(F,I)=>o(i,F,I)})})}),e[31]=s,e[32]=l,e[33]=i,e[34]=d,e[35]=o,e[36]=_):_=e[36];let D;e[37]!==s||e[38]!==l||e[39]!==i||e[40]!==d||e[41]!==r?(D=s==="resources"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.resourcesNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Za,{connectionId:i,selections:l[i]?l[i].resources:[],onToggle:(F,I)=>r(i,F,I)})})}),e[37]=s,e[38]=l,e[39]=i,e[40]=d,e[41]=r,e[42]=D):D=e[42];let T;e[43]!==s||e[44]!==l||e[45]!==i||e[46]!==d||e[47]!==h?(T=s==="prompts"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.promptsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(tl,{connectionId:i,selections:l[i]?l[i].prompts:[],onToggle:(F,I)=>h(i,F,I)})})}),e[43]=s,e[44]=l,e[45]=i,e[46]=d,e[47]=h,e[48]=T):T=e[48];let A;e[49]!==D||e[50]!==T||e[51]!==N||e[52]!==_?(A=t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[N,_,D,T]}),e[49]=D,e[50]=T,e[51]=N,e[52]=_,e[53]=A):A=e[53];let V;return e[54]!==A||e[55]!==M||e[56]!==w?(V=t.jsxs(t.Fragment,{children:[M,w,A]}),e[54]=A,e[55]=M,e[56]=w,e[57]=V):V=e[57],V}function il(a){const e=H.c(7),{onClose:n}=a,s=X();let i;e[0]!==n?(i=()=>n(!1),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==s?(l=s("virtualMcp.dependencySelectionDialog.done"),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==i||e[5]!==l?(o=t.jsx(Ts,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(se,{variant:"outline",onClick:i,children:l})}),e[4]=i,e[5]=l,e[6]=o):o=e[6],o}function al(a){const e=H.c(23),{connectionId:n,onAuthenticate:s,children:i}=a,l=X();let o;e[0]!==n?(o={connectionId:n},e[0]=n,e[1]=o):o=e[1];const r=$s(o);if(r.supportsOAuth&&!r.isAuthenticated){let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:t.jsx(Qn,{size:22,className:"text-muted-foreground"})}),e[2]=m):m=e[2];let f;e[3]!==l?(f=l("virtualMcp.dependencySelectionDialog.authorizationRequired"),e[3]=l,e[4]=f):f=e[4];let u;e[5]!==f?(u=t.jsx("p",{className:"text-sm font-medium",children:f}),e[5]=f,e[6]=u):u=e[6];let d;e[7]!==l?(d=l("virtualMcp.dependencySelectionDialog.authorizationDescription"),e[7]=l,e[8]=d):d=e[8];let p;e[9]!==d?(p=t.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:d}),e[9]=d,e[10]=p):p=e[10];let x;e[11]!==u||e[12]!==p?(x=t.jsxs("div",{className:"space-y-1",children:[u,p]}),e[11]=u,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==n||e[15]!==s||e[16]!==l?(g=s&&t.jsx(se,{variant:"outline",size:"sm",onClick:()=>s(n),children:l("virtualMcp.dependencySelectionDialog.authorize")}),e[14]=n,e[15]=s,e[16]=l,e[17]=g):g=e[17];let b;return e[18]!==x||e[19]!==g?(b=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[m,x,g]}),e[18]=x,e[19]=g,e[20]=b):b=e[20],b}let c;return e[21]!==i?(c=t.jsx(t.Fragment,{children:i}),e[21]=i,e[22]=c):c=e[22],c}function ll(a){const e={};for(const n of a)e[n.connection_id]={tools:n.selected_tools,resources:n.selected_resources??null,prompts:n.selected_prompts??null};return e}function cs(a){return Object.entries(a).map(([e,n])=>({connection_id:e,selected_tools:n.tools,selected_resources:n.resources,selected_prompts:n.prompts}))}function ds(a,e,n,s){const i=a[e]??{tools:null,resources:null,prompts:null};return{...a,[e]:{...i,[n]:s}}}function rl(a,e){return e.type==="SET_ACTIVE_TAB"?{...a,activeTab:e.payload}:a}function ol(a){const e=H.c(49),{open:n,onOpenChange:s,selectedId:i,form:l,connections:o,onAuthenticate:r}=a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,m]=G.useReducer(rl,h),f=_t(i??"");let u;e[1]!==o?(u=o??[],e[1]=o,e[2]=u):u=e[2];let d;e[3]!==u?(d=ll(u),e[3]=u,e[4]=d):d=e[4];const p=d;let x;e[5]!==l||e[6]!==p?(x=(L,k,$,W)=>{const U=p[L]?.[k];let R;U===null?R=W.filter(B=>B!==$):U?.includes($)?R=U.filter(B=>B!==$):(R=[...U??[],$],R.length===W.length&&(R=null)),l.setValue("connections",cs(ds(p,L,k,R)),{shouldDirty:!0,shouldTouch:!0})},e[5]=l,e[6]=p,e[7]=x):x=e[7];const g=x;let b;e[8]!==l||e[9]!==p?(b=(L,k)=>{const W=p[L]?.[k]===null?[]:null;l.setValue("connections",cs(ds(p,L,k,W)),{shouldDirty:!0,shouldTouch:!0})},e[8]=l,e[9]=p,e[10]=b):b=e[10];const y=b;let j;e[11]!==g?(j=(L,k,$)=>g(L,"tools",k,$),e[11]=g,e[12]=j):j=e[12];const v=j;let S;e[13]!==g?(S=(L,k,$)=>g(L,"resources",k,$),e[13]=g,e[14]=S):S=e[14];const C=S;let M;e[15]!==g?(M=(L,k,$)=>g(L,"prompts",k,$),e[15]=g,e[16]=M):M=e[16];const w=M;let N;e[17]!==y?(N=L=>y(L,"tools"),e[17]=y,e[18]=N):N=e[18];const _=N;let D;e[19]!==y?(D=L=>y(L,"resources"),e[19]=y,e[20]=D):D=e[20];const T=D;let A;e[21]!==y?(A=L=>y(L,"prompts"),e[21]=y,e[22]=A):A=e[22];const V=A;if(!i||!f)return null;let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(qe,{}),e[23]=F):F=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=L=>m({type:"SET_ACTIVE_TAB",payload:L}),e[24]=I):I=e[24];let O;e[25]!==f||e[26]!==c.activeTab||e[27]!==p||e[28]!==i||e[29]!==V||e[30]!==T||e[31]!==_||e[32]!==w||e[33]!==C||e[34]!==v?(O=t.jsx(nl,{currentConnection:f,activeTab:c.activeTab,selectedId:i,formData:p,toggleTool:v,toggleResource:C,togglePrompt:w,toggleAllTools:_,toggleAllResources:T,toggleAllPrompts:V,onTabChange:I},i),e[25]=f,e[26]=c.activeTab,e[27]=p,e[28]=i,e[29]=V,e[30]=T,e[31]=_,e[32]=w,e[33]=C,e[34]=v,e[35]=O):O=e[35];let z;e[36]!==r||e[37]!==i||e[38]!==O?(z=t.jsx(G.Suspense,{fallback:F,children:t.jsx(al,{connectionId:i,onAuthenticate:r,children:O})}),e[36]=r,e[37]=i,e[38]=O,e[39]=z):z=e[39];let q;e[40]!==s?(q=t.jsx(il,{onClose:s}),e[40]=s,e[41]=q):q=e[41];let Y;e[42]!==z||e[43]!==q?(Y=t.jsxs(Ze,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[z,q]}),e[42]=z,e[43]=q,e[44]=Y):Y=e[44];let K;return e[45]!==s||e[46]!==n||e[47]!==Y?(K=t.jsx(Je,{open:n,onOpenChange:s,children:Y}),e[45]=s,e[46]=n,e[47]=Y,e[48]=K):K=e[48],K}const us="__new_instance__";function cl(a){const e=H.c(25),{connection_id:n,usedConnectionIds:s,onOpenSettings:i,onRemove:l,onAuthenticate:o,onSwitchInstance:r,onNewInstance:h}=a,c=_t(n),{org:m}=Ae();if(!c){let g;return e[0]!==l?(g=t.jsx(fl,{onRemove:l}),e[0]=l,e[1]=g):g=e[1],g}let f;e[2]!==c?(f=wi(c),e[2]=c,e[3]=f):f=e[3];const u=f;let d;e[4]!==n?(d=t.jsx(ml,{connection_id:n}),e[4]=n,e[5]=d):d=e[5];let p;e[6]!==c.app_name||e[7]!==c.connection_type||e[8]!==c.description||e[9]!==c.icon||e[10]!==c.status||e[11]!==c.title||e[12]!==n||e[13]!==o||e[14]!==h||e[15]!==i||e[16]!==l||e[17]!==r||e[18]!==m.slug||e[19]!==u||e[20]!==s?(p=t.jsx(ul,{connection_id:n,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,connectionStatus:c.status,slug:u,orgSlug:m.slug,appName:c.app_name,usedConnectionIds:s,onOpenSettings:i,onRemove:l,onAuthenticate:o,onSwitchInstance:r,onNewInstance:h}),e[6]=c.app_name,e[7]=c.connection_type,e[8]=c.description,e[9]=c.icon,e[10]=c.status,e[11]=c.title,e[12]=n,e[13]=o,e[14]=h,e[15]=i,e[16]=l,e[17]=r,e[18]=m.slug,e[19]=u,e[20]=s,e[21]=p):p=e[21];let x;return e[22]!==d||e[23]!==p?(x=t.jsx(G.Suspense,{fallback:d,children:p}),e[22]=d,e[23]=p,e[24]=x):x=e[24],x}function dl(a){const e=H.c(24),{appName:n,connectionId:s,usedConnectionIds:i,onSwitchInstance:l,onNewInstance:o}=a,r=X();let h;e[0]!==n?(h={filters:[{column:"app_name",value:n}]},e[0]=n,e[1]=h):h=e[1];const c=Pn(h);if(c.length<=1&&!o)return null;let m;e[2]!==s||e[3]!==o||e[4]!==l?(m=g=>{g===us?o?.():l(s,g)},e[2]=s,e[3]=o,e[4]=l,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ke,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:t.jsx(Te,{})}),e[6]=f):f=e[6];let u;if(e[7]!==s||e[8]!==c||e[9]!==i){let g;e[11]!==s||e[12]!==i?(g=b=>t.jsx(xe,{value:b.id,className:"text-xs",disabled:b.id!==s&&i.has(b.id),children:b.title},b.id),e[11]=s,e[12]=i,e[13]=g):g=e[13],u=c.map(g),e[7]=s,e[8]=c,e[9]=i,e[10]=u}else u=e[10];let d;e[14]!==o||e[15]!==r?(d=o&&t.jsxs(xe,{value:us,className:"text-xs text-muted-foreground",children:["+ ",r("virtualMcp.connectionItem.newInstance")]}),e[14]=o,e[15]=r,e[16]=d):d=e[16];let p;e[17]!==u||e[18]!==d?(p=t.jsxs(De,{children:[u,d]}),e[17]=u,e[18]=d,e[19]=p):p=e[19];let x;return e[20]!==s||e[21]!==m||e[22]!==p?(x=t.jsxs(Ve,{value:s,onValueChange:m,children:[f,p]}),e[20]=s,e[21]=m,e[22]=p,e[23]=x):x=e[23],x}function ul({connection_id:a,connectionTitle:e,connectionDescription:n,connectionIcon:s,connectionType:i,connectionStatus:l,slug:o,orgSlug:r,appName:h,usedConnectionIds:c,onOpenSettings:m,onRemove:f,onAuthenticate:u,onSwitchInstance:d,onNewInstance:p}){const x=$s({connectionId:a}),g=Ns(),y=!(i==="VIRTUAL")&&x.supportsOAuth&&!x.isAuthenticated,j=l!=="active",v=X(),S=async C=>{try{await g.update.mutateAsync({id:a,data:{status:C}}),re.success(v(C==="active"?"virtualMcp.connectionItem.connectionEnabled":"virtualMcp.connectionItem.connectionDisabled"))}catch{re.error(v("virtualMcp.connectionItem.failedToUpdateConnection"))}};return t.jsxs("div",{className:fe("rounded-xl border overflow-hidden transition-colors",y||j?"border-destructive/50 bg-destructive/5":"border-border bg-card"),children:[t.jsxs(ys,{to:"/$org/settings/connections/$appSlug",params:{org:r,appSlug:o},className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[t.jsx(Ge,{icon:s,name:e,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e}),y?t.jsx("span",{className:"text-xs text-destructive font-medium",children:v("virtualMcp.connectionItem.needsAuthorization")}):j?t.jsx("span",{className:"text-xs text-destructive font-medium",children:v(l==="error"?"virtualMcp.connectionItem.disabledError":"virtualMcp.connectionItem.disabled")}):n&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n})]}),y?t.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:C=>{C.preventDefault(),C.stopPropagation(),u(a)},children:v("virtualMcp.connectionItem.authorize")}):j?t.jsxs(se,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:C=>{C.preventDefault(),C.stopPropagation(),S("active")},children:[t.jsx(Xn,{size:13}),v("virtualMcp.connectionItem.enable")]}):t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:t.jsx(fi,{size:16})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.connectionSettings")})]})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[h&&t.jsx(dl,{appName:h,connectionId:a,usedConnectionIds:c,onSwitchInstance:d,onNewInstance:p}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:m,"aria-label":v("virtualMcp.connectionItem.configureResources"),children:t.jsx(Jn,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.configureResources")})]}),!j&&t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>S("inactive"),"aria-label":v("virtualMcp.connectionItem.disableConnection"),children:t.jsx(Zn,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.disable")})]}),t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:f,"aria-label":v("virtualMcp.connectionItem.removeConnection"),children:t.jsx(At,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.remove")})]})]})]})]})}function ml(a){const e=H.c(17),{connection_id:n}=a,s=_t(n);if(!s){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Hs,{}),e[0]=f):f=e[0],f}let i;e[1]!==s.icon||e[2]!==s.title?(i=t.jsx(Ge,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[1]=s.icon,e[2]=s.title,e[3]=i):i=e[3];let l;e[4]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[4]=s.title,e[5]=l):l=e[5];let o;e[6]!==s.description?(o=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[6]=s.description,e[7]=o):o=e[7];let r;e[8]!==l||e[9]!==o?(r=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,o]}),e[8]=l,e[9]=o,e[10]=r):r=e[10];let h;e[11]!==i||e[12]!==r?(h=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i,r]}),e[11]=i,e[12]=r,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let m;return e[15]!==h?(m=t.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=m):m=e[16],m}function fl(a){const e=H.c(20),{onRemove:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.connectionItem.connectionNotFound"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm text-destructive font-medium truncate",children:i})}),e[2]=i,e[3]=l):l=e[3];let o;e[4]!==s?(o=s("virtualMcp.connectionItem.removeConnection"),e[4]=s,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(At,{size:13}),e[6]=r):r=e[6];let h;e[7]!==n||e[8]!==o?(h=t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive shrink-0",onClick:n,"aria-label":o,children:r})}),e[7]=n,e[8]=o,e[9]=h):h=e[9];let c;e[10]!==s?(c=s("virtualMcp.connectionItem.remove"),e[10]=s,e[11]=c):c=e[11];let m;e[12]!==c?(m=t.jsx(we,{side:"bottom",children:c}),e[12]=c,e[13]=m):m=e[13];let f;e[14]!==h||e[15]!==m?(f=t.jsxs(je,{delayDuration:0,children:[h,m]}),e[14]=h,e[15]=m,e[16]=f):f=e[16];let u;return e[17]!==l||e[18]!==f?(u=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-destructive/50 bg-destructive/5",children:[l,f]}),e[17]=l,e[18]=f,e[19]=u):u=e[19],u}function Hs(){const a=H.c(3);let e;a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),a[0]=e):e=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),a[1]=n):n=a[1];let s;return a[2]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[n,t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),a[2]=s):s=a[2],s}function pl(a){const e=H.c(5),{value:n}=a;let s;if(e[0]!==n){s=Symbol.for("react.early_return_sentinel");e:{const l=kt(n);if(l.type==="icon"){const o=Dt(l.name);if(o){let r;e[2]!==o?(r=t.jsx(o,{size:16,className:"text-muted-foreground"}),e[2]=o,e[3]=r):r=e[3],s=r;break e}}}e[0]=n,e[1]=s}else s=e[1];if(s!==Symbol.for("react.early_return_sentinel"))return s;let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ei,{size:16,className:"text-muted-foreground"}),e[4]=i):i=e[4],i}function hl(a){const e=H.c(74),{value:n,onChange:s,className:i,disabled:l}=a,o=X(),[r,h]=G.useState(!1),[c,m]=G.useState("");let f;e[0]!==n?(f=kt(n),e[0]=n,e[1]=f):f=e[1];const u=f,d=u.type==="icon"?u.name:null;let p,x,g,b,y,j,v,S,C,M,w,N,_,D,T;if(e[2]!==i||e[3]!==d||e[4]!==l||e[5]!==s||e[6]!==r||e[7]!==c||e[8]!==o||e[9]!==n){const q=Tt();b=Ds(q,c),g=It,y=l?!1:r,j=h;let Y;e[25]!==o?(Y=o("common.simpleIconPicker.changeIcon"),e[25]=o,e[26]=Y):Y=e[26];const K=l?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let L;e[27]!==i||e[28]!==K?(L=fe("size-7 shrink-0 rounded-lg transition-colors flex items-center justify-center",K,i),e[27]=i,e[28]=K,e[29]=L):L=e[29];let k;e[30]!==n?(k=t.jsx(pl,{value:n}),e[30]=n,e[31]=k):k=e[31],e[32]!==l||e[33]!==Y||e[34]!==L||e[35]!==k?(v=t.jsx(Ot,{asChild:!0,children:t.jsx("button",{type:"button",disabled:l,"aria-label":Y,className:L,children:k})}),e[32]=l,e[33]=Y,e[34]=L,e[35]=k,e[36]=v):v=e[36],x=Pt,_="start",D="w-64 p-0",T=xl,w="flex flex-col";let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(at,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[37]=$):$=e[37];let W;e[38]===Symbol.for("react.memo_cache_sentinel")?(W=B=>m(B.target.value),e[38]=W):W=e[38];let U;e[39]!==o?(U=o("common.simpleIconPicker.filterPlaceholder"),e[39]=o,e[40]=U):U=e[40],e[41]!==c||e[42]!==U?(N=t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"relative",children:[$,t.jsx(Me,{value:c,onChange:W,placeholder:U,className:"h-7 text-xs pl-7"})]})}),e[41]=c,e[42]=U,e[43]=N):N=e[43],p=Fs,M="h-48",S="grid grid-cols-8 gap-0.5 px-2 pb-2";let R;e[44]!==d||e[45]!==s?(R=B=>{const J=Dt(B);return J?t.jsx("button",{type:"button",onClick:()=>{s(`icon://${B}`),h(!1)},className:fe("h-7 w-7 flex items-center justify-center rounded-lg transition-colors cursor-pointer",d===B?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:wt(B),"aria-label":wt(B),children:t.jsx(J,{size:16})},B):null},e[44]=d,e[45]=s,e[46]=R):R=e[46],C=b.map(R),e[2]=i,e[3]=d,e[4]=l,e[5]=s,e[6]=r,e[7]=c,e[8]=o,e[9]=n,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=y,e[15]=j,e[16]=v,e[17]=S,e[18]=C,e[19]=M,e[20]=w,e[21]=N,e[22]=_,e[23]=D,e[24]=T}else p=e[10],x=e[11],g=e[12],b=e[13],y=e[14],j=e[15],v=e[16],S=e[17],C=e[18],M=e[19],w=e[20],N=e[21],_=e[22],D=e[23],T=e[24];let A;e[47]!==S||e[48]!==C?(A=t.jsx("div",{className:S,children:C}),e[47]=S,e[48]=C,e[49]=A):A=e[49];let V;e[50]!==b.length||e[51]!==o?(V=b.length===0&&t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:o("common.simpleIconPicker.noIconsFound")}),e[50]=b.length,e[51]=o,e[52]=V):V=e[52];let F;e[53]!==p||e[54]!==A||e[55]!==V||e[56]!==M?(F=t.jsxs(p,{className:M,children:[A,V]}),e[53]=p,e[54]=A,e[55]=V,e[56]=M,e[57]=F):F=e[57];let I;e[58]!==F||e[59]!==w||e[60]!==N?(I=t.jsxs("div",{className:w,children:[N,F]}),e[58]=F,e[59]=w,e[60]=N,e[61]=I):I=e[61];let O;e[62]!==x||e[63]!==I||e[64]!==_||e[65]!==D||e[66]!==T?(O=t.jsx(x,{align:_,className:D,onOpenAutoFocus:T,children:I}),e[62]=x,e[63]=I,e[64]=_,e[65]=D,e[66]=T,e[67]=O):O=e[67];let z;return e[68]!==g||e[69]!==y||e[70]!==j||e[71]!==v||e[72]!==O?(z=t.jsxs(g,{open:y,onOpenChange:j,children:[v,O]}),e[68]=g,e[69]=y,e[70]=j,e[71]=v,e[72]=O,e[73]=z):z=e[73],z}function xl(a){return a.preventDefault()}function gl(a){const e=H.c(10),{viewId:n}=a;if(n==="overview"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Vs,{size:16}),e[0]=i):i=e[0],i}if(n==="reports"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ht,{size:16}),e[1]=i):i=e[1],i}if(n==="board"){let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ti,{size:16}),e[2]=i):i=e[2],i}if(n==="site-editor"){let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ci,{size:16}),e[3]=i):i=e[3],i}if(n==="assets"){let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ni,{size:16}),e[4]=i):i=e[4],i}if(n==="hosting"){let i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(tn,{size:16}),e[5]=i):i=e[5],i}if(n==="e2e"){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(si,{size:16}),e[6]=i):i=e[6],i}if(n==="analytics"){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ht,{size:16}),e[7]=i):i=e[7],i}if(n==="cdn"){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ni,{size:16}),e[8]=i):i=e[8],i}let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(As,{size:16}),e[9]=s):s=e[9],s}function ms(a){const e=H.c(51),{pinned:n,canSetMainView:s,onOpen:i,onTogglePin:l,onSetMainView:o}=a,r=X(),h=n?"text-foreground":"text-muted-foreground/40";let c;e[0]!==h?(c=fe("size-7",h),e[0]=h,e[1]=c):c=e[1];let m;e[2]!==n||e[3]!==r?(m=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[2]=n,e[3]=r,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(qt,{size:16}),e[5]=f):f=e[5];let u;e[6]!==l||e[7]!==n||e[8]!==c||e[9]!==m?(u=t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:c,"aria-label":m,"aria-pressed":n,onClick:l,children:f})}),e[6]=l,e[7]=n,e[8]=c,e[9]=m,e[10]=u):u=e[10];let d;e[11]!==n||e[12]!==r?(d=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[11]=n,e[12]=r,e[13]=d):d=e[13];let p;e[14]!==d?(p=t.jsx(we,{side:"top",children:d}),e[14]=d,e[15]=p):p=e[15];let x;e[16]!==u||e[17]!==p?(x=t.jsxs(je,{delayDuration:0,children:[u,p]}),e[16]=u,e[17]=p,e[18]=x):x=e[18];let g;e[19]!==r?(g=r("virtualMcp.settings.views.rowActions"),e[19]=r,e[20]=g):g=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Si,{size:16}),e[21]=b):b=e[21];let y;e[22]!==g?(y=t.jsx(vs,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground","aria-label":g,children:b})}),e[22]=g,e[23]=y):y=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:14}),e[24]=j):j=e[24];let v;e[25]!==r?(v=r("virtualMcp.settings.views.open"),e[25]=r,e[26]=v):v=e[26];let S;e[27]!==i||e[28]!==v?(S=t.jsxs(Ke,{onClick:i,children:[j,v]}),e[27]=i,e[28]=v,e[29]=S):S=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(qt,{size:14}),e[30]=C):C=e[30];let M;e[31]!==n||e[32]!==r?(M=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[31]=n,e[32]=r,e[33]=M):M=e[33];let w;e[34]!==l||e[35]!==M?(w=t.jsxs(Ke,{onClick:l,children:[C,M]}),e[34]=l,e[35]=M,e[36]=w):w=e[36];let N;e[37]!==s||e[38]!==o||e[39]!==r?(N=s&&t.jsxs(Ke,{onClick:o,children:[t.jsx(Vs,{size:14}),r("virtualMcp.settings.views.setMainView")]}),e[37]=s,e[38]=o,e[39]=r,e[40]=N):N=e[40];let _;e[41]!==S||e[42]!==w||e[43]!==N?(_=t.jsxs(bs,{align:"end",children:[S,w,N]}),e[41]=S,e[42]=w,e[43]=N,e[44]=_):_=e[44];let D;e[45]!==y||e[46]!==_?(D=t.jsxs(gs,{children:[y,_]}),e[45]=y,e[46]=_,e[47]=D):D=e[47];let T;return e[48]!==D||e[49]!==x?(T=t.jsxs("div",{className:"flex items-center gap-1",children:[x,D]}),e[48]=D,e[49]=x,e[50]=T):T=e[50],T}const fs=a=>a.stopPropagation();function vl(a){const e=H.c(8),{icon:n,title:s}=a;let i;e[0]!==n||e[1]!==s?(i=t.jsx(Ge,{icon:n,name:s,size:"xs",className:"shrink-0"}),e[0]=n,e[1]=s,e[2]=i):i=e[2];let l;e[3]!==s?(l=t.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[3]=s,e[4]=l):l=e[4];let o;return e[5]!==i||e[6]!==l?(o=t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 bg-muted/30",children:[i,l]}),e[5]=i,e[6]=l,e[7]=o):o=e[7],o}function bl(a){const e=H.c(70),{views:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.settings.views.defaults"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==s?(l=s("virtualMcp.layoutTabContent.mainView"),e[2]=s,e[3]=l):l=e[3];let o;e[4]!==s?(o=s("virtualMcp.layoutTabContent.mainViewDescription"),e[4]=s,e[5]=o):o=e[5];const r=n.defaultMainView,h=n.setMainView;let c;e[6]!==s?(c=s("virtualMcp.layoutTabContent.mainView"),e[6]=s,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("virtualMcp.layoutTabContent.noMainView"),e[8]=s,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx(Te,{placeholder:m}),e[10]=m,e[11]=f):f=e[11];let u;e[12]!==c||e[13]!==f?(u=t.jsx(ke,{"aria-label":c,className:"w-36 h-8 text-sm shrink-0 @min-xl/project-settings:w-44",children:f}),e[12]=c,e[13]=f,e[14]=u):u=e[14];let d;e[15]!==n.defaultMainOptions?(d=n.defaultMainOptions.map(jl),e[15]=n.defaultMainOptions,e[16]=d):d=e[16];let p;e[17]!==d?(p=t.jsx(De,{children:d}),e[17]=d,e[18]=p):p=e[18];let x;e[19]!==p||e[20]!==u||e[21]!==n.defaultMainView||e[22]!==n.setMainView?(x=t.jsxs(Ve,{value:r,onValueChange:h,children:[u,p]}),e[19]=p,e[20]=u,e[21]=n.defaultMainView,e[22]=n.setMainView,e[23]=x):x=e[23];let g;e[24]!==x||e[25]!==l||e[26]!==o?(g=t.jsx(He,{title:l,description:o,action:x}),e[24]=x,e[25]=l,e[26]=o,e[27]=g):g=e[27];let b;e[28]!==s?(b=s("virtualMcp.layoutTabContent.showChat"),e[28]=s,e[29]=b):b=e[29];let y;e[30]!==s?(y=s("virtualMcp.layoutTabContent.showChatDescription"),e[30]=s,e[31]=y):y=e[31];let j;e[32]!==s?(j=s("virtualMcp.layoutTabContent.showChat"),e[32]=s,e[33]=j):j=e[33];const v=n.noMainView?!0:n.chatDefaultOpen;let S;e[34]!==j||e[35]!==v||e[36]!==n.noMainView||e[37]!==n.setChatDefaultOpen?(S=t.jsx(ye,{asChild:!0,children:t.jsx("span",{className:"shrink-0",children:t.jsx(ft,{"aria-label":j,checked:v,disabled:n.noMainView,onCheckedChange:n.setChatDefaultOpen})})}),e[34]=j,e[35]=v,e[36]=n.noMainView,e[37]=n.setChatDefaultOpen,e[38]=S):S=e[38];let C;e[39]!==s||e[40]!==n.noMainView?(C=n.noMainView&&t.jsx(we,{side:"top",children:s("virtualMcp.layoutTabContent.chatAlwaysShown")}),e[39]=s,e[40]=n.noMainView,e[41]=C):C=e[41];let M;e[42]!==S||e[43]!==C?(M=t.jsxs(je,{delayDuration:0,children:[S,C]}),e[42]=S,e[43]=C,e[44]=M):M=e[44];let w;e[45]!==b||e[46]!==y||e[47]!==M?(w=t.jsx(He,{title:b,description:y,action:M}),e[45]=b,e[46]=y,e[47]=M,e[48]=w):w=e[48];let N;e[49]!==g||e[50]!==w?(N=t.jsxs(Le,{children:[g,w]}),e[49]=g,e[50]=w,e[51]=N):N=e[51];let _;e[52]!==i||e[53]!==N?(_=t.jsx(Be,{title:i,children:N}),e[52]=i,e[53]=N,e[54]=_):_=e[54];let D;e[55]!==s?(D=s("virtualMcp.settings.views.sidebar"),e[55]=s,e[56]=D):D=e[56];let T;e[57]!==n?(T=n.projectViews.map(O=>{const z=n.pinned(O);return t.jsx(He,{icon:t.jsx(gl,{viewId:O}),title:n.labels[O],onClick:()=>n.openView(O),action:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ms,{pinned:z,canSetMainView:z&&!n.isMainView(O),onOpen:()=>n.openView(O),onTogglePin:()=>n.togglePin(O,!z),onSetMainView:()=>n.setMainView(O)}),t.jsx("span",{onClick:()=>n.openView(O),className:"flex cursor-pointer items-center text-muted-foreground",children:t.jsx(Kt,{size:16})})]})},O)}),e[57]=n,e[58]=T):T=e[58];let A;e[59]!==n?(A=n.connectionsData.flatMap(O=>[t.jsx(vl,{icon:O.icon,title:O.title},`${O.id}:header`),...O.uiTools.map(z=>{const q=n.pinnedAppViews.find(k=>k.connectionId===O.id&&k.toolName===z.name),Y=!!q,K=nn(O.id,z.name),L=`ext-apps:${O.id}:${z.name}`;return t.jsx(He,{onClick:()=>n.openView(K),icon:Y?t.jsx("span",{onClick:fs,children:t.jsx(hl,{value:q.icon??null,onChange:k=>n.setAppViewIcon(O.id,z.name,k)})}):t.jsx(As,{size:16}),title:Y?t.jsx("span",{onClick:fs,children:t.jsx(Me,{value:q.label,onChange:k=>n.setAppViewLabel(O.id,z.name,k.target.value),onBlur:n.commitAppViewLabel,"aria-label":z.title??St(z.name),className:"h-7 w-full max-w-52 text-sm"})}):z.title??St(z.name),action:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ms,{pinned:Y,canSetMainView:Y&&!n.isMainView(L),onOpen:()=>n.openView(K),onTogglePin:()=>n.toggleAppViewPin(O.id,z.name),onSetMainView:()=>n.setMainView(L)}),t.jsx("span",{onClick:()=>n.openView(K),className:"flex cursor-pointer items-center text-muted-foreground",children:t.jsx(Kt,{size:16})})]})},`${O.id}:${z.name}`)})]),e[59]=n,e[60]=A):A=e[60];let V;e[61]!==T||e[62]!==A?(V=t.jsxs(Le,{children:[T,A]}),e[61]=T,e[62]=A,e[63]=V):V=e[63];let F;e[64]!==D||e[65]!==V?(F=t.jsx(Be,{title:D,children:V}),e[64]=D,e[65]=V,e[66]=F):F=e[66];let I;return e[67]!==_||e[68]!==F?(I=t.jsxs(t.Fragment,{children:[_,F]}),e[67]=_,e[68]=F,e[69]=I):I=e[69],I}function jl(a){return t.jsx(xe,{value:a.value,children:a.label},a.value)}const qs="site-editor",yl=new Set([qs,"content"]);function wl({virtualMcpId:a,form:e,flushAndSave:n}){const s=X(),i=ot(),{openPanel:l}=Ti(),o=Ms(a),r=Di(o),h=zs(a),c=Ei(a),m=(o?.connections??[]).map(k=>k.connection_id).sort(),{data:f}=an({queryKey:ws.projectConnectionDetails(a,m),enabled:m.length>0,queryFn:async()=>await Promise.all(m.map(async $=>{try{const{item:W}=await i.call("COLLECTION_CONNECTIONS_GET",{id:$}),U=(W?.tools??[]).flatMap(R=>{const B=Mi(R._meta);return B?[{name:R.name,title:R.title,description:R.description,resourceUri:B}]:[]});return{fetchOk:!0,id:$,title:W?.title??$,icon:W?.icon??null,uiTools:U}}catch{return{fetchOk:!1,id:$,title:$,icon:null,uiTools:[]}}}))}),u=(f??[]).filter(k=>k.uiTools.length>0),d=new Set([...ln,...rn]),p=e.watch("metadata.ui.pinnedViews")??[],x=e.watch("metadata.ui.layout")??null,g=x?.defaultMainView??null,b=x?.chatDefaultOpen??!1,y=Nt(Ct({sidebarViews:e.watch("metadata.sidebarViews"),ui:{layout:x}}),e.watch("metadata.sidebarViewsVersion")),j=c??(o?Nt(Ct(o.metadata),o.metadata.sidebarViewsVersion):y),v=(()=>{if(!g||g.type==="chat")return"";const k=on(g.type);return k==="instructions"||k==="connections"||k==="layout"?"settings":yl.has(k)?qs:d.has(k)?k:`${k}:${g.id??""}:${g.toolName??""}`})(),S=v==="",C=k=>{const[$,W,U]=k.split(":");return $?d.has($)?{type:$}:$==="ext-apps"&&W?{type:"ext-apps",id:W,toolName:U||void 0}:null:null},M=k=>{e.setValue("metadata.ui.pinnedViews",k,{shouldDirty:!0})},w=k=>{e.setValue("metadata.ui.layout",{...x,...k},{shouldDirty:!0})},N=G.useRef(!1);if(f&&f.length>0&&!N.current){N.current=!0;const k=new Set((f??[]).filter(R=>R.fetchOk).map(R=>R.id)),$=new Set(u.flatMap(R=>R.uiTools.map(B=>`${R.id}:${B.name}`))),W=new Set(m),U=p.filter(R=>W.has(R.connectionId)&&(!k.has(R.connectionId)||$.has(`${R.connectionId}:${R.toolName}`)));U.length!==p.length&&(M(U),g?.type==="ext-apps"&&!U.some(R=>R.connectionId===g.id&&R.toolName===g.toolName)&&w({defaultMainView:{type:"settings"}}))}const _=(k,$)=>{if(p.some(U=>U.connectionId===k&&U.toolName===$)){const U=p.filter(B=>!(B.connectionId===k&&B.toolName===$));M(U);const R=`ext-apps:${k}:${$}`;v===R&&w({defaultMainView:{type:"settings"}})}else{const U=u.find(R=>R.id===k)?.uiTools.find(R=>R.name===$)?.title;M([...p,{connectionId:k,toolName:$,label:U??St($),icon:null}])}n()},D=(k,$,W)=>{M(p.map(U=>U.connectionId===k&&U.toolName===$?{...U,label:W}:U))},T=()=>{n()},A=(k,$,W)=>{M(p.map(U=>U.connectionId===k&&U.toolName===$?{...U,icon:W}:U)),n()},V=k=>{w({defaultMainView:C(k)}),n()},F=(k,$)=>{const W=Oi(j,k,$,1);e.setValue("metadata.sidebarViews",W,{shouldDirty:!0}),e.setValue("metadata.sidebarViewsVersion",1,{shouldDirty:!0}),h.stage(W,j);const U=Pi(g,k,$);U!==g&&w({defaultMainView:U})},I=lt(o?.metadata),O=Vi(I,r.presence),z=Ai(O),q=Ii(j,O,1),Y={overview:s("sidebar.navDestinations.home"),reports:s("sidebar.navDestinations.reports"),board:s("sidebar.navDestinations.tasks"),"site-editor":s("virtualMcp.layoutTabContent.siteEditor"),assets:s("common.mainPanelTabs.assets"),hosting:s("common.mainPanelTabs.hosting"),e2e:s("common.mainPanelTabs.e2e"),analytics:s("common.mainPanelTabs.analytics"),cdn:s("common.mainPanelTabs.cdn"),automations:s("virtualMcp.layoutTabContent.automations"),experiments:s("experiments.title")},K=[];for(const k of q)k!=="automations"&&K.push({value:k,label:Y[k]});for(const k of p)K.push({value:`ext-apps:${k.connectionId}:${k.toolName}`,label:k.label||k.toolName});return q.includes("automations")&&K.push({value:"automations",label:Y.automations}),K.push({value:"settings",label:s("virtualMcp.layoutTabContent.settings")}),{projectViews:z,labels:Y,pinned:k=>j.includes(k),isMainView:k=>v===k,defaultMainView:v,defaultMainOptions:K,noMainView:S,chatDefaultOpen:b,connectionsData:u,pinnedAppViews:p,openView:k=>l(k,{virtualmcpid:a}),togglePin:(k,$)=>F(k,$),setMainView:V,setChatDefaultOpen:k=>{w({chatDefaultOpen:k}),n()},toggleAppViewPin:_,setAppViewIcon:A,setAppViewLabel:D,commitAppViewLabel:T}}function Sl(a){const e=H.c(82),{value:n,onChange:s,onColorChange:i,name:l,size:o,className:r,avatarClassName:h,showHoverOverlay:c,disabled:m}=a,f=o===void 0?"lg":o,u=c===void 0?!0:c,d=m===void 0?!1:m,p=X(),[x,g]=G.useState(!1),[b,y]=G.useState("icons"),[j,v]=G.useState(""),[S,C]=G.useState("blue");let M;e[0]!==n?(M=kt(n),e[0]=n,e[1]=M):M=e[1];const w=M,N=w.type==="icon"||w.type==="url"&&w.color?w.color:S;let _;e[2]!==s||e[3]!==N?(_=oe=>{s(gt(oe,N))},e[2]=s,e[3]=N,e[4]=_):_=e[4];const D=_;let T;e[5]!==s||e[6]!==i||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(T=oe=>{C(oe),i?.(oe),w.type==="icon"?s(gt(w.name,oe)):w.type==="url"&&s(Qt(w.url,oe))},e[5]=s,e[6]=i,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=T):T=e[10];const A=T;let V;e[11]!==s||e[12]!==N?(V=oe=>{s(Qt(oe,N)),g(!1)},e[11]=s,e[12]=N,e[13]=V):V=e[13];const F=V;let I;e[14]!==s||e[15]!==N?(I=()=>{const oe=Tt(),Ne=oe[Math.floor(Math.random()*oe.length)];s(gt(Ne,N))},e[14]=s,e[15]=N,e[16]=I):I=e[16];const O=I,z=d?!1:x,q=d?"cursor-default opacity-50":"cursor-pointer";let Y;e[17]!==r||e[18]!==f||e[19]!==q?(Y=fe("relative group overflow-hidden",q,ii(f),r),e[17]=r,e[18]=f,e[19]=q,e[20]=Y):Y=e[20];let K;e[21]!==h||e[22]!==l||e[23]!==f||e[24]!==n?(K=t.jsx(Xt,{icon:n,name:l,size:f,className:h}),e[21]=h,e[22]=l,e[23]=f,e[24]=n,e[25]=K):K=e[25];let L;e[26]!==d||e[27]!==u?(L=u&&!d&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(ai,{size:16,className:"text-white"})}),e[26]=d,e[27]=u,e[28]=L):L=e[28];let k;e[29]!==d||e[30]!==Y||e[31]!==K||e[32]!==L?(k=t.jsx(Ot,{asChild:!0,children:t.jsxs("button",{type:"button","data-testid":"icon-picker-trigger","aria-label":"Change icon",disabled:d,className:Y,children:[K,L]})}),e[29]=d,e[30]=Y,e[31]=K,e[32]=L,e[33]=k):k=e[33];let $;e[34]!==l||e[35]!==n?($=t.jsx("div",{className:"flex items-center justify-center py-4",children:t.jsx(Xt,{icon:n,name:l,size:"xl"})}),e[34]=l,e[35]=n,e[36]=$):$=e[36];let W;e[37]!==b?(W=oe=>{if(oe.key!=="ArrowLeft"&&oe.key!=="ArrowRight")return;oe.preventDefault();const Ne=b==="icons"?"upload":"icons";y(Ne),document.getElementById(`icon-picker-tab-${Ne}`)?.focus()},e[37]=b,e[38]=W):W=e[38];const U=b==="icons",R=b==="icons"?0:-1;let B;e[39]===Symbol.for("react.memo_cache_sentinel")?(B=()=>y("icons"),e[39]=B):B=e[39];const J=b==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[40]!==J?(ie=fe("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",J),e[40]=J,e[41]=ie):ie=e[41];let ee;e[42]!==p?(ee=p("common.iconPicker.iconsTab"),e[42]=p,e[43]=ee):ee=e[43];let ce;e[44]!==U||e[45]!==R||e[46]!==ie||e[47]!==ee?(ce=t.jsx("button",{id:"icon-picker-tab-icons",type:"button",role:"tab","aria-selected":U,"aria-controls":"icon-picker-panel-icons",tabIndex:R,onClick:B,className:ie,children:ee}),e[44]=U,e[45]=R,e[46]=ie,e[47]=ee,e[48]=ce):ce=e[48];const de=b==="upload",ue=b==="upload"?0:-1;let te;e[49]===Symbol.for("react.memo_cache_sentinel")?(te=()=>y("upload"),e[49]=te):te=e[49];const pe=b==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let me;e[50]!==pe?(me=fe("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",pe),e[50]=pe,e[51]=me):me=e[51];let Se;e[52]!==p?(Se=p("common.iconPicker.uploadTab"),e[52]=p,e[53]=Se):Se=e[53];let E;e[54]!==de||e[55]!==ue||e[56]!==me||e[57]!==Se?(E=t.jsx("button",{id:"icon-picker-tab-upload",type:"button",role:"tab","aria-selected":de,"aria-controls":"icon-picker-panel-upload",tabIndex:ue,onClick:te,className:me,children:Se}),e[54]=de,e[55]=ue,e[56]=me,e[57]=Se,e[58]=E):E=e[58];let ne;e[59]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx("div",{className:"flex-1"}),e[59]=ne):ne=e[59];let Q;e[60]!==W||e[61]!==ce||e[62]!==E?(Q=t.jsxs("div",{role:"tablist","aria-label":"Icon source",className:"flex items-center border-b border-border px-3",onKeyDown:W,children:[ce,E,ne]}),e[60]=W,e[61]=ce,e[62]=E,e[63]=Q):Q=e[63];let ae;e[64]!==A||e[65]!==O||e[66]!==D||e[67]!==F||e[68]!==w.name||e[69]!==w.type||e[70]!==j||e[71]!==N||e[72]!==b?(ae=b==="icons"?t.jsx("div",{id:"icon-picker-panel-icons",role:"tabpanel","aria-labelledby":"icon-picker-tab-icons",children:t.jsx(_l,{search:j,onSearchChange:v,selectedColor:N,onColorChange:A,onSelectIcon:D,onRandom:O,currentIconName:w.type==="icon"?w.name:null})}):t.jsx("div",{id:"icon-picker-panel-upload",role:"tabpanel","aria-labelledby":"icon-picker-tab-upload",children:t.jsx(kl,{onUpload:F})}),e[64]=A,e[65]=O,e[66]=D,e[67]=F,e[68]=w.name,e[69]=w.type,e[70]=j,e[71]=N,e[72]=b,e[73]=ae):ae=e[73];let P;e[74]!==$||e[75]!==Q||e[76]!==ae?(P=t.jsx(Pt,{align:"start",className:"w-80 p-0",onOpenAutoFocus:Nl,children:t.jsxs("div",{className:"flex flex-col",children:[$,Q,ae]})}),e[74]=$,e[75]=Q,e[76]=ae,e[77]=P):P=e[77];let Z;return e[78]!==k||e[79]!==P||e[80]!==z?(Z=t.jsxs(It,{open:z,onOpenChange:g,children:[k,P]}),e[78]=k,e[79]=P,e[80]=z,e[81]=Z):Z=e[81],Z}function Nl(a){return a.preventDefault()}function Cl(a){const e=H.c(33),{selectedColor:n,onColorChange:s}=a,i=X(),[l,o]=G.useState(!1);let r,h,c,m,f,u,d;if(e[0]!==l||e[1]!==n){const S=Is(n);h=It,u=l,d=o,r=Ot,f=!0,c="button",m=fe("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",S.dot,"ring-foreground/20"),e[0]=l,e[1]=n,e[2]=r,e[3]=h,e[4]=c,e[5]=m,e[6]=f,e[7]=u,e[8]=d}else r=e[2],h=e[3],c=e[4],m=e[5],f=e[6],u=e[7],d=e[8];let p;e[9]!==i?(p=i("common.iconPicker.changeColor"),e[9]=i,e[10]=p):p=e[10];let x;e[11]!==i?(x=i("common.iconPicker.changeColor"),e[11]=i,e[12]=x):x=e[12];let g;e[13]!==c||e[14]!==m||e[15]!==p||e[16]!==x?(g=t.jsx("button",{type:c,className:m,title:p,"aria-label":x}),e[13]=c,e[14]=m,e[15]=p,e[16]=x,e[17]=g):g=e[17];let b;e[18]!==r||e[19]!==f||e[20]!==g?(b=t.jsx(r,{asChild:f,children:g}),e[18]=r,e[19]=f,e[20]=g,e[21]=b):b=e[21];let y;e[22]!==s||e[23]!==n?(y=ri.map(S=>t.jsx("button",{type:"button",onClick:()=>{s(S.name),o(!1)},className:fe("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",S.dot,n===S.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:S.name,"aria-label":S.name},S.name)),e[22]=s,e[23]=n,e[24]=y):y=e[24];let j;e[25]!==y?(j=t.jsx(Pt,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:Ml,children:t.jsx("div",{className:"grid grid-cols-4 gap-1",children:y})}),e[25]=y,e[26]=j):j=e[26];let v;return e[27]!==h||e[28]!==j||e[29]!==u||e[30]!==d||e[31]!==b?(v=t.jsxs(h,{open:u,onOpenChange:d,children:[b,j]}),e[27]=h,e[28]=j,e[29]=u,e[30]=d,e[31]=b,e[32]=v):v=e[32],v}function Ml(a){return a.preventDefault()}function _l(a){const e=H.c(55),{search:n,onSearchChange:s,selectedColor:i,onColorChange:l,onSelectIcon:o,onRandom:r,currentIconName:h}=a,c=X();let m,f,u,d,p,x,g;if(e[0]!==h||e[1]!==l||e[2]!==r||e[3]!==s||e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==c){const S=Tt(),C=Is(i);f=Ds(S,n),x="flex flex-col";let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(at,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[15]=M):M=e[15];let w;e[16]!==s?(w=I=>s(I.target.value),e[16]=s,e[17]=w):w=e[17];let N;e[18]!==c?(N=c("common.iconPicker.filterPlaceholder"),e[18]=c,e[19]=N):N=e[19];let _;e[20]!==n||e[21]!==w||e[22]!==N?(_=t.jsxs("div",{className:"relative flex-1",children:[M,t.jsx(Me,{value:n,onChange:w,placeholder:N,className:"h-8 text-xs pl-7"})]}),e[20]=n,e[21]=w,e[22]=N,e[23]=_):_=e[23];let D;e[24]!==c?(D=c("common.iconPicker.randomIcon"),e[24]=c,e[25]=D):D=e[25];let T;e[26]!==c?(T=c("common.iconPicker.randomIcon"),e[26]=c,e[27]=T):T=e[27];let A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(li,{size:14,className:"text-muted-foreground"}),e[28]=A):A=e[28];let V;e[29]!==r||e[30]!==D||e[31]!==T?(V=t.jsx("button",{type:"button",onClick:r,className:"h-8 w-8 flex items-center justify-center rounded-lg border border-border hover:bg-accent transition-colors shrink-0",title:D,"aria-label":T,children:A}),e[29]=r,e[30]=D,e[31]=T,e[32]=V):V=e[32];let F;e[33]!==l||e[34]!==i?(F=t.jsx(Cl,{selectedColor:i,onColorChange:l}),e[33]=l,e[34]=i,e[35]=F):F=e[35],e[36]!==V||e[37]!==F||e[38]!==_?(g=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[_,V,F]}),e[36]=V,e[37]=F,e[38]=_,e[39]=g):g=e[39],m=Fs,p="h-56",u="grid grid-cols-9 gap-0.5 px-2 pb-2",d=f.map(I=>{const O=Dt(I);return O?t.jsx("button",{type:"button",onClick:()=>o(I),className:fe("h-8 w-8 flex items-center justify-center rounded-lg transition-colors cursor-pointer",h===I?fe(C.bg,C.text):fe(C.text,"hover:bg-accent")),title:I,"aria-label":wt(I),children:t.jsx(O,{size:18})},I):null}),e[0]=h,e[1]=l,e[2]=r,e[3]=s,e[4]=o,e[5]=n,e[6]=i,e[7]=c,e[8]=m,e[9]=f,e[10]=u,e[11]=d,e[12]=p,e[13]=x,e[14]=g}else m=e[8],f=e[9],u=e[10],d=e[11],p=e[12],x=e[13],g=e[14];let b;e[40]!==u||e[41]!==d?(b=t.jsx("div",{className:u,children:d}),e[40]=u,e[41]=d,e[42]=b):b=e[42];let y;e[43]!==f.length||e[44]!==c?(y=f.length===0&&t.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:c("common.iconPicker.noIconsFound")}),e[43]=f.length,e[44]=c,e[45]=y):y=e[45];let j;e[46]!==m||e[47]!==p||e[48]!==b||e[49]!==y?(j=t.jsxs(m,{className:p,children:[b,y]}),e[46]=m,e[47]=p,e[48]=b,e[49]=y,e[50]=j):j=e[50];let v;return e[51]!==x||e[52]!==g||e[53]!==j?(v=t.jsxs("div",{className:x,children:[g,j]}),e[51]=x,e[52]=g,e[53]=j,e[54]=v):v=e[54],v}function kl(a){const e=H.c(46),{onUpload:n}=a,s=X(),i=G.useRef(null);let l;e[0]!==n||e[1]!==s?(l=V=>{const F=V.target.files?.[0];if(!F)return;if(F.size>2097152){re.error(s("common.iconPicker.imageTooLarge")),V.target.value="";return}const I=new FileReader;I.onerror=()=>{re.error(s("common.iconPicker.failedToReadImage")),i.current&&(i.current.value="")},I.onloadend=()=>{I.readyState===FileReader.DONE&&I.result&&n(I.result),i.current&&(i.current.value="")},I.readAsDataURL(F)},e[0]=n,e[1]=s,e[2]=l):l=e[2];const o=l,[r,h]=G.useState("");let c;e[3]!==n||e[4]!==r?(c=()=>{const V=r.trim();V&&(n(V),h(""))},e[3]=n,e[4]=r,e[5]=c):c=e[5];const m=c;let f;e[6]!==o?(f=t.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:o}),e[6]=o,e[7]=f):f=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=()=>i.current?.click(),e[8]=u):u=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ui,{size:20}),e[9]=d):d=e[9];let p;e[10]!==s?(p=s("common.iconPicker.uploadHint"),e[10]=s,e[11]=p):p=e[11];let x;e[12]!==p?(x=t.jsxs("button",{type:"button",onClick:u,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[d,t.jsx("span",{className:"text-xs",children:p})]}),e[12]=p,e[13]=x):x=e[13];let g;e[14]!==s?(g=s("common.iconPicker.or"),e[14]=s,e[15]=g):g=e[15];let b;e[16]!==g?(b=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[16]=g,e[17]=b):b=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("div",{className:"flex-1 h-px bg-border"}),e[18]=y):y=e[18];let j;e[19]!==b?(j=t.jsxs("div",{className:"flex items-center gap-2",children:[b,y]}),e[19]=b,e[20]=j):j=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=V=>h(V.target.value),e[21]=v):v=e[21];let S;e[22]!==s?(S=s("common.iconPicker.pasteUrlPlaceholder"),e[22]=s,e[23]=S):S=e[23];let C;e[24]!==m?(C=V=>{V.key==="Enter"&&(V.preventDefault(),m())},e[24]=m,e[25]=C):C=e[25];let M;e[26]!==r||e[27]!==S||e[28]!==C?(M=t.jsx(Me,{value:r,onChange:v,placeholder:S,className:"h-8 text-xs flex-1",onKeyDown:C}),e[26]=r,e[27]=S,e[28]=C,e[29]=M):M=e[29];let w;e[30]!==r?(w=r.trim(),e[30]=r,e[31]=w):w=e[31];const N=!w;let _;e[32]!==s?(_=s("common.iconPicker.apply"),e[32]=s,e[33]=_):_=e[33];let D;e[34]!==m||e[35]!==N||e[36]!==_?(D=t.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:m,disabled:N,children:_}),e[34]=m,e[35]=N,e[36]=_,e[37]=D):D=e[37];let T;e[38]!==M||e[39]!==D?(T=t.jsxs("div",{className:"flex items-center gap-1.5",children:[M,D]}),e[38]=M,e[39]=D,e[40]=T):T=e[40];let A;return e[41]!==j||e[42]!==T||e[43]!==f||e[44]!==x?(A=t.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[f,x,j,T]}),e[41]=j,e[42]=T,e[43]=f,e[44]=x,e[45]=A):A=e[45],A}function Tl(a){const e=H.c(55),{form:n,onCommit:s}=a,i=X(),l=G.useId();let o;e[0]!==i?(o=i("virtualMcp.settings.identity.icon"),e[0]=i,e[1]=o):o=e[1];let r;e[2]!==o?(r=t.jsx("p",{className:"text-sm font-medium",children:o}),e[2]=o,e[3]=r):r=e[3];let h;e[4]!==i?(h=i("virtualMcp.settings.identity.iconDescription"),e[4]=i,e[5]=h):h=e[5];let c;e[6]!==h?(c=t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:h}),e[6]=h,e[7]=c):c=e[7];let m;e[8]!==r||e[9]!==c?(m=t.jsxs("div",{children:[r,c]}),e[8]=r,e[9]=c,e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==s||e[13]!==i?(f=D=>{const{field:T}=D;return t.jsx("div",{className:"justify-self-start",children:t.jsx(Sl,{value:T.value??null,onChange:A=>{T.onChange(A),s()},onColorChange:A=>{n.setValue("metadata.ui.themeColor",A,{shouldDirty:!0}),s()},name:n.watch("title")||i("virtualMcp.virtualMcp.agentNameFallback"),size:"md",avatarClassName:"[&_svg]:w-1/2 [&_svg]:h-1/2"})})},e[11]=n,e[12]=s,e[13]=i,e[14]=f):f=e[14];let u;e[15]!==n.control||e[16]!==f?(u=t.jsx(he,{name:"icon",control:n.control,render:f}),e[15]=n.control,e[16]=f,e[17]=u):u=e[17];let d;e[18]!==m||e[19]!==u?(d=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[m,u]}),e[18]=m,e[19]=u,e[20]=d):d=e[20];const p=`${l}-name`;let x;e[21]!==i?(x=i("virtualMcp.settings.identity.name"),e[21]=i,e[22]=x):x=e[22];let g;e[23]!==x||e[24]!==p?(g=t.jsx("label",{htmlFor:p,className:"text-sm font-medium",children:x}),e[23]=x,e[24]=p,e[25]=g):g=e[25];let b;e[26]!==l||e[27]!==s||e[28]!==i?(b=D=>{const{field:T}=D;return t.jsx(Me,{...T,id:`${l}-name`,value:T.value??"",onBlur:()=>{T.onBlur(),s()},placeholder:i("virtualMcp.virtualMcp.agentNamePlaceholder")})},e[26]=l,e[27]=s,e[28]=i,e[29]=b):b=e[29];let y;e[30]!==n.control||e[31]!==b?(y=t.jsx(he,{name:"title",control:n.control,render:b}),e[30]=n.control,e[31]=b,e[32]=y):y=e[32];let j;e[33]!==g||e[34]!==y?(j=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[g,y]}),e[33]=g,e[34]=y,e[35]=j):j=e[35];const v=`${l}-description`;let S;e[36]!==i?(S=i("virtualMcp.settings.identity.description"),e[36]=i,e[37]=S):S=e[37];let C;e[38]!==v||e[39]!==S?(C=t.jsx("label",{htmlFor:v,className:"text-sm font-medium",children:S}),e[38]=v,e[39]=S,e[40]=C):C=e[40];let M;e[41]!==l||e[42]!==s||e[43]!==i?(M=D=>{const{field:T}=D;return t.jsx(it,{...T,id:`${l}-description`,value:T.value??"",onBlur:()=>{T.onBlur(),s()},placeholder:i("virtualMcp.virtualMcp.descriptionPlaceholder"),className:"min-h-24 resize-y"})},e[41]=l,e[42]=s,e[43]=i,e[44]=M):M=e[44];let w;e[45]!==n.control||e[46]!==M?(w=t.jsx(he,{name:"description",control:n.control,render:M}),e[45]=n.control,e[46]=M,e[47]=w):w=e[47];let N;e[48]!==C||e[49]!==w?(N=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[C,w]}),e[48]=C,e[49]=w,e[50]=N):N=e[50];let _;return e[51]!==j||e[52]!==N||e[53]!==d?(_=t.jsxs(Le,{children:[d,j,N]}),e[51]=j,e[52]=N,e[53]=d,e[54]=_):_=e[54],_}const Qs=["general","connections","site"],Dl={general:{icon:ci,titleKey:"virtualMcp.settings.general.title",descriptionKey:"virtualMcp.settings.general.description"},connections:{icon:Yi,titleKey:"virtualMcp.settings.connections.title",descriptionKey:"virtualMcp.settings.connections.description"},site:{icon:oi,titleKey:"virtualMcp.settings.site.title",descriptionKey:"virtualMcp.settings.site.description"}};function Vl(a){return!!a&&Qs.includes(a)}function Al(a){const e=H.c(8),{section:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.settings.navigation"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==n||e[3]!==s?(l=Qs.map(r=>{const{titleKey:h}=Dl[r];return t.jsx(ze.Tab,{active:n===r,asChild:!0,children:t.jsx(ys,{to:".",activeOptions:{exact:!0,explicitUndefined:!0},search:c=>({...c,section:r==="general"?void 0:r}),children:s(h)})},r)}),e[2]=n,e[3]=s,e[4]=l):l=e[4];let o;if(e[5]!==i||e[6]!==l){const r=t.jsx(ze.Tabs,{"aria-label":i,children:l});o=t.jsx(cn.Toolbar.Left.Portal,{fallback:r,children:r}),e[5]=i,e[6]=l,e[7]=o}else o=e[7];return o}function Il(){const a=H.c(8),e=Mt();let n;a[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},a[0]=n):n=a[0];const{section:s}=dn(n);let i;a[1]!==s?(i=Vl(s)?s:"general",a[1]=s,a[2]=i):i=a[2];let l;a[3]!==e?(l=r=>e({to:".",search:h=>({...h,section:r??void 0})}),a[3]=e,a[4]=l):l=a[4];let o;return a[5]!==i||a[6]!==l?(o={section:i,openSection:l},a[5]=i,a[6]=l,a[7]=o):o=a[7],o}const jt={tools:null,resources:null,prompts:null},Ol=Bi.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Pl(a){const n=new TextEncoder().encode(a),s=Array.from(n,i=>String.fromCharCode(i)).join("");return btoa(s)}function Xs(a){return{"x-studio-client":a,"x-mesh-client":a}}function $l(a){const e=H.c(15),{url:n,agentId:s}=a,i=X(),[l,o]=G.useState(!1);let r;e[0]!==s||e[1]!==i||e[2]!==n?(r=async()=>{ge("agent_connect_action",{agent_id:s,action:"copy_url"}),await navigator.clipboard.writeText(n),o(!0),re.success(i("virtualMcp.virtualMcpShareModal.agentUrlCopied")),await tt(2e3),o(!1)},e[0]=s,e[1]=i,e[2]=n,e[3]=r):r=e[3];const h=r;let c;e[4]!==l?(c=l?t.jsx(et,{size:20,className:"text-success"}):t.jsx(ht,{size:20}),e[4]=l,e[5]=c):c=e[5];let m;e[6]!==l||e[7]!==i?(m=i(l?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.copyUrl"),e[6]=l,e[7]=i,e[8]=m):m=e[8];let f;e[9]!==m?(f=t.jsx("span",{className:"text-xs font-medium",children:m}),e[9]=m,e[10]=f):f=e[10];let u;return e[11]!==h||e[12]!==c||e[13]!==f?(u=t.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,f]}),e[11]=h,e[12]=c,e[13]=f,e[14]=u):u=e[14],u}function El(a){const e=H.c(13),{url:n,serverName:s,agentId:i}=a,l=X();let o;e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n?(o=()=>{ge("agent_connect_action",{agent_id:i,action:"install_cursor"});const u=Ls(s),d={type:"http",url:n,headers:Xs("Cursor")},p=Pl(JSON.stringify(d,null,2)),x=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(p)}`;window.open(x,"_blank"),re.success(l("virtualMcp.virtualMcpShareModal.openingCursor"))},e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=o):o=e[4];const r=o;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),e[5]=h):h=e[5];let c;e[6]!==l?(c=l("virtualMcp.virtualMcpShareModal.installOnCursor"),e[6]=l,e[7]=c):c=e[7];let m;e[8]!==c?(m=t.jsx("span",{className:"text-xs font-medium",children:c}),e[8]=c,e[9]=m):m=e[9];let f;return e[10]!==r||e[11]!==m?(f=t.jsxs(se,{type:"button",variant:"outline",onClick:r,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,m]}),e[10]=r,e[11]=m,e[12]=f):f=e[12],f}function Fl(a){const e=H.c(16),{url:n,serverName:s,agentId:i}=a,l=X(),[o,r]=G.useState(!1);let h;e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n?(h=async()=>{ge("agent_connect_action",{agent_id:i,action:"install_claude_code"});const p=Ls(s),x={type:"http",url:n,headers:Xs("Claude Code")},g=JSON.stringify(x,null,2),b=`claude mcp add-json "${p}" '${g.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(b),r(!0),re.success(l("virtualMcp.virtualMcpShareModal.claudeCodeCommandCopied")),await tt(2e3),r(!1)},e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=h):h=e[4];const c=h;let m;e[5]!==o?(m=o?t.jsx(et,{size:20,className:"text-success"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[5]=o,e[6]=m):m=e[6];let f;e[7]!==o||e[8]!==l?(f=l(o?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.installOnClaudeCode"),e[7]=o,e[8]=l,e[9]=f):f=e[9];let u;e[10]!==f?(u=t.jsx("span",{className:"text-xs font-medium",children:f}),e[10]=f,e[11]=u):u=e[11];let d;return e[12]!==c||e[13]!==m||e[14]!==u?(d=t.jsxs(se,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,u]}),e[12]=c,e[13]=m,e[14]=u,e[15]=d):d=e[15],d}function zl({virtualMcp:a}){const e=X(),n=ot(),[s,i]=G.useState(null),[l,o]=G.useState(!1),[r,h]=G.useState(!1),c=a.id,m=a.title||`agent-${c.slice(0,8)}`,f=s?`bunx @decocms/typegen@latest --mcp ${c} --key ${s} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,u=async()=>{o(!0);try{const{key:p}=await n.call("API_KEY_CREATE",{name:`typegen-${m}`,permissions:{[c]:["*"]}});if(!p)throw new Error("No key in response");i(p),ge("agent_typegen_key_generated",{agent_id:c})}catch{ge("agent_typegen_key_failed",{agent_id:c}),re.error(e("virtualMcp.virtualMcpShareModal.failedGenerateApiKey"))}finally{o(!1)}},d=async()=>{ge("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!s}),await navigator.clipboard.writeText(f),h(!0),re.success(e("virtualMcp.virtualMcpShareModal.commandCopied")),await tt(2e3),h(!1)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClient")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClientDescription")})]}),!s&&t.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:u,disabled:l,children:[l?t.jsx(Xe,{className:"size-3.5"}):t.jsx($t,{size:14}),t.jsx("span",{children:e(l?"virtualMcp.virtualMcpShareModal.generating":"virtualMcp.virtualMcpShareModal.generateApiKey")})]})]}),s&&t.jsx("p",{className:"rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-warning",children:e("virtualMcp.virtualMcpShareModal.storeKeySecurely")}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateClientLabel")}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:f}),t.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:r?t.jsx(et,{size:12,className:"text-success"}):t.jsx(ht,{size:12})})]})}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.runtimeVariables")}),t.jsx(Rl,{apiKey:s,agentId:c})]})}function Rl(a){const e=H.c(21),{apiKey:n,agentId:s}=a,[i,l]=G.useState(!1),o=window.location.origin,r=n?`STUDIO_API_KEY=${n}`:"STUDIO_API_KEY=<api-key>",h=`STUDIO_BASE_URL=${o}`,c=`${r}
1
+ import{c as H,b as X,r as G,j as t,B as se,h as Xe,l as fe,I as gs,F as vs,H as bs,G as Ke,aR as Ut,aS as Yt,aT as Bt,t as re,X as Ae,E as Re,Z as js,e_ as en,L as ys,ab as tn,s as sn,dX as He,af as Kt,aa as nn,dW as Le,dV as Be,a2 as ot,m as an,K as ws,e$ as ln,f0 as rn,f1 as on,aU as he,f2 as Ce,n as ze,P as cn,d as Mt,u as dn,q as ge,c$ as un,ai as mn,eJ as fn,f3 as pn,aP as hn,a as xn,f4 as Ss,f5 as gn,aE as vn,a6 as bn,o as jn,an as yn,am as wn,f6 as Sn,as as Nn}from"./index-DYh8jrbk.js";import{g as Cn}from"./extract-connection-data-CRiVhO97.js";import{a as Mn}from"./chat-context-Cdshwjxx.js";import{U as _n,b as kn}from"./build-improve-prompt-doc-DygJIQv6.js";import{E as Tn}from"./empty-state-B8yQ4LTw.js";import{a as Dn}from"./shell-layout-BCElSRO4.js";import{g as ct,n as Vn,a as Wt,e as An,u as In,f as On}from"./use-date-fns-locale-BkKND_24.js";import{a as _t,b as Ns,u as Pn}from"./use-connection-Bn3u4YFa.js";import{b as Cs,a as Ms,e as _s,g as ks,k as $n}from"./github-repo-DTfdF7MX.js";import{a as En,i as Gt}from"./mcp-oauth-BtZRk9Yo.js";import{f as Fn,e as zn,b as Rn,A as Ln,a as Un,d as Yn,c as Bn,g as Kn}from"./alert-dialog-C_ia0v-T.js";import{D as Je,b as Ze,c as dt,d as ut,e as Ts,h as Wn}from"./dialog-Ba2vgagi.js";import{T as it}from"./textarea-CXlCMzII.js";import{b as je,T as ye,a as we}from"./tooltip-DU10eEii.js";import{n as Gn}from"./LinkExternal01-DrnuQ7il.js";import{b8 as Hn,l as qn,b9 as Qn,ba as Xn,aL as Jn,au as Zn,aA as kt,bb as Tt,bc as Ds,ah as Dt,bd as wt,j as ei,g as Vs,m as Ht,n as ti,q as si,p as ni,f as As,be as qt,bf as ii,bg as Is,bh as gt,bi as Qt,A as Xt,E as ai,bj as li,bk as ri,N as oi,W as ci,aJ as di,a7 as ui,an as mi}from"./agent-icon-Rfg09hGF.js";import{s as $e}from"./Plus-ho6b-a71.js";import{t as nt,a as fi}from"./Tool01-BjGNbYgZ.js";import{s as Vt}from"./Trash01-DC_GXkbG.js";import{u as Jt}from"./use-debounced-autosave-DB41iTRk.js";import{A as pi}from"./add-connection-dialog-C8LGEpWI.js";import{i as at}from"./SearchMd-CSaF80bm.js";import{F as Zt}from"./file-type-icon-SChsqlUb.js";import{i as hi,h as xi,m as gi,o as vi}from"./use-org-fs-GZosBvnR.js";import{I as Ge}from"./integration-icon-DZnTns_u.js";import{C as Os}from"./checkbox-A9vbl5N2.js";import{S as bi}from"./search-input-DwpeRojH.js";import{b as ke,a as Te,c as xe,d as De,S as Ve}from"./select-CESqWIsK.js";import{s as At}from"./XClose-Bd7dO8fP.js";import{C as ji}from"./collection-tabs-B96E7Ndf.js";import{T as Ps,u as $s}from"./use-mcp-auth-status-DVpm61QU.js";import{u as mt}from"./use-mcp-client-DBWYx08Y.js";import{a as Es}from"./use-mcp-tools-DpzBxN7Q.js";import{u as yi}from"./use-mcp-prompts-D3a-zrUV.js";import{g as wi}from"./connection-slug-CITJ0kGN.js";import{t as St}from"./utils-CVEq3hMx.js";import{I as Me}from"./input-BNlT9quL.js";import{S as ft}from"./switch-_C4M_ZrZ.js";import{P as It,a as Ot,b as Pt}from"./popover-mQuRv-90.js";import{S as Fs}from"./scroll-area-CZS9UzKT.js";import{i as Si}from"./DotsVertical-D_1q-hun.js";import{a as Ni}from"./Image01-D1A2pgAE.js";import{i as Ci}from"./Monitor01-BKyPX68x.js";import{g as Mi}from"./types-Czpy3NYR.js";import{b as lt,g as _i,d as ki}from"./use-project-scope-DkA7Grxb.js";import{a as Ti}from"./use-panel-navigate-BzX6F8y5.js";import{u as Di}from"./use-project-native-view-presence-B9zdY3NQ.js";import{e as Nt,r as Ct,p as Vi,j as Ai,s as Ii,k as Oi,l as Pi,a as $i}from"./use-chat-layout-state-aruazlXE.js";import{a as zs,u as Ei,i as Fi,o as zi,r as es,p as Ri,w as Li,b as ts}from"./optimistic-project-sidebar-views-BREwX6ob.js";import{i as Ui}from"./Upload01-DgOQWkJ-.js";import{i as Yi}from"./Link01-EhpAe5I7.js";import{V as Bi,E as pt,r as Rs,C as Ki,w as Wi}from"./virtual-mcp-De5MSXcr.js";import{s as Ls}from"./slugify-CEUa2lfQ.js";import{b as Gi,a as Hi,D as qi}from"./drawer-DXEx5yyN.js";import{u as Qi}from"./use-mobile-ykFv5E3U.js";import{i as et}from"./Check-BSlvOf7_.js";import{a as ht}from"./Copy01-TAU83rpm.js";import{i as $t}from"./Key01-DLn9A4zc.js";import{d as tt}from"./backoff-8mStPHYB.js";import{R as Xi}from"./repository-import-picker-BZwQ92-3.js";import{b as Ji}from"./sandbox-url-D3mC8qhT.js";import{L as ve}from"./label-BWDINIlA.js";import{S as Zi,a as ea,b as ta}from"./secret-picker-BM9Rpe3x.js";import{u as sa,a as na}from"./use-secrets-DmpswS6q.js";import{o as ss}from"./omit-sandbox-map-jj4lCB2U.js";import{G as ia}from"./repository-picker-BWH2DKse.js";import{p as aa,s as la,f as ra}from"./thread-intent-C1H9D-w3.js";import{r as oa}from"./serial-task-queue-CGOeQgpr.js";import{t as Ie,c as We,m as ca,a as Us}from"./differenceInSeconds-C3x8sHUj.js";function Qe(a,e){const n=ct(),s=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ie(a,e?.in),l=i.getDay(),o=(l<s?7:0)+l-s;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function rt(a,e){return Qe(a,{...e,weekStartsOn:1})}function Ys(a,e){const n=Ie(a,e?.in),s=n.getFullYear(),i=We(n,0);i.setFullYear(s+1,0,4),i.setHours(0,0,0,0);const l=rt(i),o=We(n,0);o.setFullYear(s,0,4),o.setHours(0,0,0,0);const r=rt(o);return n.getTime()>=l.getTime()?s+1:n.getTime()>=r.getTime()?s:s-1}function ns(a,e){const n=Ie(a,e?.in);return n.setHours(0,0,0,0),n}function da(a,e,n){const[s,i]=Vn(n?.in,a,e),l=ns(s),o=ns(i),r=+l-Wt(l),h=+o-Wt(o);return Math.round((r-h)/ca)}function ua(a,e){const n=Ys(a,e),s=We(a,0);return s.setFullYear(n,0,4),s.setHours(0,0,0,0),rt(s)}function ma(a){return a instanceof Date||typeof a=="object"&&Object.prototype.toString.call(a)==="[object Date]"}function fa(a){return!(!ma(a)&&typeof a!="number"||isNaN(+Ie(a)))}function pa(a,e){const n=Ie(a,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ha(a,e){const n=Ie(a,e?.in);return da(n,pa(n))+1}function xa(a,e){const n=Ie(a,e?.in),s=+rt(n)-+ua(n);return Math.round(s/Us)+1}function Bs(a,e){const n=Ie(a,e?.in),s=n.getFullYear(),i=ct(),l=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=We(e?.in||a,0);o.setFullYear(s+1,0,l),o.setHours(0,0,0,0);const r=Qe(o,e),h=We(e?.in||a,0);h.setFullYear(s,0,l),h.setHours(0,0,0,0);const c=Qe(h,e);return+n>=+r?s+1:+n>=+c?s:s-1}function ga(a,e){const n=ct(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Bs(a,e),l=We(e?.in||a,0);return l.setFullYear(i,0,s),l.setHours(0,0,0,0),Qe(l,e)}function va(a,e){const n=Ie(a,e?.in),s=+Qe(n,e)-+ga(n,e);return Math.round(s/Us)+1}function le(a,e){const n=a<0?"-":"",s=Math.abs(a).toString().padStart(e,"0");return n+s}const Pe={y(a,e){const n=a.getFullYear(),s=n>0?n:1-n;return le(e==="yy"?s%100:s,e.length)},M(a,e){const n=a.getMonth();return e==="M"?String(n+1):le(n+1,2)},d(a,e){return le(a.getDate(),e.length)},a(a,e){const n=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(a,e){return le(a.getHours()%12||12,e.length)},H(a,e){return le(a.getHours(),e.length)},m(a,e){return le(a.getMinutes(),e.length)},s(a,e){return le(a.getSeconds(),e.length)},S(a,e){const n=e.length,s=a.getMilliseconds(),i=Math.trunc(s*Math.pow(10,n-3));return le(i,e.length)}},Ye={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},is={G:function(a,e,n){const s=a.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(s,{width:"abbreviated"});case"GGGGG":return n.era(s,{width:"narrow"});default:return n.era(s,{width:"wide"})}},y:function(a,e,n){if(e==="yo"){const s=a.getFullYear(),i=s>0?s:1-s;return n.ordinalNumber(i,{unit:"year"})}return Pe.y(a,e)},Y:function(a,e,n,s){const i=Bs(a,s),l=i>0?i:1-i;if(e==="YY"){const o=l%100;return le(o,2)}return e==="Yo"?n.ordinalNumber(l,{unit:"year"}):le(l,e.length)},R:function(a,e){const n=Ys(a);return le(n,e.length)},u:function(a,e){const n=a.getFullYear();return le(n,e.length)},Q:function(a,e,n){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return le(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(a,e,n){const s=Math.ceil((a.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return le(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(a,e,n){const s=a.getMonth();switch(e){case"M":case"MM":return Pe.M(a,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(a,e,n){const s=a.getMonth();switch(e){case"L":return String(s+1);case"LL":return le(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(a,e,n,s){const i=va(a,s);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):le(i,e.length)},I:function(a,e,n){const s=xa(a);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):le(s,e.length)},d:function(a,e,n){return e==="do"?n.ordinalNumber(a.getDate(),{unit:"date"}):Pe.d(a,e)},D:function(a,e,n){const s=ha(a);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):le(s,e.length)},E:function(a,e,n){const s=a.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(a,e,n,s){const i=a.getDay(),l=(i-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(l);case"ee":return le(l,2);case"eo":return n.ordinalNumber(l,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(a,e,n,s){const i=a.getDay(),l=(i-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(l);case"cc":return le(l,e.length);case"co":return n.ordinalNumber(l,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(a,e,n){const s=a.getDay(),i=s===0?7:s;switch(e){case"i":return String(i);case"ii":return le(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(a,e,n){const i=a.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(a,e,n){const s=a.getHours();let i;switch(s===12?i=Ye.noon:s===0?i=Ye.midnight:i=s/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(a,e,n){const s=a.getHours();let i;switch(s>=17?i=Ye.evening:s>=12?i=Ye.afternoon:s>=4?i=Ye.morning:i=Ye.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(a,e,n){if(e==="ho"){let s=a.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return Pe.h(a,e)},H:function(a,e,n){return e==="Ho"?n.ordinalNumber(a.getHours(),{unit:"hour"}):Pe.H(a,e)},K:function(a,e,n){const s=a.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):le(s,e.length)},k:function(a,e,n){let s=a.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):le(s,e.length)},m:function(a,e,n){return e==="mo"?n.ordinalNumber(a.getMinutes(),{unit:"minute"}):Pe.m(a,e)},s:function(a,e,n){return e==="so"?n.ordinalNumber(a.getSeconds(),{unit:"second"}):Pe.s(a,e)},S:function(a,e){return Pe.S(a,e)},X:function(a,e,n){const s=a.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return ls(s);case"XXXX":case"XX":return Fe(s);default:return Fe(s,":")}},x:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"x":return ls(s);case"xxxx":case"xx":return Fe(s);default:return Fe(s,":")}},O:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+as(s,":");default:return"GMT"+Fe(s,":")}},z:function(a,e,n){const s=a.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+as(s,":");default:return"GMT"+Fe(s,":")}},t:function(a,e,n){const s=Math.trunc(+a/1e3);return le(s,e.length)},T:function(a,e,n){return le(+a,e.length)}};function as(a,e=""){const n=a>0?"-":"+",s=Math.abs(a),i=Math.trunc(s/60),l=s%60;return l===0?n+String(i):n+String(i)+e+le(l,2)}function ls(a,e){return a%60===0?(a>0?"-":"+")+le(Math.abs(a)/60,2):Fe(a,e)}function Fe(a,e=""){const n=a>0?"-":"+",s=Math.abs(a),i=le(Math.trunc(s/60),2),l=le(s%60,2);return n+i+e+l}const rs=(a,e)=>{switch(a){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},Ks=(a,e)=>{switch(a){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},ba=(a,e)=>{const n=a.match(/(P+)(p+)?/)||[],s=n[1],i=n[2];if(!i)return rs(a,e);let l;switch(s){case"P":l=e.dateTime({width:"short"});break;case"PP":l=e.dateTime({width:"medium"});break;case"PPP":l=e.dateTime({width:"long"});break;default:l=e.dateTime({width:"full"});break}return l.replace("{{date}}",rs(s,e)).replace("{{time}}",Ks(i,e))},ja={p:Ks,P:ba},ya=/^D+$/,wa=/^Y+$/,Sa=["D","DD","YY","YYYY"];function Na(a){return ya.test(a)}function Ca(a){return wa.test(a)}function Ma(a,e,n){const s=_a(a,e,n);if(console.warn(s),Sa.includes(a))throw new RangeError(s)}function _a(a,e,n){const s=a[0]==="Y"?"years":"days of the month";return`Use \`${a.toLowerCase()}\` instead of \`${a}\` (in \`${e}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ka=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ta=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Da=/^'([^]*?)'?$/,Va=/''/g,Aa=/[a-zA-Z]/;function Ia(a,e,n){const s=ct(),i=n?.locale??s.locale??An,l=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,r=Ie(a,n?.in);if(!fa(r))throw new RangeError("Invalid time value");let h=e.match(Ta).map(m=>{const f=m[0];if(f==="p"||f==="P"){const u=ja[f];return u(m,i.formatLong)}return m}).join("").match(ka).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const f=m[0];if(f==="'")return{isToken:!1,value:Oa(m)};if(is[f])return{isToken:!0,value:m};if(f.match(Aa))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:m}});i.localize.preprocessor&&(h=i.localize.preprocessor(r,h));const c={firstWeekContainsDate:l,weekStartsOn:o,locale:i};return h.map(m=>{if(!m.isToken)return m.value;const f=m.value;(!n?.useAdditionalWeekYearTokens&&Ca(f)||!n?.useAdditionalDayOfYearTokens&&Na(f))&&Ma(f,e,String(a));const u=is[f[0]];return u(r,f,i.localize,c)}).join("")}function Oa(a){const e=a.match(Da);return e?e[1].replace(Va,"'"):a}const Ws=25*1024*1024,vt="home",bt="knowledge";function os(a){return a==null?"":a<1024?`${a} B`:a<1024*1024?`${(a/1024).toFixed(0)} KB`:`${(a/(1024*1024)).toFixed(1)} MB`}function Ee(a){return a.split("/").pop()??a}function Pa(a){const e=H.c(64),{form:n}=a,s=X(),{upload:i}=hi(vt),l=xi(),o=G.useRef(null),[r,h]=G.useState(!1),[c,m]=G.useState(""),[f,u]=G.useState(!1);let d;e[0]!==r?(d={enabled:r},e[0]=r,e[1]=d):d=e[1];const{data:p}=gi(60,d),x=p===void 0?[]:p;let g;e[2]!==r?(g={enabled:r},e[2]=r,e[3]=g):g=e[3];const{data:b}=vi(g),y=b===void 0?[]:b;let j;e[4]!==n?(j=()=>n.getValues("metadata.knowledge")??[],e[4]=n,e[5]=j):j=e[5];const[v,S]=G.useState(j);let C;e[6]!==n?(C=P=>{S(P),n.setValue("metadata.knowledge",P,{shouldDirty:!0})},e[6]=n,e[7]=C):C=e[7];const M=C;let w;e[8]!==l||e[9]!==v||e[10]!==M||e[11]!==s||e[12]!==i?(w=async P=>{if(!P||P.length===0)return;const Z=Array.from(P),oe=Z.filter(Ua),Ne=Z.filter(La);if(Ne.length>0&&re.warning(s("virtualMcp.filesSection.fileTooLargeTitle"),{description:s("virtualMcp.filesSection.fileTooLargeDescription",{names:Ne.map(Ra).join(", ")})}),oe.length!==0){try{await i.mutateAsync({dir:bt,files:oe})}catch(be){const Oe=be;re.error(Oe instanceof Error?Oe.message:s("virtualMcp.filesSection.failedUploadFile"));return}M([...v,...oe.map(be=>({id:crypto.randomUUID(),name:be.name,volume:vt,path:`${bt}/${be.name}`,url:l(vt,`${bt}/${be.name}`),contentType:be.type||null,size:be.size,addedAt:new Date().toISOString()}))])}},e[8]=l,e[9]=v,e[10]=M,e[11]=s,e[12]=i,e[13]=w):w=e[13];const N=w;let _;e[14]!==l||e[15]!==v||e[16]!==M?(_=P=>{v.some(Z=>Z.volume===P.volume&&Z.path===P.path)||(M([...v,{id:crypto.randomUUID(),name:Ee(P.path),volume:P.volume,path:P.path,url:l(P.volume,P.path),contentType:null,size:P.size??null,addedAt:new Date().toISOString()}]),h(!1))},e[14]=l,e[15]=v,e[16]=M,e[17]=_):_=e[17];const D=_;let T;e[18]!==l||e[19]!==v||e[20]!==M?(T=P=>{v.some(Z=>Z.volume===P.volume&&Z.path===P.path)||(M([...v,{id:crypto.randomUUID(),name:Ee(P.path),kind:"skill",volume:P.volume,path:P.path,url:l(P.volume,P.path),contentType:null,size:null,addedAt:new Date().toISOString()}]),h(!1))},e[18]=l,e[19]=v,e[20]=M,e[21]=T):T=e[21];const A=T;let V;e[22]!==v||e[23]!==M?(V=P=>{M(v.filter(Z=>Z.id!==P))},e[22]=v,e[23]=M,e[24]=V):V=e[24];const F=V;let I;e[25]===Symbol.for("react.memo_cache_sentinel")?(I=P=>{h(P),P&&m("")},e[25]=I):I=e[25];const O=I;let z;e[26]!==v?(z=new Set(v.map(za)),e[26]=v,e[27]=z):z=e[27];const q=z,Y=c.toLowerCase();let K;e[28]!==q?(K=P=>!q.has(`${P.volume}/${P.path}`),e[28]=q,e[29]=K):K=e[29];const L=x.filter(Fa).filter(K).filter(P=>Ee(P.path).toLowerCase().includes(Y)).slice(0,5);let k;e[30]!==q?(k=P=>!q.has(`${P.volume}/${P.path}`),e[30]=q,e[31]=k):k=e[31];const $=y.filter(k).filter(P=>Ee(P.path).toLowerCase().includes(Y)).slice(0,5),W=P=>t.jsxs(gs,{open:r,onOpenChange:O,children:[t.jsx(vs,{asChild:!0,children:P}),t.jsxs(bs,{align:"end",className:"w-56",children:[t.jsxs(Ke,{onSelect:()=>{o.current?.click()},children:[t.jsx(Hn,{size:16}),s("virtualMcp.filesSection.uploadFile")]}),t.jsxs(Ut,{children:[t.jsxs(Yt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(qn,{size:16}),s("virtualMcp.filesSection.selectFileOrFolder")]}),t.jsxs(Bt,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(at,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:c,onChange:Z=>m(Z.target.value),onKeyDown:Ea,placeholder:s("virtualMcp.filesSection.searchFilesPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:L.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:s("virtualMcp.filesSection.noFilesFound")}):L.map(Z=>t.jsxs(Ke,{onSelect:()=>D(Z),children:[t.jsx(Zt,{filename:Ee(Z.path),className:"h-5 w-4 shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ee(Z.path)}),Z.size!=null&&t.jsx("span",{className:"text-xs text-muted-foreground",children:os(Z.size)})]},`${Z.volume}/${Z.path}`))})]})]}),t.jsxs(Ut,{children:[t.jsxs(Yt,{className:"gap-2 [&_svg:not([class*='text-'])]:text-muted-foreground",children:[t.jsx(nt,{size:16}),s("virtualMcp.filesSection.selectSkill")]}),t.jsxs(Bt,{className:"w-72 p-0",children:[t.jsxs("div",{className:"flex items-center gap-2 border-b px-3",children:[t.jsx(at,{size:16,className:"shrink-0 text-muted-foreground"}),t.jsx("input",{value:c,onChange:Z=>m(Z.target.value),onKeyDown:$a,placeholder:s("virtualMcp.filesSection.searchSkillsPlaceholder"),className:"h-10 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"})]}),t.jsx("div",{className:"max-h-64 overflow-y-auto p-1",children:$.length===0?t.jsx("p",{className:"px-2 py-3 text-center text-sm text-muted-foreground",children:s("virtualMcp.filesSection.noSkillsFound")}):$.map(Z=>t.jsxs(Ke,{onSelect:()=>A(Z),children:[t.jsx(nt,{size:16,className:"shrink-0"}),t.jsx("span",{className:"flex-1 truncate",children:Ee(Z.path)})]},`${Z.volume}/${Z.path}`))})]})]})]})]}),U="flex flex-col gap-3";let R;e[32]!==s?(R=s("virtualMcp.filesSection.filesAndSkills"),e[32]=s,e[33]=R):R=e[33];let B;e[34]!==R?(B=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:R}),e[34]=R,e[35]=B):B=e[35];let J;e[36]!==s?(J=s("virtualMcp.filesSection.description"),e[36]=s,e[37]=J):J=e[37];let ie;e[38]!==J?(ie=t.jsx("p",{className:"text-sm text-muted-foreground",children:J}),e[38]=J,e[39]=ie):ie=e[39];let ee;e[40]!==B||e[41]!==ie?(ee=t.jsxs("div",{className:"flex flex-col gap-1",children:[B,ie]}),e[40]=B,e[41]=ie,e[42]=ee):ee=e[42];const ce=v.length>0&&W(t.jsxs(se,{variant:"outline",size:"sm",disabled:i.isPending,children:[i.isPending?t.jsx(Xe,{size:"xs"}):t.jsx($e,{size:14}),s("virtualMcp.filesSection.add")]}));let de;e[43]!==ee||e[44]!==ce?(de=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[ee,ce]}),e[43]=ee,e[44]=ce,e[45]=de):de=e[45];let ue;e[46]!==N?(ue=t.jsx("input",{ref:o,type:"file",multiple:!0,className:"hidden",onChange:P=>{N(P.target.files),P.target.value=""}}),e[46]=N,e[47]=ue):ue=e[47];let te,pe;e[48]===Symbol.for("react.memo_cache_sentinel")?(te=P=>{P.preventDefault(),u(!0)},pe=()=>u(!1),e[48]=te,e[49]=pe):(te=e[48],pe=e[49]);let me;e[50]!==N?(me=P=>{P.preventDefault(),P.stopPropagation(),u(!1),N(P.dataTransfer.files)},e[50]=N,e[51]=me):me=e[51];const Se=f&&"outline outline-2 outline-dashed outline-primary";let E;e[52]!==Se?(E=fe("flex flex-col gap-2 rounded-lg",Se),e[52]=Se,e[53]=E):E=e[53];const ne=v.length===0?W(t.jsxs("button",{type:"button",className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx($e,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground flex-1",children:s("virtualMcp.filesSection.noFilesOrSkillsYet")})]})):v.map(P=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-card",children:[P.kind==="skill"?t.jsx("div",{className:"flex items-center justify-center h-8 w-6.5 shrink-0 rounded-md bg-muted text-muted-foreground",children:t.jsx(nt,{size:16})}):t.jsx(Zt,{filename:P.name,className:"h-8 w-6.5 shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:P.name}),t.jsx("p",{className:"text-xs text-muted-foreground",children:P.kind==="skill"?s("virtualMcp.filesSection.kindSkill"):P.size!=null?os(P.size):s("virtualMcp.filesSection.kindFile")})]}),t.jsx(se,{variant:"ghost",size:"icon",onClick:()=>F(P.id),"aria-label":s("virtualMcp.filesSection.removeAriaLabel",{name:P.name}),children:t.jsx(Vt,{size:16})})]},P.id));let Q;e[54]!==te||e[55]!==pe||e[56]!==me||e[57]!==E||e[58]!==ne?(Q=t.jsx("div",{onDragOver:te,onDragLeave:pe,onDrop:me,className:E,children:ne}),e[54]=te,e[55]=pe,e[56]=me,e[57]=E,e[58]=ne,e[59]=Q):Q=e[59];let ae;return e[60]!==de||e[61]!==ue||e[62]!==Q?(ae=t.jsxs("section",{className:U,children:[de,ue,Q]}),e[60]=de,e[61]=ue,e[62]=Q,e[63]=ae):ae=e[63],ae}function $a(a){return a.stopPropagation()}function Ea(a){return a.stopPropagation()}function Fa(a){return a.kind!=="dir"}function za(a){return`${a.volume}/${a.path}`}function Ra(a){return a.name}function La(a){return a.size>Ws}function Ua(a){return a.size<=Ws}function Ya(a){return a==null?"all":a.length===0?"self":"selected"}function Ba(a){const e=H.c(88),{form:n,currentAgentId:s}=a,i=X(),{org:l}=Ae(),o=Cs(),[r,h]=G.useState(!1);let c;e[0]!==n?(c=n.getValues("metadata.subAgents")??null,e[0]=n,e[1]=c):c=e[1];const m=c;let f;e[2]!==m?(f=()=>Ya(m),e[2]=m,e[3]=f):f=e[3];const[u,d]=G.useState(f);let p;e[4]!==m?(p=m??[],e[4]=m,e[5]=p):p=e[5];const[x,g]=G.useState(p);let b,y,j,v,S,C;if(e[6]!==o||e[7]!==s||e[8]!==n||e[9]!==u||e[10]!==l||e[11]!==x||e[12]!==i){let _;e[19]!==s||e[20]!==l?(_=te=>te.id!==s&&te.id!==l.id&&te.status==="active",e[19]=s,e[20]=l,e[21]=_):_=e[21],b=o.filter(_);let D;e[22]!==x?(D=te=>x.includes(te.id),e[22]=x,e[23]=D):D=e[23];const T=b.filter(D);let A;e[24]!==n?(A=(te,pe)=>n.setValue("metadata.subAgents",te==="all"?null:te==="self"?[]:pe,{shouldDirty:!0}),e[24]=n,e[25]=A):A=e[25];const V=A;let F;e[26]!==V||e[27]!==x?(F=te=>{d(te),V(te,x)},e[26]=V,e[27]=x,e[28]=F):F=e[28];const I=F;let O;e[29]!==V||e[30]!==x?(O=te=>{const pe=x.includes(te)?x.filter(me=>me!==te):[...x,te];g(pe),V("selected",pe)},e[29]=V,e[30]=x,e[31]=O):O=e[31],y=O,S="flex flex-col gap-3";let z;e[32]!==i?(z=i("virtualMcp.subAgentsSection.title"),e[32]=i,e[33]=z):z=e[33];let q;e[34]!==z?(q=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:z}),e[34]=z,e[35]=q):q=e[35];let Y;e[36]!==u||e[37]!==i?(Y=u==="all"&&t.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canDelegateToAnyAgent")}),e[36]=u,e[37]=i,e[38]=Y):Y=e[38];let K;e[39]!==u||e[40]!==i?(K=u==="self"&&t.jsx("p",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.canOnlyDelegateToItself")}),e[39]=u,e[40]=i,e[41]=K):K=e[41];let L;e[42]!==q||e[43]!==Y||e[44]!==K?(L=t.jsxs("div",{className:"flex flex-col gap-1",children:[q,Y,K]}),e[42]=q,e[43]=Y,e[44]=K,e[45]=L):L=e[45];const k=u==="selected"&&T.length>0&&t.jsxs(se,{variant:"outline",size:"sm",onClick:()=>h(!0),children:[t.jsx($e,{size:14}),i("virtualMcp.subAgentsSection.addSubAgent")]});let $;e[46]!==I?($=te=>I(te),e[46]=I,e[47]=$):$=e[47];let W;e[48]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx(ke,{size:"sm",className:"w-auto",children:t.jsx(Te,{})}),e[48]=W):W=e[48];let U;e[49]!==i?(U=i("virtualMcp.subAgentsSection.anyAgent"),e[49]=i,e[50]=U):U=e[50];let R;e[51]!==U?(R=t.jsx(xe,{value:"all",children:U}),e[51]=U,e[52]=R):R=e[52];let B;e[53]!==i?(B=i("virtualMcp.subAgentsSection.specificAgents"),e[53]=i,e[54]=B):B=e[54];let J;e[55]!==B?(J=t.jsx(xe,{value:"selected",children:B}),e[55]=B,e[56]=J):J=e[56];let ie;e[57]!==i?(ie=i("virtualMcp.subAgentsSection.onlyItself"),e[57]=i,e[58]=ie):ie=e[58];let ee;e[59]!==ie?(ee=t.jsx(xe,{value:"self",children:ie}),e[59]=ie,e[60]=ee):ee=e[60];let ce;e[61]!==R||e[62]!==J||e[63]!==ee?(ce=t.jsxs(De,{align:"end",children:[R,J,ee]}),e[61]=R,e[62]=J,e[63]=ee,e[64]=ce):ce=e[64];let de;e[65]!==u||e[66]!==$||e[67]!==ce?(de=t.jsxs(Ve,{value:u,onValueChange:$,children:[W,ce]}),e[65]=u,e[66]=$,e[67]=ce,e[68]=de):de=e[68];let ue;e[69]!==k||e[70]!==de?(ue=t.jsxs("div",{className:"flex items-center gap-2",children:[k,de]}),e[69]=k,e[70]=de,e[71]=ue):ue=e[71],e[72]!==L||e[73]!==ue?(C=t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[L,ue]}),e[72]=L,e[73]=ue,e[74]=C):C=e[74],j="flex flex-col gap-2",v=u==="selected"&&(T.length>0?T.map(te=>t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border bg-background",children:[t.jsx(Ge,{icon:te.icon,name:te.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:te.title}),te.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:te.description})]}),t.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y(te.id),children:t.jsx(At,{size:16})})]},te.id)):t.jsxs("button",{type:"button",onClick:()=>h(!0),className:"flex items-center gap-3 px-3 py-2.5 rounded-lg border border-dashed border-border hover:bg-accent/50 transition-colors w-full text-left cursor-pointer",children:[t.jsx("div",{className:"flex items-center justify-center size-8 rounded-md text-muted-foreground/75 border border-dashed border-border shrink-0",children:t.jsx($e,{size:16})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:i("virtualMcp.subAgentsSection.emptyStateMessage")})]})),e[6]=o,e[7]=s,e[8]=n,e[9]=u,e[10]=l,e[11]=x,e[12]=i,e[13]=b,e[14]=y,e[15]=j,e[16]=v,e[17]=S,e[18]=C}else b=e[13],y=e[14],j=e[15],v=e[16],S=e[17],C=e[18];let M;e[75]!==j||e[76]!==v?(M=t.jsx("div",{className:j,children:v}),e[75]=j,e[76]=v,e[77]=M):M=e[77];let w;e[78]!==b||e[79]!==y||e[80]!==r||e[81]!==x?(w=t.jsx(Ka,{open:r,onOpenChange:h,candidates:b,selectedIds:x,onToggle:y}),e[78]=b,e[79]=y,e[80]=r,e[81]=x,e[82]=w):w=e[82];let N;return e[83]!==S||e[84]!==C||e[85]!==M||e[86]!==w?(N=t.jsxs("section",{className:S,children:[C,M,w]}),e[83]=S,e[84]=C,e[85]=M,e[86]=w,e[87]=N):N=e[87],N}function Ka(a){const e=H.c(39),{open:n,onOpenChange:s,candidates:i,selectedIds:l,onToggle:o}=a,r=X(),[h,c]=G.useState("");let m,f,u,d,p,x,g,b,y;if(e[0]!==i||e[1]!==s||e[2]!==o||e[3]!==n||e[4]!==h||e[5]!==l||e[6]!==r){const C=h.toLowerCase(),M=i.filter(_=>_.title.toLowerCase().includes(C)||_.description?.toLowerCase().includes(C));f=Je,b=n,y=s,m=Ze,p="max-w-md";let w;e[16]!==r?(w=r("virtualMcp.subAgentsSection.title"),e[16]=r,e[17]=w):w=e[17],e[18]!==w?(x=t.jsx(dt,{children:t.jsx(ut,{children:w})}),e[18]=w,e[19]=x):x=e[19];let N;e[20]!==r?(N=r("virtualMcp.subAgentsSection.searchPlaceholder"),e[20]=r,e[21]=N):N=e[21],e[22]!==h||e[23]!==N?(g=t.jsx(bi,{value:h,onChange:c,placeholder:N,className:"w-full"}),e[22]=h,e[23]=N,e[24]=g):g=e[24],u="flex flex-col gap-1 max-h-80 overflow-y-auto",d=M.length===0?t.jsx("p",{className:"text-sm text-muted-foreground px-1 py-4 text-center",children:r("virtualMcp.subAgentsSection.noAgentsFound")}):M.map(_=>t.jsxs("button",{type:"button",onClick:()=>o(_.id),className:"flex items-center gap-3 px-2 py-2 rounded-lg hover:bg-accent/50 transition-colors cursor-pointer w-full text-left",children:[t.jsx(Os,{checked:l.includes(_.id),className:"pointer-events-none",tabIndex:-1}),t.jsx(Ge,{icon:_.icon,name:_.title,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:_.title}),_.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.description})]})]},_.id)),e[0]=i,e[1]=s,e[2]=o,e[3]=n,e[4]=h,e[5]=l,e[6]=r,e[7]=m,e[8]=f,e[9]=u,e[10]=d,e[11]=p,e[12]=x,e[13]=g,e[14]=b,e[15]=y}else m=e[7],f=e[8],u=e[9],d=e[10],p=e[11],x=e[12],g=e[13],b=e[14],y=e[15];let j;e[25]!==u||e[26]!==d?(j=t.jsx("div",{className:u,children:d}),e[25]=u,e[26]=d,e[27]=j):j=e[27];let v;e[28]!==m||e[29]!==p||e[30]!==x||e[31]!==g||e[32]!==j?(v=t.jsxs(m,{className:p,children:[x,g,j]}),e[28]=m,e[29]=p,e[30]=x,e[31]=g,e[32]=j,e[33]=v):v=e[33];let S;return e[34]!==f||e[35]!==b||e[36]!==y||e[37]!==v?(S=t.jsx(f,{open:b,onOpenChange:y,children:v}),e[34]=f,e[35]=b,e[36]=y,e[37]=v,e[38]=S):S=e[38],S}function qe(){const a=H.c(1);let e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex items-center justify-center h-32",children:t.jsx(Xe,{className:"size-6 text-muted-foreground"})}),a[0]=e):e=a[0],e}function st(a,e){return({error:n})=>n?.message?.includes("Method not found")||n?.code===-32601?t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:a})}):t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[t.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:t.jsx(js,{className:"h-6 w-6 text-destructive"})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h3",{className:"text-lg font-medium",children:e("virtualMcp.dependencySelectionDialog.somethingWentWrong")}),t.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:n?.message?n.message.length>200?`${n.message.slice(0,200)}...`:n.message:e("virtualMcp.dependencySelectionDialog.unexpectedError")})]})]})}function Gs(a){const e=H.c(23),{item:n,isSelected:s,onToggle:i,disabled:l}=a,o=l?"cursor-not-allowed opacity-50":"cursor-pointer",r=s?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==o||e[1]!==r?(h=fe("flex items-start gap-3 p-4 rounded-lg transition-colors",o,r),e[0]=o,e[1]=r,e[2]=h):h=e[2];let c;e[3]!==n.name?(c=t.jsx("p",{className:"text-sm font-medium leading-none truncate",children:n.name}),e[3]=n.name,e[4]=c):c=e[4];let m;e[5]!==n.tags?(m=n.tags&&t.jsx("span",{className:"shrink-0",children:n.tags}),e[5]=n.tags,e[6]=m):m=e[6];let f;e[7]!==c||e[8]!==m?(f=t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,m]}),e[7]=c,e[8]=m,e[9]=f):f=e[9];let u;e[10]!==n.description?(u=n.description&&t.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:n.description}),e[10]=n.description,e[11]=u):u=e[11];let d;e[12]!==f||e[13]!==u?(d=t.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[f,u]}),e[12]=f,e[13]=u,e[14]=d):d=e[14];let p;e[15]!==l||e[16]!==s||e[17]!==i?(p=t.jsx(Os,{checked:s,onCheckedChange:i,disabled:l,className:"mt-0.5"}),e[15]=l,e[16]=s,e[17]=i,e[18]=p):p=e[18];let x;return e[19]!==h||e[20]!==d||e[21]!==p?(x=t.jsxs("label",{className:h,children:[d,p]}),e[19]=h,e[20]=d,e[21]=p,e[22]=x):x=e[22],x}function Wa(a){const e=H.c(35),{activeTab:n,onTabChange:s,showSelectAll:i,isAllSelected:l,handleSelectAll:o}=a,r=X();let h;e[0]!==r?(h=r("virtualMcp.dependencySelectionDialog.tabTools"),e[0]=r,e[1]=h):h=e[1];let c;e[2]!==h?(c={id:"tools",label:h},e[2]=h,e[3]=c):c=e[3];let m;e[4]!==r?(m=r("virtualMcp.dependencySelectionDialog.tabActive"),e[4]=r,e[5]=m):m=e[5];let f;e[6]!==m?(f={id:"active",label:m},e[6]=m,e[7]=f):f=e[7];let u;e[8]!==r?(u=r("virtualMcp.dependencySelectionDialog.tabResources"),e[8]=r,e[9]=u):u=e[9];let d;e[10]!==u?(d={id:"resources",label:u},e[10]=u,e[11]=d):d=e[11];let p;e[12]!==r?(p=r("virtualMcp.dependencySelectionDialog.tabPrompts"),e[12]=r,e[13]=p):p=e[13];let x;e[14]!==p?(x={id:"prompts",label:p},e[14]=p,e[15]=x):x=e[15];let g;e[16]!==c||e[17]!==f||e[18]!==d||e[19]!==x?(g=[c,f,d,x],e[16]=c,e[17]=f,e[18]=d,e[19]=x,e[20]=g):g=e[20];let b;e[21]!==s?(b=S=>s(S),e[21]=s,e[22]=b):b=e[22];let y;e[23]!==n||e[24]!==b||e[25]!==g?(y=t.jsx(ji,{tabs:g,activeTab:n,onTabChange:b}),e[23]=n,e[24]=b,e[25]=g,e[26]=y):y=e[26];let j;e[27]!==o||e[28]!==l||e[29]!==i||e[30]!==r?(j=i&&t.jsx("button",{type:"button",onClick:o,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:r(l?"virtualMcp.dependencySelectionDialog.deselectAll":"virtualMcp.dependencySelectionDialog.selectAll")}),e[27]=o,e[28]=l,e[29]=i,e[30]=r,e[31]=j):j=e[31];let v;return e[32]!==y||e[33]!==j?(v=t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[y,j]}),e[32]=y,e[33]=j,e[34]=v):v=e[34],v}function Et(a){const e=H.c(13),{items:n,selections:s,onToggle:i,emptyMessage:l,disabled:o}=a;let r,h,c;if(e[0]!==o||e[1]!==l||e[2]!==n||e[3]!==i||e[4]!==s){c=Symbol.for("react.early_return_sentinel");e:{const f=n.map(Ga);if(n.length===0){let u;e[8]!==l?(u=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:l})}),e[8]=l,e[9]=u):u=e[9],c=u;break e}r="flex-1 overflow-auto px-4 py-3 space-y-1",h=n.map(u=>t.jsx(Gs,{item:u,isSelected:s===null||s?.includes(u.id),onToggle:()=>i(u.id,f),disabled:o},u.id))}e[0]=o,e[1]=l,e[2]=n,e[3]=i,e[4]=s,e[5]=r,e[6]=h,e[7]=c}else r=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let m;return e[10]!==r||e[11]!==h?(m=t.jsx("div",{className:r,children:h}),e[10]=r,e[11]=h,e[12]=m):m=e[12],m}function Ga(a){return a.id}function Ha(a){const e=H.c(22),{connectionId:n,toolSelections:s,onToggleTool:i}=a,l=X(),{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=Es(c),f=m.tools;let u,d,p;if(e[6]!==m.tools||e[7]!==i||e[8]!==l||e[9]!==s){p=Symbol.for("react.early_return_sentinel");e:{const g=f.map(Qa);let b;e[13]!==s?(b=v=>s===null||s.includes(v.name),e[13]=s,e[14]=b):b=e[14];const j=m.tools.filter(b).map(qa);if(j.length===0){let v;e[15]!==l?(v=l("virtualMcp.dependencySelectionDialog.noActiveToolsSelected"),e[15]=l,e[16]=v):v=e[16];let S;e[17]!==v?(S=t.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:t.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:v})}),e[17]=v,e[18]=S):S=e[18],p=S;break e}u="flex-1 overflow-auto px-4 py-3 space-y-1",d=j.map(v=>t.jsx(Gs,{item:v,isSelected:!0,onToggle:()=>i(v.id,g)},v.id))}e[6]=m.tools,e[7]=i,e[8]=l,e[9]=s,e[10]=u,e[11]=d,e[12]=p}else u=e[10],d=e[11],p=e[12];if(p!==Symbol.for("react.early_return_sentinel"))return p;let x;return e[19]!==u||e[20]!==d?(x=t.jsx("div",{className:u,children:d}),e[19]=u,e[20]=d,e[21]=x):x=e[21],x}function qa(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Ps,{annotations:a.annotations,_meta:a._meta})}}function Qa(a){return a.name}function Xa(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=Es(c);let f;e[6]!==m.tools?(f=m.tools.map(Ja),e[6]=m.tools,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noToolsAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function Ja(a){return{id:a.name,name:a.name,description:a.description,tags:t.jsx(Ps,{annotations:a.annotations,_meta:a._meta})}}function Za(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=en(c);let f;e[6]!==m.resources?(f=m.resources.map(el),e[6]=m.resources,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noResourcesAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function el(a){return{id:a.name||a.uri,name:a.name||a.uri,description:a.description}}function tl(a){const e=H.c(16),{connectionId:n,selections:s,onToggle:i,disabled:l}=a,{org:o}=Ae();let r;e[0]!==n||e[1]!==o.id||e[2]!==o.slug?(r={connectionId:n,orgId:o.id,orgSlug:o.slug},e[0]=n,e[1]=o.id,e[2]=o.slug,e[3]=r):r=e[3];const h=mt(r);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:m}=yi(c);let f;e[6]!==m.prompts?(f=m.prompts.map(sl),e[6]=m.prompts,e[7]=f):f=e[7];const u=f,d=X();let p;e[8]!==d?(p=d("virtualMcp.dependencySelectionDialog.noPromptsAvailable"),e[8]=d,e[9]=p):p=e[9];let x;return e[10]!==l||e[11]!==u||e[12]!==i||e[13]!==s||e[14]!==p?(x=t.jsx(Et,{items:u,selections:s,onToggle:i,emptyMessage:p,disabled:l}),e[10]=l,e[11]=u,e[12]=i,e[13]=s,e[14]=p,e[15]=x):x=e[15],x}function sl(a){return{id:a.name,name:a.name,description:a.description}}function nl(a){const e=H.c(58),{currentConnection:n,activeTab:s,selectedId:i,formData:l,toggleTool:o,toggleResource:r,togglePrompt:h,toggleAllTools:c,toggleAllResources:m,toggleAllPrompts:f,onTabChange:u}=a,d=X(),p=l[i],x=s==="tools"?p?.tools===null:s==="resources"?p?.resources===null:s==="prompts"?p?.prompts===null:!1,g=s!=="active";let b;e[0]!==s||e[1]!==i||e[2]!==f||e[3]!==m||e[4]!==c?(b=()=>{s==="tools"?c(i):s==="resources"?m(i):s==="prompts"&&f(i)},e[0]=s,e[1]=i,e[2]=f,e[3]=m,e[4]=c,e[5]=b):b=e[5];const y=b;let j;e[6]!==n.icon||e[7]!==n.title?(j=t.jsx(Ge,{icon:n.icon,name:n.title,size:"sm",className:"shrink-0"}),e[6]=n.icon,e[7]=n.title,e[8]=j):j=e[8];let v;e[9]!==n.title?(v=t.jsx("h2",{className:"text-base font-semibold truncate",children:n.title}),e[9]=n.title,e[10]=v):v=e[10];let S;e[11]!==n.description?(S=n.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n.description}),e[11]=n.description,e[12]=S):S=e[12];let C;e[13]!==v||e[14]!==S?(C=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,S]}),e[13]=v,e[14]=S,e[15]=C):C=e[15];let M;e[16]!==j||e[17]!==C?(M=t.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:t.jsxs("div",{className:"flex items-center gap-3",children:[j,C]})}),e[16]=j,e[17]=C,e[18]=M):M=e[18];let w;e[19]!==s||e[20]!==y||e[21]!==x||e[22]!==u||e[23]!==g?(w=t.jsx(Wa,{activeTab:s,onTabChange:u,showSelectAll:g,isAllSelected:x,handleSelectAll:y}),e[19]=s,e[20]=y,e[21]=x,e[22]=u,e[23]=g,e[24]=w):w=e[24];let N;e[25]!==s||e[26]!==l||e[27]!==i||e[28]!==d||e[29]!==o?(N=s==="active"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.toolsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Ha,{connectionId:i,toolSelections:l[i]?l[i].tools:[],onToggleTool:(F,I)=>o(i,F,I)})})}),e[25]=s,e[26]=l,e[27]=i,e[28]=d,e[29]=o,e[30]=N):N=e[30];let _;e[31]!==s||e[32]!==l||e[33]!==i||e[34]!==d||e[35]!==o?(_=s==="tools"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.toolsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Xa,{connectionId:i,selections:l[i]?l[i].tools:[],onToggle:(F,I)=>o(i,F,I)})})}),e[31]=s,e[32]=l,e[33]=i,e[34]=d,e[35]=o,e[36]=_):_=e[36];let D;e[37]!==s||e[38]!==l||e[39]!==i||e[40]!==d||e[41]!==r?(D=s==="resources"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.resourcesNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(Za,{connectionId:i,selections:l[i]?l[i].resources:[],onToggle:(F,I)=>r(i,F,I)})})}),e[37]=s,e[38]=l,e[39]=i,e[40]=d,e[41]=r,e[42]=D):D=e[42];let T;e[43]!==s||e[44]!==l||e[45]!==i||e[46]!==d||e[47]!==h?(T=s==="prompts"&&t.jsx(Re,{fallback:st(d("virtualMcp.dependencySelectionDialog.promptsNotSupported"),d),children:t.jsx(G.Suspense,{fallback:t.jsx(qe,{}),children:t.jsx(tl,{connectionId:i,selections:l[i]?l[i].prompts:[],onToggle:(F,I)=>h(i,F,I)})})}),e[43]=s,e[44]=l,e[45]=i,e[46]=d,e[47]=h,e[48]=T):T=e[48];let A;e[49]!==D||e[50]!==T||e[51]!==N||e[52]!==_?(A=t.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[N,_,D,T]}),e[49]=D,e[50]=T,e[51]=N,e[52]=_,e[53]=A):A=e[53];let V;return e[54]!==A||e[55]!==M||e[56]!==w?(V=t.jsxs(t.Fragment,{children:[M,w,A]}),e[54]=A,e[55]=M,e[56]=w,e[57]=V):V=e[57],V}function il(a){const e=H.c(7),{onClose:n}=a,s=X();let i;e[0]!==n?(i=()=>n(!1),e[0]=n,e[1]=i):i=e[1];let l;e[2]!==s?(l=s("virtualMcp.dependencySelectionDialog.done"),e[2]=s,e[3]=l):l=e[3];let o;return e[4]!==i||e[5]!==l?(o=t.jsx(Ts,{className:"px-6 py-4 border-t border-border shrink-0",children:t.jsx(se,{variant:"outline",onClick:i,children:l})}),e[4]=i,e[5]=l,e[6]=o):o=e[6],o}function al(a){const e=H.c(23),{connectionId:n,onAuthenticate:s,children:i}=a,l=X();let o;e[0]!==n?(o={connectionId:n},e[0]=n,e[1]=o):o=e[1];const r=$s(o);if(r.supportsOAuth&&!r.isAuthenticated){let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:t.jsx(Qn,{size:22,className:"text-muted-foreground"})}),e[2]=m):m=e[2];let f;e[3]!==l?(f=l("virtualMcp.dependencySelectionDialog.authorizationRequired"),e[3]=l,e[4]=f):f=e[4];let u;e[5]!==f?(u=t.jsx("p",{className:"text-sm font-medium",children:f}),e[5]=f,e[6]=u):u=e[6];let d;e[7]!==l?(d=l("virtualMcp.dependencySelectionDialog.authorizationDescription"),e[7]=l,e[8]=d):d=e[8];let p;e[9]!==d?(p=t.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:d}),e[9]=d,e[10]=p):p=e[10];let x;e[11]!==u||e[12]!==p?(x=t.jsxs("div",{className:"space-y-1",children:[u,p]}),e[11]=u,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==n||e[15]!==s||e[16]!==l?(g=s&&t.jsx(se,{variant:"outline",size:"sm",onClick:()=>s(n),children:l("virtualMcp.dependencySelectionDialog.authorize")}),e[14]=n,e[15]=s,e[16]=l,e[17]=g):g=e[17];let b;return e[18]!==x||e[19]!==g?(b=t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[m,x,g]}),e[18]=x,e[19]=g,e[20]=b):b=e[20],b}let c;return e[21]!==i?(c=t.jsx(t.Fragment,{children:i}),e[21]=i,e[22]=c):c=e[22],c}function ll(a){const e={};for(const n of a)e[n.connection_id]={tools:n.selected_tools,resources:n.selected_resources??null,prompts:n.selected_prompts??null};return e}function cs(a){return Object.entries(a).map(([e,n])=>({connection_id:e,selected_tools:n.tools,selected_resources:n.resources,selected_prompts:n.prompts}))}function ds(a,e,n,s){const i=a[e]??{tools:null,resources:null,prompts:null};return{...a,[e]:{...i,[n]:s}}}function rl(a,e){return e.type==="SET_ACTIVE_TAB"?{...a,activeTab:e.payload}:a}function ol(a){const e=H.c(49),{open:n,onOpenChange:s,selectedId:i,form:l,connections:o,onAuthenticate:r}=a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,m]=G.useReducer(rl,h),f=_t(i??"");let u;e[1]!==o?(u=o??[],e[1]=o,e[2]=u):u=e[2];let d;e[3]!==u?(d=ll(u),e[3]=u,e[4]=d):d=e[4];const p=d;let x;e[5]!==l||e[6]!==p?(x=(L,k,$,W)=>{const U=p[L]?.[k];let R;U===null?R=W.filter(B=>B!==$):U?.includes($)?R=U.filter(B=>B!==$):(R=[...U??[],$],R.length===W.length&&(R=null)),l.setValue("connections",cs(ds(p,L,k,R)),{shouldDirty:!0,shouldTouch:!0})},e[5]=l,e[6]=p,e[7]=x):x=e[7];const g=x;let b;e[8]!==l||e[9]!==p?(b=(L,k)=>{const W=p[L]?.[k]===null?[]:null;l.setValue("connections",cs(ds(p,L,k,W)),{shouldDirty:!0,shouldTouch:!0})},e[8]=l,e[9]=p,e[10]=b):b=e[10];const y=b;let j;e[11]!==g?(j=(L,k,$)=>g(L,"tools",k,$),e[11]=g,e[12]=j):j=e[12];const v=j;let S;e[13]!==g?(S=(L,k,$)=>g(L,"resources",k,$),e[13]=g,e[14]=S):S=e[14];const C=S;let M;e[15]!==g?(M=(L,k,$)=>g(L,"prompts",k,$),e[15]=g,e[16]=M):M=e[16];const w=M;let N;e[17]!==y?(N=L=>y(L,"tools"),e[17]=y,e[18]=N):N=e[18];const _=N;let D;e[19]!==y?(D=L=>y(L,"resources"),e[19]=y,e[20]=D):D=e[20];const T=D;let A;e[21]!==y?(A=L=>y(L,"prompts"),e[21]=y,e[22]=A):A=e[22];const V=A;if(!i||!f)return null;let F;e[23]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx(qe,{}),e[23]=F):F=e[23];let I;e[24]===Symbol.for("react.memo_cache_sentinel")?(I=L=>m({type:"SET_ACTIVE_TAB",payload:L}),e[24]=I):I=e[24];let O;e[25]!==f||e[26]!==c.activeTab||e[27]!==p||e[28]!==i||e[29]!==V||e[30]!==T||e[31]!==_||e[32]!==w||e[33]!==C||e[34]!==v?(O=t.jsx(nl,{currentConnection:f,activeTab:c.activeTab,selectedId:i,formData:p,toggleTool:v,toggleResource:C,togglePrompt:w,toggleAllTools:_,toggleAllResources:T,toggleAllPrompts:V,onTabChange:I},i),e[25]=f,e[26]=c.activeTab,e[27]=p,e[28]=i,e[29]=V,e[30]=T,e[31]=_,e[32]=w,e[33]=C,e[34]=v,e[35]=O):O=e[35];let z;e[36]!==r||e[37]!==i||e[38]!==O?(z=t.jsx(G.Suspense,{fallback:F,children:t.jsx(al,{connectionId:i,onAuthenticate:r,children:O})}),e[36]=r,e[37]=i,e[38]=O,e[39]=z):z=e[39];let q;e[40]!==s?(q=t.jsx(il,{onClose:s}),e[40]=s,e[41]=q):q=e[41];let Y;e[42]!==z||e[43]!==q?(Y=t.jsxs(Ze,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[z,q]}),e[42]=z,e[43]=q,e[44]=Y):Y=e[44];let K;return e[45]!==s||e[46]!==n||e[47]!==Y?(K=t.jsx(Je,{open:n,onOpenChange:s,children:Y}),e[45]=s,e[46]=n,e[47]=Y,e[48]=K):K=e[48],K}const us="__new_instance__";function cl(a){const e=H.c(25),{connection_id:n,usedConnectionIds:s,onOpenSettings:i,onRemove:l,onAuthenticate:o,onSwitchInstance:r,onNewInstance:h}=a,c=_t(n),{org:m}=Ae();if(!c){let g;return e[0]!==l?(g=t.jsx(fl,{onRemove:l}),e[0]=l,e[1]=g):g=e[1],g}let f;e[2]!==c?(f=wi(c),e[2]=c,e[3]=f):f=e[3];const u=f;let d;e[4]!==n?(d=t.jsx(ml,{connection_id:n}),e[4]=n,e[5]=d):d=e[5];let p;e[6]!==c.app_name||e[7]!==c.connection_type||e[8]!==c.description||e[9]!==c.icon||e[10]!==c.status||e[11]!==c.title||e[12]!==n||e[13]!==o||e[14]!==h||e[15]!==i||e[16]!==l||e[17]!==r||e[18]!==m.slug||e[19]!==u||e[20]!==s?(p=t.jsx(ul,{connection_id:n,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,connectionStatus:c.status,slug:u,orgSlug:m.slug,appName:c.app_name,usedConnectionIds:s,onOpenSettings:i,onRemove:l,onAuthenticate:o,onSwitchInstance:r,onNewInstance:h}),e[6]=c.app_name,e[7]=c.connection_type,e[8]=c.description,e[9]=c.icon,e[10]=c.status,e[11]=c.title,e[12]=n,e[13]=o,e[14]=h,e[15]=i,e[16]=l,e[17]=r,e[18]=m.slug,e[19]=u,e[20]=s,e[21]=p):p=e[21];let x;return e[22]!==d||e[23]!==p?(x=t.jsx(G.Suspense,{fallback:d,children:p}),e[22]=d,e[23]=p,e[24]=x):x=e[24],x}function dl(a){const e=H.c(24),{appName:n,connectionId:s,usedConnectionIds:i,onSwitchInstance:l,onNewInstance:o}=a,r=X();let h;e[0]!==n?(h={filters:[{column:"app_name",value:n}]},e[0]=n,e[1]=h):h=e[1];const c=Pn(h);if(c.length<=1&&!o)return null;let m;e[2]!==s||e[3]!==o||e[4]!==l?(m=g=>{g===us?o?.():l(s,g)},e[2]=s,e[3]=o,e[4]=l,e[5]=m):m=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ke,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:t.jsx(Te,{})}),e[6]=f):f=e[6];let u;if(e[7]!==s||e[8]!==c||e[9]!==i){let g;e[11]!==s||e[12]!==i?(g=b=>t.jsx(xe,{value:b.id,className:"text-xs",disabled:b.id!==s&&i.has(b.id),children:b.title},b.id),e[11]=s,e[12]=i,e[13]=g):g=e[13],u=c.map(g),e[7]=s,e[8]=c,e[9]=i,e[10]=u}else u=e[10];let d;e[14]!==o||e[15]!==r?(d=o&&t.jsxs(xe,{value:us,className:"text-xs text-muted-foreground",children:["+ ",r("virtualMcp.connectionItem.newInstance")]}),e[14]=o,e[15]=r,e[16]=d):d=e[16];let p;e[17]!==u||e[18]!==d?(p=t.jsxs(De,{children:[u,d]}),e[17]=u,e[18]=d,e[19]=p):p=e[19];let x;return e[20]!==s||e[21]!==m||e[22]!==p?(x=t.jsxs(Ve,{value:s,onValueChange:m,children:[f,p]}),e[20]=s,e[21]=m,e[22]=p,e[23]=x):x=e[23],x}function ul({connection_id:a,connectionTitle:e,connectionDescription:n,connectionIcon:s,connectionType:i,connectionStatus:l,slug:o,orgSlug:r,appName:h,usedConnectionIds:c,onOpenSettings:m,onRemove:f,onAuthenticate:u,onSwitchInstance:d,onNewInstance:p}){const x=$s({connectionId:a}),g=Ns(),y=!(i==="VIRTUAL")&&x.supportsOAuth&&!x.isAuthenticated,j=l!=="active",v=X(),S=async C=>{try{await g.update.mutateAsync({id:a,data:{status:C}}),re.success(v(C==="active"?"virtualMcp.connectionItem.connectionEnabled":"virtualMcp.connectionItem.connectionDisabled"))}catch{re.error(v("virtualMcp.connectionItem.failedToUpdateConnection"))}};return t.jsxs("div",{className:fe("rounded-xl border overflow-hidden transition-colors",y||j?"border-destructive/50 bg-destructive/5":"border-border bg-card"),children:[t.jsxs(ys,{to:"/$org/settings/connections/$appSlug",params:{org:r,appSlug:o},className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[t.jsx(Ge,{icon:s,name:e,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e}),y?t.jsx("span",{className:"text-xs text-destructive font-medium",children:v("virtualMcp.connectionItem.needsAuthorization")}):j?t.jsx("span",{className:"text-xs text-destructive font-medium",children:v(l==="error"?"virtualMcp.connectionItem.disabledError":"virtualMcp.connectionItem.disabled")}):n&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:n})]}),y?t.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:C=>{C.preventDefault(),C.stopPropagation(),u(a)},children:v("virtualMcp.connectionItem.authorize")}):j?t.jsxs(se,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:C=>{C.preventDefault(),C.stopPropagation(),S("active")},children:[t.jsx(Xn,{size:13}),v("virtualMcp.connectionItem.enable")]}):t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:t.jsx(fi,{size:16})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.connectionSettings")})]})]}),t.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[h&&t.jsx(dl,{appName:h,connectionId:a,usedConnectionIds:c,onSwitchInstance:d,onNewInstance:p}),t.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:m,"aria-label":v("virtualMcp.connectionItem.configureResources"),children:t.jsx(Jn,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.configureResources")})]}),!j&&t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>S("inactive"),"aria-label":v("virtualMcp.connectionItem.disableConnection"),children:t.jsx(Zn,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.disable")})]}),t.jsxs(je,{delayDuration:0,children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:f,"aria-label":v("virtualMcp.connectionItem.removeConnection"),children:t.jsx(At,{size:13})})}),t.jsx(we,{side:"bottom",children:v("virtualMcp.connectionItem.remove")})]})]})]})]})}function ml(a){const e=H.c(17),{connection_id:n}=a,s=_t(n);if(!s){let f;return e[0]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Hs,{}),e[0]=f):f=e[0],f}let i;e[1]!==s.icon||e[2]!==s.title?(i=t.jsx(Ge,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[1]=s.icon,e[2]=s.title,e[3]=i):i=e[3];let l;e[4]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[4]=s.title,e[5]=l):l=e[5];let o;e[6]!==s.description?(o=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[6]=s.description,e[7]=o):o=e[7];let r;e[8]!==l||e[9]!==o?(r=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,o]}),e[8]=l,e[9]=o,e[10]=r):r=e[10];let h;e[11]!==i||e[12]!==r?(h=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[i,r]}),e[11]=i,e[12]=r,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let m;return e[15]!==h?(m=t.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=m):m=e[16],m}function fl(a){const e=H.c(20),{onRemove:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.connectionItem.connectionNotFound"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm text-destructive font-medium truncate",children:i})}),e[2]=i,e[3]=l):l=e[3];let o;e[4]!==s?(o=s("virtualMcp.connectionItem.removeConnection"),e[4]=s,e[5]=o):o=e[5];let r;e[6]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx(At,{size:13}),e[6]=r):r=e[6];let h;e[7]!==n||e[8]!==o?(h=t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive shrink-0",onClick:n,"aria-label":o,children:r})}),e[7]=n,e[8]=o,e[9]=h):h=e[9];let c;e[10]!==s?(c=s("virtualMcp.connectionItem.remove"),e[10]=s,e[11]=c):c=e[11];let m;e[12]!==c?(m=t.jsx(we,{side:"bottom",children:c}),e[12]=c,e[13]=m):m=e[13];let f;e[14]!==h||e[15]!==m?(f=t.jsxs(je,{delayDuration:0,children:[h,m]}),e[14]=h,e[15]=m,e[16]=f):f=e[16];let u;return e[17]!==l||e[18]!==f?(u=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 rounded-xl border border-destructive/50 bg-destructive/5",children:[l,f]}),e[17]=l,e[18]=f,e[19]=u):u=e[19],u}function Hs(){const a=H.c(3);let e;a[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),a[0]=e):e=a[0];let n;a[1]===Symbol.for("react.memo_cache_sentinel")?(n=t.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),a[1]=n):n=a[1];let s;return a[2]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[n,t.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:t.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),a[2]=s):s=a[2],s}function pl(a){const e=H.c(5),{value:n}=a;let s;if(e[0]!==n){s=Symbol.for("react.early_return_sentinel");e:{const l=kt(n);if(l.type==="icon"){const o=Dt(l.name);if(o){let r;e[2]!==o?(r=t.jsx(o,{size:16,className:"text-muted-foreground"}),e[2]=o,e[3]=r):r=e[3],s=r;break e}}}e[0]=n,e[1]=s}else s=e[1];if(s!==Symbol.for("react.early_return_sentinel"))return s;let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ei,{size:16,className:"text-muted-foreground"}),e[4]=i):i=e[4],i}function hl(a){const e=H.c(74),{value:n,onChange:s,className:i,disabled:l}=a,o=X(),[r,h]=G.useState(!1),[c,m]=G.useState("");let f;e[0]!==n?(f=kt(n),e[0]=n,e[1]=f):f=e[1];const u=f,d=u.type==="icon"?u.name:null;let p,x,g,b,y,j,v,S,C,M,w,N,_,D,T;if(e[2]!==i||e[3]!==d||e[4]!==l||e[5]!==s||e[6]!==r||e[7]!==c||e[8]!==o||e[9]!==n){const q=Tt();b=Ds(q,c),g=It,y=l?!1:r,j=h;let Y;e[25]!==o?(Y=o("common.simpleIconPicker.changeIcon"),e[25]=o,e[26]=Y):Y=e[26];const K=l?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let L;e[27]!==i||e[28]!==K?(L=fe("size-7 shrink-0 rounded-lg transition-colors flex items-center justify-center",K,i),e[27]=i,e[28]=K,e[29]=L):L=e[29];let k;e[30]!==n?(k=t.jsx(pl,{value:n}),e[30]=n,e[31]=k):k=e[31],e[32]!==l||e[33]!==Y||e[34]!==L||e[35]!==k?(v=t.jsx(Ot,{asChild:!0,children:t.jsx("button",{type:"button",disabled:l,"aria-label":Y,className:L,children:k})}),e[32]=l,e[33]=Y,e[34]=L,e[35]=k,e[36]=v):v=e[36],x=Pt,_="start",D="w-64 p-0",T=xl,w="flex flex-col";let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx(at,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[37]=$):$=e[37];let W;e[38]===Symbol.for("react.memo_cache_sentinel")?(W=B=>m(B.target.value),e[38]=W):W=e[38];let U;e[39]!==o?(U=o("common.simpleIconPicker.filterPlaceholder"),e[39]=o,e[40]=U):U=e[40],e[41]!==c||e[42]!==U?(N=t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"relative",children:[$,t.jsx(Me,{value:c,onChange:W,placeholder:U,className:"h-7 text-xs pl-7"})]})}),e[41]=c,e[42]=U,e[43]=N):N=e[43],p=Fs,M="h-48",S="grid grid-cols-8 gap-0.5 px-2 pb-2";let R;e[44]!==d||e[45]!==s?(R=B=>{const J=Dt(B);return J?t.jsx("button",{type:"button",onClick:()=>{s(`icon://${B}`),h(!1)},className:fe("h-7 w-7 flex items-center justify-center rounded-lg transition-colors cursor-pointer",d===B?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:wt(B),"aria-label":wt(B),children:t.jsx(J,{size:16})},B):null},e[44]=d,e[45]=s,e[46]=R):R=e[46],C=b.map(R),e[2]=i,e[3]=d,e[4]=l,e[5]=s,e[6]=r,e[7]=c,e[8]=o,e[9]=n,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=y,e[15]=j,e[16]=v,e[17]=S,e[18]=C,e[19]=M,e[20]=w,e[21]=N,e[22]=_,e[23]=D,e[24]=T}else p=e[10],x=e[11],g=e[12],b=e[13],y=e[14],j=e[15],v=e[16],S=e[17],C=e[18],M=e[19],w=e[20],N=e[21],_=e[22],D=e[23],T=e[24];let A;e[47]!==S||e[48]!==C?(A=t.jsx("div",{className:S,children:C}),e[47]=S,e[48]=C,e[49]=A):A=e[49];let V;e[50]!==b.length||e[51]!==o?(V=b.length===0&&t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:o("common.simpleIconPicker.noIconsFound")}),e[50]=b.length,e[51]=o,e[52]=V):V=e[52];let F;e[53]!==p||e[54]!==A||e[55]!==V||e[56]!==M?(F=t.jsxs(p,{className:M,children:[A,V]}),e[53]=p,e[54]=A,e[55]=V,e[56]=M,e[57]=F):F=e[57];let I;e[58]!==F||e[59]!==w||e[60]!==N?(I=t.jsxs("div",{className:w,children:[N,F]}),e[58]=F,e[59]=w,e[60]=N,e[61]=I):I=e[61];let O;e[62]!==x||e[63]!==I||e[64]!==_||e[65]!==D||e[66]!==T?(O=t.jsx(x,{align:_,className:D,onOpenAutoFocus:T,children:I}),e[62]=x,e[63]=I,e[64]=_,e[65]=D,e[66]=T,e[67]=O):O=e[67];let z;return e[68]!==g||e[69]!==y||e[70]!==j||e[71]!==v||e[72]!==O?(z=t.jsxs(g,{open:y,onOpenChange:j,children:[v,O]}),e[68]=g,e[69]=y,e[70]=j,e[71]=v,e[72]=O,e[73]=z):z=e[73],z}function xl(a){return a.preventDefault()}function gl(a){const e=H.c(10),{viewId:n}=a;if(n==="overview"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Vs,{size:16}),e[0]=i):i=e[0],i}if(n==="reports"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ht,{size:16}),e[1]=i):i=e[1],i}if(n==="board"){let i;return e[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ti,{size:16}),e[2]=i):i=e[2],i}if(n==="site-editor"){let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ci,{size:16}),e[3]=i):i=e[3],i}if(n==="assets"){let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ni,{size:16}),e[4]=i):i=e[4],i}if(n==="hosting"){let i;return e[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(tn,{size:16}),e[5]=i):i=e[5],i}if(n==="e2e"){let i;return e[6]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(si,{size:16}),e[6]=i):i=e[6],i}if(n==="analytics"){let i;return e[7]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Ht,{size:16}),e[7]=i):i=e[7],i}if(n==="cdn"){let i;return e[8]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(ni,{size:16}),e[8]=i):i=e[8],i}let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(As,{size:16}),e[9]=s):s=e[9],s}function ms(a){const e=H.c(51),{pinned:n,canSetMainView:s,onOpen:i,onTogglePin:l,onSetMainView:o}=a,r=X(),h=n?"text-foreground":"text-muted-foreground/40";let c;e[0]!==h?(c=fe("size-7",h),e[0]=h,e[1]=c):c=e[1];let m;e[2]!==n||e[3]!==r?(m=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[2]=n,e[3]=r,e[4]=m):m=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(qt,{size:16}),e[5]=f):f=e[5];let u;e[6]!==l||e[7]!==n||e[8]!==c||e[9]!==m?(u=t.jsx(ye,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:c,"aria-label":m,"aria-pressed":n,onClick:l,children:f})}),e[6]=l,e[7]=n,e[8]=c,e[9]=m,e[10]=u):u=e[10];let d;e[11]!==n||e[12]!==r?(d=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[11]=n,e[12]=r,e[13]=d):d=e[13];let p;e[14]!==d?(p=t.jsx(we,{side:"top",children:d}),e[14]=d,e[15]=p):p=e[15];let x;e[16]!==u||e[17]!==p?(x=t.jsxs(je,{delayDuration:0,children:[u,p]}),e[16]=u,e[17]=p,e[18]=x):x=e[18];let g;e[19]!==r?(g=r("virtualMcp.settings.views.rowActions"),e[19]=r,e[20]=g):g=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Si,{size:16}),e[21]=b):b=e[21];let y;e[22]!==g?(y=t.jsx(vs,{asChild:!0,children:t.jsx(se,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground","aria-label":g,children:b})}),e[22]=g,e[23]=y):y=e[23];let j;e[24]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:14}),e[24]=j):j=e[24];let v;e[25]!==r?(v=r("virtualMcp.settings.views.open"),e[25]=r,e[26]=v):v=e[26];let S;e[27]!==i||e[28]!==v?(S=t.jsxs(Ke,{onClick:i,children:[j,v]}),e[27]=i,e[28]=v,e[29]=S):S=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(qt,{size:14}),e[30]=C):C=e[30];let M;e[31]!==n||e[32]!==r?(M=r(n?"virtualMcp.settings.views.unpin":"virtualMcp.settings.views.pin"),e[31]=n,e[32]=r,e[33]=M):M=e[33];let w;e[34]!==l||e[35]!==M?(w=t.jsxs(Ke,{onClick:l,children:[C,M]}),e[34]=l,e[35]=M,e[36]=w):w=e[36];let N;e[37]!==s||e[38]!==o||e[39]!==r?(N=s&&t.jsxs(Ke,{onClick:o,children:[t.jsx(Vs,{size:14}),r("virtualMcp.settings.views.setMainView")]}),e[37]=s,e[38]=o,e[39]=r,e[40]=N):N=e[40];let _;e[41]!==S||e[42]!==w||e[43]!==N?(_=t.jsxs(bs,{align:"end",children:[S,w,N]}),e[41]=S,e[42]=w,e[43]=N,e[44]=_):_=e[44];let D;e[45]!==y||e[46]!==_?(D=t.jsxs(gs,{children:[y,_]}),e[45]=y,e[46]=_,e[47]=D):D=e[47];let T;return e[48]!==D||e[49]!==x?(T=t.jsxs("div",{className:"flex items-center gap-1",children:[x,D]}),e[48]=D,e[49]=x,e[50]=T):T=e[50],T}const fs=a=>a.stopPropagation();function vl(a){const e=H.c(8),{icon:n,title:s}=a;let i;e[0]!==n||e[1]!==s?(i=t.jsx(Ge,{icon:n,name:s,size:"xs",className:"shrink-0"}),e[0]=n,e[1]=s,e[2]=i):i=e[2];let l;e[3]!==s?(l=t.jsx("span",{className:"text-xs text-muted-foreground",children:s}),e[3]=s,e[4]=l):l=e[4];let o;return e[5]!==i||e[6]!==l?(o=t.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 bg-muted/30",children:[i,l]}),e[5]=i,e[6]=l,e[7]=o):o=e[7],o}function bl(a){const e=H.c(70),{views:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.settings.views.defaults"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==s?(l=s("virtualMcp.layoutTabContent.mainView"),e[2]=s,e[3]=l):l=e[3];let o;e[4]!==s?(o=s("virtualMcp.layoutTabContent.mainViewDescription"),e[4]=s,e[5]=o):o=e[5];const r=n.defaultMainView,h=n.setMainView;let c;e[6]!==s?(c=s("virtualMcp.layoutTabContent.mainView"),e[6]=s,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("virtualMcp.layoutTabContent.noMainView"),e[8]=s,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx(Te,{placeholder:m}),e[10]=m,e[11]=f):f=e[11];let u;e[12]!==c||e[13]!==f?(u=t.jsx(ke,{"aria-label":c,className:"w-36 h-8 text-sm shrink-0 @min-xl/project-settings:w-44",children:f}),e[12]=c,e[13]=f,e[14]=u):u=e[14];let d;e[15]!==n.defaultMainOptions?(d=n.defaultMainOptions.map(jl),e[15]=n.defaultMainOptions,e[16]=d):d=e[16];let p;e[17]!==d?(p=t.jsx(De,{children:d}),e[17]=d,e[18]=p):p=e[18];let x;e[19]!==p||e[20]!==u||e[21]!==n.defaultMainView||e[22]!==n.setMainView?(x=t.jsxs(Ve,{value:r,onValueChange:h,children:[u,p]}),e[19]=p,e[20]=u,e[21]=n.defaultMainView,e[22]=n.setMainView,e[23]=x):x=e[23];let g;e[24]!==x||e[25]!==l||e[26]!==o?(g=t.jsx(He,{title:l,description:o,action:x}),e[24]=x,e[25]=l,e[26]=o,e[27]=g):g=e[27];let b;e[28]!==s?(b=s("virtualMcp.layoutTabContent.showChat"),e[28]=s,e[29]=b):b=e[29];let y;e[30]!==s?(y=s("virtualMcp.layoutTabContent.showChatDescription"),e[30]=s,e[31]=y):y=e[31];let j;e[32]!==s?(j=s("virtualMcp.layoutTabContent.showChat"),e[32]=s,e[33]=j):j=e[33];const v=n.noMainView?!0:n.chatDefaultOpen;let S;e[34]!==j||e[35]!==v||e[36]!==n.noMainView||e[37]!==n.setChatDefaultOpen?(S=t.jsx(ye,{asChild:!0,children:t.jsx("span",{className:"shrink-0",children:t.jsx(ft,{"aria-label":j,checked:v,disabled:n.noMainView,onCheckedChange:n.setChatDefaultOpen})})}),e[34]=j,e[35]=v,e[36]=n.noMainView,e[37]=n.setChatDefaultOpen,e[38]=S):S=e[38];let C;e[39]!==s||e[40]!==n.noMainView?(C=n.noMainView&&t.jsx(we,{side:"top",children:s("virtualMcp.layoutTabContent.chatAlwaysShown")}),e[39]=s,e[40]=n.noMainView,e[41]=C):C=e[41];let M;e[42]!==S||e[43]!==C?(M=t.jsxs(je,{delayDuration:0,children:[S,C]}),e[42]=S,e[43]=C,e[44]=M):M=e[44];let w;e[45]!==b||e[46]!==y||e[47]!==M?(w=t.jsx(He,{title:b,description:y,action:M}),e[45]=b,e[46]=y,e[47]=M,e[48]=w):w=e[48];let N;e[49]!==g||e[50]!==w?(N=t.jsxs(Le,{children:[g,w]}),e[49]=g,e[50]=w,e[51]=N):N=e[51];let _;e[52]!==i||e[53]!==N?(_=t.jsx(Be,{title:i,children:N}),e[52]=i,e[53]=N,e[54]=_):_=e[54];let D;e[55]!==s?(D=s("virtualMcp.settings.views.sidebar"),e[55]=s,e[56]=D):D=e[56];let T;e[57]!==n?(T=n.projectViews.map(O=>{const z=n.pinned(O);return t.jsx(He,{icon:t.jsx(gl,{viewId:O}),title:n.labels[O],onClick:()=>n.openView(O),action:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ms,{pinned:z,canSetMainView:z&&!n.isMainView(O),onOpen:()=>n.openView(O),onTogglePin:()=>n.togglePin(O,!z),onSetMainView:()=>n.setMainView(O)}),t.jsx("span",{onClick:()=>n.openView(O),className:"flex cursor-pointer items-center text-muted-foreground",children:t.jsx(Kt,{size:16})})]})},O)}),e[57]=n,e[58]=T):T=e[58];let A;e[59]!==n?(A=n.connectionsData.flatMap(O=>[t.jsx(vl,{icon:O.icon,title:O.title},`${O.id}:header`),...O.uiTools.map(z=>{const q=n.pinnedAppViews.find(k=>k.connectionId===O.id&&k.toolName===z.name),Y=!!q,K=nn(O.id,z.name),L=`ext-apps:${O.id}:${z.name}`;return t.jsx(He,{onClick:()=>n.openView(K),icon:Y?t.jsx("span",{onClick:fs,children:t.jsx(hl,{value:q.icon??null,onChange:k=>n.setAppViewIcon(O.id,z.name,k)})}):t.jsx(As,{size:16}),title:Y?t.jsx("span",{onClick:fs,children:t.jsx(Me,{value:q.label,onChange:k=>n.setAppViewLabel(O.id,z.name,k.target.value),onBlur:n.commitAppViewLabel,"aria-label":z.title??St(z.name),className:"h-7 w-full max-w-52 text-sm"})}):z.title??St(z.name),action:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(ms,{pinned:Y,canSetMainView:Y&&!n.isMainView(L),onOpen:()=>n.openView(K),onTogglePin:()=>n.toggleAppViewPin(O.id,z.name),onSetMainView:()=>n.setMainView(L)}),t.jsx("span",{onClick:()=>n.openView(K),className:"flex cursor-pointer items-center text-muted-foreground",children:t.jsx(Kt,{size:16})})]})},`${O.id}:${z.name}`)})]),e[59]=n,e[60]=A):A=e[60];let V;e[61]!==T||e[62]!==A?(V=t.jsxs(Le,{children:[T,A]}),e[61]=T,e[62]=A,e[63]=V):V=e[63];let F;e[64]!==D||e[65]!==V?(F=t.jsx(Be,{title:D,children:V}),e[64]=D,e[65]=V,e[66]=F):F=e[66];let I;return e[67]!==_||e[68]!==F?(I=t.jsxs(t.Fragment,{children:[_,F]}),e[67]=_,e[68]=F,e[69]=I):I=e[69],I}function jl(a){return t.jsx(xe,{value:a.value,children:a.label},a.value)}const qs="site-editor",yl=new Set([qs,"content"]);function wl({virtualMcpId:a,form:e,flushAndSave:n}){const s=X(),i=ot(),{openPanel:l}=Ti(),o=Ms(a),r=Di(o),h=zs(a),c=Ei(a),m=(o?.connections??[]).map(k=>k.connection_id).sort(),{data:f}=an({queryKey:ws.projectConnectionDetails(a,m),enabled:m.length>0,queryFn:async()=>await Promise.all(m.map(async $=>{try{const{item:W}=await i.call("COLLECTION_CONNECTIONS_GET",{id:$}),U=(W?.tools??[]).flatMap(R=>{const B=Mi(R._meta);return B?[{name:R.name,title:R.title,description:R.description,resourceUri:B}]:[]});return{fetchOk:!0,id:$,title:W?.title??$,icon:W?.icon??null,uiTools:U}}catch{return{fetchOk:!1,id:$,title:$,icon:null,uiTools:[]}}}))}),u=(f??[]).filter(k=>k.uiTools.length>0),d=new Set([...ln,...rn]),p=e.watch("metadata.ui.pinnedViews")??[],x=e.watch("metadata.ui.layout")??null,g=x?.defaultMainView??null,b=x?.chatDefaultOpen??!1,y=Nt(Ct({sidebarViews:e.watch("metadata.sidebarViews"),ui:{layout:x}}),e.watch("metadata.sidebarViewsVersion")),j=c??(o?Nt(Ct(o.metadata),o.metadata.sidebarViewsVersion):y),v=(()=>{if(!g||g.type==="chat")return"";const k=on(g.type);return k==="instructions"||k==="connections"||k==="layout"?"settings":yl.has(k)?qs:d.has(k)?k:`${k}:${g.id??""}:${g.toolName??""}`})(),S=v==="",C=k=>{const[$,W,U]=k.split(":");return $?d.has($)?{type:$}:$==="ext-apps"&&W?{type:"ext-apps",id:W,toolName:U||void 0}:null:null},M=k=>{e.setValue("metadata.ui.pinnedViews",k,{shouldDirty:!0})},w=k=>{e.setValue("metadata.ui.layout",{...x,...k},{shouldDirty:!0})},N=G.useRef(!1);if(f&&f.length>0&&!N.current){N.current=!0;const k=new Set((f??[]).filter(R=>R.fetchOk).map(R=>R.id)),$=new Set(u.flatMap(R=>R.uiTools.map(B=>`${R.id}:${B.name}`))),W=new Set(m),U=p.filter(R=>W.has(R.connectionId)&&(!k.has(R.connectionId)||$.has(`${R.connectionId}:${R.toolName}`)));U.length!==p.length&&(M(U),g?.type==="ext-apps"&&!U.some(R=>R.connectionId===g.id&&R.toolName===g.toolName)&&w({defaultMainView:{type:"settings"}}))}const _=(k,$)=>{if(p.some(U=>U.connectionId===k&&U.toolName===$)){const U=p.filter(B=>!(B.connectionId===k&&B.toolName===$));M(U);const R=`ext-apps:${k}:${$}`;v===R&&w({defaultMainView:{type:"settings"}})}else{const U=u.find(R=>R.id===k)?.uiTools.find(R=>R.name===$)?.title;M([...p,{connectionId:k,toolName:$,label:U??St($),icon:null}])}n()},D=(k,$,W)=>{M(p.map(U=>U.connectionId===k&&U.toolName===$?{...U,label:W}:U))},T=()=>{n()},A=(k,$,W)=>{M(p.map(U=>U.connectionId===k&&U.toolName===$?{...U,icon:W}:U)),n()},V=k=>{w({defaultMainView:C(k)}),n()},F=(k,$)=>{const W=Oi(j,k,$,1);e.setValue("metadata.sidebarViews",W,{shouldDirty:!0}),e.setValue("metadata.sidebarViewsVersion",1,{shouldDirty:!0}),h.stage(W,j);const U=Pi(g,k,$);U!==g&&w({defaultMainView:U})},I=lt(o?.metadata),O=Vi(I,r.presence),z=Ai(O),q=Ii(j,O,1),Y={overview:s("sidebar.navDestinations.home"),reports:s("sidebar.navDestinations.reports"),board:s("sidebar.navDestinations.tasks"),"site-editor":s("virtualMcp.layoutTabContent.siteEditor"),assets:s("common.mainPanelTabs.assets"),hosting:s("common.mainPanelTabs.hosting"),e2e:s("common.mainPanelTabs.e2e"),analytics:s("common.mainPanelTabs.analytics"),cdn:s("common.mainPanelTabs.cdn"),automations:s("virtualMcp.layoutTabContent.automations"),experiments:s("experiments.title")},K=[];for(const k of q)k!=="automations"&&K.push({value:k,label:Y[k]});for(const k of p)K.push({value:`ext-apps:${k.connectionId}:${k.toolName}`,label:k.label||k.toolName});return q.includes("automations")&&K.push({value:"automations",label:Y.automations}),K.push({value:"settings",label:s("virtualMcp.layoutTabContent.settings")}),{projectViews:z,labels:Y,pinned:k=>j.includes(k),isMainView:k=>v===k,defaultMainView:v,defaultMainOptions:K,noMainView:S,chatDefaultOpen:b,connectionsData:u,pinnedAppViews:p,openView:k=>l(k,{virtualmcpid:a}),togglePin:(k,$)=>F(k,$),setMainView:V,setChatDefaultOpen:k=>{w({chatDefaultOpen:k}),n()},toggleAppViewPin:_,setAppViewIcon:A,setAppViewLabel:D,commitAppViewLabel:T}}function Sl(a){const e=H.c(82),{value:n,onChange:s,onColorChange:i,name:l,size:o,className:r,avatarClassName:h,showHoverOverlay:c,disabled:m}=a,f=o===void 0?"lg":o,u=c===void 0?!0:c,d=m===void 0?!1:m,p=X(),[x,g]=G.useState(!1),[b,y]=G.useState("icons"),[j,v]=G.useState(""),[S,C]=G.useState("blue");let M;e[0]!==n?(M=kt(n),e[0]=n,e[1]=M):M=e[1];const w=M,N=w.type==="icon"||w.type==="url"&&w.color?w.color:S;let _;e[2]!==s||e[3]!==N?(_=oe=>{s(gt(oe,N))},e[2]=s,e[3]=N,e[4]=_):_=e[4];const D=_;let T;e[5]!==s||e[6]!==i||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(T=oe=>{C(oe),i?.(oe),w.type==="icon"?s(gt(w.name,oe)):w.type==="url"&&s(Qt(w.url,oe))},e[5]=s,e[6]=i,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=T):T=e[10];const A=T;let V;e[11]!==s||e[12]!==N?(V=oe=>{s(Qt(oe,N)),g(!1)},e[11]=s,e[12]=N,e[13]=V):V=e[13];const F=V;let I;e[14]!==s||e[15]!==N?(I=()=>{const oe=Tt(),Ne=oe[Math.floor(Math.random()*oe.length)];s(gt(Ne,N))},e[14]=s,e[15]=N,e[16]=I):I=e[16];const O=I,z=d?!1:x,q=d?"cursor-default opacity-50":"cursor-pointer";let Y;e[17]!==r||e[18]!==f||e[19]!==q?(Y=fe("relative group overflow-hidden",q,ii(f),r),e[17]=r,e[18]=f,e[19]=q,e[20]=Y):Y=e[20];let K;e[21]!==h||e[22]!==l||e[23]!==f||e[24]!==n?(K=t.jsx(Xt,{icon:n,name:l,size:f,className:h}),e[21]=h,e[22]=l,e[23]=f,e[24]=n,e[25]=K):K=e[25];let L;e[26]!==d||e[27]!==u?(L=u&&!d&&t.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(ai,{size:16,className:"text-white"})}),e[26]=d,e[27]=u,e[28]=L):L=e[28];let k;e[29]!==d||e[30]!==Y||e[31]!==K||e[32]!==L?(k=t.jsx(Ot,{asChild:!0,children:t.jsxs("button",{type:"button","data-testid":"icon-picker-trigger","aria-label":"Change icon",disabled:d,className:Y,children:[K,L]})}),e[29]=d,e[30]=Y,e[31]=K,e[32]=L,e[33]=k):k=e[33];let $;e[34]!==l||e[35]!==n?($=t.jsx("div",{className:"flex items-center justify-center py-4",children:t.jsx(Xt,{icon:n,name:l,size:"xl"})}),e[34]=l,e[35]=n,e[36]=$):$=e[36];let W;e[37]!==b?(W=oe=>{if(oe.key!=="ArrowLeft"&&oe.key!=="ArrowRight")return;oe.preventDefault();const Ne=b==="icons"?"upload":"icons";y(Ne),document.getElementById(`icon-picker-tab-${Ne}`)?.focus()},e[37]=b,e[38]=W):W=e[38];const U=b==="icons",R=b==="icons"?0:-1;let B;e[39]===Symbol.for("react.memo_cache_sentinel")?(B=()=>y("icons"),e[39]=B):B=e[39];const J=b==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ie;e[40]!==J?(ie=fe("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",J),e[40]=J,e[41]=ie):ie=e[41];let ee;e[42]!==p?(ee=p("common.iconPicker.iconsTab"),e[42]=p,e[43]=ee):ee=e[43];let ce;e[44]!==U||e[45]!==R||e[46]!==ie||e[47]!==ee?(ce=t.jsx("button",{id:"icon-picker-tab-icons",type:"button",role:"tab","aria-selected":U,"aria-controls":"icon-picker-panel-icons",tabIndex:R,onClick:B,className:ie,children:ee}),e[44]=U,e[45]=R,e[46]=ie,e[47]=ee,e[48]=ce):ce=e[48];const de=b==="upload",ue=b==="upload"?0:-1;let te;e[49]===Symbol.for("react.memo_cache_sentinel")?(te=()=>y("upload"),e[49]=te):te=e[49];const pe=b==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let me;e[50]!==pe?(me=fe("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",pe),e[50]=pe,e[51]=me):me=e[51];let Se;e[52]!==p?(Se=p("common.iconPicker.uploadTab"),e[52]=p,e[53]=Se):Se=e[53];let E;e[54]!==de||e[55]!==ue||e[56]!==me||e[57]!==Se?(E=t.jsx("button",{id:"icon-picker-tab-upload",type:"button",role:"tab","aria-selected":de,"aria-controls":"icon-picker-panel-upload",tabIndex:ue,onClick:te,className:me,children:Se}),e[54]=de,e[55]=ue,e[56]=me,e[57]=Se,e[58]=E):E=e[58];let ne;e[59]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsx("div",{className:"flex-1"}),e[59]=ne):ne=e[59];let Q;e[60]!==W||e[61]!==ce||e[62]!==E?(Q=t.jsxs("div",{role:"tablist","aria-label":"Icon source",className:"flex items-center border-b border-border px-3",onKeyDown:W,children:[ce,E,ne]}),e[60]=W,e[61]=ce,e[62]=E,e[63]=Q):Q=e[63];let ae;e[64]!==A||e[65]!==O||e[66]!==D||e[67]!==F||e[68]!==w.name||e[69]!==w.type||e[70]!==j||e[71]!==N||e[72]!==b?(ae=b==="icons"?t.jsx("div",{id:"icon-picker-panel-icons",role:"tabpanel","aria-labelledby":"icon-picker-tab-icons",children:t.jsx(_l,{search:j,onSearchChange:v,selectedColor:N,onColorChange:A,onSelectIcon:D,onRandom:O,currentIconName:w.type==="icon"?w.name:null})}):t.jsx("div",{id:"icon-picker-panel-upload",role:"tabpanel","aria-labelledby":"icon-picker-tab-upload",children:t.jsx(kl,{onUpload:F})}),e[64]=A,e[65]=O,e[66]=D,e[67]=F,e[68]=w.name,e[69]=w.type,e[70]=j,e[71]=N,e[72]=b,e[73]=ae):ae=e[73];let P;e[74]!==$||e[75]!==Q||e[76]!==ae?(P=t.jsx(Pt,{align:"start",className:"w-80 p-0",onOpenAutoFocus:Nl,children:t.jsxs("div",{className:"flex flex-col",children:[$,Q,ae]})}),e[74]=$,e[75]=Q,e[76]=ae,e[77]=P):P=e[77];let Z;return e[78]!==k||e[79]!==P||e[80]!==z?(Z=t.jsxs(It,{open:z,onOpenChange:g,children:[k,P]}),e[78]=k,e[79]=P,e[80]=z,e[81]=Z):Z=e[81],Z}function Nl(a){return a.preventDefault()}function Cl(a){const e=H.c(33),{selectedColor:n,onColorChange:s}=a,i=X(),[l,o]=G.useState(!1);let r,h,c,m,f,u,d;if(e[0]!==l||e[1]!==n){const S=Is(n);h=It,u=l,d=o,r=Ot,f=!0,c="button",m=fe("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",S.dot,"ring-foreground/20"),e[0]=l,e[1]=n,e[2]=r,e[3]=h,e[4]=c,e[5]=m,e[6]=f,e[7]=u,e[8]=d}else r=e[2],h=e[3],c=e[4],m=e[5],f=e[6],u=e[7],d=e[8];let p;e[9]!==i?(p=i("common.iconPicker.changeColor"),e[9]=i,e[10]=p):p=e[10];let x;e[11]!==i?(x=i("common.iconPicker.changeColor"),e[11]=i,e[12]=x):x=e[12];let g;e[13]!==c||e[14]!==m||e[15]!==p||e[16]!==x?(g=t.jsx("button",{type:c,className:m,title:p,"aria-label":x}),e[13]=c,e[14]=m,e[15]=p,e[16]=x,e[17]=g):g=e[17];let b;e[18]!==r||e[19]!==f||e[20]!==g?(b=t.jsx(r,{asChild:f,children:g}),e[18]=r,e[19]=f,e[20]=g,e[21]=b):b=e[21];let y;e[22]!==s||e[23]!==n?(y=ri.map(S=>t.jsx("button",{type:"button",onClick:()=>{s(S.name),o(!1)},className:fe("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",S.dot,n===S.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:S.name,"aria-label":S.name},S.name)),e[22]=s,e[23]=n,e[24]=y):y=e[24];let j;e[25]!==y?(j=t.jsx(Pt,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:Ml,children:t.jsx("div",{className:"grid grid-cols-4 gap-1",children:y})}),e[25]=y,e[26]=j):j=e[26];let v;return e[27]!==h||e[28]!==j||e[29]!==u||e[30]!==d||e[31]!==b?(v=t.jsxs(h,{open:u,onOpenChange:d,children:[b,j]}),e[27]=h,e[28]=j,e[29]=u,e[30]=d,e[31]=b,e[32]=v):v=e[32],v}function Ml(a){return a.preventDefault()}function _l(a){const e=H.c(55),{search:n,onSearchChange:s,selectedColor:i,onColorChange:l,onSelectIcon:o,onRandom:r,currentIconName:h}=a,c=X();let m,f,u,d,p,x,g;if(e[0]!==h||e[1]!==l||e[2]!==r||e[3]!==s||e[4]!==o||e[5]!==n||e[6]!==i||e[7]!==c){const S=Tt(),C=Is(i);f=Ds(S,n),x="flex flex-col";let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx(at,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[15]=M):M=e[15];let w;e[16]!==s?(w=I=>s(I.target.value),e[16]=s,e[17]=w):w=e[17];let N;e[18]!==c?(N=c("common.iconPicker.filterPlaceholder"),e[18]=c,e[19]=N):N=e[19];let _;e[20]!==n||e[21]!==w||e[22]!==N?(_=t.jsxs("div",{className:"relative flex-1",children:[M,t.jsx(Me,{value:n,onChange:w,placeholder:N,className:"h-8 text-xs pl-7"})]}),e[20]=n,e[21]=w,e[22]=N,e[23]=_):_=e[23];let D;e[24]!==c?(D=c("common.iconPicker.randomIcon"),e[24]=c,e[25]=D):D=e[25];let T;e[26]!==c?(T=c("common.iconPicker.randomIcon"),e[26]=c,e[27]=T):T=e[27];let A;e[28]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(li,{size:14,className:"text-muted-foreground"}),e[28]=A):A=e[28];let V;e[29]!==r||e[30]!==D||e[31]!==T?(V=t.jsx("button",{type:"button",onClick:r,className:"h-8 w-8 flex items-center justify-center rounded-lg border border-border hover:bg-accent transition-colors shrink-0",title:D,"aria-label":T,children:A}),e[29]=r,e[30]=D,e[31]=T,e[32]=V):V=e[32];let F;e[33]!==l||e[34]!==i?(F=t.jsx(Cl,{selectedColor:i,onColorChange:l}),e[33]=l,e[34]=i,e[35]=F):F=e[35],e[36]!==V||e[37]!==F||e[38]!==_?(g=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[_,V,F]}),e[36]=V,e[37]=F,e[38]=_,e[39]=g):g=e[39],m=Fs,p="h-56",u="grid grid-cols-9 gap-0.5 px-2 pb-2",d=f.map(I=>{const O=Dt(I);return O?t.jsx("button",{type:"button",onClick:()=>o(I),className:fe("h-8 w-8 flex items-center justify-center rounded-lg transition-colors cursor-pointer",h===I?fe(C.bg,C.text):fe(C.text,"hover:bg-accent")),title:I,"aria-label":wt(I),children:t.jsx(O,{size:18})},I):null}),e[0]=h,e[1]=l,e[2]=r,e[3]=s,e[4]=o,e[5]=n,e[6]=i,e[7]=c,e[8]=m,e[9]=f,e[10]=u,e[11]=d,e[12]=p,e[13]=x,e[14]=g}else m=e[8],f=e[9],u=e[10],d=e[11],p=e[12],x=e[13],g=e[14];let b;e[40]!==u||e[41]!==d?(b=t.jsx("div",{className:u,children:d}),e[40]=u,e[41]=d,e[42]=b):b=e[42];let y;e[43]!==f.length||e[44]!==c?(y=f.length===0&&t.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:c("common.iconPicker.noIconsFound")}),e[43]=f.length,e[44]=c,e[45]=y):y=e[45];let j;e[46]!==m||e[47]!==p||e[48]!==b||e[49]!==y?(j=t.jsxs(m,{className:p,children:[b,y]}),e[46]=m,e[47]=p,e[48]=b,e[49]=y,e[50]=j):j=e[50];let v;return e[51]!==x||e[52]!==g||e[53]!==j?(v=t.jsxs("div",{className:x,children:[g,j]}),e[51]=x,e[52]=g,e[53]=j,e[54]=v):v=e[54],v}function kl(a){const e=H.c(46),{onUpload:n}=a,s=X(),i=G.useRef(null);let l;e[0]!==n||e[1]!==s?(l=V=>{const F=V.target.files?.[0];if(!F)return;if(F.size>2097152){re.error(s("common.iconPicker.imageTooLarge")),V.target.value="";return}const I=new FileReader;I.onerror=()=>{re.error(s("common.iconPicker.failedToReadImage")),i.current&&(i.current.value="")},I.onloadend=()=>{I.readyState===FileReader.DONE&&I.result&&n(I.result),i.current&&(i.current.value="")},I.readAsDataURL(F)},e[0]=n,e[1]=s,e[2]=l):l=e[2];const o=l,[r,h]=G.useState("");let c;e[3]!==n||e[4]!==r?(c=()=>{const V=r.trim();V&&(n(V),h(""))},e[3]=n,e[4]=r,e[5]=c):c=e[5];const m=c;let f;e[6]!==o?(f=t.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:o}),e[6]=o,e[7]=f):f=e[7];let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=()=>i.current?.click(),e[8]=u):u=e[8];let d;e[9]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Ui,{size:20}),e[9]=d):d=e[9];let p;e[10]!==s?(p=s("common.iconPicker.uploadHint"),e[10]=s,e[11]=p):p=e[11];let x;e[12]!==p?(x=t.jsxs("button",{type:"button",onClick:u,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[d,t.jsx("span",{className:"text-xs",children:p})]}),e[12]=p,e[13]=x):x=e[13];let g;e[14]!==s?(g=s("common.iconPicker.or"),e[14]=s,e[15]=g):g=e[15];let b;e[16]!==g?(b=t.jsx("span",{className:"text-xs text-muted-foreground",children:g}),e[16]=g,e[17]=b):b=e[17];let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx("div",{className:"flex-1 h-px bg-border"}),e[18]=y):y=e[18];let j;e[19]!==b?(j=t.jsxs("div",{className:"flex items-center gap-2",children:[b,y]}),e[19]=b,e[20]=j):j=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=V=>h(V.target.value),e[21]=v):v=e[21];let S;e[22]!==s?(S=s("common.iconPicker.pasteUrlPlaceholder"),e[22]=s,e[23]=S):S=e[23];let C;e[24]!==m?(C=V=>{V.key==="Enter"&&(V.preventDefault(),m())},e[24]=m,e[25]=C):C=e[25];let M;e[26]!==r||e[27]!==S||e[28]!==C?(M=t.jsx(Me,{value:r,onChange:v,placeholder:S,className:"h-8 text-xs flex-1",onKeyDown:C}),e[26]=r,e[27]=S,e[28]=C,e[29]=M):M=e[29];let w;e[30]!==r?(w=r.trim(),e[30]=r,e[31]=w):w=e[31];const N=!w;let _;e[32]!==s?(_=s("common.iconPicker.apply"),e[32]=s,e[33]=_):_=e[33];let D;e[34]!==m||e[35]!==N||e[36]!==_?(D=t.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:m,disabled:N,children:_}),e[34]=m,e[35]=N,e[36]=_,e[37]=D):D=e[37];let T;e[38]!==M||e[39]!==D?(T=t.jsxs("div",{className:"flex items-center gap-1.5",children:[M,D]}),e[38]=M,e[39]=D,e[40]=T):T=e[40];let A;return e[41]!==j||e[42]!==T||e[43]!==f||e[44]!==x?(A=t.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[f,x,j,T]}),e[41]=j,e[42]=T,e[43]=f,e[44]=x,e[45]=A):A=e[45],A}function Tl(a){const e=H.c(55),{form:n,onCommit:s}=a,i=X(),l=G.useId();let o;e[0]!==i?(o=i("virtualMcp.settings.identity.icon"),e[0]=i,e[1]=o):o=e[1];let r;e[2]!==o?(r=t.jsx("p",{className:"text-sm font-medium",children:o}),e[2]=o,e[3]=r):r=e[3];let h;e[4]!==i?(h=i("virtualMcp.settings.identity.iconDescription"),e[4]=i,e[5]=h):h=e[5];let c;e[6]!==h?(c=t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:h}),e[6]=h,e[7]=c):c=e[7];let m;e[8]!==r||e[9]!==c?(m=t.jsxs("div",{children:[r,c]}),e[8]=r,e[9]=c,e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==s||e[13]!==i?(f=D=>{const{field:T}=D;return t.jsx("div",{className:"justify-self-start",children:t.jsx(Sl,{value:T.value??null,onChange:A=>{T.onChange(A),s()},onColorChange:A=>{n.setValue("metadata.ui.themeColor",A,{shouldDirty:!0}),s()},name:n.watch("title")||i("virtualMcp.virtualMcp.agentNameFallback"),size:"md",avatarClassName:"[&_svg]:w-1/2 [&_svg]:h-1/2"})})},e[11]=n,e[12]=s,e[13]=i,e[14]=f):f=e[14];let u;e[15]!==n.control||e[16]!==f?(u=t.jsx(he,{name:"icon",control:n.control,render:f}),e[15]=n.control,e[16]=f,e[17]=u):u=e[17];let d;e[18]!==m||e[19]!==u?(d=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[m,u]}),e[18]=m,e[19]=u,e[20]=d):d=e[20];const p=`${l}-name`;let x;e[21]!==i?(x=i("virtualMcp.settings.identity.name"),e[21]=i,e[22]=x):x=e[22];let g;e[23]!==x||e[24]!==p?(g=t.jsx("label",{htmlFor:p,className:"text-sm font-medium",children:x}),e[23]=x,e[24]=p,e[25]=g):g=e[25];let b;e[26]!==l||e[27]!==s||e[28]!==i?(b=D=>{const{field:T}=D;return t.jsx(Me,{...T,id:`${l}-name`,value:T.value??"",onBlur:()=>{T.onBlur(),s()},placeholder:i("virtualMcp.virtualMcp.agentNamePlaceholder")})},e[26]=l,e[27]=s,e[28]=i,e[29]=b):b=e[29];let y;e[30]!==n.control||e[31]!==b?(y=t.jsx(he,{name:"title",control:n.control,render:b}),e[30]=n.control,e[31]=b,e[32]=y):y=e[32];let j;e[33]!==g||e[34]!==y?(j=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[g,y]}),e[33]=g,e[34]=y,e[35]=j):j=e[35];const v=`${l}-description`;let S;e[36]!==i?(S=i("virtualMcp.settings.identity.description"),e[36]=i,e[37]=S):S=e[37];let C;e[38]!==v||e[39]!==S?(C=t.jsx("label",{htmlFor:v,className:"text-sm font-medium",children:S}),e[38]=v,e[39]=S,e[40]=C):C=e[40];let M;e[41]!==l||e[42]!==s||e[43]!==i?(M=D=>{const{field:T}=D;return t.jsx(it,{...T,id:`${l}-description`,value:T.value??"",onBlur:()=>{T.onBlur(),s()},placeholder:i("virtualMcp.virtualMcp.descriptionPlaceholder"),className:"min-h-24 resize-y"})},e[41]=l,e[42]=s,e[43]=i,e[44]=M):M=e[44];let w;e[45]!==n.control||e[46]!==M?(w=t.jsx(he,{name:"description",control:n.control,render:M}),e[45]=n.control,e[46]=M,e[47]=w):w=e[47];let N;e[48]!==C||e[49]!==w?(N=t.jsxs(Ce,{className:"grid gap-3 @min-xl/project-settings:grid-cols-[180px_minmax(0,1fr)] @min-xl/project-settings:gap-8",children:[C,w]}),e[48]=C,e[49]=w,e[50]=N):N=e[50];let _;return e[51]!==j||e[52]!==N||e[53]!==d?(_=t.jsxs(Le,{children:[d,j,N]}),e[51]=j,e[52]=N,e[53]=d,e[54]=_):_=e[54],_}const Qs=["general","connections","site"],Dl={general:{icon:ci,titleKey:"virtualMcp.settings.general.title",descriptionKey:"virtualMcp.settings.general.description"},connections:{icon:Yi,titleKey:"virtualMcp.settings.connections.title",descriptionKey:"virtualMcp.settings.connections.description"},site:{icon:oi,titleKey:"virtualMcp.settings.site.title",descriptionKey:"virtualMcp.settings.site.description"}};function Vl(a){return!!a&&Qs.includes(a)}function Al(a){const e=H.c(8),{section:n}=a,s=X();let i;e[0]!==s?(i=s("virtualMcp.settings.navigation"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==n||e[3]!==s?(l=Qs.map(r=>{const{titleKey:h}=Dl[r];return t.jsx(ze.Tab,{active:n===r,asChild:!0,children:t.jsx(ys,{to:".",activeOptions:{exact:!0,explicitUndefined:!0},search:c=>({...c,section:r==="general"?void 0:r}),children:s(h)})},r)}),e[2]=n,e[3]=s,e[4]=l):l=e[4];let o;if(e[5]!==i||e[6]!==l){const r=t.jsx(ze.Tabs,{"aria-label":i,children:l});o=t.jsx(cn.Toolbar.Left.Portal,{fallback:r,children:r}),e[5]=i,e[6]=l,e[7]=o}else o=e[7];return o}function Il(){const a=H.c(8),e=Mt();let n;a[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},a[0]=n):n=a[0];const{section:s}=dn(n);let i;a[1]!==s?(i=Vl(s)?s:"general",a[1]=s,a[2]=i):i=a[2];let l;a[3]!==e?(l=r=>e({to:".",search:h=>({...h,section:r??void 0})}),a[3]=e,a[4]=l):l=a[4];let o;return a[5]!==i||a[6]!==l?(o={section:i,openSection:l},a[5]=i,a[6]=l,a[7]=o):o=a[7],o}const jt={tools:null,resources:null,prompts:null},Ol=Bi.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Pl(a){const n=new TextEncoder().encode(a),s=Array.from(n,i=>String.fromCharCode(i)).join("");return btoa(s)}function Xs(a){return{"x-studio-client":a,"x-mesh-client":a}}function $l(a){const e=H.c(15),{url:n,agentId:s}=a,i=X(),[l,o]=G.useState(!1);let r;e[0]!==s||e[1]!==i||e[2]!==n?(r=async()=>{ge("agent_connect_action",{agent_id:s,action:"copy_url"}),await navigator.clipboard.writeText(n),o(!0),re.success(i("virtualMcp.virtualMcpShareModal.agentUrlCopied")),await tt(2e3),o(!1)},e[0]=s,e[1]=i,e[2]=n,e[3]=r):r=e[3];const h=r;let c;e[4]!==l?(c=l?t.jsx(et,{size:20,className:"text-success"}):t.jsx(ht,{size:20}),e[4]=l,e[5]=c):c=e[5];let m;e[6]!==l||e[7]!==i?(m=i(l?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.copyUrl"),e[6]=l,e[7]=i,e[8]=m):m=e[8];let f;e[9]!==m?(f=t.jsx("span",{className:"text-xs font-medium",children:m}),e[9]=m,e[10]=f):f=e[10];let u;return e[11]!==h||e[12]!==c||e[13]!==f?(u=t.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,f]}),e[11]=h,e[12]=c,e[13]=f,e[14]=u):u=e[14],u}function El(a){const e=H.c(13),{url:n,serverName:s,agentId:i}=a,l=X();let o;e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n?(o=()=>{ge("agent_connect_action",{agent_id:i,action:"install_cursor"});const u=Ls(s),d={type:"http",url:n,headers:Xs("Cursor")},p=Pl(JSON.stringify(d,null,2)),x=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(p)}`;window.open(x,"_blank"),re.success(l("virtualMcp.virtualMcpShareModal.openingCursor"))},e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=o):o=e[4];const r=o;let h;e[5]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),e[5]=h):h=e[5];let c;e[6]!==l?(c=l("virtualMcp.virtualMcpShareModal.installOnCursor"),e[6]=l,e[7]=c):c=e[7];let m;e[8]!==c?(m=t.jsx("span",{className:"text-xs font-medium",children:c}),e[8]=c,e[9]=m):m=e[9];let f;return e[10]!==r||e[11]!==m?(f=t.jsxs(se,{type:"button",variant:"outline",onClick:r,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,m]}),e[10]=r,e[11]=m,e[12]=f):f=e[12],f}function Fl(a){const e=H.c(16),{url:n,serverName:s,agentId:i}=a,l=X(),[o,r]=G.useState(!1);let h;e[0]!==i||e[1]!==s||e[2]!==l||e[3]!==n?(h=async()=>{ge("agent_connect_action",{agent_id:i,action:"install_claude_code"});const p=Ls(s),x={type:"http",url:n,headers:Xs("Claude Code")},g=JSON.stringify(x,null,2),b=`claude mcp add-json "${p}" '${g.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(b),r(!0),re.success(l("virtualMcp.virtualMcpShareModal.claudeCodeCommandCopied")),await tt(2e3),r(!1)},e[0]=i,e[1]=s,e[2]=l,e[3]=n,e[4]=h):h=e[4];const c=h;let m;e[5]!==o?(m=o?t.jsx(et,{size:20,className:"text-success"}):t.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[5]=o,e[6]=m):m=e[6];let f;e[7]!==o||e[8]!==l?(f=l(o?"virtualMcp.virtualMcpShareModal.copied":"virtualMcp.virtualMcpShareModal.installOnClaudeCode"),e[7]=o,e[8]=l,e[9]=f):f=e[9];let u;e[10]!==f?(u=t.jsx("span",{className:"text-xs font-medium",children:f}),e[10]=f,e[11]=u):u=e[11];let d;return e[12]!==c||e[13]!==m||e[14]!==u?(d=t.jsxs(se,{type:"button",variant:"outline",onClick:c,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[m,u]}),e[12]=c,e[13]=m,e[14]=u,e[15]=d):d=e[15],d}function zl({virtualMcp:a}){const e=X(),n=ot(),[s,i]=G.useState(null),[l,o]=G.useState(!1),[r,h]=G.useState(!1),c=a.id,m=a.title||`agent-${c.slice(0,8)}`,f=s?`bunx @decocms/typegen@latest --mcp ${c} --key ${s} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,u=async()=>{o(!0);try{const{key:p}=await n.call("API_KEY_CREATE",{name:`typegen-${m}`,permissions:{[c]:["*"]}});if(!p)throw new Error("No key in response");i(p),ge("agent_typegen_key_generated",{agent_id:c})}catch{ge("agent_typegen_key_failed",{agent_id:c}),re.error(e("virtualMcp.virtualMcpShareModal.failedGenerateApiKey"))}finally{o(!1)}},d=async()=>{ge("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!s}),await navigator.clipboard.writeText(f),h(!0),re.success(e("virtualMcp.virtualMcpShareModal.commandCopied")),await tt(2e3),h(!1)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClient")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateTypedClientDescription")})]}),!s&&t.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:u,disabled:l,children:[l?t.jsx(Xe,{className:"size-3.5"}):t.jsx($t,{size:14}),t.jsx("span",{children:e(l?"virtualMcp.virtualMcpShareModal.generating":"virtualMcp.virtualMcpShareModal.generateApiKey")})]})]}),s&&t.jsx("p",{className:"rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-warning",children:e("virtualMcp.virtualMcpShareModal.storeKeySecurely")}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.generateClientLabel")}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:f}),t.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:r?t.jsx(et,{size:12,className:"text-success"}):t.jsx(ht,{size:12})})]})}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.runtimeVariables")}),t.jsx(Rl,{apiKey:s,agentId:c})]})}function Rl(a){const e=H.c(21),{apiKey:n,agentId:s}=a,[i,l]=G.useState(!1),o=window.location.origin,r=n?`STUDIO_API_KEY=${n}`:"STUDIO_API_KEY=<api-key>",h=`STUDIO_BASE_URL=${o}`,c=`${r}
2
2
  ${h}`;let m;e[0]!==s||e[1]!==n||e[2]!==c?(m=async()=>{ge("agent_connect_action",{agent_id:s,action:"typegen_copy_env",has_api_key:!!n}),await navigator.clipboard.writeText(c),l(!0),await tt(2e3),l(!1)},e[0]=s,e[1]=n,e[2]=c,e[3]=m):m=e[3];const f=m,u=!n;let d;e[4]!==u?(d=fe({"opacity-50":u}),e[4]=u,e[5]=d):d=e[5];let p;e[6]!==r||e[7]!==d?(p=t.jsx("span",{className:d,children:r}),e[6]=r,e[7]=d,e[8]=p):p=e[8];let x,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("br",{}),g=t.jsx("span",{children:h}),e[9]=x,e[10]=g):(x=e[9],g=e[10]);let b;e[11]!==p?(b=t.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[p,x,g]}),e[11]=p,e[12]=b):b=e[12];let y;e[13]!==i?(y=i?t.jsx(et,{size:12,className:"text-success"}):t.jsx(ht,{size:12}),e[13]=i,e[14]=y):y=e[14];let j;e[15]!==f||e[16]!==y?(j=t.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:f,children:y}),e[15]=f,e[16]=y,e[17]=j):j=e[17];let v;return e[18]!==b||e[19]!==j?(v=t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[b,j]})}),e[18]=b,e[19]=j,e[20]=v):v=e[20],v}function Ll(a){const e=H.c(3),{virtualMcp:n}=a;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=s):s=e[0];let i;return e[1]!==n?(i=t.jsx(G.Suspense,{fallback:s,children:t.jsx(zl,{virtualMcp:n})}),e[1]=n,e[2]=i):i=e[2],i}const Ul={self:["COLLECTION_THREADS_CREATE","COLLECTION_THREADS_GET","COLLECTION_THREAD_MESSAGES_LIST","COLLECTION_THREADS_LIST"]},Yl=3600*24*90;function Bl({virtualMcp:a}){const e=X(),n=ot(),{org:s}=Ae(),[i,l]=G.useState(null),[o,r]=G.useState(!1),[h,c]=G.useState(!1),m=a.id,f=a.title||`agent-${m.slice(0,8)}`,d=[`STUDIO_BASE_URL=${window.location.origin}`,`STUDIO_ORG=${s.slug}`,`STUDIO_AGENT_ID=${m}`,`STUDIO_API_KEY=${i??"<api-key>"}`].join(`
3
3
  `),p=async()=>{r(!0);try{const{key:g}=await n.call("API_KEY_CREATE",{name:`chat-bridge-${f}`,permissions:Ul,expiresIn:Yl});if(!g)throw new Error("No key in response");l(g),ge("agent_chat_bridge_key_generated",{agent_id:m})}catch{ge("agent_chat_bridge_key_failed",{agent_id:m}),re.error(e("virtualMcp.virtualMcpShareModal.failedCreateApiKey"))}finally{r(!1)}},x=async()=>{ge("agent_connect_action",{agent_id:m,action:"chat_bridge_copy_env",has_api_key:!!i}),await navigator.clipboard.writeText(d),c(!0),re.success(e("virtualMcp.virtualMcpShareModal.connectionDetailsCopied")),await tt(2e3),c(!1)};return t.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.jsx("h4",{className:"text-sm font-medium text-foreground",children:e("virtualMcp.virtualMcpShareModal.callFromYourApp")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.callFromYourAppDescription")})]}),!i&&t.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:p,disabled:o,children:[o?t.jsx(Xe,{className:"size-3.5"}):t.jsx($t,{size:14}),t.jsx("span",{children:e(o?"virtualMcp.virtualMcpShareModal.creating":"virtualMcp.virtualMcpShareModal.createApiKey")})]})]}),i&&t.jsx("p",{className:"rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-warning",children:e("virtualMcp.virtualMcpShareModal.storeKeySecurely")}),t.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("virtualMcp.virtualMcpShareModal.connectionDetails")}),t.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx("code",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-xs text-muted-foreground",children:d}),t.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:x,children:h?t.jsx(et,{size:12,className:"text-success"}):t.jsx(ht,{size:12})})]})})]})}function Kl(a){const e=H.c(3),{virtualMcp:n}=a;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=s):s=e[0];let i;return e[1]!==n?(i=t.jsx(G.Suspense,{fallback:s,children:t.jsx(Bl,{virtualMcp:n})}),e[1]=n,e[2]=i):i=e[2],i}function Wl(a){const e=H.c(49),{open:n,onOpenChange:s,virtualMcp:i}=a,l=X(),{org:o}=Ae(),r=`/api/${o.slug}/mcp/virtual-mcp/${i.id}`;let h;e[0]!==r?(h=new URL(r,window.location.origin),e[0]=r,e[1]=h):h=e[1];const c=h;let m;e[2]!==i.id||e[3]!==i.title?(m=i.title||`agent-${i.id?.slice(0,8)??"default"}`,e[2]=i.id,e[3]=i.title,e[4]=m):m=e[4];const f=m,u=Qi();let d;e[5]!==i.id||e[6]!==c.href?(d=t.jsx($l,{url:c.href,agentId:i.id}),e[5]=i.id,e[6]=c.href,e[7]=d):d=e[7];let p,x;e[8]!==f||e[9]!==i.id||e[10]!==c.href?(p=t.jsx(El,{url:c.href,serverName:f,agentId:i.id}),x=t.jsx(Fl,{url:c.href,serverName:f,agentId:i.id}),e[8]=f,e[9]=i.id,e[10]=c.href,e[11]=p,e[12]=x):(p=e[11],x=e[12]);let g;e[13]!==d||e[14]!==p||e[15]!==x?(g=t.jsx("div",{className:"flex flex-col gap-3 pt-2",children:t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[d,p,x]})}),e[13]=d,e[14]=p,e[15]=x,e[16]=g):g=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("div",{className:"border-t border-border"}),e[17]=b):b=e[17];let y;e[18]!==i?(y=t.jsx(Ll,{virtualMcp:i}),e[18]=i,e[19]=y):y=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"border-t border-border"}),e[20]=j):j=e[20];let v;e[21]!==i?(v=t.jsx(Kl,{virtualMcp:i}),e[21]=i,e[22]=v):v=e[22];let S;e[23]!==v||e[24]!==g||e[25]!==y?(S=t.jsxs("div",{className:"flex flex-col gap-6",children:[g,b,y,j,v]}),e[23]=v,e[24]=g,e[25]=y,e[26]=S):S=e[26];const C=S;if(u){let D;e[27]!==l?(D=l("virtualMcp.virtualMcpShareModal.connect"),e[27]=l,e[28]=D):D=e[28];let T;e[29]!==D?(T=t.jsx(Gi,{className:"mt-4 mb-4 text-base font-semibold",children:D}),e[29]=D,e[30]=T):T=e[30];let A;e[31]!==C||e[32]!==T?(A=t.jsx(Hi,{children:t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[T,C]})}),e[31]=C,e[32]=T,e[33]=A):A=e[33];let V;return e[34]!==s||e[35]!==n||e[36]!==A?(V=t.jsx(qi,{open:n,onOpenChange:s,children:A}),e[34]=s,e[35]=n,e[36]=A,e[37]=V):V=e[37],V}let M;e[38]!==l?(M=l("virtualMcp.virtualMcpShareModal.connect"),e[38]=l,e[39]=M):M=e[39];let w;e[40]!==M?(w=t.jsx(dt,{children:t.jsx(ut,{children:M})}),e[40]=M,e[41]=w):w=e[41];let N;e[42]!==C||e[43]!==w?(N=t.jsxs(Ze,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[w,C]}),e[42]=C,e[43]=w,e[44]=N):N=e[44];let _;return e[45]!==s||e[46]!==n||e[47]!==N?(_=t.jsx(Je,{open:n,onOpenChange:s,children:N}),e[45]=s,e[46]=n,e[47]=N,e[48]=_):_=e[48],_}function Gl(a){const e=H.c(50),{virtualMcp:n}=a,s=X(),i=Cs(),l=_s(),[o,r]=G.useState(!1);let h,c,m,f,u,d,p,x,g;if(e[0]!==l||e[1]!==i||e[2]!==s||e[3]!==n.id||e[4]!==n.metadata){g=Symbol.for("react.early_return_sentinel");e:{const M=_i(i);if(un(n.id)||lt(n.metadata)||M.has(n.id)){g=null;break e}let w;e[14]!==i||e[15]!==n.id?(w=(i??[]).find(z=>z.metadata?.liveAgentId===n.id)??null,e[14]=i,e[15]=n.id,e[16]=w):w=e[16];const N=w,_=N?.id??null;let D;e[17]!==l.update?(D=(z,q)=>l.update.mutateAsync({id:z,data:{metadata:{liveAgentId:q}}}).catch(ql),e[17]=l.update,e[18]=D):D=e[18];const T=D;let A;e[19]!==T||e[20]!==n.id?(A=z=>{T(z,n.id)},e[19]=T,e[20]=n.id,e[21]=A):A=e[21],m=A;let V;e[22]!==_||e[23]!==T?(V=()=>{_&&T(_,null)},e[22]=_,e[23]=T,e[24]=V):V=e[24];const F=V,I=(i??[]).filter(z=>z.id!==n.id&&lt(z.metadata)&&!M.has(z.id));p="flex flex-col gap-3";let O;e[25]!==s?(O=s("devAgent.devAgentSetup.title"),e[25]=s,e[26]=O):O=e[26],e[27]!==O?(x=t.jsx("h2",{className:"text-sm font-medium text-foreground",children:O}),e[27]=O,e[28]=x):x=e[28],c=fn,d="p-6 gap-4",h=pn,f="p-0 space-y-4",u=_?t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0",children:[t.jsx("span",{className:"text-sm text-foreground truncate",children:N?N.title:_}),t.jsx("span",{className:"text-xs text-muted-foreground",children:s("devAgent.devAgentSetup.linkedDescription")})]}),t.jsx(se,{variant:"outline",size:"sm",className:"shrink-0",onClick:F,children:s("devAgent.devAgentSetup.unlinkButton")})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:s("devAgent.devAgentSetup.linkDescription")}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs(se,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>r(!0),children:[t.jsx(mn,{className:"size-4"}),s("devAgent.devAgentSetup.importButton")]}),I.length>0?t.jsxs(Ve,{onValueChange:m,children:[t.jsx(ke,{size:"sm",className:"w-56",children:t.jsx(Te,{placeholder:s("devAgent.devAgentSetup.selectPlaceholder")})}),t.jsx(De,{children:I.map(Hl)})]}):null]})]})}e[0]=l,e[1]=i,e[2]=s,e[3]=n.id,e[4]=n.metadata,e[5]=h,e[6]=c,e[7]=m,e[8]=f,e[9]=u,e[10]=d,e[11]=p,e[12]=x,e[13]=g}else h=e[5],c=e[6],m=e[7],f=e[8],u=e[9],d=e[10],p=e[11],x=e[12],g=e[13];if(g!==Symbol.for("react.early_return_sentinel"))return g;let b;e[29]!==h||e[30]!==f||e[31]!==u?(b=t.jsx(h,{className:f,children:u}),e[29]=h,e[30]=f,e[31]=u,e[32]=b):b=e[32];let y;e[33]!==c||e[34]!==d||e[35]!==b?(y=t.jsx(c,{className:d,children:b}),e[33]=c,e[34]=d,e[35]=b,e[36]=y):y=e[36];let j;e[37]!==s?(j=s("devAgent.devAgentSetup.importDialogTitle"),e[37]=s,e[38]=j):j=e[38];let v;e[39]!==m?(v=M=>{const{virtualMcpId:w}=M;r(!1),w&&m(w)},e[39]=m,e[40]=v):v=e[40];let S;e[41]!==o||e[42]!==v||e[43]!==j?(S=t.jsx(Xi,{open:o,onOpenChange:r,title:j,onImportComplete:v}),e[41]=o,e[42]=v,e[43]=j,e[44]=S):S=e[44];let C;return e[45]!==S||e[46]!==p||e[47]!==x||e[48]!==y?(C=t.jsxs("div",{className:p,children:[x,y,S]}),e[45]=S,e[46]=p,e[47]=x,e[48]=y,e[49]=C):C=e[49],C}function Hl(a){return t.jsx(xe,{value:a.id,children:a.title},a.id)}function ql(){}const Ql=/^[A-Za-z_][A-Za-z0-9_]*$/;function Xl(a){const e={},n=a.split(/\r?\n/);for(let s=0;s<n.length;s++){let i=(n[s]??"").trim();if(!i||i.startsWith("#"))continue;i.startsWith("export ")&&(i=i.slice(7).trim());const l=i.indexOf("=");if(l<0)throw new Error(`Line ${s+1}: missing '='`);const o=i.slice(0,l).trim();if(!Ql.test(o))throw new Error(`Line ${s+1}: invalid key "${o}"`);let r=i.slice(l+1).trim();r.length>=2&&(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))&&(r=r.slice(1,-1)),e[o]=r}return e}function Jl(a){const e=H.c(28),{control:n,form:s,virtualMcpId:i,orgSlug:l,sandboxMap:o}=a,r=X();let h;e[0]!==r?(h=r("sandbox.envVarsField.title"),e[0]=r,e[1]=h):h=e[1];let c;e[2]!==h?(c=t.jsx("div",{className:"flex items-baseline justify-between gap-2",children:t.jsx(ve,{className:"font-normal text-foreground",children:h})}),e[2]=h,e[3]=c):c=e[3];let m;e[4]!==r?(m=r("sandbox.envVarsField.description"),e[4]=r,e[5]=m):m=e[5];let f;e[6]!==m?(f=t.jsx("p",{className:"text-xs text-muted-foreground",children:m}),e[6]=m,e[7]=f):f=e[7];let u;e[8]!==n||e[9]!==s||e[10]!==l||e[11]!==o||e[12]!==i?(u=t.jsx(Zl,{control:n,form:s,virtualMcpId:i,orgSlug:l,sandboxMap:o}),e[8]=n,e[9]=s,e[10]=l,e[11]=o,e[12]=i,e[13]=u):u=e[13];let d;e[14]!==r?(d=y=>{const{error:j}=y;return t.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:j?.message??r("sandbox.envVarsField.failedToLoadSecrets")})},e[14]=r,e[15]=d):d=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(hn,{className:"h-9 w-full"}),e[16]=p):p=e[16];let x;e[17]!==n||e[18]!==s?(x=t.jsx(G.Suspense,{fallback:p,children:t.jsx(tr,{control:n,form:s})}),e[17]=n,e[18]=s,e[19]=x):x=e[19];let g;e[20]!==d||e[21]!==x?(g=t.jsx(Re,{fallback:d,children:x}),e[20]=d,e[21]=x,e[22]=g):g=e[22];let b;return e[23]!==c||e[24]!==f||e[25]!==u||e[26]!==g?(b=t.jsxs("div",{className:"space-y-2",children:[c,f,u,g]}),e[23]=c,e[24]=f,e[25]=u,e[26]=g,e[27]=b):b=e[27],b}function Zl(a){const e=H.c(33),{control:n,form:s,virtualMcpId:i,orgSlug:l,sandboxMap:o}=a,r=X(),c=xn.useSession().data?.user?.id,m="metadata.runtime.env";let f;e[0]!==s?(f=()=>JSON.stringify(ps(s.getValues(m))),e[0]=s,e[1]=f):f=e[1];const[u,d]=G.useState(f);let p;e[2]!==n?(p={control:n,name:m},e[2]=n,e[3]=p):p=e[3];const x=Ss(p);let g;e[4]!==x?(g=JSON.stringify(ps(x)),e[4]=x,e[5]=g):g=e[5];const b=g,y=b!==u;let j;e[6]!==o||e[7]!==c?(j=c?Object.keys(o?.[c]??{}):[],e[6]=o,e[7]=c,e[8]=j):j=e[8];const v=j,S=v.length>0,[C,M]=G.useState(!1);if(!y||!S)return null;let w;e[9]!==b||e[10]!==l||e[11]!==r||e[12]!==v||e[13]!==i?(w=async()=>{M(!0);const O=await Promise.allSettled(v.map(async q=>{const Y=Ji({orgSlug:l,virtualMcpId:i,branch:q,threadId:null},"setup/start"),K=await fetch(Y,{method:"POST"});if(!K.ok){const L=await K.text().catch(()=>K.statusText);throw new Error(L||K.statusText)}}));M(!1);const z=O.filter(er).length;z===0?(d(b),re.success(v.length===1?r("sandbox.envVarsField.restartedSingle"):r("sandbox.envVarsField.restartedMultiple",{count:v.length}))):re.error(r("sandbox.envVarsField.restartFailed",{failed:z,total:v.length}))},e[9]=b,e[10]=l,e[11]=r,e[12]=v,e[13]=i,e[14]=w):w=e[14];const N=w;let _;e[15]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(js,{className:"size-3.5 shrink-0"}),e[15]=_):_=e[15];let D;e[16]!==r?(D=r("sandbox.envVarsField.sandboxRunningNotice"),e[16]=r,e[17]=D):D=e[17];let T;e[18]!==D?(T=t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-warning",children:[_,t.jsx("span",{className:"truncate",children:D})]}),e[18]=D,e[19]=T):T=e[19];let A;e[20]!==C?(A=C?t.jsx(Xe,{className:"size-3.5"}):t.jsx(vn,{className:"size-3.5"}),e[20]=C,e[21]=A):A=e[21];let V;e[22]!==C||e[23]!==r?(V=r(C?"sandbox.envVarsField.restarting":"sandbox.envVarsField.restartDev"),e[22]=C,e[23]=r,e[24]=V):V=e[24];let F;e[25]!==N||e[26]!==C||e[27]!==V||e[28]!==A?(F=t.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:N,disabled:C,className:"shrink-0",children:[A,V]}),e[25]=N,e[26]=C,e[27]=V,e[28]=A,e[29]=F):F=e[29];let I;return e[30]!==F||e[31]!==T?(I=t.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-warning/20 bg-warning/10 px-3 py-2 text-xs",children:[T,F]}),e[30]=F,e[31]=T,e[32]=I):I=e[32],I}function er(a){return a.status==="rejected"}function tr(a){const e=H.c(62),{control:n,form:s}=a,i=X(),l="metadata.runtime.env";let o;e[0]!==n?(o={control:n,name:l},e[0]=n,e[1]=o):o=e[1];const r=gn(o),{fields:h,append:c,remove:m}=r;let f;e[2]!==s?(f=(Y,K)=>{s.setValue(`${l}.${Y}`,K,{shouldDirty:!0,shouldTouch:!0})},e[2]=s,e[3]=f):f=e[3];const u=f,d=sa();let p;if(e[4]!==d){p=new Map;for(const Y of d)p.set(Y.id,Y);e[4]=d,e[5]=p}else p=e[5];const[x,g]=G.useState(null);let b;e[6]!==c?(b=()=>{c({key:"",kind:"literal",value:""})},e[6]=c,e[7]=b):b=e[7];const y=b;let j;e[8]!==c||e[9]!==s||e[10]!==i?(j=async()=>{let Y;try{Y=await navigator.clipboard.readText()}catch{re.error(i("sandbox.envVarsField.clipboardReadFailed"));return}if(!Y.trim()){re.error(i("sandbox.envVarsField.clipboardEmpty"));return}let K;try{K=Xl(Y)}catch(R){const B=R;re.error(B.message);return}const L=Object.entries(K);if(L.length===0){re.error(i("sandbox.envVarsField.nothingToAdd"));return}const k=s.getValues(l)??[],$=new Set;for(const R of k){const B=(R.key??"").trim();B&&$.add(B)}let W=0,U=0;for(const[R,B]of L){if($.has(R)){U++;continue}c({key:R,kind:"literal",value:B}),$.add(R),W++}W===0&&U>0?re.message(i("sandbox.envVarsField.allKeysExist",{count:U})):re.success(U>0?i("sandbox.envVarsField.addedWithSkipped",{added:W,skipped:U}):i("sandbox.envVarsField.added",{added:W}))},e[8]=c,e[9]=s,e[10]=i,e[11]=j):j=e[11];const v=j;let S;if(e[12]!==n||e[13]!==h||e[14]!==s||e[15]!==m||e[16]!==p||e[17]!==d||e[18]!==u){let Y;e[20]!==n||e[21]!==s||e[22]!==m||e[23]!==p||e[24]!==d||e[25]!==u?(Y=(K,L)=>t.jsx("li",{className:"rounded-md border border-border bg-background",children:t.jsx(sr,{index:L,control:n,form:s,onUpdateEntry:u,fieldPath:l,secrets:d,secretById:p,onSaveAsSecret:(k,$)=>g({kind:"save-literal",index:L,presetKey:k,presetValue:$}),onCreateNewSecret:k=>g({kind:"create-new",index:L,presetKey:k}),onRemove:()=>m(L)})},K.id),e[20]=n,e[21]=s,e[22]=m,e[23]=p,e[24]=d,e[25]=u,e[26]=Y):Y=e[26],S=h.map(Y),e[12]=n,e[13]=h,e[14]=s,e[15]=m,e[16]=p,e[17]=d,e[18]=u,e[19]=S}else S=e[19];let C;e[27]!==S?(C=t.jsx("ul",{className:"space-y-2",children:S}),e[27]=S,e[28]=C):C=e[28];let M;e[29]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsx($e,{className:"size-3.5"}),e[29]=M):M=e[29];let w;e[30]!==i?(w=i("sandbox.envVarsField.addEnvVar"),e[30]=i,e[31]=w):w=e[31];let N;e[32]!==y||e[33]!==w?(N=t.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:y,className:"flex-1",children:[M,w]}),e[32]=y,e[33]=w,e[34]=N):N=e[34];let _;e[35]!==i?(_=i("sandbox.envVarsField.pasteDotenvAriaLabel"),e[35]=i,e[36]=_):_=e[36];let D;e[37]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx(di,{className:"size-3.5"}),e[37]=D):D=e[37];let T;e[38]!==i?(T=i("sandbox.envVarsField.pasteDotenv"),e[38]=i,e[39]=T):T=e[39];let A;e[40]!==v||e[41]!==_||e[42]!==T?(A=t.jsx(ye,{asChild:!0,children:t.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:v,"aria-label":_,children:[D,T]})}),e[40]=v,e[41]=_,e[42]=T,e[43]=A):A=e[43];let V;e[44]!==i?(V=i("sandbox.envVarsField.pasteDotenvTooltip"),e[44]=i,e[45]=V):V=e[45];let F;e[46]!==V?(F=t.jsx(we,{children:V}),e[46]=V,e[47]=F):F=e[47];let I;e[48]!==A||e[49]!==F?(I=t.jsxs(je,{children:[A,F]}),e[48]=A,e[49]=F,e[50]=I):I=e[50];let O;e[51]!==I||e[52]!==N?(O=t.jsxs("div",{className:"flex items-center gap-2",children:[N,I]}),e[51]=I,e[52]=N,e[53]=O):O=e[53];let z;e[54]!==x||e[55]!==s||e[56]!==u?(z=x!==null?t.jsx(ir,{mode:x,onClose:()=>g(null),onSaved:Y=>{const K=s.getValues(`${l}.${x.index}.key`)?.trim()??"";u(x.index,{key:K,kind:"secret",secretId:Y}),g(null)}}):null,e[54]=x,e[55]=s,e[56]=u,e[57]=z):z=e[57];let q;return e[58]!==O||e[59]!==z||e[60]!==C?(q=t.jsxs("div",{className:"space-y-2",children:[C,O,z]}),e[58]=O,e[59]=z,e[60]=C,e[61]=q):q=e[61],q}function sr(a){const e=H.c(77),{index:n,control:s,form:i,onUpdateEntry:l,fieldPath:o,secrets:r,secretById:h,onSaveAsSecret:c,onCreateNewSecret:m,onRemove:f}=a,u=X(),d=`${o}.${n}.key`,p=`${o}.${n}.value`,x=`${o}.${n}.secretId`,g=`${o}.${n}.kind`;let b;e[0]!==s||e[1]!==g?(b={control:s,name:g},e[0]=s,e[1]=g,e[2]=b):b=e[2];const j=Ss(b)==="secret"?"secret":"literal";let v;e[3]!==i||e[4]!==n||e[5]!==d||e[6]!==c||e[7]!==l||e[8]!==p?(v=B=>{const J=i.getValues(d)?.trim()??"";if(B==="literal"){l(n,{key:J,kind:"literal",value:""});return}const ie=i.getValues(p)??"";if(ie.length>0){c(J,ie);return}l(n,{key:J,kind:"secret",secretId:""})},e[3]=i,e[4]=n,e[5]=d,e[6]=c,e[7]=l,e[8]=p,e[9]=v):v=e[9];const S=v;let C;e[10]!==n||e[11]!==u?(C=B=>{const{field:J}=B,ie=(J.value??"").trim(),ee=ie.length>0&&!pt.test(ie);return t.jsxs("div",{className:"space-y-1",children:[t.jsx(Me,{...J,value:J.value??"",placeholder:u("sandbox.envVarsField.keyPlaceholder"),spellCheck:!1,autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",className:fe("font-mono",ee&&"border-destructive focus-visible:ring-destructive"),"aria-invalid":ee,"aria-label":u("sandbox.envVarsField.envVarKeyLabel",{index:n+1}),onBlur:ce=>{const de=ce.target.value.trim();J.onChange(de),J.onBlur()}}),ee?t.jsx("p",{className:"text-[11px] text-destructive",children:u("sandbox.envVarsField.invalidKeyMessage")}):null]})},e[10]=n,e[11]=u,e[12]=C):C=e[12];let M;e[13]!==s||e[14]!==d||e[15]!==C?(M=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx(he,{control:s,name:d,render:C})}),e[13]=s,e[14]=d,e[15]=C,e[16]=M):M=e[16];let w;e[17]!==S?(w=B=>S(B),e[17]=S,e[18]=w):w=e[18];let N;e[19]===Symbol.for("react.memo_cache_sentinel")?(N=t.jsx(ke,{className:"h-9 w-[110px]",children:t.jsx(Te,{})}),e[19]=N):N=e[19];let _;e[20]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx($t,{className:"size-3.5"}),e[20]=_):_=e[20];let D;e[21]!==u?(D=u("sandbox.envVarsField.literal"),e[21]=u,e[22]=D):D=e[22];let T;e[23]!==D?(T=t.jsx(xe,{value:"literal",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[_,D]})}),e[23]=D,e[24]=T):T=e[24];let A;e[25]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx(bn,{className:"size-3.5"}),e[25]=A):A=e[25];let V;e[26]!==u?(V=u("sandbox.envVarsField.secret"),e[26]=u,e[27]=V):V=e[27];let F;e[28]!==V?(F=t.jsx(xe,{value:"secret",children:t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[A,V]})}),e[28]=V,e[29]=F):F=e[29];let I;e[30]!==F||e[31]!==T?(I=t.jsxs(De,{children:[T,F]}),e[30]=F,e[31]=T,e[32]=I):I=e[32];let O;e[33]!==j||e[34]!==I||e[35]!==w?(O=t.jsx("div",{className:"shrink-0",children:t.jsxs(Ve,{value:j,onValueChange:w,children:[N,I]})}),e[33]=j,e[34]=I,e[35]=w,e[36]=O):O=e[36];let z;e[37]!==s||e[38]!==i||e[39]!==n||e[40]!==d||e[41]!==j||e[42]!==m||e[43]!==h||e[44]!==x||e[45]!==r||e[46]!==u||e[47]!==p?(z=t.jsx("div",{className:"flex flex-[2] min-w-0 items-center gap-1",children:j==="literal"?t.jsx(he,{control:s,name:p,render:B=>{const{field:J}=B;return t.jsx(Me,{...J,value:J.value??"",type:"password",placeholder:u("sandbox.envVarsField.valuePlaceholder"),spellCheck:!1,autoComplete:"off",className:"font-mono","aria-label":u("sandbox.envVarsField.envVarValueLabel",{index:n+1}),onBlur:ie=>{J.onChange(ie.target.value),J.onBlur()}})}}):t.jsxs(t.Fragment,{children:[t.jsx(he,{control:s,name:x,render:B=>{const{field:J}=B;return t.jsxs(Ve,{value:J.value||"",onValueChange:ie=>J.onChange(ie),children:[t.jsx(ke,{className:fe("h-9 w-full",!J.value&&"text-muted-foreground"),"aria-label":u("sandbox.envVarsField.secretAriaLabel",{index:n+1}),children:t.jsx(Te,{placeholder:u("sandbox.envVarsField.pickSecretPlaceholder"),children:t.jsx(Zi,{field:J,secretById:h})})}),t.jsx(De,{children:r.length===0?t.jsx("div",{className:"px-2 py-2 text-xs text-muted-foreground",children:u("sandbox.envVarsField.noSecretsYet")}):r.map(nr)})]})}}),t.jsxs(je,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{type:"button",variant:"ghost",size:"icon","aria-label":u("sandbox.envVarsField.createNewSecretAriaLabel"),onClick:()=>{const B=i.getValues(d)?.trim()??"";m(B)},children:t.jsx($e,{className:"size-3.5"})})}),t.jsx(we,{children:u("sandbox.envVarsField.createNewSecret")})]})]})}),e[37]=s,e[38]=i,e[39]=n,e[40]=d,e[41]=j,e[42]=m,e[43]=h,e[44]=x,e[45]=r,e[46]=u,e[47]=p,e[48]=z):z=e[48];let q;e[49]!==i||e[50]!==d||e[51]!==j||e[52]!==c||e[53]!==u||e[54]!==p?(q=j==="literal"?t.jsxs(je,{children:[t.jsx(ye,{asChild:!0,children:t.jsx(se,{type:"button",variant:"ghost",size:"icon","aria-label":u("sandbox.envVarsField.saveAsSecretAriaLabel"),onClick:()=>{const B=i.getValues(d)?.trim()??"",J=i.getValues(p)??"";c(B,J)},children:t.jsx(ui,{className:"size-3.5"})})}),t.jsx(we,{children:u("sandbox.envVarsField.saveAsSecret")})]}):null,e[49]=i,e[50]=d,e[51]=j,e[52]=c,e[53]=u,e[54]=p,e[55]=q):q=e[55];let Y;e[56]!==u?(Y=u("sandbox.envVarsField.removeEnvVarAriaLabel"),e[56]=u,e[57]=Y):Y=e[57];let K;e[58]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsx(Vt,{className:"size-3.5"}),e[58]=K):K=e[58];let L;e[59]!==f||e[60]!==Y?(L=t.jsx(ye,{asChild:!0,children:t.jsx(se,{type:"button",variant:"ghost",size:"icon","aria-label":Y,onClick:f,children:K})}),e[59]=f,e[60]=Y,e[61]=L):L=e[61];let k;e[62]!==u?(k=u("sandbox.envVarsField.remove"),e[62]=u,e[63]=k):k=e[63];let $;e[64]!==k?($=t.jsx(we,{children:k}),e[64]=k,e[65]=$):$=e[65];let W;e[66]!==L||e[67]!==$?(W=t.jsxs(je,{children:[L,$]}),e[66]=L,e[67]=$,e[68]=W):W=e[68];let U;e[69]!==q||e[70]!==W?(U=t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[q,W]}),e[69]=q,e[70]=W,e[71]=U):U=e[71];let R;return e[72]!==O||e[73]!==z||e[74]!==U||e[75]!==M?(R=t.jsxs("div",{className:"flex flex-col gap-2 p-2 sm:flex-row sm:items-center",children:[M,O,z,U]}),e[72]=O,e[73]=z,e[74]=U,e[75]=M,e[76]=R):R=e[76],R}function nr(a){return t.jsx(xe,{value:a.id,children:t.jsxs("span",{className:"inline-flex items-center gap-2",children:[t.jsx(ta,{scope:a.scope}),t.jsx("span",{className:"font-mono",children:a.name})]})},a.id)}function ir({mode:a,onClose:e,onSaved:n}){const s=X(),i=a.kind==="save-literal"?a.presetValue:"",l=a.presetKey,[o,r]=G.useState(()=>ar(l)),[h,c]=G.useState("organization"),[m,f]=G.useState(i),[u,d]=G.useState(""),p=na(),x=o.trim(),g=m.length>0&&x.length>0&&ea.test(x),b=async v=>{if(v.preventDefault(),!!g)try{const S=await p.mutateAsync({scope:h,name:x,value:m,description:u.trim()||void 0});re.success(s("sandbox.envVarsField.secretSaved",{name:S.name})),n(S.id)}catch(S){re.error(S instanceof Error?S.message:s("sandbox.envVarsField.failedToSaveSecret"))}},y=a.kind==="save-literal"?s("sandbox.envVarsField.saveValueAsSecretTitle"):s("sandbox.envVarsField.createNewSecretTitle"),j=a.kind==="save-literal"?s("sandbox.envVarsField.saveValueAsSecretDescription"):s("sandbox.envVarsField.createNewSecretDescription");return t.jsx(Je,{open:!0,onOpenChange:v=>{v||e()},children:t.jsxs(Ze,{className:"sm:max-w-md",children:[t.jsxs(dt,{children:[t.jsx(ut,{children:y}),t.jsx(Wn,{children:j})]}),t.jsxs("form",{onSubmit:b,className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ve,{htmlFor:"save-secret-scope",children:s("sandbox.envVarsField.scopeLabel")}),t.jsxs(Ve,{value:h,onValueChange:v=>c(v),children:[t.jsx(ke,{id:"save-secret-scope",children:t.jsx(Te,{})}),t.jsxs(De,{children:[t.jsx(xe,{value:"organization",children:s("sandbox.envVarsField.scopeOrganization")}),t.jsx(xe,{value:"user",children:s("sandbox.envVarsField.scopePrivate")})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ve,{htmlFor:"save-secret-name",children:s("sandbox.envVarsField.nameLabel")}),t.jsx(Me,{id:"save-secret-name",value:o,onChange:v=>r(v.target.value),placeholder:s("sandbox.envVarsField.namePlaceholder"),autoComplete:"off",required:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("sandbox.envVarsField.nameHelperText")})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ve,{htmlFor:"save-secret-value",children:s("sandbox.envVarsField.valueLabel")}),t.jsx(Me,{id:"save-secret-value",type:"password",value:m,onChange:v=>f(v.target.value),placeholder:s("sandbox.envVarsField.secretValuePlaceholder"),autoComplete:"new-password",required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ve,{htmlFor:"save-secret-description",children:s("sandbox.envVarsField.descriptionLabel")}),t.jsx(it,{id:"save-secret-description",value:u,onChange:v=>d(v.target.value),rows:2,placeholder:s("sandbox.envVarsField.descriptionPlaceholder")})]}),t.jsxs(Ts,{children:[t.jsx(se,{type:"button",variant:"outline",onClick:e,disabled:p.isPending,children:s("sandbox.envVarsField.cancel")}),t.jsx(se,{type:"submit",disabled:!g||p.isPending,children:p.isPending?s("sandbox.envVarsField.saving"):s("sandbox.envVarsField.saveSecret")})]})]})]})})}function ps(a){if(!Array.isArray(a))return[];const e=[];for(const n of a){if(!n||typeof n!="object")continue;const s=n,i=(s.key??"").trim();if(!(!i||!pt.test(i))){if(s.kind==="literal"){e.push({key:i,kind:"literal",value:s.value??""});continue}s.kind==="secret"&&s.secretId&&e.push({key:i,kind:"secret",secretId:s.secretId})}}return e}function ar(a){const e=a.trim();return e&&pt.test(e)?e:""}function lr(a){const e=H.c(21),{repo:n,className:s}=a,i=X();let l;e[0]!==s?(l=fe("space-y-2",s),e[0]=s,e[1]=l):l=e[1];let o;e[2]!==i?(o=i("sandbox.repoRow.label"),e[2]=i,e[3]=o):o=e[3];let r;e[4]!==o?(r=t.jsx(ve,{children:o}),e[4]=o,e[5]=r):r=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(ia,{size:20,className:"shrink-0 text-foreground/60"}),e[6]=h):h=e[6];let c;e[7]!==n||e[8]!==i?(c=t.jsx(ye,{asChild:!0,children:t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background px-4 py-3",tabIndex:0,children:[h,t.jsx("div",{className:"min-w-0 flex-1",children:n?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"truncate text-sm font-medium",children:[n.owner,"/",n.name]}),t.jsx("div",{className:"truncate text-xs text-muted-foreground",children:n.url})]}):t.jsx("div",{className:"text-sm text-muted-foreground",children:i("sandbox.repoRow.noRepositoryConnected")})})]})}),e[7]=n,e[8]=i,e[9]=c):c=e[9];let m;e[10]!==i?(m=i("sandbox.repoRow.tooltipContent"),e[10]=i,e[11]=m):m=e[11];let f;e[12]!==m?(f=t.jsx(we,{children:m}),e[12]=m,e[13]=f):f=e[13];let u;e[14]!==c||e[15]!==f?(u=t.jsxs(je,{children:[c,f]}),e[14]=c,e[15]=f,e[16]=u):u=e[16];let d;return e[17]!==l||e[18]!==r||e[19]!==u?(d=t.jsxs("div",{className:l,children:[r,u]}),e[17]=l,e[18]=r,e[19]=u,e[20]=d):d=e[20],d}const rr={npm:{install:"npm install",run:a=>`npm run ${a}`,runtime:"node"},pnpm:{install:"pnpm install",run:a=>`pnpm run ${a}`,runtime:"node"},yarn:{install:"yarn install",run:a=>`yarn run ${a}`,runtime:"node"},bun:{install:"bun install",run:a=>`bun run ${a}`,runtime:"bun"},deno:{install:"deno install",run:a=>`deno task ${a}`,runtime:"deno"}};function or(a){const e=a.trim();if(e==="")return{ok:!0,value:null};if(!/^\d+$/.test(e))return{ok:!1};const n=Number(e);return n<1||n>65535?{ok:!1}:{ok:!0,value:String(n)}}const cr=Object.keys(rr),yt="__none__";function dr(a){const e=H.c(47),{control:n}=a,s=X(),i=G.useRef(null);let l;e[0]!==s?(l=s("sandbox.runtimeFields.packageManager"),e[0]=s,e[1]=l):l=e[1];let o;e[2]!==l?(o=t.jsx(ve,{htmlFor:"runtime-pm",children:l}),e[2]=l,e[3]=o):o=e[3];let r;e[4]!==s?(r=w=>{const{field:N}=w;return t.jsxs(Ve,{value:N.value??yt,onValueChange:_=>N.onChange(_===yt?null:_),children:[t.jsx(ke,{id:"runtime-pm",children:t.jsx(Te,{placeholder:s("sandbox.runtimeFields.autoDetect")})}),t.jsxs(De,{children:[t.jsx(xe,{value:yt,children:s("sandbox.runtimeFields.autoDetect")}),cr.map(mr)]})]})},e[4]=s,e[5]=r):r=e[5];let h;e[6]!==n||e[7]!==r?(h=t.jsx(he,{control:n,name:"metadata.runtime.selected",render:r}),e[6]=n,e[7]=r,e[8]=h):h=e[8];let c;e[9]!==o||e[10]!==h?(c=t.jsxs("div",{className:"space-y-2",children:[o,h]}),e[9]=o,e[10]=h,e[11]=c):c=e[11];let m;e[12]!==s?(m=s("sandbox.runtimeFields.packagePath"),e[12]=s,e[13]=m):m=e[13];let f;e[14]!==m?(f=t.jsx(ve,{htmlFor:"runtime-path",children:m}),e[14]=m,e[15]=f):f=e[15];let u;e[16]!==n?(u=t.jsx(he,{control:n,name:"metadata.runtime.path",render:ur}),e[16]=n,e[17]=u):u=e[17];let d;e[18]!==s?(d=s("sandbox.runtimeFields.packagePathDescription"),e[18]=s,e[19]=d):d=e[19];let p;e[20]!==d?(p=t.jsx("p",{className:"text-xs text-muted-foreground",children:d}),e[20]=d,e[21]=p):p=e[21];let x;e[22]!==p||e[23]!==f||e[24]!==u?(x=t.jsxs("div",{className:"space-y-2",children:[f,u,p]}),e[22]=p,e[23]=f,e[24]=u,e[25]=x):x=e[25];let g;e[26]!==s?(g=s("sandbox.runtimeFields.devServerPort"),e[26]=s,e[27]=g):g=e[27];let b;e[28]!==g?(b=t.jsx(ve,{htmlFor:"runtime-port",children:g}),e[28]=g,e[29]=b):b=e[29];let y;e[30]!==s?(y=w=>{const{field:N}=w;return t.jsx(Me,{ref:i,id:"runtime-port",inputMode:"numeric",placeholder:s("sandbox.runtimeFields.auto"),defaultValue:N.value??"",onBlur:_=>{const D=or(_.target.value);D.ok?N.onChange(D.value):i.current&&(i.current.value=N.value??"")}})},e[30]=s,e[31]=y):y=e[31];let j;e[32]!==n||e[33]!==y?(j=t.jsx(he,{control:n,name:"metadata.runtime.port",render:y}),e[32]=n,e[33]=y,e[34]=j):j=e[34];let v;e[35]!==s?(v=s("sandbox.runtimeFields.devServerPortDescription"),e[35]=s,e[36]=v):v=e[36];let S;e[37]!==v?(S=t.jsx("p",{className:"text-xs text-muted-foreground",children:v}),e[37]=v,e[38]=S):S=e[38];let C;e[39]!==b||e[40]!==j||e[41]!==S?(C=t.jsxs("div",{className:"space-y-2",children:[b,j,S]}),e[39]=b,e[40]=j,e[41]=S,e[42]=C):C=e[42];let M;return e[43]!==x||e[44]!==C||e[45]!==c?(M=t.jsxs("div",{className:"space-y-5",children:[c,x,C]}),e[43]=x,e[44]=C,e[45]=c,e[46]=M):M=e[46],M}function ur(a){const{field:e}=a;return t.jsx(Me,{id:"runtime-path",placeholder:".",defaultValue:e.value??"",onBlur:n=>{const s=n.target.value.trim();e.onChange(s===""?null:s)}})}function mr(a){return t.jsx(xe,{value:a,children:a},a)}function fr(a){const e=H.c(17),{control:n}=a,s=X();let i;e[0]!==s?(i=s("sandbox.previewServerUrlField.label"),e[0]=s,e[1]=i):i=e[1];let l;e[2]!==i?(l=t.jsx(ve,{htmlFor:"preview-server-url",children:i}),e[2]=i,e[3]=l):l=e[3];let o;e[4]!==s?(o=f=>{const{field:u}=f,d=u.value??"";return t.jsx(Me,{id:"preview-server-url",type:"url",inputMode:"url",placeholder:s("sandbox.previewServerUrlField.placeholder"),value:d,onChange:p=>u.onChange(p.target.value===""?null:p.target.value),onBlur:()=>{u.onChange(aa(d)),u.onBlur()}})},e[4]=s,e[5]=o):o=e[5];let r;e[6]!==n||e[7]!==o?(r=t.jsx(he,{control:n,name:"metadata.previewServerUrl",render:o}),e[6]=n,e[7]=o,e[8]=r):r=e[8];let h;e[9]!==s?(h=s("sandbox.previewServerUrlField.description"),e[9]=s,e[10]=h):h=e[10];let c;e[11]!==h?(c=t.jsx("p",{className:"text-xs text-muted-foreground",children:h}),e[11]=h,e[12]=c):c=e[12];let m;return e[13]!==l||e[14]!==r||e[15]!==c?(m=t.jsxs("div",{className:"space-y-2",children:[l,r,c]}),e[13]=l,e[14]=r,e[15]=c,e[16]=m):m=e[16],m}function pr(a){const e=H.c(5),{control:n}=a,s=X();let i;e[0]!==s?(i=o=>{const{field:r}=o;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(ve,{htmlFor:"field-description-tooltips",className:"font-normal text-foreground",children:s("sandbox.fieldDescriptionTooltipsField.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:s("sandbox.fieldDescriptionTooltipsField.description")})]}),t.jsx(ft,{id:"field-description-tooltips",className:"shrink-0",checked:r.value??!1,onCheckedChange:h=>r.onChange(h)})]})},e[0]=s,e[1]=i):i=e[1];let l;return e[2]!==n||e[3]!==i?(l=t.jsx(he,{control:n,name:"metadata.fieldDescriptionTooltips",render:i}),e[2]=n,e[3]=i,e[4]=l):l=e[4],l}function hr(a){const e=H.c(8),{control:n,previewServerUrl:s}=a,i=X();let l;e[0]!==s?(l=la(s),e[0]=s,e[1]=l):l=e[1];const o=!!l;let r;e[2]!==o||e[3]!==i?(r=c=>{const{field:m}=c;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(ve,{htmlFor:"fast-preview",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.fastPreview.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i(o?"sandbox.cmsSettings.fastPreview.description":"sandbox.cmsSettings.fastPreview.needsPreviewServerUrl")})]}),t.jsx(ft,{id:"fast-preview",className:"shrink-0",checked:!!m.value&&o,disabled:!o,onCheckedChange:f=>m.onChange(f)})]})},e[2]=o,e[3]=i,e[4]=r):r=e[4];let h;return e[5]!==n||e[6]!==r?(h=t.jsx(he,{control:n,name:"metadata.fastPreview",render:r}),e[5]=n,e[6]=r,e[7]=h):h=e[7],h}function xr(a){const e=H.c(5),{control:n,fastPreview:s}=a,i=X();if(!s)return null;let l;e[0]!==i?(l=r=>{const{field:h}=r;return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(ve,{htmlFor:"fast-preview-in-place",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.fastPreviewInPlace.label")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.cmsSettings.fastPreviewInPlace.description")})]}),t.jsx(ft,{id:"fast-preview-in-place",className:"shrink-0",checked:!!h.value,onCheckedChange:c=>h.onChange(c)})]})},e[0]=i,e[1]=l):l=e[1];let o;return e[2]!==n||e[3]!==l?(o=t.jsx(he,{control:n,name:"metadata.fastPreviewInPlace",render:l}),e[2]=n,e[3]=l,e[4]=o):o=e[4],o}function gr(a){const e=H.c(32),{control:n,onCommit:s}=a,i=X();let l;e[0]!==i?(l=i("virtualMcp.virtualMcp.publishPolicySmart"),e[0]=i,e[1]=l):l=e[1];let o;e[2]!==i?(o=i("virtualMcp.virtualMcp.publishPolicySmartDescription"),e[2]=i,e[3]=o):o=e[3];let r;e[4]!==l||e[5]!==o?(r={value:"smart",label:l,description:o},e[4]=l,e[5]=o,e[6]=r):r=e[6];let h;e[7]!==i?(h=i("virtualMcp.virtualMcp.publishPolicyCodeReview"),e[7]=i,e[8]=h):h=e[8];let c;e[9]!==i?(c=i("virtualMcp.virtualMcp.publishPolicyCodeReviewDescription"),e[9]=i,e[10]=c):c=e[10];let m;e[11]!==h||e[12]!==c?(m={value:"code-review",label:h,description:c},e[11]=h,e[12]=c,e[13]=m):m=e[13];let f;e[14]!==i?(f=i("virtualMcp.virtualMcp.publishPolicyOpen"),e[14]=i,e[15]=f):f=e[15];let u;e[16]!==i?(u=i("virtualMcp.virtualMcp.publishPolicyOpenDescription"),e[16]=i,e[17]=u):u=e[17];let d;e[18]!==f||e[19]!==u?(d={value:"open",label:f,description:u},e[18]=f,e[19]=u,e[20]=d):d=e[20];let p;e[21]!==r||e[22]!==m||e[23]!==d?(p=[r,m,d],e[21]=r,e[22]=m,e[23]=d,e[24]=p):p=e[24];const x=p;let g;e[25]!==s||e[26]!==x||e[27]!==i?(g=y=>{const{field:j}=y,v=j.value??"smart";return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(ve,{htmlFor:"publish-policy",className:"font-normal text-foreground",children:i("virtualMcp.virtualMcp.publishing")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("virtualMcp.virtualMcp.publishingDescription")})]}),t.jsxs(Ve,{value:v,onValueChange:S=>{j.onChange(S),s()},children:[t.jsx(ke,{id:"publish-policy",className:"w-44 shrink-0 text-sm",children:t.jsx(Te,{})}),t.jsx(De,{className:"max-w-80",children:x.map(vr)})]})]})},e[25]=s,e[26]=x,e[27]=i,e[28]=g):g=e[28];let b;return e[29]!==n||e[30]!==g?(b=t.jsx(he,{name:"metadata.publishPolicy",control:n,render:g}),e[29]=n,e[30]=g,e[31]=b):b=e[31],b}function vr(a){return t.jsx(xe,{value:a.value,description:a.description,children:a.label},a.value)}function br(a){const e=H.c(24),{control:n,onCommit:s}=a,i=X();let l;e[0]!==i?(l=i("sandbox.cmsSettings.contentEditing.off"),e[0]=i,e[1]=l):l=e[1];let o;e[2]!==i?(o=i("sandbox.cmsSettings.contentEditing.offDescription"),e[2]=i,e[3]=o):o=e[3];let r;e[4]!==l||e[5]!==o?(r={value:"off",label:l,description:o},e[4]=l,e[5]=o,e[6]=r):r=e[6];let h;e[7]!==i?(h=i("sandbox.cmsSettings.contentEditing.on"),e[7]=i,e[8]=h):h=e[8];let c;e[9]!==i?(c=i("sandbox.cmsSettings.contentEditing.onDescription"),e[9]=i,e[10]=c):c=e[10];let m;e[11]!==h||e[12]!==c?(m={value:"on",label:h,description:c},e[11]=h,e[12]=c,e[13]=m):m=e[13];let f;e[14]!==r||e[15]!==m?(f=[r,m],e[14]=r,e[15]=m,e[16]=f):f=e[16];const u=f;let d;e[17]!==s||e[18]!==u||e[19]!==i?(d=x=>{const{field:g}=x,b=g.value??null,y=Rs(b);return t.jsxs("div",{className:"flex items-center justify-between gap-4",children:[t.jsxs("div",{className:"space-y-0.5 min-w-0",children:[t.jsx(ve,{htmlFor:"content-editing-mode",className:"font-normal text-foreground",children:i("sandbox.cmsSettings.contentEditing.title")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.cmsSettings.contentEditing.description")})]}),t.jsxs(Ve,{value:y,onValueChange:j=>{const v=Ki.safeParse(j);v.success&&(g.onChange(Wi(b,v.data)),s())},children:[t.jsx(ke,{id:"content-editing-mode",className:"w-44 shrink-0 text-sm",children:t.jsx(Te,{})}),t.jsx(De,{className:"max-w-80",children:u.map(jr)})]})]})},e[17]=s,e[18]=u,e[19]=i,e[20]=d):d=e[20];let p;return e[21]!==n||e[22]!==d?(p=t.jsx(he,{name:"metadata.ui.layout",control:n,render:d}),e[21]=n,e[22]=d,e[23]=p):p=e[23],p}function jr(a){return t.jsx(xe,{value:a.value,description:a.description,children:a.label},a.value)}function hs(a){const e=a.metadata?.sidebarViews,n=a.metadata?.sidebarViewsVersion;return{effectiveViews:[...Nt(Ct(a.metadata),n)],rawViews:e===null?null:e?[...e]:void 0,version:n}}function yr(a,e){return a===e?!0:!a||!e||a.length!==e.length?!1:a.every((n,s)=>n===e[s])}function wr(a,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...a,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...a,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...a,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...a,settingsDialogOpen:!1,settingsConnectionId:null};default:return a}}function Sr(a,e){switch(e.type){case"accumulate":{const n=a??{start:e.now,fields:new Set,saveCount:0,instructionsLength:null},s=new Set(n.fields);for(const i of e.fields)s.add(i);return{...n,fields:s,saveCount:n.saveCount+1,instructionsLength:e.instructionsLength??n.instructionsLength}}case"reset":return null}}function Nr(a){const e=a.metadata?.runtime?.env;if(!e||e.length===0)return a;const n=e.filter(s=>{if(!s||typeof s!="object")return!1;const i=(s.key??"").trim();return!i||!pt.test(i)?!1:s.kind==="literal"?!0:s.kind==="secret"?!!s.secretId:!1});return n.length===e.length?a:{...a,metadata:{...a.metadata,runtime:{...a.metadata?.runtime??{},env:n}}}}async function Cr(a,e){const n=a?.idToken??null;if(n){const i=xs(n);if(i)return i}const s=a?.userinfoEndpoint??null;if(s)try{const i=await fetch(s,{headers:{Authorization:`Bearer ${e}`}});if(i.ok){const l=await i.json(),o=typeof l.email=="string"?l.email:typeof l.upn=="string"?l.upn:typeof l.preferred_username=="string"?l.preferred_username:null;if(o)return o}}catch{}return xs(e)}function xs(a){try{const e=a.split(".");if(e.length===3&&e[1]){const n=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof n.email=="string")return n.email;if(typeof n.upn=="string")return n.upn;if(typeof n.preferred_username=="string")return n.preferred_username}}catch{}return null}function Mr({virtualMcp:a}){const e=X(),n=In(),{org:s}=Ae(),i=_s(),{data:l}=$n([a.id]),o=l?.get(a.id)?.last_used_at,r=Ns(),h=jn(),c=ot(),m=zs(a.id),f=JSON.stringify([s.id,a.id]),u=Fi(a.metadata,m.snapshot()),d=yn({resolver:wn(Ol),defaultValues:{...a,metadata:{...ss(a.metadata),previewServerUrl:ra(a.metadata),...u}}}),p=d.watch("connections"),x=ki(a),g=lt(a?.metadata),b=g&&Rs(d.watch("metadata.ui.layout"))==="off",y=ks(a),j=y?{owner:y.owner,name:y.name,url:y.url}:null,[v,S]=G.useReducer(wr,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[C,M]=G.useState(!1),[w,N]=G.useState(!1),{openSidePanel:_}=Dn(),{sendMessage:D}=Mn(),T=async()=>{if(w)return;const E=d.getValues("metadata.instructions");if(E?.trim()){N(!0);try{O(),ge("agent_instructions_improve_clicked",{agent_id:a.id,instructions_length:E.length}),_();const ne=Nn(s.id);await D({tiptapDoc:kn({managerAgentId:ne.id,managerName:ne.title,kind:"agent",id:a.id,instructions:E})})}finally{N(!1)}}},[A,V]=G.useReducer(Sr,null),F=()=>{A!==null&&(ge("agent_updated",{agent_id:a.id,fields:Array.from(A.fields),instructions_length:A.instructionsLength,save_count:A.saveCount,edit_duration_ms:Date.now()-A.start}),V({type:"reset"}))},{schedule:I,flush:O}=Jt({delayMs:3e4,save:async()=>F()}),z=async()=>{const E=m.snapshot(),ne={predicate:_e=>ts(_e.queryKey,s.id)},Q=async()=>(await h.invalidateQueries({predicate:_e=>ts(_e.queryKey,s.id),refetchType:"all"}),es(h,s.id,a.id)),ae=(_e,Ue)=>{if(_e){yr(d.getValues("metadata.sidebarViews"),_e.rawViews)||d.setValue("metadata.sidebarViews",_e.rawViews,{shouldDirty:!1}),d.getValues("metadata.sidebarViewsVersion")!==_e.version&&d.setValue("metadata.sidebarViewsVersion",_e.version,{shouldDirty:!1});return}Ue!==null&&(d.setValue("metadata.sidebarViews",[...Ue],{shouldDirty:!1}),d.setValue("metadata.sidebarViewsVersion",$i,{shouldDirty:!1}))},P=zi(E),Z=Object.keys(d.control._formState.dirtyFields);if(Z.length===0&&!P){await m.settle({snapshot:E,saved:!0,authoritativeViews:E?.persistedViews});return}const oe=Z.length>0?Z:["metadata"],Ne=oe.includes("metadata"),be=d.getValues();d.reset(be,{keepValues:!0});const Oe=Nr(be),Js=es(h,s.id,a.id),Zs=Ri({sidebarViews:Oe.metadata?.sidebarViews,sidebarViewsVersion:Oe.metadata?.sidebarViewsVersion},E,Js?.metadata);Oe.metadata={...ss(Oe.metadata),...Zs};let xt;try{xt=await i.update.mutateAsync({id:a.id,data:Oe})}catch(_e){let Ue=null;try{Ue=await Q()}catch{}const Rt=Ue?hs(Ue):null,Lt=await m.settle({snapshot:E,saved:!1,authoritativeViews:Rt?.effectiveViews});throw Lt.settledLatest&&ae(Rt,Lt.reconciledViews),_e}await h.cancelQueries(ne),Li(h,s.id,xt);const Ft=hs(xt),zt=await m.settle({snapshot:E,saved:!0,authoritativeViews:Ft.effectiveViews});zt.settledLatest&&ae(Ft,zt.reconciledViews),V({type:"accumulate",now:Date.now(),fields:oe,instructionsLength:Ne?be.metadata?.instructions?.length??0:null}),I()},q=()=>oa(f,z),{schedule:Y,flush:K}=Jt({save:q});G.useEffect(()=>{const E=d.watch(()=>Y());return()=>E.unsubscribe()},[]);const L=()=>{ge("connections_dialog_opened",{source:"agent_settings",mode:"add"}),S({type:"SET_ADD_DIALOG_OPEN",payload:!0})},k=async E=>{const ne=d.getValues("connections");if(ne.some(P=>P.connection_id===E))return;d.setValue("connections",[...ne,{connection_id:E,selected_tools:jt.tools,selected_resources:jt.resources,selected_prompts:jt.prompts}],{shouldDirty:!0}),S({type:"SET_ADD_DIALOG_OPEN",payload:!1});const Q=new URL(`/api/${s.slug}/mcp/${E}`,window.location.origin),ae=await Gt({url:Q.href,token:null,orgId:s.id});ae.supportsOAuth&&!ae.isAuthenticated&&await B(E)},$=E=>{const Q=d.getValues("connections").filter(ae=>ae.connection_id!==E);d.setValue("connections",Q,{shouldDirty:!0})},W=(E,ne)=>{const Q=d.getValues("connections");if(Q.some(ae=>ae.connection_id===ne)){re.error(e("virtualMcp.virtualMcp.instanceAlreadyAdded"));return}d.setValue("connections",Q.map(ae=>ae.connection_id===E?{...ae,connection_id:ne}:ae),{shouldDirty:!0})},U=async E=>{if(d.getValues("connections").find(Q=>Q.connection_id===E))try{const{item:Q}=await c.call("COLLECTION_CONNECTIONS_GET",{id:E});if(!Q)return;const ae=Q.title.replace(/\s*\(.*?\)\s*$/,""),P=Cn("conn"),Z=`${ae} (${Date.now().toString(36).slice(-4)})`;await r.create.mutateAsync({id:P,title:Z,description:Q.description??null,connection_type:Q.connection_type,connection_url:Q.connection_url??null,connection_token:null,icon:Q.icon??null,app_name:Q.app_name??null,app_id:Q.app_id??null,connection_headers:Q.connection_headers??null});const oe=new URL(`/api/${s.slug}/mcp/${P}`,window.location.origin),Ne=await Gt({url:oe.href,token:null,orgId:s.id});if(Ne.supportsOAuth&&!Ne.isAuthenticated){const be=await B(P);if(!be){await r.delete.mutateAsync(P);return}await r.update.mutateAsync({id:P,data:{title:`${ae} (${be})`}})}W(E,P),re.success(e("virtualMcp.virtualMcp.newInstanceCreated"))}catch(Q){console.error("Failed to create instance:",Q),re.error(e("virtualMcp.virtualMcp.failedToCreateInstance"))}},R=E=>{S({type:"OPEN_SETTINGS",payload:E})},B=async E=>{const{token:ne,tokenInfo:Q,error:ae}=await En({connectionId:E,orgSlug:s.slug,scope:"offline_access"});if(ae||!ne)return re.error(e("virtualMcp.virtualMcp.authenticationFailed",{error:ae??""})),null;if(Q)try{const Z=await fetch(`/api/${s.slug}/connections/${E}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:Q.accessToken,refreshToken:Q.refreshToken,expiresIn:Q.expiresIn,scope:Q.scope,clientId:Q.clientId,clientSecret:Q.clientSecret,tokenEndpoint:Q.tokenEndpoint})});if(!Z.ok)console.error("Failed to save OAuth token:",await Z.text()),await r.update.mutateAsync({id:E,data:{connection_token:ne}});else try{await r.update.mutateAsync({id:E,data:{}})}catch(oe){console.warn("Failed to refresh connection tools after OAuth:",oe)}}catch(Z){console.error("Error saving OAuth token:",Z),await r.update.mutateAsync({id:E,data:{connection_token:ne}})}else await r.update.mutateAsync({id:E,data:{connection_token:ne}});const P=new URL(`/api/${s.slug}/mcp/${E}`,window.location.origin);return await h.invalidateQueries({queryKey:ws.isMCPAuthenticated(P.href,null)}),re.success(e("virtualMcp.virtualMcp.authenticationSuccessful")),Cr(Q,ne)},J=()=>{const E=d.getValues("metadata.instructions")??"",ne=e("virtualMcp.virtualMcp.promptTemplateContent"),Q=E.trim()?`${E}
4
4