import{_ as x}from"./nuxt-link-BsFZFBAg.mjs";import{_ as w,c as o,l as h,o as r,a as d,p as c,d as g,e as b,z as S,b as p,v,s as k,aj as z}from"./BfF8i_OD.js";const C={props:{credit:{type:String,required:!0},width:{type:[Number,String]}},data(){return{isActive:!1}},computed:{},methods:{showCredit(){this.isActive=!this.isActive}}},L={class:"text-wrapper"},I=["innerHTML"],R={class:"icon-wrapper"};function B(t,i,e,m,n,a){const s=b;return e.credit&&e.credit!=="undefined"?(r(),o("div",{key:0,class:S(["image-credit",n.isActive?"click":""])},[d("div",L,[d("div",{class:"text",style:c({fontFamily:t.$ss.primaryFontFamily}),innerHTML:e.credit},null,12,I)]),d("div",R,[g(s,{class:"icon",width:16,icon:"mdi:image-area",onClick:i[0]||(i[0]=l=>a.showCredit())})])],2)):h("",!0)}const N=w(C,[["render",B],["__scopeId","data-v-29f90610"]]),W={props:{alt:{type:String},caption:{type:String},credit:{type:String},image:{type:String},metaData:{type:Object},width:{type:Number},height:{type:Number},contentType:{type:String,default:""},imageLink:{type:String,default:""},maxCaptionWidth:{type:String,default:"100%"},captionAlignment:{type:String,default:"left"},lazyLoad:{type:Boolean,default:!0},aspectRatio:{type:[Number,String],default:""},ignoreStyling:{type:Boolean,default:!1},useNativeSize:{type:Boolean,default:!1},target:{type:String},underlineCaption:{type:Boolean,default:!0}},data(){return{currSize:this.width&this.height?"custom":"tiny"}},computed:{wrapperComponent(){return this.imageLink?x:"div"},imageInfo(){const t=this.width&this.height?{custom:"custom"}:{tiny:250,small:320,medium:640,large:950,xlarge:1200},i={};return Object.keys(t).forEach(e=>{var u,y,f,_;const m=this.image.replace(/&h=[0-9]*/gi,"").replace(/&w=[0-9]*/gi,""),n=parseFloat(this.aspectRatio)>0?parseFloat(this.aspectRatio):this.aspectRatio==="full-teaser"?1.8:this.aspectRatio==="small-teaser"?((u=this.$ss)!=null&&u.useNewDesign?100:(f=(y=this.$ss)==null?void 0:y.contentStyle)==null?void 0:f.smallImageWidth)/75:this.aspectRatio==="issue"?.72:(_=this.metaData)!=null&&_.PixelWidth?this.metaData.PixelWidth/this.metaData.PixelHeight:"",a=this.height??n?Math.round(t[e]/n):"",s=this.width??n?t[e]:"",l=n?`${a?`&h=${a}&height=${a}`:""}${s?`&w=${s}&width=${s}`:""}`:`&w=${t[e]}&width=${t[e]}`;i[e]={url:`${m}${l}`,height:a,width:s||t[e]}}),i},imageCredits(){let t=this.credit??void 0;if(t){const i=t.matchAll(new RegExp("]*>(.*?)","g"));for(const e of i)t=t.replace(e[0],e[0].replace(">",' rel="nofollow"; style="color: #ffffff;" target="_blank";>'))}return t}},unmounted(){window.removeEventListener("resize",this.determineImageSize)},mounted(){window.addEventListener("resize",this.determineImageSize),this.determineImageSize()},methods:{determineImageSize(){const t=this.$el.clientWidth;if(!this.width&!this.height){let i=this.width&this.height?"custom":"tiny";t>250&&t<=320?i="small":t>320&&t<=640?i="medium":t>640&&t<=950?i="large":t>950&&(i="xlarge"),this.currSize!==i&&(this.currSize=i)}}}},A={ref:"web-image",class:"web-image"},D={class:"ebm-image-wrapper"},F={key:0},E={key:1,class:"image-content"},T=["innerHTML"];function H(t,i,e,m,n,a){const s=N,l=k;return r(),o("div",A,[d("figure",D,[a.imageCredits?(r(),p(s,{key:0,credit:a.imageCredits},null,8,["credit"])):h("",!0),(r(),p(z(a.wrapperComponent),{to:e.imageLink,target:e.target?e.target:e.imageLink[0]==="/"?"_self":"_blank","aria-label":e.imageLink?e.imageLink.split("/").pop().replaceAll("-"," "):"",class:S(["ebm-image",e.contentType.toLowerCase(),e.useNativeSize?"native":"container",e.aspectRatio]),style:c({padding:!e.ignoreStyling&&t.$ss.imageDropShadow?"3px":0})},{default:v(()=>[e.useNativeSize?(r(),o("div",F,[g(l,{src:e.image,alt:e.alt,title:e.alt,style:c({borderRadius:!e.ignoreStyling&&t.$ss.imageBorderRadius?"8px":"0",boxShadow:!e.ignoreStyling&&t.$ss.imageDropShadow?"1px 1px 3px rgba(0,0,0,.5)":"none"}),"lazy-load":!0},null,8,["src","alt","title","style"])])):(r(),o("div",E,[g(l,{src:a.imageInfo[n.currSize].url,alt:e.alt,height:a.imageInfo[n.currSize].height,width:a.imageInfo[n.currSize].width,title:e.alt,style:c({borderRadius:!e.ignoreStyling&&t.$ss.imageBorderRadius?"8px":"0",boxShadow:!e.ignoreStyling&&t.$ss.imageDropShadow?"1px 1px 3px rgba(0,0,0,.5)":"none"}),"lazy-load":!0},null,8,["src","alt","height","width","title","style"])])),e.caption?(r(),o("figcaption",{key:2,class:"ebm-image-caption",style:c({fontFamily:t.$ss.primaryFontFamily,maxWidth:e.maxCaptionWidth,textAlign:e.captionAlignment,borderBottom:e.underlineCaption?"1px solid #e0e0e0":null,padding:e.underlineCaption?"10px 0":"10px 0 0"}),innerHTML:e.caption},null,12,T)):h("",!0)]),_:1},8,["to","target","aria-label","class","style"]))])],512)}const P=w(W,[["render",H]]);export{P as _,N as a};