/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{Vec4 as x,ifElse as n,lessThan as t,min as w,Float as e,abs as y,Vec3 as d,fract as r,clamp as u,mix as i}from"../../../graph/glsl.js";function a(r){const u=new x(0,-1/3,2/3,-1),i=n(t(r.y,r.z),new x(r.zy,u.wz),new x(r.yz,u.xy)),a=n(t(r.x,i.x),new x(i.xyw,r.x),new x(r.x,i.yzx)),c=a.x.subtract(w(a.w,a.y)),l=new e(1e-10),s=a.w.subtract(a.y),z=c.multiply(6).add(l),o=y(s.divide(z).add(a.z)),p=a.x.add(l),m=w(c.divide(p),new e(1));return new d(o,m,a.x)}function c(n){const t=new x(1,2/3,1/3,3),w=y(r(n.xxx.add(t.xyz)).multiply(6).subtract(t.www)),e=u(w.subtract(t.xxx),new d(0,0,0),new d(1));return n.z.multiply(i(t.xxx,e,n.y))}export{c as hsv2rgb,a as rgb2hsv};
