text: const btn=document.querySelector(".talk"),content=document.querySelector(".content"),greetings=["Hi there!","Whats Going on?","I am good how are you?"];let google="https://www.googleapis.com/customsearch/v1?key=INSERT_YOUR_API_KEY&cx=017576662512468239146:omuauf_lfve&q=lectures";const SpeechRecognition=window.SpeechRecognition||window.webkitSpeechRecognition,recognition=new SpeechRecognition;function readOutLoud(e){const t=new SpeechSynthesisUtterance;if(speach.text="I am not sure what that means",e.includes("Hi")){grettings[Math.floor(Math.random()*greetings.length)];t.finalText}else if(e.includes("How are you")){grettings[2];t.finalText}else if(e.includes("Todays Date")){new Date;t.finalText}t.volume=1,t.rate=1,t.pitch=2,window.speechSynthesis.speak(t)}recognition.onstart=(()=>{const e=document.querySelector(".sonar-wave1"),t=document.querySelector(".sonar-emitter");e.innerHTML="Recording",console.log(e),e.classList.add("sonar-wave"),t.style.backgroundColor=" red",elementIsClicked=!0,console.log("voice is activated, you can talk to me")}),recognition.onend=(()=>{const e=document.querySelector(".sonar-wave1"),t=document.querySelector(".sonar-emitter");e.innerHTML="Record",t.style.backgroundColor="#ff00005c",e.classList.remove("sonar-wave"),console.log("voice is deactivated")}),recognition.onresult=(e=>{const t=e.resultIndex,o=e.results[t[0]].transcript;content.textContent=o,readOutLoud(o)}),btn.addEventListener("click",()=>{recognition.start()});