@decocms/mesh 2.40.0 → 2.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/client/assets/{AlertCircle-BGhlDWk2.js → AlertCircle-BzWtrrJ5.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-DiPZV3an.js → ArrowLeft-DbjxH-TA.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-CxSqAFHI.js → ArrowUp-bzciqS-L.js} +1 -1
  4. package/dist/client/assets/{Check-fIeUq0Tl.js → Check-0BeRG3Sh.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-aJJ6RgWv.js → ChevronDown-DSaGHwzQ.js} +1 -1
  6. package/dist/client/assets/{Code01-Ckl-ddC5.js → Code01-B2alevwS.js} +1 -1
  7. package/dist/client/assets/{Copy01-CdhhOoSD.js → Copy01-CnmNi70D.js} +1 -1
  8. package/dist/client/assets/{CpuChip02-B5a9K48n.js → CpuChip02-wjDh7ig3.js} +1 -1
  9. package/dist/client/assets/{DotsHorizontal-gjRK9bmC.js → DotsHorizontal-DWjq5QvT.js} +1 -1
  10. package/dist/client/assets/{DotsVertical-1JZvMgtG.js → DotsVertical-kAKCLT6g.js} +1 -1
  11. package/dist/client/assets/{Download01-3VU6vngg.js → Download01-jhC_FqkW.js} +1 -1
  12. package/dist/client/assets/{Edit01-F53eAMKI.js → Edit01-Cw7nvLlE.js} +1 -1
  13. package/dist/client/assets/{File06-BpUf605-.js → File06-Di7-0Zhi.js} +1 -1
  14. package/dist/client/assets/{FilterLines-BM5N4VAM.js → FilterLines-B-fhbYYb.js} +1 -1
  15. package/dist/client/assets/{FlipBackward-__aw6tTy.js → FlipBackward-sWClYMgE.js} +1 -1
  16. package/dist/client/assets/{GitBranch01-CphPKbYc.js → GitBranch01-DgvnuUj6.js} +1 -1
  17. package/dist/client/assets/{Grid01-D89OcY09.js → Grid01-BV5dHi3R.js} +1 -1
  18. package/dist/client/assets/{Home02-CvY65VhH.js → Home02-D5m9YGJE.js} +1 -1
  19. package/dist/client/assets/{Image01-DlxjetON.js → Image01-Bidy-9ro.js} +1 -1
  20. package/dist/client/assets/{Inbox01-CxsccOrS.js → Inbox01-C7pMAXQN.js} +1 -1
  21. package/dist/client/assets/{InfoCircle-Bcvi8VQY.js → InfoCircle-BfdTTja1.js} +1 -1
  22. package/dist/client/assets/{Key01-BMhwGxr8.js → Key01-C8fGnb_s.js} +1 -1
  23. package/dist/client/assets/{LinkExternal01-BF9uACMs.js → LinkExternal01-l0m7CCNG.js} +1 -1
  24. package/dist/client/assets/{List-G-H7B3e1.js → List-B-KIt-jD.js} +1 -1
  25. package/dist/client/assets/{Loading01-BOeR2B8B.js → Loading01-BJHzsSlY.js} +1 -1
  26. package/dist/client/assets/{Lock01-Bxcblt1i.js → Lock01-Bchq9Nzc.js} +1 -1
  27. package/dist/client/assets/{Play-BmnNjAyT.js → Play-BfQSNVUe.js} +1 -1
  28. package/dist/client/assets/{Plus-CROcV2-u.js → Plus-DOEL_hbF.js} +1 -1
  29. package/dist/client/assets/{SearchMd-D74Sf-27.js → SearchMd-4iIwSESe.js} +1 -1
  30. package/dist/client/assets/{Terminal-DGXkCDiq.js → Terminal-BBj7QyID.js} +1 -1
  31. package/dist/client/assets/{Trash01-DHhhoDHD.js → Trash01-Wrvcbt0u.js} +1 -1
  32. package/dist/client/assets/{Upload01-C2CuGT1-.js → Upload01-OU5jPfJY.js} +1 -1
  33. package/dist/client/assets/{X-BAy7Mfyd.js → X-CgDprUQG.js} +1 -1
  34. package/dist/client/assets/{XClose-CE5BsdL1.js → XClose-BhLEWkEW.js} +1 -1
  35. package/dist/client/assets/{agent-detail-D2jPAyzE.js → agent-detail-BPiBnkF6.js} +1 -1
  36. package/dist/client/assets/{agents-BnJBjaH8.js → agents-VC4dO1xF.js} +1 -1
  37. package/dist/client/assets/{alert-dialog-DCgyNkDL.js → alert-dialog-BsUKy6x1.js} +1 -1
  38. package/dist/client/assets/{auth-catchall-CFWeOKHi.js → auth-catchall-BMt2K2Y3.js} +1 -1
  39. package/dist/client/assets/{avatar-DyhTRBi5.js → avatar-B2I6mHo7.js} +1 -1
  40. package/dist/client/assets/{badge-BfOFucuW.js → badge-Cg-cVOUM.js} +1 -1
  41. package/dist/client/assets/{binder-D14T3-AY.js → binder-DLTRuBUr.js} +1 -1
  42. package/dist/client/assets/{button-DMKajqX_.js → button-BJ3HWp7I.js} +1 -1
  43. package/dist/client/assets/{card-Cx64whKR.js → card-VfXRHGnT.js} +1 -1
  44. package/dist/client/assets/{checkbox-BCZJI_DJ.js → checkbox-Bd8ffR4d.js} +1 -1
  45. package/dist/client/assets/{circle-alert-CMl9VinB.js → circle-alert-Dns8Lwr3.js} +1 -1
  46. package/dist/client/assets/{collection-detail-p9qkl9qa.js → collection-detail-B7lj3q-_.js} +4 -4
  47. package/dist/client/assets/{collection-display-button-BVh1TgBj.js → collection-display-button-D900xq_7.js} +1 -1
  48. package/dist/client/assets/{collection-header-Dc5LPFVH.js → collection-header-BxJ-Ykas.js} +1 -1
  49. package/dist/client/assets/{collection-page-DGyQ3ZNG.js → collection-page-DgidS8rt.js} +1 -1
  50. package/dist/client/assets/{collection-search-Di76L1bf.js → collection-search-DITQLAqZ.js} +1 -1
  51. package/dist/client/assets/{collection-tab--167XVPq.js → collection-tab-DiAv1BlF.js} +1 -1
  52. package/dist/client/assets/{collection-table-wrapper-DHB_EgNT.js → collection-table-wrapper-CD2w-c2k.js} +1 -1
  53. package/dist/client/assets/{connect-CXcmZCG1.js → connect-DUorlCtw.js} +1 -1
  54. package/dist/client/assets/{connection-card-DQrk1HXS.js → connection-card-BOJTYC0z.js} +1 -1
  55. package/dist/client/assets/{connection-detail-nzhWhLWV.js → connection-detail-GNZd312l.js} +1 -1
  56. package/dist/client/assets/{connections-ByUZtUgd.js → connections-C-D02KTB.js} +1 -1
  57. package/dist/client/assets/{constants-fPyH6C9l.js → constants-BVdHh4aD.js} +1 -1
  58. package/dist/client/assets/constants-ao3kqMSk.js +1 -0
  59. package/dist/client/assets/{create-organization-dialog-D77RxEh5.js → create-organization-dialog-_CXtGha1.js} +1 -1
  60. package/dist/client/assets/{dialog-ztR7gCh9.js → dialog-DsV8m8rX.js} +1 -1
  61. package/dist/client/assets/{dropdown-menu-ClnDILPk.js → dropdown-menu-B1OcMuo7.js} +1 -1
  62. package/dist/client/assets/{dynamic-plugin-layout-A1dILRX9.js → dynamic-plugin-layout-BoThwu5u.js} +1 -1
  63. package/dist/client/assets/{empty-state-bLy612i3.js → empty-state-C1AOcdcD.js} +1 -1
  64. package/dist/client/assets/{empty-state-BnO7A9lc.js → empty-state-mW4i8Pk5.js} +1 -1
  65. package/dist/client/assets/{env-vars-editor-BcnJ-LB5.js → env-vars-editor-f0zQEaJU.js} +1 -1
  66. package/dist/client/assets/{error-boundary-BmoPYDr9.js → error-boundary-BhvmEiaO.js} +1 -1
  67. package/dist/client/assets/{extract-connection-data-BmKY6Xwr.js → extract-connection-data-DeAFFhRc.js} +1 -1
  68. package/dist/client/assets/{file-browser-qwFJR9E8.js → file-browser-Dva-Utu8.js} +2 -2
  69. package/dist/client/assets/{form-ndfdAtTI.js → form-D6hs_qye.js} +1 -1
  70. package/dist/client/assets/{grid-view-BvcNXtON.js → grid-view-CDYOgpOI.js} +1 -1
  71. package/dist/client/assets/{home-BuQVPeAU.js → home-CirnHaZG.js} +1 -1
  72. package/dist/client/assets/{index-Dtt3Ixsj.js → index-98urlcvX.js} +1 -1
  73. package/dist/client/assets/{index-DuakjG98.js → index-D9YoVuZK.js} +1 -1
  74. package/dist/client/assets/{index-B_JsA4Kj.js → index-DFxQb7a9.js} +1 -1
  75. package/dist/client/assets/{index-DZ0WP9Uu.js → index-DHBTmGle.js} +2 -2
  76. package/dist/client/assets/{index-CsefZjgp.js → index-RzZtkQ3Q.js} +1 -1
  77. package/dist/client/assets/{index-C2RcJiSR.js → index-g80C_Gec.js} +1 -1
  78. package/dist/client/assets/{infiniteQueryObserver-BbTATuuq.js → infiniteQueryObserver-8idXPZ5W.js} +1 -1
  79. package/dist/client/assets/{input-B0NJeiuT.js → input-7ruC6uFX.js} +1 -1
  80. package/dist/client/assets/{layout-DfJ4yUAY.js → layout-BNPUEoId.js} +1 -1
  81. package/dist/client/assets/{localstorage-keys-peJWGFoJ.js → localstorage-keys-D6bFEMDt.js} +1 -1
  82. package/dist/client/assets/{login-aZLO4ovp.js → login-CFf8-jXY.js} +1 -1
  83. package/dist/client/assets/{mcp-oauth-pM6hRYfR.js → mcp-oauth-BAnajqJL.js} +1 -1
  84. package/dist/client/assets/{mcp-server-card-DHzfT3Ej.js → mcp-server-card--rrCcr_f.js} +1 -1
  85. package/dist/client/assets/{mcp-server-detail-Bw5soC6_.js → mcp-server-detail-B7slX2RS.js} +2 -2
  86. package/dist/client/assets/{members-7Q8DX6Lb.js → members-cwfclVIm.js} +1 -1
  87. package/dist/client/assets/{monaco-editor-Dv9cb_Fm.js → monaco-editor-GHN1rtUS.js} +1 -1
  88. package/dist/client/assets/{monitoring-BC6v2u5z.js → monitoring-rKA5jDuf.js} +1 -1
  89. package/dist/client/assets/{oauth-callback-Cadz6rw5.js → oauth-callback-CLzmBEx9.js} +1 -1
  90. package/dist/client/assets/{page-BNxkmB8w.js → page-DnuspCox.js} +1 -1
  91. package/dist/client/assets/{page-tk64pthv.js → page-Z84D_p1f.js} +1 -1
  92. package/dist/client/assets/{pin-to-sidebar-button-Cgw1E6xL.js → pin-to-sidebar-button-B9E6PQjp.js} +1 -1
  93. package/dist/client/assets/{plugin-empty-state-BS367vfH.js → plugin-empty-state-BnQmqDTO.js} +1 -1
  94. package/dist/client/assets/{plugin-header-CUs1tx4q.js → plugin-header-C-T4sDQA.js} +1 -1
  95. package/dist/client/assets/{plugins-bBiQTZ8C.js → plugins-BnxfB2J2.js} +1 -1
  96. package/dist/client/assets/{popover-Bz6616No.js → popover-D7YWI5Cf.js} +1 -1
  97. package/dist/client/assets/{registry-utils-CpCQJuef.js → registry-utils-BCHz1L7j.js} +1 -1
  98. package/dist/client/assets/{resizable-DIm_hRMc.js → resizable-06VLRzXj.js} +1 -1
  99. package/dist/client/assets/{resource-tabs-cEMTKUzi.js → resource-tabs-loCNqUq6.js} +1 -1
  100. package/dist/client/assets/{select-2zWNvmE1.js → select-BWkItg_a.js} +1 -1
  101. package/dist/client/assets/{settings-BfF0KNyp.js → settings-DoehzXY3.js} +1 -1
  102. package/dist/client/assets/{shell-layout-hoToOJQP.js → shell-layout-sNHiL105.js} +1 -1
  103. package/dist/client/assets/{spinner-YcNewNcW.js → spinner-DEICAlhU.js} +1 -1
  104. package/dist/client/assets/{switch-C6NVbbW1.js → switch-C6DiRa1B.js} +1 -1
  105. package/dist/client/assets/{textarea-BE-RZN1V.js → textarea-vxMnbGid.js} +1 -1
  106. package/dist/client/assets/{tool-set-selector-CoFCawdz.js → tool-set-selector-CxTiwMI8.js} +1 -1
  107. package/dist/client/assets/{tools-list-DMgjdEKU.js → tools-list-taSvhPFS.js} +1 -1
  108. package/dist/client/assets/{tooltip-CzB50oKO.js → tooltip-BuUNB1mb.js} +1 -1
  109. package/dist/client/assets/{typewriter-title-BGVtH7qI.js → typewriter-title-C6DR7Eze.js} +1 -1
  110. package/dist/client/assets/{use-binding-BhZjQhNo.js → use-binding-C_F3xeC_.js} +1 -1
  111. package/dist/client/assets/{use-collections-Drr6_6fb.js → use-collections-CToBNrWq.js} +1 -1
  112. package/dist/client/assets/{use-connection-Bp7t1xn3.js → use-connection-DAX6ty9k.js} +1 -1
  113. package/dist/client/assets/{use-create-virtual-mcp-OU_v2YUB.js → use-create-virtual-mcp-te-5zxHj.js} +1 -1
  114. package/dist/client/assets/{use-list-state-Zs89S-QA.js → use-list-state-BOP_Nd4C.js} +1 -1
  115. package/dist/client/assets/{use-mcp-prompts-CSWg69Uu.js → use-mcp-prompts-D9dGnuXY.js} +1 -1
  116. package/dist/client/assets/{use-members-CjhBeBkC.js → use-members-D8gXijKr.js} +1 -1
  117. package/dist/client/assets/{use-mobile-BrgiFD7w.js → use-mobile-B7Yc-x5B.js} +1 -1
  118. package/dist/client/assets/{use-organization-settings-BCjNGEBN.js → use-organization-settings--qcz6AHX.js} +1 -1
  119. package/dist/client/assets/{use-virtual-mcp-DQzFD2uZ.js → use-virtual-mcp-CZvW7LdD.js} +1 -1
  120. package/dist/client/assets/useInfiniteQuery-C0JrAp_w.js +1 -0
  121. package/dist/client/assets/{useMutation-BSgCoYc_.js → useMutation-BL6IQ2sq.js} +1 -1
  122. package/dist/client/assets/useQuery-6rF_dd3c.js +1 -0
  123. package/dist/client/assets/{value-Cq0O3NJH.js → value-CXwf_TMX.js} +1 -1
  124. package/dist/client/assets/{view-mode-toggle-BrT5iiCv.js → view-mode-toggle-P81vIwwH.js} +1 -1
  125. package/dist/client/assets/{workflow-DiPsBlj7.js → workflow-B6WGA_r4.js} +1 -1
  126. package/dist/client/index.html +1 -1
  127. package/dist/server/cli.js +2 -2
  128. package/dist/server/migrate.js +2 -2
  129. package/dist/server/server.js +1 -1
  130. package/package.json +1 -1
  131. package/dist/client/assets/constants-BxAQzeE8.js +0 -1
  132. package/dist/client/assets/useInfiniteQuery-CZQ71w-T.js +0 -1
  133. package/dist/client/assets/useQuery-CpAu1eM3.js +0 -1
