@decocms/mesh 2.74.0 → 2.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-C_hR5usO.js → AlertCircle-TbirTaeA.js} +1 -1
- package/dist/client/assets/{ArrowUp-DnJUZ1OS.js → ArrowUp-DVhz9MPT.js} +1 -1
- package/dist/client/assets/{Calendar-Dnf0_EY9.js → Calendar-BhleOqT-.js} +1 -1
- package/dist/client/assets/{Check-Sa4xK5Hg.js → Check-BIlnRzi6.js} +1 -1
- package/dist/client/assets/{CheckCircle-DRhauZbp.js → CheckCircle-CSYoAEm3.js} +1 -1
- package/dist/client/assets/{CheckDone01-I6GfoGdi.js → CheckDone01-gZo2F6uL.js} +1 -1
- package/dist/client/assets/{ChevronDown-DmXLJeAy.js → ChevronDown-jAfIG9nZ.js} +1 -1
- package/dist/client/assets/{ChevronRight-By4KEpZh.js → ChevronRight-CNYkXy1u.js} +1 -1
- package/dist/client/assets/{Code01-h_k8K-1e.js → Code01-DeVT5m93.js} +1 -1
- package/dist/client/assets/{Copy01-jvqvZrKj.js → Copy01-BJPi2nBZ.js} +1 -1
- package/dist/client/assets/{DotsHorizontal-CQJNqVgu.js → DotsHorizontal-CZIcl0Ye.js} +1 -1
- package/dist/client/assets/{DotsVertical-gLXmVMYI.js → DotsVertical-CPJps54j.js} +1 -1
- package/dist/client/assets/{Download01-BKmVPJWY.js → Download01-BVA62GFI.js} +1 -1
- package/dist/client/assets/{Edit01-BT8zEtQL.js → Edit01-CLT1AKyh.js} +1 -1
- package/dist/client/assets/{File02-BNE7fmK0.js → File02-M7e4eeKQ.js} +1 -1
- package/dist/client/assets/{File06-WU23pV9H.js → File06-BUOJeS0C.js} +1 -1
- package/dist/client/assets/{FilterLines-DJEB3mgx.js → FilterLines-CDkZPaiO.js} +1 -1
- package/dist/client/assets/{Globe02-Dp5eUbS2.js → Globe02-CNtZ4Mz7.js} +1 -1
- package/dist/client/assets/{Grid01-CSAsqBFD.js → Grid01-BhCIE3UE.js} +1 -1
- package/dist/client/assets/{Home02-BUr926Eo.js → Home02-Zp_wVezk.js} +1 -1
- package/dist/client/assets/{Image01-BnbXZOf7.js → Image01-Bmljn0R6.js} +1 -1
- package/dist/client/assets/{Inbox01-XFeiQPbg.js → Inbox01-Bz-1SNbb.js} +1 -1
- package/dist/client/assets/{InfoCircle-5xWfOa8P.js → InfoCircle-DutDNmXq.js} +1 -1
- package/dist/client/assets/{LinkExternal01-BJLPX8tt.js → LinkExternal01-npl2D9IH.js} +1 -1
- package/dist/client/assets/{List-kXpaJIIp.js → List-B95opsr5.js} +1 -1
- package/dist/client/assets/{Loading01-D8zw0cyg.js → Loading01-CudhqwtJ.js} +1 -1
- package/dist/client/assets/{Lock01-DCDiY4HG.js → Lock01-C3j5poil.js} +1 -1
- package/dist/client/assets/{Pin01-DWsvacVo.js → Pin01-DpTwe7GO.js} +1 -1
- package/dist/client/assets/{Play-Yhg_pcqU.js → Play-BxFFyAEF.js} +1 -1
- package/dist/client/assets/{Plus-BBD2SckJ.js → Plus-BVPnBK8D.js} +1 -1
- package/dist/client/assets/RefreshCcw01-Dzlid7sh.js +1 -0
- package/dist/client/assets/{SearchMd-CGuwiAQe.js → SearchMd-yRVgOeax.js} +1 -1
- package/dist/client/assets/{Settings01-D7-sGWon.js → Settings01-DGIrqZBI.js} +1 -1
- package/dist/client/assets/Settings02-CW4MK9LY.js +1 -0
- package/dist/client/assets/{Share07-C8iek9k4.js → Share07-BKNvns4q.js} +1 -1
- package/dist/client/assets/{Terminal-CyioLjuI.js → Terminal-DV_yPRWa.js} +1 -1
- package/dist/client/assets/{Tool01-DF-lT9RC.js → Tool01-C0EKLKq5.js} +1 -1
- package/dist/client/assets/{Trash01-CLqhrRia.js → Trash01-py7ft8Od.js} +1 -1
- package/dist/client/assets/{Upload01-DrtXkSgF.js → Upload01-CCoXEdI4.js} +1 -1
- package/dist/client/assets/{Users03-oV4Gx6fu.js → Users03-D2F2bran.js} +1 -1
- package/dist/client/assets/{X-CuhyLwhM.js → X-CixxHrye.js} +1 -1
- package/dist/client/assets/{XClose-BFt2trBc.js → XClose-S1Me7eeg.js} +1 -1
- package/dist/client/assets/{agent-connections-preview-D4bn0NTx.js → agent-connections-preview-DZgc-mir.js} +1 -1
- package/dist/client/assets/agent-detail-DPLDxB9n.js +1 -0
- package/dist/client/assets/{agents-BMyluA59.js → agents-CynO2-IY.js} +1 -1
- package/dist/client/assets/{alert-dialog-BxcV0D_1.js → alert-dialog-B1nWkQHx.js} +1 -1
- package/dist/client/assets/{auth-catchall-DLJkIPQ0.js → auth-catchall-CJ49F7Eq.js} +1 -1
- package/dist/client/assets/{avatar-D3z5_V3I.js → avatar-BbH9O0kN.js} +1 -1
- package/dist/client/assets/{badge-BklHLRcK.js → badge-C898LHvV.js} +1 -1
- package/dist/client/assets/{binder-ak1AkjZY.js → binder-xcUkLvPC.js} +1 -1
- package/dist/client/assets/{breadcrumb-B_Yxwj4p.js → breadcrumb-t_Ccp20G.js} +1 -1
- package/dist/client/assets/{button-CcO5M7F7.js → button-C1iesapY.js} +1 -1
- package/dist/client/assets/{card-BNt4WjQv.js → card-DKzkS6ji.js} +1 -1
- package/dist/client/assets/{checkbox-CirsSPdM.js → checkbox-B82l7mBw.js} +1 -1
- package/dist/client/assets/{circle-alert-BcHtOytY.js → circle-alert-_5s_KbQk.js} +1 -1
- package/dist/client/assets/{collection-detail-iX-6m_0X.js → collection-detail-B-hnHfhu.js} +3 -3
- package/dist/client/assets/{collection-search-Cyt8_oQV.js → collection-search-D3a5_1zR.js} +1 -1
- package/dist/client/assets/{collection-tab-Cbay3Q2-.js → collection-tab-Y58MHDMK.js} +1 -1
- package/dist/client/assets/{collection-table-wrapper-CFNweZN1.js → collection-table-wrapper-B6XWzQ-4.js} +1 -1
- package/dist/client/assets/{collection-tabs-Dh2bhvAY.js → collection-tabs-BPHWDFL4.js} +1 -1
- package/dist/client/assets/{command-8Q_FGz0v.js → command-DepzRVHX.js} +1 -1
- package/dist/client/assets/{connect-1mhMrmD4.js → connect-OP0J5SPJ.js} +1 -1
- package/dist/client/assets/{connection-card-BGd7kcn-.js → connection-card-DkCny6Ez.js} +1 -1
- package/dist/client/assets/connection-detail-CdLleACg.js +1 -0
- package/dist/client/assets/{connections-DmGFiu1f.js → connections-BZUVvBGs.js} +1 -1
- package/dist/client/assets/{constants-DuSOM18S.js → constants-BEco_-y7.js} +1 -1
- package/dist/client/assets/constants-gwxE8_b0.js +1 -0
- package/dist/client/assets/{create-organization-dialog-j_P7xuhv.js → create-organization-dialog-58b_GUv7.js} +1 -1
- package/dist/client/assets/{create-project-dialog-C-mSn_Ux.js → create-project-dialog-C5GAJOOY.js} +1 -1
- package/dist/client/assets/{dialog-B_iTVR3h.js → dialog-CpkgwzHW.js} +1 -1
- package/dist/client/assets/{dropdown-menu-BTPpCOPE.js → dropdown-menu-D6YYwFq7.js} +1 -1
- package/dist/client/assets/dynamic-plugin-layout-BMgNBEQS.js +1 -0
- package/dist/client/assets/{empty-state-Ct1fZFlf.js → empty-state-BQPtoYZe.js} +1 -1
- package/dist/client/assets/{empty-state--JD6ZxUc.js → empty-state-CH3e4Xzf.js} +1 -1
- package/dist/client/assets/{env-vars-editor-B4EebJEK.js → env-vars-editor-Vpi1vdW2.js} +1 -1
- package/dist/client/assets/{error-boundary-DlgelpJG.js → error-boundary-BGFWaL1J.js} +1 -1
- package/dist/client/assets/{extract-connection-data-BM37afPK.js → extract-connection-data-CDmQ7rLP.js} +1 -1
- package/dist/client/assets/file-browser-DUDclrRh.js +2 -0
- package/dist/client/assets/{form-CSsv2IBt.js → form-NA0-x5iN.js} +1 -1
- package/dist/client/assets/grid-view-DbtTgaoS.js +1 -0
- package/dist/client/assets/{home-D16zlSya.js → home-DtmWz3MA.js} +1 -1
- package/dist/client/assets/{index-fr6MaGoE.js → index-43_iGxlN.js} +1 -1
- package/dist/client/assets/{index--g69ISoA.css → index-BEdPWc-P.css} +1 -1
- package/dist/client/assets/{index-DZ7G-bvr.js → index-ByJoFAq_.js} +1 -1
- package/dist/client/assets/{index-CZtqakWK.js → index-C9Dn0opW.js} +1 -1
- package/dist/client/assets/{index-CHcJPAjT.js → index-DlY6KFzI.js} +1 -1
- package/dist/client/assets/{index-DJCm-wAr.js → index-Dv4saiJc.js} +1 -1
- package/dist/client/assets/{index-a2nqbblp.js → index-GRocoNYa.js} +1 -1
- package/dist/client/assets/{index-Bn2rDd42.js → index-HxeE9C0A.js} +29 -29
- package/dist/client/assets/{index-Bo7hWTur.js → index-Kq8ytqk9.js} +1 -1
- package/dist/client/assets/{index-BHu7Lc_d.js → index-wUnd_o-U.js} +1 -1
- package/dist/client/assets/{infiniteQueryObserver-VnhrjjoH.js → infiniteQueryObserver-CSOdbqFL.js} +1 -1
- package/dist/client/assets/{input-DBvMwxwE.js → input-DBGu1Yhi.js} +1 -1
- package/dist/client/assets/{integration-icon-C8seGsuO.js → integration-icon-CmJggqPx.js} +1 -1
- package/dist/client/assets/{label-BjQxQJkg.js → label-11d5Pe_w.js} +1 -1
- package/dist/client/assets/{layout-ZTsfxACA.js → layout-BQSZy0Ao.js} +1 -1
- package/dist/client/assets/{localstorage-keys-BhunmwZg.js → localstorage-keys-BxVB7BFB.js} +1 -1
- package/dist/client/assets/{login-H0BwFxqL.js → login-CMpn2tdR.js} +1 -1
- package/dist/client/assets/{mcp-oauth-ZUujauBG.js → mcp-oauth-JrpxCLx4.js} +1 -1
- package/dist/client/assets/{mcp-server-card-KgRAONYw.js → mcp-server-card-8DET7nVd.js} +1 -1
- package/dist/client/assets/{mcp-server-detail-Ce9SGjoZ.js → mcp-server-detail-CMrzxsYv.js} +2 -2
- package/dist/client/assets/{members-C925BdC6.js → members-CUWgr5ku.js} +1 -1
- package/dist/client/assets/{monaco-editor-D7Ghoc8y.js → monaco-editor-DvJ6AQm-.js} +1 -1
- package/dist/client/assets/{monitoring-DI8QAuDx.js → monitoring-Db1K0NxK.js} +1 -1
- package/dist/client/assets/{oauth-callback-DqKFxIqr.js → oauth-callback-Bh-LWKIz.js} +1 -1
- package/dist/client/assets/page-79TZOOqo.js +1 -0
- package/dist/client/assets/{page-DCfXF14g.js → page-Bx3m0Nlj.js} +1 -1
- package/dist/client/assets/{plugin-empty-state-BYB8Yhjv.js → plugin-empty-state-34Wj3C93.js} +1 -1
- package/dist/client/assets/{plugin-header-CLRCQ1W3.js → plugin-header-KrvIXXbF.js} +1 -1
- package/dist/client/assets/{popover-BkKSdvGf.js → popover-BbAo_V3q.js} +1 -1
- package/dist/client/assets/{project-layout-DzX_Lv0I.js → project-layout-QE2hcM6x.js} +1 -1
- package/dist/client/assets/{project-settings-lapjGGi3.js → project-settings-2bxHgR8P.js} +1 -1
- package/dist/client/assets/{projects-list-DZgOrcLS.js → projects-list-CSrfAb2G.js} +1 -1
- package/dist/client/assets/{registry-utils-BsLp7zXK.js → registry-utils-CLfG2KJO.js} +1 -1
- package/dist/client/assets/{resizable-CdUSPFqv.js → resizable-D5fgPQWp.js} +1 -1
- package/dist/client/assets/{select-J2aavKNi.js → select-CnIfeZ9k.js} +1 -1
- package/dist/client/assets/shell-layout-DIuzNmm5.js +12 -0
- package/dist/client/assets/{spinner-Bn-tqgsf.js → spinner-BbdUl9_5.js} +1 -1
- package/dist/client/assets/{store-invite-C8stGp_k.js → store-invite-eQ6O_LcC.js} +1 -1
- package/dist/client/assets/{switch-CG0LWjwI.js → switch-7wa9WQCt.js} +1 -1
- package/dist/client/assets/{table-BNxQWMxG.js → table-F_F9uG31.js} +1 -1
- package/dist/client/assets/{tasks-C_RAoHGr.js → tasks-Bo849zPQ.js} +1 -1
- package/dist/client/assets/{textarea-CKlKOzV4.js → textarea-CX1AXmSo.js} +1 -1
- package/dist/client/assets/{tools-list-D0G5KWHg.js → tools-list-CeBZ5K9_.js} +1 -1
- package/dist/client/assets/topbar-portal-DTnSGvrH.js +1 -0
- package/dist/client/assets/{typewriter-title-BqfnndCW.js → typewriter-title-CydscG0b.js} +1 -1
- package/dist/client/assets/{use-binding-Dgjl_Htk.js → use-binding-BIvDtNoa.js} +1 -1
- package/dist/client/assets/{use-connection-CVk8Bzpz.js → use-connection-DWpxH8iy.js} +1 -1
- package/dist/client/assets/{use-create-virtual-mcp-BpXLuk-p.js → use-create-virtual-mcp-CMegJpH_.js} +1 -1
- package/dist/client/assets/{use-deco-chat-open-CfZI9mqc.js → use-deco-chat-open-DeBMXnMx.js} +7 -7
- package/dist/client/assets/{use-install-from-registry-5UUqPBO7.js → use-install-from-registry-CNdLBCwL.js} +1 -1
- package/dist/client/assets/{use-list-state-D_1V56-b.js → use-list-state-CqdwrHCA.js} +1 -1
- package/dist/client/assets/{use-llm-Ca3pgrIB.js → use-llm-B2BVGott.js} +1 -1
- package/dist/client/assets/{use-mcp-prompts-Cn7tm6ug.js → use-mcp-prompts-CUow6VVK.js} +1 -1
- package/dist/client/assets/{use-mcp-tools-Ddi2i1Nb.js → use-mcp-tools-DO_-llbI.js} +1 -1
- package/dist/client/assets/{use-mobile-p03CcGW0.js → use-mobile-CqANtQ4e.js} +1 -1
- package/dist/client/assets/{use-organization-settings-DHZKDAPt.js → use-organization-settings-ANLw4ex1.js} +1 -1
- package/dist/client/assets/{use-project-D-mK4K9b.js → use-project-C1G7xlcy.js} +1 -1
- package/dist/client/assets/{use-virtual-mcp-C83o4Rih.js → use-virtual-mcp-DaI2d98r.js} +1 -1
- package/dist/client/assets/useInfiniteQuery-CL3o6Gdm.js +1 -0
- package/dist/client/assets/{useMutation-CnTeRHmv.js → useMutation-M3-wug2Q.js} +1 -1
- package/dist/client/assets/useQuery-jRtVXI31.js +1 -0
- package/dist/client/assets/utils-D1Qd9-I_.js +1 -0
- package/dist/client/assets/{view-mode-toggle-CJkT6m07.js → view-mode-toggle-JVmuLwXe.js} +1 -1
- package/dist/client/assets/workflow-BKKAfuJP.js +1 -0
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/agent-detail-D8YR1Y7H.js +0 -1
- package/dist/client/assets/connection-detail-dEdcHJ4u.js +0 -1
- package/dist/client/assets/constants-QC26G_cT.js +0 -1
- package/dist/client/assets/dynamic-plugin-layout-BsqDni3U.js +0 -1
- package/dist/client/assets/file-browser-DQeqPq9E.js +0 -2
- package/dist/client/assets/grid-view-DBKftgaD.js +0 -1
- package/dist/client/assets/page-B2cjdb1f.js +0 -1
- package/dist/client/assets/shell-layout-DOBmQ9ah.js +0 -12
- package/dist/client/assets/useInfiniteQuery-DDUEUpOZ.js +0 -1
- package/dist/client/assets/useQuery-Ct96KcZp.js +0 -1
- package/dist/client/assets/utils-Ckc2UwOp.js +0 -1
- package/dist/client/assets/workflow-2rDY9uo2.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as v,j as i}from"./index-
|
|
1
|
+
import{c as v,j as i}from"./index-HxeE9C0A.js";import{i as w}from"./Loading01-CudhqwtJ.js";import{i as C}from"./SearchMd-yRVgOeax.js";import{I as k}from"./input-DBGu1Yhi.js";import{c as b}from"./utils-D1Qd9-I_.js";function R(j){const e=v.c(21),{value:m,onChange:d,placeholder:g,onKeyDown:f,className:p,isSearching:u,disabled:n}=j,x=g===void 0?"Search...":g;let t;e[0]!==p?(t=b("shrink-0 w-full border-b border-border h-12",p),e[0]=p,e[1]=t):t=e[1];const h=n?"cursor-not-allowed opacity-50":"cursor-text";let s;e[2]!==h?(s=b("flex items-center gap-2.5 h-12 px-4",h),e[2]=h,e[3]=s):s=e[3];let r;e[4]!==u?(r=u?i.jsx(w,{size:16,className:"animate-spin text-muted-foreground shrink-0"}):i.jsx(C,{size:16,className:"text-muted-foreground shrink-0"}),e[4]=u,e[5]=r):r=e[5];let o;e[6]!==d?(o=N=>d(N.target.value),e[6]=d,e[7]=o):o=e[7];let l;e[8]!==n||e[9]!==f||e[10]!==x||e[11]!==o||e[12]!==m?(l=i.jsx(k,{value:m,onChange:o,onKeyDown:f,placeholder:x,disabled:n,className:"flex-1 border-0 shadow-none focus-visible:ring-0 px-0 h-full text-sm placeholder:text-muted-foreground/50 bg-transparent"}),e[8]=n,e[9]=f,e[10]=x,e[11]=o,e[12]=m,e[13]=l):l=e[13];let a;e[14]!==s||e[15]!==r||e[16]!==l?(a=i.jsxs("label",{className:s,children:[r,l]}),e[14]=s,e[15]=r,e[16]=l,e[17]=a):a=e[17];let c;return e[18]!==t||e[19]!==a?(c=i.jsx("div",{className:t,children:a}),e[18]=t,e[19]=a,e[20]=c):c=e[20],c}export{R as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as Ae,j as t,m as Ye,g as Ze,u as et,r as tt,O as $e,t as st}from"./index-Bn2rDd42.js";import{g as Oe}from"./generate-id-Dyweu44Y.js";import{a as ot,C as Fe}from"./collection-table-wrapper-CFNweZN1.js";import{C as it}from"./collection-search-Cyt8_oQV.js";import{C as nt}from"./card-BNt4WjQv.js";import{I as ke}from"./integration-icon-C8seGsuO.js";import{D as Ke,a as Ue,b as Le,c as k}from"./dropdown-menu-BTPpCOPE.js";import{B as Ie}from"./button-CcO5M7F7.js";import{a as Be}from"./Copy01-jvqvZrKj.js";import{i as Re}from"./DotsVertical-gLXmVMYI.js";import{i as Ve}from"./Edit01-BT8zEtQL.js";import{s as Ge,U as rt,u as lt}from"./use-list-state-D_1V56-b.js";import{s as Je}from"./Trash01-CLqhrRia.js";import{E as ze}from"./empty-state-Ct1fZFlf.js";import{n as Ee}from"./Inbox01-XFeiQPbg.js";import{E as at}from"./empty-state--JD6ZxUc.js";import{B as ct}from"./constants-QC26G_cT.js";import{A as dt,g as pt,c as mt,b as ut,d as ft,e as ht,a as xt,f as gt}from"./alert-dialog-BxcV0D_1.js";import{u as jt,e as Ct}from"./use-connection-CVk8Bzpz.js";import{u as vt}from"./constants-DuSOM18S.js";import{s as bt}from"./Plus-BBD2SckJ.js";import{V as yt}from"./layout-ZTsfxACA.js";function Nt(n,e){const s=n.properties||{};for(const i in s){const l=s[i];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&i in e&&e[i])return e[i]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const i of r)if(e&&typeof e=="object"&&i in e&&typeof e[i]=="string")return e[i]}function wt(n){const e=Ae.c(25),{item:s,schema:r,actions:i}=n;let l;e[0]!==s||e[1]!==r?(l=Nt(r,s),e[0]=s,e[1]=r,e[2]=l):l=e[2];const u=l,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let j;e[3]!==i?(j=i&&Object.keys(i).length>0,e[3]=i,e[4]=j):j=e[4];const o=j;let m;e[5]!==u||e[6]!==s.title?(m=t.jsx(ke,{icon:u,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=u,e[6]=s.title,e[7]=m):m=e[7];let f;e[8]!==s.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=f):f=e[9];const d=p||"No description";let c;e[10]!==d?(c=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=c):c=e[11];let C;e[12]!==f||e[13]!==c?(C=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,c]}),e[12]=f,e[13]=c,e[14]=C):C=e[14];let y;e[15]!==m||e[16]!==C?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,C]}),e[15]=m,e[16]=C,e[17]=y):y=e[17];let a;e[18]!==i||e[19]!==o||e[20]!==s?(a=o&&t.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:At,onMouseDown:_t,children:t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Dt,children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:St,children:[i.open&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.open?.(s)},children:[t.jsx(Ge,{size:16}),"Open"]}),i.edit&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.edit?.(s)},children:[t.jsx(Ve,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.duplicate?.(s)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(k,{variant:"destructive",onClick:h=>{h.stopPropagation(),i.delete?.(s)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]})}),e[18]=i,e[19]=o,e[20]=s,e[21]=a):a=e[21];let S;return e[22]!==y||e[23]!==a?(S=t.jsxs(nt,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[y,a]}),e[22]=y,e[23]=a,e[24]=S):S=e[24],S}function St(n){return n.stopPropagation()}function Dt(n){return n.stopPropagation()}function _t(n){return n.stopPropagation()}function At(n){return n.stopPropagation()}const It=["icon","avatar","logo"],Me=["created_at","created_by","id"];function Pt(n){return Object.keys(n).find(e=>It.includes(e.toLowerCase()))}function We(n,e){return Object.keys(n.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Tt(n){const e=Ae.c(32),{data:s,schema:r,viewMode:i,onViewModeChange:l,search:u,sortKey:p,sortDirection:j,onSort:o,actions:m,onItemClick:f,headerActions:d,emptyState:c,readOnly:C,columns:y,hideToolbar:a,sortableFields:S}=n,h=l===void 0?Mt:l,x=j===void 0?"asc":j,P=o===void 0?Et:o;let v;e[0]!==m?(v=m===void 0?{}:m,e[0]=m,e[1]=v):v=e[1];const D=v,_=f===void 0?zt:f,z=d===void 0?null:d,b=c===void 0?null:c,T=C===void 0?!1:C,N=y===void 0?void 0:y,F=a===void 0?!1:a,w=S===void 0?void 0:S;let E;e[2]!==N||e[3]!==r||e[4]!==w?(E=N?N.filter(Ot).filter(M=>!w||w.includes(M.id)).map($t):We(r,w),e[2]=N,e[3]=r,e[4]=w,e[5]=E):E=e[5];const $=E;let A;e[6]!==z||e[7]!==F||e[8]!==P||e[9]!==h||e[10]!==x||e[11]!==p||e[12]!==$||e[13]!==i?(A=!F&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:z}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Fe,{viewMode:i,onViewModeChange:h,sortKey:p,sortDirection:x,onSort:P,sortOptions:$})})]})}),e[6]=z,e[7]=F,e[8]=P,e[9]=h,e[10]=x,e[11]=p,e[12]=$,e[13]=i,e[14]=A):A=e[14];let O;e[15]!==D||e[16]!==N||e[17]!==s||e[18]!==b||e[19]!==_||e[20]!==P||e[21]!==T||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==p||e[26]!==w||e[27]!==i?(O=i==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:s.map(M=>t.jsx("div",{onClick:()=>_?.(M),className:"cursor-pointer h-full",children:t.jsx(wt,{item:M,schema:r,readOnly:T,actions:D})},M.id))})}):t.jsx(ot,{columns:Kt(N,r,w,D),data:s,sortKey:p,sortDirection:x,onSort:P,onRowClick:_,emptyState:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}),e[15]=D,e[16]=N,e[17]=s,e[18]=b,e[19]=_,e[20]=P,e[21]=T,e[22]=r,e[23]=u,e[24]=x,e[25]=p,e[26]=w,e[27]=i,e[28]=O):O=e[28];let I;return e[29]!==A||e[30]!==O?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[A,O]}),e[29]=A,e[30]=O,e[31]=I):I=e[31],I}function $t(n){return{id:n.id,label:typeof n.header=="string"?n.header:n.id}}function Ot(n){return n.sortable!==!1}function zt(){}function Et(){}function Mt(){}function Ft(n){return{id:"actions",header:"",render:e=>t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:s=>s.stopPropagation(),children:[n.open&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.open?.(e)},children:[t.jsx(Ge,{size:16}),"Open"]}),n.edit&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.edit?.(e)},children:[t.jsx(Ve,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.duplicate?.(e)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(k,{variant:"destructive",onClick:s=>{s.stopPropagation(),n.delete?.(e)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function He(n){const e=n.type;return Array.isArray(e)?e.every(s=>He({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function kt(n,e){const s=n.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&He(m)}),i=Pt(s),l=[],u=new Set;i&&r.includes(i)&&(l.push(i),u.add(i));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));const j=r.filter(o=>!u.has(o)&&!Me.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of j)l.push(o),u.add(o);for(const o of Me)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));return l.map(o=>{const m=s[o],f=e?e.includes(o):!["id"].includes(o);return o===i?{id:o,header:"",render:d=>{const c=d[o];return t.jsx(ke,{icon:c,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(c)})},sortable:f,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx(rt,{id:String(c),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx("span",{className:"block truncate max-w-full",children:new Date(c).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(c)})},sortable:f,cellClassName:"max-w-[200px]"}})}function Kt(n,e,s,r){const i=n||kt(e,s);return i.some(p=>p.id==="actions")?i:Object.keys(r).length>0?[...i,Ft(r)]:i}function cs(n){const e=Ae.c(113),{connectionId:s,org:r,activeCollection:i}=n,l=i.name,u=i.schema??ct,p=i.hasCreateTool,j=i.hasUpdateTool,o=i.hasDeleteTool,m=Ye(),{data:f}=Ze.useSession(),d=f?.user?.id||"unknown",{org:c}=et();let C;e[0]!==s||e[1]!==c.id?(C={connectionId:s,orgId:c.id},e[0]=s,e[1]=c.id,e[2]=C):C=e[2];const y=vt(C),a=jt(s,l,y),S=`${s}-${l}`;let h;e[3]!==r||e[4]!==S?(h={namespace:r,resource:S,defaultSortKey:"updated_at"},e[3]=r,e[4]=S,e[5]=h):h=e[5];const{search:x,searchTerm:P,setSearch:v,viewMode:D,setViewMode:_,sortKey:z,sortDirection:b,handleSort:T}=lt(h);let N;e[6]!==P||e[7]!==b||e[8]!==z?(N={searchTerm:P,sortKey:z,sortDirection:b},e[6]=P,e[7]=b,e[8]=z,e[9]=N):N=e[9];const F=Ct(s,l,y,N),w=!p&&!j&&!o;let E;e[10]!==l||e[11]!==s||e[12]!==m||e[13]!==r?(E=g=>{m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:g.id}})},e[10]=l,e[11]=s,e[12]=m,e[13]=r,e[14]=E):E=e[14];const $=E;let A;e[15]!==a.create||e[16]!==d?(A=async g=>{const me=new Date().toISOString();await a.create.mutateAsync({...g,id:Oe("conn"),title:`${g.title} (Copy)`,created_at:me,updated_at:me,created_by:d,updated_by:d})},e[15]=a.create,e[16]=d,e[17]=A):A=e[17];const O=A,[I,M]=tt.useState(null);let oe;e[18]===Symbol.for("react.memo_cache_sentinel")?(oe=g=>{M(g)},e[18]=oe):oe=e[18];const qe=oe;let K;e[19]!==$||e[20]!==j?(K=j&&{edit:$},e[19]=$,e[20]=j,e[21]=K):K=e[21];let U;e[22]!==O||e[23]!==p?(U=p&&{duplicate:O},e[22]=O,e[23]=p,e[24]=U):U=e[24];let L;e[25]!==o?(L=o&&{delete:qe},e[25]=o,e[26]=L):L=e[26];let ie;e[27]!==L||e[28]!==K||e[29]!==U?(ie={...K,...U,...L},e[27]=L,e[28]=K,e[29]=U,e[30]=ie):ie=e[30];const ue=ie;let ne;e[31]!==a.delete||e[32]!==I?(ne=async()=>{I&&(await a.delete.mutateAsync(I.id),M(null))},e[31]=a.delete,e[32]=I,e[33]=ne):ne=e[33];const fe=ne;let re;e[34]!==a.create||e[35]!==l||e[36]!==s||e[37]!==p||e[38]!==m||e[39]!==r||e[40]!==d?(re=async()=>{if(!p){st.error("Create operation is not available for this collection");return}const g=new Date().toISOString(),me={id:Oe("conn"),title:"New Item",description:"A brief description of the item",created_at:g,updated_at:g,created_by:d,updated_by:d};try{const _e=await a.create.mutateAsync(me);m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:_e.id}})}catch(_e){console.error("Failed to create item:",_e)}},e[34]=a.create,e[35]=l,e[36]=s,e[37]=p,e[38]=m,e[39]=r,e[40]=d,e[41]=re):re=e[41];const he=re;let le;e[42]!==u?(le=We(u),e[42]=u,e[43]=le):le=e[43];const xe=le,Pe=(F?.length??0)>0,Qe=p&&Pe,Xe=p&&!Pe&&!x;let ae;e[44]!==a.create||e[45]!==he||e[46]!==p?(ae=p?t.jsxs(Ie,{onClick:he,size:"sm",disabled:a.create.isPending,className:"h-7",children:[t.jsx(bt,{className:"mr-2 h-4 w-4"}),a.create.isPending?"Creating...":"Create"]}):null,e[44]=a.create,e[45]=he,e[46]=p,e[47]=ae):ae=e[47];const Te=ae,ge=z;let B;e[48]!==T||e[49]!==_||e[50]!==b||e[51]!==xe||e[52]!==ge||e[53]!==D?(B=t.jsx(Fe,{viewMode:D,onViewModeChange:_,sortKey:ge,sortDirection:b,onSort:T,sortOptions:xe}),e[48]=T,e[49]=_,e[50]=b,e[51]=xe,e[52]=ge,e[53]=D,e[54]=B):B=e[54];const je=Qe&&Te;let R;e[55]!==B||e[56]!==je?(R=t.jsxs(yt,{children:[B,je]}),e[55]=B,e[56]=je,e[57]=R):R=e[57];const Ce=`Search ${l}...`;let V;e[58]!==v?(V=g=>{g.key==="Escape"&&(v(""),g.target.blur())},e[58]=v,e[59]=V):V=e[59];let G;e[60]!==x||e[61]!==v||e[62]!==Ce||e[63]!==V?(G=t.jsx(it,{value:x,onChange:v,placeholder:Ce,onKeyDown:V}),e[60]=x,e[61]=v,e[62]=Ce,e[63]=V,e[64]=G):G=e[64];let J;e[65]!==F?(J=F??[],e[65]=F,e[66]=J):J=e[66];const ve=z;let W;e[67]!==$?(W=g=>$(g),e[67]=$,e[68]=W):W=e[68];const be="No items found",ye=x?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ne=Xe?Te:void 0;let H;e[69]!==be||e[70]!==ye||e[71]!==Ne?(H=t.jsx(at,{image:null,title:be,description:ye,actions:Ne}),e[69]=be,e[70]=ye,e[71]=Ne,e[72]=H):H=e[72];let q;e[73]!==T||e[74]!==w||e[75]!==ue||e[76]!==u||e[77]!==x||e[78]!==v||e[79]!==_||e[80]!==b||e[81]!==J||e[82]!==ve||e[83]!==W||e[84]!==H||e[85]!==D?(q=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Tt,{hideToolbar:!0,data:J,schema:u,viewMode:D,onViewModeChange:_,search:x,onSearchChange:v,sortKey:ve,sortDirection:b,onSort:T,actions:ue,onItemClick:W,readOnly:w,emptyState:H})}),e[73]=T,e[74]=w,e[75]=ue,e[76]=u,e[77]=x,e[78]=v,e[79]=_,e[80]=b,e[81]=J,e[82]=ve,e[83]=W,e[84]=H,e[85]=D,e[86]=q):q=e[86];let Q;e[87]!==G||e[88]!==q?(Q=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[G,q]}),e[87]=G,e[88]=q,e[89]=Q):Q=e[89];const we=!!I;let ce;e[90]===Symbol.for("react.memo_cache_sentinel")?(ce=g=>{g||M(null)},e[90]=ce):ce=e[90];let de;e[91]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(mt,{children:"Delete item?"}),e[91]=de):de=e[91];const Se=I?.title;let X;e[92]!==Se?(X=t.jsxs(ut,{children:[de,t.jsxs(ft,{children:['Are you sure you want to delete "',Se,'"? This action cannot be undone.']})]}),e[92]=Se,e[93]=X):X=e[93];let Y;e[94]!==a.delete.isPending?(Y=t.jsx(dt,{disabled:a.delete.isPending,children:"Cancel"}),e[94]=a.delete.isPending,e[95]=Y):Y=e[95];const De=a.delete.isPending?"Deleting...":"Delete";let Z;e[96]!==a.delete.isPending||e[97]!==fe||e[98]!==De?(Z=t.jsx(pt,{onClick:fe,disabled:a.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:De}),e[96]=a.delete.isPending,e[97]=fe,e[98]=De,e[99]=Z):Z=e[99];let ee;e[100]!==Y||e[101]!==Z?(ee=t.jsxs(ht,{children:[Y,Z]}),e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==X||e[104]!==ee?(te=t.jsxs(xt,{children:[X,ee]}),e[103]=X,e[104]=ee,e[105]=te):te=e[105];let se;e[106]!==we||e[107]!==te?(se=t.jsx(gt,{open:we,onOpenChange:ce,children:te}),e[106]=we,e[107]=te,e[108]=se):se=e[108];let pe;return e[109]!==R||e[110]!==Q||e[111]!==se?(pe=t.jsxs(t.Fragment,{children:[R,Q,se]}),e[109]=R,e[110]=Q,e[111]=se,e[112]=pe):pe=e[112],pe}export{cs as C};
|
|
1
|
+
import{c as Ae,j as t,m as Ye,g as Ze,u as et,r as tt,O as $e,t as st}from"./index-HxeE9C0A.js";import{g as Oe}from"./generate-id-Dyweu44Y.js";import{a as ot,C as Fe}from"./collection-table-wrapper-B6XWzQ-4.js";import{C as it}from"./collection-search-D3a5_1zR.js";import{C as nt}from"./card-DKzkS6ji.js";import{I as ke}from"./integration-icon-CmJggqPx.js";import{D as Ke,a as Ue,b as Le,c as k}from"./dropdown-menu-D6YYwFq7.js";import{B as Ie}from"./button-C1iesapY.js";import{a as Be}from"./Copy01-BJPi2nBZ.js";import{i as Re}from"./DotsVertical-CPJps54j.js";import{i as Ve}from"./Edit01-CLT1AKyh.js";import{s as Ge,U as rt,u as lt}from"./use-list-state-CqdwrHCA.js";import{s as Je}from"./Trash01-py7ft8Od.js";import{E as ze}from"./empty-state-BQPtoYZe.js";import{n as Ee}from"./Inbox01-Bz-1SNbb.js";import{E as at}from"./empty-state-CH3e4Xzf.js";import{B as ct}from"./constants-gwxE8_b0.js";import{A as dt,g as pt,c as mt,b as ut,d as ft,e as ht,a as xt,f as gt}from"./alert-dialog-B1nWkQHx.js";import{u as jt,e as Ct}from"./use-connection-DWpxH8iy.js";import{u as vt}from"./constants-BEco_-y7.js";import{s as bt}from"./Plus-BVPnBK8D.js";import{V as yt}from"./layout-BQSZy0Ao.js";function Nt(n,e){const s=n.properties||{};for(const i in s){const l=s[i];if(l&&l.type==="string"&&(l.format==="url"||l.format==="uri")&&e&&typeof e=="object"&&i in e&&e[i])return e[i]}const r=["image","img","avatar","icon","logo","thumbnail","cover"];for(const i of r)if(e&&typeof e=="object"&&i in e&&typeof e[i]=="string")return e[i]}function wt(n){const e=Ae.c(25),{item:s,schema:r,actions:i}=n;let l;e[0]!==s||e[1]!==r?(l=Nt(r,s),e[0]=s,e[1]=r,e[2]=l):l=e[2];const u=l,p=s&&typeof s=="object"&&"description"in s&&typeof s.description=="string"?s.description:void 0;let j;e[3]!==i?(j=i&&Object.keys(i).length>0,e[3]=i,e[4]=j):j=e[4];const o=j;let m;e[5]!==u||e[6]!==s.title?(m=t.jsx(ke,{icon:u,name:s.title,size:"md",className:"shrink-0 shadow-sm"}),e[5]=u,e[6]=s.title,e[7]=m):m=e[7];let f;e[8]!==s.title?(f=t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:s.title}),e[8]=s.title,e[9]=f):f=e[9];const d=p||"No description";let c;e[10]!==d?(c=t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:d}),e[10]=d,e[11]=c):c=e[11];let C;e[12]!==f||e[13]!==c?(C=t.jsxs("div",{className:"flex flex-col gap-0 flex-1",children:[f,c]}),e[12]=f,e[13]=c,e[14]=C):C=e[14];let y;e[15]!==m||e[16]!==C?(y=t.jsxs("div",{className:"flex flex-col gap-4 p-6 flex-1",children:[m,C]}),e[15]=m,e[16]=C,e[17]=y):y=e[17];let a;e[18]!==i||e[19]!==o||e[20]!==s?(a=o&&t.jsx("div",{className:"absolute top-6 right-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:At,onMouseDown:_t,children:t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Dt,children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:St,children:[i.open&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.open?.(s)},children:[t.jsx(Ge,{size:16}),"Open"]}),i.edit&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.edit?.(s)},children:[t.jsx(Ve,{size:16}),"Edit"]}),i.duplicate&&t.jsxs(k,{onClick:h=>{h.stopPropagation(),i.duplicate?.(s)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),i.delete&&t.jsxs(k,{variant:"destructive",onClick:h=>{h.stopPropagation(),i.delete?.(s)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]})}),e[18]=i,e[19]=o,e[20]=s,e[21]=a):a=e[21];let S;return e[22]!==y||e[23]!==a?(S=t.jsxs(nt,{className:"cursor-pointer transition-colors h-full flex flex-col group relative",children:[y,a]}),e[22]=y,e[23]=a,e[24]=S):S=e[24],S}function St(n){return n.stopPropagation()}function Dt(n){return n.stopPropagation()}function _t(n){return n.stopPropagation()}function At(n){return n.stopPropagation()}const It=["icon","avatar","logo"],Me=["created_at","created_by","id"];function Pt(n){return Object.keys(n).find(e=>It.includes(e.toLowerCase()))}function We(n,e){return Object.keys(n.properties||{}).filter(s=>["id","created_at","updated_at","created_by","updated_by"].includes(s)?!1:e?e.includes(s):!0).map(s=>({id:s,label:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ")}))}function Tt(n){const e=Ae.c(32),{data:s,schema:r,viewMode:i,onViewModeChange:l,search:u,sortKey:p,sortDirection:j,onSort:o,actions:m,onItemClick:f,headerActions:d,emptyState:c,readOnly:C,columns:y,hideToolbar:a,sortableFields:S}=n,h=l===void 0?Mt:l,x=j===void 0?"asc":j,P=o===void 0?Et:o;let v;e[0]!==m?(v=m===void 0?{}:m,e[0]=m,e[1]=v):v=e[1];const D=v,_=f===void 0?zt:f,z=d===void 0?null:d,b=c===void 0?null:c,T=C===void 0?!1:C,N=y===void 0?void 0:y,F=a===void 0?!1:a,w=S===void 0?void 0:S;let E;e[2]!==N||e[3]!==r||e[4]!==w?(E=N?N.filter(Ot).filter(M=>!w||w.includes(M.id)).map($t):We(r,w),e[2]=N,e[3]=r,e[4]=w,e[5]=E):E=e[5];const $=E;let A;e[6]!==z||e[7]!==F||e[8]!==P||e[9]!==h||e[10]!==x||e[11]!==p||e[12]!==$||e[13]!==i?(A=!F&&t.jsx("div",{className:"shrink-0 w-full border-b border-border h-12",children:t.jsxs("div",{className:"flex items-center gap-3 h-12 px-4",children:[t.jsx("div",{className:"flex items-center gap-2 flex-1",children:z}),t.jsx("div",{className:"flex items-center gap-2 shrink-0",children:t.jsx(Fe,{viewMode:i,onViewModeChange:h,sortKey:p,sortDirection:x,onSort:P,sortOptions:$})})]})}),e[6]=z,e[7]=F,e[8]=P,e[9]=h,e[10]=x,e[11]=p,e[12]=$,e[13]=i,e[14]=A):A=e[14];let O;e[15]!==D||e[16]!==N||e[17]!==s||e[18]!==b||e[19]!==_||e[20]!==P||e[21]!==T||e[22]!==r||e[23]!==u||e[24]!==x||e[25]!==p||e[26]!==w||e[27]!==i?(O=i==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:s.length===0?t.jsx("div",{className:"flex items-center justify-center h-full",children:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:s.map(M=>t.jsx("div",{onClick:()=>_?.(M),className:"cursor-pointer h-full",children:t.jsx(wt,{item:M,schema:r,readOnly:T,actions:D})},M.id))})}):t.jsx(ot,{columns:Kt(N,r,w,D),data:s,sortKey:p,sortDirection:x,onSort:P,onRowClick:_,emptyState:b||t.jsx(ze,{icon:t.jsx(Ee,{size:36,className:"text-muted-foreground"}),title:"No items found",description:u?"Try adjusting your search":"No items to display"})}),e[15]=D,e[16]=N,e[17]=s,e[18]=b,e[19]=_,e[20]=P,e[21]=T,e[22]=r,e[23]=u,e[24]=x,e[25]=p,e[26]=w,e[27]=i,e[28]=O):O=e[28];let I;return e[29]!==A||e[30]!==O?(I=t.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[A,O]}),e[29]=A,e[30]=O,e[31]=I):I=e[31],I}function $t(n){return{id:n.id,label:typeof n.header=="string"?n.header:n.id}}function Ot(n){return n.sortable!==!1}function zt(){}function Et(){}function Mt(){}function Ft(n){return{id:"actions",header:"",render:e=>t.jsxs(Ke,{children:[t.jsx(Ue,{asChild:!0,children:t.jsx(Ie,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:s=>s.stopPropagation(),children:t.jsx(Re,{size:20})})}),t.jsxs(Le,{align:"end",onClick:s=>s.stopPropagation(),children:[n.open&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.open?.(e)},children:[t.jsx(Ge,{size:16}),"Open"]}),n.edit&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.edit?.(e)},children:[t.jsx(Ve,{size:16}),"Edit"]}),n.duplicate&&t.jsxs(k,{onClick:s=>{s.stopPropagation(),n.duplicate?.(e)},children:[t.jsx(Be,{size:16}),"Duplicate"]}),n.delete&&t.jsxs(k,{variant:"destructive",onClick:s=>{s.stopPropagation(),n.delete?.(e)},children:[t.jsx(Je,{size:16}),"Delete"]})]})]}),cellClassName:"w-[60px]",sortable:!1}}function He(n){const e=n.type;return Array.isArray(e)?e.every(s=>He({type:s})):e==="string"||e==="number"||e==="integer"||e==="boolean"||e==="null"}function kt(n,e){const s=n.properties||{},r=Object.keys(s).filter(o=>{const m=s[o];return m&&He(m)}),i=Pt(s),l=[],u=new Set;i&&r.includes(i)&&(l.push(i),u.add(i));const p=["title","description","updated_at","updated_by"];for(const o of p)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));const j=r.filter(o=>!u.has(o)&&!Me.includes(o)).sort((o,m)=>o.localeCompare(m));for(const o of j)l.push(o),u.add(o);for(const o of Me)r.includes(o)&&!u.has(o)&&(l.push(o),u.add(o));return l.map(o=>{const m=s[o],f=e?e.includes(o):!["id"].includes(o);return o===i?{id:o,header:"",render:d=>{const c=d[o];return t.jsx(ke,{icon:c,name:d.title,size:"sm",className:"shrink-0 shadow-sm"})},sortable:!1,cellClassName:"w-16 shrink-0",wrap:!0}:o==="description"?{id:o,header:"Description",render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-[50ch]",children:String(c)})},sortable:f,cellClassName:"max-w-[50ch]"}:o==="created_by"||o==="updated_by"?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx(rt,{id:String(c),size:"xs"}):"—"},sortable:f,cellClassName:"max-w-[250px]"}:m?.format==="date-time"||o.endsWith("_at")?{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c?t.jsx("span",{className:"block truncate max-w-full",children:new Date(c).toLocaleDateString()}):"—"},sortable:f,cellClassName:"max-w-[200px]"}:{id:o,header:o.charAt(0).toUpperCase()+o.slice(1).replace(/_/g," "),render:d=>{const c=d[o];return c==null?"—":t.jsx("span",{className:"block truncate max-w-full",children:String(c)})},sortable:f,cellClassName:"max-w-[200px]"}})}function Kt(n,e,s,r){const i=n||kt(e,s);return i.some(p=>p.id==="actions")?i:Object.keys(r).length>0?[...i,Ft(r)]:i}function cs(n){const e=Ae.c(113),{connectionId:s,org:r,activeCollection:i}=n,l=i.name,u=i.schema??ct,p=i.hasCreateTool,j=i.hasUpdateTool,o=i.hasDeleteTool,m=Ye(),{data:f}=Ze.useSession(),d=f?.user?.id||"unknown",{org:c}=et();let C;e[0]!==s||e[1]!==c.id?(C={connectionId:s,orgId:c.id},e[0]=s,e[1]=c.id,e[2]=C):C=e[2];const y=vt(C),a=jt(s,l,y),S=`${s}-${l}`;let h;e[3]!==r||e[4]!==S?(h={namespace:r,resource:S,defaultSortKey:"updated_at"},e[3]=r,e[4]=S,e[5]=h):h=e[5];const{search:x,searchTerm:P,setSearch:v,viewMode:D,setViewMode:_,sortKey:z,sortDirection:b,handleSort:T}=lt(h);let N;e[6]!==P||e[7]!==b||e[8]!==z?(N={searchTerm:P,sortKey:z,sortDirection:b},e[6]=P,e[7]=b,e[8]=z,e[9]=N):N=e[9];const F=Ct(s,l,y,N),w=!p&&!j&&!o;let E;e[10]!==l||e[11]!==s||e[12]!==m||e[13]!==r?(E=g=>{m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:g.id}})},e[10]=l,e[11]=s,e[12]=m,e[13]=r,e[14]=E):E=e[14];const $=E;let A;e[15]!==a.create||e[16]!==d?(A=async g=>{const me=new Date().toISOString();await a.create.mutateAsync({...g,id:Oe("conn"),title:`${g.title} (Copy)`,created_at:me,updated_at:me,created_by:d,updated_by:d})},e[15]=a.create,e[16]=d,e[17]=A):A=e[17];const O=A,[I,M]=tt.useState(null);let oe;e[18]===Symbol.for("react.memo_cache_sentinel")?(oe=g=>{M(g)},e[18]=oe):oe=e[18];const qe=oe;let K;e[19]!==$||e[20]!==j?(K=j&&{edit:$},e[19]=$,e[20]=j,e[21]=K):K=e[21];let U;e[22]!==O||e[23]!==p?(U=p&&{duplicate:O},e[22]=O,e[23]=p,e[24]=U):U=e[24];let L;e[25]!==o?(L=o&&{delete:qe},e[25]=o,e[26]=L):L=e[26];let ie;e[27]!==L||e[28]!==K||e[29]!==U?(ie={...K,...U,...L},e[27]=L,e[28]=K,e[29]=U,e[30]=ie):ie=e[30];const ue=ie;let ne;e[31]!==a.delete||e[32]!==I?(ne=async()=>{I&&(await a.delete.mutateAsync(I.id),M(null))},e[31]=a.delete,e[32]=I,e[33]=ne):ne=e[33];const fe=ne;let re;e[34]!==a.create||e[35]!==l||e[36]!==s||e[37]!==p||e[38]!==m||e[39]!==r||e[40]!==d?(re=async()=>{if(!p){st.error("Create operation is not available for this collection");return}const g=new Date().toISOString(),me={id:Oe("conn"),title:"New Item",description:"A brief description of the item",created_at:g,updated_at:g,created_by:d,updated_by:d};try{const _e=await a.create.mutateAsync(me);m({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:$e,connectionId:s,collectionName:l,itemId:_e.id}})}catch(_e){console.error("Failed to create item:",_e)}},e[34]=a.create,e[35]=l,e[36]=s,e[37]=p,e[38]=m,e[39]=r,e[40]=d,e[41]=re):re=e[41];const he=re;let le;e[42]!==u?(le=We(u),e[42]=u,e[43]=le):le=e[43];const xe=le,Pe=(F?.length??0)>0,Qe=p&&Pe,Xe=p&&!Pe&&!x;let ae;e[44]!==a.create||e[45]!==he||e[46]!==p?(ae=p?t.jsxs(Ie,{onClick:he,size:"sm",disabled:a.create.isPending,className:"h-7",children:[t.jsx(bt,{className:"mr-2 h-4 w-4"}),a.create.isPending?"Creating...":"Create"]}):null,e[44]=a.create,e[45]=he,e[46]=p,e[47]=ae):ae=e[47];const Te=ae,ge=z;let B;e[48]!==T||e[49]!==_||e[50]!==b||e[51]!==xe||e[52]!==ge||e[53]!==D?(B=t.jsx(Fe,{viewMode:D,onViewModeChange:_,sortKey:ge,sortDirection:b,onSort:T,sortOptions:xe}),e[48]=T,e[49]=_,e[50]=b,e[51]=xe,e[52]=ge,e[53]=D,e[54]=B):B=e[54];const je=Qe&&Te;let R;e[55]!==B||e[56]!==je?(R=t.jsxs(yt,{children:[B,je]}),e[55]=B,e[56]=je,e[57]=R):R=e[57];const Ce=`Search ${l}...`;let V;e[58]!==v?(V=g=>{g.key==="Escape"&&(v(""),g.target.blur())},e[58]=v,e[59]=V):V=e[59];let G;e[60]!==x||e[61]!==v||e[62]!==Ce||e[63]!==V?(G=t.jsx(it,{value:x,onChange:v,placeholder:Ce,onKeyDown:V}),e[60]=x,e[61]=v,e[62]=Ce,e[63]=V,e[64]=G):G=e[64];let J;e[65]!==F?(J=F??[],e[65]=F,e[66]=J):J=e[66];const ve=z;let W;e[67]!==$?(W=g=>$(g),e[67]=$,e[68]=W):W=e[68];const be="No items found",ye=x?"Try adjusting your search terms":"This collection doesn't have any items yet.",Ne=Xe?Te:void 0;let H;e[69]!==be||e[70]!==ye||e[71]!==Ne?(H=t.jsx(at,{image:null,title:be,description:ye,actions:Ne}),e[69]=be,e[70]=ye,e[71]=Ne,e[72]=H):H=e[72];let q;e[73]!==T||e[74]!==w||e[75]!==ue||e[76]!==u||e[77]!==x||e[78]!==v||e[79]!==_||e[80]!==b||e[81]!==J||e[82]!==ve||e[83]!==W||e[84]!==H||e[85]!==D?(q=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Tt,{hideToolbar:!0,data:J,schema:u,viewMode:D,onViewModeChange:_,search:x,onSearchChange:v,sortKey:ve,sortDirection:b,onSort:T,actions:ue,onItemClick:W,readOnly:w,emptyState:H})}),e[73]=T,e[74]=w,e[75]=ue,e[76]=u,e[77]=x,e[78]=v,e[79]=_,e[80]=b,e[81]=J,e[82]=ve,e[83]=W,e[84]=H,e[85]=D,e[86]=q):q=e[86];let Q;e[87]!==G||e[88]!==q?(Q=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[G,q]}),e[87]=G,e[88]=q,e[89]=Q):Q=e[89];const we=!!I;let ce;e[90]===Symbol.for("react.memo_cache_sentinel")?(ce=g=>{g||M(null)},e[90]=ce):ce=e[90];let de;e[91]===Symbol.for("react.memo_cache_sentinel")?(de=t.jsx(mt,{children:"Delete item?"}),e[91]=de):de=e[91];const Se=I?.title;let X;e[92]!==Se?(X=t.jsxs(ut,{children:[de,t.jsxs(ft,{children:['Are you sure you want to delete "',Se,'"? This action cannot be undone.']})]}),e[92]=Se,e[93]=X):X=e[93];let Y;e[94]!==a.delete.isPending?(Y=t.jsx(dt,{disabled:a.delete.isPending,children:"Cancel"}),e[94]=a.delete.isPending,e[95]=Y):Y=e[95];const De=a.delete.isPending?"Deleting...":"Delete";let Z;e[96]!==a.delete.isPending||e[97]!==fe||e[98]!==De?(Z=t.jsx(pt,{onClick:fe,disabled:a.delete.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:De}),e[96]=a.delete.isPending,e[97]=fe,e[98]=De,e[99]=Z):Z=e[99];let ee;e[100]!==Y||e[101]!==Z?(ee=t.jsxs(ht,{children:[Y,Z]}),e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let te;e[103]!==X||e[104]!==ee?(te=t.jsxs(xt,{children:[X,ee]}),e[103]=X,e[104]=ee,e[105]=te):te=e[105];let se;e[106]!==we||e[107]!==te?(se=t.jsx(gt,{open:we,onOpenChange:ce,children:te}),e[106]=we,e[107]=te,e[108]=se):se=e[108];let pe;return e[109]!==R||e[110]!==Q||e[111]!==se?(pe=t.jsxs(t.Fragment,{children:[R,Q,se]}),e[109]=R,e[110]=Q,e[111]=se,e[112]=pe):pe=e[112],pe}export{cs as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as k,c as T,j as t}from"./index-
|
|
1
|
+
import{r as k,c as T,j as t}from"./index-HxeE9C0A.js";import{B as L}from"./button-C1iesapY.js";import{c as E,a as V,D as B,b as $}from"./dropdown-menu-D6YYwFq7.js";import{i as D}from"./ArrowUp-DVhz9MPT.js";import{i as R}from"./Check-BIlnRzi6.js";import{c as H}from"./Grid01-BhCIE3UE.js";import{i as W}from"./List-B95opsr5.js";import{c as I,b as K,T as _,a as A}from"./integration-icon-CmJggqPx.js";import{V as O}from"./view-mode-toggle-JVmuLwXe.js";import{c as y}from"./utils-D1Qd9-I_.js";import{T as P,a as q,b as z,c as F,d as G,e as J}from"./table-F_F9uG31.js";const S=({size:p=24,color:e="currentColor",...s})=>k.createElement("svg",{viewBox:"0 0 24 24",width:p,height:p,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},k.createElement("path",{d:"M12 5v14m0 0 7-7m-7 7-7-7"}));S.displayName="ArrowDown";const M=({size:p=24,color:e="currentColor",...s})=>k.createElement("svg",{viewBox:"0 0 24 24",width:p,height:p,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},k.createElement("path",{d:"M5 21v-7m0-4V3m7 18v-9m0-4V3m7 18v-5m0-4V3M2 14h6m1-6h6m1 8h6"}));M.displayName="Sliders01";function ae(p){const e=T.c(16),{viewMode:s,onViewModeChange:x,sortKey:u,sortDirection:d,onSort:a,sortOptions:i}=p;let l;e[0]!==i?(l=i===void 0?[]:i,e[0]=i,e[1]=l):l=e[1];const m=l;let h;e[2]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(I,{children:t.jsxs(K,{children:[t.jsx(_,{asChild:!0,children:t.jsx(V,{asChild:!0,children:t.jsx(L,{variant:"outline",size:"icon",className:"size-7 border border-input",children:t.jsx(M,{size:16})})})}),t.jsx(A,{children:"Search filters"})]})}),e[2]=h):h=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c={value:"table",icon:t.jsx(W,{})},e[3]=c):c=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=[c,{value:"cards",icon:t.jsx(H,{})}],e[4]=r):r=e[4];let o;e[5]!==x||e[6]!==s?(o=t.jsx("div",{className:"p-2 border-b border-border",children:t.jsx(O,{value:s,onValueChange:x,fullWidth:!0,options:r})}),e[5]=x,e[6]=s,e[7]=o):o=e[7];let f;e[8]!==a||e[9]!==d||e[10]!==u||e[11]!==m?(f=m.length>0&&a&&t.jsxs("div",{className:"p-1 flex flex-col gap-0.5",children:[t.jsx("div",{className:"px-2 py-1.5 text-xs font-mono font-normal text-muted-foreground uppercase tracking-wide",children:"Sort by"}),m.map(j=>{const w=u===j.id;return t.jsx(E,{onClick:()=>a(j.id),className:y("h-8 px-2 py-0 cursor-pointer",w&&"bg-accent"),children:t.jsxs("div",{className:"flex items-center gap-2 w-full",children:[w&&t.jsx(R,{size:16,className:"text-foreground shrink-0"}),!w&&t.jsx("div",{className:"w-4 shrink-0"}),t.jsx("span",{className:"text-sm text-foreground flex-1",children:j.label}),w&&d&&(d==="asc"?t.jsx(D,{size:16,className:"text-foreground shrink-0"}):t.jsx(S,{size:16,className:"text-foreground shrink-0"}))]})},j.id)})]}),e[8]=a,e[9]=d,e[10]=u,e[11]=m,e[12]=f):f=e[12];let g;return e[13]!==o||e[14]!==f?(g=t.jsxs(B,{children:[h,t.jsxs($,{align:"end",className:"w-[200px] p-0 gap-0",children:[o,f]})]}),e[13]=o,e[14]=f,e[15]=g):g=e[15],g}function Q(p){const e=T.c(29),{columns:s,data:x,sortKey:u,sortDirection:d,onSort:a,onRowClick:i,rowClassName:l}=p;let m;e[0]!==d?(m=function(n,N){return t.jsx("div",{className:"w-4 flex items-center justify-center",children:N&&d&&(d==="asc"?t.jsx(D,{size:16,className:"text-muted-foreground transition-colors"}):t.jsx(S,{size:16,className:"text-muted-foreground transition-colors"}))})},e[0]=d,e[1]=m):m=e[1];const h=m;let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=function(n,N){let C="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider";return n===N-1&&(C="px-4 py-2 text-left font-mono font-normal text-muted-foreground text-[11px] h-9 uppercase tracking-wider w-8"),C},e[2]=c):c=e[2];const r=c;let o;if(e[3]!==s||e[4]!==a||e[5]!==h||e[6]!==u){let b;e[8]!==s.length||e[9]!==a||e[10]!==h||e[11]!==u?(b=(n,N)=>{const C=u===n.id;return t.jsx(P,{className:y(r(N,s.length),"group transition-colors select-none",n.sortable&&"hover:bg-accent cursor-pointer",n.rowClassName,n.cellClassName),onClick:n.sortable&&a?()=>a(n.id):void 0,children:t.jsxs("span",{className:"flex items-center gap-1",children:[n.header,n.sortable&&h(n.id,C)]})},n.id)},e[8]=s.length,e[9]=a,e[10]=h,e[11]=u,e[12]=b):b=e[12],o=s.map(b),e[3]=s,e[4]=a,e[5]=h,e[6]=u,e[7]=o}else o=e[7];let f;e[13]!==o?(f=t.jsx(q,{className:"border-b-0",children:t.jsx(z,{className:"h-9 hover:bg-transparent border-b border-border",children:o})}),e[13]=o,e[14]=f):f=e[14];let g;if(e[15]!==s||e[16]!==x||e[17]!==i||e[18]!==l){let b;e[20]!==s||e[21]!==i||e[22]!==l?(b=(n,N)=>{const C=l?.(n);return t.jsx(z,{"data-row-index":N,className:y("group/data-row transition-colors border-b-0 hover:bg-accent/50",i?"cursor-pointer":"",C),onClick:i?()=>i(n):void 0,children:s.map(v=>t.jsx(F,{className:y("px-5 py-4 h-16 align-middle text-sm text-foreground",v.cellClassName,v.wrap?"whitespace-normal wrap-break-word":""),children:t.jsx("div",{className:y(v.wrap?"w-full":"min-w-0 w-full",!v.wrap&&"truncate overflow-hidden whitespace-nowrap"),children:v.render?v.render(n):v.accessor?v.accessor(n):null})},v.id))},N)},e[20]=s,e[21]=i,e[22]=l,e[23]=b):b=e[23],g=x.map(b),e[15]=s,e[16]=x,e[17]=i,e[18]=l,e[19]=g}else g=e[19];let j;e[24]!==g?(j=t.jsx(G,{children:g}),e[24]=g,e[25]=j):j=e[25];let w;return e[26]!==f||e[27]!==j?(w=t.jsxs(J,{className:"w-full border-collapse",children:[f,j]}),e[26]=f,e[27]=j,e[28]=w):w=e[28],w}function le(p){const e=T.c(12),{columns:s,data:x,isLoading:u,sortKey:d,sortDirection:a,onSort:i,onRowClick:l,emptyState:m}=p;if(u===void 0?!1:u){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("div",{className:"flex items-center justify-center h-full",children:t.jsx("div",{className:"text-muted-foreground",children:"Loading..."})}),e[0]=r):r=e[0],r}if(x.length===0){let r;e[1]!==m?(r=m||t.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No items found"}),e[1]=m,e[2]=r):r=e[2];let o;return e[3]!==r?(o=t.jsx("div",{className:"flex items-center justify-center h-full",children:r}),e[3]=r,e[4]=o):o=e[4],o}let c;return e[5]!==s||e[6]!==x||e[7]!==l||e[8]!==i||e[9]!==a||e[10]!==d?(c=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(Q,{columns:s,data:x,sortKey:d,sortDirection:a,onSort:i,onRowClick:l})}),e[5]=s,e[6]=x,e[7]=l,e[8]=i,e[9]=a,e[10]=d,e[11]=c):c=e[11],c}export{ae as C,le as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x,j as u}from"./index-
|
|
1
|
+
import{c as x,j as u}from"./index-HxeE9C0A.js";import{c as m}from"./utils-D1Qd9-I_.js";import{B as g}from"./badge-C898LHvV.js";function v(f){const e=x.c(12),{tabs:l,activeTab:n,onTabChange:s,className:a}=f;let t;e[0]!==a?(t=m("flex items-center gap-2 overflow-x-auto no-scrollbar",a),e[0]=a,e[1]=t):t=e[1];let r;if(e[2]!==n||e[3]!==s||e[4]!==l){let c;e[6]!==n||e[7]!==s?(c=o=>{const d=n===o.id;return u.jsxs("button",{type:"button",onClick:()=>s(o.id),className:m("h-7 px-2 text-sm rounded-lg border border-input transition-colors inline-flex gap-1.5 items-center",d&&"bg-accent border-border text-foreground",!d&&"bg-transparent text-muted-foreground hover:border-border hover:bg-accent/50 hover:text-foreground"),children:[o.label,o.count!==void 0&&u.jsx(g,{variant:"secondary",className:m("h-5 min-w-5 px-1 rounded-full text-[10px] font-mono inline-flex items-center justify-center",d?"bg-background text-foreground":"bg-muted-foreground/10 text-muted-foreground"),children:o.count})]},o.id)},e[6]=n,e[7]=s,e[8]=c):c=e[8],r=l.map(c),e[2]=n,e[3]=s,e[4]=l,e[5]=r}else r=e[5];let i;return e[9]!==t||e[10]!==r?(i=u.jsx("div",{className:t,children:r}),e[9]=t,e[10]=r,e[11]=i):i=e[11],i}export{v as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as r,u as i,y as u,K as p,g as f,j as n}from"./index-
|
|
1
|
+
import{c as r,u as i,y as u,K as p,g as f,j as n}from"./index-HxeE9C0A.js";import{_ as m}from"./index-DlY6KFzI.js";import{c}from"./utils-D1Qd9-I_.js";import{i as x}from"./SearchMd-yRVgOeax.js";function v(){const a=r.c(4),{locator:e}=i();let t;a[0]!==e?(t=p.members(e),a[0]=e,a[1]=t):t=a[1];let s;return a[2]!==t?(s={queryKey:t,queryFn:g},a[2]=t,a[3]=s):s=a[3],u(s)}function g(){return f.organization.listMembers()}function _(a){const e=r.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=c("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m,{"data-slot":"command",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function j(a){const e=r.c(9);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx(x,{className:"size-5 shrink-0 text-foreground"}),e[3]=o):o=e[3];let l;e[4]!==t?(l=c("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",t),e[4]=t,e[5]=l):l=e[5];let d;return e[6]!==s||e[7]!==l?(d=n.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-10 items-center gap-2 border-b px-3",children:[o,n.jsx(m.Input,{"data-slot":"command-input",className:l,...s})]}),e[6]=s,e[7]=l,e[8]=d):d=e[8],d}function C(a){const e=r.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=c("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.List,{"data-slot":"command-list",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function w(a){const e=r.c(4);let t;e[0]!==a?({...t}=a,e[0]=a,e[1]=t):t=e[1];let s;return e[2]!==t?(s=n.jsx(m.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...t}),e[2]=t,e[3]=s):s=e[3],s}function $(a){const e=r.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=c("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Group,{"data-slot":"command-group",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function k(a){const e=r.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=c("bg-border -mx-1 h-px",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Separator,{"data-slot":"command-separator",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}function E(a){const e=r.c(8);let t,s;e[0]!==a?({className:t,...s}=a,e[0]=a,e[1]=t,e[2]=s):(t=e[1],s=e[2]);let o;e[3]!==t?(o=c("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),e[3]=t,e[4]=o):o=e[4];let l;return e[5]!==s||e[6]!==o?(l=n.jsx(m.Item,{"data-slot":"command-item",className:o,...s}),e[5]=s,e[6]=o,e[7]=l):l=e[7],l}export{$ as C,E as a,k as b,w as c,C as d,_ as e,j as f,v as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as T,
|
|
1
|
+
import{c as T,bo as M,j as e,bp as P,z as q,r as R,t as h,a as O}from"./index-HxeE9C0A.js";import{u as A}from"./useQuery-jRtVXI31.js";import{u as _}from"./useMutation-M3-wug2Q.js";import{B as y}from"./button-C1iesapY.js";import{C as N,a as v}from"./card-DKzkS6ji.js";import{i as L,a as U}from"./mcp-oauth-JrpxCLx4.js";import{c as C,C as K,a as k}from"./circle-alert-_5s_KbQk.js";import"./utils-D1Qd9-I_.js";const Q=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],D=C("external-link",Q);const H=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],w=C("loader-circle",H);const J=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],B=C("refresh-cw",J),Y=t=>{const n=T.c(6);let i;n[0]!==t?({...i}=t,n[0]=t,n[1]=i):i=n[1];const{theme:a}=M(),d=a===void 0?"system":a;let r;n[2]===Symbol.for("react.memo_cache_sentinel")?(r={"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)"},n[2]=r):r=n[2];let m;return n[3]!==i||n[4]!==d?(m=e.jsx(P,{theme:d,className:"toaster group",style:r,...i}),n[3]=i,n[4]=d,n[5]=m):m=n[5],m},b={session:t=>["user-sandbox-session",t]};function V({sessionId:t,onComplete:n,onError:i}){const a=q(),[p,d]=R.useState(null),{data:r,isLoading:m,error:j}=A({queryKey:b.session(t),queryFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}`);if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to load session")}return s.json()}}),F=_({mutationFn:async({appName:s,connectionId:o})=>{const l=await fetch(`/api/user-sandbox/sessions/${t}/configure`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s,connection_id:o})});if(!l.ok){const u=await l.json();throw new Error(u.error||"Configuration failed")}return l.json()},onSuccess:()=>{a.invalidateQueries({queryKey:b.session(t)})}}),x=_({mutationFn:async()=>{const s=await fetch(`/api/user-sandbox/sessions/${t}/complete`,{method:"POST",headers:{"Content-Type":"application/json"}});if(!s.ok){const o=await s.json();throw new Error(o.error||"Failed to complete")}return s.json()},onSuccess:s=>{s.redirectUrl?window.location.href=s.redirectUrl:(h.success("Setup complete!"),a.invalidateQueries({queryKey:b.session(t)}),n?.({agentId:s.agentId,redirectUrl:s.redirectUrl}))},onError:s=>{const o=s instanceof Error?s:new Error("Failed to complete");h.error(o.message),i?.(o)}}),S=async s=>{d(s.app_name);try{const o=await fetch(`/api/user-sandbox/sessions/${t}/provision`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({app_name:s.app_name})});if(!o.ok){const g=await o.json();throw new Error(g.error||"Failed to provision connection")}const u=(await o.json()).connection_id;if(s.connection_type==="HTTP"||s.connection_type==="SSE"||s.connection_type==="Websocket"){const g=`/mcp/${u}`,z=await L({url:g,token:null});if(!z.isAuthenticated&&z.supportsOAuth){h.info("Opening authentication window...");const c=await U({connectionId:u,clientName:s.title,timeout:3e5});if(c.error)throw new Error(c.error);if(c.tokenInfo){const E=await fetch(`/api/connections/${u}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:c.tokenInfo.accessToken,refreshToken:c.tokenInfo.refreshToken,expiresIn:c.tokenInfo.expiresIn,scope:c.tokenInfo.scope,clientId:c.tokenInfo.clientId,clientSecret:c.tokenInfo.clientSecret,tokenEndpoint:c.tokenInfo.tokenEndpoint})});if(!E.ok){const $=await E.json().catch(()=>({}));throw new Error($.error||"Failed to save authentication tokens. Please try again.")}}}}await F.mutateAsync({appName:s.app_name,connectionId:u}),h.success(`${s.title} connected successfully`)}catch(o){console.error("Connection error:",o);const l=o instanceof Error?o:new Error("Failed to connect");h.error(l.message),i?.(l)}finally{d(null)}},I=r?.apps.every(s=>s.status.configured),f=r?.session.status==="completed";return m?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"})}):j?e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx(N,{className:"max-w-md w-full",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("div",{className:"size-12 rounded-full bg-destructive/10 flex items-center justify-center",children:e.jsx(K,{className:"size-6 text-destructive"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Session Error"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:j instanceof Error?j.message:"Failed to load"})]})]})})})}):r?e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Y,{}),e.jsxs("div",{className:"max-w-lg mx-auto px-4 py-12",children:[e.jsxs("div",{className:"text-center mb-8",children:[r.template.icon&&e.jsx("div",{className:"size-16 mx-auto mb-4 rounded-xl bg-muted flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:r.template.icon,alt:"",className:"size-10 object-contain"})}),e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:r.template.title}),r.template.description&&e.jsx("p",{className:"text-muted-foreground mt-2",children:r.template.description})]}),f&&e.jsx(N,{className:"mb-6 border-green-500/20 bg-green-500/5",children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"size-10 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Setup Complete"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your integrations are ready to use."})]})]})})}),e.jsx("div",{className:"space-y-3",children:r.apps.map(s=>e.jsx(N,{children:e.jsx(v,{className:"py-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"size-10 rounded-lg bg-muted flex items-center justify-center shrink-0 overflow-hidden",children:s.icon?e.jsx("img",{src:s.icon,alt:"",className:"size-6 object-contain"}):e.jsx("span",{className:"text-lg",children:"📦"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.status.configured?e.jsxs("span",{className:"text-green-600 dark:text-green-400 flex items-center gap-1",children:[e.jsx(k,{className:"size-3"})," Connected"]}):s.requires_oauth?"Requires authentication":"Ready to connect"})]}),!s.status.configured&&!f&&e.jsx(y,{size:"sm",onClick:()=>S(s),disabled:p!==null||x.isPending,children:p===s.app_name?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Connecting..."]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"size-4 mr-2"}),"Connect"]})}),s.status.configured&&!f&&e.jsxs(y,{size:"sm",variant:"outline",onClick:()=>S(s),disabled:p!==null||x.isPending,children:[e.jsx(B,{className:"size-4 mr-2"}),"Reconnect"]}),f&&e.jsx("div",{className:"size-8 rounded-full bg-green-500/10 flex items-center justify-center",children:e.jsx(k,{className:"size-4 text-green-500"})})]})})},s.app_name))}),I&&!f&&e.jsx("div",{className:"mt-6",children:e.jsx(y,{className:"w-full",size:"lg",onClick:()=>x.mutate(),disabled:x.isPending,children:x.isPending?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"size-4 mr-2 animate-spin"}),"Completing..."]}):"Complete Setup"})}),e.jsx("div",{className:"mt-8 pt-6 border-t text-center",children:e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Session expires:"," ",new Date(r.session.expires_at).toLocaleString()]})})]})]}):null}function re(){const t=T.c(3);let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n={from:"/connect/$sessionId"},t[0]=n):n=t[0];const{sessionId:i}=O(n);let a;return t[1]!==i?(a=e.jsx(V,{sessionId:i}),t[1]=i,t[2]=a):a=t[2],a}export{re as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as $,j as t}from"./index-
|
|
1
|
+
import{c as $,j as t}from"./index-HxeE9C0A.js";import{C as q}from"./card-DKzkS6ji.js";import{c as N}from"./utils-D1Qd9-I_.js";import{I as B}from"./integration-icon-CmJggqPx.js";function L(g){const e=$.c(46),{connection:s,onClick:C,headerActions:b,body:k,footer:y,className:I,size:A,fallbackIcon:w}=g,E=A===void 0?"md":A,i=E==="sm"?"p-4":"p-6",P=E==="sm"?"text-sm":"text-base",R=E==="sm"?"text-xs":"text-sm",S=C&&"hover:bg-muted/50";let l;e[0]!==I||e[1]!==S?(l=N("cursor-pointer transition-colors group overflow-hidden flex flex-col",S,I),e[0]=I,e[1]=S,e[2]=l):l=e[2];let o;e[3]!==i?(o=N("flex flex-col gap-4",i),e[3]=i,e[4]=o):o=e[4];let n;e[5]!==s.icon||e[6]!==s.title||e[7]!==w?(n=t.jsx(B,{icon:s.icon,name:s.title,size:"md",className:"shrink-0 shadow-sm",fallbackIcon:w}),e[5]=s.icon,e[6]=s.title,e[7]=w,e[8]=n):n=e[8];let c;e[9]!==b?(c=b&&t.jsx("div",{className:N("transition-opacity","opacity-0 group-hover:opacity-100"),onClick:F,children:b}),e[9]=b,e[10]=c):c=e[10];let r;e[11]!==c?(r=t.jsx("div",{className:"relative",children:c}),e[11]=c,e[12]=r):r=e[12];let a;e[13]!==n||e[14]!==r?(a=t.jsxs("div",{className:"flex items-start justify-between",children:[n,r]}),e[13]=n,e[14]=r,e[15]=a):a=e[15];let d;e[16]!==P?(d=N("font-medium text-foreground truncate",P),e[16]=P,e[17]=d):d=e[17];let m;e[18]!==s.title||e[19]!==d?(m=t.jsx("h3",{className:d,children:s.title}),e[18]=s.title,e[19]=d,e[20]=m):m=e[20];let f;e[21]!==R?(f=N("text-muted-foreground line-clamp-2",R),e[21]=R,e[22]=f):f=e[22];const _=s.description||"No description";let x;e[23]!==f||e[24]!==_?(x=t.jsx("p",{className:f,children:_}),e[23]=f,e[24]=_,e[25]=x):x=e[25];let p;e[26]!==m||e[27]!==x?(p=t.jsxs("div",{className:"flex flex-col gap-0",children:[m,x]}),e[26]=m,e[27]=x,e[28]=p):p=e[28];let h;e[29]!==k?(h=k&&t.jsx("div",{children:k}),e[29]=k,e[30]=h):h=e[30];let u;e[31]!==p||e[32]!==h||e[33]!==o||e[34]!==a?(u=t.jsxs("div",{className:o,children:[a,p,h]}),e[31]=p,e[32]=h,e[33]=o,e[34]=a,e[35]=u):u=e[35];let j;e[36]!==y||e[37]!==i?(j=y&&t.jsx("div",{className:"border-t border-border mt-auto",children:t.jsx("div",{className:N("h-14 flex items-center",i),onClick:D,children:y})}),e[36]=y,e[37]=i,e[38]=j):j=e[38];let v;e[39]!==u||e[40]!==j?(v=t.jsxs("div",{className:"flex flex-col flex-1",children:[u,j]}),e[39]=u,e[40]=j,e[41]=v):v=e[41];let z;return e[42]!==C||e[43]!==v||e[44]!==l?(z=t.jsx(q,{className:l,onClick:C,children:v}),e[42]=C,e[43]=v,e[44]=l,e[45]=z):z=e[45],z}function D(g){return g.stopPropagation()}function F(g){return g.stopPropagation()}export{L as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as X,j as t,m as Ee,O as Se,aM as ct,u as at,bs as Ge,ai as vt,p as Nt,br as ze,r as Y,o as lt,b9 as yt,bh as _t,s as W,aj as Je,ak as Ct,a as St,f as wt,z as Tt,h as kt,k as Pt,i as It,t as Ce,K as Ye}from"./index-HxeE9C0A.js";import{E as ye}from"./empty-state-CH3e4Xzf.js";import{E as dt}from"./error-boundary-BGFWaL1J.js";import{E as $t,r as At,e as mt}from"./env-vars-editor-Vpi1vdW2.js";import{P as Xe,S as Vt}from"./index-GRocoNYa.js";import{b as Mt,a as Dt}from"./use-binding-BIvDtNoa.js";import{u as Ot,S as Rt}from"./index-Dv4saiJc.js";import{f as Ke,g as ut}from"./use-connection-DWpxH8iy.js";import{u as Et}from"./constants-BEco_-y7.js";import{d as Lt}from"./use-mcp-tools-DO_-llbI.js";import{b as Ut,d as Ft}from"./use-mcp-prompts-CUow6VVK.js";import{a as Bt}from"./mcp-oauth-JrpxCLx4.js";import{b as Ze,c as zt,d as Xt,e as Kt,B as Wt,a as qt}from"./breadcrumb-t_Ccp20G.js";import{B as Fe}from"./button-C1iesapY.js";import{C as Ht}from"./collection-tabs-BPHWDFL4.js";import{i as Re}from"./Loading01-CudhqwtJ.js";import{V as We,a as Qt}from"./layout-BQSZy0Ao.js";import{C as Gt}from"./collection-tab-Y58MHDMK.js";import{I as qe,n as Jt}from"./integration-icon-CmJggqPx.js";import{B as Be}from"./badge-C898LHvV.js";import{D as Yt,a as Zt,b as es,c as et}from"./dropdown-menu-D6YYwFq7.js";import{F as G,a as ts,b as J,d as q,f as Z,c as te,e as ss}from"./form-NA0-x5iN.js";import{I as ee}from"./input-DBGu1Yhi.js";import{S as tt,a as st,b as nt,c as ot,d as Q}from"./select-CnIfeZ9k.js";import{i as pt}from"./CheckCircle-CSYoAEm3.js";import{t as ns}from"./ChevronDown-jAfIG9nZ.js";import{s as Oe}from"./Globe02-CNtZ4Mz7.js";import{s as os}from"./RefreshCcw01-Dzlid7sh.js";import{i as rs}from"./Terminal-DV_yPRWa.js";import{s as is}from"./Trash01-py7ft8Od.js";import{t as He}from"./Users03-D2F2bran.js";import{s as cs}from"./XClose-S1Me7eeg.js";import{U as as}from"./use-list-state-CqdwrHCA.js";import{b as ls,a as ds}from"./use-virtual-mcp-DaI2d98r.js";import{i as ms}from"./ChevronRight-CNYkXy1u.js";import{s as us}from"./Plus-BVPnBK8D.js";import{f as ps}from"./formatDistanceToNow-Cb2QZZJn.js";import{a as ft,C as xt}from"./collection-table-wrapper-B6XWzQ-4.js";import{C as ht}from"./collection-search-D3a5_1zR.js";import{C as gt}from"./card-DKzkS6ji.js";import{R as fs,T as xs}from"./tools-list-CeBZ5K9_.js";import"./utils-D1Qd9-I_.js";import"./Pin01-DpTwe7GO.js";import"./use-organization-settings-ANLw4ex1.js";import"./useMutation-M3-wug2Q.js";import"./binder-xcUkLvPC.js";import"./File06-BUOJeS0C.js";import"./index-DlY6KFzI.js";import"./constants-gwxE8_b0.js";import"./registry-utils-CLfG2KJO.js";import"./extract-connection-data-CDmQ7rLP.js";import"./github-icon-Dp3wHhYE.js";import"./generate-id-Dyweu44Y.js";import"./use-install-from-registry-CNdLBCwL.js";import"./index-Kq8ytqk9.js";import"./circle-alert-_5s_KbQk.js";import"./index-C9Dn0opW.js";import"./X-CixxHrye.js";import"./use-deco-chat-open-DeBMXnMx.js";import"./use-llm-B2BVGott.js";import"./useQuery-jRtVXI31.js";import"./Code01-DeVT5m93.js";import"./infiniteQueryObserver-CSOdbqFL.js";import"./localstorage-keys-BxVB7BFB.js";import"./popover-BbAo_V3q.js";import"./Grid01-BhCIE3UE.js";import"./Image01-Bmljn0R6.js";import"./SearchMd-yRVgOeax.js";import"./spinner-BbdUl9_5.js";import"./dialog-CpkgwzHW.js";import"./AlertCircle-TbirTaeA.js";import"./ArrowUp-DVhz9MPT.js";import"./Edit01-CLT1AKyh.js";import"./Check-BIlnRzi6.js";import"./Copy01-BJPi2nBZ.js";import"./monaco-editor-DvJ6AQm-.js";import"./use-create-virtual-mcp-CMegJpH_.js";import"./index-wUnd_o-U.js";import"./DotsVertical-CPJps54j.js";import"./empty-state-BQPtoYZe.js";import"./Inbox01-Bz-1SNbb.js";import"./alert-dialog-B1nWkQHx.js";import"./index-ByJoFAq_.js";import"./label-11d5Pe_w.js";import"./avatar-BbH9O0kN.js";import"./use-mobile-CqANtQ4e.js";import"./differenceInSeconds-NQ4PDo0z.js";import"./List-B95opsr5.js";import"./view-mode-toggle-JVmuLwXe.js";import"./table-F_F9uG31.js";function hs(s){const e=X.c(13),{virtualMcp:n,org:o}=s;let r;e[0]!==o||e[1]!==n.id?(r={org:o,project:Se,agentId:n.id},e[0]=o,e[1]=n.id,e[2]=r):r=e[2];let c;e[3]!==n.icon||e[4]!==n.title?(c=n.icon?t.jsx("img",{src:n.icon,alt:n.title,className:"w-5 h-5 rounded-md object-cover shrink-0"}):t.jsx("div",{className:"w-8 h-8 rounded-md bg-primary/10 flex items-center justify-center shrink-0",children:t.jsx(He,{size:16,className:"text-primary"})}),e[3]=n.icon,e[4]=n.title,e[5]=c):c=e[5];let a;e[6]!==n.title?(a=t.jsx("span",{className:"flex-1 text-sm font-medium text-foreground truncate",children:n.title}),e[6]=n.title,e[7]=a):a=e[7];let f;e[8]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(ms,{size:16,className:"text-muted-foreground group-hover:text-foreground transition-colors shrink-0"}),e[8]=f):f=e[8];let u;return e[9]!==r||e[10]!==c||e[11]!==a?(u=t.jsxs(ct,{to:"/$org/$project/agents/$agentId",params:r,className:"flex items-center gap-3 p-2 pr-1 rounded-lg hover:bg-muted/50 transition-colors group",children:[c,a,f]}),e[9]=r,e[10]=c,e[11]=a,e[12]=u):u=e[12],u}function rt(s){const e=X.c(20),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:f}=s,u=Ee(),p=ds();let x;e[0]!==p.create||e[1]!==r||e[2]!==c||e[3]!==n||e[4]!==o||e[5]!==u||e[6]!==a?(x=async()=>{const d=await p.create.mutateAsync({title:`${o} Agent`,description:r??null,icon:c??null,status:"active",connections:[{connection_id:n,selected_tools:null,selected_resources:null,selected_prompts:null}]});u({to:"/$org/$project/agents/$agentId",params:{org:a,project:Se,agentId:d.id}})},e[0]=p.create,e[1]=r,e[2]=c,e[3]=n,e[4]=o,e[5]=u,e[6]=a,e[7]=x):x=e[7];const m=x;if(f){let d;e[8]!==p.create.isPending?(d=p.create.isPending?t.jsx(Re,{size:16,className:"animate-spin"}):t.jsx(us,{size:16}),e[8]=p.create.isPending,e[9]=d):d=e[9];let l;return e[10]!==p.create.isPending||e[11]!==m||e[12]!==d?(l=t.jsx(Fe,{variant:"ghost",className:"size-6 p-0",onClick:m,disabled:p.create.isPending,children:d}),e[10]=p.create.isPending,e[11]=m,e[12]=d,e[13]=l):l=e[13],l}let i;e[14]!==p.create.isPending?(i=p.create.isPending?t.jsx(Re,{className:"animate-spin text-muted-foreground"}):t.jsx(He,{className:"size-3 text-muted-foreground"}),e[14]=p.create.isPending,e[15]=i):i=e[15];let b;return e[16]!==p.create.isPending||e[17]!==m||e[18]!==i?(b=t.jsxs(Fe,{variant:"outline",size:"sm",onClick:m,disabled:p.create.isPending,children:[i,"Create an agent"]}),e[16]=p.create.isPending,e[17]=m,e[18]=i,e[19]=b):b=e[19],b}function gs(s){const e=X.c(26),{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a}=s;let f;e[0]!==n?(f={filters:[{column:"connection_id",value:n}]},e[0]=n,e[1]=f):f=e[1];const u=ls(f);if(!(u.length>0)){let l;e[2]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Use in your IDE"}),e[2]=l):l=e[2];let j;return e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==o||e[7]!==a?(j=t.jsxs("div",{className:"p-5 flex items-center justify-between gap-3",children:[l,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:!1})]}),e[3]=r,e[4]=c,e[5]=n,e[6]=o,e[7]=a,e[8]=j):j=e[8],j}let x;e[9]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("h4",{className:"text-xs text-muted-foreground font-medium",children:"Agents"}),e[9]=x):x=e[9];let m;e[10]!==r||e[11]!==c||e[12]!==n||e[13]!==o||e[14]!==a?(m=t.jsx("div",{className:"flex flex-col gap-1",children:t.jsxs("div",{className:"flex items-center justify-between",children:[x,t.jsx(rt,{connectionId:n,connectionTitle:o,connectionDescription:r,connectionIcon:c,org:a,hasExistingVirtualMcps:!0})]})}),e[10]=r,e[11]=c,e[12]=n,e[13]=o,e[14]=a,e[15]=m):m=e[15];let i;if(e[16]!==a||e[17]!==u){let l;e[19]!==a?(l=j=>t.jsx(hs,{virtualMcp:j,org:a},j.id),e[19]=a,e[20]=l):l=e[20],i=u.map(l),e[16]=a,e[17]=u,e[18]=i}else i=e[18];let b;e[21]!==i?(b=t.jsx("div",{className:"flex flex-col gap-2",children:i}),e[21]=i,e[22]=b):b=e[22];let d;return e[23]!==m||e[24]!==b?(d=t.jsxs("div",{className:"p-5 flex flex-col gap-3",children:[m,b]}),e[23]=m,e[24]=b,e[25]=d):d=e[25],d}function js({form:s,connection:e,hasOAuthToken:n,onReauthenticate:o,onRemoveOAuth:r}){const c=Ge({control:s.control,name:"ui_type"}),a=Ge({control:s.control,name:"connection_url"}),{stdioEnabled:f}=vt(),u=(()=>{if(typeof a!="string"||!a)return!1;try{const i=new URL(a);return i.hostname==="api.githubcopilot.com"&&i.pathname.replace(/\/+$/,"")==="/mcp"}catch{return!1}})(),p=f||e.connection_type==="STDIO",x=e.connection_type==="VIRTUAL",m=x?Nt(e.connection_url):null;return x?t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Type"}),t.jsxs("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:[t.jsx(He,{className:"w-4 h-4 text-muted-foreground"}),t.jsx("span",{className:"text-sm",children:"Virtual MCP"})]}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"This connection references a Virtual MCP. Tools and resources are aggregated dynamically from the Virtual MCP's underlying connections."})]}),m&&t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Virtual MCP ID"}),t.jsx("div",{className:"flex items-center gap-2 h-10 px-3 border border-border rounded-lg bg-muted/50",children:t.jsx("code",{className:"text-sm text-muted-foreground",children:m})})]})]}):t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[t.jsx(G,{control:s.control,name:"ui_type",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Connection"}),c!=="NPX"&&c!=="STDIO"?t.jsxs("div",{className:"flex items-stretch rounded-lg border border-border overflow-hidden",children:[t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsxs(st,{className:"h-10 w-auto min-w-[90px] border-0 rounded-none bg-muted/50 focus:ring-0 focus:ring-offset-0",children:[t.jsx(Oe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),t.jsx(nt,{})]})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:"HTTP"}),t.jsx(Q,{value:"SSE",children:"SSE"}),t.jsx(Q,{value:"Websocket",children:"Websocket"}),p&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:"NPX Package"}),t.jsx(Q,{value:"STDIO",children:"Custom Command"})]})]})]}),t.jsx("div",{className:"w-px bg-border"}),t.jsx(G,{control:s.control,name:"connection_url",render:({field:b})=>t.jsx(J,{className:"flex-1 min-w-0",children:t.jsx(q,{children:t.jsx(ee,{placeholder:"https://example.com/mcp",...b,value:b.value??"",className:"h-10 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0 bg-transparent"})})})})]}):t.jsxs(tt,{value:i.value,onValueChange:i.onChange,children:[t.jsx(q,{children:t.jsx(st,{className:"h-10",children:t.jsx(nt,{})})}),t.jsxs(ot,{children:[t.jsx(Q,{value:"HTTP",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"HTTP"]})}),t.jsx(Q,{value:"SSE",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"SSE"]})}),t.jsx(Q,{value:"Websocket",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Oe,{className:"w-4 h-4"}),"Websocket"]})}),p&&t.jsxs(t.Fragment,{children:[t.jsx(Q,{value:"NPX",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(Jt,{className:"w-4 h-4"}),"NPX Package"]})}),t.jsx(Q,{value:"STDIO",children:t.jsxs("span",{className:"flex items-center gap-2",children:[t.jsx(rs,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),t.jsx(Z,{})]})}),c==="NPX"&&t.jsx(G,{control:s.control,name:"npx_package",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"NPM Package"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"@perplexity-ai/mcp-server",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),c==="STDIO"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[t.jsx(G,{control:s.control,name:"stdio_command",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Command"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"node, bun, python...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})}),t.jsx(G,{control:s.control,name:"stdio_args",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Arguments"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"arg1 arg2 --flag value",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Space-separated arguments"}),t.jsx(Z,{})]})})]}),t.jsx(G,{control:s.control,name:"stdio_cwd",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Working Directory"}),t.jsx(q,{children:t.jsx(ee,{placeholder:"/path/to/project (optional)",...i,value:i.value||"",className:"h-10 rounded-lg"})}),t.jsx(Z,{})]})})]}),(c==="NPX"||c==="STDIO")&&t.jsx(G,{control:s.control,name:"env_vars",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:"Environment Variables"}),t.jsx(q,{children:t.jsx($t,{value:i.value??[],onChange:i.onChange})}),t.jsx(Z,{})]})}),c!=="NPX"&&c!=="STDIO"&&t.jsx(G,{control:s.control,name:"connection_token",render:({field:i})=>t.jsxs(J,{className:"flex flex-col gap-3",children:[t.jsx(te,{className:"text-xs text-muted-foreground font-medium",children:u?"GitHub Personal Access Token":"Token"}),n?t.jsx("div",{className:"flex items-center gap-2",children:t.jsxs(Yt,{children:[t.jsx(Zt,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 cursor-pointer",children:t.jsxs(Be,{variant:"success",className:"gap-1.5",children:[t.jsx(pt,{size:12}),"Authenticated via OAuth",t.jsx(ns,{size:12})]})})}),t.jsxs(es,{align:"start",children:[t.jsxs(et,{onClick:o,children:[t.jsx(os,{size:16}),"Re-authenticate"]}),t.jsxs(et,{variant:"destructive",onClick:r,children:[t.jsx(is,{size:16}),"Remove OAuth"]})]})]})}):e.connection_token&&i.value===null?t.jsxs("div",{className:"relative group",children:[t.jsx("div",{className:"h-10 px-3 flex items-center rounded-lg border border-border bg-muted/50 text-muted-foreground font-mono text-sm",children:"••••••••••••••••"}),t.jsx("button",{type:"button",onClick:()=>i.onChange(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 rounded hover:bg-muted opacity-0 group-hover:opacity-100 transition-opacity",title:"Clear and replace token",children:t.jsx(cs,{size:14,className:"text-muted-foreground"})})]}):t.jsxs(t.Fragment,{children:[t.jsx(q,{children:t.jsx(ee,{type:"password",placeholder:u?"Paste your GitHub PAT":"Enter access token...",...i,value:i.value||"",className:"h-10 rounded-lg"})}),u&&t.jsxs(ss,{children:["Create a PAT at"," ",t.jsx("a",{href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"github.com/settings/personal-access-tokens"})]})]}),t.jsx(Z,{})]})})]})}function bs(s){const e=X.c(43),{form:n,connection:o,isMCPAuthenticated:r,hasOAuthToken:c,onReauthenticate:a,onRemoveOAuth:f}=s,{org:u}=at();let p;e[0]!==o.icon||e[1]!==o.title?(p=t.jsx(qe,{icon:o.icon,name:o.title,size:"lg",className:"shadow-sm"}),e[0]=o.icon,e[1]=o.title,e[2]=p):p=e[2];let x;e[3]!==n.control?(x=t.jsxs("div",{className:"flex flex-col",children:[t.jsx(G,{control:n.control,name:"title",render:Ns}),t.jsx(G,{control:n.control,name:"description",render:vs})]}),e[3]=n.control,e[4]=x):x=e[4];let m;e[5]!==p||e[6]!==x?(m=t.jsxs("div",{className:"flex flex-col gap-4 p-5 border-b border-border",children:[p,x]}),e[5]=p,e[6]=x,e[7]=m):m=e[7];let i;e[8]!==o||e[9]!==n||e[10]!==c||e[11]!==a||e[12]!==f?(i=t.jsx(js,{form:n,connection:o,hasOAuthToken:c,onReauthenticate:a,onRemoveOAuth:f}),e[8]=o,e[9]=n,e[10]=c,e[11]=a,e[12]=f,e[13]=i):i=e[13];let b;e[14]===Symbol.for("react.memo_cache_sentinel")?(b=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Status"}),e[14]=b):b=e[14];let d;e[15]!==r?(d=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b,r?t.jsxs(Be,{variant:"success",className:"gap-1.5 bg-success-foreground text-success",children:[t.jsx(pt,{size:12}),"Connected"]}):t.jsx(Be,{variant:"outline",className:"text-muted-foreground",children:"Not connected"})]}),e[15]=r,e[16]=d):d=e[16];let l;e[17]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Created by"}),e[17]=l):l=e[17];let j;e[18]!==o.created_by?(j=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[l,t.jsx(as,{id:o.created_by,size:"2xs"})]}),e[18]=o.created_by,e[19]=j):j=e[19];let T;e[20]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{className:"text-xs text-muted-foreground font-medium",children:"Updated"}),e[20]=T):T=e[20];let v;e[21]!==o.updated_at?(v=o.updated_at?ps(new Date(o.updated_at),{addSuffix:!0}):"Unknown",e[21]=o.updated_at,e[22]=v):v=e[22];let y;e[23]!==v?(y=t.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[T,t.jsx("span",{className:"text-sm text-foreground",children:v})]}),e[23]=v,e[24]=y):y=e[24];let _;e[25]!==y||e[26]!==d||e[27]!==j?(_=t.jsxs("div",{className:"flex flex-col gap-2 p-5 border-b border-border",children:[d,j,y]}),e[25]=y,e[26]=d,e[27]=j,e[28]=_):_=e[28];let N;e[29]!==o.description||e[30]!==o.icon||e[31]!==o.id||e[32]!==o.title||e[33]!==u.slug?(N=t.jsx(gs,{connectionId:o.id,connectionTitle:o.title,connectionDescription:o.description,connectionIcon:o.icon,org:u.slug}),e[29]=o.description,e[30]=o.icon,e[31]=o.id,e[32]=o.title,e[33]=u.slug,e[34]=N):N=e[34];let h;e[35]!==_||e[36]!==N||e[37]!==m||e[38]!==i?(h=t.jsxs("div",{className:"flex flex-col h-full overflow-auto",children:[m,i,_,N]}),e[35]=_,e[36]=N,e[37]=m,e[38]=i,e[39]=h):h=e[39];let k;return e[40]!==n||e[41]!==h?(k=t.jsx(ts,{...n,children:h}),e[40]=n,e[41]=h,e[42]=k):k=e[42],k}function vs(s){const{field:e}=s;return t.jsxs(J,{className:"w-full space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,value:e.value||"",className:"h-auto py-0.5 text-base text-muted-foreground leading-6 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Add a description..."})}),t.jsx(Z,{})]})}function Ns(s){const{field:e}=s;return t.jsxs(J,{className:"flex-1 space-y-0",children:[t.jsx(q,{children:t.jsx(ee,{...e,className:"h-auto py-0.5 text-lg! font-medium leading-7 px-2 -mx-2 border-transparent hover:bg-input/25 focus:border-input bg-transparent transition-all",placeholder:"Connection Name"})}),t.jsx(Z,{})]})}function ys(s){const e=X.c(42),{prompts:n,connectionId:o,org:r,connectionTitle:c,connectionIcon:a,onPromptClick:f,showToolbar:u,emptyMessage:p}=s,x=u===void 0?!0:u,m=p===void 0?"This connection doesn't have any prompts yet.":p,i=Ee(),d=ze().location.href,[l,j]=Y.useState(""),[T,v]=Y.useState("table"),[y,_]=Y.useState("name"),[N,h]=Y.useState("asc");let k;e[0]!==N||e[1]!==y?(k=S=>{y===S?(h(Ts),N==="desc"&&_(void 0)):(_(S),h("asc"))},e[0]=N,e[1]=y,e[2]=k):k=e[2];const B=k;let $;e[3]!==o||e[4]!==i||e[5]!==f||e[6]!==r?($=S=>{f?f(S):o&&r&&i({to:"/$org/$project/mcps/$connectionId/$collectionName/$itemId",params:{org:r,project:Se,connectionId:o,collectionName:"prompts",itemId:encodeURIComponent(S.name)}})},e[3]=o,e[4]=i,e[5]=f,e[6]=r,e[7]=$):$=e[7];const M=$;let A;if(e[8]!==n||e[9]!==l||e[10]!==N||e[11]!==y){const S=!n||n.length===0?[]:l.trim()?(()=>{const H=l.toLowerCase();return n.filter(K=>K.name.toLowerCase().includes(H)||K.description&&K.description.toLowerCase().includes(H))})():n;A=!y||!N?S:[...S].sort((H,K)=>{const se=H[y]||"",ne=K[y]||"",oe=String(se).localeCompare(String(ne));return N==="asc"?oe:-oe}),e[8]=n,e[9]=l,e[10]=N,e[11]=y,e[12]=A}else A=e[12];const I=A;let E;e[13]===Symbol.for("react.memo_cache_sentinel")?(E=[{id:"name",header:"Name",render:ws,sortable:!0},{id:"description",header:"Description",render:Ss,cellClassName:"flex-1",sortable:!0}],e[13]=E):E=e[13];const L=E;let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=L.filter(Cs).map(_s),e[14]=C):C=e[14];const z=C;let P;e[15]!==a||e[16]!==c||e[17]!==B||e[18]!==x||e[19]!==N||e[20]!==y||e[21]!==d||e[22]!==T?(P=x&&t.jsxs(We,{children:[t.jsx(xt,{viewMode:T,onViewModeChange:v,sortKey:y,sortDirection:N,onSort:B,sortOptions:z}),t.jsx(Xe,{title:c?`${c}: Prompts`:"Prompts",url:d,icon:a??"description"})]}),e[15]=a,e[16]=c,e[17]=B,e[18]=x,e[19]=N,e[20]=y,e[21]=d,e[22]=T,e[23]=P):P=e[23];let D;e[24]===Symbol.for("react.memo_cache_sentinel")?(D=S=>{S.key==="Escape"&&(j(""),S.target.blur())},e[24]=D):D=e[24];let V;e[25]!==l?(V=t.jsx(ht,{value:l,onChange:j,placeholder:"Search prompts...",onKeyDown:D}),e[25]=l,e[26]=V):V=e[26];let g;e[27]!==m||e[28]!==M||e[29]!==B||e[30]!==l||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==T?(g=T==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:I.length===0?t.jsx(ye,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":m}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:I.map(S=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>M(S),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(qe,{icon:null,name:S.name,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-0",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:S.name}),t.jsx("p",{className:"text-base text-muted-foreground line-clamp-2",children:S.description||"No description"})]})]})},S.name))})}):t.jsx(ft,{columns:L,data:I,isLoading:!1,sortKey:y,sortDirection:N,onSort:B,onRowClick:S=>M(S),emptyState:t.jsx(ye,{image:null,title:l?"No prompts found":"No prompts available",description:l?"Try adjusting your search terms":m})}),e[27]=m,e[28]=M,e[29]=B,e[30]=l,e[31]=N,e[32]=y,e[33]=I,e[34]=T,e[35]=g):g=e[35];let F;e[36]!==V||e[37]!==g?(F=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[V,g]}),e[36]=V,e[37]=g,e[38]=F):F=e[38];let O;return e[39]!==F||e[40]!==P?(O=t.jsxs(t.Fragment,{children:[P,F]}),e[39]=F,e[40]=P,e[41]=O):O=e[41],O}function _s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function Cs(s){return s.sortable}function Ss(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function ws(s){return t.jsx("span",{className:"text-sm font-medium font-mono text-foreground",children:s.name})}function Ts(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function ks(s){const e=X.c(6),{prompts:n,connectionId:o,org:r}=s,c=Ke(o),a=c?.title,f=c?.icon;let u;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==a||e[4]!==f?(u=t.jsx(ys,{prompts:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:f}),e[0]=o,e[1]=r,e[2]=n,e[3]=a,e[4]=f,e[5]=u):u=e[5],u}function Ps(s){const e=X.c(2),{repository:n}=s;let o;return e[0]!==n?(o=t.jsx("div",{className:"flex-1 overflow-y-auto bg-background",children:t.jsx(fs,{repository:n})}),e[0]=n,e[1]=o):o=e[1],o}function Is(s){const e=X.c(39),{resources:n,connectionTitle:o,connectionIcon:r,onResourceClick:c,showToolbar:a,emptyMessage:f}=s,u=a===void 0?!0:a,p=f===void 0?"This connection doesn't have any resources yet.":f,m=ze().location.href,[i,b]=Y.useState(""),[d,l]=Y.useState("table"),[j,T]=Y.useState("name"),[v,y]=Y.useState("asc");let _;e[0]!==v||e[1]!==j?(_=g=>{j===g?(y(Rs),v==="desc"&&T(void 0)):(T(g),y("asc"))},e[0]=v,e[1]=j,e[2]=_):_=e[2];const N=_;let h;e[3]!==c?(h=g=>{c&&c(g)},e[3]=c,e[4]=h):h=e[4];const k=h;let B;if(e[5]!==n||e[6]!==i||e[7]!==v||e[8]!==j){const g=!n||n.length===0?[]:i.trim()?(()=>{const F=i.toLowerCase();return n.filter(O=>O.uri.toLowerCase().includes(F)||O.name&&O.name.toLowerCase().includes(F)||O.description&&O.description.toLowerCase().includes(F))})():n;B=!j||!v?g:[...g].sort((F,O)=>{const S=F[j]||"",H=O[j]||"",K=String(S).localeCompare(String(H));return v==="asc"?K:-K}),e[5]=n,e[6]=i,e[7]=v,e[8]=j,e[9]=B}else B=e[9];const $=B;let M;e[10]===Symbol.for("react.memo_cache_sentinel")?(M=[{id:"name",header:"Name",render:Os,sortable:!0},{id:"uri",header:"URI",render:Ds,sortable:!0},{id:"description",header:"Description",render:Ms,cellClassName:"flex-1",sortable:!0},{id:"mimeType",header:"Type",render:Vs,sortable:!0}],e[10]=M):M=e[10];const A=M;let I;e[11]===Symbol.for("react.memo_cache_sentinel")?(I=A.filter(As).map($s),e[11]=I):I=e[11];const E=I;let L;e[12]!==r||e[13]!==o||e[14]!==N||e[15]!==u||e[16]!==v||e[17]!==j||e[18]!==m||e[19]!==d?(L=u&&t.jsxs(We,{children:[t.jsx(xt,{viewMode:d,onViewModeChange:l,sortKey:j,sortDirection:v,onSort:N,sortOptions:E}),t.jsx(Xe,{title:o?`${o}: Resources`:"Resources",url:m,icon:r??"folder"})]}),e[12]=r,e[13]=o,e[14]=N,e[15]=u,e[16]=v,e[17]=j,e[18]=m,e[19]=d,e[20]=L):L=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=g=>{g.key==="Escape"&&(b(""),g.target.blur())},e[21]=C):C=e[21];let z;e[22]!==i?(z=t.jsx(ht,{value:i,onChange:b,placeholder:"Search resources...",onKeyDown:C}),e[22]=i,e[23]=z):z=e[23];let P;e[24]!==p||e[25]!==k||e[26]!==N||e[27]!==i||e[28]!==v||e[29]!==j||e[30]!==$||e[31]!==d?(P=d==="cards"?t.jsx("div",{className:"flex-1 overflow-auto p-5",children:$.length===0?t.jsx(ye,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":p}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:$.map(g=>t.jsx(gt,{className:"cursor-pointer transition-colors",onClick:()=>k(g),children:t.jsxs("div",{className:"flex flex-col gap-4 p-6",children:[t.jsx(qe,{icon:null,name:g.name||g.uri,size:"md",className:"shrink-0 shadow-sm"}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h3",{className:"text-base font-medium text-foreground truncate",children:g.name||g.uri}),t.jsx("p",{className:"text-xs font-mono text-muted-foreground truncate",children:g.uri}),g.description&&t.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:g.description})]})]})},g.uri))})}):t.jsx(ft,{columns:A,data:$,isLoading:!1,sortKey:j,sortDirection:v,onSort:N,onRowClick:g=>k(g),emptyState:t.jsx(ye,{image:null,title:i?"No resources found":"No resources available",description:i?"Try adjusting your search terms":p})}),e[24]=p,e[25]=k,e[26]=N,e[27]=i,e[28]=v,e[29]=j,e[30]=$,e[31]=d,e[32]=P):P=e[32];let D;e[33]!==z||e[34]!==P?(D=t.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[z,P]}),e[33]=z,e[34]=P,e[35]=D):D=e[35];let V;return e[36]!==D||e[37]!==L?(V=t.jsxs(t.Fragment,{children:[L,D]}),e[36]=D,e[37]=L,e[38]=V):V=e[38],V}function $s(s){return{id:s.id,label:typeof s.header=="string"?s.header:s.id}}function As(s){return s.sortable}function Vs(s){return t.jsx("span",{className:"text-sm text-muted-foreground",children:s.mimeType||"—"})}function Ms(s){return t.jsx("span",{className:"text-sm text-foreground",children:s.description||"—"})}function Ds(s){return t.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:s.uri})}function Os(s){return t.jsx("span",{className:"text-sm font-medium text-foreground",children:s.name||s.uri})}function Rs(s){return s==="asc"?"desc":s==="desc"?null:"asc"}function Es(s){const e=X.c(6),{resources:n,connectionId:o,org:r}=s,c=Ke(o),a=c?.title,f=c?.icon;let u;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==a||e[4]!==f?(u=t.jsx(Is,{resources:n,connectionId:o,org:r,connectionTitle:a,connectionIcon:f}),e[0]=o,e[1]=r,e[2]=n,e[3]=a,e[4]=f,e[5]=u):u=e[5],u}const Ls=lt({key:W().min(1,"Key is required"),value:W()}),Us=lt({title:W().min(1,"Name is required"),description:W().nullable().optional(),ui_type:Ct(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:W().optional(),connection_token:W().nullable().optional(),npx_package:W().optional(),stdio_command:W().optional(),stdio_args:W().optional(),stdio_cwd:W().optional(),env_vars:Je(Ls).optional(),configuration_scopes:Je(W()).nullable().optional(),configuration_state:yt(W(),_t()).nullable().optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function Fs(s){const e=X.c(5),{tools:n,connectionId:o,org:r,isLoading:c}=s;let a;return e[0]!==o||e[1]!==c||e[2]!==r||e[3]!==n?(a=t.jsx(xs,{tools:n,connectionId:o,org:r,isLoading:c}),e[0]=o,e[1]=c,e[2]=r,e[3]=n,e[4]=a):a=e[4],a}function Bs(s){return s.command==="npx"}function zs(s){return s.args?.find(e=>!e.startsWith("-"))??""}function Xs(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function Ks(s,e){const n={command:"npx",args:["-y",s]},o=mt(e);return Object.keys(o).length>0&&(n.envVars=o),n}function Ws(s,e,n,o){const r={command:s};e.trim()&&(r.args=e.trim().split(/\s+/)),n?.trim()&&(r.cwd=n.trim());const c=mt(o);return Object.keys(c).length>0&&(r.envVars=c),r}function it(s,e){const n={title:s.title,description:s.description??"",configuration_state:s.configuration_state??{},configuration_scopes:s.configuration_scopes||[]};if(s.connection_type==="STDIO"&&It(s.connection_headers)){const o=s.connection_headers,r=At(o.envVars);if(Bs(o)){const a=zs(o);return{...n,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:a,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:r}}const c=Xs(o);return{...n,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:c.command,stdio_args:c.args,stdio_cwd:c.cwd,env_vars:r}}return{...n,ui_type:s.connection_type,connection_url:s.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}function qs(s){let e,n=null,o=null,r=null;return s.ui_type==="NPX"?(e="STDIO",n="",r=Ks(s.npx_package||"",s.env_vars||[])):s.ui_type==="STDIO"?(e="STDIO",n="",r=Ws(s.stdio_command||"",s.stdio_args||"",s.stdio_cwd,s.env_vars||[])):(e=s.ui_type,n=s.connection_url||"",o=s.connection_token||null),{title:s.title,description:s.description||null,connection_type:e,connection_url:n,...o&&{connection_token:o},...r&&{connection_headers:r},configuration_state:s.configuration_state??null,configuration_scopes:s.configuration_scopes??null}}function Hs(s){const e=X.c(117),{connection:n,connectionId:o,org:r,requestedTabId:c,collections:a,onUpdate:f,isUpdating:u,prompts:p,resources:x,tools:m,isLoadingTools:i}=s;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b={from:"/$org/$project/mcps/$connectionId"},e[0]=b):b=e[0];const d=Ee(b),l=Tt(),T=ze().location.href,v=ut();let y;e[1]!==o?(y={connectionId:o},e[1]=o,e[2]=y):y=e[2];const _=Ot(y),h=n?.connection_type==="VIRTUAL"||_.isAuthenticated;let k;e[3]!==n?(k={connections:[n],binding:"MCP"},e[3]=n,e[4]=k):k=e[4];const $=Dt(k).length>0,M=n?.metadata?.repository,A=!!M?.url;let I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=kt(Us),e[5]=I):I=e[5];let E;e[6]!==n?(E=it(n),e[6]=n,e[7]=E):E=e[7];let L;e[8]!==E?(L={resolver:I,values:E},e[8]=E,e[9]=L):L=e[9];const C=Pt(L),z=C.formState.isDirty;let P;e[10]!==C||e[11]!==f?(P=async()=>{if(!await C.trigger())return;const U=C.getValues(),Ne=qs(U);await f(Ne),C.reset(U)},e[10]=C,e[11]=f,e[12]=P):P=e[12];const D=P;let V;e[13]!==n||e[14]!==C?(V=()=>{C.reset(it(n))},e[13]=n,e[14]=C,e[15]=V):V=e[15];const g=V;let F;e[16]!==n.id||e[17]!==v||e[18]!==l?(F=async()=>{const{token:w,tokenInfo:U,error:Ne}=await Bt({connectionId:n.id});if(Ne||!w){Ce.error(`Authentication failed: ${Ne}`);return}if(U)try{const De=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accessToken:U.accessToken,refreshToken:U.refreshToken,expiresIn:U.expiresIn,scope:U.scope,clientId:U.clientId,clientSecret:U.clientSecret,tokenEndpoint:U.tokenEndpoint})});if(!De.ok)console.error("Failed to save OAuth token:",await De.text()),await v.update.mutateAsync({id:n.id,data:{connection_token:w}});else try{await v.update.mutateAsync({id:n.id,data:{}})}catch(Qe){console.warn("Failed to refresh connection tools after OAuth:",Qe)}}catch(De){console.error("Error saving OAuth token:",De),await v.update.mutateAsync({id:n.id,data:{connection_token:w}})}else await v.update.mutateAsync({id:n.id,data:{connection_token:w}});const bt=new URL(`/mcp/${n.id}`,window.location.origin);await l.invalidateQueries({queryKey:Ye.isMCPAuthenticated(bt.href,null)}),Ce.success("Authentication successful")},e[16]=n.id,e[17]=v,e[18]=l,e[19]=F):F=e[19];const O=F;let S;e[20]!==n.id||e[21]!==l?(S=async()=>{try{const w=await fetch(`/api/connections/${n.id}/oauth-token`,{method:"DELETE",credentials:"include"});if(!w.ok){const Ne=await w.text();Ce.error(`Failed to remove OAuth: ${Ne}`);return}const U=new URL(`/mcp/${n.id}`,window.location.origin);await l.invalidateQueries({queryKey:Ye.isMCPAuthenticated(U.href,null)}),Ce.success("OAuth removed. You can now re-authenticate with a different account.")}catch(w){console.error("Error removing OAuth token:",w),Ce.error("Failed to remove OAuth")}},e[20]=n.id,e[21]=l,e[22]=S):S=e[22];const H=S,K=m.length,se=p.length,ne=x.length,oe=K>0||i;let we;e[23]===Symbol.for("react.memo_cache_sentinel")?(we={id:"settings",label:"Settings"},e[23]=we):we=e[23];let re;e[24]!==i||e[25]!==h||e[26]!==oe||e[27]!==K?(re=h&&oe?[{id:"tools",label:"Tools",count:i?void 0:K}]:[],e[24]=i,e[25]=h,e[26]=oe,e[27]=K,e[28]=re):re=e[28];let ie;e[29]!==h||e[30]!==se?(ie=h&&se>0?[{id:"prompts",label:"Prompts",count:se}]:[],e[29]=h,e[30]=se,e[31]=ie):ie=e[31];let ce;e[32]!==h||e[33]!==ne?(ce=h&&ne>0?[{id:"resources",label:"Resources",count:ne}]:[],e[32]=h,e[33]=ne,e[34]=ce):ce=e[34];let Te;if(e[35]!==a||e[36]!==A||e[37]!==h||e[38]!==re||e[39]!==ie||e[40]!==ce){let w;e[42]!==A?(w=A?[{id:"readme",label:"README"}]:[],e[42]=A,e[43]=w):w=e[43],Te=[we,...re,...ie,...ce,...h?(a||[]).map(Gs):[],...w],e[35]=a,e[36]=A,e[37]=h,e[38]=re,e[39]=ie,e[40]=ce,e[41]=Te}else Te=e[41];const _e=Te,jt=h&&_e.some(Qs)?"tools":"settings",R=_e.some(w=>w.id===c)?c:jt;let ke;e[44]!==d?(ke=w=>{d({search:U=>({...U,tab:w}),replace:!0})},e[44]=d,e[45]=ke):ke=e[45];const ae=ke;let le;e[46]!==a?(le=a||[],e[46]=a,e[47]=le):le=e[47];let Pe;if(e[48]!==R||e[49]!==le){let w;e[51]!==R?(w=U=>U.name===R,e[51]=R,e[52]=w):w=e[52],Pe=le.find(w),e[48]=R,e[49]=le,e[50]=Pe}else Pe=e[50];const Ie=Pe;let de;e[53]!==r?(de=t.jsx(Ze,{children:t.jsx(Xt,{asChild:!0,children:t.jsx(ct,{to:"/$org/$project/mcps",params:{org:r,project:Se},children:"Connections"})})}),e[53]=r,e[54]=de):de=e[54];let $e;e[55]===Symbol.for("react.memo_cache_sentinel")?($e=t.jsx(Kt,{}),e[55]=$e):$e=e[55];let me;e[56]!==n.title?(me=t.jsx(Ze,{children:t.jsx(zt,{children:n.title})}),e[56]=n.title,e[57]=me):me=e[57];let Ae;e[58]!==de||e[59]!==me?(Ae=t.jsx(Wt,{children:t.jsxs(qt,{children:[de,$e,me]})}),e[58]=de,e[59]=me,e[60]=Ae):Ae=e[60];const Le=Ae;let ue;e[61]!==D||e[62]!==g||e[63]!==z||e[64]!==u?(ue=t.jsx(Vt,{onSave:D,onUndo:g,isDirty:z,isSaving:u}),e[61]=D,e[62]=g,e[63]=z,e[64]=u,e[65]=ue):ue=e[65];const Ue=n.icon??"settings";let pe;e[66]!==n.title||e[67]!==Ue||e[68]!==T?(pe=t.jsx(Xe,{title:n.title,url:T,icon:Ue}),e[66]=n.title,e[67]=Ue,e[68]=T,e[69]=pe):pe=e[69];let fe;e[70]!==ue||e[71]!==pe?(fe=t.jsxs(We,{children:[ue,pe]}),e[70]=ue,e[71]=pe,e[72]=fe):fe=e[72];let xe;e[73]!==_.hasOAuthToken||e[74]!==n||e[75]!==C||e[76]!==O||e[77]!==H||e[78]!==h?(xe=t.jsx("div",{className:"w-100 shrink-0 border-r border-border bg-background",children:t.jsx(bs,{form:C,connection:n,isMCPAuthenticated:h,hasOAuthToken:_.hasOAuthToken,onReauthenticate:O,onRemoveOAuth:H})}),e[73]=_.hasOAuthToken,e[74]=n,e[75]=C,e[76]=O,e[77]=H,e[78]=h,e[79]=xe):xe=e[79];let he;e[80]!==R||e[81]!==ae||e[82]!==_e?(he=t.jsx("div",{className:"shrink-0 flex items-center gap-4 px-5 py-3 border-b border-border",children:t.jsx(Ht,{tabs:_e,activeTab:R,onTabChange:ae,className:"flex-1"})}),e[80]=R,e[81]=ae,e[82]=_e,e[83]=he):he=e[83];let Ve;e[84]===Symbol.for("react.memo_cache_sentinel")?(Ve=t.jsx("div",{className:"flex h-full items-center justify-center",children:t.jsx(Re,{size:32,className:"animate-spin text-muted-foreground"})}),e[84]=Ve):Ve=e[84];let ge;e[85]!==Ie||e[86]!==R||e[87]!==_.isServerError||e[88]!==_.supportsOAuth||e[89]!==n||e[90]!==o||e[91]!==C||e[92]!==O||e[93]!==ae||e[94]!==$||e[95]!==A||e[96]!==i||e[97]!==h||e[98]!==r||e[99]!==p||e[100]!==M||e[101]!==x||e[102]!==m?(ge=t.jsx(Y.Suspense,{fallback:Ve,children:R==="tools"?t.jsx(Fs,{tools:m,connectionId:o,org:r,isLoading:i}):R==="prompts"?t.jsx(ks,{prompts:p,connectionId:o,org:r}):R==="resources"?t.jsx(Es,{resources:x,connectionId:o,org:r}):R==="settings"?t.jsx(Rt,{connection:n,form:C,hasMcpBinding:$,isMCPAuthenticated:h,supportsOAuth:_.supportsOAuth,isServerError:_.isServerError,onAuthenticate:O,onViewReadme:A?()=>ae("readme"):void 0}):R==="readme"&&A?t.jsx(Ps,{repository:M}):Ie&&h?t.jsx(Gt,{connectionId:o,org:r,activeCollection:Ie},R):t.jsx(ye,{title:"Collection not found",description:"This collection may have been deleted or you may not have access."})}),e[85]=Ie,e[86]=R,e[87]=_.isServerError,e[88]=_.supportsOAuth,e[89]=n,e[90]=o,e[91]=C,e[92]=O,e[93]=ae,e[94]=$,e[95]=A,e[96]=i,e[97]=h,e[98]=r,e[99]=p,e[100]=M,e[101]=x,e[102]=m,e[103]=ge):ge=e[103];let je;e[104]!==R||e[105]!==ge?(je=t.jsx("div",{className:"flex-1 overflow-auto",children:t.jsx(dt,{children:ge},R)}),e[104]=R,e[105]=ge,e[106]=je):je=e[106];let be;e[107]!==he||e[108]!==je?(be=t.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-hidden",children:[he,je]}),e[107]=he,e[108]=je,e[109]=be):be=e[109];let ve;e[110]!==xe||e[111]!==be?(ve=t.jsxs("div",{className:"flex h-full w-full bg-background overflow-hidden",children:[xe,be]}),e[110]=xe,e[111]=be,e[112]=ve):ve=e[112];let Me;return e[113]!==Le||e[114]!==fe||e[115]!==ve?(Me=t.jsxs(Qt,{breadcrumb:Le,children:[fe,ve]}),e[113]=Le,e[114]=fe,e[115]=ve,e[116]=Me):Me=e[116],Me}function Qs(s){return s.id==="tools"}function Gs(s){return{id:s.name,label:s.displayName}}function Js(){const s=X.c(43);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/$org/$project/mcps/$connectionId"},s[0]=e):e=s[0];const n=Ee(e);let o;s[1]===Symbol.for("react.memo_cache_sentinel")?(o={from:"/shell/$org/$project/mcps/$connectionId"},s[1]=o):o=s[1];const{connectionId:r,org:c}=St(o),{org:a}=at();let f;s[2]===Symbol.for("react.memo_cache_sentinel")?(f={from:"/shell/$org/$project/mcps/$connectionId"},s[2]=f):f=s[2];const p=wt(f).tab??"",x=Ke(r),m=ut(),i=Mt(x??void 0);let b;s[3]!==r||s[4]!==a.id?(b={connectionId:r,orgId:a.id},s[3]=r,s[4]=a.id,s[5]=b):b=s[5];const d=Et(b);let l;s[6]!==d?(l={client:d},s[6]=d,s[7]=l):l=s[7];const{data:j}=Ut(l);let T;s[8]!==d?(T={client:d},s[8]=d,s[9]=T):T=s[9];const{data:v}=Ft(T),_=!(x?.connection_type==="VIRTUAL")&&x?.tools&&x.tools.length>0,N=!_;let h;s[10]!==d||s[11]!==N?(h={client:d,enabled:N},s[10]=d,s[11]=N,s[12]=h):h=s[12];const{data:k,isLoading:B}=Lt(h);let $;s[13]!==j?.prompts?($=j?.prompts??[],s[13]=j?.prompts,s[14]=$):$=s[14];let M;s[15]!==$?(M=$.map(en),s[15]=$,s[16]=M):M=s[16];const A=M;let I;s[17]!==v?.resources?(I=v?.resources??[],s[17]=v?.resources,s[18]=I):I=s[18];let E;s[19]!==I?(E=I.map(Zs),s[19]=I,s[20]=E):E=s[20];const L=E;let C;s[21]!==x||s[22]!==_||s[23]!==k?.tools?(C=_?x.tools??[]:(k?.tools??[]).map(Ys),s[21]=x,s[22]=_,s[23]=k?.tools,s[24]=C):C=s[24];const z=C;let P;s[25]!==m.update||s[26]!==r?(P=async g=>{await m.update.mutateAsync({id:r,data:g})},s[25]=m.update,s[26]=r,s[27]=P):P=s[27];const D=P;if(!x){let g;return s[28]!==n||s[29]!==c?(g=t.jsx("div",{className:"flex h-full w-full bg-background",children:t.jsx(ye,{title:"Connection not found",description:"This connection may have been deleted or you may not have access.",actions:t.jsx(Fe,{variant:"outline",onClick:()=>n({to:"/$org/$project/mcps",params:{org:c,project:Se}}),children:"Back to connections"})})}),s[28]=n,s[29]=c,s[30]=g):g=s[30],g}let V;return s[31]!==m.update.isPending||s[32]!==i||s[33]!==x||s[34]!==r||s[35]!==D||s[36]!==B||s[37]!==c||s[38]!==A||s[39]!==p||s[40]!==L||s[41]!==z?(V=t.jsx(Hs,{org:c,connection:x,connectionId:r,requestedTabId:p,collections:i,onUpdate:D,isUpdating:m.update.isPending,prompts:A,resources:L,tools:z,isLoadingTools:B}),s[31]=m.update.isPending,s[32]=i,s[33]=x,s[34]=r,s[35]=D,s[36]=B,s[37]=c,s[38]=A,s[39]=p,s[40]=L,s[41]=z,s[42]=V):V=s[42],V}function Ys(s){return{name:s.name,description:s.description,inputSchema:s.inputSchema}}function Zs(s){return{uri:s.uri,name:s.name,description:s.description}}function en(s){return{name:s.name,description:s.description}}function tn(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(dt,{children:t.jsx(Y.Suspense,{fallback:t.jsx("div",{className:"flex h-full items-center justify-center bg-background",children:t.jsx(Re,{size:32,className:"animate-spin text-muted-foreground"})}),children:t.jsx(Js,{})})}),s[0]=e):e=s[0],e}function Fo(){const s=X.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx(tn,{}),s[0]=e):e=s[0],e}export{Fo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as de,j as e,r as R,u as Ce,m as be,f as ke,g as Ne,ai as we,k as Se,h as De,i as Pe,O as h,o as me,aj as Te,s as v,ak as Ie}from"./index-Bn2rDd42.js";import{g as $e}from"./generate-id-Dyweu44Y.js";import{C as Ve,a as Ae}from"./collection-table-wrapper-CFNweZN1.js";import{C as Ee}from"./collection-search-Cyt8_oQV.js";import{C as Me}from"./connection-card-BGd7kcn-.js";import{B as F}from"./badge-BklHLRcK.js";import{i as Oe}from"./AlertCircle-C_hR5usO.js";import{i as Be}from"./CheckCircle-DRhauZbp.js";import{E as H}from"./empty-state--JD6ZxUc.js";import{E as Fe}from"./error-boundary-DlgelpJG.js";import{n as z,I as He}from"./integration-icon-C8seGsuO.js";import{P as I}from"./index-BHu7Lc_d.js";import{u as ze,U as ee,s as te}from"./use-list-state-D_1V56-b.js";import{u as Ue}from"./use-binding-Dgjl_Htk.js";import{f as Re,e as Le}from"./registry-utils-BsLp7zXK.js";import{f as Xe,a as We,b as Ke,c as Ge,d as qe,e as Ye,A as Je,g as Qe}from"./alert-dialog-BxcV0D_1.js";import{B as Ze,a as et,b as tt,c as nt}from"./breadcrumb-B_Yxwj4p.js";import{B as C}from"./button-CcO5M7F7.js";import{D as st,a as ot,b as rt,c as it,d as at,e as ct}from"./dialog-B_iTVR3h.js";import{D as ne,a as se,b as oe,c as E}from"./dropdown-menu-BTPpCOPE.js";import{a as lt,F as x,b as g,c as j,d as f,f as y}from"./form-CSsv2IBt.js";import{I as k}from"./input-DBvMwxwE.js";import{S as dt,a as mt,b as ut,c as pt,d as $}from"./select-J2aavKNi.js";import{T as ht}from"./textarea-CKlKOzV4.js";import{g as xt,h as gt}from"./use-connection-CVk8Bzpz.js";import{u as jt}from"./constants-DuSOM18S.js";import{b as ft}from"./use-mcp-tools-Ddi2i1Nb.js";import{i as re}from"./DotsVertical-gLXmVMYI.js";import{s as U}from"./Globe02-Dp5eUbS2.js";import{i as yt}from"./Loading01-D8zw0cyg.js";import{i as vt}from"./Terminal-CyioLjuI.js";import{s as ie}from"./Trash01-CLqhrRia.js";import{r as _t,E as Ct,e as ue}from"./env-vars-editor-B4EebJEK.js";import{d as bt}from"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowUp-DnJUZ1OS.js";import"./Check-Sa4xK5Hg.js";import"./Grid01-CSAsqBFD.js";import"./List-kXpaJIIp.js";import"./view-mode-toggle-CJkT6m07.js";import"./utils-Ckc2UwOp.js";import"./table-BNxQWMxG.js";import"./SearchMd-CGuwiAQe.js";import"./card-BNt4WjQv.js";import"./index-DZ7G-bvr.js";import"./avatar-D3z5_V3I.js";import"./useQuery-Ct96KcZp.js";import"./use-mobile-p03CcGW0.js";import"./binder-ak1AkjZY.js";import"./ChevronRight-By4KEpZh.js";import"./X-CuhyLwhM.js";import"./label-BjQxQJkg.js";import"./ChevronDown-DmXLJeAy.js";import"./useMutation-CnTeRHmv.js";import"./Plus-BBD2SckJ.js";function ae(s){const n=de.c(3),{status:i}=s;if(i==="active"){let c;return n[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(F,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(Be,{size:12}),"Active"]}),n[0]=c):c=n[0],c}if(i==="error"){let c;return n[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(F,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Oe,{size:12}),"Error"]}),n[1]=c):c=n[1],c}let d;return n[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(F,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),n[2]=d):d=n[2],d}function ce(s){const n=bt(new Date,s);return n<60?"<1m":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:n<2592e3?`${Math.floor(n/604800)}w ago`:n<31536e3?`${Math.floor(n/2592e3)}mo ago`:`${Math.floor(n/31536e3)}y ago`}const kt=me({key:v(),value:v()}),Nt=me({title:v().min(1,"Name is required"),description:v().nullable().optional(),ui_type:Ie(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:v().optional(),connection_token:v().nullable().optional(),npx_package:v().optional(),stdio_command:v().optional(),stdio_args:v().optional(),stdio_cwd:v().optional(),env_vars:Te(kt).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function O(s){const n=s.trim();if(!n)return"";try{const i=new URL(n),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return n.replace(/\/+$/,"")}}function wt(s){const n=s.trim().split(/\s+/).filter(Boolean);if(n.length<2)return null;const i=n[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=n.slice(1).find(a=>!a.startsWith("-"));return c?{packageName:c}:null}function M(s){const{uiType:n}=s,i=O(s.connectionUrl??"");if((n==="HTTP"||n==="SSE"||n==="Websocket")&&i===O("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(s.npxPackage??"").trim();return n==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function le(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const n=O(s.connectionUrl??"");if(!n)return null;const i=s.registryItems.find(a=>(a.server?.remotes??[]).some(N=>O(N.url??"")===n));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function St(s,n){const i={command:"npx",args:["-y",s]},d=ue(n);return Object.keys(d).length>0&&(i.envVars=d),i}function Dt(s,n,i,d){const c={command:s};n.trim()&&(c.args=n.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const a=ue(d);return Object.keys(a).length>0&&(c.envVars=a),c}function Pt(s){return s.command==="npx"}function Tt(s){return s.args?.find(n=>!n.startsWith("-"))??""}function It(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function $t(s,n){switch(n.type){case"edit":return{mode:"editing",connection:n.connection};case"delete":return{mode:"deleting",connection:n.connection};case"close":return{mode:"idle"}}}function Vt(){const{org:s}=Ce(),n=be(),i=ke({strict:!1}),{data:d}=Ne.useSession(),{stdioEnabled:c}=we(),a=ze({namespace:s.slug,resource:"connections"}),V=xt(),N=gt(a),[_,w]=R.useReducer($t,{mode:"idle"}),L=Ue(N)[0],X=L?.id??"",W=Re(L?.tools),pe=jt({connectionId:X||null,orgId:s.id}),{data:he}=ft({client:pe,toolName:W,toolArguments:{limit:200},enabled:!!(X&&W),staleTime:3600*1e3,select:t=>t.structuredContent??t}),K=Le(he??[]),G=i.action==="create",xe=()=>{n({to:"/$org/$project/mcps",params:{org:s.slug,project:h},search:{action:"create"}})},q=()=>{n({to:"/$org/$project/mcps",params:{org:s.slug,project:h},search:{}})},r=Se({resolver:De(Nt),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),Y=r.watch("connection_url"),ge=r.watch("npx_package"),P=M({uiType:u,connectionUrl:Y??"",npxPackage:ge??""})??le({uiType:u,connectionUrl:Y??"",registryItems:K}),m=_.mode==="editing"?_.connection:null;R.useEffect(()=>{if(m){const t=Pe(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const o=_t(t.envVars);if(Pt(t)){const l=Tt(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:o})}else{const l=It(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:l.command,stdio_args:l.args,stdio_cwd:l.cwd,env_vars:o})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const je=async()=>{if(_.mode!=="deleting")return;const t=_.connection.id;w({type:"close"});try{await V.delete.mutateAsync(t)}catch{}},fe=async t=>{let o,l=null,S=null,b=null;if(t.ui_type==="NPX"?(o="STDIO",l="",b=St(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(o="STDIO",l="",b=Dt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(o=t.ui_type,l=t.connection_url||"",S=t.connection_token||null),m){await V.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:o,connection_url:l,...S&&{connection_token:S},...b&&{connection_headers:b}}}),w({type:"close"}),r.reset();return}const D=$e("conn");await V.create.mutateAsync({id:D,title:t.title,description:t.description||null,connection_type:o,connection_url:l,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:b,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),q(),r.reset(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:D}})},J=t=>{t||(G?q():w({type:"close"}),r.reset())},A=t=>{const o=t.trim();if(!o)return;const l=!!r.formState.dirtyFields.title,S=!!r.formState.dirtyFields.description,b=!!r.formState.dirtyFields.env_vars,D=p=>{if(p&&(!l&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!S&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!b&&p.envVarKeys?.length)){const Q=r.getValues("env_vars")??[],_e=new Set(Q.map(T=>T.key)),Z=p.envVarKeys.filter(T=>!_e.has(T));Z.length>0&&r.setValue("env_vars",[...Q,...Z.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},B=wt(o);if(B&&c){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",B.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),D(M({uiType:"NPX",npxPackage:B.packageName}));return}if(o.startsWith("http://")||o.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",o,{shouldDirty:!0}),D(M({uiType:p,connectionUrl:o})??le({uiType:p,connectionUrl:o,registryItems:K}));return}u==="NPX"&&D(M({uiType:"NPX",npxPackage:o}))},ye=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(He,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(z,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(ae,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(ee,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?ce(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(re,{size:20})})}),e.jsxs(oe,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs(E,{onClick:o=>{o.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}})},children:[e.jsx(te,{size:16}),"Open"]}),e.jsxs(E,{variant:"destructive",onClick:o=>{o.stopPropagation(),w({type:"delete",connection:t})},children:[e.jsx(ie,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],ve=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(C,{onClick:xe,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(I,{children:[e.jsx(st,{open:G||_.mode==="editing",onOpenChange:J,children:e.jsxs(ot,{className:"sm:max-w-[525px]",children:[e.jsxs(rt,{children:[e.jsx(it,{children:m?"Edit Connection":"Create Connection"}),e.jsx(at,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(lt,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(fe),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(x,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Type *"}),e.jsxs(dt,{value:t.value,onValueChange:t.onChange,children:[e.jsx(f,{children:e.jsx(mt,{children:e.jsx(ut,{})})}),e.jsxs(pt,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Websocket"]})}),c&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(vt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(y,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(x,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"NPM Package *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:o=>{const l=o.clipboardData.getData("text");l&&(o.preventDefault(),r.setValue("npx_package",l.trim(),{shouldDirty:!0}),A(l))},onBlur:o=>{A(o.target.value),t.onBlur()}})}),e.jsx(y,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(x,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Command *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Arguments"}),e.jsx(f,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(y,{})]})})]}),e.jsx(x,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Working Directory"}),e.jsx(f,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(y,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(x,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Environment Variables"}),e.jsx(f,{children:e.jsx(Ct,{value:t.value??[],onChange:t.onChange})}),e.jsx(y,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"URL *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:o=>{const l=o.clipboardData.getData("text");l&&(o.preventDefault(),r.setValue("connection_url",l.trim(),{shouldDirty:!0}),A(l))},onBlur:o=>{A(o.target.value),t.onBlur()}})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:P?.token?.label??"Token (optional)"}),e.jsx(f,{children:e.jsx(k,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(y,{})]})})]}),e.jsx(x,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Name *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Description"}),e.jsx(f,{children:e.jsx(ht,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(y,{})]})})]}),e.jsxs(ct,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>J(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(Xe,{open:_.mode==="deleting",onOpenChange:t=>!t&&w({type:"close"}),children:e.jsxs(We,{children:[e.jsxs(Ke,{children:[e.jsx(Ge,{children:"Delete Connection?"}),e.jsxs(qe,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:_.mode==="deleting"&&_.connection.title}),"."]})]}),e.jsxs(Ye,{children:[e.jsx(Je,{children:"Cancel"}),e.jsx(Qe,{onClick:je,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsxs(I.Header,{children:[e.jsx(I.Header.Left,{children:e.jsx(Ze,{children:e.jsx(et,{children:e.jsx(tt,{children:e.jsx(nt,{children:"Connections"})})})})}),e.jsxs(I.Header.Right,{children:[e.jsx(Ve,{viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),ve]})]}),e.jsx(Ee,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),e.jsx(I.Content,{children:a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(Me,{connection:t,fallbackIcon:e.jsx(z,{}),onClick:()=>n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}}),headerActions:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(re,{size:20})})}),e.jsxs(oe,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs(E,{onClick:o=>{o.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}})},children:[e.jsx(te,{size:16}),"Open"]}),e.jsxs(E,{variant:"destructive",onClick:o=>{o.stopPropagation(),w({type:"delete",connection:t})},children:[e.jsx(ie,{size:16}),"Delete"]})]})]}),body:e.jsx(ae,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ee,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?ce(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Ae,{columns:ye,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}}),emptyState:a.search?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),children:"Browse Store"})})})})})})})]})}function En(){const s=de.c(1);let n;return s[0]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx(Fe,{children:e.jsx(R.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(yt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Vt,{})})}),s[0]=n):n=s[0],n}export{En as default};
|
|
1
|
+
import{c as de,j as e,r as R,u as Ce,m as be,f as ke,g as Ne,ai as we,k as Se,h as De,i as Pe,O as h,o as me,aj as Te,s as v,ak as Ie}from"./index-HxeE9C0A.js";import{g as $e}from"./generate-id-Dyweu44Y.js";import{C as Ve,a as Ae}from"./collection-table-wrapper-B6XWzQ-4.js";import{C as Ee}from"./collection-search-D3a5_1zR.js";import{C as Me}from"./connection-card-DkCny6Ez.js";import{B as F}from"./badge-C898LHvV.js";import{i as Oe}from"./AlertCircle-TbirTaeA.js";import{i as Be}from"./CheckCircle-CSYoAEm3.js";import{E as H}from"./empty-state-CH3e4Xzf.js";import{E as Fe}from"./error-boundary-BGFWaL1J.js";import{n as z,I as He}from"./integration-icon-CmJggqPx.js";import{P as I}from"./index-wUnd_o-U.js";import{u as ze,U as ee,s as te}from"./use-list-state-CqdwrHCA.js";import{u as Ue}from"./use-binding-BIvDtNoa.js";import{f as Re,e as Le}from"./registry-utils-CLfG2KJO.js";import{f as Xe,a as We,b as Ke,c as Ge,d as qe,e as Ye,A as Je,g as Qe}from"./alert-dialog-B1nWkQHx.js";import{B as Ze,a as et,b as tt,c as nt}from"./breadcrumb-t_Ccp20G.js";import{B as C}from"./button-C1iesapY.js";import{D as st,a as ot,b as rt,c as it,d as at,e as ct}from"./dialog-CpkgwzHW.js";import{D as ne,a as se,b as oe,c as E}from"./dropdown-menu-D6YYwFq7.js";import{a as lt,F as x,b as g,c as j,d as f,f as y}from"./form-NA0-x5iN.js";import{I as k}from"./input-DBGu1Yhi.js";import{S as dt,a as mt,b as ut,c as pt,d as $}from"./select-CnIfeZ9k.js";import{T as ht}from"./textarea-CX1AXmSo.js";import{g as xt,h as gt}from"./use-connection-DWpxH8iy.js";import{u as jt}from"./constants-BEco_-y7.js";import{b as ft}from"./use-mcp-tools-DO_-llbI.js";import{i as re}from"./DotsVertical-CPJps54j.js";import{s as U}from"./Globe02-CNtZ4Mz7.js";import{i as yt}from"./Loading01-CudhqwtJ.js";import{i as vt}from"./Terminal-DV_yPRWa.js";import{s as ie}from"./Trash01-py7ft8Od.js";import{r as _t,E as Ct,e as ue}from"./env-vars-editor-Vpi1vdW2.js";import{d as bt}from"./differenceInSeconds-NQ4PDo0z.js";import"./ArrowUp-DVhz9MPT.js";import"./Check-BIlnRzi6.js";import"./Grid01-BhCIE3UE.js";import"./List-B95opsr5.js";import"./view-mode-toggle-JVmuLwXe.js";import"./utils-D1Qd9-I_.js";import"./table-F_F9uG31.js";import"./SearchMd-yRVgOeax.js";import"./card-DKzkS6ji.js";import"./index-ByJoFAq_.js";import"./avatar-BbH9O0kN.js";import"./useQuery-jRtVXI31.js";import"./use-mobile-CqANtQ4e.js";import"./binder-xcUkLvPC.js";import"./ChevronRight-CNYkXy1u.js";import"./X-CixxHrye.js";import"./label-11d5Pe_w.js";import"./ChevronDown-jAfIG9nZ.js";import"./useMutation-M3-wug2Q.js";import"./Plus-BVPnBK8D.js";function ae(s){const n=de.c(3),{status:i}=s;if(i==="active"){let c;return n[0]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(F,{variant:"success",className:"gap-1.5 text-success border-success/40 bg-background",children:[e.jsx(Be,{size:12}),"Active"]}),n[0]=c):c=n[0],c}if(i==="error"){let c;return n[1]===Symbol.for("react.memo_cache_sentinel")?(c=e.jsxs(F,{variant:"outline",className:"gap-1.5 text-destructive border-destructive/40 bg-background",children:[e.jsx(Oe,{size:12}),"Error"]}),n[1]=c):c=n[1],c}let d;return n[2]===Symbol.for("react.memo_cache_sentinel")?(d=e.jsx(F,{variant:"outline",className:"text-muted-foreground",children:"Inactive"}),n[2]=d):d=n[2],d}function ce(s){const n=bt(new Date,s);return n<60?"<1m":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<604800?`${Math.floor(n/86400)}d ago`:n<2592e3?`${Math.floor(n/604800)}w ago`:n<31536e3?`${Math.floor(n/2592e3)}mo ago`:`${Math.floor(n/31536e3)}y ago`}const kt=me({key:v(),value:v()}),Nt=me({title:v().min(1,"Name is required"),description:v().nullable().optional(),ui_type:Ie(["HTTP","SSE","Websocket","NPX","STDIO"]),connection_url:v().optional(),connection_token:v().nullable().optional(),npx_package:v().optional(),stdio_command:v().optional(),stdio_args:v().optional(),stdio_cwd:v().optional(),env_vars:Te(kt).optional()}).refine(s=>s.ui_type==="NPX"?!!s.npx_package?.trim():!0,{message:"NPM package is required",path:["npx_package"]}).refine(s=>s.ui_type==="STDIO"?!!s.stdio_command?.trim():!0,{message:"Command is required",path:["stdio_command"]}).refine(s=>s.ui_type==="HTTP"||s.ui_type==="SSE"||s.ui_type==="Websocket"?!!s.connection_url?.trim():!0,{message:"URL is required",path:["connection_url"]});function O(s){const n=s.trim();if(!n)return"";try{const i=new URL(n),d=i.pathname.length>1?i.pathname.replace(/\/+$/,""):i.pathname;return`${i.origin}${d}`}catch{return n.replace(/\/+$/,"")}}function wt(s){const n=s.trim().split(/\s+/).filter(Boolean);if(n.length<2)return null;const i=n[0]?.toLowerCase();if(i!=="npx"&&i!=="bunx")return null;const c=n.slice(1).find(a=>!a.startsWith("-"));return c?{packageName:c}:null}function M(s){const{uiType:n}=s,i=O(s.connectionUrl??"");if((n==="HTTP"||n==="SSE"||n==="Websocket")&&i===O("https://api.githubcopilot.com/mcp/"))return{id:"github",title:"GitHub",description:"GitHub Copilot MCP",token:{label:"GitHub PAT",placeholder:"github_pat_…",helperText:"Paste a GitHub Personal Access Token (PAT)"}};const d=(s.npxPackage??"").trim();return n==="NPX"&&d==="@perplexity-ai/mcp-server"?{id:"perplexity",title:"Perplexity",description:"Perplexity MCP Server",envVarKeys:["PERPLEXITY_API_KEY"]}:null}function le(s){if(s.registryItems.length===0||s.uiType!=="HTTP"&&s.uiType!=="SSE"&&s.uiType!=="Websocket")return null;const n=O(s.connectionUrl??"");if(!n)return null;const i=s.registryItems.find(a=>(a.server?.remotes??[]).some(N=>O(N.url??"")===n));if(!i)return null;const d=i.title||i.name||i.server?.title||i.server?.name||"",c=i.server?.description||i.description||i.summary||null;return d?{id:"registry",title:d,description:c}:null}function St(s,n){const i={command:"npx",args:["-y",s]},d=ue(n);return Object.keys(d).length>0&&(i.envVars=d),i}function Dt(s,n,i,d){const c={command:s};n.trim()&&(c.args=n.trim().split(/\s+/)),i?.trim()&&(c.cwd=i.trim());const a=ue(d);return Object.keys(a).length>0&&(c.envVars=a),c}function Pt(s){return s.command==="npx"}function Tt(s){return s.args?.find(n=>!n.startsWith("-"))??""}function It(s){return{command:s.command,args:s.args?.join(" ")??"",cwd:s.cwd??""}}function $t(s,n){switch(n.type){case"edit":return{mode:"editing",connection:n.connection};case"delete":return{mode:"deleting",connection:n.connection};case"close":return{mode:"idle"}}}function Vt(){const{org:s}=Ce(),n=be(),i=ke({strict:!1}),{data:d}=Ne.useSession(),{stdioEnabled:c}=we(),a=ze({namespace:s.slug,resource:"connections"}),V=xt(),N=gt(a),[_,w]=R.useReducer($t,{mode:"idle"}),L=Ue(N)[0],X=L?.id??"",W=Re(L?.tools),pe=jt({connectionId:X||null,orgId:s.id}),{data:he}=ft({client:pe,toolName:W,toolArguments:{limit:200},enabled:!!(X&&W),staleTime:3600*1e3,select:t=>t.structuredContent??t}),K=Le(he??[]),G=i.action==="create",xe=()=>{n({to:"/$org/$project/mcps",params:{org:s.slug,project:h},search:{action:"create"}})},q=()=>{n({to:"/$org/$project/mcps",params:{org:s.slug,project:h},search:{}})},r=Se({resolver:De(Nt),defaultValues:{title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]}}),u=r.watch("ui_type"),Y=r.watch("connection_url"),ge=r.watch("npx_package"),P=M({uiType:u,connectionUrl:Y??"",npxPackage:ge??""})??le({uiType:u,connectionUrl:Y??"",registryItems:K}),m=_.mode==="editing"?_.connection:null;R.useEffect(()=>{if(m){const t=Pe(m.connection_headers)?m.connection_headers:null;if(t&&m.connection_type==="STDIO"){const o=_t(t.envVars);if(Pt(t)){const l=Tt(t);r.reset({title:m.title,description:m.description,ui_type:"NPX",connection_url:"",connection_token:null,npx_package:l,stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:o})}else{const l=It(t);r.reset({title:m.title,description:m.description,ui_type:"STDIO",connection_url:"",connection_token:null,npx_package:"",stdio_command:l.command,stdio_args:l.args,stdio_cwd:l.cwd,env_vars:o})}}else r.reset({title:m.title,description:m.description,ui_type:m.connection_type,connection_url:m.connection_url??"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})}else r.reset({title:"",description:null,ui_type:"HTTP",connection_url:"",connection_token:null,npx_package:"",stdio_command:"",stdio_args:"",stdio_cwd:"",env_vars:[]})},[m,r]);const je=async()=>{if(_.mode!=="deleting")return;const t=_.connection.id;w({type:"close"});try{await V.delete.mutateAsync(t)}catch{}},fe=async t=>{let o,l=null,S=null,b=null;if(t.ui_type==="NPX"?(o="STDIO",l="",b=St(t.npx_package||"",t.env_vars||[])):t.ui_type==="STDIO"?(o="STDIO",l="",b=Dt(t.stdio_command||"",t.stdio_args||"",t.stdio_cwd,t.env_vars||[])):(o=t.ui_type,l=t.connection_url||"",S=t.connection_token||null),m){await V.update.mutateAsync({id:m.id,data:{title:t.title,description:t.description||null,connection_type:o,connection_url:l,...S&&{connection_token:S},...b&&{connection_headers:b}}}),w({type:"close"}),r.reset();return}const D=$e("conn");await V.create.mutateAsync({id:D,title:t.title,description:t.description||null,connection_type:o,connection_url:l,connection_token:S,created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:d?.user?.id||"system",organization_id:s.id,icon:null,app_name:null,app_id:null,connection_headers:b,oauth_config:null,configuration_state:null,metadata:null,tools:null,bindings:null,status:"inactive"}),q(),r.reset(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:D}})},J=t=>{t||(G?q():w({type:"close"}),r.reset())},A=t=>{const o=t.trim();if(!o)return;const l=!!r.formState.dirtyFields.title,S=!!r.formState.dirtyFields.description,b=!!r.formState.dirtyFields.env_vars,D=p=>{if(p&&(!l&&!r.getValues("title").trim()&&p.title&&r.setValue("title",p.title,{shouldDirty:!1}),!S&&!(r.getValues("description")??"").trim()&&p.description&&r.setValue("description",p.description,{shouldDirty:!1}),!b&&p.envVarKeys?.length)){const Q=r.getValues("env_vars")??[],_e=new Set(Q.map(T=>T.key)),Z=p.envVarKeys.filter(T=>!_e.has(T));Z.length>0&&r.setValue("env_vars",[...Q,...Z.map(T=>({key:T,value:""}))],{shouldDirty:!0})}},B=wt(o);if(B&&c){r.setValue("ui_type","NPX",{shouldDirty:!0}),r.setValue("npx_package",B.packageName,{shouldDirty:!0}),r.setValue("connection_url","",{shouldDirty:!0}),r.setValue("connection_token",null,{shouldDirty:!0}),D(M({uiType:"NPX",npxPackage:B.packageName}));return}if(o.startsWith("http://")||o.startsWith("https://")){const p=u==="HTTP"||u==="SSE"||u==="Websocket"?u:"HTTP";r.setValue("ui_type",p,{shouldDirty:!0}),r.setValue("connection_url",o,{shouldDirty:!0}),D(M({uiType:p,connectionUrl:o})??le({uiType:p,connectionUrl:o,registryItems:K}));return}u==="NPX"&&D(M({uiType:"NPX",npxPackage:o}))},ye=[{id:"title",header:"Name",render:t=>e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(He,{icon:t.icon,name:t.title,size:"sm",className:"shrink-0 shadow-sm",fallbackIcon:e.jsx(z,{})}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate block",title:t.title,children:t.title})]}),cellClassName:"w-32 min-w-0 shrink-0",sortable:!0},{id:"description",header:"Description",render:t=>e.jsx("span",{className:"text-sm text-muted-foreground truncate block",title:t.description||"",children:t.description||"—"}),cellClassName:"flex-1 min-w-0 max-w-0",wrap:!1,sortable:!0},{id:"connection_type",header:"Type",accessor:t=>e.jsx("span",{className:"text-xs font-medium",children:t.connection_type}),cellClassName:"w-16 shrink-0",sortable:!0},{id:"status",header:"Status",render:t=>e.jsx(ae,{status:t.status}),cellClassName:"w-28 shrink-0",sortable:!1},{id:"updated_by",header:"Updated by",render:t=>e.jsx(ee,{id:t.updated_by??t.created_by,size:"3xs"}),cellClassName:"w-32 shrink-0",sortable:!0},{id:"updated_at",header:"Updated",render:t=>e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:t.updated_at?ce(new Date(t.updated_at)):"—"}),cellClassName:"max-w-24 w-24 shrink-0",sortable:!0},{id:"actions",header:"",render:t=>e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(re,{size:20})})}),e.jsxs(oe,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs(E,{onClick:o=>{o.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}})},children:[e.jsx(te,{size:16}),"Open"]}),e.jsxs(E,{variant:"destructive",onClick:o=>{o.stopPropagation(),w({type:"delete",connection:t})},children:[e.jsx(ie,{size:16}),"Delete"]})]})]}),cellClassName:"w-12 shrink-0"}],ve=e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Browse Store"}),e.jsx(C,{onClick:xe,size:"sm",className:"h-7 px-3 rounded-lg text-sm font-medium",children:"Custom Connection"})]});return e.jsxs(I,{children:[e.jsx(st,{open:G||_.mode==="editing",onOpenChange:J,children:e.jsxs(ot,{className:"sm:max-w-[525px]",children:[e.jsxs(rt,{children:[e.jsx(it,{children:m?"Edit Connection":"Create Connection"}),e.jsx(at,{children:m?"Update the connection details below.":"Create a custom connection in your organization. Fill in the details below."})]}),e.jsx(lt,{...r,children:e.jsxs("form",{onSubmit:r.handleSubmit(fe),children:[e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsx(x,{control:r.control,name:"ui_type",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Type *"}),e.jsxs(dt,{value:t.value,onValueChange:t.onChange,children:[e.jsx(f,{children:e.jsx(mt,{children:e.jsx(ut,{})})}),e.jsxs(pt,{children:[e.jsx($,{value:"HTTP",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"HTTP"]})}),e.jsx($,{value:"SSE",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"SSE"]})}),e.jsx($,{value:"Websocket",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"w-4 h-4"}),"Websocket"]})}),c&&e.jsxs(e.Fragment,{children:[e.jsx($,{value:"NPX",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(z,{className:"w-4 h-4"}),"NPX Package"]})}),e.jsx($,{value:"STDIO",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(vt,{className:"w-4 h-4"}),"Custom Command"]})})]})]})]}),e.jsx(y,{})]})}),u==="NPX"&&e.jsx(e.Fragment,{children:e.jsx(x,{control:r.control,name:"npx_package",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"NPM Package *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"@perplexity-ai/mcp-server",...t,value:t.value??"",onPaste:o=>{const l=o.clipboardData.getData("text");l&&(o.preventDefault(),r.setValue("npx_package",l.trim(),{shouldDirty:!0}),A(l))},onBlur:o=>{A(o.target.value),t.onBlur()}})}),e.jsx(y,{})]})})}),u==="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 items-start",children:[e.jsx(x,{control:r.control,name:"stdio_command",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Command *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"node, bun, python...",...t,value:t.value??""})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"stdio_args",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Arguments"}),e.jsx(f,{children:e.jsx(k,{placeholder:"arg1 arg2 --flag value",...t,value:t.value??""})}),e.jsx(y,{})]})})]}),e.jsx(x,{control:r.control,name:"stdio_cwd",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Working Directory"}),e.jsx(f,{children:e.jsx(k,{placeholder:"/path/to/project (optional)",...t,value:t.value??""})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Directory where the command will be executed"}),e.jsx(y,{})]})})]}),(u==="NPX"||u==="STDIO")&&e.jsx(x,{control:r.control,name:"env_vars",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Environment Variables"}),e.jsx(f,{children:e.jsx(Ct,{value:t.value??[],onChange:t.onChange})}),e.jsx(y,{})]})}),u!=="NPX"&&u!=="STDIO"&&e.jsxs(e.Fragment,{children:[e.jsx(x,{control:r.control,name:"connection_url",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"URL *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"https://example.com/mcp",...t,value:t.value??"",onPaste:o=>{const l=o.clipboardData.getData("text");l&&(o.preventDefault(),r.setValue("connection_url",l.trim(),{shouldDirty:!0}),A(l))},onBlur:o=>{A(o.target.value),t.onBlur()}})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"connection_token",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:P?.token?.label??"Token (optional)"}),e.jsx(f,{children:e.jsx(k,{type:"password",placeholder:P?.token?.placeholder??"Bearer token or API key",...t,value:t.value??""})}),P?.token?.helperText&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[P.token.helperText,P.id==="github"&&e.jsxs(e.Fragment,{children:[" ","·"," ",e.jsx("a",{className:"text-foreground underline underline-offset-4 hover:text-foreground/80",href:"https://github.com/settings/personal-access-tokens",target:"_blank",rel:"noreferrer",children:"Open GitHub PAT settings"})]})]}),e.jsx(y,{})]})})]}),e.jsx(x,{control:r.control,name:"title",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Name *"}),e.jsx(f,{children:e.jsx(k,{placeholder:"My Connection",...t})}),e.jsx(y,{})]})}),e.jsx(x,{control:r.control,name:"description",render:({field:t})=>e.jsxs(g,{children:[e.jsx(j,{children:"Description"}),e.jsx(f,{children:e.jsx(ht,{placeholder:"A brief description of this connection",rows:3,...t,value:t.value??""})}),e.jsx(y,{})]})})]}),e.jsxs(ct,{children:[e.jsx(C,{type:"button",variant:"outline",onClick:()=>J(!1),children:"Cancel"}),e.jsx(C,{type:"submit",disabled:r.formState.isSubmitting,className:"min-w-40",children:r.formState.isSubmitting?"Saving...":m?"Update Connection":"Create Connection"})]})]})})]})}),e.jsx(Xe,{open:_.mode==="deleting",onOpenChange:t=>!t&&w({type:"close"}),children:e.jsxs(We,{children:[e.jsxs(Ke,{children:[e.jsx(Ge,{children:"Delete Connection?"}),e.jsxs(qe,{children:["This action cannot be undone. This will permanently delete"," ",e.jsx("span",{className:"font-medium text-foreground",children:_.mode==="deleting"&&_.connection.title}),"."]})]}),e.jsxs(Ye,{children:[e.jsx(Je,{children:"Cancel"}),e.jsx(Qe,{onClick:je,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e.jsxs(I.Header,{children:[e.jsx(I.Header.Left,{children:e.jsx(Ze,{children:e.jsx(et,{children:e.jsx(tt,{children:e.jsx(nt,{children:"Connections"})})})})}),e.jsxs(I.Header.Right,{children:[e.jsx(Ve,{viewMode:a.viewMode,onViewModeChange:a.setViewMode,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,sortOptions:[{id:"title",label:"Name"},{id:"description",label:"Description"},{id:"connection_type",label:"Type"},{id:"updated_by",label:"Updated by"},{id:"updated_at",label:"Updated"}]}),ve]})]}),e.jsx(Ee,{value:a.search,onChange:a.setSearch,placeholder:"Search for a Connection...",onKeyDown:t=>{t.key==="Escape"&&(a.setSearch(""),t.target.blur())}}),e.jsx(I.Content,{children:a.viewMode==="cards"?e.jsx("div",{className:"flex-1 overflow-auto p-5",children:N.length===0?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:336,height:320,"aria-hidden":"true"}),title:(a.search,"No Connections found"),description:a.search?`No Connections match "${a.search}"`:"Create a connection to get started.",actions:!a.search&&e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),children:"Browse Store"})}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4",children:N.map(t=>e.jsx(Me,{connection:t,fallbackIcon:e.jsx(z,{}),onClick:()=>n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}}),headerActions:e.jsxs(ne,{children:[e.jsx(se,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:o=>o.stopPropagation(),children:e.jsx(re,{size:20})})}),e.jsxs(oe,{align:"end",onClick:o=>o.stopPropagation(),children:[e.jsxs(E,{onClick:o=>{o.stopPropagation(),n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}})},children:[e.jsx(te,{size:16}),"Open"]}),e.jsxs(E,{variant:"destructive",onClick:o=>{o.stopPropagation(),w({type:"delete",connection:t})},children:[e.jsx(ie,{size:16}),"Delete"]})]})]}),body:e.jsx(ae,{status:t.status}),footer:e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground w-full min-w-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx(ee,{id:t.updated_by??t.created_by,size:"3xs"})}),e.jsx("span",{className:"shrink-0 ml-2",children:t.updated_at?ce(new Date(t.updated_at)):"—"})]})},t.id))})}):e.jsx("div",{className:"h-full flex flex-col overflow-hidden",children:e.jsx("div",{className:"flex-1 overflow-auto min-w-0",children:e.jsx("div",{className:"min-w-[1000px]",children:e.jsx(Ae,{columns:ye,data:N,isLoading:!1,sortKey:a.sortKey,sortDirection:a.sortDirection,onSort:a.handleSort,onRowClick:t=>n({to:"/$org/$project/mcps/$connectionId",params:{org:s.slug,project:h,connectionId:t.id}}),emptyState:a.search?e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:`No Connections match "${a.search}"`}):e.jsx(H,{image:e.jsx("img",{src:"/emptystate-mcp.svg",alt:"",width:400,height:178,"aria-hidden":"true"}),title:"No Connections found",description:"Create a connection to get started.",actions:e.jsx(C,{variant:"outline",onClick:()=>n({to:"/$org/$project/store",params:{org:s.slug,project:h}}),children:"Browse Store"})})})})})})})]})}function En(){const s=de.c(1);let n;return s[0]===Symbol.for("react.memo_cache_sentinel")?(n=e.jsx(Fe,{children:e.jsx(R.Suspense,{fallback:e.jsx("div",{className:"flex h-full items-center justify-center",children:e.jsx(yt,{size:32,className:"animate-spin text-muted-foreground"})}),children:e.jsx(Vt,{})})}),s[0]=n):n=s[0],n}export{En as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b2 as h,c as d,y as f,b3 as _}from"./index-HxeE9C0A.js";const m={authConfig:()=>["authConfig"],threads:t=>["threads",t],virtualMcpThreads:(t,e)=>["threads",t,"virtual-mcp",e],thread:(t,e)=>["thread",t,e],threadMessages:(t,e)=>["thread-messages",t,e],messages:t=>["messages",t],organizations:()=>["organizations"],members:t=>[t,"members"],invitations:t=>[t,"invitations"],organizationRoles:t=>[t,"organization-roles"],connections:t=>[t,"connections"],connectionsByBinding:(t,e)=>[t,"connections",`binding:${e}`],connection:(t,e)=>[t,"connection",e],isMCPAuthenticated:(t,e)=>["is-mcp-authenticated",t,e],mcpTools:(t,e)=>["mcp","tools",t,e],mcpClient:(t,e,n,o)=>["mcp","client",t,e,n,o],mcpToolsList:t=>["mcp","client",t,"tools"],mcpResourcesList:t=>["mcp","client",t,"resources"],mcpPromptsList:t=>["mcp","client",t,"prompts"],mcpReadResource:(t,e)=>["mcp","client",t,"resource",e],mcpGetPrompt:(t,e,n)=>["mcp","client",t,"prompt",e,n],mcpToolCall:(t,e,n)=>["mcp","client",t,"tool-call",e,n],organizationSettings:t=>["organization-settings",t],activeOrganization:t=>["activeOrganization",t],modelsList:t=>["models-list",t],connectionCollections:t=>[t,"collections","discovery"],toolCall:(t,e,n)=>["tool-call",t,e,n],collectionItems:(t,e)=>["collection",t,e],collection:(t,e,n)=>[t,e,"collection",n],collectionItem:(t,e,n,o,i)=>[t,e,n,"collection",o,i],collectionList:(t,e,n,o,i)=>[t,e,n,"collection",o,"list",i],collectionListInfinite:(t,e,n,o,i)=>[t,e,n,"collection",o,"list-infinite",i],githubReadme:(t,e)=>["github-readme",t,e],monitoringStats:()=>["monitoring","stats"],monitoringLogs:t=>["monitoring","logs",t],monitoringLogsInfinite:(t,e)=>["monitoring","logs-infinite",t,e],virtualMcpPrompts:t=>["virtual-mcp",t,"prompts"],connectionPrompts:t=>["connection",t,"prompts"],connectionResources:t=>["connection",t,"resources"],user:t=>["user",t]};class y extends h{constructor(e,n){super(e,n)}send(e,n){const o=b(e);return o?.type==="emit"?(this.onmessage?.(o.message),Promise.resolve()):o?.type==="suppress"?Promise.resolve():super.send(e,n)}}function b(t){const e=t;if(!e||typeof e!="object"||!("method"in e))return null;switch(e.method){case"initialize":{const n=e?.params?.protocolVersion;return n?{type:"emit",message:{result:{protocolVersion:n,capabilities:{tools:{},resources:{},prompts:{},tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}},serverInfo:{name:"mesh-virtual-mcp",version:"1.0.0"}},jsonrpc:e.jsonrpc??"2.0",id:e.id}}:null}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}const C={name:"mesh-sdk",version:"1.0.0"};function T(t,e){const n=e??(typeof window<"u"?window.location.origin:void 0);if(!n)throw new Error("MCP client requires either meshUrl option or a browser environment.");const o=t?`/mcp/${t}`:"/mcp";return new URL(o,n).href}async function g({connectionId:t,orgId:e,token:n,meshUrl:o}){const i=T(t,o),c=new _(C,{capabilities:{tasks:{list:{},cancel:{},requests:{tool:{call:{}}}}}}),r=new y(new URL(i),{requestInit:{headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream","x-org-id":e,...n?{Authorization:`Bearer ${n}`}:{}}}});await c.connect(r);const a=m.mcpClient(e,t??"self",n??"",o??"");return c.toJSON=()=>`mcp-client:${a.join(":")}`,c}function S(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=m.mcpClient(o,n??"self",i??"",c??""),e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=()=>g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u}function I(t){const e=d.c(13),{connectionId:n,orgId:o,token:i,meshUrl:c}=t;let r;e[0]!==n||e[1]!==c||e[2]!==o||e[3]!==i?(r=n!==void 0?m.mcpClient(o,n??"self",i??"",c??""):["mcp","client","skip",o],e[0]=n,e[1]=c,e[2]=o,e[3]=i,e[4]=r):r=e[4];const a=r;let s;e[5]!==n||e[6]!==c||e[7]!==o||e[8]!==i?(s=async()=>n===void 0?null:g({connectionId:n,orgId:o,token:i,meshUrl:c}),e[5]=n,e[6]=c,e[7]=o,e[8]=i,e[9]=s):s=e[9];let l;e[10]!==a||e[11]!==s?(l={queryKey:a,queryFn:s,staleTime:1/0,gcTime:0},e[10]=a,e[11]=s,e[12]=l):l=e[12];const{data:u}=f(l);return u??null}const P={SELF:t=>`${t}_self`,REGISTRY:t=>`${t}_registry`,COMMUNITY_REGISTRY:t=>`${t}_community-registry`,DEV_ASSETS:t=>`${t}_dev-assets`},M="self";function R(t){return{id:P.REGISTRY(t),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function L(){return{id:"community-registry",title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function D(t={}){return{id:t.id,title:"OpenRouter",description:"Access hundreds of LLM models from a single API",icon:"https://assets.decocache.com/decocms/b2e2f64f-6025-45f7-9e8c-3b3ebdd073d8/openrouter_logojpg.jpg",app_name:"openrouter",app_id:"openrouter",connection_type:"HTTP",connection_url:"https://sites-openrouter.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{source:"chat",verified:!1,scopeName:"deco",toolsCount:0,publishedAt:null,repository:null}}}function E(){return{title:"MCP Studio",description:"An app that allows you to create and manage MCPs",icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"mcp-studio",app_id:"65a1b407-b6af-41e2-a89f-ce9450c05bbc",connection_type:"HTTP",connection_url:"https://sites-vibemcp.decocache.com/mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"mcp-studio"}}}function O(t){return{id:v(t),organization_id:t,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:null},connections:[]}}const p="decopilot_";function $(t){return!t||!t.startsWith(p)?null:t.slice(p.length)||null}function v(t){return`${p}${t}`}export{m as K,y as S,P as W,M as a,L as b,g as c,O as d,E as e,D as f,v as g,R as h,$ as i,I as j,S as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{M as t,Q as a}from"./index-HxeE9C0A.js";const e=t(a,{target:"draft-7"});export{e as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as A,s as D,c as O,h as v,k as E,j as r,g as N}from"./index-
|
|
1
|
+
import{o as A,s as D,c as O,h as v,k as E,j as r,g as N}from"./index-HxeE9C0A.js";import{A as I,a as M,b as L,c as R,d as T,e as $,f as k}from"./alert-dialog-B1nWkQHx.js";import{B}from"./button-C1iesapY.js";import{F as V,a as q,b as H,c as U,d as G,e as J,f as K}from"./form-NA0-x5iN.js";import{I as P}from"./input-DBGu1Yhi.js";import{S as Q}from"./spinner-BbdUl9_5.js";import{u as W}from"./useMutation-M3-wug2Q.js";function _(o){return o.toLowerCase().trim().replace(/[^a-z0-9\s_-]+/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const X=A({name:D().min(2,"Organization name is required")});function ne(o){const e=O.c(41),{open:a,onOpenChange:s}=o;let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j={resolver:v(X),defaultValues:{name:""}},e[0]=j):j=e[0];const t=E(j);let w;e[1]===Symbol.for("react.memo_cache_sentinel")?(w={mutationFn:Z,onSuccess:Y},e[1]=w):w=e[1];const i=W(w),z=i.error instanceof Error?i.error.message:i.error?"Failed to create organization.":null;let F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r.jsxs(L,{children:[r.jsx(R,{children:"Create a new organization"}),r.jsx(T,{children:"Set up a new organization to collaborate with others."})]}),e[2]=F):F=e[2];let n;if(e[3]!==i||e[4]!==t){let x;e[6]!==i?(x=b=>i.mutateAsync(b),e[6]=i,e[7]=x):x=e[7],n=t.handleSubmit(x),e[3]=i,e[4]=t,e[5]=n}else n=e[5];let l;e[8]!==t.formState.isSubmitting?(l=x=>{const{field:b}=x;return r.jsxs(H,{children:[r.jsx(U,{children:"Organization Name"}),r.jsx(G,{children:r.jsx(P,{...b,placeholder:"Acme Inc.",disabled:t.formState.isSubmitting})}),r.jsx(J,{children:"The name of your company or organization"}),b.value&&r.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Organization URL:"," ",r.jsxs("span",{className:"font-mono",children:[typeof window<"u"?globalThis.location.origin:"","/",_(b.value)]})]}),r.jsx(K,{})]})},e[8]=t.formState.isSubmitting,e[9]=l):l=e[9];let m;e[10]!==t.control||e[11]!==l?(m=r.jsx(V,{control:t.control,name:"name",render:l}),e[10]=t.control,e[11]=l,e[12]=m):m=e[12];let c;e[13]!==z?(c=z&&r.jsx("div",{className:"text-destructive text-sm mt-2",children:z}),e[13]=z,e[14]=c):c=e[14];let f;e[15]!==i||e[16]!==t?(f=()=>{i.reset(),t.reset()},e[15]=i,e[16]=t,e[17]=f):f=e[17];let g;e[18]!==t.formState.isSubmitting||e[19]!==f?(g=r.jsx(I,{disabled:t.formState.isSubmitting,onClick:f,children:"Cancel"}),e[18]=t.formState.isSubmitting,e[19]=f,e[20]=g):g=e[20];const y=!t.formState.isValid||t.formState.isSubmitting;let u;e[21]!==t.formState.isSubmitting?(u=t.formState.isSubmitting?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Q,{size:"xs"})," Creating..."]}):"Create Organization",e[21]=t.formState.isSubmitting,e[22]=u):u=e[22];let d;e[23]!==y||e[24]!==u?(d=r.jsx(B,{type:"submit",variant:"default",disabled:y,children:u}),e[23]=y,e[24]=u,e[25]=d):d=e[25];let h;e[26]!==d||e[27]!==g?(h=r.jsxs($,{children:[g,d]}),e[26]=d,e[27]=g,e[28]=h):h=e[28];let S;e[29]!==h||e[30]!==n||e[31]!==m||e[32]!==c?(S=r.jsxs("form",{className:"space-y-6",onSubmit:n,autoComplete:"off",children:[m,c,h]}),e[29]=h,e[30]=n,e[31]=m,e[32]=c,e[33]=S):S=e[33];let p;e[34]!==t||e[35]!==S?(p=r.jsxs(M,{children:[F,r.jsx(q,{...t,children:S})]}),e[34]=t,e[35]=S,e[36]=p):p=e[36];let C;return e[37]!==s||e[38]!==a||e[39]!==p?(C=r.jsx(k,{open:a,onOpenChange:s,children:p}),e[37]=s,e[38]=a,e[39]=p,e[40]=C):C=e[40],C}function Y(o){const{orgSlug:e}=o;window.location.href=`/${e}`}async function Z(o){const e=_(o.name);if(!e)throw new Error("Organization slug is invalid");const a=await N.organization.create({name:o.name,slug:e});if(a?.error)throw new Error(a.error.message||"Failed to create organization");const s=a?.data?.slug??e;if(!s)throw new Error("Failed to create organization");return{orgSlug:s}}export{ne as C};
|