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