import{__spreadArray}from"tslib";import{b as balBrowser}from"./browser-216e7b03.js";var defaultLoggerConfig={components:[],event:false,lifecycle:false,render:false,custom:false};var getConfig=function(){var r=defaultLoggerConfig;if(balBrowser.hasWindow&&window.BaloiseDesignSystem&&window.BaloiseDesignSystem.config&&window.BaloiseDesignSystem.config.logger){r=window.BaloiseDesignSystem.config.logger}return r};var buildLogger=function(r){var e=function(e,n){var o=[];for(var a=2;a<arguments.length;a++){o[a-2]=arguments[a]}var t=getConfig();if(t.components.includes(r)&&t[e]){console.log.apply(console,__spreadArray([n],o,false))}};return{custom:function(n){var o=[];for(var a=1;a<arguments.length;a++){o[a-1]=arguments[a]}return e.apply(void 0,__spreadArray(["custom"," ➡️ [".concat(r,"] - ").concat(n)],o,false))},lifecycle:function(n){var o=[];for(var a=1;a<arguments.length;a++){o[a-1]=arguments[a]}return e.apply(void 0,__spreadArray(["lifecycle","".concat(n==="connectedCallback"?"🟢":n==="disconnectedCallback"?"🔴":n==="componentDidLoad"?"🏁":" ➡️"," [").concat(r,"] - (").concat(n,")")],o,false))},event:function(n){var o=[];for(var a=1;a<arguments.length;a++){o[a-1]=arguments[a]}return e.apply(void 0,__spreadArray(["event","🔥 [".concat(r,"] - (").concat(n,")")],o,false))},render:function(){var n=[];for(var o=0;o<arguments.length;o++){n[o]=arguments[o]}return e.apply(void 0,__spreadArray(["render","🖌️ [".concat(r,"] - (render)")],n,false))}}};function Logger(r){if(r===void 0){r="unknown"}return function(e,n,o){var a=e.connectedCallback,t=e.disconnectedCallback,i=e.render,f=e.componentDidLoad,s=e.createLogger;var c=buildLogger(r);e.connectedCallback=function(){var r=this;c.lifecycle("connectedCallback",this);var e=Object.keys(this).filter((function(r){return r.startsWith("bal")})).filter((function(e){return typeof r[e]==="object"}));var n=function(n){var a=e[n];var t=o[a];o[a]={emit:function(){var e;var n=[];for(var o=0;o<arguments.length;o++){n[o]=arguments[o]}c.event.apply(c,__spreadArray([a,r],n,false));return(e=t.emit).call.apply(e,__spreadArray([r],n,false))}}};var o=this;for(var t=0;t<e.length;t++){n(t)}s.call(this,c.custom);return a&&a.call(this)};e.disconnectedCallback=function(){c.lifecycle("disconnectedCallback",this);return t&&t.call(this)};e.componentDidLoad=function(){c.lifecycle("componentDidLoad",this);return f&&f.call(this)};e.render=function(){c.render(this);return i.call(this)}}}export{Logger as L,defaultLoggerConfig as d};