decocms 3.73.0 → 3.74.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 (286) hide show
  1. package/dist/client/assets/{AlertCircle-Qsz79sot.js → AlertCircle-Ccspj6_x.js} +1 -1
  2. package/dist/client/assets/ArrowRight-DjM-WAe8.js +1 -0
  3. package/dist/client/assets/{ArrowUpRight-CqYlpRve.js → ArrowUpRight-tJm1fmd7.js} +1 -1
  4. package/dist/client/assets/Check-D3J8f8u-.js +1 -0
  5. package/dist/client/assets/{CheckCircle-D96bOHZ4.js → CheckCircle-2NPq-6dO.js} +1 -1
  6. package/dist/client/assets/{ChevronDown-BDUfpA8-.js → ChevronDown-Dilz0yBl.js} +1 -1
  7. package/dist/client/assets/{ChevronLeft-CPb9YQ3b.js → ChevronLeft-CJ5DBM3M.js} +1 -1
  8. package/dist/client/assets/{ChevronRight-BdBQHcGY.js → ChevronRight-KEtpzT4P.js} +1 -1
  9. package/dist/client/assets/ChevronUp-B5x1falF.js +1 -0
  10. package/dist/client/assets/{DotsVertical-B0BcJ-Xx.js → DotsVertical-BM5d8Pc7.js} +1 -1
  11. package/dist/client/assets/{Eye-Cn63kKBo.js → Eye-hHNCwVZ1.js} +1 -1
  12. package/dist/client/assets/{FilterLines-CybSjddP.js → FilterLines-DfVdVEBp.js} +1 -1
  13. package/dist/client/assets/{Globe01-D6_7mD2q.js → Globe01-DD8UM4Hn.js} +1 -1
  14. package/dist/client/assets/{Globe04-DGI5tY8K.js → Globe04-CHjKQaGv.js} +1 -1
  15. package/dist/client/assets/{HardDrive-BoitsKJ1.js → HardDrive-ClhqImrT.js} +1 -1
  16. package/dist/client/assets/{Key01-CEwc6a0T.js → Key01-BYHEvjL0.js} +1 -1
  17. package/dist/client/assets/{LayoutLeft-Dbsbo4ui.js → LayoutLeft-BNwcfVCc.js} +1 -1
  18. package/dist/client/assets/{LinkExternal01-B1YJxZ_i.js → LinkExternal01-BqsD3A6i.js} +1 -1
  19. package/dist/client/assets/{Monitor01-BJEn_hPF.js → Monitor01-BqllG5YD.js} +1 -1
  20. package/dist/client/assets/{Palette-DM7mN-wZ.js → Palette-CdtyN2t7.js} +1 -1
  21. package/dist/client/assets/{Play--fnJFFV0.js → Play-DpX5JUyA.js} +1 -1
  22. package/dist/client/assets/{Plus-BotD1zxJ.js → Plus-BaLwS14l.js} +1 -1
  23. package/dist/client/assets/{SearchMd-BJM4yPQO.js → SearchMd-CJ_dFCp5.js} +1 -1
  24. package/dist/client/assets/{Settings02-BDBrMikk.js → Settings02-Cg6Yp6Ig.js} +1 -1
  25. package/dist/client/assets/{Shield01-BLk45Lqh.js → Shield01-DYwaNnY3.js} +1 -1
  26. package/dist/client/assets/{Star01-c7vPYDwm.js → Star01-D42mJCl7.js} +1 -1
  27. package/dist/client/assets/{Stars01-B-5V3LS2.js → Stars01-CrB442jN.js} +1 -1
  28. package/dist/client/assets/{Stars02-CsAFd9rT.js → Stars02-C2akJW-A.js} +1 -1
  29. package/dist/client/assets/{Sun-DLMUNZaS.js → Sun-CgYYfF85.js} +1 -1
  30. package/dist/client/assets/{SwitchHorizontal01-BG4hAcSt.js → SwitchHorizontal01-y3DhestF.js} +1 -1
  31. package/dist/client/assets/{Tool01-DuWKfueG.js → Tool01-CI_6KMgQ.js} +1 -1
  32. package/dist/client/assets/{Trash01-CBhkXuxm.js → Trash01-Cd_0JhhN.js} +1 -1
  33. package/dist/client/assets/{Upload01-geIrWEzc.js → Upload01-ijsbLMSK.js} +1 -1
  34. package/dist/client/assets/{User01-BQxtHTb_.js → User01-BI5RuTWy.js} +1 -1
  35. package/dist/client/assets/{Users01-oAfFj8jH.js → Users01-LhAUtJ2l.js} +1 -1
  36. package/dist/client/assets/{Users03-rDpaXmvi.js → Users03-CJf6bBEA.js} +1 -1
  37. package/dist/client/assets/{X-CWsxaTAy.js → X-BmA2kYv-.js} +1 -1
  38. package/dist/client/assets/XCircle-CSVmVGl-.js +1 -0
  39. package/dist/client/assets/{XClose-CjsCyYq1.js → XClose-BGGuhSdx.js} +1 -1
  40. package/dist/client/assets/{Zap-CBPMaWRv.js → Zap-C5OGTH44.js} +1 -1
  41. package/dist/client/assets/{ZapSquare-BZciBg8V.js → ZapSquare-Bh6-lHaM.js} +1 -1
  42. package/dist/client/assets/{ZoomOut-CuzhjD8R.js → ZoomOut-xDQo2yr7.js} +1 -1
  43. package/dist/client/assets/{access-gate-gL5SpIsh.js → access-gate-C-eMG1Ta.js} +1 -1
  44. package/dist/client/assets/add-section-modal-DNNafM9O.js +1 -0
  45. package/dist/client/assets/agent-icon-Bcqwo2Wq.js +1 -0
  46. package/dist/client/assets/agents-list-obMS8uxZ.js +1 -0
  47. package/dist/client/assets/ai-providers-apfL_rjp.js +1 -0
  48. package/dist/client/assets/{alert-CFJHHcie.js → alert-B1Ln6zZV.js} +1 -1
  49. package/dist/client/assets/{alert-dialog-y-SjofRy.js → alert-dialog-BZRM5ze7.js} +3 -3
  50. package/dist/client/assets/app-editor-C0jI2dDZ.js +1 -0
  51. package/dist/client/assets/{auth-catchall-DAbA44Yn.js → auth-catchall-s-1qzuNO.js} +1 -1
  52. package/dist/client/assets/auth-entry-CW5gsTiA.js +1 -0
  53. package/dist/client/assets/{auth-oAvShPIA.js → auth-rl3GT7t8.js} +1 -1
  54. package/dist/client/assets/{auth-split-layout-h72ar9bS.js → auth-split-layout-BC0lphRW.js} +1 -1
  55. package/dist/client/assets/{automation-list-row-CPRLW9qP.js → automation-list-row-DefMjeyu.js} +1 -1
  56. package/dist/client/assets/{automation-runs-MukaSUF3.js → automation-runs-C-Da4MEd.js} +1 -1
  57. package/dist/client/assets/automations-CbOSvhEe.js +1 -0
  58. package/dist/client/assets/{avatar-BuKPm2vr.js → avatar-CXZnLPEU.js} +1 -1
  59. package/dist/client/assets/backoff-CrEUbyZT.js +1 -0
  60. package/dist/client/assets/{badge-r4de0kry.js → badge-DSiiJMKS.js} +1 -1
  61. package/dist/client/assets/{block-document-BV4M7GSw.js → block-document-DR_-i1iv.js} +1 -1
  62. package/dist/client/assets/{brand-context-CBTn9oh3.js → brand-context-D385RFi4.js} +1 -1
  63. package/dist/client/assets/buckets-CfLzGo42.js +1 -0
  64. package/dist/client/assets/{calendar-Cxlga-qo.js → calendar-CdvLiXTi.js} +1 -1
  65. package/dist/client/assets/{capability-load-error-B01bGGw8.js → capability-load-error-Cc0Imt5p.js} +1 -1
  66. package/dist/client/assets/{card-D2P5f0Hv.js → card-DSDTRgoU.js} +1 -1
  67. package/dist/client/assets/category-editor-sMElZzN1.js +1 -0
  68. package/dist/client/assets/chat-context-DnaexSAo.js +21 -0
  69. package/dist/client/assets/checkbox-CL_5fiO_.js +1 -0
  70. package/dist/client/assets/{cli-auth-success-B-xojIRf.js → cli-auth-success-DV-qTae_.js} +1 -1
  71. package/dist/client/assets/collection-detail-CtoW7iVa.js +1 -0
  72. package/dist/client/assets/collection-display-button-Boq8hl8Q.js +1 -0
  73. package/dist/client/assets/{collection-search-DS6Qu-vl.js → collection-search-2g11_WBH.js} +1 -1
  74. package/dist/client/assets/{collection-tabs-Ck6BuvIC.js → collection-tabs-CDMyDuFK.js} +1 -1
  75. package/dist/client/assets/{command-BW1QDtOt.js → command-Bw_f0kDn.js} +1 -1
  76. package/dist/client/assets/commerce-onboarding-LL_9usA-.js +1 -0
  77. package/dist/client/assets/connect-desktop-dialog-Dybq2Hx1.js +1 -0
  78. package/dist/client/assets/{connection-card-Cnc4pAuK.js → connection-card-DA1t_KQo.js} +1 -1
  79. package/dist/client/assets/connection-detail-C3h6Iqqu.js +1 -0
  80. package/dist/client/assets/{connection-form-helpers-BWYI6_re.js → connection-form-helpers-BqK6S8Yx.js} +1 -1
  81. package/dist/client/assets/connections-BdIG1myf.js +1 -0
  82. package/dist/client/assets/context-menu-KaWlIbj1.js +1 -0
  83. package/dist/client/assets/{decopilot-lDNbKmoL.js → decopilot-fUgUe2Eh.js} +1 -1
  84. package/dist/client/assets/decopilot-sse-pool-Dl1x5tdf.js +1 -0
  85. package/dist/client/assets/delay-CnY5UFtP.js +1 -0
  86. package/dist/client/assets/dialog-CQ6B0IwC.js +1 -0
  87. package/dist/client/assets/{domain-settings-DNfnwQe1.js → domain-settings-BvzKBAZm.js} +1 -1
  88. package/dist/client/assets/drawer-mbT59SGx.js +1 -0
  89. package/dist/client/assets/dropdown-menu-bs6nmOyP.js +1 -0
  90. package/dist/client/assets/{empty-state-LK6HJ1Ub.js → empty-state-crYivviN.js} +1 -1
  91. package/dist/client/assets/{extract-connection-data-BVb7kACV.js → extract-connection-data-D-Y4GRfE.js} +1 -1
  92. package/dist/client/assets/file-explorer-iYX8uF4-.js +2 -0
  93. package/dist/client/assets/{file-type-icon-Co_9nTdI.js → file-type-icon-D0ASmNXK.js} +1 -1
  94. package/dist/client/assets/{files-BB2L5yxl.js → files-ENTpyfhv.js} +1 -1
  95. package/dist/client/assets/{form-DeXV6ZbR.js → form-O9DEtf_L.js} +1 -1
  96. package/dist/client/assets/general-BJWZpnpu.js +1 -0
  97. package/dist/client/assets/{github-repo-picker-D28KZVlK.js → github-repo-picker-CHTvfJAD.js} +1 -1
  98. package/dist/client/assets/{hooks-C6xsli9S.js → hooks-CSfRJCjt.js} +6 -6
  99. package/dist/client/assets/image-field-BdcHkDRx.js +1 -0
  100. package/dist/client/assets/{import-from-deco-dialog-BqR81gos.js → import-from-deco-dialog-Bz8FE0_9.js} +2 -2
  101. package/dist/client/assets/{index-DYVHqMRU.js → index-7a12TwCl.js} +10 -10
  102. package/dist/client/assets/{index-BT1fnsTX.js → index-B4I34F6K.js} +1 -1
  103. package/dist/client/assets/{index-BS6SIcIO.js → index-BFeGPSf0.js} +1 -1
  104. package/dist/client/assets/{index-D_EAxCKt.js → index-BK1jVztm.js} +4 -4
  105. package/dist/client/assets/{index-BvJIELiR.js → index-BPuJ390n.js} +1 -1
  106. package/dist/client/assets/{index-Cn123si2.js → index-BRnQ22g3.js} +1 -1
  107. package/dist/client/assets/index-B_6khNsr.js +1 -0
  108. package/dist/client/assets/{index-DhP6uqg6.js → index-BsWl8UuV.js} +1 -1
  109. package/dist/client/assets/index-C9uGIJ2-.js +1 -0
  110. package/dist/client/assets/{index-fZsfe2dv.js → index-CGoh8mx2.js} +2 -2
  111. package/dist/client/assets/{index-EQfvflqN.js → index-D0U_smqt.js} +29 -29
  112. package/dist/client/assets/{index-DlAcri6L.js → index-DHLJyA5u.js} +3 -3
  113. package/dist/client/assets/{index-CL7iXGkA.js → index-D_UY8Zf9.js} +1 -1
  114. package/dist/client/assets/{index-C9ln6Rlu.js → index-DvTimAjS.js} +12 -12
  115. package/dist/client/assets/{index-redirect-DyYQW9cK.js → index-redirect-CPy0Z1T_.js} +1 -1
  116. package/dist/client/assets/{input-DSpuivwc.js → input-Ccm3ShdT.js} +1 -1
  117. package/dist/client/assets/{integration-icon-CLgQo-hX.js → integration-icon-BjRqMG3n.js} +1 -1
  118. package/dist/client/assets/label-KRKjsQLR.js +1 -0
  119. package/dist/client/assets/login-B5WUG2bv.js +1 -0
  120. package/dist/client/assets/{mcp-oauth-B7WMtt2U.js → mcp-oauth-Ccqa98JF.js} +1 -1
  121. package/dist/client/assets/{members-DwMoOKaR.js → members-BwXKPt6c.js} +2 -2
  122. package/dist/client/assets/{monaco-editor-eUJHQqAo.js → monaco-editor-DztiaMte.js} +1 -1
  123. package/dist/client/assets/{monitoring-stats-row-DxDe7dnK.js → monitoring-stats-row-DY_Jk7Qu.js} +1 -1
  124. package/dist/client/assets/{oauth-callback-CeRw4Jke.js → oauth-callback-B5Sy5Cax.js} +1 -1
  125. package/dist/client/assets/{oauth-callback-ai-provider-C2phjFNn.js → oauth-callback-ai-provider-DFLSFrMH.js} +1 -1
  126. package/dist/client/assets/onboarding-tnqH6jke.js +1 -0
  127. package/dist/client/assets/{org-install-CM9G-6Y5.js → org-install-CMfEhUPU.js} +1 -1
  128. package/dist/client/assets/org-layout-DWTGapvu.js +1 -0
  129. package/dist/client/assets/organization-choice-BhcilQzG.js +1 -0
  130. package/dist/client/assets/{page-seo-form-Dzkc_5Zz.js → page-seo-form-CworrxTj.js} +1 -1
  131. package/dist/client/assets/page-seo-sheet-CU9OHYe8.js +1 -0
  132. package/dist/client/assets/popover-CQIMDVug.js +1 -0
  133. package/dist/client/assets/post-editor-BgM1RATm.js +1 -0
  134. package/dist/client/assets/preview-dialog-CJENsRWm.js +5 -0
  135. package/dist/client/assets/{primitives-DTM0cYw2.js → primitives-qIzOEfAk.js} +1 -1
  136. package/dist/client/assets/profile-B0-E7bKd.js +1 -0
  137. package/dist/client/assets/project-app-view-CMI1MfV-.js +1 -0
  138. package/dist/client/assets/record-editor-DGdCVdoZ.js +1 -0
  139. package/dist/client/assets/registry-D-K5v381.js +2 -0
  140. package/dist/client/assets/{registry-layout-Dvh3zycp.js → registry-layout-Cy0i7eVL.js} +4 -4
  141. package/dist/client/assets/require-capability-D9TOSbgf.js +1 -0
  142. package/dist/client/assets/required-auth-layout-D9FVCOQl.js +1 -0
  143. package/dist/client/assets/{reset-password-yVdorWr2.js → reset-password-m90-iQba.js} +1 -1
  144. package/dist/client/assets/roles-m5faIEUW.js +1 -0
  145. package/dist/client/assets/save-referenced-block-CtS93Zrw.js +1 -0
  146. package/dist/client/assets/save-status-Dr27404A.js +1 -0
  147. package/dist/client/assets/{schema-form-BT-HtmzD.js → schema-form-Bpex2GV2.js} +1 -1
  148. package/dist/client/assets/{scroll-area-CLsPpB-r.js → scroll-area-DbztbmuO.js} +7 -7
  149. package/dist/client/assets/{search-input-3wsWtr8y.js → search-input-C742tJr8.js} +1 -1
  150. package/dist/client/assets/secrets-DbY4hLUu.js +1 -0
  151. package/dist/client/assets/{sections-editor--NaQBFc_.js → sections-editor-DJuNcR6f.js} +2 -2
  152. package/dist/client/assets/select-COSJe-70.js +1 -0
  153. package/dist/client/assets/{select-model-BWy_J6Nk.js → select-model-Cv_gN_vr.js} +1 -1
  154. package/dist/client/assets/seo-editor-ynZ80zTU.js +1 -0
  155. package/dist/client/assets/settings-layout-D5cpx9f5.js +1 -0
  156. package/dist/client/assets/{settings-section-Xa6gQanu.js → settings-section-C-zTpCRT.js} +1 -1
  157. package/dist/client/assets/{sheet-CO5nUKz5.js → sheet-CuyenB5M.js} +1 -1
  158. package/dist/client/assets/shell-controls-fwD6Be98.js +1 -0
  159. package/dist/client/assets/shell-layout-BhblvLd4.js +1 -0
  160. package/dist/client/assets/shell-route-loading-ClsKn-Oj.js +1 -0
  161. package/dist/client/assets/{sidebar-Bc_N4P0Q.js → sidebar-BYFEz6-7.js} +1 -1
  162. package/dist/client/assets/skeleton-DHas8e4O.js +1 -0
  163. package/dist/client/assets/{sortable.esm-8cD2lpev.js → sortable.esm-CtBH0PGw.js} +1 -1
  164. package/dist/client/assets/sso-BFO9vLZv.js +1 -0
  165. package/dist/client/assets/{store-DdMLz8Ze.js → store-C9F0E0yc.js} +1 -1
  166. package/dist/client/assets/store-registry-D8kCyVob.js +2 -0
  167. package/dist/client/assets/studio-tools-DO12gBMa.js +1 -0
  168. package/dist/client/assets/switch-By8vCxNg.js +1 -0
  169. package/dist/client/assets/table-BgkbBxMz.js +1 -0
  170. package/dist/client/assets/{tabs-guVlWmKk.js → tabs-DPoZSyfS.js} +1 -1
  171. package/dist/client/assets/{task-status-CuvvylED.js → task-status-D9k3BLzM.js} +1 -1
  172. package/dist/client/assets/textarea-DQwh6y_K.js +1 -0
  173. package/dist/client/assets/{toggle-group-CMjl8VgC.js → toggle-group-CW5GRzAp.js} +1 -1
  174. package/dist/client/assets/{toolbar-CkTqFHd9.js → toolbar-1QmqWl6-.js} +1 -1
  175. package/dist/client/assets/tooltip-DO1R3Vmb.js +1 -0
  176. package/dist/client/assets/{types-D4QaCOrk.js → types-pBNKtzBp.js} +1 -1
  177. package/dist/client/assets/{use-ai-providers-DG2JQjs-.js → use-ai-providers-qobt2OiH.js} +1 -1
  178. package/dist/client/assets/{use-automations-CteEXHmM.js → use-automations-BwoNV2me.js} +1 -1
  179. package/dist/client/assets/use-capability-C09ZF9_G.js +1 -0
  180. package/dist/client/assets/{use-clock-tick-ZNeIyYyN.js → use-clock-tick-_1lW4UqP.js} +1 -1
  181. package/dist/client/assets/{use-collections-BpjfU7Qz.js → use-collections-DRgt6Bb8.js} +1 -1
  182. package/dist/client/assets/use-connection-XfA-QrSw.js +1 -0
  183. package/dist/client/assets/use-copy-DyplBFAe.js +1 -0
  184. package/dist/client/assets/use-create-virtual-mcp-BJFWHgGz.js +1 -0
  185. package/dist/client/assets/{use-debounced-autosave-DcMAFfy3.js → use-debounced-autosave-DqciCJ__.js} +1 -1
  186. package/dist/client/assets/use-deco-credits-CyoNix9p.js +1 -0
  187. package/dist/client/assets/{use-delete-connection-DUHc9RVY.js → use-delete-connection-CweyK7E_.js} +1 -1
  188. package/dist/client/assets/use-file-configs-OLHA7dwa.js +1 -0
  189. package/dist/client/assets/{use-infinite-scroll-BvUO_UAz.js → use-infinite-scroll-BbUZw7ju.js} +1 -1
  190. package/dist/client/assets/{use-join-requests-DTfMSZbu.js → use-join-requests-CHh2Zrhx.js} +1 -1
  191. package/dist/client/assets/use-mcp-client-DilmxmKU.js +10 -0
  192. package/dist/client/assets/{use-mcp-prompts-DK7oMqp2.js → use-mcp-prompts-D2ueJ3CD.js} +1 -1
  193. package/dist/client/assets/{use-mcp-tools-Baigwz11.js → use-mcp-tools-uucJgbkt.js} +1 -1
  194. package/dist/client/assets/{use-members-sheMPGLK.js → use-members-Y5iRty7v.js} +1 -1
  195. package/dist/client/assets/use-navigate-to-agent-HvaD8xDj.js +1 -0
  196. package/dist/client/assets/{use-org-auth-client-BWdAUif4.js → use-org-auth-client-Dl_7zTlg.js} +1 -1
  197. package/dist/client/assets/{use-org-sso-CQCoThc3.js → use-org-sso-9Z0u5sV3.js} +1 -1
  198. package/dist/client/assets/{use-organization-roles-Blo5zOq7.js → use-organization-roles-C8kGFpoE.js} +1 -1
  199. package/dist/client/assets/use-organization-settings-B5vS3xHV.js +1 -0
  200. package/dist/client/assets/{use-registry-connections-Dp82aVQV.js → use-registry-connections-DhFpf503.js} +1 -1
  201. package/dist/client/assets/use-secrets-DtlQfYRK.js +1 -0
  202. package/dist/client/assets/{use-status-sounds-Cbe3FatD.js → use-status-sounds-BSqGti4P.js} +1 -1
  203. package/dist/client/assets/{use-view-mode-DuHWUBn_.js → use-view-mode-Cc4A86jX.js} +1 -1
  204. package/dist/client/assets/{use-virtual-mcp-isKQVwa1.js → use-virtual-mcp-cixi9WNo.js} +1 -1
  205. package/dist/client/assets/useInfiniteQuery-C4arjVN1.js +1 -0
  206. package/dist/client/assets/useSuspenseInfiniteQuery-DTlBviqw.js +1 -0
  207. package/dist/client/assets/variant-calendar-BtDF6xbX.js +1 -0
  208. package/dist/client/assets/view-mode-toggle-BNmCyKXO.js +1 -0
  209. package/dist/client/index.html +1 -1
  210. package/dist/server/cli.js +509 -506
  211. package/dist/server/server.js +318 -318
  212. package/package.json +1 -1
  213. package/dist/client/assets/ChevronUp-ByHCMSz5.js +0 -1
  214. package/dist/client/assets/XCircle-qby-IxK9.js +0 -1
  215. package/dist/client/assets/add-section-modal--cVfcrtB.js +0 -1
  216. package/dist/client/assets/agent-icon-CBTaU_uB.js +0 -1
  217. package/dist/client/assets/agents-list-CXBn8lDh.js +0 -1
  218. package/dist/client/assets/ai-providers-CbnbJJz4.js +0 -1
  219. package/dist/client/assets/app-editor-BcOUOP9g.js +0 -1
  220. package/dist/client/assets/automations-h21yis8y.js +0 -1
  221. package/dist/client/assets/buckets-B83SYpLX.js +0 -1
  222. package/dist/client/assets/category-editor-wy2LOTex.js +0 -1
  223. package/dist/client/assets/chat-context-BtC6Ah0G.js +0 -21
  224. package/dist/client/assets/checkbox-CgVOF7oH.js +0 -1
  225. package/dist/client/assets/collection-detail-nxizKZ79.js +0 -1
  226. package/dist/client/assets/collection-display-button-CdC3bHO_.js +0 -1
  227. package/dist/client/assets/connect-desktop-dialog-CDALyqpZ.js +0 -1
  228. package/dist/client/assets/connection-detail-bVa9c8Lh.js +0 -1
  229. package/dist/client/assets/connections-BJFKAoWQ.js +0 -1
  230. package/dist/client/assets/context-menu-DTN-hspY.js +0 -1
  231. package/dist/client/assets/decopilot-sse-pool-4h5QEcLo.js +0 -1
  232. package/dist/client/assets/dialog-45S14PiE.js +0 -1
  233. package/dist/client/assets/drawer-BdP8u_Wg.js +0 -1
  234. package/dist/client/assets/dropdown-menu-CqSJARyq.js +0 -1
  235. package/dist/client/assets/file-explorer-CvvH4Wsl.js +0 -2
  236. package/dist/client/assets/general-hVWzdym-.js +0 -1
  237. package/dist/client/assets/image-field-CIVwBDwt.js +0 -1
  238. package/dist/client/assets/index-C3c5UhFw.js +0 -1
  239. package/dist/client/assets/index-CX9HPjy_.js +0 -1
  240. package/dist/client/assets/label-WMNwqiQL.js +0 -1
  241. package/dist/client/assets/login-YdjddSPA.js +0 -1
  242. package/dist/client/assets/onboarding-D6fpPPXQ.js +0 -1
  243. package/dist/client/assets/org-layout-DpaEw-4S.js +0 -1
  244. package/dist/client/assets/page-seo-sheet-C_NzOtxI.js +0 -1
  245. package/dist/client/assets/popover-D2IKuRrN.js +0 -1
  246. package/dist/client/assets/post-editor-CM4EkGCt.js +0 -1
  247. package/dist/client/assets/preview-dialog-BYT9QnPJ.js +0 -5
  248. package/dist/client/assets/profile-DU9dowPP.js +0 -1
  249. package/dist/client/assets/project-app-view-CMB3qFiO.js +0 -1
  250. package/dist/client/assets/record-editor-D8GUWHmB.js +0 -1
  251. package/dist/client/assets/registry-Bb6Tgwun.js +0 -2
  252. package/dist/client/assets/require-capability-BnPWl2tF.js +0 -1
  253. package/dist/client/assets/required-auth-layout-D-3ucvj0.js +0 -1
  254. package/dist/client/assets/roles-SqN3pcMs.js +0 -1
  255. package/dist/client/assets/save-referenced-block-CJbd0wX1.js +0 -1
  256. package/dist/client/assets/save-status-BnLQAr10.js +0 -1
  257. package/dist/client/assets/secrets-hO3DohpV.js +0 -1
  258. package/dist/client/assets/select-Cr8ncrzb.js +0 -1
  259. package/dist/client/assets/seo-editor-C7JgJycB.js +0 -1
  260. package/dist/client/assets/settings-layout-BD7cvvYF.js +0 -1
  261. package/dist/client/assets/shell-controls-Bsba7LUp.js +0 -1
  262. package/dist/client/assets/shell-layout-CMM5javC.js +0 -1
  263. package/dist/client/assets/shell-route-loading-rFRhSsv7.js +0 -1
  264. package/dist/client/assets/skeleton-BDjpHo4F.js +0 -1
  265. package/dist/client/assets/sso-Ch2uxBlI.js +0 -1
  266. package/dist/client/assets/store-registry-n1SChU-1.js +0 -2
  267. package/dist/client/assets/studio-tools-CcZtrETh.js +0 -1
  268. package/dist/client/assets/switch-DJTBR0xh.js +0 -1
  269. package/dist/client/assets/table-ujnX7HJ5.js +0 -1
  270. package/dist/client/assets/textarea-DaCUK96G.js +0 -1
  271. package/dist/client/assets/tooltip-DZelUdM0.js +0 -1
  272. package/dist/client/assets/use-capability-D0k-04nV.js +0 -1
  273. package/dist/client/assets/use-connection-DgGg0YyB.js +0 -1
  274. package/dist/client/assets/use-copy-B8BHxthn.js +0 -1
  275. package/dist/client/assets/use-create-virtual-mcp-BIiePYSF.js +0 -1
  276. package/dist/client/assets/use-deco-credits-Mx2CqZEN.js +0 -1
  277. package/dist/client/assets/use-file-configs-CoOJ1-eP.js +0 -1
  278. package/dist/client/assets/use-mcp-client-Dlrc-MQT.js +0 -10
  279. package/dist/client/assets/use-navigate-to-agent-YIuMJGpH.js +0 -1
  280. package/dist/client/assets/use-organization-settings-MrFZCmt9.js +0 -1
  281. package/dist/client/assets/use-secrets-Cl4CjxvR.js +0 -1
  282. package/dist/client/assets/useInfiniteQuery-l1kRSOtu.js +0 -1
  283. package/dist/client/assets/useRouterState-JYZfxOr3.js +0 -1
  284. package/dist/client/assets/useSuspenseInfiniteQuery-CFjEx0xH.js +0 -1
  285. package/dist/client/assets/variant-calendar-wUxggbqL.js +0 -1
  286. package/dist/client/assets/view-mode-toggle-Bo4aZcGU.js +0 -1
