import { r as registerInstance, h, H as Host } from './index-55faf181.js';
import { d as dark, l as light } from './light-1332153c.js';
import { i as isUserLoggedIn } from './index-36f6c00a.js';
import './colors-4dc9e03b.js';
import './kimlikApi-7350588e.js';
import './data-transfer-field-918730a3.js';
import './BaseField-461b6d0c.js';
import './filter-cbaa3d7d.js';
import './cookie-93ea205f.js';
import './_commonjsHelpers-27f122dd.js';

function wrapContent(theme, content) {
  return (h(Host, null, h("mentornity-console-app-context-injector", { theme: theme }, h("dvn-theme-provider", { colorBackground: true, fitHeight: true, theme: theme }, h("dvn-global-table", null), h("dvn-global-grid", null), h("dvn-global-text", null), h("notifier-wrapper", null, content)))));
}
const MentornityConsoleAppRoot = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.navigate = (config) => {
      this.path = config.path;
      history.pushState({}, '', this.path);
    };
  }
  onThemeChange(event) {
    if (event.detail === 'dvn-dark') {
      this.theme = dark;
    }
    else {
      this.theme = light;
    }
  }
  componentWillLoad() {
    const hour = new Date().getHours();
    const isSunGone = 6 > hour || hour > 18;
    this.theme = isSunGone ? dark : light;
    this.path = location.pathname;
  }
  render() {
    if (!isUserLoggedIn()) {
      return wrapContent(this.theme, h("dvn-app-anonymous", { navigate: this.navigate, path: this.path }));
    }
    return wrapContent(this.theme, h("dvn-app", { navigate: this.navigate, path: this.path }));
  }
};

export { MentornityConsoleAppRoot as mentornity_console_app_root };
