import{b1 as q,j,b2 as F,b3 as K,aU as m,aV as Q,b4 as W,aW as G,h as X,b5 as g,m as Z,k as H,P as J,l as x,b6 as ee,b7 as te,b8 as ae,b9 as oe,ba as ie}from"./index-CsCqMgta.js";import{M as re,aK as le,E as d,R as i,U as r,V as l,X as u,a8 as p,Z as P,Y as y,N as ne,P as ue,Q as se,e as a,T as ce,S as de,O as o}from"./vendor-CsGITfgk.js";const ge=re({__name:"product-card",props:{loading:{type:Boolean},product:{},viewMode:{default:"grid"},browserTarget:{default:"_blank"},cardType:{},lazy:{type:Boolean}},emits:["linkClick"],setup(f){const n=f,e=le(n,"product"),{isComponentRegistered:V,getComponent:C,shouldRenderComponent:T,getComponentProps:w}=q(),{isEnabled:D}=j(F),h=D(K),v=d(()=>m(n.product.id,n.product.slug)),$=d(()=>e.value.hasVariations?e.value.minVariationPrice?.actual??e.value.price.actual:e.value.price.actual),R=d(()=>e.value.hasVariations?e.value.minVariationPrice?.list??e.value.price.list:e.value.price.list),B=d(()=>Object.values(Q(n.product.properties??[],W.Product)).filter(t=>t.name!==G).slice(0,3)),_=d(()=>n.viewMode==="grid"?"lg":"md"),{productsFilters:O}=X(),M=d(()=>{if(!O.value.inStock)return(n.product.variations?.length||0)+1;let t=0;return n.product.availabilityData?.isInStock&&n.product.availabilityData.isBuyable&&t++,t+=n.product.variations?.filter(s=>s.availabilityData?.isInStock&&s.availabilityData?.isBuyable)?.length||0,t});return(t,s)=>{const N=r("VcProductImage"),z=r("VcProductActions"),S=r("VcProductTitle"),A=r("VcProductVendor"),b=r("VcProperty"),E=r("VcRating"),U=r("VcProductProperties"),I=r("VcProductPrice"),k=r("VcProductButton"),L=r("VcProductCard");return o(),i(L,{"view-mode":t.viewMode,"data-product-sku":e.value.code,border:"","data-test-id":"product-card"},{media:l(()=>[u(N,{images:t.viewMode==="grid"?e.value.images:[],"img-src":e.value.imgSrc,alt:e.value.name,lazy:t.lazy,to:v.value},{default:l(()=>[u(ee,null,{default:l(()=>[e.value.isPurchased?(o(),i(te,{key:0,size:_.value,square:""},null,8,["size"])):p("",!0),e.value.price?(o(),i(ae,{key:1,static:"",price:e.value.price,size:_.value},null,8,["price","size"])):p("",!0)]),_:1})]),_:1},8,["images","img-src","alt","lazy","to"]),u(z,{direction:t.viewMode==="grid"?"vertical":"horizontal","with-background":t.viewMode==="grid"},{default:l(()=>[u(a(oe),{product:e.value},null,8,["product"]),t.$cfg.product_compare_enabled?(o(),i(a(ie),{key:0,product:e.value},null,8,["product"])):p("",!0)]),_:1},8,["direction","with-background"])]),default:l(()=>[u(S,{title:e.value.name,to:v.value,"lines-number":"2","fix-height":""},null,8,["title","to"]),t.$cfg.vendor_enabled?(o(),i(A,{key:0},{default:l(()=>[P(y(e.value.vendor?.name),1)]),_:1})):p("",!0),t.cardType!=="short"?(o(),i(U,{key:1},{default:l(()=>[(o(!0),ne(ue,null,se(B.value,(c,Y)=>(o(),i(b,{key:Y,label:c.label},{default:l(()=>[P(y(c.value),1)]),_:2},1032,["label"]))),128)),a(h)&&e.value.rating?(o(),i(b,{key:0,label:t.$t("shared.catalog.product_card.product_rating")},{default:l(()=>[u(E,{size:"xs",value:e.value.rating.value,"review-count":e.value.rating.reviewCount},null,8,["value","review-count"])]),_:1},8,["label"])):p("",!0)]),_:1})):p("",!0),u(I,{"actual-price":$.value,"list-price":R.value,"with-from-label":e.value.hasVariations,"single-line":t.viewMode==="grid"},null,8,["actual-price","list-price","with-from-label","single-line"]),a(V)(a(g).CARD_BUTTON)&&a(T)(a(g).CARD_BUTTON,e.value)?(o(),i(ce(a(C)(a(g).CARD_BUTTON)),de({key:2,product:e.value,"is-text-shown":""},a(w)(a(g).CARD_BUTTON)),null,16,["product"])):e.value.isConfigurable?(o(),i(k,{key:3,to:a(m)(e.value.id,e.value.slug),"link-text":t.$t("pages.catalog.customize_button"),"link-to":a(m)(e.value.id,e.value.slug),"button-text":t.$t("pages.catalog.customize_button"),icon:"cube-transparent",target:t.browserTarget||t.$cfg.details_browser_target||"_blank",onLinkClick:s[0]||(s[0]=c=>t.$emit("linkClick",e.value,c))},null,8,["to","link-text","link-to","button-text","target"])):e.value.hasVariations?(o(),i(k,{key:4,to:v.value,"link-text":t.$t("pages.catalog.show_on_a_separate_page"),"link-to":v.value,"button-text":t.$t("pages.catalog.variations_button",[M.value]),target:t.browserTarget||t.$cfg.details_browser_target||"_blank",onLinkClick:s[1]||(s[1]=c=>t.$emit("linkClick",e.value,c))},null,8,["to","link-text","link-to","button-text","target"])):(o(),i(a(Z),{key:5,product:e.value,"reserved-space":t.viewMode==="grid"},{default:l(()=>[u(H,{"is-in-stock":e.value.availabilityData?.isInStock,"is-digital":e.value.productType===a(J).Digital,quantity:e.value.availabilityData?.availableQuantity},null,8,["is-in-stock","is-digital","quantity"]),u(x,{"product-id":e.value.id},null,8,["product-id"])]),_:1},8,["product","reserved-space"]))]),_:1},8,["view-mode","data-product-sku"])}}});export{ge as _};
//# sourceMappingURL=product-card.vue_vue_type_script_setup_true_lang-CXwGwsM6.js.map
