(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4800],{73276:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/shop",function(){return s(89399)}])},89399:function(e,n,s){"use strict";s.r(n);var t=s(85893),l=s(67294),r=s(80129),i=s.n(r),o=s(9008),c=s.n(o),u=s(11163),d=s(65582),a=s(5616),h=s(51233),x=s(15861),m=s(46901),j=s(86886),Z=s(15054),g=s(74934),p=s(93577),f=s(58026),y=s(1764),_=s(37996),P=s(41320),v=s(73709),S=s(75874);let w=e=>Array.isArray(e)?e:e?[e]:[],E=()=>{let{translate:e}=(0,v.ZP)(),{isMobile:n,isTablet:s}=(0,P.Z)(),[r,o]=(0,l.useState)(!0),[E,b]=(0,l.useState)({}),C=(0,u.useRouter)(),{message:N,...k}=(0,l.useMemo)(()=>{let{categories:e,labels:n,brands:s,attributeValues:t,...l}=C.query;return{...l,labels:w(n),brands:w(s),categories:w(e),attributeValues:w(t)}},[null==C?void 0:C.query]),M=(0,l.useMemo)(()=>JSON.stringify(k),[k]),T=()=>{o(!0),(0,_.Z)({method:"GET",url:"products?".concat(i().stringify({page:1,take:30,order:"DESC",...k}))}).then(e=>{var n;(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.length)?b(e):C.push("/shop?message=NoProductsWereFoundMatchingYourSelection")}).finally(()=>o(!1))};(0,l.useEffect)(()=>{C.isReady&&T()},[M]);let{page:q=0,take:O=0,pageCount:A=0,itemCount:F=0,productsList:L=[]}=(0,l.useMemo)(()=>({productsList:null==E?void 0:E.data,...(null==E?void 0:E.meta)||{}}),[E]),R=(0,l.useMemo)(()=>{let e=(q-1)*O+1;return"".concat(e,"-").concat(Math.min(e+O-1,F))},[q,O,F]),W=(0,l.useCallback)((e,n)=>{let s=(0,y.o)(k,"page",n);C.push({pathname:"/shop",query:s})},[k]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c(),{children:(0,t.jsx)("title",{children:e("Shop")||"Shop"})}),(0,t.jsxs)(d.Z,{sx:{my:s?2:5},children:[(0,t.jsx)(a.Z,{my:s?2:6}),(0,t.jsxs)(h.Z,{direction:s?"column":"row",spacing:s?2:3,mb:4,children:[(0,t.jsx)(a.Z,{flex:1,maxWidth:282,children:(0,t.jsx)(p.Z,{query:k})}),(0,t.jsxs)(a.Z,{flex:1,children:[(0,t.jsxs)(a.Z,{sx:S.Z.head,children:[(null==L?void 0:L.length)&&!r?(0,t.jsx)(x.Z,{fontSize:16,color:"custom.grayscale.scale.70",children:e("ShowCounter",{change:{"{{SIZE}}":R,"{{TOTAL_COUNT}}":F}})}):(0,t.jsx)(a.Z,{}),!n&&(0,t.jsx)(g.Z,{query:k})]}),N&&(0,t.jsx)(a.Z,{pb:3,children:(0,t.jsx)(m.Z,{color:"warning",children:e(N)})}),r?(0,t.jsxs)(j.ZP,{container:!0,spacing:2,children:[(0,t.jsx)(j.ZP,{item:!0,xs:6,md:4,lg:3,children:(0,t.jsx)(f.m,{})}),(0,t.jsx)(j.ZP,{item:!0,xs:6,md:4,lg:3,children:(0,t.jsx)(f.m,{})}),(0,t.jsx)(j.ZP,{item:!0,xs:6,md:4,lg:3,children:(0,t.jsx)(f.m,{})}),(0,t.jsx)(j.ZP,{item:!0,xs:6,md:4,lg:3,children:(0,t.jsx)(f.m,{})})]}):Boolean(null==L?void 0:L.length)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.ZP,{container:!0,spacing:1,children:L.map(e=>(0,t.jsx)(j.ZP,{item:!0,xs:6,md:4,lg:3,children:(0,t.jsx)(f.Z,{product:e})},e.id))}),F>O&&(0,t.jsx)(a.Z,{mt:4,display:"flex",justifyContent:"flex-end",children:(0,t.jsx)(Z.Z,{shape:"rounded",page:q,count:A,onChange:W})})]})]})]})]})]})};n.default=E},24654:function(){}},function(e){e.O(0,[6886,1013,3143,5873,5586,5054,7739,5250,9774,2888,179],function(){return e(e.s=73276)}),_N_E=e.O()}]);