1import{r as n,j as e}from"./react-vendor-DL_jcNr5.js";import{b as E}from"./index-ClFcW42D.js";import"./react-query-D7GX_s2z.js";import"./helmet-_v06W0yj.js";import"./legacy-redirects-jyAQCFZG.js";const k="https://otplkcfqqbohwcgpvxwo.supabase.co/functions/v1/door-counter",M=()=>{const[s,r]=n.useState(null),[i,l]=n.useState(!0),[m,c]=n.useState(null),t=n.useRef(!0),o=async()=>{l(!0),c(null);try{const a=await fetch(k);if(!a.ok)throw new Error("Failed to fetch door openings");const d=await a.json();t.current&&r(d)}catch(a){t.current&&(c(a instanceof Error?a:new Error("Unknown error")),r(5e6))}finally{t.current&&l(!1)}};return n.useEffect(()=>(t.current=!0,o(),()=>{t.current=!1}),[]),{count:s,loading:i,error:m,refetch:o}},D=(s,r,i=2e3)=>{const[l,m]=n.useState(0);return n.useEffect(()=>{if(!r||s===0){m(0);return}const c=performance.now();let t;const o=a=>{const d=Math.min((a-c)/i,1),p=1-Math.pow(1-d,3);m(Math.floor(p*s)),d<1&&(t=requestAnimationFrame(o))};return t=requestAnimationFrame(o),()=>{t&&cancelAnimationFrame(t)}},[s,r,i]),l},S=(s,r="es-ES")=>new Intl.NumberFormat(r).format(s),q=({className:s="bg-background"})=>{const{t:r}=E(),{count:i,loading:l,refetch:m}=M(),c=n.useRef(null),[t,o]=n.useState(!1),[a,d]=n.useState(0),[p,g]=n.useState(0);n.useEffect(()=>{const u=new IntersectionObserver(([f])=>{f.isIntersecting&&!t&&o(!0)},{threshold:.3});return c.current&&u.observe(c.current),()=>u.disconnect()},[t]);const b=D(i??0,t&&!l,2e3),y=t&&!l&&b===(i??0)&&i!==null;n.useEffect(()=>{if(!y)return;let u,f=800,h=0;const v=()=>{const x=Math.random();x<.3?f=150+Math.random()*150:x<.7?f=600+Math.random()*400:f=2e3+Math.random()*2e3,h=Math.floor(Math.random()*16)+5},C=()=>{const x=-Math.log(Math.random())*f;return Math.max(80,Math.min(12e3,x))},w=()=>{g(x=>x+1),h--,h<=0&&v(),u=setTimeout(w,C())};return v(),u=setTimeout(w,500),()=>clearTimeout(u)},[y]);const j=S(b+p),N=async()=>{o(!1),g(0),await m(),d(u=>u+1),setTimeout(()=>o(!0),100)};return e.jsxs("section",{ref:c,className:`py-20 md:py-28 ${s} relative overflow-hidden`,children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:"radial-gradient(circle at 50% 50%, hsl(350 84% 48% / 0.08) 0%, transparent 55%)"}}),e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:[e.jsx("div",{className:"absolute w-[300px] h-[300px] rounded-full bg-gradient-to-br from-pink-200/30 to-pink-400/15 animate-pulse-ring",style:{animationDelay:"0s"}}),e.jsx("div",{className:"absolute w-[220px] h-[220px] rounded-full bg-gradient-to-br from-pink-300/35 to-raixer-light/20 animate-pulse-ring",style:{animationDelay:"0.4s"}}),e.jsx("div",{className:"absolute w-[150px] h-[150px] rounded-full bg-gradient-to-br from-raixer-light/30 to-raixer/15 animate-pulse-ring",style:{animationDelay:"0.8s"}}),e.jsx("div",{className:"absolute w-[90px] h-[90px] rounded-full bg-gradient-to-br from-raixer/20 to-raixer-dark/10 animate-pulse-ring",style:{animationDelay:"1.2s"}})]}),e.jsx("div",{className:"container mx-auto px-6 md:px-8 lg:px-12 relative z-10",children:e.jsxs("div",{className:"max-w-5xl mx-auto text-center",children:[e.jsx("div",{className:"flex justify-center mb-6",children:e.jsxs("span",{className:"inline-flex items-center gap-2 px-4 py-1.5 rounded-full text-sm font-semibold bg-[#E51346]/10 text-[#E51346]",children:[e.jsxs("span",{className:"relative flex h-2.5 w-2.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-2.5 w-2.5 bg-green-500"})]}),r("doorCounter.live")]})}),e.jsxs("button",{onClick:N,className:`text-6xl md:text-7xl lg:text-8xl font-bold text-raixer tabular-nums transition-all duration-300 cursor-pointer hover:scale-105 ${l?"opacity-50":"opacity-100"}`,title:r("doorCounter.refresh"),children:["+",j]},a),e.jsx("p",{className:"text-xl md:text-2xl text-muted-foreground mt-4",children:r("doorCounter.label")})]})})]})};export{q as default};
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.