1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[204],{6102:(e,t,a)=>{Promise.resolve().then(a.bind(a,97969)),Promise.resolve().then(a.bind(a,64004)),Promise.resolve().then(a.bind(a,60079))},64004:(e,t,a)=>{"use strict";a.d(t,{default:()=>C});var r=a(95296),n=a(62493),l=a(11180);let o={board:{width:720,height:1280},wall:{y:1050,height:96,maxHp:420,defense:4},hero:{x:360,y:1180,range:1e3},waves:[{minWave:1,countBase:7,countGrowth:1.25,countMax:18,spawnInterval:.98,intervalFloor:.72,enemyWeights:[{type:"skitter",weight:.62},{type:"shard",weight:.38}]},{minWave:5,countBase:9,countGrowth:1.42,countMax:26,spawnInterval:.88,intervalFloor:.58,enemyWeights:[{type:"skitter",weight:.48},{type:"shard",weight:.34},{type:"brute",weight:.18}]},{minWave:10,countBase:11,countGrowth:1.68,countMax:34,spawnInterval:.78,intervalFloor:.46,enemyWeights:[{type:"skitter",weight:.35},{type:"shard",weight:.25},{type:"brute",weight:.18},{type:"caster",weight:.22}]},{minWave:16,countBase:13,countGrowth:1.85,countMax:42,spawnInterval:.68,intervalFloor:.36,enemyWeights:[{type:"skitter",weight:.28},{type:"shard",weight:.2},{type:"brute",weight:.22},{type:"caster",weight:.3}]}],enemies:{skitter:{id:"skitter",name:"Skitter",hp:20,speed:88,reward:8,radiu
1s:12,sides:3,rotation:-Math.PI/2,color:"#fb7185",glow:"#fda4af",attackKind:"melee",attackRange:22,attackDamage:6,attackCooldown:.78,projectileSpeed:0,projectileDamage:0},shard:{id:"shard",name:"Shard",hp:28,speed:72,reward:12,radius:15,sides:4,rotation:Math.PI/4,color:"#f59e0b",glow:"#fcd34d",attackKind:"ranged",attackRange:170,attackDamage:5,attackCooldown:1.15,projectileSpeed:286,projectileDamage:6},brute:{id:"brute",name:"Brute",hp:56,speed:56,reward:20,radius:19,sides:6,rotation:Math.PI/6,color:"#60a5fa",glow:"#93c5fd",attackKind:"melee",attackRange:34,attackDamage:11,attackCooldown:1.05,projectileSpeed:0,projectileDamage:0},caster:{id:"caster",name:"Caster",hp:38,speed:62,reward:18,radius:16,sides:8,rotation:Math.PI/8,color:"#34d399",glow:"#6ee7b7",attackKind:"ranged",attackRange:220,attackDamage:7,attackCooldown:1.35,projectileSpeed:320,projectileDamage:8}},ui:{headline:"Hold the wall, clear the sky, and turn every level-up into a weapon choice.",mobileHint:"Tap Restart to begin again, or expand the board when you want the action to fill the screen.",shieldLabel:"Wall Defense"}};function i(e,t,a){return Math.min(a,Math.max(t,e))}function s(e,t){return Math.hypot(e.x-t.x,e.y-t.y)}function d(e){return Math.round(32+18*e+7*Math.pow(e,1.32))}function c(e){let t=function(e){let t=o.waves[0];for(let a of o.waves)e>=a.minWave&&(t=a);return t}(e),a=i(Math.round(t.countBase+e*t.countGrowth),6,t.countMax),r=Math.max(t.intervalFloor,t.spawnInterval-.012*Math.max(0,e-t.minWave)),n=Array.from({length:a},()=>(function(e){var t;let a=Math.random()*e.reduce((e,t)=>e+t.weight,0);for(let t of e)if((a-=t.weight)<=0)return t.type;return(null==(t=e[e.length-1])?void 0:t.type)||"skitter"})(t.enemyWeights));return{band:t,count:a,spawnInterval:r,queue:n}}function h(){return{wave:1,level:1,exp:0,xpToNext:d(1),score:0,kills:0,wallHp:o.wall.maxHp,wallMaxHp:o.wall.maxHp,wallDefense:o.wall.defense,weapon:{damage:11,penetration:0,spreadCount:1,burstCount:1,spreadAngle:0,burstGap:.06,projectileSpeed:980,fireRate:1.35,range:o.hero.range},enemies:[],projectiles:[],enemyProjectiles:[],waveBlueprint:c(1),waveSpawned:0,spawnTimer:.7,intermissionTimer:0,heroFireCooldown:.2,message:"Hold the wall and clear the first wave.",messageTimer:3,choice:null,gameOver:!1,nextEnemyId:1,nextProjectileId:1,nextEnemyProjectileId:1,nextChoiceId:1}}function u(e,t,a,r,n,l){let o=t,i=a,s=r,d=n;s<0&&(o+=s,s=Math.abs(s)),d<0&&(i+=d,d=Math.abs(d));let c=Math.max(0,Math.min(l,s/2,d/2));e.beginPath(),e.moveTo(o+c,i),e.arcTo(o+s,i,o+s,i+d,c),e.arcTo(o+s,i+d,o,i+d,c),e.arcTo(o,i+d,o,i,c),e.arcTo(o,i,o+s,i,c),e.closePath()}function f(e,t,a,r,n,l,o){let i=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;e.save(),i&&(e.shadowColor=i.color,e.shadowBlur=i.blur,e.shadowOffsetY=i.offsetY||0),u(e,t,a,r,n,l),e.fillStyle=o,e.fill(),e.restore()}function p(e,t,a,r,n,l,o){let i=arguments.length>7&&void 0!==arguments[7]?arguments[7]:1;e.save(),u(e,t,a,r,n,l),e.strokeStyle=o,e.lineWidth=i,e.stroke(),e.restore()}function y(e,t,a){let r=t.split(" "),n=[],l="";for(let t of r){let r=l?"".concat(l," ").concat(t):t;e.measureText(r).width>a&&l?(n.push(l),l=t):l=r}return l&&n.push(l),n}function m(e,t,a,r,n){let l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,o=2*Math.PI/n;e.beginPath();for(let i=0;i<n;i+=1){let n=l+i*o,s=t+Math.cos(n)*r,d=a+Math.sin(n)*r;0===i?e.moveTo(s,d):e.lineTo(s,d)}e.closePath()}function w(e,t){let a=i(Math.round(.04*e),14,24),r=i(Math.round(.016*e),8,14),n=a+108+r,l=Math.max(320,t-n-a-r),s={x:a,y:n,w:e-2*a,h:l},d=o.board.width,c=o.board.height,h=Math.min(s.w/d,s.h/c),u={x:s.x+(s.w-d*h)/2,y:s.y+(s.h-c*h)/2,w:d*h,h:c*h,scale:h},f={x:a,y:a,w:e-2*a,h:108},p=e<700,y=e<540?2:4,m=Math.ceil(4/y),w=(e-2*a-10*(y-1))/y,g=f.y+10,x=Math.max(42,f.y+f.h-10-g),b=m>1?Math.max(24,Math.min(34,Math.floor((x-10*(m-1))/m))):Math.max(26,Math.floor(x)),v=[];for(let e=0;e<4;e+=1){let t=e%y,r=Math.floor(e/y);v.push({x:a+t*(w+10),y:g+r*(b+10),w:w,h:b})}let M=p?(f.w-6)/2:Math.max(70,Math.min(92,Math.round(.1*f.w))),S=f.y+f.h-24-6,k=p?{restart:{x:f.x,y:S,w:M,h:24},expand:{x:f.x+M+6,y:S,w:M,h:24}}:{expand:{x:f.x+f.w-M,y:S,w:M,h:24},restart:{x:f.x+f.w-2*M-6,y:S,w:M,h:24}};return{pad:a,gap:r,controlBarHeight:108,boardArea:s,boardInner:u,topBar:f,statCards:v,buttons:k,isCompact:p}}function g(e,t){return{x:e.x+t.x*e.scale,y:e.y+t.y*e.scale}}function x(e,t,a,r,n){let l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"";f(e,t.x,t.y,t.w,t.h,12,"rgba(15, 23, 42, 0.92)",{color:n,blur:12,offsetY:1}),p(e,t.x,t.y,t.w,t.h,12,"rgba(255,255,255,0.10)",1),e.save(),e.fillStyle=n,e.fillRect(t.x+8,t.y+7,3,t.h-14),e.fillStyle="rgba(226, 232, 240, 0.76)",e.font="600 ".concat(8,"px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif"),e.textAlign="left",e.textBaseline="top",e.fillText(a.toUpperCase(),t.x+15,t.y+7),e.fillStyle="#fff",e.font="700 ".concat(14,"px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif"),e.fillText(String(r),t.x+15,t.y+18),l&&(e.fillStyle="rgba(226, 232, 240, 0.68)",e.font="500 8px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(l,t.x+15,t.y+t.h-10)),e.restore(
1)}function b(e,t,a,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"primary",l=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(e.save(),"primary"===n&&l){let a=e.createLinearGradient(t.x,t.y,t.x+t.w,t.y+t.h);a.addColorStop(0,"rgba(14,165,233,1)"),a.addColorStop(1,"rgba(59,130,246,0.92)"),e.fillStyle=a,e.shadowColor="rgba(56, 189, 248, 0.36)",e.shadowBlur=14}else e.fillStyle=l?"rgba(30, 41, 59, 0.92)":"rgba(71, 85, 105, 0.55)";u(e,t.x,t.y,t.w,t.h,16),e.fill(),e.shadowBlur=0,e.strokeStyle=l?"rgba(255,255,255,0.16)":"rgba(255,255,255,0.08)",e.lineWidth=1,e.stroke(),e.fillStyle="#fff",e.font="700 11px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.textBaseline="middle",e.textAlign="left",e.fillText(a,t.x+10,t.y+t.h/2-4),r&&(e.fillStyle="rgba(255,255,255,0.76)",e.font="500 8px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(r,t.x+10,t.y+t.h/2+6)),e.restore()}function v(e){let t,a=Math.min(640,e.boardInner.w-32),r=e.boardInner.w>=560,n=r?132:90,l=[];if(r){let r=(a-36-24)/3;t=220;let o=e.boardInner.x+(e.boardInner.w-a)/2+18,i=e.boardInner.y+.28*e.boardInner.h+58;for(let e=0;e<3;e+=1)l.push({x:o+e*(r+12),y:i,w:r,h:n});return{panel:{x:e.boardInner.x+(e.boardInner.w-a)/2,y:e.boardInner.y+.24*e.boardInner.h,w:a,h:t},cards:l}}let o=a-36;t=36+3*n+24+44;let i=e.boardInner.x+(e.boardInner.w-a)/2+18,s=e.boardInner.y+.18*e.boardInner.h+54;for(let e=0;e<3;e+=1)l.push({x:i,y:s+e*(n+12),w:o,h:n});return{panel:{x:e.boardInner.x+(e.boardInner.w-a)/2,y:e.boardInner.y+.15*e.boardInner.h,w:a,h:t},cards:l}}function M(e,t){return e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h}function S(e,t){let a=Math.max(1,t-e.wallDefense);e.wallHp=Math.max(0,e.wallHp-a),e.message="The wall took ".concat(a," damage."),e.messageTimer=1.2,e.wallHp<=0&&(e.wallHp=0,e.gameOver=!0,e.message="The wall has fallen.",e.messageTimer=0)}function k(e,t,a){if(a.hp-=t.damage,t.pierceLeft-=1,a.hp<=0){a.dead=!0,e.kills+=1;let t=a.reward+Math.floor(e.wave/3);e.score+=10*t,e.exp+=t,e.exp>=e.xpToNext&&!e.choice&&(e.level+=1,e.exp-=e.xpToNext,e.xpToNext=d(e.level),T(e))}}function T(e){var t;let a=[...[{id:"damage",title:"Heavy Rounds",summary:"+3 bullet damage",detail:"Single shots punch through tougher enemies.",accent:"rgba(248, 113, 113, 0.95)",available:!0,apply:()=>{t.weapon.damage+=3}},{id:"pierce",title:"Piercing Ammo",summary:"+1 penetration",detail:"Bullets can pass through one more target.",accent:"rgba(59, 130, 246, 0.95)",available:(t=e).weapon.penetration<4,apply:()=>{t.weapon.penetration=Math.min(4,t.weapon.penetration+1)}},{id:"spread",title:"Wide Spread",summary:"+1 fire lane",detail:"The volley opens into a wider fan.",accent:"rgba(14, 165, 233, 0.95)",available:t.weapon.spreadCount<3,apply:()=>{t.weapon.spreadCount=Math.min(3,t.weapon.spreadCount+1),t.weapon.spreadAngle=Math.min(22,t.weapon.spreadAngle+2)}},{id:"burst",title:"Burst Drum",summary:"+1 burst",detail:"The gun f
1ires another short burst per volley.",accent:"rgba(168, 85, 247, 0.95)",available:t.weapon.burstCount<3,apply:()=>{t.weapon.burstCount=Math.min(3,t.weapon.burstCount+1)}},{id:"rapid",title:"Rapid Loader",summary:"Faster firing",detail:"Your trigger recovery gets shorter.",accent:"rgba(250, 204, 21, 0.95)",available:t.weapon.fireRate<3.1,apply:()=>{t.weapon.fireRate=Math.min(3.1,t.weapon.fireRate+.16)}},{id:"range",title:"Long Barrel",summary:"+96 range",detail:"The gun tracks threats from farther away.",accent:"rgba(34, 197, 94, 0.95)",available:t.weapon.range<1360,apply:()=>{t.weapon.range=Math.min(1360,t.weapon.range+96)}},{id:"wallHp",title:"Reinforced Plating",summary:"+48 wall max HP",detail:"The barricade can take more punishment.",accent:"rgba(148, 163, 184, 0.95)",available:t.wallMaxHp<720,apply:()=>{t.wallMaxHp+=48,t.wallHp=Math.min(t.wallMaxHp,t.wallHp+24)}},{id:"wallDef",title:"Armor Seal",summary:"+1 wall defense",detail:"Each hit is softened before it reaches the wall.",accent:"rgba(20, 184, 166, 0.95)",available:t.wallDefense<12,apply:()=>{t.wallDefense+=1}}].filter(e=>e.available)].sort(()=>Math.random()-.5).slice(0,3);a.length&&(e.choice={id:e.nextChoiceId++,cards:a},e.message="Level up! Choose one upgrade.",e.messageTimer=1.5)}function I(e,t){e.current=h(),t(e=>e+1)}function C(){let e=(0,l.useRef)(null),t=(0,l.useRef)(null),a=(0,l.useRef)(h()),C=(0,l.useRef)({width:0,height:0}),[B,P]=(0,l.useState)({width:0,height:0}),[R,j]=(0,l.useState)(!1),[E,F]=(0,l.useState)(0);(0,l.useEffect)(()=>{let t=e.current;if(!t)return;let a=()=>{let e=t.getBoundingClientRect(),a={width:Math.max(1,Math.round(e.width)),height:Math.max(1,Math.round(e.height))};a.width&&a.height&&(C.current=a,P(a))};a();let r=requestAnimationFrame(a),n=new ResizeObserver(e=>{let t=e[0].contentRect,a={width:Math.max(1,Math.round(t.width)),height:Math.max(1,Math.round(t.height))};a.width&&a.height&&(C.current=a,P(a))});return n.observe(t),()=>{cancelAnimationFrame(r),n.disconnect()}},[R]),(0,l.useEffect)(()=>{var e,t;let a=()=>{var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||window.innerHeight;document.documentElement.style.setProperty("--vertical-defense-viewport-height","".concat(Math.round(t),"px"))};return a(),window.addEventListener("resize",a),null==(e=window.visualViewport)||e.addEventListener("resize",a),null==(t=window.visualViewport)||t.addEventListener("scroll",a),()=>{var e,t;window.removeEventListener("resize",a),null==(e=window.visualViewport)||e.removeEventListener("resize",a),null==(t=window.visualViewport)||t.removeEventListener("scroll",a),document.documentElement.style.removeProperty("--vertical-defense-viewport-height")}},[]),(0,l.useEffect)(()=>{if(!R)return;let e=document.body.style.overflow,t=document.documentElement.style.overflow,a=document.body.style.overscrollBehavior,r=document.documentElement.style.overscrollBehavior;return document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",document.body.style.overscrollBehavior="none",document.documentElement.style.overscrollBehavior="none",()=>{document.body.style.overflow=e,document.documentElement.style.overflow=t,document.body.style.overscrollBehavior=a,document.documentElement.style.overscrollBehavior=r}},[R]),(0,l.useEffect)(()=>{let e=t.current;if(!e||!B.width||!B.height)return;let r=window.devicePixelRatio||1;e.width=Math.floor(B.width*r),e.height=Math.floor(B.height*r),e.style.width="".concat(B.width,"px"),e.style.height="".concat(B.height,"px");let n=e.getContext("2d");if(!n)return;let l=0,d=performance.now(),h=()=>{let e=C.current.width,t=C.current.height;if(!e||!t){l=requestAnimationFrame(h);return}let M=performance.now(),T=Math.min(.033,(M-d)/1e3);d=M,function(e,t){if(e.gameOver||e.choice)return;if(e.messageTimer>0&&(e.messageTimer-=t,e.messageTimer<=0&&(e.message="")),e.intermissionTimer>0)e.intermissionTimer-=t,e.intermissionTimer<=0&&(e.wave+=1,e.waveBlueprint=c(e.wave),e.waveSpawned=0,e.spawnTimer=e.waveBlueprint.spawnInterval,e.message="Wave ".concat(e.wave," incoming."),e.messageTimer=1.6);else if(e.waveSpawned<e.waveBlueprint.count)for(e.spawnTimer-=t;e.spawnTimer<=0&&e.waveSpawned<e.waveBlueprint.count;){let t=e.waveBlueprint.queue[e.waveSpawned],a={x:i(60+600*Math.random(),44,676),y:-60-100*Math.random()};e.enemies.push(function(e,t,a,r){let n=o.enemies[e],l=1+.13*t,i=n.reward+Math.floor(t/3);return{id:a,typeId:e,name:n.name,x:r.x,y:r.y,hp:Math.round(n.hp*l),maxHp:Math.round(n.hp*l),speed:n.speed*(1+.012*t),reward:i,radius:n.radius,sides:n.sides,rotation:n.rotation,color:n.color,glow:n.glow,attackKind:n.attackKind,attackRange:n.attackRange+4*Math.floor(t/8),attackDamage:n.attackDamage+Math.floor(t/7),attackCooldown:n.attackCooldown,projectileSpeed:n.projectileSpeed+10*Math.floor(t/6),projectileDamage:n.projectileDamage+Math.floor(t/8),spin:Math.random()*Math.PI*2,attackTimer:0,dead:!1}}(t,e.wave,e.nextEnemyId++,a)),e.waveSpawned+=1,e.spawnTimer+=e.waveBlueprint.spawnInterval}e.heroFireCooldown=Math.max(0,e.heroFireCooldown-t);let a=function(e,t,a){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0,n=null,l=r;for(let r of e){if(r.dead)continue;let e=Math.hypot(r.x-t,r.y-a);e<=l&&(n=r,l=e)}return n}(e.enemies,o.hero.x,o.wall.y-24,e.weapon.range);a&&e.heroFireCooldown<=0&&(!function(e,t){let a=e.weapon,r={x:o.hero.x,y:o.wall.y-24},n=o.enemies[t.typeId],l=t.speed*(1+.014*e.wave),s="ranged"===t.attackKind?o.wall.y-.88*n.attackRange:o.wall.y-t.radius-3,d=l>0?Math.max(0,(s-t.y)/l):0,c=function(e,t,a,r){let n=t.x-e.x,l=t.y-e.y,o=a*a-r*r,i=2*l*a,s=n*n+l*l;if(1e-6>Math.abs(o)){if(1e-6>Math.abs(i))return null;let e=-s/i;return e>0?e:null}let d=i*i-4*o*s;if(d<0)return null;
1let c=Math.sqrt(d),h=[(-i-c)/(2*o),(-i+c)/(2*o)].filter(e=>Number.isFinite(e)&&e>0);return h.length?Math.min(...h):null}(r,t,l,a.projectileSpeed),h={x:t.x,y:t.y};null!==c&&c<=d?h={x:t.x,y:t.y+l*c}:d>0&&(h={x:t.x,y:s});let u=Math.atan2(h.y-r.y,h.x-r.x),f=i(a.burstCount,1,3),p=i(a.spreadCount,1,3),y=a.spreadAngle*(Math.PI/180),m=Math.hypot(h.x-r.x,h.y-r.y)/Math.max(a.projectileSpeed,1);for(let n=0;n<f;n+=1){let l=n*a.burstGap;for(let n=0;n<p;n+=1){let o=(n-(p-1)/2)*y;e.projectiles.push({id:e.nextProjectileId++,x:r.x,y:r.y,prevX:r.x,prevY:r.y,angle:u+o,speed:a.projectileSpeed,guaranteedHit:0===o,lockedTargetId:t.id,flightTime:0,travelTime:m,damage:a.damage,radius:4.8,delay:l,ttl:3.6,pierceLeft:a.penetration,color:0===n?"rgba(255,255,255,0.98)":"rgba(125, 211, 252, 0.95)"})}}}(e,a),e.heroFireCooldown=1/e.weapon.fireRate);let r=[];for(let a of e.enemies){if(a.dead)continue;let n=o.enemies[a.typeId];a.spin+=t*("ranged"===n.attackKind?.9:.6),a.attackCooldown=Math.max(0,a.attackCooldown-t);let l=a.speed*(1+.014*e.wave),s=o.wall.y-a.y;if("ranged"===n.attackKind)a.y=Math.min(o.wall.y-.88*n.attackRange,a.y+l*t);else{let e=o.wall.y-a.radius-3;a.y=Math.min(e,a.y+l*t)}if(a.x=i(a.x,36,o.board.width-36),"melee"===n.attackKind)s<=a.radius+2&&a.attackCooldown<=0&&(S(e,n.attackDamage+Math.floor(e.wave/7)),a.attackCooldown=n.attackCooldown);else if(s<=n.attackRange&&a.attackCooldown<=0){let t=a.projectileSpeed,r=Math.PI/2+(Math.random()-.5)*.22;e.enemyProjectiles.push({id:e.nextEnemyProjectileId++,x:a.x,y:a.y+a.radius,prevX:a.x,prevY:a.y+a.radius,angle:r,speed:t,damage:a.projectileDamage,radius:i(.3*a.radius,4,7),ttl:4,color:"caster"===a.id?"rgba(52, 211, 153, 0.96)":"rgba(251, 146, 60, 0.96)"}),a.attackCooldown=n.attackCooldown}r.push(a)}if(e.enemies=r,e.gameOver)return;let n=[];for(let a of e.projectiles){if(a.ttl-=t,a.delay>0){a.delay-=t,n.push(a);continue}a.flightTime=(a.flightTime||0)+t,a.prevX=a.x,a.prevY=a.y;let r={x:a.prevX,y:a.prevY};if(a.x+=Math.cos(a.angle)*a.speed*t,a.y+=Math.sin(a.angle)*a.speed*t,a.guaranteedHit){let t=e.enemies.find(e=>!e.dead&&e.id===a.lockedTargetId);if(t){let r=t.radius+a.radius;if(a.flightTime>=a.travelTime||s(a,t)<=r){k(e,a,t),a.ttl=0;continue}}else if(a.flightTime>=a.travelTime){a.ttl=0;continue}}let l=!1;for(let t of e.enemies){if(t.dead||a.guaranteedHit&&t.id!==a.lockedTargetId)continue;let n=t.radius+a.radius;if((s(a,t)<=n||function(e,t,a){let r=a.x-t.x,n=a.y-t.y;if(0===r&&0===n){let a=e.x-t.x,r=e.y-t.y;return a*a+r*r}let l=i(((e.x-t.x)*r+(e.y-t.y)*n)/(r*r+n*n),0,1),o=t.x+r*l,s=t.y+n*l,d=e.x-o,c=e.y-s;return d*d+c*c}(t,r,a)<=n*n)&&(k(e,a,t),l=!0,a.guaranteedHit||a.pierceLeft<0||e.choice)){a.guaranteedHit&&(a.ttl=0);break}}a.ttl<=0||!(a.x<-40||a.y<-80||a.x>o.board.width+40||a.y>o.board.height+80)&&(e.choice||!(a.pierceLeft>=0)&&l||n.push(a))}if(e.projectiles=n,e.choice)return;let l=[];for(let a of e.enemyProjectiles){if(a.ttl-=t,a.prevX=a.x,a.prevY=a.y,a.x+=Math.cos(a.angle)*a.speed*t,a.y+=Math.sin(a.angle)*a.speed*t,a.y>=o.wall.y){S(e,a.damage);continue}a.ttl<=0||l.push(a)}e.enemyProjectiles=l,e.gameOver||(e.enemies=e.enemies.filter(e=>!e.dead&&e.hp>0),!e.choice&&!e.gameOver&&e.intermissionTimer<=0&&e.waveSpawned>=e.waveBlueprint.count&&0===e.enemies.length&&0===e.enemyProjectiles.length&&(e.intermissionTimer=1.4,e.message="Wave ".concat(e.wave," cleared."),e.messageTimer=1.6))}(a.current,T),n.setTransform(r,0,0,r,0,0);let I=n.createLinearGradient(0,0,0,t);I.addColorStop(0,"#020617"),I.addColorStop(.55,"#0f172a"),I.addColorStop(1,"#111827"),n.fillStyle=I,n.fillRect(0,0,e,t);let B=n.createRadialGradient(.5*e,.05*t,10,.5*e,.05*t,.56*Math.max(e,t));B.addColorStop(0,"rgba(59,130,246,0.20)"),B.addColorStop(.35,"rgba(16,185,129,0.10)"),B.addColorStop(1,"rgba(2,6,23,0)"),n.fillStyle=B,n.fillRect(0,0,e,t);let P=n.createRadialGradient(.55*e,.95*t,10,.55*e,.95*t,.42*Math.max(e,t));P.addColorStop(0,"rgba(56,189,248,0.14)"),P.addColorStop(1,"rgba(2,6,23,0)"),n.fillStyle=P,n.fillRect(0,0,e,t);let j=w(e,t);!function(e,t,a,r){let{pad:n,topBar:l,statCards:o,buttons:s}=a;f(e,l.x,l.y,l.w,l.h,24,"rgba(15, 23, 42, 0.82)",{color:"rgba(59,130,246,0.16)",blur:16,offsetY:3}),p(e,l.x,l.y,l.w,l.h,24,"rgba(255,255,255,0.08)",1),e.save();let d=t.waveBlueprint,c=d.count>0?t.waveSpawned/d.count:1,h=n+16,u=l.y+16,m=Math.min(a.isCompact?180:220,a.boardArea.w*(a.isCompact?.26:.28));if(f(e,h,u-7,m,7,4,"rgba(30,41,59,0.95)"),f(e,h,u-7,Math.max(12,m*i(c,0,1)),7,4,"rgba(56,189,248,0.95)"),e.fillStyle="rgba(226, 232, 240, 0.8)",e.font=a.isCompact?"500 9px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif":"500 10px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText("Wave ".concat(t.wave," \xb7 ").concat(t.waveSpawned,"/").concat(d.count),h,u+2),x(e,o[0],"W",t.wave,"rgba(56, 189, 248, 0.95)","B".concat(d.band.minWave,"+")),x(e,o[1],"L",t.level,"rgba(74, 222, 128, 0.95)","XP ".concat(t.exp,"/").concat(t.xpToNext)),x(e,o[2],"HP",Math.max(0,Math.round(t.wallHp)),"rgba(248, 113, 113, 0.95)","D".concat(t.wallDefense)),x(e,o[3],"S",t.score,"rgba(250, 204, 21, 0.95)","".concat(t.kills,"k")),t.message){let r={x:n+16,y:l.y+l.h-25,w:Math.max(180,.42*a.boardArea.w),h:18};f(e,r.x,r.y,r.w,r.h,10,"rgba(15,23,42,0.88)",{color:"rgba(129,140,248,0.16)",blur:10,offsetY:2}),e.fillStyle="rgba(255,255,255,0.96)",e.font="600 9px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="left",e.textBaseline="middle",y(e,t.message,r.w-24).slice(0,1).forEac
1h((t,a)=>{e.fillText(t,r.x+10,r.y+r.h/2+10*a-1)})}b(e,s.restart,"Restart",t.gameOver?"Again":"Run","primary",!0),b(e,s.expand,r?"Shrink":"Expand",r?"Back":"Full","secondary",!0),e.restore()}(n,a.current,j,R);var E=j.boardArea;let F=n.createLinearGradient(E.x,E.y,E.x,E.y+E.h);F.addColorStop(0,"rgba(8, 15, 34, 0.94)"),F.addColorStop(1,"rgba(12, 18, 38, 0.98)"),f(n,E.x,E.y,E.w,E.h,28,F,{color:"rgba(14, 165, 233, 0.16)",blur:24,offsetY:6}),p(n,E.x,E.y,E.w,E.h,28,"rgba(148, 163, 184, 0.16)",1),function(e,t){e.save(),e.beginPath(),u(e,t.x,t.y,t.w,t.h,24),e.clip();let a=Math.max(34,Math.round(42*t.scale/.75));e.strokeStyle="rgba(255,255,255,0.05)",e.lineWidth=1;for(let r=t.x;r<=t.x+t.w;r+=a)e.beginPath(),e.moveTo(r,t.y),e.lineTo(r,t.y+t.h),e.stroke();for(let r=t.y;r<=t.y+t.h;r+=a)e.beginPath(),e.moveTo(t.x,r),e.lineTo(t.x+t.w,r),e.stroke();e.restore()}(n,j.boardInner);var H=j.boardInner;let D=n.createLinearGradient(0,H.y,0,H.y+.24*H.h);D.addColorStop(0,"rgba(59,130,246,0.16)"),D.addColorStop(1,"rgba(2,6,23,0)"),f(n,H.x,H.y,H.w,.28*H.h,22,D),[...a.current.enemies].sort((e,t)=>e.y-t.y).forEach(e=>(function(e,t,a){let r=g(t,a),n=i(t.scale*a.radius,8,22);e.save(),e.shadowColor=a.glow,e.shadowBlur=18;let l=e.createRadialGradient(r.x-4,r.y-4,2,r.x,r.y,n+10);l.addColorStop(0,"rgba(255,255,255,0.34)"),l.addColorStop(.35,a.color),l.addColorStop(1,"rgba(15,23,42,0.96)"),m(e,r.x,r.y,n,a.sides,a.rotation+a.spin),e.fillStyle=l,e.fill(),e.strokeStyle="rgba(255,255,255,0.16)",e.lineWidth=1,e.stroke(),e.shadowBlur=0,m(e,r.x,r.y,.42*n,a.sides,a.rotation+.4*a.spin),e.fillStyle=a.glow,e.fill();let o=2.2*n,s=r.x-o/2,d=r.y+n+6,c=i(a.hp/a.maxHp,0,1);f(e,s,d,o,5,3,"rgba(15,23,42,0.64)"),f(e,s,d,Math.max(10,o*c),5,3,c>.5?"rgba(74, 222, 128, 0.94)":"rgba(248, 113, 113, 0.94)"),e.fillStyle="rgba(226, 232, 240, 0.84)",e.font="600 9px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="center",e.textBaseline="bottom",e.fillText(a.name.toUpperCase(),r.x,r.y-n-4),e.restore()})(n,j.boardInner,e)),a.current.enemyProjectiles.forEach(e=>(function(e,t,a){let r=g(t,{x:a.x,y:a.y}),n=g(t,{x:a.prevX,y:a.prevY}),l=i(t.scale*a.radius,3,7);e.save(),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(r.x,r.y),e.strokeStyle=a.color,e.lineWidth=Math.max(2,l),e.lineCap="round",e.stroke(),e.beginPath(),e.arc(r.x,r.y,l,0,2*Math.PI),e.fillStyle=a.color,e.shadowColor=a.color,e.shadowBlur=10,e.fill(),e.restore()})(n,j.boardInner,e)),a.current.projectiles.forEach(e=>{e.delay<=0&&function(e,t,a){let r=g(t,{x:a.x,y:a.y}),n=g(t,{x:a.prevX,y:a.prevY}),l=i(t.scale*a.radius,2.5,6.5);e.save(),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(r.x,r.y),e.strokeStyle=a.color,e.lineWidth=Math.max(2,l),e.lineCap="round",e.stroke(),e.beginPath(),e.arc(r.x,r.y,l,0,2*Math.PI),e.fillStyle="#fff",e.shadowColor=a.color,e.shadowBlur=12,e.fill(),e.restore()}(n,j.boardInner,e)}),function(e,t){let a=g(t,o.hero),r=i(52*t.scale,32,46),n=i(64*t.scale,42,58),l=i(14*t.scale,10,14);e.save(),e.shadowColor="rgba(34, 211, 238, 0.4)",e.shadowBlur=18,e.beginPath(),e.arc(a.x,a.y-.8*n,l,0,2*Math.PI),e.fillStyle="#e2e8f0",e.fill(),e.shadowBlur=0,f(e,a.x-r/2,a.y-n/2,r,n,18,"rgba(15,23,42,0.95)",{color:"rgba(56,189,248,0.24)",blur:10,offsetY:1}),e.fillStyle="rgba(96, 165, 250, 0.9)",e.fillRect(a.x-4,a.y-n/2+8,8,n-16),e.strokeStyle="rgba(255,255,255,0.8)",e.lineWidth=4,e.lineCap="round",e.beginPath(),e.moveTo(a.x+8,a.y-10),e.lineTo(a.x+28,a.y-18),e.stroke(),e.beginPath(),e.arc(a.x+30,a.y-19,4,0,2*Math.PI),e.fillStyle="#fff",e.fill(),e.restore()}(n,j.boardInner),function(e,t,a){let r=g(a,{x:0,y:o.wall.y}),n=o.wall.height*a.scale,l=a.w,s=i(t.wallHp/t.wallMaxHp,0,1);e.save(),f(e,r.x,r.y,l,n,20,"rgba(15, 23, 42, 0.95)",{color:"rgba(56, 189, 248, 0.10)",blur:12,offsetY:1}),p(e,r.x,r.y,l,n,20,"rgba(255,255,255,0.08)",1);let d=l/8;for(let t=0;t<8;t+=1){let a=r.x+t*d;f(e,a+2,r.y+8,d-4,n-16,16,"rgba(30,41,59,0.72)"),e.strokeStyle="rgba(148, 163, 184, 0.12)",e.strokeRect(a+2,r.y+8,d-4,n-16)}f(e,r.x+18,r.y+16,Math.max(8,(l-36)*s),10,5,s>.65?"rgba(15, 118, 110, 0.92)":s>.35?"rgba(234, 179, 8, 0.92)":"rgba(239, 68, 68, 0.92)"),e.fillStyle="rgba(226, 232, 240, 0.78)",e.font="600 11px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.textAlign="left",e.textBaseline="top",e.fillText("Wall HP ".concat(Math.max(0,Math.round(t.wallHp)),"/").concat(t.wallMaxHp),r.x+18,r.y+32),e.fillText("".concat(o.ui.shieldLabel," ").concat(t.wallDefense),r.x+18,r.y+48),s<.45&&(e.fillStyle="rgba(248, 113, 113, 0.18)",e.fillRect(r.x,r.y,l,n)),e.restore(
1)}(n,a.current,j.boardInner),function(e,t,a){if(!t.choice)return;let r=v(a),n=r.panel,l=r.cards;e.save(),e.fillStyle="rgba(2, 6, 23, 0.62)",e.fillRect(a.boardInner.x,a.boardInner.y,a.boardInner.w,a.boardInner.h),f(e,n.x,n.y,n.w,n.h,24,"rgba(15, 23, 42, 0.96)",{color:"rgba(56, 189, 248, 0.18)",blur:18,offsetY:2}),p(e,n.x,n.y,n.w,n.h,24,"rgba(255,255,255,0.12)",1),e.fillStyle="#fff",e.textAlign="center",e.textBaseline="top",e.font="800 22px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText("Level Up",n.x+n.w/2,n.y+18),e.fillStyle="rgba(226, 232, 240, 0.82)",e.font="500 12px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText("Choose one of three weapon upgrades",n.x+n.w/2,n.y+44),t.choice.cards.forEach((t,a)=>{let r=l[a];r&&(f(e,r.x,r.y,r.w,r.h,18,"rgba(30, 41, 59, 0.96)",{color:t.accent,blur:12,offsetY:1}),p(e,r.x,r.y,r.w,r.h,18,"rgba(255,255,255,0.10)",1),e.fillStyle=t.accent,e.fillRect(r.x+14,r.y+14,4,r.h-28),e.fillStyle="#fff",e.textAlign="left",e.textBaseline="top",e.font="800 16px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText(t.title,r.x+24,r.y+16),e.fillStyle="rgba(226, 232, 240, 0.9)",e.font="500 12px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",y(e,t.summary,r.w-42).slice(0,2).forEach((t,a)=>{e.fillText(t,r.x+24,r.y+42+15*a)}),e.fillStyle="rgba(148, 163, 184, 0.9)",e.font="500 11px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",y(e,t.detail,r.w-42).slice(0,2).forEach((t,a)=>{e.fillText(t,r.x+24,r.y+r.h-36+14*a)}))}),e.restore()}(n,a.current,j),function(e,t,a){if(!t.gameOver)return;let r=Math.min(460,a.boardInner.w-32),n={x:a.boardInner.x+(a.boardInner.w-r)/2,y:a.boardInner.y+.24*a.boardInner.h,w:r,h:230},l={x:n.x+24,y:n.y+n.h-68,w:n.w-48,h:44};e.save(),e.fillStyle="rgba(2, 6, 23, 0.72)",e.fillRect(a.boardInner.x,a.boardInner.y,a.boardInner.w,a.boardInner.h),f(e,n.x,n.y,n.w,n.h,24,"rgba(15, 23, 42, 0.96)",{color:"rgba(248, 113, 113, 0.18)",blur:18,offsetY:2}),p(e,n.x,n.y,n.w,n.h,24,"rgba(255,255,255,0.12)",1),e.fillStyle="#fff",e.textAlign="center",e.textBaseline="top",e.font="800 24px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText("The wall has fallen",n.x+n.w/2,n.y+22),e.fillStyle="rgba(226, 232, 240, 0.82)",e.font="500 13px ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif",e.fillText("Wave ".concat(t.wave," \xb7 Level ").concat(t.level," \xb7 Score ").concat(t.score),n.x+n.w/2,n.y+56),e.fillText("Restart to try a different upgrade path.",n.x+n.w/2,n.y+80),b(e,l,"Restart run","New attempt","primary",!0),e.restore()}(n,a.current,j),l=requestAnimationFrame(h)};return l=requestAnimationFrame(h),()=>cancelAnimationFrame(l)},[B.width,B.height,R,E]);let H=(0,r.jsxs)("div",{ref:e,className:R?"fixed inset-0 z-[80] overflow-hidden rounded-none bg-slate-950 shadow-2xl shadow-slate-900/15 outline-none":"relative w-full overflow-hidden rounded-[1.75rem] border border-slate-200 bg-slate-950 shadow-2xl shadow-slate-900/15 outline-none",style:{height:R?"var(--vertical-defense-viewport-height, 100dvh)":"clamp(820px, 94dvh, 1180px)"},children:[(0,r.jsx)("canvas",{ref:t,tabIndex:0,"aria-label":"Vertical defense game canvas","aria-describedby":"vertical-defense-help",className:"block h-full w-full touch-manipulation",style:{touchAction:R?"none":"manipulation"},onPointerDown:e=>{let r=t.current;if(!r||!C.current.width||!C.current.height)return;let n=r.getBoundingClientRect(),l=(e.clientX-n.left)/n.width*C.current.width,o=(e.clientY-n.top)/n.height*C.current.height,i=w(C.current.width,C.current.height),s={x:l,y:o},c=a.current;if(c.choice){v(i).cards.forEach((e,t)=>{if(M(s,e)){var a;a=c.choice.cards[t],c.choice&&(a.apply(),c.choice=null,c.message="".concat(a.title," selected."),c.messageTimer=1.5,c.exp>=c.xpToNext&&(c.level+=1,c.xpToNext=d(c.level),T(c))),F(e=>e+1)}}),r.focus();return}if(c.gameOver){M(s,{x:i.boardInner.x+24,y:i.boardInner.y+.24*i.boardInner.h+162,w:Math.min(460,i.boardInner.w-32)-48,h:44})&&I(a,F),r.focus();return}for(let[e,t]of Object.entries(i.buttons))if(M(s,t)){"restart"===e&&I(a,F),"expand"===e&&j(!R),r.focus();return}r.focus()},onKeyDown:e=>{if("r"===e.key||"R"===e.key){e.preventDefault(),I(a,F);return}if("f"===e.key||"F"===e.key){e.preventDefault(),j(!R);return}"Escape"===e.key&&R&&j(!1)}}),(0,r.jsx)("p",{id:"vertical-defense-help",className:"sr-only",children:"Defend the wall against enemies falling from the top. When you level up, choose one of three weapon upgrades. Use Restart to begin again, and Expand to fill the screen."})]});return R&&"undefined"!=typeof document?(0,n.createPortal)(H,document.body):H}}},e=>{e.O(0,[533,186,262,732,299,689,359,324,724,358],()=>e(e.s=6102)),_N_E=e.O()}]);
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.