"use strict";const E=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,c=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,m=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,w=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi,y=new Map([["n",`
`],["r","\r"],["t","	"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function f(s){return s[0]==="u"&&s.length===5||s[0]==="x"&&s.length===3?String.fromCharCode(parseInt(s.slice(1),16)):y.get(s)||s}function d(s,l){const e=[],n=l.trim().split(/\s*,\s*/g);let t;for(const r of n)if(!isNaN(r))e.push(Number(r));else if(t=r.match(m))e.push(t[2].replace(w,(u,o,i)=>o?f(o):i));else throw new Error(`Invalid Chalk template style argument: ${r} (in style '${s}')`);return e}function k(s){c.lastIndex=0;const l=[];let e;for(;(e=c.exec(s))!==null;){const n=e[1];if(e[2]){const t=d(n,e[2]);l.push([n].concat(t))}else l.push([n])}return l}function h(s,l){const e={};for(const t of l)for(const r of t.styles)e[r[0]]=t.inverse?null:r.slice(1);let n=s;for(const t of Object.keys(e))if(Array.isArray(e[t])){if(!(t in n))throw new Error(`Unknown Chalk style: ${t}`);e[t].length>0?n=n[t].apply(n,e[t]):n=n[t]}return n}var S=(s,l)=>{const e=[],n=[];let t=[];if(l.replace(E,(r,u,o,i,p,g)=>{if(u)t.push(f(u));else if(i){const a=t.join("");t=[],n.push(e.length===0?a:h(s,e)(a)),e.push({inverse:o,styles:k(i)})}else if(p){if(e.length===0)throw new Error("Found extraneous } in Chalk template literal");n.push(h(s,e)(t.join(""))),t=[],e.pop()}else t.push(g)}),n.push(t.join("")),e.length>0){const r=`Chalk template literal is missing ${e.length} closing bracket${e.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return n.join("")};module.exports=S;
//# sourceMappingURL=templates.js.map
