import{r as t,c as i,h as o,H as e}from"./p-9137dcab.js";import{c as a}from"./p-de951a46.js";import("./p-72f327e1.js");const h=class{constructor(o){t(this,o),this.onLoad=i(this,"load",7),this.onError=i(this,"error",7),this.src=void 0,this.mode="scaleToFill",this.lazyLoad=!1,this.nativeProps={},this.aspectFillMode="width",this.didLoad=!1}componentDidLoad(){if(!this.lazyLoad)return;const t=new IntersectionObserver((i=>{i[i.length-1].isIntersecting&&(t.unobserve(this.imgRef),this.didLoad=!0)}),{rootMargin:"300px 0px"});t.observe(this.imgRef)}imageOnLoad(){const{width:t,height:i,naturalWidth:o,naturalHeight:e}=this.imgRef;this.onLoad.emit({width:t,height:i}),this.aspectFillMode=o>e?"width":"height"}imageOnError(t){this.onError.emit(t)}render(){const{src:t,mode:i="scaleToFill",lazyLoad:h=!1,aspectFillMode:s="width",imageOnLoad:r,imageOnError:m,nativeProps:d,didLoad:g}=this,l=a({"taro-img__widthfix":"widthFix"===i}),n=a(`taro-img__mode-${i.toLowerCase().replace(/\s/g,"")}`,{[`taro-img__mode-aspectfill--${s}`]:"aspectFill"===i});return o(e,{class:l},o("img",Object.assign({ref:t=>this.imgRef=t,class:n,src:h&&!g?void 0:t,onLoad:r.bind(this),onError:m.bind(this)},d)))}};h.style='img[src=""]{opacity:0}taro-image-core{display:inline-block;overflow:hidden;position:relative;width:320px;height:240px;font-size:0}.taro-img.taro-img__widthfix{height:100%}.taro-img__mode-scaletofill{width:100%;height:100%}.taro-img__mode-aspectfit{max-width:100%;max-height:100%}.taro-img__mode-aspectfill{position:absolute;left:50%;top:50%;-webkit-transform:translate(-50%, -50%);transform:translate(-50%, -50%)}.taro-img__mode-aspectfill--width{min-width:100%;height:100%}.taro-img__mode-aspectfill--height{width:100%;min-height:100%}.taro-img__mode-widthfix{width:100%}.taro-img__mode-heightfix{height:100%}.taro-img__mode-top{width:100%}.taro-img__mode-bottom{position:absolute;bottom:0;width:100%}.taro-img__mode-left{height:100%}.taro-img__mode-right{position:absolute;right:0;height:100%}.taro-img__mode-topright{position:absolute;right:0}.taro-img__mode-bottomleft{position:absolute;bottom:0}.taro-img__mode-bottomright{position:absolute;right:0;bottom:0}';export{h as taro_image_core}