<?php
/**
 * Readabler
 * Web accessibility for Your WordPress site.
 * Exclusively on https://1.envato.market/readabler
 *
 * @encoding        UTF-8
 * @version         2.0.5
 * @copyright       (C) 2018 - 2024 Merkulove ( https://merkulov.design/ ). All rights reserved.
 * @license         Envato License https://1.envato.market/KYbje
 * @contributors    Nemirovskiy Vitaliy (nemirovskiyvitaliy@gmail.com), Dmitry Merkulov (dmitry@merkulov.design)
 * @support         help@merkulov.design
 * @license         Envato License https://1.envato.market/KYbje
 **/

namespace Merkulove\Readabler;

use Merkulove\Readabler\Unity\Plugin;
use Merkulove\Readabler\Unity\Settings;
use Merkulove\Readabler\Unity\TabGeneral;

/** Exit if accessed directly. */
if ( ! defined( 'ABSPATH' ) ) {
	header( 'Status: 403 Forbidden' );
	header( 'HTTP/1.1 403 Forbidden' );
	exit;
}

final class Config {

	/**
	 * The one true Settings.
	 *
	 * @since 1.0.0
	 * @access private
	 * @var Config
	 **/
	private static $instance;

	/**
	 * All accessibility modes
	 * @return array
	 */
	public static function all_accessibility_modes(): array {

		return array(
			'profile_epilepsy'             => esc_html__( 'Epilepsy Safe Mode', 'readabler' ),
			'profile_visually_impaired'    => esc_html__( 'Visually Impaired Mode', 'readabler' ),
			'profile_cognitive_disability' => esc_html__( 'Cognitive Disability Mode', 'readabler' ),
			'profile_adhd_friendly'        => esc_html__( 'ADHD Friendly Mode', 'readabler' ),
			'profile_blind_users'          => esc_html__( 'Blindness Mode', 'readabler' ),
			'content_scaling'              => esc_html__( 'Content Scaling', 'readabler' ),
			'readable_font'                => esc_html__( 'Readable Font', 'readabler' ),
			'dyslexia_font'                => esc_html__( 'Dyslexia Friendly', 'readabler' ),
			'highlight_titles'             => esc_html__( 'Highlight Titles', 'readabler' ),
			'highlight_links'              => esc_html__( 'Highlight Links', 'readabler' ),
			'font_sizing'                  => esc_html__( 'Font Sizing', 'readabler' ),
			'line_height'                  => esc_html__( 'Line Height', 'readabler' ),
			'letter_spacing'               => esc_html__( 'Letter Spacing', 'readabler' ),
			'text_magnifier'               => esc_html__( 'Text Magnifier', 'readabler' ),
			'align_center'                 => esc_html__( 'Align Center', 'readabler' ),
			'align_left'                   => esc_html__( 'Align Left', 'readabler' ),
			'align_right'                  => esc_html__( 'Align Right', 'readabler' ),
			'dark_contrast'                => esc_html__( 'Dark Contrast', 'readabler' ),
			'light_contrast'               => esc_html__( 'Light Contrast', 'readabler' ),
			'monochrome'                   => esc_html__( 'Monochrome', 'readabler' ),
			'high_saturation'              => esc_html__( 'High Saturation', 'readabler' ),
			'high_contrast'                => esc_html__( 'High Contrast', 'readabler' ),
			'low_saturation'               => esc_html__( 'Low Saturation', 'readabler' ),
			'mute_sounds'                  => esc_html__( 'Mute Sounds', 'readabler' ),
			'hide_images'                  => esc_html__( 'Hide Images', 'readabler' ),
			'hide_emoji'                  => esc_html__( 'Hide Emoji', 'readabler' ),
			'virtual_keyboard'             => esc_html__( 'Virtual Keyboard', 'readabler' ),
			'reading_guide'                => esc_html__( 'Reading Guide', 'readabler' ),
			'cognitive_reading'            => esc_html__( 'Cognitive Reading', 'readabler' ),
			'useful_links'                 => esc_html__( 'Useful Links', 'readabler' ),
			'stop_animations'              => esc_html__( 'Stop Animations', 'readabler' ),
			'reading_mask'                 => esc_html__( 'Reading Mask', 'readabler' ),
			'highlight_hover'              => esc_html__( 'Highlight Hover', 'readabler' ),
			'highlight_focus'              => esc_html__( 'Highlight Focus', 'readabler' ),
			'big_black_cursor'             => esc_html__( 'Big Dark Cursor', 'readabler' ),
			'big_white_cursor'             => esc_html__( 'Big Light Cursor', 'readabler' ),
			'text_to_speech'               => esc_html__( 'Text to Speech', 'readabler' ),
			'voice_navigation'             => esc_html__( 'Voice Navigation', 'readabler' ),
			'keyboard_navigation'          => esc_html__( 'Keyboard Navigation', 'readabler' )
		);

	}

	/**
	 * Google languages
	 * @var string[][]
	 */
	public static $languages = [ // TODO: Remove this and make works this with Language.php
		'da-DK'  => 'Danish (Dansk)',
		'nl-NL'  => 'Dutch (Nederlands)',
		'en-AU'  => 'English (Australian)',
		'en-GB'  => 'English (UK)',
		'en-US'  => 'English (US)',
		'fr-CA'  => 'French Canada (Français)',
		'fr-FR'  => 'French France (Français)',
		'de-DE'  => 'German (Deutsch)',
		'it-IT'  => 'Italian (Italiano)',
		'ja-JP'  => 'Japanese (日本語)',
		'ko-KR'  => 'Korean (한국어)',
		'nb-NO'  => 'Norwegian (Norsk)',
		'pl-PL'  => 'Polish (Polski)',
		'pt-BR'  => 'Portuguese Brazil (Português)',
		'pt-PT'  => 'Portuguese Portugal (Portugal)',
		'ru-RU'  => 'Russian (Русский)',
		'sk-SK'  => 'Slovak (Slovenčina)',
		'es-ES'  => 'Spanish (Español)',
		'sv-SE'  => 'Swedish (Svenska)',
		'tr-TR'  => 'Turkish (Türkçe)',
		'uk-UA'  => 'Ukrainian (Українська)',
		'ar-XA'  => 'Arabic (العربية)',
		'cs-CZ'  => 'Czech (Čeština)',
		'el-GR'  => 'Greek (Ελληνικά)',
		'en-IN'  => 'Indian English',
		'fi-FI'  => 'Finnish (Suomi)',
		'vi-VN'  => 'Vietnamese (Tiếng Việt)',
		'id-ID'  => 'Indonesian (Bahasa Indonesia)',
		'fil-PH' => 'Philippines (Filipino)',
		'hi-IN'  => 'Hindi (हिन्दी)',
		'hu-HU'  => 'Hungarian (Magyar)',
		'cmn-CN' => 'Chinese (官话)',
		'cmn-TW' => 'Taiwanese Mandarin (中文(台灣))',
		'bn-IN'  => 'Bengali (বাংলা)',
		'gu-IN'  => 'Gujarati (ગુજરાતી)',
		'kn-IN'  => 'Kannada (ಕನ್ನಡ)',
		'ml-IN'  => 'Malayalam (മലയാളം)',
		'ta-IN'  => 'Tamil (தமிழ்)',
		'te-IN'  => 'Telugu (తెలుగు)',
		'th-TH'  => 'Thai (ภาษาไทย)',
		'yue-HK' => 'Yue Chinese',
		'ro-RO'  => 'Romanian (Română)',
		'ca-ES'  => 'Catalan (Català)',
		'af-ZA'  => 'Afrikaans (South Africa)',
		'bg-BG'  => 'Bulgarian (Български)',
		'lv-LV'  => 'Latvian (Latvietis)',
		'sr-RS'  => 'Serbian (Cрпски)',
		'is-IS'  => 'Icelandic (Íslensk)',
		'es-US'  => 'US Spanish (Hispanoamericano)',
		'ms-MY'  => 'Malay (Malaysia)',
		'nl-BE'  => 'Dutch (Belgium)',
		'pa-IN'  => 'Punjabi (India)',
		'mr-IN'  => 'Marathi (India)',
		'eu-ES'  => 'Basque (Vasco)',
		'gl-ES'  => 'Galician (Galego)'
	];

