var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function u(t){try{h(n.next(t))}catch(t){r(t)}}function a(t){try{h(n["throw"](t))}catch(t){r(t)}}function h(t){t.done?i(t.value):s(t.value).then(u,a)}h((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,u;return u={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(u[Symbol.iterator]=function(){return this}),u;function a(t){return function(e){return h([t,e])}}function h(a){if(n)throw new TypeError("Generator is already executing.");while(u&&(u=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./index-83dd9303.system.js"],(function(t){"use strict";var e,i;return{setters:[function(t){e=t.r;i=t.h}],execute:function(){var n=":host{display:inline-block}";var s=t("bds_image",function(){function t(t){e(this,t);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}t.prototype.loadImage=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n;return __generator(this,(function(s){switch(s.label){case 0:if(!this.src)return[3,7];s.label=1;case 1:s.trys.push([1,6,,7]);return[4,fetch(this.src)];case 2:t=s.sent();if(!t.ok)return[3,4];return[4,t.blob()];case 3:e=s.sent();i=URL.createObjectURL(e);this.currentSrc=i;this.imageLoaded=true;return[3,5];case 4:this.loadError=true;s.label=5;case 5:return[3,7];case 6:n=s.sent();this.loadError=true;return[3,7];case 7:return[2]}}))}))};t.prototype.render=function(){if(!this.imageLoaded&&!this.loadError){this.loadImage()}if(this.imageLoaded){return i("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 i("div",{style:{width:this.width||this.height?this.width:"100%"}},i("bds-illustration",{type:"empty-states",name:"image-not-found",alt:this.alt,"data-test":this.dataTest}))}else{return i("div",{style:{width:this.width||this.height?this.width:"100%"}},i("bds-illustration",{type:"empty-states",name:"broken-image",alt:this.alt,"data-test":this.dataTest}))}};return t}());s.style=n}}}));
//# sourceMappingURL=bds-image.system.entry.js.map