@decocms/mesh 2.123.5 → 2.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-e9vRKWVt.js → AlertCircle-BzYW4X7z.js} +1 -1
- package/dist/client/assets/{AlertOctagon-CNHeyyqI.js → AlertOctagon-CUysWl_m.js} +1 -1
- package/dist/client/assets/{AlertTriangle-cnBbzVPi.js → AlertTriangle-DniGvpwb.js} +1 -1
- package/dist/client/assets/ArrowDown-B35oswmj.js +1 -0
- package/dist/client/assets/{ArrowLeft-TcoC4WAS.js → ArrowLeft-dS1h2Fqu.js} +1 -1
- package/dist/client/assets/ArrowUp-G8RCE5_O.js +1 -0
- package/dist/client/assets/{Check-EA1ayL22.js → Check-Bv0pZ3gl.js} +1 -1
- package/dist/client/assets/{CheckCircle-xWFK4Wk3.js → CheckCircle-lzDHXhkH.js} +1 -1
- package/dist/client/assets/{CheckDone01-BOMbg_rH.js → CheckDone01-BrxNvWbF.js} +1 -1
- package/dist/client/assets/{CheckVerified02-4QT-kdyE.js → CheckVerified02-6wwLRSRQ.js} +1 -1
- package/dist/client/assets/{ChevronDown-xG1flmUs.js → ChevronDown-CggIFEVQ.js} +1 -1
- package/dist/client/assets/{ChevronRight-C9tH4CkK.js → ChevronRight-DgAfR8pA.js} +1 -1
- package/dist/client/assets/{Clock-BcphCi5B.js → Clock-IA7N95Qq.js} +1 -1
- package/dist/client/assets/{Code01-ADQg-6t7.js → Code01-DP2jwP0n.js} +1 -1
- package/dist/client/assets/{Container-CxXUVDpa.js → Container-jfv9L6Hc.js} +1 -1
- package/dist/client/assets/{Copy01-Dv-qbf9Z.js → Copy01-Dq7Edhtu.js} +1 -1
- package/dist/client/assets/{Dataflow03-B87skZTy.js → Dataflow03-C6KAN8vb.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-DHYMLP_1.js → DotsHorizontal-CQ-MbYsC.js} +1 -1
- package/dist/client/assets/{DotsVertical-CWcpvKQb.js → DotsVertical-PhooMqUv.js} +1 -1
- package/dist/client/assets/{Download01-BjOSY-hg.js → Download01-CA9RmYjX.js} +1 -1
- package/dist/client/assets/{Edit01-Bc5S6NRh.js → Edit01-DRruZKzG.js} +1 -1
- package/dist/client/assets/{Eye-C8kM8O8_.js → Eye-B9ZDOUkE.js} +1 -1
- package/dist/client/assets/{File02-BUAk_Mxv.js → File02-B2t2I1sM.js} +1 -1
- package/dist/client/assets/{File06-DiS1m4o9.js → File06-2US99J_V.js} +1 -1
- package/dist/client/assets/{FilterLines-BwKo1iZw.js → FilterLines-BFeSNY4D.js} +1 -1
- package/dist/client/assets/{Globe01-4jB_rpuY.js → Globe01-Dxe6Kj1c.js} +1 -1
- package/dist/client/assets/{Globe02-CT2c-Sr-.js → Globe02-BPmEw10H.js} +1 -1
- package/dist/client/assets/{Grid01-D2I-nDSy.js → Grid01-CJW4ZLO5.js} +1 -1
- package/dist/client/assets/{Hash02-CzXz7icr.js → Hash02-CIZbsu7P.js} +1 -1
- package/dist/client/assets/{Home02-BA7Zg0e7.js → Home02-Doo3wLuN.js} +1 -1
- package/dist/client/assets/{Image01-DNFNbFFa.js → Image01-C9h8llDV.js} +1 -1
- package/dist/client/assets/{Inbox01-B0U3vj2i.js → Inbox01-BweXezQd.js} +1 -1
- package/dist/client/assets/{InfoCircle-BGj0zA50.js → InfoCircle-DBbArWGV.js} +1 -1
- package/dist/client/assets/{Key01-CXgWd4vy.js → Key01-CfL5jY3W.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DYnfy1wV.js → LinkExternal01-DAvzaXYE.js} +1 -1
- package/dist/client/assets/{List-DGxlSM0E.js → List-sG42OZ_v.js} +1 -1
- package/dist/client/assets/{Loading01-KCITfr7g.js → Loading01-BHMOj-H5.js} +1 -1
- package/dist/client/assets/{Lock01-CdxVQsk2.js → Lock01-CQ3bhGvR.js} +1 -1
- package/dist/client/assets/{Pin01-u382yYSC.js → Pin01-8MTlfWD2.js} +1 -1
- package/dist/client/assets/{Play-D_UDCjeV.js → Play-APj1Lxit.js} +1 -1
- package/dist/client/assets/{Plus-BNEEXEVt.js → Plus-DNqvDLOK.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-BpGtyqTA.js → RefreshCcw01-4dzpBOob.js} +1 -1
- package/dist/client/assets/{RefreshCw01-k0GFakzy.js → RefreshCw01-DHXbMDcX.js} +1 -1
- package/dist/client/assets/{Rows03-nEjgsj7h.js → Rows03-Cdgrgsit.js} +1 -1
- package/dist/client/assets/{Save01-BbS0C0s1.js → Save01-D-T2SbCx.js} +1 -1
- package/dist/client/assets/{SearchMd-DqymgKbi.js → SearchMd-BLcaRHQs.js} +1 -1
- package/dist/client/assets/{Settings01-DB_FXn41.js → Settings01-DKXbh8uh.js} +1 -1
- package/dist/client/assets/{Shield01-83aA2EpW.js → Shield01-B89AcbSX.js} +1 -1
- package/dist/client/assets/{Terminal-D70UGODi.js → Terminal-BblMM2fp.js} +1 -1
- package/dist/client/assets/{Trash01-Ve8IhEa-.js → Trash01-CkTOgej8.js} +1 -1
- package/dist/client/assets/{Upload01-BM2mkCav.js → Upload01-gcuuVZ2S.js} +1 -1
- package/dist/client/assets/{Users03-CgNWgARv.js → Users03-C1B58zTV.js} +1 -1
- package/dist/client/assets/{XCircle-I5P8gQFi.js → XCircle-DneNZUk0.js} +1 -1
- package/dist/client/assets/{XClose-Ds_Z25Px.js → XClose-Dgr_gyyv.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-DjlpVnu5.js → agent-connections-preview-Dq0jl9Fh.js} +1 -1
- package/dist/client/assets/agent-detail-BNn3Uyo0.js +2 -0
- package/dist/client/assets/agents-BAZxaM_m.js +1 -0
- package/dist/client/assets/{alert-dialog-97XFXZ7z.js → alert-dialog-BvNipqK_.js} +1 -1
- package/dist/client/assets/{auth-catchall-QQUziPMo.js → auth-catchall-BoSUXTLZ.js} +1 -1
- package/dist/client/assets/{avatar-CSAt9Xy0.js → avatar-BNKSN34R.js} +1 -1
- package/dist/client/assets/{badge-CmYXzetd.js → badge-Do8iK9u9.js} +1 -1
- package/dist/client/assets/{binder-DYyCY7OY.js → binder-BBB8LQyx.js} +1 -1
- package/dist/client/assets/{breadcrumb-C8XV9Tx6.js → breadcrumb-DeYbtjMk.js} +1 -1
- package/dist/client/assets/{button-BCe1bdkY.js → button-D6YZfFzy.js} +1 -1
- package/dist/client/assets/{card-CPMQS2Ob.js → card-BNyCnFpQ.js} +1 -1
- package/dist/client/assets/{chart-BkpAbHOw.js → chart--8-symKO.js} +1 -1
- package/dist/client/assets/{checkbox-CwkaBsQF.js → checkbox-BZwARXIv.js} +1 -1
- package/dist/client/assets/{circle-alert-Bm720OZV.js → circle-alert-YjViK8VE.js} +1 -1
- package/dist/client/assets/{collection-detail-BFUjMKO2.js → collection-detail-LkGK1rw-.js} +3 -3
- package/dist/client/assets/collection-search-CBYSITVU.js +1 -0
- package/dist/client/assets/collection-tab-BrrYAQmN.js +1 -0
- package/dist/client/assets/collection-table-wrapper-fNhnYl-G.js +1 -0
- package/dist/client/assets/{collection-tabs-BHN2S0hU.js → collection-tabs-D0bfkNrY.js} +1 -1
- package/dist/client/assets/{command-Pq6xcJWI.js → command-Dt3t7o57.js} +1 -1
- package/dist/client/assets/{connect-DQK3gKkY.js → connect-DPEGql6L.js} +1 -1
- package/dist/client/assets/{connection-card-BpGIljul.js → connection-card-Cwh5xUmA.js} +1 -1
- package/dist/client/assets/connection-detail-DgHwxZSJ.js +1 -0
- package/dist/client/assets/connections-D2AuzZXu.js +1 -0
- package/dist/client/assets/{constants-BHgsXonC.js → constants-8URKDp4Y.js} +1 -1
- package/dist/client/assets/constants-oXq_cTdm.js +1 -0
- package/dist/client/assets/context-DHicyHl4.js +23 -0
- package/dist/client/assets/{create-organization-dialog-CBFtj5S8.js → create-organization-dialog-Cb3EQpzl.js} +1 -1
- package/dist/client/assets/{create-project-dialog-D6D5900x.js → create-project-dialog-BjqZAjhY.js} +1 -1
- package/dist/client/assets/{deco-constants-0EY--BSu.js → deco-constants-CyaJG-D1.js} +1 -1
- package/dist/client/assets/{dialog-CtlwZ0jC.js → dialog-DSPMVHyJ.js} +1 -1
- package/dist/client/assets/{dropdown-menu-DrduhkS0.js → dropdown-menu-CRT7qGQ9.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-B2-8YMnE.js → dynamic-plugin-layout-Dj3hkiA6.js} +1 -1
- package/dist/client/assets/{empty-state-Ar7E8UGz.js → empty-state-BA6UkF4p.js} +1 -1
- package/dist/client/assets/empty-state-sMx3NP6e.js +1 -0
- package/dist/client/assets/{env-vars-editor-CULzWCmD.js → env-vars-editor-DuW-Il-b.js} +1 -1
- package/dist/client/assets/{error-boundary-CEwcdDux.js → error-boundary-lFjWy2-n.js} +1 -1
- package/dist/client/assets/{extract-connection-data-D0wplOp-.js → extract-connection-data-B39uuFqG.js} +1 -1
- package/dist/client/assets/{file-browser-BgdKdkl_.js → file-browser-BIF8ssgw.js} +2 -2
- package/dist/client/assets/{form-CKVYRQ0T.js → form-BMtUcs2k.js} +1 -1
- package/dist/client/assets/{grid-view-Co3RRJOJ.js → grid-view-e1dnT7b5.js} +1 -1
- package/dist/client/assets/{home-DznUdggS.js → home-1A3rDo1n.js} +1 -1
- package/dist/client/assets/index-BMDGI420.css +1 -0
- package/dist/client/assets/{index-DT392Y-e.js → index-B_nMIrSY.js} +1 -1
- package/dist/client/assets/{index-CcDRz5PD.js → index-CCjxSJ1y.js} +1 -1
- package/dist/client/assets/{index-Dn7aggDn.js → index-CjGa0AXv.js} +1 -1
- package/dist/client/assets/{index-k8Oe2hAn.js → index-DJ_LDW-E.js} +1 -1
- package/dist/client/assets/{index-2W7jwMtr.js → index-DmoBx0VC.js} +1 -1
- package/dist/client/assets/{index-Cn654U6b.js → index-DnrfuViL.js} +1 -1
- package/dist/client/assets/{index-D9HmjKFM.js → index-DwBgLSti.js} +3 -3
- package/dist/client/assets/{index-DX0MTN78.js → index-QQ-XmLlG.js} +66 -68
- package/dist/client/assets/{infiniteQueryObserver-D6Tb66x3.js → infiniteQueryObserver-Yvt0ZTml.js} +1 -1
- package/dist/client/assets/{input-Dh6_kcmG.js → input-B7id4I1j.js} +1 -1
- package/dist/client/assets/{integration-icon-cQ6g2UTs.js → integration-icon-qV_BsBQR.js} +1 -1
- package/dist/client/assets/{label-BMznY53d.js → label-29qY4FPs.js} +1 -1
- package/dist/client/assets/{layout-Czw_4tYq.js → layout-Ck3H2-cu.js} +1 -1
- package/dist/client/assets/{localstorage-keys-CiUgmUPA.js → localstorage-keys-Ct4C992S.js} +1 -1
- package/dist/client/assets/{login-Btb0l3uq.js → login-DO8QasPa.js} +1 -1
- package/dist/client/assets/{markdown-U-heFZhR.js → markdown-jp5pFlBz.js} +2 -2
- package/dist/client/assets/{mcp-oauth-B9YTiwC5.js → mcp-oauth-Bb9gvF4o.js} +1 -1
- package/dist/client/assets/{mcp-server-card-BG1M4TxF.js → mcp-server-card-D_Epc4aH.js} +1 -1
- package/dist/client/assets/mcp-server-detail-Dut9IDFd.js +2 -0
- package/dist/client/assets/members-4s3A4PQH.js +3 -0
- package/dist/client/assets/{monitoring-dashboard-edit-D1JRXMr3.js → monitoring-dashboard-edit-DyFCcJjq.js} +1 -1
- package/dist/client/assets/{monitoring-dashboard-view-BIzOH-Jz.js → monitoring-dashboard-view-Bc4tCiDF.js} +1 -1
- package/dist/client/assets/{monitoring-BE-L8s7T.js → monitoring-gEkChCwS.js} +2 -2
- package/dist/client/assets/{oauth-callback-BXtPanrp.js → oauth-callback-tz7MTdrq.js} +1 -1
- package/dist/client/assets/{page-EpeWbq1x.js → page-YrzfNFn-.js} +1 -1
- package/dist/client/assets/page-pkTyp5rB.js +1 -0
- package/dist/client/assets/{plugin-empty-state-BofxsUhg.js → plugin-empty-state-YsTdKC2B.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-ChEPKOiF.js → plugin-empty-state-dEbxXjO6.js} +1 -1
- package/dist/client/assets/{plugin-header-Lsd9YZZT.js → plugin-header-Di-tZc0h.js} +1 -1
- package/dist/client/assets/{plugin-header-DOkBj305.js → plugin-header-Djvd0-eL.js} +1 -1
- package/dist/client/assets/{popover-eropQyy1.js → popover-pjzQQlLd.js} +1 -1
- package/dist/client/assets/project-layout-Bp5s1iI1.js +1 -0
- package/dist/client/assets/projects-list-DcozT0tR.js +1 -0
- package/dist/client/assets/ranking-layout-D3PvNfv7.js +1 -0
- package/dist/client/assets/{readme-viewer-DZxyjAz3.js → readme-viewer-BmO5RwRH.js} +1 -1
- package/dist/client/assets/{registry-layout-O1Li2ya2.js → registry-layout-DEN2jHtD.js} +1 -1
- package/dist/client/assets/{registry-utils-CyMutbQd.js → registry-utils-DMdc5PTp.js} +1 -1
- package/dist/client/assets/{reports-layout-BFKmzSSH.js → reports-layout-DziFQRp_.js} +2 -2
- package/dist/client/assets/{reset-password-DShMbyV1.js → reset-password-CrHLBBwi.js} +1 -1
- package/dist/client/assets/{resizable-BG9z6Y7B.js → resizable-jXkpfiVS.js} +1 -1
- package/dist/client/assets/{save-actions-B-kfZtU1.js → save-actions-BPg_8VMI.js} +1 -1
- package/dist/client/assets/{scroll-area-CtvEyO8q.js → scroll-area-CcejXaMp.js} +1 -1
- package/dist/client/assets/{select-CTboIb4n.js → select-CkeKfTEx.js} +1 -1
- package/dist/client/assets/shell-layout-C4PQ301W.js +3 -0
- package/dist/client/assets/{skeleton-DvxloPhR.js → skeleton-DNLZ4Kho.js} +1 -1
- package/dist/client/assets/{spinner-BXzzaGxp.js → spinner-DZtD-MX0.js} +1 -1
- package/dist/client/assets/{store-invite-DIMsDV12.js → store-invite-B_jz8YSY.js} +1 -1
- package/dist/client/assets/{switch-Bqvl2ZUo.js → switch-DFKxfcc5.js} +1 -1
- package/dist/client/assets/{table-8mfsydT_.js → table-Csfk_VXo.js} +1 -1
- package/dist/client/assets/tasks-Dv2Dq-cV.js +1 -0
- package/dist/client/assets/{textarea-D7l_vCcE.js → textarea-GWXLFYfv.js} +1 -1
- package/dist/client/assets/{time-range-picker-jSuF4CZc.js → time-range-picker-DnUGZRLa.js} +1 -1
- package/dist/client/assets/{toggle-group-Dn_Mv5A3.js → toggle-group-CojJ3wZ4.js} +1 -1
- package/dist/client/assets/tools-list-BPGP3JUO.js +1 -0
- package/dist/client/assets/{tooltip-D4-guuax.js → tooltip-D71dCz4E.js} +1 -1
- package/dist/client/assets/{topbar-portal-BYH3tZsX.js → topbar-portal-BKT0Es8i.js} +1 -1
- package/dist/client/assets/typewriter-title-DqLjhGgL.js +16 -0
- package/dist/client/assets/{use-binding-Df-bJ2So.js → use-binding-DbH4Xe03.js} +1 -1
- package/dist/client/assets/{use-connection-DdTk8NLZ.js → use-connection-BEGrPCmR.js} +1 -1
- package/dist/client/assets/{use-copy-8HhO39al.js → use-copy-DsHlaDHD.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-DwsRmfVV.js → use-create-virtual-mcp-BzTARjrD.js} +1 -1
- package/dist/client/assets/use-deco-chat-open-CxG3qwlT.js +1 -0
- package/dist/client/assets/{use-install-from-registry-Ce99gIbp.js → use-install-from-registry-CSDJ0ZgD.js} +1 -1
- package/dist/client/assets/{use-list-state-jCvBKLOI.js → use-list-state-DvpdPuz-.js} +1 -1
- package/dist/client/assets/{use-llm-DUUdSPtc.js → use-llm-BbYG_RIr.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-BFC1Reld.js → use-mcp-prompts-qD8uHlkj.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-CLGl37yf.js → use-mcp-tools-BAsmCzEJ.js} +1 -1
- package/dist/client/assets/{use-mobile-DjLsite2.js → use-mobile-Bs0AkxK7.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DcyH2By3.js → use-organization-settings-BJ9tNAL9.js} +1 -1
- package/dist/client/assets/{use-project-dNP8uTKN.js → use-project-CXHCn5kp.js} +1 -1
- package/dist/client/assets/{use-settings-modal-DA_WPJ_R.js → use-settings-modal-Dx8IF1Gs.js} +1 -1
- package/dist/client/assets/{use-view-mode-BGqPs4Aj.js → use-view-mode-DMPiUC22.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CtYFVzEt.js → use-virtual-mcp-DBzFAk7J.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-DXQ7BtjQ.js +1 -0
- package/dist/client/assets/{useMutation-4bsh-QBF.js → useMutation-DgG1LVg-.js} +1 -1
- package/dist/client/assets/useQuery-CPsXfVfR.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-CuH1Eku2.js +1 -0
- package/dist/client/assets/view-mode-toggle-2-qyK3LU.js +1 -0
- package/dist/client/assets/workflow-YppA7Sxi.js +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/ArrowUp-C9QbeSMz.js +0 -1
- package/dist/client/assets/Tool01-Gadnesxv.js +0 -1
- package/dist/client/assets/agent-detail-D2ISZyix.js +0 -2
- package/dist/client/assets/agents-DOdcUWzi.js +0 -1
- package/dist/client/assets/collection-tab-CrrbTDng.js +0 -1
- package/dist/client/assets/collection-table-wrapper-CXjGnlMm.js +0 -1
- package/dist/client/assets/connection-detail-BqvjF6X1.js +0 -1
- package/dist/client/assets/connections-BY5LbGWi.js +0 -1
- package/dist/client/assets/constants-CsU2_t5q.js +0 -1
- package/dist/client/assets/context-L0w3Lka_.js +0 -23
- package/dist/client/assets/empty-state-Cme5CLy_.js +0 -1
- package/dist/client/assets/index-BHAz67cr.css +0 -1
- package/dist/client/assets/mcp-server-detail-B9DpOKRj.js +0 -2
- package/dist/client/assets/members-BgBfar63.js +0 -3
- package/dist/client/assets/page-Ce7Y9dmM.js +0 -1
- package/dist/client/assets/project-layout-xiFU-30r.js +0 -1
- package/dist/client/assets/projects-list-CRX29G8Z.js +0 -1
- package/dist/client/assets/ranking-layout-CBbuyeVt.js +0 -1
- package/dist/client/assets/shell-layout-BUmIacnr.js +0 -3
- package/dist/client/assets/tasks-CkROBPPq.js +0 -1
- package/dist/client/assets/tools-list-4-0RjQZk.js +0 -1
- package/dist/client/assets/typewriter-title-4u2iTKVw.js +0 -16
- package/dist/client/assets/use-deco-chat-open-hbEpr7iz.js +0 -1
- package/dist/client/assets/useInfiniteQuery-JCmjqA8d.js +0 -1
- package/dist/client/assets/useQuery-DGMDf2So.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-DX7McnGC.js +0 -1
- package/dist/client/assets/workflow-Yiu69H_T.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{b4 as te,r as k,o as Zs,s as It,c as C,j as o,by as Wt,u as G,l as Ys,y as eo,e as pe,a as to,aE as et,O as tt,t as On,bm as q,bQ as no,bR as so,aH as oo,ar as Ft,au as de,aw as Rn,aI as ro,ap as Ht,aG as io,aJ as An,as as Mn,aP as lo,aQ as co,ax as Pn,aR as ao,bS as Vt,bT as uo,al as fo,bo as mo,ao as po,m as xo,bU as ho,bV as go,bW as Ln}from"./index-D9HmjKFM.js";import{E as Dn}from"./empty-state-Cme5CLy_.js";import{E as zn}from"./error-boundary-CEwcdDux.js";import{d as Ut,u as Bt,f as ct,h as bo}from"./use-connection-DdTk8NLZ.js";import{u as ne,g as Be,i as jo}from"./constants-BHgsXonC.js";import{P as qt}from"./index-Cn654U6b.js";import{F as _t,a as vo,b as Kt,d as Jt}from"./form-CKVYRQ0T.js";import{I as Gt}from"./input-Dh6_kcmG.js";import{T as Mt}from"./textarea-D7l_vCcE.js";import{b as Wn,V as Xt,a as he}from"./layout-Czw_4tYq.js";import{S as Fn}from"./save-actions-B-kfZtU1.js";import{c as M,B as Y}from"./button-BCe1bdkY.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as nt}from"./select-CTboIb4n.js";import{c as Qt,T as Zt,a as Yt,b as en,i as qn}from"./tooltip-D4-guuax.js";import{i as So}from"./AlertCircle-e9vRKWVt.js";import{s as yo}from"./Clock-BcphCi5B.js";import{i as wo}from"./Code01-ADQg-6t7.js";import{a as No}from"./Copy01-Dv-qbf9Z.js";import{i as Ue}from"./Loading01-KCITfr7g.js";import{i as tn}from"./Play-D_UDCjeV.js";import{s as at}from"./XClose-Ds_Z25Px.js";import{B as Kn,a as Jn,b as Pe,d as st,e as ot,c as Gn}from"./breadcrumb-C8XV9Tx6.js";import{u as Co,O as ko,M as Io,F as _o,v as Eo}from"./index-CcDRz5PD.js";import{d as nn,b as sn,a as on}from"./use-mcp-tools-CLGl37yf.js";import{I as dt}from"./integration-icon-cQ6g2UTs.js";import{M as Le,n as To,S as $o,a as Oo}from"./scroll-area-CtvEyO8q.js";import{E as rn}from"./empty-state-Ar7E8UGz.js";import{n as Ro}from"./Container-CxXUVDpa.js";import{b as Xn}from"./use-virtual-mcp-CtYFVzEt.js";import{b as Ao,a as jn,R as Mo}from"./resizable-BG9z6Y7B.js";import{B as me}from"./badge-CmYXzetd.js";import{S as ut}from"./spinner-BXzzaGxp.js";import{V as Po}from"./collection-table-wrapper-CXjGnlMm.js";import{N as Lo,S as Do,a as zo,c as Wo,m as Qe,P as Fo,i as Ho,R as Vo,u as Uo,b as Bo,d as vn,E as qo,e as Ko}from"./index-DX0MTN78.js";import{a as Jo}from"./use-binding-Df-bJ2So.js";import{b as Go,c as Xo,d as Qo,e as Zo,a as Yo,D as er}from"./dialog-CtlwZ0jC.js";import"./index-k8Oe2hAn.js";import{s as Qn}from"./Plus-BNEEXEVt.js";import{c as Zn}from"./AlertOctagon-CNHeyyqI.js";import{i as ft}from"./Check-EA1ayL22.js";import{i as tr}from"./DotsHorizontal-DHYMLP_1.js";import{a as nr}from"./Tool01-Gadnesxv.js";import{D as sr,a as or,b as rr,c as Sn}from"./dropdown-menu-DrduhkS0.js";import{g as ir,R as lr,h as cr,j as Yn}from"./use-deco-chat-open-hbEpr7iz.js";import{i as ar}from"./ChevronRight-C9tH4CkK.js";import{c as dr}from"./context-L0w3Lka_.js";import"./SearchMd-DqymgKbi.js";import"./AlertTriangle-cnBbzVPi.js";import"./useMutation-4bsh-QBF.js";import"./Pin01-u382yYSC.js";import"./use-organization-settings-DcyH2By3.js";import"./label-BMznY53d.js";import"./index-DT392Y-e.js";import"./use-mobile-DjLsite2.js";import"./Save01-BbS0C0s1.js";import"./ChevronDown-xG1flmUs.js";import"./mcp-oauth-B9YTiwC5.js";import"./File06-DiS1m4o9.js";import"./Key01-CXgWd4vy.js";import"./constants-CsU2_t5q.js";import"./registry-utils-CyMutbQd.js";import"./extract-connection-data-D0wplOp-.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-Ce99gIbp.js";import"./circle-alert-Bm720OZV.js";import"./index-2W7jwMtr.js";import"./useQuery-DGMDf2So.js";import"./ArrowUp-C9QbeSMz.js";import"./Grid01-D2I-nDSy.js";import"./List-DGxlSM0E.js";import"./table-8mfsydT_.js";import"./popover-eropQyy1.js";import"./skeleton-DvxloPhR.js";import"./localstorage-keys-CiUgmUPA.js";import"./use-mcp-prompts-BFC1Reld.js";import"./usage-B8eRkRZY.js";import"./Edit01-Bc5S6NRh.js";import"./Users03-CgNWgARv.js";import"./XCircle-I5P8gQFi.js";import"./ArrowLeft-TcoC4WAS.js";import"./use-copy-8HhO39al.js";import"./use-create-virtual-mcp-DwsRmfVV.js";import"./deco-constants-0EY--BSu.js";import"./marked.esm-BaswSlok.js";import"./markdown-U-heFZhR.js";import"./tools-list-4-0RjQZk.js";import"./card-CPMQS2Ob.js";import"./Eye-C8kM8O8_.js";import"./Globe02-CT2c-Sr-.js";import"./RefreshCw01-k0GFakzy.js";import"./Trash01-Ve8IhEa-.js";import"./binder-DYyCY7OY.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-DUUdSPtc.js";import"./Image01-DNFNbFFa.js";import"./RefreshCcw01-BpGtyqTA.js";import"./Settings01-DB_FXn41.js";import"./useSuspenseInfiniteQuery-DX7McnGC.js";import"./infiniteQueryObserver-D6Tb66x3.js";const es=te("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const ts=te("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ln=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const cn=te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const ur=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const fr=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const mr=te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ns=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ss=te("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const os=te("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const pr=te("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const rs=te("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const is=te("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));ls.displayName="Box";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));cs.displayName="ClockFastForward";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));as.displayName="Code02";const Ze=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Ze.displayName="Columns01";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));ds.displayName="CornerDownRight";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));us.displayName="Database01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));fs.displayName="GitBranch01";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));ms.displayName="Repeat03";Zs({title:It().min(1),description:It().nullable(),body:It()});function Et(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function xr(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function hr(t){const e=C.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(_t,{control:n.control,name:"title",render:jr}),o.jsx(_t,{control:n.control,name:"description",render:br})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(_t,{control:n.control,name:"body",render:gr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function gr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(Mt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function br(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function jr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function vr(t){const e=C.c(41),{providerId:n,promptId:s}=t,r=Wt().location.href,{org:l}=G(),c=n||null;let a;e[0]!==l.id||e[1]!==c?(a={connectionId:c,orgId:l.id},e[0]=l.id,e[1]=c,e[2]=a):a=e[2];const d=ne(a),u=Ut(n,"PROMPT",s,d),f=Bt(n,"PROMPT",d),m=f.update.isPending;let h;e[3]!==u?(h=u?{title:u.title,description:u.description??null,body:Et(u)}:void 0,e[3]=u,e[4]=h):h=e[4];let p;e[5]!==h?(p={values:h},e[5]=h,e[6]=p):p=e[6];const x=Ys(p);let g;e[7]!==x||e[8]!==u?(g=()=>{u&&x.reset({title:u.title,description:u.description??null,body:Et(u)})},e[7]=x,e[8]=u,e[9]=g):g=e[9];const b=g;let j;e[10]!==f.update||e[11]!==x||e[12]!==s?(j=x.handleSubmit(async I=>{const A=await f.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:A.title,description:A.description??null,body:Et(A)})}),e[10]=f.update,e[11]=x,e[12]=s,e[13]=j):j=e[13];const S=j;if(!u){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let y;e[15]!==u.title?(y=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[15]=u.title,e[16]=y):y=e[16];let v;e[17]!==u.description?(v=u.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[17]=u.description,e[18]=v):v=e[18];let w;e[19]!==y||e[20]!==v?(w=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,v]})}),e[19]=y,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==S?(N=()=>{S()},e[22]=S,e[23]=N):N=e[23];let E;e[24]!==x.formState.isDirty||e[25]!==m||e[26]!==b||e[27]!==N?(E=o.jsx(Fn,{onSave:N,onUndo:b,isDirty:x.formState.isDirty,isSaving:m}),e[24]=x.formState.isDirty,e[25]=m,e[26]=b,e[27]=N,e[28]=E):E=e[28];let T;e[29]!==u.title||e[30]!==r?(T=o.jsx(qt,{title:u.title,url:r,icon:"description"}),e[29]=u.title,e[30]=r,e[31]=T):T=e[31];let $;e[32]!==E||e[33]!==T?($=o.jsxs(Xt,{children:[E,T]}),e[32]=E,e[33]=T,e[34]=$):$=e[34];let R;e[35]!==x?(R=o.jsx("div",{className:"h-full",children:o.jsx(hr,{form:x})}),e[35]=x,e[36]=R):R=e[36];let L;return e[37]!==$||e[38]!==R||e[39]!==w?(L=o.jsxs(he,{children:[w,$,R]}),e[37]=$,e[38]=R,e[39]=w,e[40]=L):L=e[40],L}function Sr(t){const e=C.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=xr(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(vr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const yr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function wr(t){const e=C.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=M(yr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function Nr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Cr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const yn=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function kr(t){const e=C.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Co(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ko,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx(Ir,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function Ir({toolName:t,connectionId:e}){const s=Wt().location.href,{replayId:i}=to({strict:!1}),r=(()=>{if(!i)return null;const _=`replay-${i}`,O=sessionStorage.getItem(_);if(!O)return null;sessionStorage.removeItem(_);try{return JSON.parse(O)}catch{return null}})(),l=(()=>{if(!r)return null;const _={};for(const[O,P]of Object.entries(r))P!==null&&typeof P=="object"?_[O]=JSON.stringify(P,null,2):_[O]=P;return _})(),[c,a]=k.useState(l??{}),[d,u]=k.useState(r?JSON.stringify(r,null,2):"{}"),[f,m]=k.useState(null),[h,p]=k.useState(null),[x,g]=k.useState(!1),[b,j]=k.useState(null),{org:S}=G(),y=ct(e),v=ne({connectionId:e,orgId:S.id}),w=nn({client:v}),N=w.data?.tools?.find(_=>_.name===t),E=N?.inputSchema?.properties,T=E?Object.keys(E):[],$=T.length>0,R={};if($&&N?.inputSchema?.properties)for(const _ of T)R[_]=N.inputSchema.required?.includes(_)?"":void 0;const L=_=>Object.prototype.hasOwnProperty.call(c,_),I=async()=>{g(!0),p(null),m(null),j(null);const _=performance.now();try{if(!v)throw new Error("MCP client is not available");const O=$?{...R,...c}:(()=>{const H=d.trim();if(!H)return{};const J=JSON.parse(H);if(J&&typeof J=="object")return J;throw new Error("Raw JSON input must be an object.")})();$&&N?.inputSchema?.properties&&Object.entries(N.inputSchema.properties).forEach(([H,J])=>{if((J.type==="object"||J.type==="array")&&typeof O[H]=="string")try{O[H]=JSON.parse(O[H])}catch{}});const P=await v.callTool({name:t,arguments:O}),Q=P.structuredContent??P,Z=performance.now(),F=Math.round(Z-_);m(Q);const K=JSON.stringify(Q),B=new TextEncoder().encode(K).length;j({duration:`${F}ms`,bytes:`${B} bytes`,tokens:`~${Math.ceil(B/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);p(P||"Unknown error occurred");const Q=performance.now();j({duration:`${Math.round(Q-_)}ms`})}finally{g(!1)}},A=(_,O)=>{a(P=>({...P,[_]:O}))},W=()=>{m(null),p(null),j(null)},z=N?.name??yn(t),X=o.jsx(Kn,{children:o.jsxs(Jn,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps",params:{org:S.slug,project:tt},children:"Connections"})})}),o.jsx(ot,{}),y&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps/$connectionId",params:{org:S.slug,project:tt,connectionId:e},search:{tab:"tools"},children:y.title})})}),o.jsx(ot,{})]}),o.jsx(Pe,{children:o.jsx(Gn,{children:z})})]})});return o.jsxs(he,{breadcrumb:X,children:[o.jsx(Xt,{children:o.jsx(qt,{title:N?.name??yn(t),url:s,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(dt,{icon:y?.icon||null,name:y?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.isLoading?o.jsx(Ue,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.isSuccess?"ready":w.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:N?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),N?.inputSchema?.required&&N.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:$&&N?.inputSchema?.properties?Object.entries(N.inputSchema.properties).map(([_,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,N.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(Mt,{className:"font-mono text-xs",value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:L(_)?String(c[_]??""):"",onValueChange:P=>A(_,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(nt,{value:"true",children:"true"}),o.jsx(nt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_}...`})]},_)):N?.inputSchema&&!$?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Mt,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:_=>u(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),b&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(yo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ls,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(us,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(Y,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:I,disabled:x,children:x?o.jsxs(o.Fragment,{children:[o.jsx(Ue,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(tn,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(Qt,{children:o.jsxs(Zt,{children:[o.jsx(Yt,{asChild:!0,children:o.jsx(Y,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:W,disabled:!f&&!h,children:o.jsx(at,{size:14})})}),o.jsx(en,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(wr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(So,{className:"h-4 w-4"}),o.jsx(Nr,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Cr,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(Y,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(f,null,2)),On.success("Copied to clipboard")},children:o.jsx(No,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(wo,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function _r(t){const e=C.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!ct(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ue,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(kr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const wn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(h=>h(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},an=(t=>t?wn(t):wn),Er=t=>t;function Pt(t,e=Er){const n=q.useSyncExternalStore(t.subscribe,q.useCallback(()=>e(t.getState()),[t,e]),q.useCallback(()=>e(t.getInitialState()),[t,e]));return q.useDebugValue(n),n}const Tr=t=>{const e=an(t),n=s=>Pt(e,s);return Object.assign(n,e),n},$r=(t=>Tr);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Lt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Lt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Lt(s)(n)}}}},Or=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const h=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>h;let p;const x=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:h)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:h))||void 0;return Lt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,N]=y;if(p=r.merge(N,(v=s())!=null?v:h),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>x(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||x(),p||h},xs=Or,{useSyncExternalStoreWithSelector:Rr}=no,Ar=t=>t;function Mr(t,e=Ar,n){const s=Rr(t.subscribe,t.getState,t.getInitialState,e,n);return q.useDebugValue(s),s}const Nn=t=>Symbol.iterator in t,Cn=t=>"entries"in t,kn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Pr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Lr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Nn(t)&&Nn(e)?Cn(t)&&Cn(e)?kn(t,e):Pr(t,e):kn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Dr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
1
|
+
import{b4 as te,r as k,o as Zs,s as It,c as C,j as o,by as Wt,u as G,l as Ys,y as eo,e as pe,a as to,aE as et,O as tt,t as On,bm as q,bQ as no,bR as so,aH as oo,ar as Ft,au as de,aw as Rn,aI as ro,ap as Ht,aG as io,aJ as An,as as Mn,aP as lo,aQ as co,ax as Pn,aR as ao,bS as Vt,bT as uo,al as fo,bo as mo,ao as po,m as xo,bU as ho,bV as go,bW as Ln}from"./index-DwBgLSti.js";import{E as Dn}from"./empty-state-sMx3NP6e.js";import{E as zn}from"./error-boundary-lFjWy2-n.js";import{d as Ut,u as Bt,f as ct,h as bo}from"./use-connection-BEGrPCmR.js";import{u as ne,g as Be,i as jo}from"./constants-8URKDp4Y.js";import{P as qt}from"./index-DnrfuViL.js";import{F as _t,a as vo,b as Kt,d as Jt}from"./form-BMtUcs2k.js";import{I as Gt}from"./input-B7id4I1j.js";import{T as Mt}from"./textarea-GWXLFYfv.js";import{b as Wn,V as Xt,a as he}from"./layout-Ck3H2-cu.js";import{S as Fn}from"./save-actions-BPg_8VMI.js";import{c as M,B as Y}from"./button-D6YZfFzy.js";import{S as Hn,a as Vn,b as Un,c as Bn,d as nt}from"./select-CkeKfTEx.js";import{c as Qt,T as Zt,a as Yt,b as en,i as qn}from"./tooltip-D71dCz4E.js";import{i as So}from"./AlertCircle-BzYW4X7z.js";import{s as yo}from"./Clock-IA7N95Qq.js";import{i as wo}from"./Code01-DP2jwP0n.js";import{a as No}from"./Copy01-Dq7Edhtu.js";import{i as Ue}from"./Loading01-BHMOj-H5.js";import{i as tn}from"./Play-APj1Lxit.js";import{s as at}from"./XClose-Dgr_gyyv.js";import{B as Kn,a as Jn,b as Pe,d as st,e as ot,c as Gn}from"./breadcrumb-DeYbtjMk.js";import{u as Co,O as ko,M as Io,F as _o,v as Eo}from"./index-CCjxSJ1y.js";import{d as nn,b as sn,a as on}from"./use-mcp-tools-BAsmCzEJ.js";import{I as dt}from"./integration-icon-qV_BsBQR.js";import{M as Le,n as To,S as $o,a as Oo}from"./scroll-area-CcejXaMp.js";import{E as rn}from"./empty-state-BA6UkF4p.js";import{n as Ro}from"./Container-jfv9L6Hc.js";import{b as Xn}from"./use-virtual-mcp-DBzFAk7J.js";import{b as Ao,a as jn,R as Mo}from"./resizable-jXkpfiVS.js";import{B as me}from"./badge-Do8iK9u9.js";import{S as ut}from"./spinner-DZtD-MX0.js";import{V as Po}from"./view-mode-toggle-2-qyK3LU.js";import{N as Lo,S as Do,a as zo,c as Wo,m as Qe,P as Fo,i as Ho,R as Vo,u as Uo,b as Bo,d as vn,E as qo,e as Ko}from"./index-QQ-XmLlG.js";import{a as Jo}from"./use-binding-DbH4Xe03.js";import{b as Go,c as Xo,d as Qo,e as Zo,a as Yo,D as er}from"./dialog-DSPMVHyJ.js";import"./index-DJ_LDW-E.js";import{s as Qn}from"./Plus-DNqvDLOK.js";import{c as Zn}from"./AlertOctagon-CUysWl_m.js";import{i as ft}from"./Check-Bv0pZ3gl.js";import{i as tr}from"./DotsHorizontal-CQ-MbYsC.js";import{a as nr,h as sr,R as or,j as rr,k as Yn}from"./use-deco-chat-open-CxG3qwlT.js";import{D as ir,a as lr,b as cr,c as Sn}from"./dropdown-menu-CRT7qGQ9.js";import{i as ar}from"./ChevronRight-DgAfR8pA.js";import{c as dr}from"./context-DHicyHl4.js";import"./AlertTriangle-DniGvpwb.js";import"./useMutation-DgG1LVg-.js";import"./Pin01-8MTlfWD2.js";import"./use-organization-settings-BJ9tNAL9.js";import"./label-29qY4FPs.js";import"./index-B_nMIrSY.js";import"./use-mobile-Bs0AkxK7.js";import"./Save01-D-T2SbCx.js";import"./ChevronDown-CggIFEVQ.js";import"./mcp-oauth-Bb9gvF4o.js";import"./File06-2US99J_V.js";import"./Key01-CfL5jY3W.js";import"./constants-oXq_cTdm.js";import"./registry-utils-DMdc5PTp.js";import"./extract-connection-data-B39uuFqG.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-CSDJ0ZgD.js";import"./circle-alert-YjViK8VE.js";import"./index-DmoBx0VC.js";import"./useQuery-CPsXfVfR.js";import"./popover-pjzQQlLd.js";import"./skeleton-DNLZ4Kho.js";import"./localstorage-keys-Ct4C992S.js";import"./use-mcp-prompts-qD8uHlkj.js";import"./usage-B8eRkRZY.js";import"./ArrowUp-G8RCE5_O.js";import"./Edit01-DRruZKzG.js";import"./Users03-C1B58zTV.js";import"./XCircle-DneNZUk0.js";import"./ArrowLeft-dS1h2Fqu.js";import"./use-copy-DsHlaDHD.js";import"./SearchMd-BLcaRHQs.js";import"./use-create-virtual-mcp-BzTARjrD.js";import"./deco-constants-CyaJG-D1.js";import"./marked.esm-BaswSlok.js";import"./markdown-jp5pFlBz.js";import"./Eye-B9ZDOUkE.js";import"./Globe02-BPmEw10H.js";import"./Trash01-CkTOgej8.js";import"./binder-BBB8LQyx.js";import"./decopilot-events-Brt4gAR6.js";import"./use-llm-BbYG_RIr.js";import"./Grid01-CJW4ZLO5.js";import"./Image01-C9h8llDV.js";import"./RefreshCcw01-4dzpBOob.js";import"./Settings01-DKXbh8uh.js";import"./useSuspenseInfiniteQuery-CuH1Eku2.js";import"./infiniteQueryObserver-Yvt0ZTml.js";const es=te("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const ts=te("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const ln=te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const cn=te("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const ur=te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const fr=te("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const mr=te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const ns=te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const ss=te("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const os=te("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);const pr=te("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);const rs=te("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const is=te("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]),ls=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M20.5 8v8.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.22 21 17.38 21 15.7 21H8.3c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3.5 18.72 3.5 17.88 3.5 16.2V8m.1-5h16.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C22 3.76 22 4.04 22 4.6v1.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437C21.24 8 20.96 8 20.4 8H3.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C2 7.24 2 6.96 2 6.4V4.6c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C2.76 3 3.04 3 3.6 3Zm6 8.5h4.8c.56 0 .84 0 1.054.109a1 1 0 0 1 .437.437C16 12.26 16 12.54 16 13.1v.8c0 .56 0 .84-.109 1.054a1 1 0 0 1-.437.437c-.214.109-.494.109-1.054.109H9.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C8 14.74 8 14.46 8 13.9v-.8c0-.56 0-.84.109-1.054a1 1 0 0 1 .437-.437C8.76 11.5 9.04 11.5 9.6 11.5Z"}));ls.displayName="Box";const cs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));cs.displayName="ClockFastForward";const as=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));as.displayName="Code02";const Ze=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M6.8 3h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C3 4.52 3 5.08 3 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C4.52 21 5.08 21 6.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C10 19.48 10 18.92 10 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C8.48 3 7.92 3 6.8 3Zm11 0h-.6c-1.12 0-1.68 0-2.108.218a2 2 0 0 0-.874.874C14 4.52 14 5.08 14 6.2v11.6c0 1.12 0 1.68.218 2.108a2 2 0 0 0 .874.874C15.52 21 16.08 21 17.2 21h.6c1.12 0 1.68 0 2.108-.218a2 2 0 0 0 .874-.874C21 19.48 21 18.92 21 17.8V6.2c0-1.12 0-1.68-.218-2.108a2 2 0 0 0-.874-.874C19.48 3 18.92 3 17.8 3Z"}));Ze.displayName="Columns01";const ds=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M4 4v1.4c0 3.36 0 5.04.654 6.324a6 6 0 0 0 2.622 2.622C8.56 15 10.24 15 13.6 15H20m0 0-5-5m5 5-5 5"}));ds.displayName="CornerDownRight";const us=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M21 5c0 1.657-4.03 3-9 3S3 6.657 3 5m18 0c0-1.657-4.03-3-9-3S3 3.343 3 5m18 0v14c0 1.66-4 3-9 3s-9-1.34-9-3V5m18 7c0 1.66-4 3-9 3s-9-1.34-9-3"}));us.displayName="Database01";const fs=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"M3 3v10.2c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311C5.28 18 6.12 18 7.8 18H15m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0ZM3 8h12m0 0a3 3 0 1 0 6 0 3 3 0 0 0-6 0Z"}));fs.displayName="GitBranch01";const ms=({size:t=24,color:e="currentColor",...n})=>k.createElement("svg",{viewBox:"0 0 24 24",width:t,height:t,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...n},k.createElement("path",{d:"m13 22-3-3m0 0 3-3m-3 3h5a7 7 0 0 0 3-13.326M6 18.326A7 7 0 0 1 9 5h5m0 0-3-3m3 3-3 3"}));ms.displayName="Repeat03";Zs({title:It().min(1),description:It().nullable(),body:It()});function Et(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function xr(){const t=window.location.pathname.split("/").filter(Boolean),e=t.findIndex(s=>s==="mcps"),n=e>=0?t[e+1]:void 0;return n?decodeURIComponent(n):void 0}function hr(t){const e=C.c(13),{form:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Details"}),e[0]=s):s=e[0];let i;e[1]!==n.control?(i=o.jsxs("div",{className:"flex flex-col gap-4",children:[s,o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[o.jsx(_t,{control:n.control,name:"title",render:jr}),o.jsx(_t,{control:n.control,name:"description",render:br})]})]}),e[1]=n.control,e[2]=i):i=e[2];let r,l;e[3]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"text-sm font-medium text-foreground",children:"Message"}),l=o.jsx("div",{className:"text-xs text-muted-foreground",children:"This becomes the user message in the prompt."}),e[3]=r,e[4]=l):(r=e[3],l=e[4]);let c;e[5]!==n.control?(c=o.jsxs("div",{className:"flex flex-col gap-2",children:[r,l,o.jsx(_t,{control:n.control,name:"body",render:gr})]}),e[5]=n.control,e[6]=c):c=e[6];let a;e[7]!==i||e[8]!==c?(a=o.jsxs("div",{className:"h-full py-6 flex flex-col max-w-3xl mx-auto w-full min-w-0 gap-8 overflow-y-auto px-4",children:[i,c]}),e[7]=i,e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(vo,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function gr(t){const{field:e}=t;return o.jsx(Kt,{children:o.jsx(Jt,{children:o.jsx(Mt,{...e,value:e.value??"",placeholder:"Write the prompt message…",className:"min-h-[240px] resize-none text-base leading-relaxed font-normal rounded-xl border border-border bg-muted/20 px-4 py-3 shadow-none focus-visible:ring-0"})})})}function br(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,value:e.value??"",placeholder:"Add a description…",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function jr(t){const{field:e}=t;return o.jsxs(Kt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(Jt,{children:o.jsx(Gt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function vr(t){const e=C.c(41),{providerId:n,promptId:s}=t,r=Wt().location.href,{org:l}=G(),c=n||null;let a;e[0]!==l.id||e[1]!==c?(a={connectionId:c,orgId:l.id},e[0]=l.id,e[1]=c,e[2]=a):a=e[2];const d=ne(a),u=Ut(n,"PROMPT",s,d),f=Bt(n,"PROMPT",d),m=f.update.isPending;let h;e[3]!==u?(h=u?{title:u.title,description:u.description??null,body:Et(u)}:void 0,e[3]=u,e[4]=h):h=e[4];let p;e[5]!==h?(p={values:h},e[5]=h,e[6]=p):p=e[6];const x=Ys(p);let g;e[7]!==x||e[8]!==u?(g=()=>{u&&x.reset({title:u.title,description:u.description??null,body:Et(u)})},e[7]=x,e[8]=u,e[9]=g):g=e[9];const b=g;let j;e[10]!==f.update||e[11]!==x||e[12]!==s?(j=x.handleSubmit(async I=>{const A=await f.update.mutateAsync({id:s,data:{title:I.title,description:I.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:I.body}}]}});x.reset({title:A.title,description:A.description??null,body:Et(A)})}),e[10]=f.update,e[11]=x,e[12]=s,e[13]=j):j=e[13];const S=j;if(!u){let I;return e[14]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=I):I=e[14],I}let y;e[15]!==u.title?(y=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:u.title}),e[15]=u.title,e[16]=y):y=e[16];let v;e[17]!==u.description?(v=u.description?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:u.description})]}):null,e[17]=u.description,e[18]=v):v=e[18];let w;e[19]!==y||e[20]!==v?(w=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y,v]})}),e[19]=y,e[20]=v,e[21]=w):w=e[21];let N;e[22]!==S?(N=()=>{S()},e[22]=S,e[23]=N):N=e[23];let E;e[24]!==x.formState.isDirty||e[25]!==m||e[26]!==b||e[27]!==N?(E=o.jsx(Fn,{onSave:N,onUndo:b,isDirty:x.formState.isDirty,isSaving:m}),e[24]=x.formState.isDirty,e[25]=m,e[26]=b,e[27]=N,e[28]=E):E=e[28];let T;e[29]!==u.title||e[30]!==r?(T=o.jsx(qt,{title:u.title,url:r,icon:"description"}),e[29]=u.title,e[30]=r,e[31]=T):T=e[31];let $;e[32]!==E||e[33]!==T?($=o.jsxs(Xt,{children:[E,T]}),e[32]=E,e[33]=T,e[34]=$):$=e[34];let R;e[35]!==x?(R=o.jsx("div",{className:"h-full",children:o.jsx(hr,{form:x})}),e[35]=x,e[36]=R):R=e[36];let L;return e[37]!==$||e[38]!==R||e[39]!==w?(L=o.jsxs(he,{children:[w,$,R]}),e[37]=$,e[38]=R,e[39]=w,e[40]=L):L=e[40],L}function Sr(t){const e=C.c(4),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=xr(),e[0]=s):s=e[0];const i=s;if(!i){let l;return e[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Dn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=l):l=e[1],l}let r;return e[2]!==n?(r=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:null,children:o.jsx(vr,{providerId:i,promptId:n})})}),e[2]=n,e[3]=r):r=e[3],r}const yr=eo("relative w-full rounded-lg border px-4 py-3 text-sm flex items-start gap-3 [&>svg]:size-4 [&>svg]:flex-shrink-0 [&>svg]:mt-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-destructive/5 text-destructive border-destructive/25 [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90",warning:"bg-warning/10 text-warning-foreground border-warning [&>svg]:text-current *:data-[slot=alert-description]:text-warning-foreground/90",success:"bg-success/10 text-success-foreground border-success [&>svg]:text-current *:data-[slot=alert-description]:text-success-foreground/90",info:"bg-card text-card-foreground border-border [&>svg]:text-current *:data-[slot=alert-description]:text-muted-foreground/90"}},defaultVariants:{variant:"default"}});function wr(t){const e=C.c(10);let n,s,i;e[0]!==t?({className:n,variant:i,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==n||e[5]!==i?(r=M(yr({variant:i}),n),e[4]=n,e[5]=i,e[6]=r):r=e[6];let l;return e[7]!==s||e[8]!==r?(l=o.jsx("div",{"data-slot":"alert",role:"alert",className:r,...s}),e[7]=s,e[8]=r,e[9]=l):l=e[9],l}function Nr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("line-clamp-1 min-h-4 font-medium tracking-tight",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-title",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Cr(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("text-muted-foreground leading-relaxed",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx("div",{"data-slot":"alert-description",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}const yn=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function kr(t){const e=C.c(9),{toolName:n,connectionId:s,onBack:i}=t;let r;e[0]!==s?(r={connectionId:s},e[0]=s,e[1]=r):r=e[1];const l=Co(r);if(!l.isAuthenticated){let d;return e[2]!==l.supportsOAuth||e[3]!==i?(d=o.jsx("div",{className:"flex h-full items-center justify-center",children:l.supportsOAuth?o.jsx(ko,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Io,{hasReadme:!1})}),e[2]=l.supportsOAuth,e[3]=i,e[4]=d):d=e[4],d}const c=`${s}:${n}`;let a;return e[5]!==s||e[6]!==c||e[7]!==n?(a=o.jsx(Ir,{toolName:n,connectionId:s},c),e[5]=s,e[6]=c,e[7]=n,e[8]=a):a=e[8],a}function Ir({toolName:t,connectionId:e}){const s=Wt().location.href,{replayId:i}=to({strict:!1}),r=(()=>{if(!i)return null;const _=`replay-${i}`,O=sessionStorage.getItem(_);if(!O)return null;sessionStorage.removeItem(_);try{return JSON.parse(O)}catch{return null}})(),l=(()=>{if(!r)return null;const _={};for(const[O,P]of Object.entries(r))P!==null&&typeof P=="object"?_[O]=JSON.stringify(P,null,2):_[O]=P;return _})(),[c,a]=k.useState(l??{}),[d,u]=k.useState(r?JSON.stringify(r,null,2):"{}"),[f,m]=k.useState(null),[h,p]=k.useState(null),[x,g]=k.useState(!1),[b,j]=k.useState(null),{org:S}=G(),y=ct(e),v=ne({connectionId:e,orgId:S.id}),w=nn({client:v}),N=w.data?.tools?.find(_=>_.name===t),E=N?.inputSchema?.properties,T=E?Object.keys(E):[],$=T.length>0,R={};if($&&N?.inputSchema?.properties)for(const _ of T)R[_]=N.inputSchema.required?.includes(_)?"":void 0;const L=_=>Object.prototype.hasOwnProperty.call(c,_),I=async()=>{g(!0),p(null),m(null),j(null);const _=performance.now();try{if(!v)throw new Error("MCP client is not available");const O=$?{...R,...c}:(()=>{const H=d.trim();if(!H)return{};const J=JSON.parse(H);if(J&&typeof J=="object")return J;throw new Error("Raw JSON input must be an object.")})();$&&N?.inputSchema?.properties&&Object.entries(N.inputSchema.properties).forEach(([H,J])=>{if((J.type==="object"||J.type==="array")&&typeof O[H]=="string")try{O[H]=JSON.parse(O[H])}catch{}});const P=await v.callTool({name:t,arguments:O}),Q=P.structuredContent??P,Z=performance.now(),F=Math.round(Z-_);m(Q);const K=JSON.stringify(Q),B=new TextEncoder().encode(K).length;j({duration:`${F}ms`,bytes:`${B} bytes`,tokens:`~${Math.ceil(B/4)} tokens`,cost:"$0.0000"})}catch(O){const P=O instanceof Error?O.message:String(O);p(P||"Unknown error occurred");const Q=performance.now();j({duration:`${Math.round(Q-_)}ms`})}finally{g(!1)}},A=(_,O)=>{a(P=>({...P,[_]:O}))},W=()=>{m(null),p(null),j(null)},z=N?.name??yn(t),X=o.jsx(Kn,{children:o.jsxs(Jn,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps",params:{org:S.slug,project:tt},children:"Connections"})})}),o.jsx(ot,{}),y&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps/$connectionId",params:{org:S.slug,project:tt,connectionId:e},search:{tab:"tools"},children:y.title})})}),o.jsx(ot,{})]}),o.jsx(Pe,{children:o.jsx(Gn,{children:z})})]})});return o.jsxs(he,{breadcrumb:X,children:[o.jsx(Xt,{children:o.jsx(qt,{title:N?.name??yn(t),url:s,icon:"build"})}),o.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 h-full",children:[o.jsx("div",{className:"flex flex-col border-r border-border overflow-hidden",children:o.jsxs("div",{className:"flex-1 overflow-auto",children:[o.jsx("div",{className:"flex flex-col gap-4 p-6 border-b border-border min-h-28",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(dt,{icon:y?.icon||null,name:y?.title||t,size:"sm",className:"shadow-sm shrink-0"}),o.jsx("h1",{className:"text-lg font-medium text-foreground leading-none",children:t}),o.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1 bg-muted/50 rounded-md h-fit",children:[w.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):w.isLoading?o.jsx(Ue,{size:10,className:"animate-spin text-yellow-500 shrink-0"}):o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-red-500 shrink-0"}),o.jsx("span",{className:"font-mono text-xs capitalize text-muted-foreground leading-none",children:w.isSuccess?"ready":w.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:N?.description||"No description available"})]})}),o.jsxs("div",{className:"flex flex-col p-6 gap-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h2",{className:"text-sm font-semibold text-foreground uppercase tracking-wide",children:"Parameters"}),N?.inputSchema?.required&&N.inputSchema.required.length>0&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:[o.jsx("span",{className:"text-red-500",children:"*"})," Required"]})]}),o.jsx("div",{className:"space-y-4",children:$&&N?.inputSchema?.properties?Object.entries(N.inputSchema.properties).map(([_,O])=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("label",{className:"text-sm font-medium leading-none flex items-center gap-1.5",children:[_,N.inputSchema?.required?.includes(_)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:O.type})]}),O.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:O.description}),O.type==="object"||O.type==="array"?o.jsx(Mt,{className:"font-mono text-xs",value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):O.type==="boolean"?o.jsxs(Hn,{value:L(_)?String(c[_]??""):"",onValueChange:P=>A(_,P==="true"),children:[o.jsx(Vn,{children:o.jsx(Un,{placeholder:"Select true or false..."})}),o.jsxs(Bn,{children:[o.jsx(nt,{value:"true",children:"true"}),o.jsx(nt,{value:"false",children:"false"})]})]}):o.jsx(Gt,{value:L(_)?c[_]??"":R[_]??"",onChange:P=>A(_,P.target.value),placeholder:`Enter ${_}...`})]},_)):N?.inputSchema&&!$?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(Mt,{className:"font-mono text-xs min-h-[120px]",value:d,onChange:_=>u(_.target.value),placeholder:'e.g. { "foo": "bar" }'})]}):o.jsx("div",{className:"flex items-center justify-center p-8 bg-muted/30 rounded-lg border border-dashed border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"No parameters required"})})})]})]})}),o.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 h-14 border-t lg:border-t-0 border-b border-border bg-background",children:[o.jsx("h2",{className:"text-sm font-medium text-foreground uppercase tracking-wide",children:"Result"}),b&&o.jsxs("div",{className:"flex items-center gap-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(yo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.duration})]}),b.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(ls,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.tokens})]}),b.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(us,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:b.bytes})]}),b.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:b.cost})})]})]}),o.jsx("div",{className:"flex items-center justify-end lg:justify-between px-4 h-14 border-b border-border bg-background",children:o.jsxs("div",{className:"flex items-center gap-2 w-full lg:w-auto",children:[o.jsx(Y,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:I,disabled:x,children:x?o.jsxs(o.Fragment,{children:[o.jsx(Ue,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(tn,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(Qt,{children:o.jsxs(Zt,{children:[o.jsx(Yt,{asChild:!0,children:o.jsx(Y,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:W,disabled:!f&&!h,children:o.jsx(at,{size:14})})}),o.jsx(en,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),h&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(wr,{variant:"destructive",children:o.jsxs("div",{className:"flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(So,{className:"h-4 w-4"}),o.jsx(Nr,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Cr,{className:"text-xs text-destructive",children:h})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:f?o.jsxs(o.Fragment,{children:[o.jsx(Le,{code:JSON.stringify(f,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(Y,{size:"icon",variant:"ghost",className:"absolute top-4 right-4 h-8 w-8 bg-background/80 hover:bg-background border border-border shadow-sm",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(f,null,2)),On.success("Copied to clipboard")},children:o.jsx(No,{className:"h-3.5 w-3.5"})})]}):o.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-muted-foreground",children:[o.jsx(wo,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function _r(t){const e=C.c(7),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const l=pe(i).connectionId;if(!ct(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ue,{size:32,className:"animate-spin text-muted-foreground"})}),e[2]=a):a=e[2];let d;return e[3]!==l||e[4]!==s||e[5]!==n?(d=o.jsx(k.Suspense,{fallback:a,children:o.jsx(kr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const wn=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(h=>h(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},an=(t=>t?wn(t):wn),Er=t=>t;function Pt(t,e=Er){const n=q.useSyncExternalStore(t.subscribe,q.useCallback(()=>e(t.getState()),[t,e]),q.useCallback(()=>e(t.getInitialState()),[t,e]));return q.useDebugValue(n),n}const Tr=t=>{const e=an(t),n=s=>Pt(e,s);return Object.assign(n,e),n},$r=(t=>Tr);function ps(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const Lt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Lt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Lt(s)(n)}}}},Or=(t,e)=>(n,s,i)=>{let r={storage:ps(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,b)=>({...b,...g}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...g)},s,i);const f=()=>{const g=r.partialize({...s()});return u.setItem(r.name,{state:g,version:r.version})},m=i.setState;i.setState=(g,b)=>(m(g,b),f());const h=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>h;let p;const x=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(y=>{var v;return y((v=s())!=null?v:h)});const S=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:h))||void 0;return Lt(u.getItem.bind(u))(r.name).then(y=>{if(y)if(typeof y.version=="number"&&y.version!==r.version){if(r.migrate){const v=r.migrate(y.state,y.version);return v instanceof Promise?v.then(w=>[!0,w]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,y.state];return[!1,void 0]}).then(y=>{var v;if(j!==c)return;const[w,N]=y;if(p=r.merge(N,(v=s())!=null?v:h),n(p,!0),w)return f()}).then(()=>{j===c&&(S?.(p,void 0),p=s(),l=!0,d.forEach(y=>y(p)))}).catch(y=>{j===c&&S?.(void 0,y)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>x(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||x(),p||h},xs=Or,{useSyncExternalStoreWithSelector:Rr}=no,Ar=t=>t;function Mr(t,e=Ar,n){const s=Rr(t.subscribe,t.getState,t.getInitialState,e,n);return q.useDebugValue(s),s}const Nn=t=>Symbol.iterator in t,Cn=t=>"entries"in t,kn=(t,e)=>{const n=t instanceof Map?t:new Map(t.entries()),s=e instanceof Map?e:new Map(e.entries());if(n.size!==s.size)return!1;for(const[i,r]of n)if(!s.has(i)||!Object.is(r,s.get(i)))return!1;return!0},Pr=(t,e)=>{const n=t[Symbol.iterator](),s=e[Symbol.iterator]();let i=n.next(),r=s.next();for(;!i.done&&!r.done;){if(!Object.is(i.value,r.value))return!1;i=n.next(),r=s.next()}return!!i.done&&!!r.done};function Lr(t,e){return Object.is(t,e)?!0:typeof t!="object"||t===null||typeof e!="object"||e===null||Object.getPrototypeOf(t)!==Object.getPrototypeOf(e)?!1:Nn(t)&&Nn(e)?Cn(t)&&Cn(e)?kn(t,e):Pr(t,e):kn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Dr(t,e="Output"){if(!t)return`interface ${e} {}`;function n(r){if(!r||typeof r!="object")return"unknown";const l=r.type;if(Array.isArray(l))return l.map(c=>s(c)).join(" | ");switch(l){case"string":return r.enum?r.enum.map(c=>`"${c}"`).join(" | "):"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";case"array":{const c=r.items;return c?`${n(c)}[]`:"unknown[]"}case"object":return i(r);default:return r.anyOf?r.anyOf.map(n).join(" | "):r.oneOf?r.oneOf.map(n).join(" | "):r.allOf?r.allOf.map(n).join(" & "):"unknown"}}function s(r){switch(r){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"null":return"null";default:return"unknown"}}function i(r){const l=r.properties;if(!l)return"Record<string, unknown>";const c=new Set(r.required||[]);return`{
|
|
2
2
|
${Object.entries(l).map(([d,u])=>{const f=c.has(d)?"":"?";return`${u.description?` /** ${u.description} */
|
|
3
3
|
`:""} ${d}${f}: ${n(u)};`}).join(`
|
|
4
4
|
`)}
|
|
5
5
|
}`}return`interface ${e} ${n(t)}`}function Tt(t,e){const n=t.trim();return e.some(i=>i.name.toLowerCase()===n.toLowerCase())?`${n}_${Math.random().toString(36).substring(2,6)}`:n}function zr(t,e){const n=t.match(/interface\s+Input\s*\{/);if(!n||n.index===void 0)return`${e}
|
|
6
6
|
|
|
7
|
-
${t.trimStart()}`;const s=n.index,i=s+n[0].length-1;let r=1,l=i+1;for(;l<t.length&&r>0;)t[l]==="{"?r++:t[l]==="}"&&r--,l++;return t.slice(0,s)+e+t.slice(l)}function $t(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...so,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const hs=k.createContext(null),Wr=t=>an()(xs(e=>({...t,actions:{setIsAddingStep:n=>e(s=>({...s,isAddingStep:n})),setCurrentStepTab:n=>e(s=>({...s,currentStepTab:n})),setToolAction:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.map(i=>"toolName"in i.action&&i.action.toolName===n.toolName?{...i,action:n}:i)}})),appendStep:({step:n,type:s})=>e(i=>{const r=n??$t(s,i.workflow.steps.length),l=i.workflow.steps.find(a=>a.name===r.name),c=l?`${r.name} ${parseInt(l.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:r.name;return{workflow:{...i.workflow,steps:[...i.workflow.steps,{...r,name:c}]}}}),deleteStep:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.filter(i=>i.name!==n)}})),duplicateStep:n=>e(s=>{const i=s.workflow.steps.findIndex(a=>a.name===n);if(i===-1)return s;const r=s.workflow.steps[i];if(!r)return s;const l={...r,name:Tt(r.name,s.workflow.steps)},c=[...s.workflow.steps];return c.splice(i+1,0,l),{workflow:{...s.workflow,steps:c},currentStepName:l.name}}),setCurrentStepName:n=>e(s=>({...s,currentStepName:n})),updateStep:(n,s)=>e(i=>({...i,workflow:{...i.workflow,steps:i.workflow.steps.map(r=>r.name===n?{...r,...s}:r)}})),setTrackingExecutionId:n=>e(s=>({...s,trackingExecutionId:n})),resetToOriginalWorkflow:()=>e(n=>({...n,workflow:n.originalWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(h=>h.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=$t("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Dr(a,"Input"),m=d.action,h=zr(m.code,f);d={...d,action:{...m,code:h}}}const u=Tt(d.name,r.steps);return{...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...r,steps:[...r.steps,{...d,name:u}]},currentStepName:u}}),addToolStep:()=>e(n=>{let s=$t("tool",Number((Math.random()*1e6).toFixed(0)));const i=Tt(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setWorkflow:n=>e(s=>({...s,workflow:n})),startReplacingTool:n=>e(s=>({...s,replacingToolInfo:{toolName:n}})),cancelReplacingTool:()=>e(n=>({...n,replacingToolInfo:null})),setSelectedVirtualMcpId:n=>e(s=>({...s,selectedVirtualMcpId:n}))}}),{name:`workflow-store-${encodeURIComponent(t.workflow.id)}`,storage:ps(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Fr(t){const e=C.c(11),{children:n,initialState:s}=t,i=Xn(),{org:r}=G();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Be(r.id),e[0]=r,e[1]=i?.[0]?.id,e[2]=l):l=e[2];const c=l;let a;e[3]!==c||e[4]!==s.currentStepTab||e[5]!==s.trackingExecutionId||e[6]!==s.workflow?(a=()=>Wr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:c,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[3]=c,e[4]=s.currentStepTab,e[5]=s.trackingExecutionId,e[6]=s.workflow,e[7]=a):a=e[7];const[d]=k.useState(a);let u;return e[8]!==n||e[9]!==d?(u=o.jsx(hs.Provider,{value:d,children:n}),e[8]=n,e[9]=d,e[10]=u):u=e[10],u}function qe(t,e){const n=k.useContext(hs);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Mr(n,t,Lr)}function De(){return qe(Hr)}function Hr(t){return t.workflow}function ee(){return qe(Vr)}function Vr(t){return t.actions}function gs(){const t=Je();return qe(Ur)??t[0]?.name}function Ur(t){return t.currentStepName}function Ke(){const t=C.c(5),e=gs(),n=Je();let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==e?(r=l=>l.name===e,t[3]=e,t[4]=r):r=t[4],s=n.find(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];const i=s;return i||n[0]}function Je(){return De().steps}function Dt(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!=typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Dt(t[n],e[n]))return!1;return!0}if(typeof t=="object"){const n=t,s=e,i=Object.keys(n),r=Object.keys(s);if(i.length!==r.length)return!1;for(const l of i)if(!(l in s)||!Dt(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=C.c(5),e=De();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=qs(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=Dt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function U(){return qe(Br)}function Br(t){return t.trackingExecutionId}function Ge(){return qe(qr)}function qr(t){return t.selectedVirtualMcpId}function Kr(t){const e=C.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Xn()??[],{org:a}=G();let d;e[0]!==a.id?(d=Be(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(Gr),m=Hn,h=n??u;let p;e[2]!==s?(p=N=>s(N===""?void 0:N),e[2]=s,e[3]=p):p=e[3];let x;e[4]!==i?(x=M("text-xs",i),e[4]=i,e[5]=x):x=e[5];let g;e[6]!==l?(g=o.jsx(Un,{placeholder:l}),e[6]=l,e[7]=g):g=e[7];let b;e[8]!==x||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:x,children:g}),e[8]=x,e[9]=g,e[10]=b):b=e[10];const j=Bn;let S;e[11]!==u?(S=o.jsx(nt,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=S):S=e[12];const y=f.map(Jr);let v;e[13]!==j||e[14]!==S||e[15]!==y?(v=o.jsxs(j,{children:[S,y]}),e[13]=j,e[14]=S,e[15]=y,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==h||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:h,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=h,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function Jr(t){return o.jsx(nt,{value:t.id,children:t.title},t.id)}function Gr(t){return t.id!==null&&!jo(t.id)}function ze(){const t=C.c(2),e=bo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Jo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function fe(t){const e=C.c(12),{org:n}=G(),s=ze();let i;e[0]!==s.id||e[1]!==n.id?(i={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=i):i=e[2];const r=ne(i);let l;e[3]!==t?(l={id:t},e[3]=t,e[4]=l):l=e[4];const c=!!t;let a;e[5]!==r||e[6]!==l||e[7]!==c?(a={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:l,enabled:c,select:Xr},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=sn(a),f=d?.item;let m;return e[9]!==u||e[10]!==f?(m={item:f,isLoading:u},e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Xr(t){return t.structuredContent??t}function js(t,e,n){const s=C.c(14),{org:i}=G(),r=ze();let l;s[0]!==r.id||s[1]!==i.id?(l={connectionId:r.id,orgId:i.id},s[0]=r.id,s[1]=i.id,s[2]=l):l=s[2];const c=ne(l),a=(n?.enabled??!0)&&!!t&&!!e;let d;s[3]!==t||s[4]!==e?(d={executionId:t,stepId:e},s[3]=t,s[4]=e,s[5]=d):d=s[5];let u;s[6]!==c||s[7]!==a||s[8]!==d?(u={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,select:Qr},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=sn(u),h=f?.output,p=f?.error;let x;return s[10]!==m||s[11]!==h||s[12]!==p?(x={output:h,error:p,isLoading:m},s[10]=m,s[11]=h,s[12]=p,s[13]=x):x=s[13],x}function Qr(t){return t.structuredContent??t}function Zr(){const t=C.c(19),{org:e}=G(),n=ze(),s=De();let i;t[0]!==n.id||t[1]!==e.id?(i={connectionId:n.id,orgId:e.id},t[0]=n.id,t[1]=e.id,t[2]=i):i=t[2];const r=ne(i);let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=["workflow"],t[3]=l):l=t[3];let c;t[4]!==s.id?(c={field:l,operator:"eq",value:s.id},t[4]=s.id,t[5]=c):c=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=[{field:["created_at"],direction:"desc"}],t[6]=a):a=t[6];let d;t[7]!==c?(d={where:c,orderBy:a,limit:100},t[7]=c,t[8]=d):d=t[8];const u=!!s.id;let f;t[9]!==r||t[10]!==d||t[11]!==u?(f={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolArguments:d,enabled:u,staleTime:5e3,select:Yr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:h,refetch:p}=sn(f);let x;t[13]!==m?.items?(x=m?.items??[],t[13]=m?.items,t[14]=x):x=t[14];let g;return t[15]!==h||t[16]!==p||t[17]!==x?(g={executions:x,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=x,t[18]=g):g=t[18],g}function Yr(t){return t.structuredContent??t}function vs(t){const e=[];function n(s){if(typeof s=="string"){const i=s.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(i)for(const r of i)if(r==="@input")e.push("__entire_input__");else{const l=r.replace("@input.","");e.push(l)}}else Array.isArray(s)?s.forEach(n):typeof s=="object"&&s!==null&&Object.values(s).forEach(n)}return n(t),[...new Set(e)]}function ei(t){const e=[];for(const n of t){const s=vs(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function ti(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ni(t){const e=ei(t);if(e.length===0)return ti(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},s=[];for(const i of e){const r=i.split(".");if(r.length===1)n[i]={type:"string",description:`Input field: ${i}`},s.push(i);else{const l=r[0];l&&!n[l]&&(n[l]={type:"object",description:`Input object: ${l}`,additionalProperties:!0},s.push(l))}}return{type:"object",properties:n,required:s,description:"Workflow execution input"}}function si(){const t=C.c(2),e=De();let n;return t[0]!==e.steps?(n=ni(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function oi(){const t=C.c(16),{org:e}=G(),{id:n}=ze(),{setTrackingExecutionId:s}=ee(),i=De(),r=Ge(),l=si();let c;t[0]!==n||t[1]!==e.id?(c={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=c):c=t[2];const a=ne(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=on(d);let m;t[5]!==e.id||t[6]!==r||t[7]!==s||t[8]!==u||t[9]!==i?(m=async g=>{const b=g===void 0?{}:g,j=r??Be(e.id),S=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:S,workflow_collection_id:i.id}}),w=(y.structuredContent??y)?.item?.id??void 0;return s(w),w},t[5]=e.id,t[6]=r,t[7]=s,t[8]=u,t[9]=i,t[10]=m):m=t[10];const h=m,p=l!==null;let x;return t[11]!==h||t[12]!==l||t[13]!==f||t[14]!==p?(x={handleRunWorkflow:h,isPending:f,requiresInput:p,inputSchema:l},t[11]=h,t[12]=l,t[13]=f,t[14]=p,t[15]=x):x=t[15],x}function ri(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>await l({name:"CANCEL_EXECUTION",arguments:{executionId:f}}),t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleCancelWorkflow:d,isCancelling:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ii(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function li(){const t=C.c(3),e=U(),{item:n}=fe(e);let s;return t[0]!==n||t[1]!==e?(s=e&&n?(()=>{const r={};return n?.input&&(r.input=n.input),r})():void 0,t[0]=n,t[1]=e,t[2]=s):s=t[2],s}function ci(t,e,n,s){if(!e)return[...t].sort(s);const i=n(e);return[...t].sort((r,l)=>{const c=n(r),a=n(l);return c===i?-1:a===i?1:s?s(r,l):0})}const dn=$r()(xs(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),Ss=k.createContext([]);function ys(){return k.useContext(Ss)}function ai({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Fo;return{editor:t,char:s,pluginKey:i,command:({editor:r,range:l,props:c})=>{var a,d,u;const f=r.view.state.selection.$to.nodeAfter;(a=f?.text)!=null&&a.startsWith(" ")&&(l.to+=1),r.chain().focus().insertContentAt(l,[{type:n,attrs:{...c,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(d=r.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:r,range:l})=>{const c=r.doc.resolve(l.from),a=r.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(a)},...e}}function ws(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>ai({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function In(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var di=Lo.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,s;return`${(n=e?.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var s,i;return["span",Qe(this.HTMLAttributes,t.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=In(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Qe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Qe({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Qe({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Wo({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(t);for(;s!==null;){const[,i,r,l]=s,c=r??l;e[i==="char"?"mentionSuggestionChar":i]=c,s=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:In(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:s}=e,{empty:i,anchor:r}=s;if(!i)return!1;let l=new zo,c=0;return e.doc.nodesBetween(r-1,r,(a,d)=>{if(a.type.name===this.name)return n=!0,l=a,c=d,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,c,c+l.nodeSize),n})}},addProseMirrorPlugins(){return ws(this).map(Do)}}),ui=di,Ot,mt="HoverCard",[Ns]=Pn(mt,[An]),pt=An(),[fi,xt]=Ns(mt),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=pt(e),d=k.useRef(0),u=k.useRef(0),f=k.useRef(!1),m=k.useRef(!1),[h,p]=Ht({prop:s,defaultProp:i??!1,onChange:r,caller:mt}),x=k.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),g=k.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=k.useCallback(()=>p(!1),[p]);return k.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(fi,{scope:e,open:h,onOpenChange:p,onOpen:x,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=mt;var ks="HoverCardTrigger",Is=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=xt(ks,n),r=pt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Ft.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:de(t.onPointerEnter,it(i.onOpen)),onPointerLeave:de(t.onPointerLeave,it(i.onClose)),onFocus:de(t.onFocus,i.onOpen),onBlur:de(t.onBlur,i.onClose),onTouchStart:de(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var un="HoverCardPortal",[mi,pi]=Ns(un,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=xt(un,e);return o.jsx(mi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=un;var rt="HoverCardContent",Es=k.forwardRef((t,e)=>{const n=pi(rt,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=xt(rt,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(xi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:de(t.onPointerEnter,it(r.onOpen)),onPointerLeave:de(t.onPointerLeave,it(r.onClose)),ref:e})})});Es.displayName=rt;var xi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=xt(rt,n),d=pt(n),u=k.useRef(null),f=Mn(e,u),[m,h]=k.useState(!1);return k.useEffect(()=>{if(m){const p=document.body;return Ot=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Ot,p.style.webkitUserSelect=Ot}}},[m]),k.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),k.useEffect(()=>{u.current&&bi(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:de(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:de(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),hi="HoverCardArrow",gi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=pt(n);return o.jsx(ao,{...i,...s,ref:e})});gi.displayName=hi;function it(t){return e=>e.pointerType==="touch"?void 0:t()}function bi(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var ji=Cs,vi=Is,Si=_s,yi=Es;function wi(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(ji,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ni(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(vi,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ci(t){const e=C.c(12);let n,s,i,r;e[0]!==t?({className:n,align:i,sideOffset:r,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i,e[4]=r):(n=e[1],s=e[2],i=e[3],r=e[4]);const l=i===void 0?"center":i,c=r===void 0?4:r;let a;e[5]!==n?(a=M("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==s||e[9]!==c||e[10]!==a?(d=o.jsx(Si,{"data-slot":"hover-card-portal",children:o.jsx(yi,{"data-slot":"hover-card-content",align:l,sideOffset:c,className:a,...s})}),e[7]=l,e[8]=s,e[9]=c,e[10]=a,e[11]=d):d=e[11],d}const Ts=k.createContext(void 0);function ki(t,e){const n=e.split("."),s=n[0];if(!s)return;let i=t[s];for(let r=1;r<n.length&&i!==void 0;r++){const l=n[r];if(l)if(typeof i=="object"&&i!==null)i=i[l];else return}return i}function Ii(t){const e=C.c(20),{node:n}=t,s=k.useContext(Ts),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const x=r?ki(s,i):void 0;l=x!==void 0?typeof x=="object"?JSON.stringify(x,null,2):String(x):void 0,e[0]=r,e[1]=i,e[2]=s,e[3]=l}else l=e[3];const c=l;let a;e[4]!==i?(a=o.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",i]}),e[4]=i,e[5]=a):a=e[5];const d=a;if(!r||c===void 0){let x;return e[6]!==d?(x=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=x):x=e[7],x}let u;e[8]!==d?(u=o.jsx(Ni,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let h;e[14]!==f||e[15]!==m?(h=o.jsx(Ci,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=o.jsx(vn,{as:"span",children:o.jsxs(wi,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function $s(t){const e=[];function n(s){for(const i of s)i.children?.length||e.push(i),i.children&&n(i.children)}return n(t),e}let ue=Os();function Os(){return an(()=>({items:[],selectedIndex:0,command:null}))}function _n(t,e){ue.setState({items:t,command:e,selectedIndex:0})}function _i(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e-1+t.length)%t.length})}function Ei(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=ue.getState(),s=t[e];return s?(n?.(s),!0):!1}function En(){ue=Os()}function Ti(){const t=C.c(7),e=Pt(ue,Oi),n=Pt(ue,$i);if(!e.length)return null;let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==n?(r=(l,c)=>o.jsx("button",{type:"button",onClick:()=>{ue.setState({selectedIndex:c}),Rs()},className:M("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",c===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:l.label},l.id),t[3]=n,t[4]=r):r=t[4],s=e.map(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];let i;return t[5]!==s?(i=o.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:o.jsx("div",{className:"p-1",children:s})}),t[5]=s,t[6]=i):i=t[6],i}function $i(t){return t.selectedIndex}function Oi(t){return t.items}function Ri(){let t=null,e=null;return{onStart:n=>{_n(n.items,n.command),t=new Bo(Ti,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const s=n.clientRect?.();s&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{_n(n.items,n.command);const s=n.clientRect?.();s&&e&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),En(),!0):n.key==="ArrowUp"?(_i(),!0):n.key==="ArrowDown"?(Ei(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),En()}}}const Rt=/@([\w.]+)/g;function Ai(t,e){if(!t)return null;const n=$s(e),s=new Map(n.map(a=>[a.id,a]));if(!Rt.test(t))return t;Rt.lastIndex=0;const r=[];let l=0,c;for(;(c=Rt.exec(t))!==null;){const a=c[1]??"",d=c.index;d>l&&r.push({type:"text",text:t.slice(l,d)});const u=s.get(a);u?r.push({type:"mention",attrs:{id:u.id,label:u.label}}):r.push({type:"text",text:c[0]}),l=d+c[0].length}return l<t.length&&r.push({type:"text",text:t.slice(l)}),{type:"doc",content:[{type:"paragraph",content:r.length>0?r:void 0}]}}function fn(t){const e=C.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=li();let d;e[0]!==n||e[1]!==s?(d=Ai(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=Ho.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==f){let T;e[7]!==n?(T=$=>{const{query:R}=$;return $s(n).filter(I=>I.label.toLowerCase().includes(R.toLowerCase())||I.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=ui.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Di,renderHTML:Li,suggestion:{items:T,render:Ri,command:Pi}}).extend(f?{addNodeView(){return Vo(Ii)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let x;e[9]!==p?(x=[h,p],e[9]=p,e[10]=x):x=e[10];const g=r??"";let b;e[11]!==g?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":g},handleKeyDown:Mi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:$}=T;return i?.($.getText().trim())},e[13]=i,e[14]=j):j=e[14];let S;e[15]!==u||e[16]!==m||e[17]!==x||e[18]!==b||e[19]!==j?(S={content:u,editable:m,extensions:x,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=x,e[18]=b,e[19]=j,e[20]=S):S=e[20];const y=Uo(S);let v;e[21]!==l?(v=M("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",l),e[21]=l,e[22]=v):v=e[22];let w;e[23]!==y?(w=o.jsx(qo,{editor:y}),e[23]=y,e[24]=w):w=e[24];let N;e[25]!==v||e[26]!==w?(N=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=N):N=e[27];const E=N;if(a!==void 0){let T;return e[28]!==E||e[29]!==a?(T=o.jsx(Ts.Provider,{value:a,children:E}),e[28]=E,e[29]=a,e[30]=T):T=e[30],T}return E}function Mi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Pi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Li(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Di(t){const{node:e}=t;return`@${e.attrs.id}`}function zi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Wi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r,className:"min-h-[80px]"}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Fi(t){const e=C.c(8),{value:n,onChange:s,readonly:i,id:r}=t,l=n??"";let c;e[0]!==s?(c=u=>s(u.target.value===""?void 0:Number(u.target.value)),e[0]=s,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let d;return e[3]!==r||e[4]!==i||e[5]!==l||e[6]!==c?(d=o.jsx("input",{id:r,type:"number",value:l,onChange:c,disabled:i,className:a}),e[3]=r,e[4]=i,e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Hi(t){const e=C.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Vi(t){const e=C.c(14),{value:n,onChange:s,readonly:i,id:r,options:l}=t;let c;e[0]!==l.enumOptions?(c=l.enumOptions??[],e[0]=l.enumOptions,e[1]=c):c=e[1];const a=c,d=n??"";let u;e[2]!==s?(u=x=>s(x.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let h;e[6]!==a?(h=a.map(Ui),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==h?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,h]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function Ui(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Bi={TextWidget:zi,TextareaWidget:Wi,NumberWidget:Fi,CheckboxWidget:Hi,SelectWidget:Vi};function qi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function Ki(t){const e=C.c(36),{id:n,label:s,required:i,description:r,children:l,schema:c,hidden:a}=t;if(a){let v;return e[0]!==l?(v=o.jsx("div",{className:"hidden",children:l}),e[0]=l,e[1]=v):v=e[1],v}if(n==="root"){let v;return e[2]!==l?(v=o.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=v):v=e[3],v}const d=Array.isArray(c.type)?c.type[0]:c.type??"string";let u,f,m,h,p,x,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=qi(d);g="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(x=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=x):x=e[19],u=v,f=14,m=M(w,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=h,e[12]=p,e[13]=x,e[14]=g}else u=e[8],f=e[9],m=e[10],h=e[11],p=e[12],x=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==h||e[25]!==p||e[26]!==x||e[27]!==b?(j=o.jsxs("div",{className:h,children:[p,x,b]}),e[24]=h,e[25]=p,e[26]=x,e[27]=b,e[28]=j):j=e[28];let S;e[29]!==r?(S=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=S):S=e[30];let y;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==S?(y=o.jsxs("div",{className:g,children:[j,S,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=S,e[35]=y):y=e[35],y}function Ji(t){const e=C.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Xi),e[0]=n,e[1]=c):c=e[1];let a;return e[2]!==c?(a=o.jsx("div",{className:"space-y-4",children:c}),e[2]=c,e[3]=a):a=e[3],a}let r;e[4]!==n?(r=n.map(Gi),e[4]=n,e[5]=r):r=e[5];let l;return e[6]!==r?(l=o.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:r}),e[6]=r,e[7]=l):l=e[7],l}function Gi(t){return o.jsx("div",{children:t.content},t.name)}function Xi(t){return o.jsx("div",{children:t.content},t.name)}function Qi(t){const e=C.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Zi),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"space-y-2",children:l}),e[2]=l,e[3]=c):c=e[3];let a;e[4]!==s||e[5]!==i||e[6]!==r?(a=s&&o.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:i,children:["+ Add ",r||"item"]}),e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==c||e[9]!==a?(d=o.jsxs("div",{className:"space-y-2",children:[c,a]}),e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Zi(t){return o.jsx("div",{className:"flex gap-2 items-start",children:o.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function Yi(){return null}function el(){return null}const tl={FieldTemplate:Ki,ObjectFieldTemplate:Ji,ArrayFieldTemplate:Qi,UnsupportedFieldTemplate:Yi,ErrorListTemplate:el};function nl(t){const e=C.c(6),{inputSchema:n,inputParams:s,mentions:i}=t;if(!n?.properties||!s)return null;let r;e[0]!==i?(r=(a,d,u)=>{const f=typeof d=="object"&&d!==null?JSON.stringify(d,null,2):String(d??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(fn,{mentions:i,value:f,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=i,e[1]=r):r=e[1];const l=r;let c;return e[2]!==s||e[3]!==n.properties||e[4]!==l?(c=o.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[d,u]=a,f=s[d];return l(d,f,u)})}),e[2]=s,e[3]=n.properties,e[4]=l,e[5]=c):c=e[5],c}function As({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:s,mentions:i,readOnly:r}){const l=i??[];if(!t)return o.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(r)return o.jsx(nl,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=k.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[h,p]of Object.entries(f))m[h]!==p&&s(h,p);for(const h of Object.keys(m))h in f||s(h,void 0)}a.current=f};return o.jsx(Ss.Provider,{value:l,children:o.jsx(_o,{schema:c,formData:e,onChange:d,validator:Eo,widgets:Bi,templates:tl,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function sl(t){const e=C.c(33),{open:n,onOpenChange:s,inputSchema:i,onSubmit:r,isPending:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];const[a,d]=k.useState(c);let u;e[1]!==a||e[2]!==s||e[3]!==r?(u=async()=>{await r(a),s(!1),d({})},e[1]=a,e[2]=s,e[3]=r,e[4]=u):u=e[4];const f=u;let m;e[5]!==s?(m=E=>{E||d({}),s(E)},e[5]=s,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(Go,{children:[o.jsx(Xo,{children:"Workflow Input"}),o.jsx(Qo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[8]=x):x=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(As,{inputSchema:i,inputParams:a,setInputParams:d,mentions:x})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==h?(b=()=>h(!1),e[12]=h,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(Y,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let S;e[17]!==l?(S=l?o.jsx(ut,{size:"xs"}):o.jsx(tn,{size:14}),e[17]=l,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==l||e[21]!==S?(y=o.jsxs(Y,{onClick:f,disabled:l,className:"gap-2",children:[S,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=S,e[22]=y):y=e[22];let v;e[23]!==y||e[24]!==j?(v=o.jsxs(Zo,{children:[j,y]}),e[23]=y,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(Yo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,g,v]}),e[26]=v,e[27]=g,e[28]=w):w=e[28];let N;return e[29]!==h||e[30]!==n||e[31]!==w?(N=o.jsx(er,{open:n,onOpenChange:h,children:w}),e[29]=h,e[30]=n,e[31]=w,e[32]=N):N=e[32],N}function ol(t){const e=C.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=Wt().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=dn(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:h}=ee(),p=bs(),x=Ge(),g=U();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let S;e[4]!==b||e[5]!==j?(S=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=S):S=e[6];let y;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==x||e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(y=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:m,isDirty:p,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(k.Suspense,{fallback:o.jsx(ut,{size:"xs"}),children:o.jsx(Kr,{selectedVirtualMcpId:x,onVirtualMcpChange:h,placeholder:"Select Agent"})}),o.jsx(Po,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(fs,{})},{value:"code",icon:o.jsx(as,{})}]}),o.jsx(qt,{title:n,url:c,icon:"workflow"}),o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(Y,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(cs,{size:14})})})}),o.jsx(en,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=x,e[12]=h,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=y):y=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(ll,{}),e[21]=v):v=e[21];let w;e[22]!==y?(w=o.jsxs(Xt,{children:[y,v]}),e[22]=y,e[23]=w):w=e[23];let N;return e[24]!==S||e[25]!==w?(N=o.jsxs(o.Fragment,{children:[S,w]}),e[24]=S,e[25]=w,e[26]=N):N=e[26],N}function rl(){const t=U(),{item:e}=fe(t);return e?.completed_at_epoch_ms!=null}function il(){const t=U(),{item:e}=fe(t);return e?.status==="cancelled"}function ll(){const t=C.c(58),e=bs(),n=rl(),s=il(),i=U(),r=Ge(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=oi(),u=Je(),[f,m]=k.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=ri(),{handleResumeWorkflow:x,isResuming:g}=ii(),b=i&&!n;let j;t[0]!==u?(j=u.some(cl),t[0]=u,t[1]=j):j=t[1];const S=j,y=!r,v=u.length===0,w=e||v||S||y||c||p,N=b||c;let E;t[2]!==S||t[3]!==y||t[4]!==e||t[5]!==s||t[6]!==N||t[7]!==v?(E=()=>s?"Workflow is currently cancelled":N?"Workflow is currently running":e?"Save your changes before running":y?"Select an Agent first":v||S?"Add at least one step to the workflow":null,t[2]=S,t[3]=y,t[4]=e,t[5]=s,t[6]=N,t[7]=v,t[8]=E):E=t[8];const $=E();let R;t[9]!==h||t[10]!==x||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==N||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){m(!0);return}if(s&&i){await x(i);return}if(N&&i){await h(i);return}await l({})},t[9]=h,t[10]=x,t[11]=l,t[12]=d,t[13]=s,t[14]=N,t[15]=a,t[16]=i,t[17]=R):R=t[17];const L=R;let I;t[18]!==l?(I=async J=>{await l(J)},t[18]=l,t[19]=I):I=t[19];const A=I,W=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",z=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let X;t[20]!==z?(X=M("gap-2 h-7 px-3",z),t[20]=z,t[21]=X):X=t[21];let _;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(_=(!b&&!c&&!p&&!g||s)&&o.jsx(tn,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=_):_=t[27];let O;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(O=b&&!c&&!p&&!g&&!s&&o.jsx(Ko,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=O):O=t[33];let P;t[34]!==p||t[35]!==c||t[36]!==g?(P=(c||p||g)&&o.jsx(ut,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=P):P=t[37];let Q;t[38]!==W||t[39]!==L||t[40]!==w||t[41]!==X||t[42]!==_||t[43]!==O||t[44]!==P?(Q=o.jsxs(Y,{variant:"default",size:"sm",className:X,disabled:w,onClick:L,children:[_,O,P,W]}),t[38]=W,t[39]=L,t[40]=w,t[41]=X,t[42]=_,t[43]=O,t[44]=P,t[45]=Q):Q=t[45];const Z=Q;let F;t[46]!==Z||t[47]!==$?(F=$?o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Z})}),o.jsx(en,{side:"bottom",children:$})]})}):Z,t[46]=Z,t[47]=$,t[48]=F):F=t[48];const K=F;let B;t[49]!==A||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(sl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:A,isPending:c}),t[49]=A,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let H;return t[55]!==K||t[56]!==B?(H=o.jsxs(o.Fragment,{children:[K,B]}),t[55]=K,t[56]=B,t[57]=H):H=t[57],H}function cl(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Tn(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function al(){const t=C.c(13),e=U(),n=Je(),{item:s}=fe(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.error||t[3]!==s.running_steps||t[4]!==s.status||t[5]!==n){i={};let r;t[7]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(dl)??[]),t[7]=s.completed_steps?.success,t[8]=r):r=t[8];const l=r,c=s.completed_steps?.error??[];let a;t[9]!==s.running_steps?(a=s.running_steps??[],t[9]=s.running_steps,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d,f=s.status,m=s.error!=null?typeof s.error=="string"?s.error:JSON.stringify(s.error):void 0;let h=-1;n.forEach((p,x)=>{(l.has(p.name)||Tn(p.name,c))&&(h=x)}),n.forEach((p,x)=>{let g="pending",b;Tn(p.name,c)?(g="error",b=m):l.has(p.name)?g="success":(f==="error"||f==="failed")&&u.has(p.name)?(g="error",b=m):f==="running"&&x===h+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:x}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.error,t[3]=s.running_steps,t[4]=s.status,t[5]=n,t[6]=i}else i=t[6];return i}function dl(t){return t.name}function ul(t){const e=C.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=U(),{item:m}=fe(f),h=m?.completed_steps,p=h?.success,x=h?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(D=>D.name===n.name),e[0]=n.name,e[1]=p,e[2]=g):g=e[2];const b=g,j=b?.completed_at_epoch_ms,S=b!=null;let y;e[3]!==n.name?(y=D=>D===n.name||D.startsWith(`${n.name}[`),e[3]=n.name,e[4]=y):y=e[4];const v=x.some(y),w="toolName"in n.action,N=w&&"connectionId"in n.action?n.action.connectionId:null,T=!!(w&&"toolName"in n.action?n.action.toolName:null),$=yl(n),L=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=S?"success":v||L?"error":r?.status,A=r!==void 0,W=I==="success"||I==="error";let z=$.length>0?60:12;(I==="success"||I==="error")&&(z=z+32);const X=pl(I);let _;e[5]!==I?(_=xl(I),e[5]=I,e[6]=_):_=e[6];const O=_;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=function(kt,Xs){const bn=Xs.split(".").slice(1);if(bn.length===0)return Array.isArray(kt)?kt:void 0;let xe=kt;for(const Qs of bn){if(xe==null)return;if(typeof xe=="object")xe=xe[Qs];else return}return Array.isArray(xe)?xe:void 0},e[7]=P):P=e[7];const Q=P,Z=n.forEach!==void 0,F=n.forEach?.ref;let K;e[8]!==F?(K=F?.replace("@","").split(".")[0],e[8]=F,e[9]=K):K=e[9];const B=K,H=m?.status==="running"||m?.status==="enqueued";let J;e[10]!==p||e[11]!==B?(J=p?.some(D=>D.name===B),e[10]=p,e[11]=B,e[12]=J):J=e[12];const ie=J,le=H?500:!1;let se;e[13]!==ie||e[14]!==le?(se={refetchInterval:le,enabled:ie},e[13]=ie,e[14]=le,e[15]=se):se=e[15];const{output:ce}=js(f,B,se);let oe;if(e[16]!==ce||e[17]!==F){const D=F?.replace("@","");oe=D?Q(ce,D):void 0,e[16]=ce,e[17]=F,e[18]=oe}else oe=e[18];const ae=oe;let V;if(e[19]!==n.name){let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=/[.*+?^${}()|[\]\\]/g,e[21]=D):D=e[21],V=n.name.replace(D,"\\$&"),e[19]=n.name,e[20]=V}else V=e[20];const We=V,gn=new RegExp(`^${We}\\[\\d+\\]$`),bt=m?.completed_steps?.success?.filter(D=>gn.test(D.name)),Fe=x.filter(D=>gn.test(D)),jt=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",vt=I==="running"&&"bg-accent/50",St=l&&"opacity-50";let ge;e[22]!==jt||e[23]!==vt||e[24]!==St?(ge=M("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",jt,vt,St),e[22]=jt,e[23]=vt,e[24]=St,e[25]=ge):ge=e[25];const Ks="button",Js=0;let be;e[26]!==a?(be=D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),a())},e[26]=a,e[27]=be):be=e[27];const yt=M("text-xs font-mono opacity-75 h-8 flex items-center",X),wt=s+1;let je;e[28]!==yt||e[29]!==wt?(je=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:yt,children:[wt,"."]})}),e[28]=yt,e[29]=wt,e[30]=je):je=e[30];let ve;e[31]!==O||e[32]!==s?(ve=s>0?o.jsx(At,{height:12,color:O}):o.jsx("div",{className:"h-3"}),e[31]=O,e[32]=s,e[33]=ve):ve=e[33];let Se;e[34]!==N||e[35]!==T||e[36]!==w||e[37]!==n.name?(Se=o.jsx(vl,{connectionId:N,isToolStep:w,hasToolSelected:T,stepName:n.name}),e[34]=N,e[35]=T,e[36]=w,e[37]=n.name,e[38]=Se):Se=e[38];let ye;e[39]!==O||e[40]!==W||e[41]!==I?(ye=W&&o.jsxs(o.Fragment,{children:[o.jsx(At,{height:8,color:O}),o.jsx(hl,{status:I})]}),e[39]=O,e[40]=W,e[41]=I,e[42]=ye):ye=e[42];let we;e[43]!==O||e[44]!==z||e[45]!==c||e[46]!==f?(we=c&&f?null:o.jsx(At,{height:z,color:O}),e[43]=O,e[44]=z,e[45]=c,e[46]=f,e[47]=we):we=e[47];let Ne;e[48]!==ve||e[49]!==Se||e[50]!==ye||e[51]!==we?(Ne=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[ve,Se,ye,we]}),e[48]=ve,e[49]=Se,e[50]=ye,e[51]=we,e[52]=Ne):Ne=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",Nt=T?"font-medium text-foreground":"text-foreground";let Ce;e[53]!==Nt?(Ce=M("text-sm truncate flex-1",Nt),e[53]=Nt,e[54]=Ce):Ce=e[54];let ke;e[55]!==n?(ke=Sl(n),e[55]=n,e[56]=ke):ke=e[56];let Ie;e[57]!==Ce||e[58]!==ke?(Ie=o.jsx("span",{className:Ce,children:ke}),e[57]=Ce,e[58]=ke,e[59]=Ie):Ie=e[59];let _e;e[60]!==bt?.length||e[61]!==Fe||e[62]!==Z||e[63]!==ae?(_e=Z&&ae&&ae.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(bt?.length??0)+Fe.length} / ${ae.length}`,Fe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",Fe.length," failed)"]})]}),e[60]=bt?.length,e[61]=Fe,e[62]=Z,e[63]=ae,e[64]=_e):_e=e[64];let Ee;e[65]!==A||e[66]!==I?(Ee=A&&o.jsx(gl,{status:I}),e[65]=A,e[66]=I,e[67]=Ee):Ee=e[67];let Te;e[68]!==_e||e[69]!==Ee?(Te=o.jsxs("div",{className:"flex items-center gap-2",children:[_e,Ee]}),e[68]=_e,e[69]=Ee,e[70]=Te):Te=e[70];let $e;e[71]!==A||e[72]!==d||e[73]!==u?($e=!A&&o.jsxs(sr,{children:[o.jsx(or,{asChild:!0,children:o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:ml,children:o.jsx(tr,{size:14})})}),o.jsxs(rr,{align:"end",children:[o.jsxs(Sn,{onClick:D=>{D.stopPropagation(),u()},children:[o.jsx(mr,{size:14}),"Duplicate"]}),o.jsxs(Sn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:D=>{D.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=A,e[72]=d,e[73]=u,e[74]=$e):$e=e[74];let Oe;e[75]!==Ie||e[76]!==Te||e[77]!==$e?(Oe=o.jsxs("div",{className:"flex items-center h-8",children:[Ie,Te,$e]}),e[75]=Ie,e[76]=Te,e[77]=$e,e[78]=Oe):Oe=e[78];const Ct=$.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:$.map(fl)});let Re;e[79]!==I||e[80]!==j?(Re=I==="success"&&o.jsx(bl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Re):Re=e[81];let Ae;e[82]!==r?.error||e[83]!==I?(Ae=I==="error"&&o.jsx(jl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=Ae):Ae=e[84];let Me;e[85]!==Oe||e[86]!==Ct||e[87]!==Re||e[88]!==Ae?(Me=o.jsxs("div",{className:Gs,children:[Oe,Ct,Re,Ae]}),e[85]=Oe,e[86]=Ct,e[87]=Re,e[88]=Ae,e[89]=Me):Me=e[89];let Xe;return e[90]!==a||e[91]!==ge||e[92]!==be||e[93]!==je||e[94]!==Ne||e[95]!==Me?(Xe=o.jsxs("div",{className:ge,onClick:a,role:Ks,tabIndex:Js,onKeyDown:be,children:[je,Ne,Me]}),e[90]=a,e[91]=ge,e[92]=be,e[93]=je,e[94]=Ne,e[95]=Me,e[96]=Xe):Xe=e[96],Xe}function fl(t){return o.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function ml(t){return t.stopPropagation()}function pl(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function xl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function hl(t){const e=C.c(2),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:o.jsx(ft,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(at,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function gl(t){const e=C.c(3),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ft,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(at,{size:11,className:"text-destructive"})}),e[1]=s):s=e[1],s}if(n==="running"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(Ue,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function bl(t){const e=C.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null&&n>0?new Date(n):null,d=a&&!Number.isNaN(a.getTime());s=d?a.toISOString().split("T")[0]:null,i=d?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];const r=i;let l;e[3]!==s||e[4]!==r?(l=s&&r&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(To,{size:16,className:"text-success"}),o.jsx("span",{className:"text-xs text-success",children:s}),o.jsx("span",{className:"text-xs text-success",children:r})]}),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==l?(c=o.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:l}),e[6]=l,e[7]=c):c=e[7],c}function jl(t){const e=C.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zn,{size:16,className:"text-destructive"}),e[0]=s):s=e[0];const i=n||"Execution failed";let r;return e[1]!==i?(r=o.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[s,o.jsx("span",{className:"text-xs text-destructive",children:i})]}),e[1]=i,e[2]=r):r=e[2],r}function vl(t){const e=C.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=ct(n??"");if(s&&i&&l?.icon){let a;return e[0]!==l.icon||e[1]!==r?(a=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:o.jsx(dt,{icon:l.icon,name:r,size:"xs",className:"border-0 rounded-none"})}),e[0]=l.icon,e[1]=r,e[2]=a):a=e[2],a}let c;return e[3]!==s?(c=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:s?o.jsx(nr,{size:16,className:"text-muted-foreground"}):o.jsx(fr,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function At(t){const e=C.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=M("w-px",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l={height:n},e[2]=n,e[3]=l):l=e[3];let c;return e[4]!==r||e[5]!==l?(c=o.jsx("div",{className:r,style:l}),e[4]=r,e[5]=l,e[6]=c):c=e[6],c}function Sl(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function yl(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties??e.items?.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function wl(t){const e=C.c(32),{className:n}=t,s=Je(),i=gs(),r=al(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ee(),d=U();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(S=>r[S.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let h;e[4]!==n?(h=M("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let S;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(S=(y,v)=>{const w=r?.[y.name],N=f!==-1&&v>f&&w?.status==="pending",E=v===s.length-1;return o.jsx(ul,{step:y,index:v,isSelected:y.name===i,executionStatus:w,isSkipped:N,isLastStep:E,onSelect:()=>l(y.name),onDelete:()=>c(y.name),onDuplicate:()=>a(y.name)},y.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=S):S=e[21],p=s.map(S),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let x;e[22]!==p?(x=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=x):x=e[23];let g;e[24]!==d?(g=d?null:o.jsx(Nl,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==x||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[x,g]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==h||e[30]!==b?(j=o.jsx(k.Suspense,{fallback:m,children:o.jsx("div",{className:h,children:b})}),e[29]=h,e[30]=b,e[31]=j):j=e[31],j}function Nl(){const t=C.c(8),{addToolStep:e}=ee();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Qn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(Y,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function Cl(){const t=C.c(14),{org:e}=G(),n=Ge();let s;t[0]!==e.id||t[1]!==n?(s=n??Be(e.id),t[0]=e.id,t[1]=n,t[2]=s):s=t[2];const i=s;let r;t[3]!==e.id||t[4]!==i?(r={connectionId:i,orgId:e.id},t[3]=e.id,t[4]=i,t[5]=r):r=t[5];const l=ne(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=nn(c);let d;t[8]!==a.data?.tools?(d=a.data?.tools??[],t[8]=a.data?.tools,t[9]=d):d=t[9];let u;return t[10]!==d||t[11]!==a.error||t[12]!==a.isLoading?(u={tools:d,isLoading:a.isLoading,error:a.error},t[10]=d,t[11]=a.error,t[12]=a.isLoading,t[13]=u):u=t[13],u}function kl(t){const e=C.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(Il,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function Il(t){const e=C.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Cl(),l=Ke(),{updateStep:c}=ee(),d=l&&"toolName"in l.action&&"toolName"in l.action?l.action.toolName:null;let u;if(e[0]!==d||e[1]!==s){let v;e[3]!==d?(v=w=>w.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=ci(s,u??null,El,_l);let h;e[5]!==l||e[6]!==c?(h=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=h):h=e[7];const p=h;if(i){let v;e[8]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(ut,{size:"sm"})}),e[10]=w):w=e[10];let N;return e[11]!==v?(N=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=N):N=e[12],N}if(r){let v;e[13]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let w;e[15]!==r.message?(w=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",r.message]}),e[15]=r.message,e[16]=w):w=e[16];let N;return e[17]!==v||e[18]!==w?(N=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=N):N=e[19],N}let x;e[20]!==n?(x=M("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=x):x=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=g):g=e[22];let b;e[23]!==s.length?(b=o.jsx("div",{className:"flex items-start border-b border-border",children:o.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[g,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=w=>o.jsx(Tl,{icon:null,title:w.name,description:w.description,isSelected:w.name===d,onClick:()=>p(w)},w.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let S;e[32]!==j?(S=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=S):S=e[33];let y;return e[34]!==x||e[35]!==b||e[36]!==S?(y=o.jsxs("div",{className:x,children:[b,S]}),e[34]=x,e[35]=b,e[36]=S,e[37]=y):y=e[37],y}function _l(t,e){return t.name.localeCompare(e.name)}function El(t){return t.name}function Tl(t){const e=C.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=M("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",c),e[0]=c,e[1]=a):a=e[1];let d;e[2]!==l?(d=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(dt,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let h;e[11]!==f||e[12]!==m?(h=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,h]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var re="Accordion",$l=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[mn,Ol,Rl]=mo(re),[ht]=Pn(re,[Rl,Yn]),pn=Yn(),Ms=q.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(mn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Ll,{...r,ref:e}):o.jsx(Pl,{...i,ref:e})})});Ms.displayName=re;var[Ps,Al]=ht(re),[Ls,Ml]=ht(re,{collapsible:!1}),Pl=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ht({prop:n,defaultProp:s??"",onChange:i,caller:re});return o.jsx(Ps,{scope:t.__scopeAccordion,value:q.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:q.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Ll=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ht({prop:n,defaultProp:s??[],onChange:i,caller:re}),a=q.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=q.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Ps,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(Ds,{...r,ref:e})})})}),[Dl,gt]=ht(re),Ds=q.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=q.useRef(null),a=Mn(c,e),d=Ol(n),f=po(i)==="ltr",m=de(t.onKeyDown,h=>{if(!$l.includes(h.key))return;const p=h.target,x=d().filter(E=>!E.ref.current?.disabled),g=x.findIndex(E=>E.ref.current===p),b=x.length;if(g===-1)return;h.preventDefault();let j=g;const S=0,y=b-1,v=()=>{j=g+1,j>y&&(j=S)},w=()=>{j=g-1,j<S&&(j=y)};switch(h.key){case"Home":j=S;break;case"End":j=y;break;case"ArrowRight":r==="horizontal"&&(f?v():w());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?w():v());break;case"ArrowUp":r==="vertical"&&w();break}const N=j%b;x[N].ref.current?.focus()});return o.jsx(Dl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(mn.Slot,{scope:n,children:o.jsx(Ft.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),lt="AccordionItem",[zl,xn]=ht(lt),zs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=gt(lt,n),l=Al(lt,n),c=pn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(zl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(lr,{"data-orientation":r.orientation,"data-state":Bs(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});zs.displayName=lt;var Ws="AccordionHeader",Fs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(Ws,n);return o.jsx(Ft.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var zt="AccordionTrigger",Hs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(zt,n),l=Ml(zt,n),c=pn(n);return o.jsx(mn.ItemSlot,{scope:n,children:o.jsx(ir,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=zt;var Vs="AccordionContent",Us=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(Vs,n),l=pn(n);return o.jsx(cr,{role:"region","aria-labelledby":r.triggerId,"data-orientation":i.orientation,...l,...s,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Us.displayName=Vs;function Bs(t){return t?"open":"closed"}var Wl=Ms,Fl=zs,Hl=Fs,Vl=Hs,Ul=Us;function Bl(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(Wl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function ql(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("border-b last:border-b-0",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx(Fl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Kl(t){const e=C.c(11);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ar,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=l):l=e[6];let c;return e[7]!==n||e[8]!==i||e[9]!==r?(c=o.jsx(Hl,{className:"flex",children:o.jsxs(Vl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function Jl(t){const e=C.c(12);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("pt-0 pb-4",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==n||e[7]!==r?(l=o.jsx("div",{className:r,children:n}),e[6]=n,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==l?(c=o.jsx(Ul,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function Gl(t){const{updateStep:e}=ee(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=hn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Xl(t){const e=C.c(48),{className:n}=t,s=Ke(),{appendStep:i}=ee();Gl(s);const r=U(),{item:l}=fe(r);if(!s){let $;e[0]!==n?($=M("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=$):$=e[1];let R;e[2]!==i?(R=()=>{i({type:"tool"})},e[2]=i,e[3]=R):R=e[3];let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Qn,{size:14}),e[4]=L):L=e[4];let I;e[5]!==R?(I=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:R,children:L})]}),e[5]=R,e[6]=I):I=e[6];let A;return e[7]!==$||e[8]!==I?(A=o.jsx("div",{className:$,children:I}),e[7]=$,e[8]=I,e[9]=A):A=e[9],A}const c=s?.name;let a;e[10]!==l?.completed_steps?.error?(a=l?.completed_steps?.error??[],e[10]=l?.completed_steps?.error,e[11]=a):a=e[11];const d=a;let u;if(e[12]!==c||e[13]!==d){let $;e[15]!==c?($=R=>R===c||R.startsWith(`${c}[`),e[15]=c,e[16]=$):$=e[16],u=d.some($),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let h;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(h=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=h):h=e[20];const p=h,x=!!(l?.completed_steps?.success?.some($=>$.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=M("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,S;e[23]!==s?(j=o.jsx(Ql,{step:s}),S=o.jsx(Yl,{step:s}),e[23]=s,e[24]=j,e[25]=S):(j=e[24],S=e[25]);const y=`${c}-${x?"open":"closed"}`;let v;e[26]!==l||e[27]!==g?(v=g&&l?.error!=null?typeof l.error=="string"?l.error:JSON.stringify(l.error):void 0,e[26]=l,e[27]=g,e[28]=v):v=e[28];let w;e[29]!==s||e[30]!==x||e[31]!==g||e[32]!==y||e[33]!==v?(w=o.jsx(tc,{step:s,defaultOpen:x,isStepErrored:g,executionError:v},y),e[29]=s,e[30]=x,e[31]=g,e[32]=y,e[33]=v,e[34]=w):w=e[34];let N;e[35]!==s||e[36]!==r?(N=!r&&o.jsx(lc,{step:s}),e[35]=s,e[36]=r,e[37]=N):N=e[37];let E;e[38]!==s||e[39]!==r?(E=!r&&o.jsx(dc,{step:s}),e[38]=s,e[39]=r,e[40]=E):E=e[40];let T;return e[41]!==N||e[42]!==E||e[43]!==b||e[44]!==j||e[45]!==S||e[46]!==w?(T=o.jsxs("div",{className:b,children:[j,S,w,N,E]}),e[41]=N,e[42]=E,e[43]=b,e[44]=j,e[45]=S,e[46]=w,e[47]=T):T=e[47],T}function Ql(t){const e=C.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=U(),l=i??"";let c;e[0]!==l?(c=o.jsx(dt,{icon:null,name:l,size:"xs",className:"shadow-sm"}),e[0]=l,e[1]=c):c=e[1];let a;e[2]!==i?(a=o.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:i}),e[2]=i,e[3]=a):a=e[3];let d;e[4]!==r?(d=r?null:o.jsx(Zl,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function Zl(){const t=C.c(9),e=Ke(),{updateStep:n,startReplacingTool:s}=ee(),i=U(),l=e&&"toolName"in e.action?e.action.toolName:null;let c;t[0]!==e||t[1]!==s||t[2]!==l||t[3]!==i||t[4]!==n?(c=()=>{if(e){if(i){On.error("You cannot replace a tool while a workflow is executing.");return}l&&s(l),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=s,t[2]=l,t[3]=i,t[4]=n,t[5]=c):c=t[5];const a=c;let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ms,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:d}),t[7]=a,t[8]=u):u=t[8],u}function hn(t){const e=C.c(16),{org:n}=G(),s=Ge();let i;e[0]!==n.id||e[1]!==s?(i=s??Be(n.id),e[0]=n.id,e[1]=s,e[2]=i):i=e[2];const r=i;let l;e[3]!==n.id||e[4]!==r?(l={connectionId:r,orgId:n.id},e[3]=n.id,e[4]=r,e[5]=l):l=e[5];const c=ne(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=nn(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(h=>h.name===t),e[8]=t,e[9]=d.data?.tools,e[10]=u):u=e[10];const f=u;let m;return e[11]!==f||e[12]!==d.error||e[13]!==d.isLoading||e[14]!==d.isSuccess?(m={tool:f,isLoading:d.isLoading,isReady:d.isSuccess,error:d.error},e[11]=f,e[12]=d.error,e[13]=d.isLoading,e[14]=d.isSuccess,e[15]=m):m=e[15],m}function Yl(t){const e=C.c(18),{step:n}=t,{updateStep:s}=ee(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=U(),{tool:c}=hn(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=v=>{s(n.name,{input:v})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==n.input||e[4]!==c.inputSchema||e[5]!==l?(u=l?ec(c.inputSchema,n.input):c.inputSchema,e[3]=n.input,e[4]=c.inputSchema,e[5]=l,e[6]=u):u=e[6];const f=u,m=l?"output":"input";let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kl,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=h):h=e[7];const p=n.name+l,x=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let S;e[9]!==d||e[10]!==p||e[11]!==x||e[12]!==g||e[13]!==b?(S=o.jsxs(ql,{value:"input",className:"border-b-0",children:[h,o.jsx(Jl,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:x,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=S):S=e[14];let y;return e[15]!==S||e[16]!==m?(y=o.jsx(Bl,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:S}),e[15]=S,e[16]=m,e[17]=y):y=e[17],y}function ec(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function tc(t){const e=C.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=U(),{item:a}=fe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=V=>V===n.name||V.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),h=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(V=>V.name===n.name)||f||h),[x,g]=k.useState(s),b=n.forEach!==void 0,[j,S]=k.useState("all"),y=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(V=>y.test(V.name)).map(V=>{const We=V.name.match(y);return{index:Number(We[1]),status:"success"}}):[],N=(b?d.filter(V=>y.test(V)):[]).map(V=>{const We=V.match(y);return{index:Number(We[1]),status:"error"}}),E=[...v,...N].sort(sc),T=E.length>0,$=b&&j!=="all"?`${n.name}[${j}]`:void 0,R=p?n.name:void 0,L=$??R,{output:I,error:A}=js(c,L);let W;e[2]!==A||e[3]!==r||e[4]!==i||e[5]!==I?(W=I||(A?{error:A}:i&&r?{error:r}:void 0),e[2]=A,e[3]=r,e[4]=i,e[5]=I,e[6]=W):W=e[6];const z=W,X=l&&typeof l=="object"?l.properties:void 0;let _;e[7]!==X?(_=X?Object.entries(X):[],e[7]=X,e[8]=_):_=e[8];const O=_,P=j!=="all"&&N.some(V=>V.index===j),Q=j==="all"?i||f||h:P,Z=x?"flex-1 min-h-0 overflow-hidden":"shrink-0";let F;e[9]!==Z?(F=M("flex flex-col border-b border-border",Z),e[9]=Z,e[10]=F):F=e[10];let K;e[11]!==x||e[12]!==g?(K=()=>g(!x),e[11]=x,e[12]=g,e[13]=K):K=e[13];const B=Q?"text-destructive":"text-muted-foreground";let H;e[14]!==B?(H=M("text-sm font-medium",B),e[14]=B,e[15]=H):H=e[15];const J=Q?"Error":"Output";let ie;e[16]!==H||e[17]!==J?(ie=o.jsx("h3",{className:H,children:J}),e[16]=H,e[17]=J,e[18]=ie):ie=e[18];let le;e[19]!==x?(le=x?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"}),e[19]=x,e[20]=le):le=e[20];let se;e[21]!==ie||e[22]!==le?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,le]}),e[21]=ie,e[22]=le,e[23]=se):se=e[23];let ce;e[24]!==se||e[25]!==K?(ce=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:K,children:se}),e[24]=se,e[25]=K,e[26]=ce):ce=e[26];let oe;e[27]!==E||e[28]!==z||e[29]!==T||e[30]!==b||e[31]!==x||e[32]!==O||e[33]!==j||e[34]!==S||e[35]!==n.name||e[36]!==c?(oe=x&&o.jsxs(o.Fragment,{children:[c&&b&&T&&o.jsx(oc,{iterations:E,selectedIteration:j,onSelect:S}),c&&z?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:JSON.stringify(z,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&O.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:O.map(nc)})]}),e[27]=E,e[28]=z,e[29]=T,e[30]=b,e[31]=x,e[32]=O,e[33]=j,e[34]=S,e[35]=n.name,e[36]=c,e[37]=oe):oe=e[37];let ae;return e[38]!==ce||e[39]!==oe||e[40]!==F?(ae=o.jsxs("div",{className:F,children:[ce,oe]}),e[38]=ce,e[39]=oe,e[40]=F,e[41]=ae):ae=e[41],ae}function nc(t){const[e,n]=t;return o.jsx(ic,{name:e,schema:n},e)}function sc(t,e){return t.index-e.index}function oc(t){const e=C.c(21),{iterations:n,selectedIteration:s,onSelect:i}=t,r=s==="all"?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground";let l;e[0]!==r?(l=M("h-7 px-3 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",r),e[0]=r,e[1]=l):l=e[1];let c;e[2]!==i?(c=()=>i("all"),e[2]=i,e[3]=c):c=e[3];let a;e[4]!==l||e[5]!==c?(a=o.jsx("button",{type:"button",className:l,onClick:c,children:"All Results"}),e[4]=l,e[5]=c,e[6]=a):a=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e[7]=d):d=e[7];let u;if(e[8]!==n||e[9]!==i||e[10]!==s){let p;e[12]!==i||e[13]!==s?(p=x=>{const g=s===x.index;return o.jsxs("button",{type:"button",className:M("h-7 px-2.5 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",g?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(x.index),children:[x.status==="success"?o.jsx(ft,{size:12,className:"text-success"}):o.jsx(at,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",x.index]})]},x.index)},e[12]=i,e[13]=s,e[14]=p):p=e[14],u=n.map(p),e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];let f;e[15]!==a||e[16]!==u?(f=o.jsxs("div",{className:"flex w-max items-center gap-2 pb-3",children:[a,d,u]}),e[15]=a,e[16]=u,e[17]=f):f=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($o,{orientation:"horizontal"}),e[18]=m):m=e[18];let h;return e[19]!==f?(h=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(Oo,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=h):h=e[20],h}function rc(t){switch(t){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function ic(t){const e=C.c(28),{name:n,schema:s}=t,i=Ke(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:y,color:v}=rc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=y,c=14,a=M(v),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=u}else l=e[1],c=e[2],a=e[3],d=e[4],u=e[5];let f;e[6]!==l||e[7]!==c||e[8]!==a?(f=o.jsx(l,{size:c,className:a}),e[6]=l,e[7]=c,e[8]=a,e[9]=f):f=e[9];let m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let h;e[12]!==d||e[13]!==f||e[14]!==m?(h=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ds,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const x=i?.name;let g;e[17]!==x?(g=o.jsxs("span",{className:"text-muted-foreground",children:[x,"."]}),e[17]=x,e[18]=g):g=e[18];let b;e[19]!==n?(b=o.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=b):b=e[20];let j;e[21]!==g||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let S;return e[24]!==j||e[25]!==u||e[26]!==h?(S=o.jsxs("div",{className:u,children:[h,j]}),e[24]=j,e[25]=u,e[26]=h,e[27]=S):S=e[27],S}function lc(t){const e=C.c(29),{step:n}=t,{updateStep:s}=ee(),i=U(),[r,l]=k.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=hn(a??""),u=c&&"transformCode"in n.action?n.action.transformCode??null:null;let f;e[0]!==d?(f=()=>{if(!d?.outputSchema)return`interface Input {
|
|
7
|
+
${t.trimStart()}`;const s=n.index,i=s+n[0].length-1;let r=1,l=i+1;for(;l<t.length&&r>0;)t[l]==="{"?r++:t[l]==="}"&&r--,l++;return t.slice(0,s)+e+t.slice(l)}function $t(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...so,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const hs=k.createContext(null),Wr=t=>an()(xs(e=>({...t,actions:{setIsAddingStep:n=>e(s=>({...s,isAddingStep:n})),setCurrentStepTab:n=>e(s=>({...s,currentStepTab:n})),setToolAction:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.map(i=>"toolName"in i.action&&i.action.toolName===n.toolName?{...i,action:n}:i)}})),appendStep:({step:n,type:s})=>e(i=>{const r=n??$t(s,i.workflow.steps.length),l=i.workflow.steps.find(a=>a.name===r.name),c=l?`${r.name} ${parseInt(l.name.split(" ").pop()??Math.random().toString(36).substring(2,15))+1}`:r.name;return{workflow:{...i.workflow,steps:[...i.workflow.steps,{...r,name:c}]}}}),deleteStep:n=>e(s=>({workflow:{...s.workflow,steps:s.workflow.steps.filter(i=>i.name!==n)}})),duplicateStep:n=>e(s=>{const i=s.workflow.steps.findIndex(a=>a.name===n);if(i===-1)return s;const r=s.workflow.steps[i];if(!r)return s;const l={...r,name:Tt(r.name,s.workflow.steps)},c=[...s.workflow.steps];return c.splice(i+1,0,l),{workflow:{...s.workflow,steps:c},currentStepName:l.name}}),setCurrentStepName:n=>e(s=>({...s,currentStepName:n})),updateStep:(n,s)=>e(i=>({...i,workflow:{...i.workflow,steps:i.workflow.steps.map(r=>r.name===n?{...r,...s}:r)}})),setTrackingExecutionId:n=>e(s=>({...s,trackingExecutionId:n})),resetToOriginalWorkflow:()=>e(n=>({...n,workflow:n.originalWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(h=>h.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=$t("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Dr(a,"Input"),m=d.action,h=zr(m.code,f);d={...d,action:{...m,code:h}}}const u=Tt(d.name,r.steps);return{...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[],workflow:{...r,steps:[...r.steps,{...d,name:u}]},currentStepName:u}}),addToolStep:()=>e(n=>{let s=$t("tool",Number((Math.random()*1e6).toFixed(0)));const i=Tt(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setWorkflow:n=>e(s=>({...s,workflow:n})),startReplacingTool:n=>e(s=>({...s,replacingToolInfo:{toolName:n}})),cancelReplacingTool:()=>e(n=>({...n,replacingToolInfo:null})),setSelectedVirtualMcpId:n=>e(s=>({...s,selectedVirtualMcpId:n}))}}),{name:`workflow-store-${encodeURIComponent(t.workflow.id)}`,storage:ps(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Fr(t){const e=C.c(11),{children:n,initialState:s}=t,i=Xn(),{org:r}=G();let l;e[0]!==r||e[1]!==i?.[0]?.id?(l=i?.[0]?.id??Be(r.id),e[0]=r,e[1]=i?.[0]?.id,e[2]=l):l=e[2];const c=l;let a;e[3]!==c||e[4]!==s.currentStepTab||e[5]!==s.trackingExecutionId||e[6]!==s.workflow?(a=()=>Wr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:c,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[3]=c,e[4]=s.currentStepTab,e[5]=s.trackingExecutionId,e[6]=s.workflow,e[7]=a):a=e[7];const[d]=k.useState(a);let u;return e[8]!==n||e[9]!==d?(u=o.jsx(hs.Provider,{value:d,children:n}),e[8]=n,e[9]=d,e[10]=u):u=e[10],u}function qe(t,e){const n=k.useContext(hs);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return Mr(n,t,Lr)}function De(){return qe(Hr)}function Hr(t){return t.workflow}function ee(){return qe(Vr)}function Vr(t){return t.actions}function gs(){const t=Je();return qe(Ur)??t[0]?.name}function Ur(t){return t.currentStepName}function Ke(){const t=C.c(5),e=gs(),n=Je();let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==e?(r=l=>l.name===e,t[3]=e,t[4]=r):r=t[4],s=n.find(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];const i=s;return i||n[0]}function Je(){return De().steps}function Dt(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!=typeof e)return!1;if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!Dt(t[n],e[n]))return!1;return!0}if(typeof t=="object"){const n=t,s=e,i=Object.keys(n),r=Object.keys(s);if(i.length!==r.length)return!1;for(const l of i)if(!(l in s)||!Dt(n[l],s[l]))return!1;return!0}return!1}function bs(){const t=C.c(5),e=De();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=qs(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=Dt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function U(){return qe(Br)}function Br(t){return t.trackingExecutionId}function Ge(){return qe(qr)}function qr(t){return t.selectedVirtualMcpId}function Kr(t){const e=C.c(23),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=Xn()??[],{org:a}=G();let d;e[0]!==a.id?(d=Be(a.id),e[0]=a.id,e[1]=d):d=e[1];const u=d,f=c.filter(Gr),m=Hn,h=n??u;let p;e[2]!==s?(p=N=>s(N===""?void 0:N),e[2]=s,e[3]=p):p=e[3];let x;e[4]!==i?(x=M("text-xs",i),e[4]=i,e[5]=x):x=e[5];let g;e[6]!==l?(g=o.jsx(Un,{placeholder:l}),e[6]=l,e[7]=g):g=e[7];let b;e[8]!==x||e[9]!==g?(b=o.jsx(Vn,{size:"sm",className:x,children:g}),e[8]=x,e[9]=g,e[10]=b):b=e[10];const j=Bn;let S;e[11]!==u?(S=o.jsx(nt,{value:u,children:"All tools (Decopilot)"}),e[11]=u,e[12]=S):S=e[12];const y=f.map(Jr);let v;e[13]!==j||e[14]!==S||e[15]!==y?(v=o.jsxs(j,{children:[S,y]}),e[13]=j,e[14]=S,e[15]=y,e[16]=v):v=e[16];let w;return e[17]!==m||e[18]!==v||e[19]!==h||e[20]!==p||e[21]!==b?(w=o.jsxs(m,{value:h,onValueChange:p,children:[b,v]}),e[17]=m,e[18]=v,e[19]=h,e[20]=p,e[21]=b,e[22]=w):w=e[22],w}function Jr(t){return o.jsx(nt,{value:t.id,children:t.title},t.id)}function Gr(t){return t.id!==null&&!jo(t.id)}function ze(){const t=C.c(2),e=bo();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Jo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}function fe(t){const e=C.c(12),{org:n}=G(),s=ze();let i;e[0]!==s.id||e[1]!==n.id?(i={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=i):i=e[2];const r=ne(i);let l;e[3]!==t?(l={id:t},e[3]=t,e[4]=l):l=e[4];const c=!!t;let a;e[5]!==r||e[6]!==l||e[7]!==c?(a={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:l,enabled:c,select:Xr},e[5]=r,e[6]=l,e[7]=c,e[8]=a):a=e[8];const{data:d,isLoading:u}=sn(a),f=d?.item;let m;return e[9]!==u||e[10]!==f?(m={item:f,isLoading:u},e[9]=u,e[10]=f,e[11]=m):m=e[11],m}function Xr(t){return t.structuredContent??t}function js(t,e,n){const s=C.c(14),{org:i}=G(),r=ze();let l;s[0]!==r.id||s[1]!==i.id?(l={connectionId:r.id,orgId:i.id},s[0]=r.id,s[1]=i.id,s[2]=l):l=s[2];const c=ne(l),a=(n?.enabled??!0)&&!!t&&!!e;let d;s[3]!==t||s[4]!==e?(d={executionId:t,stepId:e},s[3]=t,s[4]=e,s[5]=d):d=s[5];let u;s[6]!==c||s[7]!==a||s[8]!==d?(u={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,select:Qr},s[6]=c,s[7]=a,s[8]=d,s[9]=u):u=s[9];const{data:f,isLoading:m}=sn(u),h=f?.output,p=f?.error;let x;return s[10]!==m||s[11]!==h||s[12]!==p?(x={output:h,error:p,isLoading:m},s[10]=m,s[11]=h,s[12]=p,s[13]=x):x=s[13],x}function Qr(t){return t.structuredContent??t}function Zr(){const t=C.c(19),{org:e}=G(),n=ze(),s=De();let i;t[0]!==n.id||t[1]!==e.id?(i={connectionId:n.id,orgId:e.id},t[0]=n.id,t[1]=e.id,t[2]=i):i=t[2];const r=ne(i);let l;t[3]===Symbol.for("react.memo_cache_sentinel")?(l=["workflow"],t[3]=l):l=t[3];let c;t[4]!==s.id?(c={field:l,operator:"eq",value:s.id},t[4]=s.id,t[5]=c):c=t[5];let a;t[6]===Symbol.for("react.memo_cache_sentinel")?(a=[{field:["created_at"],direction:"desc"}],t[6]=a):a=t[6];let d;t[7]!==c?(d={where:c,orderBy:a,limit:100},t[7]=c,t[8]=d):d=t[8];const u=!!s.id;let f;t[9]!==r||t[10]!==d||t[11]!==u?(f={client:r,toolName:"COLLECTION_WORKFLOW_EXECUTION_LIST",toolArguments:d,enabled:u,staleTime:5e3,select:Yr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:h,refetch:p}=sn(f);let x;t[13]!==m?.items?(x=m?.items??[],t[13]=m?.items,t[14]=x):x=t[14];let g;return t[15]!==h||t[16]!==p||t[17]!==x?(g={executions:x,isLoading:h,refetch:p},t[15]=h,t[16]=p,t[17]=x,t[18]=g):g=t[18],g}function Yr(t){return t.structuredContent??t}function vs(t){const e=[];function n(s){if(typeof s=="string"){const i=s.match(/@input(?:\.(\w+(?:\.\w+)*))?/g);if(i)for(const r of i)if(r==="@input")e.push("__entire_input__");else{const l=r.replace("@input.","");e.push(l)}}else Array.isArray(s)?s.forEach(n):typeof s=="object"&&s!==null&&Object.values(s).forEach(n)}return n(t),[...new Set(e)]}function ei(t){const e=[];for(const n of t){const s=vs(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function ti(t){for(const e of t)if(vs(e.input).includes("__entire_input__"))return!0;return!1}function ni(t){const e=ei(t);if(e.length===0)return ti(t)?{type:"object",additionalProperties:!0,description:"Workflow input data"}:null;const n={},s=[];for(const i of e){const r=i.split(".");if(r.length===1)n[i]={type:"string",description:`Input field: ${i}`},s.push(i);else{const l=r[0];l&&!n[l]&&(n[l]={type:"object",description:`Input object: ${l}`,additionalProperties:!0},s.push(l))}}return{type:"object",properties:n,required:s,description:"Workflow execution input"}}function si(){const t=C.c(2),e=De();let n;return t[0]!==e.steps?(n=ni(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function oi(){const t=C.c(16),{org:e}=G(),{id:n}=ze(),{setTrackingExecutionId:s}=ee(),i=De(),r=Ge(),l=si();let c;t[0]!==n||t[1]!==e.id?(c={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=c):c=t[2];const a=ne(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=on(d);let m;t[5]!==e.id||t[6]!==r||t[7]!==s||t[8]!==u||t[9]!==i?(m=async g=>{const b=g===void 0?{}:g,j=r??Be(e.id),S=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:j,start_at_epoch_ms:S,workflow_collection_id:i.id}}),w=(y.structuredContent??y)?.item?.id??void 0;return s(w),w},t[5]=e.id,t[6]=r,t[7]=s,t[8]=u,t[9]=i,t[10]=m):m=t[10];const h=m,p=l!==null;let x;return t[11]!==h||t[12]!==l||t[13]!==f||t[14]!==p?(x={handleRunWorkflow:h,isPending:f,requiresInput:p,inputSchema:l},t[11]=h,t[12]=l,t[13]=f,t[14]=p,t[15]=x):x=t[15],x}function ri(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>await l({name:"CANCEL_EXECUTION",arguments:{executionId:f}}),t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleCancelWorkflow:d,isCancelling:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function ii(){const t=C.c(10),{org:e}=G(),{id:n}=ze();let s;t[0]!==n||t[1]!==e.id?(s={connectionId:n,orgId:e.id},t[0]=n,t[1]=e.id,t[2]=s):s=t[2];const i=ne(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=on(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function li(){const t=C.c(3),e=U(),{item:n}=fe(e);let s;return t[0]!==n||t[1]!==e?(s=e&&n?(()=>{const r={};return n?.input&&(r.input=n.input),r})():void 0,t[0]=n,t[1]=e,t[2]=s):s=t[2],s}function ci(t,e,n,s){if(!e)return[...t].sort(s);const i=n(e);return[...t].sort((r,l)=>{const c=n(r),a=n(l);return c===i?-1:a===i?1:s?s(r,l):0})}const dn=$r()(xs(t=>({viewMode:"visual",setViewMode:e=>t({viewMode:e}),showExecutionsList:!1,setShowExecutionsList:e=>t({showExecutionsList:e}),toggleExecutionsList:()=>t(e=>({showExecutionsList:!e.showExecutionsList}))}),{name:"workflow-view-mode"})),Ss=k.createContext([]);function ys(){return k.useContext(Ss)}function ai({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Fo;return{editor:t,char:s,pluginKey:i,command:({editor:r,range:l,props:c})=>{var a,d,u;const f=r.view.state.selection.$to.nodeAfter;(a=f?.text)!=null&&a.startsWith(" ")&&(l.to+=1),r.chain().focus().insertContentAt(l,[{type:n,attrs:{...c,mentionSuggestionChar:s}},{type:"text",text:" "}]).run(),(u=(d=r.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:r,range:l})=>{const c=r.doc.resolve(l.from),a=r.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(a)},...e}}function ws(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>ai({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function In(t,e){const n=ws(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var di=Lo.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,s;return`${(n=e?.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var s,i;return["span",Qe(this.HTMLAttributes,t.HTMLAttributes),`${(s=n?.char)!=null?s:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=In(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Qe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Qe({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Qe({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...Wo({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let s=n.exec(t);for(;s!==null;){const[,i,r,l]=s,c=r??l;e[i==="char"?"mentionSuggestionChar":i]=c,s=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:In(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:s}=e,{empty:i,anchor:r}=s;if(!i)return!1;let l=new zo,c=0;return e.doc.nodesBetween(r-1,r,(a,d)=>{if(a.type.name===this.name)return n=!0,l=a,c=d,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,c,c+l.nodeSize),n})}},addProseMirrorPlugins(){return ws(this).map(Do)}}),ui=di,Ot,mt="HoverCard",[Ns]=Pn(mt,[An]),pt=An(),[fi,xt]=Ns(mt),Cs=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=pt(e),d=k.useRef(0),u=k.useRef(0),f=k.useRef(!1),m=k.useRef(!1),[h,p]=Ht({prop:s,defaultProp:i??!1,onChange:r,caller:mt}),x=k.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),g=k.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=k.useCallback(()=>p(!1),[p]);return k.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(fi,{scope:e,open:h,onOpenChange:p,onOpen:x,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(io,{...a,children:n})})};Cs.displayName=mt;var ks="HoverCardTrigger",Is=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=xt(ks,n),r=pt(n);return o.jsx(oo,{asChild:!0,...r,children:o.jsx(Ft.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:de(t.onPointerEnter,it(i.onOpen)),onPointerLeave:de(t.onPointerLeave,it(i.onClose)),onFocus:de(t.onFocus,i.onOpen),onBlur:de(t.onBlur,i.onClose),onTouchStart:de(t.onTouchStart,l=>l.preventDefault())})})});Is.displayName=ks;var un="HoverCardPortal",[mi,pi]=Ns(un,{forceMount:void 0}),_s=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=xt(un,e);return o.jsx(mi,{scope:e,forceMount:n,children:o.jsx(Rn,{present:n||r.open,children:o.jsx(ro,{asChild:!0,container:i,children:s})})})};_s.displayName=un;var rt="HoverCardContent",Es=k.forwardRef((t,e)=>{const n=pi(rt,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=xt(rt,t.__scopeHoverCard);return o.jsx(Rn,{present:s||r.open,children:o.jsx(xi,{"data-state":r.open?"open":"closed",...i,onPointerEnter:de(t.onPointerEnter,it(r.onOpen)),onPointerLeave:de(t.onPointerLeave,it(r.onClose)),ref:e})})});Es.displayName=rt;var xi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=xt(rt,n),d=pt(n),u=k.useRef(null),f=Mn(e,u),[m,h]=k.useState(!1);return k.useEffect(()=>{if(m){const p=document.body;return Ot=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=Ot,p.style.webkitUserSelect=Ot}}},[m]),k.useEffect(()=>{if(u.current){const p=()=>{h(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),k.useEffect(()=>{u.current&&bi(u.current).forEach(x=>x.setAttribute("tabindex","-1"))}),o.jsx(lo,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:de(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(co,{...d,...c,onPointerDown:de(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&h(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),hi="HoverCardArrow",gi=k.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=pt(n);return o.jsx(ao,{...i,...s,ref:e})});gi.displayName=hi;function it(t){return e=>e.pointerType==="touch"?void 0:t()}function bi(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)e.push(n.currentNode);return e}var ji=Cs,vi=Is,Si=_s,yi=Es;function wi(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(ji,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ni(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(vi,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Ci(t){const e=C.c(12);let n,s,i,r;e[0]!==t?({className:n,align:i,sideOffset:r,...s}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i,e[4]=r):(n=e[1],s=e[2],i=e[3],r=e[4]);const l=i===void 0?"center":i,c=r===void 0?4:r;let a;e[5]!==n?(a=M("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",n),e[5]=n,e[6]=a):a=e[6];let d;return e[7]!==l||e[8]!==s||e[9]!==c||e[10]!==a?(d=o.jsx(Si,{"data-slot":"hover-card-portal",children:o.jsx(yi,{"data-slot":"hover-card-content",align:l,sideOffset:c,className:a,...s})}),e[7]=l,e[8]=s,e[9]=c,e[10]=a,e[11]=d):d=e[11],d}const Ts=k.createContext(void 0);function ki(t,e){const n=e.split("."),s=n[0];if(!s)return;let i=t[s];for(let r=1;r<n.length&&i!==void 0;r++){const l=n[r];if(l)if(typeof i=="object"&&i!==null)i=i[l];else return}return i}function Ii(t){const e=C.c(20),{node:n}=t,s=k.useContext(Ts),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const x=r?ki(s,i):void 0;l=x!==void 0?typeof x=="object"?JSON.stringify(x,null,2):String(x):void 0,e[0]=r,e[1]=i,e[2]=s,e[3]=l}else l=e[3];const c=l;let a;e[4]!==i?(a=o.jsxs("span",{className:"bg-primary/20 text-primary px-1 rounded font-medium cursor-pointer",children:["@",i]}),e[4]=i,e[5]=a):a=e[5];const d=a;if(!r||c===void 0){let x;return e[6]!==d?(x=o.jsx(vn,{as:"span",children:d}),e[6]=d,e[7]=x):x=e[7],x}let u;e[8]!==d?(u=o.jsx(Ni,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let h;e[14]!==f||e[15]!==m?(h=o.jsx(Ci,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=h):h=e[16];let p;return e[17]!==u||e[18]!==h?(p=o.jsx(vn,{as:"span",children:o.jsxs(wi,{openDelay:200,children:[u,h]})}),e[17]=u,e[18]=h,e[19]=p):p=e[19],p}function $s(t){const e=[];function n(s){for(const i of s)i.children?.length||e.push(i),i.children&&n(i.children)}return n(t),e}let ue=Os();function Os(){return an(()=>({items:[],selectedIndex:0,command:null}))}function _n(t,e){ue.setState({items:t,command:e,selectedIndex:0})}function _i(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e-1+t.length)%t.length})}function Ei(){const{items:t,selectedIndex:e}=ue.getState();t.length&&ue.setState({selectedIndex:(e+1)%t.length})}function Rs(){const{items:t,selectedIndex:e,command:n}=ue.getState(),s=t[e];return s?(n?.(s),!0):!1}function En(){ue=Os()}function Ti(){const t=C.c(7),e=Pt(ue,Oi),n=Pt(ue,$i);if(!e.length)return null;let s;if(t[0]!==e||t[1]!==n){let r;t[3]!==n?(r=(l,c)=>o.jsx("button",{type:"button",onClick:()=>{ue.setState({selectedIndex:c}),Rs()},className:M("flex items-center w-full text-left px-3 py-1.5 text-sm rounded-md transition-colors",c===n?"bg-accent text-accent-foreground":"hover:bg-muted"),children:l.label},l.id),t[3]=n,t[4]=r):r=t[4],s=e.map(r),t[0]=e,t[1]=n,t[2]=s}else s=t[2];let i;return t[5]!==s?(i=o.jsx("div",{className:"bg-popover border border-border rounded-lg shadow-lg overflow-hidden min-w-[180px]",children:o.jsx("div",{className:"p-1",children:s})}),t[5]=s,t[6]=i):i=t[6],i}function $i(t){return t.selectedIndex}function Oi(t){return t.items}function Ri(){let t=null,e=null;return{onStart:n=>{_n(n.items,n.command),t=new Bo(Ti,{editor:n.editor}),e=document.createElement("div"),e.style.cssText="position:absolute;z-index:9999";const s=n.clientRect?.();s&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`),e.appendChild(t.element),document.body.appendChild(e)},onUpdate:n=>{_n(n.items,n.command);const s=n.clientRect?.();s&&e&&(e.style.top=`${s.bottom+window.scrollY+4}px`,e.style.left=`${s.left+window.scrollX}px`)},onKeyDown:({event:n})=>n.key==="Escape"?(e?.remove(),t?.destroy(),En(),!0):n.key==="ArrowUp"?(_i(),!0):n.key==="ArrowDown"?(Ei(),!0):n.key==="Enter"?Rs():!1,onExit:()=>{e?.remove(),t?.destroy(),En()}}}const Rt=/@([\w.]+)/g;function Ai(t,e){if(!t)return null;const n=$s(e),s=new Map(n.map(a=>[a.id,a]));if(!Rt.test(t))return t;Rt.lastIndex=0;const r=[];let l=0,c;for(;(c=Rt.exec(t))!==null;){const a=c[1]??"",d=c.index;d>l&&r.push({type:"text",text:t.slice(l,d)});const u=s.get(a);u?r.push({type:"mention",attrs:{id:u.id,label:u.label}}):r.push({type:"text",text:c[0]}),l=d+c[0].length}return l<t.length&&r.push({type:"text",text:t.slice(l)}),{type:"doc",content:[{type:"paragraph",content:r.length>0?r:void 0}]}}function fn(t){const e=C.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=li();let d;e[0]!==n||e[1]!==s?(d=Ai(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let h;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=Ho.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=h):h=e[3];let p;if(e[4]!==n||e[5]!==f){let T;e[7]!==n?(T=$=>{const{query:R}=$;return $s(n).filter(I=>I.label.toLowerCase().includes(R.toLowerCase())||I.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],p=ui.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Di,renderHTML:Li,suggestion:{items:T,render:Ri,command:Pi}}).extend(f?{addNodeView(){return Vo(Ii)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let x;e[9]!==p?(x=[h,p],e[9]=p,e[10]=x):x=e[10];const g=r??"";let b;e[11]!==g?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":g},handleKeyDown:Mi},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:$}=T;return i?.($.getText().trim())},e[13]=i,e[14]=j):j=e[14];let S;e[15]!==u||e[16]!==m||e[17]!==x||e[18]!==b||e[19]!==j?(S={content:u,editable:m,extensions:x,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=x,e[18]=b,e[19]=j,e[20]=S):S=e[20];const y=Uo(S);let v;e[21]!==l?(v=M("rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",l),e[21]=l,e[22]=v):v=e[22];let w;e[23]!==y?(w=o.jsx(qo,{editor:y}),e[23]=y,e[24]=w):w=e[24];let N;e[25]!==v||e[26]!==w?(N=o.jsx("div",{className:v,children:w}),e[25]=v,e[26]=w,e[27]=N):N=e[27];const E=N;if(a!==void 0){let T;return e[28]!==E||e[29]!==a?(T=o.jsx(Ts.Provider,{value:a,children:E}),e[28]=E,e[29]=a,e[30]=T):T=e[30],T}return E}function Mi(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Pi(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Li(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Di(t){const{node:e}=t;return`@${e.attrs.id}`}function zi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Wi(t){const e=C.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=ys(),c=n??"";let a;e[0]!==s?(a=f=>s(f),e[0]=s,e[1]=a):a=e[1];const d=i||"Enter value...";let u;return e[2]!==l||e[3]!==r||e[4]!==c||e[5]!==a||e[6]!==d?(u=o.jsx(fn,{mentions:l,value:c,onChange:a,placeholder:d,readOnly:r,className:"min-h-[80px]"}),e[2]=l,e[3]=r,e[4]=c,e[5]=a,e[6]=d,e[7]=u):u=e[7],u}function Fi(t){const e=C.c(8),{value:n,onChange:s,readonly:i,id:r}=t,l=n??"";let c;e[0]!==s?(c=u=>s(u.target.value===""?void 0:Number(u.target.value)),e[0]=s,e[1]=c):c=e[1];let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),e[2]=a):a=e[2];let d;return e[3]!==r||e[4]!==i||e[5]!==l||e[6]!==c?(d=o.jsx("input",{id:r,type:"number",value:l,onChange:c,disabled:i,className:a}),e[3]=r,e[4]=i,e[5]=l,e[6]=c,e[7]=d):d=e[7],d}function Hi(t){const e=C.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Vi(t){const e=C.c(14),{value:n,onChange:s,readonly:i,id:r,options:l}=t;let c;e[0]!==l.enumOptions?(c=l.enumOptions??[],e[0]=l.enumOptions,e[1]=c):c=e[1];const a=c,d=n??"";let u;e[2]!==s?(u=x=>s(x.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=M("w-full rounded-md border border-input bg-background px-3 py-2 text-sm","ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let h;e[6]!==a?(h=a.map(Ui),e[6]=a,e[7]=h):h=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==h?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,h]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=h,e[13]=p):p=e[13],p}function Ui(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Bi={TextWidget:zi,TextareaWidget:Wi,NumberWidget:Fi,CheckboxWidget:Hi,SelectWidget:Vi};function qi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function Ki(t){const e=C.c(36),{id:n,label:s,required:i,description:r,children:l,schema:c,hidden:a}=t;if(a){let v;return e[0]!==l?(v=o.jsx("div",{className:"hidden",children:l}),e[0]=l,e[1]=v):v=e[1],v}if(n==="root"){let v;return e[2]!==l?(v=o.jsx("div",{className:"space-y-4",children:l}),e[2]=l,e[3]=v):v=e[3],v}const d=Array.isArray(c.type)?c.type[0]:c.type??"string";let u,f,m,h,p,x,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:w}=qi(d);g="space-y-2",h="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(x=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=x):x=e[19],u=v,f=14,m=M(w,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=h,e[12]=p,e[13]=x,e[14]=g}else u=e[8],f=e[9],m=e[10],h=e[11],p=e[12],x=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==h||e[25]!==p||e[26]!==x||e[27]!==b?(j=o.jsxs("div",{className:h,children:[p,x,b]}),e[24]=h,e[25]=p,e[26]=x,e[27]=b,e[28]=j):j=e[28];let S;e[29]!==r?(S=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=S):S=e[30];let y;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==S?(y=o.jsxs("div",{className:g,children:[j,S,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=S,e[35]=y):y=e[35],y}function Ji(t){const e=C.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(Xi),e[0]=n,e[1]=c):c=e[1];let a;return e[2]!==c?(a=o.jsx("div",{className:"space-y-4",children:c}),e[2]=c,e[3]=a):a=e[3],a}let r;e[4]!==n?(r=n.map(Gi),e[4]=n,e[5]=r):r=e[5];let l;return e[6]!==r?(l=o.jsx("div",{className:"pl-4 border-l-2 border-border/50 space-y-4",children:r}),e[6]=r,e[7]=l):l=e[7],l}function Gi(t){return o.jsx("div",{children:t.content},t.name)}function Xi(t){return o.jsx("div",{children:t.content},t.name)}function Qi(t){const e=C.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Zi),e[0]=n,e[1]=l):l=e[1];let c;e[2]!==l?(c=o.jsx("div",{className:"space-y-2",children:l}),e[2]=l,e[3]=c):c=e[3];let a;e[4]!==s||e[5]!==i||e[6]!==r?(a=s&&o.jsxs(Y,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:i,children:["+ Add ",r||"item"]}),e[4]=s,e[5]=i,e[6]=r,e[7]=a):a=e[7];let d;return e[8]!==c||e[9]!==a?(d=o.jsxs("div",{className:"space-y-2",children:[c,a]}),e[8]=c,e[9]=a,e[10]=d):d=e[10],d}function Zi(t){return o.jsx("div",{className:"flex gap-2 items-start",children:o.jsx("div",{className:"flex-1",children:t})},t.key||t.index)}function Yi(){return null}function el(){return null}const tl={FieldTemplate:Ki,ObjectFieldTemplate:Ji,ArrayFieldTemplate:Qi,UnsupportedFieldTemplate:Yi,ErrorListTemplate:el};function nl(t){const e=C.c(6),{inputSchema:n,inputParams:s,mentions:i}=t;if(!n?.properties||!s)return null;let r;e[0]!==i?(r=(a,d,u)=>{const f=typeof d=="object"&&d!==null?JSON.stringify(d,null,2):String(d??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(fn,{mentions:i,value:f,readOnly:!0,className:"border-0 bg-transparent p-0"})})]},a)},e[0]=i,e[1]=r):r=e[1];const l=r;let c;return e[2]!==s||e[3]!==n.properties||e[4]!==l?(c=o.jsx("div",{className:"space-y-4",children:Object.entries(n.properties).map(a=>{const[d,u]=a,f=s[d];return l(d,f,u)})}),e[2]=s,e[3]=n.properties,e[4]=l,e[5]=c):c=e[5],c}function As({inputSchema:t,inputParams:e,setInputParams:n,handleInputChange:s,mentions:i,readOnly:r}){const l=i??[];if(!t)return o.jsx("div",{className:"text-sm text-muted-foreground italic",children:"No arguments defined in schema."});if(r)return o.jsx(nl,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=k.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[h,p]of Object.entries(f))m[h]!==p&&s(h,p);for(const h of Object.keys(m))h in f||s(h,void 0)}a.current=f};return o.jsx(Ss.Provider,{value:l,children:o.jsx(_o,{schema:c,formData:e,onChange:d,validator:Eo,widgets:Bi,templates:tl,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function sl(t){const e=C.c(33),{open:n,onOpenChange:s,inputSchema:i,onSubmit:r,isPending:l}=t;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c={},e[0]=c):c=e[0];const[a,d]=k.useState(c);let u;e[1]!==a||e[2]!==s||e[3]!==r?(u=async()=>{await r(a),s(!1),d({})},e[1]=a,e[2]=s,e[3]=r,e[4]=u):u=e[4];const f=u;let m;e[5]!==s?(m=E=>{E||d({}),s(E)},e[5]=s,e[6]=m):m=e[6];const h=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(Go,{children:[o.jsx(Xo,{children:"Workflow Input"}),o.jsx(Qo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=[],e[8]=x):x=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(As,{inputSchema:i,inputParams:a,setInputParams:d,mentions:x})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==h?(b=()=>h(!1),e[12]=h,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(Y,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let S;e[17]!==l?(S=l?o.jsx(ut,{size:"xs"}):o.jsx(tn,{size:14}),e[17]=l,e[18]=S):S=e[18];let y;e[19]!==f||e[20]!==l||e[21]!==S?(y=o.jsxs(Y,{onClick:f,disabled:l,className:"gap-2",children:[S,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=S,e[22]=y):y=e[22];let v;e[23]!==y||e[24]!==j?(v=o.jsxs(Zo,{children:[j,y]}),e[23]=y,e[24]=j,e[25]=v):v=e[25];let w;e[26]!==v||e[27]!==g?(w=o.jsxs(Yo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,g,v]}),e[26]=v,e[27]=g,e[28]=w):w=e[28];let N;return e[29]!==h||e[30]!==n||e[31]!==w?(N=o.jsx(er,{open:n,onOpenChange:h,children:w}),e[29]=h,e[30]=n,e[31]=w,e[32]=N):N=e[32],N}function ol(t){const e=C.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=Wt().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=dn(),{resetToOriginalWorkflow:m,setSelectedVirtualMcpId:h}=ee(),p=bs(),x=Ge(),g=U();let b;e[0]!==n?(b=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==s?(j=s?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"•"}),o.jsx("span",{className:"text-xs text-muted-foreground font-normal truncate min-w-0 max-w-[20ch]",children:s})]}):null,e[2]=s,e[3]=j):j=e[3];let S;e[4]!==b||e[5]!==j?(S=o.jsx(Wn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=S):S=e[6];let y;e[7]!==p||e[8]!==r||e[9]!==i||e[10]!==m||e[11]!==x||e[12]!==h||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(y=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Fn,{onSave:i,onUndo:m,isDirty:p,isSaving:r,saveLabel:"Save workflow",undoLabel:"Reset changes"}),o.jsx(k.Suspense,{fallback:o.jsx(ut,{size:"xs"}),children:o.jsx(Kr,{selectedVirtualMcpId:x,onVirtualMcpChange:h,placeholder:"Select Agent"})}),o.jsx(Po,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(fs,{})},{value:"code",icon:o.jsx(as,{})}]}),o.jsx(qt,{title:n,url:c,icon:"workflow"}),o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(Y,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(cs,{size:14})})})}),o.jsx(en,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=p,e[8]=r,e[9]=i,e[10]=m,e[11]=x,e[12]=h,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=y):y=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(ll,{}),e[21]=v):v=e[21];let w;e[22]!==y?(w=o.jsxs(Xt,{children:[y,v]}),e[22]=y,e[23]=w):w=e[23];let N;return e[24]!==S||e[25]!==w?(N=o.jsxs(o.Fragment,{children:[S,w]}),e[24]=S,e[25]=w,e[26]=N):N=e[26],N}function rl(){const t=U(),{item:e}=fe(t);return e?.completed_at_epoch_ms!=null}function il(){const t=U(),{item:e}=fe(t);return e?.status==="cancelled"}function ll(){const t=C.c(58),e=bs(),n=rl(),s=il(),i=U(),r=Ge(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=oi(),u=Je(),[f,m]=k.useState(!1),{handleCancelWorkflow:h,isCancelling:p}=ri(),{handleResumeWorkflow:x,isResuming:g}=ii(),b=i&&!n;let j;t[0]!==u?(j=u.some(cl),t[0]=u,t[1]=j):j=t[1];const S=j,y=!r,v=u.length===0,w=e||v||S||y||c||p,N=b||c;let E;t[2]!==S||t[3]!==y||t[4]!==e||t[5]!==s||t[6]!==N||t[7]!==v?(E=()=>s?"Workflow is currently cancelled":N?"Workflow is currently running":e?"Save your changes before running":y?"Select an Agent first":v||S?"Add at least one step to the workflow":null,t[2]=S,t[3]=y,t[4]=e,t[5]=s,t[6]=N,t[7]=v,t[8]=E):E=t[8];const $=E();let R;t[9]!==h||t[10]!==x||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==N||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){m(!0);return}if(s&&i){await x(i);return}if(N&&i){await h(i);return}await l({})},t[9]=h,t[10]=x,t[11]=l,t[12]=d,t[13]=s,t[14]=N,t[15]=a,t[16]=i,t[17]=R):R=t[17];const L=R;let I;t[18]!==l?(I=async J=>{await l(J)},t[18]=l,t[19]=I):I=t[19];const A=I,W=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",z=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let X;t[20]!==z?(X=M("gap-2 h-7 px-3",z),t[20]=z,t[21]=X):X=t[21];let _;t[22]!==p||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?(_=(!b&&!c&&!p&&!g||s)&&o.jsx(tn,{size:14}),t[22]=p,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=_):_=t[27];let O;t[28]!==p||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(O=b&&!c&&!p&&!g&&!s&&o.jsx(Ko,{size:14}),t[28]=p,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=O):O=t[33];let P;t[34]!==p||t[35]!==c||t[36]!==g?(P=(c||p||g)&&o.jsx(ut,{size:"xs"}),t[34]=p,t[35]=c,t[36]=g,t[37]=P):P=t[37];let Q;t[38]!==W||t[39]!==L||t[40]!==w||t[41]!==X||t[42]!==_||t[43]!==O||t[44]!==P?(Q=o.jsxs(Y,{variant:"default",size:"sm",className:X,disabled:w,onClick:L,children:[_,O,P,W]}),t[38]=W,t[39]=L,t[40]=w,t[41]=X,t[42]=_,t[43]=O,t[44]=P,t[45]=Q):Q=t[45];const Z=Q;let F;t[46]!==Z||t[47]!==$?(F=$?o.jsx(Qt,{children:o.jsxs(Zt,{delayDuration:0,children:[o.jsx(Yt,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:Z})}),o.jsx(en,{side:"bottom",children:$})]})}):Z,t[46]=Z,t[47]=$,t[48]=F):F=t[48];const K=F;let B;t[49]!==A||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(sl,{open:f,onOpenChange:m,inputSchema:d,onSubmit:A,isPending:c}),t[49]=A,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let H;return t[55]!==K||t[56]!==B?(H=o.jsxs(o.Fragment,{children:[K,B]}),t[55]=K,t[56]=B,t[57]=H):H=t[57],H}function cl(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function Tn(t,e){for(const n of e)if(n===t||n.startsWith(`${t}[`))return!0;return!1}function al(){const t=C.c(13),e=U(),n=Je(),{item:s}=fe(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.error||t[3]!==s.running_steps||t[4]!==s.status||t[5]!==n){i={};let r;t[7]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(dl)??[]),t[7]=s.completed_steps?.success,t[8]=r):r=t[8];const l=r,c=s.completed_steps?.error??[];let a;t[9]!==s.running_steps?(a=s.running_steps??[],t[9]=s.running_steps,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d,f=s.status,m=s.error!=null?typeof s.error=="string"?s.error:JSON.stringify(s.error):void 0;let h=-1;n.forEach((p,x)=>{(l.has(p.name)||Tn(p.name,c))&&(h=x)}),n.forEach((p,x)=>{let g="pending",b;Tn(p.name,c)?(g="error",b=m):l.has(p.name)?g="success":(f==="error"||f==="failed")&&u.has(p.name)?(g="error",b=m):f==="running"&&x===h+1&&(g="running"),i[p.name]={status:g,output:void 0,error:b,stepIndex:x}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.error,t[3]=s.running_steps,t[4]=s.status,t[5]=n,t[6]=i}else i=t[6];return i}function dl(t){return t.name}function ul(t){const e=C.c(97),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=U(),{item:m}=fe(f),h=m?.completed_steps,p=h?.success,x=h?.error??[];let g;e[0]!==n.name||e[1]!==p?(g=p?.find(D=>D.name===n.name),e[0]=n.name,e[1]=p,e[2]=g):g=e[2];const b=g,j=b?.completed_at_epoch_ms,S=b!=null;let y;e[3]!==n.name?(y=D=>D===n.name||D.startsWith(`${n.name}[`),e[3]=n.name,e[4]=y):y=e[4];const v=x.some(y),w="toolName"in n.action,N=w&&"connectionId"in n.action?n.action.connectionId:null,T=!!(w&&"toolName"in n.action?n.action.toolName:null),$=yl(n),L=(m?.status==="error"||m?.status==="failed")&&m?.running_steps?.includes(n.name),I=S?"success":v||L?"error":r?.status,A=r!==void 0,W=I==="success"||I==="error";let z=$.length>0?60:12;(I==="success"||I==="error")&&(z=z+32);const X=pl(I);let _;e[5]!==I?(_=xl(I),e[5]=I,e[6]=_):_=e[6];const O=_;let P;e[7]===Symbol.for("react.memo_cache_sentinel")?(P=function(kt,Xs){const bn=Xs.split(".").slice(1);if(bn.length===0)return Array.isArray(kt)?kt:void 0;let xe=kt;for(const Qs of bn){if(xe==null)return;if(typeof xe=="object")xe=xe[Qs];else return}return Array.isArray(xe)?xe:void 0},e[7]=P):P=e[7];const Q=P,Z=n.forEach!==void 0,F=n.forEach?.ref;let K;e[8]!==F?(K=F?.replace("@","").split(".")[0],e[8]=F,e[9]=K):K=e[9];const B=K,H=m?.status==="running"||m?.status==="enqueued";let J;e[10]!==p||e[11]!==B?(J=p?.some(D=>D.name===B),e[10]=p,e[11]=B,e[12]=J):J=e[12];const ie=J,le=H?500:!1;let se;e[13]!==ie||e[14]!==le?(se={refetchInterval:le,enabled:ie},e[13]=ie,e[14]=le,e[15]=se):se=e[15];const{output:ce}=js(f,B,se);let oe;if(e[16]!==ce||e[17]!==F){const D=F?.replace("@","");oe=D?Q(ce,D):void 0,e[16]=ce,e[17]=F,e[18]=oe}else oe=e[18];const ae=oe;let V;if(e[19]!==n.name){let D;e[21]===Symbol.for("react.memo_cache_sentinel")?(D=/[.*+?^${}()|[\]\\]/g,e[21]=D):D=e[21],V=n.name.replace(D,"\\$&"),e[19]=n.name,e[20]=V}else V=e[20];const We=V,gn=new RegExp(`^${We}\\[\\d+\\]$`),bt=m?.completed_steps?.success?.filter(D=>gn.test(D.name)),Fe=x.filter(D=>gn.test(D)),jt=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",vt=I==="running"&&"bg-accent/50",St=l&&"opacity-50";let ge;e[22]!==jt||e[23]!==vt||e[24]!==St?(ge=M("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",jt,vt,St),e[22]=jt,e[23]=vt,e[24]=St,e[25]=ge):ge=e[25];const Ks="button",Js=0;let be;e[26]!==a?(be=D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),a())},e[26]=a,e[27]=be):be=e[27];const yt=M("text-xs font-mono opacity-75 h-8 flex items-center",X),wt=s+1;let je;e[28]!==yt||e[29]!==wt?(je=o.jsx("div",{className:"w-5 flex flex-col items-center justify-center shrink-0 pt-3",children:o.jsxs("span",{className:yt,children:[wt,"."]})}),e[28]=yt,e[29]=wt,e[30]=je):je=e[30];let ve;e[31]!==O||e[32]!==s?(ve=s>0?o.jsx(At,{height:12,color:O}):o.jsx("div",{className:"h-3"}),e[31]=O,e[32]=s,e[33]=ve):ve=e[33];let Se;e[34]!==N||e[35]!==T||e[36]!==w||e[37]!==n.name?(Se=o.jsx(vl,{connectionId:N,isToolStep:w,hasToolSelected:T,stepName:n.name}),e[34]=N,e[35]=T,e[36]=w,e[37]=n.name,e[38]=Se):Se=e[38];let ye;e[39]!==O||e[40]!==W||e[41]!==I?(ye=W&&o.jsxs(o.Fragment,{children:[o.jsx(At,{height:8,color:O}),o.jsx(hl,{status:I})]}),e[39]=O,e[40]=W,e[41]=I,e[42]=ye):ye=e[42];let we;e[43]!==O||e[44]!==z||e[45]!==c||e[46]!==f?(we=c&&f?null:o.jsx(At,{height:z,color:O}),e[43]=O,e[44]=z,e[45]=c,e[46]=f,e[47]=we):we=e[47];let Ne;e[48]!==ve||e[49]!==Se||e[50]!==ye||e[51]!==we?(Ne=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[ve,Se,ye,we]}),e[48]=ve,e[49]=Se,e[50]=ye,e[51]=we,e[52]=Ne):Ne=e[52];const Gs="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",Nt=T?"font-medium text-foreground":"text-foreground";let Ce;e[53]!==Nt?(Ce=M("text-sm truncate flex-1",Nt),e[53]=Nt,e[54]=Ce):Ce=e[54];let ke;e[55]!==n?(ke=Sl(n),e[55]=n,e[56]=ke):ke=e[56];let Ie;e[57]!==Ce||e[58]!==ke?(Ie=o.jsx("span",{className:Ce,children:ke}),e[57]=Ce,e[58]=ke,e[59]=Ie):Ie=e[59];let _e;e[60]!==bt?.length||e[61]!==Fe||e[62]!==Z||e[63]!==ae?(_e=Z&&ae&&ae.length>0&&o.jsxs("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center gap-1",children:[`${(bt?.length??0)+Fe.length} / ${ae.length}`,Fe.length>0&&o.jsxs("span",{className:"text-destructive",children:["(",Fe.length," failed)"]})]}),e[60]=bt?.length,e[61]=Fe,e[62]=Z,e[63]=ae,e[64]=_e):_e=e[64];let Ee;e[65]!==A||e[66]!==I?(Ee=A&&o.jsx(gl,{status:I}),e[65]=A,e[66]=I,e[67]=Ee):Ee=e[67];let Te;e[68]!==_e||e[69]!==Ee?(Te=o.jsxs("div",{className:"flex items-center gap-2",children:[_e,Ee]}),e[68]=_e,e[69]=Ee,e[70]=Te):Te=e[70];let $e;e[71]!==A||e[72]!==d||e[73]!==u?($e=!A&&o.jsxs(ir,{children:[o.jsx(lr,{asChild:!0,children:o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:ml,children:o.jsx(tr,{size:14})})}),o.jsxs(cr,{align:"end",children:[o.jsxs(Sn,{onClick:D=>{D.stopPropagation(),u()},children:[o.jsx(mr,{size:14}),"Duplicate"]}),o.jsxs(Sn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:D=>{D.stopPropagation(),d()},children:[o.jsx(uo,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[71]=A,e[72]=d,e[73]=u,e[74]=$e):$e=e[74];let Oe;e[75]!==Ie||e[76]!==Te||e[77]!==$e?(Oe=o.jsxs("div",{className:"flex items-center h-8",children:[Ie,Te,$e]}),e[75]=Ie,e[76]=Te,e[77]=$e,e[78]=Oe):Oe=e[78];const Ct=$.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:$.map(fl)});let Re;e[79]!==I||e[80]!==j?(Re=I==="success"&&o.jsx(bl,{completedAtEpochMs:j}),e[79]=I,e[80]=j,e[81]=Re):Re=e[81];let Ae;e[82]!==r?.error||e[83]!==I?(Ae=I==="error"&&o.jsx(jl,{error:r?.error}),e[82]=r?.error,e[83]=I,e[84]=Ae):Ae=e[84];let Me;e[85]!==Oe||e[86]!==Ct||e[87]!==Re||e[88]!==Ae?(Me=o.jsxs("div",{className:Gs,children:[Oe,Ct,Re,Ae]}),e[85]=Oe,e[86]=Ct,e[87]=Re,e[88]=Ae,e[89]=Me):Me=e[89];let Xe;return e[90]!==a||e[91]!==ge||e[92]!==be||e[93]!==je||e[94]!==Ne||e[95]!==Me?(Xe=o.jsxs("div",{className:ge,onClick:a,role:Ks,tabIndex:Js,onKeyDown:be,children:[je,Ne,Me]}),e[90]=a,e[91]=ge,e[92]=be,e[93]=je,e[94]=Ne,e[95]=Me,e[96]=Xe):Xe=e[96],Xe}function fl(t){return o.jsx("span",{className:"px-1.5 py-1 text-xs text-muted-foreground bg-background border border-border rounded-lg",children:t},t)}function ml(t){return t.stopPropagation()}function pl(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function xl(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function hl(t){const e=C.c(2),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-success flex items-center justify-center",children:o.jsx(ft,{size:8,className:"text-success-foreground"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-4 rounded bg-destructive flex items-center justify-center",children:o.jsx(at,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function gl(t){const e=C.c(3),{status:n}=t;if(n==="success"){let s;return e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(ft,{size:11,className:"text-success"})}),e[0]=s):s=e[0],s}if(n==="error"){let s;return e[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(at,{size:11,className:"text-destructive"})}),e[1]=s):s=e[1],s}if(n==="running"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"size-7 flex items-center justify-center",children:o.jsx(Ue,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function bl(t){const e=C.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null&&n>0?new Date(n):null,d=a&&!Number.isNaN(a.getTime());s=d?a.toISOString().split("T")[0]:null,i=d?a.toTimeString().split(" ")[0]:null,e[0]=n,e[1]=s,e[2]=i}else s=e[1],i=e[2];const r=i;let l;e[3]!==s||e[4]!==r?(l=s&&r&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(To,{size:16,className:"text-success"}),o.jsx("span",{className:"text-xs text-success",children:s}),o.jsx("span",{className:"text-xs text-success",children:r})]}),e[3]=s,e[4]=r,e[5]=l):l=e[5];let c;return e[6]!==l?(c=o.jsx("div",{className:"inline-flex items-center gap-3 px-1.5 py-1 bg-success-foreground rounded-lg w-fit",children:l}),e[6]=l,e[7]=c):c=e[7],c}function jl(t){const e=C.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Zn,{size:16,className:"text-destructive"}),e[0]=s):s=e[0];const i=n||"Execution failed";let r;return e[1]!==i?(r=o.jsxs("div",{className:"inline-flex items-center gap-1.5 px-1.5 py-1 bg-destructive-foreground rounded-lg w-fit",children:[s,o.jsx("span",{className:"text-xs text-destructive",children:i})]}),e[1]=i,e[2]=r):r=e[2],r}function vl(t){const e=C.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=ct(n??"");if(s&&i&&l?.icon){let a;return e[0]!==l.icon||e[1]!==r?(a=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:o.jsx(dt,{icon:l.icon,name:r,size:"xs",className:"border-0 rounded-none"})}),e[0]=l.icon,e[1]=r,e[2]=a):a=e[2],a}let c;return e[3]!==s?(c=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center",children:s?o.jsx(nr,{size:16,className:"text-muted-foreground"}):o.jsx(fr,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function At(t){const e=C.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=M("w-px",i),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==n?(l={height:n},e[2]=n,e[3]=l):l=e[3];let c;return e[4]!==r||e[5]!==l?(c=o.jsx("div",{className:r,style:l}),e[4]=r,e[5]=l,e[6]=c):c=e[6],c}function Sl(t){return t.name?t.name:"toolName"in t.action&&t.action.toolName?t.action.toolName:"code"in t.action?t.name||"Code Step":"Select tool..."}function yl(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties??e.items?.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function wl(t){const e=C.c(32),{className:n}=t,s=Je(),i=gs(),r=al(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=ee(),d=U();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(S=>r[S.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let h;e[4]!==n?(h=M("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=h):h=e[5];let p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let S;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(S=(y,v)=>{const w=r?.[y.name],N=f!==-1&&v>f&&w?.status==="pending",E=v===s.length-1;return o.jsx(ul,{step:y,index:v,isSelected:y.name===i,executionStatus:w,isSkipped:N,isLastStep:E,onSelect:()=>l(y.name),onDelete:()=>c(y.name),onDuplicate:()=>a(y.name)},y.name)},e[14]=i,e[15]=c,e[16]=a,e[17]=f,e[18]=l,e[19]=r,e[20]=s.length,e[21]=S):S=e[21],p=s.map(S),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let x;e[22]!==p?(x=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=x):x=e[23];let g;e[24]!==d?(g=d?null:o.jsx(Nl,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==x||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[x,g]}),e[26]=x,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==h||e[30]!==b?(j=o.jsx(k.Suspense,{fallback:m,children:o.jsx("div",{className:h,children:b})}),e[29]=h,e[30]=b,e[31]=j):j=e[31],j}function Nl(){const t=C.c(8),{addToolStep:e}=ee();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"w-5 shrink-0"}),t[0]=n):n=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"w-px h-3 bg-border"}),t[1]=s):s=t[1];let i;t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Qn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(Y,{variant:"outline",size:"icon",className:"size-8 rounded-lg",onClick:e,children:i}),t[3]=e,t[4]=r):r=t[4];let l;t[5]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"w-px h-8",style:{backgroundImage:"repeating-linear-gradient(180deg, var(--border), var(--border) 4px, transparent 4px, transparent 8px)",backgroundPosition:"left top",backgroundRepeat:"repeat-y",backgroundSize:"2px 100%"}}),t[5]=l):l=t[5];let c;return t[6]!==r?(c=o.jsxs("div",{className:"flex gap-2 items-start px-4 pb-3",children:[n,o.jsxs("div",{className:"flex flex-col border-1 border-transparent items-center shrink-0",children:[s,r,l]})]}),t[6]=r,t[7]=c):c=t[7],c}function Cl(){const t=C.c(14),{org:e}=G(),n=Ge();let s;t[0]!==e.id||t[1]!==n?(s=n??Be(e.id),t[0]=e.id,t[1]=n,t[2]=s):s=t[2];const i=s;let r;t[3]!==e.id||t[4]!==i?(r={connectionId:i,orgId:e.id},t[3]=e.id,t[4]=i,t[5]=r):r=t[5];const l=ne(r);let c;t[6]!==l?(c={client:l},t[6]=l,t[7]=c):c=t[7];const a=nn(c);let d;t[8]!==a.data?.tools?(d=a.data?.tools??[],t[8]=a.data?.tools,t[9]=d):d=t[9];let u;return t[10]!==d||t[11]!==a.error||t[12]!==a.isLoading?(u={tools:d,isLoading:a.isLoading,error:a.error},t[10]=d,t[11]=a.error,t[12]=a.isLoading,t[13]=u):u=t[13],u}function kl(t){const e=C.c(2),{className:n}=t;let s;return e[0]!==n?(s=o.jsx(Il,{className:n}),e[0]=n,e[1]=s):s=e[1],s}function Il(t){const e=C.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=Cl(),l=Ke(),{updateStep:c}=ee(),d=l&&"toolName"in l.action&&"toolName"in l.action?l.action.toolName:null;let u;if(e[0]!==d||e[1]!==s){let v;e[3]!==d?(v=w=>w.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=ci(s,u??null,El,_l);let h;e[5]!==l||e[6]!==c?(h=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=h):h=e[7];const p=h;if(i){let v;e[8]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(ut,{size:"sm"})}),e[10]=w):w=e[10];let N;return e[11]!==v?(N=o.jsx("div",{className:v,children:w}),e[11]=v,e[12]=N):N=e[12],N}if(r){let v;e[13]!==n?(v=M("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let w;e[15]!==r.message?(w=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-destructive p-4 text-center",children:["Failed to load tools: ",r.message]}),e[15]=r.message,e[16]=w):w=e[16];let N;return e[17]!==v||e[18]!==w?(N=o.jsx("div",{className:v,children:w}),e[17]=v,e[18]=w,e[19]=N):N=e[19],N}let x;e[20]!==n?(x=M("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=x):x=e[21];let g;e[22]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=g):g=e[22];let b;e[23]!==s.length?(b=o.jsx("div",{className:"flex items-start border-b border-border",children:o.jsxs("div",{className:"flex-1 flex items-center h-12 px-5",children:[g,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=w=>o.jsx(Tl,{icon:null,title:w.name,description:w.description,isSelected:w.name===d,onClick:()=>p(w)},w.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let S;e[32]!==j?(S=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=S):S=e[33];let y;return e[34]!==x||e[35]!==b||e[36]!==S?(y=o.jsxs("div",{className:x,children:[b,S]}),e[34]=x,e[35]=b,e[36]=S,e[37]=y):y=e[37],y}function _l(t,e){return t.name.localeCompare(e.name)}function El(t){return t.name}function Tl(t){const e=C.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=M("flex items-start gap-2.5 min-h-14 px-5 py-4 cursor-pointer transition-colors","hover:bg-muted/50",c),e[0]=c,e[1]=a):a=e[1];let d;e[2]!==l?(d=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(dt,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let h;e[11]!==f||e[12]!==m?(h=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=h):h=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==h?(p=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,h]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=h,e[19]=p):p=e[19],p}var re="Accordion",$l=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[mn,Ol,Rl]=mo(re),[ht]=Pn(re,[Rl,Yn]),pn=Yn(),Ms=q.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(mn.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Ll,{...r,ref:e}):o.jsx(Pl,{...i,ref:e})})});Ms.displayName=re;var[Ps,Al]=ht(re),[Ls,Ml]=ht(re,{collapsible:!1}),Pl=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Ht({prop:n,defaultProp:s??"",onChange:i,caller:re});return o.jsx(Ps,{scope:t.__scopeAccordion,value:q.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:q.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Ds,{...l,ref:e})})})}),Ll=q.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Ht({prop:n,defaultProp:s??[],onChange:i,caller:re}),a=q.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=q.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Ps,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Ls,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(Ds,{...r,ref:e})})})}),[Dl,gt]=ht(re),Ds=q.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=q.useRef(null),a=Mn(c,e),d=Ol(n),f=po(i)==="ltr",m=de(t.onKeyDown,h=>{if(!$l.includes(h.key))return;const p=h.target,x=d().filter(E=>!E.ref.current?.disabled),g=x.findIndex(E=>E.ref.current===p),b=x.length;if(g===-1)return;h.preventDefault();let j=g;const S=0,y=b-1,v=()=>{j=g+1,j>y&&(j=S)},w=()=>{j=g-1,j<S&&(j=y)};switch(h.key){case"Home":j=S;break;case"End":j=y;break;case"ArrowRight":r==="horizontal"&&(f?v():w());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?w():v());break;case"ArrowUp":r==="vertical"&&w();break}const N=j%b;x[N].ref.current?.focus()});return o.jsx(Dl,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(mn.Slot,{scope:n,children:o.jsx(Ft.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),lt="AccordionItem",[zl,xn]=ht(lt),zs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=gt(lt,n),l=Al(lt,n),c=pn(n),a=fo(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(zl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(or,{"data-orientation":r.orientation,"data-state":Bs(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});zs.displayName=lt;var Ws="AccordionHeader",Fs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(Ws,n);return o.jsx(Ft.h3,{"data-orientation":i.orientation,"data-state":Bs(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Fs.displayName=Ws;var zt="AccordionTrigger",Hs=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(zt,n),l=Ml(zt,n),c=pn(n);return o.jsx(mn.ItemSlot,{scope:n,children:o.jsx(sr,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Hs.displayName=zt;var Vs="AccordionContent",Us=q.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=gt(re,n),r=xn(Vs,n),l=pn(n);return o.jsx(rr,{role:"region","aria-labelledby":r.triggerId,"data-orientation":i.orientation,...l,...s,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Us.displayName=Vs;function Bs(t){return t?"open":"closed"}var Wl=Ms,Fl=zs,Hl=Fs,Vl=Hs,Ul=Us;function Bl(t){const e=C.c(4);let n;e[0]!==t?({...n}=t,e[0]=t,e[1]=n):n=e[1];let s;return e[2]!==n?(s=o.jsx(Wl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function ql(t){const e=C.c(8);let n,s;e[0]!==t?({className:n,...s}=t,e[0]=t,e[1]=n,e[2]=s):(n=e[1],s=e[2]);let i;e[3]!==n?(i=M("border-b last:border-b-0",n),e[3]=n,e[4]=i):i=e[4];let r;return e[5]!==s||e[6]!==i?(r=o.jsx(Fl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Kl(t){const e=C.c(11);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-center justify-between gap-4 py-4 text-left text-sm font-medium transition-all outline-none hover:bg-accent/50 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-90",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(ar,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 transition-transform duration-200"}),e[6]=l):l=e[6];let c;return e[7]!==n||e[8]!==i||e[9]!==r?(c=o.jsx(Hl,{className:"flex",children:o.jsxs(Vl,{"data-slot":"accordion-trigger",className:r,...i,children:[n,l]})}),e[7]=n,e[8]=i,e[9]=r,e[10]=c):c=e[10],c}function Jl(t){const e=C.c(12);let n,s,i;e[0]!==t?({className:s,children:n,...i}=t,e[0]=t,e[1]=n,e[2]=s,e[3]=i):(n=e[1],s=e[2],i=e[3]);let r;e[4]!==s?(r=M("pt-0 pb-4",s),e[4]=s,e[5]=r):r=e[5];let l;e[6]!==n||e[7]!==r?(l=o.jsx("div",{className:r,children:n}),e[6]=n,e[7]=r,e[8]=l):l=e[8];let c;return e[9]!==i||e[10]!==l?(c=o.jsx(Ul,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...i,children:l}),e[9]=i,e[10]=l,e[11]=c):c=e[11],c}function Gl(t){const{updateStep:e}=ee(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=hn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function Xl(t){const e=C.c(48),{className:n}=t,s=Ke(),{appendStep:i}=ee();Gl(s);const r=U(),{item:l}=fe(r);if(!s){let $;e[0]!==n?($=M("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=$):$=e[1];let R;e[2]!==i?(R=()=>{i({type:"tool"})},e[2]=i,e[3]=R):R=e[3];let L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(Qn,{size:14}),e[4]=L):L=e[4];let I;e[5]!==R?(I=o.jsxs("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground gap-2 flex-col",children:["Select or create a step to configure",o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:R,children:L})]}),e[5]=R,e[6]=I):I=e[6];let A;return e[7]!==$||e[8]!==I?(A=o.jsx("div",{className:$,children:I}),e[7]=$,e[8]=I,e[9]=A):A=e[9],A}const c=s?.name;let a;e[10]!==l?.completed_steps?.error?(a=l?.completed_steps?.error??[],e[10]=l?.completed_steps?.error,e[11]=a):a=e[11];const d=a;let u;if(e[12]!==c||e[13]!==d){let $;e[15]!==c?($=R=>R===c||R.startsWith(`${c}[`),e[15]=c,e[16]=$):$=e[16],u=d.some($),e[12]=c,e[13]=d,e[14]=u}else u=e[14];const f=u,m=l?.status==="error"||l?.status==="failed";let h;e[17]!==c||e[18]!==m||e[19]!==l?.running_steps?(h=m&&l?.running_steps?.includes(c??""),e[17]=c,e[18]=m,e[19]=l?.running_steps,e[20]=h):h=e[20];const p=h,x=!!(l?.completed_steps?.success?.some($=>$.name===c)||f||p),g=f||p;let b;e[21]!==n?(b=M("flex flex-col h-full bg-sidebar overflow-scroll",n),e[21]=n,e[22]=b):b=e[22];let j,S;e[23]!==s?(j=o.jsx(Ql,{step:s}),S=o.jsx(Yl,{step:s}),e[23]=s,e[24]=j,e[25]=S):(j=e[24],S=e[25]);const y=`${c}-${x?"open":"closed"}`;let v;e[26]!==l||e[27]!==g?(v=g&&l?.error!=null?typeof l.error=="string"?l.error:JSON.stringify(l.error):void 0,e[26]=l,e[27]=g,e[28]=v):v=e[28];let w;e[29]!==s||e[30]!==x||e[31]!==g||e[32]!==y||e[33]!==v?(w=o.jsx(tc,{step:s,defaultOpen:x,isStepErrored:g,executionError:v},y),e[29]=s,e[30]=x,e[31]=g,e[32]=y,e[33]=v,e[34]=w):w=e[34];let N;e[35]!==s||e[36]!==r?(N=!r&&o.jsx(lc,{step:s}),e[35]=s,e[36]=r,e[37]=N):N=e[37];let E;e[38]!==s||e[39]!==r?(E=!r&&o.jsx(dc,{step:s}),e[38]=s,e[39]=r,e[40]=E):E=e[40];let T;return e[41]!==N||e[42]!==E||e[43]!==b||e[44]!==j||e[45]!==S||e[46]!==w?(T=o.jsxs("div",{className:b,children:[j,S,w,N,E]}),e[41]=N,e[42]=E,e[43]=b,e[44]=j,e[45]=S,e[46]=w,e[47]=T):T=e[47],T}function Ql(t){const e=C.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=U(),l=i??"";let c;e[0]!==l?(c=o.jsx(dt,{icon:null,name:l,size:"xs",className:"shadow-sm"}),e[0]=l,e[1]=c):c=e[1];let a;e[2]!==i?(a=o.jsx("span",{className:"text-base font-medium text-foreground truncate flex-1",children:i}),e[2]=i,e[3]=a):a=e[3];let d;e[4]!==r?(d=r?null:o.jsx(Zl,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function Zl(){const t=C.c(9),e=Ke(),{updateStep:n,startReplacingTool:s}=ee(),i=U(),l=e&&"toolName"in e.action?e.action.toolName:null;let c;t[0]!==e||t[1]!==s||t[2]!==l||t[3]!==i||t[4]!==n?(c=()=>{if(e){if(i){On.error("You cannot replace a tool while a workflow is executing.");return}l&&s(l),n(e.name,{action:{...e.action,toolName:""}})}},t[0]=e,t[1]=s,t[2]=l,t[3]=i,t[4]=n,t[5]=c):c=t[5];const a=c;let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(ms,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:a,title:"Replace tool",children:d}),t[7]=a,t[8]=u):u=t[8],u}function hn(t){const e=C.c(16),{org:n}=G(),s=Ge();let i;e[0]!==n.id||e[1]!==s?(i=s??Be(n.id),e[0]=n.id,e[1]=s,e[2]=i):i=e[2];const r=i;let l;e[3]!==n.id||e[4]!==r?(l={connectionId:r,orgId:n.id},e[3]=n.id,e[4]=r,e[5]=l):l=e[5];const c=ne(l);let a;e[6]!==c?(a={client:c},e[6]=c,e[7]=a):a=e[7];const d=nn(a);let u;e[8]!==t||e[9]!==d.data?.tools?(u=d.data?.tools?.find(h=>h.name===t),e[8]=t,e[9]=d.data?.tools,e[10]=u):u=e[10];const f=u;let m;return e[11]!==f||e[12]!==d.error||e[13]!==d.isLoading||e[14]!==d.isSuccess?(m={tool:f,isLoading:d.isLoading,isReady:d.isSuccess,error:d.error},e[11]=f,e[12]=d.error,e[13]=d.isLoading,e[14]=d.isSuccess,e[15]=m):m=e[15],m}function Yl(t){const e=C.c(18),{step:n}=t,{updateStep:s}=ee(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=U(),{tool:c}=hn(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=v=>{s(n.name,{input:v})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a;let u;e[3]!==n.input||e[4]!==c.inputSchema||e[5]!==l?(u=l?ec(c.inputSchema,n.input):c.inputSchema,e[3]=n.input,e[4]=c.inputSchema,e[5]=l,e[6]=u):u=e[6];const f=u,m=l?"output":"input";let h;e[7]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Kl,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=h):h=e[7];const p=n.name+l,x=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let S;e[9]!==d||e[10]!==p||e[11]!==x||e[12]!==g||e[13]!==b?(S=o.jsxs(ql,{value:"input",className:"border-b-0",children:[h,o.jsx(Jl,{className:"px-5 pt-2",children:o.jsx(As,{readOnly:x,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},p)})]}),e[9]=d,e[10]=p,e[11]=x,e[12]=g,e[13]=b,e[14]=S):S=e[14];let y;return e[15]!==S||e[16]!==m?(y=o.jsx(Bl,{type:"single",collapsible:!0,defaultValue:m,className:"border-b border-border shrink-0",children:S}),e[15]=S,e[16]=m,e[17]=y):y=e[17],y}function ec(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function tc(t){const e=C.c(42),{step:n,defaultOpen:s,isStepErrored:i,executionError:r}=t,l=n.outputSchema,c=U(),{item:a}=fe(c),d=a?.completed_steps?.error??[];let u;e[0]!==n.name?(u=V=>V===n.name||V.startsWith(`${n.name}[`),e[0]=n.name,e[1]=u):u=e[1];const f=d.some(u),h=(a?.status==="error"||a?.status==="failed")&&a?.running_steps?.includes(n.name),p=!!(a?.completed_steps?.success?.some(V=>V.name===n.name)||f||h),[x,g]=k.useState(s),b=n.forEach!==void 0,[j,S]=k.useState("all"),y=b?new RegExp(`^${n.name}\\[(\\d+)\\]$`):null,v=b?(a?.completed_steps?.success??[]).filter(V=>y.test(V.name)).map(V=>{const We=V.name.match(y);return{index:Number(We[1]),status:"success"}}):[],N=(b?d.filter(V=>y.test(V)):[]).map(V=>{const We=V.match(y);return{index:Number(We[1]),status:"error"}}),E=[...v,...N].sort(sc),T=E.length>0,$=b&&j!=="all"?`${n.name}[${j}]`:void 0,R=p?n.name:void 0,L=$??R,{output:I,error:A}=js(c,L);let W;e[2]!==A||e[3]!==r||e[4]!==i||e[5]!==I?(W=I||(A?{error:A}:i&&r?{error:r}:void 0),e[2]=A,e[3]=r,e[4]=i,e[5]=I,e[6]=W):W=e[6];const z=W,X=l&&typeof l=="object"?l.properties:void 0;let _;e[7]!==X?(_=X?Object.entries(X):[],e[7]=X,e[8]=_):_=e[8];const O=_,P=j!=="all"&&N.some(V=>V.index===j),Q=j==="all"?i||f||h:P,Z=x?"flex-1 min-h-0 overflow-hidden":"shrink-0";let F;e[9]!==Z?(F=M("flex flex-col border-b border-border",Z),e[9]=Z,e[10]=F):F=e[10];let K;e[11]!==x||e[12]!==g?(K=()=>g(!x),e[11]=x,e[12]=g,e[13]=K):K=e[13];const B=Q?"text-destructive":"text-muted-foreground";let H;e[14]!==B?(H=M("text-sm font-medium",B),e[14]=B,e[15]=H):H=e[15];const J=Q?"Error":"Output";let ie;e[16]!==H||e[17]!==J?(ie=o.jsx("h3",{className:H,children:J}),e[16]=H,e[17]=J,e[18]=ie):ie=e[18];let le;e[19]!==x?(le=x?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"}),e[19]=x,e[20]=le):le=e[20];let se;e[21]!==ie||e[22]!==le?(se=o.jsxs("div",{className:"flex items-center justify-between",children:[ie,le]}),e[21]=ie,e[22]=le,e[23]=se):se=e[23];let ce;e[24]!==se||e[25]!==K?(ce=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:K,children:se}),e[24]=se,e[25]=K,e[26]=ce):ce=e[26];let oe;e[27]!==E||e[28]!==z||e[29]!==T||e[30]!==b||e[31]!==x||e[32]!==O||e[33]!==j||e[34]!==S||e[35]!==n.name||e[36]!==c?(oe=x&&o.jsxs(o.Fragment,{children:[c&&b&&T&&o.jsx(oc,{iterations:E,selectedIteration:j,onSelect:S}),c&&z?o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:JSON.stringify(z,null,2),language:"json",height:"100%",readOnly:!0},`output-${n.name}-${j}`)}):null,!c&&O.length>0&&o.jsx("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:O.map(nc)})]}),e[27]=E,e[28]=z,e[29]=T,e[30]=b,e[31]=x,e[32]=O,e[33]=j,e[34]=S,e[35]=n.name,e[36]=c,e[37]=oe):oe=e[37];let ae;return e[38]!==ce||e[39]!==oe||e[40]!==F?(ae=o.jsxs("div",{className:F,children:[ce,oe]}),e[38]=ce,e[39]=oe,e[40]=F,e[41]=ae):ae=e[41],ae}function nc(t){const[e,n]=t;return o.jsx(ic,{name:e,schema:n},e)}function sc(t,e){return t.index-e.index}function oc(t){const e=C.c(21),{iterations:n,selectedIteration:s,onSelect:i}=t,r=s==="all"?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground";let l;e[0]!==r?(l=M("h-7 px-3 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",r),e[0]=r,e[1]=l):l=e[1];let c;e[2]!==i?(c=()=>i("all"),e[2]=i,e[3]=c):c=e[3];let a;e[4]!==l||e[5]!==c?(a=o.jsx("button",{type:"button",className:l,onClick:c,children:"All Results"}),e[4]=l,e[5]=c,e[6]=a):a=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e[7]=d):d=e[7];let u;if(e[8]!==n||e[9]!==i||e[10]!==s){let p;e[12]!==i||e[13]!==s?(p=x=>{const g=s===x.index;return o.jsxs("button",{type:"button",className:M("h-7 px-2.5 text-xs font-medium rounded-lg border transition-colors inline-flex gap-1.5 items-center",g?"bg-accent border-border text-foreground":"bg-transparent border-transparent text-muted-foreground hover:bg-accent/50 hover:text-foreground"),onClick:()=>i(x.index),children:[x.status==="success"?o.jsx(ft,{size:12,className:"text-success"}):o.jsx(at,{size:12,className:"text-destructive"}),o.jsxs("span",{className:"font-mono",children:["#",x.index]})]},x.index)},e[12]=i,e[13]=s,e[14]=p):p=e[14],u=n.map(p),e[8]=n,e[9]=i,e[10]=s,e[11]=u}else u=e[11];let f;e[15]!==a||e[16]!==u?(f=o.jsxs("div",{className:"flex w-max items-center gap-2 pb-3",children:[a,d,u]}),e[15]=a,e[16]=u,e[17]=f):f=e[17];let m;e[18]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx($o,{orientation:"horizontal"}),e[18]=m):m=e[18];let h;return e[19]!==f?(h=o.jsx("div",{className:"px-5 pb-3 shrink-0 border-b border-border/50",children:o.jsxs(Oo,{className:"w-full whitespace-nowrap",children:[f,m]})}),e[19]=f,e[20]=h):h=e[20],h}function rc(t){switch(t){case"string":return{Icon:is,color:"text-blue-500"};case"number":case"integer":return{Icon:os,color:"text-blue-500"};case"array":return{Icon:ts,color:"text-purple-500"};case"object":return{Icon:es,color:"text-orange-500"};case"boolean":return{Icon:rs,color:"text-pink-500"};case"null":return{Icon:Vt,color:"text-gray-500"};default:return{Icon:ns,color:"text-muted-foreground"}}}function ic(t){const e=C.c(28),{name:n,schema:s}=t,i=Ke(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:y,color:v}=rc(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=y,c=14,a=M(v),e[0]=r,e[1]=l,e[2]=c,e[3]=a,e[4]=d,e[5]=u}else l=e[1],c=e[2],a=e[3],d=e[4],u=e[5];let f;e[6]!==l||e[7]!==c||e[8]!==a?(f=o.jsx(l,{size:c,className:a}),e[6]=l,e[7]=c,e[8]=a,e[9]=f):f=e[9];let m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let h;e[12]!==d||e[13]!==f||e[14]!==m?(h=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=h):h=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(ds,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const x=i?.name;let g;e[17]!==x?(g=o.jsxs("span",{className:"text-muted-foreground",children:[x,"."]}),e[17]=x,e[18]=g):g=e[18];let b;e[19]!==n?(b=o.jsx("div",{className:"bg-blue-500/10 text-blue-500 px-1 py-0.5 rounded",children:n}),e[19]=n,e[20]=b):b=e[20];let j;e[21]!==g||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let S;return e[24]!==j||e[25]!==u||e[26]!==h?(S=o.jsxs("div",{className:u,children:[h,j]}),e[24]=j,e[25]=u,e[26]=h,e[27]=S):S=e[27],S}function lc(t){const e=C.c(29),{step:n}=t,{updateStep:s}=ee(),i=U(),[r,l]=k.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=hn(a??""),u=c&&"transformCode"in n.action?n.action.transformCode??null:null;let f;e[0]!==d?(f=()=>{if(!d?.outputSchema)return`interface Input {
|
|
8
8
|
// Tool output schema not available
|
|
9
9
|
}`;const E=d.outputSchema,T=E.properties;return T?`interface Input {
|
|
10
10
|
${Object.entries(T).map(R=>{const[L,I]=R,A=Ye(I),W=!E.required?.includes(L);return` ${L}${W?"?":""}: ${A};`}).join(`
|
|
@@ -23,4 +23,4 @@ export default async function(input: Input): Promise<Output> {
|
|
|
23
23
|
return {
|
|
24
24
|
result: input,
|
|
25
25
|
};
|
|
26
|
-
}`;s(n.name,{action:{...n.action,transformCode:T}}),l(cc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=h):h=e[6];const p=h;let x;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(x=(E,T)=>{s(n.name,{action:{...n.action,transformCode:E},...T?{outputSchema:T}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=x):x=e[10];const g=x;if("code"in n.action&&n.action.code)return null;const b=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[11]!==b?(j=M("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=S):S=e[13];let y;e[14]!==r?(y=o.jsxs("div",{className:"flex items-center justify-between",children:[S,r?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=y):y=e[15];let v;e[16]!==y||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:y}),e[16]=y,e[17]=p,e[18]=v):v=e[18];let w;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(w=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:u,language:"typescript",readOnly:i!==void 0,onSave:g,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=g,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=w):w=e[24];let N;return e[25]!==j||e[26]!==v||e[27]!==w?(N=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=N):N=e[28],N}function cc(t){return!t}function ac(t){return!t}function dc(t){const e=C.c(24),{step:n}=t,[s,i]=k.useState(!1),{updateStep:r}=ee(),l="code"in n.action&&n.action.code?n.action.code:null,c=U();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,S)=>{r(n.name,{action:{...n.action,code:j},...S?{outputSchema:S}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=M("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[h,s?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let x;e[11]!==m||e[12]!==p?(x=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(g=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{onSave:(j,S)=>d(j,S),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==x||e[22]!==g?(b=o.jsxs("div",{className:f,children:[x,g]}),e[20]=f,e[21]=x,e[22]=g,e[23]=b):b=e[23],b}function Ye(t){if(Array.isArray(t.type))return t.type.map(n=>Ye({...t,type:n})).join(" | ");switch(t.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return t.items?`${Ye(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ye(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function uc(t){switch(t){case"success":return o.jsxs(me,{variant:"success",className:"gap-1",children:[o.jsx(ft,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(me,{variant:"destructive",className:"gap-1",children:[o.jsx(Zn,{size:11}),"Error"]});case"running":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),"Running"]});case"enqueued":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),"On hold"]});case"cancelled":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(qn,{size:11}),"Cancelled"]});default:return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),t]})}}function fc(t){return`Run #${t.slice(-4).toUpperCase()}`}function mc(t){const e=C.c(21),{className:n}=t,{executions:s,isLoading:i}=Zr(),{setShowExecutionsList:r}=dn(),{setTrackingExecutionId:l}=ee(),c=U();let a;e[0]!==l?(a=S=>{l(S)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=M("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(qn,{size:11}),e[7]=p):p=e[7];let x;e[8]!==f?(x=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=x):x=e[9];let g;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(g=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((S,y)=>o.jsx(pc,{execution:S,isSelected:S.id===c,isFirst:y===0,onSelect:()=>d(S.id)},S.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==x||e[19]!==b?(j=o.jsxs("div",{className:m,children:[x,b]}),e[17]=m,e[18]=x,e[19]=b,e[20]=j):j=e[20],j}function pc(t){const e=C.c(17),{execution:n,isSelected:s,isFirst:i,onSelect:r}=t,l=s&&"bg-accent/50",c=i&&s&&"bg-accent/50",a=!s&&"hover:bg-accent/30";let d;e[0]!==l||e[1]!==c||e[2]!==a?(d=M("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",l,c,a),e[0]=l,e[1]=c,e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n.status?(u=uc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=fc(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==h?(p=o.jsx("div",{className:d,onClick:r,children:h}),e[13]=r,e[14]=d,e[15]=h,e[16]=p):p=e[16],p}const xc=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],hc=dr({buildUrl:t=>`/org/${t}/watch?types=workflow.*`,eventTypes:xc}),gc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],bc=500,Ve=new Map,He=new Map;function jc(t){const e=He.get(t);if(e)for(const n of e)n.invalidateQueries({predicate:s=>s.queryKey.some(i=>typeof i=="string"&&gc.includes(i))})}function vc(t){Ve.has(t)||Ve.set(t,setTimeout(()=>{Ve.delete(t),jc(t)},bc))}const $n=()=>0;function Sc(){const t=C.c(3),{org:e}=G(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{let c=He.get(s);c||(c=new Set,He.set(s,c)),c.add(n);const a=()=>{vc(s),l()},d=hc.subscribe(s,a);return()=>{d(),c.delete(n),c.size===0&&He.delete(s);const u=Ve.get(s);u&&!He.has(s)&&(clearTimeout(u),Ve.delete(s))}},t[0]=s,t[1]=n,t[2]=i):i=t[2];const r=i;k.useSyncExternalStore(r,$n,$n)}function qs(t){const e=C.c(11),{itemId:n}=t,[s,i]=k.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=pe(r),c=l??"no-connection",{org:a}=G(),d=l??null;let u;e[1]!==a.id||e[2]!==d?(u={connectionId:d,orgId:a.id},e[1]=a.id,e[2]=d,e[3]=u):u=e[3];const f=ne(u),m=Ut(c,"WORKFLOW",n,f),h=Bt(c,"WORKFLOW",f);let p;e[4]!==h||e[5]!==n?(p=async b=>{i(!0),await h.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=h,e[5]=n,e[6]=p):p=e[6];const x=p;let g;return e[7]!==s||e[8]!==m||e[9]!==x?(g={item:m,update:x,isUpdating:s},e[7]=s,e[8]=m,e[9]=x,e[10]=g):g=e[10],g}function yc(t){const e=C.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ee();let r,l,c,a;if(e[0]!==n.description||e[1]!==n.id||e[2]!==n.steps||e[3]!==n.title){const f={title:n.title,description:n.description,steps:n.steps};r=Le,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function wc(){const t=C.c(9),e=U(),{item:n}=fe(e),s=n?.start_at_epoch_ms,i=n?.completed_at_epoch_ms,r=n?.status==="running"&&s&&!i;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=Date.now(),t[0]=l):l=t[0];const c=k.useRef(l);let a;t[1]!==r?(a=x=>{if(!r)return Nc;const g=setInterval(()=>{c.current=Date.now(),x()},50);return()=>clearInterval(g)},t[1]=r,t[2]=a):a=t[2];const d=a;let u;t[3]!==r?(u=()=>r?c.current:0,t[3]=r,t[4]=u):u=t[4];const f=u,m=k.useSyncExternalStore(d,f,f),h=i&&s?Math.max(0,i-s):null;let p=null;if(s){let x;t[5]!==s?(x=new Date(s).getTime(),t[5]=s,t[6]=x):x=t[6];const g=x;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],p=Math.max(0,b-g)}else r&&(p=Math.max(0,m-g))}return p??h}function Nc(){}function Cc(t){if(t<1e3)return`${t}ms`;const e=t/1e3,n=e%60,s=Math.floor(e/60),i=s%60,r=Math.floor(s/60);return r>0?`${r}h ${i}m ${n.toFixed(3)}s`:i>0?`${i}m ${n.toFixed(3)}s`:`${n.toFixed(3)}s`}function kc(){const t=C.c(26),{setTrackingExecutionId:e}=ee(),n=U(),{item:s}=fe(n),i=wc();let r;t[0]!==i?(r=i!=null?Cc(i):null,t[0]=i,t[1]=r):r=t[1];const l=r,c=s?.status,a=c==="error"||c==="failed",d=c==="success";let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(ho,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=u):u=t[2];let f;t[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=f):f=t[3];let m;t[4]!==n?(m=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[f,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=m):m=t[5];let h;t[6]!==d?(h=d&&o.jsxs(me,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=h):h=t[7];let p;t[8]!==a?(p=a&&o.jsxs(me,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(pr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ur,{className:"w-4 h-4 text-muted-foreground"}),t[10]=x):x=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[x,o.jsx("span",{className:"text-sm text-muted-foreground",children:l})]}),t[11]=l,t[12]=g):g=t[12];let b;t[13]!==m||t[14]!==h||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,h,p,g]}),t[13]=m,t[14]=h,t[15]=p,t[16]=g,t[17]=b):b=t[17];let j;t[18]!==e?(j=()=>e(void 0),t[18]=e,t[19]=j):j=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Vt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=S):S=t[20];let y;t[21]!==j?(y=o.jsx(Y,{variant:"ghost",size:"xs",onClick:j,children:S}),t[21]=j,t[22]=y):y=t[22];let v;return t[23]!==y||t[24]!==b?(v=o.jsx("div",{className:"flex flex-col border-b border-border",children:o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between",children:[b,y]})}),t[23]=y,t[24]=b,t[25]=v):v=t[25],v}function Ic(){const t=C.c(15);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i,update:r,isUpdating:l}=qs(s);let c;t[3]!==i?(c=JSON.stringify(i),t[3]=i,t[4]=c):c=t[4];const a=c;if(!i){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow not found",description:"This workflow may have been deleted or you may not have access to it."})})}),t[5]=m):m=t[5],m}let d;t[6]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},t[6]=i,t[7]=d):d=t[7];let u;t[8]!==l||t[9]!==r?(u=o.jsx(_c,{onUpdate:r,isUpdating:l}),t[8]=l,t[9]=r,t[10]=u):u=t[10];let f;return t[11]!==a||t[12]!==d||t[13]!==u?(f=o.jsx(Fr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function _c(t){const e=C.c(21),{onUpdate:n,isUpdating:s}=t;Sc();const i=De(),r=U(),{viewMode:l,showExecutionsList:c}=dn(),a=Ke();let d;e[0]!==n||e[1]!==i?(d=async()=>{await n(i)},e[0]=n,e[1]=i,e[2]=d):d=e[2];const u=d,f=a&&"toolName"in a.action,m=f?a.action.toolName:null,h=f&&!m&&!r,p=!h&&(a||r||!c);let x;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(x=o.jsx(ol,{title:i.title,description:i.description,onSave:u,isSaving:s}),e[3]=u,e[4]=s,e[5]=i.description,e[6]=i.title,e[7]=x):x=e[7];let g;e[8]!==r?(g=r&&o.jsx(kc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==h||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(yc,{workflow:i,onUpdate:n}):o.jsxs(Ao,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx(wl,{})}),o.jsx(Mo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[h&&o.jsx(kl,{className:"border-l border-border"}),c&&o.jsx(mc,{}),p&&o.jsx(Xl,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=h,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==x||e[18]!==g||e[19]!==b?(j=o.jsx(he,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[x,g,b]})}),e[17]=x,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Ec(t){const e=C.c(6),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=pe(s),r=i??"no-connection",{org:l}=G(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=ne(a),u=Ut(r,"WORKFLOW_EXECUTION",n,d);let f;return e[4]!==u?(f={item:u},e[4]=u,e[5]=f):f=e[5],f}function Tc(){const t=C.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Ec(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow execution not found",description:"This workflow execution may have been deleted or you may not have access to it."})})}),t[3]=c):c=t[3],c}let r;t[4]!==i?(r=JSON.stringify(i,null,2),t[4]=i,t[5]=r):r=t[5];let l;return t[6]!==r?(l=o.jsx(he,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Le,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const $c={workflow:Ic,workflow_execution:Tc,prompt:Sr};function Oc(){const t=C.c(6),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=decodeURIComponent(s.itemId);let r;t[1]!==e.history?(r=()=>{e.history.back()},t[1]=e.history,t[2]=r):r=t[2];const l=r,c=Rc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(_r,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Rc(t){return Promise.resolve()}function Ac(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Mc(){const t=C.c(38),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=s.connectionId,r=decodeURIComponent(s.collectionName),l=decodeURIComponent(s.itemId);let c;t[1]!==e.history?(c=()=>{e.history.back()},t[1]=e.history,t[2]=c):c=t[2];const a=c,d=i??"no-connection",{org:u}=G(),f=ct(i),m=i??null;let h;t[3]!==u.id||t[4]!==m?(h={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=h):h=t[5];const p=ne(h),x=Bt(d,r,p);let g;t[6]!==x||t[7]!==l?(g=async z=>{l&&await x.update.mutateAsync({id:l,data:z})},t[6]=x,t[7]=l,t[8]=g):g=t[8];const b=g;let j;t[9]!==r?(j=r?.toLowerCase(),t[9]=r,t[10]=j):j=t[10];const S=j,y=S&&$c[S];let v;t[11]!==r?(v=Ac(r),t[11]=r,t[12]=v):v=t[12];const w=v;let N;t[13]!==u.slug?(N=o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps",params:{org:u.slug,project:tt},children:"Connections"})})}),t[13]=u.slug,t[14]=N):N=t[14];let E;t[15]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ot,{}),t[15]=E):E=t[15];let T;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(T=f&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:tt,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(ot,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=T):T=t[20];let $;t[21]!==w?($=o.jsx(Pe,{children:o.jsx(Gn,{children:w})}),t[21]=w,t[22]=$):$=t[22];let R;t[23]!==$||t[24]!==N||t[25]!==T?(R=o.jsx(Kn,{children:o.jsxs(Jn,{children:[N,E,T,$]})}),t[23]=$,t[24]=N,t[25]=T,t[26]=R):R=t[26];const L=R;if(y){let z;return t[27]!==y||t[28]!==a||t[29]!==b||t[30]!==l?(z=o.jsx(y,{itemId:l,onBack:a,onUpdate:b}),t[27]=y,t[28]=a,t[29]=b,t[30]=l,t[31]=z):z=t[31],z}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ro,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let A;t[33]!==a?(A=o.jsx(rn,{icon:I,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[33]=a,t[34]=A):A=t[34];let W;return t[35]!==L||t[36]!==A?(W=o.jsx(he,{breadcrumb:L,children:A}),t[35]=L,t[36]=A,t[37]=W):W=t[37],W}function Pc(){const t=C.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=pe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Oc,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Mc,{}),t[2]=r):r=t[2],r}function Td(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ue,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Pc,{})})}),t[0]=e):e=t[0],e}export{Td as default};
|
|
26
|
+
}`;s(n.name,{action:{...n.action,transformCode:T}}),l(cc)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=h):h=e[6];const p=h;let x;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(x=(E,T)=>{s(n.name,{action:{...n.action,transformCode:E},...T?{outputSchema:T}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=x):x=e[10];const g=x;if("code"in n.action&&n.action.code)return null;const b=r?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[11]!==b?(j=M("flex flex-col flex-1 min-h-0 overflow-hidden border-b border-border",b),e[11]=b,e[12]=j):j=e[12];let S;e[13]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=S):S=e[13];let y;e[14]!==r?(y=o.jsxs("div",{className:"flex items-center justify-between",children:[S,r?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=y):y=e[15];let v;e[16]!==y||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:y}),e[16]=y,e[17]=p,e[18]=v):v=e[18];let w;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(w=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{code:u,language:"typescript",readOnly:i!==void 0,onSave:g,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=g,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=w):w=e[24];let N;return e[25]!==j||e[26]!==v||e[27]!==w?(N=o.jsxs("div",{className:j,children:[v,w]}),e[25]=j,e[26]=v,e[27]=w,e[28]=N):N=e[28],N}function cc(t){return!t}function ac(t){return!t}function dc(t){const e=C.c(24),{step:n}=t,[s,i]=k.useState(!1),{updateStep:r}=ee(),l="code"in n.action&&n.action.code?n.action.code:null,c=U();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,S)=>{r(n.name,{action:{...n.action,code:j},...S?{outputSchema:S}:{}})},e[0]=n.action,e[1]=n.name,e[2]=r,e[3]=a):a=e[3];const d=a;if(!l)return null;const u=s?"flex-1 min-h-0 overflow-hidden":"shrink-0";let f;e[4]!==u?(f=M("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=h):h=e[8];let p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[h,s?o.jsx(cn,{size:14,className:"text-muted-foreground"}):o.jsx(ln,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let x;e[11]!==m||e[12]!==p?(x=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=x):x=e[13];let g;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(g=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Le,{onSave:(j,S)=>d(j,S),code:l,language:"typescript",height:"100%",readOnly:c!==void 0},`step-code-${n.name}-${c}`)}),e[14]=l,e[15]=d,e[16]=s,e[17]=n.name,e[18]=c,e[19]=g):g=e[19];let b;return e[20]!==f||e[21]!==x||e[22]!==g?(b=o.jsxs("div",{className:f,children:[x,g]}),e[20]=f,e[21]=x,e[22]=g,e[23]=b):b=e[23],b}function Ye(t){if(Array.isArray(t.type))return t.type.map(n=>Ye({...t,type:n})).join(" | ");switch(t.type){case"string":return"string";case"number":case"integer":return"number";case"boolean":return"boolean";case"array":return t.items?`${Ye(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ye(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function uc(t){switch(t){case"success":return o.jsxs(me,{variant:"success",className:"gap-1",children:[o.jsx(ft,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(me,{variant:"destructive",className:"gap-1",children:[o.jsx(Zn,{size:11}),"Error"]});case"running":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),"Running"]});case"enqueued":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),"On hold"]});case"cancelled":return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(qn,{size:11}),"Cancelled"]});default:return o.jsxs(me,{variant:"secondary",className:"gap-1",children:[o.jsx(Ze,{size:11}),t]})}}function fc(t){return`Run #${t.slice(-4).toUpperCase()}`}function mc(t){const e=C.c(21),{className:n}=t,{executions:s,isLoading:i}=Zr(),{setShowExecutionsList:r}=dn(),{setTrackingExecutionId:l}=ee(),c=U();let a;e[0]!==l?(a=S=>{l(S)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=M("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=e[5];let h;e[6]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=h):h=e[6];let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(qn,{size:11}),e[7]=p):p=e[7];let x;e[8]!==f?(x=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[h,o.jsx(Y,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=x):x=e[9];let g;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(g=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((S,y)=>o.jsx(pc,{execution:S,isSelected:S.id===c,isFirst:y===0,onSelect:()=>d(S.id)},S.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=g):g=e[14];let b;e[15]!==g?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:g}),e[15]=g,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==x||e[19]!==b?(j=o.jsxs("div",{className:m,children:[x,b]}),e[17]=m,e[18]=x,e[19]=b,e[20]=j):j=e[20],j}function pc(t){const e=C.c(17),{execution:n,isSelected:s,isFirst:i,onSelect:r}=t,l=s&&"bg-accent/50",c=i&&s&&"bg-accent/50",a=!s&&"hover:bg-accent/30";let d;e[0]!==l||e[1]!==c||e[2]!==a?(d=M("flex flex-col justify-center h-[60px] px-4 border-b border-border cursor-pointer transition-colors",l,c,a),e[0]=l,e[1]=c,e[2]=a,e[3]=d):d=e[3];let u;e[4]!==n.status?(u=uc(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=fc(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let h;e[10]!==u||e[11]!==m?(h=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=h):h=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==h?(p=o.jsx("div",{className:d,onClick:r,children:h}),e[13]=r,e[14]=d,e[15]=h,e[16]=p):p=e[16],p}const xc=["workflow.execution.created","workflow.execution.resumed","workflow.step.execute","workflow.step.completed"],hc=dr({buildUrl:t=>`/org/${t}/watch?types=workflow.*`,eventTypes:xc}),gc=["COLLECTION_WORKFLOW_EXECUTION_LIST","COLLECTION_WORKFLOW_EXECUTION_GET","COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT"],bc=500,Ve=new Map,He=new Map;function jc(t){const e=He.get(t);if(e)for(const n of e)n.invalidateQueries({predicate:s=>s.queryKey.some(i=>typeof i=="string"&&gc.includes(i))})}function vc(t){Ve.has(t)||Ve.set(t,setTimeout(()=>{Ve.delete(t),jc(t)},bc))}const $n=()=>0;function Sc(){const t=C.c(3),{org:e}=G(),n=xo(),s=e.id;let i;t[0]!==s||t[1]!==n?(i=l=>{let c=He.get(s);c||(c=new Set,He.set(s,c)),c.add(n);const a=()=>{vc(s),l()},d=hc.subscribe(s,a);return()=>{d(),c.delete(n),c.size===0&&He.delete(s);const u=Ve.get(s);u&&!He.has(s)&&(clearTimeout(u),Ve.delete(s))}},t[0]=s,t[1]=n,t[2]=i):i=t[2];const r=i;k.useSyncExternalStore(r,$n,$n)}function qs(t){const e=C.c(11),{itemId:n}=t,[s,i]=k.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=pe(r),c=l??"no-connection",{org:a}=G(),d=l??null;let u;e[1]!==a.id||e[2]!==d?(u={connectionId:d,orgId:a.id},e[1]=a.id,e[2]=d,e[3]=u):u=e[3];const f=ne(u),m=Ut(c,"WORKFLOW",n,f),h=Bt(c,"WORKFLOW",f);let p;e[4]!==h||e[5]!==n?(p=async b=>{i(!0),await h.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=h,e[5]=n,e[6]=p):p=e[6];const x=p;let g;return e[7]!==s||e[8]!==m||e[9]!==x?(g={item:m,update:x,isUpdating:s},e[7]=s,e[8]=m,e[9]=x,e[10]=g):g=e[10],g}function yc(t){const e=C.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=ee();let r,l,c,a;if(e[0]!==n.description||e[1]!==n.id||e[2]!==n.steps||e[3]!==n.title){const f={title:n.title,description:n.description,steps:n.steps};r=Le,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function wc(){const t=C.c(9),e=U(),{item:n}=fe(e),s=n?.start_at_epoch_ms,i=n?.completed_at_epoch_ms,r=n?.status==="running"&&s&&!i;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=Date.now(),t[0]=l):l=t[0];const c=k.useRef(l);let a;t[1]!==r?(a=x=>{if(!r)return Nc;const g=setInterval(()=>{c.current=Date.now(),x()},50);return()=>clearInterval(g)},t[1]=r,t[2]=a):a=t[2];const d=a;let u;t[3]!==r?(u=()=>r?c.current:0,t[3]=r,t[4]=u):u=t[4];const f=u,m=k.useSyncExternalStore(d,f,f),h=i&&s?Math.max(0,i-s):null;let p=null;if(s){let x;t[5]!==s?(x=new Date(s).getTime(),t[5]=s,t[6]=x):x=t[6];const g=x;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],p=Math.max(0,b-g)}else r&&(p=Math.max(0,m-g))}return p??h}function Nc(){}function Cc(t){if(t<1e3)return`${t}ms`;const e=t/1e3,n=e%60,s=Math.floor(e/60),i=s%60,r=Math.floor(s/60);return r>0?`${r}h ${i}m ${n.toFixed(3)}s`:i>0?`${i}m ${n.toFixed(3)}s`:`${n.toFixed(3)}s`}function kc(){const t=C.c(26),{setTrackingExecutionId:e}=ee(),n=U(),{item:s}=fe(n),i=wc();let r;t[0]!==i?(r=i!=null?Cc(i):null,t[0]=i,t[1]=r):r=t[1];const l=r,c=s?.status,a=c==="error"||c==="failed",d=c==="success";let u;t[2]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(ho,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=u):u=t[2];let f;t[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=f):f=t[3];let m;t[4]!==n?(m=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[f,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=m):m=t[5];let h;t[6]!==d?(h=d&&o.jsxs(me,{variant:"success",className:"gap-1 ml-3",children:[o.jsx(go,{size:11}),"Success"]}),t[6]=d,t[7]=h):h=t[7];let p;t[8]!==a?(p=a&&o.jsxs(me,{variant:"destructive",className:"gap-1 ml-3",children:[o.jsx(pr,{size:11}),"Failed"]}),t[8]=a,t[9]=p):p=t[9];let x;t[10]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(ur,{className:"w-4 h-4 text-muted-foreground"}),t[10]=x):x=t[10];let g;t[11]!==l?(g=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[x,o.jsx("span",{className:"text-sm text-muted-foreground",children:l})]}),t[11]=l,t[12]=g):g=t[12];let b;t[13]!==m||t[14]!==h||t[15]!==p||t[16]!==g?(b=o.jsxs("div",{className:"flex items-center h-full",children:[u,m,h,p,g]}),t[13]=m,t[14]=h,t[15]=p,t[16]=g,t[17]=b):b=t[17];let j;t[18]!==e?(j=()=>e(void 0),t[18]=e,t[19]=j):j=t[19];let S;t[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Vt,{className:"w-4 h-4 text-muted-foreground"}),t[20]=S):S=t[20];let y;t[21]!==j?(y=o.jsx(Y,{variant:"ghost",size:"xs",onClick:j,children:S}),t[21]=j,t[22]=y):y=t[22];let v;return t[23]!==y||t[24]!==b?(v=o.jsx("div",{className:"flex flex-col border-b border-border",children:o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between",children:[b,y]})}),t[23]=y,t[24]=b,t[25]=v):v=t[25],v}function Ic(){const t=C.c(15);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i,update:r,isUpdating:l}=qs(s);let c;t[3]!==i?(c=JSON.stringify(i),t[3]=i,t[4]=c):c=t[4];const a=c;if(!i){let m;return t[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow not found",description:"This workflow may have been deleted or you may not have access to it."})})}),t[5]=m):m=t[5],m}let d;t[6]!==i?(d={workflow:i,trackingExecutionId:void 0,currentStepTab:"input"},t[6]=i,t[7]=d):d=t[7];let u;t[8]!==l||t[9]!==r?(u=o.jsx(_c,{onUpdate:r,isUpdating:l}),t[8]=l,t[9]=r,t[10]=u):u=t[10];let f;return t[11]!==a||t[12]!==d||t[13]!==u?(f=o.jsx(Fr,{initialState:d,children:u},a),t[11]=a,t[12]=d,t[13]=u,t[14]=f):f=t[14],f}function _c(t){const e=C.c(21),{onUpdate:n,isUpdating:s}=t;Sc();const i=De(),r=U(),{viewMode:l,showExecutionsList:c}=dn(),a=Ke();let d;e[0]!==n||e[1]!==i?(d=async()=>{await n(i)},e[0]=n,e[1]=i,e[2]=d):d=e[2];const u=d,f=a&&"toolName"in a.action,m=f?a.action.toolName:null,h=f&&!m&&!r,p=!h&&(a||r||!c);let x;e[3]!==u||e[4]!==s||e[5]!==i.description||e[6]!==i.title?(x=o.jsx(ol,{title:i.title,description:i.description,onSave:u,isSaving:s}),e[3]=u,e[4]=s,e[5]=i.description,e[6]=i.title,e[7]=x):x=e[7];let g;e[8]!==r?(g=r&&o.jsx(kc,{}),e[8]=r,e[9]=g):g=e[9];let b;e[10]!==n||e[11]!==c||e[12]!==p||e[13]!==h||e[14]!==l||e[15]!==i?(b=o.jsx("div",{className:"flex-1 overflow-hidden",children:l==="code"?o.jsx(yc,{workflow:i,onUpdate:n}):o.jsxs(Ao,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(jn,{defaultSize:50,minSize:30,children:o.jsx(wl,{})}),o.jsx(Mo,{}),o.jsxs(jn,{defaultSize:50,minSize:25,children:[h&&o.jsx(kl,{className:"border-l border-border"}),c&&o.jsx(mc,{}),p&&o.jsx(Xl,{className:"border-l border-border"})]})]})}),e[10]=n,e[11]=c,e[12]=p,e[13]=h,e[14]=l,e[15]=i,e[16]=b):b=e[16];let j;return e[17]!==x||e[18]!==g||e[19]!==b?(j=o.jsx(he,{children:o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[x,g,b]})}),e[17]=x,e[18]=g,e[19]=b,e[20]=j):j=e[20],j}function Ec(t){const e=C.c(6),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=pe(s),r=i??"no-connection",{org:l}=G(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=ne(a),u=Ut(r,"WORKFLOW_EXECUTION",n,d);let f;return e[4]!==u?(f={item:u},e[4]=u,e[5]=f):f=e[5],f}function Tc(){const t=C.c(8);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const{itemId:n}=pe(e);let s;t[1]!==n?(s={itemId:n},t[1]=n,t[2]=s):s=t[2];const{item:i}=Ec(s);if(!i){let c;return t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(he,{children:o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(rn,{icon:o.jsx(ss,{className:"w-10 h-10 text-muted-foreground"}),title:"Workflow execution not found",description:"This workflow execution may have been deleted or you may not have access to it."})})}),t[3]=c):c=t[3],c}let r;t[4]!==i?(r=JSON.stringify(i,null,2),t[4]=i,t[5]=r):r=t[5];let l;return t[6]!==r?(l=o.jsx(he,{children:o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Le,{height:"100%",code:r,language:"json",readOnly:!0})})}),t[6]=r,t[7]=l):l=t[7],l}const $c={workflow:Ic,workflow_execution:Tc,prompt:Sr};function Oc(){const t=C.c(6),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=decodeURIComponent(s.itemId);let r;t[1]!==e.history?(r=()=>{e.history.back()},t[1]=e.history,t[2]=r):r=t[2];const l=r,c=Rc;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(_r,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Rc(t){return Promise.resolve()}function Ac(t){return t.toLowerCase().split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function Mc(){const t=C.c(38),e=Ln();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=pe(n),i=s.connectionId,r=decodeURIComponent(s.collectionName),l=decodeURIComponent(s.itemId);let c;t[1]!==e.history?(c=()=>{e.history.back()},t[1]=e.history,t[2]=c):c=t[2];const a=c,d=i??"no-connection",{org:u}=G(),f=ct(i),m=i??null;let h;t[3]!==u.id||t[4]!==m?(h={connectionId:m,orgId:u.id},t[3]=u.id,t[4]=m,t[5]=h):h=t[5];const p=ne(h),x=Bt(d,r,p);let g;t[6]!==x||t[7]!==l?(g=async z=>{l&&await x.update.mutateAsync({id:l,data:z})},t[6]=x,t[7]=l,t[8]=g):g=t[8];const b=g;let j;t[9]!==r?(j=r?.toLowerCase(),t[9]=r,t[10]=j):j=t[10];const S=j,y=S&&$c[S];let v;t[11]!==r?(v=Ac(r),t[11]=r,t[12]=v):v=t[12];const w=v;let N;t[13]!==u.slug?(N=o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps",params:{org:u.slug,project:tt},children:"Connections"})})}),t[13]=u.slug,t[14]=N):N=t[14];let E;t[15]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(ot,{}),t[15]=E):E=t[15];let T;t[16]!==r||t[17]!==f||t[18]!==i||t[19]!==u.slug?(T=f&&o.jsxs(o.Fragment,{children:[o.jsx(Pe,{children:o.jsx(st,{asChild:!0,children:o.jsx(et,{to:"/$org/$project/mcps/$connectionId",params:{org:u.slug,project:tt,connectionId:i},search:{tab:r},children:f.title})})}),o.jsx(ot,{})]}),t[16]=r,t[17]=f,t[18]=i,t[19]=u.slug,t[20]=T):T=t[20];let $;t[21]!==w?($=o.jsx(Pe,{children:o.jsx(Gn,{children:w})}),t[21]=w,t[22]=$):$=t[22];let R;t[23]!==$||t[24]!==N||t[25]!==T?(R=o.jsx(Kn,{children:o.jsxs(Jn,{children:[N,E,T,$]})}),t[23]=$,t[24]=N,t[25]=T,t[26]=R):R=t[26];const L=R;if(y){let z;return t[27]!==y||t[28]!==a||t[29]!==b||t[30]!==l?(z=o.jsx(y,{itemId:l,onBack:a,onUpdate:b}),t[27]=y,t[28]=a,t[29]=b,t[30]=l,t[31]=z):z=t[31],z}let I;t[32]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx(Ro,{size:36,className:"text-muted-foreground"}),t[32]=I):I=t[32];let A;t[33]!==a?(A=o.jsx(rn,{icon:I,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[33]=a,t[34]=A):A=t[34];let W;return t[35]!==L||t[36]!==A?(W=o.jsx(he,{breadcrumb:L,children:A}),t[35]=L,t[36]=A,t[37]=W):W=t[37],W}function Pc(){const t=C.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/$project/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=pe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Oc,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Mc,{}),t[2]=r):r=t[2],r}function Nd(){const t=C.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(zn,{children:o.jsx(k.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(Ue,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(Pc,{})})}),t[0]=e):e=t[0],e}export{Nd as default};
|