const navMenu=document.getElementById("nav-menu"),navToggle=document.getElementById("nav-toggle"),navClose=document.getElementById("nav-close");window.addEventListener("load",(function(){document.getElementById("preloader").style.display="none"})),navToggle.addEventListener("click",(()=>{navMenu.classList.toggle("show")})),navClose.addEventListener("click",(()=>{navMenu.classList.remove("show")}));const navLink=document.querySelectorAll(".nav-link");function setActiveLink(e){navLink.forEach((e=>e.classList.remove("active"))),e.classList.add("active"),localStorage.setItem("activeLink",e.getAttribute("href"))}function mostrarAlerta(e,t,n,o=!0){const c=document.querySelector(".alerta");c&&c.remove();const a=document.createElement("DIV");a.textContent=e,a.classList.add("alerta"),"error"===t&&a.classList.add("error");document.querySelector(n).appendChild(a),o&&setTimeout((()=>{a.remove()}),3e3)}document.addEventListener("DOMContentLoaded",(e=>{const t=document.getElementById("cartModal"),n=document.getElementById("cart-icon"),o=document.getElementsByClassName("close")[0];n.onclick=function(){t.style.display="block"},o.onclick=function(){t.style.display="none"},window.onclick=function(e){e.target==t&&(t.style.display="none")}})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".icono-compartir"),t=document.querySelector(".share-options"),n=document.getElementById("copy-btn"),o=document.getElementById("link-url");e.addEventListener("click",(()=>{t.classList.toggle("show")})),document.addEventListener("click",(function(n){e.contains(n.target)||t.contains(n.target)||t.classList.remove("show")})),n.addEventListener("click",(()=>{const e=o.textContent;navigator.clipboard.writeText(e).then((()=>{alert("URL copiada al portapapeles")})).catch((e=>{console.error("Error al copiar la URL: ",e)}))}))}));