(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[49072],{42282:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(79477),o=n(74631),s=n(87740);let u=e=>e instanceof MouseEvent,c=function(e){let{buffer:t=0,throttleBy:n=18,excludeTouchEvents:c,onEnterBox:a,onLeaveBox:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,s.Z)(e),[d,p]=r.useState({x:null,y:null}),f=r.useRef(!1),h=r.useRef(a),w=r.useRef(l);return h.current=a,w.current=l,r.useEffect(()=>{let e=h.current,r=w.current,s=n=>{u(n)&&(n.preventDefault(),n.stopPropagation());let{clientX:o,clientY:s}=n;if(!i)return;if(!(o>=i.left-t&&o<=i.left+i.width+t&&s>=i.top-t&&s<=i.top+i.height+t)){f.current&&"function"==typeof r&&r(),f.current=!1;return}f.current||("function"==typeof e&&e(),f.current=!0);let c={x:o-i.left,y:s-i.top};f.current=!0,p(c)},[a,l]=(0,o.Ep)(s,n),[d,m]=(0,o.Ep)(e=>{s(e.touches[0])},n);return window.addEventListener("mousemove",a),c||window.addEventListener("touchmove",d),()=>{window.removeEventListener("mousemove",a),l(),c||(window.removeEventListener("touchmove",d),m())}},[i,t,n,c]),[d,i]}},49072:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var r=n(67841),o=n(79477),s=n(64833),u=n(74631),c=n(42282);function a(e){let[t,n,r]=e.toUpperCase().match(/[0-9A-F]{2}/g);return{r:t,g:n,b:r}}let l=e=>parseInt(e,16),i=e=>{let t=e.toString(16);return e<16&&(t="0".concat(t)),1===t.length&&(t="".concat(t).concat(t)),t},d=e=>{let{r:t,g:n,b:r}=e;return"#".concat(t).concat(n).concat(r)},p=e=>"linear-gradient(0deg, ".concat(e.join(", "),")"),f=(0,s.z)("div")({name:"Wrapper",class:"wk99p5d",propsAsIs:!1}),h=(0,s.z)("button")({name:"SliderButton",class:"s1ifpwuy",propsAsIs:!1}),w=(0,s.z)("span")({name:"HandleWrapper",class:"hjgdu10",propsAsIs:!1}),m=(0,s.z)("span")({name:"Handle",class:"h1g0qwxd",propsAsIs:!1}),v=o.memo(function(e){let{value:t,channel:n,color:s,dynamicGradients:a,onChange:v}=e,g=o.useRef(),E=o.useId(),[y,x]=(0,c.Z)(g,{buffer:128}),[j,k]=o.useState(!1);o.useEffect(()=>{if(!j||!y||!x)return;let e=y.y/x.height*255;v(n,e=255-Math.round((0,u.uZ)(e,0,255)))},[j,y,x,n,v]),o.useEffect(()=>{function e(){k(!1)}return window.addEventListener("mouseup",e),window.addEventListener("touchend",e),document.addEventListener("mouseleave",e),()=>{window.removeEventListener("mouseup",e),window.removeEventListener("touchend",e),document.removeEventListener("mouseleave",e)}},[j]);let b=l(t),L=(0,u.Fv)(b,0,255,100,0),A=o.useMemo(()=>(0,u.w6)(10).map(e=>{let t=a?{...s}:{r:"00",g:"00",b:"00"};return t[n]=i(Math.round((0,u.Fv)(e,0,9,0,255))),d(t)}),[n,s,a]);return(0,r.jsxs)(f,{children:[t,(0,r.jsx)(h,{ref:g,id:"slider-".concat(E),style:{background:p(A)},onMouseDown:()=>k(!0),onTouchStart:()=>k(!0),onKeyDown:function(e){switch(e.key){case"ArrowUp":e.preventDefault(),v(n,(0,u.uZ)(b+10,0,255));break;case"ArrowDown":e.preventDefault(),v(n,(0,u.uZ)(b-10,0,255))}},children:(0,r.jsx)(w,{children:(0,r.jsx)(m,{style:{top:"".concat(L,"%")}})})})]})});n(35861);let g=(0,s.z)("div")({name:"Wrapper",class:"w1puqmho",propsAsIs:!1}),E=o.memo(function(e){let{dynamicGradients:t=!1}=e,[n,s]=o.useState("FF0000"),{r:u,g:c,b:l}=a(n),d=o.useCallback((e,t)=>{s(n=>{let r=a(n);return r[e]=i(t),"".concat(r.r).concat(r.g).concat(r.b)})},[]);return(0,r.jsxs)(g,{style:{color:"#".concat(n)},children:["#",(0,r.jsx)(v,{value:u,channel:"r",color:n,dynamicGradients:t,onChange:d}),(0,r.jsx)(v,{value:c,channel:"g",color:n,dynamicGradients:t,onChange:d}),(0,r.jsx)(v,{value:l,channel:"b",color:n,dynamicGradients:t,onChange:d})]})});n(43393)},43393:e=>{e.exports={w1puqmho:"w1puqmho"}},35861:e=>{e.exports={wk99p5d:"wk99p5d",s1ifpwuy:"s1ifpwuy",hjgdu10:"hjgdu10",h1g0qwxd:"h1g0qwxd"}}}]); //# sourceMappingURL=49072.8e81c74da1ffedae.js.map