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

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