import{Hr as e}from"./src-BOCweS1p.js";import{ia as t,is as n}from"./app-server-manager-signals-Yn0WSnoY.js";import{L as r,h as i}from"./vscode-api-DjORcpSo.js";function a({remoteControlConnections:e}){let t=new Map,n=[];for(let r of e){if(r.installationId==null){n.push(r);continue}let e=t.get(r.installationId);(e==null||e.clientType!==`CODEX_DESKTOP_APP`&&r.clientType===`CODEX_DESKTOP_APP`)&&t.set(r.installationId,r)}return[...t.values(),...n]}function o({addedRemoteControlEnvIds:e,remoteControlConnections:t,remoteSshConnections:n}){return[...n,...s({addedRemoteControlEnvIds:e,remoteControlConnections:t})]}function s({addedRemoteControlEnvIds:e,remoteControlConnections:t}){let n=new Set(e),r=new Set(t.flatMap(e=>n.has(e.envId)&&e.installationId!=null?[e.installationId]:[]));return a({remoteControlConnections:t}).filter(e=>n.has(e.envId)||e.installationId!=null&&r.has(e.installationId))}function c({addedRemoteControlEnvIds:e,remoteControlConnections:t}){let n=s({addedRemoteControlEnvIds:e,remoteControlConnections:t}),r=new Set(n.map(e=>e.envId)),i=new Set(n.flatMap(e=>e.installationId==null?[]:[e.installationId]));return a({remoteControlConnections:t}).filter(e=>!r.has(e.envId)&&(e.installationId==null||!i.has(e.installationId)))}var l=r(i,({get:r})=>{let i=n(r,`remote_ssh_connections`);if(i!=null)return o({addedRemoteControlEnvIds:t(r,e.ADDED_REMOTE_CONTROL_ENV_IDS),remoteSshConnections:i,remoteControlConnections:n(r,`remote_control_connections`)??[]})}),u=r(i,({get:e})=>n(e,`remote_ssh_connections`)==null||n(e,`remote_control_connections`)==null);export{s as i,l as n,c as r,u as t};
//# sourceMappingURL=selectable-remote-connections-signal-db9FavQq.js.map