decocms 2.304.11 → 2.304.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DNXZvA9j.js → AlertCircle-DykTdePm.js} +1 -1
- package/dist/client/assets/{ArrowNarrowLeft-Gm4Xkvpy.js → ArrowNarrowLeft-BSnqV9Qp.js} +1 -1
- package/dist/client/assets/{ArrowUpRight-O3jikuh3.js → ArrowUpRight-BbCrxIiB.js} +1 -1
- package/dist/client/assets/{CheckCircle-H4V25dcS.js → CheckCircle-dpfQl31_.js} +1 -1
- package/dist/client/assets/{ChevronDown-Ce2OjGrT.js → ChevronDown-ChKIyEYX.js} +1 -1
- package/dist/client/assets/{ChevronRight-DM5N13PI.js → ChevronRight-CfxVPCJg.js} +1 -1
- package/dist/client/assets/{ChevronUp-CyPLVPf1.js → ChevronUp-DrgxDzSb.js} +1 -1
- package/dist/client/assets/{Container-COQnfxdW.js → Container-BmeFpotW.js} +1 -1
- package/dist/client/assets/{DotsVertical-CyXt8PT9.js → DotsVertical-Dpo2lfzf.js} +1 -1
- package/dist/client/assets/{LinkExternal01-foB2b2ju.js → LinkExternal01-BFenb5P9.js} +1 -1
- package/dist/client/assets/{Lock01-ucerLi_m.js → Lock01-D4wd-Mt0.js} +1 -1
- package/dist/client/assets/{Palette-CWS5P_Bb.js → Palette-DWycQqah.js} +1 -1
- package/dist/client/assets/{Play-B0qxiwIM.js → Play-3GU5tyK6.js} +1 -1
- package/dist/client/assets/{Plus-CXt-F95f.js → Plus-DNS-JW4m.js} +1 -1
- package/dist/client/assets/{RefreshCcw01-CvllgBGg.js → RefreshCcw01-U2jJl9XZ.js} +1 -1
- package/dist/client/assets/{SearchMd-mJ3-Y6pi.js → SearchMd-CJRrkj_7.js} +1 -1
- package/dist/client/assets/{Settings02-CZXBZ9dp.js → Settings02-BfZESxtt.js} +1 -1
- package/dist/client/assets/{Shield01-DSEVwFlT.js → Shield01-CuEoE6Cq.js} +1 -1
- package/dist/client/assets/{Star01-Kt9eAOrx.js → Star01-BIiXL1NH.js} +1 -1
- package/dist/client/assets/{Sun-DHxk_oDq.js → Sun-DJvU306F.js} +1 -1
- package/dist/client/assets/{Tool01-D7BUXrGA.js → Tool01-B3jB5-GF.js} +1 -1
- package/dist/client/assets/{Trash01-CpZ82qo1.js → Trash01-DygHC0Or.js} +1 -1
- package/dist/client/assets/{User01-BXHi1zAw.js → User01-XcdTTiqO.js} +1 -1
- package/dist/client/assets/{Users03-CxpjXo7-.js → Users03-CdkPI2qt.js} +1 -1
- package/dist/client/assets/{X-Cesxj0TS.js → X-CaSicsGt.js} +1 -1
- package/dist/client/assets/{XCircle-KN03fplT.js → XCircle-CAjnYXMv.js} +1 -1
- package/dist/client/assets/{XClose-DFrrxeI9.js → XClose-BD0-I41d.js} +1 -1
- package/dist/client/assets/{Zap-BBJ66Grg.js → Zap-DSo0BijB.js} +1 -1
- package/dist/client/assets/{ZapSquare-DQMHM_Az.js → ZapSquare-DJjYeaGT.js} +1 -1
- package/dist/client/assets/{accordion-ENyIrry_.js → accordion-NFEtlqmu.js} +1 -1
- package/dist/client/assets/{agent-icon-DH1erOLo.js → agent-icon-2WwvMIOR.js} +1 -1
- package/dist/client/assets/{agents-list-CRVayb3p.js → agents-list-B3NTdokI.js} +1 -1
- package/dist/client/assets/ai-providers-cvctUcOl.js +1 -0
- package/dist/client/assets/{alert-dialog-DisfPNds.js → alert-dialog-CczJ0CiT.js} +1 -1
- package/dist/client/assets/{auth-catchall-C7X3aqDL.js → auth-catchall-D2VjSNCY.js} +1 -1
- package/dist/client/assets/{automation-list-row-B6R4hbWU.js → automation-list-row-BM66xXdA.js} +1 -1
- package/dist/client/assets/{automations-B-eBYWeh.js → automations-CENOzqx0.js} +1 -1
- package/dist/client/assets/{avatar-BjZ78dvf.js → avatar-XLD41nT1.js} +1 -1
- package/dist/client/assets/{badge-Bu2pzpRI.js → badge-CqM8ft8a.js} +1 -1
- package/dist/client/assets/{brand-context-BRZXdXIg.js → brand-context-DawPDVwK.js} +1 -1
- package/dist/client/assets/{card-Di2QvueV.js → card-BromnR4D.js} +1 -1
- package/dist/client/assets/{chat-context-C7xeFwbj.js → chat-context-C1cX954x.js} +1 -1
- package/dist/client/assets/{checkbox-BLyNIdWA.js → checkbox-q02yCTCr.js} +1 -1
- package/dist/client/assets/{collection-detail-BubZksKa.js → collection-detail-CuW2SK0p.js} +1 -1
- package/dist/client/assets/{collection-display-button-Ig89UA5W.js → collection-display-button-Cz_4oQot.js} +1 -1
- package/dist/client/assets/{collection-search-73ZE_Rxd.js → collection-search-BwqJnK6o.js} +1 -1
- package/dist/client/assets/{collection-search-BjTSjOvQ.js → collection-search-l5AWFuzp.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-BDcCK68t.js → collection-table-wrapper-BlzCLLAo.js} +1 -1
- package/dist/client/assets/{collection-tabs-afccA05T.js → collection-tabs-yGBJSAc8.js} +1 -1
- package/dist/client/assets/{collections-BM6Z8nGc.js → collections-Bdy_Kvem.js} +1 -1
- package/dist/client/assets/{command-Dul__cSK.js → command-Dm5FUYzy.js} +1 -1
- package/dist/client/assets/{connection-card-bt811v_C.js → connection-card-Bpj8ZSs7.js} +1 -1
- package/dist/client/assets/{connection-detail-BvIlLD4t.js → connection-detail-w6Hswx6I.js} +1 -1
- package/dist/client/assets/{connection-form-helpers-DeGnXv9z.js → connection-form-helpers-_eiZ9Dyj.js} +1 -1
- package/dist/client/assets/{connections-Cvi8bJGK.js → connections-ZzdUySRj.js} +1 -1
- package/dist/client/assets/{constants-CCFSt8jO.js → constants-CqYb75aZ.js} +1 -1
- package/dist/client/assets/{constants-HOfKPHDy.js → constants-DoDQutb_.js} +1 -1
- package/dist/client/assets/{dialog-BHi9STqD.js → dialog-Cv4ROuD1.js} +1 -1
- package/dist/client/assets/{domain-settings-CJTT8u55.js → domain-settings-CcBopmCQ.js} +1 -1
- package/dist/client/assets/{drawer-CFPIi-pq.js → drawer-BvCmaZEN.js} +1 -1
- package/dist/client/assets/{dropdown-menu-ChEDfeWm.js → dropdown-menu-CXpZ_ns-.js} +1 -1
- package/dist/client/assets/{dynamic-plugin-layout-ChPVfvIn.js → dynamic-plugin-layout-DQ5UtKMf.js} +1 -1
- package/dist/client/assets/{empty-state-CgXa2kei.js → empty-state-BBjIyjuI.js} +1 -1
- package/dist/client/assets/{empty-state-ad634-a1.js → empty-state-BQm2cEn7.js} +1 -1
- package/dist/client/assets/{extract-connection-data-CNS4342G.js → extract-connection-data-DRmUoKq6.js} +1 -1
- package/dist/client/assets/{features-CBSonKCO.js → features-BN-47yPZ.js} +1 -1
- package/dist/client/assets/{form-O7o12XKC.js → form-vv7czlx-.js} +1 -1
- package/dist/client/assets/{general-Dwl_RFxT.js → general-GwVabcuc.js} +1 -1
- package/dist/client/assets/{index-BpQvm0m_.js → index-BTPvxzW6.js} +1 -1
- package/dist/client/assets/{index-DRxD_3cb.js → index-BizHATMB.js} +1 -1
- package/dist/client/assets/{index-CV1lFX-Z.js → index-Byh16eae.js} +2 -2
- package/dist/client/assets/{index-D-vg00dg.js → index-C89IjMPF.js} +1 -1
- package/dist/client/assets/{index-CG8wxlmz.js → index-CAszNWEi.js} +1 -1
- package/dist/client/assets/{index-CUeJKjUo.js → index-CO-xtUtF.js} +1 -1
- package/dist/client/assets/{index-BRREdYdm.js → index-ChEPbjgU.js} +1 -1
- package/dist/client/assets/{index-BQPKIoNa.js → index-D7GdEVK0.js} +1 -1
- package/dist/client/assets/{index-DBW0tfwB.js → index-DAmwYTvH.js} +1 -1
- package/dist/client/assets/index-DEcDMso8.js +1 -0
- package/dist/client/assets/{index-D7CuHsQA.js → index-DHQaot3v.js} +1 -1
- package/dist/client/assets/{index-CLd1VMk-.js → index-DIMB4WE0.js} +1 -1
- package/dist/client/assets/{index-D4EXGfoG.js → index-MijQYZKH.js} +3 -3
- package/dist/client/assets/{index-B4HzWryX.js → index-Qw9LGy6b.js} +1 -1
- package/dist/client/assets/{index-CP6bD0QO.js → index-YHRzikDj.js} +1 -1
- package/dist/client/assets/{index-Do1XArQs.js → index-ao7NoSNv.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-BVAzy1Sk.js → infiniteQueryObserver-CeXFUdTd.js} +1 -1
- package/dist/client/assets/{input-CN-FAUiT.js → input-Vak5VRqX.js} +1 -1
- package/dist/client/assets/{integration-icon-tJ5Z1ZtK.js → integration-icon-qqFh_bDX.js} +1 -1
- package/dist/client/assets/{label-PUMmND_r.js → label-BNsXufvU.js} +1 -1
- package/dist/client/assets/{layout-Bqbj2wLY.js → layout-l92_NVlz.js} +1 -1
- package/dist/client/assets/{lean-canvas-recruit-modal-ywtX7ECZ.js → lean-canvas-recruit-modal-HYouwCHv.js} +1 -1
- package/dist/client/assets/{login-Mvzj8t4K.js → login-qRSyAZ_o.js} +1 -1
- package/dist/client/assets/{members-cTtXQ1OM.js → members-D4UY4ei6.js} +1 -1
- package/dist/client/assets/{monaco-editor-Dz10Y__a.js → monaco-editor-BOg-v1iU.js} +1 -1
- package/dist/client/assets/{monitoring-stats-row-B-cEMu_9.js → monitoring-stats-row-xiPLeKvD.js} +1 -1
- package/dist/client/assets/{oauth-callback-gQD649Ih.js → oauth-callback-D2FTNcui.js} +1 -1
- package/dist/client/assets/{oauth-callback-ai-provider-Chxdycb_.js → oauth-callback-ai-provider-Kb5ulQoF.js} +1 -1
- package/dist/client/assets/{onboarding-DQPmRIcx.js → onboarding-D5RrB-Tz.js} +1 -1
- package/dist/client/assets/{org-layout-Dn0dw0VQ.js → org-layout-WhfAqk0U.js} +1 -1
- package/dist/client/assets/{org-plugin-layout-CXdSKJr7.js → org-plugin-layout-C70m9fD9.js} +1 -1
- package/dist/client/assets/{pair-ByvRRfgF.js → pair-BozNTVaW.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BdyLNYrm.js → plugin-empty-state-BhaTB3gV.js} +1 -1
- package/dist/client/assets/{plugin-header-DFdSKbGT.js → plugin-header-CCyEhf-g.js} +1 -1
- package/dist/client/assets/{plugin-layout-BYyFiJQI.js → plugin-layout-kiqmZ4Ty.js} +1 -1
- package/dist/client/assets/{popover-Bb31RhES.js → popover-DsEUr0UP.js} +1 -1
- package/dist/client/assets/{profile-Dt2FmPx9.js → profile-OzTBu6o-.js} +1 -1
- package/dist/client/assets/{project-app-view-BRps_raG.js → project-app-view-CbPm1ZuF.js} +1 -1
- package/dist/client/assets/registry-CsXSm8-9.js +2 -0
- package/dist/client/assets/{registry-layout-CTsKpN8K.js → registry-layout-BpFNGTYZ.js} +1 -1
- package/dist/client/assets/{required-auth-layout-CUyvfcB4.js → required-auth-layout-DHh0SFyh.js} +1 -1
- package/dist/client/assets/{reset-password-D-ToySou.js → reset-password-9vHhhDeq.js} +1 -1
- package/dist/client/assets/{roles-CxEY0wcy.js → roles-D3OPlwRQ.js} +1 -1
- package/dist/client/assets/{scroll-area-CxdNBd0d.js → scroll-area-CSvHQmLp.js} +1 -1
- package/dist/client/assets/{search-input-CoXN7n1O.js → search-input-CQG6oP1I.js} +1 -1
- package/dist/client/assets/{select-CwP42l1t.js → select-CBnW7xgF.js} +1 -1
- package/dist/client/assets/{select-model-BeJoG9-P.js → select-model-CkVUDibB.js} +1 -1
- package/dist/client/assets/{settings-layout-DrKWvZnz.js → settings-layout-D4i1woj8.js} +1 -1
- package/dist/client/assets/{settings-section-Bi-8KbSP.js → settings-section-C2ru3Pcu.js} +1 -1
- package/dist/client/assets/{shell-layout-aUES-kFD.js → shell-layout-C--vXF8e.js} +1 -1
- package/dist/client/assets/{skeleton-DcjwowII.js → skeleton-DZE_Durz.js} +1 -1
- package/dist/client/assets/{sso-BGkz0eQv.js → sso-Dud_r3Fd.js} +1 -1
- package/dist/client/assets/{store-VBma9EJF.js → store-BxxFQfUe.js} +1 -1
- package/dist/client/assets/store-registry-c5WBQeKh.js +2 -0
- package/dist/client/assets/{switch-C5rJGOpi.js → switch-9ZAU9Wsd.js} +1 -1
- package/dist/client/assets/{table-KruF5l_B.js → table-DMcPz0bN.js} +1 -1
- package/dist/client/assets/{tabs-rlOqMpk_.js → tabs-DMO0mB-I.js} +1 -1
- package/dist/client/assets/{task-status-bebWweDN.js → task-status-DVZLBvKG.js} +1 -1
- package/dist/client/assets/{textarea-CxGYitYu.js → textarea-BCuCo32x.js} +1 -1
- package/dist/client/assets/{toggle-group-LdkT1Ecu.js → toggle-group-VxweZQrl.js} +1 -1
- package/dist/client/assets/{tools-list-BzZoS1K1.js → tools-list-DVh0mjAv.js} +1 -1
- package/dist/client/assets/{tooltip-7zLr-moN.js → tooltip-D6qvPlF4.js} +1 -1
- package/dist/client/assets/{types-DxqWkEtq.js → types-DCqv44Zz.js} +1 -1
- package/dist/client/assets/{use-ai-providers-mLoGEXc_.js → use-ai-providers-C0E0qH45.js} +1 -1
- package/dist/client/assets/{use-collections-u1h_t_JF.js → use-collections-BYyKflom.js} +1 -1
- package/dist/client/assets/{use-connection-DQwJCiIx.js → use-connection-kAb3_1aU.js} +1 -1
- package/dist/client/assets/{use-copy-C-S0osaU.js → use-copy-Dr24Lx_X.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BruWfWOW.js → use-create-virtual-mcp-DL9XFAgg.js} +1 -1
- package/dist/client/assets/{use-decopilot-events-B4aVkVre.js → use-decopilot-events-BA7vVAsF.js} +1 -1
- package/dist/client/assets/{use-delete-connection-CilGQAHO.js → use-delete-connection-DOTVFlyu.js} +1 -1
- package/dist/client/assets/{use-infinite-scroll-C9RvfCBh.js → use-infinite-scroll-CeNFrFZw.js} +1 -1
- package/dist/client/assets/{use-list-state-DgGya_Kh.js → use-list-state-ChPE6VX_.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-V6zce17I.js → use-mcp-tools-Bbkq91Xc.js} +1 -1
- package/dist/client/assets/{use-members-DzfmudDX.js → use-members-BbBWLiDA.js} +1 -1
- package/dist/client/assets/{use-navigate-to-agent-up8QETMW.js → use-navigate-to-agent-CiGytRqe.js} +1 -1
- package/dist/client/assets/{use-org-auth-client-Bv8qraCw.js → use-org-auth-client-Ctlksu1L.js} +1 -1
- package/dist/client/assets/{use-org-sso-D0kTPrgt.js → use-org-sso-Dtmr2O8h.js} +1 -1
- package/dist/client/assets/{use-organization-roles-vVY-U_lX.js → use-organization-roles-CYz2FAFR.js} +1 -1
- package/dist/client/assets/{use-organization-settings-W-mmflSy.js → use-organization-settings-CffFj1WY.js} +1 -1
- package/dist/client/assets/{use-registry-connections-BIZ2aNDt.js → use-registry-connections-Br5-A4Q9.js} +1 -1
- package/dist/client/assets/{use-status-sounds-YemQM946.js → use-status-sounds-C_N93Hgc.js} +1 -1
- package/dist/client/assets/{use-tasks-4FsSty5E.js → use-tasks-UUjCH1vs.js} +1 -1
- package/dist/client/assets/{use-view-mode-CLCiVZle.js → use-view-mode-BqPySn5U.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-CNRz_FcH.js → use-virtual-mcp-CriuigLx.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CXsqG0YB.js +1 -0
- package/dist/client/assets/useSuspenseInfiniteQuery-D0VeE26p.js +1 -0
- package/dist/client/assets/{user-DiQbbrAS.js → user-DfBEFCfL.js} +1 -1
- package/dist/client/assets/{view-mode-toggle-DWWeISWY.js → view-mode-toggle-YvwpFyqQ.js} +1 -1
- package/dist/client/assets/{workflow-CAX5kqLQ.js → workflow-DjrE6MxM.js} +1 -1
- package/dist/client/assets/workflow-detail-COUbvzSr.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/server/cli.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/ai-providers-ChfcKFAa.js +0 -1
- package/dist/client/assets/index-BXqhvHqj.js +0 -1
- package/dist/client/assets/registry-mlXjwmt-.js +0 -2
- package/dist/client/assets/store-registry-CvC5bBZ_.js +0 -2
- package/dist/client/assets/useInfiniteQuery-CSrqdvmh.js +0 -1
- package/dist/client/assets/useSuspenseInfiniteQuery-dLr5FZgz.js +0 -1
- package/dist/client/assets/workflow-detail-B07fAcdT.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-
|
|
2
|
-
import{o as Ut,r as P,p as El,q as Tl,e as K,s as ve,K as As,n as Vo,a as Ko,c as ee,j as o,l as Be,B as se,E as $t,b as wi,v as ni,f as It,d as Zr,w as Rl,x as me,y as Dl,V as Ml,t as ye,z as qo,C as Al,D as Zt,F as Il,G as bn,L as Bl,H as Li,I as Js,J as ct,M as Go,P as Pl,_ as Ll,Q as Yo,R as Xo,T as Ol,g as zl}from"./index-CV1lFX-Z.js";import{C as Ee,u as $l,w as Fl,A as Hl,T as Wl,a as Ul}from"./index-DBW0tfwB.js";import{I as ds}from"./integration-icon-tJ5Z1ZtK.js";import{S as Bt,u as Ue,g as Jo,a as Zo}from"./constants-HOfKPHDy.js";import{u as wt,a as Vl}from"./use-virtual-mcp-CNRz_FcH.js";import{a as Kl}from"./Users03-CxpjXo7-.js";import{u as Qo,a as lt,b as Ci,c as ki,t as ql,d as Sn}from"./chat-context-C7xeFwbj.js";import{i as Is}from"./AlertCircle-DNXZvA9j.js";import{i as Gl}from"./CheckCircle-H4V25dcS.js";import{n as yn,a as Yl}from"./ZapSquare-DQMHM_Az.js";import{i as Xl,a as Jl,b as Zl,c as Ni,d as Ql}from"./XCircle-KN03fplT.js";import{s as ls,i as ec}from"./XClose-DFrrxeI9.js";import{c as tc,r as sc,p as ea,f as wn,a as ic,F as rc,t as Cn,M as Qr,G as ta,L as nc,i as oc,b as ac,d as lc,e as cc}from"./pair-ByvRRfgF.js";import{C as hc,a as kn,b as Nn,c as dc,d as uc,e as fc,f as mc}from"./command-Dul__cSK.js";import{P as Fs,a as Hs,b as Ws}from"./popover-Bb31RhES.js";import{i as Es,a as _i,b as _c,c as pc,p as ji,g as Ei,d as en,e as sa,h as hr,f as Oi,j as jn,A as En,k as ia,l as gc,m as vc,n as xc,t as bc,o as Sc,q as oi,r as ra,s as na,u as oa,v as Tn,w as yc,x as Ts,y as wc,z as Cc,B as kc,C as aa}from"./agent-icon-DH1erOLo.js";import{u as us,a as Nc}from"./use-mcp-tools-V6zce17I.js";import{u as jc,a as Ec}from"./use-ai-providers-mLoGEXc_.js";import{g as Vt,c as Rn,u as Tc,b as dr,d as Rc,e as Dc,f as Mc,T as Ac}from"./index-D7CuHsQA.js";import{u as tn,i as Ic}from"./shell-layout-aUES-kFD.js";import{i as Bc,P as at,u as Pc,c as Lc,d as Oc,e as zc}from"./index-CUeJKjUo.js";import{u as la,T as qe,a as Ge,b as Ye,c as $c}from"./tooltip-7zLr-moN.js";import{u as Fc}from"./use-status-sounds-YemQM946.js";import{E as Bs}from"./empty-state-CgXa2kei.js";import{A as Hc,a as Wc,b as Uc,c as Vc,R as ca,d as Kc,e as qc}from"./accordion-ENyIrry_.js";import{u as Ti,a as sn,b as Gc}from"./use-connection-DQwJCiIx.js";import{g as Yc}from"./constants-CCFSt8jO.js";import{u as Xc,g as Jc}from"./types-DxqWkEtq.js";import{U as ha}from"./user-DiQbbrAS.js";import{T as Zc,u as da}from"./tools-list-BzZoS1K1.js";import{u as zi}from"./unwrap-tool-result-BYXdCQMg.js";import{s as ua,g as Qc}from"./connection-slug-eyAPH6o3.js";import{A as fa,a as ma,b as _a,c as pa,d as ga,e as va,f as xa,g as ba}from"./alert-dialog-DisfPNds.js";import{D as eh,a as rn,b as nn,c as Sa,d as ya}from"./dialog-BHi9STqD.js";import{C as th,a as Dn}from"./card-Di2QvueV.js";import{I as fs}from"./input-CN-FAUiT.js";import{L as Rs}from"./label-PUMmND_r.js";import{S as ts,a as ss,b as is,c as rs,d as At}from"./select-CwP42l1t.js";import{S as ur}from"./switch-C5rJGOpi.js";import{T as Mn}from"./textarea-CxGYitYu.js";import{i as ai}from"./Play-B0qxiwIM.js";import{s as cs}from"./Plus-CXt-F95f.js";import{a as sh}from"./Settings02-CZXBZ9dp.js";import{t as wa}from"./Tool01-D7BUXrGA.js";import{s as fr}from"./Trash01-CpZ82qo1.js";import{S as Ca}from"./scroll-area-CxdNBd0d.js";import{i as ka,a as ih}from"./SearchMd-mJ3-Y6pi.js";import{C as rh}from"./collection-tabs-afccA05T.js";import{C as nh}from"./checkbox-BLyNIdWA.js";import{u as oh,T as $i,a as ah,b as lh,c as Fi}from"./tabs-rlOqMpk_.js";import{D as ch,a as hh,b as dh}from"./drawer-CFPIi-pq.js";import{i as Ri,t as mr}from"./ChevronDown-Ce2OjGrT.js";import{n as Kt}from"./LinkExternal01-foB2b2ju.js";import{S as uh}from"./index-BpQvm0m_.js";import{D as ns,a as os,b as as,c as yt,d as fh,e as mh,f as _h}from"./dropdown-menu-ChEDfeWm.js";import{i as Na}from"./RefreshCcw01-CvllgBGg.js";import{V as ph}from"./view-mode-toggle-DWWeISWY.js";import{G as gh}from"./lean-canvas-recruit-modal-ywtX7ECZ.js";import{M as vh}from"./select-model-BeJoG9-P.js";import{u as Us,a as xh,b as bh,c as Sh,A as yh,d as wh}from"./automation-list-row-B6R4hbWU.js";import{i as Ps}from"./Zap-BBJ66Grg.js";import{S as Ch}from"./search-input-CoXN7n1O.js";import"./use-navigate-to-agent-up8QETMW.js";import"./use-tasks-4FsSty5E.js";import"./use-collections-u1h_t_JF.js";import"./collection-search-BjTSjOvQ.js";import"./form-O7o12XKC.js";import"./Star01-Kt9eAOrx.js";import"./Lock01-ucerLi_m.js";import"./X-Cesxj0TS.js";import"./toggle-group-LdkT1Ecu.js";import"./index-CLd1VMk-.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-bt811v_C.js";import"./use-registry-connections-BIZ2aNDt.js";import"./use-organization-settings-W-mmflSy.js";import"./useInfiniteQuery-CSrqdvmh.js";import"./infiniteQueryObserver-BVAzy1Sk.js";import"./extract-connection-data-CNS4342G.js";import"./Container-COQnfxdW.js";import"./connection-form-helpers-DeGnXv9z.js";import"./use-infinite-scroll-C9RvfCBh.js";import"./useSuspenseInfiniteQuery-dLr5FZgz.js";import"./badge-Bu2pzpRI.js";import"./ChevronRight-DM5N13PI.js";import"./use-decopilot-events-B4aVkVre.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-C-S0osaU.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-DHxk_oDq.js";import"./index-BQPKIoNa.js";import"./ArrowNarrowLeft-Gm4Xkvpy.js";import"./ArrowUpRight-O3jikuh3.js";import"./ChevronUp-CyPLVPf1.js";import"./DotsVertical-CyXt8PT9.js";import"./Palette-CWS5P_Bb.js";import"./Shield01-DSEVwFlT.js";import"./User01-BXHi1zAw.js";import"./skeleton-DcjwowII.js";import"./avatar-BjZ78dvf.js";import"./index-Do1XArQs.js";import"./collection-search-73ZE_Rxd.js";import"./use-create-virtual-mcp-BruWfWOW.js";import"./task-status-bebWweDN.js";import"./required-auth-layout-CUyvfcB4.js";import"./use-org-sso-D0kTPrgt.js";import"./collections-BM6Z8nGc.js";import"./settings-section-Bi-8KbSP.js";import"./formatDistanceToNow-Cb2QZZJn.js";function kh(t,e){const s=Ut(e);return Nh({filters:{...t,status:"pending"}},s).length}function An(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Nh(t={},e){const s=Ut(e).getMutationCache(),i=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=An(s,t)),P.useEffect(()=>{i.current=t}),P.useSyncExternalStore(P.useCallback(n=>s.subscribe(()=>{const a=El(r.current,An(s,i.current));r.current!==a&&(r.current=a,Tl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function jh(t,e){const s=K.c(40),{org:i,locator:r}=ve();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Bt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Ue(n),l=Ut();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Vo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=Ko(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),P.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function ps(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function In(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Eh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Th(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Rh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Rh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Dh(t){const e=K.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Mh(t){const e=K.c(19),{part:s}=t,i=s.input?.agent_id,r=wt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=ee("shrink-0 font-medium",d),e[3]=d,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Be,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Xl,{size:12,className:"text-destructive"}):c?o.jsx(Is,{size:12,className:"text-warning"}):o.jsx(Gl,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=K.c(58),{onClose:s,back:i,className:r}=t,[n,a]=P.useState(null),{messages:l}=Qo(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=Ci();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=J=>J.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=tc(l),j=[...l].reverse().find(Uh),M=j?.metadata?.usage,R=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,D=M?.contextTokens??M?.totalTokens??0,C=R&&R>0?(D/R*100).toFixed(1):null,T=l;let E;e[19]!==T?(E=T.filter(Wh).reduce(Hh,0),e[19]=T,e[20]=E):E=e[20];const A=E,O=l;let L;e[21]!==O?(L=O.filter(Fh).reduce($h,0),e[21]=O,e[22]=L):L=e[22];const B=L,F=Math.max(0,N.totalTokens-A-B),z=l[0],$=l.at(-1),V=z?.metadata?.created_at??w?.created_at,W=$?.metadata?.created_at??w?.updated_at,U=l.filter(zh),q=l.flatMap(Lh),I=u?.modelId?Eh(u.modelId):"—",X=d?.title??"Decopilot",Y=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:X},{label:"Model",value:I},{label:"Context Limit",value:R?ps(R):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?ps(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?ps(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?ps(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?ps(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:In(V)},{label:"Last Activity",value:In(W)}];if(!w&&U.length===0){let J;e[23]!==r?(J=ee("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=J):J=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let ue;e[26]!==i?(ue=i?o.jsx(yn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=ue):ue=e[27];let he;e[28]!==s||e[29]!==ue?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ue})]}),e[28]=s,e[29]=ue,e[30]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let ke;e[32]!==J||e[33]!==he?(ke=o.jsxs("div",{className:J,children:[he,pe]}),e[32]=J,e[33]=he,e[34]=ke):ke=e[34],S=ke;break e}e[35]!==r?(v=ee("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ce;e[38]!==i?(ce=i?o.jsx(yn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ce):ce=e[39],e[40]!==s||e[41]!==ce?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ce})]}),e[40]=s,e[41]=ce,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=q.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:q.map(Ph)})]}),f=o.jsx(Th,{items:Y});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==B||e[45]!==F||e[46]!==A?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Dh,{userTokens:A,assistantTokens:B,otherTokens:F})]}),e[44]=B,e[45]=F,e[46]=A,e[47]=p):p=e[47],g=U.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:U.map(J=>{const de=J.metadata?.created_at,ue=n?.id===J.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(ue?null:J),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:ee("shrink-0 font-medium",J.role==="user"?"text-chart-1":"text-chart-2"),children:J.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:J.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ue&&o.jsxs(o.Fragment,{children:[J.role==="assistant"&&(()=>{const he=J.metadata?._request;if(!he)return null;const pe=he.systemSections??[],ke=Math.max(1,...pe.map(Bh)),re=pe.reduce(Ih,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(re/4).toLocaleString()," ","tok"]})]}),pe.map((_e,He)=>{const De=_e.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${He}`,je=_e.chars/ke*100,vt=Math.round(_e.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:De}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",vt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${je}%`}})})]},He)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(J,null,2)})]})]},J.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Ih(t,e){return t+e.chars}function Bh(t){return t.chars}function Ph(t,e){return o.jsx(Mh,{part:t},e)}function Lh(t){return(t.parts??[]).filter(Oh)}function Oh(t){return t.type==="tool-subtask"}function zh(t){return t.role!=="system"}function $h(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Fh(t){return t.role==="assistant"}function Hh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Wh(t){return t.role==="user"}function Uh(t){return t.role==="assistant"&&t.metadata?.usage}const Bn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Pn=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Vh(){const t=Bn[Math.floor(Math.random()*Bn.length)],e=Pn[Math.floor(Math.random()*Pn.length)];return`deco/${t}-${e}`}function Kh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function qh(t){const e=K.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=Ue(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Jh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Xh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const R=Array.isArray(v)?v:v?.branches??[];let D;e[18]!==y?(D=C=>!y.has(C.name),e[18]=y,e[19]=D):D=e[19],w=R.filter(Yh).filter(D).map(Gh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let M;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(M={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=M):M=e[25],M}function Gh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Yh(t){return typeof t.name=="string"}function Xh(t){return{name:t,source:"yours"}}function Jh(t){return Kh(t)}function Zh(t){const e=K.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=P.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=qh(_);let b;e[9]!==u?(b=A=>{u(A),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Es,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=o.jsx(Fs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(uc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Vh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=j):j=e[18];let M;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(M=!v&&!g&&f.length===0&&p.length===0&&o.jsx(hc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=M):M=e[23];let R;e[24]!==S||e[25]!==f?(R=f.length>0&&o.jsx(kn,{heading:"Your branches",children:f.map(A=>o.jsxs(Nn,{value:A.name,onSelect:()=>S(A.name),children:[o.jsx(Es,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:A.name})]},A.name))}),e[24]=S,e[25]=f,e[26]=R):R=e[26];let D;e[27]!==p||e[28]!==S?(D=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(dc,{}),o.jsx(kn,{heading:"Other branches in repo",children:p.map(A=>o.jsxs(Nn,{value:A.name,onSelect:()=>S(A.name),children:[o.jsx(Es,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:A.name}),A.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",A.author]})]},A.name))})]}),e[27]=p,e[28]=S,e[29]=D):D=e[29];let C;e[30]!==D||e[31]!==j||e[32]!==M||e[33]!==R?(C=o.jsxs(fc,{children:[j,M,R,D]}),e[30]=D,e[31]=j,e[32]=M,e[33]=R,e[34]=C):C=e[34];let T;e[35]!==C||e[36]!==N?(T=o.jsx(Hs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(mc,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=T):T=e[37];let E;return e[38]!==d||e[39]!==T||e[40]!==k?(E=o.jsxs(Ws,{open:d,onOpenChange:m,children:[k,T]}),e[38]=d,e[39]=T,e[40]=k,e[41]=E):E=e[41],E}function Qh(){const t=K.c(27),{org:e}=ve(),{selectedVirtualMcp:s}=Ci(),{data:i}=wi.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Jo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=wt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Kl,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Zh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function ed(){const t=K.c(26),{org:e}=ve(),s=jc(),{isChatEmpty:i}=Qo(),[r,n]=P.useState("chat"),a=$l();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Fl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=ee("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Qh,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=ee("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ah,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function ja(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{fallback:e,children:o.jsx(P.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(ed,{})})}),t[1]=s):s=t[1],s}async function td(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Ea=["VM_START"],Zs=new Map,sd=t=>`${t.virtualMcpId}::${t.branch??""}`,Hi=new Set,pi={mark:(t,e)=>Hi.add(`${t}::${e}`),clear:(t,e)=>Hi.delete(`${t}::${e}`),isStopped:(t,e)=>Hi.has(`${t}::${e}`)};function on(t){const e=Ut();return Ko({mutationKey:Ea,mutationFn:async s=>{s.branch&&pi.clear(s.virtualMcpId,s.branch);const i=sd(s),r=Zs.get(i);if(r)return r;const n=(async()=>(await td(t,"VM_START",s)).structuredContent)();Zs.set(i,n);try{return await n}finally{Zs.get(i)===n&&Zs.delete(i)}},onSuccess:()=>{ni(e)}})}function Ta(t,e){const s=K.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ea,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],kh(i)>0}const id={settings:pc,automations:_c,env:_i,preview:Jl,git:Es};function Ln(t){const e=ji(t);if(e.type==="icon"){const s=Ei(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Wi(t){if(t.kind==="system")return{kind:"component",Component:id[t.tabId]};const e=Ln(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=Ln(s.icon);return i||{kind:"fallback"}}function rd(t){const{org:e}=ve(),s=Ue({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),{data:i}=Rl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Ra(t){const e=K.c(8),s=It();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Zr(i),n=wt(t.virtualMcpId),a=rd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Vt(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Ti(f),{activeTab:g,mainOpen:v}=sc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(nd)}:null}),b=ea(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const M=wn(j.appId,j.toolName);x.set(M,{id:M,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const M=wn(j.connectionId,j.toolName);x.set(M,{id:M,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Wi({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Wi({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:Wi({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const M=ic({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:R=>({...R,main:M}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function nd(t){return{id:t.id}}function od(t){const e=K.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=P.useState(!1),[g,v]=P.useState("icons"),[b,S]=P.useState(""),[x,y]=P.useState("blue");let k;e[0]!==s?(k=ji(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=je=>{i(Oi(je,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const M=j;let R;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(R=je=>{y(je),r?.(je),w.type==="icon"?i(Oi(w.name,je)):w.type==="url"&&i(jn(w.url,je))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=R):R=e[10];const D=R;let C;e[11]!==i||e[12]!==N?(C=je=>{i(jn(je,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const T=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const je=en(),vt=je[Math.floor(Math.random()*je.length)];i(Oi(vt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const A=E;let O,L,B,F,z,$,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const je={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};L=Ws,$=_?!1:f,V=p,O=Fs,z=!0,W="button",B=_,F=ee("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",je[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=O,e[22]=L,e[23]=B,e[24]=F,e[25]=z,e[26]=$,e[27]=V,e[28]=W}else O=e[21],L=e[22],B=e[23],F=e[24],z=e[25],$=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(En,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let q;e[34]!==_||e[35]!==m?(q=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ia,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=q):q=e[36];let I;e[37]!==B||e[38]!==F||e[39]!==U||e[40]!==q||e[41]!==W?(I=o.jsxs("button",{type:W,disabled:B,className:F,children:[U,q]}),e[37]=B,e[38]=F,e[39]=U,e[40]=q,e[41]=W,e[42]=I):I=e[42];let X;e[43]!==O||e[44]!==z||e[45]!==I?(X=o.jsx(O,{asChild:z,children:I}),e[43]=O,e[44]=z,e[45]=I,e[46]=X):X=e[46];let Y;e[47]!==n||e[48]!==s?(Y=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(En,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=Y):Y=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=()=>v("icons"),e[50]=te):te=e[50];const ce=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ne;e[51]!==ce?(ne=ee("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ne):ne=e[52];let J;e[53]!==ne?(J=o.jsx("button",{type:"button",onClick:te,className:ne,children:"Icons"}),e[53]=ne,e[54]=J):J=e[54];let de;e[55]===Symbol.for("react.memo_cache_sentinel")?(de=()=>v("upload"),e[55]=de):de=e[55];const ue=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==ue?(he=ee("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ue),e[56]=ue,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:de,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let ke;e[60]===Symbol.for("react.memo_cache_sentinel")?(ke=o.jsx("div",{className:"flex-1"}),e[60]=ke):ke=e[60];let re;e[61]!==J||e[62]!==pe?(re=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[J,pe,ke]}),e[61]=J,e[62]=pe,e[63]=re):re=e[63];let _e;e[64]!==D||e[65]!==A||e[66]!==M||e[67]!==T||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(_e=g==="icons"?o.jsx(hd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:D,onSelectIcon:M,onRandom:A,currentIconName:w.type==="icon"?w.name:null}):o.jsx(dd,{onUpload:T}),e[64]=D,e[65]=A,e[66]=M,e[67]=T,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=_e):_e=e[73];let He;e[74]!==Y||e[75]!==re||e[76]!==_e?(He=o.jsx(Hs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ad,children:o.jsxs("div",{className:"flex flex-col",children:[Y,re,_e]})}),e[74]=Y,e[75]=re,e[76]=_e,e[77]=He):He=e[77];let De;return e[78]!==L||e[79]!==$||e[80]!==V||e[81]!==X||e[82]!==He?(De=o.jsxs(L,{open:$,onOpenChange:V,children:[X,He]}),e[78]=L,e[79]=$,e[80]=V,e[81]=X,e[82]=He,e[83]=De):De=e[83],De}function ad(t){return t.preventDefault()}function ld(t){const e=K.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=P.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=sa(s);l=Ws,d=r,m=n,a=Fs,u=!0,h="button",c=ee("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=vc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:ee("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Hs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:cd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function cd(t){return t.preventDefault()}function hd(t){const e=K.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=en(),y=sa(r);u=s.trim()?x.filter(D=>{const C=hr(D),T=s.toLowerCase();return C.includes(T)||D.toLowerCase().includes(T)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(ka,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=D=>i(D.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let M;e[21]!==l?(M=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=M):M=e[22];let R;e[23]!==n||e[24]!==r?(R=o.jsx(ld,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=R):R=e[25],e[26]!==M||e[27]!==R||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,M,R]}),e[26]=M,e[27]=R,e[28]=N,e[29]=p):p=e[29],c=Ca,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(D=>{const C=Ei(D);return C?o.jsx("button",{type:"button",onClick:()=>a(D),className:ee("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===D?ee(y.bg,y.text):ee(y.text,"hover:bg-accent")),title:D,children:o.jsx(C,{size:18})},D):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function dd(t){const e=K.c(27),{onUpload:s}=t,i=P.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){me.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{me.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=P.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Zl,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function ud(t){const e=K.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=ji(s);if(n.type==="icon"){const a=Ei(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Bc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function fd(t){const e=K.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=P.useState(!1),[h,c]=P.useState("");let u;e[0]!==s?(u=ji(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,M,R;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const L=en();g=h.trim()?L.filter(U=>{const q=h.toLowerCase();return hr(U).includes(q)||U.toLowerCase().includes(q)}):L,p=Ws,v=n?!1:a,b=l;const B=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let F;e[24]!==r||e[25]!==B?(F=ee("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",B,r),e[24]=r,e[25]=B,e[26]=F):F=e[26];let z;e[27]!==s?(z=o.jsx(ud,{value:s}),e[27]=s,e[28]=z):z=e[28],e[29]!==n||e[30]!==F||e[31]!==z?(S=o.jsx(Fs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:F,children:z})}),e[29]=n,e[30]=F,e[31]=z,e[32]=S):S=e[32],f=Hs,j="start",M="w-64 p-0",R=md,w="flex flex-col";let $;e[33]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ka,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=$):$=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[$,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=Ca,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const q=Ei(U);return q?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:ee("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:hr(U),children:o.jsx(q,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=M,e[23]=R}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],M=e[22],R=e[23];let D;e[40]!==x||e[41]!==y?(D=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=D):D=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let T;e[45]!==_||e[46]!==D||e[47]!==C||e[48]!==k?(T=o.jsxs(_,{className:k,children:[D,C]}),e[45]=_,e[46]=D,e[47]=C,e[48]=k,e[49]=T):T=e[49];let E;e[50]!==T||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,T]}),e[50]=T,e[51]=w,e[52]=N,e[53]=E):E=e[53];let A;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==M||e[58]!==R?(A=o.jsx(f,{align:j,className:M,onOpenAutoFocus:R,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=M,e[58]=R,e[59]=A):A=e[59];let O;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==A?(O=o.jsxs(p,{open:v,onOpenChange:b,children:[S,A]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=A,e[65]=O):O=e[65],O}function md(t){return t.preventDefault()}function li(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Be,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Ui(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Dl,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function _d(t){const e=K.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=ee("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(nh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function an(t){const e=K.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const d=s.map(pd);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(_d,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function pd(t){return t.id}function gd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Nc(c);let d;e[6]!==u.tools?(d=u.tools.map(vd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function vd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Zc,{annotations:t.annotations,_meta:t._meta})}}function xd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Xc(c);let d;e[6]!==u.resources?(d=u.resources.map(bd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function bd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function Sd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=oh(c);let d;e[6]!==u.prompts?(d=u.prompts.map(yd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function yd(t){return{id:t.name,name:t.name,description:t.description}}function wd(t){const e=K.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let y;e[16]!==v||e[17]!==x?(y=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=O=>m(O),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(rh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let M;e[25]!==g||e[26]!==j?(M=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=M):M=e[27];let R;e[28]!==M||e[29]!==N?(R=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,M]}),e[28]=M,e[29]=N,e[30]=R):R=e[30];let D;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(D=i==="tools"&&o.jsx($t,{fallback:Ui("Tools not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(gd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(O,L)=>a(r,O,L)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=D):D=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx($t,{fallback:Ui("Resources not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(xd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(O,L)=>l(r,O,L)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let T;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(T=i==="prompts"&&o.jsx($t,{fallback:Ui("Prompts not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(Sd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(O,L)=>h(r,O,L)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=T):T=e[45];let E;e[46]!==D||e[47]!==C||e[48]!==T?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[D,C,T]}),e[46]=D,e[47]=C,e[48]=T,e[49]=E):E=e[49];let A;return e[50]!==R||e[51]!==E||e[52]!==y?(A=o.jsxs(o.Fragment,{children:[y,R,E]}),e[50]=R,e[51]=E,e[52]=y,e[53]=A):A=e[53],A}function Cd(t){const e=K.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=da(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(xc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function kd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function On(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function Nd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function jd(t){const e=K.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,u]=P.useReducer(Nd,h),d=sn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=kd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=($,V,W,U)=>{const q=f[$]?.[V];let I;q===null?I=U.filter(Y=>Y!==W):q?.includes(W)?I=q.filter(Y=>Y!==W):(I=[...q??[],W],I.length===U.length&&(I=null));const X={...f};X[$]?X[$]={...X[$]}:X[$]={tools:null,resources:null,prompts:null},X[$][V]=I,n.setValue("connections",On(X),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=($,V)=>{const U=f[$]?.[V]===null?[]:null,q={...f};q[$]?q[$]={...q[$]}:q[$]={tools:null,resources:null,prompts:null},q[$][V]=U,n.setValue("connections",On(q),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=($,V,W)=>g($,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=($,V,W)=>g($,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=($,V,W)=>g($,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=$=>b($,"tools"),e[17]=b,e[18]=j):j=e[18];const M=j;let R;e[19]!==b?(R=$=>b($,"resources"),e[19]=b,e[20]=R):R=e[20];const D=R;let C;e[21]!==b?(C=$=>b($,"prompts"),e[21]=b,e[22]=C):C=e[22];const T=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(li,{}),e[23]=E):E=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=$=>u({type:"SET_ACTIVE_TAB",payload:$}),e[24]=A):A=e[24];let O;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==T||e[30]!==D||e[31]!==M||e[32]!==N||e[33]!==k||e[34]!==x?(O=o.jsx(wd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:M,toggleAllResources:D,toggleAllPrompts:T,onTabChange:A},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=T,e[30]=D,e[31]=M,e[32]=N,e[33]=k,e[34]=x,e[35]=O):O=e[35];let L;e[36]!==l||e[37]!==r||e[38]!==O?(L=o.jsx(P.Suspense,{fallback:E,children:o.jsx(Cd,{connectionId:r,onAuthenticate:l,children:O})}),e[36]=l,e[37]=r,e[38]=O,e[39]=L):L=e[39];let B;e[40]!==i?(B=o.jsx(eh,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=B):B=e[41];let F;e[42]!==L||e[43]!==B?(F=o.jsxs(rn,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[L,B]}),e[42]=L,e[43]=B,e[44]=F):F=e[44];let z;return e[45]!==i||e[46]!==s||e[47]!==F?(z=o.jsx(nn,{open:s,onOpenChange:i,children:F}),e[45]=i,e[46]=s,e[47]=F,e[48]=z):z=e[48],z}const Vi={tools:null,resources:null,prompts:null},Ed=Ml.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Td(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Rd(t){const e=K.c(11),{url:s,agentId:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{ye("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),me.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Ri,{size:20,className:"text-green-600"}):o.jsx(Ni,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Dd(t){const e=K.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{ye("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=ua(i),m=Td(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),me.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Md(t){const e=K.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=P.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{ye("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=ua(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),me.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Ri,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=ve(),s=Ue({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),[i,r]=P.useState(null),[n,a]=P.useState(!1),[l,h]=P.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),ye("agent_typegen_key_generated",{agent_id:c})}catch{ye("agent_typegen_key_failed",{agent_id:c}),me.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{ye("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),me.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Be,{size:14,className:"animate-spin"}):o.jsx(ih,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Ri,{size:12,className:"text-green-600"}):o.jsx(Ni,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Id,{apiKey:i,agentId:c})]})}function Id(t){const e=K.c(21),{apiKey:s,agentId:i}=t,[r,n]=P.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-app-view-CbPm1ZuF.js","assets/index-Byh16eae.js","assets/index-DXHNyf1g.css","assets/pair-BozNTVaW.js","assets/agent-icon-2WwvMIOR.js","assets/AlertCircle-DykTdePm.js","assets/Tool01-B3jB5-GF.js","assets/XClose-BD0-I41d.js","assets/RefreshCcw01-U2jJl9XZ.js","assets/ArrowNarrowLeft-BSnqV9Qp.js","assets/XCircle-CAjnYXMv.js","assets/ArrowUpRight-BbCrxIiB.js","assets/ZapSquare-DJjYeaGT.js","assets/Users03-CdkPI2qt.js","assets/CheckCircle-dpfQl31_.js","assets/ChevronDown-ChKIyEYX.js","assets/ChevronRight-CfxVPCJg.js","assets/ChevronUp-DrgxDzSb.js","assets/DotsVertical-Dpo2lfzf.js","assets/Container-BmeFpotW.js","assets/Star01-BIiXL1NH.js","assets/Palette-DWycQqah.js","assets/SearchMd-CJRrkj_7.js","assets/index-CO-xtUtF.js","assets/tooltip-D6qvPlF4.js","assets/X-CaSicsGt.js","assets/LinkExternal01-BFenb5P9.js","assets/Lock01-D4wd-Mt0.js","assets/Sun-DJvU306F.js","assets/Play-3GU5tyK6.js","assets/Plus-DNS-JW4m.js","assets/Settings02-BfZESxtt.js","assets/Shield01-CuEoE6Cq.js","assets/Trash01-DygHC0Or.js","assets/User01-XcdTTiqO.js","assets/Zap-DSo0BijB.js","assets/index-BTPvxzW6.js","assets/use-copy-Dr24Lx_X.js","assets/differenceInSeconds-NQ4PDo0z.js","assets/dialog-Cv4ROuD1.js","assets/content-blocks-o63cs2vh.js","assets/types-DCqv44Zz.js","assets/constants-DoDQutb_.js","assets/chat-context-C1cX954x.js","assets/use-virtual-mcp-CriuigLx.js","assets/use-collections-BYyKflom.js","assets/use-ai-providers-C0E0qH45.js","assets/use-decopilot-events-BA7vVAsF.js","assets/create-sse-subscription-CxkOgzKf.js","assets/use-tasks-UUjCH1vs.js","assets/use-organization-settings-CffFj1WY.js","assets/shell-layout-C--vXF8e.js","assets/required-auth-layout-DHh0SFyh.js","assets/use-org-sso-Dtmr2O8h.js","assets/integration-icon-qqFh_bDX.js","assets/use-mcp-tools-Bbkq91Xc.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as Ut,r as P,p as El,q as Tl,e as K,s as ve,K as As,n as Vo,a as Ko,c as ee,j as o,l as Be,B as se,E as $t,b as wi,v as ni,f as It,d as Zr,w as Rl,x as me,y as Dl,V as Ml,t as ye,z as qo,C as Al,D as Zt,F as Il,G as bn,L as Bl,H as Li,I as Js,J as ct,M as Go,P as Pl,_ as Ll,Q as Yo,R as Xo,T as Ol,g as zl}from"./index-Byh16eae.js";import{C as Ee,u as $l,w as Fl,A as Hl,T as Wl,a as Ul}from"./index-DAmwYTvH.js";import{I as ds}from"./integration-icon-qqFh_bDX.js";import{S as Bt,u as Ue,g as Jo,a as Zo}from"./constants-DoDQutb_.js";import{u as wt,a as Vl}from"./use-virtual-mcp-CriuigLx.js";import{a as Kl}from"./Users03-CdkPI2qt.js";import{u as Qo,a as lt,b as Ci,c as ki,t as ql,d as Sn}from"./chat-context-C1cX954x.js";import{i as Is}from"./AlertCircle-DykTdePm.js";import{i as Gl}from"./CheckCircle-dpfQl31_.js";import{n as yn,a as Yl}from"./ZapSquare-DJjYeaGT.js";import{i as Xl,a as Jl,b as Zl,c as Ni,d as Ql}from"./XCircle-CAjnYXMv.js";import{s as ls,i as ec}from"./XClose-BD0-I41d.js";import{c as tc,r as sc,p as ea,f as wn,a as ic,F as rc,t as Cn,M as Qr,G as ta,L as nc,i as oc,b as ac,d as lc,e as cc}from"./pair-BozNTVaW.js";import{C as hc,a as kn,b as Nn,c as dc,d as uc,e as fc,f as mc}from"./command-Dm5FUYzy.js";import{P as Fs,a as Hs,b as Ws}from"./popover-DsEUr0UP.js";import{i as Es,a as _i,b as _c,c as pc,p as ji,g as Ei,d as en,e as sa,h as hr,f as Oi,j as jn,A as En,k as ia,l as gc,m as vc,n as xc,t as bc,o as Sc,q as oi,r as ra,s as na,u as oa,v as Tn,w as yc,x as Ts,y as wc,z as Cc,B as kc,C as aa}from"./agent-icon-2WwvMIOR.js";import{u as us,a as Nc}from"./use-mcp-tools-Bbkq91Xc.js";import{u as jc,a as Ec}from"./use-ai-providers-C0E0qH45.js";import{g as Vt,c as Rn,u as Tc,b as dr,d as Rc,e as Dc,f as Mc,T as Ac}from"./index-DHQaot3v.js";import{u as tn,i as Ic}from"./shell-layout-C--vXF8e.js";import{i as Bc,P as at,u as Pc,c as Lc,d as Oc,e as zc}from"./index-CO-xtUtF.js";import{u as la,T as qe,a as Ge,b as Ye,c as $c}from"./tooltip-D6qvPlF4.js";import{u as Fc}from"./use-status-sounds-C_N93Hgc.js";import{E as Bs}from"./empty-state-BBjIyjuI.js";import{A as Hc,a as Wc,b as Uc,c as Vc,R as ca,d as Kc,e as qc}from"./accordion-NFEtlqmu.js";import{u as Ti,a as sn,b as Gc}from"./use-connection-kAb3_1aU.js";import{g as Yc}from"./constants-CqYb75aZ.js";import{u as Xc,g as Jc}from"./types-DCqv44Zz.js";import{U as ha}from"./user-DfBEFCfL.js";import{T as Zc,u as da}from"./tools-list-DVh0mjAv.js";import{u as zi}from"./unwrap-tool-result-BYXdCQMg.js";import{s as ua,g as Qc}from"./connection-slug-eyAPH6o3.js";import{A as fa,a as ma,b as _a,c as pa,d as ga,e as va,f as xa,g as ba}from"./alert-dialog-CczJ0CiT.js";import{D as eh,a as rn,b as nn,c as Sa,d as ya}from"./dialog-Cv4ROuD1.js";import{C as th,a as Dn}from"./card-BromnR4D.js";import{I as fs}from"./input-Vak5VRqX.js";import{L as Rs}from"./label-BNsXufvU.js";import{S as ts,a as ss,b as is,c as rs,d as At}from"./select-CBnW7xgF.js";import{S as ur}from"./switch-9ZAU9Wsd.js";import{T as Mn}from"./textarea-BCuCo32x.js";import{i as ai}from"./Play-3GU5tyK6.js";import{s as cs}from"./Plus-DNS-JW4m.js";import{a as sh}from"./Settings02-BfZESxtt.js";import{t as wa}from"./Tool01-B3jB5-GF.js";import{s as fr}from"./Trash01-DygHC0Or.js";import{S as Ca}from"./scroll-area-CSvHQmLp.js";import{i as ka,a as ih}from"./SearchMd-CJRrkj_7.js";import{C as rh}from"./collection-tabs-yGBJSAc8.js";import{C as nh}from"./checkbox-q02yCTCr.js";import{u as oh,T as $i,a as ah,b as lh,c as Fi}from"./tabs-DMO0mB-I.js";import{D as ch,a as hh,b as dh}from"./drawer-BvCmaZEN.js";import{i as Ri,t as mr}from"./ChevronDown-ChKIyEYX.js";import{n as Kt}from"./LinkExternal01-BFenb5P9.js";import{S as uh}from"./index-BTPvxzW6.js";import{D as ns,a as os,b as as,c as yt,d as fh,e as mh,f as _h}from"./dropdown-menu-CXpZ_ns-.js";import{i as Na}from"./RefreshCcw01-U2jJl9XZ.js";import{V as ph}from"./view-mode-toggle-YvwpFyqQ.js";import{G as gh}from"./lean-canvas-recruit-modal-HYouwCHv.js";import{M as vh}from"./select-model-CkVUDibB.js";import{u as Us,a as xh,b as bh,c as Sh,A as yh,d as wh}from"./automation-list-row-BM66xXdA.js";import{i as Ps}from"./Zap-DSo0BijB.js";import{S as Ch}from"./search-input-CQG6oP1I.js";import"./use-navigate-to-agent-CiGytRqe.js";import"./use-tasks-UUjCH1vs.js";import"./use-collections-BYyKflom.js";import"./collection-search-l5AWFuzp.js";import"./form-vv7czlx-.js";import"./Star01-BIiXL1NH.js";import"./Lock01-D4wd-Mt0.js";import"./X-CaSicsGt.js";import"./toggle-group-VxweZQrl.js";import"./index-DIMB4WE0.js";import"./question-004-sINsf4GQ.js";import"./ai-providers-logos-DD3qZ33J.js";import"./connection-card-Bpj8ZSs7.js";import"./use-registry-connections-Br5-A4Q9.js";import"./use-organization-settings-CffFj1WY.js";import"./useInfiniteQuery-CXsqG0YB.js";import"./infiniteQueryObserver-CeXFUdTd.js";import"./extract-connection-data-DRmUoKq6.js";import"./Container-BmeFpotW.js";import"./connection-form-helpers-_eiZ9Dyj.js";import"./use-infinite-scroll-CeNFrFZw.js";import"./useSuspenseInfiniteQuery-D0VeE26p.js";import"./badge-CqM8ft8a.js";import"./ChevronRight-CfxVPCJg.js";import"./use-decopilot-events-BA7vVAsF.js";import"./create-sse-subscription-CxkOgzKf.js";import"./use-copy-Dr24Lx_X.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./content-blocks-o63cs2vh.js";import"./Sun-DJvU306F.js";import"./index-D7GdEVK0.js";import"./ArrowNarrowLeft-BSnqV9Qp.js";import"./ArrowUpRight-BbCrxIiB.js";import"./ChevronUp-DrgxDzSb.js";import"./DotsVertical-Dpo2lfzf.js";import"./Palette-DWycQqah.js";import"./Shield01-CuEoE6Cq.js";import"./User01-XcdTTiqO.js";import"./skeleton-DZE_Durz.js";import"./avatar-XLD41nT1.js";import"./index-ao7NoSNv.js";import"./collection-search-BwqJnK6o.js";import"./use-create-virtual-mcp-DL9XFAgg.js";import"./task-status-DVZLBvKG.js";import"./required-auth-layout-DHh0SFyh.js";import"./use-org-sso-Dtmr2O8h.js";import"./collections-Bdy_Kvem.js";import"./settings-section-C2ru3Pcu.js";import"./formatDistanceToNow-Cb2QZZJn.js";function kh(t,e){const s=Ut(e);return Nh({filters:{...t,status:"pending"}},s).length}function An(t,e){return t.findAll(e.filters).map(s=>e.select?e.select(s):s.state)}function Nh(t={},e){const s=Ut(e).getMutationCache(),i=P.useRef(t),r=P.useRef(null);return r.current===null&&(r.current=An(s,t)),P.useEffect(()=>{i.current=t}),P.useSyncExternalStore(P.useCallback(n=>s.subscribe(()=>{const a=El(r.current,An(s,i.current));r.current!==a&&(r.current=a,Tl.schedule(n))}),[s]),()=>r.current,()=>r.current)}function jh(t,e){const s=K.c(40),{org:i,locator:r}=ve();let n;s[0]!==i.id||s[1]!==i.slug?(n={connectionId:Bt,orgId:i.id,orgSlug:i.slug},s[0]=i.id,s[1]=i.slug,s[2]=n):n=s[2];const a=Ue(n),l=Ut();let h;s[3]!==t||s[4]!==i.id?(h=As.ensureTask(i.id,t),s[3]=t,s[4]=i.id,s[5]=h):h=s[5];let c;s[6]!==a||s[7]!==t?(c=async()=>(await a.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}})).structuredContent?.item??null,s[6]=a,s[7]=t,s[8]=c):c=s[8];const u=t.length>0;let d;s[9]!==h||s[10]!==c||s[11]!==u?(d={queryKey:h,queryFn:c,enabled:u,retry:!1,refetchOnWindowFocus:!1},s[9]=h,s[10]=c,s[11]=u,s[12]=d):d=s[12];const m=Vo(d);let _;s[13]!==a||s[14]!==e?(_=async x=>{const y=await a.callTool({name:"COLLECTION_THREADS_CREATE",arguments:{data:{id:x,virtual_mcp_id:e}}});if(y.isError){const w=y.content,N=Array.isArray(w)&&w[0]&&typeof w[0]=="object"?w[0].text??"Create failed":"Create failed";throw new Error(N)}return y.structuredContent.item},s[13]=a,s[14]=e,s[15]=_):_=s[15];let f;s[16]!==r||s[17]!==i.id||s[18]!==m||s[19]!==l?(f=()=>{l.invalidateQueries({predicate:x=>x.queryKey[1]===i.id&&x.queryKey[3]==="collection"&&x.queryKey[4]==="THREADS"}),l.invalidateQueries({queryKey:As.tasksPrefix(r)}),m.refetch()},s[16]=r,s[17]=i.id,s[18]=m,s[19]=l,s[20]=f):f=s[20];let p;s[21]!==_||s[22]!==f?(p={mutationFn:_,onSuccess:f},s[21]=_,s[22]=f,s[23]=p):p=s[23];const g=Ko(p);let v,b;if(s[24]!==g||s[25]!==t||s[26]!==m.data||s[27]!==m.isSuccess?(v=()=>{t&&(!m.isSuccess||m.data||g.isPending||g.variables!==t&&g.mutate(t))},b=[t,m.isSuccess,m.data,g],s[24]=g,s[25]=t,s[26]=m.data,s[27]=m.isSuccess,s[28]=v,s[29]=b):(v=s[28],b=s[29]),P.useEffect(v,b),!t){let x;return s[30]===Symbol.for("react.memo_cache_sentinel")?(x={status:"ready",task:null},s[30]=x):x=s[30],x}if(m.isLoading){let x;return s[31]===Symbol.for("react.memo_cache_sentinel")?(x={status:"loading"},s[31]=x):x=s[31],x}if(m.isError){const x=m.error;let y;return s[32]!==x?(y={status:"error",error:x},s[32]=x,s[33]=y):y=s[33],y}if(m.isSuccess&&m.data){let x;return s[34]!==m.data?(x={status:"ready",task:m.data},s[34]=m.data,s[35]=x):x=s[35],x}if(g.isPending||m.isSuccess&&!m.data){let x;return s[36]===Symbol.for("react.memo_cache_sentinel")?(x={status:"creating"},s[36]=x):x=s[36],x}if(g.isError){let x;return s[37]!==g.error?(x={status:"error",error:g.error},s[37]=g.error,s[38]=x):x=s[38],x}let S;return s[39]===Symbol.for("react.memo_cache_sentinel")?(S={status:"loading"},s[39]=S):S=s[39],S}function ps(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function In(t){if(!t)return"—";const e=typeof t=="string"?new Date(t):t;return isNaN(e.getTime())?"—":e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function Eh(t){return t?t.replace(/-\d{8}(?:-[a-z0-9]+)*$/i,"").replace(/-/g," "):"—"}function Th(t){const e=K.c(4),{items:s}=t;let i;e[0]!==s?(i=s.map(Rh),e[0]=s,e[1]=i):i=e[1];let r;return e[2]!==i?(r=o.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-6",children:i}),e[2]=i,e[3]=r):r=e[3],r}function Rh(t){return o.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[o.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.label}),o.jsx("span",{className:"text-sm text-foreground tabular-nums truncate",children:t.value})]},t.label)}function Dh(t){const e=K.c(30),{userTokens:s,assistantTokens:i,otherTokens:r}=t,n=s+i+r,a=n>0?s/n*100:0,l=n>0?i/n*100:0,h=n>0?r/n*100:0;let c;e[0]!==a?(c=a>0&&o.jsx("div",{className:"h-full bg-chart-1",style:{width:`${a}%`}}),e[0]=a,e[1]=c):c=e[1];let u;e[2]!==l?(u=l>0&&o.jsx("div",{className:"h-full bg-chart-2",style:{width:`${l}%`}}),e[2]=l,e[3]=u):u=e[3];let d;e[4]!==h?(d=h>0&&o.jsx("div",{className:"h-full bg-muted-foreground/30",style:{width:`${h}%`}}),e[4]=h,e[5]=d):d=e[5];let m;e[6]!==c||e[7]!==u||e[8]!==d?(m=o.jsxs("div",{className:"flex h-2 w-full overflow-hidden rounded-full bg-muted",children:[c,u,d]}),e[6]=c,e[7]=u,e[8]=d,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-1 shrink-0"}),e[10]=_):_=e[10];let f;e[11]!==a?(f=a.toFixed(1),e[11]=a,e[12]=f):f=e[12];let p;e[13]!==f?(p=o.jsxs("div",{className:"flex items-center gap-1.5",children:[_,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["User ",f,"%"]})]}),e[13]=f,e[14]=p):p=e[14];let g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-chart-2 shrink-0"}),e[15]=g):g=e[15];let v;e[16]!==l?(v=l.toFixed(1),e[16]=l,e[17]=v):v=e[17];let b;e[18]!==v?(b=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Assistant ",v,"%"]})]}),e[18]=v,e[19]=b):b=e[19];let S;e[20]!==h||e[21]!==r?(S=r>0&&o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block h-2 w-2 rounded-sm bg-muted-foreground/30 shrink-0"}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:["Other ",h.toFixed(1),"%"]})]}),e[20]=h,e[21]=r,e[22]=S):S=e[22];let x;e[23]!==b||e[24]!==S||e[25]!==p?(x=o.jsxs("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:[p,b,S]}),e[23]=b,e[24]=S,e[25]=p,e[26]=x):x=e[26];let y;return e[27]!==x||e[28]!==m?(y=o.jsxs("div",{className:"flex flex-col gap-2",children:[m,x]}),e[27]=x,e[28]=m,e[29]=y):y=e[29],y}function Mh(t){const e=K.c(19),{part:s}=t,i=s.input?.agent_id,r=wt(i),n=r?.title??"Subtask",a=r?.icon??null,l=s.state==="input-streaming"||s.state==="input-available"||s.state==="output-available"&&s.preliminary===!0,h=s.state==="output-error",c=s.state==="approval-requested";let u;e[0]!==a||e[1]!==n?(u=o.jsx(ds,{icon:a,name:n,size:"xs",className:"size-6 rounded-md shrink-0"}),e[0]=a,e[1]=n,e[2]=u):u=e[2];const d=h?"text-destructive":"text-foreground";let m;e[3]!==d?(m=ee("shrink-0 font-medium",d),e[3]=d,e[4]=m):m=e[4];let _;e[5]!==n||e[6]!==m?(_=o.jsx("span",{className:m,children:n}),e[5]=n,e[6]=m,e[7]=_):_=e[7];let f;e[8]!==s.input?(f=s.input?.prompt&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-muted-foreground/50",children:"·"}),o.jsx("span",{className:"truncate text-muted-foreground",children:s.input.prompt})]}),e[8]=s.input,e[9]=f):f=e[9];let p;e[10]!==c||e[11]!==h||e[12]!==l?(p=o.jsx("span",{className:"ml-auto shrink-0",children:l?o.jsx(Be,{size:12,className:"animate-spin text-muted-foreground"}):h?o.jsx(Xl,{size:12,className:"text-destructive"}):c?o.jsx(Is,{size:12,className:"text-warning"}):o.jsx(Gl,{size:12,className:"text-emerald-500"})}),e[10]=c,e[11]=h,e[12]=l,e[13]=p):p=e[13];let g;return e[14]!==u||e[15]!==_||e[16]!==f||e[17]!==p?(g=o.jsxs("div",{className:"flex items-center gap-2 text-xs min-w-0",children:[u,_,f,p]}),e[14]=u,e[15]=_,e[16]=f,e[17]=p,e[18]=g):g=e[18],g}function Ah(t){const e=K.c(58),{onClose:s,back:i,className:r}=t,[n,a]=P.useState(null),{messages:l}=Qo(),{tasks:h,taskId:c}=lt(),{selectedModel:u,selectedVirtualMcp:d}=Ci();let m,_,f,p,g,v,b,S;if(e[0]!==i||e[1]!==r||e[2]!==l||e[3]!==s||e[4]!==n?.id||e[5]!==u||e[6]!==d?.title||e[7]!==c||e[8]!==h){S=Symbol.for("react.early_return_sentinel");e:{let k;e[17]!==c?(k=J=>J.id===c,e[17]=c,e[18]=k):k=e[18];const w=h.find(k),N=tc(l),j=[...l].reverse().find(Uh),M=j?.metadata?.usage,R=j?.metadata?.modelLimits?.contextWindow??u?.limits?.contextWindow??null,D=M?.contextTokens??M?.totalTokens??0,C=R&&R>0?(D/R*100).toFixed(1):null,T=l;let E;e[19]!==T?(E=T.filter(Wh).reduce(Hh,0),e[19]=T,e[20]=E):E=e[20];const A=E,O=l;let L;e[21]!==O?(L=O.filter(Fh).reduce($h,0),e[21]=O,e[22]=L):L=e[22];const B=L,F=Math.max(0,N.totalTokens-A-B),z=l[0],$=l.at(-1),V=z?.metadata?.created_at??w?.created_at,W=$?.metadata?.created_at??w?.updated_at,U=l.filter(zh),q=l.flatMap(Lh),I=u?.modelId?Eh(u.modelId):"—",X=d?.title??"Decopilot",Y=[{label:"Session",value:w?.title??"New chat"},{label:"Messages",value:U.length},{label:"Agent",value:X},{label:"Model",value:I},{label:"Context Limit",value:R?ps(R):"—"},{label:"Session Tokens (billed)",value:N.totalTokens>0?ps(N.totalTokens):"0"},{label:"Usage",value:C!==null?`${C}%`:"—"},{label:"Input Tokens",value:N.inputTokens>0?ps(N.inputTokens):"0"},{label:"Output Tokens",value:N.outputTokens>0?ps(N.outputTokens):"0"},{label:"Reasoning Tokens",value:N.reasoningTokens>0?ps(N.reasoningTokens):"0"},{label:"Cost",value:N.cost>0?`$${N.cost<.001?N.cost.toFixed(6):N.cost.toFixed(4)}`:"$0.00"},{label:"Session Created",value:In(V)},{label:"Last Activity",value:In(W)}];if(!w&&U.length===0){let J;e[23]!==r?(J=ee("flex flex-col h-full w-full border-l border-border bg-background",r),e[23]=r,e[24]=J):J=e[24];let de;e[25]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[25]=de):de=e[25];let ue;e[26]!==i?(ue=i?o.jsx(yn,{size:14,className:"text-muted-foreground"}):o.jsx(ls,{size:14,className:"text-muted-foreground"}),e[26]=i,e[27]=ue):ue=e[27];let he;e[28]!==s||e[29]!==ue?(he=o.jsxs("div",{className:"h-11 px-4 flex items-center justify-between shrink-0 border-b border-border/50",children:[de,o.jsx("button",{type:"button",onClick:s,className:"flex size-6 items-center justify-center rounded hover:bg-accent transition-colors",children:ue})]}),e[28]=s,e[29]=ue,e[30]=he):he=e[30];let pe;e[31]===Symbol.for("react.memo_cache_sentinel")?(pe=o.jsx("div",{className:"flex-1 flex items-center justify-center px-4 text-center",children:o.jsx("p",{className:"text-xs text-muted-foreground",children:"Start a conversation to see context"})}),e[31]=pe):pe=e[31];let ke;e[32]!==J||e[33]!==he?(ke=o.jsxs("div",{className:J,children:[he,pe]}),e[32]=J,e[33]=he,e[34]=ke):ke=e[34],S=ke;break e}e[35]!==r?(v=ee("flex flex-col h-full w-full border-l border-border bg-background overflow-y-auto",r),e[35]=r,e[36]=v):v=e[36];let te;e[37]===Symbol.for("react.memo_cache_sentinel")?(te=o.jsx("span",{className:"text-sm font-medium text-foreground",children:"Context"}),e[37]=te):te=e[37];let ce;e[38]!==i?(ce=i?o.jsx(yn,{size:14}):o.jsx(ls,{size:14}),e[38]=i,e[39]=ce):ce=e[39],e[40]!==s||e[41]!==ce?(b=o.jsxs("div",{className:"flex h-11 shrink-0 items-center justify-between border-b border-border/50 px-4",children:[te,o.jsx("button",{type:"button",onClick:s,className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:ce})]}),e[40]=s,e[41]=ce,e[42]=b):b=e[42],m="flex flex-col gap-8 p-6",_=q.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Subtasks"}),o.jsx("div",{className:"flex flex-col gap-1",children:q.map(Ph)})]}),f=o.jsx(Th,{items:Y});let ne;e[43]===Symbol.for("react.memo_cache_sentinel")?(ne=o.jsx("span",{className:"text-xs text-muted-foreground",children:"Context Breakdown"}),e[43]=ne):ne=e[43],e[44]!==B||e[45]!==F||e[46]!==A?(p=o.jsxs("div",{className:"flex flex-col gap-3",children:[ne,o.jsx(Dh,{userTokens:A,assistantTokens:B,otherTokens:F})]}),e[44]=B,e[45]=F,e[46]=A,e[47]=p):p=e[47],g=U.length>0&&o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"Raw messages"}),o.jsx("div",{className:"flex flex-col gap-1",children:U.map(J=>{const de=J.metadata?.created_at,ue=n?.id===J.id;return o.jsxs("div",{className:"rounded-md border border-border/50 overflow-hidden",children:[o.jsxs("button",{type:"button",onClick:()=>a(ue?null:J),className:"flex items-center justify-between gap-2 px-3 py-2 text-xs hover:bg-accent/50 w-full text-left cursor-pointer",children:[o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[o.jsx("span",{className:ee("shrink-0 font-medium",J.role==="user"?"text-chart-1":"text-chart-2"),children:J.role}),o.jsx("span",{className:"text-muted-foreground",children:"•"}),o.jsx("span",{className:"truncate text-muted-foreground font-mono",children:J.id})]}),de&&o.jsx("span",{className:"shrink-0 text-muted-foreground tabular-nums",children:new Date(de).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})})]}),ue&&o.jsxs(o.Fragment,{children:[J.role==="assistant"&&(()=>{const he=J.metadata?._request;if(!he)return null;const pe=he.systemSections??[],ke=Math.max(1,...pe.map(Bh)),re=pe.reduce(Ih,0);return o.jsxs("div",{className:"border-t border-border/50 px-3 py-2.5 text-xs space-y-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium text-foreground",children:"Request"}),o.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[he.activeTools??0," / ",he.tools??0," ","tools active"]})]}),pe.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"text-muted-foreground",children:["System prompt"," ",o.jsxs("span",{className:"tabular-nums",children:["~",Math.round(re/4).toLocaleString()," ","tok"]})]}),pe.map((_e,He)=>{const De=_e.preview.match(/^<([a-z-]+)/i)?.[1]??`section ${He}`,je=_e.chars/ke*100,vt=Math.round(_e.chars/4);return o.jsxs("div",{className:"space-y-0.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-mono text-foreground truncate",children:De}),o.jsxs("span",{className:"text-muted-foreground tabular-nums shrink-0",children:["~",vt.toLocaleString()," tok"]})]}),o.jsx("div",{className:"h-1 w-full rounded-full bg-muted overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full bg-chart-3",style:{width:`${je}%`}})})]},He)})]})]})})(),o.jsx("pre",{className:"text-xs font-mono bg-muted px-3 py-2 overflow-auto whitespace-pre-wrap break-all border-t border-border/50 max-h-64",children:JSON.stringify(J,null,2)})]})]},J.id)})})]})}e[0]=i,e[1]=r,e[2]=l,e[3]=s,e[4]=n?.id,e[5]=u,e[6]=d?.title,e[7]=c,e[8]=h,e[9]=m,e[10]=_,e[11]=f,e[12]=p,e[13]=g,e[14]=v,e[15]=b,e[16]=S}else m=e[9],_=e[10],f=e[11],p=e[12],g=e[13],v=e[14],b=e[15],S=e[16];if(S!==Symbol.for("react.early_return_sentinel"))return S;let x;e[48]!==m||e[49]!==_||e[50]!==f||e[51]!==p||e[52]!==g?(x=o.jsxs("div",{className:m,children:[_,f,p,g]}),e[48]=m,e[49]=_,e[50]=f,e[51]=p,e[52]=g,e[53]=x):x=e[53];let y;return e[54]!==v||e[55]!==b||e[56]!==x?(y=o.jsxs("div",{className:v,children:[b,x]}),e[54]=v,e[55]=b,e[56]=x,e[57]=y):y=e[57],y}function Ih(t,e){return t+e.chars}function Bh(t){return t.chars}function Ph(t,e){return o.jsx(Mh,{part:t},e)}function Lh(t){return(t.parts??[]).filter(Oh)}function Oh(t){return t.type==="tool-subtask"}function zh(t){return t.role!=="system"}function $h(t,e){const s=e.metadata?.usage;return t+(s?.outputTokens??0)}function Fh(t){return t.role==="assistant"}function Hh(t,e){const s=e.metadata?.usage;return t+(s?.inputTokens??0)}function Wh(t){return t.role==="user"}function Uh(t){return t.role==="assistant"&&t.metadata?.usage}const Bn=["amber","bold","bright","calm","crimson","coral","daring","deep","dusty","eager","faint","fierce","frozen","gentle","golden","grand","green","hollow","iron","ivory","keen","lasting","lunar","mellow","misty","noble","olive","pale","prime","quiet","rapid","rustic","serene","sharp","silver","sleek","solar","stark","still","swift","tawny","tender","thin","true","vast","velvet","warm","wild","young","zen"],Pn=["anchor","birch","brook","cedar","cliff","cove","crane","dune","echo","ember","falcon","fern","flint","forge","frost","glade","grove","harbor","hawk","iris","jade","lark","maple","marsh","mesa","opal","orbit","peak","pine","plume","quartz","rapids","reef","ridge","river","sage","shore","slate","spruce","stone","summit","thorn","tide","trail","vale","wren","aspen","delta","crest","spark"];function Vh(){const t=Bn[Math.floor(Math.random()*Bn.length)],e=Pn[Math.floor(Math.random()*Pn.length)];return`deco/${t}-${e}`}function Kh(t){const e=t;if(e.structuredContent)return e.structuredContent;const s=e.content?.find(i=>i.type==="text")?.text;if(s)try{return JSON.parse(s)}catch{return[]}return[]}function qh(t){const e=K.c(26),{orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:a,owner:l,repo:h,enabled:c}=t,u=c===void 0?!0:c,d=n??null;let m;e[0]!==s||e[1]!==i||e[2]!==d?(m={connectionId:d,orgId:s,orgSlug:i},e[0]=s,e[1]=i,e[2]=d,e[3]=m):m=e[3];const _=Ue(m);let f;e[4]!==l||e[5]!==h?(f={owner:l,repo:h},e[4]=l,e[5]=h,e[6]=f):f=e[6];const p=u&&!!n&&!!l&&!!h;let g;e[7]!==_||e[8]!==f||e[9]!==p?(g={client:_,toolName:"list_branches",toolArguments:f,enabled:p,staleTime:3e4,select:Jh},e[7]=_,e[8]=f,e[9]=p,e[10]=g):g=e[10];const{data:v,isLoading:b,isError:S}=us(g);let x,y;e[11]!==r||e[12]!==a?(y=new Set(Object.keys(a?.[r]??{})),x=[...y].sort().map(Xh),e[11]=r,e[12]=a,e[13]=x,e[14]=y):(x=e[13],y=e[14]);const k=x;let w;if(e[15]!==v||e[16]!==y){const R=Array.isArray(v)?v:v?.branches??[];let D;e[18]!==y?(D=C=>!y.has(C.name),e[18]=y,e[19]=D):D=e[19],w=R.filter(Yh).filter(D).map(Gh),e[15]=v,e[16]=y,e[17]=w}else w=e[17];const N=w,j=Array.isArray(v)?null:v?.default_branch??null;let M;return e[20]!==j||e[21]!==S||e[22]!==b||e[23]!==N||e[24]!==k?(M={yours:k,others:N,defaultBase:j,isLoading:b,isError:S},e[20]=j,e[21]=S,e[22]=b,e[23]=N,e[24]=k,e[25]=M):M=e[25],M}function Gh(t){return{name:t.name,source:"other",author:typeof t.commit?.author=="string"?t.commit.author:t.commit?.author?.login??null}}function Yh(t){return typeof t.name=="string"}function Xh(t){return{name:t,source:"yours"}}function Jh(t){return Kh(t)}function Zh(t){const e=K.c(42),{orgId:s,orgSlug:i,userId:r,connectionId:n,owner:a,repo:l,vmMap:h,value:c,onChange:u}=t,[d,m]=P.useState(!1);let _;e[0]!==n||e[1]!==d||e[2]!==s||e[3]!==i||e[4]!==a||e[5]!==l||e[6]!==r||e[7]!==h?(_={orgId:s,orgSlug:i,userId:r,connectionId:n,vmMap:h,owner:a,repo:l,enabled:d},e[0]=n,e[1]=d,e[2]=s,e[3]=i,e[4]=a,e[5]=l,e[6]=r,e[7]=h,e[8]=_):_=e[8];const{yours:f,others:p,isLoading:g,isError:v}=qh(_);let b;e[9]!==u?(b=A=>{u(A),m(!1)},e[9]=u,e[10]=b):b=e[10];const S=b,x=c??"Select branch…";let y;e[11]===Symbol.for("react.memo_cache_sentinel")?(y=o.jsx(Es,{className:"h-3.5 w-3.5"}),e[11]=y):y=e[11];let k;e[12]!==x?(k=o.jsx(Fs,{asChild:!0,children:o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 font-mono text-xs",children:[y,o.jsx("span",{className:"max-w-[200px] truncate",children:x})]})}),e[12]=x,e[13]=k):k=e[13];let w;e[14]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(uc,{placeholder:"Search branches…"}),e[14]=w):w=e[14];let N;e[15]!==S?(N=o.jsxs("div",{className:"flex items-center border-b pr-2 [&>[data-slot=command-input-wrapper]]:flex-1 [&>[data-slot=command-input-wrapper]]:border-b-0",children:[w,o.jsx(se,{variant:"outline",size:"sm",className:"h-7 shrink-0",onClick:()=>S(Vh()),children:"New"})]}),e[15]=S,e[16]=N):N=e[16];let j;e[17]!==v?(j=v&&o.jsx("div",{className:"p-3 text-xs text-muted-foreground",children:"Couldn't load branches from GitHub. You can still pick from your branches."}),e[17]=v,e[18]=j):j=e[18];let M;e[19]!==v||e[20]!==g||e[21]!==p.length||e[22]!==f.length?(M=!v&&!g&&f.length===0&&p.length===0&&o.jsx(hc,{children:"No branches found."}),e[19]=v,e[20]=g,e[21]=p.length,e[22]=f.length,e[23]=M):M=e[23];let R;e[24]!==S||e[25]!==f?(R=f.length>0&&o.jsx(kn,{heading:"Your branches",children:f.map(A=>o.jsxs(Nn,{value:A.name,onSelect:()=>S(A.name),children:[o.jsx(Es,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:A.name})]},A.name))}),e[24]=S,e[25]=f,e[26]=R):R=e[26];let D;e[27]!==p||e[28]!==S?(D=p.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(dc,{}),o.jsx(kn,{heading:"Other branches in repo",children:p.map(A=>o.jsxs(Nn,{value:A.name,onSelect:()=>S(A.name),children:[o.jsx(Es,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"flex-1 truncate",children:A.name}),A.author&&o.jsxs("span",{className:"text-xs text-muted-foreground",children:["@",A.author]})]},A.name))})]}),e[27]=p,e[28]=S,e[29]=D):D=e[29];let C;e[30]!==D||e[31]!==j||e[32]!==M||e[33]!==R?(C=o.jsxs(fc,{children:[j,M,R,D]}),e[30]=D,e[31]=j,e[32]=M,e[33]=R,e[34]=C):C=e[34];let T;e[35]!==C||e[36]!==N?(T=o.jsx(Hs,{className:"w-[min(420px,calc(100vw-2rem))] p-0",align:"start",children:o.jsxs(mc,{children:[N,C]})}),e[35]=C,e[36]=N,e[37]=T):T=e[37];let E;return e[38]!==d||e[39]!==T||e[40]!==k?(E=o.jsxs(Ws,{open:d,onOpenChange:m,children:[k,T]}),e[38]=d,e[39]=T,e[40]=k,e[41]=E):E=e[41],E}function Qh(){const t=K.c(27),{org:e}=ve(),{selectedVirtualMcp:s}=Ci(),{data:i}=wi.useSession(),{currentBranch:r,setCurrentTaskBranch:n}=lt();let a;t[0]!==e.id?(a=Jo(e.id),t[0]=e.id,t[1]=a):a=t[1];const h=s??a,c=wt(h.id),u=i?.user?.id??"",d=c?.metadata?.githubRepo??null,m=!!d?.connectionId&&!!u;let _;t[2]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Kl,{size:32}),t[2]=_):_=t[2];let f;t[3]!==h.icon||t[4]!==h.title?(f=o.jsx(ds,{icon:h.icon,name:h.title,size:"lg",fallbackIcon:_,className:"size-10 min-w-10 md:size-[60px]! md:min-w-[60px] rounded-xl md:rounded-[18px]!"}),t[3]=h.icon,t[4]=h.title,t[5]=f):f=t[5];let p;t[6]!==h.title?(p=o.jsx("h3",{className:"text-base md:text-xl font-medium text-foreground",children:h.title}),t[6]=h.title,t[7]=p):p=t[7];const g=h.description??"Ask anything about configuring model providers or using MCP Mesh.";let v;t[8]!==g?(v=o.jsx("div",{className:"text-muted-foreground text-center text-base max-w-md line-clamp-2",children:g}),t[8]=g,t[9]=v):v=t[9];let b;t[10]!==r||t[11]!==c?.metadata?.vmMap||t[12]!==d||t[13]!==e.id||t[14]!==e.slug||t[15]!==n||t[16]!==m||t[17]!==u?(b=m&&o.jsx("div",{className:"mt-2",children:o.jsx(Zh,{orgId:e.id,orgSlug:e.slug,userId:u,connectionId:d.connectionId,owner:d.owner,repo:d.name,vmMap:c?.metadata?.vmMap,value:r??void 0,onChange:n})}),t[10]=r,t[11]=c?.metadata?.vmMap,t[12]=d,t[13]=e.id,t[14]=e.slug,t[15]=n,t[16]=m,t[17]=u,t[18]=b):b=t[18];let S;t[19]!==f||t[20]!==p||t[21]!==v||t[22]!==b?(S=o.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 md:gap-4 text-center",children:[f,p,v,b]}),t[19]=f,t[20]=p,t[21]=v,t[22]=b,t[23]=S):S=t[23];let x;t[24]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx("div",{className:"w-full max-w-3xl mx-auto",children:o.jsx(Ee.IceBreakers,{})}),t[24]=x):x=t[24];let y;return t[25]!==S?(y=o.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center gap-6 px-4",children:[S,x]}),t[25]=S,t[26]=y):y=t[26],y}function ed(){const t=K.c(26),{org:e}=ve(),s=jc(),{isChatEmpty:i}=Qo(),[r,n]=P.useState("chat"),a=$l();if(s.length===0){let S;return t[0]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Ee,{className:"animate-in fade-in-0 duration-200",children:o.jsx(Ee.Main,{className:"flex flex-col items-center",children:o.jsx(Ee.EmptyState,{children:o.jsx(Ee.NoAiProviderEmptyState,{})})})}),t[0]=S):S=t[0],S}let l;t[1]!==a.hasDecoKey||t[2]!==a.hasOnlyDecoProvider||t[3]!==a.isLoading||t[4]!==a.isZeroBalance||t[5]!==i||t[6]!==e?(l=a.hasDecoKey&&a.isZeroBalance&&a.hasOnlyDecoProvider&&!a.isLoading&&i&&!Fl(e.id),t[1]=a.hasDecoKey,t[2]=a.hasOnlyDecoProvider,t[3]=a.isLoading,t[4]=a.isZeroBalance,t[5]=i,t[6]=e,t[7]=l):l=t[7];const h=l;let c;t[8]!==h?(c=h&&o.jsx(Ee.CreditsEmptyState,{}),t[8]=h,t[9]=c):c=t[9];const u=r!=="chat"?"opacity-0 pointer-events-none":"opacity-100";let d;t[10]!==u?(d=ee("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",u),t[10]=u,t[11]=d):d=t[11];let m;t[12]!==i?(m=i?o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Qh,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ee.Main,{children:o.jsx(Ee.Messages,{})}),o.jsx(Ee.Footer,{children:o.jsx(Ee.Input,{onOpenContextPanel:()=>n("context")})})]}),t[12]=i,t[13]=m):m=t[13];let _;t[14]!==d||t[15]!==m?(_=o.jsx("div",{className:d,children:m}),t[14]=d,t[15]=m,t[16]=_):_=t[16];const f=r==="context"?"opacity-100":"opacity-0 pointer-events-none";let p;t[17]!==f?(p=ee("absolute inset-0 flex flex-col transition-opacity duration-100 ease-out",f),t[17]=f,t[18]=p):p=t[18];let g;t[19]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx(Ah,{back:!0,onClose:()=>n("chat")}),t[19]=g):g=t[19];let v;t[20]!==p?(v=o.jsx("div",{className:p,children:g}),t[20]=p,t[21]=v):v=t[21];let b;return t[22]!==c||t[23]!==_||t[24]!==v?(b=o.jsxs(Ee,{className:"relative overflow-hidden animate-in fade-in-0 duration-200",children:[c,_,v]}),t[22]=c,t[23]=_,t[24]=v,t[25]=b):b=t[25],b}function ja(){const t=K.c(2);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(Ee.Skeleton,{}),t[0]=e):e=t[0];let s;return t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsx($t,{fallback:e,children:o.jsx(P.Suspense,{fallback:o.jsx(Ee.Skeleton,{}),children:o.jsx(ed,{})})}),t[1]=s):s=t[1],s}async function td(t,e,s){const i=await t.callTool({name:e,arguments:s});if(i.isError){const r=i.content?.[0]?.text??`Tool ${e} failed without a message`;throw new Error(r)}return i}const Ea=["VM_START"],Zs=new Map,sd=t=>`${t.virtualMcpId}::${t.branch??""}`,Hi=new Set,pi={mark:(t,e)=>Hi.add(`${t}::${e}`),clear:(t,e)=>Hi.delete(`${t}::${e}`),isStopped:(t,e)=>Hi.has(`${t}::${e}`)};function on(t){const e=Ut();return Ko({mutationKey:Ea,mutationFn:async s=>{s.branch&&pi.clear(s.virtualMcpId,s.branch);const i=sd(s),r=Zs.get(i);if(r)return r;const n=(async()=>(await td(t,"VM_START",s)).structuredContent)();Zs.set(i,n);try{return await n}finally{Zs.get(i)===n&&Zs.delete(i)}},onSuccess:()=>{ni(e)}})}function Ta(t,e){const s=K.c(3);let i;return s[0]!==e||s[1]!==t?(i={mutationKey:Ea,predicate:n=>{if(!t)return!1;const a=n.state.variables;return!a||a.virtualMcpId!==t?!1:(a.branch??"")===(e??"")}},s[0]=e,s[1]=t,s[2]=i):i=s[2],kh(i)>0}const id={settings:pc,automations:_c,env:_i,preview:Jl,git:Es};function Ln(t){const e=ji(t);if(e.type==="icon"){const s=Ei(e.name);return s?{kind:"component",Component:s}:null}return e.type==="url"?{kind:"url",src:e.url}:null}function Wi(t){if(t.kind==="system")return{kind:"component",Component:id[t.tabId]};const e=Ln(t.iconUrl);if(e)return e;if(!t.appId)return{kind:"fallback"};const s=t.connections.find(r=>r.id===t.appId);if(!s)return{kind:"fallback"};const i=Ln(s.icon);return i||{kind:"fallback"}}function rd(t){const{org:e}=ve(),s=Ue({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),{data:i}=Rl({queryKey:As.threadMetadata(t),queryFn:async()=>{if(!s||!t)return null;try{const r=await s.callTool({name:"COLLECTION_THREADS_GET",arguments:{id:t}});return(r.structuredContent??r).item?.metadata??null}catch{return null}},staleTime:3e4});return i}function Ra(t){const e=K.c(8),s=It();let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={strict:!1},e[0]=i):i=e[0];const r=Zr(i),n=wt(t.virtualMcpId),a=rd(t.taskId),{currentBranch:l}=lt(),h=n?.metadata?.ui??null,c=h?.layout??null,u=c?.tabs??[],d=h?.pinnedViews??[],m=a?.expanded_tools??[],_=!!(n&&Vt(n));let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f={includeVirtual:!0},e[1]=f):f=e[1];const p=Ti(f),{activeTab:g,mainOpen:v}=sc({mainParam:r.main,metadata:c?{defaultMainView:c.defaultMainView??null,tabs:u.map(nd)}:null}),b=ea(g),S=[];_&&(S.push({id:"preview",title:"Preview"}),S.push({id:"env",title:"Terminal"}),S.push({id:"git",title:l??"git"})),S.push({id:"settings",title:"Settings"}),S.push({id:"automations",title:"Automations"});const x=new Map;for(const j of m){const M=wn(j.appId,j.toolName);x.set(M,{id:M,title:j.toolName,appId:j.appId,iconKey:j.toolName})}for(const j of d){const M=wn(j.connectionId,j.toolName);x.set(M,{id:M,title:j.label||j.toolName,appId:j.connectionId,iconKey:j.toolName,iconUrl:j.icon??null})}let y;e[2]!==p?(y=j=>({id:j.id,title:j.title,kind:"agent",icon:Wi({tabId:j.id,kind:"agent",appId:j.view.appId,connections:p})}),e[2]=p,e[3]=y):y=e[3];const k=[...u.map(y),...Array.from(x.values()).map(j=>({id:j.id,title:j.title,kind:"expanded",icon:Wi({tabId:j.iconKey,kind:"expanded",appId:j.appId,iconUrl:j.iconUrl,connections:p})})),...S.map(j=>({id:j.id,title:j.title,kind:"system",icon:Wi({tabId:j.id,kind:"system",connections:p})}))];let w;return e[4]!==g||e[5]!==v||e[6]!==s?(w=j=>{const M=ic({clickedId:j,activeTab:g,mainOpen:v});s({to:".",search:R=>({...R,main:M}),replace:!0})},e[4]=g,e[5]=v,e[6]=s,e[7]=w):w=e[7],{activeTab:g,mainOpen:v,setActiveTab:w,systemTabs:S,layoutTabs:u,expandedTools:m,automationTabParsed:b,tabs:k}}function nd(t){return{id:t.id}}function od(t){const e=K.c(84),{value:s,onChange:i,onColorChange:r,name:n,size:a,className:l,avatarClassName:h,showHoverOverlay:c,disabled:u}=t,d=a===void 0?"lg":a,m=c===void 0?!0:c,_=u===void 0?!1:u,[f,p]=P.useState(!1),[g,v]=P.useState("icons"),[b,S]=P.useState(""),[x,y]=P.useState("blue");let k;e[0]!==s?(k=ji(s),e[0]=s,e[1]=k):k=e[1];const w=k,N=w.type==="icon"||w.type==="url"&&w.color?w.color:x;let j;e[2]!==i||e[3]!==N?(j=je=>{i(Oi(je,N))},e[2]=i,e[3]=N,e[4]=j):j=e[4];const M=j;let R;e[5]!==i||e[6]!==r||e[7]!==w.name||e[8]!==w.type||e[9]!==w.url?(R=je=>{y(je),r?.(je),w.type==="icon"?i(Oi(w.name,je)):w.type==="url"&&i(jn(w.url,je))},e[5]=i,e[6]=r,e[7]=w.name,e[8]=w.type,e[9]=w.url,e[10]=R):R=e[10];const D=R;let C;e[11]!==i||e[12]!==N?(C=je=>{i(jn(je,N)),p(!1)},e[11]=i,e[12]=N,e[13]=C):C=e[13];const T=C;let E;e[14]!==i||e[15]!==N?(E=()=>{const je=en(),vt=je[Math.floor(Math.random()*je.length)];i(Oi(vt,N))},e[14]=i,e[15]=N,e[16]=E):E=e[16];const A=E;let O,L,B,F,z,$,V,W;if(e[17]!==l||e[18]!==_||e[19]!==f||e[20]!==d){const je={xs:"rounded-md",sm:"rounded-lg","sm+":"rounded-xl",md:"rounded-xl",lg:"rounded-2xl",xl:"rounded-2xl"};L=Ws,$=_?!1:f,V=p,O=Fs,z=!0,W="button",B=_,F=ee("relative group overflow-hidden",_?"cursor-default opacity-50":"cursor-pointer",je[d],l),e[17]=l,e[18]=_,e[19]=f,e[20]=d,e[21]=O,e[22]=L,e[23]=B,e[24]=F,e[25]=z,e[26]=$,e[27]=V,e[28]=W}else O=e[21],L=e[22],B=e[23],F=e[24],z=e[25],$=e[26],V=e[27],W=e[28];let U;e[29]!==h||e[30]!==n||e[31]!==d||e[32]!==s?(U=o.jsx(En,{icon:s,name:n,size:d,className:h}),e[29]=h,e[30]=n,e[31]=d,e[32]=s,e[33]=U):U=e[33];let q;e[34]!==_||e[35]!==m?(q=m&&!_&&o.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(ia,{size:16,className:"text-white"})}),e[34]=_,e[35]=m,e[36]=q):q=e[36];let I;e[37]!==B||e[38]!==F||e[39]!==U||e[40]!==q||e[41]!==W?(I=o.jsxs("button",{type:W,disabled:B,className:F,children:[U,q]}),e[37]=B,e[38]=F,e[39]=U,e[40]=q,e[41]=W,e[42]=I):I=e[42];let X;e[43]!==O||e[44]!==z||e[45]!==I?(X=o.jsx(O,{asChild:z,children:I}),e[43]=O,e[44]=z,e[45]=I,e[46]=X):X=e[46];let Y;e[47]!==n||e[48]!==s?(Y=o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx(En,{icon:s,name:n,size:"xl"})}),e[47]=n,e[48]=s,e[49]=Y):Y=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=()=>v("icons"),e[50]=te):te=e[50];const ce=g==="icons"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let ne;e[51]!==ce?(ne=ee("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ce),e[51]=ce,e[52]=ne):ne=e[52];let J;e[53]!==ne?(J=o.jsx("button",{type:"button",onClick:te,className:ne,children:"Icons"}),e[53]=ne,e[54]=J):J=e[54];let de;e[55]===Symbol.for("react.memo_cache_sentinel")?(de=()=>v("upload"),e[55]=de):de=e[55];const ue=g==="upload"?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground";let he;e[56]!==ue?(he=ee("px-3 py-2 text-sm font-medium border-b-2 -mb-px transition-colors",ue),e[56]=ue,e[57]=he):he=e[57];let pe;e[58]!==he?(pe=o.jsx("button",{type:"button",onClick:de,className:he,children:"Upload"}),e[58]=he,e[59]=pe):pe=e[59];let ke;e[60]===Symbol.for("react.memo_cache_sentinel")?(ke=o.jsx("div",{className:"flex-1"}),e[60]=ke):ke=e[60];let re;e[61]!==J||e[62]!==pe?(re=o.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[J,pe,ke]}),e[61]=J,e[62]=pe,e[63]=re):re=e[63];let _e;e[64]!==D||e[65]!==A||e[66]!==M||e[67]!==T||e[68]!==w.name||e[69]!==w.type||e[70]!==b||e[71]!==N||e[72]!==g?(_e=g==="icons"?o.jsx(hd,{search:b,onSearchChange:S,selectedColor:N,onColorChange:D,onSelectIcon:M,onRandom:A,currentIconName:w.type==="icon"?w.name:null}):o.jsx(dd,{onUpload:T}),e[64]=D,e[65]=A,e[66]=M,e[67]=T,e[68]=w.name,e[69]=w.type,e[70]=b,e[71]=N,e[72]=g,e[73]=_e):_e=e[73];let He;e[74]!==Y||e[75]!==re||e[76]!==_e?(He=o.jsx(Hs,{align:"start",className:"w-80 p-0",onOpenAutoFocus:ad,children:o.jsxs("div",{className:"flex flex-col",children:[Y,re,_e]})}),e[74]=Y,e[75]=re,e[76]=_e,e[77]=He):He=e[77];let De;return e[78]!==L||e[79]!==$||e[80]!==V||e[81]!==X||e[82]!==He?(De=o.jsxs(L,{open:$,onOpenChange:V,children:[X,He]}),e[78]=L,e[79]=$,e[80]=V,e[81]=X,e[82]=He,e[83]=De):De=e[83],De}function ad(t){return t.preventDefault()}function ld(t){const e=K.c(27),{selectedColor:s,onColorChange:i}=t,[r,n]=P.useState(!1);let a,l,h,c,u,d,m;if(e[0]!==r||e[1]!==s){const b=sa(s);l=Ws,d=r,m=n,a=Fs,u=!0,h="button",c=ee("h-6 w-6 rounded-full shrink-0 ring-2 ring-offset-2 ring-offset-background transition-all cursor-pointer hover:scale-110",b.dot,"ring-foreground/20"),e[0]=r,e[1]=s,e[2]=a,e[3]=l,e[4]=h,e[5]=c,e[6]=u,e[7]=d,e[8]=m}else a=e[2],l=e[3],h=e[4],c=e[5],u=e[6],d=e[7],m=e[8];let _;e[9]!==h||e[10]!==c?(_=o.jsx("button",{type:h,className:c,title:"Change color"}),e[9]=h,e[10]=c,e[11]=_):_=e[11];let f;e[12]!==a||e[13]!==u||e[14]!==_?(f=o.jsx(a,{asChild:u,children:_}),e[12]=a,e[13]=u,e[14]=_,e[15]=f):f=e[15];let p;e[16]!==i||e[17]!==s?(p=vc.map(b=>o.jsx("button",{type:"button",onClick:()=>{i(b.name),n(!1)},className:ee("h-5 w-5 rounded-full transition-all shrink-0 cursor-pointer",b.dot,s===b.name?"ring-2 ring-offset-1 ring-offset-background ring-foreground/30 scale-110":"hover:scale-110"),title:b.name},b.name)),e[16]=i,e[17]=s,e[18]=p):p=e[18];let g;e[19]!==p?(g=o.jsx(Hs,{align:"start",side:"right",sideOffset:8,className:"w-auto p-2",onOpenAutoFocus:cd,children:o.jsx("div",{className:"grid grid-cols-4 gap-1",children:p})}),e[19]=p,e[20]=g):g=e[20];let v;return e[21]!==l||e[22]!==d||e[23]!==m||e[24]!==f||e[25]!==g?(v=o.jsxs(l,{open:d,onOpenChange:m,children:[f,g]}),e[21]=l,e[22]=d,e[23]=m,e[24]=f,e[25]=g,e[26]=v):v=e[26],v}function cd(t){return t.preventDefault()}function hd(t){const e=K.c(44),{search:s,onSearchChange:i,selectedColor:r,onColorChange:n,onSelectIcon:a,onRandom:l,currentIconName:h}=t;let c,u,d,m,_,f,p;if(e[0]!==h||e[1]!==n||e[2]!==l||e[3]!==i||e[4]!==a||e[5]!==s||e[6]!==r){const x=en(),y=sa(r);u=s.trim()?x.filter(D=>{const C=hr(D),T=s.toLowerCase();return C.includes(T)||D.toLowerCase().includes(T)}):x,f="flex flex-col";let k;e[14]===Symbol.for("react.memo_cache_sentinel")?(k=o.jsx(ka,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[14]=k):k=e[14];let w;e[15]!==i?(w=D=>i(D.target.value),e[15]=i,e[16]=w):w=e[16];let N;e[17]!==s||e[18]!==w?(N=o.jsxs("div",{className:"relative flex-1",children:[k,o.jsx(fs,{value:s,onChange:w,placeholder:"Filter...",className:"h-8 text-xs pl-7"})]}),e[17]=s,e[18]=w,e[19]=N):N=e[19];let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=o.jsx(gc,{size:14,className:"text-muted-foreground"}),e[20]=j):j=e[20];let M;e[21]!==l?(M=o.jsx("button",{type:"button",onClick:l,className:"h-8 w-8 flex items-center justify-center rounded-md border border-border hover:bg-accent transition-colors shrink-0",title:"Random icon",children:j}),e[21]=l,e[22]=M):M=e[22];let R;e[23]!==n||e[24]!==r?(R=o.jsx(ld,{selectedColor:r,onColorChange:n}),e[23]=n,e[24]=r,e[25]=R):R=e[25],e[26]!==M||e[27]!==R||e[28]!==N?(p=o.jsxs("div",{className:"flex items-center gap-2 px-3 py-2",children:[N,M,R]}),e[26]=M,e[27]=R,e[28]=N,e[29]=p):p=e[29],c=Ca,_="h-56",d="grid grid-cols-9 gap-0.5 px-2 pb-2",m=u.map(D=>{const C=Ei(D);return C?o.jsx("button",{type:"button",onClick:()=>a(D),className:ee("h-8 w-8 flex items-center justify-center rounded-md transition-colors cursor-pointer",h===D?ee(y.bg,y.text):ee(y.text,"hover:bg-accent")),title:D,children:o.jsx(C,{size:18})},D):null}),e[0]=h,e[1]=n,e[2]=l,e[3]=i,e[4]=a,e[5]=s,e[6]=r,e[7]=c,e[8]=u,e[9]=d,e[10]=m,e[11]=_,e[12]=f,e[13]=p}else c=e[7],u=e[8],d=e[9],m=e[10],_=e[11],f=e[12],p=e[13];let g;e[30]!==d||e[31]!==m?(g=o.jsx("div",{className:d,children:m}),e[30]=d,e[31]=m,e[32]=g):g=e[32];let v;e[33]!==u.length?(v=u.length===0&&o.jsx("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"No icons found"}),e[33]=u.length,e[34]=v):v=e[34];let b;e[35]!==c||e[36]!==_||e[37]!==g||e[38]!==v?(b=o.jsxs(c,{className:_,children:[g,v]}),e[35]=c,e[36]=_,e[37]=g,e[38]=v,e[39]=b):b=e[39];let S;return e[40]!==f||e[41]!==p||e[42]!==b?(S=o.jsxs("div",{className:f,children:[p,b]}),e[40]=f,e[41]=p,e[42]=b,e[43]=S):S=e[43],S}function dd(t){const e=K.c(27),{onUpload:s}=t,i=P.useRef(null);let r;e[0]!==s?(r=k=>{const w=k.target.files?.[0];if(!w)return;if(w.size>2097152){me.error("Image must be smaller than 2MB"),k.target.value="";return}const N=new FileReader;N.onerror=()=>{me.error("Failed to read image file"),i.current&&(i.current.value="")},N.onloadend=()=>{N.readyState===FileReader.DONE&&N.result&&s(N.result),i.current&&(i.current.value="")},N.readAsDataURL(w)},e[0]=s,e[1]=r):r=e[1];const n=r,[a,l]=P.useState("");let h;e[2]!==s||e[3]!==a?(h=()=>{const k=a.trim();k&&(s(k),l(""))},e[2]=s,e[3]=a,e[4]=h):h=e[4];const c=h;let u;e[5]!==n?(u=o.jsx("input",{type:"file",ref:i,className:"hidden",accept:"image/*",onChange:n}),e[5]=n,e[6]=u):u=e[6];let d;e[7]===Symbol.for("react.memo_cache_sentinel")?(d=()=>i.current?.click(),e[7]=d):d=e[7];let m;e[8]===Symbol.for("react.memo_cache_sentinel")?(m=o.jsxs("button",{type:"button",onClick:d,className:"h-24 rounded-lg border-2 border-dashed border-border hover:border-foreground/50 hover:bg-accent/50 transition-colors flex flex-col items-center justify-center gap-2 text-muted-foreground hover:text-foreground",children:[o.jsx(Zl,{size:20}),o.jsx("span",{className:"text-xs",children:"Click to upload an image (max 2MB)"})]}),e[8]=m):m=e[8];let _;e[9]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),o.jsx("div",{className:"flex-1 h-px bg-border"})]}),e[9]=_):_=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=k=>l(k.target.value),e[10]=f):f=e[10];let p;e[11]!==c?(p=k=>{k.key==="Enter"&&(k.preventDefault(),c())},e[11]=c,e[12]=p):p=e[12];let g;e[13]!==a||e[14]!==p?(g=o.jsx(fs,{value:a,onChange:f,placeholder:"Paste image URL...",className:"h-8 text-xs flex-1",onKeyDown:p}),e[13]=a,e[14]=p,e[15]=g):g=e[15];let v;e[16]!==a?(v=a.trim(),e[16]=a,e[17]=v):v=e[17];const b=!v;let S;e[18]!==c||e[19]!==b?(S=o.jsx(se,{variant:"outline",size:"sm",className:"h-8 px-3 text-xs shrink-0",onClick:c,disabled:b,children:"Apply"}),e[18]=c,e[19]=b,e[20]=S):S=e[20];let x;e[21]!==S||e[22]!==g?(x=o.jsxs("div",{className:"flex items-center gap-1.5",children:[g,S]}),e[21]=S,e[22]=g,e[23]=x):x=e[23];let y;return e[24]!==x||e[25]!==u?(y=o.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[u,m,_,x]}),e[24]=x,e[25]=u,e[26]=y):y=e[26],y}function ud(t){const e=K.c(5),{value:s}=t;let i;if(e[0]!==s){i=Symbol.for("react.early_return_sentinel");e:{const n=ji(s);if(n.type==="icon"){const a=Ei(n.name);if(a){let l;e[2]!==a?(l=o.jsx(a,{size:16,className:"text-muted-foreground"}),e[2]=a,e[3]=l):l=e[3],i=l;break e}}}e[0]=s,e[1]=i}else i=e[1];if(i!==Symbol.for("react.early_return_sentinel"))return i;let r;return e[4]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx(Bc,{size:16,className:"text-muted-foreground"}),e[4]=r):r=e[4],r}function fd(t){const e=K.c(66),{value:s,onChange:i,className:r,disabled:n}=t,[a,l]=P.useState(!1),[h,c]=P.useState("");let u;e[0]!==s?(u=ji(s),e[0]=s,e[1]=u):u=e[1];const d=u,m=d.type==="icon"?d.name:null;let _,f,p,g,v,b,S,x,y,k,w,N,j,M,R;if(e[2]!==r||e[3]!==m||e[4]!==n||e[5]!==i||e[6]!==a||e[7]!==h||e[8]!==s){const L=en();g=h.trim()?L.filter(U=>{const q=h.toLowerCase();return hr(U).includes(q)||U.toLowerCase().includes(q)}):L,p=Ws,v=n?!1:a,b=l;const B=n?"cursor-default opacity-50":"cursor-pointer hover:bg-accent";let F;e[24]!==r||e[25]!==B?(F=ee("size-7 shrink-0 rounded-md transition-colors flex items-center justify-center",B,r),e[24]=r,e[25]=B,e[26]=F):F=e[26];let z;e[27]!==s?(z=o.jsx(ud,{value:s}),e[27]=s,e[28]=z):z=e[28],e[29]!==n||e[30]!==F||e[31]!==z?(S=o.jsx(Fs,{asChild:!0,children:o.jsx("button",{type:"button",disabled:n,className:F,children:z})}),e[29]=n,e[30]=F,e[31]=z,e[32]=S):S=e[32],f=Hs,j="start",M="w-64 p-0",R=md,w="flex flex-col";let $;e[33]===Symbol.for("react.memo_cache_sentinel")?($=o.jsx(ka,{size:14,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"}),e[33]=$):$=e[33];let V;e[34]===Symbol.for("react.memo_cache_sentinel")?(V=U=>c(U.target.value),e[34]=V):V=e[34],e[35]!==h?(N=o.jsx("div",{className:"px-2 py-2",children:o.jsxs("div",{className:"relative",children:[$,o.jsx(fs,{value:h,onChange:V,placeholder:"Filter...",className:"h-7 text-xs pl-7"})]})}),e[35]=h,e[36]=N):N=e[36],_=Ca,k="h-48",x="grid grid-cols-8 gap-0.5 px-2 pb-2";let W;e[37]!==m||e[38]!==i?(W=U=>{const q=Ei(U);return q?o.jsx("button",{type:"button",onClick:()=>{i(`icon://${U}`),l(!1)},className:ee("h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer",m===U?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),title:hr(U),children:o.jsx(q,{size:16})},U):null},e[37]=m,e[38]=i,e[39]=W):W=e[39],y=g.map(W),e[2]=r,e[3]=m,e[4]=n,e[5]=i,e[6]=a,e[7]=h,e[8]=s,e[9]=_,e[10]=f,e[11]=p,e[12]=g,e[13]=v,e[14]=b,e[15]=S,e[16]=x,e[17]=y,e[18]=k,e[19]=w,e[20]=N,e[21]=j,e[22]=M,e[23]=R}else _=e[9],f=e[10],p=e[11],g=e[12],v=e[13],b=e[14],S=e[15],x=e[16],y=e[17],k=e[18],w=e[19],N=e[20],j=e[21],M=e[22],R=e[23];let D;e[40]!==x||e[41]!==y?(D=o.jsx("div",{className:x,children:y}),e[40]=x,e[41]=y,e[42]=D):D=e[42];let C;e[43]!==g.length?(C=g.length===0&&o.jsx("div",{className:"flex items-center justify-center py-6 text-xs text-muted-foreground",children:"No icons found"}),e[43]=g.length,e[44]=C):C=e[44];let T;e[45]!==_||e[46]!==D||e[47]!==C||e[48]!==k?(T=o.jsxs(_,{className:k,children:[D,C]}),e[45]=_,e[46]=D,e[47]=C,e[48]=k,e[49]=T):T=e[49];let E;e[50]!==T||e[51]!==w||e[52]!==N?(E=o.jsxs("div",{className:w,children:[N,T]}),e[50]=T,e[51]=w,e[52]=N,e[53]=E):E=e[53];let A;e[54]!==f||e[55]!==E||e[56]!==j||e[57]!==M||e[58]!==R?(A=o.jsx(f,{align:j,className:M,onOpenAutoFocus:R,children:E}),e[54]=f,e[55]=E,e[56]=j,e[57]=M,e[58]=R,e[59]=A):A=e[59];let O;return e[60]!==p||e[61]!==v||e[62]!==b||e[63]!==S||e[64]!==A?(O=o.jsxs(p,{open:v,onOpenChange:b,children:[S,A]}),e[60]=p,e[61]=v,e[62]=b,e[63]=S,e[64]=A,e[65]=O):O=e[65],O}function md(t){return t.preventDefault()}function li(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx(Be,{className:"animate-spin text-muted-foreground",size:24})}),t[0]=e):e=t[0],e}function Ui(t){return({error:e})=>e?.message?.includes("Method not found")||e?.code===-32601?o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:t})}):o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center h-full p-6 text-center space-y-4",children:[o.jsx("div",{className:"bg-destructive/10 p-3 rounded-full",children:o.jsx(Dl,{className:"h-6 w-6 text-destructive"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h3",{className:"text-lg font-medium",children:"Something went wrong"}),o.jsx("p",{className:"text-sm text-muted-foreground max-w-xs mx-auto",children:e?.message?e.message.length>200?`${e.message.slice(0,200)}...`:e.message:"An unexpected error occurred"})]})]})}function _d(t){const e=K.c(23),{item:s,isSelected:i,onToggle:r,disabled:n}=t,a=n?"cursor-not-allowed opacity-50":"cursor-pointer",l=i?"bg-accent/25":"hover:bg-muted/50";let h;e[0]!==a||e[1]!==l?(h=ee("flex items-start gap-3 p-4 rounded-lg transition-colors",a,l),e[0]=a,e[1]=l,e[2]=h):h=e[2];let c;e[3]!==s.name?(c=o.jsx("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),e[3]=s.name,e[4]=c):c=e[4];let u;e[5]!==s.tags?(u=s.tags&&o.jsx("span",{className:"shrink-0",children:s.tags}),e[5]=s.tags,e[6]=u):u=e[6];let d;e[7]!==c||e[8]!==u?(d=o.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c,u]}),e[7]=c,e[8]=u,e[9]=d):d=e[9];let m;e[10]!==s.description?(m=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:s.description}),e[10]=s.description,e[11]=m):m=e[11];let _;e[12]!==d||e[13]!==m?(_=o.jsxs("div",{className:"flex-1 min-w-0 space-y-2",children:[d,m]}),e[12]=d,e[13]=m,e[14]=_):_=e[14];let f;e[15]!==n||e[16]!==i||e[17]!==r?(f=o.jsx(nh,{checked:i,onCheckedChange:r,disabled:n,className:"mt-0.5"}),e[15]=n,e[16]=i,e[17]=r,e[18]=f):f=e[18];let p;return e[19]!==h||e[20]!==_||e[21]!==f?(p=o.jsxs("label",{className:h,children:[_,f]}),e[19]=h,e[20]=_,e[21]=f,e[22]=p):p=e[22],p}function an(t){const e=K.c(13),{items:s,selections:i,onToggle:r,emptyMessage:n,disabled:a}=t;let l,h,c;if(e[0]!==a||e[1]!==n||e[2]!==s||e[3]!==r||e[4]!==i){c=Symbol.for("react.early_return_sentinel");e:{const d=s.map(pd);if(s.length===0){let m;e[8]!==n?(m=o.jsx("div",{className:"flex-1 overflow-auto px-4 py-3 space-y-1",children:o.jsx("div",{className:"flex items-center justify-center h-32 text-sm text-muted-foreground",children:n})}),e[8]=n,e[9]=m):m=e[9],c=m;break e}l="flex-1 overflow-auto px-4 py-3 space-y-1",h=s.map(m=>o.jsx(_d,{item:m,isSelected:i===null||i?.includes(m.id),onToggle:()=>r(m.id,d),disabled:a},m.id))}e[0]=a,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=l,e[6]=h,e[7]=c}else l=e[5],h=e[6],c=e[7];if(c!==Symbol.for("react.early_return_sentinel"))return c;let u;return e[10]!==l||e[11]!==h?(u=o.jsx("div",{className:l,children:h}),e[10]=l,e[11]=h,e[12]=u):u=e[12],u}function pd(t){return t.id}function gd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Nc(c);let d;e[6]!==u.tools?(d=u.tools.map(vd),e[6]=u.tools,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No tools available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function vd(t){return{id:t.name,name:t.name,description:t.description,tags:o.jsx(Zc,{annotations:t.annotations,_meta:t._meta})}}function xd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=Xc(c);let d;e[6]!==u.resources?(d=u.resources.map(bd),e[6]=u.resources,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No resources available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function bd(t){return{id:t.name||t.uri,name:t.name||t.uri,description:t.description}}function Sd(t){const e=K.c(13),{connectionId:s,selections:i,onToggle:r,disabled:n}=t,{org:a}=ve();let l;e[0]!==s||e[1]!==a.id||e[2]!==a.slug?(l={connectionId:s,orgId:a.id,orgSlug:a.slug},e[0]=s,e[1]=a.id,e[2]=a.slug,e[3]=l):l=e[3];const h=Ue(l);let c;e[4]!==h?(c={client:h},e[4]=h,e[5]=c):c=e[5];const{data:u}=oh(c);let d;e[6]!==u.prompts?(d=u.prompts.map(yd),e[6]=u.prompts,e[7]=d):d=e[7];const m=d;let _;return e[8]!==n||e[9]!==m||e[10]!==r||e[11]!==i?(_=o.jsx(an,{items:m,selections:i,onToggle:r,emptyMessage:"No prompts available",disabled:n}),e[8]=n,e[9]=m,e[10]=r,e[11]=i,e[12]=_):_=e[12],_}function yd(t){return{id:t.name,name:t.name,description:t.description}}function wd(t){const e=K.c(54),{currentConnection:s,activeTab:i,selectedId:r,formData:n,toggleTool:a,toggleResource:l,togglePrompt:h,toggleAllTools:c,toggleAllResources:u,toggleAllPrompts:d,onTabChange:m}=t,_=n[r],f=i==="tools"?_?.tools===null:i==="resources"?_?.resources===null:_?.prompts===null;let p;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==u||e[4]!==c?(p=()=>{i==="tools"?c(r):i==="resources"?u(r):d(r)},e[0]=i,e[1]=r,e[2]=d,e[3]=u,e[4]=c,e[5]=p):p=e[5];const g=p;let v;e[6]!==s.icon||e[7]!==s.title?(v=o.jsx(ds,{icon:s.icon,name:s.title,size:"sm",className:"shrink-0"}),e[6]=s.icon,e[7]=s.title,e[8]=v):v=e[8];let b;e[9]!==s.title?(b=o.jsx("h2",{className:"text-base font-semibold truncate",children:s.title}),e[9]=s.title,e[10]=b):b=e[10];let S;e[11]!==s.description?(S=s.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s.description}),e[11]=s.description,e[12]=S):S=e[12];let x;e[13]!==b||e[14]!==S?(x=o.jsxs("div",{className:"flex-1 min-w-0",children:[b,S]}),e[13]=b,e[14]=S,e[15]=x):x=e[15];let y;e[16]!==v||e[17]!==x?(y=o.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:o.jsxs("div",{className:"flex items-center gap-3",children:[v,x]})}),e[16]=v,e[17]=x,e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=[{id:"tools",label:"Tools"},{id:"resources",label:"Resources"},{id:"prompts",label:"Prompts"}],e[19]=k):k=e[19];let w;e[20]!==m?(w=O=>m(O),e[20]=m,e[21]=w):w=e[21];let N;e[22]!==i||e[23]!==w?(N=o.jsx(rh,{tabs:k,activeTab:i,onTabChange:w}),e[22]=i,e[23]=w,e[24]=N):N=e[24];const j=f?"Deselect all":"Select all";let M;e[25]!==g||e[26]!==j?(M=o.jsx("button",{type:"button",onClick:g,className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:j}),e[25]=g,e[26]=j,e[27]=M):M=e[27];let R;e[28]!==M||e[29]!==N?(R=o.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border shrink-0",children:[N,M]}),e[28]=M,e[29]=N,e[30]=R):R=e[30];let D;e[31]!==i||e[32]!==n||e[33]!==r||e[34]!==a?(D=i==="tools"&&o.jsx($t,{fallback:Ui("Tools not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(gd,{connectionId:r,selections:n[r]?n[r].tools:[],onToggle:(O,L)=>a(r,O,L)})})}),e[31]=i,e[32]=n,e[33]=r,e[34]=a,e[35]=D):D=e[35];let C;e[36]!==i||e[37]!==n||e[38]!==r||e[39]!==l?(C=i==="resources"&&o.jsx($t,{fallback:Ui("Resources not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(xd,{connectionId:r,selections:n[r]?n[r].resources:[],onToggle:(O,L)=>l(r,O,L)})})}),e[36]=i,e[37]=n,e[38]=r,e[39]=l,e[40]=C):C=e[40];let T;e[41]!==i||e[42]!==n||e[43]!==r||e[44]!==h?(T=i==="prompts"&&o.jsx($t,{fallback:Ui("Prompts not supported by this server"),children:o.jsx(P.Suspense,{fallback:o.jsx(li,{}),children:o.jsx(Sd,{connectionId:r,selections:n[r]?n[r].prompts:[],onToggle:(O,L)=>h(r,O,L)})})}),e[41]=i,e[42]=n,e[43]=r,e[44]=h,e[45]=T):T=e[45];let E;e[46]!==D||e[47]!==C||e[48]!==T?(E=o.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col",children:[D,C,T]}),e[46]=D,e[47]=C,e[48]=T,e[49]=E):E=e[49];let A;return e[50]!==R||e[51]!==E||e[52]!==y?(A=o.jsxs(o.Fragment,{children:[y,R,E]}),e[50]=R,e[51]=E,e[52]=y,e[53]=A):A=e[53],A}function Cd(t){const e=K.c(11),{connectionId:s,onAuthenticate:i,children:r}=t;let n;e[0]!==s?(n={connectionId:s},e[0]=s,e[1]=n):n=e[1];const a=da(n);if(a.supportsOAuth&&!a.isAuthenticated){let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted",children:o.jsx(xc,{size:22,className:"text-muted-foreground"})}),e[2]=c):c=e[2];let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"Authorization required"}),o.jsx("p",{className:"text-xs text-muted-foreground max-w-xs",children:"This connection needs to be authorized before you can configure its tools and resources."})]}),e[3]=u):u=e[3];let d;e[4]!==s||e[5]!==i?(d=i&&o.jsx(se,{variant:"outline",size:"sm",onClick:()=>i(s),children:"Authorize"}),e[4]=s,e[5]=i,e[6]=d):d=e[6];let m;return e[7]!==d?(m=o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 p-8 text-center",children:[c,u,d]}),e[7]=d,e[8]=m):m=e[8],m}let h;return e[9]!==r?(h=o.jsx(o.Fragment,{children:r}),e[9]=r,e[10]=h):h=e[10],h}function kd(t){const e={};for(const s of t)e[s.connection_id]={tools:s.selected_tools,resources:s.selected_resources??null,prompts:s.selected_prompts??null};return e}function On(t){return Object.entries(t).map(([e,s])=>({connection_id:e,selected_tools:s.tools,selected_resources:s.resources,selected_prompts:s.prompts}))}function Nd(t,e){return e.type==="SET_ACTIVE_TAB"?{...t,activeTab:e.payload}:t}function jd(t){const e=K.c(49),{open:s,onOpenChange:i,selectedId:r,form:n,connections:a,onAuthenticate:l}=t;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h={activeTab:"tools"},e[0]=h):h=e[0];const[c,u]=P.useReducer(Nd,h),d=sn(r??"");let m;e[1]!==a?(m=a??[],e[1]=a,e[2]=m):m=e[2];let _;e[3]!==m?(_=kd(m),e[3]=m,e[4]=_):_=e[4];const f=_;let p;e[5]!==n||e[6]!==f?(p=($,V,W,U)=>{const q=f[$]?.[V];let I;q===null?I=U.filter(Y=>Y!==W):q?.includes(W)?I=q.filter(Y=>Y!==W):(I=[...q??[],W],I.length===U.length&&(I=null));const X={...f};X[$]?X[$]={...X[$]}:X[$]={tools:null,resources:null,prompts:null},X[$][V]=I,n.setValue("connections",On(X),{shouldDirty:!0,shouldTouch:!0})},e[5]=n,e[6]=f,e[7]=p):p=e[7];const g=p;let v;e[8]!==n||e[9]!==f?(v=($,V)=>{const U=f[$]?.[V]===null?[]:null,q={...f};q[$]?q[$]={...q[$]}:q[$]={tools:null,resources:null,prompts:null},q[$][V]=U,n.setValue("connections",On(q),{shouldDirty:!0,shouldTouch:!0})},e[8]=n,e[9]=f,e[10]=v):v=e[10];const b=v;let S;e[11]!==g?(S=($,V,W)=>g($,"tools",V,W),e[11]=g,e[12]=S):S=e[12];const x=S;let y;e[13]!==g?(y=($,V,W)=>g($,"resources",V,W),e[13]=g,e[14]=y):y=e[14];const k=y;let w;e[15]!==g?(w=($,V,W)=>g($,"prompts",V,W),e[15]=g,e[16]=w):w=e[16];const N=w;let j;e[17]!==b?(j=$=>b($,"tools"),e[17]=b,e[18]=j):j=e[18];const M=j;let R;e[19]!==b?(R=$=>b($,"resources"),e[19]=b,e[20]=R):R=e[20];const D=R;let C;e[21]!==b?(C=$=>b($,"prompts"),e[21]=b,e[22]=C):C=e[22];const T=C;if(!r||!d)return null;let E;e[23]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(li,{}),e[23]=E):E=e[23];let A;e[24]===Symbol.for("react.memo_cache_sentinel")?(A=$=>u({type:"SET_ACTIVE_TAB",payload:$}),e[24]=A):A=e[24];let O;e[25]!==d||e[26]!==c.activeTab||e[27]!==f||e[28]!==r||e[29]!==T||e[30]!==D||e[31]!==M||e[32]!==N||e[33]!==k||e[34]!==x?(O=o.jsx(wd,{currentConnection:d,activeTab:c.activeTab,selectedId:r,formData:f,toggleTool:x,toggleResource:k,togglePrompt:N,toggleAllTools:M,toggleAllResources:D,toggleAllPrompts:T,onTabChange:A},r),e[25]=d,e[26]=c.activeTab,e[27]=f,e[28]=r,e[29]=T,e[30]=D,e[31]=M,e[32]=N,e[33]=k,e[34]=x,e[35]=O):O=e[35];let L;e[36]!==l||e[37]!==r||e[38]!==O?(L=o.jsx(P.Suspense,{fallback:E,children:o.jsx(Cd,{connectionId:r,onAuthenticate:l,children:O})}),e[36]=l,e[37]=r,e[38]=O,e[39]=L):L=e[39];let B;e[40]!==i?(B=o.jsx(eh,{className:"px-6 py-4 border-t border-border shrink-0",children:o.jsx(se,{variant:"outline",onClick:()=>i(!1),children:"Done"})}),e[40]=i,e[41]=B):B=e[41];let F;e[42]!==L||e[43]!==B?(F=o.jsxs(rn,{className:"sm:max-w-2xl h-[75vh] max-h-[75vh] flex flex-col p-0 gap-0 overflow-hidden w-[95vw]",children:[L,B]}),e[42]=L,e[43]=B,e[44]=F):F=e[44];let z;return e[45]!==i||e[46]!==s||e[47]!==F?(z=o.jsx(nn,{open:s,onOpenChange:i,children:F}),e[45]=i,e[46]=s,e[47]=F,e[48]=z):z=e[48],z}const Vi={tools:null,resources:null,prompts:null},Ed=Ml.pick({status:!0,title:!0,description:!0,icon:!0,metadata:!0,connections:!0});function Td(t){const s=new TextEncoder().encode(t),i=Array.from(s,r=>String.fromCharCode(r)).join("");return btoa(i)}function Rd(t){const e=K.c(11),{url:s,agentId:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i||e[1]!==s?(a=async()=>{ye("agent_connect_action",{agent_id:i,action:"copy_url"}),await navigator.clipboard.writeText(s),n(!0),me.success("Agent URL copied to clipboard"),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=a):a=e[2];const l=a;let h;e[3]!==r?(h=r?o.jsx(Ri,{size:20,className:"text-green-600"}):o.jsx(Ni,{size:20}),e[3]=r,e[4]=h):h=e[4];const c=r?"Copied!":"Copy URL";let u;e[5]!==c?(u=o.jsx("span",{className:"text-xs font-medium",children:c}),e[5]=c,e[6]=u):u=e[6];let d;return e[7]!==l||e[8]!==h||e[9]!==u?(d=o.jsxs(se,{type:"button",variant:"outline",onClick:l,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[h,u]}),e[7]=l,e[8]=h,e[9]=u,e[10]=d):d=e[10],d}function Dd(t){const e=K.c(8),{url:s,serverName:i,agentId:r}=t;let n;e[0]!==r||e[1]!==i||e[2]!==s?(n=()=>{ye("agent_connect_action",{agent_id:r,action:"install_cursor"});const u=ua(i),m=Td(JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Cursor"}},null,2)),_=`cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(u)}&config=${encodeURIComponent(m)}`;window.open(_,"_blank"),me.success("Opening Cursor...")},e[0]=r,e[1]=i,e[2]=s,e[3]=n):n=e[3];const a=n;let l,h;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=o.jsx("img",{src:"/logos/cursor.svg",alt:"Cursor",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(11%) sepia(8%) saturate(785%) hue-rotate(1deg) brightness(95%) contrast(89%)"}}),h=o.jsx("span",{className:"text-xs font-medium",children:"Install on Cursor"}),e[4]=l,e[5]=h):(l=e[4],h=e[5]);let c;return e[6]!==a?(c=o.jsxs(se,{type:"button",variant:"outline",onClick:a,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[l,h]}),e[6]=a,e[7]=c):c=e[7],c}function Md(t){const e=K.c(12),{url:s,serverName:i,agentId:r}=t,[n,a]=P.useState(!1);let l;e[0]!==r||e[1]!==i||e[2]!==s?(l=async()=>{ye("agent_connect_action",{agent_id:r,action:"install_claude_code"});const _=ua(i),p=JSON.stringify({type:"http",url:s,headers:{"x-mesh-client":"Claude Code"}},null,2),g=`claude mcp add-json "${_}" '${p.replace(/'/g,"'\\''")}' --scope user`;await navigator.clipboard.writeText(g),a(!0),me.success("Claude Code command copied to clipboard"),setTimeout(()=>a(!1),2e3)},e[0]=r,e[1]=i,e[2]=s,e[3]=l):l=e[3];const h=l;let c;e[4]!==n?(c=n?o.jsx(Ri,{size:20,className:"text-green-600"}):o.jsx("img",{src:"/logos/Claude Code.svg",alt:"Claude Code",className:"h-5 w-5",style:{filter:"brightness(0) saturate(100%) invert(55%) sepia(31%) saturate(1264%) hue-rotate(331deg) brightness(92%) contrast(86%)"}}),e[4]=n,e[5]=c):c=e[5];const u=n?"Copied!":"Install on Claude Code";let d;e[6]!==u?(d=o.jsx("span",{className:"text-xs font-medium",children:u}),e[6]=u,e[7]=d):d=e[7];let m;return e[8]!==h||e[9]!==c||e[10]!==d?(m=o.jsxs(se,{type:"button",variant:"outline",onClick:h,className:"h-auto py-3 px-4 flex flex-col items-center gap-2",children:[c,d]}),e[8]=h,e[9]=c,e[10]=d,e[11]=m):m=e[11],m}function Ad({virtualMcp:t}){const{org:e}=ve(),s=Ue({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),[i,r]=P.useState(null),[n,a]=P.useState(!1),[l,h]=P.useState(!1),c=t.id,u=t.title||`agent-${c.slice(0,8)}`,d=i?`bunx @decocms/typegen@latest --mcp ${c} --key ${i} --output client.ts`:`bunx @decocms/typegen@latest --mcp ${c} --key <api-key> --output client.ts`,m=async()=>{a(!0);try{const p=(await s.callTool({name:"API_KEY_CREATE",arguments:{name:`typegen-${u}`,permissions:{[c]:["*"]}}})).structuredContent?.key;if(!p)throw new Error("No key in response");r(p),ye("agent_typegen_key_generated",{agent_id:c})}catch{ye("agent_typegen_key_failed",{agent_id:c}),me.error("Failed to generate API key")}finally{a(!1)}},_=async()=>{ye("agent_connect_action",{agent_id:c,action:"typegen_copy_command",has_api_key:!!i}),await navigator.clipboard.writeText(d),h(!0),me.success("Command copied to clipboard"),setTimeout(()=>h(!1),2e3)};return o.jsxs("div",{className:"flex min-w-0 flex-col gap-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex flex-col gap-0.5",children:[o.jsx("h4",{className:"text-sm font-medium text-foreground",children:"Generate typed client"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Introspects this agent and writes a typed"," ",o.jsx("code",{className:"font-mono",children:"client.ts"})," you can import directly."]})]}),!i&&o.jsxs(se,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:m,disabled:n,children:[n?o.jsx(Be,{size:14,className:"animate-spin"}):o.jsx(ih,{size:14}),o.jsx("span",{children:n?"Generating…":"Generate API key"})]})]}),i&&o.jsx("p",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",children:"Store this key securely — it won't be shown again."}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Generate client"}),o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all font-mono text-xs text-muted-foreground",children:d}),o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:_,children:l?o.jsx(Ri,{size:12,className:"text-green-600"}):o.jsx(Ni,{size:12})})]})}),o.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Runtime variables"}),o.jsx(Id,{apiKey:i,agentId:c})]})}function Id(t){const e=K.c(21),{apiKey:s,agentId:i}=t,[r,n]=P.useState(!1),a=window.location.origin,l=s?`MESH_API_KEY=${s}`:"MESH_API_KEY=<api-key>",h=`MESH_BASE_URL=${a}`,c=`${l}
|
|
3
3
|
${h}`;let u;e[0]!==i||e[1]!==s||e[2]!==c?(u=async()=>{ye("agent_connect_action",{agent_id:i,action:"typegen_copy_env",has_api_key:!!s}),await navigator.clipboard.writeText(c),n(!0),setTimeout(()=>n(!1),2e3)},e[0]=i,e[1]=s,e[2]=c,e[3]=u):u=e[3];const d=u,m=!s;let _;e[4]!==m?(_=ee({"opacity-50":m}),e[4]=m,e[5]=_):_=e[5];let f;e[6]!==l||e[7]!==_?(f=o.jsx("span",{className:_,children:l}),e[6]=l,e[7]=_,e[8]=f):f=e[8];let p,g;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=o.jsx("br",{}),g=o.jsx("span",{children:h}),e[9]=p,e[10]=g):(p=e[9],g=e[10]);let v;e[11]!==f?(v=o.jsxs("code",{className:"min-w-0 flex-1 font-mono text-xs text-muted-foreground",children:[f,p,g]}),e[11]=f,e[12]=v):v=e[12];let b;e[13]!==r?(b=r?o.jsx(Ri,{size:12,className:"text-green-600"}):o.jsx(Ni,{size:12}),e[13]=r,e[14]=b):b=e[14];let S;e[15]!==d||e[16]!==b?(S=o.jsx(se,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0",onClick:d,children:b}),e[15]=d,e[16]=b,e[17]=S):S=e[17];let x;return e[18]!==v||e[19]!==S?(x=o.jsx("div",{className:"rounded-md border border-input bg-muted/50 px-3 py-2.5",children:o.jsxs("div",{className:"flex items-start gap-2",children:[v,S]})}),e[18]=v,e[19]=S,e[20]=x):x=e[20],x}function Bd(t){const e=K.c(3),{virtualMcp:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"h-20 animate-pulse rounded-md bg-muted"}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:i,children:o.jsx(Ad,{virtualMcp:s})}),e[1]=s,e[2]=r):r=e[2],r}function Pd(t){const e=K.c(37),{open:s,onOpenChange:i,virtualMcp:r}=t,{org:n}=ve(),a=`/api/${n.slug}/mcp/virtual-mcp/${r.id}`;let l;e[0]!==a?(l=new URL(a,window.location.origin),e[0]=a,e[1]=l):l=e[1];const h=l;let c;e[2]!==r.id||e[3]!==r.title?(c=r.title||`agent-${r.id?.slice(0,8)??"default"}`,e[2]=r.id,e[3]=r.title,e[4]=c):c=e[4];const u=c,d=la();let m;e[5]!==r.id||e[6]!==h.href?(m=o.jsx(Rd,{url:h.href,agentId:r.id}),e[5]=r.id,e[6]=h.href,e[7]=m):m=e[7];let _,f;e[8]!==u||e[9]!==r.id||e[10]!==h.href?(_=o.jsx(Dd,{url:h.href,serverName:u,agentId:r.id}),f=o.jsx(Md,{url:h.href,serverName:u,agentId:r.id}),e[8]=u,e[9]=r.id,e[10]=h.href,e[11]=_,e[12]=f):(_=e[11],f=e[12]);let p;e[13]!==m||e[14]!==_||e[15]!==f?(p=o.jsx("div",{className:"flex flex-col gap-3 pt-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[m,_,f]})}),e[13]=m,e[14]=_,e[15]=f,e[16]=p):p=e[16];let g;e[17]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"border-t border-border"}),e[17]=g):g=e[17];let v;e[18]!==r?(v=o.jsx(Bd,{virtualMcp:r}),e[18]=r,e[19]=v):v=e[19];let b;e[20]!==p||e[21]!==v?(b=o.jsxs("div",{className:"flex flex-col gap-6",children:[p,g,v]}),e[20]=p,e[21]=v,e[22]=b):b=e[22];const S=b;if(d){let w;e[23]===Symbol.for("react.memo_cache_sentinel")?(w=o.jsx(ch,{className:"mt-4 mb-4 text-base font-semibold",children:"Connect"}),e[23]=w):w=e[23];let N;e[24]!==S?(N=o.jsx(hh,{children:o.jsxs("div",{className:"flex-1 overflow-y-auto px-4 pb-6 [touch-action:pan-y]",children:[w,S]})}),e[24]=S,e[25]=N):N=e[25];let j;return e[26]!==i||e[27]!==s||e[28]!==N?(j=o.jsx(dh,{open:s,onOpenChange:i,children:N}),e[26]=i,e[27]=s,e[28]=N,e[29]=j):j=e[29],j}let x;e[30]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Sa,{children:o.jsx(ya,{children:"Connect"})}),e[30]=x):x=e[30];let y;e[31]!==S?(y=o.jsxs(rn,{className:"max-h-[80vh] overflow-y-auto sm:max-w-2xl",children:[x,S]}),e[31]=S,e[32]=y):y=e[32];let k;return e[33]!==i||e[34]!==s||e[35]!==y?(k=o.jsx(nn,{open:s,onOpenChange:i,children:y}),e[33]=i,e[34]=s,e[35]=y,e[36]=k):k=e[36],k}function Ld(t,e){switch(e.type){case"SET_SHARE_DIALOG_OPEN":return{...t,shareDialogOpen:e.payload};case"SET_ADD_DIALOG_OPEN":return{...t,addDialogOpen:e.payload};case"OPEN_SETTINGS":return{...t,settingsDialogOpen:!0,settingsConnectionId:e.payload};case"CLOSE_SETTINGS":return{...t,settingsDialogOpen:!1,settingsConnectionId:null};default:return t}}function Od(t){const e=K.c(22),{connection_id:s,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}=t,c=sn(s),{org:u}=ve();if(!c)return null;let d;e[0]!==c?(d=Qc(c),e[0]=c,e[1]=d):d=e[1];const m=d;let _;e[2]!==s?(_=o.jsx(Hd,{connection_id:s}),e[2]=s,e[3]=_):_=e[3];let f;e[4]!==c.app_name||e[5]!==c.connection_type||e[6]!==c.description||e[7]!==c.icon||e[8]!==c.title||e[9]!==s||e[10]!==a||e[11]!==h||e[12]!==r||e[13]!==n||e[14]!==l||e[15]!==u.slug||e[16]!==m||e[17]!==i?(f=o.jsx(Fd,{connection_id:s,connectionTitle:c.title,connectionDescription:c.description,connectionIcon:c.icon,connectionType:c.connection_type,slug:m,orgSlug:u.slug,appName:c.app_name,usedConnectionIds:i,onOpenSettings:r,onRemove:n,onAuthenticate:a,onSwitchInstance:l,onNewInstance:h}),e[4]=c.app_name,e[5]=c.connection_type,e[6]=c.description,e[7]=c.icon,e[8]=c.title,e[9]=s,e[10]=a,e[11]=h,e[12]=r,e[13]=n,e[14]=l,e[15]=u.slug,e[16]=m,e[17]=i,e[18]=f):f=e[18];let p;return e[19]!==_||e[20]!==f?(p=o.jsx(P.Suspense,{fallback:_,children:f}),e[19]=_,e[20]=f,e[21]=p):p=e[21],p}const zn="__new_instance__";async function zd(t,e){const s=t?.idToken??null;if(s){const r=$n(s);if(r)return r}const i=t?.userinfoEndpoint??null;if(i)try{const r=await fetch(i,{headers:{Authorization:`Bearer ${e}`}});if(r.ok){const n=await r.json(),a=typeof n.email=="string"?n.email:typeof n.upn=="string"?n.upn:typeof n.preferred_username=="string"?n.preferred_username:null;if(a)return a}}catch{}return $n(e)}function $n(t){try{const e=t.split(".");if(e.length===3&&e[1]){const s=JSON.parse(atob(e[1].replace(/-/g,"+").replace(/_/g,"/")));if(typeof s.email=="string")return s.email;if(typeof s.upn=="string")return s.upn;if(typeof s.preferred_username=="string")return s.preferred_username}}catch{}return null}function $d(t){const e=K.c(23),{appName:s,connectionId:i,usedConnectionIds:r,onSwitchInstance:n,onNewInstance:a}=t;let l;e[0]!==s?(l={filters:[{column:"app_name",value:s}]},e[0]=s,e[1]=l):l=e[1];const h=Ti(l);if(h.length<=1)return null;let c;e[2]!==i||e[3]!==a||e[4]!==n?(c=p=>{p===zn?a?.():n(i,p)},e[2]=i,e[3]=a,e[4]=n,e[5]=c):c=e[5];let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(ss,{size:"sm",className:"w-auto text-xs gap-1 px-2 shadow-none",children:o.jsx(is,{})}),e[6]=u):u=e[6];let d;if(e[7]!==i||e[8]!==h||e[9]!==r){let p;e[11]!==i||e[12]!==r?(p=g=>o.jsx(At,{value:g.id,className:"text-xs",disabled:g.id!==i&&r.has(g.id),children:g.title},g.id),e[11]=i,e[12]=r,e[13]=p):p=e[13],d=h.map(p),e[7]=i,e[8]=h,e[9]=r,e[10]=d}else d=e[10];let m;e[14]!==a?(m=a&&o.jsx(At,{value:zn,className:"text-xs text-muted-foreground",children:"+ New instance"}),e[14]=a,e[15]=m):m=e[15];let _;e[16]!==d||e[17]!==m?(_=o.jsxs(rs,{children:[d,m]}),e[16]=d,e[17]=m,e[18]=_):_=e[18];let f;return e[19]!==i||e[20]!==c||e[21]!==_?(f=o.jsxs(ts,{value:i,onValueChange:c,children:[u,_]}),e[19]=i,e[20]=c,e[21]=_,e[22]=f):f=e[22],f}function Fd(t){const e=K.c(55),{connection_id:s,connectionTitle:i,connectionDescription:r,connectionIcon:n,connectionType:a,slug:l,orgSlug:h,appName:c,usedConnectionIds:u,onOpenSettings:d,onRemove:m,onAuthenticate:_,onSwitchInstance:f,onNewInstance:p}=t;let g;e[0]!==s?(g={connectionId:s},e[0]=s,e[1]=g):g=e[1];const v=da(g),S=!(a==="VIRTUAL")&&v.supportsOAuth&&!v.isAuthenticated,x=S?"border-destructive/50 bg-destructive/5":"border-border";let y;e[2]!==x?(y=ee("rounded-xl border overflow-hidden transition-colors",x),e[2]=x,e[3]=y):y=e[3];let k;e[4]!==h||e[5]!==l?(k={org:h,appSlug:l},e[4]=h,e[5]=l,e[6]=k):k=e[6];let w;e[7]!==n||e[8]!==i?(w=o.jsx(ds,{icon:n,name:i,size:"sm",className:"shrink-0"}),e[7]=n,e[8]=i,e[9]=w):w=e[9];let N;e[10]!==i?(N=o.jsx("p",{className:"text-sm font-medium truncate",children:i}),e[10]=i,e[11]=N):N=e[11];let j;e[12]!==r||e[13]!==S?(j=S?o.jsx("span",{className:"text-xs text-destructive font-medium",children:"Needs authorization"}):r&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r}),e[12]=r,e[13]=S,e[14]=j):j=e[14];let M;e[15]!==N||e[16]!==j?(M=o.jsxs("div",{className:"flex-1 min-w-0",children:[N,j]}),e[15]=N,e[16]=j,e[17]=M):M=e[17];let R;e[18]!==s||e[19]!==S||e[20]!==_?(R=S?o.jsx(se,{variant:"outline",size:"sm",className:"h-7 text-xs shrink-0",onClick:U=>{U.preventDefault(),U.stopPropagation(),_(s)},children:"Authorize"}):o.jsxs(qe,{delayDuration:0,children:[o.jsx(Ge,{asChild:!0,children:o.jsx("span",{className:"inline-flex items-center justify-center rounded-md h-7 w-7 hover:bg-accent text-muted-foreground shrink-0 transition-colors",children:o.jsx(sh,{size:16})})}),o.jsx(Ye,{side:"bottom",children:"Connection settings"})]}),e[18]=s,e[19]=S,e[20]=_,e[21]=R):R=e[21];let D;e[22]!==k||e[23]!==w||e[24]!==M||e[25]!==R?(D=o.jsxs(Bl,{to:"/$org/settings/connections/$appSlug",params:k,className:"flex items-center gap-3 px-4 py-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[w,M,R]}),e[22]=k,e[23]=w,e[24]=M,e[25]=R,e[26]=D):D=e[26];let C;e[27]!==c||e[28]!==s||e[29]!==p||e[30]!==f||e[31]!==u?(C=c&&o.jsx($d,{appName:c,connectionId:s,usedConnectionIds:u,onSwitchInstance:f,onNewInstance:p}),e[27]=c,e[28]=s,e[29]=p,e[30]=f,e[31]=u,e[32]=C):C=e[32];let T;e[33]===Symbol.for("react.memo_cache_sentinel")?(T=o.jsx(Sc,{size:13}),e[33]=T):T=e[33];let E;e[34]!==d?(E=o.jsx(Ge,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:d,"aria-label":"Configure resources",children:T})}),e[34]=d,e[35]=E):E=e[35];let A;e[36]===Symbol.for("react.memo_cache_sentinel")?(A=o.jsx(Ye,{side:"bottom",children:"Configure resources"}),e[36]=A):A=e[36];let O;e[37]!==E?(O=o.jsxs(qe,{delayDuration:0,children:[E,A]}),e[37]=E,e[38]=O):O=e[38];let L;e[39]===Symbol.for("react.memo_cache_sentinel")?(L=o.jsx(ls,{size:13}),e[39]=L):L=e[39];let B;e[40]!==m?(B=o.jsx(Ge,{asChild:!0,children:o.jsx(se,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:m,"aria-label":"Remove connection",children:L})}),e[40]=m,e[41]=B):B=e[41];let F;e[42]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Ye,{side:"bottom",children:"Remove"}),e[42]=F):F=e[42];let z;e[43]!==B?(z=o.jsxs(qe,{delayDuration:0,children:[B,F]}),e[43]=B,e[44]=z):z=e[44];let $;e[45]!==O||e[46]!==z?($=o.jsxs("div",{className:"flex items-center gap-0.5 ml-auto",children:[O,z]}),e[45]=O,e[46]=z,e[47]=$):$=e[47];let V;e[48]!==C||e[49]!==$?(V=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-2 border-t border-border bg-muted/25",children:[C,$]}),e[48]=C,e[49]=$,e[50]=V):V=e[50];let W;return e[51]!==D||e[52]!==V||e[53]!==y?(W=o.jsxs("div",{className:y,children:[D,V]}),e[51]=D,e[52]=V,e[53]=y,e[54]=W):W=e[54],W}function Hd(t){const e=K.c(17),{connection_id:s}=t,i=sn(s);if(!i){let d;return e[0]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Da,{}),e[0]=d):d=e[0],d}let r;e[1]!==i.icon||e[2]!==i.title?(r=o.jsx(ds,{icon:i.icon,name:i.title,size:"sm",className:"shrink-0"}),e[1]=i.icon,e[2]=i.title,e[3]=r):r=e[3];let n;e[4]!==i.title?(n=o.jsx("p",{className:"text-sm font-medium truncate",children:i.title}),e[4]=i.title,e[5]=n):n=e[5];let a;e[6]!==i.description?(a=i.description&&o.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.description}),e[6]=i.description,e[7]=a):a=e[7];let l;e[8]!==n||e[9]!==a?(l=o.jsxs("div",{className:"flex-1 min-w-0",children:[n,a]}),e[8]=n,e[9]=a,e[10]=l):l=e[10];let h;e[11]!==r||e[12]!==l?(h=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[r,l]}),e[11]=r,e[12]=l,e[13]=h):h=e[13];let c;e[14]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})}),e[14]=c):c=e[14];let u;return e[15]!==h?(u=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[h,c]}),e[15]=h,e[16]=u):u=e[16],u}function Da(){const t=K.c(3);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx("div",{className:"size-8 rounded-md bg-muted animate-pulse shrink-0"}),t[0]=e):e=t[0];let s;t[1]===Symbol.for("react.memo_cache_sentinel")?(s=o.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[e,o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-4 w-32 rounded bg-muted animate-pulse"}),o.jsx("div",{className:"h-3 w-48 rounded bg-muted animate-pulse"})]})]}),t[1]=s):s=t[1];let i;return t[2]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsxs("div",{className:"rounded-xl border border-border overflow-hidden",children:[s,o.jsx("div",{className:"flex items-center px-4 py-2 border-t border-border bg-muted/25",children:o.jsx("div",{className:"h-5 w-20 rounded bg-muted animate-pulse"})})]}),t[2]=i):i=t[2],i}function Wd({virtualMcpId:t}){const{org:e}=ve(),s=Ue({connectionId:Bt,orgId:e.id,orgSlug:e.slug}),i=Ut(),r=wt(t),n=(r?.connections??[]).map(B=>B.connection_id).sort(),{data:a}=Vo({queryKey:As.projectConnectionDetails(t,n),enabled:n.length>0,queryFn:async()=>await Promise.all(n.map(async F=>{try{const z=await s.callTool({name:"COLLECTION_CONNECTIONS_GET",arguments:{id:F}}),{item:$}=zi(z),V=($?.tools??[]).filter(W=>!!Jc(W._meta)).map(W=>({name:W.name,description:W.description}));return{fetchOk:!0,id:F,title:$?.title??F,icon:$?.icon??null,uiTools:V}}catch{return{fetchOk:!1,id:F,title:F,icon:null,uiTools:[]}}}))}),l=(a??[]).filter(B=>B.uiTools.length>0),h=new Set(rc),c=r?.metadata?.ui,u=c?.pinnedViews??[],d=c?.layout?.defaultMainView??null,m=c?.layout?.chatDefaultOpen??!1,_=!d||d.type==="chat"?"chat":d.type==="instructions"||d.type==="connections"||d.type==="layout"?"settings":h.has(d.type)?d.type:`${d.type}:${d.id??""}:${d.toolName??""}`,[f,p]=P.useState(u),[g,v]=P.useState(_),[b,S]=P.useState(m),[x,y]=P.useState(!1),k=B=>{const[F,z,$]=B.split(":");return F?F==="chat"?{type:F}:h.has(F)?{type:F}:F==="ext-apps"&&z?{type:"ext-apps",id:z,toolName:$||void 0}:null:null},w=P.useRef(!1);if(a&&a.length>0&&!w.current){w.current=!0;const B=new Set((a??[]).filter($=>$.fetchOk).map($=>$.id)),F=new Set(l.flatMap($=>$.uiTools.map(V=>`${$.id}:${V.name}`))),z=u.filter($=>!B.has($.connectionId)||F.has(`${$.connectionId}:${$.toolName}`));if(z.length!==u.length){p(z);let $=g;d?.type==="ext-apps"&&!z.some(V=>V.connectionId===d.id&&V.toolName===d.toolName)&&($="chat",v($)),s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:z,layout:{defaultMainView:k($),chatDefaultOpen:b}}}).then(V=>{zi(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")})}).catch(()=>{p(u),v(_)})}}const N=(B,F,z)=>{y(!0),(async()=>{try{const V=await s.callTool({name:"VIRTUAL_MCP_PINNED_VIEWS_UPDATE",arguments:{virtualMcpId:t,pinnedViews:B,layout:{defaultMainView:k(F),chatDefaultOpen:z??b}}});zi(V),i.invalidateQueries({predicate:W=>Array.isArray(W.queryKey)&&W.queryKey.includes("collection")&&W.queryKey.includes("VIRTUAL_MCP")}),me.success("Layout updated")}catch(V){me.error("Failed to update layout: "+(V instanceof Error?V.message:"Unknown error"))}finally{y(!1)}})()},j=(B,F)=>{const z=f.some(W=>W.connectionId===B&&W.toolName===F);let $,V=g;if(z){$=f.filter(U=>!(U.connectionId===B&&U.toolName===F));const W=`ext-apps:${B}:${F}`;g===W&&(V="chat",v(V))}else $=[...f,{connectionId:B,toolName:F,label:Cn(F),icon:null}];p($),N($,V)},M=(B,F,z)=>{p($=>$.map(V=>V.connectionId===B&&V.toolName===F?{...V,label:z}:V))},R=()=>{N(f,g)},D=(B,F,z)=>{p(V=>V.map(W=>W.connectionId===B&&W.toolName===F?{...W,icon:z}:W));const $=f.map(V=>V.connectionId===B&&V.toolName===F?{...V,icon:z}:V);N($,g)},C=B=>{v(B),N(f,B)},T=n.length===0,E=a&&l.length===0,A=!!Vt(r),O=[{value:"chat",label:"Chat"},{value:"settings",label:"Settings"},{value:"automations",label:"Automations"}];A&&(O.push({value:"env",label:"Terminal"}),O.push({value:"preview",label:"Preview"}));for(const B of f)O.push({value:`ext-apps:${B.connectionId}:${B.toolName}`,label:B.label||B.toolName});const L=l.length>0||T||E;return o.jsxs("div",{className:"flex flex-col gap-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-3",children:o.jsx("h2",{className:"text-sm font-medium text-foreground",children:"Layout"})}),o.jsxs(th,{className:"p-6 gap-5",children:[o.jsxs(Dn,{className:"p-0 space-y-5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Rs,{className:"font-normal text-foreground",children:"Main view"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"What users see when they first open this agent."})]}),o.jsxs(ts,{value:g,onValueChange:C,children:[o.jsx(ss,{className:"w-44 h-8 text-sm capitalize shrink-0",children:o.jsx(is,{})}),o.jsx(rs,{children:O.map(B=>o.jsx(At,{value:B.value,className:"capitalize",children:B.label},B.value))})]})]}),o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Rs,{className:"font-normal text-foreground",children:"Show chat"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Display the chat panel alongside the main view."})]}),o.jsxs(qe,{delayDuration:0,children:[o.jsx(Ge,{asChild:!0,children:o.jsx("span",{className:"shrink-0",children:o.jsx(ur,{checked:g==="chat"?!0:b,disabled:g==="chat"||x,onCheckedChange:B=>{S(B),N(f,g,B)}})})}),g==="chat"&&o.jsx(Ye,{side:"top",children:"Chat is always shown when it is the default view"})]})]})]}),L&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t border-border -mx-6"}),o.jsxs(Dn,{className:"p-0 space-y-3",children:[o.jsx("div",{className:"flex items-center justify-between gap-4",children:o.jsxs("div",{className:"space-y-0.5 min-w-0",children:[o.jsx(Rs,{className:"font-normal text-foreground",children:"Pinned views"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Surface interactive tools as top-level tabs in the agent."})]})}),T&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a connection above to configure pinned views."}),E&&!T&&o.jsx("p",{className:"text-xs text-muted-foreground",children:"None of the connected servers expose interactive tools."}),l.length>0&&o.jsx("div",{className:"space-y-4 pt-1",children:l.map((B,F)=>o.jsxs("div",{children:[F>0&&o.jsx("div",{className:"border-t border-border -mx-6 mb-4"}),o.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[o.jsx(ds,{icon:B.icon,name:B.title,size:"xs",className:"shrink-0"}),o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:B.title})]}),o.jsx("div",{className:"space-y-1.5",children:B.uiTools.map(z=>{const $=f.some(W=>W.connectionId===B.id&&W.toolName===z.name),V=f.find(W=>W.connectionId===B.id&&W.toolName===z.name);return o.jsxs("div",{className:ee("flex items-center justify-between gap-3 px-3 py-2 rounded-lg border transition-colors",$?"bg-accent/40 border-border":"bg-transparent border-border"),children:[o.jsxs("div",{className:"min-w-0 flex-1 flex items-center gap-2",children:[o.jsx(fd,{value:V?.icon??null,onChange:W=>D(B.id,z.name,W),disabled:!$||x}),o.jsx(fs,{value:$&&V?V.label:Cn(z.name),onChange:W=>M(B.id,z.name,W.target.value),onBlur:R,className:"h-7 text-sm w-40",disabled:!$||x,readOnly:!$})]}),o.jsx(ur,{checked:$,onCheckedChange:()=>j(B.id,z.name),disabled:x})]},z.name)})})]},B.id))})]})]})]})]})}function Ud({virtualMcp:t,hideOwnTitle:e}){const{org:s}=ve(),i=Vl(),r=Gc(),n=Ut(),a=Ue({connectionId:Bt,orgId:s.id,orgSlug:s.slug}),l=qo({resolver:Al(Ed),defaultValues:t}),h=l.watch("connections"),c=!!Vt(t),[u,d]=P.useReducer(Ld,{shareDialogOpen:!1,addDialogOpen:!1,settingsDialogOpen:!1,settingsConnectionId:null}),[m,_]=P.useState(!1),{createTaskWithMessage:f}=lt(),{setChatMode:p}=Ci(),{createNewTask:g}=tn(),v=()=>{const I=l.getValues("metadata.instructions");I?.trim()&&(M(),ye("agent_instructions_improve_clicked",{agent_id:t.id,instructions_length:I.length}),p("plan"),f({virtualMcpId:Zo(s.id),message:{parts:[{type:"text",text:`/writing-prompts ${t.id}
|
|
4
4
|
|
|
5
5
|
<instructions>
|
|
@@ -186,4 +186,4 @@ ${Z}
|
|
|
186
186
|
|
|
187
187
|
<message>
|
|
188
188
|
${_e}
|
|
189
|
-
</message>`}]}}))},O=e.models?.credentialId||m||"",L=e.models?.thinking?.id||_?.modelId||"",B=qo({defaultValues:{name:e.name,active:e.active,credential_id:O,model_id:L}}),F=B.watch("active"),z=B.watch("credential_id"),$=B.watch("model_id"),{models:V,isLoading:W}=Ec(z||void 0),U=V.find(re=>re.modelId===$)??null,q=P.useRef(null),I=P.useRef(new Set),X=P.useRef(0),Y=P.useRef(null),te=3e4,ce=()=>{Y.current&&(clearTimeout(Y.current),Y.current=null),q.current!==null&&(ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(I.current),save_count:X.current,edit_duration_ms:Date.now()-q.current}),q.current=null,I.current=new Set,X.current=0)},ne=async()=>{if(!(Object.keys(B.formState.dirtyFields).length>0)&&!T.current)return!0;const _e=Object.keys(B.formState.dirtyFields),He=T.current;T.current=!1;const De=B.getValues(),je=E.current;try{const vt=De.credential_id&&De.model_id?De.credential_id:"",Z=De.credential_id&&De.model_id?De.model_id:"",oe={id:t,name:De.name,active:De.active,models:{credentialId:vt,thinking:{id:Z}},messages:ql(je),temperature:0};await a.mutateAsync(oe),q.current===null&&(q.current=Date.now());for(const Me of _e)I.current.add(Me);return He&&I.current.add("messages"),X.current+=1,Y.current&&clearTimeout(Y.current),Y.current=setTimeout(ce,te),B.reset({...De,credential_id:vt,model_id:Z},{keepDirtyValues:!0}),!0}catch{return T.current=!0,!1}},J=P.useRef(ne);J.current=ne;const de=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{C.current=null,J.current()},1e3)},ue=async()=>(C.current&&(clearTimeout(C.current),C.current=null),J.current()),he=re=>{if(E.current=re,S(re),!D.current){D.current=!0;return}T.current=!0,de()},pe=P.useRef(!1);pe.current||(pe.current=!0,B.watch(()=>{de()})),P.useEffect(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null,J.current())},[]);const ke=async()=>{ye("automation_test_clicked",{automation_id:t,agent_id:r});const re=await ue();if(ce(),!re)return;if(!b){me.error("No instructions configured for this automation");return}U&&z&&d({...U,keyId:z}),g({...p,toolApprovalLevel:"auto"});const _e=Sn(b);u({message:{tiptapDoc:b,parts:_e},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Na,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...B.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),i&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(fr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{control:B.control,name:"active",render:({field:re})=>o.jsx(ur,{checked:re.value,onCheckedChange:_e=>{re.onChange(_e),setTimeout(()=>ue(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ha,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Tp,{automationId:t,open:x,onOpenChange:y,onCustomSelect:()=>{w(!0),R(!1),j("")},onEventSelect:()=>{R(!0),w(!1)}})]}),e.triggers.length===0&&!k?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>y(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(re=>o.jsx(Rp,{trigger:re,automationId:t,connectionName:re.connection_id?c.get(re.connection_id):void 0},re.id))}),k&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Ts,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:N,onChange:re=>j(re.target.value),onBlur:async()=>{const re=N.trim();if(!(!re||!Ms(re)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:re}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),w(!1),j("")}catch{me.error("Failed to add starter")}},onKeyDown:async re=>{const _e=N.trim();re.key==="Enter"&&_e&&Ms(_e)&&re.target.blur(),re.key==="Escape"&&(w(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),N&&!Ms(N)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Be,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),j("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Be,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Mp,{automationId:t,onDone:()=>R(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!b,onClick:A,children:[o.jsx(wa,{size:13}),"Improve"]})]}),o.jsx(Wl,{tiptapDoc:b,setTiptapDoc:he,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Ul,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(vh,{model:U,isLoading:W,credentialId:z||null,onCredentialChange:re=>{B.setValue("credential_id",re??"",{shouldDirty:!0}),B.setValue("model_id","",{shouldDirty:!0})},onModelChange:re=>B.setValue("model_id",re.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(qe,{children:[o.jsx(Ge,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ke,disabled:!r,children:[o.jsx(ec,{size:16}),"Test"]})}),o.jsx(Ye,{children:"Test Automation"})]})]})]})})]})]})]})}function Lp(t){const e=K.c(5),{tabId:s}=t;let i;e[0]!==s?(i=ea(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Op,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function Op(t){const e=K.c(8),{id:s}=t,i=It(),{data:r,isLoading:n}=bh(s);let a;e[0]!==i?(a=()=>i({to:".",search:zp,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Pp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function zp(t){return{...t,main:"automations"}}function $p(t){const e=K.c(20),{virtualMcpId:s}=t,i=It(),{data:r}=Sh(s),n=r===void 0?[]:r,{create:a}=Us(),[l,h]=P.useState(""),c=l.toLowerCase(),u=n.filter(M=>M.name.toLowerCase().includes(c));let d;e[0]!==i?(d=M=>i({to:".",search:R=>({...R,main:"automation:"+M}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const M=await a.mutateAsync(wh(s));m(M.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(Ch,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let y;e[7]!==b||e[8]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{image:o.jsx(Ps,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{image:o.jsx(Ps,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(M=>o.jsx(yh,{automation:M,onClick:()=>m(M.id)},M.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Fp(t){const e=K.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:i,children:o.jsx($p,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const zo=P.lazy(()=>Ll(()=>import("./project-app-view-BRps_raG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Hp(t){const e=K.c(43),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Ra(r);if(oc(n)){let f;return e[3]!==i?(f=o.jsx(Fn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(wu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Fp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(wp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(of,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n?(f=o.jsx(Lp,{tabId:n}),e[13]=n,e[14]=f):f=e[14],f}let c;e[15]!==n?(c=ac(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let f;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let S;e[21]!==u.connectionId||e[22]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=S):S=e[23],f=l.find(S),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=f}else f=e[20];const p=f;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(P.Suspense,{fallback:g,children:o.jsx(zo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let f;e[33]!==n?(f=p=>p.id===n,e[33]=n,e[34]=f):f=e[34],d=a.find(f),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const m=d;if(m){let f;e[35]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=f):f=e[35];let p;return e[36]!==n||e[37]!==m.id||e[38]!==m.view.appId||e[39]!==m.view.args?(p=o.jsx(P.Suspense,{fallback:f,children:o.jsx(zo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[36]=n,e[37]=m.id,e[38]=m.view.appId,e[39]=m.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(Fn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function Wp(t){const e=K.c(7),{children:s,defaultSize:i}=t,[,r]=P.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Xo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Yo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ca,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Up(t){const e=K.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Rn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Xo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Yo(c,45),d=P.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const M=d.current;if(!M)return;const R=Rn(r,n),D=R.chat>0&&R.chat<100?u:R.chat,C=R.chat>0&&R.chat<100?100-u:R.main;M.setLayout([D,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),P.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(ja,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(Wp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Kc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=ee("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($t,{children:o.jsx(Hp,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ca,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(qc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const lr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",$o="bg-sidebar-accent text-sidebar-foreground",cr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Vp(t){const e=K.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Tc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{ye("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?$o:cr;let u;e[3]!==c?(u=ee(lr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Cc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ye,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(qe,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{ye("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?$o:cr;let v;e[16]!==g?(v=ee(lr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(kc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ye,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(qe,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=ee("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,M=!l,R=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let D;e[28]!==R?(D=ee(lr,cr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",R),e[28]=R,e[29]=D):D=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ia,{size:16}),e[30]=C):C=e[30];let T;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==M||e[35]!==D?(T=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":M,className:D,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=M,e[35]=D,e[36]=T):T=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ye,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let A;e[38]!==T?(A=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(qe,{delayDuration:300,children:[T,E]})}),e[38]=T,e[39]=A):A=e[39];let O;e[40]!==w||e[41]!==A?(O=o.jsx("div",{className:w,children:A}),e[40]=w,e[41]=A,e[42]=O):O=e[42];let L;return e[43]!==y||e[44]!==O||e[45]!==f?(L=o.jsxs(o.Fragment,{children:[f,y,O]}),e[43]=y,e[44]=O,e[45]=f,e[46]=L):L=e[46],L}function Kp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function qp(t){const e=K.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=ee("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Gp,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function Gp(t){const e=K.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(aa,{className:"size-4"}),e[4]=i):i=e[4],i}function Yp(t){const e=K.c(13),{overflow:s,onSelect:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Fs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ra,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Xp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(Hs,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Ws,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Xp(t){const e=K.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(aa,{className:"size-4"}),e[4]=i):i=e[4],i}const Jp=6;function Zp(t){const e=K.c(20),{virtualMcpId:s,taskId:i}=t,r=It();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Ra(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=lc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=Kp(a,S,Jp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(ye("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=cc({activeTab:l,mainOpen:h});r({to:".",search:M=>({...M,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(qp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Yp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Qp(t){const e=K.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=ee("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(Ol,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function eg(t){const e=K.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(uu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(du({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(mr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(yt,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const tg=new Set(["failure","timed_out","cancelled","action_required"]);function sg(t){return t.status==="completed"&&tg.has(t.conclusion)}function ig(t){return t.status==="queued"||t.status==="in_progress"}function rg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(sg).map(m=>m.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(ig);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function ng(){return qt().branchStatus}const og=6e4,ag=3e4;function lg(t){const e=K.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=Ue(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:og,refetchIntervalInBackground:!1,staleTime:ag,select:cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function cg(t){const e=Vs(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function hg(t){const e=K.c(42),{virtualMcpId:s}=t,{org:i}=ve(),r=wt(s),{currentBranch:n}=lt(),a=ki(),l=r?.metadata?.githubRepo??null,h=ng(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ma(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Ia(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let M;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(M={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=M):M=e[20];const R=lg(M);if(!l?.connectionId||!n)return null;let D;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==R.data?(D=rg({branchStatus:h,pr:p,checks:y.data??[],reviews:R.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=R.data,e[26]=D):D=e[26];const C=D;let T;e[27]!==a?(T=$=>a.sendMessage({parts:[{type:"text",text:$}]}),e[27]=a,e[28]=T):T=e[28];const E=T,A=a.isStreaming;let O;e[29]!==n||e[30]!==C||e[31]!==A||e[32]!==p||e[33]!==E?(O=$=>{if(!A)switch($){case"commit-and-push":{E(iu({branch:n}));return}case"create-pr":{E(ru({branch:n}));return}case"reopen":{p&&E(nu({prNumber:p.number}));return}case"rebase":{E(ou({branch:n}));return}case"fix-checks":{p&&E(lu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(cu({prNumber:p.number}));return}case"resolve-comments":{p&&E(hu({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=A,e[32]=p,e[33]=E,e[34]=O):O=e[34];const L=O;let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Qp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=B):B=e[35];const F=p?.number;let z;return e[36]!==C||e[37]!==A||e[38]!==L||e[39]!==E||e[40]!==F?(z=o.jsxs(o.Fragment,{children:[B,o.jsx(dg,{button:C,isStreaming:A,onActivate:L,prNumber:F,send:E})]}),e[36]=C,e[37]=A,e[38]=L,e[39]=E,e[40]=F,e[41]=z):z=e[41],z}function dg(t){const e=K.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(eg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Fo,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(uh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Fo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Fo(t){const e=K.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ge,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(Ye,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx($c,{children:o.jsxs(qe,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function ug(t){const e=K.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(dr.Right,{children:o.jsx(hg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=P.createContext(null);function xn(){return P.use(Qt)}function Ho(t){const e=K.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(ja,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx($t,{fallback:r,children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Wo(t){const e=K.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],P.useLayoutEffect(r),null}function fg(t){const e=K.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Yl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Uo(t){const e=K.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=ve(),{currentBranch:l}=lt(),{data:h}=wi.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Bt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Ue(u),{mutate:m}=on(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=P.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:mg}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),P.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Ou,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function mg(t){console.error("[auto-start-vm] failed:",t)}function _g(){const t=K.c(96),e=la(),s=It(),{org:i}=ve(),r=Rc()?.tasksOpen??!1;Fc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=zl(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Zr(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Jo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=jh(a.taskId??"",d),_=wt(d),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Vt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Dc(g,S),{setOpenMobile:y,openMobile:k}=Pc(),w=y,N=P.useRef(null);let j,M;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=q=>{Ic(q)&&q.shiftKey&&q.code==="KeyS"&&!q.repeat&&(q.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),P.useEffect(j,M);const R=d;let D;t[14]!==_||t[15]!==d?(D={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=D):D=t[16];const C=D;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Be,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let q;return t[18]!==C?(q=o.jsx(Qt,{value:C,children:U}),t[18]=C,t[19]=q):q=t[19],q}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let q;t[21]!==m.error.message?(q=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=q):q=t[22];let I;return t[23]!==C||t[24]!==q?(I=o.jsx(Qt,{value:C,children:q}),t[23]=C,t[24]=q,t[25]=I):I=t[25],I}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Is,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const q=`The agent "${d}" does not exist in this organization.`;let I;t[27]!==s||t[28]!==l?(I=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=I):I=t[29];let X;t[30]!==q||t[31]!==I?(X=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Bs,{image:U,title:"Agent not found",description:q,actions:I})})}),t[30]=q,t[31]=I,t[32]=X):X=t[32];let Y;return t[33]!==C||t[34]!==X?(Y=o.jsx(Qt,{value:C,children:X}),t[33]=C,t[34]=X,t[35]=Y):Y=t[35],Y}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Lc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let q;t[37]!==w?(q=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Mc,{onClose:()=>w(!1)})}),t[37]=w,t[38]=q):q=t[38];let I;t[39]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=I):I=t[39];let X;t[40]!==q?(X=o.jsxs(Oc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[q,I]})]}),t[40]=q,t[41]=X):X=t[41];let Y;t[42]!==k||t[43]!==w||t[44]!==X?(Y=o.jsx(zc,{open:k,onOpenChange:w,children:X}),t[42]=k,t[43]=w,t[44]=X,t[45]=Y):Y=t[45];const te=Y,ce=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let J;t[48]!==w?(J=o.jsx(fg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=J):J=t[49];let de;t[50]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ho,{})}),t[50]=de):de=t[50];let ue;t[51]!==b||t[52]!==te||t[53]!==ce||t[54]!==ne||t[55]!==J||t[56]!==d?(ue=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ce,children:[ne,J,de,te]}),t[51]=b,t[52]=te,t[53]=ce,t[54]=ne,t[55]=J,t[56]=d,t[57]=ue):ue=t[57];let he;t[58]!==R||t[59]!==ue?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:R,children:ue},R)}),t[58]=R,t[59]=ue,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Qt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const T=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==T?(E=o.jsx(dr.Toggles,{children:o.jsx(Vp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:T})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=T,t[67]=E):E=t[67];let A;t[68]!==x.taskId||t[69]!==d?(A=o.jsx(dr.Tabs,{children:o.jsx(Zp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=A):A=t[70];const O=_?.metadata?.vmMap;let L;t[71]!==_?(L=o.jsx(ug,{virtualMcp:_}),t[71]=_,t[72]=L):L=t[72];let B;t[73]!==x.createNewTask?(B=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=B):B=t[74];let F;t[75]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Ho,{}),t[75]=F):F=t[75];let z;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(z=o.jsx(Up,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:F}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=z):z=t[80];let $;t[81]!==b||t[82]!==O||t[83]!==L||t[84]!==B||t[85]!==z||t[86]!==d?($=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:O,children:[L,B,z]}),t[81]=b,t[82]=O,t[83]=L,t[84]=B,t[85]=z,t[86]=d,t[87]=$):$=t[87];let V;t[88]!==R||t[89]!==A||t[90]!==$?(V=o.jsxs(Ee.Provider,{virtualMcpId:R,children:[A,$]},R),t[88]=R,t[89]=A,t[90]=$,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function S1(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_g,{})}),t[0]=e):e=t[0],e}export{S1 as default,xn as useInsetContext};
|
|
189
|
+
</message>`}]}}))},O=e.models?.credentialId||m||"",L=e.models?.thinking?.id||_?.modelId||"",B=qo({defaultValues:{name:e.name,active:e.active,credential_id:O,model_id:L}}),F=B.watch("active"),z=B.watch("credential_id"),$=B.watch("model_id"),{models:V,isLoading:W}=Ec(z||void 0),U=V.find(re=>re.modelId===$)??null,q=P.useRef(null),I=P.useRef(new Set),X=P.useRef(0),Y=P.useRef(null),te=3e4,ce=()=>{Y.current&&(clearTimeout(Y.current),Y.current=null),q.current!==null&&(ye("automation_updated",{automation_id:t,agent_id:r,fields:Array.from(I.current),save_count:X.current,edit_duration_ms:Date.now()-q.current}),q.current=null,I.current=new Set,X.current=0)},ne=async()=>{if(!(Object.keys(B.formState.dirtyFields).length>0)&&!T.current)return!0;const _e=Object.keys(B.formState.dirtyFields),He=T.current;T.current=!1;const De=B.getValues(),je=E.current;try{const vt=De.credential_id&&De.model_id?De.credential_id:"",Z=De.credential_id&&De.model_id?De.model_id:"",oe={id:t,name:De.name,active:De.active,models:{credentialId:vt,thinking:{id:Z}},messages:ql(je),temperature:0};await a.mutateAsync(oe),q.current===null&&(q.current=Date.now());for(const Me of _e)I.current.add(Me);return He&&I.current.add("messages"),X.current+=1,Y.current&&clearTimeout(Y.current),Y.current=setTimeout(ce,te),B.reset({...De,credential_id:vt,model_id:Z},{keepDirtyValues:!0}),!0}catch{return T.current=!0,!1}},J=P.useRef(ne);J.current=ne;const de=()=>{C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{C.current=null,J.current()},1e3)},ue=async()=>(C.current&&(clearTimeout(C.current),C.current=null),J.current()),he=re=>{if(E.current=re,S(re),!D.current){D.current=!0;return}T.current=!0,de()},pe=P.useRef(!1);pe.current||(pe.current=!0,B.watch(()=>{de()})),P.useEffect(()=>()=>{C.current&&(clearTimeout(C.current),C.current=null,J.current())},[]);const ke=async()=>{ye("automation_test_clicked",{automation_id:t,agent_id:r});const re=await ue();if(ce(),!re)return;if(!b){me.error("No instructions configured for this automation");return}U&&z&&d({...U,keyId:z}),g({...p,toolApprovalLevel:"auto"});const _e=Sn(b);u({message:{tiptapDoc:b,parts:_e},virtualMcpId:r||void 0})};return o.jsxs(o.Fragment,{children:[s&&o.jsx("div",{className:"flex items-center pb-4 shrink-0",children:o.jsxs(se,{variant:"ghost",size:"sm",onClick:s,children:[o.jsx(Na,{size:14}),"Back to list"]})}),o.jsxs("div",{className:"flex flex-col gap-8",children:[o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsx(fs,{...B.register("name"),placeholder:"Automation name",className:"border border-transparent shadow-none px-0 text-lg font-medium h-auto focus-visible:ring-0 focus-visible:border-border bg-transparent flex-1",style:{boxShadow:"none"}}),i&&o.jsx(se,{variant:"ghost",size:"icon",className:"text-muted-foreground hover:text-destructive shrink-0",onClick:i,children:o.jsx(fr,{size:14})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Zt,{control:B.control,name:"active",render:({field:re})=>o.jsx(ur,{checked:re.value,onCheckedChange:_e=>{re.onChange(_e),setTimeout(()=>ue(),0)},className:"cursor-pointer"})}),o.jsx("span",{className:"text-sm text-muted-foreground",children:F?"Active":"Inactive"}),o.jsx("span",{className:"text-muted-foreground/50 text-sm",children:"·"}),o.jsx(ha,{id:e.created_by,size:"2xs",className:"text-sm text-muted-foreground"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Starter"}),o.jsx(Tp,{automationId:t,open:x,onOpenChange:y,onCustomSelect:()=>{w(!0),R(!1),j("")},onEventSelect:()=>{R(!0),w(!1)}})]}),e.triggers.length===0&&!k?o.jsx("div",{className:"rounded-lg border border-dashed border-border px-4 py-6 text-center",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:["When should this automation run?"," ",o.jsx("button",{type:"button",className:"text-foreground underline underline-offset-2 cursor-pointer hover:text-foreground/80 transition-colors",onClick:()=>y(!0),children:"Add a starter"})," ","to get going."]})}):o.jsx("div",{className:"flex flex-col gap-2",children:e.triggers.map(re=>o.jsx(Rp,{trigger:re,automationId:t,connectionName:re.connection_id?c.get(re.connection_id):void 0},re.id))}),k&&o.jsxs("div",{className:"flex items-center gap-2.5 px-3 py-2.5 rounded-lg border border-border bg-background group",children:[o.jsx(Ts,{size:14,className:"text-muted-foreground shrink-0"}),o.jsx("input",{type:"text",value:N,onChange:re=>j(re.target.value),onBlur:async()=>{const re=N.trim();if(!(!re||!Ms(re)))try{await l.mutateAsync({automation_id:t,type:"cron",cron_expression:re}),ye("automation_trigger_added",{automation_id:t,trigger_type:"cron"}),me.success("Starter added"),w(!1),j("")}catch{me.error("Failed to add starter")}},onKeyDown:async re=>{const _e=N.trim();re.key==="Enter"&&_e&&Ms(_e)&&re.target.blur(),re.key==="Escape"&&(w(!1),j(""))},placeholder:"0 9 * * 1-5",className:"flex-1 text-sm font-mono bg-transparent outline-none placeholder:text-muted-foreground/40",autoFocus:!0}),N&&!Ms(N)&&o.jsx("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:"invalid"}),l.isPending&&o.jsx(Be,{size:13,className:"animate-spin text-muted-foreground shrink-0"}),o.jsx("button",{type:"button",className:"shrink-0 p-0.5 rounded text-muted-foreground opacity-0 group-hover:opacity-100 hover:text-foreground transition-opacity",onClick:()=>{w(!1),j("")},children:o.jsx(ls,{size:13})})]}),M&&o.jsx(P.Suspense,{fallback:o.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 rounded-lg border border-border bg-background",children:[o.jsx(Be,{size:13,className:"animate-spin text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading connections..."})]}),children:o.jsx(Mp,{automationId:t,onDone:()=>R(!1)})})]}),o.jsxs("div",{className:"flex flex-col gap-2.5",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"text-xs font-semibold text-muted-foreground/60",children:"Instructions"}),o.jsxs(se,{variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:!b,onClick:A,children:[o.jsx(wa,{size:13}),"Improve"]})]}),o.jsx(Wl,{tiptapDoc:b,setTiptapDoc:he,placeholder:"What should this automation do?",children:o.jsxs("div",{className:"rounded-xl border border-border min-h-[120px] flex flex-col",children:[o.jsx(Ul,{virtualMcpId:r||null,className:"max-h-[45vh]"}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 p-2.5",children:[o.jsx(vh,{model:U,isLoading:W,credentialId:z||null,onCredentialChange:re=>{B.setValue("credential_id",re??"",{shouldDirty:!0}),B.setValue("model_id","",{shouldDirty:!0})},onModelChange:re=>B.setValue("model_id",re.modelId,{shouldDirty:!0}),placeholder:"Model"}),o.jsxs(qe,{children:[o.jsx(Ge,{asChild:!0,children:o.jsxs(se,{type:"button",variant:"default",className:"h-8 gap-1.5 rounded-md px-3 text-sm font-medium",onClick:ke,disabled:!r,children:[o.jsx(ec,{size:16}),"Test"]})}),o.jsx(Ye,{children:"Test Automation"})]})]})]})})]})]})]})}function Lp(t){const e=K.c(5),{tabId:s}=t;let i;e[0]!==s?(i=ea(s),e[0]=s,e[1]=i):i=e[1];const r=i;if(!r)return null;let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=n):n=e[2];let a;return e[3]!==r.id?(a=o.jsx(at,{children:o.jsx(at.Content,{children:o.jsx(at.Body,{children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Op,{id:r.id})})})})}),e[3]=r.id,e[4]=a):a=e[4],a}function Op(t){const e=K.c(8),{id:s}=t,i=It(),{data:r,isLoading:n}=bh(s);let a;e[0]!==i?(a=()=>i({to:".",search:zp,replace:!0}),e[0]=i,e[1]=a):a=e[1];const l=a;if(n){let c;return e[2]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[2]=c):c=e[2],c}if(!r){let c;return e[3]===Symbol.for("react.memo_cache_sentinel")?(c=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Automation not found"}),e[3]=c):c=e[3],c}let h;return e[4]!==r||e[5]!==s||e[6]!==l?(h=o.jsx(Pp,{automationId:s,automation:r,onBack:l}),e[4]=r,e[5]=s,e[6]=l,e[7]=h):h=e[7],h}function zp(t){return{...t,main:"automations"}}function $p(t){const e=K.c(20),{virtualMcpId:s}=t,i=It(),{data:r}=Sh(s),n=r===void 0?[]:r,{create:a}=Us(),[l,h]=P.useState(""),c=l.toLowerCase(),u=n.filter(M=>M.name.toLowerCase().includes(c));let d;e[0]!==i?(d=M=>i({to:".",search:R=>({...R,main:"automation:"+M}),replace:!0}),e[0]=i,e[1]=d):d=e[1];const m=d,_=async()=>{if(a.isPending)return;ye("automation_new_clicked",{virtual_mcp_id:s,existing_count:n.length});const M=await a.mutateAsync(wh(s));m(M.id)},f=at,p=at,g=at;let v;e[2]===Symbol.for("react.memo_cache_sentinel")?(v=o.jsx(at.Title,{children:"Automations"}),e[2]=v):v=e[2];const b=n.length>0&&o.jsx(Ch,{value:l,onChange:h,placeholder:"Search automations...",className:"w-full md:w-[375px]"});let S;e[3]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(cs,{size:14}),e[3]=S):S=e[3];let x;e[4]!==a.isPending||e[5]!==_?(x=o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[S,"New automation"]}),e[4]=a.isPending,e[5]=_,e[6]=x):x=e[6];let y;e[7]!==b||e[8]!==x?(y=o.jsxs("div",{className:"flex flex-col gap-6",children:[v,o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[b,x]})]}),e[7]=b,e[8]=x,e[9]=y):y=e[9];const k=n.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{image:o.jsx(Ps,{size:48,className:"text-muted-foreground"}),title:"No automations yet",description:"Create your first automation to run this agent on a schedule or in response to events.",actions:o.jsxs(se,{size:"sm",onClick:_,disabled:a.isPending,children:[o.jsx(cs,{size:14}),"New automation"]})})}):u.length===0?o.jsx("div",{className:"flex items-center justify-center py-20",children:o.jsx(Bs,{image:o.jsx(Ps,{size:48,className:"text-muted-foreground"}),title:"No automations found",description:`No automations match "${l}"`})}):o.jsx("div",{className:"mt-6 rounded-xl border border-border overflow-hidden",children:u.map(M=>o.jsx(yh,{automation:M,onClick:()=>m(M.id)},M.id))});let w;e[10]!==k||e[11]!==g.Body||e[12]!==y?(w=o.jsxs(g.Body,{children:[y,k]}),e[10]=k,e[11]=g.Body,e[12]=y,e[13]=w):w=e[13];let N;e[14]!==w||e[15]!==p.Content?(N=o.jsx(p.Content,{children:w}),e[14]=w,e[15]=p.Content,e[16]=N):N=e[16];let j;return e[17]!==f||e[18]!==N?(j=o.jsx(f,{children:N}),e[17]=f,e[18]=N,e[19]=j):j=e[19],j}function Fp(t){const e=K.c(3),{virtualMcpId:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx(P.Suspense,{fallback:i,children:o.jsx($p,{virtualMcpId:s})}),e[1]=s,e[2]=r):r=e[2],r}const zo=P.lazy(()=>Ll(()=>import("./project-app-view-CbPm1ZuF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55])).then(t=>({default:t.AppViewContent})));function Hp(t){const e=K.c(43),{taskId:s,virtualMcpId:i}=t;let r;e[0]!==s||e[1]!==i?(r={virtualMcpId:i,taskId:s},e[0]=s,e[1]=i,e[2]=r):r=e[2];const{activeTab:n,layoutTabs:a,expandedTools:l,automationTabParsed:h}=Ra(r);if(oc(n)){let f;return e[3]!==i?(f=o.jsx(Fn,{virtualMcpId:i}),e[3]=i,e[4]=f):f=e[4],f}if(n==="git"){let f;return e[5]!==i?(f=o.jsx(wu,{virtualMcpId:i}),e[5]=i,e[6]=f):f=e[6],f}if(n==="automations"){let f;return e[7]!==i?(f=o.jsx(Fp,{virtualMcpId:i}),e[7]=i,e[8]=f):f=e[8],f}if(n==="env"){let f;return e[9]!==i?(f=o.jsx(wp,{virtualMcpId:i}),e[9]=i,e[10]=f):f=e[10],f}if(n==="preview"){let f;return e[11]!==i?(f=o.jsx(of,{virtualMcpId:i}),e[11]=i,e[12]=f):f=e[12],f}if(h){let f;return e[13]!==n?(f=o.jsx(Lp,{tabId:n}),e[13]=n,e[14]=f):f=e[14],f}let c;e[15]!==n?(c=ac(n),e[15]=n,e[16]=c):c=e[16];const u=c;if(u){let f;if(e[17]!==l||e[18]!==u.connectionId||e[19]!==u.toolName){let S;e[21]!==u.connectionId||e[22]!==u.toolName?(S=x=>x.appId===u.connectionId&&x.toolName===u.toolName,e[21]=u.connectionId,e[22]=u.toolName,e[23]=S):S=e[23],f=l.find(S),e[17]=l,e[18]=u.connectionId,e[19]=u.toolName,e[20]=f}else f=e[20];const p=f;let g;e[24]===Symbol.for("react.memo_cache_sentinel")?(g=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[24]=g):g=e[24];const v=p?.args;let b;return e[25]!==n||e[26]!==u.connectionId||e[27]!==u.toolName||e[28]!==v?(b=o.jsx(P.Suspense,{fallback:g,children:o.jsx(zo,{connectionId:u.connectionId,toolName:u.toolName,args:v},n)}),e[25]=n,e[26]=u.connectionId,e[27]=u.toolName,e[28]=v,e[29]=b):b=e[29],b}let d;if(e[30]!==n||e[31]!==a){let f;e[33]!==n?(f=p=>p.id===n,e[33]=n,e[34]=f):f=e[34],d=a.find(f),e[30]=n,e[31]=a,e[32]=d}else d=e[32];const m=d;if(m){let f;e[35]===Symbol.for("react.memo_cache_sentinel")?(f=o.jsx("div",{className:"h-full w-full flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),e[35]=f):f=e[35];let p;return e[36]!==n||e[37]!==m.id||e[38]!==m.view.appId||e[39]!==m.view.args?(p=o.jsx(P.Suspense,{fallback:f,children:o.jsx(zo,{connectionId:m.view.appId,toolName:m.id,args:m.view.args},n)}),e[36]=n,e[37]=m.id,e[38]=m.view.appId,e[39]=m.view.args,e[40]=p):p=e[40],p}let _;return e[41]!==i?(_=o.jsx(Fn,{virtualMcpId:i}),e[41]=i,e[42]=_):_=e[42],_}function Wp(t){const e=K.c(7),{children:s,defaultSize:i}=t,[,r]=P.useTransition();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=Xo.decoChatPanelWidth(),e[0]=n):n=e[0];const[a,l]=Yo(n,45),h=i>0&&i<100?a:i;let c;e[1]!==l?(c=m=>r(()=>{m>0&&m<100&&l(m)}),e[1]=l,e[2]=c):c=e[2];const u=c;let d;return e[3]!==s||e[4]!==h||e[5]!==u?(d=o.jsx(ca,{defaultSize:h,minSize:20,collapsible:!0,collapsedSize:0,className:"min-w-0 overflow-hidden bg-sidebar",onResize:u,order:1,children:s}),e[3]=s,e[4]=h,e[5]=u,e[6]=d):d=e[6],d}function Up(t){const e=K.c(30),{virtualMcpId:s,taskId:i,chatOpen:r,mainOpen:n,chatContent:a}=t;let l;e[0]!==r||e[1]!==n?(l=Rn(r,n),e[0]=r,e[1]=n,e[2]=l):l=e[2];const h=l;let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=Xo.decoChatPanelWidth(),e[3]=c):c=e[3];const[u]=Yo(c,45),d=P.useRef(null);let m,_;e[4]!==r||e[5]!==n||e[6]!==u?(m=()=>{const M=d.current;if(!M)return;const R=Rn(r,n),D=R.chat>0&&R.chat<100?u:R.chat,C=R.chat>0&&R.chat<100?100-u:R.main;M.setLayout([D,C])},_=[r,n,u],e[4]=r,e[5]=n,e[6]=u,e[7]=m,e[8]=_):(m=e[7],_=e[8]),P.useEffect(m,_);const f=`${s}-${i}`;let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p={overflow:"visible"},e[9]=p):p=e[9];let g;e[10]!==a?(g=a??o.jsx(ja,{}),e[10]=a,e[11]=g):g=e[11];let v;e[12]!==g?(v=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:"h-full bg-background rounded-[0.75rem] overflow-hidden card-shadow",children:g})}),e[12]=g,e[13]=v):v=e[13];let b;e[14]!==h.chat||e[15]!==v?(b=o.jsx(Wp,{defaultSize:h.chat,children:v}),e[14]=h.chat,e[15]=v,e[16]=b):b=e[16];let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=o.jsx(Kc,{className:"bg-sidebar"}),e[17]=S):S=e[17];const x=h.main;let y;e[18]===Symbol.for("react.memo_cache_sentinel")?(y={overflow:"visible"},e[18]=y):y=e[18];let k;e[19]===Symbol.for("react.memo_cache_sentinel")?(k=ee("flex flex-col h-full min-h-0 bg-background overflow-hidden","card-shadow","transition-[border-radius] duration-200 ease-[var(--ease-out-quart)]","rounded-[0.75rem]"),e[19]=k):k=e[19];let w;e[20]!==i||e[21]!==s?(w=o.jsx("div",{className:"h-full p-0.5 pt-0.25",children:o.jsx("div",{className:k,children:o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx($t,{children:o.jsx(Hp,{taskId:i,virtualMcpId:s})})})})}),e[20]=i,e[21]=s,e[22]=w):w=e[22];let N;e[23]!==h.main||e[24]!==w?(N=o.jsx(ca,{className:"min-w-0 flex flex-col",order:2,defaultSize:x,style:y,collapsible:!0,collapsedSize:0,minSize:20,children:w}),e[23]=h.main,e[24]=w,e[25]=N):N=e[25];let j;return e[26]!==N||e[27]!==f||e[28]!==b?(j=o.jsxs(qc,{ref:d,direction:"horizontal",className:"flex-1 min-h-0 pb-1 pr-1 pl-0 pt-0",style:p,children:[b,S,N]},f),e[26]=N,e[27]=f,e[28]=b,e[29]=j):j=e[29],j}const lr="flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",$o="bg-sidebar-accent text-sidebar-foreground",cr="text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";function Vp(t){const e=K.c(47),{chatOpen:s,toggleChat:i,onNewTask:r}=t,{tasksOpen:n,toggleTasks:a}=Tc(),l=!!r;let h;e[0]!==n||e[1]!==a?(h=()=>{ye("agent_toolbar_toggled",{button:"tasks",next_state:n?"closed":"open"}),a()},e[0]=n,e[1]=a,e[2]=h):h=e[2];const c=n?$o:cr;let u;e[3]!==c?(u=ee(lr,c),e[3]=c,e[4]=u):u=e[4];let d;e[5]===Symbol.for("react.memo_cache_sentinel")?(d=o.jsx(Cc,{size:16}),e[5]=d):d=e[5];let m;e[6]!==h||e[7]!==u||e[8]!==n?(m=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:h,"aria-pressed":n,className:u,children:d})}),e[6]=h,e[7]=u,e[8]=n,e[9]=m):m=e[9];let _;e[10]===Symbol.for("react.memo_cache_sentinel")?(_=o.jsx(Ye,{side:"bottom",children:"Tasks"}),e[10]=_):_=e[10];let f;e[11]!==m?(f=o.jsxs(qe,{delayDuration:300,children:[m,_]}),e[11]=m,e[12]=f):f=e[12];let p;e[13]!==s||e[14]!==i?(p=()=>{ye("agent_toolbar_toggled",{button:"chat",next_state:s?"closed":"open"}),i()},e[13]=s,e[14]=i,e[15]=p):p=e[15];const g=s?$o:cr;let v;e[16]!==g?(v=ee(lr,g),e[16]=g,e[17]=v):v=e[17];let b;e[18]===Symbol.for("react.memo_cache_sentinel")?(b=o.jsx(kc,{size:16}),e[18]=b):b=e[18];let S;e[19]!==s||e[20]!==v||e[21]!==p?(S=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:p,"aria-pressed":s,className:v,children:b})}),e[19]=s,e[20]=v,e[21]=p,e[22]=S):S=e[22];let x;e[23]===Symbol.for("react.memo_cache_sentinel")?(x=o.jsx(Ye,{side:"bottom",children:"Chat"}),e[23]=x):x=e[23];let y;e[24]!==S?(y=o.jsxs(qe,{delayDuration:300,children:[S,x]}),e[24]=S,e[25]=y):y=e[25];const k=l?"grid-cols-[1fr]":"grid-cols-[0fr]";let w;e[26]!==k?(w=ee("grid transition-[grid-template-columns] duration-200 ease-[var(--ease-out-quart)]",k),e[26]=k,e[27]=w):w=e[27];const N=!l,j=l?0:-1,M=!l,R=l?"translate-x-0 opacity-100":"-translate-x-2 opacity-0";let D;e[28]!==R?(D=ee(lr,cr,"transition-[transform,opacity] duration-200 ease-[var(--ease-out-quart)] will-change-transform",R),e[28]=R,e[29]=D):D=e[29];let C;e[30]===Symbol.for("react.memo_cache_sentinel")?(C=o.jsx(ia,{size:16}),e[30]=C):C=e[30];let T;e[31]!==r||e[32]!==N||e[33]!==j||e[34]!==M||e[35]!==D?(T=o.jsx(Ge,{asChild:!0,children:o.jsx("button",{type:"button",onClick:r,disabled:N,tabIndex:j,"aria-hidden":M,className:D,children:C})}),e[31]=r,e[32]=N,e[33]=j,e[34]=M,e[35]=D,e[36]=T):T=e[36];let E;e[37]===Symbol.for("react.memo_cache_sentinel")?(E=o.jsx(Ye,{side:"bottom",children:"New task"}),e[37]=E):E=e[37];let A;e[38]!==T?(A=o.jsx("div",{className:"overflow-hidden",children:o.jsxs(qe,{delayDuration:300,children:[T,E]})}),e[38]=T,e[39]=A):A=e[39];let O;e[40]!==w||e[41]!==A?(O=o.jsx("div",{className:w,children:A}),e[40]=w,e[41]=A,e[42]=O):O=e[42];let L;return e[43]!==y||e[44]!==O||e[45]!==f?(L=o.jsxs(o.Fragment,{children:[f,y,O]}),e[43]=y,e[44]=O,e[45]=f,e[46]=L):L=e[46],L}function Kp(t,e,s){if(t.length<=s)return{visible:t,overflow:[]};const i=t.slice(0,s),r=t.slice(s);if(e==null)return{visible:i,overflow:r};if(i.some(d=>d.id===e))return{visible:i,overflow:r};const a=r.findIndex(d=>d.id===e);if(a===-1)return{visible:i,overflow:r};const l=i[i.length-1],h=r[a],c=[...i.slice(0,-1),h],u=[l,...r.slice(0,a),...r.slice(a+1)];return{visible:c,overflow:u}}function qp(t){const e=K.c(13),{title:s,icon:i,active:r,onClick:n}=t,a=r?"bg-sidebar-accent text-sidebar-foreground":"text-sidebar-foreground/60 hover:bg-sidebar-accent hover:text-sidebar-foreground";let l;e[0]!==a?(l=ee("shrink-0 flex items-center gap-1.5 h-8 rounded-md px-2","[transition:background-color_180ms_ease,color_180ms_ease]",a),e[0]=a,e[1]=l):l=e[1];let h;e[2]!==i?(h=o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Gp,{icon:i})}),e[2]=i,e[3]=h):h=e[3];let c;e[4]!==s?(c=o.jsx("span",{className:"whitespace-nowrap text-sm font-medium leading-none",children:s}),e[4]=s,e[5]=c):c=e[5];let u;return e[6]!==r||e[7]!==n||e[8]!==l||e[9]!==h||e[10]!==c||e[11]!==s?(u=o.jsxs("button",{type:"button",onClick:n,"aria-pressed":r,"aria-label":s,className:l,children:[h,c]}),e[6]=r,e[7]=n,e[8]=l,e[9]=h,e[10]=c,e[11]=s,e[12]=u):u=e[12],u}function Gp(t){const e=K.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(aa,{className:"size-4"}),e[4]=i):i=e[4],i}function Yp(t){const e=K.c(13),{overflow:s,onSelect:i}=t,[r,n]=P.useState(!1);let a;e[0]!==i?(a=m=>{n(!1),i(m)},e[0]=i,e[1]=a):a=e[1];const l=a;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=o.jsx(Fs,{asChild:!0,children:o.jsx("button",{type:"button",title:"More tabs","aria-label":"More tabs",className:"shrink-0 flex size-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:o.jsx(ra,{className:"size-4"})})}),e[2]=h):h=e[2];let c;if(e[3]!==l||e[4]!==s){let m;e[6]!==l?(m=_=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>l(_.id),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md hover:bg-accent text-sm text-foreground",children:[o.jsx("span",{className:"flex size-5 items-center justify-center shrink-0",children:o.jsx(Xp,{icon:_.icon})}),o.jsx("span",{className:"truncate",children:_.title})]})},_.id),e[6]=l,e[7]=m):m=e[7],c=s.map(m),e[3]=l,e[4]=s,e[5]=c}else c=e[5];let u;e[8]!==c?(u=o.jsx(Hs,{align:"end",className:"w-56 p-1",children:o.jsx("ul",{className:"flex flex-col",children:c})}),e[8]=c,e[9]=u):u=e[9];let d;return e[10]!==r||e[11]!==u?(d=o.jsxs(Ws,{open:r,onOpenChange:n,children:[h,u]}),e[10]=r,e[11]=u,e[12]=d):d=e[12],d}function Xp(t){const e=K.c(5),{icon:s}=t;if(s.kind==="component"){const{Component:r}=s;let n;return e[0]!==r?(n=o.jsx(r,{className:"size-4"}),e[0]=r,e[1]=n):n=e[1],n}if(s.kind==="url"){let r;return e[2]!==s.src?(r=o.jsx("img",{src:s.src,alt:"",className:"size-4 rounded-sm object-cover"}),e[2]=s.src,e[3]=r):r=e[3],r}let i;return e[4]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(aa,{className:"size-4"}),e[4]=i):i=e[4],i}const Jp=6;function Zp(t){const e=K.c(20),{virtualMcpId:s,taskId:i}=t,r=It();let n;e[0]!==i||e[1]!==s?(n={virtualMcpId:s,taskId:i},e[0]=i,e[1]=s,e[2]=n):n=e[2];const{tabs:a,activeTab:l,mainOpen:h,setActiveTab:c}=Ra(n);let u,d,m,_;if(e[3]!==l||e[4]!==h||e[5]!==r||e[6]!==c||e[7]!==a||e[8]!==s){const g=lc({activeTab:l,mainOpen:h}),v=k=>k.id==="automations"?g:h&&k.id===l,S=a.find(k=>v(k))?.id??null,{visible:x,overflow:y}=Kp(a,S,Jp);d=y,u=k=>{const w=a.find(j=>j.id===k),N=S===k&&h;if(ye("main_panel_tab_clicked",{virtual_mcp_id:s,tab_id:k,tab_kind:w?.kind??null,was_active:N}),k==="automations"){const j=cc({activeTab:l,mainOpen:h});r({to:".",search:M=>({...M,main:j}),replace:!0});return}c(k)},m="flex items-center min-w-0 ml-auto gap-0.5",_=x.map(k=>o.jsx(qp,{title:k.title,icon:k.icon,active:v(k),onClick:()=>u(k.id)},k.id)),e[3]=l,e[4]=h,e[5]=r,e[6]=c,e[7]=a,e[8]=s,e[9]=u,e[10]=d,e[11]=m,e[12]=_}else u=e[9],d=e[10],m=e[11],_=e[12];let f;e[13]!==u||e[14]!==d?(f=d.length>0&&o.jsx(Yp,{overflow:d,onSelect:u}),e[13]=u,e[14]=d,e[15]=f):f=e[15];let p;return e[16]!==m||e[17]!==_||e[18]!==f?(p=o.jsxs("div",{className:m,children:[_,f]}),e[16]=m,e[17]=_,e[18]=f,e[19]=p):p=e[19],p}function Qp(t){const e=K.c(12);let s,i,r,n;e[0]!==t?({className:s,orientation:r,decorative:n,...i}=t,e[0]=t,e[1]=s,e[2]=i,e[3]=r,e[4]=n):(s=e[1],i=e[2],r=e[3],n=e[4]);const a=r===void 0?"horizontal":r,l=n===void 0?!0:n;let h;e[5]!==s?(h=ee("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",s),e[5]=s,e[6]=h):h=e[6];let c;return e[7]!==l||e[8]!==a||e[9]!==i||e[10]!==h?(c=o.jsx(Ol,{"data-slot":"separator-root",decorative:l,orientation:a,className:h,...i}),e[7]=l,e[8]=a,e[9]=i,e[10]=h,e[11]=c):c=e[11],c}function eg(t){const e=K.c(20),{prNumber:s,disabled:i,send:r}=t;let n;e[0]!==s||e[1]!==r?(n=()=>r(uu({prNumber:s})),e[0]=s,e[1]=r,e[2]=n):n=e[2];const a=n;let l;e[3]!==s||e[4]!==r?(l=()=>r(du({prNumber:s})),e[3]=s,e[4]=r,e[5]=l):l=e[5];const h=l;let c;e[6]!==i||e[7]!==a?(c=o.jsx(se,{size:"sm",variant:"success",className:"rounded-r-none border-r border-success-foreground/20",disabled:i,onClick:a,children:"Publish"}),e[6]=i,e[7]=a,e[8]=c):c=e[8];let u;e[9]===Symbol.for("react.memo_cache_sentinel")?(u=o.jsx(mr,{className:"h-3.5 w-3.5"}),e[9]=u):u=e[9];let d;e[10]!==i?(d=o.jsx(os,{asChild:!0,children:o.jsx(se,{size:"sm",variant:"success",className:"rounded-l-none px-2",disabled:i,"aria-label":"More actions",children:u})}),e[10]=i,e[11]=d):d=e[11];let m;e[12]!==h?(m=o.jsx(as,{align:"end",children:o.jsx(yt,{onClick:h,children:"Review"})}),e[12]=h,e[13]=m):m=e[13];let _;e[14]!==d||e[15]!==m?(_=o.jsxs(ns,{children:[d,m]}),e[14]=d,e[15]=m,e[16]=_):_=e[16];let f;return e[17]!==c||e[18]!==_?(f=o.jsxs("div",{className:"inline-flex items-stretch rounded-md",children:[c,_]}),e[17]=c,e[18]=_,e[19]=f):f=e[19],f}const tg=new Set(["failure","timed_out","cancelled","action_required"]);function sg(t){return t.status==="completed"&&tg.has(t.conclusion)}function ig(t){return t.status==="queued"||t.status==="in_progress"}function rg(t){const{branchStatus:e,pr:s,checks:i,reviews:r,loading:n}=t;if(!e||n)return{label:"Loading…",disabled:!0,loading:!0,variant:"outline",tooltip:"Loading branch and pull request status"};switch(e.kind){case"initializing":return{label:"Starting sandbox…",disabled:!0,loading:!0,variant:"outline",tooltip:"Waiting for the sandbox daemon to come online"};case"cloning":return{label:"Cloning repo…",disabled:!0,loading:!0,variant:"outline",tooltip:"Cloning the project repository"};case"clone-failed":return{label:"Clone failed",disabled:!0,variant:"outline",tooltip:e.error||"git clone failed — see setup logs"};case"checking-out":return{label:`Switching to ${e.to}…`,disabled:!0,loading:!0,variant:"outline",tooltip:`Checking out ${e.to}`};case"checkout-failed":return{label:"Checkout failed",disabled:!0,variant:"outline",tooltip:e.error||"git checkout failed — see setup logs"}}const a=e;if(a.workingTreeDirty||a.unpushed>0)return{label:"Save changes",action:"commit-and-push",variant:"default",tooltip:"Commit and push local changes"};if(s?.merged)return!!a.headSha&&!!s.headSha&&a.headSha!==s.headSha?{label:"Continue",action:"create-pr",variant:"special",tooltip:"Open a new PR with the latest commits"}:{label:"Published",disabled:!0,variant:"outline",tooltip:`PR #${s.number} merged into ${s.base}`};if(a.aheadOfBase>0){if(s&&s.state==="closed"&&!s.merged)return{label:"Reopen",action:"reopen",variant:"default",tooltip:`Reopen PR #${s.number}`};if(!s)return{label:"Submit for review",action:"create-pr",variant:"default",tooltip:`Open a PR for ${a.branch} → ${a.base}`};if((r?.mergeableState??"unknown")==="dirty")return{label:`Sync with ${s.base}`,action:"rebase",variant:"default",tooltip:`Resolve conflicts with ${s.base} before merging`};const c=i.filter(sg).map(m=>m.name);if(c.length>0)return{label:"Fix tests",action:"fix-checks",variant:"default",tooltip:`Failing: ${c.join(", ")}`,meta:{failingChecks:c}};const u=i.filter(ig);if(u.length>0)return{label:"Running tests…",disabled:!0,loading:!0,variant:"outline",tooltip:`Waiting on ${u.length} check${u.length===1?"":"s"} to finish`};if(r?.draft)return{label:"Mark ready",action:"mark-ready",variant:"default",tooltip:"Mark draft PR ready for review"};const d=r?.unresolvedConversations??0;return d>0?{label:"Address feedback",action:"resolve-comments",variant:"default",tooltip:`${d} unresolved conversation${d===1?"":"s"}`}:r?.missingRequiredApprovals?{label:"Awaiting review",disabled:!0,variant:"outline",tooltip:"Waiting for required approvals"}:{label:"Publish",action:"merge-split",variant:"success",tooltip:`Squash-merge PR #${s.number} into ${s.base}`}}return{label:"Up to date",disabled:!0,variant:"outline",tooltip:`Branch is in sync with ${a.base}`}}function ng(){return qt().branchStatus}const og=6e4,ag=3e4;function lg(t){const e=K.c(12);let s;e[0]!==t.connectionId||e[1]!==t.orgId||e[2]!==t.orgSlug?(s={connectionId:t.connectionId,orgId:t.orgId,orgSlug:t.orgSlug},e[0]=t.connectionId,e[1]=t.orgId,e[2]=t.orgSlug,e[3]=s):s=e[3];const i=Ue(s),r=t.prNumber??0;let n;e[4]!==t.owner||e[5]!==t.repo||e[6]!==r?(n={method:"get",owner:t.owner,repo:t.repo,pullNumber:r},e[4]=t.owner,e[5]=t.repo,e[6]=r,e[7]=n):n=e[7];const a=!!t.prNumber;let l;return e[8]!==i||e[9]!==n||e[10]!==a?(l={client:i,toolName:"pull_request_read",toolArguments:n,enabled:a,refetchInterval:og,refetchIntervalInBackground:!1,staleTime:ag,select:cg},e[8]=i,e[9]=n,e[10]=a,e[11]=l):l=e[11],us(l)}function cg(t){const e=Vs(t);if(!e)return null;const s=e.mergeable_state??"unknown",i=!!(e.draft??!1),r=Number(e.review_comments??0),n=s==="blocked"&&r>0?r:0;return{draft:i,mergeableState:s,unresolvedConversations:n,missingRequiredApprovals:s==="blocked"&&n===0}}function hg(t){const e=K.c(42),{virtualMcpId:s}=t,{org:i}=ve(),r=wt(s),{currentBranch:n}=lt(),a=ki(),l=r?.metadata?.githubRepo??null,h=ng(),c=l?.connectionId??"",u=l?.owner??"",d=l?.name??"",m=n??null;let _;e[0]!==i.id||e[1]!==i.slug||e[2]!==c||e[3]!==u||e[4]!==d||e[5]!==m?(_={orgId:i.id,orgSlug:i.slug,connectionId:c,owner:u,repo:d,branch:m},e[0]=i.id,e[1]=i.slug,e[2]=c,e[3]=u,e[4]=d,e[5]=m,e[6]=_):_=e[6];const f=Ma(_),p=f.data??null,g=l?.connectionId??"",v=l?.owner??"",b=l?.name??"",S=p&&p.state==="open"?p.number:null;let x;e[7]!==i.id||e[8]!==i.slug||e[9]!==g||e[10]!==v||e[11]!==b||e[12]!==S?(x={orgId:i.id,orgSlug:i.slug,connectionId:g,owner:v,repo:b,prNumber:S},e[7]=i.id,e[8]=i.slug,e[9]=g,e[10]=v,e[11]=b,e[12]=S,e[13]=x):x=e[13];const y=Ia(x),k=l?.connectionId??"",w=l?.owner??"",N=l?.name??"",j=p&&p.state==="open"?p.number:null;let M;e[14]!==i.id||e[15]!==i.slug||e[16]!==k||e[17]!==w||e[18]!==N||e[19]!==j?(M={orgId:i.id,orgSlug:i.slug,connectionId:k,owner:w,repo:N,prNumber:j},e[14]=i.id,e[15]=i.slug,e[16]=k,e[17]=w,e[18]=N,e[19]=j,e[20]=M):M=e[20];const R=lg(M);if(!l?.connectionId||!n)return null;let D;e[21]!==h||e[22]!==y.data||e[23]!==p||e[24]!==f.isPending||e[25]!==R.data?(D=rg({branchStatus:h,pr:p,checks:y.data??[],reviews:R.data??null,loading:f.isPending}),e[21]=h,e[22]=y.data,e[23]=p,e[24]=f.isPending,e[25]=R.data,e[26]=D):D=e[26];const C=D;let T;e[27]!==a?(T=$=>a.sendMessage({parts:[{type:"text",text:$}]}),e[27]=a,e[28]=T):T=e[28];const E=T,A=a.isStreaming;let O;e[29]!==n||e[30]!==C||e[31]!==A||e[32]!==p||e[33]!==E?(O=$=>{if(!A)switch($){case"commit-and-push":{E(iu({branch:n}));return}case"create-pr":{E(ru({branch:n}));return}case"reopen":{p&&E(nu({prNumber:p.number}));return}case"rebase":{E(ou({branch:n}));return}case"fix-checks":{p&&E(lu({prNumber:p.number,failingChecks:C.meta?.failingChecks??[]}));return}case"mark-ready":{p&&E(cu({prNumber:p.number}));return}case"resolve-comments":{p&&E(hu({prNumber:p.number}));return}case"merge-split":return}},e[29]=n,e[30]=C,e[31]=A,e[32]=p,e[33]=E,e[34]=O):O=e[34];const L=O;let B;e[35]===Symbol.for("react.memo_cache_sentinel")?(B=o.jsx(Qp,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-5"}),e[35]=B):B=e[35];const F=p?.number;let z;return e[36]!==C||e[37]!==A||e[38]!==L||e[39]!==E||e[40]!==F?(z=o.jsxs(o.Fragment,{children:[B,o.jsx(dg,{button:C,isStreaming:A,onActivate:L,prNumber:F,send:E})]}),e[36]=C,e[37]=A,e[38]=L,e[39]=E,e[40]=F,e[41]=z):z=e[41],z}function dg(t){const e=K.c(21),{button:s,isStreaming:i}=t,r=!!s.disabled||i,n=i?"Chat is running":s.tooltip??null;if(s.action==="merge-split"&&t.prNumber!=null){let u;e[0]!==r||e[1]!==t.prNumber||e[2]!==t.send?(u=o.jsx(eg,{prNumber:t.prNumber,disabled:r,send:t.send}),e[0]=r,e[1]=t.prNumber,e[2]=t.send,e[3]=u):u=e[3];let d;return e[4]!==u||e[5]!==n?(d=o.jsx(Fo,{label:n,children:u}),e[4]=u,e[5]=n,e[6]=d):d=e[6],d}let a;e[7]!==s.action||e[8]!==t?(a=()=>t.onActivate(s.action),e[7]=s.action,e[8]=t,e[9]=a):a=e[9];let l;e[10]!==s.loading?(l=s.loading?o.jsx(uh,{size:"xs",variant:"default"}):null,e[10]=s.loading,e[11]=l):l=e[11];let h;e[12]!==s.label||e[13]!==s.variant||e[14]!==r||e[15]!==a||e[16]!==l?(h=o.jsxs(se,{size:"sm",variant:s.variant,disabled:r,onClick:a,children:[l,s.label]}),e[12]=s.label,e[13]=s.variant,e[14]=r,e[15]=a,e[16]=l,e[17]=h):h=e[17];let c;return e[18]!==h||e[19]!==n?(c=o.jsx(Fo,{label:n,children:h}),e[18]=h,e[19]=n,e[20]=c):c=e[20],c}function Fo(t){const e=K.c(9),{label:s,children:i}=t;if(!s){let l;return e[0]!==i?(l=o.jsx(o.Fragment,{children:i}),e[0]=i,e[1]=l):l=e[1],l}let r;e[2]!==i?(r=o.jsx(Ge,{asChild:!0,children:o.jsx("span",{children:i})}),e[2]=i,e[3]=r):r=e[3];let n;e[4]!==s?(n=o.jsx(Ye,{children:s}),e[4]=s,e[5]=n):n=e[5];let a;return e[6]!==r||e[7]!==n?(a=o.jsx($c,{children:o.jsxs(qe,{children:[r,n]})}),e[6]=r,e[7]=n,e[8]=a):a=e[8],a}function ug(t){const e=K.c(2),{virtualMcp:s}=t;if(!!!(s.metadata?.githubRepo??null)?.connectionId)return null;let n;return e[0]!==s.id?(n=o.jsx(dr.Right,{children:o.jsx(hg,{virtualMcpId:s.id})}),e[0]=s.id,e[1]=n):n=e[1],n}const Qt=P.createContext(null);function xn(){return P.use(Qt)}function Ho(t){const e=K.c(7),{children:s}=t,{taskId:i}=lt();let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=o.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"Something went wrong loading the chat. Try refreshing."}),e[0]=r):r=e[0];let n;e[1]===Symbol.for("react.memo_cache_sentinel")?(n=o.jsx(Ee.Skeleton,{}),e[1]=n):n=e[1];let a;e[2]!==s?(a=s??o.jsx(ja,{}),e[2]=s,e[3]=a):a=e[3];let l;return e[4]!==a||e[5]!==i?(l=o.jsx($t,{fallback:r,children:o.jsx(P.Suspense,{fallback:n,children:o.jsx(Ee.ActiveTaskProvider,{taskId:i,children:a})})}),e[4]=a,e[5]=i,e[6]=l):l=e[6],l}function Wo(t){const e=K.c(3),{onNewTaskRef:s,createNewTask:i}=t;let r;return e[0]!==i||e[1]!==s?(r=()=>(s.current=i,()=>{s.current=null}),e[0]=i,e[1]=s,e[2]=r):r=e[2],P.useLayoutEffect(r),null}function fg(t){const e=K.c(3),{onOpenSidebar:s}=t;let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=o.jsx(Yl,{size:20}),e[0]=i):i=e[0];let r;return e[1]!==s?(r=o.jsx("div",{className:"shrink-0 flex items-center justify-between px-3 h-12 bg-background border-b border-border",children:o.jsx("button",{type:"button",onClick:s,className:"flex size-8 items-center justify-center rounded-md text-foreground/60 hover:bg-accent hover:text-foreground transition-colors","aria-label":"Open menu",children:i})}),e[1]=s,e[2]=r):r=e[2],r}function Uo(t){const e=K.c(16),{virtualMcpId:s,hasActiveGithubRepo:i,vmMap:r,children:n}=t,{org:a}=ve(),{currentBranch:l}=lt(),{data:h}=wi.useSession(),c=h?.user?.id;let u;e[0]!==a.id||e[1]!==a.slug?(u={connectionId:Bt,orgId:a.id,orgSlug:a.slug},e[0]=a.id,e[1]=a.slug,e[2]=u):u=e[2];const d=Ue(u),{mutate:m}=on(d);let _;e[3]===Symbol.for("react.memo_cache_sentinel")?(_=new Set,e[3]=_):_=e[3];const f=P.useRef(_);let p,g;e[4]!==l||e[5]!==i||e[6]!==m||e[7]!==c||e[8]!==s||e[9]!==r?(p=()=>{if(i&&c&&l){if(r?.[c]?.[l]){f.current.add(l);return}f.current.has(l)||(f.current.add(l),m({virtualMcpId:s,branch:l},{onError:mg}))}},g=[i,c,l,r,s,m],e[4]=l,e[5]=i,e[6]=m,e[7]=c,e[8]=s,e[9]=r,e[10]=p,e[11]=g):(p=e[10],g=e[11]),P.useEffect(p,g);const v=l??null;let b;return e[12]!==n||e[13]!==v||e[14]!==s?(b=o.jsx(Ou,{virtualMcpId:s,branch:v,children:n}),e[12]=n,e[13]=v,e[14]=s,e[15]=b):b=e[15],b}function mg(t){console.error("[auto-start-vm] failed:",t)}function _g(){const t=K.c(96),e=la(),s=It(),{org:i}=ve(),r=Rc()?.tasksOpen??!1;Fc(i.slug);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={strict:!1},t[0]=n):n=t[0];const a=zl(n),l=a.org??"";let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h={strict:!1},t[1]=h):h=t[1];const c=Zr(h);let u;t[2]!==i.id||t[3]!==c.virtualmcpid?(u=c.virtualmcpid??Jo(i.id).id,t[2]=i.id,t[3]=c.virtualmcpid,t[4]=u):u=t[4];const d=u,m=jh(a.taskId??"",d),_=wt(d),f=_?.metadata?.ui?.layout??null;let p;t[5]!==f?(p=f?{defaultMainView:f.defaultMainView??null,chatDefaultOpen:f.chatDefaultOpen??null}:null,t[5]=f,t[6]=p):p=t[6];const g=p;let v;t[7]!==_?(v=_&&Vt(_),t[7]=_,t[8]=v):v=t[8];const b=!!v;let S;t[9]!==l||t[10]!==d?(S={virtualMcpId:d,orgSlug:l,isAgentRoute:!0},t[9]=l,t[10]=d,t[11]=S):S=t[11];const x=Dc(g,S),{setOpenMobile:y,openMobile:k}=Pc(),w=y,N=P.useRef(null);let j,M;t[12]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const U=q=>{Ic(q)&&q.shiftKey&&q.code==="KeyS"&&!q.repeat&&(q.preventDefault(),N.current?.())};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},M=[],t[12]=j,t[13]=M):(j=t[12],M=t[13]),P.useEffect(j,M);const R=d;let D;t[14]!==_||t[15]!==d?(D={virtualMcpId:d,entity:_},t[14]=_,t[15]=d,t[16]=D):D=t[16];const C=D;if(m.status==="creating"||m.status==="loading"){let U;t[17]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex h-full items-center justify-center bg-background card-shadow rounded-[0.75rem] text-sm text-muted-foreground",children:[o.jsx(Be,{className:"size-4 animate-spin mr-2"}),"Creating task…"]})}),t[17]=U):U=t[17];let q;return t[18]!==C?(q=o.jsx(Qt,{value:C,children:U}),t[18]=C,t[19]=q):q=t[19],q}if(m.status==="error"){let U;t[20]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx("div",{className:"font-medium",children:"Task unavailable"}),t[20]=U):U=t[20];let q;t[21]!==m.error.message?(q=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsxs("div",{className:"flex flex-col h-full items-center justify-center gap-2 bg-background card-shadow rounded-[0.75rem] p-8 text-sm",children:[U,o.jsx("div",{className:"text-muted-foreground",children:m.error.message})]})}),t[21]=m.error.message,t[22]=q):q=t[22];let I;return t[23]!==C||t[24]!==q?(I=o.jsx(Qt,{value:C,children:q}),t[23]=C,t[24]=q,t[25]=I):I=t[25],I}if(!_){let U;t[26]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Is,{size:48,className:"text-muted-foreground"}),t[26]=U):U=t[26];const q=`The agent "${d}" does not exist in this organization.`;let I;t[27]!==s||t[28]!==l?(I=o.jsx(se,{variant:"outline",onClick:()=>s({to:"/$org",params:{org:l}}),children:"Go to organization home"}),t[27]=s,t[28]=l,t[29]=I):I=t[29];let X;t[30]!==q||t[31]!==I?(X=o.jsx("div",{className:"flex-1 min-h-0 pr-1.5 pb-1.5 overflow-hidden",children:o.jsx("div",{className:"flex flex-col h-full bg-background overflow-hidden card-shadow rounded-[0.75rem]",children:o.jsx(Bs,{image:U,title:"Agent not found",description:q,actions:I})})}),t[30]=q,t[31]=I,t[32]=X):X=t[32];let Y;return t[33]!==C||t[34]!==X?(Y=o.jsx(Qt,{value:C,children:X}),t[33]=C,t[34]=X,t[35]=Y):Y=t[35],Y}if(e){let U;t[36]===Symbol.for("react.memo_cache_sentinel")?(U=o.jsx(Lc,{className:"sr-only",children:"Navigation"}),t[36]=U):U=t[36];let q;t[37]!==w?(q=o.jsx("div",{className:"w-14 shrink-0 bg-sidebar flex flex-col items-center border-r border-border overflow-y-auto group/sidebar","data-state":"collapsed",children:o.jsx(Mc,{onClose:()=>w(!1)})}),t[37]=w,t[38]=q):q=t[38];let I;t[39]===Symbol.for("react.memo_cache_sentinel")?(I=o.jsx("div",{className:"flex-1 min-w-0 overflow-hidden",children:o.jsx(Ac,{})}),t[39]=I):I=t[39];let X;t[40]!==q?(X=o.jsxs(Oc,{side:"left",hideCloseButton:!0,className:"w-[calc(100vw-3rem)] sm:max-w-md! p-0",children:[U,o.jsxs("div",{className:"flex h-full",children:[q,I]})]}),t[40]=q,t[41]=X):X=t[41];let Y;t[42]!==k||t[43]!==w||t[44]!==X?(Y=o.jsx(zc,{open:k,onOpenChange:w,children:X}),t[42]=k,t[43]=w,t[44]=X,t[45]=Y):Y=t[45];const te=Y,ce=_?.metadata?.vmMap;let ne;t[46]!==x.createNewTask?(ne=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[46]=x.createNewTask,t[47]=ne):ne=t[47];let J;t[48]!==w?(J=o.jsx(fg,{onOpenSidebar:()=>w(!0)}),t[48]=w,t[49]=J):J=t[49];let de;t[50]===Symbol.for("react.memo_cache_sentinel")?(de=o.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:o.jsx(Ho,{})}),t[50]=de):de=t[50];let ue;t[51]!==b||t[52]!==te||t[53]!==ce||t[54]!==ne||t[55]!==J||t[56]!==d?(ue=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:ce,children:[ne,J,de,te]}),t[51]=b,t[52]=te,t[53]=ce,t[54]=ne,t[55]=J,t[56]=d,t[57]=ue):ue=t[57];let he;t[58]!==R||t[59]!==ue?(he=o.jsx("div",{className:"flex flex-col flex-1 bg-background min-h-0",children:o.jsx(Ee.Provider,{virtualMcpId:R,children:ue},R)}),t[58]=R,t[59]=ue,t[60]=he):he=t[60];let pe;return t[61]!==C||t[62]!==he?(pe=o.jsx(Qt,{value:C,children:he}),t[61]=C,t[62]=he,t[63]=pe):pe=t[63],pe}const T=r?void 0:x.createNewTask;let E;t[64]!==x.chatOpen||t[65]!==x.toggleChat||t[66]!==T?(E=o.jsx(dr.Toggles,{children:o.jsx(Vp,{chatOpen:x.chatOpen,toggleChat:x.toggleChat,onNewTask:T})}),t[64]=x.chatOpen,t[65]=x.toggleChat,t[66]=T,t[67]=E):E=t[67];let A;t[68]!==x.taskId||t[69]!==d?(A=o.jsx(dr.Tabs,{children:o.jsx(Zp,{virtualMcpId:d,taskId:x.taskId})}),t[68]=x.taskId,t[69]=d,t[70]=A):A=t[70];const O=_?.metadata?.vmMap;let L;t[71]!==_?(L=o.jsx(ug,{virtualMcp:_}),t[71]=_,t[72]=L):L=t[72];let B;t[73]!==x.createNewTask?(B=o.jsx(Wo,{onNewTaskRef:N,createNewTask:x.createNewTask}),t[73]=x.createNewTask,t[74]=B):B=t[74];let F;t[75]===Symbol.for("react.memo_cache_sentinel")?(F=o.jsx(Ho,{}),t[75]=F):F=t[75];let z;t[76]!==x.chatOpen||t[77]!==x.mainOpen||t[78]!==x.taskId||t[79]!==d?(z=o.jsx(Up,{virtualMcpId:d,taskId:x.taskId,chatOpen:x.chatOpen,mainOpen:x.mainOpen,chatContent:F}),t[76]=x.chatOpen,t[77]=x.mainOpen,t[78]=x.taskId,t[79]=d,t[80]=z):z=t[80];let $;t[81]!==b||t[82]!==O||t[83]!==L||t[84]!==B||t[85]!==z||t[86]!==d?($=o.jsxs(Uo,{virtualMcpId:d,hasActiveGithubRepo:b,vmMap:O,children:[L,B,z]}),t[81]=b,t[82]=O,t[83]=L,t[84]=B,t[85]=z,t[86]=d,t[87]=$):$=t[87];let V;t[88]!==R||t[89]!==A||t[90]!==$?(V=o.jsxs(Ee.Provider,{virtualMcpId:R,children:[A,$]},R),t[88]=R,t[89]=A,t[90]=$,t[91]=V):V=t[91];let W;return t[92]!==C||t[93]!==E||t[94]!==V?(W=o.jsx("div",{className:"flex-1 min-w-0 flex flex-col",children:o.jsxs(Qt,{value:C,children:[E,V]})}),t[92]=C,t[93]=E,t[94]=V,t[95]=W):W=t[95],W}function S1(){const t=K.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=o.jsx(P.Suspense,{fallback:o.jsx("div",{className:"flex-1 flex items-center justify-center",children:o.jsx(Be,{size:20,className:"animate-spin text-muted-foreground"})}),children:o.jsx(_g,{})}),t[0]=e):e=t[0],e}export{S1 as default,xn as useInsetContext};
|