1import{Y as ee,_ as b,bx as se,a6 as W,$ as O,ga as te,u as p,j as e,aW as ce,aX as ae,aY as ne,aZ as le,a_ as oe,a9 as T,aa as _,ab as B,fS as D,ad as E,ap as F,aC as P,E as h,c9 as re,a1 as R,a2 as V,a3 as H,a5 as q,aw as Z,ax as z,y as ie,fF as de,r as u,aL as pe,an as y,d as xe}from"./index-6AHMKm1b.js";import{T as me,a as he,b as k,c as m,d as ue,e as d}from"./table-CbGew4kG.js";import{E as ge}from"./external-link-D24muBQE.js";/** 2 * @license lucide-react v0.503.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Ce=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],fe=ee("bot",Ce),N={fetchClients:async s=>{try{return(await b.get("/api/v2/mcp-access/clients",s!=null?{params:{account_id:s}}:void 0)).data}catch(t){throw console.error("Failed to fetch MCP clients:",t),t}},disconnectClient:async s=>{try{return(await b.delete(`/api/v2/mcp-access/clients/${encodeURIComponent(s)}`)).data}catch(t){throw console.error("Failed to disconnect MCP client:",t),t}},toggleAccess:async s=>{try{return(await b.put("/api/v2/mcp-access/toggle",s)).data}catch(t){throw console.error("Failed to toggle MCP access:",t),t}}},g={all:["mcp-access"],clients:s=>[...g.all,"clients",s??null]},je=s=>se({queryKey:g.clients(s),queryFn:()=>N.fetchClients(s),staleTime:5*60*1e3,gcTime:10*60*1e3,refetchOnWindowFocus:!0,refetchOnReconnect:!0}),be=()=>{const s=W();return O({mutationFn:t=>N.toggleAccess(t),onSuccess:()=>{s.invalidateQueries({queryKey:g.all}),s.invalidateQueries({queryKey:te.all})}})},ye=()=>{const s=W();return O({mutationFn:t=>N.disconnectClient(t),onSuccess:()=>{s.invalidateQueries({queryKey:g.all})}})}
6,ke=({accounts:s,value:t,onChange:c})=>{const{t:l}=p(),a=n=>{var r;return l("mcpAccess.accountSelector.optionLabel",{id:n.id,email:((r=n.owner)==null?void 0:r.email)??n.email})};return e.jsxs("div",{"data-testid":"section-mcp-account-selector",className:"bg-white rounded-[12px] px-8 py-[18px] flex items-center gap-3",children:[e.jsx("label",{htmlFor:"mcp-account-selector",className:"text-sm font-medium text-secondary-dark shrink-0",children:l("mcpAccess.accountSelector.label")}),e.jsxs(ce,{value:t!=null?String(t):void 0,onValueChange:n=>c(Number(n)),children:[e.jsx(ae,{id:"mcp-account-selector","data-testid":"select-mcp-account",className:"flex-1 bg-[#f4f5fa] border-[#c7cade] text-sm text-secondary-dark",children:e.jsx(ne,{placeholder:l("mcpAccess.accountSelector.placeholder")})}),e.jsx(le,{children:s.map(n=>e.jsx(oe,{value:String(n.id),children:a(n)},n.id))})]})]})},Ne=({isEnabled:s,isAccountOwner:t,isPending:c,onToggle:l})=>{const{t:a}=p(),n=a("mcpAccess.toggleSection.tooltipOwner"),r=a("mcpAccess.toggleSection.tooltipNonOwner"),i=e.jsxs("div",{className:"flex items-start gap-16 w-full",children:[e.jsxs("div",{className:"flex items-center gap-1 w-[249px] shrink-0",children:[e.jsx("span",{className:"text-sm text-secondary-dark",children:a("mcpAccess.toggleSection.label")}),t?e.jsx(T,{children:e.jsxs(_,{children:[e.jsx(B,{asChild:!0,children:e.jsx("span",{className:"cursor-default text-secondary-dark","aria-label":n,children:e.jsx(D,{className:"w-4 h-4"})})}),e.jsx(E,{side:"right",className:"max-w-[300px] text-left",children:e.jsx("p",{children:n})})]})}):e.jsx("span",{className:"cursor-default text-secondary-dark",children:e.jsx(D,{className:"w-4 h-4"})})]}),t?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(F,{"data-testid":"switch-mcp-toggle",className:"data-[state=unchecked]:bg-[#b0b0b8]",checked:s,onCheckedChange:l,disabled:c,"aria-label":a("mcpAccess.toggleSection.heading")}),e.jsxs("p",{className:"text-[13px] text-secondary-dark",children:[a("mcpAccess.toggleSection.helperText")," ",e.jsx("a",{href:a("mcpAccess.toggleSection.mcpLink"),target:"_blank",rel:"noopener noreferrer",className:"text-primary underline-offset-2 hover:underline",children:a("mcpAccess.toggleSection.mcpLinkLabel")}),"."]})]}):e.jsx(T,{children:e.jsxs(_,{children:[e.jsx(B,{asChild:!0,children:e.jsxs("div",{className:"flex flex-col gap-2 cursor-default",children:[e.jsx(F,{"data-testid":"switch-mcp-toggle",className:"data-[state=unchecked]:bg-[#b0b0b8]",checked:s,onCheckedChange:l,disabled:!0,"aria-label":a("mcpAccess.toggleSection.heading")}),e.jsxs("p",{className:"text-[13px] text-secondary-dark",children:[a("mcpAccess.toggleSection.helperText")," ",e.jsx("a",{href:a("mcpAccess.toggleSection.mcpLink"),target:"_blank",rel:"noopener noreferrer",className:"text-primary underline-offset-2 hover:underline",children:a("mcpAccess.toggleSection.mcpLinkLabel")}),"."]})]})}),e.jsx(E,{side:"right",className:"max-w-[300px] text-left",children:e.jsx("p",{children:r})})]})})]});return e.jsxs("div",{"data-testid":"section-mcp-toggle",className:`flex flex-col gap-10 ${t?"":"opacity-75"}`,children:[e.jsx("p",{className:"text-base font-semibold text-[#001737]",children:a("mcpAccess.toggleSection.heading")}),i]})},we=({width:s=64,height:t=64,className:c})=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:s,height:t,viewBox:"0 0 64 64",fill:"none",className:c,"data-testid":"icon-mcp-package",children:[e.jsx("path",{d:"M0 32C0 14.3269 14.3269 0 32 0C49.6731 0 64 14.3269 64 32C64 49.6731 49.6731 64 32 64C14.3269 64 0 49.6731 0 32Z",fill:"#F4F5FA"}),e.jsx("path",{d:"M30.6667 44.9729C31.0721 45.2069 31.5319 45.3301 32 45.3301C32.4681 45.3301 32.9279 45.2069 33.3333 44.9729L42.6667 39.6395C43.0717 39.4057 43.408 39.0695 43.6421 38.6647C43.8761 38.2598 43.9995 37.8005 44 37.3329V26.6662C43.9995 26.1986 43.8761 25.7393 43.6421 25.3344C43.408 24.9296 43.0717 24.5934 42.6667 24.3595L33.3333 19.0262C32.9279 18.7922 32.4681 18.6689 32 18.6689C31.5319 18.6689 31.0721 18.7922 30.6667 19.0262L21.3333 24.3595C20.9284 24.5934 20.592 24.9296 20.3579 25.3344C20.1239 25.7393 20.0005 26.1986 20 26.6662V37.3329C20.0005 37.8005 20.1239 38.2598 20.3579 38.6647C20.592 39.0695 20.9284 39.4057 21.3333 39.6395L30.6667 44.9729Z",stroke:"#6E7191",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M32 45.3333V32",stroke:"#6E7191",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M20.3867 25.333L32 31.9997L43.6133 25.333",stroke:"#6E7191",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M26 21.6934L38 28.56",stroke:"#6E7191",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),Me=()=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M5.25 7L6.41667 8.16667L8.75 5.83333M12.25 7C12.25 7.68944 12.1142 8.37213 11.8504 9.00909C11.5865 9.64605 11.1998 10.2248 10.7123 10.7123C10.2248 11.1998 9.64605 11.5865 9.00909 11.8504C8.37213
612.1142 7.68944 12.25 7 12.25C6.31056 12.25 5.62787 12.1142 4.99091 11.8504C4.35395 11.5865 3.7752 11.1998 3.28769 10.7123C2.80018 10.2248 2.41347 9.64605 2.14963 9.00909C1.8858 8.37213 1.75 7.68944 1.75 7C1.75 5.60761 2.30312 4.27226 3.28769 3.28769C4.27226 2.30312 5.60761 1.75 7 1.75C8.39239 1.75 9.72774 2.30312 10.7123 3.28769C11.6969 4.27226 12.25 5.60761 12.25 7Z",stroke:"#4E4B66",strokeWidth:"1.16667",strokeLinecap:"round",strokeLinejoin:"round"})}),ve=()=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M12.25 12.25L8.75 8.75M9.91667 5.83333C9.91667 6.36956 9.81105 6.90054 9.60584 7.39596C9.40063 7.89137 9.09986 8.34151 8.72069 8.72069C8.34151 9.09986 7.89137 9.40063 7.39596 9.60584C6.90054 9.81105 6.36956 9.91667 5.83333 9.91667C5.2971 9.91667 4.76612 9.81105 4.27071 9.60584C3.7753 9.40063 3.32515 9.09986 2.94598 8.72069C2.56681 8.34151 2.26603 7.89137 2.06083 7.39596C1.85562 6.90054 1.75 6.36956 1.75 5.83333C1.75 4.75037 2.18021 3.71175 2.94598 2.94598C3.71175 2.18021 4.75037 1.75 5.83333 1.75C6.9163 1.75 7.95491 2.18021 8.72069 2.94598C9.48646 3.71175 9.91667 4.75037 9.91667 5.83333Z",stroke:"#4E4B66",strokeWidth:"1.16667",strokeLinecap:"round",strokeLinejoin:"round"})}),Ae=()=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[e.jsx("path",{d:"M6.02292 2.51825C6.27142 1.49392 7.72858 1.49392 7.97708 2.51825C8.01437 2.67213 8.08746 2.81504 8.19041 2.93533C8.29337 3.05563 8.42327 3.14991 8.56955 3.21052C8.71583 3.27112 8.87435 3.29633 9.03221 3.28409C9.19007 3.27185 9.34281 3.22251 9.478 3.14008C10.3781 2.59175 11.4088 3.62192 10.8605 4.52258C10.7782 4.65772 10.7289 4.81036 10.7167 4.96812C10.7045 5.12587 10.7297 5.28428 10.7902 5.43047C10.8508 5.57666 10.9449 5.7065 11.0651 5.80945C11.1852 5.91239 11.328 5.98553 11.4817 6.02292C12.5061 6.27142 12.5061 7.72858 11.4817 7.97708C11.3279 8.01437 11.185 8.08746 11.0647 8.19041C10.9444 8.29337 10.8501 8.42327 10.7895 8.56955C10.7289 8.71583 10.7037 8.87435 10.7159 9.03221C10.7281 9.19007 10.7775 9.34281 10.8599 9.478C11.4083 10.3781 10.3781 11.4088 9.47742 10.8605C9.34228 10.7782 9.18964 10.7289 9.03188 10.7167C8.87413 10.7045 8.71572 10.7297 8.56953 10.7902C8.42334 10.8508 8.2935 10.9449 8.19055 11.0651C8.08761 11.1852 8.01447 11.328 7.97708 11.4817C7.72858 12.5061 6.27142 12.5061 6.02292 11.4817C5.98563 11.3279 5.91254 11.185 5.80959 11.0647C5.70663 10.9444 5.57673 10.8501 5.43045 10.7895C5.28417 10.7289 5.12565 10.7037 4.96779 10.7159C4.80993 10.7281 4.65719 10.7775 4.522 10.8599C3.62192 11.4083 2.59117 10.3781 3.1395 9.47742C3.22181 9.34228 3.27107 9.18964 3.28328 9.03188C3.29549 8.87413 3.27031 8.71572 3.20978 8.56953C3.14924 8.42334 3.05507 8.2935 2.93491 8.19055C2.81475 8.08761 2.672 8.01447 2.51825 7.97708C1.49392 7.72858 1.49392 6.27142 2.51825 6.02292C2.67213 5.98563 2.81504 5.91254 2.93533 5.80959C3.05563 5.70663 3.14991 5.57673 3.21052 5.43045C3.27112 5.28417 3.29633 5.12565 3.28409 4.96779C3.27185 4.80993 3.22251 4.65719 3.14008 4.522C2.59175 3.62192 3.62192 2.59117 4.52258 3.1395C5.10358 3.49417 5.86192 3.18033 6.02292 2.51825Z",stroke:"#4E4B66",strokeWidth:"1.16667",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M8.75 7C8.75 7.46413 8.56563 7.90925 8.23744 8.23744C7.90925 8.56563 7.46413 8.75 7 8.75C6.53587 8.75 6.09075 8.56563 5.76256 8.23744C5.43437 7.90925 5.25 7.46413 5.25 7C5.25 6.53587 5.43437 6.09075 5.76256 5.76256C6.09075 5.43437 6.53587 5.25 7 5.25C7.46413 5.25 7.90925 5.43437 8.23744 5.76256C8.56563 6.09075 8.75 6.53587 8.75 7Z",stroke:"#4E4B66",strokeWidth:"1.16667",strokeLinecap:"round",strokeLinejoin:"round"})]}),Le=()=>e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:e.jsx("path",{d:"M1.78208 6.41667H2.91667C3.22609 6.41667 3.52283 6.53958 3.74162 6.75838C3.96042 6.97717 4.08333 7.27391 4.08333 7.58333V8.16667C4.08333 8.47609 4.20625 8.77283 4.42504 8.99162C4.64383 9.21042 4.94058 9.33333 5.25 9.33333C5.55942 9.33333 5.85617 9.45625 6.07496 9.67504C6.29375 9.89383 6.41667 10.
61906 6.41667 10.5V12.2179M4.66667 2.29542V3.20833C4.66667 3.59511 4.82031 3.96604 5.0938 4.23953C5.36729 4.51302 5.73823 4.66667 6.125 4.66667H6.41667C6.72609 4.66667 7.02283 4.78958 7.24162 5.00838C7.46042 5.22717 7.58333 5.52391 7.58333 5.83333C7.58333 6.14275 7.70625 6.4395 7.92504 6.65829C8.14383 6.87708 8.44058 7 8.75 7C9.05942 7 9.35616 6.87708 9.57496 6.65829C9.79375 6.4395 9.91667 6.14275 9.91667 5.83333C9.91667 5.52391 10.0396 5.22717 10.2584 5.00838C10.4772 4.78958 10.7739 4.66667 11.0833 4.66667H11.704M8.75 11.9513V10.5C8.75 10.1906 8.87292 9.89383 9.09171 9.67504C9.3105 9.45625 9.60725 9.33333 9.91667 9.33333H11.704M12.25 7C12.25 7.68944 12.1142 8.37213 11.8504 9.00909C11.5865 9.64605 11.1998 10.2248 10.7123 10.7123C10.2248 11.1998 9.64605 11.5865 9.00909 11.8504C8.37213 12.1142 7.68944 12.25 7 12.25C6.31056 12.25 5.62787 12.1142 4.99091 11.8504C4.35395 11.5865 3.7752 11.1998 3.28769 10.7123C2.80018 10.2248 2.41347 9.64605 2.14963 9.00909C1.8858 8.37213 1.75 7.68944 1.75 7C1.75 5.60761 2.30312 4.27226 3.28769 3.28769C4.27226 2.30312 5.60761 1.75 7 1.75C8.39239 1.75 9.72774 2.30312 10.7123 3.28769C11.6969 4.27226 12.25 5.60761 12.25 7Z",stroke:"#4E4B66",strokeWidth:"1.16667",strokeLinecap:"round",strokeLinejoin:"round"})}),Se=[e.jsx(Me,{}),e.jsx(ve,{}),e.jsx(Ae,{}),e.jsx(Le,{})];function Te(s){if(s.startsWith("/"))return!0;try{const{protocol:t}=new URL(s);return t==="https:"||t==="http:"}catch{return!1}}function _e(s){var c;return s.logo_path&&Te(s.logo_path)?{type:"img",src:s.logo_path}:{type:"letter",letter:(c=(s.client_name??"?")[0])==null?void 0:c.toUpperCase()}}function I(s){if(!s)return"â";try{return re(new Date(s),"dd MMM yyyy")}catch{return"â"}}const Be=({connectors:s,onDisconnect:t})=>{const{t:c}=p();return e.jsx("div",{"data-testid":"section-mcp-connectors-table",className:"rounded-[6px] overflow-hidden border border-[#d9dbe9]",children:e.jsx("div",{className:s.length>5?"max-h-[320px] overflow-y-auto":void 0,children:e.jsxs(me,{children:[s.length>0&&e.jsx(he,{"data-testid":"table-header-mcp-connectors",className:"bg-[#f8f9fc]",children:e.jsxs(k,{className:"border-b border-gray-border",children:[e.jsx(m,{className:"px-6 py-3 text-md font-semibold text-secondary-dark",children:c("mcpAccess.table.colClientName")}),e.jsx(m,{className:"px-6 py-3 text-md font-semibold text-secondary-dark",children:c("mcpAccess.table.colAuthorisedDate")}),e.jsx(m,{className:"px-6 py-3 text-md font-semibold text-secondary-dark",children:c("mcpAccess.table.colStatus")}),e.jsx(m,{className:"px-6 py-3 text-md font-semibold text-secondary-dark",children:c("mcpAccess.table.colLastUsed")}),e.jsx(m,{className:"px-6 py-3"})]})}),e.jsxs(ue,{children:[s.length===0&&e.jsx(k,{"data-testid":"section-mcp-empty-state",className:"hover:bg-transparent",children:e.jsx(d,{colSpan:5,className:"py-9 px-8",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(we,{width:64,height:64}),e.jsx("h2",{"data-testid":"heading-mcp-empty-state",className:"text-base font-semibold text-secondary-dark",children:c("mcpAccess.emptyState.heading")}),e.jsxs("p",{className:"text-sm text-secondary whitespace-nowrap",children:[c("mcpAccess.emptyState.subtext")," ",e.jsxs("a",{"data-testid":"link-mcp-learn-more",href:c("mcpAccess.emptyState.learnMoreLink"),target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1 hover:underline underline-offset-2",children:[c("mcpAccess.emptyState.learnMoreLabel"),e.jsx(ge,{className:"w-[18px] h-[18px]"})]})]}),e.jsx("ul",{className:"flex flex-col items-start gap-1.5 text-left",children:c("mcpAccess.emptyState.bullets",{returnObjects:!0}).map((l,a)=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0",children:Se[a]}),e.jsx("span",{className:"text-sm text-secondary",children:l})]},a))})]})})}),s.map(l=>e.jsxs(k,{className:"border-b border-gray-border last:border-0 hover:bg-transparent",children:[e.jsx(d,{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-white border border-[#e8e8e8] flex items-center justify-center shrink-0 overflow-hidden",children:(()=>{const a=_e(l);return a.type==="img"?e.jsx("img",{src:a.src,alt:l.client_name,width:20,height:20,className:"object-contain"}):a.type==="letter"?e.jsx("span",{className:"text-xs font-bold text-secondary-dark",children:a.letter}):e.jsx(fe,{className:"w-4 h-4 text-secondary"})})()}),e.jsx("span",{className:"text-md text-secondary-dark font-medium",children:l.client_name})]})}),e.jsx(d,{className:"px-6 py-4 text-md text-secondary",children:I(l.authorised_date)}),e.jsx(d,{className:"px-6 py-4",children:l.status==="connected"?e.jsx(P,{variant:"success",className:"py-2","data-testid":`badge-connector-status-${l.client_id}`,children:c("mcpAccess.table.statusConnected")}):e.jsx(P,{variant:"danger",className:"py-2","data-testid":`badge-connector-status-${l.client_id}`,children:c("mcpAccess.table.statusRestricted")})}),e.jsx(d,{className:"px-6 py-4 text-md text-secondary","data-testid":`cell-last-used-${l.client_id}`,children:I(l.last_used)}),e.jsx(d,{className:"px-6 py-4",children:e.jsx(h,{variant:"outline-danger",size:"md","data-testid":`button-disconnect-client-${l.client_id}`,onClick:()=>t(l),children:c("mcpAccess.table.disconnectButton")})})]},l.client_id))]})]})})})},De=({connector:s,isPending:t,onConfirm:c,onClose:l})=>{const{t:a}=p();return e.jsx(R,{open:s!==null,onOpenChange:n=>!n&&l(),children:e.jsxs(V,{"data-testid":"dialog-mcp-disconnect",showCloseButton:!1,className:"max-w-md",children:[e.jsx(H,{children:e.jsx(q,{children:s?a("mcpAccess.disconnectMod
6al.title",{client_name:s.client_name}):""})}),e.jsx(Z,{className:"mt-3 text-md text-secondary",children:s?a("mcpAccess.disconnectModal.body",{client_name:s.client_name}):""}),e.jsxs(z,{className:"flex flex-row items-center justify-end gap-3 mt-6",children:[e.jsx(h,{variant:"outline-secondary-dark",size:"md","data-testid":"button-disconnect-cancel",onClick:l,disabled:t,children:a("mcpAccess.disconnectModal.cancelButton")}),e.jsx(h,{variant:"danger",size:"md","data-testid":"button-disconnect-confirm",onClick:c,disabled:t,children:a(t?"mcpAccess.disconnectModal.confirmButtonPending":"mcpAccess.disconnectModal.confirmButton")})]})]})})},Ee=({open:s,accountId:t,isPending:c,onConfirm:l,onClose:a})=>{const{t:n}=p();return e.jsx(R,{open:s,onOpenChange:r=>!r&&a(),children:e.jsxs(V,{"data-testid":"dialog-mcp-disable",showCloseButton:!1,className:"max-w-md",children:[e.jsx(H,{children:e.jsx(q,{children:n("mcpAccess.disableModal.title")})}),e.jsxs(Z,{className:"mt-3 text-md text-secondary",children:[e.jsxs("span",{className:"font-semibold text-secondary-dark",children:[n("mcpAccess.disableModal.bodyPrefix")," ",n("mcpAccess.disableModal.bodyAccountId",{account_id:t??"â"}),n("mcpAccess.disableModal.bodyManagedUsers")]}),n("mcpAccess.disableModal.bodySuffix")]}),e.jsxs(z,{className:"flex flex-row items-center justify-end gap-3 mt-6",children:[e.jsx(h,{variant:"outline-secondary-dark",size:"md","data-testid":"button-disable-mcp-cancel",onClick:a,disabled:c,children:n("mcpAccess.disableModal.cancelButton")}),e.jsx(h,{variant:"danger",size:"md","data-testid":"button-disable-mcp-confirm",onClick:l,disabled:c,children:n(c?"mcpAccess.disableModal.confirmButtonPending":"mcpAccess.disableModal.confirmButton")})]})]})})},Fe=()=>{const{t:s}=p();return e.jsxs("div",{className:"flex flex-col gap-1 mt-4",children:[e.jsxs("p",{"data-testid":"text-mcp-footer-guide",className:"text-md text-secondary-dark",children:[s("mcpAccess.footer.guideText")," ",e.jsx("a",{"data-testid":"link-mcp-guide",href:s("mcpAccess.footer.guideLink"),target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline underline-offset-2",children:s("mcpAccess.footer.guideLinkLabel")})," ",s("mcpAccess.footer.guideTextSuffix")]}),e.jsx("p",{"data-testid":"text-mcp-footer-note",className:"text-md text-secondary-dark",children:s("mcpAccess.footer.noteText")})]})},Pe=()=>{var A,L;const s=ie(o=>{var x,S;return(S=(x=o.user)==null?void 0:x.account)==null?void 0:S.id}),{data:t=[]}=de(),[c,l]=u.useState(s);u.useEffect(()=>{var o;c==null&&l(s??((o=t[0])==null?void 0:o.id))},[s,t,c]);const a=c!=null&&c===s,{data:n,isLoading:r}=je(c),i=be(),w=ye(),M=(A=n==null?void 0:n.data)==null?void 0:A.clients,v=(Array.isArray(M)?M:[]).slice().sort((o,x)=>o.status==="connected"&&x.status!=="connected"?-1:o.status!=="connected"&&x.status==="connected"?1:0),$=((L=n==null?void 0:n.data)==null?void 0:L.mcp_enabled)??!0,[C,f]=u.useState(null),[K,j]=u.useState(!1),U=o=>{if(!o){j(!0);return}i.mutate({enabled:o,account_id:c}),y("MCP Access Toggled",{enabled:o})},Q=()=>{j(!1)},Y=()=>{i.mutate({enabled:!1,account_id:c}),y("MCP Access Toggled",{enabled:!1}),j(!1)},G=o=>{f(o)},X=()=>{f(null)},J=()=>{if(!C)return;const o=C.client_id;w.mutate(o,{onSuccess:()=>{y("MCP Client Disconnected",{client_id:o}),f(null)}})};return r?e.jsx(pe,{"data-testid":"loader"}):e.jsxs("div",{"data-testid":"section-mcp-page",className:"flex flex-col gap-4",children:[e.jsx(ke,{accounts:t,value:c,onChange:l}),e.jsxs("div",{className:"bg-white rounded-[12px] px-8 py-[18px] flex flex-col gap-6",children:[e.jsx(Ne,{isEnabled:$,isAccountOwner:a,isPending:i.isPending,onToggle:U}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsx("p",{className:"text-base font-semibold text-[#001737]",children:"Connectors"}),e.jsx(Be,{connectors:v,onDisconnect:G}),v.length>0&&e.jsx(Fe,{})]})]}),e.jsx(De,{connector:C,isPending:w.isPending,onConfirm:J,onClose:X}),e.jsx(Ee,{open:K,accountId:c,isPending:i.isPending,onConfirm:Y,onClose:Q})]})},Ve=xe("/settings/mcp-access")({component:Ie});function Ie(){return e.jsx("div",{className:"bg-secondary-lightest pt-24 w-full min-h-[calc(100vh-0px)] flex-grow",children:e.jsxs("div",{className:"py-6 px-8 flex flex-col gap-6",children:[e.jsx("h1",{className:"text-xl font-semibold text-secondary-dark",children:"MCP Access"}),e.jsx(Pe,{})]})})}export{Ve as Route,Ie as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.