@visulima/fmt 1.1.1 → 1.1.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## @visulima/fmt [1.1.2](https://github.com/visulima/visulima/compare/@visulima/fmt@1.1.1...@visulima/fmt@1.1.2) (2024-02-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * moved custom formatters into the default switch call ([eaf550b](https://github.com/visulima/visulima/commit/eaf550bd72f464e86a50e713410d41e068ebf953))
7
+
1
8
  ## @visulima/fmt [1.1.1](https://github.com/visulima/visulima/compare/@visulima/fmt@1.1.0...@visulima/fmt@1.1.1) (2024-02-19)
2
9
 
3
10
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),B=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,C=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,$=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,M=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,k=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/g,g=e=>{h.has(e)&&(e=h.get(e));let n=B.exec(e);if(n)return [Number.parseInt(n[1],16),Number.parseInt(n[2],16),Number.parseInt(n[3],16)];let t=C.exec(e);if(t)return [Number.parseInt(`${t[1]}${t[1]}`,16),Number.parseInt(`${t[2]}${t[2]}`,16),Number.parseInt(`${t[3]}${t[3]}`,16)];let l=$.exec(e);if(l)return [Math.round(Math.max(0,Math.min(255,Number(l[1])))),Math.round(Math.max(0,Math.min(255,Number(l[2])))),Math.round(Math.max(0,Math.min(255,Number(l[3]))))];let f=M.exec(e);if(f){let o=Number(f[1])%360;o<0&&(o+=360);let i=Math.max(0,Math.min(100,Number(f[2])))/100,a=Math.max(0,Math.min(100,Number(f[3])))/100,c=(1-Math.abs(2*a-1))*i,d=c*(1-Math.abs(o/60%2-1)),r=a-c/2,u,s,b;return o<60?{0:u,1:s,2:b}=[c,d,0]:o<120?{0:u,1:s,2:b}=[d,c,0]:o<180?{0:u,1:s,2:b}=[0,c,d]:o<240?{0:u,1:s,2:b}=[0,d,c]:o<300?{0:u,1:s,2:b}=[d,0,c]:{0:u,1:s,2:b}=[c,0,d],[Math.round((u+r)*255),Math.round((s+r)*255),Math.round((b+r)*255)]}return null},m=(e,n)=>e?.[0]===n?.[0]&&e?.[1]===n?.[1]&&e?.[2]===n?.[2],p=e=>{let n=k(),t=[],l=!1,f=null,o=0,i="";for(let a of e){if(a==="(")o++;else if(o>0)a===")"&&o--;else if(l){if(a===";"){let c=i.trim();c!==""&&t.push([f,c]),f=null,i="",l=!1;continue}}else if(a===":"){f=i.trim(),i="",l=!0;continue}i+=a;}if(l&&o===0){let a=i.trim();a!==""&&t.push([f,a]),f=null,i="";}for(let{0:a,1:c}of t)switch(a){case"background-color":{c!=null&&(n.backgroundColor=c);break}case"color":{c!=null&&(n.color=c);break}case"font-weight":{c==="bold"&&(n.fontWeight=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(n.fontStyle="italic");break}case"text-decoration-line":{n.textDecorationLine=[];let d=c.split(y);for(let r of d)["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);break}case"text-decoration-color":{let d=g(c);d!=null&&(n.textDecorationColor=d);break}case"text-decoration":{n.textDecorationColor=null,n.textDecorationLine=[];let d=c.split(y);for(let r of d){let u=g(r);u!=null?n.textDecorationColor=u:["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);}break}}return n},w=(e,n=null)=>{n=n??k();let t="";if(!m(e.backgroundColor,n.backgroundColor))if(e.backgroundColor==null)t+="\x1B[49m";else switch(e.backgroundColor){case"black":{t+="\x1B[40m";break}case"red":{t+="\x1B[41m";break}case"green":{t+="\x1B[42m";break}case"yellow":{t+="\x1B[43m";break}case"blue":{t+="\x1B[44m";break}case"magenta":{t+="\x1B[45m";break}case"cyan":{t+="\x1B[46m";break}case"white":{t+="\x1B[47m";break}default:if(Array.isArray(e.backgroundColor)){let{0:l,1:f,2:o}=e.backgroundColor;t+=`\x1B[48;2;${l};${f};${o}m`;}else {let l=g(e.backgroundColor);if(l===null)t+="\x1B[49m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[48;2;${f};${o};${i}m`;}}}if(!m(e.color,n.color))if(e.color==null)t+="\x1B[39m";else switch(e.color){case"black":{t+="\x1B[30m";break}case"red":{t+="\x1B[31m";break}case"green":{t+="\x1B[32m";break}case"yellow":{t+="\x1B[33m";break}case"blue":{t+="\x1B[34m";break}case"magenta":{t+="\x1B[35m";break}case"cyan":{t+="\x1B[36m";break}case"white":{t+="\x1B[37m";break}default:if(Array.isArray(e.color)){let{0:l,1:f,2:o}=e.color;t+=`\x1B[38;2;${l};${f};${o}m`;}else {let l=g(e.color);if(l===null)t+="\x1B[39m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[38;2;${f};${o};${i}m`;}}}if(e.fontWeight!==n.fontWeight&&(t+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==n.fontStyle&&(t+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!m(e.textDecorationColor,n.textDecorationColor))if(e.textDecorationColor==null)t+="\x1B[59m";else {let{0:l,1:f,2:o}=e.textDecorationColor;t+=`\x1B[58;2;${l};${f};${o}m`;}return e.textDecorationLine.includes("line-through")!==n.textDecorationLine.includes("line-through")&&(t+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==n.textDecorationLine.includes("overline")&&(t+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==n.textDecorationLine.includes("underline")&&(t+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t};var D=e=>{try{return JSON.stringify(e)}catch{return '"[Circular]"'}},A="%".codePointAt(0),N="s".codePointAt(0),F="d".codePointAt(0),P="f".codePointAt(0),_="i".codePointAt(0),R="O".codePointAt(0),L="o".codePointAt(0),O="j".codePointAt(0),T="c".codePointAt(0),j=(e,n=[],t={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);let l=t.stringify??D,f=1;if(typeof e=="object"){let r=n.length+f;if(r===1)return "{}";let u=Array.from({length:r});u[0]=l(e);for(let s=1;s<r;s++)u[s]=l(n[s-f]);return u.join(" ")}if(n.length===0)return e;let o="",i=1-f,a=-1,c=!1,d=null;for(let r=0;r<e.length;){if(e.codePointAt(r)===A&&r+1<e.length){a=a>-1?a:0;let u=e.codePointAt(r+1);if(u===void 0){++i;break}switch(u){case F:case P:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Number(n[i]).toString(),a=r+2,r++;break}case _:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Math.floor(Number(n[i])).toString(),a=r+2,r++;break}case R:case L:case O:{if(i>=n.length||n[i]===void 0)break;a<r&&(o+=e.slice(a,r));let s=n[i],b=typeof s;if(b==="string"){o+=`'${s}'`,a=r+2;break}if(b==="function"){o+=s.name?`[Function: ${s.name}]`:"[Function: <anonymous>]",a=r+2;break}o+=l(s),a=r+2,r++;break}case N:{if(i>=n.length)break;a<r&&(o+=e.slice(a,r)),o+=typeof n[i]=="object"?l(n[i]):String(n[i]),a=r+2,r++;break}case A:{a<r&&(o+=e.slice(a,r)),o+="%",a=r+2,r++,i--;break}case T:{if(typeof window>"u"){let s=p(n[i]);a<r&&(o+=e.slice(a,r)),o+=w(s,d),o!==""&&(c=!0,d=s);}a=r+2,r++;break}}typeof t.formatters?.[u]=="function"&&(o+=t.formatters[u](n[i]),a=r+2),++i;}++r;}return a===-1?e:(a<e.length&&(o+=e.slice(a)),c&&(o+="\x1B[0m"),o)},q=(e={})=>{let n={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([t,l])=>{if(t.length===0)throw new Error(`Formatter %${t} has no characters`);if(t.length>1)throw new Error(`Formatter %${t} has more than one character`);if(typeof l!="function")throw new TypeError(`Formatter for %${t} is not a function`);let f=t.codePointAt(0);if(f===void 0)throw new Error(`${t}.codePointAt(0) failed to return a value, please report this issue`);n[f]=l;}),(t,l=[],f={})=>j(t,l,{...f,formatters:n})};
3
+ var h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),B=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,C=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,$=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,M=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,k=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/g,g=e=>{h.has(e)&&(e=h.get(e));let n=B.exec(e);if(n)return [Number.parseInt(n[1],16),Number.parseInt(n[2],16),Number.parseInt(n[3],16)];let t=C.exec(e);if(t)return [Number.parseInt(`${t[1]}${t[1]}`,16),Number.parseInt(`${t[2]}${t[2]}`,16),Number.parseInt(`${t[3]}${t[3]}`,16)];let l=$.exec(e);if(l)return [Math.round(Math.max(0,Math.min(255,Number(l[1])))),Math.round(Math.max(0,Math.min(255,Number(l[2])))),Math.round(Math.max(0,Math.min(255,Number(l[3]))))];let f=M.exec(e);if(f){let o=Number(f[1])%360;o<0&&(o+=360);let i=Math.max(0,Math.min(100,Number(f[2])))/100,a=Math.max(0,Math.min(100,Number(f[3])))/100,c=(1-Math.abs(2*a-1))*i,d=c*(1-Math.abs(o/60%2-1)),r=a-c/2,u,s,b;return o<60?{0:u,1:s,2:b}=[c,d,0]:o<120?{0:u,1:s,2:b}=[d,c,0]:o<180?{0:u,1:s,2:b}=[0,c,d]:o<240?{0:u,1:s,2:b}=[0,d,c]:o<300?{0:u,1:s,2:b}=[d,0,c]:{0:u,1:s,2:b}=[c,0,d],[Math.round((u+r)*255),Math.round((s+r)*255),Math.round((b+r)*255)]}return null},m=(e,n)=>e?.[0]===n?.[0]&&e?.[1]===n?.[1]&&e?.[2]===n?.[2],p=e=>{let n=k(),t=[],l=!1,f=null,o=0,i="";for(let a of e){if(a==="(")o++;else if(o>0)a===")"&&o--;else if(l){if(a===";"){let c=i.trim();c!==""&&t.push([f,c]),f=null,i="",l=!1;continue}}else if(a===":"){f=i.trim(),i="",l=!0;continue}i+=a;}if(l&&o===0){let a=i.trim();a!==""&&t.push([f,a]),f=null,i="";}for(let{0:a,1:c}of t)switch(a){case"background-color":{c!=null&&(n.backgroundColor=c);break}case"color":{c!=null&&(n.color=c);break}case"font-weight":{c==="bold"&&(n.fontWeight=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(n.fontStyle="italic");break}case"text-decoration-line":{n.textDecorationLine=[];let d=c.split(y);for(let r of d)["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);break}case"text-decoration-color":{let d=g(c);d!=null&&(n.textDecorationColor=d);break}case"text-decoration":{n.textDecorationColor=null,n.textDecorationLine=[];let d=c.split(y);for(let r of d){let u=g(r);u!=null?n.textDecorationColor=u:["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);}break}}return n},w=(e,n=null)=>{n=n??k();let t="";if(!m(e.backgroundColor,n.backgroundColor))if(e.backgroundColor==null)t+="\x1B[49m";else switch(e.backgroundColor){case"black":{t+="\x1B[40m";break}case"red":{t+="\x1B[41m";break}case"green":{t+="\x1B[42m";break}case"yellow":{t+="\x1B[43m";break}case"blue":{t+="\x1B[44m";break}case"magenta":{t+="\x1B[45m";break}case"cyan":{t+="\x1B[46m";break}case"white":{t+="\x1B[47m";break}default:if(Array.isArray(e.backgroundColor)){let{0:l,1:f,2:o}=e.backgroundColor;t+=`\x1B[48;2;${l};${f};${o}m`;}else {let l=g(e.backgroundColor);if(l===null)t+="\x1B[49m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[48;2;${f};${o};${i}m`;}}}if(!m(e.color,n.color))if(e.color==null)t+="\x1B[39m";else switch(e.color){case"black":{t+="\x1B[30m";break}case"red":{t+="\x1B[31m";break}case"green":{t+="\x1B[32m";break}case"yellow":{t+="\x1B[33m";break}case"blue":{t+="\x1B[34m";break}case"magenta":{t+="\x1B[35m";break}case"cyan":{t+="\x1B[36m";break}case"white":{t+="\x1B[37m";break}default:if(Array.isArray(e.color)){let{0:l,1:f,2:o}=e.color;t+=`\x1B[38;2;${l};${f};${o}m`;}else {let l=g(e.color);if(l===null)t+="\x1B[39m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[38;2;${f};${o};${i}m`;}}}if(e.fontWeight!==n.fontWeight&&(t+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==n.fontStyle&&(t+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!m(e.textDecorationColor,n.textDecorationColor))if(e.textDecorationColor==null)t+="\x1B[59m";else {let{0:l,1:f,2:o}=e.textDecorationColor;t+=`\x1B[58;2;${l};${f};${o}m`;}return e.textDecorationLine.includes("line-through")!==n.textDecorationLine.includes("line-through")&&(t+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==n.textDecorationLine.includes("overline")&&(t+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==n.textDecorationLine.includes("underline")&&(t+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t};var D=e=>{try{return JSON.stringify(e)}catch{return '"[Circular]"'}},A="%".codePointAt(0),N="s".codePointAt(0),F="d".codePointAt(0),P="f".codePointAt(0),_="i".codePointAt(0),R="O".codePointAt(0),L="o".codePointAt(0),O="j".codePointAt(0),T="c".codePointAt(0),j=(e,n=[],t={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);let l=t.stringify??D,f=1;if(typeof e=="object"){let r=n.length+f;if(r===1)return "{}";let u=Array.from({length:r});u[0]=l(e);for(let s=1;s<r;s++)u[s]=l(n[s-f]);return u.join(" ")}if(n.length===0)return e;let o="",i=1-f,a=-1,c=!1,d=null;for(let r=0;r<e.length;){if(e.codePointAt(r)===A&&r+1<e.length){a=a>-1?a:0;let u=e.codePointAt(r+1);if(u===void 0){++i;break}switch(u){case F:case P:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Number(n[i]).toString(),a=r+2,r++;break}case _:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Math.floor(Number(n[i])).toString(),a=r+2,r++;break}case R:case L:case O:{if(i>=n.length||n[i]===void 0)break;a<r&&(o+=e.slice(a,r));let s=n[i],b=typeof s;if(b==="string"){o+=`'${s}'`,a=r+2;break}if(b==="function"){o+=s.name?`[Function: ${s.name}]`:"[Function: <anonymous>]",a=r+2;break}o+=l(s),a=r+2,r++;break}case N:{if(i>=n.length)break;a<r&&(o+=e.slice(a,r)),o+=typeof n[i]=="object"?l(n[i]):String(n[i]),a=r+2,r++;break}case A:{a<r&&(o+=e.slice(a,r)),o+="%",a=r+2,r++,i--;break}case T:{if(typeof window>"u"){let s=p(n[i]);a<r&&(o+=e.slice(a,r)),o+=w(s,d),o!==""&&(c=!0,d=s);}a=r+2,r++;break}default:typeof t.formatters?.[u]=="function"&&(a<r&&(o+=e.slice(a,r)),o+=t.formatters[u](n[i]),a=r+2,r++);}++i;}++r;}return a===-1?e:(a<e.length&&(o+=e.slice(a)),c&&(o+="\x1B[0m"),o)},q=(e={})=>{let n={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([t,l])=>{if(t.length===0)throw new Error(`Formatter %${t} has no characters`);if(t.length>1)throw new Error(`Formatter %${t} has more than one character`);if(typeof l!="function")throw new TypeError(`Formatter for %${t} is not a function`);let f=t.codePointAt(0);if(f===void 0)throw new Error(`${t}.codePointAt(0) failed to return a value, please report this issue`);n[f]=l;}),(t,l=[],f={})=>j(t,l,{...f,formatters:n})};
4
4
 
5
5
  exports.build = q;
6
6
  exports.format = j;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/inspect-colors.ts","../src/index.ts"],"names":["colorKeywords","HASH_PATTERN","SMALL_HASH_PATTERN","RGB_PATTERN","HSL_PATTERN","getDefaultCss","SPACE_PATTERN","parseCssColor","colorString","hashMatch","smallHashMatch","rgbMatch","hslMatch","h","s","l","x","m","r_","g_","b_","colorEquals","color1","color2","parseCss","cssString","css","rawEntries","inValue","currentKey","parenthesesDepth","currentPart","c","value","key","lineTypes","lineType","color","arguments_","argument","maybeColor","cssToAnsi","previousCss","ansi","r","g","b","parsed","tryStringify","o","CHAR_PERCENT","CHAR_s","CHAR_d","CHAR_f","CHAR_i","CHAR_O","CHAR_o","CHAR_j","CHAR_c","format","fmt","options","stringify","offset","argumentsLength","objects","index","result","a","lastPosition","usedStyle","temporaryArgument","type","build","formatters","formatterFunction","f","formatOptions"],"mappings":"AAaA,IAAMA,E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AAeH,EAAQ,EAEvBA,IAEA,KACJ,CACJ,CAGI,OAAOL,EAAQ,aAAa7B,CAAC,GAAM,aAEnCmC,GAAWN,EAAQ,WAAW7B,CAAC,EAAwBM,EAAW8B,CAA4B,CAAC,EAC/FC,EAAeH,EAAQ,GAG3B,EAAEE,CACN,CAEA,EAAEF,CACN,CAEA,OAAIG,IAAiB,GACVT,GAGPS,EAAeT,EAAI,SACnBO,GAAUP,EAAI,MAAMS,CAAY,GAGhCC,IACAH,GAAU,WAGPA,EACX,EAEaM,EAAQ,CACjBZ,EAAmB,CAAC,IAE0G,CAC9H,IAAMa,EAA2B,CAAC,EAElC,OAAI,OAAOb,EAAQ,YAAe,UAC9B,OAAO,QAAQA,EAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC3B,EAAKyC,CAAiB,IAAM,CACrE,GAAIzC,EAAI,SAAW,EACf,MAAM,IAAI,MAAM,cAAcA,CAAG,oBAAoB,EAGzD,GAAIA,EAAI,OAAS,EACb,MAAM,IAAI,MAAM,cAAcA,CAAG,8BAA8B,EAGnE,GAAI,OAAOyC,GAAsB,WAC7B,MAAM,IAAI,UAAU,kBAAkBzC,CAAG,oBAAoB,EAGjE,IAAMF,EAAIE,EAAI,YAAY,CAAC,EAE3B,GAAIF,IAAM,OACN,MAAM,IAAI,MAAM,GAAGE,CAAG,oEAAoE,EAI9FwC,EAAW1C,CAAC,EAAI2C,CACpB,CAAC,EAIE,CAACC,EAA8CtC,EAAoB,CAAC,EAAGuC,EAA6C,CAAC,IACxHlB,EAAOiB,EAAGtC,EAAY,CAAE,GAAGuC,EAAe,WAAAH,CAAW,CAAC,CAC9D","sourcesContent":["type CssObject = {\n __proto__: null;\n backgroundColor: string | null;\n color: string | null;\n fontStyle: string | null;\n fontWeight: string | null;\n textDecorationColor: [number, number, number] | null;\n textDecorationLine: string[];\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2575\nconst colorKeywords: Map<string, string> = new Map<string, string>([\n [\"aliceblue\", \"#f0f8ff\"],\n [\"antiquewhite\", \"#faebd7\"],\n [\"aqua\", \"#00ffff\"],\n [\"aquamarine\", \"#7fffd4\"],\n [\"azure\", \"#f0ffff\"],\n [\"beige\", \"#f5f5dc\"],\n [\"bisque\", \"#ffe4c4\"],\n [\"black\", \"#000000\"],\n [\"blanchedalmond\", \"#ffebcd\"],\n [\"blue\", \"#0000ff\"],\n [\"blueviolet\", \"#8a2be2\"],\n [\"brown\", \"#a52a2a\"],\n [\"burlywood\", \"#deb887\"],\n [\"cadetblue\", \"#5f9ea0\"],\n [\"chartreuse\", \"#7fff00\"],\n [\"chocolate\", \"#d2691e\"],\n [\"coral\", \"#ff7f50\"],\n [\"cornflowerblue\", \"#6495ed\"],\n [\"cornsilk\", \"#fff8dc\"],\n [\"crimson\", \"#dc143c\"],\n [\"cyan\", \"#00ffff\"],\n [\"darkblue\", \"#00008b\"],\n [\"darkcyan\", \"#008b8b\"],\n [\"darkgoldenrod\", \"#b8860b\"],\n [\"darkgray\", \"#a9a9a9\"],\n [\"darkgreen\", \"#006400\"],\n [\"darkgrey\", \"#a9a9a9\"],\n [\"darkkhaki\", \"#bdb76b\"],\n [\"darkmagenta\", \"#8b008b\"],\n [\"darkolivegreen\", \"#556b2f\"],\n [\"darkorange\", \"#ff8c00\"],\n [\"darkorchid\", \"#9932cc\"],\n [\"darkred\", \"#8b0000\"],\n [\"darksalmon\", \"#e9967a\"],\n [\"darkseagreen\", \"#8fbc8f\"],\n [\"darkslateblue\", \"#483d8b\"],\n [\"darkslategray\", \"#2f4f4f\"],\n [\"darkslategrey\", \"#2f4f4f\"],\n [\"darkturquoise\", \"#00ced1\"],\n [\"darkviolet\", \"#9400d3\"],\n [\"deeppink\", \"#ff1493\"],\n [\"deepskyblue\", \"#00bfff\"],\n [\"dimgray\", \"#696969\"],\n [\"dimgrey\", \"#696969\"],\n [\"dodgerblue\", \"#1e90ff\"],\n [\"firebrick\", \"#b22222\"],\n [\"floralwhite\", \"#fffaf0\"],\n [\"forestgreen\", \"#228b22\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"gainsboro\", \"#dcdcdc\"],\n [\"ghostwhite\", \"#f8f8ff\"],\n [\"gold\", \"#ffd700\"],\n [\"goldenrod\", \"#daa520\"],\n [\"gray\", \"#808080\"],\n [\"green\", \"#008000\"],\n [\"greenyellow\", \"#adff2f\"],\n [\"grey\", \"#808080\"],\n [\"honeydew\", \"#f0fff0\"],\n [\"hotpink\", \"#ff69b4\"],\n [\"indianred\", \"#cd5c5c\"],\n [\"indigo\", \"#4b0082\"],\n [\"ivory\", \"#fffff0\"],\n [\"khaki\", \"#f0e68c\"],\n [\"lavender\", \"#e6e6fa\"],\n [\"lavenderblush\", \"#fff0f5\"],\n [\"lawngreen\", \"#7cfc00\"],\n [\"lemonchiffon\", \"#fffacd\"],\n [\"lightblue\", \"#add8e6\"],\n [\"lightcoral\", \"#f08080\"],\n [\"lightcyan\", \"#e0ffff\"],\n [\"lightgoldenrodyellow\", \"#fafad2\"],\n [\"lightgray\", \"#d3d3d3\"],\n [\"lightgreen\", \"#90ee90\"],\n [\"lightgrey\", \"#d3d3d3\"],\n [\"lightpink\", \"#ffb6c1\"],\n [\"lightsalmon\", \"#ffa07a\"],\n [\"lightseagreen\", \"#20b2aa\"],\n [\"lightskyblue\", \"#87cefa\"],\n [\"lightslategray\", \"#778899\"],\n [\"lightslategrey\", \"#778899\"],\n [\"lightsteelblue\", \"#b0c4de\"],\n [\"lightyellow\", \"#ffffe0\"],\n [\"lime\", \"#00ff00\"],\n [\"limegreen\", \"#32cd32\"],\n [\"linen\", \"#faf0e6\"],\n [\"magenta\", \"#ff00ff\"],\n [\"maroon\", \"#800000\"],\n [\"mediumaquamarine\", \"#66cdaa\"],\n [\"mediumblue\", \"#0000cd\"],\n [\"mediumorchid\", \"#ba55d3\"],\n [\"mediumpurple\", \"#9370db\"],\n [\"mediumseagreen\", \"#3cb371\"],\n [\"mediumslateblue\", \"#7b68ee\"],\n [\"mediumspringgreen\", \"#00fa9a\"],\n [\"mediumturquoise\", \"#48d1cc\"],\n [\"mediumvioletred\", \"#c71585\"],\n [\"midnightblue\", \"#191970\"],\n [\"mintcream\", \"#f5fffa\"],\n [\"mistyrose\", \"#ffe4e1\"],\n [\"moccasin\", \"#ffe4b5\"],\n [\"navajowhite\", \"#ffdead\"],\n [\"navy\", \"#000080\"],\n [\"oldlace\", \"#fdf5e6\"],\n [\"olive\", \"#808000\"],\n [\"olivedrab\", \"#6b8e23\"],\n [\"orange\", \"#ffa500\"],\n [\"orangered\", \"#ff4500\"],\n [\"orchid\", \"#da70d6\"],\n [\"palegoldenrod\", \"#eee8aa\"],\n [\"palegreen\", \"#98fb98\"],\n [\"paleturquoise\", \"#afeeee\"],\n [\"palevioletred\", \"#db7093\"],\n [\"papayawhip\", \"#ffefd5\"],\n [\"peachpuff\", \"#ffdab9\"],\n [\"peru\", \"#cd853f\"],\n [\"pink\", \"#ffc0cb\"],\n [\"plum\", \"#dda0dd\"],\n [\"powderblue\", \"#b0e0e6\"],\n [\"purple\", \"#800080\"],\n [\"rebeccapurple\", \"#663399\"],\n [\"red\", \"#ff0000\"],\n [\"rosybrown\", \"#bc8f8f\"],\n [\"royalblue\", \"#4169e1\"],\n [\"saddlebrown\", \"#8b4513\"],\n [\"salmon\", \"#fa8072\"],\n [\"sandybrown\", \"#f4a460\"],\n [\"seagreen\", \"#2e8b57\"],\n [\"seashell\", \"#fff5ee\"],\n [\"sienna\", \"#a0522d\"],\n [\"silver\", \"#c0c0c0\"],\n [\"skyblue\", \"#87ceeb\"],\n [\"slateblue\", \"#6a5acd\"],\n [\"slategray\", \"#708090\"],\n [\"slategrey\", \"#708090\"],\n [\"snow\", \"#fffafa\"],\n [\"springgreen\", \"#00ff7f\"],\n [\"steelblue\", \"#4682b4\"],\n [\"tan\", \"#d2b48c\"],\n [\"teal\", \"#008080\"],\n [\"thistle\", \"#d8bfd8\"],\n [\"tomato\", \"#ff6347\"],\n [\"turquoise\", \"#40e0d0\"],\n [\"violet\", \"#ee82ee\"],\n [\"wheat\", \"#f5deb3\"],\n [\"white\", \"#ffffff\"],\n [\"whitesmoke\", \"#f5f5f5\"],\n [\"yellow\", \"#ffff00\"],\n [\"yellowgreen\", \"#9acd32\"],\n]);\n\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\nconst HASH_PATTERN = /^#([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})?$/i;\n// eslint-disable-next-line regexp/optimal-quantifier-concatenation,regexp/no-unused-capturing-group\nconst SMALL_HASH_PATTERN = /^#([\\dA-F])([\\dA-F])([\\dA-F])([\\dA-F])?$/i;\nconst RGB_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^rgba?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\nconst HSL_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^hsla?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\n\nconst getDefaultCss = (): CssObject => {\n return {\n __proto__: null,\n backgroundColor: null,\n color: null,\n fontStyle: null,\n fontWeight: null,\n textDecorationColor: null,\n textDecorationLine: [],\n };\n};\n\n// eslint-disable-next-line regexp/no-useless-flag\nconst SPACE_PATTERN = /\\s+/g;\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2739\nconst parseCssColor = (colorString: string): [number, number, number] | null => {\n if (colorKeywords.has(colorString)) {\n // eslint-disable-next-line no-param-reassign\n colorString = colorKeywords.get(colorString) as string;\n }\n\n const hashMatch = HASH_PATTERN.exec(colorString);\n\n if (hashMatch) {\n return [Number.parseInt(hashMatch[1] as string, 16), Number.parseInt(hashMatch[2] as string, 16), Number.parseInt(hashMatch[3] as string, 16)];\n }\n\n const smallHashMatch = SMALL_HASH_PATTERN.exec(colorString);\n\n if (smallHashMatch) {\n return [\n Number.parseInt(`${smallHashMatch[1]}${smallHashMatch[1]}`, 16),\n Number.parseInt(`${smallHashMatch[2]}${smallHashMatch[2]}`, 16),\n Number.parseInt(`${smallHashMatch[3]}${smallHashMatch[3]}`, 16),\n ];\n }\n\n const rgbMatch = RGB_PATTERN.exec(colorString);\n\n if (rgbMatch) {\n return [\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[1])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[2])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[3])))),\n ];\n }\n\n const hslMatch = HSL_PATTERN.exec(colorString);\n\n if (hslMatch) {\n // https://www.rapidtables.com/convert/color/hsl-to-rgb.html\n let h = Number(hslMatch[1]) % 360;\n if (h < 0) {\n h += 360;\n }\n const s = Math.max(0, Math.min(100, Number(hslMatch[2]))) / 100;\n const l = Math.max(0, Math.min(100, Number(hslMatch[3]))) / 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let r_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let g_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let b_: number;\n\n if (h < 60) {\n ({ 0: r_, 1: g_, 2: b_ } = [c, x, 0]);\n } else if (h < 120) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, c, 0]);\n } else if (h < 180) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, c, x]);\n } else if (h < 240) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, x, c]);\n } else if (h < 300) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, 0, c]);\n } else {\n ({ 0: r_, 1: g_, 2: b_ } = [c, 0, x]);\n }\n\n return [Math.round((r_ + m) * 255), Math.round((g_ + m) * 255), Math.round((b_ + m) * 255)];\n }\n\n return null;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2928\nconst colorEquals = (color1: string | [number, number, number] | null, color2: string | [number, number, number] | null) =>\n color1?.[0] === color2?.[0] && color1?.[1] === color2?.[1] && color1?.[2] === color2?.[2];\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2821\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const parseCss = (cssString: string): CssObject => {\n const css = getDefaultCss();\n\n const rawEntries = [];\n\n let inValue = false;\n let currentKey = null;\n let parenthesesDepth = 0;\n let currentPart = \"\";\n\n // eslint-disable-next-line no-restricted-syntax\n for (const c of cssString) {\n if (c === \"(\") {\n parenthesesDepth++;\n } else if (parenthesesDepth > 0) {\n if (c === \")\") {\n parenthesesDepth--;\n }\n } else if (inValue) {\n if (c === \";\") {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n inValue = false;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n } else if (c === \":\") {\n currentKey = currentPart.trim();\n currentPart = \"\";\n inValue = true;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPart += c;\n }\n\n if (inValue && parenthesesDepth === 0) {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const { 0: key, 1: value } of rawEntries) {\n switch (key) {\n case \"background-color\": {\n if (value != null) {\n css.backgroundColor = value;\n }\n\n break;\n }\n case \"color\": {\n if (value != null) {\n css.color = value;\n }\n\n break;\n }\n case \"font-weight\": {\n if (value === \"bold\") {\n css.fontWeight = value;\n }\n\n break;\n }\n case \"font-style\": {\n if ([\"italic\", \"oblique\", \"oblique 14deg\"].includes(value as string)) {\n css.fontStyle = \"italic\";\n }\n\n break;\n }\n case \"text-decoration-line\": {\n css.textDecorationLine = [];\n const lineTypes = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const lineType of lineTypes) {\n if ([\"line-through\", \"overline\", \"underline\"].includes(lineType)) {\n css.textDecorationLine.push(lineType);\n }\n }\n\n break;\n }\n case \"text-decoration-color\": {\n const color = parseCssColor(value as string);\n\n if (color != null) {\n css.textDecorationColor = color;\n }\n\n break;\n }\n case \"text-decoration\": {\n css.textDecorationColor = null;\n css.textDecorationLine = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n const arguments_ = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const argument of arguments_) {\n const maybeColor = parseCssColor(argument);\n if (maybeColor != null) {\n css.textDecorationColor = maybeColor;\n } else if ([\"line-through\", \"overline\", \"underline\"].includes(argument)) {\n css.textDecorationLine.push(argument);\n }\n }\n\n break;\n }\n default:\n // empty\n }\n }\n\n return css;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2933\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const cssToAnsi = (css: CssObject, previousCss: CssObject | null = null): string => {\n // eslint-disable-next-line no-param-reassign\n previousCss = previousCss ?? getDefaultCss();\n\n let ansi = \"\";\n\n if (!colorEquals(css.backgroundColor, previousCss.backgroundColor)) {\n if (css.backgroundColor == null) {\n ansi += \"\\u001B[49m\";\n } else\n switch (css.backgroundColor) {\n case \"black\": {\n ansi += \"\\u001B[40m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[41m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[42m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[43m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[44m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[45m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[46m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[47m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.backgroundColor)) {\n const { 0: r, 1: g, 2: b } = css.backgroundColor;\n\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.backgroundColor);\n\n if (parsed === null) {\n ansi += \"\\u001B[49m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n if (!colorEquals(css.color, previousCss.color)) {\n if (css.color == null) {\n ansi += \"\\u001B[39m\";\n } else\n switch (css.color) {\n case \"black\": {\n ansi += \"\\u001B[30m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[31m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[32m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[33m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[34m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[35m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[36m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[37m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.color)) {\n const { 0: r, 1: g, 2: b } = css.color;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.color);\n\n if (parsed === null) {\n ansi += \"\\u001B[39m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n\n if (css.fontWeight !== previousCss.fontWeight) {\n ansi += css.fontWeight === \"bold\" ? \"\\u001B[1m\" : \"\\u001B[22m\";\n }\n\n if (css.fontStyle !== previousCss.fontStyle) {\n ansi += css.fontStyle === \"italic\" ? \"\\u001B[3m\" : \"\\u001B[23m\";\n }\n\n if (!colorEquals(css.textDecorationColor, previousCss.textDecorationColor)) {\n if (css.textDecorationColor == null) {\n ansi += \"\\u001B[59m\";\n } else {\n const { 0: r, 1: g, 2: b } = css.textDecorationColor;\n ansi += `\\u001B[58;2;${r};${g};${b}m`;\n }\n }\n\n if (css.textDecorationLine.includes(\"line-through\") !== previousCss.textDecorationLine.includes(\"line-through\")) {\n ansi += css.textDecorationLine.includes(\"line-through\") ? \"\\u001B[9m\" : \"\\u001B[29m\";\n }\n\n if (css.textDecorationLine.includes(\"overline\") !== previousCss.textDecorationLine.includes(\"overline\")) {\n ansi += css.textDecorationLine.includes(\"overline\") ? \"\\u001B[53m\" : \"\\u001B[55m\";\n }\n\n if (css.textDecorationLine.includes(\"underline\") !== previousCss.textDecorationLine.includes(\"underline\")) {\n ansi += css.textDecorationLine.includes(\"underline\") ? \"\\u001B[4m\" : \"\\u001B[24m\";\n }\n\n return ansi;\n};\n","import { cssToAnsi, parseCss } from \"./inspect-colors\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst tryStringify = (o: any): string => {\n try {\n return JSON.stringify(o);\n } catch {\n return '\"[Circular]\"';\n }\n};\n\nconst CHAR_PERCENT = \"%\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_s = \"s\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_d = \"d\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_f = \"f\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_i = \"i\".codePointAt(0);\nconst CHAR_O = \"O\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_o = \"o\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_j = \"j\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_c = \"c\".codePointAt(0);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,sonarjs/cognitive-complexity\nexport const format = (fmt: Record<string, any> | string, arguments_: any[] = [], options: Options = {}): string => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if ((typeof fmt !== \"string\" && typeof fmt !== \"object\") || fmt === null) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n throw new TypeError(`fmt must be a string or object, got ${fmt === null ? \"null\" : typeof fmt}`);\n }\n\n const stringify = options.stringify ?? tryStringify;\n const offset = 1;\n\n if (typeof fmt === \"object\") {\n const argumentsLength = arguments_.length + offset;\n\n if (argumentsLength === 1) {\n return \"{}\";\n }\n\n const objects = Array.from({ length: argumentsLength });\n\n objects[0] = stringify(fmt);\n\n for (let index = 1; index < argumentsLength; index++) {\n // eslint-disable-next-line security/detect-object-injection\n objects[index] = stringify(arguments_[index - offset]);\n }\n\n return objects.join(\" \");\n }\n\n if (arguments_.length === 0) {\n return fmt;\n }\n\n let result = \"\";\n let a = 1 - offset;\n let lastPosition = -1;\n\n let usedStyle = false;\n let previousCss = null;\n\n for (let index = 0; index < fmt.length; ) {\n if (fmt.codePointAt(index) === CHAR_PERCENT && index + 1 < fmt.length) {\n lastPosition = lastPosition > -1 ? lastPosition : 0;\n\n const c = fmt.codePointAt(index + 1);\n\n if (c === undefined) {\n ++a;\n break;\n }\n\n // eslint-disable-next-line default-case\n switch (c) {\n case CHAR_d:\n case CHAR_f: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Number(arguments_[a as keyof typeof arguments_]).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_i: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Math.floor(Number(arguments_[a as keyof typeof arguments_])).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_O:\n case CHAR_o:\n case CHAR_j: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] === undefined) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const temporaryArgument = arguments_[a as keyof typeof arguments_];\n const type = typeof temporaryArgument;\n\n if (type === \"string\") {\n result += `'${temporaryArgument}'`;\n lastPosition = index + 2;\n break;\n }\n\n if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/ban-types\n result += (temporaryArgument as Function).name ? `[Function: ${(temporaryArgument as Function).name}]` : \"[Function: <anonymous>]\";\n lastPosition = index + 2;\n break;\n }\n\n result += stringify(temporaryArgument);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_s: {\n if (a >= arguments_.length) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result +=\n typeof arguments_[a as keyof typeof arguments_] === \"object\"\n ? stringify(arguments_[a as keyof typeof arguments_])\n : String(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_PERCENT: {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += \"%\";\n lastPosition = index + 2;\n\n index++;\n a--;\n break;\n }\n case CHAR_c: {\n // Inspired by Deno's handling of '%c'.\n // eslint-disable-next-line no-secrets/no-secrets\n // https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L3115\n if (typeof window === \"undefined\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const css = parseCss(arguments_[a as keyof typeof arguments_]);\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += cssToAnsi(css, previousCss);\n\n if (result !== \"\") {\n usedStyle = true;\n previousCss = css;\n }\n }\n\n lastPosition = index + 2;\n\n index++;\n\n break;\n }\n }\n\n // eslint-disable-next-line security/detect-object-injection\n if (typeof options.formatters?.[c] === \"function\") {\n // eslint-disable-next-line security/detect-object-injection\n result += (options.formatters[c] as FormatterFunction)(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n }\n\n ++a;\n }\n\n ++index;\n }\n\n if (lastPosition === -1) {\n return fmt;\n }\n\n if (lastPosition < fmt.length) {\n result += fmt.slice(lastPosition);\n }\n\n if (usedStyle) {\n result += \"\\u001B[0m\";\n }\n\n return result;\n};\n\nexport const build = (\n options: Options = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ((f: NonNullable<Record<string, any> | string>, arguments_?: any[], formatOptions?: Omit<Options, \"formatters\">) => string) => {\n const formatters: FormatterMap = {};\n\n if (typeof options.formatters === \"object\") {\n Object.entries(options.formatters).forEach(([key, formatterFunction]) => {\n if (key.length === 0) {\n throw new Error(`Formatter %${key} has no characters`);\n }\n\n if (key.length > 1) {\n throw new Error(`Formatter %${key} has more than one character`);\n }\n\n if (typeof formatterFunction !== \"function\") {\n throw new TypeError(`Formatter for %${key} is not a function`);\n }\n\n const c = key.codePointAt(0);\n\n if (c === undefined) {\n throw new Error(`${key}.codePointAt(0) failed to return a value, please report this issue`);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n formatters[c] = formatterFunction;\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (f: NonNullable<Record<string, any> | string>, arguments_: any[] = [], formatOptions: Omit<Options, \"formatters\"> = {}) =>\n format(f, arguments_, { ...formatOptions, formatters });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormatterFunction = (argument: any) => string;\nexport type FormatterMap = Record<number, FormatterFunction>;\n\nexport interface Options {\n formatters?: Record<string, FormatterFunction>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stringify?: (o: any) => string;\n}\n"]}
1
+ {"version":3,"sources":["../src/inspect-colors.ts","../src/index.ts"],"names":["colorKeywords","HASH_PATTERN","SMALL_HASH_PATTERN","RGB_PATTERN","HSL_PATTERN","getDefaultCss","SPACE_PATTERN","parseCssColor","colorString","hashMatch","smallHashMatch","rgbMatch","hslMatch","h","s","l","x","m","r_","g_","b_","colorEquals","color1","color2","parseCss","cssString","css","rawEntries","inValue","currentKey","parenthesesDepth","currentPart","c","value","key","lineTypes","lineType","color","arguments_","argument","maybeColor","cssToAnsi","previousCss","ansi","r","g","b","parsed","tryStringify","o","CHAR_PERCENT","CHAR_s","CHAR_d","CHAR_f","CHAR_i","CHAR_O","CHAR_o","CHAR_j","CHAR_c","format","fmt","options","stringify","offset","argumentsLength","objects","index","result","a","lastPosition","usedStyle","temporaryArgument","type","build","formatters","formatterFunction","f","formatOptions"],"mappings":"AAaA,IAAMA,EAAqC,IAAI,IAAoB,CAC/D,CAAC,YAAa,SAAS,EACvB,CAAC,eAAgB,SAAS,EAC1B,CAAC,OAAQ,SAAS,EAClB,CAAC,aAAc,SAAS,EACxB,CAAC,Q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AK,GAI3CC,GAAWN,EAAQ,WAAW7B,CAAC,EAAwBM,EAAW8B,CAA4B,CAAC,EAE/FC,EAAeH,EAAQ,EAEvBA,IAGZ,CAEA,EAAEE,CACN,CAEA,EAAEF,CACN,CAEA,OAAIG,IAAiB,GACVT,GAGPS,EAAeT,EAAI,SACnBO,GAAUP,EAAI,MAAMS,CAAY,GAGhCC,IACAH,GAAU,WAGPA,EACX,EAEaM,EAAQ,CACjBZ,EAAmB,CAAC,IAE0G,CAC9H,IAAMa,EAA2B,CAAC,EAElC,OAAI,OAAOb,EAAQ,YAAe,UAC9B,OAAO,QAAQA,EAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC3B,EAAKyC,CAAiB,IAAM,CACrE,GAAIzC,EAAI,SAAW,EACf,MAAM,IAAI,MAAM,cAAcA,CAAG,oBAAoB,EAGzD,GAAIA,EAAI,OAAS,EACb,MAAM,IAAI,MAAM,cAAcA,CAAG,8BAA8B,EAGnE,GAAI,OAAOyC,GAAsB,WAC7B,MAAM,IAAI,UAAU,kBAAkBzC,CAAG,oBAAoB,EAGjE,IAAMF,EAAIE,EAAI,YAAY,CAAC,EAE3B,GAAIF,IAAM,OACN,MAAM,IAAI,MAAM,GAAGE,CAAG,oEAAoE,EAI9FwC,EAAW1C,CAAC,EAAI2C,CACpB,CAAC,EAIE,CAACC,EAA8CtC,EAAoB,CAAC,EAAGuC,EAA6C,CAAC,IACxHlB,EAAOiB,EAAGtC,EAAY,CAAE,GAAGuC,EAAe,WAAAH,CAAW,CAAC,CAC9D","sourcesContent":["type CssObject = {\n __proto__: null;\n backgroundColor: string | null;\n color: string | null;\n fontStyle: string | null;\n fontWeight: string | null;\n textDecorationColor: [number, number, number] | null;\n textDecorationLine: string[];\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2575\nconst colorKeywords: Map<string, string> = new Map<string, string>([\n [\"aliceblue\", \"#f0f8ff\"],\n [\"antiquewhite\", \"#faebd7\"],\n [\"aqua\", \"#00ffff\"],\n [\"aquamarine\", \"#7fffd4\"],\n [\"azure\", \"#f0ffff\"],\n [\"beige\", \"#f5f5dc\"],\n [\"bisque\", \"#ffe4c4\"],\n [\"black\", \"#000000\"],\n [\"blanchedalmond\", \"#ffebcd\"],\n [\"blue\", \"#0000ff\"],\n [\"blueviolet\", \"#8a2be2\"],\n [\"brown\", \"#a52a2a\"],\n [\"burlywood\", \"#deb887\"],\n [\"cadetblue\", \"#5f9ea0\"],\n [\"chartreuse\", \"#7fff00\"],\n [\"chocolate\", \"#d2691e\"],\n [\"coral\", \"#ff7f50\"],\n [\"cornflowerblue\", \"#6495ed\"],\n [\"cornsilk\", \"#fff8dc\"],\n [\"crimson\", \"#dc143c\"],\n [\"cyan\", \"#00ffff\"],\n [\"darkblue\", \"#00008b\"],\n [\"darkcyan\", \"#008b8b\"],\n [\"darkgoldenrod\", \"#b8860b\"],\n [\"darkgray\", \"#a9a9a9\"],\n [\"darkgreen\", \"#006400\"],\n [\"darkgrey\", \"#a9a9a9\"],\n [\"darkkhaki\", \"#bdb76b\"],\n [\"darkmagenta\", \"#8b008b\"],\n [\"darkolivegreen\", \"#556b2f\"],\n [\"darkorange\", \"#ff8c00\"],\n [\"darkorchid\", \"#9932cc\"],\n [\"darkred\", \"#8b0000\"],\n [\"darksalmon\", \"#e9967a\"],\n [\"darkseagreen\", \"#8fbc8f\"],\n [\"darkslateblue\", \"#483d8b\"],\n [\"darkslategray\", \"#2f4f4f\"],\n [\"darkslategrey\", \"#2f4f4f\"],\n [\"darkturquoise\", \"#00ced1\"],\n [\"darkviolet\", \"#9400d3\"],\n [\"deeppink\", \"#ff1493\"],\n [\"deepskyblue\", \"#00bfff\"],\n [\"dimgray\", \"#696969\"],\n [\"dimgrey\", \"#696969\"],\n [\"dodgerblue\", \"#1e90ff\"],\n [\"firebrick\", \"#b22222\"],\n [\"floralwhite\", \"#fffaf0\"],\n [\"forestgreen\", \"#228b22\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"gainsboro\", \"#dcdcdc\"],\n [\"ghostwhite\", \"#f8f8ff\"],\n [\"gold\", \"#ffd700\"],\n [\"goldenrod\", \"#daa520\"],\n [\"gray\", \"#808080\"],\n [\"green\", \"#008000\"],\n [\"greenyellow\", \"#adff2f\"],\n [\"grey\", \"#808080\"],\n [\"honeydew\", \"#f0fff0\"],\n [\"hotpink\", \"#ff69b4\"],\n [\"indianred\", \"#cd5c5c\"],\n [\"indigo\", \"#4b0082\"],\n [\"ivory\", \"#fffff0\"],\n [\"khaki\", \"#f0e68c\"],\n [\"lavender\", \"#e6e6fa\"],\n [\"lavenderblush\", \"#fff0f5\"],\n [\"lawngreen\", \"#7cfc00\"],\n [\"lemonchiffon\", \"#fffacd\"],\n [\"lightblue\", \"#add8e6\"],\n [\"lightcoral\", \"#f08080\"],\n [\"lightcyan\", \"#e0ffff\"],\n [\"lightgoldenrodyellow\", \"#fafad2\"],\n [\"lightgray\", \"#d3d3d3\"],\n [\"lightgreen\", \"#90ee90\"],\n [\"lightgrey\", \"#d3d3d3\"],\n [\"lightpink\", \"#ffb6c1\"],\n [\"lightsalmon\", \"#ffa07a\"],\n [\"lightseagreen\", \"#20b2aa\"],\n [\"lightskyblue\", \"#87cefa\"],\n [\"lightslategray\", \"#778899\"],\n [\"lightslategrey\", \"#778899\"],\n [\"lightsteelblue\", \"#b0c4de\"],\n [\"lightyellow\", \"#ffffe0\"],\n [\"lime\", \"#00ff00\"],\n [\"limegreen\", \"#32cd32\"],\n [\"linen\", \"#faf0e6\"],\n [\"magenta\", \"#ff00ff\"],\n [\"maroon\", \"#800000\"],\n [\"mediumaquamarine\", \"#66cdaa\"],\n [\"mediumblue\", \"#0000cd\"],\n [\"mediumorchid\", \"#ba55d3\"],\n [\"mediumpurple\", \"#9370db\"],\n [\"mediumseagreen\", \"#3cb371\"],\n [\"mediumslateblue\", \"#7b68ee\"],\n [\"mediumspringgreen\", \"#00fa9a\"],\n [\"mediumturquoise\", \"#48d1cc\"],\n [\"mediumvioletred\", \"#c71585\"],\n [\"midnightblue\", \"#191970\"],\n [\"mintcream\", \"#f5fffa\"],\n [\"mistyrose\", \"#ffe4e1\"],\n [\"moccasin\", \"#ffe4b5\"],\n [\"navajowhite\", \"#ffdead\"],\n [\"navy\", \"#000080\"],\n [\"oldlace\", \"#fdf5e6\"],\n [\"olive\", \"#808000\"],\n [\"olivedrab\", \"#6b8e23\"],\n [\"orange\", \"#ffa500\"],\n [\"orangered\", \"#ff4500\"],\n [\"orchid\", \"#da70d6\"],\n [\"palegoldenrod\", \"#eee8aa\"],\n [\"palegreen\", \"#98fb98\"],\n [\"paleturquoise\", \"#afeeee\"],\n [\"palevioletred\", \"#db7093\"],\n [\"papayawhip\", \"#ffefd5\"],\n [\"peachpuff\", \"#ffdab9\"],\n [\"peru\", \"#cd853f\"],\n [\"pink\", \"#ffc0cb\"],\n [\"plum\", \"#dda0dd\"],\n [\"powderblue\", \"#b0e0e6\"],\n [\"purple\", \"#800080\"],\n [\"rebeccapurple\", \"#663399\"],\n [\"red\", \"#ff0000\"],\n [\"rosybrown\", \"#bc8f8f\"],\n [\"royalblue\", \"#4169e1\"],\n [\"saddlebrown\", \"#8b4513\"],\n [\"salmon\", \"#fa8072\"],\n [\"sandybrown\", \"#f4a460\"],\n [\"seagreen\", \"#2e8b57\"],\n [\"seashell\", \"#fff5ee\"],\n [\"sienna\", \"#a0522d\"],\n [\"silver\", \"#c0c0c0\"],\n [\"skyblue\", \"#87ceeb\"],\n [\"slateblue\", \"#6a5acd\"],\n [\"slategray\", \"#708090\"],\n [\"slategrey\", \"#708090\"],\n [\"snow\", \"#fffafa\"],\n [\"springgreen\", \"#00ff7f\"],\n [\"steelblue\", \"#4682b4\"],\n [\"tan\", \"#d2b48c\"],\n [\"teal\", \"#008080\"],\n [\"thistle\", \"#d8bfd8\"],\n [\"tomato\", \"#ff6347\"],\n [\"turquoise\", \"#40e0d0\"],\n [\"violet\", \"#ee82ee\"],\n [\"wheat\", \"#f5deb3\"],\n [\"white\", \"#ffffff\"],\n [\"whitesmoke\", \"#f5f5f5\"],\n [\"yellow\", \"#ffff00\"],\n [\"yellowgreen\", \"#9acd32\"],\n]);\n\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\nconst HASH_PATTERN = /^#([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})?$/i;\n// eslint-disable-next-line regexp/optimal-quantifier-concatenation,regexp/no-unused-capturing-group\nconst SMALL_HASH_PATTERN = /^#([\\dA-F])([\\dA-F])([\\dA-F])([\\dA-F])?$/i;\nconst RGB_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^rgba?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\nconst HSL_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^hsla?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\n\nconst getDefaultCss = (): CssObject => {\n return {\n __proto__: null,\n backgroundColor: null,\n color: null,\n fontStyle: null,\n fontWeight: null,\n textDecorationColor: null,\n textDecorationLine: [],\n };\n};\n\n// eslint-disable-next-line regexp/no-useless-flag\nconst SPACE_PATTERN = /\\s+/g;\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2739\nconst parseCssColor = (colorString: string): [number, number, number] | null => {\n if (colorKeywords.has(colorString)) {\n // eslint-disable-next-line no-param-reassign\n colorString = colorKeywords.get(colorString) as string;\n }\n\n const hashMatch = HASH_PATTERN.exec(colorString);\n\n if (hashMatch) {\n return [Number.parseInt(hashMatch[1] as string, 16), Number.parseInt(hashMatch[2] as string, 16), Number.parseInt(hashMatch[3] as string, 16)];\n }\n\n const smallHashMatch = SMALL_HASH_PATTERN.exec(colorString);\n\n if (smallHashMatch) {\n return [\n Number.parseInt(`${smallHashMatch[1]}${smallHashMatch[1]}`, 16),\n Number.parseInt(`${smallHashMatch[2]}${smallHashMatch[2]}`, 16),\n Number.parseInt(`${smallHashMatch[3]}${smallHashMatch[3]}`, 16),\n ];\n }\n\n const rgbMatch = RGB_PATTERN.exec(colorString);\n\n if (rgbMatch) {\n return [\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[1])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[2])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[3])))),\n ];\n }\n\n const hslMatch = HSL_PATTERN.exec(colorString);\n\n if (hslMatch) {\n // https://www.rapidtables.com/convert/color/hsl-to-rgb.html\n let h = Number(hslMatch[1]) % 360;\n if (h < 0) {\n h += 360;\n }\n const s = Math.max(0, Math.min(100, Number(hslMatch[2]))) / 100;\n const l = Math.max(0, Math.min(100, Number(hslMatch[3]))) / 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let r_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let g_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let b_: number;\n\n if (h < 60) {\n ({ 0: r_, 1: g_, 2: b_ } = [c, x, 0]);\n } else if (h < 120) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, c, 0]);\n } else if (h < 180) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, c, x]);\n } else if (h < 240) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, x, c]);\n } else if (h < 300) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, 0, c]);\n } else {\n ({ 0: r_, 1: g_, 2: b_ } = [c, 0, x]);\n }\n\n return [Math.round((r_ + m) * 255), Math.round((g_ + m) * 255), Math.round((b_ + m) * 255)];\n }\n\n return null;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2928\nconst colorEquals = (color1: string | [number, number, number] | null, color2: string | [number, number, number] | null) =>\n color1?.[0] === color2?.[0] && color1?.[1] === color2?.[1] && color1?.[2] === color2?.[2];\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2821\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const parseCss = (cssString: string): CssObject => {\n const css = getDefaultCss();\n\n const rawEntries = [];\n\n let inValue = false;\n let currentKey = null;\n let parenthesesDepth = 0;\n let currentPart = \"\";\n\n // eslint-disable-next-line no-restricted-syntax\n for (const c of cssString) {\n if (c === \"(\") {\n parenthesesDepth++;\n } else if (parenthesesDepth > 0) {\n if (c === \")\") {\n parenthesesDepth--;\n }\n } else if (inValue) {\n if (c === \";\") {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n inValue = false;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n } else if (c === \":\") {\n currentKey = currentPart.trim();\n currentPart = \"\";\n inValue = true;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPart += c;\n }\n\n if (inValue && parenthesesDepth === 0) {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const { 0: key, 1: value } of rawEntries) {\n switch (key) {\n case \"background-color\": {\n if (value != null) {\n css.backgroundColor = value;\n }\n\n break;\n }\n case \"color\": {\n if (value != null) {\n css.color = value;\n }\n\n break;\n }\n case \"font-weight\": {\n if (value === \"bold\") {\n css.fontWeight = value;\n }\n\n break;\n }\n case \"font-style\": {\n if ([\"italic\", \"oblique\", \"oblique 14deg\"].includes(value as string)) {\n css.fontStyle = \"italic\";\n }\n\n break;\n }\n case \"text-decoration-line\": {\n css.textDecorationLine = [];\n const lineTypes = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const lineType of lineTypes) {\n if ([\"line-through\", \"overline\", \"underline\"].includes(lineType)) {\n css.textDecorationLine.push(lineType);\n }\n }\n\n break;\n }\n case \"text-decoration-color\": {\n const color = parseCssColor(value as string);\n\n if (color != null) {\n css.textDecorationColor = color;\n }\n\n break;\n }\n case \"text-decoration\": {\n css.textDecorationColor = null;\n css.textDecorationLine = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n const arguments_ = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const argument of arguments_) {\n const maybeColor = parseCssColor(argument);\n if (maybeColor != null) {\n css.textDecorationColor = maybeColor;\n } else if ([\"line-through\", \"overline\", \"underline\"].includes(argument)) {\n css.textDecorationLine.push(argument);\n }\n }\n\n break;\n }\n default:\n // empty\n }\n }\n\n return css;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2933\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const cssToAnsi = (css: CssObject, previousCss: CssObject | null = null): string => {\n // eslint-disable-next-line no-param-reassign\n previousCss = previousCss ?? getDefaultCss();\n\n let ansi = \"\";\n\n if (!colorEquals(css.backgroundColor, previousCss.backgroundColor)) {\n if (css.backgroundColor == null) {\n ansi += \"\\u001B[49m\";\n } else\n switch (css.backgroundColor) {\n case \"black\": {\n ansi += \"\\u001B[40m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[41m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[42m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[43m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[44m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[45m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[46m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[47m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.backgroundColor)) {\n const { 0: r, 1: g, 2: b } = css.backgroundColor;\n\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.backgroundColor);\n\n if (parsed === null) {\n ansi += \"\\u001B[49m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n if (!colorEquals(css.color, previousCss.color)) {\n if (css.color == null) {\n ansi += \"\\u001B[39m\";\n } else\n switch (css.color) {\n case \"black\": {\n ansi += \"\\u001B[30m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[31m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[32m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[33m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[34m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[35m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[36m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[37m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.color)) {\n const { 0: r, 1: g, 2: b } = css.color;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.color);\n\n if (parsed === null) {\n ansi += \"\\u001B[39m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n\n if (css.fontWeight !== previousCss.fontWeight) {\n ansi += css.fontWeight === \"bold\" ? \"\\u001B[1m\" : \"\\u001B[22m\";\n }\n\n if (css.fontStyle !== previousCss.fontStyle) {\n ansi += css.fontStyle === \"italic\" ? \"\\u001B[3m\" : \"\\u001B[23m\";\n }\n\n if (!colorEquals(css.textDecorationColor, previousCss.textDecorationColor)) {\n if (css.textDecorationColor == null) {\n ansi += \"\\u001B[59m\";\n } else {\n const { 0: r, 1: g, 2: b } = css.textDecorationColor;\n ansi += `\\u001B[58;2;${r};${g};${b}m`;\n }\n }\n\n if (css.textDecorationLine.includes(\"line-through\") !== previousCss.textDecorationLine.includes(\"line-through\")) {\n ansi += css.textDecorationLine.includes(\"line-through\") ? \"\\u001B[9m\" : \"\\u001B[29m\";\n }\n\n if (css.textDecorationLine.includes(\"overline\") !== previousCss.textDecorationLine.includes(\"overline\")) {\n ansi += css.textDecorationLine.includes(\"overline\") ? \"\\u001B[53m\" : \"\\u001B[55m\";\n }\n\n if (css.textDecorationLine.includes(\"underline\") !== previousCss.textDecorationLine.includes(\"underline\")) {\n ansi += css.textDecorationLine.includes(\"underline\") ? \"\\u001B[4m\" : \"\\u001B[24m\";\n }\n\n return ansi;\n};\n","import { cssToAnsi, parseCss } from \"./inspect-colors\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst tryStringify = (o: any): string => {\n try {\n return JSON.stringify(o);\n } catch {\n return '\"[Circular]\"';\n }\n};\n\nconst CHAR_PERCENT = \"%\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_s = \"s\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_d = \"d\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_f = \"f\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_i = \"i\".codePointAt(0);\nconst CHAR_O = \"O\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_o = \"o\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_j = \"j\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_c = \"c\".codePointAt(0);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,sonarjs/cognitive-complexity\nexport const format = (fmt: Record<string, any> | string, arguments_: any[] = [], options: Options = {}): string => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if ((typeof fmt !== \"string\" && typeof fmt !== \"object\") || fmt === null) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n throw new TypeError(`fmt must be a string or object, got ${fmt === null ? \"null\" : typeof fmt}`);\n }\n\n const stringify = options.stringify ?? tryStringify;\n const offset = 1;\n\n if (typeof fmt === \"object\") {\n const argumentsLength = arguments_.length + offset;\n\n if (argumentsLength === 1) {\n return \"{}\";\n }\n\n const objects = Array.from({ length: argumentsLength });\n\n objects[0] = stringify(fmt);\n\n for (let index = 1; index < argumentsLength; index++) {\n // eslint-disable-next-line security/detect-object-injection\n objects[index] = stringify(arguments_[index - offset]);\n }\n\n return objects.join(\" \");\n }\n\n if (arguments_.length === 0) {\n return fmt;\n }\n\n let result = \"\";\n let a = 1 - offset;\n let lastPosition = -1;\n\n let usedStyle = false;\n let previousCss = null;\n\n for (let index = 0; index < fmt.length; ) {\n if (fmt.codePointAt(index) === CHAR_PERCENT && index + 1 < fmt.length) {\n lastPosition = lastPosition > -1 ? lastPosition : 0;\n\n const c = fmt.codePointAt(index + 1);\n\n if (c === undefined) {\n ++a;\n break;\n }\n\n switch (c) {\n case CHAR_d:\n case CHAR_f: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Number(arguments_[a as keyof typeof arguments_]).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_i: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Math.floor(Number(arguments_[a as keyof typeof arguments_])).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_O:\n case CHAR_o:\n case CHAR_j: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] === undefined) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const temporaryArgument = arguments_[a as keyof typeof arguments_];\n const type = typeof temporaryArgument;\n\n if (type === \"string\") {\n result += `'${temporaryArgument}'`;\n lastPosition = index + 2;\n break;\n }\n\n if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/ban-types\n result += (temporaryArgument as Function).name ? `[Function: ${(temporaryArgument as Function).name}]` : \"[Function: <anonymous>]\";\n lastPosition = index + 2;\n break;\n }\n\n result += stringify(temporaryArgument);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_s: {\n if (a >= arguments_.length) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result +=\n typeof arguments_[a as keyof typeof arguments_] === \"object\"\n ? stringify(arguments_[a as keyof typeof arguments_])\n : String(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_PERCENT: {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += \"%\";\n lastPosition = index + 2;\n\n index++;\n a--;\n break;\n }\n case CHAR_c: {\n // Inspired by Deno's handling of '%c'.\n // eslint-disable-next-line no-secrets/no-secrets\n // https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L3115\n if (typeof window === \"undefined\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const css = parseCss(arguments_[a as keyof typeof arguments_]);\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += cssToAnsi(css, previousCss);\n\n if (result !== \"\") {\n usedStyle = true;\n previousCss = css;\n }\n }\n\n lastPosition = index + 2;\n\n index++;\n\n break;\n }\n default: {\n // eslint-disable-next-line security/detect-object-injection\n if (typeof options.formatters?.[c] === \"function\") {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n result += (options.formatters[c] as FormatterFunction)(arguments_[a as keyof typeof arguments_]);\n\n lastPosition = index + 2;\n\n index++;\n }\n }\n }\n\n ++a;\n }\n\n ++index;\n }\n\n if (lastPosition === -1) {\n return fmt;\n }\n\n if (lastPosition < fmt.length) {\n result += fmt.slice(lastPosition);\n }\n\n if (usedStyle) {\n result += \"\\u001B[0m\";\n }\n\n return result;\n};\n\nexport const build = (\n options: Options = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ((f: NonNullable<Record<string, any> | string>, arguments_?: any[], formatOptions?: Omit<Options, \"formatters\">) => string) => {\n const formatters: FormatterMap = {};\n\n if (typeof options.formatters === \"object\") {\n Object.entries(options.formatters).forEach(([key, formatterFunction]) => {\n if (key.length === 0) {\n throw new Error(`Formatter %${key} has no characters`);\n }\n\n if (key.length > 1) {\n throw new Error(`Formatter %${key} has more than one character`);\n }\n\n if (typeof formatterFunction !== \"function\") {\n throw new TypeError(`Formatter for %${key} is not a function`);\n }\n\n const c = key.codePointAt(0);\n\n if (c === undefined) {\n throw new Error(`${key}.codePointAt(0) failed to return a value, please report this issue`);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n formatters[c] = formatterFunction;\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (f: NonNullable<Record<string, any> | string>, arguments_: any[] = [], formatOptions: Omit<Options, \"formatters\"> = {}) =>\n format(f, arguments_, { ...formatOptions, formatters });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormatterFunction = (argument: any) => string;\nexport type FormatterMap = Record<number, FormatterFunction>;\n\nexport interface Options {\n formatters?: Record<string, FormatterFunction>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stringify?: (o: any) => string;\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),C=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,$=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,M=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,D=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,k=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/g,g=e=>{h.has(e)&&(e=h.get(e));let n=C.exec(e);if(n)return [Number.parseInt(n[1],16),Number.parseInt(n[2],16),Number.parseInt(n[3],16)];let t=$.exec(e);if(t)return [Number.parseInt(`${t[1]}${t[1]}`,16),Number.parseInt(`${t[2]}${t[2]}`,16),Number.parseInt(`${t[3]}${t[3]}`,16)];let l=M.exec(e);if(l)return [Math.round(Math.max(0,Math.min(255,Number(l[1])))),Math.round(Math.max(0,Math.min(255,Number(l[2])))),Math.round(Math.max(0,Math.min(255,Number(l[3]))))];let f=D.exec(e);if(f){let o=Number(f[1])%360;o<0&&(o+=360);let i=Math.max(0,Math.min(100,Number(f[2])))/100,a=Math.max(0,Math.min(100,Number(f[3])))/100,c=(1-Math.abs(2*a-1))*i,d=c*(1-Math.abs(o/60%2-1)),r=a-c/2,u,s,b;return o<60?{0:u,1:s,2:b}=[c,d,0]:o<120?{0:u,1:s,2:b}=[d,c,0]:o<180?{0:u,1:s,2:b}=[0,c,d]:o<240?{0:u,1:s,2:b}=[0,d,c]:o<300?{0:u,1:s,2:b}=[d,0,c]:{0:u,1:s,2:b}=[c,0,d],[Math.round((u+r)*255),Math.round((s+r)*255),Math.round((b+r)*255)]}return null},m=(e,n)=>e?.[0]===n?.[0]&&e?.[1]===n?.[1]&&e?.[2]===n?.[2],p=e=>{let n=k(),t=[],l=!1,f=null,o=0,i="";for(let a of e){if(a==="(")o++;else if(o>0)a===")"&&o--;else if(l){if(a===";"){let c=i.trim();c!==""&&t.push([f,c]),f=null,i="",l=!1;continue}}else if(a===":"){f=i.trim(),i="",l=!0;continue}i+=a;}if(l&&o===0){let a=i.trim();a!==""&&t.push([f,a]),f=null,i="";}for(let{0:a,1:c}of t)switch(a){case"background-color":{c!=null&&(n.backgroundColor=c);break}case"color":{c!=null&&(n.color=c);break}case"font-weight":{c==="bold"&&(n.fontWeight=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(n.fontStyle="italic");break}case"text-decoration-line":{n.textDecorationLine=[];let d=c.split(y);for(let r of d)["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);break}case"text-decoration-color":{let d=g(c);d!=null&&(n.textDecorationColor=d);break}case"text-decoration":{n.textDecorationColor=null,n.textDecorationLine=[];let d=c.split(y);for(let r of d){let u=g(r);u!=null?n.textDecorationColor=u:["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);}break}}return n},w=(e,n=null)=>{n=n??k();let t="";if(!m(e.backgroundColor,n.backgroundColor))if(e.backgroundColor==null)t+="\x1B[49m";else switch(e.backgroundColor){case"black":{t+="\x1B[40m";break}case"red":{t+="\x1B[41m";break}case"green":{t+="\x1B[42m";break}case"yellow":{t+="\x1B[43m";break}case"blue":{t+="\x1B[44m";break}case"magenta":{t+="\x1B[45m";break}case"cyan":{t+="\x1B[46m";break}case"white":{t+="\x1B[47m";break}default:if(Array.isArray(e.backgroundColor)){let{0:l,1:f,2:o}=e.backgroundColor;t+=`\x1B[48;2;${l};${f};${o}m`;}else {let l=g(e.backgroundColor);if(l===null)t+="\x1B[49m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[48;2;${f};${o};${i}m`;}}}if(!m(e.color,n.color))if(e.color==null)t+="\x1B[39m";else switch(e.color){case"black":{t+="\x1B[30m";break}case"red":{t+="\x1B[31m";break}case"green":{t+="\x1B[32m";break}case"yellow":{t+="\x1B[33m";break}case"blue":{t+="\x1B[34m";break}case"magenta":{t+="\x1B[35m";break}case"cyan":{t+="\x1B[36m";break}case"white":{t+="\x1B[37m";break}default:if(Array.isArray(e.color)){let{0:l,1:f,2:o}=e.color;t+=`\x1B[38;2;${l};${f};${o}m`;}else {let l=g(e.color);if(l===null)t+="\x1B[39m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[38;2;${f};${o};${i}m`;}}}if(e.fontWeight!==n.fontWeight&&(t+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==n.fontStyle&&(t+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!m(e.textDecorationColor,n.textDecorationColor))if(e.textDecorationColor==null)t+="\x1B[59m";else {let{0:l,1:f,2:o}=e.textDecorationColor;t+=`\x1B[58;2;${l};${f};${o}m`;}return e.textDecorationLine.includes("line-through")!==n.textDecorationLine.includes("line-through")&&(t+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==n.textDecorationLine.includes("overline")&&(t+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==n.textDecorationLine.includes("underline")&&(t+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t};var N=e=>{try{return JSON.stringify(e)}catch{return '"[Circular]"'}},A="%".codePointAt(0),F="s".codePointAt(0),P="d".codePointAt(0),_="f".codePointAt(0),R="i".codePointAt(0),L="O".codePointAt(0),O="o".codePointAt(0),T="j".codePointAt(0),j="c".codePointAt(0),E=(e,n=[],t={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);let l=t.stringify??N,f=1;if(typeof e=="object"){let r=n.length+f;if(r===1)return "{}";let u=Array.from({length:r});u[0]=l(e);for(let s=1;s<r;s++)u[s]=l(n[s-f]);return u.join(" ")}if(n.length===0)return e;let o="",i=1-f,a=-1,c=!1,d=null;for(let r=0;r<e.length;){if(e.codePointAt(r)===A&&r+1<e.length){a=a>-1?a:0;let u=e.codePointAt(r+1);if(u===void 0){++i;break}switch(u){case P:case _:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Number(n[i]).toString(),a=r+2,r++;break}case R:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Math.floor(Number(n[i])).toString(),a=r+2,r++;break}case L:case O:case T:{if(i>=n.length||n[i]===void 0)break;a<r&&(o+=e.slice(a,r));let s=n[i],b=typeof s;if(b==="string"){o+=`'${s}'`,a=r+2;break}if(b==="function"){o+=s.name?`[Function: ${s.name}]`:"[Function: <anonymous>]",a=r+2;break}o+=l(s),a=r+2,r++;break}case F:{if(i>=n.length)break;a<r&&(o+=e.slice(a,r)),o+=typeof n[i]=="object"?l(n[i]):String(n[i]),a=r+2,r++;break}case A:{a<r&&(o+=e.slice(a,r)),o+="%",a=r+2,r++,i--;break}case j:{if(typeof window>"u"){let s=p(n[i]);a<r&&(o+=e.slice(a,r)),o+=w(s,d),o!==""&&(c=!0,d=s);}a=r+2,r++;break}}typeof t.formatters?.[u]=="function"&&(o+=t.formatters[u](n[i]),a=r+2),++i;}++r;}return a===-1?e:(a<e.length&&(o+=e.slice(a)),c&&(o+="\x1B[0m"),o)},S=(e={})=>{let n={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([t,l])=>{if(t.length===0)throw new Error(`Formatter %${t} has no characters`);if(t.length>1)throw new Error(`Formatter %${t} has more than one character`);if(typeof l!="function")throw new TypeError(`Formatter for %${t} is not a function`);let f=t.codePointAt(0);if(f===void 0)throw new Error(`${t}.codePointAt(0) failed to return a value, please report this issue`);n[f]=l;}),(t,l=[],f={})=>E(t,l,{...f,formatters:n})};
1
+ var h=new Map([["aliceblue","#f0f8ff"],["antiquewhite","#faebd7"],["aqua","#00ffff"],["aquamarine","#7fffd4"],["azure","#f0ffff"],["beige","#f5f5dc"],["bisque","#ffe4c4"],["black","#000000"],["blanchedalmond","#ffebcd"],["blue","#0000ff"],["blueviolet","#8a2be2"],["brown","#a52a2a"],["burlywood","#deb887"],["cadetblue","#5f9ea0"],["chartreuse","#7fff00"],["chocolate","#d2691e"],["coral","#ff7f50"],["cornflowerblue","#6495ed"],["cornsilk","#fff8dc"],["crimson","#dc143c"],["cyan","#00ffff"],["darkblue","#00008b"],["darkcyan","#008b8b"],["darkgoldenrod","#b8860b"],["darkgray","#a9a9a9"],["darkgreen","#006400"],["darkgrey","#a9a9a9"],["darkkhaki","#bdb76b"],["darkmagenta","#8b008b"],["darkolivegreen","#556b2f"],["darkorange","#ff8c00"],["darkorchid","#9932cc"],["darkred","#8b0000"],["darksalmon","#e9967a"],["darkseagreen","#8fbc8f"],["darkslateblue","#483d8b"],["darkslategray","#2f4f4f"],["darkslategrey","#2f4f4f"],["darkturquoise","#00ced1"],["darkviolet","#9400d3"],["deeppink","#ff1493"],["deepskyblue","#00bfff"],["dimgray","#696969"],["dimgrey","#696969"],["dodgerblue","#1e90ff"],["firebrick","#b22222"],["floralwhite","#fffaf0"],["forestgreen","#228b22"],["fuchsia","#ff00ff"],["gainsboro","#dcdcdc"],["ghostwhite","#f8f8ff"],["gold","#ffd700"],["goldenrod","#daa520"],["gray","#808080"],["green","#008000"],["greenyellow","#adff2f"],["grey","#808080"],["honeydew","#f0fff0"],["hotpink","#ff69b4"],["indianred","#cd5c5c"],["indigo","#4b0082"],["ivory","#fffff0"],["khaki","#f0e68c"],["lavender","#e6e6fa"],["lavenderblush","#fff0f5"],["lawngreen","#7cfc00"],["lemonchiffon","#fffacd"],["lightblue","#add8e6"],["lightcoral","#f08080"],["lightcyan","#e0ffff"],["lightgoldenrodyellow","#fafad2"],["lightgray","#d3d3d3"],["lightgreen","#90ee90"],["lightgrey","#d3d3d3"],["lightpink","#ffb6c1"],["lightsalmon","#ffa07a"],["lightseagreen","#20b2aa"],["lightskyblue","#87cefa"],["lightslategray","#778899"],["lightslategrey","#778899"],["lightsteelblue","#b0c4de"],["lightyellow","#ffffe0"],["lime","#00ff00"],["limegreen","#32cd32"],["linen","#faf0e6"],["magenta","#ff00ff"],["maroon","#800000"],["mediumaquamarine","#66cdaa"],["mediumblue","#0000cd"],["mediumorchid","#ba55d3"],["mediumpurple","#9370db"],["mediumseagreen","#3cb371"],["mediumslateblue","#7b68ee"],["mediumspringgreen","#00fa9a"],["mediumturquoise","#48d1cc"],["mediumvioletred","#c71585"],["midnightblue","#191970"],["mintcream","#f5fffa"],["mistyrose","#ffe4e1"],["moccasin","#ffe4b5"],["navajowhite","#ffdead"],["navy","#000080"],["oldlace","#fdf5e6"],["olive","#808000"],["olivedrab","#6b8e23"],["orange","#ffa500"],["orangered","#ff4500"],["orchid","#da70d6"],["palegoldenrod","#eee8aa"],["palegreen","#98fb98"],["paleturquoise","#afeeee"],["palevioletred","#db7093"],["papayawhip","#ffefd5"],["peachpuff","#ffdab9"],["peru","#cd853f"],["pink","#ffc0cb"],["plum","#dda0dd"],["powderblue","#b0e0e6"],["purple","#800080"],["rebeccapurple","#663399"],["red","#ff0000"],["rosybrown","#bc8f8f"],["royalblue","#4169e1"],["saddlebrown","#8b4513"],["salmon","#fa8072"],["sandybrown","#f4a460"],["seagreen","#2e8b57"],["seashell","#fff5ee"],["sienna","#a0522d"],["silver","#c0c0c0"],["skyblue","#87ceeb"],["slateblue","#6a5acd"],["slategray","#708090"],["slategrey","#708090"],["snow","#fffafa"],["springgreen","#00ff7f"],["steelblue","#4682b4"],["tan","#d2b48c"],["teal","#008080"],["thistle","#d8bfd8"],["tomato","#ff6347"],["turquoise","#40e0d0"],["violet","#ee82ee"],["wheat","#f5deb3"],["white","#ffffff"],["whitesmoke","#f5f5f5"],["yellow","#ffff00"],["yellowgreen","#9acd32"]]),C=/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})?$/i,$=/^#([\dA-F])([\dA-F])([\dA-F])([\dA-F])?$/i,M=/^rgba?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,D=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,k=()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),y=/\s+/g,g=e=>{h.has(e)&&(e=h.get(e));let n=C.exec(e);if(n)return [Number.parseInt(n[1],16),Number.parseInt(n[2],16),Number.parseInt(n[3],16)];let t=$.exec(e);if(t)return [Number.parseInt(`${t[1]}${t[1]}`,16),Number.parseInt(`${t[2]}${t[2]}`,16),Number.parseInt(`${t[3]}${t[3]}`,16)];let l=M.exec(e);if(l)return [Math.round(Math.max(0,Math.min(255,Number(l[1])))),Math.round(Math.max(0,Math.min(255,Number(l[2])))),Math.round(Math.max(0,Math.min(255,Number(l[3]))))];let f=D.exec(e);if(f){let o=Number(f[1])%360;o<0&&(o+=360);let i=Math.max(0,Math.min(100,Number(f[2])))/100,a=Math.max(0,Math.min(100,Number(f[3])))/100,c=(1-Math.abs(2*a-1))*i,d=c*(1-Math.abs(o/60%2-1)),r=a-c/2,u,s,b;return o<60?{0:u,1:s,2:b}=[c,d,0]:o<120?{0:u,1:s,2:b}=[d,c,0]:o<180?{0:u,1:s,2:b}=[0,c,d]:o<240?{0:u,1:s,2:b}=[0,d,c]:o<300?{0:u,1:s,2:b}=[d,0,c]:{0:u,1:s,2:b}=[c,0,d],[Math.round((u+r)*255),Math.round((s+r)*255),Math.round((b+r)*255)]}return null},m=(e,n)=>e?.[0]===n?.[0]&&e?.[1]===n?.[1]&&e?.[2]===n?.[2],p=e=>{let n=k(),t=[],l=!1,f=null,o=0,i="";for(let a of e){if(a==="(")o++;else if(o>0)a===")"&&o--;else if(l){if(a===";"){let c=i.trim();c!==""&&t.push([f,c]),f=null,i="",l=!1;continue}}else if(a===":"){f=i.trim(),i="",l=!0;continue}i+=a;}if(l&&o===0){let a=i.trim();a!==""&&t.push([f,a]),f=null,i="";}for(let{0:a,1:c}of t)switch(a){case"background-color":{c!=null&&(n.backgroundColor=c);break}case"color":{c!=null&&(n.color=c);break}case"font-weight":{c==="bold"&&(n.fontWeight=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(n.fontStyle="italic");break}case"text-decoration-line":{n.textDecorationLine=[];let d=c.split(y);for(let r of d)["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);break}case"text-decoration-color":{let d=g(c);d!=null&&(n.textDecorationColor=d);break}case"text-decoration":{n.textDecorationColor=null,n.textDecorationLine=[];let d=c.split(y);for(let r of d){let u=g(r);u!=null?n.textDecorationColor=u:["line-through","overline","underline"].includes(r)&&n.textDecorationLine.push(r);}break}}return n},w=(e,n=null)=>{n=n??k();let t="";if(!m(e.backgroundColor,n.backgroundColor))if(e.backgroundColor==null)t+="\x1B[49m";else switch(e.backgroundColor){case"black":{t+="\x1B[40m";break}case"red":{t+="\x1B[41m";break}case"green":{t+="\x1B[42m";break}case"yellow":{t+="\x1B[43m";break}case"blue":{t+="\x1B[44m";break}case"magenta":{t+="\x1B[45m";break}case"cyan":{t+="\x1B[46m";break}case"white":{t+="\x1B[47m";break}default:if(Array.isArray(e.backgroundColor)){let{0:l,1:f,2:o}=e.backgroundColor;t+=`\x1B[48;2;${l};${f};${o}m`;}else {let l=g(e.backgroundColor);if(l===null)t+="\x1B[49m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[48;2;${f};${o};${i}m`;}}}if(!m(e.color,n.color))if(e.color==null)t+="\x1B[39m";else switch(e.color){case"black":{t+="\x1B[30m";break}case"red":{t+="\x1B[31m";break}case"green":{t+="\x1B[32m";break}case"yellow":{t+="\x1B[33m";break}case"blue":{t+="\x1B[34m";break}case"magenta":{t+="\x1B[35m";break}case"cyan":{t+="\x1B[36m";break}case"white":{t+="\x1B[37m";break}default:if(Array.isArray(e.color)){let{0:l,1:f,2:o}=e.color;t+=`\x1B[38;2;${l};${f};${o}m`;}else {let l=g(e.color);if(l===null)t+="\x1B[39m";else {let{0:f,1:o,2:i}=l;t+=`\x1B[38;2;${f};${o};${i}m`;}}}if(e.fontWeight!==n.fontWeight&&(t+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==n.fontStyle&&(t+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!m(e.textDecorationColor,n.textDecorationColor))if(e.textDecorationColor==null)t+="\x1B[59m";else {let{0:l,1:f,2:o}=e.textDecorationColor;t+=`\x1B[58;2;${l};${f};${o}m`;}return e.textDecorationLine.includes("line-through")!==n.textDecorationLine.includes("line-through")&&(t+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==n.textDecorationLine.includes("overline")&&(t+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==n.textDecorationLine.includes("underline")&&(t+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),t};var N=e=>{try{return JSON.stringify(e)}catch{return '"[Circular]"'}},A="%".codePointAt(0),F="s".codePointAt(0),P="d".codePointAt(0),_="f".codePointAt(0),R="i".codePointAt(0),L="O".codePointAt(0),O="o".codePointAt(0),T="j".codePointAt(0),j="c".codePointAt(0),E=(e,n=[],t={})=>{if(typeof e!="string"&&typeof e!="object"||e===null)throw new TypeError(`fmt must be a string or object, got ${e===null?"null":typeof e}`);let l=t.stringify??N,f=1;if(typeof e=="object"){let r=n.length+f;if(r===1)return "{}";let u=Array.from({length:r});u[0]=l(e);for(let s=1;s<r;s++)u[s]=l(n[s-f]);return u.join(" ")}if(n.length===0)return e;let o="",i=1-f,a=-1,c=!1,d=null;for(let r=0;r<e.length;){if(e.codePointAt(r)===A&&r+1<e.length){a=a>-1?a:0;let u=e.codePointAt(r+1);if(u===void 0){++i;break}switch(u){case P:case _:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Number(n[i]).toString(),a=r+2,r++;break}case R:{if(i>=n.length||n[i]==null)break;a<r&&(o+=e.slice(a,r)),o+=Math.floor(Number(n[i])).toString(),a=r+2,r++;break}case L:case O:case T:{if(i>=n.length||n[i]===void 0)break;a<r&&(o+=e.slice(a,r));let s=n[i],b=typeof s;if(b==="string"){o+=`'${s}'`,a=r+2;break}if(b==="function"){o+=s.name?`[Function: ${s.name}]`:"[Function: <anonymous>]",a=r+2;break}o+=l(s),a=r+2,r++;break}case F:{if(i>=n.length)break;a<r&&(o+=e.slice(a,r)),o+=typeof n[i]=="object"?l(n[i]):String(n[i]),a=r+2,r++;break}case A:{a<r&&(o+=e.slice(a,r)),o+="%",a=r+2,r++,i--;break}case j:{if(typeof window>"u"){let s=p(n[i]);a<r&&(o+=e.slice(a,r)),o+=w(s,d),o!==""&&(c=!0,d=s);}a=r+2,r++;break}default:typeof t.formatters?.[u]=="function"&&(a<r&&(o+=e.slice(a,r)),o+=t.formatters[u](n[i]),a=r+2,r++);}++i;}++r;}return a===-1?e:(a<e.length&&(o+=e.slice(a)),c&&(o+="\x1B[0m"),o)},S=(e={})=>{let n={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([t,l])=>{if(t.length===0)throw new Error(`Formatter %${t} has no characters`);if(t.length>1)throw new Error(`Formatter %${t} has more than one character`);if(typeof l!="function")throw new TypeError(`Formatter for %${t} is not a function`);let f=t.codePointAt(0);if(f===void 0)throw new Error(`${t}.codePointAt(0) failed to return a value, please report this issue`);n[f]=l;}),(t,l=[],f={})=>E(t,l,{...f,formatters:n})};
2
2
 
3
3
  export { S as build, E as format };
4
4
  //# sourceMappingURL=out.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/inspect-colors.ts","../src/index.ts"],"names":["colorKeywords","HASH_PATTERN","SMALL_HASH_PATTERN","RGB_PATTERN","HSL_PATTERN","getDefaultCss","SPACE_PATTERN","parseCssColor","colorString","hashMatch","smallHashMatch","rgbMatch","hslMatch","h","s","l","x","m","r_","g_","b_","colorEquals","color1","color2","parseCss","cssString","css","rawEntries","inValue","currentKey","parenthesesDepth","currentPart","c","value","key","lineTypes","lineType","color","arguments_","argument","maybeColor","cssToAnsi","previousCss","ansi","r","g","b","parsed","tryStringify","o","CHAR_PERCENT","CHAR_s","CHAR_d","CHAR_f","CHAR_i","CHAR_O","CHAR_o","CHAR_j","CHAR_c","format","fmt","options","stringify","offset","argumentsLength","objects","index","result","a","lastPosition","usedStyle","temporaryArgument","type","build","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,KACXG,EAAY,GACZ5B,EAAchB,EAEtB,CAEA2C,EAAeH,EAAQ,EAEvBA,IAEA,KACJ,CACJ,CAGI,OAAOL,EAAQ,aAAa7B,CAAC,GAAM,aAEnCmC,GAAWN,EAAQ,WAAW7B,CAAC,EAAwBM,EAAW8B,CAA4B,CAAC,EAC/FC,EAAeH,EAAQ,GAG3B,EAAEE,CACN,CAEA,EAAEF,CACN,CAEA,OAAIG,IAAiB,GACVT,GAGPS,EAAeT,EAAI,SACnBO,GAAUP,EAAI,MAAMS,CAAY,GAGhCC,IACAH,GAAU,WAGPA,EACX,EAEaM,EAAQ,CACjBZ,EAAmB,CAAC,IAE0G,CAC9H,IAAMa,EAA2B,CAAC,EAElC,OAAI,OAAOb,EAAQ,YAAe,UAC9B,OAAO,QAAQA,EAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC3B,EAAKyC,CAAiB,IAAM,CACrE,GAAIzC,EAAI,SAAW,EACf,MAAM,IAAI,MAAM,cAAcA,CAAG,oBAAoB,EAGzD,GAAIA,EAAI,OAAS,EACb,MAAM,IAAI,MAAM,cAAcA,CAAG,8BAA8B,EAGnE,GAAI,OAAOyC,GAAsB,WAC7B,MAAM,IAAI,UAAU,kBAAkBzC,CAAG,oBAAoB,EAGjE,IAAMF,EAAIE,EAAI,YAAY,CAAC,EAE3B,GAAIF,IAAM,OACN,MAAM,IAAI,MAAM,GAAGE,CAAG,oEAAoE,EAI9FwC,EAAW1C,CAAC,EAAI2C,CACpB,CAAC,EAIE,CAACC,EAA8CtC,EAAoB,CAAC,EAAGuC,EAA6C,CAAC,IACxHlB,EAAOiB,EAAGtC,EAAY,CAAE,GAAGuC,EAAe,WAAAH,CAAW,CAAC,CAC9D","sourcesContent":["type CssObject = {\n __proto__: null;\n backgroundColor: string | null;\n color: string | null;\n fontStyle: string | null;\n fontWeight: string | null;\n textDecorationColor: [number, number, number] | null;\n textDecorationLine: string[];\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2575\nconst colorKeywords: Map<string, string> = new Map<string, string>([\n [\"aliceblue\", \"#f0f8ff\"],\n [\"antiquewhite\", \"#faebd7\"],\n [\"aqua\", \"#00ffff\"],\n [\"aquamarine\", \"#7fffd4\"],\n [\"azure\", \"#f0ffff\"],\n [\"beige\", \"#f5f5dc\"],\n [\"bisque\", \"#ffe4c4\"],\n [\"black\", \"#000000\"],\n [\"blanchedalmond\", \"#ffebcd\"],\n [\"blue\", \"#0000ff\"],\n [\"blueviolet\", \"#8a2be2\"],\n [\"brown\", \"#a52a2a\"],\n [\"burlywood\", \"#deb887\"],\n [\"cadetblue\", \"#5f9ea0\"],\n [\"chartreuse\", \"#7fff00\"],\n [\"chocolate\", \"#d2691e\"],\n [\"coral\", \"#ff7f50\"],\n [\"cornflowerblue\", \"#6495ed\"],\n [\"cornsilk\", \"#fff8dc\"],\n [\"crimson\", \"#dc143c\"],\n [\"cyan\", \"#00ffff\"],\n [\"darkblue\", \"#00008b\"],\n [\"darkcyan\", \"#008b8b\"],\n [\"darkgoldenrod\", \"#b8860b\"],\n [\"darkgray\", \"#a9a9a9\"],\n [\"darkgreen\", \"#006400\"],\n [\"darkgrey\", \"#a9a9a9\"],\n [\"darkkhaki\", \"#bdb76b\"],\n [\"darkmagenta\", \"#8b008b\"],\n [\"darkolivegreen\", \"#556b2f\"],\n [\"darkorange\", \"#ff8c00\"],\n [\"darkorchid\", \"#9932cc\"],\n [\"darkred\", \"#8b0000\"],\n [\"darksalmon\", \"#e9967a\"],\n [\"darkseagreen\", \"#8fbc8f\"],\n [\"darkslateblue\", \"#483d8b\"],\n [\"darkslategray\", \"#2f4f4f\"],\n [\"darkslategrey\", \"#2f4f4f\"],\n [\"darkturquoise\", \"#00ced1\"],\n [\"darkviolet\", \"#9400d3\"],\n [\"deeppink\", \"#ff1493\"],\n [\"deepskyblue\", \"#00bfff\"],\n [\"dimgray\", \"#696969\"],\n [\"dimgrey\", \"#696969\"],\n [\"dodgerblue\", \"#1e90ff\"],\n [\"firebrick\", \"#b22222\"],\n [\"floralwhite\", \"#fffaf0\"],\n [\"forestgreen\", \"#228b22\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"gainsboro\", \"#dcdcdc\"],\n [\"ghostwhite\", \"#f8f8ff\"],\n [\"gold\", \"#ffd700\"],\n [\"goldenrod\", \"#daa520\"],\n [\"gray\", \"#808080\"],\n [\"green\", \"#008000\"],\n [\"greenyellow\", \"#adff2f\"],\n [\"grey\", \"#808080\"],\n [\"honeydew\", \"#f0fff0\"],\n [\"hotpink\", \"#ff69b4\"],\n [\"indianred\", \"#cd5c5c\"],\n [\"indigo\", \"#4b0082\"],\n [\"ivory\", \"#fffff0\"],\n [\"khaki\", \"#f0e68c\"],\n [\"lavender\", \"#e6e6fa\"],\n [\"lavenderblush\", \"#fff0f5\"],\n [\"lawngreen\", \"#7cfc00\"],\n [\"lemonchiffon\", \"#fffacd\"],\n [\"lightblue\", \"#add8e6\"],\n [\"lightcoral\", \"#f08080\"],\n [\"lightcyan\", \"#e0ffff\"],\n [\"lightgoldenrodyellow\", \"#fafad2\"],\n [\"lightgray\", \"#d3d3d3\"],\n [\"lightgreen\", \"#90ee90\"],\n [\"lightgrey\", \"#d3d3d3\"],\n [\"lightpink\", \"#ffb6c1\"],\n [\"lightsalmon\", \"#ffa07a\"],\n [\"lightseagreen\", \"#20b2aa\"],\n [\"lightskyblue\", \"#87cefa\"],\n [\"lightslategray\", \"#778899\"],\n [\"lightslategrey\", \"#778899\"],\n [\"lightsteelblue\", \"#b0c4de\"],\n [\"lightyellow\", \"#ffffe0\"],\n [\"lime\", \"#00ff00\"],\n [\"limegreen\", \"#32cd32\"],\n [\"linen\", \"#faf0e6\"],\n [\"magenta\", \"#ff00ff\"],\n [\"maroon\", \"#800000\"],\n [\"mediumaquamarine\", \"#66cdaa\"],\n [\"mediumblue\", \"#0000cd\"],\n [\"mediumorchid\", \"#ba55d3\"],\n [\"mediumpurple\", \"#9370db\"],\n [\"mediumseagreen\", \"#3cb371\"],\n [\"mediumslateblue\", \"#7b68ee\"],\n [\"mediumspringgreen\", \"#00fa9a\"],\n [\"mediumturquoise\", \"#48d1cc\"],\n [\"mediumvioletred\", \"#c71585\"],\n [\"midnightblue\", \"#191970\"],\n [\"mintcream\", \"#f5fffa\"],\n [\"mistyrose\", \"#ffe4e1\"],\n [\"moccasin\", \"#ffe4b5\"],\n [\"navajowhite\", \"#ffdead\"],\n [\"navy\", \"#000080\"],\n [\"oldlace\", \"#fdf5e6\"],\n [\"olive\", \"#808000\"],\n [\"olivedrab\", \"#6b8e23\"],\n [\"orange\", \"#ffa500\"],\n [\"orangered\", \"#ff4500\"],\n [\"orchid\", \"#da70d6\"],\n [\"palegoldenrod\", \"#eee8aa\"],\n [\"palegreen\", \"#98fb98\"],\n [\"paleturquoise\", \"#afeeee\"],\n [\"palevioletred\", \"#db7093\"],\n [\"papayawhip\", \"#ffefd5\"],\n [\"peachpuff\", \"#ffdab9\"],\n [\"peru\", \"#cd853f\"],\n [\"pink\", \"#ffc0cb\"],\n [\"plum\", \"#dda0dd\"],\n [\"powderblue\", \"#b0e0e6\"],\n [\"purple\", \"#800080\"],\n [\"rebeccapurple\", \"#663399\"],\n [\"red\", \"#ff0000\"],\n [\"rosybrown\", \"#bc8f8f\"],\n [\"royalblue\", \"#4169e1\"],\n [\"saddlebrown\", \"#8b4513\"],\n [\"salmon\", \"#fa8072\"],\n [\"sandybrown\", \"#f4a460\"],\n [\"seagreen\", \"#2e8b57\"],\n [\"seashell\", \"#fff5ee\"],\n [\"sienna\", \"#a0522d\"],\n [\"silver\", \"#c0c0c0\"],\n [\"skyblue\", \"#87ceeb\"],\n [\"slateblue\", \"#6a5acd\"],\n [\"slategray\", \"#708090\"],\n [\"slategrey\", \"#708090\"],\n [\"snow\", \"#fffafa\"],\n [\"springgreen\", \"#00ff7f\"],\n [\"steelblue\", \"#4682b4\"],\n [\"tan\", \"#d2b48c\"],\n [\"teal\", \"#008080\"],\n [\"thistle\", \"#d8bfd8\"],\n [\"tomato\", \"#ff6347\"],\n [\"turquoise\", \"#40e0d0\"],\n [\"violet\", \"#ee82ee\"],\n [\"wheat\", \"#f5deb3\"],\n [\"white\", \"#ffffff\"],\n [\"whitesmoke\", \"#f5f5f5\"],\n [\"yellow\", \"#ffff00\"],\n [\"yellowgreen\", \"#9acd32\"],\n]);\n\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\nconst HASH_PATTERN = /^#([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})?$/i;\n// eslint-disable-next-line regexp/optimal-quantifier-concatenation,regexp/no-unused-capturing-group\nconst SMALL_HASH_PATTERN = /^#([\\dA-F])([\\dA-F])([\\dA-F])([\\dA-F])?$/i;\nconst RGB_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^rgba?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\nconst HSL_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^hsla?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\n\nconst getDefaultCss = (): CssObject => {\n return {\n __proto__: null,\n backgroundColor: null,\n color: null,\n fontStyle: null,\n fontWeight: null,\n textDecorationColor: null,\n textDecorationLine: [],\n };\n};\n\n// eslint-disable-next-line regexp/no-useless-flag\nconst SPACE_PATTERN = /\\s+/g;\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2739\nconst parseCssColor = (colorString: string): [number, number, number] | null => {\n if (colorKeywords.has(colorString)) {\n // eslint-disable-next-line no-param-reassign\n colorString = colorKeywords.get(colorString) as string;\n }\n\n const hashMatch = HASH_PATTERN.exec(colorString);\n\n if (hashMatch) {\n return [Number.parseInt(hashMatch[1] as string, 16), Number.parseInt(hashMatch[2] as string, 16), Number.parseInt(hashMatch[3] as string, 16)];\n }\n\n const smallHashMatch = SMALL_HASH_PATTERN.exec(colorString);\n\n if (smallHashMatch) {\n return [\n Number.parseInt(`${smallHashMatch[1]}${smallHashMatch[1]}`, 16),\n Number.parseInt(`${smallHashMatch[2]}${smallHashMatch[2]}`, 16),\n Number.parseInt(`${smallHashMatch[3]}${smallHashMatch[3]}`, 16),\n ];\n }\n\n const rgbMatch = RGB_PATTERN.exec(colorString);\n\n if (rgbMatch) {\n return [\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[1])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[2])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[3])))),\n ];\n }\n\n const hslMatch = HSL_PATTERN.exec(colorString);\n\n if (hslMatch) {\n // https://www.rapidtables.com/convert/color/hsl-to-rgb.html\n let h = Number(hslMatch[1]) % 360;\n if (h < 0) {\n h += 360;\n }\n const s = Math.max(0, Math.min(100, Number(hslMatch[2]))) / 100;\n const l = Math.max(0, Math.min(100, Number(hslMatch[3]))) / 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let r_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let g_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let b_: number;\n\n if (h < 60) {\n ({ 0: r_, 1: g_, 2: b_ } = [c, x, 0]);\n } else if (h < 120) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, c, 0]);\n } else if (h < 180) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, c, x]);\n } else if (h < 240) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, x, c]);\n } else if (h < 300) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, 0, c]);\n } else {\n ({ 0: r_, 1: g_, 2: b_ } = [c, 0, x]);\n }\n\n return [Math.round((r_ + m) * 255), Math.round((g_ + m) * 255), Math.round((b_ + m) * 255)];\n }\n\n return null;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2928\nconst colorEquals = (color1: string | [number, number, number] | null, color2: string | [number, number, number] | null) =>\n color1?.[0] === color2?.[0] && color1?.[1] === color2?.[1] && color1?.[2] === color2?.[2];\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2821\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const parseCss = (cssString: string): CssObject => {\n const css = getDefaultCss();\n\n const rawEntries = [];\n\n let inValue = false;\n let currentKey = null;\n let parenthesesDepth = 0;\n let currentPart = \"\";\n\n // eslint-disable-next-line no-restricted-syntax\n for (const c of cssString) {\n if (c === \"(\") {\n parenthesesDepth++;\n } else if (parenthesesDepth > 0) {\n if (c === \")\") {\n parenthesesDepth--;\n }\n } else if (inValue) {\n if (c === \";\") {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n inValue = false;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n } else if (c === \":\") {\n currentKey = currentPart.trim();\n currentPart = \"\";\n inValue = true;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPart += c;\n }\n\n if (inValue && parenthesesDepth === 0) {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const { 0: key, 1: value } of rawEntries) {\n switch (key) {\n case \"background-color\": {\n if (value != null) {\n css.backgroundColor = value;\n }\n\n break;\n }\n case \"color\": {\n if (value != null) {\n css.color = value;\n }\n\n break;\n }\n case \"font-weight\": {\n if (value === \"bold\") {\n css.fontWeight = value;\n }\n\n break;\n }\n case \"font-style\": {\n if ([\"italic\", \"oblique\", \"oblique 14deg\"].includes(value as string)) {\n css.fontStyle = \"italic\";\n }\n\n break;\n }\n case \"text-decoration-line\": {\n css.textDecorationLine = [];\n const lineTypes = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const lineType of lineTypes) {\n if ([\"line-through\", \"overline\", \"underline\"].includes(lineType)) {\n css.textDecorationLine.push(lineType);\n }\n }\n\n break;\n }\n case \"text-decoration-color\": {\n const color = parseCssColor(value as string);\n\n if (color != null) {\n css.textDecorationColor = color;\n }\n\n break;\n }\n case \"text-decoration\": {\n css.textDecorationColor = null;\n css.textDecorationLine = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n const arguments_ = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const argument of arguments_) {\n const maybeColor = parseCssColor(argument);\n if (maybeColor != null) {\n css.textDecorationColor = maybeColor;\n } else if ([\"line-through\", \"overline\", \"underline\"].includes(argument)) {\n css.textDecorationLine.push(argument);\n }\n }\n\n break;\n }\n default:\n // empty\n }\n }\n\n return css;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2933\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const cssToAnsi = (css: CssObject, previousCss: CssObject | null = null): string => {\n // eslint-disable-next-line no-param-reassign\n previousCss = previousCss ?? getDefaultCss();\n\n let ansi = \"\";\n\n if (!colorEquals(css.backgroundColor, previousCss.backgroundColor)) {\n if (css.backgroundColor == null) {\n ansi += \"\\u001B[49m\";\n } else\n switch (css.backgroundColor) {\n case \"black\": {\n ansi += \"\\u001B[40m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[41m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[42m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[43m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[44m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[45m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[46m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[47m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.backgroundColor)) {\n const { 0: r, 1: g, 2: b } = css.backgroundColor;\n\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.backgroundColor);\n\n if (parsed === null) {\n ansi += \"\\u001B[49m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n if (!colorEquals(css.color, previousCss.color)) {\n if (css.color == null) {\n ansi += \"\\u001B[39m\";\n } else\n switch (css.color) {\n case \"black\": {\n ansi += \"\\u001B[30m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[31m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[32m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[33m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[34m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[35m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[36m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[37m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.color)) {\n const { 0: r, 1: g, 2: b } = css.color;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.color);\n\n if (parsed === null) {\n ansi += \"\\u001B[39m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n\n if (css.fontWeight !== previousCss.fontWeight) {\n ansi += css.fontWeight === \"bold\" ? \"\\u001B[1m\" : \"\\u001B[22m\";\n }\n\n if (css.fontStyle !== previousCss.fontStyle) {\n ansi += css.fontStyle === \"italic\" ? \"\\u001B[3m\" : \"\\u001B[23m\";\n }\n\n if (!colorEquals(css.textDecorationColor, previousCss.textDecorationColor)) {\n if (css.textDecorationColor == null) {\n ansi += \"\\u001B[59m\";\n } else {\n const { 0: r, 1: g, 2: b } = css.textDecorationColor;\n ansi += `\\u001B[58;2;${r};${g};${b}m`;\n }\n }\n\n if (css.textDecorationLine.includes(\"line-through\") !== previousCss.textDecorationLine.includes(\"line-through\")) {\n ansi += css.textDecorationLine.includes(\"line-through\") ? \"\\u001B[9m\" : \"\\u001B[29m\";\n }\n\n if (css.textDecorationLine.includes(\"overline\") !== previousCss.textDecorationLine.includes(\"overline\")) {\n ansi += css.textDecorationLine.includes(\"overline\") ? \"\\u001B[53m\" : \"\\u001B[55m\";\n }\n\n if (css.textDecorationLine.includes(\"underline\") !== previousCss.textDecorationLine.includes(\"underline\")) {\n ansi += css.textDecorationLine.includes(\"underline\") ? \"\\u001B[4m\" : \"\\u001B[24m\";\n }\n\n return ansi;\n};\n","import { cssToAnsi, parseCss } from \"./inspect-colors\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst tryStringify = (o: any): string => {\n try {\n return JSON.stringify(o);\n } catch {\n return '\"[Circular]\"';\n }\n};\n\nconst CHAR_PERCENT = \"%\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_s = \"s\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_d = \"d\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_f = \"f\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_i = \"i\".codePointAt(0);\nconst CHAR_O = \"O\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_o = \"o\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_j = \"j\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_c = \"c\".codePointAt(0);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,sonarjs/cognitive-complexity\nexport const format = (fmt: Record<string, any> | string, arguments_: any[] = [], options: Options = {}): string => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if ((typeof fmt !== \"string\" && typeof fmt !== \"object\") || fmt === null) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n throw new TypeError(`fmt must be a string or object, got ${fmt === null ? \"null\" : typeof fmt}`);\n }\n\n const stringify = options.stringify ?? tryStringify;\n const offset = 1;\n\n if (typeof fmt === \"object\") {\n const argumentsLength = arguments_.length + offset;\n\n if (argumentsLength === 1) {\n return \"{}\";\n }\n\n const objects = Array.from({ length: argumentsLength });\n\n objects[0] = stringify(fmt);\n\n for (let index = 1; index < argumentsLength; index++) {\n // eslint-disable-next-line security/detect-object-injection\n objects[index] = stringify(arguments_[index - offset]);\n }\n\n return objects.join(\" \");\n }\n\n if (arguments_.length === 0) {\n return fmt;\n }\n\n let result = \"\";\n let a = 1 - offset;\n let lastPosition = -1;\n\n let usedStyle = false;\n let previousCss = null;\n\n for (let index = 0; index < fmt.length; ) {\n if (fmt.codePointAt(index) === CHAR_PERCENT && index + 1 < fmt.length) {\n lastPosition = lastPosition > -1 ? lastPosition : 0;\n\n const c = fmt.codePointAt(index + 1);\n\n if (c === undefined) {\n ++a;\n break;\n }\n\n // eslint-disable-next-line default-case\n switch (c) {\n case CHAR_d:\n case CHAR_f: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Number(arguments_[a as keyof typeof arguments_]).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_i: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Math.floor(Number(arguments_[a as keyof typeof arguments_])).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_O:\n case CHAR_o:\n case CHAR_j: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] === undefined) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const temporaryArgument = arguments_[a as keyof typeof arguments_];\n const type = typeof temporaryArgument;\n\n if (type === \"string\") {\n result += `'${temporaryArgument}'`;\n lastPosition = index + 2;\n break;\n }\n\n if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/ban-types\n result += (temporaryArgument as Function).name ? `[Function: ${(temporaryArgument as Function).name}]` : \"[Function: <anonymous>]\";\n lastPosition = index + 2;\n break;\n }\n\n result += stringify(temporaryArgument);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_s: {\n if (a >= arguments_.length) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result +=\n typeof arguments_[a as keyof typeof arguments_] === \"object\"\n ? stringify(arguments_[a as keyof typeof arguments_])\n : String(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_PERCENT: {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += \"%\";\n lastPosition = index + 2;\n\n index++;\n a--;\n break;\n }\n case CHAR_c: {\n // Inspired by Deno's handling of '%c'.\n // eslint-disable-next-line no-secrets/no-secrets\n // https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L3115\n if (typeof window === \"undefined\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const css = parseCss(arguments_[a as keyof typeof arguments_]);\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += cssToAnsi(css, previousCss);\n\n if (result !== \"\") {\n usedStyle = true;\n previousCss = css;\n }\n }\n\n lastPosition = index + 2;\n\n index++;\n\n break;\n }\n }\n\n // eslint-disable-next-line security/detect-object-injection\n if (typeof options.formatters?.[c] === \"function\") {\n // eslint-disable-next-line security/detect-object-injection\n result += (options.formatters[c] as FormatterFunction)(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n }\n\n ++a;\n }\n\n ++index;\n }\n\n if (lastPosition === -1) {\n return fmt;\n }\n\n if (lastPosition < fmt.length) {\n result += fmt.slice(lastPosition);\n }\n\n if (usedStyle) {\n result += \"\\u001B[0m\";\n }\n\n return result;\n};\n\nexport const build = (\n options: Options = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ((f: NonNullable<Record<string, any> | string>, arguments_?: any[], formatOptions?: Omit<Options, \"formatters\">) => string) => {\n const formatters: FormatterMap = {};\n\n if (typeof options.formatters === \"object\") {\n Object.entries(options.formatters).forEach(([key, formatterFunction]) => {\n if (key.length === 0) {\n throw new Error(`Formatter %${key} has no characters`);\n }\n\n if (key.length > 1) {\n throw new Error(`Formatter %${key} has more than one character`);\n }\n\n if (typeof formatterFunction !== \"function\") {\n throw new TypeError(`Formatter for %${key} is not a function`);\n }\n\n const c = key.codePointAt(0);\n\n if (c === undefined) {\n throw new Error(`${key}.codePointAt(0) failed to return a value, please report this issue`);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n formatters[c] = formatterFunction;\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (f: NonNullable<Record<string, any> | string>, arguments_: any[] = [], formatOptions: Omit<Options, \"formatters\"> = {}) =>\n format(f, arguments_, { ...formatOptions, formatters });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormatterFunction = (argument: any) => string;\nexport type FormatterMap = Record<number, FormatterFunction>;\n\nexport interface Options {\n formatters?: Record<string, FormatterFunction>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stringify?: (o: any) => string;\n}\n"]}
1
+ {"version":3,"sources":["../src/inspect-colors.ts","../src/index.ts"],"names":["colorKeywords","HASH_PATTERN","SMALL_HASH_PATTERN","RGB_PATTERN","HSL_PATTERN","getDefaultCss","SPACE_PATTERN","parseCssColor","colorString","hashMatch","smallHashMatch","rgbMatch","hslMatch","h","s","l","x","m","r_","g_","b_","colorEquals","color1","color2","parseCss","cssString","css","rawEntries","inValue","currentKey","parenthesesDepth","currentPart","c","value","key","lineTypes","lineType","color","arguments_","argument","maybeColor","cssToAnsi","previousCss","ansi","r","g","b","parsed","tryStringify","o","CHAR_PERCENT","CHAR_s","CHAR_d","CHAR_f","CHAR_i","CHAR_O","CHAR_o","CHAR_j","CHAR_c","format","fmt","options","stringify","offset","argumentsLength","objects","index","result","a","lastPosition","usedStyle","temporaryArgument","type","build","formatters","formatterFunction","f","formatOptions"],"mappings":"AAaA,IAAMA,EAAqC,IAAI,IAAoB,CAC/D,CAAC,YAAa,SAAS,EACvB,CAAC,eAAgB,SAAS,EAC1B,CAAC,OAAQ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C,EAAeH,IACfC,GAAUP,EAAI,MAAMS,EAAcH,CAAK,GAI3CC,GAAWN,EAAQ,WAAW7B,CAAC,EAAwBM,EAAW8B,CAA4B,CAAC,EAE/FC,EAAeH,EAAQ,EAEvBA,IAGZ,CAEA,EAAEE,CACN,CAEA,EAAEF,CACN,CAEA,OAAIG,IAAiB,GACVT,GAGPS,EAAeT,EAAI,SACnBO,GAAUP,EAAI,MAAMS,CAAY,GAGhCC,IACAH,GAAU,WAGPA,EACX,EAEaM,EAAQ,CACjBZ,EAAmB,CAAC,IAE0G,CAC9H,IAAMa,EAA2B,CAAC,EAElC,OAAI,OAAOb,EAAQ,YAAe,UAC9B,OAAO,QAAQA,EAAQ,UAAU,EAAE,QAAQ,CAAC,CAAC3B,EAAKyC,CAAiB,IAAM,CACrE,GAAIzC,EAAI,SAAW,EACf,MAAM,IAAI,MAAM,cAAcA,CAAG,oBAAoB,EAGzD,GAAIA,EAAI,OAAS,EACb,MAAM,IAAI,MAAM,cAAcA,CAAG,8BAA8B,EAGnE,GAAI,OAAOyC,GAAsB,WAC7B,MAAM,IAAI,UAAU,kBAAkBzC,CAAG,oBAAoB,EAGjE,IAAMF,EAAIE,EAAI,YAAY,CAAC,EAE3B,GAAIF,IAAM,OACN,MAAM,IAAI,MAAM,GAAGE,CAAG,oEAAoE,EAI9FwC,EAAW1C,CAAC,EAAI2C,CACpB,CAAC,EAIE,CAACC,EAA8CtC,EAAoB,CAAC,EAAGuC,EAA6C,CAAC,IACxHlB,EAAOiB,EAAGtC,EAAY,CAAE,GAAGuC,EAAe,WAAAH,CAAW,CAAC,CAC9D","sourcesContent":["type CssObject = {\n __proto__: null;\n backgroundColor: string | null;\n color: string | null;\n fontStyle: string | null;\n fontWeight: string | null;\n textDecorationColor: [number, number, number] | null;\n textDecorationLine: string[];\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2575\nconst colorKeywords: Map<string, string> = new Map<string, string>([\n [\"aliceblue\", \"#f0f8ff\"],\n [\"antiquewhite\", \"#faebd7\"],\n [\"aqua\", \"#00ffff\"],\n [\"aquamarine\", \"#7fffd4\"],\n [\"azure\", \"#f0ffff\"],\n [\"beige\", \"#f5f5dc\"],\n [\"bisque\", \"#ffe4c4\"],\n [\"black\", \"#000000\"],\n [\"blanchedalmond\", \"#ffebcd\"],\n [\"blue\", \"#0000ff\"],\n [\"blueviolet\", \"#8a2be2\"],\n [\"brown\", \"#a52a2a\"],\n [\"burlywood\", \"#deb887\"],\n [\"cadetblue\", \"#5f9ea0\"],\n [\"chartreuse\", \"#7fff00\"],\n [\"chocolate\", \"#d2691e\"],\n [\"coral\", \"#ff7f50\"],\n [\"cornflowerblue\", \"#6495ed\"],\n [\"cornsilk\", \"#fff8dc\"],\n [\"crimson\", \"#dc143c\"],\n [\"cyan\", \"#00ffff\"],\n [\"darkblue\", \"#00008b\"],\n [\"darkcyan\", \"#008b8b\"],\n [\"darkgoldenrod\", \"#b8860b\"],\n [\"darkgray\", \"#a9a9a9\"],\n [\"darkgreen\", \"#006400\"],\n [\"darkgrey\", \"#a9a9a9\"],\n [\"darkkhaki\", \"#bdb76b\"],\n [\"darkmagenta\", \"#8b008b\"],\n [\"darkolivegreen\", \"#556b2f\"],\n [\"darkorange\", \"#ff8c00\"],\n [\"darkorchid\", \"#9932cc\"],\n [\"darkred\", \"#8b0000\"],\n [\"darksalmon\", \"#e9967a\"],\n [\"darkseagreen\", \"#8fbc8f\"],\n [\"darkslateblue\", \"#483d8b\"],\n [\"darkslategray\", \"#2f4f4f\"],\n [\"darkslategrey\", \"#2f4f4f\"],\n [\"darkturquoise\", \"#00ced1\"],\n [\"darkviolet\", \"#9400d3\"],\n [\"deeppink\", \"#ff1493\"],\n [\"deepskyblue\", \"#00bfff\"],\n [\"dimgray\", \"#696969\"],\n [\"dimgrey\", \"#696969\"],\n [\"dodgerblue\", \"#1e90ff\"],\n [\"firebrick\", \"#b22222\"],\n [\"floralwhite\", \"#fffaf0\"],\n [\"forestgreen\", \"#228b22\"],\n [\"fuchsia\", \"#ff00ff\"],\n [\"gainsboro\", \"#dcdcdc\"],\n [\"ghostwhite\", \"#f8f8ff\"],\n [\"gold\", \"#ffd700\"],\n [\"goldenrod\", \"#daa520\"],\n [\"gray\", \"#808080\"],\n [\"green\", \"#008000\"],\n [\"greenyellow\", \"#adff2f\"],\n [\"grey\", \"#808080\"],\n [\"honeydew\", \"#f0fff0\"],\n [\"hotpink\", \"#ff69b4\"],\n [\"indianred\", \"#cd5c5c\"],\n [\"indigo\", \"#4b0082\"],\n [\"ivory\", \"#fffff0\"],\n [\"khaki\", \"#f0e68c\"],\n [\"lavender\", \"#e6e6fa\"],\n [\"lavenderblush\", \"#fff0f5\"],\n [\"lawngreen\", \"#7cfc00\"],\n [\"lemonchiffon\", \"#fffacd\"],\n [\"lightblue\", \"#add8e6\"],\n [\"lightcoral\", \"#f08080\"],\n [\"lightcyan\", \"#e0ffff\"],\n [\"lightgoldenrodyellow\", \"#fafad2\"],\n [\"lightgray\", \"#d3d3d3\"],\n [\"lightgreen\", \"#90ee90\"],\n [\"lightgrey\", \"#d3d3d3\"],\n [\"lightpink\", \"#ffb6c1\"],\n [\"lightsalmon\", \"#ffa07a\"],\n [\"lightseagreen\", \"#20b2aa\"],\n [\"lightskyblue\", \"#87cefa\"],\n [\"lightslategray\", \"#778899\"],\n [\"lightslategrey\", \"#778899\"],\n [\"lightsteelblue\", \"#b0c4de\"],\n [\"lightyellow\", \"#ffffe0\"],\n [\"lime\", \"#00ff00\"],\n [\"limegreen\", \"#32cd32\"],\n [\"linen\", \"#faf0e6\"],\n [\"magenta\", \"#ff00ff\"],\n [\"maroon\", \"#800000\"],\n [\"mediumaquamarine\", \"#66cdaa\"],\n [\"mediumblue\", \"#0000cd\"],\n [\"mediumorchid\", \"#ba55d3\"],\n [\"mediumpurple\", \"#9370db\"],\n [\"mediumseagreen\", \"#3cb371\"],\n [\"mediumslateblue\", \"#7b68ee\"],\n [\"mediumspringgreen\", \"#00fa9a\"],\n [\"mediumturquoise\", \"#48d1cc\"],\n [\"mediumvioletred\", \"#c71585\"],\n [\"midnightblue\", \"#191970\"],\n [\"mintcream\", \"#f5fffa\"],\n [\"mistyrose\", \"#ffe4e1\"],\n [\"moccasin\", \"#ffe4b5\"],\n [\"navajowhite\", \"#ffdead\"],\n [\"navy\", \"#000080\"],\n [\"oldlace\", \"#fdf5e6\"],\n [\"olive\", \"#808000\"],\n [\"olivedrab\", \"#6b8e23\"],\n [\"orange\", \"#ffa500\"],\n [\"orangered\", \"#ff4500\"],\n [\"orchid\", \"#da70d6\"],\n [\"palegoldenrod\", \"#eee8aa\"],\n [\"palegreen\", \"#98fb98\"],\n [\"paleturquoise\", \"#afeeee\"],\n [\"palevioletred\", \"#db7093\"],\n [\"papayawhip\", \"#ffefd5\"],\n [\"peachpuff\", \"#ffdab9\"],\n [\"peru\", \"#cd853f\"],\n [\"pink\", \"#ffc0cb\"],\n [\"plum\", \"#dda0dd\"],\n [\"powderblue\", \"#b0e0e6\"],\n [\"purple\", \"#800080\"],\n [\"rebeccapurple\", \"#663399\"],\n [\"red\", \"#ff0000\"],\n [\"rosybrown\", \"#bc8f8f\"],\n [\"royalblue\", \"#4169e1\"],\n [\"saddlebrown\", \"#8b4513\"],\n [\"salmon\", \"#fa8072\"],\n [\"sandybrown\", \"#f4a460\"],\n [\"seagreen\", \"#2e8b57\"],\n [\"seashell\", \"#fff5ee\"],\n [\"sienna\", \"#a0522d\"],\n [\"silver\", \"#c0c0c0\"],\n [\"skyblue\", \"#87ceeb\"],\n [\"slateblue\", \"#6a5acd\"],\n [\"slategray\", \"#708090\"],\n [\"slategrey\", \"#708090\"],\n [\"snow\", \"#fffafa\"],\n [\"springgreen\", \"#00ff7f\"],\n [\"steelblue\", \"#4682b4\"],\n [\"tan\", \"#d2b48c\"],\n [\"teal\", \"#008080\"],\n [\"thistle\", \"#d8bfd8\"],\n [\"tomato\", \"#ff6347\"],\n [\"turquoise\", \"#40e0d0\"],\n [\"violet\", \"#ee82ee\"],\n [\"wheat\", \"#f5deb3\"],\n [\"white\", \"#ffffff\"],\n [\"whitesmoke\", \"#f5f5f5\"],\n [\"yellow\", \"#ffff00\"],\n [\"yellowgreen\", \"#9acd32\"],\n]);\n\n// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\nconst HASH_PATTERN = /^#([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})([\\dA-F]{2})?$/i;\n// eslint-disable-next-line regexp/optimal-quantifier-concatenation,regexp/no-unused-capturing-group\nconst SMALL_HASH_PATTERN = /^#([\\dA-F])([\\dA-F])([\\dA-F])([\\dA-F])?$/i;\nconst RGB_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^rgba?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\nconst HSL_PATTERN =\n // eslint-disable-next-line security/detect-unsafe-regex,regexp/no-unused-capturing-group\n /^hsla?\\(\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))%\\s*(,\\s*([+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+))\\s*)?\\)$/;\n\nconst getDefaultCss = (): CssObject => {\n return {\n __proto__: null,\n backgroundColor: null,\n color: null,\n fontStyle: null,\n fontWeight: null,\n textDecorationColor: null,\n textDecorationLine: [],\n };\n};\n\n// eslint-disable-next-line regexp/no-useless-flag\nconst SPACE_PATTERN = /\\s+/g;\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2739\nconst parseCssColor = (colorString: string): [number, number, number] | null => {\n if (colorKeywords.has(colorString)) {\n // eslint-disable-next-line no-param-reassign\n colorString = colorKeywords.get(colorString) as string;\n }\n\n const hashMatch = HASH_PATTERN.exec(colorString);\n\n if (hashMatch) {\n return [Number.parseInt(hashMatch[1] as string, 16), Number.parseInt(hashMatch[2] as string, 16), Number.parseInt(hashMatch[3] as string, 16)];\n }\n\n const smallHashMatch = SMALL_HASH_PATTERN.exec(colorString);\n\n if (smallHashMatch) {\n return [\n Number.parseInt(`${smallHashMatch[1]}${smallHashMatch[1]}`, 16),\n Number.parseInt(`${smallHashMatch[2]}${smallHashMatch[2]}`, 16),\n Number.parseInt(`${smallHashMatch[3]}${smallHashMatch[3]}`, 16),\n ];\n }\n\n const rgbMatch = RGB_PATTERN.exec(colorString);\n\n if (rgbMatch) {\n return [\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[1])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[2])))),\n Math.round(Math.max(0, Math.min(255, Number(rgbMatch[3])))),\n ];\n }\n\n const hslMatch = HSL_PATTERN.exec(colorString);\n\n if (hslMatch) {\n // https://www.rapidtables.com/convert/color/hsl-to-rgb.html\n let h = Number(hslMatch[1]) % 360;\n if (h < 0) {\n h += 360;\n }\n const s = Math.max(0, Math.min(100, Number(hslMatch[2]))) / 100;\n const l = Math.max(0, Math.min(100, Number(hslMatch[3]))) / 100;\n const c = (1 - Math.abs(2 * l - 1)) * s;\n const x = c * (1 - Math.abs(((h / 60) % 2) - 1));\n const m = l - c / 2;\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let r_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let g_: number;\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n let b_: number;\n\n if (h < 60) {\n ({ 0: r_, 1: g_, 2: b_ } = [c, x, 0]);\n } else if (h < 120) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, c, 0]);\n } else if (h < 180) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, c, x]);\n } else if (h < 240) {\n ({ 0: r_, 1: g_, 2: b_ } = [0, x, c]);\n } else if (h < 300) {\n ({ 0: r_, 1: g_, 2: b_ } = [x, 0, c]);\n } else {\n ({ 0: r_, 1: g_, 2: b_ } = [c, 0, x]);\n }\n\n return [Math.round((r_ + m) * 255), Math.round((g_ + m) * 255), Math.round((b_ + m) * 255)];\n }\n\n return null;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2928\nconst colorEquals = (color1: string | [number, number, number] | null, color2: string | [number, number, number] | null) =>\n color1?.[0] === color2?.[0] && color1?.[1] === color2?.[1] && color1?.[2] === color2?.[2];\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2821\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const parseCss = (cssString: string): CssObject => {\n const css = getDefaultCss();\n\n const rawEntries = [];\n\n let inValue = false;\n let currentKey = null;\n let parenthesesDepth = 0;\n let currentPart = \"\";\n\n // eslint-disable-next-line no-restricted-syntax\n for (const c of cssString) {\n if (c === \"(\") {\n parenthesesDepth++;\n } else if (parenthesesDepth > 0) {\n if (c === \")\") {\n parenthesesDepth--;\n }\n } else if (inValue) {\n if (c === \";\") {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n inValue = false;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n } else if (c === \":\") {\n currentKey = currentPart.trim();\n currentPart = \"\";\n inValue = true;\n\n // eslint-disable-next-line no-continue\n continue;\n }\n currentPart += c;\n }\n\n if (inValue && parenthesesDepth === 0) {\n const value = currentPart.trim();\n\n if (value !== \"\") {\n rawEntries.push([currentKey, value]);\n }\n\n currentKey = null;\n currentPart = \"\";\n }\n\n // eslint-disable-next-line no-restricted-syntax\n for (const { 0: key, 1: value } of rawEntries) {\n switch (key) {\n case \"background-color\": {\n if (value != null) {\n css.backgroundColor = value;\n }\n\n break;\n }\n case \"color\": {\n if (value != null) {\n css.color = value;\n }\n\n break;\n }\n case \"font-weight\": {\n if (value === \"bold\") {\n css.fontWeight = value;\n }\n\n break;\n }\n case \"font-style\": {\n if ([\"italic\", \"oblique\", \"oblique 14deg\"].includes(value as string)) {\n css.fontStyle = \"italic\";\n }\n\n break;\n }\n case \"text-decoration-line\": {\n css.textDecorationLine = [];\n const lineTypes = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const lineType of lineTypes) {\n if ([\"line-through\", \"overline\", \"underline\"].includes(lineType)) {\n css.textDecorationLine.push(lineType);\n }\n }\n\n break;\n }\n case \"text-decoration-color\": {\n const color = parseCssColor(value as string);\n\n if (color != null) {\n css.textDecorationColor = color;\n }\n\n break;\n }\n case \"text-decoration\": {\n css.textDecorationColor = null;\n css.textDecorationLine = [];\n\n // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle\n const arguments_ = (value as string).split(SPACE_PATTERN);\n\n // eslint-disable-next-line no-restricted-syntax\n for (const argument of arguments_) {\n const maybeColor = parseCssColor(argument);\n if (maybeColor != null) {\n css.textDecorationColor = maybeColor;\n } else if ([\"line-through\", \"overline\", \"underline\"].includes(argument)) {\n css.textDecorationLine.push(argument);\n }\n }\n\n break;\n }\n default:\n // empty\n }\n }\n\n return css;\n};\n\n// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.\n// eslint-disable-next-line no-secrets/no-secrets\n// https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L2933\n// eslint-disable-next-line sonarjs/cognitive-complexity\nexport const cssToAnsi = (css: CssObject, previousCss: CssObject | null = null): string => {\n // eslint-disable-next-line no-param-reassign\n previousCss = previousCss ?? getDefaultCss();\n\n let ansi = \"\";\n\n if (!colorEquals(css.backgroundColor, previousCss.backgroundColor)) {\n if (css.backgroundColor == null) {\n ansi += \"\\u001B[49m\";\n } else\n switch (css.backgroundColor) {\n case \"black\": {\n ansi += \"\\u001B[40m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[41m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[42m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[43m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[44m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[45m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[46m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[47m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.backgroundColor)) {\n const { 0: r, 1: g, 2: b } = css.backgroundColor;\n\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.backgroundColor);\n\n if (parsed === null) {\n ansi += \"\\u001B[49m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[48;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n if (!colorEquals(css.color, previousCss.color)) {\n if (css.color == null) {\n ansi += \"\\u001B[39m\";\n } else\n switch (css.color) {\n case \"black\": {\n ansi += \"\\u001B[30m\";\n\n break;\n }\n case \"red\": {\n ansi += \"\\u001B[31m\";\n\n break;\n }\n case \"green\": {\n ansi += \"\\u001B[32m\";\n\n break;\n }\n case \"yellow\": {\n ansi += \"\\u001B[33m\";\n\n break;\n }\n case \"blue\": {\n ansi += \"\\u001B[34m\";\n\n break;\n }\n case \"magenta\": {\n ansi += \"\\u001B[35m\";\n\n break;\n }\n case \"cyan\": {\n ansi += \"\\u001B[36m\";\n\n break;\n }\n case \"white\": {\n ansi += \"\\u001B[37m\";\n\n break;\n }\n default: {\n if (Array.isArray(css.color)) {\n const { 0: r, 1: g, 2: b } = css.color;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n } else {\n const parsed = parseCssColor(css.color);\n\n if (parsed === null) {\n ansi += \"\\u001B[39m\";\n } else {\n const { 0: r, 1: g, 2: b } = parsed;\n ansi += `\\u001B[38;2;${r};${g};${b}m`;\n }\n }\n }\n }\n }\n\n if (css.fontWeight !== previousCss.fontWeight) {\n ansi += css.fontWeight === \"bold\" ? \"\\u001B[1m\" : \"\\u001B[22m\";\n }\n\n if (css.fontStyle !== previousCss.fontStyle) {\n ansi += css.fontStyle === \"italic\" ? \"\\u001B[3m\" : \"\\u001B[23m\";\n }\n\n if (!colorEquals(css.textDecorationColor, previousCss.textDecorationColor)) {\n if (css.textDecorationColor == null) {\n ansi += \"\\u001B[59m\";\n } else {\n const { 0: r, 1: g, 2: b } = css.textDecorationColor;\n ansi += `\\u001B[58;2;${r};${g};${b}m`;\n }\n }\n\n if (css.textDecorationLine.includes(\"line-through\") !== previousCss.textDecorationLine.includes(\"line-through\")) {\n ansi += css.textDecorationLine.includes(\"line-through\") ? \"\\u001B[9m\" : \"\\u001B[29m\";\n }\n\n if (css.textDecorationLine.includes(\"overline\") !== previousCss.textDecorationLine.includes(\"overline\")) {\n ansi += css.textDecorationLine.includes(\"overline\") ? \"\\u001B[53m\" : \"\\u001B[55m\";\n }\n\n if (css.textDecorationLine.includes(\"underline\") !== previousCss.textDecorationLine.includes(\"underline\")) {\n ansi += css.textDecorationLine.includes(\"underline\") ? \"\\u001B[4m\" : \"\\u001B[24m\";\n }\n\n return ansi;\n};\n","import { cssToAnsi, parseCss } from \"./inspect-colors\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst tryStringify = (o: any): string => {\n try {\n return JSON.stringify(o);\n } catch {\n return '\"[Circular]\"';\n }\n};\n\nconst CHAR_PERCENT = \"%\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_s = \"s\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_d = \"d\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_f = \"f\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_i = \"i\".codePointAt(0);\nconst CHAR_O = \"O\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_o = \"o\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention,unicorn/prevent-abbreviations\nconst CHAR_j = \"j\".codePointAt(0);\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst CHAR_c = \"c\".codePointAt(0);\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any,sonarjs/cognitive-complexity\nexport const format = (fmt: Record<string, any> | string, arguments_: any[] = [], options: Options = {}): string => {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if ((typeof fmt !== \"string\" && typeof fmt !== \"object\") || fmt === null) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n throw new TypeError(`fmt must be a string or object, got ${fmt === null ? \"null\" : typeof fmt}`);\n }\n\n const stringify = options.stringify ?? tryStringify;\n const offset = 1;\n\n if (typeof fmt === \"object\") {\n const argumentsLength = arguments_.length + offset;\n\n if (argumentsLength === 1) {\n return \"{}\";\n }\n\n const objects = Array.from({ length: argumentsLength });\n\n objects[0] = stringify(fmt);\n\n for (let index = 1; index < argumentsLength; index++) {\n // eslint-disable-next-line security/detect-object-injection\n objects[index] = stringify(arguments_[index - offset]);\n }\n\n return objects.join(\" \");\n }\n\n if (arguments_.length === 0) {\n return fmt;\n }\n\n let result = \"\";\n let a = 1 - offset;\n let lastPosition = -1;\n\n let usedStyle = false;\n let previousCss = null;\n\n for (let index = 0; index < fmt.length; ) {\n if (fmt.codePointAt(index) === CHAR_PERCENT && index + 1 < fmt.length) {\n lastPosition = lastPosition > -1 ? lastPosition : 0;\n\n const c = fmt.codePointAt(index + 1);\n\n if (c === undefined) {\n ++a;\n break;\n }\n\n switch (c) {\n case CHAR_d:\n case CHAR_f: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Number(arguments_[a as keyof typeof arguments_]).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_i: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] == null) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += Math.floor(Number(arguments_[a as keyof typeof arguments_])).toString();\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_O:\n case CHAR_o:\n case CHAR_j: {\n if (a >= arguments_.length || arguments_[a as keyof typeof arguments_] === undefined) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const temporaryArgument = arguments_[a as keyof typeof arguments_];\n const type = typeof temporaryArgument;\n\n if (type === \"string\") {\n result += `'${temporaryArgument}'`;\n lastPosition = index + 2;\n break;\n }\n\n if (type === \"function\") {\n // eslint-disable-next-line @typescript-eslint/ban-types\n result += (temporaryArgument as Function).name ? `[Function: ${(temporaryArgument as Function).name}]` : \"[Function: <anonymous>]\";\n lastPosition = index + 2;\n break;\n }\n\n result += stringify(temporaryArgument);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_s: {\n if (a >= arguments_.length) {\n break;\n }\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result +=\n typeof arguments_[a as keyof typeof arguments_] === \"object\"\n ? stringify(arguments_[a as keyof typeof arguments_])\n : String(arguments_[a as keyof typeof arguments_]);\n lastPosition = index + 2;\n\n index++;\n break;\n }\n case CHAR_PERCENT: {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += \"%\";\n lastPosition = index + 2;\n\n index++;\n a--;\n break;\n }\n case CHAR_c: {\n // Inspired by Deno's handling of '%c'.\n // eslint-disable-next-line no-secrets/no-secrets\n // https://github.com/denoland/deno/blob/ece2a3de5b19588160634452638aa656218853c5/ext/console/01_console.js#L3115\n if (typeof window === \"undefined\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n const css = parseCss(arguments_[a as keyof typeof arguments_]);\n\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n result += cssToAnsi(css, previousCss);\n\n if (result !== \"\") {\n usedStyle = true;\n previousCss = css;\n }\n }\n\n lastPosition = index + 2;\n\n index++;\n\n break;\n }\n default: {\n // eslint-disable-next-line security/detect-object-injection\n if (typeof options.formatters?.[c] === \"function\") {\n if (lastPosition < index) {\n result += fmt.slice(lastPosition, index);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n result += (options.formatters[c] as FormatterFunction)(arguments_[a as keyof typeof arguments_]);\n\n lastPosition = index + 2;\n\n index++;\n }\n }\n }\n\n ++a;\n }\n\n ++index;\n }\n\n if (lastPosition === -1) {\n return fmt;\n }\n\n if (lastPosition < fmt.length) {\n result += fmt.slice(lastPosition);\n }\n\n if (usedStyle) {\n result += \"\\u001B[0m\";\n }\n\n return result;\n};\n\nexport const build = (\n options: Options = {},\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ((f: NonNullable<Record<string, any> | string>, arguments_?: any[], formatOptions?: Omit<Options, \"formatters\">) => string) => {\n const formatters: FormatterMap = {};\n\n if (typeof options.formatters === \"object\") {\n Object.entries(options.formatters).forEach(([key, formatterFunction]) => {\n if (key.length === 0) {\n throw new Error(`Formatter %${key} has no characters`);\n }\n\n if (key.length > 1) {\n throw new Error(`Formatter %${key} has more than one character`);\n }\n\n if (typeof formatterFunction !== \"function\") {\n throw new TypeError(`Formatter for %${key} is not a function`);\n }\n\n const c = key.codePointAt(0);\n\n if (c === undefined) {\n throw new Error(`${key}.codePointAt(0) failed to return a value, please report this issue`);\n }\n\n // eslint-disable-next-line security/detect-object-injection\n formatters[c] = formatterFunction;\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (f: NonNullable<Record<string, any> | string>, arguments_: any[] = [], formatOptions: Omit<Options, \"formatters\"> = {}) =>\n format(f, arguments_, { ...formatOptions, formatters });\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type FormatterFunction = (argument: any) => string;\nexport type FormatterMap = Record<number, FormatterFunction>;\n\nexport interface Options {\n formatters?: Record<string, FormatterFunction>;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n stringify?: (o: any) => string;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/fmt",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Util.format-like string formatting utility.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -83,10 +83,10 @@
83
83
  "@anolilab/prettier-config": "^5.0.14",
84
84
  "@anolilab/semantic-release-preset": "^8.0.3",
85
85
  "@babel/core": "^7.23.9",
86
- "@rushstack/eslint-plugin-security": "^0.8.0",
86
+ "@rushstack/eslint-plugin-security": "^0.8.1",
87
87
  "@types/node": "18.18.14",
88
- "@vitest/coverage-v8": "^1.2.2",
89
- "@vitest/ui": "^1.2.2",
88
+ "@vitest/coverage-v8": "^1.3.1",
89
+ "@vitest/ui": "^1.3.1",
90
90
  "cross-env": "^7.0.3",
91
91
  "eslint": "^8.56.0",
92
92
  "eslint-plugin-deprecation": "^2.0.0",
@@ -102,7 +102,7 @@
102
102
  "sort-package-json": "^2.7.0",
103
103
  "tsup": "^8.0.2",
104
104
  "typescript": "^5.3.3",
105
- "vitest": "^1.2.2"
105
+ "vitest": "^1.3.1"
106
106
  },
107
107
  "engines": {
108
108
  "node": ">=18.* <=21.*"