"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7670],{63078:function(e,t,l){l.r(t);var c=l(82729),n=l(85893),a=l(67294),s=l(71641),i=l(68806),r=l(65706),o=l(87261),d=l(90532);function _templateObject(){let e=(0,c._)(["\n  query getBrands($type: String) {\n    getBrands(type: $type) {\n      brand\n    }\n  }\n"]);return _templateObject=function(){return e},e}let u=(0,i.Ps)(_templateObject());t.default=()=>{let e=(0,a.useContext)(d.Z),t=e.isChecked;e.filterChecked;let[l,c]=(0,a.useState)(!1);var{loading:i,data:p}=(0,s.aM)(u,{variables:{type:e.state}});return(0,n.jsxs)("div",{className:"collection-collapse-block open",children:[(0,n.jsx)("h3",{className:"collapse-block-title",onClick:()=>c(!l),children:"brand"}),(0,n.jsx)(r.Z,{isOpen:l,children:(0,n.jsx)("div",{className:"collection-collapse-block-content",children:(0,n.jsx)("div",{className:"collection-brand-filter",children:p&&p.getBrands&&0!==p.getBrands.length&&!i?p&&p.getBrands.brand.map((l,c)=>(0,n.jsxs)("div",{className:"form-check custom-checkbox collection-filter-checkbox",children:[(0,n.jsx)(o.Z,{checked:e.selectedBrands.includes(l),onChange:()=>{e.handleBrands(l,t)},type:"checkbox",className:"custom-control-input",id:l}),(0,n.jsx)("label",{className:"custom-control-label",htmlFor:l,children:l})]},c)):"loading"})})})]})}},77825:function(e,t,l){l.r(t);var c=l(82729),n=l(85893),a=l(67294),s=l(71641),i=l(68806),r=l(65706),o=l(87261),d=l(90532);function _templateObject(){let e=(0,c._)(["\n    query getColors($type:String)  {\n        getColors(type: $type){\n            colors\n        }\n    }\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,c._)(['\n    {\n        customAttributeMetadata(\n          attributes: [\n            {\n              attribute_code: "color"\n              entity_type: "catalog_product"\n            }\n          ]\n        ) {\n          items {\n            attribute_code\n            attribute_type\n            entity_type\n            input_type\n            attribute_options {\n             value\n             label\n           }\n          }\n        }\n    }\n      \n']);return _templateObject1=function(){return e},e}(0,i.Ps)(_templateObject());let u=(0,i.Ps)(_templateObject1());t.default=()=>{let e=(0,a.useContext)(d.Z),[t,l]=(0,a.useState)(!1);var c,{loading:i,data:p}=(0,s.aM)(u,{variables:{type:e.state}});return(0,n.jsxs)("div",{className:"collection-collapse-block open",children:[(0,n.jsx)("h3",{className:"collapse-block-title",onClick:()=>l(!t),children:"colors"}),(0,n.jsx)(r.Z,{isOpen:t,children:(0,n.jsx)("div",{className:"collection-collapse-block-content",children:(0,n.jsx)("div",{className:"collection-brand-filter",children:!p||!p.customAttributeMetadata||p.customAttributeMetadata.items[0].attribute_options.length<0||i?(0,n.jsx)("h4",{children:"Loading"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"form-check custom-checkbox collection-filter-checkbox",children:[(0,n.jsx)(o.Z,{checked:""===e.selectedColor,onChange:()=>{e.setSelectedColor("")},type:"checkbox",className:"custom-control-input",id:"emptyColor"}),(0,n.jsx)("label",{className:"custom-control-label",htmlFor:"emptyColor",children:"Any Color"})]}),null==p?void 0:null===(c=p.customAttributeMetadata)||void 0===c?void 0:c.items[0].attribute_options.map((t,l)=>(0,n.jsxs)("div",{className:"form-check custom-checkbox collection-filter-checkbox",children:[(0,n.jsx)(o.Z,{checked:e.selectedColor.includes(t.value),onChange:()=>{e.setSelectedColor(t.value)},type:"checkbox",className:"custom-control-input",id:t.value}),(0,n.jsx)("label",{className:"custom-control-label",htmlFor:t.value,children:t.label})]},l))]})})})})]})}},17670:function(e,t,l){l.r(t),l.d(t,{default:function(){return filter}});var c=l(82729),n=l(85893),a=l(67294),s=l(95305),i=l(65706),r=l(87261),o=l(48654),d=l(39667);l(63078),l(77825),l(62637),l(91159);var u=l(13260),p=l(68806),m=l(71641),h=l(90532),x=l(11163);function _templateObject(){let e=(0,c._)(["\nquery getaggregations($catid : String!) {\n    products(filter: { category_id: { eq: $catid } }) {\n      total_count\n      aggregations{\n        attribute_code\n        label\n        count\n        options{\n          count\n          label\n          value\n          \n        }\n      }\n    }\n  }"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,c._)(['\n{\n    customAttributeMetadata(\n      attributes: [\n        {\n          attribute_code: "color"\n          entity_type: "catalog_product"\n        }\n      ]\n    ) {\n      items {\n        attribute_code\n        attribute_type\n        entity_type\n        input_type\n        attribute_options {\n         value\n         label\n       }\n      }\n    }\n}\n']);return _templateObject1=function(){return e},e}let b=(0,p.Ps)(_templateObject());(0,p.Ps)(_templateObject1());var filter=e=>{let{sm:t,sidebarView:l,closeSidebar:c}=e;(0,x.useRouter)();let[p,j]=(0,a.useState)([]),f=(0,a.useContext)(h.Z),[g,v]=(0,a.useState)({}),[y,k]=(0,a.useState)({}),_=(0,m.aM)(b,{variables:{catid:f.state?f.state:""},skip:!f.state}),toggle=e=>{var t={...g};t[e]=!t[e],v(t)},fetchFilter=async()=>{let{data:e}=await _.refetch();j(e.products.aggregations);var t={};e.products.aggregations.map((e,l)=>{t[e.attribute_code]=!1}),v(t)};(0,a.useEffect)(()=>{fetchFilter()},[f.state]);let handleSelectedOptions=(e,t,l)=>{k(c=>c.hasOwnProperty(t)?l?{...c,[t]:{in:[...c[t].in,e]}}:{...c,[t]:{in:[...c[t].in].filter(t=>t!==e)}}:{...c,[t]:{in:[e]}})};return(0,a.useEffect)(()=>{f.setselectedOptions(y)},[y]),(0,a.useEffect)(()=>{f.setselectedOptions({})},[f.selectedCategoryurl,f.selectedCategoryurl]),(0,a.useEffect)(()=>{window.location.pathname;var e=p.find(e=>"price"===e.attribute_code);if(e){var t=parseInt(e.options[(null==e?void 0:e.options.length)-1].value.split("_")[1]);f.setSelectedPrice({min:0,max:t})}},[p,f.state,f.selectedCategoryurl]),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(s.Z,{sm:t,className:"collection-filter",style:l?{left:"0px"}:{},children:[(0,n.jsxs)("div",{className:"collection-filter-block",children:[(0,n.jsx)("div",{className:"collection-mobile-back",onClick:()=>c(),children:(0,n.jsxs)("span",{className:"filter-back",children:[(0,n.jsx)("i",{className:"fa fa-angle-left","aria-hidden":"true"})," back"]})}),(0,n.jsx)(d.default,{}),p.length>0&&p.map((e,t)=>"category_uid"!==e.attribute_code&&"price"!==e.attribute_code?(0,n.jsxs)("div",{className:"collection-collapse-block open",children:[(0,n.jsx)("h3",{className:"collapse-block-title",onClick:()=>toggle(e.attribute_code),children:e.label}),(0,n.jsx)(i.Z,{isOpen:g[e.attribute_code],children:(0,n.jsx)("div",{className:"collection-collapse-block-content",children:(0,n.jsx)("div",{className:"collection-brand-filter",children:e.options.map((t,l)=>(0,n.jsxs)("div",{className:"form-check custom-checkbox collection-filter-checkbox",children:[(0,n.jsx)(r.Z,{checked:!!f.selectOptions[e.attribute_code]&&f.selectOptions[e.attribute_code].in.includes(t.value),onChange:l=>{handleSelectedOptions(t.value,e.attribute_code,l.target.checked)},type:"checkbox",className:"custom-control-input",id:t.value}),(0,n.jsxs)("label",{className:"custom-control-label",htmlFor:t.value,children:[t.label," (",t.count,")"]})]},"p"+l))})})})]},"o"+t):"price"===e.attribute_code&&(0,n.jsx)(u.default,{item:e},"o"+t))]}),(0,n.jsx)(o.default,{})]})})}},48654:function(e,t,l){l.r(t);var c=l(82729),n=l(85893),a=l(67294),s=l(71641),i=l(68806),r=l(51436),o=l(46066),d=l(61007),u=l(11163);function _templateObject(){let e=(0,c._)(["\n  query newProducts($type: String!) {\n    newProducts(type: $type) {\n      title\n      price\n      images {\n        alt\n        src\n      }\n    }\n  }\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,c._)(['\n{\n  products(search: "", pageSize: 8, sort:{position: DESC}) {\n    items {\n      id\n      name\n      sku\n      url_key\n      rating_summary\n      review_count  \n      price {\n        regularPrice {\n          amount {\n            value\n            currency\n          }\n        }\n      }\n      image{\n        url\n      }\n    }\n  }\n}\n']);return _templateObject1=function(){return e},e}(0,i.Ps)(_templateObject());let p=(0,i.Ps)(_templateObject1());t.default=()=>{let e=(0,u.useRouter)(),t=(0,a.useContext)(d.$R),l=t.state.symbol;var{loading:c,data:i}=(0,s.aM)(p);let clickProductDetail=t=>{e.push("/product/".concat(t.url_key),void 0,{shallow:!0})};return(0,n.jsxs)("div",{className:"theme-card",children:[(0,n.jsx)("h5",{className:"title-border",children:"new product"}),(0,n.jsxs)(o.Z,{className:"offer-slider slide-1",children:[(0,n.jsx)("div",{children:i&&i.products&&0!==i.products.length&&!c?(0,n.jsx)(n.Fragment,{children:i&&i.products.items.slice(0,3).map((e,t)=>(0,n.jsxs)("div",{className:"media",children:[(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsx)(r.Z,{className:"img-fluid blur-up lazyload",src:e.image.url,alt:e.name})}),(0,n.jsxs)("div",{className:"media-body align-self-center",children:[(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsx)("h6",{className:"truncate-text",style:{width:"100px"},children:e.name})}),(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsxs)("h4",{children:[l,e.price.regularPrice.amount.value]})})]})]},t))}):"loading"}),(0,n.jsx)("div",{children:i&&i.products&&0!==i.products.length&&!c?(0,n.jsx)(n.Fragment,{children:i&&i.products.items.slice(4,7).map((e,t)=>(0,n.jsxs)("div",{className:"media",children:[(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsx)(r.Z,{className:"img-fluid blur-up lazyload",src:e.image.url,alt:e.name})}),(0,n.jsxs)("div",{className:"media-body align-self-center",children:[(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsx)("h6",{onClick:()=>clickProductDetail(e),style:{width:"100px"},className:"truncate-text",children:e.name})}),(0,n.jsx)("a",{href:"#",onClick:()=>clickProductDetail(e),children:(0,n.jsxs)("h4",{children:[l,e.price.regularPrice.amount.value]})})]})]},t))}):"loading"})]})]})}},91159:function(e,t,l){l.r(t);var c=l(85893),n=l(67294),a=l(94398),s=l(90532),i=l(11163),r=l(65706);t.default=()=>{let[e,t]=(0,n.useState)(!1),l=(0,n.useContext)(s.Z),[o,d]=(0,n.useState)([0,l.maximumPrice?l.maximumPrice:l.max]),u=l.selectedPrice,p=(0,i.useRouter)(),m=l.setSelectedPrice,[h,x]=(0,n.useState)();(0,n.useEffect)(()=>{let e=window.location.pathname;x(e)},[]);let priceHandle=e=>{if(e){var t,c;m({min:e[0],max:e[1]}),d(e),p.push("/product-category/".concat(l.selectedCategoryurl,"?minPrice=").concat(null===(t=l.selectedPrice)||void 0===t?void 0:t.min,"&maxPrice=").concat(null===(c=l.selectedPrice)||void 0===c?void 0:c.max),void 0,{shallow:!0})}};return(0,n.useEffect)(()=>{d([0,l.maximumPrice])},[l.selectedCategoryurl]),(0,c.jsxs)("div",{className:"collection-collapse-block border-0 open",children:[(0,c.jsx)("h3",{className:"collapse-block-title",onClick:()=>t(!e),children:"price"}),(0,c.jsx)(r.Z,{isOpen:e,children:(0,c.jsx)("div",{className:"collection-collapse-block-content",children:(0,c.jsx)("div",{className:"wrapper mt-3",children:(0,c.jsx)("div",{className:"range-slider",children:(0,c.jsx)(a.Range,{values:o,step:10,min:0,max:l.maximumPrice,onChange:e=>{priceHandle(e)},renderTrack:e=>{let{props:t,children:l}=e;return(0,c.jsxs)("div",{onMouseDown:t.onMouseDown,onTouchStart:t.onTouchStart,style:{...t.style,height:"36px",display:"flex",width:"100%"},children:[(0,c.jsx)("output",{style:{marginTop:"30px"},children:o[0]}),(0,c.jsx)("div",{ref:t.ref,style:{height:"5px",width:"100%",borderRadius:"4px",background:(0,a.getTrackBackground)({values:o,colors:["#ccc","#f84c3c","#ccc"],min:u.min,max:u.max}),alignSelf:"center"},children:l}),(0,c.jsx)("output",{style:{marginTop:"30px"},children:o[1]})]})},renderThumb:e=>{let{props:t}=e;return(0,c.jsx)("div",{...t,style:{...t.style,height:"16px",width:"16px",borderRadius:"60px",backgroundColor:"#f84c3c",display:"flex",justifyContent:"center",alignItems:"center",boxShadow:"0px 2px 6px #AAA"}})}})})})})})]})}},13260:function(e,t,l){l.r(t);var c=l(85893),n=l(67294),a=l(94398),s=l(90532),i=l(11163),r=l(65706),o=l(23279),d=l.n(o);t.default=e=>{let{item:t}=e,l=null==t?void 0:t.options[(null==t?void 0:t.options.length)-1].value,[o,u]=(0,n.useState)(!1),p=(0,n.useContext)(s.Z),[m,h]=(0,n.useState)([0,1]);p.selectedPrice;let x=(0,i.useRouter)(),b=p.setSelectedPrice,[j,f]=(0,n.useState)(""),g=x.query.minPrice?parseInt(x.query.minPrice):0;(0,n.useEffect)(()=>{let e=window.location.pathname;f(e)},[]),(0,n.useEffect)(()=>{if(!x.query.maxPrice){let e=parseInt(l.split("_")[1]);h([g,e])}if(x.query.maxPrice){let e=parseInt(x.query.maxPrice);h([g,e])}},[x]);let priceHandle=e=>{e&&h(e)},v=d()(()=>{b({min:m[0],max:m[1]}),x.push("".concat(j,"?category=").concat(p.state,"&minPrice=").concat(m[0],"&maxPrice=").concat(m[1]),void 0,{shallow:!0})},1e3);return(0,n.useEffect)(()=>{let e=parseInt(l.split("_")[1]);h([0,e])},[l,p.state,p.selectedCategoryurl]),(0,c.jsxs)("div",{className:"collection-collapse-block border-0 open",children:[(0,c.jsx)("h3",{className:"collapse-block-title",onClick:()=>u(!o),children:"Price"}),(0,c.jsx)(r.Z,{isOpen:o,children:(0,c.jsx)("div",{className:"collection-collapse-block-content",children:(0,c.jsx)("div",{className:"wrapper mt-3",children:(0,c.jsx)("div",{className:"range-slider",children:(0,c.jsx)(a.Range,{values:m,step:10,min:0,max:parseInt(l.split("_")[1]),onChange:e=>{priceHandle(e)},onFinalChange:v,renderTrack:e=>{let{props:t,children:n}=e;return(0,c.jsxs)("div",{onMouseDown:t.onMouseDown,onTouchStart:t.onTouchStart,style:{...t.style,height:"36px",display:"flex",width:"100%"},children:[(0,c.jsx)("output",{style:{marginTop:"30px"},children:m[0]}),(0,c.jsx)("div",{ref:t.ref,style:{height:"5px",width:"100%",borderRadius:"4px",background:(0,a.getTrackBackground)({values:m,colors:["#ccc","#f84c3c","#ccc"],min:0,max:parseInt(l.split("_")[1])}),alignSelf:"center"},children:n}),(0,c.jsx)("output",{style:{marginTop:"30px"},children:m[1]})]})},renderThumb:e=>{let{props:t}=e;return(0,c.jsx)("div",{...t,style:{...t.style,height:"16px",width:"16px",borderRadius:"60px",backgroundColor:"#f84c3c",display:"flex",justifyContent:"center",alignItems:"center",boxShadow:"0px 2px 6px #AAA"}})}})})})})})]})}},62637:function(e,t,l){l.r(t);var c=l(82729),n=l(85893),a=l(67294),s=l(71641),i=l(68806),r=l(65706),o=l(87261),d=l(90532);function _templateObject(){let e=(0,c._)(["\n  query getSize($type: String) {\n    getSize(type: $type) {\n      size\n    }\n  }\n"]);return _templateObject=function(){return e},e}function _templateObject1(){let e=(0,c._)(['\n    {\n        customAttributeMetadata(\n          attributes: [\n            {\n              attribute_code: "size"\n              entity_type: "catalog_product"\n            }\n          ]\n        ) {\n          items {\n            attribute_code\n            attribute_type\n            entity_type\n            input_type\n            attribute_options {\n             value\n             label\n           }\n          }\n        }\n    }\n      \n']);return _templateObject1=function(){return e},e}(0,i.Ps)(_templateObject());let u=(0,i.Ps)(_templateObject1());t.default=()=>{let[e,t]=(0,a.useState)(!1),l=(0,a.useContext)(d.Z),c=l.isChecked;l.filterChecked;var i,{loading:p,data:m}=(0,s.aM)(u,{variables:{type:l.state}});return(0,n.jsxs)("div",{className:"collection-collapse-block border-0 open",children:[(0,n.jsx)("h3",{className:"collapse-block-title",onClick:()=>t(!e),children:"size"}),(0,n.jsx)(r.Z,{isOpen:e,children:(0,n.jsx)("div",{className:"collection-collapse-block-content",children:(0,n.jsx)("div",{className:"collection-brand-filter",children:!m||!m.customAttributeMetadata||m.customAttributeMetadata.items[0].attribute_options.length<0||p?"loading":m&&(null===(i=m.customAttributeMetadata)||void 0===i?void 0:i.items[0].attribute_options.map((e,t)=>(0,n.jsxs)("div",{className:"form-check custom-checkbox collection-filter-checkbox",children:[(0,n.jsx)(o.Z,{checked:l.selectedSize.includes(e.value),onChange:()=>{l.handleSizes(e.value,c)},type:"checkbox",className:"custom-control-input",id:e.value}),(0,n.jsx)("label",{className:"custom-control-label",htmlFor:e.value,children:e.label})]},t)))})})})]})}}}]);