import J from"./CzbA5VOJ.js";import K from"./YMgwR3Gi.js";import Q from"./-hq_PDZF.js";import{Y as X,r as p,a as Z,s as x,y as ee,f as c,h as te,U as se,m as n,j as l,k as o,i as oe,A as v,v as y,w as f,l as $,p as e,C as g,F as O,B as w,t as le}from"./BCLrUOBx.js";import{u as ne}from"./ChGwzFWX.js";const ae={class:"image-popup"},ie={key:0,class:"image-popup-icons"},re=["id","alt","data-src"],ce={key:0},ue=["src"],de={class:"title mb-10"},me=["onClick"],pe=["alt","src"],ve=["alt","src"],ye={__name:"ImagePopup",props:{product:{type:Object},title:{type:String,default:""},activeId:{type:Number,default:1},imageList:{type:Array,default(){return[]}},noScroll:{type:Boolean,default:!0},stackedOnResponsive:{type:Boolean,default:!1}},emits:["close-popup","add-to-wishlist"],setup(u,{expose:I,emit:B}){const U=u,C=B,{product:d,imageList:i,noScroll:P}=X(U),h=p(null),T=Z(),{profile:F}=x(T),b=t=>{h.value&&h.value.onThumbClick(t)};I({selectSliderImage:b});const _=p(0),m=p(!1),N=p(!1),{getThumbImageURL:V,getImageURL:S,getVideoURL:j}=ee(),{onChange:z,onFirstImageLoad:A}=ne(_,N);c(()=>k?i.value.length+1:i.value.length);const k=c(()=>{var t;return((t=d.value)==null?void 0:t.video)||""}),L=c(()=>{var t;return((t=d.value)==null?void 0:t.video_thumb)||""}),E=c(()=>{var t,s;return((t=F.value)==null?void 0:t.id)&&((s=d.value)==null?void 0:s.wishlisted)}),M=c(()=>E.value?"heart-fill-icon":"heart-icon"),D=()=>{m.value=!m.value},H=()=>{m.value=!1},W=()=>{C("add-to-wishlist")},R=()=>{C("close-popup")};return te(()=>{P.value&&document.body.classList.add("no-scroll")}),se(()=>{document.body.classList.remove("no-scroll")}),(t,s)=>{const Y=J,q=K,G=Q;return l(),n("div",{class:g([{stacked:u.stackedOnResponsive},"image-popup-wrapper"])},[o("div",{class:"layer",onClick:y(R,["prevent"])}),m.value?(l(),oe(q,{key:0,title:t.$t("socialShare.share"),layer:!0,onClose:H,"elem-id":"social-pop-over"},{content:f(()=>[$(Y,{product:e(d)},null,8,["product"])]),_:1},8,["title"])):v("",!0),o("div",ae,[u.stackedOnResponsive?(l(),n("div",ie,[o("button",{class:"left-btn fav-btn",onClick:y(W,["prevent"])},[o("i",{class:g([e(M),"m-0 icon"])},null,2)]),o("button",{class:"right-btn share-btn",onClick:D},s[3]||(s[3]=[o("i",{class:"m-0 icon share-icon"},null,-1)]))])):v("",!0),o("button",{class:"right-btn close-btn",onClick:R},s[4]||(s[4]=[o("i",{class:"m-0 icon close-icon"},null,-1)])),$(G,{ref_key:"productSliderRef",ref:h,class:"product-slider",addInitEvt:!0,bullets:!0,lazy:!0,loop:!0,onOnChange:s[1]||(s[1]=a=>e(z)(a,"product-image")),onOnInit:s[2]||(s[2]=a=>e(A)(0,"product-image"))},{content:f(()=>[(l(!0),n(O,null,w(e(i),(a,r)=>(l(),n("li",{key:r},[o("img",{id:`product-image-${r}`,class:"full-dimen opacity-0",alt:t.$t("invent.si"),"data-src":e(S)(a.image)},null,8,re)]))),128)),e(k)?(l(),n("li",ce,[o("video",{preload:"metadata",src:e(j)(e(k)),controls:""},null,8,ue)])):v("",!0)]),title:f(()=>[o("h5",de,le(u.title),1)]),"bullet-area":f(()=>[(l(!0),n(O,null,w(e(i),(a,r)=>(l(),n("div",{key:r,class:g(["embla-thumbs__slide",r===_.value?"active":""]),onClick:fe=>b(r)},[o("img",{class:"embla-thumbs__slide__number img-handler",alt:t.$t("invent.si"),src:e(V)(a.image)},null,8,pe)],10,me))),128)),e(L)?(l(),n("div",{key:0,class:g(["embla-thumbs__slide video-thumb",e(i).length===_.value?"active":""]),onClick:s[0]||(s[0]=y(a=>b(e(i).length),["prevent"]))},[o("img",{class:"embla-thumbs__slide__number img-handler",alt:t.$t("invent.si"),src:e(S)(e(L))},null,8,ve),s[5]||(s[5]=o("span",{class:"flex"},[o("i",{class:"icon play-icon"})],-1))],2)):v("",!0)]),_:1},512)])],2)}}};export{ye as default};
