decocms 4.217.13 → 4.217.14
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.
- package/dist/client/assets/{AlertCircle-0OUPWUNo.js → AlertCircle-CEGqDvaA.js} +1 -1
- package/dist/client/assets/{AreaChart-BKcNvqGV.js → AreaChart-rNtuKWY8.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CcZIvmNQ.js → ArrowLeft-D-GaGLbo.js} +1 -1
- package/dist/client/assets/{ArrowUp-CNifCRwW.js → ArrowUp-DazHjV8x.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-CHr_jXVV.js → ArrowUpRight-DNskIx7Q.js} +1 -1
- package/dist/client/assets/{Check-YqNpUnjS.js → Check-B8suwSr9.js} +1 -1
- package/dist/client/assets/{CheckCircle-HA9HSubF.js → CheckCircle-DObEUtRu.js} +1 -1
- package/dist/client/assets/{ChevronDown-BX2HgupK.js → ChevronDown-C6kSK4xi.js} +1 -1
- package/dist/client/assets/{ChevronRight-kdKaq9Ii.js → ChevronRight-BIidR9SM.js} +1 -1
- package/dist/client/assets/{ChevronUp-J2R9ILOH.js → ChevronUp-DHnR36Wm.js} +1 -1
- package/dist/client/assets/{Copy01-Bm8H5mLb.js → Copy01-C9sG-6D6.js} +1 -1
- package/dist/client/assets/{CpuChip01-DgkecjAs.js → CpuChip01-C6R2c7cp.js} +1 -1
- package/dist/client/assets/{CreditCard01-f8B5Wkqh.js → CreditCard01-sjHzWu4n.js} +1 -1
- package/dist/client/assets/{DotsVertical-Cz5ElmDn.js → DotsVertical-DVg_Pbm_.js} +1 -1
- package/dist/client/assets/{Eye-CaOR6o-h.js → Eye-B0s0rmgv.js} +1 -1
- package/dist/client/assets/{FilterLines-CU3G94q8.js → FilterLines-xbs5S3Vb.js} +1 -1
- package/dist/client/assets/{Globe01-BAit6vQe.js → Globe01-_I5Gee5_.js} +1 -1
- package/dist/client/assets/{Globe04-DOMcqhEH.js → Globe04-p6Pq1FLe.js} +1 -1
- package/dist/client/assets/{HardDrive-CGleOs63.js → HardDrive-BX_FsVnA.js} +1 -1
- package/dist/client/assets/{Key01-DE0cHxdc.js → Key01-kW6GScFx.js} +1 -1
- package/dist/client/assets/{LayoutLeft-B3Xq6Q9F.js → LayoutLeft-B8TJ15_W.js} +1 -1
- package/dist/client/assets/{LinkExternal01-CtVhb7np.js → LinkExternal01-Dqas4G6a.js} +1 -1
- package/dist/client/assets/{LogOut01-pEbmO0Np.js → LogOut01-C6waAPKc.js} +1 -1
- package/dist/client/assets/{Monitor01-DDxK-vql.js → Monitor01-BJd3P9Bs.js} +1 -1
- package/dist/client/assets/{Palette-BdM6u7AM.js → Palette-CVUGmkcJ.js} +1 -1
- package/dist/client/assets/{Play-IbqcJdN3.js → Play-D6P4Qt3H.js} +1 -1
- package/dist/client/assets/{Plus-BXW-bLkv.js → Plus-Cuw6ld9s.js} +1 -1
- package/dist/client/assets/{SearchLg-L_ta90AC.js → SearchLg-CvmvPTNH.js} +1 -1
- package/dist/client/assets/{SearchMd-B1jAF5PX.js → SearchMd-BPfugAIu.js} +1 -1
- package/dist/client/assets/{Settings02-D8A1C3JO.js → Settings02-D9mUVp_d.js} +1 -1
- package/dist/client/assets/{Share07-BVdvoyk4.js → Share07-C3qW0KvP.js} +1 -1
- package/dist/client/assets/{Shield01-D2H3k2fO.js → Shield01-BuqzbXhN.js} +1 -1
- package/dist/client/assets/{Star01-Dk3FFpxM.js → Star01-itSgb7DF.js} +1 -1
- package/dist/client/assets/{Stars01-ndnSTODt.js → Stars01-04iBWvYW.js} +1 -1
- package/dist/client/assets/{Stars02-D49Mvriv.js → Stars02-D3OSImoU.js} +1 -1
- package/dist/client/assets/{Sun-BZWpsJUV.js → Sun-fnvHykt1.js} +1 -1
- package/dist/client/assets/{SwitchHorizontal01-B0vjSREj.js → SwitchHorizontal01-Di19iqO8.js} +1 -1
- package/dist/client/assets/{Tool01-BK3Hfpvm.js → Tool01-n6deJtHB.js} +1 -1
- package/dist/client/assets/{Tool02-gKszIrtU.js → Tool02-ChBe855x.js} +1 -1
- package/dist/client/assets/{Trash01-BSXuR-v0.js → Trash01-BysA7V0F.js} +1 -1
- package/dist/client/assets/{TrendUp01-D4y32I70.js → TrendUp01-BhChTRyL.js} +1 -1
- package/dist/client/assets/{Upload01-nh4tHrH4.js → Upload01-Y2mazRed.js} +1 -1
- package/dist/client/assets/{User01-XKHS0Yi2.js → User01-BvPxxSqY.js} +1 -1
- package/dist/client/assets/{Users01-tFQvWfNL.js → Users01-ChDlVjp-.js} +1 -1
- package/dist/client/assets/{Users03-DEaDNrbw.js → Users03-C7g8VOdi.js} +1 -1
- package/dist/client/assets/{X-B1FpD19v.js → X-Bb9AvrlL.js} +1 -1
- package/dist/client/assets/{XCircle-CT6qobjT.js → XCircle-J5pnVl1i.js} +1 -1
- package/dist/client/assets/{XClose-CnW8TKsr.js → XClose-BQLeCToC.js} +1 -1
- package/dist/client/assets/{Zap-CAz1ejRf.js → Zap-B30ko8EF.js} +1 -1
- package/dist/client/assets/{ZapSquare-C7FTkjlS.js → ZapSquare-D28-LH7C.js} +1 -1
- package/dist/client/assets/{access-gate-BUqNYnUF.js → access-gate-DBwhIB9O.js} +1 -1
- package/dist/client/assets/{agent-icon-ivyach6Y.js → agent-icon-s6_qyUu1.js} +1 -1
- package/dist/client/assets/{agents-list-BD8HMFlr.js → agents-list-BIqOwdsn.js} +1 -1
- package/dist/client/assets/{ai-providers-CLkRw_xJ.js → ai-providers-H4mb24A6.js} +1 -1
- package/dist/client/assets/{alert-JiyNNqe_.js → alert-DzZkeGZS.js} +1 -1
- package/dist/client/assets/{alert-dialog-BtRTtbG0.js → alert-dialog-DC6Lplgx.js} +1 -1
- package/dist/client/assets/{api-keys-DpqcfGrn.js → api-keys-Cax5K7wk.js} +1 -1
- package/dist/client/assets/{app-editor-BUsapCBQ.js → app-editor-qAsv6qqG.js} +1 -1
- package/dist/client/assets/{auth-BxRabvv-.js → auth-B_fsW_pO.js} +1 -1
- package/dist/client/assets/{auth-catchall-Cs7ipMDJ.js → auth-catchall-s1CXHbJH.js} +1 -1
- package/dist/client/assets/{auth-entry-Db5e2aY_.js → auth-entry-CNHAV1Br.js} +1 -1
- package/dist/client/assets/{auth-split-layout-Du-8m3RM.js → auth-split-layout-J_umNggt.js} +1 -1
- package/dist/client/assets/{authenticate-and-persist-oauth-DH2xTiqE.js → authenticate-and-persist-oauth-C5hTKLZu.js} +1 -1
- package/dist/client/assets/{automation-list-row-D0gz_UHt.js → automation-list-row-CdL9Bcdo.js} +1 -1
- package/dist/client/assets/{automation-runs-B9PPWxz2.js → automation-runs-BMnosc0O.js} +1 -1
- package/dist/client/assets/{automations-B77Ef8pJ.js → automations-amKzeO-u.js} +1 -1
- package/dist/client/assets/{avatar-BxOwauBx.js → avatar-Cen-fEa-.js} +1 -1
- package/dist/client/assets/{badge-YeCL-pM6.js → badge-Cf8TI2On.js} +1 -1
- package/dist/client/assets/{billing-LBD_HGMi.js → billing-DQSelg4x.js} +1 -1
- package/dist/client/assets/{block-document-Dwn6SQky.js → block-document-BC_10-SY.js} +1 -1
- package/dist/client/assets/{brand-context-B5zJkNnY.js → brand-context-CfH1CgID.js} +1 -1
- package/dist/client/assets/{buckets-BnUKsEzp.js → buckets-CYFjRu-Z.js} +1 -1
- package/dist/client/assets/{bulk-category-panel-DTyd9WI7.js → bulk-category-panel-zETDvhPN.js} +1 -1
- package/dist/client/assets/{capability-load-error-Bl4HXrb5.js → capability-load-error-5XD0Oq4g.js} +1 -1
- package/dist/client/assets/{card-BgLseUz9.js → card-bfZkFKGg.js} +1 -1
- package/dist/client/assets/{cards-nVim6xBl.js → cards-BhMv0YTc.js} +1 -1
- package/dist/client/assets/{category-editor-DsDVl13L.js → category-editor-BepLapvY.js} +1 -1
- package/dist/client/assets/{chat-context-DtiyxjXg.js → chat-context-CViMhULY.js} +1 -1
- package/dist/client/assets/{checkbox-DtxWa1Lp.js → checkbox-BiqXdTZP.js} +1 -1
- package/dist/client/assets/{cli-auth-success-D7_d7B6d.js → cli-auth-success-BJsuzA-1.js} +1 -1
- package/dist/client/assets/{collection-detail-BsnNHZuj.js → collection-detail-BV5oizjn.js} +1 -1
- package/dist/client/assets/{collection-display-button-o9rgPX4h.js → collection-display-button-BaoilCj7.js} +1 -1
- package/dist/client/assets/{collection-search-C5R8jkCo.js → collection-search-UbWH5VZy.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-prfaJL6p.js → collection-table-wrapper-CbDiYvna.js} +1 -1
- package/dist/client/assets/{collection-tabs-CCbVGHLG.js → collection-tabs-B-UVnRIT.js} +1 -1
- package/dist/client/assets/{command-BweZE9r1.js → command-DrNiVNR3.js} +1 -1
- package/dist/client/assets/{commerce-onboarding-D86hui_V.js → commerce-onboarding-OCLqANIK.js} +1 -1
- package/dist/client/assets/{connect-C9Mordhu.js → connect-d2UX1k7O.js} +1 -1
- package/dist/client/assets/{connection-BHMqqEr8.js → connection-DRNSQbMi.js} +1 -1
- package/dist/client/assets/{connection-card-B7NQUqWh.js → connection-card-C9SeUY5z.js} +1 -1
- package/dist/client/assets/{connection-detail-BRAl0ckH.js → connection-detail-s7jjmM9f.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-ZRhzxhfS.js → connection-form-helpers-CZF0KXDA.js} +1 -1
- package/dist/client/assets/{connections-DpqEid10.js → connections-CcNHjVc2.js} +1 -1
- package/dist/client/assets/{decopilot-sse-pool-BwUtRq_o.js → decopilot-sse-pool-H9DQ4gY8.js} +1 -1
- package/dist/client/assets/{dialog-DsCqITds.js → dialog-f2gIoJyo.js} +1 -1
- package/dist/client/assets/{domain-settings-D-pog2VX.js → domain-settings-CuovgRAH.js} +1 -1
- package/dist/client/assets/{drawer-CWuptb6-.js → drawer-BM7WsZWa.js} +1 -1
- package/dist/client/assets/{dropdown-menu-CkysSdXs.js → dropdown-menu-CkRaLL_n.js} +1 -1
- package/dist/client/assets/{empty-state-HwZPqFUt.js → empty-state-6Ei3fC_M.js} +1 -1
- package/dist/client/assets/{extract-connection-data-XyQY0B73.js → extract-connection-data-Dwb0cyv5.js} +1 -1
- package/dist/client/assets/{file-explorer-BYizn1JB.js → file-explorer-BFXhO0OE.js} +1 -1
- package/dist/client/assets/{file-type-icon-Cqwaa-8d.js → file-type-icon-CicLZ25Q.js} +1 -1
- package/dist/client/assets/{form-C5LT36jD.js → form-BfQ5_Xev.js} +1 -1
- package/dist/client/assets/{general-jy9ogNyA.js → general-DZz1BiAH.js} +1 -1
- package/dist/client/assets/{github-repo-picker-UNa4kaK1.js → github-repo-picker-8yIoQVfR.js} +1 -1
- package/dist/client/assets/{hooks-DoEly3LT.js → hooks-IaMFwizq.js} +1 -1
- package/dist/client/assets/{index-B6bkuuby.js → index-6A0kQsfc.js} +1 -1
- package/dist/client/assets/{index-CD1X_eW5.js → index-AtVn8mi0.js} +1 -1
- package/dist/client/assets/{index-uoMzVpNH.js → index-BJ8bMiZH.js} +1 -1
- package/dist/client/assets/{index-wqhKYY5M.js → index-BtGXwuiz.js} +1 -1
- package/dist/client/assets/{index-BQO3LZFM.js → index-D9iRNBXx.js} +1 -1
- package/dist/client/assets/{index-6TRi0uef.js → index-DUWa0kTK.js} +1 -1
- package/dist/client/assets/{index-CxV3B-5l.js → index-DyBmgM84.js} +4 -4
- package/dist/client/assets/{index-HWhUkMVs.js → index-GPtGFYbO.js} +3 -3
- package/dist/client/assets/{index-DC1l1OL-.js → index-ZrFL84cc.js} +1 -1
- package/dist/client/assets/{index-Cb7hCoS-.js → index-diZVRqpE.js} +1 -1
- package/dist/client/assets/{index-redirect-BoS6Qpc-.js → index-redirect-DRzVUZWo.js} +1 -1
- package/dist/client/assets/{input-CDxc4QX0.js → input-C4kw1M0o.js} +1 -1
- package/dist/client/assets/{integration-icon-CtS0uJhZ.js → integration-icon-DrUXWgOf.js} +1 -1
- package/dist/client/assets/{invite-member-dialog-vJbHGv59.js → invite-member-dialog-Dn-nY7b9.js} +1 -1
- package/dist/client/assets/{label-CZbP70z-.js → label-DCGTT-Xz.js} +1 -1
- package/dist/client/assets/{layout-DqMTePyh.js → layout-DDe9VzmF.js} +1 -1
- package/dist/client/assets/{login-Cajnb4aP.js → login-D6N8YGTw.js} +1 -1
- package/dist/client/assets/{mcp-oauth-DKoInR_S.js → mcp-oauth-DYN1bOv6.js} +1 -1
- package/dist/client/assets/{members-SjX1OUIT.js → members-D4U8HZ8h.js} +1 -1
- package/dist/client/assets/{monaco-editor-8vQ4bsg1.js → monaco-editor-C4i3AQCg.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-DCubd6zO.js → monitoring-stats-row-B7ErD4Tf.js} +1 -1
- package/dist/client/assets/{multi-select-CP76ESrQ.js → multi-select-mR66j8Sr.js} +1 -1
- package/dist/client/assets/{oauth-callback-BRJVac2a.js → oauth-callback-CJiOPjAt.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-DwlNDTj-.js → oauth-callback-ai-provider-CCITL_nC.js} +1 -1
- package/dist/client/assets/{onboarding-DN4soHuD.js → onboarding-BvNyPibN.js} +1 -1
- package/dist/client/assets/{org-layout-7FmNBUHk.js → org-layout-D5qHW3da.js} +1 -1
- package/dist/client/assets/{organization-choice-DditNfue.js → organization-choice-BkfJzZK6.js} +1 -1
- package/dist/client/assets/{orgs-C8FbFzrk.js → orgs-DBOtBeOr.js} +1 -1
- package/dist/client/assets/{page-seo-form-q36UjJko.js → page-seo-form-_B8ARCX_.js} +1 -1
- package/dist/client/assets/{popover-CnbRVVJ4.js → popover-BVzFNm24.js} +1 -1
- package/dist/client/assets/{post-editor-CsgQrDnJ.js → post-editor-DxciAkdF.js} +1 -1
- package/dist/client/assets/{primitives-D7u08cAb.js → primitives-BJpIBKy4.js} +1 -1
- package/dist/client/assets/{profile-DjaGLDcj.js → profile-D5Dpkxk9.js} +1 -1
- package/dist/client/assets/{project-app-view-DlvKMam_.js → project-app-view-AbNqnhsW.js} +1 -1
- package/dist/client/assets/record-editor-DnV-f_3E.js +1 -0
- package/dist/client/assets/redirect-editor-B5R2cIbh.js +1 -0
- package/dist/client/assets/registry-BM82mflG.js +2 -0
- package/dist/client/assets/{registry-layout-CQILIy3B.js → registry-layout-ChKu7vVg.js} +1 -1
- package/dist/client/assets/{reports-4WwZo7l5.js → reports-B5HmQreI.js} +2 -2
- package/dist/client/assets/{require-capability-V2e0LU3P.js → require-capability-CPhtITFk.js} +1 -1
- package/dist/client/assets/{required-auth-layout-Cdi-946f.js → required-auth-layout-CMXSrbVh.js} +1 -1
- package/dist/client/assets/{reset-password-Daf0ERPq.js → reset-password-Cc2GeSl_.js} +1 -1
- package/dist/client/assets/{roles-D5WQ-8A7.js → roles-BxCqnDDZ.js} +1 -1
- package/dist/client/assets/{search-input-DmFmc4FA.js → search-input-BQvnJ7ie.js} +1 -1
- package/dist/client/assets/{secrets-Dp7mvwc3.js → secrets-CkJM5pHd.js} +1 -1
- package/dist/client/assets/{sections-editor-D9g5CKfD.js → sections-editor-CtptmgzO.js} +1 -1
- package/dist/client/assets/{select-D3htjNBx.js → select-DCUthKzq.js} +1 -1
- package/dist/client/assets/{select-model-DQpQr2DQ.js → select-model-CAkcqYBe.js} +1 -1
- package/dist/client/assets/{self-tool-result-Ces-0lJd.js → self-tool-result-BnIQca-t.js} +1 -1
- package/dist/client/assets/{seo-editor-DpR_FVvo.js → seo-editor-W-be-pOE.js} +1 -1
- package/dist/client/assets/{settings-layout-Be7ozVBR.js → settings-layout-uM_v5UZP.js} +1 -1
- package/dist/client/assets/{settings-section-DzETP_0_.js → settings-section-CAbLKYDo.js} +1 -1
- package/dist/client/assets/{shell-controls-D7-dloPl.js → shell-controls-BbaCDCTk.js} +1 -1
- package/dist/client/assets/{shell-layout-CzKlLa8f.js → shell-layout-B6xqx3ks.js} +1 -1
- package/dist/client/assets/{sidebar-DbMpr-rh.js → sidebar-BKLfDbJN.js} +1 -1
- package/dist/client/assets/{skeleton-Y7gyZPrn.js → skeleton-E7dM1cU6.js} +1 -1
- package/dist/client/assets/{spinner-CMWgEkOv.js → spinner-BKYiVvRF.js} +1 -1
- package/dist/client/assets/{sso-pOrWsTkM.js → sso-CTp57qTl.js} +1 -1
- package/dist/client/assets/{store-u2l_1WH6.js → store-BtDmLKWJ.js} +1 -1
- package/dist/client/assets/store-registry-AVNiISOY.js +2 -0
- package/dist/client/assets/{studio-tools-whdp8gFV.js → studio-tools-BDRk_Gqu.js} +1 -1
- package/dist/client/assets/{switch-b6594rNl.js → switch-DHdf9bGS.js} +1 -1
- package/dist/client/assets/{synced-repos-DBzAs0pB.js → synced-repos-DHvd4DNO.js} +1 -1
- package/dist/client/assets/{tab-id-fxY7FqYq.js → tab-id-BiJME16N.js} +1 -1
- package/dist/client/assets/{table-Bieg1GxH.js → table-D0OjjXFn.js} +1 -1
- package/dist/client/assets/{tabs-D4B8_rLi.js → tabs-DezkOYP4.js} +1 -1
- package/dist/client/assets/{textarea-CXh3iKjW.js → textarea-BltiOv6V.js} +1 -1
- package/dist/client/assets/{toggle-group-CBptT1rM.js → toggle-group-DhBiPEmR.js} +1 -1
- package/dist/client/assets/{toolbar-BI3FThik.js → toolbar-ANRXiQzU.js} +1 -1
- package/dist/client/assets/{tooltip-DO91iaPZ.js → tooltip-Btz0jJUy.js} +1 -1
- package/dist/client/assets/{track-CY-fnB6q.js → track-CM-gFNzg.js} +1 -1
- package/dist/client/assets/{use-ai-providers-Dfw1C_Qb.js → use-ai-providers-a-L8T3uD.js} +1 -1
- package/dist/client/assets/{use-api-keys-D0_X5TBd.js → use-api-keys-DwiRAhRw.js} +1 -1
- package/dist/client/assets/{use-automations-Y3CwRy47.js → use-automations-CR14JUIv.js} +1 -1
- package/dist/client/assets/{use-autosave-DwrF0hri.js → use-autosave-2cJHdPpV.js} +1 -1
- package/dist/client/assets/{use-capability-hVyOyKfv.js → use-capability-7E41d664.js} +1 -1
- package/dist/client/assets/{use-clock-tick-CttCxR3S.js → use-clock-tick-CcVpPjly.js} +1 -1
- package/dist/client/assets/{use-connection-B24S3YCN.js → use-connection-_5ysFy7m.js} +1 -1
- package/dist/client/assets/{use-copy-BNHHpgOS.js → use-copy-OBJePWyp.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-B4-JNTOi.js → use-create-virtual-mcp-CJZL5OXt.js} +1 -1
- package/dist/client/assets/{use-debounced-autosave-CrvyuS1z.js → use-debounced-autosave-zC-uauJa.js} +1 -1
- package/dist/client/assets/{use-debounced-value-P_5pUA9W.js → use-debounced-value-CgunDIm8.js} +1 -1
- package/dist/client/assets/{use-deco-credits-5oBMNAq-.js → use-deco-credits-C4n4jHC3.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-LcKd19eo.js → use-decopilot-events-eIVvjBw7.js} +1 -1
- package/dist/client/assets/{use-delete-connection-YreJg1bm.js → use-delete-connection-B4-A3kiZ.js} +1 -1
- package/dist/client/assets/{use-deployment-admin-BHP-geVv.js → use-deployment-admin-SQnVkdAY.js} +1 -1
- package/dist/client/assets/{use-file-configs-CPONQlYc.js → use-file-configs-D9uM3Pg0.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-CBy2t19Z.js → use-infinite-scroll-Bx6Dv81T.js} +1 -1
- package/dist/client/assets/{use-join-requests-atODS-UJ.js → use-join-requests-EtqBkha1.js} +1 -1
- package/dist/client/assets/{use-mcp-client-WNkI8KAJ.js → use-mcp-client-B8hPaR2x.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-BW_wQYIZ.js → use-mcp-tools-DxzHZCmj.js} +1 -1
- package/dist/client/assets/{use-members-smedIK7m.js → use-members-caI7LoqI.js} +1 -1
- package/dist/client/assets/{use-mobile-nNGwbm7m.js → use-mobile-DoH3Zs0T.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-9y1G65Xj.js → use-navigate-to-agent-DzLLgouC.js} +1 -1
- package/dist/client/assets/{use-open-billing-url-GphQa9pn.js → use-open-billing-url-93kNP1D3.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-uDIBUVH9.js → use-org-auth-client-BagXMda2.js} +1 -1
- package/dist/client/assets/{use-org-sso-DrOx8nh9.js → use-org-sso-Ck-Kjho-.js} +1 -1
- package/dist/client/assets/{use-organization-roles-DYd5AO4U.js → use-organization-roles-CtXbiqWt.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BJdrgwhq.js → use-organization-settings-JoyMX7--.js} +1 -1
- package/dist/client/assets/{use-registry-connections-ChaImRoz.js → use-registry-connections-BibtsFf-.js} +1 -1
- package/dist/client/assets/{use-secrets-Dl1vnLJJ.js → use-secrets-BX95LtsI.js} +1 -1
- package/dist/client/assets/{use-section-preview-base-BcBdEo4a.js → use-section-preview-base-BqSulPkL.js} +1 -1
- package/dist/client/assets/{use-status-sounds-CRL_QHV0.js → use-status-sounds-CMvp4UmG.js} +1 -1
- package/dist/client/assets/{use-tags-4N4KBIBB.js → use-tags-U4CIg3SL.js} +1 -1
- package/dist/client/assets/{use-view-mode-Cuib_Qyk.js → use-view-mode-9vv-wVeZ.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-uppMIhb1.js → use-virtual-mcp-Bo4QPAh_.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-B4qPBAxY.js +1 -0
- package/dist/client/assets/{useRouterState-DMhgLsX7.js → useRouterState-B6Pq2isx.js} +1 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-KfvQ1Xcr.js +1 -0
- package/dist/client/assets/{users-D_L2xQM5.js → users-BlIhHxql.js} +1 -1
- package/dist/client/assets/{variant-calendar-CqXsSQtn.js → variant-calendar-CfoMFSFl.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-Bd7XGg_T.js → view-mode-toggle-CIT6nAQv.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/record-editor-B9tAoum2.js +0 -1
- package/dist/client/assets/redirect-editor-B0SRp5vj.js +0 -1
- package/dist/client/assets/registry-DMD5W51g.js +0 -2
- package/dist/client/assets/store-registry-D-qh_ccf.js +0 -2
- package/dist/client/assets/useInfiniteQuery-BOShi_GX.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-C2H3DSMn.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as z,b as B,j as t,y as Vt,B as te,r as V,aR as Rt,d as nt,s as Ht,m as K,a as re,t as H,w as Ut,k as De,p as E,F as oe,f as st,u as ot,L as Kt,D as qt,a1 as Gt,a2 as Xt,I as Qt,G as Wt,K as it,o as Yt,n as Jt}from"./index-HWhUkMVs.js";import{i as Zt}from"./ChevronRight-kdKaq9Ii.js";import{i as en}from"./X-B1FpD19v.js";import{aD as tn,Q as nn,A as gt,g as sn,am as on}from"./agent-icon-ivyach6Y.js";import{t as ht}from"./ChevronDown-BX2HgupK.js";import{T as Ce,a as ye,c as Ne}from"./tooltip-DO91iaPZ.js";import{u as pt,d as xt,c as jt}from"./sidebar-DbMpr-rh.js";import{a as at,i as an,f as ln,S as cn,u as rn}from"./use-mcp-client-WNkI8KAJ.js";import{a as dn,u as un}from"./use-virtual-mcp-uppMIhb1.js";import{a as Le,b as vt,P as bt}from"./popover-CnbRVVJ4.js";import{i as Ee}from"./Check-YqNpUnjS.js";import{s as we}from"./Plus-BXW-bLkv.js";import{i as Ct}from"./SearchMd-B1jAF5PX.js";import{s as yt}from"./XClose-CnW8TKsr.js";import{C as mn}from"./self-tool-result-Ces-0lJd.js";import{T as Nt}from"./toolbar-BI3FThik.js";import{S as fn}from"./skeleton-Y7gyZPrn.js";import{D as wt,a as _t,b as St,c as gn,g as hn,e as pn,f as xn}from"./drawer-CWuptb6-.js";import{u as kt}from"./use-mobile-nNGwbm7m.js";import{a as jn,G as vn}from"./github-repo-picker-UNa4kaK1.js";import{g as bn,b as Cn,a as Dt}from"./hooks-DoEly3LT.js";import{u as yn,g as Nn,a as wn,b as _n}from"./use-navigate-to-agent-9y1G65Xj.js";import{a as Sn,c as It}from"./agent-capabilities-cXfbMfjV.js";import{u as At}from"./shell-layout-CzKlLa8f.js";import{f as kn}from"./reusable-new-chat-CouMjkYR.js";import{C as Dn}from"./collection-search-C5R8jkCo.js";import{g as In,a as An,b as Pn,e as Tn}from"./extract-connection-data-XyQY0B73.js";import{u as Pt,a as Tt,g as zn,C as Ye}from"./connection-card-B7NQUqWh.js";import{e as zt,d as Ot,a as Mt,b as $t,h as On,c as Mn}from"./dialog-DsCqITds.js";import{d as W,a as Y,e as J,b as Z,c as ee,F as dt}from"./form-C5LT36jD.js";import{I as ce}from"./input-CDxc4QX0.js";import{S as $n,a as Fn,b as Bn,c as Ln,d as ke}from"./select-D3htjNBx.js";import{T as En}from"./textarea-CXh3iKjW.js";import{b as Ft}from"./use-connection-B24S3YCN.js";import{n as Be,i as Je}from"./Tool02-gKszIrtU.js";import{s as Ze}from"./Star01-Dk3FFpxM.js";import{c as Vn,i as $e,a as ut,E as Rn,p as Hn,b as Un,d as Kn}from"./connection-form-helpers-ZRhzxhfS.js";import{a as et}from"./authenticate-and-persist-oauth-DH2xTiqE.js";import{g as qn}from"./connection-slug-eyAPH6o3.js";import{C as Gn}from"./collection-tabs-CCbVGHLG.js";import{u as mt}from"./use-infinite-scroll-CBy2t19Z.js";import{B as Fe}from"./badge-YeCL-pM6.js";import{u as Xn}from"./useSuspenseInfiniteQuery-C2H3DSMn.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as Qn}from"./studio-tools-whdp8gFV.js";import{u as Wn}from"./use-ai-providers-Dfw1C_Qb.js";const Yn="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Jn(){const n=z.c(13),e=B();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let o;n[1]!==e?(o=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=o):o=n[2];let a;n[3]!==o?(a=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",o,"”"]}),n[3]=o,n[4]=a):a=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:Yn,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=i):i=n[5];let c;n[6]!==e?(c=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=c):c=n[7];let r;n[8]!==c?(r=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[i,t.jsx("span",{className:"text-base font-medium",children:c})]}),n[8]=c,n[9]=r):r=n[9];let l;return n[10]!==a||n[11]!==r?(l=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,a,r]}),n[10]=a,n[11]=r,n[12]=l):l=n[12],l}function Zn(){const n=z.c(19),e=B();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let o;n[2]!==s?(o={Icon:tn,label:s},n[2]=s,n[3]=o):o=n[3];let a;n[4]!==e?(a=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=a):a=n[5];let i;n[6]!==a?(i={Icon:Vt,label:a},n[6]=a,n[7]=i):i=n[7];let c;n[8]!==e?(c=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=c):c=n[9];let r;n[10]!==c?(r={Icon:nn,label:c},n[10]=c,n[11]=r):r=n[11];let l;n[12]!==o||n[13]!==i||n[14]!==r?(l=[o,i,r],n[12]=o,n[13]=i,n[14]=r,n[15]=l):l=n[15];const u=l;let m;n[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=m):m=n[16];let f;return n[17]!==u?(f=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[m,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:u.map(es)})]}),n[17]=u,n[18]=f):f=n[18],f}function es(n){const{Icon:e,label:s}=n;return t.jsxs("li",{className:"flex items-center gap-2.5 text-[13px] leading-tight text-white/70",children:[t.jsx(e,{className:"size-4 shrink-0 opacity-85"}),s]},s)}function To(n){const e=z.c(22),{siteHost:s,footer:o,onClose:a,children:i}=n,c=B(),r=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let l;e[0]!==a||e[1]!==c?(l=a&&t.jsx("button",{type:"button",onClick:a,"aria-label":c("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(en,{size:18})}),e[0]=a,e[1]=c,e[2]=l):l=e[2];let u,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),m=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=u,e[4]=m):(u=e[3],m=e[4]);let f;e[5]!==r||e[6]!==s?(f=s&&t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:16,className:"shrink-0 text-foreground/25"}),r&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:r,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=r,e[6]=s,e[7]=f):f=e[7];let d;e[8]!==f?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[u,m,f]}),e[8]=f,e[9]=d):d=e[9];let h;e[10]!==o?(h=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:o}),e[10]=o,e[11]=h):h=e[11];let C;e[12]!==i||e[13]!==d||e[14]!==h?(C=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[d,i,h]}),e[12]=i,e[13]=d,e[14]=h,e[15]=C):C=e[15];let p,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("img",{src:"https://decoims.com/image?src=decocms%2F8191643a-1947-4c30-afb4-36b8073c90fb%2Fbg-quote.png&quality=original&fit=cover&width=880",alt:"",className:"absolute inset-0 size-full object-cover"}),g=t.jsx("div",{className:"absolute inset-0 bg-black/20"}),e[16]=p,e[17]=g):(p=e[16],g=e[17]);let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[p,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Jn,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zn,{})]})]}),e[18]=j):j=e[18];let v;return e[19]!==l||e[20]!==C?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[l,C,j]}),e[19]=l,e[20]=C,e[21]=v):v=e[21],v}function zo(n){const e=z.c(5),{ready:s,pending:o,label:a,onClick:i,children:c}=n,r=o||!s,l=s&&!o?c:null;let u;return e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==l?(u=t.jsxs(te,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:i,disabled:r,children:[a,l]}),e[0]=a,e[1]=i,e[2]=r,e[3]=l,e[4]=u):u=e[4],u}function Bt(){const n=V.useContext(Rt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(a=>a.status==="pending"&&new Date(a.expiresAt)>new Date),refetch:()=>s?.()}}function ts(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=z.c(13),{org:s,size:o}=n,a=o===void 0?"sm":o,i=a==="xs"?"size-5":"size-6",c=a==="xs"?"text-[9px]":"text-xs";let r;e[0]!==i?(r=K(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s.logo||e[3]!==s.name?(l=s.logo?void 0:ts(s.name),e[2]=s.logo,e[3]=s.name,e[4]=l):l=e[4];let u;e[5]!==s.logo||e[6]!==s.name||e[7]!==c?(u=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:K("font-semibold leading-none",c),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=c,e[8]=u):u=e[8];let m;return e[9]!==r||e[10]!==l||e[11]!==u?(m=t.jsx("div",{className:r,style:l,children:u}),e[9]=r,e[10]=l,e[11]=u,e[12]=m):m=e[12],m}function ns({invitation:n,onChanged:e}){const s=B(),[o,a]=V.useState(!1),i=n.organizationName??s("header.orgSwitcher.unknownOrganization"),c=async()=>{a(!0);try{const u=await re.organization.acceptInvitation({invitationId:n.id});if(u.error){H.error(u.error.message),a(!1);return}}catch{H.error(s("header.orgSwitcher.failedToAcceptInvitation")),a(!1);return}H.success(s("header.orgSwitcher.joined",{name:i})),Ut();let l;try{l=(await re.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=l?`/${l}`:"/"},r=async()=>{a(!0);try{const l=await re.organization.rejectInvitation({invitationId:n.id});if(l.error){H.error(l.error.message),a(!1);return}H.success(s("header.orgSwitcher.invitationDeclined")),a(!1),e()}catch{H.error(s("header.orgSwitcher.failedToDeclineInvitation")),a(!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(lt,{org:{name:i},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:i}),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(te,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:c,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:i}),children:t.jsx(yt,{size:14})})]})]})}function ss(n){const e=z.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:a}=n,i=B(),{data:c}=Ht(),{invitations:r,refetch:l}=Bt();let u;e[0]!==s?(u=(I,A)=>I.slug===s?-1:A.slug===s?1:I.name.localeCompare(A.name),e[0]=s,e[1]=u):u=e[1];const m=[...c??[]].sort(u),[f,d]=V.useState(""),h=f.toLowerCase(),C=h?m.filter(I=>I.name.toLowerCase().includes(h)||I.slug.toLowerCase().includes(h)):m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ct,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=p):p=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=I=>d(I.target.value),e[3]=g):g=e[3];let j;e[4]!==f?(j=I=>I.key==="Escape"&&f&&d(""),e[4]=f,e[5]=j):j=e[5];let v;e[6]!==i?(v=i("header.orgSwitcher.searchOrganizations"),e[6]=i,e[7]=v):v=e[7];let b;e[8]!==f||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:f,onChange:g,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=f,e[9]=j,e[10]=v,e[11]=b):b=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 S;e[13]!==a?(S=t.jsx("button",{type:"button",onClick:a,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]=a,e[14]=S):S=e[14];let D;e[15]!==b||e[16]!==S?(D=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[p,b,S]}),e[15]=b,e[16]=S,e[17]=D):D=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let x;e[18]!==r||e[19]!==f||e[20]!==l?(x=!f&&r.map(I=>t.jsx(ns,{invitation:I,onChanged:l},I.id)),e[18]=r,e[19]=f,e[20]=l,e[21]=x):x=e[21];const k=C.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:f?i("header.orgSwitcher.noOrganizationsMatch",{query:f}):i("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=I=>t.jsxs("button",{type:"button",onClick:()=>o(I.slug),className:K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",I.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:I,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:I.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.slug})]}),I.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},I.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const N=C.map(T);let y;e[25]!==x||e[26]!==k||e[27]!==N?(y=t.jsxs("div",{className:O,children:[x,k,N]}),e[25]=x,e[26]=k,e[27]=N,e[28]=y):y=e[28];let P;return e[29]!==y||e[30]!==D?(P=t.jsxs(t.Fragment,{children:[D,y]}),e[29]=y,e[30]=D,e[31]=P):P=e[31],P}function os(n){const e=z.c(22),{trigger:s,orgParam:o,align:a,side:i}=n,c=a===void 0?"start":a,r=i===void 0?"bottom":i,l=nt(),[u,m]=V.useState(!1),[f,d]=V.useState(!1);let h;e[0]!==s?(h=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=h):h=e[1];const C=String(u);let p;e[2]!==l?(p=D=>{m(!1),l({to:"/$org",params:{org:D}})},e[2]=l,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),d(!0)},e[4]=g):g=e[4];let j;e[5]!==o||e[6]!==C||e[7]!==p?(j=t.jsx(ss,{orgParam:o,onSelectOrg:p,onCreateOrg:g},C),e[5]=o,e[6]=C,e[7]=p,e[8]=j):j=e[8];let v;e[9]!==c||e[10]!==r||e[11]!==j?(v=t.jsx(vt,{side:r,align:c,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:as,onCloseAutoFocus:is,children:j}),e[9]=c,e[10]=r,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==u||e[14]!==h||e[15]!==v?(b=t.jsxs(bt,{open:u,onOpenChange:m,children:[h,v]}),e[13]=u,e[14]=h,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==f?(w=t.jsx(mn,{open:f,onOpenChange:d}),e[17]=f,e[18]=w):w=e[18];let S;return e[19]!==w||e[20]!==b?(S=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=S):S=e[21],S}function is(n){return n.preventDefault()}function as(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ls(n){const e=z.c(21),{value:s,onChange:o,placeholder:a,onKeyDown:i,className:c,isSearching:r,disabled:l}=n,u=a===void 0?"Search...":a;let m;e[0]!==c?(m=K("shrink-0 w-full border-b border-border h-12",c),e[0]=c,e[1]=m):m=e[1];const f=l?"cursor-not-allowed opacity-50":"cursor-text";let d;e[2]!==f?(d=K("flex items-center gap-2.5 h-12 px-4",f),e[2]=f,e[3]=d):d=e[3];let h;e[4]!==r?(h=r?t.jsx(De,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Ct,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=r,e[5]=h):h=e[5];let C;e[6]!==o?(C=v=>o(v.target.value),e[6]=o,e[7]=C):C=e[7];let p;e[8]!==l||e[9]!==i||e[10]!==u||e[11]!==C||e[12]!==s?(p=t.jsx("input",{type:"text",value:s,onChange:C,onKeyDown:i,placeholder:u,disabled:l,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=l,e[9]=i,e[10]=u,e[11]=C,e[12]=s,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==h||e[16]!==p?(g=t.jsxs("label",{className:d,children:[h,p]}),e[14]=d,e[15]=h,e[16]=p,e[17]=g):g=e[17];let j;return e[18]!==m||e[19]!==g?(j=t.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=j):j=e[20],j}function cs(n,e,s){if(!s)return null;const o=bn(n,e);return o?o.threads.get().find(i=>i.id===s)?.branch??null:null}function rs(n){const e=z.c(6),{value:s,onChange:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.searchAgents"),e[0]=a,e[1]=i):i=e[1];let c;return e[2]!==o||e[3]!==i||e[4]!==s?(c=t.jsx(ls,{value:s,onChange:o,placeholder:i}),e[2]=o,e[3]=i,e[4]=s,e[5]=c):c=e[5],c}function ds(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function us(n){const e=z.c(10),{org:s,onClose:o}=n,a=B();let i;e[0]!==s.slug?(i={org:s.slug},e[0]=s.slug,e[1]=i):i=e[1];let c;e[2]!==o?(c=()=>o(),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==a?(r=a("sidebar.agentsSection.seeAllAgents"),e[4]=a,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==c||e[8]!==r?(l=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Kt,{to:"/$org/settings/agents",params:i,onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:r})}),e[6]=i,e[7]=c,e[8]=r,e[9]=l):l=e[9],l}function ms(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Lt,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function fs(n){const e=z.c(11),{onImportFromGithub:s}=n,o=B();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(vn,{className:"size-3.5"}),e[0]=a):a=e[0];let i;e[1]!==o?(i=o("sidebar.agentsSection.import"),e[1]=o,e[2]=i):i=e[2];let c;e[3]!==s||e[4]!==i?(c=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:[a,i]}),e[3]=s,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==o?(r=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=r):r=e[7];let l;return e[8]!==c||e[9]!==r?(l=t.jsx(Lt,{action:c,children:r}),e[8]=c,e[9]=r,e[10]=l):l=e[10],l}function gs(n){const e=z.c(11),{setOpen:s,emptyCtaClass:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.browseAgents"),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==o?(c=K(o),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==s?(r=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{className:"size-4"}),e[6]=l):l=e[6];let u;return e[7]!==i||e[8]!==c||e[9]!==r?(u=t.jsx(Nt,{"aria-label":i,className:c,onClick:r,children:l}),e[7]=i,e[8]=c,e[9]=r,e[10]=u):u=e[10],u}function hs(n){const e=z.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]!==s?(l=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(we,{}),e[7]=u):u=e[7];let m;e[8]!==i?(m=i("sidebar.agentsSection.newAgent"),e[8]=i,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx("span",{children:m}),e[10]=m,e[11]=f):f=e[11];let d;return e[12]!==c||e[13]!==r||e[14]!==l||e[15]!==f?(d=t.jsx(xt,{children:t.jsxs(jt,{tooltip:c,className:r,onClick:l,children:[u,f]})}),e[12]=c,e[13]=r,e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function ps(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(St,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=z.c(8),{emptyCtaClass:s}=n,o=B();let a;e[0]!==o?(a=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a):a=e[1];let i;e[2]!==s?(i=K(s),e[2]=s,e[3]=i):i=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[4]=c):c=e[4];let r;return e[5]!==a||e[6]!==i?(r=t.jsx(Nt,{"aria-label":a,className:i,children:c}),e[5]=a,e[6]=i,e[7]=r):r=e[7],r}function js(n){const e=z.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{}),e[5]=l):l=e[5];let u;e[6]!==i?(u=i("sidebar.agentsSection.newAgent"),e[6]=i,e[7]=u):u=e[7];let m;e[8]!==u?(m=t.jsx("span",{children:u}),e[8]=u,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==r||e[12]!==m?(f=t.jsx(Le,{asChild:!0,children:t.jsxs(jt,{tooltip:c,className:r,children:[l,m]})}),e[10]=c,e[11]=r,e[12]=m,e[13]=f):f=e[13];let d;e[14]!==f||e[15]!==s?(d=s(f),e[14]=f,e[15]=s,e[16]=d):d=e[16];let h;return e[17]!==d?(h=t.jsx(xt,{children:d}),e[17]=d,e[18]=h):h=e[18],h}function vs(n){const e=z.c(9),{children:s}=n,o=B();let a;e[0]!==s?(a=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=a):a=e[1];let i;e[2]!==o?(i=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==i?(c=t.jsx(ye,{side:"right",sideOffset:8,children:i}),e[4]=i,e[5]=c):c=e[5];let r;return e[6]!==a||e[7]!==c?(r=t.jsxs(Ne,{defaultOpen:!0,delayDuration:0,children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8],r}function bs(n){const e=nt(),{create:s}=Cn(),{locator:o}=oe(),a=st({strict:!1}),i=ot({strict:!1});return async c=>{const r=crypto.randomUUID(),l=c===i.virtualmcpid?cs(n,o,a.taskId??""):null;try{await s({id:r,virtual_mcp_id:c,...l?{branch:l}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:r},search:{virtualmcpid:c}})}}function tt(n){const e=z.c(20),{agent:s,selected:o,onClick:a}=n,i=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let c;e[0]!==i?(c=K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s.icon||e[3]!==s.title?(r=t.jsx(gt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=r):r=e[4];let l;e[5]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let m;e[9]!==l||e[10]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,u]}),e[9]=l,e[10]=u,e[11]=m):m=e[11];let f;e[12]!==o?(f=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=f):f=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==r||e[17]!==m||e[18]!==f?(d=t.jsxs("button",{type:"button",onClick:a,className:c,children:[r,m,f]}),e[14]=a,e[15]=c,e[16]=r,e[17]=m,e[18]=f,e[19]=d):d=e[19],d}function Lt(n){const e=z.c(5),{children:s,action:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let i;return e[2]!==o||e[3]!==a?(i=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[a,o]}),e[2]=o,e[3]=a,e[4]=i):i=e[4],i}function Cs(n){const e=z.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:i}=n,[c,r]=V.useState(""),l=dn(),u=l??[],{org:m}=oe(),{data:f}=re.useSession(),d=f?.user?.id??"anon",h=Nn(l),C=wn(),p=bs(m.slug),g=Sn(l),j=c.toLowerCase(),v=u.filter(_s).filter(F=>!g.has(F.id)).filter(ws).filter(F=>!c||F.title.toLowerCase().includes(j)),b=v.filter(Ns),w=v.filter(ys),S=at(m.id),D=!c||S.title.toLowerCase().includes(j),O=!!(o&&D);let x;e[0]!==s||e[1]!==o?(x=()=>{o?.(null),s(),r("")},e[0]=s,e[1]=o,e[2]=x):x=e[2];const k=x,T=F=>{if(o){o(F.id),s(),r("");return}_n({orgId:m.id,userId:d},F.id,h),C(),s(),r(""),p(F.id)},N="flex flex-col max-h-[min(640px,80dvh)]";let y;e[3]!==c?(y=t.jsx(rs,{value:c,onChange:r}),e[3]=c,e[4]=y):y=e[4];const P="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",I=o&&D&&S&&t.jsx(tt,{agent:S,selected:!a||a===S.id,onClick:k}),A=(b.length>0||!c)&&t.jsx(fs,{onImportFromGithub:i}),M=b.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id)),R=w.length>0&&t.jsx(ms,{}),X=w.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id));let L;e[5]!==O||e[6]!==c||e[7]!==v.length?(L=v.length===0&&!O&&c&&t.jsx(ds,{}),e[5]=O,e[6]=c,e[7]=v.length,e[8]=L):L=e[8];let ne;e[9]!==L||e[10]!==I||e[11]!==A||e[12]!==M||e[13]!==R||e[14]!==X?(ne=t.jsxs("div",{className:P,children:[I,A,M,R,X,L]}),e[9]=L,e[10]=I,e[11]=A,e[12]=M,e[13]=R,e[14]=X,e[15]=ne):ne=e[15];let q;e[16]!==s||e[17]!==m?(q=t.jsx(us,{org:m,onClose:s}),e[16]=s,e[17]=m,e[18]=q):q=e[18];let de;return e[19]!==ne||e[20]!==q||e[21]!==y?(de=t.jsxs("div",{className:N,children:[y,ne,q]}),e[19]=ne,e[20]=q,e[21]=y,e[22]=de):de=e[22],de}function ys(n){return!It(n.metadata)}function Ns(n){return It(n.metadata)}function ws(n){return!ln(n.id)}function _s(n){return!an(n.id)}function Ss(n){const e=z.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:a,onSelectAgent:i,selectedAgentId:c,side:r,align:l}=s,u=o===void 0?!1:o,m=r===void 0?"right":r,f=l===void 0?"start":l,[d,h]=V.useState(!1),[C,p]=V.useState(!1),g=kt(),{setOpenMobile:j}=pt(),v=yn(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(vs,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const S=w;let D;e[4]!==g||e[5]!==j?(D=()=>{h(!1),g&&j(!1)},e[4]=g,e[5]=j,e[6]=D):D=e[6];const O=D;let x;e[7]!==O?(x=()=>{O(),p(!0)},e[7]=O,e[8]=x):x=e[8];const k=x;let T;e[9]!==O||e[10]!==k||e[11]!==i||e[12]!==d||e[13]!==c?(T=d&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(fn,{className:"h-4 w-24"})}),children:t.jsx(Cs,{onClose:O,onSelectAgent:i,selectedAgentId:c,onImportFromGithub:k})}),e[9]=O,e[10]=k,e[11]=i,e[12]=d,e[13]=c,e[14]=T):T=e[14];const N=T;let y;e[15]!==f||e[16]!==u||e[17]!==b||e[18]!==v||e[19]!==g||e[20]!==d||e[21]!==N||e[22]!==m||e[23]!==a||e[24]!==S?(y=g?t.jsxs(t.Fragment,{children:[a?t.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:a}):u?S(t.jsx(gs,{setOpen:h,emptyCtaClass:b})):t.jsx(hs,{setOpen:h,highlightEmpty:v,emptyCtaClass:b}),t.jsx(wt,{open:d,onOpenChange:h,direction:"bottom",children:t.jsxs(_t,{className:"max-h-[85dvh] p-0",children:[t.jsx(ps,{}),N]})})]}):t.jsxs(bt,{open:d,onOpenChange:A=>{A&&!d&&E("agent_browser_opened",{surface:"desktop_popover"}),h(A)},children:[a?t.jsx(Le,{asChild:!0,children:a}):u?S(t.jsx(Le,{asChild:!0,children:t.jsx(xs,{emptyCtaClass:b})})):t.jsx(js,{wrapEmptyHint:S,highlightEmpty:v,emptyCtaClass:b}),t.jsx(vt,{className:"w-[380px] p-0 overflow-hidden",side:m,align:f,children:N})]}),e[15]=f,e[16]=u,e[17]=b,e[18]=v,e[19]=g,e[20]=d,e[21]=N,e[22]=m,e[23]=a,e[24]=S,e[25]=y):y=e[25];let P;e[26]!==C?(P=t.jsx(jn,{open:C,onOpenChange:p,mode:"agent"}),e[26]=C,e[27]=P):P=e[27];let I;return e[28]!==P||e[29]!==y?(I=t.jsxs(t.Fragment,{children:[y,P]}),e[28]=P,e[29]=y,e[30]=I):I=e[30],I}const ks="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 Ds(n){const e=z.c(29),{agentId:s,fallback:o,onOpenHome:a,onPick:i}=n,c=B(),r=un(s)??o??null;let l,u,m,f,d;e[0]!==r?.title||e[1]!==a||e[2]!==c?(d=r?.title??c("header.shellBreadcrumb.superAgentDefaultName"),f="flex min-w-0 items-center gap-0",l="button",u=a,m=c("header.shellBreadcrumb.openAgentHome",{name:d}),e[0]=r?.title,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=m,e[6]=f,e[7]=d):(l=e[3],u=e[4],m=e[5],f=e[6],d=e[7]);const h=r?.icon??null;let C;e[8]!==h||e[9]!==d?(C=t.jsx(gt,{icon:h,name:d,size:"xs"}),e[8]=h,e[9]=d,e[10]=C):C=e[10];let p;e[11]!==l||e[12]!==u||e[13]!==m||e[14]!==C?(p=t.jsx("button",{type:l,onClick:u,"aria-label":m,className:"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:C}),e[11]=l,e[12]=u,e[13]=m,e[14]=C,e[15]=p):p=e[15];let g;e[16]!==d?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:d}),e[16]=d,e[17]=g):g=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ks,children:[g,j]}),e[19]=g,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==i||e[23]!==v?(b=t.jsx(Ss,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:i,trigger:v}),e[21]=s,e[22]=i,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==f||e[27]!==p?(w=t.jsxs("div",{className:f,children:[p,b]}),e[25]=b,e[26]=f,e[27]=p,e[28]=w):w=e[28],w}function Oo(n){const e=z.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,a=B(),{org:i}=oe(),{state:c,isMobile:r}=pt(),l=Bt().invitations.length>0,u=c==="collapsed"||r;let m;e[2]!==l||e[3]!==i.name||e[4]!==a?(m=l?a("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:i.name}):a("header.shellBreadcrumb.switchOrganization",{name:i.name}),e[2]=l,e[3]=i.name,e[4]=a,e[5]=m):m=e[5];let f;e[6]!==i?(f=t.jsx(lt,{org:i,size:"sm"}),e[6]=i,e[7]=f):f=e[7];let d;e[8]!==l||e[9]!==u?(d=l&&t.jsx("span",{className:K("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",u?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=l,e[9]=u,e[10]=d):d=e[10];let h;e[11]!==f||e[12]!==d?(h=t.jsxs("span",{className:"relative inline-flex",children:[f,d]}),e[11]=f,e[12]=d,e[13]=h):h=e[13];let C;e[14]!==i.name||e[15]!==o?(C=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:i.name}),e[14]=i.name,e[15]=o,e[16]=C):C=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==h||e[20]!==C?(g=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":m,className:"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:[h,C,p]})}),e[18]=m,e[19]=h,e[20]=C,e[21]=g):g=e[21];let j;e[22]!==i.slug||e[23]!==g?(j=t.jsx(os,{orgParam:i.slug,trigger:g}),e[22]=i.slug,e[23]=g,e[24]=j):j=e[24];let v;e[25]!==i.name?(v=t.jsx(ye,{side:"bottom",children:i.name}),e[25]=i.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Ne,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Mo(n){const e=z.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:a}=oe();let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[2]=i):i=e[2];const c=st(i);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[3]=r):r=e[3];const l=ot(r),{threads:u}=Dt(),{data:m}=re.useSession(),{setTaskId:f,createNewTask:d}=At();let h;e[4]!==a.id?(h=at(a.id),e[4]=a.id,e[5]=h):h=e[5];const C=h,p=C.id,g=c.taskId?l.virtualmcpid??p:p;let j;e[6]!==d||e[7]!==p||e[8]!==o||e[9]!==m?.user?.id||e[10]!==f||e[11]!==u?(j=O=>{const x=O??p,k=kn(u,x,m?.user?.id);k?f(k.id,x):d(x),o?.()},e[6]=d,e[7]=p,e[8]=o,e[9]=m?.user?.id,e[10]=f,e[11]=u,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=g===p?C:void 0;let S;e[14]!==g||e[15]!==v?(S=()=>v(g),e[14]=g,e[15]=v,e[16]=S):S=e[16];let D;return e[17]!==g||e[18]!==v||e[19]!==w||e[20]!==S?(D=t.jsx(V.Suspense,{fallback:b,children:t.jsx(Ds,{agentId:g,fallback:w,onOpenHome:S,onPick:v})}),e[17]=g,e[18]=v,e[19]=w,e[20]=S,e[21]=D):D=e[21],D}function $o(){const n=z.c(24),e=B(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const a=st(o);let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[1]=i):i=n[1];const c=ot(i),{threads:r}=Dt(),{createNewTask:l}=At();let u;n[2]!==s.id?(u=at(s.id),n[2]=s.id,n[3]=u):u=n[3];const m=u.id,f=a.taskId?c.virtualmcpid??m:m;let d;n[4]!==a.taskId||n[5]!==r?(d=(a.taskId?r.find(D=>D.id===a.taskId)?.branch:null)??null,n[4]=a.taskId,n[5]=r,n[6]=d):d=n[6];const h=d;let C;n[7]!==f||n[8]!==l||n[9]!==h?(C=()=>{l(f,h)},n[7]=f,n[8]=l,n[9]=h,n[10]=C):C=n[10];const p=C;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==p||n[15]!==g?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:p,"aria-label":g,className:"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[14]=p,n[15]=g,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let S;return n[21]!==v||n[22]!==w?(S=t.jsxs(Ne,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=S):S=n[23],S}function Is({open:n,onOpenChange:e,onCreated:s}){const o=B(),{org:a}=oe(),{data:i}=re.useSession(),{stdioEnabled:c}=qt(),r=kt(),l=Ft(),u=Pt(),f=Tt(u,"").items,d=Gt({resolver:Xt(Vn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),h=d.watch("ui_type"),C=d.watch("connection_url"),p=d.watch("npx_package"),g=$e({uiType:h,connectionUrl:C??"",npxPackage:p??""})??ut({uiType:h,connectionUrl:C??"",registryItems:f}),j=x=>{const k=x.trim();if(!k)return;const T=!!d.formState.dirtyFields.title,N=!!d.formState.dirtyFields.description,y=!!d.formState.dirtyFields.env_vars,P=A=>{if(A&&(!T&&!d.getValues("title").trim()&&A.title&&d.setValue("title",A.title,{shouldDirty:!1}),!N&&!(d.getValues("description")??"").trim()&&A.description&&d.setValue("description",A.description,{shouldDirty:!1}),!y&&A.envVarKeys?.length)){const M=d.getValues("env_vars")??[],R=new Set(M.map(L=>L.key)),X=A.envVarKeys.filter(L=>!R.has(L));X.length>0&&d.setValue("env_vars",[...M,...X.map(L=>({key:L,value:""}))],{shouldDirty:!0})}},I=Hn(k);if(I&&c){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),P($e({uiType:"NPX",npxPackage:I.packageName}));return}if(k.startsWith("http://")||k.startsWith("https://")){const A=h==="HTTP"||h==="SSE"||h==="Websocket"?h:"HTTP";d.setValue("ui_type",A,{shouldDirty:!0}),d.setValue("connection_url",k,{shouldDirty:!0}),P($e({uiType:A,connectionUrl:k})??ut({uiType:A,connectionUrl:k,registryItems:f}));return}h==="NPX"&&P($e({uiType:"NPX",npxPackage:k}))},v=x=>{x||d.reset(),e(x)},b=async x=>{let k,T=null,N=null,y=null;x.ui_type==="NPX"?(k="STDIO",T="",y=Un(x.npx_package||"",x.env_vars||[])):x.ui_type==="STDIO"?(k="STDIO",T="",y=Kn(x.stdio_command||"",x.stdio_args||"",x.stdio_cwd,x.env_vars||[])):(k=x.ui_type,T=x.connection_url||"",N=x.connection_token||null);const P=In("conn");try{await l.create.mutateAsync({id:P,title:x.title,description:x.description||null,connection_type:k,connection_url:T,connection_token:N,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:i?.user?.id||"system",organization_id:a.id,icon:x.icon??null,app_name:null,app_id:null,connection_headers:y,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(P)}catch{H.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),S=o("connections.createConnectionDialog.description"),D=d.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(W,{control:d.control,name:"ui_type",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs($n,{value:x.value,onValueChange:x.onChange,children:[t.jsx(Z,{children:t.jsx(Fn,{children:t.jsx(Bn,{})})}),t.jsxs(Ln,{children:[t.jsx(ke,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(ke,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(ke,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),c&&t.jsxs(t.Fragment,{children:[t.jsx(ke,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(ke,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(on,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),h==="NPX"&&t.jsx(W,{control:d.control,name:"npx_package",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),h==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(W,{control:d.control,name:"stdio_command",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"stdio_args",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"stdio_cwd",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...x,value:x.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(h==="NPX"||h==="STDIO")&&t.jsx(W,{control:d.control,name:"env_vars",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Rn,{value:x.value??[],onChange:x.onChange})}),t.jsx(ee,{})]})}),h!=="NPX"&&h!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(W,{control:d.control,name:"connection_url",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"connection_token",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:g?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ce,{type:"password",placeholder:g?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...x,value:x.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"title",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...x})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"description",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(En,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...x,value:x.value??""})}),t.jsx(ee,{})]})})]});return r?t.jsx(wt,{open:n,onOpenChange:v,children:t.jsxs(_t,{className:"max-h-[90vh]",children:[t.jsx(gn,{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(St,{children:w}),t.jsx(hn,{className:"mt-1",children:S})]}),t.jsx(pn,{asChild:!0,children:t.jsx(te,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(yt,{size:16})})})]})}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(xn,{children:t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:D})})]})})]})}):t.jsx(zt,{open:n,onOpenChange:v,children:t.jsxs(Ot,{className:"sm:max-w-[525px]",children:[t.jsxs(Mt,{children:[t.jsx($t,{children:w}),t.jsx(On,{children:S})]}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Mn,{children:[t.jsx(te,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:D})]})]})})]})})}function As(n){const e=z.c(72),{mode:s,agentId:o,addedConnectionIds:a,onAdd:i,onCloneAndAdd:c,onConnectAndAdd:r,connectingItemId:l,search:u,onCreateConnection:m,onBrowseNavigate:f,defaultTab:d}=n,h=s===void 0?"add":s,C=d===void 0?"connected":d,p=B(),{org:g}=oe(),j=V.useDeferredValue(u),v=u!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let S;e[2]!==C?(S=_=>_??C,e[2]=C,e[3]=S):S=e[3];const[D,O]=Qt(Wt.connectionsTab(g.slug)+(C==="all"?":home-modal":":agent-modal"),S);let x;e[4]!==D||e[5]!==O?(x=_=>{_!==D&&E("connections_dialog_tab_changed",{to_tab:_}),O(_)},e[4]=D,e[5]=O,e[6]=x):x=e[6];const k=x;let T;e[7]!==g.id||e[8]!==g.slug?(T={connectionId:cn,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=T):T=e[9];const N=rn(T),y=j?.trim().split(/\s+/).filter(Boolean)??[],P=y.length>0?{operator:"or",conditions:y.flatMap(Bs)}:void 0,I={...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(I),{data:M,fetchNextPage:R,hasNextPage:X,isFetchingNextPage:L}=Xn({queryKey:it.collectionListInfinite(N,g.id,"","CONNECTIONS",A),queryFn:async _=>{const{pageParam:$}=_,se=$===void 0?0:$;return(await N.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:$s,staleTime:3e4}),ne=M?.pages.flatMap(Ms)??[],q=zn(ne),de=new Set(ne.filter(Os).map(zs)),F=Pt(),ie=Tt(F,j),Re=mt(ie.loadMore,ie.hasMore,ie.isLoadingMore),He=mt(R,X??!1,L),G=D==="all"||!!w,ct=G?ie.items.filter(_=>{const $=An(_);if($&&de.has($))return!1;if(!w)return!0;const se=Ve(_._meta),ae=[_.title,_.description,_.name,_.server?.title,_.server?.description,_.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return y.some(Q=>ae.includes(Q.toLowerCase()))}):[],_e=ct.filter(Ts),Se=ct.filter(Ps);let Ie;e[10]!==a?(Ie=_=>_.some($=>a.has($.id)),e[10]=a,e[11]=Ie):Ie=e[11];const Ue=Ie;let Ae;e[12]!==a||e[13]!==o||e[14]!==l||e[15]!==Ue||e[16]!==h||e[17]!==i||e[18]!==f||e[19]!==c||e[20]!==p?(Ae=(_,$,se,ae,Q)=>{const Me=Ue(Q),be=Q.find(le=>!a.has(le.id)),U=Q[0];if(h==="browse"){const le=qn(U);return t.jsx(Ye,{connection:{title:$,icon:se,description:Q.length>1?`${Q.length} instances`:ae??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{E("connection_browse_clicked",{app_name:U.app_name??null,connection_id:U.id,instances_count:Q.length}),f?.(le)}},_)}return t.jsx(Ye,{connection:{title:$,icon:se,description:ae},fallbackIcon:t.jsx(Be,{}),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})," ",p("virtualMcp.connectionDialogContent.added")]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),be?(E("connection_add_clicked",{action:"use_existing",app_name:U.app_name??null,connection_id:be.id}),o&&E("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:U.app_name??null,mode:"existing"}),i(be.id)):(E("connection_add_clicked",{action:"clone",app_name:U.app_name??null,base_connection_id:U.id}),c(U))},children:p("virtualMcp.connectionDialogContent.add")})]})},_)},e[12]=a,e[13]=o,e[14]=l,e[15]=Ue,e[16]=h,e[17]=i,e[18]=f,e[19]=c,e[20]=p,e[21]=Ae):Ae=e[21];const Pe=Ae;let Te;e[22]!==l||e[23]!==h||e[24]!==r||e[25]!==p?(Te=_=>{const $=Ve(_._meta),se=$?.friendlyName||$?.friendly_name||_.server?.title||_.title||_.server?.name||_.name||_.id||"",ae=_.server?.description||_.description||null,Q=_.server?.icons?.[0]?.src||Pn(_.server?.repository)||null,Me=$?.official===!0,be=$?.verified===!0,U=$?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:ae,icon:Q},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[U&&t.jsxs(Ne,{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:p("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByDeco")})]}),!U&&Me&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!U&&!Me&&be&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),E("connection_add_clicked",{action:"connect_new",registry_item_id:_.id,app_name:$?.friendlyName||_.server?.name||_.name||null}),r(_)},children:l===_.id?t.jsx(De,{size:14,className:"animate-spin"}):p(h==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${_.id}`)},e[22]=l,e[23]=h,e[24]=r,e[25]=p,e[26]=Te):Te=e[26];const rt=Te;let ue;e[27]!==D||e[28]!==k||e[29]!==m||e[30]!==w||e[31]!==p?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(Gn,{tabs:[{id:"all",label:p("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:p("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:D,onTabChange:_=>k(_)}),t.jsxs(te,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{E("connections_dialog_custom_clicked"),m()},children:[t.jsx(we,{size:12}),p("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=D,e[28]=k,e[29]=m,e[30]=w,e[31]=p,e[32]=ue):ue=e[32];const Ke=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ke?(me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ke),e[33]=Ke,e[34]=me):me=e[34];const Et="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ze;e[35]!==Pe?(ze=_=>{if(_.type==="group")return Pe(_.key,_.title,_.icon,null,_.connections);const $=_.connection;return Pe($.id,$.title,$.icon,$.description??null,[$])},e[35]=Pe,e[36]=ze):ze=e[36];const qe=q.map(ze);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]!==L?(ge=L&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=L,e[40]=ge):ge=e[40];const Ge=G&&_e.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:p("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=G&&_e.map(rt),Qe=G&&Se.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:p("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),We=G&&Se.map(rt);let he;e[41]!==Re||e[42]!==F||e[43]!==G?(he=G&&F.length>0&&t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[41]=Re,e[42]=F,e[43]=G,e[44]=he):he=e[44];let pe;e[45]!==ie.isLoadingMore||e[46]!==G?(pe=G&&ie.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=ie.isLoadingMore,e[46]=G,e[47]=pe):pe=e[47];let xe;e[48]!==qe||e[49]!==fe||e[50]!==ge||e[51]!==Ge||e[52]!==Xe||e[53]!==Qe||e[54]!==We||e[55]!==he||e[56]!==pe?(xe=t.jsxs("div",{className:Et,children:[qe,fe,ge,Ge,Xe,Qe,We,he,pe]}),e[48]=qe,e[49]=fe,e[50]=ge,e[51]=Ge,e[52]=Xe,e[53]=Qe,e[54]=We,e[55]=he,e[56]=pe,e[57]=xe):xe=e[57];let je;e[58]!==D||e[59]!==q.length||e[60]!==Se||e[61]!==u||e[62]!==p||e[63]!==_e?(je=q.length===0&&_e.length===0&&Se.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?p("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:u}):p(D==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=D,e[59]=q.length,e[60]=Se,e[61]=u,e[62]=p,e[63]=_e,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 Oe;return e[69]!==ue||e[70]!==ve?(Oe=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=Oe):Oe=e[71],Oe}function Ps(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Ts(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function zs(n){return n.app_name}function Os(n){return n.app_name}function Ms(n){return n?.items??[]}function $s(n,e){if(n?.hasMore)return e.reduce(Fs,0)}function Fs(n,e){return n+(e?.items?.length??0)}function Bs(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Fo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...a}){const i=B(),c=a.mode??"add",r="agentId"in a?a.agentId:void 0,l="addedConnectionIds"in a?a.addedConnectionIds??new Set:new Set,u="onAdd"in a&&a.onAdd?a.onAdd:N=>{},m=(N,y,P)=>{r&&E("agent_connection_attached",{agent_id:r,connection_id:N,app_name:y,mode:P})},[f,d]=V.useState(null),[h,C]=V.useState(o),[p,g]=V.useState(!1),{org:j}=oe(),{data:v}=re.useSession(),b=Ft(),w=Yt(),S=nt(),D=N=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:N}})},O=()=>{w.invalidateQueries({predicate:N=>{const y=N.queryKey;return y[1]===j.id&&y[3]==="collection"&&y[4]==="CONNECTIONS"}})},x=async(N,y)=>{E("connection_oauth_succeeded",{connection_id:N,flow:y});const P=new URL(`/api/${j.slug}/mcp/${N}`,window.location.origin);await w.invalidateQueries({queryKey:it.isMCPAuthenticated(P.href,null)}),O()},k=async N=>{d(N.app_name??N.id);try{const P=`${N.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:P,description:N.description??null,connection_type:N.connection_type,connection_url:N.connection_url??null,connection_token:null,icon:N.icon??null,app_name:N.app_name??null,app_id:N.app_id??null,connection_headers:N.connection_headers??null})).id,M=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:R=>b.update.mutateAsync({id:A,data:{connection_token:R}}).then(()=>{})});if(M.ran&&!M.ok){E("connection_oauth_failed",{connection_id:A,flow:"clone",error:M.error??"no_token"}),H.error(i("virtualMcp.addConnectionDialog.authenticationFailedError",{error:M.error??"no token received"})),await b.delete.mutateAsync(A);return}M.ran&&await x(A,"clone"),m(A,N.app_name??null,"clone"),u(A)}catch(y){console.error("Failed to add connection:",y),H.error(i("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{d(null)}},T=async N=>{if(!(!j||!v?.user?.id)){d(N.id);try{const y=Tn(N,j.id,v.user.id,{remoteIndex:0}),P=y.connection_type==="STDIO",I=!!y.connection_url,A=P&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!A){H.error(i("virtualMcp.addConnectionDialog.mcpServerConnectionError")),d(null);return}const{id:M}=await b.create.mutateAsync(y),R=await et({connectionId:M,orgId:j.id,orgSlug:j.slug,persistFallback:X=>b.update.mutateAsync({id:M,data:{connection_token:X}}).then(()=>{})});if(R.ran&&!R.ok){E("connection_oauth_failed",{connection_id:M,flow:"connect_new",error:R.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:R.error??"no token received"})}),m(M,y.app_name??null,"new"),u(M);return}R.ran?(await x(M,"connect_new"),H.success(i("virtualMcp.addConnectionDialog.connectedAuthenticated"))):H.success(i("virtualMcp.addConnectionDialog.connected")),m(M,y.app_name??null,"new"),u(M)}catch(y){console.error("Failed to connect:",y),H.error(i("virtualMcp.addConnectionDialog.failedToConnect"))}finally{d(null)}}};return t.jsxs(zt,{open:n,onOpenChange:e,children:[t.jsxs(Ot,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Mt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx($t,{className:"text-base font-semibold",children:i(c==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Dn,{value:h,onChange:C,placeholder:i("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(As,{mode:c,agentId:r,addedConnectionIds:l,onAdd:u,onCloneAndAdd:k,onConnectAndAdd:T,connectingItemId:f,search:h,onCreateConnection:()=>g(!0),onBrowseNavigate:D,defaultTab:s})})]}),t.jsx(Is,{open:p,onOpenChange:g,onCreated:async N=>{g(!1);const y=await et({connectionId:N,orgId:j.id,orgSlug:j.slug,persistFallback:P=>b.update.mutateAsync({id:N,data:{connection_token:P}}).then(()=>{})});if(y.ran&&!y.ok){E("connection_oauth_failed",{connection_id:N,flow:"custom_create",error:y.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:y.error??"no token received"})}),m(N,null,"custom"),u(N),e(!1);return}y.ran&&await x(N,"custom_create"),m(N,null,"custom"),u(N),e(!1)}})]})}const ft=new Map;function Bo(){const{org:n}=oe(),e=Qn(),s=Wn(),o=s.find(g=>g.providerId==="deco"),{data:a,isLoading:i,refetch:c,isFetching:r}=Jt({queryKey:it.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),l=a?.balanceCents??null,u=l!=null?l/100:null,m=V.useRef(new Map);if(l!=null){const g=ft.get(n.id);m.current.get(n.id)&&g!=null&&l>g&&E("credits_topped_up_detected",{organization_id:n.id,delta_cents:l-g,previous_balance_cents:g,new_balance_cents:l}),ft.set(n.id,l),m.current.set(n.id,!0)}const f=!!o,d=l!=null&&l>0,h=l!=null&&l===0,C=l!=null&&l===200,p=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:f,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:d,isZeroBalance:h,isInitialFreeCredit:C,hasOnlyDecoProvider:p,isLoading:i,isFetching:r,refetch:c}}export{Mo as A,To as C,$o as N,Oo as O,zo as a,Fo as b,os as c,lt as d,Bo as u};
|
|
1
|
+
import{c as z,b as B,j as t,y as Vt,B as te,r as V,aR as Rt,d as nt,s as Ht,m as K,a as re,t as H,w as Ut,k as De,p as E,F as oe,f as st,u as ot,L as Kt,D as qt,a1 as Gt,a2 as Xt,I as Qt,G as Wt,K as it,o as Yt,n as Jt}from"./index-GPtGFYbO.js";import{i as Zt}from"./ChevronRight-BIidR9SM.js";import{i as en}from"./X-Bb9AvrlL.js";import{aD as tn,Q as nn,A as gt,g as sn,am as on}from"./agent-icon-s6_qyUu1.js";import{t as ht}from"./ChevronDown-C6kSK4xi.js";import{T as Ce,a as ye,c as Ne}from"./tooltip-Btz0jJUy.js";import{u as pt,d as xt,c as jt}from"./sidebar-BKLfDbJN.js";import{a as at,i as an,f as ln,S as cn,u as rn}from"./use-mcp-client-B8hPaR2x.js";import{a as dn,u as un}from"./use-virtual-mcp-Bo4QPAh_.js";import{a as Le,b as vt,P as bt}from"./popover-BVzFNm24.js";import{i as Ee}from"./Check-B8suwSr9.js";import{s as we}from"./Plus-Cuw6ld9s.js";import{i as Ct}from"./SearchMd-BPfugAIu.js";import{s as yt}from"./XClose-BQLeCToC.js";import{C as mn}from"./self-tool-result-BnIQca-t.js";import{T as Nt}from"./toolbar-ANRXiQzU.js";import{S as fn}from"./skeleton-E7dM1cU6.js";import{D as wt,a as _t,b as St,c as gn,g as hn,e as pn,f as xn}from"./drawer-BM7WsZWa.js";import{u as kt}from"./use-mobile-DoH3Zs0T.js";import{a as jn,G as vn}from"./github-repo-picker-8yIoQVfR.js";import{g as bn,b as Cn,a as Dt}from"./hooks-IaMFwizq.js";import{u as yn,g as Nn,a as wn,b as _n}from"./use-navigate-to-agent-DzLLgouC.js";import{a as Sn,c as It}from"./agent-capabilities-cXfbMfjV.js";import{u as At}from"./shell-layout-B6xqx3ks.js";import{f as kn}from"./reusable-new-chat-CouMjkYR.js";import{C as Dn}from"./collection-search-UbWH5VZy.js";import{g as In,a as An,b as Pn,e as Tn}from"./extract-connection-data-Dwb0cyv5.js";import{u as Pt,a as Tt,g as zn,C as Ye}from"./connection-card-C9SeUY5z.js";import{e as zt,d as Ot,a as Mt,b as $t,h as On,c as Mn}from"./dialog-f2gIoJyo.js";import{d as W,a as Y,e as J,b as Z,c as ee,F as dt}from"./form-BfQ5_Xev.js";import{I as ce}from"./input-C4kw1M0o.js";import{S as $n,a as Fn,b as Bn,c as Ln,d as ke}from"./select-DCUthKzq.js";import{T as En}from"./textarea-BltiOv6V.js";import{b as Ft}from"./use-connection-_5ysFy7m.js";import{n as Be,i as Je}from"./Tool02-ChBe855x.js";import{s as Ze}from"./Star01-itSgb7DF.js";import{c as Vn,i as $e,a as ut,E as Rn,p as Hn,b as Un,d as Kn}from"./connection-form-helpers-CZF0KXDA.js";import{a as et}from"./authenticate-and-persist-oauth-C5hTKLZu.js";import{g as qn}from"./connection-slug-eyAPH6o3.js";import{C as Gn}from"./collection-tabs-B-UVnRIT.js";import{u as mt}from"./use-infinite-scroll-Bx6Dv81T.js";import{B as Fe}from"./badge-Cf8TI2On.js";import{u as Xn}from"./useSuspenseInfiniteQuery-KfvQ1Xcr.js";import{g as Ve}from"./metadata-dUsYcpuu.js";import{u as Qn}from"./studio-tools-BDRk_Gqu.js";import{u as Wn}from"./use-ai-providers-a-L8T3uD.js";const Yn="https://decoims.com/image?src=decocms%2F06b54678-5335-4671-b63a-e13d9e541155%2Fagataesteves.png&quality=original&fit=cover&width=160&height=160";function Jn(){const n=z.c(13),e=B();let s;n[0]===Symbol.for("react.memo_cache_sentinel")?(s=t.jsx("img",{src:"/logos/summit/monte-carlo.svg",alt:"Monte Carlo",className:"h-14 w-[112px] shrink-0 self-start object-contain object-left brightness-0 invert"}),n[0]=s):s=n[0];let o;n[1]!==e?(o=e("routes.commerceOnboarding.connectModal.quote"),n[1]=e,n[2]=o):o=n[2];let a;n[3]!==o?(a=t.jsxs("blockquote",{className:"text-lg font-medium leading-[1.45] lg:text-xl",children:["“",o,"”"]}),n[3]=o,n[4]=a):a=n[4];let i;n[5]===Symbol.for("react.memo_cache_sentinel")?(i=t.jsx("img",{src:Yn,alt:"",className:"size-10 shrink-0 rounded-full object-cover",loading:"lazy"}),n[5]=i):i=n[5];let c;n[6]!==e?(c=e("routes.commerceOnboarding.connectModal.quoteAuthor"),n[6]=e,n[7]=c):c=n[7];let r;n[8]!==c?(r=t.jsxs("figcaption",{className:"flex items-center gap-2.5",children:[i,t.jsx("span",{className:"text-base font-medium",children:c})]}),n[8]=c,n[9]=r):r=n[9];let l;return n[10]!==a||n[11]!==r?(l=t.jsxs("div",{className:"relative flex flex-col gap-8 text-white",children:[s,a,r]}),n[10]=a,n[11]=r,n[12]=l):l=n[12],l}function Zn(){const n=z.c(19),e=B();let s;n[0]!==e?(s=e("routes.commerceOnboarding.connectModal.trustRevoke"),n[0]=e,n[1]=s):s=n[1];let o;n[2]!==s?(o={Icon:tn,label:s},n[2]=s,n[3]=o):o=n[3];let a;n[4]!==e?(a=e("routes.commerceOnboarding.connectModal.trustEncrypted"),n[4]=e,n[5]=a):a=n[5];let i;n[6]!==a?(i={Icon:Vt,label:a},n[6]=a,n[7]=i):i=n[7];let c;n[8]!==e?(c=e("routes.commerceOnboarding.connectModal.trustNeverSold"),n[8]=e,n[9]=c):c=n[9];let r;n[10]!==c?(r={Icon:nn,label:c},n[10]=c,n[11]=r):r=n[11];let l;n[12]!==o||n[13]!==i||n[14]!==r?(l=[o,i,r],n[12]=o,n[13]=i,n[14]=r,n[15]=l):l=n[15];const u=l;let m;n[16]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("div",{className:"h-px w-full bg-white/15"}),n[16]=m):m=n[16];let f;return n[17]!==u?(f=t.jsxs("div",{className:"relative flex flex-col gap-2.5 text-white",children:[m,t.jsx("ul",{className:"mt-1 flex flex-col gap-2.5",children:u.map(es)})]}),n[17]=u,n[18]=f):f=n[18],f}function es(n){const{Icon:e,label:s}=n;return t.jsxs("li",{className:"flex items-center gap-2.5 text-[13px] leading-tight text-white/70",children:[t.jsx(e,{className:"size-4 shrink-0 opacity-85"}),s]},s)}function To(n){const e=z.c(22),{siteHost:s,footer:o,onClose:a,children:i}=n,c=B(),r=s?`https://www.google.com/s2/favicons?domain=${s}&sz=128`:null;let l;e[0]!==a||e[1]!==c?(l=a&&t.jsx("button",{type:"button",onClick:a,"aria-label":c("routes.commerceOnboarding.connectModal.close"),className:"absolute right-3 top-3 z-10 flex size-9 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-black/10 hover:text-foreground lg:text-white/80 lg:hover:bg-white/15 lg:hover:text-white",children:t.jsx(en,{size:18})}),e[0]=a,e[1]=c,e[2]=l):l=e[2];let u,m;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("img",{src:"/logos/deco logo.svg",alt:"Deco",className:"size-7 shrink-0 dark:hidden"}),m=t.jsx("img",{src:"/logos/deco logo negative.svg",alt:"Deco",className:"hidden size-7 shrink-0 dark:block"}),e[3]=u,e[4]=m):(u=e[3],m=e[4]);let f;e[5]!==r||e[6]!==s?(f=s&&t.jsxs(t.Fragment,{children:[t.jsx(Zt,{size:16,className:"shrink-0 text-foreground/25"}),r&&t.jsx("span",{className:"flex size-4 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t.jsx("img",{src:r,alt:"",className:"size-full"})}),t.jsx("span",{className:"truncate text-[15px] leading-tight text-muted-foreground",children:s})]}),e[5]=r,e[6]=s,e[7]=f):f=e[7];let d;e[8]!==f?(d=t.jsxs("div",{className:"flex items-center gap-2",children:[u,m,f]}),e[8]=f,e[9]=d):d=e[9];let h;e[10]!==o?(h=t.jsx("div",{className:"flex shrink-0 flex-col gap-3",children:o}),e[10]=o,e[11]=h):h=e[11];let C;e[12]!==i||e[13]!==d||e[14]!==h?(C=t.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-8 bg-background p-6 lg:p-8",children:[d,i,h]}),e[12]=i,e[13]=d,e[14]=h,e[15]=C):C=e[15];let p,g;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("img",{src:"https://decoims.com/image?src=decocms%2F8191643a-1947-4c30-afb4-36b8073c90fb%2Fbg-quote.png&quality=original&fit=cover&width=880",alt:"",className:"absolute inset-0 size-full object-cover"}),g=t.jsx("div",{className:"absolute inset-0 bg-black/20"}),e[16]=p,e[17]=g):(p=e[16],g=e[17]);let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsxs("aside",{className:"relative hidden shrink-0 overflow-hidden lg:flex lg:w-[440px] lg:flex-col lg:p-14",children:[p,g,t.jsxs("div",{className:"relative z-10 flex h-full flex-col",children:[t.jsx("div",{className:"flex-1"}),t.jsx(Jn,{}),t.jsx("div",{className:"flex-1"}),t.jsx(Zn,{})]})]}),e[18]=j):j=e[18];let v;return e[19]!==l||e[20]!==C?(v=t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col lg:flex-row",children:[l,C,j]}),e[19]=l,e[20]=C,e[21]=v):v=e[21],v}function zo(n){const e=z.c(5),{ready:s,pending:o,label:a,onClick:i,children:c}=n,r=o||!s,l=s&&!o?c:null;let u;return e[0]!==a||e[1]!==i||e[2]!==r||e[3]!==l?(u=t.jsxs(te,{type:"button",size:"lg",className:"h-auto min-h-12 w-full whitespace-normal rounded-lg py-3 text-center text-base font-medium leading-tight",onClick:i,disabled:r,children:[a,l]}),e[0]=a,e[1]=i,e[2]=r,e[3]=l,e[4]=u):u=e[4],u}function Bt(){const n=V.useContext(Rt),{data:e,refetch:s}=n.hooks.useListUserInvitations();return{invitations:(e??[]).filter(a=>a.status==="pending"&&new Date(a.expiresAt)>new Date),refetch:()=>s?.()}}function ts(n){let e=0;for(let o=0;o<n.length;o++)e=n.charCodeAt(o)+((e<<5)-e);const s=Math.abs(e)%360;return{backgroundColor:`hsl(${s} 55% 70%)`,color:`hsl(${s} 55% 20%)`}}function lt(n){const e=z.c(13),{org:s,size:o}=n,a=o===void 0?"sm":o,i=a==="xs"?"size-5":"size-6",c=a==="xs"?"text-[9px]":"text-xs";let r;e[0]!==i?(r=K(i,"shrink-0 rounded-md flex items-center justify-center border border-border/50 overflow-hidden"),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==s.logo||e[3]!==s.name?(l=s.logo?void 0:ts(s.name),e[2]=s.logo,e[3]=s.name,e[4]=l):l=e[4];let u;e[5]!==s.logo||e[6]!==s.name||e[7]!==c?(u=s.logo?t.jsx("img",{src:s.logo,alt:"",className:"size-full object-cover"}):t.jsx("span",{className:K("font-semibold leading-none",c),children:s.name.slice(0,2).toUpperCase()}),e[5]=s.logo,e[6]=s.name,e[7]=c,e[8]=u):u=e[8];let m;return e[9]!==r||e[10]!==l||e[11]!==u?(m=t.jsx("div",{className:r,style:l,children:u}),e[9]=r,e[10]=l,e[11]=u,e[12]=m):m=e[12],m}function ns({invitation:n,onChanged:e}){const s=B(),[o,a]=V.useState(!1),i=n.organizationName??s("header.orgSwitcher.unknownOrganization"),c=async()=>{a(!0);try{const u=await re.organization.acceptInvitation({invitationId:n.id});if(u.error){H.error(u.error.message),a(!1);return}}catch{H.error(s("header.orgSwitcher.failedToAcceptInvitation")),a(!1);return}H.success(s("header.orgSwitcher.joined",{name:i})),Ut();let l;try{l=(await re.organization.getFullOrganization({query:{organizationId:n.organizationId}}))?.data?.slug}catch{}window.location.href=l?`/${l}`:"/"},r=async()=>{a(!0);try{const l=await re.organization.rejectInvitation({invitationId:n.id});if(l.error){H.error(l.error.message),a(!1);return}H.success(s("header.orgSwitcher.invitationDeclined")),a(!1),e()}catch{H.error(s("header.orgSwitcher.failedToDeclineInvitation")),a(!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(lt,{org:{name:i},size:"sm"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",children:i}),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(te,{size:"sm",variant:"default",className:"h-7 text-xs",onClick:c,disabled:o,children:s("header.orgSwitcher.accept")}),t.jsx(te,{size:"icon",variant:"ghost",className:"size-7 text-muted-foreground",onClick:r,disabled:o,"aria-label":s("header.orgSwitcher.declineInvitationTo",{name:i}),children:t.jsx(yt,{size:14})})]})]})}function ss(n){const e=z.c(32),{orgParam:s,onSelectOrg:o,onCreateOrg:a}=n,i=B(),{data:c}=Ht(),{invitations:r,refetch:l}=Bt();let u;e[0]!==s?(u=(I,A)=>I.slug===s?-1:A.slug===s?1:I.name.localeCompare(A.name),e[0]=s,e[1]=u):u=e[1];const m=[...c??[]].sort(u),[f,d]=V.useState(""),h=f.toLowerCase(),C=h?m.filter(I=>I.name.toLowerCase().includes(h)||I.slug.toLowerCase().includes(h)):m;let p;e[2]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(Ct,{size:16,className:"shrink-0 text-muted-foreground/60"}),e[2]=p):p=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=I=>d(I.target.value),e[3]=g):g=e[3];let j;e[4]!==f?(j=I=>I.key==="Escape"&&f&&d(""),e[4]=f,e[5]=j):j=e[5];let v;e[6]!==i?(v=i("header.orgSwitcher.searchOrganizations"),e[6]=i,e[7]=v):v=e[7];let b;e[8]!==f||e[9]!==j||e[10]!==v?(b=t.jsx("input",{"data-org-switcher-search":!0,autoFocus:!0,type:"text",value:f,onChange:g,onKeyDown:j,placeholder:v,className:"flex-1 min-w-0 bg-transparent text-sm outline-none placeholder:text-muted-foreground/60"}),e[8]=f,e[9]=j,e[10]=v,e[11]=b):b=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 S;e[13]!==a?(S=t.jsx("button",{type:"button",onClick:a,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]=a,e[14]=S):S=e[14];let D;e[15]!==b||e[16]!==S?(D=t.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[p,b,S]}),e[15]=b,e[16]=S,e[17]=D):D=e[17];const O="flex-1 min-h-0 overflow-y-auto p-1.5 flex flex-col gap-1";let x;e[18]!==r||e[19]!==f||e[20]!==l?(x=!f&&r.map(I=>t.jsx(ns,{invitation:I,onChanged:l},I.id)),e[18]=r,e[19]=f,e[20]=l,e[21]=x):x=e[21];const k=C.length===0&&t.jsx("p",{className:"px-3 py-4 text-sm text-muted-foreground/60 text-center",children:f?i("header.orgSwitcher.noOrganizationsMatch",{query:f}):i("header.orgSwitcher.noOrganizationsAvailable")});let T;e[22]!==o||e[23]!==s?(T=I=>t.jsxs("button",{type:"button",onClick:()=>o(I.slug),className:K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",I.slug===s?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[t.jsx(lt,{org:I,size:"sm"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:I.name}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:I.slug})]}),I.slug===s&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"})]},I.id),e[22]=o,e[23]=s,e[24]=T):T=e[24];const N=C.map(T);let y;e[25]!==x||e[26]!==k||e[27]!==N?(y=t.jsxs("div",{className:O,children:[x,k,N]}),e[25]=x,e[26]=k,e[27]=N,e[28]=y):y=e[28];let P;return e[29]!==y||e[30]!==D?(P=t.jsxs(t.Fragment,{children:[D,y]}),e[29]=y,e[30]=D,e[31]=P):P=e[31],P}function os(n){const e=z.c(22),{trigger:s,orgParam:o,align:a,side:i}=n,c=a===void 0?"start":a,r=i===void 0?"bottom":i,l=nt(),[u,m]=V.useState(!1),[f,d]=V.useState(!1);let h;e[0]!==s?(h=t.jsx(Le,{asChild:!0,children:s}),e[0]=s,e[1]=h):h=e[1];const C=String(u);let p;e[2]!==l?(p=D=>{m(!1),l({to:"/$org",params:{org:D}})},e[2]=l,e[3]=p):p=e[3];let g;e[4]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{m(!1),d(!0)},e[4]=g):g=e[4];let j;e[5]!==o||e[6]!==C||e[7]!==p?(j=t.jsx(ss,{orgParam:o,onSelectOrg:p,onCreateOrg:g},C),e[5]=o,e[6]=C,e[7]=p,e[8]=j):j=e[8];let v;e[9]!==c||e[10]!==r||e[11]!==j?(v=t.jsx(vt,{side:r,align:c,sideOffset:8,collisionPadding:16,className:"w-[300px] p-0 flex flex-col max-h-[440px]",onOpenAutoFocus:as,onCloseAutoFocus:is,children:j}),e[9]=c,e[10]=r,e[11]=j,e[12]=v):v=e[12];let b;e[13]!==u||e[14]!==h||e[15]!==v?(b=t.jsxs(bt,{open:u,onOpenChange:m,children:[h,v]}),e[13]=u,e[14]=h,e[15]=v,e[16]=b):b=e[16];let w;e[17]!==f?(w=t.jsx(mn,{open:f,onOpenChange:d}),e[17]=f,e[18]=w):w=e[18];let S;return e[19]!==w||e[20]!==b?(S=t.jsxs(t.Fragment,{children:[b,w]}),e[19]=w,e[20]=b,e[21]=S):S=e[21],S}function is(n){return n.preventDefault()}function as(n){n.preventDefault(),n.currentTarget?.querySelector("[data-org-switcher-search]")?.focus()}function ls(n){const e=z.c(21),{value:s,onChange:o,placeholder:a,onKeyDown:i,className:c,isSearching:r,disabled:l}=n,u=a===void 0?"Search...":a;let m;e[0]!==c?(m=K("shrink-0 w-full border-b border-border h-12",c),e[0]=c,e[1]=m):m=e[1];const f=l?"cursor-not-allowed opacity-50":"cursor-text";let d;e[2]!==f?(d=K("flex items-center gap-2.5 h-12 px-4",f),e[2]=f,e[3]=d):d=e[3];let h;e[4]!==r?(h=r?t.jsx(De,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):t.jsx(Ct,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=r,e[5]=h):h=e[5];let C;e[6]!==o?(C=v=>o(v.target.value),e[6]=o,e[7]=C):C=e[7];let p;e[8]!==l||e[9]!==i||e[10]!==u||e[11]!==C||e[12]!==s?(p=t.jsx("input",{type:"text",value:s,onChange:C,onKeyDown:i,placeholder:u,disabled:l,className:"flex-1 min-w-0 bg-transparent text-sm text-foreground placeholder:text-muted-foreground/50 outline-none"}),e[8]=l,e[9]=i,e[10]=u,e[11]=C,e[12]=s,e[13]=p):p=e[13];let g;e[14]!==d||e[15]!==h||e[16]!==p?(g=t.jsxs("label",{className:d,children:[h,p]}),e[14]=d,e[15]=h,e[16]=p,e[17]=g):g=e[17];let j;return e[18]!==m||e[19]!==g?(j=t.jsx("div",{className:m,children:g}),e[18]=m,e[19]=g,e[20]=j):j=e[20],j}function cs(n,e,s){if(!s)return null;const o=bn(n,e);return o?o.threads.get().find(i=>i.id===s)?.branch??null:null}function rs(n){const e=z.c(6),{value:s,onChange:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.searchAgents"),e[0]=a,e[1]=i):i=e[1];let c;return e[2]!==o||e[3]!==i||e[4]!==s?(c=t.jsx(ls,{value:s,onChange:o,placeholder:i}),e[2]=o,e[3]=i,e[4]=s,e[5]=c):c=e[5],c}function ds(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.noAgentsFound"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:s}),n[2]=s,n[3]=o):o=n[3],o}function us(n){const e=z.c(10),{org:s,onClose:o}=n,a=B();let i;e[0]!==s.slug?(i={org:s.slug},e[0]=s.slug,e[1]=i):i=e[1];let c;e[2]!==o?(c=()=>o(),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==a?(r=a("sidebar.agentsSection.seeAllAgents"),e[4]=a,e[5]=r):r=e[5];let l;return e[6]!==i||e[7]!==c||e[8]!==r?(l=t.jsx("div",{className:"border-t border-border px-3 py-2.5",children:t.jsx(Kt,{to:"/$org/settings/agents",params:i,onClick:c,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center justify-center",children:r})}),e[6]=i,e[7]=c,e[8]=r,e[9]=l):l=e[9],l}function ms(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.agents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(Lt,{children:s}),n[2]=s,n[3]=o):o=n[3],o}function fs(n){const e=z.c(11),{onImportFromGithub:s}=n,o=B();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=t.jsx(vn,{className:"size-3.5"}),e[0]=a):a=e[0];let i;e[1]!==o?(i=o("sidebar.agentsSection.import"),e[1]=o,e[2]=i):i=e[2];let c;e[3]!==s||e[4]!==i?(c=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:[a,i]}),e[3]=s,e[4]=i,e[5]=c):c=e[5];let r;e[6]!==o?(r=o("sidebar.agentsSection.codeAgents"),e[6]=o,e[7]=r):r=e[7];let l;return e[8]!==c||e[9]!==r?(l=t.jsx(Lt,{action:c,children:r}),e[8]=c,e[9]=r,e[10]=l):l=e[10],l}function gs(n){const e=z.c(11),{setOpen:s,emptyCtaClass:o}=n,a=B();let i;e[0]!==a?(i=a("sidebar.agentsSection.browseAgents"),e[0]=a,e[1]=i):i=e[1];let c;e[2]!==o?(c=K(o),e[2]=o,e[3]=c):c=e[3];let r;e[4]!==s?(r=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{className:"size-4"}),e[6]=l):l=e[6];let u;return e[7]!==i||e[8]!==c||e[9]!==r?(u=t.jsx(Nt,{"aria-label":i,className:c,onClick:r,children:l}),e[7]=i,e[8]=c,e[9]=r,e[10]=u):u=e[10],u}function hs(n){const e=z.c(17),{setOpen:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]!==s?(l=()=>{E("agent_browser_opened",{surface:"mobile_drawer"}),s(!0)},e[5]=s,e[6]=l):l=e[6];let u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx(we,{}),e[7]=u):u=e[7];let m;e[8]!==i?(m=i("sidebar.agentsSection.newAgent"),e[8]=i,e[9]=m):m=e[9];let f;e[10]!==m?(f=t.jsx("span",{children:m}),e[10]=m,e[11]=f):f=e[11];let d;return e[12]!==c||e[13]!==r||e[14]!==l||e[15]!==f?(d=t.jsx(xt,{children:t.jsxs(jt,{tooltip:c,className:r,onClick:l,children:[u,f]})}),e[12]=c,e[13]=r,e[14]=l,e[15]=f,e[16]=d):d=e[16],d}function ps(){const n=z.c(4),e=B();let s;n[0]!==e?(s=e("sidebar.agentsSection.browseAgents"),n[0]=e,n[1]=s):s=n[1];let o;return n[2]!==s?(o=t.jsx(St,{className:"sr-only",children:s}),n[2]=s,n[3]=o):o=n[3],o}function xs(n){const e=z.c(8),{emptyCtaClass:s}=n,o=B();let a;e[0]!==o?(a=o("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=a):a=e[1];let i;e[2]!==s?(i=K(s),e[2]=s,e[3]=i):i=e[3];let c;e[4]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(we,{className:"size-4"}),e[4]=c):c=e[4];let r;return e[5]!==a||e[6]!==i?(r=t.jsx(Nt,{"aria-label":a,className:i,children:c}),e[5]=a,e[6]=i,e[7]=r):r=e[7],r}function js(n){const e=z.c(19),{wrapEmptyHint:s,highlightEmpty:o,emptyCtaClass:a}=n,i=B();let c;e[0]!==o||e[1]!==i?(c=o?void 0:i("sidebar.agentsSection.browseAgents"),e[0]=o,e[1]=i,e[2]=c):c=e[2];let r;e[3]!==a?(r=K(a),e[3]=a,e[4]=r):r=e[4];let l;e[5]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx(we,{}),e[5]=l):l=e[5];let u;e[6]!==i?(u=i("sidebar.agentsSection.newAgent"),e[6]=i,e[7]=u):u=e[7];let m;e[8]!==u?(m=t.jsx("span",{children:u}),e[8]=u,e[9]=m):m=e[9];let f;e[10]!==c||e[11]!==r||e[12]!==m?(f=t.jsx(Le,{asChild:!0,children:t.jsxs(jt,{tooltip:c,className:r,children:[l,m]})}),e[10]=c,e[11]=r,e[12]=m,e[13]=f):f=e[13];let d;e[14]!==f||e[15]!==s?(d=s(f),e[14]=f,e[15]=s,e[16]=d):d=e[16];let h;return e[17]!==d?(h=t.jsx(xt,{children:d}),e[17]=d,e[18]=h):h=e[18],h}function vs(n){const e=z.c(9),{children:s}=n,o=B();let a;e[0]!==s?(a=t.jsx(Ce,{asChild:!0,children:s}),e[0]=s,e[1]=a):a=e[1];let i;e[2]!==o?(i=o("sidebar.agentsSection.selectAnExistingAgent"),e[2]=o,e[3]=i):i=e[3];let c;e[4]!==i?(c=t.jsx(ye,{side:"right",sideOffset:8,children:i}),e[4]=i,e[5]=c):c=e[5];let r;return e[6]!==a||e[7]!==c?(r=t.jsxs(Ne,{defaultOpen:!0,delayDuration:0,children:[a,c]}),e[6]=a,e[7]=c,e[8]=r):r=e[8],r}function bs(n){const e=nt(),{create:s}=Cn(),{locator:o}=oe(),a=st({strict:!1}),i=ot({strict:!1});return async c=>{const r=crypto.randomUUID(),l=c===i.virtualmcpid?cs(n,o,a.taskId??""):null;try{await s({id:r,virtual_mcp_id:c,...l?{branch:l}:{}})}catch{}e({to:"/$org/$taskId",params:{org:n,taskId:r},search:{virtualmcpid:c}})}}function tt(n){const e=z.c(20),{agent:s,selected:o,onClick:a}=n,i=o?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50";let c;e[0]!==i?(c=K("flex items-center gap-3 px-3 py-2.5 rounded-md text-sm text-left w-full transition-colors",i),e[0]=i,e[1]=c):c=e[1];let r;e[2]!==s.icon||e[3]!==s.title?(r=t.jsx(gt,{icon:s.icon,name:s.title,size:"xs",className:"shrink-0"}),e[2]=s.icon,e[3]=s.title,e[4]=r):r=e[4];let l;e[5]!==s.title?(l=t.jsx("p",{className:"text-sm font-medium truncate",children:s.title}),e[5]=s.title,e[6]=l):l=e[6];let u;e[7]!==s.description?(u=s.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[7]=s.description,e[8]=u):u=e[8];let m;e[9]!==l||e[10]!==u?(m=t.jsxs("div",{className:"flex-1 min-w-0",children:[l,u]}),e[9]=l,e[10]=u,e[11]=m):m=e[11];let f;e[12]!==o?(f=o&&t.jsx(Ee,{size:14,className:"ml-auto text-muted-foreground shrink-0"}),e[12]=o,e[13]=f):f=e[13];let d;return e[14]!==a||e[15]!==c||e[16]!==r||e[17]!==m||e[18]!==f?(d=t.jsxs("button",{type:"button",onClick:a,className:c,children:[r,m,f]}),e[14]=a,e[15]=c,e[16]=r,e[17]=m,e[18]=f,e[19]=d):d=e[19],d}function Lt(n){const e=z.c(5),{children:s,action:o}=n;let a;e[0]!==s?(a=t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s}),e[0]=s,e[1]=a):a=e[1];let i;return e[2]!==o||e[3]!==a?(i=t.jsxs("div",{className:"flex items-center justify-between px-3 pb-1 pt-2",children:[a,o]}),e[2]=o,e[3]=a,e[4]=i):i=e[4],i}function Cs(n){const e=z.c(23),{onClose:s,onSelectAgent:o,selectedAgentId:a,onImportFromGithub:i}=n,[c,r]=V.useState(""),l=dn(),u=l??[],{org:m}=oe(),{data:f}=re.useSession(),d=f?.user?.id??"anon",h=Nn(l),C=wn(),p=bs(m.slug),g=Sn(l),j=c.toLowerCase(),v=u.filter(_s).filter(F=>!g.has(F.id)).filter(ws).filter(F=>!c||F.title.toLowerCase().includes(j)),b=v.filter(Ns),w=v.filter(ys),S=at(m.id),D=!c||S.title.toLowerCase().includes(j),O=!!(o&&D);let x;e[0]!==s||e[1]!==o?(x=()=>{o?.(null),s(),r("")},e[0]=s,e[1]=o,e[2]=x):x=e[2];const k=x,T=F=>{if(o){o(F.id),s(),r("");return}_n({orgId:m.id,userId:d},F.id,h),C(),s(),r(""),p(F.id)},N="flex flex-col max-h-[min(640px,80dvh)]";let y;e[3]!==c?(y=t.jsx(rs,{value:c,onChange:r}),e[3]=c,e[4]=y):y=e[4];const P="overflow-y-auto flex-1 min-h-0 p-1.5 flex flex-col gap-0.5",I=o&&D&&S&&t.jsx(tt,{agent:S,selected:!a||a===S.id,onClick:k}),A=(b.length>0||!c)&&t.jsx(fs,{onImportFromGithub:i}),M=b.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id)),R=w.length>0&&t.jsx(ms,{}),X=w.map(F=>t.jsx(tt,{agent:F,selected:o?a===F.id:void 0,onClick:()=>T(F)},F.id));let L;e[5]!==O||e[6]!==c||e[7]!==v.length?(L=v.length===0&&!O&&c&&t.jsx(ds,{}),e[5]=O,e[6]=c,e[7]=v.length,e[8]=L):L=e[8];let ne;e[9]!==L||e[10]!==I||e[11]!==A||e[12]!==M||e[13]!==R||e[14]!==X?(ne=t.jsxs("div",{className:P,children:[I,A,M,R,X,L]}),e[9]=L,e[10]=I,e[11]=A,e[12]=M,e[13]=R,e[14]=X,e[15]=ne):ne=e[15];let q;e[16]!==s||e[17]!==m?(q=t.jsx(us,{org:m,onClose:s}),e[16]=s,e[17]=m,e[18]=q):q=e[18];let de;return e[19]!==ne||e[20]!==q||e[21]!==y?(de=t.jsxs("div",{className:N,children:[y,ne,q]}),e[19]=ne,e[20]=q,e[21]=y,e[22]=de):de=e[22],de}function ys(n){return!It(n.metadata)}function Ns(n){return It(n.metadata)}function ws(n){return!ln(n.id)}function _s(n){return!an(n.id)}function Ss(n){const e=z.c(31);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{compact:o,trigger:a,onSelectAgent:i,selectedAgentId:c,side:r,align:l}=s,u=o===void 0?!1:o,m=r===void 0?"right":r,f=l===void 0?"start":l,[d,h]=V.useState(!1),[C,p]=V.useState(!1),g=kt(),{setOpenMobile:j}=pt(),v=yn(),b=v?"border border-border":void 0;let w;e[2]!==v?(w=A=>v?t.jsx(vs,{children:A}):A,e[2]=v,e[3]=w):w=e[3];const S=w;let D;e[4]!==g||e[5]!==j?(D=()=>{h(!1),g&&j(!1)},e[4]=g,e[5]=j,e[6]=D):D=e[6];const O=D;let x;e[7]!==O?(x=()=>{O(),p(!0)},e[7]=O,e[8]=x):x=e[8];const k=x;let T;e[9]!==O||e[10]!==k||e[11]!==i||e[12]!==d||e[13]!==c?(T=d&&t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center py-8",children:t.jsx(fn,{className:"h-4 w-24"})}),children:t.jsx(Cs,{onClose:O,onSelectAgent:i,selectedAgentId:c,onImportFromGithub:k})}),e[9]=O,e[10]=k,e[11]=i,e[12]=d,e[13]=c,e[14]=T):T=e[14];const N=T;let y;e[15]!==f||e[16]!==u||e[17]!==b||e[18]!==v||e[19]!==g||e[20]!==d||e[21]!==N||e[22]!==m||e[23]!==a||e[24]!==S?(y=g?t.jsxs(t.Fragment,{children:[a?t.jsx("button",{type:"button",onClick:()=>h(!0),className:"contents",children:a}):u?S(t.jsx(gs,{setOpen:h,emptyCtaClass:b})):t.jsx(hs,{setOpen:h,highlightEmpty:v,emptyCtaClass:b}),t.jsx(wt,{open:d,onOpenChange:h,direction:"bottom",children:t.jsxs(_t,{className:"max-h-[85dvh] p-0",children:[t.jsx(ps,{}),N]})})]}):t.jsxs(bt,{open:d,onOpenChange:A=>{A&&!d&&E("agent_browser_opened",{surface:"desktop_popover"}),h(A)},children:[a?t.jsx(Le,{asChild:!0,children:a}):u?S(t.jsx(Le,{asChild:!0,children:t.jsx(xs,{emptyCtaClass:b})})):t.jsx(js,{wrapEmptyHint:S,highlightEmpty:v,emptyCtaClass:b}),t.jsx(vt,{className:"w-[380px] p-0 overflow-hidden",side:m,align:f,children:N})]}),e[15]=f,e[16]=u,e[17]=b,e[18]=v,e[19]=g,e[20]=d,e[21]=N,e[22]=m,e[23]=a,e[24]=S,e[25]=y):y=e[25];let P;e[26]!==C?(P=t.jsx(jn,{open:C,onOpenChange:p,mode:"agent"}),e[26]=C,e[27]=P):P=e[27];let I;return e[28]!==P||e[29]!==y?(I=t.jsxs(t.Fragment,{children:[y,P]}),e[28]=P,e[29]=y,e[30]=I):I=e[30],I}const ks="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 Ds(n){const e=z.c(29),{agentId:s,fallback:o,onOpenHome:a,onPick:i}=n,c=B(),r=un(s)??o??null;let l,u,m,f,d;e[0]!==r?.title||e[1]!==a||e[2]!==c?(d=r?.title??c("header.shellBreadcrumb.superAgentDefaultName"),f="flex min-w-0 items-center gap-0",l="button",u=a,m=c("header.shellBreadcrumb.openAgentHome",{name:d}),e[0]=r?.title,e[1]=a,e[2]=c,e[3]=l,e[4]=u,e[5]=m,e[6]=f,e[7]=d):(l=e[3],u=e[4],m=e[5],f=e[6],d=e[7]);const h=r?.icon??null;let C;e[8]!==h||e[9]!==d?(C=t.jsx(gt,{icon:h,name:d,size:"xs"}),e[8]=h,e[9]=d,e[10]=C):C=e[10];let p;e[11]!==l||e[12]!==u||e[13]!==m||e[14]!==C?(p=t.jsx("button",{type:l,onClick:u,"aria-label":m,className:"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:C}),e[11]=l,e[12]=u,e[13]=m,e[14]=C,e[15]=p):p=e[15];let g;e[16]!==d?(g=t.jsx("span",{className:"truncate font-medium max-w-[8rem]",children:d}),e[16]=d,e[17]=g):g=e[17];let j;e[18]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[18]=j):j=e[18];let v;e[19]!==g?(v=t.jsxs("button",{type:"button",className:ks,children:[g,j]}),e[19]=g,e[20]=v):v=e[20];let b;e[21]!==s||e[22]!==i||e[23]!==v?(b=t.jsx(Ss,{side:"bottom",align:"start",selectedAgentId:s,onSelectAgent:i,trigger:v}),e[21]=s,e[22]=i,e[23]=v,e[24]=b):b=e[24];let w;return e[25]!==b||e[26]!==f||e[27]!==p?(w=t.jsxs("div",{className:f,children:[p,b]}),e[25]=b,e[26]=f,e[27]=p,e[28]=w):w=e[28],w}function Oo(n){const e=z.c(30);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{showName:o}=s,a=B(),{org:i}=oe(),{state:c,isMobile:r}=pt(),l=Bt().invitations.length>0,u=c==="collapsed"||r;let m;e[2]!==l||e[3]!==i.name||e[4]!==a?(m=l?a("header.shellBreadcrumb.switchOrganizationPendingInvitation",{name:i.name}):a("header.shellBreadcrumb.switchOrganization",{name:i.name}),e[2]=l,e[3]=i.name,e[4]=a,e[5]=m):m=e[5];let f;e[6]!==i?(f=t.jsx(lt,{org:i,size:"sm"}),e[6]=i,e[7]=f):f=e[7];let d;e[8]!==l||e[9]!==u?(d=l&&t.jsx("span",{className:K("absolute -right-1 size-2.5 rounded-full bg-destructive ring-2 ring-background",u?"-top-1":"top-1/2 -translate-y-1/2")}),e[8]=l,e[9]=u,e[10]=d):d=e[10];let h;e[11]!==f||e[12]!==d?(h=t.jsxs("span",{className:"relative inline-flex",children:[f,d]}),e[11]=f,e[12]=d,e[13]=h):h=e[13];let C;e[14]!==i.name||e[15]!==o?(C=o&&t.jsx("span",{className:"truncate text-sm font-medium text-foreground max-w-[10rem]",children:i.name}),e[14]=i.name,e[15]=o,e[16]=C):C=e[16];let p;e[17]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx(ht,{size:14,className:"shrink-0 text-muted-foreground opacity-70"}),e[17]=p):p=e[17];let g;e[18]!==m||e[19]!==h||e[20]!==C?(g=t.jsx(Ce,{asChild:!0,children:t.jsxs("button",{type:"button","aria-label":m,className:"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:[h,C,p]})}),e[18]=m,e[19]=h,e[20]=C,e[21]=g):g=e[21];let j;e[22]!==i.slug||e[23]!==g?(j=t.jsx(os,{orgParam:i.slug,trigger:g}),e[22]=i.slug,e[23]=g,e[24]=j):j=e[24];let v;e[25]!==i.name?(v=t.jsx(ye,{side:"bottom",children:i.name}),e[25]=i.name,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==j?(b=t.jsxs(Ne,{children:[j,v]}),e[27]=v,e[28]=j,e[29]=b):b=e[29],b}function Mo(n){const e=z.c(22);let s;e[0]!==n?(s=n===void 0?{}:n,e[0]=n,e[1]=s):s=e[1];const{onNavigate:o}=s,{org:a}=oe();let i;e[2]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[2]=i):i=e[2];const c=st(i);let r;e[3]===Symbol.for("react.memo_cache_sentinel")?(r={strict:!1},e[3]=r):r=e[3];const l=ot(r),{threads:u}=Dt(),{data:m}=re.useSession(),{setTaskId:f,createNewTask:d}=At();let h;e[4]!==a.id?(h=at(a.id),e[4]=a.id,e[5]=h):h=e[5];const C=h,p=C.id,g=c.taskId?l.virtualmcpid??p:p;let j;e[6]!==d||e[7]!==p||e[8]!==o||e[9]!==m?.user?.id||e[10]!==f||e[11]!==u?(j=O=>{const x=O??p,k=kn(u,x,m?.user?.id);k?f(k.id,x):d(x),o?.()},e[6]=d,e[7]=p,e[8]=o,e[9]=m?.user?.id,e[10]=f,e[11]=u,e[12]=j):j=e[12];const v=j;let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"h-5 w-24 rounded bg-muted animate-pulse"}),e[13]=b):b=e[13];const w=g===p?C:void 0;let S;e[14]!==g||e[15]!==v?(S=()=>v(g),e[14]=g,e[15]=v,e[16]=S):S=e[16];let D;return e[17]!==g||e[18]!==v||e[19]!==w||e[20]!==S?(D=t.jsx(V.Suspense,{fallback:b,children:t.jsx(Ds,{agentId:g,fallback:w,onOpenHome:S,onPick:v})}),e[17]=g,e[18]=v,e[19]=w,e[20]=S,e[21]=D):D=e[21],D}function $o(){const n=z.c(24),e=B(),{org:s}=oe();let o;n[0]===Symbol.for("react.memo_cache_sentinel")?(o={strict:!1},n[0]=o):o=n[0];const a=st(o);let i;n[1]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},n[1]=i):i=n[1];const c=ot(i),{threads:r}=Dt(),{createNewTask:l}=At();let u;n[2]!==s.id?(u=at(s.id),n[2]=s.id,n[3]=u):u=n[3];const m=u.id,f=a.taskId?c.virtualmcpid??m:m;let d;n[4]!==a.taskId||n[5]!==r?(d=(a.taskId?r.find(D=>D.id===a.taskId)?.branch:null)??null,n[4]=a.taskId,n[5]=r,n[6]=d):d=n[6];const h=d;let C;n[7]!==f||n[8]!==l||n[9]!==h?(C=()=>{l(f,h)},n[7]=f,n[8]=l,n[9]=h,n[10]=C):C=n[10];const p=C;let g;n[11]!==e?(g=e("sidebar.taskGroupsList.newChat"),n[11]=e,n[12]=g):g=n[12];let j;n[13]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx(sn,{size:16}),n[13]=j):j=n[13];let v;n[14]!==p||n[15]!==g?(v=t.jsx(Ce,{asChild:!0,children:t.jsx("button",{type:"button",onClick:p,"aria-label":g,className:"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[14]=p,n[15]=g,n[16]=v):v=n[16];let b;n[17]!==e?(b=e("sidebar.taskGroupsList.newChat"),n[17]=e,n[18]=b):b=n[18];let w;n[19]!==b?(w=t.jsx(ye,{side:"bottom",children:b}),n[19]=b,n[20]=w):w=n[20];let S;return n[21]!==v||n[22]!==w?(S=t.jsxs(Ne,{children:[v,w]}),n[21]=v,n[22]=w,n[23]=S):S=n[23],S}function Is({open:n,onOpenChange:e,onCreated:s}){const o=B(),{org:a}=oe(),{data:i}=re.useSession(),{stdioEnabled:c}=qt(),r=kt(),l=Ft(),u=Pt(),f=Tt(u,"").items,d=Gt({resolver:Xt(Vn),defaultValues:{title:"",description:null,icon:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),h=d.watch("ui_type"),C=d.watch("connection_url"),p=d.watch("npx_package"),g=$e({uiType:h,connectionUrl:C??"",npxPackage:p??""})??ut({uiType:h,connectionUrl:C??"",registryItems:f}),j=x=>{const k=x.trim();if(!k)return;const T=!!d.formState.dirtyFields.title,N=!!d.formState.dirtyFields.description,y=!!d.formState.dirtyFields.env_vars,P=A=>{if(A&&(!T&&!d.getValues("title").trim()&&A.title&&d.setValue("title",A.title,{shouldDirty:!1}),!N&&!(d.getValues("description")??"").trim()&&A.description&&d.setValue("description",A.description,{shouldDirty:!1}),!y&&A.envVarKeys?.length)){const M=d.getValues("env_vars")??[],R=new Set(M.map(L=>L.key)),X=A.envVarKeys.filter(L=>!R.has(L));X.length>0&&d.setValue("env_vars",[...M,...X.map(L=>({key:L,value:""}))],{shouldDirty:!0})}},I=Hn(k);if(I&&c){d.setValue("ui_type","NPX",{shouldDirty:!0}),d.setValue("npx_package",I.packageName,{shouldDirty:!0}),d.setValue("connection_url","",{shouldDirty:!0}),d.setValue("connection_token",null,{shouldDirty:!0}),P($e({uiType:"NPX",npxPackage:I.packageName}));return}if(k.startsWith("http://")||k.startsWith("https://")){const A=h==="HTTP"||h==="SSE"||h==="Websocket"?h:"HTTP";d.setValue("ui_type",A,{shouldDirty:!0}),d.setValue("connection_url",k,{shouldDirty:!0}),P($e({uiType:A,connectionUrl:k})??ut({uiType:A,connectionUrl:k,registryItems:f}));return}h==="NPX"&&P($e({uiType:"NPX",npxPackage:k}))},v=x=>{x||d.reset(),e(x)},b=async x=>{let k,T=null,N=null,y=null;x.ui_type==="NPX"?(k="STDIO",T="",y=Un(x.npx_package||"",x.env_vars||[])):x.ui_type==="STDIO"?(k="STDIO",T="",y=Kn(x.stdio_command||"",x.stdio_args||"",x.stdio_cwd,x.env_vars||[])):(k=x.ui_type,T=x.connection_url||"",N=x.connection_token||null);const P=In("conn");try{await l.create.mutateAsync({id:P,title:x.title,description:x.description||null,connection_type:k,connection_url:T,connection_token:N,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:i?.user?.id||"system",organization_id:a.id,icon:x.icon??null,app_name:null,app_id:null,connection_headers:y,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),d.reset(),e(!1),s?.(P)}catch{H.error(o("connections.createConnectionDialog.failedToCreateConnection"))}},w=o("connections.createConnectionDialog.title"),S=o("connections.createConnectionDialog.description"),D=d.formState.isSubmitting?o("connections.createConnectionDialog.saving"):o("connections.createConnectionDialog.createButton"),O=t.jsxs("div",{className:"grid gap-4",children:[t.jsx(W,{control:d.control,name:"ui_type",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.typeLabel")}),t.jsxs($n,{value:x.value,onValueChange:x.onChange,children:[t.jsx(Z,{children:t.jsx(Fn,{children:t.jsx(Bn,{})})}),t.jsxs(Ln,{children:[t.jsx(ke,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.httpType")]})}),t.jsx(ke,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.sseType")]})}),t.jsx(ke,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Ze,{className:"w-4 h-4"}),o("connections.createConnectionDialog.websocketType")]})}),c&&t.jsxs(t.Fragment,{children:[t.jsx(ke,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Be,{className:"w-4 h-4"}),o("connections.createConnectionDialog.npxPackageType")]})}),t.jsx(ke,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(on,{className:"w-4 h-4"}),o("connections.createConnectionDialog.customCommandType")]})})]})]})]}),t.jsx(ee,{})]})}),h==="NPX"&&t.jsx(W,{control:d.control,name:"npx_package",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.npmPackageLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.npmPackagePlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("npx_package",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),h==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[t.jsx(W,{control:d.control,name:"stdio_command",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.commandLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.commandPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"stdio_args",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.argumentsLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.argumentsPlaceholder"),...x,value:x.value??""})}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"stdio_cwd",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.workingDirectoryLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.workingDirectoryPlaceholder"),...x,value:x.value??""})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("connections.createConnectionDialog.workingDirectoryDescription")}),t.jsx(ee,{})]})})]}),(h==="NPX"||h==="STDIO")&&t.jsx(W,{control:d.control,name:"env_vars",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.environmentVariablesLabel")}),t.jsx(Z,{children:t.jsx(Rn,{value:x.value??[],onChange:x.onChange})}),t.jsx(ee,{})]})}),h!=="NPX"&&h!=="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsx(W,{control:d.control,name:"connection_url",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.urlLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.urlPlaceholder"),...x,value:x.value??"",onPaste:k=>{const T=k.clipboardData.getData("text");T&&(k.preventDefault(),d.setValue("connection_url",T.trim(),{shouldDirty:!0}),j(T))},onBlur:k=>{j(k.target.value),x.onBlur()}})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"connection_token",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:g?.token?.label??o("connections.createConnectionDialog.tokenLabelDefault")}),t.jsx(Z,{children:t.jsx(ce,{type:"password",placeholder:g?.token?.placeholder??o("connections.createConnectionDialog.tokenPlaceholderDefault"),className:"ph-no-capture",...x,value:x.value??""})}),g?.token?.helperText&&t.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.token.helperText,g.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:o("connections.createConnectionDialog.openGitHubPatSettings")})]})]}),t.jsx(ee,{})]})})]}),t.jsx(W,{control:d.control,name:"title",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.nameLabel")}),t.jsx(Z,{children:t.jsx(ce,{placeholder:o("connections.createConnectionDialog.namePlaceholder"),...x})}),t.jsx(ee,{})]})}),t.jsx(W,{control:d.control,name:"description",render:({field:x})=>t.jsxs(Y,{children:[t.jsx(J,{children:o("connections.createConnectionDialog.descriptionLabel")}),t.jsx(Z,{children:t.jsx(En,{placeholder:o("connections.createConnectionDialog.descriptionPlaceholder"),rows:3,...x,value:x.value??""})}),t.jsx(ee,{})]})})]});return r?t.jsx(wt,{open:n,onOpenChange:v,children:t.jsxs(_t,{className:"max-h-[90vh]",children:[t.jsx(gn,{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(St,{children:w}),t.jsx(hn,{className:"mt-1",children:S})]}),t.jsx(pn,{asChild:!0,children:t.jsx(te,{variant:"ghost",size:"icon",className:"shrink-0 -mt-1",children:t.jsx(yt,{size:16})})})]})}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"overflow-y-auto px-4 pb-4",children:O}),t.jsx(xn,{children:t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"w-full",children:D})})]})})]})}):t.jsx(zt,{open:n,onOpenChange:v,children:t.jsxs(Ot,{className:"sm:max-w-[525px]",children:[t.jsxs(Mt,{children:[t.jsx($t,{children:w}),t.jsx(On,{children:S})]}),t.jsx(dt,{...d,children:t.jsxs("form",{onSubmit:d.handleSubmit(b),children:[t.jsx("div",{className:"py-4",children:O}),t.jsxs(Mn,{children:[t.jsx(te,{type:"button",variant:"outline",onClick:()=>v(!1),children:o("connections.createConnectionDialog.cancelButton")}),t.jsx(te,{type:"submit",disabled:d.formState.isSubmitting,className:"min-w-40",children:D})]})]})})]})})}function As(n){const e=z.c(72),{mode:s,agentId:o,addedConnectionIds:a,onAdd:i,onCloneAndAdd:c,onConnectAndAdd:r,connectingItemId:l,search:u,onCreateConnection:m,onBrowseNavigate:f,defaultTab:d}=n,h=s===void 0?"add":s,C=d===void 0?"connected":d,p=B(),{org:g}=oe(),j=V.useDeferredValue(u),v=u!==j;let b;e[0]!==j?(b=j.trim().toLowerCase(),e[0]=j,e[1]=b):b=e[1];const w=b;let S;e[2]!==C?(S=_=>_??C,e[2]=C,e[3]=S):S=e[3];const[D,O]=Qt(Wt.connectionsTab(g.slug)+(C==="all"?":home-modal":":agent-modal"),S);let x;e[4]!==D||e[5]!==O?(x=_=>{_!==D&&E("connections_dialog_tab_changed",{to_tab:_}),O(_)},e[4]=D,e[5]=O,e[6]=x):x=e[6];const k=x;let T;e[7]!==g.id||e[8]!==g.slug?(T={connectionId:cn,orgId:g.id,orgSlug:g.slug},e[7]=g.id,e[8]=g.slug,e[9]=T):T=e[9];const N=rn(T),y=j?.trim().split(/\s+/).filter(Boolean)??[],P=y.length>0?{operator:"or",conditions:y.flatMap(Bs)}:void 0,I={...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:0},A=JSON.stringify(I),{data:M,fetchNextPage:R,hasNextPage:X,isFetchingNextPage:L}=Xn({queryKey:it.collectionListInfinite(N,g.id,"","CONNECTIONS",A),queryFn:async _=>{const{pageParam:$}=_,se=$===void 0?0:$;return(await N.callTool({name:"COLLECTION_CONNECTIONS_LIST",arguments:{...P&&{where:P},orderBy:[{field:["updated_at"],direction:"asc"}],limit:100,offset:se}})).structuredContent},initialPageParam:0,getNextPageParam:$s,staleTime:3e4}),ne=M?.pages.flatMap(Ms)??[],q=zn(ne),de=new Set(ne.filter(Os).map(zs)),F=Pt(),ie=Tt(F,j),Re=mt(ie.loadMore,ie.hasMore,ie.isLoadingMore),He=mt(R,X??!1,L),G=D==="all"||!!w,ct=G?ie.items.filter(_=>{const $=An(_);if($&&de.has($))return!1;if(!w)return!0;const se=Ve(_._meta),ae=[_.title,_.description,_.name,_.server?.title,_.server?.description,_.server?.name,se?.friendly_name,se?.friendlyName].filter(Boolean).join(" ").toLowerCase();return y.some(Q=>ae.includes(Q.toLowerCase()))}):[],_e=ct.filter(Ts),Se=ct.filter(Ps);let Ie;e[10]!==a?(Ie=_=>_.some($=>a.has($.id)),e[10]=a,e[11]=Ie):Ie=e[11];const Ue=Ie;let Ae;e[12]!==a||e[13]!==o||e[14]!==l||e[15]!==Ue||e[16]!==h||e[17]!==i||e[18]!==f||e[19]!==c||e[20]!==p?(Ae=(_,$,se,ae,Q)=>{const Me=Ue(Q),be=Q.find(le=>!a.has(le.id)),U=Q[0];if(h==="browse"){const le=qn(U);return t.jsx(Ye,{connection:{title:$,icon:se,description:Q.length>1?`${Q.length} instances`:ae??void 0},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs(Fe,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[t.jsx(Ee,{size:11})," ",p("virtualMcp.connectionDialogContent.connected")]}),onClick:()=>{E("connection_browse_clicked",{app_name:U.app_name??null,connection_id:U.id,instances_count:Q.length}),f?.(le)}},_)}return t.jsx(Ye,{connection:{title:$,icon:se,description:ae},fallbackIcon:t.jsx(Be,{}),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})," ",p("virtualMcp.connectionDialogContent.added")]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),be?(E("connection_add_clicked",{action:"use_existing",app_name:U.app_name??null,connection_id:be.id}),o&&E("agent_connection_attached",{agent_id:o,connection_id:be.id,app_name:U.app_name??null,mode:"existing"}),i(be.id)):(E("connection_add_clicked",{action:"clone",app_name:U.app_name??null,base_connection_id:U.id}),c(U))},children:p("virtualMcp.connectionDialogContent.add")})]})},_)},e[12]=a,e[13]=o,e[14]=l,e[15]=Ue,e[16]=h,e[17]=i,e[18]=f,e[19]=c,e[20]=p,e[21]=Ae):Ae=e[21];const Pe=Ae;let Te;e[22]!==l||e[23]!==h||e[24]!==r||e[25]!==p?(Te=_=>{const $=Ve(_._meta),se=$?.friendlyName||$?.friendly_name||_.server?.title||_.title||_.server?.name||_.name||_.id||"",ae=_.server?.description||_.description||null,Q=_.server?.icons?.[0]?.src||Pn(_.server?.repository)||null,Me=$?.official===!0,be=$?.verified===!0,U=$?.owner==="deco";return t.jsx(Ye,{connection:{title:se,description:ae,icon:Q},fallbackIcon:t.jsx(Be,{}),headerActionsAlwaysVisible:!0,headerActions:t.jsxs("div",{className:"flex items-center gap-1.5",children:[U&&t.jsxs(Ne,{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:p("virtualMcp.connectionDialogContent.madeByDeco"),className:"size-3"})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByDeco")})]}),!U&&Me&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.builtByOfficial")})]}),!U&&!Me&&be&&t.jsxs(Ne,{children:[t.jsx(Ce,{asChild:!0,children:t.jsx(Fe,{variant:"outline",size:"icon",children:t.jsx(Je,{})})}),t.jsx(ye,{children:p("virtualMcp.connectionDialogContent.verifiedByDeco")})]}),t.jsx(te,{variant:"outline",size:"sm",className:"h-7 px-3 text-xs font-medium",disabled:l!==null,onClick:le=>{le.stopPropagation(),E("connection_add_clicked",{action:"connect_new",registry_item_id:_.id,app_name:$?.friendlyName||_.server?.name||_.name||null}),r(_)},children:l===_.id?t.jsx(De,{size:14,className:"animate-spin"}):p(h==="browse"?"virtualMcp.connectionDialogContent.connect":"virtualMcp.connectionDialogContent.add")})]})},`catalog-${_.id}`)},e[22]=l,e[23]=h,e[24]=r,e[25]=p,e[26]=Te):Te=e[26];const rt=Te;let ue;e[27]!==D||e[28]!==k||e[29]!==m||e[30]!==w||e[31]!==p?(ue=!w&&t.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border shrink-0",children:[t.jsx(Gn,{tabs:[{id:"all",label:p("virtualMcp.connectionDialogContent.tabAll")},{id:"connected",label:p("virtualMcp.connectionDialogContent.tabConnected")}],activeTab:D,onTabChange:_=>k(_)}),t.jsxs(te,{variant:"outline",size:"sm",className:"h-7 px-2 text-sm",onClick:()=>{E("connections_dialog_custom_clicked"),m()},children:[t.jsx(we,{size:12}),p("virtualMcp.connectionDialogContent.customConnection")]})]}),e[27]=D,e[28]=k,e[29]=m,e[30]=w,e[31]=p,e[32]=ue):ue=e[32];const Ke=v&&"opacity-50 pointer-events-none";let me;e[33]!==Ke?(me=K("flex-1 overflow-auto p-5 transition-opacity duration-150",Ke),e[33]=Ke,e[34]=me):me=e[34];const Et="grid grid-cols-[repeat(auto-fill,minmax(260px,1fr))] gap-4";let ze;e[35]!==Pe?(ze=_=>{if(_.type==="group")return Pe(_.key,_.title,_.icon,null,_.connections);const $=_.connection;return Pe($.id,$.title,$.icon,$.description??null,[$])},e[35]=Pe,e[36]=ze):ze=e[36];const qe=q.map(ze);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]!==L?(ge=L&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[39]=L,e[40]=ge):ge=e[40];const Ge=G&&_e.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:p("virtualMcp.connectionDialogContent.sectionVerified")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),Xe=G&&_e.map(rt),Qe=G&&Se.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:p("virtualMcp.connectionDialogContent.sectionAllConnections")}),t.jsx("div",{className:"flex-1 h-px bg-border"})]}),We=G&&Se.map(rt);let he;e[41]!==Re||e[42]!==F||e[43]!==G?(he=G&&F.length>0&&t.jsx("div",{ref:Re,className:"col-span-full h-1"}),e[41]=Re,e[42]=F,e[43]=G,e[44]=he):he=e[44];let pe;e[45]!==ie.isLoadingMore||e[46]!==G?(pe=G&&ie.isLoadingMore&&t.jsx("div",{className:"col-span-full flex justify-center py-6",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),e[45]=ie.isLoadingMore,e[46]=G,e[47]=pe):pe=e[47];let xe;e[48]!==qe||e[49]!==fe||e[50]!==ge||e[51]!==Ge||e[52]!==Xe||e[53]!==Qe||e[54]!==We||e[55]!==he||e[56]!==pe?(xe=t.jsxs("div",{className:Et,children:[qe,fe,ge,Ge,Xe,Qe,We,he,pe]}),e[48]=qe,e[49]=fe,e[50]=ge,e[51]=Ge,e[52]=Xe,e[53]=Qe,e[54]=We,e[55]=he,e[56]=pe,e[57]=xe):xe=e[57];let je;e[58]!==D||e[59]!==q.length||e[60]!==Se||e[61]!==u||e[62]!==p||e[63]!==_e?(je=q.length===0&&_e.length===0&&Se.length===0&&t.jsx("div",{className:"flex items-center justify-center h-48 text-sm text-muted-foreground",children:u?p("virtualMcp.connectionDialogContent.emptyStateSearchNoMatch",{search:u}):p(D==="connected"?"virtualMcp.connectionDialogContent.emptyStateNoConnectionsYet":"virtualMcp.connectionDialogContent.emptyStateNoConnectionsAvailable")}),e[58]=D,e[59]=q.length,e[60]=Se,e[61]=u,e[62]=p,e[63]=_e,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 Oe;return e[69]!==ue||e[70]!==ve?(Oe=t.jsxs(t.Fragment,{children:[ue,ve]}),e[69]=ue,e[70]=ve,e[71]=Oe):Oe=e[71],Oe}function Ps(n){return!n.verified&&!Ve(n._meta)?.verified&&!n.meta?.verified}function Ts(n){return n.verified||Ve(n._meta)?.verified||n.meta?.verified}function zs(n){return n.app_name}function Os(n){return n.app_name}function Ms(n){return n?.items??[]}function $s(n,e){if(n?.hasMore)return e.reduce(Fs,0)}function Fs(n,e){return n+(e?.items?.length??0)}function Bs(n){return[{field:["title"],operator:"contains",value:n},{field:["description"],operator:"contains",value:n}]}function Fo({open:n,onOpenChange:e,defaultTab:s,initialSearch:o="",...a}){const i=B(),c=a.mode??"add",r="agentId"in a?a.agentId:void 0,l="addedConnectionIds"in a?a.addedConnectionIds??new Set:new Set,u="onAdd"in a&&a.onAdd?a.onAdd:N=>{},m=(N,y,P)=>{r&&E("agent_connection_attached",{agent_id:r,connection_id:N,app_name:y,mode:P})},[f,d]=V.useState(null),[h,C]=V.useState(o),[p,g]=V.useState(!1),{org:j}=oe(),{data:v}=re.useSession(),b=Ft(),w=Yt(),S=nt(),D=N=>{e(!1),S({to:"/$org/settings/connections/$appSlug",params:{org:j.slug,appSlug:N}})},O=()=>{w.invalidateQueries({predicate:N=>{const y=N.queryKey;return y[1]===j.id&&y[3]==="collection"&&y[4]==="CONNECTIONS"}})},x=async(N,y)=>{E("connection_oauth_succeeded",{connection_id:N,flow:y});const P=new URL(`/api/${j.slug}/mcp/${N}`,window.location.origin);await w.invalidateQueries({queryKey:it.isMCPAuthenticated(P.href,null)}),O()},k=async N=>{d(N.app_name??N.id);try{const P=`${N.title.replace(/\s*\(\d+\)\s*$/,"")} (${Date.now().toString(36).slice(-4)})`,A=(await b.create.mutateAsync({title:P,description:N.description??null,connection_type:N.connection_type,connection_url:N.connection_url??null,connection_token:null,icon:N.icon??null,app_name:N.app_name??null,app_id:N.app_id??null,connection_headers:N.connection_headers??null})).id,M=await et({connectionId:A,orgId:j.id,orgSlug:j.slug,persistFallback:R=>b.update.mutateAsync({id:A,data:{connection_token:R}}).then(()=>{})});if(M.ran&&!M.ok){E("connection_oauth_failed",{connection_id:A,flow:"clone",error:M.error??"no_token"}),H.error(i("virtualMcp.addConnectionDialog.authenticationFailedError",{error:M.error??"no token received"})),await b.delete.mutateAsync(A);return}M.ran&&await x(A,"clone"),m(A,N.app_name??null,"clone"),u(A)}catch(y){console.error("Failed to add connection:",y),H.error(i("virtualMcp.addConnectionDialog.failedToAddConnection"))}finally{d(null)}},T=async N=>{if(!(!j||!v?.user?.id)){d(N.id);try{const y=Tn(N,j.id,v.user.id,{remoteIndex:0}),P=y.connection_type==="STDIO",I=!!y.connection_url,A=P&&y.connection_headers&&typeof y.connection_headers=="object"&&"command"in y.connection_headers;if(!I&&!A){H.error(i("virtualMcp.addConnectionDialog.mcpServerConnectionError")),d(null);return}const{id:M}=await b.create.mutateAsync(y),R=await et({connectionId:M,orgId:j.id,orgSlug:j.slug,persistFallback:X=>b.update.mutateAsync({id:M,data:{connection_token:X}}).then(()=>{})});if(R.ran&&!R.ok){E("connection_oauth_failed",{connection_id:M,flow:"connect_new",error:R.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:R.error??"no token received"})}),m(M,y.app_name??null,"new"),u(M);return}R.ran?(await x(M,"connect_new"),H.success(i("virtualMcp.addConnectionDialog.connectedAuthenticated"))):H.success(i("virtualMcp.addConnectionDialog.connected")),m(M,y.app_name??null,"new"),u(M)}catch(y){console.error("Failed to connect:",y),H.error(i("virtualMcp.addConnectionDialog.failedToConnect"))}finally{d(null)}}};return t.jsxs(zt,{open:n,onOpenChange:e,children:[t.jsxs(Ot,{className:"sm:max-w-5xl h-[85vh] max-h-[85vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[t.jsx(Mt,{className:"px-6 pt-5 pb-0 shrink-0",children:t.jsx($t,{className:"text-base font-semibold",children:i(c==="browse"?"virtualMcp.addConnectionDialog.connectionsTitle":"virtualMcp.addConnectionDialog.addConnectionTitle")})}),t.jsx("div",{className:"pt-3 shrink-0",children:t.jsx(Dn,{value:h,onChange:C,placeholder:i("virtualMcp.addConnectionDialog.searchConnectionsPlaceholder")})}),t.jsx(V.Suspense,{fallback:t.jsx("div",{className:"flex-1 flex items-center justify-center",children:t.jsx(De,{size:24,className:"animate-spin text-muted-foreground"})}),children:t.jsx(As,{mode:c,agentId:r,addedConnectionIds:l,onAdd:u,onCloneAndAdd:k,onConnectAndAdd:T,connectingItemId:f,search:h,onCreateConnection:()=>g(!0),onBrowseNavigate:D,defaultTab:s})})]}),t.jsx(Is,{open:p,onOpenChange:g,onCreated:async N=>{g(!1);const y=await et({connectionId:N,orgId:j.id,orgSlug:j.slug,persistFallback:P=>b.update.mutateAsync({id:N,data:{connection_token:P}}).then(()=>{})});if(y.ran&&!y.ok){E("connection_oauth_failed",{connection_id:N,flow:"custom_create",error:y.error??"no_token"}),H.warning(i("virtualMcp.addConnectionDialog.signInFailedTitle"),{description:i("virtualMcp.addConnectionDialog.signInFailedDescription",{error:y.error??"no token received"})}),m(N,null,"custom"),u(N),e(!1);return}y.ran&&await x(N,"custom_create"),m(N,null,"custom"),u(N),e(!1)}})]})}const ft=new Map;function Bo(){const{org:n}=oe(),e=Qn(),s=Wn(),o=s.find(g=>g.providerId==="deco"),{data:a,isLoading:i,refetch:c,isFetching:r}=Jt({queryKey:it.aiProviderCredits(n.id,"deco"),enabled:!!o,staleTime:6e4,queryFn:async()=>{try{return await e.call("AI_PROVIDER_CREDITS",{providerId:"deco"})}catch{return null}}}),l=a?.balanceCents??null,u=l!=null?l/100:null,m=V.useRef(new Map);if(l!=null){const g=ft.get(n.id);m.current.get(n.id)&&g!=null&&l>g&&E("credits_topped_up_detected",{organization_id:n.id,delta_cents:l-g,previous_balance_cents:g,new_balance_cents:l}),ft.set(n.id,l),m.current.set(n.id,!0)}const f=!!o,d=l!=null&&l>0,h=l!=null&&l===0,C=l!=null&&l===200,p=s.length>0&&s.every(g=>g.providerId==="deco");return{hasDecoKey:f,decoKeyId:o?.id??null,balanceCents:l,balanceDollars:u,hasCredits:d,isZeroBalance:h,isInitialFreeCredit:C,hasOnlyDecoProvider:p,isLoading:i,isFetching:r,refetch:c}}export{Mo as A,To as C,$o as N,Oo as O,zo as a,Fo as b,os as c,lt as d,Bo as u};
|
package/dist/client/assets/{use-decopilot-events-LcKd19eo.js → use-decopilot-events-eIVvjBw7.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s}from"./index-
|
|
1
|
+
import{r as s}from"./index-GPtGFYbO.js";import{d as R,c as u}from"./decopilot-sse-pool-H9DQ4gY8.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};
|
package/dist/client/assets/{use-delete-connection-YreJg1bm.js → use-delete-connection-B4-A3kiZ.js}
RENAMED
|
@@ -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,bb as re,bc as ae}from"./index-
|
|
1
|
+
import{c as oe,b as le,j as n,F as se,o as ie,r as ce,t as Y,bb as re,bc as ae}from"./index-GPtGFYbO.js";import{A as z,a as G,b as V,c as X,d as Z,e as ee,f as te,g as ne}from"./alert-dialog-DC6Lplgx.js";import{u as de}from"./studio-tools-BDRk_Gqu.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 b;e[56]!==_?(b=n.jsx("p",{className:"mt-2",children:_}),e[56]=_,e[57]=b):b=e[57];let F;e[58]!==A||e[59]!==b?(F=n.jsx(G,{asChild:!0,children:n.jsxs("div",{children:[A,b]})}),e[58]=A,e[59]=b,e[60]=F):F=e[60];let I;e[61]!==y||e[62]!==F?(I=n.jsxs(V,{children:[y,F]}),e[61]=y,e[62]=F,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};
|
package/dist/client/assets/{use-deployment-admin-BHP-geVv.js → use-deployment-admin-SQnVkdAY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as s,n as m,K as c}from"./index-
|
|
1
|
+
import{c as s,n as m,K as c}from"./index-GPtGFYbO.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-
|
|
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-GPtGFYbO.js";import{u as f}from"./studio-tools-BDRk_Gqu.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};
|
package/dist/client/assets/{use-infinite-scroll-CBy2t19Z.js → use-infinite-scroll-Bx6Dv81T.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aU as l,e4 as d,e5 as v,r as i}from"./index-
|
|
1
|
+
import{aU as l,e4 as d,e5 as v,r as i}from"./index-GPtGFYbO.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-
|
|
1
|
+
import{c as g,F as N,K as y,n as _,o as A,e as I,t as q}from"./index-GPtGFYbO.js";import{a as S}from"./use-capability-7E41d664.js";import{u as O}from"./studio-tools-BDRk_Gqu.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,4 +1,4 @@
|
|
|
1
|
-
import{dc as fe,dd as pe,de as me,ch as _e,df as ge,bV as _,bW as w,dg as we,dh as Te,di as ye,dj as $,dk as ve,dl as V,dm as ke,dn as M,dp as Se,dq as G,dr as Re,ds as Ce,dt as Ee,du as K,by as be,bA as Ie,bv as Ae,cc as re,co as qe,cu as Me,cs as Pe,cF as Oe,dv as $e,dw as Ne,dx as N,dy as He,dz as Ue,ct as De,cp as xe,cq as je,cr as Le,bw as Fe,dA as Ve,dB as Ge,dC as Qe,cj as We,dD as ze,dE as Ke,cB as D,dF as Je,bu as j,c as oe,x as ae,K as W}from"./index-HWhUkMVs.js";import{U as P,a as H,e as J}from"./auth-BxRabvv-.js";const qt={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`},Mt="get_my_diagnostic",Pt="https://github.com/decocms.png",Ye="self";function R(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function Be(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_"),Ot=ne.is,Ze=ne.get,ie=R("dev_"),$t=ie.get,Nt=ie.is,Xe="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",et="#f59e0b",Ht=`https://api.iconify.design/lucide:bug.svg?color=${encodeURIComponent(et)}`,tt="#6366f1",Ut=`https://api.iconify.design/lucide:file-search.svg?color=${encodeURIComponent(tt)}`;function Dt(a){return Be({id:Ze(a),organizationId:a,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:Xe,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}const st=R("commerce-discovery_"),xt=st.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_")},jt={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 Lt(a){return a?Object.values(C).some(e=>e.is(a)!==null):!1}function x(a){return!!a._zod}function b(a,e){return x(a)?fe(a,e):a.safeParse(e)}function ce(a){if(!a)return;let e;if(x(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function rt(a){if(x(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 Y(a){const t=ce(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=rt(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function B(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const ot=6e4;class at{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(pe,t=>{this._oncancel(t)}),this.setNotificationHandler(me,t=>{this._onprogress(t)}),this.setRequestHandler(_e,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ge,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(we,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 d=u,f=new _(d.error.code,d.error.message,d.error.data);l(f)}else{const d=i.type==="response"?"Response":"Error";this._onerror(new Error(`${d} 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 _(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(Te,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 _(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ye,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(I(r.status))throw new _(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 _(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof _?r:new _(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),_.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)||ve(o)?this._onresponse(o):V(o)?this._onrequest(o,n):ke(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=_.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(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):r?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=Se(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 d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(n.signal.aborted)throw new _(w.ConnectionClosed,"Request was cancelled");const m={...f,relatedRequestId:e.id};o&&!m.relatedTask&&(m.relatedTask={taskId:o});const T=m.relatedTask?.taskId??o;return T&&u&&await u.updateTaskStatus(T,"input_required"),await this.request(l,d,m)},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 d={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)},async l=>{if(n.signal.aborted)return;const d={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:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)}).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),$(e))s(e);else{const n=new _(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($(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),$(e))r(e);else{const n=_.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 _?n:new _(w.InternalError,String(n))}}return}let o;try{const n=await this.request(e,G,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new _(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 _(w.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new _(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 _?n:new _(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 d=c=>{l(c)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){d(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(m.params={...m.params,task:i}),u&&(m.params={...m.params,_meta:{...m.params?._meta||{},[M]:u}});const T=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 g=c instanceof _?c:new _(w.RequestTimeout,String(c));l(g)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const g=b(t,c.result);g.success?p(g.data):l(g.error)}catch(g){l(g)}}}),s?.signal?.addEventListener("abort",()=>{T(s?.signal?.reason)});const y=s?.timeout??ot,v=()=>T(_.fromError(w.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(f,y,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const h=u?.taskId;if(h){const c=g=>{const k=this._responseHandlers.get(f);k?k(g):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(h,{type:"request",message:m,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(f),l(g)})}else this._transport.send(m,{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},Re,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},Ce,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ee,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=Y(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=B(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=Y(e);this._notificationHandlers.set(s,r=>{const o=B(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"&&V(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new _(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 _(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new _(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 _(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=K.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 _(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(I(i.status))throw new _(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=K.parse({method:"notifications/tasks/status",params:u});await this.notification(p),I(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function Z(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function nt(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];Z(n)&&Z(o)?t[r]={...n,...o}:t[r]=o}return t}var it=Ie();const ct=be(it);function lt(){const a=new ct({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ae(a),a}class ut{constructor(e){this._ajv=e??lt()}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 dt{constructor(e){this._client=e}async*callToolStream(e,t=re,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 _(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 _(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof _){yield{type:"error",error:l};return}yield{type:"error",error:new _(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 ht(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 ft(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 U(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&&U(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&U(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&U(t,e)}}function pt(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 mt=class extends at{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 ut,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",qe,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Me,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new dt(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nt(this._capabilities,e)}setRequestHandler(e,t){const r=ce(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(x(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(Ge,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:d}=l.data;d.mode=d.mode??"form";const{supportsFormMode:f,supportsUrlMode:m}=pt(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new _(w.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!m)throw new _(w.InvalidParams,"Client does not support URL-mode elicitation requests");const T=await Promise.resolve(t(u,p));if(d.task){const c=b(G,T);if(!c.success){const g=c.error instanceof Error?c.error.message:String(c.error);throw new _(w.InvalidParams,`Invalid task creation result: ${g}`)}return c.data}const y=b(Qe,T);if(!y.success){const c=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=y.data,h=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{U(h,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(We,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:d}=l.data,f=await Promise.resolve(t(u,p));if(d.task){const v=b(G,f);if(!v.success){const h=v.error instanceof Error?v.error.message:String(v.error);throw new _(w.InvalidParams,`Invalid task creation result: ${h}`)}return v.data}const T=d.tools||d.toolChoice?ze:Ke,y=b(T,f);if(!y.success){const v=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid sampling result: ${v}`)}return y.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:Oe,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ne.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){ht(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ft(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},He,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},Ue,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},De,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},je,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Le,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=re,s){if(this.isToolTaskRequired(e.name))throw new _(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 _(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 _(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof _?n:new _(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=Ve.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 d=await r();u(null,d)}catch(d){const f=d instanceof Error?d:new Error(String(d));u(f,null)}},l=()=>{if(i){const d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);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 L=a=>[{type:"text",text:a}];function _t(a){const e=D(a,typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either studioUrl 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(d){const f=d instanceof Error?d.message:"Network error";return{content:L(f),isError:!0}}if(!p.ok){let d=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(d=f.error)}catch{}return{content:L(d),isError:!0}}const l=await p.json().catch(()=>({}));return{content:L(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 Q(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function gt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...Q(e.headers),...Q(s.headers)}:e.headers};return a(t,r)}:a}class X 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 ee=10,wt=13,A=32;function F(a){}function Tt(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 d(h){if(n&&(n=!1,h.charCodeAt(0)===239&&h.charCodeAt(1)===187&&h.charCodeAt(2)===191&&(h=h.slice(3))),o.length===0){const k=f(h);k!==""&&o.push(k);return}if(h.indexOf(`
|
|
1
|
+
import{dc as fe,dd as pe,de as me,ch as _e,df as ge,bV as _,bW as w,dg as we,dh as Te,di as ye,dj as $,dk as ve,dl as V,dm as ke,dn as M,dp as Se,dq as G,dr as Re,ds as Ce,dt as Ee,du as K,by as be,bA as Ie,bv as Ae,cc as re,co as qe,cu as Me,cs as Pe,cF as Oe,dv as $e,dw as Ne,dx as N,dy as He,dz as Ue,ct as De,cp as xe,cq as je,cr as Le,bw as Fe,dA as Ve,dB as Ge,dC as Qe,cj as We,dD as ze,dE as Ke,cB as D,dF as Je,bu as j,c as oe,x as ae,K as W}from"./index-GPtGFYbO.js";import{U as P,a as H,e as J}from"./auth-B_fsW_pO.js";const qt={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`},Mt="get_my_diagnostic",Pt="https://github.com/decocms.png",Ye="self";function R(a){return{is(e){return!e||!e.startsWith(a)?null:e.slice(a.length)||null},get(e){return`${a}${e}`}}}function Be(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_"),Ot=ne.is,Ze=ne.get,ie=R("dev_"),$t=ie.get,Nt=ie.is,Xe="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",et="#f59e0b",Ht=`https://api.iconify.design/lucide:bug.svg?color=${encodeURIComponent(et)}`,tt="#6366f1",Ut=`https://api.iconify.design/lucide:file-search.svg?color=${encodeURIComponent(tt)}`;function Dt(a){return Be({id:Ze(a),organizationId:a,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:Xe,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}const st=R("commerce-discovery_"),xt=st.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_")},jt={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 Lt(a){return a?Object.values(C).some(e=>e.is(a)!==null):!1}function x(a){return!!a._zod}function b(a,e){return x(a)?fe(a,e):a.safeParse(e)}function ce(a){if(!a)return;let e;if(x(a)?e=a._zod?.def?.shape:e=a.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function rt(a){if(x(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 Y(a){const t=ce(a)?.method;if(!t)throw new Error("Schema is missing a method literal");const s=rt(t);if(typeof s!="string")throw new Error("Schema method literal must be a string");return s}function B(a,e){const t=b(a,e);if(!t.success)throw t.error;return t.data}const ot=6e4;class at{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(pe,t=>{this._oncancel(t)}),this.setNotificationHandler(me,t=>{this._onprogress(t)}),this.setRequestHandler(_e,t=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ge,async(t,s)=>{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(we,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 d=u,f=new _(d.error.code,d.error.message,d.error.data);l(f)}else{const d=i.type==="response"?"Response":"Error";this._onerror(new Error(`${d} 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 _(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(Te,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 _(w.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ye,async(t,s)=>{try{const r=await this._taskStore.getTask(t.params.taskId,s.sessionId);if(!r)throw new _(w.InvalidParams,`Task not found: ${t.params.taskId}`);if(I(r.status))throw new _(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 _(w.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(r){throw r instanceof _?r:new _(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),_.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)||ve(o)?this._onresponse(o):V(o)?this._onrequest(o,n):ke(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=_.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(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):r?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const i=Se(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 d={relatedRequestId:e.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(n.signal.aborted)throw new _(w.ConnectionClosed,"Request was cancelled");const m={...f,relatedRequestId:e.id};o&&!m.relatedTask&&(m.relatedTask={taskId:o});const T=m.relatedTask?.taskId??o;return T&&u&&await u.updateTaskStatus(T,"input_required"),await this.request(l,d,m)},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 d={result:l,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)},async l=>{if(n.signal.aborted)return;const d={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:d,timestamp:Date.now()},r?.sessionId):await r?.send(d)}).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),$(e))s(e);else{const n=new _(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($(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),$(e))r(e);else{const n=_.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 _?n:new _(w.InternalError,String(n))}}return}let o;try{const n=await this.request(e,G,s);if(n.task)o=n.task.taskId,yield{type:"taskCreated",task:n.task};else throw new _(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 _(w.InternalError,`Task ${o} failed`)}:i.status==="cancelled"&&(yield{type:"error",error:new _(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 _?n:new _(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 d=c=>{l(c)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),i&&this.assertTaskCapability(e.method)}catch(c){d(c);return}s?.signal?.throwIfAborted();const f=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:f};s?.onprogress&&(this._progressHandlers.set(f,s.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:f}}),i&&(m.params={...m.params,task:i}),u&&(m.params={...m.params,_meta:{...m.params?._meta||{},[M]:u}});const T=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 g=c instanceof _?c:new _(w.RequestTimeout,String(c));l(g)};this._responseHandlers.set(f,c=>{if(!s?.signal?.aborted){if(c instanceof Error)return l(c);try{const g=b(t,c.result);g.success?p(g.data):l(g.error)}catch(g){l(g)}}}),s?.signal?.addEventListener("abort",()=>{T(s?.signal?.reason)});const y=s?.timeout??ot,v=()=>T(_.fromError(w.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(f,y,s?.maxTotalTimeout,v,s?.resetTimeoutOnProgress??!1);const h=u?.taskId;if(h){const c=g=>{const k=this._responseHandlers.get(f);k?k(g):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,c),this._enqueueTaskMessage(h,{type:"request",message:m,timestamp:Date.now()}).catch(g=>{this._cleanupTimeout(f),l(g)})}else this._transport.send(m,{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},Re,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},Ce,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Ee,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=Y(e);this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,o)=>{const n=B(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=Y(e);this._notificationHandlers.set(s,r=>{const o=B(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"&&V(r.message)){const o=r.message.id,n=this._requestResolvers.get(o);n?(n(new _(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 _(w.InvalidRequest,"Request cancelled"));return}const n=setTimeout(r,s);t.addEventListener("abort",()=>{clearTimeout(n),o(new _(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 _(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=K.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 _(w.InvalidParams,`Task "${r}" not found - it may have been cleaned up`);if(I(i.status))throw new _(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=K.parse({method:"notifications/tasks/status",params:u});await this.notification(p),I(u.status)&&this._cleanupTaskProgressHandler(r)}},listTasks:r=>s.listTasks(r,t)}}}function Z(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function nt(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];Z(n)&&Z(o)?t[r]={...n,...o}:t[r]=o}return t}var it=Ie();const ct=be(it);function lt(){const a=new ct({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Ae(a),a}class ut{constructor(e){this._ajv=e??lt()}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 dt{constructor(e){this._client=e}async*callToolStream(e,t=re,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 _(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 _(w.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof _){yield{type:"error",error:l};return}yield{type:"error",error:new _(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 ht(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 ft(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 U(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&&U(o,t[r])}}if(Array.isArray(a.anyOf))for(const t of a.anyOf)typeof t!="boolean"&&U(t,e);if(Array.isArray(a.oneOf))for(const t of a.oneOf)typeof t!="boolean"&&U(t,e)}}function pt(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 mt=class extends at{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 ut,t?.listChanged&&(this._pendingListChangedConfig=t.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",qe,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Me,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Pe,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new dt(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=nt(this._capabilities,e)}setRequestHandler(e,t){const r=ce(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let o;if(x(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(Ge,u);if(!l.success){const c=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid elicitation request: ${c}`)}const{params:d}=l.data;d.mode=d.mode??"form";const{supportsFormMode:f,supportsUrlMode:m}=pt(this._capabilities.elicitation);if(d.mode==="form"&&!f)throw new _(w.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!m)throw new _(w.InvalidParams,"Client does not support URL-mode elicitation requests");const T=await Promise.resolve(t(u,p));if(d.task){const c=b(G,T);if(!c.success){const g=c.error instanceof Error?c.error.message:String(c.error);throw new _(w.InvalidParams,`Invalid task creation result: ${g}`)}return c.data}const y=b(Qe,T);if(!y.success){const c=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid elicitation result: ${c}`)}const v=y.data,h=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&v.action==="accept"&&v.content&&h&&this._capabilities.elicitation?.form?.applyDefaults)try{U(h,v.content)}catch{}return v};return super.setRequestHandler(e,i)}if(n==="sampling/createMessage"){const i=async(u,p)=>{const l=b(We,u);if(!l.success){const v=l.error instanceof Error?l.error.message:String(l.error);throw new _(w.InvalidParams,`Invalid sampling request: ${v}`)}const{params:d}=l.data,f=await Promise.resolve(t(u,p));if(d.task){const v=b(G,f);if(!v.success){const h=v.error instanceof Error?v.error.message:String(v.error);throw new _(w.InvalidParams,`Invalid task creation result: ${h}`)}return v.data}const T=d.tools||d.toolChoice?ze:Ke,y=b(T,f);if(!y.success){const v=y.error instanceof Error?y.error.message:String(y.error);throw new _(w.InvalidParams,`Invalid sampling result: ${v}`)}return y.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:Oe,capabilities:this._capabilities,clientInfo:this._clientInfo}},$e,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!Ne.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){ht(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&ft(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},He,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},Ue,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},De,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xe,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},je,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Le,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=re,s){if(this.isToolTaskRequired(e.name))throw new _(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 _(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 _(w.InvalidParams,`Structured content does not match the tool's output schema: ${n.errorMessage}`)}catch(n){throw n instanceof _?n:new _(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=Ve.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 d=await r();u(null,d)}catch(d){const f=d instanceof Error?d:new Error(String(d));u(f,null)}},l=()=>{if(i){const d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);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 L=a=>[{type:"text",text:a}];function _t(a){const e=D(a,typeof window<"u"?window.location.origin:void 0);if(!e)throw new Error("RestSelfClient requires either studioUrl 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(d){const f=d instanceof Error?d.message:"Network error";return{content:L(f),isError:!0}}if(!p.ok){let d=`${u.name} failed (${p.status})`;try{const f=await p.json();f?.error&&(d=f.error)}catch{}return{content:L(d),isError:!0}}const l=await p.json().catch(()=>({}));return{content:L(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 Q(a){return a?a instanceof Headers?Object.fromEntries(a.entries()):Array.isArray(a)?Object.fromEntries(a):{...a}:{}}function gt(a=fetch,e){return e?async(t,s)=>{const r={...e,...s,headers:s?.headers?{...Q(e.headers),...Q(s.headers)}:e.headers};return a(t,r)}:a}class X 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 ee=10,wt=13,A=32;function F(a){}function Tt(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 d(h){if(n&&(n=!1,h.charCodeAt(0)===239&&h.charCodeAt(1)===187&&h.charCodeAt(2)===191&&(h=h.slice(3))),o.length===0){const k=f(h);k!==""&&o.push(k);return}if(h.indexOf(`
|
|
2
2
|
`)===-1&&h.indexOf("\r")===-1){o.push(h);return}o.push(h);const c=o.join("");o.length=0;const g=f(c);g!==""&&o.push(g)}function f(h){let c=0;if(h.indexOf("\r")===-1){let g=h.indexOf(`
|
|
3
3
|
`,c);for(;g!==-1;){if(c===g){p>0&&e({id:i,event:l,data:u}),i=void 0,u="",p=0,l=void 0,c=g+1,g=h.indexOf(`
|
|
4
4
|
`,c);continue}const k=h.charCodeAt(c);if(te(h,c,k)){const S=h.charCodeAt(c+5)===A?c+6:c+5,E=h.slice(S,g);if(p===0&&h.charCodeAt(g+1)===ee){e({id:i,event:l,data:E}),i=void 0,u="",l=void 0,c=g+2,g=h.indexOf(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as m,n as p,x as q,K as T}from"./index-
|
|
1
|
+
import{c as m,n as p,x as q,K as T}from"./index-GPtGFYbO.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 w(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,w as u};
|