1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4737],{99812:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/wishlist",function(){return r(8549)}])},64910:function(e,t,r){"use strict";r.d(t,{d:function(){return d}});var s=r(52676),i=r(21588),l=r(27026),n=r.n(l),a=r(75271),c=r(48588),o=r(89415);let d=e=>"RM".concat(e);t.Z=e=>{let{image:t,title:r,numberOfSales:l,discountPrice:u,originalPrice:h,hasOffer:f,outOfStock:x,discountPercentage:m,id:p,slug:v}=e,{addToWishlist:N,checkIsInWishlist:g,removeFromWishlist:b,loading:w}=(0,o.Ei)(),[j,P]=(0,a.useState)(g(p));return(0,s.jsxs)(n(),{href:(0,c.w)(p,v),className:"relative block h-full overflow-hidden no-underline transition-shadow duration-200 bg-white border rounded-md shadow-sm cursor-pointer hover:shadow-md border-neutral-200",children:[(0,s.jsx)("div",{onClick:e=>{e.preventDefault(),e.stopPropagation(),w||(j?b(p,{onSuccess:()=>{P(!1)}}):N(p,{onSuccess:()=>{P(!0)}}))},"aria-pressed":j,className:"w-8 h-8 group absolute right-3 top-3 z-[2] flex items-center justify-center rounded-full border border-neutral-200 ".concat(j?"bg-[#FB233B]":"bg-white/90"," backdrop-blur transition-transform hover:bg-[#FB233B] cursor-pointer"),children:(0,s.jsx)(i.Z,{className:"w-5 h-5 transition-colors ".concat(j?"text-white":"text-neutral-700"," group-hover:text-white")})}),(()=>{let e=null!=m?Number(m):NaN;return f&&Number.isFinite(e)&&e>0?(0,s.jsxs)("div",{className:"absolute left-3 top-3 z-[1] rounded bg-[#FB233B] px-2 py-1 text-[12px] font-semibold text-white",children:[e,"% OFF"]}):null})(),x&&(0,s.jsx)("div",{className:"absolute left-3 top-10 z-[1] rounded bg-neutral-800 px-2 py-1 text-[12px] font-semibold text-white",children:"OUT OF STOCK"}),(0,s.jsx)("div",{className:"w-full overflow-hidden aspect-square bg-neutral-100",children:(0,s.jsx)("img",{src:t,alt:r,className:"object-cover w-full h-full"})}),(0,s.jsxs)("div",{className:"flex flex-col p-3 items-left",children:[(0,s.jsx)("p",{className:"text-[14px] text-[#111] line-clamp-2",children:r}),"number"==typeof l&&(0,s.jsxs)("p",{className:"mt-1 text-[12px] text-neutral-500",children:[l," Sold"]}),(()=>{let e=null!=h?Number(h):void 0,t=null!=u?Number(u):void 0,r="number"==typeof e&&!Number.isNaN(e)&&e>0,i="number"==typeof t&&!Number.isNaN(t)&&t>0;if(!r&&!i)return null;if(f&&i&&r)return(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,s.jsx)("span",{className:"text-[16px] font-semibold text-[#111]",children:d(t)}),(0,s.jsx)("span",{className:"text-[14px] text-[#9CA3AF] line-through",children:d(e)})]});let l=i?t:e;return(0,s.jsx)("div",{className:"flex items-center gap-2 mt-2",children:(0,s.jsx)("span",{className:"text-[16px] font-semibold text-[#111]",children:d(l)})})})()]})]})}},8549:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return x},default:function(){return m}});
1var s=r(52676),i=r(75271),l=r(46980),n=r(7638),a=r(87213),c=r(5211),o=r(33561),d=r(78051),u=r(64910),h=r(89415),f=e=>{let{item:t,onQuickView:r,refetchWishlist:i}=e,{id:l,slug:n,image:a,title:c,discountPrice:o,originalPrice:f}=t,{removeFromWishlist:x,loading:m}=(0,h.Ei)();return(0,s.jsx)("div",{className:"border-b border-neutral-200",children:(0,s.jsxs)("div",{className:"flex py-6",children:[(0,s.jsxs)("div",{className:"flex gap-4 items-center w-2/5",children:[(0,s.jsx)("img",{src:a,alt:c,className:"object-cover w-40 h-40 rounded-lg"}),c]}),(0,s.jsx)("div",{className:"flex w-1/5",children:o?(0,s.jsxs)("div",{className:"flex gap-2 items-center mt-2",children:[(0,s.jsx)("span",{className:"text-[16px] font-semibold text-[#111]",children:(0,u.d)(o)}),(0,s.jsx)("span",{className:"text-[14px] text-[#9CA3AF] line-through",children:(0,u.d)(f)})]}):(0,s.jsx)("div",{className:"flex gap-2 items-center mt-2",children:(0,s.jsx)("span",{className:"text-[16px] font-semibold text-[#111]",children:(0,u.d)(f)})})}),(0,s.jsx)("div",{className:"flex w-2/5",children:(0,s.jsxs)("div",{className:"flex gap-2 items-center w-2/5",children:[(0,s.jsx)(d.ZP,{type:"primary",onClick:()=>r(l,n),children:"Quick View"}),(0,s.jsx)(d.ZP,{type:"default",onClick:()=>{x(l,{onSuccess:i})},loading:m,children:"Remove"})]})})]})})},x=!0,m=e=>{var t;let{user:r}=e,d=(0,o.useRouter)(),[u,x]=(0,i.useState)(null);(0,i.useEffect)(()=>{try{let e=JSON.parse(localStorage.getItem(h.Cw)||"[]");x(Array.isArray(e)?e:[])}catch(e){x([])}},[]);let m=(0,n.N)({queryKey:["wishlist","list",u,null==r?void 0:r.id],initialPageParam:1,queryFn:async e=>{let{pageParam:t}=e,s={page:t,pageSize:10,sortField:"createdAt",sortOrder:"desc"};return r?await (0,a.Qq)(s):await (0,a.nT)({...s,productIds:u||[]})},getNextPageParam:(e,t)=>{let r=e.data.total;return t.reduce((e,t)=>e+t.data.rows.length,0)<r?t.length+1:void 0}}),p=(0,i.useRef)(null),{isLoading:v,isFetchingNextPage:N,hasNextPage:g,fetchNextPage:b}=m,w=!!g,j=(0,i.useCallback)(()=>{v||N||!w||b()},[v,N,w,b]);(0,i.useEffect)(()=>{if(!w)return;let e=p.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;t.isIntersecting&&j()},{root:null,rootMargin:"200px 0px",threshold:.01});return t.observe(e),()=>t.disconnect()},[w,j]);let P=(e,t)=>{d.push("/product/".concat(e,"/").concat(t))},y=()=>{m.refetch(),x(JSON.parse(localStorage.getItem(h.Cw)||"[]"))},k=(0,i.useMemo)(()=>{var e,t;return null!==(t=null===(e=m.data)||void 0===e?void 0:e.pages.flatMap(e=>e.data.rows.map(e=>(0,c.f)(e))))&&void 0!==t?t:[]},[null===(t=m.data)||void 0===t?void 0:t.pages]);return(0,s.jsx)(l.Z,{user:r,children:(0,s.jsxs)("div",{className:"p-4 maxContainer",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold",children:"My wishlist"}),(0,s.jsxs)("div",{className:"flex mt-10 text-lg font-semibold",children:[(0,s.jsx)("div",{className:"w-2/5",children:"Product"}),(0,s.jsx)("div",{className:"w-1/5",children:"Price"}),(0,s.jsx)("div",{className:"w-2/5",children:"Actions"})]}),(0,s.jsx)("div",{className:"mt-2 mb-[-3px] border-b border-neutral-200"}),null==k?void 0:k.map(e=>(0,s.jsx)(f,{item:e,onQuickView:P,refetchWishlist:y},e.id)),(0,s.jsx)("div",{ref:p,className:"w-full h-4"}),(0,s.jsxs)("div",{className:"flex justify-center py-6 text-sm text-neutral-500",children:[(v||N)&&w&&(0,s.jsx)("span",{children:"Loading more..."}),!w&&k.length>0&&(0,s.jsx)("span",{children:"No more items"})]})]})})}},5211:function(e,t,r){"use strict";r.d(t,{f:function(){return a}});var s=r(99764),i=r(22903);let l=e=>{if(null==e)return;let t=Number(e);return Number.isNaN(t)?void 0:t},n=e=>{if(e.type!==s.kv.VARIABLE||!e.variations||0===e.variations.length)return null;let t=e=>{var t;let r=null!==(t=l(e.price))&&void 0!==t?t:0,s=l(e.discountedPrice);return s&&s>0?s:r},r=e.variations.filter(e=>e.enabled&&t(e)>0);return 0===r.length?null:r.reduce((e,r)=>t(r)<t(e)?r:e)},a=e=>{var t,r;let a,c,o;let d=!1;if(e.type===s.kv.SIMPLE){let t=l(e.price),r=l(e.discountedPrice);a=t&&t>0?t:void 0,d=!!(c=r&&r>0?r:void 0)&&c>0}else if(e.type===s.kv.VARIABLE){let t=n(e);if(t){let e=l(t.price),r=l(t.discountedPrice);a=e&&e>0?e:void 0,d=!!(c=r&&r>0?r:void 0)&&c>0}else{let t=l(e.price),r=l(e.discountedPrice);a=t&&t>0?t:void 0,d=!!(c=r&&r>0?r:void 0)&&c>0}}if("number"==typeof a&&a>0&&"number"==typeof c&&c>0&&c<a){let e=Math.round((a-c)/a*100);e>0&&(o=String(e))}return{image:(0,i.I)(null===(t=e.image)||void 0===t?void 0:t.key),title:e.name,numberOfSales:null!==(r=e.totalSales)&&void 0!==r?r:0,discountPercentage:o,hasOffer:d,originalPrice
1:a,discountPrice:c,outOfStock:e.isOutOfStock,id:e.refId,slug:e.slug}}},7638:function(e,t,r){"use strict";r.d(t,{N:function(){return a}});var s=r(66693),i=r(67565),l=class extends s.z{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:r}=e,s=super.createResult(e,t),{isFetching:l,isRefetching:n,isError:a,isRefetchError:c}=s,o=r.fetchMeta?.fetchMore?.direction,d=a&&"forward"===o,u=l&&"forward"===o,h=a&&"backward"===o,f=l&&"backward"===o;return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,i.Qy)(t,r.data),hasPreviousPage:(0,i.ZF)(t,r.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:h,isFetchingPreviousPage:f,isRefetchError:c&&!d&&!h,isRefetching:n&&!u&&!f}}},n=r(12882);function a(e,t){return(0,n.r)(e,l,t)}}},function(e){e.O(0,[5989,4237,7610,8174,9834,8051,9830,6980,2888,9774,179],function(){return e(e.s=99812)}),_N_E=e.O()}]);
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.