(()=>{function e(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;var n,c,o=[],l=!0,a=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){a=!0,c=e}finally{try{l||null==r.return||r.return()}finally{if(a)throw c}}return o}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r0)return u.parentNode&&u.parentNode.removeChild(u),"continue";var y=m.map((function(e){var t=document.createElement("a");t.classList.add("child-link"),t.href="/"+e.href;var r=document.createElement("div");return r.textContent=e.title.replace("
",""),t.append(r),t}));u.innerHTML="",m.length>0&&(itemTitle=document.createElement("div"),itemTitle.classList.add("search-item-title","justify-between"),titleTextElement=document.createElement("span"),titleTextElement.innerHTML=m.length>0?s+" ("+d.count+")":"",viewAllElement=document.createElement("a"),viewAllElement.classList.add("cursor-pointer"),viewAllElement.addEventListener("click",(function(){window.location.href="/view-all/"+s.replaceAll(" ","-")+"/?q="+r.searchFor})),viewAllElement.innerHTML="View All",itemTitle.append(titleTextElement),itemTitle.append(viewAllElement),u.append(itemTitle),n.push({title:s,ids:d.ids})),(c=u).append.apply(c,e(y)),o.append(u)},a=0,i=Object.entries(c);a2&&(window.location.href="/view-all/?q="+r.searchFor)}))})).catch((function(e){return console.error(e)}))})),document.querySelector(".display-search").addEventListener("click",(function(){return c(document.querySelector(".search-bar"),"opacity-0","opacity-100"),c(document.querySelector(".search-bar"),"-z-1","z-50"),void document.querySelector(".search").focus()})),document.querySelector(".close-search").addEventListener("click",(function(){return o()})),document.querySelector(".search").addEventListener("keydown",(function(e){"Escape"==e.key&&o(),"ArrowDown"===e.key&&(e.preventDefault(),document.querySelector(".search-results").querySelectorAll(".child-link").forEach((function(e,t,r){r[0].focus(),e.addEventListener("keydown",(function(n){if(n.preventDefault(),"ArrowDown"==n.key){if(r.length-1===t)return;r[t+1].focus()}else if("ArrowUp"==n.key){if(0===t)return void document.querySelector(".search").focus();r[t-1].focus()}else if("Enter"==n.key){if(!e.href)return;window.location.href=e.href}else"Escape"==n.key&&o()}))})))})),document.querySelector("body").addEventListener("click",(function(){document.querySelector(".search-bar").contains(document.activeElement)||o()}))}))})();