@@ -1 +0,0 @@
1
- import{e as S,g as L,j as s,p as J,c as k,ae as Q,L as R,t as B,C as I,b as G,l as D,r as F,O as K}from"./index-EQfvflqN.js";import{u as E}from"./useRouterState-JYZfxOr3.js";import{j as U,k as V,l as X,b as q,c as w,d as M,S as P,a as O,f as Y,g as Z}from"./sidebar-Bc_N4P0Q.js";import{a as ee}from"./index-BS6SIcIO.js";import{n as se,b as te,a as le,c as re,d as ie,i as T}from"./ZapSquare-BZciBg8V.js";import{t as oe,a as A}from"./Users03-rDpaXmvi.js";import{i as ne}from"./HardDrive-BoitsKJ1.js";import{i as ae}from"./Key01-CEwc6a0T.js";import{i as ce}from"./Shield01-BLk45Lqh.js";import{s as me}from"./User01-BQxtHTb_.js";import{i as fe}from"./Zap-CBPMaWRv.js";import{a as de}from"./use-capability-D0k-04nV.js";import{a as xe}from"./use-join-requests-DTfMSZbu.js";import{u as W}from"./tooltip-DZelUdM0.js";import{u as be}from"./use-status-sounds-Cbe3FatD.js";import{a as y}from"./toolbar-CkTqFHd9.js";import{S as ue,M as he}from"./shell-controls-Bsba7LUp.js";import"./LayoutLeft-Dbsbo4ui.js";import"./sheet-CO5nUKz5.js";import"./X-CWsxaTAy.js";import"./studio-tools-CcZtrETh.js";import"./question-004-sINsf4GQ.js";import"./decopilot-sse-pool-4h5QEcLo.js";import"./ChevronLeft-CPb9YQ3b.js";import"./ChevronRight-BdBQHcGY.js";function H(){const e=S.c(21),{capabilities:t,isPrivileged:f,loading:l,error:a}=de(),r=xe().length;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(oe,{size:14}),e[0]=o):o=e[0];let n,i;if(e[1]!==t||e[2]!==a||e[3]!==f||e[4]!==r||e[5]!==l){i=Symbol.for("react.early_return_sentinel");e:{let u;e[8]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(se,{size:14}),e[8]=u):u=e[8];let c;e[9]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(te,{size:14}),e[9]=c):c=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(ae,{size:14}),e[10]=d):d=e[10];let x;e[11]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(ne,{size:14}),e[11]=x):x=e[11];let m;e[12]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx(le,{size:14}),e[12]=m):m=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(A,{size:14}),e[13]=b):b=e[13];let p;e[14]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(fe,{size:14}),e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=s.jsx(re,{size:14}),e[15]=g):g=e[15];let h;e[16]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(ie,{size:14}),e[16]=h):h=e[16];let _;e[17]===Symbol.for("react.memo_cache_sentinel")?(_=s.jsx(A,{size:14}),e[17]=_):_=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(ce,{size:14}),e[18]=j):j=e[18];let v;e[19]===Symbol.for("react.memo_cache_sentinel")?(v=s.jsx(Q,{size:14}),e[19]=v):v=e[19];let N;e[20]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(me,{size:14}),e[20]=N):N=e[20];const C=[{label:"Organization",items:[{key:"general",label:"General",icon:o,to:"/$org/settings/general",requires:"org:manage"},{key:"brand-context",label:"Brand Context",icon:u,to:"/$org/settings/brand-context",requires:"org:manage"},{key:"ai-providers",label:"AI Providers",icon:c,to:"/$org/settings/ai-providers",requires:"ai-providers:manage"},{key:"secrets",label:"Secrets",icon:d,to:"/$org/settings/secrets",requires:"secrets:manage"},{key:"buckets",label:"Buckets",icon:x,to:"/$org/settings/buckets",requires:"file-configs:manage"}]},{label:"Build",items:[{key:"connections",label:"Connections",icon:m,to:"/$org/settings/connections"},{key:"agents",label:"Agents",icon:b,to:"/$org/settings/agents"},{key:"automations",label:"Automations",icon:p,to:"/$org/settings/automations",requires:"automations:manage"},{key:"store",label:"Store",icon:g,to:"/$org/settings/store",requires:"registry:manage"}]},{label:"Manage",items:[{key:"monitor",label:"Monitor",icon:h,to:"/$org/settings/monitor",requires:"monitoring:view"},{key:"members",label:"Members",icon:_,to:"/$org/settings/members",requires:"members:manage",badge:r},{key:"roles",label:"Roles",icon:j,to:"/$org/settings/roles",privilegedOnly:!0},{key:"sso",label:"Security",icon:v,to:"/$org/settings/sso",requires:"org:manage"}]},{label:"Account",items:[{key:"profile",label:"Profile & Preferences",icon:N,to:"/$org/settings/profile"}]}];if(l||a){i=C;break e}n=C.map(z=>({...z,items:z.items.filter($=>$.privilegedOnly?f:$.requires?f||t[$.requires]:!0)})).filter(pe)}e[1]=t,e[2]=a,e[3]=f,e[4]=r,e[5]=l,e[6]=n,e[7]=i}else n=e[6],i=e[7];return i!==Symbol.for("react.early_return_sentinel")?i:n}function pe(e){return e.items.length>0}function ge(){const e=S.c(19),t=H();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={from:"/shell/$org"},e[0]=f):f=e[0];const{org:l}=L(f);let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a={select:_e},e[1]=a):a=e[1];const r=E(a);let o;e[2]!==l||e[3]!==r?(o=b=>{const p=b.replace("$org",l);return r.startsWith(p)},e[2]=l,e[3]=r,e[4]=o):o=e[4];const n=o;let i;if(e[5]!==t||e[6]!==n||e[7]!==l){let b;e[9]!==n||e[10]!==l?(b=(p,g)=>s.jsxs(q,{className:"pt-0 pr-0 pb-0 pl-0",children:[p.label&&s.jsx("p",{className:k("px-2 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",g>0&&"mt-3"),children:p.label}),s.jsx(w,{children:s.jsx(M,{className:"gap-0.5",children:p.items.map(h=>s.jsx(P,{children:s.jsx(O,{asChild:!0,isActive:n(h.to),children:s.jsxs(R,{to:h.to,params:{org:l},onClick:()=>B("settings_nav_clicked",{section_key:h.key,section_label:h.label,group_label:p.label||"main"}),className:"flex items-center gap-2.5 text-sm",children:[s.jsxs("span",{className:"relative shrink-0",children:[h.icon,h.badge?s.jsx("span",{className:"absolute -right-1 -top-1 size-2 rounded-full bg-red-500 pointer-events-none"}):null]}),s.jsx("span",{className:"truncate",children:h.label})]})})},h.key))})})]},`${p.label}-${g}`),e[9]=n,e[10]=l,e[11]=b):b=e[11],i=t.map(b),e[5]=t,e[6]=n,e[7]=l,e[8]=i}else i=e[8];let u;e[12]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx("div",{className:"mx-2 my-2 border-t border-border/50"}),e[12]=u):u=e[12];let c;e[13]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(q,{className:"pt-0 pr-0 pb-0 pl-0",children:[u,s.jsx(w,{children:s.jsx(M,{className:"gap-0.5",children:s.jsx(P,{children:s.jsxs(O,{onClick:je,className:"flex items-center gap-2.5 text-sm",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(T,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})})})})]}),e[13]=c):c=e[13];let d;e[14]!==i?(d=s.jsxs(Y,{className:"flex flex-col flex-1 mt-2 px-2 pb-2 gap-0 overflow-y-auto",children:[i,c]}),e[14]=i,e[15]=d):d=e[15];let x;e[16]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx("div",{className:"mt-auto px-4 pb-1",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","3.73.0"]})}),e[16]=x):x=e[16];let m;return e[17]!==d?(m=s.jsxs(Z,{variant:"sidebar",children:[d,x]}),e[17]=d,e[18]=m):m=e[18],m}function je(){B("signed_out",{source:"settings_sidebar"}),I(),G.signOut()}function _e(e){return e.location.pathname}function ye(e){const t=S.c(21),{onClose:f}=e,l=H();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a={from:"/shell/$org"},t[0]=a):a=t[0];const{org:r}=L(a);let o;t[1]===Symbol.for("react.memo_cache_sentinel")?(o={select:ve},t[1]=o):o=t[1];const n=E(o);let i;t[2]!==r||t[3]!==n?(i=g=>{const h=g.replace("$org",r);return n.startsWith(h)},t[2]=r,t[3]=n,t[4]=i):i=t[4];const u=i;let c;if(t[5]!==l||t[6]!==u||t[7]!==f||t[8]!==r){let g;t[10]!==u||t[11]!==f||t[12]!==r?(g=(h,_)=>s.jsxs("div",{className:"flex flex-col gap-0.5",children:[h.label&&s.jsx("p",{className:k("px-3 pt-1.5 pb-0.5 text-xs font-medium text-muted-foreground/60",_>0&&"mt-3"),children:h.label}),h.items.map(j=>s.jsxs(R,{to:j.to,params:{org:r},onClick:f,className:k("flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm",u(j.to)?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground"),children:[s.jsxs("span",{className:"relative shrink-0",children:[j.icon,j.badge?s.jsx("span",{className:"absolute -right-1 -top-1 size-2 rounded-full bg-red-500 pointer-events-none"}):null]}),s.jsx("span",{className:"truncate",children:j.label})]},j.key))]},`${h.label}-${_}`),t[10]=u,t[11]=f,t[12]=r,t[13]=g):g=t[13],c=l.map(g),t[5]=l,t[6]=u,t[7]=f,t[8]=r,t[9]=c}else c=t[9];let d;t[14]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"h-px bg-border/50 my-2"}),t[14]=d):d=t[14];let x;t[15]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsxs("div",{className:"flex flex-col gap-0.5",children:[d,s.jsxs("button",{type:"button",onClick:Se,className:"flex items-center gap-3 w-full px-3 py-2.5 rounded-lg transition-colors text-sm text-sidebar-foreground/70 hover:bg-sidebar-accent hover:text-sidebar-foreground",children:[s.jsx("span",{className:"shrink-0",children:s.jsx(T,{size:14})}),s.jsx("span",{className:"truncate",children:"Sign Out"})]})]}),t[15]=x):x=t[15];let m;t[16]!==c?(m=s.jsxs("div",{className:"flex flex-col flex-1 overflow-y-auto px-2 py-2 gap-0.5",children:[c,x]}),t[16]=c,t[17]=m):m=t[17];let b;t[18]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx("div",{className:"px-4 pb-3 pt-1 border-t border-border/50",children:s.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v","3.73.0"]})}),t[18]=b):b=t[18];let p;return t[19]!==m?(p=s.jsxs("div",{className:"flex flex-col h-full bg-sidebar",children:[m,b]}),t[19]=m,t[20]=p):p=t[20],p}function Se(){I(),G.signOut()}function ve(e){return e.location.pathname}function Ne(){const e=S.c(4),t=W(),{org:f}=J();be(f.slug);let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:"flex-1 flex items-center justify-center",children:s.jsx(D,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=l):l=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(F.Suspense,{fallback:l,children:s.jsx("div",{className:"flex flex-1 items-center overflow-hidden rounded-[inherit]",children:s.jsx(ee,{value:"p-0",children:s.jsx("div",{className:"flex-1 min-w-0 overflow-hidden h-full",children:s.jsx(K,{})})})})}),e[1]=a):a=e[1];const r=a;if(t){let n;return e[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0 overflow-hidden",children:r}),e[2]=n):n=e[2],n}let o;return e[3]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx("div",{className:"flex-1 min-h-0 p-1",children:s.jsx("div",{className:k("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","rounded-[0.75rem]"),children:r})}),e[3]=o):o=e[3],o}function Xe(){const e=S.c(22),t=W();let f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(y.LogoLink,{}),e[0]=f):f=e[0];let l;e[1]!==t?(l=t&&s.jsx(ue,{}),e[1]=t,e[2]=l):l=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("span",{className:"hidden md:contents",children:s.jsx(y.Nav,{})}),e[3]=a):a=e[3];let r;e[4]!==l?(r=s.jsxs(y.LeftColumn,{children:[f,l,a]}),e[4]=l,e[5]=r):r=e[5];let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(y.CenterSlot,{}),e[6]=o):o=e[6];let n;e[7]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(y.RightColumn,{children:s.jsx("span",{})}),e[7]=n):n=e[7];let i;e[8]!==r?(i=s.jsxs(y.Header,{children:[r,o,n]}),e[8]=r,e[9]=i):i=e[9];let u;e[10]===Symbol.for("react.memo_cache_sentinel")?(u={"--sidebar-width-icon":"3.5rem"},e[10]=u):u=e[10];let c;e[11]!==t?(c=!t&&s.jsx(ge,{}),e[11]=t,e[12]=c):c=e[12];let d;e[13]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx(U,{className:"flex flex-col",style:{background:"transparent",containerType:"inline-size"},children:s.jsx(Ne,{})}),e[13]=d):d=e[13];let x;e[14]!==c?(x=s.jsxs(V,{className:"flex-1 bg-sidebar min-h-0",style:u,children:[c,d]}),e[14]=c,e[15]=x):x=e[15];let m;e[16]!==t?(m=t&&s.jsx(he,{renderSidebar:ke}),e[16]=t,e[17]=m):m=e[17];let b;return e[18]!==x||e[19]!==m||e[20]!==i?(b=s.jsx(y.Provider,{children:s.jsx(X,{defaultOpen:!0,children:s.jsxs("div",{className:"app-shell-root flex flex-col h-dvh overflow-hidden",children:[i,x,m]})})}),e[18]=x,e[19]=m,e[20]=i,e[21]=b):b=e[21],b}function ke(e){const{onClose:t}=e;return s.jsx(ye,{onClose:t})}export{ge as SettingsSidebar,ye as SettingsSidebarMobile,Xe as default};
@@ -1 +0,0 @@
1
- import{e as f,j as a}from"./index-EQfvflqN.js";import{S as p,c as b,d as S}from"./sheet-CO5nUKz5.js";import{u as d}from"./sidebar-Bc_N4P0Q.js";import{i as h}from"./LayoutLeft-Dbsbo4ui.js";import{T as u}from"./toolbar-CkTqFHd9.js";function M(){const t=f.c(3),{toggleSidebar:e}=d();let o;t[0]===Symbol.for("react.memo_cache_sentinel")?(o=a.jsx(h,{size:16}),t[0]=o):o=t[0];let s;return t[1]!==e?(s=a.jsx(u,{onClick:e,"aria-label":"Toggle sidebar",children:o}),t[1]=e,t[2]=s):s=t[2],s}function _(t){const e=f.c(12),{renderSidebar:o}=t,{openMobile:s,setOpenMobile:i}=d();let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=a.jsx(p,{className:"sr-only",children:"Navigation"}),e[0]=c):c=e[0];let n;e[1]!==i?(n=()=>i(!1),e[1]=i,e[2]=n):n=e[2];let r;e[3]!==o||e[4]!==n?(r=o({onClose:n}),e[3]=o,e[4]=n,e[5]=r):r=e[5];let l;e[6]!==r?(l=a.jsxs(b,{side:"left",hideCloseButton:!0,className:"w-screen max-w-none! p-0",children:[c,r]}),e[6]=r,e[7]=l):l=e[7];let m;return e[8]!==s||e[9]!==i||e[10]!==l?(m=a.jsx(S,{open:s,onOpenChange:i,children:l}),e[8]=s,e[9]=i,e[10]=l,e[11]=m):m=e[11],m}export{_ as M,M as S};
@@ -1 +0,0 @@
1
- import{e as k,a as X,j as s,B as O,bT as U,n as G,ae as fe,b as Z,H as Se,a5 as ge,K as le,bU as je,bV as ve,a2 as H,r as V,bW as ke,bX as Ne,m as ie,f as Oe,p as _e,g as he,d as Ce,y as Ae,bY as $e,bZ as ce,b_ as ze,b$ as Te,S as Ee,O as Pe,c0 as Me}from"./index-EQfvflqN.js";import{A as te}from"./avatar-BuKPm2vr.js";import{t as pe,a as Le}from"./Users03-rDpaXmvi.js";import{i as Fe,b as Ie,s as qe,a as D,n as Re}from"./Stars02-CsAFd9rT.js";import{s as De}from"./XClose-CjsCyYq1.js";import{i as K}from"./CheckCircle-D96bOHZ4.js";import{i as de}from"./FilterLines-CybSjddP.js";import{i as Q}from"./Zap-CBPMaWRv.js";import{c as Ue,D as Ke,a as He,d as Ge}from"./dialog-45S14PiE.js";import{R as Be}from"./required-auth-layout-D-3ucvj0.js";import{g as We,c as Ye,A as Je}from"./hooks-C6xsli9S.js";import{g as Qe,m as Ve,S as Xe}from"./use-mcp-client-Dlrc-MQT.js";import{n as Ze}from"./tab-id-BptcWVWa.js";import{c as et}from"./use-organization-settings-MrFZCmt9.js";import{u as tt}from"./use-org-sso-CQCoThc3.js";function nt(t){const e=k.c(27),{orgName:n,orgSlug:o,orgLogo:r,domain:a}=t;let i;e[0]!==o?(i={mutationFn:async()=>{const b=await fetch("/api/auth/custom/domain-join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationSlug:o})}),v=await b.json();if(!b.ok||!v.success)throw new Error(v.error??"Failed to join organization");return v},onSuccess:b=>{window.location.href=`/${b.slug??o}`},onError:ot},e[0]=o,e[1]=i):i=e[1];const l=X(i),d=st;let c;e[2]!==r||e[3]!==n?(c=r?s.jsx(te,{url:r,fallback:n.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-12 w-12"}):s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(pe,{className:"h-6 w-6 text-primary"})}),e[2]=r,e[3]=n,e[4]=c):c=e[4];let m;e[5]!==n?(m=s.jsxs("h3",{className:"text-lg font-medium",children:["Join ",n,"?"]}),e[5]=n,e[6]=m):m=e[6];let u;e[7]!==a?(u=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Anyone with an ",s.jsxs("strong",{children:["@",a]})," email can join this organization."]}),e[7]=a,e[8]=u):u=e[8];let p;e[9]!==m||e[10]!==u?(p=s.jsxs("div",{className:"space-y-2",children:[m,u]}),e[9]=m,e[10]=u,e[11]=p):p=e[11];let h;e[12]!==l?(h=()=>l.mutate(),e[12]=l,e[13]=h):h=e[13];const x=l.isPending?"Joining…":`Enter ${n}`;let f;e[14]!==l.isPending||e[15]!==h||e[16]!==x?(f=s.jsx(O,{onClick:h,disabled:l.isPending,children:x}),e[14]=l.isPending,e[15]=h,e[16]=x,e[17]=f):f=e[17];let g;e[18]!==l.isPending?(g=s.jsx(O,{variant:"ghost",onClick:d,disabled:l.isPending,children:"Go to home"}),e[18]=l.isPending,e[19]=g):g=e[19];let y;e[20]!==f||e[21]!==g?(y=s.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[f,g]}),e[20]=f,e[21]=g,e[22]=y):y=e[22];let w;return e[23]!==y||e[24]!==c||e[25]!==p?(w=s.jsxs(U,{children:[c,p,y]}),e[23]=y,e[24]=c,e[25]=p,e[26]=w):w=e[26],w}function st(){window.location.href="/"}function ot(t){G.error(t instanceof Error?t.message:"Failed to join organization")}function ue(t){const e=k.c(17),{orgSlug:n,orgName:o,reason:r}=t,a=it,i=r==="not-found",l=i?Fe:fe,d=i?"Organization not found":"No access";let c;e[0]!==i||e[1]!==o||e[2]!==n?(c=i?s.jsxs(s.Fragment,{children:["We couldn't find an organization called ",s.jsx("strong",{children:n}),"."]}):s.jsxs(s.Fragment,{children:["You don't have access to ",s.jsx("strong",{children:o??n}),".",s.jsx("br",{}),"Ask an admin to invite you."]}),e[0]=i,e[1]=o,e[2]=n,e[3]=c):c=e[3];const m=c;let u;e[4]!==l?(u=s.jsx("div",{className:"bg-muted p-3 rounded-full",children:s.jsx(l,{className:"h-6 w-6 text-muted-foreground"})}),e[4]=l,e[5]=u):u=e[5];let p;e[6]!==d?(p=s.jsx("h3",{className:"text-lg font-medium",children:d}),e[6]=d,e[7]=p):p=e[7];let h;e[8]!==m?(h=s.jsx("p",{className:"text-sm text-muted-foreground",children:m}),e[8]=m,e[9]=h):h=e[9];let x;e[10]!==p||e[11]!==h?(x=s.jsxs("div",{className:"space-y-2",children:[p,h]}),e[10]=p,e[11]=h,e[12]=x):x=e[12];let f;e[13]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(O,{onClick:a,children:"Go to home"}),e[13]=f):f=e[13];let g;return e[14]!==u||e[15]!==x?(g=s.jsxs(U,{children:[u,x,f]}),e[14]=u,e[15]=x,e[16]=g):g=e[16],g}function it(){window.location.href="/"}function at(t){const e=k.c(39),{invitationId:n,orgName:o,orgSlug:r,orgLogo:a}=t;let i;e[0]!==n?(i=async()=>{const C=await Z.organization.acceptInvitation({invitationId:n});if(C.error)throw new Error(C.error.message);return C.data},e[0]=n,e[1]=i):i=e[1];let l;e[2]!==r?(l=()=>{Se(),window.location.href=`/${r}`},e[2]=r,e[3]=l):l=e[3];let d;e[4]!==i||e[5]!==l?(d={mutationFn:i,onSuccess:l,onError:ct},e[4]=i,e[5]=l,e[6]=d):d=e[6];const c=X(d);let m;e[7]!==n?(m=async()=>{const C=await Z.organization.rejectInvitation({invitationId:n});if(C.error)throw new Error(C.error.message);return C.data},e[7]=n,e[8]=m):m=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=lt,e[9]=u):u=e[9];let p;e[10]!==m?(p={mutationFn:m,onSuccess:u,onError:rt},e[10]=m,e[11]=p):p=e[11];const h=X(p),x=c.isPending||h.isPending;let f;e[12]!==a||e[13]!==o?(f=a?s.jsx(te,{url:a,fallback:o.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-12 w-12"}):s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(Ie,{className:"h-6 w-6 text-primary"})}),e[12]=a,e[13]=o,e[14]=f):f=e[14];let g;e[15]!==o?(g=s.jsxs("h3",{className:"text-lg font-medium",children:["You've been invited to ",s.jsx("strong",{children:o})]}),e[15]=o,e[16]=g):g=e[16];let y;e[17]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("p",{className:"text-sm text-muted-foreground",children:"Accept the invitation to join this organization."}),e[17]=y):y=e[17];let w;e[18]!==g?(w=s.jsxs("div",{className:"space-y-2",children:[g,y]}),e[18]=g,e[19]=w):w=e[19];let b;e[20]!==c?(b=()=>c.mutate(),e[20]=c,e[21]=b):b=e[21];const v=c.isPending?"Accepting…":"Accept invitation";let N;e[22]!==x||e[23]!==b||e[24]!==v?(N=s.jsx(O,{onClick:b,disabled:x,children:v}),e[22]=x,e[23]=b,e[24]=v,e[25]=N):N=e[25];let _;e[26]!==h?(_=()=>h.mutate(),e[26]=h,e[27]=_):_=e[27];const S=h.isPending?"Declining…":"Decline";let A;e[28]!==x||e[29]!==_||e[30]!==S?(A=s.jsx(O,{variant:"ghost",onClick:_,disabled:x,children:S}),e[28]=x,e[29]=_,e[30]=S,e[31]=A):A=e[31];let $;e[32]!==N||e[33]!==A?($=s.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[N,A]}),e[32]=N,e[33]=A,e[34]=$):$=e[34];let z;return e[35]!==w||e[36]!==$||e[37]!==f?(z=s.jsxs(U,{children:[f,w,$]}),e[35]=w,e[36]=$,e[37]=f,e[38]=z):z=e[38],z}function rt(t){G.error(t instanceof Error?t.message:"Failed to decline invitation")}function lt(){G.success("Invitation declined"),window.location.href="/"}function ct(t){G.error(t instanceof Error?t.message:"Failed to accept invitation")}function dt(t){const e=k.c(10),{orgName:n,orgLogo:o}=t;let r;e[0]!==o||e[1]!==n?(r=o?s.jsx(te,{url:o,fallback:n.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-12 w-12"}):s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(qe,{className:"h-6 w-6 text-primary"})}),e[0]=o,e[1]=n,e[2]=r):r=e[2];let a;e[3]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx("h3",{className:"text-lg font-medium",children:"Request pending"}),e[3]=a):a=e[3];let i;e[4]!==n?(i=s.jsxs("div",{className:"space-y-2",children:[a,s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Your request to join ",s.jsx("strong",{children:n})," is waiting for an admin to approve it. You'll get access once it's approved."]})]}),e[4]=n,e[5]=i):i=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(O,{variant:"ghost",onClick:ut,children:"Go to home"}),e[6]=l):l=e[6];let d;return e[7]!==r||e[8]!==i?(d=s.jsxs(U,{children:[r,i,l]}),e[7]=r,e[8]=i,e[9]=d):d=e[9],d}function ut(){window.location.href="/"}function mt(t){const e=k.c(30),{orgName:n,orgSlug:o,orgLogo:r,domain:a}=t;let i;e[0]!==o?(i=async()=>{const v=await fetch("/api/auth/custom/domain-request-join",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({organizationSlug:o})}),N=await v.json();if(!v.ok||!N.success)throw new Error(N.error??"Failed to request access");return N},e[0]=o,e[1]=i):i=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=ht,e[2]=l):l=e[2];let d;e[3]!==i?(d={mutationFn:i,onSuccess:l,onError:gt},e[3]=i,e[4]=d):d=e[4];const c=X(d);let m;e[5]!==r||e[6]!==n?(m=r?s.jsx(te,{url:r,fallback:n.charAt(0).toUpperCase(),shape:"square",size:"base",className:"h-12 w-12"}):s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(pe,{className:"h-6 w-6 text-primary"})}),e[5]=r,e[6]=n,e[7]=m):m=e[7];let u;e[8]!==n?(u=s.jsxs("h3",{className:"text-lg font-medium",children:["Request to join ",n,"?"]}),e[8]=n,e[9]=u):u=e[9];let p;e[10]!==a?(p=s.jsxs("p",{className:"text-sm text-muted-foreground",children:["An admin must approve requests from ",s.jsxs("strong",{children:["@",a]})," emails before you can join."]}),e[10]=a,e[11]=p):p=e[11];let h;e[12]!==u||e[13]!==p?(h=s.jsxs("div",{className:"space-y-2",children:[u,p]}),e[12]=u,e[13]=p,e[14]=h):h=e[14];let x;e[15]!==c?(x=()=>c.mutate(),e[15]=c,e[16]=x):x=e[16];const f=c.isPending?"Requesting…":"Request to join";let g;e[17]!==c.isPending||e[18]!==x||e[19]!==f?(g=s.jsx(O,{onClick:x,disabled:c.isPending,children:f}),e[17]=c.isPending,e[18]=x,e[19]=f,e[20]=g):g=e[20];let y;e[21]!==c.isPending?(y=s.jsx(O,{variant:"ghost",onClick:ft,disabled:c.isPending,children:"Go to home"}),e[21]=c.isPending,e[22]=y):y=e[22];let w;e[23]!==g||e[24]!==y?(w=s.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[g,y]}),e[23]=g,e[24]=y,e[25]=w):w=e[25];let b;return e[26]!==w||e[27]!==m||e[28]!==h?(b=s.jsxs(U,{children:[m,h,w]}),e[26]=w,e[27]=m,e[28]=h,e[29]=b):b=e[29],b}function ft(){window.location.href="/"}function gt(t){G.error(t instanceof Error?t.message:"Failed to request access")}function ht(t){if(t.alreadyMember&&t.slug){window.location.href=`/${t.slug}`;return}window.location.reload()}function pt(t){const e=k.c(7);let n;e[0]!==t?(n=le.orgAccessStatus(t),e[0]=t,e[1]=n):n=e[1];let o;e[2]!==t?(o=async()=>{const a=await fetch(`/api/auth/custom/org-access-status/${encodeURIComponent(t)}`,{credentials:"include"});if(!a.ok)throw new Error(`org-access-status failed (${a.status})`);return await a.json()},e[2]=t,e[3]=o):o=e[3];let r;return e[4]!==n||e[5]!==o?(r={queryKey:n,queryFn:o,refetchOnWindowFocus:!1},e[4]=n,e[5]=o,e[6]=r):r=e[6],ge(r)}function xt({orgSlug:t}){const{data:e}=pt(t);if(e.status!=="member"){je()?.org===t&&ve();const n=localStorage.getItem(H.lastOrgSlug())===t;if(n&&localStorage.removeItem(H.lastOrgSlug()),n&&(e.status==="not-found"||e.status==="no-access"))return window.location.href="/",null}return e.status==="not-found"?s.jsx(ue,{orgSlug:t,reason:"not-found"}):e.status==="pending-invite"?s.jsx(at,{invitationId:e.invitation.id,orgName:e.organization.name,orgSlug:e.organization.slug,orgLogo:e.organization.logo}):e.status==="auto-domain-join"?s.jsx(nt,{orgName:e.organization.name,orgSlug:e.organization.slug,orgLogo:e.organization.logo,domain:e.organization.domain??""}):e.status==="can-request"?s.jsx(mt,{orgName:e.organization.name,orgSlug:e.organization.slug,orgLogo:e.organization.logo,domain:e.organization.domain??""}):e.status==="request-pending"?s.jsx(dt,{orgName:e.organization.name,orgLogo:e.organization.logo}):e.status==="member"?(window.location.reload(),null):s.jsx(ue,{orgSlug:t,orgName:e.organization.name,reason:"no-access"})}function yt(t){const e=k.c(20),{release:n,onCtaClick:o,onLearnMoreClick:r}=t;let a;e[0]!==n.eyebrow?(a=n.eyebrow&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n.eyebrow}),e[0]=n.eyebrow,e[1]=a):a=e[1];let i;e[2]!==n.title?(i=s.jsx("h3",{className:"text-base font-semibold text-foreground",children:n.title}),e[2]=n.title,e[3]=i):i=e[3];let l;e[4]!==a||e[5]!==i?(l=s.jsxs("div",{children:[a,i]}),e[4]=a,e[5]=i,e[6]=l):l=e[6];let d;e[7]!==n.bullets?(d=n.bullets.map(bt),e[7]=n.bullets,e[8]=d):d=e[8];let c;e[9]!==d?(c=s.jsx("ul",{className:"flex flex-col gap-3",children:d}),e[9]=d,e[10]=c):c=e[10];let m;e[11]!==o||e[12]!==r||e[13]!==n.cta||e[14]!==n.learnMoreHref?(m=(n.cta||n.learnMoreHref)&&s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[n.learnMoreHref?s.jsx("a",{href:n.learnMoreHref,target:"_blank",rel:"noreferrer",onClick:r,className:"text-xs text-muted-foreground hover:text-foreground underline-offset-2 hover:underline",children:"Learn More"}):s.jsx("span",{}),n.cta&&s.jsx(O,{asChild:!0,size:"sm",onClick:o,children:s.jsx("a",{href:n.cta.href,children:n.cta.label})})]}),e[11]=o,e[12]=r,e[13]=n.cta,e[14]=n.learnMoreHref,e[15]=m):m=e[15];let u;return e[16]!==l||e[17]!==c||e[18]!==m?(u=s.jsxs("div",{className:"flex flex-col gap-3",children:[l,c,m]}),e[16]=l,e[17]=c,e[18]=m,e[19]=u):u=e[19],u}function bt(t,e){return s.jsxs("li",{className:"flex items-start gap-3",children:[s.jsx(t.icon,{size:20,className:"text-muted-foreground mt-0.5 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium text-foreground",children:t.title}),s.jsx("p",{className:"text-xs text-muted-foreground",children:t.body})]})]},e)}const xe=[{id:"fable-5-suspension",date:"2026-06-13",eyebrow:"Important Update",title:"Fable 5 & Mythos 5 suspended — Opus 4.8 takes over",bullets:[{icon:K,title:"US government directive",body:"Anthropic received an export control directive requiring the suspension of Fable 5 and Mythos 5 access for all users, citing national security concerns. Anthropic is complying while it works to resolve the matter."},{icon:D,title:"Opus 4.8 steps in as the Thinking tier",body:"The Thinking tier now runs on Claude Opus 4.8, which remains fully operational. Performance on most tasks is comparable, and Anthropic reports more than 95% of sessions were unaffected by the Fable 5 classifiers anyway."},{icon:Q,title:"Nothing to change",body:"The switch is automatic — any chat or agent already using the Thinking tier is now served by Opus 4.8. Anthropic will share further details within 24 hours."}],learnMoreHref:"https://www.anthropic.com/news/fable-mythos-access"},{id:"claude-fable-5",date:"2026-06-09",eyebrow:"Now Available",title:"Claude Fable 5 leads the Thinking tier",bullets:[{icon:D,title:"State-of-the-art reasoning",body:"Fable 5 takes the Thinking tier, posting top scores across software engineering, knowledge work, and vision — and outperforming Opus 4.8 on nearly every benchmark Anthropic tested."},{icon:K,title:"Safety without the slowdown",body:"New classifiers route the small slice of high-risk requests (cybersecurity, bio/chem) back to Opus 4.8. Anthropic reports more than 95% of sessions never trigger a fallback."},{icon:Q,title:"Nothing to change",body:"Chats and agents pick up Fable 5 automatically wherever the Thinking tier is selected. Opus 4.8 stays available as the safety fallback."}],learnMoreHref:"https://www.anthropic.com/news/claude-fable-5-mythos-5"},{id:"claude-opus-4-8",date:"2026-05-28",eyebrow:"Now Available",title:"Claude Opus 4.8 is the new default",bullets:[{icon:D,title:"Smarter thinking, same price",body:"Opus 4.8 now leads the Thinking and Smarter tiers, outperforming Opus 4.7 on coding, reasoning, and agent tasks at the same cost."},{icon:K,title:"More honest answers",body:"It's about 4× less likely to let a code flaw slip through unflagged, and surfaces uncertainty instead of making unsupported claims."},{icon:Q,title:"Nothing to change",body:"Chats and agents pick up Opus 4.8 automatically wherever the Thinking or Smarter tier is selected."}],learnMoreHref:"https://www.anthropic.com/news/claude-opus-4-8"},{id:"enhanced-sidebar",date:"2026-05-28",eyebrow:"Now Available",title:"Enhanced sidebar",bullets:[{icon:D,title:"A clearer view of what's running",body:"See every task in your organization at a glance, with each agent and status group laid out so you can spot active work without hunting for it."},{icon:de,title:"Browse one group at a time",body:"Expand the groups you care about and pull in more results on demand — no more endless scrolling to find an older conversation."},{icon:K,title:"Polished and steadier",body:"Several sidebar bugs are fixed, including empty agent groups showing the right action and status filters returning the right tasks."}]},{id:"smarter-task-delegation",date:"2026-05-27",eyebrow:"Now Available",title:"Smarter task delegation",bullets:[{icon:Le,title:"Real results from delegated agents",body:"When one agent hands work to another, you'll see the full report inline — no more empty replies hiding the work that was done."},{icon:Q,title:"Same powers, top to bottom",body:"Delegated agents now work with the same tools, context, and memory as the agent that called them, so complex multi-agent investigations finish on the first try."},{icon:K,title:"Clearer progress signals",body:"When a delegated task hits its limit or runs into a problem, you get a plain-language message instead of a silent stall."}]},{id:"sidebar-task-groups",date:"2026-05-27",eyebrow:"Now Available",title:"Redesigned sidebar",bullets:[{icon:D,title:"Group by agent or status",body:"Switch the task list between grouping by agent or by status — pick whichever matches how you're working right now."},{icon:de,title:"Sharper filters",body:"Narrow the list to your tasks, manual chats, or automations from a compact filter row above the groups."}]},{id:"release-channel",date:"2026-05-26",eyebrow:"Now Available",title:"Release announcements",bullets:[{icon:D,title:"Heads-up when features ship",body:"New releases surface in a corner card the first time you see them, then stick around in your inbox."},{icon:Re,title:"Unified inbox",body:"Org invitations and product updates now share one chronological feed in the sidebar."}]}],ee="studio.release-feed.v1",ae=new Set;let M="",L={},re=!1;function wt(){if(re)return M||"{}";try{return localStorage.getItem(ee)??"{}"}catch{return M||"{}"}}function ye(t){try{const e=JSON.parse(t);return e&&typeof e=="object"?e:{}}catch{return{}}}function me(){const t=wt();return t!==M&&(M=t,L=ye(t)),L}function St(t){ae.add(t);const e=n=>{if(!(n.key!==ee&&n.key!==null)){try{const o=localStorage.getItem(ee)??"{}",a={...ye(o),...L};L=a,M=JSON.stringify(a)}catch{}t()}};return window.addEventListener("storage",e),()=>{ae.delete(t),window.removeEventListener("storage",e)}}function jt(t){L=t,M=JSON.stringify(t);try{localStorage.setItem(ee,M),re=!1}catch{re=!0}ae.forEach(e=>e())}function vt(){const t=k.c(7),e=V.useSyncExternalStore(St,me,me);let n;t[0]!==e?(n=d=>!!e[d],t[0]=e,t[1]=n):n=t[1];const o=n,r=kt;let a;t[2]!==e?(a=xe.reduce((d,c)=>e[c.id]?d:d+1,0),t[2]=e,t[3]=a):a=t[3];const i=a;let l;return t[4]!==o||t[5]!==i?(l={isSeen:o,markSeen:r,unseenCount:i},t[4]=o,t[5]=i,t[6]=l):l=t[6],l}function kt(t){L[t]||jt({...L,[t]:{seenAt:new Date().toISOString()}})}const Nt=720*60*60*1e3;function Ot(t){const[e,n,o]=t.split("-").map(Number);return!e||!n||!o?new Date(t).getTime():new Date(e,n-1,o).getTime()}function _t(t){const e=xe[0];if(!e)return null;const n=Ot(e.date),o=t-n;return o<0||o>Nt?null:e}function Ct(){const t=k.c(21),{isSeen:e,markSeen:n}=vt();let o,r,a;if(t[0]!==e){a=Symbol.for("react.early_return_sentinel");e:{if(o=_t(Date.now()),!o){a=null;break e}r=e(o.id)}t[0]=e,t[1]=o,t[2]=r,t[3]=a}else o=t[1],r=t[2],a=t[3];if(a!==Symbol.for("react.early_return_sentinel"))return a;if(r)return null;let i;t[4]!==o.id||t[5]!==n?(i=()=>n(o.id),t[4]=o.id,t[5]=n,t[6]=i):i=t[6];let l;t[7]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(De,{size:14}),t[7]=l):l=t[7];let d;t[8]!==i?(d=s.jsx(O,{size:"icon",variant:"ghost","aria-label":"Dismiss release announcement",className:"absolute right-2 top-2 size-7 text-muted-foreground",onClick:i,children:l}),t[8]=i,t[9]=d):d=t[9];let c,m;t[10]!==o.id||t[11]!==n?(c=()=>n(o.id),m=()=>n(o.id),t[10]=o.id,t[11]=n,t[12]=c,t[13]=m):(c=t[12],m=t[13]);let u;t[14]!==o||t[15]!==c||t[16]!==m?(u=s.jsx(yt,{release:o,onCtaClick:c,onLearnMoreClick:m}),t[14]=o,t[15]=c,t[16]=m,t[17]=u):u=t[17];let p;return t[18]!==d||t[19]!==u?(p=s.jsxs("div",{role:"dialog","aria-label":"Release announcement",className:"fixed bottom-6 right-6 z-50 w-[min(360px,calc(100vw-3rem))] rounded-lg border border-border bg-background p-4 shadow-lg animate-in fade-in slide-in-from-bottom-2 duration-300",children:[d,u]}),t[18]=d,t[19]=u,t[20]=p):p=t[20],p}const be=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),P=be?"⌘":"Ctrl",E={keyboardShortcuts:{keys:[P,"K"],description:"Keyboard shortcuts"},focusChatInput:{keys:[P,"L"],description:"Focus chat input"},saveAndFormat:{keys:[P,"S"],description:"Save & format"},sendMessage:{keys:["Enter"],description:"Send message"},newLine:{keys:["Shift","Enter"],description:"New line"},selectOption:{keys:["1-9"],description:"Select option"},applyFilter:{keys:[P,"Enter"],description:"Apply filter"},togglePlanMode:{keys:[P,"Shift","L"],description:"Toggle plan mode"},newTask:{keys:["Shift",P,"S"],description:"New task"},toggleDaemon:{keys:[P,"D"],description:"Toggle daemon logs"}},At=[{label:"General",shortcuts:[E.keyboardShortcuts,E.newTask,E.toggleDaemon]},{label:"Editor",shortcuts:[E.saveAndFormat]},{label:"Chat",shortcuts:[E.focusChatInput,E.togglePlanMode,E.sendMessage,E.newLine]},{label:"Questions",shortcuts:[E.selectOption]},{label:"Monitoring",shortcuts:[E.applyFilter]}];function $t(t){return be?t.metaKey:t.ctrlKey}function zt(t){const e=k.c(5),{open:n,onOpenChange:o}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(Ke,{children:s.jsx(He,{children:"Keyboard Shortcuts"})}),e[0]=r):r=e[0];let a;e[1]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsxs(Ue,{className:"sm:max-w-md",children:[r,s.jsx("div",{className:"flex flex-col gap-4",children:At.map(Tt)})]}),e[1]=a):a=e[1];let i;return e[2]!==o||e[3]!==n?(i=s.jsx(Ge,{open:n,onOpenChange:o,children:a}),e[2]=o,e[3]=n,e[4]=i):i=e[4],i}function Tt(t){return s.jsxs("div",{children:[s.jsx("h3",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2",children:t.label}),s.jsx("div",{className:"flex flex-col gap-1.5",children:t.shortcuts.map(Et)})]},t.label)}function Et(t){return s.jsxs("div",{className:"flex items-center justify-between py-1",children:[s.jsx("span",{className:"text-sm",children:t.description}),s.jsx("div",{className:"flex items-center gap-1",children:t.keys.map(Pt)})]},t.description)}function Pt(t){return s.jsx("kbd",{className:"inline-flex items-center justify-center min-w-6 h-6 px-1.5 rounded-sm border border-border bg-muted text-muted-foreground text-xs font-mono",children:t},t)}function Mt({activeOrg:t}){return t&&(ke(t.id,{name:t.name??void 0,slug:t.slug??void 0}),Ne()),null}function Lt(t,e,n){if(!n)return null;const o=We(t,e);return o?o.threads.get().find(a=>a.id===n)?.branch??null:null}function we(t){return{queryKey:le.homeNextActions(t),queryFn:async()=>{const e=await fetch(`/api/${t}/home-next-actions`,{cache:"no-store"});if(!e.ok)throw new Error("Failed to load home next actions");return await e.json()},staleTime:0,refetchOnWindowFocus:"always"}}function rn(t){const e=k.c(10);let n;e[0]!==t?(n=we(t),e[0]=t,e[1]=n):n=e[1];const o=ie(n);let r;e[2]!==o.data?.prompts?(r=o.data?.prompts??[],e[2]=o.data?.prompts,e[3]=r):r=e[3];let a;e[4]!==o.data?.tiles?(a=o.data?.tiles??[],e[4]=o.data?.tiles,e[5]=a):a=e[5];let i;return e[6]!==o.isLoading||e[7]!==r||e[8]!==a?(i={isLoading:o.isLoading,prompts:r,tiles:a},e[6]=o.isLoading,e[7]=r,e[8]=a,e[9]=i):i=e[9],i}function Ft(t){const e=k.c(17),{orgSlug:n,orgName:o,domain:r}=t;let a;e[0]!==n?(a=()=>{window.location.href=`/api/${encodeURIComponent(n)}/sso/authorize`},e[0]=n,e[1]=a):a=e[1];const i=a,l=It;let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsx("div",{className:"bg-primary/10 p-3 rounded-full",children:s.jsx(fe,{className:"h-6 w-6 text-primary"})}),e[2]=d):d=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx("h3",{className:"text-lg font-medium",children:"SSO Authentication Required"}),e[3]=c):c=e[3];let m;e[4]!==r||e[5]!==o?(m=o?s.jsxs(s.Fragment,{children:[s.jsx("strong",{children:o})," requires SSO authentication",r?` via ${r}`:"","."]}):"This organization requires SSO authentication to access.",e[4]=r,e[5]=o,e[6]=m):m=e[6];let u;e[7]!==m?(u=s.jsxs("div",{className:"space-y-2",children:[c,s.jsx("p",{className:"text-sm text-muted-foreground",children:m})]}),e[7]=m,e[8]=u):u=e[8];let p;e[9]!==i?(p=s.jsx(O,{onClick:i,children:"Sign in with SSO"}),e[9]=i,e[10]=p):p=e[10];let h;e[11]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(O,{variant:"ghost",onClick:l,children:"Go back"}),e[11]=h):h=e[11];let x;e[12]!==p?(x=s.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[p,h]}),e[12]=p,e[13]=x):x=e[13];let f;return e[14]!==u||e[15]!==x?(f=s.jsxs(U,{children:[d,u,x]}),e[14]=u,e[15]=x,e[16]=f):f=e[16],f}function It(){window.location.href="/"}function qt(t){const e=k.c(8),{org:n,children:o}=t,a=et(n.id,n.slug)?.enabled_plugins??null;let i;e[0]!==n.id||e[1]!==n.name||e[2]!==a?(i={id:n.id,organizationId:n.id,slug:"_org",name:n.name,enabledPlugins:a,ui:null},e[0]=n.id,e[1]=n.name,e[2]=a,e[3]=i):i=e[3];const l=i;let d;return e[4]!==o||e[5]!==n||e[6]!==l?(d=s.jsx(Me,{org:n,project:l,children:o}),e[4]=o,e[5]=n,e[6]=l,e[7]=d):d=e[7],d}function Rt(){const t=Oe(),e=Ye(),{org:n,locator:o}=_e(),r=he({strict:!1}),a=Ce({strict:!1}),i=r.org??"",l=r.taskId??"",d=(f,g,y=!0)=>t({to:"/$org/$taskId",params:{org:i,taskId:f},search:g,replace:y}),c=(f,g=!0)=>d(l,f,g),m=f=>c(g=>({...g,chat:f?1:0})),u=(f,g,y)=>d(f,w=>{const b={chat:1};if(g?b.virtualmcpid=g:w.virtualmcpid&&(b.virtualmcpid=w.virtualmcpid),y?.main)b.main=y.main;else{const v=w.main;v&&typeof v=="string"&&!Ze(v)&&(b.main=v)}return y?.autosend&&(b.autosend=Je),b},!1);return{setChatOpen:m,setTaskId:u,createNewTask:async f=>{const g=crypto.randomUUID(),y=f??a.virtualmcpid??Qe(n.id).id,b=y===a.virtualmcpid?Lt(n.slug,o,l):null;try{await e?.create({id:g,virtual_mcp_id:y,...b?{branch:b}:{}})}catch{}u(g,y)},openTab:f=>d(l||crypto.randomUUID(),g=>({...g,main:f})),toggleMain:()=>c(f=>{if(f.main!==void 0&&f.main!=="0")return{...f,main:"0"};const y={...f};return delete y.main,y})}}function Dt(){const t=k.c(51);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org",shouldThrow:!1},t[0]=e):e=t[0];const o=Ae(e)?.params.org;let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},t[1]=r):r=t[1];const{taskId:a}=he(r),[i,l]=V.useState(!1),d=o??"";let c;t[2]!==d?(c=we(d),t[2]=d,t[3]=c):c=t[3];const m=!!o&&!a;let u;t[4]!==c||t[5]!==m?(u={...c,enabled:m},t[4]=c,t[5]=m,t[6]=u):u=t[6],ie(u);const{data:p}=Z.useSession(),h=p?.user?.id;let x;t[7]!==o||t[8]!==h?(x=o&&h?$e(h,o):null,t[7]=o,t[8]=h,t[9]=x):x=t[9];const f=x;let g,y;t[10]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{const j=T=>{$t(T)&&T.code==="KeyK"&&(T.preventDefault(),l(!0))};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},y=[],t[10]=g,t[11]=y):(g=t[10],y=t[11]),V.useEffect(g,y);let w;t[12]!==o?(w=le.activeOrganization(o),t[12]=o,t[13]=w):w=t[13];let b;t[14]!==o||t[15]!==h?(b=async()=>{if(!o)return null;performance.mark("mesh:active-org-fetch:start");const{data:j}=await Z.organization.getFullOrganization({query:{organizationSlug:o}}).finally(Ut),T=ce(j);return j&&!T&&localStorage.setItem(H.lastOrgSlug(),o),h&&j&&Te(h,o,j),j},t[14]=o,t[15]=h,t[16]=b):b=t[16];const v=f?f.data:void 0,N=f?.updatedAt;let _;t[17]!==b||t[18]!==v||t[19]!==N||t[20]!==w?(_={queryKey:w,queryFn:b,initialData:v,initialDataUpdatedAt:N,gcTime:1/0,refetchOnWindowFocus:!1},t[17]=b,t[18]=v,t[19]=N,t[20]=w,t[21]=_):_=t[21];const{data:S}=ge(_),A=S?.id,$=S?.slug,{data:z}=tt(A,$),C=A??"",ne=$??"";let F;t[22]!==C||t[23]!==ne?(F=Ve({connectionId:Xe,orgId:C,orgSlug:ne}),t[22]=C,t[23]=ne,t[24]=F):F=t[24];const se=!!A&&!!$;let B;if(t[25]!==F||t[26]!==se?(B={...F,enabled:se},t[25]=F,t[26]=se,t[27]=B):B=t[27],ie(B),!S){let j;t[28]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(Ee,{}),t[28]=j):j=t[28];let T;return t[29]!==o?(T=s.jsx(V.Suspense,{fallback:j,children:s.jsx(xt,{orgSlug:o})}),t[29]=o,t[30]=T):T=t[30],T}if(ce(S)){localStorage.getItem(H.lastOrgSlug())===o&&localStorage.removeItem(H.lastOrgSlug());let j;return t[31]!==S.name?(j=s.jsx(ze,{orgName:S.name}),t[31]=S.name,t[32]=j):j=t[32],j}if(z?.ssoRequired&&!z.authenticated){let j;return t[33]!==S.id||t[34]!==S.name||t[35]!==S.slug||t[36]!==z.domain?(j=s.jsx(Ft,{orgId:S.id,orgSlug:S.slug,orgName:S.name,domain:z.domain}),t[33]=S.id,t[34]=S.name,t[35]=S.slug,t[36]=z.domain,t[37]=j):j=t[37],j}const oe=S.logo??null;let I;t[38]!==S||t[39]!==oe?(I={...S,logo:oe},t[38]=S,t[39]=oe,t[40]=I):I=t[40];let q;t[41]!==S?(q=s.jsx(Mt,{activeOrg:S}),t[41]=S,t[42]=q):q=t[42];let W,Y;t[43]===Symbol.for("react.memo_cache_sentinel")?(W=s.jsx(Pe,{}),Y=s.jsx(Ct,{}),t[43]=W,t[44]=Y):(W=t[43],Y=t[44]);let R;t[45]!==i?(R=s.jsx(zt,{open:i,onOpenChange:l}),t[45]=i,t[46]=R):R=t[46];let J;return t[47]!==I||t[48]!==q||t[49]!==R?(J=s.jsxs(qt,{org:I,children:[q,W,Y,R]}),t[47]=I,t[48]=q,t[49]=R,t[50]=J):J=t[50],J}function Ut(){performance.mark("mesh:active-org-fetch:end"),performance.measure("mesh:active-org-fetch","mesh:active-org-fetch:start","mesh:active-org-fetch:end")}function Kt(){const t=k.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(Be,{children:s.jsx(Dt,{})}),t[0]=e):e=t[0],e}const ln=Object.freeze(Object.defineProperty({__proto__:null,default:Kt,usePanelActions:Rt},Symbol.toStringTag,{value:"Module"}));export{E as K,xe as R,yt as a,Rt as b,rn as c,we as h,$t as i,Lt as r,ln as s,vt as u};
@@ -1 +0,0 @@
1
- import{e as l,j as s,l as i}from"./index-EQfvflqN.js";function a(){const t=l.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{"data-testid":"shell-route-loading",className:"absolute inset-0 h-full w-full flex items-center justify-center",children:s.jsx(i,{size:20,className:"animate-spin text-muted-foreground"})}),t[0]=e):e=t[0],e}export{a as S};
@@ -1 +0,0 @@
1
- import{e as n,c,j as i}from"./index-EQfvflqN.js";function m(o){const e=n.c(8);let s,t;e[0]!==o?({className:s,...t}=o,e[0]=o,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let l;e[3]!==s?(l=c("bg-accent animate-pulse rounded-md",s),e[3]=s,e[4]=l):l=e[4];let a;return e[5]!==t||e[6]!==l?(a=i.jsx("div",{"data-slot":"skeleton",className:l,...t}),e[5]=t,e[6]=l,e[7]=a):a=e[7],a}export{m as S};
@@ -1 +0,0 @@
1
- import{p as D,r as v,j as e,B as p,t as S,n as c,e as N}from"./index-EQfvflqN.js";import{D as k}from"./domain-settings-DNfnwQe1.js";import{P as f}from"./index-BS6SIcIO.js";import{I as l}from"./input-DSpuivwc.js";import{S as z}from"./switch-DJTBR0xh.js";import{a as P,b as R,c as A,d as T}from"./use-org-sso-CQCoThc3.js";import{c as F,S as y,a as C,b as r,d as O}from"./settings-section-Xa6gQanu.js";import{s as L}from"./Trash01-CBhkXuxm.js";import{R as q}from"./require-capability-BnPWl2tF.js";import"./studio-tools-CcZtrETh.js";import"./badge-r4de0kry.js";import"./select-Cr8ncrzb.js";import"./tooltip-DZelUdM0.js";import"./ChevronUp-ByHCMSz5.js";import"./ChevronDown-BDUfpA8-.js";import"./sidebar-Bc_N4P0Q.js";import"./LayoutLeft-Dbsbo4ui.js";import"./sheet-CO5nUKz5.js";import"./X-CWsxaTAy.js";import"./card-D2P5f0Hv.js";import"./ArrowUpRight-CqYlpRve.js";import"./use-capability-D0k-04nV.js";import"./access-gate-gL5SpIsh.js";import"./capability-load-error-B01bGGw8.js";function B(){const{org:s}=D(),{data:a,isLoading:E}=P(s.id,s.slug),x=R(s.id,s.slug),h=A(s.id,s.slug),j=T(s.id,s.slug),[t,d]=v.useState({issuer:"",clientId:"",clientSecret:"",discoveryEndpoint:"",domain:"",scopes:"openid email profile"}),[m,g]=v.useState(!1),u=a?.configured&&a.config,o=a?.config,I=()=>{o&&d({issuer:o.issuer,clientId:o.clientId,clientSecret:"",discoveryEndpoint:o.discoveryEndpoint??"",domain:o.domain,scopes:o.scopes.join(" ")}),g(!0)},b=async()=>{if(!t.issuer||!t.clientId||!t.domain){c.error("Issuer, Client ID, and Domain are required");return}if(!u&&!t.clientSecret){c.error("Client Secret is required for initial setup");return}try{await x.mutateAsync({issuer:t.issuer,clientId:t.clientId,clientSecret:t.clientSecret,discoveryEndpoint:t.discoveryEndpoint||void 0,scopes:t.scopes.split(/\s+/).filter(Boolean),domain:t.domain,enforced:o?.enforced??!1}),S(u?"sso_config_updated":"sso_configured",{organization_id:s.id,email_domain:t.domain}),c.success("SSO configuration saved"),g(!1)}catch(i){c.error(i instanceof Error?i.message:"Failed to save SSO config")}},w=async()=>{if(confirm("Are you sure you want to remove SSO configuration?"))try{await h.mutateAsync(),S("sso_config_removed",{organization_id:s.id}),c.success("SSO configuration removed"),g(!1)}catch{c.error("Failed to remove SSO config")}},_=async i=>{try{await j.mutateAsync(i),S("sso_enforcement_toggled",{organization_id:s.id,enforced:i}),c.success(i?"SSO enforcement enabled":"SSO enforcement disabled")}catch{c.error("Failed to toggle SSO enforcement")}};return e.jsx(f,{children:e.jsx(f.Content,{children:e.jsx(f.Body,{children:e.jsxs(F,{children:[e.jsx(f.Title,{children:"Security"}),e.jsx(k,{}),E?e.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading..."}):e.jsxs(e.Fragment,{children:[u&&!m&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Provider",action:e.jsx("span",{className:"font-medium",children:o.issuer})}),e.jsx(r,{title:"Client ID",action:e.jsx("span",{className:"font-mono text-xs",children:o.clientId})}),e.jsx(r,{title:"Domain",action:e.jsx("span",{className:"font-medium",children:o.domain})}),e.jsx(r,{title:"Scopes",action:e.jsx("span",{className:"font-mono text-xs",children:o.scopes.join(" ")})}),e.jsx("div",{className:"h-px bg-border mx-5"}),e.jsx(r,{title:"Enforce SSO",description:"Require all members to authenticate via SSO",action:e.jsx(z,{checked:o.enforced,onCheckedChange:_,disabled:j.isPending})}),e.jsxs(O,{children:[e.jsxs(p,{variant:"ghost",size:"sm",onClick:w,disabled:h.isPending,className:"text-destructive hover:text-destructive mr-auto",children:[e.jsx(L,{size:14}),"Remove"]}),e.jsx(p,{variant:"outline",size:"sm",onClick:()=>{window.open(`/api/${s.slug}/sso/authorize`,"_blank")},children:"Test SSO"}),e.jsx(p,{variant:"outline",size:"sm",onClick:I,children:"Edit configuration"})]})]})}),(!u||m)&&e.jsx(y,{title:"Single Sign-On",children:e.jsxs(C,{children:[e.jsx(r,{title:"Issuer URL",description:"The OIDC issuer URL of your identity provider.",action:e.jsx(l,{id:"sso-issuer",placeholder:"https://login.microsoftonline.com/{tenant}/v2.0",value:t.issuer,onChange:i=>d(n=>({...n,issuer:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client ID",action:e.jsx(l,{id:"sso-client-id",placeholder:"your-client-id",value:t.clientId,onChange:i=>d(n=>({...n,clientId:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Client Secret",description:m&&u?"Leave empty to keep current":void 0,action:e.jsx(l,{id:"sso-client-secret",type:"password",placeholder:"your-client-secret",value:t.clientSecret,onChange:i=>d(n=>({...n,clientSecret:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Email Domain",description:"The email domain this SSO provider covers.",action:e.jsx(l,{id:"sso-domain",placeholder:"company.com",value:t.domain,onChange:i=>d(n=>({...n,domain:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Scopes",action:e.jsx(l,{id:"sso-scopes",placeholder:"openid email profile",value:t.scopes,onChange:i=>d(n=>({...n,scopes:i.target.value})),className:"w-[280px]"})}),e.jsx(r,{title:"Discovery Endpoint",description:"Optional — auto-detected from issuer if omitted.",action:e.jsx(l,{id:"sso-discovery",placeholder:"Auto-detected from issuer",value:t.discoveryEndpoint,onChange:i=>d(n=>({...n,discoveryEndpoint:i.target.value})),className:"w-[280px]"})}),e.jsxs(O,{children:[m&&e.jsx(p,{variant:"outline",size:"sm",onClick:()=>g(!1),children:"Cancel"}),e.jsx(p,{onClick:b,disabled:x.isPending,size:"sm",children:x.isPending?"Saving...":m?"Update":"Configure SSO"})]})]})})]})]})})})})}function me(){const s=N.c(1);let a;return s[0]===Symbol.for("react.memo_cache_sentinel")?(a=e.jsx(q,{capability:"org:manage",area:"security",children:e.jsx(B,{})}),s[0]=a):a=s[0],a}export{me as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/registry-layout-Dvh3zycp.js","assets/index-EQfvflqN.js","assets/index-BITgxoqa.css","assets/XCircle-qby-IxK9.js","assets/CheckCircle-D96bOHZ4.js","assets/Settings02-BDBrMikk.js","assets/use-mcp-client-Dlrc-MQT.js","assets/auth-oAvShPIA.js","assets/useInfiniteQuery-l1kRSOtu.js","assets/use-infinite-scroll-BvUO_UAz.js","assets/studio-tools-CcZtrETh.js","assets/badge-r4de0kry.js","assets/input-DSpuivwc.js","assets/dropdown-menu-CqSJARyq.js","assets/ChevronUp-ByHCMSz5.js","assets/ChevronRight-BdBQHcGY.js","assets/DotsVertical-B0BcJ-Xx.js","assets/table-ujnX7HJ5.js","assets/toggle-group-CMjl8VgC.js","assets/use-view-mode-DuHWUBn_.js","assets/tooltip-DZelUdM0.js","assets/FilterLines-CybSjddP.js","assets/Globe01-D6_7mD2q.js","assets/SearchMd-BJM4yPQO.js","assets/dialog-45S14PiE.js","assets/X-CWsxaTAy.js","assets/AlertCircle-Qsz79sot.js","assets/Upload01-geIrWEzc.js","assets/alert-dialog-y-SjofRy.js","assets/card-D2P5f0Hv.js","assets/Trash01-CBhkXuxm.js","assets/label-WMNwqiQL.js","assets/select-Cr8ncrzb.js","assets/ChevronDown-BDUfpA8-.js","assets/switch-DJTBR0xh.js","assets/textarea-DaCUK96G.js","assets/checkbox-CgVOF7oH.js","assets/Eye-Cn63kKBo.js","assets/LinkExternal01-B1YJxZ_i.js","assets/use-copy-B8BHxthn.js","assets/Key01-CEwc6a0T.js","assets/Plus-BotD1zxJ.js","assets/mcp-oauth-B7WMtt2U.js","assets/Play--fnJFFV0.js"])))=>i.map(i=>d[i]);
2
- import{e as m,f as n,g as c,j as t,l as f,r as l,ak as p}from"./index-EQfvflqN.js";import{R as u}from"./require-capability-BnPWl2tF.js";import"./use-capability-D0k-04nV.js";import"./access-gate-gL5SpIsh.js";import"./capability-load-error-B01bGGw8.js";const g=l.lazy(()=>p(()=>import("./registry-layout-Dvh3zycp.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43])));function j(){const e=m.c(5),i=n();let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org"},e[0]=s):s=e[0];const{org:o}=c(s);let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"h-full flex items-center justify-center",children:t.jsx(f,{size:20,className:"animate-spin text-muted-foreground"})}),e[1]=r):r=e[1];let a;return e[2]!==i||e[3]!==o?(a=t.jsx(u,{capability:"registry:manage",area:"the registry",children:t.jsx(l.Suspense,{fallback:r,children:t.jsx(g,{onBack:()=>i({to:"/$org/settings/store",params:{org:o}})})})}),e[2]=i,e[3]=o,e[4]=a):a=e[4],a}export{j as default};
@@ -1 +0,0 @@
1
- import{e as i,p as c}from"./index-EQfvflqN.js";class l extends Error{constructor(r,s){super(r),this.status=s,this.name="StudioToolError"}status}async function u(o,r,s){const t=await fetch(`/api/${encodeURIComponent(o)}/tools/${encodeURIComponent(r)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s??{})});if(!t.ok){let e=`${r} failed (${t.status})`;try{const n=await t.json();n?.error&&(e=n.error)}catch{}throw new l(e,t.status)}return await t.json()}function p(){const o=i.c(5),{org:r}=c(),s=r.slug;let t;o[0]!==s?(t=(n,a)=>u(s,n,a),o[0]=s,o[1]=t):t=o[1];let e;return o[2]!==s||o[3]!==t?(e={orgSlug:s,call:t},o[2]=s,o[3]=t,o[4]=e):e=o[4],e}export{u as c,p as u};
@@ -1 +0,0 @@
1
- import{r as c,j as i,P as C,V as y,_ as B,M as I,bH as M,bG as H,T as z,e as A,c as g}from"./index-EQfvflqN.js";var m="Switch",[U]=z(m),[q,L]=U(m),P=c.forwardRef((a,e)=>{const{__scopeSwitch:t,name:r,checked:s,defaultChecked:n,required:o,disabled:d,value:u="on",onCheckedChange:k,form:l,...w}=a,[p,h]=c.useState(null),v=y(e,b=>h(b)),x=c.useRef(!1),S=p?l||!!p.closest("form"):!0,[f,N]=B({prop:s,defaultProp:n??!1,onChange:k,caller:m});return i.jsxs(q,{scope:t,checked:f,disabled:d,children:[i.jsx(C.button,{type:"button",role:"switch","aria-checked":f,"aria-required":o,"data-state":j(f),"data-disabled":d?"":void 0,disabled:d,value:u,...w,ref:v,onClick:I(a.onClick,b=>{N(T=>!T),S&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),S&&i.jsx(R,{control:p,bubbles:!x.current,name:r,value:u,checked:f,required:o,disabled:d,form:l,style:{transform:"translateX(-100%)"}})]})});P.displayName=m;var E="SwitchThumb",_=c.forwardRef((a,e)=>{const{__scopeSwitch:t,...r}=a,s=L(E,t);return i.jsx(C.span,{"data-state":j(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});_.displayName=E;var O="SwitchBubbleInput",R=c.forwardRef(({__scopeSwitch:a,control:e,checked:t,bubbles:r=!0,...s},n)=>{const o=c.useRef(null),d=y(o,n),u=M(t),k=H(e);return c.useEffect(()=>{const l=o.current;if(!l)return;const w=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(w,"checked").set;if(u!==t&&h){const v=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(v)}},[u,t,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...s,tabIndex:-1,ref:d,style:{...s.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});R.displayName=O;function j(a){return a?"checked":"unchecked"}var $=P,D=_;function G(a){const e=A.c(9);let t,r;e[0]!==a?({className:t,...r}=a,e[0]=a,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let s;e[3]!==t?(s=g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/20 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[2px] disabled:opacity-50",t),e[3]=t,e[4]=s):s=e[4];let n;e[5]===Symbol.for("react.memo_cache_sentinel")?(n=i.jsx(D,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}),e[5]=n):n=e[5];let o;return e[6]!==r||e[7]!==s?(o=i.jsx($,{"data-slot":"switch",className:s,...r,children:n}),e[6]=r,e[7]=s,e[8]=o):o=e[8],o}export{G as S};
@@ -1 +0,0 @@
1
- import{e as c,c as i,j as r}from"./index-EQfvflqN.js";function d(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("w-full caption-bottom text-sm min-w-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("div",{"data-slot":"table-container",className:"w-full min-w-0 bg-card rounded-xl card-shadow overflow-hidden",children:r.jsx("table",{"data-slot":"table",className:s,...l})}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function f(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("[&_tr]:border-b sticky top-0 z-10 bg-card",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("thead",{"data-slot":"table-header",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function b(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("[&_tr:last-child]:border-0",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("tbody",{"data-slot":"table-body",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function p(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("data-[state=selected]:bg-muted border-b transition-colors",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("tr",{"data-slot":"table-row",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function m(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("th",{"data-slot":"table-head",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}function x(o){const e=c.c(8);let t,l;e[0]!==o?({className:t,...l}=o,e[0]=o,e[1]=t,e[2]=l):(t=e[1],l=e[2]);let s;e[3]!==t?(s=i("p-2 align-middle whitespace-nowrap text-sm [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),e[3]=t,e[4]=s):s=e[4];let a;return e[5]!==l||e[6]!==s?(a=r.jsx("td",{"data-slot":"table-cell",className:s,...l}),e[5]=l,e[6]=s,e[7]=a):a=e[7],a}export{x as T,p as a,b,d as c,f as d,m as e};
@@ -1 +0,0 @@
1
- import{e as o,c as l,j as n}from"./index-EQfvflqN.js";function c(s){const e=o.c(8);let i,r;e[0]!==s?({className:i,...r}=s,e[0]=s,e[1]=i,e[2]=r):(i=e[1],r=e[2]);let t;e[3]!==i?(t=l("placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/20 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex field-sizing-content min-h-16 w-full rounded-xl bg-background dark:bg-input/30 px-3 py-2 text-sm transition-[color,box-shadow] outline-none focus-visible:ring-[2px] card-shadow disabled:cursor-not-allowed disabled:opacity-50",i),e[3]=i,e[4]=t):t=e[4];let a;return e[5]!==r||e[6]!==t?(a=n.jsx("textarea",{"data-slot":"textarea",className:t,...r}),e[5]=r,e[6]=t,e[7]=a):a=e[7],a}export{c as T};
@@ -1 +0,0 @@
1
- import{r as a,j as c,P as H,ai as Z,_ as ee,$ as te,V as $,J as oe,M as C,U as G,Z as re,Q as V,W as ne,X as se,T as ae,dB as ie,Y as le,e as _,c as ce}from"./index-EQfvflqN.js";var ue=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),de="VisuallyHidden",B=a.forwardRef((o,e)=>c.jsx(H.span,{...o,ref:e,style:{...ue,...o.style}}));B.displayName=de;var pe=B,[O]=ae("Tooltip",[V]),D=V(),z="TooltipProvider",fe=700,A="tooltip.open",[ve,k]=O(z),F=o=>{const{__scopeTooltip:e,delayDuration:t=fe,skipDelayDuration:r=300,disableHoverableContent:n=!1,children:s}=o,i=a.useRef(!0),d=a.useRef(!1),l=a.useRef(0);return a.useEffect(()=>{const p=l.current;return()=>window.clearTimeout(p)},[]),c.jsx(ve,{scope:e,isOpenDelayedRef:i,delayDuration:t,onOpen:a.useCallback(()=>{window.clearTimeout(l.current),i.current=!1},[]),onClose:a.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:d,onPointerInTransitChange:a.useCallback(p=>{d.current=p},[]),disableHoverableContent:n,children:s})};F.displayName=z;var R="Tooltip",[he,j]=O(R),Y=o=>{const{__scopeTooltip:e,children:t,open:r,defaultOpen:n,onOpenChange:s,disableHoverableContent:i,delayDuration:d}=o,l=k(R,o.__scopeTooltip),p=D(e),[u,v]=a.useState(null),h=Z(),f=a.useRef(0),x=i??l.disableHoverableContent,m=d??l.delayDuration,g=a.useRef(!1),[y,T]=ee({prop:r,defaultProp:n??!1,onChange:S=>{S?(l.onOpen(),document.dispatchEvent(new CustomEvent(A))):l.onClose(),s?.(S)},caller:R}),w=a.useMemo(()=>y?g.current?"delayed-open":"instant-open":"closed",[y]),E=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,g.current=!1,T(!0)},[T]),P=a.useCallback(()=>{window.clearTimeout(f.current),f.current=0,T(!1)},[T]),N=a.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{g.current=!0,T(!0),f.current=0},m)},[m,T]);return a.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),c.jsx(te,{...p,children:c.jsx(he,{scope:e,contentId:h,open:y,stateAttribute:w,trigger:u,onTriggerChange:v,onTriggerEnter:a.useCallback(()=>{l.isOpenDelayedRef.current?N():E()},[l.isOpenDelayedRef,N,E]),onTriggerLeave:a.useCallback(()=>{x?P():(window.clearTimeout(f.current),f.current=0)},[P,x]),onOpen:E,onClose:P,disableHoverableContent:x,children:t})})};Y.displayName=R;var M="TooltipTrigger",U=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=j(M,t),s=k(M,t),i=D(t),d=a.useRef(null),l=$(e,d,n.onTriggerChange),p=a.useRef(!1),u=a.useRef(!1),v=a.useCallback(()=>p.current=!1,[]);return a.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),c.jsx(oe,{asChild:!0,...i,children:c.jsx(H.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...r,ref:l,onPointerMove:C(o.onPointerMove,h=>{h.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:C(o.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:C(o.onPointerDown,()=>{n.open&&n.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:C(o.onFocus,()=>{p.current||n.onOpen()}),onBlur:C(o.onBlur,n.onClose),onClick:C(o.onClick,n.onClose)})})});U.displayName=M;var I="TooltipPortal",[xe,ge]=O(I,{forceMount:void 0}),W=o=>{const{__scopeTooltip:e,forceMount:t,children:r,container:n}=o,s=j(I,e);return c.jsx(xe,{scope:e,forceMount:t,children:c.jsx(G,{present:t||s.open,children:c.jsx(re,{asChild:!0,container:n,children:r})})})};W.displayName=I;var b="TooltipContent",q=a.forwardRef((o,e)=>{const t=ge(b,o.__scopeTooltip),{forceMount:r=t.forceMount,side:n="top",...s}=o,i=j(b,o.__scopeTooltip);return c.jsx(G,{present:r||i.open,children:i.disableHoverableContent?c.jsx(X,{side:n,...s,ref:e}):c.jsx(me,{side:n,...s,ref:e})})}),me=a.forwardRef((o,e)=>{const t=j(b,o.__scopeTooltip),r=k(b,o.__scopeTooltip),n=a.useRef(null),s=$(e,n),[i,d]=a.useState(null),{trigger:l,onClose:p}=t,u=n.current,{onPointerInTransitChange:v}=r,h=a.useCallback(()=>{d(null),v(!1)},[v]),f=a.useCallback((x,m)=>{const g=x.currentTarget,y={x:x.clientX,y:x.clientY},T=be(y,g.getBoundingClientRect()),w=we(y,T),E=Ee(m.getBoundingClientRect()),P=Re([...w,...E]);d(P),v(!0)},[v]);return a.useEffect(()=>()=>h(),[h]),a.useEffect(()=>{if(l&&u){const x=g=>f(g,u),m=g=>f(g,l);return l.addEventListener("pointerleave",x),u.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",x),u.removeEventListener("pointerleave",m)}}},[l,u,f,h]),a.useEffect(()=>{if(i){const x=m=>{const g=m.target,y={x:m.clientX,y:m.clientY},T=l?.contains(g)||u?.contains(g),w=!Pe(y,i);T?h():w&&(h(),p())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[l,u,i,p,h]),c.jsx(X,{...o,ref:s})}),[Te,ye]=O(R,{isInside:!1}),Ce=ie("TooltipContent"),X=a.forwardRef((o,e)=>{const{__scopeTooltip:t,children:r,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:i,...d}=o,l=j(b,t),p=D(t),{onClose:u}=l;return a.useEffect(()=>(document.addEventListener(A,u),()=>document.removeEventListener(A,u)),[u]),a.useEffect(()=>{if(l.trigger){const v=h=>{h.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[l.trigger,u]),c.jsx(ne,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:v=>v.preventDefault(),onDismiss:u,children:c.jsxs(se,{"data-state":l.stateAttribute,...p,...d,ref:e,style:{...d.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[c.jsx(Ce,{children:r}),c.jsx(Te,{scope:t,isInside:!0,children:c.jsx(pe,{id:l.contentId,role:"tooltip",children:n||r})})]})})});q.displayName=b;var K="TooltipArrow",J=a.forwardRef((o,e)=>{const{__scopeTooltip:t,...r}=o,n=D(t);return ye(K,t).isInside?null:c.jsx(le,{...n,...r,ref:e})});J.displayName=K;function be(o,e){const t=Math.abs(e.top-o.y),r=Math.abs(e.bottom-o.y),n=Math.abs(e.right-o.x),s=Math.abs(e.left-o.x);switch(Math.min(t,r,n,s)){case s:return"left";case n:return"right";case t:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function we(o,e,t=5){const r=[];switch(e){case"top":r.push({x:o.x-t,y:o.y+t},{x:o.x+t,y:o.y+t});break;case"bottom":r.push({x:o.x-t,y:o.y-t},{x:o.x+t,y:o.y-t});break;case"left":r.push({x:o.x+t,y:o.y-t},{x:o.x+t,y:o.y+t});break;case"right":r.push({x:o.x-t,y:o.y-t},{x:o.x-t,y:o.y+t});break}return r}function Ee(o){const{top:e,right:t,bottom:r,left:n}=o;return[{x:n,y:e},{x:t,y:e},{x:t,y:r},{x:n,y:r}]}function Pe(o,e){const{x:t,y:r}=o;let n=!1;for(let s=0,i=e.length-1;s<e.length;i=s++){const d=e[s],l=e[i],p=d.x,u=d.y,v=l.x,h=l.y;u>r!=h>r&&t<(v-p)*(r-u)/(h-u)+p&&(n=!n)}return n}function Re(o){const e=o.slice();return e.sort((t,r)=>t.x<r.x?-1:t.x>r.x?1:t.y<r.y?-1:t.y>r.y?1:0),_e(e)}function _e(o){if(o.length<=1)return o.slice();const e=[];for(let r=0;r<o.length;r++){const n=o[r];for(;e.length>=2;){const s=e[e.length-1],i=e[e.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))e.pop();else break}e.push(n)}e.pop();const t=[];for(let r=o.length-1;r>=0;r--){const n=o[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))t.pop();else break}t.push(n)}return t.pop(),e.length===1&&t.length===1&&e[0].x===t[0].x&&e[0].y===t[0].y?e:e.concat(t)}var je=F,Oe=Y,De=U,Le=W,Ae=q,Me=J;const Q=768,L=()=>globalThis.innerWidth<Q;function Ne(){const o=_.c(2),[e,t]=a.useState(L);let r,n;return o[0]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{const s=()=>t(L),i=globalThis.matchMedia(`(max-width: ${Q-1}px)`);return i.addEventListener("change",s),t(L),()=>i.removeEventListener("change",s)},n=[],o[0]=r,o[1]=n):(r=o[0],n=o[1]),a.useEffect(r,n),e}function ke(o){const e=_.c(6);let t,r;e[0]!==o?({delayDuration:r,...t}=o,e[0]=o,e[1]=t,e[2]=r):(t=e[1],r=e[2]);const n=r===void 0?0:r;let s;return e[3]!==n||e[4]!==t?(s=c.jsx(je,{"data-slot":"tooltip-provider",delayDuration:n,...t}),e[3]=n,e[4]=t,e[5]=s):s=e[5],s}function Se(o){const e=_.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(ke,{children:c.jsx(Oe,{"data-slot":"tooltip",...t})}),e[2]=t,e[3]=r):r=e[3],r}function He(o){const e=_.c(4);let t;e[0]!==o?({...t}=o,e[0]=o,e[1]=t):t=e[1];let r;return e[2]!==t?(r=c.jsx(De,{"data-slot":"tooltip-trigger",...t}),e[2]=t,e[3]=r):r=e[3],r}function $e(o){const e=_.c(13);let t,r,n,s;e[0]!==o?({className:r,sideOffset:s,children:t,...n}=o,e[0]=o,e[1]=t,e[2]=r,e[3]=n,e[4]=s):(t=e[1],r=e[2],n=e[3],s=e[4]);const i=s===void 0?0:s;let d;e[5]!==r?(d=ce("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",r),e[5]=r,e[6]=d):d=e[6];let l;e[7]===Symbol.for("react.memo_cache_sentinel")?(l=c.jsx(Me,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"}),e[7]=l):l=e[7];let p;return e[8]!==t||e[9]!==n||e[10]!==i||e[11]!==d?(p=c.jsx(Le,{children:c.jsxs(Ae,{"data-slot":"tooltip-content",sideOffset:i,className:d,...n,children:[t,l]})}),e[8]=t,e[9]=n,e[10]=i,e[11]=d,e[12]=p):p=e[12],p}export{He as T,ue as V,$e as a,Se as b,ke as c,Ne as u};
@@ -1 +0,0 @@
1
- import{e as u,p as m,m as g,K as p}from"./index-EQfvflqN.js";const b=new Set(["owner","admin"]);function d(){const e=u.c(11),{org:r,locator:c}=m();let o;e[0]!==c?(o=p.myCapabilities(c),e[0]=c,e[1]=o):o=e[1];let a;e[2]!==r?(a=async()=>{const f=await fetch(`/api/auth/custom/my-capabilities/${encodeURIComponent(r.slug)}`,{credentials:"include"});if(!f.ok)throw new Error(`my-capabilities request failed: ${f.status}`);return await f.json()},e[2]=r,e[3]=a):a=e[3];let i;e[4]!==o||e[5]!==a?(i={queryKey:o,queryFn:a,staleTime:3e4,retry:2},e[4]=o,e[5]=a,e[6]=i):i=e[6];const{data:s,isLoading:l,isError:n}=g(i);let t;return e[7]!==s||e[8]!==n||e[9]!==l?(t={data:s,loading:l,error:n},e[7]=s,e[8]=n,e[9]=l,e[10]=t):t=e[10],t}function _(e){const r=u.c(8),{data:c,loading:o,error:a}=d();if(o){let t;return r[0]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!0,error:!1,reason:"loading"},r[0]=t):t=r[0],t}if(a){let t;return r[1]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!0,reason:"error"},r[1]=t):t=r[1],t}const i=c?.role??null;if(!i){let t;return r[2]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!1,loading:!1,error:!1,reason:"denied"},r[2]=t):t=r[2],t}if(i==="owner"){let t;return r[3]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"owner"},r[3]=t):t=r[3],t}if(i==="admin"){let t;return r[4]===Symbol.for("react.memo_cache_sentinel")?(t={granted:!0,loading:!1,error:!1,reason:"admin"},r[4]=t):t=r[4],t}const s=c?.capabilities?.[e]===!0,l=s?"role":"denied";let n;return r[5]!==s||r[6]!==l?(n={granted:s,loading:!1,error:!1,reason:l},r[5]=s,r[6]=l,r[7]=n):n=r[7],n}function S(){const e=u.c(10),{data:r,loading:c,error:o}=d(),a=r?.role??void 0;let i;e[0]!==a?(i=a?b.has(a):!1,e[0]=a,e[1]=i):i=e[1];const s=i;let l;e[2]!==r?.capabilities?(l=r?.capabilities??{},e[2]=r?.capabilities,e[3]=l):l=e[3];const n=l;let t;return e[4]!==o||e[5]!==s||e[6]!==c||e[7]!==a||e[8]!==n?(t={capabilities:n,loading:c,error:o,isPrivileged:s,roleSlug:a},e[4]=o,e[5]=s,e[6]=c,e[7]=a,e[8]=n,e[9]=t):t=e[9],t}export{S as a,_ as u};
@@ -1 +0,0 @@
1
- import{e as f,p as C}from"./index-EQfvflqN.js";import{a as N,b as O,u as S}from"./use-collections-BpjfU7Qz.js";import{S as I,u as p}from"./use-mcp-client-Dlrc-MQT.js";function E(t){const o=f.c(20);let i;o[0]!==t?(i=t===void 0?{}:t,o[0]=t,o[1]=i):i=o[1];const n=i;let l,s,c,d;o[2]!==n?({binding:l,includeVirtual:c,slug:d,...s}=n,o[2]=n,o[3]=l,o[4]=s,o[5]=c,o[6]=d):(l=o[3],s=o[4],c=o[5],d=o[6]);let e;o[7]!==l||o[8]!==s.additionalToolArgs||o[9]!==c||o[10]!==d?(e={...s.additionalToolArgs},l!==void 0&&(e.binding=l),c!==void 0&&(e.include_virtual=c),d!==void 0&&(e.slug=d),o[7]=l,o[8]=s.additionalToolArgs,o[9]=c,o[10]=d,o[11]=e):e=o[11];let r;o[12]!==e?(r=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=r):r=o[13];let g;o[14]!==s||o[15]!==r?(g={...s,additionalToolArgs:r},o[14]=s,o[15]=r,o[16]=g):g=o[16];const m=g,{org:u}=C();let a;o[17]!==u.id||o[18]!==u.slug?(a={connectionId:I,orgId:u.id,orgSlug:u.slug},o[17]=u.id,o[18]=u.slug,o[19]=a):a=o[19];const A=p(a);return O(u.id,"CONNECTIONS",A,m)}function _(t){const o=f.c(3),{org:i}=C();let n;o[0]!==i.id||o[1]!==i.slug?(n={connectionId:I,orgId:i.id,orgSlug:i.slug},o[0]=i.id,o[1]=i.slug,o[2]=n):n=o[2];const l=p(n);return S(i.id,"CONNECTIONS",t,l)}function x(){const t=f.c(3),{org:o}=C();let i;t[0]!==o.id||t[1]!==o.slug?(i={connectionId:I,orgId:o.id,orgSlug:o.slug},t[0]=o.id,t[1]=o.slug,t[2]=i):i=t[2];const n=p(i);return N(o.id,"CONNECTIONS",n)}export{_ as a,x as b,E as u};
@@ -1 +0,0 @@
1
- import{e as c,r as n}from"./index-EQfvflqN.js";function p(){const e=c.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async i=>{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),2e3)},e[0]=t):t=e[0];const r=t;let o;return e[1]!==s?(o={handleCopy:r,copied:s},e[1]=s,e[2]=o):o=e[2],o}export{p as u};
@@ -1 +0,0 @@
1
- import{e as g}from"./index-EQfvflqN.js";import{b as f}from"./use-virtual-mcp-isKQVwa1.js";import{m}from"./use-navigate-to-agent-YIuMJGpH.js";function A(i){const e=g.c(9);let n;e[0]!==i?(n=i===void 0?{}:i,e[0]=i,e[1]=n):n=e[1];const d=n,{navigateOnCreate:u}=d,r=u===void 0?!1:u,t=f(),c=m();let s;e[2]!==t.create||e[3]!==r||e[4]!==c?(s=async()=>{const l=await t.create.mutateAsync({title:"New Agent",description:"AI-driven assistant designed to handle specific tasks",status:"active",connections:[],pinned:!1});return r&&c(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=r,e[4]=c,e[5]=s):s=e[5];const o=s;let a;return e[6]!==t.create.isPending||e[7]!==o?(a={createVirtualMCP:o,isCreating:t.create.isPending},e[6]=t.create.isPending,e[7]=o,e[8]=a):a=e[8],a}export{A as u};
@@ -1 +0,0 @@
1
- import{p as Se,b as en,u as un,x as pn,w as mn,j as e,B as Y,n as X,r as le,F as hn,f as fn,l as ke,t as N,K as me,e as gn,o as xn,a2 as jn,c as yn,m as vn}from"./index-EQfvflqN.js";import{g as _n}from"./connection-slug-eyAPH6o3.js";import{u as nn,a as tn,g as Cn,C as Le}from"./connection-card-Cnc4pAuK.js";import{C as wn}from"./collection-search-DS6Qu-vl.js";import{C as bn}from"./collection-tabs-Ck6BuvIC.js";import{g as kn,a as Nn,e as Sn,b as In}from"./extract-connection-data-BVb7kACV.js";import{d as on,c as sn,D as an,a as cn,b as An,e as Tn}from"./dialog-45S14PiE.js";import{D as Dn,a as Pn,c as Fn,b as On,d as Mn,e as Vn,f as $n}from"./drawer-BdP8u_Wg.js";import{u as En,b as Be,T as Re,a as ze}from"./tooltip-DZelUdM0.js";import{F as V,b as $,c as E,d as L,f as B,a as Qe}from"./form-DeXV6ZbR.js";import{I as J}from"./input-DSpuivwc.js";import{d as Ln,b as Bn,c as Rn,S as zn,a as pe}from"./select-Cr8ncrzb.js";import{T as Hn}from"./textarea-DaCUK96G.js";import{b as rn}from"./use-connection-DgGg0YyB.js";import{n as Ne,c as He}from"./XCircle-qby-IxK9.js";import{s as Ke}from"./Star01-c7vPYDwm.js";import{Z as Kn}from"./agent-icon-CBTaU_uB.js";import{s as Un}from"./XClose-CjsCyYq1.js";import{c as Xn,i as we,a as We,E as qn,p as Gn,b as Qn,d as Wn}from"./connection-form-helpers-BWYI6_re.js";import{u as Je}from"./use-infinite-scroll-BvUO_UAz.js";import{u as Jn}from"./useSuspenseInfiniteQuery-CFjEx0xH.js";import{S as Yn,u as Zn}from"./use-mcp-client-Dlrc-MQT.js";import{i as Ue,a as Xe}from"./mcp-oauth-B7WMtt2U.js";import{B as be}from"./badge-r4de0kry.js";import{i as Ye}from"./ChevronUp-ByHCMSz5.js";import{s as et}from"./Plus-BotD1zxJ.js";import{u as nt}from"./studio-tools-CcZtrETh.js";import{u as tt}from"./use-ai-providers-DG2JQjs-.js";function ot(o){const n=o?.metadata?.githubRepo;return n?n.connectionId?o?.connections?.some(f=>f.connection_id===n.connectionId)?n:null:n:null}function zt(o){if(typeof o!="object"||o===null)return!1;const h=o.githubRepo?.url;return typeof h=="string"&&h.length>0}function st(o){return!!ot(o??null)?.connectionId}function Ht(o){return st(o)}function Kt(o){const n=new Set;for(const h of o??[]){const f=h.metadata?.liveAgentId;typeof f=="string"&&f&&n.add(h.id)}return n}function Ut(o){const n=new Map,h=new Map;for(const f of o??[]){const p=f.metadata?.liveAgentId;typeof p=="string"&&p&&(h.set(f.id,p),n.set(p,f.id))}return{liveToDev:n,devToLive:h}}function Xt(o,n){if(!o)return null;const h=o.metadata?.liveAgentId;if(typeof h=="string"&&h)return{mode:"dev",targetId:h};const f=(n??[]).find(p=>p.metadata?.liveAgentId===o.id);return f?{mode:"live",targetId:f.id}:null}function qt(o){return o.online?o.capabilities.includes("claude-code")||o.capabilities.includes("codex"):!1}function it({open:o,onOpenChange:n,onCreated:h}){const{org:f}=Se(),{data:p}=en.useSession(),{stdioEnabled:D}=un(),P=En(),R=rn(),d=nn(),z=tn(d,"").items,i=pn({resolver:mn(Xn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),y=i.watch("ui_type"),S=i.watch("connection_url"),M=i.watch("npx_package"),j=we({uiType:y,connectionUrl:S??"",npxPackage:M??""})??We({uiType:y,connectionUrl:S??"",registryItems:z}),l=s=>{const t=s.trim();if(!t)return;const c=!!i.formState.dirtyFields.title,v=!!i.formState.dirtyFields.description,_=!!i.formState.dirtyFields.env_vars,r=x=>{if(x&&(!c&&!i.getValues("title").trim()&&x.title&&i.setValue("title",x.title,{shouldDirty:!1}),!v&&!(i.getValues("description")??"").trim()&&x.description&&i.setValue("description",x.description,{shouldDirty:!1}),!_&&x.envVarKeys?.length)){const A=i.getValues("env_vars")??[],C=new Set(A.map(k=>k.key)),w=x.envVarKeys.filter(k=>!C.has(k));w.length>0&&i.setValue("env_vars",[...A,...w.map(k=>({key:k,value:""}))],{shouldDirty:!0})}},u=Gn(t);if(u&&D){i.setValue("ui_type","NPX",{shouldDirty:!0}),i.setValue("npx_package",u.packageName,{shouldDirty:!0}),i.setValue("connection_url","",{shouldDirty:!0}),i.setValue("connection_token",null,{shouldDirty:!0}),r(we({uiType:"NPX",npxPackage:u.packageName}));return}if(t.startsWith("http://")||t.startsWith("https://")){const x=y==="HTTP"||y==="SSE"||y==="Websocket"?y:"HTTP";i.setValue("ui_type",x,{shouldDirty:!0}),i.setValue("connection_url",t,{shouldDirty:!0}),r(we({uiType:x,connectionUrl:t})??We({uiType:x,connectionUrl:t,registryItems:z}));return}y==="NPX"&&r(we({uiType:"NPX",npxPackage:t}))},H=s=>{s||i.reset(),n(s)},g=async s=>{let t,c=null,v=null,_=null;s.ui_type==="NPX"?(t="STDIO",c="",_=Qn(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(t="STDIO",c="",_=Wn(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(t=s.ui_type,c=s.connection_url||"",v=s.connection_token||null);const r=kn("conn");try{await R.create.mutateAsync({id:r,title:s.title,description:s.description||null,connection_type:t,connection_url:c,connection_token:v,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:p?.user?.id||"system",organization_id:f.id,icon:s.icon??null,app_name:null,app_id:null,connection_headers:_,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),i.reset(),n(!1),h?.(r)}catch{X.error("Failed to create connection")}},F="Create Connection",I="Create a custom connection in your organization. Fill in the details below.",q=i.formState.isSubmitting?"Saving...":"Create Connection",K=e.jsxs("div",{className:"grid gap-4",children:[e.jsx(V,{control:i.control,name:"ui_type",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Type *"}),e.jsxs(Ln,{value:s.value,onValueChange:s.onChange,children:[e.jsx(L,{children:e.jsx(Bn,{children:e.jsx(Rn,{})})}),e.jsxs(zn,{children:[e.jsx(pe,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx(pe,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"w-4 h-4"}),"SSE"]})}),e.jsx(pe,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ke,{className:"w-4 h-4"}),"Websocket"]})}),D&&e.jsxs(e.Fragment,{children:[e.jsx(pe,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Ne,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx(pe,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(Kn,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(B,{})]})}),y==="NPX"&&e.jsx(V,{control:i.control,name:"npx_package",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"NPM Package *"}),e.jsx(L,{children:e.jsx(J,{placeholder:"@perplexity-ai/mcp-server",...s,value:s.value??"",onPaste:t=>{const c=t.clipboardData.getData("text");c&&(t.preventDefault(),i.setValue("npx_package",c.trim(),{shouldDirty:!0}),l(c))},onBlur:t=>{l(t.target.value),s.onBlur()}})}),e.jsx(B,{})]})}),y==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(V,{control:i.control,name:"stdio_command",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Command *"}),e.jsx(L,{children:e.jsx(J,{placeholder:"node, bun, python...",...s,value:s.value??""})}),e.jsx(B,{})]})}),e.jsx(V,{control:i.control,name:"stdio_args",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Arguments"}),e.jsx(L,{children:e.jsx(J,{placeholder:"arg1 arg2 --flag value",...s,value:s.value??""})}),e.jsx(B,{})]})})]}),e.jsx(V,{control:i.control,name:"stdio_cwd",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Working Directory"}),e.jsx(L,{children:e.jsx(J,{placeholder:"/path/to/project (optional)",...s,value:s.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(B,{})]})})]}),(y==="NPX"||y==="STDIO")&&e.jsx(V,{control:i.control,name:"env_vars",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Environment Variables"}),e.jsx(L,{children:e.jsx(qn,{value:s.value??[],onChange:s.onChange})}),e.jsx(B,{})]})}),y!=="NPX"&&y!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(V,{control:i.control,name:"connection_url",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"URL *"}),e.jsx(L,{children:e.jsx(J,{placeholder:"https://example.com/mcp",...s,value:s.value??"",onPaste:t=>{const c=t.clipboardData.getData("text");c&&(t.preventDefault(),i.setValue("connection_url",c.trim(),{shouldDirty:!0}),l(c))},onBlur:t=>{l(t.target.value),s.onBlur()}})}),e.jsx(B,{})]})}),e.jsx(V,{control:i.control,name:"connection_token",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:j?.token?.label??"Token (optional)"}),e.jsx(L,{children:e.jsx(J,{type:"password",placeholder:j?.token?.placeholder??"Bearer token or API key",className:"ph-no-capture",...s,value:s.value??""})}),j?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.token.helperText,j.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.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"})]})]}),e.jsx(B,{})]})})]}),e.jsx(V,{control:i.control,name:"title",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Name *"}),e.jsx(L,{children:e.jsx(J,{placeholder:"My Connection",...s})}),e.jsx(B,{})]})}),e.jsx(V,{control:i.control,name:"description",render:({field:s})=>e.jsxs($,{children:[e.jsx(E,{children:"Description"}),e.jsx(L,{children:e.jsx(Hn,{placeholder:"A brief description of this connection",rows:3,...s,value:s.value??""})}),e.jsx(B,{})]})})]});return P?e.jsx(Dn,{open:o,onOpenChange:H,children:e.jsxs(Pn,{className:"max-h-[90vh]",children:[e.jsx(Fn,{className:"pb-2",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx(On,{children:F}),e.jsx(Mn,{className:"mt-1",children:I})]}),e.jsx(Vn,{asChild:!0,children:e.jsx(Y,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:e.jsx(Un,{size:16})})})]})}),e.jsx(Qe,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(g),children:[e.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:K}),e.jsx($n,{children:e.jsx(Y,{type:"submit",disabled:i.formState.isSubmitting,className:"w-full",children:q})})]})})]})}):e.jsx(on,{open:o,onOpenChange:H,children:e.jsxs(sn,{className:"sm:max-w-[525px]",children:[e.jsxs(an,{children:[e.jsx(cn,{children:F}),e.jsx(An,{children:I})]}),e.jsx(Qe,{...i,children:e.jsxs("form",{onSubmit:i.handleSubmit(g),children:[e.jsx("div",{className:"py-4",children:K}),e.jsxs(Tn,{children:[e.jsx(Y,{type:"button",variant:"outline",onClick:()=>H(!1),children:"Cancel"}),e.jsx(Y,{type:"submit",disabled:i.formState.isSubmitting,className:"min-w-40",children:q})]})]})})]})})}function at(o){const n=gn.c(73),{mode:h,agentId:f,addedConnectionIds:p,onAdd:D,onCloneAndAdd:P,onConnectAndAdd:R,connectingItemId:d,search:b,onCreateConnection:z,onBrowseNavigate:i,defaultTab:y}=o,S=h===void 0?"add":h,M=y===void 0?"connected":y,{org:j}=Se(),l=le.useDeferredValue(b),H=b!==l,g=l.trim().toLowerCase();let F;n[0]!==M?(F=a=>a??M,n[0]=M,n[1]=F):F=n[1];const[I,q]=xn(jn.connectionsTab(j.slug)+(M==="all"?":home-modal":":agent-modal"),F);let K;n[2]!==I||n[3]!==q?(K=a=>{a!==I&&N("connections_dialog_tab_changed",{to_tab:a}),q(a)},n[2]=I,n[3]=q,n[4]=K):K=n[4];const s=K;let t;n[5]!==j.id||n[6]!==j.slug?(t={connectionId:Yn,orgId:j.id,orgSlug:j.slug},n[5]=j.id,n[6]=j.slug,n[7]=t):t=n[7];const c=Zn(t);let v,_,r;if(n[8]!==c||n[9]!==l||n[10]!==j.id){r=l?.trim()?{operator:"or",conditions:[{field:["title"],operator:"contains",value:l.trim()},{field:["description"],operator:"contains",value:l.trim()}]}:void 0;const a={...r&&{where:r},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},m=JSON.stringify(a);_=Jn,v=me.collectionListInfinite(c,j.id,"","CONNECTIONS",m),n[8]=c,n[9]=l,n[10]=j.id,n[11]=v,n[12]=_,n[13]=r}else v=n[11],_=n[12],r=n[13];let u;n[14]!==c||n[15]!==r?(u=async a=>{const{pageParam:m}=a,U=m===void 0?0:m;return(await c.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...r&&{where:r},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:U}})).structuredContent},n[14]=c,n[15]=r,n[16]=u):u=n[16];let x;n[17]!==v||n[18]!==u?(x={queryKey:v,queryFn:u,initialPageParam:0,getNextPageParam:pt,staleTime:3e4},n[17]=v,n[18]=u,n[19]=x):x=n[19];const{data:A,fetchNextPage:C,hasNextPage:w,isFetchingNextPage:k}=_(x),Ie=A?.pages.flatMap(ut)??[],he=Cn(Ie),ln=new Set(Ie.filter(dt).map(lt)),fe=nn(),Q=tn(fe,l),Ae=Je(Q.loadMore,Q.hasMore,Q.isLoadingMore),Te=Je(C,w??!1,k),O=I==="all"||!!g,qe=O?Q.items.filter(a=>{const m=Nn(a);if(m&&ln.has(m))return!1;if(!g)return!0;const U=a._meta?.["mcp.mesh"];return[a.title,a.description,a.name,a.server?.title,a.server?.description,a.server?.name,U?.friendly_name,U?.friendlyName].filter(Boolean).join(" ").toLowerCase().includes(g)}):[],de=qe.filter(rt),ue=qe.filter(ct);let ge;n[20]!==p?(ge=a=>a.some(m=>p.has(m.id)),n[20]=p,n[21]=ge):ge=n[21];const De=ge;let xe;n[22]!==p||n[23]!==f||n[24]!==d||n[25]!==De||n[26]!==S||n[27]!==D||n[28]!==i||n[29]!==P?(xe=(a,m,U,ce,G)=>{const Ce=De(G),re=G.find(W=>!p.has(W.id)),T=G[0];if(S==="browse"){const W=_n(T);return e.jsx(Le,{connection:{title:m,icon:U,description:G.length>1?`${G.length} instances`:ce??void 0},fallbackIcon:e.jsx(Ne,{}),headerActionsAlwaysVisible:!0,headerActions:e.jsxs(be,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[e.jsx(Ye,{size:11})," Connected"]}),onClick:()=>{N("connection_browse_clicked",{app_name:T.app_name??null,connection_id:T.id,instances_count:G.length}),i?.(W)}},a)}return e.jsx(Le,{connection:{title:m,icon:U,description:ce},fallbackIcon:e.jsx(Ne,{}),headerActionsAlwaysVisible:!0,headerActions:e.jsxs("div",{className:"flex items-center gap-1.5",children:[Ce&&e.jsxs(be,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[e.jsx(Ye,{size:11})," Added"]}),e.jsx(Y,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:d!==null,onClick:W=>{W.stopPropagation(),re?(N("connection_add_clicked",{action:"use_existing",app_name:T.app_name??null,connection_id:re.id}),f&&N("agent_connection_attached",{agent_id:f,connection_id:re.id,app_name:T.app_name??null,mode:"existing"}),D(re.id)):(N("connection_add_clicked",{action:"clone",app_name:T.app_name??null,base_connection_id:T.id}),P(T))},children:"Add"})]})},a)},n[22]=p,n[23]=f,n[24]=d,n[25]=De,n[26]=S,n[27]=D,n[28]=i,n[29]=P,n[30]=xe):xe=n[30];const je=xe;let ye;n[31]!==d||n[32]!==S||n[33]!==R?(ye=a=>{const m=a._meta?.["mcp.mesh"],U=m?.friendlyName||m?.friendly_name||a.server?.title||a.title||a.server?.name||a.name||a.id||"",ce=a.server?.description||a.description||null,G=a.server?.icons?.[0]?.src||In(a.server?.repository)||null,Ce=m?.official===!0,re=m?.verified===!0,T=m?.owner==="deco";return e.jsx(Le,{connection:{title:U,description:ce,icon:G},fallbackIcon:e.jsx(Ne,{}),headerActionsAlwaysVisible:!0,headerActions:e.jsxs("div",{className:"flex items-center gap-1.5",children:[T&&e.jsxs(Be,{children:[e.jsx(Re,{asChild:!0,children:e.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:e.jsx("img",{src:"/logos/deco logo.svg",alt:"Made by Deco",className:"size-3"})})}),e.jsx(ze,{children:"Built and maintained by Deco"})]}),!T&&Ce&&e.jsxs(Be,{children:[e.jsx(Re,{asChild:!0,children:e.jsx(be,{variant:"outline",size:"icon",children:e.jsx(He,{})})}),e.jsx(ze,{children:"Built and maintained by the official vendor"})]}),!T&&!Ce&&re&&e.jsxs(Be,{children:[e.jsx(Re,{asChild:!0,children:e.jsx(be,{variant:"outline",size:"icon",children:e.jsx(He,{})})}),e.jsx(ze,{children:"Verified by the Deco team"})]}),e.jsx(Y,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:d!==null,onClick:W=>{W.stopPropagation(),N("connection_add_clicked",{action:"connect_new",registry_item_id:a.id,app_name:m?.friendlyName||a.server?.name||a.name||null}),R(a)},children:d===a.id?e.jsx(ke,{size:14,className:"animate-spin"}):S==="browse"?"Connect":"Add"})]})},`catalog-${a.id}`)},n[31]=d,n[32]=S,n[33]=R,n[34]=ye):ye=n[34];const Ge=ye,Pe=!g&&e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[e.jsx(bn,{tabs:[{id:"all",label:"All"},{id:"connected",label:"Connected"}],activeTab:I,onTabChange:a=>s(a)}),e.jsxs(Y,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{N("connections_dialog_custom_clicked"),z()},children:[e.jsx(et,{size:12}),"Custom Connection"]})]}),Fe=H&&"opacity-50 pointer-events-none";let Z;n[35]!==Fe?(Z=yn("flex-1 overflow-auto p-5 transition-opacity duration-150",Fe),n[35]=Fe,n[36]=Z):Z=n[36];const dn="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ve;n[37]!==je?(ve=a=>{if(a.type==="group")return je(a.key,a.title,a.icon,null,a.connections);const m=a.connection;return je(m.id,m.title,m.icon,m.description??null,[m])},n[37]=je,n[38]=ve):ve=n[38];const Oe=he.map(ve);let ee;n[39]!==Te?(ee=e.jsx("div",{ref:Te,className:"col-span-full h-1"}),n[39]=Te,n[40]=ee):ee=n[40];let ne;n[41]!==k?(ne=k&&e.jsx("div",{className:"col-span-full flex justify-center py-6",children:e.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),n[41]=k,n[42]=ne):ne=n[42];const Me=O&&de.length>0&&e.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[e.jsx(He,{size:13,className:"text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"Verified"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ve=O&&de.map(Ge),$e=O&&ue.length>0&&e.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:"All connections"}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),Ee=O&&ue.map(Ge);let te;n[43]!==Ae||n[44]!==fe||n[45]!==O?(te=O&&fe.length>0&&e.jsx("div",{ref:Ae,className:"col-span-full h-1"}),n[43]=Ae,n[44]=fe,n[45]=O,n[46]=te):te=n[46];let oe;n[47]!==Q.isLoadingMore||n[48]!==O?(oe=O&&Q.isLoadingMore&&e.jsx("div",{className:"col-span-full flex justify-center py-6",children:e.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),n[47]=Q.isLoadingMore,n[48]=O,n[49]=oe):oe=n[49];let se;n[50]!==Oe||n[51]!==ee||n[52]!==ne||n[53]!==Me||n[54]!==Ve||n[55]!==$e||n[56]!==Ee||n[57]!==te||n[58]!==oe?(se=e.jsxs("div",{className:dn,children:[Oe,ee,ne,Me,Ve,$e,Ee,te,oe]}),n[50]=Oe,n[51]=ee,n[52]=ne,n[53]=Me,n[54]=Ve,n[55]=$e,n[56]=Ee,n[57]=te,n[58]=oe,n[59]=se):se=n[59];let ie;n[60]!==I||n[61]!==he.length||n[62]!==ue||n[63]!==b||n[64]!==de?(ie=he.length===0&&de.length===0&&ue.length===0&&e.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:b?`No connections match "${b}"`:I==="connected"?"No connections yet":"No connections available"}),n[60]=I,n[61]=he.length,n[62]=ue,n[63]=b,n[64]=de,n[65]=ie):ie=n[65];let ae;n[66]!==Z||n[67]!==se||n[68]!==ie?(ae=e.jsxs("div",{className:Z,children:[se,ie]}),n[66]=Z,n[67]=se,n[68]=ie,n[69]=ae):ae=n[69];let _e;return n[70]!==Pe||n[71]!==ae?(_e=e.jsxs(e.Fragment,{children:[Pe,ae]}),n[70]=Pe,n[71]=ae,n[72]=_e):_e=n[72],_e}function ct(o){return!o.verified&&!o._meta?.["mcp.mesh"]?.verified&&!o.meta?.verified}function rt(o){return o.verified||o._meta?.["mcp.mesh"]?.verified||o.meta?.verified}function lt(o){return o.app_name}function dt(o){return o.app_name}function ut(o){return o?.items??[]}function pt(o,n){if(o?.hasMore)return n.reduce(mt,0)}function mt(o,n){return o+(n?.items?.length??0)}function Gt({open:o,onOpenChange:n,defaultTab:h,initialSearch:f="",...p}){const D=p.mode??"add",P="agentId"in p?p.agentId:void 0,R="addedConnectionIds"in p?p.addedConnectionIds??new Set:new Set,d="onAdd"in p&&p.onAdd?p.onAdd:t=>{},b=(t,c,v)=>{P&&N("agent_connection_attached",{agent_id:P,connection_id:t,app_name:c,mode:v})},[z,i]=le.useState(null),[y,S]=le.useState(f),[M,j]=le.useState(!1),{org:l}=Se(),{data:H}=en.useSession(),g=rn(),F=hn(),I=fn(),q=t=>{n(!1),I({to:"/$org/settings/connections/$appSlug",params:{org:l.slug,appSlug:t}})},K=async t=>{i(t.app_name??t.id);try{const v=`${t.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,r=(await g.create.mutateAsync({title:v,description:t.description??null,connection_type:t.connection_type,connection_url:t.connection_url??null,connection_token:null,icon:t.icon??null,app_name:t.app_name??null,app_id:t.app_id??null,connection_headers:t.connection_headers??null})).id,u=new URL(`/api/${l.slug}/mcp/${r}`,window.location.origin),x=await Ue({url:u.href,token:null,orgId:l.id});if(x.supportsOAuth&&!x.isAuthenticated){const{token:A,tokenInfo:C,error:w}=await Xe({connectionId:r,orgSlug:l.slug,scope:"offline_access"});if(w||!A){N("connection_oauth_failed",{connection_id:r,flow:"clone",error:w??"no_token"}),X.error(`Authentication failed: ${w??"no token received"}`),await g.delete.mutateAsync(r);return}if(N("connection_oauth_succeeded",{connection_id:r,flow:"clone"}),C)try{(await fetch(`/api/${l.slug}/connections/${r}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:C.accessToken,refreshToken:C.refreshToken,expiresIn:C.expiresIn,scope:C.scope,clientId:C.clientId,clientSecret:C.clientSecret,tokenEndpoint:C.tokenEndpoint})})).ok?await g.update.mutateAsync({id:r,data:{}}):await g.update.mutateAsync({id:r,data:{connection_token:A}})}catch{await g.update.mutateAsync({id:r,data:{connection_token:A}})}else await g.update.mutateAsync({id:r,data:{connection_token:A}});await F.invalidateQueries({queryKey:me.isMCPAuthenticated(u.href,null)})}b(r,t.app_name??null,"clone"),d(r)}catch(c){console.error("Failed to add connection:",c),X.error("Failed to add connection")}finally{i(null)}},s=async t=>{if(!(!l||!H?.user?.id)){i(t.id);try{const c=Sn(t,l.id,H.user.id,{remoteIndex:0}),v=c.connection_type==="STDIO",_=!!c.connection_url,r=v&&c.connection_headers&&typeof c.connection_headers=="object"&&"command"in c.connection_headers;if(!_&&!r){X.error("This MCP Server cannot be connected: no connection method available"),i(null);return}const{id:u}=await g.create.mutateAsync(c),x=new URL(`/api/${l.slug}/mcp/${u}`,window.location.origin),A=await Ue({url:x.href,token:null,orgId:l.id});if(A.supportsOAuth&&!A.isAuthenticated){const{token:C,tokenInfo:w,error:k}=await Xe({connectionId:u,orgSlug:l.slug,scope:"offline_access"});if(k||!C){N("connection_oauth_failed",{connection_id:u,flow:"connect_new",error:k??"no_token"}),X.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${k??"no token received"})`}),b(u,c.app_name??null,"new"),d(u);return}if(N("connection_oauth_succeeded",{connection_id:u,flow:"connect_new"}),w)try{(await fetch(`/api/${l.slug}/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:w.accessToken,refreshToken:w.refreshToken,expiresIn:w.expiresIn,scope:w.scope,clientId:w.clientId,clientSecret:w.clientSecret,tokenEndpoint:w.tokenEndpoint})})).ok?await g.update.mutateAsync({id:u,data:{}}):await g.update.mutateAsync({id:u,data:{connection_token:C}})}catch{await g.update.mutateAsync({id:u,data:{connection_token:C}})}else await g.update.mutateAsync({id:u,data:{connection_token:C}});await F.invalidateQueries({queryKey:me.isMCPAuthenticated(x.href,null)}),X.success("Connected and authenticated")}else X.success("Connected");b(u,c.app_name??null,"new"),d(u)}catch(c){console.error("Failed to connect:",c),X.error("Failed to connect")}finally{i(null)}}};return e.jsxs(on,{open:o,onOpenChange:n,children:[e.jsxs(sn,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[e.jsx(an,{className:"px-6 pt-5 pb-0 shrink-0",children:e.jsx(cn,{className:"text-base font-semibold",children:D==="browse"?"Connections":"Add Connection"})}),e.jsx("div",{className:"pt-3 shrink-0",children:e.jsx(wn,{value:y,onChange:S,placeholder:"Search connections..."})}),e.jsx(le.Suspense,{fallback:e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),children:e.jsx(at,{mode:D,agentId:P,addedConnectionIds:R,onAdd:d,onCloneAndAdd:K,onConnectAndAdd:s,connectingItemId:z,search:y,onCreateConnection:()=>j(!0),onBrowseNavigate:q,defaultTab:h})})]}),e.jsx(it,{open:M,onOpenChange:j,onCreated:async t=>{j(!1);const c=new URL(`/api/${l.slug}/mcp/${t}`,window.location.origin),v=await Ue({url:c.href,token:null,orgId:l.id});if(v.supportsOAuth&&!v.isAuthenticated){const{token:_,tokenInfo:r,error:u}=await Xe({connectionId:t,orgSlug:l.slug,scope:"offline_access"});if(u||!_){N("connection_oauth_failed",{connection_id:t,flow:"custom_create",error:u??"no_token"}),X.warning("Couldn't sign in to this connection",{description:`It was added to your agent, but its sign-in setup looks off. You can try authenticating again later from the connection's settings. (${u??"no token received"})`}),b(t,null,"custom"),d(t),n(!1);return}if(N("connection_oauth_succeeded",{connection_id:t,flow:"custom_create"}),r)try{(await fetch(`/api/${l.slug}/connections/${t}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:r.accessToken,refreshToken:r.refreshToken,expiresIn:r.expiresIn,scope:r.scope,clientId:r.clientId,clientSecret:r.clientSecret,tokenEndpoint:r.tokenEndpoint})})).ok?await g.update.mutateAsync({id:t,data:{}}):await g.update.mutateAsync({id:t,data:{connection_token:_}})}catch{await g.update.mutateAsync({id:t,data:{connection_token:_}})}else await g.update.mutateAsync({id:t,data:{connection_token:_}});await F.invalidateQueries({queryKey:me.isMCPAuthenticated(c.href,null)})}b(t,null,"custom"),d(t),n(!1)}})]})}const Ze=new Map;function Qt(){const{org:o}=Se(),n=nt(),h=tt(),f=h.find(l=>l.providerId==="deco"),{data:p,isLoading:D,refetch:P,isFetching:R}=vn({queryKey:me.aiProviderCredits(o.id,"deco"),enabled:!!f,staleTime:6e4,queryFn:async()=>{try{return await n.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),d=p?.balanceCents??null,b=d!=null?d/100:null,z=le.useRef(new Map);if(d!=null){const l=Ze.get(o.id);z.current.get(o.id)&&l!=null&&d>l&&N("credits_topped_up_detected",{organization_id:o.id,delta_cents:d-l,previous_balance_cents:l,new_balance_cents:d}),Ze.set(o.id,d),z.current.set(o.id,!0)}const i=!!f,y=d!=null&&d>0,S=d!=null&&d===0,M=d!=null&&d===200,j=h.length>0&&h.every(l=>l.providerId==="deco");return{hasDecoKey:i,decoKeyId:f?.id??null,balanceCents:d,balanceDollars:b,hasCredits:y,isZeroBalance:S,isInitialFreeCredit:M,hasOnlyDecoProvider:j,isLoading:D,isFetching:R,refetch:P}}export{Gt as A,ot as a,Ut as b,st as c,zt as d,Ht as e,Xt as f,Kt as g,qt as h,Qt as u};
@@ -1 +0,0 @@
1
- import{e as u,p as c,K as r,a5 as d,m as y,F as C,a as F}from"./index-EQfvflqN.js";import{u as a}from"./studio-tools-CcZtrETh.js";function E(){const e=u.c(7),{org:n}=c(),o=a();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:l}=d(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=a();let i;e[0]!==n.id?(i=r.fileConfigs(n.id),e[0]=n.id,e[1]=i):i=e[1];let t;e[2]!==o?(t=()=>o.call("FILE_CONFIG_LIST",{}),e[2]=o,e[3]=t):t=e[3];let s;return e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6],y(s)}function q(){const e=u.c(8),{org:n}=c(),o=a(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_CREATE",{...f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],F(l)}function _(){const e=u.c(8),{org:n}=c(),o=a(),i=C();let t;e[0]!==o?(t=f=>o.call("FILE_CONFIG_DELETE",{id:f}),e[0]=o,e[1]=t):t=e[1];let s;e[2]!==n||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:r.fileConfigs(n.id)})},e[2]=n,e[3]=i,e[4]=s):s=e[4];let l;return e[5]!==t||e[6]!==s?(l={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=l):l=e[7],F(l)}export{q as a,_ as b,I as c,E as u};
@@ -1,10 +0,0 @@
1
- import{d3 as de,d4 as he,d5 as fe,cc as pe,d6 as me,bR as m,bS as w,d7 as _e,d8 as ge,d9 as we,da as A,db as Te,dc as j,dd as ye,de as q,df as ke,dg as F,dh as ve,di as Se,dj as Ce,dk as z,bw as be,bz as Re,bd as Ie,c7 as ee,cj as Ee,cp as qe,cn as Pe,cT as $e,dl as Ae,dm as Me,dn as M,dp as Oe,dq as He,co as Ne,ck as xe,cl as De,cm as Ue,bt as je,dr as Fe,ds as Le,dt as Ve,ce as We,du as ze,dv as Qe,dw as Ge,bs as x,e as te,a5 as se,aI as V}from"./index-EQfvflqN.js";import{U as P,a as O,e as Q}from"./auth-oAvShPIA.js";function N(a){return!!a._zod}function b(a,e){return N(a)?de(a,e):a.safeParse(e)}function re(a){if(!a)return;let e;if(N(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function Je(a){if(N(a)){const o=a._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}const t=a._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const s=a.value;if(s!==void 0)return s}function R(a){return a==="completed"||a==="failed"||a==="cancelled"}function G(a){const t=re(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=Je(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function J(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const Ke=6e4;class Be{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(he,t=>{this._oncancel(t)}),this.setNotificationHandler(fe,t=>{this._onprogress(t)}),this.setRequestHandler(pe,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(me,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(_e,async(t,s)=>{const r=async()=>{const o=t.params.taskId;if(this._taskMessageQueue){let i;for(;i=await this._taskMessageQueue.dequeue(o,s.sessionId);){if(i.type==="response"||i.type==="error"){const u=i.message,p=u.id,l=this._requestResolvers.get(p);if(l)if(this._requestResolvers.delete(p),i.type==="response")l(u);else{const h=u,f=new m(h.error.code,h.error.message,h.error.data);l(f)}else{const h=i.type==="response"?"Response":"Error";this._onerror(new Error(`${h} handler missing for request ${p}`))}continue}await this._transport?.send(i.message,{relatedRequestId:s.requestId})}}const n=await this._taskStore.getTask(o,s.sessionId);if(!n)throw new m(w.InvalidParams,`Task not found: ${o}`);if(!R(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(R(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[q]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(ge,async(t,s)=>{try{const{tasks:r,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,s.sessionId);return{tasks:r,nextCursor:o,_meta:{}}}catch(r){throw new m(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(we,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new m(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(R(r.status))throw new m(w.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",s.sessionId),this._clearTaskQueue(t.params.taskId);const o=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!o)throw new m(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof m?r:new m(w.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,s,r,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:o,onTimeout:r})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),m.fromError(w.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const s=this.transport?.onerror;this._transport.onerror=o=>{s?.(o),this._onerror(o)};const r=this._transport?.onmessage;this._transport.onmessage=(o,n)=>{r?.(o,n),A(o)||Te(o)?this._onresponse(o):j(o)?this._onrequest(o,n):ye(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const s of this._timeoutInfo.values())clearTimeout(s.timeoutId);this._timeoutInfo.clear();for(const s of this._requestHandlerAbortControllers.values())s.abort();this._requestHandlerAbortControllers.clear();const t=m.fromError(w.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const s of e.values())s(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(s=>this._onerror(new Error(`Uncaught error in notification handler: ${s}`)))}_onrequest(e,t){const s=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,o=e.params?._meta?.[q]?.taskId;if(s===void 0){const l={jsonrpc:"2.0",id:e.id,error:{code:w.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},r?.sessionId).catch(h=>this._onerror(new Error(`Failed to enqueue error response: ${h}`))):r?.send(l).catch(h=>this._onerror(new Error(`Failed to send an error response: ${h}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=ke(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,p={signal:n.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(n.signal.aborted)return;const h={relatedRequestId:e.id};o&&(h.relatedTask={taskId:o}),await this.notification(l,h)},sendRequest:async(l,h,f)=>{if(n.signal.aborted)throw new m(w.ConnectionClosed,"Request was cancelled");const g={...f,relatedRequestId:e.id};o&&!g.relatedTask&&(g.relatedTask={taskId:o});const y=g.relatedTask?.taskId??o;return y&&u&&await u.updateTaskStatus(y,"input_required"),await this.request(l,h,g)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:u,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{i&&this.assertTaskHandlerCapability(e.method)}).then(()=>s(e,p)).then(async l=>{if(n.signal.aborted)return;const h={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)},async l=>{if(n.signal.aborted)return;const h={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:w.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:h,timestamp:Date.now()},r?.sessionId):await r?.send(h)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===n&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...s}=e.params,r=Number(t),o=this._progressHandlers.get(r);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}const n=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&n&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),n(u);return}o(s)}_onresponse(e){const t=Number(e.id),s=this._requestResolvers.get(t);if(s){if(this._requestResolvers.delete(t),A(e))s(e);else{const n=new m(e.error.code,e.error.message,e.error.data);s(n)}return}const r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(A(e)&&e.result&&typeof e.result=="object"){const n=e.result;if(n.task&&typeof n.task=="object"){const i=n.task;typeof i.taskId=="string"&&(o=!0,this._taskProgressTokens.set(i.taskId,t))}}if(o||this._progressHandlers.delete(t),A(e))r(e);else{const n=m.fromError(e.error.code,e.error.message,e.error.data);r(n)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,s){const{task:r}=s??{};if(!r){try{yield{type:"result",result:await this.request(e,t,s)}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}return}let o;try{const n=await this.request(e,F,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new m(w.InternalError,"Task creation did not return a task");for(;;){const i=await this.getTask({taskId:o},s);if(yield{type:"taskStatus",task:i},R(i.status)){i.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)}:i.status==="failed"?yield{type:"error",error:new m(w.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new m(w.InternalError,`Task ${o} was cancelled`)});return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,s)};return}const u=i.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(p=>setTimeout(p,u)),s?.signal?.throwIfAborted()}}catch(n){yield{type:"error",error:n instanceof m?n:new m(w.InternalError,String(n))}}}request(e,t,s){const{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n,task:i,relatedTask:u}=s??{};return new Promise((p,l)=>{const h=c=>{l(c)};if(!this._transport){h(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){h(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),g.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(g.params={...g.params,task:i}),u&&(g.params={...g.params,_meta:{...g.params?._meta||{},[q]:u}});const y=c=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(c)}},{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(v=>this._onerror(new Error(`Failed to send cancellation: ${v}`)));const _=c instanceof m?c:new m(w.RequestTimeout,String(c));l(_)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const _=b(t,c.result);_.success?p(_.data):l(_.error)}catch(_){l(_)}}}),s?.signal?.addEventListener("abort",()=>{y(s?.signal?.reason)});const T=s?.timeout??Ke,k=()=>y(m.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,k,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const v=this._responseHandlers.get(f);v?v(_):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(d,{type:"request",message:g,timestamp:Date.now()}).catch(_=>{this._cleanupTimeout(f),l(_)})}else this._transport.send(g,{relatedRequestId:r,resumptionToken:o,onresumptiontoken:n}).catch(c=>{this._cleanupTimeout(f),l(c)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},ve,t)}async getTaskResult(e,t,s){return this.request({method:"tasks/result",params:e},t,s)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Se,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ce,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const s=t?.relatedTask?.taskId;if(s){const i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[q]:t.relatedTask}}};await this._enqueueTaskMessage(s,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};t?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[q]:t.relatedTask}}}),this._transport?.send(i,t).catch(u=>this._onerror(u))});return}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[q]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=G(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=J(e,r);return Promise.resolve(t(n,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const s=G(e);this._notificationHandlers.set(s,r=>{const o=J(e,r);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,s){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,s,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const s=await this._taskMessageQueue.dequeueAll(e,t);for(const r of s)if(r.type==="request"&&j(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new m(w.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let s=this._options?.defaultTaskPollInterval??1e3;try{const r=await this._taskStore?.getTask(e);r?.pollInterval&&(s=r.pollInterval)}catch{}return new Promise((r,o)=>{if(t.aborted){o(new m(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new m(w.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const s=this._taskStore;if(!s)throw new Error("No task store configured");return{createTask:async r=>{if(!e)throw new Error("No request provided");return await s.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async r=>{const o=await s.getTask(r,t);if(!o)throw new m(w.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(r,o,n)=>{await s.storeTaskResult(r,o,n,t);const i=await s.getTask(r,t);if(i){const u=z.parse({method:"notifications/tasks/status",params:i});await this.notification(u),R(i.status)&&this._cleanupTaskProgressHandler(r)}},getTaskResult:r=>s.getTaskResult(r,t),updateTaskStatus:async(r,o,n)=>{const i=await s.getTask(r,t);if(!i)throw new m(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(R(i.status))throw new m(w.InvalidParams,`Cannot update task "${r}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await s.updateTaskStatus(r,o,n,t);const u=await s.getTask(r,t);if(u){const p=z.parse({method:"notifications/tasks/status",params:u});await this.notification(p),R(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function K(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Ye(a,e){const t={...a};for(const s in e){const r=s,o=e[r];if(o===void 0)continue;const n=t[r];K(n)&&K(o)?t[r]={...n,...o}:t[r]=o}return t}var Ze=Re();const Xe=be(Ze);function et(){const a=new Xe({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ie(a),a}class tt{constructor(e){this._ajv=e??et()}getValidator(e){const t="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return s=>t(s)?{valid:!0,data:s,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class st{constructor(e){this._client=e}async*callToolStream(e,t=ee,s){const r=this._client,o={...s,task:s?.task??(r.isToolTask(e.name)?{}:void 0)},n=r.requestStream({method:"tools/call",params:e},t,o),i=r.getToolOutputValidator(e.name);for await(const u of n){if(u.type==="result"&&i){const p=u.result;if(!p.structuredContent&&!p.isError){yield{type:"error",error:new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(p.structuredContent)try{const l=i(p.structuredContent);if(!l.valid){yield{type:"error",error:new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof m){yield{type:"error",error:l};return}yield{type:"error",error:new m(w.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield u}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,s){return this._client.getTaskResult({taskId:e},t,s)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,s){return this._client.requestStream(e,t,s)}}function rt(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!a.tools?.call)throw new Error(`${t} does not support task creation for tools/call (required for ${e})`);break}}function at(a,e,t){if(!a)throw new Error(`${t} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!a.sampling?.createMessage)throw new Error(`${t} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!a.elicitation?.create)throw new Error(`${t} does not support task creation for elicitation/create (required for ${e})`);break}}function H(a,e){if(!(!a||e===null||typeof e!="object")){if(a.type==="object"&&a.properties&&typeof a.properties=="object"){const t=e,s=a.properties;for(const r of Object.keys(s)){const o=s[r];t[r]===void 0&&Object.prototype.hasOwnProperty.call(o,"default")&&(t[r]=o.default),t[r]!==void 0&&H(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&H(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&H(t,e)}}function ot(a){if(!a)return{supportsFormMode:!1,supportsUrlMode:!1};const e=a.form!==void 0,t=a.url!==void 0;return{supportsFormMode:e||!e&&!t,supportsUrlMode:t}}let nt=class extends Be{constructor(e,t){super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new tt,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ee,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",qe,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new st(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ye(this._capabilities,e)}setRequestHandler(e,t){const r=re(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(N(r)){const i=r;o=i._zod?.def?.value??i.value}else{const i=r;o=i._def?.value??i.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");const n=o;if(n==="elicitation/create"){const i=async(u,p)=>{const l=b(Le,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:h}=l.data;h.mode=h.mode??"form";const{supportsFormMode:f,supportsUrlMode:g}=ot(this._capabilities.elicitation);if(h.mode==="form"&&!f)throw new m(w.InvalidParams,"Client does not support form-mode elicitation requests");if(h.mode==="url"&&!g)throw new m(w.InvalidParams,"Client does not support URL-mode elicitation requests");const y=await Promise.resolve(t(u,p));if(h.task){const c=b(F,y);if(!c.success){const _=c.error instanceof Error?c.error.message:String(c.error);throw new m(w.InvalidParams,`Invalid task creation result: ${_}`)}return c.data}const T=b(Ve,y);if(!T.success){const c=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid elicitation result: ${c}`)}const k=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&k.action==="accept"&&k.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{H(d,k.content)}catch{}return k};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(We,u);if(!l.success){const k=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid sampling request: ${k}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const k=b(F,f);if(!k.success){const d=k.error instanceof Error?k.error.message:String(k.error);throw new m(w.InvalidParams,`Invalid task creation result: ${d}`)}return k.data}const y=h.tools||h.toolChoice?ze:Qe,T=b(y,f);if(!T.success){const k=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid sampling result: ${k}`)}return T.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{const s=await this.request({method:"initialize",params:{protocolVersion:$e,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ae,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Me.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${e})`);break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${e})`);break}}assertTaskCapability(e){rt(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&at(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},M,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Oe,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},M,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},He,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Ne,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},De,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ue,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},M,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},M,t)}async callTool(e,t=ee,s){if(this.isToolTaskRequired(e.name))throw new m(w.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);const r=await this.request({method:"tools/call",params:e},t,s),o=this.getToolOutputValidator(e.name);if(o){if(!r.structuredContent&&!r.isError)throw new m(w.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{const n=o(r.structuredContent);if(!n.valid)throw new m(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof m?n:new m(w.InvalidParams,`Failed to validate structured content: ${n instanceof Error?n.message:String(n)}`)}}return r}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(const t of e){if(t.outputSchema){const r=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,r)}const s=t.execution?.taskSupport;(s==="required"||s==="optional")&&this._cachedKnownTaskTools.add(t.name),s==="required"&&this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){const s=await this.request({method:"tools/list",params:e},je,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Fe.safeParse(s);if(!o.success)throw new Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof s.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);const{autoRefresh:n,debounceMs:i}=o.data,{onChanged:u}=s,p=async()=>{if(!n){u(null,null);return}try{const h=await r();u(null,h)}catch(h){const f=h instanceof Error?h:new Error(String(h));u(f,null)}},l=()=>{if(i){const h=this._listChangedDebounceTimers.get(e);h&&clearTimeout(h);const f=setTimeout(p,i);this._listChangedDebounceTimers.set(e,f)}else p()};this.setNotificationHandler(t,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};const bt={SELF:a=>`${a}_self`,REGISTRY:a=>`${a}_registry`,COMMUNITY_REGISTRY:a=>`${a}_community-registry`,DEV_ASSETS:a=>`${a}_dev-assets`,SITE_DIAGNOSTICS:a=>`site-diagnostics_${a}`},it="self";function ae(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function ct(a){return{id:a.id,organization_id:a.organizationId,title:a.title,description:a.description,icon:a.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:a.instructions??null},pinned:!1,connections:[]}}const oe=ae("decopilot_"),Rt=oe.is,lt=oe.get,ne=ae("dev_"),It=ne.get,Et=ne.is;function qt(a){return ct({id:lt(a),organizationId:a,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png"})}const Pt={AGENT_MANAGER:a=>`studio-agent-manager_${a}`,AUTOMATION_MANAGER:a=>`studio-automation-manager_${a}`,CONNECTION_MANAGER:a=>`studio-connection-manager_${a}`,STORE_MANAGER:a=>`studio-store-manager_${a}`,BRAND_MANAGER:a=>`studio-brand-manager_${a}`,USAGE_MANAGER:a=>`studio-usage-manager_${a}`};function $t(a){return a?a.startsWith("studio-agent-manager_")||a.startsWith("studio-automation-manager_")||a.startsWith("studio-connection-manager_")||a.startsWith("studio-store-manager_")||a.startsWith("studio-brand-manager_")||a.startsWith("studio-usage-manager_"):!1}const D=a=>[{type:"text",text:a}];function ut(a){const e=a.meshUrl??(typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either meshUrl or a browser environment.");const t={"Content-Type":"application/json",Accept:"application/json",...a.token?{Authorization:`Bearer ${a.token}`}:{}},s=u=>new URL(`/api/${encodeURIComponent(a.orgSlug)}${u}`,e).href,r=async u=>{let p;try{p=await fetch(s(`/tools/${encodeURIComponent(u.name)}`),{method:"POST",headers:t,credentials:"include",body:JSON.stringify(u.arguments??{})})}catch(h){const f=h instanceof Error?h.message:"Network error";return{content:D(f),isError:!0}}if(!p.ok){let h=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(h=f.error)}catch{}return{content:D(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:D(typeof l=="string"?l:JSON.stringify(l)),structuredContent:l}},o=async()=>{const u=await fetch(s("/tools"),{method:"GET",headers:t,credentials:"include"});return u.ok?await u.json():{tools:[]}},n=u=>()=>Promise.reject(new Error(`RestSelfClient: ${u} is not supported over REST for the self connection`));return{callTool:r,listTools:o,listPrompts:n("listPrompts"),getPrompt:n("getPrompt"),listResources:n("listResources"),readResource:n("readResource"),listResourceTemplates:n("listResourceTemplates"),close:()=>Promise.resolve(),toJSON:()=>a.toJSONString}}function L(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function dt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...L(e.headers),...L(s.headers)}:e.headers};return a(t,r)}:a}class B extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}const Y=10,ht=13,I=32;function U(a){}function ft(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=U,onError:t=U,onRetry:s=U,onComment:r}=a,o=[];let n=!0,i,u="",p=0,l;function h(d){if(n&&(n=!1,d.charCodeAt(0)===239&&d.charCodeAt(1)===187&&d.charCodeAt(2)===191&&(d=d.slice(3))),o.length===0){const v=f(d);v!==""&&o.push(v);return}if(d.indexOf(`
2
- `)===-1&&d.indexOf("\r")===-1){o.push(d);return}o.push(d);const c=o.join("");o.length=0;const _=f(c);_!==""&&o.push(_)}function f(d){let c=0;if(d.indexOf("\r")===-1){let _=d.indexOf(`
3
- `,c);for(;_!==-1;){if(c===_){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0,c=_+1,_=d.indexOf(`
4
- `,c);continue}const v=d.charCodeAt(c);if(Z(d,c,v)){const S=d.charCodeAt(c+5)===I?c+6:c+5,C=d.slice(S,_);if(p===0&&d.charCodeAt(_+1)===Y){e({id:i,event:l,data:C}),i=void 0,u="",l=void 0,c=_+2,_=d.indexOf(`
5
- `,c);continue}u=p===0?C:`${u}
6
- ${C}`,p++}else X(d,c,v)?l=d.slice(d.charCodeAt(c+6)===I?c+7:c+6,_)||void 0:g(d,c,_);c=_+1,_=d.indexOf(`
7
- `,c)}return d.slice(c)}for(;c<d.length;){const _=d.indexOf("\r",c),v=d.indexOf(`
8
- `,c);let S=-1;if(_!==-1&&v!==-1?S=_<v?_:v:_!==-1?_===d.length-1?S=-1:S=_:v!==-1&&(S=v),S===-1)break;g(d,c,S),c=S+1,d.charCodeAt(c-1)===ht&&d.charCodeAt(c)===Y&&c++}return d.slice(c)}function g(d,c,_){if(c===_){T();return}const v=d.charCodeAt(c);if(Z(d,c,v)){const E=d.charCodeAt(c+5)===I?c+6:c+5,W=d.slice(E,_);u=p===0?W:`${u}
9
- ${W}`,p++;return}if(X(d,c,v)){l=d.slice(d.charCodeAt(c+6)===I?c+7:c+6,_)||void 0;return}if(v===105&&d.charCodeAt(c+1)===100&&d.charCodeAt(c+2)===58){const E=d.slice(d.charCodeAt(c+3)===I?c+4:c+3,_);i=E.includes("\0")?void 0:E;return}if(v===58){if(r){const E=d.slice(c,_);r(E.slice(d.charCodeAt(c+1)===I?2:1))}return}const S=d.slice(c,_),C=S.indexOf(":");if(C===-1){y(S,"",S);return}const ce=S.slice(0,C),le=S.charCodeAt(C+1)===I?2:1,ue=S.slice(C+le);y(ce,ue,S)}function y(d,c,_){switch(d){case"event":l=c||void 0;break;case"data":u=p===0?c:`${u}
10
- ${c}`,p++;break;case"id":i=c.includes("\0")?void 0:c;break;case"retry":/^\d+$/.test(c)?s(parseInt(c,10)):t(new B(`Invalid \`retry\` value: "${c}"`,{type:"invalid-retry",value:c,line:_}));break;default:t(new B(`Unknown field "${d.length>20?`${d.slice(0,20)}…`:d}"`,{type:"unknown-field",field:d,value:c,line:_}));break}}function T(){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0}function k(d={}){if(d.consume&&o.length>0){const c=o.join("");g(c,0,c.length)}n=!0,i=void 0,u="",p=0,l=void 0,o.length=0}return{feed:h,reset:k}}function Z(a,e,t){return t===100&&a.charCodeAt(e+1)===97&&a.charCodeAt(e+2)===116&&a.charCodeAt(e+3)===97&&a.charCodeAt(e+4)===58}function X(a,e,t){return t===101&&a.charCodeAt(e+1)===118&&a.charCodeAt(e+2)===101&&a.charCodeAt(e+3)===110&&a.charCodeAt(e+4)===116&&a.charCodeAt(e+5)===58}class pt extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(o){r=ft({onEvent:n=>{o.enqueue(n)},onError(n){e==="terminate"?o.error(n):typeof e=="function"&&e(n)},onRetry:t,onComment:s})},transform(o){r.feed(o)}})}}const mt={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2};class $ extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}}let _t=class{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=dt(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??mt}async _authThenStart(){if(!this._authProvider)throw new P("No auth provider");let e;try{e=await O(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new P;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){const e={};if(this._authProvider){const s=await this._authProvider.tokens();s&&(e.Authorization=`Bearer ${s.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);const t=L(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){const{resumptionToken:t}=e;try{const s=await this._commonHeaders();s.set("Accept","text/event-stream"),t&&s.set("last-event-id",t);const r=await(this._fetch??fetch)(this._url,{method:"GET",headers:s,signal:this._abortController?.signal});if(!r.ok){if(await r.body?.cancel(),r.status===401&&this._authProvider)return await this._authThenStart();if(r.status===405)return;throw new $(r.status,`Failed to open SSE stream: ${r.statusText}`)}this._handleSseStream(r.body,e,!0)}catch(s){throw this.onerror?.(s),s}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;const t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_scheduleReconnection(e,t=0){const s=this._reconnectionOptions.maxRetries;if(t>=s){this.onerror?.(new Error(`Maximum reconnection attempts (${s}) exceeded.`));return}const r=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},r)}_handleSseStream(e,t,s){if(!e)return;const{onresumptiontoken:r,replayMessageId:o}=t;let n,i=!1,u=!1;(async()=>{try{const l=e.pipeThrough(new TextDecoderStream).pipeThrough(new pt({onRetry:g=>{this._serverRetryMs=g}})).getReader();for(;;){const{value:g,done:y}=await l.read();if(y)break;if(g.id&&(n=g.id,i=!0,r?.(g.id)),!!g.data&&(!g.event||g.event==="message"))try{const T=x.parse(JSON.parse(g.data));A(T)&&(u=!0,o!==void 0&&(T.id=o)),this.onmessage?.(T)}catch(T){this.onerror?.(T)}}(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(s||i)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:n,onresumptiontoken:r,replayMessageId:o},0)}catch(g){this.onerror?.(new Error(`Failed to reconnect: ${g instanceof Error?g.message:String(g)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new P("No auth provider");if(await O(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,t){try{const{resumptionToken:s,onresumptiontoken:r}=t||{};if(s){this._startOrAuthSse({resumptionToken:s,replayMessageId:j(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}const o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");const n={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,n),u=i.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!i.ok){const f=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new $(401,"Server returned 401 after successful authentication");const{resourceMetadataUrl:g,scope:y}=Q(i);if(this._resourceMetadataUrl=g,this._scope=y,await O(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new P;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){const{resourceMetadataUrl:g,scope:y,error:T}=Q(i);if(T==="insufficient_scope"){const k=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===k)throw new $(403,"Server returned 403 after trying upscoping");if(y&&(this._scope=y),g&&(this._resourceMetadataUrl=g),this._lastUpscopingHeader=k??void 0,await O(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new P;return this.send(e)}}throw new $(i.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){await i.body?.cancel(),Ge(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}const l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,h=i.headers.get("content-type");if(l)if(h?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:r},!1);else if(h?.includes("application/json")){const f=await i.json(),g=Array.isArray(f)?f.map(y=>x.parse(y)):[x.parse(f)];for(const y of g)this.onmessage?.(y)}else throw await i.body?.cancel(),new $(-1,`Unexpected content type: ${h}`);else await i.body?.cancel()}catch(s){throw this.onerror?.(s),s}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{const e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,t);if(await s.body?.cancel(),!s.ok&&s.status!==405)throw new $(s.status,`Failed to terminate session: ${s.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}};class gt extends _t{constructor(e,t){super(e,t)}send(e,t){const s=wt(e);return s?.type==="emit"?(this.onmessage?.(s.message),Promise.resolve()):s?.type==="suppress"?Promise.resolve():super.send(e,t)}}function wt(a){const e=a;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const t=e?.params?.protocolVersion;return t?{type:"emit",message:{result:{protocolVersion:t,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const Tt={name:"mesh-sdk",version:"1.0.0"};function yt(a,e,t){const s=t??(typeof window<"u"?window.location.origin:void 0);if(!s)throw new Error("MCP client requires either meshUrl option or a browser environment.");const r=`/api/${encodeURIComponent(e)}`,o=a?`${r}/mcp/${a}`:`${r}/mcp`;return new URL(o,s).href}async function ie({connectionId:a,orgId:e,orgSlug:t,token:s,meshUrl:r,mcpUrl:o}){const n=V.mcpClient(e,a??"self",s??"",o??r??"");if(!o&&(!a||a===it))return ut({orgSlug:t,token:s,meshUrl:r,toJSONString:`mcp-client:${n.join(":")}`});const i=o??yt(a,t,r),u=new nt(Tt,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),p=new gt(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...s?{Authorization:`Bearer ${s}`}:{}}}});return await u.connect(p),u.toJSON=()=>`mcp-client:${n.join(":")}`,u}function kt(a){const{connectionId:e,token:t,meshUrl:s,mcpUrl:r,orgId:o}=a;return{queryKey:V.mcpClient(o,e??"self",t??"",r??s??""),queryFn:()=>ie(a),staleTime:1/0,gcTime:6e4}}function Mt(a){const e=te.c(2);let t;e[0]!==a?(t=kt(a),e[0]=a,e[1]=t):t=e[1];const{data:s}=se(t);return s}function Ot(a){const e=te.c(16),{connectionId:t,orgId:s,orgSlug:r,token:o,meshUrl:n,mcpUrl:i}=a;let u;e[0]!==t||e[1]!==i||e[2]!==n||e[3]!==s||e[4]!==o?(u=t!==void 0?V.mcpClient(s,t??"self",o??"",i??n??""):["mcp","client","skip",s],e[0]=t,e[1]=i,e[2]=n,e[3]=s,e[4]=o,e[5]=u):u=e[5];const p=u;let l;e[6]!==t||e[7]!==i||e[8]!==n||e[9]!==s||e[10]!==r||e[11]!==o?(l=async()=>t===void 0?null:ie({connectionId:t,orgId:s,orgSlug:r,token:o,meshUrl:n,mcpUrl:i}),e[6]=t,e[7]=i,e[8]=n,e[9]=s,e[10]=r,e[11]=o,e[12]=l):l=e[12];let h;e[13]!==p||e[14]!==l?(h={queryKey:p,queryFn:l,staleTime:1/0,gcTime:6e4},e[13]=p,e[14]=l,e[15]=h):h=e[15];const{data:f}=se(h);return f??null}export{Xe as A,nt as C,Be as P,it as S,bt as W,It as a,Ot as b,Pt as c,ie as d,ft as e,dt as f,qt as g,_t as h,Rt as i,$t as j,lt as k,kt as m,L as n,Et as p,Mt as u};
@@ -1 +0,0 @@
1
- import{a2 as v,r as f,e as C,j,f as D,p as M,b as N}from"./index-EQfvflqN.js";import{u as F}from"./use-virtual-mcp-isKQVwa1.js";const h="__tool_call_runs__",R=["requires_action","in_progress","failed","expired","completed"];function tt(t){const e=new Map(R.map(r=>[r,[]]));for(const r of t){const n=r.status??"completed";(e.get(n)??e.get("completed")).push(r)}return R.map(r=>({status:r,threads:e.get(r)}))}function et(t,e){const r=new Map;for(const a of t){if(a.id.startsWith("thrd_welcome_"))continue;const u=a.virtual_mcp_id??h,d=r.get(u);d?(d.threads.push(a),(a.updated_at??"")>d.latestUpdatedAt&&(d.latestUpdatedAt=a.updated_at??"")):r.set(u,{virtualMcpId:u,threads:[a],latestUpdatedAt:a.updated_at??""})}const n=e!==null?r.get(e):void 0;n&&e&&r.delete(e);const s=r.get(h);s&&r.delete(h);const o=[...r.values()].sort((a,u)=>u.latestUpdatedAt.localeCompare(a.latestUpdatedAt)),i=[];return e&&i.push(n??{virtualMcpId:e,threads:[],latestUpdatedAt:""}),i.push(...o),s&&s.threads.length>0&&i.push(s),i}function rt(t,e){if(e.size===0)return t;const r=[],n=new Map;for(const s of t){const o=e.get(s.virtualMcpId);if(o){const a=n.get(o);if(a)a.threads=[...a.threads,...s.threads],s.latestUpdatedAt>a.latestUpdatedAt&&(a.latestUpdatedAt=s.latestUpdatedAt);else{const u={virtualMcpId:o,threads:[...s.threads],latestUpdatedAt:s.latestUpdatedAt};n.set(o,u),r.push(u)}continue}const i=n.get(s.virtualMcpId);if(i)i.threads=[...s.threads,...i.threads],s.latestUpdatedAt>i.latestUpdatedAt&&(i.latestUpdatedAt=s.latestUpdatedAt);else{const a={...s,threads:[...s.threads]};n.set(s.virtualMcpId,a),r.push(a)}}return r}const x=new Map,I=new Map;function P(t){return`${t.orgId}:${t.userId}`}function E(t){return`sidebar.group-order.${t}`}function O(t){try{const e=localStorage.getItem(t),r=e?JSON.parse(e):[];return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}catch{return[]}}function T(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch{}}function k(t){const e=P(t),r=x.get(e);if(r)return r;const n=v.sidebarGroupOrder(t.orgId,t.userId);let s=!1;try{s=localStorage.getItem(n)!==null}catch{}let o=O(n);if(!s&&o.length===0&&t.userId!=="anon"){const i=O(E(t.orgId));i.length>0&&(o=i)}return x.set(e,o),o}function p(t,e){const r=new Set(e);return k(t).filter(n=>!r.has(n))}function g(t,e){x.set(P(t),e),T(v.sidebarGroupOrder(t.orgId,t.userId),e)}function m(t){const e=I.get(t);if(e)return e;const r=O(v.sidebarOrgPinnedOrder(t));return I.set(t,r),r}function S(t,e){I.set(t,e),T(v.sidebarOrgPinnedOrder(t),e)}function nt(t,e){g(t,e)}function st(t,e){S(t,e)}function L(t,e){return t===e||t===h}function w(t,e){return e.includes(t)}function q(t,e){return t.map(r=>r.virtualMcpId).filter(r=>!L(r,e))}function ot(t,e,r,n){const s=new Set(n);return q(t,r).filter(o=>e==="org"?s.has(o):!s.has(o))}function B(t,e){const r=new Set(t),n=e.filter(s=>!r.has(s));return n.length===0?t:[...t,...n]}function at(t,e,r){const n=new Set(r),s=[],o=[];let i,a;for(const u of t){const d=u.virtualMcpId;if(e&&d===e){i=u;continue}if(d===h){a=u;continue}if(n.has(d)){s.push(u);continue}o.push(u)}return{decopilot:i,orgPinned:s,user:o,toolCallRuns:a}}function $(t,e,r,n=[],s=[]){const o=r?t.find(c=>c.virtualMcpId===r):void 0,i=t.find(c=>c.virtualMcpId===h),a=new Set(n),u=n.filter(c=>!L(c,r)),d=B(s,u),l=e.filter(c=>!a.has(c)),b=new Map(t.map(c=>[c.virtualMcpId,c])),A=c=>{const G=b.get(c);return G||{virtualMcpId:c,threads:[],latestUpdatedAt:""}},_=d.filter(c=>a.has(c)).map(A),K=l.map(A),U=[];return o&&U.push(o),U.push(..._,...K),i&&U.push(i),{groups:U,userOrder:l,orgOrder:_.map(c=>c.virtualMcpId)}}function J(t,e){const r=new Set(e);m(t.orgId).length===0&&e.length>0&&S(t.orgId,[...e]);const s=v.sidebarGroupOrder(t.orgId,t.userId);if(O(s).length>0)return;const o=O(E(t.orgId));if(o.length===0)return;const i=o.filter(a=>!r.has(a));g(t,i)}function Y(t,e){const r=new Set(e),n=k(t),s=n.filter(o=>!r.has(o));s.length!==n.length&&g(t,s)}function it(t,e,r,n=[]){J(t,n),Y(t,n);const s=p(t,n),o=m(t.orgId),{userOrder:i,orgOrder:a}=$(e,s,r,n,o);(i.length!==s.length||i.some((u,d)=>u!==s[d]))&&g(t,i),(a.length!==o.length||a.some((u,d)=>u!==o[d]))&&S(t.orgId,a)}function ut(t,e,r,n=[]){const s=p(t,n),o=m(t.orgId);return $(e,s,r,n,o).groups}function dt(t,e,r){if(r){const o=p(t,[e]).filter(a=>a!==e);g(t,o);const i=m(t.orgId);i.includes(e)||S(t.orgId,[...i,e]);return}const n=m(t.orgId).filter(o=>o!==e);S(t.orgId,n);const s=p(t,[]);s.includes(e)||g(t,[...s,e])}function z(t,e,r=[]){if(r.includes(e))return;const n=p(t,r);n.includes(e)||g(t,[e,...n])}function ct(t,e,r=[]){const n=p(t,r),s=n.filter(o=>o!==e);s.length!==n.length&&g(t,s)}function lt(t,e,r){const n=t.indexOf(e),s=t.indexOf(r);if(n===-1||s===-1||n===s)return t;const o=[...t],[i]=o.splice(n,1);return i===void 0?t:(o.splice(s,0,i),o)}function ft(t,e,r,n){if(t==="org")return n;const s=p(e,r),o=new Set(n),i=s.filter(a=>!o.has(a));return[...n,...i]}function gt(t,e,r){const n=w(t,r),s=w(e,r);return n===s}const y=f.createContext(null);function pt(t){const e=C.c(7),{children:r}=t,[n,s]=f.useState(!1),[o,i]=f.useState(0);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=()=>i(W),e[0]=a):a=e[0];const u=a;let d;e[1]!==n||e[2]!==o?(d={empty:n,setEmpty:s,orderRevision:o,bumpOrderRevision:u},e[1]=n,e[2]=o,e[3]=d):d=e[3];let l;return e[4]!==r||e[5]!==d?(l=j.jsx(y.Provider,{value:d,children:r}),e[4]=r,e[5]=d,e[6]=l):l=e[6],l}function W(t){return t+1}function ht(){return f.useContext(y)?.empty??!1}function Ot(){return f.useContext(y)?.orderRevision??0}function H(){return f.useContext(y)?.bumpOrderRevision??Q}function Q(){}function mt(t){const{value:e}=t,r=f.useContext(y),[n,s]=f.useState(null);return r&&n!==e&&(r.setEmpty(e),s(e)),null}function X(t){return(t??[]).filter(e=>!!e.pinned).map(e=>e.id)}function St(){const t=C.c(9),e=D(),{org:r}=M(),n=F(),{data:s}=N.useSession(),o=s?.user?.id??"anon";let i;t[0]!==n?(i=X(n),t[0]=n,t[1]=i):i=t[1];const a=i,u=H();let d;return t[2]!==u||t[3]!==e||t[4]!==r.id||t[5]!==r.slug||t[6]!==a||t[7]!==o?(d=(l,b)=>{z({orgId:r.id,userId:o},l,a),u();const A=crypto.randomUUID();e({to:"/$org/$taskId",params:{org:r.slug,taskId:A},search:{...b?.search??{},virtualmcpid:l}})},t[2]=u,t[3]=e,t[4]=r.id,t[5]=r.slug,t[6]=a,t[7]=o,t[8]=d):d=t[8],d}export{mt as S,h as T,H as a,z as b,gt as c,ft as d,st as e,nt as f,X as g,it as h,ut as i,Ot as j,rt as k,et as l,St as m,tt as n,ct as o,at as p,dt as q,lt as r,ot as s,pt as t,ht as u};
@@ -1 +0,0 @@
1
- import{K as d,e as l,p as g,m as E,F as I,a as R,r as b}from"./index-EQfvflqN.js";import{W as G}from"./use-mcp-client-Dlrc-MQT.js";import{c as M,u as Q}from"./studio-tools-CcZtrETh.js";const N={organizationId:"",sidebar_items:null,enabled_plugins:null,registry_config:null,simple_mode:null,default_home_agents:null},O={tiers:{fast:null,smart:null,thinking:null,image:null,web_search:null,deep_research:null}};function w(t,e){return{queryKey:d.organizationSettings(e),queryFn:async()=>{try{return await M(t,"ORGANIZATION_SETTINGS_GET",{})}catch{return{...N,organizationId:e}}},staleTime:6e4}}function h(t){const e=l.c(6),{org:s}=g();let n;e[0]!==s.id||e[1]!==s.slug?(n=w(s.slug,s.id),e[0]=s.id,e[1]=s.slug,e[2]=n):n=e[2];const i=t;let r;return e[3]!==n||e[4]!==i?(r={...n,select:i},e[3]=n,e[4]=i,e[5]=r):r=e[5],E(r)}function H(t,e){const s=l.c(3);let n;s[0]!==t||s[1]!==e?(n=w(e,t),s[0]=t,s[1]=e,s[2]=n):n=s[2];const{data:i}=E(n);return i??null}function S(){const t=l.c(9),{org:e}=g(),s=Q(),n=I();let i;t[0]!==e||t[1]!==s?(i=async u=>{const o=await s.call("ORGANIZATION_SETTINGS_UPDATE",{organizationId:e.id,...u});if(!o)throw new Error("ORGANIZATION_SETTINGS_UPDATE returned no payload");return o},t[0]=e,t[1]=s,t[2]=i):i=t[2];let r;t[3]!==e||t[4]!==n?(r=u=>{n.setQueryData(d.organizationSettings(e.id),o=>({...o??N,...u}))},t[3]=e,t[4]=n,t[5]=r):r=t[5];let a;return t[6]!==i||t[7]!==r?(a={mutationFn:i,onSuccess:r},t[6]=i,t[7]=r,t[8]=a):a=t[8],R(a)}function C(t){return t?.tiers?{tiers:{fast:t.tiers.fast??null,smart:t.tiers.smart??null,thinking:t.tiers.thinking??null,image:t.tiers.image??null,web_search:t.tiers.web_search??null,deep_research:t.tiers.deep_research??null}}:O}function W(){const{data:t}=h(P);return t??O}function P(t){return C(t.simple_mode)}function Z(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({simple_mode:r},a),n=(r,a)=>e.mutateAsync({simple_mode:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function $(){const{data:t}=h(x);return t??null}function x(t){return t.registry_config}function j(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({registry_config:r},a),n=(r,a)=>e.mutateAsync({registry_config:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function B(){const{data:t}=h(U);return t??null}function U(t){return t.default_home_agents}function k(){const t=l.c(7),e=S();let s,n;t[0]!==e?(s=(r,a)=>e.mutate({default_home_agents:r},a),n=(r,a)=>e.mutateAsync({default_home_agents:r},a),t[0]=e,t[1]=s,t[2]=n):(s=t[1],n=t[2]);let i;return t[3]!==e||t[4]!==s||t[5]!==n?(i={...e,mutate:s,mutateAsync:n},t[3]=e,t[4]=s,t[5]=n,t[6]=i):i=t[6],i}function L(){const t=l.c(14),{org:e}=g(),s=k(),n=I();let i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=Promise.resolve(),t[0]=i):i=t[0];const r=b.useRef(i);let a;t[1]!==e.id?(a=d.organizationSettings(e.id),t[1]=e.id,t[2]=a):a=t[2];const u=a;let o;t[3]!==u||t[4]!==n?(o=()=>n.getQueryData(u)?.default_home_agents?.ids??[],t[3]=u,t[4]=n,t[5]=o):o=t[5];const _=o;let m;t[6]!==u||t[7]!==e.slug||t[8]!==n||t[9]!==s?(m=z=>{const T=r.current.then(async()=>{const A=n.getQueryData(u),p=z(A?.default_home_agents?.ids??[]);if(p!==null){n.setQueryData(u,c=>c&&{...c,default_home_agents:{ids:p}});try{await s.mutateAsync({ids:p}),await n.refetchQueries({queryKey:d.homeNextActions(e.slug),type:"active"})}catch(c){const D=c;throw n.setQueryData(u,A),D}}});return r.current=T.catch(q),T},t[6]=u,t[7]=e.slug,t[8]=n,t[9]=s,t[10]=m):m=t[10];const y=m;let f;return t[11]!==y||t[12]!==_?(f={currentIds:_,apply:y},t[11]=y,t[12]=_,t[13]=f):f=t[13],f}function q(){}function v(){const t=l.c(5),{org:e}=g(),s=$();let n;t[0]!==e.id?(n=G.REGISTRY(e.id),t[0]=e.id,t[1]=n):n=t[1];const i=n;let r;return t[2]!==i||t[3]!==s?(r=a=>{if(!s)return a===i;const u=s.registries[a];return u?u.enabled:a===i},t[2]=i,t[3]=s,t[4]=r):r=t[4],r}export{L as a,v as b,H as c,W as d,Z as e,$ as f,j as g,w as o,B as u};
@@ -1 +0,0 @@
1
- import{e as n,p as r,K as c,a5 as y,F as d,a as S}from"./index-EQfvflqN.js";import{u as l}from"./studio-tools-CcZtrETh.js";function p(){const e=n.c(7),{org:o}=r(),a=l();let i;e[0]!==o.id?(i=c.secrets(o.id),e[0]=o.id,e[1]=i):i=e[1];let t;e[2]!==a?(t=async()=>await a.call("SECRET_LIST",{}),e[2]=a,e[3]=t):t=e[3];let s;e[4]!==i||e[5]!==t?(s={queryKey:i,staleTime:6e4,queryFn:t},e[4]=i,e[5]=t,e[6]=s):s=e[6];const{data:u}=y(s);return u.secrets}function C(){const e=n.c(8),{org:o}=r(),a=l(),i=d();let t;e[0]!==a?(t=async f=>await a.call("SECRET_CREATE",{...f}),e[0]=a,e[1]=t):t=e[1];let s;e[2]!==o||e[3]!==i?(s=()=>{i.invalidateQueries({queryKey:c.secrets(o.id)})},e[2]=o,e[3]=i,e[4]=s):s=e[4];let u;return e[5]!==t||e[6]!==s?(u={mutationFn:t,onSuccess:s},e[5]=t,e[6]=s,e[7]=u):u=e[7],S(u)}export{C as a,p as u};
@@ -1 +0,0 @@
1
- import{I as u}from"./use-infinite-scroll-BvUO_UAz.js";import{cH as i}from"./index-EQfvflqN.js";function t(e,r){return i(e,u,r)}export{t as u};
@@ -1 +0,0 @@
1
- import{bc as n,r as s,c1 as a,c2 as i}from"./index-EQfvflqN.js";function f(r){const o=n({warn:r?.router===void 0}),t=r?.router||o,u=s.useRef(void 0);return a(t.stores.__store,e=>{if(r?.select){if(r.structuralSharing??t.options.defaultStructuralSharing){const c=i(u.current,r.select(e));return u.current=c,c}return r.select(e)}return e})}export{f as u};
@@ -1 +0,0 @@
1
- import{I as s}from"./use-infinite-scroll-BvUO_UAz.js";import{cH as u,az as n}from"./index-EQfvflqN.js";function a(r,e){return u({...r,enabled:!0,suspense:!0,throwOnError:n},s,e)}export{a as u};
@@ -1 +0,0 @@
1
- import{e as R,r as K,j as a,c as W,B as O}from"./index-EQfvflqN.js";import{P as Q,f as it}from"./agent-icon-CBTaU_uB.js";import{n as at}from"./ChevronLeft-CPb9YQ3b.js";import{i as lt}from"./ChevronRight-BdBQHcGY.js";import{S as X}from"./scroll-area-CLsPpB-r.js";import{T as ct,b as mt,a as pt}from"./tooltip-DZelUdM0.js";import{V as ft}from"./view-mode-toggle-Bo4aZcGU.js";import"./AlertCircle-Qsz79sot.js";import"./Tool01-DuWKfueG.js";import"./SwitchHorizontal01-BG4hAcSt.js";import"./Settings02-BDBrMikk.js";import"./XCircle-qby-IxK9.js";import"./ArrowUpRight-CqYlpRve.js";import"./ZapSquare-BZciBg8V.js";import"./Users03-rDpaXmvi.js";import"./CheckCircle-D96bOHZ4.js";import"./ChevronUp-ByHCMSz5.js";import"./ChevronDown-BDUfpA8-.js";import"./DotsVertical-B0BcJ-Xx.js";import"./Stars02-CsAFd9rT.js";import"./Eye-Cn63kKBo.js";import"./ZoomOut-CuzhjD8R.js";import"./Globe01-D6_7mD2q.js";import"./FilterLines-CybSjddP.js";import"./Star01-c7vPYDwm.js";import"./Globe04-DGI5tY8K.js";import"./HardDrive-BoitsKJ1.js";import"./Key01-CEwc6a0T.js";import"./LayoutLeft-Dbsbo4ui.js";import"./LinkExternal01-B1YJxZ_i.js";import"./Monitor01-BJEn_hPF.js";import"./Sun-DLMUNZaS.js";import"./Palette-DM7mN-wZ.js";import"./Play--fnJFFV0.js";import"./Plus-BotD1zxJ.js";import"./SearchMd-BJM4yPQO.js";import"./Shield01-BLk45Lqh.js";import"./Stars01-B-5V3LS2.js";import"./Trash01-CBhkXuxm.js";import"./Upload01-geIrWEzc.js";import"./User01-BQxtHTb_.js";import"./Users01-oAfFj8jH.js";import"./XClose-CjsCyYq1.js";import"./X-CWsxaTAy.js";import"./Zap-CBPMaWRv.js";import"./use-clock-tick-ZNeIyYyN.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./use-copy-B8BHxthn.js";import"./file-type-icon-Co_9nTdI.js";import"./dialog-45S14PiE.js";import"./tab-id-BptcWVWa.js";import"./content-blocks-o63cs2vh.js";import"./types-D4QaCOrk.js";import"./use-mcp-client-Dlrc-MQT.js";import"./auth-oAvShPIA.js";import"./chat-context-BtC6Ah0G.js";import"./hooks-C6xsli9S.js";import"./decopilot-sse-pool-4h5QEcLo.js";import"./use-virtual-mcp-isKQVwa1.js";import"./use-collections-BpjfU7Qz.js";import"./use-ai-providers-DG2JQjs-.js";import"./studio-tools-CcZtrETh.js";import"./use-organization-settings-MrFZCmt9.js";import"./shell-layout-CMM5javC.js";import"./avatar-BuKPm2vr.js";import"./required-auth-layout-D-3ucvj0.js";import"./useRouterState-JYZfxOr3.js";import"./use-org-sso-CQCoThc3.js";import"./sheet-CO5nUKz5.js";import"./integration-icon-CLgQo-hX.js";import"./use-navigate-to-agent-YIuMJGpH.js";import"./use-connection-DgGg0YyB.js";import"./use-mcp-prompts-DK7oMqp2.js";import"./form-DeXV6ZbR.js";import"./label-WMNwqiQL.js";import"./input-DSpuivwc.js";import"./select-Cr8ncrzb.js";const dt=new Set(["website/matchers/date.ts","$live/matchers/MatchDate.ts"]),ut=new Set(["website/matchers/multi.ts","$live/matchers/MatchMulti.ts"]),ht=/\/flags\/multivariate\/[^/]+\.ts$/;function xt(e){let t=e;t.startsWith("pages-")&&(t=t.slice(6).replace(/-\d+$/,""));try{t=decodeURIComponent(t)}catch{}return t}function gt(e){if(!e||typeof e!="object")return null;const{start:t,end:r}=e;if(typeof t!="string"||typeof r!="string")return null;const n=new Date(t),c=new Date(r);return Number.isNaN(n.getTime())||Number.isNaN(c.getTime())||c.getTime()<=n.getTime()?null:{start:n,end:c}}function Z(e,t){if(!e||typeof e!="object")return;const r=e.__resolveType;if(typeof r=="string"){if(dt.has(r)){const n=gt(e);n&&t.push(n);return}if(ut.has(r)){const n=e.matchers;if(Array.isArray(n))for(const c of n)Z(c,t)}}}function bt(e){if(!e||typeof e!="object")return!1;const t=e.__resolveType;if(typeof t!="string"||!ht.test(t))return!1;const r=e.variants;return Array.isArray(r)}function yt(e){if(typeof e=="string"){const i=e.trim();if(i.length===0)return null;try{const m=new URL(i).pathname.split("/").filter(Boolean),p=m[m.length-1];if(p)return decodeURIComponent(p)}catch{}return i.length>80?`${i.slice(0,77)}…`:i}if(!e||typeof e!="object")return null;const t=e,r=t.config,c=t.desktop?.media,o=[t.title,t.name,t.label,t.alt,r?.title,r?.name,r?.typeAlert?.message,c?.alt,Array.isArray(t.matcher)?t.matcher[0]:void 0];for(const i of o)if(typeof i=="string"&&i.trim().length>0)return i.trim();const l=t.__resolveType;if(typeof l=="string"){const s=(l.split("/").pop()??l).replace(/\.(tsx?|jsx?)$/i,"");if(s.length>0)return s}return null}function vt(e){const t=[];for(let r=0;r<e.length;r++){const n=e[r];typeof n=="number"?t.length>0?t[t.length-1]+=`[${n}]`:t.push(`[${n}]`):t.push(n)}return t.join(" · ")}function H(e,t,r,n,c){if(bt(e)){const o=vt(n),l=e.variants,i=e.__resolveType;l.forEach((s,m)=>{if(!s||typeof s!="object")return;const p=s,d=[];if(Z(p.rule,d),d.length===0)return;const x=yt(p.value)??(o||r);for(const g of d)c.push({blockKey:t,blockLabel:r,innerPath:o,variantIndex:m,start:g.start,end:g.end,label:x,flagResolveType:i})});for(let s=0;s<l.length;s++){const m=l[s];m&&typeof m=="object"&&H(m.value,t,r,[...n,"variants",s,"value"],c)}return}if(Array.isArray(e)){for(let o=0;o<e.length;o++)H(e[o],t,r,[...n,o],c);return}if(e&&typeof e=="object")for(const[o,l]of Object.entries(e))o!=="__resolveType"&&H(l,t,r,[...n,o],c)}function Tt(e){if(!e)return[];const t=[];for(const[r,n]of Object.entries(e))H(n,r,xt(r),[],t);return t.sort((r,n)=>r.start.getTime()-n.start.getTime())}function jt(e){const t=[...new Set(e)].sort(),r=new Map;return t.forEach((n,c)=>{const o=c*137.508%360;r.set(n,{bg:`oklch(0.62 0.14 ${o})`,text:"white",border:`oklch(0.50 0.14 ${o})`})}),r}const Nt={bg:"oklch(0.62 0.14 0)",text:"white",border:"oklch(0.50 0.14 0)"};function tt(e,t){return e.get(t)??Nt}const kt=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],et=["January","February","March","April","May","June","July","August","September","October","November","December"],wt=1440*60*1e3;function L(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function rt(e){return new Date(e.getFullYear(),e.getMonth(),1)}function $(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function I(e,t){const r=new Date(e);return r.setDate(r.getDate()+t),r}function G(e,t){return Math.round((L(e).getTime()-L(t).getTime())/wt)}function _t(e){const t=I(e,-e.getDay()),r=[];for(let n=0;n<6;n++){const c=[];for(let o=0;o<7;o++)c.push(I(t,n*7+o));r.push(c)}for(;r.length>0&&r[r.length-1].every(n=>n.getMonth()!==e.getMonth());)r.pop();return r}function Mt(e,t){const r=L(e[0]),n=I(r,7),c=[];for(const i of t){const s=L(i.start),m=L(i.end);if(m.getTime()<r.getTime()||s.getTime()>=n.getTime())continue;const p=s.getTime()<r.getTime()?r:s,d=m.getTime()>=n.getTime()?I(n,-1):m,u=G(p,r),x=G(d,p)+1;x<=0||c.push({variant:i,startCol:u,span:x})}c.sort((i,s)=>i.startCol-s.startCol||s.span-i.span||i.variant.blockKey.localeCompare(s.variant.blockKey));const o=[],l=[];for(const i of c){let s=o.findIndex(m=>m<=i.startCol);s===-1&&(s=o.length,o.push(0)),o[s]=i.startCol+i.span,l.push({...i,lane:s})}return l}const U=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeStyle:"short"});function St(e){return`${U.format(e.start)} → ${U.format(e.end)}`}function At(e){const t=R.c(17),{variant:r}=e;let n;t[0]!==r.blockLabel?(n=a.jsx("div",{className:"font-semibold",children:r.blockLabel}),t[0]=r.blockLabel,t[1]=n):n=t[1];let c;t[2]!==r.innerPath?(c=r.innerPath&&a.jsx("div",{className:"text-muted-foreground",children:r.innerPath}),t[2]=r.innerPath,t[3]=c):c=t[3];let o;t[4]!==r.blockLabel||t[5]!==r.innerPath||t[6]!==r.label?(o=r.label!==r.blockLabel&&r.label!==r.innerPath&&a.jsx("div",{className:"text-muted-foreground",children:r.label}),t[4]=r.blockLabel,t[5]=r.innerPath,t[6]=r.label,t[7]=o):o=t[7];let l;t[8]!==r?(l=St(r),t[8]=r,t[9]=l):l=t[9];let i;t[10]!==l?(i=a.jsx("div",{className:"mt-1",children:l}),t[10]=l,t[11]=i):i=t[11];let s;return t[12]!==n||t[13]!==c||t[14]!==o||t[15]!==i?(s=a.jsx(pt,{children:a.jsxs("div",{className:"text-xs",children:[n,c,o,i]})}),t[12]=n,t[13]=c,t[14]=o,t[15]=i,t[16]=s):s=t[16],s}function nt(e){const t=R.c(14),{variant:r,color:n,style:c,children:o}=e;let l;t[0]!==n.bg||t[1]!==n.text||t[2]!==c?(l={background:n.bg,color:n.text,borderRadius:4,...c},t[0]=n.bg,t[1]=n.text,t[2]=c,t[3]=l):l=t[3];let i;t[4]!==o?(i=a.jsx("span",{className:"truncate",children:o}),t[4]=o,t[5]=i):i=t[5];let s;t[6]!==l||t[7]!==i?(s=a.jsx(ct,{asChild:!0,children:a.jsx("div",{className:"absolute flex items-center px-2 text-[11px] font-medium truncate cursor-default",style:l,children:i})}),t[6]=l,t[7]=i,t[8]=s):s=t[8];let m;t[9]!==r?(m=a.jsx(At,{variant:r}),t[9]=r,t[10]=m):m=t[10];let p;return t[11]!==s||t[12]!==m?(p=a.jsxs(mt,{children:[s,m]}),t[11]=s,t[12]=m,t[13]=p):p=t[13],p}function mr(e){const t=R.c(39),{decofile:r}=e,[n,c]=K.useState("calendar"),[o,l]=K.useState(Ct);let i,s;t[0]!==r?(s=Tt(r),i=jt(s.map(Et)),t[0]=r,t[1]=i,t[2]=s):(i=t[1],s=t[2]);const m=i;let p;t[3]===Symbol.for("react.memo_cache_sentinel")?(p=()=>l(rt(new Date)),t[3]=p):p=t[3];const d=p;let u;t[4]!==n?(u=()=>l(k=>n==="calendar"?$(k,-1):$(k,-3)),t[4]=n,t[5]=u):u=t[5];const x=u;let g;t[6]!==n?(g=()=>l(k=>n==="calendar"?$(k,1):$(k,3)),t[6]=n,t[7]=g):g=t[7];const w=g;let N;t[8]===Symbol.for("react.memo_cache_sentinel")?(N=a.jsx(O,{variant:"outline",size:"sm",onClick:d,children:"Today"}),t[8]=N):N=t[8];let E;t[9]===Symbol.for("react.memo_cache_sentinel")?(E=a.jsx(at,{size:16}),t[9]=E):E=t[9];let _;t[10]!==x?(_=a.jsx(O,{variant:"ghost",size:"icon",className:"size-8",onClick:x,"aria-label":"Previous",children:E}),t[10]=x,t[11]=_):_=t[11];let f;t[12]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(lt,{size:16}),t[12]=f):f=t[12];let b;t[13]!==w?(b=a.jsx(O,{variant:"ghost",size:"icon",className:"size-8",onClick:w,"aria-label":"Next",children:f}),t[13]=w,t[14]=b):b=t[14];const M=et[o.getMonth()];let y;t[15]!==o?(y=o.getFullYear(),t[15]=o,t[16]=y):y=t[16];let v;t[17]!==M||t[18]!==y?(v=a.jsxs("h2",{className:"ml-2 text-base font-semibold",children:[M," ",y]}),t[17]=M,t[18]=y,t[19]=v):v=t[19];let T;t[20]!==v||t[21]!==_||t[22]!==b?(T=a.jsxs("div",{className:"flex items-center gap-2",children:[N,_,b,v]}),t[20]=v,t[21]=_,t[22]=b,t[23]=T):T=t[23];let C;t[24]===Symbol.for("react.memo_cache_sentinel")?(C={value:"calendar",icon:a.jsx(Q,{}),label:"Calendar"},t[24]=C):C=t[24];let j;t[25]===Symbol.for("react.memo_cache_sentinel")?(j=[C,{value:"timeline",icon:a.jsx(it,{}),label:"Timeline"}],t[25]=j):j=t[25];let h;t[26]!==n?(h=a.jsx(ft,{value:n,onValueChange:c,options:j}),t[26]=n,t[27]=h):h=t[27];let S;t[28]!==T||t[29]!==h?(S=a.jsxs("div",{className:"flex items-center justify-between px-4 h-12 border-b shrink-0",children:[T,h]}),t[28]=T,t[29]=h,t[30]=S):S=t[30];let A;t[31]!==m||t[32]!==o||t[33]!==s||t[34]!==n?(A=s.length===0?a.jsx(Dt,{}):n==="calendar"?a.jsx($t,{monthStart:o,variants:s,colorMap:m}):a.jsx(Vt,{monthStart:o,variants:s,colorMap:m}),t[31]=m,t[32]=o,t[33]=s,t[34]=n,t[35]=A):A=t[35];let D;return t[36]!==S||t[37]!==A?(D=a.jsxs("div",{className:"flex h-full w-full flex-col",children:[S,A]}),t[36]=S,t[37]=A,t[38]=D):D=t[38],D}function Et(e){return e.blockKey}function Ct(){return rt(new Date)}function Dt(){const e=R.c(1);let t;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=a.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center text-sm text-muted-foreground p-6",children:[a.jsx(Q,{size:24,className:"text-muted-foreground/60"}),a.jsx("div",{children:"No scheduled variants."}),a.jsx("div",{className:"text-xs text-muted-foreground/80",children:"Variants gated by a date matcher appear here."})]}),e[0]=t):t=e[0],t}const z=20,J=2,q=28;function $t(e){const t=R.c(17),{monthStart:r,variants:n,colorMap:c}=e;let o,l,i,s,m;if(t[0]!==c||t[1]!==r||t[2]!==n){const u=_t(r),x=L(new Date);o=X,m="flex-1 min-h-0",l="min-w-[840px]",t[8]===Symbol.for("react.memo_cache_sentinel")?(i=a.jsx("div",{className:"grid grid-cols-7 border-b text-xs text-muted-foreground sticky top-0 bg-background z-10",children:kt.map(Rt)}),t[8]=i):i=t[8],s=u.map((g,w)=>{const N=Mt(g,n),E=N.reduce(Lt,0),_=q+E*(z+J)+8;return a.jsxs("div",{className:"grid grid-cols-7 relative border-b",style:{height:_},children:[g.map((f,b)=>{const M=f.getMonth()===r.getMonth(),y=f.getTime()===x.getTime();return a.jsx("div",{className:W("border-r last:border-r-0 px-2 pt-1.5 text-xs",M?"bg-background":"bg-muted/30 text-muted-foreground"),children:a.jsx("span",{className:W("inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1",y&&"bg-primary text-primary-foreground font-semibold"),children:f.getDate()})},b)}),N.map((f,b)=>{const M=tt(c,f.variant.blockKey),y=q+f.lane*(z+J),v=f.startCol/7*100,T=f.span/7*100;return a.jsxs(nt,{variant:f.variant,color:M,style:{top:y,left:`calc(${v}% + 2px)`,width:`calc(${T}% - 4px)`,height:z},children:[f.variant.blockLabel,f.variant.label!==f.variant.blockLabel&&a.jsxs("span",{className:"opacity-70",children:[" · ",f.variant.label]})]},`${w}-${b}`)})]},w)}),t[0]=c,t[1]=r,t[2]=n,t[3]=o,t[4]=l,t[5]=i,t[6]=s,t[7]=m}else o=t[3],l=t[4],i=t[5],s=t[6],m=t[7];let p;t[9]!==l||t[10]!==i||t[11]!==s?(p=a.jsxs("div",{className:l,children:[i,s]}),t[9]=l,t[10]=i,t[11]=s,t[12]=p):p=t[12];let d;return t[13]!==o||t[14]!==m||t[15]!==p?(d=a.jsx(o,{className:m,children:p}),t[13]=o,t[14]=m,t[15]=p,t[16]=d):d=t[16],d}function Lt(e,t){return Math.max(e,t.lane+1)}function Rt(e){return a.jsx("div",{className:"px-2 py-2 text-center uppercase tracking-wide",children:e},e)}const V=4,Pt=32,P=240;function Vt(e){const t=R.c(27),{monthStart:r,variants:n,colorMap:c}=e,o=r;let l,i,s,m,p,d;if(t[0]!==c||t[1]!==r||t[2]!==o||t[3]!==n){const g=$(r,V),w=new Date,N=new Map;for(const j of n){const h=N.get(j.blockKey)??[];h.push(j),N.set(j.blockKey,h)}const E=Array.from(N.entries()).sort(Ot),_=g.getTime()-o.getTime(),f=j=>(Math.max(o.getTime(),Math.min(g.getTime(),j.getTime()))-o.getTime())/_*100;let b;t[10]!==o?(b=(j,h)=>$(o,h),t[10]=o,t[11]=b):b=t[11];const M=Array.from({length:V},b),y=w.getTime()>=o.getTime()&&w.getTime()<=g.getTime()?f(w):null;l=X,d="flex-1 min-h-0",i="min-w-[900px] relative";let v;t[12]===Symbol.for("react.memo_cache_sentinel")?(v=a.jsx("div",{className:"shrink-0 px-3 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground border-r",style:{width:P},children:"Variant / Block"}),t[12]=v):v=t[12];let T;t[13]===Symbol.for("react.memo_cache_sentinel")?(T={gridTemplateColumns:`repeat(${V}, minmax(0, 1fr))`},t[13]=T):T=t[13];const C=M.map(It);t[14]!==C?(s=a.jsxs("div",{className:"flex border-b sticky top-0 bg-background z-10",children:[v,a.jsx("div",{className:"flex-1 grid",style:T,children:C})]}),t[14]=C,t[15]=s):s=t[15],t[16]!==y?(m=y!==null&&a.jsx("div",{className:"pointer-events-none absolute top-0 bottom-0 w-px bg-primary/70 z-[5]",style:{left:`calc(${P}px + (100% - ${P}px) * ${y} / 100)`},children:a.jsx("span",{className:"absolute -top-0.5 -translate-x-1/2 rounded-sm bg-primary px-1.5 py-px text-[10px] font-medium text-primary-foreground",children:"Today"})}),t[16]=y,t[17]=m):m=t[17],p=E.map(j=>{const[h,S]=j,A=tt(c,h),D=S[0]?.blockLabel??h;return a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center bg-muted/40 border-b text-xs font-semibold uppercase tracking-wide text-muted-foreground",style:{height:28},children:a.jsx("div",{className:"px-3 truncate",style:{width:P},children:D})}),S.map((k,st)=>a.jsxs("div",{className:"flex border-b items-center",style:{height:Pt},children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 text-sm border-r shrink-0",style:{width:P},children:[a.jsx("span",{className:"inline-block h-2 w-2 rounded-full shrink-0",style:{background:A.bg}}),a.jsx("span",{className:"truncate text-foreground/80",children:k.label})]}),a.jsxs("div",{className:"relative flex-1 h-full",children:[a.jsx("div",{className:"absolute inset-0 grid",style:{gridTemplateColumns:`repeat(${V}, minmax(0, 1fr))`},children:M.map(Ht)}),(()=>{const B=Math.max(k.start.getTime(),o.getTime()),F=Math.min(k.end.getTime(),g.getTime());if(F<=B)return null;const Y=f(new Date(B)),ot=f(new Date(F))-Y;return a.jsx(nt,{variant:k,color:A,style:{top:"50%",transform:"translateY(-50%)",left:`${Y}%`,width:`calc(${ot}% - 2px)`,height:22},children:k.label})})()]})]},st))]},h)}),t[0]=c,t[1]=r,t[2]=o,t[3]=n,t[4]=l,t[5]=i,t[6]=s,t[7]=m,t[8]=p,t[9]=d}else l=t[4],i=t[5],s=t[6],m=t[7],p=t[8],d=t[9];let u;t[18]!==i||t[19]!==s||t[20]!==m||t[21]!==p?(u=a.jsxs("div",{className:i,children:[s,m,p]}),t[18]=i,t[19]=s,t[20]=m,t[21]=p,t[22]=u):u=t[22];let x;return t[23]!==l||t[24]!==d||t[25]!==u?(x=a.jsx(l,{className:d,children:u}),t[23]=l,t[24]=d,t[25]=u,t[26]=x):x=t[26],x}function Ht(e,t){return a.jsx("div",{className:"border-r last:border-r-0 border-border/40"},t)}function It(e,t){return a.jsxs("div",{className:"px-2 py-2 text-xs uppercase tracking-wide text-muted-foreground border-r last:border-r-0",children:[et[e.getMonth()]?.slice(0,3)," ",e.getFullYear()]},t)}function Ot(e,t){return e[0].localeCompare(t[0])}export{mr as VariantCalendar};
@@ -1 +0,0 @@
1
- import{e as k,r as C,c as x,j as i}from"./index-EQfvflqN.js";import{b as I,T as P,a as L}from"./tooltip-DZelUdM0.js";const M={sm:{button:"size-7",icon:"size-4"},md:{button:"size-9",icon:"size-5"},lg:{button:"size-12",icon:"size-6"}};function B(S){const e=k.c(27),{value:s,onValueChange:y,options:o,size:R,fullWidth:E,className:z}=S,V=R===void 0?"sm":R,u=E===void 0?!1:E;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=[],e[0]=b):b=e[0];const _=C.useRef(b);let g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g={left:0,width:0,opacity:0},e[1]=g):g=e[1];const[f,W]=C.useState(g);let h,p;e[2]!==o||e[3]!==s?(h=()=>{const t=o.findIndex(j=>j.value===s),m=_.current[t];m&&W({left:m.offsetLeft,width:m.offsetWidth,opacity:1})},p=[s,o],e[2]=o,e[3]=s,e[4]=h,e[5]=p):(h=e[4],p=e[5]),C.useEffect(h,p);const d=M[V];let n;e[6]!==z?(n=x("relative flex gap-0 bg-muted rounded-lg",z),e[6]=z,e[7]=n):n=e[7];let l;e[8]!==d||e[9]!==u||e[10]!==y||e[11]!==o||e[12]!==s?(l=o.map((t,m)=>{const j=i.jsxs("button",{ref:$=>{_.current[m]=$},type:"button",onClick:()=>y(t.value),className:x("relative z-10 flex items-center justify-center gap-2 rounded-lg transition-colors [transition-timing-function:var(--ease-out-cubic)] duration-200",u?"flex-1 h-12 px-4":d.button,!u&&t.label?"px-3":""),children:[i.jsx("span",{className:x("transition-colors ease-out duration-200 flex items-center justify-center [&>svg]:size-[1em]",d.icon,s===t.value?"text-foreground":"text-muted-foreground"),children:t.icon}),t.label&&i.jsx("span",{className:x("text-xs transition-colors ease-out duration-200 whitespace-nowrap",s===t.value?"text-foreground":"text-muted-foreground"),children:t.label})]},t.value);return t.tooltip?i.jsxs(I,{children:[i.jsx(P,{asChild:!0,children:j}),i.jsx(L,{side:"bottom",children:t.tooltip})]},t.value):j}),e[8]=d,e[9]=u,e[10]=y,e[11]=o,e[12]=s,e[13]=l):l=e[13];const w=u?"h-12":d.button;let a;e[14]!==w?(a=x("absolute z-0 bg-background rounded-lg border-shadow transition-all [transition-timing-function:var(--ease-out-cubic)] duration-200",w),e[14]=w,e[15]=a):a=e[15];const N=`${f.left}px`,T=`${f.width}px`;let r;e[16]!==f.opacity||e[17]!==N||e[18]!==T?(r={left:N,width:T,opacity:f.opacity},e[16]=f.opacity,e[17]=N,e[18]=T,e[19]=r):r=e[19];let c;e[20]!==a||e[21]!==r?(c=i.jsx("div",{className:a,style:r}),e[20]=a,e[21]=r,e[22]=c):c=e[22];let v;return e[23]!==c||e[24]!==n||e[25]!==l?(v=i.jsxs("div",{className:n,children:[l,c]}),e[23]=c,e[24]=n,e[25]=l,e[26]=v):v=e[26],v}export{B as V};