import{a as _}from"./index.4b887428.js";import{u as d}from"./ScrollTo.81bea8a7.js";import{g as h,r as m}from"./params.af7ed354.js";import{Y as T,Z as f,f as A}from"./runtime-core.esm-bundler.ce5add0b.js";const H=(p={})=>{const{scrollTimeout:r=500,highlightTimeout:v=500,scrollAndHighlightTimeout:y=1500}=p,t=T(!1),o=_();f(()=>o.navigate.scroll,()=>{t.value||(t.value=!0,i())}),f(()=>o.navigate.highlight,()=>{t.value||(t.value=!0,i())});const i=()=>{var n,a;const e=h()["aioseo-scroll"]||((n=history.state)==null?void 0:n.scroll)||o.navigate.scroll;e&&typeof e=="string"&&setTimeout(()=>{var s;d().scrollTo(e,{mods:{scrollMarginClass:"aioseo-scroll-and-highlight-margin",timeout:r}}),m("aioseo-scroll"),(s=history.state)==null||delete s.scroll,o.navigate.scroll=null,t.value=!1},r);const l=h()["aioseo-highlight"]||((a=history.state)==null?void 0:a.highlight)||o.navigate.highlight;l&&typeof l=="string"&&setTimeout(()=>{var c;const u=document.querySelectorAll(`#${l.replace(/,/g,", #").replace(/%2C/ig,", #")}`);u.length&&u.forEach(g=>{g.classList.add("aioseo-row-highlight"),setTimeout(()=>{g.classList.remove("aioseo-row-highlight")},1500)}),m("aioseo-highlight"),(c=history.state)==null||delete c.highlight,o.navigate.highlight=null,t.value=!1},e?y:v)};A(i)};export{H as u};
