import{r as s,h as i,U as c,y as d,m,j as g,a7 as f}from"./BCLrUOBx.js";const v=["data-src","alt","title"],h={__name:"ImageLazy",props:{alt:{type:String,default:null},title:{type:String,default:null},lazySrc:{type:String,default:null}},setup(l){const n=s(0),r=s(null);let e=null;i(()=>{e=new IntersectionObserver(([t])=>{t.isIntersecting&&(t.target.setAttribute("src",l.lazySrc),e.unobserve(t.target))},{root:null,threshold:0}),e.observe(r.value),r.value.addEventListener("load",()=>{var t;(t=r.value)==null||t.removeAttribute("data-src"),r.value&&(n.value=1)})}),c(()=>{e&&e.disconnect()});const{getImageURL:o}=d(),u=t=>{const a=t.target;a.dataset.errorHandled!=="true"&&(a.dataset.errorHandled="true",e==null||e.unobserve(a),a.removeAttribute("data-src"),a.src=o(),n.value=1)};return(t,a)=>(g(),m("img",{ref_key:"lazyImage",ref:r,"data-src":l.lazySrc,alt:l.alt,title:l.title,height:"50",width:"50",style:f({opacity:n.value}),onError:u},null,44,v))}};export{h as default};
