import{Wo as e}from"./app-server-manager-signals-Yn0WSnoY.js";import{t}from"./jsx-runtime-CiQ1k8xo.js";import{t as n}from"./clsx-BcPLHiun.js";import{lt as r}from"./vscode-api-DjORcpSo.js";import{c as i,o as a}from"./lib-MoKmYgcO.js";import{t as o}from"./check-md-BzLzXDM7.js";import{r as s,t as c}from"./dropdown-BuwnWUZ3.js";import{t as l}from"./globe-oc2o98t5.js";import{t as u}from"./remote-host-globe-icon-BHKHbi3J.js";import{t as d}from"./laptop-DvGDTU4m.js";import{t as f}from"./settings-shared-S83eyY-Y.js";var p=r(),m=t();function h(t){let n=(0,p.c)(41),{connectedRemoteConnections:r,disabled:l,onSelectHost:u,remoteConnectionHostIds:h,selectedHostId:v,align:y,contentWidth:b,localLabel:x,showConnectedIndicator:S,triggerClassName:C,triggerColor:w,useRemoteHostColors:T}=t,E=l===void 0?!1:l,D=S===void 0?!1:S,O=T===void 0?!0:T,k=i(),A;n[0]!==r||n[1]!==v?(A=r.find(e=>e.hostId===v)??null,n[0]=r,n[1]=v,n[2]=A):A=n[2];let j=A,M;n[3]!==k||n[4]!==x?(M=x??k.formatMessage({id:`settings.hostDropdown.local`,defaultMessage:`Local`,description:`Label for the local host in settings connection dropdowns`}),n[3]=k,n[4]=x,n[5]=M):M=n[5];let N=M,P=j?.displayName??N,F;n[6]===N?F=n[7]:(F={hostId:e,displayName:N},n[6]=N,n[7]=F);let I;n[8]!==r||n[9]!==F?(I=[F,...r],n[8]=r,n[9]=F,n[10]=I):I=n[10];let L=I,R=E?`hidden`:void 0,z;n[11]!==h||n[12]!==j||n[13]!==O?(z=j==null?(0,m.jsx)(d,{className:`icon-xs shrink-0 text-token-foreground`}):(0,m.jsx)(_,{className:`icon-xs shrink-0`,hostId:j.hostId,hostIdsForColorAssignment:h,useRemoteHostColors:O}),n[11]=h,n[12]=j,n[13]=O,n[14]=z):z=n[14];let B;n[15]===P?B=n[16]:(B=(0,m.jsx)(`span`,{className:`truncate text-left text-token-foreground`,children:P}),n[15]=P,n[16]=B);let V;n[17]!==j||n[18]!==D?(V=j!=null&&D?(0,m.jsx)(g,{}):null,n[17]=j,n[18]=D,n[19]=V):V=n[19];let H;n[20]!==E||n[21]!==B||n[22]!==V||n[23]!==R||n[24]!==z||n[25]!==C||n[26]!==w?(H=(0,m.jsxs)(f,{className:C,color:w,disabled:E,chevronClassName:R,children:[z,B,V]}),n[20]=E,n[21]=B,n[22]=V,n[23]=R,n[24]=z,n[25]=C,n[26]=w,n[27]=H):H=n[27];let U=H;if(E)return U;let W=y??`end`,G=b??`menuWide`,K;n[28]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,m.jsx)(s.Title,{children:(0,m.jsx)(a,{id:`settings.hostDropdown.title`,defaultMessage:`Host`,description:`Title for the Host dropdown shown in settings pages`})}),n[28]=K):K=n[28];let q;n[29]!==L||n[30]!==u||n[31]!==h||n[32]!==v||n[33]!==D||n[34]!==O?(q=(0,m.jsx)(s.Section,{className:`max-h-40 overflow-y-auto`,children:L.map(e=>(0,m.jsx)(s.Item,{RightIcon:e.hostId===v?o:void 0,onSelect:()=>{u(e.hostId)},children:(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[e.hostId===`local`?(0,m.jsx)(d,{className:`icon-xs shrink-0`}):(0,m.jsx)(_,{className:`icon-xs shrink-0`,hostId:e.hostId,hostIdsForColorAssignment:h,useRemoteHostColors:O}),(0,m.jsx)(`span`,{className:`truncate`,children:e.displayName}),e.hostId!==`local`&&D?(0,m.jsx)(g,{}):null]})},e.hostId))}),n[29]=L,n[30]=u,n[31]=h,n[32]=v,n[33]=D,n[34]=O,n[35]=q):q=n[35];let J;return n[36]!==W||n[37]!==G||n[38]!==q||n[39]!==U?(J=(0,m.jsxs)(c,{align:W,contentWidth:G,triggerButton:U,children:[K,q]}),n[36]=W,n[37]=G,n[38]=q,n[39]=U,n[40]=J):J=n[40],J}function g(){let e=(0,p.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,m.jsx)(`span`,{"aria-hidden":!0,className:`block size-2 shrink-0 rounded-full bg-green-500`}),e[0]=t):t=e[0],t}function _(e){let t=(0,p.c)(8),{className:r,hostId:i,hostIdsForColorAssignment:a,useRemoteHostColors:o}=e;if(!o){let e;t[0]===r?e=t[1]:(e=n(r,`text-token-foreground`),t[0]=r,t[1]=e);let i;return t[2]===e?i=t[3]:(i=(0,m.jsx)(l,{className:e}),t[2]=e,t[3]=i),i}let s;return t[4]!==r||t[5]!==i||t[6]!==a?(s=(0,m.jsx)(u,{className:r,hostId:i,hostIdsForColorAssignment:a}),t[4]=r,t[5]=i,t[6]=a,t[7]=s):s=t[7],s}export{h as t};
//# sourceMappingURL=settings-host-dropdown-CgcmPvQt.js.map