(()=>{const e="a[data-gb-prefetch][href]";const t={};document.body.addEventListener("mouseenter",(function(n){const r=n.target.closest(e);if(r){var o;if(null!==(o=t[r.href])&&void 0!==o&&o)return;const e=document.createElement("link");e.rel="prefetch",e.href=r.href,document.head.appendChild(e),t[r.href]=!0}}),!0),document.addEventListener("click",(t=>{const n=t.target.closest(e);if(n&&n.href){const e=n.getAttribute("data-gb-router-target");if(!e)return;t.preventDefault();const r=n.href;(function(e){return fetch(e).then((e=>{if(!e.ok)throw new Error("Network error");return e.text()})).catch((e=>{console.error("Error fetching prefetched page:",e)}))})(r).then((t=>{(function(e="",t=""){const n=document.querySelector(`[data-gb-router-region="${e}"]`);if(!n||!t)throw new Error("Missing container or prefetched content");const r=n.parentNode.querySelector(".gb-query-loop-pagination"),o=document.createElement("div");o.innerHTML=t;const c=o.querySelector(`[data-gb-router-region="${e}"]`),i=c.parentNode.querySelector(".gb-query-loop-pagination");c&&n?(n.innerHTML=c.innerHTML,function(e){const t=e.getBoundingClientRect();t.top>=0&&t.top<=(window.innerHeight||document.documentElement.clientHeight)||e.scrollIntoView({behavior:"smooth",block:"start"})}(n),r.innerHTML=i.innerHTML):console.error("Unable to update posts container: Missing elements")})(e,t),history.pushState(null,"",r)}))}}))})();