#!/usr/bin/env node
import {b as b$1}from'./chunk-5TAVYPOV.js';import {AsyncLocalStorage}from'async_hooks';function v(){let t=new Date,r=String(t.getHours()).padStart(2,"0"),e=String(t.getMinutes()).padStart(2,"0"),s=String(t.getSeconds()).padStart(2,"0"),o=String(t.getMilliseconds()).padStart(3,"0");return `${r}:${e}:${s}.${o}`}function S(t){return !t||Object.keys(t).length===0?"":" "+JSON.stringify(t)}function b(t,r,e,s,o,i){let n=d[t],a=t.toUpperCase().padEnd(5),f=v(),g=S(i?{correlationId:i,...o}:o);return `${n}${f}${c} ${y}${r}${c} ${n}${a}${c} ${s}${g}`}function w(t,r,e,s,o,i){let n={timestamp:new Date().toISOString(),level:t,symbol:r,symbolType:e,message:s,...o};return i&&(n.correlationId=i),JSON.stringify(n)}function O(){return L.getStore()}function T(){let t=typeof process<"u"?process.env:{},r=t.LOG_LEVEL;return r&&m[r]!==void 0?r:t.NODE_ENV==="production"?"info":"debug"}function D(){let t=typeof process<"u"?process.env:{};return t.PARADIGM_LOG_FORMAT==="json"||t.NODE_ENV==="production"?"json":"pretty"}function E(){let r=(typeof process<"u"?process.env:{}).PARADIGM_SYMBOLS;return r?r.split(",").map(e=>e.trim()).filter(Boolean):null}var d,y,c,L,m,I,h,u,p=b$1(()=>{d={debug:"\x1B[90m",info:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m"},y="\x1B[1m",c="\x1B[0m";L=new AsyncLocalStorage;m={debug:0,info:1,warn:2,error:3};I=class{constructor(t){this.emit=t,this.startTime=Date.now();}startTime;success(t,r){this.end("info",t,r);}error(t,r){this.end("error",t,r);}end(t,r,e){let s=Date.now()-this.startTime;this.emit(t,r,{...e,duration:`${s}ms`});}},h=class{constructor(t,r,e,s,o,i,n=[]){this.symbol=t,this.symbolType=r,this.minLevel=e,this.symbolFilter=s,this.format=o,this.output=i,this.transports=n;}debug(t,r){this.emit("debug",t,r);}info(t,r){this.emit("info",t,r);}warn(t,r){this.emit("warn",t,r);}error(t,r){this.emit("error",t,r);}start(t,r){return this.emit("info",t,r),new I((e,s,o)=>this.emit(e,s,o))}emit(t,r,e){if(m[t]<m[this.minLevel])return;if(this.symbolFilter){let n=this.symbol.charAt(0);if(!this.symbolFilter.includes(n))return}let s=O(),i=(this.format==="json"?w:b)(t,this.symbol,this.symbolType,r,e,s);if(this.output(i),this.transports.length>0){let n={level:t,symbol:this.symbol,symbolType:this.symbolType,message:r,data:e,correlationId:s,timestamp:new Date().toISOString()};for(let a of this.transports)a.send(n);}}},u=class{level;symbolFilter;format;output;transports;constructor(t){this.level=t?.level??T(),this.symbolFilter=t?.symbols??E(),this.format=t?.format??D(),this.output=t?.output??(r=>console.log(r)),this.transports=t?.transports??[];}addTransport(t){this.transports.push(t);}removeTransport(t){let r=this.transports.indexOf(t);r!==-1&&this.transports.splice(r,1);}component(t){return this.create(t,"component","#")}gate(t){return this.create(t,"gate","^")}signal(t){return this.create(t,"signal","!")}flow(t){return this.create(t,"flow","$")}aspect(t){return this.create(t,"aspect","~")}raw(t){return new h(t,"raw",this.level,this.symbolFilter,this.format,this.output,this.transports)}create(t,r,e){let s=t.startsWith(e)?t:`${e}${t}`;return new h(s,r,this.level,this.symbolFilter,this.format,this.output,this.transports)}},new u;});var j,x=b$1(()=>{p();j=new u({output:t=>process.stderr.write(t+`
`)});});export{j as a,x as b};