import{f as X,aq as ee,j as t,k as te,y as j,n as i,a1 as D,I as se,bn as ne,p as s}from"./index-BB3C6ia3.js";import{b as f,L as v}from"./vendor-q1sfVHxQ.js";import{S as ae,a as re}from"./swiper.min-BjDUzMMs.js";import{n as oe}from"./noImage-CNGZMR77.js";import{P as le}from"./PeriodOverlay-CBs1wfM9.js";import{h as ie}from"./product-D_O9OGFi.js";import{B as ce}from"./Button-CJM3HEil.js";import{I as de}from"./IconBtn-Cs7b2ih8.js";var S=function(){return S=Object.assign||function(e){for(var a,l=1,n=arguments.length;l0,payload:{requestBody:{productNos:[a]}},onSuccess:function(O){var y=O.data;r?.({productNo:a,count:l+(y?1:-1),isActive:y})}})};return x?t.jsx(ce,S({"shopby-script-action":"TOGGLE_LIKE_STATUS","shopby-like-status":n?.toString(),"shopby-product-no":a,className:"sc-like-button ".concat(d," ").concat(n?"is-active":""),onClick:b},m,{children:x})):t.jsx(de,S({"shopby-script-action":"TOGGLE_LIKE_STATUS","shopby-product-no":a,"shopby-like-status":n?.toString(),className:"".concat(d," ").concat(n?"is-active":""),hiddenLabel:!h,label:h?l:"좋아요 버튼",onClick:b},m))};const ge=[400,600,800,1e3],he="(min-width: 1024px) 16vw, (min-width: 768px) 47vw, 45vw",H=(e,a)=>se({url:e,additionalSearchParams:`${a}x${Math.round(a*1.25)}`}),xe=e=>ge.map(a=>`${H(e,a)} ${a}w`).join(", "),be=({productNo:e,productName:a,brandName:l,brandNameEn:n,imageUrls:r,listImageUrls:p,salePrice:d,immediateDiscountAmt:g,additionDiscountAmt:h,isSoldOut:x,liked:m,nested:w,hidePrice:b,showDeleteBtn:O,onDelete:y,onBrandClick:E,stickerLabels:T,collabBrandName:C,salePeriodType:$,saleStartYmdt:R,saleEndYmdt:K,saleStatusType:G})=>{const{t:N}=te("common"),[Y,z]=f.useState(0),[I,A]=f.useState(m),[F,q]=f.useState(!1);f.useEffect(()=>{A(m)},[m]);const L=o=>o?o.includes("/no_img.png"):!0,k=(()=>{const o=(r||[]).filter(P=>!L(P));if(o.length)return o;const c=(p||[]).filter(P=>!L(P));return c.length?[c[0]]:[]})(),_=k.length,u=j(l?.split(" / ")?.[0]||n),U=j(a),W=j(C),V=j(T?.[0]),B=ne({salePrice:d,immediateDiscountAmt:g,additionDiscountAmt:h}),Z=ie(T),J=x&&!Z,Q=o=>{z(o.realIndex)};return t.jsxs("article",{className:"flex flex-col items-start w-full min-w-0 overflow-hidden",children:[t.jsxs("div",{className:"relative w-full overflow-hidden aspect-[4/5] bg-[#f7f7f7]",children:[t.jsx(v,{to:`/product-detail?productNo=${e}`,tabIndex:-1,"aria-hidden":"true",className:"block w-full h-full",children:_>0?t.jsx(ae,{slidesPerView:1,spaceBetween:1,loop:_>1,nested:w,threshold:10,onSlideChange:Q,onSliderFirstMove:()=>q(!0),className:"w-full h-full",children:k.map((o,c)=>t.jsx(re,{children:c===0||F?t.jsx("img",{className:"w-full h-full object-cover block",src:H(o,600),srcSet:xe(o),sizes:he,alt:U||"",loading:"lazy",decoding:"async"}):t.jsx("div",{className:"w-full h-full bg-[#f7f7f7]","aria-hidden":"true"})},c))}):t.jsx("img",{className:"w-full h-full object-cover block",src:oe,alt:"No image"})}),$==="PERIOD"&&t.jsx(le,{saleStartYmdt:R,saleEndYmdt:K,saleStatusType:G})]}),_>1&&t.jsx("div",{className:"flex items-center justify-start gap-[0.2rem] w-full h-px mt-[0.8rem]",children:k.map((o,c)=>t.jsx("div",{className:i("w-[0.8rem] h-full",c===Y?"bg-[#2e2e2e]":"bg-[#c5c5c5]")},c))}),t.jsxs("div",{className:"flex flex-col items-start w-full pt-[0.8rem]",children:[T?.length>0&&t.jsx("span",{className:i("font-fig-en font-medium","text-[1.2rem] leading-[1.8rem] text-[#DE3162] uppercase"),children:V}),C&&t.jsx("span",{className:i("inline-flex items-center justify-start gap-[0.4rem]","font-fig-en font-normal","text-[1.2rem] leading-[1.8rem] text-black uppercase"),children:t.jsx("span",{children:W})}),u&&(E?t.jsx("button",{type:"button",onClick:()=>E(u),className:i("font-fig-en font-bold","text-[1.2rem] leading-[1.8rem] text-black uppercase"),children:u}):t.jsx(v,{to:`/products?brand=${encodeURIComponent(u)}&sort=RECENT_PRODUCT`,className:i("font-fig-en font-bold","text-[1.2rem] leading-[1.8rem] text-black uppercase"),children:u})),t.jsx(v,{to:`/product-detail?productNo=${e}`,className:i("font-fig-mixed font-normal","text-[1.2rem] leading-[1.8rem] text-black"),children:U||" "}),!b&&(J?t.jsx("p",{className:i("font-normal","text-[1.2rem] leading-[1.8rem] text-[#757575]"),children:N("soldOut")}):t.jsxs("div",{className:"flex items-center justify-start gap-[0.8rem]",children:[t.jsxs(v,{to:`/product-detail?productNo=${e}`,className:i("font-fig-en font-normal","text-[1.2rem] leading-[1.8rem]"),children:["₩",D(B)]}),By?.({productNo:e}),className:"font-fig-mixed font-normal text-[1.2rem] leading-[1.8rem] text-fig-text-secondary",children:N("delete")}):t.jsx(pe,{className:"plp-wishlist-btn",productNo:Number(e),isActive:I,onClick:o=>A(o.isActive),size:0,children:t.jsx("span",{className:i("font-fig-mixed font-normal","text-[1.2rem] leading-[1.8rem] text-[#898989]",!I&&"underline decoration-[0.5px] decoration-[#898989] underline-offset-[0.1rem]"),children:N(I?"delete":"wishlist")})})]})]})};be.propTypes={productNo:s.number,productName:s.string,brandName:s.string,brandNameEn:s.string,imageUrls:s.arrayOf(s.string),listImageUrls:s.arrayOf(s.string),salePrice:s.number,immediateDiscountAmt:s.number,additionDiscountAmt:s.number,isSoldOut:s.bool,saleStatusType:s.string,liked:s.bool,adult:s.bool,nested:s.bool,hidePrice:s.bool,showDeleteBtn:s.bool,onDelete:s.func,onBrandClick:s.func,stickerLabels:s.arrayOf(s.string),collabBrandName:s.string,salePeriodType:s.string,saleStartYmdt:s.string,saleEndYmdt:s.string};export{pe as L,be as P};