suyuan/public/admin/assets/color-convert.755d189f.js

2 lines
10 KiB
JavaScript

import{c as k}from"./color-name.e7a4e1d3.js";var y={exports:{}},b=k,m={};for(var M in b)b.hasOwnProperty(M)&&(m[b[M]]=M);var s=y.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var o in s)if(s.hasOwnProperty(o)){if(!("channels"in s[o]))throw new Error("missing channels property: "+o);if(!("labels"in s[o]))throw new Error("missing channel labels property: "+o);if(s[o].labels.length!==s[o].channels)throw new Error("channel and label counts mismatch: "+o);var d=s[o].channels,F=s[o].labels;delete s[o].channels,delete s[o].labels,Object.defineProperty(s[o],"channels",{value:d}),Object.defineProperty(s[o],"labels",{value:F})}s.rgb.hsl=function(r){var e=r[0]/255,n=r[1]/255,a=r[2]/255,t=Math.min(e,n,a),v=Math.max(e,n,a),i=v-t,u,c,h;return v===t?u=0:e===v?u=(n-a)/i:n===v?u=2+(a-e)/i:a===v&&(u=4+(e-n)/i),u=Math.min(u*60,360),u<0&&(u+=360),h=(t+v)/2,v===t?c=0:h<=.5?c=i/(v+t):c=i/(2-v-t),[u,c*100,h*100]};s.rgb.hsv=function(r){var e,n,a,t,v,i=r[0]/255,u=r[1]/255,c=r[2]/255,h=Math.max(i,u,c),f=h-Math.min(i,u,c),l=function(x){return(h-x)/6/f+1/2};return f===0?t=v=0:(v=f/h,e=l(i),n=l(u),a=l(c),i===h?t=a-n:u===h?t=1/3+e-a:c===h&&(t=2/3+n-e),t<0?t+=1:t>1&&(t-=1)),[t*360,v*100,h*100]};s.rgb.hwb=function(r){var e=r[0],n=r[1],a=r[2],t=s.rgb.hsl(r)[0],v=1/255*Math.min(e,Math.min(n,a));return a=1-1/255*Math.max(e,Math.max(n,a)),[t,v*100,a*100]};s.rgb.cmyk=function(r){var e=r[0]/255,n=r[1]/255,a=r[2]/255,t,v,i,u;return u=Math.min(1-e,1-n,1-a),t=(1-e-u)/(1-u)||0,v=(1-n-u)/(1-u)||0,i=(1-a-u)/(1-u)||0,[t*100,v*100,i*100,u*100]};function O(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}s.rgb.keyword=function(r){var e=m[r];if(e)return e;var n=1/0,a;for(var t in b)if(b.hasOwnProperty(t)){var v=b[t],i=O(r,v);i<n&&(n=i,a=t)}return a};s.keyword.rgb=function(r){return b[r]};s.rgb.xyz=function(r){var e=r[0]/255,n=r[1]/255,a=r[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92;var t=e*.4124+n*.3576+a*.1805,v=e*.2126+n*.7152+a*.0722,i=e*.0193+n*.1192+a*.9505;return[t*100,v*100,i*100]};s.rgb.lab=function(r){var e=s.rgb.xyz(r),n=e[0],a=e[1],t=e[2],v,i,u;return n/=95.047,a/=100,t/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,t=t>.008856?Math.pow(t,1/3):7.787*t+16/116,v=116*a-16,i=500*(n-a),u=200*(a-t),[v,i,u]};s.hsl.rgb=function(r){var e=r[0]/360,n=r[1]/100,a=r[2]/100,t,v,i,u,c;if(n===0)return c=a*255,[c,c,c];a<.5?v=a*(1+n):v=a+n-a*n,t=2*a-v,u=[0,0,0];for(var h=0;h<3;h++)i=e+1/3*-(h-1),i<0&&i++,i>1&&i--,6*i<1?c=t+(v-t)*6*i:2*i<1?c=v:3*i<2?c=t+(v-t)*(2/3-i)*6:c=t,u[h]=c*255;return u};s.hsl.hsv=function(r){var e=r[0],n=r[1]/100,a=r[2]/100,t=n,v=Math.max(a,.01),i,u;return a*=2,n*=a<=1?a:2-a,t*=v<=1?v:2-v,u=(a+n)/2,i=a===0?2*t/(v+t):2*n/(a+n),[e,i*100,u*100]};s.hsv.rgb=function(r){var e=r[0]/60,n=r[1]/100,a=r[2]/100,t=Math.floor(e)%6,v=e-Math.floor(e),i=255*a*(1-n),u=255*a*(1-n*v),c=255*a*(1-n*(1-v));switch(a*=255,t){case 0:return[a,c,i];case 1:return[u,a,i];case 2:return[i,a,c];case 3:return[i,u,a];case 4:return[c,i,a];case 5:return[a,i,u]}};s.hsv.hsl=function(r){var e=r[0],n=r[1]/100,a=r[2]/100,t=Math.max(a,.01),v,i,u;return u=(2-n)*a,v=(2-n)*t,i=n*t,i/=v<=1?v:2-v,i=i||0,u/=2,[e,i*100,u*100]};s.hwb.rgb=function(r){var e=r[0]/360,n=r[1]/100,a=r[2]/100,t=n+a,v,i,u,c;t>1&&(n/=t,a/=t),v=Math.floor(6*e),i=1-a,u=6*e-v,(v&1)!==0&&(u=1-u),c=n+u*(i-n);var h,f,l;switch(v){default:case 6:case 0:h=i,f=c,l=n;break;case 1:h=c,f=i,l=n;break;case 2:h=n,f=i,l=c;break;case 3:h=n,f=c,l=i;break;case 4:h=c,f=n,l=i;break;case 5:h=i,f=n,l=c;break}return[h*255,f*255,l*255]};s.cmyk.rgb=function(r){var e=r[0]/100,n=r[1]/100,a=r[2]/100,t=r[3]/100,v,i,u;return v=1-Math.min(1,e*(1-t)+t),i=1-Math.min(1,n*(1-t)+t),u=1-Math.min(1,a*(1-t)+t),[v*255,i*255,u*255]};s.xyz.rgb=function(r){var e=r[0]/100,n=r[1]/100,a=r[2]/100,t,v,i;return t=e*3.2406+n*-1.5372+a*-.4986,v=e*-.9689+n*1.8758+a*.0415,i=e*.0557+n*-.204+a*1.057,t=t>.0031308?1.055*Math.pow(t,1/2.4)-.055:t*12.92,v=v>.0031308?1.055*Math.pow(v,1/2.4)-.055:v*12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*12.92,t=Math.min(Math.max(0,t),1),v=Math.min(Math.max(0,v),1),i=Math.min(Math.max(0,i),1),[t*255,v*255,i*255]};s.xyz.lab=function(r){var e=r[0],n=r[1],a=r[2],t,v,i;return e/=95.047,n/=100,a/=108.883,e=e>.008856?Math.pow(e,1/3):7.787*e+16/116,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,t=116*n-16,v=500*(e-n),i=200*(n-a),[t,v,i]};s.lab.xyz=function(r){var e=r[0],n=r[1],a=r[2],t,v,i;v=(e+16)/116,t=n/500+v,i=v-a/200;var u=Math.pow(v,3),c=Math.pow(t,3),h=Math.pow(i,3);return v=u>.008856?u:(v-16/116)/7.787,t=c>.008856?c:(t-16/116)/7.787,i=h>.008856?h:(i-16/116)/7.787,t*=95.047,v*=100,i*=108.883,[t,v,i]};s.lab.lch=function(r){var e=r[0],n=r[1],a=r[2],t,v,i;return t=Math.atan2(a,n),v=t*360/2/Math.PI,v<0&&(v+=360),i=Math.sqrt(n*n+a*a),[e,i,v]};s.lch.lab=function(r){var e=r[0],n=r[1],a=r[2],t,v,i;return i=a/360*2*Math.PI,t=n*Math.cos(i),v=n*Math.sin(i),[e,t,v]};s.rgb.ansi16=function(r){var e=r[0],n=r[1],a=r[2],t=1 in arguments?arguments[1]:s.rgb.hsv(r)[2];if(t=Math.round(t/50),t===0)return 30;var v=30+(Math.round(a/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return t===2&&(v+=60),v};s.hsv.ansi16=function(r){return s.rgb.ansi16(s.hsv.rgb(r),r[2])};s.rgb.ansi256=function(r){var e=r[0],n=r[1],a=r[2];if(e===n&&n===a)return e<8?16:e>248?231:Math.round((e-8)/247*24)+232;var t=16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(a/255*5);return t};s.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7)return r>50&&(e+=3.5),e=e/10.5*255,[e,e,e];var n=(~~(r>50)+1)*.5,a=(e&1)*n*255,t=(e>>1&1)*n*255,v=(e>>2&1)*n*255;return[a,t,v]};s.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var n,a=Math.floor(r/36)/5*255,t=Math.floor((n=r%36)/6)/5*255,v=n%6/5*255;return[a,t,v]};s.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255),n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n};s.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];e[0].length===3&&(n=n.split("").map(function(u){return u+u}).join(""));var a=parseInt(n,16),t=a>>16&255,v=a>>8&255,i=a&255;return[t,v,i]};s.rgb.hcg=function(r){var e=r[0]/255,n=r[1]/255,a=r[2]/255,t=Math.max(Math.max(e,n),a),v=Math.min(Math.min(e,n),a),i=t-v,u,c;return i<1?u=v/(1-i):u=0,i<=0?c=0:t===e?c=(n-a)/i%6:t===n?c=2+(a-e)/i:c=4+(e-n)/i+4,c/=6,c%=1,[c*360,i*100,u*100]};s.hsl.hcg=function(r){var e=r[1]/100,n=r[2]/100,a=1,t=0;return n<.5?a=2*e*n:a=2*e*(1-n),a<1&&(t=(n-.5*a)/(1-a)),[r[0],a*100,t*100]};s.hsv.hcg=function(r){var e=r[1]/100,n=r[2]/100,a=e*n,t=0;return a<1&&(t=(n-a)/(1-a)),[r[0],a*100,t*100]};s.hcg.rgb=function(r){var e=r[0]/360,n=r[1]/100,a=r[2]/100;if(n===0)return[a*255,a*255,a*255];var t=[0,0,0],v=e%1*6,i=v%1,u=1-i,c=0;switch(Math.floor(v)){case 0:t[0]=1,t[1]=i,t[2]=0;break;case 1:t[0]=u,t[1]=1,t[2]=0;break;case 2:t[0]=0,t[1]=1,t[2]=i;break;case 3:t[0]=0,t[1]=u,t[2]=1;break;case 4:t[0]=i,t[1]=0,t[2]=1;break;default:t[0]=1,t[1]=0,t[2]=u}return c=(1-n)*a,[(n*t[0]+c)*255,(n*t[1]+c)*255,(n*t[2]+c)*255]};s.hcg.hsv=function(r){var e=r[1]/100,n=r[2]/100,a=e+n*(1-e),t=0;return a>0&&(t=e/a),[r[0],t*100,a*100]};s.hcg.hsl=function(r){var e=r[1]/100,n=r[2]/100,a=n*(1-e)+.5*e,t=0;return a>0&&a<.5?t=e/(2*a):a>=.5&&a<1&&(t=e/(2*(1-a))),[r[0],t*100,a*100]};s.hcg.hwb=function(r){var e=r[1]/100,n=r[2]/100,a=e+n*(1-e);return[r[0],(a-e)*100,(1-a)*100]};s.hwb.hcg=function(r){var e=r[1]/100,n=r[2]/100,a=1-n,t=a-e,v=0;return t<1&&(v=(a-t)/(1-t)),[r[0],t*100,v*100]};s.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};s.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};s.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};s.gray.hsl=s.gray.hsv=function(r){return[0,0,r[0]]};s.gray.hwb=function(r){return[0,100,r[0]]};s.gray.cmyk=function(r){return[0,0,0,r[0]]};s.gray.lab=function(r){return[r[0],0,0]};s.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255,n=(e<<16)+(e<<8)+e,a=n.toString(16).toUpperCase();return"000000".substring(a.length)+a};s.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]};var g=y.exports;function z(){for(var r={},e=Object.keys(g),n=e.length,a=0;a<n;a++)r[e[a]]={distance:-1,parent:null};return r}function j(r){var e=z(),n=[r];for(e[r].distance=0;n.length;)for(var a=n.pop(),t=Object.keys(g[a]),v=t.length,i=0;i<v;i++){var u=t[i],c=e[u];c.distance===-1&&(c.distance=e[a].distance+1,c.parent=a,n.unshift(u))}return e}function P(r,e){return function(n){return e(r(n))}}function C(r,e){for(var n=[e[r].parent,r],a=g[e[r].parent][r],t=e[r].parent;e[t].parent;)n.unshift(e[t].parent),a=P(g[e[t].parent][t],a),t=e[t].parent;return a.conversion=n,a}var E=function(r){for(var e=j(r),n={},a=Object.keys(e),t=a.length,v=0;v<t;v++){var i=a[v],u=e[i];u.parent!==null&&(n[i]=C(i,e))}return n},w=y.exports,S=E,p={},I=Object.keys(w);function $(r){var e=function(n){return n==null?n:(arguments.length>1&&(n=Array.prototype.slice.call(arguments)),r(n))};return"conversion"in r&&(e.conversion=r.conversion),e}function q(r){var e=function(n){if(n==null)return n;arguments.length>1&&(n=Array.prototype.slice.call(arguments));var a=r(n);if(typeof a=="object")for(var t=a.length,v=0;v<t;v++)a[v]=Math.round(a[v]);return a};return"conversion"in r&&(e.conversion=r.conversion),e}I.forEach(function(r){p[r]={},Object.defineProperty(p[r],"channels",{value:w[r].channels}),Object.defineProperty(p[r],"labels",{value:w[r].labels});var e=S(r),n=Object.keys(e);n.forEach(function(a){var t=e[a];p[r][a]=q(t),p[r][a].raw=$(t)})});var A=p;export{A as c};