decocms 4.112.1 → 4.113.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/client/assets/{AlertCircle-BPAJ0AH_.js → AlertCircle-1nu6iy2O.js} +1 -1
  2. package/dist/client/assets/{AreaChart-D25dOd9L.js → AreaChart-VOSiBQuc.js} +1 -1
  3. package/dist/client/assets/{ArrowRight-DPHDASHB.js → ArrowRight-Bv77srvJ.js} +1 -1
  4. package/dist/client/assets/{ArrowUp-Bedb6L3V.js → ArrowUp-vGbILDUJ.js} +1 -1
  5. package/dist/client/assets/{ArrowUpRight-DVT7itvm.js → ArrowUpRight-CvAvSFF6.js} +1 -1
  6. package/dist/client/assets/{Check-DVdr-fHD.js → Check-DZuO_3-U.js} +1 -1
  7. package/dist/client/assets/{CheckCircle-qFtrLK-I.js → CheckCircle-DFYupWQE.js} +1 -1
  8. package/dist/client/assets/{ChevronDown-CP4K6WVC.js → ChevronDown-DNmWCLs3.js} +1 -1
  9. package/dist/client/assets/{ChevronRight-CURNdwHv.js → ChevronRight-CAmdYWp6.js} +1 -1
  10. package/dist/client/assets/{ChevronUp-Bq5QY1HH.js → ChevronUp-B4i6gipC.js} +1 -1
  11. package/dist/client/assets/{Copy01-BrM3zThJ.js → Copy01-cUeCwxLt.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-CAEab9-7.js → DotsVertical-C2nl0Bhp.js} +1 -1
  13. package/dist/client/assets/{Eye-BPSpUM1B.js → Eye-D-f59z2c.js} +1 -1
  14. package/dist/client/assets/{FilterLines-9idf71sf.js → FilterLines-DvBT56q0.js} +1 -1
  15. package/dist/client/assets/{Globe01-CRpOJGMW.js → Globe01-B0yOhk7q.js} +1 -1
  16. package/dist/client/assets/{Globe04-Df-FgXkI.js → Globe04-CnZTmzk0.js} +1 -1
  17. package/dist/client/assets/{HardDrive-CTD7kn1_.js → HardDrive-vC7iw4BV.js} +1 -1
  18. package/dist/client/assets/{Image01-CXegS0cf.js → Image01-BNfiJ_Ri.js} +1 -1
  19. package/dist/client/assets/{Key01-D4boOCfw.js → Key01-B4j6_eCF.js} +1 -1
  20. package/dist/client/assets/{LayoutLeft-Ct7yqT-8.js → LayoutLeft-Cl-npUPX.js} +1 -1
  21. package/dist/client/assets/{LinkExternal01-Bt0kypGl.js → LinkExternal01-FeDiEFvO.js} +1 -1
  22. package/dist/client/assets/{LogOut01-gzymfeiL.js → LogOut01-Cfw7OaDJ.js} +1 -1
  23. package/dist/client/assets/{Monitor01-lASV4aL_.js → Monitor01-Cefkrlpc.js} +1 -1
  24. package/dist/client/assets/{Package-4wIx6EXV.js → Package-CX9Ji2oC.js} +1 -1
  25. package/dist/client/assets/{Palette-DQcG6f10.js → Palette-6aMhcbus.js} +1 -1
  26. package/dist/client/assets/{Play-BxXVqH8a.js → Play-DttcR2c0.js} +1 -1
  27. package/dist/client/assets/{Plus-DvkwjQys.js → Plus-CrmrtePf.js} +1 -1
  28. package/dist/client/assets/{SearchLg-BdXxED9F.js → SearchLg-CGg8npcS.js} +1 -1
  29. package/dist/client/assets/{SearchMd-BXStN27m.js → SearchMd-I_6dwmem.js} +1 -1
  30. package/dist/client/assets/{Settings02-CxO9BwAX.js → Settings02-d7C5fgvm.js} +1 -1
  31. package/dist/client/assets/{Shield01-B7UX37fq.js → Shield01-BHRYEUXG.js} +1 -1
  32. package/dist/client/assets/{Star01-B9yyP_dl.js → Star01-BXyPOmxC.js} +1 -1
  33. package/dist/client/assets/{Stars01-DzCuVtlp.js → Stars01-BR9FMVQ-.js} +1 -1
  34. package/dist/client/assets/{Stars02-BbJELdJJ.js → Stars02-D_SVLZzo.js} +1 -1
  35. package/dist/client/assets/{Sun-CQBv42eA.js → Sun-Cp5c77yW.js} +1 -1
  36. package/dist/client/assets/{SwitchHorizontal01-BCuXg9EG.js → SwitchHorizontal01-DDUsVJkM.js} +1 -1
  37. package/dist/client/assets/{Tool01-BK-Abo_W.js → Tool01-BKum9UWD.js} +1 -1
  38. package/dist/client/assets/{Tool02-Cuvgxmz_.js → Tool02-CtSGODZV.js} +1 -1
  39. package/dist/client/assets/{Trash01-Dg0PRDGo.js → Trash01-CO6gYfEV.js} +1 -1
  40. package/dist/client/assets/{TrendUp01-DxN3AiAM.js → TrendUp01-BtkZhqF1.js} +1 -1
  41. package/dist/client/assets/{Upload01-IlLQszJa.js → Upload01-CcvUirbw.js} +1 -1
  42. package/dist/client/assets/{User01-DAuN3raG.js → User01-C4p8AFg1.js} +1 -1
  43. package/dist/client/assets/{Users01-ClVtIpAF.js → Users01-CsNKwKZh.js} +1 -1
  44. package/dist/client/assets/{Users03-DranLzQa.js → Users03-DecO1W_9.js} +1 -1
  45. package/dist/client/assets/{X-D2byo9sM.js → X-9R1SCvpR.js} +1 -1
  46. package/dist/client/assets/{XCircle-7Vp7VZO2.js → XCircle-g_LTmCsw.js} +1 -1
  47. package/dist/client/assets/{XClose-C_sKhdsy.js → XClose-Cnmuk8Ko.js} +1 -1
  48. package/dist/client/assets/{Zap-CTWtvhM-.js → Zap-DYyOoOsC.js} +1 -1
  49. package/dist/client/assets/{ZapSquare-PYKE-3Yk.js → ZapSquare-tf_yHnjW.js} +1 -1
  50. package/dist/client/assets/{ZoomOut-Dku36CkB.js → ZoomOut-lAL6vnTY.js} +1 -1
  51. package/dist/client/assets/{access-gate-V__oxJQU.js → access-gate-BPTrlhSW.js} +1 -1
  52. package/dist/client/assets/{add-section-modal-Dz2CIZCQ.js → add-section-modal-Tw-No2pW.js} +1 -1
  53. package/dist/client/assets/{agent-icon-DboEKEwb.js → agent-icon-8M4EsQDg.js} +1 -1
  54. package/dist/client/assets/{agents-list-d0_V3zC5.js → agents-list-GbRaVUyR.js} +1 -1
  55. package/dist/client/assets/{ai-providers-p-o56TbN.js → ai-providers-LxJmZO6m.js} +1 -1
  56. package/dist/client/assets/{alert-OfMKhXOE.js → alert-BcND6-PQ.js} +1 -1
  57. package/dist/client/assets/{alert-dialog-CAjnI-sk.js → alert-dialog-7uhMzMe-.js} +1 -1
  58. package/dist/client/assets/{app-editor-DG5ESbAh.js → app-editor-DwPoxnnZ.js} +1 -1
  59. package/dist/client/assets/{auth-DL46EIm-.js → auth-CGHXgyTz.js} +1 -1
  60. package/dist/client/assets/{auth-catchall-b2ADNteC.js → auth-catchall-BuGsum5Y.js} +1 -1
  61. package/dist/client/assets/{auth-entry-D8bWuy4I.js → auth-entry-DeRLUfCB.js} +1 -1
  62. package/dist/client/assets/{auth-split-layout-B4a4Xdor.js → auth-split-layout-B8xL1Q1s.js} +1 -1
  63. package/dist/client/assets/{authenticate-and-persist-oauth-LnJEhLBB.js → authenticate-and-persist-oauth-B9Bijlsj.js} +1 -1
  64. package/dist/client/assets/{automation-list-row-DW9WNcl6.js → automation-list-row-D_9J0wLL.js} +1 -1
  65. package/dist/client/assets/{automation-runs-BU7awJwF.js → automation-runs-URg1IHZU.js} +1 -1
  66. package/dist/client/assets/{automations-BdFtkBKU.js → automations-DID04Tj6.js} +1 -1
  67. package/dist/client/assets/{autosend-q2XXJhGf.js → autosend-Dv0LCgCt.js} +1 -1
  68. package/dist/client/assets/{avatar-BMQSTz7T.js → avatar-MEGj1wbQ.js} +1 -1
  69. package/dist/client/assets/{badge-DTgp6kSY.js → badge-DrkRrH-Z.js} +1 -1
  70. package/dist/client/assets/{block-document-En1-9m4T.js → block-document-X-enrWQX.js} +1 -1
  71. package/dist/client/assets/{brand-context-Dwapn05Q.js → brand-context-CNW6sayx.js} +1 -1
  72. package/dist/client/assets/{buckets-DEE1QH7D.js → buckets-0amRgbhC.js} +1 -1
  73. package/dist/client/assets/{bulk-category-panel-Bvu632yW.js → bulk-category-panel-BPWIksFS.js} +1 -1
  74. package/dist/client/assets/{calendar-DE27O6B3.js → calendar-CpNkAg6y.js} +1 -1
  75. package/dist/client/assets/{capability-load-error-DRgusnL-.js → capability-load-error-DWhYVBm5.js} +1 -1
  76. package/dist/client/assets/{card-C1E3IqIe.js → card-Cj2PCxJl.js} +1 -1
  77. package/dist/client/assets/{category-editor-D4kEsE60.js → category-editor-Blgt0j22.js} +1 -1
  78. package/dist/client/assets/{chat-context-Bqe9EjUf.js → chat-context-B7VnnFIL.js} +6 -6
  79. package/dist/client/assets/{checkbox-DucL6lfV.js → checkbox-KHKmf4BM.js} +1 -1
  80. package/dist/client/assets/{cli-auth-success-BkCktMU5.js → cli-auth-success-IoYzDE_s.js} +1 -1
  81. package/dist/client/assets/{collection-detail-DUwAO62w.js → collection-detail-DEs-ylaz.js} +1 -1
  82. package/dist/client/assets/{collection-display-button-BDbR9SRz.js → collection-display-button-9bP0cC4K.js} +1 -1
  83. package/dist/client/assets/{collection-search-BeQcHO0e.js → collection-search-CzJO1Bet.js} +1 -1
  84. package/dist/client/assets/{collection-table-wrapper-DbIfg3Tu.js → collection-table-wrapper-xL5kYayH.js} +1 -1
  85. package/dist/client/assets/{collection-tabs-B-z06u3L.js → collection-tabs-Df0khv4d.js} +1 -1
  86. package/dist/client/assets/{command-BpaxudUr.js → command-Bm0y96nt.js} +1 -1
  87. package/dist/client/assets/{commerce-onboarding-C6AQvriJ.js → commerce-onboarding-DsBen__k.js} +1 -1
  88. package/dist/client/assets/{companions-core-BKdg1X4N.js → companions-core-BuHhSBmb.js} +1 -1
  89. package/dist/client/assets/{connect-DwDf5hM9.js → connect-C9aWv1jr.js} +1 -1
  90. package/dist/client/assets/{connect-desktop-dialog-Dop9zIy0.js → connect-desktop-dialog-DkfyrIIk.js} +1 -1
  91. package/dist/client/assets/{connection-card-YkA4B3Y2.js → connection-card-DOyv0WHW.js} +1 -1
  92. package/dist/client/assets/{connection-detail-B7fdM_RU.js → connection-detail-BuUwJaUe.js} +1 -1
  93. package/dist/client/assets/{connection-form-helpers-CEAyvcoM.js → connection-form-helpers-BRE4mupD.js} +1 -1
  94. package/dist/client/assets/{connections-CTLVBVZ-.js → connections-V0AO_S5n.js} +1 -1
  95. package/dist/client/assets/{decopilot-sse-pool-DvS9xmzn.js → decopilot-sse-pool-B9mIJbCT.js} +1 -1
  96. package/dist/client/assets/{dialog-DuG3B5hN.js → dialog-CrhPWlsu.js} +1 -1
  97. package/dist/client/assets/{domain-settings-BQZ9bk3J.js → domain-settings-Cbg8zMo1.js} +1 -1
  98. package/dist/client/assets/{drawer-C2jN8NT3.js → drawer-CKDocp3V.js} +1 -1
  99. package/dist/client/assets/{dropdown-menu-BNF_6r-n.js → dropdown-menu-DsoLLp1X.js} +1 -1
  100. package/dist/client/assets/{empty-state-uOBrYEmx.js → empty-state-B5D554Sf.js} +1 -1
  101. package/dist/client/assets/{extract-connection-data-mjantdQ3.js → extract-connection-data-lQlzAEx8.js} +1 -1
  102. package/dist/client/assets/{file-explorer-HVD4zjOj.js → file-explorer-B9IUO4TG.js} +1 -1
  103. package/dist/client/assets/{file-type-icon-DmqsPWVn.js → file-type-icon-Cw0xACB1.js} +1 -1
  104. package/dist/client/assets/{files-DLlwt5M5.js → files-Byh09W_o.js} +1 -1
  105. package/dist/client/assets/{form-CfiVR7-E.js → form-B9MzfW7Q.js} +1 -1
  106. package/dist/client/assets/{general-DQpko3z7.js → general-D_EvmRr2.js} +1 -1
  107. package/dist/client/assets/{github-repo-picker-B67xOvpE.js → github-repo-picker-DG5mwuJS.js} +1 -1
  108. package/dist/client/assets/{hooks--B2ClHkv.js → hooks-C8vbzir9.js} +6 -6
  109. package/dist/client/assets/{index-BjqdNfD4.js → index-AWx-XTyH.js} +3 -3
  110. package/dist/client/assets/{index-C7C6Raa3.js → index-B9uAt2_s.js} +1 -1
  111. package/dist/client/assets/{index-D6ISBRIZ.js → index-BfAh5ctt.js} +1 -1
  112. package/dist/client/assets/{index-CRhw6MPR.js → index-BgS-opEq.js} +1 -1
  113. package/dist/client/assets/{index-GHnBSXbp.js → index-BtUwGdgo.js} +1 -1
  114. package/dist/client/assets/{index-DrYlRUBO.js → index-C-n-2ep-.js} +1 -1
  115. package/dist/client/assets/{index-DQL_sX_z.js → index-D0ic3MqZ.js} +1 -1
  116. package/dist/client/assets/{index-B4v8cE0Y.js → index-D2PVjV4h.js} +1 -1
  117. package/dist/client/assets/{index-DzT6le2T.js → index-DK3kyqme.js} +1 -1
  118. package/dist/client/assets/{index-BEZBfxfq.js → index-DZDoPjn7.js} +3 -3
  119. package/dist/client/assets/{index-BP_x5C5G.js → index-Doki-u4s.js} +1 -1
  120. package/dist/client/assets/{index-DlK5F-9g.js → index-JzA_F9uE.js} +1 -1
  121. package/dist/client/assets/{index-Cd6V9L5H.js → index-NLROv-P0.js} +26 -26
  122. package/dist/client/assets/{index-redirect-f80Laun7.js → index-redirect-Ces2tOuF.js} +1 -1
  123. package/dist/client/assets/{input-DVKWqN4B.js → input-dOJy3p-z.js} +1 -1
  124. package/dist/client/assets/{integration-icon-01krASjY.js → integration-icon-NYn3l4Cv.js} +1 -1
  125. package/dist/client/assets/{invite-member-dialog-C30-4wkQ.js → invite-member-dialog-PA_xYY28.js} +1 -1
  126. package/dist/client/assets/{label-DzsNH7Is.js → label-T39xqSsk.js} +1 -1
  127. package/dist/client/assets/{layout-BPSuHpAi.js → layout-D9Ht8nwi.js} +1 -1
  128. package/dist/client/assets/{login-DMnYXve8.js → login-B7cnM25w.js} +1 -1
  129. package/dist/client/assets/{mcp-oauth-_4C32xnP.js → mcp-oauth-CQOT6ZPC.js} +1 -1
  130. package/dist/client/assets/{members-DopgSvLD.js → members-CDwKqxuK.js} +1 -1
  131. package/dist/client/assets/{monaco-editor-Cvn-LJcd.js → monaco-editor-CGcI0ABN.js} +1 -1
  132. package/dist/client/assets/{monitoring-stats-row-DH7gWSkT.js → monitoring-stats-row-BLSD-hjW.js} +1 -1
  133. package/dist/client/assets/{multi-select-VwHL_OgI.js → multi-select-Cf3XuaeM.js} +1 -1
  134. package/dist/client/assets/{oauth-callback-BAa2XKVb.js → oauth-callback-DBwI7cZP.js} +1 -1
  135. package/dist/client/assets/{oauth-callback-ai-provider-CS6Wvb7F.js → oauth-callback-ai-provider-DUmvFxTM.js} +1 -1
  136. package/dist/client/assets/{onboarding-vbNUruQ8.js → onboarding-BcPIB_up.js} +1 -1
  137. package/dist/client/assets/{org-install-syKja4u5.js → org-install-ib1gGGBk.js} +1 -1
  138. package/dist/client/assets/{org-layout-BY6L7U5G.js → org-layout-DzweICfd.js} +1 -1
  139. package/dist/client/assets/{organization-choice-Ca4Dtqx4.js → organization-choice-DsZbq96B.js} +1 -1
  140. package/dist/client/assets/{orgs-DD3fRDFA.js → orgs-BrtlMrzA.js} +1 -1
  141. package/dist/client/assets/{page-seo-form-Dzn3gLSm.js → page-seo-form-DlD0MYWz.js} +1 -1
  142. package/dist/client/assets/page-seo-sheet-Brf8QwRX.js +1 -0
  143. package/dist/client/assets/{popover-SQDnlMpS.js → popover-DPpEWtTO.js} +1 -1
  144. package/dist/client/assets/{post-editor-Cov0mKWE.js → post-editor-BhTnEJJu.js} +1 -1
  145. package/dist/client/assets/{primitives-CPIgjGnw.js → primitives-DqtVeEzM.js} +1 -1
  146. package/dist/client/assets/{profile-NXhUR-9P.js → profile-vVhm8rfo.js} +1 -1
  147. package/dist/client/assets/project-app-view-Du26cIqG.js +1 -0
  148. package/dist/client/assets/record-editor-CExlSWRW.js +1 -0
  149. package/dist/client/assets/redirect-editor-Djpy2zTg.js +1 -0
  150. package/dist/client/assets/registry-D1wIrTmN.js +2 -0
  151. package/dist/client/assets/{registry-layout-CmIJcs6x.js → registry-layout-BkwEkx4a.js} +1 -1
  152. package/dist/client/assets/{reports-8jvxKoAI.js → reports-DEOB92jP.js} +1 -1
  153. package/dist/client/assets/{require-capability-abQVxnhi.js → require-capability-i2Ucbfy-.js} +1 -1
  154. package/dist/client/assets/{required-auth-layout-ZhKgR5cl.js → required-auth-layout-R2uHvriE.js} +1 -1
  155. package/dist/client/assets/{reset-password-CBUiONN1.js → reset-password-DbdghccO.js} +1 -1
  156. package/dist/client/assets/{roles-BLQFcEke.js → roles-C4Kk-tfc.js} +1 -1
  157. package/dist/client/assets/{search-input-Bp2VsjKA.js → search-input-Cy8zAf8w.js} +1 -1
  158. package/dist/client/assets/{secrets-D-Y6gN0-.js → secrets-DRUfprUc.js} +1 -1
  159. package/dist/client/assets/{sections-editor-C-xRLscC.js → sections-editor-CmSQnnud.js} +1 -1
  160. package/dist/client/assets/{select-CHVMib0e.js → select-C-c84gqD.js} +1 -1
  161. package/dist/client/assets/{select-model-LfcTr4nG.js → select-model-BvmJgxWT.js} +1 -1
  162. package/dist/client/assets/{self-tool-result-CBc1wtRN.js → self-tool-result-D8lHMbx9.js} +1 -1
  163. package/dist/client/assets/{seo-editor-DUKuzRGf.js → seo-editor-Da2lSCxN.js} +1 -1
  164. package/dist/client/assets/{settings-layout-CDDdQ2e0.js → settings-layout-CBN0VsBR.js} +1 -1
  165. package/dist/client/assets/{settings-section-IUcnM38x.js → settings-section-2RaI_swU.js} +1 -1
  166. package/dist/client/assets/{shell-controls-DERol15Q.js → shell-controls-BZZvwekM.js} +1 -1
  167. package/dist/client/assets/shell-layout-BVbG3CWD.js +1 -0
  168. package/dist/client/assets/{sidebar-BRu-Erl0.js → sidebar-1nUBTcZ5.js} +1 -1
  169. package/dist/client/assets/{skeleton-BJdGBxDn.js → skeleton-CO3sKI5a.js} +1 -1
  170. package/dist/client/assets/{sso-CSce7CAV.js → sso-CUSzW5HN.js} +1 -1
  171. package/dist/client/assets/{store-Cvx8HpGf.js → store-DPmuNEdD.js} +1 -1
  172. package/dist/client/assets/store-registry-Bx7RfDMl.js +2 -0
  173. package/dist/client/assets/{studio-tools-B6TBpJy3.js → studio-tools-DNNqlbd5.js} +1 -1
  174. package/dist/client/assets/{switch-GzXyTa7t.js → switch-BEXuD_4N.js} +1 -1
  175. package/dist/client/assets/{table-C_uxr9RS.js → table-DV9ZtLzo.js} +1 -1
  176. package/dist/client/assets/{tabs-D0HTooRp.js → tabs-Bt3wxC0x.js} +1 -1
  177. package/dist/client/assets/{textarea-ZMDvthPv.js → textarea-j70QHwPE.js} +1 -1
  178. package/dist/client/assets/{toggle-group-D7e2is13.js → toggle-group-DTsKZMhu.js} +1 -1
  179. package/dist/client/assets/{toolbar-Cof1BRQU.js → toolbar-EUeTADQp.js} +1 -1
  180. package/dist/client/assets/{toolbar-icon-button-BpU4_fmO.js → toolbar-icon-button-p1Exse_j.js} +1 -1
  181. package/dist/client/assets/{tooltip-DhTKpLao.js → tooltip-u2UtZ4A6.js} +1 -1
  182. package/dist/client/assets/{use-ai-providers-e0TsvBpy.js → use-ai-providers-BDAE_9bK.js} +1 -1
  183. package/dist/client/assets/{use-api-keys-DPpqUPAA.js → use-api-keys-DTRvCTl9.js} +1 -1
  184. package/dist/client/assets/{use-automations-Cl7PLc9i.js → use-automations-DZ7eW24Z.js} +1 -1
  185. package/dist/client/assets/{use-autosave-lDLGG4vQ.js → use-autosave-DHNtPWHe.js} +1 -1
  186. package/dist/client/assets/{use-capability-vqVc-i11.js → use-capability-C5eUQLBX.js} +1 -1
  187. package/dist/client/assets/{use-clock-tick-B2mHIRSx.js → use-clock-tick-CC4WfjKj.js} +1 -1
  188. package/dist/client/assets/{use-connection-BAQMsrJq.js → use-connection-K5A04m_I.js} +1 -1
  189. package/dist/client/assets/{use-copy-BVuBsBUL.js → use-copy-BZTzgFC4.js} +1 -1
  190. package/dist/client/assets/{use-create-virtual-mcp-9yNesJw-.js → use-create-virtual-mcp-BSHEXGD1.js} +1 -1
  191. package/dist/client/assets/{use-debounced-autosave-3nLcw0lp.js → use-debounced-autosave-q1vpVxuQ.js} +1 -1
  192. package/dist/client/assets/{use-debounced-value-Bm87M4-z.js → use-debounced-value-DMQt5ciW.js} +1 -1
  193. package/dist/client/assets/use-deco-credits-CKbezexf.js +1 -0
  194. package/dist/client/assets/{use-decopilot-events-4nMOerOw.js → use-decopilot-events-DAK06Wu1.js} +1 -1
  195. package/dist/client/assets/{use-delete-connection-CXDffDTB.js → use-delete-connection-GXKe8SDv.js} +1 -1
  196. package/dist/client/assets/{use-deployment-admin-Co7CH0Lj.js → use-deployment-admin-D5wIRWI7.js} +1 -1
  197. package/dist/client/assets/{use-file-configs-DvDXTQzY.js → use-file-configs-Cj04vyGe.js} +1 -1
  198. package/dist/client/assets/{use-infinite-scroll-CDTP3cPC.js → use-infinite-scroll-CeeyEYVQ.js} +1 -1
  199. package/dist/client/assets/{use-join-requests-DNpwA7f9.js → use-join-requests-BwkyTh59.js} +1 -1
  200. package/dist/client/assets/{use-mcp-auth-status-Ddb476WY.js → use-mcp-auth-status-DwTO64b5.js} +1 -1
  201. package/dist/client/assets/{use-mcp-client-BT39mx9A.js → use-mcp-client-BBGyfAUZ.js} +1 -1
  202. package/dist/client/assets/{use-mcp-tools-CGxK1_gj.js → use-mcp-tools-Jn_TQz9P.js} +1 -1
  203. package/dist/client/assets/{use-members-_FPM_T6c.js → use-members-eCfD7hF7.js} +1 -1
  204. package/dist/client/assets/{use-mobile-DSMb8fwP.js → use-mobile-BA7Xr9l-.js} +1 -1
  205. package/dist/client/assets/{use-navigate-to-agent-zu-n6oJ9.js → use-navigate-to-agent-CyXF9Nfp.js} +1 -1
  206. package/dist/client/assets/{use-org-auth-client-DS3AIARn.js → use-org-auth-client-eKS3tfiU.js} +1 -1
  207. package/dist/client/assets/{use-org-sso-Cfer4AMn.js → use-org-sso-B36TFjSA.js} +1 -1
  208. package/dist/client/assets/{use-organization-roles-CDueCpaQ.js → use-organization-roles-CkWMeF4W.js} +1 -1
  209. package/dist/client/assets/{use-organization-settings-BnHHp7Sg.js → use-organization-settings-CCooUYOF.js} +1 -1
  210. package/dist/client/assets/{use-registry-app-ClxY6KTL.js → use-registry-app-DzTRc8RZ.js} +1 -1
  211. package/dist/client/assets/{use-registry-connections-DFS0CxCI.js → use-registry-connections-BXtcs4tY.js} +1 -1
  212. package/dist/client/assets/{use-secrets-B83Wtq69.js → use-secrets-BFVqvpqO.js} +1 -1
  213. package/dist/client/assets/{use-status-sounds-spkqD0E7.js → use-status-sounds-BXgit-2A.js} +1 -1
  214. package/dist/client/assets/{use-view-mode-DxVGeXom.js → use-view-mode-BdFIHCF7.js} +1 -1
  215. package/dist/client/assets/{use-virtual-mcp-DI0WnvSW.js → use-virtual-mcp-Dw5dc6PG.js} +1 -1
  216. package/dist/client/assets/useInfiniteQuery-B7RwoVuT.js +1 -0
  217. package/dist/client/assets/{useQueries-BUIk3SI1.js → useQueries--fyH1BAg.js} +1 -1
  218. package/dist/client/assets/{useRouterState-C7lhZIXx.js → useRouterState-upuX1K7o.js} +1 -1
  219. package/dist/client/assets/useSuspenseInfiniteQuery-fKYTkkuN.js +1 -0
  220. package/dist/client/assets/{users-CyMJWljJ.js → users-C3loELtf.js} +1 -1
  221. package/dist/client/assets/{variant-calendar-DYdx-NyQ.js → variant-calendar-CRCowikR.js} +1 -1
  222. package/dist/client/assets/{view-mode-toggle-BUGE4j9R.js → view-mode-toggle-Cy5NG04k.js} +1 -1
  223. package/dist/client/index.html +1 -1
  224. package/dist/server/cli.js +617 -621
  225. package/dist/server/server.js +312 -312
  226. package/package.json +1 -1
  227. package/dist/client/assets/page-seo-sheet-C2ZuGi6g.js +0 -1
  228. package/dist/client/assets/project-app-view-aeAAnT3p.js +0 -1
  229. package/dist/client/assets/record-editor-B9G-sOGn.js +0 -1
  230. package/dist/client/assets/redirect-editor--IxkTzn1.js +0 -1
  231. package/dist/client/assets/registry-DdvfpIFB.js +0 -2
  232. package/dist/client/assets/shell-layout-BLqcIFgl.js +0 -1
  233. package/dist/client/assets/store-registry-COelq8y_.js +0 -2
  234. package/dist/client/assets/use-deco-credits-Dkt5IHkt.js +0 -1
  235. package/dist/client/assets/useInfiniteQuery-DiI89mMf.js +0 -1
  236. package/dist/client/assets/useSuspenseInfiniteQuery-B7Phg5ay.js +0 -1
