import{d as w,a as I,r as h,e as y,b7 as z,j as C,b8 as E,f as N,i as a,h as o,C as v,g as d,v as n,a0 as S,o as T,aL as B,_ as L}from"./BxiWQxwE.js";import{_ as U}from"./4HfP1VOY.js";import"./QMEN6lyk.js";import"./CxeYIrhH.js";const j=["src","alt"],O={class:"quantity"},V={class:"price"},A={class:"product__card--quantity"},D={class:"product__card--price"},M=w({__name:"product-card",props:{product:{type:Object,required:!0},quantity:{type:Number,required:!1,default:1}},emits:["item-observed"],setup(e,{emit:b}){const t=e,{$gtm:x,$messages:q}=I(),u=h(null),$=b,i=y(()=>B(`/producten/${t.product.department}/${t.product.webgroup}/${encodeURIComponent(t.product.headerText??"")}/${t.product.productId}`)??""),p=y(()=>({item_id:t.product.productId,item_brand:t.product.brand,item_category:t.product.department,item_category2:t.product.webgroup,item_name:t.product.headerText,item_variant:t.product.packaging,item_list_name:"shopping-list",item_list_id:"shopping-list",price:t.product.price.priceToShow,quantity:Number(t.product.quantity)})),{stop:l}=z(u,([{isIntersecting:c}])=>{c&&($("item-observed",p.value),l())},{threshold:.8}),s=h(null),m=()=>{var c;return(c=s.value)==null?void 0:c.classList.remove("lazy_img--unloaded")},k=()=>{x("products.select_item",{ecommerce:{items:[p.value]}})};return C(()=>{s.value.complete&&m()}),E(()=>l()),(c,R)=>{var f;const _=S,g=U;return T(),N("div",{ref_key:"productElement",ref:u,class:"product__card"},[a(_,{to:d(i),class:"product__card--image"},{default:v(()=>{var r;return[o("img",{ref_key:"imgEl",ref:s,class:"image lazy_img lazy_img--unloaded",src:`${e.product.image}?width=190`,alt:(r=e.product.headerText)==null?void 0:r.trim(),loading:"lazy",onLoad:m},null,40,j)]}),_:1},8,["to"]),a(_,{class:"product__card--content",to:d(i),onClick:k},{default:v(()=>{var r;return[o("h4",null,n(e.product.headerText),1),o("p",null,n(e.product.packaging),1),o("div",O,[o("span",null,"aantal: "+n((r=e.product.quantity)==null?void 0:r.units),1)]),o("div",V,[a(g,{product:e.product,"force-show":"regular"},null,8,["product"])])]}),_:1},8,["to"]),o("div",A,[o("span",null,n(d(q)("common.quantity",{number:String((f=e.product.quantity)==null?void 0:f.units)})),1)]),o("div",D,[a(g,{product:e.product,"force-show":"regular"},null,8,["product"])])],512)}}}),K=L(M,[["__scopeId","data-v-859de5de"]]);export{K as default};
