1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8817],{2773:(e,t,r)=>{r.d(t,{GL:()=>u,Gp:()=>o,Nc:()=>i,_y:()=>s,mA:()=>c});var n=r(2115);let l=null,a=new Set;function i(e){if(l!==e)for(let t of(l=e,a))t(e)}function o(e){return a.add(e),()=>a.delete(e)}let s={title:"Leave this game?",body:"You're mid-game â your progress in this round will be lost."},c={title:"Leave the match?",body:"The match is still live â leaving counts as a loss and your opponent takes the win."};function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,{title:r,body:l}=t;(0,n.useEffect)(()=>e?(i({title:r,body:l}),()=>i(null)):void i(null),[e,r,l])}},2932:(e,t,r)=>{function n(e,t,r){let n=window.devicePixelRatio||1,l=Math.max(1,Math.min((e.clientWidth||t)*n/t,4)),a=Math.round(t*l),i=Math.round(r*l);(e.width!==a||e.height!==i)&&(e.width=a,e.height=i);let o=e.getContext("2d");return o&&o.setTransform(l,0,0,l,0,0),o}function l(e,t,r,n,l){let a=r.getBoundingClientRect(),i=Math.min(a.width/n,a.height/l)||1,o=a.left+(a.width-n*i)/2,s=a.top+(a.height-l*i)/2;return{x:(e-o)/i,y:(t-s)/i}}r.d(t,{c:()=>n,f:()=>l})},3557:(e,t,r)=>{r.d(t,{g:()=>l});var n=r(2115);function l(e){let[t,r]=(0,n.useState)(0);return(0,n.useEffect)(()=>{try{let t=window.localStorage.getItem("funnudge:".concat(e));t&&r(Number(t)||0)}catch(e){}},[e]),{best:t,submit:(0,n.useCallback)(t=>{r(r=>{if(t<=r)return r;try{window.localStorage.setItem("funnudge:".concat(e),String(t))}catch(e){}return t})},[e])}}},8213:(e,t,r)=>{r.d(t,{P:()=>n,Q:()=>l});let n="funnudge:celebrate";function l(){try{window.dispatchEvent(new CustomEvent(n))}catch(e){}}},8817:(e,t,r)=>{r.r(t),r.d(t,{default:()=>d});
1var n=r(5155),l=r(2115),a=r(2932),i=r(8213),o=r(1175),s=r(4107),c=r(3557),u=r(2773);let h=["#ef4444","#3b82f6","#22c55e","#eab308","#a855f7","#06b6d4","#f97316","#ec4899"];function d(){let e=(0,l.useRef)(null),[t,r]=(0,l.useState)("idle");(0,u.GL)("playing"===t);let[d,f]=(0,l.useState)(0),[p,g]=(0,l.useState)(0),[x,m]=(0,l.useState)({filled:0,total:25,pipes:0,pipesTotal:5}),{best:b,submit:w}=(0,c.g)("flow-connect"),[y,v]=(0,l.useState)([]),C=(0,l.useRef)(0),N=(0,l.useCallback)((e,t)=>{let r=++C.current;v(n=>[...n.slice(-1),{id:r,text:e,cls:t}]),setTimeout(()=>v(e=>e.filter(e=>e.id!==r)),1e3)},[]),S=(0,l.useRef)(N);S.current=N;let j=(0,l.useRef)(null),k=(0,l.useRef)(new Int8Array(0)),M=(0,l.useRef)([]),P=(0,l.useRef)(-1),R=(0,l.useRef)(!1),D=(0,l.useRef)(0),T=(0,l.useRef)(0),z=(0,l.useRef)(t),E=(0,l.useRef)(0);z.current=t;let I=(0,l.useCallback)(()=>{let e=Math.min(5+Math.floor(T.current/2),9),t=Math.min(h.length,3+T.current,Math.floor(e*e/2)),r=function(e,t){var r;let n=e*e,l=null!=(r=(()=>{let t=Math.random()*n|0,r=[t],l=new Uint8Array(n);l[t]=1;let a=Date.now(),i=()=>{if(r.length===n)return!0;if(Date.now()-a>150)return!1;for(let t of(e=>{for(let t=e.length-1;t>0;t--){let r=Math.random()*(t+1)|0;[e[t],e[r]]=[e[r],e[t]]}return e})((t=>{let r=t/e|0,n=t%e,l=[];return r>0&&l.push(t-e),r<e-1&&l.push(t+e),n>0&&l.push(t-1),n<e-1&&l.push(t+1),l})(r[r.length-1])))if(!l[t]){if(l[t]=1,r.push(t),i())return!0;r.pop(),l[t]=0}return!1};return i()?r:null})())?r:(()=>{let t=[];for(let r=0;r<e;r++)if(r%2==0)for(let n=0;n<e;n++)t.push(r*e+n);else for(let n=e-1;n>=0;n--)t.push(r*e+n);return t})(),a=Math.max(2,Math.min(t,h.length,Math.floor(n/2))),i=Array(a).fill(2),o=n-2*a;for(;o>0;)i[Math.random()*a|0]++,o--;let s=[],c=new Int8Array(n).fill(-1),u=0;for(let e=0;e<a;e++){let t=l.slice(u,u+i[e]);u+=i[e];let r=t[0],n=t[t.length-1];s.push([r,n]),c[r]=e,c[n]=e}return{size:e,pairs:s,epColor:c}}(e,t);j.current=r,k.current=new Int8Array(e*e).fill(-1);for(let e=0;e<r.epColor.length;e++)r.epColor[e]>=0&&(k.current[e]=r.epColor[e]);M.current=r.pairs.map(()=>[]),P.current=-1,R.current=!1},[]),_=(0,l.useCallback)(()=>{T.current=0,D.current=0,f(0),g(0),I(),r("playing")},[I]),A=()=>{let e=j.current;if(!e)return;let t=0;for(let e=0;e<k.current.length;e++)k.current[e]>=0&&t++;let r=0;for(let t=0;t<e.pairs.length;t++){let n=M.current[t];if(n.length<2)continue;let l=new Set([n[0],n[n.length-1]]);l.has(e.pairs[t][0])&&l.has(e.pairs[t][1])&&r++}m({filled:t,total:k.current.length,pipes:r,pipesTotal:e.pairs.length})},F=()=>{let e=j.current;if(e&&!R.current){for(let e=0;e<k.current.length;e++)if(k.current[e]<0)return;for(let t=0;t<e.pairs.length;t++){let r=M.current[t];if(r.length<2)return;let n=new Set([r[0],r[r.length-1]]);if(!n.has(e.pairs[t][0])||!n.has(e.pairs[t][1]))return}R.current=!0,D.current+=1,g(D.current),w(D.current),(0,s.q7)("flow-connect",D.current),(0,o._O)("win"),r("won"),(0,i.Q)(),setTimeout(()=>{"won"===z.current&&(T.current+=1,f(T.current),I(),r("playing"))},900)}},B=t=>{let r=e.current.getBoundingClientRect(),n=j.current.size,l=Math.floor((t.clientX-r.left)/r.width*n),a=Math.floor((t.clientY-r.top)/r.height*n);return l<0||l>=n||a<0||a>=n?-1:a*n+l};(0,l.useEffect)(()=>{"playing"===t&&A()},[t,d]);let L=(0,l.useCallback)(()=>{let t=e.current;if(!t||!j.current)return;let r=(0,a.c)(t,520,520);if(!r)return;let n=j.current,l=n.size,i=520/l,o=r.createLinearGradient(0,0,520,520);o.addColorStop(0,"#0a0f28"),o.addColorStop(.5,"#0d1233"),o.addColorStop(1,"#121038"),r.fillStyle=o,r.fillRect(0,0,520,520),r.strokeStyle="rgba(120,160,255,0.12)",r.lineWidth=1.5;for(let e=0;e<=l;e++)r.beginPath(),r.moveTo(e*i,0),r.lineTo(e*i,520),r.stroke(),r.beginPath(),r.moveTo(0,e*i),r.lineTo(520,e*i),r.stroke();let s=e=>({x:e%l*i+i/2,y:(e/l|0)*i+i/2}),c=(e,t,n)=>{r.beginPath(),e.forEach((e,l)=>{let{x:a,y:i}=s(e);0===l?r.moveTo(a+t,i+n):r.lineTo(a+t,i+n)}),r.stroke()},u=n.pairs.map((e,t)=>{let r=M.current[t];if(r.length<2)return!1;let n=new Set([r[0],r[r.length-1]]);return n.has(e[0])&&n.has(e[1])}),d=performance.now()/1e3;r.lineCap="round",r.lineJoin="round",M.current.forEach((e,t)=>{if(e.length<2)return;let n=h[t%h.length];(P.current===t||u[t])&&(r.shadowColor=n,r.shadowBlur=P.current===t?16:8),r.strokeStyle=n,r.lineWidth=.4*i,c(e,0,0),r.shadowBlur=0,r.strokeStyle="rgba(255,255,255,0.4)",r.lineWidth=.1*i,c(e,-(.04*i),-(.05*i))});for(let e=0;e<n.epColor.length;e++){let t=n.epColor[e];if(t<0)continue;let{x:l,y:a}=s(e),o=h[t%h.length],c=i*(.34+(u[t]?0:.04*Math.sin(3*d+1.3*t)+.02));u[t]&&(r.strokeStyle="rgba(255,255,255,0.55)",r.lineWidth=2,r.beginPath(),r.arc(l,a,c+4,0,2*Math.PI),r.stroke()),r.fillStyle=o,r.beginPath(),r.arc(l,a,c,0,2*Math.PI),r.fill();let f=r.createRadialGradient(l-.35*c,a-.35*c,.1*c,l,a,c);f.addColorStop(0,"rgba(255,255,255,0.18)"),f.addColorStop(.55,"rgba(255,255,255,0)"),f.addColorStop(1,"rgba(0,0,0,0.16)"),r.f
1illStyle=f,r.beginPath(),r.arc(l,a,c,0,2*Math.PI),r.fill(),r.fillStyle="rgba(255,255,255,0.3)",r.beginPath(),r.arc(l-.28*c,a-.3*c,.16*c,0,2*Math.PI),r.fill()}},[]);return(0,l.useEffect)(()=>{let e=()=>{L(),E.current=requestAnimationFrame(e)};return E.current=requestAnimationFrame(e),()=>cancelAnimationFrame(E.current)},[L]),(0,n.jsxs)("div",{className:"select-none",children:[(0,n.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[(0,n.jsxs)("div",{className:"flex gap-2",children:[(0,n.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Level"}),(0,n.jsx)("div",{className:"text-xl font-bold text-white",children:d+1})]}),(0,n.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Solved"}),(0,n.jsx)("div",{className:"text-xl font-bold text-cyan-300",children:p})]}),(0,n.jsxs)("div",{className:"rounded-xl bg-white/10 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-zinc-400",children:"Best"}),(0,n.jsx)("div",{className:"text-xl font-bold text-amber-300",children:b})]})]}),(0,n.jsx)("button",{onClick:_,className:"rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-4 py-2 font-bold text-white transition hover:scale-105",children:"playing"===t?"Restart":"Start"})]}),(0,n.jsxs)("div",{"data-board":!0,className:"relative mx-auto grid w-full max-w-md place-items-center rounded-2xl border border-white/10 bg-[#0b1020] touch-none",children:[(0,n.jsx)("canvas",{ref:e,width:520,height:520,onPointerDown:e=>{if("playing"!==z.current)return;let t=B(e);if(t<0)return;try{e.currentTarget.setPointerCapture(e.pointerId)}catch(e){}let r=j.current,n=r.epColor[t],l=n>=0?n:k.current[t];if(!(l<0))if(P.current=l,n>=0){for(let e of M.current[l])r.epColor[e]!==l&&(k.current[e]=-1);M.current[l]=[t]}else{let e=M.current[l],n=e.indexOf(t);if(n>=0){for(let t=n+1;t<e.length;t++)r.epColor[e[t]]!==l&&(k.current[e[t]]=-1);e.length=n+1}}},onPointerMove:e=>{let t=P.current;if(t<0)return;let r=B(e);if(r<0)return;let n=j.current,l=M.current[t];if(0===l.length)return;let a=l[l.length-1];if(r===a)return;if(l.length>=2&&r===l[l.length-2]){let e=l.pop();n.epColor[e]!==t&&(k.current[e]=-1);return}if(!((e,t)=>{let r=j.current.size;return Math.abs((e/r|0)-(t/r|0))+Math.abs(e%r-t%r)===1})(r,a))return;let i=n.epColor[r];if(i>=0&&i!==t)return;if(i===t&&r!==l[0]){l.push(r),(0,o._O)("merge");let e=0;for(let t=0;t<n.pairs.length;t++){let r=M.current[t];if(r.length<2)continue;let l=new Set([r[0],r[r.length-1]]);l.has(n.pairs[t][0])&&l.has(n.pairs[t][1])&&e++}e<n.pairs.length&&S.current("\uD83D\uDD17 ".concat(e,"/").concat(n.pairs.length," pipes"),"text-cyan-300"),F();return}let s=l.indexOf(r);if(s>=0){for(let e=s+1;e<l.length;e++)n.epColor[l[e]]!==t&&(k.current[l[e]]=-1);l.length=s+1;return}let c=k.current[r];c>=0&&c!==t&&((e,t)=>{let r=M.current[e],n=r.indexOf(t);if(!(n<0)){for(let t=n;t<r.length;t++)j.current.epColor[r[t]]!==e&&(k.current[r[t]]=-1);r.length=n}})(c,r),k.current[r]=t,l.push(r)},onPointerUp:()=>{P.current=-1,F(),A()},className:"block touch-none rounded-xl",style:{width:"min(100%, 82vh)",height:"auto"},role:"application","aria-label":"Flow Connect. Drag from a colored dot to its matching dot. Fill every square without crossing paths."}),(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-[8%] z-10 flex flex-col items-center gap-1",children:y.map(e=>(0,n.jsx)("div",{className:"animate-bounce-in text-xl font-extrabold drop-shadow-[0_2px_6px_rgba(0,0,0,0.8)] ".concat(e.cls),children:e.text},e.id))}),"playing"!==t&&(0,n.jsxs)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/60 backdrop-blur-[2px]",children:["won"===t?(0,n.jsx)("p",{className:"animate-bounce-in text-3xl font-extrabold text-white",children:"â
Connected!"}
1):(0,n.jsx)("p",{className:"text-5xl","aria-hidden":!0,children:"\uD83D\uDD0C"}),(0,n.jsxs)("button",{onClick:_,className:"rounded-xl bg-gradient-to-r from-cyan-500 to-blue-600 px-6 py-3 font-bold text-white transition hover:scale-105",children:["â¶ ","won"===t?"Next":"Start connecting"]})]})]}),"playing"===t&&(0,n.jsxs)("p",{className:"mt-3 text-center text-sm font-semibold text-zinc-300",children:["Filled"," ",(0,n.jsxs)("span",{className:x.filled===x.total?"text-emerald-400":"text-white",children:[x.filled,"/",x.total]})," ","\xb7 Pipes"," ",(0,n.jsxs)("span",{className:x.pipes===x.pipesTotal?"text-emerald-400":"text-white",children:[x.pipes,"/",x.pipesTotal]})]}),(0,n.jsxs)("p",{className:"mt-2 text-center text-sm text-zinc-500",children:["\uD83D\uDDB1ï¸ Drag from a dot to its matching dot \xb7 Paths can't cross \xb7 Fill",(0,n.jsx)("span",{className:"font-semibold text-zinc-300",children:" every square"})," to solve the board"]})]})}}}]);
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.