"use strict";var v=Object.defineProperty;var h=(e,t)=>v(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var A=Object.defineProperty,m=h((e,t)=>A(e,"name",{value:t,configurable:!0}),"m$1");const x=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,D=/^#([\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*)?\)$/,P=/^hsla?\(\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))%\s*(,\s*([+-]?(?:\d+(?:\.\d+)?|\.\d+))\s*)?\)$/,B=m(()=>({__proto__:null,backgroundColor:null,color:null,fontStyle:null,fontWeight:null,textDecorationColor:null,textDecorationLine:[]}),"getDefaultCss"),p=/\s+/g,g=m(e=>{x.has(e)&&(e=x.get(e));const t=C.exec(e);if(t)return[Number.parseInt(t[1],16),Number.parseInt(t[2],16),Number.parseInt(t[3],16)];const o=D.exec(e);if(o)return[Number.parseInt(`${o[1]}${o[1]}`,16),Number.parseInt(`${o[2]}${o[2]}`,16),Number.parseInt(`${o[3]}${o[3]}`,16)];const f=M.exec(e);if(f)return[Math.round(Math.max(0,Math.min(255,Number(f[1])))),Math.round(Math.max(0,Math.min(255,Number(f[2])))),Math.round(Math.max(0,Math.min(255,Number(f[3]))))];const i=P.exec(e);if(i){let n=Number(i[1])%360;n<0&&(n+=360);const l=Math.max(0,Math.min(100,Number(i[2])))/100,a=Math.max(0,Math.min(100,Number(i[3])))/100,c=(1-Math.abs(2*a-1))*l,u=c*(1-Math.abs(n/60%2-1)),r=a-c/2;let s,d,b;return n<60?{0:s,1:d,2:b}=[c,u,0]:n<120?{0:s,1:d,2:b}=[u,c,0]:n<180?{0:s,1:d,2:b}=[0,c,u]:n<240?{0:s,1:d,2:b}=[0,u,c]:n<300?{0:s,1:d,2:b}=[u,0,c]:{0:s,1:d,2:b}=[c,0,u],[Math.round((s+r)*255),Math.round((d+r)*255),Math.round((b+r)*255)]}return null},"parseCssColor"),k=m((e,t)=>e?.[0]===t?.[0]&&e?.[1]===t?.[1]&&e?.[2]===t?.[2],"colorEquals"),N=m(e=>{const t=B(),o=[];let f=!1,i=null,n=0,l="";for(const a of e){if(a==="(")n++;else if(n>0)a===")"&&n--;else if(f){if(a===";"){const c=l.trim();c!==""&&o.push([i,c]),i=null,l="",f=!1;continue}}else if(a===":"){i=l.trim(),l="",f=!0;continue}l+=a}if(f&&n===0){const a=l.trim();a!==""&&o.push([i,a]),i=null,l=""}for(const{0:a,1:c}of o)switch(a){case"background-color":{c!=null&&(t.backgroundColor=c);break}case"color":{c!=null&&(t.color=c);break}case"font-weight":{c==="bold"&&(t.fontWeight=c);break}case"font-style":{["italic","oblique","oblique 14deg"].includes(c)&&(t.fontStyle="italic");break}case"text-decoration-line":{t.textDecorationLine=[];const u=c.split(p);for(const r of u)["line-through","overline","underline"].includes(r)&&t.textDecorationLine.push(r);break}case"text-decoration-color":{const u=g(c);u!=null&&(t.textDecorationColor=u);break}case"text-decoration":{t.textDecorationColor=null,t.textDecorationLine=[];const u=c.split(p);for(const r of u){const s=g(r);s!=null?t.textDecorationColor=s:["line-through","overline","underline"].includes(r)&&t.textDecorationLine.push(r)}break}}return t},"parseCss"),F=m((e,t=null)=>{t=t??B();let o="";if(!k(e.backgroundColor,t.backgroundColor))if(e.backgroundColor==null)o+="\x1B[49m";else switch(e.backgroundColor){case"black":{o+="\x1B[40m";break}case"red":{o+="\x1B[41m";break}case"green":{o+="\x1B[42m";break}case"yellow":{o+="\x1B[43m";break}case"blue":{o+="\x1B[44m";break}case"magenta":{o+="\x1B[45m";break}case"cyan":{o+="\x1B[46m";break}case"white":{o+="\x1B[47m";break}default:if(Array.isArray(e.backgroundColor)){const{0:f,1:i,2:n}=e.backgroundColor;o+=`\x1B[48;2;${f};${i};${n}m`}else{const f=g(e.backgroundColor);if(f===null)o+="\x1B[49m";else{const{0:i,1:n,2:l}=f;o+=`\x1B[48;2;${i};${n};${l}m`}}}if(!k(e.color,t.color))if(e.color==null)o+="\x1B[39m";else switch(e.color){case"black":{o+="\x1B[30m";break}case"red":{o+="\x1B[31m";break}case"green":{o+="\x1B[32m";break}case"yellow":{o+="\x1B[33m";break}case"blue":{o+="\x1B[34m";break}case"magenta":{o+="\x1B[35m";break}case"cyan":{o+="\x1B[36m";break}case"white":{o+="\x1B[37m";break}default:if(Array.isArray(e.color)){const{0:f,1:i,2:n}=e.color;o+=`\x1B[38;2;${f};${i};${n}m`}else{const f=g(e.color);if(f===null)o+="\x1B[39m";else{const{0:i,1:n,2:l}=f;o+=`\x1B[38;2;${i};${n};${l}m`}}}if(e.fontWeight!==t.fontWeight&&(o+=e.fontWeight==="bold"?"\x1B[1m":"\x1B[22m"),e.fontStyle!==t.fontStyle&&(o+=e.fontStyle==="italic"?"\x1B[3m":"\x1B[23m"),!k(e.textDecorationColor,t.textDecorationColor))if(e.textDecorationColor==null)o+="\x1B[59m";else{const{0:f,1:i,2:n}=e.textDecorationColor;o+=`\x1B[58;2;${f};${i};${n}m`}return e.textDecorationLine.includes("line-through")!==t.textDecorationLine.includes("line-through")&&(o+=e.textDecorationLine.includes("line-through")?"\x1B[9m":"\x1B[29m"),e.textDecorationLine.includes("overline")!==t.textDecorationLine.includes("overline")&&(o+=e.textDecorationLine.includes("overline")?"\x1B[53m":"\x1B[55m"),e.textDecorationLine.includes("underline")!==t.textDecorationLine.includes("underline")&&(o+=e.textDecorationLine.includes("underline")?"\x1B[4m":"\x1B[24m"),o},"cssToAnsi");var L=Object.defineProperty,y=h((e,t)=>L(e,"name",{value:t,configurable:!0}),"y");const j=y(e=>{try{return JSON.stringify(e)}catch{return'"[Circular]"'}},"tryStringify"),w="%".codePointAt(0),q="s".codePointAt(0),S="d".codePointAt(0),E="f".codePointAt(0),O="i".codePointAt(0),I="O".codePointAt(0),T="o".codePointAt(0),W="j".codePointAt(0),_="c".codePointAt(0),$=y((e,t=[],o={})=>{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}`);const f=o.stringify??j,i=1;if(typeof e=="object"){const r=t.length+i;if(r===1)return"{}";const s=Array.from({length:r});s[0]=f(e);for(let d=1;d-1?a:0;const s=e.codePointAt(r+1);if(s===void 0){++l;break}switch(s){case S:case E:{if(l>=t.length||t[l]==null)break;a=t.length||t[l]==null)break;a=t.length||t[l]===void 0)break;a]",a=r+2;break}n+=f(d),a=r+2,r++;break}case q:{if(l>=t.length)break;a"u"){const d=N(t[l]);a{const t={};return typeof e.formatters=="object"&&Object.entries(e.formatters).forEach(([o,f])=>{if(o.length===0)throw new Error(`Formatter %${o} has no characters`);if(o.length>1)throw new Error(`Formatter %${o} has more than one character`);if(typeof f!="function")throw new TypeError(`Formatter for %${o} is not a function`);const i=o.codePointAt(0);if(i===void 0)throw new Error(`${o}.codePointAt(0) failed to return a value, please report this issue`);t[i]=f}),(o,f=[],i={})=>$(o,f,{...i,formatters:t})},"build");exports.build=z;exports.format=$;