1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./framework-C-kvl5Nm.js";var n=e(t(),1),r=16;function i(){let e=document.querySelector(`.site-header`);if(!e)return r;let t=window.getComputedStyle(e);return(t.position===`sticky`||t.position===`fixed`?e.getBoundingClientRect().height:0)+r}function a(e){let t=e.closest(`label`)??e,n=i(),a=t.getBoundingClientRect(),o=window.innerHeight-r;e.focus({preventScroll:!0}),(a.top<n||a.bottom>o)&&window.scrollTo({top:Math.max(0,window.scrollY+a.top-n),behavior:`auto`})}function o(){return(0,n.useEffect)(()=>{let e=0;function t(t){let n=t.target;if(!(n instanceof HTMLElement))return;let r=n.closest(`form`);!r||r.querySelector(`:invalid`)!==n||(window.cancelAnimationFrame(e),e=window.requestAnimationFrame(()=>{e=window.requestAnimationFrame(()=>a(n))}))}return document.addEventListener(`invalid`,t,!0),()=>{document.removeEventListener(`invalid`,t,!0),window.cancelAnimationFrame(e)}},[]),null}export{o as FormValidationFocusManager};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.