import{d as r}from"./Caret.19b10233.js";import{n as a}from"./_plugin-vue2_normalizer.61652a7c.js";const i={props:{src:String,tag:{type:String,default(){return"img"}},debounce:{type:Boolean,default(){return!0}}},data(){return{canShow:!1,images:{}}},watch:{src(){if(this.debounce){r(this.maybeShowImage,50);return}this.maybeShowImage()},canShow(t){this.$emit("can-show",t)},images:{handler:function(){this.$emit("images",this.images)},deep:!0}},methods:{async maybeShowImage(){if(this.canShow=!1,!this.src)return;if(this.images[this.src]){this.canShow=!0;return}const t=new Image;t.onload=await(()=>{this.canShow=!0;let n=0;const e=t.width,s=t.height;e&&s&&(n=e/s),!this.images[this.src]&&this.$set(this.images,this.src,{image:t,ratio:n,vertical:e>s})}),t.onerror=await(()=>{this.canShow=!1}),t.src=this.src}},mounted(){this.maybeShowImage()}};var o=function(){var n=this,e=n._self._c;return n.canShow?e("img",{attrs:{src:n.src}}):n._e()},c=[],u=a(i,o,c,!1,null,null,null,null);const m=u.exports;export{m as B};
