<commit_before>import ns from 'imajs/client/core/namespace.js';

ns.namespace('Core.Window');

/**
 * Client-side implementation of the {@code Core.Interface.Window} utility API.
 *
 * @class Client
 * @implements ns.Core.Interface.Window
 * @namespace Core.Window
 * @module Core
 * @submodule Core.Window
 */
class Client extends ns.Core.Interface.Window {

	/**
	 * Returns {@code true} if invoked at the client side.
	 *
	 * @inheritdoc
	 * @override
	 * @method isClient
	 * @return {boolean} {@code true} if invoked at the client side.
	 */
	isClient() {
		return true;
	}

	/**
	 * Returns {@code true} if the cookies are set and processed on the HTTP
	 * requests and responses automatically by the environment.
	 *
	 * @inheritdoc
	 * @override
	 * @method isCookieEnabled
	 * @return {boolean} {@code true} if cookies are handled automatically by the
	 *         environment.
	 */
	isCookieEnabled() {
		return navigator.cookieEnabled;
	}

	/**
	 * Returns {@code true} if the session storage is supported.
	 *
	 * @inheritdoc
	 * @override
	 * @method hasSessionStorage
	 * @return {boolean} {@code true} if the session storage is supported.
	 */
	hasSessionStorage() {
		return !!window.sessionStorage;
	}

	/**
	 * Returns {@code true} if the WebSockets are supported.
	 *
	 * @inheritdoc
	 * @override
	 * @method hasWebSocket
	 * @return {boolean} {@code true} if the WebSockets are supported.
	 */<commit_msg>#! fix detection bug in sessionStorage for safari incognito window<commit_after>import ns from 'imajs/client/core/namespace.js';

ns.namespace('Core.Window');

/**
 * Client-side implementation of the {@code Core.Interface.Window} utility API.
 *
 * @class Client
 * @implements ns.Core.Interface.Window
 * @namespace Core.Window
 * @module Core
 * @submodule Core.Window
 */
class Client extends ns.Core.Interface.Window {

	/**
	 * Returns {@code true} if invoked at the client side.
	 *
	 * @inheritdoc
	 * @override
	 * @method isClient
	 * @return {boolean} {@code true} if invoked at the client side.
	 */
	isClient() {
		return true;
	}

	/**
	 * Returns {@code true} if the cookies are set and processed on the HTTP
	 * requests and responses automatically by the environment.
	 *
	 * @inheritdoc
	 * @override
	 * @method isCookieEnabled
	 * @return {boolean} {@code true} if cookies are handled automatically by the
	 *         environment.
	 */
	isCookieEnabled() {
		return navigator.cookieEnabled;
	}

	/**
	 * Returns {@code true} if the session storage is supported.
	 *
	 * @inheritdoc
	 * @override
	 * @method hasSessionStorage
	 * @return {boolean} {@code true} if the session storage is supported.
	 */
	hasSessionStorage() {
		if (!!window.sessionStorage) {
			var sessionKey = 'IMA.jsTest';

			try {
				sessionStorage.setItem(sessionKey, 1);
				sessionStorage.removeItem(sessionKey);
			} catch(e){
				return false;
			}

			return true;
		}
		return false;
	}

	/**
	 * Returns {@code true} if the WebSockets are supported.
	 *
	 * @inheritdoc
	 * @override
	 * @method hasWebSocket
	 * @return {boolean} {@code true} if the WebSockets are supported.
	 */
{'fraction_non_alphanumeric': 0.11908593498551658, 'fraction_numerical': 0.000321853878339234, 'mean_word_length': 3.3529411764705883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '490853', 'n_tokens_mistral': 984, 'n_tokens_neox': 885, 'n_words': 301}