import{t as e}from"./jsx-runtime-CiQ1k8xo.js";import{I as t,lt as n}from"./vscode-api-DjORcpSo.js";import{t as r}from"./persisted-signal-CweW-bgN.js";import{t as i}from"./globe-oc2o98t5.js";var a=r(`remote-host-globe-color-by-host-id`,void 0);function o(e,{forbiddenHueRanges:t=[]}={}){let n=[...new Set(e)].sort((e,t)=>e.localeCompare(t)),r={},i=s(t),a=i.reduce((e,t)=>e+(t.end-t.start),0);return a===0||n.forEach((e,t)=>{r[e]=c((t+.5)*a/n.length,i)}),r}function s(e){let t=e.flatMap(e=>{let t=(e.start%360+360)%360,n=(e.end%360+360)%360;return t<=n?[{start:t,end:n}]:[{start:t,end:360},{start:0,end:n}]}).sort((e,t)=>e.start-t.start);if(t.length===0)return[{start:0,end:360}];let n=[];t.forEach(e=>{let t=n[n.length-1];if(!t||e.start>t.end){n.push(e);return}t.end=Math.max(t.end,e.end)});let r=[],i=0;return n.forEach(e=>{e.start>i&&r.push({start:i,end:e.start}),i=e.end}),i<360&&r.push({start:i,end:360}),r}function c(e,t){let n=e;for(let e of t){let t=e.end-e.start;if(n<=t)return e.start+n;n-=t}return t[t.length-1]?.end??0}var l=.74,u=.09,d=.18,f=[{start:330,end:45},{start:95,end:165}];function p({chroma:e,hue:t}){let n=t*Math.PI/180,r=e*Math.cos(n),i=e*Math.sin(n),a=l+.3963377774*r+.2158037573*i,o=l-.1055613458*r-.0638541728*i,s=l-.0894841775*r-1.291485548*i,c=a**3,u=o**3,d=s**3;return`#${[4.0767416621*c-3.3077115913*u+.2309699292*d,-1.2684380046*c+2.6097574011*u-.3413193965*d,-.0041960863*c-.7034186147*u+1.707614701*d].map(g).join(``)}`}function m({hostCount:e,hostIndex:t}){return e<=1?(u+d)/2:u+(d-u)/(e-1)*t}function h(e,t){let n=o(e,{forbiddenHueRanges:f}),r=Object.keys(n).sort((e,t)=>e.localeCompare(t));return Object.fromEntries(r.map((e,i)=>[e,t?.[e]??p({chroma:m({hostCount:r.length,hostIndex:i}),hue:n[e]})]))}function g(e){let t=e<=.0031308?e*12.92:1.055*e**(1/2.4)-.055;return Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,`0`)}var _=n(),v=e();function y(e){let n=(0,_.c)(11),{className:r,hostId:o,hostIdsForColorAssignment:s}=e,c=t(a),l;n[0]!==o||n[1]!==s?(l=s.includes(o)?s:[o,...s],n[0]=o,n[1]=s,n[2]=l):l=n[2];let u=l,d;n[3]!==c||n[4]!==u?(d=h(u,c),n[3]=c,n[4]=u,n[5]=d):d=n[5];let f=d[o],p;n[6]===f?p=n[7]:(p={color:f},n[6]=f,n[7]=p);let m;return n[8]!==r||n[9]!==p?(m=(0,v.jsx)(i,{className:r,style:p}),n[8]=r,n[9]=p,n[10]=m):m=n[10],m}export{h as n,a as r,y as t};
//# sourceMappingURL=remote-host-globe-icon-BHKHbi3J.js.map