	/**
	 * Prepare plugin settings by modifying the default one.
	 *
	 * @return void
	 **@since 1.0.0
	 * @access public
	 *
	 */
	public function prepare_settings() {

		/** Reset API Key on fatal error. */
		if ( isset( $_GET['reset-api-key'] ) && '1' === $_GET['reset-api-key'] ) {
			$this->reset_api_key();
		}

		// Include the necessary WordPress file
		if ( ! function_exists( 'is_plugin_active' ) ) {
			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
		}

		/** PHP version check. */
		if ( version_compare( PHP_VERSION, '8.1', '<' ) ) {
			if ( ! is_plugin_active( 'readabler-php7/readabler-php7.php' ) ) {
				add_action( 'admin_notices', function () {
					echo self::msg_php_7_to_8();
				} );
			}
		} else {
			if ( is_plugin_active( 'readabler-php7/readabler-php7.php' ) ) {
				add_action( 'admin_notices', function () {
					echo wp_sprintf(
						'<div class="notice notice-warning is-dismissible"><p><strong>Readabler</strong>: %s %s. %s</p></div>', //But you have installed the PHP 7 compatibility plugin.
						esc_html__( 'You have installed the Readabler PHP 7 compatibility plugin. Your current PHP version is', 'readabler' ),
						esc_attr( PHP_VERSION ),
						esc_html__( 'Readabler plugin compatible with PHP 8.1 or higher by default, you can deactivate and remove the Readabler PHP 7 compatibility plugin.', 'readabler' )
					);
				} );
			}
		}

		$isAi = Tools::is_readabler_ai();

		$this->add_server_requirements();

		TabReadablerGeneral::get_instance();
		TabOpenButton::get_instance();
		TabModalPopup::get_instance();
		TabDesign::get_instance();

		$tabs = Plugin::get_tabs();

		/** Create Accessibility Statement tab. */
		$tabs = $this->create_tab_accessibility_statement( $tabs );

		/** Create Hot Keys tab. */
		$tabs = $this->create_tab_hot_keys( $tabs );

		/** Create tab with initial configuration */
		$tabs = $this->create_tab_initial_settings( $tabs );
		$tabs = $this->refresh_settings( $tabs );
		$tabs = $this->create_tab_initial_settings( $tabs );

		/** Set updated tabs. */
		Plugin::set_tabs( $tabs );

		if ( ! $isAi ) {
			TabVoiceNavigation::tab();
		}
		TabAnalyzer::tab();
		TabTextToSpeech::tab();
		TabUsageAnalytics::tab();
		TabAdvanced::tab();
		do_action( 'readabler_add_tabs' );

		if ( ! $isAi ) {
			TabVoiceNavigation::controls();
		}
		TabAnalyzer::controls();
		try {
			TabTextToSpeech::controls( Settings::get_instance()->options );
		} catch ( \Exception $e ) {
			// Handle exception if needed
		}
		TabUsageAnalytics::controls();
		TabAdvanced::controls();
		do_action( 'readabler_add_controls' );

		/** Refresh settings. */
		Settings::get_instance()->get_options();

	}

	private function refresh_settings( $tabs ): array {

		/** Set updated tabs. */
		Plugin::set_tabs( $tabs );

		/** Refresh settings. */
		Settings::get_instance()->get_options();

		/** Get default plugin settings. */
		return Plugin::get_tabs();

	}

	/**
	 * Create Accessibility Statement tab.
	 *
	 * @param array $tabs - List of tabs with all settings and fields.
	 *
	 * @return array - List of tabs with all settings and fields.
	 **@since  1.0.0
	 * @access public
	 *
	 */
	private function create_tab_accessibility_statement( array $tabs ): array {

		/** Add Open button tab after Design. */
		$offset = 4; // Position for new tab.
		$tabs   = array_slice( $tabs, 0, $offset, true ) +
		          [
			          'accessibility_statement' => [
				          'enabled'    => true,
				          'class'      => TabGeneral::class,
				          'label'      => esc_html__( 'Accessibility Statement', 'readabler' ),
				          'title'      => esc_html__( 'Accessibility Statement Settings', 'readabler' ),
				          'show_title' => true,
				          'icon'       => 'accessibility_new',
				          'fields'     => []
			          ]
		          ] +
		          array_slice( $tabs, $offset, null, true );

		# Website Owner's Contact Info header
		$tabs['accessibility_statement']['fields']['owner_contact_info_header'] = [
			'type'        => 'header',
			'label'       => esc_html__( 'Website Owner\'s Contact Info', 'readabler' ),
			'description' => esc_html__( 'This contact info will be used in the Accessibility Statement, to comply with the WCAG 2.1, and therefore with the ADA and Section 508. We do not use personal information and abides by data privacy laws.', 'readabler' ),
			'default'     => ''
		];

		# Accessibility statement type
		$tabs['accessibility_statement']['fields']['statement_type'] = [
			'type'        => 'select',
			'label'       => esc_html__( 'Statement source', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'Accessibility Statement', 'readabler' ),
			'description' => esc_html__( 'Select the accessibility statement source', 'readabler' ),
			'default'     => 'inline',
			'options'     => [
				'inline' => esc_html__( 'Generated by plugin', 'readabler' ),
				'link'   => esc_html__( 'Custom link', 'readabler' ),
				'hide'   => esc_html__( 'None', 'readabler' )
			]
		];

		# Statement URL
		$tabs['accessibility_statement']['fields']['statement_link'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Statement URL', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'URL', 'readabler' ),
			'description' => esc_html__( 'Insert the accessibility statement link', 'readabler' ),
			'default'     => '',
			'attr'        => [
				'maxlength' => '4500'
			]
		];

		# Header generated
		$tabs['accessibility_statement']['fields']['owner_contact_info_header_generated'] = [
			'type'        => 'header',
			'description' => '<strong>' . esc_html__( 'Note', 'readabler' ) . ': ' . '</strong>' . esc_html__( 'If you are an agency purchasing for a client, you should enter your client\'s contact information.', 'readabler' ),
			'default'     => ''
		];

		# Website's Owner Name
		$tabs['accessibility_statement']['fields']['owner_name'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Website\'s Owner Name', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'Full Name', 'readabler' ),
			'default'     => '',
			'attr'        => [
				'maxlength' => '4500'
			]
		];

