Files
sm-bm-plugin/public/assets/scrollToHash-Iwy9VZ0s.js

2 lines
589 B
JavaScript

import{T as i,k as d,Y as u,an as m}from"./index-B1ZTq02x.js";const l=2500;function h(n){const s=d();let c="";i([()=>m(n),()=>s.hash],([a,e])=>{!a||!e||e===c||(c=e,u(()=>{if(typeof document>"u")return;let o=e.slice(1);try{o=decodeURIComponent(o)}catch{}const t=document.getElementById(o);if(!t)return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;t.scrollIntoView({behavior:r?"auto":"smooth",block:"start"}),t.classList.add("hash-target"),setTimeout(()=>t.classList.remove("hash-target"),l)}))},{immediate:!0})}export{h as u};