1import{j as o}from"./vendor-ui-bootstrap-613dad89.js";import{r as s}from"./vendor-react-4c7f50f2.js";import"./vendor-ui-material-b69ee68f.js";const w=300,y=6e4,g=1e4,S="https://speed.cloudflare.com/__down?bytes=200000",_="https://speed.cloudflare.com/__down?bytes=1",v=56;function E(){const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;return e&&typeof e.downlink=="number"&&e.downlink>0?e.downlink*1e3:null}async function I(e){const t=performance.now();return await fetch(`${_}&_=${Date.now()}`,{cache:"no-store",signal:e}),performance.now()-t}async function M(e){const t=await I(e),a=performance.now(),d=await(await fetch(`${S}&_=${Date.now()}`,{cache:"no-store",signal:e})).arrayBuffer(),i=performance.now()-a,c=d.byteLength;if(c===0)return null;const r=Math.max(i-t,1)/1e3;return c*8/r/1e3}async function k(e){const t=E();if(t!==null)return{kbps:t,method:"api"};const a=await M(e);return a!==null?{kbps:a,method:"fetch+ping"}:null}const T=()=>{const[e,t]=s.useState(null),[a,f]=s.useState(!1),[d,i]=s.useState(!1),[c,m]=s.useState(!0),r=s.useRef(null);s.useEffect(()=>{const n=document.getElementById("header");if(!n)return;const l=new IntersectionObserver(([u])=>m(u.isIntersecting),{threshold:0});return l.observe(n),()=>l.disconnect()},[]);const p=s.useCallback(async()=>{r.current&&r.current.abort();const n=new AbortController;r.current=n;const l=setTimeout(()=>n.abort(),g);try{const u=await k(n.signal);if(!u)return;const{kbps:b,method:C}=u;t(Math.round(b)),b<w?(i(!1),f(!0)):f(!1)}catch{}finally{clearTimeout(l)}},[]);s.useEffect(()=>{p();const n=setInterval(p,y);return()=>{clearInterval(n),r.current&&r.current.abort()}},[p]);const h=a&&!d,x=c?`${v}px`:"0px";return o.jsx(o.Fragment,{children:h&&o.jsxs("div",{role:"alert","aria-live":"polite",style:{position:"fixed",top:x,left:0,right:0,zIndex:500,backgroundColor:"#fff3cd",borderBottom:"1px solid #ffc107",color:"#856404",fontSize:"0.8rem",lineHeight:"1.2",display:"flex",alignItems:"center",justifyContent:"center",padding:"4px 12px",transition:"top 0.2s ease"},children:[o.jsx("span",{className:"material-symbols-outlined me-2",style:{fontSize:"1.1rem"},children:"speed"}),o.jsxs("div",{children:[o.jsx("strong",{children:"Conexão lenta!"})," Sua internet está a ",e??"?"," Kbps."]}),o.jsx("button",{type:"button","aria-label":"Fechar aviso",onClick:()=>i(!0),style:{position:"absolute",right:"8px",background:"none",border:"none",cursor:"pointer",color:"#856404",lineHeight:1,padding:"0 4px"},children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"1rem"},children:"close"})})]})})};export{T as default}; 2//# sourceMappingURL=SpeedNotification-9de2ba4e.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.