		# Website's Owner Email
		$tabs['accessibility_statement']['fields']['owner_email'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Website\'s Owner Email', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'E-mail', 'readabler' ),
			'default'     => '',
			'attr'        => [
				'maxlength' => '4500'
			]
		];

		# Website's Owner Phone
		$tabs['accessibility_statement']['fields']['owner_phone'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Website\'s Owner Phone', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'phone', 'readabler' ),
			'default'     => '',
			'attr'        => [
				'maxlength' => '4500'
			]
		];

		# Accessibility Statement
		$tabs['accessibility_statement']['fields']['statement_text'] = [
			'type'        => 'editor',
			'label'       => esc_html__( 'Accessibility Statement', 'readabler' ) . ':',
			'description' => esc_html__( 'You can use special placeholders: {siteDomain}, {currentDate}, {contactEmail}, {contactName}, {contactPhone}. They will be replaced with their values accordingly.', 'readabler' ),
			'default'     => $this->get_default_statement(),
			'attr'        => [
				'textarea_rows' => '20',
			]
		];

		return $tabs;

	}

	/**
	 * Create Hot Keys tab.
	 *
	 * @param array $tabs - List of tabs with all settings and fields.
	 *
	 * @return array - List of tabs with all settings and fields.
	 **@since  1.0.0
	 * @access public
	 *
	 */
	private function create_tab_hot_keys( array $tabs ): array {

		/** Shorthand for plugin settings. */
		$options = Settings::get_instance()->options;

		/** Add Hot keys tab after Accessibility Statement. */
		$offset = 5; // Position for new tab.
		$tabs   = array_slice( $tabs, 0, $offset, true ) +
		          [
			          'hot_keys' => [
				          'enabled'    => true,
				          'class'      => TabGeneral::class,
				          'label'      => esc_html__( 'Hot Keys', 'readabler' ),
				          'title'      => esc_html__( 'Hot Keys Settings', 'readabler' ),
				          'show_title' => true,
				          'icon'       => 'keyboard',
				          'fields'     => []
			          ]
		          ] +
		          array_slice( $tabs, $offset, null, true );

		# Supported Keys header
		$tabs['hot_keys']['fields']['supported_keys_header'] = [
			'type'        => 'header',
			'label'       => esc_html__( 'Supported Keys', 'readabler' ),
			'description' => $this->get_keys_description(),
			'default'     => ''
		];

		# Divider
		$key                                = 'divider_popup_scroll';
		$tabs['hot_keys']['fields'][ $key ] = [ 'type' => 'divider', 'default' => '' ];

		# Open the Accessibility Interface
		$tabs['hot_keys']['fields']['hot_key_open_interface'] = [
			'type'        => 'text',
			'label'       => esc_html__( 'Open Hot Key', 'readabler' ) . ':',
			'placeholder' => esc_html__( 'Open Hot Key', 'readabler' ),
			'description' => esc_html__( 'Open the Accessibility Interface.', 'readabler' ),
			'default'     => 'Alt+9',
			'attr'        => [
				'maxlength' => '50'
			]
		];

		/** If Keyboard Navigation is enabled. */
		if (
			'on' === $options['keyboard_navigation'] ||
			'on' === $options['profile_blind_users']
		) {

			# Keyboard Menus Navigation
			$tabs['hot_keys']['fields']['hot_key_menu'] = [
				'type'        => 'text',
				'label'       => esc_html__( 'Keyboard Menus Navigation', 'readabler' ) . ':',
				'placeholder' => esc_html__( 'Menus Navigation Hot Key', 'readabler' ),
				'default'     => 'M',
				'attr'        => [
					'maxlength' => '10'
				]
			];

			# Keyboard Headings Navigation
			$tabs['hot_keys']['fields']['hot_key_headings'] = [
				'type'        => 'text',
				'label'       => esc_html__( 'Keyboard Headings Navigation', 'readabler' ) . ':',
				'placeholder' => esc_html__( 'Headings Navigation Hot Key', 'readabler' ),
				'default'     => 'H',
				'attr'        => [
					'maxlength' => '10'
				]
			];

			# Keyboard Forms Navigation
			$tabs['hot_keys']['fields']['hot_key_forms'] = [
				'type'        => 'text',
				'label'       => esc_html__( 'Keyboard Forms Navigation', 'readabler' ) . ':',
				'placeholder' => esc_html__( 'Forms Navigation Hot Key', 'readabler' ),
				'default'     => 'F',
				'attr'        => [
					'maxlength' => '10'
				]
			];

			# Keyboard Buttons Navigation
			$tabs['hot_keys']['fields']['hot_key_buttons'] = [
				'type'        => 'text',
				'label'       => esc_html__( 'Keyboard Buttons Navigation', 'readabler' ) . ':',
				'placeholder' => esc_html__( 'Buttons Navigation Hot Key', 'readabler' ),
				'default'     => 'B',
				'attr'        => [
					'maxlength' => '10'
				]
			];

			# Keyboard Graphics Navigation
			$tabs['hot_keys']['fields']['hot_key_graphics'] = [
				'type'        => 'text',
				'label'       => esc_html__( 'Keyboard Graphics Navigation', 'readabler' ) . ':',
				'placeholder' => esc_html__( 'Graphics Navigation Hot Key', 'readabler' ),
				'default'     => 'G',
				'attr'        => [
					'maxlength' => '10'
				]
			];
		}

		return $tabs;

	}

	/**
	 * Create Initial settings tab.
	 *
	 * @param $tabs
	 *
	 * @return array|array[]
	 */
	private function create_tab_initial_settings( $tabs ): array {

		$options = Settings::get_instance()->options;

		/** Add Open button tab after General. */
		$offset = 7; // Position for new tab.
		$tabs   = array_slice( $tabs, 0, $offset, true ) +
		          [
			          'initial_settings' => [
				          'enabled'    => true,
				          'class'      => TabGeneral::class,
				          'label'      => esc_html__( 'Initial settings', 'readabler' ),
				          'title'      => esc_html__( 'Initial accessibility settings', 'readabler' ),
				          'show_title' => true,
				          'icon'       => 'settings_suggest',
				          'fields'     => []
			          ]
		          ] +
		          array_slice( $tabs, $offset, null, true );

		$tabs['initial_settings']['fields']['start_config_settings_header'] = [
			'type'        => 'header',
			'description' => esc_html__( 'These settings determine which modes will be automatically applied to the page after it is loaded.', 'readabler' ),
			'default'     => ''
		];

		$tabs['initial_settings']['fields']['start_config'] = [
			'type'        => 'chosen',
			'label'       => esc_html__( 'Start Configuration', 'readabler' ) . ':',
			'description' => esc_html__( 'Select the modes that will be applied after the page is loaded.', 'readabler' ),
			'options'     => $this->get_start_config_options( $options ),
			'default'     => '',
			'attr'        => [
				'multiple' => 'multiple',
			],
		];

		$key                                        = 'start_content_scaling';
		$tabs['initial_settings']['fields'][ $key ] = [
			'type'        => 'slider',
			'label'       => esc_html__( 'Content Scaling', 'readabler' ) . ':',
			'description' => esc_html__( 'Initial content scaling', 'readabler' ) . ':' .
			                 ' <strong>' .
			                 esc_html( ( ! empty( $options[ $key ] ) ) ? $options[ $key ] : esc_html__( 'Default', 'readabler' ) ) .
			                 '</strong>' . ' %',
			'min'         => -100,
			'max'         => 100,
			'step'        => 5,
			'default'     => 0,
			'discrete'    => true,
		];

		$key                                        = 'start_font_sizing';
		$tabs['initial_settings']['fields'][ $key ] = [
			'type'        => 'slider',
			'label'       => esc_html__( 'Font Sizing', 'readabler' ) . ':',
			'description' => esc_html__( 'Initial font sizing', 'readabler' ) . ':' .
			                 ' <strong>' .
			                 esc_html( ( ! empty( $options[ $key ] ) ) ? $options[ $key ] : esc_html__( 'Default', 'readabler' ) ) .
			                 '</strong>' . ' %',
			'min'         => -100,
			'max'         => 100,
			'step'        => 5,
			'default'     => 0,
			'discrete'    => true,
		];

		$key                                        = 'start_line_height';
		$tabs['initial_settings']['fields'][ $key ] = [
			'type'        => 'slider',
			'label'       => esc_html__( 'Line Height', 'readabler' ) . ':',
			'description' => esc_html__( 'Initial line height', 'readabler' ) . ':' .
			                 ' <strong>' .
			                 esc_html( ( ! empty( $options[ $key ] ) ) ? $options[ $key ] : esc_html__( 'Default', 'readabler' ) ) .
			                 '</strong>' . ' %',
			'min'         => -100,
			'max'         => 100,
			'step'        => 5,
			'default'     => 0,
			'discrete'    => true,
		];

		$key                                        = 'start_letter_spacing';
		$tabs['initial_settings']['fields'][ $key ] = [
			'type'        => 'slider',
			'label'       => esc_html__( 'Letter Spacing', 'readabler' ) . ':',
			'description' => esc_html__( 'Initial letter spacing', 'readabler' ) . ':' .
			                 ' <strong>' .
			                 esc_html( ( ! empty( $options[ $key ] ) ) ? $options[ $key ] : esc_html__( 'Default', 'readabler' ) ) .
			                 '</strong>' . ' %',
			'min'         => -100,
			'max'         => 100,
			'step'        => 5,
			'default'     => 0,
			'discrete'    => true,
		];

		$tabs['initial_settings']['fields']['save_config'] = [
			'type'        => 'switcher',
			'label'       => esc_html__( 'Save config', 'readabler' ),
			'description' => esc_html__( 'Save the configuration and apply it after page reload.', 'readabler' ),
			'default'     => 'on',
		];

		$tabs['initial_settings']['fields']['ignore_saved_config'] = [
			'type'        => 'switcher',
			'label'       => esc_html__( 'Ignore user config', 'readabler' ),
			'description' => esc_html__( 'Ignore the user configuration that was saved after previous visit.', 'readabler' ),
			'default'     => 'off',
		];

		return $tabs;

	}

	/**
	 * Get an initial config options list
	 *
	 * @param $settings
	 *
	 * @return array
	 */
	private function get_start_config_options( $settings ): array {

		// Add only ON options
		$options_list = array();
		foreach ( self::all_accessibility_modes() as $option_name => $title ) {

			if ( ($settings[ $option_name ] ?? 'off') === 'on' ) {

				$options_list[ $option_name ] = $title;

			}

		}

		return $options_list;

	}

	/**
	 * Return notes for hot keys tab.
	 *
	 * @return string
	 **@since  1.0.0
	 * @access public
	 *
	 */
	private function get_keys_description(): string {

		return
			esc_html__( 'Hot Keys understands the following modifiers: ', 'readabler' ) .
			'<b>⇧</b> <b>shift</b> <b>option</b> <b>⌥</b> <b>alt</b> <b>ctrl</b> <b>⌃</b> <b>control</b> <b>command</b> <b>⌘</b>' .
			'<br><br>' .
			esc_html__( 'The following special keys can be used for shortcuts: ', 'readabler' ) .
			'<b>backspace</b> <b>tab</b> <b>clear</b> <b>enter</b> <b>return</b> <b>esc</b> <b>escape</b> <b>space</b> <b>up</b> <b>down</b> <b>left</b> <b>right</b> <b>home</b> <b>end</b> <b>pageup</b> <b>pagedown</b> <b>del</b> <b>delete</b> <b>f1..f12</b>' .
			'<br><br>' .
			esc_html__( 'Use the ', 'readabler' ) .
			'<b>+</b>' .
			esc_html__( ' to create key combination and use ', 'readabler' ) .
			'<b>,</b>' .
			esc_html__( ' to join multiple combinations', 'readabler' ) . ': ' .
			'<b>ctrl+b, ⇧+r, ⌘+f</b>';
	}

	/**
	 * Create General tab.
	 *
	 * @param array $tabs - List of tabs with all settings and fields.
	 *
	 * @return array - List of tabs with all settings and fields.
	 **@since  1.0.0
	 * @access public
	 *
	 */
	private function create_tab_general( array $tabs ): array {

		# Accessibility profiles header
        $tabs['general']['fields']['accessibility_profiles_header'] = [
            'type'              => 'header',
            'label'             => esc_html__( 'Accessibility modes', 'readabler' ),
            'description'       => esc_html__( 'Select pre-built disability modes.', 'readabler' ),
            'default'           => ''
        ];

		$tabs['general']['fields']['accessibility_profiles_heading'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Section title', 'readabler' ),
			'placeholder'       => esc_html__( 'Show section title', 'readabler' ),
			'description'       => esc_html__( 'Enable/disable the display of the current section  title.', 'readabler' ),
			'default'           => 'on',
		];

		# Epilepsy Safe Mode
		$tabs['general']['fields']['profile_epilepsy'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Epilepsy Safe Mode', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Epilepsy Safe Mode', 'readabler' ),
			'description'       => esc_html__( 'This profile enables people with epilepsy to use the website safely by eliminating the risk of seizures that result from flashing or blinking animations and risky color combinations.', 'readabler' ),
			'default'           => 'on',
		];

		# Visually Impaired Mode
		$tabs['general']['fields']['profile_visually_impaired'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Visually Impaired Mode', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Visually Impaired Mode', 'readabler' ),
			'description'       => esc_html__( 'This mode adjusts the website for the convenience of users with visual impairments such as Degrading Eyesight, Tunnel Vision, Cataract, Glaucoma, and others.', 'readabler' ),
			'default'           => 'on',
		];

		# Cognitive Disability Mode
		$tabs['general']['fields']['profile_cognitive_disability'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Cognitive Disability Mode', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Cognitive Disability Mode', 'readabler' ),
			'description'       => esc_html__( 'This mode provides different assistive options to help users with cognitive impairments such as Dyslexia, Autism, CVA, and others, to focus on the essential elements of the website more easily.', 'readabler' ),
			'default'           => 'on',
		];

		# ADHD Friendly Mode
		$tabs['general']['fields']['profile_adhd_friendly'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'ADHD Friendly Mode', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'ADHD Friendly Mode', 'readabler' ),
			'description'       => esc_html__( 'This mode helps users with ADHD and Neurodevelopmental disorders to read, browse, and focus on the main website elements more easily while significantly reducing distractions.', 'readabler' ),
			'default'           => 'on',
		];

		# Blind Users Profile
		$tabs['general']['fields']['profile_blind_users'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Blindness Mode', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Blindness Mode', 'readabler' ),
			'description'       => esc_html__( 'This mode configures the website to be compatible with screen-readers such as JAWS, NVDA, VoiceOver, and TalkBack. A screen-reader is software for blind users that is installed on a  computer and smartphone, and websites must be compatible with it.', 'readabler' ),
			'default'           => 'on',
		];

        # Divider
        $key = 'divider_online_dictionary';
        $tabs['general']['fields'][$key] = ['type' => 'divider', 'default' => ''];


        # Accessibility profiles header
        $tabs['general']['fields']['online_dictionary_header'] = [
            'type'              => 'header',
            'label'             => esc_html__( 'Online Dictionary', 'readabler' ),
            'description'       => esc_html__( 'Select Wikipedia Online Dictionary.', 'readabler' ),
            'default'           => ''
        ];

        $tabs['general']['fields']['online_dictionary_heading'] = [
            'type'              => 'switcher',
            'label'             => esc_html__( 'Section heading', 'readabler' ) . ':',
            'placeholder'       => esc_html__( 'Section heading', 'readabler' ),
            'description'       => esc_html__( 'Enable/disable the display of the current section heading.', 'readabler' ),
            'default'           => 'on',
        ];

        # Online Dictionary
        $tabs['general']['fields']['online_dictionary'] = [
            'type'              => 'switcher',
            'label'             => esc_html__( 'Online Dictionary', 'readabler' ) . ':',
            'placeholder'       => esc_html__( 'Online Dictionary', 'readabler' ),
            'description'       => esc_html__( 'Allows searching for phrases, abbreviations and concepts for Cognitive Disorders.', 'readabler' ),
            'default'           => 'on',
        ];

		# Wikipedia Language
		$tabs['general']['fields']['dictionary_language'] = [
			'type'              => 'select',
			'label'             => esc_html__( 'Dictionary language', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Dictionary language', 'readabler' ),
			'description'       => esc_html__( 'Select the Wikipedia language to search', 'readabler' ),
			'default'           => 'auto',
			'options'           => [
				'auto' => esc_html__( 'Auto', 'readabler' ),
				'ar' => esc_html( 'العربية' ), // Al-ʿArabīyah
				'ast' => esc_html( 'Asturianu' ),
				'az' => esc_html( 'Azərbaycanca' ),
				'bg' => esc_html( 'Български' ), // Bǎlgarski
				'nan' => esc_html( 'Bân-lâm-gú / Hō-ló-oē' ),
				'bn' => esc_html( 'বাংলা' ), // Bangla
				'be' => esc_html( 'Беларуская' ), // Belaruskaya
				'ca' => esc_html( 'Català' ),
				'cs' => esc_html( 'Čeština' ), // čeština
				'cy' => esc_html( 'Cymraeg' ), // Cymraeg
				'da' => esc_html( 'Dansk' ),
				'de' => esc_html( 'Deutsch' ),
				'et' => esc_html( 'Eesti' ),
				'el' => esc_html( 'Ελληνικά' ), // Ellīniká
				'en' => esc_html( 'English' ), // English
				'es' => esc_html( 'Español' ),
				'eo' => esc_html( 'Esperanto' ),
				'eu' => esc_html( 'Euskara' ),
				'fa' => esc_html( 'فارسی' ), // Fārsi
				'fr' => esc_html( 'Français' ),
				'gl' => esc_html( 'Galego' ),
				'hy' => esc_html( 'Հայերեն' ), // Hayeren
				'hi' => esc_html( 'हिन्दी' ), // Hindī
				'hr' => esc_html( 'Hrvatski' ),
				'id' => esc_html( 'Bahasa Indonesia' ),
				'it' => esc_html( 'Italiano' ),
				'is' => esc_html( 'íslenskur' ),// Islandic
				'he' => esc_html( 'עברית' ), // Ivrit
				'ka' => esc_html( 'ქართული' ), // Kartuli
				'la' => esc_html( 'Latina' ),
				'lv' => esc_html( 'Latviešu' ),
				'lt' => esc_html( 'Lietuvių' ),
				'hu' => esc_html( 'Magyar' ),
				'mk' => esc_html( 'Македонски' ), // Makedonski
				'arz' => esc_html( 'مصرى' ), // Maṣrī
				'ms' => esc_html( 'Bahasa Melayu' ),
				'min' => esc_html( 'Bahaso Minangkabau' ),
				'my' => esc_html( 'မြန်မာဘာသာ' ), // Myanmarsar
				'nl' => esc_html( 'Nederlands' ),
				'ja' => esc_html( '日本語' ), // Nihongo
				'nb' => esc_html( 'Norsk (bokmål)' ),
				'nn' => esc_html( 'Norsk (nynorsk)' ),
				'ce' => esc_html( 'Нохчийн' ), // Noxçiyn
				'uz' => esc_html( 'Oʻzbekcha / Ўзбекча' ),
				'pl' => esc_html( 'Polski' ),
				'pt' => esc_html( 'Português' ),
				'kk' => esc_html( 'Қазақша / Qazaqşa / قازاقشا' ),
				'ro' => esc_html( 'Română' ), // Română
				'ru' => esc_html( 'Русский' ), // Russkiy
				'ceb' => esc_html( 'Sinugboanong Binisaya' ),
				'sk' => esc_html( 'Slovenčina' ),
				'sl' => esc_html( 'Slovenščina' ),
				'sr' => esc_html( 'Српски / Srpski' ),
				'sh' => esc_html( 'Srpskohrvatski / Српскохрватски' ),
				'fi' => esc_html( 'Suomi' ), // suomi
				'sv' => esc_html( 'Svenska' ),
				'ta' => esc_html( 'தமிழ்' ), // Tamiḻ
				'tt' => esc_html( 'Татарча / Tatarça' ),
				'th' => esc_html( 'ภาษาไทย' ), // Phasa Thai
				'tg' => esc_html( 'Тоҷикӣ' ), // Tojikī
				'azb' => esc_html( 'تۆرکجه' ), // Türkce
				'tr' => esc_html( 'Türkçe' ), // Türkçe
				'uk' => esc_html( 'Українська' ), // Ukrayins’ka
				'ur' => esc_html( 'اردو' ), // Urdu
				'vi' => esc_html( 'Tiếng Việt' ),
				'vo' => esc_html( 'Volapük' ),
				'war' => esc_html( 'Winaray' ),
				'yue' => esc_html( '粵語' ), // Yuht Yúh / Jyut6 jyu5
				'zh' => esc_html( '中文' ), // Zhōngwén
				'ko' => esc_html( '한국어' ), // Hangugeo

			]
		];

        # Divider
		$key = 'divider_profile_blind_users';
		$tabs['general']['fields'][$key] = ['type' => 'divider', 'default' => ''];

		# Readable Experience header
		$tabs['general']['fields']['readable_experience_header'] = [
			'type'              => 'header',
			'label'             => esc_html__( 'Readable Experience', 'readabler' ),
			'description'       => esc_html__( 'Tools enable users to adjust how the content of your site is displayed, so it is as readable as possible to their particular disability.', 'readabler' ),
			'default'           => ''
		];

        $tabs['general']['fields']['readable_experience_heading'] = [
            'type'              => 'switcher',
            'label'             => esc_html__( 'Section title', 'readabler' ),
            'placeholder'       => esc_html__( 'Show section title', 'readabler' ),
            'description'       => esc_html__( 'Enable/disable the display of the current section  title.', 'readabler' ),
            'default'           => 'on',
        ];

		# Content Scaling
		$tabs['general']['fields']['content_scaling'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Content Scaling', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Content Scaling', 'readabler' ),
			'description'       => esc_html__( 'The option allows scaling the website content. ', 'readabler' ),
			'default'           => 'on',
		];

		# Readable Font
		$tabs['general']['fields']['readable_font'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Readable Font', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Readable Font', 'readabler' ),
			'description'       => esc_html__( 'The option converts the content font to a more readable one.', 'readabler' ),
			'default'           => 'on',
		];

		# Dyslexia Friendly
		$tabs['general']['fields']['dyslexia_font'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Dyslexia Friendly', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Dyslexia Friendly', 'readabler' ),
			'description'       => esc_html__( 'The option adapts the font to be more convenient for Dyslexic users.', 'readabler' ),
			'default'           => 'on',
		];

		# Highlight Titles
		$tabs['general']['fields']['highlight_titles'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Highlight Titles', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Highlight Titles', 'readabler' ),
			'description'       => esc_html__( 'The option highlights the titles with borders for all site content.', 'readabler' ),
			'default'           => 'on',
		];

		# Highlight Links
		$tabs['general']['fields']['highlight_links'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Highlight Links', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Highlight Links', 'readabler' ),
			'description'       => esc_html__( 'The option highlights the links with borders for all site content.', 'readabler' ),
			'default'           => 'on',
		];

		# Text Magnifier
		$tabs['general']['fields']['text_magnifier'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Text Magnifier', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Text Magnifier', 'readabler' ),
			'description'       => esc_html__( 'The option allows you to display specific text in the magnifier on hover.', 'readabler' ),
			'default'           => 'on',
		];

		# Font Sizing
		$tabs['general']['fields']['font_sizing'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Font Sizing', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Font Sizing', 'readabler' ),
			'description'       => esc_html__( 'The option allows you to change the text font size as a percentage.', 'readabler' ),
			'default'           => 'on',
		];

		# Line Height
		$tabs['general']['fields']['line_height'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Line Height', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Line Height', 'readabler' ),
			'description'       => esc_html__( 'The option allows you to change the font line-height as a percentage', 'readabler' ),
			'default'           => 'on',
		];

		# Letter Spacing
		$tabs['general']['fields']['letter_spacing'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Letter Spacing', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Letter Spacing', 'readabler' ),
			'description'       => esc_html__( 'The option allows you to change the text letter spacing as a percentage.', 'readabler' ),
			'default'           => 'on',
		];

		# Align Center
		$tabs['general']['fields']['align_center'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Align Center', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Align Center', 'readabler' ),
			'description'       => esc_html__( 'The option aligns the website content to the center.', 'readabler' ),
			'default'           => 'on',
		];

		# Align Left
		$tabs['general']['fields']['align_left'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Align Left', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Align Left', 'readabler' ),
			'description'       => esc_html__( 'The option aligns the website content to the left.', 'readabler' ),
			'default'           => 'on',
		];

		# Align Right
		$tabs['general']['fields']['align_right'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Align Right', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Align Right', 'readabler' ),
			'description'       => esc_html__( 'The option aligns the website content to the right.', 'readabler' ),
			'default'           => 'on',
		];

		# Divider
		$key = 'divider_align_right';
		$tabs['general']['fields'][$key] = ['type' => 'divider', 'default' => ''];

		# Visually Pleasing Experience Header
		$tabs['general']['fields']['visually_pleasing_experience_header'] = [
			'type'              => 'header',
			'label'             => esc_html__( 'Visually Pleasing Experience', 'readabler' ),
			'description'       => esc_html__( 'Tools relating to the colorization of your website.', 'readabler' ),
			'default'           => ''
		];

        $tabs['general']['fields']['visually_pleasing_heading'] = [
            'type'              => 'switcher',
            'label'             => esc_html__( 'Section title', 'readabler' ) . ':',
            'placeholder'       => esc_html__( 'Show section title', 'readabler' ),
            'description'       => esc_html__( 'Enable/disable the display of the current section  title.', 'readabler' ),
            'default'           => 'on',
        ];

		# Dark Contrast
		$tabs['general']['fields']['dark_contrast'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Dark Contrast', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Dark Contrast', 'readabler' ),
			'description'       => esc_html__( 'The option sets a dark contrast for the content of the entire site.', 'readabler' ),
			'default'           => 'on',
		];

		# Light Contrast
		$tabs['general']['fields']['light_contrast'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Light Contrast', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Light Contrast', 'readabler' ),
			'description'       => esc_html__( 'The option sets a light contrast for the content of the entire site.', 'readabler' ),
			'default'           => 'on',
		];

		# Monochrome
		$tabs['general']['fields']['monochrome'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Monochrome', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Monochrome', 'readabler' ),
			'description'       => esc_html__( 'The option applies a monochrome color scheme for the entire site.', 'readabler' ),
			'default'           => 'on',
		];

		# High Saturation
		$tabs['general']['fields']['high_saturation'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'High Saturation', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'High Saturation', 'readabler' ),
			'description'       => esc_html__( 'The option adds color saturation for the entire site content.', 'readabler' ),
			'default'           => 'on',
		];

		# High Contrast
		$tabs['general']['fields']['high_contrast'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'High Contrast', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'High Contrast', 'readabler' ),
			'description'       => esc_html__( 'The option increases color contrast for the entire site content.', 'readabler' ),
			'default'           => 'on',
		];

		# Low Saturation
		$tabs['general']['fields']['low_saturation'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Low Saturation', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Low Saturation', 'readabler' ),
			'description'       => esc_html__( 'The option minimizes color saturation for the entire site content.', 'readabler' ),
			'default'           => 'on',
		];

		# Text Colors
		$tabs['general']['fields']['text_colors'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Text Colors', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Text Colors', 'readabler' ),
			'description'       => esc_html__( 'The option displays a color picker to adjust the text color of website content.', 'readabler' ),
			'default'           => 'on',
		];

		# Title Colors
		$tabs['general']['fields']['title_colors'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Title Colors', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Title Colors', 'readabler' ),
			'description'       => esc_html__( 'The option displays a color picker to adjust the title color of website content.', 'readabler' ),
			'default'           => 'on',
		];

		# Background Colors
		$tabs['general']['fields']['background_colors'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Background Colors', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Background Colors', 'readabler' ),
			'description'       => esc_html__( 'The option displays a color picker to adjust the background color of website content.', 'readabler' ),
			'default'           => 'on',
		];

		# Divider
		$key = 'divider_background_colors';
		$tabs['general']['fields'][$key] = ['type' => 'divider', 'default' => ''];

		# Easy Orientation
		$tabs['general']['fields']['easy_orientation_header'] = [
			'type'              => 'header',
			'label'             => esc_html__( 'Easy Orientation', 'readabler' ),
			'description'       => esc_html__( 'Tools for people with visual impairments, cognitive disabilities, or motor impairments to orient better at the site.', 'readabler' ),
			'default'           => ''
		];

        $tabs['general']['fields']['easy_orientation_heading'] = [
            'type'              => 'switcher',
            'label'             => esc_html__( 'Section title', 'readabler' ),
            'placeholder'       => esc_html__( 'Show section title', 'readabler' ),
            'description'       => esc_html__( 'Enable/disable the display of the current section  title.', 'readabler' ),
            'default'           => 'on',
        ];

		# Mute Sounds
		$tabs['general']['fields']['mute_sounds'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Mute Sounds', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Mute Sounds', 'readabler' ),
			'description'       => esc_html__( 'The option mutes all sounds on the site.', 'readabler' ),
			'default'           => 'on',
		];

		# Hide Images
		$tabs['general']['fields']['hide_images'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Hide Images', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Hide Images', 'readabler' ),
			'description'       => esc_html__( 'The option hides all images on the site.', 'readabler' ),
			'default'           => 'on',
		];

		# Virtual Keyboard
		$tabs['general']['fields']['virtual_keyboard'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Virtual Keyboard', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Virtual Keyboard', 'readabler' ),
			'description'       => esc_html__( 'The option enables the virtual keyboard when any one of the input fields is active.', 'readabler' ),
			'default'           => 'on',
		];

		# Reading Guide
		$tabs['general']['fields']['reading_guide'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Reading Guide', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Reading Guide', 'readabler' ),
			'description'       => esc_html__( 'The option displays a guideline that follows the cursor and helps to concentrate only on the specific text.', 'readabler' ),
			'default'           => 'on',
		];

		$tabs['general']['fields']['cognitive_reading'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Cognitive Reading', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Cognitive Reading', 'readabler' ),
			'description'       => esc_html__( 'The option allows you to turn on the cognitive reading mode for quick understanding of the text based on word recognition by the brain.', 'readabler' ),
			'default'           => 'on',
		];

		# Useful Links
		$tabs['general']['fields']['useful_links'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Useful Links', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Useful Links', 'readabler' ),
			'description'       => esc_html__( 'The option displays a select list of useful site links to get the necessary info without site research.', 'readabler' ),
			'default'           => 'on',
		];

		# Stop Animations
		$tabs['general']['fields']['stop_animations'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Stop Animations', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Stop Animations', 'readabler' ),
			'description'       => esc_html__( 'The option allows disabling animations on the site.', 'readabler' ),
			'default'           => 'on',
		];

		# Reading Mask
		$tabs['general']['fields']['reading_mask'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Reading Mask', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Reading Mask', 'readabler' ),
			'description'       => esc_html__( 'The option creates a horizontal mask of a certain height that follows the cursor and allows you to select and focus only on a certain part of the content.', 'readabler' ),
			'default'           => 'on',
		];

		# Highlight Hover
		$tabs['general']['fields']['highlight_hover'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Highlight Hover', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Highlight Hover', 'readabler' ),
			'description'       => esc_html__( 'The option highlights the hover area by borders.', 'readabler' ),
			'default'           => 'on',
		];

		# Highlight Focus
		$tabs['general']['fields']['highlight_focus'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Highlight Focus', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Highlight Focus', 'readabler' ),
			'description'       => esc_html__( 'The option highlights the focus area by borders.', 'readabler' ),
			'default'           => 'on',
		];

		# Big Black Cursor
		$tabs['general']['fields']['big_black_cursor'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Big Dark Cursor', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Big Dark Cursor', 'readabler' ),
			'description'       => esc_html__( 'The option enables a large black cursor instead of the regular one.', 'readabler' ),
			'default'           => 'on',
		];

		# Big White Cursor
		$tabs['general']['fields']['big_white_cursor'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Big Light Cursor', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Big Light Cursor', 'readabler' ),
			'description'       => esc_html__( 'The option enables a large white cursor instead of the regular one.', 'readabler' ),
			'default'           => 'on',
		];

		# Text to Speech
		$tabs['general']['fields']['text_to_speech'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Text to Speech', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Text to Speech', 'readabler' ),
			'description'       => esc_html__( 'The option enables the Text-to-Speech feature. Audio is generated when the user highlights text. Before activating this feature, please upload the API key file on the "Text to Speech" tab.', 'readabler' ),
			'default'           => 'off',
		];

		$tabs[ 'general' ][ 'fields' ][ 'voice_navigation' ] = [
			'type'          => 'switcher',
			'label'         => esc_html__( 'Voice Navigation', 'readabler' ),
			'placeholder'   => esc_html__( 'Voice Navigation', 'readabler' ),
			'description'   => esc_html__( 'The option enables the voice navigation feature. The user can navigate through the site using voice commands.', 'readabler' ),
			'default'       => 'on',
		];

		# Keyboard Navigation
		$tabs['general']['fields']['keyboard_navigation'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Keyboard Navigation', 'readabler' ) . ':',
			'placeholder'       => esc_html__( 'Keyboard Navigation', 'readabler' ),
			'description'       => esc_html__( 'The option enables a keyboard navigation feature.', 'readabler' ),
			'default'           => 'on',
		];

		$key = 'divider_themes_settings';
		$tabs['general']['fields'][$key] = ['type' => 'divider', 'default' => ''];

		$tabs['general']['fields']['themes_settings_header'] = [
			'type'              => 'header',
			'label'             => esc_html__( 'WordPress Themes & Plugins compatibility', 'readabler' ),
			'description'       => esc_html__( 'A group of settings to improve the compatibility of the plugin with other plugins or themes.', 'readabler' ),
			'default'           => ''
		];

		$tabs['general']['fields']['noscript'] = [
			'type' => 'switcher',
			'label' => esc_html__( 'Noscript markup', 'readabler'),
			'description' => esc_html__( 'Add the noscript tag to the site markup.', 'readabler'),
			'default' => 'on',
		];

		$tabs['general']['fields']['assets_condition'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Required JS and CSS', 'readabler' ),
			'description'       => esc_html__( 'Load only scripts and styles necessary for work with current settings.', 'readabler' ),
			'default'           => 'on',
		];

		$tabs['general']['fields']['late_load'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'Late CSS and JS loading', 'readabler' ),
			'description'       => esc_html__( 'Enables later loading of styles and scripts. Use this option if some of the pages are missing Readable styles or scripts.', 'readabler' ),
			'default'           => 'off',
		];

		$tabs['general']['fields']['copyscape_skip'] = [
			'type'              => 'switcher',
			'label'             => esc_html__( 'CopyScape Skip', 'readabler' ),
			'description'       => esc_html__( 'Ignore the markup of the plugin interface when parsing with the CopyScape', 'readabler' ),
			'default'           => 'off',
		];

		return $tabs;

	}

	/**
	 * Return default Accessibility Statement text.
	 *
	 * @return string
	 **@since  1.0.0
	 * @access public
	 *
	 */
	public function get_default_statement(): string {

		// language=HTML
		return "<section>
	<h2>Accessibility Statement</h2>
	<ul>
	    <li>{siteDomain}</li>
	    <li>{currentDate}</li>
	</ul>
</section>

<h3>Compliance status</h3>
<p>We firmly believe that the internet should be available and accessible to anyone, and are committed to providing a website that is accessible to the widest possible audience,
regardless of circumstance and ability.</p>

<p>To fulfill this, we aim to adhere as strictly as possible to the World Wide Web Consortium’s (W3C) Web Content Accessibility Guidelines 2.1 (WCAG 2.1) at the AA level.
These guidelines explain how to make web content accessible to people with a wide array of disabilities. Complying with those guidelines helps us ensure that the website is accessible
to all people: blind people, people with motor impairments, visual impairment, cognitive disabilities, and more.</p>

<p>This website utilizes various technologies that are meant to make it as accessible as possible at all times. We utilize an accessibility interface that allows persons with specific
disabilities to adjust the website’s UI (user interface) and design it to their personal needs.</p>

<p>Additionally, the website utilizes an AI-based application that runs in the background and optimizes its accessibility level constantly. This application remediates the website’s HTML,
adapts Its functionality and behavior for screen-readers used by the blind users, and for keyboard functions used by individuals with motor impairments.</p>

<p>If you’ve found a malfunction or have ideas for improvement, we’ll be happy to hear from you. You can reach out to the website’s operators by using the following email {contactEmail}</p>

<h3>Screen-reader and keyboard navigation</h3>

<p>Our website implements the ARIA attributes (Accessible Rich Internet Applications) technique, alongside various different behavioral changes, to ensure blind users visiting with
screen-readers are able to read, comprehend, and enjoy the website’s functions. As soon as a user with a screen-reader enters your site, they immediately receive
a prompt to enter the Screen-Reader Profile so they can browse and operate your site effectively. Here’s how our website covers some of the most important screen-reader requirements,
alongside console screenshots of code examples:</p>

<ol>
 	<li>
 	
	    <p><strong>Screen-reader optimization: </strong>we run a background process that learns the website’s components from top to bottom, to ensure ongoing compliance even when updating the website.
	In this process, we provide screen-readers with meaningful data using the ARIA set of attributes. For example, we provide accurate form labels;
	descriptions for actionable icons (social media icons, search icons, cart icons, etc.); validation guidance for form inputs; element roles such as buttons, menus, modal dialogues (popups),
	and others. Additionally, the background process scans all the website’s images and provides an accurate and meaningful image-object-recognition-based description as an ALT (alternate text) tag
	for images that are not described. It will also extract texts that are embedded within the image, using an OCR (optical character recognition) technology.
	To turn on screen-reader adjustments at any time, users need only to press the Alt+1 keyboard combination. Screen-reader users also get automatic announcements to turn the Screen-reader mode on
	as soon as they enter the website.</p>
	
		<p>These adjustments are compatible with all popular screen readers, including JAWS and NVDA.</p>
	</li>
 	<li>
 		<p><strong>Keyboard navigation optimization: </strong>The background process also adjusts the website’s HTML, and adds various behaviors using JavaScript code to make the website operable by the keyboard. This includes the ability to navigate the website using the Tab and Shift+Tab keys, operate dropdowns with the arrow keys, close them with Esc, trigger buttons and links using the Enter key, navigate between radio and checkbox elements using the arrow keys, and fill them in with the Spacebar or Enter key.Additionally, keyboard users will find quick-navigation and content-skip menus, available at any time by clicking Alt+1, or as the first elements of the site while navigating with the keyboard. The background process also handles triggered popups by moving the keyboard focus towards them as soon as they appear, and not allow the focus drift outside it.</p> 
		<p>Users can also use shortcuts such as “M” (menus), “H” (headings), “F” (forms), “B” (buttons), and “G” (graphics) to jump to specific elements.</p>
	</li>
</ol>

<h3>Disability profiles supported in our website</h3>
<ul>
 	<li><strong>Epilepsy Safe Mode:</strong> this profile enables people with epilepsy to use the website safely by eliminating the risk of seizures that result from flashing or blinking animations and risky color combinations.</li>
 	<li><strong>Visually Impaired Mode:</strong> this mode adjusts the website for the convenience of users with visual impairments such as Degrading Eyesight, Tunnel Vision, Cataract, Glaucoma, and others.</li>
 	<li><strong>Cognitive Disability Mode:</strong> this mode provides different assistive options to help users with cognitive impairments such as Dyslexia, Autism, CVA, and others, to focus on the essential elements of the website more easily.</li>
 	<li><strong>ADHD Friendly Mode:</strong> this mode helps users with ADHD and Neurodevelopmental disorders to read, browse, and focus on the main website elements more easily while significantly reducing distractions.</li>
 	<li><strong>Blindness Mode:</strong> this mode configures the website to be compatible with screen-readers such as JAWS, NVDA, VoiceOver, and TalkBack. A screen-reader is software for blind users that is installed on a  computer and smartphone, and websites must be compatible with it.</li>
 	<li><strong>Keyboard Navigation Profile (Motor-Impaired):</strong> this profile enables motor-impaired persons to operate the website using the keyboard Tab, Shift+Tab, and the Enter keys. Users can also use shortcuts such as “M” (menus), “H” (headings), “F” (forms), “B” (buttons), and “G” (graphics) to jump to specific elements.</li>
</ul>

<h3>Additional UI, design, and readability adjustments</h3>
<ol>
 	<li><strong>Font adjustments –</strong> users, can increase and decrease its size, change its family (type), adjust the spacing, alignment, line height, and more.</li>
 	<li><strong>Color adjustments –</strong> users can select various color contrast profiles such as light, dark, inverted, and monochrome. Additionally, users can swap color schemes of titles, texts, and backgrounds, with over seven different coloring options.</li>
 	<li><strong>Animations –</strong> person with epilepsy can stop all running animations with the click of a button. Animations controlled by the interface include videos, GIFs, and CSS flashing transitions.</li>
 	<li><strong>Content highlighting –</strong> users can choose to emphasize important elements such as links and titles. They can also choose to highlight focused or hovered elements only.</li>
 	<li><strong>Audio muting –</strong> users with hearing devices may experience headaches or other issues due to automatic audio playing. This option lets users mute the entire website instantly.</li>
 	<li><strong>Cognitive disorders –</strong> we utilize a search engine that is linked to Wikipedia and Wiktionary, allowing people with cognitive disorders to decipher meanings of phrases, initials, slang, and others.</li>
 	<li><strong>Additional functions –</strong> we provide users the option to change cursor color and size, use a printing mode, enable a virtual keyboard, and many other functions.</li>
</ol>

<h3>Browser and assistive technology compatibility</h3>

<p>We aim to support the widest array of browsers and assistive technologies as possible, so our users can choose the best fitting tools for them, with as few limitations as possible. Therefore, we have worked very hard to be able to support all major systems that comprise over 95% of the user market share including Google Chrome, Mozilla Firefox, Apple Safari, Opera and Microsoft Edge, JAWS and NVDA (screen readers).</p>

<h3>Notes, comments, and feedback</h3>
<p>Despite our very best efforts to allow anybody to adjust the website to their needs. There may still be pages or sections that are not fully accessible, are in the process of becoming accessible, or are lacking an adequate technological solution to make them accessible. Still, we are continually improving our accessibility, adding, updating and improving its options and features, and developing and adopting new technologies. All this is meant to reach the optimal level of accessibility, following technological advancements. For any assistance, please reach out to {contactEmail}</p>";

	}

	/**
	 * Reset API Key on fatal error.
	 *
	 * @return void
	 **@since  1.0.0
	 * @access public
	 */
	public function reset_api_key() {

		/** Remove API Key. */
		$options            = get_option( 'mdp_readabler_text_to_speech_settings' );
		$options['api_key'] = '';

		/** Save new value. */
		update_option( 'mdp_readabler_text_to_speech_settings', $options );

		/** Go to Text to Speech tab. */
		wp_redirect( admin_url( '/admin.php?page=mdp_readabler_settings&tab=text_to_speech' ) );
		exit;

	}

	/**
	 * @return string
	 */
	private static function msg_php_7_to_8(): string {

		if ( version_compare( PHP_VERSION, '8.1', '<' ) ) {
			if ( ! is_plugin_active( 'readabler-php7/readabler-php7.php' ) ) {
				return wp_sprintf(
					'<div class="notice notice-error is-dismissible">
                                    <p>
                                        <strong>Readabler</strong>: %s %s. %s <strong>%s</strong> %s <code>%s</code> %s <code>%s</code> %s <a href="https://1.envato.market/cc-downloads" target="_blank">Codecanyon</a>.
                                    </p>
                                </div>',
					esc_html__( 'Plugin requires PHP 8.1 or higher. Your current PHP version is', 'readabler' ),
					esc_attr( PHP_VERSION ),
					esc_html__( 'Update your PHP version or install', 'readabler' ),
					'Readabler - PHP7',
					esc_html__( 'extension to continue using the plugin with the current PHP version. Find the', 'readabler' ),
					'readabler-php7.zip',
					esc_html__( 'in', 'readabler' ),
					'plugin/readabler-extensions',
					esc_html__( 'folder of the Readabler package downloaded from', 'readabler' )
				);
			}
		}

		return '';

	}

	/**
	 * Display server requirements on status tab
	 */
	private function add_server_requirements() {

		$tabs = Plugin::get_tabs();

		// Remove 'Delete plugin, settings, and data' option from Uninstall tab.
		unset( $tabs['migration']['fields']['delete_plugin']['options']['plugin+settings+data'] );

		$tabs['status']['reports']['server']['mbstring_installed'] = true;
		$tabs['status']['reports']['server']['server_time']        = true;
		$tabs['status']['reports']['server']['allow_url_fopen']    = false;
		$tabs['status']['reports']['server']['dom_installed']      = true;
		$tabs['status']['reports']['server']['xml_installed']      = true;
		$tabs['status']['reports']['server']['bcmath_installed']   = true;

		$tabs['custom_css']['description']  = esc_html__( 'Use custom CSS for more flexibility in customizing the accessibility window view for your theme. The parent class of the block with the player:', 'readabler' ) . ' <code>.mdp-readabler-wrapper</code>';
		$tabs['assignments']['description'] = esc_html__( 'Set the conditions under which the accessibility window will be shown/hidden on the page. Find out more about this from', 'readabler' ) . ' <a href="https://docs.merkulov.design/assignments-in-wordpress-plugins/" target="_blank">' . esc_html__( 'Assignments in WordPress plugin', 'readabler' ) . '</a>.';
		$tabs['activation']['description']  = esc_html__( 'Activate the plugin with a purchase key to get access to all plugin features including hidden features. Note that an unauthenticated plugin only has basic functionality for audio generation.', 'readabler' );
		$tabs['migration']['description']   = esc_html__( 'Use this tab to export (import) plugin settings to another site and(or) permanently remove all settings from the current site.', 'readabler' );
		$tabs['status']['description']      = esc_html__( 'This tab displays the status of the plugin and the server requirements for its operation. Please note that all the necessary items are marked with a green checkmark, otherwise the plugin will not be able to work on your server.', 'readabler' );
		$tabs['updates']['description']     = esc_html__( 'This page contains all information about plugin updates and also allows you to check for an update for this plugin only.', 'readabler' );

		Plugin::set_tabs( $tabs );

	}

	/**
	 * Main Settings Instance.
	 * Insures that only one instance of Settings exists in memory at any one time.
	 *
	 * @static
	 * @return Config
	 **@since 1.0.0
	 * @access public
	 *
	 */
	public static function get_instance(): Config {

		if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) {

			self::$instance = new self;

		}

		return self::$instance;

	}

}
