'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-ce58ddc5.js');
const dark = require('./dark-18386f8e.js');
const light = require('./light-d6947636.js');
const index$1 = require('./index-4b96acc9.js');
require('./colors-a0e2d25f.js');
require('./kimlikApi-f4f62100.js');
require('./apiBase-b14a8285.js');
require('./data-transfer-field-0ce05c1a.js');
require('./BaseField-d019ade6.js');
require('./filter-d5040f65.js');
require('./cookie-ea977378.js');
require('./_commonjsHelpers-206db00d.js');

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

exports.mentornity_console_app_root = MentornityConsoleAppRoot;
