decocms 3.26.2 → 3.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/dist/client/assets/{AlertCircle-9EFUZenf.js → AlertCircle-Dk6vk346.js} +1 -1
  2. package/dist/client/assets/{ArrowUpRight-97355q5v.js → ArrowUpRight-4oEjocH3.js} +1 -1
  3. package/dist/client/assets/{Check-D-9dblUn.js → Check-xMlMIzVH.js} +1 -1
  4. package/dist/client/assets/{CheckCircle-C2ualSpf.js → CheckCircle-ieh2HpZJ.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Cf2Q-GlB.js → ChevronDown-DXk0XLak.js} +1 -1
  6. package/dist/client/assets/{ChevronLeft-BaV4nFMQ.js → ChevronLeft-z0R4UDTf.js} +1 -1
  7. package/dist/client/assets/{ChevronRight-CrZy8tHx.js → ChevronRight-TZkuqway.js} +1 -1
  8. package/dist/client/assets/{ChevronUp-BAxoXhnT.js → ChevronUp-CDwUhj6r.js} +1 -1
  9. package/dist/client/assets/{Container-CYcITvPW.js → Container-BuYdkyve.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-SvwN4CeV.js → DotsVertical-dauL8_mz.js} +1 -1
  11. package/dist/client/assets/{Eye-ByuwKsdh.js → Eye-DjmQZ2p3.js} +1 -1
  12. package/dist/client/assets/{FilterLines-BJZdiggU.js → FilterLines-DCVUz1mF.js} +1 -1
  13. package/dist/client/assets/{Globe01-DfGFlik1.js → Globe01-BFX2DjNo.js} +1 -1
  14. package/dist/client/assets/{HardDrive-DNFvbooP.js → HardDrive-ep-sJwLU.js} +1 -1
  15. package/dist/client/assets/{Key01-CzmPnHuw.js → Key01-u8nOkLN5.js} +1 -1
  16. package/dist/client/assets/{LayoutLeft-CQ8Vq9nI.js → LayoutLeft-Ozgz9jeL.js} +1 -1
  17. package/dist/client/assets/{LinkExternal01-CgI1VTqi.js → LinkExternal01-C_bnt3ki.js} +1 -1
  18. package/dist/client/assets/{Monitor01-Cw6kmClm.js → Monitor01-BBuvzSNf.js} +1 -1
  19. package/dist/client/assets/{Palette-Druykvzw.js → Palette-CJj0LVDj.js} +1 -1
  20. package/dist/client/assets/{Play-CMJ2IWYR.js → Play-BUy7F0as.js} +1 -1
  21. package/dist/client/assets/{Plus-CjrtKB-Y.js → Plus-CSmw6cpp.js} +1 -1
  22. package/dist/client/assets/{RefreshCcw01-3BsQQkRx.js → RefreshCcw01-Ct_5xx8z.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BL2y99rx.js → SearchMd-DXp3IUvU.js} +1 -1
  24. package/dist/client/assets/{Settings02-Cd4DIqaJ.js → Settings02-DttqwSGe.js} +1 -1
  25. package/dist/client/assets/{Shield01-zIbMct6w.js → Shield01-BlrpeOP8.js} +1 -1
  26. package/dist/client/assets/{Star01-eRdSY4QW.js → Star01-s_hRJjwq.js} +1 -1
  27. package/dist/client/assets/{Stars01-v0yz6PCZ.js → Stars01-U1zM7H-d.js} +1 -1
  28. package/dist/client/assets/{Stars02-EuAFDZ5E.js → Stars02-Cg2K8h2t.js} +1 -1
  29. package/dist/client/assets/{Sun-CH2HWLCn.js → Sun-D1pch37z.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-BMnNI1Fi.js → SwitchHorizontal01-DUBxuMB8.js} +1 -1
  31. package/dist/client/assets/{Tool01-Dcq7KP8Y.js → Tool01-CSM07Bd3.js} +1 -1
  32. package/dist/client/assets/{Trash01-Cup7-ZTT.js → Trash01-BOiUMUTV.js} +1 -1
  33. package/dist/client/assets/{Upload01-C9yi1Bdg.js → Upload01-B45bupsd.js} +1 -1
  34. package/dist/client/assets/{User01-thAIxsAs.js → User01-CMlKZMq6.js} +1 -1
  35. package/dist/client/assets/{Users01-DPJm6-u-.js → Users01-CHcmgQX1.js} +1 -1
  36. package/dist/client/assets/{Users03-BlNe2PnN.js → Users03-C19XPgsH.js} +1 -1
  37. package/dist/client/assets/{X-1KR4wibP.js → X-LT7RIKGm.js} +1 -1
  38. package/dist/client/assets/{XCircle-UPVnJx4i.js → XCircle-fZmWWsk8.js} +1 -1
  39. package/dist/client/assets/{XClose-pR-QU0OQ.js → XClose-CXQHotFO.js} +1 -1
  40. package/dist/client/assets/{Zap-Cl-JM7N9.js → Zap-DhYBCL8w.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-B1o2Q9OR.js → ZapSquare-Br5HjwCx.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-D8vQ49we.js → ZoomOut-DiWWUJB1.js} +1 -1
  43. package/dist/client/assets/{access-gate-CWPebMdP.js → access-gate-CAbN0Agd.js} +1 -1
  44. package/dist/client/assets/{accordion-aX0NKKKh.js → accordion-CqS3rCYY.js} +1 -1
  45. package/dist/client/assets/add-section-modal-Xtytp9xF.js +1 -0
  46. package/dist/client/assets/agent-capabilities-CH2iEpSS.js +3 -0
  47. package/dist/client/assets/{agent-icon-DT8dQ9tq.js → agent-icon-DyETFFvd.js} +1 -1
  48. package/dist/client/assets/agent-icons-0as3WkuR.js +4 -0
  49. package/dist/client/assets/{agents-list-DDhPNISh.js → agents-list-CDTD2QQV.js} +1 -1
  50. package/dist/client/assets/ai-providers-CmBK6tVa.js +1 -0
  51. package/dist/client/assets/{alert-DyB_hFGI.js → alert-BvaxqAIW.js} +1 -1
  52. package/dist/client/assets/{alert-dialog-CSkQIwm8.js → alert-dialog-C_C5CWIi.js} +1 -1
  53. package/dist/client/assets/app-editor-BeU6l_dS.js +1 -0
  54. package/dist/client/assets/{auth-catchall-BUwhIhze.js → auth-catchall-DBSfiKWC.js} +1 -1
  55. package/dist/client/assets/{auth-split-layout-CY4CpKKX.js → auth-split-layout-CEZXGHtA.js} +1 -1
  56. package/dist/client/assets/{automation-list-row-5M4PNEWw.js → automation-list-row-s3KQqnbA.js} +1 -1
  57. package/dist/client/assets/automation-runs-RFg521Hi.js +1 -0
  58. package/dist/client/assets/{automations-Cy981ltn.js → automations-C4zBnLxc.js} +1 -1
  59. package/dist/client/assets/{avatar-BHEXMwdE.js → avatar-DI2KQvq0.js} +1 -1
  60. package/dist/client/assets/{badge-Da0IsrqH.js → badge-DqS5s_eb.js} +1 -1
  61. package/dist/client/assets/brand-context-Cg_N2T5g.js +1 -0
  62. package/dist/client/assets/buckets-CGFQSBKU.js +1 -0
  63. package/dist/client/assets/{calendar-BbhbS2FE.js → calendar-CuCfbpTI.js} +1 -1
  64. package/dist/client/assets/{capability-load-error-Dfw4xb8a.js → capability-load-error-DMe1nIxk.js} +1 -1
  65. package/dist/client/assets/{card-BUTabNLA.js → card-C0qmaAJH.js} +1 -1
  66. package/dist/client/assets/chat-context-DEKG6yp4.js +20 -0
  67. package/dist/client/assets/{checkbox--nDaSUZE.js → checkbox-ClCQ7aIa.js} +1 -1
  68. package/dist/client/assets/{cli-auth-success-CUSnxWUp.js → cli-auth-success-YaavH1FD.js} +1 -1
  69. package/dist/client/assets/collection-detail-TiY0uzM1.js +1 -0
  70. package/dist/client/assets/{collection-display-button-BfQyXSIv.js → collection-display-button-C6_DwOqJ.js} +1 -1
  71. package/dist/client/assets/{collection-search-LsgoMrVO.js → collection-search-uQS9yrST.js} +1 -1
  72. package/dist/client/assets/{collection-table-wrapper-D3ciIIEv.js → collection-table-wrapper-CTY0qyxJ.js} +1 -1
  73. package/dist/client/assets/{collection-tabs-CQJiHDMR.js → collection-tabs-dTL9gxGq.js} +1 -1
  74. package/dist/client/assets/{collections-C_j8CeI8.js → collections-5f6Mz9W3.js} +1 -1
  75. package/dist/client/assets/{command-BehF6pb8.js → command-DZekvH1G.js} +1 -1
  76. package/dist/client/assets/connect-desktop-dialog-Bi-Fd5NF.js +1 -0
  77. package/dist/client/assets/{connection-card-EXvV7rxl.js → connection-card-CVH5Hy6F.js} +1 -1
  78. package/dist/client/assets/connection-detail-mj8sHl20.js +1 -0
  79. package/dist/client/assets/{connection-form-helpers-DoJomSCQ.js → connection-form-helpers-DFXgro4O.js} +1 -1
  80. package/dist/client/assets/connections-D3Q6bIzz.js +1 -0
  81. package/dist/client/assets/{decopilot-sse-pool-BUhEcft-.js → decopilot-sse-pool-Keqs3wfV.js} +1 -1
  82. package/dist/client/assets/{dialog-Bm1pP7Vu.js → dialog-BE3BWPis.js} +1 -1
  83. package/dist/client/assets/domain-settings-Bq8L3_pf.js +1 -0
  84. package/dist/client/assets/{drawer-B51jkLaX.js → drawer-BSFXr7hp.js} +1 -1
  85. package/dist/client/assets/{dropdown-menu-CIu58K9q.js → dropdown-menu-D7fqzmBS.js} +1 -1
  86. package/dist/client/assets/dynamic-plugin-layout-CK3Aqazw.js +1 -0
  87. package/dist/client/assets/{empty-state-1AbmTLd7.js → empty-state-BumLAiri.js} +1 -1
  88. package/dist/client/assets/{empty-state-BfmCVPeb.js → empty-state-Eik7Dn7e.js} +1 -1
  89. package/dist/client/assets/{extract-connection-data-LoMqboL3.js → extract-connection-data-BLVQkjXZ.js} +1 -1
  90. package/dist/client/assets/{features-DWJ09Fdz.js → features-BPRhAfHF.js} +1 -1
  91. package/dist/client/assets/file-explorer-D9JJ-ABp.js +2 -0
  92. package/dist/client/assets/{file-type-icon-CX5JEvCQ.js → file-type-icon-I99Qy2JI.js} +1 -1
  93. package/dist/client/assets/{files-QExlaPCQ.js → files-Bo9D7ZcJ.js} +1 -1
  94. package/dist/client/assets/{form-BcPtow5O.js → form-Bn5_lJ6b.js} +1 -1
  95. package/dist/client/assets/general-BKEEaSjd.js +1 -0
  96. package/dist/client/assets/{generate-id-CadHbHqX.js → generate-id-D0pLsbUu.js} +1 -1
  97. package/dist/client/assets/{github-repo-picker-B24_pGAu.js → github-repo-picker-CKp3ba8m.js} +1 -1
  98. package/dist/client/assets/header-tab-button-CbbR6n8q.js +5 -0
  99. package/dist/client/assets/{hover-card-DE2_8MLP.js → hover-card-NLGI_Z11.js} +1 -1
  100. package/dist/client/assets/image-field-Baxidks4.js +1 -0
  101. package/dist/client/assets/{index-BflNEs6l.js → index-B-No0lhl.js} +1 -1
  102. package/dist/client/assets/{index-50-dmJFK.js → index-B6YB9tmn.js} +1 -1
  103. package/dist/client/assets/{index-B1bHiM-j.js → index-BE8dVooN.js} +1 -1
  104. package/dist/client/assets/index-BGdRrrmO.js +1 -0
  105. package/dist/client/assets/{index-J2NhKqyZ.js → index-BM5cVzVa.js} +5 -5
  106. package/dist/client/assets/{index-Dr4Isy1j.js → index-BTFwMarm.js} +1 -1
  107. package/dist/client/assets/{index-r7-3fAFf.js → index-Bgv8YQhF.js} +1 -1
  108. package/dist/client/assets/{index-biiHZ5l9.js → index-Bll1AlZi.js} +26 -26
  109. package/dist/client/assets/{index-D6ELOmUq.js → index-Bz4SrPhc.js} +1 -1
  110. package/dist/client/assets/{index-Bo5bzoUm.js → index-CF_awNaT.js} +1 -1
  111. package/dist/client/assets/{index-YdX5UjUB.js → index-ClpGtndr.js} +1 -1
  112. package/dist/client/assets/{index-CZJ35dl3.css → index-DfYyH4IW.css} +1 -1
  113. package/dist/client/assets/{index-CR_LeyNj.js → index-DxNfIzhJ.js} +1 -1
  114. package/dist/client/assets/{index-CHdFXpqc.js → index-YVfCniqO.js} +1 -1
  115. package/dist/client/assets/index-apuzt69p.js +310 -0
  116. package/dist/client/assets/index-bSiT8Vjd.js +1 -0
  117. package/dist/client/assets/{index-redirect-pPYMz5D6.js → index-redirect-DjHBgih0.js} +1 -1
  118. package/dist/client/assets/{infiniteQueryObserver-B0VBGXv5.js → infiniteQueryObserver-B-dakPwk.js} +1 -1
  119. package/dist/client/assets/{input-5PMMNPU9.js → input-CMMOM0dD.js} +1 -1
  120. package/dist/client/assets/{integration-icon-Dy-a3x5R.js → integration-icon-DblM7d27.js} +1 -1
  121. package/dist/client/assets/{label-CcC4_aKf.js → label-cKO6vIjy.js} +1 -1
  122. package/dist/client/assets/{layout-CbTbCjmA.js → layout-QBDJ_skY.js} +1 -1
  123. package/dist/client/assets/{login-Dn4EF5EK.js → login-BAGu_SJp.js} +1 -1
  124. package/dist/client/assets/members-C7uPVWw3.js +3 -0
  125. package/dist/client/assets/{monaco-editor-CJVi8Ty8.js → monaco-editor-BD33gVrt.js} +1 -1
  126. package/dist/client/assets/{monitoring-stats-row-BAplEVfE.js → monitoring-stats-row-Bvt3RsAI.js} +1 -1
  127. package/dist/client/assets/{oauth-callback-D5XAAL8p.js → oauth-callback-DvAeoSNI.js} +1 -1
  128. package/dist/client/assets/{oauth-callback-ai-provider-tGQCB63I.js → oauth-callback-ai-provider-BuhDe7NV.js} +1 -1
  129. package/dist/client/assets/{onboarding-CgvYwT2C.js → onboarding-DiyHWSGI.js} +1 -1
  130. package/dist/client/assets/{org-install-CV5qvXsE.js → org-install-B1rM2juw.js} +1 -1
  131. package/dist/client/assets/{org-layout-BFil8fwL.js → org-layout-Ck7vt_mB.js} +1 -1
  132. package/dist/client/assets/org-plugin-layout-Cc5oLilE.js +1 -0
  133. package/dist/client/assets/{page-seo-form-Bbna5w2y.js → page-seo-form-CTM0Xp8N.js} +1 -1
  134. package/dist/client/assets/page-seo-sheet-nSdCZ-KL.js +1 -0
  135. package/dist/client/assets/pair-BidrJ4sX.js +39 -0
  136. package/dist/client/assets/{plugin-empty-state-DM8dR2Wk.js → plugin-empty-state-CERz9K1r.js} +1 -1
  137. package/dist/client/assets/{plugin-header-CaWKfaZE.js → plugin-header-CISIxXxk.js} +1 -1
  138. package/dist/client/assets/plugin-layout-UkXtyZlZ.js +1 -0
  139. package/dist/client/assets/{popover-Cvcd3A1d.js → popover-CNh3Ozeq.js} +1 -1
  140. package/dist/client/assets/{post-editor-CM-ESdP7.js → post-editor-C3YLiXXM.js} +3 -3
  141. package/dist/client/assets/{primitives-DWXKnou4.js → primitives-Y0YbWOD4.js} +1 -1
  142. package/dist/client/assets/{profile-DmCC3zYK.js → profile-o29P_MC2.js} +1 -1
  143. package/dist/client/assets/project-app-view-DHVFZPIZ.js +1 -0
  144. package/dist/client/assets/record-editor-DtXRmftd.js +1 -0
  145. package/dist/client/assets/registry-jlRh9TsH.js +2 -0
  146. package/dist/client/assets/registry-layout-zUgwlIce.js +27 -0
  147. package/dist/client/assets/{require-capability-DVI2cKO3.js → require-capability-CQkA6hP5.js} +1 -1
  148. package/dist/client/assets/{required-auth-layout-zYH6NIDF.js → required-auth-layout-Sv9_QEzP.js} +1 -1
  149. package/dist/client/assets/{reset-password-DXXx8e6Q.js → reset-password-C1pH8pyn.js} +1 -1
  150. package/dist/client/assets/{resizable-BbbLszRZ.js → resizable-BTpQlX-z.js} +1 -1
  151. package/dist/client/assets/{roles-vHYrQg5g.js → roles-CL5RMNps.js} +1 -1
  152. package/dist/client/assets/save-referenced-block-JBVOc1Wy.js +1 -0
  153. package/dist/client/assets/{save-status-pJVz5vCQ.js → save-status-Dfy3Cw0L.js} +1 -1
  154. package/dist/client/assets/{schema-form-nZH-67HX.js → schema-form-BLq0KNxn.js} +1 -1
  155. package/dist/client/assets/{scroll-area-BqOijBAI.js → scroll-area-SRbC7c25.js} +1 -1
  156. package/dist/client/assets/{search-input-BgGthWir.js → search-input-JFEU6QlH.js} +1 -1
  157. package/dist/client/assets/secrets-DvkQvbwt.js +1 -0
  158. package/dist/client/assets/sections-editor-HXjdp6eB.js +2 -0
  159. package/dist/client/assets/{select-CNSUv3cw.js → select-CTk6Rsq0.js} +1 -1
  160. package/dist/client/assets/{select-model-0CGh6cKF.js → select-model-D2KMm6n2.js} +1 -1
  161. package/dist/client/assets/seo-editor-ifMY-Fw8.js +1 -0
  162. package/dist/client/assets/{settings-layout-DRYgevr6.js → settings-layout-BCPOwwNR.js} +1 -1
  163. package/dist/client/assets/{settings-section-V9kb8x32.js → settings-section-CcspUfab.js} +1 -1
  164. package/dist/client/assets/{sheet-D99KevZC.js → sheet-DokH5LKH.js} +1 -1
  165. package/dist/client/assets/{shell-controls-DSSWZ7Ia.js → shell-controls-rZZhpuW4.js} +1 -1
  166. package/dist/client/assets/{shell-layout-4LsIVsl3.js → shell-layout-DO1LZiwY.js} +1 -1
  167. package/dist/client/assets/shell-route-loading-DI9OtFHe.js +1 -0
  168. package/dist/client/assets/{sidebar-CPZXU-2w.js → sidebar-hk7mPADd.js} +1 -1
  169. package/dist/client/assets/{skeleton--DN75sg7.js → skeleton-CxMjy9Kg.js} +1 -1
  170. package/dist/client/assets/{sortable.esm-g7bq1nDZ.js → sortable.esm-BnSJaRIy.js} +1 -1
  171. package/dist/client/assets/{spinner-DJD6-9r-.js → spinner-Dstb6AhM.js} +1 -1
  172. package/dist/client/assets/sso-lfWsp7Wf.js +1 -0
  173. package/dist/client/assets/{store-DTK5DubB.js → store-CHpKgn9g.js} +1 -1
  174. package/dist/client/assets/store-registry-D9xAoVoW.js +2 -0
  175. package/dist/client/assets/studio-tools-I8Y7AvNq.js +1 -0
  176. package/dist/client/assets/{switch-D6SWnoi2.js → switch-Ds4XHhlB.js} +1 -1
  177. package/dist/client/assets/{tab-id-D4SJwEQy.js → tab-id-D_jK7L5o.js} +2 -2
  178. package/dist/client/assets/{table-Cx3PhNth.js → table-BvWfaT33.js} +1 -1
  179. package/dist/client/assets/{tabs-DCDCb9Pz.js → tabs-2_PrfGe1.js} +1 -1
  180. package/dist/client/assets/{task-status-P3BULAyA.js → task-status-CyBgq1B0.js} +1 -1
  181. package/dist/client/assets/{textarea-QEULyLXh.js → textarea-D7mZzw_Y.js} +1 -1
  182. package/dist/client/assets/{toggle-group-DhVqXGfs.js → toggle-group-CcV2qfqh.js} +1 -1
  183. package/dist/client/assets/{toolbar-BsB4Mvyv.js → toolbar-Vk0X9zFW.js} +1 -1
  184. package/dist/client/assets/{tools-list-Ch5RlbiL.js → tools-list-DZyHvyxj.js} +1 -1
  185. package/dist/client/assets/{tooltip-bsrBmmjV.js → tooltip-B2vnmSMM.js} +1 -1
  186. package/dist/client/assets/{types-jBdXInU0.js → types-DsBzghfJ.js} +1 -1
  187. package/dist/client/assets/use-ai-providers-BDbyWdvc.js +1 -0
  188. package/dist/client/assets/{use-automations-Db8x6SNU.js → use-automations-DjpksCFK.js} +1 -1
  189. package/dist/client/assets/{use-capability-BPM45mbW.js → use-capability-cYRWRLhr.js} +1 -1
  190. package/dist/client/assets/{use-collections-B5Jh_wGd.js → use-collections-DI2EpqEk.js} +1 -1
  191. package/dist/client/assets/{use-connection-DyJtuHQI.js → use-connection-Cam2HslE.js} +1 -1
  192. package/dist/client/assets/{use-copy-P6tx-uOp.js → use-copy-CyNGh3eK.js} +1 -1
  193. package/dist/client/assets/{use-create-virtual-mcp-CWYOy45e.js → use-create-virtual-mcp-TPoPQ6hG.js} +1 -1
  194. package/dist/client/assets/{use-debounced-autosave-ClLbciGl.js → use-debounced-autosave-b8Qk2OvK.js} +1 -1
  195. package/dist/client/assets/use-delete-connection-DXpw9Kqu.js +1 -0
  196. package/dist/client/assets/use-file-configs-J3tDrhRd.js +1 -0
  197. package/dist/client/assets/{use-infinite-scroll-xQQ6lYk4.js → use-infinite-scroll-CF4jvsDL.js} +1 -1
  198. package/dist/client/assets/{use-list-state-BZmeG7gi.js → use-list-state-C3OBf8IN.js} +1 -1
  199. package/dist/client/assets/{use-mcp-client-CWFUu1lY.js → use-mcp-client-Des-fSV9.js} +2 -2
  200. package/dist/client/assets/{use-mcp-prompts-B5RhBVzg.js → use-mcp-prompts-d7xtcVsP.js} +1 -1
  201. package/dist/client/assets/{use-mcp-tools-DePRGZE5.js → use-mcp-tools-DVBLMBo3.js} +1 -1
  202. package/dist/client/assets/{use-members-Cw70r_Wh.js → use-members-CTowYB9Z.js} +1 -1
  203. package/dist/client/assets/{use-navigate-to-agent-CdsMYUzL.js → use-navigate-to-agent-TzPRxzJx.js} +1 -1
  204. package/dist/client/assets/{use-org-auth-client--i_Sx92M.js → use-org-auth-client-uSzlmndB.js} +1 -1
  205. package/dist/client/assets/{use-org-sso-C1cJTBIx.js → use-org-sso-Bez1Sajf.js} +1 -1
  206. package/dist/client/assets/{use-organization-roles-ATKYiNpl.js → use-organization-roles-DfnjRa-5.js} +1 -1
  207. package/dist/client/assets/{use-organization-settings-Izqk1Gkk.js → use-organization-settings-B5dKExdR.js} +1 -1
  208. package/dist/client/assets/{use-registry-connections-C-WVKjSU.js → use-registry-connections-CWiPZtVM.js} +1 -1
  209. package/dist/client/assets/use-secrets-CrukgaJs.js +1 -0
  210. package/dist/client/assets/{use-status-sounds-BJ_LqdGJ.js → use-status-sounds-B1WepgCG.js} +1 -1
  211. package/dist/client/assets/{use-view-mode-CbT8E3wV.js → use-view-mode-q_aFx9Fj.js} +1 -1
  212. package/dist/client/assets/{use-virtual-mcp-0jbEmvOc.js → use-virtual-mcp-71PpEQrs.js} +1 -1
  213. package/dist/client/assets/useInfiniteQuery-Dl7i7ptk.js +1 -0
  214. package/dist/client/assets/{useRouterState-Dm0UHjU4.js → useRouterState-l6E4h2DF.js} +1 -1
  215. package/dist/client/assets/useSuspenseInfiniteQuery-CmT2FyND.js +1 -0
  216. package/dist/client/assets/user-ZvpM4E3a.js +1 -0
  217. package/dist/client/assets/{view-mode-toggle-G0qNMbJ1.js → view-mode-toggle-oQJDkJzK.js} +1 -1
  218. package/dist/client/assets/workflow-detail-Ba-EIKe1.js +1 -0
  219. package/dist/client/assets/workflow-i0CMnn6N.js +1 -0
  220. package/dist/client/index.html +2 -2
  221. package/dist/server/cli.js +439 -419
  222. package/dist/server/migrate.js +95 -95
  223. package/dist/server/server.js +287 -282
  224. package/package.json +1 -1
  225. package/dist/client/assets/add-section-modal-DbuGc2qc.js +0 -1
  226. package/dist/client/assets/agent-capabilities-BJLQSkAN.js +0 -3
  227. package/dist/client/assets/agent-icons-DRrDyR7j.js +0 -4
  228. package/dist/client/assets/ai-providers-GxPLAPId.js +0 -1
  229. package/dist/client/assets/app-editor-BsxVHV86.js +0 -1
  230. package/dist/client/assets/automation-runs-BJTRztep.js +0 -1
  231. package/dist/client/assets/brand-context-DTmvDRqf.js +0 -1
  232. package/dist/client/assets/buckets-Cv3AB_TT.js +0 -1
  233. package/dist/client/assets/chat-context-Bu6qpu9K.js +0 -20
  234. package/dist/client/assets/collection-detail-DHxXW6T4.js +0 -1
  235. package/dist/client/assets/connect-desktop-dialog-DPqrgnkS.js +0 -1
  236. package/dist/client/assets/connection-detail-58UbdFd3.js +0 -1
  237. package/dist/client/assets/connections-BMZIGugH.js +0 -1
  238. package/dist/client/assets/domain-settings-DHsRsnmX.js +0 -1
  239. package/dist/client/assets/dynamic-plugin-layout-DWE13BKk.js +0 -1
  240. package/dist/client/assets/file-explorer-Dmpsw-4-.js +0 -2
  241. package/dist/client/assets/general-CLesrOe8.js +0 -1
  242. package/dist/client/assets/header-tab-button-DSX6YPkf.js +0 -5
  243. package/dist/client/assets/image-field-D00iYa4G.js +0 -1
  244. package/dist/client/assets/index-BZvxagUr.js +0 -310
  245. package/dist/client/assets/index-CCs3Chg3.js +0 -1
  246. package/dist/client/assets/index-Db3P8pHg.js +0 -1
  247. package/dist/client/assets/members-BwcNzXwU.js +0 -3
  248. package/dist/client/assets/org-plugin-layout-DyCflrr1.js +0 -1
  249. package/dist/client/assets/page-seo-sheet-D9M3CoUb.js +0 -1
  250. package/dist/client/assets/pair-Ba1UoSSJ.js +0 -39
  251. package/dist/client/assets/plugin-layout-DrVKV-lp.js +0 -1
  252. package/dist/client/assets/project-app-view-C9azYjZP.js +0 -1
  253. package/dist/client/assets/record-editor-DJucp492.js +0 -1
  254. package/dist/client/assets/registry-hKns5OCc.js +0 -2
  255. package/dist/client/assets/registry-layout-DPaKDLDg.js +0 -27
  256. package/dist/client/assets/save-referenced-block-q2CPWVkl.js +0 -1
  257. package/dist/client/assets/secrets-YkTDT7yT.js +0 -1
  258. package/dist/client/assets/sections-editor-CSz4pxMw.js +0 -2
  259. package/dist/client/assets/seo-editor-CspZxazh.js +0 -1
  260. package/dist/client/assets/shell-route-loading-5KSwc3hj.js +0 -1
  261. package/dist/client/assets/sso-D04DjSnZ.js +0 -1
  262. package/dist/client/assets/store-registry-nABlp_7k.js +0 -2
  263. package/dist/client/assets/unwrap-tool-result-BYXdCQMg.js +0 -1
  264. package/dist/client/assets/use-ai-providers-v0sCRzMO.js +0 -1
  265. package/dist/client/assets/use-delete-connection-C60uGs0b.js +0 -1
  266. package/dist/client/assets/use-file-configs-CC8ghNUa.js +0 -1
  267. package/dist/client/assets/use-secrets-BpdIBEe6.js +0 -1
  268. package/dist/client/assets/useInfiniteQuery-BGg7INCQ.js +0 -1
  269. package/dist/client/assets/useSuspenseInfiniteQuery-B4dQiTEq.js +0 -1
  270. package/dist/client/assets/user-DRDdFgUw.js +0 -1
  271. package/dist/client/assets/workflow-D1PUPL3K.js +0 -1
  272. package/dist/client/assets/workflow-detail-CRUxUbKb.js +0 -1
