import{g as c}from"./index-BD2PoSOi.chunk.mjs";var n=(s=>(s[s.Debug=0]="Debug",s[s.Info=1]="Info",s[s.Warn=2]="Warn",s[s.Error=3]="Error",s[s.Fatal=4]="Fatal",s))(n||{}),l=Object.defineProperty,u=(s,e,t)=>e in s?l(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,g=(s,e,t)=>(u(s,e+"",t),t);class h{constructor(e){g(this,"context"),this.context=e||{}}formatMessage(e,t,o){let a="["+n[t].toUpperCase()+"] ";return o&&o.app&&(a+=o.app+": "),typeof e=="string"?a+e:(a+="Unexpected ".concat(e.name),e.message&&(a+=' "'.concat(e.message,'"')),t===n.Debug&&e.stack&&(a+=`

Stack trace:
`.concat(e.stack)),a)}log(e,t,o){var a,r;if(!(typeof((a=this.context)==null?void 0:a.level)=="number"&&e<((r=this.context)==null?void 0:r.level)))switch(typeof t=="object"&&o?.error===void 0&&(o.error=t),e){case n.Debug:console.debug(this.formatMessage(t,n.Debug,o),o);break;case n.Info:console.info(this.formatMessage(t,n.Info,o),o);break;case n.Warn:console.warn(this.formatMessage(t,n.Warn,o),o);break;case n.Error:console.error(this.formatMessage(t,n.Error,o),o);break;case n.Fatal:default:console.error(this.formatMessage(t,n.Fatal,o),o);break}}debug(e,t){this.log(n.Debug,e,Object.assign({},this.context,t))}info(e,t){this.log(n.Info,e,Object.assign({},this.context,t))}warn(e,t){this.log(n.Warn,e,Object.assign({},this.context,t))}error(e,t){this.log(n.Error,e,Object.assign({},this.context,t))}fatal(e,t){this.log(n.Fatal,e,Object.assign({},this.context,t))}}function d(s){return new h(s)}var b=Object.defineProperty,f=(s,e,t)=>e in s?b(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,i=(s,e,t)=>(f(s,typeof e!="symbol"?e+"":e,t),t);class v{constructor(e){i(this,"context"),i(this,"factory"),this.context={},this.factory=e}setApp(e){return this.context.app=e,this}setLogLevel(e){return this.context.level=e,this}setUid(e){return this.context.uid=e,this}detectUser(){const e=c();return e!==null&&(this.context.uid=e.uid),this}detectLogLevel(){const e=this,t=()=>{var o,a;document.readyState==="complete"||document.readyState==="interactive"?(e.context.level=(a=(o=window._oc_config)==null?void 0:o.loglevel)!=null?a:n.Warn,window._oc_debug&&(e.context.level=n.Debug),document.removeEventListener("readystatechange",t)):document.addEventListener("readystatechange",t)};return t(),this}build(){return this.context.level===void 0&&this.detectLogLevel(),this.factory(this.context)}}function m(){return new v(d)}const x=m().setApp("files_downloadlimit").detectUser().build();export{x as l};
//# sourceMappingURL=logger-SLCD81cU.chunk.mjs.map
