@decocms/mesh 2.51.2 → 2.51.3
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-CGP1h14a.js → AlertCircle-88ul_ysw.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CpmrevUA.js → ArrowLeft-NTyF5o90.js} +1 -1
- package/dist/client/assets/{ArrowUp-CAhT4Vag.js → ArrowUp-CIHNR5Ti.js} +1 -1
- package/dist/client/assets/{Check-DHrYQOla.js → Check-D3fya4Wu.js} +1 -1
- package/dist/client/assets/{ChevronDown-BXfKwQXg.js → ChevronDown-LpwEwHtC.js} +1 -1
- package/dist/client/assets/{Code01-BxSE-cTG.js → Code01-7r5Rdlst.js} +1 -1
- package/dist/client/assets/{Copy01-BqHNV9KS.js → Copy01-CKl2i95h.js} +1 -1
- package/dist/client/assets/{CpuChip02-CJBnmNd-.js → CpuChip02-D2-gnazp.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-BJ0nWw_n.js → DotsHorizontal-CRhfdELJ.js} +1 -1
- package/dist/client/assets/{DotsVertical-C8_Vocxa.js → DotsVertical-CT3aoNsF.js} +1 -1
- package/dist/client/assets/{Download01-DwaP_Z8x.js → Download01-DDmz-uw3.js} +1 -1
- package/dist/client/assets/{Edit01-0Q09UeyH.js → Edit01-BWyahuqm.js} +1 -1
- package/dist/client/assets/{File06-gnwTn_85.js → File06-C062kR9d.js} +1 -1
- package/dist/client/assets/{FilterLines-B4KQCNKf.js → FilterLines-BQ42EHCX.js} +1 -1
- package/dist/client/assets/{FlipBackward-BBtJOj6N.js → FlipBackward-BEL7qvde.js} +1 -1
- package/dist/client/assets/{Grid01-beE2TRSL.js → Grid01-8xyYPIMC.js} +1 -1
- package/dist/client/assets/{Home02-04BLyxHW.js → Home02-BMUrwm4p.js} +1 -1
- package/dist/client/assets/{Image01-CqBEJ9c0.js → Image01-1lgMHhj4.js} +1 -1
- package/dist/client/assets/{Inbox01-9sfzjxUE.js → Inbox01-BL02sWie.js} +1 -1
- package/dist/client/assets/{InfoCircle--Gk6Y4tA.js → InfoCircle-Bhi4dDxW.js} +1 -1
- package/dist/client/assets/{Key01-CIomR331.js → Key01-ToYP3oYd.js} +1 -1
- package/dist/client/assets/{LinkExternal01-DxcJxnJW.js → LinkExternal01-DZ1WSjmv.js} +1 -1
- package/dist/client/assets/{List-D4q8ermq.js → List-CJDIE54n.js} +1 -1
- package/dist/client/assets/{Loading01-QioKqjl6.js → Loading01-Dy8QJJm0.js} +1 -1
- package/dist/client/assets/{Lock01-DW4hlBxJ.js → Lock01-CC5xTbUZ.js} +1 -1
- package/dist/client/assets/{Pin01-DfrbwmHM.js → Pin01-B_4iXjnX.js} +1 -1
- package/dist/client/assets/{Play-Xat2ooOZ.js → Play-BtZxi1d9.js} +1 -1
- package/dist/client/assets/{Plus-ssdLWeI8.js → Plus-Cyqo5wWM.js} +1 -1
- package/dist/client/assets/{SearchMd-B-MDYOIq.js → SearchMd-DjrVOydc.js} +1 -1
- package/dist/client/assets/{Share07-DWfKI3X_.js → Share07-z08fW9iD.js} +1 -1
- package/dist/client/assets/{Terminal-B7hQNB-9.js → Terminal-Cw45rdqr.js} +1 -1
- package/dist/client/assets/{Trash01-GpfPnmmV.js → Trash01-t4Tlvg9V.js} +1 -1
- package/dist/client/assets/{Upload01-CVe6JP-f.js → Upload01-BJdAsK-z.js} +1 -1
- package/dist/client/assets/{X-D3gEEcBd.js → X-C1PfyXlW.js} +1 -1
- package/dist/client/assets/{XClose-7-Njencf.js → XClose-BL3__4ag.js} +1 -1
- package/dist/client/assets/{agent-detail-iBGUc35B.js → agent-detail-BmsminX4.js} +1 -1
- package/dist/client/assets/{agents-B8mn5GvC.js → agents-DjiXFelk.js} +1 -1
- package/dist/client/assets/{alert-dialog-BYX3XU0x.js → alert-dialog-BiZR0rkH.js} +1 -1
- package/dist/client/assets/{auth-catchall-QtOrkI51.js → auth-catchall-Baj1KizF.js} +1 -1
- package/dist/client/assets/{avatar-COVN-fYN.js → avatar-B9FicdGa.js} +1 -1
- package/dist/client/assets/{badge-ZWFo0qGa.js → badge-BRIxF15Z.js} +1 -1
- package/dist/client/assets/{binder-D5Yo0FIA.js → binder-DjCtRW3S.js} +1 -1
- package/dist/client/assets/{button-BwMxf9J6.js → button-DGXtIS4r.js} +1 -1
- package/dist/client/assets/card-C2IUwHgu.js +1 -0
- package/dist/client/assets/{checkbox-f9zBlxEv.js → checkbox-DPYixgWM.js} +1 -1
- package/dist/client/assets/circle-alert-CLyNdU2a.js +1 -0
- package/dist/client/assets/{collection-detail-DWeFfX0m.js → collection-detail-E5xj04yR.js} +4 -4
- package/dist/client/assets/{collection-display-button-Dk_7tCGN.js → collection-display-button-Bnkvg60-.js} +1 -1
- package/dist/client/assets/{collection-header-BGRNcmIr.js → collection-header-Cpvl7c7v.js} +1 -1
- package/dist/client/assets/{collection-page-CmUp8rbg.js → collection-page-Dbr4bOLa.js} +1 -1
- package/dist/client/assets/{collection-search-Cw31ncc8.js → collection-search-R6F0EA4Z.js} +1 -1
- package/dist/client/assets/{collection-tab-CGwCxBxs.js → collection-tab-DEziz7PL.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-05Dq-PmH.js → collection-table-wrapper-DvJ8m93f.js} +1 -1
- package/dist/client/assets/connect-DwyEXfdO.js +1 -0
- package/dist/client/assets/{connection-card-2D8DJHyQ.js → connection-card-B7hZybfY.js} +1 -1
- package/dist/client/assets/connection-detail-BWtyHgn9.js +1 -0
- package/dist/client/assets/{connections-DAUSeaEc.js → connections-CDlXruIO.js} +1 -1
- package/dist/client/assets/constants-BKu68b-2.js +1 -0
- package/dist/client/assets/{constants-DaEAuvNm.js → constants-CiBjUY6S.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-Cc_XYqH6.js → create-organization-dialog-BvNAPyJM.js} +1 -1
- package/dist/client/assets/{dialog-6JHIWxB1.js → dialog-Dp-FrMKH.js} +1 -1
- package/dist/client/assets/{dropdown-menu-ClVp7BVI.js → dropdown-menu-Ci3MYNnW.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-DnQCFevi.js → dynamic-plugin-layout-CthjHCZX.js} +1 -1
- package/dist/client/assets/{empty-state-BqZB7ri3.js → empty-state-BQFxfBdg.js} +1 -1
- package/dist/client/assets/{empty-state-D4usWvmz.js → empty-state-hXm8EOg-.js} +1 -1
- package/dist/client/assets/{env-vars-editor-D5NAu_mP.js → env-vars-editor-CRLhIL72.js} +1 -1
- package/dist/client/assets/{error-boundary-sXeRiEr7.js → error-boundary-C8Ilx4jY.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CcfCh6f7.js → extract-connection-data-BayHmzKl.js} +1 -1
- package/dist/client/assets/{file-browser-HHJSYs-c.js → file-browser-C7VjiPNZ.js} +2 -2
- package/dist/client/assets/{form-D7SCGNVK.js → form-EJExLEda.js} +1 -1
- package/dist/client/assets/{grid-view-CuW3QwuQ.js → grid-view-B95AcZAl.js} +1 -1
- package/dist/client/assets/{home-BardKBVC.js → home-_eXW_Wgz.js} +1 -1
- package/dist/client/assets/{index-Bi2JhEJc.js → index-B-4tMlZ4.js} +1 -1
- package/dist/client/assets/{index-CZvP6SmL.js → index-CPMXBs-i.js} +11 -11
- package/dist/client/assets/{index-DOcZKr-9.js → index-Chv5FQ3d.js} +1 -1
- package/dist/client/assets/{index-DgXF3qY1.js → index-DiFlLLdH.js} +1 -1
- package/dist/client/assets/index-DwxqbLSv.js +25 -0
- package/dist/client/assets/{index-DHE3rugI.js → index-DzjdURWp.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-WblNte-F.js → infiniteQueryObserver-CEDMOMFB.js} +1 -1
- package/dist/client/assets/{input-DMB0iMp-.js → input-ChhfDVgL.js} +1 -1
- package/dist/client/assets/{layout-COIF9hBU.js → layout-D1FFvDia.js} +1 -1
- package/dist/client/assets/{localstorage-keys-C9yqmCkX.js → localstorage-keys-B9csLyjJ.js} +1 -1
- package/dist/client/assets/{login-CMj3RuL-.js → login-CRvmY_C3.js} +1 -1
- package/dist/client/assets/{mcp-oauth-Dj_c8299.js → mcp-oauth-CUvjwG59.js} +1 -1
- package/dist/client/assets/{mcp-server-card-C8wN3V2s.js → mcp-server-card-DY2Rh7My.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-BYb9bzDh.js → mcp-server-detail-BZBKmN-Q.js} +2 -2
- package/dist/client/assets/{members-hmSHO8JG.js → members-BpCUK5ii.js} +1 -1
- package/dist/client/assets/{monaco-editor-B4tACOzt.js → monaco-editor-DHNJO_F-.js} +3 -3
- package/dist/client/assets/{monitoring-Bo0kqe6D.js → monitoring-C5DnJiAi.js} +1 -1
- package/dist/client/assets/{oauth-callback-CHD2Xjfu.js → oauth-callback-OzUxeUgS.js} +1 -1
- package/dist/client/assets/{page-C9aoP-fQ.js → page-Wz0vnXHW.js} +1 -1
- package/dist/client/assets/{page-BRV-YC6d.js → page-tUZebgnx.js} +1 -1
- package/dist/client/assets/{pin-to-sidebar-button-oW7kV1a5.js → pin-to-sidebar-button-DXwZpUKr.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-B1ecZl1M.js → plugin-empty-state-C5eUmqSe.js} +1 -1
- package/dist/client/assets/{plugin-header-DSx39XZl.js → plugin-header-Du58aXLz.js} +1 -1
- package/dist/client/assets/{plugins-DUGm422i.js → plugins-D0mD4fXK.js} +1 -1
- package/dist/client/assets/{popover-kBoMNvtb.js → popover-C7DRUwpl.js} +1 -1
- package/dist/client/assets/{registry-utils-Cay66DXx.js → registry-utils-B1mgs3VU.js} +1 -1
- package/dist/client/assets/{resizable-Cbv7HFwi.js → resizable-B0_3KR6z.js} +1 -1
- package/dist/client/assets/{resource-tabs-Bd5BfKkE.js → resource-tabs-DEAxabnk.js} +1 -1
- package/dist/client/assets/{select-D9FKewR6.js → select-Mueooxt8.js} +1 -1
- package/dist/client/assets/{settings-DWV7so73.js → settings-DRajtAsd.js} +1 -1
- package/dist/client/assets/{shell-layout-BPJmUU9T.js → shell-layout-CpecmQWv.js} +2 -2
- package/dist/client/assets/{spinner-B63zH740.js → spinner-rREEpFsD.js} +1 -1
- package/dist/client/assets/{switch-QVCUfP0T.js → switch-ue8XKEOV.js} +1 -1
- package/dist/client/assets/{textarea-oI39PZ4j.js → textarea-KtnUafWW.js} +1 -1
- package/dist/client/assets/{tool-set-selector-CrxDaSzt.js → tool-set-selector-CVhoN0PI.js} +1 -1
- package/dist/client/assets/{tools-list-czdszUUV.js → tools-list-CZPa8MOr.js} +1 -1
- package/dist/client/assets/{tooltip-BeaFHZHO.js → tooltip-DaWgyZoK.js} +1 -1
- package/dist/client/assets/{typewriter-title-CwzGiUE8.js → typewriter-title-BS4qTagW.js} +1 -1
- package/dist/client/assets/{use-binding-CYKCgkMl.js → use-binding-zGEPhmwS.js} +1 -1
- package/dist/client/assets/{use-collections-BGuD4Asz.js → use-collections-mtxV8ZME.js} +1 -1
- package/dist/client/assets/{use-connection-CzhWY9E1.js → use-connection-L5OJ6J3E.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-U2JDJLU0.js → use-create-virtual-mcp-63RybENu.js} +1 -1
- package/dist/client/assets/{use-list-state-BDr3eR2Q.js → use-list-state-BuRvdydO.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-Cr9ZbnL8.js → use-mcp-prompts-DV5AIYC4.js} +1 -1
- package/dist/client/assets/{use-members-C4nx4yGs.js → use-members-CYYoWYpk.js} +1 -1
- package/dist/client/assets/{use-mobile-BcokTJ-3.js → use-mobile-d9OXIPZr.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DDgAtCf6.js → use-organization-settings-DDB2mOfc.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CeNgek3n.js → use-virtual-mcp-CJcxnVAF.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-D9Q5pmO1.js +1 -0
- package/dist/client/assets/{useMutation-BxCryVcg.js → useMutation-D_REnhHk.js} +1 -1
- package/dist/client/assets/useQuery-BwF41IZH.js +1 -0
- package/dist/client/assets/{view-mode-toggle-CJjzapvU.js → view-mode-toggle-Db_7Xzo4.js} +1 -1
- package/dist/client/assets/{workflow-B4Z5pkBE.js → workflow-DI8SlGcD.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/card-C8fw2vIu.js +0 -1
- package/dist/client/assets/connect-0wOgtuwA.js +0 -1
- package/dist/client/assets/connection-detail-7LQsO9wN.js +0 -1
- package/dist/client/assets/constants-DIeNizBe.js +0 -1
- package/dist/client/assets/index-v5n9Yu7p.js +0 -25
- package/dist/client/assets/useInfiniteQuery-DQhhwYgp.js +0 -1
- package/dist/client/assets/useQuery-BfZvKTGb.js +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{bG as Q,r as C,o as Ms,s as mt,c as N,j as o,bg as It,u as Y,d as Ps,m as Ls,a as oe,g as zs,a8 as gn,bz as F,bH as Ds,ak as Ws,ai as _t,aj as ne,al as bn,am as Hs,ae as Tt,af as Fs,an as jn,ah as vn,au as Vs,av as Bs,aq as yn,aw as Us,bI as $t,bJ as qs,ag as Ks,bc as Js,b6 as Gs,bK as Zs,bq as wn}from"./index-CZvP6SmL.js";import{E as Sn,I as Ye,n as Xs}from"./empty-state-BqZB7ri3.js";import{E as Nn}from"./error-boundary-sXeRiEr7.js";import{a as Et,u as Ot,f as Rt,e as At,d as Mt}from"./use-collections-BGuD4Asz.js";import{u as ee}from"./constants-DaEAuvNm.js";import{P as Pt}from"./pin-to-sidebar-button-oW7kV1a5.js";import{B as V,c as O}from"./button-BwMxf9J6.js";import{F as pt,a as Qs,b as Lt,d as zt}from"./form-D7SCGNVK.js";import{I as Dt}from"./input-DMB0iMp-.js";import{T as yt}from"./textarea-oI39PZ4j.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-BeaFHZHO.js";import{i as kn}from"./FlipBackward-BBtJOj6N.js";import{a as Cn,V as Wt,b as Ee}from"./layout-COIF9hBU.js";import{S as In,a as _n,b as Tn,c as $n,d as wt}from"./select-D9FKewR6.js";import{i as Ys}from"./AlertCircle-CGP1h14a.js";import{s as eo,M as Oe}from"./monaco-editor-B4tACOzt.js";import{i as to}from"./Code01-BxSE-cTG.js";import{a as no}from"./Copy01-BqHNV9KS.js";import{i as ze}from"./Loading01-QioKqjl6.js";import{i as Ht,n as so}from"./Play-Xat2ooOZ.js";import{s as Ft}from"./XClose-7-Njencf.js";import{u as oo,O as ro,M as io,F as lo,v as co}from"./index-v5n9Yu7p.js";import{u as Vt,b as ao}from"./use-connection-CzhWY9E1.js";import{E as Bt}from"./empty-state-D4usWvmz.js";import{D as uo,a as fo}from"./use-binding-CYKCgkMl.js";import{b as En}from"./use-virtual-mcp-CeNgek3n.js";import{b as mo,R as rn,a as po}from"./resizable-Cbv7HFwi.js";import{S as De}from"./spinner-B63zH740.js";import{V as xo}from"./view-mode-toggle-CJjzapvU.js";import{N as ho,b as go,c as bo,d as jo,m as Ke,P as vo,e as yo,R as wo,f as So,g as No,h as ln,E as ko,j as Co,T as Io,k as _o,l as To,n as On}from"./index-DOcZKr-9.js";import{b as $o,c as Eo,d as Oo,e as Ro,a as Ao,D as Mo}from"./dialog-6JHIWxB1.js";import"./index-DgXF3qY1.js";import{s as Rn}from"./Plus-ssdLWeI8.js";import{i as Ut}from"./Check-DHrYQOla.js";import{i as Po}from"./DotsHorizontal-BJ0nWw_n.js";import{D as Lo,a as zo,b as Do,c as cn}from"./dropdown-menu-ClVp7BVI.js";import{i as Wo}from"./Grid01-beE2TRSL.js";import{B as $e}from"./badge-ZWFo0qGa.js";import{i as An}from"./X-D3gEEcBd.js";import"./useMutation-BxCryVcg.js";import"./useQuery-BfZvKTGb.js";import"./Pin01-DfrbwmHM.js";import"./use-organization-settings-DDgAtCf6.js";import"./ArrowLeft-CpmrevUA.js";import"./ChevronDown-BXfKwQXg.js";import"./infiniteQueryObserver-WblNte-F.js";import"./mcp-oauth-Dj_c8299.js";import"./env-vars-editor-D5NAu_mP.js";import"./Trash01-GpfPnmmV.js";import"./File06-gnwTn_85.js";import"./Key01-CIomR331.js";import"./extract-connection-data-CcfCh6f7.js";import"./constants-DIeNizBe.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-Cay66DXx.js";import"./generate-id-Dyweu44Y.js";import"./CpuChip02-CJBnmNd-.js";import"./Terminal-B7hQNB-9.js";import"./index-Bi2JhEJc.js";import"./binder-D5Yo0FIA.js";import"./localstorage-keys-C9yqmCkX.js";import"./popover-kBoMNvtb.js";import"./Image01-CqBEJ9c0.js";import"./SearchMd-B-MDYOIq.js";import"./use-mcp-prompts-Cr9ZbnL8.js";import"./ArrowUp-CAhT4Vag.js";import"./Edit01-0Q09UeyH.js";import"./use-create-virtual-mcp-U2JDJLU0.js";const Mn=Q("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 Pn=Q("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 qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Ho=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Fo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Vo=Q("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 Ln=Q("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 zn=Q("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 Dn=Q("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 Wn=Q("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 Hn=Q("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"}]]),Jt=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));Jt.displayName="AlertOctagon";const Fn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Fn.displayName="Box";const Vn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Vn.displayName="ClockFastForward";const Bn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Bn.displayName="Code02";const Je=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Je.displayName="Columns01";const Un=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Un.displayName="CornerDownRight";const qn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));qn.displayName="Database01";const Kn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Kn.displayName="GitBranch01";const Jn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Jn.displayName="Repeat03";const Gt=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";const Gn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));Gn.displayName="Tool01";Ms({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Bo(){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 Uo(t){const e=N.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(pt,{control:n.control,name:"title",render:Jo}),o.jsx(pt,{control:n.control,name:"description",render:Ko})]})]}),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(pt,{control:n.control,name:"body",render:qo})]}),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(Qs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function qo(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...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 Ko(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...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 Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Go(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),p=Ot(n,"PROMPT",u),x=p.update.isPending;let m;e[3]!==f?(m=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=m):m=e[4];let h;e[5]!==m?(h={values:m},e[5]=m,e[6]=h):h=e[6];const g=Ps(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==p.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await p.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=p.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const w=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let S;e[17]!==f.description?(S=f.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:f.description})]}):null,e[17]=f.description,e[18]=S):S=e[18];let k;e[19]!==v||e[20]!==S?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,S]})}),e[19]=v,e[20]=S,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let M;e[25]===Symbol.for("react.memo_cache_sentinel")?(M=o.jsx(kn,{size:14}),e[25]=M):M=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:M})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let A;e[32]!==w?(A=()=>{w()},e[32]=w,e[33]=A):A=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==A?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:A,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=A,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(Uo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let X;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(X=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=X):X=e[51],X}function Zo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Bo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Go,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Xo=Ls("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 Qo(t){const e=N.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=O(Xo({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 Yo(t){const e=N.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=O("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 er(t){const e=N.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=O("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 tr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function nr(t){const e=N.c(10),{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=oo(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(ro,{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]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(sr,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function sr({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=zs({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[p,x]=C.useState(null),[m,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:w}=Y(),v=Vt(e),S=ee({connectionId:e,orgId:w.id}),k=Rt({client:S}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,M=T?Object.keys(T):[],R=M.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of M)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!S)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await S.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),X=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${X}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},A=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??tr(t),url:i,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(Ye,{icon:v?.icon||null,name:v?.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:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{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:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.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"}),I?.inputSchema?.required&&I.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:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>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:[_,I.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:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>A(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(wt,{value:"true",children:"true"}),o.jsx(wt,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>A(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.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"}),j&&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(eo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.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(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!p&&!m,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),m&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Qo,{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(Ys,{className:"h-4 w-4"}),o.jsx(Yo,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(er,{className:"text-xs text-destructive",children:m})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:p?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(p,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{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(p,null,2)),gn.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(to,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function or(t){const e=N.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=oe(i).connectionId;if(!Vt(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(ze,{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(C.Suspense,{fallback:a,children:o.jsx(nr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const p=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,p))}},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},Zt=(t=>t?an(t):an),rr=t=>t;function St(t,e=rr){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const ir=t=>{const e=Zt(t),n=s=>St(e,s);return Object.assign(n,e),n},lr=(t=>ir);function Zn(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 Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},cr=(t,e)=>(n,s,i)=>{let r={storage:Zn(()=>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})},p=i.setState;i.setState=(g,b)=>(p(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let m;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(w=>{var v;return w((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==r.version){if(r.migrate){const v=r.migrate(w.state,w.version);return v instanceof Promise?v.then(S=>[!0,S]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var v;if(j!==c)return;const[S,k]=w;if(m=r.merge(k,(v=s())!=null?v:x),n(m,!0),S)return f()}).then(()=>{j===c&&(y?.(m,void 0),m=s(),l=!0,d.forEach(w=>w(m)))}).catch(w=>{j===c&&y?.(void 0,w)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),m||x},Xn=cr,{useSyncExternalStoreWithSelector:ar}=Ds,dr=t=>t;function ur(t,e=dr,n){const s=ar(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(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},fr=(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 mr(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:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):fr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function pr(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{bI as Q,r as C,o as As,s as mt,c as N,j as o,bg as It,u as Y,d as Ps,m as Ls,a as oe,g as zs,a8 as gn,bB as F,bJ as Ds,ak as Ws,ai as _t,aj as ne,al as bn,am as Hs,ae as Tt,af as Fs,an as jn,ah as vn,au as Vs,av as Bs,aq as yn,aw as Us,bK as $t,bL as qs,ag as Ks,bc as Js,b6 as Gs,bM as Zs,bq as wn}from"./index-CPMXBs-i.js";import{E as Sn,I as Ye,n as Xs}from"./empty-state-BQFxfBdg.js";import{E as Nn}from"./error-boundary-C8Ilx4jY.js";import{a as Et,u as Ot,f as Rt,e as Mt,d as At}from"./use-collections-mtxV8ZME.js";import{u as ee}from"./constants-CiBjUY6S.js";import{P as Pt}from"./pin-to-sidebar-button-DXwZpUKr.js";import{B as V,c as O}from"./button-DGXtIS4r.js";import{F as pt,a as Qs,b as Lt,d as zt}from"./form-EJExLEda.js";import{I as Dt}from"./input-ChhfDVgL.js";import{T as yt}from"./textarea-KtnUafWW.js";import{T as le,a as ce,b as ae,c as de}from"./tooltip-DaWgyZoK.js";import{i as kn}from"./FlipBackward-BEL7qvde.js";import{a as Cn,V as Wt,b as Ee}from"./layout-D1FFvDia.js";import{S as In,a as _n,b as Tn,c as $n,d as wt}from"./select-Mueooxt8.js";import{i as Ys}from"./AlertCircle-88ul_ysw.js";import{s as eo,M as Oe}from"./monaco-editor-DHNJO_F-.js";import{i as to}from"./Code01-7r5Rdlst.js";import{a as no}from"./Copy01-CKl2i95h.js";import{i as ze}from"./Loading01-Dy8QJJm0.js";import{i as Ht,n as so}from"./Play-BtZxi1d9.js";import{s as Ft}from"./XClose-BL3__4ag.js";import{u as oo,O as ro,M as io,F as lo,v as co}from"./index-DwxqbLSv.js";import{u as Vt,b as ao}from"./use-connection-L5OJ6J3E.js";import{E as Bt}from"./empty-state-hXm8EOg-.js";import{D as uo,a as fo}from"./use-binding-zGEPhmwS.js";import{b as En}from"./use-virtual-mcp-CJcxnVAF.js";import{b as mo,R as rn,a as po}from"./resizable-B0_3KR6z.js";import{S as De}from"./spinner-rREEpFsD.js";import{V as xo}from"./view-mode-toggle-Db_7Xzo4.js";import{N as ho,b as go,c as bo,d as jo,m as Ke,P as vo,e as yo,R as wo,f as So,g as No,h as ln,E as ko,j as Co,T as Io,k as _o,l as To,n as On}from"./index-Chv5FQ3d.js";import{b as $o,c as Eo,d as Oo,e as Ro,a as Mo,D as Ao}from"./dialog-Dp-FrMKH.js";import"./index-DiFlLLdH.js";import{s as Rn}from"./Plus-Cyqo5wWM.js";import{i as Ut}from"./Check-D3fya4Wu.js";import{i as Po}from"./DotsHorizontal-CRhfdELJ.js";import{D as Lo,a as zo,b as Do,c as cn}from"./dropdown-menu-Ci3MYNnW.js";import{i as Wo}from"./Grid01-8xyYPIMC.js";import{B as $e}from"./badge-BRIxF15Z.js";import{i as Mn}from"./X-C1PfyXlW.js";import"./useMutation-D_REnhHk.js";import"./useQuery-BwF41IZH.js";import"./Pin01-B_4iXjnX.js";import"./use-organization-settings-DDB2mOfc.js";import"./ArrowLeft-NTyF5o90.js";import"./ChevronDown-LpwEwHtC.js";import"./infiniteQueryObserver-CEDMOMFB.js";import"./mcp-oauth-CUvjwG59.js";import"./env-vars-editor-CRLhIL72.js";import"./Trash01-t4Tlvg9V.js";import"./File06-C062kR9d.js";import"./Key01-ToYP3oYd.js";import"./extract-connection-data-BayHmzKl.js";import"./constants-BKu68b-2.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-B1mgs3VU.js";import"./generate-id-Dyweu44Y.js";import"./CpuChip02-D2-gnazp.js";import"./Terminal-Cw45rdqr.js";import"./index-B-4tMlZ4.js";import"./circle-alert-CLyNdU2a.js";import"./binder-DjCtRW3S.js";import"./localstorage-keys-B9csLyjJ.js";import"./popover-C7DRUwpl.js";import"./Image01-1lgMHhj4.js";import"./SearchMd-DjrVOydc.js";import"./use-mcp-prompts-DV5AIYC4.js";import"./ArrowUp-CIHNR5Ti.js";import"./Edit01-BWyahuqm.js";import"./use-create-virtual-mcp-63RybENu.js";const An=Q("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 Pn=Q("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 qt=Q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Kt=Q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const Ho=Q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);const Fo=Q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const Vo=Q("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 Ln=Q("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 zn=Q("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 Dn=Q("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 Wn=Q("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 Hn=Q("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"}]]),Jt=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M12 8v4m0 4h.01M2 8.523v6.954c0 .245 0 .367.028.482a1 1 0 0 0 .12.29c.061.1.148.187.32.36l4.923 4.922c.173.173.26.26.36.322.09.054.188.095.29.12.115.027.237.027.482.027h6.954c.245 0 .367 0 .482-.028a.998.998 0 0 0 .29-.12c.1-.061.187-.148.36-.32l4.922-4.923c.173-.173.26-.26.322-.36a.998.998 0 0 0 .12-.29c.027-.115.027-.237.027-.482V8.523c0-.245 0-.367-.028-.482a.998.998 0 0 0-.12-.29c-.061-.1-.148-.187-.32-.36L16.608 2.47c-.173-.173-.26-.26-.36-.322a1 1 0 0 0-.29-.12C15.844 2 15.722 2 15.477 2H8.523c-.245 0-.367 0-.482.028a1 1 0 0 0-.29.12c-.1.061-.187.148-.36.32L2.47 7.392c-.173.173-.26.26-.322.36a1 1 0 0 0-.12.29C2 8.156 2 8.278 2 8.523Z"}));Jt.displayName="AlertOctagon";const Fn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Fn.displayName="Box";const Vn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));Vn.displayName="ClockFastForward";const Bn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"m17 17 5-5-5-5M7 7l-5 5 5 5m7-14-4 18"}));Bn.displayName="Code02";const Je=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Je.displayName="Columns01";const Un=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Un.displayName="CornerDownRight";const qn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));qn.displayName="Database01";const Kn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Kn.displayName="GitBranch01";const Jn=({size:t=24,color:e="currentColor",...n})=>C.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},C.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"}));Jn.displayName="Repeat03";const Gt=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M15 8H8.6c-.56 0-.84 0-1.054-.109a1 1 0 0 1-.437-.437C7 7.24 7 6.96 7 6.4V3m10 18v-6.4c0-.56 0-.84-.109-1.054a1 1 0 0 0-.437-.437C16.24 13 15.96 13 15.4 13H8.6c-.56 0-.84 0-1.054.109a1 1 0 0 0-.437.437C7 13.76 7 14.04 7 14.6V21M21 9.325V16.2c0 1.68 0 2.52-.327 3.162a3 3 0 0 1-1.311 1.311C18.72 21 17.88 21 16.2 21H7.8c-1.68 0-2.52 0-3.162-.327a3 3 0 0 1-1.311-1.311C3 18.72 3 17.88 3 16.2V7.8c0-1.68 0-2.52.327-3.162a3 3 0 0 1 1.311-1.311C5.28 3 6.12 3 7.8 3h6.875c.489 0 .733 0 .963.055.204.05.4.13.579.24.201.123.374.296.72.642l3.126 3.126c.346.346.519.519.642.72.11.18.19.374.24.579.055.23.055.474.055.963Z"}));Gt.displayName="Save02";const Gn=({size:t=24,color:e="currentColor",...n})=>C.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},C.createElement("path",{d:"M15.631 7.631c-.396-.396-.594-.594-.668-.822a1 1 0 0 1 0-.618c.074-.228.272-.426.668-.822L18.47 2.53a6 6 0 0 0-8.3 6.895c.12.49.179.734.168.888a.849.849 0 0 1-.11.392c-.07.138-.207.274-.48.547L3.5 17.5a2.121 2.121 0 0 0 3 3l6.248-6.248c.273-.273.41-.41.547-.48a.849.849 0 0 1 .392-.11c.154-.011.399.049.888.168a6 6 0 0 0 6.895-8.3l-2.84 2.84c-.396.396-.594.594-.822.668a1 1 0 0 1-.618 0c-.228-.074-.426-.272-.822-.668l-.738-.738Z"}));Gn.displayName="Tool01";As({title:mt().min(1),description:mt().nullable(),body:mt()});function xt(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function Bo(){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 Uo(t){const e=N.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(pt,{control:n.control,name:"title",render:Jo}),o.jsx(pt,{control:n.control,name:"description",render:Ko})]})]}),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(pt,{control:n.control,name:"body",render:qo})]}),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(Qs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function qo(t){const{field:e}=t;return o.jsx(Lt,{children:o.jsx(zt,{children:o.jsx(yt,{...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 Ko(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(zt,{children:o.jsx(Dt,{...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 Jo(t){const{field:e}=t;return o.jsxs(Lt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(zt,{children:o.jsx(Dt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function Go(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=It().location.href,{org:c}=Y(),a=n||null;let d;e[0]!==c.id||e[1]!==a?(d={connectionId:a,orgId:c.id},e[0]=c.id,e[1]=a,e[2]=d):d=e[2];const u=ee(d),f=Et(n,"PROMPT",s,u),p=Ot(n,"PROMPT",u),x=p.update.isPending;let m;e[3]!==f?(m=f?{title:f.title,description:f.description??null,body:xt(f)}:void 0,e[3]=f,e[4]=m):m=e[4];let h;e[5]!==m?(h={values:m},e[5]=m,e[6]=h):h=e[6];const g=Ps(h);let b;e[7]!==g||e[8]!==f?(b=()=>{f&&g.reset({title:f.title,description:f.description??null,body:xt(f)})},e[7]=g,e[8]=f,e[9]=b):b=e[9];const j=b;let y;e[10]!==p.update||e[11]!==g||e[12]!==s?(y=g.handleSubmit(async D=>{const G=await p.update.mutateAsync({id:s,data:{title:D.title,description:D.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:D.body}}]}});g.reset({title:G.title,description:G.description??null,body:xt(G)})}),e[10]=p.update,e[11]=g,e[12]=s,e[13]=y):y=e[13];const w=y;if(!f){let D;return e[14]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=D):D=e[14],D}let v;e[15]!==f.title?(v=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.title}),e[15]=f.title,e[16]=v):v=e[16];let S;e[17]!==f.description?(S=f.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:f.description})]}):null,e[17]=f.description,e[18]=S):S=e[18];let k;e[19]!==v||e[20]!==S?(k=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,S]})}),e[19]=v,e[20]=S,e[21]=k):k=e[21];let I;e[22]!==f.title||e[23]!==l?(I=o.jsx(Pt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=I):I=e[24];const T=!g.formState.isDirty||x;let A;e[25]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(kn,{size:14}),e[25]=A):A=e[25];let R;e[26]!==j||e[27]!==T?(R=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:T,onClick:j,"aria-label":"Cancel",children:A})})}),e[26]=j,e[27]=T,e[28]=R):R=e[28];let P;e[29]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(ce,{side:"bottom",children:"Cancel"}),e[29]=P):P=e[29];let z;e[30]!==R?(z=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[R,P]})}),e[30]=R,e[31]=z):z=e[31];const q=!g.formState.isDirty||x;let M;e[32]!==w?(M=()=>{w()},e[32]=w,e[33]=M):M=e[33];let J;e[34]===Symbol.for("react.memo_cache_sentinel")?(J=o.jsx(Gt,{size:14}),e[34]=J):J=e[34];let _;e[35]!==q||e[36]!==M?(_=o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:q,onClick:M,"aria-label":"Save",children:J})})}),e[35]=q,e[36]=M,e[37]=_):_=e[37];let $;e[38]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ce,{side:"bottom",children:"Save"}),e[38]=$):$=e[38];let E;e[39]!==_?(E=o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[_,$]})}),e[39]=_,e[40]=E):E=e[40];let L;e[41]!==I||e[42]!==z||e[43]!==E?(L=o.jsxs(Wt,{children:[I,z,E]}),e[41]=I,e[42]=z,e[43]=E,e[44]=L):L=e[44];let H;e[45]!==g?(H=o.jsx("div",{className:"h-full",children:o.jsx(Uo,{form:g})}),e[45]=g,e[46]=H):H=e[46];let X;return e[47]!==i||e[48]!==L||e[49]!==H||e[50]!==k?(X=o.jsxs(Ee,{onBack:i,children:[k,L,H]}),e[47]=i,e[48]=L,e[49]=H,e[50]=k,e[51]=X):X=e[51],X}function Zo(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=Bo(),e[0]=i):i=e[0];const r=i;if(!r){let c;return e[1]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Sn,{title:"Prompt not found",description:"Missing connection information in the current route."})}),e[1]=c):c=e[1],c}let l;return e[2]!==n||e[3]!==s?(l=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(Go,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const Xo=Ls("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 Qo(t){const e=N.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=O(Xo({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 Yo(t){const e=N.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=O("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 er(t){const e=N.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=O("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 tr=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function nr(t){const e=N.c(10),{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=oo(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(ro,{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]!==i||e[7]!==c||e[8]!==n?(a=o.jsx(sr,{toolName:n,connectionId:s,onBack:i},c),e[5]=s,e[6]=i,e[7]=c,e[8]=n,e[9]=a):a=e[9],a}function sr({toolName:t,connectionId:e,onBack:n}){const i=It().location.href,{replayId:r}=zs({strict:!1}),l=(()=>{if(!r)return null;const _=`replay-${r}`,$=sessionStorage.getItem(_);if(!$)return null;sessionStorage.removeItem(_);try{return JSON.parse($)}catch{return null}})(),c=(()=>{if(!l)return null;const _={};for(const[$,E]of Object.entries(l))E!==null&&typeof E=="object"?_[$]=JSON.stringify(E,null,2):_[$]=E;return _})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[p,x]=C.useState(null),[m,h]=C.useState(null),[g,b]=C.useState(!1),[j,y]=C.useState(null),{org:w}=Y(),v=Vt(e),S=ee({connectionId:e,orgId:w.id}),k=Rt({client:S}),I=k.data?.tools?.find(_=>_.name===t),T=I?.inputSchema?.properties,A=T?Object.keys(T):[],R=A.length>0,P={};if(R&&I?.inputSchema?.properties)for(const _ of A)P[_]=I.inputSchema.required?.includes(_)?"":void 0;const z=_=>Object.prototype.hasOwnProperty.call(a,_),q=async()=>{b(!0),h(null),x(null),y(null);const _=performance.now();try{if(!S)throw new Error("MCP client is not available");const $=R?{...P,...a}:(()=>{const B=u.trim();if(!B)return{};const K=JSON.parse(B);if(K&&typeof K=="object")return K;throw new Error("Raw JSON input must be an object.")})();R&&I?.inputSchema?.properties&&Object.entries(I.inputSchema.properties).forEach(([B,K])=>{if((K.type==="object"||K.type==="array")&&typeof $[B]=="string")try{$[B]=JSON.parse($[B])}catch{}});const E=await S.callTool({name:t,arguments:$}),L=E.structuredContent??E,H=performance.now(),X=Math.round(H-_);x(L);const D=JSON.stringify(L),G=new TextEncoder().encode(D).length;y({duration:`${X}ms`,bytes:`${G} bytes`,tokens:`~${Math.ceil(G/4)} tokens`,cost:"$0.0000"})}catch($){const E=$ instanceof Error?$.message:String($);h(E||"Unknown error occurred");const L=performance.now();y({duration:`${Math.round(L-_)}ms`})}finally{b(!1)}},M=(_,$)=>{d(E=>({...E,[_]:$}))},J=()=>{x(null),h(null),y(null)};return o.jsxs(Ee,{onBack:n,children:[o.jsx(Wt,{children:o.jsx(Pt,{title:I?.name??tr(t),url:i,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(Ye,{icon:v?.icon||null,name:v?.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:[k.isSuccess?o.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-green-500 animate-pulse shrink-0"}):k.isLoading?o.jsx(ze,{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:k.isSuccess?"ready":k.isLoading?"connecting":"error"})]})]}),o.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:I?.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"}),I?.inputSchema?.required&&I.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:R&&I?.inputSchema?.properties?Object.entries(I.inputSchema.properties).map(([_,$])=>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:[_,I.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:$.type})]}),$.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:$.description}),$.type==="object"||$.type==="array"?o.jsx(yt,{className:"font-mono text-xs",value:z(_)?a[_]??"":P[_]??"",onChange:E=>M(_,E.target.value),placeholder:`Enter ${_} as JSON...`,rows:3}):$.type==="boolean"?o.jsxs(In,{value:z(_)?String(a[_]??""):"",onValueChange:E=>M(_,E==="true"),children:[o.jsx(_n,{children:o.jsx(Tn,{placeholder:"Select true or false..."})}),o.jsxs($n,{children:[o.jsx(wt,{value:"true",children:"true"}),o.jsx(wt,{value:"false",children:"false"})]})]}):o.jsx(Dt,{value:z(_)?a[_]??"":P[_]??"",onChange:E=>M(_,E.target.value),placeholder:`Enter ${_}...`})]},_)):I?.inputSchema&&!R?o.jsxs("div",{className:"space-y-2",children:[o.jsx("label",{className:"text-sm font-medium",children:"Raw JSON Input"}),o.jsx(yt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:_=>f(_.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"}),j&&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(eo,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.duration})]}),j.tokens&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(Fn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.tokens})]}),j.bytes&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx(qn,{className:"h-3 w-3 text-muted-foreground"}),o.jsx("span",{className:"font-mono text-foreground",children:j.bytes})]}),j.cost&&o.jsx("div",{className:"flex items-center gap-1.5",children:o.jsx("span",{className:"font-mono text-foreground",children:j.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(V,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:q,disabled:g,children:g?o.jsxs(o.Fragment,{children:[o.jsx(ze,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Ht,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ae,{children:o.jsxs(de,{children:[o.jsx(le,{asChild:!0,children:o.jsx(V,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:J,disabled:!p&&!m,children:o.jsx(Ft,{size:14})})}),o.jsx(ce,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),m&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(Qo,{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(Ys,{className:"h-4 w-4"}),o.jsx(Yo,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(er,{className:"text-xs text-destructive",children:m})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:p?o.jsxs(o.Fragment,{children:[o.jsx(Oe,{code:JSON.stringify(p,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(V,{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(p,null,2)),gn.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(to,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function or(t){const e=N.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=oe(i).connectionId;if(!Vt(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(ze,{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(C.Suspense,{fallback:a,children:o.jsx(nr,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const an=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const p=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,p))}},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},Zt=(t=>t?an(t):an),rr=t=>t;function St(t,e=rr){const n=F.useSyncExternalStore(t.subscribe,F.useCallback(()=>e(t.getState()),[t,e]),F.useCallback(()=>e(t.getInitialState()),[t,e]));return F.useDebugValue(n),n}const ir=t=>{const e=Zt(t),n=s=>St(e,s);return Object.assign(n,e),n},lr=(t=>ir);function Zn(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 Nt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return Nt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Nt(s)(n)}}}},cr=(t,e)=>(n,s,i)=>{let r={storage:Zn(()=>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})},p=i.setState;i.setState=(g,b)=>(p(g,b),f());const x=t((...g)=>(n(...g),f()),s,i);i.getInitialState=()=>x;let m;const h=()=>{var g,b;if(!u)return;const j=++c;l=!1,a.forEach(w=>{var v;return w((v=s())!=null?v:x)});const y=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(g=s())!=null?g:x))||void 0;return Nt(u.getItem.bind(u))(r.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==r.version){if(r.migrate){const v=r.migrate(w.state,w.version);return v instanceof Promise?v.then(S=>[!0,S]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,w.state];return[!1,void 0]}).then(w=>{var v;if(j!==c)return;const[S,k]=w;if(m=r.merge(k,(v=s())!=null?v:x),n(m,!0),S)return f()}).then(()=>{j===c&&(y?.(m,void 0),m=s(),l=!0,d.forEach(w=>w(m)))}).catch(w=>{j===c&&y?.(void 0,w)})};return i.persist={setOptions:g=>{r={...r,...g},g.storage&&(u=g.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>h(),hasHydrated:()=>l,onHydrate:g=>(a.add(g),()=>{a.delete(g)}),onFinishHydration:g=>(d.add(g),()=>{d.delete(g)})},r.skipHydration||h(),m||x},Xn=cr,{useSyncExternalStoreWithSelector:ar}=Ds,dr=t=>t;function ur(t,e=dr,n){const s=ar(t.subscribe,t.getState,t.getInitialState,e,n);return F.useDebugValue(s),s}const dn=t=>Symbol.iterator in t,un=t=>"entries"in t,fn=(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},fr=(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 mr(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:dn(t)&&dn(e)?un(t)&&un(e)?fn(t,e):fr(t,e):fn({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function pr(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 ht(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 xr(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 gt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...uo,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const Qn=C.createContext(null),hr=t=>Zt()(Xn(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??gt(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:ht(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 p=r.steps.find(x=>x.name===f);p?.outputSchema&&(c[f]=p.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=gt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=pr(a,"Input"),p=d.action,x=xr(p.code,f);d={...d,action:{...p,code:x}}}const u=ht(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=gt("tool",Number((Math.random()*1e6).toFixed(0)));const i=ht(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:Zn(()=>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 gr(t){const e=N.c(8),{children:n,initialState:s}=t,i=En();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>hr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:i?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[0]=s.currentStepTab,e[1]=s.trackingExecutionId,e[2]=s.workflow,e[3]=i?.[0]?.id,e[4]=r):r=e[4];const[l]=C.useState(r);let c;return e[5]!==n||e[6]!==l?(c=o.jsx(Qn.Provider,{value:l,children:n}),e[5]=n,e[6]=l,e[7]=c):c=e[7],c}function We(t,e){const n=C.useContext(Qn);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return ur(n,t,mr)}function Re(){return We(br)}function br(t){return t.workflow}function Z(){return We(jr)}function jr(t){return t.actions}function Yn(){const t=Fe();return We(vr)??t[0]?.name}function vr(t){return t.currentStepName}function He(){const t=N.c(5),e=Yn(),n=Fe();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 Fe(){return Re().steps}function kt(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(!kt(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)||!kt(n[l],s[l]))return!1;return!0}return!1}function es(){const t=N.c(5),e=Re();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=_s(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=kt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function W(){return We(yr)}function yr(t){return t.trackingExecutionId}function Ae(){return We(wr)}function wr(t){return t.selectedVirtualMcpId}function Sr(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=En()??[],a=n??void 0;let d;e[0]!==s?(d=g=>s(g===""?void 0:g),e[0]=s,e[1]=d):d=e[1];let u;e[2]!==i?(u=O("text-xs",i),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==l?(f=o.jsx(Tn,{placeholder:l}),e[4]=l,e[5]=f):f=e[5];let p;e[6]!==u||e[7]!==f?(p=o.jsx(_n,{size:"sm",className:u,children:f}),e[6]=u,e[7]=f,e[8]=p):p=e[8];let x;e[9]!==c?(x=c.map(Nr),e[9]=c,e[10]=x):x=e[10];let m;e[11]!==x?(m=o.jsx($n,{children:x}),e[11]=x,e[12]=m):m=e[12];let h;return e[13]!==a||e[14]!==d||e[15]!==p||e[16]!==m?(h=o.jsxs(In,{value:a,onValueChange:d,children:[p,m]}),e[13]=a,e[14]=d,e[15]=p,e[16]=m,e[17]=h):h=e[17],h}function Nr(t){return o.jsx(wt,{value:t.id,children:t.title},t.id)}function Me(){const t=N.c(2),e=ao();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=fo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const mn=[100,1e3,2e3];function re(t){const e=N.c(15),{org:n}=Y(),s=Me(),i=C.useRef(0);let r;e[0]!==s.id||e[1]!==n.id?(r={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==t?(c={id:t},e[3]=t,e[4]=c):c=e[4];const a=!!t;let d;e[5]!==t?(d=t?h=>{const b=h.state?.data,y=(b?.structuredContent??b)?.item?.status;if(y==="running"||y==="enqueued"){const w=mn[i.current]??1;return i.current=(i.current+1)%mn.length,w}return i.current=0,!1}:!1,e[5]=t,e[6]=d):d=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==a||e[10]!==d?(u={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:c,gcTime:0,enabled:a,select:kr,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:p}=At(u),x=f?.item;let m;return e[12]!==p||e[13]!==x?(m={item:x,isLoading:p},e[12]=p,e[13]=x,e[14]=m):m=e[14],m}function kr(t){return t.structuredContent??t}function ts(t,e,n){const s=N.c(15),{org:i}=Y(),r=Me();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=ee(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];const u=n?.refetchInterval;let f;s[6]!==c||s[7]!==a||s[8]!==d||s[9]!==u?(f={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,refetchInterval:u,select:Cr},s[6]=c,s[7]=a,s[8]=d,s[9]=u,s[10]=f):f=s[10];const{data:p,isLoading:x}=At(f),m=p?.output,h=p?.error;let g;return s[11]!==x||s[12]!==m||s[13]!==h?(g={output:m,error:h,isLoading:x},s[11]=x,s[12]=m,s[13]=h,s[14]=g):g=s[14],g}function Cr(t){return t.structuredContent??t}function Ir(){const t=N.c(19),{org:e}=Y(),n=Me(),s=Re();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=ee(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:_r},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:p,isLoading:x,refetch:m}=At(f);let h;t[13]!==p?.items?(h=p?.items??[],t[13]=p?.items,t[14]=h):h=t[14];let g;return t[15]!==x||t[16]!==m||t[17]!==h?(g={executions:h,isLoading:x,refetch:m},t[15]=x,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function _r(t){return t.structuredContent??t}function ns(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 Tr(t){const e=[];for(const n of t){const s=ns(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function $r(t){for(const e of t)if(ns(e.input).includes("__entire_input__"))return!0;return!1}function Er(t){const e=Tr(t);if(e.length===0)return $r(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 Or(){const t=N.c(2),e=Re();let n;return t[0]!==e.steps?(n=Er(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function Rr(){const t=N.c(15),{org:e}=Y(),{id:n}=Me(),{setTrackingExecutionId:s}=Z(),i=Re(),r=Ae(),l=Or();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=ee(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=Mt(d);let p;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(p=async g=>{const b=g===void 0?{}:g;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:r,start_at_epoch_ms:j,workflow_collection_id:i.id}}),v=(y.structuredContent??y)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=p):p=t[9];const x=p,m=l!==null;let h;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==m?(h={handleRunWorkflow:x,isPending:f,requiresInput:m,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=m,t[14]=h):h=t[14],h}function Ar(){const t=N.c(10),{org:e}=Y(),{id:n}=Me();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=Mt(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 Mr(){const t=N.c(10),{org:e}=Y(),{id:n}=Me();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=Mt(r);let a;t[5]!==l?(a=async f=>{const p=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(p.structuredContent??p)?.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 Pr(){const t=N.c(3),e=W(),{item:n}=re(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 Lr(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 Xt=lr()(Xn(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=C.createContext([]);function os(){return C.useContext(ss)}function zr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new vo;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 rs(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>zr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function pn(t,e){const n=rs(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var Dr=ho.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",Ke(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=pn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ke({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...jo({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:pn(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 bo,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 rs(this).map(go)}}),Wr=Dr,bt,et="HoverCard",[is]=yn(et,[jn]),tt=jn(),[Hr,nt]=is(et),ls=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=tt(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),p=C.useRef(!1),[x,m]=Tt({prop:s,defaultProp:i??!1,onChange:r,caller:et}),h=C.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>m(!0),l)},[l,m]),g=C.useCallback(()=>{clearTimeout(d.current),!f.current&&!p.current&&(u.current=window.setTimeout(()=>m(!1),c))},[c,m]),b=C.useCallback(()=>m(!1),[m]);return C.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(Hr,{scope:e,open:x,onOpenChange:m,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:p,children:o.jsx(Fs,{...a,children:n})})};ls.displayName=et;var cs="HoverCardTrigger",as=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=nt(cs,n),r=tt(n);return o.jsx(Ws,{asChild:!0,...r,children:o.jsx(_t.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:ne(t.onPointerEnter,Xe(i.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(i.onClose)),onFocus:ne(t.onFocus,i.onOpen),onBlur:ne(t.onBlur,i.onClose),onTouchStart:ne(t.onTouchStart,l=>l.preventDefault())})})});as.displayName=cs;var Qt="HoverCardPortal",[Fr,Vr]=is(Qt,{forceMount:void 0}),ds=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=nt(Qt,e);return o.jsx(Fr,{scope:e,forceMount:n,children:o.jsx(bn,{present:n||r.open,children:o.jsx(Hs,{asChild:!0,container:i,children:s})})})};ds.displayName=Qt;var Ze="HoverCardContent",us=C.forwardRef((t,e)=>{const n=Vr(Ze,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=nt(Ze,t.__scopeHoverCard);return o.jsx(bn,{present:s||r.open,children:o.jsx(Br,{"data-state":r.open?"open":"closed",...i,onPointerEnter:ne(t.onPointerEnter,Xe(r.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(r.onClose)),ref:e})})});us.displayName=Ze;var Br=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=nt(Ze,n),d=tt(n),u=C.useRef(null),f=vn(e,u),[p,x]=C.useState(!1);return C.useEffect(()=>{if(p){const m=document.body;return bt=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=bt,m.style.webkitUserSelect=bt}}},[p]),C.useEffect(()=>{if(u.current){const m=()=>{x(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),C.useEffect(()=>{u.current&&Kr(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(Vs,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ne(r,m=>{m.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(Bs,{...d,...c,onPointerDown:ne(c.onPointerDown,m=>{m.currentTarget.contains(m.target)&&x(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"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)"}})})}),Ur="HoverCardArrow",qr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=tt(n);return o.jsx(Us,{...i,...s,ref:e})});qr.displayName=Ur;function Xe(t){return e=>e.pointerType==="touch"?void 0:t()}function Kr(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 Jr=ls,Gr=as,Zr=ds,Xr=us;function Qr(t){const e=N.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(Jr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function Yr(t){const e=N.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(Gr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function ei(t){const e=N.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=O("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(Zr,{"data-slot":"hover-card-portal",children:o.jsx(Xr,{"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 fs=C.createContext(void 0);function ti(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 ni(t){const e=N.c(20),{node:n}=t,s=C.useContext(fs),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?ti(s,i):void 0;l=h!==void 0?typeof h=="object"?JSON.stringify(h,null,2):String(h):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 h;return e[6]!==d?(h=o.jsx(ln,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx(Yr,{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 p;e[12]!==c?(p=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]=p):p=e[13];let x;e[14]!==f||e[15]!==p?(x=o.jsx(ei,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,p]})}),e[14]=f,e[15]=p,e[16]=x):x=e[16];let m;return e[17]!==u||e[18]!==x?(m=o.jsx(ln,{as:"span",children:o.jsxs(Qr,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,e[19]=m):m=e[19],m}function ms(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 se=ps();function ps(){return Zt(()=>({items:[],selectedIndex:0,command:null}))}function xn(t,e){se.setState({items:t,command:e,selectedIndex:0})}function si(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e-1+t.length)%t.length})}function oi(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e+1)%t.length})}function xs(){const{items:t,selectedIndex:e,command:n}=se.getState(),s=t[e];return s?(n?.(s),!0):!1}function hn(){se=ps()}function ri(){const t=N.c(7),e=St(se,li),n=St(se,ii);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:()=>{se.setState({selectedIndex:c}),xs()},className:O("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 ii(t){return t.selectedIndex}function li(t){return t.items}function ci(){let t=null,e=null;return{onStart:n=>{xn(n.items,n.command),t=new No(ri,{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=>{xn(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(),hn(),!0):n.key==="ArrowUp"?(si(),!0):n.key==="ArrowDown"?(oi(),!0):n.key==="Enter"?xs():!1,onExit:()=>{e?.remove(),t?.destroy(),hn()}}}const jt=/@([\w.]+)/g;function ai(t,e){if(!t)return null;const n=ms(e),s=new Map(n.map(a=>[a.id,a]));if(!jt.test(t))return t;jt.lastIndex=0;const r=[];let l=0,c;for(;(c=jt.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 Yt(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=Pr();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,p=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=yo.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let m;if(e[4]!==n||e[5]!==f){let T;e[7]!==n?(T=M=>{const{query:R}=M;return ms(n).filter(z=>z.label.toLowerCase().includes(R.toLowerCase())||z.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],m=Wr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:mi,renderHTML:fi,suggestion:{items:T,render:ci,command:ui}}).extend(f?{addNodeView(){return wo(ni)}}:{}),e[4]=n,e[5]=f,e[6]=m}else m=e[6];let h;e[9]!==m?(h=[x,m],e[9]=m,e[10]=h):h=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:di},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:M}=T;return i?.(M.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==p||e[17]!==h||e[18]!==b||e[19]!==j?(y={content:u,editable:p,extensions:h,editorProps:b,onUpdate:j},e[15]=u,e[16]=p,e[17]=h,e[18]=b,e[19]=j,e[20]=y):y=e[20];const w=So(y);let v;e[21]!==l?(v=O("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 S;e[23]!==w?(S=o.jsx(ko,{editor:w}),e[23]=w,e[24]=S):S=e[24];let k;e[25]!==v||e[26]!==S?(k=o.jsx("div",{className:v,children:S}),e[25]=v,e[26]=S,e[27]=k):k=e[27];const I=k;if(a!==void 0){let T;return e[28]!==I||e[29]!==a?(T=o.jsx(fs.Provider,{value:a,children:I}),e[28]=I,e[29]=a,e[30]=T):T=e[30],T}return I}function di(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function ui(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function fi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function mi(t){const{node:e}=t;return`@${e.attrs.id}`}function pi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 xi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 hi(t){const e=N.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=O("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 gi(t){const e=N.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=p=>s(p.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 bi(t){const e=N.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=h=>s(h.target.value),e[2]=s,e[3]=u):u=e[3];let f,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=O("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"),p=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=p):(f=e[4],p=e[5]);let x;e[6]!==a?(x=a.map(ji),e[6]=a,e[7]=x):x=e[7];let m;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(m=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[p,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=m):m=e[13],m}function ji(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const vi={TextWidget:pi,TextareaWidget:xi,NumberWidget:hi,CheckboxWidget:gi,SelectWidget:bi};function yi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:Mn,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function wi(t){const e=N.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,p,x,m,h,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:S}=yi(d);g="space-y-2",x="flex items-center gap-2",e[15]!==n||e[16]!==s?(m=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=m):m=e[17],e[18]!==i?(h=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=h):h=e[19],u=v,f=14,p=O(S,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=p,e[11]=x,e[12]=m,e[13]=h,e[14]=g}else u=e[8],f=e[9],p=e[10],x=e[11],m=e[12],h=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==p?(b=o.jsx(u,{size:f,className:p}),e[20]=u,e[21]=f,e[22]=p,e[23]=b):b=e[23];let j;e[24]!==x||e[25]!==m||e[26]!==h||e[27]!==b?(j=o.jsxs("div",{className:x,children:[m,h,b]}),e[24]=x,e[25]=m,e[26]=h,e[27]=b,e[28]=j):j=e[28];let y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let w;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(w=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=w):w=e[35],w}function Si(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(ki),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(Ni),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 Ni(t){return o.jsx("div",{children:t.content},t.name)}function ki(t){return o.jsx("div",{children:t.content},t.name)}function Ci(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Ii),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(V,{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 Ii(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 _i(){return null}function Ti(){return null}const $i={FieldTemplate:wi,ObjectFieldTemplate:Si,ArrayFieldTemplate:Ci,UnsupportedFieldTemplate:_i,ErrorListTemplate:Ti};function Ei(t){const e=N.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??""),p=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:p})]}),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(Yt,{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 hs({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(Ei,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=C.useRef(e??{}),d=u=>{const f=u.formData??{},p=a.current;if(n?.(f),s){for(const[x,m]of Object.entries(f))p[x]!==m&&s(x,m);for(const x of Object.keys(p))x in f||s(x,void 0)}a.current=f};return o.jsx(ss.Provider,{value:l,children:o.jsx(lo,{schema:c,formData:e,onChange:d,validator:co,widgets:vi,templates:$i,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function Oi(t){const e=N.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]=C.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 p;e[5]!==s?(p=I=>{I||d({}),s(I)},e[5]=s,e[6]=p):p=e[6];const x=p;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs($o,{children:[o.jsx(Eo,{children:"Workflow Input"}),o.jsx(Oo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[8]=h):h=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(hs,{inputSchema:i,inputParams:a,setInputParams:d,mentions:h})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==x?(b=()=>x(!1),e[12]=x,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(V,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(De,{size:"xs"}):o.jsx(Ht,{size:14}),e[17]=l,e[18]=y):y=e[18];let w;e[19]!==f||e[20]!==l||e[21]!==y?(w=o.jsxs(V,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=w):w=e[22];let v;e[23]!==w||e[24]!==j?(v=o.jsxs(Ro,{children:[j,w]}),e[23]=w,e[24]=j,e[25]=v):v=e[25];let S;e[26]!==v||e[27]!==g?(S=o.jsxs(Ao,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[m,g,v]}),e[26]=v,e[27]=g,e[28]=S):S=e[28];let k;return e[29]!==x||e[30]!==n||e[31]!==S?(k=o.jsx(Mo,{open:n,onOpenChange:x,children:S}),e[29]=x,e[30]=n,e[31]=S,e[32]=k):k=e[32],k}function Ri(t){const e=N.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=It().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=Xt(),{resetToOriginalWorkflow:p,setSelectedVirtualMcpId:x}=Z(),m=es(),h=Ae(),g=W();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 y;e[4]!==b||e[5]!==j?(y=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let w;e[7]!==m||e[8]!==r||e[9]!==i||e[10]!==p||e[11]!==h||e[12]!==x||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(w=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Pt,{title:n,url:c,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Sr,{selectedVirtualMcpId:h,onVirtualMcpChange:x,placeholder:"Select Agent"})}),o.jsx(xo,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(Kn,{})},{value:"code",icon:o.jsx(Bn,{})}]}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:p,disabled:!m,"aria-label":"Reset changes",children:o.jsx(kn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!m||r,"aria-label":"Save workflow",children:r?o.jsx(De,{size:"xs"}):o.jsx(Gt,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(Vn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=m,e[8]=r,e[9]=i,e[10]=p,e[11]=h,e[12]=x,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=w):w=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Pi,{}),e[21]=v):v=e[21];let S;e[22]!==w?(S=o.jsxs(Wt,{children:[w,v]}),e[22]=w,e[23]=S):S=e[23];let k;return e[24]!==y||e[25]!==S?(k=o.jsxs(o.Fragment,{children:[y,S]}),e[24]=y,e[25]=S,e[26]=k):k=e[26],k}function Ai(){const t=W(),{item:e}=re(t);return e?.completed_at_epoch_ms!=null}function Mi(){const t=W(),{item:e}=re(t);return e?.status==="cancelled"}function Pi(){const t=N.c(58),e=es(),n=Ai(),s=Mi(),i=W(),r=Ae(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=Rr(),u=Fe(),[f,p]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:m}=Ar(),{handleResumeWorkflow:h,isResuming:g}=Mr(),b=i&&!n;let j;t[0]!==u?(j=u.some(Li),t[0]=u,t[1]=j):j=t[1];const y=j,w=!r,v=u.length===0,S=e||v||y||w||c||m,k=b||c;let I;t[2]!==y||t[3]!==w||t[4]!==e||t[5]!==s||t[6]!==k||t[7]!==v?(I=()=>s?"Workflow is currently cancelled":k?"Workflow is currently running":e?"Save your changes before running":w?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=w,t[4]=e,t[5]=s,t[6]=k,t[7]=v,t[8]=I):I=t[8];const M=I();let R;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==k||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){p(!0);return}if(s&&i){await h(i);return}if(k&&i){await x(i);return}await l({})},t[9]=x,t[10]=h,t[11]=l,t[12]=d,t[13]=s,t[14]=k,t[15]=a,t[16]=i,t[17]=R):R=t[17];const P=R;let z;t[18]!==l?(z=async Pe=>{await l(Pe)},t[18]=l,t[19]=z):z=t[19];const q=z,A=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",J=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let _;t[20]!==J?(_=O("gap-2 h-7 px-3",J),t[20]=J,t[21]=_):_=t[21];let $;t[22]!==m||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?($=(!b&&!c&&!m&&!g||s)&&o.jsx(Ht,{size:14}),t[22]=m,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=$):$=t[27];let E;t[28]!==m||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(E=b&&!c&&!m&&!g&&!s&&o.jsx(Co,{size:14}),t[28]=m,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=E):E=t[33];let L;t[34]!==m||t[35]!==c||t[36]!==g?(L=(c||m||g)&&o.jsx(De,{size:"xs"}),t[34]=m,t[35]=c,t[36]=g,t[37]=L):L=t[37];let H;t[38]!==A||t[39]!==P||t[40]!==S||t[41]!==_||t[42]!==$||t[43]!==E||t[44]!==L?(H=o.jsxs(V,{variant:"default",size:"sm",className:_,disabled:S,onClick:P,children:[$,E,L,A]}),t[38]=A,t[39]=P,t[40]=S,t[41]=_,t[42]=$,t[43]=E,t[44]=L,t[45]=H):H=t[45];const X=H;let D;t[46]!==X||t[47]!==M?(D=M?o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:X})}),o.jsx(ce,{side:"bottom",children:M})]})}):X,t[46]=X,t[47]=M,t[48]=D):D=t[48];const G=D;let B;t[49]!==q||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(Oi,{open:f,onOpenChange:p,inputSchema:d,onSubmit:q,isPending:c}),t[49]=q,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let K;return t[55]!==G||t[56]!==B?(K=o.jsxs(o.Fragment,{children:[G,B]}),t[55]=G,t[56]=B,t[57]=K):K=t[57],K}function Li(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function zi(){const t=N.c(15),e=W(),n=Fe(),{item:s}=re(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.status||t[3]!==n){i={};let r;t[5]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(Di)??[]),t[5]=s.completed_steps?.success,t[6]=r):r=t[6];const l=r;let c;t[7]!==s.completed_steps?.error?(c=s.completed_steps?.error??[],t[7]=s.completed_steps?.error,t[8]=c):c=t[8];let a;t[9]!==c?(a=new Set(c),t[9]=c,t[10]=a):a=t[10];const d=a;let u;t[11]!==d||t[12]!==n||t[13]!==l?(u=-1,n.forEach((f,p)=>{(l.has(f.name)||d.has(f.name))&&(u=p)}),t[11]=d,t[12]=n,t[13]=l,t[14]=u):u=t[14],n.forEach((f,p)=>{let x="pending";d.has(f.name)?x="error":l.has(f.name)?x="success":s.status==="running"&&p===u+1&&(x="running"),i[f.name]={status:x,output:void 0,error:void 0,stepIndex:p}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.status,t[3]=n,t[4]=i}else i=t[4];return i}function Di(t){return t.name}function Wi(t){const e=N.c(94),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=W(),{item:p}=re(f),x=p?.completed_steps,m=x?.success;let h;e[0]!==n.name||e[1]!==m?(h=m?.find(U=>U.name===n.name),e[0]=n.name,e[1]=m,e[2]=h):h=e[2];const g=h,b=g?.completed_at_epoch_ms,j=g!=null,y=x?.error?.includes(n.name),w="toolName"in n.action,v=w&&"connectionId"in n.action?n.action.connectionId:null,k=!!(w&&"toolName"in n.action?n.action.toolName:null),I=Xi(n),T=j?"success":y?"error":r?.status,M=r!==void 0,R=T==="success"||T==="error";let P=I.length>0?60:12;(T==="success"||T==="error")&&(P=P+32);const z=Vi(T);let q;e[3]!==T?(q=Bi(T),e[3]=T,e[4]=q):q=e[4];const A=q;let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=function(qe,Rs){const on=Rs.split(".").slice(1);if(on.length===0)return Array.isArray(qe)?qe:void 0;let ie=qe;for(const As of on){if(ie==null)return;if(typeof ie=="object")ie=ie[As];else return}return Array.isArray(ie)?ie:void 0},e[5]=J):J=e[5];const _=J,$=n.forEach!==void 0,E=n.forEach?.ref;let L;e[6]!==E?(L=E?.replace("@","").split(".")[0],e[6]=E,e[7]=L):L=e[7];const H=L,X=p?.status==="running"||p?.status==="enqueued";let D;e[8]!==m||e[9]!==H?(D=m?.some(U=>U.name===H),e[8]=m,e[9]=H,e[10]=D):D=e[10];const G=D,B=X?500:!1;let K;e[11]!==G||e[12]!==B?(K={refetchInterval:B,enabled:G},e[11]=G,e[12]=B,e[13]=K):K=e[13];const{output:Pe}=ts(f,H,K);let Ve;if(e[14]!==Pe||e[15]!==E){const U=E?.replace("@","");Ve=U?_(Pe,U):void 0,e[14]=Pe,e[15]=E,e[16]=Ve}else Ve=e[16];const Le=Ve;let Be;e[17]!==p?.completed_steps?.success||e[18]!==n.name?(Be=p?.completed_steps?.success?.filter(U=>new RegExp(`^${n.name}\\[\\d+\\]$`).test(U.name)),e[17]=p?.completed_steps?.success,e[18]=n.name,e[19]=Be):Be=e[19];const rt=Be,it=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lt=T==="running"&&"bg-accent/50",ct=l&&"opacity-50";let ue;e[20]!==it||e[21]!==lt||e[22]!==ct?(ue=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",it,lt,ct),e[20]=it,e[21]=lt,e[22]=ct,e[23]=ue):ue=e[23];const Ts="button",$s=0;let fe;e[24]!==a?(fe=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),a())},e[24]=a,e[25]=fe):fe=e[25];const Es="w-5 flex flex-col items-center justify-center shrink-0 pt-3",at=O("text-xs font-mono opacity-75 h-8 flex items-center",z),dt=s+1;let me;e[26]!==at||e[27]!==dt?(me=o.jsx("div",{className:Es,children:o.jsxs("span",{className:at,children:[dt,"."]})}),e[26]=at,e[27]=dt,e[28]=me):me=e[28];let pe;e[29]!==A||e[30]!==s?(pe=s>0?o.jsx(vt,{height:12,color:A}):o.jsx("div",{className:"h-3"}),e[29]=A,e[30]=s,e[31]=pe):pe=e[31];let xe;e[32]!==v||e[33]!==k||e[34]!==w||e[35]!==n.name?(xe=o.jsx(Gi,{connectionId:v,isToolStep:w,hasToolSelected:k,stepName:n.name}),e[32]=v,e[33]=k,e[34]=w,e[35]=n.name,e[36]=xe):xe=e[36];let he;e[37]!==A||e[38]!==R||e[39]!==T?(he=R&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{height:8,color:A}),o.jsx(Ui,{status:T})]}),e[37]=A,e[38]=R,e[39]=T,e[40]=he):he=e[40];let ge;e[41]!==A||e[42]!==P||e[43]!==c||e[44]!==f?(ge=c&&f?null:o.jsx(vt,{height:P,color:A}),e[41]=A,e[42]=P,e[43]=c,e[44]=f,e[45]=ge):ge=e[45];let be;e[46]!==pe||e[47]!==xe||e[48]!==he||e[49]!==ge?(be=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[pe,xe,he,ge]}),e[46]=pe,e[47]=xe,e[48]=he,e[49]=ge,e[50]=be):be=e[50];const Os="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",ut=k?"font-medium text-foreground":"text-foreground";let je;e[51]!==ut?(je=O("text-sm truncate flex-1",ut),e[51]=ut,e[52]=je):je=e[52];let ve;e[53]!==n?(ve=Zi(n),e[53]=n,e[54]=ve):ve=e[54];let ye;e[55]!==je||e[56]!==ve?(ye=o.jsx("span",{className:je,children:ve}),e[55]=je,e[56]=ve,e[57]=ye):ye=e[57];let we;e[58]!==rt?.length||e[59]!==$||e[60]!==Le?(we=$&&Le&&Le.length>0&&o.jsx("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center",children:`${rt?.length??0} / ${Le.length}`}),e[58]=rt?.length,e[59]=$,e[60]=Le,e[61]=we):we=e[61];let Se;e[62]!==M||e[63]!==T?(Se=M&&o.jsx(qi,{status:T}),e[62]=M,e[63]=T,e[64]=Se):Se=e[64];let Ne;e[65]!==we||e[66]!==Se?(Ne=o.jsxs("div",{className:"flex items-center gap-2",children:[we,Se]}),e[65]=we,e[66]=Se,e[67]=Ne):Ne=e[67];let ke;e[68]!==M||e[69]!==d||e[70]!==u?(ke=!M&&o.jsxs(Lo,{children:[o.jsx(zo,{asChild:!0,children:o.jsx(V,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:Fi,children:o.jsx(Po,{size:14})})}),o.jsxs(Do,{align:"end",children:[o.jsxs(cn,{onClick:U=>{U.stopPropagation(),u()},children:[o.jsx(Vo,{size:14}),"Duplicate"]}),o.jsxs(cn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:U=>{U.stopPropagation(),d()},children:[o.jsx(qs,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[68]=M,e[69]=d,e[70]=u,e[71]=ke):ke=e[71];let Ce;e[72]!==ye||e[73]!==Ne||e[74]!==ke?(Ce=o.jsxs("div",{className:"flex items-center h-8",children:[ye,Ne,ke]}),e[72]=ye,e[73]=Ne,e[74]=ke,e[75]=Ce):Ce=e[75];const ft=I.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(Hi)});let Ie;e[76]!==T||e[77]!==b?(Ie=T==="success"&&o.jsx(Ki,{completedAtEpochMs:b}),e[76]=T,e[77]=b,e[78]=Ie):Ie=e[78];let _e;e[79]!==r?.error||e[80]!==T?(_e=T==="error"&&o.jsx(Ji,{error:r?.error}),e[79]=r?.error,e[80]=T,e[81]=_e):_e=e[81];let Te;e[82]!==Ce||e[83]!==ft||e[84]!==Ie||e[85]!==_e?(Te=o.jsxs("div",{className:Os,children:[Ce,ft,Ie,_e]}),e[82]=Ce,e[83]=ft,e[84]=Ie,e[85]=_e,e[86]=Te):Te=e[86];let Ue;return e[87]!==a||e[88]!==ue||e[89]!==fe||e[90]!==me||e[91]!==be||e[92]!==Te?(Ue=o.jsxs("div",{className:ue,onClick:a,role:Ts,tabIndex:$s,onKeyDown:fe,children:[me,be,Te]}),e[87]=a,e[88]=ue,e[89]=fe,e[90]=me,e[91]=be,e[92]=Te,e[93]=Ue):Ue=e[93],Ue}function Hi(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 Fi(t){return t.stopPropagation()}function Vi(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function Bi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function Ui(t){const e=N.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(Ut,{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(Ft,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function qi(t){const e=N.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(Ut,{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(Ft,{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(ze,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Ki(t){const e=N.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null?new Date(n):null;s=a?a.toISOString().split("T")[0]:null,i=a?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(so,{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 Ji(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Jt,{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 Gi(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=Vt(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(Ye,{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(Gn,{size:16,className:"text-muted-foreground"}):o.jsx(Fo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function vt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=O("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 Zi(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 Xi(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 Qi(t){const e=N.c(32),{className:n}=t,s=Fe(),i=Yn(),r=zi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=Z(),d=W();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{children:"Loading..."}),e[3]=p):p=e[3];let x;e[4]!==n?(x=O("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=x):x=e[5];let m;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(w,v)=>{const S=r?.[w.name],k=f!==-1&&v>f&&S?.status==="pending",I=v===s.length-1;return o.jsx(Wi,{step:w,index:v,isSelected:w.name===i,executionStatus:S,isSkipped:k,isLastStep:I,onSelect:()=>l(w.name),onDelete:()=>c(w.name),onDuplicate:()=>a(w.name)},w.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]=y):y=e[21],m=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=m}else m=e[13];let h;e[22]!==m?(h=o.jsx("div",{className:"pt-3 -space-y-1",children:m}),e[22]=m,e[23]=h):h=e[23];let g;e[24]!==d?(g=d?null:o.jsx(Yi,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==h||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[h,g]}),e[26]=h,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(C.Suspense,{fallback:p,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function Yi(){const t=N.c(8),{addToolStep:e}=Z();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(Rn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(V,{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 el(){const t=N.c(11),{org:e}=Y(),s=Ae()??null;let i;t[0]!==e.id||t[1]!==s?(i={connectionId:s,orgId:e.id},t[0]=e.id,t[1]=s,t[2]=i):i=t[2];const r=ee(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=Rt(l);let a;t[5]!==c.data?.tools?(a=c.data?.tools??[],t[5]=c.data?.tools,t[6]=a):a=t[6];let d;return t[7]!==a||t[8]!==c.error||t[9]!==c.isLoading?(d={tools:a,isLoading:c.isLoading,error:c.error},t[7]=a,t[8]=c.error,t[9]=c.isLoading,t[10]=d):d=t[10],d}function tl(t){const e=N.c(7),{className:n}=t;if(!Ae()){let r;e[0]!==n?(r=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select an agent to see available tools"}),e[2]=l):l=e[2];let c;return e[3]!==r?(c=o.jsx("div",{className:r,children:l}),e[3]=r,e[4]=c):c=e[4],c}let i;return e[5]!==n?(i=o.jsx(nl,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function nl(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=el(),l=He(),{updateStep:c}=Z(),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=S=>S.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 p=Lr(s,u??null,ol,sl);let x;e[5]!==l||e[6]!==c?(x=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=x):x=e[7];const m=x;if(i){let v;e[8]!==n?(v=O("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(De,{size:"sm"})}),e[10]=S):S=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:S}),e[11]=v,e[12]=k):k=e[12],k}if(r){let v;e[13]!==n?(v=O("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let S;e[15]!==r.message?(S=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]=S):S=e[16];let k;return e[17]!==v||e[18]!==S?(k=o.jsx("div",{className:v,children:S}),e[17]=v,e[18]=S,e[19]=k):k=e[19],k}let h;e[20]!==n?(h=O("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=h):h=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]!==m||e[26]!==p||e[27]!==d){let v;e[29]!==m||e[30]!==d?(v=S=>o.jsx(rl,{icon:null,title:S.name,description:S.description,isSelected:S.name===d,onClick:()=>m(S)},S.name),e[29]=m,e[30]=d,e[31]=v):v=e[31],j=p.map(v),e[25]=m,e[26]=p,e[27]=d,e[28]=j}else j=e[28];let y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let w;return e[34]!==h||e[35]!==b||e[36]!==y?(w=o.jsxs("div",{className:h,children:[b,y]}),e[34]=h,e[35]=b,e[36]=y,e[37]=w):w=e[37],w}function sl(t,e){return t.name.localeCompare(e.name)}function ol(t){return t.name}function rl(t){const e=N.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=O("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=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(Ye,{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 p;e[9]!==i?(p=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=p):p=e[10];let x;e[11]!==f||e[12]!==p?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,p]}),e[11]=f,e[12]=p,e[13]=x):x=e[13];let m;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(m=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,x]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=x,e[19]=m):m=e[19],m}var te="Accordion",il=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[en,ll,cl]=Js(te),[st]=yn(te,[cl,On]),tn=On(),gs=F.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(en.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(fl,{...r,ref:e}):o.jsx(ul,{...i,ref:e})})});gs.displayName=te;var[bs,al]=st(te),[js,dl]=st(te,{collapsible:!1}),ul=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Tt({prop:n,defaultProp:s??"",onChange:i,caller:te});return o.jsx(bs,{scope:t.__scopeAccordion,value:F.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:F.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(vs,{...l,ref:e})})})}),fl=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Tt({prop:n,defaultProp:s??[],onChange:i,caller:te}),a=F.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=F.useCallback(u=>c((f=[])=>f.filter(p=>p!==u)),[c]);return o.jsx(bs,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(vs,{...r,ref:e})})})}),[ml,ot]=st(te),vs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=F.useRef(null),a=vn(c,e),d=ll(n),f=Gs(i)==="ltr",p=ne(t.onKeyDown,x=>{if(!il.includes(x.key))return;const m=x.target,h=d().filter(I=>!I.ref.current?.disabled),g=h.findIndex(I=>I.ref.current===m),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const y=0,w=b-1,v=()=>{j=g+1,j>w&&(j=y)},S=()=>{j=g-1,j<y&&(j=w)};switch(x.key){case"Home":j=y;break;case"End":j=w;break;case"ArrowRight":r==="horizontal"&&(f?v():S());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?S():v());break;case"ArrowUp":r==="vertical"&&S();break}const k=j%b;h[k].ref.current?.focus()});return o.jsx(ml,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(en.Slot,{scope:n,children:o.jsx(_t.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:p})})})}),Qe="AccordionItem",[pl,nn]=st(Qe),ys=F.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ot(Qe,n),l=al(Qe,n),c=tn(n),a=Ks(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(pl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(_o,{"data-orientation":r.orientation,"data-state":Is(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});ys.displayName=Qe;var ws="AccordionHeader",Ss=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ws,n);return o.jsx(_t.h3,{"data-orientation":i.orientation,"data-state":Is(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Ss.displayName=ws;var Ct="AccordionTrigger",Ns=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(Ct,n),l=dl(Ct,n),c=tn(n);return o.jsx(en.ItemSlot,{scope:n,children:o.jsx(Io,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Ns.displayName=Ct;var ks="AccordionContent",Cs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ks,n),l=tn(n);return o.jsx(To,{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}})});Cs.displayName=ks;function Is(t){return t?"open":"closed"}var xl=gs,hl=ys,gl=Ss,bl=Ns,jl=Cs;function vl(t){const e=N.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(xl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function yl(t){const e=N.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=O("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(hl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function wl(t){const e=N.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=O("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(Wo,{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(gl,{className:"flex",children:o.jsxs(bl,{"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 Sl(t){const e=N.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=O("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(jl,{"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 Nl(t){const{updateStep:e}=Z(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=sn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function kl(t){const e=N.c(32),{className:n}=t,s=He(),{appendStep:i}=Z();Nl(s);const r=W(),{item:l}=re(r);if(!s){let b;e[0]!==n?(b=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==i?(j=()=>{i({type:"tool"})},e[2]=i,e[3]=j):j=e[3];let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Rn,{size:14}),e[4]=y):y=e[4];let w;e[5]!==j?(w=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(V,{variant:"ghost",size:"icon",className:"size-7",onClick:j,children:y})]}),e[5]=j,e[6]=w):w=e[6];let v;return e[7]!==b||e[8]!==w?(v=o.jsx("div",{className:b,children:w}),e[7]=b,e[8]=w,e[9]=v):v=e[9],v}const c=s?.name,a=!!(l?.completed_steps?.success?.some(b=>b.name===c)||l?.completed_steps?.error?.includes(c));let d;e[10]!==n?(d=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=d):d=e[11];let u,f;e[12]!==s?(u=o.jsx(Cl,{step:s}),f=o.jsx(_l,{step:s}),e[12]=s,e[13]=u,e[14]=f):(u=e[13],f=e[14]);const p=a?"open":"closed";let x;e[15]!==s||e[16]!==a||e[17]!==p?(x=o.jsx($l,{step:s,defaultOpen:a},p),e[15]=s,e[16]=a,e[17]=p,e[18]=x):x=e[18];let m;e[19]!==s||e[20]!==r?(m=!r&&o.jsx(Al,{step:s}),e[19]=s,e[20]=r,e[21]=m):m=e[21];let h;e[22]!==s||e[23]!==r?(h=!r&&o.jsx(Ll,{step:s}),e[22]=s,e[23]=r,e[24]=h):h=e[24];let g;return e[25]!==d||e[26]!==u||e[27]!==f||e[28]!==x||e[29]!==m||e[30]!==h?(g=o.jsxs("div",{className:d,children:[u,f,x,m,h]}),e[25]=d,e[26]=u,e[27]=f,e[28]=x,e[29]=m,e[30]=h,e[31]=g):g=e[31],g}function Cl(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=W(),l=i??"";let c;e[0]!==l?(c=o.jsx(Ye,{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(Il,{}),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 p;return e[12]!==u||e[13]!==f?(p=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]=p):p=e[14],p}function Il(){const t=N.c(9),e=He(),{updateStep:n,startReplacingTool:s}=Z(),i=W(),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){gn.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(Jn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(V,{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 sn(t){const e=N.c(13),{org:n}=Y(),i=Ae()??null;let r;e[0]!==n.id||e[1]!==i?(r={connectionId:i,orgId:n.id},e[0]=n.id,e[1]=i,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=Rt(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(p=>p.name===t),e[5]=t,e[6]=a.data?.tools,e[7]=d):d=e[7];const u=d;let f;return e[8]!==u||e[9]!==a.error||e[10]!==a.isLoading||e[11]!==a.isSuccess?(f={tool:u,isLoading:a.isLoading,isReady:a.isSuccess,error:a.error},e[8]=u,e[9]=a.error,e[10]=a.isLoading,e[11]=a.isSuccess,e[12]=f):f=e[12],f}function _l(t){const e=N.c(18),{step:n}=t,{updateStep:s}=Z(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=W(),{tool:c}=sn(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?Tl(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,p=l?"output":"input";let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(wl,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=x):x=e[7];const m=n.name+l,h=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let y;e[9]!==d||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==b?(y=o.jsxs(yl,{value:"input",className:"border-b-0",children:[x,o.jsx(Sl,{className:"px-5 pt-2",children:o.jsx(hs,{readOnly:h,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},m)})]}),e[9]=d,e[10]=m,e[11]=h,e[12]=g,e[13]=b,e[14]=y):y=e[14];let w;return e[15]!==y||e[16]!==p?(w=o.jsx(vl,{type:"single",collapsible:!0,defaultValue:p,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=p,e[17]=w):w=e[17],w}function Tl(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function $l(t){const e=N.c(24),{step:n,defaultOpen:s}=t,i=n.outputSchema,r=W(),{item:l}=re(r),c=!!(l?.completed_steps?.success?.some(T=>T.name===n.name)||l?.completed_steps?.error?.includes(n.name)),[a,d]=C.useState(s),{output:u,error:f}=ts(r,c?n.name:void 0);let p;e[0]!==f||e[1]!==u?(p=u||(f?{error:f}:void 0),e[0]=f,e[1]=u,e[2]=p):p=e[2];const x=p,m=i&&typeof i=="object"?i.properties:void 0;let h;e[3]!==m?(h=m?Object.entries(m):[],e[3]=m,e[4]=h):h=e[4];const g=h,b=a?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[5]!==b?(j=O("flex flex-col border-b border-border",b),e[5]=b,e[6]=j):j=e[6];let y;e[7]!==a?(y=()=>d(!a),e[7]=a,e[8]=y):y=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=w):w=e[9];let v;e[10]!==a?(v=o.jsxs("div",{className:"flex items-center justify-between",children:[w,a?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[10]=a,e[11]=v):v=e[11];let S;e[12]!==y||e[13]!==v?(S=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:v}),e[12]=y,e[13]=v,e[14]=S):S=e[14];let k;e[15]!==x||e[16]!==a||e[17]!==g||e[18]!==r?(k=a&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[r&&x?o.jsx(Oe,{code:JSON.stringify(x,null,2),language:"json",height:"100%",readOnly:!0}):null,!r&&g.map(El)]}),e[15]=x,e[16]=a,e[17]=g,e[18]=r,e[19]=k):k=e[19];let I;return e[20]!==j||e[21]!==S||e[22]!==k?(I=o.jsxs("div",{className:j,children:[S,k]}),e[20]=j,e[21]=S,e[22]=k,e[23]=I):I=e[23],I}function El(t){const[e,n]=t;return o.jsx(Rl,{name:e,schema:n},e)}function Ol(t){switch(t){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:Mn,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Rl(t){const e=N.c(28),{name:n,schema:s}=t,i=He(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:w,color:v}=Ol(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=w,c=14,a=O(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 p;e[10]!==n?(p=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=p):p=e[11];let x;e[12]!==d||e[13]!==f||e[14]!==p?(x=o.jsxs("div",{className:d,children:[f,p]}),e[12]=d,e[13]=f,e[14]=p,e[15]=x):x=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Un,{size:14,className:"opacity-50"}),e[16]=m):m=e[16];const h=i?.name;let g;e[17]!==h?(g=o.jsxs("span",{className:"text-muted-foreground",children:[h,"."]}),e[17]=h,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:[m,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let y;return e[24]!==j||e[25]!==u||e[26]!==x?(y=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=y):y=e[27],y}function Al(t){const e=N.c(29),{step:n}=t,{updateStep:s}=Z(),i=W(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=sn(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 gt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...uo,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const Qn=C.createContext(null),hr=t=>Zt()(Xn(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??gt(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:ht(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 p=r.steps.find(x=>x.name===f);p?.outputSchema&&(c[f]=p.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=gt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=pr(a,"Input"),p=d.action,x=xr(p.code,f);d={...d,action:{...p,code:x}}}const u=ht(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=gt("tool",Number((Math.random()*1e6).toFixed(0)));const i=ht(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:Zn(()=>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 gr(t){const e=N.c(8),{children:n,initialState:s}=t,i=En();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>hr({workflow:s.workflow,originalWorkflow:s.workflow,selectedVirtualMcpId:i?.[0]?.id,isAddingStep:!1,selectedParentSteps:[],trackingExecutionId:s.trackingExecutionId,currentStepName:s.workflow.steps[0]?.name,currentStepTab:s.currentStepTab??"input"}),e[0]=s.currentStepTab,e[1]=s.trackingExecutionId,e[2]=s.workflow,e[3]=i?.[0]?.id,e[4]=r):r=e[4];const[l]=C.useState(r);let c;return e[5]!==n||e[6]!==l?(c=o.jsx(Qn.Provider,{value:l,children:n}),e[5]=n,e[6]=l,e[7]=c):c=e[7],c}function We(t,e){const n=C.useContext(Qn);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return ur(n,t,mr)}function Re(){return We(br)}function br(t){return t.workflow}function Z(){return We(jr)}function jr(t){return t.actions}function Yn(){const t=Fe();return We(vr)??t[0]?.name}function vr(t){return t.currentStepName}function He(){const t=N.c(5),e=Yn(),n=Fe();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 Fe(){return Re().steps}function kt(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(!kt(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)||!kt(n[l],s[l]))return!1;return!0}return!1}function es(){const t=N.c(5),e=Re();let n;t[0]!==e.id?(n={itemId:e.id},t[0]=e.id,t[1]=n):n=t[1];const{item:s}=_s(n);if(!s)return!1;let i;return t[2]!==s||t[3]!==e?(i=kt(e,s),t[2]=s,t[3]=e,t[4]=i):i=t[4],!i}function W(){return We(yr)}function yr(t){return t.trackingExecutionId}function Me(){return We(wr)}function wr(t){return t.selectedVirtualMcpId}function Sr(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=En()??[],a=n??void 0;let d;e[0]!==s?(d=g=>s(g===""?void 0:g),e[0]=s,e[1]=d):d=e[1];let u;e[2]!==i?(u=O("text-xs",i),e[2]=i,e[3]=u):u=e[3];let f;e[4]!==l?(f=o.jsx(Tn,{placeholder:l}),e[4]=l,e[5]=f):f=e[5];let p;e[6]!==u||e[7]!==f?(p=o.jsx(_n,{size:"sm",className:u,children:f}),e[6]=u,e[7]=f,e[8]=p):p=e[8];let x;e[9]!==c?(x=c.map(Nr),e[9]=c,e[10]=x):x=e[10];let m;e[11]!==x?(m=o.jsx($n,{children:x}),e[11]=x,e[12]=m):m=e[12];let h;return e[13]!==a||e[14]!==d||e[15]!==p||e[16]!==m?(h=o.jsxs(In,{value:a,onValueChange:d,children:[p,m]}),e[13]=a,e[14]=d,e[15]=p,e[16]=m,e[17]=h):h=e[17],h}function Nr(t){return o.jsx(wt,{value:t.id,children:t.title},t.id)}function Ae(){const t=N.c(2),e=ao();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=fo(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const mn=[100,1e3,2e3];function re(t){const e=N.c(15),{org:n}=Y(),s=Ae(),i=C.useRef(0);let r;e[0]!==s.id||e[1]!==n.id?(r={connectionId:s.id,orgId:n.id},e[0]=s.id,e[1]=n.id,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==t?(c={id:t},e[3]=t,e[4]=c):c=e[4];const a=!!t;let d;e[5]!==t?(d=t?h=>{const b=h.state?.data,y=(b?.structuredContent??b)?.item?.status;if(y==="running"||y==="enqueued"){const w=mn[i.current]??1;return i.current=(i.current+1)%mn.length,w}return i.current=0,!1}:!1,e[5]=t,e[6]=d):d=e[6];let u;e[7]!==l||e[8]!==c||e[9]!==a||e[10]!==d?(u={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET",toolArguments:c,gcTime:0,enabled:a,select:kr,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:p}=Mt(u),x=f?.item;let m;return e[12]!==p||e[13]!==x?(m={item:x,isLoading:p},e[12]=p,e[13]=x,e[14]=m):m=e[14],m}function kr(t){return t.structuredContent??t}function ts(t,e,n){const s=N.c(15),{org:i}=Y(),r=Ae();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=ee(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];const u=n?.refetchInterval;let f;s[6]!==c||s[7]!==a||s[8]!==d||s[9]!==u?(f={client:c,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:d,enabled:a,refetchInterval:u,select:Cr},s[6]=c,s[7]=a,s[8]=d,s[9]=u,s[10]=f):f=s[10];const{data:p,isLoading:x}=Mt(f),m=p?.output,h=p?.error;let g;return s[11]!==x||s[12]!==m||s[13]!==h?(g={output:m,error:h,isLoading:x},s[11]=x,s[12]=m,s[13]=h,s[14]=g):g=s[14],g}function Cr(t){return t.structuredContent??t}function Ir(){const t=N.c(19),{org:e}=Y(),n=Ae(),s=Re();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=ee(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:_r},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:p,isLoading:x,refetch:m}=Mt(f);let h;t[13]!==p?.items?(h=p?.items??[],t[13]=p?.items,t[14]=h):h=t[14];let g;return t[15]!==x||t[16]!==m||t[17]!==h?(g={executions:h,isLoading:x,refetch:m},t[15]=x,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function _r(t){return t.structuredContent??t}function ns(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 Tr(t){const e=[];for(const n of t){const s=ns(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function $r(t){for(const e of t)if(ns(e.input).includes("__entire_input__"))return!0;return!1}function Er(t){const e=Tr(t);if(e.length===0)return $r(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 Or(){const t=N.c(2),e=Re();let n;return t[0]!==e.steps?(n=Er(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function Rr(){const t=N.c(15),{org:e}=Y(),{id:n}=Ae(),{setTrackingExecutionId:s}=Z(),i=Re(),r=Me(),l=Or();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=ee(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=At(d);let p;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(p=async g=>{const b=g===void 0?{}:g;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),y=await u({name:"COLLECTION_WORKFLOW_EXECUTION_CREATE",arguments:{input:b,virtual_mcp_id:r,start_at_epoch_ms:j,workflow_collection_id:i.id}}),v=(y.structuredContent??y)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=p):p=t[9];const x=p,m=l!==null;let h;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==m?(h={handleRunWorkflow:x,isPending:f,requiresInput:m,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=m,t[14]=h):h=t[14],h}function Mr(){const t=N.c(10),{org:e}=Y(),{id:n}=Ae();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=At(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 Ar(){const t=N.c(10),{org:e}=Y(),{id:n}=Ae();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=ee(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=At(r);let a;t[5]!==l?(a=async f=>{const p=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(p.structuredContent??p)?.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 Pr(){const t=N.c(3),e=W(),{item:n}=re(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 Lr(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 Xt=lr()(Xn(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=C.createContext([]);function os(){return C.useContext(ss)}function zr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new vo;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 rs(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>zr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function pn(t,e){const n=rs(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var Dr=ho.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",Ke(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=pn(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Ke({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Ke({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...jo({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:pn(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 bo,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 rs(this).map(go)}}),Wr=Dr,bt,et="HoverCard",[is]=yn(et,[jn]),tt=jn(),[Hr,nt]=is(et),ls=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=tt(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),p=C.useRef(!1),[x,m]=Tt({prop:s,defaultProp:i??!1,onChange:r,caller:et}),h=C.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>m(!0),l)},[l,m]),g=C.useCallback(()=>{clearTimeout(d.current),!f.current&&!p.current&&(u.current=window.setTimeout(()=>m(!1),c))},[c,m]),b=C.useCallback(()=>m(!1),[m]);return C.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(Hr,{scope:e,open:x,onOpenChange:m,onOpen:h,onClose:g,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:p,children:o.jsx(Fs,{...a,children:n})})};ls.displayName=et;var cs="HoverCardTrigger",as=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=nt(cs,n),r=tt(n);return o.jsx(Ws,{asChild:!0,...r,children:o.jsx(_t.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:ne(t.onPointerEnter,Xe(i.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(i.onClose)),onFocus:ne(t.onFocus,i.onOpen),onBlur:ne(t.onBlur,i.onClose),onTouchStart:ne(t.onTouchStart,l=>l.preventDefault())})})});as.displayName=cs;var Qt="HoverCardPortal",[Fr,Vr]=is(Qt,{forceMount:void 0}),ds=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=nt(Qt,e);return o.jsx(Fr,{scope:e,forceMount:n,children:o.jsx(bn,{present:n||r.open,children:o.jsx(Hs,{asChild:!0,container:i,children:s})})})};ds.displayName=Qt;var Ze="HoverCardContent",us=C.forwardRef((t,e)=>{const n=Vr(Ze,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=nt(Ze,t.__scopeHoverCard);return o.jsx(bn,{present:s||r.open,children:o.jsx(Br,{"data-state":r.open?"open":"closed",...i,onPointerEnter:ne(t.onPointerEnter,Xe(r.onOpen)),onPointerLeave:ne(t.onPointerLeave,Xe(r.onClose)),ref:e})})});us.displayName=Ze;var Br=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=nt(Ze,n),d=tt(n),u=C.useRef(null),f=vn(e,u),[p,x]=C.useState(!1);return C.useEffect(()=>{if(p){const m=document.body;return bt=m.style.userSelect||m.style.webkitUserSelect,m.style.userSelect="none",m.style.webkitUserSelect="none",()=>{m.style.userSelect=bt,m.style.webkitUserSelect=bt}}},[p]),C.useEffect(()=>{if(u.current){const m=()=>{x(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",m),()=>{document.removeEventListener("pointerup",m),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),C.useEffect(()=>{u.current&&Kr(u.current).forEach(h=>h.setAttribute("tabindex","-1"))}),o.jsx(Vs,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ne(r,m=>{m.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(Bs,{...d,...c,onPointerDown:ne(c.onPointerDown,m=>{m.currentTarget.contains(m.target)&&x(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:p?"text":void 0,WebkitUserSelect:p?"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)"}})})}),Ur="HoverCardArrow",qr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=tt(n);return o.jsx(Us,{...i,...s,ref:e})});qr.displayName=Ur;function Xe(t){return e=>e.pointerType==="touch"?void 0:t()}function Kr(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 Jr=ls,Gr=as,Zr=ds,Xr=us;function Qr(t){const e=N.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(Jr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function Yr(t){const e=N.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(Gr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function ei(t){const e=N.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=O("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(Zr,{"data-slot":"hover-card-portal",children:o.jsx(Xr,{"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 fs=C.createContext(void 0);function ti(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 ni(t){const e=N.c(20),{node:n}=t,s=C.useContext(fs),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const h=r?ti(s,i):void 0;l=h!==void 0?typeof h=="object"?JSON.stringify(h,null,2):String(h):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 h;return e[6]!==d?(h=o.jsx(ln,{as:"span",children:d}),e[6]=d,e[7]=h):h=e[7],h}let u;e[8]!==d?(u=o.jsx(Yr,{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 p;e[12]!==c?(p=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]=p):p=e[13];let x;e[14]!==f||e[15]!==p?(x=o.jsx(ei,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,p]})}),e[14]=f,e[15]=p,e[16]=x):x=e[16];let m;return e[17]!==u||e[18]!==x?(m=o.jsx(ln,{as:"span",children:o.jsxs(Qr,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,e[19]=m):m=e[19],m}function ms(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 se=ps();function ps(){return Zt(()=>({items:[],selectedIndex:0,command:null}))}function xn(t,e){se.setState({items:t,command:e,selectedIndex:0})}function si(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e-1+t.length)%t.length})}function oi(){const{items:t,selectedIndex:e}=se.getState();t.length&&se.setState({selectedIndex:(e+1)%t.length})}function xs(){const{items:t,selectedIndex:e,command:n}=se.getState(),s=t[e];return s?(n?.(s),!0):!1}function hn(){se=ps()}function ri(){const t=N.c(7),e=St(se,li),n=St(se,ii);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:()=>{se.setState({selectedIndex:c}),xs()},className:O("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 ii(t){return t.selectedIndex}function li(t){return t.items}function ci(){let t=null,e=null;return{onStart:n=>{xn(n.items,n.command),t=new No(ri,{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=>{xn(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(),hn(),!0):n.key==="ArrowUp"?(si(),!0):n.key==="ArrowDown"?(oi(),!0):n.key==="Enter"?xs():!1,onExit:()=>{e?.remove(),t?.destroy(),hn()}}}const jt=/@([\w.]+)/g;function ai(t,e){if(!t)return null;const n=ms(e),s=new Map(n.map(a=>[a.id,a]));if(!jt.test(t))return t;jt.lastIndex=0;const r=[];let l=0,c;for(;(c=jt.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 Yt(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=Pr();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,p=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=yo.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let m;if(e[4]!==n||e[5]!==f){let T;e[7]!==n?(T=A=>{const{query:R}=A;return ms(n).filter(z=>z.label.toLowerCase().includes(R.toLowerCase())||z.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=T):T=e[8],m=Wr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:mi,renderHTML:fi,suggestion:{items:T,render:ci,command:ui}}).extend(f?{addNodeView(){return wo(ni)}}:{}),e[4]=n,e[5]=f,e[6]=m}else m=e[6];let h;e[9]!==m?(h=[x,m],e[9]=m,e[10]=h):h=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:di},e[11]=g,e[12]=b):b=e[12];let j;e[13]!==i?(j=T=>{const{editor:A}=T;return i?.(A.getText().trim())},e[13]=i,e[14]=j):j=e[14];let y;e[15]!==u||e[16]!==p||e[17]!==h||e[18]!==b||e[19]!==j?(y={content:u,editable:p,extensions:h,editorProps:b,onUpdate:j},e[15]=u,e[16]=p,e[17]=h,e[18]=b,e[19]=j,e[20]=y):y=e[20];const w=So(y);let v;e[21]!==l?(v=O("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 S;e[23]!==w?(S=o.jsx(ko,{editor:w}),e[23]=w,e[24]=S):S=e[24];let k;e[25]!==v||e[26]!==S?(k=o.jsx("div",{className:v,children:S}),e[25]=v,e[26]=S,e[27]=k):k=e[27];const I=k;if(a!==void 0){let T;return e[28]!==I||e[29]!==a?(T=o.jsx(fs.Provider,{value:a,children:I}),e[28]=I,e[29]=a,e[30]=T):T=e[30],T}return I}function di(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function ui(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function fi(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function mi(t){const{node:e}=t;return`@${e.attrs.id}`}function pi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 xi(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=os(),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(Yt,{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 hi(t){const e=N.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=O("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 gi(t){const e=N.c(13),{value:n,onChange:s,readonly:i,id:r,label:l}=t,c=n??!1;let a;e[0]!==s?(a=p=>s(p.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 bi(t){const e=N.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=h=>s(h.target.value),e[2]=s,e[3]=u):u=e[3];let f,p;e[4]===Symbol.for("react.memo_cache_sentinel")?(f=O("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"),p=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=p):(f=e[4],p=e[5]);let x;e[6]!==a?(x=a.map(ji),e[6]=a,e[7]=x):x=e[7];let m;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(m=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[p,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=m):m=e[13],m}function ji(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const vi={TextWidget:pi,TextareaWidget:xi,NumberWidget:hi,CheckboxWidget:gi,SelectWidget:bi};function yi(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:An,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function wi(t){const e=N.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,p,x,m,h,g;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:S}=yi(d);g="space-y-2",x="flex items-center gap-2",e[15]!==n||e[16]!==s?(m=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=m):m=e[17],e[18]!==i?(h=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=h):h=e[19],u=v,f=14,p=O(S,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=p,e[11]=x,e[12]=m,e[13]=h,e[14]=g}else u=e[8],f=e[9],p=e[10],x=e[11],m=e[12],h=e[13],g=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==p?(b=o.jsx(u,{size:f,className:p}),e[20]=u,e[21]=f,e[22]=p,e[23]=b):b=e[23];let j;e[24]!==x||e[25]!==m||e[26]!==h||e[27]!==b?(j=o.jsxs("div",{className:x,children:[m,h,b]}),e[24]=x,e[25]=m,e[26]=h,e[27]=b,e[28]=j):j=e[28];let y;e[29]!==r?(y=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=y):y=e[30];let w;return e[31]!==l||e[32]!==g||e[33]!==j||e[34]!==y?(w=o.jsxs("div",{className:g,children:[j,y,l]}),e[31]=l,e[32]=g,e[33]=j,e[34]=y,e[35]=w):w=e[35],w}function Si(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(ki),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(Ni),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 Ni(t){return o.jsx("div",{children:t.content},t.name)}function ki(t){return o.jsx("div",{children:t.content},t.name)}function Ci(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(Ii),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(V,{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 Ii(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 _i(){return null}function Ti(){return null}const $i={FieldTemplate:wi,ObjectFieldTemplate:Si,ArrayFieldTemplate:Ci,UnsupportedFieldTemplate:_i,ErrorListTemplate:Ti};function Ei(t){const e=N.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??""),p=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:p})]}),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(Yt,{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 hs({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(Ei,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=C.useRef(e??{}),d=u=>{const f=u.formData??{},p=a.current;if(n?.(f),s){for(const[x,m]of Object.entries(f))p[x]!==m&&s(x,m);for(const x of Object.keys(p))x in f||s(x,void 0)}a.current=f};return o.jsx(ss.Provider,{value:l,children:o.jsx(lo,{schema:c,formData:e,onChange:d,validator:co,widgets:vi,templates:$i,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function Oi(t){const e=N.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]=C.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 p;e[5]!==s?(p=I=>{I||d({}),s(I)},e[5]=s,e[6]=p):p=e[6];const x=p;let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs($o,{children:[o.jsx(Eo,{children:"Workflow Input"}),o.jsx(Oo,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=m):m=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[8]=h):h=e[8];let g;e[9]!==a||e[10]!==i?(g=o.jsx("div",{className:"py-4",children:o.jsx(hs,{inputSchema:i,inputParams:a,setInputParams:d,mentions:h})}),e[9]=a,e[10]=i,e[11]=g):g=e[11];let b;e[12]!==x?(b=()=>x(!1),e[12]=x,e[13]=b):b=e[13];let j;e[14]!==l||e[15]!==b?(j=o.jsx(V,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let y;e[17]!==l?(y=l?o.jsx(De,{size:"xs"}):o.jsx(Ht,{size:14}),e[17]=l,e[18]=y):y=e[18];let w;e[19]!==f||e[20]!==l||e[21]!==y?(w=o.jsxs(V,{onClick:f,disabled:l,className:"gap-2",children:[y,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=y,e[22]=w):w=e[22];let v;e[23]!==w||e[24]!==j?(v=o.jsxs(Ro,{children:[j,w]}),e[23]=w,e[24]=j,e[25]=v):v=e[25];let S;e[26]!==v||e[27]!==g?(S=o.jsxs(Mo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[m,g,v]}),e[26]=v,e[27]=g,e[28]=S):S=e[28];let k;return e[29]!==x||e[30]!==n||e[31]!==S?(k=o.jsx(Ao,{open:n,onOpenChange:x,children:S}),e[29]=x,e[30]=n,e[31]=S,e[32]=k):k=e[32],k}function Ri(t){const e=N.c(27),{title:n,description:s,onSave:i,isSaving:r}=t,c=It().location.href,{viewMode:a,setViewMode:d,showExecutionsList:u,toggleExecutionsList:f}=Xt(),{resetToOriginalWorkflow:p,setSelectedVirtualMcpId:x}=Z(),m=es(),h=Me(),g=W();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 y;e[4]!==b||e[5]!==j?(y=o.jsx(Cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b,j]})}),e[4]=b,e[5]=j,e[6]=y):y=e[6];let w;e[7]!==m||e[8]!==r||e[9]!==i||e[10]!==p||e[11]!==h||e[12]!==x||e[13]!==d||e[14]!==u||e[15]!==n||e[16]!==f||e[17]!==g||e[18]!==c||e[19]!==a?(w=!g&&o.jsxs(o.Fragment,{children:[o.jsx(Pt,{title:n,url:c,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Sr,{selectedVirtualMcpId:h,onVirtualMcpChange:x,placeholder:"Select Agent"})}),o.jsx(xo,{value:a,onValueChange:d,size:"sm",options:[{value:"visual",icon:o.jsx(Kn,{})},{value:"code",icon:o.jsx(Bn,{})}]}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:p,disabled:!m,"aria-label":"Reset changes",children:o.jsx(kn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!m||r,"aria-label":"Save workflow",children:r?o.jsx(De,{size:"xs"}):o.jsx(Gt,{size:14})})})}),o.jsx(ce,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(V,{variant:u?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:f,"aria-label":u?"Hide runs":"Show runs",children:o.jsx(Vn,{size:14})})})}),o.jsx(ce,{side:"bottom",children:u?"Hide runs":"Show runs"})]})})]}),e[7]=m,e[8]=r,e[9]=i,e[10]=p,e[11]=h,e[12]=x,e[13]=d,e[14]=u,e[15]=n,e[16]=f,e[17]=g,e[18]=c,e[19]=a,e[20]=w):w=e[20];let v;e[21]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(Pi,{}),e[21]=v):v=e[21];let S;e[22]!==w?(S=o.jsxs(Wt,{children:[w,v]}),e[22]=w,e[23]=S):S=e[23];let k;return e[24]!==y||e[25]!==S?(k=o.jsxs(o.Fragment,{children:[y,S]}),e[24]=y,e[25]=S,e[26]=k):k=e[26],k}function Mi(){const t=W(),{item:e}=re(t);return e?.completed_at_epoch_ms!=null}function Ai(){const t=W(),{item:e}=re(t);return e?.status==="cancelled"}function Pi(){const t=N.c(58),e=es(),n=Mi(),s=Ai(),i=W(),r=Me(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=Rr(),u=Fe(),[f,p]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:m}=Mr(),{handleResumeWorkflow:h,isResuming:g}=Ar(),b=i&&!n;let j;t[0]!==u?(j=u.some(Li),t[0]=u,t[1]=j):j=t[1];const y=j,w=!r,v=u.length===0,S=e||v||y||w||c||m,k=b||c;let I;t[2]!==y||t[3]!==w||t[4]!==e||t[5]!==s||t[6]!==k||t[7]!==v?(I=()=>s?"Workflow is currently cancelled":k?"Workflow is currently running":e?"Save your changes before running":w?"Select an Agent first":v||y?"Add at least one step to the workflow":null,t[2]=y,t[3]=w,t[4]=e,t[5]=s,t[6]=k,t[7]=v,t[8]=I):I=t[8];const A=I();let R;t[9]!==x||t[10]!==h||t[11]!==l||t[12]!==d||t[13]!==s||t[14]!==k||t[15]!==a||t[16]!==i?(R=async()=>{if(a&&d){p(!0);return}if(s&&i){await h(i);return}if(k&&i){await x(i);return}await l({})},t[9]=x,t[10]=h,t[11]=l,t[12]=d,t[13]=s,t[14]=k,t[15]=a,t[16]=i,t[17]=R):R=t[17];const P=R;let z;t[18]!==l?(z=async Pe=>{await l(Pe)},t[18]=l,t[19]=z):z=t[19];const q=z,M=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",J=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let _;t[20]!==J?(_=O("gap-2 h-7 px-3",J),t[20]=J,t[21]=_):_=t[21];let $;t[22]!==m||t[23]!==s||t[24]!==c||t[25]!==g||t[26]!==b?($=(!b&&!c&&!m&&!g||s)&&o.jsx(Ht,{size:14}),t[22]=m,t[23]=s,t[24]=c,t[25]=g,t[26]=b,t[27]=$):$=t[27];let E;t[28]!==m||t[29]!==s||t[30]!==c||t[31]!==g||t[32]!==b?(E=b&&!c&&!m&&!g&&!s&&o.jsx(Co,{size:14}),t[28]=m,t[29]=s,t[30]=c,t[31]=g,t[32]=b,t[33]=E):E=t[33];let L;t[34]!==m||t[35]!==c||t[36]!==g?(L=(c||m||g)&&o.jsx(De,{size:"xs"}),t[34]=m,t[35]=c,t[36]=g,t[37]=L):L=t[37];let H;t[38]!==M||t[39]!==P||t[40]!==S||t[41]!==_||t[42]!==$||t[43]!==E||t[44]!==L?(H=o.jsxs(V,{variant:"default",size:"sm",className:_,disabled:S,onClick:P,children:[$,E,L,M]}),t[38]=M,t[39]=P,t[40]=S,t[41]=_,t[42]=$,t[43]=E,t[44]=L,t[45]=H):H=t[45];const X=H;let D;t[46]!==X||t[47]!==A?(D=A?o.jsx(ae,{children:o.jsxs(de,{delayDuration:0,children:[o.jsx(le,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:X})}),o.jsx(ce,{side:"bottom",children:A})]})}):X,t[46]=X,t[47]=A,t[48]=D):D=t[48];const G=D;let B;t[49]!==q||t[50]!==d||t[51]!==c||t[52]!==a||t[53]!==f?(B=a&&d&&o.jsx(Oi,{open:f,onOpenChange:p,inputSchema:d,onSubmit:q,isPending:c}),t[49]=q,t[50]=d,t[51]=c,t[52]=a,t[53]=f,t[54]=B):B=t[54];let K;return t[55]!==G||t[56]!==B?(K=o.jsxs(o.Fragment,{children:[G,B]}),t[55]=G,t[56]=B,t[57]=K):K=t[57],K}function Li(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function zi(){const t=N.c(15),e=W(),n=Fe(),{item:s}=re(e);if(!e||!s)return;let i;if(t[0]!==s.completed_steps?.error||t[1]!==s.completed_steps?.success||t[2]!==s.status||t[3]!==n){i={};let r;t[5]!==s.completed_steps?.success?(r=new Set(s.completed_steps?.success?.map(Di)??[]),t[5]=s.completed_steps?.success,t[6]=r):r=t[6];const l=r;let c;t[7]!==s.completed_steps?.error?(c=s.completed_steps?.error??[],t[7]=s.completed_steps?.error,t[8]=c):c=t[8];let a;t[9]!==c?(a=new Set(c),t[9]=c,t[10]=a):a=t[10];const d=a;let u;t[11]!==d||t[12]!==n||t[13]!==l?(u=-1,n.forEach((f,p)=>{(l.has(f.name)||d.has(f.name))&&(u=p)}),t[11]=d,t[12]=n,t[13]=l,t[14]=u):u=t[14],n.forEach((f,p)=>{let x="pending";d.has(f.name)?x="error":l.has(f.name)?x="success":s.status==="running"&&p===u+1&&(x="running"),i[f.name]={status:x,output:void 0,error:void 0,stepIndex:p}}),t[0]=s.completed_steps?.error,t[1]=s.completed_steps?.success,t[2]=s.status,t[3]=n,t[4]=i}else i=t[4];return i}function Di(t){return t.name}function Wi(t){const e=N.c(94),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=W(),{item:p}=re(f),x=p?.completed_steps,m=x?.success;let h;e[0]!==n.name||e[1]!==m?(h=m?.find(U=>U.name===n.name),e[0]=n.name,e[1]=m,e[2]=h):h=e[2];const g=h,b=g?.completed_at_epoch_ms,j=g!=null,y=x?.error?.includes(n.name),w="toolName"in n.action,v=w&&"connectionId"in n.action?n.action.connectionId:null,k=!!(w&&"toolName"in n.action?n.action.toolName:null),I=Xi(n),T=j?"success":y?"error":r?.status,A=r!==void 0,R=T==="success"||T==="error";let P=I.length>0?60:12;(T==="success"||T==="error")&&(P=P+32);const z=Vi(T);let q;e[3]!==T?(q=Bi(T),e[3]=T,e[4]=q):q=e[4];const M=q;let J;e[5]===Symbol.for("react.memo_cache_sentinel")?(J=function(qe,Rs){const on=Rs.split(".").slice(1);if(on.length===0)return Array.isArray(qe)?qe:void 0;let ie=qe;for(const Ms of on){if(ie==null)return;if(typeof ie=="object")ie=ie[Ms];else return}return Array.isArray(ie)?ie:void 0},e[5]=J):J=e[5];const _=J,$=n.forEach!==void 0,E=n.forEach?.ref;let L;e[6]!==E?(L=E?.replace("@","").split(".")[0],e[6]=E,e[7]=L):L=e[7];const H=L,X=p?.status==="running"||p?.status==="enqueued";let D;e[8]!==m||e[9]!==H?(D=m?.some(U=>U.name===H),e[8]=m,e[9]=H,e[10]=D):D=e[10];const G=D,B=X?500:!1;let K;e[11]!==G||e[12]!==B?(K={refetchInterval:B,enabled:G},e[11]=G,e[12]=B,e[13]=K):K=e[13];const{output:Pe}=ts(f,H,K);let Ve;if(e[14]!==Pe||e[15]!==E){const U=E?.replace("@","");Ve=U?_(Pe,U):void 0,e[14]=Pe,e[15]=E,e[16]=Ve}else Ve=e[16];const Le=Ve;let Be;e[17]!==p?.completed_steps?.success||e[18]!==n.name?(Be=p?.completed_steps?.success?.filter(U=>new RegExp(`^${n.name}\\[\\d+\\]$`).test(U.name)),e[17]=p?.completed_steps?.success,e[18]=n.name,e[19]=Be):Be=e[19];const rt=Be,it=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",lt=T==="running"&&"bg-accent/50",ct=l&&"opacity-50";let ue;e[20]!==it||e[21]!==lt||e[22]!==ct?(ue=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",it,lt,ct),e[20]=it,e[21]=lt,e[22]=ct,e[23]=ue):ue=e[23];const Ts="button",$s=0;let fe;e[24]!==a?(fe=U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),a())},e[24]=a,e[25]=fe):fe=e[25];const Es="w-5 flex flex-col items-center justify-center shrink-0 pt-3",at=O("text-xs font-mono opacity-75 h-8 flex items-center",z),dt=s+1;let me;e[26]!==at||e[27]!==dt?(me=o.jsx("div",{className:Es,children:o.jsxs("span",{className:at,children:[dt,"."]})}),e[26]=at,e[27]=dt,e[28]=me):me=e[28];let pe;e[29]!==M||e[30]!==s?(pe=s>0?o.jsx(vt,{height:12,color:M}):o.jsx("div",{className:"h-3"}),e[29]=M,e[30]=s,e[31]=pe):pe=e[31];let xe;e[32]!==v||e[33]!==k||e[34]!==w||e[35]!==n.name?(xe=o.jsx(Gi,{connectionId:v,isToolStep:w,hasToolSelected:k,stepName:n.name}),e[32]=v,e[33]=k,e[34]=w,e[35]=n.name,e[36]=xe):xe=e[36];let he;e[37]!==M||e[38]!==R||e[39]!==T?(he=R&&o.jsxs(o.Fragment,{children:[o.jsx(vt,{height:8,color:M}),o.jsx(Ui,{status:T})]}),e[37]=M,e[38]=R,e[39]=T,e[40]=he):he=e[40];let ge;e[41]!==M||e[42]!==P||e[43]!==c||e[44]!==f?(ge=c&&f?null:o.jsx(vt,{height:P,color:M}),e[41]=M,e[42]=P,e[43]=c,e[44]=f,e[45]=ge):ge=e[45];let be;e[46]!==pe||e[47]!==xe||e[48]!==he||e[49]!==ge?(be=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[pe,xe,he,ge]}),e[46]=pe,e[47]=xe,e[48]=he,e[49]=ge,e[50]=be):be=e[50];const Os="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3",ut=k?"font-medium text-foreground":"text-foreground";let je;e[51]!==ut?(je=O("text-sm truncate flex-1",ut),e[51]=ut,e[52]=je):je=e[52];let ve;e[53]!==n?(ve=Zi(n),e[53]=n,e[54]=ve):ve=e[54];let ye;e[55]!==je||e[56]!==ve?(ye=o.jsx("span",{className:je,children:ve}),e[55]=je,e[56]=ve,e[57]=ye):ye=e[57];let we;e[58]!==rt?.length||e[59]!==$||e[60]!==Le?(we=$&&Le&&Le.length>0&&o.jsx("span",{className:"text-xs font-mono opacity-75 h-8 flex items-center",children:`${rt?.length??0} / ${Le.length}`}),e[58]=rt?.length,e[59]=$,e[60]=Le,e[61]=we):we=e[61];let Se;e[62]!==A||e[63]!==T?(Se=A&&o.jsx(qi,{status:T}),e[62]=A,e[63]=T,e[64]=Se):Se=e[64];let Ne;e[65]!==we||e[66]!==Se?(Ne=o.jsxs("div",{className:"flex items-center gap-2",children:[we,Se]}),e[65]=we,e[66]=Se,e[67]=Ne):Ne=e[67];let ke;e[68]!==A||e[69]!==d||e[70]!==u?(ke=!A&&o.jsxs(Lo,{children:[o.jsx(zo,{asChild:!0,children:o.jsx(V,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:Fi,children:o.jsx(Po,{size:14})})}),o.jsxs(Do,{align:"end",children:[o.jsxs(cn,{onClick:U=>{U.stopPropagation(),u()},children:[o.jsx(Vo,{size:14}),"Duplicate"]}),o.jsxs(cn,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:U=>{U.stopPropagation(),d()},children:[o.jsx(qs,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[68]=A,e[69]=d,e[70]=u,e[71]=ke):ke=e[71];let Ce;e[72]!==ye||e[73]!==Ne||e[74]!==ke?(Ce=o.jsxs("div",{className:"flex items-center h-8",children:[ye,Ne,ke]}),e[72]=ye,e[73]=Ne,e[74]=ke,e[75]=Ce):Ce=e[75];const ft=I.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:I.map(Hi)});let Ie;e[76]!==T||e[77]!==b?(Ie=T==="success"&&o.jsx(Ki,{completedAtEpochMs:b}),e[76]=T,e[77]=b,e[78]=Ie):Ie=e[78];let _e;e[79]!==r?.error||e[80]!==T?(_e=T==="error"&&o.jsx(Ji,{error:r?.error}),e[79]=r?.error,e[80]=T,e[81]=_e):_e=e[81];let Te;e[82]!==Ce||e[83]!==ft||e[84]!==Ie||e[85]!==_e?(Te=o.jsxs("div",{className:Os,children:[Ce,ft,Ie,_e]}),e[82]=Ce,e[83]=ft,e[84]=Ie,e[85]=_e,e[86]=Te):Te=e[86];let Ue;return e[87]!==a||e[88]!==ue||e[89]!==fe||e[90]!==me||e[91]!==be||e[92]!==Te?(Ue=o.jsxs("div",{className:ue,onClick:a,role:Ts,tabIndex:$s,onKeyDown:fe,children:[me,be,Te]}),e[87]=a,e[88]=ue,e[89]=fe,e[90]=me,e[91]=be,e[92]=Te,e[93]=Ue):Ue=e[93],Ue}function Hi(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 Fi(t){return t.stopPropagation()}function Vi(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function Bi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function Ui(t){const e=N.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(Ut,{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(Ft,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function qi(t){const e=N.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(Ut,{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(Ft,{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(ze,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Ki(t){const e=N.c(8),{completedAtEpochMs:n}=t;let s,i;if(e[0]!==n){const a=n!=null?new Date(n):null;s=a?a.toISOString().split("T")[0]:null,i=a?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(so,{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 Ji(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Jt,{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 Gi(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=Vt(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(Ye,{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(Gn,{size:16,className:"text-muted-foreground"}):o.jsx(Fo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function vt(t){const e=N.c(7),{height:n,color:s}=t,i=s===void 0?"bg-border":s;let r;e[0]!==i?(r=O("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 Zi(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 Xi(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 Qi(t){const e=N.c(32),{className:n}=t,s=Fe(),i=Yn(),r=zi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=Z(),d=W();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(y=>r[y.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("div",{children:"Loading..."}),e[3]=p):p=e[3];let x;e[4]!==n?(x=O("h-full flex flex-col p-8 overflow-auto",n),e[4]=n,e[5]=x):x=e[5];let m;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let y;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(y=(w,v)=>{const S=r?.[w.name],k=f!==-1&&v>f&&S?.status==="pending",I=v===s.length-1;return o.jsx(Wi,{step:w,index:v,isSelected:w.name===i,executionStatus:S,isSkipped:k,isLastStep:I,onSelect:()=>l(w.name),onDelete:()=>c(w.name),onDuplicate:()=>a(w.name)},w.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]=y):y=e[21],m=s.map(y),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=m}else m=e[13];let h;e[22]!==m?(h=o.jsx("div",{className:"pt-3 -space-y-1",children:m}),e[22]=m,e[23]=h):h=e[23];let g;e[24]!==d?(g=d?null:o.jsx(Yi,{}),e[24]=d,e[25]=g):g=e[25];let b;e[26]!==h||e[27]!==g?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[h,g]}),e[26]=h,e[27]=g,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(C.Suspense,{fallback:p,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function Yi(){const t=N.c(8),{addToolStep:e}=Z();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(Rn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(V,{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 el(){const t=N.c(11),{org:e}=Y(),s=Me()??null;let i;t[0]!==e.id||t[1]!==s?(i={connectionId:s,orgId:e.id},t[0]=e.id,t[1]=s,t[2]=i):i=t[2];const r=ee(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=Rt(l);let a;t[5]!==c.data?.tools?(a=c.data?.tools??[],t[5]=c.data?.tools,t[6]=a):a=t[6];let d;return t[7]!==a||t[8]!==c.error||t[9]!==c.isLoading?(d={tools:a,isLoading:c.isLoading,error:c.error},t[7]=a,t[8]=c.error,t[9]=c.isLoading,t[10]=d):d=t[10],d}function tl(t){const e=N.c(7),{className:n}=t;if(!Me()){let r;e[0]!==n?(r=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=r):r=e[1];let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground p-4 text-center",children:"Select an agent to see available tools"}),e[2]=l):l=e[2];let c;return e[3]!==r?(c=o.jsx("div",{className:r,children:l}),e[3]=r,e[4]=c):c=e[4],c}let i;return e[5]!==n?(i=o.jsx(nl,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function nl(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=el(),l=He(),{updateStep:c}=Z(),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=S=>S.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 p=Lr(s,u??null,ol,sl);let x;e[5]!==l||e[6]!==c?(x=v=>{l&&c(l.name,{action:{...l.action,toolName:v.name},outputSchema:v.outputSchema??{}})},e[5]=l,e[6]=c,e[7]=x):x=e[7];const m=x;if(i){let v;e[8]!==n?(v=O("flex flex-col h-full bg-sidebar",n),e[8]=n,e[9]=v):v=e[9];let S;e[10]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(De,{size:"sm"})}),e[10]=S):S=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:S}),e[11]=v,e[12]=k):k=e[12],k}if(r){let v;e[13]!==n?(v=O("flex flex-col h-full bg-sidebar",n),e[13]=n,e[14]=v):v=e[14];let S;e[15]!==r.message?(S=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]=S):S=e[16];let k;return e[17]!==v||e[18]!==S?(k=o.jsx("div",{className:v,children:S}),e[17]=v,e[18]=S,e[19]=k):k=e[19],k}let h;e[20]!==n?(h=O("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=h):h=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]!==m||e[26]!==p||e[27]!==d){let v;e[29]!==m||e[30]!==d?(v=S=>o.jsx(rl,{icon:null,title:S.name,description:S.description,isSelected:S.name===d,onClick:()=>m(S)},S.name),e[29]=m,e[30]=d,e[31]=v):v=e[31],j=p.map(v),e[25]=m,e[26]=p,e[27]=d,e[28]=j}else j=e[28];let y;e[32]!==j?(y=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=y):y=e[33];let w;return e[34]!==h||e[35]!==b||e[36]!==y?(w=o.jsxs("div",{className:h,children:[b,y]}),e[34]=h,e[35]=b,e[36]=y,e[37]=w):w=e[37],w}function sl(t,e){return t.name.localeCompare(e.name)}function ol(t){return t.name}function rl(t){const e=N.c(20),{icon:n,title:s,description:i,isSelected:r,onClick:l}=t,c=r&&"bg-muted/50";let a;e[0]!==c?(a=O("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=h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(Ye,{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 p;e[9]!==i?(p=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=p):p=e[10];let x;e[11]!==f||e[12]!==p?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,p]}),e[11]=f,e[12]=p,e[13]=x):x=e[13];let m;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(m=o.jsxs("div",{className:a,onClick:l,role:"button",tabIndex:0,onKeyDown:d,children:[u,x]}),e[14]=l,e[15]=a,e[16]=d,e[17]=u,e[18]=x,e[19]=m):m=e[19],m}var te="Accordion",il=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[en,ll,cl]=Js(te),[st]=yn(te,[cl,On]),tn=On(),gs=F.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(en.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(fl,{...r,ref:e}):o.jsx(ul,{...i,ref:e})})});gs.displayName=te;var[bs,al]=st(te),[js,dl]=st(te,{collapsible:!1}),ul=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=Tt({prop:n,defaultProp:s??"",onChange:i,caller:te});return o.jsx(bs,{scope:t.__scopeAccordion,value:F.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:F.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(vs,{...l,ref:e})})})}),fl=F.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=Tt({prop:n,defaultProp:s??[],onChange:i,caller:te}),a=F.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=F.useCallback(u=>c((f=[])=>f.filter(p=>p!==u)),[c]);return o.jsx(bs,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(js,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(vs,{...r,ref:e})})})}),[ml,ot]=st(te),vs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=F.useRef(null),a=vn(c,e),d=ll(n),f=Gs(i)==="ltr",p=ne(t.onKeyDown,x=>{if(!il.includes(x.key))return;const m=x.target,h=d().filter(I=>!I.ref.current?.disabled),g=h.findIndex(I=>I.ref.current===m),b=h.length;if(g===-1)return;x.preventDefault();let j=g;const y=0,w=b-1,v=()=>{j=g+1,j>w&&(j=y)},S=()=>{j=g-1,j<y&&(j=w)};switch(x.key){case"Home":j=y;break;case"End":j=w;break;case"ArrowRight":r==="horizontal"&&(f?v():S());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?S():v());break;case"ArrowUp":r==="vertical"&&S();break}const k=j%b;h[k].ref.current?.focus()});return o.jsx(ml,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(en.Slot,{scope:n,children:o.jsx(_t.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:p})})})}),Qe="AccordionItem",[pl,nn]=st(Qe),ys=F.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=ot(Qe,n),l=al(Qe,n),c=tn(n),a=Ks(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(pl,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(_o,{"data-orientation":r.orientation,"data-state":Is(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});ys.displayName=Qe;var ws="AccordionHeader",Ss=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ws,n);return o.jsx(_t.h3,{"data-orientation":i.orientation,"data-state":Is(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Ss.displayName=ws;var Ct="AccordionTrigger",Ns=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(Ct,n),l=dl(Ct,n),c=tn(n);return o.jsx(en.ItemSlot,{scope:n,children:o.jsx(Io,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Ns.displayName=Ct;var ks="AccordionContent",Cs=F.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=ot(te,n),r=nn(ks,n),l=tn(n);return o.jsx(To,{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}})});Cs.displayName=ks;function Is(t){return t?"open":"closed"}var xl=gs,hl=ys,gl=Ss,bl=Ns,jl=Cs;function vl(t){const e=N.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(xl,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function yl(t){const e=N.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=O("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(hl,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function wl(t){const e=N.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=O("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(Wo,{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(gl,{className:"flex",children:o.jsxs(bl,{"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 Sl(t){const e=N.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=O("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(jl,{"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 Nl(t){const{updateStep:e}=Z(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=sn(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function kl(t){const e=N.c(32),{className:n}=t,s=He(),{appendStep:i}=Z();Nl(s);const r=W(),{item:l}=re(r);if(!s){let b;e[0]!==n?(b=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=b):b=e[1];let j;e[2]!==i?(j=()=>{i({type:"tool"})},e[2]=i,e[3]=j):j=e[3];let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Rn,{size:14}),e[4]=y):y=e[4];let w;e[5]!==j?(w=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(V,{variant:"ghost",size:"icon",className:"size-7",onClick:j,children:y})]}),e[5]=j,e[6]=w):w=e[6];let v;return e[7]!==b||e[8]!==w?(v=o.jsx("div",{className:b,children:w}),e[7]=b,e[8]=w,e[9]=v):v=e[9],v}const c=s?.name,a=!!(l?.completed_steps?.success?.some(b=>b.name===c)||l?.completed_steps?.error?.includes(c));let d;e[10]!==n?(d=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=d):d=e[11];let u,f;e[12]!==s?(u=o.jsx(Cl,{step:s}),f=o.jsx(_l,{step:s}),e[12]=s,e[13]=u,e[14]=f):(u=e[13],f=e[14]);const p=a?"open":"closed";let x;e[15]!==s||e[16]!==a||e[17]!==p?(x=o.jsx($l,{step:s,defaultOpen:a},p),e[15]=s,e[16]=a,e[17]=p,e[18]=x):x=e[18];let m;e[19]!==s||e[20]!==r?(m=!r&&o.jsx(Ml,{step:s}),e[19]=s,e[20]=r,e[21]=m):m=e[21];let h;e[22]!==s||e[23]!==r?(h=!r&&o.jsx(Ll,{step:s}),e[22]=s,e[23]=r,e[24]=h):h=e[24];let g;return e[25]!==d||e[26]!==u||e[27]!==f||e[28]!==x||e[29]!==m||e[30]!==h?(g=o.jsxs("div",{className:d,children:[u,f,x,m,h]}),e[25]=d,e[26]=u,e[27]=f,e[28]=x,e[29]=m,e[30]=h,e[31]=g):g=e[31],g}function Cl(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=W(),l=i??"";let c;e[0]!==l?(c=o.jsx(Ye,{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(Il,{}),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 p;return e[12]!==u||e[13]!==f?(p=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]=p):p=e[14],p}function Il(){const t=N.c(9),e=He(),{updateStep:n,startReplacingTool:s}=Z(),i=W(),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){gn.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(Jn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(V,{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 sn(t){const e=N.c(13),{org:n}=Y(),i=Me()??null;let r;e[0]!==n.id||e[1]!==i?(r={connectionId:i,orgId:n.id},e[0]=n.id,e[1]=i,e[2]=r):r=e[2];const l=ee(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=Rt(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(p=>p.name===t),e[5]=t,e[6]=a.data?.tools,e[7]=d):d=e[7];const u=d;let f;return e[8]!==u||e[9]!==a.error||e[10]!==a.isLoading||e[11]!==a.isSuccess?(f={tool:u,isLoading:a.isLoading,isReady:a.isSuccess,error:a.error},e[8]=u,e[9]=a.error,e[10]=a.isLoading,e[11]=a.isSuccess,e[12]=f):f=e[12],f}function _l(t){const e=N.c(18),{step:n}=t,{updateStep:s}=Z(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=W(),{tool:c}=sn(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?Tl(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,p=l?"output":"input";let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(wl,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[7]=x):x=e[7];const m=n.name+l,h=!!l,g=f,b=n.input;let j;e[8]===Symbol.for("react.memo_cache_sentinel")?(j=[],e[8]=j):j=e[8];let y;e[9]!==d||e[10]!==m||e[11]!==h||e[12]!==g||e[13]!==b?(y=o.jsxs(yl,{value:"input",className:"border-b-0",children:[x,o.jsx(Sl,{className:"px-5 pt-2",children:o.jsx(hs,{readOnly:h,inputSchema:g,inputParams:b,setInputParams:d,mentions:j},m)})]}),e[9]=d,e[10]=m,e[11]=h,e[12]=g,e[13]=b,e[14]=y):y=e[14];let w;return e[15]!==y||e[16]!==p?(w=o.jsx(vl,{type:"single",collapsible:!0,defaultValue:p,className:"border-b border-border shrink-0",children:y}),e[15]=y,e[16]=p,e[17]=w):w=e[17],w}function Tl(t,e){const n=structuredClone(t),s=n.properties;return s&&Object.keys(s).forEach(i=>{e[i]||delete s[i]}),n}function $l(t){const e=N.c(24),{step:n,defaultOpen:s}=t,i=n.outputSchema,r=W(),{item:l}=re(r),c=!!(l?.completed_steps?.success?.some(T=>T.name===n.name)||l?.completed_steps?.error?.includes(n.name)),[a,d]=C.useState(s),{output:u,error:f}=ts(r,c?n.name:void 0);let p;e[0]!==f||e[1]!==u?(p=u||(f?{error:f}:void 0),e[0]=f,e[1]=u,e[2]=p):p=e[2];const x=p,m=i&&typeof i=="object"?i.properties:void 0;let h;e[3]!==m?(h=m?Object.entries(m):[],e[3]=m,e[4]=h):h=e[4];const g=h,b=a?"flex-1 min-h-0 overflow-hidden":"shrink-0";let j;e[5]!==b?(j=O("flex flex-col border-b border-border",b),e[5]=b,e[6]=j):j=e[6];let y;e[7]!==a?(y=()=>d(!a),e[7]=a,e[8]=y):y=e[8];let w;e[9]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Output"}),e[9]=w):w=e[9];let v;e[10]!==a?(v=o.jsxs("div",{className:"flex items-center justify-between",children:[w,a?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[10]=a,e[11]=v):v=e[11];let S;e[12]!==y||e[13]!==v?(S=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:y,children:v}),e[12]=y,e[13]=v,e[14]=S):S=e[14];let k;e[15]!==x||e[16]!==a||e[17]!==g||e[18]!==r?(k=a&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[r&&x?o.jsx(Oe,{code:JSON.stringify(x,null,2),language:"json",height:"100%",readOnly:!0}):null,!r&&g.map(El)]}),e[15]=x,e[16]=a,e[17]=g,e[18]=r,e[19]=k):k=e[19];let I;return e[20]!==j||e[21]!==S||e[22]!==k?(I=o.jsxs("div",{className:j,children:[S,k]}),e[20]=j,e[21]=S,e[22]=k,e[23]=I):I=e[23],I}function El(t){const[e,n]=t;return o.jsx(Rl,{name:e,schema:n},e)}function Ol(t){switch(t){case"string":return{Icon:Hn,color:"text-blue-500"};case"number":case"integer":return{Icon:Dn,color:"text-blue-500"};case"array":return{Icon:Pn,color:"text-purple-500"};case"object":return{Icon:An,color:"text-orange-500"};case"boolean":return{Icon:Wn,color:"text-pink-500"};case"null":return{Icon:$t,color:"text-gray-500"};default:return{Icon:Ln,color:"text-muted-foreground"}}}function Rl(t){const e=N.c(28),{name:n,schema:s}=t,i=He(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:w,color:v}=Ol(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=w,c=14,a=O(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 p;e[10]!==n?(p=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=p):p=e[11];let x;e[12]!==d||e[13]!==f||e[14]!==p?(x=o.jsxs("div",{className:d,children:[f,p]}),e[12]=d,e[13]=f,e[14]=p,e[15]=x):x=e[15];let m;e[16]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Un,{size:14,className:"opacity-50"}),e[16]=m):m=e[16];const h=i?.name;let g;e[17]!==h?(g=o.jsxs("span",{className:"text-muted-foreground",children:[h,"."]}),e[17]=h,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:[m,g,b]}),e[21]=g,e[22]=b,e[23]=j):j=e[23];let y;return e[24]!==j||e[25]!==u||e[26]!==x?(y=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=y):y=e[27],y}function Ml(t){const e=N.c(29),{step:n}=t,{updateStep:s}=Z(),i=W(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=sn(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 I=d.outputSchema,T=I.properties;return T?`interface Input {
|
|
10
|
-
${Object.entries(T).map(R=>{const[P,z]=R,q=Ge(z),
|
|
10
|
+
${Object.entries(T).map(R=>{const[P,z]=R,q=Ge(z),M=!I.required?.includes(P);return` ${P}${M?"?":""}: ${q};`}).join(`
|
|
11
11
|
`)}
|
|
12
12
|
}`:`interface Input {
|
|
13
13
|
[key: string]: unknown;
|
|
@@ -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(Ml)},e[2]=p,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const m=x;let h;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(h=(I,T)=>{s(n.name,{action:{...n.action,transformCode:I},...T?{outputSchema:T}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=h):h=e[10];const g=h;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=O("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 y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let w;e[14]!==r?(w=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=w):w=e[15];let v;e[16]!==w||e[17]!==m?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:w}),e[16]=w,e[17]=m,e[18]=v):v=e[18];let S;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(S=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Oe,{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]=S):S=e[24];let k;return e[25]!==j||e[26]!==v||e[27]!==S?(k=o.jsxs("div",{className:j,children:[v,S]}),e[25]=j,e[26]=v,e[27]=S,e[28]=k):k=e[28],k}function Ml(t){return!t}function Pl(t){return!t}function Ll(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=Z(),l="code"in n.action&&n.action.code?n.action.code:null,c=W();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},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=O("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==s?(p=()=>i(!s),e[6]=s,e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=x):x=e[8];let m;e[9]!==s?(m=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=m):m=e[10];let h;e[11]!==p||e[12]!==m?(h=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:m}),e[11]=p,e[12]=m,e[13]=h):h=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(Oe,{onSave:(j,y)=>d(j,y),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]!==h||e[22]!==g?(b=o.jsxs("div",{className:f,children:[h,g]}),e[20]=f,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}function Ge(t){if(Array.isArray(t.type))return t.type.map(n=>Ge({...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?`${Ge(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ge(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function zl(t){switch(t){case"success":return o.jsxs($e,{variant:"success",className:"gap-1",children:[o.jsx(Ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs($e,{variant:"destructive",className:"gap-1",children:[o.jsx(Jt,{size:11}),"Error"]});case"running":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"Running"]});case"enqueued":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"On hold"]});case"cancelled":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(An,{size:11}),"Cancelled"]});default:return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),t]})}}function Dl(t){return`Run #${t.slice(-4).toUpperCase()}`}function Wl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=Ir(),{setShowExecutionsList:r}=Xt(),{setTrackingExecutionId:l}=Z(),c=W();let a;e[0]!==l?(a=y=>{l(y)},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 p;e[4]!==n?(p=O("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=p):p=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=x):x=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(An,{size:11}),e[7]=m):m=e[7];let h;e[8]!==f?(h=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(V,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:m})]}),e[8]=f,e[9]=h):h=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((y,w)=>o.jsx(Hl,{execution:y,isSelected:y.id===c,isFirst:w===0,onSelect:()=>d(y.id)},y.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]!==p||e[18]!==h||e[19]!==b?(j=o.jsxs("div",{className:p,children:[h,b]}),e[17]=p,e[18]=h,e[19]=b,e[20]=j):j=e[20],j}function Hl(t){const e=N.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=O("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=zl(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=Dl(n.id),e[6]=n.id,e[7]=f):f=e[7];let p;e[8]!==f?(p=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=p):p=e[9];let x;e[10]!==u||e[11]!==p?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,p]}),e[10]=u,e[11]=p,e[12]=x):x=e[12];let m;return e[13]!==r||e[14]!==d||e[15]!==x?(m=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=m):m=e[16],m}function _s(t){const e=N.c(11),{itemId:n}=t,[s,i]=C.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=oe(r),c=l??"no-connection",{org:a}=Y(),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=ee(u),p=Et(c,"WORKFLOW",n,f),x=Ot(c,"WORKFLOW",f);let m;e[4]!==x||e[5]!==n?(m=async b=>{i(!0),await x.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=x,e[5]=n,e[6]=m):m=e[6];const h=m;let g;return e[7]!==s||e[8]!==p||e[9]!==h?(g={item:p,update:h,isUpdating:s},e[7]=s,e[8]=p,e[9]=h,e[10]=g):g=e[10],g}function Fl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=Z();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=Oe,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 p=JSON.parse(f);i({...n,...p}),s(p)},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 Vl(){const t=N.c(9),e=W(),{item:n}=re(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=C.useRef(l);let a;t[1]!==r?(a=h=>{if(!r)return Bl;const g=setInterval(()=>{c.current=Date.now(),h()},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,p=C.useSyncExternalStore(d,f,f),x=i&&s?Math.max(0,i-s):null;let m=null;if(s){let h;t[5]!==s?(h=new Date(s).getTime(),t[5]=s,t[6]=h):h=t[6];const g=h;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],m=Math.max(0,b-g)}else r&&(m=Math.max(0,p-g))}return m??x}function Bl(){}function Ul(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 ql(){const t=N.c(20),{setTrackingExecutionId:e}=Z(),n=W(),s=Vl();let i;t[0]!==s?(i=s!=null?Ul(s):null,t[0]=s,t[1]=i):i=t[1];const r=i;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(Zs,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=l):l=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=c):c=t[3];let a;t[4]!==n?(a=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[c,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=a):a=t[5];let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ho,{className:"w-4 h-4 text-muted-foreground"}),t[6]=d):d=t[6];let u;t[7]!==r?(u=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[d,o.jsx("span",{className:"text-sm text-muted-foreground",children:r})]}),t[7]=r,t[8]=u):u=t[8];let f;t[9]!==a||t[10]!==u?(f=o.jsxs("div",{className:"flex items-center h-full",children:[l,a,u]}),t[9]=a,t[10]=u,t[11]=f):f=t[11];let p;t[12]!==e?(p=()=>e(void 0),t[12]=e,t[13]=p):p=t[13];let x;t[14]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx($t,{className:"w-4 h-4 text-muted-foreground"}),t[14]=x):x=t[14];let m;t[15]!==p?(m=o.jsx(V,{variant:"ghost",size:"xs",onClick:p,children:x}),t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==f||t[18]!==m?(h=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[f,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function Kl(t){const e=N.c(18),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c,isUpdating:a}=_s(r);let d;e[3]!==l?(d=JSON.stringify(l),e[3]=l,e[4]=d):d=e[4];const u=d;if(!l){let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[5]=m):m=e[5];let h;return e[6]!==n?(h=o.jsx(Ee,{onBack:n,children:m}),e[6]=n,e[7]=h):h=e[7],h}let f;e[8]!==l?(f={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=f):f=e[9];let p;e[10]!==a||e[11]!==n||e[12]!==c?(p=o.jsx(Jl,{onBack:n,onUpdate:c,isUpdating:a}),e[10]=a,e[11]=n,e[12]=c,e[13]=p):p=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==p?(x=o.jsx(gr,{initialState:f,children:p},u),e[14]=u,e[15]=f,e[16]=p,e[17]=x):x=e[17],x}function Jl(t){const e=N.c(24),{onBack:n,onUpdate:s,isUpdating:i}=t,r=Re(),l=W(),{viewMode:c,showExecutionsList:a}=Xt(),d=He();let u;e[0]!==s||e[1]!==r?(u=async()=>{await s(r)},e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,p=d&&"toolName"in d.action,x=p?d.action.toolName:null,m=p&&!x&&!l,h=!m&&(d||l||!a);let g;e[3]!==f||e[4]!==i||e[5]!==r.description||e[6]!==r.title?(g=o.jsx(Ri,{title:r.title,description:r.description,onSave:f,isSaving:i}),e[3]=f,e[4]=i,e[5]=r.description,e[6]=r.title,e[7]=g):g=e[7];let b;e[8]!==l?(b=l&&o.jsx(ql,{}),e[8]=l,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==h||e[13]!==m||e[14]!==c||e[15]!==r?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(Fl,{workflow:r,onUpdate:s}):o.jsxs(mo,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(rn,{defaultSize:50,minSize:30,children:o.jsx(Qi,{})}),o.jsx(po,{}),o.jsxs(rn,{defaultSize:50,minSize:25,children:[m&&o.jsx(tl,{className:"border-l border-border"}),a&&o.jsx(Wl,{}),h&&o.jsx(kl,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=h,e[13]=m,e[14]=c,e[15]=r,e[16]=j):j=e[16];let y;e[17]!==g||e[18]!==b||e[19]!==j?(y=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[g,b,j]}),e[17]=g,e[18]=b,e[19]=j,e[20]=y):y=e[20];let w;return e[21]!==n||e[22]!==y?(w=o.jsx(Ee,{onBack:n,children:y}),e[21]=n,e[22]=y,e[23]=w):w=e[23],w}function Gl(t){const e=N.c(3),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=oe(s),l=Et(i??"no-connection","WORKFLOW_EXECUTION",n,i);let c;return e[1]!==l?(c={item:l},e[1]=l,e[2]=c):c=e[2],c}function Zl(t){const e=N.c(13),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=Gl(r);if(!l){let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[3]=u):u=e[3];let f;return e[4]!==n?(f=o.jsx(Ee,{onBack:n,children:u}),e[4]=n,e[5]=f):f=e[5],f}let c;e[6]!==l?(c=JSON.stringify(l,null,2),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==c?(a=o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Oe,{height:"100%",code:c,language:"json",readOnly:!0})}),e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Ee,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Xl={workflow:Kl,workflow_execution:Zl,prompt:Zo};function Ql(){const t=N.c(6),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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=Yl;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(or,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Yl(t){return Promise.resolve()}function ec(){const t=N.c(19),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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}=Y(),f=i??null;let p;t[3]!==u.id||t[4]!==f?(p={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=p):p=t[5];const x=ee(p),m=Ot(d,r,x);let h;t[6]!==m||t[7]!==l?(h=async S=>{l&&await m.update.mutateAsync({id:l,data:S})},t[6]=m,t[7]=l,t[8]=h):h=t[8];const g=h;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,y=j&&Xl[j];if(y){let S;return t[11]!==y||t[12]!==a||t[13]!==g||t[14]!==l?(S=o.jsx(y,{itemId:l,onBack:a,onUpdate:g}),t[11]=y,t[12]=a,t[13]=g,t[14]=l,t[15]=S):S=t[15],S}let w;t[16]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Xs,{size:36,className:"text-muted-foreground"}),t[16]=w):w=t[16];let v;return t[17]!==a?(v=o.jsx(Bt,{icon:w,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[17]=a,t[18]=v):v=t[18],v}function tc(){const t=N.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=oe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Ql,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ec,{}),t[2]=r):r=t[2],r}function ga(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(tc,{})})}),t[0]=e):e=t[0],e}export{ga as default};
|
|
26
|
+
}`;s(n.name,{action:{...n.action,transformCode:T}}),l(Al)},e[2]=p,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const m=x;let h;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(h=(I,T)=>{s(n.name,{action:{...n.action,transformCode:I},...T?{outputSchema:T}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=h):h=e[10];const g=h;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=O("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 y;e[13]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=y):y=e[13];let w;e[14]!==r?(w=o.jsxs("div",{className:"flex items-center justify-between",children:[y,r?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=w):w=e[15];let v;e[16]!==w||e[17]!==m?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:w}),e[16]=w,e[17]=m,e[18]=v):v=e[18];let S;e[19]!==g||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(S=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(Oe,{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]=S):S=e[24];let k;return e[25]!==j||e[26]!==v||e[27]!==S?(k=o.jsxs("div",{className:j,children:[v,S]}),e[25]=j,e[26]=v,e[27]=S,e[28]=k):k=e[28],k}function Al(t){return!t}function Pl(t){return!t}function Ll(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=Z(),l="code"in n.action&&n.action.code?n.action.code:null,c=W();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,y)=>{r(n.name,{action:{...n.action,code:j},...y?{outputSchema:y}:{}})},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=O("flex flex-col border-b border-border",u),e[4]=u,e[5]=f):f=e[5];let p;e[6]!==s?(p=()=>i(!s),e[6]=s,e[7]=p):p=e[7];let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Step Code"}),e[8]=x):x=e[8];let m;e[9]!==s?(m=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx(Kt,{size:14,className:"text-muted-foreground"}):o.jsx(qt,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=m):m=e[10];let h;e[11]!==p||e[12]!==m?(h=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:m}),e[11]=p,e[12]=m,e[13]=h):h=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(Oe,{onSave:(j,y)=>d(j,y),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]!==h||e[22]!==g?(b=o.jsxs("div",{className:f,children:[h,g]}),e[20]=f,e[21]=h,e[22]=g,e[23]=b):b=e[23],b}function Ge(t){if(Array.isArray(t.type))return t.type.map(n=>Ge({...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?`${Ge(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Ge(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function zl(t){switch(t){case"success":return o.jsxs($e,{variant:"success",className:"gap-1",children:[o.jsx(Ut,{size:11}),"Success"]});case"error":case"failed":return o.jsxs($e,{variant:"destructive",className:"gap-1",children:[o.jsx(Jt,{size:11}),"Error"]});case"running":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"Running"]});case"enqueued":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),"On hold"]});case"cancelled":return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Mn,{size:11}),"Cancelled"]});default:return o.jsxs($e,{variant:"secondary",className:"gap-1",children:[o.jsx(Je,{size:11}),t]})}}function Dl(t){return`Run #${t.slice(-4).toUpperCase()}`}function Wl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=Ir(),{setShowExecutionsList:r}=Xt(),{setTrackingExecutionId:l}=Z(),c=W();let a;e[0]!==l?(a=y=>{l(y)},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 p;e[4]!==n?(p=O("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=p):p=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:"Runs"}),e[6]=x):x=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx(Mn,{size:11}),e[7]=m):m=e[7];let h;e[8]!==f?(h=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(V,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:m})]}),e[8]=f,e[9]=h):h=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((y,w)=>o.jsx(Hl,{execution:y,isSelected:y.id===c,isFirst:w===0,onSelect:()=>d(y.id)},y.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]!==p||e[18]!==h||e[19]!==b?(j=o.jsxs("div",{className:p,children:[h,b]}),e[17]=p,e[18]=h,e[19]=b,e[20]=j):j=e[20],j}function Hl(t){const e=N.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=O("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=zl(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=Dl(n.id),e[6]=n.id,e[7]=f):f=e[7];let p;e[8]!==f?(p=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=p):p=e[9];let x;e[10]!==u||e[11]!==p?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,p]}),e[10]=u,e[11]=p,e[12]=x):x=e[12];let m;return e[13]!==r||e[14]!==d||e[15]!==x?(m=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=m):m=e[16],m}function _s(t){const e=N.c(11),{itemId:n}=t,[s,i]=C.useState(!1);let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=r):r=e[0];const{connectionId:l}=oe(r),c=l??"no-connection",{org:a}=Y(),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=ee(u),p=Et(c,"WORKFLOW",n,f),x=Ot(c,"WORKFLOW",f);let m;e[4]!==x||e[5]!==n?(m=async b=>{i(!0),await x.update.mutateAsync({id:n,data:b}).finally(()=>{i(!1)})},e[4]=x,e[5]=n,e[6]=m):m=e[6];const h=m;let g;return e[7]!==s||e[8]!==p||e[9]!==h?(g={item:p,update:h,isUpdating:s},e[7]=s,e[8]=p,e[9]=h,e[10]=g):g=e[10],g}function Fl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=Z();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=Oe,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 p=JSON.parse(f);i({...n,...p}),s(p)},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 Vl(){const t=N.c(9),e=W(),{item:n}=re(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=C.useRef(l);let a;t[1]!==r?(a=h=>{if(!r)return Bl;const g=setInterval(()=>{c.current=Date.now(),h()},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,p=C.useSyncExternalStore(d,f,f),x=i&&s?Math.max(0,i-s):null;let m=null;if(s){let h;t[5]!==s?(h=new Date(s).getTime(),t[5]=s,t[6]=h):h=t[6];const g=h;if(i){let b;t[7]!==i?(b=new Date(i).getTime(),t[7]=i,t[8]=b):b=t[8],m=Math.max(0,b-g)}else r&&(m=Math.max(0,p-g))}return m??x}function Bl(){}function Ul(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 ql(){const t=N.c(20),{setTrackingExecutionId:e}=Z(),n=W(),s=Vl();let i;t[0]!==s?(i=s!=null?Ul(s):null,t[0]=s,t[1]=i):i=t[1];const r=i;let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(Zs,{className:"w-4 h-4 text-muted-foreground"})}),t[2]=l):l=t[2];let c;t[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[3]=c):c=t[3];let a;t[4]!==n?(a=o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[c,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]}),t[4]=n,t[5]=a):a=t[5];let d;t[6]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Ho,{className:"w-4 h-4 text-muted-foreground"}),t[6]=d):d=t[6];let u;t[7]!==r?(u=o.jsxs("div",{className:"flex items-center gap-1 ml-6",children:[d,o.jsx("span",{className:"text-sm text-muted-foreground",children:r})]}),t[7]=r,t[8]=u):u=t[8];let f;t[9]!==a||t[10]!==u?(f=o.jsxs("div",{className:"flex items-center h-full",children:[l,a,u]}),t[9]=a,t[10]=u,t[11]=f):f=t[11];let p;t[12]!==e?(p=()=>e(void 0),t[12]=e,t[13]=p):p=t[13];let x;t[14]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx($t,{className:"w-4 h-4 text-muted-foreground"}),t[14]=x):x=t[14];let m;t[15]!==p?(m=o.jsx(V,{variant:"ghost",size:"xs",onClick:p,children:x}),t[15]=p,t[16]=m):m=t[16];let h;return t[17]!==f||t[18]!==m?(h=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[f,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function Kl(t){const e=N.c(18),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c,isUpdating:a}=_s(r);let d;e[3]!==l?(d=JSON.stringify(l),e[3]=l,e[4]=d):d=e[4];const u=d;if(!l){let m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[5]=m):m=e[5];let h;return e[6]!==n?(h=o.jsx(Ee,{onBack:n,children:m}),e[6]=n,e[7]=h):h=e[7],h}let f;e[8]!==l?(f={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=f):f=e[9];let p;e[10]!==a||e[11]!==n||e[12]!==c?(p=o.jsx(Jl,{onBack:n,onUpdate:c,isUpdating:a}),e[10]=a,e[11]=n,e[12]=c,e[13]=p):p=e[13];let x;return e[14]!==u||e[15]!==f||e[16]!==p?(x=o.jsx(gr,{initialState:f,children:p},u),e[14]=u,e[15]=f,e[16]=p,e[17]=x):x=e[17],x}function Jl(t){const e=N.c(24),{onBack:n,onUpdate:s,isUpdating:i}=t,r=Re(),l=W(),{viewMode:c,showExecutionsList:a}=Xt(),d=He();let u;e[0]!==s||e[1]!==r?(u=async()=>{await s(r)},e[0]=s,e[1]=r,e[2]=u):u=e[2];const f=u,p=d&&"toolName"in d.action,x=p?d.action.toolName:null,m=p&&!x&&!l,h=!m&&(d||l||!a);let g;e[3]!==f||e[4]!==i||e[5]!==r.description||e[6]!==r.title?(g=o.jsx(Ri,{title:r.title,description:r.description,onSave:f,isSaving:i}),e[3]=f,e[4]=i,e[5]=r.description,e[6]=r.title,e[7]=g):g=e[7];let b;e[8]!==l?(b=l&&o.jsx(ql,{}),e[8]=l,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==h||e[13]!==m||e[14]!==c||e[15]!==r?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(Fl,{workflow:r,onUpdate:s}):o.jsxs(mo,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(rn,{defaultSize:50,minSize:30,children:o.jsx(Qi,{})}),o.jsx(po,{}),o.jsxs(rn,{defaultSize:50,minSize:25,children:[m&&o.jsx(tl,{className:"border-l border-border"}),a&&o.jsx(Wl,{}),h&&o.jsx(kl,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=h,e[13]=m,e[14]=c,e[15]=r,e[16]=j):j=e[16];let y;e[17]!==g||e[18]!==b||e[19]!==j?(y=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[g,b,j]}),e[17]=g,e[18]=b,e[19]=j,e[20]=y):y=e[20];let w;return e[21]!==n||e[22]!==y?(w=o.jsx(Ee,{onBack:n,children:y}),e[21]=n,e[22]=y,e[23]=w):w=e[23],w}function Gl(t){const e=N.c(3),{itemId:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{connectionId:i}=oe(s),l=Et(i??"no-connection","WORKFLOW_EXECUTION",n,i);let c;return e[1]!==l?(c={item:l},e[1]=l,e[2]=c):c=e[2],c}function Zl(t){const e=N.c(13),{onBack:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},e[0]=s):s=e[0];const{itemId:i}=oe(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=Gl(r);if(!l){let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Bt,{icon:o.jsx(zn,{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."})}),e[3]=u):u=e[3];let f;return e[4]!==n?(f=o.jsx(Ee,{onBack:n,children:u}),e[4]=n,e[5]=f):f=e[5],f}let c;e[6]!==l?(c=JSON.stringify(l,null,2),e[6]=l,e[7]=c):c=e[7];let a;e[8]!==c?(a=o.jsx("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:o.jsx(Oe,{height:"100%",code:c,language:"json",readOnly:!0})}),e[8]=c,e[9]=a):a=e[9];let d;return e[10]!==n||e[11]!==a?(d=o.jsx(Ee,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Xl={workflow:Kl,workflow_execution:Zl,prompt:Zo};function Ql(){const t=N.c(6),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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=Yl;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(or,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Yl(t){return Promise.resolve()}function ec(){const t=N.c(19),e=wn();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=n):n=t[0];const s=oe(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}=Y(),f=i??null;let p;t[3]!==u.id||t[4]!==f?(p={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=p):p=t[5];const x=ee(p),m=Ot(d,r,x);let h;t[6]!==m||t[7]!==l?(h=async S=>{l&&await m.update.mutateAsync({id:l,data:S})},t[6]=m,t[7]=l,t[8]=h):h=t[8];const g=h;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,y=j&&Xl[j];if(y){let S;return t[11]!==y||t[12]!==a||t[13]!==g||t[14]!==l?(S=o.jsx(y,{itemId:l,onBack:a,onUpdate:g}),t[11]=y,t[12]=a,t[13]=g,t[14]=l,t[15]=S):S=t[15],S}let w;t[16]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(Xs,{size:36,className:"text-muted-foreground"}),t[16]=w):w=t[16];let v;return t[17]!==a?(v=o.jsx(Bt,{icon:w,title:"No component defined",description:"No component for this collection was defined",buttonProps:{onClick:a,children:"Go back"}}),t[17]=a,t[18]=v):v=t[18],v}function tc(){const t=N.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/shell/$org/mcps/$connectionId/$collectionName/$itemId"},t[0]=e):e=t[0];const n=oe(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(Ql,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(ec,{}),t[2]=r):r=t[2],r}function ba(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Nn,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(ze,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(tc,{})})}),t[0]=e):e=t[0],e}export{ba as default};
|