1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2e418fd7-495e-4fdd-9aa1-1f4f1cd55627",e._sentryDebugIdIdentifier="sentry-dbid-2e418fd7-495e-4fdd-9aa1-1f4f1cd55627")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5452],{95452:(e,t,l)=>{l.r(t),l.d(t,{default:()=>L});var r=l(95155),n=l(12115),i=l(57872),a=l(78966),o=l(85402),s=l(34919),d=l(13149),u=l(99954),c=l(20796),f=l(70542),p=l(67725),h=l(64656),m=l(90368),v=l(27937),x=l(25507),g=l(98608),w=l(70621),y=l(34561),C=l(61894),b=l(52711),_=l(25656),S=l(69764),j=l(375),N=l(41081),k=l(43700),T=l(15669),I=l.n(T);let A=e=>{let{productList:t,title:l,section:i,freeShippingText:a}=e,[o,p]=(0,n.useState)(t),{sessionId:T}=(0,N.useCartStore)(),{getLikeNum:A,user:L}=(0,f.useAppStore)(),{ready:P}=(0,s.h)(),{t:D}=(0,u.Bd)();(0,y.al)();let E=(0,k.S)(e=>e.openQuickView),F=(0,n.useRef)(null),[R,U]=(0,n.useState)(!0),[q,B]=(0,n.useState)(!1),[V,z]=(0,n.useState)(!1),O=(0,n.useCallback)(()=>{if(!F.current)return;let{scrollLeft:e,scrollWidth:t,clientWidth:l}=F.current;z(t>l+1),U(e<=1),B(Math.ceil(e+l)>=t-1)},[]);(0,n.useEffect)(()=>{O();let e=F.current;if(!e)return;let t=null;return"undefined"!=typeof ResizeObserver&&(t=new ResizeObserver(()=>{O()})).observe(e),window.addEventListener("resize",O),()=>{window.removeEventListener("resize",O),null==t||t.disconnect()}},[o,O]);let W=(0,n.useRef)([]),H=(0,n.useRef)(null);(0,d.R)(".ex-".concat(i),{onExposure:(0,n.useCallback)(e=>{let t=e.getAttribute("data-handle"),l=e.getAttribute("data-name"),r=e.getAttribute("data-product-id");W.current.push({collection_handler:null!=t?t:"",collection_name:null!=l?l:"",product_id:null!=r?r:""}),H.current&&clearTimeout(H.current),H.current=setTimeout(()=>{(0,h.Ql)(W.current,i),W.current=[]},500)},[i])});let M=(0,n.useCallback)(async e=>{try{let t=await (0,x.Tl)(e);p(l=>(0,S.B)(l,e,t))}catch(e){console.error("[pdp-recommend] refresh cart quantity failed",e)}},[]),Q=async e=>{await (0,b.A)();let t=N.useCartStore.getState().sessionId;p(o.map(t=>t.productId===e?{...t,isLoading:!0}:t));let l=o.find(t=>t.productId===e);if(l){var r;let n={productId:e,sessionId:t,userId:L.id};if(null!=(r=null==l?void 0:l.isLike)&&r)if(0===(await _.Ay.post("/api/my/favorite/remove",n)).data.code){let t=o.map(t=>t.productId===e?{...t,isLike:!1,isLoading:!1}:t);p(t),A(),C.iU.success(D("wishlist.remove_wishlist"));let l=t.findIndex(t=>t.productId===e);(0,j.sx)({event_name:"add_to_wishlist",section:"page_recommend",page_type:"PRODUCTS",event_params:[{product_id:e,position:l,is_wish:0}]})}else C.iU.error(D("favorite.removeError"));else if(0===(await _.Ay.post("/api/my/favorite/add",n)).data.code){let t=o.map(t=>t.productId===e?{...t,isLike:!0,isLoading:!1}:t),l=t.findIndex(t=>t.productId===e);(0,j.sx)({event_name:"add_to_wishlist",section:"page_recommend",page_type:"PRODUCTS",event_params:[{product_id:e,position:l,is_wish:1}]}),p(t),A(),C.iU.success(D("wishlist.add_wishlist"))}else C.iU.error(D("productDetail.addFavoriteError"))}},G=(0,n.useCallback)(async e=>{if(!P||!T||!e||0===e.length)return;let t=e.map(e=>{var t;return null!=(t=e.productId)?t:""}).filter(e=>!!e),l=await (0,g.yG)({sessionId:T,productIdList:t});if(0===l.code){let e=Array.isArray(l.data)?l.data:[];p(t=>t.map(t=>{var l;return{...t,isLike:e.includes(null!=(l=t.productId)?l:"")}}))}},[P,T]);return(0,n.useEffect)(()=>{t&&0!=t.length&&(p(t),G(t))},[t,G]),(0,r.jsxs)("div",{className:(0,c.cn)("mt-5 w-full",I().container),children:[(0,r.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"font-herbik text-lg font-normal leading-8 text-[#393939]",children:l}),V&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{onClick:()=>{if(!F.current)return;let e=F.current,t=e.clientWidth+16;e.scrollTo({left:e.scrollLeft-t,behavior:"smooth"})},disabled:R,className:(0,c.cn)("flex h-8 w-8 items-center justify-center rounded-full bg-[#F7F7F7] transition-all",R?"cursor-not-allowed text-[#CCCCCC]":"cursor-pointer hover:bg-gray-50 active:scale-95"),children:(0,r.jsx)(m.A,{className:(0,
1c.cn)("flex h-5 w-5 items-center justify-center text-[#696969]",R&&"text-[#CCCCCC]")})}),(0,r.jsx)("button",{onClick:()=>{if(!F.current)return;let e=F.current,t=e.clientWidth+16;e.scrollTo({left:e.scrollLeft+t,behavior:"smooth"})},disabled:q,className:(0,c.cn)("flex h-8 w-8 items-center justify-center rounded-full bg-[#F7F7F7] transition-all",q?"cursor-not-allowed":"cursor-pointer hover:bg-gray-50 active:scale-95"),children:(0,r.jsx)(v.A,{className:(0,c.cn)("flex h-5 w-5 items-center justify-center text-[#696969]",q&&"text-[#CCCCCC]")})})]})]}),(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("div",{ref:F,onScroll:O,className:"no-scrollbar flex w-full flex-nowrap gap-4 overflow-x-auto scroll-smooth",children:(null==o?void 0:o.length)===0?null:null==o?void 0:o.map((e,t)=>{var l;return(0,r.jsx)("div",{className:I().itemWrapper,children:(0,r.jsx)(w.A,{isCustomized:!!(null==e?void 0:e.customize),urlPath:"/products/".concat(encodeURIComponent(null!=(l=e.handle)?l:"")),exposureName:"ex-".concat(i),isFreeShipping:!!(null==e?void 0:e.showFreeShipping),freeShippingText:a||"",layoutOptimize:!1,index:t,item:e,"data-handle":e.handle,"data-name":e.title,"data-product-id":e.productId,isDivide:!1,onFavoriteClick:()=>{var t;return Q(null!=(t=e.productId)?t:"")},onAddToCart:()=>{let t=(0,S.E)(e);t&&E(t,{trackEventSection:"product_detail-".concat(i,"-view_modal"),...e.cartNum&&e.cartNum>0?{addToCartText:D("cart.add_update_cart",{defaultValue:"Add/Update Cart"})}:{},fields:"cartNum",onClose:()=>{M(t)}})},onProductClick:()=>{var t,l,r;(0,h.PQ)(null!=(t=e.productId)?t:"",null!=(l=e.handle)?l:"",null!=(r=e.title)?r:"",i)}})},t)})})})]})};function L(e){var t,l,m,v,x,g,w,y,C,b,_,S,j,N,k;let{productId:T}=e,{t:I}=(0,u.Bd)(),[L,P]=(0,n.useState)({}),[D,E]=(0,n.useState)(!1),{ready:F,tabLocaleReady:R}=(0,s.h)(),{tabLocaleRevision:U}=(0,f.useAppStore)(),{loading:q}=(0,i.A)(async()=>{let e=await (0,a.e)({productId:T});return(null==e?void 0:e.code)===0&&(null==e?void 0:e.data)?e.data:null},{ready:F&&R&&!!T,refreshDeps:[T,U],onSuccess:e=>{e&&P(e)},onError:e=>{console.error("[pdp-recommend] client refetch failed",e)},onFinally:()=>{E(!0)}}),B=(0,n.useMemo)(()=>{var e;return null!=(e=null==L?void 0:L.searchWordList)?e:[]},[null==L?void 0:L.searchWordList]),V=(0,d.p)({onExposure:(0,n.useCallback)(()=>{let e=B.map(e=>({collection_name:e.collectionName||e.word||""}));(0,h.sd)(e)},[B])});return(null!=(w=null==L||null==(t=L.frequentlyBought)?void 0:t.length)?w:0)>0||(null!=(y=null==L||null==(l=L.collectionPopular)?void 0:l.length)?y:0)>0||(null!=(C=null==L||null==(m=L.itemSimilar)?void 0:m.length)?C:0)>0||B.length>0?(0,r.jsxs)("div",{className:"mx-auto mb-12 w-full 2xl:mb-20",children:[(null!=(b=null==(v=L.frequentlyBought)?void 0:v.length)?b:0)>0&&(0,r.jsx)(A,{freeShippingText:L.freeShippingText,productList:null!=(_=L.frequentlyBought)?_:[],title:I("productDetailPC.frequentlyBought",{defaultValue:"Frequently Bought Together"}),section:"page-frequently_bought_together"}),(null!=(S=null==(x=L.collectionPopular)?void 0:x.length)?S:0)>0&&(0,r.jsx)(A,{freeShippingText:L.freeShippingText,productList:null!=(j=L.collectionPopular)?j:[],title:I("productDetailPC.collectionPopular_V2",{defaultValue:"Popular Products in This factory"}),section:"page-popular_in_this_collection"}),(null!=(N=null==(g=L.itemSimilar)?void 0:g.length)?N:0)>0&&(0,r.jsx)(A,{freeShippingText:L.freeShippingText,productList:null!=(k=L.itemSimilar)?k:[],title:I("productDetailPC.itemSimilar",{defaultValue:"Discover More Like This"}),section:"page-similar_items"}),B.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-3",ref:V,children:[(0,r.jsx)("h2",{className:"font-herbik text-lg font-normal leading-8 text-[#393939]",children:I("productDetailPC.relatedSearches",{defaultValue:"Related Searches"})}),(0,r.jsx)("div",{className:"flex w-full flex-wrap gap-3",children:B.map((e,t)=>{let l=(null==e?void 0:e.urlHandle)?(null==e?void 0:e.collectionName)||(null==e?void 0:e.word):(null==e?void 0:e.word)||"",n="";return n=e.urlHandle?(0,c.wN)(e.collectionType,e.urlHandle||""):"/search?q=".concat(encodeURIComponent(e.urlHandle||e.word||"")),(0,r.jsx)(o.default,{target:"_blank",to:n,onClick:()=>{(0,h.Vf)(l||"")},children:(0,r.jsx)("div",{className:"flex h-8 min-w-[80px] items-center justify-center rounded-full bg-[#fafafa] px-3 hover:bg-[#ececec]",children:(0,r.jsx)("div",{className:"justify-center font-GTStandard text-xs font-normal leading-8 text-[#696969]",children:l})})},"".concat(e,"-").concat(t))})})]})]}):F&&D&&!q?null:(0,r.jsx)(p.A,{})}}}]);
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.