import{d as L}from"./products.B7Arsgtk.js";import"./hoisted.CmkSwYHY.js";function d(){const o=document.querySelector("#search-container");window.location.pathname,o?.classList.add("bg-black"),o?.classList.remove("bg-white")}window.addEventListener("popstate",d);document.addEventListener("astro:page-load",()=>{d();const o=document.querySelector(".burger-menu"),u=document.querySelector(".mobile-menu"),m=document.querySelector("#mobile-menu-container"),g=document.querySelector("body");o?.addEventListener("click",()=>{o.classList.toggle("open"),u?.classList.toggle("open"),m?.classList.toggle("open"),g?.classList.toggle("overflow-hidden")});const r=L.productsByCategory;function p(){const l={};for(const n in r)for(const s in r[n])l[s]=r[n][s];return l}const b=p(),i=document.getElementById("searchInput"),e=document.getElementById("suggestions");i&&i.addEventListener("input",l=>{const n=i.value.toLowerCase();if(e&&(e.innerHTML="",e.classList.remove("p-2","w-max")),n.length>0){e&&e.classList.add("p-2","w-max");const s=Object.entries(b).filter(t=>t[0].toLowerCase().includes(n));if(s.length>0)s.forEach(t=>{const c=document.createElement("li"),a=document.createElement("a"),f=t[1].category?t[1].category.toLowerCase():"";a.classList.add("font-jost","px-[2px]","py-[1px]","block","border-b","hover:border-black","hover:bg-gray-200"),a.href=`/products/${f}/${t[0].toLowerCase().split(" ").join("-")}`,a.textContent=t[0],c.appendChild(a),e&&e.appendChild(c)});else{const t=document.createElement("li"),c=document.createElement("a");c.textContent="Nuk u gjet asnje produkt",t.appendChild(c),e&&e.appendChild(t)}}})},{once:!1});
