import{u as C,r as g,a as k,c as $,n as D,o as F,b as f,d as z,w as B,e as U,v as j,f as y,g as w,h as b,i as v,E as M}from"./index-DmCbOAxb.js";import{l as P,a as E}from"./containers-B-x1Py5x.js";import{_ as L}from"./_plugin-vue_export-helper-DlAUqK2U.js";const R=["src","alt"],N={__name:"ImageContainer",props:{id:String,layoutId:String,partner:String,code:String},setup(x){C();const i="https://display24.ru",s=g(null),l=g(!1);let c=null;const n=x,e=k({id:null,displayCode:null,layoutId:null,content:null}),I=$(()=>{var t,o,a,r,d,u,h,p,m;return{top:e.top+"px",left:e.left+"px",width:e.width+"px",height:e.height+"px",backgroundColor:D((t=e.background)==null?void 0:t.color)||"#000",zIndex:e.zIndex||0,borderColor:((o=e.border)==null?void 0:o.color)||"#fff",borderStyle:((a=e.border)==null?void 0:a.style)||"solid",borderWidth:(((r=e.border)==null?void 0:r.width)||0)+"px",borderRadius:((d=e.border)==null?void 0:d.radius)+"px",boxShadow:"".concat((u=e.shadow)==null?void 0:u.x,"px ").concat((h=e.shadow)==null?void 0:h.y,"px ").concat((p=e.shadow)==null?void 0:p.b,"px ").concat((m=e.shadow)==null?void 0:m.color)}}),S=async t=>{const o="https://cdn.display24.ru/partners/".concat(n.partner,"/").concat(t);return await M(o)},_=t=>{switch(t){case 1:return{objectFit:"fill",width:"100%",height:"100%"};case 2:return{objectFit:"cover",width:"100%",height:"100%"};default:return{objectFit:"none"}}};return F(async()=>{var t;e.id=n.id,e.displayCode=n.code,e.layoutId=n.layoutId,await P(e,i,"ImageContainer (layouts)"),await E(e,l,i,"ImageContainer (schedule)"),(t=e.content)!=null&&t.filename&&(s.value=await S(e.content.filename)),c=setInterval(()=>{l.value=f(e==null?void 0:e.scheduleData)},1e3)}),z(()=>{c&&clearInterval(c)}),B(()=>e.scheduleData,t=>{l.value=f(t)}),(t,o)=>{var a,r;return U((w(),y("div",{class:"container",style:v(I.value)},[b("",!0),s.value?(w(),y("img",{key:1,src:s.value,alt:(a=e.content)==null?void 0:a.name,class:"content-image",style:v(_((r=e.content)==null?void 0:r.mediaMode))},null,12,R)):b("",!0)],4)),[[j,l.value]])}}},A=L(N,[["__scopeId","data-v-ea9cd92f"]]);export{A as default};
