import{E as e}from"./p-BNpVu1WU.js";var s;!function(e){e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warn=3]="Warn",e[e.Error=4]="Error"}(s||(s={}));class o{constructor(o,t={}){this.componentName=o||"UnknownComponent",this.logLevel=t.logLevel||function(e){switch(e.toLowerCase()){case"info":return s.Info;case"warn":return s.Warn;case"error":return s.Error;default:return console.warn(`Invalid log level string: ${e}, defaulting to Error`),s.Error}}(e.LOG_LEVEL)||s.Error,this.remoteLoggingUrl=t.remoteLoggingUrl}setLogLevel(e){e in s?this.logLevel=e:console.warn(`Invalid log level: ${e}`)}log(e,o,...t){if(e>=this.logLevel){const n=(new Date).toISOString(),r=s[e].toUpperCase(),a=`[${n}] [${this.componentName}] [${r}] ${o}`;switch(e){case s.Debug:console.debug(a,...t);break;case s.Info:console.info(a,...t);break;case s.Warn:console.warn(a,...t);break;case s.Error:console.error(a,...t)}this.remoteLoggingUrl&&this.sendToServer(r,o,t)}}sendToServer(e,s,o){const t={timestamp:(new Date).toISOString(),componentName:this.componentName,level:e,message:s,args:o};fetch(this.remoteLoggingUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).catch((e=>{console.warn("Failed to send log to server:",e)}))}debug(e,...o){this.log(s.Debug,e,...o)}info(e,...o){this.log(s.Info,e,...o)}warn(e,...o){this.log(s.Warn,e,...o)}error(e,o){o instanceof Error?this.log(s.Error,`${e}: ${o.message}`,o.stack):this.log(s.Error,e,o)}}export{o as L,s as a}