1/*! For license information please see 5616.b11beed9.chunk.js.LICENSE.txt */ 2"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[5616],{5469(e,t,a){a.d(t,{A:()=>l});const l=(0,a(7784).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},5616(e,t,a){a.r(t),a.d(t,{default:()=>x});var l=a(9379),r=a(5043),s=a(5469),i=a(5692),n=a(7784);const o=(0,n.A)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),c=(0,n.A)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);var d=a(7874),u=a(9722),h=a(2532),m=a(579);const g=e=>{var t;if(!e)return"";if(e.startsWith("http"))return e;const a=null===(t="https://www.bagchee.com/api")?void 0:t.replace("/api","");return"".concat(a,"/").concat(e.replace(/^\//,""))},p=()=>{const[e,t]=(0,r.useState)(0),[a,n]=(0,r.useState)(!1),{data:p=[],isLoading:x}=(0,h.I)({queryKey:["hero-banners"],queryFn:async()=>{const e=await u.A.get("".concat("https://www.bagchee.com/api","/home-slider/list"));if(e.data.status){const t=e.data.data.filter(e=>e.isActive&&(e.desktopImage||e.mobileImage)).sort((e,t)=>(e.order||0)-(t.order||0));return t.forEach(e=>{(new Image).src=g(e.desktopImage);(new Image).src=g(e.mobileImage)}),t}return[]},staleTime:6e5});(0,r.useEffect)(()=>{if(p.length<=1||a)return;const e=setInterval(()=>{t(e=>e===p.length-1?0:e+1)},5e3);return()=>clearInterval(e)},[p.length,a]);const b=(0,r.useCallback)(e=>{null===e||void 0===e||e.preventDefault(),t(e=>0===e?p.length-1:e-1)},[p.length]),f=(0,r.useCallback)(e=>{null===e||void 0===e||e.preventDefault(),t(e=>e===p.length-1?0:e+1)},[p.length]),w=(0,r.useMemo)(()=>p.map((t,a)=>{const r=a===e;return(0,m.jsx)("div",{className:"absolute inset-0 w-full h-full transition-opacity duration-1000 ease-in-out ".concat(r?"opacity-100 z-10":"opacity-0 z-0"),children:(0,m.jsx)(d.N_,{to:t.link||"/shop",className:"block w-full h-full ".concat(r?"pointer-events-auto":"pointer-events-none"),children:(0,m.jsxs)("picture",{className:"w-full h-full block",children:[t.desktopImage&&(0,m.jsx)("source",{media:"(min-width: 768px)",srcSet:g(t.desktopImage)}),(0,m.jsx)("img",(0,l.A)((0,l.A)({src:g(t.mobileImage||t.desktopImage),loading:0===a?"eager":"lazy"},0===a?{fetchpriority:"high"}:{}),{},{alt:t.title||"Banner ".concat(a),className:"w-full h-full object-cover object-center",draggable:"false"}))]})})},t._id||a)}),[p,e]);return x?(0,m.jsx)("div",{className:"w-full aspect-[4/3] md:aspect-auto md:h-[350px] lg:h-[400px] bg-cream-100 animate-pulse flex items-center justify-center",children:(0,m.jsx)("span",{className:"text-text-muted font-montserrat font-bold uppercase tracking-widest text-xs",children:"Loading Banners..."})}):0===p.length?null:(0,m.jsxs)("div",{className:"w-full relative group overflow-hidden",children:[(0,m.jsx)("div",{className:"w-full relative bg-cream-100 transition-all duration-500 aspect-[4/3] md:aspect-auto md:h-[350px] lg:h-[400px] overflow-hidden",children:w}),p.length>1&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{onClick:b,className:" group-hover:flex absolute top-1/2 -translate-y-1/2 left-4 z-20 w-10 h-10 bg-black/20 hover:bg-primary text-text-light rounded-full items-center justify-center backdrop-blur-sm transition-all shadow-lg border border-text-light/30 active:scale-90","aria-label":"Previous slide",children:(0,m.jsx)(s.A,{size:20})}),(0,m.jsx)("button",{onClick:f,className:" group-hover:flex absolute top-1/2 -translate-y-1/2 right-4 z-20 w-10 h-10 bg-black/20 hover:bg-primary text-text-light rounded-full items-center justify-center backdrop-blur-sm transition-all shadow-lg border border-text-light/30 active:scale-90","aria-label":"Next slide",children:(0,m.jsx)(i.A,{size:20})}),(0,m.jsxs)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex items-center gap-4 z-20",children:[(0,m.jsx)("div",{className:"flex gap-2",children:p.map((a,l)=>(0,m.jsx)("button",{onClick:()=>t(l),className:"h-1.5 rounded-full transition-all duration-300 shadow-md ".concat(e===l?"bg-primary w-8":"bg-text-light/60 w-2 hover:bg-text-light"),"aria-label":"Go to slide ".concat(l+1)},l))}),(0,m.jsx)("button",{onClick:()=>n(!a),className:"w-7 h-7 flex items-center justify-center bg-text-light/20 backdrop-blur-sm text-text-light rounded-full border border-text-light/40 hover:bg-primary transition-colors shadow-md active:scale-90",title:a?"Play Slider":"Pause Slider",children:a?(0,m.jsx)(o,{size:12,fill:"currentColor"}):(0,m.jsx)(c,{size:12,fill:"currentColor"})})]})]})]})},x=(0,r.memo)(p)}}]); 3//# sourceMappingURL=5616.b11beed9.chunk.js.map
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.