1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1787],{71787:function(e,t,s){s.d(t,{m:function(){return x}});var a=s(57437),l=s(2265),n=s(34924),i=s(76858),c=s(83774),r=s(10407);function o(e){return e?e.startsWith("http")?e:"".concat("https://api.doorstephub.com","/").concat(e):""}function d(e){let{mutedCardClass:t}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex gap-3 overflow-x-auto pb-2 lg:!hidden",children:Array.from({length:6}).map((e,s)=>(0,a.jsx)("div",{className:"h-12 min-w-[120px] rounded-full animate-pulse ".concat(t)},"mobile-tab-skeleton-".concat(s)))}),(0,a.jsx)("div",{className:"hidden space-y-4 lg:block",children:Array.from({length:6}).map((e,s)=>(0,a.jsx)("div",{className:"h-[108px] rounded-[30px] animate-pulse ".concat(t)},"list-skeleton-".concat(s)))})]})}function m(e){let{cardHeightClass:t}=e;return(0,a.jsx)("div",{className:"shared-cat-grid shared-cat-grid--all",children:Array.from({length:12}).map((e,s)=>(0,a.jsx)("div",{className:"".concat(t," rounded-[18px] bg-white/40 animate-pulse")},"grid-skeleton-".concat(s)))})}function x(e){let{categories:t=[],categoriesLoading:s=!1,fetchSubcategoriesForCategory:x,onSubcategoryClick:u,onOpenCategory:g,onViewAll:h,isLocationReady:p=!0,onSelectLocation:f,theme:y}=e,[v,b]=(0,l.useState)({}),[w,C]=(0,l.useState)(""),[j,N]=(0,l.useState)(!0),[k,_]=(0,l.useState)([]),[S,T]=(0,l.useState)(!1),[A,E]=(0,l.useState)(!1),Z=(0,l.useRef)(null),[L,z]=(0,l.useState)(0),[F,H]=(0,l.useState)(!1);(0,l.useEffect)(()=>{let e=()=>{H(window.innerWidth>=1024)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,l.useEffect)(()=>{if(!F){z(0);return}let e=Z.current;if(!e){console.log("CategorySubcategorySection: container not found");return}if(j){z(0);return}let t=e.querySelector('[data-slug="'.concat(w,'"]'));t?z(t.offsetTop||0):(console.log("CategorySubcategorySection: activeButton not found"),z(0))},[w,j,t,F,s]),(0,l.useEffect)(()=>{t.length&&(C(e=>{var s,a;return e||(null===(s=t[0])||void 0===s?void 0:s.slug)||(null===(a=t[0])||void 0===a?void 0:a._id)||""}),N(!0),E(!1))},[t]),(0,l.useEffect)(()=>{let e=!0;return(async()=>{if(!t.length||!x)return;let s=t.filter(e=>void 0===v[e.slug||e._id]);if(!s.length)return;let a=await Promise.allSettled(s.map(e=>x(e).then(t=>({key:e.slug||e._id,count:Array.isArray(t)?t.length:0}))));e&&b(e=>{let t={...e};return a.forEach((e,a)=>{var l,n;
1let i=(null===(l=s[a])||void 0===l?void 0:l.slug)||(null===(n=s[a])||void 0===n?void 0:n._id);i&&(t[i]="fulfilled"===e.status?e.value.count:0)}),t})})(),()=>{e=!1}},[t,v,x]),(0,l.useEffect)(()=>{let e=!0,s=(e,t)=>({...e,_id:e._id||e.id,slug:e.slug||e._id||e.id,name:e.name||e.subcategoryName||e.title||"Service",image:o(e.image||e.category_image||e.categoryIcon),description:e.description||e.title||e.subcategoryDescription||"Professional service by verified and experienced experts",categorySlug:t.slug||t._id}),a=async()=>{if(!t.length||!x){e&&_([]);return}T(!0);try{let a=await Promise.allSettled(t.map(e=>x(e).then(t=>({key:e.slug||e._id,category:e,items:Array.isArray(t)?t:[]}))));if(!e)return;let l=[],n={};a.forEach(e=>{if("fulfilled"!==e.status)return;let{key:t,category:a,items:i}=e.value;n[t]=i.length,i.forEach(e=>l.push(s(e,a)))}),b(e=>({...e,...n})),_(l)}catch(t){console.error("Failed to fetch subcategories:",t),e&&_([])}finally{e&&T(!1)}},l=async()=>{if(!w||!x){e&&_([]);return}let a=t.find(e=>(e.slug||e._id)===w);if(a){T(!0);try{let t=await x(a);if(!e)return;let l=(Array.isArray(t)?t:[]).map(e=>s(e,a));_(l),b(e=>({...e,[w]:l.length}))}catch(t){console.error("Failed to fetch subcategories:",t),e&&_([])}finally{e&&T(!1)}}};return j?a():l(),()=>{e=!1}},[w,t,x,j]);let B=(0,l.useMemo)(()=>t.find(e=>(e.slug||e._id)===w)||null,[t,w]),I=A?k:k.slice(0,15),M=j?[...I].sort((e,t)=>(e.name||"").localeCompare(t.name||"",void 0,{sensitivity:"base"})):I,P=e=>{C(e.slug||e._id),N(!1),E(!1)};return(0,a.jsx)("section",{className:"relative overflow-x-hidden py-12 sm:py-16 lg:py-20 ".concat(y.sectionClass),children:(0,a.jsxs)("div",{className:"relative mx-auto max-w-[1400px] px-4 sm:px-6 lg:px-8",children:[(0,a.jsxs)("div",{className:"mx-auto mb-10 max-w-7xl text-center sm:mb-14",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-center gap-4 ".concat(y.eyebrowClass),children:[(0,a.jsx)("span",{className:"h-px w-10 bg-current/40"}),(0,a.jsx)("span",{className:"text-sm font-semibold tracking-[0.2em] uppercase",children:y.eyebrow}),(0,a.jsx)("span",{className:"h-px w-10 bg-current/40"})]}),(0,a.jsx)("h2",{className:"text-4xl font-bold tracking-tight sm:text-5xl ".concat(y.titleClass),children:y.title}),(0,a.jsx)("p",{className:"mx-auto mt-4 max-w-2xl text-base leading-8 sm:text-lg ".concat(y.descriptionClass),children:y.description}),h?(0,a.jsxs)("button",{type:"button",onClick:h,className:"mt-5 inline-flex items-center gap-2 text-lg font-semibold transition-colors ".concat(y.viewAllClass),children:[y.viewAllLabel||"View all",(0,a.jsx)(i.Z,{className:"h-5 w-5"})]}):null]}),p?(0,a.jsxs)("div",{className:"grid gap-8 lg:grid-cols-[300px_minmax(0,1fr)] lg:items-start overflow-x-hidden",children:[(0,a.jsx)("div",{className:"".concat(j?"lg:relative":"lg:sticky lg:top-24"," min-w-0"),children:s?(0,a.jsx)(d,{mutedCardClass:y.mutedCardClass}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex gap-2 overflow-x-auto pb-2 lg:hidden w-full scrollbar-hide",children:[(0,a.jsx)(n.E.button,{type:"button",whileTap:{scale:.98},onClick:()=>{N(!0),E(!1)},className:"flex h-12 shrink-0 items-center rounded-full border px-4 text-sm font-semibold transition ".concat(j?y.activeCategoryCardClass:y.categoryCardClass),children:"All Services"}),t.map(e=>{let t=e.slug||e._id,s=!j&&t===w;return(0,a.jsx)(n.E.button,{type:"button",whileTap:{scale:.98},onClick:()=>P(e),className:"flex h-12 shrink-0 items-center rounded-full border px-4 text-sm font-semibold transition ".concat(s?y.activeCategoryCardClass:y.categoryCardClass," ").concat(s?y.activeCategoryTextClass:y.categoryTextClass),children:e.name},"mobile-tab-".concat(t))})]}),(0,a.jsxs)("div",{ref:Z,className:"hidden lg:block lg:space-y-4 relative",children:[(0,a.jsxs)(n.E.button,{type:"button",whileHover:{x:4},whileTap:{scale:.98},onClick:()=>{N(!0),E(!1)},className:"group h-[108px] min-w-[260px] rounded-[30px] border px-5 py-4 text-left transition-all lg:flex lg:w-full lg:min-w-0 lg:items-center lg:justify-between ".concat(j?y.activeCategoryCardClass:y.categoryCardClass),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"flex h-[58px] w-[58px] shrink-0 items-center justify-center rounded-2xl border ".concat(j?y.activeThumbClass:y.thumbClass),children:(0,a.jsx)("span",{className:"text-base font-bold ".concat(y.activeCategoryTextClass),children:"All"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold leading-tight ".concat(j?y.activeCategoryTextClass:y.
1categoryTextClass),children:"All Services"}),(0,a.jsx)("p",{className:"mt-1 text-sm ".concat(y.countTextClass),children:"Show every subcategory"})]})]}),(0,a.jsx)("div",{className:"mt-4 flex h-11 w-11 items-center justify-center rounded-full transition-all lg:mt-0 ".concat(j?y.activeArrowClass:y.arrowClass),children:(0,a.jsx)(i.Z,{className:"h-5 w-5"})})]}),t.map(e=>{var t;let s=e.slug||e._id,l=!j&&s===w,c=v[s],r=o(e.image||e.categoryIcon||e.category_image);return(0,a.jsxs)(n.E.button,{"data-slug":s,type:"button",whileHover:{x:4},whileTap:{scale:.98},onClick:()=>P(e),className:"group h-[108px] min-w-[260px] rounded-[30px] border px-5 py-4 text-left transition-all lg:flex lg:w-full lg:min-w-0 lg:items-center lg:justify-between ".concat(l?y.activeCategoryCardClass:y.categoryCardClass),children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"flex h-[58px] w-[58px] shrink-0 items-center justify-center rounded-2xl border ".concat(l?y.activeThumbClass:y.thumbClass),children:r?(0,a.jsx)("img",{loading:"lazy",decoding:"async",src:r,alt:e.name,className:"h-11 w-11 rounded-xl object-cover"}):(0,a.jsx)("span",{className:"text-lg font-bold ".concat(l?y.activeCategoryTextClass:y.categoryAccentTextClass),children:null===(t=e.name)||void 0===t?void 0:t.charAt(0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold leading-tight ".concat(l?y.activeCategoryTextClass:y.categoryTextClass),children:e.name}),(0,a.jsx)("p",{className:"mt-1 text-sm ".concat(y.countTextClass),children:"number"==typeof c?"".concat(c," Services"):"Loading services..."})]})]}),(0,a.jsx)("div",{className:"mt-4 flex h-11 w-11 items-center justify-center rounded-full transition-all lg:mt-0 ".concat(l?y.activeArrowClass:y.arrowClass),children:(0,a.jsx)(i.Z,{className:"h-5 w-5"})})]},s)})]})]})}),(0,a.jsx)("div",{className:"min-w-0",style:F?{marginTop:"".concat(L,"px"),transition:"margin-top 0.4s cubic-bezier(0.16, 1, 0.3, 1)"}:{},children:s||S?(0,a.jsx)(m,{cardHeightClass:y.gridCardHeightClass||"h-[190px]"}):k.length>0?(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:j?"shared-cat-grid shared-cat-grid--all":"shared-cat-grid shared-cat-grid--filtered",children:M.map((e,t)=>(0,a.jsxs)(n.E.button,{type:"button",initial:{opacity:0,y:20},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:.04*t},whileHover:{y:-6},onClick:()=>null==u?void 0:u(e,B),className:"group relative overflow-hidden rounded-[18px] text-left shadow-[0_12px_30px_rgba(15,23,42,0.12)]",children:[(0,a.jsx)("div",{className:"absolute inset-0 ".concat(y.gridFallbackClass)}),e.image?(0,a.jsx)("img",{loading:"lazy",decoding:"async",src:e.image,alt:e.name,className:"absolute inset-0 h-full w-full object-cover transition-transform duration-700 group-hover:scale-110"}):null,(0,a.jsx)("div",{className:"absolute inset-0 ".concat(y.gridOverlayClass)}),(0,a.jsx)("div",{className:"absolute inset-x-0 bottom-0",children:(0,a.jsx)("div",{className:"w-full bg-black/42 px-2 sm:px-4 py-2 sm:py-3 backdrop-blur-md ring-1 ring-white/12 shadow-[0_10px_25px_rgba(0,0,0,0.18)] ".concat(y.labelClass||""),children:(0,a.jsx)("h4",{className:"text-center text-[11px] sm:text-[12px] md:text-[13px] font-medium leading-snug !text-white drop-shadow-[0_2px_8px_rgba(0,0,0,0.55)] break-words",children:e.name})})})]},e._id||e.slug||t))}),k.length>15?(0,a.jsx)("div",{className:"mt-8 flex justify-center",children:(0,a.jsxs)("button",{type:"button",onClick:()=>E(e=>!e),className:"inline-flex items-center gap-2 rounded-full border px-5 py-3 text-sm font-semibold transition ".concat(y.showMoreClass),children:[A?"Show Less":"Show More (".concat(k.length,")"),(0,a.jsx)(r.Z,{className:"h-4 w-4 transition-transform ".concat(A?"-rotate-90":"rotate-90")})]})}):null]}):(0,a.jsxs)("div",{className:"rounded-[28px] px-6 py-14 text-center shadow-sm ".concat(y.emptyBoxClass),children:[(0,a.jsxs)("p",{className:"text-lg font-semibold ".concat(y.emptyTitleClass),children:["No services found for ",(null==B?void 0:B.name)||"this category"]}),(0,a.jsx)("p",{className:"mt-2 text-sm ".concat(y.emptyTextClass),children:"Try another category or view the full category page."}),B&&g?(0,a.jsxs)("button",{type:"button",onClick:()=>
1g(B),className:"mt-5 inline-flex items-center gap-2 rounded-full border px-5 py-3 text-sm font-semibold transition ".concat(y.showMoreClass),children:["Open Category",(0,a.jsx)(r.Z,{className:"h-4 w-4"})]}):null]})})]}):(0,a.jsxs)("div",{className:"rounded-[32px] px-6 py-14 text-center shadow-sm ".concat(y.locationBoxClass),children:[(0,a.jsx)(c.Z,{className:"mx-auto mb-4 h-10 w-10 ".concat(y.locationIconClass)}),(0,a.jsx)("p",{className:"text-lg font-semibold ".concat(y.locationTitleClass),children:y.locationTitle||"Set your location to explore services near you"}),f?(0,a.jsxs)("button",{type:"button",onClick:f,className:"mt-4 inline-flex items-center gap-2 rounded-full px-5 py-3 text-sm font-semibold transition ".concat(y.locationButtonClass),children:["Select Location",(0,a.jsx)(r.Z,{className:"h-4 w-4"})]}):null]})]})})}}}]);
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.