const e=require("../../_util/hooks/useState.js"),t=require("../util.js");let n=require("vue");function r(r,i,a,o){let[s,c]=e.default(void 0);(0,n.watchEffect)(()=>{let e=typeof r.value==`function`?r.value():r.value;c(e||null)},{flush:`post`});let[l,u]=e.default(null),d=()=>{if(!i.value){u(null);return}if(s.value){!t.isInViewPort(s.value)&&i.value&&s.value.scrollIntoView(o.value);let{left:e,top:n,width:r,height:a}=s.value.getBoundingClientRect(),c={left:e,top:n,width:r,height:a,radius:0};JSON.stringify(l.value)!==JSON.stringify(c)&&u(c)}else u(null)};return(0,n.onMounted)(()=>{(0,n.watch)([i,s],()=>{d()},{flush:`post`,immediate:!0}),window.addEventListener(`resize`,d)}),(0,n.onBeforeUnmount)(()=>{window.removeEventListener(`resize`,d)}),[(0,n.computed)(()=>{if(!l.value)return l.value;let e=a.value?.offset||6,t=a.value?.radius||2;return{left:l.value.left-e,top:l.value.top-e,width:l.value.width+e*2,height:l.value.height+e*2,radius:t}}),s]}exports.default=r;