PageSourceSearch

https://www.funnudge.com/_next/static/chunks/4382.f093ee094ae457ac.js

js funnudge.com collected 2026-10-02 01:31:11 UTC 15,186 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4382],{2773:(e,t,r)=>{r.d(t,{GL:()=>s,Gp:()=>i,Nc:()=>c,_y:()=>u,mA:()=>o});var n=r(2115);let l=null,a=new Set;function c(e){if(l!==e)for(let t of(l=e,a))t(e)}function i(e){return a.add(e),()=>a.delete(e)}let u={title:"Leave this game?",body:"You're mid-game — your progress in this round will be lost."},o={title:"Leave the match?",body:"The match is still live — leaving counts as a loss and your opponent takes the win."};function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u,{title:r,body:l}=t;(0,n.useEffect)(()=>e?(c({title:r,body:l}),()=>c(null)):void c(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),c=Math.round(r*l);(e.width!==a||e.height!==c)&&(e.width=a,e.height=c);let i=e.getContext("2d");return i&&i.setTransform(l,0,0,l,0,0),i}function l(e,t,r,n,l){let a=r.getBoundingClientRect(),c=Math.min(a.width/n,a.height/l)||1,i=a.left+(a.width-n*c)/2,u=a.top+(a.height-l*c)/2;return{x:(e-i)/c,y:(t-u)/c}}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])}}},4382:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});
1var n=r(5155),l=r(2115),a=r(2932),c=r(1175),i=r(4107),u=r(3557),o=r(2773);let s=(e,t,r)=>{let n=Math.max(0,Math.min(1,r));return"rgb(".concat(Math.round(e[0]+(t[0]-e[0])*n),",").concat(Math.round(e[1]+(t[1]-e[1])*n),",").concat(Math.round(e[2]+(t[2]-e[2])*n),")")},f=[[143,212,238],[214,240,249]],x=[[59,74,122],[240,163,94]],h=[[11,16,48],[39,52,92]],d=[121,184,81],m=[46,74,40],g=Array.from({length:42},(e,t)=>({x:(151*t+37)%640,y:(83*t+11)%220+8,tw:t%5*1.3})),w=[{x:-10,w:90,h:150,c:"#d98c84"},{x:70,w:70,h:100,c:"#eecb8f"},{x:150,w:100,h:190,c:"#d98c84"},{x:260,w:80,h:120,c:"#eecb8f"},{x:350,w:95,h:170,c:"#d98c84"},{x:455,w:75,h:110,c:"#eecb8f"},{x:540,w:110,h:150,c:"#d98c84"}];function b(e){return 430-(e+1)*34}function y(e,t,r,n,l){e.fillStyle=l%3==1?"#e8a33d":"#cf4a4a",e.fillRect(t,r+5,n,29),e.fillStyle="rgba(0,0,0,0.12)",e.fillRect(t+n-5,r+5,5,29),e.fillStyle="#4a312a",e.fillRect(t-3,r,n+6,6);let a=Math.max(1,Math.floor((n-9)/22)),c=t+(n-(13*a+(a-1)*9))/2;for(let t=0;t<a;t++)e.fillStyle="#f7f1e8",e.fillRect(c,r+12,13,15),e.fillStyle="rgba(0,0,0,0.18)",e.fillRect(c,r+12,13,3.5),c+=22}function p(){let e=(0,l.useRef)(null),[t,r]=(0,l.useState)("idle");(0,o.GL)("running"===t);let[p,v]=(0,l.useState)(0),[M,S]=(0,l.useState)(0),{best:R,submit:k}=(0,u.g)("stack-tower"),[D,N]=(0,l.useState)([]),T=(0,l.useRef)(0),C=(0,l.useCallback)((e,t)=>{let r=++T.current;N(n=>[...n.slice(-2),{id:r,text:e,cls:t}]),setTimeout(()=>N(e=>e.filter(e=>e.id!==r)),1100)},[]),P=(0,l.useRef)(C);P.current=C;let j=(0,l.useRef)([]),A=(0,l.useRef)(null),E=(0,l.useRef)(0),_=(0,l.useRef)(0),I=(0,l.useRef)(null),L=(0,l.useRef)([]),F=(0,l.useRef)([]),B=(0,l.useRef)(Array.from({length:5},(e,t)=>({x:140*t+30,y:50+t%3*70,s:.7+t%3*.25}))),W=(0,l.useRef)(0),z=(0,l.useRef)(0),O=(0,l.useRef)(0),q=(0,l.useRef)(0),G=(0,l.useRef)(3),V=(0,l.useRef)(-1),Y=(0,l.useRef)(10),H=(0,l.useRef)([]),J=(0,l.useRef)(5),K=(0,l.useRef)("idle"),Q=(0,l.useRef)(0),U=(0,l.useRef)(0),X=(0,l.useRef)(0),Z=(0,l.useRef)(0);K.current=t;let $=()=>Math.floor(Q.current/10)+1,ee=e=>{let t=Math.max(j.current.length,1);return Math.sin(z.current)*Math.min(26,1.4*Math.max(0,j.current.length-6))*Math.pow((e+1)/t,1.7)},et=()=>{let e=Math.min(.52+.05*$(),.95)*Math.sin(E.current);return{x:320+118*Math.sin(e),y:14+118*Math.cos(e),theta:e}},er=(0,l.useCallback)(()=>{let t=e.current;if(!t)return;let r=(0,a.c)(t,640,480);if(!r)return;let n=Math.min(1,W.current/520),l=n<.5?s(f[0],x[0],2*n):s(x[0],h[0],(n-.5)*2),c=n<.5?s(f[1],x[1],2*n):s(x[1],h[1],(n-.5)*2),i=r.createLinearGradient(0,0,0,480);if(i.addColorStop(0,l),i.addColorStop(1,c),r.fillStyle=i,r.fillRect(0,0,640,480),n>.45){let e=performance.now()/1e3;for(let t of g){let l=(n-.45)*1.8*(.5+.5*Math.sin(2*e+t.tw));r.fillStyle="rgba(255,255,255,".concat(Math.min(.9,l),")"),r.fillRect(t.x,t.y,2,2)}}let u=Math.max(0,1-1.8*n);for(let e of(u>.02&&(r.globalAlpha=u,r.fillStyle="#f6a823",r.shadowColor="#f6a823",r.shadowBlur=24,r.beginPath(),r.arc(56,140+180*n,24,0,2*Math.PI),r.fill(),r.shadowBlur=0,r.globalAlpha=1),n>.5&&(r.globalAlpha=(n-.5)*2,r.fillStyle="#e8ecf5",r.shadowColor="#c9d4ef",r.shadowBlur=18,r.beginPath(),r.arc(550,90,20,0,2*Math.PI),r.fill(),r.shadowBlur=0,r.fillStyle="rgba(150,160,190,0.5)",r.beginPath(),r.arc(544,84,4.5,0,2*Math.PI),r.arc(556,96,3,0,2*Math.PI),r.fill(),r.globalAlpha=1),r.fillStyle="rgba(".concat(255-160*n,",").concat(255-150*n,",").concat(255-120*n,",").concat(.9-.35*n,")"),B.current))r.beginPath(),r.ellipse(e.x,e.y,38*e.s,13*e.s,0,0,2*Math.PI),r.ellipse(e.x+24*e.s,e.y-7*e.s,22*e.s,11*e.s,0,0,2*Math.PI),r.fill();for(let e of(r.strokeStyle=n>.5?"rgba(20,24,44,0.9)":"rgba(40,40,50,0.75)",r.lineWidth=2,H.current)){let t=5*Math.sin(9*e.t);r.beginPath(),r.moveTo(e.x-7,e.y-t),r.quadraticCurveTo(e.x-2,e.y+3,e.x,e.y),r.quadraticCurveTo(e.x+2,e.y+3,e.x+7,e.y-t),r.stroke()}O.current>0&&(r.fillStyle="rgba(255,255,255,".concat(.3*O.current,")"),r.fillRect(0,0,640,480));let o=q.current,p=o>0?(Math.random()-.5)*o*9:0;for(let e of(r.save(),r.translate(p,W.current),r.globalAlpha=.75,w)){r.fillStyle=n>.4?s([90,70,90],[24,28,52],(n-.4)*1.6):e.c,r.fillRect(e.x,430-e.h,e.w,e.h),r.fillStyle="rgba(40,30,40,0.85)",r.fillRect(e.x-3,430-e.h,e.w+6,6),r.fillStyle=n>.4?"rgba(255,214,130,".concat(.35+.5*n,")"):"rgba(255,255,255,0.55)";for(let t=430-e.h+14;t<418;t+=22)for(let n=e.x+8;n<e.x+e.w-12;n+=18)r.fillRect(n,t,8,10)}if(r.globalAlpha=1,r.fillStyle=s(d,m,n),r.fillRect(-50,430,740,14),r.fillStyle=s([93,64,55],[40,30,30],n),r.fillRect(-50,444,740,400),j.current.forEach((e,t)=>{y(r,e.x+ee(t),b(t),e.w,e.idx)}),I.current){let e=I.current;y(r,e.x,e.y,e.w,e.idx)}for(let e of L.current)r.save(),r.translate(e.x+e.w/2,e.y+17),r.rotate(e.rot),r.globalAlpha=.9,y(r,-e.w/2,-17,e.w,e.idx),r.globalAlpha=1,r.restore(
1);for(let e of F.current)r.globalAlpha=Math.max(1.6*e.life,0),r.fillStyle="#fff",r.beginPath(),r.arc(e.x,e.y,5,0,2*Math.PI),r.fill();if(r.globalAlpha=1,r.restore(),"running"===K.current&&A.current&&!I.current){let{x:e,y:t,theta:n}=et(),l=t+22,a=A.current;r.strokeStyle="#7a5a36",r.lineWidth=4,r.beginPath(),r.moveTo(320,0),r.lineTo(e,t-16),r.stroke(),r.save(),r.translate(e,t-16),r.rotate(.3*n),r.fillStyle="#f2b134",r.beginPath(),r.roundRect(-13,0,26,20,4),r.fill(),r.fillStyle="#4a312a",r.fillRect(-13,4,26,4),r.fillRect(-13,12,26,4),r.strokeStyle="#9a9a9a",r.lineWidth=4,r.beginPath(),r.arc(0,26,7,-Math.PI/2,.8*Math.PI),r.stroke(),r.restore(),r.strokeStyle="#4a312a",r.lineWidth=2.5,r.beginPath(),r.moveTo(e,t+6),r.lineTo(e-a.w/2+6,l+4),r.moveTo(e,t+6),r.lineTo(e+a.w/2-6,l+4),r.stroke(),r.save(),r.translate(e,l),r.rotate(.22*n),y(r,-a.w/2,0,a.w,a.idx),r.restore(),r.strokeStyle="rgba(0,0,0,0.12)",r.setLineDash([5,9]),r.lineWidth=1.5,r.beginPath(),r.moveTo(e-a.w/2,l+34),r.lineTo(e-a.w/2,480),r.moveTo(e+a.w/2,l+34),r.lineTo(e+a.w/2,480),r.stroke(),r.setLineDash([])}r.fillStyle=n>.45?"#ffd7a8":"#d33c3c",r.font="800 46px system-ui, sans-serif",r.textAlign="left",r.fillText(String($()),18,52),r.font="800 20px system-ui, sans-serif",r.fillText("LVL",18+r.measureText(String($())).width+26,36),r.textAlign="right",r.font="800 30px system-ui, sans-serif",r.fillText(String(Q.current),622,42),r.font="20px system-ui, sans-serif",r.fillText("❤️".repeat(Math.max(G.current,0)),624,72),U.current>=2&&(r.fillStyle="#b45309",r.font="bold 16px system-ui, sans-serif",r.textAlign="center",r.fillText("\uD83D\uDD25 perfect \xd7".concat(U.current),320,464))},[]),en=(0,l.useCallback)(()=>{(0,c._O)("lose"),q.current=1.4,V.current=0;let e=Math.max(1,j.current.length-4);j.current.splice(e).forEach((t,r)=>{L.current.push({x:t.x+ee(e+r),y:b(e+r),w:t.w,vx:(r%2==0?-1:1)*(60+45*r),vy:-80-30*r,idx:t.idx,rot:0,vr:(r%2==0?-1:1)*(2+r)})}),A.current=null,I.current=null},[]),el=(0,l.useCallback)(e=>{let t=j.current.length-1,r=j.current[t],n=ee(t),l=r.x+n,a=Math.max(e.x,l),i=Math.min(e.x+e.w,l+r.w),u=i-a;if(u<=0){L.current.push({x:e.x,y:e.y,w:e.w,vx:e.vx,vy:Math.max(.5*e.vy,120),idx:e.idx,rot:0,vr:e.x<l?-3:3}),q.current=1,G.current-=1,U.current=0,S(0),G.current<=0?en():((0,c._O)("explode"),P.current("\uD83D\uDC94 ".concat(G.current," ").concat(1===G.current?"heart":"hearts"," left!"),"text-rose-400"),A.current={w:e.w,idx:e.idx+1});return}let o=Math.abs(e.x-l),s=a-n,f=u;if(o<=8)s=r.x,f=Math.min(r.w+5,200),U.current+=1,O.current=1,P.current(U.current>=2?"\uD83D\uDD25 PERFECT \xd7".concat(U.current):"⭐ PERFECT!","text-yellow-300"),(0,c._O)("perfect");else{U.current=0;let t=e.x<l?e.x:i;L.current.push({x:t,y:e.y,w:e.w-u,vx:.4*e.vx,vy:-40,idx:e.idx,rot:0,vr:(e.x<l?-1:1)*2.5}),(0,c._O)("tap")}q.current=Math.min(.4,e.vy/2600),((e,t)=>{for(let r=0;r<8;r++){let r=Math.PI+(Math.random()-.5)*Math.PI;F.current.push({x:e+(Math.random()-.5)*30,y:t,vx:Math.cos(r)*(40+60*Math.random())*(.5>Math.random()?-1:1),vy:-(20+50*Math.random()),life:.5+.3*Math.random()})}})(s+f/2,b(j.current.length)+34),j.current.push({x:s,w:f,idx:e.idx}),Q.current+=1+(U.current>=2?U.current:0),v(Q.current),S(U.current),k(Q.current),Q.current>=Y.current&&(P.current("\uD83C\uDFD9️ LEVEL ".concat(Math.floor(Y.current/10)+1,"!"),"text-amber-300"),(0,c._O)("clear"),Y.current+=10),A.current={w:f,idx:e.idx+1}},[en,k]),ea=(0,l.useCallback)(e=>{let t=Math.min((e-Z.current)/1e3,.033);for(let r of(Z.current=e,B.current))r.x+=7*r.s*t,r.x>700&&(r.x=-60);if(J.current-=t,J.current<=0&&W.current>120){let e=.5>Math.random(),t=40+150*Math.random(),r=(e?1:-1)*(32+26*Math.random());for(let n=0;n<3;n++)H.current.push({x:(e?-20:660)-(e?1:-1)*n*18,y:t+n%2*14,vx:r,t:6*Math.random()});J.current=7+8*Math.random()}for(let e of H.current)e.x+=e.vx*t,e.t+=t,e.y+=6*Math.sin(3*e.t)*t;if(H.current=H.current.filter(e=>e.x>-60&&e.x<700),V.current>=0&&"running"===K.current&&(V.current+=1e3*t,V.current>900&&(V.current=-1,r("over"),k(Q.current),(0,i.q7)("stack-tower",Q.current))),"running"===K.current&&V.current<0){if(z.current+=t*(1.1+.08*$()),!I.current&&A.current){let e=Math.min(1.5+.18*$(),3.2),r=et().x;E.current+=e*t,_.current=(et().x-r)/Math.max(t,.001)}else if(I.current){let e=I.current;e.vy+=3200*t,e.x+=e.vx*t,e.y+=e.vy*t;let r=b(j.current.length);e.y>=r&&(e.y=r,I.current=null,el(e))}}for(let e of L.current)e.vy+=1500*t,e.x+=e.vx*t,e.y+=e.vy*t,e.rot+=e.vr*t;for(let e of(L.current=L.current.filter(e=>e.y<700-W.current),F.current))e.x+=e.vx*t,e.y+=e.vy*t,e.life-=t;F.current=F.current.filter(e=>e.life>0);let n=Math.max(0,(j.current.length-5)*34);W.current+=(n-W.current)*Math.min(6*t,1),O.current>0&&(O.current-=3*t),q.current>0&&(q.current-=3*t),er(),X.current=requestAnimationFrame(ea)},[er,el,k]);(0,l.useEffect)(()=>(Z.current=performance.now(),X.current=requestAnimationFrame(ea),()=>cancelAnimationFrame(X.current)),[ea]);let ec=(0,l.useCallback)(()=>{j.current=[{x:220,w:200,idx:0}],A.current={w:200,idx:1},I.current=null,L.current=[],F.current=[],E.current=0,z.current=0,W.current=0,G.current=3,V.current=-1,Y.current=10,H.
1current=[],J.current=5,Q.current=0,U.current=0,v(0),S(0),r("running")},[]),ei=(0,l.useCallback)(()=>{if("running"!==K.current){"idle"===K.current&&ec();return}if(I.current||!A.current||V.current>=0)return;let{x:e,y:t}=et(),r=Math.max(-340,Math.min(340,.8*_.current));(0,c._O)("tap"),I.current={x:e-A.current.w/2,y:t+22-W.current,w:A.current.w,vx:r,vy:50,idx:A.current.idx},A.current=null,setTimeout(()=>{"running"!==K.current||!(V.current<0)||A.current||I.current||(A.current={w:j.current[j.current.length-1].w,idx:j.current.length})},3e3)},[ec]);return(0,l.useEffect)(()=>{let e=e=>{("Space"===e.code||"Enter"===e.key)&&(e.preventDefault(),"over"===K.current?ec():ei())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ei,ec]),(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:"Floors"}),(0,n.jsx)("div",{className:"text-xl font-bold text-white",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:R})]}),M>=2&&(0,n.jsxs)("div",{className:"animate-pop rounded-xl bg-amber-400/20 px-4 py-2 text-center",children:[(0,n.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-amber-300",children:"Streak"}),(0,n.jsxs)("div",{className:"text-xl font-bold text-amber-300",children:["\xd7",M]})]})]}),(0,n.jsx)("button",{onClick:ec,className:"rounded-xl bg-gradient-to-r from-rose-500 to-pink-500 px-4 py-2 font-bold text-white transition hover:scale-105",children:"running"===t?"Restart":"Start"})]}),(0,n.jsxs)("div",{"data-board":!0,className:"relative mx-auto w-full touch-none overflow-hidden rounded-2xl border border-white/10",style:{maxWidth:"min(100%, calc(82vh * 1.333))"},onPointerDown:()=>{"over"!==K.current&&ei()},role:"application","aria-label":"Stack Tower game. Tap or press space to release the swinging block.",children:[(0,n.jsx)("canvas",{ref:e,width:640,height:480,className:"block h-auto w-full"}),(0,n.jsx)("div",{className:"pointer-events-none absolute inset-x-0 top-[16%] z-10 flex flex-col items-center gap-1",children:D.map(e=>(0,n.jsx)("div",{className:"animate-bounce-in text-xl font-extrabold drop-shadow-[0_2px_4px_rgba(0,0,0,0.7)] sm:text-2xl ".concat(e.cls),children:e.text},e.id))}),"running"!==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:["over"===t?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{className:"animate-bounce-in text-3xl font-extrabold text-white",children:"\uD83C\uDFD7️ Tower down!"}),(0,n.jsxs)("p",{className:"text-zinc-200",children:[p," floors",p>0&&p>=R&&(0,n.jsx)("span",{className:"ml-2 font-bold text-amber-300",children:"New best!"})]})]}):(0,n.jsx)("p",{className:"animate-float text-5xl","aria-hidden":!0,children:"\uD83C\uDFD7️"}),(0,n.jsx)("button",{onClick:e=>{e.stopPropagation(),ec()},className:"rounded-xl bg-gradient-to-r from-rose-500 to-pink-500 px-6 py-3 font-bold text-white transition hover:scale-105",children:"over"===t?"Build again":"▶ Start building"})]})]}),(0,n.jsx)("p",{className:"mt-4 text-center text-sm text-zinc-500",children:"⌨️ Space / \uD83D\uDCF1 Tap to release the crane block \xb7 3 ❤️ \xb7 Perfect drops grow the floor \xb7 Build into the night \uD83C\uDF19"})]})}}}]);

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.