1import{n as e}from"./hePW80VL.js";import{D as t,On as n,b as r,g as i,k as a,mt as o,vn as s,wn as c}from"./CrzdsfCC.js";import{n as l}from"./BujKp7DX.js";import{t as u}from"./D_HTiAM4.js";import{C as d,S as f,m as p,n as m,x as h,y as g}from"./BNbkW9CS.js";import{t as _}from"./OuD5E1W0.js";import{t as v}from"./BsF-jUVA.js";import{t as y}from"./p-6YOgvm.js";import{i as b,n as x}from"./50s3XuM6.js";import{t as S}from"./DG1KLCKn.js";import{t as C}from"./DKjFBADs.js";import{t as w}from"./Bcz7xO6S.js";import{t as T}from"./CAR34u1a.js";import{t as E}from"./tfktwmF1.js";var D={class:`p-px flex flex-col justify-start items-start overflow-hidden`},O=a({__name:`SwProductCard`,props:{product:{},layoutType:{default:`standard`},displayMode:{default:`standard`},isProductListing:{type:Boolean,default:!1}},setup(e){let{pushSuccess:a,pushError:O}=_(),{getErrorsCodes:k}=w(),{resolveCartError:A}=x(),j={product:{addedToWishlist:`has been added to wishlist.`,removedFromTheWishlist:`has been removed from wishlist.`,reason:`Reason`,cannotAddToWishlist:`cannot be added to wishlist.`,addedToCart:`has been added to cart.`,viewCart:`View cart`,addToCart:`Add to cart`,details:`Details`,badges:{topseller:`Tip`},addToWishlist:`Add to wishlist`,removeFromWishlist:`Remove from wishlist`},errors:{"product-stock-reached":`The product {name} is only available {quantity} times`}};j=l(S(),j);let M=c(()=>e.product),{addToCart:N}=b(M),{addToWishlist:P,removeFromWishlist:F,isInWishlist:I}=C(M.value.id),L=s(!1),R=async()=>{L.value=!0;try{I.value?(await F(),a(`${M?.value.translated.name} ${j.product.removedFromTheWishlist}`)):(await P(),a(`${M?.value.translated.name} ${j.product.addedToWishlist}`))}catch(e){if(e instanceof u){let t=e.details.errors?.[0]?.detail?`${j.product.reason}: ${e.details.errors?.[0]?.detail}`:``;return O(`${M?.value.translated.name} ${j.product.cannotAddToWishlist}\n${t}`,{timeout:5e3})}}finally{L.value=!1}},z=async()=>{await N();let e=k();for(let t of e){let{messageKey:e,params:n}=A(t);j.errors[e]&&O(p(j.errors[e],n))}e.length||a(`${M?.value.translated.name} ${j.product.addedToCart}`,{action:{label:j.product.viewCart,to:`/checkout/cart`}})},B=g(M.value),V=i(()=>f({product:M.value})),H=i(()=>h(M.value)),{foreignKey:U,routeName:W}=y(),G=i(()=>e.isProductListing&&W.value===`frontend.navigation.page`?U.value:void 0),{getUrlPrefix:K}=v(),q=i(()=>{let e=d(M.value),t={...e,state:{...e.state,referrerCategoryId:G.value}};return m(t,K())});return(i,a)=>{let s=T,c=E;return o(),r(`div`,D,[t(s,{product:M.value,translations:n(j),isInWishlist:n(I),isLoading:L.value,toggleWishlist:R,productLink:q.value},null,8,[`product`,`translations`,`isInWishlist`,`isLoading`,`productLink`]),t(c,{product:M.value,productName:V.value,productManufacturer:H.value,translations:n(j),fromPrice:n(B),addToCartProxy:z,productLink:q.value,layoutType:e.layoutType},null,8,[`product`,`productName`,`productManufacturer`,`translations`,`fromPrice`,`productLink`,`layoutType`])])}}}),k=e({default:()=>A}),A=Object.assign(O,{__name:`SwProductCard`});export{k as n,A as t};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.