jQuery(document).ready(function($) {

	/* Eye to show/hide API key */
	function hideAPIKey(passwordSelector) {

		const togglePassword  = document.querySelector(passwordSelector+" #togglePassword");
		const password        = document.querySelector(passwordSelector+" input");

		if(togglePassword) {
			togglePassword.addEventListener("click", function () {
					// toggle the type attribute
					const type = password.getAttribute("type") === "password" ? "text" : "password";
					password.setAttribute("type", type);

					// toggle the icon
					this.classList.toggle("close-eye");
			});
		}
	}

	hideAPIKey("#password-openai");


	/* Click & copy */
    jQuery( "#custom-request-buttons > p" ).on( "click", function() {
		var currentTextareaVal = jQuery("#textarea-editable").html();
		var contentTag = event.target;
		jQuery("#textarea-editable").append(jQuery(this).children('span').clone());
		jQuery('#textarea-editable span').prop("contenteditable", false);
	  });

	/* Prevent line break */
	jQuery(document).on('keypress', '#textarea-editable', function(e){
		return e.which != 13;
	});

});



document.addEventListener("DOMContentLoaded", function() {

	function showValueInterval(value) {

		// Display tooltip
		var output = document.getElementById("value-interval");
		if( null != slider ) {
			output.innerHTML = slider.value + '%';
		}
	
	}

});


function checkRights() {
    var premium_version = false;
    

    return premium_version;
}