@uniformdev/cli 17.7.1-alpha.34 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/dist/chunk-IRPO3X2Q.mjs +1576 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1736 -7
- package/dist/index.mjs +174 -2
- package/dist/sync/index.d.ts +12 -12
- package/dist/sync/index.js +2008 -9
- package/dist/sync/index.mjs +420 -4
- package/package.json +7 -6
- package/dist/chunk-LPA4W6MO.mjs +0 -6
package/dist/index.js
CHANGED
|
@@ -1,8 +1,1737 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var Te=Object.create;var P=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var $e=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var K=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Se(t))!Ne.call(e,o)&&o!==r&&P(e,o,{get:()=>t[o],enumerable:!(n=Fe(t,o))||n.enumerable});return e};var O=(e,t,r)=>(r=e!=null?Te($e(e)):{},K(t||!e||!e.__esModule?P(r,"default",{value:e,enumerable:!0}):r,e)),Ue=e=>K(P({},"__esModule",{value:!0}),e);var W=g((bt,V)=>{"use strict";V.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var B=g((yt,J)=>{var M=W(),H={};for(let e of Object.keys(M))H[M[e]]=e;var a={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"]}};J.exports=a;for(let e of Object.keys(a)){if(!("channels"in a[e]))throw new Error("missing channels property: "+e);if(!("labels"in a[e]))throw new Error("missing channel labels property: "+e);if(a[e].labels.length!==a[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=a[e];delete a[e].channels,delete a[e].labels,Object.defineProperty(a[e],"channels",{value:t}),Object.defineProperty(a[e],"labels",{value:r})}a.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(t,r,n),s=Math.max(t,r,n),l=s-o,i,c;s===o?i=0:t===s?i=(r-n)/l:r===s?i=2+(n-t)/l:n===s&&(i=4+(t-r)/l),i=Math.min(i*60,360),i<0&&(i+=360);let u=(o+s)/2;return s===o?c=0:u<=.5?c=l/(s+o):c=l/(2-s-o),[i,c*100,u*100]};a.rgb.hsv=function(e){let t,r,n,o,s,l=e[0]/255,i=e[1]/255,c=e[2]/255,u=Math.max(l,i,c),d=u-Math.min(l,i,c),f=function(Be){return(u-Be)/6/d+1/2};return d===0?(o=0,s=0):(s=d/u,t=f(l),r=f(i),n=f(c),l===u?o=n-r:i===u?o=1/3+t-n:c===u&&(o=2/3+r-t),o<0?o+=1:o>1&&(o-=1)),[o*360,s*100,u*100]};a.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],o=a.rgb.hsl(e)[0],s=1/255*Math.min(t,Math.min(r,n));return n=1-1/255*Math.max(t,Math.max(r,n)),[o,s*100,n*100]};a.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-r,1-n),s=(1-t-o)/(1-o)||0,l=(1-r-o)/(1-o)||0,i=(1-n-o)/(1-o)||0;return[s*100,l*100,i*100,o*100]};function Le(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}a.rgb.keyword=function(e){let t=H[e];if(t)return t;let r=1/0,n;for(let o of Object.keys(M)){let s=M[o],l=Le(e,s);l<r&&(r=l,n=o)}return n};a.keyword.rgb=function(e){return M[e]};a.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=t*.4124+r*.3576+n*.1805,s=t*.2126+r*.7152+n*.0722,l=t*.0193+r*.1192+n*.9505;return[o*100,s*100,l*100]};a.rgb.lab=function(e){let t=a.rgb.xyz(e),r=t[0],n=t[1],o=t[2];r/=95.047,n/=100,o/=108.883,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let s=116*n-16,l=500*(r-n),i=200*(n-o);return[s,l,i]};a.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,o,s,l;if(r===0)return l=n*255,[l,l,l];n<.5?o=n*(1+r):o=n+r-n*r;let i=2*n-o,c=[0,0,0];for(let u=0;u<3;u++)s=t+1/3*-(u-1),s<0&&s++,s>1&&s--,6*s<1?l=i+(o-i)*6*s:2*s<1?l=o:3*s<2?l=i+(o-i)*(2/3-s)*6:l=i,c[u]=l*255;return c};a.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,o=r,s=Math.max(n,.01);n*=2,r*=n<=1?n:2-n,o*=s<=1?s:2-s;let l=(n+r)/2,i=n===0?2*o/(s+o):2*r/(n+r);return[t,i*100,l*100]};a.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,s=t-Math.floor(t),l=255*n*(1-r),i=255*n*(1-r*s),c=255*n*(1-r*(1-s));switch(n*=255,o){case 0:return[n,c,l];case 1:return[i,n,l];case 2:return[l,n,c];case 3:return[l,i,n];case 4:return[c,l,n];case 5:return[n,l,i]}};a.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,o=Math.max(n,.01),s,l;l=(2-r)*n;let i=(2-r)*o;return s=r*o,s/=i<=1?i:2-i,s=s||0,l/=2,[t,s*100,l*100]};a.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,o=r+n,s;o>1&&(r/=o,n/=o);let l=Math.floor(6*t),i=1-n;s=6*t-l,(l&1)!==0&&(s=1-s);let c=r+s*(i-r),u,d,f;switch(l){default:case 6:case 0:u=i,d=c,f=r;break;case 1:u=c,d=i,f=r;break;case 2:u=r,d=i,f=c;break;case 3:u=r,d=c,f=i;break;case 4:u=c,d=r,f=i;break;case 5:u=i,d=r,f=c;break}return[u*255,d*255,f*255]};a.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100,s=1-Math.min(1,t*(1-o)+o),l=1-Math.min(1,r*(1-o)+o),i=1-Math.min(1,n*(1-o)+o);return[s*255,l*255,i*255]};a.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,o,s,l;return o=t*3.2406+r*-1.5372+n*-.4986,s=t*-.9689+r*1.8758+n*.0415,l=t*.0557+r*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),l=Math.min(Math.max(0,l),1),[o*255,s*255,l*255]};a.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*r-16,s=500*(t-r),l=200*(r-n);return[o,s,l]};a.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],o,s,l;s=(t+16)/116,o=r/500+s,l=s-n/200;let i=s**3,c=o**3,u=l**3;return s=i>.008856?i:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,l=u>.008856?u:(l-16/116)/7.787,o*=95.047,s*=100,l*=108.883,[o,s,l]};a.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],o;o=Math.atan2(n,r)*360/2/Math.PI,o<0&&(o+=360);let l=Math.sqrt(r*r+n*n);return[t,l,o]};a.lch.lab=function(e){let t=e[0],r=e[1],o=e[2]/360*2*Math.PI,s=r*Math.cos(o),l=r*Math.sin(o);return[t,s,l]};a.rgb.ansi16=function(e,t=null){let[r,n,o]=e,s=t===null?a.rgb.hsv(e)[2]:t;if(s=Math.round(s/50),s===0)return 30;let l=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));return s===2&&(l+=60),l};a.hsv.ansi16=function(e){return a.rgb.ansi16(a.hsv.rgb(e),e[2])};a.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};a.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let r=(~~(e>50)+1)*.5,n=(t&1)*r*255,o=(t>>1&1)*r*255,s=(t>>2&1)*r*255;return[n,o,s]};a.ansi256.rgb=function(e){if(e>=232){let s=(e-232)*10+8;return[s,s,s]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[r,n,o]};a.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};a.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];t[0].length===3&&(r=r.split("").map(i=>i+i).join(""));let n=parseInt(r,16),o=n>>16&255,s=n>>8&255,l=n&255;return[o,s,l]};a.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,r),n),s=Math.min(Math.min(t,r),n),l=o-s,i,c;return l<1?i=s/(1-l):i=0,l<=0?c=0:o===t?c=(r-n)/l%6:o===r?c=2+(n-t)/l:c=4+(t-r)/l,c/=6,c%=1,[c*360,l*100,i*100]};a.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<.5?2*t*r:2*t*(1-r),o=0;return n<1&&(o=(r-.5*n)/(1-n)),[e[0],n*100,o*100]};a.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,o=0;return n<1&&(o=(r-n)/(1-n)),[e[0],n*100,o*100]};a.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],s=t%1*6,l=s%1,i=1-l,c=0;switch(Math.floor(s)){case 0:o[0]=1,o[1]=l,o[2]=0;break;case 1:o[0]=i,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=l;break;case 3:o[0]=0,o[1]=i,o[2]=1;break;case 4:o[0]=l,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=i}return c=(1-r)*n,[(r*o[0]+c)*255,(r*o[1]+c)*255,(r*o[2]+c)*255]};a.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),o=0;return n>0&&(o=t/n),[e[0],o*100,n*100]};a.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,o=0;return n>0&&n<.5?o=t/(2*n):n>=.5&&n<1&&(o=t/(2*(1-n))),[e[0],o*100,n*100]};a.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};a.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,o=n-t,s=0;return o<1&&(s=(n-o)/(1-o)),[e[0],o*100,s*100]};a.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};a.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};a.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};a.gray.hsl=function(e){return[0,0,e[0]]};a.gray.hsv=a.gray.hsl;a.gray.hwb=function(e){return[0,100,e[0]]};a.gray.cmyk=function(e){return[0,0,0,e[0]]};a.gray.lab=function(e){return[e[0],0,0]};a.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};a.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var Q=g((wt,X)=>{var E=B();function qe(){let e={},t=Object.keys(E);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function De(e){let t=qe(),r=[e];for(t[e].distance=0;r.length;){let n=r.pop(),o=Object.keys(E[n]);for(let s=o.length,l=0;l<s;l++){let i=o[l],c=t[i];c.distance===-1&&(c.distance=t[n].distance+1,c.parent=n,r.unshift(i))}}return t}function Ge(e,t){return function(r){return t(e(r))}}function ze(e,t){let r=[t[e].parent,e],n=E[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)r.unshift(t[o].parent),n=Ge(E[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}X.exports=function(e){let t=De(e),r={},n=Object.keys(t);for(let o=n.length,s=0;s<o;s++){let l=n[s];t[l].parent!==null&&(r[l]=ze(l,t))}return r}});var ee=g((vt,Z)=>{var T=B(),Ye=Q(),y={},Ke=Object.keys(T);function Ve(e){let t=function(...r){let n=r[0];return n==null?n:(n.length>1&&(r=n),e(r))};return"conversion"in e&&(t.conversion=e.conversion),t}function We(e){let t=function(...r){let n=r[0];if(n==null)return n;n.length>1&&(r=n);let o=e(r);if(typeof o=="object")for(let s=o.length,l=0;l<s;l++)o[l]=Math.round(o[l]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}Ke.forEach(e=>{y[e]={},Object.defineProperty(y[e],"channels",{value:T[e].channels}),Object.defineProperty(y[e],"labels",{value:T[e].labels});let t=Ye(e);Object.keys(t).forEach(n=>{let o=t[n];y[e][n]=We(o),y[e][n].raw=Ve(o)})});Z.exports=y});var le=g((kt,se)=>{"use strict";var te=(e,t)=>(...r)=>`\x1B[${e(...r)+t}m`,ne=(e,t)=>(...r)=>{let n=e(...r);return`\x1B[${38+t};5;${n}m`},re=(e,t)=>(...r)=>{let n=e(...r);return`\x1B[${38+t};2;${n[0]};${n[1]};${n[2]}m`},I=e=>e,oe=(e,t,r)=>[e,t,r],w=(e,t,r)=>{Object.defineProperty(e,t,{get:()=>{let n=r();return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},F,v=(e,t,r,n)=>{F===void 0&&(F=ee());let o=n?10:0,s={};for(let[l,i]of Object.entries(F)){let c=l==="ansi16"?"ansi":l;l===t?s[c]=e(r,o):typeof i=="object"&&(s[c]=e(i[t],o))}return s};function He(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[r,n]of Object.entries(t)){for(let[o,s]of Object.entries(n))t[o]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},n[o]=t[o],e.set(s[0],s[1]);Object.defineProperty(t,r,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",w(t.color,"ansi",()=>v(te,"ansi16",I,!1)),w(t.color,"ansi256",()=>v(ne,"ansi256",I,!1)),w(t.color,"ansi16m",()=>v(re,"rgb",oe,!1)),w(t.bgColor,"ansi",()=>v(te,"ansi16",I,!0)),w(t.bgColor,"ansi256",()=>v(ne,"ansi256",I,!0)),w(t.bgColor,"ansi16m",()=>v(re,"rgb",oe,!0)),t}Object.defineProperty(se,"exports",{enumerable:!0,get:He})});var ce=g((Ot,ie)=>{"use strict";ie.exports=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}});var fe=g((Mt,ue)=>{"use strict";var Je=require("os"),ae=require("tty"),m=ce(),{env:h}=process,b;m("no-color")||m("no-colors")||m("color=false")||m("color=never")?b=0:(m("color")||m("colors")||m("color=true")||m("color=always"))&&(b=1);"FORCE_COLOR"in h&&(h.FORCE_COLOR==="true"?b=1:h.FORCE_COLOR==="false"?b=0:b=h.FORCE_COLOR.length===0?1:Math.min(parseInt(h.FORCE_COLOR,10),3));function S(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function $(e,t){if(b===0)return 0;if(m("color=16m")||m("color=full")||m("color=truecolor"))return 3;if(m("color=256"))return 2;if(e&&!t&&b===void 0)return 0;let r=b||0;if(h.TERM==="dumb")return r;if(process.platform==="win32"){let n=Je.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in h)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in h)||h.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in h)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(h.TEAMCITY_VERSION)?1:0;if(h.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in h){let n=parseInt((h.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(h.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(h.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(h.TERM)||"COLORTERM"in h?1:r}function Xe(e){let t=$(e,e&&e.isTTY);return S(t)}ue.exports={supportsColor:Xe,stdout:S($(!0,ae.isatty(1))),stderr:S($(!0,ae.isatty(2)))}});var de=g((Ct,he)=>{"use strict";var Qe=(e,t,r)=>{let n=e.indexOf(t);if(n===-1)return e;let o=t.length,s=0,l="";do l+=e.substr(s,n-s)+t+r,s=n+o,n=e.indexOf(t,s);while(n!==-1);return l+=e.substr(s),l},Ze=(e,t,r,n)=>{let o=0,s="";do{let l=e[n-1]==="\r";s+=e.substr(o,(l?n-1:n)-o)+t+(l?`\r
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// ../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js
|
|
27
|
+
var require_color_name = __commonJS({
|
|
28
|
+
"../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js"(exports, module4) {
|
|
29
|
+
"use strict";
|
|
30
|
+
module4.exports = {
|
|
31
|
+
"aliceblue": [240, 248, 255],
|
|
32
|
+
"antiquewhite": [250, 235, 215],
|
|
33
|
+
"aqua": [0, 255, 255],
|
|
34
|
+
"aquamarine": [127, 255, 212],
|
|
35
|
+
"azure": [240, 255, 255],
|
|
36
|
+
"beige": [245, 245, 220],
|
|
37
|
+
"bisque": [255, 228, 196],
|
|
38
|
+
"black": [0, 0, 0],
|
|
39
|
+
"blanchedalmond": [255, 235, 205],
|
|
40
|
+
"blue": [0, 0, 255],
|
|
41
|
+
"blueviolet": [138, 43, 226],
|
|
42
|
+
"brown": [165, 42, 42],
|
|
43
|
+
"burlywood": [222, 184, 135],
|
|
44
|
+
"cadetblue": [95, 158, 160],
|
|
45
|
+
"chartreuse": [127, 255, 0],
|
|
46
|
+
"chocolate": [210, 105, 30],
|
|
47
|
+
"coral": [255, 127, 80],
|
|
48
|
+
"cornflowerblue": [100, 149, 237],
|
|
49
|
+
"cornsilk": [255, 248, 220],
|
|
50
|
+
"crimson": [220, 20, 60],
|
|
51
|
+
"cyan": [0, 255, 255],
|
|
52
|
+
"darkblue": [0, 0, 139],
|
|
53
|
+
"darkcyan": [0, 139, 139],
|
|
54
|
+
"darkgoldenrod": [184, 134, 11],
|
|
55
|
+
"darkgray": [169, 169, 169],
|
|
56
|
+
"darkgreen": [0, 100, 0],
|
|
57
|
+
"darkgrey": [169, 169, 169],
|
|
58
|
+
"darkkhaki": [189, 183, 107],
|
|
59
|
+
"darkmagenta": [139, 0, 139],
|
|
60
|
+
"darkolivegreen": [85, 107, 47],
|
|
61
|
+
"darkorange": [255, 140, 0],
|
|
62
|
+
"darkorchid": [153, 50, 204],
|
|
63
|
+
"darkred": [139, 0, 0],
|
|
64
|
+
"darksalmon": [233, 150, 122],
|
|
65
|
+
"darkseagreen": [143, 188, 143],
|
|
66
|
+
"darkslateblue": [72, 61, 139],
|
|
67
|
+
"darkslategray": [47, 79, 79],
|
|
68
|
+
"darkslategrey": [47, 79, 79],
|
|
69
|
+
"darkturquoise": [0, 206, 209],
|
|
70
|
+
"darkviolet": [148, 0, 211],
|
|
71
|
+
"deeppink": [255, 20, 147],
|
|
72
|
+
"deepskyblue": [0, 191, 255],
|
|
73
|
+
"dimgray": [105, 105, 105],
|
|
74
|
+
"dimgrey": [105, 105, 105],
|
|
75
|
+
"dodgerblue": [30, 144, 255],
|
|
76
|
+
"firebrick": [178, 34, 34],
|
|
77
|
+
"floralwhite": [255, 250, 240],
|
|
78
|
+
"forestgreen": [34, 139, 34],
|
|
79
|
+
"fuchsia": [255, 0, 255],
|
|
80
|
+
"gainsboro": [220, 220, 220],
|
|
81
|
+
"ghostwhite": [248, 248, 255],
|
|
82
|
+
"gold": [255, 215, 0],
|
|
83
|
+
"goldenrod": [218, 165, 32],
|
|
84
|
+
"gray": [128, 128, 128],
|
|
85
|
+
"green": [0, 128, 0],
|
|
86
|
+
"greenyellow": [173, 255, 47],
|
|
87
|
+
"grey": [128, 128, 128],
|
|
88
|
+
"honeydew": [240, 255, 240],
|
|
89
|
+
"hotpink": [255, 105, 180],
|
|
90
|
+
"indianred": [205, 92, 92],
|
|
91
|
+
"indigo": [75, 0, 130],
|
|
92
|
+
"ivory": [255, 255, 240],
|
|
93
|
+
"khaki": [240, 230, 140],
|
|
94
|
+
"lavender": [230, 230, 250],
|
|
95
|
+
"lavenderblush": [255, 240, 245],
|
|
96
|
+
"lawngreen": [124, 252, 0],
|
|
97
|
+
"lemonchiffon": [255, 250, 205],
|
|
98
|
+
"lightblue": [173, 216, 230],
|
|
99
|
+
"lightcoral": [240, 128, 128],
|
|
100
|
+
"lightcyan": [224, 255, 255],
|
|
101
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
102
|
+
"lightgray": [211, 211, 211],
|
|
103
|
+
"lightgreen": [144, 238, 144],
|
|
104
|
+
"lightgrey": [211, 211, 211],
|
|
105
|
+
"lightpink": [255, 182, 193],
|
|
106
|
+
"lightsalmon": [255, 160, 122],
|
|
107
|
+
"lightseagreen": [32, 178, 170],
|
|
108
|
+
"lightskyblue": [135, 206, 250],
|
|
109
|
+
"lightslategray": [119, 136, 153],
|
|
110
|
+
"lightslategrey": [119, 136, 153],
|
|
111
|
+
"lightsteelblue": [176, 196, 222],
|
|
112
|
+
"lightyellow": [255, 255, 224],
|
|
113
|
+
"lime": [0, 255, 0],
|
|
114
|
+
"limegreen": [50, 205, 50],
|
|
115
|
+
"linen": [250, 240, 230],
|
|
116
|
+
"magenta": [255, 0, 255],
|
|
117
|
+
"maroon": [128, 0, 0],
|
|
118
|
+
"mediumaquamarine": [102, 205, 170],
|
|
119
|
+
"mediumblue": [0, 0, 205],
|
|
120
|
+
"mediumorchid": [186, 85, 211],
|
|
121
|
+
"mediumpurple": [147, 112, 219],
|
|
122
|
+
"mediumseagreen": [60, 179, 113],
|
|
123
|
+
"mediumslateblue": [123, 104, 238],
|
|
124
|
+
"mediumspringgreen": [0, 250, 154],
|
|
125
|
+
"mediumturquoise": [72, 209, 204],
|
|
126
|
+
"mediumvioletred": [199, 21, 133],
|
|
127
|
+
"midnightblue": [25, 25, 112],
|
|
128
|
+
"mintcream": [245, 255, 250],
|
|
129
|
+
"mistyrose": [255, 228, 225],
|
|
130
|
+
"moccasin": [255, 228, 181],
|
|
131
|
+
"navajowhite": [255, 222, 173],
|
|
132
|
+
"navy": [0, 0, 128],
|
|
133
|
+
"oldlace": [253, 245, 230],
|
|
134
|
+
"olive": [128, 128, 0],
|
|
135
|
+
"olivedrab": [107, 142, 35],
|
|
136
|
+
"orange": [255, 165, 0],
|
|
137
|
+
"orangered": [255, 69, 0],
|
|
138
|
+
"orchid": [218, 112, 214],
|
|
139
|
+
"palegoldenrod": [238, 232, 170],
|
|
140
|
+
"palegreen": [152, 251, 152],
|
|
141
|
+
"paleturquoise": [175, 238, 238],
|
|
142
|
+
"palevioletred": [219, 112, 147],
|
|
143
|
+
"papayawhip": [255, 239, 213],
|
|
144
|
+
"peachpuff": [255, 218, 185],
|
|
145
|
+
"peru": [205, 133, 63],
|
|
146
|
+
"pink": [255, 192, 203],
|
|
147
|
+
"plum": [221, 160, 221],
|
|
148
|
+
"powderblue": [176, 224, 230],
|
|
149
|
+
"purple": [128, 0, 128],
|
|
150
|
+
"rebeccapurple": [102, 51, 153],
|
|
151
|
+
"red": [255, 0, 0],
|
|
152
|
+
"rosybrown": [188, 143, 143],
|
|
153
|
+
"royalblue": [65, 105, 225],
|
|
154
|
+
"saddlebrown": [139, 69, 19],
|
|
155
|
+
"salmon": [250, 128, 114],
|
|
156
|
+
"sandybrown": [244, 164, 96],
|
|
157
|
+
"seagreen": [46, 139, 87],
|
|
158
|
+
"seashell": [255, 245, 238],
|
|
159
|
+
"sienna": [160, 82, 45],
|
|
160
|
+
"silver": [192, 192, 192],
|
|
161
|
+
"skyblue": [135, 206, 235],
|
|
162
|
+
"slateblue": [106, 90, 205],
|
|
163
|
+
"slategray": [112, 128, 144],
|
|
164
|
+
"slategrey": [112, 128, 144],
|
|
165
|
+
"snow": [255, 250, 250],
|
|
166
|
+
"springgreen": [0, 255, 127],
|
|
167
|
+
"steelblue": [70, 130, 180],
|
|
168
|
+
"tan": [210, 180, 140],
|
|
169
|
+
"teal": [0, 128, 128],
|
|
170
|
+
"thistle": [216, 191, 216],
|
|
171
|
+
"tomato": [255, 99, 71],
|
|
172
|
+
"turquoise": [64, 224, 208],
|
|
173
|
+
"violet": [238, 130, 238],
|
|
174
|
+
"wheat": [245, 222, 179],
|
|
175
|
+
"white": [255, 255, 255],
|
|
176
|
+
"whitesmoke": [245, 245, 245],
|
|
177
|
+
"yellow": [255, 255, 0],
|
|
178
|
+
"yellowgreen": [154, 205, 50]
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
// ../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js
|
|
184
|
+
var require_conversions = __commonJS({
|
|
185
|
+
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js"(exports, module4) {
|
|
186
|
+
var cssKeywords = require_color_name();
|
|
187
|
+
var reverseKeywords = {};
|
|
188
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
189
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
190
|
+
}
|
|
191
|
+
var convert = {
|
|
192
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
193
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
194
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
195
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
196
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
197
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
198
|
+
lab: { channels: 3, labels: "lab" },
|
|
199
|
+
lch: { channels: 3, labels: "lch" },
|
|
200
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
201
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
202
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
203
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
204
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
205
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
206
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
207
|
+
};
|
|
208
|
+
module4.exports = convert;
|
|
209
|
+
for (const model of Object.keys(convert)) {
|
|
210
|
+
if (!("channels" in convert[model])) {
|
|
211
|
+
throw new Error("missing channels property: " + model);
|
|
212
|
+
}
|
|
213
|
+
if (!("labels" in convert[model])) {
|
|
214
|
+
throw new Error("missing channel labels property: " + model);
|
|
215
|
+
}
|
|
216
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
217
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
218
|
+
}
|
|
219
|
+
const { channels, labels } = convert[model];
|
|
220
|
+
delete convert[model].channels;
|
|
221
|
+
delete convert[model].labels;
|
|
222
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
223
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
224
|
+
}
|
|
225
|
+
convert.rgb.hsl = function(rgb) {
|
|
226
|
+
const r = rgb[0] / 255;
|
|
227
|
+
const g = rgb[1] / 255;
|
|
228
|
+
const b = rgb[2] / 255;
|
|
229
|
+
const min = Math.min(r, g, b);
|
|
230
|
+
const max = Math.max(r, g, b);
|
|
231
|
+
const delta = max - min;
|
|
232
|
+
let h;
|
|
233
|
+
let s;
|
|
234
|
+
if (max === min) {
|
|
235
|
+
h = 0;
|
|
236
|
+
} else if (r === max) {
|
|
237
|
+
h = (g - b) / delta;
|
|
238
|
+
} else if (g === max) {
|
|
239
|
+
h = 2 + (b - r) / delta;
|
|
240
|
+
} else if (b === max) {
|
|
241
|
+
h = 4 + (r - g) / delta;
|
|
242
|
+
}
|
|
243
|
+
h = Math.min(h * 60, 360);
|
|
244
|
+
if (h < 0) {
|
|
245
|
+
h += 360;
|
|
246
|
+
}
|
|
247
|
+
const l = (min + max) / 2;
|
|
248
|
+
if (max === min) {
|
|
249
|
+
s = 0;
|
|
250
|
+
} else if (l <= 0.5) {
|
|
251
|
+
s = delta / (max + min);
|
|
252
|
+
} else {
|
|
253
|
+
s = delta / (2 - max - min);
|
|
254
|
+
}
|
|
255
|
+
return [h, s * 100, l * 100];
|
|
256
|
+
};
|
|
257
|
+
convert.rgb.hsv = function(rgb) {
|
|
258
|
+
let rdif;
|
|
259
|
+
let gdif;
|
|
260
|
+
let bdif;
|
|
261
|
+
let h;
|
|
262
|
+
let s;
|
|
263
|
+
const r = rgb[0] / 255;
|
|
264
|
+
const g = rgb[1] / 255;
|
|
265
|
+
const b = rgb[2] / 255;
|
|
266
|
+
const v = Math.max(r, g, b);
|
|
267
|
+
const diff = v - Math.min(r, g, b);
|
|
268
|
+
const diffc = function(c) {
|
|
269
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
270
|
+
};
|
|
271
|
+
if (diff === 0) {
|
|
272
|
+
h = 0;
|
|
273
|
+
s = 0;
|
|
274
|
+
} else {
|
|
275
|
+
s = diff / v;
|
|
276
|
+
rdif = diffc(r);
|
|
277
|
+
gdif = diffc(g);
|
|
278
|
+
bdif = diffc(b);
|
|
279
|
+
if (r === v) {
|
|
280
|
+
h = bdif - gdif;
|
|
281
|
+
} else if (g === v) {
|
|
282
|
+
h = 1 / 3 + rdif - bdif;
|
|
283
|
+
} else if (b === v) {
|
|
284
|
+
h = 2 / 3 + gdif - rdif;
|
|
285
|
+
}
|
|
286
|
+
if (h < 0) {
|
|
287
|
+
h += 1;
|
|
288
|
+
} else if (h > 1) {
|
|
289
|
+
h -= 1;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return [
|
|
293
|
+
h * 360,
|
|
294
|
+
s * 100,
|
|
295
|
+
v * 100
|
|
296
|
+
];
|
|
297
|
+
};
|
|
298
|
+
convert.rgb.hwb = function(rgb) {
|
|
299
|
+
const r = rgb[0];
|
|
300
|
+
const g = rgb[1];
|
|
301
|
+
let b = rgb[2];
|
|
302
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
303
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
304
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
305
|
+
return [h, w * 100, b * 100];
|
|
306
|
+
};
|
|
307
|
+
convert.rgb.cmyk = function(rgb) {
|
|
308
|
+
const r = rgb[0] / 255;
|
|
309
|
+
const g = rgb[1] / 255;
|
|
310
|
+
const b = rgb[2] / 255;
|
|
311
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
312
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
313
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
314
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
315
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
316
|
+
};
|
|
317
|
+
function comparativeDistance(x, y) {
|
|
318
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
319
|
+
}
|
|
320
|
+
convert.rgb.keyword = function(rgb) {
|
|
321
|
+
const reversed = reverseKeywords[rgb];
|
|
322
|
+
if (reversed) {
|
|
323
|
+
return reversed;
|
|
324
|
+
}
|
|
325
|
+
let currentClosestDistance = Infinity;
|
|
326
|
+
let currentClosestKeyword;
|
|
327
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
328
|
+
const value = cssKeywords[keyword];
|
|
329
|
+
const distance = comparativeDistance(rgb, value);
|
|
330
|
+
if (distance < currentClosestDistance) {
|
|
331
|
+
currentClosestDistance = distance;
|
|
332
|
+
currentClosestKeyword = keyword;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return currentClosestKeyword;
|
|
336
|
+
};
|
|
337
|
+
convert.keyword.rgb = function(keyword) {
|
|
338
|
+
return cssKeywords[keyword];
|
|
339
|
+
};
|
|
340
|
+
convert.rgb.xyz = function(rgb) {
|
|
341
|
+
let r = rgb[0] / 255;
|
|
342
|
+
let g = rgb[1] / 255;
|
|
343
|
+
let b = rgb[2] / 255;
|
|
344
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
345
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
346
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
347
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
348
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
349
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
350
|
+
return [x * 100, y * 100, z * 100];
|
|
351
|
+
};
|
|
352
|
+
convert.rgb.lab = function(rgb) {
|
|
353
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
354
|
+
let x = xyz[0];
|
|
355
|
+
let y = xyz[1];
|
|
356
|
+
let z = xyz[2];
|
|
357
|
+
x /= 95.047;
|
|
358
|
+
y /= 100;
|
|
359
|
+
z /= 108.883;
|
|
360
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
361
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
362
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
363
|
+
const l = 116 * y - 16;
|
|
364
|
+
const a = 500 * (x - y);
|
|
365
|
+
const b = 200 * (y - z);
|
|
366
|
+
return [l, a, b];
|
|
367
|
+
};
|
|
368
|
+
convert.hsl.rgb = function(hsl) {
|
|
369
|
+
const h = hsl[0] / 360;
|
|
370
|
+
const s = hsl[1] / 100;
|
|
371
|
+
const l = hsl[2] / 100;
|
|
372
|
+
let t2;
|
|
373
|
+
let t3;
|
|
374
|
+
let val;
|
|
375
|
+
if (s === 0) {
|
|
376
|
+
val = l * 255;
|
|
377
|
+
return [val, val, val];
|
|
378
|
+
}
|
|
379
|
+
if (l < 0.5) {
|
|
380
|
+
t2 = l * (1 + s);
|
|
381
|
+
} else {
|
|
382
|
+
t2 = l + s - l * s;
|
|
383
|
+
}
|
|
384
|
+
const t1 = 2 * l - t2;
|
|
385
|
+
const rgb = [0, 0, 0];
|
|
386
|
+
for (let i = 0; i < 3; i++) {
|
|
387
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
388
|
+
if (t3 < 0) {
|
|
389
|
+
t3++;
|
|
390
|
+
}
|
|
391
|
+
if (t3 > 1) {
|
|
392
|
+
t3--;
|
|
393
|
+
}
|
|
394
|
+
if (6 * t3 < 1) {
|
|
395
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
396
|
+
} else if (2 * t3 < 1) {
|
|
397
|
+
val = t2;
|
|
398
|
+
} else if (3 * t3 < 2) {
|
|
399
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
400
|
+
} else {
|
|
401
|
+
val = t1;
|
|
402
|
+
}
|
|
403
|
+
rgb[i] = val * 255;
|
|
404
|
+
}
|
|
405
|
+
return rgb;
|
|
406
|
+
};
|
|
407
|
+
convert.hsl.hsv = function(hsl) {
|
|
408
|
+
const h = hsl[0];
|
|
409
|
+
let s = hsl[1] / 100;
|
|
410
|
+
let l = hsl[2] / 100;
|
|
411
|
+
let smin = s;
|
|
412
|
+
const lmin = Math.max(l, 0.01);
|
|
413
|
+
l *= 2;
|
|
414
|
+
s *= l <= 1 ? l : 2 - l;
|
|
415
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
416
|
+
const v = (l + s) / 2;
|
|
417
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
418
|
+
return [h, sv * 100, v * 100];
|
|
419
|
+
};
|
|
420
|
+
convert.hsv.rgb = function(hsv) {
|
|
421
|
+
const h = hsv[0] / 60;
|
|
422
|
+
const s = hsv[1] / 100;
|
|
423
|
+
let v = hsv[2] / 100;
|
|
424
|
+
const hi = Math.floor(h) % 6;
|
|
425
|
+
const f = h - Math.floor(h);
|
|
426
|
+
const p = 255 * v * (1 - s);
|
|
427
|
+
const q = 255 * v * (1 - s * f);
|
|
428
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
429
|
+
v *= 255;
|
|
430
|
+
switch (hi) {
|
|
431
|
+
case 0:
|
|
432
|
+
return [v, t, p];
|
|
433
|
+
case 1:
|
|
434
|
+
return [q, v, p];
|
|
435
|
+
case 2:
|
|
436
|
+
return [p, v, t];
|
|
437
|
+
case 3:
|
|
438
|
+
return [p, q, v];
|
|
439
|
+
case 4:
|
|
440
|
+
return [t, p, v];
|
|
441
|
+
case 5:
|
|
442
|
+
return [v, p, q];
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
convert.hsv.hsl = function(hsv) {
|
|
446
|
+
const h = hsv[0];
|
|
447
|
+
const s = hsv[1] / 100;
|
|
448
|
+
const v = hsv[2] / 100;
|
|
449
|
+
const vmin = Math.max(v, 0.01);
|
|
450
|
+
let sl;
|
|
451
|
+
let l;
|
|
452
|
+
l = (2 - s) * v;
|
|
453
|
+
const lmin = (2 - s) * vmin;
|
|
454
|
+
sl = s * vmin;
|
|
455
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
456
|
+
sl = sl || 0;
|
|
457
|
+
l /= 2;
|
|
458
|
+
return [h, sl * 100, l * 100];
|
|
459
|
+
};
|
|
460
|
+
convert.hwb.rgb = function(hwb) {
|
|
461
|
+
const h = hwb[0] / 360;
|
|
462
|
+
let wh = hwb[1] / 100;
|
|
463
|
+
let bl = hwb[2] / 100;
|
|
464
|
+
const ratio = wh + bl;
|
|
465
|
+
let f;
|
|
466
|
+
if (ratio > 1) {
|
|
467
|
+
wh /= ratio;
|
|
468
|
+
bl /= ratio;
|
|
469
|
+
}
|
|
470
|
+
const i = Math.floor(6 * h);
|
|
471
|
+
const v = 1 - bl;
|
|
472
|
+
f = 6 * h - i;
|
|
473
|
+
if ((i & 1) !== 0) {
|
|
474
|
+
f = 1 - f;
|
|
475
|
+
}
|
|
476
|
+
const n = wh + f * (v - wh);
|
|
477
|
+
let r;
|
|
478
|
+
let g;
|
|
479
|
+
let b;
|
|
480
|
+
switch (i) {
|
|
481
|
+
default:
|
|
482
|
+
case 6:
|
|
483
|
+
case 0:
|
|
484
|
+
r = v;
|
|
485
|
+
g = n;
|
|
486
|
+
b = wh;
|
|
487
|
+
break;
|
|
488
|
+
case 1:
|
|
489
|
+
r = n;
|
|
490
|
+
g = v;
|
|
491
|
+
b = wh;
|
|
492
|
+
break;
|
|
493
|
+
case 2:
|
|
494
|
+
r = wh;
|
|
495
|
+
g = v;
|
|
496
|
+
b = n;
|
|
497
|
+
break;
|
|
498
|
+
case 3:
|
|
499
|
+
r = wh;
|
|
500
|
+
g = n;
|
|
501
|
+
b = v;
|
|
502
|
+
break;
|
|
503
|
+
case 4:
|
|
504
|
+
r = n;
|
|
505
|
+
g = wh;
|
|
506
|
+
b = v;
|
|
507
|
+
break;
|
|
508
|
+
case 5:
|
|
509
|
+
r = v;
|
|
510
|
+
g = wh;
|
|
511
|
+
b = n;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
return [r * 255, g * 255, b * 255];
|
|
515
|
+
};
|
|
516
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
517
|
+
const c = cmyk[0] / 100;
|
|
518
|
+
const m = cmyk[1] / 100;
|
|
519
|
+
const y = cmyk[2] / 100;
|
|
520
|
+
const k = cmyk[3] / 100;
|
|
521
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
522
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
523
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
524
|
+
return [r * 255, g * 255, b * 255];
|
|
525
|
+
};
|
|
526
|
+
convert.xyz.rgb = function(xyz) {
|
|
527
|
+
const x = xyz[0] / 100;
|
|
528
|
+
const y = xyz[1] / 100;
|
|
529
|
+
const z = xyz[2] / 100;
|
|
530
|
+
let r;
|
|
531
|
+
let g;
|
|
532
|
+
let b;
|
|
533
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
534
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
535
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
536
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
537
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
538
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
539
|
+
r = Math.min(Math.max(0, r), 1);
|
|
540
|
+
g = Math.min(Math.max(0, g), 1);
|
|
541
|
+
b = Math.min(Math.max(0, b), 1);
|
|
542
|
+
return [r * 255, g * 255, b * 255];
|
|
543
|
+
};
|
|
544
|
+
convert.xyz.lab = function(xyz) {
|
|
545
|
+
let x = xyz[0];
|
|
546
|
+
let y = xyz[1];
|
|
547
|
+
let z = xyz[2];
|
|
548
|
+
x /= 95.047;
|
|
549
|
+
y /= 100;
|
|
550
|
+
z /= 108.883;
|
|
551
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
552
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
553
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
554
|
+
const l = 116 * y - 16;
|
|
555
|
+
const a = 500 * (x - y);
|
|
556
|
+
const b = 200 * (y - z);
|
|
557
|
+
return [l, a, b];
|
|
558
|
+
};
|
|
559
|
+
convert.lab.xyz = function(lab) {
|
|
560
|
+
const l = lab[0];
|
|
561
|
+
const a = lab[1];
|
|
562
|
+
const b = lab[2];
|
|
563
|
+
let x;
|
|
564
|
+
let y;
|
|
565
|
+
let z;
|
|
566
|
+
y = (l + 16) / 116;
|
|
567
|
+
x = a / 500 + y;
|
|
568
|
+
z = y - b / 200;
|
|
569
|
+
const y2 = y ** 3;
|
|
570
|
+
const x2 = x ** 3;
|
|
571
|
+
const z2 = z ** 3;
|
|
572
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
573
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
574
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
575
|
+
x *= 95.047;
|
|
576
|
+
y *= 100;
|
|
577
|
+
z *= 108.883;
|
|
578
|
+
return [x, y, z];
|
|
579
|
+
};
|
|
580
|
+
convert.lab.lch = function(lab) {
|
|
581
|
+
const l = lab[0];
|
|
582
|
+
const a = lab[1];
|
|
583
|
+
const b = lab[2];
|
|
584
|
+
let h;
|
|
585
|
+
const hr = Math.atan2(b, a);
|
|
586
|
+
h = hr * 360 / 2 / Math.PI;
|
|
587
|
+
if (h < 0) {
|
|
588
|
+
h += 360;
|
|
589
|
+
}
|
|
590
|
+
const c = Math.sqrt(a * a + b * b);
|
|
591
|
+
return [l, c, h];
|
|
592
|
+
};
|
|
593
|
+
convert.lch.lab = function(lch) {
|
|
594
|
+
const l = lch[0];
|
|
595
|
+
const c = lch[1];
|
|
596
|
+
const h = lch[2];
|
|
597
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
598
|
+
const a = c * Math.cos(hr);
|
|
599
|
+
const b = c * Math.sin(hr);
|
|
600
|
+
return [l, a, b];
|
|
601
|
+
};
|
|
602
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
603
|
+
const [r, g, b] = args;
|
|
604
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
605
|
+
value = Math.round(value / 50);
|
|
606
|
+
if (value === 0) {
|
|
607
|
+
return 30;
|
|
608
|
+
}
|
|
609
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
610
|
+
if (value === 2) {
|
|
611
|
+
ansi += 60;
|
|
612
|
+
}
|
|
613
|
+
return ansi;
|
|
614
|
+
};
|
|
615
|
+
convert.hsv.ansi16 = function(args) {
|
|
616
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
617
|
+
};
|
|
618
|
+
convert.rgb.ansi256 = function(args) {
|
|
619
|
+
const r = args[0];
|
|
620
|
+
const g = args[1];
|
|
621
|
+
const b = args[2];
|
|
622
|
+
if (r === g && g === b) {
|
|
623
|
+
if (r < 8) {
|
|
624
|
+
return 16;
|
|
625
|
+
}
|
|
626
|
+
if (r > 248) {
|
|
627
|
+
return 231;
|
|
628
|
+
}
|
|
629
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
630
|
+
}
|
|
631
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
632
|
+
return ansi;
|
|
633
|
+
};
|
|
634
|
+
convert.ansi16.rgb = function(args) {
|
|
635
|
+
let color = args % 10;
|
|
636
|
+
if (color === 0 || color === 7) {
|
|
637
|
+
if (args > 50) {
|
|
638
|
+
color += 3.5;
|
|
639
|
+
}
|
|
640
|
+
color = color / 10.5 * 255;
|
|
641
|
+
return [color, color, color];
|
|
642
|
+
}
|
|
643
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
644
|
+
const r = (color & 1) * mult * 255;
|
|
645
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
646
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
647
|
+
return [r, g, b];
|
|
648
|
+
};
|
|
649
|
+
convert.ansi256.rgb = function(args) {
|
|
650
|
+
if (args >= 232) {
|
|
651
|
+
const c = (args - 232) * 10 + 8;
|
|
652
|
+
return [c, c, c];
|
|
653
|
+
}
|
|
654
|
+
args -= 16;
|
|
655
|
+
let rem;
|
|
656
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
657
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
658
|
+
const b = rem % 6 / 5 * 255;
|
|
659
|
+
return [r, g, b];
|
|
660
|
+
};
|
|
661
|
+
convert.rgb.hex = function(args) {
|
|
662
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
663
|
+
const string = integer.toString(16).toUpperCase();
|
|
664
|
+
return "000000".substring(string.length) + string;
|
|
665
|
+
};
|
|
666
|
+
convert.hex.rgb = function(args) {
|
|
667
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
668
|
+
if (!match) {
|
|
669
|
+
return [0, 0, 0];
|
|
670
|
+
}
|
|
671
|
+
let colorString = match[0];
|
|
672
|
+
if (match[0].length === 3) {
|
|
673
|
+
colorString = colorString.split("").map((char) => {
|
|
674
|
+
return char + char;
|
|
675
|
+
}).join("");
|
|
676
|
+
}
|
|
677
|
+
const integer = parseInt(colorString, 16);
|
|
678
|
+
const r = integer >> 16 & 255;
|
|
679
|
+
const g = integer >> 8 & 255;
|
|
680
|
+
const b = integer & 255;
|
|
681
|
+
return [r, g, b];
|
|
682
|
+
};
|
|
683
|
+
convert.rgb.hcg = function(rgb) {
|
|
684
|
+
const r = rgb[0] / 255;
|
|
685
|
+
const g = rgb[1] / 255;
|
|
686
|
+
const b = rgb[2] / 255;
|
|
687
|
+
const max = Math.max(Math.max(r, g), b);
|
|
688
|
+
const min = Math.min(Math.min(r, g), b);
|
|
689
|
+
const chroma = max - min;
|
|
690
|
+
let grayscale;
|
|
691
|
+
let hue;
|
|
692
|
+
if (chroma < 1) {
|
|
693
|
+
grayscale = min / (1 - chroma);
|
|
694
|
+
} else {
|
|
695
|
+
grayscale = 0;
|
|
696
|
+
}
|
|
697
|
+
if (chroma <= 0) {
|
|
698
|
+
hue = 0;
|
|
699
|
+
} else if (max === r) {
|
|
700
|
+
hue = (g - b) / chroma % 6;
|
|
701
|
+
} else if (max === g) {
|
|
702
|
+
hue = 2 + (b - r) / chroma;
|
|
703
|
+
} else {
|
|
704
|
+
hue = 4 + (r - g) / chroma;
|
|
705
|
+
}
|
|
706
|
+
hue /= 6;
|
|
707
|
+
hue %= 1;
|
|
708
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
709
|
+
};
|
|
710
|
+
convert.hsl.hcg = function(hsl) {
|
|
711
|
+
const s = hsl[1] / 100;
|
|
712
|
+
const l = hsl[2] / 100;
|
|
713
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
714
|
+
let f = 0;
|
|
715
|
+
if (c < 1) {
|
|
716
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
717
|
+
}
|
|
718
|
+
return [hsl[0], c * 100, f * 100];
|
|
719
|
+
};
|
|
720
|
+
convert.hsv.hcg = function(hsv) {
|
|
721
|
+
const s = hsv[1] / 100;
|
|
722
|
+
const v = hsv[2] / 100;
|
|
723
|
+
const c = s * v;
|
|
724
|
+
let f = 0;
|
|
725
|
+
if (c < 1) {
|
|
726
|
+
f = (v - c) / (1 - c);
|
|
727
|
+
}
|
|
728
|
+
return [hsv[0], c * 100, f * 100];
|
|
729
|
+
};
|
|
730
|
+
convert.hcg.rgb = function(hcg) {
|
|
731
|
+
const h = hcg[0] / 360;
|
|
732
|
+
const c = hcg[1] / 100;
|
|
733
|
+
const g = hcg[2] / 100;
|
|
734
|
+
if (c === 0) {
|
|
735
|
+
return [g * 255, g * 255, g * 255];
|
|
736
|
+
}
|
|
737
|
+
const pure = [0, 0, 0];
|
|
738
|
+
const hi = h % 1 * 6;
|
|
739
|
+
const v = hi % 1;
|
|
740
|
+
const w = 1 - v;
|
|
741
|
+
let mg = 0;
|
|
742
|
+
switch (Math.floor(hi)) {
|
|
743
|
+
case 0:
|
|
744
|
+
pure[0] = 1;
|
|
745
|
+
pure[1] = v;
|
|
746
|
+
pure[2] = 0;
|
|
747
|
+
break;
|
|
748
|
+
case 1:
|
|
749
|
+
pure[0] = w;
|
|
750
|
+
pure[1] = 1;
|
|
751
|
+
pure[2] = 0;
|
|
752
|
+
break;
|
|
753
|
+
case 2:
|
|
754
|
+
pure[0] = 0;
|
|
755
|
+
pure[1] = 1;
|
|
756
|
+
pure[2] = v;
|
|
757
|
+
break;
|
|
758
|
+
case 3:
|
|
759
|
+
pure[0] = 0;
|
|
760
|
+
pure[1] = w;
|
|
761
|
+
pure[2] = 1;
|
|
762
|
+
break;
|
|
763
|
+
case 4:
|
|
764
|
+
pure[0] = v;
|
|
765
|
+
pure[1] = 0;
|
|
766
|
+
pure[2] = 1;
|
|
767
|
+
break;
|
|
768
|
+
default:
|
|
769
|
+
pure[0] = 1;
|
|
770
|
+
pure[1] = 0;
|
|
771
|
+
pure[2] = w;
|
|
772
|
+
}
|
|
773
|
+
mg = (1 - c) * g;
|
|
774
|
+
return [
|
|
775
|
+
(c * pure[0] + mg) * 255,
|
|
776
|
+
(c * pure[1] + mg) * 255,
|
|
777
|
+
(c * pure[2] + mg) * 255
|
|
778
|
+
];
|
|
779
|
+
};
|
|
780
|
+
convert.hcg.hsv = function(hcg) {
|
|
781
|
+
const c = hcg[1] / 100;
|
|
782
|
+
const g = hcg[2] / 100;
|
|
783
|
+
const v = c + g * (1 - c);
|
|
784
|
+
let f = 0;
|
|
785
|
+
if (v > 0) {
|
|
786
|
+
f = c / v;
|
|
787
|
+
}
|
|
788
|
+
return [hcg[0], f * 100, v * 100];
|
|
789
|
+
};
|
|
790
|
+
convert.hcg.hsl = function(hcg) {
|
|
791
|
+
const c = hcg[1] / 100;
|
|
792
|
+
const g = hcg[2] / 100;
|
|
793
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
794
|
+
let s = 0;
|
|
795
|
+
if (l > 0 && l < 0.5) {
|
|
796
|
+
s = c / (2 * l);
|
|
797
|
+
} else if (l >= 0.5 && l < 1) {
|
|
798
|
+
s = c / (2 * (1 - l));
|
|
799
|
+
}
|
|
800
|
+
return [hcg[0], s * 100, l * 100];
|
|
801
|
+
};
|
|
802
|
+
convert.hcg.hwb = function(hcg) {
|
|
803
|
+
const c = hcg[1] / 100;
|
|
804
|
+
const g = hcg[2] / 100;
|
|
805
|
+
const v = c + g * (1 - c);
|
|
806
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
807
|
+
};
|
|
808
|
+
convert.hwb.hcg = function(hwb) {
|
|
809
|
+
const w = hwb[1] / 100;
|
|
810
|
+
const b = hwb[2] / 100;
|
|
811
|
+
const v = 1 - b;
|
|
812
|
+
const c = v - w;
|
|
813
|
+
let g = 0;
|
|
814
|
+
if (c < 1) {
|
|
815
|
+
g = (v - c) / (1 - c);
|
|
816
|
+
}
|
|
817
|
+
return [hwb[0], c * 100, g * 100];
|
|
818
|
+
};
|
|
819
|
+
convert.apple.rgb = function(apple) {
|
|
820
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
821
|
+
};
|
|
822
|
+
convert.rgb.apple = function(rgb) {
|
|
823
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
824
|
+
};
|
|
825
|
+
convert.gray.rgb = function(args) {
|
|
826
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
827
|
+
};
|
|
828
|
+
convert.gray.hsl = function(args) {
|
|
829
|
+
return [0, 0, args[0]];
|
|
830
|
+
};
|
|
831
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
832
|
+
convert.gray.hwb = function(gray) {
|
|
833
|
+
return [0, 100, gray[0]];
|
|
834
|
+
};
|
|
835
|
+
convert.gray.cmyk = function(gray) {
|
|
836
|
+
return [0, 0, 0, gray[0]];
|
|
837
|
+
};
|
|
838
|
+
convert.gray.lab = function(gray) {
|
|
839
|
+
return [gray[0], 0, 0];
|
|
840
|
+
};
|
|
841
|
+
convert.gray.hex = function(gray) {
|
|
842
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
843
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
844
|
+
const string = integer.toString(16).toUpperCase();
|
|
845
|
+
return "000000".substring(string.length) + string;
|
|
846
|
+
};
|
|
847
|
+
convert.rgb.gray = function(rgb) {
|
|
848
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
849
|
+
return [val / 255 * 100];
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
|
|
854
|
+
// ../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js
|
|
855
|
+
var require_route = __commonJS({
|
|
856
|
+
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js"(exports, module4) {
|
|
857
|
+
var conversions = require_conversions();
|
|
858
|
+
function buildGraph() {
|
|
859
|
+
const graph = {};
|
|
860
|
+
const models = Object.keys(conversions);
|
|
861
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
862
|
+
graph[models[i]] = {
|
|
863
|
+
distance: -1,
|
|
864
|
+
parent: null
|
|
865
|
+
};
|
|
866
|
+
}
|
|
867
|
+
return graph;
|
|
868
|
+
}
|
|
869
|
+
function deriveBFS(fromModel) {
|
|
870
|
+
const graph = buildGraph();
|
|
871
|
+
const queue = [fromModel];
|
|
872
|
+
graph[fromModel].distance = 0;
|
|
873
|
+
while (queue.length) {
|
|
874
|
+
const current = queue.pop();
|
|
875
|
+
const adjacents = Object.keys(conversions[current]);
|
|
876
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
877
|
+
const adjacent = adjacents[i];
|
|
878
|
+
const node = graph[adjacent];
|
|
879
|
+
if (node.distance === -1) {
|
|
880
|
+
node.distance = graph[current].distance + 1;
|
|
881
|
+
node.parent = current;
|
|
882
|
+
queue.unshift(adjacent);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return graph;
|
|
887
|
+
}
|
|
888
|
+
function link(from, to) {
|
|
889
|
+
return function(args) {
|
|
890
|
+
return to(from(args));
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
function wrapConversion(toModel, graph) {
|
|
894
|
+
const path = [graph[toModel].parent, toModel];
|
|
895
|
+
let fn = conversions[graph[toModel].parent][toModel];
|
|
896
|
+
let cur = graph[toModel].parent;
|
|
897
|
+
while (graph[cur].parent) {
|
|
898
|
+
path.unshift(graph[cur].parent);
|
|
899
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
900
|
+
cur = graph[cur].parent;
|
|
901
|
+
}
|
|
902
|
+
fn.conversion = path;
|
|
903
|
+
return fn;
|
|
904
|
+
}
|
|
905
|
+
module4.exports = function(fromModel) {
|
|
906
|
+
const graph = deriveBFS(fromModel);
|
|
907
|
+
const conversion = {};
|
|
908
|
+
const models = Object.keys(graph);
|
|
909
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
910
|
+
const toModel = models[i];
|
|
911
|
+
const node = graph[toModel];
|
|
912
|
+
if (node.parent === null) {
|
|
913
|
+
continue;
|
|
914
|
+
}
|
|
915
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
916
|
+
}
|
|
917
|
+
return conversion;
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
|
|
922
|
+
// ../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js
|
|
923
|
+
var require_color_convert = __commonJS({
|
|
924
|
+
"../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js"(exports, module4) {
|
|
925
|
+
var conversions = require_conversions();
|
|
926
|
+
var route = require_route();
|
|
927
|
+
var convert = {};
|
|
928
|
+
var models = Object.keys(conversions);
|
|
929
|
+
function wrapRaw(fn) {
|
|
930
|
+
const wrappedFn = function(...args) {
|
|
931
|
+
const arg0 = args[0];
|
|
932
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
933
|
+
return arg0;
|
|
934
|
+
}
|
|
935
|
+
if (arg0.length > 1) {
|
|
936
|
+
args = arg0;
|
|
937
|
+
}
|
|
938
|
+
return fn(args);
|
|
939
|
+
};
|
|
940
|
+
if ("conversion" in fn) {
|
|
941
|
+
wrappedFn.conversion = fn.conversion;
|
|
942
|
+
}
|
|
943
|
+
return wrappedFn;
|
|
944
|
+
}
|
|
945
|
+
function wrapRounded(fn) {
|
|
946
|
+
const wrappedFn = function(...args) {
|
|
947
|
+
const arg0 = args[0];
|
|
948
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
949
|
+
return arg0;
|
|
950
|
+
}
|
|
951
|
+
if (arg0.length > 1) {
|
|
952
|
+
args = arg0;
|
|
953
|
+
}
|
|
954
|
+
const result = fn(args);
|
|
955
|
+
if (typeof result === "object") {
|
|
956
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
957
|
+
result[i] = Math.round(result[i]);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return result;
|
|
961
|
+
};
|
|
962
|
+
if ("conversion" in fn) {
|
|
963
|
+
wrappedFn.conversion = fn.conversion;
|
|
964
|
+
}
|
|
965
|
+
return wrappedFn;
|
|
966
|
+
}
|
|
967
|
+
models.forEach((fromModel) => {
|
|
968
|
+
convert[fromModel] = {};
|
|
969
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
970
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
971
|
+
const routes = route(fromModel);
|
|
972
|
+
const routeModels = Object.keys(routes);
|
|
973
|
+
routeModels.forEach((toModel) => {
|
|
974
|
+
const fn = routes[toModel];
|
|
975
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
976
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
977
|
+
});
|
|
978
|
+
});
|
|
979
|
+
module4.exports = convert;
|
|
980
|
+
}
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
// ../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js
|
|
984
|
+
var require_ansi_styles = __commonJS({
|
|
985
|
+
"../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js"(exports, module4) {
|
|
986
|
+
"use strict";
|
|
987
|
+
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
988
|
+
const code = fn(...args);
|
|
989
|
+
return `\x1B[${code + offset}m`;
|
|
990
|
+
};
|
|
991
|
+
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
992
|
+
const code = fn(...args);
|
|
993
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
994
|
+
};
|
|
995
|
+
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
996
|
+
const rgb = fn(...args);
|
|
997
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
998
|
+
};
|
|
999
|
+
var ansi2ansi = (n) => n;
|
|
1000
|
+
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
1001
|
+
var setLazyProperty = (object, property, get) => {
|
|
1002
|
+
Object.defineProperty(object, property, {
|
|
1003
|
+
get: () => {
|
|
1004
|
+
const value = get();
|
|
1005
|
+
Object.defineProperty(object, property, {
|
|
1006
|
+
value,
|
|
1007
|
+
enumerable: true,
|
|
1008
|
+
configurable: true
|
|
1009
|
+
});
|
|
1010
|
+
return value;
|
|
1011
|
+
},
|
|
1012
|
+
enumerable: true,
|
|
1013
|
+
configurable: true
|
|
1014
|
+
});
|
|
1015
|
+
};
|
|
1016
|
+
var colorConvert;
|
|
1017
|
+
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
1018
|
+
if (colorConvert === void 0) {
|
|
1019
|
+
colorConvert = require_color_convert();
|
|
1020
|
+
}
|
|
1021
|
+
const offset = isBackground ? 10 : 0;
|
|
1022
|
+
const styles = {};
|
|
1023
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
1024
|
+
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
1025
|
+
if (sourceSpace === targetSpace) {
|
|
1026
|
+
styles[name] = wrap(identity, offset);
|
|
1027
|
+
} else if (typeof suite === "object") {
|
|
1028
|
+
styles[name] = wrap(suite[targetSpace], offset);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return styles;
|
|
1032
|
+
};
|
|
1033
|
+
function assembleStyles() {
|
|
1034
|
+
const codes = /* @__PURE__ */ new Map();
|
|
1035
|
+
const styles = {
|
|
1036
|
+
modifier: {
|
|
1037
|
+
reset: [0, 0],
|
|
1038
|
+
bold: [1, 22],
|
|
1039
|
+
dim: [2, 22],
|
|
1040
|
+
italic: [3, 23],
|
|
1041
|
+
underline: [4, 24],
|
|
1042
|
+
inverse: [7, 27],
|
|
1043
|
+
hidden: [8, 28],
|
|
1044
|
+
strikethrough: [9, 29]
|
|
1045
|
+
},
|
|
1046
|
+
color: {
|
|
1047
|
+
black: [30, 39],
|
|
1048
|
+
red: [31, 39],
|
|
1049
|
+
green: [32, 39],
|
|
1050
|
+
yellow: [33, 39],
|
|
1051
|
+
blue: [34, 39],
|
|
1052
|
+
magenta: [35, 39],
|
|
1053
|
+
cyan: [36, 39],
|
|
1054
|
+
white: [37, 39],
|
|
1055
|
+
blackBright: [90, 39],
|
|
1056
|
+
redBright: [91, 39],
|
|
1057
|
+
greenBright: [92, 39],
|
|
1058
|
+
yellowBright: [93, 39],
|
|
1059
|
+
blueBright: [94, 39],
|
|
1060
|
+
magentaBright: [95, 39],
|
|
1061
|
+
cyanBright: [96, 39],
|
|
1062
|
+
whiteBright: [97, 39]
|
|
1063
|
+
},
|
|
1064
|
+
bgColor: {
|
|
1065
|
+
bgBlack: [40, 49],
|
|
1066
|
+
bgRed: [41, 49],
|
|
1067
|
+
bgGreen: [42, 49],
|
|
1068
|
+
bgYellow: [43, 49],
|
|
1069
|
+
bgBlue: [44, 49],
|
|
1070
|
+
bgMagenta: [45, 49],
|
|
1071
|
+
bgCyan: [46, 49],
|
|
1072
|
+
bgWhite: [47, 49],
|
|
1073
|
+
bgBlackBright: [100, 49],
|
|
1074
|
+
bgRedBright: [101, 49],
|
|
1075
|
+
bgGreenBright: [102, 49],
|
|
1076
|
+
bgYellowBright: [103, 49],
|
|
1077
|
+
bgBlueBright: [104, 49],
|
|
1078
|
+
bgMagentaBright: [105, 49],
|
|
1079
|
+
bgCyanBright: [106, 49],
|
|
1080
|
+
bgWhiteBright: [107, 49]
|
|
1081
|
+
}
|
|
1082
|
+
};
|
|
1083
|
+
styles.color.gray = styles.color.blackBright;
|
|
1084
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
1085
|
+
styles.color.grey = styles.color.blackBright;
|
|
1086
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
1087
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
1088
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
1089
|
+
styles[styleName] = {
|
|
1090
|
+
open: `\x1B[${style[0]}m`,
|
|
1091
|
+
close: `\x1B[${style[1]}m`
|
|
1092
|
+
};
|
|
1093
|
+
group[styleName] = styles[styleName];
|
|
1094
|
+
codes.set(style[0], style[1]);
|
|
1095
|
+
}
|
|
1096
|
+
Object.defineProperty(styles, groupName, {
|
|
1097
|
+
value: group,
|
|
1098
|
+
enumerable: false
|
|
1099
|
+
});
|
|
1100
|
+
}
|
|
1101
|
+
Object.defineProperty(styles, "codes", {
|
|
1102
|
+
value: codes,
|
|
1103
|
+
enumerable: false
|
|
1104
|
+
});
|
|
1105
|
+
styles.color.close = "\x1B[39m";
|
|
1106
|
+
styles.bgColor.close = "\x1B[49m";
|
|
1107
|
+
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
1108
|
+
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
1109
|
+
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
1110
|
+
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
1111
|
+
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
1112
|
+
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
1113
|
+
return styles;
|
|
1114
|
+
}
|
|
1115
|
+
Object.defineProperty(module4, "exports", {
|
|
1116
|
+
enumerable: true,
|
|
1117
|
+
get: assembleStyles
|
|
1118
|
+
});
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
// ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
1123
|
+
var require_has_flag = __commonJS({
|
|
1124
|
+
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module4) {
|
|
1125
|
+
"use strict";
|
|
1126
|
+
module4.exports = (flag, argv = process.argv) => {
|
|
1127
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
1128
|
+
const position = argv.indexOf(prefix + flag);
|
|
1129
|
+
const terminatorPosition = argv.indexOf("--");
|
|
1130
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
});
|
|
1134
|
+
|
|
1135
|
+
// ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
1136
|
+
var require_supports_color = __commonJS({
|
|
1137
|
+
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module4) {
|
|
1138
|
+
"use strict";
|
|
1139
|
+
var os = require("os");
|
|
1140
|
+
var tty = require("tty");
|
|
1141
|
+
var hasFlag = require_has_flag();
|
|
1142
|
+
var { env } = process;
|
|
1143
|
+
var forceColor;
|
|
1144
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
1145
|
+
forceColor = 0;
|
|
1146
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
1147
|
+
forceColor = 1;
|
|
1148
|
+
}
|
|
1149
|
+
if ("FORCE_COLOR" in env) {
|
|
1150
|
+
if (env.FORCE_COLOR === "true") {
|
|
1151
|
+
forceColor = 1;
|
|
1152
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
1153
|
+
forceColor = 0;
|
|
1154
|
+
} else {
|
|
1155
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function translateLevel(level) {
|
|
1159
|
+
if (level === 0) {
|
|
1160
|
+
return false;
|
|
1161
|
+
}
|
|
1162
|
+
return {
|
|
1163
|
+
level,
|
|
1164
|
+
hasBasic: true,
|
|
1165
|
+
has256: level >= 2,
|
|
1166
|
+
has16m: level >= 3
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
1170
|
+
if (forceColor === 0) {
|
|
1171
|
+
return 0;
|
|
1172
|
+
}
|
|
1173
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
1174
|
+
return 3;
|
|
1175
|
+
}
|
|
1176
|
+
if (hasFlag("color=256")) {
|
|
1177
|
+
return 2;
|
|
1178
|
+
}
|
|
1179
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
1180
|
+
return 0;
|
|
1181
|
+
}
|
|
1182
|
+
const min = forceColor || 0;
|
|
1183
|
+
if (env.TERM === "dumb") {
|
|
1184
|
+
return min;
|
|
1185
|
+
}
|
|
1186
|
+
if (process.platform === "win32") {
|
|
1187
|
+
const osRelease = os.release().split(".");
|
|
1188
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
1189
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
1190
|
+
}
|
|
1191
|
+
return 1;
|
|
1192
|
+
}
|
|
1193
|
+
if ("CI" in env) {
|
|
1194
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
1195
|
+
return 1;
|
|
1196
|
+
}
|
|
1197
|
+
return min;
|
|
1198
|
+
}
|
|
1199
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
1200
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
1201
|
+
}
|
|
1202
|
+
if (env.COLORTERM === "truecolor") {
|
|
1203
|
+
return 3;
|
|
1204
|
+
}
|
|
1205
|
+
if ("TERM_PROGRAM" in env) {
|
|
1206
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
1207
|
+
switch (env.TERM_PROGRAM) {
|
|
1208
|
+
case "iTerm.app":
|
|
1209
|
+
return version >= 3 ? 3 : 2;
|
|
1210
|
+
case "Apple_Terminal":
|
|
1211
|
+
return 2;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
1215
|
+
return 2;
|
|
1216
|
+
}
|
|
1217
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
1218
|
+
return 1;
|
|
1219
|
+
}
|
|
1220
|
+
if ("COLORTERM" in env) {
|
|
1221
|
+
return 1;
|
|
1222
|
+
}
|
|
1223
|
+
return min;
|
|
1224
|
+
}
|
|
1225
|
+
function getSupportLevel(stream) {
|
|
1226
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
1227
|
+
return translateLevel(level);
|
|
1228
|
+
}
|
|
1229
|
+
module4.exports = {
|
|
1230
|
+
supportsColor: getSupportLevel,
|
|
1231
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
1232
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1237
|
+
// ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js
|
|
1238
|
+
var require_util = __commonJS({
|
|
1239
|
+
"../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js"(exports, module4) {
|
|
1240
|
+
"use strict";
|
|
1241
|
+
var stringReplaceAll = (string, substring, replacer) => {
|
|
1242
|
+
let index = string.indexOf(substring);
|
|
1243
|
+
if (index === -1) {
|
|
1244
|
+
return string;
|
|
1245
|
+
}
|
|
1246
|
+
const substringLength = substring.length;
|
|
1247
|
+
let endIndex = 0;
|
|
1248
|
+
let returnValue = "";
|
|
1249
|
+
do {
|
|
1250
|
+
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
|
|
1251
|
+
endIndex = index + substringLength;
|
|
1252
|
+
index = string.indexOf(substring, endIndex);
|
|
1253
|
+
} while (index !== -1);
|
|
1254
|
+
returnValue += string.substr(endIndex);
|
|
1255
|
+
return returnValue;
|
|
1256
|
+
};
|
|
1257
|
+
var stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
|
|
1258
|
+
let endIndex = 0;
|
|
1259
|
+
let returnValue = "";
|
|
1260
|
+
do {
|
|
1261
|
+
const gotCR = string[index - 1] === "\r";
|
|
1262
|
+
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
1263
|
+
endIndex = index + 1;
|
|
1264
|
+
index = string.indexOf("\n", endIndex);
|
|
1265
|
+
} while (index !== -1);
|
|
1266
|
+
returnValue += string.substr(endIndex);
|
|
1267
|
+
return returnValue;
|
|
1268
|
+
};
|
|
1269
|
+
module4.exports = {
|
|
1270
|
+
stringReplaceAll,
|
|
1271
|
+
stringEncaseCRLFWithFirstIndex
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
|
|
1276
|
+
// ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js
|
|
1277
|
+
var require_templates = __commonJS({
|
|
1278
|
+
"../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js"(exports, module4) {
|
|
1279
|
+
"use strict";
|
|
1280
|
+
var TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
|
|
1281
|
+
var STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
|
|
1282
|
+
var STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
|
|
1283
|
+
var ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
|
|
1284
|
+
var ESCAPES = /* @__PURE__ */ new Map([
|
|
1285
|
+
["n", "\n"],
|
|
1286
|
+
["r", "\r"],
|
|
1287
|
+
["t", " "],
|
|
1288
|
+
["b", "\b"],
|
|
1289
|
+
["f", "\f"],
|
|
1290
|
+
["v", "\v"],
|
|
1291
|
+
["0", "\0"],
|
|
1292
|
+
["\\", "\\"],
|
|
1293
|
+
["e", "\x1B"],
|
|
1294
|
+
["a", "\x07"]
|
|
1295
|
+
]);
|
|
1296
|
+
function unescape(c) {
|
|
1297
|
+
const u = c[0] === "u";
|
|
1298
|
+
const bracket = c[1] === "{";
|
|
1299
|
+
if (u && !bracket && c.length === 5 || c[0] === "x" && c.length === 3) {
|
|
1300
|
+
return String.fromCharCode(parseInt(c.slice(1), 16));
|
|
1301
|
+
}
|
|
1302
|
+
if (u && bracket) {
|
|
1303
|
+
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
|
|
1304
|
+
}
|
|
1305
|
+
return ESCAPES.get(c) || c;
|
|
1306
|
+
}
|
|
1307
|
+
function parseArguments(name, arguments_) {
|
|
1308
|
+
const results = [];
|
|
1309
|
+
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
|
1310
|
+
let matches;
|
|
1311
|
+
for (const chunk of chunks) {
|
|
1312
|
+
const number = Number(chunk);
|
|
1313
|
+
if (!Number.isNaN(number)) {
|
|
1314
|
+
results.push(number);
|
|
1315
|
+
} else if (matches = chunk.match(STRING_REGEX)) {
|
|
1316
|
+
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
|
1317
|
+
} else {
|
|
1318
|
+
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return results;
|
|
1322
|
+
}
|
|
1323
|
+
function parseStyle(style) {
|
|
1324
|
+
STYLE_REGEX.lastIndex = 0;
|
|
1325
|
+
const results = [];
|
|
1326
|
+
let matches;
|
|
1327
|
+
while ((matches = STYLE_REGEX.exec(style)) !== null) {
|
|
1328
|
+
const name = matches[1];
|
|
1329
|
+
if (matches[2]) {
|
|
1330
|
+
const args = parseArguments(name, matches[2]);
|
|
1331
|
+
results.push([name].concat(args));
|
|
1332
|
+
} else {
|
|
1333
|
+
results.push([name]);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
return results;
|
|
1337
|
+
}
|
|
1338
|
+
function buildStyle(chalk2, styles) {
|
|
1339
|
+
const enabled = {};
|
|
1340
|
+
for (const layer of styles) {
|
|
1341
|
+
for (const style of layer.styles) {
|
|
1342
|
+
enabled[style[0]] = layer.inverse ? null : style.slice(1);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
let current = chalk2;
|
|
1346
|
+
for (const [styleName, styles2] of Object.entries(enabled)) {
|
|
1347
|
+
if (!Array.isArray(styles2)) {
|
|
1348
|
+
continue;
|
|
1349
|
+
}
|
|
1350
|
+
if (!(styleName in current)) {
|
|
1351
|
+
throw new Error(`Unknown Chalk style: ${styleName}`);
|
|
1352
|
+
}
|
|
1353
|
+
current = styles2.length > 0 ? current[styleName](...styles2) : current[styleName];
|
|
1354
|
+
}
|
|
1355
|
+
return current;
|
|
1356
|
+
}
|
|
1357
|
+
module4.exports = (chalk2, temporary) => {
|
|
1358
|
+
const styles = [];
|
|
1359
|
+
const chunks = [];
|
|
1360
|
+
let chunk = [];
|
|
1361
|
+
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
|
|
1362
|
+
if (escapeCharacter) {
|
|
1363
|
+
chunk.push(unescape(escapeCharacter));
|
|
1364
|
+
} else if (style) {
|
|
1365
|
+
const string = chunk.join("");
|
|
1366
|
+
chunk = [];
|
|
1367
|
+
chunks.push(styles.length === 0 ? string : buildStyle(chalk2, styles)(string));
|
|
1368
|
+
styles.push({ inverse, styles: parseStyle(style) });
|
|
1369
|
+
} else if (close) {
|
|
1370
|
+
if (styles.length === 0) {
|
|
1371
|
+
throw new Error("Found extraneous } in Chalk template literal");
|
|
1372
|
+
}
|
|
1373
|
+
chunks.push(buildStyle(chalk2, styles)(chunk.join("")));
|
|
1374
|
+
chunk = [];
|
|
1375
|
+
styles.pop();
|
|
1376
|
+
} else {
|
|
1377
|
+
chunk.push(character);
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
chunks.push(chunk.join(""));
|
|
1381
|
+
if (styles.length > 0) {
|
|
1382
|
+
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? "" : "s"} (\`}\`)`;
|
|
1383
|
+
throw new Error(errMessage);
|
|
1384
|
+
}
|
|
1385
|
+
return chunks.join("");
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
|
|
1390
|
+
// ../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js
|
|
1391
|
+
var require_source = __commonJS({
|
|
1392
|
+
"../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"(exports, module4) {
|
|
1393
|
+
"use strict";
|
|
1394
|
+
var ansiStyles = require_ansi_styles();
|
|
1395
|
+
var { stdout: stdoutColor, stderr: stderrColor } = require_supports_color();
|
|
1396
|
+
var {
|
|
1397
|
+
stringReplaceAll,
|
|
1398
|
+
stringEncaseCRLFWithFirstIndex
|
|
1399
|
+
} = require_util();
|
|
1400
|
+
var { isArray } = Array;
|
|
1401
|
+
var levelMapping = [
|
|
1402
|
+
"ansi",
|
|
1403
|
+
"ansi",
|
|
1404
|
+
"ansi256",
|
|
1405
|
+
"ansi16m"
|
|
1406
|
+
];
|
|
1407
|
+
var styles = /* @__PURE__ */ Object.create(null);
|
|
1408
|
+
var applyOptions = (object, options = {}) => {
|
|
1409
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
1410
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
1411
|
+
}
|
|
1412
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
1413
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
1414
|
+
};
|
|
1415
|
+
var ChalkClass = class {
|
|
1416
|
+
constructor(options) {
|
|
1417
|
+
return chalkFactory(options);
|
|
1418
|
+
}
|
|
1419
|
+
};
|
|
1420
|
+
var chalkFactory = (options) => {
|
|
1421
|
+
const chalk3 = {};
|
|
1422
|
+
applyOptions(chalk3, options);
|
|
1423
|
+
chalk3.template = (...arguments_) => chalkTag(chalk3.template, ...arguments_);
|
|
1424
|
+
Object.setPrototypeOf(chalk3, Chalk.prototype);
|
|
1425
|
+
Object.setPrototypeOf(chalk3.template, chalk3);
|
|
1426
|
+
chalk3.template.constructor = () => {
|
|
1427
|
+
throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.");
|
|
1428
|
+
};
|
|
1429
|
+
chalk3.template.Instance = ChalkClass;
|
|
1430
|
+
return chalk3.template;
|
|
1431
|
+
};
|
|
1432
|
+
function Chalk(options) {
|
|
1433
|
+
return chalkFactory(options);
|
|
1434
|
+
}
|
|
1435
|
+
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
|
1436
|
+
styles[styleName] = {
|
|
1437
|
+
get() {
|
|
1438
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
|
1439
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
1440
|
+
return builder;
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
styles.visible = {
|
|
1445
|
+
get() {
|
|
1446
|
+
const builder = createBuilder(this, this._styler, true);
|
|
1447
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
1448
|
+
return builder;
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
var usedModels = ["rgb", "hex", "keyword", "hsl", "hsv", "hwb", "ansi", "ansi256"];
|
|
1452
|
+
for (const model of usedModels) {
|
|
1453
|
+
styles[model] = {
|
|
1454
|
+
get() {
|
|
1455
|
+
const { level } = this;
|
|
1456
|
+
return function(...arguments_) {
|
|
1457
|
+
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
|
1458
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
for (const model of usedModels) {
|
|
1464
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
1465
|
+
styles[bgModel] = {
|
|
1466
|
+
get() {
|
|
1467
|
+
const { level } = this;
|
|
1468
|
+
return function(...arguments_) {
|
|
1469
|
+
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
|
1470
|
+
return createBuilder(this, styler, this._isEmpty);
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
var proto = Object.defineProperties(() => {
|
|
1476
|
+
}, {
|
|
1477
|
+
...styles,
|
|
1478
|
+
level: {
|
|
1479
|
+
enumerable: true,
|
|
1480
|
+
get() {
|
|
1481
|
+
return this._generator.level;
|
|
1482
|
+
},
|
|
1483
|
+
set(level) {
|
|
1484
|
+
this._generator.level = level;
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
var createStyler = (open, close, parent) => {
|
|
1489
|
+
let openAll;
|
|
1490
|
+
let closeAll;
|
|
1491
|
+
if (parent === void 0) {
|
|
1492
|
+
openAll = open;
|
|
1493
|
+
closeAll = close;
|
|
1494
|
+
} else {
|
|
1495
|
+
openAll = parent.openAll + open;
|
|
1496
|
+
closeAll = close + parent.closeAll;
|
|
1497
|
+
}
|
|
1498
|
+
return {
|
|
1499
|
+
open,
|
|
1500
|
+
close,
|
|
1501
|
+
openAll,
|
|
1502
|
+
closeAll,
|
|
1503
|
+
parent
|
|
1504
|
+
};
|
|
1505
|
+
};
|
|
1506
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
1507
|
+
const builder = (...arguments_) => {
|
|
1508
|
+
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
|
1509
|
+
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
|
1510
|
+
}
|
|
1511
|
+
return applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
1512
|
+
};
|
|
1513
|
+
Object.setPrototypeOf(builder, proto);
|
|
1514
|
+
builder._generator = self;
|
|
1515
|
+
builder._styler = _styler;
|
|
1516
|
+
builder._isEmpty = _isEmpty;
|
|
1517
|
+
return builder;
|
|
1518
|
+
};
|
|
1519
|
+
var applyStyle = (self, string) => {
|
|
1520
|
+
if (self.level <= 0 || !string) {
|
|
1521
|
+
return self._isEmpty ? "" : string;
|
|
1522
|
+
}
|
|
1523
|
+
let styler = self._styler;
|
|
1524
|
+
if (styler === void 0) {
|
|
1525
|
+
return string;
|
|
1526
|
+
}
|
|
1527
|
+
const { openAll, closeAll } = styler;
|
|
1528
|
+
if (string.indexOf("\x1B") !== -1) {
|
|
1529
|
+
while (styler !== void 0) {
|
|
1530
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
1531
|
+
styler = styler.parent;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
const lfIndex = string.indexOf("\n");
|
|
1535
|
+
if (lfIndex !== -1) {
|
|
1536
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
1537
|
+
}
|
|
1538
|
+
return openAll + string + closeAll;
|
|
1539
|
+
};
|
|
1540
|
+
var template;
|
|
1541
|
+
var chalkTag = (chalk3, ...strings) => {
|
|
1542
|
+
const [firstString] = strings;
|
|
1543
|
+
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
|
1544
|
+
return strings.join(" ");
|
|
1545
|
+
}
|
|
1546
|
+
const arguments_ = strings.slice(1);
|
|
1547
|
+
const parts = [firstString.raw[0]];
|
|
1548
|
+
for (let i = 1; i < firstString.length; i++) {
|
|
1549
|
+
parts.push(
|
|
1550
|
+
String(arguments_[i - 1]).replace(/[{}\\]/g, "\\$&"),
|
|
1551
|
+
String(firstString.raw[i])
|
|
1552
|
+
);
|
|
1553
|
+
}
|
|
1554
|
+
if (template === void 0) {
|
|
1555
|
+
template = require_templates();
|
|
1556
|
+
}
|
|
1557
|
+
return template(chalk3, parts.join(""));
|
|
1558
|
+
};
|
|
1559
|
+
Object.defineProperties(Chalk.prototype, styles);
|
|
1560
|
+
var chalk2 = Chalk();
|
|
1561
|
+
chalk2.supportsColor = stdoutColor;
|
|
1562
|
+
chalk2.stderr = Chalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
1563
|
+
chalk2.stderr.supportsColor = stderrColor;
|
|
1564
|
+
module4.exports = chalk2;
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
|
|
1568
|
+
// src/index.ts
|
|
1569
|
+
var src_exports = {};
|
|
1570
|
+
module.exports = __toCommonJS(src_exports);
|
|
1571
|
+
var import_yargs3 = __toESM(require("yargs"));
|
|
1572
|
+
|
|
1573
|
+
// src/commands/optimize.ts
|
|
1574
|
+
var import_yargs2 = __toESM(require("yargs"));
|
|
1575
|
+
|
|
1576
|
+
// src/commands/optimize/manifest.ts
|
|
1577
|
+
var import_yargs = __toESM(require("yargs"));
|
|
1578
|
+
|
|
1579
|
+
// src/commands/optimize/manifest/download.ts
|
|
1580
|
+
var import_chalk = __toESM(require_source());
|
|
1581
|
+
var import_fs = require("fs");
|
|
1582
|
+
var import_isomorphic_unfetch = __toESM(require("isomorphic-unfetch"));
|
|
1583
|
+
var import_process = require("process");
|
|
1584
|
+
|
|
1585
|
+
// src/constants.ts
|
|
1586
|
+
var UniformBaseUrl = "https://uniform.app";
|
|
1587
|
+
|
|
1588
|
+
// src/commands/optimize/manifest/download.ts
|
|
1589
|
+
var module2 = {
|
|
1590
|
+
command: "download [output]",
|
|
1591
|
+
describe: "Download intent manifest",
|
|
1592
|
+
builder: (yargs4) => {
|
|
1593
|
+
var _a;
|
|
1594
|
+
return yargs4.option("apiKey", {
|
|
1595
|
+
alias: "k",
|
|
1596
|
+
demandOption: true,
|
|
1597
|
+
string: true,
|
|
1598
|
+
default: process.env.UNIFORM_API_KEY,
|
|
1599
|
+
describe: "Uniform API key to use. Defaults to UNIFORM_API_KEY env if set."
|
|
1600
|
+
}).option("project", {
|
|
1601
|
+
describe: "Uniform project ID. Defaults to UOPT_CLI_PROJECT_ID or UNIFORM_PROJECT_ID env. Supports dotenv.",
|
|
1602
|
+
default: (_a = process.env.UOPT_CLI_PROJECT_ID) != null ? _a : process.env.UNIFORM_PROJECT_ID,
|
|
1603
|
+
type: "string",
|
|
1604
|
+
alias: ["p"]
|
|
1605
|
+
}).option("preview", {
|
|
1606
|
+
describe: "If set, fetches the unpublished preview manifest (assuming your API key has permission)",
|
|
1607
|
+
default: false,
|
|
1608
|
+
type: "boolean",
|
|
1609
|
+
alias: ["d"]
|
|
1610
|
+
}).option("output", {
|
|
1611
|
+
string: true,
|
|
1612
|
+
alias: "o",
|
|
1613
|
+
default: process.env.UNIFORM_MANIFEST_PATH,
|
|
1614
|
+
describe: "Path to write manifest to. Defaults to UNIFORM_MANIFEST_PATH env if set."
|
|
1615
|
+
});
|
|
1616
|
+
},
|
|
1617
|
+
handler: async ({ apiKey, output, project, preview }) => {
|
|
1618
|
+
const isLegacyApiKey = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test(
|
|
1619
|
+
apiKey
|
|
1620
|
+
);
|
|
1621
|
+
if (isLegacyApiKey) {
|
|
1622
|
+
console.error(
|
|
1623
|
+
import_chalk.default.yellow(
|
|
1624
|
+
"WARNING: you appear to be using a deprecated type of API key. Keys like this will stop working soon; please create new keys on uniform.app."
|
|
1625
|
+
)
|
|
1626
|
+
);
|
|
1627
|
+
} else if (!project) {
|
|
1628
|
+
console.error(import_chalk.default.red("You must specify the project ID"));
|
|
1629
|
+
(0, import_process.exit)(1);
|
|
1630
|
+
}
|
|
1631
|
+
const baseUrl = resolveBaseUrl();
|
|
1632
|
+
const qs = new URLSearchParams();
|
|
1633
|
+
if (project) {
|
|
1634
|
+
qs.set("projectId", project);
|
|
1635
|
+
}
|
|
1636
|
+
if (preview) {
|
|
1637
|
+
qs.set("preview", "true");
|
|
1638
|
+
}
|
|
1639
|
+
const manifestUrl = `${baseUrl}api/v1/manifest?${qs.toString()}`;
|
|
1640
|
+
let fetchResponse = void 0;
|
|
1641
|
+
try {
|
|
1642
|
+
fetchResponse = await (0, import_isomorphic_unfetch.default)(manifestUrl, {
|
|
1643
|
+
headers: {
|
|
1644
|
+
"x-api-key": apiKey
|
|
1645
|
+
}
|
|
1646
|
+
});
|
|
1647
|
+
if (!fetchResponse.ok) {
|
|
1648
|
+
if (fetchResponse.status === 403) {
|
|
1649
|
+
throw `The API key ${apiKey} had no published data. This means it is either incorrectly entered, or intents have not been published since creating the API key.`;
|
|
1650
|
+
}
|
|
1651
|
+
throw `${fetchResponse.status} ${fetchResponse.statusText}, content ${await fetchResponse.text()}`;
|
|
1652
|
+
}
|
|
1653
|
+
} catch (e) {
|
|
1654
|
+
console.error(import_chalk.default.red(`\u26A0 Error fetching intent manifest ${manifestUrl}`));
|
|
1655
|
+
console.error(import_chalk.default.gray(` \u2757 ${e}`));
|
|
1656
|
+
(0, import_process.exit)(1);
|
|
1657
|
+
}
|
|
1658
|
+
let json;
|
|
1659
|
+
try {
|
|
1660
|
+
json = await fetchResponse.json();
|
|
1661
|
+
} catch (e) {
|
|
1662
|
+
console.error(import_chalk.default.red(import_chalk.default.red(`\u26A0 Error parsing intent manifest ${manifestUrl}`)));
|
|
1663
|
+
console.error(import_chalk.default.gray(` \u2757 ${e}`));
|
|
1664
|
+
console.error(`Response: ${await fetchResponse.text()}`);
|
|
1665
|
+
(0, import_process.exit)(1);
|
|
1666
|
+
}
|
|
1667
|
+
const text = JSON.stringify(json, null, 2);
|
|
1668
|
+
if (output) {
|
|
1669
|
+
(0, import_fs.writeFile)(output, text, (error) => {
|
|
1670
|
+
if (error) {
|
|
1671
|
+
console.error(`Error writing file to ${output}
|
|
1672
|
+
`, error);
|
|
1673
|
+
(0, import_process.exit)(1);
|
|
1674
|
+
}
|
|
1675
|
+
console.log(import_chalk.default.green(`\u2705 ${output} has been updated from ${manifestUrl}`));
|
|
1676
|
+
});
|
|
1677
|
+
} else {
|
|
1678
|
+
console.log(text);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
};
|
|
1682
|
+
var resolveBaseUrl = () => {
|
|
1683
|
+
let baseUrl = process.env.UNIFORM_CLI_BASE_URL || UniformBaseUrl;
|
|
1684
|
+
if (!baseUrl.endsWith("/")) {
|
|
1685
|
+
baseUrl += "/";
|
|
1686
|
+
}
|
|
1687
|
+
return baseUrl;
|
|
1688
|
+
};
|
|
1689
|
+
var download_default = module2;
|
|
1690
|
+
|
|
1691
|
+
// src/commands/optimize/manifest.ts
|
|
1692
|
+
var module3 = {
|
|
1693
|
+
command: "manifest <command>",
|
|
1694
|
+
describe: "Intent manifest commands",
|
|
1695
|
+
builder: () => {
|
|
1696
|
+
return import_yargs.default.command(download_default);
|
|
1697
|
+
},
|
|
1698
|
+
handler: () => {
|
|
1699
|
+
return import_yargs.default.showHelp();
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
var manifest_default = module3;
|
|
1703
|
+
|
|
1704
|
+
// src/commands/optimize.ts
|
|
1705
|
+
var command = {
|
|
1706
|
+
command: "optimize <command>",
|
|
1707
|
+
aliases: ["opt"],
|
|
1708
|
+
describe: "Uniform Optimize commands",
|
|
1709
|
+
builder: () => {
|
|
1710
|
+
return import_yargs2.default.command(manifest_default);
|
|
1711
|
+
},
|
|
1712
|
+
handler: () => {
|
|
1713
|
+
return import_yargs2.default.showHelp();
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
var optimize_default = command;
|
|
1717
|
+
|
|
1718
|
+
// src/index.ts
|
|
1719
|
+
require("dotenv").config();
|
|
1720
|
+
var plugins = [
|
|
1721
|
+
"@uniformdev/canvas/cli",
|
|
1722
|
+
"@uniformdev/context/cli",
|
|
1723
|
+
"@uniformdev/project-map/cli",
|
|
1724
|
+
"@uniformdev/uniform-new"
|
|
1725
|
+
];
|
|
1726
|
+
var yarggery = import_yargs3.default.scriptName("uniform");
|
|
1727
|
+
plugins.flatMap((plugin) => {
|
|
1728
|
+
try {
|
|
1729
|
+
const commands = require(plugin).uniformCLI.commands;
|
|
1730
|
+
const commandsToAdd = Array.isArray(commands) ? commands : [];
|
|
1731
|
+
commandsToAdd.forEach((command2) => {
|
|
1732
|
+
yarggery = yarggery.command(command2);
|
|
1733
|
+
});
|
|
1734
|
+
} catch (e) {
|
|
1735
|
+
}
|
|
1736
|
+
});
|
|
1737
|
+
yarggery.command(optimize_default).demandCommand(1, "").strict().help().argv;
|