@@ -1 +1 @@
1
- import{c as u,F as m,n as g,K as p}from"./index-BjqdNfD4.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
+ import{c as u,F as m,n as g,K as p}from"./index-AWx-XTyH.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 +1 @@
1
- import{i as a}from"./AlertCircle-BPAJ0AH_.js";import{i as c}from"./CheckCircle-qFtrLK-I.js";import{i as u}from"./DotsVertical-CAEab9-7.js";import{aL as m}from"./agent-icon-DboEKEwb.js";import{k as b,c as d,r as f}from"./index-BjqdNfD4.js";import{i as p}from"./XCircle-7Vp7VZO2.js";const g={requires_action:{label:"Needs review",verb:"Waiting for your review",icon:a,iconClassName:"text-warning",labelColor:"text-warning"},failed:{label:"Failed",verb:"Something went wrong",icon:p,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{label:"Timed out",verb:"Stopped responding",icon:m,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{label:"Running",verb:"Agent is working",icon:b,iconClassName:"text-primary",labelColor:"text-primary"},completed:{label:"Done",verb:"Completed",icon:c,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},v={label:"Unknown",verb:"Unknown status",icon:u,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function y(r){return g[r??"completed"]??v}const i=new Map;function s(r){let t=i.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},i.set(r,t)),t}function x(r,t){const e=s(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const o of e.subscribers)o()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function T(r){const t=d.c(3),e=r===void 0?6e4:r;let o,n;return t[0]!==e?(o=l=>x(e,l),n=()=>s(e).tick,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),f.useSyncExternalStore(o,n,C)}function C(){return 0}export{g as S,y as g,T as u};
1
+ import{i as a}from"./AlertCircle-1nu6iy2O.js";import{i as c}from"./CheckCircle-DFYupWQE.js";import{i as u}from"./DotsVertical-C2nl0Bhp.js";import{aL as m}from"./agent-icon-8M4EsQDg.js";import{k as b,c as d,r as f}from"./index-AWx-XTyH.js";import{i as p}from"./XCircle-g_LTmCsw.js";const g={requires_action:{label:"Needs review",verb:"Waiting for your review",icon:a,iconClassName:"text-warning",labelColor:"text-warning"},failed:{label:"Failed",verb:"Something went wrong",icon:p,iconClassName:"text-destructive",labelColor:"text-destructive"},expired:{label:"Timed out",verb:"Stopped responding",icon:m,iconClassName:"text-warning",labelColor:"text-warning"},in_progress:{label:"Running",verb:"Agent is working",icon:b,iconClassName:"text-primary",labelColor:"text-primary"},completed:{label:"Done",verb:"Completed",icon:c,iconClassName:"text-muted-foreground/50",labelColor:"text-muted-foreground"}},v={label:"Unknown",verb:"Unknown status",icon:u,iconClassName:"text-muted-foreground",labelColor:"text-muted-foreground"};function y(r){return g[r??"completed"]??v}const i=new Map;function s(r){let t=i.get(r);return t||(t={tick:0,subscribers:new Set,intervalId:null},i.set(r,t)),t}function x(r,t){const e=s(r);return e.subscribers.add(t),e.intervalId===null&&(e.intervalId=setInterval(()=>{e.tick+=1;for(const o of e.subscribers)o()},r)),()=>{e.subscribers.delete(t),e.subscribers.size===0&&e.intervalId!==null&&(clearInterval(e.intervalId),e.intervalId=null)}}function T(r){const t=d.c(3),e=r===void 0?6e4:r;let o,n;return t[0]!==e?(o=l=>x(e,l),n=()=>s(e).tick,t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),f.useSyncExternalStore(o,n,C)}function C(){return 0}export{g as S,y as g,T as u};
@@ -1 +1 @@
1
- import{c as f,F as C,dY as S,bc as p,bb as T}from"./index-BjqdNfD4.js";import{S as I,u as A}from"./use-mcp-client-BT39mx9A.js";function v(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 g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{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 O=A(a);return S(u.id,"CONNECTIONS",O,N)}function E(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=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){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=A(i);return p(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
1
+ import{c as f,F as C,dY as S,bc as p,bb as T}from"./index-AWx-XTyH.js";import{S as I,u as A}from"./use-mcp-client-BBGyfAUZ.js";function v(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 g;o[12]!==e?(g=Object.keys(e).length>0?e:void 0,o[12]=e,o[13]=g):g=o[13];let r;o[14]!==s||o[15]!==g?(r={...s,additionalToolArgs:g},o[14]=s,o[15]=g,o[16]=r):r=o[16];const N=r,{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 O=A(a);return S(u.id,"CONNECTIONS",O,N)}function E(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=A(n);return T(i.id,"CONNECTIONS",t,l)}function _(){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=A(i);return p(o.id,"CONNECTIONS",n)}export{E as a,_ as b,v as u};
@@ -1 +1 @@
1
- import{c as i,r as n}from"./index-BjqdNfD4.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),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
+ import{c as i,r as n}from"./index-AWx-XTyH.js";function p(){const e=i.c(3),[s,a]=n.useState(!1);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t=async c=>{await navigator.clipboard.writeText(c),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 +1 @@
1
- import{c as g}from"./index-BjqdNfD4.js";import{b as f}from"./use-virtual-mcp-DI0WnvSW.js";import{c as p}from"./use-navigate-to-agent-zu-n6oJ9.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,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(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 c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,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
+ import{c as g}from"./index-AWx-XTyH.js";import{b as f}from"./use-virtual-mcp-Dw5dc6PG.js";import{c as p}from"./use-navigate-to-agent-CyXF9Nfp.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,c=u===void 0?!1:u,t=f(),r=p();let s;e[2]!==t.create||e[3]!==c||e[4]!==r?(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 c&&r(l.id,{search:{main:"instructions"}}),{id:l.id,virtualMcp:l}},e[2]=t.create,e[3]=c,e[4]=r,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 +1 @@
1
- import{r as u}from"./index-BjqdNfD4.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
1
+ import{r as u}from"./index-AWx-XTyH.js";function l({save:t,delayMs:n=1e3}){const e=u.useRef(t);e.current=t;const r=u.useRef(null),c=()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{r.current=null,e.current()},n)},o=()=>(r.current&&(clearTimeout(r.current),r.current=null),e.current());return u.useEffect(()=>()=>{r.current&&(clearTimeout(r.current),r.current=null,e.current())},[]),{schedule:c,flush:o}}export{l as u};
@@ -1 +1 @@
1
- import{c as m,r as n}from"./index-BjqdNfD4.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
1
+ import{c as m,r as n}from"./index-AWx-XTyH.js";function p(e,o){const t=m.c(4),[s,u]=n.useState(e);let c,r;return t[0]!==o||t[1]!==e?(c=()=>{const i=setTimeout(()=>u(e),o);return()=>clearTimeout(i)},r=[e,o],t[0]=o,t[1]=e,t[2]=c,t[3]=r):(c=t[2],r=t[3]),n.useEffect(c,r),s}export{p as u};
@@ -0,0 +1 @@
1
+ import{W as Kt,X as Ut,c as $,b as V,Y as ft,Z as gt,e as qt,j as t,a as oe,B as ne,r as H,aN as Xt,d as Ve,m as X,s as Wt,t as G,w as Qt,k as ke,q as R,F as ae,L as Yt,f as pt,u as ht,D as Jt,I as Zt,G as en,K as st,o as tn,n as nn}from"./index-AWx-XTyH.js";import{t as xt}from"./ChevronDown-DNmWCLs3.js";import{A as jt,h as sn,b as on}from"./agent-icon-8M4EsQDg.js";import{T as Ce,a as ye,c as Se}from"./tooltip-u2UtZ4A6.js";import{u as vt,d as bt,c as Ct}from"./sidebar-1nUBTcZ5.js";import{a as ot,i as an,f as rn,S as cn,u as ln}from"./use-mcp-client-BBGyfAUZ.js";import{a as dn,u as un}from"./use-virtual-mcp-Dw5dc6PG.js";import{a as Be,b as yt,P as St}from"./popover-DPpEWtTO.js";import{i as Ee}from"./Check-DZuO_3-U.js";import{s as we}from"./Plus-CrmrtePf.js";import{i as wt}from"./SearchMd-I_6dwmem.js";import{s as Nt}from"./XClose-Cnmuk8Ko.js";import{c as mn,d as fn,b as gn,f as pn,e as hn,a as xn,A as jn}from"./alert-dialog-7uhMzMe-.js";import{F as Q,a as nt,b as Y,c as J,d as Z,f as vn,e as ee}from"./form-B9MzfW7Q.js";import{I as ie}from"./input-dOJy3p-z.js";import{S as bn}from"./chat-context-B7VnnFIL.js";import{T as _t}from"./toolbar-icon-button-p1Exse_j.js";import{S as Cn}from"./skeleton-CO3sKI5a.js";import{D as Dt,a as kt,b as At,c as yn,d as Sn,e as wn,f as Nn}from"./drawer-CKDocp3V.js";import{u as It}from"./use-mobile-BA7Xr9l-.js";import{G as _n}from"./use-registry-app-DzTRc8RZ.js";import{G as Dn}from"./github-repo-picker-DG5mwuJS.js";import{b as kn,a as Pt}from"./hooks-C8vbzir9.js";import{u as An,g as In,a as Pn,b as Tn}from"./use-navigate-to-agent-CyXF9Nfp.js";import{u as Tt}from"./shell-layout-BVbG3CWD.js";import{f as Ot}from"./reusable-new-chat-CouMjkYR.js";import{C as On}from"./collection-search-CzJO1Bet.js";import{g as zn,a as Mn,b as $n,e as Fn}from"./extract-connection-data-lQlzAEx8.js";import{u as zt,a as Mt,g as Ln,C as Ye}from"./connection-card-DOyv0WHW.js";import{e as $t,d as Ft,a as Lt,b as Bt,h as Bn,c as En}from"./dialog-CrhPWlsu.js";import{S as Vn,a as Rn,b as Hn,c as Gn,d as De}from"./select-C-c84gqD.js";import{T as Kn}from"./textarea-j70QHwPE.js";import{b as Et}from"./use-connection-K5A04m_I.js";import{n as Le,i as Je}from"./Tool02-CtSGODZV.js";import{s as Ze}from"./Star01-BXyPOmxC.js";import{c as Un,i as $e,a as lt,E as qn,p as Xn,b as Wn,d as Qn}from"./connection-form-helpers-BRE4mupD.js";import{a as et}from"./authenticate-and-persist-oauth-B9Bijlsj.js";import{g as Yn}from"./connection-slug-eyAPH6o3.js";import{C as Jn}from"./collection-tabs-Df0khv4d.js";import{u as dt}from"./use-infinite-scroll-CeeyEYVQ.js";import{B as Fe}from"./badge-DrkRrH-Z.js";import{u as Zn}from"./useSuspenseInfiniteQuery-fKYTkkuN.js";import{u as es}from"./studio-tools-DNNqlbd5.js";import{u as ts}from"./use-ai-providers-BDAE_9bK.js";function ut(n){return n.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ns=Kt({name:Ut().min(2,"Organization name is required")});function ss(n){const e=$.c(66),{open:s,onOpenChange:i}=n,o=V();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={resolver:ft(ns),defaultValues:{name:""}},e[0]=r):r=e[0];const a=gt(r);let c;e[1]!==o?(c=async E=>{const M=ut(E.name);if(!M)throw new Error(o("common.createOrganizationDialog.invalidSlug"));const U=await oe.organization.create({name:E.name,slug:M});if(U?.error)throw new Error(U.error.message||o("common.createOrganizationDialog.failedToCreate"));const K=U?.data?.slug??M;if(!K)throw new Error(o("common.createOrganizationDialog.failedToCreate"));return{orgSlug:K}},e[1]=o,e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=os,e[3]=d):d=e[3];let m;e[4]!==c?(m={mutationFn:c,onSuccess:d},e[4]=c,e[5]=m):m=e[5];const u=qt(m);let g;e[6]!==u.error||e[7]!==o?(g=u.error instanceof Error?u.error.message:u.error?o("common.createOrganizationDialog.failedToCreateGeneric"):null,e[6]=u.error,e[7]=o,e[8]=g):g=e[8];const l=g;let p;e[9]!==o?(p=o("common.createOrganizationDialog.title"),e[9]=o,e[10]=p):p=e[10];let C;e[11]!==p?(C=t.jsx(mn,{children:p}),e[11]=p,e[12]=C):C=e[12];let x;e[13]!==o?(x=o("common.createOrganizationDialog.description"),e[13]=o,e[14]=x):x=e[14];let h;e[15]!==x?(h=t.jsx(fn,{children:x}),e[15]=x,e[16]=h):h=e[16];let j;e[17]!==C||e[18]!==h?(j=t.jsxs(gn,{children:[C,h]}),e[17]=C,e[18]=h,e[19]=j):j=e[19];let b;if(e[20]!==u||e[21]!==a){let E;e[23]!==u?(E=M=>u.mutateAsync(M),e[23]=u,e[24]=E):E=e[24],b=a.handleSubmit(E),e[20]=u,e[21]=a,e[22]=b}else b=e[22];let y;e[25]!==a.formState.isSubmitting||e[26]!==o?(y=E=>{const{field:M}=E;return t.jsxs(Y,{children:[t.jsx(J,{children:o("common.createOrganizationDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{...M,placeholder:o("common.createOrganizationDialog.namePlaceholder"),disabled:a.formState.isSubmitting})}),t.jsx(vn,{children:o("common.createOrganizationDialog.nameDescription")}),M.value&&t.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[o("common.createOrganizationDialog.urlLabel")," ",t.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",ut(M.value)]})]}),t.jsx(ee,{})]})},e[25]=a.formState.isSubmitting,e[26]=o,e[27]=y):y=e[27];let w;e[28]!==a.control||e[29]!==y?(w=t.jsx(Q,{control:a.control,name:"name",render:y}),e[28]=a.control,e[29]=y,e[30]=w):w=e[30];let _;e[31]!==l?(_=l&&t.jsx("div",{className:"text-destructive text-sm mt-2",children:l}),e[31]=l,e[32]=_):_=e[32];const A=a.formState.isSubmitting;let O;e[33]!==u||e[34]!==a?(O=()=>{u.reset(),a.reset()},e[33]=u,e[34]=a,e[35]=O):O=e[35];let f;e[36]!==o?(f=o("common.createOrganizationDialog.cancel"),e[36]=o,e[37]=f):f=e[37];let N;e[38]!==a.formState.isSubmitting||e[39]!==O||e[40]!==f?(N=t.jsx(pn,{disabled:A,onClick:O,children:f}),e[38]=a.formState.isSubmitting,e[39]=O,e[40]=f,e[41]=N):N=e[41];const T=!a.formState.isValid||a.formState.isSubmitting;let S;e[42]!==a.formState.isSubmitting||e[43]!==o?(S=a.formState.isSubmitting?t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(bn,{size:"xs"})," ",o("common.createOrganizationDialog.creating")]}):o("common.createOrganizationDialog.createButton"),e[42]=a.formState.isSubmitting,e[43]=o,e[44]=S):S=e[44];let v;e[45]!==T||e[46]!==S?(v=t.jsx(ne,{type:"submit",variant:"default",disabled:T,children:S}),e[45]=T,e[46]=S,e[47]=v):v=e[47];let P;e[48]!==N||e[49]!==v?(P=t.jsxs(hn,{children:[N,v]}),e[48]=N,e[49]=v,e[50]=P):P=e[50];let k;e[51]!==b||e[52]!==w||e[53]!==_||e[54]!==P?(k=t.jsxs("form",{className:"space-y-6",onSubmit:b,autoComplete:"off",children:[w,_,P]}),e[51]=b,e[52]=w,e[53]=_,e[54]=P,e[55]=k):k=e[55];let I;e[56]!==a||e[57]!==k?(I=t.jsx(nt,{...a,children:k}),e[56]=a,e[57]=k,e[58]=I):I=e[58];let z;e[59]!==j||e[60]!==I?(z=t.jsxs(xn,{children:[j,I]}),e[59]=j,e[60]=I,e[61]=z):z=e[61];let B;return e[62]!==i||e[63]!==s||e[64]!==z?(B=t.jsx(jn,{open:s,onOpenChange:i,children:z}),e[62]=i,e[63]=s,e[64]=z,e[65]=B):B=e[65],B}function os(n){const{orgSlug:e}=n;window.location.href=`/${e}`}function Vt(){const n=H.useContext(Xt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(o=>o.status==="pending"&&new Date(o.expiresAt)>new Date),refetch:()=>s?.()}}function is(n){let e=0;for(let i=0;i<n.length;i++)e=n.charCodeAt(i)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function it(n){const e=$.c(13),{org:s,size:i}=n,o=i===void 0?"sm":i,r=o==="xs"?"size-5":"size-6",a=o==="xs"?"text-[9px]":"text-xs";let c;e[0]!==r?(c=X(r,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=r,e[1]=c):c=e[1];let d;e[2]!==s.logo||e[3]!==s.name?(d=s.logo?void 0:is(s.name),e[2]=s.logo,e[3]=s.name,e[4]=d):d=e[4];let m;e[5]!==s.logo||e[6]!==s.name||e[7]!==a?(m=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:X("font-semibold leading-none",a),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=a,e[8]=m):m=e[8];let u;return e[9]!==c||e[10]!==d||e[11]!==m?(u=t.jsx("div",{className:c,style:d,children:m}),e[9]=c,e[10]=d,e[11]=m,e[12]=u):u=e[12],u}function as({invitation:n,onChanged:e}){const s=V(),[i,o]=H.useState(!1),r=n.organizationName??s("header.orgSwitcher.unknownOrganization"),a=async()=>{o(!0);try{const m=await oe.organization.acceptInvitation({invitationId:n.id});if(m.error){G.error(m.error.message),o(!1);return}}catch{G.error(s("header.orgSwitcher.failedToAcceptInvitation")),o(!1);return}G.success(s("header.orgSwitcher.joined",{name:r})),Qt();let d;try{d=(await oe.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=d?`/${d}`:"/"},c=async()=>{o(!0);try{const d=await oe.organization.rejectInvitation({invitationId:n.id});if(d.error){G.error(d.error.message),o(!1);return}G.success(s("header.orgSwitcher.invitationDeclined")),o(!1),e()}catch{G.error(s("header.orgSwitcher.failedToDeclineInvitation")),o(!1)}};return t.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-dashed border-border px-3 py-2.5",children:[t.jsx(it,{org:{name:r},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:r}),t.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s("header.orgSwitcher.invitedToJoin")})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx(ne,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:a,disabled:i,children:s("header.orgSwitcher.accept")}),t.jsx(ne,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:c,disabled:i,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:r}),children:t.jsx(Nt,{size:14})})]})]})}function rs(n){const e=$.c(32),{orgParam:s,onSelectOrg:i,onCreateOrg:o}=n,r=V(),{data:a}=Wt(),{invitations:c,refetch:d}=Vt();let m;e[0]!==s?(m=(k,I)=>k.slug===s?-1:I.slug===s?1:k.name.localeCompare(I.name),e[0]=s,e[1]=m):m=e[1];const u=[...a??[]].sort(m),[g,l]=H.useState(""),p=g.toLowerCase(),C=p?u.filter(k=>k.name.toLowerCase().includes(p)||k.slug.toLowerCase().includes(p)):u;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(wt,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=x):x=e[2];let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=k=>l(k.target.value),e[3]=h):h=e[3];let j;e[4]!==g?(j=k=>k.key==="Escape"&&g&&l(""),e[4]=g,e[5]=j):j=e[5];let b;e[6]!==r?(b=r("header.orgSwitcher.searchOrganizations"),e[6]=r,e[7]=b):b=e[7];let y;e[8]!==g||e[9]!==j||e[10]!==b?(y=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:g,onChange:h,onKeyDown:j,placeholder:b,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=g,e[9]=j,e[10]=b,e[11]=y):y=e[11];let w;e[12]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx(we,{size:16}),e[12]=w):w=e[12];let _;e[13]!==o?(_=t.jsx("button",{type:"button",onClick:o,className:"flex items-center justify-center size-7 rounded-md text-muted-foreground hover:bg-accent/50 hover:text-foreground transition-colors",children:w}),e[13]=o,e[14]=_):_=e[14];let A;e[15]!==y||e[16]!==_?(A=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[x,y,_]}),e[15]=y,e[16]=_,e[17]=A):A=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let f;e[18]!==c||e[19]!==g||e[20]!==d?(f=!g&&c.map(k=>t.jsx(as,{invitation:k,onChanged:d},k.id)),e[18]=c,e[19]=g,e[20]=d,e[21]=f):f=e[21];const N=C.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:g?r("header.orgSwitcher.noOrganizationsMatch",{query:g}):r("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==i||e[23]!==s?(T=k=>t.jsxs("button",{type:"button",onClick:()=>i(k.slug),className:X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",k.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(it,{org:k,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.slug})]}),k.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},k.id),e[22]=i,e[23]=s,e[24]=T):T=e[24];const S=C.map(T);let v;e[25]!==f||e[26]!==N||e[27]!==S?(v=t.jsxs("div",{className:O,children:[f,N,S]}),e[25]=f,e[26]=N,e[27]=S,e[28]=v):v=e[28];let P;return e[29]!==v||e[30]!==A?(P=t.jsxs(t.Fragment,{children:[A,v]}),e[29]=v,e[30]=A,e[31]=P):P=e[31],P}function cs(n){const e=$.c(22),{trigger:s,orgParam:i,align:o,side:r}=n,a=o===void 0?"start":o,c=r===void 0?"bottom":r,d=Ve(),[m,u]=H.useState(!1),[g,l]=H.useState(!1);let p;e[0]!==s?(p=t.jsx(Be,{asChild:!0,children:s}),e[0]=s,e[1]=p):p=e[1];const C=String(m);let x;e[2]!==d?(x=A=>{u(!1),d({to:"/$org",params:{org:A}})},e[2]=d,e[3]=x):x=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{u(!1),l(!0)},e[4]=h):h=e[4];let j;e[5]!==i||e[6]!==C||e[7]!==x?(j=t.jsx(rs,{orgParam:i,onSelectOrg:x,onCreateOrg:h},C),e[5]=i,e[6]=C,e[7]=x,e[8]=j):j=e[8];let b;e[9]!==a||e[10]!==c||e[11]!==j?(b=t.jsx(yt,{side:c,align:a,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:ds,onCloseAutoFocus:ls,children:j}),e[9]=a,e[10]=c,e[11]=j,e[12]=b):b=e[12];let y;e[13]!==m||e[14]!==p||e[15]!==b?(y=t.jsxs(St,{open:m,onOpenChange:u,children:[p,b]}),e[13]=m,e[14]=p,e[15]=b,e[16]=y):y=e[16];let w;e[17]!==g?(w=t.jsx(ss,{open:g,onOpenChange:l}),e[17]=g,e[18]=w):w=e[18];let _;return e[19]!==w||e[20]!==y?(_=t.jsxs(t.Fragment,{children:[y,w]}),e[19]=w,e[20]=y,e[21]=_):_=e[21],_}function ls(n){return n.preventDefault()}function ds(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function us(n){const e=$.c(21),{value:s,onChange:i,placeholder:o,onKeyDown:r,className:a,isSearching:c,disabled:d}=n,m=o===void 0?"Search...":o;let u;e[0]!==a?(u=X("shrink-0 w-full border-b border-border h-12",a),e[0]=a,e[1]=u):u=e[1];const g=d?"cursor-not-allowed opacity-50":"cursor-text";let l;e[2]!==g?(l=X("flex items-center gap-2.5 h-12 px-4",g),e[2]=g,e[3]=l):l=e[3];let p;e[4]!==c?(p=c?t.jsx(ke,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(wt,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=c,e[5]=p):p=e[5];let C;e[6]!==i?(C=b=>i(b.target.value),e[6]=i,e[7]=C):C=e[7];let x;e[8]!==d||e[9]!==r||e[10]!==m||e[11]!==C||e[12]!==s?(x=t.jsx("input",{type:"text",value:s,onChange:C,onKeyDown:r,placeholder:m,disabled:d,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=d,e[9]=r,e[10]=m,e[11]=C,e[12]=s,e[13]=x):x=e[13];let h;e[14]!==l||e[15]!==p||e[16]!==x?(h=t.jsxs("label",{className:l,children:[p,x]}),e[14]=l,e[15]=p,e[16]=x,e[17]=h):h=e[17];let j;return e[18]!==u||e[19]!==h?(j=t.jsx("div",{className:u,children:h}),e[18]=u,e[19]=h,e[20]=j):j=e[20],j}function at(n){const e=n?.metadata?.githubRepo;if(!e?.url)return{status:"none"};const s=e.connectionId;return!!s&&!!n?.connections?.some(r=>r.connection_id===s)?{status:"attached",repo:e,connectionId:s}:!!s||e.installationId!=null?{status:"detached",repo:e}:{status:"public-clone",repo:e}}function zo(n){const e=at(n);return e.status==="attached"||e.status==="public-clone"?e.repo:null}function Rt(n){if(typeof n!="object"||n===null)return!1;const s=n.githubRepo?.url;return typeof s=="string"&&s.length>0}function Mo(n){return at(n).status==="attached"}function $o(n){const e=at(n).status;return e==="attached"||e==="detached"}function ms(n){const e=new Set;for(const s of n??[]){const i=s.metadata?.liveAgentId;typeof i=="string"&&i&&e.add(s.id)}return e}function Fo(n,e){if(!n)return null;const s=n.metadata?.liveAgentId;if(typeof s=="string"&&s)return{mode:"dev",targetId:s};const i=(e??[]).find(o=>o.metadata?.liveAgentId===n.id);return i?{mode:"live",targetId:i.id}:null}function fs(n){const e=$.c(6),{value:s,onChange:i}=n,o=V();let r;e[0]!==o?(r=o("sidebar.agentsSection.searchAgents"),e[0]=o,e[1]=r):r=e[1];let a;return e[2]!==i||e[3]!==r||e[4]!==s?(a=t.jsx(us,{value:s,onChange:i,placeholder:r}),e[2]=i,e[3]=r,e[4]=s,e[5]=a):a=e[5],a}function gs(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=i):i=n[3],i}function ps(n){const e=$.c(10),{org:s,onClose:i}=n,o=V();let r;e[0]!==s.slug?(r={org:s.slug},e[0]=s.slug,e[1]=r):r=e[1];let a;e[2]!==i?(a=()=>i(),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==o?(c=o("sidebar.agentsSection.seeAllAgents"),e[4]=o,e[5]=c):c=e[5];let d;return e[6]!==r||e[7]!==a||e[8]!==c?(d=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Yt,{to:"/$org/settings/agents",params:r,onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:c})}),e[6]=r,e[7]=a,e[8]=c,e[9]=d):d=e[9],d}function hs(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(Ht,{children:s}),n[2]=s,n[3]=i):i=n[3],i}function xs(n){const e=$.c(11),{onImportFromGithub:s}=n,i=V();let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx(_n,{className:"size-3.5"}),e[0]=o):o=e[0];let r;e[1]!==i?(r=i("sidebar.agentsSection.import"),e[1]=i,e[2]=r):r=e[2];let a;e[3]!==s||e[4]!==r?(a=t.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",children:[o,r]}),e[3]=s,e[4]=r,e[5]=a):a=e[5];let c;e[6]!==i?(c=i("sidebar.agentsSection.codeAgents"),e[6]=i,e[7]=c):c=e[7];let d;return e[8]!==a||e[9]!==c?(d=t.jsx(Ht,{action:a,children:c}),e[8]=a,e[9]=c,e[10]=d):d=e[10],d}function js(n){const e=$.c(11),{setOpen:s,emptyCtaClass:i}=n,o=V();let r;e[0]!==o?(r=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=r):r=e[1];let a;e[2]!==i?(a=X(i),e[2]=i,e[3]=a):a=e[3];let c;e[4]!==s?(c=()=>{R("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=c):c=e[5];let d;e[6]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(we,{className:"size-4"}),e[6]=d):d=e[6];let m;return e[7]!==r||e[8]!==a||e[9]!==c?(m=t.jsx(_t,{"aria-label":r,className:a,onClick:c,children:d}),e[7]=r,e[8]=a,e[9]=c,e[10]=m):m=e[10],m}function vs(n){const e=$.c(17),{setOpen:s,highlightEmpty:i,emptyCtaClass:o}=n,r=V();let a;e[0]!==i||e[1]!==r?(a=i?void 0:r("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;e[3]!==o?(c=X(o),e[3]=o,e[4]=c):c=e[4];let d;e[5]!==s?(d=()=>{R("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=d):d=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx(we,{}),e[7]=m):m=e[7];let u;e[8]!==r?(u=r("sidebar.agentsSection.newAgent"),e[8]=r,e[9]=u):u=e[9];let g;e[10]!==u?(g=t.jsx("span",{children:u}),e[10]=u,e[11]=g):g=e[11];let l;return e[12]!==a||e[13]!==c||e[14]!==d||e[15]!==g?(l=t.jsx(bt,{children:t.jsxs(Ct,{tooltip:a,className:c,onClick:d,children:[m,g]})}),e[12]=a,e[13]=c,e[14]=d,e[15]=g,e[16]=l):l=e[16],l}function bs(){const n=$.c(4),e=V();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let i;return n[2]!==s?(i=t.jsx(At,{className:"sr-only",children:s}),n[2]=s,n[3]=i):i=n[3],i}function Cs(n){const e=$.c(8),{emptyCtaClass:s}=n,i=V();let o;e[0]!==i?(o=i("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=o):o=e[1];let r;e[2]!==s?(r=X(s),e[2]=s,e[3]=r):r=e[3];let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(we,{className:"size-4"}),e[4]=a):a=e[4];let c;return e[5]!==o||e[6]!==r?(c=t.jsx(_t,{"aria-label":o,className:r,children:a}),e[5]=o,e[6]=r,e[7]=c):c=e[7],c}function ys(n){const e=$.c(19),{wrapEmptyHint:s,highlightEmpty:i,emptyCtaClass:o}=n,r=V();let a;e[0]!==i||e[1]!==r?(a=i?void 0:r("sidebar.agentsSection.browseAgents"),e[0]=i,e[1]=r,e[2]=a):a=e[2];let c;e[3]!==o?(c=X(o),e[3]=o,e[4]=c):c=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=t.jsx(we,{}),e[5]=d):d=e[5];let m;e[6]!==r?(m=r("sidebar.agentsSection.newAgent"),e[6]=r,e[7]=m):m=e[7];let u;e[8]!==m?(u=t.jsx("span",{children:m}),e[8]=m,e[9]=u):u=e[9];let g;e[10]!==a||e[11]!==c||e[12]!==u?(g=t.jsx(Be,{asChild:!0,children:t.jsxs(Ct,{tooltip:a,className:c,children:[d,u]})}),e[10]=a,e[11]=c,e[12]=u,e[13]=g):g=e[13];let l;e[14]!==g||e[15]!==s?(l=s(g),e[14]=g,e[15]=s,e[16]=l):l=e[16];let p;return e[17]!==l?(p=t.jsx(bt,{children:l}),e[17]=l,e[18]=p):p=e[18],p}function Ss(n){const e=$.c(9),{children:s}=n,i=V();let o;e[0]!==s?(o=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=o):o=e[1];let r;e[2]!==i?(r=i("sidebar.agentsSection.selectAnExistingAgent"),e[2]=i,e[3]=r):r=e[3];let a;e[4]!==r?(a=t.jsx(ye,{side:"right",sideOffset:8,children:r}),e[4]=r,e[5]=a):a=e[5];let c;return e[6]!==o||e[7]!==a?(c=t.jsxs(Se,{defaultOpen:!0,delayDuration:0,children:[o,a]}),e[6]=o,e[7]=a,e[8]=c):c=e[8],c}function ws(n){const e=$.c(4),s=Ve(),{create:i}=kn();let o;return e[0]!==i||e[1]!==s||e[2]!==n?(o=async r=>{const a=crypto.randomUUID();try{await i({id:a,virtual_mcp_id:r})}catch{}s({to:"/$org/$taskId",params:{org:n,taskId:a},search:{virtualmcpid:r}})},e[0]=i,e[1]=s,e[2]=n,e[3]=o):o=e[3],o}function tt(n){const e=$.c(20),{agent:s,selected:i,onClick:o}=n,r=i?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let a;e[0]!==r?(a=X("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",r),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==s.icon||e[3]!==s.title?(c=t.jsx(jt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=c):c=e[4];let d;e[5]!==s.title?(d=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=d):d=e[6];let m;e[7]!==s.description?(m=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=m):m=e[8];let u;e[9]!==d||e[10]!==m?(u=t.jsxs("div",{className:"flex-1 min-w-0",children:[d,m]}),e[9]=d,e[10]=m,e[11]=u):u=e[11];let g;e[12]!==i?(g=i&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=i,e[13]=g):g=e[13];let l;return e[14]!==o||e[15]!==a||e[16]!==c||e[17]!==u||e[18]!==g?(l=t.jsxs("button",{type:"button",onClick:o,className:a,children:[c,u,g]}),e[14]=o,e[15]=a,e[16]=c,e[17]=u,e[18]=g,e[19]=l):l=e[19],l}function Ht(n){const e=$.c(5),{children:s,action:i}=n;let o;e[0]!==s?(o=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=o):o=e[1];let r;return e[2]!==i||e[3]!==o?(r=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[o,i]}),e[2]=i,e[3]=o,e[4]=r):r=e[4],r}function Ns(n){const e=$.c(23),{onClose:s,onSelectAgent:i,selectedAgentId:o,onImportFromGithub:r}=n,[a,c]=H.useState(""),d=dn(),m=d??[],{org:u}=ae(),{data:g}=oe.useSession(),l=g?.user?.id??"anon",p=In(d),C=Pn(),x=ws(u.slug),h=ms(d),j=a.toLowerCase(),b=m.filter(As).filter(L=>!h.has(L.id)).filter(ks).filter(L=>!a||L.title.toLowerCase().includes(j)),y=b.filter(Ds),w=b.filter(_s),_=ot(u.id),A=!a||_.title.toLowerCase().includes(j),O=!!(i&&A);let f;e[0]!==s||e[1]!==i?(f=()=>{i?.(null),s(),c("")},e[0]=s,e[1]=i,e[2]=f):f=e[2];const N=f,T=L=>{if(i){i(L.id),s(),c("");return}Tn({orgId:u.id,userId:l},L.id,p),C(),s(),c(""),x(L.id)},S="flex flex-col max-h-[min(640px,80dvh)]";let v;e[3]!==a?(v=t.jsx(fs,{value:a,onChange:c}),e[3]=a,e[4]=v):v=e[4];const P="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",k=i&&A&&_&&t.jsx(tt,{agent:_,selected:!o||o===_.id,onClick:N}),I=(y.length>0||!a)&&t.jsx(xs,{onImportFromGithub:r}),z=y.map(L=>t.jsx(tt,{agent:L,selected:i?o===L.id:void 0,onClick:()=>T(L)},L.id)),B=w.length>0&&t.jsx(hs,{}),E=w.map(L=>t.jsx(tt,{agent:L,selected:i?o===L.id:void 0,onClick:()=>T(L)},L.id));let M;e[5]!==O||e[6]!==a||e[7]!==b.length?(M=b.length===0&&!O&&a&&t.jsx(gs,{}),e[5]=O,e[6]=a,e[7]=b.length,e[8]=M):M=e[8];let U;e[9]!==M||e[10]!==k||e[11]!==I||e[12]!==z||e[13]!==B||e[14]!==E?(U=t.jsxs("div",{className:P,children:[k,I,z,B,E,M]}),e[9]=M,e[10]=k,e[11]=I,e[12]=z,e[13]=B,e[14]=E,e[15]=U):U=e[15];let K;e[16]!==s||e[17]!==u?(K=t.jsx(ps,{org:u,onClose:s}),e[16]=s,e[17]=u,e[18]=K):K=e[18];let de;return e[19]!==U||e[20]!==K||e[21]!==v?(de=t.jsxs("div",{className:S,children:[v,U,K]}),e[19]=U,e[20]=K,e[21]=v,e[22]=de):de=e[22],de}function _s(n){return!Rt(n.metadata)}function Ds(n){return Rt(n.metadata)}function ks(n){return!rn(n.id)}function As(n){return!an(n.id)}function Is(n){const e=$.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:i,trigger:o,onSelectAgent:r,selectedAgentId:a,side:c,align:d}=s,m=i===void 0?!1:i,u=c===void 0?"right":c,g=d===void 0?"start":d,[l,p]=H.useState(!1),[C,x]=H.useState(!1),h=It(),{setOpenMobile:j}=vt(),b=An(),y=b?"border border-border":void 0;let w;e[2]!==b?(w=I=>b?t.jsx(Ss,{children:I}):I,e[2]=b,e[3]=w):w=e[3];const _=w;let A;e[4]!==h||e[5]!==j?(A=()=>{p(!1),h&&j(!1)},e[4]=h,e[5]=j,e[6]=A):A=e[6];const O=A;let f;e[7]!==O?(f=()=>{O(),x(!0)},e[7]=O,e[8]=f):f=e[8];const N=f;let T;e[9]!==O||e[10]!==N||e[11]!==r||e[12]!==l||e[13]!==a?(T=l&&t.jsx(H.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(Cn,{className:"h-4 w-24"})}),children:t.jsx(Ns,{onClose:O,onSelectAgent:r,selectedAgentId:a,onImportFromGithub:N})}),e[9]=O,e[10]=N,e[11]=r,e[12]=l,e[13]=a,e[14]=T):T=e[14];const S=T;let v;e[15]!==g||e[16]!==m||e[17]!==y||e[18]!==b||e[19]!==h||e[20]!==l||e[21]!==S||e[22]!==u||e[23]!==o||e[24]!==_?(v=h?t.jsxs(t.Fragment,{children:[o?t.jsx("button",{type:"button",onClick:()=>p(!0),className:"contents",children:o}):m?_(t.jsx(js,{setOpen:p,emptyCtaClass:y})):t.jsx(vs,{setOpen:p,highlightEmpty:b,emptyCtaClass:y}),t.jsx(Dt,{open:l,onOpenChange:p,direction:"bottom",children:t.jsxs(kt,{className:"max-h-[85dvh] p-0",children:[t.jsx(bs,{}),S]})})]}):t.jsxs(St,{open:l,onOpenChange:I=>{I&&!l&&R("agent_browser_opened",{surface:"desktop_popover"}),p(I)},children:[o?t.jsx(Be,{asChild:!0,children:o}):m?_(t.jsx(Be,{asChild:!0,children:t.jsx(Cs,{emptyCtaClass:y})})):t.jsx(ys,{wrapEmptyHint:_,highlightEmpty:b,emptyCtaClass:y}),t.jsx(yt,{className:"w-[380px] p-0 overflow-hidden",side:u,align:g,children:S})]}),e[15]=g,e[16]=m,e[17]=y,e[18]=b,e[19]=h,e[20]=l,e[21]=S,e[22]=u,e[23]=o,e[24]=_,e[25]=v):v=e[25];let P;e[26]!==C?(P=t.jsx(Dn,{open:C,onOpenChange:x,mode:"agent"}),e[26]=C,e[27]=P):P=e[27];let k;return e[28]!==P||e[29]!==v?(k=t.jsxs(t.Fragment,{children:[v,P]}),e[28]=P,e[29]=v,e[30]=k):k=e[30],k}const Ps="wco-no-drag inline-flex items-center gap-1.5 min-w-0 rounded-md pl-1 pr-2 py-1.5 text-sm text-foreground hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";function Ts(n){const e=$.c(19),{agentId:s,fallback:i,onOpenHome:o,onPick:r}=n,a=un(s)??i??null,c=a?.title??"Super Agent",d=`Open ${c} home`,m=a?.icon??null;let u;e[0]!==m||e[1]!==c?(u=t.jsx(jt,{icon:m,name:c,size:"xs"}),e[0]=m,e[1]=c,e[2]=u):u=e[2];let g;e[3]!==o||e[4]!==d||e[5]!==u?(g=t.jsx("button",{type:"button",onClick:o,"aria-label":d,className:"wco-no-drag flex items-center shrink-0 rounded-md p-1 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:u}),e[3]=o,e[4]=d,e[5]=u,e[6]=g):g=e[6];let l;e[7]!==c?(l=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:c}),e[7]=c,e[8]=l):l=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[9]=p):p=e[9];let C;e[10]!==l?(C=t.jsxs("button",{type:"button",className:Ps,children:[l,p]}),e[10]=l,e[11]=C):C=e[11];let x;e[12]!==s||e[13]!==r||e[14]!==C?(x=t.jsx(Is,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:r,trigger:C}),e[12]=s,e[13]=r,e[14]=C,e[15]=x):x=e[15];let h;return e[16]!==g||e[17]!==x?(h=t.jsxs("div",{className:"flex min-w-0 items-center gap-0",children:[g,x]}),e[16]=g,e[17]=x,e[18]=h):h=e[18],h}function Lo(n){const e=$.c(26);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:i}=s,{org:o}=ae(),{state:r,isMobile:a}=vt(),c=Vt().invitations.length>0,d=r==="collapsed"||a,m=c?`${o.name} — switch organization (pending invitation)`:`${o.name} — switch organization`;let u;e[2]!==o?(u=t.jsx(it,{org:o,size:"sm"}),e[2]=o,e[3]=u):u=e[3];let g;e[4]!==c||e[5]!==d?(g=c&&t.jsx("span",{className:X("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",d?"-top-1":"top-1/2 -translate-y-1/2")}),e[4]=c,e[5]=d,e[6]=g):g=e[6];let l;e[7]!==u||e[8]!==g?(l=t.jsxs("span",{className:"relative inline-flex",children:[u,g]}),e[7]=u,e[8]=g,e[9]=l):l=e[9];let p;e[10]!==o.name||e[11]!==i?(p=i&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:o.name}),e[10]=o.name,e[11]=i,e[12]=p):p=e[12];let C;e[13]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(xt,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[13]=C):C=e[13];let x;e[14]!==m||e[15]!==l||e[16]!==p?(x=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":m,className:"wco-no-drag flex items-center gap-1.5 shrink-0 rounded-lg pl-[5px] pr-1.5 py-1.5 hover:bg-accent/60 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:[l,p,C]})}),e[14]=m,e[15]=l,e[16]=p,e[17]=x):x=e[17];let h;e[18]!==o.slug||e[19]!==x?(h=t.jsx(cs,{orgParam:o.slug,trigger:x}),e[18]=o.slug,e[19]=x,e[20]=h):h=e[20];let j;e[21]!==o.name?(j=t.jsx(ye,{side:"bottom",children:o.name}),e[21]=o.name,e[22]=j):j=e[22];let b;return e[23]!==j||e[24]!==h?(b=t.jsxs(Se,{children:[h,j]}),e[23]=j,e[24]=h,e[25]=b):b=e[25],b}function Bo(n){const e=$.c(24);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:i}=s,{org:o}=ae(),r=Ve();let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a={strict:!1},e[2]=a):a=e[2];const c=pt(a);let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d={strict:!1},e[3]=d):d=e[3];const m=ht(d),{threads:u}=Pt(),{data:g}=oe.useSession(),{setTaskId:l,createNewTask:p}=Tt();let C;e[4]!==o.id?(C=ot(o.id),e[4]=o.id,e[5]=C):C=e[5];const x=C,h=x.id,j=c.taskId?m.virtualmcpid??h:h;let b;e[6]!==p||e[7]!==h||e[8]!==r||e[9]!==i||e[10]!==o.slug||e[11]!==g?.user?.id||e[12]!==l||e[13]!==u?(b=f=>{if(!f||f===h){r({to:"/$org",params:{org:o.slug}}),i?.();return}const N=Ot(u,f,g?.user?.id);N?l(N.id,f):p(f),i?.()},e[6]=p,e[7]=h,e[8]=r,e[9]=i,e[10]=o.slug,e[11]=g?.user?.id,e[12]=l,e[13]=u,e[14]=b):b=e[14];const y=b;let w;e[15]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[15]=w):w=e[15];const _=j===h?x:void 0;let A;e[16]!==j||e[17]!==y?(A=()=>y(j),e[16]=j,e[17]=y,e[18]=A):A=e[18];let O;return e[19]!==j||e[20]!==y||e[21]!==_||e[22]!==A?(O=t.jsx(H.Suspense,{fallback:w,children:t.jsx(Ts,{agentId:j,fallback:_,onOpenHome:A,onPick:y})}),e[19]=j,e[20]=y,e[21]=_,e[22]=A,e[23]=O):O=e[23],O}function Eo(){const n=$.c(23),e=V(),{org:s}=ae();let i;n[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[0]=i):i=n[0];const o=pt(i);let r;n[1]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},n[1]=r):r=n[1];const a=ht(r),{threads:c}=Pt(),{data:d}=oe.useSession(),{setTaskId:m,createNewTask:u}=Tt();let g;n[2]!==s.id?(g=ot(s.id),n[2]=s.id,n[3]=g):g=n[3];const l=g.id,p=o.taskId?a.virtualmcpid??l:l;let C;n[4]!==p||n[5]!==u||n[6]!==d?.user?.id||n[7]!==m||n[8]!==c?(C=()=>{const A=Ot(c,p,d?.user?.id);A?m(A.id,p):u(p)},n[4]=p,n[5]=u,n[6]=d?.user?.id,n[7]=m,n[8]=c,n[9]=C):C=n[9];const x=C;let h;n[10]!==e?(h=e("sidebar.taskGroupsList.newChat"),n[10]=e,n[11]=h):h=n[11];let j;n[12]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:16}),n[12]=j):j=n[12];let b;n[13]!==x||n[14]!==h?(b=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:x,"aria-label":h,className:"wco-no-drag flex shrink-0 items-center rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",children:j})}),n[13]=x,n[14]=h,n[15]=b):b=n[15];let y;n[16]!==e?(y=e("sidebar.taskGroupsList.newChat"),n[16]=e,n[17]=y):y=n[17];let w;n[18]!==y?(w=t.jsx(ye,{side:"bottom",children:y}),n[18]=y,n[19]=w):w=n[19];let _;return n[20]!==b||n[21]!==w?(_=t.jsxs(Se,{children:[b,w]}),n[20]=b,n[21]=w,n[22]=_):_=n[22],_}function Os({open:n,onOpenChange:e,onCreated:s}){const i=V(),{org:o}=ae(),{data:r}=oe.useSession(),{stdioEnabled:a}=Jt(),c=It(),d=Et(),m=zt(),g=Mt(m,"").items,l=gt({resolver:ft(Un),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),p=l.watch("ui_type"),C=l.watch("connection_url"),x=l.watch("npx_package"),h=$e({uiType:p,connectionUrl:C??"",npxPackage:x??""})??lt({uiType:p,connectionUrl:C??"",registryItems:g}),j=f=>{const N=f.trim();if(!N)return;const T=!!l.formState.dirtyFields.title,S=!!l.formState.dirtyFields.description,v=!!l.formState.dirtyFields.env_vars,P=I=>{if(I&&(!T&&!l.getValues("title").trim()&&I.title&&l.setValue("title",I.title,{shouldDirty:!1}),!S&&!(l.getValues("description")??"").trim()&&I.description&&l.setValue("description",I.description,{shouldDirty:!1}),!v&&I.envVarKeys?.length)){const z=l.getValues("env_vars")??[],B=new Set(z.map(M=>M.key)),E=I.envVarKeys.filter(M=>!B.has(M));E.length>0&&l.setValue("env_vars",[...z,...E.map(M=>({key:M,value:""}))],{shouldDirty:!0})}},k=Xn(N);if(k&&a){l.setValue("ui_type","NPX",{shouldDirty:!0}),l.setValue("npx_package",k.packageName,{shouldDirty:!0}),l.setValue("connection_url","",{shouldDirty:!0}),l.setValue("connection_token",null,{shouldDirty:!0}),P($e({uiType:"NPX",npxPackage:k.packageName}));return}if(N.startsWith("http://")||N.startsWith("https://")){const I=p==="HTTP"||p==="SSE"||p==="Websocket"?p:"HTTP";l.setValue("ui_type",I,{shouldDirty:!0}),l.setValue("connection_url",N,{shouldDirty:!0}),P($e({uiType:I,connectionUrl:N})??lt({uiType:I,connectionUrl:N,registryItems:g}));return}p==="NPX"&&P($e({uiType:"NPX",npxPackage:N}))},b=f=>{f||l.reset(),e(f)},y=async f=>{let N,T=null,S=null,v=null;f.ui_type==="NPX"?(N="STDIO",T="",v=Wn(f.npx_package||"",f.env_vars||[])):f.ui_type==="STDIO"?(N="STDIO",T="",v=Qn(f.stdio_command||"",f.stdio_args||"",f.stdio_cwd,f.env_vars||[])):(N=f.ui_type,T=f.connection_url||"",S=f.connection_token||null);const P=zn("conn");try{await d.create.mutateAsync({id:P,title:f.title,description:f.description||null,connection_type:N,connection_url:T,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:r?.user?.id||"system",organization_id:o.id,icon:f.icon??null,app_name:null,app_id:null,connection_headers:v,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),l.reset(),e(!1),s?.(P)}catch{G.error(i("connections.createConnectionDialog.failedToCreateConnection"))}},w=i("connections.createConnectionDialog.title"),_=i("connections.createConnectionDialog.description"),A=l.formState.isSubmitting?i("connections.createConnectionDialog.saving"):i("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(Q,{control:l.control,name:"ui_type",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.typeLabel")}),t.jsxs(Vn,{value:f.value,onValueChange:f.onChange,children:[t.jsx(Z,{children:t.jsx(Rn,{children:t.jsx(Hn,{})})}),t.jsxs(Gn,{children:[t.jsx(De,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),i("connections.createConnectionDialog.httpType")]})}),t.jsx(De,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),i("connections.createConnectionDialog.sseType")]})}),t.jsx(De,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),i("connections.createConnectionDialog.websocketType")]})}),a&&t.jsxs(t.Fragment,{children:[t.jsx(De,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Le,{className:"w-4 h-4"}),i("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(De,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(on,{className:"w-4 h-4"}),i("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),p==="NPX"&&t.jsx(Q,{control:l.control,name:"npx_package",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.npmPackagePlaceholder"),...f,value:f.value??"",onPaste:N=>{const T=N.clipboardData.getData("text");T&&(N.preventDefault(),l.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:N=>{j(N.target.value),f.onBlur()}})}),t.jsx(ee,{})]})}),p==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(Q,{control:l.control,name:"stdio_command",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.commandPlaceholder"),...f,value:f.value??""})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"stdio_args",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.argumentsPlaceholder"),...f,value:f.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"stdio_cwd",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.workingDirectoryPlaceholder"),...f,value:f.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:i("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(p==="NPX"||p==="STDIO")&&t.jsx(Q,{control:l.control,name:"env_vars",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(qn,{value:f.value??[],onChange:f.onChange})}),t.jsx(ee,{})]})}),p!=="NPX"&&p!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{control:l.control,name:"connection_url",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.urlPlaceholder"),...f,value:f.value??"",onPaste:N=>{const T=N.clipboardData.getData("text");T&&(N.preventDefault(),l.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:N=>{j(N.target.value),f.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"connection_token",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:h?.token?.label??i("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ie,{type:"password",placeholder:h?.token?.placeholder??i("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...f,value:f.value??""})}),h?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.token.helperText,h.id==="github"&&t.jsxs(t.Fragment,{children:[" ","·"," ",t.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:i("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(Q,{control:l.control,name:"title",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ie,{placeholder:i("connections.createConnectionDialog.namePlaceholder"),...f})}),t.jsx(ee,{})]})}),t.jsx(Q,{control:l.control,name:"description",render:({field:f})=>t.jsxs(Y,{children:[t.jsx(J,{children:i("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(Kn,{placeholder:i("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...f,value:f.value??""})}),t.jsx(ee,{})]})})]});return c?t.jsx(Dt,{open:n,onOpenChange:b,children:t.jsxs(kt,{className:"max-h-[90vh]",children:[t.jsx(yn,{className:"pb-2",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"flex-1 text-left",children:[t.jsx(At,{children:w}),t.jsx(Sn,{className:"mt-1",children:_})]}),t.jsx(wn,{asChild:!0,children:t.jsx(ne,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(Nt,{size:16})})})]})}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(y),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(Nn,{children:t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"w-full",children:A})})]})})]})}):t.jsx($t,{open:n,onOpenChange:b,children:t.jsxs(Ft,{className:"sm:max-w-[525px]",children:[t.jsxs(Lt,{children:[t.jsx(Bt,{children:w}),t.jsx(Bn,{children:_})]}),t.jsx(nt,{...l,children:t.jsxs("form",{onSubmit:l.handleSubmit(y),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(En,{children:[t.jsx(ne,{type:"button",variant:"outline",onClick:()=>b(!1),children:i("connections.createConnectionDialog.cancelButton")}),t.jsx(ne,{type:"submit",disabled:l.formState.isSubmitting,className:"min-w-40",children:A})]})]})})]})})}function zs(n){const e=$.c(72),{mode:s,agentId:i,addedConnectionIds:o,onAdd:r,onCloneAndAdd:a,onConnectAndAdd:c,connectingItemId:d,search:m,onCreateConnection:u,onBrowseNavigate:g,defaultTab:l}=n,p=s===void 0?"add":s,C=l===void 0?"connected":l,x=V(),{org:h}=ae(),j=H.useDeferredValue(m),b=m!==j;let y;e[0]!==j?(y=j.trim().toLowerCase(),e[0]=j,e[1]=y):y=e[1];const w=y;let _;e[2]!==C?(_=D=>D??C,e[2]=C,e[3]=_):_=e[3];const[A,O]=Zt(en.connectionsTab(h.slug)+(C==="all"?":home-modal":":agent-modal"),_);let f;e[4]!==A||e[5]!==O?(f=D=>{D!==A&&R("connections_dialog_tab_changed",{to_tab:D}),O(D)},e[4]=A,e[5]=O,e[6]=f):f=e[6];const N=f;let T;e[7]!==h.id||e[8]!==h.slug?(T={connectionId:cn,orgId:h.id,orgSlug:h.slug},e[7]=h.id,e[8]=h.slug,e[9]=T):T=e[9];const S=ln(T),v=j?.trim().split(/\s+/).filter(Boolean)??[],P=v.length>0?{operator:"or",conditions:v.flatMap(Rs)}:void 0,k={...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},I=JSON.stringify(k),{data:z,fetchNextPage:B,hasNextPage:E,isFetchingNextPage:M}=Zn({queryKey:st.collectionListInfinite(S,h.id,"","CONNECTIONS",I),queryFn:async D=>{const{pageParam:F}=D,se=F===void 0?0:F;return(await S.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:Es,staleTime:3e4}),U=z?.pages.flatMap(Bs)??[],K=Ln(U),de=new Set(U.filter(Ls).map(Fs)),L=zt(),re=Mt(L,j),Re=dt(re.loadMore,re.hasMore,re.isLoadingMore),He=dt(B,E??!1,M),W=A==="all"||!!w,rt=W?re.items.filter(D=>{const F=Mn(D);if(F&&de.has(F))return!1;if(!w)return!0;const se=D._meta?.["mcp.mesh"],ce=[D.title,D.description,D.name,D.server?.title,D.server?.description,D.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return v.some(te=>ce.includes(te.toLowerCase()))}):[],Ne=rt.filter($s),_e=rt.filter(Ms);let Ae;e[10]!==o?(Ae=D=>D.some(F=>o.has(F.id)),e[10]=o,e[11]=Ae):Ae=e[11];const Ge=Ae;let Ie;e[12]!==o||e[13]!==i||e[14]!==d||e[15]!==Ge||e[16]!==p||e[17]!==r||e[18]!==g||e[19]!==a||e[20]!==x?(Ie=(D,F,se,ce,te)=>{const Me=Ge(te),be=te.find(le=>!o.has(le.id)),q=te[0];if(p==="browse"){const le=Yn(q);return t.jsx(Ye,{connection:{title:F,icon:se,description:te.length>1?`${te.length} instances`:ce??void 0},fallbackIcon:t.jsx(Le,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",x("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{R("connection_browse_clicked",{app_name:q.app_name??null,connection_id:q.id,instances_count:te.length}),g?.(le)}},D)}return t.jsx(Ye,{connection:{title:F,icon:se,description:ce},fallbackIcon:t.jsx(Le,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[Me&&t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",x("virtualMcp.connectionDialogContent.added")]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:d!==null,onClick:le=>{le.stopPropagation(),be?(R("connection_add_clicked",{action:"use_existing",app_name:q.app_name??null,connection_id:be.id}),i&&R("agent_connection_attached",{agent_id:i,connection_id:be.id,app_name:q.app_name??null,mode:"existing"}),r(be.id)):(R("connection_add_clicked",{action:"clone",app_name:q.app_name??null,base_connection_id:q.id}),a(q))},children:x("virtualMcp.connectionDialogContent.add")})]})},D)},e[12]=o,e[13]=i,e[14]=d,e[15]=Ge,e[16]=p,e[17]=r,e[18]=g,e[19]=a,e[20]=x,e[21]=Ie):Ie=e[21];const Pe=Ie;let Te;e[22]!==d||e[23]!==p||e[24]!==c||e[25]!==x?(Te=D=>{const F=D._meta?.["mcp.mesh"],se=F?.friendlyName||F?.friendly_name||D.server?.title||D.title||D.server?.name||D.name||D.id||"",ce=D.server?.description||D.description||null,te=D.server?.icons?.[0]?.src||$n(D.server?.repository)||null,Me=F?.official===!0,be=F?.verified===!0,q=F?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:ce,icon:te},fallbackIcon:t.jsx(Le,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[q&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx("span",{className:"inline-flex items-center justify-center size-5 rounded-md bg-muted shrink-0",children:t.jsx("img",{src:"/logos/deco logo.svg",alt:x("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:x("virtualMcp.connectionDialogContent.builtByDeco")})]}),!q&&Me&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:x("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!q&&!Me&&be&&t.jsxs(Se,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:x("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(ne,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:d!==null,onClick:le=>{le.stopPropagation(),R("connection_add_clicked",{action:"connect_new",registry_item_id:D.id,app_name:F?.friendlyName||D.server?.name||D.name||null}),c(D)},children:d===D.id?t.jsx(ke,{size:14,className:"animate-spin"}):x(p==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${D.id}`)},e[22]=d,e[23]=p,e[24]=c,e[25]=x,e[26]=Te):Te=e[26];const ct=Te;let ue;e[27]!==A||e[28]!==N||e[29]!==u||e[30]!==w||e[31]!==x?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(Jn,{tabs:[{id:"all",label:x("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:x("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:A,onTabChange:D=>N(D)}),t.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{R("connections_dialog_custom_clicked"),u()},children:[t.jsx(we,{size:12}),x("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=A,e[28]=N,e[29]=u,e[30]=w,e[31]=x,e[32]=ue):ue=e[32];const Ke=b&&"opacity-50 pointer-events-none";let me;e[33]!==Ke?(me=X("flex-1 overflow-auto p-5 transition-opacity duration-150",Ke),e[33]=Ke,e[34]=me):me=e[34];const Gt="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let Oe;e[35]!==Pe?(Oe=D=>{if(D.type==="group")return Pe(D.key,D.title,D.icon,null,D.connections);const F=D.connection;return Pe(F.id,F.title,F.icon,F.description??null,[F])},e[35]=Pe,e[36]=Oe):Oe=e[36];const Ue=K.map(Oe);let fe;e[37]!==He?(fe=t.jsx("div",{ref:He,className:"col-span-full h-1"}),e[37]=He,e[38]=fe):fe=e[38];let ge;e[39]!==M?(ge=M&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=M,e[40]=ge):ge=e[40];const qe=W&&Ne.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx(Je,{size:13,className:"text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=W&&Ne.map(ct),We=W&&_e.length>0&&t.jsxs("div",{className:"col-span-full flex items-center gap-2 mt-2",children:[t.jsx("span",{className:"text-sm font-medium text-muted-foreground whitespace-nowrap",children:x("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Qe=W&&_e.map(ct);let pe;e[41]!==Re||e[42]!==L||e[43]!==W?(pe=W&&L.length>0&&t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[41]=Re,e[42]=L,e[43]=W,e[44]=pe):pe=e[44];let he;e[45]!==re.isLoadingMore||e[46]!==W?(he=W&&re.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=re.isLoadingMore,e[46]=W,e[47]=he):he=e[47];let xe;e[48]!==Ue||e[49]!==fe||e[50]!==ge||e[51]!==qe||e[52]!==Xe||e[53]!==We||e[54]!==Qe||e[55]!==pe||e[56]!==he?(xe=t.jsxs("div",{className:Gt,children:[Ue,fe,ge,qe,Xe,We,Qe,pe,he]}),e[48]=Ue,e[49]=fe,e[50]=ge,e[51]=qe,e[52]=Xe,e[53]=We,e[54]=Qe,e[55]=pe,e[56]=he,e[57]=xe):xe=e[57];let je;e[58]!==A||e[59]!==K.length||e[60]!==_e||e[61]!==m||e[62]!==x||e[63]!==Ne?(je=K.length===0&&Ne.length===0&&_e.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:m?x("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:m}):x(A==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=A,e[59]=K.length,e[60]=_e,e[61]=m,e[62]=x,e[63]=Ne,e[64]=je):je=e[64];let ve;e[65]!==me||e[66]!==xe||e[67]!==je?(ve=t.jsxs("div",{className:me,children:[xe,je]}),e[65]=me,e[66]=xe,e[67]=je,e[68]=ve):ve=e[68];let ze;return e[69]!==ue||e[70]!==ve?(ze=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=ze):ze=e[71],ze}function Ms(n){return!n.verified&&!n._meta?.["mcp.mesh"]?.verified&&!n.meta?.verified}function $s(n){return n.verified||n._meta?.["mcp.mesh"]?.verified||n.meta?.verified}function Fs(n){return n.app_name}function Ls(n){return n.app_name}function Bs(n){return n?.items??[]}function Es(n,e){if(n?.hasMore)return e.reduce(Vs,0)}function Vs(n,e){return n+(e?.items?.length??0)}function Rs(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Vo({open:n,onOpenChange:e,defaultTab:s,initialSearch:i="",...o}){const r=V(),a=o.mode??"add",c="agentId"in o?o.agentId:void 0,d="addedConnectionIds"in o?o.addedConnectionIds??new Set:new Set,m="onAdd"in o&&o.onAdd?o.onAdd:S=>{},u=(S,v,P)=>{c&&R("agent_connection_attached",{agent_id:c,connection_id:S,app_name:v,mode:P})},[g,l]=H.useState(null),[p,C]=H.useState(i),[x,h]=H.useState(!1),{org:j}=ae(),{data:b}=oe.useSession(),y=Et(),w=tn(),_=Ve(),A=S=>{e(!1),_({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:S}})},O=()=>{w.invalidateQueries({predicate:S=>{const v=S.queryKey;return v[1]===j.id&&v[3]==="collection"&&v[4]==="CONNECTIONS"}})},f=async(S,v)=>{R("connection_oauth_succeeded",{connection_id:S,flow:v});const P=new URL(`/api/${j.slug}/mcp/${S}`,window.location.origin);await w.invalidateQueries({queryKey:st.isMCPAuthenticated(P.href,null)}),O()},N=async S=>{l(S.app_name??S.id);try{const P=`${S.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,I=(await y.create.mutateAsync({title:P,description:S.description??null,connection_type:S.connection_type,connection_url:S.connection_url??null,connection_token:null,icon:S.icon??null,app_name:S.app_name??null,app_id:S.app_id??null,connection_headers:S.connection_headers??null})).id,z=await et({connectionId:I,orgId:j.id,orgSlug:j.slug,persistFallback:B=>y.update.mutateAsync({id:I,data:{connection_token:B}}).then(()=>{})});if(z.ran&&!z.ok){R("connection_oauth_failed",{connection_id:I,flow:"clone",error:z.error??"no_token"}),G.error(r("virtualMcp.addConnectionDialog.authenticationFailedError",{error:z.error??"no token received"})),await y.delete.mutateAsync(I);return}z.ran&&await f(I,"clone"),u(I,S.app_name??null,"clone"),m(I)}catch(v){console.error("Failed to add connection:",v),G.error(r("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{l(null)}},T=async S=>{if(!(!j||!b?.user?.id)){l(S.id);try{const v=Fn(S,j.id,b.user.id,{remoteIndex:0}),P=v.connection_type==="STDIO",k=!!v.connection_url,I=P&&v.connection_headers&&typeof v.connection_headers=="object"&&"command"in v.connection_headers;if(!k&&!I){G.error(r("virtualMcp.addConnectionDialog.mcpServerConnectionError")),l(null);return}const{id:z}=await y.create.mutateAsync(v),B=await et({connectionId:z,orgId:j.id,orgSlug:j.slug,persistFallback:E=>y.update.mutateAsync({id:z,data:{connection_token:E}}).then(()=>{})});if(B.ran&&!B.ok){R("connection_oauth_failed",{connection_id:z,flow:"connect_new",error:B.error??"no_token"}),G.warning(r("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:r("virtualMcp.addConnectionDialog.signInFailedDescription",{error:B.error??"no token received"})}),u(z,v.app_name??null,"new"),m(z);return}B.ran?(await f(z,"connect_new"),G.success(r("virtualMcp.addConnectionDialog.connectedAuthenticated"))):G.success(r("virtualMcp.addConnectionDialog.connected")),u(z,v.app_name??null,"new"),m(z)}catch(v){console.error("Failed to connect:",v),G.error(r("virtualMcp.addConnectionDialog.failedToConnect"))}finally{l(null)}}};return t.jsxs($t,{open:n,onOpenChange:e,children:[t.jsxs(Ft,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Lt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx(Bt,{className:"text-base font-semibold",children:r(a==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(On,{value:p,onChange:C,placeholder:r("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(H.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(ke,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(zs,{mode:a,agentId:c,addedConnectionIds:d,onAdd:m,onCloneAndAdd:N,onConnectAndAdd:T,connectingItemId:g,search:p,onCreateConnection:()=>h(!0),onBrowseNavigate:A,defaultTab:s})})]}),t.jsx(Os,{open:x,onOpenChange:h,onCreated:async S=>{h(!1);const v=await et({connectionId:S,orgId:j.id,orgSlug:j.slug,persistFallback:P=>y.update.mutateAsync({id:S,data:{connection_token:P}}).then(()=>{})});if(v.ran&&!v.ok){R("connection_oauth_failed",{connection_id:S,flow:"custom_create",error:v.error??"no_token"}),G.warning(r("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:r("virtualMcp.addConnectionDialog.signInFailedDescription",{error:v.error??"no token received"})}),u(S,null,"custom"),m(S),e(!1);return}v.ran&&await f(S,"custom_create"),u(S,null,"custom"),m(S),e(!1)}})]})}const mt=new Map;function Ro(){const{org:n}=ae(),e=es(),s=ts(),i=s.find(h=>h.providerId==="deco"),{data:o,isLoading:r,refetch:a,isFetching:c}=nn({queryKey:st.aiProviderCredits(n.id,"deco"),enabled:!!i,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),d=o?.balanceCents??null,m=d!=null?d/100:null,u=H.useRef(new Map);if(d!=null){const h=mt.get(n.id);u.current.get(n.id)&&h!=null&&d>h&&R("credits_topped_up_detected",{organization_id:n.id,delta_cents:d-h,previous_balance_cents:h,new_balance_cents:d}),mt.set(n.id,d),u.current.set(n.id,!0)}const g=!!i,l=d!=null&&d>0,p=d!=null&&d===0,C=d!=null&&d===200,x=s.length>0&&s.every(h=>h.providerId==="deco");return{hasDecoKey:g,decoKeyId:i?.id??null,balanceCents:d,balanceDollars:m,hasCredits:l,isZeroBalance:p,isInitialFreeCredit:C,hasOnlyDecoProvider:x,isLoading:r,isFetching:c,refetch:a}}export{Bo as A,Eo as N,Lo as O,Vo as a,cs as b,it as c,ms as d,Mo as e,Rt as f,zo as g,Fo as h,$o as i,at as r,Ro as u};
@@ -1 +1 @@
1
- import{r as s}from"./index-BjqdNfD4.js";import{d as R,D as u}from"./decopilot-sse-pool-DvS9xmzn.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
1
+ import{r as s}from"./index-AWx-XTyH.js";import{d as R,D as u}from"./decopilot-sse-pool-B9mIJbCT.js";const f=()=>0;function g(E){const{orgSlug:t,taskId:a,enabled:n=!0,onStep:o,onFinish:S,onTaskStatus:i}=E,l=s.useRef({taskId:a,onStep:o,onFinish:S,onTaskStatus:i});l.current={taskId:a,onStep:o,onFinish:S,onTaskStatus:i};const c=s.useRef(null),p=s.useRef(n),b=s.useRef(t);(!c.current||p.current!==n||b.current!==t)&&(p.current=n,b.current=t,c.current=d=>{if(!n||!t)return()=>{};const k=T=>{let e;try{e=JSON.parse(T.data)}catch{return}const r=l.current;if(!(r.taskId&&e.subject!==r.taskId)){switch(e.type){case u.STEP:r.onStep?.(e);break;case u.FINISH:r.onFinish?.(e);break;case u.THREAD_STATUS:r.onTaskStatus?.(e);break}d()}};return R.subscribe(t,k)}),s.useSyncExternalStore(c.current,f,f)}export{g as u};
@@ -1 +1 @@
1
- import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,b9 as re,ba as ae}from"./index-BjqdNfD4.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-CAjnI-sk.js";import{u as de}from"./studio-tools-B6TBpJy3.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let F;e[56]!==_?(F=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=F):F=e[57];let b;e[58]!==A||e[59]!==F?(b=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,F]})}),e[58]=A,e[59]=F,e[60]=b):b=e[60];let I;e[61]!==y||e[62]!==b?(I=n.jsxs(V,{children:[y,b]}),e[61]=y,e[62]=b,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ue as D,De as u};
1
+ import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,b9 as re,ba as ae}from"./index-AWx-XTyH.js";import{c as z,d as G,b as V,f as X,g as Z,e as ee,a as te,A as ne}from"./alert-dialog-7uhMzMe-.js";import{u as de}from"./studio-tools-DNNqlbd5.js";function ue(B){const e=oe.c(86),{deleteState:s,cancelDelete:a,confirmDelete:d,confirmForceDelete:c}=B,t=le(),w=s.mode==="deleting";let m;e[0]!==a?(m=W=>{W||a()},e[0]=a,e[1]=m):m=e[1];let u;e[2]!==t?(u=t("common.deleteConnectionDialogs.title"),e[2]=t,e[3]=u):u=e[3];let D;e[4]!==u?(D=n.jsx(z,{children:u}),e[4]=u,e[5]=D):D=e[5];let C;e[6]!==t?(C=t("common.deleteConnectionDialogs.description"),e[6]=t,e[7]=C):C=e[7];const H=s.mode==="deleting"&&s.connection.title;let o;e[8]!==H?(o=n.jsx("span",{className:"font-medium text-foreground",children:H}),e[8]=H,e[9]=o):o=e[9];let l;e[10]!==C||e[11]!==o?(l=n.jsxs(G,{children:[C," ",o,"."]}),e[10]=C,e[11]=o,e[12]=l):l=e[12];let i;e[13]!==D||e[14]!==l?(i=n.jsxs(V,{children:[D,l]}),e[13]=D,e[14]=l,e[15]=i):i=e[15];let f;e[16]!==t?(f=t("common.deleteConnectionDialogs.cancel"),e[16]=t,e[17]=f):f=e[17];let r;e[18]!==f?(r=n.jsx(X,{children:f}),e[18]=f,e[19]=r):r=e[19];let g;e[20]!==t?(g=t("common.deleteConnectionDialogs.delete"),e[20]=t,e[21]=g):g=e[21];let x;e[22]!==d||e[23]!==g?(x=n.jsx(Z,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g}),e[22]=d,e[23]=g,e[24]=x):x=e[24];let h;e[25]!==r||e[26]!==x?(h=n.jsxs(ee,{children:[r,x]}),e[25]=r,e[26]=x,e[27]=h):h=e[27];let j;e[28]!==h||e[29]!==i?(j=n.jsxs(te,{children:[i,h]}),e[28]=h,e[29]=i,e[30]=j):j=e[30];let p;e[31]!==w||e[32]!==j||e[33]!==m?(p=n.jsx(ne,{open:w,onOpenChange:m,children:j}),e[31]=w,e[32]=j,e[33]=m,e[34]=p):p=e[34];const J=s.mode==="force-deleting";let N;e[35]!==a?(N=W=>{W||a()},e[35]=a,e[36]=N):N=e[36];let E;e[37]!==t?(E=t("common.deleteConnectionDialogs.forceDeleteTitle"),e[37]=t,e[38]=E):E=e[38];let y;e[39]!==E?(y=n.jsx(z,{children:E}),e[39]=E,e[40]=y):y=e[40];let O;e[41]!==t?(O=t("common.deleteConnectionDialogs.forceDeleteDescription"),e[41]=t,e[42]=O):O=e[42];const M=s.mode==="force-deleting"&&s.connection.title;let v;e[43]!==M?(v=n.jsx("span",{className:"font-medium text-foreground",children:M}),e[43]=M,e[44]=v):v=e[44];let S;e[45]!==t?(S=t("common.deleteConnectionDialogs.isUsedByAgents"),e[45]=t,e[46]=S):S=e[46];const P=s.mode==="force-deleting"&&s.agentNames;let T;e[47]!==P?(T=n.jsx("span",{className:"font-medium text-foreground",children:P}),e[47]=P,e[48]=T):T=e[48];let A;e[49]!==O||e[50]!==v||e[51]!==S||e[52]!==T?(A=n.jsxs("p",{children:[O," ",v," ",S," ",T,"."]}),e[49]=O,e[50]=v,e[51]=S,e[52]=T,e[53]=A):A=e[53];let _;e[54]!==t?(_=t("common.deleteConnectionDialogs.forceDeleteWarning"),e[54]=t,e[55]=_):_=e[55];let F;e[56]!==_?(F=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=F):F=e[57];let b;e[58]!==A||e[59]!==F?(b=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,F]})}),e[58]=A,e[59]=F,e[60]=b):b=e[60];let I;e[61]!==y||e[62]!==b?(I=n.jsxs(V,{children:[y,b]}),e[61]=y,e[62]=b,e[63]=I):I=e[63];let L;e[64]!==t?(L=t("common.deleteConnectionDialogs.cancel"),e[64]=t,e[65]=L):L=e[65];let R;e[66]!==L?(R=n.jsx(X,{children:L}),e[66]=L,e[67]=R):R=e[67];let q;e[68]!==t?(q=t("common.deleteConnectionDialogs.deleteAnyway"),e[68]=t,e[69]=q):q=e[69];let U;e[70]!==c||e[71]!==q?(U=n.jsx(Z,{onClick:c,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:q}),e[70]=c,e[71]=q,e[72]=U):U=e[72];let K;e[73]!==R||e[74]!==U?(K=n.jsxs(ee,{children:[R,U]}),e[73]=R,e[74]=U,e[75]=K):K=e[75];let $;e[76]!==I||e[77]!==K?($=n.jsxs(te,{children:[I,K]}),e[76]=I,e[77]=K,e[78]=$):$=e[78];let k;e[79]!==J||e[80]!==N||e[81]!==$?(k=n.jsx(ne,{open:J,onOpenChange:N,children:$}),e[79]=J,e[80]=N,e[81]=$,e[82]=k):k=e[82];let Q;return e[83]!==p||e[84]!==k?(Q=n.jsxs(n.Fragment,{children:[p,k]}),e[83]=p,e[84]=k,e[85]=Q):Q=e[85],Q}function De({onSuccess:B}={}){const{org:e}=se(),s=ie(),a=de(),[d,c]=ce.useState({mode:"idle"}),t=()=>{s.invalidateQueries({predicate:o=>{const l=o.queryKey;return l[1]===e.id&&l[3]==="collection"&&l[4]==="CONNECTIONS"}})},w=o=>{re(o),s.invalidateQueries({predicate:l=>l.queryKey[1]===ae&&l.queryKey[3]===o})},m=o=>{t(),w(o),Y.success("Connection deleted successfully"),c({mode:"idle"}),B?.()};return{deleteState:d,requestDelete:o=>{c({mode:"deleting",connection:o})},cancelDelete:()=>{c({mode:"idle"})},confirmDelete:async()=>{if(d.mode!=="deleting")return;const o=d.connection;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o.id}),m(o.id)}catch(l){const i=l instanceof Error?l.message:String(l),f=i.replace(/^Error:\s*/,"");try{const r=JSON.parse(f);if(r.code==="CONNECTION_IN_USE"&&r.agentNames){c({mode:"force-deleting",connection:o,agentNames:r.agentNames.map(g=>`"${g}"`).join(", ")});return}}catch{}Y.error(`Failed to delete connection: ${i}`)}},confirmForceDelete:async()=>{if(d.mode!=="force-deleting")return;const o=d.connection.id;c({mode:"idle"});try{await a.call("COLLECTION_CONNECTIONS_DELETE",{id:o,force:!0}),m(o)}catch(l){const i=l instanceof Error?l.message:String(l);Y.error(`Failed to delete connection: ${i}`)}}}}export{ue as D,De as u};
@@ -1 +1 @@
1
- import{c as s,n as m,K as c}from"./index-BjqdNfD4.js";function l(){const e=s.c(5);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={queryKey:c.deploymentAdminMe(),queryFn:d,staleTime:1/0,retry:2},e[0]=t):t=e[0];const{data:a,isLoading:i}=m(t),r=a==="admin",o=a==="unverified";let n;return e[1]!==i||e[2]!==r||e[3]!==o?(n={isAdmin:r,loading:i,needsEmailVerification:o},e[1]=i,e[2]=r,e[3]=o,e[4]=n):n=e[4],n}async function d(){const e=await fetch("/api/_admin/me",{credentials:"include"});if(e.status>=500)throw new Error(`admin/me request failed: ${e.status}`);return e.ok?"admin":(await e.json().catch(u)).error==="email_not_verified"?"unverified":"denied"}function u(){return{}}export{l as u};
1
+ import{c as s,n as m,K as c}from"./index-AWx-XTyH.js";function l(){const e=s.c(5);let t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={queryKey:c.deploymentAdminMe(),queryFn:d,staleTime:1/0,retry:2},e[0]=t):t=e[0];const{data:a,isLoading:i}=m(t),r=a==="admin",o=a==="unverified";let n;return e[1]!==i||e[2]!==r||e[3]!==o?(n={isAdmin:r,loading:i,needsEmailVerification:o},e[1]=i,e[2]=r,e[3]=o,e[4]=n):n=e[4],n}async function d(){const e=await fetch("/api/_admin/me",{credentials:"include"});if(e.status>=500)throw new Error(`admin/me request failed: ${e.status}`);return e.ok?"admin":(await e.json().catch(u)).error==="email_not_verified"?"unverified":"denied"}function u(){return{}}export{l as u};
@@ -1 +1 @@
1
- import{c as u,F as c,K as r,n as d,x as y,o as C,e as F}from"./index-BjqdNfD4.js";import{u as f}from"./studio-tools-B6TBpJy3.js";function m(){const e=u.c(7),{org:n}=c(),o=f();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}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();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],d(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),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=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),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{I as a,q as b,_ as c,m as u};
1
+ import{c as u,F as c,K as r,n as d,x as y,o as C,e as F}from"./index-AWx-XTyH.js";import{u as f}from"./studio-tools-DNNqlbd5.js";function m(){const e=u.c(7),{org:n}=c(),o=f();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}=y(s);return l.configs}function I(){const e=u.c(7),{org:n}=c(),o=f();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],d(s)}function q(){const e=u.c(8),{org:n}=c(),o=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_CREATE",{...a}),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=f(),i=C();let t;e[0]!==o?(t=a=>o.call("FILE_CONFIG_DELETE",{id:a}),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{I as a,q as b,_ as c,m as u};
@@ -1 +1 @@
1
- import{aQ as l,e0 as d,e1 as v,r as i}from"./index-BjqdNfD4.js";var p=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:o,isFetchingNextPage:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
1
+ import{aQ as l,e0 as d,e1 as v,r as i}from"./index-AWx-XTyH.js";var p=class extends l{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,u=super.createResult(e,t),{isFetching:r,isRefetching:h,isError:a,isRefetchError:g}=u,s=n.fetchMeta?.fetchMore?.direction,o=a&&s==="forward",P=r&&s==="forward",c=a&&s==="backward",f=r&&s==="backward";return{...u,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:v(t,n.data),hasPreviousPage:d(t,n.data),isFetchNextPageError:o,isFetchingNextPage:P,isFetchPreviousPageError:c,isFetchingPreviousPage:f,isRefetchError:g&&!o&&!c,isRefetching:h&&!P&&!f}}};function b(e,t,n=!1,u){const r=i.useRef(null),h=i.useRef(null),a=i.useRef(e),g=i.useRef(t),s=i.useRef(n),o=i.useRef(u);a.current=e,g.current=t,s.current=n,o.current=u;const[P]=i.useState(()=>c=>{h.current=c,r.current&&(r.current.disconnect(),r.current=null),c&&queueMicrotask(()=>{if(h.current!==c)return;const f=new IntersectionObserver(R=>{R[0]?.isIntersecting&&g.current&&!s.current&&a.current()},{root:o.current?.current??null,rootMargin:"0px 0px 200px 0px"});f.observe(c),r.current=f})});return P}export{p as I,b as u};
@@ -1 +1 @@
1
- import{c as g,F as N,K as y,n as _,o as A,e as I,t as q}from"./index-BjqdNfD4.js";import{a as S}from"./use-capability-vqVc-i11.js";import{u as O}from"./studio-tools-B6TBpJy3.js";function b(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{K as a,b as u};
1
+ import{c as g,F as N,K as y,n as _,o as A,e as I,t as q}from"./index-AWx-XTyH.js";import{a as S}from"./use-capability-C5eUQLBX.js";import{u as O}from"./studio-tools-DNNqlbd5.js";function b(){const e=g.c(10),{org:r}=N(),u=O(),{capabilities:a,isPrivileged:c}=S(),d=c||!!a["members:manage"];let t;e[0]!==r.id?(t=y.organizationJoinRequests(r.id),e[0]=r.id,e[1]=t):t=e[1];let s;e[2]!==u?(s=()=>u.call("ORGANIZATION_JOIN_REQUEST_LIST",{}),e[2]=u,e[3]=s):s=e[3];const i=!!r.id&&d;let n;e[4]!==t||e[5]!==s||e[6]!==i?(n={queryKey:t,queryFn:s,enabled:i},e[4]=t,e[5]=s,e[6]=i,e[7]=n):n=e[7];const{data:l}=_(n);let o;return e[8]!==l?.requests?(o=l?.requests??[],e[8]=l?.requests,e[9]=o):o=e[9],o}function K(){const e=g.c(21),{org:r,locator:u}=N(),a=O(),c=A();let d;e[0]!==u||e[1]!==r||e[2]!==c?(d=()=>{c.invalidateQueries({queryKey:y.organizationJoinRequests(r.id)}),c.invalidateQueries({queryKey:y.members(u)})},e[0]=u,e[1]=r,e[2]=c,e[3]=d):d=e[3];const t=d;let s;e[4]!==a?(s=R=>a.call("ORGANIZATION_JOIN_REQUEST_APPROVE",{requestId:R}),e[4]=a,e[5]=s):s=e[5];let i;e[6]!==t?(i=()=>{t(),q.success("Request approved")},e[6]=t,e[7]=i):i=e[7];let n;e[8]!==s||e[9]!==i?(n={mutationFn:s,onSuccess:i,onError:v},e[8]=s,e[9]=i,e[10]=n):n=e[10];const l=I(n);let o;e[11]!==a?(o=R=>a.call("ORGANIZATION_JOIN_REQUEST_DENY",{requestId:R}),e[11]=a,e[12]=o):o=e[12];let f;e[13]!==t?(f=()=>{t(),q.success("Request denied")},e[13]=t,e[14]=f):f=e[14];let m;e[15]!==o||e[16]!==f?(m={mutationFn:o,onSuccess:f,onError:T},e[15]=o,e[16]=f,e[17]=m):m=e[17];const E=I(m);let p;return e[18]!==l||e[19]!==E?(p={approve:l,deny:E},e[18]=l,e[19]=E,e[20]=p):p=e[20],p}function T(e){return q.error(e instanceof Error?e.message:"Failed to deny")}function v(e){return q.error(e instanceof Error?e.message:"Failed to approve")}export{K as a,b as u};
@@ -1 +1 @@
1
- import{r as R,aH as z,aF as V,j as a,bI as W,aC as x,aG as I,bJ as Y,aI as C,bK as w,bL as J,aE as S,bH as Q,bG as X,c as A,b as Z,z as ee,ay as oe,F as te,K as re,x as se}from"./index-BjqdNfD4.js";import{B as _}from"./badge-DTgp6kSY.js";import{c as k,T as E,a as P,b as ae}from"./tooltip-DhTKpLao.js";import{g as ne}from"./index-BP_x5C5G.js";import{s as ie}from"./Eye-BPSpUM1B.js";import{s as ce}from"./Star01-B9yyP_dl.js";import{aC as le}from"./agent-icon-DboEKEwb.js";import{i as de}from"./mcp-oauth-_4C32xnP.js";var g="Radio",[ue,N]=S(g),[pe,fe]=ue(g),G=R.forwardRef((d,e)=>{const{__scopeRadio:t,name:n,checked:o=!1,required:r,disabled:s,value:i="on",onCheck:c,form:l,...f}=d,[u,v]=R.useState(null),p=I(e,h=>v(h)),m=R.useRef(!1),y=u?l||!!u.closest("form"):!0;return a.jsxs(pe,{scope:t,checked:o,disabled:s,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":O(o),"data-disabled":s?"":void 0,disabled:s,value:i,...f,ref:p,onClick:C(d.onClick,h=>{o||c?.(),y&&(m.current=h.isPropagationStopped(),m.current||h.stopPropagation())})}),y&&a.jsx(L,{control:u,bubbles:!m.current,name:n,value:i,checked:o,required:r,disabled:s,form:l,style:{transform:"translateX(-100%)"}})]})});G.displayName=g;var T="RadioIndicator",K=R.forwardRef((d,e)=>{const{__scopeRadio:t,forceMount:n,...o}=d,r=fe(T,t);return a.jsx(J,{present:n||r.checked,children:a.jsx(x.span,{"data-state":O(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:e})})});K.displayName=T;var ve="RadioBubbleInput",L=R.forwardRef(({__scopeRadio:d,control:e,checked:t,bubbles:n=!0,...o},r)=>{const s=R.useRef(null),i=I(s,r),c=Q(t),l=X(e);return R.useEffect(()=>{const f=s.current;if(!f)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==t&&p){const m=new Event("click",{bubbles:n});p.call(f,t),f.dispatchEvent(m)}},[c,t,n]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:i,style:{...o.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});L.displayName=ve;function O(d){return d?"checked":"unchecked"}var me=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b="RadioGroup",[Re]=S(b,[w,N]),D=w(),M=N(),[ye,he]=Re(b),F=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,name:n,defaultValue:o,value:r,required:s=!1,disabled:i=!1,orientation:c,dir:l,loop:f=!0,onValueChange:u,...v}=d,p=D(t),m=z(l),[y,h]=V({prop:r,defaultProp:o??null,onChange:u,caller:b});return a.jsx(ye,{scope:t,name:n,required:s,disabled:i,value:y,onValueChange:h,children:a.jsx(W,{asChild:!0,...p,orientation:c,dir:m,loop:f,children:a.jsx(x.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":i?"":void 0,dir:m,...v,ref:e})})})});F.displayName=b;var U="RadioGroupItem",B=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,disabled:n,...o}=d,r=he(U,t),s=r.disabled||n,i=D(t),c=M(t),l=R.useRef(null),f=I(e,l),u=r.value===o.value,v=R.useRef(!1);return R.useEffect(()=>{const p=y=>{me.includes(y.key)&&(v.current=!0)},m=()=>v.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",m)}},[]),a.jsx(Y,{asChild:!0,...i,focusable:!s,active:u,children:a.jsx(G,{disabled:s,required:r.required,checked:u,...c,...o,name:r.name,ref:f,onCheck:()=>r.onValueChange(o.value),onKeyDown:C(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:C(o.onFocus,()=>{v.current&&l.current?.click()})})})});B.displayName=U;var xe="RadioGroupIndicator",H=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,...n}=d,o=M(t);return a.jsx(K,{...o,...n,ref:e})});H.displayName=xe;var we=F,Se=B,Ae=H;const be=[{key:"readOnlyHint",labelKey:"tools.toolsList.readOnly",Icon:ie,variant:"secondary"},{key:"destructiveHint",labelKey:"tools.toolsList.destructive",Icon:ee,variant:"destructive"},{key:"idempotentHint",labelKey:"tools.toolsList.idempotent",Icon:oe,variant:"secondary"},{key:"openWorldHint",labelKey:"tools.toolsList.openWorld",Icon:ce,variant:"outline"}];function Ne(d){const e=A.c(22),{annotations:t,_meta:n}=d,o=Z();let r;e[0]!==n?(r=ne(n),e[0]=n,e[1]=r):r=e[1];const s=!!r;let i,c,l,f,u;if(e[2]!==t||e[3]!==s||e[4]!==o){u=Symbol.for("react.early_return_sentinel");e:{const m=t?be.filter(h=>t[h.key]===!0):[];if(m.length===0&&!s){u=null;break e}i=ae,c="flex gap-1 flex-nowrap",e[10]!==s||e[11]!==o?(l=s&&a.jsxs(k,{children:[a.jsx(E,{asChild:!0,children:a.jsx(_,{asChild:!0,variant:"secondary",className:"size-6 p-1",children:a.jsx(le,{})})}),a.jsx(P,{children:o("tools.toolsList.interactive")})]}),e[10]=s,e[11]=o,e[12]=l):l=e[12];let y;e[13]!==o?(y=h=>{const{labelKey:j,Icon:q,variant:$}=h;return a.jsxs(k,{children:[a.jsx(E,{asChild:!0,children:a.jsx(_,{asChild:!0,variant:$,className:"size-6 p-1",children:a.jsx(q,{})})}),a.jsx(P,{children:o(j)})]},j)},e[13]=o,e[14]=y):y=e[14],f=m.map(y)}e[2]=t,e[3]=s,e[4]=o,e[5]=i,e[6]=c,e[7]=l,e[8]=f,e[9]=u}else i=e[5],c=e[6],l=e[7],f=e[8],u=e[9];if(u!==Symbol.for("react.early_return_sentinel"))return u;let v;e[15]!==c||e[16]!==l||e[17]!==f?(v=a.jsxs("div",{className:c,children:[l,f]}),e[15]=c,e[16]=l,e[17]=f,e[18]=v):v=e[18];let p;return e[19]!==i||e[20]!==v?(p=a.jsx(i,{children:v}),e[19]=i,e[20]=v,e[21]=p):p=e[21],p}function Ge(d){const e=A.c(11),{connectionId:t}=d,{org:n}=te();let o,r,s;e[0]!==t||e[1]!==n.slug?(o=new URL(`/api/${n.slug}/mcp/${t}`,window.location.origin),s=se,r=re.isMCPAuthenticated(o.href,null),e[0]=t,e[1]=n.slug,e[2]=o,e[3]=r,e[4]=s):(o=e[2],r=e[3],s=e[4]);let i;e[5]!==o||e[6]!==n.id?(i=()=>de({url:o.href,token:null,orgId:n.id}),e[5]=o,e[6]=n.id,e[7]=i):i=e[7];let c;e[8]!==r||e[9]!==i?(c={queryKey:r,queryFn:i},e[8]=r,e[9]=i,e[10]=c):c=e[10];const{data:l}=s(c);return l}export{Se as I,we as R,Ne as T,Ae as a,Ge as u};
1
+ import{r as R,aH as z,aF as V,j as a,bI as W,aC as x,aG as I,bJ as Y,aI as C,bK as w,bL as J,aE as S,bH as Q,bG as X,c as A,b as Z,z as ee,ay as oe,F as te,K as re,x as se}from"./index-AWx-XTyH.js";import{B as _}from"./badge-DrkRrH-Z.js";import{c as k,T as E,a as P,b as ae}from"./tooltip-u2UtZ4A6.js";import{g as ne}from"./index-Doki-u4s.js";import{s as ie}from"./Eye-D-f59z2c.js";import{s as ce}from"./Star01-BXyPOmxC.js";import{aC as le}from"./agent-icon-8M4EsQDg.js";import{i as de}from"./mcp-oauth-CQOT6ZPC.js";var g="Radio",[ue,N]=S(g),[pe,fe]=ue(g),G=R.forwardRef((d,e)=>{const{__scopeRadio:t,name:n,checked:o=!1,required:r,disabled:s,value:i="on",onCheck:c,form:l,...f}=d,[u,v]=R.useState(null),p=I(e,h=>v(h)),m=R.useRef(!1),y=u?l||!!u.closest("form"):!0;return a.jsxs(pe,{scope:t,checked:o,disabled:s,children:[a.jsx(x.button,{type:"button",role:"radio","aria-checked":o,"data-state":O(o),"data-disabled":s?"":void 0,disabled:s,value:i,...f,ref:p,onClick:C(d.onClick,h=>{o||c?.(),y&&(m.current=h.isPropagationStopped(),m.current||h.stopPropagation())})}),y&&a.jsx(L,{control:u,bubbles:!m.current,name:n,value:i,checked:o,required:r,disabled:s,form:l,style:{transform:"translateX(-100%)"}})]})});G.displayName=g;var T="RadioIndicator",K=R.forwardRef((d,e)=>{const{__scopeRadio:t,forceMount:n,...o}=d,r=fe(T,t);return a.jsx(J,{present:n||r.checked,children:a.jsx(x.span,{"data-state":O(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:e})})});K.displayName=T;var ve="RadioBubbleInput",L=R.forwardRef(({__scopeRadio:d,control:e,checked:t,bubbles:n=!0,...o},r)=>{const s=R.useRef(null),i=I(s,r),c=Q(t),l=X(e);return R.useEffect(()=>{const f=s.current;if(!f)return;const u=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==t&&p){const m=new Event("click",{bubbles:n});p.call(f,t),f.dispatchEvent(m)}},[c,t,n]),a.jsx(x.input,{type:"radio","aria-hidden":!0,defaultChecked:t,...o,tabIndex:-1,ref:i,style:{...o.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});L.displayName=ve;function O(d){return d?"checked":"unchecked"}var me=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],b="RadioGroup",[Re]=S(b,[w,N]),D=w(),M=N(),[ye,he]=Re(b),F=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,name:n,defaultValue:o,value:r,required:s=!1,disabled:i=!1,orientation:c,dir:l,loop:f=!0,onValueChange:u,...v}=d,p=D(t),m=z(l),[y,h]=V({prop:r,defaultProp:o??null,onChange:u,caller:b});return a.jsx(ye,{scope:t,name:n,required:s,disabled:i,value:y,onValueChange:h,children:a.jsx(W,{asChild:!0,...p,orientation:c,dir:m,loop:f,children:a.jsx(x.div,{role:"radiogroup","aria-required":s,"aria-orientation":c,"data-disabled":i?"":void 0,dir:m,...v,ref:e})})})});F.displayName=b;var U="RadioGroupItem",B=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,disabled:n,...o}=d,r=he(U,t),s=r.disabled||n,i=D(t),c=M(t),l=R.useRef(null),f=I(e,l),u=r.value===o.value,v=R.useRef(!1);return R.useEffect(()=>{const p=y=>{me.includes(y.key)&&(v.current=!0)},m=()=>v.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",m),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",m)}},[]),a.jsx(Y,{asChild:!0,...i,focusable:!s,active:u,children:a.jsx(G,{disabled:s,required:r.required,checked:u,...c,...o,name:r.name,ref:f,onCheck:()=>r.onValueChange(o.value),onKeyDown:C(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:C(o.onFocus,()=>{v.current&&l.current?.click()})})})});B.displayName=U;var xe="RadioGroupIndicator",H=R.forwardRef((d,e)=>{const{__scopeRadioGroup:t,...n}=d,o=M(t);return a.jsx(K,{...o,...n,ref:e})});H.displayName=xe;var we=F,Se=B,Ae=H;const be=[{key:"readOnlyHint",labelKey:"tools.toolsList.readOnly",Icon:ie,variant:"secondary"},{key:"destructiveHint",labelKey:"tools.toolsList.destructive",Icon:ee,variant:"destructive"},{key:"idempotentHint",labelKey:"tools.toolsList.idempotent",Icon:oe,variant:"secondary"},{key:"openWorldHint",labelKey:"tools.toolsList.openWorld",Icon:ce,variant:"outline"}];function Ne(d){const e=A.c(22),{annotations:t,_meta:n}=d,o=Z();let r;e[0]!==n?(r=ne(n),e[0]=n,e[1]=r):r=e[1];const s=!!r;let i,c,l,f,u;if(e[2]!==t||e[3]!==s||e[4]!==o){u=Symbol.for("react.early_return_sentinel");e:{const m=t?be.filter(h=>t[h.key]===!0):[];if(m.length===0&&!s){u=null;break e}i=ae,c="flex gap-1 flex-nowrap",e[10]!==s||e[11]!==o?(l=s&&a.jsxs(k,{children:[a.jsx(E,{asChild:!0,children:a.jsx(_,{asChild:!0,variant:"secondary",className:"size-6 p-1",children:a.jsx(le,{})})}),a.jsx(P,{children:o("tools.toolsList.interactive")})]}),e[10]=s,e[11]=o,e[12]=l):l=e[12];let y;e[13]!==o?(y=h=>{const{labelKey:j,Icon:q,variant:$}=h;return a.jsxs(k,{children:[a.jsx(E,{asChild:!0,children:a.jsx(_,{asChild:!0,variant:$,className:"size-6 p-1",children:a.jsx(q,{})})}),a.jsx(P,{children:o(j)})]},j)},e[13]=o,e[14]=y):y=e[14],f=m.map(y)}e[2]=t,e[3]=s,e[4]=o,e[5]=i,e[6]=c,e[7]=l,e[8]=f,e[9]=u}else i=e[5],c=e[6],l=e[7],f=e[8],u=e[9];if(u!==Symbol.for("react.early_return_sentinel"))return u;let v;e[15]!==c||e[16]!==l||e[17]!==f?(v=a.jsxs("div",{className:c,children:[l,f]}),e[15]=c,e[16]=l,e[17]=f,e[18]=v):v=e[18];let p;return e[19]!==i||e[20]!==v?(p=a.jsx(i,{children:v}),e[19]=i,e[20]=v,e[21]=p):p=e[21],p}function Ge(d){const e=A.c(11),{connectionId:t}=d,{org:n}=te();let o,r,s;e[0]!==t||e[1]!==n.slug?(o=new URL(`/api/${n.slug}/mcp/${t}`,window.location.origin),s=se,r=re.isMCPAuthenticated(o.href,null),e[0]=t,e[1]=n.slug,e[2]=o,e[3]=r,e[4]=s):(o=e[2],r=e[3],s=e[4]);let i;e[5]!==o||e[6]!==n.id?(i=()=>de({url:o.href,token:null,orgId:n.id}),e[5]=o,e[6]=n.id,e[7]=i):i=e[7];let c;e[8]!==r||e[9]!==i?(c={queryKey:r,queryFn:i},e[8]=r,e[9]=i,e[10]=c):c=e[10];const{data:l}=s(c);return l}export{Se as I,we as R,Ne as T,Ae as a,Ge as u};
@@ -1,4 +1,4 @@
1
- import{d7 as he,d8 as fe,d9 as pe,cf as me,da as _e,bU as m,bV as w,db as ge,dc as we,dd as Te,de as O,df as ye,dg as L,dh as ve,di as M,dj as ke,dk as V,dl as Se,dm as Re,dn as Ce,dp as Q,bw as Ee,by as be,be as Ie,ca as se,cm as Ae,cs as qe,cq as Me,cA as Pe,dq as $e,dr as Oe,ds as N,dt as Ne,du as He,cr as xe,cn as De,co as Ue,cp as je,bu as Fe,dv as Le,dw as Ve,dx as Ge,ch as ze,dy as Ke,dz as Qe,dA as We,bt as U,c as re,x as oe,aM as z}from"./index-BjqdNfD4.js";import{U as P,a as H,e as W}from"./auth-DL46EIm-.js";function D(a){return!!a._zod}function b(a,e){return D(a)?he(a,e):a.safeParse(e)}function ae(a){if(!a)return;let e;if(D(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(D(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 I(a){return a==="completed"||a==="failed"||a==="cancelled"}function J(a){const t=ae(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 Y(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const Ye=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(fe,t=>{this._oncancel(t)}),this.setNotificationHandler(pe,t=>{this._onprogress(t)}),this.setRequestHandler(me,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(_e,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(ge,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(!I(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(I(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[M]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(we,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(Te,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(I(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),O(o)||ye(o)?this._onresponse(o):L(o)?this._onrequest(o,n):ve(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?.[M]?.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),O(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(O(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),O(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,V,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},I(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||{},[M]: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(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));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??Ye,v=()=>y(m.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const k=this._responseHandlers.get(f);k?k(_):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},Se,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},Re,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||{},[M]: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||{},[M]: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||{},[M]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=J(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=Y(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=J(e);this._notificationHandlers.set(s,r=>{const o=Y(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"&&L(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=Q.parse({method:"notifications/tasks/status",params:i});await this.notification(u),I(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(I(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=Q.parse({method:"notifications/tasks/status",params:u});await this.notification(p),I(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function B(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Ze(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];B(n)&&B(o)?t[r]={...n,...o}:t[r]=o}return t}var Xe=be();const et=Ee(Xe);function tt(){const a=new et({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ie(a),a}class st{constructor(e){this._ajv=e??tt()}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 rt{constructor(e){this._client=e}async*callToolStream(e,t=se,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 ot(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 x(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&&x(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&x(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&x(t,e)}}function nt(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 it=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 st,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ae,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",Me,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new rt(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ze(this._capabilities,e)}setRequestHandler(e,t){const r=ae(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(D(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(Ve,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}=nt(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(V,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(Ge,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 v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{x(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(ze,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const v=b(V,f);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new m(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?Ke:Qe,T=b(y,f);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid sampling result: ${v}`)}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:Pe,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Oe.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){ot(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"},N,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Ne,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},N,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},xe,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},De,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ue,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},je,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},N,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},N,t)}async callTool(e,t=se,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},Fe,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Le.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 It={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}`,COMMERCE_DISCOVERY:a=>`${a}_commerce-discovery`},At="get_my_diagnostic",qt="https://github.com/decocms.png",ct="self";function R(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function lt(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,...a.ui?{ui:a.ui}:{}},pinned:!1,connections:[]}}const ne=R("decopilot_"),Mt=ne.is,ut=ne.get,ie=R("dev_"),Pt=ie.get,$t=ie.is,dt="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Ot(a){return lt({id:ut(a),organizationId:a,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:dt,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}const ht=R("commerce-discovery_"),Nt=ht.get,C={AGENT_MANAGER:R("studio-agent-manager_"),AUTOMATION_MANAGER:R("studio-automation-manager_"),CONNECTION_MANAGER:R("studio-connection-manager_"),API_KEY_MANAGER:R("studio-api-key-manager_"),STORE_MANAGER:R("studio-store-manager_"),BRAND_MANAGER:R("studio-brand-manager_"),TASK_MANAGER:R("studio-task-manager_"),USAGE_MANAGER:R("studio-usage-manager_")},Ht={AGENT_MANAGER:C.AGENT_MANAGER.get,AUTOMATION_MANAGER:C.AUTOMATION_MANAGER.get,CONNECTION_MANAGER:C.CONNECTION_MANAGER.get,API_KEY_MANAGER:C.API_KEY_MANAGER.get,STORE_MANAGER:C.STORE_MANAGER.get,BRAND_MANAGER:C.BRAND_MANAGER.get,TASK_MANAGER:C.TASK_MANAGER.get,USAGE_MANAGER:C.USAGE_MANAGER.get};function xt(a){return a?Object.values(C).some(e=>e.is(a)!==null):!1}const j=a=>[{type:"text",text:a}];function ft(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:j(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:j(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:j(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 G(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function pt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...G(e.headers),...G(s.headers)}:e.headers};return a(t,r)}:a}class Z 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 X=10,mt=13,A=32;function F(a){}function _t(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=F,onError:t=F,onRetry:s=F,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 k=f(d);k!==""&&o.push(k);return}if(d.indexOf(`
1
+ import{d7 as he,d8 as fe,d9 as pe,cf as me,da as _e,bU as m,bV as w,db as ge,dc as we,dd as Te,de as O,df as ye,dg as L,dh as ve,di as M,dj as ke,dk as V,dl as Se,dm as Re,dn as Ce,dp as Q,bw as Ee,by as be,be as Ie,ca as se,cm as Ae,cs as qe,cq as Me,cA as Pe,dq as $e,dr as Oe,ds as N,dt as Ne,du as He,cr as xe,cn as De,co as Ue,cp as je,bu as Fe,dv as Le,dw as Ve,dx as Ge,ch as ze,dy as Ke,dz as Qe,dA as We,bt as U,c as re,x as oe,aM as z}from"./index-AWx-XTyH.js";import{U as P,a as H,e as W}from"./auth-CGHXgyTz.js";function D(a){return!!a._zod}function b(a,e){return D(a)?he(a,e):a.safeParse(e)}function ae(a){if(!a)return;let e;if(D(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(D(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 I(a){return a==="completed"||a==="failed"||a==="cancelled"}function J(a){const t=ae(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 Y(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const Ye=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(fe,t=>{this._oncancel(t)}),this.setNotificationHandler(pe,t=>{this._onprogress(t)}),this.setRequestHandler(me,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(_e,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(ge,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(!I(n.status))return await this._waitForTaskUpdate(o,s.signal),await r();if(I(n.status)){const i=await this._taskStore.getTaskResult(o,s.sessionId);return this._clearTaskQueue(o),{...i,_meta:{...i._meta,[M]:{taskId:o}}}}return await r()};return await r()}),this.setRequestHandler(we,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(Te,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(I(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),O(o)||ye(o)?this._onresponse(o):L(o)?this._onrequest(o,n):ve(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?.[M]?.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),O(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(O(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),O(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,V,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},I(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||{},[M]: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(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));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??Ye,v=()=>y(m.fromError(w.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(f,T,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const d=u?.taskId;if(d){const c=_=>{const k=this._responseHandlers.get(f);k?k(_):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},Se,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},Re,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||{},[M]: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||{},[M]: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||{},[M]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const s=J(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=Y(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=J(e);this._notificationHandlers.set(s,r=>{const o=Y(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"&&L(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=Q.parse({method:"notifications/tasks/status",params:i});await this.notification(u),I(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(I(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=Q.parse({method:"notifications/tasks/status",params:u});await this.notification(p),I(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function B(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function Ze(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];B(n)&&B(o)?t[r]={...n,...o}:t[r]=o}return t}var Xe=be();const et=Ee(Xe);function tt(){const a=new et({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ie(a),a}class st{constructor(e){this._ajv=e??tt()}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 rt{constructor(e){this._client=e}async*callToolStream(e,t=se,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 ot(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 x(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&&x(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&x(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&x(t,e)}}function nt(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 it=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 st,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",Ae,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",Me,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new rt(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ze(this._capabilities,e)}setRequestHandler(e,t){const r=ae(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(D(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(Ve,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}=nt(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(V,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(Ge,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 v=T.data,d=h.mode==="form"?h.requestedSchema:void 0;if(h.mode==="form"&&v.action==="accept"&&v.content&&d&&this._capabilities.elicitation?.form?.applyDefaults)try{x(d,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(ze,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new m(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:h}=l.data,f=await Promise.resolve(t(u,p));if(h.task){const v=b(V,f);if(!v.success){const d=v.error instanceof Error?v.error.message:String(v.error);throw new m(w.InvalidParams,`Invalid task creation result: ${d}`)}return v.data}const y=h.tools||h.toolChoice?Ke:Qe,T=b(y,f);if(!T.success){const v=T.error instanceof Error?T.error.message:String(T.error);throw new m(w.InvalidParams,`Invalid sampling result: ${v}`)}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:Pe,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Oe.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){ot(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"},N,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Ne,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},N,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},xe,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},De,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ue,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},je,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},N,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},N,t)}async callTool(e,t=se,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},Fe,t);return this.cacheToolMetadata(s.tools),s}_setupListChangedHandler(e,t,s,r){const o=Le.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 It={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}`,COMMERCE_DISCOVERY:a=>`${a}_commerce-discovery`},At="get_my_diagnostic",qt="https://github.com/decocms.png",ct="self";function R(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function lt(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,...a.ui?{ui:a.ui}:{}},pinned:!1,connections:[]}}const ne=R("decopilot_"),Mt=ne.is,ut=ne.get,ie=R("dev_"),Pt=ie.get,$t=ie.is,dt="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png";function Ot(a){return lt({id:ut(a),organizationId:a,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:dt,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}const ht=R("commerce-discovery_"),Nt=ht.get,C={AGENT_MANAGER:R("studio-agent-manager_"),AUTOMATION_MANAGER:R("studio-automation-manager_"),CONNECTION_MANAGER:R("studio-connection-manager_"),API_KEY_MANAGER:R("studio-api-key-manager_"),STORE_MANAGER:R("studio-store-manager_"),BRAND_MANAGER:R("studio-brand-manager_"),TASK_MANAGER:R("studio-task-manager_"),USAGE_MANAGER:R("studio-usage-manager_")},Ht={AGENT_MANAGER:C.AGENT_MANAGER.get,AUTOMATION_MANAGER:C.AUTOMATION_MANAGER.get,CONNECTION_MANAGER:C.CONNECTION_MANAGER.get,API_KEY_MANAGER:C.API_KEY_MANAGER.get,STORE_MANAGER:C.STORE_MANAGER.get,BRAND_MANAGER:C.BRAND_MANAGER.get,TASK_MANAGER:C.TASK_MANAGER.get,USAGE_MANAGER:C.USAGE_MANAGER.get};function xt(a){return a?Object.values(C).some(e=>e.is(a)!==null):!1}const j=a=>[{type:"text",text:a}];function ft(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:j(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:j(h),isError:!0}}const l=await p.json().catch(()=>({}));return{content:j(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 G(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function pt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...G(e.headers),...G(s.headers)}:e.headers};return a(t,r)}:a}class Z 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 X=10,mt=13,A=32;function F(a){}function _t(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=F,onError:t=F,onRetry:s=F,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 k=f(d);k!==""&&o.push(k);return}if(d.indexOf(`
2
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
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
4
  `,c);continue}const k=d.charCodeAt(c);if(ee(d,c,k)){const S=d.charCodeAt(c+5)===A?c+6:c+5,E=d.slice(S,_);if(p===0&&d.charCodeAt(_+1)===X){e({id:i,event:l,data:E}),i=void 0,u="",l=void 0,c=_+2,_=d.indexOf(`
@@ -1 +1 @@
1
- import{c as m,n as p,x as q,aM as T}from"./index-BjqdNfD4.js";function C(r){const e=m.c(12);let t,o;e[0]!==r?({client:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const n=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==n?(i={...o,queryKey:l,queryFn:s,staleTime:n,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=n,e[11]=i):i=e[11],q(i)}function K(r){const e=m.c(12);let t,o;e[0]!==r?({client:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const n=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==n?(i={...o,queryKey:l,queryFn:s,staleTime:n,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=n,e[11]=i):i=e[11],p(i)}function O(r){const e=m.c(21);let t,o,l,s;e[0]!==r?({client:t,toolName:s,toolArguments:l,...o}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let n,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=q,n=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=n,e[10]=i,e[11]=u}else n=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==n||e[17]!==i||e[18]!==a||e[19]!==y?(c={...n,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=n,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}function M(r){const e=m.c(21);let t,o,l,s;e[0]!==r?({client:t,toolName:s,toolArguments:l,...o}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let n,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=p,n=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=n,e[10]=i,e[11]=u}else n=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==n||e[17]!==i||e[18]!==a||e[19]!==y?(c={...n,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=n,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{K as a,C as b,O as c,M as u};
1
+ import{c as m,n as p,x as q,aM as T}from"./index-AWx-XTyH.js";function C(r){const e=m.c(12);let t,o;e[0]!==r?({client:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const n=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==n?(i={...o,queryKey:l,queryFn:s,staleTime:n,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=n,e[11]=i):i=e[11],q(i)}function K(r){const e=m.c(12);let t,o;e[0]!==r?({client:t,...o}=r,e[0]=r,e[1]=t,e[2]=o):(t=e[1],o=e[2]);let l;e[3]!==t?(l=T.mcpToolsList(t),e[3]=t,e[4]=l):l=e[4];let s;e[5]!==t?(s=async()=>await t.listTools(),e[5]=t,e[6]=s):s=e[6];const n=o.staleTime??3e4;let i;return e[7]!==o||e[8]!==l||e[9]!==s||e[10]!==n?(i={...o,queryKey:l,queryFn:s,staleTime:n,retry:!1},e[7]=o,e[8]=l,e[9]=s,e[10]=n,e[11]=i):i=e[11],p(i)}function O(r){const e=m.c(21);let t,o,l,s;e[0]!==r?({client:t,toolName:s,toolArguments:l,...o}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let n,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=q,n=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=n,e[10]=i,e[11]=u}else n=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==n||e[17]!==i||e[18]!==a||e[19]!==y?(c={...n,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=n,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}function M(r){const e=m.c(21);let t,o,l,s;e[0]!==r?({client:t,toolName:s,toolArguments:l,...o}=r,e[0]=r,e[1]=t,e[2]=o,e[3]=l,e[4]=s):(t=e[1],o=e[2],l=e[3],s=e[4]);let n,i,u;if(e[5]!==t||e[6]!==o||e[7]!==l||e[8]!==s){const f=JSON.stringify(l??{});u=p,n=o,i=T.mcpToolCall(t,s,f),e[5]=t,e[6]=o,e[7]=l,e[8]=s,e[9]=n,e[10]=i,e[11]=u}else n=e[9],i=e[10],u=e[11];let a;e[12]!==t||e[13]!==l||e[14]!==s?(a=async()=>await t.callTool({name:s,arguments:l}),e[12]=t,e[13]=l,e[14]=s,e[15]=a):a=e[15];const y=o.staleTime??3e4;let c;return e[16]!==n||e[17]!==i||e[18]!==a||e[19]!==y?(c={...n,queryKey:i,queryFn:a,staleTime:y,retry:!1},e[16]=n,e[17]=i,e[18]=a,e[19]=y,e[20]=c):c=e[20],u(c)}export{K as a,C as b,O as c,M as u};
@@ -1 +1 @@
1
- import{c,F as m,x as b,K as f,n as M}from"./index-BjqdNfD4.js";import{u as y}from"./use-org-auth-client-DS3AIARn.js";const p=300*1e3;function d(){const t=c.c(7),{locator:e}=m(),o=y();let r;t[0]!==e?(r=f.members(e),t[0]=e,t[1]=r):r=t[1];let s;t[2]!==o?(s=()=>o.organization.listMembers(),t[2]=o,t[3]=s):s=t[3];let n;return t[4]!==r||t[5]!==s?(n={queryKey:r,queryFn:s},t[4]=r,t[5]=s,t[6]=n):n=t[6],b(n)}function q(t){const e=c.c(10);let o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];const{enabled:r}=o,s=r===void 0?!0:r,{locator:n}=m(),a=y();let u;e[2]!==n?(u=f.members(n),e[2]=n,e[3]=u):u=e[3];let i;e[4]!==a?(i=()=>a.organization.listMembers(),e[4]=a,e[5]=i):i=e[5];let l;return e[6]!==s||e[7]!==u||e[8]!==i?(l={queryKey:u,queryFn:i,staleTime:p,enabled:s},e[6]=s,e[7]=u,e[8]=i,e[9]=l):l=e[9],M(l)}export{q as a,d as u};
1
+ import{c,F as m,x as b,K as f,n as M}from"./index-AWx-XTyH.js";import{u as y}from"./use-org-auth-client-eKS3tfiU.js";const p=300*1e3;function d(){const t=c.c(7),{locator:e}=m(),o=y();let r;t[0]!==e?(r=f.members(e),t[0]=e,t[1]=r):r=t[1];let s;t[2]!==o?(s=()=>o.organization.listMembers(),t[2]=o,t[3]=s):s=t[3];let n;return t[4]!==r||t[5]!==s?(n={queryKey:r,queryFn:s},t[4]=r,t[5]=s,t[6]=n):n=t[6],b(n)}function q(t){const e=c.c(10);let o;e[0]!==t?(o=t===void 0?{}:t,e[0]=t,e[1]=o):o=e[1];const{enabled:r}=o,s=r===void 0?!0:r,{locator:n}=m(),a=y();let u;e[2]!==n?(u=f.members(n),e[2]=n,e[3]=u):u=e[3];let i;e[4]!==a?(i=()=>a.organization.listMembers(),e[4]=a,e[5]=i):i=e[5];let l;return e[6]!==s||e[7]!==u||e[8]!==i?(l={queryKey:u,queryFn:i,staleTime:p,enabled:s},e[6]=s,e[7]=u,e[8]=i,e[9]=l):l=e[9],M(l)}export{q as a,d as u};
@@ -1 +1 @@
1
- import{c as m,r}from"./index-BjqdNfD4.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
1
+ import{c as m,r}from"./index-AWx-XTyH.js";const a=768,o=()=>globalThis.innerWidth<a;function u(){const e=m.c(2),[l,n]=r.useState(o);let t,s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(t=()=>{const i=()=>n(o),c=globalThis.matchMedia(`(max-width: ${a-1}px)`);return c.addEventListener("change",i),n(o),()=>c.removeEventListener("change",i)},s=[],e[0]=t,e[1]=s):(t=e[0],s=e[1]),r.useEffect(t,s),l}export{u};
@@ -1 +1 @@
1
- import{G as y,r as c,c as b,j as A,d as C,F as E,a as $}from"./index-BjqdNfD4.js";import{a as _}from"./use-virtual-mcp-DI0WnvSW.js";import{c as G}from"./hooks--B2ClHkv.js";import{f as P}from"./reusable-new-chat-CouMjkYR.js";const h=new Map;function I(e){return`${e.orgId}:${e.userId}`}function w(e){return`sidebar.group-order.${e}`}function O(e){try{const t=localStorage.getItem(e),r=t?JSON.parse(t):[];return Array.isArray(r)?r.filter(s=>typeof s=="string"):[]}catch{return[]}}function N(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function U(e){const t=I(e),r=h.get(t);if(r)return r;const s=y.sidebarGroupOrder(e.orgId,e.userId);let a=!1;try{a=localStorage.getItem(s)!==null}catch{}let o=O(s);if(!a&&o.length===0&&e.userId!=="anon"){const i=O(w(e.orgId));i.length>0&&(o=i)}return h.set(t,o),o}function T(e,t){const r=new Set(t);return U(e).filter(s=>!r.has(s))}function j(e,t){h.set(I(e),t),N(y.sidebarGroupOrder(e.orgId,e.userId),t)}function K(e,t,r=[]){if(r.includes(t))return;const s=T(e,r);s.includes(t)||j(e,[t,...s])}const S=c.createContext(null);function Q(e){const t=b.c(7),{children:r}=e,[s,a]=c.useState(!1),[o,i]=c.useState(0);let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i(k),t[0]=d):d=t[0];const l=d;let n;t[1]!==s||t[2]!==o?(n={empty:s,setEmpty:a,orderRevision:o,bumpOrderRevision:l},t[1]=s,t[2]=o,t[3]=n):n=t[3];let u;return t[4]!==r||t[5]!==n?(u=A.jsx(S.Provider,{value:n,children:r}),t[4]=r,t[5]=n,t[6]=u):u=t[6],u}function k(e){return e+1}function W(){return c.useContext(S)?.empty??!1}function D(){return c.useContext(S)?.bumpOrderRevision??J}function J(){}const v=[],L=()=>()=>{};function B(e){return(e??[]).filter(t=>!!t.pinned).map(t=>t.id)}function X(){const e=b.c(15),t=C(),{org:r}=E(),s=_(),{data:a}=$.useSession(),o=a?.user?.id??"anon";let i;e[0]!==s?(i=B(s),e[0]=s,e[1]=i):i=e[1];const d=i,l=D(),n=G();let u;e[2]!==n?.threads.get?(u=n?.threads.get??H,e[2]=n?.threads.get,e[3]=u):u=e[3];let f;e[4]!==n?.threads.get?(f=n?.threads.get??F,e[4]=n?.threads.get,e[5]=f):f=e[5];const m=c.useSyncExternalStore(n?.threads.subscribe??L,u,f);let g;return e[6]!==l||e[7]!==t||e[8]!==r.id||e[9]!==r.slug||e[10]!==d||e[11]!==a?.user?.id||e[12]!==o||e[13]!==m?(g=(p,x)=>{K({orgId:r.id,userId:o},p,d),l();const R=P(m,p,a?.user?.id)?.id??crypto.randomUUID();t({to:"/$org/$taskId",params:{org:r.slug,taskId:R},search:{...x?.search??{},virtualmcpid:p}})},e[6]=l,e[7]=t,e[8]=r.id,e[9]=r.slug,e[10]=d,e[11]=a?.user?.id,e[12]=o,e[13]=m,e[14]=g):g=e[14],g}function F(){return v}function H(){return v}export{Q as S,D as a,K as b,X as c,B as g,W as u};
1
+ import{G as y,r as c,c as b,j as A,d as C,F as E,a as $}from"./index-AWx-XTyH.js";import{a as _}from"./use-virtual-mcp-Dw5dc6PG.js";import{c as G}from"./hooks-C8vbzir9.js";import{f as P}from"./reusable-new-chat-CouMjkYR.js";const h=new Map;function I(e){return`${e.orgId}:${e.userId}`}function w(e){return`sidebar.group-order.${e}`}function O(e){try{const t=localStorage.getItem(e),r=t?JSON.parse(t):[];return Array.isArray(r)?r.filter(s=>typeof s=="string"):[]}catch{return[]}}function N(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function U(e){const t=I(e),r=h.get(t);if(r)return r;const s=y.sidebarGroupOrder(e.orgId,e.userId);let a=!1;try{a=localStorage.getItem(s)!==null}catch{}let o=O(s);if(!a&&o.length===0&&e.userId!=="anon"){const i=O(w(e.orgId));i.length>0&&(o=i)}return h.set(t,o),o}function T(e,t){const r=new Set(t);return U(e).filter(s=>!r.has(s))}function j(e,t){h.set(I(e),t),N(y.sidebarGroupOrder(e.orgId,e.userId),t)}function K(e,t,r=[]){if(r.includes(t))return;const s=T(e,r);s.includes(t)||j(e,[t,...s])}const S=c.createContext(null);function Q(e){const t=b.c(7),{children:r}=e,[s,a]=c.useState(!1),[o,i]=c.useState(0);let d;t[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i(k),t[0]=d):d=t[0];const l=d;let n;t[1]!==s||t[2]!==o?(n={empty:s,setEmpty:a,orderRevision:o,bumpOrderRevision:l},t[1]=s,t[2]=o,t[3]=n):n=t[3];let u;return t[4]!==r||t[5]!==n?(u=A.jsx(S.Provider,{value:n,children:r}),t[4]=r,t[5]=n,t[6]=u):u=t[6],u}function k(e){return e+1}function W(){return c.useContext(S)?.empty??!1}function D(){return c.useContext(S)?.bumpOrderRevision??J}function J(){}const v=[],L=()=>()=>{};function B(e){return(e??[]).filter(t=>!!t.pinned).map(t=>t.id)}function X(){const e=b.c(15),t=C(),{org:r}=E(),s=_(),{data:a}=$.useSession(),o=a?.user?.id??"anon";let i;e[0]!==s?(i=B(s),e[0]=s,e[1]=i):i=e[1];const d=i,l=D(),n=G();let u;e[2]!==n?.threads.get?(u=n?.threads.get??H,e[2]=n?.threads.get,e[3]=u):u=e[3];let f;e[4]!==n?.threads.get?(f=n?.threads.get??F,e[4]=n?.threads.get,e[5]=f):f=e[5];const m=c.useSyncExternalStore(n?.threads.subscribe??L,u,f);let g;return e[6]!==l||e[7]!==t||e[8]!==r.id||e[9]!==r.slug||e[10]!==d||e[11]!==a?.user?.id||e[12]!==o||e[13]!==m?(g=(p,x)=>{K({orgId:r.id,userId:o},p,d),l();const R=P(m,p,a?.user?.id)?.id??crypto.randomUUID();t({to:"/$org/$taskId",params:{org:r.slug,taskId:R},search:{...x?.search??{},virtualmcpid:p}})},e[6]=l,e[7]=t,e[8]=r.id,e[9]=r.slug,e[10]=d,e[11]=a?.user?.id,e[12]=o,e[13]=m,e[14]=g):g=e[14],g}function F(){return v}function H(){return v}export{Q as S,D as a,K as b,X as c,B as g,W as u};
@@ -1 +1 @@
1
- import{c as x,F as j,a as i}from"./index-BjqdNfD4.js";function A(){const e=x.c(32),{org:O}=j(),o=O.id;let z;e[0]!==o?(z=R=>(f=>i.organization[R]({...f??{},organizationId:o})),e[0]=o,e[1]=z):z=e[1];const t=z;let M;e[2]!==o?(M=R=>(f=>{const y={...f??{}},h=y.query??{};return y.query={...h,organizationId:o},i.organization[R](y)}),e[2]=o,e[3]=M):M=e[3];const n=M;let a,r;e[4]!==n?(a=n("listMembers"),r=n("listRoles"),e[4]=n,e[5]=a,e[6]=r):(a=e[5],r=e[6]);let l,s,c,g,u,m,d,v,b;e[7]!==t?(g=t("inviteMember"),u=t("removeMember"),m=t("updateMemberRole"),d=t("addMember"),v=t("createRole"),b=t("updateRole"),l=t("deleteRole"),s=t("cancelInvitation"),c=t("update"),e[7]=t,e[8]=l,e[9]=s,e[10]=c,e[11]=g,e[12]=u,e[13]=m,e[14]=d,e[15]=v,e[16]=b):(l=e[8],s=e[9],c=e[10],g=e[11],u=e[12],m=e[13],d=e[14],v=e[15],b=e[16]);let p;e[17]!==n?(p=n("getActiveMember"),e[17]=n,e[18]=p):p=e[18];let I;return e[19]!==l||e[20]!==s||e[21]!==c||e[22]!==p||e[23]!==a||e[24]!==r||e[25]!==g||e[26]!==u||e[27]!==m||e[28]!==d||e[29]!==v||e[30]!==b?(I={organization:{listMembers:a,listRoles:r,inviteMember:g,removeMember:u,updateMemberRole:m,addMember:d,createRole:v,updateRole:b,deleteRole:l,cancelInvitation:s,update:c,getActiveMember:p,acceptInvitation:i.organization.acceptInvitation,rejectInvitation:i.organization.rejectInvitation,getInvitation:i.organization.getInvitation,list:i.organization.list,create:i.organization.create,getFullOrganization:i.organization.getFullOrganization}},e[19]=l,e[20]=s,e[21]=c,e[22]=p,e[23]=a,e[24]=r,e[25]=g,e[26]=u,e[27]=m,e[28]=d,e[29]=v,e[30]=b,e[31]=I):I=e[31],I}export{A as u};
1
+ import{c as x,F as j,a as i}from"./index-AWx-XTyH.js";function A(){const e=x.c(32),{org:O}=j(),o=O.id;let z;e[0]!==o?(z=R=>(f=>i.organization[R]({...f??{},organizationId:o})),e[0]=o,e[1]=z):z=e[1];const t=z;let M;e[2]!==o?(M=R=>(f=>{const y={...f??{}},h=y.query??{};return y.query={...h,organizationId:o},i.organization[R](y)}),e[2]=o,e[3]=M):M=e[3];const n=M;let a,r;e[4]!==n?(a=n("listMembers"),r=n("listRoles"),e[4]=n,e[5]=a,e[6]=r):(a=e[5],r=e[6]);let l,s,c,g,u,m,d,v,b;e[7]!==t?(g=t("inviteMember"),u=t("removeMember"),m=t("updateMemberRole"),d=t("addMember"),v=t("createRole"),b=t("updateRole"),l=t("deleteRole"),s=t("cancelInvitation"),c=t("update"),e[7]=t,e[8]=l,e[9]=s,e[10]=c,e[11]=g,e[12]=u,e[13]=m,e[14]=d,e[15]=v,e[16]=b):(l=e[8],s=e[9],c=e[10],g=e[11],u=e[12],m=e[13],d=e[14],v=e[15],b=e[16]);let p;e[17]!==n?(p=n("getActiveMember"),e[17]=n,e[18]=p):p=e[18];let I;return e[19]!==l||e[20]!==s||e[21]!==c||e[22]!==p||e[23]!==a||e[24]!==r||e[25]!==g||e[26]!==u||e[27]!==m||e[28]!==d||e[29]!==v||e[30]!==b?(I={organization:{listMembers:a,listRoles:r,inviteMember:g,removeMember:u,updateMemberRole:m,addMember:d,createRole:v,updateRole:b,deleteRole:l,cancelInvitation:s,update:c,getActiveMember:p,acceptInvitation:i.organization.acceptInvitation,rejectInvitation:i.organization.rejectInvitation,getInvitation:i.organization.getInvitation,list:i.organization.list,create:i.organization.create,getFullOrganization:i.organization.getFullOrganization}},e[19]=l,e[20]=s,e[21]=c,e[22]=p,e[23]=a,e[24]=r,e[25]=g,e[26]=u,e[27]=m,e[28]=d,e[29]=v,e[30]=b,e[31]=I):I=e[31],I}export{A as u};
@@ -1 +1 @@
1
- import{c as u,n as S,o as r,e as y,K as c}from"./index-BjqdNfD4.js";async function f(i,a,e){const s=await fetch(i,a);if(!s.ok){const t=await s.json().catch(()=>null);throw new Error(t?.error||e)}return s.json()}function q(i,a){const e=u.c(8);let s;e[0]!==i?(s=c.orgSsoStatus(i??""),e[0]=i,e[1]=s):s=e[1];let t;e[2]!==a?(t=()=>f(`/api/${a}/sso/status`,void 0,"Failed to check SSO status"),e[2]=a,e[3]=t):t=e[3];const n=!!i&&!!a;let o;return e[4]!==s||e[5]!==t||e[6]!==n?(o={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=o):o=e[7],S(o)}function C(i,a){const e=u.c(8);let s;e[0]!==i?(s=c.orgSsoConfig(i??""),e[0]=i,e[1]=s):s=e[1];let t;e[2]!==a?(t=()=>f(`/api/${a}/sso/config`,void 0,"Failed to fetch SSO config"),e[2]=a,e[3]=t):t=e[3];const n=!!i&&!!a;let o;return e[4]!==s||e[5]!==t||e[6]!==n?(o={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=o):o=e[7],S(o)}function O(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=l=>f(`/api/${a}/sso/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"Failed to save SSO config"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}function m(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=()=>f(`/api/${a}/sso/config`,{method:"DELETE"},"Failed to delete SSO config"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}function h(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=l=>f(`/api/${a}/sso/config/enforce`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enforced:l})},"Failed to toggle SSO enforcement"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}export{C as a,O as b,m as c,h as d,q as u};
1
+ import{c as u,n as S,o as r,e as y,K as c}from"./index-AWx-XTyH.js";async function f(i,a,e){const s=await fetch(i,a);if(!s.ok){const t=await s.json().catch(()=>null);throw new Error(t?.error||e)}return s.json()}function q(i,a){const e=u.c(8);let s;e[0]!==i?(s=c.orgSsoStatus(i??""),e[0]=i,e[1]=s):s=e[1];let t;e[2]!==a?(t=()=>f(`/api/${a}/sso/status`,void 0,"Failed to check SSO status"),e[2]=a,e[3]=t):t=e[3];const n=!!i&&!!a;let o;return e[4]!==s||e[5]!==t||e[6]!==n?(o={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=o):o=e[7],S(o)}function C(i,a){const e=u.c(8);let s;e[0]!==i?(s=c.orgSsoConfig(i??""),e[0]=i,e[1]=s):s=e[1];let t;e[2]!==a?(t=()=>f(`/api/${a}/sso/config`,void 0,"Failed to fetch SSO config"),e[2]=a,e[3]=t):t=e[3];const n=!!i&&!!a;let o;return e[4]!==s||e[5]!==t||e[6]!==n?(o={queryKey:s,queryFn:t,enabled:n},e[4]=s,e[5]=t,e[6]=n,e[7]=o):o=e[7],S(o)}function O(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=l=>f(`/api/${a}/sso/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)},"Failed to save SSO config"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}function m(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=()=>f(`/api/${a}/sso/config`,{method:"DELETE"},"Failed to delete SSO config"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}function h(i,a){const e=u.c(8),s=r();let t;e[0]!==a?(t=l=>f(`/api/${a}/sso/config/enforce`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enforced:l})},"Failed to toggle SSO enforcement"),e[0]=a,e[1]=t):t=e[1];let n;e[2]!==i||e[3]!==s?(n=()=>{s.invalidateQueries({queryKey:c.orgSsoConfig(i)}),s.invalidateQueries({queryKey:c.orgSsoStatus(i)})},e[2]=i,e[3]=s,e[4]=n):n=e[4];let o;return e[5]!==t||e[6]!==n?(o={mutationFn:t,onSuccess:n},e[5]=t,e[6]=n,e[7]=o):o=e[7],y(o)}export{C as a,O as b,m as c,h as d,q as u};