1import{c as te,r as o,u as ne,o as U,A as re,z as se,j as t,J as _,b as oe,d as ae}from"./index-dAhzxcDZ.js";import{F as ie}from"./FlyOut-C9MoVCbF.js";/* empty css */import{d as ce}from"./download-BxGhSxQa.js";import{P as le}from"./index-CJ0rO7On.js";import{P as ue}from"./pencil-DvEYZ5Vp.js";import{A as de}from"./index-BU9YdLJM.js";import"./ComponentHeading-CrCCQOm9.js";/** 2 * @license lucide-react v0.416.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const he=te("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]),ke=({contentCategory:ge,FormName:N,table_ID:E,adminMode:B,reRender:x})=>{const[n,H]=o.useState([]),[f,I]=o.useState([]),[M,pe]=o.useState(B),[T,me]=o.useState(!0),[g,L]=o.useState(!1),[s,R]=o.useState(0),[$,b]=o.useState(135),y=o.useRef(null),p=o.useRef(null),d=o.useRef(null),j=o.useRef(null),A=o.useRef(!0),W=50,X=5e3;ne();const C=U(e=>e.font.fontSize),z=U(e=>e.language.language),D=new URL(window.location.href),J=window.location.pathname.split("/").filter(Boolean),v=D.searchParams.get("center")||J[1]||"HQ",w=e=>{if(!e)return"";const a=document.createElement("div");return a.innerHTML=e,a.textContent||a.innerText||""},V=e=>{const a=w(e).replace(/<[^>]*>/g,"");return/[a-zA-Z0-9]/.test(a)},q=()=>{n[0]&&window.open(`/admin?formName=${n[0].typeFormName}¢er=${v}`,"_blank")},F=async()=>{const e={...oe,FormName:N,table_ID:E,center:v,language:z};try{const a=await ae(e);H(a.data.result[0])}catch{}};o.useEffect(()=>{F()},[N,E,z,x]),o.useEffect(()=>{const e=()=>{window.innerWidth<=500?b(60):window.innerWidth<=990?b(100):b(135)};return window.addEventListener("resize",e),e(),()=>window.removeEventListener("resize",e)},[x]),o.useEffect(()=>{!Array.isArray(n)||n.length===0||(I(Array(n.length).fill(null)),n.forEach(async(e,a)=>{if(e.contentImages?.[0])try{const c=await re({fileId:e.contentImages[0]}),i=c.data[0]?.doc,h=c.data[0]?.doc_type;if(i&&h){const m=URL.createObjectURL(new Blob([se.Buffer.from(i.data)],{type:h}));I(k=>{const r=[...k];return r[a]=m,r})}}catch{}}))},[n,x]),o.useEffect(()=>{if(!Array.isArray(n)||n.length<=1)return;const e=()=>{clearInterval(y.current),y.current=null},a=()=>{!T||g||!A.current||(e(),y.current=setInterval(()=>{R(i=>(i+1)%n.length)},X))},c=new IntersectionObserver(([i])=>{A.current=i.isIntersecting,i.isIntersecting?a():e()},{threshold:0});return j.current&&c.observe(j.current),a(),()=>{c.disconnect(),e()}},[n,T,g]);const S=e=>R(e),P=()=>S((s+1)%n.length),O=()=>S(s===0?n.length-1:s-1),G=()=>L(!0),Q=()=>L(!1),Z=e=>{p.current=e.touches[0].clientX,d.current=null},K=e=>{d.current=e.touches[0].clientX},Y=()=>{if(p.current===null||d.current===null)return;const e=p.current-d.current;Math.abs(e)>=W&&(e>0?P():O()),p.current=null,d.current=null},ee=e=>{localStorage.setItem("breadcrumbs",JSON.stringify([{title:"Home",path:"/"},{title:e,path:null}]))};if(!Array.isArray(n)||n.length===0)return null;const l=n[s];return t.jsx(le,{children:t.jsx("div",{ref:j,children:t.jsxs("div",{className:"relative z-10 hero-banner-container",onMouseEnter:G,onMouseLeave:Q,onTouchStart:Z,onTouchMove:K,onTouchEnd:Y,children:[M&&t.jsx("button",{className:"absolute right-4 top-4 z-20 bg-emerald-900 hover:bg-emerald-600 text-white p-2 rounded",onClick:q,children:t.jsx(ue,{})}),t.jsx("div",{className:"slider-image-wrapper",children:t.jsx(de,{mode:"wait",initial:!1,children:f[s]?l?.direct_URL?t.jsx(_.a,{href:l.direct_URL,target:"_blank",rel:"noopener noreferrer",initial:{opacity:0}
6,animate:{opacity:1},transition:{duration:1,ease:"easeInOut"},className:"slider-image-inner",children:t.jsx("img",{src:f[s],alt:"Banner",className:"slider-image"})},s):t.jsx(_.img,{src:f[s],alt:"Banner",initial:{opacity:0},animate:{opacity:1},transition:{duration:1,ease:"easeInOut"},className:"slider-image"},s):t.jsx("img",{src:ce,alt:"Loading...",className:"slider-image"})})}),l?.contentText&&V(l.contentText)&&t.jsx("div",{className:"slider-floating-text",children:t.jsxs("div",{className:"slider-content",children:[t.jsx("h1",{className:"slider-title",style:{fontSize:`${C}px`},children:w(l.title)}),t.jsx("p",{className:"slider-text",style:{fontSize:`${C}px`},children:w(l.contentText)?.substring(0,$)+"..."}),t.jsx("div",{className:"slider-btn",children:t.jsx(ie,{text:"View More",className:"white",link:"",adminMode:M,route:"blog",onClick:()=>ee(l.blogName),blogName:`${l.blogName}¢er=${v}`,icon:t.jsx(he,{})})})]})}),n.length>1&&t.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-between px-4 py-2.5 transition-opacity duration-300",style:{opacity:g?1:0,pointerEvents:g?"auto":"none",background:"linear-gradient(to top, rgba(0,0,0,0.60) 0%, rgba(0,0,0,0.0) 100%)"},children:[t.jsxs("span",{className:"text-xs font-semibold tracking-widest select-none flex-shrink-0",style:{color:"rgba(255,255,255,0.75)",letterSpacing:"0.12em"},children:[String(s+1).padStart(2,"0"),t.jsxs("span",{style:{color:"rgba(255,255,255,0.35)"},children:["/",String(n.length).padStart(2,"0")]})]}),t.jsx("div",{className:"flex items-center gap-1.5",children:(()=>{const e=n.length,a=5,c=({i:r})=>t.jsx("button",{onClick:()=>S(r),"aria-label":`Go to slide ${r+1}`,style:{width:r===s?"24px":"8px",height:"4px",borderRadius:"999px",background:r===s?"white":"rgba(255,255,255,0.40)",border:"none",padding:0,cursor:"pointer",transition:"all 0.3s ease",flexShrink:0},onMouseEnter:u=>{r!==s&&(u.currentTarget.style.background="rgba(255,255,255,0.70)")},onMouseLeave:u=>{r!==s&&(u.currentTarget.style.background="rgba(255,255,255,0.40)")}},r);if(e<=a)return n.map((r,u)=>t.jsx(c,{i:u},u));const i=[],h=({k:r})=>t.jsx("span",{className:"select-none",style:{color:"rgba(255,255,255,0.40)",fontSize:"10px",lineHeight:1,letterSpacing:"1px"},children:"â¢â¢â¢"},r);i.push(t.jsx(c,{i:0},0)),s>2&&i.push(t.jsx(h,{},"e1"));const m=Math.max(1,Math.min(s-1,e-4)),k=Math.min(m+2,e-2);for(let r=m;r<=k;r++)i.push(t.jsx(c,{i:r},r));return s<e-3&&i.push(t.jsx(h,{},"e2")),i.push(t.jsx(c,{i:e-1},e-1)),i})()}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-shrink-0 pr-12",children:[t.jsx("button",{onClick:O,"aria-label":"Previous slide",className:"flex items-center justify-center transition-all duration-200",style:{width:"28px",height:"28px",borderRadius:"50%",background:"rgba(255,255,255,0.15)",border:"1px solid rgba(255,255,255,0.25)"},onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.30)",onMouseLeave:e=>e.currentTarget.style.background="rgba(255,255,255,0.15)",children:t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})})}),t.jsx("button",{onClick:P,"aria-label":"Next slide",className:"flex items-center justify-center transition-all duration-200",style:{width:"28px",height:"28px",borderRadius:"50%",background:"rgba(255,255,255,0.15)",border:"1px solid rgba(255,255,255,0.25)"},onMouseEnter:e=>e.currentTarget.style.background="rgba(255,255,255,0.30)",onMouseLeave:e=>e.currentTarget.style.background="rgba(255,255,255,0.15)",children:t.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"9 18 15 12 9 6"})})})]})]})]})})})};export{ke as NIELITMainSlider};
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.