UNPKG

@uiw/react-color

Version:

Color Picker component for React.

2 lines 44.8 kB
/*! For license information please see color.min.js.LICENSE.txt */ !function(e,r){"object"===typeof exports&&"object"===typeof module?module.exports=r(require("react")):"function"===typeof define&&define.amd?define(["react"],r):"object"===typeof exports?exports["@uiw/react-color"]=r(require("react")):e["@uiw/react-color"]=r(e.React)}(self,(e=>(()=>{"use strict";var r={382:e=>{var r=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(r).map((function(e){return r[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(a){return!1}}()?Object.assign:function(e,n){for(var s,l,i=a(e),p=1;p<arguments.length;p++){for(var c in s=Object(arguments[p]))t.call(s,c)&&(i[c]=s[c]);if(r){l=r(s);for(var d=0;d<l.length;d++)o.call(s,l[d])&&(i[l[d]]=s[l[d]])}}return i}},858:(e,r,t)=>{t(382);var o=t(787),a=60103;if(60107,"function"===typeof Symbol&&Symbol.for){var n=Symbol.for;a=n("react.element"),n("react.fragment")}var s=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l=Object.prototype.hasOwnProperty,i={key:!0,ref:!0,__self:!0,__source:!0};function p(e,r,t){var o,n={},p=null,c=null;for(o in void 0!==t&&(p=""+t),void 0!==r.key&&(p=""+r.key),void 0!==r.ref&&(c=r.ref),r)l.call(r,o)&&!i.hasOwnProperty(o)&&(n[o]=r[o]);if(e&&e.defaultProps)for(o in r=e.defaultProps)void 0===n[o]&&(n[o]=r[o]);return{$$typeof:a,type:e,key:p,ref:c,props:n,_owner:s.current}}r.jsx=p,r.jsxs=p},664:(e,r,t)=>{e.exports=t(858)},787:r=>{r.exports=e}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{function e(){return e=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},e.apply(this,arguments)}o.r(a),o.d(a,{Alpha:()=>te,BACKGROUND_IMG:()=>ee,Block:()=>Qe,Chrome:()=>Ue,ChromeInputType:()=>_e,Circle:()=>hr,Colorful:()=>ir,Compact:()=>rr,EditableInput:()=>Pe,EditableInputHSLA:()=>He,EditableInputRGBA:()=>Le,Github:()=>ve,GithubPlacement:()=>ue,Hue:()=>Re,Material:()=>xr,Saturation:()=>je,ShadeSlider:()=>jr,Sketch:()=>Tr,Slider:()=>Rr,Swatch:()=>ce,Wheel:()=>Wr,color:()=>H,equalColorObjects:()=>r,equalColorString:()=>t,equalHex:()=>n,getContrastingColor:()=>l,hexToHsva:()=>N,hexToRgba:()=>B,hslStringToHsla:()=>g,hslStringToHsva:()=>v,hslaStringToHsva:()=>b,hslaToHsl:()=>L,hslaToHsva:()=>x,hsvStringToHsva:()=>w,hsvaStringToHsva:()=>m,hsvaToHex:()=>F,hsvaToHexa:()=>D,hsvaToHslString:()=>d,hsvaToHsla:()=>y,hsvaToHslaString:()=>f,hsvaToHsv:()=>M,hsvaToHsvString:()=>u,hsvaToHsvaString:()=>h,hsvaToRgbString:()=>A,hsvaToRgba:()=>P,hsvaToRgbaString:()=>T,parseHue:()=>j,rgbStringToHsva:()=>S,rgbaStringToHsva:()=>O,rgbaToHex:()=>R,rgbaToHexa:()=>k,rgbaToHsva:()=>c,rgbaToRgb:()=>E,validHex:()=>s});var r=(e,r)=>{if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},t=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),n=(e,t)=>e.toLowerCase()===t.toLowerCase()||r(B(e),B(t)),s=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e),l=e=>{if(!e)return"#fff";var r=H(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000":"#fff"},i=255,p=100,c=e=>{var{r:r,g:t,b:o,a:a}=e,n=Math.max(r,t,o),s=n-Math.min(r,t,o),l=s?n===r?(t-o)/s:n===t?2+(o-r)/s:4+(r-t)/s:0;return{h:60*(l<0?l+6:l),s:n?s/n*p:0,v:n/i*p,a:a}},d=e=>{var{h:r,s:t,l:o}=y(e);return"hsl("+r+", "+Math.round(t)+"%, "+Math.round(o)+"%)"},u=e=>{var{h:r,s:t,v:o}=e;return"hsv("+r+", "+t+"%, "+o+"%)"},h=e=>{var{h:r,s:t,v:o,a:a}=e;return"hsva("+r+", "+t+"%, "+o+"%, "+a+")"},f=e=>{var{h:r,s:t,l:o,a:a}=y(e);return"hsla("+r+", "+t+"%, "+o+"%, "+a+")"},g=e=>{var[r,t,o,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:t,l:o,a:a}},b=e=>{var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?x({h:j(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},v=b,x=e=>{var{h:r,s:t,l:o,a:a}=e;return{h:r,s:(t*=(o<50?o:p-o)/p)>0?2*t/(o+t)*p:0,v:o+t,a:a}},y=e=>{var{h:r,s:t,v:o,a:a}=e,n=(200-t)*o/p;return{h:r,s:n>0&&n<200?t*o/p/(n<=p?n:200-n)*p:0,l:n/2,a:a}},m=e=>{var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?{h:j(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?p:1)}:{h:0,s:0,v:0,a:1}},C={grad:.9,turn:360,rad:360/(2*Math.PI)},j=function(e,r){return void 0===r&&(r="deg"),Number(e)*(C[r]||1)},w=m,O=e=>{var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?c({r:Number(r[1])/(r[2]?p/i:1),g:Number(r[3])/(r[4]?p/i:1),b:Number(r[5])/(r[6]?p/i:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?p:1)}):{h:0,s:0,v:0,a:1}},S=O,R=e=>{var r,{r:t,g:o,b:a}=e;return"#"+(r=(t<<16|o<<8|a).toString(16),new Array(7-r.length).join("0")+r)},k=e=>{var{r:r,g:t,b:o,a:a}=e,n="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+R({r:r,g:t,b:o,a:a})+(n||"")},N=e=>c(B(e)),B=e=>{var r=e.replace("#","");/^#?/.test(e)&&3===r.length&&(e="#"+r.charAt(0)+r.charAt(0)+r.charAt(1)+r.charAt(1)+r.charAt(2)+r.charAt(2));var t=new RegExp("[A-Za-z0-9]{2}","g"),[o,a,n=0,s]=e.match(t).map((e=>parseInt(e,16)));return{r:o,g:a,b:n,a:s?s/i:1}},P=r=>{var{h:t,s:o,v:a,a:n}=r,s=t/60,l=o/p,c=a/p,d=Math.floor(s)%6,u=s-Math.floor(s),h=i*c*(1-l),f=i*c*(1-l*u),g=i*c*(1-l*(1-u));c*=i;var b={};switch(d){case 0:b.r=c,b.g=g,b.b=h;break;case 1:b.r=f,b.g=c,b.b=h;break;case 2:b.r=h,b.g=c,b.b=g;break;case 3:b.r=h,b.g=f,b.b=c;break;case 4:b.r=g,b.g=h,b.b=c;break;case 5:b.r=c,b.g=h,b.b=f}return b.r=Math.round(b.r),b.g=Math.round(b.g),b.b=Math.round(b.b),e({},b,{a:n})},A=e=>{var{r:r,g:t,b:o}=P(e);return"rgb("+r+", "+t+", "+o+")"},T=e=>{var{r:r,g:t,b:o,a:a}=P(e);return"rgba("+r+", "+t+", "+o+", "+a+")"},E=e=>{var{r:r,g:t,b:o}=e;return{r:r,g:t,b:o}},L=e=>{var{h:r,s:t,l:o}=e;return{h:r,s:t,l:o}},F=e=>R(P(e)),D=e=>k(P(e)),M=e=>{var{h:r,s:t,v:o}=e;return{h:r,s:t,v:o}},H=e=>{var r,t,o,a,n,l,i,p;return"string"===typeof e&&s(e)?(l=N(e),i=e):"string"!==typeof e&&(l=e),l&&(o=M(l),n=y(l),a=P(l),p=k(a),i=F(l),t=L(n),r=E(a)),{rgb:r,hsl:t,hsv:o,rgba:a,hsla:n,hsva:l,hex:i,hexa:p}};function I(){return I=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},I.apply(this,arguments)}var z=o(787),_=o.n(z);function W(){return W=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},W.apply(this,arguments)}function G(e){var r=(0,z.useRef)(e);return(0,z.useEffect)((()=>{r.current=e})),(0,z.useCallback)(((e,t)=>r.current&&r.current(e,t)),[])}var U=e=>"touches"in e,q=e=>{!U(e)&&e.preventDefault&&e.preventDefault()},X=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},Y=(e,r)=>{var t=e.getBoundingClientRect(),o=U(r)?r.touches[0]:r;return{left:X((o.pageX-(t.left+window.pageXOffset))/t.width),top:X((o.pageY-(t.top+window.pageYOffset))/t.height),width:t.width,height:t.height,x:o.pageX-(t.left+window.pageXOffset),y:o.pageY-(t.top+window.pageYOffset)}},V=o(664),Q=["prefixCls","className","onMove","onDown"],Z=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-interactive",className:o,onMove:a,onDown:n}=e,s=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Q),l=(0,z.useRef)(null),i=(0,z.useRef)(!1),[p,c]=(0,z.useState)(!1),d=G(a),u=G(n),h=(0,z.useCallback)((e=>{q(e),(U(e)?e.touches.length>0:e.buttons>0)&&l.current?d&&d(Y(l.current,e),e):c(!1)}),[d]),f=(0,z.useCallback)((()=>c(!1)),[]),g=(0,z.useCallback)((e=>{var r=e?window.addEventListener:window.removeEventListener;r(i.current?"touchmove":"mousemove",h),r(i.current?"touchend":"mouseup",f)}),[]);(0,z.useEffect)((()=>(g(p),()=>{p&&g(!1)})),[p,g]);var b=(0,z.useCallback)((e=>{q(e.nativeEvent),(e=>!(i.current&&!U(e))&&(i.current=U(e),!0))(e.nativeEvent)&&(u&&u(Y(l.current,e.nativeEvent),e.nativeEvent),c(!0))}),[u]);return(0,V.jsx)("div",W({},s,{className:[t,o||""].filter(Boolean).join(" "),style:W({},s.style,{touchAction:"none"}),ref:l,tabIndex:0,onMouseDown:b,onTouchStart:b}))}));Z.displayName="Interactive";const $=Z;var J=e=>{var{className:r,prefixCls:t,left:o,top:a}=e,n={position:"absolute",left:o,top:a};return(0,z.useMemo)((()=>(0,V.jsx)("div",{className:t+"-pointer "+(r||""),style:n,children:(0,V.jsx)("div",{className:t+"-fill",style:{width:18,height:18,transform:o?"translate(-9px, -1px)":"translate(-1px, -9px)",boxShadow:"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:"50%",backgroundColor:"rgb(248, 248, 248)"}})})),[r,o,a,t])},K=["prefixCls","className","hsva","background","bgProps","innerProps","radius","width","height","direction","style","onChange","pointer"],ee="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",re=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-alpha",className:o,hsva:a,background:n,bgProps:s={},innerProps:l={},radius:i=0,width:p,height:c=16,direction:d="horizontal",style:u,onChange:h,pointer:g}=e,b=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,K),v=(0,z.useCallback)((e=>{h&&h(I({},a,{a:"horizontal"===d?e.left:e.top}),e)}),[a]),x=f(Object.assign({},a,{a:1})),y="linear-gradient(to "+("horizontal"===d?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+x+" 100%)",m={};return"horizontal"===d?m.left=100*a.a+"%":m.top=100*a.a+"%",(0,V.jsxs)("div",I({},b,{className:[t,t+"-"+d,o||""].filter(Boolean).join(" "),style:I({borderRadius:i,background:"url("+ee+") left center",backgroundColor:"#fff"},u,{position:"relative"},{width:p,height:c}),ref:r,children:[(0,V.jsx)("div",I({},s,{style:I({inset:0,position:"absolute",background:n||y,borderRadius:i},s.style)})),(0,V.jsx)($,I({},l,{style:I({},l.style,{inset:0,zIndex:1,position:"absolute"}),onMove:v,onDown:v,children:_().createElement(g||J,I({prefixCls:t},m))}))]}))}));re.displayName="Aplha";const te=re;function oe(){return oe=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},oe.apply(this,arguments)}function ae(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}function ne(){return ne=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},ne.apply(this,arguments)}function se(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}function le(){return le=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},le.apply(this,arguments)}var ie=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],pe=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-swatch",className:o,color:a,colors:n=[],style:s,rectProps:l={},onChange:i,addonAfter:p,addonBefore:c,rectRender:d}=e,u=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,ie),h=le({background:"rgb(144, 19, 254)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},l.style),f=e=>{i&&i(N(e))};return(0,V.jsxs)("div",le({ref:r},u,{className:[t,o||""].filter(Boolean).join(" "),style:le({display:"flex",flexWrap:"wrap",position:"relative"},s),children:[c&&_().isValidElement(c)&&c,n&&Array.isArray(n)&&n.map(((e,r)=>{var t="",o="";"string"===typeof e&&(t=e,o=e),"object"===typeof e&&e.color&&(t=e.title||e.color,o=e.color);var n=a&&a.toLocaleLowerCase()===o.toLocaleLowerCase();if(d)return d({key:r,title:t,color:o,checked:!!n,style:le({},h,{background:o}),onClick:()=>f(o)});var s=l.children&&_().isValidElement(l.children)?_().cloneElement(l.children,{color:o,checked:n}):null;return(0,V.jsx)("div",le({tabIndex:0,title:t,onClick:()=>f(o)},l,{children:s,style:le({},h,{background:o})}),r)})),p&&_().isValidElement(p)&&p]}))}));pe.displayName="Swatch";const ce=pe;function de(e){var{style:r,title:t,checked:o,color:a,onClick:n,rectProps:s}=e,l=(0,z.useRef)(null),i=(0,z.useCallback)((()=>{l.current.style.zIndex="2",l.current.style.outline="#fff solid 2px",l.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"}),[]),p=(0,z.useCallback)((()=>{o||(l.current.style.zIndex="0",l.current.style.outline="initial",l.current.style.boxShadow="initial")}),[o]);return(0,V.jsx)("div",ne({ref:l,title:t},s,{onClick:n,onMouseEnter:i,onMouseLeave:p,style:ne({},r,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},o?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0},s.style)}))}var ue,he=["prefixCls","placement","className","style","color","colors","rectProps","onChange"],fe=["key"],ge=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"];!function(e){e.Left="L",e.LeftTop="LT",e.LeftBotton="LB",e.Right="R",e.RightTop="RT",e.RightBotton="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Botton="B",e.BottonLeft="BL",e.BottonRight="BR"}(ue||(ue={}));var be=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-github",placement:o=ue.TopRight,className:a,style:n,color:l,colors:i=ge,rectProps:p={},onChange:c}=e,d=se(e,he),u="string"===typeof l&&s(l)?N(l):l,h=l?F(u):"",f={borderStyle:"solid",position:"absolute"},g=ne({},f),b=ne({},f);return/^T/.test(o)&&(g.borderWidth="0 8px 8px",g.borderColor="transparent transparent rgba(0, 0, 0, 0.15)",b.borderWidth="0 7px 7px",b.borderColor="transparent transparent #fff"),o===ue.TopRight&&(g.top=-8,b.top=-7),o===ue.Top&&(g.top=-8,b.top=-7),o===ue.TopLeft&&(g.top=-8,b.top=-7),/^B/.test(o)&&(g.borderWidth="8px 8px 0 ",g.borderColor="rgba(0, 0, 0, 0.15) transparent transparent",b.borderWidth="7px 7px 0px",b.borderColor="#fff transparent transparent",o===ue.BottonRight&&(g.top="100%",b.top="100%"),o===ue.Botton&&(g.top="100%",b.top="100%"),o===ue.BottonLeft&&(g.top="100%",b.top="100%")),/^(B|T)/.test(o)&&(o!==ue.Top&&o!==ue.Botton||(g.left="50%",g.marginLeft=-8,b.left="50%",b.marginLeft=-7),o!==ue.TopRight&&o!==ue.BottonRight||(g.right=10,b.right=11),o!==ue.TopLeft&&o!==ue.BottonLeft||(g.left=7,b.left=8)),/^L/.test(o)&&(g.borderWidth="8px 8px 8px 0px",g.borderColor="transparent rgba(0, 0, 0, 0.15) transparent transparent",b.borderWidth="7px 7px 7px 0px",b.borderColor="transparent #fff transparent transparent",g.left=-8,b.left=-7),/^R/.test(o)&&(g.borderWidth="8px 0px 8px 8px",g.borderColor="transparent transparent transparent rgba(0, 0, 0, 0.15)",b.borderWidth="7px 0px 7px 7px",b.borderColor="transparent transparent transparent #fff",g.right=-8,b.right=-7),/^(L|R)/.test(o)&&(o!==ue.RightTop&&o!==ue.LeftTop||(g.top=5,b.top=6),o!==ue.Left&&o!==ue.Right||(g.top="50%",b.top="50%",g.marginTop=-8,b.marginTop=-7),o!==ue.LeftBotton&&o!==ue.RightBotton||(g.top="100%",b.top="100%",g.marginTop=-21,b.marginTop=-20)),(0,V.jsx)(ce,ne({ref:r,className:[t,a].filter(Boolean).join(" "),colors:i,color:h,rectRender:e=>{var{key:r}=e,t=se(e,fe);return(0,V.jsx)(de,ne({},t,{rectProps:p}),r)}},d,{onChange:e=>c&&c(H(e)),style:ne({width:200,borderRadius:4,background:"#fff",boxShadow:"rgb(0 0 0 / 15%) 0px 3px 12px",border:"1px solid rgba(0, 0, 0, 0.2)",position:"relative",padding:5},n),rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,V.jsxs)(z.Fragment,{children:[(0,V.jsx)("div",{style:g}),(0,V.jsx)("div",{style:b})]})}))}));be.displayName="Github";const ve=be;function xe(){return xe=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},xe.apply(this,arguments)}var ye=e=>{var{className:r,color:t,left:o,top:a,prefixCls:n}=e,s={position:"absolute",top:a,left:o};return(0,z.useMemo)((()=>(0,V.jsx)("div",{className:n+"-pointer "+(r||""),style:s,children:(0,V.jsx)("div",{className:n+"-fill",style:{width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",borderRadius:"50%",backgroundColor:t}})})),[a,o,t,r,n])},me=["prefixCls","radius","pointer","className","style","hsva","onChange"],Ce=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-saturation",radius:o=0,pointer:a,className:n,style:s,hsva:l,onChange:i}=e,p=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,me),c=xe({width:200,height:200,borderRadius:o},s,{position:"relative"}),d=(e,r)=>{i&&i({h:l.h,s:100*e.left,v:100*(1-e.top),a:l.a})},u={top:100-l.v+"%",left:l.s+"%",color:f(l)};return(0,V.jsx)($,xe({className:[t,n||""].filter(Boolean).join(" ")},p,{style:xe({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+l.h+", 100%, 50%))"},c),ref:r,onMove:d,onDown:d,children:_().createElement(a||ye,xe({prefixCls:t},u))}))}));Ce.displayName="Saturation";const je=Ce;function we(){return we=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},we.apply(this,arguments)}var Oe=["prefixCls","className","hue","onChange","direction"],Se=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-hue",className:o,hue:a=0,onChange:n,direction:s="horizontal"}=e,l=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Oe);return(0,V.jsx)(te,we({ref:r,className:t+" "+(o||"")},l,{direction:s,background:"linear-gradient(to "+("horizontal"===s?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:a,s:100,v:100,a:a/360},onChange:(e,r)=>{n&&n({h:"horizontal"===s?360*r.left:360*r.top})}}))}));Se.displayName="Hue";const Re=Se;function ke(){return ke=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},ke.apply(this,arguments)}var Ne=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur"],Be=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-editable-input",placement:o="bottom",label:a,value:n,className:s,style:l,labelStyle:i,inputStyle:p,onChange:c,onBlur:d}=e,u=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Ne),[h,f]=(0,z.useState)(n),g=(0,z.useRef)(!1);(0,z.useEffect)((()=>{e.value!==h&&(g.current||f(e.value))}),[e.value]);var b={};return"bottom"===o&&(b.flexDirection="column"),"top"===o&&(b.flexDirection="column-reverse"),"left"===o&&(b.flexDirection="row-reverse"),(0,V.jsxs)("div",{className:[t,s||""].filter(Boolean).join(" "),style:ke({position:"relative",alignItems:"center",display:"flex",fontSize:11},b,l),children:[(0,V.jsx)("input",ke({ref:r,value:h,onChange:function(e,r){var t=r||e.target.value;/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(t)&&c&&c(e,t);var o=(e=>Number(String(e).replace(/%/g,"")))(t);isNaN(o)||c&&c(e,o),f(t)},onBlur:function(r){g.current=!1,f(e.value),d&&d(r)},autoComplete:"off",onFocus:()=>g.current=!0},u,{style:ke({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,boxSizing:"border-box",border:"none",boxShadow:"rgb(204 204 204) 0px 0px 0px 1px inset"},p)})),a&&(0,V.jsx)("span",{style:ke({color:"rgb(153, 153, 153)",textTransform:"capitalize"},i),children:a})]})}));Be.displayName="EditableInput";const Pe=Be;function Ae(){return Ae=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ae.apply(this,arguments)}var Te=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],Ee=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-editable-input-rgba",hsva:o,placement:a="bottom",rProps:n={},gProps:s={},bProps:l={},aProps:i={},className:p,style:d,onChange:u}=e,h=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Te),f=o?P(o):{};function g(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var b=(e,r,t)=>{"number"===typeof e&&("a"===r&&(e<0&&(e=0),e>100&&(e=100),u&&u(H(c(Ae({},f,{a:e/100}))))),e>255&&(e=255,t.target.value="255"),e<0&&(e=0,t.target.value="0"),"r"===r&&u&&u(H(c(Ae({},f,{r:e})))),"g"===r&&u&&u(H(c(Ae({},f,{g:e})))),"b"===r&&u&&u(H(c(Ae({},f,{b:e})))))};return(0,V.jsxs)("div",Ae({ref:r,className:[t,p||""].filter(Boolean).join(" ")},h,{style:Ae({fontSize:11,display:"flex"},d),children:[(0,V.jsx)(Pe,Ae({label:"R",value:f.r||0,onBlur:g,placement:a,onChange:(e,r)=>b(r,"r",e)},n,{style:Ae({},n.style)})),(0,V.jsx)(Pe,Ae({label:"G",value:f.g||0,onBlur:g,placement:a,onChange:(e,r)=>b(r,"g",e)},s,{style:Ae({marginLeft:5},n.style)})),(0,V.jsx)(Pe,Ae({label:"B",value:f.b||0,onBlur:g,placement:a,onChange:(e,r)=>b(r,"b",e)},l,{style:Ae({marginLeft:5},l.style)})),i&&(0,V.jsx)(Pe,Ae({label:"A",value:f.a?parseInt(String(100*f.a),10):0,onBlur:g,placement:a,onChange:(e,r)=>b(r,"a",e)},i,{style:Ae({marginLeft:5},i.style)}))]}))}));Ee.displayName="EditableInputRGBA";const Le=Ee;function Fe(){return Fe=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Fe.apply(this,arguments)}var De=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],Me=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-editable-input-hsla",hsva:o,hProps:a={},sProps:n={},lProps:s={},aProps:l={},className:i,onChange:p}=e,c=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,De),d=o?y(o):{h:0,s:0,l:0,a:0},u=(e,r,t)=>{"number"===typeof e&&("h"===r&&(e<0&&(e=0),e>360&&(e=360),p&&p(H(x(Fe({},d,{h:e}))))),"s"===r&&(e<0&&(e=0),e>100&&(e=100),p&&p(H(x(Fe({},d,{s:e}))))),"l"===r&&(e<0&&(e=0),e>100&&(e=100),p&&p(H(x(Fe({},d,{l:e}))))),"a"===r&&(e<0&&(e=0),e>1&&(e=1),p&&p(H(x(Fe({},d,{a:e}))))))};return(0,V.jsx)(Le,Fe({ref:r,hsva:o,rProps:Fe({label:"H",value:Math.round(d.h)},a,{onChange:(e,r)=>u(r,"h")}),gProps:Fe({label:"S",value:Math.round(d.s)+"%"},n,{onChange:(e,r)=>u(r,"s")}),bProps:Fe({label:"L",value:Math.round(d.l)+"%"},s,{onChange:(e,r)=>u(r,"l")}),aProps:Fe({label:"A",value:Math.round(100*d.a)/100},l,{onChange:(e,r)=>u(r,"a")}),className:[t,i||""].filter(Boolean).join(" ")},c))}));Me.displayName="EditableInputHSLA";const He=Me;var Ie=["style"];function ze(e){var{style:r}=e,t=ae(e,Ie),o=(0,z.useRef)(null),a=(0,z.useCallback)((e=>{o.current.style.backgroundColor="#e8e8e8"}),[]),n=(0,z.useCallback)((e=>{o.current.style.backgroundColor="transparent"}),[]);return(0,V.jsx)("div",oe({ref:o,style:oe({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},r)},t,{onMouseEnter:a,onMouseLeave:n,children:(0,V.jsx)("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:(0,V.jsx)("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"#333"})})}))}var _e,We=["prefixCls","className","style","color","inputType","rectProps","onChange"];!function(e){e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla"}(_e||(_e={}));var Ge=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-chrome",className:o,color:a,inputType:n=_e.RGBA,rectProps:l={},onChange:i}=e,p=ae(e,We),c="string"===typeof a&&s(a)?N(a):a||{h:0,s:0,l:0,a:0},d=e=>i&&i(H(e)),[u,h]=(0,z.useState)(n),f={paddingTop:6},g={textAlign:"center",paddingTop:4,paddingBottom:4};return(0,V.jsx)(ve,oe({ref:r,color:c,style:{borderRadius:0,flexDirection:"column",width:230,padding:0},colors:void 0,className:[t,o].filter(Boolean).join(" "),placement:ue.TopLeft},p,{addonAfter:(0,V.jsxs)(z.Fragment,{children:[(0,V.jsx)(je,{hsva:c,style:{width:"100%",height:130},onChange:e=>{d(oe({},c,e,{a:c.a}))}}),(0,V.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center"},children:[(0,V.jsx)(te,{width:24,height:24,hsva:c,radius:2,style:{marginRight:15,borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:{borderRadius:"50%",background:T(c),boxShadow:"rgb(0 0 0 / 25%) 0px 0px 1px inset"}},pointer:()=>(0,V.jsx)(z.Fragment,{})}),(0,V.jsxs)("div",{style:{flex:1},children:[(0,V.jsx)(Re,{hue:c.h,style:{width:"100%"},bgProps:{style:{borderRadius:2}},onChange:e=>{d(oe({},c,e))}}),(0,V.jsx)(te,{hsva:c,style:{marginTop:10},bgProps:{style:{borderRadius:2}},onChange:e=>{d(oe({},c,e))}})]})]}),(0,V.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[(0,V.jsxs)("div",{style:{flex:1},children:[u==_e.RGBA&&(0,V.jsx)(Le,{hsva:c,rProps:{labelStyle:f,inputStyle:g},gProps:{labelStyle:f,inputStyle:g},bProps:{labelStyle:f,inputStyle:g},aProps:{labelStyle:f,inputStyle:g},onChange:e=>d(e.hsva)}),u===_e.HEXA&&(0,V.jsx)(Pe,{label:"HEX",labelStyle:f,inputStyle:g,value:c.a>0&&c.a<1?D(c).toLocaleUpperCase():F(c).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&d(N(/^#/.test(r)?r:"#"+r))}}),u===_e.HSLA&&(0,V.jsx)(He,{hsva:c,hProps:{labelStyle:f,inputStyle:g},sProps:{labelStyle:f,inputStyle:g},lProps:{labelStyle:f,inputStyle:g},aProps:{labelStyle:f,inputStyle:g},onChange:e=>d(e.hsva)})]}),(0,V.jsx)(ze,{onClick:()=>{u===_e.RGBA&&h(_e.HSLA),u===_e.HSLA&&h(_e.HEXA),u===_e.HEXA&&h(_e.RGBA)}})]})]}),rectRender:e=>{var{key:r}=e;return(0,V.jsx)(z.Fragment,{},r)}}))}));Ge.displayName="Chrome";const Ue=Ge;function qe(){return qe=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},qe.apply(this,arguments)}var Xe=["prefixCls","className","style","color","colors","onChange"],Ye=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],Ve=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-block",className:o,style:a,color:n,colors:i=Ye,onChange:p}=e,c=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Xe),d="string"===typeof n&&s(n)?N(n):n,u=n?F(d):"",h=(e,r)=>{"string"===typeof e&&s(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&p&&p(H(N(e)))};return(0,V.jsxs)("div",qe({ref:r,className:[t,o].filter(Boolean).join(" "),style:qe({width:170,borderRadius:6,background:"rgb(255, 255, 255)",boxShadow:"rgb(0 0 0 / 10%) 0 1px",position:"relative"},a)},c,{children:[(0,V.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+u,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,V.jsx)("div",{title:u,style:{backgroundColor:""+u,color:l(u),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:u.toLocaleUpperCase()}),(0,V.jsx)(ce,{colors:i,color:u,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{p&&p(H(e))}}),(0,V.jsx)(Pe,{value:u.toLocaleUpperCase(),onChange:(e,r)=>h(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),h(r.slice(0,6))},inputStyle:{height:22,outline:0,borderRadius:3,color:"#666",padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));Ve.displayName="Block";const Qe=Ve;function Ze(){return Ze=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ze.apply(this,arguments)}var $e=["prefixCls","className","style","onChange","color","colors"],Je=["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"];function Ke(e){return e.checked?(0,V.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:l(e.color)}}):null}var er=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-compact",className:o,style:a,onChange:n,color:l,colors:i=Je}=e,p=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,$e),c="string"===typeof l&&s(l)?N(l):l,d=l?F(c).replace(/^#/,""):"",u=(0,z.useCallback)((e=>n&&n(H(e))),[]),h={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}};return(0,V.jsxs)("div",Ze({ref:r,style:Ze({background:"#f6f6f6",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},a),className:[t,o||""].filter(Boolean).join(" ")},p,{children:[(0,V.jsx)(ce,{colors:i,color:l?F(c):void 0,rectProps:{children:(0,V.jsx)(Ke,{}),style:{display:"flex",alignItems:"center",justifyContent:"center"}},onChange:e=>u(e)}),(0,V.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,V.jsx)(Pe,{onChange:(e,r)=>{var t;"string"===typeof(t=r)&&s(t)&&/(3|6)/.test(String(t.length))&&u(N(t))},labelStyle:{paddingRight:5,marginTop:-1},value:d.toLocaleUpperCase(),label:(0,V.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+d}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,V.jsx)(Le,{hsva:c,placement:"left",onChange:e=>u(e.hsva),aProps:!1,rProps:h,gProps:h,bProps:h})]})]}))}));er.displayName="Compact";const rr=er;function tr(){return tr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},tr.apply(this,arguments)}function or(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}var ar=["style","color"],nr=["prefixCls","className","onChange","color","style"],sr=e=>{var{style:r,color:t}=e,o=or(e,ar);return(0,V.jsx)("div",tr({},o,{style:tr({height:28,width:28,position:"absolute",transform:"translate(-14px, -4px)",boxShadow:"0 2px 4px rgb(0 0 0 / 20%)",borderRadius:"50%",background:"url("+ee+")",backgroundColor:"#fff",border:"2px solid #fff",zIndex:1},r),children:(0,V.jsx)("div",{style:{backgroundColor:t,borderRadius:"50%",height:" 100%",width:"100%"}})}))},lr=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-colorful",className:o,onChange:a,color:n,style:l}=e,i=or(e,nr),p="string"===typeof n&&s(n)?N(n):n||{},c=e=>a&&a(H(e));return(0,V.jsxs)("div",tr({ref:r,style:tr({width:200,position:"relative"},l)},i,{className:t+" "+(o||""),children:[(0,V.jsx)(je,{hsva:p,className:t,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var{left:r,top:t,color:o}=e;return(0,V.jsx)(sr,{style:{left:r,top:t,transform:"translate(-16px, -16px)"},color:F(p)})},onChange:e=>c(tr({},p,e))}),(0,V.jsx)(Re,{hue:p.h,height:24,className:t,onChange:e=>c(tr({},p,e)),pointer:e=>{var{left:r}=e;return(0,V.jsx)(sr,{style:{left:r},color:"hsl("+(p.h||0)+"deg 100% 50%)"})}}),(0,V.jsx)(te,{hsva:p,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,V.jsx)(sr,{style:{left:r},color:T(p)})},onChange:e=>c(tr({},p,e))})]}))}));lr.displayName="Colorful";const ir=lr;function pr(){return pr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},pr.apply(this,arguments)}function cr(e){var{style:r,title:t,checked:o,color:a,onClick:n,rectProps:s}=e,l=(0,z.useRef)(null),i=(0,z.useCallback)((e=>{l.current.style.transform="scale(1.2)"}),[]),p=(0,z.useCallback)((e=>{l.current.style.transform="scale(1)"}),[]);return(0,V.jsx)("div",{ref:l,onClick:n,onMouseEnter:i,onMouseLeave:p,title:t,style:pr({},r,{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:3,borderRadius:"50%",marginRight:12,marginBottom:12,boxSizing:"border-box",transform:"scale(1)",boxShadow:a+" 0px 0px "+(o?5:0)+"px",transition:"transform 100ms ease 0s, box-shadow 100ms ease 0s"}),children:(0,V.jsx)("div",pr({},s,{style:pr({height:o?"100%":0,width:o?"100%":0,borderRadius:"50%",backgroundColor:"#fff",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},s.style)}))})}var dr=["prefixCls","className","color","colors","rectProps","onChange"],ur=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-circle",className:o,color:a,colors:n=[],rectProps:l={},onChange:i}=e,p=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,dr),c="string"===typeof a&&s(a)?N(a):a||{},d=a?F(c):"";return(0,V.jsx)(ce,pr({ref:r,colors:n,color:d},p,{className:[t,o].filter(Boolean).join(" "),rectRender:e=>{var r=pr({},e);return(0,V.jsx)(cr,pr({},r,{rectProps:l}))},onChange:e=>{i&&i(H(e))}}))}));ur.displayName="Circle";const hr=ur;function fr(){return fr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},fr.apply(this,arguments)}var gr=["prefixCls","className","style","color","onChange"],br={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"#eee",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},vr=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-material",className:o,style:a,color:n,onChange:l}=e,i=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,gr),p="string"===typeof n&&s(n)?N(n):n,c=n?F(p).replace(/^#/,""):"",d=(e,r)=>{"string"===typeof e&&s(e)&&/(3|6)/.test(String(e.length))&&l&&l(H(N(e)))};return(0,V.jsxs)("div",fr({ref:r,className:[t,o||""].filter(Boolean).join(" "),style:fr({padding:16,width:98,fontFamily:"Roboto",backgroundColor:"#fff"},a)},i,{children:[(0,V.jsx)(Pe,{label:"Hex",value:c.toLocaleUpperCase(),onChange:(e,r)=>d(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),d(r.slice(0,6))},inputStyle:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:c?"#"+c:"#eee",borderBottomStyle:"solid"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,V.jsx)(Le,{hsva:p,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:fr({},br)},gProps:{style:{alignItems:"flex-start"},inputStyle:fr({},br)},bProps:{style:{alignItems:"flex-start"},inputStyle:fr({},br)},aProps:!1,onChange:e=>{return r=e.hsva,void(l&&l(H(r)));var r}})]}))}));vr.displayName="Material";const xr=vr;function yr(){return yr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},yr.apply(this,arguments)}var mr=["prefixCls","className","onChange","direction","hsva"],Cr=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-saturation",className:o,onChange:a,direction:n="horizontal",hsva:s}=e,l=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,mr),i=f(Object.assign({},s,{a:1,s:100,v:100}));return(0,V.jsx)(te,yr({ref:r},l,{className:t+" "+(o||""),hsva:{h:s.h,s:100,v:s.v,a:1-s.v/100},direction:n,background:"linear-gradient(to "+("horizontal"===n?"right":"bottom")+", "+i+", rgb(0, 0, 0))",onChange:(e,r)=>{a&&a({v:"horizontal"===n?100-100*r.left:100-100*r.top,s:100})}}))}));Cr.displayName="ShadeSlider";const jr=Cr;function wr(){return wr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},wr.apply(this,arguments)}var Or=["prefixCls","className","style","onChange","color","lightness"],Sr=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-slider",className:o,style:a,onChange:n,color:l,lightness:i=[80,65,50,35,20]}=e,p=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Or),c="string"===typeof l&&s(l)?N(l):l||{};return(0,V.jsx)("div",wr({ref:r,style:wr({display:"flex"},a),className:[t,o||""].filter(Boolean).join(" ")},p,{children:i.map(((e,r)=>{var t="hsl("+y(c).h+", 50%, "+e+"%)",o=t===d(c);return(0,V.jsx)("div",{style:{paddingLeft:1,width:100/i.length+"%",boxSizing:"border-box"},children:(0,V.jsx)("div",{onClick:e=>((e,r)=>{n&&n(H(v(e)),r)})(t,e),style:wr({backgroundColor:t,height:12,cursor:"pointer"},o?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},r)}))}))}));Sr.displayName="Slider";const Rr=Sr;function kr(){return kr=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},kr.apply(this,arguments)}var Nr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","style"],Br=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],Pr=e=>(0,V.jsx)("div",{style:{boxShadow:"rgb(0 0 0 / 60%) 0px 0px 2px",width:4,top:1,bottom:1,left:e.left,borderRadius:1,position:"absolute",backgroundColor:"#fff"}}),Ar=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-sketch",className:o,onChange:a,width:n=218,presetColors:l=Br,color:i,editableDisable:p=!0,style:c}=e,d=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,Nr),[u,h]=(0,z.useState)({h:209,s:36,v:90,a:1});(0,z.useEffect)((()=>{"string"===typeof i&&s(i)&&h(N(i)),"object"===typeof i&&h(i)}),[i]);var f=(0,z.useCallback)((e=>{h(e),a&&a(H(e))}),[u]);return(0,V.jsxs)("div",kr({},d,{className:t+" "+(o||""),ref:r,style:kr({background:"rgb(255, 255, 255)",borderRadius:4,boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px, rgb(0 0 0 / 15%) 0px 8px 16px",width:n},c),children:[(0,V.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,V.jsx)(je,{hsva:u,style:{width:"auto",height:150},onChange:e=>f(kr({},u,e,{a:u.a}))}),(0,V.jsxs)("div",{style:{display:"flex",marginTop:4},children:[(0,V.jsxs)("div",{style:{flex:1},children:[(0,V.jsx)(Re,{width:"auto",height:10,hue:u.h,pointer:Pr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>f(kr({},u,e))}),(0,V.jsx)(te,{width:"auto",height:10,hsva:u,pointer:Pr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>{f(kr({},u,{a:e.a}))}})]}),(0,V.jsx)(te,{width:24,height:24,hsva:u,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:{borderRadius:2,background:T(u),boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset, rgb(0 0 0 / 25%) 0px 0px 4px inset"}},pointer:()=>(0,V.jsx)(z.Fragment,{})})]})]}),p&&(0,V.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,V.jsx)(Pe,{label:"Hex",value:F(u).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var t;"string"===typeof(t=r)&&s(t)&&/(3|6)/.test(String(t.length))&&f(N(t))},style:{minWidth:58}}),(0,V.jsx)(Le,{hsva:u,style:{marginLeft:6},onChange:e=>f(e.hsva)})]}),l&&l.length>0&&(0,V.jsx)(ce,{style:{borderTop:"1px solid rgb(238, 238, 238)",paddingTop:10,paddingLeft:10},colors:l,color:F(u),onChange:e=>f(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset"}}})]}))}));Ar.displayName="Sketch";const Tr=Ar;function Er(){return Er=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Er.apply(this,arguments)}var Lr=e=>{var{className:r,color:t,left:o,top:a,style:n,prefixCls:s}=e,l=Er({},n,{position:"absolute",top:a,left:o});return(0,z.useMemo)((()=>(0,V.jsx)("div",{className:s+"-pointer "+(r||""),style:l,children:(0,V.jsx)("div",{className:s+"-fill",style:{width:10,height:10,transform:"translate(-5px, -5px)",boxShadow:"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",borderRadius:"50%",backgroundColor:"#fff"},children:(0,V.jsx)("div",{style:{inset:0,borderRadius:"50%",position:"absolute",backgroundColor:t}})})})),[a,o,t,r,s])},Fr=2*Math.PI,Dr=(e,r)=>Math.sqrt(e*e+r*r);function Mr(e){var{width:r=0}=e,t=r/2;return{width:r,radius:t,cx:t,cy:t}}function Hr(e){var{width:r=0}=e;return r/2}function Ir(e,r,t){var o,a=e.angle||0,n=e.direction;return t&&"clockwise"===n?r=a+r:"clockwise"===n?r=360-a+r:t&&"anticlockwise"===n?r=a+180-r:"anticlockwise"===n&&(r=a-r),(r%(o=360)+o)%o}var zr=["prefixCls","radius","pointer","className","style","width","height","direction","angle","color","onChange"],_r=_().forwardRef(((e,r)=>{var{prefixCls:t="w-color-wheel",radius:o=0,pointer:a,className:n,style:l,width:i=200,height:p=200,direction:c="anticlockwise",angle:d=180,color:u,onChange:h}=e,f=function(e,r){if(null==e)return{};var t,o,a={},n=Object.keys(e);for(o=0;o<n.length;o++)t=n[o],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,zr),g="string"===typeof u&&s(u)?N(u):u||{},b=u?F(g):"",v=function(e,r){var{cx:t,cy:o}=Mr(e),a=Hr(e),n=(180+Ir(e,r.h,!0))*(Fr/360),s=r.s/100*a,l="clockwise"===e.direction?-1:1;return{x:t+s*Math.cos(n)*l,y:o+s*Math.sin(n)*l}}({width:i},g),x={top:"0",left:"0",color:b},y=(e,r)=>{var t=function(e,r,t){var{cx:o,cy:a}=Mr(e),n=Hr(e);r=o-r,t=a-t;var s=Ir(e,Math.atan2(-t,-r)*(360/Fr)),l=Math.min(Dr(r,t),n);return{h:Math.round(s),s:Math.round(100/n*l)}}({width:i},i-e.x,p-e.y),o={h:t.h,s:t.s,v:g.v,a:g.a};h&&h(H(o))};return(0,V.jsxs)($,Er({className:[t,n||""].filter(Boolean).join(" ")},f,{style:Er({},l,{position:"relative",width:i,height:p}),ref:r,onMove:y,onDown:y,children:[_().createElement(a||Lr,Er({prefixCls:t,style:{zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px)"}},x)),(0,V.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===c?"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)":"conic-gradient(red, magenta, blue, aqua, lime, yellow, red)",transform:"rotateZ("+(d+90)+"deg)",inset:0}}),(0,V.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"radial-gradient(circle closest-side, #fff, transparent)",inset:0}}),(0,V.jsx)("div",{style:{backgroundColor:"#000",borderRadius:"50%",position:"absolute",inset:0,opacity:"number"===typeof g.v?1-g.v/100:0}})]}))}));_r.displayName="Wheel";const Wr=_r})(),a})()));