@@ -1,13 +1,13 @@
1
- import{bI as Y,r as C,o as ss,s as Ze,c as N,j as o,bg as at,u as Z,d as os,m as rs,a as se,g as is,a8 as Zt,bB as U,bJ as ls,ak as cs,ai as dt,aj as te,al as Qt,am as as,ae as ut,af as ds,an as Yt,ah as en,au as us,av as fs,aq as tn,aw as ms,bK as ft,bL as ps,ag as xs,bc as hs,b6 as gs,bM as bs,bq as nn}from"./index-DZ0WP9Uu.js";import{E as sn,I as ze,n as js}from"./empty-state-BnO7A9lc.js";import{E as on}from"./error-boundary-BmoPYDr9.js";import{a as mt,u as pt,f as xt,e as ht,d as gt}from"./use-collections-Drr6_6fb.js";import{u as Q}from"./constants-fPyH6C9l.js";import{P as bt}from"./pin-to-sidebar-button-Cgw1E6xL.js";import{B as q,c as O}from"./button-DMKajqX_.js";import{F as Qe,a as vs,b as jt,d as vt}from"./form-ndfdAtTI.js";import{I as yt}from"./input-B0NJeiuT.js";import{T as rt}from"./textarea-BE-RZN1V.js";import{T as oe,a as re,b as ie,c as le}from"./tooltip-CzB50oKO.js";import{i as rn}from"./FlipBackward-__aw6tTy.js";import{a as ln,V as wt,b as ve}from"./layout-DfJ4yUAY.js";import{i as ys}from"./AlertCircle-BGhlDWk2.js";import{s as ws,M as ye}from"./monaco-editor-Dv9cb_Fm.js";import{i as Ss}from"./Code01-Ckl-ddC5.js";import{a as Ns}from"./Copy01-CdhhOoSD.js";import{i as _e}from"./Loading01-BOeR2B8B.js";import{i as St,n as ks}from"./Play-BmnNjAyT.js";import{s as Nt}from"./XClose-CE5BsdL1.js";import{u as Cs,O as Is,M as _s,F as Ts,v as $s}from"./index-B_JsA4Kj.js";import{u as kt,b as Es}from"./use-connection-Bp7t1xn3.js";import{E as Ct}from"./empty-state-bLy612i3.js";import{D as Os,a as Rs}from"./use-binding-BhZjQhNo.js";import{b as cn}from"./use-virtual-mcp-DQzFD2uZ.js";import{b as Ms,R as Wt,a as As}from"./resizable-DIm_hRMc.js";import{d as Ps,b as Ls,a as zs,c as Ds,S as Ws}from"./select-2zWNvmE1.js";import{S as De}from"./spinner-YcNewNcW.js";import{V as Hs}from"./view-mode-toggle-BrT5iiCv.js";import{i as Vs}from"./GitBranch01-CphPKbYc.js";import{N as Fs,c as Bs,d as Us,e as qs,m as Oe,P as Ks,f as Js,R as Gs,g as Xs,h as Zs,j as Ht,E as Qs,k as Ys,l as eo,n as to,T as no,o as an}from"./index-Dtt3Ixsj.js";import{b as so,c as oo,d as ro,e as io,a as lo,D as co}from"./dialog-ztR7gCh9.js";import"./index-C2RcJiSR.js";import{s as dn}from"./Plus-CROcV2-u.js";import{i as It}from"./Check-fIeUq0Tl.js";import{i as ao}from"./DotsHorizontal-gjRK9bmC.js";import{D as uo,a as fo,b as mo,c as Vt}from"./dropdown-menu-ClnDILPk.js";import{i as po}from"./Grid01-D89OcY09.js";import{B as je}from"./badge-BfOFucuW.js";import{i as un}from"./X-BAy7Mfyd.js";import"./useMutation-BSgCoYc_.js";import"./useQuery-CpAu1eM3.js";import"./use-organization-settings-BCjNGEBN.js";import"./ArrowLeft-DiPZV3an.js";import"./infiniteQueryObserver-BbTATuuq.js";import"./mcp-oauth-pM6hRYfR.js";import"./env-vars-editor-BcnJ-LB5.js";import"./Trash01-DHhhoDHD.js";import"./File06-BpUf605-.js";import"./Key01-BMhwGxr8.js";import"./extract-connection-data-BmKY6Xwr.js";import"./constants-BxAQzeE8.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-CpCQJuef.js";import"./generate-id-Dyweu44Y.js";import"./CpuChip02-B5a9K48n.js";import"./Terminal-DGXkCDiq.js";import"./index-CsefZjgp.js";import"./circle-alert-CMl9VinB.js";import"./binder-D14T3-AY.js";import"./ChevronDown-aJJ6RgWv.js";import"./localstorage-keys-peJWGFoJ.js";import"./popover-Bz6616No.js";import"./Image01-DlxjetON.js";import"./SearchMd-D74Sf-27.js";import"./use-mcp-prompts-CSWg69Uu.js";import"./ArrowUp-CxSqAFHI.js";import"./Edit01-F53eAMKI.js";import"./use-create-virtual-mcp-OU_v2YUB.js";const fn=Y("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 mn=Y("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 _t=Y("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Tt=Y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const xo=Y("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const ho=Y("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 pn=Y("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 xn=Y("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 hn=Y("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 gn=Y("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 bn=Y("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"}]]),$t=({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"}));$t.displayName="AlertOctagon";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:"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"}));jn.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 yn=({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"}));yn.displayName="Code02";const Re=({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"}));Re.displayName="Columns01";const wn=({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"}));wn.displayName="CornerDownRight";const Sn=({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"}));Sn.displayName="Database01";const Nn=({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"}));Nn.displayName="Repeat03";const Et=({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"}));Et.displayName="Save02";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:"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"}));kn.displayName="Tool01";ss({title:Ze().min(1),description:Ze().nullable(),body:Ze()});function Ye(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function go(){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 bo(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(Qe,{control:n.control,name:"title",render:yo}),o.jsx(Qe,{control:n.control,name:"description",render:vo})]})]}),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(Qe,{control:n.control,name:"body",render:jo})]}),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(vs,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function jo(t){const{field:e}=t;return o.jsx(jt,{children:o.jsx(vt,{children:o.jsx(rt,{...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 vo(t){const{field:e}=t;return o.jsxs(jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(vt,{children:o.jsx(yt,{...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 yo(t){const{field:e}=t;return o.jsxs(jt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(vt,{children:o.jsx(yt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function wo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=at().location.href,{org:c}=Z(),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=Q(d),f=mt(n,"PROMPT",s,u),m=pt(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:Ye(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let g;e[5]!==p?(g={values:p},e[5]=p,e[6]=g):g=e[6];const h=os(g);let b;e[7]!==h||e[8]!==f?(b=()=>{f&&h.reset({title:f.title,description:f.description??null,body:Ye(f)})},e[7]=h,e[8]=f,e[9]=b):b=e[9];const j=b;let w;e[10]!==m.update||e[11]!==h||e[12]!==s?(w=h.handleSubmit(async B=>{const V=await m.update.mutateAsync({id:s,data:{title:B.title,description:B.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:B.body}}]}});h.reset({title:V.title,description:V.description??null,body:Ye(V)})}),e[10]=m.update,e[11]=h,e[12]=s,e[13]=w):w=e[13];const S=w;if(!f){let B;return e[14]===Symbol.for("react.memo_cache_sentinel")?(B=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]=B):B=e[14],B}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 y;e[17]!==f.description?(y=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]=y):y=e[18];let k;e[19]!==v||e[20]!==y?(k=o.jsx(ln,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,y]})}),e[19]=v,e[20]=y,e[21]=k):k=e[21];let _;e[22]!==f.title||e[23]!==l?(_=o.jsx(bt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=_):_=e[24];const $=!h.formState.isDirty||x;let P;e[25]===Symbol.for("react.memo_cache_sentinel")?(P=o.jsx(rn,{size:14}),e[25]=P):P=e[25];let R;e[26]!==j||e[27]!==$?(R=o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:$,onClick:j,"aria-label":"Cancel",children:P})})}),e[26]=j,e[27]=$,e[28]=R):R=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(re,{side:"bottom",children:"Cancel"}),e[29]=A):A=e[29];let M;e[30]!==R?(M=o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[R,A]})}),e[30]=R,e[31]=M):M=e[31];const H=!h.formState.isDirty||x;let L;e[32]!==S?(L=()=>{S()},e[32]=S,e[33]=L):L=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(Et,{size:14}),e[34]=D):D=e[34];let I;e[35]!==H||e[36]!==L?(I=o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:H,onClick:L,"aria-label":"Save",children:D})})}),e[35]=H,e[36]=L,e[37]=I):I=e[37];let T;e[38]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(re,{side:"bottom",children:"Save"}),e[38]=T):T=e[38];let E;e[39]!==I?(E=o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[I,T]})}),e[39]=I,e[40]=E):E=e[40];let W;e[41]!==_||e[42]!==M||e[43]!==E?(W=o.jsxs(wt,{children:[_,M,E]}),e[41]=_,e[42]=M,e[43]=E,e[44]=W):W=e[44];let K;e[45]!==h?(K=o.jsx("div",{className:"h-full",children:o.jsx(bo,{form:h})}),e[45]=h,e[46]=K):K=e[46];let F;return e[47]!==i||e[48]!==W||e[49]!==K||e[50]!==k?(F=o.jsxs(ve,{onBack:i,children:[k,W,K]}),e[47]=i,e[48]=W,e[49]=K,e[50]=k,e[51]=F):F=e[51],F}function So(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=go(),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(on,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(wo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const No=rs("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 ko(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(No({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 Co(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 Io(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 _o=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function To(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=Cs(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(Is,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(_s,{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($o,{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 $o({toolName:t,connectionId:e,onBack:n}){const i=at().location.href,{replayId:r}=is({strict:!1}),l=(()=>{if(!r)return null;const I=`replay-${r}`,T=sessionStorage.getItem(I);if(!T)return null;sessionStorage.removeItem(I);try{return JSON.parse(T)}catch{return null}})(),c=(()=>{if(!l)return null;const I={};for(const[T,E]of Object.entries(l))E!==null&&typeof E=="object"?I[T]=JSON.stringify(E,null,2):I[T]=E;return I})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,g]=C.useState(null),[h,b]=C.useState(!1),[j,w]=C.useState(null),{org:S}=Z(),v=kt(e),y=Q({connectionId:e,orgId:S.id}),k=xt({client:y}),_=k.data?.tools?.find(I=>I.name===t),$=_?.inputSchema?.properties,P=$?Object.keys($):[],R=P.length>0,A={};if(R&&_?.inputSchema?.properties)for(const I of P)A[I]=_.inputSchema.required?.includes(I)?"":void 0;const M=I=>Object.prototype.hasOwnProperty.call(a,I),H=async()=>{b(!0),g(null),x(null),w(null);const I=performance.now();try{if(!y)throw new Error("MCP client is not available");const T=R?{...A,...a}:(()=>{const z=u.trim();if(!z)return{};const G=JSON.parse(z);if(G&&typeof G=="object")return G;throw new Error("Raw JSON input must be an object.")})();R&&_?.inputSchema?.properties&&Object.entries(_.inputSchema.properties).forEach(([z,G])=>{if((G.type==="object"||G.type==="array")&&typeof T[z]=="string")try{T[z]=JSON.parse(T[z])}catch{}});const E=await y.callTool({name:t,arguments:T}),W=E.structuredContent??E,K=performance.now(),F=Math.round(K-I);x(W);const B=JSON.stringify(W),V=new TextEncoder().encode(B).length;w({duration:`${F}ms`,bytes:`${V} bytes`,tokens:`~${Math.ceil(V/4)} tokens`,cost:"$0.0000"})}catch(T){const E=T instanceof Error?T.message:String(T);g(E||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-I)}ms`})}finally{b(!1)}},L=(I,T)=>{d(E=>({...E,[I]:T}))},D=()=>{x(null),g(null),w(null)};return o.jsxs(ve,{onBack:n,children:[o.jsx(wt,{children:o.jsx(bt,{title:_?.name??_o(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(ze,{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(_e,{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:_?.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"}),_?.inputSchema?.required&&_.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&&_?.inputSchema?.properties?Object.entries(_.inputSchema.properties).map(([I,T])=>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(I)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:T.type})]}),T.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:T.description}),T.type==="object"||T.type==="array"?o.jsx(rt,{className:"font-mono text-xs",value:M(I)?a[I]??"":A[I]??"",onChange:E=>L(I,E.target.value),placeholder:`Enter ${I} as JSON...`,rows:3}):o.jsx(yt,{value:M(I)?a[I]??"":A[I]??"",onChange:E=>L(I,E.target.value),placeholder:`Enter ${I}...`})]},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(rt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:I=>f(I.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(ws,{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(jn,{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(Sn,{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(q,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:H,disabled:h,children:h?o.jsxs(o.Fragment,{children:[o.jsx(_e,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(St,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ie,{children:o.jsxs(le,{children:[o.jsx(oe,{asChild:!0,children:o.jsx(q,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:D,disabled:!m&&!p,children:o.jsx(Nt,{size:14})})}),o.jsx(re,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(ko,{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(Co,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Io,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(ye,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(q,{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(m,null,2)),Zt.success("Copied to clipboard")},children:o.jsx(Ns,{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(Ss,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function Eo(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=se(i).connectionId;if(!kt(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(_e,{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(To,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const Ft=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},Ot=(t=>t?Ft(t):Ft),Oo=t=>t;function it(t,e=Oo){const n=U.useSyncExternalStore(t.subscribe,U.useCallback(()=>e(t.getState()),[t,e]),U.useCallback(()=>e(t.getInitialState()),[t,e]));return U.useDebugValue(n),n}const Ro=t=>{const e=Ot(t),n=s=>it(e,s);return Object.assign(n,e),n},Mo=(t=>Ro);function Cn(t,e){let n;try{n=t()}catch{return}return{getItem:i=>{var r;const l=a=>a===null?null:JSON.parse(a,void 0),c=(r=n.getItem(i))!=null?r:null;return c instanceof Promise?c.then(l):l(c)},setItem:(i,r)=>n.setItem(i,JSON.stringify(r,void 0)),removeItem:i=>n.removeItem(i)}}const lt=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return lt(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return lt(s)(n)}}}},Ao=(t,e)=>(n,s,i)=>{let r={storage:Cn(()=>localStorage),partialize:h=>h,version:0,merge:(h,b)=>({...b,...h}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...h)},s,i);const f=()=>{const h=r.partialize({...s()});return u.setItem(r.name,{state:h,version:r.version})},m=i.setState;i.setState=(h,b)=>(m(h,b),f());const x=t((...h)=>(n(...h),f()),s,i);i.getInitialState=()=>x;let p;const g=()=>{var h,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:x)});const w=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(h=s())!=null?h:x))||void 0;return lt(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(y=>[!0,y]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[y,k]=S;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),y)return f()}).then(()=>{j===c&&(w?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&w?.(void 0,S)})};return i.persist={setOptions:h=>{r={...r,...h},h.storage&&(u=h.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>g(),hasHydrated:()=>l,onHydrate:h=>(a.add(h),()=>{a.delete(h)}),onFinishHydration:h=>(d.add(h),()=>{d.delete(h)})},r.skipHydration||g(),p||x},In=Ao,{useSyncExternalStoreWithSelector:Po}=ls,Lo=t=>t;function zo(t,e=Lo,n){const s=Po(t.subscribe,t.getState,t.getInitialState,e,n);return U.useDebugValue(s),s}const Bt=t=>Symbol.iterator in t,Ut=t=>"entries"in t,qt=(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},Do=(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 Wo(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:Bt(t)&&Bt(e)?Ut(t)&&Ut(e)?qt(t,e):Do(t,e):qt({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Ho(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 Y,r as C,o as cs,s as Ze,c as N,j as o,bg as dt,u as Z,d as as,m as ds,a as se,g as us,a8 as Qt,bB as U,bJ as fs,ak as ms,ai as ut,aj as te,al as Yt,am as ps,ae as ft,af as xs,an as en,ah as tn,au as hs,av as gs,aq as nn,aw as bs,bK as mt,bL as js,ag as vs,bc as ys,b6 as ws,bM as Ss,bq as sn}from"./index-DHBTmGle.js";import{E as on,I as ze,n as Ns}from"./empty-state-mW4i8Pk5.js";import{E as rn}from"./error-boundary-BhvmEiaO.js";import{a as pt,u as xt,f as ht,e as gt,d as bt}from"./use-collections-CToBNrWq.js";import{u as Q}from"./constants-BVdHh4aD.js";import{P as jt}from"./pin-to-sidebar-button-B9E6PQjp.js";import{B as q,c as O}from"./button-BJ3HWp7I.js";import{F as Qe,a as ks,b as vt,d as yt}from"./form-D6hs_qye.js";import{I as wt}from"./input-7ruC6uFX.js";import{T as rt}from"./textarea-vxMnbGid.js";import{T as oe,a as re,b as ie,c as le}from"./tooltip-BuUNB1mb.js";import{i as ln}from"./FlipBackward-sWClYMgE.js";import{a as cn,V as St,b as ve}from"./layout-BNPUEoId.js";import{S as an,a as dn,b as un,c as fn,d as it}from"./select-BWkItg_a.js";import{i as Cs}from"./AlertCircle-BzWtrrJ5.js";import{s as Is,M as ye}from"./monaco-editor-GHN1rtUS.js";import{i as _s}from"./Code01-B2alevwS.js";import{a as Ts}from"./Copy01-CnmNi70D.js";import{i as _e}from"./Loading01-BJHzsSlY.js";import{i as Nt,n as $s}from"./Play-BfQSNVUe.js";import{s as kt}from"./XClose-BhLEWkEW.js";import{u as Es,O as Os,M as Rs,F as Ms,v as As}from"./index-DFxQb7a9.js";import{u as Ct,b as Ps}from"./use-connection-DAX6ty9k.js";import{E as It}from"./empty-state-C1AOcdcD.js";import{D as Ls,a as zs}from"./use-binding-C_F3xeC_.js";import{b as mn}from"./use-virtual-mcp-CZvW7LdD.js";import{b as Ds,R as Ht,a as Ws}from"./resizable-06VLRzXj.js";import{S as De}from"./spinner-DEICAlhU.js";import{V as Hs}from"./view-mode-toggle-P81vIwwH.js";import{i as Vs}from"./GitBranch01-DgvnuUj6.js";import{N as Fs,c as Bs,d as Us,e as qs,m as Oe,P as Ks,f as Js,R as Gs,g as Xs,h as Zs,j as Vt,E as Qs,k as Ys,l as eo,n as to,T as no,o as pn}from"./index-98urlcvX.js";import{b as so,c as oo,d as ro,e as io,a as lo,D as co}from"./dialog-DsV8m8rX.js";import"./index-g80C_Gec.js";import{s as xn}from"./Plus-DOEL_hbF.js";import{i as _t}from"./Check-0BeRG3Sh.js";import{i as ao}from"./DotsHorizontal-DWjq5QvT.js";import{D as uo,a as fo,b as mo,c as Ft}from"./dropdown-menu-B1OcMuo7.js";import{i as po}from"./Grid01-BV5dHi3R.js";import{B as je}from"./badge-Cg-cVOUM.js";import{i as hn}from"./X-CgDprUQG.js";import"./useMutation-BL6IQ2sq.js";import"./useQuery-6rF_dd3c.js";import"./use-organization-settings--qcz6AHX.js";import"./ArrowLeft-DbjxH-TA.js";import"./ChevronDown-DSaGHwzQ.js";import"./infiniteQueryObserver-8idXPZ5W.js";import"./mcp-oauth-BAnajqJL.js";import"./env-vars-editor-f0zQEaJU.js";import"./Trash01-Wrvcbt0u.js";import"./File06-Di7-0Zhi.js";import"./Key01-C8fGnb_s.js";import"./extract-connection-data-DeAFFhRc.js";import"./constants-ao3kqMSk.js";import"./github-icon-Dp3wHhYE.js";import"./registry-utils-BCHz1L7j.js";import"./generate-id-Dyweu44Y.js";import"./CpuChip02-wjDh7ig3.js";import"./Terminal-BBj7QyID.js";import"./index-RzZtkQ3Q.js";import"./circle-alert-Dns8Lwr3.js";import"./binder-DLTRuBUr.js";import"./localstorage-keys-D6bFEMDt.js";import"./popover-D7YWI5Cf.js";import"./Image01-Bidy-9ro.js";import"./SearchMd-4iIwSESe.js";import"./use-mcp-prompts-D9dGnuXY.js";import"./ArrowUp-bzciqS-L.js";import"./Edit01-Cw7nvLlE.js";import"./use-create-virtual-mcp-te-5zxHj.js";const gn=Y("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 bn=Y("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 Tt=Y("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const $t=Y("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const xo=Y("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);const ho=Y("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 jn=Y("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 vn=Y("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 yn=Y("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=Y("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 Sn=Y("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"}]]),Et=({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"}));Et.displayName="AlertOctagon";const Nn=({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"}));Nn.displayName="Box";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:"m22.7 11.5-2 2-2-2m2.245 1.5A9 9 0 1 0 19 17.657M12 7v5l3 2"}));kn.displayName="ClockFastForward";const Cn=({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"}));Cn.displayName="Code02";const Re=({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"}));Re.displayName="Columns01";const In=({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"}));In.displayName="CornerDownRight";const _n=({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"}));_n.displayName="Database01";const Tn=({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"}));Tn.displayName="Repeat03";const Ot=({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"}));Ot.displayName="Save02";const $n=({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"}));$n.displayName="Tool01";cs({title:Ze().min(1),description:Ze().nullable(),body:Ze()});function Ye(t){for(const e of t.messages??[])if(e.role==="user"&&e.content?.type==="text")return e.content.text??"";return""}function go(){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 bo(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(Qe,{control:n.control,name:"title",render:yo}),o.jsx(Qe,{control:n.control,name:"description",render:vo})]})]}),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(Qe,{control:n.control,name:"body",render:jo})]}),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(ks,{...n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}function jo(t){const{field:e}=t;return o.jsx(vt,{children:o.jsx(yt,{children:o.jsx(rt,{...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 vo(t){const{field:e}=t;return o.jsxs(vt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Description"}),o.jsx(yt,{children:o.jsx(wt,{...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 yo(t){const{field:e}=t;return o.jsxs(vt,{children:[o.jsx("div",{className:"text-xs text-muted-foreground",children:"Title"}),o.jsx(yt,{children:o.jsx(wt,{...e,placeholder:"Untitled prompt",className:"h-9 rounded-lg border border-border bg-muted/20 shadow-none focus-visible:ring-0"})})]})}function wo(t){const e=N.c(52),{providerId:n,promptId:s,onBack:i}=t,l=dt().location.href,{org:c}=Z(),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=Q(d),f=pt(n,"PROMPT",s,u),m=xt(n,"PROMPT",u),x=m.update.isPending;let p;e[3]!==f?(p=f?{title:f.title,description:f.description??null,body:Ye(f)}:void 0,e[3]=f,e[4]=p):p=e[4];let g;e[5]!==p?(g={values:p},e[5]=p,e[6]=g):g=e[6];const h=as(g);let b;e[7]!==h||e[8]!==f?(b=()=>{f&&h.reset({title:f.title,description:f.description??null,body:Ye(f)})},e[7]=h,e[8]=f,e[9]=b):b=e[9];const j=b;let w;e[10]!==m.update||e[11]!==h||e[12]!==s?(w=h.handleSubmit(async B=>{const V=await m.update.mutateAsync({id:s,data:{title:B.title,description:B.description,arguments:[],icons:[],messages:[{role:"user",content:{type:"text",text:B.body}}]}});h.reset({title:V.title,description:V.description??null,body:Ye(V)})}),e[10]=m.update,e[11]=h,e[12]=s,e[13]=w):w=e[13];const S=w;if(!f){let B;return e[14]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(on,{title:"Prompt not found",description:"This prompt may have been deleted or you may not have access to it."})}),e[14]=B):B=e[14],B}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 y;e[17]!==f.description?(y=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]=y):y=e[18];let k;e[19]!==v||e[20]!==y?(k=o.jsx(cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v,y]})}),e[19]=v,e[20]=y,e[21]=k):k=e[21];let _;e[22]!==f.title||e[23]!==l?(_=o.jsx(jt,{title:f.title,url:l,icon:"description"}),e[22]=f.title,e[23]=l,e[24]=_):_=e[24];const $=!h.formState.isDirty||x;let L;e[25]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ln,{size:14}),e[25]=L):L=e[25];let R;e[26]!==j||e[27]!==$?(R=o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:$,onClick:j,"aria-label":"Cancel",children:L})})}),e[26]=j,e[27]=$,e[28]=R):R=e[28];let A;e[29]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(re,{side:"bottom",children:"Cancel"}),e[29]=A):A=e[29];let M;e[30]!==R?(M=o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[R,A]})}),e[30]=R,e[31]=M):M=e[31];const H=!h.formState.isDirty||x;let P;e[32]!==S?(P=()=>{S()},e[32]=S,e[33]=P):P=e[33];let D;e[34]===Symbol.for("react.memo_cache_sentinel")?(D=o.jsx(Ot,{size:14}),e[34]=D):D=e[34];let I;e[35]!==H||e[36]!==P?(I=o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",disabled:H,onClick:P,"aria-label":"Save",children:D})})}),e[35]=H,e[36]=P,e[37]=I):I=e[37];let T;e[38]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(re,{side:"bottom",children:"Save"}),e[38]=T):T=e[38];let E;e[39]!==I?(E=o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[I,T]})}),e[39]=I,e[40]=E):E=e[40];let W;e[41]!==_||e[42]!==M||e[43]!==E?(W=o.jsxs(St,{children:[_,M,E]}),e[41]=_,e[42]=M,e[43]=E,e[44]=W):W=e[44];let K;e[45]!==h?(K=o.jsx("div",{className:"h-full",children:o.jsx(bo,{form:h})}),e[45]=h,e[46]=K):K=e[46];let F;return e[47]!==i||e[48]!==W||e[49]!==K||e[50]!==k?(F=o.jsxs(ve,{onBack:i,children:[k,W,K]}),e[47]=i,e[48]=W,e[49]=K,e[50]=k,e[51]=F):F=e[51],F}function So(t){const e=N.c(5),{itemId:n,onBack:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=go(),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(on,{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(rn,{children:o.jsx(C.Suspense,{fallback:null,children:o.jsx(wo,{providerId:r,promptId:n,onBack:s})})}),e[2]=n,e[3]=s,e[4]=l):l=e[4],l}const No=ds("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 ko(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(No({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 Co(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 Io(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 _o=t=>t.replace(/_/g," ").replace(/\b\w/g,e=>e.toLocaleLowerCase());function To(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=Es(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(Os,{onAuthenticate:()=>i(),buttonText:"Go back to authenticate"}):o.jsx(Rs,{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($o,{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 $o({toolName:t,connectionId:e,onBack:n}){const i=dt().location.href,{replayId:r}=us({strict:!1}),l=(()=>{if(!r)return null;const I=`replay-${r}`,T=sessionStorage.getItem(I);if(!T)return null;sessionStorage.removeItem(I);try{return JSON.parse(T)}catch{return null}})(),c=(()=>{if(!l)return null;const I={};for(const[T,E]of Object.entries(l))E!==null&&typeof E=="object"?I[T]=JSON.stringify(E,null,2):I[T]=E;return I})(),[a,d]=C.useState(c??{}),[u,f]=C.useState(l?JSON.stringify(l,null,2):"{}"),[m,x]=C.useState(null),[p,g]=C.useState(null),[h,b]=C.useState(!1),[j,w]=C.useState(null),{org:S}=Z(),v=Ct(e),y=Q({connectionId:e,orgId:S.id}),k=ht({client:y}),_=k.data?.tools?.find(I=>I.name===t),$=_?.inputSchema?.properties,L=$?Object.keys($):[],R=L.length>0,A={};if(R&&_?.inputSchema?.properties)for(const I of L)A[I]=_.inputSchema.required?.includes(I)?"":void 0;const M=I=>Object.prototype.hasOwnProperty.call(a,I),H=async()=>{b(!0),g(null),x(null),w(null);const I=performance.now();try{if(!y)throw new Error("MCP client is not available");const T=R?{...A,...a}:(()=>{const z=u.trim();if(!z)return{};const G=JSON.parse(z);if(G&&typeof G=="object")return G;throw new Error("Raw JSON input must be an object.")})();R&&_?.inputSchema?.properties&&Object.entries(_.inputSchema.properties).forEach(([z,G])=>{if((G.type==="object"||G.type==="array")&&typeof T[z]=="string")try{T[z]=JSON.parse(T[z])}catch{}});const E=await y.callTool({name:t,arguments:T}),W=E.structuredContent??E,K=performance.now(),F=Math.round(K-I);x(W);const B=JSON.stringify(W),V=new TextEncoder().encode(B).length;w({duration:`${F}ms`,bytes:`${V} bytes`,tokens:`~${Math.ceil(V/4)} tokens`,cost:"$0.0000"})}catch(T){const E=T instanceof Error?T.message:String(T);g(E||"Unknown error occurred");const W=performance.now();w({duration:`${Math.round(W-I)}ms`})}finally{b(!1)}},P=(I,T)=>{d(E=>({...E,[I]:T}))},D=()=>{x(null),g(null),w(null)};return o.jsxs(ve,{onBack:n,children:[o.jsx(St,{children:o.jsx(jt,{title:_?.name??_o(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(ze,{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(_e,{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:_?.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"}),_?.inputSchema?.required&&_.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&&_?.inputSchema?.properties?Object.entries(_.inputSchema.properties).map(([I,T])=>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(I)&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"})]}),o.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:T.type})]}),T.description&&o.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:T.description}),T.type==="object"||T.type==="array"?o.jsx(rt,{className:"font-mono text-xs",value:M(I)?a[I]??"":A[I]??"",onChange:E=>P(I,E.target.value),placeholder:`Enter ${I} as JSON...`,rows:3}):T.type==="boolean"?o.jsxs(an,{value:M(I)?String(a[I]??""):"",onValueChange:E=>P(I,E==="true"),children:[o.jsx(dn,{children:o.jsx(un,{placeholder:"Select true or false..."})}),o.jsxs(fn,{children:[o.jsx(it,{value:"true",children:"true"}),o.jsx(it,{value:"false",children:"false"})]})]}):o.jsx(wt,{value:M(I)?a[I]??"":A[I]??"",onChange:E=>P(I,E.target.value),placeholder:`Enter ${I}...`})]},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(rt,{className:"font-mono text-xs min-h-[120px]",value:u,onChange:I=>f(I.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(Is,{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(Nn,{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(_n,{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(q,{size:"sm",variant:"default",className:"h-8 gap-2 flex-1 lg:flex-none",onClick:H,disabled:h,children:h?o.jsxs(o.Fragment,{children:[o.jsx(_e,{size:14,className:"animate-spin"}),"Executing..."]}):o.jsxs(o.Fragment,{children:[o.jsx(Nt,{className:"h-3.5 w-3.5 fill-current"}),"Execute Tool"]})}),o.jsx(ie,{children:o.jsxs(le,{children:[o.jsx(oe,{asChild:!0,children:o.jsx(q,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:D,disabled:!m&&!p,children:o.jsx(kt,{size:14})})}),o.jsx(re,{children:o.jsx("p",{children:"Clear results"})})]})})]})}),p&&o.jsx("div",{className:"px-6 py-4 bg-background",children:o.jsx(ko,{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(Cs,{className:"h-4 w-4"}),o.jsx(Co,{className:"mb-0",children:"Execution Failed"})]}),o.jsx(Io,{className:"text-xs text-destructive",children:p})]})})}),o.jsx("div",{className:"relative flex-1 overflow-auto bg-muted/50",children:m?o.jsxs(o.Fragment,{children:[o.jsx(ye,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}),o.jsx(q,{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(m,null,2)),Qt.success("Copied to clipboard")},children:o.jsx(Ts,{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(_s,{className:"h-12 w-12 mb-3 opacity-40"}),o.jsx("p",{className:"text-sm",children:"Run the tool to see results"})]})})]})]})]})}function Eo(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=se(i).connectionId;if(!Ct(l)||!l){let u;return e[1]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsxs("div",{className:"flex flex-col items-center gap-2 text-center",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"Connection not found"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"This connection may have been deleted or you may not have access."})]})}),e[1]=u):u=e[1],u}let a;e[2]===Symbol.for("react.memo_cache_sentinel")?(a=o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(_e,{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(To,{toolName:n,connectionId:l,onBack:s})}),e[3]=l,e[4]=s,e[5]=n,e[6]=d):d=e[6],d}const Bt=t=>{let e;const n=new Set,s=(d,u)=>{const f=typeof d=="function"?d(e):d;if(!Object.is(f,e)){const m=e;e=u??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(x=>x(e,m))}},i=()=>e,c={setState:s,getState:i,getInitialState:()=>a,subscribe:d=>(n.add(d),()=>n.delete(d))},a=e=t(s,i,c);return c},Rt=(t=>t?Bt(t):Bt),Oo=t=>t;function lt(t,e=Oo){const n=U.useSyncExternalStore(t.subscribe,U.useCallback(()=>e(t.getState()),[t,e]),U.useCallback(()=>e(t.getInitialState()),[t,e]));return U.useDebugValue(n),n}const Ro=t=>{const e=Rt(t),n=s=>lt(e,s);return Object.assign(n,e),n},Mo=(t=>Ro);function En(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 ct=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return ct(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return ct(s)(n)}}}},Ao=(t,e)=>(n,s,i)=>{let r={storage:En(()=>localStorage),partialize:h=>h,version:0,merge:(h,b)=>({...b,...h}),...e},l=!1,c=0;const a=new Set,d=new Set;let u=r.storage;if(!u)return t((...h)=>{console.warn(`[zustand persist middleware] Unable to update item '${r.name}', the given storage is currently unavailable.`),n(...h)},s,i);const f=()=>{const h=r.partialize({...s()});return u.setItem(r.name,{state:h,version:r.version})},m=i.setState;i.setState=(h,b)=>(m(h,b),f());const x=t((...h)=>(n(...h),f()),s,i);i.getInitialState=()=>x;let p;const g=()=>{var h,b;if(!u)return;const j=++c;l=!1,a.forEach(S=>{var v;return S((v=s())!=null?v:x)});const w=((b=r.onRehydrateStorage)==null?void 0:b.call(r,(h=s())!=null?h:x))||void 0;return ct(u.getItem.bind(u))(r.name).then(S=>{if(S)if(typeof S.version=="number"&&S.version!==r.version){if(r.migrate){const v=r.migrate(S.state,S.version);return v instanceof Promise?v.then(y=>[!0,y]):[!0,v]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,S.state];return[!1,void 0]}).then(S=>{var v;if(j!==c)return;const[y,k]=S;if(p=r.merge(k,(v=s())!=null?v:x),n(p,!0),y)return f()}).then(()=>{j===c&&(w?.(p,void 0),p=s(),l=!0,d.forEach(S=>S(p)))}).catch(S=>{j===c&&w?.(void 0,S)})};return i.persist={setOptions:h=>{r={...r,...h},h.storage&&(u=h.storage)},clearStorage:()=>{u?.removeItem(r.name)},getOptions:()=>r,rehydrate:()=>g(),hasHydrated:()=>l,onHydrate:h=>(a.add(h),()=>{a.delete(h)}),onFinishHydration:h=>(d.add(h),()=>{d.delete(h)})},r.skipHydration||g(),p||x},On=Ao,{useSyncExternalStoreWithSelector:Po}=fs,Lo=t=>t;function zo(t,e=Lo,n){const s=Po(t.subscribe,t.getState,t.getInitialState,e,n);return U.useDebugValue(s),s}const Ut=t=>Symbol.iterator in t,qt=t=>"entries"in t,Kt=(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},Do=(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 Wo(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:Ut(t)&&Ut(e)?qt(t)&&qt(e)?Kt(t,e):Do(t,e):Kt({entries:()=>Object.entries(t)},{entries:()=>Object.entries(e)})}function Ho(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 et(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 Vo(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 tt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...Os,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const _n=C.createContext(null),Fo=t=>Ot()(In(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??tt(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:et(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.localWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(x=>x.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=tt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Ho(a,"Input"),m=d.action,x=Vo(m.code,f);d={...d,action:{...m,code:x}}}const u=et(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=tt("tool",Number((Math.random()*1e6).toFixed(0)));const i=et(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setOriginalWorkflow:n=>e(s=>({...s,localWorkflow:n})),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:Cn(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,localWorkflow:e.localWorkflow,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Bo(t){const e=N.c(8),{children:n,initialState:s}=t,i=cn();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>Fo({workflow:s.workflow,localWorkflow: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(_n.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(_n);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return zo(n,t,Wo)}function Se(){return we(Uo)}function Uo(t){return t.workflow}function X(){return we(qo)}function qo(t){return t.actions}function Tn(){const t=$e();return we(Ko)??t[0]?.name}function Ko(t){return t.currentStepName}function Te(){const t=N.c(5),e=Tn(),n=$e();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 $e(){return Se().steps}function $n(){const t=N.c(8),e=Se(),n=we(Xo);let s,i;if(t[0]!==n.description||t[1]!==n.steps||t[2]!==n.title||t[3]!==e.description||t[4]!==e.steps||t[5]!==e.title){const r={title:e.title,description:e.description,steps:e.steps.map(Go)},l={title:n.title,description:n.description,steps:n.steps.map(Jo)};s=JSON.stringify(r),i=JSON.stringify(l),t[0]=n.description,t[1]=n.steps,t[2]=n.title,t[3]=e.description,t[4]=e.steps,t[5]=e.title,t[6]=s,t[7]=i}else s=t[6],i=t[7];return s!==i}function Jo(t){return{...t,outputSchema:void 0}}function Go(t){return{...t,outputSchema:void 0}}function Xo(t){return t.localWorkflow}function J(){return we(Zo)}function Zo(t){return t.trackingExecutionId}function Ne(){return we(Qo)}function Qo(t){return t.selectedVirtualMcpId}function Yo(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=cn()??[],a=n??void 0;let d;e[0]!==s?(d=h=>s(h===""?void 0:h),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(Ls,{placeholder:l}),e[4]=l,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==f?(m=o.jsx(zs,{size:"sm",className:u,children:f}),e[6]=u,e[7]=f,e[8]=m):m=e[8];let x;e[9]!==c?(x=c.map(er),e[9]=c,e[10]=x):x=e[10];let p;e[11]!==x?(p=o.jsx(Ds,{children:x}),e[11]=x,e[12]=p):p=e[12];let g;return e[13]!==a||e[14]!==d||e[15]!==m||e[16]!==p?(g=o.jsxs(Ws,{value:a,onValueChange:d,children:[m,p]}),e[13]=a,e[14]=d,e[15]=m,e[16]=p,e[17]=g):g=e[17],g}function er(t){return o.jsx(Ps,{value:t.id,children:t.title},t.id)}function ke(){const t=N.c(2),e=Es();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=Rs(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const Kt=[100,1e3,2e3];function Ce(t){const e=N.c(15),{org:n}=Z(),s=ke(),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=Q(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?g=>{const b=g.state?.data?.item?.status;if(b==="running"||b==="enqueued"){const j=Kt[i.current]??1;return i.current=(i.current+1)%Kt.length,j}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,staleTime:0,gcTime:0,enabled:a,select:tr,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:m}=ht(u),x=f?.item;let p;return e[12]!==m||e[13]!==x?(p={item:x,isLoading:m},e[12]=m,e[13]=x,e[14]=p):p=e[14],p}function tr(t){return t.structuredContent??t}function nr(t,e){const n=N.c(14),{org:s}=Z(),i=ke();let r;n[0]!==i.id||n[1]!==s.id?(r={connectionId:i.id,orgId:s.id},n[0]=i.id,n[1]=s.id,n[2]=r):r=n[2];const l=Q(r);let c;n[3]!==t||n[4]!==e?(c={executionId:t,stepId:e},n[3]=t,n[4]=e,n[5]=c):c=n[5];const a=!!t&&!!e;let d;n[6]!==l||n[7]!==c||n[8]!==a?(d={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:c,enabled:a,select:sr},n[6]=l,n[7]=c,n[8]=a,n[9]=d):d=n[9];const{data:u,isLoading:f}=ht(d),m=u?.output,x=u?.error;let p;return n[10]!==f||n[11]!==m||n[12]!==x?(p={output:m,error:x,isLoading:f},n[10]=f,n[11]=m,n[12]=x,n[13]=p):p=n[13],p}function sr(t){return t.structuredContent??t}function or(){const t=N.c(19),{org:e}=Z(),n=ke(),s=Se();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=Q(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:rr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=ht(f);let g;t[13]!==m?.items?(g=m?.items??[],t[13]=m?.items,t[14]=g):g=t[14];let h;return t[15]!==x||t[16]!==p||t[17]!==g?(h={executions:g,isLoading:x,refetch:p},t[15]=x,t[16]=p,t[17]=g,t[18]=h):h=t[18],h}function rr(t){return t.structuredContent??t}function En(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 ir(t){const e=[];for(const n of t){const s=En(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function lr(t){for(const e of t)if(En(e.input).includes("__entire_input__"))return!0;return!1}function cr(t){const e=ir(t);if(e.length===0)return lr(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 ar(){const t=N.c(2),e=Se();let n;return t[0]!==e.steps?(n=cr(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function dr(){const t=N.c(15),{org:e}=Z(),{id:n}=ke(),{setTrackingExecutionId:s}=X(),i=Se(),r=Ne(),l=ar();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=Q(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=gt(d);let m;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(m=async h=>{const b=h===void 0?{}:h;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),w=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=(w.structuredContent??w)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=m):m=t[9];const x=m,p=l!==null;let g;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==p?(g={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=p,t[14]=g):g=t[14],g}function ur(){const t=N.c(10),{org:e}=Z(),{id:n}=ke();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=Q(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=gt(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 fr(){const t=N.c(10),{org:e}=Z(),{id:n}=ke();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=Q(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=gt(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function mr(){const t=N.c(3),e=J(),{item:n}=Ce(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 pr(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 Rt=Mo()(In(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"})),On=C.createContext([]);function Rn(){return C.useContext(On)}function xr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Ks;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 Mn(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>xr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Jt(t,e){const n=Mn(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var hr=Fs.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",Oe(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=Jt(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Oe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Oe({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Oe({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...qs({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:Jt(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 Us,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 Mn(this).map(Bs)}}),gr=hr,nt,We="HoverCard",[An]=tn(We,[Yt]),He=Yt(),[br,Ve]=An(We),Pn=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=He(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),m=C.useRef(!1),[x,p]=ut({prop:s,defaultProp:i??!1,onChange:r,caller:We}),g=C.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),h=C.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=C.useCallback(()=>p(!1),[p]);return C.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(br,{scope:e,open:x,onOpenChange:p,onOpen:g,onClose:h,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(ds,{...a,children:n})})};Pn.displayName=We;var Ln="HoverCardTrigger",zn=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=Ve(Ln,n),r=He(n);return o.jsx(cs,{asChild:!0,...r,children:o.jsx(dt.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:te(t.onPointerEnter,Pe(i.onOpen)),onPointerLeave:te(t.onPointerLeave,Pe(i.onClose)),onFocus:te(t.onFocus,i.onOpen),onBlur:te(t.onBlur,i.onClose),onTouchStart:te(t.onTouchStart,l=>l.preventDefault())})})});zn.displayName=Ln;var Mt="HoverCardPortal",[jr,vr]=An(Mt,{forceMount:void 0}),Dn=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=Ve(Mt,e);return o.jsx(jr,{scope:e,forceMount:n,children:o.jsx(Qt,{present:n||r.open,children:o.jsx(as,{asChild:!0,container:i,children:s})})})};Dn.displayName=Mt;var Ae="HoverCardContent",Wn=C.forwardRef((t,e)=>{const n=vr(Ae,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=Ve(Ae,t.__scopeHoverCard);return o.jsx(Qt,{present:s||r.open,children:o.jsx(yr,{"data-state":r.open?"open":"closed",...i,onPointerEnter:te(t.onPointerEnter,Pe(r.onOpen)),onPointerLeave:te(t.onPointerLeave,Pe(r.onClose)),ref:e})})});Wn.displayName=Ae;var yr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=Ve(Ae,n),d=He(n),u=C.useRef(null),f=en(e,u),[m,x]=C.useState(!1);return C.useEffect(()=>{if(m){const p=document.body;return nt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=nt,p.style.webkitUserSelect=nt}}},[m]),C.useEffect(()=>{if(u.current){const p=()=>{x(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),C.useEffect(()=>{u.current&&Nr(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),o.jsx(us,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:te(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(fs,{...d,...c,onPointerDown:te(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&x(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),wr="HoverCardArrow",Sr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=He(n);return o.jsx(ms,{...i,...s,ref:e})});Sr.displayName=wr;function Pe(t){return e=>e.pointerType==="touch"?void 0:t()}function Nr(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 kr=Pn,Cr=zn,Ir=Dn,_r=Wn;function Tr(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(kr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function $r(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(Cr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Er(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(Ir,{"data-slot":"hover-card-portal",children:o.jsx(_r,{"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 Hn=C.createContext(void 0);function Or(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 Rr(t){const e=N.c(20),{node:n}=t,s=C.useContext(Hn),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const g=r?Or(s,i):void 0;l=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):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 g;return e[6]!==d?(g=o.jsx(Ht,{as:"span",children:d}),e[6]=d,e[7]=g):g=e[7],g}let u;e[8]!==d?(u=o.jsx($r,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let x;e[14]!==f||e[15]!==m?(x=o.jsx(Er,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(Ht,{as:"span",children:o.jsxs(Tr,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,e[19]=p):p=e[19],p}function Vn(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 ne=Fn();function Fn(){return Ot(()=>({items:[],selectedIndex:0,command:null}))}function Gt(t,e){ne.setState({items:t,command:e,selectedIndex:0})}function Mr(){const{items:t,selectedIndex:e}=ne.getState();t.length&&ne.setState({selectedIndex:(e-1+t.length)%t.length})}function Ar(){const{items:t,selectedIndex:e}=ne.getState();t.length&&ne.setState({selectedIndex:(e+1)%t.length})}function Bn(){const{items:t,selectedIndex:e,command:n}=ne.getState(),s=t[e];return s?(n?.(s),!0):!1}function Xt(){ne=Fn()}function Pr(){const t=N.c(7),e=it(ne,zr),n=it(ne,Lr);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:()=>{ne.setState({selectedIndex:c}),Bn()},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 Lr(t){return t.selectedIndex}function zr(t){return t.items}function Dr(){let t=null,e=null;return{onStart:n=>{Gt(n.items,n.command),t=new Zs(Pr,{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=>{Gt(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(),Xt(),!0):n.key==="ArrowUp"?(Mr(),!0):n.key==="ArrowDown"?(Ar(),!0):n.key==="Enter"?Bn():!1,onExit:()=>{e?.remove(),t?.destroy(),Xt()}}}const st=/@([\w.]+)/g;function Wr(t,e){if(!t)return null;const n=Vn(e),s=new Map(n.map(a=>[a.id,a]));if(!st.test(t))return t;st.lastIndex=0;const r=[];let l=0,c;for(;(c=st.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 At(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=mr();let d;e[0]!==n||e[1]!==s?(d=Wr(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=Js.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let p;if(e[4]!==n||e[5]!==f){let $;e[7]!==n?($=P=>{const{query:R}=P;return Vn(n).filter(M=>M.label.toLowerCase().includes(R.toLowerCase())||M.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=$):$=e[8],p=gr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Br,renderHTML:Fr,suggestion:{items:$,render:Dr,command:Vr}}).extend(f?{addNodeView(){return Gs(Rr)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[x,p],e[9]=p,e[10]=g):g=e[10];const h=r??"";let b;e[11]!==h?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":h},handleKeyDown:Hr},e[11]=h,e[12]=b):b=e[12];let j;e[13]!==i?(j=$=>{const{editor:P}=$;return i?.(P.getText().trim())},e[13]=i,e[14]=j):j=e[14];let w;e[15]!==u||e[16]!==m||e[17]!==g||e[18]!==b||e[19]!==j?(w={content:u,editable:m,extensions:g,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=g,e[18]=b,e[19]=j,e[20]=w):w=e[20];const S=Xs(w);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 y;e[23]!==S?(y=o.jsx(Qs,{editor:S}),e[23]=S,e[24]=y):y=e[24];let k;e[25]!==v||e[26]!==y?(k=o.jsx("div",{className:v,children:y}),e[25]=v,e[26]=y,e[27]=k):k=e[27];const _=k;if(a!==void 0){let $;return e[28]!==_||e[29]!==a?($=o.jsx(Hn.Provider,{value:a,children:_}),e[28]=_,e[29]=a,e[30]=$):$=e[30],$}return _}function Hr(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Vr(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Fr(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Br(t){const{node:e}=t;return`@${e.attrs.id}`}function Ur(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Rn(),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(At,{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 qr(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=Rn(),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(At,{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 Kr(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 Jr(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=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Gr(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=g=>s(g.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;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"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let x;e[6]!==a?(x=a.map(Xr),e[6]=a,e[7]=x):x=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=p):p=e[13],p}function Xr(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Zr={TextWidget:Ur,TextareaWidget:qr,NumberWidget:Kr,CheckboxWidget:Jr,SelectWidget:Gr};function Qr(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:bn,color:"text-blue-500"};case"number":case"integer":return{Icon:hn,color:"text-blue-500"};case"array":return{Icon:mn,color:"text-purple-500"};case"object":return{Icon:fn,color:"text-orange-500"};case"boolean":return{Icon:gn,color:"text-pink-500"};case"null":return{Icon:ft,color:"text-gray-500"};default:return{Icon:pn,color:"text-muted-foreground"}}}function Yr(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,m,x,p,g,h;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:y}=Qr(d);h="space-y-2",x="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(g=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=g):g=e[19],u=v,f=14,m=O(y,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=x,e[12]=p,e[13]=g,e[14]=h}else u=e[8],f=e[9],m=e[10],x=e[11],p=e[12],g=e[13],h=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==x||e[25]!==p||e[26]!==g||e[27]!==b?(j=o.jsxs("div",{className:x,children:[p,g,b]}),e[24]=x,e[25]=p,e[26]=g,e[27]=b,e[28]=j):j=e[28];let w;e[29]!==r?(w=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=w):w=e[30];let S;return e[31]!==l||e[32]!==h||e[33]!==j||e[34]!==w?(S=o.jsxs("div",{className:h,children:[j,w,l]}),e[31]=l,e[32]=h,e[33]=j,e[34]=w,e[35]=S):S=e[35],S}function ei(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(ni),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(ti),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 ti(t){return o.jsx("div",{children:t.content},t.name)}function ni(t){return o.jsx("div",{children:t.content},t.name)}function si(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(oi),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(q,{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 oi(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 ri(){return null}function ii(){return null}const li={FieldTemplate:Yr,ObjectFieldTemplate:ei,ArrayFieldTemplate:si,UnsupportedFieldTemplate:ri,ErrorListTemplate:ii};function ci(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??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(At,{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 Un({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(ci,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=C.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[x,p]of Object.entries(f))m[x]!==p&&s(x,p);for(const x of Object.keys(m))x in f||s(x,void 0)}a.current=f};return o.jsx(On.Provider,{value:l,children:o.jsx(Ts,{schema:c,formData:e,onChange:d,validator:$s,widgets:Zr,templates:li,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function ai(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 m;e[5]!==s?(m=_=>{_||d({}),s(_)},e[5]=s,e[6]=m):m=e[6];const x=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(so,{children:[o.jsx(oo,{children:"Workflow Input"}),o.jsx(ro,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let h;e[9]!==a||e[10]!==i?(h=o.jsx("div",{className:"py-4",children:o.jsx(Un,{inputSchema:i,inputParams:a,setInputParams:d,mentions:g})}),e[9]=a,e[10]=i,e[11]=h):h=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(q,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let w;e[17]!==l?(w=l?o.jsx(De,{size:"xs"}):o.jsx(St,{size:14}),e[17]=l,e[18]=w):w=e[18];let S;e[19]!==f||e[20]!==l||e[21]!==w?(S=o.jsxs(q,{onClick:f,disabled:l,className:"gap-2",children:[w,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=w,e[22]=S):S=e[22];let v;e[23]!==S||e[24]!==j?(v=o.jsxs(io,{children:[j,S]}),e[23]=S,e[24]=j,e[25]=v):v=e[25];let y;e[26]!==v||e[27]!==h?(y=o.jsxs(lo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,h,v]}),e[26]=v,e[27]=h,e[28]=y):y=e[28];let k;return e[29]!==x||e[30]!==n||e[31]!==y?(k=o.jsx(co,{open:n,onOpenChange:x,children:y}),e[29]=x,e[30]=n,e[31]=y,e[32]=k):k=e[32],k}function di(t){const e=N.c(26),{title:n,description:s,onSave:i}=t,l=at().location.href,{viewMode:c,setViewMode:a,showExecutionsList:d,toggleExecutionsList:u}=Rt(),{resetToOriginalWorkflow:f,setSelectedVirtualMcpId:m}=X(),x=$n(),p=Ne(),g=J();let h;e[0]!==n?(h=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=h):h=e[1];let b;e[2]!==s?(b=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]=b):b=e[3];let j;e[4]!==h||e[5]!==b?(j=o.jsx(ln,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h,b]})}),e[4]=h,e[5]=b,e[6]=j):j=e[6];let w;e[7]!==x||e[8]!==i||e[9]!==f||e[10]!==p||e[11]!==m||e[12]!==a||e[13]!==d||e[14]!==n||e[15]!==u||e[16]!==g||e[17]!==l||e[18]!==c?(w=!g&&o.jsxs(o.Fragment,{children:[o.jsx(bt,{title:n,url:l,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Yo,{selectedVirtualMcpId:p,onVirtualMcpChange:m,placeholder:"Select Agent"})}),o.jsx(Hs,{value:c,onValueChange:a,size:"sm",options:[{value:"visual",icon:o.jsx(Vs,{})},{value:"code",icon:o.jsx(yn,{})}]}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:f,disabled:!x,"aria-label":"Reset changes",children:o.jsx(rn,{size:14})})})}),o.jsx(re,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!x,"aria-label":"Save workflow",children:o.jsx(Et,{size:14})})})}),o.jsx(re,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:d?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:u,"aria-label":d?"Hide runs":"Show runs",children:o.jsx(vn,{size:14})})})}),o.jsx(re,{side:"bottom",children:d?"Hide runs":"Show runs"})]})})]}),e[7]=x,e[8]=i,e[9]=f,e[10]=p,e[11]=m,e[12]=a,e[13]=d,e[14]=n,e[15]=u,e[16]=g,e[17]=l,e[18]=c,e[19]=w):w=e[19];let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(mi,{}),e[20]=S):S=e[20];let v;e[21]!==w?(v=o.jsxs(wt,{children:[w,S]}),e[21]=w,e[22]=v):v=e[22];let y;return e[23]!==j||e[24]!==v?(y=o.jsxs(o.Fragment,{children:[j,v]}),e[23]=j,e[24]=v,e[25]=y):y=e[25],y}function ui(){const t=J(),{item:e}=Ce(t);return e?.completed_at_epoch_ms!=null}function fi(){const t=J(),{item:e}=Ce(t);return e?.status==="cancelled"}function mi(){const t=N.c(57),e=$n(),n=ui(),s=fi(),i=J(),r=Ne(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=dr(),u=$e(),[f,m]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=ur(),{handleResumeWorkflow:g,isResuming:h}=fr(),b=i&&!n;let j;t[0]!==u?(j=u.some(pi),t[0]=u,t[1]=j):j=t[1];const w=j,S=!r,v=e||w||S||c||p,y=b||c;let k;t[2]!==w||t[3]!==S||t[4]!==e||t[5]!==s||t[6]!==y?(k=()=>s?"Workflow is currently cancelled":y?"Workflow is currently running":e?"Save your changes before running":S?"Select an Agent first":w?"Add at least one step to the workflow":null,t[2]=w,t[3]=S,t[4]=e,t[5]=s,t[6]=y,t[7]=k):k=t[7];const $=k();let P;t[8]!==x||t[9]!==g||t[10]!==l||t[11]!==d||t[12]!==s||t[13]!==y||t[14]!==a||t[15]!==i?(P=async()=>{if(a&&d){m(!0);return}if(s&&i){await g(i);return}if(y&&i){await x(i);return}await l({})},t[8]=x,t[9]=g,t[10]=l,t[11]=d,t[12]=s,t[13]=y,t[14]=a,t[15]=i,t[16]=P):P=t[16];const R=P;let A;t[17]!==l?(A=async G=>{await l(G)},t[17]=l,t[18]=A):A=t[18];const M=A,H=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",L=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let D;t[19]!==L?(D=O("gap-2 h-7 px-3",L),t[19]=L,t[20]=D):D=t[20];let I;t[21]!==p||t[22]!==s||t[23]!==c||t[24]!==h||t[25]!==b?(I=(!b&&!c&&!p&&!h||s)&&o.jsx(St,{size:14}),t[21]=p,t[22]=s,t[23]=c,t[24]=h,t[25]=b,t[26]=I):I=t[26];let T;t[27]!==p||t[28]!==s||t[29]!==c||t[30]!==h||t[31]!==b?(T=b&&!c&&!p&&!h&&!s&&o.jsx(Ys,{size:14}),t[27]=p,t[28]=s,t[29]=c,t[30]=h,t[31]=b,t[32]=T):T=t[32];let E;t[33]!==p||t[34]!==c||t[35]!==h?(E=(c||p||h)&&o.jsx(De,{size:"xs"}),t[33]=p,t[34]=c,t[35]=h,t[36]=E):E=t[36];let W;t[37]!==H||t[38]!==R||t[39]!==v||t[40]!==D||t[41]!==I||t[42]!==T||t[43]!==E?(W=o.jsxs(q,{variant:"default",size:"sm",className:D,disabled:v,onClick:R,children:[I,T,E,H]}),t[37]=H,t[38]=R,t[39]=v,t[40]=D,t[41]=I,t[42]=T,t[43]=E,t[44]=W):W=t[44];const K=W;let F;t[45]!==K||t[46]!==$?(F=$?o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:K})}),o.jsx(re,{side:"bottom",children:$})]})}):K,t[45]=K,t[46]=$,t[47]=F):F=t[47];const B=F;let V;t[48]!==M||t[49]!==d||t[50]!==c||t[51]!==a||t[52]!==f?(V=a&&d&&o.jsx(ai,{open:f,onOpenChange:m,inputSchema:d,onSubmit:M,isPending:c}),t[48]=M,t[49]=d,t[50]=c,t[51]=a,t[52]=f,t[53]=V):V=t[53];let z;return t[54]!==B||t[55]!==V?(z=o.jsxs(o.Fragment,{children:[B,V]}),t[54]=B,t[55]=V,t[56]=z):z=t[56],z}function pi(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function xi(){const t=N.c(17),e=J(),n=$e(),{item:s}=Ce(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=s.completed_steps?.success??[],t[5]=s.completed_steps?.success,t[6]=r):r=t[6];let l;t[7]!==r?(l=new Set(r),t[7]=r,t[8]=l):l=t[8];const c=l;let a;t[9]!==s.completed_steps?.error?(a=s.completed_steps?.error??[],t[9]=s.completed_steps?.error,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d;let f;t[13]!==u||t[14]!==n||t[15]!==c?(f=-1,n.forEach((m,x)=>{(c.has(m.name)||u.has(m.name))&&(f=x)}),t[13]=u,t[14]=n,t[15]=c,t[16]=f):f=t[16],n.forEach((m,x)=>{let p="pending";u.has(m.name)?p="error":c.has(m.name)?p="success":s.status==="running"&&x===f+1&&(p="running"),i[m.name]={status:p,output:void 0,error:void 0,stepIndex:x}}),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 hi(t){const e=N.c(119),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=J(),{item:m}=Ce(f),x=m?.completed_at_epoch_ms;let p;e[0]!==m?.completed_steps?.success||e[1]!==n.name?(p=m?.completed_steps?.success?.includes(n.name)??!1,e[0]=m?.completed_steps?.success,e[1]=n.name,e[2]=p):p=e[2];const g=p;let h;e[3]!==m?.completed_steps?.error||e[4]!==n.name?(h=m?.completed_steps?.error?.includes(n.name)??!1,e[3]=m?.completed_steps?.error,e[4]=n.name,e[5]=h):h=e[5];const b=h,j="toolName"in n.action,w=j&&"connectionId"in n.action?n.action.connectionId:null,v=!!(j&&"toolName"in n.action?n.action.toolName:null);let y,k,_,$,P,R,A,M,H,L,D;if(e[6]!==w||e[7]!==r||e[8]!==v||e[9]!==s||e[10]!==g||e[11]!==b||e[12]!==c||e[13]!==i||e[14]!==l||e[15]!==j||e[16]!==d||e[17]!==u||e[18]!==a||e[19]!==n||e[20]!==f){const K=Ii(n);y=g?"success":b?"error":r?.status;const F=r!==void 0,B=y==="success"||y==="error";let V=K.length>0?60:12;(y==="success"||y==="error")&&(V=V+32);let z,G,ce;if(e[32]!==i||e[33]!==l||e[34]!==a||e[35]!==y){const Ie=ji(y);let Ee;e[44]!==y?(Ee=vi(y),e[44]=y,e[45]=Ee):Ee=e[45],z=Ee;const Ke=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",Je=y==="running"&&"bg-accent/50",Ge=l&&"opacity-50";e[46]!==Ke||e[47]!==Je||e[48]!==Ge?(M=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",Ke,Je,Ge),e[46]=Ke,e[47]=Je,e[48]=Ge,e[49]=M):M=e[49],H=a,L="button",D=0,e[50]!==a?(k=Xe=>{(Xe.key==="Enter"||Xe.key===" ")&&(Xe.preventDefault(),a())},e[50]=a,e[51]=k):k=e[51],ce="w-5 flex flex-col items-center justify-center shrink-0 pt-3",G=O("text-xs font-mono opacity-75 h-8 flex items-center",Ie),e[32]=i,e[33]=l,e[34]=a,e[35]=y,e[36]=z,e[37]=k,e[38]=G,e[39]=ce,e[40]=M,e[41]=H,e[42]=L,e[43]=D}else z=e[36],k=e[37],G=e[38],ce=e[39],M=e[40],H=e[41],L=e[42],D=e[43];const Ue=s+1;let ae;e[52]!==G||e[53]!==Ue?(ae=o.jsxs("span",{className:G,children:[Ue,"."]}),e[52]=G,e[53]=Ue,e[54]=ae):ae=e[54],e[55]!==ce||e[56]!==ae?(_=o.jsx("div",{className:ce,children:ae}),e[55]=ce,e[56]=ae,e[57]=_):_=e[57];let de;e[58]!==z||e[59]!==s?(de=s>0?o.jsx(ot,{height:12,color:z}):o.jsx("div",{className:"h-3"}),e[58]=z,e[59]=s,e[60]=de):de=e[60];let ue;e[61]!==w||e[62]!==v||e[63]!==j||e[64]!==n.name?(ue=o.jsx(ki,{connectionId:w,isToolStep:j,hasToolSelected:v,stepName:n.name}),e[61]=w,e[62]=v,e[63]=j,e[64]=n.name,e[65]=ue):ue=e[65];let fe;e[66]!==z||e[67]!==B||e[68]!==y?(fe=B&&o.jsxs(o.Fragment,{children:[o.jsx(ot,{height:8,color:z}),o.jsx(yi,{status:y})]}),e[66]=z,e[67]=B,e[68]=y,e[69]=fe):fe=e[69];let me;e[70]!==z||e[71]!==V||e[72]!==c||e[73]!==f?(me=c&&f?null:o.jsx(ot,{height:V,color:z}),e[70]=z,e[71]=V,e[72]=c,e[73]=f,e[74]=me):me=e[74],e[75]!==de||e[76]!==ue||e[77]!==fe||e[78]!==me?($=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[de,ue,fe,me]}),e[75]=de,e[76]=ue,e[77]=fe,e[78]=me,e[79]=$):$=e[79],P="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const qe=v?"font-medium text-foreground":"text-foreground";let pe;e[80]!==qe?(pe=O("text-sm truncate flex-1",qe),e[80]=qe,e[81]=pe):pe=e[81];let xe;e[82]!==n?(xe=Ci(n),e[82]=n,e[83]=xe):xe=e[83];let he;e[84]!==pe||e[85]!==xe?(he=o.jsx("span",{className:pe,children:xe}),e[84]=pe,e[85]=xe,e[86]=he):he=e[86];let ge;e[87]!==F||e[88]!==y?(ge=F&&o.jsx(wi,{status:y}),e[87]=F,e[88]=y,e[89]=ge):ge=e[89];let be;e[90]!==F||e[91]!==d||e[92]!==u?(be=!F&&o.jsxs(uo,{children:[o.jsx(fo,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:bi,children:o.jsx(ao,{size:14})})}),o.jsxs(mo,{align:"end",children:[o.jsxs(Vt,{onClick:Ie=>{Ie.stopPropagation(),u()},children:[o.jsx(ho,{size:14}),"Duplicate"]}),o.jsxs(Vt,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:Ie=>{Ie.stopPropagation(),d()},children:[o.jsx(ps,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=F,e[91]=d,e[92]=u,e[93]=be):be=e[93],e[94]!==he||e[95]!==ge||e[96]!==be?(R=o.jsxs("div",{className:"flex items-center h-8",children:[he,ge,be]}),e[94]=he,e[95]=ge,e[96]=be,e[97]=R):R=e[97],A=K.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(gi)}),e[6]=w,e[7]=r,e[8]=v,e[9]=s,e[10]=g,e[11]=b,e[12]=c,e[13]=i,e[14]=l,e[15]=j,e[16]=d,e[17]=u,e[18]=a,e[19]=n,e[20]=f,e[21]=y,e[22]=k,e[23]=_,e[24]=$,e[25]=P,e[26]=R,e[27]=A,e[28]=M,e[29]=H,e[30]=L,e[31]=D}else y=e[21],k=e[22],_=e[23],$=e[24],P=e[25],R=e[26],A=e[27],M=e[28],H=e[29],L=e[30],D=e[31];let I;e[98]!==x||e[99]!==y?(I=y==="success"&&o.jsx(Si,{completedAtEpochMs:x}),e[98]=x,e[99]=y,e[100]=I):I=e[100];let T;e[101]!==r?.error||e[102]!==y?(T=y==="error"&&o.jsx(Ni,{error:r?.error}),e[101]=r?.error,e[102]=y,e[103]=T):T=e[103];let E;e[104]!==I||e[105]!==T||e[106]!==P||e[107]!==R||e[108]!==A?(E=o.jsxs("div",{className:P,children:[R,A,I,T]}),e[104]=I,e[105]=T,e[106]=P,e[107]=R,e[108]=A,e[109]=E):E=e[109];let W;return e[110]!==k||e[111]!==_||e[112]!==$||e[113]!==E||e[114]!==M||e[115]!==H||e[116]!==L||e[117]!==D?(W=o.jsxs("div",{className:M,onClick:H,role:L,tabIndex:D,onKeyDown:k,children:[_,$,E]}),e[110]=k,e[111]=_,e[112]=$,e[113]=E,e[114]=M,e[115]=H,e[116]=L,e[117]=D,e[118]=W):W=e[118],W}function gi(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 bi(t){return t.stopPropagation()}function ji(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function vi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function yi(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(It,{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(Nt,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function wi(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(It,{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(Nt,{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(_e,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Si(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(ks,{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 Ni(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{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 ki(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=kt(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(ze,{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(kn,{size:16,className:"text-muted-foreground"}):o.jsx(xo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function ot(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 Ci(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 Ii(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function _i(t){const e=N.c(32),{className:n}=t,s=$e(),i=Tn(),r=xi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=X(),d=J();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(w=>r[w.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let 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 p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let w;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(w=(S,v)=>{const y=r?.[S.name],k=f!==-1&&v>f&&y?.status==="pending",_=v===s.length-1;return o.jsx(hi,{step:S,index:v,isSelected:S.name===i,executionStatus:y,isSkipped:k,isLastStep:_,onSelect:()=>l(S.name),onDelete:()=>c(S.name),onDuplicate:()=>a(S.name)},S.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]=w):w=e[21],p=s.map(w),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let g;e[22]!==p?(g=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let h;e[24]!==d?(h=d?null:o.jsx(Ti,{}),e[24]=d,e[25]=h):h=e[25];let b;e[26]!==g||e[27]!==h?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[g,h]}),e[26]=g,e[27]=h,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(C.Suspense,{fallback:m,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function Ti(){const t=N.c(8),{addToolStep:e}=X();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(dn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(q,{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 $i(){const t=N.c(11),{org:e}=Z(),s=Ne()??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=Q(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=xt(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 Ei(t){const e=N.c(7),{className:n}=t;if(!Ne()){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(Oi,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function Oi(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=$i(),l=Te(),{updateStep:c}=X(),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=y=>y.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=pr(s,u??null,Mi,Ri);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 p=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 y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(De,{size:"sm"})}),e[10]=y):y=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:y}),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 y;e[15]!==r.message?(y=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]=y):y=e[16];let k;return e[17]!==v||e[18]!==y?(k=o.jsx("div",{className:v,children:y}),e[17]=v,e[18]=y,e[19]=k):k=e[19],k}let g;e[20]!==n?(g=O("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=g):g=e[21];let h;e[22]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=h):h=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:[h,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=y=>o.jsx(Ai,{icon:null,title:y.name,description:y.description,isSelected:y.name===d,onClick:()=>p(y)},y.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let w;e[32]!==j?(w=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=w):w=e[33];let S;return e[34]!==g||e[35]!==b||e[36]!==w?(S=o.jsxs("div",{className:g,children:[b,w]}),e[34]=g,e[35]=b,e[36]=w,e[37]=S):S=e[37],S}function Ri(t,e){return t.name.localeCompare(e.name)}function Mi(t){return t.name}function Ai(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=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(ze,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let x;e[11]!==f||e[12]!==m?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=x):x=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(p=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]=p):p=e[19],p}var ee="Accordion",Pi=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Pt,Li,zi]=hs(ee),[Fe]=tn(ee,[zi,an]),Lt=an(),qn=U.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(Pt.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Vi,{...r,ref:e}):o.jsx(Hi,{...i,ref:e})})});qn.displayName=ee;var[Kn,Di]=Fe(ee),[Jn,Wi]=Fe(ee,{collapsible:!1}),Hi=U.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=ut({prop:n,defaultProp:s??"",onChange:i,caller:ee});return o.jsx(Kn,{scope:t.__scopeAccordion,value:U.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:U.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Jn,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(Gn,{...l,ref:e})})})}),Vi=U.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=ut({prop:n,defaultProp:s??[],onChange:i,caller:ee}),a=U.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=U.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Kn,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Jn,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(Gn,{...r,ref:e})})})}),[Fi,Be]=Fe(ee),Gn=U.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=U.useRef(null),a=en(c,e),d=Li(n),f=gs(i)==="ltr",m=te(t.onKeyDown,x=>{if(!Pi.includes(x.key))return;const p=x.target,g=d().filter(_=>!_.ref.current?.disabled),h=g.findIndex(_=>_.ref.current===p),b=g.length;if(h===-1)return;x.preventDefault();let j=h;const w=0,S=b-1,v=()=>{j=h+1,j>S&&(j=w)},y=()=>{j=h-1,j<w&&(j=S)};switch(x.key){case"Home":j=w;break;case"End":j=S;break;case"ArrowRight":r==="horizontal"&&(f?v():y());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?y():v());break;case"ArrowUp":r==="vertical"&&y();break}const k=j%b;g[k].ref.current?.focus()});return o.jsx(Fi,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(Pt.Slot,{scope:n,children:o.jsx(dt.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),Le="AccordionItem",[Bi,zt]=Fe(Le),Xn=U.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=Be(Le,n),l=Di(Le,n),c=Lt(n),a=xs(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(Bi,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(eo,{"data-orientation":r.orientation,"data-state":ns(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});Xn.displayName=Le;var Zn="AccordionHeader",Qn=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=zt(Zn,n);return o.jsx(dt.h3,{"data-orientation":i.orientation,"data-state":ns(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});Qn.displayName=Zn;var ct="AccordionTrigger",Yn=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=zt(ct,n),l=Wi(ct,n),c=Lt(n);return o.jsx(Pt.ItemSlot,{scope:n,children:o.jsx(no,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});Yn.displayName=ct;var es="AccordionContent",ts=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=zt(es,n),l=Lt(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}})});ts.displayName=es;function ns(t){return t?"open":"closed"}var Ui=qn,qi=Xn,Ki=Qn,Ji=Yn,Gi=ts;function Xi(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(Ui,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Zi(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(qi,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Qi(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(po,{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(Ki,{className:"flex",children:o.jsxs(Ji,{"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 Yi(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(Gi,{"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 el(t){const{updateStep:e}=X(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=Dt(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function tl(t){const e=N.c(25),{className:n}=t,s=Te(),{appendStep:i}=X();if(el(s),!s){let m;e[0]!==n?(m=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=m):m=e[1];let x;e[2]!==i?(x=()=>{i({type:"tool"})},e[2]=i,e[3]=x):x=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(dn,{size:14}),e[4]=p):p=e[4];let g;e[5]!==x?(g=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(q,{variant:"ghost",size:"icon",className:"size-7",onClick:x,children:p})]}),e[5]=x,e[6]=g):g=e[6];let h;return e[7]!==m||e[8]!==g?(h=o.jsx("div",{className:m,children:g}),e[7]=m,e[8]=g,e[9]=h):h=e[9],h}let r;e[10]!==n?(r=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=r):r=e[11];let l,c,a,d,u;e[12]!==s?(l=o.jsx(nl,{step:s}),c=o.jsx(ol,{step:s}),a=o.jsx(rl,{step:s}),d=o.jsx(al,{step:s}),u=o.jsx(fl,{step:s}),e[12]=s,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):(l=e[13],c=e[14],a=e[15],d=e[16],u=e[17]);let f;return e[18]!==r||e[19]!==l||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==u?(f=o.jsxs("div",{className:r,children:[l,c,a,d,u]}),e[18]=r,e[19]=l,e[20]=c,e[21]=a,e[22]=d,e[23]=u,e[24]=f):f=e[24],f}function nl(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=J(),l=i??"";let c;e[0]!==l?(c=o.jsx(ze,{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(sl,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function sl(){const t=N.c(9),e=Te(),{updateStep:n,startReplacingTool:s}=X(),i=J(),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){Zt.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(Nn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(q,{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 Dt(t){const e=N.c(13),{org:n}=Z(),i=Ne()??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=Q(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=xt(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(m=>m.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 ol(t){const e=N.c(13),{step:n}=t,{updateStep:s}=X(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=J(),{tool:c}=Dt(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=b=>{s(n.name,{input:b})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a,u=l?"output":"input";let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Qi,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=f):f=e[3];const m=c.inputSchema,x=n.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==d||e[6]!==n.name||e[7]!==m||e[8]!==x?(g=o.jsxs(Zi,{value:"input",className:"border-b-0",children:[f,o.jsx(Yi,{className:"px-5 pt-2",children:o.jsx(Un,{inputSchema:m,inputParams:x,setInputParams:d,mentions:p},n.name)})]}),e[5]=d,e[6]=n.name,e[7]=m,e[8]=x,e[9]=g):g=e[9];let h;return e[10]!==u||e[11]!==g?(h=o.jsx(Xi,{type:"single",collapsible:!0,defaultValue:u,className:"border-b border-border shrink-0",children:g}),e[10]=u,e[11]=g,e[12]=h):h=e[12],h}function rl(t){const e=N.c(24),{step:n}=t,s=n.outputSchema,[i,r]=C.useState(!1),l=J(),{item:c}=Ce(l),a=!!(c?.completed_steps?.success?.includes(n.name)||c?.completed_steps?.error?.includes(n.name)),{output:d,error:u}=nr(l,a?n.name:void 0);let f;e[0]!==u||e[1]!==d?(f=d||(u?{error:u}:void 0),e[0]=u,e[1]=d,e[2]=f):f=e[2];const m=f,x=s&&typeof s=="object"?s.properties:void 0;let p;e[3]!==x?(p=x?Object.entries(x):[],e[3]=x,e[4]=p):p=e[4];const g=p,h=i?"flex-1 min-h-0 overflow-hidden":"shrink-0";let b;e[5]!==h?(b=O("flex flex-col border-b border-border",h),e[5]=h,e[6]=b):b=e[6];let j;e[7]!==i?(j=()=>r(!i),e[7]=i,e[8]=j):j=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 S;e[10]!==i?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[w,i?o.jsx(Tt,{size:14,className:"text-muted-foreground"}):o.jsx(_t,{size:14,className:"text-muted-foreground"})]}),e[10]=i,e[11]=S):S=e[11];let v;e[12]!==j||e[13]!==S?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:j,children:S}),e[12]=j,e[13]=S,e[14]=v):v=e[14];let y;e[15]!==m||e[16]!==i||e[17]!==g||e[18]!==l?(y=i&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[l&&m?o.jsx(ye,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}):null,!l&&g.map(il)]}),e[15]=m,e[16]=i,e[17]=g,e[18]=l,e[19]=y):y=e[19];let k;return e[20]!==b||e[21]!==v||e[22]!==y?(k=o.jsxs("div",{className:b,children:[v,y]}),e[20]=b,e[21]=v,e[22]=y,e[23]=k):k=e[23],k}function il(t){const[e,n]=t;return o.jsx(cl,{name:e,schema:n},e)}function ll(t){switch(t){case"string":return{Icon:bn,color:"text-blue-500"};case"number":case"integer":return{Icon:hn,color:"text-blue-500"};case"array":return{Icon:mn,color:"text-purple-500"};case"object":return{Icon:fn,color:"text-orange-500"};case"boolean":return{Icon:gn,color:"text-pink-500"};case"null":return{Icon:ft,color:"text-gray-500"};default:return{Icon:pn,color:"text-muted-foreground"}}}function cl(t){const e=N.c(28),{name:n,schema:s}=t,i=Te(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:S,color:v}=ll(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=S,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 m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let x;e[12]!==d||e[13]!==f||e[14]!==m?(x=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=x):x=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(wn,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=i?.name;let h;e[17]!==g?(h=o.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=h):h=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]!==h||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,h,b]}),e[21]=h,e[22]=b,e[23]=j):j=e[23];let w;return e[24]!==j||e[25]!==u||e[26]!==x?(w=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=w):w=e[27],w}function al(t){const e=N.c(29),{step:n}=t,{updateStep:s}=X(),i=J(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=Dt(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 tt(t,e){switch(t){case"tool":return{input:{},action:{toolName:""},outputSchema:{},name:`Step_${e+1}`};case"code":return{...Ls,name:`Step_${e+1}`};default:throw new Error(`Invalid step type: ${t}`)}}const Rn=C.createContext(null),Fo=t=>Rt()(On(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??tt(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:et(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.localWorkflow})),startAddingStep:n=>e(s=>({...s,isAddingStep:!0,addingStepType:n})),cancelAddingStep:()=>e(n=>({...n,isAddingStep:!1,addingStepType:null,selectedParentSteps:[]})),toggleParentStepSelection:n=>e(s=>{const i=s.selectedParentSteps.includes(n);return{...s,selectedParentSteps:i?s.selectedParentSteps.filter(r=>r!==n):[...s.selectedParentSteps,n]}}),confirmAddCodeStep:()=>e(n=>{const{selectedParentSteps:s,addingStepType:i,workflow:r}=n;if(i!=="code"||s.length===0)return n;const l={};for(const f of s)l[f]=`@${f}`;const c={};for(const f of s){const m=r.steps.find(x=>x.name===f);m?.outputSchema&&(c[f]=m.outputSchema)}const a=Object.keys(c).length>0?{type:"object",properties:c,required:Object.keys(c)}:void 0;let d=tt("code",Number((Math.random()*1e6).toFixed(0)));if(d={...d,input:l},a){const f=Ho(a,"Input"),m=d.action,x=Vo(m.code,f);d={...d,action:{...m,code:x}}}const u=et(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=tt("tool",Number((Math.random()*1e6).toFixed(0)));const i=et(s.name,n.workflow.steps);return{...n,isAddingStep:!1,addingStepType:null,workflow:{...n.workflow,steps:[...n.workflow.steps,{...s,name:i}]},currentStepName:i}}),setOriginalWorkflow:n=>e(s=>({...s,localWorkflow:n})),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:En(()=>localStorage),version:1,partialize:e=>({trackingExecutionId:e.trackingExecutionId,currentStepName:e.currentStepName,currentStepTab:e.currentStepTab,localWorkflow:e.localWorkflow,isAddingStep:e.isAddingStep,addingStepType:e.addingStepType,selectedParentSteps:e.selectedParentSteps,replacingToolInfo:e.replacingToolInfo,selectedVirtualMcpId:e.selectedVirtualMcpId})}));function Bo(t){const e=N.c(8),{children:n,initialState:s}=t,i=mn();let r;e[0]!==s.currentStepTab||e[1]!==s.trackingExecutionId||e[2]!==s.workflow||e[3]!==i?.[0]?.id?(r=()=>Fo({workflow:s.workflow,localWorkflow: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(Rn.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(Rn);if(!n)throw new Error("Missing WorkflowStoreProvider - refresh the page. If the error persists, please contact support.");return zo(n,t,Wo)}function Se(){return we(Uo)}function Uo(t){return t.workflow}function X(){return we(qo)}function qo(t){return t.actions}function Mn(){const t=$e();return we(Ko)??t[0]?.name}function Ko(t){return t.currentStepName}function Te(){const t=N.c(5),e=Mn(),n=$e();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 $e(){return Se().steps}function An(){const t=N.c(8),e=Se(),n=we(Xo);let s,i;if(t[0]!==n.description||t[1]!==n.steps||t[2]!==n.title||t[3]!==e.description||t[4]!==e.steps||t[5]!==e.title){const r={title:e.title,description:e.description,steps:e.steps.map(Go)},l={title:n.title,description:n.description,steps:n.steps.map(Jo)};s=JSON.stringify(r),i=JSON.stringify(l),t[0]=n.description,t[1]=n.steps,t[2]=n.title,t[3]=e.description,t[4]=e.steps,t[5]=e.title,t[6]=s,t[7]=i}else s=t[6],i=t[7];return s!==i}function Jo(t){return{...t,outputSchema:void 0}}function Go(t){return{...t,outputSchema:void 0}}function Xo(t){return t.localWorkflow}function J(){return we(Zo)}function Zo(t){return t.trackingExecutionId}function Ne(){return we(Qo)}function Qo(t){return t.selectedVirtualMcpId}function Yo(t){const e=N.c(18),{selectedVirtualMcpId:n,onVirtualMcpChange:s,className:i,placeholder:r}=t,l=r===void 0?"Select Agent":r,c=mn()??[],a=n??void 0;let d;e[0]!==s?(d=h=>s(h===""?void 0:h),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(un,{placeholder:l}),e[4]=l,e[5]=f):f=e[5];let m;e[6]!==u||e[7]!==f?(m=o.jsx(dn,{size:"sm",className:u,children:f}),e[6]=u,e[7]=f,e[8]=m):m=e[8];let x;e[9]!==c?(x=c.map(er),e[9]=c,e[10]=x):x=e[10];let p;e[11]!==x?(p=o.jsx(fn,{children:x}),e[11]=x,e[12]=p):p=e[12];let g;return e[13]!==a||e[14]!==d||e[15]!==m||e[16]!==p?(g=o.jsxs(an,{value:a,onValueChange:d,children:[m,p]}),e[13]=a,e[14]=d,e[15]=m,e[16]=p,e[17]=g):g=e[17],g}function er(t){return o.jsx(it,{value:t.id,children:t.title},t.id)}function ke(){const t=N.c(2),e=Ps();let n;t[0]!==e?(n={connections:e,binding:"WORKFLOW"},t[0]=e,t[1]=n):n=t[1];const s=zs(n);if(!s||s.length===0||!s[0])throw new Error("No workflow connection found");return s[0]}const Jt=[100,1e3,2e3];function Ce(t){const e=N.c(15),{org:n}=Z(),s=ke(),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=Q(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?g=>{const b=g.state?.data?.item?.status;if(b==="running"||b==="enqueued"){const j=Jt[i.current]??1;return i.current=(i.current+1)%Jt.length,j}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,staleTime:0,gcTime:0,enabled:a,select:tr,refetchInterval:d},e[7]=l,e[8]=c,e[9]=a,e[10]=d,e[11]=u):u=e[11];const{data:f,isLoading:m}=gt(u),x=f?.item;let p;return e[12]!==m||e[13]!==x?(p={item:x,isLoading:m},e[12]=m,e[13]=x,e[14]=p):p=e[14],p}function tr(t){return t.structuredContent??t}function nr(t,e){const n=N.c(14),{org:s}=Z(),i=ke();let r;n[0]!==i.id||n[1]!==s.id?(r={connectionId:i.id,orgId:s.id},n[0]=i.id,n[1]=s.id,n[2]=r):r=n[2];const l=Q(r);let c;n[3]!==t||n[4]!==e?(c={executionId:t,stepId:e},n[3]=t,n[4]=e,n[5]=c):c=n[5];const a=!!t&&!!e;let d;n[6]!==l||n[7]!==c||n[8]!==a?(d={client:l,toolName:"COLLECTION_WORKFLOW_EXECUTION_GET_STEP_RESULT",toolArguments:c,enabled:a,select:sr},n[6]=l,n[7]=c,n[8]=a,n[9]=d):d=n[9];const{data:u,isLoading:f}=gt(d),m=u?.output,x=u?.error;let p;return n[10]!==f||n[11]!==m||n[12]!==x?(p={output:m,error:x,isLoading:f},n[10]=f,n[11]=m,n[12]=x,n[13]=p):p=n[13],p}function sr(t){return t.structuredContent??t}function or(){const t=N.c(19),{org:e}=Z(),n=ke(),s=Se();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=Q(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:rr},t[9]=r,t[10]=d,t[11]=u,t[12]=f):f=t[12];const{data:m,isLoading:x,refetch:p}=gt(f);let g;t[13]!==m?.items?(g=m?.items??[],t[13]=m?.items,t[14]=g):g=t[14];let h;return t[15]!==x||t[16]!==p||t[17]!==g?(h={executions:g,isLoading:x,refetch:p},t[15]=x,t[16]=p,t[17]=g,t[18]=h):h=t[18],h}function rr(t){return t.structuredContent??t}function Pn(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 ir(t){const e=[];for(const n of t){const s=Pn(n.input);e.push(...s)}return[...new Set(e)].filter(n=>n!=="__entire_input__")}function lr(t){for(const e of t)if(Pn(e.input).includes("__entire_input__"))return!0;return!1}function cr(t){const e=ir(t);if(e.length===0)return lr(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 ar(){const t=N.c(2),e=Se();let n;return t[0]!==e.steps?(n=cr(e.steps),t[0]=e.steps,t[1]=n):n=t[1],n}function dr(){const t=N.c(15),{org:e}=Z(),{id:n}=ke(),{setTrackingExecutionId:s}=X(),i=Se(),r=Ne(),l=ar();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=Q(c);let d;t[3]!==a?(d={client:a},t[3]=a,t[4]=d):d=t[4];const{mutateAsync:u,isPending:f}=bt(d);let m;t[5]!==r||t[6]!==s||t[7]!==u||t[8]!==i?(m=async h=>{const b=h===void 0?{}:h;if(!r)throw new Error("Please select an Agent before running the workflow");const j=Date.now(),w=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=(w.structuredContent??w)?.item?.id??void 0;return s(v),v},t[5]=r,t[6]=s,t[7]=u,t[8]=i,t[9]=m):m=t[9];const x=m,p=l!==null;let g;return t[10]!==x||t[11]!==l||t[12]!==f||t[13]!==p?(g={handleRunWorkflow:x,isPending:f,requiresInput:p,inputSchema:l},t[10]=x,t[11]=l,t[12]=f,t[13]=p,t[14]=g):g=t[14],g}function ur(){const t=N.c(10),{org:e}=Z(),{id:n}=ke();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=Q(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=bt(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 fr(){const t=N.c(10),{org:e}=Z(),{id:n}=ke();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=Q(s);let r;t[3]!==i?(r={client:i},t[3]=i,t[4]=r):r=t[4];const{mutateAsync:l,isPending:c}=bt(r);let a;t[5]!==l?(a=async f=>{const m=await l({name:"RESUME_EXECUTION",arguments:{executionId:f}});return(m.structuredContent??m)?.success??!1},t[5]=l,t[6]=a):a=t[6];const d=a;let u;return t[7]!==d||t[8]!==c?(u={handleResumeWorkflow:d,isResuming:c},t[7]=d,t[8]=c,t[9]=u):u=t[9],u}function mr(){const t=N.c(3),e=J(),{item:n}=Ce(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 pr(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 Mt=Mo()(On(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"})),Ln=C.createContext([]);function zn(){return C.useContext(Ln)}function xr({editor:t,overrideSuggestionOptions:e,extensionName:n,char:s="@"}){const i=new Ks;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 Dn(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>xr({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Gt(t,e){const n=Dn(t),s=n.find(i=>i.char===e);return s||(n.length?n[0]:null)}var hr=Fs.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",Oe(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=Gt(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Oe({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const s={...this.options};s.HTMLAttributes=Oe({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:s,node:t,suggestion:n});return typeof i=="string"?["span",Oe({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...qs({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:Gt(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 Us,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 Dn(this).map(Bs)}}),gr=hr,nt,We="HoverCard",[Wn]=nn(We,[en]),He=en(),[br,Ve]=Wn(We),Hn=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:i,onOpenChange:r,openDelay:l=700,closeDelay:c=300}=t,a=He(e),d=C.useRef(0),u=C.useRef(0),f=C.useRef(!1),m=C.useRef(!1),[x,p]=ft({prop:s,defaultProp:i??!1,onChange:r,caller:We}),g=C.useCallback(()=>{clearTimeout(u.current),d.current=window.setTimeout(()=>p(!0),l)},[l,p]),h=C.useCallback(()=>{clearTimeout(d.current),!f.current&&!m.current&&(u.current=window.setTimeout(()=>p(!1),c))},[c,p]),b=C.useCallback(()=>p(!1),[p]);return C.useEffect(()=>()=>{clearTimeout(d.current),clearTimeout(u.current)},[]),o.jsx(br,{scope:e,open:x,onOpenChange:p,onOpen:g,onClose:h,onDismiss:b,hasSelectionRef:f,isPointerDownOnContentRef:m,children:o.jsx(xs,{...a,children:n})})};Hn.displayName=We;var Vn="HoverCardTrigger",Fn=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=Ve(Vn,n),r=He(n);return o.jsx(ms,{asChild:!0,...r,children:o.jsx(ut.a,{"data-state":i.open?"open":"closed",...s,ref:e,onPointerEnter:te(t.onPointerEnter,Pe(i.onOpen)),onPointerLeave:te(t.onPointerLeave,Pe(i.onClose)),onFocus:te(t.onFocus,i.onOpen),onBlur:te(t.onBlur,i.onClose),onTouchStart:te(t.onTouchStart,l=>l.preventDefault())})})});Fn.displayName=Vn;var At="HoverCardPortal",[jr,vr]=Wn(At,{forceMount:void 0}),Bn=t=>{const{__scopeHoverCard:e,forceMount:n,children:s,container:i}=t,r=Ve(At,e);return o.jsx(jr,{scope:e,forceMount:n,children:o.jsx(Yt,{present:n||r.open,children:o.jsx(ps,{asChild:!0,container:i,children:s})})})};Bn.displayName=At;var Ae="HoverCardContent",Un=C.forwardRef((t,e)=>{const n=vr(Ae,t.__scopeHoverCard),{forceMount:s=n.forceMount,...i}=t,r=Ve(Ae,t.__scopeHoverCard);return o.jsx(Yt,{present:s||r.open,children:o.jsx(yr,{"data-state":r.open?"open":"closed",...i,onPointerEnter:te(t.onPointerEnter,Pe(r.onOpen)),onPointerLeave:te(t.onPointerLeave,Pe(r.onClose)),ref:e})})});Un.displayName=Ae;var yr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:r,onInteractOutside:l,...c}=t,a=Ve(Ae,n),d=He(n),u=C.useRef(null),f=tn(e,u),[m,x]=C.useState(!1);return C.useEffect(()=>{if(m){const p=document.body;return nt=p.style.userSelect||p.style.webkitUserSelect,p.style.userSelect="none",p.style.webkitUserSelect="none",()=>{p.style.userSelect=nt,p.style.webkitUserSelect=nt}}},[m]),C.useEffect(()=>{if(u.current){const p=()=>{x(!1),a.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(a.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",p),()=>{document.removeEventListener("pointerup",p),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!1}}},[a.isPointerDownOnContentRef,a.hasSelectionRef]),C.useEffect(()=>{u.current&&Nr(u.current).forEach(g=>g.setAttribute("tabindex","-1"))}),o.jsx(hs,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:te(r,p=>{p.preventDefault()}),onDismiss:a.onDismiss,children:o.jsx(gs,{...d,...c,onPointerDown:te(c.onPointerDown,p=>{p.currentTarget.contains(p.target)&&x(!0),a.hasSelectionRef.current=!1,a.isPointerDownOnContentRef.current=!0}),ref:f,style:{...c.style,userSelect:m?"text":void 0,WebkitUserSelect:m?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),wr="HoverCardArrow",Sr=C.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,i=He(n);return o.jsx(bs,{...i,...s,ref:e})});Sr.displayName=wr;function Pe(t){return e=>e.pointerType==="touch"?void 0:t()}function Nr(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 kr=Hn,Cr=Fn,Ir=Bn,_r=Un;function Tr(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(kr,{"data-slot":"hover-card",...n}),e[2]=n,e[3]=s):s=e[3],s}function $r(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(Cr,{"data-slot":"hover-card-trigger",...n}),e[2]=n,e[3]=s):s=e[3],s}function Er(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(Ir,{"data-slot":"hover-card-portal",children:o.jsx(_r,{"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 qn=C.createContext(void 0);function Or(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 Rr(t){const e=N.c(20),{node:n}=t,s=C.useContext(qn),i=n.attrs.id??"",r=s!==void 0;let l;if(e[0]!==r||e[1]!==i||e[2]!==s){const g=r?Or(s,i):void 0;l=g!==void 0?typeof g=="object"?JSON.stringify(g,null,2):String(g):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 g;return e[6]!==d?(g=o.jsx(Vt,{as:"span",children:d}),e[6]=d,e[7]=g):g=e[7],g}let u;e[8]!==d?(u=o.jsx($r,{asChild:!0,children:d}),e[8]=d,e[9]=u):u=e[9];let f;e[10]!==i?(f=o.jsxs("div",{className:"text-xs font-medium text-muted-foreground",children:["@",i]}),e[10]=i,e[11]=f):f=e[11];let m;e[12]!==c?(m=o.jsx("pre",{className:"text-xs font-mono bg-muted/50 p-2 rounded overflow-auto max-h-[200px] whitespace-pre-wrap break-all",children:c}),e[12]=c,e[13]=m):m=e[13];let x;e[14]!==f||e[15]!==m?(x=o.jsx(Er,{className:"w-auto max-w-[400px] p-3",side:"top",align:"start",children:o.jsxs("div",{className:"space-y-1.5",children:[f,m]})}),e[14]=f,e[15]=m,e[16]=x):x=e[16];let p;return e[17]!==u||e[18]!==x?(p=o.jsx(Vt,{as:"span",children:o.jsxs(Tr,{openDelay:200,children:[u,x]})}),e[17]=u,e[18]=x,e[19]=p):p=e[19],p}function Kn(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 ne=Jn();function Jn(){return Rt(()=>({items:[],selectedIndex:0,command:null}))}function Xt(t,e){ne.setState({items:t,command:e,selectedIndex:0})}function Mr(){const{items:t,selectedIndex:e}=ne.getState();t.length&&ne.setState({selectedIndex:(e-1+t.length)%t.length})}function Ar(){const{items:t,selectedIndex:e}=ne.getState();t.length&&ne.setState({selectedIndex:(e+1)%t.length})}function Gn(){const{items:t,selectedIndex:e,command:n}=ne.getState(),s=t[e];return s?(n?.(s),!0):!1}function Zt(){ne=Jn()}function Pr(){const t=N.c(7),e=lt(ne,zr),n=lt(ne,Lr);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:()=>{ne.setState({selectedIndex:c}),Gn()},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 Lr(t){return t.selectedIndex}function zr(t){return t.items}function Dr(){let t=null,e=null;return{onStart:n=>{Xt(n.items,n.command),t=new Zs(Pr,{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=>{Xt(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(),Zt(),!0):n.key==="ArrowUp"?(Mr(),!0):n.key==="ArrowDown"?(Ar(),!0):n.key==="Enter"?Gn():!1,onExit:()=>{e?.remove(),t?.destroy(),Zt()}}}const st=/@([\w.]+)/g;function Wr(t,e){if(!t)return null;const n=Kn(e),s=new Map(n.map(a=>[a.id,a]));if(!st.test(t))return t;st.lastIndex=0;const r=[];let l=0,c;for(;(c=st.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 Pt(t){const e=N.c(31),{mentions:n,value:s,onChange:i,placeholder:r,className:l,readOnly:c}=t,a=mr();let d;e[0]!==n||e[1]!==s?(d=Wr(s,n),e[0]=n,e[1]=s,e[2]=d):d=e[2];const u=d,f=a!==void 0,m=!c;let x;e[3]===Symbol.for("react.memo_cache_sentinel")?(x=Js.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,hardBreak:!1}),e[3]=x):x=e[3];let p;if(e[4]!==n||e[5]!==f){let $;e[7]!==n?($=L=>{const{query:R}=L;return Kn(n).filter(M=>M.label.toLowerCase().includes(R.toLowerCase())||M.id.toLowerCase().includes(R.toLowerCase()))},e[7]=n,e[8]=$):$=e[8],p=gr.configure({HTMLAttributes:{class:"bg-primary/20 text-primary px-1 rounded font-medium"},renderText:Br,renderHTML:Fr,suggestion:{items:$,render:Dr,command:Vr}}).extend(f?{addNodeView(){return Gs(Rr)}}:{}),e[4]=n,e[5]=f,e[6]=p}else p=e[6];let g;e[9]!==p?(g=[x,p],e[9]=p,e[10]=g):g=e[10];const h=r??"";let b;e[11]!==h?(b={attributes:{class:"prose prose-sm max-w-none focus:outline-none w-full min-h-[20px]","data-placeholder":h},handleKeyDown:Hr},e[11]=h,e[12]=b):b=e[12];let j;e[13]!==i?(j=$=>{const{editor:L}=$;return i?.(L.getText().trim())},e[13]=i,e[14]=j):j=e[14];let w;e[15]!==u||e[16]!==m||e[17]!==g||e[18]!==b||e[19]!==j?(w={content:u,editable:m,extensions:g,editorProps:b,onUpdate:j},e[15]=u,e[16]=m,e[17]=g,e[18]=b,e[19]=j,e[20]=w):w=e[20];const S=Xs(w);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 y;e[23]!==S?(y=o.jsx(Qs,{editor:S}),e[23]=S,e[24]=y):y=e[24];let k;e[25]!==v||e[26]!==y?(k=o.jsx("div",{className:v,children:y}),e[25]=v,e[26]=y,e[27]=k):k=e[27];const _=k;if(a!==void 0){let $;return e[28]!==_||e[29]!==a?($=o.jsx(qn.Provider,{value:a,children:_}),e[28]=_,e[29]=a,e[30]=$):$=e[30],$}return _}function Hr(t,e){return e.key==="Enter"?(e.preventDefault(),!0):!1}function Vr(t){const{editor:e,range:n,props:s}=t;e.chain().focus().insertContentAt(n,[{type:"mention",attrs:s}]).run()}function Fr(t){const{options:e,node:n}=t;return["span",e.HTMLAttributes,`@${n.attrs.id}`]}function Br(t){const{node:e}=t;return`@${e.attrs.id}`}function Ur(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=zn(),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(Pt,{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 qr(t){const e=N.c(8),{value:n,onChange:s,placeholder:i,readonly:r}=t,l=zn(),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(Pt,{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 Kr(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 Jr(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=m=>s(m.target.checked),e[0]=s,e[1]=a):a=e[1];let d;e[2]!==r||e[3]!==i||e[4]!==c||e[5]!==a?(d=o.jsx("input",{id:r,type:"checkbox",checked:c,onChange:a,disabled:i,className:"h-4 w-4 rounded border-input"}),e[2]=r,e[3]=i,e[4]=c,e[5]=a,e[6]=d):d=e[6];let u;e[7]!==l?(u=o.jsx("span",{className:"text-sm",children:l}),e[7]=l,e[8]=u):u=e[8];let f;return e[9]!==r||e[10]!==d||e[11]!==u?(f=o.jsxs("label",{htmlFor:r,className:"flex items-center gap-2 cursor-pointer",children:[d,u]}),e[9]=r,e[10]=d,e[11]=u,e[12]=f):f=e[12],f}function Gr(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=g=>s(g.target.value),e[2]=s,e[3]=u):u=e[3];let f,m;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"),m=o.jsx("option",{value:"",children:"Select..."}),e[4]=f,e[5]=m):(f=e[4],m=e[5]);let x;e[6]!==a?(x=a.map(Xr),e[6]=a,e[7]=x):x=e[7];let p;return e[8]!==r||e[9]!==i||e[10]!==d||e[11]!==u||e[12]!==x?(p=o.jsxs("select",{id:r,value:d,onChange:u,disabled:i,className:f,children:[m,x]}),e[8]=r,e[9]=i,e[10]=d,e[11]=u,e[12]=x,e[13]=p):p=e[13],p}function Xr(t){return o.jsx("option",{value:String(t.value),children:String(t.label)},String(t.value))}const Zr={TextWidget:Ur,TextareaWidget:qr,NumberWidget:Kr,CheckboxWidget:Jr,SelectWidget:Gr};function Qr(t){switch(Array.isArray(t)?t[0]:t??"unknown"){case"string":return{Icon:Sn,color:"text-blue-500"};case"number":case"integer":return{Icon:yn,color:"text-blue-500"};case"array":return{Icon:bn,color:"text-purple-500"};case"object":return{Icon:gn,color:"text-orange-500"};case"boolean":return{Icon:wn,color:"text-pink-500"};case"null":return{Icon:mt,color:"text-gray-500"};default:return{Icon:jn,color:"text-muted-foreground"}}}function Yr(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,m,x,p,g,h;if(e[4]!==n||e[5]!==s||e[6]!==i||e[7]!==d){const{Icon:v,color:y}=Qr(d);h="space-y-2",x="flex items-center gap-2",e[15]!==n||e[16]!==s?(p=o.jsx("label",{htmlFor:n,className:"text-sm font-medium leading-none",children:s}),e[15]=n,e[16]=s,e[17]=p):p=e[17],e[18]!==i?(g=i&&o.jsx("span",{className:"text-red-500 text-xs",children:"*"}),e[18]=i,e[19]=g):g=e[19],u=v,f=14,m=O(y,"ml-auto"),e[4]=n,e[5]=s,e[6]=i,e[7]=d,e[8]=u,e[9]=f,e[10]=m,e[11]=x,e[12]=p,e[13]=g,e[14]=h}else u=e[8],f=e[9],m=e[10],x=e[11],p=e[12],g=e[13],h=e[14];let b;e[20]!==u||e[21]!==f||e[22]!==m?(b=o.jsx(u,{size:f,className:m}),e[20]=u,e[21]=f,e[22]=m,e[23]=b):b=e[23];let j;e[24]!==x||e[25]!==p||e[26]!==g||e[27]!==b?(j=o.jsxs("div",{className:x,children:[p,g,b]}),e[24]=x,e[25]=p,e[26]=g,e[27]=b,e[28]=j):j=e[28];let w;e[29]!==r?(w=r&&o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:r}),e[29]=r,e[30]=w):w=e[30];let S;return e[31]!==l||e[32]!==h||e[33]!==j||e[34]!==w?(S=o.jsxs("div",{className:h,children:[j,w,l]}),e[31]=l,e[32]=h,e[33]=j,e[34]=w,e[35]=S):S=e[35],S}function ei(t){const e=N.c(8),{properties:n,title:s}=t;if(!s||s==="Root"){let c;e[0]!==n?(c=n.map(ni),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(ti),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 ti(t){return o.jsx("div",{children:t.content},t.name)}function ni(t){return o.jsx("div",{children:t.content},t.name)}function si(t){const e=N.c(11),{items:n,canAdd:s,onAddClick:i,title:r}=t;let l;e[0]!==n?(l=n.map(oi),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(q,{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 oi(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 ri(){return null}function ii(){return null}const li={FieldTemplate:Yr,ObjectFieldTemplate:ei,ArrayFieldTemplate:si,UnsupportedFieldTemplate:ri,ErrorListTemplate:ii};function ci(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??""),m=Array.isArray(u.type)?u.type.join(" | "):u.type??"string";return o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline gap-2",children:[o.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),o.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:m})]}),u.description&&o.jsx("div",{className:"text-xs text-muted-foreground",children:u.description}),o.jsx("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-sm",children:o.jsx(Pt,{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 Xn({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(ci,{inputSchema:t,inputParams:e,mentions:l});const c=t,a=C.useRef(e??{}),d=u=>{const f=u.formData??{},m=a.current;if(n?.(f),s){for(const[x,p]of Object.entries(f))m[x]!==p&&s(x,p);for(const x of Object.keys(m))x in f||s(x,void 0)}a.current=f};return o.jsx(Ln.Provider,{value:l,children:o.jsx(Ms,{schema:c,formData:e,onChange:d,validator:As,widgets:Zr,templates:li,readonly:r,uiSchema:{"ui:submitButtonOptions":{norender:!0}},liveValidate:!1,className:"rjsf-form",omitExtraData:!0,liveOmit:!0,children:o.jsx(o.Fragment,{})})})}function ai(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 m;e[5]!==s?(m=_=>{_||d({}),s(_)},e[5]=s,e[6]=m):m=e[6];const x=m;let p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsxs(so,{children:[o.jsx(oo,{children:"Workflow Input"}),o.jsx(ro,{children:"This workflow requires input values to run. Fill in the fields below to start the execution."})]}),e[7]=p):p=e[7];let g;e[8]===Symbol.for("react.memo_cache_sentinel")?(g=[],e[8]=g):g=e[8];let h;e[9]!==a||e[10]!==i?(h=o.jsx("div",{className:"py-4",children:o.jsx(Xn,{inputSchema:i,inputParams:a,setInputParams:d,mentions:g})}),e[9]=a,e[10]=i,e[11]=h):h=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(q,{variant:"outline",onClick:b,disabled:l,children:"Cancel"}),e[14]=l,e[15]=b,e[16]=j):j=e[16];let w;e[17]!==l?(w=l?o.jsx(De,{size:"xs"}):o.jsx(Nt,{size:14}),e[17]=l,e[18]=w):w=e[18];let S;e[19]!==f||e[20]!==l||e[21]!==w?(S=o.jsxs(q,{onClick:f,disabled:l,className:"gap-2",children:[w,"Run Workflow"]}),e[19]=f,e[20]=l,e[21]=w,e[22]=S):S=e[22];let v;e[23]!==S||e[24]!==j?(v=o.jsxs(io,{children:[j,S]}),e[23]=S,e[24]=j,e[25]=v):v=e[25];let y;e[26]!==v||e[27]!==h?(y=o.jsxs(lo,{className:"sm:max-w-lg max-h-[80vh] overflow-y-auto",children:[p,h,v]}),e[26]=v,e[27]=h,e[28]=y):y=e[28];let k;return e[29]!==x||e[30]!==n||e[31]!==y?(k=o.jsx(co,{open:n,onOpenChange:x,children:y}),e[29]=x,e[30]=n,e[31]=y,e[32]=k):k=e[32],k}function di(t){const e=N.c(26),{title:n,description:s,onSave:i}=t,l=dt().location.href,{viewMode:c,setViewMode:a,showExecutionsList:d,toggleExecutionsList:u}=Mt(),{resetToOriginalWorkflow:f,setSelectedVirtualMcpId:m}=X(),x=An(),p=Ne(),g=J();let h;e[0]!==n?(h=o.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:n}),e[0]=n,e[1]=h):h=e[1];let b;e[2]!==s?(b=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]=b):b=e[3];let j;e[4]!==h||e[5]!==b?(j=o.jsx(cn,{children:o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[h,b]})}),e[4]=h,e[5]=b,e[6]=j):j=e[6];let w;e[7]!==x||e[8]!==i||e[9]!==f||e[10]!==p||e[11]!==m||e[12]!==a||e[13]!==d||e[14]!==n||e[15]!==u||e[16]!==g||e[17]!==l||e[18]!==c?(w=!g&&o.jsxs(o.Fragment,{children:[o.jsx(jt,{title:n,url:l,icon:"workflow"}),o.jsx(C.Suspense,{fallback:o.jsx(De,{size:"xs"}),children:o.jsx(Yo,{selectedVirtualMcpId:p,onVirtualMcpChange:m,placeholder:"Select Agent"})}),o.jsx(Hs,{value:c,onValueChange:a,size:"sm",options:[{value:"visual",icon:o.jsx(Vs,{})},{value:"code",icon:o.jsx(Cn,{})}]}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:f,disabled:!x,"aria-label":"Reset changes",children:o.jsx(ln,{size:14})})})}),o.jsx(re,{side:"bottom",children:"Reset changes"})]})}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:"outline",size:"icon",className:"size-7 border border-input",onClick:i,disabled:!x,"aria-label":"Save workflow",children:o.jsx(Ot,{size:14})})})}),o.jsx(re,{side:"bottom",children:"Save workflow"})]})}),o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:o.jsx(q,{variant:d?"secondary":"outline",size:"icon",className:"size-7 border border-input",onClick:u,"aria-label":d?"Hide runs":"Show runs",children:o.jsx(kn,{size:14})})})}),o.jsx(re,{side:"bottom",children:d?"Hide runs":"Show runs"})]})})]}),e[7]=x,e[8]=i,e[9]=f,e[10]=p,e[11]=m,e[12]=a,e[13]=d,e[14]=n,e[15]=u,e[16]=g,e[17]=l,e[18]=c,e[19]=w):w=e[19];let S;e[20]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(mi,{}),e[20]=S):S=e[20];let v;e[21]!==w?(v=o.jsxs(St,{children:[w,S]}),e[21]=w,e[22]=v):v=e[22];let y;return e[23]!==j||e[24]!==v?(y=o.jsxs(o.Fragment,{children:[j,v]}),e[23]=j,e[24]=v,e[25]=y):y=e[25],y}function ui(){const t=J(),{item:e}=Ce(t);return e?.completed_at_epoch_ms!=null}function fi(){const t=J(),{item:e}=Ce(t);return e?.status==="cancelled"}function mi(){const t=N.c(57),e=An(),n=ui(),s=fi(),i=J(),r=Ne(),{handleRunWorkflow:l,isPending:c,requiresInput:a,inputSchema:d}=dr(),u=$e(),[f,m]=C.useState(!1),{handleCancelWorkflow:x,isCancelling:p}=ur(),{handleResumeWorkflow:g,isResuming:h}=fr(),b=i&&!n;let j;t[0]!==u?(j=u.some(pi),t[0]=u,t[1]=j):j=t[1];const w=j,S=!r,v=e||w||S||c||p,y=b||c;let k;t[2]!==w||t[3]!==S||t[4]!==e||t[5]!==s||t[6]!==y?(k=()=>s?"Workflow is currently cancelled":y?"Workflow is currently running":e?"Save your changes before running":S?"Select an Agent first":w?"Add at least one step to the workflow":null,t[2]=w,t[3]=S,t[4]=e,t[5]=s,t[6]=y,t[7]=k):k=t[7];const $=k();let L;t[8]!==x||t[9]!==g||t[10]!==l||t[11]!==d||t[12]!==s||t[13]!==y||t[14]!==a||t[15]!==i?(L=async()=>{if(a&&d){m(!0);return}if(s&&i){await g(i);return}if(y&&i){await x(i);return}await l({})},t[8]=x,t[9]=g,t[10]=l,t[11]=d,t[12]=s,t[13]=y,t[14]=a,t[15]=i,t[16]=L):L=t[16];const R=L;let A;t[17]!==l?(A=async G=>{await l(G)},t[17]=l,t[18]=A):A=t[18];const M=A,H=s?"Resume":i?n?"Replay":"Running...":a?"Run with input...":"Run workflow",P=!b&&"bg-primary text-primary-foreground hover:bg-primary/90";let D;t[19]!==P?(D=O("gap-2 h-7 px-3",P),t[19]=P,t[20]=D):D=t[20];let I;t[21]!==p||t[22]!==s||t[23]!==c||t[24]!==h||t[25]!==b?(I=(!b&&!c&&!p&&!h||s)&&o.jsx(Nt,{size:14}),t[21]=p,t[22]=s,t[23]=c,t[24]=h,t[25]=b,t[26]=I):I=t[26];let T;t[27]!==p||t[28]!==s||t[29]!==c||t[30]!==h||t[31]!==b?(T=b&&!c&&!p&&!h&&!s&&o.jsx(Ys,{size:14}),t[27]=p,t[28]=s,t[29]=c,t[30]=h,t[31]=b,t[32]=T):T=t[32];let E;t[33]!==p||t[34]!==c||t[35]!==h?(E=(c||p||h)&&o.jsx(De,{size:"xs"}),t[33]=p,t[34]=c,t[35]=h,t[36]=E):E=t[36];let W;t[37]!==H||t[38]!==R||t[39]!==v||t[40]!==D||t[41]!==I||t[42]!==T||t[43]!==E?(W=o.jsxs(q,{variant:"default",size:"sm",className:D,disabled:v,onClick:R,children:[I,T,E,H]}),t[37]=H,t[38]=R,t[39]=v,t[40]=D,t[41]=I,t[42]=T,t[43]=E,t[44]=W):W=t[44];const K=W;let F;t[45]!==K||t[46]!==$?(F=$?o.jsx(ie,{children:o.jsxs(le,{delayDuration:0,children:[o.jsx(oe,{asChild:!0,children:o.jsx("span",{className:"inline-block",children:K})}),o.jsx(re,{side:"bottom",children:$})]})}):K,t[45]=K,t[46]=$,t[47]=F):F=t[47];const B=F;let V;t[48]!==M||t[49]!==d||t[50]!==c||t[51]!==a||t[52]!==f?(V=a&&d&&o.jsx(ai,{open:f,onOpenChange:m,inputSchema:d,onSubmit:M,isPending:c}),t[48]=M,t[49]=d,t[50]=c,t[51]=a,t[52]=f,t[53]=V):V=t[53];let z;return t[54]!==B||t[55]!==V?(z=o.jsxs(o.Fragment,{children:[B,V]}),t[54]=B,t[55]=V,t[56]=z):z=t[56],z}function pi(t){return"toolName"in t.action&&(!t.action.toolName||t.action.toolName==="")}function xi(){const t=N.c(17),e=J(),n=$e(),{item:s}=Ce(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=s.completed_steps?.success??[],t[5]=s.completed_steps?.success,t[6]=r):r=t[6];let l;t[7]!==r?(l=new Set(r),t[7]=r,t[8]=l):l=t[8];const c=l;let a;t[9]!==s.completed_steps?.error?(a=s.completed_steps?.error??[],t[9]=s.completed_steps?.error,t[10]=a):a=t[10];let d;t[11]!==a?(d=new Set(a),t[11]=a,t[12]=d):d=t[12];const u=d;let f;t[13]!==u||t[14]!==n||t[15]!==c?(f=-1,n.forEach((m,x)=>{(c.has(m.name)||u.has(m.name))&&(f=x)}),t[13]=u,t[14]=n,t[15]=c,t[16]=f):f=t[16],n.forEach((m,x)=>{let p="pending";u.has(m.name)?p="error":c.has(m.name)?p="success":s.status==="running"&&x===f+1&&(p="running"),i[m.name]={status:p,output:void 0,error:void 0,stepIndex:x}}),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 hi(t){const e=N.c(119),{step:n,index:s,isSelected:i,executionStatus:r,isSkipped:l,isLastStep:c,onSelect:a,onDelete:d,onDuplicate:u}=t,f=J(),{item:m}=Ce(f),x=m?.completed_at_epoch_ms;let p;e[0]!==m?.completed_steps?.success||e[1]!==n.name?(p=m?.completed_steps?.success?.includes(n.name)??!1,e[0]=m?.completed_steps?.success,e[1]=n.name,e[2]=p):p=e[2];const g=p;let h;e[3]!==m?.completed_steps?.error||e[4]!==n.name?(h=m?.completed_steps?.error?.includes(n.name)??!1,e[3]=m?.completed_steps?.error,e[4]=n.name,e[5]=h):h=e[5];const b=h,j="toolName"in n.action,w=j&&"connectionId"in n.action?n.action.connectionId:null,v=!!(j&&"toolName"in n.action?n.action.toolName:null);let y,k,_,$,L,R,A,M,H,P,D;if(e[6]!==w||e[7]!==r||e[8]!==v||e[9]!==s||e[10]!==g||e[11]!==b||e[12]!==c||e[13]!==i||e[14]!==l||e[15]!==j||e[16]!==d||e[17]!==u||e[18]!==a||e[19]!==n||e[20]!==f){const K=Ii(n);y=g?"success":b?"error":r?.status;const F=r!==void 0,B=y==="success"||y==="error";let V=K.length>0?60:12;(y==="success"||y==="error")&&(V=V+32);let z,G,ce;if(e[32]!==i||e[33]!==l||e[34]!==a||e[35]!==y){const Ie=ji(y);let Ee;e[44]!==y?(Ee=vi(y),e[44]=y,e[45]=Ee):Ee=e[45],z=Ee;const Ke=i&&"bg-background border-1 border-border outline outline-offset-3 outline-border/25",Je=y==="running"&&"bg-accent/50",Ge=l&&"opacity-50";e[46]!==Ke||e[47]!==Je||e[48]!==Ge?(M=O("flex gap-2 items-start border-1 border-transparent px-4 w-full rounded-lg cursor-pointer group hover:bg-accent/30",Ke,Je,Ge),e[46]=Ke,e[47]=Je,e[48]=Ge,e[49]=M):M=e[49],H=a,P="button",D=0,e[50]!==a?(k=Xe=>{(Xe.key==="Enter"||Xe.key===" ")&&(Xe.preventDefault(),a())},e[50]=a,e[51]=k):k=e[51],ce="w-5 flex flex-col items-center justify-center shrink-0 pt-3",G=O("text-xs font-mono opacity-75 h-8 flex items-center",Ie),e[32]=i,e[33]=l,e[34]=a,e[35]=y,e[36]=z,e[37]=k,e[38]=G,e[39]=ce,e[40]=M,e[41]=H,e[42]=P,e[43]=D}else z=e[36],k=e[37],G=e[38],ce=e[39],M=e[40],H=e[41],P=e[42],D=e[43];const Ue=s+1;let ae;e[52]!==G||e[53]!==Ue?(ae=o.jsxs("span",{className:G,children:[Ue,"."]}),e[52]=G,e[53]=Ue,e[54]=ae):ae=e[54],e[55]!==ce||e[56]!==ae?(_=o.jsx("div",{className:ce,children:ae}),e[55]=ce,e[56]=ae,e[57]=_):_=e[57];let de;e[58]!==z||e[59]!==s?(de=s>0?o.jsx(ot,{height:12,color:z}):o.jsx("div",{className:"h-3"}),e[58]=z,e[59]=s,e[60]=de):de=e[60];let ue;e[61]!==w||e[62]!==v||e[63]!==j||e[64]!==n.name?(ue=o.jsx(ki,{connectionId:w,isToolStep:j,hasToolSelected:v,stepName:n.name}),e[61]=w,e[62]=v,e[63]=j,e[64]=n.name,e[65]=ue):ue=e[65];let fe;e[66]!==z||e[67]!==B||e[68]!==y?(fe=B&&o.jsxs(o.Fragment,{children:[o.jsx(ot,{height:8,color:z}),o.jsx(yi,{status:y})]}),e[66]=z,e[67]=B,e[68]=y,e[69]=fe):fe=e[69];let me;e[70]!==z||e[71]!==V||e[72]!==c||e[73]!==f?(me=c&&f?null:o.jsx(ot,{height:V,color:z}),e[70]=z,e[71]=V,e[72]=c,e[73]=f,e[74]=me):me=e[74],e[75]!==de||e[76]!==ue||e[77]!==fe||e[78]!==me?($=o.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[de,ue,fe,me]}),e[75]=de,e[76]=ue,e[77]=fe,e[78]=me,e[79]=$):$=e[79],L="flex-1 flex flex-col gap-3 min-w-0 pt-3 pb-3";const qe=v?"font-medium text-foreground":"text-foreground";let pe;e[80]!==qe?(pe=O("text-sm truncate flex-1",qe),e[80]=qe,e[81]=pe):pe=e[81];let xe;e[82]!==n?(xe=Ci(n),e[82]=n,e[83]=xe):xe=e[83];let he;e[84]!==pe||e[85]!==xe?(he=o.jsx("span",{className:pe,children:xe}),e[84]=pe,e[85]=xe,e[86]=he):he=e[86];let ge;e[87]!==F||e[88]!==y?(ge=F&&o.jsx(wi,{status:y}),e[87]=F,e[88]=y,e[89]=ge):ge=e[89];let be;e[90]!==F||e[91]!==d||e[92]!==u?(be=!F&&o.jsxs(uo,{children:[o.jsx(fo,{asChild:!0,children:o.jsx(q,{variant:"ghost",size:"icon",className:"size-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",onClick:bi,children:o.jsx(ao,{size:14})})}),o.jsxs(mo,{align:"end",children:[o.jsxs(Ft,{onClick:Ie=>{Ie.stopPropagation(),u()},children:[o.jsx(ho,{size:14}),"Duplicate"]}),o.jsxs(Ft,{className:"text-destructive hover:bg-destructive/10! focus:text-destructive",onClick:Ie=>{Ie.stopPropagation(),d()},children:[o.jsx(js,{size:14,className:"text-destructive"}),"Delete"]})]})]}),e[90]=F,e[91]=d,e[92]=u,e[93]=be):be=e[93],e[94]!==he||e[95]!==ge||e[96]!==be?(R=o.jsxs("div",{className:"flex items-center h-8",children:[he,ge,be]}),e[94]=he,e[95]=ge,e[96]=be,e[97]=R):R=e[97],A=K.length>0&&o.jsx("div",{className:"flex flex-wrap gap-1.5",children:K.map(gi)}),e[6]=w,e[7]=r,e[8]=v,e[9]=s,e[10]=g,e[11]=b,e[12]=c,e[13]=i,e[14]=l,e[15]=j,e[16]=d,e[17]=u,e[18]=a,e[19]=n,e[20]=f,e[21]=y,e[22]=k,e[23]=_,e[24]=$,e[25]=L,e[26]=R,e[27]=A,e[28]=M,e[29]=H,e[30]=P,e[31]=D}else y=e[21],k=e[22],_=e[23],$=e[24],L=e[25],R=e[26],A=e[27],M=e[28],H=e[29],P=e[30],D=e[31];let I;e[98]!==x||e[99]!==y?(I=y==="success"&&o.jsx(Si,{completedAtEpochMs:x}),e[98]=x,e[99]=y,e[100]=I):I=e[100];let T;e[101]!==r?.error||e[102]!==y?(T=y==="error"&&o.jsx(Ni,{error:r?.error}),e[101]=r?.error,e[102]=y,e[103]=T):T=e[103];let E;e[104]!==I||e[105]!==T||e[106]!==L||e[107]!==R||e[108]!==A?(E=o.jsxs("div",{className:L,children:[R,A,I,T]}),e[104]=I,e[105]=T,e[106]=L,e[107]=R,e[108]=A,e[109]=E):E=e[109];let W;return e[110]!==k||e[111]!==_||e[112]!==$||e[113]!==E||e[114]!==M||e[115]!==H||e[116]!==P||e[117]!==D?(W=o.jsxs("div",{className:M,onClick:H,role:P,tabIndex:D,onKeyDown:k,children:[_,$,E]}),e[110]=k,e[111]=_,e[112]=$,e[113]=E,e[114]=M,e[115]=H,e[116]=P,e[117]=D,e[118]=W):W=e[118],W}function gi(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 bi(t){return t.stopPropagation()}function ji(t){switch(t){case"success":return"text-success";case"error":return"text-destructive";default:return"text-muted-foreground"}}function vi(t){switch(t){case"success":return"bg-success";case"error":return"bg-destructive";default:return"bg-border"}}function yi(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(_t,{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(kt,{size:8,className:"text-destructive-foreground"})}),e[1]=s):s=e[1],s}return null}function wi(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(_t,{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(kt,{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(_e,{size:11,className:"text-muted-foreground animate-spin"})}),e[2]=s):s=e[2],s}return null}function Si(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($s,{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 Ni(t){const e=N.c(3),{error:n}=t;let s;e[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx(Et,{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 ki(t){const e=N.c(5),{connectionId:n,isToolStep:s,hasToolSelected:i,stepName:r}=t,l=Ct(n??"");if(s&&i&&l?.icon){let a;return e[0]!==l.icon||e[1]!==r?(a=o.jsx("div",{className:"size-8 rounded-lg border border-border/10 bg-background shadow-sm flex items-center justify-center overflow-hidden",children:o.jsx(ze,{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($n,{size:16,className:"text-muted-foreground"}):o.jsx(xo,{size:16,className:"text-muted-foreground"})}),e[3]=s,e[4]=c):c=e[4],c}function ot(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 Ci(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 Ii(t){const e=t.outputSchema;if(!e||typeof e!="object")return[];const n=e.properties;return!n||typeof n!="object"?[]:Object.keys(n).slice(0,5)}function _i(t){const e=N.c(32),{className:n}=t,s=$e(),i=Mn(),r=xi(),{setCurrentStepName:l,deleteStep:c,duplicateStep:a}=X(),d=J();let u;e[0]!==r||e[1]!==s?(u=r?s.findIndex(w=>r[w.name]?.status==="error"):-1,e[0]=r,e[1]=s,e[2]=u):u=e[2];const f=u;let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsx("div",{children:"Loading..."}),e[3]=m):m=e[3];let 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 p;if(e[6]!==i||e[7]!==c||e[8]!==a||e[9]!==f||e[10]!==l||e[11]!==r||e[12]!==s){let w;e[14]!==i||e[15]!==c||e[16]!==a||e[17]!==f||e[18]!==l||e[19]!==r||e[20]!==s.length?(w=(S,v)=>{const y=r?.[S.name],k=f!==-1&&v>f&&y?.status==="pending",_=v===s.length-1;return o.jsx(hi,{step:S,index:v,isSelected:S.name===i,executionStatus:y,isSkipped:k,isLastStep:_,onSelect:()=>l(S.name),onDelete:()=>c(S.name),onDuplicate:()=>a(S.name)},S.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]=w):w=e[21],p=s.map(w),e[6]=i,e[7]=c,e[8]=a,e[9]=f,e[10]=l,e[11]=r,e[12]=s,e[13]=p}else p=e[13];let g;e[22]!==p?(g=o.jsx("div",{className:"pt-3 -space-y-1",children:p}),e[22]=p,e[23]=g):g=e[23];let h;e[24]!==d?(h=d?null:o.jsx(Ti,{}),e[24]=d,e[25]=h):h=e[25];let b;e[26]!==g||e[27]!==h?(b=o.jsxs("div",{className:"w-full -space-y-1",children:[g,h]}),e[26]=g,e[27]=h,e[28]=b):b=e[28];let j;return e[29]!==x||e[30]!==b?(j=o.jsx(C.Suspense,{fallback:m,children:o.jsx("div",{className:x,children:b})}),e[29]=x,e[30]=b,e[31]=j):j=e[31],j}function Ti(){const t=N.c(8),{addToolStep:e}=X();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(xn,{size:14}),t[2]=i):i=t[2];let r;t[3]!==e?(r=o.jsx(q,{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 $i(){const t=N.c(11),{org:e}=Z(),s=Ne()??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=Q(i);let l;t[3]!==r?(l={client:r},t[3]=r,t[4]=l):l=t[4];const c=ht(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 Ei(t){const e=N.c(7),{className:n}=t;if(!Ne()){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(Oi,{className:n}),e[5]=n,e[6]=i):i=e[6],i}function Oi(t){const e=N.c(38),{className:n}=t,{tools:s,isLoading:i,error:r}=$i(),l=Te(),{updateStep:c}=X(),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=y=>y.name===d,e[3]=d,e[4]=v):v=e[4],u=s.find(v),e[0]=d,e[1]=s,e[2]=u}else u=e[2];const m=pr(s,u??null,Mi,Ri);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 p=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 y;e[10]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(De,{size:"sm"})}),e[10]=y):y=e[10];let k;return e[11]!==v?(k=o.jsx("div",{className:v,children:y}),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 y;e[15]!==r.message?(y=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]=y):y=e[16];let k;return e[17]!==v||e[18]!==y?(k=o.jsx("div",{className:v,children:y}),e[17]=v,e[18]=y,e[19]=k):k=e[19],k}let g;e[20]!==n?(g=O("flex flex-col h-full bg-sidebar",n),e[20]=n,e[21]=g):g=e[21];let h;e[22]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx("span",{className:"text-base font-medium text-foreground",children:"Select tool"}),e[22]=h):h=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:[h,o.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["(",s.length,")"]})]})}),e[23]=s.length,e[24]=b):b=e[24];let j;if(e[25]!==p||e[26]!==m||e[27]!==d){let v;e[29]!==p||e[30]!==d?(v=y=>o.jsx(Ai,{icon:null,title:y.name,description:y.description,isSelected:y.name===d,onClick:()=>p(y)},y.name),e[29]=p,e[30]=d,e[31]=v):v=e[31],j=m.map(v),e[25]=p,e[26]=m,e[27]=d,e[28]=j}else j=e[28];let w;e[32]!==j?(w=o.jsx("div",{className:"flex-1 overflow-auto",children:j}),e[32]=j,e[33]=w):w=e[33];let S;return e[34]!==g||e[35]!==b||e[36]!==w?(S=o.jsxs("div",{className:g,children:[b,w]}),e[34]=g,e[35]=b,e[36]=w,e[37]=S):S=e[37],S}function Ri(t,e){return t.name.localeCompare(e.name)}function Mi(t){return t.name}function Ai(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=g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l())},e[2]=l,e[3]=d):d=e[3];let u;e[4]!==n||e[5]!==s?(u=o.jsx(ze,{icon:n,name:s,size:"xs",className:"shadow-sm mt-0.5"}),e[4]=n,e[5]=s,e[6]=u):u=e[6];let f;e[7]!==s?(f=o.jsx("span",{className:"text-sm font-medium text-foreground truncate block",children:s}),e[7]=s,e[8]=f):f=e[8];let m;e[9]!==i?(m=i&&o.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2",children:i}),e[9]=i,e[10]=m):m=e[10];let x;e[11]!==f||e[12]!==m?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[f,m]}),e[11]=f,e[12]=m,e[13]=x):x=e[13];let p;return e[14]!==l||e[15]!==a||e[16]!==d||e[17]!==u||e[18]!==x?(p=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]=p):p=e[19],p}var ee="Accordion",Pi=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Lt,Li,zi]=ys(ee),[Fe]=nn(ee,[zi,pn]),zt=pn(),Zn=U.forwardRef((t,e)=>{const{type:n,...s}=t,i=s,r=s;return o.jsx(Lt.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?o.jsx(Vi,{...r,ref:e}):o.jsx(Hi,{...i,ref:e})})});Zn.displayName=ee;var[Qn,Di]=Fe(ee),[Yn,Wi]=Fe(ee,{collapsible:!1}),Hi=U.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},collapsible:r=!1,...l}=t,[c,a]=ft({prop:n,defaultProp:s??"",onChange:i,caller:ee});return o.jsx(Qn,{scope:t.__scopeAccordion,value:U.useMemo(()=>c?[c]:[],[c]),onItemOpen:a,onItemClose:U.useCallback(()=>r&&a(""),[r,a]),children:o.jsx(Yn,{scope:t.__scopeAccordion,collapsible:r,children:o.jsx(es,{...l,ref:e})})})}),Vi=U.forwardRef((t,e)=>{const{value:n,defaultValue:s,onValueChange:i=()=>{},...r}=t,[l,c]=ft({prop:n,defaultProp:s??[],onChange:i,caller:ee}),a=U.useCallback(u=>c((f=[])=>[...f,u]),[c]),d=U.useCallback(u=>c((f=[])=>f.filter(m=>m!==u)),[c]);return o.jsx(Qn,{scope:t.__scopeAccordion,value:l,onItemOpen:a,onItemClose:d,children:o.jsx(Yn,{scope:t.__scopeAccordion,collapsible:!0,children:o.jsx(es,{...r,ref:e})})})}),[Fi,Be]=Fe(ee),es=U.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:s,dir:i,orientation:r="vertical",...l}=t,c=U.useRef(null),a=tn(c,e),d=Li(n),f=ws(i)==="ltr",m=te(t.onKeyDown,x=>{if(!Pi.includes(x.key))return;const p=x.target,g=d().filter(_=>!_.ref.current?.disabled),h=g.findIndex(_=>_.ref.current===p),b=g.length;if(h===-1)return;x.preventDefault();let j=h;const w=0,S=b-1,v=()=>{j=h+1,j>S&&(j=w)},y=()=>{j=h-1,j<w&&(j=S)};switch(x.key){case"Home":j=w;break;case"End":j=S;break;case"ArrowRight":r==="horizontal"&&(f?v():y());break;case"ArrowDown":r==="vertical"&&v();break;case"ArrowLeft":r==="horizontal"&&(f?y():v());break;case"ArrowUp":r==="vertical"&&y();break}const k=j%b;g[k].ref.current?.focus()});return o.jsx(Fi,{scope:n,disabled:s,direction:i,orientation:r,children:o.jsx(Lt.Slot,{scope:n,children:o.jsx(ut.div,{...l,"data-orientation":r,ref:a,onKeyDown:s?void 0:m})})})}),Le="AccordionItem",[Bi,Dt]=Fe(Le),ts=U.forwardRef((t,e)=>{const{__scopeAccordion:n,value:s,...i}=t,r=Be(Le,n),l=Di(Le,n),c=zt(n),a=vs(),d=s&&l.value.includes(s)||!1,u=r.disabled||t.disabled;return o.jsx(Bi,{scope:n,open:d,disabled:u,triggerId:a,children:o.jsx(eo,{"data-orientation":r.orientation,"data-state":ls(d),...c,...i,ref:e,disabled:u,open:d,onOpenChange:f=>{f?l.onItemOpen(s):l.onItemClose(s)}})})});ts.displayName=Le;var ns="AccordionHeader",ss=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=Dt(ns,n);return o.jsx(ut.h3,{"data-orientation":i.orientation,"data-state":ls(r.open),"data-disabled":r.disabled?"":void 0,...s,ref:e})});ss.displayName=ns;var at="AccordionTrigger",os=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=Dt(at,n),l=Wi(at,n),c=zt(n);return o.jsx(Lt.ItemSlot,{scope:n,children:o.jsx(no,{"aria-disabled":r.open&&!l.collapsible||void 0,"data-orientation":i.orientation,id:r.triggerId,...c,...s,ref:e})})});os.displayName=at;var rs="AccordionContent",is=U.forwardRef((t,e)=>{const{__scopeAccordion:n,...s}=t,i=Be(ee,n),r=Dt(rs,n),l=zt(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}})});is.displayName=rs;function ls(t){return t?"open":"closed"}var Ui=Zn,qi=ts,Ki=ss,Ji=os,Gi=is;function Xi(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(Ui,{"data-slot":"accordion",...n}),e[2]=n,e[3]=s):s=e[3],s}function Zi(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(qi,{"data-slot":"accordion-item",className:i,...s}),e[5]=s,e[6]=i,e[7]=r):r=e[7],r}function Qi(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(po,{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(Ki,{className:"flex",children:o.jsxs(Ji,{"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 Yi(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(Gi,{"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 el(t){const{updateStep:e}=X(),s=t&&"toolName"in t.action&&"toolName"in t.action?t.action.toolName:null,{tool:i}=Wt(s??"");t&&s&&i?.outputSchema&&(!t.outputSchema||Object.keys(t.outputSchema).length===0)&&queueMicrotask(()=>{e(t.name,{outputSchema:i.outputSchema})})}function tl(t){const e=N.c(25),{className:n}=t,s=Te(),{appendStep:i}=X();if(el(s),!s){let m;e[0]!==n?(m=O("flex flex-col h-full bg-sidebar",n),e[0]=n,e[1]=m):m=e[1];let x;e[2]!==i?(x=()=>{i({type:"tool"})},e[2]=i,e[3]=x):x=e[3];let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(xn,{size:14}),e[4]=p):p=e[4];let g;e[5]!==x?(g=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(q,{variant:"ghost",size:"icon",className:"size-7",onClick:x,children:p})]}),e[5]=x,e[6]=g):g=e[6];let h;return e[7]!==m||e[8]!==g?(h=o.jsx("div",{className:m,children:g}),e[7]=m,e[8]=g,e[9]=h):h=e[9],h}let r;e[10]!==n?(r=O("flex flex-col h-full bg-sidebar overflow-scroll",n),e[10]=n,e[11]=r):r=e[11];let l,c,a,d,u;e[12]!==s?(l=o.jsx(nl,{step:s}),c=o.jsx(ol,{step:s}),a=o.jsx(rl,{step:s}),d=o.jsx(al,{step:s}),u=o.jsx(fl,{step:s}),e[12]=s,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):(l=e[13],c=e[14],a=e[15],d=e[16],u=e[17]);let f;return e[18]!==r||e[19]!==l||e[20]!==c||e[21]!==a||e[22]!==d||e[23]!==u?(f=o.jsxs("div",{className:r,children:[l,c,a,d,u]}),e[18]=r,e[19]=l,e[20]=c,e[21]=a,e[22]=d,e[23]=u,e[24]=f):f=e[24],f}function nl(t){const e=N.c(15),{step:n}=t,i="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,r=J(),l=i??"";let c;e[0]!==l?(c=o.jsx(ze,{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(sl,{}),e[4]=r,e[5]=d):d=e[5];let u;e[6]!==c||e[7]!==a||e[8]!==d?(u=o.jsxs("div",{className:"flex items-center gap-2",children:[c,a,d]}),e[6]=c,e[7]=a,e[8]=d,e[9]=u):u=e[9];let f;e[10]!==n.description?(f=n.description&&o.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),e[10]=n.description,e[11]=f):f=e[11];let m;return e[12]!==u||e[13]!==f?(m=o.jsxs("div",{className:"border-b border-border p-5 shrink-0 flex flex-col gap-2",children:[u,f]}),e[12]=u,e[13]=f,e[14]=m):m=e[14],m}function sl(){const t=N.c(9),e=Te(),{updateStep:n,startReplacingTool:s}=X(),i=J(),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){Qt.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(Tn,{size:14}),t[6]=d):d=t[6];let u;return t[7]!==a?(u=o.jsx(q,{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 Wt(t){const e=N.c(13),{org:n}=Z(),i=Ne()??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=Q(r);let c;e[3]!==l?(c={client:l},e[3]=l,e[4]=c):c=e[4];const a=ht(c);let d;e[5]!==t||e[6]!==a.data?.tools?(d=a.data?.tools?.find(m=>m.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 ol(t){const e=N.c(13),{step:n}=t,{updateStep:s}=X(),r="toolName"in n.action&&"toolName"in n.action?n.action.toolName:null,l=J(),{tool:c}=Wt(r??"");if(!c||!c.inputSchema)return null;let a;e[0]!==n.name||e[1]!==s?(a=b=>{s(n.name,{input:b})},e[0]=n.name,e[1]=s,e[2]=a):a=e[2];const d=a,u=l?"output":"input";let f;e[3]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx(Qi,{className:"px-5 py-5",children:o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Input"})}),e[3]=f):f=e[3];const m=c.inputSchema,x=n.input;let p;e[4]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[4]=p):p=e[4];let g;e[5]!==d||e[6]!==n.name||e[7]!==m||e[8]!==x?(g=o.jsxs(Zi,{value:"input",className:"border-b-0",children:[f,o.jsx(Yi,{className:"px-5 pt-2",children:o.jsx(Xn,{inputSchema:m,inputParams:x,setInputParams:d,mentions:p},n.name)})]}),e[5]=d,e[6]=n.name,e[7]=m,e[8]=x,e[9]=g):g=e[9];let h;return e[10]!==u||e[11]!==g?(h=o.jsx(Xi,{type:"single",collapsible:!0,defaultValue:u,className:"border-b border-border shrink-0",children:g}),e[10]=u,e[11]=g,e[12]=h):h=e[12],h}function rl(t){const e=N.c(24),{step:n}=t,s=n.outputSchema,[i,r]=C.useState(!1),l=J(),{item:c}=Ce(l),a=!!(c?.completed_steps?.success?.includes(n.name)||c?.completed_steps?.error?.includes(n.name)),{output:d,error:u}=nr(l,a?n.name:void 0);let f;e[0]!==u||e[1]!==d?(f=d||(u?{error:u}:void 0),e[0]=u,e[1]=d,e[2]=f):f=e[2];const m=f,x=s&&typeof s=="object"?s.properties:void 0;let p;e[3]!==x?(p=x?Object.entries(x):[],e[3]=x,e[4]=p):p=e[4];const g=p,h=i?"flex-1 min-h-0 overflow-hidden":"shrink-0";let b;e[5]!==h?(b=O("flex flex-col border-b border-border",h),e[5]=h,e[6]=b):b=e[6];let j;e[7]!==i?(j=()=>r(!i),e[7]=i,e[8]=j):j=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 S;e[10]!==i?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[w,i?o.jsx($t,{size:14,className:"text-muted-foreground"}):o.jsx(Tt,{size:14,className:"text-muted-foreground"})]}),e[10]=i,e[11]=S):S=e[11];let v;e[12]!==j||e[13]!==S?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:j,children:S}),e[12]=j,e[13]=S,e[14]=v):v=e[14];let y;e[15]!==m||e[16]!==i||e[17]!==g||e[18]!==l?(y=i&&o.jsxs("div",{className:"flex-1 min-h-0 overflow-auto px-5",children:[l&&m?o.jsx(ye,{code:JSON.stringify(m,null,2),language:"json",height:"100%",readOnly:!0}):null,!l&&g.map(il)]}),e[15]=m,e[16]=i,e[17]=g,e[18]=l,e[19]=y):y=e[19];let k;return e[20]!==b||e[21]!==v||e[22]!==y?(k=o.jsxs("div",{className:b,children:[v,y]}),e[20]=b,e[21]=v,e[22]=y,e[23]=k):k=e[23],k}function il(t){const[e,n]=t;return o.jsx(cl,{name:e,schema:n},e)}function ll(t){switch(t){case"string":return{Icon:Sn,color:"text-blue-500"};case"number":case"integer":return{Icon:yn,color:"text-blue-500"};case"array":return{Icon:bn,color:"text-purple-500"};case"object":return{Icon:gn,color:"text-orange-500"};case"boolean":return{Icon:wn,color:"text-pink-500"};case"null":return{Icon:mt,color:"text-gray-500"};default:return{Icon:jn,color:"text-muted-foreground"}}}function cl(t){const e=N.c(28),{name:n,schema:s}=t,i=Te(),r=s.type??"unknown";let l,c,a,d,u;if(e[0]!==r){const{Icon:S,color:v}=ll(r);u="flex items-center gap-2",d="flex-1 flex items-center gap-2",l=S,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 m;e[10]!==n?(m=o.jsx("span",{className:"text-sm font-medium text-foreground",children:n}),e[10]=n,e[11]=m):m=e[11];let x;e[12]!==d||e[13]!==f||e[14]!==m?(x=o.jsxs("div",{className:d,children:[f,m]}),e[12]=d,e[13]=f,e[14]=m,e[15]=x):x=e[15];let p;e[16]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(In,{size:14,className:"opacity-50"}),e[16]=p):p=e[16];const g=i?.name;let h;e[17]!==g?(h=o.jsxs("span",{className:"text-muted-foreground",children:[g,"."]}),e[17]=g,e[18]=h):h=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]!==h||e[22]!==b?(j=o.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[p,h,b]}),e[21]=h,e[22]=b,e[23]=j):j=e[23];let w;return e[24]!==j||e[25]!==u||e[26]!==x?(w=o.jsxs("div",{className:u,children:[x,j]}),e[24]=j,e[25]=u,e[26]=x,e[27]=w):w=e[27],w}function al(t){const e=N.c(29),{step:n}=t,{updateStep:s}=X(),i=J(),[r,l]=C.useState(!1),c="toolName"in n.action,a=c&&"toolName"in n.action?n.action.toolName:null,{tool:d}=Wt(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 _=d.outputSchema,$=_.properties;return $?`interface Input {
10
- ${Object.entries($).map(R=>{const[A,M]=R,H=Me(M),L=!_.required?.includes(A);return` ${A}${L?"?":""}: ${H};`}).join(`
10
+ ${Object.entries($).map(R=>{const[A,M]=R,H=Me(M),P=!_.required?.includes(A);return` ${A}${P?"?":""}: ${H};`}).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:$}}),l(dl)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const p=x;let g;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(g=(_,$)=>{s(n.name,{action:{...n.action,transformCode:_},...$?{outputSchema:$}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=g):g=e[10];const h=g;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 w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=w):w=e[13];let S;e[14]!==r?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[w,r?o.jsx(Tt,{size:14,className:"text-muted-foreground"}):o.jsx(_t,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=S):S=e[15];let v;e[16]!==S||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:S}),e[16]=S,e[17]=p,e[18]=v):v=e[18];let y;e[19]!==h||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(y=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(ye,{code:u,language:"typescript",readOnly:i!==void 0,onSave:h,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=h,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=y):y=e[24];let k;return e[25]!==j||e[26]!==v||e[27]!==y?(k=o.jsxs("div",{className:j,children:[v,y]}),e[25]=j,e[26]=v,e[27]=y,e[28]=k):k=e[28],k}function dl(t){return!t}function ul(t){return!t}function fl(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=X(),l="code"in n.action&&n.action.code?n.action.code:null,c=J();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,w)=>{r(n.name,{action:{...n.action,code:j},...w?{outputSchema:w}:{}})},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 m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=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 p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx(Tt,{size:14,className:"text-muted-foreground"}):o.jsx(_t,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let g;e[11]!==m||e[12]!==p?(g=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=g):g=e[13];let h;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(h=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(ye,{onSave:(j,w)=>d(j,w),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]=h):h=e[19];let b;return e[20]!==f||e[21]!==g||e[22]!==h?(b=o.jsxs("div",{className:f,children:[g,h]}),e[20]=f,e[21]=g,e[22]=h,e[23]=b):b=e[23],b}function Me(t){if(Array.isArray(t.type))return t.type.map(n=>Me({...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?`${Me(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Me(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function ml(t){switch(t){case"success":return o.jsxs(je,{variant:"success",className:"gap-1",children:[o.jsx(It,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(je,{variant:"destructive",className:"gap-1",children:[o.jsx($t,{size:11}),"Error"]});case"running":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),"Running"]});case"enqueued":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),"On hold"]});case"cancelled":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(un,{size:11}),"Cancelled"]});default:return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),t]})}}function pl(t){return`Run #${t.slice(-4).toUpperCase()}`}function xl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=or(),{setShowExecutionsList:r}=Rt(),{setTrackingExecutionId:l}=X(),c=J();let a;e[0]!==l?(a=w=>{l(w)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=O("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=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 p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(un,{size:11}),e[7]=p):p=e[7];let g;e[8]!==f?(g=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(q,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=g):g=e[9];let h;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(h=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((w,S)=>o.jsx(hl,{execution:w,isSelected:w.id===c,isFirst:S===0,onSelect:()=>d(w.id)},w.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=h):h=e[14];let b;e[15]!==h?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:h}),e[15]=h,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==g||e[19]!==b?(j=o.jsxs("div",{className:m,children:[g,b]}),e[17]=m,e[18]=g,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=ml(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=pl(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let x;e[10]!==u||e[11]!==m?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=x):x=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==x?(p=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=p):p=e[16],p}function gl(t){const e=N.c(10),{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}=se(s),r=i??"no-connection",{org:l}=Z(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=Q(a),u=mt(r,"WORKFLOW",n,d),f=pt(r,"WORKFLOW",d);let m;e[4]!==f||e[5]!==n?(m=async g=>{await f.update.mutateAsync({id:n,data:g})},e[4]=f,e[5]=n,e[6]=m):m=e[6];const x=m;let p;return e[7]!==u||e[8]!==x?(p={item:u,update:x},e[7]=u,e[8]=x,e[9]=p):p=e[9],p}function bl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=X();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=ye,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function jl(){const t=N.c(12),{setTrackingExecutionId:e}=X(),n=J();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(bs,{className:"w-4 h-4 text-muted-foreground"})}),t[0]=s):s=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[1]=i):i=t[1];let r;t[2]!==n?(r=o.jsxs("div",{className:"flex items-center h-full",children:[s,o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[i,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]})]}),t[2]=n,t[3]=r):r=t[3];let l;t[4]!==e?(l=()=>e(void 0),t[4]=e,t[5]=l):l=t[5];let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(ft,{className:"w-4 h-4 text-muted-foreground"}),t[6]=c):c=t[6];let a;t[7]!==l?(a=o.jsx(q,{variant:"ghost",size:"xs",onClick:l,children:c}),t[7]=l,t[8]=a):a=t[8];let d;return t[9]!==r||t[10]!==a?(d=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[r,a]}),t[9]=r,t[10]=a,t[11]=d):d=t[11],d}function vl(t){const e=N.c(17),{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}=se(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c}=gl(r);let a;e[3]!==l?(a=JSON.stringify(l),e[3]=l,e[4]=a):a=e[4];const d=a;if(!l){let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(Ct,{icon:o.jsx(xn,{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]=x):x=e[5];let p;return e[6]!==n?(p=o.jsx(ve,{onBack:n,children:x}),e[6]=n,e[7]=p):p=e[7],p}let u;e[8]!==l?(u={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=u):u=e[9];let f;e[10]!==n||e[11]!==c?(f=o.jsx(yl,{onBack:n,onUpdate:c}),e[10]=n,e[11]=c,e[12]=f):f=e[12];let m;return e[13]!==d||e[14]!==u||e[15]!==f?(m=o.jsx(Bo,{initialState:u,children:f},d),e[13]=d,e[14]=u,e[15]=f,e[16]=m):m=e[16],m}function yl(t){const e=N.c(24),{onBack:n,onUpdate:s}=t,i=Se(),r=J(),{setOriginalWorkflow:l}=X(),{viewMode:c,showExecutionsList:a}=Rt(),d=Te();let u;e[0]!==s||e[1]!==l||e[2]!==i?(u=async()=>{await s(i),l(i)},e[0]=s,e[1]=l,e[2]=i,e[3]=u):u=e[3];const f=u,m=d&&"toolName"in d.action,x=m?d.action.toolName:null,p=m&&!x&&!r,g=!p&&(d||r||!a);let h;e[4]!==f||e[5]!==i.description||e[6]!==i.title?(h=o.jsx(di,{title:i.title,description:i.description,onSave:f}),e[4]=f,e[5]=i.description,e[6]=i.title,e[7]=h):h=e[7];let b;e[8]!==r?(b=r&&o.jsx(jl,{}),e[8]=r,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==g||e[13]!==p||e[14]!==c||e[15]!==i?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(bl,{workflow:i,onUpdate:s}):o.jsxs(Ms,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(Wt,{defaultSize:50,minSize:30,children:o.jsx(_i,{})}),o.jsx(As,{}),o.jsxs(Wt,{defaultSize:50,minSize:25,children:[p&&o.jsx(Ei,{className:"border-l border-border"}),a&&o.jsx(xl,{}),g&&o.jsx(tl,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=g,e[13]=p,e[14]=c,e[15]=i,e[16]=j):j=e[16];let w;e[17]!==h||e[18]!==b||e[19]!==j?(w=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[h,b,j]}),e[17]=h,e[18]=b,e[19]=j,e[20]=w):w=e[20];let S;return e[21]!==n||e[22]!==w?(S=o.jsx(ve,{onBack:n,children:w}),e[21]=n,e[22]=w,e[23]=S):S=e[23],S}function wl(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}=se(s),l=mt(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 Sl(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}=se(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=wl(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(Ct,{icon:o.jsx(xn,{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(ve,{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(ye,{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(ve,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Nl={workflow:vl,workflow_execution:Sl,prompt:So};function kl(){const t=N.c(6),e=nn();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=se(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=Cl;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Eo,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Cl(t){return Promise.resolve()}function Il(){const t=N.c(19),e=nn();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=se(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}=Z(),f=i??null;let m;t[3]!==u.id||t[4]!==f?(m={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=m):m=t[5];const x=Q(m),p=pt(d,r,x);let g;t[6]!==p||t[7]!==l?(g=async y=>{l&&await p.update.mutateAsync({id:l,data:y})},t[6]=p,t[7]=l,t[8]=g):g=t[8];const h=g;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,w=j&&Nl[j];if(w){let y;return t[11]!==w||t[12]!==a||t[13]!==h||t[14]!==l?(y=o.jsx(w,{itemId:l,onBack:a,onUpdate:h}),t[11]=w,t[12]=a,t[13]=h,t[14]=l,t[15]=y):y=t[15],y}let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(js,{size:36,className:"text-muted-foreground"}),t[16]=S):S=t[16];let v;return t[17]!==a?(v=o.jsx(Ct,{icon:S,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 _l(){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=se(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(kl,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Il,{}),t[2]=r):r=t[2],r}function Bc(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(on,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(_e,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_l,{})})}),t[0]=e):e=t[0],e}export{Bc as default};
26
+ }`;s(n.name,{action:{...n.action,transformCode:$}}),l(dl)},e[2]=m,e[3]=n.action,e[4]=n.name,e[5]=s,e[6]=x):x=e[6];const p=x;let g;e[7]!==n.action||e[8]!==n.name||e[9]!==s?(g=(_,$)=>{s(n.name,{action:{...n.action,transformCode:_},...$?{outputSchema:$}:{}})},e[7]=n.action,e[8]=n.name,e[9]=s,e[10]=g):g=e[10];const h=g;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 w;e[13]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Transform Code"}),e[13]=w):w=e[13];let S;e[14]!==r?(S=o.jsxs("div",{className:"flex items-center justify-between",children:[w,r?o.jsx($t,{size:14,className:"text-muted-foreground"}):o.jsx(Tt,{size:14,className:"text-muted-foreground"})]}),e[14]=r,e[15]=S):S=e[15];let v;e[16]!==S||e[17]!==p?(v=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:p,children:S}),e[16]=S,e[17]=p,e[18]=v):v=e[18];let y;e[19]!==h||e[20]!==r||e[21]!==n.name||e[22]!==i||e[23]!==u?(y=r&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(ye,{code:u,language:"typescript",readOnly:i!==void 0,onSave:h,height:"100%"},`transform-code-${n.name}-${i}`)}),e[19]=h,e[20]=r,e[21]=n.name,e[22]=i,e[23]=u,e[24]=y):y=e[24];let k;return e[25]!==j||e[26]!==v||e[27]!==y?(k=o.jsxs("div",{className:j,children:[v,y]}),e[25]=j,e[26]=v,e[27]=y,e[28]=k):k=e[28],k}function dl(t){return!t}function ul(t){return!t}function fl(t){const e=N.c(24),{step:n}=t,[s,i]=C.useState(!1),{updateStep:r}=X(),l="code"in n.action&&n.action.code?n.action.code:null,c=J();let a;e[0]!==n.action||e[1]!==n.name||e[2]!==r?(a=(j,w)=>{r(n.name,{action:{...n.action,code:j},...w?{outputSchema:w}:{}})},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 m;e[6]!==s?(m=()=>i(!s),e[6]=s,e[7]=m):m=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 p;e[9]!==s?(p=o.jsxs("div",{className:"flex items-center justify-between",children:[x,s?o.jsx($t,{size:14,className:"text-muted-foreground"}):o.jsx(Tt,{size:14,className:"text-muted-foreground"})]}),e[9]=s,e[10]=p):p=e[10];let g;e[11]!==m||e[12]!==p?(g=o.jsx("div",{className:"p-5 shrink-0 cursor-pointer hover:bg-accent/50 transition-colors",onClick:m,children:p}),e[11]=m,e[12]=p,e[13]=g):g=e[13];let h;e[14]!==l||e[15]!==d||e[16]!==s||e[17]!==n.name||e[18]!==c?(h=s&&o.jsx("div",{className:"flex-1 min-h-0",children:o.jsx(ye,{onSave:(j,w)=>d(j,w),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]=h):h=e[19];let b;return e[20]!==f||e[21]!==g||e[22]!==h?(b=o.jsxs("div",{className:f,children:[g,h]}),e[20]=f,e[21]=g,e[22]=h,e[23]=b):b=e[23],b}function Me(t){if(Array.isArray(t.type))return t.type.map(n=>Me({...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?`${Me(t.items)}[]`:"unknown[]";case"object":return t.properties?`{ ${Object.entries(t.properties).map(([s,i])=>{const r=Me(i),l=!t.required?.includes(s);return`${s}${l?"?":""}: ${r}`}).join("; ")} }`:"Record<string, unknown>";case"null":return"null";default:return"unknown"}}function ml(t){switch(t){case"success":return o.jsxs(je,{variant:"success",className:"gap-1",children:[o.jsx(_t,{size:11}),"Success"]});case"error":case"failed":return o.jsxs(je,{variant:"destructive",className:"gap-1",children:[o.jsx(Et,{size:11}),"Error"]});case"running":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),"Running"]});case"enqueued":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),"On hold"]});case"cancelled":return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(hn,{size:11}),"Cancelled"]});default:return o.jsxs(je,{variant:"secondary",className:"gap-1",children:[o.jsx(Re,{size:11}),t]})}}function pl(t){return`Run #${t.slice(-4).toUpperCase()}`}function xl(t){const e=N.c(21),{className:n}=t,{executions:s,isLoading:i}=or(),{setShowExecutionsList:r}=Mt(),{setTrackingExecutionId:l}=X(),c=J();let a;e[0]!==l?(a=w=>{l(w)},e[0]=l,e[1]=a):a=e[1];const d=a;let u;e[2]!==r?(u=()=>{r(!1)},e[2]=r,e[3]=u):u=e[3];const f=u;let m;e[4]!==n?(m=O("flex flex-col h-full bg-sidebar border-l border-border",n),e[4]=n,e[5]=m):m=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 p;e[7]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx(hn,{size:11}),e[7]=p):p=e[7];let g;e[8]!==f?(g=o.jsxs("div",{className:"flex items-center h-12 px-5 border-b border-border shrink-0",children:[x,o.jsx(q,{variant:"ghost",size:"icon",className:"size-7",onClick:f,children:p})]}),e[8]=f,e[9]=g):g=e[9];let h;e[10]!==s||e[11]!==d||e[12]!==i||e[13]!==c?(h=i?o.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading executions..."}):s.map((w,S)=>o.jsx(hl,{execution:w,isSelected:w.id===c,isFirst:S===0,onSelect:()=>d(w.id)},w.id)),e[10]=s,e[11]=d,e[12]=i,e[13]=c,e[14]=h):h=e[14];let b;e[15]!==h?(b=o.jsx("div",{className:"flex-1 overflow-auto",children:h}),e[15]=h,e[16]=b):b=e[16];let j;return e[17]!==m||e[18]!==g||e[19]!==b?(j=o.jsxs("div",{className:m,children:[g,b]}),e[17]=m,e[18]=g,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=ml(n.status),e[4]=n.status,e[5]=u):u=e[5];let f;e[6]!==n.id?(f=pl(n.id),e[6]=n.id,e[7]=f):f=e[7];let m;e[8]!==f?(m=o.jsx("p",{className:"flex-1 text-base font-medium text-foreground",children:f}),e[8]=f,e[9]=m):m=e[9];let x;e[10]!==u||e[11]!==m?(x=o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[u,m]}),e[10]=u,e[11]=m,e[12]=x):x=e[12];let p;return e[13]!==r||e[14]!==d||e[15]!==x?(p=o.jsx("div",{className:d,onClick:r,children:x}),e[13]=r,e[14]=d,e[15]=x,e[16]=p):p=e[16],p}function gl(t){const e=N.c(10),{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}=se(s),r=i??"no-connection",{org:l}=Z(),c=i??null;let a;e[1]!==l.id||e[2]!==c?(a={connectionId:c,orgId:l.id},e[1]=l.id,e[2]=c,e[3]=a):a=e[3];const d=Q(a),u=pt(r,"WORKFLOW",n,d),f=xt(r,"WORKFLOW",d);let m;e[4]!==f||e[5]!==n?(m=async g=>{await f.update.mutateAsync({id:n,data:g})},e[4]=f,e[5]=n,e[6]=m):m=e[6];const x=m;let p;return e[7]!==u||e[8]!==x?(p={item:u,update:x},e[7]=u,e[8]=x,e[9]=p):p=e[9],p}function bl(t){const e=N.c(18),{workflow:n,onUpdate:s}=t,{setWorkflow:i}=X();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=ye,l=`workflow-${n.id}`,c="100%",a=JSON.stringify(f,null,2),e[0]=n.description,e[1]=n.id,e[2]=n.steps,e[3]=n.title,e[4]=r,e[5]=l,e[6]=c,e[7]=a}else r=e[4],l=e[5],c=e[6],a=e[7];let d;e[8]!==s||e[9]!==i||e[10]!==n?(d=f=>{const m=JSON.parse(f);i({...n,...m}),s(m)},e[8]=s,e[9]=i,e[10]=n,e[11]=d):d=e[11];let u;return e[12]!==r||e[13]!==l||e[14]!==c||e[15]!==a||e[16]!==d?(u=o.jsx(r,{height:c,code:a,language:"json",onSave:d},l),e[12]=r,e[13]=l,e[14]=c,e[15]=a,e[16]=d,e[17]=u):u=e[17],u}function jl(){const t=N.c(12),{setTrackingExecutionId:e}=X(),n=J();let s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx("div",{className:"flex items-center justify-center h-full w-12",children:o.jsx(Ss,{className:"w-4 h-4 text-muted-foreground"})}),t[0]=s):s=t[0];let i;t[1]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("strong",{className:"text-base text-foreground",children:"Run"}),t[1]=i):i=t[1];let r;t[2]!==n?(r=o.jsxs("div",{className:"flex items-center h-full",children:[s,o.jsxs("p",{className:"flex gap-3 items-center h-full",children:[i,o.jsxs("span",{className:"text-sm text-muted-foreground",children:["#",n]})]})]}),t[2]=n,t[3]=r):r=t[3];let l;t[4]!==e?(l=()=>e(void 0),t[4]=e,t[5]=l):l=t[5];let c;t[6]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx(mt,{className:"w-4 h-4 text-muted-foreground"}),t[6]=c):c=t[6];let a;t[7]!==l?(a=o.jsx(q,{variant:"ghost",size:"xs",onClick:l,children:c}),t[7]=l,t[8]=a):a=t[8];let d;return t[9]!==r||t[10]!==a?(d=o.jsxs("div",{className:"h-10 bg-accent flex items-center justify-between border-b border-border",children:[r,a]}),t[9]=r,t[10]=a,t[11]=d):d=t[11],d}function vl(t){const e=N.c(17),{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}=se(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l,update:c}=gl(r);let a;e[3]!==l?(a=JSON.stringify(l),e[3]=l,e[4]=a):a=e[4];const d=a;if(!l){let x;e[5]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"flex h-full w-full bg-background",children:o.jsx(It,{icon:o.jsx(vn,{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]=x):x=e[5];let p;return e[6]!==n?(p=o.jsx(ve,{onBack:n,children:x}),e[6]=n,e[7]=p):p=e[7],p}let u;e[8]!==l?(u={workflow:l,trackingExecutionId:void 0,currentStepTab:"input"},e[8]=l,e[9]=u):u=e[9];let f;e[10]!==n||e[11]!==c?(f=o.jsx(yl,{onBack:n,onUpdate:c}),e[10]=n,e[11]=c,e[12]=f):f=e[12];let m;return e[13]!==d||e[14]!==u||e[15]!==f?(m=o.jsx(Bo,{initialState:u,children:f},d),e[13]=d,e[14]=u,e[15]=f,e[16]=m):m=e[16],m}function yl(t){const e=N.c(24),{onBack:n,onUpdate:s}=t,i=Se(),r=J(),{setOriginalWorkflow:l}=X(),{viewMode:c,showExecutionsList:a}=Mt(),d=Te();let u;e[0]!==s||e[1]!==l||e[2]!==i?(u=async()=>{await s(i),l(i)},e[0]=s,e[1]=l,e[2]=i,e[3]=u):u=e[3];const f=u,m=d&&"toolName"in d.action,x=m?d.action.toolName:null,p=m&&!x&&!r,g=!p&&(d||r||!a);let h;e[4]!==f||e[5]!==i.description||e[6]!==i.title?(h=o.jsx(di,{title:i.title,description:i.description,onSave:f}),e[4]=f,e[5]=i.description,e[6]=i.title,e[7]=h):h=e[7];let b;e[8]!==r?(b=r&&o.jsx(jl,{}),e[8]=r,e[9]=b):b=e[9];let j;e[10]!==s||e[11]!==a||e[12]!==g||e[13]!==p||e[14]!==c||e[15]!==i?(j=o.jsx("div",{className:"flex-1 overflow-hidden",children:c==="code"?o.jsx(bl,{workflow:i,onUpdate:s}):o.jsxs(Ds,{direction:"horizontal",className:"flex w-full h-full",children:[o.jsx(Ht,{defaultSize:50,minSize:30,children:o.jsx(_i,{})}),o.jsx(Ws,{}),o.jsxs(Ht,{defaultSize:50,minSize:25,children:[p&&o.jsx(Ei,{className:"border-l border-border"}),a&&o.jsx(xl,{}),g&&o.jsx(tl,{className:"border-l border-border"})]})]})}),e[10]=s,e[11]=a,e[12]=g,e[13]=p,e[14]=c,e[15]=i,e[16]=j):j=e[16];let w;e[17]!==h||e[18]!==b||e[19]!==j?(w=o.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[h,b,j]}),e[17]=h,e[18]=b,e[19]=j,e[20]=w):w=e[20];let S;return e[21]!==n||e[22]!==w?(S=o.jsx(ve,{onBack:n,children:w}),e[21]=n,e[22]=w,e[23]=S):S=e[23],S}function wl(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}=se(s),l=pt(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 Sl(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}=se(s);let r;e[1]!==i?(r={itemId:i},e[1]=i,e[2]=r):r=e[2];const{item:l}=wl(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(It,{icon:o.jsx(vn,{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(ve,{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(ye,{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(ve,{onBack:n,children:a}),e[10]=n,e[11]=a,e[12]=d):d=e[12],d}const Nl={workflow:vl,workflow_execution:Sl,prompt:So};function kl(){const t=N.c(6),e=sn();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=se(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=Cl;let a;return t[3]!==l||t[4]!==i?(a=o.jsx(Eo,{itemId:i,onBack:l,onUpdate:c}),t[3]=l,t[4]=i,t[5]=a):a=t[5],a}async function Cl(t){return Promise.resolve()}function Il(){const t=N.c(19),e=sn();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=se(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}=Z(),f=i??null;let m;t[3]!==u.id||t[4]!==f?(m={connectionId:f,orgId:u.id},t[3]=u.id,t[4]=f,t[5]=m):m=t[5];const x=Q(m),p=xt(d,r,x);let g;t[6]!==p||t[7]!==l?(g=async y=>{l&&await p.update.mutateAsync({id:l,data:y})},t[6]=p,t[7]=l,t[8]=g):g=t[8];const h=g;let b;t[9]!==r?(b=r?.toLowerCase(),t[9]=r,t[10]=b):b=t[10];const j=b,w=j&&Nl[j];if(w){let y;return t[11]!==w||t[12]!==a||t[13]!==h||t[14]!==l?(y=o.jsx(w,{itemId:l,onBack:a,onUpdate:h}),t[11]=w,t[12]=a,t[13]=h,t[14]=l,t[15]=y):y=t[15],y}let S;t[16]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ns,{size:36,className:"text-muted-foreground"}),t[16]=S):S=t[16];let v;return t[17]!==a?(v=o.jsx(It,{icon:S,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 _l(){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=se(e);if(decodeURIComponent(n.collectionName)==="tools"){let l;return t[1]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx(kl,{}),t[1]=l):l=t[1],l}let r;return t[2]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Il,{}),t[2]=r):r=t[2],r}function Bc(){const t=N.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(rn,{children:o.jsx(C.Suspense,{fallback:o.jsx("div",{className:"flex h-full items-center justify-center",children:o.jsx(_e,{size:32,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_l,{})})}),t[0]=e):e=t[0],e}export{Bc as default};