#!/usr/bin/env node
import {c,a,b,e}from'./chunk-XHJ27CER.js';var y=c((z,d)=>{var l=Object.defineProperty,L=Object.getOwnPropertyDescriptor,$=Object.getOwnPropertyNames,P=Object.prototype.hasOwnProperty,D=(t,r)=>{for(var e in r)l(t,e,{get:r[e],enumerable:true});},T=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of $(r))!P.call(t,s)&&s!==e&&l(t,s,{get:()=>r[s],enumerable:!(o=L(r,s))||o.enumerable});return t},x=t=>T(l({},"__esModule",{value:true}),t),h={};D(h,{ParadigmLogger:()=>g,createCorrelationId:()=>M,log:()=>q,withCorrelation:()=>R});d.exports=x(h);var E={debug:"\x1B[90m",info:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m"},I="\x1B[1m",c="\x1B[0m";function j(){let t=new Date,r=String(t.getHours()).padStart(2,"0"),e=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0"),s=String(t.getMilliseconds()).padStart(3,"0");return `${r}:${e}:${o}.${s}`}function C(t){return !t||Object.keys(t).length===0?"":" "+JSON.stringify(t)}function F(t,r,e,o,s,i){let n=E[t],a=t.toUpperCase().padEnd(5),b=j(),w=C(i?{correlationId:i,...s}:s);return `${n}${b}${c} ${I}${r}${c} ${n}${a}${c} ${o}${w}`}function B(t,r,e,o,s,i){let n={timestamp:new Date().toISOString(),level:t,symbol:r,symbolType:e,message:o,...s};return i&&(n.correlationId=i),JSON.stringify(n)}var N=a("async_hooks"),A=a("crypto"),f=new N.AsyncLocalStorage;function M(){return (0, A.randomUUID)()}function R(t,r){return f.run(t,r)}function V(){return f.getStore()}var u={debug:0,info:1,warn:2,error:3};function k(){let t=typeof process<"u"?process.env:{},r=t.LOG_LEVEL;return r&&u[r]!==void 0?r:t.NODE_ENV==="production"?"info":"debug"}function G(){let t=typeof process<"u"?process.env:{};return t.PARADIGM_LOG_FORMAT==="json"||t.NODE_ENV==="production"?"json":"pretty"}function J(){let r=(typeof process<"u"?process.env:{}).PARADIGM_SYMBOLS;return r?r.split(",").map(e=>e.trim()).filter(Boolean):null}var U=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 o=Date.now()-this.startTime;this.emit(t,r,{...e,duration:`${o}ms`});}},m=class{constructor(t,r,e,o,s,i,n=[]){this.symbol=t,this.symbolType=r,this.minLevel=e,this.symbolFilter=o,this.format=s,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 U((e,o,s)=>this.emit(e,o,s))}emit(t,r,e){if(u[t]<u[this.minLevel])return;if(this.symbolFilter){let n=this.symbol.charAt(0);if(!this.symbolFilter.includes(n))return}let o=V(),i=(this.format==="json"?B:F)(t,this.symbol,this.symbolType,r,e,o);if(this.output(i),this.transports.length>0){let n={level:t,symbol:this.symbol,symbolType:this.symbolType,message:r,data:e,correlationId:o,timestamp:new Date().toISOString()};for(let a of this.transports)a.send(n);}}},g=class{level;symbolFilter;format;output;transports;constructor(t){this.level=t?.level??k(),this.symbolFilter=t?.symbols??J(),this.format=t?.format??G(),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 m(t,"raw",this.level,this.symbolFilter,this.format,this.output,this.transports)}create(t,r,e){let o=t.startsWith(e)?t:`${e}${t}`;return new m(o,r,this.level,this.symbolFilter,this.format,this.output,this.transports)}},q=new g;});var v,Q,Y=b(()=>{v=e(y(),1),Q=new v.ParadigmLogger({output:t=>process.stderr.write(t+`
`)});});export{Q as a,Y as b};