(function (window, document) {
	'use strict';

	var config = window.titaniumSuiteHeaderConfig || {};
	var storageKey = config.storageKey || 'titaniumSuiteDarkMode';
	var extraDarkClass = config.extraDarkClass || '';
	var enabled = false;

	try {
		enabled = window.localStorage.getItem(storageKey) === '1';
	} catch (error) {
		enabled = false;
	}

	document.documentElement.classList.toggle('titanium-suite-admin-dark', enabled);
	if (extraDarkClass) {
		document.documentElement.classList.toggle(extraDarkClass, enabled);
	}
}(window, document));
