{"size": 2339, "ext": "js", "max_stars_repo_path": "docs/templates/js/intro-scdocs.js", "max_stars_repo_name": "rambdev/sugarcube-2", "max_stars_repo_stars_event_min_datetime": "2022-02-16T07:54:05.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-16T07:54:05.000Z", "max_issues_repo_path": "docs/templates/js/intro-scdocs.js", "max_issues_repo_name": "rambdev/sugarcube-2", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "docs/templates/js/intro-scdocs.js", "max_forks_repo_name": "rambdev/sugarcube-2", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.6554621849, "max_line_length": 88, "alphanum_fraction": 0.5664814023}
/*
	`SCDocs` SETUP
*/
(function () {
	'use strict';

	var hasWebStorage = function (storeId) {
		try {
			var store = window[storeId];
			var tid   = '_scd_' + String(Date.now());
			store.setItem(tid, tid);
			var result = store.getItem(tid) === tid;
			store.removeItem(tid);
			return result;
		}
		catch (ex) { /* no-op */ }

		return false;
	};

	if (
		   !document.head
		|| !document.addEventListener
		|| !document.querySelector
		|| !Array.prototype.indexOf
		|| !Object.defineProperties
		|| !hasWebStorage('localStorage')
	) {
		return;
	}

	var storageKey = 'sugarcube-v2-docs-cfg';
	var SCDocs = Object.freeze(Object.defineProperties(Object.create(null), {
		getConfig : {
			value : function (key) {
				var json = localStorage.getItem(storageKey);

				if (json) {
					try {
						var config = JSON.parse(json);

						if (config !== null && typeof config === 'object' && config.hasOwnProperty(key)) {
							return config[key];
						}
					}
					catch (ex) { /* no-op */ }
				}

				return undefined;
			}
		},
		setConfig : {
			value : function (key, value) {
				var config;

				try {
					config = JSON.parse(localStorage.getItem(storageKey));
				}
				catch (ex) { /* no-op */ }

				if (config === null || typeof config !== 'object') {
					config = {};
				}

				config[key] = value;

				try {
					localStorage.setItem(storageKey, JSON.stringify(config));
					return true;
				}
				catch (ex) { /* no-op */ }

				return false;
			}
		},
		removeConfig : {
			value : function (key) {
				var json = localStorage.getItem(storageKey);

				if (json) {
					try {
						var config = JSON.parse(json);

						if (config !== null && typeof config === 'object' && config.hasOwnProperty(key)) {
							delete config[key];

							if (Object.keys(config).length > 0) {
								localStorage.setItem(storageKey, JSON.stringify(config));
							}
							else {
								localStorage.removeItem(storageKey);
							}
						}

						return true;
					}
					catch (ex) { /* no-op */ }
				}

				return false;
			}
		},
		clearConfig : {
			value : function () {
				localStorage.removeItem(storageKey);
				return true;
			}
		},
		arrayFrom : {
			value : function (arrayLike) {
				return Array.prototype.slice.call(arrayLike);
			}
		}
	}));
	Object.defineProperty(window, 'SCDocs', {
		value : SCDocs
	});
})();
