1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5627],{45627:(e,t,a)=>{a.r(t),a.d(t,{default:()=>v});var r=a(95155),s=a(35536),l=a(31919),n=a(98500),c=a.n(n),i=a(12115),x=a(49810),m=a(16494),d=a(6710),p=a(4548),h=a(98228),u=a(37668),o=a(36941),g=a(73321),j=a(25959),y=a(99145),f=a(11475);let b=({categories:e,activeCategory:t,facets:a={}})=>{let n,o,b=(0,g.useSearchParams)(),v=(0,j.useRouter)(),N=(0,g.usePathname)(),P=(0,g.useParams)().slug,[A,S]=(0,i.useState)(b.get("minPrice")||""),[w,k]=(0,i.useState)(b.get("maxPrice")||""),[$,C]=(0,i.useState)(!1),[q,_]=(0,i.useState)(!1),F=e=>t&&t.length>0&&t?.some(t=>t.slug===e)||!1,E=e=>{if(!$&&(e.preventDefault(),"Enter"===e.key)){let e=new URLSearchParams(b.toString());A?e.set("minPrice",A):e.delete("minPrice"),w?e.set("maxPrice",w):e.delete("maxPrice"),v.replace(`?${e.toString()}`,{scroll:!1})}},R=e=>{let t=new URLSearchParams((0,g.useSearchParams)().toString());return t.delete("slug"),e.map(e=>e.children&&e.children.length>0?(0,r.jsx)(h.A,{header:(0,r.jsx)("div",{onClick:e=>{e.stopPropagation(),e.preventDefault()},children:(0,r.jsx)(c(),{href:{pathname:e.slug,query:(0,s.t0)(t)},children:(0,r.jsx)(x.A,{readOnly:!0,name:e.name,value:e.slug,id:`cat-category-${e.slug}-${e.name}`,color:"secondary",checked:e.slug===P,label:(0,r.jsx)(d.rw,{className:"cursor-pointer filter-hover text-[14px] text-gray-900 hover:text-primary",children:e.name})})})}),isExpanded:F(e.slug),totalItems:e.children?.length??0,children:R(e.children)},`cat-accordion-${e.id}`):(0,r.jsx)(c(),{href:{pathname:`${e.slug}`,query:(0,s.t0)(t)},children:(0,r.jsx)(x.A,{readOnly:!0,inputMy:"6px",name:e.name,value:e.slug,id:`cat-filter-${e.slug}-${e.name}`,color:"secondary",checked:e.slug===P,label:(0,r.jsx)(d.rw,{className:"cursor-pointer filter-hover text-[14px] hover:text-primary",children:e.name})})},e.id))};return(0,r.jsx)("div",{children:(0,r.jsxs)(y.h,{className:"py-[10px] px-[27px]",elevation:5,children:[(n=(0,g.useSearchParams)(),o=(0,i.useMemo)(()=>{let e=[];return n.forEach((t,a)=>{("q"!==a||"/search"!==N)&&e.push({key:a,value:[t]})}),e},[n]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(m.A,{justify:"between",children:[(0,r.jsx)("p",{className:"text-[18px] font-semibold mb-[10px]",children:"Filters"}),o.length>0&&(0,r.jsx)(c(),{href:{pathname:N,query:n.get("q")?{q:n.get("q")}:null},children:(0,r.jsx)("p",{className:"pt-[5px] text-[#020AA6] text-[13px] font-normal",children:"reset"})})]}),0===o.length&&(0,r.jsx)("p",{className:"text-[13px] text-text-muted font-normal mt-0 mb-[12px] pt-[1px]",children:"No filter applied"}),o.map(e=>(0,r.jsx)(i.Fragment,{children:e.value.map(t=>(0,r.jsx)(x.A,{checked:!0,name:t,value:t,id:`cat-filter-ch-${e.key}-${t}`,color:"secondary",onChange:t=>{(0,l.IF)(e.key,n.toString(),e=>{v.replace(e,{scroll:!1})})},label:(0,r.jsx)(d.rw,{className:"text-gray-900 text-[14px] capitalize",children:t}),my:"10px"},`${e.key}-${t}`))},`filter-${e.key}`)),(0,r.jsx)("div",{className:"divider my-[10px] h-[1px] bg-gray-200"})]})),(0,r.jsxs)(p.n,{expanded:F(P)&&q,toggleCallback:()=>_(!q),children:[(0,r.jsx)(p.u,{className:"py-0 px-0 mb-[10px]",children:(0,r.jsx)(m.A,{justify:"between",children:(0,r.jsx)("p",{className:"text-[16px] font-semibold pt-[10px]",children:"Categories"})})}),R(e)]}),(0,r.jsx)("div",{className:"divider my-[10px] h-[1px] bg-gray-200"}),a&&"object"==typeof a&&Object?.entries(a||{})?.sort(([e],[t])=>{let a=b.has(e.replace(/^cs_/,""));return a===b.has(t.replace(/^cs_/,""))?0:a?-1:1})?.map(([e,t])=>t&&"object"==typeof t?(0,r.jsxs)(i.Fragment,{children:[(0,r.jsx)(f.S,{name:e,details:t}),(0,r.jsx)("div",{className:"divider my-[10px] h-[1px] bg-gray-200"})]},`dynamic-${e}-${b.has(e.replace(/^cs_/,""))}`):null),(0,r.jsxs)(p.n,{children:[(0,r.jsx)(p.u,{className:"py-0 px-0 mb-[10px]",children:(0,r.jsx)(m.A,{justify:"between",children:(0,r.jsx)("p",{className:"text-[16px] font-semibold pt-[10px]",children:"Price Range"})})}),(0,r.jsxs)(m.A,{justify:"between",items:"center",className:"mx-1",children:[(0,r.jsx)(u.A,{placeholder:"0",name:"minPrice",type:"number",fullwidth:!0,onKeyUp:E,value:A,onChange:e=>{C(!1),w&&Number(e.target.value)>=Number(w)&&C(!0),S(e.target.value)}}),(0,r.jsx)(d.Ay,{className:"text-[16px] font-semibold text-text-muted px-[0.5rem] mb-0 mt-0",children:"-"}),(0,r.jsx)(u.A,{placeholder:"1000",name:"maxPrice",type:"number",fullwidth:!0,onKeyUp:E,value:w,onChange:e=>{C(!1),A&&Number(e.target.value)<=Number(A)&&C(!0),k(e.target.value)}})]}),$&&(0,r.jsx)(d.rw,{className:"text-[14px] text-red-500",children:"Min Price cannot be greater than Max Price"}),(0,r.jsx)(m.A,{justify:"end",children:(0,r.jsx)(c(),{href:{pathname:N,query:(0,s.t0)((e=>{let t=new URLSearchParams(b.toString());for(let a of e)t.delete(a);return t})(["maxPrice","minPrice"]))},children:(0,r.jsx)("p",{className:"pt-[5px] text-[#020AA6] text-[13px] font-normal",children:"reset"})})})]})]})})};
1b.displayName="CatSearchPageProductFilter";let v=(0,i.memo)(b,function(e,t){return(0,o.A)(e.categories,t.categories)&&(0,o.A)(e.activeCategory,t.activeCategory)&&(0,o.A)(e.facets,t.facets)})}}]);
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.