import{r as t,h as s}from"./p-93b809e8.js";const i=class{constructor(s){t(this,s),this.src=void 0,this.alt=void 0,this.width=void 0,this.height=void 0,this.objectFit="cover",this.dataTest=null,this.imageLoaded=!1,this.loadError=!1,this.currentSrc=void 0}async loadImage(){if(this.src)try{const t=await fetch(this.src);if(t.ok){const s=await t.blob(),i=URL.createObjectURL(s);this.currentSrc=i,this.imageLoaded=!0}else this.loadError=!0}catch(t){this.loadError=!0}}render(){return this.imageLoaded||this.loadError||this.loadImage(),this.imageLoaded?s("img",{src:this.currentSrc,alt:this.alt,style:{objectFit:this.objectFit,width:this.width,height:this.height},"data-test":this.dataTest}):s("div",{style:{width:this.width||this.height?this.width:"100%"}},s("bds-illustration",this.src?{type:"empty-states",name:"broken-image",alt:this.alt,"data-test":this.dataTest}:{type:"empty-states",name:"image-not-found",alt:this.alt,"data-test":this.dataTest}))}};i.style=":host{display:inline-block}";export{i as bds_image}