text: import{fireRouterEvent as t}from"../utils.js";function vaadinRouterGlobalClickHandler(e){if(e.defaultPrevented)return;if(0!==e.button)return;if(e.shiftKey||e.ctrlKey||e.altKey||e.metaKey)return;let o=e.target;const a=e.composedPath?e.composedPath():e.path||[];for(let t=0;t<a.length;t++){const e=a[t];if(e.nodeName&&"a"===e.nodeName.toLowerCase()){o=e;break}}for(;o&&"a"!==o.nodeName.toLowerCase();)o=o.parentNode;if(!o||"a"!==o.nodeName.toLowerCase())return;if(o.target&&"_self"!==o.target.toLowerCase())return;if(o.hasAttribute("download"))return;if(o.hasAttribute("router-ignore"))return;if(o.pathname===window.location.pathname&&""!==o.hash)return;if((o.origin||function getAnchorOrigin(t){const e=t.port,o=t.protocol;return`${o}//${"http:"===o&&"80"===e||"https:"===o&&"443"===e?t.hostname:t.host}`}(o))!==window.location.origin)return;const{pathname:r,search:n,hash:i}=o;t("go",{pathname:r,search:n,hash:i})&&(e.preventDefault(),e&&"click"===e.type&&window.scrollTo(0,0))}const e={activate(){window.document.addEventListener("click",vaadinRouterGlobalClickHandler)},inactivate(){window.document.removeEventListener("click",vaadinRouterGlobalClickHandler)}};export default e;