document.addEventListener("DOMContentLoaded",function(){const c=document.getElementById("downloads-search"),a=document.getElementById("downloads-category-filter"),l=document.querySelectorAll(".downloads-category-card");function s(){const n=c?c.value.toLowerCase().trim():"",o=a?a.value:"";l.forEach(function(t){const e=t.getAttribute("data-category"),u=t.querySelectorAll(".download-item");let i=0;if(!(!o||e===o)){t.style.display="none";return}u.forEach(function(r){const y=r.getAttribute("data-title")||"",d=!n||y.includes(n);r.style.display=d?"":"none",d&&i++}),t.style.display=i>0?"":"none"})}c&&c.addEventListener("input",s),a&&a.addEventListener("change",s),document.addEventListener("click",function(n){const o=n.target.closest(".btn-copy-hash");if(!o)return;n.preventDefault();const t=o.getAttribute("data-hash");t&&navigator.clipboard&&navigator.clipboard.writeText(t).then(function(){const e=o.querySelector("i");e&&(e.classList.remove("fa-copy"),e.classList.add("fa-check"),setTimeout(function(){e.classList.remove("fa-check"),e.classList.add("fa-copy")},2e3))})})});
