(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2826],{923:(e,s,r)=>{Promise.resolve().then(r.t.bind(r,6874,23)),Promise.resolve().then(r.bind(r,6821)),Promise.resolve().then(r.bind(r,8150))},8150:(e,s,r)=>{"use strict";r.d(s,{default:()=>l});var i=r(5155),t=r(2115),a=r(6874),n=r.n(a),c=r(1990);function l(e){let{locale:s}=e,[r,a]=(0,t.useState)([]),[l,o]=(0,t.useState)(!0),[d,h]=(0,t.useState)(null);return((0,t.useEffect)(()=>{(async()=>{let e=new URLSearchParams({}),s=(0,c.uX)();if(!(null==s?void 0:s.id))return h("Country is missing");e.set("countryId",null==s?void 0:s.id);try{o(!0);let s=await fetch("/api/categories/featured?".concat(e.toString()));if(!s.ok)throw Error("Failed to fetch categories");let r=await s.json();if(r.success)a(r.data);else throw Error(r.error||"Failed to fetch categories")}catch(e){console.error("Error fetching categories:",e),h(e instanceof Error?e.message:"An error occurred")}finally{o(!1)}})()},[]),l)?(0,i.jsx)("section",{className:"categories-wrapper pt-120",children:(0,i.jsx)("div",{className:"container",children:(0,i.jsx)("div",{className:"row",children:(0,i.jsxs)("div",{className:"col-12",children:[(0,i.jsxs)("div",{className:"heading-box",children:[(0,i.jsx)("h2",{className:"mb-0",children:"Featured Categories"}),(0,i.jsx)("div",{className:"h-link",children:(0,i.jsxs)(n(),{href:"/".concat(s,"/categories"),children:["View All",(0,i.jsxs)("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M1 8L23 8",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M16 1L23 8L16 15",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})]})})]}),(0,i.jsx)("div",{className:"category-listing",children:(0,i.jsx)("div",{className:"d-flex justify-content-center align-items-center",style:{minHeight:"200px"},children:(0,i.jsx)("div",{className:"spinner-border text-primary",role:"status",children:(0,i.jsx)("span",{className:"visually-hidden",children:"Loading..."})})})})]})})})}):d?(0,i.jsx)("section",{className:"categories-wrapper pt-120",children:(0,i.jsx)("div",{className:"container",children:(0,i.jsx)("div",{className:"row",children:(0,i.jsxs)("div",{className:"col-12",children:[(0,i.jsxs)("div",{className:"heading-box",children:[(0,i.jsx)("h2",{className:"mb-0",children:"Featured Categories"}),(0,i.jsx)("div",{className:"h-link",children:(0,i.jsxs)(n(),{href:"/".concat(s,"/categories"),children:["View All",(0,i.jsxs)("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M1 8L23 8",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M16 1L23 8L16 15",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})]})})]}),(0,i.jsx)("div",{className:"category-listing",children:(0,i.jsxs)("div",{className:"alert alert-danger text-center",role:"alert",children:[(0,i.jsx)("h5",{children:"Unable to load categories"}),(0,i.jsx)("p",{className:"mb-0",children:d})]})})]})})})}):(0,i.jsx)("section",{className:"categories-wrapper pt-120",children:(0,i.jsx)("div",{className:"container",children:(0,i.jsx)("div",{className:"row",children:(0,i.jsxs)("div",{className:"col-12",children:[(0,i.jsxs)("div",{className:"heading-box",children:[(0,i.jsx)("h2",{className:"mb-0",children:"Featured Categories"}),(0,i.jsx)("div",{className:"h-link",children:(0,i.jsxs)(n(),{href:"/".concat(s,"/categories"),children:["View All",(0,i.jsxs)("svg",{width:"24",height:"16",viewBox:"0 0 24 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M1 8L23 8",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M16 1L23 8L16 15",stroke:"#0E9493",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})]})})]}),(0,i.jsx)("div",{className:"category-listing",children:(0,i.jsx)("ul",{className:"category-list-wrap",children:r.map(e=>(0,i.jsxs)("li",{children:[(0,i.jsx)("div",{className:"cat-img",children:(0,i.jsx)("img",{src:e.image,alt:e.name,onError:e=>{e.target.src="/assets/image/category/default.svg"}})}),(0,i.jsx)(n(),{href:"/".concat(s,"/projects?categoryId=").concat(e.id),className:"stretched-link",children:e.name}),(0,i.jsxs)("div",{className:"totalpro",children:[e.projectCount," Project",1!==e.projectCount?"s":""]})]},e.id))})})]})})})})}}},e=>{e.O(0,[6874,6821,8441,5964,7358],()=>e(e.s=923)),_N_E=e.O()}]);