1import{r as tt,j as it}from"./index-DLLZWH4o.js";function lt(){const D=tt.useRef(null);return tt.useEffect(()=>{const w=D.current;if(!w)return;const c=w.getContext("2d");if(!c)return;const z=window.matchMedia("(prefers-reduced-motion: reduce)").matches;let L=0,i=[],S=[],C=!1,b=0,E=0,O=900;const f={tx:0,ty:0,rx:0,ry:0},g={tx:0,ty:0,rx:0,ry:0},M={x:0,y:0,active:!1,down:!1};let R=0,Y=0,_=4e3+Math.random()*3e3,$=0,F=performance.now(),N=!0;const A=8,j=12100,et=3,P=[],nt=()=>{P.length=0;const t=Math.ceil(A/2);for(let s=0;s<t;s++){const a=.25+Math.random()*.55,o=(Math.random()*2-1)*.55,r=(Math.random()*2-1)*.7;P.push({x:a,y:o,z:r}),P.length<A&&P.push({x:-a+(Math.random()-.5)*.1,y:o+(Math.random()-.5)*.15,z:-r+(Math.random()-.5)*.2})}},I=()=>{const t=Math.max(1e-6,Math.random()),s=Math.max(1e-6,Math.random());return Math.sqrt(-2*Math.log(t))*Math.cos(2*Math.PI*s)},X=()=>{const t=Math.min(window.devicePixelRatio||1,1.5);b=w.clientWidth,E=w.clientHeight,w.width=Math.max(1,Math.floor(b*t)),w.height=Math.max(1,Math.floor(E*t)),c.setTransform(t,0,0,t,0,0),C=b<768,O=Math.max(700,Math.min(b,E)*1.1);const s=z?60:C?110:180;P.length===0&&nt(),S=[],i=Array.from({length:s},(a,o)=>{const r=P[o%A],d=.22;return{bx:r.x+I()*d,by:r.y+I()*d*.85,bz:r.z+I()*d,px:Math.random()*Math.PI*2,py:Math.random()*Math.PI*2,pz:Math.random()*Math.PI*2,x:0,y:0,z:0,sx:0,sy:0,scale:1,cluster:o%A,energy:0,neighbors:[]}})},ot=t=>{const s=Math.cos(f.ry),a=Math.sin(f.ry),o=Math.cos(f.rx),r=Math.sin(f.rx);let d=t.x,m=t.y,x=t.z;const n=d*s+x*a,e=-d*a+x*s,y=m*o-e*r,u=m*r+e*o;d=n,m=y,x=u;const h=Math.min(b,E)*(C?.85:.55),v=2.2-x,p=O/(v*350);t.sx=b/2+d*h*p+f.tx,t.sy=E/2+m*h*p+f.ty,t.scale=p},st=()=>{for(let t=0;t<i.length;t++){const s=i[t],a=[];for(let o=0;o<i.length;o++){if(o===t)continue;const r=i[o],d=s.sx-r.sx,m=s.sy-r.sy,x=d*d+m*m;x<j&&a.push({j:o,d:x})}a.sort((o,r)=>o.d-r.d),s.neighbors=a.slice(0,et).map(o=>o.j)}},G=(t,s=1)=>{z||(S.push({frontier:[t],visited:new Set([t]),age:0,life:1400,intensity:s}),i[t].energy=Math.min(1,i[t].energy+s))},rt=(t,s)=>{let a=-1,o=1/0;for(let r=0;r<i.length;r++){const d=i[r].sx-t,m=i[r].sy-s,x=d*d+m*m;x<o&&(o=x,a=r)}return a},H=()=>{const t=M.x/b*2-1,s=M.y/E*2-1,a=C?1.6:1;g.tx=-t*14*a,g.ty=-s*10*a,g.ry=t*.07*a,g.rx=-s*.05*a},U=()=>{g.tx=0,g.ty=0,g.rx=0,g.ry=0},W=t=>{if(z||t.pointerType!=="mouse"&&!M.down)return;const s=w.getBoundingClientRect();M.x=t.clientX-s.left,M.y=t.clientY-s.top,M.active=!0,H()},Z=t=>{M.down=!0;const s=w.getBoundingClientRect(),a=t.clientX-s.left,o=t.clientY-s.top;M.x=a,M.y=o,t.pointerType!=="mouse"&&!z&&H();const r=rt(a,o);r>=0&&G(r,C?.7:1)},T=t=>{M.down=!1,t.pointerType!=="mouse"&&U()},Q=()=>{M.active=!1,U()},V=()=>{R=Math.min(1,R+.8)},J=()=>{N=!document.hidden,N?(F=performance.now(),L=requestAnimationFrame(k)):cancelAnimationFrame(L)},k=t=>{if(!N)return;const s=Math.min(60,t-F);F=t,$++;const a=.06;f.tx+=(g.tx-f.tx)*a,f.ty+=(g.ty-f.ty)*a,f.rx+=(g.rx-f.rx)*a,f.ry+=(g.ry-f.ry)*a,R*=Math.pow(.5,s/600);const o=t*.001,r=z?.02:.06,d=z?.005:.02;for(let n=0;n<i.length;n++){const e=i[n],y=Math.sin(o*.25+e.px)*r,u=Math.cos(o*.22+e.py)*r,h=Math.sin(o*.18+e.pz)*r*.8,l=P[e.cluster],v=(e.bx-l.x)*Math.cos(o*.08)-(e.bz-l.z)*Math.sin(o*.08),p=(e.bx-l.x)*Math.sin(o*.08)+(e.bz-l.z)*Math.cos(o*.08);e.x=l.x+v+y+(e.bx-l.x)*d,e.y=e.by+u,e.z=l.z+p+h,e.energy*=Math.pow(.5,s/350)}for(const n of i)ot(n);($%6===0||!i[0]?.neighbors.length)&&st();for(const n of S)if(n.age+=s,Math.floor(n.age/110)>0&&n.frontier.length>0){const u=[];for(const h of n.frontier)for(const l of i[h].neighbors)n.visited.has(l)||(n.visited.add(l),u.push(l),i[l].energy=Math.min(1,i[l].energy+n.intensity*.85));n.frontier=u}if(S=S.filter(n=>n.age<n.life&&(n.frontier.length>0||n.age<n.life*.5)),!z&&t-Y>_){Y=t,_=4e3+Math.random()*3500;const n=Math.floor(Math.random()*i.length);G(n,.9)}c.clearRect(0,0,b,E);const m=i.map((n,e)=>({i:e,z:n.z})).sort((n,e)=>n.z-e.z).map(n=>n.i),x=1+R*.6;c.globalCompositeOperation="lighter",c.lineWidth=.7;for(let n=0;n<m.length;n++){const e=m[n],y=i[e];for(const u of y.neighbors){if(u<e)continue;const h=i[u],l=y.sx-h.sx,v=y.sy-h.sy,p=l*l+v*v;if(p>j)continue;const q=1-p/j,B=(y.scale+h.scale)*.5,at=Math.max(y.energy,h.energy),K=Math.min(.55,(.06+.18*q)*B*1.3*x+at*.45);K<.02||(c.strokeStyle=`rgba(209, 206, 39, ${K.toFixed(3)})`,c.beginPath(),c.moveTo(y.sx,y.sy),c.lineTo(h.sx,h.sy),c.stroke())}}
1for(const n of m){const e=i[n],u=(1.6+e.scale*1.6)*(1+e.energy*1.4),h=u*5,l=Math.min(1,.35+e.scale*.9),v=e.energy,p=c.createRadialGradient(e.sx,e.sy,0,e.sx,e.sy,h),q=Math.min(.55,(.08+v*.5)*l*x);p.addColorStop(0,`rgba(232, 230, 110, ${q.toFixed(3)})`),p.addColorStop(1,"rgba(209, 206, 39, 0)"),c.fillStyle=p,c.beginPath(),c.arc(e.sx,e.sy,h,0,Math.PI*2),c.fill();const B=Math.min(1,(.55+v*.5)*l);c.fillStyle=`rgba(245, 243, 170, ${B.toFixed(3)})`,c.beginPath(),c.arc(e.sx,e.sy,u,0,Math.PI*2),c.fill()}c.globalCompositeOperation="source-over",L=requestAnimationFrame(k)};return X(),L=requestAnimationFrame(k),window.addEventListener("resize",X),window.addEventListener("pointermove",W),window.addEventListener("pointerdown",Z),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),window.addEventListener("mouseleave",Q),window.addEventListener("viar:energize",V),document.addEventListener("visibilitychange",J),()=>{cancelAnimationFrame(L),window.removeEventListener("resize",X),window.removeEventListener("pointermove",W),window.removeEventListener("pointerdown",Z),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T),window.removeEventListener("mouseleave",Q),window.removeEventListener("viar:energize",V),document.removeEventListener("visibilitychange",J)}},[]),it.jsx("canvas",{ref:D,className:"pointer-events-none absolute inset-0 h-full w-full","aria-hidden":"true"})}export{lt as NeuralNetworkCanvas};
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.