#!/usr/bin/env node
import n from'chalk';var o=class{constructor(r,t){this.symbol=r;this.type=t;}format(r,t,s){let i=this.getPrefix(r),g=this.formatSymbol(),c=s?n.gray(` ${JSON.stringify(s)}`):"";return `${i} ${g} ${t}${c}`}getPrefix(r){switch(r){case "debug":return n.gray("\u25CB");case "info":return n.blue("\u2139");case "success":return n.green("\u2714");case "warn":return n.yellow("\u26A0");case "error":return n.red("\u2716")}}formatSymbol(){switch(this.type){case "command":return n.cyan(`[${this.symbol}]`);case "component":return n.magenta(`#${this.symbol}`);case "operation":return n.blue(this.symbol)}}debug(r,t){process.env.DEBUG&&console.log(this.format("debug",r,t));}info(r,t){console.log(this.format("info",r,t));}success(r,t){console.log(this.format("success",r,t));}warn(r,t){console.log(this.format("warn",r,t));}error(r,t){console.error(this.format("error",r,t));}start(r,t){return this.info(r,t),new a(this.symbol,this.type)}},a=class{constructor(r,t){this.symbol=r;this.type=t;this.startTime=Date.now();}startTime;getDuration(){return Date.now()-this.startTime}success(r,t){let s=this.getDuration();new o(this.symbol,this.type).success(r,{...t,duration:`${s}ms`});}error(r,t){let s=this.getDuration();new o(this.symbol,this.type).error(r,{...t,duration:`${s}ms`});}},u={command(e){return new o(e,"command")},component(e){return new o(e,"component")},operation(e){return new o(e,"operation")}};export{u as a};