@@ -1,20 +0,0 @@
1
- import{cp as De,e as ee,q as z,K as J,n as Ne,X as Le,$ as ke,G as Ce,o as ve,p as re,L as ie,f as Se,d as Me,g as Fe,r as p,j as ce,t as je,b as qe,a0 as Ke,aN as Ue}from"./index-biiHZ5l9.js";import{v as Ve,A as Ee,d as Be,x as Ge,y as He,B as Qe,u as We,o as Xe,w as ze}from"./tab-id-D4SJwEQy.js";import{S as Ae,u as _e,g as Ye}from"./use-mcp-client-CWFUu1lY.js";import{u as Ze}from"./unwrap-tool-result-BYXdCQMg.js";import{u as Je}from"./use-virtual-mcp-0jbEmvOc.js";import{u as et,b as de}from"./use-ai-providers-v0sCRzMO.js";import{e as tt}from"./use-organization-settings-Izqk1Gkk.js";const nt={anthropic:["claude-haiku-4-5","claude-haiku"],openrouter:["qwen/qwen3.5-flash","anthropic/claude-haiku-4.5","anthropic/claude-haiku","google/gemini-3-flash"],deco:["qwen/qwen3.5-flash","anthropic/claude-haiku"],google:["gemini-2.5-flash","gemini-3-flash"],"claude-code":["claude-code:haiku","claude-code:sonnet"],codex:["codex:gpt-5.4-mini"]},ot={anthropic:["claude-sonnet-4-6","claude-sonnet"],openrouter:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-opus-4.8","google/gemini-3-pro"],deco:["anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude"],google:["gemini-3-pro","gemini-3-flash"],"claude-code":["claude-code:sonnet"],codex:["codex:gpt-5.4"]},st={anthropic:["claude-opus-4-8","claude-sonnet-4-6","claude-sonnet","claude-fable-5"],openrouter:["anthropic/claude-opus-4.8","anthropic/claude-sonnet-4.6:extended","anthropic/claude-sonnet-4.6","google/gemini-3-pro","anthropic/claude-fable-5"],deco:["anthropic/claude-opus","anthropic/claude-sonnet-4.6","anthropic/claude-sonnet","anthropic/claude-fable"],google:["gemini-3-pro"],"claude-code":["claude-code:opus-1m","claude-code:opus","claude-code:sonnet"],codex:["codex:gpt-5.5"]},at={openrouter:["openai/gpt-image-1","google/gemini-2.0-flash-image"],deco:["openai/gpt-image-1","google/gemini-2.0-flash-image"],google:["gemini-2.0-flash-image"]},rt={openrouter:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"],deco:["perplexity/sonar","perplexity/sonar-pro","perplexity/deep-research"]};function oe(t,e,s,n){for(const o of s){const a=t.find(r=>r.modelId===o);if(a)return{keyId:e,modelId:a.modelId,title:a.title}}for(const o of s){const a=t.find(r=>r.modelId.includes(o));if(a)return{keyId:e,modelId:a.modelId,title:a.title}}if(n){const o=t.find(n);if(o)return{keyId:e,modelId:o.modelId,title:o.title}}return null}function it(t,e){const s={chat:{fast:null,smart:null,thinking:null},image:null,webResearch:null};for(const n of t){const o=e[n.id]??[],a=n.providerId;s.chat.fast||(s.chat.fast=oe(o,n.id,nt[a]??[])),s.chat.smart||(s.chat.smart=oe(o,n.id,ot[a]??[])),s.chat.thinking||(s.chat.thinking=oe(o,n.id,st[a]??[])),s.image||(s.image=oe(o,n.id,at[a]??[],r=>r.capabilities?.includes("image")===!0)),s.webResearch||(s.webResearch=oe(o,n.id,rt[a]??[],r=>{const i=r.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return i.includes("sonar")||i.includes("deepresearch")}))}return s}const he={decopilot:{harness:"decopilot",sandbox:"agent-sandbox"},"decopilot-desktop":{harness:"decopilot",sandbox:"user-desktop"},"claude-code-desktop":{harness:"claude-code",sandbox:"user-desktop"},"codex-desktop":{harness:"codex",sandbox:"user-desktop"}};function ct(t,e){if(!t)return null;const s=e?De(e):null;if(t==="decopilot"&&s===null)return"decopilot";for(const[n,o]of Object.entries(he))if(o.harness===t&&o.sandbox===s)return n;return null}function ye(t,e){switch(t){case"decopilot":return e.agentSandbox;case"decopilot-desktop":return e.userDesktop;case"claude-code-desktop":return e.userDesktop&&e.claudeCode;case"codex-desktop":return e.userDesktop&&e.codex}}const lt=["decopilot","decopilot-desktop","claude-code-desktop","codex-desktop"];function dt(t,e){return t==null?null:ye(t,e)?t:lt.find(s=>ye(s,e))??null}const Ie={online:!1,capabilities:[],ready:!1};function ut(){const t=ee.c(10),{org:e}=z();let s;t[0]!==e.id||t[1]!==e.slug?(s={connectionId:Ae,orgId:e.id,orgSlug:e.slug},t[0]=e.id,t[1]=e.slug,t[2]=s):s=t[2];const n=_e(s);let o;t[3]!==e.id?(o=J.currentLink(e.id),t[3]=e.id,t[4]=o):o=t[4];let a;t[5]!==n?(a=async()=>{const m=await n.callTool({name:"LINK_CURRENT_GET",arguments:{}}),k=Ze(m);return k?{...k,ready:!0}:{...Ie,ready:!0}},t[5]=n,t[6]=a):a=t[6];let r;t[7]!==o||t[8]!==a?(r={queryKey:o,queryFn:a,staleTime:1e4,refetchInterval:15e3,refetchOnWindowFocus:!0},t[7]=o,t[8]=a,t[9]=r):r=t[9];const{data:i}=Ne(r);return i??Ie}function pt(){const t=ee.c(11),e=ut(),s=Le();let n;t[0]!==e.capabilities||t[1]!==e.online?(n=e.online&&e.capabilities.includes("claude-code"),t[0]=e.capabilities,t[1]=e.online,t[2]=n):n=t[2];let o;t[3]!==e.capabilities||t[4]!==e.online?(o=e.online&&e.capabilities.includes("codex"),t[3]=e.capabilities,t[4]=e.online,t[5]=o):o=t[5];let a;return t[6]!==e.online||t[7]!==s.runtime.agentSandbox||t[8]!==n||t[9]!==o?(a={agentSandbox:s.runtime.agentSandbox,userDesktop:e.online,claudeCode:n,codex:o},t[6]=e.online,t[7]=s.runtime.agentSandbox,t[8]=n,t[9]=o,t[10]=a):a=t[10],a}function ft(t){return t.thread?.harness_id!=null?{}:{harnessId:t.globals.harnessId,sandboxProviderKind:t.globals.sandboxProviderKind,branch:t.globals.branch??null}}function ht(t){const e=ee.c(10);let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},e[0]=s):s=e[0];const n=ke(s);let o;if(e[1]!==n?.params.appSlug||e[2]!==n?.params.collectionName||e[3]!==n?.params.itemId||e[4]!==t){o=[],t&&o.push(`### Selected Agent
2
- - ID: ${t}`);let a;e[6]!==n?.params.appSlug||e[7]!==n?.params.collectionName||e[8]!==n?.params.itemId?(a=[],n?.params.appSlug&&a.push(`- Connection ID: ${n?.params.appSlug}`),n?.params.collectionName&&a.push(`- Collection: ${n?.params.collectionName}`),n?.params.itemId&&a.push(`- Item ID: ${n?.params.itemId}`),e[6]=n?.params.appSlug,e[7]=n?.params.collectionName,e[8]=n?.params.itemId,e[9]=a):a=e[9],a.length>0&&o.push(`### Current Resource
3
- The user is viewing the following resource:
4
- ${a.join(`
5
- `)}
6
-
7
- Help the user understand and work with this resource.`),e[1]=n?.params.appSlug,e[2]=n?.params.collectionName,e[3]=n?.params.itemId,e[4]=t,e[5]=o}else o=e[5];return o.join(`
8
-
9
- `)}function mt(){const t=ee.c(5),e=Ce(),{org:s}=z();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId",shouldThrow:!1},t[0]=n):n=t[0];const o=ke(n);let a;return t[1]!==o?.params||t[2]!==s||t[3]!==e?(a=r=>{const m=r.toolCall.toolName.match(/^COLLECTION_([A-Z_]+)_(CREATE|UPDATE|DELETE)$/);if(!m||!m[1])return;const k=m[1],g=o?.params.appSlug;if(!g)return;e.invalidateQueries({queryKey:J.collection(s.slug,g,k)});const f=k.toLowerCase().replace(/_/g," ");ve.success(`${f} updated`)},t[1]=o?.params,t[2]=s,t[3]=e,t[4]=a):a=t[4],a}function gt(){const t=ee.c(4),{org:e,project:s}=z(),n=`${e.id}/${s.id}`;let o;t[0]!==n?(o=ie.taskLastViewed(n),t[0]=n,t[1]=o):o=t[1];const[,a]=re(o,xt);let r;return t[2]!==a?(r={markTaskRead:m=>{a(k=>({...k,[m]:new Date().toISOString()}))}},t[2]=a,t[3]=r):r=t[3],r}function xt(t){return t??{}}function we(){const t=Se(),{org:e}=z(),s=Me({strict:!1}),n=Fe({strict:!1}),o=s.virtualmcpid??Ye(e.id).id,a=(m,k)=>{t({to:"/$org/$taskId",params:{org:e.slug,taskId:m},search:g=>{const f={},$=k?.virtualMcpId??g.virtualmcpid;$&&(f.virtualmcpid=$);const x=g.main;return x&&typeof x=="string"&&!Ve(x)&&(f.main=x),g.chat&&(f.chat=g.chat),k?.autosend&&(f.autosend=Ee),f}})},r=p.useRef(crypto.randomUUID()),i=n.taskId??r.current;return{virtualMcpId:o,taskId:i,navigateToTask:a}}function yt(t,e){const{mimeType:s,data:n}=t;if(s.startsWith("text/"))try{const o=new TextDecoder().decode(Uint8Array.from(atob(n),a=>a.charCodeAt(0)));return[{type:"text",text:`${e}
10
- ${o}`}]}catch(o){console.error("Failed to decode text file:",o)}return[{type:"file",url:`data:${s};base64,${n}`,filename:e,mediaType:s}]}function be(t,e){const s=[];for(const n of t)"text"in n&&n.text?s.push({type:"text",text:`[${e}]
11
- ${n.text}`}):"blob"in n&&n.blob&&n.mimeType&&s.push({type:"file",url:`data:${n.mimeType};base64,${n.blob}`,filename:String(n.uri),mediaType:String(n.mimeType)});return s}function It(t,e){const s=[];for(const n of t){if(n.role!=="user"||!n.content)continue;const o=Array.isArray(n.content)?n.content:[n.content];for(const a of o)switch(a.type){case"text":{const r=a.text?.trim();if(!r)continue;s.push({type:"text",text:`[${e}]
12
- ${r}`});break}case"image":case"audio":{if(!a.data||!a.mimeType)continue;s.push({type:"file",url:`data:${a.mimeType};base64,${a.data}`,mediaType:a.mimeType});break}case"resource":{const r=a.resource;if(!r||!r.mimeType)continue;r&&("text"in r&&r.text?s.push({type:"text",text:`[${e}]
13
- ${r.text}`}):"blob"in r&&r.blob&&r.mimeType&&s.push({type:"file",url:`data:${r.mimeType};base64,${r.blob}`,filename:String(r.uri),mediaType:String(r.mimeType)}));break}}}return s}function Pe(t){if(!t)return[];const e=[];let s="";const n=o=>{if(o){if(o.type==="text"&&"text"in o&&typeof o.text=="string")s+=o.text;else if(o.type==="mention"&&o.attrs){const a=o.attrs.char??"/",r=`${a}${o.attrs.name}`;if(s+=r,a==="@"){const i=o.attrs.metadata;i&&!Array.isArray(i)&&"agentId"in i?e.push({type:"text",text:`[DELEGATE TO AGENT: ${i.title??o.attrs.name} (agent_id: ${i.agentId})]
14
- Use the subtask tool to delegate this task to the agent above. Include the full relevant context from this conversation in the prompt field — the subagent has no conversation history.`}):Array.isArray(i)&&e.push(...be(i,r))}else{const i=o.attrs.metadata||o.attrs.prompts||[];Array.isArray(i)&&i.length>0&&"role"in i[0]?e.push(...It(i,r)):Array.isArray(i)&&e.push(...be(i,r))}}else if(o.type==="file"&&o.attrs){const a=o.attrs,r=`[file:://${encodeURIComponent(a.name)}]`;s+=r,e.push(...yt(a,r))}if("content"in o&&Array.isArray(o.content))for(const a of o.content)n(a)}};return n(t),s.trim()&&e.unshift({type:"text",text:s.trim()}),e}function Nt(t){const e=Pe(t);return e.length===0?[]:[{id:crypto.randomUUID(),role:"user",parts:e,metadata:{tiptapDoc:t}}]}const Te=new Set;function se(t){return p.useSyncExternalStore(t.subscribe,t.get,t.get)}function bt(t){return t.kind==="loading"?"ready":t.kind}function ae(t,e,s,n){if(!t)return null;const o=e.find(r=>r.id===t.keyId);if(!o)return null;const a=s.find(r=>r.modelId===t.modelId);return a?{...a,keyId:t.keyId}:{modelId:t.modelId,title:n??t.modelId,keyId:t.keyId,providerId:o.providerId,description:null,logo:null,capabilities:[],limits:null,costs:null}}function Tt(t){return t==="fast"||t==="smart"||t==="thinking"?t:"smart"}function kt(t,e,s,n){if(!s||n.length===0)return null;const o=e.find(m=>m.id===s);if(!o)return null;const a=it([o],{[s]:n}),r=t==="fast"?a.chat.fast:t==="thinking"?a.chat.thinking:a.chat.smart;if(!r)return null;const i=n.find(m=>m.modelId===r.modelId);return i?{...i,keyId:s}:null}const Ct=1e4,vt=10,me=p.createContext(null),ge=p.createContext(null),xe=p.createContext(null),Re=p.createContext(null);function St({children:t}){const{locator:e}=z(),{virtualMcpId:s}=we(),[n,o]=re(ie.chatSelectedImageModel(e),null),[a,r]=re(ie.chatSelectedDeepResearchModel(e),null),[i,m]=p.useState(null),[k,g]=p.useState("default"),f=tt(),[$,x]=re(ie.chatSimpleModeTier(e),null),C=Tt($),b=et(),O=f.tiers[C],D=i&&b.some(c=>c.id===i)?i:O?.keyId??b[0]?.id??null,{models:y,isLoading:T}=de(D??void 0),{models:N}=de(O?.keyId),{models:B}=de(f.tiers.image?.keyId),{models:L}=de(f.tiers.web_research?.keyId),K=ae(O,b,N,O?.title)??kt(C,b,D,y),v=T,F=y.filter(c=>c.capabilities?.includes("image")),U=ae(n,b,F),V=ae(f.tiers.image,b,B,f.tiers.image?.title)??U??F[0]??null,u=y.filter(c=>{const _=c.modelId.toLowerCase().replace(/[^a-z0-9]/g,"");return _.includes("sonar")||_.includes("deepresearch")}),S=ae(a,b,u),R=u.find(c=>c.modelId==="perplexity/sonar")??u[0]??null,G=ae(f.tiers.web_research,b,L,f.tiers.web_research?.title)??S??R,Q=Je(s)??{id:s,title:"",description:null,icon:null},[M,j]=p.useState({}),I=(c,_)=>{const ne=[];for(const q of _.content??[])q.type==="text"&&q.text?.trim()&&ne.push(q.text.trim());const P=ne.join(`
15
- `);if(!P){w(c);return}new TextEncoder().encode(P).length>Ct||j(q=>Object.keys(q).length>=vt&&!(c in q)?q:{...q,[c]:P})},w=c=>{j(_=>{const{[c]:ne,...P}=_;return P})},[Y,W]=re(ie.chatLastAgentOption(e),c=>c&&c in he?c:null),X=At(),Z=X?.isThreadLocked&&X.lockedHarness!=null?ct(X.lockedHarness,X.lockedSandbox):null,ue=pt(),pe=dt(Y,ue),le=X?.isThreadLocked?Z:pe,te=le?he[le]:null,fe=te?.harness??null,l=te?.sandbox??null,[d,h]=p.useState(void 0),E=p.useRef(d);E.current=d;const A={selectedModel:K,setModel:()=>{},credentialId:D,setCredentialId:m,allModelsConnections:b,isModelsLoading:v,selectedVirtualMcp:Q,imageModel:V,setImageModel:c=>{o(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},deepResearchModel:G,setDeepResearchModel:c=>{r(c?.keyId?{keyId:c.keyId,modelId:c.modelId}:null)},chatMode:k,setChatMode:g,appContexts:M,setAppContext:I,clearAppContext:w,tiptapDoc:d,setTiptapDoc:h,tiptapDocRef:E,resetInteraction:()=>{},simpleModeTier:C,setSimpleModeTier:c=>x(c),pendingAgentOption:le,setPendingAgentOption:W,pendingHarnessId:fe,pendingSandboxProviderKind:l};return ce.jsx(xe.Provider,{value:A,children:t})}function Lt(t){const e=ee.c(41),{virtualMcpId:s,task:n,children:o}=t,{locator:a}=z(),{data:r}=qe.useSession(),i=r?.user??null,{taskId:m,virtualMcpId:k,navigateToTask:g}=we(),[f]=Ke(),{markTaskRead:$}=gt(),x=We(),C=m,b=k,O=ht(b);let D;e[0]!==$||e[1]!==g?(D=(I,w)=>{$(I),g(I,{virtualMcpId:w?.virtualMcpId,autosend:w?.autosend})},e[0]=$,e[1]=g,e[2]=D):D=e[2];const y=D,T=C&&n?.id===C?n:null,N=T?.harness_id??null,B=T?.sandbox_provider_kind??null,L=T?.branch??null,K=N!=null,v=L;let F;e[3]!==v||e[4]!==y||e[5]!==x||e[6]!==s?(F=()=>{const I=crypto.randomUUID();return x.create({id:I,virtual_mcp_id:s,...v?{branch:v}:{}}).then(()=>y(I)).catch(()=>{y(I)}),I},e[3]=v,e[4]=y,e[5]=x,e[6]=s,e[7]=F):F=e[7];const U=F;let V;e[8]!==v||e[9]!==a||e[10]!==y||e[11]!==x||e[12]!==s?(V=I=>{const w=crypto.randomUUID(),Y=I.virtualMcpId??s,W=Y===s?v:null;ze(sessionStorage,a,w,I.message),x.create({id:w,virtual_mcp_id:Y,...W?{branch:W}:{}}).then(()=>y(w,{virtualMcpId:I.virtualMcpId,autosend:!0})).catch(()=>{y(w,{virtualMcpId:I.virtualMcpId,autosend:!0})})},e[8]=v,e[9]=a,e[10]=y,e[11]=x,e[12]=s,e[13]=V):V=e[13];const u=V;let S;e[14]!==C||e[15]!==x?(S=I=>{C&&x.setBranch(C,I)},e[14]=C,e[15]=x,e[16]=S):S=e[16];let R;e[17]!==T||e[18]!==U||e[19]!==u||e[20]!==v||e[21]!==C||e[22]!==b||e[23]!==K||e[24]!==L||e[25]!==N||e[26]!==B||e[27]!==y||e[28]!==S?(R={virtualMcpId:b,taskId:C,openTask:y,createTask:U,createTaskWithMessage:u,activeTask:T,isThreadLocked:K,lockedHarness:N,lockedSandbox:B,lockedBranch:L,currentBranch:v,setCurrentTaskBranch:S},e[17]=T,e[18]=U,e[19]=u,e[20]=v,e[21]=C,e[22]=b,e[23]=K,e[24]=L,e[25]=N,e[26]=B,e[27]=y,e[28]=S,e[29]=R):R=e[29];const G=R;let H;e[30]!==O||e[31]!==f||e[32]!==g||e[33]!==i?(H={user:i,contextPrompt:O,preferences:f,rawNavigateToTask:g},e[30]=O,e[31]=f,e[32]=g,e[33]=i,e[34]=H):H=e[34];const Q=H;let M;e[35]!==o||e[36]!==Q?(M=ce.jsx(St,{children:ce.jsx(Re.Provider,{value:Q,children:o})}),e[35]=o,e[36]=Q,e[37]=M):M=e[37];let j;return e[38]!==M||e[39]!==G?(j=ce.jsx(ge.Provider,{value:G,children:M}),e[38]=M,e[39]=G,e[40]=j):j=e[40],j}function Ft({taskId:t,children:e}){const{virtualMcpId:s,activeTask:n,currentBranch:o}=Mt();t&&!Te.has(t)&&(Te.add(t),je("chat_opened",{thread_id:t}));const{imageModel:a,deepResearchModel:r,chatMode:i,setChatMode:m,appContexts:k,setTiptapDoc:g,simpleModeTier:f,pendingSandboxProviderKind:$,pendingHarnessId:x}=Et(),C=p.useContext(Re);if(!C)throw new Error("ActiveTaskProvider must be used within ChatContextProvider");const{user:b,contextPrompt:O,preferences:D,rawNavigateToTask:y}=C,{org:T,locator:N}=z(),[B,L]=p.useState(null),K=mt(),v=Ce(),F=Be(),U=Se(),V=_e({connectionId:Ae,orgId:T.id,orgSlug:T.slug}),u=Ge(T.slug,t,{client:V});p.use(u.ready);const S=se(u.messages),R=se(u.status),G=se(u.finishReason),H=se(u.hasMoreOlder),Q=se(u.isFetchingOlder),M=p.useRef({onToolCall:K,queryClient:v,rawNavigateToTask:y,taskId:t,manager:F,navigate:U,orgId:T.id,orgSlug:T.slug});M.current={onToolCall:K,queryClient:v,rawNavigateToTask:y,taskId:t,manager:F,navigate:U,orgId:T.id,orgSlug:T.slug},p.useEffect(()=>{const l={onData:d=>{if(d.type==="data-thread-title"){const h=d.data;if(!h?.title)return;const E=M.current;if(!E.taskId)return;E.manager.patchThread({id:E.taskId,title:h.title,updated_at:new Date().toISOString()});return}if(d.type==="data-html-page-published"){const h=d.data;if(!h?.slug)return;const E=h.slug;M.current.navigate({to:".",search:A=>({...A,main:`web-page:${E}`}),replace:!0});return}if(d.type==="data-deck-updated"){const h=d.data;if(!h?.path)return;const E=h.path,A=M.current;A.queryClient.invalidateQueries({queryKey:J.orgFsStat(A.orgId,"home",E)}),A.queryClient.invalidateQueries({queryKey:J.orgFsRecent(A.orgId)}),A.navigate({to:".",search:c=>({...c,main:Xe(E)}),replace:!0});return}},onFinish:d=>{const h=M.current,E=d.parts?.some(c=>{const _=c;return(_.type==="tool-share_with_user"||_.type==="tool-bash"||_.type==="tool-write")&&_.state==="output-available"});if(h.taskId&&E){const c=J.threadOutputs(h.taskId);for(const _ of[0,1500,3e3,6e3,12e3,25e3])setTimeout(()=>{h.queryClient.invalidateQueries({queryKey:c})},_)}h.queryClient.invalidateQueries({queryKey:J.homeNextActions(h.orgSlug)});const A=d.metadata?.thread_id;A&&A!==h.taskId&&h.rawNavigateToTask(A)},onError:d=>{L(d),console.error("[chat] Error",d)},onToolCall:d=>M.current.onToolCall(d)};return u.observer=l,()=>{u.observer===l&&(u.observer=null)}},[u]);const j=R.kind==="submitted"||R.kind==="streaming",I=S.length===0,w=S.at(-1),Y=!j&&w?.role==="assistant"&&w.parts.some(l=>"state"in l&&l.state==="approval-requested"),W=n,X=(W?.status==="in_progress"||W?.status==="expired")&&R.kind==="ready"&&S.length>0;async function Z(l){const d=l.parts??Pe(l.tiptapDoc);if(d.length===0)return;const h=t,E=s;L(null),g(void 0);const A={tiptapDoc:l.tiptapDoc,created_at:new Date().toISOString(),user:{avatar:b?.image??void 0,name:b?.name??"you"}},c=Object.entries(k),_=c.length>0?c.map(([$e,Oe])=>`### App Context: ${$e}
16
- ${Oe}`).join(`
17
-
18
- `):"",ne=[O,_].filter(Boolean).join(`
19
-
20
- `);let P=i;P==="gen-image"&&!a&&(P="default"),P==="web-search"&&!r&&(P="default"),P==="web-search"&&m("default");const q={id:crypto.randomUUID(),role:"user",parts:d,metadata:A};await u.submit({kind:"message",message:q},{tier:f,mode:P,toolApprovalLevel:D.toolApprovalLevel??Ue(),system:ne||void 0,agent:{id:E},thread_id:h,...ft({thread:n?{harness_id:n.harness_id??null,sandbox_provider_kind:n.sandbox_provider_kind??null,branch:n.branch??null}:null,globals:{harnessId:x??void 0,sandboxProviderKind:$??void 0,branch:o}})})}const ue=async()=>{u.stop();try{const l=await fetch(`/api/${T.slug}/decopilot/cancel/${t}`,{method:"POST",credentials:"include"});if(l.status===404)return;if(!l.ok){const d=await l.json().catch(()=>({}));throw new Error(d.message??`Cancel failed: ${l.status}`)}}catch(l){const d=l instanceof Error?l.message:"Failed to cancel";ve.error(d),console.error("[chat] cancelRun",l)}},pe=l=>l&&typeof l=="object"&&"type"in l?Z({tiptapDoc:l}):Z(l),te=Me({strict:!1}).autosend===Ee;p.useEffect(()=>{if(!te||S.length>0)return;const l=He(sessionStorage,N,t);l&&Z(l.message).then(()=>{Qe(sessionStorage,N,t)})},[te,S.length,N,t,Z]);const fe={messages:S,status:bt(R),sendMessage:pe,stop:()=>{ue()},submit:(l,d)=>u.submit(l,d),error:B,clearError:()=>L(null),finishReason:G,clearFinishReason:()=>u.finishReason.set(null),isStreaming:j,isChatEmpty:I,isWaitingForApprovals:Y??!1,isRunInProgress:X,hasMoreOlder:H,isFetchingOlder:Q,fetchOlderMessages:u.fetchOlderMessages.bind(u)};return ce.jsx(me.Provider,{value:fe,children:e})}function jt(){const t=p.useContext(me);if(!t)throw new Error("useChatStream must be used within ActiveTaskProvider");return t}function qt(){return p.useContext(me)}function Mt(){const t=p.useContext(ge);if(!t)throw new Error("useChatTask must be used within ChatContextProvider");return t}function Et(){const t=p.useContext(xe);if(!t)throw new Error("useChatPrefs must be used within ChatContextProvider");return t}function Kt(){return p.useContext(xe)}function At(){return p.useContext(ge)}export{Ft as A,St as C,jt as a,Mt as b,Et as c,At as d,Pe as e,qt as f,pt as g,Lt as h,Kt as i,it as p,Nt as t,ut as u};
@@ -1 +0,0 @@
1
- import{T as Ke,W as te,e as C,j as t,E as Te,r as w,q as ie,H as Qe,c as J,bn as Ge,l as le,d as Ye,P as Q,B as W,o as Xe,g as ae,bo as ke}from"./index-biiHZ5l9.js";import{E as Pe}from"./empty-state-1AbmTLd7.js";import{u as Ze,a as Ee}from"./use-collections-B5Jh_wGd.js";import{u as ce}from"./use-mcp-client-CWFUu1lY.js";import{F as se,a as et,b as de,d as me}from"./form-BcPtow5O.js";import{I as ue}from"./input-5PMMNPU9.js";import{T as re}from"./textarea-QEULyLXh.js";import{a as tt,b as st,V as pe}from"./layout-CbTbCjmA.js";import{S as ot,W as nt,a as rt}from"./index-D6ELOmUq.js";import{g as it,M as lt,a as je}from"./types-jBdXInU0.js";import{A as at,a as ct,b as dt}from"./alert-DyB_hFGI.js";import{d as be,S as Ne,a as ve,b as Se,c as oe}from"./select-CNSUv3cw.js";import{c as mt,b as ye,T as we,a as Ce}from"./tooltip-bsrBmmjV.js";import{i as ut}from"./AlertCircle-9EFUZenf.js";import{S as pt,Q as xt,a6 as ft,N as ht,a7 as gt,F as Ie}from"./agent-icon-DT8dQ9tq.js";import{a as jt}from"./Eye-ByuwKsdh.js";import{i as bt}from"./Play-CMJ2IWYR.js";import{i as Nt}from"./ChevronRight-CrZy8tHx.js";import{O as vt,M as St}from"./index-CHdFXpqc.js";import{g as yt}from"./connection-slug-eyAPH6o3.js";import{u as wt,T as Ct}from"./tools-list-Ch5RlbiL.js";import{a as _e,u as Ae}from"./use-connection-DyJtuHQI.js";import{b as It}from"./use-mcp-tools-DePRGZE5.js";import{c as $t}from"./content-blocks-o63cs2vh.js";import{I as $e}from"./integration-icon-Dy-a3x5R.js";import{f as Tt,i as kt}from"./chat-context-Bu6qpu9K.js";import{u as Pt}from"./shell-layout-4LsIVsl3.js";import{M as Et}from"./monaco-editor-CJVi8Ty8.js";import{E as _t}from"./empty-state-BfmCVPeb.js";import{n as At}from"./Container-CYcITvPW.js";import"./label-CcC4_aKf.js";import"./index-r7-3fAFf.js";import"./sidebar-CPZXU-2w.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./sheet-D99KevZC.js";import"./X-1KR4wibP.js";import"./index-YdX5UjUB.js";import"./collections-C_j8CeI8.js";import"./index-50-dmJFK.js";import"./use-virtual-mcp-0jbEmvOc.js";import"./resizable-BbbLszRZ.js";import"./ZoomOut-D8vQ49we.js";import"./badge-Da0IsrqH.js";import"./spinner-DJD6-9r-.js";import"./view-mode-toggle-G0qNMbJ1.js";import"./dialog-Bm1pP7Vu.js";import"./scroll-area-BqOijBAI.js";import"./index-Bo5bzoUm.js";import"./hover-card-DE2_8MLP.js";import"./dropdown-menu-CIu58K9q.js";import"./Check-D-9dblUn.js";import"./DotsVertical-SvwN4CeV.js";import"./Plus-CjrtKB-Y.js";import"./Tool01-Dcq7KP8Y.js";import"./XClose-pR-QU0OQ.js";import"./accordion-aX0NKKKh.js";import"./index-B1bHiM-j.js";import"./create-sse-subscription-BS5983N4.js";import"./ChevronDown-Cf2Q-GlB.js";import"./ChevronUp-BAxoXhnT.js";import"./SwitchHorizontal01-BMnNI1Fi.js";import"./RefreshCcw01-3BsQQkRx.js";import"./XCircle-UPVnJx4i.js";import"./ArrowUpRight-97355q5v.js";import"./ZapSquare-B1o2Q9OR.js";import"./Users03-BlNe2PnN.js";import"./CheckCircle-C2ualSpf.js";import"./ChevronLeft-BaV4nFMQ.js";import"./Globe01-DfGFlik1.js";import"./FilterLines-BJZdiggU.js";import"./Star01-eRdSY4QW.js";import"./Palette-Druykvzw.js";import"./HardDrive-DNFvbooP.js";import"./Stars02-EuAFDZ5E.js";import"./Key01-CzmPnHuw.js";import"./LinkExternal01-CgI1VTqi.js";import"./Monitor01-Cw6kmClm.js";import"./Sun-CH2HWLCn.js";import"./SearchMd-BL2y99rx.js";import"./Settings02-Cd4DIqaJ.js";import"./Shield01-zIbMct6w.js";import"./Stars01-v0yz6PCZ.js";import"./Trash01-Cup7-ZTT.js";import"./Upload01-C9yi1Bdg.js";import"./User01-thAIxsAs.js";import"./Users01-DPJm6-u-.js";import"./Zap-Cl-JM7N9.js";import"./extract-connection-data-LoMqboL3.js";import"./generate-id-CadHbHqX.js";import"./use-registry-connections-C-WVKjSU.js";import"./use-organization-settings-Izqk1Gkk.js";import"./index-CR_LeyNj.js";import"./popover-Cvcd3A1d.js";import"./use-create-virtual-mcp-CWYOy45e.js";import"./use-navigate-to-agent-CdsMYUzL.js";import"./tab-id-D4SJwEQy.js";import"./decopilot-sse-pool-BUhEcft-.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-ai-providers-v0sCRzMO.js";import"./avatar-BHEXMwdE.js";import"./required-auth-layout-zYH6NIDF.js";import"./useRouterState-Dm0UHjU4.js";import"./use-org-sso-C1cJTBIx.js";import"./index-BflNEs6l.js";Ke({title:te().min(1),description:te().nullable(),body:te()});function ne(s){for(const e of s.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Ot(){const s=window.location.pathname.split("/").filter(Boolean),e=s.findIndex(o=>o==="mcps"),n=e>=0?s[e+1]:void 0;return n?decodeURIComponent(n):void 0}function Rt(s){const e=C.c(13),{form:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=o):o=e[0];let r;e[1]!==n.control?(r=t.jsxs("div",{className:"flex flex-col gap-4",children:[o,t.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[t.jsx(se,{control:n.control,name:"title",render:Ut}),t.jsx(se,{control:n.control,name:"description",render:Mt})]})]}),e[1]=n.control,e[2]=r):r=e[2];let i,a;e[3]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),a=t.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=i,e[4]=a):(i=e[3],a=e[4]);let c;e[5]!==n.control?(c=t.jsxs("div",{className:"flex flex-col gap-2",children:[i,a,t.jsx(se,{control:n.control,name:"body",render:Dt})]}),e[5]=n.control,e[6]=c):c=e[6];let l;e[7]!==r||e[8]!==c?(l=t.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[r,c]}),e[7]=r,e[8]=c,e[9]=l):l=e[9];let p;return e[10]!==n||e[11]!==l?(p=t.jsx(et,{...n,children:l}),e[10]=n,e[11]=l,e[12]=p):p=e[12],p}function Dt(s){const{field:e}=s;return t.jsx(de,{children:t.jsx(me,{children:t.jsx(re,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function Mt(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),t.jsx(me,{children:t.jsx(ue,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Ut(s){const{field:e}=s;return t.jsxs(de,{children:[t.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),t.jsx(me,{children:t.jsx(ue,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function zt(s){const e=C.c(36),{providerId:n,promptId:o}=s,{org:r}=ie(),i=n||null;let a;e[0]!==r.id||e[1]!==r.slug||e[2]!==i?(a={connectionId:i,orgId:r.id,orgSlug:r.slug},e[0]=r.id,e[1]=r.slug,e[2]=i,e[3]=a):a=e[3];const c=ce(a),l=Ze(n,"PROMPT",o,c),p=Ee(n,"PROMPT",c),f=p.update.isPending;let u;e[4]!==l?(u=l?{title:l.title,description:l.description??null,body:ne(l)}:void 0,e[4]=l,e[5]=u):u=e[5];let h;e[6]!==u?(h={values:u},e[6]=u,e[7]=h):h=e[7];const N=Qe(h);let T;e[8]!==N||e[9]!==l?(T=()=>{l&&N.reset({title:l.title,description:l.description??null,body:ne(l)})},e[8]=N,e[9]=l,e[10]=T):T=e[10];const _=T;let A;e[11]!==p.update||e[12]!==N||e[13]!==o?(A=N.handleSubmit(async j=>{const P=await p.update.mutateAsync({id:o,data:{title:j.title,description:j.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:j.body}}]}});N.reset({title:P.title,description:P.description??null,body:ne(P)})}),e[11]=p.update,e[12]=N,e[13]=o,e[14]=A):A=e[14];const O=A;if(!l){let j;return e[15]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pe,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[15]=j):j=e[15],j}let y;e[16]!==l.title?(y=t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:l.title}),e[16]=l.title,e[17]=y):y=e[17];let k;e[18]!==l.description?(k=l.description?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),t.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:l.description})]}):null,e[18]=l.description,e[19]=k):k=e[19];let I;e[20]!==y||e[21]!==k?(I=t.jsx(st,{children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,k]})}),e[20]=y,e[21]=k,e[22]=I):I=e[22];let g;e[23]!==O?(g=()=>{O()},e[23]=O,e[24]=g):g=e[24];let v;e[25]!==N.formState.isDirty||e[26]!==f||e[27]!==_||e[28]!==g?(v=t.jsx(tt,{children:t.jsx(ot,{onSave:g,onUndo:_,isDirty:N.formState.isDirty,isSaving:f})}),e[25]=N.formState.isDirty,e[26]=f,e[27]=_,e[28]=g,e[29]=v):v=e[29];let S;e[30]!==N?(S=t.jsx("div",{className:"h-full",children:t.jsx(Rt,{form:N})}),e[30]=N,e[31]=S):S=e[31];let $;return e[32]!==v||e[33]!==S||e[34]!==I?($=t.jsxs(pe,{children:[I,v,S]}),e[32]=v,e[33]=S,e[34]=I,e[35]=$):$=e[35],$}function Bt(s){const e=C.c(4),{itemId:n}=s;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=Ot(),e[0]=o):o=e[0];const r=o;if(!r){let a;return e[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(Pe,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=a):a=e[1],a}let i;return e[2]!==n?(i=t.jsx(Te,{children:t.jsx(w.Suspense,{fallback:null,children:t.jsx(zt,{providerId:r,promptId:n})})}),e[2]=n,e[3]=i):i=e[3],i}function Oe(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("min-w-0 overflow-hidden",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Re(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("flex items-center gap-1.5 text-sm sm:gap-2 overflow-hidden",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("ol",{"data-slot":"breadcrumb-list",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function V(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("inline-flex items-center gap-1.5 min-w-0",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("li",{"data-slot":"breadcrumb-item",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function G(s){const e=C.c(10);let n,o,r;e[0]!==s?({asChild:n,className:o,...r}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=r):(n=e[1],o=e[2],r=e[3]);const i=n?Ge:"a";let a;e[4]!==o?(a=J("hover:text-foreground transition-colors truncate",o),e[4]=o,e[5]=a):a=e[5];let c;return e[6]!==i||e[7]!==r||e[8]!==a?(c=t.jsx(i,{"data-slot":"breadcrumb-link",className:a,...r}),e[6]=i,e[7]=r,e[8]=a,e[9]=c):c=e[9],c}function De(s){const e=C.c(8);let n,o;e[0]!==s?({className:n,...o}=s,e[0]=s,e[1]=n,e[2]=o):(n=e[1],o=e[2]);let r;e[3]!==n?(r=J("text-foreground font-medium truncate",n),e[3]=n,e[4]=r):r=e[4];let i;return e[5]!==o||e[6]!==r?(i=t.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:r,...o}),e[5]=o,e[6]=r,e[7]=i):i=e[7],i}function Y(s){const e=C.c(12);let n,o,r;e[0]!==s?({children:n,className:o,...r}=s,e[0]=s,e[1]=n,e[2]=o,e[3]=r):(n=e[1],o=e[2],r=e[3]);let i;e[4]!==o?(i=J("[&>svg]:size-3.5 text-muted-foreground opacity-50 list-none shrink-0",o),e[4]=o,e[5]=i):i=e[5];let a;e[6]!==n?(a=n??t.jsx(Nt,{}),e[6]=n,e[7]=a):a=e[7];let c;return e[8]!==r||e[9]!==i||e[10]!==a?(c=t.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:i,...r,children:a}),e[8]=r,e[9]=i,e[10]=a,e[11]=c):c=e[11],c}const Ft=s=>s.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function Lt(s){const e=C.c(11),{toolName:n,connectionId:o,siblings:r,onSelectInstance:i,onBack:a}=s;let c;e[0]!==o?(c={connectionId:o},e[0]=o,e[1]=c):c=e[1];const l=wt(c);if(!l.isAuthenticated){let u;return e[2]!==l.supportsOAuth||e[3]!==a?(u=t.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?t.jsx(vt,{onAuthenticate:()=>a(),buttonText:"Go back to authenticate"}):t.jsx(St,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=a,e[4]=u):u=e[4],u}const p=`${o}:${n}`;let f;return e[5]!==o||e[6]!==i||e[7]!==r||e[8]!==p||e[9]!==n?(f=t.jsx(Vt,{toolName:n,connectionId:o,siblings:r,onSelectInstance:i},p),e[5]=o,e[6]=i,e[7]=r,e[8]=p,e[9]=n,e[10]=f):f=e[10],f}function Vt({toolName:s,connectionId:e,siblings:n,onSelectInstance:o}){const{replayId:r}=Ye({strict:!1}),i=(()=>{if(!r)return null;const d=`replay-${r}`,m=sessionStorage.getItem(d);if(!m)return null;sessionStorage.removeItem(d);try{return JSON.parse(m)}catch{return null}})(),a=(()=>{if(!i)return null;const d={};for(const[m,b]of Object.entries(i))b!==null&&typeof b=="object"?d[m]=JSON.stringify(b,null,2):d[m]=b;return d})(),[c,l]=w.useState(a??{}),[p,f]=w.useState(i?JSON.stringify(i,null,2):"{}"),[u,h]=w.useState(null),[N,T]=w.useState(null),[_,A]=w.useState(null),[O,y]=w.useState(null),[k,I]=w.useState(!1),[g,v]=w.useState(null),{org:S}=ie(),$=_e(e),j=Tt(),P=kt(),{setChatOpen:z}=Pt(),M=`${e}:${s}`,R=ce({connectionId:e,orgId:S.id,orgSlug:S.slug}),U=It({client:R}),x=U.data?.tools?.find(d=>d.name===s),E=it(x?._meta),B=d=>{if(!j)return;const m=$t(d.content);m.content.length>0&&(z(!0),j.sendMessage({tiptapDoc:m}))},[D,X]=w.useState("json"),[Me,Ue]=w.useState(!1);E&&!Me&&(X("ui"),Ue(!0));const xe=x?.inputSchema?.properties,fe=xe?Object.keys(xe):[],q=fe.length>0,H={};if(q&&x?.inputSchema?.properties)for(const d of fe)H[d]=x.inputSchema.required?.includes(d)?"":void 0;const Z=d=>Object.prototype.hasOwnProperty.call(c,d),ze=async()=>{I(!0),y(null),h(null),T(null),A(null),v(null);const d=performance.now();try{if(!R)throw new Error("MCP client is not available");const m=q?{...H,...c}:(()=>{const F=p.trim();if(!F)return{};const L=JSON.parse(F);if(L&&typeof L=="object")return L;throw new Error("Raw JSON input must be an object.")})();q&&x?.inputSchema?.properties&&Object.entries(x.inputSchema.properties).forEach(([F,L])=>{if((L.type==="object"||L.type==="array")&&typeof m[F]=="string")try{m[F]=JSON.parse(m[F])}catch{}});const b=await R.callTool({name:s,arguments:m}),K=b.structuredContent??b,qe=performance.now(),We=Math.round(qe-d);h(K),T(b),A(m);const He=JSON.stringify(K),ge=new TextEncoder().encode(He).length;v({duration:`${We}ms`,bytes:`${ge} bytes`,tokens:`~${Math.ceil(ge/4)} tokens`,cost:"$0.0000"})}catch(m){const b=m instanceof Error?m.message:String(m);y(b||"Unknown error occurred");const K=performance.now();v({duration:`${Math.round(K-d)}ms`})}finally{I(!1)}},ee=(d,m)=>{l(b=>({...b,[d]:m}))},Be=()=>{h(null),T(null),A(null),y(null),v(null)},Fe=x?.name??Ft(s),Le=t.jsx(Oe,{children:t.jsxs(Re,{children:[t.jsx(V,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:S.slug},children:"Connections"})})}),t.jsx(Y,{}),$&&t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:S.slug,appSlug:yt($)},search:{tab:"tools"},children:$.title})})}),t.jsx(Y,{})]}),t.jsx(V,{children:t.jsx(De,{children:Fe})})]})}),he=n.length>1&&t.jsxs(be,{value:e,onValueChange:o,children:[t.jsx(Ne,{className:"h-8 w-auto min-w-[200px]",children:t.jsx(ve,{})}),t.jsx(Se,{children:n.map(d=>t.jsx(oe,{value:d.id,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx($e,{icon:d.icon,name:d.title,size:"xs",className:"shrink-0"}),d.title]})},d.id))})]}),Ve=t.jsxs("div",{className:"flex flex-col p-6 gap-4 overflow-auto",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),x?.inputSchema?.required&&x.inputSchema.required.length>0&&t.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),t.jsx("div",{className:"space-y-4",children:q&&x?.inputSchema?.properties?Object.entries(x.inputSchema.properties).map(([d,m])=>t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[d,x.inputSchema?.required?.includes(d)&&t.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),t.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:m.type})]}),m.description&&t.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:m.description}),m.type==="object"||m.type==="array"?t.jsx(re,{className:"font-mono text-xs",value:Z(d)?c[d]??"":H[d]??"",onChange:b=>ee(d,b.target.value),placeholder:`Enter ${d} as JSON...`,rows:3}):m.type==="boolean"?t.jsxs(be,{value:Z(d)?String(c[d]??""):"",onValueChange:b=>ee(d,b==="true"),children:[t.jsx(Ne,{children:t.jsx(ve,{placeholder:"Select true or false..."})}),t.jsxs(Se,{children:[t.jsx(oe,{value:"true",children:"true"}),t.jsx(oe,{value:"false",children:"false"})]})]}):t.jsx(ue,{value:Z(d)?c[d]??"":H[d]??"",onChange:b=>ee(d,b.target.value),placeholder:`Enter ${d}...`})]},d)):x?.inputSchema&&!q?t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),t.jsx(re,{className:"font-mono text-xs min-h-[120px]",value:p,onChange:d=>f(d.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):t.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})}),t.jsx("div",{className:"flex items-center gap-2 pt-2",children:k?t.jsxs(W,{size:"sm",variant:"destructive",className:"h-8 gap-2",onClick:Be,children:[t.jsx(pt,{className:"h-3.5 w-3.5"}),"Cancel"]}):t.jsxs(W,{size:"sm",variant:"default",className:"h-8 gap-2",onClick:ze,children:[t.jsx(bt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})})]}),Je=t.jsxs("div",{className:"flex flex-col @3xl:h-full @3xl:overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-b border-border bg-background",children:[t.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),t.jsxs("div",{className:"flex items-center gap-3",children:[g&&t.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xt,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.duration})]}),g.tokens&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ft,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.tokens})]}),g.bytes&&t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(ht,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"font-mono text-foreground",children:g.bytes})]}),g.cost&&t.jsx("div",{className:"flex items-center gap-1.5",children:t.jsx("span",{className:"font-mono text-foreground",children:g.cost})})]}),E&&t.jsx(mt,{children:t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:D==="ui"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("ui"),children:t.jsx(gt,{size:14})})}),t.jsx(Ce,{children:"Interactive view"})]}),t.jsxs(ye,{children:[t.jsx(we,{asChild:!0,children:t.jsx(W,{size:"icon",variant:D==="json"?"secondary":"ghost",className:"h-8 w-8",onClick:()=>X("json"),children:t.jsx(Ie,{size:14})})}),t.jsx(Ce,{children:"JSON view"})]})]})})]})]}),O&&t.jsx("div",{className:"px-6 py-4 bg-background",children:t.jsx(at,{variant:"destructive",children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ut,{className:"h-4 w-4"}),t.jsx(ct,{className:"mb-0",children:"Execution Failed"})]}),t.jsx(dt,{className:"text-xs text-destructive",children:O})]})})}),t.jsx("div",{className:"relative flex-1 min-h-[400px] @3xl:min-h-0 @3xl:overflow-auto bg-muted/50",children:E&&D==="ui"&&R?t.jsx(w.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-48",children:t.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[t.jsx("div",{className:"size-4 border-2 border-current border-t-transparent rounded-full animate-spin"}),t.jsx("span",{className:"text-sm",children:"Loading app..."})]})}),children:t.jsx(lt,{resourceURI:E,toolInfo:x?{tool:x}:void 0,toolInput:_??void 0,toolResult:N??void 0,displayMode:"fullscreen",minHeight:je.view.minHeight,maxHeight:je.view.maxHeight,client:R,onMessage:B,onUpdateModelContext:d=>P?.setAppContext(M,d),onTeardown:()=>P?.clearAppContext(M),className:"h-full"})}):u?t.jsxs(t.Fragment,{children:[t.jsx(Et,{code:JSON.stringify(u,null,2),language:"json",height:"100%",readOnly:!0}),t.jsx(W,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(u,null,2)),Xe.success("Copied to clipboard")},children:t.jsx(jt,{className:"h-3.5 w-3.5"})})]}):t.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[t.jsx(Ie,{className:"h-12 w-12 mb-3 opacity-40"}),t.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]});return t.jsx(pe,{breadcrumb:Le,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden @container",children:[t.jsxs("div",{className:"flex flex-col gap-3 py-7 px-8 bg-background border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-4",children:[t.jsx($e,{icon:$?.icon||null,name:$?.title||s,size:"xl",className:"shrink-0"}),t.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground leading-none truncate",children:s}),t.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit shrink-0",children:[U.isSuccess?t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):U.isLoading?t.jsx(le,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),t.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:U.isSuccess?"ready":U.isLoading?"connecting":"error"})]}),t.jsx(Ct,{annotations:x?.annotations,_meta:x?._meta}),t.jsx("div",{className:"hidden @3xl:flex items-center ml-auto shrink-0",children:he})]}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:x?.description||"No description available"})]}),n.length>1&&t.jsxs("div",{className:"flex @3xl:hidden items-center gap-3 px-8 py-3 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground shrink-0",children:"Instance"}),he]}),t.jsx("div",{className:"flex-1 overflow-auto @3xl:overflow-hidden",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-[minmax(0,2fr)_minmax(0,5fr)] @3xl:h-full @3xl:grid-rows-1",children:[t.jsx("div",{className:"@3xl:border-r border-border @3xl:overflow-auto",children:Ve}),Je]})})]})})}function Jt(s){const e=C.c(10),{itemId:n,siblings:o,onBack:r}=s,[i,a]=w.useState(o[0]?.id??"");let c;e[0]!==i||e[1]!==o?(c=o.find(h=>h.id===i)?.id??o[0]?.id??"",e[0]=i,e[1]=o,e[2]=c):c=e[2];const l=c;if(!_e(l||void 0)||!l){let h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[t.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[3]=h):h=e[3],h}let f;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),e[4]=f):f=e[4];let u;return e[5]!==l||e[6]!==r||e[7]!==o||e[8]!==n?(u=t.jsx(w.Suspense,{fallback:f,children:t.jsx(Lt,{toolName:n,connectionId:l,siblings:o,onSelectInstance:a,onBack:r})}),e[5]=l,e[6]=r,e[7]=o,e[8]=n,e[9]=u):u=e[9],u}const qt={workflow:rt,workflow_execution:nt,prompt:Bt};function Wt(){const s=C.c(9),e=ke();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=n):n=s[0];const o=ae(n),r=decodeURIComponent(o.itemId);let i;s[1]!==o.appSlug?(i={slug:o.appSlug},s[1]=o.appSlug,s[2]=i):i=s[2];const a=Ae(i);let c;s[3]!==e.history?(c=()=>{e.history.back()},s[3]=e.history,s[4]=c):c=s[4];const l=c,p=Ht;let f;return s[5]!==l||s[6]!==r||s[7]!==a?(f=t.jsx(Jt,{itemId:r,siblings:a,onBack:l,onUpdate:p}),s[5]=l,s[6]=r,s[7]=a,s[8]=f):f=s[8],f}async function Ht(s){return Promise.resolve()}function Kt(s){return s.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Qt(){const s=C.c(41),e=ke();let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=n):n=s[0];const o=ae(n),r=decodeURIComponent(o.collectionName),i=decodeURIComponent(o.itemId);let a;s[1]!==e.history?(a=()=>{e.history.back()},s[1]=e.history,s[2]=a):a=s[2];const c=a,{org:l}=ie();let p;s[3]!==o.appSlug?(p={slug:o.appSlug},s[3]=o.appSlug,s[4]=p):p=s[4];const u=Ae(p)[0]??null,h=u?.id??"",N=h||"no-connection",T=h??null;let _;s[5]!==l.id||s[6]!==l.slug||s[7]!==T?(_={connectionId:T,orgId:l.id,orgSlug:l.slug},s[5]=l.id,s[6]=l.slug,s[7]=T,s[8]=_):_=s[8];const A=ce(_),O=Ee(N,r,A);let y;s[9]!==O||s[10]!==i?(y=async D=>{i&&await O.update.mutateAsync({id:i,data:D})},s[9]=O,s[10]=i,s[11]=y):y=s[11];const k=y;let I;s[12]!==r?(I=r?.toLowerCase(),s[12]=r,s[13]=I):I=s[13];const g=I,v=g&&qt[g];let S;s[14]!==r?(S=Kt(r),s[14]=r,s[15]=S):S=s[15];const $=S;let j;s[16]!==l.slug?(j=t.jsx(V,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections",params:{org:l.slug},children:"Connections"})})}),s[16]=l.slug,s[17]=j):j=s[17];let P;s[18]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(Y,{}),s[18]=P):P=s[18];let z;s[19]!==r||s[20]!==u||s[21]!==l.slug||s[22]!==o.appSlug?(z=u&&t.jsxs(t.Fragment,{children:[t.jsx(V,{children:t.jsx(G,{asChild:!0,children:t.jsx(Q,{to:"/$org/settings/connections/$appSlug",params:{org:l.slug,appSlug:o.appSlug},search:{tab:r},children:u.title})})}),t.jsx(Y,{})]}),s[19]=r,s[20]=u,s[21]=l.slug,s[22]=o.appSlug,s[23]=z):z=s[23];let M;s[24]!==$?(M=t.jsx(V,{children:t.jsx(De,{children:$})}),s[24]=$,s[25]=M):M=s[25];let R;s[26]!==z||s[27]!==M||s[28]!==j?(R=t.jsx(Oe,{children:t.jsxs(Re,{children:[j,P,z,M]})}),s[26]=z,s[27]=M,s[28]=j,s[29]=R):R=s[29];const U=R;if(v){let D;return s[30]!==v||s[31]!==c||s[32]!==k||s[33]!==i?(D=t.jsx(v,{itemId:i,onBack:c,onUpdate:k}),s[30]=v,s[31]=c,s[32]=k,s[33]=i,s[34]=D):D=s[34],D}let x;s[35]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(At,{size:36,className:"text-muted-foreground"}),s[35]=x):x=s[35];let E;s[36]!==c?(E=t.jsx(_t,{icon:x,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:c,children:"Go back"}}),s[36]=c,s[37]=E):E=s[37];let B;return s[38]!==U||s[39]!==E?(B=t.jsx(pe,{breadcrumb:U,children:E}),s[38]=U,s[39]=E,s[40]=B):B=s[40],B}function Gt(){const s=C.c(3);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/settings/connections/$appSlug/$collectionName/$itemId"},s[0]=e):e=s[0];const n=ae(e);if(decodeURIComponent(n.collectionName)==="tools"){let a;return s[1]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(Wt,{}),s[1]=a):a=s[1],a}let i;return s[2]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(Qt,{}),s[2]=i):i=s[2],i}function Ko(){const s=C.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Te,{children:t.jsx(w.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Gt,{})})}),s[0]=e):e=s[0],e}export{Ko as default};
@@ -1 +0,0 @@
1
- import{e as P,r as T,q as A,G as _,a as B,j as s,B as L,K as z,o as K}from"./index-biiHZ5l9.js";import{c as Y,e as q,b as F,a as M,D as O}from"./dialog-Bm1pP7Vu.js";import{S as R}from"./spinner-DJD6-9r-.js";import{i as Q}from"./Check-D-9dblUn.js";import{a as $}from"./Eye-ByuwKsdh.js";import{S as G,u as H}from"./use-mcp-client-CWFUu1lY.js";import{u as W}from"./chat-context-Bu6qpu9K.js";const E="bunx decocms link",v={"claude-code":"Claude Code",codex:"Codex"};function w(n){return n.map(e=>v[e]).filter(e=>!!e)}function N(n){return Object.keys(v).filter(e=>!n.includes(e)).map(e=>v[e]).filter(e=>!!e)}function ie(n){const e=P.c(35),{open:h,onOpenChange:j}=n,t=W(),[C,y]=T.useState(!1),{org:i}=A(),k=_();let x;e[0]!==i.id||e[1]!==i.slug?(x={connectionId:G,orgId:i.id,orgSlug:i.slug},e[0]=i.id,e[1]=i.slug,e[2]=x):x=e[2];const b=H(x);let o;e[3]!==b?(o=async()=>{const S=await b.callTool({name:"LINK_DISCONNECT",arguments:{}});if(S?.isError)throw new Error(S.content?.[0]?.text??"Failed to disconnect desktop")},e[3]=b,e[4]=o):o=e[4];let a;e[5]!==i.id||e[6]!==k?(a=()=>{k.invalidateQueries({queryKey:z.currentLink(i.id)})},e[5]=i.id,e[6]=k,e[7]=a):a=e[7];let f;e[8]!==o||e[9]!==a?(f={mutationFn:o,onSuccess:a,onError:J},e[8]=o,e[9]=a,e[10]=f):f=e[10];const p=B(f),D=t.online?"Desktop connected":"Connect your desktop";let l;e[11]!==D?(l=s.jsx(Y,{children:D}),e[11]=D,e[12]=l):l=e[12];const I=t.online?"Your desktop is online. Pick a desktop agent in the chat to use it.":"Run this command in your desktop terminal. The dialog will close once your desktop is online.";let r;e[13]!==I?(r=s.jsx(q,{children:I}),e[13]=I,e[14]=r):r=e[14];let c;e[15]!==l||e[16]!==r?(c=s.jsxs(F,{children:[l,r]}),e[15]=l,e[16]=r,e[17]=c):c=e[17];let d;e[18]!==C||e[19]!==t.online?(d=!t.online&&s.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-muted px-3 py-2 font-mono text-sm",children:[s.jsx("span",{className:"flex-1",children:E}),s.jsx(L,{type:"button",variant:"ghost",size:"icon-sm",onClick:()=>{navigator.clipboard.writeText(E),y(!0),setTimeout(()=>y(!1),1500)},children:C?s.jsx(Q,{size:14}):s.jsx($,{size:14})})]}),e[18]=C,e[19]=t.online,e[20]=d):d=e[20];let m;e[21]!==p||e[22]!==t.capabilities||e[23]!==t.hostname||e[24]!==t.machineId||e[25]!==t.online?(m=t.online?s.jsxs("div",{className:"flex flex-col gap-1 text-sm",children:[s.jsxs("p",{className:"text-foreground",children:[t.hostname??t.machineId??"Your desktop"," is linked."]}),w(t.capabilities).length>0&&s.jsxs("p",{className:"text-muted-foreground",children:["Available: ",w(t.capabilities).join(", ")]}),N(t.capabilities).length>0&&s.jsxs("p",{className:"text-muted-foreground",children:[N(t.capabilities).join(" and ")," ",N(t.capabilities).length>1?"were":"was"," ","not detected on this desktop. Install the CLI and sign in there — it appears here automatically within a minute."]}),s.jsx("div",{className:"flex justify-end pt-2",children:s.jsx(L,{type:"button",variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>p.mutate(),className:"text-destructive hover:text-destructive",children:p.isPending?"Disconnecting…":"Disconnect desktop"})})]}):s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(R,{size:"sm"}),"Waiting for desktop…"]}),e[21]=p,e[22]=t.capabilities,e[23]=t.hostname,e[24]=t.machineId,e[25]=t.online,e[26]=m):m=e[26];let u;e[27]!==d||e[28]!==m||e[29]!==c?(u=s.jsxs(M,{className:"sm:max-w-md",children:[c,d,m]}),e[27]=d,e[28]=m,e[29]=c,e[30]=u):u=e[30];let g;return e[31]!==j||e[32]!==h||e[33]!==u?(g=s.jsx(O,{open:h,onOpenChange:j,children:u}),e[31]=j,e[32]=h,e[33]=u,e[34]=g):g=e[34],g}function J(n){K.error(`Disconnect failed: ${n.message}`)}export{ie as C,w as v};
@@ -1 +0,0 @@
1
- import{T as ge,aJ as Ie,ba as Ae,W as ce,aH as De,e as P,j as t,l as je,B as V,r as X,c as ve,q as J,s as $e,K as ne,f as Y,x as de,u as Pe,bb as Oe,E as Me,g as ze,bc as Ee,G as Ve,H as Ue,I as Fe,M as Re,o as G,bd as Le,J as He}from"./index-biiHZ5l9.js";import{g as Be}from"./generate-id-CadHbHqX.js";import{E as be}from"./empty-state-1AbmTLd7.js";import{E as We,c as qe,r as Ge,b as Xe,d as Ke}from"./connection-form-helpers-DoJomSCQ.js";import{c as Qe,S as Je}from"./index-CHdFXpqc.js";import{u as Ne,T as Ye}from"./tools-list-Ch5RlbiL.js";import{u as Ze}from"./use-members-Cw70r_Wh.js";import{A as et}from"./avatar-BHEXMwdE.js";import{a as ye,b as _e,u as tt}from"./use-connection-DyJtuHQI.js";import{u as ae,S as st}from"./use-mcp-client-CWFUu1lY.js";import{b as nt}from"./use-mcp-tools-DePRGZE5.js";import{a as ot}from"./use-mcp-prompts-B5RhBVzg.js";import{I as oe}from"./integration-icon-Dy-a3x5R.js";import{s as it}from"./Plus-CjrtKB-Y.js";import{q as at,s as rt,a5 as lt,R as ct}from"./agent-icon-DT8dQ9tq.js";import{a as Se}from"./Settings02-Cd4DIqaJ.js";import{s as re}from"./Trash01-Cup7-ZTT.js";import{b as dt,a as mt,d as ut,S as xt,c as pt}from"./sheet-D99KevZC.js";import{F as L,b as H,c as B,d as E,f as W,e as ft,a as ht}from"./form-BcPtow5O.js";import{I as q}from"./input-5PMMNPU9.js";import{u as gt,D as jt}from"./use-delete-connection-C60uGs0b.js";import{V as vt}from"./layout-CbTbCjmA.js";import{c as bt,C as Nt,B as yt,a as _t,b as St,d as Ct,e as wt}from"./monitoring-stats-row-BAplEVfE.js";import{a as kt}from"./use-virtual-mcp-0jbEmvOc.js";import{i as Ce}from"./ChevronRight-CrZy8tHx.js";import{a as we}from"./Users03-BlNe2PnN.js";import{T as ee,a as Tt,b as te,c as It}from"./tabs-DCDCb9Pz.js";import{g as ke}from"./connection-slug-eyAPH6o3.js";import{n as At}from"./ZapSquare-B1o2Q9OR.js";import{b as Dt}from"./Tool01-Dcq7KP8Y.js";import{g as le,M as $t}from"./types-jBdXInU0.js";import{C as Pt}from"./collection-search-LsgoMrVO.js";import{C as Ot}from"./card-BUTabNLA.js";import{B as Mt}from"./badge-Da0IsrqH.js";import{D as zt,a as Et,b as Vt,c as me}from"./dropdown-menu-CIu58K9q.js";import{d as ue,S as xe,a as pe,b as fe,c as R}from"./select-CNSUv3cw.js";import{i as Ut}from"./CheckCircle-C2ualSpf.js";import{t as Ft}from"./ChevronDown-Cf2Q-GlB.js";import{n as Rt}from"./Container-CYcITvPW.js";import{s as se}from"./Star01-eRdSY4QW.js";import{s as Lt}from"./RefreshCcw01-3BsQQkRx.js";import{s as Ht}from"./XClose-pR-QU0OQ.js";import"./collections-C_j8CeI8.js";import"./ZoomOut-D8vQ49we.js";import"./Key01-CzmPnHuw.js";import"./index-YdX5UjUB.js";import"./index-50-dmJFK.js";import"./extract-connection-data-LoMqboL3.js";import"./use-registry-connections-C-WVKjSU.js";import"./use-organization-settings-Izqk1Gkk.js";import"./index-CR_LeyNj.js";import"./popover-Cvcd3A1d.js";import"./tooltip-bsrBmmjV.js";import"./Check-D-9dblUn.js";import"./SearchMd-BL2y99rx.js";import"./use-create-virtual-mcp-CWYOy45e.js";import"./use-navigate-to-agent-CdsMYUzL.js";import"./Eye-ByuwKsdh.js";import"./use-org-auth-client--i_Sx92M.js";import"./User01-thAIxsAs.js";import"./use-collections-B5Jh_wGd.js";import"./AlertCircle-9EFUZenf.js";import"./SwitchHorizontal01-BMnNI1Fi.js";import"./XCircle-UPVnJx4i.js";import"./ArrowUpRight-97355q5v.js";import"./ChevronLeft-BaV4nFMQ.js";import"./ChevronUp-BAxoXhnT.js";import"./DotsVertical-SvwN4CeV.js";import"./Globe01-DfGFlik1.js";import"./FilterLines-BJZdiggU.js";import"./Palette-Druykvzw.js";import"./HardDrive-DNFvbooP.js";import"./Stars02-EuAFDZ5E.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./LinkExternal01-CgI1VTqi.js";import"./Monitor01-Cw6kmClm.js";import"./Sun-CH2HWLCn.js";import"./Play-CMJ2IWYR.js";import"./Shield01-zIbMct6w.js";import"./Stars01-v0yz6PCZ.js";import"./Upload01-C9yi1Bdg.js";import"./Users01-DPJm6-u-.js";import"./X-1KR4wibP.js";import"./Zap-Cl-JM7N9.js";import"./label-CcC4_aKf.js";import"./alert-dialog-CSkQIwm8.js";import"./index-r7-3fAFf.js";import"./sidebar-CPZXU-2w.js";const Bt=ge({scopes:De(ce()).describe("List of scopes available"),stateSchema:Ie(ce(),Ae()).describe("JSON Schema (draft-07) defining the state structure")}),Wt=[{name:"MCP_CONFIGURATION",inputSchema:ge({}),outputSchema:Bt}];function qt(s){const e=P.c(46),{instance:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i}=s;let d;e[0]!==n.id?(d={connectionId:n.id},e[0]=n.id,e[1]=d):d=e[1];const l=Ne(d),m=!(n.connection_type==="VIRTUAL")&&l.supportsOAuth&&!l.isAuthenticated,p=n.status!=="active",c=m||p?"border-destructive/50 bg-destructive/5":"border-transparent";let h;e[2]!==c?(h=ve("flex items-center gap-3 rounded-lg border px-4 py-2.5 transition-colors",c),e[2]=c,e[3]=h):h=e[3];let g;e[4]!==n.icon||e[5]!==n.title?(g=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[4]=n.icon,e[5]=n.title,e[6]=g):g=e[6];let v;e[7]!==n.title?(v=t.jsx("p",{className:"text-sm font-medium truncate",children:n.title}),e[7]=n.title,e[8]=v):v=e[8];let b;e[9]!==n.status||e[10]!==p||e[11]!==m?(b=m?t.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):p?t.jsx("span",{className:"text-xs text-destructive font-medium",children:n.status==="error"?"Disabled (error)":"Disabled"}):null,e[9]=n.status,e[10]=p,e[11]=m,e[12]=b):b=e[12];let j;e[13]!==v||e[14]!==b?(j=t.jsxs("div",{className:"flex-1 min-w-0",children:[v,b]}),e[13]=v,e[14]=b,e[15]=j):j=e[15];let N;e[16]!==n||e[17]!==m||e[18]!==r?(N=m&&t.jsx(V,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>r(n),children:"Authorize"}),e[16]=n,e[17]=m,e[18]=r,e[19]=N):N=e[19];let T;e[20]!==n||e[21]!==p||e[22]!==i?(T=p?t.jsxs(V,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>i(n,"active"),children:[t.jsx(at,{size:13}),"Enable"]}):t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>i(n,"inactive"),title:"Disable",children:t.jsx(rt,{size:13})}),e[20]=n,e[21]=p,e[22]=i,e[23]=T):T=e[23];let C;e[24]!==n||e[25]!==a?(C=()=>a(n),e[24]=n,e[25]=a,e[26]=C):C=e[26];let y;e[27]===Symbol.for("react.memo_cache_sentinel")?(y=t.jsx(Se,{size:13}),e[27]=y):y=e[27];let I;e[28]!==C?(I=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:C,title:"Configure",children:y}),e[28]=C,e[29]=I):I=e[29];let _;e[30]!==n||e[31]!==o?(_=()=>o(n),e[30]=n,e[31]=o,e[32]=_):_=e[32];let k;e[33]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(re,{size:13}),e[33]=k):k=e[33];let S;e[34]!==_?(S=t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:_,title:"Delete",children:k}),e[34]=_,e[35]=S):S=e[35];let f;e[36]!==I||e[37]!==S||e[38]!==N||e[39]!==T?(f=t.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[N,T,I,S]}),e[36]=I,e[37]=S,e[38]=N,e[39]=T,e[40]=f):f=e[40];let w;return e[41]!==f||e[42]!==h||e[43]!==g||e[44]!==j?(w=t.jsxs("div",{className:h,children:[g,j,f]}),e[41]=f,e[42]=h,e[43]=g,e[44]=j,e[45]=w):w=e[45],w}function Gt(s){const e=P.c(15),{instance:n,onConfigure:a}=s;let r;e[0]!==n.icon||e[1]!==n.title?(r=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",className:"shrink-0"}),e[0]=n.icon,e[1]=n.title,e[2]=r):r=e[2];let o;e[3]!==n.title?(o=t.jsx("div",{className:"flex-1 min-w-0",children:t.jsx("p",{className:"text-sm font-medium truncate",children:n.title})}),e[3]=n.title,e[4]=o):o=e[4];let i;e[5]!==n||e[6]!==a?(i=()=>a(n),e[5]=n,e[6]=a,e[7]=i):i=e[7];let d;e[8]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(Se,{size:13}),e[8]=d):d=e[8];let l;e[9]!==i?(l=t.jsx("div",{className:"flex items-center gap-1 shrink-0",children:t.jsx(V,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:i,title:"Configure",children:d})}),e[9]=i,e[10]=l):l=e[10];let x;return e[11]!==r||e[12]!==o||e[13]!==l?(x=t.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-transparent px-4 py-2.5 transition-colors",children:[r,o,l]}),e[11]=r,e[12]=o,e[13]=l,e[14]=x):x=e[14],x}function Xt(s){const e=P.c(27),{instances:n,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i,onAdd:d,isAdding:l}=s;if(n.length===0)return null;const x=n.length===1?"Instance":"Instances";let m;e[0]!==x?(m=t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:x}),e[0]=x,e[1]=m):m=e[1];let p;e[2]!==l?(p=l?t.jsx(je,{size:13,className:"animate-spin"}):t.jsx(it,{size:13}),e[2]=l,e[3]=p):p=e[3];let c;e[4]!==l||e[5]!==d||e[6]!==p?(c=t.jsxs(V,{variant:"default",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:d,disabled:l,children:[p,"Add instance"]}),e[4]=l,e[5]=d,e[6]=p,e[7]=c):c=e[7];let h;e[8]!==m||e[9]!==c?(h=t.jsxs("div",{className:"px-5 py-4 border-b border-border flex items-center justify-between",children:[m,c]}),e[8]=m,e[9]=c,e[10]=h):h=e[10];let g;if(e[11]!==n||e[12]!==r||e[13]!==a||e[14]!==o||e[15]!==i){let j;e[17]!==r||e[18]!==a||e[19]!==o||e[20]!==i?(j=N=>t.jsx(X.Suspense,{fallback:t.jsx(Gt,{instance:N,onConfigure:a}),children:t.jsx(qt,{instance:N,onConfigure:a,onAuthenticate:r,onDelete:o,onToggleStatus:i})},N.id),e[17]=r,e[18]=a,e[19]=o,e[20]=i,e[21]=j):j=e[21],g=n.map(j),e[11]=n,e[12]=r,e[13]=a,e[14]=o,e[15]=i,e[16]=g}else g=e[16];let v;e[22]!==g?(v=t.jsx("div",{className:"p-2 flex flex-col gap-1",children:g}),e[22]=g,e[23]=v):v=e[23];let b;return e[24]!==h||e[25]!==v?(b=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[h,v]}),e[24]=h,e[25]=v,e[26]=b):b=e[26],b}const Kt=[{value:"7d",label:"7d"},{value:"14d",label:"14d"},{value:"30d",label:"30d"}];function Qt(s){const e=new Date,n=new Date(e);return s==="7d"?n.setDate(n.getDate()-7):s==="14d"?n.setDate(n.getDate()-14):n.setDate(n.getDate()-30),{startDate:n,endDate:e}}const Jt={calls:{label:"Tool calls"},errors:{label:"Errors"}};function Yt(s){const e=P.c(4),{connectionId:n,orgId:a,orgSlug:r,timeframe:o}=s;let i;e[0]!==a||e[1]!==r?(i={connectionId:st,orgId:a,orgSlug:r},e[0]=a,e[1]=r,e[2]=i):i=e[2];const d=ae(i),l=Qt(o),{data:x}=$e({queryKey:ne.connectionActivity(n,o,a),queryFn:async()=>{const g=await d.callTool({name:"MONITORING_LOGS_LIST",arguments:{startDate:l.startDate.toISOString(),endDate:l.endDate.toISOString(),connectionId:n,limit:2e3,offset:0}});return g.structuredContent??g},staleTime:3e5}),m=bt(x?.logs??[],l),p=m.data,c=m.totalCalls>0;let h;return e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Tool calls"}),e[3]=h):h=e[3],t.jsxs("div",{children:[t.jsxs("div",{className:"flex gap-6 px-5 pb-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:m.totalCalls.toLocaleString()}),h]}),m.totalErrors>0&&t.jsxs("div",{children:[t.jsx("p",{className:"text-2xl font-semibold text-destructive tabular-nums",children:m.totalErrors.toLocaleString()}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Errors"})]}),m.avgDurationMs>0&&t.jsxs("div",{children:[t.jsxs("p",{className:"text-2xl font-semibold text-foreground tabular-nums",children:[Math.round(m.avgDurationMs),"ms"]}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Avg latency"})]})]}),c?t.jsxs("div",{children:[t.jsx(Nt,{config:Jt,className:"h-16 w-full",children:t.jsxs(yt,{data:p,barCategoryGap:"4%",children:[t.jsx(_t,{content:t.jsx(St,{labelFormatter:es}),cursor:{fill:"var(--muted)"}}),t.jsx(Ct,{dataKey:"calls",radius:[2,2,0,0],minPointSize:1,children:p.map(Zt)})]})}),t.jsxs("div",{className:"flex justify-between px-3 mt-1 pb-3",children:[t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[0]?.label}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:p[p.length-1]?.label})]})]}):t.jsx("div",{className:"h-20 flex items-center justify-center",children:t.jsx("p",{className:"text-sm text-muted-foreground/60",children:"No activity in this period"})})]})}function Zt(s,e){return t.jsx(wt,{fill:s.errorRate>50?"var(--destructive)":"var(--chart-1)",fillOpacity:s.calls===0?.2:s.errorRate>50?.7:.85},`cell-${e}`)}function es(s,e){const n=Array.isArray(e)?e[0]:void 0;return n&&typeof n=="object"&&"payload"in n?n.payload?.label??"":""}function ts(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsxs("div",{children:[t.jsx("div",{className:"flex gap-6 px-5 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("div",{className:"h-7 w-16 rounded-md bg-muted animate-pulse"}),t.jsx("div",{className:"h-3 w-14 rounded bg-muted animate-pulse"})]})}),t.jsx("div",{className:"h-20 w-full rounded-md bg-muted animate-pulse"})]}),s[0]=e):e=s[0],e}function ss(s){const e=P.c(14),{connectionId:n}=s,[a,r]=X.useState("14d"),{org:o}=J();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("div",{children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Activity"})}),e[0]=i):i=e[0];let d;e[1]!==a?(d=Kt.map(c=>t.jsx("button",{type:"button",onClick:()=>r(c.value),className:ve("px-2.5 py-1 text-xs font-medium rounded-md transition-colors",a===c.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c.label},c.value)),e[1]=a,e[2]=d):d=e[2];let l;e[3]!==d?(l=t.jsxs("div",{className:"px-5 py-4 flex items-center justify-between",children:[i,t.jsx("div",{className:"flex items-center gap-0.5 bg-muted rounded-lg p-0.5",children:d})]}),e[3]=d,e[4]=l):l=e[4];let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(ts,{}),e[5]=x):x=e[5];let m;e[6]!==n||e[7]!==o.id||e[8]!==o.slug||e[9]!==a?(m=t.jsx(X.Suspense,{fallback:x,children:t.jsx(Yt,{connectionId:n,orgId:o.id,orgSlug:o.slug,timeframe:a})}),e[6]=n,e[7]=o.id,e[8]=o.slug,e[9]=a,e[10]=m):m=e[10];let p;return e[11]!==l||e[12]!==m?(p=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[l,m]}),e[11]=l,e[12]=m,e[13]=p):p=e[13],p}function ns(s){const e=P.c(15),{virtualMcp:n,org:a}=s,r=Y();let o;e[0]!==r||e[1]!==a||e[2]!==n.id?(o=()=>{const p=crypto.randomUUID();r({to:"/$org/$taskId",params:{org:a,taskId:p},search:{virtualmcpid:n.id}})},e[0]=r,e[1]=a,e[2]=n.id,e[3]=o):o=e[3];let i;e[4]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx(we,{size:16}),e[4]=i):i=e[4];let d;e[5]!==n.icon||e[6]!==n.title?(d=t.jsx(oe,{icon:n.icon,name:n.title,size:"xs",fallbackIcon:i}),e[5]=n.icon,e[6]=n.title,e[7]=d):d=e[7];let l;e[8]!==n.title?(l=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[8]=n.title,e[9]=l):l=e[9];let x;e[10]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(Ce,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[10]=x):x=e[10];let m;return e[11]!==o||e[12]!==d||e[13]!==l?(m=t.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-3 rounded-lg hover:bg-muted/50 transition-colors group text-left w-full",children:[d,l,x]}),e[11]=o,e[12]=d,e[13]=l,e[14]=m):m=e[14],m}function os(s){const e=P.c(7),{virtualMcps:n,org:a}=s;let r;if(e[0]!==a||e[1]!==n){let i;e[3]!==a?(i=d=>t.jsx(ns,{virtualMcp:d,org:a},d.id),e[3]=a,e[4]=i):i=e[4],r=n.map(i),e[0]=a,e[1]=n,e[2]=r}else r=e[2];let o;return e[5]!==r?(o=t.jsx("div",{className:"flex flex-col gap-3",children:t.jsx("div",{className:"flex flex-col gap-2",children:r})}),e[5]=r,e[6]=o):o=e[6],o}function is(s){const e=P.c(7),{connection:n}=s,{org:a}=J();let r;e[0]!==n.id?(r={filters:[{column:"connection_id",value:n.id}]},e[0]=n.id,e[1]=r):r=e[1];const o=kt(r);if(!(o.length>0)){let x;return e[2]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(t.Fragment,{}),e[2]=x):x=e[2],x}let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx("div",{className:"px-5 py-4 border-b border-border",children:t.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Used by agents"})}),e[3]=d):d=e[3];let l;return e[4]!==a.slug||e[5]!==o?(l=t.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[d,t.jsx("div",{className:"px-5 py-4",children:t.jsx(os,{virtualMcps:o,org:a.slug})})]}),e[4]=a.slug,e[5]=o,e[6]=l):l=e[6],l}function as(s){const e=P.c(31),{tools:n,connectionId:a,org:r}=s,o=Y(),{org:i}=J();let d;e[0]!==a||e[1]!==i.id||e[2]!==i.slug?(d={connectionId:a,orgId:i.id,orgSlug:i.slug},e[0]=a,e[1]=i.id,e[2]=i.slug,e[3]=d):d=e[3];const l=ae(d),x=ye(a);let m;e[4]!==x||e[5]!==a?(m=x?ke(x):a,e[4]=x,e[5]=a,e[6]=m):m=e[6];const p=m,[c,h]=X.useState("");let g,v,b,j;if(e[7]!==p||e[8]!==l||e[9]!==o||e[10]!==r||e[11]!==c||e[12]!==n){const C=(n??[]).filter(rs),y=c.toLowerCase().trim(),I=y?C.filter(f=>f.name.toLowerCase().includes(y)||f.description&&f.description.toLowerCase().includes(y)):C;let _;e[17]!==p||e[18]!==o||e[19]!==r?(_=f=>{o({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:r,appSlug:p,collectionName:"tools",itemId:encodeURIComponent(f.name)}})},e[17]=p,e[18]=o,e[19]=r,e[20]=_):_=e[20];const k=_;b="flex flex-col h-full overflow-hidden";let S;e[21]===Symbol.for("react.memo_cache_sentinel")?(S=f=>{f.key==="Escape"&&(h(""),f.target.blur())},e[21]=S):S=e[21],e[22]!==c?(j=t.jsx(Pt,{value:c,onChange:h,placeholder:"Search apps...",onKeyDown:S}),e[22]=c,e[23]=j):j=e[23],g="flex-1 overflow-auto p-5",v=I.length===0?t.jsx(be,{image:null,title:c?"No apps found":"No apps available",description:c?"Try adjusting your search terms":"This connection doesn't have any tools with interactive UIs yet."}):t.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-4",children:I.map(f=>{const w=le(f._meta);return t.jsxs(Ot,{className:"cursor-pointer transition-colors overflow-hidden gap-0",onClick:()=>k(f),children:[t.jsx("div",{className:"h-[200px] overflow-hidden border-b border-border",children:t.jsx($t,{resourceURI:w,toolInfo:{tool:f},displayMode:"inline",minHeight:200,maxHeight:200,client:l})}),t.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:f.name}),t.jsx(Ye,{annotations:f.annotations,_meta:f._meta})]}),f.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:f.description})]})]},f.name)})}),e[7]=p,e[8]=l,e[9]=o,e[10]=r,e[11]=c,e[12]=n,e[13]=g,e[14]=v,e[15]=b,e[16]=j}else g=e[13],v=e[14],b=e[15],j=e[16];let N;e[24]!==g||e[25]!==v?(N=t.jsx("div",{className:g,children:v}),e[24]=g,e[25]=v,e[26]=N):N=e[26];let T;return e[27]!==b||e[28]!==j||e[29]!==N?(T=t.jsxs("div",{className:b,children:[j,N]}),e[27]=b,e[28]=j,e[29]=N,e[30]=T):T=e[30],T}function rs(s){return!!le(s._meta)}function Te(s){const e=s.replace(/[._]/g," ").trim().split(/\s+/),n=i=>i.charAt(0).toUpperCase()+i.slice(1),a=new Set(["list","create","get","update","delete","fetch","search","run","trigger","review","send","check"]),r=e.map(n),o=e[e.length-1];return r.length>=2&&o&&a.has(o)?[r.pop(),...r].join(" "):r.join(" ")}function ie(s){const e=P.c(2),{label:n}=s;let a;return e[0]!==n?(a=t.jsx("div",{className:"px-5 py-8 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",n," available."]})}),e[0]=n,e[1]=a):a=e[1],a}function ls(s){const e=P.c(50),{tools:n,prompts:a,resources:r,connectionId:o,org:i}=s;let d;e[0]!==a?(d=a===void 0?[]:a,e[0]=a,e[1]=d):d=e[1];const l=d;let x;e[2]!==r?(x=r===void 0?[]:r,e[2]=r,e[3]=x):x=e[3];const m=x,p=Y(),c=ye(o??"");let h;e[4]!==c||e[5]!==o?(h=c?ke(c):o,e[4]=c,e[5]=o,e[6]=h):h=e[6];const g=h;let v;e[7]!==g||e[8]!==o||e[9]!==p||e[10]!==i?(v=function(D){!o||!i||p({to:"/$org/settings/connections/$appSlug/$collectionName/$itemId",params:{org:i,appSlug:g,collectionName:"tools",itemId:encodeURIComponent(D)}})},e[7]=g,e[8]=o,e[9]=p,e[10]=i,e[11]=v):v=e[11];const b=v;let j;e[12]!==o||e[13]!==i||e[14]!==n?(j=o&&i&&n.some(ms),e[12]=o,e[13]=i,e[14]=n,e[15]=j):j=e[15];const N=j;if(n.length+l.length+m.length===0){let u;return e[16]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[t.jsx("h3",{className:"text-sm font-semibold text-foreground mb-1",children:"Capabilities"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"No capabilities discovered yet. The connection may still be connecting."})]}),e[16]=u):u=e[16],u}let C;e[17]!==n.length?(C=t.jsxs(ee,{value:"tools",variant:"underline",children:["Tools (",n.length,")"]}),e[17]=n.length,e[18]=C):C=e[18];let y;e[19]!==N?(y=N&&t.jsx(ee,{value:"apps",variant:"underline",children:"UI"}),e[19]=N,e[20]=y):y=e[20];let I,_;e[21]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ee,{value:"prompts",variant:"underline",children:"Prompts"}),_=t.jsx(ee,{value:"resources",variant:"underline",children:"Resources"}),e[21]=I,e[22]=_):(I=e[21],_=e[22]);let k;e[23]!==C||e[24]!==y?(k=t.jsx("div",{className:"px-5 flex items-center justify-between border-b border-border",children:t.jsxs(Tt,{variant:"underline",className:"gap-1",children:[C,y,I,_]})}),e[23]=C,e[24]=y,e[25]=k):k=e[25];let S;e[26]!==b||e[27]!==n?(S=n.length>0?n.map(u=>t.jsxs("button",{type:"button",className:"w-full flex items-start gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors cursor-pointer",onClick:()=>b(u.name),children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(Dt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(u.name)}),u.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:u.description})]}),t.jsx(Ce,{size:16,className:"text-muted-foreground shrink-0 mt-0.5"})]},u.name)):t.jsx(ie,{label:"tools"}),e[26]=b,e[27]=n,e[28]=S):S=e[28];let f;e[29]!==S?(f=t.jsx(te,{value:"tools",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:S})}),e[29]=S,e[30]=f):f=e[30];let w;e[31]!==o||e[32]!==N||e[33]!==i||e[34]!==n?(w=N&&t.jsx(te,{value:"apps",className:"h-auto min-h-[200px]",children:t.jsx(as,{tools:n,connectionId:o,org:i})}),e[31]=o,e[32]=N,e[33]=i,e[34]=n,e[35]=w):w=e[35];let M;e[36]!==l?(M=l.length>0?l.map(ds):t.jsx(ie,{label:"prompts"}),e[36]=l,e[37]=M):M=e[37];let O;e[38]!==M?(O=t.jsx(te,{value:"prompts",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:M})}),e[38]=M,e[39]=O):O=e[39];let A;e[40]!==m?(A=m.length>0?m.map(cs):t.jsx(ie,{label:"resources"}),e[40]=m,e[41]=A):A=e[41];let z;e[42]!==A?(z=t.jsx(te,{value:"resources",className:"h-auto",children:t.jsx("div",{className:"divide-y divide-border",children:A})}),e[42]=A,e[43]=z):z=e[43];let U;return e[44]!==k||e[45]!==f||e[46]!==w||e[47]!==O||e[48]!==z?(U=t.jsx("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:t.jsxs(It,{defaultValue:"tools",variant:"underline",children:[k,f,w,O,z]})}),e[44]=k,e[45]=f,e[46]=w,e[47]=O,e[48]=z,e[49]=U):U=e[49],U}function cs(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(lt,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:s.name}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description}),s.uri&&t.jsx("div",{className:"text-xs text-muted-foreground/60 font-mono mt-0.5 truncate",children:s.uri})]})]},s.uri??s.name)}function ds(s){return t.jsxs("div",{className:"flex items-start gap-3 px-5 py-3",children:[t.jsx("div",{className:"mt-0.5 shrink-0 size-7 rounded-md bg-muted flex items-center justify-center",children:t.jsx(At,{size:13,className:"text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm font-medium text-foreground",children:Te(s.name)}),s.description&&t.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 leading-relaxed line-clamp-2",children:s.description})]})]},s.name)}function ms(s){return le(s._meta)}function us(s){const e=P.c(13),{connection:n,displayTitle:a}=s,r=a??n.title;let o;e[0]!==n.icon||e[1]!==r?(o=t.jsx(oe,{icon:n.icon,name:r,size:"xl",className:"shrink-0"}),e[0]=n.icon,e[1]=r,e[2]=o):o=e[2];let i;e[3]!==r?(i=t.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:t.jsx("h1",{className:"text-lg md:text-xl font-semibold tracking-tight text-foreground leading-none",children:r})}),e[3]=r,e[4]=i):i=e[4];let d;e[5]!==n.description?(d=n.description&&t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:n.description}),e[5]=n.description,e[6]=d):d=e[6];let l;e[7]!==i||e[8]!==d?(l=t.jsxs("div",{className:"flex-1 min-w-0",children:[i,d]}),e[7]=i,e[8]=d,e[9]=l):l=e[9];let x;return e[10]!==o||e[11]!==l?(x=t.jsxs("div",{className:"flex items-center gap-4 md:gap-6 py-5 md:py-7 px-4 md:px-8 bg-background border-b border-border shrink-0",children:[o,l]}),e[10]=o,e[11]=l,e[12]=x):x=e[12],x}function xs({form:s,connection:e,hasOAuthToken:n,onReauthenticate:a,onRemoveOAuth:r}){const o=de({control:s.control,name:"ui_type"}),i=de({control:s.control,name:"connection_url"}),{stdioEnabled:d}=Pe(),l=(()=>{if(typeof i!="string"||!i)return!1;try{const c=new URL(i);return c.hostname==="api.githubcopilot.com"&&c.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),x=d||e.connection_type==="STDIO",m=e.connection_type==="VIRTUAL",p=m?Oe(e.connection_url):null;return m?t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(we,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),p&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:p})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsx(L,{control:s.control,name:"ui_type",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),o!=="NPX"&&o!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(ue,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsxs(xe,{className:"h-full! w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(se,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(pe,{})]})}),t.jsxs(fe,{children:[t.jsx(R,{value:"HTTP",children:"HTTP"}),t.jsx(R,{value:"SSE",children:"SSE"}),t.jsx(R,{value:"Websocket",children:"Websocket"}),x&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:"NPX Package"}),t.jsx(R,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(L,{control:s.control,name:"connection_url",render:({field:h})=>t.jsx(H,{className:"flex-1 min-w-0",children:t.jsx(E,{children:t.jsx(q,{placeholder:"https://example.com/mcp",...h,value:h.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(ue,{value:c.value,onValueChange:c.onChange,children:[t.jsx(E,{children:t.jsx(xe,{className:"h-10",children:t.jsx(pe,{})})}),t.jsxs(fe,{children:[t.jsx(R,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(R,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(R,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(se,{className:"w-4 h-4"}),"Websocket"]})}),x&&t.jsxs(t.Fragment,{children:[t.jsx(R,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Rt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(R,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ct,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(W,{})]})}),o==="NPX"&&t.jsx(L,{control:s.control,name:"npx_package",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(E,{children:t.jsx(q,{placeholder:"@perplexity-ai/mcp-server",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),o==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(L,{control:s.control,name:"stdio_command",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(E,{children:t.jsx(q,{placeholder:"node, bun, python...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})}),t.jsx(L,{control:s.control,name:"stdio_args",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(E,{children:t.jsx(q,{placeholder:"arg1 arg2 --flag value",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(W,{})]})})]}),t.jsx(L,{control:s.control,name:"stdio_cwd",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(E,{children:t.jsx(q,{placeholder:"/path/to/project (optional)",...c,value:c.value||"",className:"h-10 rounded-lg"})}),t.jsx(W,{})]})})]}),(o==="NPX"||o==="STDIO")&&t.jsx(L,{control:s.control,name:"env_vars",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(E,{children:t.jsx(We,{value:c.value??[],onChange:c.onChange})}),t.jsx(W,{})]})}),o!=="NPX"&&o!=="STDIO"&&t.jsx(L,{control:s.control,name:"connection_token",render:({field:c})=>t.jsxs(H,{className:"flex flex-col gap-3",children:[t.jsx(B,{className:"text-xs text-muted-foreground font-medium",children:l?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(zt,{children:[t.jsx(Et,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Mt,{variant:"success",className:"gap-1.5",children:[t.jsx(Ut,{size:12}),"Authenticated via OAuth",t.jsx(Ft,{size:12})]})})}),t.jsxs(Vt,{align:"start",children:[t.jsxs(me,{onClick:a,children:[t.jsx(Lt,{size:16}),"Re-authenticate"]}),t.jsxs(me,{variant:"destructive",onClick:r,children:[t.jsx(re,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&c.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>c.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(Ht,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(E,{children:t.jsx(q,{type:"password",placeholder:l?"Paste your GitHub PAT":"Enter access token...",...c,value:c.value||"",className:"h-10 rounded-lg"})}),l&&t.jsxs(ft,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(W,{})]})})]})}function ps(s){return s.command==="npx"}function fs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function hs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function he(s,e){const n={title:s.title,description:s.description??"",icon:s.icon??null,configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&Le(s.connection_headers)){const a=s.connection_headers,r=Ge(a.envVars);if(ps(a)){const i=fs(a);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:i,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const o=hs(a);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:o.command,stdio_args:o.args,stdio_cwd:o.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function gs(s){let e,n=null,a=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Xe(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ke(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",a=s.connection_token||null),{title:s.title,description:s.description||null,icon:s.icon??null,connection_type:e,connection_url:n,...a&&{connection_token:a},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function js({connection:s,connectionId:e,org:n,isUpdating:a,tools:r,prompts:o,resources:i,siblings:d}){const l=Y({from:"/$org/settings/connections/$appSlug"}),x=Ve(),m=_e(),{org:p}=J(),c=gt({onSuccess:()=>{d.length<=1&&l({to:"/$org/settings/connections",params:{org:n}})}}),[h,g]=X.useState(null),[v,b]=X.useState(!1),j=Ne({connectionId:e}),{data:N}=Ze(),T=N?.data?.members??[],C=h??s,y=T.find(u=>u.userId===C.created_by),_=s?.connection_type==="VIRTUAL"||j.isAuthenticated,k={...s,tools:r},S=Qe(k,Wt),f=Ue({resolver:Fe(qe),values:he(h??s)}),w=f.formState.isDirty,M=async()=>{if(!await f.trigger())return;const D=f.getValues(),$=gs(D),F=h?.id??e;await m.update.mutateAsync({id:F,data:$}),f.reset(D)},O=()=>{f.reset(he(h??s))},A=async u=>{const{token:D,tokenInfo:$,error:F}=await He({connectionId:u,orgSlug:p.slug,scope:"offline_access"});if(F||!D){G.error(`Authentication failed: ${F}`);return}if($)try{const K=await fetch(`/api/${p.slug}/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:$.accessToken,refreshToken:$.refreshToken,expiresIn:$.expiresIn,scope:$.scope,clientId:$.clientId,clientSecret:$.clientSecret,tokenEndpoint:$.tokenEndpoint})});if(!K.ok)console.error("Failed to save OAuth token:",await K.text()),await m.update.mutateAsync({id:u,data:{connection_token:D}});else try{await m.update.mutateAsync({id:u,data:{}})}catch(Z){console.warn("Failed to refresh connection tools after OAuth:",Z)}}catch(K){console.error("Error saving OAuth token:",K),await m.update.mutateAsync({id:u,data:{connection_token:D}})}else await m.update.mutateAsync({id:u,data:{connection_token:D}});const Q=new URL(`/api/${p.slug}/mcp/${u}`,window.location.origin);await x.invalidateQueries({queryKey:ne.isMCPAuthenticated(Q.href,null)}),await x.invalidateQueries({queryKey:ne.mcpClientPrefix()}),G.success("Authentication successful")},z=()=>A(s.id),U=async()=>{try{const u=await fetch(`/api/${p.slug}/connections/${s.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!u.ok){const $=await u.text();G.error(`Failed to remove OAuth: ${$}`);return}const D=new URL(`/api/${p.slug}/mcp/${s.id}`,window.location.origin);await x.invalidateQueries({queryKey:ne.isMCPAuthenticated(D.href,null)}),G.success("OAuth removed. You can now re-authenticate with a different account.")}catch(u){console.error("Error removing OAuth token:",u),G.error("Failed to remove OAuth")}};return t.jsxs(t.Fragment,{children:[t.jsx(jt,{...c}),t.jsx(dt,{open:h!==null,onOpenChange:u=>{u||g(null)},children:t.jsxs(mt,{side:"right",className:"sm:max-w-[520px] p-0 flex flex-col gap-0 overflow-hidden",children:[t.jsxs(ut,{className:"px-4 py-3 md:px-6 md:py-4 border-b border-border shrink-0",children:[t.jsx(xt,{className:"text-base",children:h?.title??s.title}),t.jsx(pt,{className:"text-xs",children:"Update URL, authentication, and other settings"}),y&&t.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:"Connected by"}),t.jsx(et,{url:y.user?.image??void 0,fallback:y.user?.name??y.user?.email??"?",size:"3xs",shape:"circle"}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:y.user?.name||y.user?.email})]})]}),t.jsxs(ht,{...f,children:[t.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-3 md:px-6 md:py-5 flex flex-col gap-4 md:gap-6",children:[t.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.jsx(L,{control:f.control,name:"title",render:({field:u})=>t.jsxs(H,{children:[t.jsx(B,{children:"Name"}),t.jsx(E,{children:t.jsx(q,{...u})}),t.jsx(W,{})]})}),t.jsx(L,{control:f.control,name:"description",render:({field:u})=>t.jsxs(H,{children:[t.jsx(B,{children:"Description"}),t.jsx(E,{children:t.jsx(q,{...u,value:u.value||""})}),t.jsx(W,{})]})})]}),t.jsx(xs,{form:f,connection:h??s,hasOAuthToken:j.hasOAuthToken,onReauthenticate:z,onRemoveOAuth:U}),t.jsx(Je,{connection:h??s,form:f,hasMcpBinding:S,isMCPAuthenticated:_,supportsOAuth:j.supportsOAuth,isServerError:j.isServerError,onAuthenticate:z,onViewReadme:void 0})]}),t.jsxs("div",{className:"px-6 py-4 border-t border-border flex gap-2 shrink-0",children:[t.jsx(V,{onClick:M,disabled:!w||a,className:"flex-1",children:a?"Saving…":"Save changes"}),w&&t.jsx(V,{variant:"outline",onClick:O,children:"Undo"}),t.jsxs(V,{variant:"outline",className:"gap-2 text-muted-foreground hover:text-destructive hover:border-destructive",onClick:()=>{const u=h??s;g(null),c.requestDelete(u)},children:[t.jsx(re,{size:15}),"Delete"]})]})]},h?.id??s.id)]})}),t.jsx(vt,{hideHeader:!0,children:t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[t.jsx(us,{connection:s,displayTitle:(()=>{const u=d[0]??s;return u.app_name?u.title.replace(/\s*\(\d+\)\s*$/,""):u.title})()}),t.jsx("div",{className:"flex-1 overflow-auto @container",children:t.jsxs("div",{className:"grid grid-cols-1 @3xl:grid-cols-2 gap-5 p-6",children:[t.jsx(ss,{connectionId:e}),t.jsxs("div",{className:"flex flex-col gap-5",children:[t.jsx(Xt,{instances:d,onConfigure:u=>g(u),onAuthenticate:u=>A(u.id),onDelete:u=>c.requestDelete(u),onToggleStatus:async(u,D)=>{try{await m.update.mutateAsync({id:u.id,data:{status:D}}),G.success(D==="active"?"Connection enabled":"Connection disabled")}catch{G.error("Failed to update connection")}},isAdding:v,onAdd:async()=>{b(!0);try{const u=d[0]??s,D=u.title.replace(/\s*\(\d+\)\s*$/,""),$=d.length+1,F=`${D} (${$})`,Q=Be("conn");await m.create.mutateAsync({id:Q,title:F,description:u.description??null,connection_type:u.connection_type,connection_url:u.connection_url??null,connection_token:null,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:u.created_by,organization_id:u.organization_id,icon:u.icon??null,app_name:u.app_name??null,app_id:u.app_id??null,connection_headers:u.connection_headers??null,oauth_config:null,configuration_state:u.configuration_state??null,metadata:null,tools:null,bindings:null,status:"inactive"});const K=new URL(`/api/${p.slug}/mcp/${Q}`,window.location.origin),Z=await Re({url:K.href,token:null,orgId:p.id});Z.supportsOAuth&&!Z.isAuthenticated&&await A(Q)}finally{b(!1)}}}),t.jsx(is,{connection:s})]}),t.jsx("div",{className:"@3xl:col-span-2",children:t.jsx(ls,{tools:r,prompts:o,resources:i,connectionId:e,org:n})})]})})]})})]})}function vs(){const s=P.c(39);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/settings/connections/$appSlug"},s[0]=e):e=s[0];const n=Y(e);let a;s[1]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org/settings/connections/$appSlug"},s[1]=a):a=s[1];const{appSlug:r,org:o}=ze(a),{org:i}=J(),d=_e();let l;s[2]!==r?(l={slug:r},s[2]=r,s[3]=l):l=s[3];const x=tt(l),m=x[0]??null,p=m?.id??"",c=p||null;let h;s[4]!==i.id||s[5]!==i.slug||s[6]!==c?(h={connectionId:c,orgId:i.id,orgSlug:i.slug},s[4]=i.id,s[5]=i.slug,s[6]=c,s[7]=h):h=s[7];const g=ae(h);let v;s[8]!==g?(v={client:g},s[8]=g,s[9]=v):v=s[9];const{data:b}=nt(v);let j;if(s[10]!==m?.tools||s[11]!==p||s[12]!==x||s[13]!==b){const A=b?b.tools.map(Cs):(m?.tools??[]).map(Ss);e:{if(x.length<=1){j=A;break e}const z=new Set,U=[],u=ys;for(const D of x){const $=D.id===p?A:u(D.tools);for(const F of $)z.has(F.name)||(z.add(F.name),U.push(F))}j=U.length>0?U:A}s[10]=m?.tools,s[11]=p,s[12]=x,s[13]=b,s[14]=j}else j=s[14];const N=j;let T;s[15]!==g?(T={client:g},s[15]=g,s[16]=T):T=s[16];const{data:C}=ot(T);let y;s[17]!==g?(y={client:g},s[17]=g,s[18]=y):y=s[18];const{data:I}=Ee(y);let _;s[19]!==C?.prompts?(_=C?.prompts??[],s[19]=C?.prompts,s[20]=_):_=s[20];let k;s[21]!==_?(k=_.map(Ns),s[21]=_,s[22]=k):k=s[22];const S=k;let f;s[23]!==I?.resources?(f=I?.resources??[],s[23]=I?.resources,s[24]=f):f=s[24];let w;s[25]!==f?(w=f.map(bs),s[25]=f,s[26]=w):w=s[26];const M=w;if(!m){let A;return s[27]!==n||s[28]!==o?(A=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(be,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(V,{variant:"outline",onClick:()=>n({to:"/$org/settings/connections",params:{org:o}}),children:"Back to connections"})})}),s[27]=n,s[28]=o,s[29]=A):A=s[29],A}let O;return s[30]!==d.update.isPending||s[31]!==N||s[32]!==m||s[33]!==p||s[34]!==o||s[35]!==S||s[36]!==M||s[37]!==x?(O=t.jsx(js,{org:o,connection:m,connectionId:p,isUpdating:d.update.isPending,tools:N,prompts:S,resources:M,siblings:x}),s[30]=d.update.isPending,s[31]=N,s[32]=m,s[33]=p,s[34]=o,s[35]=S,s[36]=M,s[37]=x,s[38]=O):O=s[38],O}function bs(s){return{name:s.name,description:s.description,uri:s.uri}}function Ns(s){return{name:s.name,description:s.description}}function ys(s){return(s??[]).map(_s)}function _s(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema??{},outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Ss(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function Cs(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema,outputSchema:s.outputSchema,annotations:s.annotations,_meta:s._meta}}function ws(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(Me,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(je,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(vs,{})})}),s[0]=e):e=s[0],e}function lo(){const s=P.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(ws,{}),s[0]=e):e=s[0],e}export{lo as default};
@@ -1 +0,0 @@
1
- import{e as ce,j as t,E as tt,r as X,l as le,q as ke,f as De,d as nt,b as Ae,u as st,p as ot,L as it,H as at,I as ct,B as z,t as ne,G as rt,c as de,o as W,M as lt,J as dt,K as mt}from"./index-biiHZ5l9.js";import{g as ut}from"./generate-id-CadHbHqX.js";import{C as pt}from"./collection-display-button-BfQyXSIv.js";import{S as ht}from"./search-input-BgGthWir.js";import{C as xt}from"./collection-tabs-CQJiHDMR.js";import{u as gt,a as we,g as ft,C as ve}from"./connection-card-EXvV7rxl.js";import{E as jt}from"./empty-state-1AbmTLd7.js";import{I as yt}from"./integration-icon-Dy-a3x5R.js";import{P as pe}from"./index-r7-3fAFf.js";import{u as Ct,D as vt}from"./use-delete-connection-C60uGs0b.js";import{u as Ce}from"./use-capability-BPM45mbW.js";import{u as _t}from"./use-infinite-scroll-xQQ6lYk4.js";import{u as St}from"./use-list-state-BZmeG7gi.js";import{g as Te,a as bt,e as Nt}from"./extract-connection-data-LoMqboL3.js";import{g as xe}from"./connection-slug-eyAPH6o3.js";import{c as Ie,d as Pe,b as Le,f as Oe,e as $e,g as Ee,a as Me,A as ze}from"./alert-dialog-CSkQIwm8.js";import{C as Fe}from"./checkbox--nDaSUZE.js";import{D as Ve,a as Be,b as Re,c as Ue,e as He,d as Ke}from"./dialog-Bm1pP7Vu.js";import{b as kt,a as Dt,c as At,D as wt,d as Tt,e as It,f as Pt}from"./drawer-B51jkLaX.js";import{u as Lt}from"./tooltip-bsrBmmjV.js";import{D as We,a as Xe,b as qe,c as ae}from"./dropdown-menu-CIu58K9q.js";import{F as J,b as Y,c as Z,d as ee,f as te,a as be}from"./form-BcPtow5O.js";import{I as ie}from"./input-5PMMNPU9.js";import{d as Ot,S as $t,a as Et,b as Mt,c as re}from"./select-CNSUv3cw.js";import{T as zt}from"./textarea-QEULyLXh.js";import{b as Ge,u as Ft}from"./use-connection-DyJtuHQI.js";import{u as Vt,S as Bt}from"./use-mcp-client-CWFUu1lY.js";import{a as Rt}from"./use-virtual-mcp-0jbEmvOc.js";import{R as Ut,a4 as Ht,s as Kt,q as Wt}from"./agent-icon-DT8dQ9tq.js";import{n as ge}from"./Container-CYcITvPW.js";import{i as Qe}from"./DotsVertical-SvwN4CeV.js";import{s as Je}from"./Eye-ByuwKsdh.js";import{s as ye}from"./Star01-eRdSY4QW.js";import{s as Ye}from"./Plus-CjrtKB-Y.js";import{s as Ze}from"./Trash01-Cup7-ZTT.js";import{s as et}from"./XClose-pR-QU0OQ.js";import{i as he,a as Ne,E as Xt,c as qt,p as Gt,b as Qt,d as Jt}from"./connection-form-helpers-DoJomSCQ.js";import"./collections-C_j8CeI8.js";import"./SwitchHorizontal01-BMnNI1Fi.js";import"./Check-D-9dblUn.js";import"./view-mode-toggle-G0qNMbJ1.js";import"./badge-Da0IsrqH.js";import"./SearchMd-BL2y99rx.js";import"./use-registry-connections-C-WVKjSU.js";import"./use-organization-settings-Izqk1Gkk.js";import"./useInfiniteQuery-BGg7INCQ.js";import"./infiniteQueryObserver-B0VBGXv5.js";import"./card-BUTabNLA.js";import"./sidebar-CPZXU-2w.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./sheet-D99KevZC.js";import"./X-1KR4wibP.js";import"./use-view-mode-CbT8E3wV.js";import"./ChevronRight-CrZy8tHx.js";import"./label-CcC4_aKf.js";import"./ChevronDown-Cf2Q-GlB.js";import"./ChevronUp-BAxoXhnT.js";import"./use-collections-B5Jh_wGd.js";import"./AlertCircle-9EFUZenf.js";import"./Tool01-Dcq7KP8Y.js";import"./RefreshCcw01-3BsQQkRx.js";import"./XCircle-UPVnJx4i.js";import"./ArrowUpRight-97355q5v.js";import"./ZapSquare-B1o2Q9OR.js";import"./Users03-BlNe2PnN.js";import"./CheckCircle-C2ualSpf.js";import"./ChevronLeft-BaV4nFMQ.js";import"./ZoomOut-D8vQ49we.js";import"./Globe01-DfGFlik1.js";import"./FilterLines-BJZdiggU.js";import"./Palette-Druykvzw.js";import"./HardDrive-DNFvbooP.js";import"./Stars02-EuAFDZ5E.js";import"./Key01-CzmPnHuw.js";import"./LinkExternal01-CgI1VTqi.js";import"./Monitor01-Cw6kmClm.js";import"./Sun-CH2HWLCn.js";import"./Play-CMJ2IWYR.js";import"./Settings02-Cd4DIqaJ.js";import"./Shield01-zIbMct6w.js";import"./Stars01-v0yz6PCZ.js";import"./Upload01-C9yi1Bdg.js";import"./User01-thAIxsAs.js";import"./Users01-DPJm6-u-.js";import"./Zap-Cl-JM7N9.js";function Yt(v){const e=ce.c(51),{group:n,onOpen:p,selectionMode:u,selectedIds:m,onToggleSelect:c}=v;let h;if(e[0]!==n.connections||e[1]!==m){let C;e[3]!==m?(C=P=>m.has(P.id),e[3]=m,e[4]=C):C=e[4],h=n.connections.every(C),e[0]=n.connections,e[1]=m,e[2]=h}else h=e[2];const g=h;let y;if(e[5]!==n.connections||e[6]!==m){let C;e[8]!==m?(C=P=>m.has(P.id),e[8]=m,e[9]=C):C=e[9],y=n.connections.some(C),e[5]=n.connections,e[6]=m,e[7]=y}else y=e[7];const x=y,b=`${n.connections.length} instances`;let N;e[10]!==n.icon||e[11]!==n.title||e[12]!==b?(N={title:n.title,icon:n.icon,description:b},e[10]=n.icon,e[11]=n.title,e[12]=b,e[13]=N):N=e[13];let l;e[14]!==g||e[15]!==n.connections||e[16]!==p||e[17]!==c||e[18]!==m||e[19]!==u?(l=()=>u?(()=>{for(const C of n.connections)g?m.has(C.id)&&c(C.id):m.has(C.id)||c(C.id)})():p(),e[14]=g,e[15]=n.connections,e[16]=p,e[17]=c,e[18]=m,e[19]=u,e[20]=l):l=e[20];const j=u&&g&&"ring-2 ring-primary",d=u&&x&&!g&&"ring-1 ring-primary/50";let k;e[21]!==j||e[22]!==d?(k=de(j,d),e[21]=j,e[22]=d,e[23]=k):k=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(ge,{}),e[24]=_):_=e[24];let D;e[25]!==g||e[26]!==n.connections||e[27]!==c||e[28]!==m||e[29]!==u||e[30]!==x?(D=u?t.jsx(Fe,{checked:g?!0:x?"indeterminate":!1,onCheckedChange:()=>{for(const C of n.connections)g?m.has(C.id)&&c(C.id):m.has(C.id)||c(C.id)}}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsxs("span",{className:"text-xs text-muted-foreground font-normal tabular-nums",children:["x",n.connections.length]})]}),e[25]=g,e[26]=n.connections,e[27]=c,e[28]=m,e[29]=u,e[30]=x,e[31]=D):D=e[31];const R=u?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100";let F;e[32]!==R?(F=de("overflow-hidden transition-all duration-150 ease-out",R),e[32]=R,e[33]=F):F=e[33];let s;e[34]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx(Xe,{asChild:!0,children:t.jsx(z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:en,children:t.jsx(Qe,{size:20})})}),e[34]=s):s=e[34];let A;e[35]!==p?(A=C=>{C.stopPropagation(),p()},e[35]=p,e[36]=A):A=e[36];let V;e[37]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsx(Je,{size:16}),e[37]=V):V=e[37];let $;e[38]!==A?($=t.jsxs(We,{children:[s,t.jsx(qe,{align:"end",onClick:Zt,children:t.jsxs(ae,{onClick:A,children:[V,"Open"]})})]}),e[38]=A,e[39]=$):$=e[39];let w;e[40]!==F||e[41]!==$?(w=t.jsx("div",{className:F,children:$}),e[40]=F,e[41]=$,e[42]=w):w=e[42];let L;e[43]!==D||e[44]!==w?(L=t.jsxs("div",{className:"flex items-center gap-1",children:[D,w]}),e[43]=D,e[44]=w,e[45]=L):L=e[45];let B;return e[46]!==L||e[47]!==N||e[48]!==l||e[49]!==k?(B=t.jsx(t.Fragment,{children:t.jsx(ve,{connection:N,onClick:l,className:k,fallbackIcon:_,headerActionsAlwaysVisible:!0,headerActions:L})}),e[46]=L,e[47]=N,e[48]=l,e[49]=k,e[50]=B):B=e[50],B}function Zt(v){return v.stopPropagation()}function en(v){return v.stopPropagation()}function tn(v){const e=ce.c(23),{count:n,total:p,canManage:u,canManageAgents:m,onSelectAll:c,onDeselectAll:h,onDelete:g,onAddToAgent:y,onToggleStatus:x,onCancel:b}=v;if(n===0)return null;let N;e[0]!==n?(N=t.jsxs("div",{className:"text-xs text-muted-foreground pr-1 tabular-nums",children:[n," selected"]}),e[0]=n,e[1]=N):N=e[1];let l;e[2]!==n||e[3]!==h||e[4]!==c||e[5]!==p?(l=n<p?t.jsxs(z,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:c,children:["Select all (",p,")"]}):t.jsx(z,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:h,children:"Clear selection"}),e[2]=n,e[3]=h,e[4]=c,e[5]=p,e[6]=l):l=e[6];let j;e[7]!==m||e[8]!==y?(j=m&&t.jsxs(z,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:y,children:[t.jsx(Ye,{size:13}),"Add to Agent"]}),e[7]=m,e[8]=y,e[9]=j):j=e[9];let d;e[10]!==u||e[11]!==g||e[12]!==x?(d=u&&t.jsxs(t.Fragment,{children:[t.jsx(z,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>x("active"),children:"Enable"}),t.jsx(z,{variant:"outline",size:"sm",className:"h-7 text-xs px-2",onClick:()=>x("inactive"),children:"Disable"}),t.jsxs(z,{variant:"destructive",size:"sm",className:"h-7 text-xs px-2",onClick:g,children:[t.jsx(Ze,{size:13}),"Delete"]})]}),e[10]=u,e[11]=g,e[12]=x,e[13]=d):d=e[13];let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx(et,{size:13}),e[14]=k):k=e[14];let _;e[15]!==b?(_=t.jsx(z,{variant:"ghost",size:"sm",className:"h-7 text-xs px-2",onClick:b,children:k}),e[15]=b,e[16]=_):_=e[16];let D;return e[17]!==N||e[18]!==l||e[19]!==j||e[20]!==d||e[21]!==_?(D=t.jsx("div",{className:"fixed bottom-4 left-1/2 z-50 -translate-x-1/2",children:t.jsxs("div",{className:"rounded-xl border border-border bg-background/95 shadow-lg backdrop-blur px-3 py-2 flex items-center gap-2",children:[N,l,j,d,_]})}),e[17]=N,e[18]=l,e[19]=j,e[20]=d,e[21]=_,e[22]=D):D=e[22],D}function nn(v){const e=ce.c(25),{open:n,onOpenChange:p,agents:u,onConfirm:m}=v,[c,h]=X.useState(null);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsxs(Re,{children:[t.jsx(Ue,{children:"Add to Agent"}),t.jsx(He,{children:"Select an agent to add the selected connections to."})]}),e[0]=g):g=e[0];let y;e[1]!==u||e[2]!==c?(y=u.length===0?t.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No agents found"}):u.map(D=>t.jsxs("button",{type:"button",onClick:()=>h(D.id),className:de("flex items-center gap-3 w-full rounded-md px-3 py-2 text-left transition-colors",c===D.id?"bg-primary/10 ring-1 ring-primary":"hover:bg-muted/50"),children:[t.jsx(yt,{icon:D.icon,name:D.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:D.title}),D.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.description})]})]},D.id)),e[1]=u,e[2]=c,e[3]=y):y=e[3];let x;e[4]!==y?(x=t.jsx("div",{className:"max-h-60 overflow-auto py-2 space-y-1",children:y}),e[4]=y,e[5]=x):x=e[5];let b;e[6]!==p?(b=t.jsx(z,{variant:"outline",onClick:()=>p(!1),children:"Cancel"}),e[6]=p,e[7]=b):b=e[7];const N=!c;let l;e[8]!==m||e[9]!==p||e[10]!==c?(l=()=>{c&&(m(c),p(!1),h(null))},e[8]=m,e[9]=p,e[10]=c,e[11]=l):l=e[11];let j;e[12]!==N||e[13]!==l?(j=t.jsx(z,{disabled:N,onClick:l,children:"Add"}),e[12]=N,e[13]=l,e[14]=j):j=e[14];let d;e[15]!==b||e[16]!==j?(d=t.jsxs(Ke,{children:[b,j]}),e[15]=b,e[16]=j,e[17]=d):d=e[17];let k;e[18]!==x||e[19]!==d?(k=t.jsxs(Be,{className:"sm:max-w-[400px]",children:[g,x,d]}),e[18]=x,e[19]=d,e[20]=k):k=e[20];let _;return e[21]!==p||e[22]!==n||e[23]!==k?(_=t.jsx(Ve,{open:n,onOpenChange:p,children:k}),e[21]=p,e[22]=n,e[23]=k,e[24]=_):_=e[24],_}function sn(v){const e=ce.c(20),{open:n,onOpenChange:p,count:u,onConfirm:m}=v,c=u!==1?"s":"";let h;e[0]!==u||e[1]!==c?(h=t.jsxs(Ie,{children:["Delete ",u," connection",c,"?"]}),e[0]=u,e[1]=c,e[2]=h):h=e[2];const g=u!==1?"s":"";let y;e[3]!==g?(y=t.jsxs(Pe,{children:["This will permanently delete the selected connection",g,". This action cannot be undone."]}),e[3]=g,e[4]=y):y=e[4];let x;e[5]!==h||e[6]!==y?(x=t.jsxs(Le,{children:[h,y]}),e[5]=h,e[6]=y,e[7]=x):x=e[7];let b;e[8]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx(Oe,{children:"Cancel"}),e[8]=b):b=e[8];const N=u!==1?"s":"";let l;e[9]!==u||e[10]!==m||e[11]!==N?(l=t.jsxs($e,{children:[b,t.jsxs(Ee,{onClick:m,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:["Delete ",u," connection",N]})]}),e[9]=u,e[10]=m,e[11]=N,e[12]=l):l=e[12];let j;e[13]!==x||e[14]!==l?(j=t.jsxs(Me,{children:[x,l]}),e[13]=x,e[14]=l,e[15]=j):j=e[15];let d;return e[16]!==p||e[17]!==n||e[18]!==j?(d=t.jsx(ze,{open:n,onOpenChange:p,children:j}),e[16]=p,e[17]=n,e[18]=j,e[19]=d):d=e[19],d}function on(v){return v._registryId?.includes("community-registry")===!0}function an(v){const e=ce.c(58),{item:n,canManage:p,allConnections:u,connectedAppNames:m,connectingItemId:c,onNavigateConnected:h,onConnect:g}=v,[y,x]=X.useState(!1),[b,N]=X.useState(null);let l,j;e[0]!==m||e[1]!==n?(l=Te(n)??"",j=m.has(l),e[0]=m,e[1]=n,e[2]=l,e[3]=j):(l=e[2],j=e[3]);const d=j,k=n._meta?.["mcp.mesh"],_=k?.friendlyName||k?.friendly_name||n.server?.title||n.title||n.server?.name||n.name||n.id||"",D=n.server?.description||n.description||null;let R;e[4]!==n.server?.icons?.[0]?.src||e[5]!==n.server?.repository?(R=n.server?.icons?.[0]?.src||bt(n.server?.repository)||null,e[4]=n.server?.icons?.[0]?.src,e[5]=n.server?.repository,e[6]=R):R=e[6];const F=R;let s;if(e[7]!==u||e[8]!==l){let S;e[10]!==l?(S=se=>se.connection_type!=="VIRTUAL"&&se.app_name===l,e[10]=l,e[11]=S):S=e[11],s=u.filter(S),e[7]=u,e[8]=l,e[9]=s}else s=e[9];const A=s;let V;e[12]!==n?(V=on(n),e[12]=n,e[13]=V):V=e[13];const $=V;let w,L;e[14]!==A||e[15]!==p||e[16]!==$||e[17]!==d||e[18]!==n||e[19]!==g||e[20]!==h?(w=()=>{if(d){const S=A[0];S&&h(S);return}p&&L()},L=()=>{$?(N("connect"),x(!0)):g(n)},e[14]=A,e[15]=p,e[16]=$,e[17]=d,e[18]=n,e[19]=g,e[20]=h,e[21]=w,e[22]=L):(w=e[21],L=e[22]);let B;e[23]!==n||e[24]!==g||e[25]!==b?(B=()=>{ne("connections_community_warning_confirmed",{registry_item_id:n.id}),x(!1),b==="connect"&&g(n),N(null)},e[23]=n,e[24]=g,e[25]=b,e[26]=B):B=e[26];const C=B;let P;e[27]!==D||e[28]!==F||e[29]!==_?(P={title:_,description:D,icon:F},e[27]=D,e[28]=F,e[29]=_,e[30]=P):P=e[30];let Q;e[31]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(ge,{}),e[31]=Q):Q=e[31];let H;e[32]!==$||e[33]!==n._sourceIcon?(H=$&&n._sourceIcon&&t.jsx("img",{src:n._sourceIcon,alt:"Community",className:"size-4 rounded-sm object-contain"}),e[32]=$,e[33]=n._sourceIcon,e[34]=H):H=e[34];let q;e[35]!==p||e[36]!==c||e[37]!==L||e[38]!==d||e[39]!==n.id?(q=d?t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}):p&&t.jsx(z,{variant:"outline",size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",disabled:c!==null,onClick:S=>{S.stopPropagation(),L()},children:c===n.id?t.jsx(le,{size:14,className:"animate-spin"}):"Connect"}),e[35]=p,e[36]=c,e[37]=L,e[38]=d,e[39]=n.id,e[40]=q):q=e[40];let i;e[41]!==H||e[42]!==q?(i=t.jsxs("div",{className:"flex items-center gap-2",children:[H,q]}),e[41]=H,e[42]=q,e[43]=i):i=e[43];let f;e[44]!==w||e[45]!==i||e[46]!==P?(f=t.jsx(ve,{connection:P,fallbackIcon:Q,onClick:w,headerActionsAlwaysVisible:!0,headerActions:i}),e[44]=w,e[45]=i,e[46]=P,e[47]=f):f=e[47];let O;e[48]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsxs(Le,{children:[t.jsx(Ie,{children:"Community MCP Server"}),t.jsx(Pe,{children:"This MCP server is from the Community MCP Registry and is not maintained or verified by Deco. Community servers may have varying levels of quality, security, and reliability. Proceed with caution and review the server details before connecting."})]}),e[48]=O):O=e[48];let U;e[49]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx(Oe,{children:"Cancel"}),e[49]=U):U=e[49];let E;e[50]!==C?(E=t.jsxs(Me,{children:[O,t.jsxs($e,{children:[U,t.jsx(Ee,{onClick:C,children:"Continue"})]})]}),e[50]=C,e[51]=E):E=e[51];let r;e[52]!==y||e[53]!==E?(r=t.jsx(ze,{open:y,onOpenChange:x,children:E}),e[52]=y,e[53]=E,e[54]=r):r=e[54];let I;return e[55]!==f||e[56]!==r?(I=t.jsxs(t.Fragment,{children:[f,r]}),e[55]=f,e[56]=r,e[57]=I):I=e[57],I}function cn({listState:v,activeTab:e,typeFilter:n,statusFilter:p,registryFilter:u,enabledRegistries:m}){const{org:c}=ke(),h=rt(),g=De(),{data:y}=Ae.useSession(),x=Ge(),b=Ft(v),N=Ct(),{granted:l}=Ce("connections:manage"),{granted:j}=Ce("agents:manage"),[d,k]=X.useState(new Set),_=d.size>0,[D,R]=X.useState(!1),[F,s]=X.useState(!1),[A,V]=X.useState(null),$=Rt(),w=b.filter(o=>!(n!=="ALL"&&o.connection_type!==n||p!=="ALL"&&o.status!==p)),L=ft(w),B=o=>{k(a=>{const M=new Set(a);return M.has(o)?M.delete(o):M.add(o),M})},C=()=>{k(new Set)},P=we(m,v.searchTerm),Q=P.items,H=_t(P.loadMore,P.hasMore,P.isLoadingMore),q=new Set(b.filter(o=>o.app_name).map(o=>o.app_name)),i=u==="ALL"||m.some(o=>o.id===u)?u:"ALL",f=v.search.length>0,O=e==="all"||f?Q.filter(o=>{if(i!=="ALL"&&o._registryId!==i)return!1;if(f){const a=Te(o);if(a&&q.has(a))return!1}return!0}):[],U=e==="connected"||f?L:[],E=async o=>{if(!(!c||!y?.user?.id)){ne("connection_add_clicked",{action:"connect_new",registry_item_id:o.id,source:"connections_page"}),V(o.id);try{const a=Nt(o,c.id,y.user.id,{remoteIndex:0}),M=a.connection_type==="STDIO",T=!!a.connection_url,G=M&&a.connection_headers&&typeof a.connection_headers=="object"&&"command"in a.connection_headers;if(!T&&!G){W.error("This MCP Server cannot be connected: no connection method available"),V(null);return}const{id:K}=await x.create.mutateAsync(a),_e=new URL(`/api/${c.slug}/mcp/${K}`,window.location.origin),Se=await lt({url:_e.href,token:null,orgId:c.id});if(Se.supportsOAuth&&!Se.isAuthenticated){const{token:ue,tokenInfo:oe,error:je}=await dt({connectionId:K,orgSlug:c.slug,scope:"offline_access"});if(je||!ue){ne("connection_oauth_failed",{connection_id:K,flow:"connections_page_connect",error:je??"no_token"}),W.error(`Authentication failed: ${je??"no token received"}`);return}else{if(ne("connection_oauth_succeeded",{connection_id:K,flow:"connections_page_connect"}),oe)try{(await fetch(`/api/${c.slug}/connections/${K}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:oe.accessToken,refreshToken:oe.refreshToken,expiresIn:oe.expiresIn,scope:oe.scope,clientId:oe.clientId,clientSecret:oe.clientSecret,tokenEndpoint:oe.tokenEndpoint})})).ok?await x.update.mutateAsync({id:K,data:{}}):await x.update.mutateAsync({id:K,data:{connection_token:ue}})}catch{await x.update.mutateAsync({id:K,data:{connection_token:ue}})}else await x.update.mutateAsync({id:K,data:{connection_token:ue}});await h.invalidateQueries({queryKey:mt.isMCPAuthenticated(_e.href,null)}),W.success("Authentication successful")}}W.success("Connected successfully")}catch(a){W.error(`Failed to connect: ${a instanceof Error?a.message:String(a)}`)}finally{V(null)}}},r=Vt({connectionId:Bt,orgId:c.id,orgSlug:c.slug}),I=()=>{h.invalidateQueries({predicate:o=>{const a=o.queryKey;return a[1]===c.id&&a[3]==="collection"&&a[4]==="CONNECTIONS"}})},S=async()=>{R(!1);const o=[...d];ne("connections_bulk_delete",{count:o.length});let a=0;for(const M of o)try{(await r.callTool({name:"COLLECTION_CONNECTIONS_DELETE",arguments:{id:M,force:!0}})).isError||a++}catch{}I(),W.success(`Deleted ${a} connection${a!==1?"s":""}`),C()},se=async(o,a)=>{try{await x.update.mutateAsync({id:o,data:{status:a}}),I(),W.success(a==="active"?"Connection enabled":"Connection disabled")}catch{W.error("Failed to update connection")}},fe=async o=>{const a=[...d];ne("connections_bulk_status_toggled",{count:a.length,to_status:o});let M=0;for(const T of a)try{await x.update.mutateAsync({id:T,data:{status:o}}),M++}catch{}I(),W.success(`${o==="active"?"Enabled":"Disabled"} ${M} connection${M!==1?"s":""}`),C()},me=async o=>{const a=$.find(G=>G.id===o);if(!a||!r)return;ne("connections_bulk_add_to_agent",{agent_id:o,count:d.size});const M=new Set(a.connections.map(G=>G.connection_id)),T=[...d].filter(G=>!M.has(G)).map(G=>({connection_id:G,selected_tools:null,selected_resources:null,selected_prompts:null}));if(T.length===0){W.info("All selected connections are already in that agent");return}try{await r.callTool({name:"COLLECTION_VIRTUAL_MCP_UPDATE",arguments:{id:o,data:{connections:[...a.connections,...T]}}}),h.invalidateQueries({predicate:G=>{const K=G.queryKey;return K[1]===c.id&&K[3]==="collection"&&K[4]==="VIRTUAL_MCP"}}),W.success(`Added ${T.length} connection${T.length!==1?"s":""} to "${a.title}"`),C()}catch{W.error("Failed to add connections to agent")}};return t.jsxs(t.Fragment,{children:[t.jsx(vt,{...N}),t.jsx(sn,{open:D,onOpenChange:R,count:d.size,onConfirm:S}),t.jsx(nn,{open:F,onOpenChange:s,agents:$,onConfirm:me}),P.isInitialLoading&&e==="all"?t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}):t.jsx("div",{children:(f?O.length===0&&w.length===0:e==="all"?O.length===0:w.length===0)?t.jsx(jt,{image:t.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:"No Connections found",description:v.search?`No Connections match "${v.search}"`:l?"Create a connection to get started.":"Ask an organization admin to add one."}):t.jsxs("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] gap-4",children:[U.map(o=>{if(o.type==="group")return t.jsx(Yt,{group:o,onOpen:()=>{g({to:"/$org/settings/connections/$appSlug",params:{org:c.slug,appSlug:o.key}})},selectionMode:_,selectedIds:d,onToggleSelect:B},o.key);const a=o.connection,M=d.has(a.id);return t.jsx(ve,{connection:a,fallbackIcon:t.jsx(ge,{}),onClick:()=>_?B(a.id):g({to:"/$org/settings/connections/$appSlug",params:{org:c.slug,appSlug:xe(a)}}),className:de(M&&"ring-2 ring-primary bg-primary/5"),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1",children:[_?t.jsx(Fe,{checked:M,onCheckedChange:()=>B(a.id),onClick:T=>T.stopPropagation()}):t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Connected"}),t.jsx("div",{className:de("overflow-hidden transition-all duration-150 ease-out",_?"w-8 opacity-100":"w-0 opacity-0 group-hover:w-8 group-hover:opacity-100"),children:t.jsxs(We,{children:[t.jsx(Xe,{asChild:!0,children:t.jsx(z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:T=>T.stopPropagation(),children:t.jsx(Qe,{size:20})})}),t.jsxs(qe,{align:"end",onClick:T=>T.stopPropagation(),children:[t.jsxs(ae,{onClick:T=>{T.stopPropagation(),g({to:"/$org/settings/connections/$appSlug",params:{org:c.slug,appSlug:xe(a)}})},children:[t.jsx(Je,{size:16}),"Open"]}),(l||j)&&t.jsxs(ae,{onClick:T=>{T.stopPropagation(),B(a.id)},children:[t.jsx(Ht,{size:16}),"Select"]}),l&&(a.status==="active"?t.jsxs(ae,{onClick:T=>{T.stopPropagation(),se(a.id,"inactive")},children:[t.jsx(Kt,{size:16}),"Disable"]}):t.jsxs(ae,{onClick:T=>{T.stopPropagation(),se(a.id,"active")},children:[t.jsx(Wt,{size:16}),"Enable"]})),l&&t.jsxs(ae,{variant:"destructive",onClick:T=>{T.stopPropagation(),N.requestDelete(a)},children:[t.jsx(Ze,{size:16}),"Delete"]})]})]})})]})},a.id)}),O.map(o=>t.jsx(an,{item:o,canManage:l,allConnections:b,connectedAppNames:q,connectingItemId:A,onNavigateConnected:a=>g({to:"/$org/settings/connections/$appSlug",params:{org:c.slug,appSlug:xe(a)}}),onConnect:E},`catalog-${o._registryId}:${o.id}`)),(e==="all"||f)&&m.length>0&&t.jsx("div",{ref:H,className:"col-span-full h-4"}),(e==="all"||f)&&P.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(le,{size:24,className:"animate-spin text-muted-foreground"})})]})}),_&&t.jsx(tn,{count:d.size,total:w.length,canManage:l,canManageAgents:j,onSelectAll:()=>{k(new Set(w.map(o=>o.id)))},onDeselectAll:()=>k(new Set),onDelete:()=>R(!0),onAddToAgent:()=>s(!0),onToggleStatus:fe,onCancel:C})]})}function rn(){const{org:v}=ke(),e=De(),n=nt({strict:!1}),{data:p}=Ae.useSession(),{stdioEnabled:u}=st(),m=Lt(),{granted:c}=Ce("connections:manage"),h=St({namespace:v.slug,resource:"connections"}),g=Ge(),[y,x]=ot(it.connectionsTab(v.slug),i=>n.tab==="all"||n.tab==="connected"?n.tab:i??"all"),[b,N]=X.useState("ALL"),[l,j]=X.useState("ALL"),[d,k]=X.useState("ALL"),_=gt(),R=we(_,h.searchTerm).items,F=h.search!==h.searchTerm,s=at({resolver:ct(qt),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),A=s.watch("ui_type"),V=s.watch("connection_url"),$=s.watch("npx_package"),w=he({uiType:A,connectionUrl:V??"",npxPackage:$??""})??Ne({uiType:A,connectionUrl:V??"",registryItems:R}),L=c&&n.action==="create",B=()=>{ne("connections_custom_dialog_opened",{source:"connections_page"}),e({to:"/$org/settings/connections",params:{org:v.slug},search:{action:"create"}})},C=()=>{e({to:"/$org/settings/connections",params:{org:v.slug},search:{}})},P=async i=>{let f,O=null,U=null,E=null;i.ui_type==="NPX"?(f="STDIO",O="",E=Qt(i.npx_package||"",i.env_vars||[])):i.ui_type==="STDIO"?(f="STDIO",O="",E=Jt(i.stdio_command||"",i.stdio_args||"",i.stdio_cwd,i.env_vars||[])):(f=i.ui_type,O=i.connection_url||"",U=i.connection_token||null);const r=ut("conn");ne("connection_custom_created",{connection_type:f,ui_type:i.ui_type}),await g.create.mutateAsync({id:r,title:i.title,description:i.description||null,connection_type:f,connection_url:O,connection_token:U,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:v.id,icon:i.icon??null,app_name:null,app_id:null,connection_headers:E,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),C(),s.reset(),e({to:"/$org/settings/connections/$appSlug",params:{org:v.slug,appSlug:xe({app_name:null,connection_url:O,title:i.title,id:r})}})},Q=i=>{i||(L&&C(),s.reset())},H=i=>{const f=i.trim();if(!f)return;const O=!!s.formState.dirtyFields.title,U=!!s.formState.dirtyFields.description,E=!!s.formState.dirtyFields.env_vars,r=S=>{if(S&&(!O&&!s.getValues("title").trim()&&S.title&&s.setValue("title",S.title,{shouldDirty:!1}),!U&&!(s.getValues("description")??"").trim()&&S.description&&s.setValue("description",S.description,{shouldDirty:!1}),!E&&S.envVarKeys?.length)){const se=s.getValues("env_vars")??[],fe=new Set(se.map(o=>o.key)),me=S.envVarKeys.filter(o=>!fe.has(o));me.length>0&&s.setValue("env_vars",[...se,...me.map(o=>({key:o,value:""}))],{shouldDirty:!0})}},I=Gt(f);if(I&&u){s.setValue("ui_type","NPX",{shouldDirty:!0}),s.setValue("npx_package",I.packageName,{shouldDirty:!0}),s.setValue("connection_url","",{shouldDirty:!0}),s.setValue("connection_token",null,{shouldDirty:!0}),r(he({uiType:"NPX",npxPackage:I.packageName}));return}if(f.startsWith("http://")||f.startsWith("https://")){const S=A==="HTTP"||A==="SSE"||A==="Websocket"?A:"HTTP";s.setValue("ui_type",S,{shouldDirty:!0}),s.setValue("connection_url",f,{shouldDirty:!0}),r(he({uiType:S,connectionUrl:f})??Ne({uiType:S,connectionUrl:f,registryItems:R}));return}A==="NPX"&&r(he({uiType:"NPX",npxPackage:f}))},q=c?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(z,{variant:"outline",onClick:B,children:[t.jsx(Ye,{size:14,className:"sm:hidden"}),t.jsx("span",{className:"hidden sm:inline",children:"Custom Connection"})]})}):null;return t.jsx(t.Fragment,{children:t.jsxs(pe,{children:[(()=>{const i="Create Connection",f="Create a custom connection in your organization. Fill in the details below.",O=s.formState.isSubmitting?"Saving...":"Create Connection",U=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(J,{control:s.control,name:"ui_type",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Type *"}),t.jsxs(Ot,{value:r.value,onValueChange:r.onChange,children:[t.jsx(ee,{children:t.jsx($t,{children:t.jsx(Et,{})})}),t.jsxs(Mt,{children:[t.jsx(re,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(re,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(re,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ye,{className:"w-4 h-4"}),"Websocket"]})}),u&&t.jsxs(t.Fragment,{children:[t.jsx(re,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(ge,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(re,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ut,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(te,{})]})}),A==="NPX"&&t.jsx(J,{control:s.control,name:"npx_package",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"NPM Package *"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"@perplexity-ai/mcp-server",...r,value:r.value??"",onPaste:I=>{const S=I.clipboardData.getData("text");S&&(I.preventDefault(),s.setValue("npx_package",S.trim(),{shouldDirty:!0}),H(S))},onBlur:I=>{H(I.target.value),r.onBlur()}})}),t.jsx(te,{})]})}),A==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(J,{control:s.control,name:"stdio_command",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Command *"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"node, bun, python...",...r,value:r.value??""})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"stdio_args",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Arguments"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"arg1 arg2 --flag value",...r,value:r.value??""})}),t.jsx(te,{})]})})]}),t.jsx(J,{control:s.control,name:"stdio_cwd",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Working Directory"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"/path/to/project (optional)",...r,value:r.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),t.jsx(te,{})]})})]}),(A==="NPX"||A==="STDIO")&&t.jsx(J,{control:s.control,name:"env_vars",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Environment Variables"}),t.jsx(ee,{children:t.jsx(Xt,{value:r.value??[],onChange:r.onChange})}),t.jsx(te,{})]})}),A!=="NPX"&&A!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(J,{control:s.control,name:"connection_url",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"URL *"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"https://example.com/mcp",...r,value:r.value??"",onPaste:I=>{const S=I.clipboardData.getData("text");S&&(I.preventDefault(),s.setValue("connection_url",S.trim(),{shouldDirty:!0}),H(S))},onBlur:I=>{H(I.target.value),r.onBlur()}})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"connection_token",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:w?.token?.label??"Token (optional)"}),t.jsx(ee,{children:t.jsx(ie,{type:"password",placeholder:w?.token?.placeholder??"Bearer token or API key",...r,value:r.value??""})}),w?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.token.helperText,w.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),t.jsx(te,{})]})})]}),t.jsx(J,{control:s.control,name:"title",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Name *"}),t.jsx(ee,{children:t.jsx(ie,{placeholder:"My Connection",...r})}),t.jsx(te,{})]})}),t.jsx(J,{control:s.control,name:"description",render:({field:r})=>t.jsxs(Y,{children:[t.jsx(Z,{children:"Description"}),t.jsx(ee,{children:t.jsx(zt,{placeholder:"A brief description of this connection",rows:3,...r,value:r.value??""})}),t.jsx(te,{})]})})]}),E=L;return m?t.jsx(kt,{open:E,onOpenChange:Q,children:t.jsxs(Dt,{className:"max-h-[90vh]",children:[t.jsx(At,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(wt,{children:i}),t.jsx(Tt,{className:"mt-1",children:f})]}),t.jsx(It,{asChild:!0,children:t.jsx(z,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(et,{size:16})})})]})}),t.jsx(be,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(P),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:U}),t.jsx(Pt,{children:t.jsx(z,{type:"submit",disabled:s.formState.isSubmitting,className:"w-full",children:O})})]})})]})}):t.jsx(Ve,{open:E,onOpenChange:Q,children:t.jsxs(Be,{className:"sm:max-w-[525px]",children:[t.jsxs(Re,{children:[t.jsx(Ue,{children:i}),t.jsx(He,{children:f})]}),t.jsx(be,{...s,children:t.jsxs("form",{onSubmit:s.handleSubmit(P),children:[t.jsx("div",{className:"py-4",children:U}),t.jsxs(Ke,{children:[t.jsx(z,{type:"button",variant:"outline",onClick:()=>Q(!1),children:"Cancel"}),t.jsx(z,{type:"submit",disabled:s.formState.isSubmitting,className:"min-w-40",children:O})]})]})})]})})})(),t.jsx(pe.Content,{children:t.jsx(pe.Body,{children:t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(pe.Title,{children:"Connections"}),t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ht,{value:h.search,onChange:h.setSearch,placeholder:"Search for a connection",className:"w-full md:w-[375px]",onKeyDown:i=>{i.key==="Escape"&&(h.setSearch(""),i.target.blur())}}),t.jsx(pt,{sortKey:h.sortKey,sortDirection:h.sortDirection,onSort:h.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}],filters:[{label:"Type",value:b,onChange:i=>N(i||"ALL"),options:[{id:"ALL",label:"All"},{id:"HTTP",label:"HTTP"},{id:"SSE",label:"SSE"},{id:"Websocket",label:"WebSocket"},{id:"STDIO",label:"STDIO"}]},{label:"Status",value:l,onChange:i=>j(i||"ALL"),options:[{id:"ALL",label:"All"},{id:"active",label:"Active"},{id:"inactive",label:"Inactive"},{id:"error",label:"Error"}]},..._.length>1?[{label:"Registry",value:d,onChange:i=>k(i||"ALL"),options:[{id:"ALL",label:"All registries"},..._.map(i=>({id:i.id,label:i.id.includes("community-registry")?"Community MCP Registry":i.title}))]}]:[]]})]}),q]}),t.jsx(xt,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:y,onTabChange:i=>{const f=i;f!==y&&ne("connections_page_tab_changed",{to_tab:f}),x(f)}}),t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx("div",{style:{opacity:F?.5:1,transition:F?"opacity 0.2s 0.2s linear":"opacity 0s 0s linear",pointerEvents:F?"none":"auto"},children:t.jsx(cn,{listState:h,activeTab:y,typeFilter:b,statusFilter:l,registryFilter:d,enabledRegistries:_})})})]})})})]})})}function Bs(){const v=ce.c(1);let e;return v[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tt,{children:t.jsx(X.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(le,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(rn,{})})}),v[0]=e):e=v[0],e}export{Bs as default};
@@ -1 +0,0 @@
1
- import{e as B,q as U,b as $,G as Y,K as J,n as H,a as G,j as s,B as L,t as p,o as A}from"./index-biiHZ5l9.js";import{u as M}from"./unwrap-tool-result-BYXdCQMg.js";import{S as V,u as W}from"./use-mcp-client-CWFUu1lY.js";import{S as X}from"./switch-D6SWnoi2.js";import{S as ii,a as k,b as P}from"./settings-section-V9kb8x32.js";function si(){const i=B.c(62),{org:t}=U(),{data:K}=$.useSession(),R=Y();let z;i[0]!==t.id||i[1]!==t.slug?(z={connectionId:V,orgId:t.id,orgSlug:t.slug},i[0]=t.id,i[1]=t.slug,i[2]=z):z=i[2];const a=W(z);let r;i[3]!==t.id?(r=J.organizationDomain(t.id),i[3]=t.id,i[4]=r):r=i[4];let d;i[5]!==a?(d=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_GET",arguments:{}});return M(e)},i[5]=a,i[6]=d):d=i[6];let h;i[7]!==r||i[8]!==d?(h={queryKey:r,queryFn:d},i[7]=r,i[8]=d,i[9]=h):h=i[9];const{data:q,isPending:Z}=H(h),b=K?.user?.email??"";let I;i[10]!==b?(I=b.split("@")[1]?.toLowerCase()??"",i[10]=b,i[11]=I):I=i[11];const o=I,n=q?.domain??null,F=q?.autoJoinEnabled??!1,v=o&&o!==n;let x;i[12]!==t.id||i[13]!==R?(x=()=>R.invalidateQueries({queryKey:J.organizationDomain(t.id)}),i[12]=t.id,i[13]=R,i[14]=x):x=i[14];const l=x;let c;i[15]!==a||i[16]!==o?(c=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_SET",arguments:{domain:o,autoJoinEnabled:!1}});return M(e)},i[15]=a,i[16]=o,i[17]=c):c=i[17];let m;i[18]!==l||i[19]!==t.id||i[20]!==o?(m=()=>{p("organization_domain_claimed",{organization_id:t.id,email_domain:o}),l(),A.success("Domain claimed")},i[18]=l,i[19]=t.id,i[20]=o,i[21]=m):m=i[21];let u;i[22]!==t.id||i[23]!==o?(u=e=>{p("organization_domain_claim_failed",{organization_id:t.id,email_domain:o,error:e instanceof Error?e.message:String(e)}),A.error(e instanceof Error?e.message:"Failed to claim domain")},i[22]=t.id,i[23]=o,i[24]=u):u=i[24];let D;i[25]!==c||i[26]!==m||i[27]!==u?(D={mutationFn:c,onSuccess:m,onError:u},i[25]=c,i[26]=m,i[27]=u,i[28]=D):D=i[28];const C=G(D);let g;i[29]!==a?(g=async()=>{const e=await a.callTool({name:"ORGANIZATION_DOMAIN_CLEAR",arguments:{}});return M(e)},i[29]=a,i[30]=g):g=i[30];let f;i[31]!==n||i[32]!==l||i[33]!==t.id?(f=()=>{p("organization_domain_cleared",{organization_id:t.id,email_domain:n}),l(),A.success("Domain removed")},i[31]=n,i[32]=l,i[33]=t.id,i[34]=f):f=i[34];let _;i[35]!==n||i[36]!==t.id?(_=e=>{p("organization_domain_clear_failed",{organization_id:t.id,email_domain:n,error:e instanceof Error?e.message:String(e)}),A.error(e instanceof Error?e.message:"Failed to remove domain")},i[35]=n,i[36]=t.id,i[37]=_):_=i[37];let y;i[38]!==g||i[39]!==f||i[40]!==_?(y={mutationFn:g,onSuccess:f,onError:_},i[38]=g,i[39]=f,i[40]=_,i[41]=y):y=i[41];const N=G(y);let E;i[42]!==a||i[43]!==n||i[44]!==t.id?(E=async e=>{if(!n)return;p("organization_auto_join_toggled",{organization_id:t.id,enabled:e});const Q=await a.callTool({name:"ORGANIZATION_DOMAIN_UPDATE",arguments:{autoJoinEnabled:e}});return M(Q)},i[42]=a,i[43]=n,i[44]=t.id,i[45]=E):E=i[45];let S;i[46]!==l?(S=()=>{l(),A.success("Auto-join setting updated")},i[46]=l,i[47]=S):S=i[47];let j;i[48]!==t.id?(j=e=>{p("organization_auto_join_toggle_failed",{organization_id:t.id,error:e instanceof Error?e.message:String(e)}),A.error(e instanceof Error?e.message:"Failed to update auto-join")},i[48]=t.id,i[49]=j):j=i[49];let w;i[50]!==E||i[51]!==S||i[52]!==j?(w={mutationFn:E,onSuccess:S,onError:j},i[50]=E,i[51]=S,i[52]=j,i[53]=w):w=i[53];const O=G(w);if(Z)return null;let T;return i[54]!==F||i[55]!==v||i[56]!==N||i[57]!==n||i[58]!==C||i[59]!==O||i[60]!==o?(T=s.jsx(ii,{title:"Email domain",children:n?s.jsxs(k,{children:[s.jsx(P,{title:n,description:"Claimed domain",action:s.jsx(L,{variant:"outline",size:"sm",onClick:()=>N.mutate(),disabled:N.isPending,children:"Remove"})}),s.jsx(P,{title:"Auto-join",description:`Users with @${n} emails will automatically join this organization on signup.`,action:s.jsx(X,{checked:F,onCheckedChange:e=>O.mutate(e),disabled:O.isPending})})]}):v?s.jsx(k,{children:s.jsx(P,{title:o,description:"Let new users with matching emails auto-join this org.",action:s.jsx(L,{size:"sm",onClick:()=>C.mutate(),disabled:C.isPending,children:C.isPending?"Claiming...":"Claim domain"})})}):s.jsx(k,{children:s.jsx(P,{title:"No domain detected",description:"Sign in with a corporate email to claim a domain for your organization."})})}),i[54]=F,i[55]=v,i[56]=N,i[57]=n,i[58]=C,i[59]=O,i[60]=o,i[61]=T):T=i[61],T}export{si as D};
@@ -1 +0,0 @@
1
- import{e as d,g as p,cm as l,j as s,O as u}from"./index-biiHZ5l9.js";import{P as c}from"./plugin-layout-DrVKV-lp.js";import"./use-connection-DyJtuHQI.js";import"./use-collections-B5Jh_wGd.js";import"./use-mcp-client-CWFUu1lY.js";import"./Settings02-Cd4DIqaJ.js";import"./index-r7-3fAFf.js";import"./sidebar-CPZXU-2w.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./tooltip-bsrBmmjV.js";import"./sheet-D99KevZC.js";import"./X-1KR4wibP.js";function _(){const e=d.c(10);let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$taskId/$pluginId"},e[0]=n):n=e[0];const{pluginId:a}=p(n);let i;e[1]!==a?(i=l.find(r=>r.id===a),e[1]=a,e[2]=i):i=e[2];const t=i;if(t?.renderHeader&&t?.renderEmptyState&&t?.bindingName){let r;return e[3]!==t.bindingName||e[4]!==t.renderEmptyState||e[5]!==t.renderHeader?(r=s.jsx(c,{bindingName:t.bindingName,renderHeader:t.renderHeader,renderEmptyState:t.renderEmptyState}),e[3]=t.bindingName,e[4]=t.renderEmptyState,e[5]=t.renderHeader,e[6]=r):r=e[6],r}const o=t?.LayoutComponent;if(!o){let r;return e[7]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(u,{}),e[7]=r):r=e[7],r}let m;return e[8]!==o?(m=s.jsx(o,{}),e[8]=o,e[9]=m):m=e[9],m}export{_ as default};
@@ -1,2 +0,0 @@
1
- import{e as Ke,r as l,j as i,l as re,B as fe,c as Ve,G as ut,o as $,K as Te}from"./index-biiHZ5l9.js";import{F as mt,l as pt}from"./index-BflNEs6l.js";import{Z as ht,aq as xt,ar as gt,as as ae,at as yt,G as $e}from"./agent-icon-DT8dQ9tq.js";import{a as wt}from"./Tool01-Dcq7KP8Y.js";import{s as jt}from"./XClose-pR-QU0OQ.js";import{S as bt}from"./scroll-area-BqOijBAI.js";import{b as Re,T as Oe,a as ze}from"./tooltip-bsrBmmjV.js";import{A as vt,a as Ct,b as Nt,c as St,d as Dt,e as kt,f as Ft,g as Lt}from"./alert-dialog-CSkQIwm8.js";import{a as Et}from"./chat-context-Bu6qpu9K.js";import{u as Pt}from"./shell-layout-4LsIVsl3.js";import{a7 as le,a8 as Ae,a9 as Tt}from"./index-BZvxagUr.js";import{c as $t,e as Rt,b as Ot,d as zt,a as At,D as Wt}from"./dialog-Bm1pP7Vu.js";import{I as We}from"./input-5PMMNPU9.js";import{C as It,c as _,d as Ie,e as Mt,f as Kt}from"./shell-route-loading-5KSwc3hj.js";import{t as Vt}from"./ChevronDown-Cf2Q-GlB.js";import{i as Bt}from"./ChevronRight-CrZy8tHx.js";import{a as Gt}from"./ZoomOut-D8vQ49we.js";import{E as qt,p as Me,q as he,r as Qt,s as Ut,t as Ht,v as M,w as ce,g as xe,x as ge,y as Jt,z as Xt,A as ye,B as de,C as we,D as Yt,G as Zt}from"./header-tab-button-DSX6YPkf.js";import"./AlertCircle-9EFUZenf.js";import"./SwitchHorizontal01-BMnNI1Fi.js";import"./RefreshCcw01-3BsQQkRx.js";import"./XCircle-UPVnJx4i.js";import"./ArrowUpRight-97355q5v.js";import"./ZapSquare-B1o2Q9OR.js";import"./Users03-BlNe2PnN.js";import"./CheckCircle-C2ualSpf.js";import"./Check-D-9dblUn.js";import"./ChevronLeft-BaV4nFMQ.js";import"./ChevronUp-BAxoXhnT.js";import"./DotsVertical-SvwN4CeV.js";import"./Container-CYcITvPW.js";import"./Eye-ByuwKsdh.js";import"./Globe01-DfGFlik1.js";import"./FilterLines-BJZdiggU.js";import"./Star01-eRdSY4QW.js";import"./Palette-Druykvzw.js";import"./HardDrive-DNFvbooP.js";import"./Stars02-EuAFDZ5E.js";import"./Key01-CzmPnHuw.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./LinkExternal01-CgI1VTqi.js";import"./Monitor01-Cw6kmClm.js";import"./Sun-CH2HWLCn.js";import"./Play-CMJ2IWYR.js";import"./Plus-CjrtKB-Y.js";import"./SearchMd-BL2y99rx.js";import"./Settings02-Cd4DIqaJ.js";import"./Shield01-zIbMct6w.js";import"./Stars01-v0yz6PCZ.js";import"./Trash01-Cup7-ZTT.js";import"./Upload01-C9yi1Bdg.js";import"./User01-thAIxsAs.js";import"./Users01-DPJm6-u-.js";import"./X-1KR4wibP.js";import"./Zap-Cl-JM7N9.js";import"./select-CNSUv3cw.js";import"./tab-id-D4SJwEQy.js";import"./use-mcp-client-CWFUu1lY.js";import"./decopilot-sse-pool-BUhEcft-.js";import"./create-sse-subscription-BS5983N4.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./use-virtual-mcp-0jbEmvOc.js";import"./use-collections-B5Jh_wGd.js";import"./use-ai-providers-v0sCRzMO.js";import"./use-organization-settings-Izqk1Gkk.js";import"./avatar-BHEXMwdE.js";import"./required-auth-layout-zYH6NIDF.js";import"./useRouterState-Dm0UHjU4.js";import"./use-org-sso-C1cJTBIx.js";import"./agent-capabilities-BJLQSkAN.js";import"./pair-Ba1UoSSJ.js";import"./format-time-Cy7tTmZp.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-P6tx-uOp.js";import"./file-type-icon-CX5JEvCQ.js";import"./content-blocks-o63cs2vh.js";import"./types-jBdXInU0.js";import"./integration-icon-Dy-a3x5R.js";import"./use-navigate-to-agent-CdsMYUzL.js";import"./use-connection-DyJtuHQI.js";import"./use-mcp-prompts-B5RhBVzg.js";import"./form-BcPtow5O.js";import"./label-CcC4_aKf.js";import"./spinner-DJD6-9r-.js";import"./drawer-B51jkLaX.js";import"./collection-search-LsgoMrVO.js";import"./tabs-DCDCb9Pz.js";import"./toggle-group-DhVqXGfs.js";import"./connect-desktop-dialog-DPqrgnkS.js";import"./agent-icons-DRrDyR7j.js";import"./checkbox--nDaSUZE.js";import"./skeleton--DN75sg7.js";import"./ai-providers-logos-DD3qZ33J.js";import"./settings-section-V9kb8x32.js";import"./card-BUTabNLA.js";import"./popover-Cvcd3A1d.js";import"./command-BehF6pb8.js";import"./index-CR_LeyNj.js";import"./useInfiniteQuery-BGg7INCQ.js";import"./infiniteQueryObserver-B0VBGXv5.js";import"./sortable.esm-g7bq1nDZ.js";import"./connection-slug-eyAPH6o3.js";import"./connection-card-EXvV7rxl.js";import"./use-registry-connections-C-WVKjSU.js";import"./extract-connection-data-LoMqboL3.js";import"./generate-id-CadHbHqX.js";import"./collections-C_j8CeI8.js";import"./collection-tabs-CQJiHDMR.js";import"./badge-Da0IsrqH.js";import"./textarea-QEULyLXh.js";import"./connection-form-helpers-DoJomSCQ.js";import"./use-infinite-scroll-xQQ6lYk4.js";import"./useSuspenseInfiniteQuery-B4dQiTEq.js";import"./index-Bo5bzoUm.js";import"./dropdown-menu-CIu58K9q.js";import"./question-004-sINsf4GQ.js";import"./sidebar-CPZXU-2w.js";import"./sheet-D99KevZC.js";import"./use-status-sounds-BJ_LqdGJ.js";import"./empty-state-1AbmTLd7.js";import"./toolbar-BsB4Mvyv.js";import"./resizable-BbbLszRZ.js";import"./use-mcp-tools-DePRGZE5.js";import"./use-capability-BPM45mbW.js";import"./user-DRDdFgUw.js";import"./tools-list-Ch5RlbiL.js";import"./switch-D6SWnoi2.js";import"./use-debounced-autosave-ClLbciGl.js";import"./index-r7-3fAFf.js";import"./search-input-BgGthWir.js";import"./use-secrets-BpdIBEe6.js";import"./github-repo-picker-B24_pGAu.js";import"./formatDistanceToNow-Cb2QZZJn.js";import"./accordion-aX0NKKKh.js";import"./view-mode-toggle-G0qNMbJ1.js";import"./select-model-0CGh6cKF.js";import"./use-automations-Db8x6SNU.js";import"./monaco-editor-CJVi8Ty8.js";import"./automation-runs-BJTRztep.js";import"./table-Cx3PhNth.js";import"./use-members-Cw70r_Wh.js";import"./use-org-auth-client--i_Sx92M.js";import"./task-status-P3BULAyA.js";import"./automation-list-row-5M4PNEWw.js";import"./use-create-virtual-mcp-CWYOy45e.js";import"./index-B1bHiM-j.js";import"./hover-card-DE2_8MLP.js";const _t={"new-file":{title:"New File",description:"Enter a name for the new file.",submit:"Create",placeholder:"filename.ts"},"new-folder":{title:"New Folder",description:"Enter a name for the new folder.",submit:"Create",placeholder:"folder-name"},rename:{title:"Rename",description:"Enter a new name for this item.",submit:"Rename",placeholder:"new-name"}};function en(y){const e=Ke.c(51),{open:c,mode:K,initialName:X,parentLabel:Q,isPending:A,onSubmit:V,onOpenChange:P}=y,W=X===void 0?"":X,o=A===void 0?!1:A,[p,R]=l.useState(W),[I,B]=l.useState(c),f=_t[K];c!==I&&(B(c),c&&R(W));let F;e[0]!==o||e[1]!==P?(F=E=>{!E&&!o&&P(!1)},e[0]=o,e[1]=P,e[2]=F):F=e[2];const U=F;let G;e[3]!==o||e[4]!==p||e[5]!==V?(G=async E=>{E.preventDefault();const z=p.trim();!z||o||await V(z)},e[3]=o,e[4]=p,e[5]=V,e[6]=G):G=e[6];const q=G;let L;e[7]!==f.title?(L=i.jsx($t,{children:f.title}),e[7]=f.title,e[8]=L):L=e[8];let N;e[9]!==f.description?(N=i.jsx(Rt,{children:f.description}),e[9]=f.description,e[10]=N):N=e[10];let O;e[11]!==L||e[12]!==N?(O=i.jsxs(Ot,{children:[L,N]}),e[11]=L,e[12]=N,e[13]=O):O=e[13];let S;e[14]!==Q?(S=Q&&i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Location"}),i.jsx(We,{value:Q,readOnly:!0,disabled:!0,className:"font-mono text-xs"})]}),e[14]=Q,e[15]=S):S=e[15];let D;e[16]===Symbol.for("react.memo_cache_sentinel")?(D=i.jsx("label",{htmlFor:"file-explorer-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),e[16]=D):D=e[16];let j;e[17]===Symbol.for("react.memo_cache_sentinel")?(j=E=>R(E.target.value),e[17]=j):j=e[17];let b;e[18]!==f.placeholder||e[19]!==o||e[20]!==p?(b=i.jsxs("div",{className:"space-y-1.5",children:[D,i.jsx(We,{id:"file-explorer-name",value:p,onChange:j,placeholder:f.placeholder,autoFocus:!0,disabled:o})]}),e[18]=f.placeholder,e[19]=o,e[20]=p,e[21]=b):b=e[21];let h;e[22]!==b||e[23]!==S?(h=i.jsxs("div",{className:"space-y-4 py-4",children:[S,b]}),e[22]=b,e[23]=S,e[24]=h):h=e[24];let x;e[25]!==P?(x=()=>P(!1),e[25]=P,e[26]=x):x=e[26];let v;e[27]!==o||e[28]!==x?(v=i.jsx(fe,{type:"button",variant:"outline",onClick:x,disabled:o,children:"Cancel"}),e[27]=o,e[28]=x,e[29]=v):v=e[29];let C;e[30]!==o||e[31]!==p?(C=!p.trim()||o,e[30]=o,e[31]=p,e[32]=C):C=e[32];let u;e[33]!==f.submit||e[34]!==o?(u=o?i.jsxs(i.Fragment,{children:[i.jsx(re,{size:14,className:"animate-spin"}),"Saving…"]}):f.submit,e[33]=f.submit,e[34]=o,e[35]=u):u=e[35];let k;e[36]!==C||e[37]!==u?(k=i.jsx(fe,{type:"submit",disabled:C,children:u}),e[36]=C,e[37]=u,e[38]=k):k=e[38];let m;e[39]!==v||e[40]!==k?(m=i.jsxs(zt,{children:[v,k]}),e[39]=v,e[40]=k,e[41]=m):m=e[41];let g;e[42]!==q||e[43]!==h||e[44]!==m||e[45]!==O?(g=i.jsx(At,{className:"sm:max-w-md",children:i.jsxs("form",{onSubmit:q,children:[O,h,m]})}),e[42]=q,e[43]=h,e[44]=m,e[45]=O,e[46]=g):g=e[46];let T;return e[47]!==U||e[48]!==c||e[49]!==g?(T=i.jsx(Wt,{open:c,onOpenChange:U,children:g}),e[47]=U,e[48]=c,e[49]=g,e[50]=T):T=e[50],T}const tn="#d9a441";function nn(y){const e=Ke.c(45),{node:c,depth:K,isExpanded:X,isSelected:Q,isLoading:A,fileVisual:V,onOpen:P,onSelect:W,onNewFile:o,onNewFolder:p,onCopyPath:R,onCopyRelativePath:I,onRename:B,onDelete:f}=y,F=A===void 0?!1:A,U=c.kind==="directory",{Icon:G,color:q}=V,L=Q&&"bg-accent";let N;e[0]!==L?(N=Ve("flex w-full items-center gap-1.5 px-2 py-1.5 text-left text-[13px] hover:bg-accent transition-colors",L),e[0]=L,e[1]=N):N=e[1];const O=`${K*14+8}px`;let S;e[2]!==O?(S={paddingLeft:O},e[2]=O,e[3]=S):S=e[3];let D;e[4]!==P||e[5]!==W?(D=()=>{W(),P()},e[4]=P,e[5]=W,e[6]=D):D=e[6];let j;e[7]!==G||e[8]!==q||e[9]!==U||e[10]!==X||e[11]!==F?(j=U?i.jsxs(i.Fragment,{children:[F?i.jsx(re,{size:14,className:"shrink-0 animate-spin text-muted-foreground"}):X?i.jsx(Vt,{size:14,className:"shrink-0 text-muted-foreground"}):i.jsx(Bt,{size:14,className:"shrink-0 text-muted-foreground"}),i.jsx(Gt,{size:16,className:"shrink-0",style:{color:tn}})]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"w-3.5 shrink-0"}),i.jsx(G,{size:16,className:"shrink-0",style:{color:q}})]}),e[7]=G,e[8]=q,e[9]=U,e[10]=X,e[11]=F,e[12]=j):j=e[12];let b;e[13]!==c.name?(b=i.jsx("span",{className:"truncate",children:c.name}),e[13]=c.name,e[14]=b):b=e[14];let h;e[15]!==N||e[16]!==S||e[17]!==D||e[18]!==j||e[19]!==b?(h=i.jsx(It,{asChild:!0,children:i.jsxs("button",{type:"button",className:N,style:S,onClick:D,children:[j,b]})}),e[15]=N,e[16]=S,e[17]=D,e[18]=j,e[19]=b,e[20]=h):h=e[20];let x;e[21]!==o?(x=i.jsx(_,{onSelect:o,children:"New File"}),e[21]=o,e[22]=x):x=e[22];let v;e[23]!==p?(v=i.jsx(_,{onSelect:p,children:"New Folder"}),e[23]=p,e[24]=v):v=e[24];let C;e[25]===Symbol.for("react.memo_cache_sentinel")?(C=i.jsx(Ie,{}),e[25]=C):C=e[25];let u;e[26]!==R?(u=i.jsx(_,{onSelect:R,children:"Copy Path"}),e[26]=R,e[27]=u):u=e[27];let k;e[28]!==I?(k=i.jsx(_,{onSelect:I,children:"Copy Relative Path"}),e[28]=I,e[29]=k):k=e[29];let m;e[30]===Symbol.for("react.memo_cache_sentinel")?(m=i.jsx(Ie,{}),e[30]=m):m=e[30];let g;e[31]!==B?(g=i.jsx(_,{onSelect:B,children:"Rename"}),e[31]=B,e[32]=g):g=e[32];let T;e[33]!==f?(T=i.jsx(_,{variant:"destructive",onSelect:f,children:"Delete"}),e[33]=f,e[34]=T):T=e[34];let E;e[35]!==x||e[36]!==v||e[37]!==u||e[38]!==k||e[39]!==g||e[40]!==T?(E=i.jsxs(Mt,{className:"w-52",children:[x,v,C,u,k,m,g,T]}),e[35]=x,e[36]=v,e[37]=u,e[38]=k,e[39]=g,e[40]=T,e[41]=E):E=e[41];let z;return e[42]!==E||e[43]!==h?(z=i.jsxs(Kt,{children:[h,E]}),e[42]=E,e[43]=h,e[44]=z):z=e[44],z}pt.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function je(y,e,c,K){return`/api/${y}/sandbox/${encodeURIComponent(e)}/${encodeURIComponent(c)}/${K}`}function rn(y){const e=M(y);return!e||e.includes("..")||e.includes("\\")?!1:e.startsWith(".deco/blocks/")||!e.startsWith("/")&&!e.includes("://")}const sn="#94a3b8";function on(y){const e=y.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?{Icon:ae,color:"#3b82f6"}:e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?{Icon:ae,color:"#d9a441"}:e.endsWith(".json")?{Icon:yt,color:"#cb9b3f"}:e.endsWith(".css")||e.endsWith(".scss")?{Icon:ae,color:"#06b6d4"}:e.endsWith(".html")||e.endsWith(".xml")?{Icon:ae,color:"#f97316"}:/\.(png|jpe?g|gif|webp|avif|ico|svg)$/.test(e)?{Icon:wt,color:"#a855f7"}:e.endsWith(".md")||e.endsWith(".mdx")?{Icon:$e,color:"#64748b"}:{Icon:$e,color:sn}}function Qi({orgSlug:y,virtualMcpId:e,branch:c,openPath:K}){const[X,Q]=l.useState({files:[],directories:[],truncated:!1}),{files:A,directories:V}=X,[P,W]=l.useState(new Set),[o,p]=l.useState(null),[R,I]=l.useState(null),[B,f]=l.useState([]),[F,U]=l.useState(""),[G,q]=l.useState(!1),[L,N]=l.useState(!1),[,O]=l.useState(new Set),[S,D]=l.useState(new Set),j=l.useRef(0),b=l.useRef(null),h=l.useRef(new Set),x=l.useRef(new Map);function v(t){O(n=>{const r=typeof t=="function"?t(n):t;return h.current=r,r})}const[C,u]=l.useState(new Map),k=l.useRef(null),[m,g]=l.useState(null),{sendMessage:T}=Et(),{setChatOpen:E}=Pt(),z=ut(),[w,H]=l.useState(null),[J,ue]=l.useState(null),[ee,ie]=l.useState(!1);async function te(t,n){const r=await fetch(je(y,e,c,t),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const s=await r.json().catch(()=>({}));throw new Error(s.error??`Request failed (${r.status})`)}return r.json()}async function se(){z.invalidateQueries({queryKey:Ae(y,e,c)})}function be(t,n){navigator.clipboard.writeText(n).then(()=>$.success(`${t} copied`),()=>$.error(`Failed to copy ${t.toLowerCase()}`))}function Be(t){const n=Yt(t);if(!n)return;const r=`${y}/${e}/${c}`;z.setQueryData(Te.decofile(r),s=>{if(!s)return s;const{[n]:a,...d}=s;return d}),z.invalidateQueries({queryKey:Te.liveMeta(r)})}function Ge(t){const n=t.kind==="file"?[t.path]:A.filter(r=>r.startsWith(".deco/blocks/")).map(r=>ce(r)).filter(r=>r===t.path||r.startsWith(`${t.path}/`));for(const r of n)Be(r)}function qe(t){const n=ce(t);return B.filter(r=>{if(r!==n&&!r.startsWith(`${n}/`))return!1;const s=C.get(r);return!!(s?.loaded&&s.editorValue!==s.savedContent)})}function ve(t){f(n=>n.map(r=>t(r)).filter(r=>r!==null)),p(n=>n&&t(n)),u(n=>{const r=new Map;for(const[s,a]of n){const d=t(s);d&&r.set(d,a)}return r}),I(n=>{if(!n)return n;const r=t(n.path);return r?r===n.path?n:{...n,path:r,name:r.split("/").pop()??r}:null})}function Qe(t){const n=ce(t);I(r=>r&&(r.path===n||r.path.startsWith(`${n}/`)?null:r)),ve(r=>r===n||r.startsWith(`${n}/`)?null:r)}async function Ue(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);await te("write",{path:M(n),content:""}),await ne(),await se(),H(null),me(n)}async function He(t){if(!w)return;const n=de(w.parentDir,t);if(we(n,A,V))throw new Error(`"${t}" already exists`);const r=M(n);await te("mkdir",{path:r}),Q(s=>({...s,directories:s.directories.includes(r)?s.directories:[...s.directories,r]})),await ne(),await se(),H(null),W(s=>{const a=new Set(s);for(const d of he(n))a.add(d);return a.add(n),a}),I({name:t,path:n,kind:"directory",children:[]})}async function Je(t){if(!w)return;const n=w.node.path,r=ye(n),s=de(r,t);if(s===n){H(null);return}if(we(s,A,V))throw new Error(`"${t}" already exists`);await te("rename",{from:M(n),to:M(s)}),ve(a=>a===n?s:a.startsWith(`${n}/`)?de(s,a.slice(n.length+1)):a),await ne(),await se(),H(null)}async function Xe(t){ie(!0);try{await te("unlink",{path:M(t.path),recursive:t.kind==="directory"}),Ge(t),Qe(t.path),await ne(),await se(),ue(null),$.success(`Deleted "${t.name}"`)}catch(n){$.error(n instanceof Error?n.message:"Delete failed")}finally{ie(!1)}}async function Ye(t){const n=Xt(t);if(n){$.error(n);return}ie(!0);try{w?.mode==="new-file"?(await Ue(t),$.success(`Created "${t}"`)):w?.mode==="new-folder"?(await He(t),$.success(`Created folder "${t}"`)):w?.mode==="rename"&&(await Je(t),$.success(`Renamed to "${t}"`))}catch(r){$.error(r instanceof Error?r.message:"Operation failed")}finally{ie(!1)}}const Ce=l.useRef(!1);Ce.current||(Ce.current=!0,b.current=ne());const[Ze,_e]=l.useState(null);if(K&&K!==Ze){_e(K);const t=K;queueMicrotask(()=>{rn(t)&&me(t).catch(n=>{$.error(n instanceof Error?n.message:"Failed to open file")})})}async function Ne(t){const n=await te("glob",t);return{files:n.files??[],directories:n.directories??[],truncated:n.truncated}}function Se(t,n,r){if(r!==j.current)return!1;let s=!1;return Q(a=>{const d=n?Zt(a.files,a.directories,t,a.truncated):{files:t.files,directories:t.directories??[],truncated:!!t.truncated};return s=!!d.truncated,{files:d.files,directories:d.directories,truncated:s}}),s&&$.warning("File list truncated — some files may be hidden"),s}async function et(t){const n=x.current.get(t);if(n)return n;const r=j.current,s=(async()=>{const a=await Ne({pattern:"**/*",path:M(t),limit:Me}),d=Se(a,!0,r);return!d&&r===j.current&&v(Y=>{const oe=new Set(Y);return oe.add(t),oe}),d})();x.current.set(t,s);try{return await s}finally{x.current.delete(t)}}async function De(t){if(!ge(t,h.current))return!1;D(n=>new Set(n).add(t));try{return await et(t)}finally{D(n=>{const r=new Set(n);return r.delete(t),r})}}async function tt(t){const n=new Set(h.current);for(const r of he(t)){if(!ge(r,n))continue;if(await De(r))throw new Error("Folder listing truncated — expand again to load more");n.add(r)}}async function ne(){const t=++j.current;x.current.clear(),q(!0),v(new Set),W(new Set),D(new Set);try{const n=await Ne({pattern:"**/*",limit:Me,maxDepth:qt});Se(n,!1,t),N(!0)}catch{L&&$.error("Failed to refresh file tree")}finally{q(!1)}}async function ke(t){if(!C.get(t)?.loaded){u(r=>{const s=new Map(r);return s.set(t,{savedContent:"",editorValue:"",loaded:!1}),s});try{const r=await fetch(je(y,e,c,"read"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),full:!0})});if(!r.ok)return;const s=await r.json(),a=Jt(s.content??"");u(d=>{const Y=new Map(d);return Y.set(t,{savedContent:a,editorValue:a,loaded:!0}),Y})}catch{}}}async function nt(t,n){try{const r=await fetch(je(y,e,c,"write"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:M(t),content:n})});if(!r.ok){le("file save failed",{path:t,status:r.status});return}le("file saved via sandbox /write",{path:t}),z.invalidateQueries({queryKey:Ae(y,e,c)});try{const s=await Tt(y,e,c);le("git status after save",s)}catch(s){le("git status after save failed",{path:t,error:s instanceof Error?s.message:String(s)})}u(s=>{const a=new Map(s),d=a.get(t);return d&&a.set(t,{...d,savedContent:n}),a})}catch{}}function rt(t){p(t),I({name:t.split("/").pop()??t,path:t,kind:"file",children:[]}),g(null),B.includes(t)||f(n=>[...n,t]),ke(t)}function it(t){f(n=>{const r=n.filter(s=>s!==t);return o===t&&p(r[r.length-1]??null),r}),u(n=>{const r=new Map(n);return r.delete(t),r})}function Fe(t){W(n=>{const r=new Set(n);return r.has(t)?r.delete(t):r.add(t),r})}async function st(t){if(ge(t,h.current))try{if(await De(t))return}catch(n){$.error(n instanceof Error?n.message:"Failed to load folder");return}Fe(t)}async function ot(t,n){if(n){Fe(t);return}await st(t)}async function me(t){await b.current,await tt(t);const n=he(t);W(r=>{const s=new Set(r);for(const a of n)s.add(a);return s}),rt(t)}function at(){return R?.kind==="directory"?R.path:R?.kind==="file"?ye(R.path):o?ye(o):"/"}function Le(t){const n=at();H({mode:t,parentDir:n,node:{name:"",path:n,kind:"directory",children:[]}})}const lt=Qt(A,V),Ee=Ut(lt,P),Pe=F?Ee.filter(t=>t.node.name.toLowerCase().includes(F.toLowerCase())):Ee,Z=o?C.get(o):null,ct=Z?.loaded&&Z.editorValue!==Z.savedContent,pe=J?qe(J.path):[],dt=(t,n)=>{k.current=t,t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyS,async()=>{if(!o)return;const r=t.getValue();await nt(o,r)}),t.addCommand(n.KeyMod.CtrlCmd|n.KeyCode.KeyK,()=>{const r=t.getSelection(),s=t.getModel();if(!r||!s||!o)return;const a=s.getValueInRange(r);g({filePath:o,lineStart:r.startLineNumber,lineEnd:r.endLineNumber,selectedCode:a})})};function ft(t){if(!m)return;const n=[`The user selected code in the file explorer and asked: **"${t.trim()}"**`,"",`**File:** \`${m.filePath}\``,`**Lines:** ${m.lineStart}–${m.lineEnd}`];if(m.selectedCode){const r=xe(m.filePath),s=m.selectedCode.replace(/```/g,"`` `");n.push("","**Selected code:**","```"+r,s,"```")}n.push("","Please read the source file, locate the code, and apply the requested change."),E(!0),T({parts:[{type:"text",text:n.join(`
2
- `)}]}),g(null)}return G&&!L?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsxs("div",{className:"flex h-full w-full overflow-hidden",children:[i.jsxs("div",{className:"w-64 shrink-0 border-r flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center gap-1 p-2 border-b",children:[i.jsxs("div",{className:"relative min-w-0 flex-1",children:[i.jsx(ht,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),i.jsx("input",{type:"text",value:F,onChange:t=>U(t.target.value),placeholder:"Search files...","aria-label":"Search files",className:"w-full rounded-md border border-input bg-transparent pl-7 pr-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground focus:ring-1 focus:ring-ring"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New file",onClick:()=>Le("new-file"),children:i.jsx(xt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New file"})]}),i.jsxs(Re,{children:[i.jsx(Oe,{asChild:!0,children:i.jsx(fe,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":"New folder",onClick:()=>Le("new-folder"),children:i.jsx(gt,{size:14})})}),i.jsx(ze,{side:"bottom",children:"New folder"})]})]}),i.jsx(bt,{className:"flex-1",children:i.jsxs("div",{className:"py-1",children:[Pe.map(t=>{const{node:n,depth:r}=t,s=n.kind==="directory",a=P.has(n.path),d=R?.path===n.path,Y=Ht(n.path,n.kind),oe=s&&S.has(n.path);return i.jsx(nn,{node:n,depth:r,isExpanded:a,isSelected:d,isLoading:oe,fileVisual:on(n.name),onSelect:()=>I(n),onOpen:()=>{s?ot(n.path,a):me(n.path)},onNewFile:()=>H({mode:"new-file",node:n,parentDir:Y}),onNewFolder:()=>H({mode:"new-folder",node:n,parentDir:Y}),onCopyPath:()=>be("Path",ce(n.path)),onCopyRelativePath:()=>be("Relative path",M(n.path)),onRename:()=>H({mode:"rename",node:n,parentDir:Y}),onDelete:()=>ue(n)},n.path)}),L&&Pe.length===0&&i.jsx("div",{className:"px-3 py-4 text-center text-xs text-muted-foreground",children:F?`No files match "${F}"`:"No files found"})]})})]}),i.jsxs("div",{className:"relative flex-1 flex flex-col overflow-hidden",children:[B.length>0&&i.jsx("div",{className:"flex items-center border-b overflow-x-auto shrink-0",children:B.map(t=>{const n=C.get(t),r=n?.loaded&&n.editorValue!==n.savedContent,s=o===t,a=t.split("/").pop()??t;return i.jsxs("div",{className:Ve("flex items-center gap-1 px-3 py-1.5 text-xs border-r cursor-pointer transition-colors",s?"bg-background text-foreground":"bg-muted/50 text-muted-foreground hover:bg-accent"),onClick:()=>{p(t),ke(t)},onKeyDown:()=>{},role:"tab",tabIndex:0,"aria-selected":s,children:[i.jsx("span",{className:"truncate max-w-32",children:a}),r&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground/60 shrink-0"}),i.jsx("button",{type:"button",className:"ml-1 rounded p-0.5 hover:bg-accent-foreground/10",onClick:d=>{d.stopPropagation(),it(t)},children:i.jsx(jt,{size:12})})]},t)})}),m&&i.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 z-20 mt-2",style:{width:"360px"},children:i.jsxs("form",{className:"flex w-full items-center gap-1.5 rounded-xl border border-border bg-background/95 px-3 py-1.5 shadow-lg backdrop-blur",onSubmit:t=>{t.preventDefault();const r=t.currentTarget.elements.namedItem("askAiInput");r.value.trim()&&ft(r.value)},children:[i.jsx("input",{name:"askAiInput",autoFocus:!0,type:"text",placeholder:"Ask the AI...",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground",onKeyDown:t=>{t.stopPropagation(),t.key==="Escape"&&g(null)}}),i.jsx("button",{type:"submit",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-opacity",title:"Send",children:i.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none","aria-hidden":"true",children:[i.jsx("title",{children:"Send"}),i.jsx("path",{d:"M5 9V1M1 5l4-4 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})]})}),i.jsx("div",{className:"flex-1 overflow-hidden",children:o&&Z?.loaded?i.jsx(mt,{language:xe(o),theme:document.documentElement.classList.contains("dark")?"vs-dark":"light",value:Z.editorValue,path:o,onChange:t=>{const n=o;n&&u(r=>{const s=new Map(r),a=s.get(n);return a&&s.set(n,{...a,editorValue:t??""}),s})},onMount:dt,loading:i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}),options:{fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:2,wordWrap:"on",minimap:{enabled:!1},padding:{top:12,bottom:12},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}}},o):o&&!Z?.loaded?i.jsx("div",{className:"flex items-center justify-center h-full w-full",children:i.jsx(re,{size:20,className:"animate-spin text-muted-foreground"})}):i.jsx("div",{className:"flex items-center justify-center h-full w-full text-sm text-muted-foreground",children:"Select a file to edit"})}),o&&i.jsxs("div",{className:"flex items-center justify-between px-3 py-1 border-t text-[11px] text-muted-foreground shrink-0",children:[i.jsx("span",{className:"truncate",children:o}),i.jsxs("span",{children:[ct?"Modified":"Saved"," ·"," ",xe(o)]})]})]}),i.jsx(en,{open:w!==null,mode:w?.mode??"new-file",initialName:w?.mode==="rename"?w.node.name:"",parentLabel:w&&w.mode!=="rename"?w.parentDir==="/"?"/":M(w.parentDir):void 0,isPending:ee,onSubmit:Ye,onOpenChange:t=>{!t&&!ee&&H(null)}}),i.jsx(vt,{open:J!==null,onOpenChange:t=>{!t&&!ee&&ue(null)},children:i.jsxs(Ct,{children:[i.jsxs(Nt,{children:[i.jsxs(St,{children:["Delete ",J?.kind==="directory"?"folder":"file","?"]}),i.jsxs(Dt,{children:["This will permanently delete"," ",i.jsx("span",{className:"font-mono",children:J?.name}),J?.kind==="directory"?" and everything inside it.":".",pe.length>0&&i.jsxs(i.Fragment,{children:[" ",pe.length===1?"One open file has unsaved changes that will be lost.":`${pe.length} open files have unsaved changes that will be lost.`]})]})]}),i.jsxs(kt,{children:[i.jsx(Ft,{disabled:ee,children:"Cancel"}),i.jsx(Lt,{disabled:ee||!J,onClick:t=>{t.preventDefault(),J&&Xe(J)},children:"Delete"})]})]})})]})}export{Qi as FileExplorer};
@@ -1 +0,0 @@
1
- import{f as H,q as V,G as Y,H as Z,I as W,a as M,t as L,o as D,K as q,j as n,D as B,T as J,W as k,e as I,r as T,B as X,L as $,a4 as ee}from"./index-biiHZ5l9.js";import{P as E}from"./index-r7-3fAFf.js";import{u as te}from"./use-org-auth-client--i_Sx92M.js";import{u as ne}from"./use-debounced-autosave-ClLbciGl.js";import{A as ae}from"./avatar-BHEXMwdE.js";import{I as G}from"./input-5PMMNPU9.js";import{S as K,a as U,b as F,c as se}from"./settings-section-V9kb8x32.js";import{D as oe}from"./domain-settings-DHsRsnmX.js";import{S as ie,u as re}from"./use-mcp-client-CWFUu1lY.js";import{c as le,b as ce,d as ue,f as de,e as me,g as ge,a as fe,A as pe}from"./alert-dialog-CSkQIwm8.js";import{R as he}from"./require-capability-DVI2cKO3.js";import"./sidebar-CPZXU-2w.js";import"./LayoutLeft-CQ8Vq9nI.js";import"./tooltip-bsrBmmjV.js";import"./sheet-D99KevZC.js";import"./X-1KR4wibP.js";import"./User01-thAIxsAs.js";import"./card-BUTabNLA.js";import"./ArrowUpRight-97355q5v.js";import"./unwrap-tool-result-BYXdCQMg.js";import"./switch-D6SWnoi2.js";import"./use-capability-BPM45mbW.js";import"./access-gate-CWPebMdP.js";import"./capability-load-error-Dfw4xb8a.js";const xe=J({name:k().min(1,"Name is required").max(255,"Name is too long"),slug:k().min(1,"Slug is required").max(50,"Slug is too long").regex(/^[a-z0-9-]+$/,"Slug must contain only lowercase letters, numbers, and hyphens"),logo:k().optional()});function je(e){const t=I.c(13),{value:y,onChange:h,name:o,disabled:m}=e,c=T.useRef(null);let u;t[0]===Symbol.for("react.memo_cache_sentinel")?(u=()=>c.current?.click(),t[0]=u):u=t[0];const i=u;let l;t[1]!==h?(l=j=>{const f=j.target.files?.[0];if(!f)return;if(f.size>2097152){D.error("Image must be smaller than 2MB");return}const p=new FileReader;p.onerror=ye,p.onloadend=()=>{p.result&&h(p.result),c.current&&(c.current.value="")},p.readAsDataURL(f)},t[1]=h,t[2]=l):l=t[2];const a=l;let s;t[3]!==m||t[4]!==a?(s=n.jsx("input",{ref:c,type:"file",accept:"image/*",onChange:a,className:"hidden",disabled:m}),t[3]=m,t[4]=a,t[5]=s):s=t[5];const r=y||void 0,d=o??"?";let g;t[6]!==r||t[7]!==d?(g=n.jsx(ae,{url:r,fallback:d,shape:"square",size:"base"}),t[6]=r,t[7]=d,t[8]=g):g=t[8];let x;return t[9]!==m||t[10]!==s||t[11]!==g?(x=n.jsxs("button",{type:"button",onClick:i,disabled:m,className:"rounded-lg overflow-hidden hover:ring-2 hover:ring-border transition-all disabled:opacity-50","aria-label":"Upload organization logo",children:[s,g]}),t[9]=m,t[10]=s,t[11]=g,t[12]=x):x=t[12],x}function ye(){return D.error("Failed to read image")}function ve(){const e=H(),{org:t}=V(),y=te(),h=Y(),o=Z({resolver:W(xe),values:{name:t.name??"",slug:t.slug??"",logo:t.logo??""}}),m=M({mutationFn:async a=>{const s={name:a.name,slug:a.slug};a.logo&&(s.logo=a.logo);const r=await y.organization.update({data:s});if(r?.error)throw new Error(r.error.message||"Failed to update organization");return r},onSuccess:(a,s)=>{L("organization_settings_updated",{organization_id:t.id,fields:Object.keys(s)}),h.invalidateQueries({queryKey:q.organizations()}),h.invalidateQueries({queryKey:q.activeOrganization(t.slug)}),D.success("Organization updated successfully"),a?.data?.slug&&a.data.slug!==t.slug&&e({to:"/$org/settings/general",params:{org:a.data.slug}})},onError:(a,s)=>{L("organization_settings_update_failed",{organization_id:t.id,fields:Object.keys(s),error:a instanceof Error?a.message:String(a)}),D.error(a instanceof Error?a.message:"Failed to update organization")}}),{schedule:c,flush:u}=ne({save:async()=>{const a=o.control._formState.dirtyFields;if(Object.keys(a).length===0||!await o.trigger())return;const r=o.getValues(),d=o.control._defaultValues;o.reset(r,{keepValues:!0});try{await m.mutateAsync(r)}catch{o.reset(d,{keepValues:!0})}}}),i=o.formState.errors,l=typeof window<"u"?`${window.location.host}/`:"";return n.jsx(K,{children:n.jsxs(U,{children:[n.jsx(F,{title:"Logo",description:"Recommended size is 256x256px",action:n.jsx(je,{value:o.watch("logo"),onChange:a=>{o.setValue("logo",a??"",{shouldDirty:!0}),u()},name:o.watch("name")})}),n.jsx(F,{title:"Name",action:n.jsx(B,{control:o.control,name:"name",render:({field:a})=>n.jsx(G,{id:"org-name",...a,onChange:s=>{a.onChange(s),c()},onBlur:()=>{a.onBlur(),u()},placeholder:"Organization name",className:"w-[280px]"})})}),n.jsx(F,{title:"URL",action:n.jsxs("div",{className:"flex items-center w-[280px] rounded-md border border-input bg-input/30 focus-within:ring-2 focus-within:ring-ring/50 overflow-hidden",children:[l&&n.jsx("span",{className:"pl-3 text-sm text-muted-foreground select-none",children:l}),n.jsx(B,{control:o.control,name:"slug",render:({field:a})=>n.jsx("input",{id:"org-slug",value:a.value??"",name:a.name,ref:a.ref,placeholder:"my-organization",className:"flex-1 min-w-0 bg-transparent px-2 py-1.5 text-sm text-foreground placeholder:text-muted-foreground/60 outline-none",onChange:s=>{const r=s.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"");o.setValue("slug",r,{shouldDirty:!0,shouldTouch:!0,shouldValidate:!0}),c()},onBlur:()=>{a.onBlur(),u()}})})]})}),(i.name||i.slug||i.logo)&&n.jsxs("div",{className:"px-5 pb-3 flex flex-col gap-1",children:[i.name&&n.jsx("p",{className:"text-xs text-destructive",children:i.name.message}),i.slug&&n.jsx("p",{className:"text-xs text-destructive",children:i.slug.message}),i.logo&&n.jsx("p",{className:"text-xs text-destructive",children:i.logo.message})]})]})})}function be(){const e=I.c(45),{org:t}=V(),[y,h]=T.useState(!1),[o,m]=T.useState("");let c;e[0]!==t.id||e[1]!==t.slug?(c={connectionId:ie,orgSlug:t.slug,orgId:t.id},e[0]=t.id,e[1]=t.slug,e[2]=c):c=e[2];const u=re(c);let i;e[3]!==t.id||e[4]!==u?(i=async()=>{const v=await u.callTool({name:"ORGANIZATION_DELETE",arguments:{id:t.id}});if(v.isError){const N=v.content,Q=Array.isArray(N)&&N[0]?.type==="text"&&typeof N[0].text=="string"?N[0].text:"Failed to delete organization";throw new Error(Q)}},e[3]=t.id,e[4]=u,e[5]=i):i=e[5];let l;e[6]!==t.id||e[7]!==t.slug?(l=()=>{L("organization_deleted",{organization_id:t.id}),localStorage.getItem($.lastOrgSlug())===t.slug&&localStorage.removeItem($.lastOrgSlug()),ee(),D.success("Organization deleted"),window.location.href="/"},e[6]=t.id,e[7]=t.slug,e[8]=l):l=e[8];let a;e[9]!==i||e[10]!==l?(a={mutationFn:i,onSuccess:l,onError:Se},e[9]=i,e[10]=l,e[11]=a):a=e[11];const s=M(a);let r;e[12]===Symbol.for("react.memo_cache_sentinel")?(r=()=>h(!0),e[12]=r):r=e[12];let d;e[13]!==s.isPending?(d=n.jsx(K,{title:"Danger Zone",description:"Irreversible actions that affect your entire organization.",children:n.jsx(U,{className:"border-destructive/40",children:n.jsx(F,{title:"Delete organization",description:"Permanently delete this organization and all of its data. This action cannot be undone.",action:n.jsx(X,{variant:"destructive",size:"sm",onClick:r,disabled:s.isPending,children:"Delete"})})})}),e[13]=s.isPending,e[14]=d):d=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=v=>{h(v),v||m("")},e[15]=g):g=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(le,{children:"Delete Organization?"}),e[16]=x):x=e[16];let j;e[17]!==t.name?(j=n.jsxs("p",{children:["This will permanently delete all data associated with"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name}),". This action cannot be undone."]}),e[17]=t.name,e[18]=j):j=e[18];let f;e[19]!==t.name?(f=n.jsxs("p",{className:"mt-3 mb-1.5",children:["Type"," ",n.jsx("span",{className:"font-medium text-foreground",children:t.name})," ","to confirm:"]}),e[19]=t.name,e[20]=f):f=e[20];let p;e[21]===Symbol.for("react.memo_cache_sentinel")?(p=v=>m(v.target.value),e[21]=p):p=e[21];let b;e[22]!==o||e[23]!==t.name?(b=n.jsx(G,{value:o,onChange:p,placeholder:t.name,autoFocus:!0}),e[22]=o,e[23]=t.name,e[24]=b):b=e[24];let S;e[25]!==b||e[26]!==j||e[27]!==f?(S=n.jsxs(ce,{children:[x,n.jsx(ue,{asChild:!0,children:n.jsxs("div",{children:[j,f,b]})})]}),e[25]=b,e[26]=j,e[27]=f,e[28]=S):S=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=n.jsx(de,{children:"Cancel"}),e[29]=A):A=e[29];let z;e[30]!==s?(z=()=>s.mutate(),e[30]=s,e[31]=z):z=e[31];const P=o!==t.name||s.isPending,R=s.isPending?"Deleting…":"Delete organization";let C;e[32]!==z||e[33]!==P||e[34]!==R?(C=n.jsxs(me,{children:[A,n.jsx(ge,{onClick:z,disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 disabled:opacity-50",children:R})]}),e[32]=z,e[33]=P,e[34]=R,e[35]=C):C=e[35];let _;e[36]!==S||e[37]!==C?(_=n.jsxs(fe,{children:[S,C]}),e[36]=S,e[37]=C,e[38]=_):_=e[38];let w;e[39]!==y||e[40]!==_?(w=n.jsx(pe,{open:y,onOpenChange:g,children:_}),e[39]=y,e[40]=_,e[41]=w):w=e[41];let O;return e[42]!==w||e[43]!==d?(O=n.jsxs(n.Fragment,{children:[d,w]}),e[42]=w,e[43]=d,e[44]=O):O=e[44],O}function Se(e){D.error(e instanceof Error?e.message:"Failed to delete organization")}function ze(){const e=I.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(E,{children:n.jsx(E.Content,{children:n.jsx(E.Body,{children:n.jsxs(se,{children:[n.jsx(E.Title,{children:"Organization"}),n.jsx(ve,{}),n.jsx(oe,{}),n.jsx(be,{})]})})})}),e[0]=t):t=e[0],t}function He(){const e=I.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=n.jsx(he,{capability:"org:manage",area:"general settings",children:n.jsx(ze,{})}),e[0]=t):t=e[0],t}export{He as default};
@@ -1,5 +0,0 @@
1
- import{e as y,r as v,j as o,B as W,C as we,c as ee,q as M,G as ce,a as Q,K as C,n as V,b6 as xe,o as re,a0 as ge,l as ye}from"./index-biiHZ5l9.js";import{D as je,a as ke,b as be,c as ie}from"./dropdown-menu-CIu58K9q.js";import{b as B,T as A,a as K}from"./tooltip-bsrBmmjV.js";import{i as ve}from"./Check-D-9dblUn.js";import{a as Se}from"./Eye-ByuwKsdh.js";import{n as Z}from"./Globe01-DfGFlik1.js";import{e as $e,f as Te,i as Ee,b as Ce}from"./ZoomOut-D8vQ49we.js";import{i as Me}from"./LayoutLeft-CQ8Vq9nI.js";import{n as Fe}from"./LinkExternal01-CgI1VTqi.js";import{S as G}from"./skeleton--DN75sg7.js";import{l as Ne,F as De}from"./index-BflNEs6l.js";import{F as Pe,M as Ue}from"./file-type-icon-CX5JEvCQ.js";function ze(n){if(!n||n.includes("/")||n.includes("\\")||n.includes("..")||n.includes("\0"))return!0;try{const e=decodeURIComponent(n);return e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")}catch{return!0}}function Oe(n){if(ze(n))throw new Error(`Invalid block key: ${n||"(empty)"}`)}function Re(n){try{return decodeURIComponent(n)}catch{return n}}function _e(n){return Oe(n),encodeURIComponent(n)}function We(n){return`.deco/blocks/${_e(n)}.json`}function kt(n){return`/${We(n)}`}const bt=1e4,Le=3;function J(n){return n.trim()?(n.startsWith("/")?n:`/${n}`).replace(/\/+/g,"/"):"/"}function te(n){return n.startsWith("/")?n.slice(1):n}function Y(n){return n.trim()?n.startsWith("/")?n:`/${n}`:"/"}function qe(n){const e=Y(n);if(e==="/")return"/";const t=e.split("/").filter(Boolean);return t.pop(),t.length===0?"/":`/${t.join("/")}`}function vt(n,e){const t=e.replace(/^\/+|\/+$/g,"");return Y(t?`${n==="/"?"":n}/${t}`:n)}function St(n,e){return e==="directory"?n:qe(n)}function $t(n){const e=n.trim();return e?e.includes("/")||e.includes("\\")||e.includes("..")||e.includes("\0")?"Name cannot contain /, \\, or ..":e.startsWith(".")?"Name cannot start with a dot":null:"Name is required"}function Ie(n){const e=te(n);return e?e.split("/").filter(Boolean).length:0}function Tt(n,e,t,s=!1){return{files:[...new Set([...n,...t.files])],directories:[...new Set([...e,...t.directories??[]])],truncated:s||!!t.truncated}}function Et(n,e){return Ie(n)>Le&&!e.has(n)}function Ct(n,e,t=[]){const s=te(n);if(e.includes(s)||t.includes(s))return!0;if(!s)return!1;const r=`${s}/`;return e.some(i=>i.startsWith(r))||t.some(i=>i.startsWith(r))}function Mt(n){const e=te(n),t=".deco/blocks/";if(!e.startsWith(t)||!e.endsWith(".json"))return null;const s=e.slice(t.length,-5);return Re(s)}function Be(n){if(!n)return"plaintext";const e=n.toLowerCase();return e.endsWith(".tsx")||e.endsWith(".ts")?"typescript":e.endsWith(".jsx")||e.endsWith(".js")||e.endsWith(".mjs")||e.endsWith(".cjs")?"javascript":e.endsWith(".json")?"json":e.endsWith(".md")||e.endsWith(".mdx")?"markdown":e.endsWith(".css")?"css":e.endsWith(".scss")?"scss":e.endsWith(".html")?"html":e.endsWith(".yaml")||e.endsWith(".yml")?"yaml":e.endsWith(".xml")||e.endsWith(".svg")?"xml":e.endsWith(".py")?"python":e.endsWith(".sql")?"sql":e.endsWith(".sh")?"shell":"plaintext"}function Ft(n){const e=J(n).split("/").filter(Boolean),t=["/"];let s="";for(const r of e.slice(0,-1))s+=`/${r}`,t.push(s);return t}function Nt(n,e=[]){const t={children:[]},s=i=>{const d=J(i).split("/").filter(Boolean);let c=t,l="";for(const u of d){l+=`/${u}`;let f=c.children.find(m=>m.name===u);f?f.kind==="file"&&(f.kind="directory"):(f={name:u,path:l,kind:"directory",children:[]},c.children.push(f)),c=f}};for(const i of n){const d=J(i).split("/").filter(Boolean);let c=t,l="";d.forEach((u,f)=>{l+=`/${u}`;const m=f===d.length-1;let x=c.children.find(k=>k.name===u);x||(x={name:u,path:l,kind:m?"file":"directory",children:[]},c.children.push(x)),c=x})}for(const i of e)s(Y(i));const r=i=>{i.sort((a,d)=>a.kind!==d.kind?a.kind==="directory"?-1:1:a.name.localeCompare(d.name));for(const a of i)a.children.length>0&&r(a.children)};return r(t.children),t.children}function Ae(n,e,t=0){const s=[];for(const r of n)r.name!==".gitkeep"&&(s.push({node:r,depth:t}),r.kind==="directory"&&r.children.length>0&&e.has(r.path)&&s.push(...Ae(r.children,e,t+1)));return s}function Dt(n){return n.split(`
2
- `).map(e=>{const t=e.match(/^\d+\t(.*)/);return t?t[1]:e}).join(`
3
- `)}function Ke(n){const e=y.c(53),{readUrl:t,editor:s,downloadName:r,trailing:i}=n,[a,d]=v.useState(!1);let c;e[0]!==t?(c=new URL(t,window.location.origin).toString(),e[0]=t,e[1]=c):c=e[1];const l=c;let u;e[2]!==l?(u=()=>{navigator.clipboard.writeText(l),d(!0),window.setTimeout(()=>d(!1),1500)},e[2]=l,e[3]=u):u=e[3];const f=u;let m;e[4]!==s?(m=s.deckDetected&&o.jsxs(B,{children:[o.jsx(A,{asChild:!0,children:o.jsx(W,{variant:s.railOpen?"secondary":"ghost",size:"icon","aria-label":s.railOpen?"Hide slide list":"Show slide list",onClick:()=>s.setRailOpen(!s.railOpen),children:o.jsx(Me,{size:14})})}),o.jsx(K,{side:"bottom",children:s.railOpen?"Hide slide list":"Show slide list"})]}),e[4]=s,e[5]=m):m=e[5];let x;e[6]!==l?(x=()=>window.open(l,"_blank","noopener"),e[6]=l,e[7]=x):x=e[7];let k;e[8]!==l?(k=o.jsx("span",{className:"truncate",children:l}),e[8]=l,e[9]=k):k=e[9];let b;e[10]!==l||e[11]!==x||e[12]!==k?(b=o.jsx("button",{type:"button",onClick:x,className:"flex min-w-0 flex-1 items-center rounded-md px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:l,children:k}),e[10]=l,e[11]=x,e[12]=k,e[13]=b):b=e[13];let g;e[14]!==s.agentUpdated||e[15]!==s.reload?(g=s.agentUpdated&&o.jsxs(B,{children:[o.jsx(A,{asChild:!0,children:o.jsxs(W,{variant:"outline",size:"sm",className:"h-7 gap-1 text-xs",onClick:s.reload,children:[o.jsx(we,{size:12}),"Agent updated — reload"]})}),o.jsx(K,{side:"bottom",children:"The agent rewrote this deck while you were editing. Reloading discards unsaved differences."})]}),e[14]=s.agentUpdated,e[15]=s.reload,e[16]=g):g=e[16];let j;e[17]!==s.saving?(j=s.saving&&o.jsx("span",{className:"px-1 text-xs text-muted-foreground",children:"Saving…"}),e[17]=s.saving,e[18]=j):j=e[18];let S;e[19]!==s?(S=s.deckDetected&&s.writable&&o.jsxs(B,{children:[o.jsx(A,{asChild:!0,children:o.jsx(W,{variant:s.editMode?"secondary":"ghost",size:"icon","aria-label":s.editMode?"Done editing":"Edit inline",className:ee(s.editMode&&"text-primary"),onClick:()=>s.setEditMode(!s.editMode),children:o.jsx($e,{size:14})})}),o.jsx(K,{side:"bottom",children:s.editMode?"Done editing":"Edit inline (text, reorder, delete)"})]}),e[19]=s,e[20]=S):S=e[20];let E;e[21]!==l||e[22]!==r||e[23]!==s.deckDetected?(E=s.deckDetected?o.jsxs(je,{children:[o.jsx(ke,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Download",children:o.jsx(Z,{size:14})})}),o.jsxs(be,{align:"end",children:[o.jsxs(ie,{onClick:()=>window.open(`${l}#print`,"_blank","noopener"),children:[o.jsx(Te,{size:14}),"Export as PDF"]}),o.jsx(ie,{asChild:!0,children:o.jsxs("a",{href:l,download:r,children:[o.jsx(Ee,{size:14}),"Download HTML"]})})]})]}):o.jsxs(B,{children:[o.jsx(A,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Download",asChild:!0,children:o.jsx("a",{href:l,download:r,children:o.jsx(Z,{size:14})})})}),o.jsx(K,{side:"bottom",children:"Download"})]}),e[21]=l,e[22]=r,e[23]=s.deckDetected,e[24]=E):E=e[24];let D;e[25]!==a?(D=a?o.jsx(ve,{size:14}):o.jsx(Se,{size:14}),e[25]=a,e[26]=D):D=e[26];let P;e[27]!==f||e[28]!==D?(P=o.jsx(A,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Copy URL",onClick:f,children:D})}),e[27]=f,e[28]=D,e[29]=P):P=e[29];const X=a?"Copied":"Copy URL";let p;e[30]!==X?(p=o.jsx(K,{side:"bottom",children:X}),e[30]=X,e[31]=p):p=e[31];let U;e[32]!==P||e[33]!==p?(U=o.jsxs(B,{children:[P,p]}),e[32]=P,e[33]=p,e[34]=U):U=e[34];let F;e[35]!==l?(F=()=>window.open(l,"_blank","noopener"),e[35]=l,e[36]=F):F=e[36];let $;e[37]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(Fe,{size:14}),e[37]=$):$=e[37];let T;e[38]!==F?(T=o.jsx(A,{asChild:!0,children:o.jsx(W,{variant:"ghost",size:"icon","aria-label":"Open in new tab",onClick:F,children:$})}),e[38]=F,e[39]=T):T=e[39];let I;e[40]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(K,{side:"bottom",children:"Open in new tab"}),e[40]=I):I=e[40];let z;e[41]!==T?(z=o.jsxs(B,{children:[T,I]}),e[41]=T,e[42]=z):z=e[42];let O;return e[43]!==E||e[44]!==U||e[45]!==z||e[46]!==m||e[47]!==b||e[48]!==g||e[49]!==j||e[50]!==S||e[51]!==i?(O=o.jsxs("div",{className:"flex h-9 shrink-0 items-center gap-1 border-b border-border/60 px-2",children:[m,b,g,j,S,E,U,z,i]}),e[43]=E,e[44]=U,e[45]=z,e[46]=m,e[47]=b,e[48]=g,e[49]=j,e[50]=S,e[51]=i,e[52]=O):O=e[52],O}function He(n){return n.contentHash??`${n.size}-${n.updatedAt}`}function N(n,e,t,s){const r=new URLSearchParams(s).toString();return`/api/${encodeURIComponent(n)}/fs/${encodeURIComponent(e)}/${t}${r?`?${r}`:""}`}async function q(n,e){const t=await fetch(n,e);if(!t.ok){let s="";try{s=(await t.json()).error??""}catch{}throw new Error(s||`HTTP ${t.status}`)}return t}function Pt(n,e){const t=y.c(11),{org:s}=M();let r;t[0]!==s.id||t[1]!==e||t[2]!==n?(r=C.orgFsList(s.id,n,e),t[0]=s.id,t[1]=e,t[2]=n,t[3]=r):r=t[3];let i;t[4]!==s.slug||t[5]!==e||t[6]!==n?(i=async()=>(await(await q(N(s.slug,n,"list",{path:e}))).json()).entries.toSorted(Ve),t[4]=s.slug,t[5]=e,t[6]=n,t[7]=i):i=t[7];let a;return t[8]!==r||t[9]!==i?(a={queryKey:r,placeholderData:xe,queryFn:i},t[8]=r,t[9]=i,t[10]=a):a=t[10],V(a)}function Ve(n,e){return n.kind!==e.kind?n.kind==="dir"?-1:1:n.path.localeCompare(e.path)}function Ut(n,e,t){const s=y.c(15),{org:r}=M();let i;s[0]!==r.id||s[1]!==e||s[2]!==n?(i=C.orgFsStat(r.id,n??"",e),s[0]=r.id,s[1]=e,s[2]=n,s[3]=i):i=s[3];const a=n!==null;let d;s[4]!==t?(d=t?.refetchIntervalWhenAbsent?u=>u.state.data?!1:t.refetchIntervalWhenAbsent??!1:void 0,s[4]=t,s[5]=d):d=s[5];let c;s[6]!==r.slug||s[7]!==e||s[8]!==n?(c=async()=>{const u=await fetch(N(r.slug,n??"","stat",{path:e}));if(u.status===404)return null;if(!u.ok)throw new Error(`HTTP ${u.status}`);return(await u.json()).entry},s[6]=r.slug,s[7]=e,s[8]=n,s[9]=c):c=s[9];let l;return s[10]!==i||s[11]!==a||s[12]!==d||s[13]!==c?(l={queryKey:i,enabled:a,refetchInterval:d,queryFn:c},s[10]=i,s[11]=a,s[12]=d,s[13]=c,s[14]=l):l=s[14],V(l)}function zt(n){const e=y.c(9),{org:t}=M();let s;e[0]!==t.id||e[1]!==n?(s=C.orgFsUsage(t.id,n),e[0]=t.id,e[1]=n,e[2]=s):s=e[2];let r;e[3]!==t.slug||e[4]!==n?(r=async()=>await(await q(N(t.slug,n,"usage"))).json(),e[3]=t.slug,e[4]=n,e[5]=r):r=e[5];let i;return e[6]!==s||e[7]!==r?(i={queryKey:s,queryFn:r},e[6]=s,e[7]=r,e[8]=i):i=e[8],V(i)}function Ot(n){const e=y.c(8),t=60,{org:s}=M();let r;e[0]!==s.id?(r=C.orgFsRecent(s.id),e[0]=s.id,e[1]=r):r=e[1];let i;e[2]!==t||e[3]!==s.slug?(i=async()=>(await(await q(`/api/${encodeURIComponent(s.slug)}/fs/recent?limit=${t}`)).json()).entries,e[2]=t,e[3]=s.slug,e[4]=i):i=e[4];let a;return e[5]!==r||e[6]!==i?(a={queryKey:r,queryFn:i},e[5]=r,e[6]=i,e[7]=a):a=e[7],V(a)}function Rt(){const n=y.c(7),{org:e}=M();let t;n[0]!==e.id?(t=C.orgFsPublicSets(e.id),n[0]=e.id,n[1]=t):t=n[1];let s;n[2]!==e.slug?(s=async()=>(await(await q(`/api/${encodeURIComponent(e.slug)}/fs/public-sets`)).json()).sets,n[2]=e.slug,n[3]=s):s=n[3];let r;return n[4]!==t||n[5]!==s?(r={queryKey:t,staleTime:3e5,queryFn:s},n[4]=t,n[5]=s,n[6]=r):r=n[6],V(r)}function _t(n){const e=y.c(3),{org:t}=M();let s;return e[0]!==t.slug||e[1]!==n?(s=r=>N(t.slug,n,"read",{path:r}),e[0]=t.slug,e[1]=n,e[2]=s):s=e[2],s}function Wt(){const n=y.c(2),{org:e}=M();let t;return n[0]!==e.slug?(t=(s,r)=>N(e.slug,s,"read",{path:r}),n[0]=e.slug,n[1]=t):t=n[1],t}function Xe(n){const e=y.c(3),{org:t}=M();let s;return e[0]!==t||e[1]!==n?(s={mutationFn:async r=>(await(await q(N(t.slug,n,"file",{path:r.path}),{method:"PUT",headers:{"content-type":r.contentType??"text/html; charset=utf-8"},body:r.body})).json()).entry},e[0]=t,e[1]=n,e[2]=s):s=e[2],Q(s)}function Lt(n){const e=y.c(26),{org:t}=M(),s=ce();let r;e[0]!==t||e[1]!==s||e[2]!==n?(r=()=>{s.invalidateQueries({queryKey:C.orgFsVolume(t.id,n)}),s.invalidateQueries({queryKey:C.orgFsRecent(t.id)})},e[0]=t,e[1]=s,e[2]=n,e[3]=r):r=e[3];const i=r;let a;e[4]!==t||e[5]!==n?(a=async g=>{for(const j of g.files){const S=g.dir?`${g.dir}/${j.name}`:j.name;await q(N(t.slug,n,"file",{path:S}),{method:"PUT",headers:{"content-type":j.type||"application/octet-stream"},body:j})}},e[4]=t,e[5]=n,e[6]=a):a=e[6];let d;e[7]!==i||e[8]!==a?(d={mutationFn:a,onSettled:i},e[7]=i,e[8]=a,e[9]=d):d=e[9];const c=Q(d);let l;e[10]!==t||e[11]!==n?(l=async g=>{await q(N(t.slug,n,"dir",{path:g}),{method:"POST"})},e[10]=t,e[11]=n,e[12]=l):l=e[12];let u;e[13]!==i||e[14]!==l?(u={mutationFn:l,onSuccess:i},e[13]=i,e[14]=l,e[15]=u):u=e[15];const f=Q(u);let m;e[16]!==t||e[17]!==n?(m=async g=>{await q(N(t.slug,n,"file",{path:g}),{method:"DELETE"})},e[16]=t,e[17]=n,e[18]=m):m=e[18];let x;e[19]!==i||e[20]!==m?(x={mutationFn:m,onSuccess:i},e[19]=i,e[20]=m,e[21]=x):x=e[21];const k=Q(x);let b;return e[22]!==f||e[23]!==k||e[24]!==c?(b={upload:c,mkdir:f,remove:k},e[22]=f,e[23]=k,e[24]=c,e[25]=b):b=e[25],b}const H=1;function Ge(n){if(typeof n!="object"||n===null||n.v!==H||n.source!=="deck-viewer")return null;const e=n;return e.type==="ready"||e.type==="state"||e.type==="op"&&typeof e.opId=="string"&&e.op?e:null}class L extends Error{constructor(e,t){super(e),this.code=t,this.name="DeckOpError"}code}function de(n){return[...n.children].filter(e=>!/^(TEMPLATE|SCRIPT|STYLE)$/.test(e.tagName))}function Qe(n){const t=new DOMParser().parseFromString(n,"text/html").querySelector("deck-viewer");return t?de(t).length:null}function Ye(n,e){const t=new DOMParser().parseFromString(n,"text/html"),s=t.querySelector("deck-viewer");if(!s)throw new L("no <deck-viewer> element in source","no-viewer");const r=de(s),i=e.kind==="move"?e.from:e.at,a=r[i];if(!a)throw new L(`slide index ${i} out of range (${r.length})`,"stale-index");switch(e.kind){case"remove":{if(r.length<=1)throw new L("cannot remove the last slide","bad-op");a.remove();break}case"duplicate":{const c=a.cloneNode(!0);c.removeAttribute("id");for(const l of c.querySelectorAll("[id]"))l.removeAttribute("id");a.after(c);break}case"move":{if(e.to<0||e.to>=r.length)throw new L(`move target ${e.to} out of range`,"stale-index");if(e.to!==e.from){const c=e.to<e.from?r[e.to]:r[e.to].nextSibling;s.insertBefore(a,c)}break}case"set-attr":{if(!/^[a-zA-Z][\w-]*$/.test(e.name))throw new L(`invalid attribute name: ${e.name}`,"bad-op");a.setAttribute(e.name,e.value);break}case"remove-attr":{a.removeAttribute(e.name);break}case"replace":{const l=new DOMParser().parseFromString(e.html,"text/html").body.firstElementChild;if(!l)throw new L("replace html has no root element","bad-op");a.replaceWith(t.importNode(l,!0));break}default:throw new L(`unknown op kind: ${e.kind}`,"bad-op")}return`${n.trimStart().toLowerCase().startsWith("<!doctype")?`<!DOCTYPE html>
4
- `:""}${t.documentElement.outerHTML}
5
- `}const oe="home",Ze=400,Je=800;function et(n){const e=n.savePath!==void 0,{org:t}=M(),s=ce(),r=Xe(oe),[i,a]=v.useState(!1),[d,c]=v.useState(!1),[l,u]=v.useState(!1),[f,m]=v.useState(!1),[x,k]=v.useState(!1),[b,g]=v.useState(!1),[j,S]=v.useState(null),[E,D]=v.useState(null),[P,X]=v.useState(0),[p]=v.useState(()=>({iframe:null,source:null,queue:Promise.resolve(),saveTimer:null,selfMarkers:new Set})),U=i||b||x,F=()=>{n.savePath!==void 0&&(s.invalidateQueries({queryKey:C.orgFsStat(t.id,oe,n.savePath)}),s.invalidateQueries({queryKey:C.orgFsRecent(t.id)}))},$=h=>{p.iframe?.contentWindow?.postMessage(h,"*")},T=()=>{p.source=null,m(!1),E&&S(E),X(h=>h+1),F()};n.statMarker!==E&&(D(n.statMarker),n.statMarker!==null&&(j===null?S(n.statMarker):p.selfMarkers.has(n.statMarker)||n.statMarker!==j&&(U?m(!0):(p.source=null,S(n.statMarker)))));const I=async()=>{p.saveTimer=null;const h=p.source;if(h===null){g(!1);return}k(!0);try{const w=await r.mutateAsync({path:n.savePath,body:h});p.selfMarkers.add(He(w)),F()}catch(w){console.error("[deck-editor] save failed",w),re.error("Couldn't save deck edits — reloading the preview."),R.current.reload()}finally{k(!1),g(!1)}},z=h=>{g(!0),p.saveTimer&&clearTimeout(p.saveTimer),p.saveTimer=setTimeout(()=>{R.current.flushSave()},h)},O=(h,w,_)=>{$({v:H,type:"ack",opId:h,ok:w,error:_})},ne=async h=>{if(!e){O(h.opId,!1,"read-only preview");return}try{if(p.source===null){const _=await fetch(n.readUrl,{credentials:"include"});if(!_.ok)throw new Error(`HTTP ${_.status}`);p.source=await _.text()}const w=Qe(p.source);if(w===null||w!==h.witness.childCount)throw new L(`slide count drifted (source ${w}, iframe ${h.witness.childCount})`,"stale-index");p.source=Ye(p.source,h.op),O(h.opId,!0),z(h.op.kind==="replace"?Je:Ze)}catch(w){console.error("[deck-editor] op failed",h.op,w),O(h.opId,!1,w instanceof Error?w.message:String(w)),re.error("That edit couldn't be saved — reloading the preview."),R.current.reload()}},se=h=>{if(!p.iframe||h.source!==p.iframe.contentWindow)return;const w=Ge(h.data);if(w){if(w.type==="ready"){c(!0),R.current.editMode?$({v:H,type:"set-edit-mode",enabled:!0}):R.current.railOpen&&$({v:H,type:"set-rail",open:!0});return}w.type==="op"&&(p.queue=p.queue.then(()=>R.current.handleOp(w)).catch(()=>{}))}},R=v.useRef({onMessage:se,handleOp:ne,flushSave:I,reload:T,editMode:i,railOpen:l});R.current={onMessage:se,handleOp:ne,flushSave:I,reload:T,editMode:i,railOpen:l};const[fe]=v.useState(()=>{let h=null;return w=>{if(w){p.iframe=w;const _=pe=>R.current.onMessage(pe);window.addEventListener("message",_),h=()=>window.removeEventListener("message",_)}else h?.(),h=null,p.iframe=null}}),me=h=>{u(h),$({v:H,type:"set-rail",open:h})},he=h=>{a(h),$({v:H,type:"set-edit-mode",enabled:h}),h&&u(!0),!h&&f&&!b&&!x&&T()};return{iframeRef:fe,deckDetected:d,writable:e,displayedMarker:j===null?null:`${j}.${P}`,editMode:i,setEditMode:he,railOpen:l,setRailOpen:me,saving:x,agentUpdated:f,reload:T,postToIframe:$}}const tt=300;function qt({readUrl:n,marker:e,title:t,savePath:s,trailing:r}){const i=et({readUrl:n,statMarker:e,savePath:s}),[a,d]=v.useState(null);if(i.displayedMarker===null)return null;const c=n.includes("?")?"&":"?",l=`${n}${c}v=${encodeURIComponent(i.displayedMarker)}`,u=a===l;return o.jsxs("div",{className:"flex h-full w-full flex-col bg-background",children:[o.jsx(Ke,{readUrl:n,editor:i,downloadName:t.split("/").pop()??t,trailing:r}),o.jsx("div",{className:"relative flex-1",children:o.jsx("iframe",{ref:i.iframeRef,src:l,onLoad:()=>d(l),sandbox:"allow-scripts",className:ee("absolute inset-0 block h-full w-full bg-white","transition-opacity ease-out",u?"opacity-100":"opacity-0"),style:{transitionDuration:`${tt}ms`},title:t},l)})]})}Ne.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.0/min/vs"}});function nt(n){const e=y.c(11),{value:t,filename:s}=n,[r]=ge(),i=r.theme==="dark"||r.theme==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches;let a;e[0]!==s?(a=Be(s),e[0]=s,e[1]=a):a=e[1];const d=i?"vs-dark":"light";let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsx(ye,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2];let l,u;e[3]===Symbol.for("react.memo_cache_sentinel")?(l={enabled:!1},u={top:12,bottom:12},e[3]=l,e[4]=u):(l=e[3],u=e[4]);let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f={readOnly:!0,domReadOnly:!0,fontSize:13,scrollBeyondLastLine:!1,automaticLayout:!0,lineNumbersMinChars:3,wordWrap:"on",minimap:l,padding:u,renderLineHighlight:"none",scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8}},e[5]=f):f=e[5];let m;return e[6]!==s||e[7]!==a||e[8]!==d||e[9]!==t?(m=o.jsx(De,{path:s,language:a,value:t,theme:d,loading:c,options:f},s),e[6]=s,e[7]=a,e[8]=d,e[9]=t,e[10]=m):m=e[10],m}function st(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}const rt=new Set(["png","jpg","jpeg","gif","webp","svg","avif"]),it=new Set(["txt","json","csv","tsv","log","yaml","yml","xml","toml","ts","tsx","js","jsx","py","rb","go","rs","java","sh","sql"]),le=2*1024*1024;function ot(n,e){const t=n.split(".").pop()?.toLowerCase()??"";return rt.has(t)?"image":t==="pdf"?"pdf":t==="html"||t==="htm"?"html":t==="md"||t==="markdown"?e<=le?"markdown":"download":it.has(t)&&e<=le?"text":"download"}function lt(){const n=y.c(2);let e;n[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(G,{className:"h-6 w-2/3"}),n[0]=e):e=n[0];let t;return n[1]===Symbol.for("react.memo_cache_sentinel")?(t=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex w-3/4 max-w-md flex-col gap-3 p-6",children:[e,o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsx(G,{className:"h-3 w-full"}),o.jsx(G,{className:"h-3 w-5/6"}),o.jsx(G,{className:"h-3 w-2/3"})]})]})}),n[1]=t):t=n[1],t}function ue(n){const e=y.c(20),{file:t,note:s}=n;let r;e[0]!==t.filename?(r=o.jsx(Pe,{filename:t.filename,className:"h-12 w-10"}),e[0]=t.filename,e[1]=r):r=e[1];let i;e[2]!==t.filename?(i=o.jsx("span",{className:"text-sm font-medium text-foreground",children:t.filename}),e[2]=t.filename,e[3]=i):i=e[3];let a;e[4]!==t.size?(a=st(t.size),e[4]=t.size,e[5]=a):a=e[5];const d=s?` · ${s}`:"";let c;e[6]!==a||e[7]!==d?(c=o.jsxs("span",{className:"text-xs text-muted-foreground",children:[a,d]}),e[6]=a,e[7]=d,e[8]=c):c=e[8];let l;e[9]!==i||e[10]!==c?(l=o.jsxs("div",{className:"flex flex-col items-center gap-0.5",children:[i,c]}),e[9]=i,e[10]=c,e[11]=l):l=e[11];let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(Z,{size:14}),e[12]=u):u=e[12];let f;e[13]!==t.downloadUrl||e[14]!==t.filename?(f=o.jsx(W,{asChild:!0,variant:"outline",size:"sm",children:o.jsxs("a",{href:t.downloadUrl,download:t.filename,children:[u,"Download"]})}),e[13]=t.downloadUrl,e[14]=t.filename,e[15]=f):f=e[15];let m;return e[16]!==r||e[17]!==l||e[18]!==f?(m=o.jsx("div",{className:"flex h-full w-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-muted/30 px-10 py-8",children:[r,l,f]})}),e[16]=r,e[17]=l,e[18]=f,e[19]=m):m=e[19],m}function ae(n){const e=y.c(16),{file:t,markdown:s}=n;let r;e[0]!==t.downloadUrl?(r=C.fileText(t.downloadUrl),e[0]=t.downloadUrl,e[1]=r):r=e[1];let i;e[2]!==t.downloadUrl?(i=async()=>{const f=await fetch(t.downloadUrl,{credentials:"include"});if(!f.ok)throw new Error(`fetch failed: ${f.status}`);return f.text()},e[2]=t.downloadUrl,e[3]=i):i=e[3];let a;e[4]!==r||e[5]!==i?(a={queryKey:r,queryFn:i,staleTime:6e4,retry:!1},e[4]=r,e[5]=i,e[6]=a):a=e[6];const{data:d,isPending:c,isError:l}=V(a);if(c){let f;return e[7]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(lt,{}),e[7]=f):f=e[7],f}if(l||d===void 0){let f;return e[8]!==t?(f=o.jsx(ue,{file:t,note:"preview unavailable"}),e[8]=t,e[9]=f):f=e[9],f}if(s){const f=`file-preview-${t.key}`;let m;return e[10]!==d||e[11]!==f?(m=o.jsx("div",{className:"h-full overflow-y-auto",children:o.jsx("div",{className:"prose prose-sm dark:prose-invert mx-auto max-w-3xl px-6 py-6",children:o.jsx(Ue,{id:f,text:d})})}),e[10]=d,e[11]=f,e[12]=m):m=e[12],m}let u;return e[13]!==d||e[14]!==t.filename?(u=o.jsx(nt,{value:d,filename:t.filename}),e[13]=d,e[14]=t.filename,e[15]=u):u=e[15],u}function It(n){const e=y.c(15),{file:t}=n;switch(ot(t.filename,t.size)){case"image":{let r;return e[0]!==t.downloadUrl||e[1]!==t.filename?(r=o.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-auto bg-muted/30 p-4",children:o.jsx("img",{src:t.downloadUrl,alt:t.filename,className:"max-h-full max-w-full rounded-lg object-contain"})}),e[0]=t.downloadUrl,e[1]=t.filename,e[2]=r):r=e[2],r}case"pdf":{let r;return e[3]!==t.downloadUrl||e[4]!==t.filename?(r=o.jsx("iframe",{src:t.downloadUrl,title:t.filename,className:"block h-full w-full bg-white"}),e[3]=t.downloadUrl,e[4]=t.filename,e[5]=r):r=e[5],r}case"html":{let r;return e[6]!==t.downloadUrl||e[7]!==t.filename?(r=o.jsx("iframe",{src:t.downloadUrl,title:t.filename,sandbox:"allow-scripts",className:"block h-full w-full bg-white"}),e[6]=t.downloadUrl,e[7]=t.filename,e[8]=r):r=e[8],r}case"markdown":{let r;return e[9]!==t?(r=o.jsx(ae,{file:t,markdown:!0}),e[9]=t,e[10]=r):r=e[10],r}case"text":{let r;return e[11]!==t?(r=o.jsx(ae,{file:t,markdown:!1}),e[11]=t,e[12]=r):r=e[12],r}default:{let r;return e[13]!==t?(r=o.jsx(ue,{file:t}),e[13]=t,e[14]=r):r=e[14],r}}}function Bt(n){const e=y.c(13),{title:t,icon:s,active:r,onClick:i}=n,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let d;e[0]!==a?(d=ee("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=d):d=e[1];let c;e[2]!==s?(c=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(at,{icon:s})}),e[2]=s,e[3]=c):c=e[3];let l;e[4]!==t?(l=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:t}),e[4]=t,e[5]=l):l=e[5];let u;return e[6]!==r||e[7]!==i||e[8]!==d||e[9]!==c||e[10]!==l||e[11]!==t?(u=o.jsxs("button",{type:"button",onClick:i,"aria-pressed":r,"aria-label":t,className:d,children:[c,l]}),e[6]=r,e[7]=i,e[8]=d,e[9]=c,e[10]=l,e[11]=t,e[12]=u):u=e[12],u}function at(n){const e=y.c(5),{icon:t}=n;if(t.kind==="component"){const{Component:r}=t;let i;return e[0]!==r?(i=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=i):i=e[1],i}if(t.kind==="url"){let r;return e[2]!==t.src?(r=o.jsx("img",{src:t.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=t.src,e[3]=r):r=e[3],r}let s;return e[4]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Ce,{className:"size-4"}),e[4]=s):s=e[4],s}export{qe as A,vt as B,Ct as C,Mt as D,Le as E,lt as F,Tt as G,qt as H,kt as a,It as b,_t as c,We as d,He as e,st as f,Be as g,Bt as h,Wt as i,Pt as j,Lt as k,Ot as l,Rt as m,zt as n,Oe as o,bt as p,Ft as q,Nt as r,Ae as s,St as t,Ut as u,te as v,Y as w,Et as x,Dt as y,$t as z};