{"version":3,"file":"page.D_28iZ5E.js","sources":["../../node_modules/astro/dist/prefetch/index.js","../../astro:scripts/page.js"],"sourcesContent":["const debug = import.meta.env.DEV ? console.debug : void 0;\nconst inBrowser = import.meta.env.SSR === false;\nconst prefetchedUrls = /* @__PURE__ */ new Set();\nconst listenedAnchors = /* @__PURE__ */ new WeakSet();\nlet prefetchAll = __PREFETCH_PREFETCH_ALL__;\nlet defaultStrategy = __PREFETCH_DEFAULT_STRATEGY__;\nlet clientPrerender = __EXPERIMENTAL_CLIENT_PRERENDER__;\nlet inited = false;\nfunction init(defaultOpts) {\n if (!inBrowser) return;\n if (inited) return;\n inited = true;\n debug?.(`[astro] Initializing prefetch script`);\n prefetchAll ??= defaultOpts?.prefetchAll ?? false;\n defaultStrategy ??= defaultOpts?.defaultStrategy ?? \"hover\";\n initTapStrategy();\n initHoverStrategy();\n initViewportStrategy();\n initLoadStrategy();\n}\nfunction initTapStrategy() {\n for (const event of [\"touchstart\", \"mousedown\"]) {\n document.body.addEventListener(\n event,\n (e) => {\n if (elMatchesStrategy(e.target, \"tap\")) {\n prefetch(e.target.href, { ignoreSlowConnection: true });\n }\n },\n { passive: true }\n );\n }\n}\nfunction initHoverStrategy() {\n let timeout;\n document.body.addEventListener(\n \"focusin\",\n (e) => {\n if (elMatchesStrategy(e.target, \"hover\")) {\n handleHoverIn(e);\n }\n },\n { passive: true }\n );\n document.body.addEventListener(\"focusout\", handleHoverOut, { passive: true });\n onPageLoad(() => {\n for (const anchor of document.getElementsByTagName(\"a\")) {\n if (listenedAnchors.has(anchor)) continue;\n if (elMatchesStrategy(anchor, \"hover\")) {\n listenedAnchors.add(anchor);\n anchor.addEventListener(\"mouseenter\", handleHoverIn, { passive: true });\n anchor.addEventListener(\"mouseleave\", handleHoverOut, { passive: true });\n }\n }\n });\n function handleHoverIn(e) {\n const href = e.target.href;\n if (timeout) {\n clearTimeout(timeout);\n }\n timeout = setTimeout(() => {\n prefetch(href);\n }, 80);\n }\n function handleHoverOut() {\n if (timeout) {\n clearTimeout(timeout);\n timeout = 0;\n }\n }\n}\nfunction initViewportStrategy() {\n let observer;\n onPageLoad(() => {\n for (const anchor of document.getElementsByTagName(\"a\")) {\n if (listenedAnchors.has(anchor)) continue;\n if (elMatchesStrategy(anchor, \"viewport\")) {\n listenedAnchors.add(anchor);\n observer ??= createViewportIntersectionObserver();\n observer.observe(anchor);\n }\n }\n });\n}\nfunction createViewportIntersectionObserver() {\n const timeouts = /* @__PURE__ */ new WeakMap();\n return new IntersectionObserver((entries, observer) => {\n for (const entry of entries) {\n const anchor = entry.target;\n const timeout = timeouts.get(anchor);\n if (entry.isIntersecting) {\n if (timeout) {\n clearTimeout(timeout);\n }\n timeouts.set(\n anchor,\n setTimeout(() => {\n observer.unobserve(anchor);\n timeouts.delete(anchor);\n prefetch(anchor.href);\n }, 300)\n );\n } else {\n if (timeout) {\n clearTimeout(timeout);\n timeouts.delete(anchor);\n }\n }\n }\n });\n}\nfunction initLoadStrategy() {\n onPageLoad(() => {\n for (const anchor of document.getElementsByTagName(\"a\")) {\n if (elMatchesStrategy(anchor, \"load\")) {\n prefetch(anchor.href);\n }\n }\n });\n}\nfunction prefetch(url, opts) {\n url = url.replace(/#.*/, \"\");\n const ignoreSlowConnection = opts?.ignoreSlowConnection ?? false;\n if (!canPrefetchUrl(url, ignoreSlowConnection)) return;\n prefetchedUrls.add(url);\n if (clientPrerender && HTMLScriptElement.supports?.(\"speculationrules\")) {\n debug?.(`[astro] Prefetching ${url} with