1import{r as u,j as i}from"./vendor-react-COL_fmx_.js";import{f as vt,a as Ut,s as $t,c as Ht,A as le,b as Kt,w as zt,d as Jt,e as Qt,g as xt,h as Zt,i as en,j as tn,k as _e,l as nn}from"./ArcadeWalletLockNotice-fTzDr8FC.js";import{aE as rn}from"./index-Cc-3hq20.js";import"./suiGrpcFailover-BjN35zYs.js";import"./vendor-three-CoHYrz5L.js";function Be(e){switch(e){case"ready":return"ready";case"dying":return"dying";case"dead":return"dead";default:return"playing"}}const ye=2,an=4e3,on=1,ln=2,g=787,R=1198,we=g/2,sn=120,cn=we,q=132,X=66,Ye=900,ie=28,rt=24,dn=R+X,Xe=.62,We=1900,kt=1500,je=1/240,fn=.05,at=.16,un=.72,pn=.36,St=.5,Rt=.22,Tt=700,wt=1.6,mn=.09,hn=12,ot=.12,gn=.18,de=.45,bn=.7,Ge=.8,Ee=.45,yn=.15,Ke=4.2,vn=.55,kn=1.1,Sn=.4,Rn=.1,Tn=.6,lt=.3,wn="ef.foamdrop.best.",Ue='"IBM Plex Mono", ui-monospace, monospace',ue='"Chakra Petch", system-ui, sans-serif',c={voidTop:"#0a0b0d",voidMid:"#07080a",voidBottom:"#050506",farWall:"#101215",farWallRib:"#14171b",lampWarm:"rgba(255,216,160,0.055)",lampCool:"rgba(190,214,255,0.040)",girder:"#15181c",girderEdge:"#1d2126",crossBrace:"#13161a",nearFrame:"#0c0e11",nearFrameRim:"#2a2318",railFlangeTop:"#22262b",railHighlight:"#343a41",railWeb:"#171a1e",railFlangeBottom:"#2a2f35",railBolt:"#3c4249",trolley:"#2e3339",trolleyHighlight:"#454b53",trolleyVent:"#171a1e",hook:"#3a4046",hookHighlight:"#565d66",cable:"#2a2e33",cableHighlight:"#4a5158",foamFrontLight:"#e4dcc6",foamFrontMid:"#cfc5ab",foamFrontDark:"#bdb398",foamTopLight:"#f0e9d6",foamTopDark:"#e2dac4",foamCheek:"#a79e86",foamOutline:"#7c7461",foamSeam:"#fbf6e8",foamBottomEdge:"#8e856e",foamStud:"#d8d0b8",foamStudShade:"#c2b9a0",foamStudTop:"#e9e1cc",deckSlabLight:"#3a3e44",deckSlabDark:"#262a2f",deckTopBand:"#474c53",deckHighlight:"#5a6068",deckPost:"#171a1e",deckPostDark:"#0d0f12",hazard:"#c8a233",hazardDark:"#1c1f23",deckDatum:"#7c838c",deckBolt:"#4e545b",pitVoid:"#040405",pitHaze:"rgba(74,68,58,0.13)",grateLip:"#1a1d21",grateHighlight:"#2c3138",dust:"#8c8371",dustLight:"#a9a08a",debris:"#b4ab93",score:"#ffffff",hudDim:"rgba(255,255,255,0.45)",popup:"#f2eddf",edgeWord:"#d8b04a",perfectWord:"#efe7d2"},En=1207,Pn=90,An=24;function ze(e){let t=e|0;return{next(){t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296},getState(){return t>>>0},setState(n){t=n|0}}}function se(e,t,n){return e+(t-e)*n}function ne(e,t){return Math.max(0,Math.min(e/t,1))}const Cn=4.2,Mn=150;function me(e){const t=se(.55,.95,ne(e,24));let n=se(2.6,3.35,ne(e,30));e>30&&(n=Math.min(n+.1*Math.floor((e-30)/6),Cn));const a=se(300,250,ne(e,20)),r=e<12?0:90*ne(e-12,18),l=Math.max(se(300,150,ne(e,26)),Mn);let s=se(120,270,ne(e,22));e>26&&(s=Math.min(s+8*Math.floor((e-26)/8),300));const f=e<10?0:e<20?20:40;return{amplitude:t,omega:n,cableLength:a,pivotTravel:r,platformWidth:l,xOffsetMax:s,vJitterMax:f}}function Nn(e,t){const n=t/2+rt,a=g-t/2-rt;return Math.min(Math.max(e,n),a)}function Je(e,t){const n=t.amplitude*Math.cos(t.omega*e),a=-t.amplitude*t.omega*Math.sin(t.omega*e),r=cn+t.pivotTravel*Math.sin(Xe*e);return{theta:n,thetaDot:a,pivotX:r,blockX:r+t.cableLength*Math.sin(n),blockY:sn+t.cableLength*Math.cos(n)}}function Ln(e,t){const n=Je(e,t),a=t.pivotTravel*Xe*Math.cos(Xe*e);let r=t.cableLength*n.thetaDot*Math.cos(n.theta)+a,l=-t.cableLength*n.thetaDot*Math.sin(n.theta);return Math.abs(r)<1&&(r=0),Math.abs(l)<1&&(l=0),{x:n.blockX,y:n.blockY,vx:r,vy:l}}function In(e,t,n){const a=me(t),r=(e.next()*2-1)*a.xOffsetMax;let l=we+r;Math.abs(l-n)<90&&(l=we-r),Math.abs(l-n)<90&&(l=n+(r>=0?90:-90)),l=Nn(l,a.platformWidth);let s=Ye;if(a.vJitterMax===0)e.next();else{const f=2*a.vJitterMax/20+1;s=Ye+(Math.floor(e.next()*f)*20-a.vJitterMax)}return{x:l,topY:s,width:a.platformWidth}}function it(){const e=me(0);return{x:we,topY:Ye,width:e.platformWidth}}function Qe(e,t){const n=q/2,a=t.width/2,r=Math.min(e+n,t.x+a)-Math.max(e-n,t.x-a);return Math.max(r,0)/q}function Fn(e){return e>=un?"clean":e>=pn?"teeter":"miss"}function _n(e,t){const n=Math.min(Math.max(Math.abs(t)/Tt,0),wt);return e-Rt*n>=St}function jn(e){const t=Math.min(Math.max(Math.abs(e)/Tt,0),wt);return St+Rt*t}function Et(e){return Math.min(mn*e,hn)}function qn(e,t){return Math.abs(e-t.x)<=Et(t.width)}function Se(e,t,n,a){return{contactX:e,platX:n.x,platWidth:n.width,supportFraction:Qe(e,n),vx:t,neededFraction:jn(t),outcome:a}}function Vn(e){return Number.isFinite(e)?Math.min(Math.max(e,0),fn):0}function Y(e,t,n){const a=Be(e.phase);e.phase=t,e.phaseElapsed=0;const r=Be(t);a!==r&&n.onPhaseChange?.(r)}function st(e,t,n){if(e.landingScored)return;e.landingScored=!0,e.landings+=1,t?(e.perfectStreak+=1,e.bestPerfectStreak=Math.max(e.bestPerfectStreak,e.perfectStreak)):e.perfectStreak=0;const a=Math.min(t?ln:on,an-e.score);a<=0||(e.score+=a,n.onScoreChange?.(e.score),n.onEvent?.({type:"score",value:e.score,delta:a,perfect:t,streak:e.perfectStreak}))}function ct(e){e.resetFrom={...e.platform},e.prevPlatX=e.platform.x,e.platform=In(e.rng,e.landings,e.prevPlatX),e.landingScored=!1}function On(e,t){const n=Qe(e.blockX,e.platform),a=Fn(n);if(a==="clean"){const r=qn(e.blockX,e.platform);e.contactRecord=Se(e.blockX,e.blockVx,e.platform,r?"perfect":"clean"),t.onEvent?.({type:"impact",x:e.blockX,y:e.blockY,vy:e.blockVy,quality:r?"perfect":"clean",supp
1ortFraction:n}),Y(e,"landing",t);return}if(a==="teeter"){e.teeterWillSettle=_n(n,e.blockVx),e.tipSide=e.blockX<e.platform.x?-1:1,e.contactRecord=Se(e.blockX,e.blockVx,e.platform,e.teeterWillSettle?"settled":"tipped"),t.onEvent?.({type:"impact",x:e.blockX,y:e.blockY,vy:e.blockVy,quality:"teeter",supportFraction:n}),t.onEvent?.({type:"teeterStart"}),Y(e,"teetering",t);return}e.tipSide=e.blockX<e.platform.x?-1:1,e.contactRecord=Se(e.blockX,e.blockVx,e.platform,"tipped"),e.blockVy=0,e.blockVx=e.tipSide*60,t.onEvent?.({type:"tip"}),Y(e,"dying",t)}function Dn(e,t,n){e.airTime+=t;const a=Math.min(Math.max(e.blockVx/2600,-at),at);e.blockRot=a*Math.min(1,e.airTime/.35),e.fallAccumulator+=t;const r=e.platform.topY-X/2;for(;e.fallAccumulator>=je;){e.fallAccumulator-=je;const l=je,s=e.blockVy,f=Math.min(s+We*l,kt),m=e.blockY+f*l,o=e.blockX+e.blockVx*l;if(e.blockY<r&&m>=r&&f>0){const h=(r-e.blockY)/(m-e.blockY),v=e.blockX+e.blockVx*l*h,b=s+We*l*h;if(e.blockX=v,e.blockY=r,e.blockVy=b,Qe(v,e.platform)>0){e.fallAccumulator=0,On(e,n);return}e.contactRecord=Se(v,e.blockVx,e.platform,"pit"),e.blockVy=b,e.blockX=o,e.blockY=m,n.onEvent?.({type:"pit"}),e.fallAccumulator=0,Y(e,"dying",n);return}e.blockVy=f,e.blockX=o,e.blockY=m}}function Bn(e,t,n){if(e.phaseElapsed+=t,e.contactRecord?.outcome==="tipped"&&(e.blockRot+=e.tipSide*Ke*t),e.blockVy=Math.min(e.blockVy+We*t,kt),e.blockX+=e.blockVx*t,e.blockY+=e.blockVy*t,e.blockY>dn&&e.phaseElapsed>
1=vn||e.phaseElapsed>=kn){const l=Math.max(e.score,e.bestScore);e.bestScore=l,n.onBestScore?.(l,e.mode),n.onEvent?.({type:"dead"}),Y(e,"dead",n),n.onGameOver?.(e.score,l)}}function Yn(e,t,n,a={}){if(e.elapsed+=t,e.phase==="ready"||e.phase==="swinging"){if(e.swingTime+=t,e.armLockRemaining>0&&(e.armLockRemaining=Math.max(0,e.armLockRemaining-t)),n.pendingRelease&&(n.pendingRelease=!1,!e.attract&&e.armLockRemaining<=0)){a.onAudioResume?.();const r=me(e.landings),l=Ln(e.swingTime,r);e.blockX=l.x,e.blockY=l.y,e.blockVx=l.vx,e.blockVy=l.vy,e.airTime=0,e.fallAccumulator=0,e.blockRot=0,a.onEvent?.({type:"release"}),Y(e,"falling",a)}return}if(n.pendingRelease=!1,e.phase==="falling"){Dn(e,t,a);return}if(e.phase==="landing"){e.phaseElapsed+=t,e.blockRot*=Math.max(0,1-t/.12),e.phaseElapsed>=ot&&!e.landingScored&&st(e,e.contactRecord?.outcome==="perfect",a),e.phaseElapsed>=ot+gn&&(ct(e),Y(e,"resetting",a));return}if(e.phase==="teetering"){e.phaseElapsed+=t,e.teeterWillSettle?e.phaseElapsed>=bn&&(st(e,!1,a),a.onEvent?.({type:"settle"}),e.blockRot=0,ct(e),Y(e,"resetting",a)):e.phaseElapsed>=Ge&&(e.blockVx=e.tipSide*60,e.blockVy=0,e.blockRot=e.tipSide*Ke*(Ge-de),a.onEvent?.({type:"tip"}),Y(e,"dying",a));return}if(e.phase==="resetting"){if(e.phaseElapsed+=t,e.swingTime=Math.max(0,e.phaseElapsed-yn),e.phaseElapsed>=Ee){e.armLockRemaining=Rn,e.resetFrom=null;const r=e.swingTime;Y(e,"swinging",a),e.swingTime=r}return}if(e.phase==="dying"){Bn(e,t,a);return}}function Re(e,t,n=!1){return{phase:"ready",mode:"ranked",attract:n,score:0,landings:0,bestScore:t,swingTime:0,armLockRemaining:Sn,blockX:0,blockY:0,blockVx:0,blockVy:0,blockRot:0,airTime:0,fallAccumulator:0,platform:it(),prevPlatX:it().x,resetFrom:null,phaseElapsed:0,teeterWillSettle:!1,tipSide:1,contactRecord:null,perfectStreak:0,bestPerfectStreak:0,landingScored:!1,rng:ze(e),seed:e,reviveCount:0,runLog:[],elapsed:0}}function Xn(e){return e.phase!=="dead"?!1:(e.reviveCount+=1,e.runLog.push({type:"revive",reviveNo:e.reviveCount,scoreAtRevive:e.score}),e.phase="swinging",e.swingTime=0,e.armLockRemaining=Tn,e.blockVx=0,e.blockVy=0,e.blockRot=0,e.airTime=0,e.fallAccumulator=0,e.resetFrom=null,e.phaseElapsed=0,e.teeterWillSettle=!1,e.contactRecord=null,e.perfectStreak=0,e.landingScored=!1,!0)}function Pe(e){return{x:e.x,topY:e.topY,width:e.width}}function Wn(e){return{v:2,mode:e.mode,seed:e.seed,score:e.score,landings:e.landings,reviveCount:e.reviveCount,rngState:e.rng.getState(),runLog:e.runLog.map(t=>({...t})),phase:e.phase,swingTime:e.swingTime,armLockRemaining:e.armLockRemaining,blockX:e.blockX,blockY:e.blockY,blockVx:e.blockVx,blockVy:e.blockVy,blockRot:e.blockRot,airTime:e.airTime,platform:Pe(e.platform),prevPlatX:e.prevPlatX,resetFrom:e.resetFrom?Pe(e.resetFrom):null,phaseElapsed:e.phaseElapsed,teeterWillSettle:e.teeterWillSettle,tipSide:e.tipSide,contactRecord:e.contactRecord?{...e.contactRecord}:null,perfectStreak:e.perfectStreak,bestPerfectStreak:e.bestPerfectStreak,landingScored:e.landingScored,elapsed:e.elapsed}}function Gn(e,t){const n=Re(e.seed,t);return n.mode=e.mode,n.score=e.score,n.landings=e.landings,n.reviveCount=e.reviveCount,n.rng.setState(e.rngState),n.runLog=e.runLog.map(a=>({...a})),n.phase=e.phase,n.swingTime=e.swingTime,n.armLockRemaining=e.armLockRemaining,n.blockX=e.blockX,n.blockY=e.blockY,n.blockVx=e.blockVx,n.blockVy=e.blockVy,n.blockRot=e.blockRot,n.airTime=e.airTime,n.platform=Pe(e.platform),n.prevPlatX=e.prevPlatX,n.resetFrom=e.resetFrom?Pe(e.resetFrom):null,n.phaseElapsed=e.phaseElapsed,n.teeterWillSettle=e.teeterWillSettle,n.tipSide=e.tipSide,n.contactRecord=e.contactRecord?{...e.contactRecord}:null,n.perfectStreak=e.perfectStreak,n.bestPerfectStreak=e.bestPerfectStreak,n.landingScored=e.landingScored,n.elapsed=e.elapsed,n.fallAccumulator=0,n}function Un(e){if(!e||typeof e!="object")return!1;const t=e;return t.v===2&&typeof t.seed=="number"&&typeof t.score=="number"&&typeof t.landings=="number"&&typeof t.reviveCount=="number"&&Array.isArray(t.runLog)&&t.mode==="ranked"&&typeof t.rngState=="number"&&typeof t.phase=="string"&&typeof t.platform=="object"&&t.platform!==null}const $n=new Set(["Space","ArrowDown","Enter"]);function Hn(e){const t={pendingRelease:!1},n=()=>{t.pendingRelease=!0},a=l=>{l.preventDefault(),t.pendingRelease=!0},r=l=>
1{$n.has(l.code)&&(l.preventDefault(),!l.repeat&&(t.pendingRelease=!0))};return e.addEventListener("pointerdown",n),e.addEventListener("touchstart",a,{passive:!1}),e.addEventListener("keydown",r),{state:t,cleanup(){e.removeEventListener("pointerdown",n),e.removeEventListener("touchstart",a),e.removeEventListener("keydown",r)}}}function Pt(e){return`${wn}${e}`}function fe(e){try{const t=localStorage.getItem(Pt(e)),n=t===null?0:Number(t);return Number.isFinite(n)&&n>0?Math.floor(n):0}catch{return 0}}function Kn(e,t){try{const n=fe(t);e>n&&localStorage.setItem(Pt(t),String(e))}catch{}}const At="ef.foamdrop.sound.v1",Ct=.7;let F=null,qe=!1,V=null,pe=null,Te=!1,dt=!1;function he(){if(!dt){dt=!0;try{Te=localStorage.getItem(At)==="off"}catch{Te=!1}}return Te}function zn(){return he()}function Jn(e){he(),Te=e;try{localStorage.setItem(At,e?"off":"on")}catch{}V&&F&&(V.gain.cancelScheduledValues(F.currentTime),V.gain.setValueAtTime(V.gain.value,F.currentTime),V.gain.linearRampToValueAtTime(e?0:Ct,F.currentTime+.06))}function xe(){if(qe)return null;if(F)return F;try{const e=window.AudioContext??window.webkitAudioContext;if(!e)return qe=!0,null;F=new e,V=F.createGain(),V.gain.value=he()?0:Ct,V.connect(F.destination);const t=F.sampleRate;pe=F.createBuffer(1,t,F.sampleRate);const n=pe.getChannelData(0);for(let a=0;a<t;a++)n[a]=Math.random()*2-1;return F}catch{return qe=!0,null}}function Qn(){const e=xe();e&&e.state==="suspended"&&e.resume().catch(()=>{})}function w(e){const t=xe();if(!(!t||!V||he()))try{const n=t.currentTime+(e.at??0),a=t.createOscillator();if(a.type=e.type,a.frequency.setValueAtTime(e.freq,n),e.detune&&a.detune.setValueAtTime(e.detune,n),e.freqTo!==void 0){const f=n+(e.freqRampAt??e.decay);e.linearFreq?a.frequency.linearRampToValueAtTime(e.freqTo,f):a.frequency.exponentialRampToValueAtTime(Math.max(e.freqTo,1),f)}const r=t.createGain(),l=e.attack??.003;r.gain.setValueAtTime(1e-4,n),r.gain.linearRampToValueAtTime(e.gain,n+l),r.gain.exponentialRampToValueAtTime(.001,n+e.decay);let s=a;if(e.filter){const f=t.createBiquadFilter();f.type=e.filter.type,f.frequency.setValueAtTime(e.filter.freq,n),e.filter.freqTo!==void 0&&f.frequency.linearRampToValueAtTime(e.filter.freqTo,n+(e.filter.rampBy??e.decay)),e.filter.q&&f.Q.setValueAtTime(e.filter.q,n),s.connect(f),s=f}s.connect(r),r.connect(V),a.start(n),a.stop(n+e.decay+.05)}catch{}}function $(e){const t=xe();if(!(!t||!V||!pe||he()))try{const n=t.currentTime+(e.at??0),a=t.createBufferSource();a.buffer=pe;const r=Math.random()*Math.max(0,pe.duration-e.decay-.05),l=t.createBiquadFilter();l.type=e.filter.type,l.frequency.setValueAtTime(e.filter.freq,n),e.filter.freqTo!==void 0&&l.frequency.linearRampToValueAtTime(e.filter.freqTo,n+(e.filter.rampBy??e.decay)),e.filter.q&&l.Q.setValueAtTime(e.filter.q,n);const s=t.createGain();s.gain.setValueAtTime(1e-4,n),s.gain.linearRampToValueAtTime(e.gain*(e.scale??1),n+(e.attack??.004)),s.gain.exponentialRampToValueAtTime(.001,n+e.decay),a.connect(l),l.connect(s),s.connect(V),a.start(n,r,e.decay+.05)}catch{}}function xn(){w({type:"square",freq:900,freqTo:480,freqRampAt:.045,gain:.055,decay:.05}),$({gain:.045,decay:.035,filter:{type:"bandpass",freq:2600,q:2.2}}),w({type:"triangle",freq:240,freqTo:190,linearFreq:!0,gain:.018,decay:.14})}function Mt(e,t){const n=e==="perfect"?1.06:e==="teeter"?.86:1,a=Math.min(78+t*1.6,108),r=Math.max(.34-t*.006,.2),l=e==="perfect"?4:e==="teeter"?-5:0;w({type:"sine",freq:a,freqTo:38,freqRampAt:.22,gain:r*n,decay:.34}),w({type:"triangle",freq:196*(1+l/100),freqTo:122,freqRampAt:.09,gain:.12*n,decay:.13,filter:{type:"lowpass",freq:1400,q:1.1}}),w({type:"triangle",freq:233*(1+l/100),freqTo:145,freqRampAt:.09,gain:.12*n,decay:.13,filter:{type:"lowpass",freq:1400,q:1.1}}),$({gain:.16*n,decay:.2,scale:.55,filter:{type:"lowpass",freq:2200,freqTo:380,rampBy:.16,q:.8}})}function Zn(e){const t=Math.min(Math.max(e,1),4)-1,n=Math.pow(2,t*2/12),a=e>4?.09:0;w({type:"sine",freq:784*n,gain:.09,attack:.006,decay:.16+a,at:.035,filter:{type:"lowpass",freq:5200,q:.7}}),w({type:"sine",freq:1175*n,gain:.072,attack:.006,decay:.26+a,at:.11,filter:{type:"lowpass",freq:5200,q:.7}}),w({type:"sine",freq:1568*n,gain:t>=2?.052:.038,attack:.006,decay:.2+a,at:.185,filter:{type:"lowpass",freq:5200,q:.7}}),w({type:"sine",freq:132,freqTo:66,freqRampAt:.18,gain:.055,attack:.012,decay:.22,at:.045,filter:{type:"lowpass",freq:400,q:.7}}),$({gain:.016,decay:.045,at:.035,scale:.8,filter:{type:"bandpass",freq:5200,q:3.5}})}function er(){w({type:"sawtooth",freq:142,freqTo:148,linearFreq:!0,gain:.03,attack:.05,decay:.5,filter:{type:"bandpass",freq:380,q:11}}),$({gain:.02,decay:.02,at:.22,filter:{type:"highpass",freq:2400}}),$({gain:.014,decay:.02,at:.38,filter:{type:"highpass",freq:2400}})}function tr(e){Mt("clean",e)}function nr(){w({type:"sawtooth",freq:120,freqTo:44,linearFreq:!0,freqRampAt:.55,gain:.13,attack:.04,decay:.62,filter:{type:"lowpass",freq:700,freqTo:220,rampBy:.55,q:1.4}}),$({gain:.055,decay:.35,filter:{type:"bandpass",freq:900,freqTo:300,rampBy:.35,q:3.5}}),Nt(.55)}function rr(){w({type:"sine",freq:200,freqTo:60,freqRampAt:.5,gain:.09,decay:.5}),Nt(.35)}function Nt(e){$({gain:.038,attack:.25,decay:.9,at:e,filter:{type:"lowpass",freq:300}}),w({type:"sine",freq:31,gain:.09,decay:.7,at:e})}function ar(e){const t=1320*Math.pow(1.06,Math.min(e,6));w({type:"square",freq:t,gain:.022,attack:.002,decay:.035,at:.09,filter:{type:"lowpass",freq:3600}})}function or(){$({gain:.05,decay:.03,filter:{type:"bandpass",freq:1500,q:3}}),w({type:"triangle",freq:90,freqTo:300,linearFreq:!0,freqRampAt:.4,gain:.055,attack:.06,decay:.46,filter:{type:"lowpass",freq:1200}}),w({type:"sine",freq:660,gain:.05,decay:.14,at:.42})}function lr(){w({type:"sine",freq:523,gain:.06,attack:.008,decay:.3,filter:{type:"lowpass",freq:6e3,q:.7}}),w({type:"sine",freq:659,gain:.06,attack:.008,decay:.3,at:.09,filter:{type:"lowpass",freq:6e3,q:.7}}),w({type:"sine",freq:880,gain:.06,attack:.008,decay:.3,at:.18,filter:{type:"lowpass",freq:6e3,q:.7}}),$({gain:.03,decay:.05,at:.18,filter:{type:"bandpass",freq:900,q:2}})}const Lt=1.2,$e=.72,ft=34,ir=.42,ut=.16,sr=.14,Ae=()=>Math.random(),U=(e,t)=>e+Ae()*t;function ve(e){return{particles:[],popups:[],shakeAmp:0,shakeAge:1,shakeX:0,shakeY:0,thu
1nkAmp:0,thunkAge:1,scorePopAge:1,streakPulseAge:1,reducedMotion:e,frame:0}}function cr(e){return e.reducedMotion?An:Pn}function It(e,t){e.particles.length>=cr(e)&&e.particles.shift(),e.particles.push(t)}function Ve(e,t,n,a,r=0){for(let l=0;l<a;l++)It(e,{x:U(t-8,16),y:U(n-4,8),vx:r+U(-95,190),vy:-U(40,80),r:U(2.5,4.5),growth:9,life:U(.42,.2),age:0,kind:"dust",light:Ae()>.7})}function dr(e,t,n,a){if(!e.reducedMotion)for(let r=0;r<a;r++)It(e,{x:U(t-20,40),y:n,vx:U(-120,240),vy:-U(60,140),r:2,growth:0,life:.5,age:0,kind:"debris",light:!1})}function Oe(e,t){e.reducedMotion||(e.shakeAmp=Math.max(e.shakeAmp,t),e.shakeAge=0)}function pt(e){for(const t of e.popups)t.age=Math.max(t.age,$e)}function fr(e,t,n){switch(t.type){case"impact":{pt(e);const a=Math.min(Math.max(Math.abs(t.vy)/1400,0),1),r=Math.round(6+10*a),l=t.supportFraction*q/2;Ve(e,t.x-l,t.y+30,r),Ve(e,t.x+l,t.y+30,r),dr(e,t.x,t.y+30,5),Oe(e,t.quality==="perfect"?3:t.quality==="clean"?2.2:1.4),e.thunkAmp=5+5*a,e.thunkAge=0;break}case"score":{pt(e),e.popups.push({x:0,y:0,text:`+${t.delta}`,word:t.perfect?"PERFECT":null,age:0}),e.popups.length>2&&e.popups.shift(),e.scorePopAge=0,t.perfect&&(e.streakPulseAge=0);break}case"tip":Oe(e,1);break;case"settle":Oe(e,1.8),Ve(e,0,n+30,6);break}}function ur(e,t,n,a){const r=e.popups[e.popups.length-1];r&&r.age===0&&(r.x=t,r.y=n,a&&(r.word=a))}function pr(e,t){e.frame+=1;for(let n=e.particles.length-1;n>=0;n--){const a=e.particles[n];if(a.age+=t,a.age>=a.life){e.particles.splice(n,1);continue}const r=a.kind==="debris"?900:320;if(a.vy+=r*t,a.kind==="dust"){const l=Math.pow(.92,t*60);a.vx*=l,a.vy*=l}a.x+=a.vx*t,a.y+=a.vy*t,a.r+=a.growth*t}for(let n=e.popups.length-1;n>=0;n--)e.popups[n].age+=t,e.popups[n].age>Lt&&e.popups.splice(n,1);if(e.shakeAge<.22){e.shakeAge+=t;const n=e.shakeAmp*Math.exp(-e.shakeAge/.09);e.frame%2===0&&(e.shakeX=Math.round(n*(Ae()*2-1)),e.shakeY=Math.round(n*(Ae()*2-1)*.6)),e.shakeAge>=.22&&(e.shakeAmp=0,e.shakeX=0,e.shakeY=0)}else e.shakeX=0,e.shakeY=0;e.thunkAge<.3&&(e.thunkAge+=t),e.scorePopAge<.2&&(e.scorePopAge+=t),e.streakPulseAge<.18&&(e.streakPulseAge+=t)}function mr(e){return e.thunkAge>=.3?0:e.thunkAmp*Math.exp(-e.thunkAge/.07)*Math.cos(2*Math.PI*9*e.thunkAge)}function hr(e){if(e.scorePopAge>=.2)return 1;const t=e.scorePopAge/.2;return 1+.18*Math.sin(Math.PI*t)}function gr(){if(typeof document>"u")return null;const e=document.createElement("canvas");e.width=g,e.height=R;const t=e.getContext("2d");if(!t)return null;const n=t.createLinearGradient(0,0,0,R);n.addColorStop(0,c.voidTop),n.addColorStop(.5,c.voidMid),n.addColorStop(1,c.voidBottom),t.fillStyle=n,t.fillRect(0,0,g,R),t.fillStyle=c.farWall,t.fillRect(0,150,g,R-150),t.strokeStyle=c.farWallRib,t.lineWidth=1;for(let h=48;h<g;h+=96)t.beginPath(),t.moveTo(h+.5,150),t.lineTo(h+.5,R),t.stroke();const a=t.createRadialGradient(150,210,10,150,210,320);a.addColorStop(0,c.lampWarm),a.addColorStop(1,"rgba(255,216,160,0)"),t.fillStyle=a,t.fillRect(0,0,g,620);const r=t.createRadialGradient(640,260,10,640,260,380);r.addColorStop(0,c.lampCool),r.addColorStop(1,"rgba(190,214,255,0)"),t.fillStyle=r,t.fillRect(240,0,g-240,700);const l=t.createLinearGradient(0,820,0,R);l.addColorStop(0,"rgba(120,96,64,0)"),l.addColorStop(1,"rgba(120,96,64,0.07)"),t.fillStyle=l,t.fillRect(0,820,g,R-820);const s=[62,393,724];for(const h of s)t.fillStyle=c.girder,t.fillRect(h-23,150,46,R-150),t.strokeStyle=c.girderEdge,t.beginPath(),t.moveTo(h-22.5,150),t.lineTo(h-22.5,R),t.stroke();t.fillStyle=c.crossBrace,t.fillRect(0,300,g,18),t.fillRect(0,640,g,18),t.strokeStyle=c.crossBrace,t.lineWidth=6;for(let h=0;h<s.length-1;h++){const v=s[h],b=s[h+1];t.beginPath(),t.moveTo(v,318),t.lineTo(b,640),t.moveTo(b,318),t.lineTo(v,640),t.stroke()}t.lineWidth=1;const f=t.createLinearGradient(0,118,0,230);f.addColorStop(0,"rgba(0,0,0,0.55)"),f.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=f,t.fillRect(0,118,g,112),t.fillStyle=c.pitVoid,t.fillRect(0,1050,g,R-1050);const m=t.createLinearGradient(0,1050,0,1120);m.addColorStop(0,"rgba(74,68,58,0)"),m.addColorStop(1,c.pitHaze),t.fillStyle=m,t.fillRect(0,1050,g,70),t.fillStyle=c.grateLip,t.fillRect(0,1046,g,12),t.strokeStyle=c.grateHighlight,t.beginPath(),t.moveTo(0,1046.5),t.lineTo(g,1046.5),t.stroke();const o=ze(En);for(let h=0;h<900;
1h++){const v=o.next()*g,b=o.next()*R,C=.02+o.next()*.025;t.fillStyle=`rgba(255,255,255,${C})`,t.fillRect(v,b,1,1)}return e}function br(e){e.fillStyle=c.nearFrame,e.fillRect(0,0,34,R),e.fillRect(g-34,0,34,R),e.strokeStyle=c.nearFrameRim,e.lineWidth=2,e.beginPath(),e.moveTo(33,0),e.lineTo(33,R),e.moveTo(g-33,0),e.lineTo(g-33,R),e.stroke(),e.lineWidth=1}const J=17,re=11,G=23,ke=8.6,B=5;let De=null;function yr(){if(De)return De;if(typeof document>"u")return null;const e=document.createElement("canvas");e.width=q,e.height=X;const t=e.getContext("2d");if(!t)return null;const n=ze(3850);for(let a=0;a<260;a++){const r=n.next()*q,l=n.next()*X,s=.5+n.next()*1.1,f=.05+n.next()*.09;t.fillStyle=n.next()>.5?`rgba(255,255,255,${f})`:`rgba(110,103,84,${f})`,t.beginPath(),t.arc(r,l,s,0,Math.PI*2),t.fill()}t.strokeStyle="rgba(164,155,132,0.5)",t.lineWidth=1;for(let a=0;a<4;a++){const r=10+n.next()*(q-24),l=8+n.next()*(X-16),s=4+n.next()*5;t.beginPath(),t.moveTo(r,l),t.lineTo(r+s,l+(n.next()-.5)*2),t.stroke()}return De=e,e}function mt(e,t,n){e.fillStyle="rgba(90,82,66,0.22)",e.beginPath(),e.ellipse(t+2,n+2,G+3,ke+1.5,0,0,Math.PI*2),e.fill(),e.fillStyle=c.foamStud,e.fillRect(t-G,n-7,G*2,7),e.fillStyle=c.foamStudShade,e.fillRect(t+G/3,n-7,G*2/3,7);const a=e.createRadialGradient(t-8,n-10,2,t,n-7,G*1.4);a.addColorStop(0,c.foamSeam),a.addColorStop(1,c.foamStudTop),e.fillStyle=a,e.beginPath(),e.ellipse(t,n-7,G,ke,0,0,Math.PI*2),e.fill(),e.strokeStyle=c.foamBottomEdge,e.lineWidth=1,e.beginPath(),e.ellipse(t,n-7,G,ke,0,.15*Math.PI,.85*Math.PI),e.stroke(),e.strokeStyle="#fffdf4",e.beginPath(),e.ellipse(t,n-7,G,ke,0,1.1*Math.PI,1.75*Math.PI),e.stroke()}function He(e){const t=-q/2,n=-X/2,a=q/2,r=X/2;e.fillStyle=c.foamCheek,e.beginPath(),e.moveTo(a,n),e.lineTo(a+re,n-J),e.lineTo(a+re,r-J),e.lineTo(a,r),e.closePath(),e.fill();const l=e.createLinearGradient(t,n-J,t,n);l.addColorStop(0,c.foamTopLight),l.addColorStop(1,c.foamTopDark),e.fillStyle=l,e.beginPath(),e.moveTo(t,n),e.lineTo(t+re,n-J),e.lineTo(a+re,n-J),e.lineTo(a,n),e.closePath(),e.fill();const s=e.createLinearGradient(0,n,0,r);s.addColorStop(0,c.foamFrontLight),s.addColorStop(.55,c.foamFrontMid),s.addColorStop(1,c.foamFrontDark),e.fillStyle=s,e.beginPath(),e.moveTo(t+B,n),e.lineTo(a-B,n),e.lineTo(a,n+B),e.lineTo(a,r),e.lineTo(t,r),e.lineTo(t,n+B),e.closePath(),e.fill();const f=yr();f&&(e.save(),e.globalAlpha=.55,e.drawImage(f,t,n),e.restore());const m=e.createLinearGradient(0,r-10,0,r);m.addColorStop(0,"rgba(74,66,52,0)"),m.addColorStop(1,"rgba(74,66,52,0.35)"),e.fillStyle=m,e.fillRect(t,r-10,q,10),e.strokeStyle=c.foamBottomEdge,e.lineWidth=1,e.beginPath(),e.moveTo(t,r-.5),e.lineTo(a,r-.5),e.stroke(),e.strokeStyle=c.foamOutline,e.beginPath(),e.moveTo(t+B,n),e.lineTo(a-B,n),e.lineTo(a,n+B),e.lineTo(a,r),e.lineTo(t,r),e.lineTo(t,n+B),e.closePath(),e.stroke(),e.strokeStyle=c.foamSeam,e.beginPath(),e.moveTo(t+B,n+.5),e.lineTo(a-B,n+.5),e.stroke(),mt(e,t+q*.25+re/2,n-J/2),mt(e,t+q*.75+re/2,n-J/2)}function vr(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function kr(e){if(e.phase==="resetting"&&e.resetFrom){const t=vr(Math.min(e.phaseElapsed/Ee,1));return{x:e.resetFrom.x+(e.platform.x-e.resetFrom.x)*t,topY:e.resetFrom.topY+(e.platform.topY-e.resetFrom.topY)*t,width:e.resetFrom.width+(e.platform.width-e.resetFrom.width)*t}}return e.platform}function Sr(e){e.fillStyle=c.railFlangeTop,e.fillRect(0,96,g,6),e.strokeStyle=c.railHighlight,e.beginPath(),e.moveTo(0,96.5),e.lineTo(g,96.5),e.stroke(),e.fillStyle=c.railWeb,e.fillRect(0,102,g,10),e.fillStyle=c.railFlangeBottom,e.fillRect(0,112,g,6),e.strokeStyle=c.voidTop,e.beginPath(),e.moveTo(0,118.5),e.lineTo(g,118.5),e.stroke(),e.fillStyle=c.railBolt;for(let t=28;t<g;t+=56)e.beginPath(),e.arc(t,107,2,0,Math.PI*2),e.fill()}function Rr(e,t,n){const a=me(t.landings),r=Je(t.swingTime,a),l=r.pivotX-3*(r.theta/Math.max(a.amplitude,.001));if(e.fillStyle=c.trolley,e.fillRect(l-46,118,92,32),e.strokeStyle=c.trolleyHighlight,e.beginPath(),e.moveTo(l-46,118.5),e.lineTo(l+46,118.5),e.stroke(),e.fillStyle=c.trolleyVent,e.fillRect(l-24,128,6,18),e.fillRect(l+18,128,6,18),!n)return;const s=Math.min(1,t.swingTime/.25+(t.phase==="ready"?1:0)),f=r.pivotX+a.cableLength*s*
1Math.sin(r.theta),m=150+(r.blockY-X/2-150)*s,o=(l+f)/2-Math.sign(r.thetaDot||1)*2,h=(150+m)/2;e.strokeStyle=c.cable,e.lineWidth=3,e.beginPath(),e.moveTo(l,150),e.quadraticCurveTo(o,h,f,m),e.stroke(),e.strokeStyle=c.cableHighlight,e.lineWidth=1,e.beginPath(),e.moveTo(l-1,150),e.quadraticCurveTo(o-1,h,f-1,m),e.stroke(),e.fillStyle=c.hook,e.fillRect(f-17,m-11,34,11),e.strokeStyle=c.hookHighlight,e.beginPath(),e.moveTo(f-17,m-10.5),e.lineTo(f+17,m-10.5),e.stroke(),s>=1&&(e.save(),e.translate(r.blockX,r.blockY),e.rotate(r.theta*.85),He(e),e.restore())}function Tr(e,t,n){const a=mr(n),r=t.topY+a,l=t.x-t.width/2,s=e.createLinearGradient(0,r,0,R);s.addColorStop(0,c.deckPost),s.addColorStop(1,c.deckPostDark),e.fillStyle=s,e.fillRect(t.x-37,r+ie,74,R-r),e.strokeStyle=c.girderEdge,e.beginPath(),e.moveTo(t.x-18.5,r+ie),e.lineTo(t.x-18.5,R),e.moveTo(t.x+18.5,r+ie),e.lineTo(t.x+18.5,R),e.stroke();const f=e.createLinearGradient(0,r,0,r+ie);f.addColorStop(0,c.deckSlabLight),f.addColorStop(1,c.deckSlabDark),e.fillStyle=f,e.fillRect(l,r,t.width,ie),e.fillStyle=c.deckTopBand,e.fillRect(l,r,t.width,6),e.strokeStyle=c.deckHighlight,e.beginPath(),e.moveTo(l,r+.5),e.lineTo(l+t.width,r+.5),e.stroke(),e.save();for(const o of[l,l+t.width-40]){e.beginPath(),e.rect(o,r,40,6),e.clip(),e.fillStyle=c.hazardDark,e.fillRect(o,r,40,6),e.fillStyle=c.hazard;for(let h=-10;h<50;h+=20)e.beginPath(),e.moveTo(o+h,r+6),e.lineTo(o+h+10,r),e.lineTo(o+h+20,r),e.lineTo(o+h+10,r+6),e.closePath(),e.fill();e.restore(),e.save()}e.restore();const m=Et(t.width);e.strokeStyle=c.deckDatum,e.beginPath(),e.moveTo(t.x,r-6),e.lineTo(t.x,r),e.moveTo(t.x-m,r-4),e.lineTo(t.x-m,r),e.moveTo(t.x+m,r-4),e.lineTo(t.x+m,r),e.stroke(),e.fillStyle=c.deckBolt;for(let o=l+20;o<l+t.width-10;o+=40)e.beginPath(),e.arc(o,r+16,3,0,Math.PI*2),e.fill()}function wr(e){const t=e.phaseElapsed,n=e.contactRecord?.supportFraction??.5;return t<de?e.tipSide*.055*((.72-n)/.36)*Math.sin(2*Math.PI*3.4*t)*(1-t/de):e.teeterWillSettle?0:e.tipSide*Ke*Math.min(t-de,Ge-de)}function Er(e,t,n){const a=t.phase;if(a==="ready"||a==="swinging")return;if(a==="resetting"){if(!t.resetFrom||!t.contactRecord)return;const s=t.phaseElapsed,f=s>Ee-.15?Math.max(0,(Ee-s)/.15):1;if(f<=0)return;const m=t.contactRecord.contactX-t.resetFrom.x;e.save(),e.globalAlpha=f,e.translate(n.x+m,n.topY-X/2),He(e),e.restore();return}let r=t.blockRot,l=null;if(a==="teetering"&&(r=wr(t),l=t.platform.x+t.tipSide*(t.platform.width/2)),e.save(),l!==null){const s=t.platform.topY;e.translate(l,s),e.rotate(r),e.translate(t.blockX-l,t.blockY-s)}else e.translate(t.blockX,t.blockY),e.rotate(r);He(e),e.restore()}function Pr(e,t,n){if(t.phase!=="ready"&&t.phase!=="swinging"&&t.phase!=="falling")return;let a=t.blockX;if(t.phase==="ready"||t.phase==="swinging"){const r=me(t.landings);a=Je(t.swingTime,r).blockX}e.fillStyle="rgba(0,0,0,0.12)",e.beginPath(),e.ellipse(a,n.topY+3,q*.42,5,0,0,Math.PI*2),e.fill()}function Ar(e,t){for(const n of t.particles){const a=n.age/n.life;n.kind==="debris"?(e.globalAlpha=a>.76?1-(a-.76)/.24:1,e.fillStyle=c.debris,e.fillRect(n.x-1,n.y-1,2,2)):(e.globalAlpha=.42*Math.pow(1-a,1.6),e.fillStyle=n.light?c.dustLight:c.dust,e.beginPath(),e.arc(n.x,n.y,n.r,0,Math.PI*2),e.fill())}e.globalAlpha=1}function Cr(e,t){for(const n of t.popups){const a=t.reducedMotion?ft:ft*(1-Math.pow(1-Math.min(n.age/ir,1),3)),r=Math.max(0,(n.age-$e)/(Lt-$e));e.globalAlpha=Math.max(1-r*r,0);const l=n.word==="PERFECT",s=!t.reducedMotion&&l&&n.age<ut?1+sr*Math.sin(Math.PI*(n.age/ut)):1;e.save(),e.translate(n.x,n.y-a),e.scale(s,s),e.textAlign="center",e.font=l?`700 40px ${Ue}`:`600 34px ${Ue}`,e.fillStyle="rgba(0,0,0,0.6)",e.fillText(n.text,1,2),e.fillStyle=l?c.foamSeam:c.popup,e.fillText(n.text,0,0),n.word&&(e.font=l?`700 14px ${ue}`:`600 13px ${ue}`,e.fillStyle=l?c.perfectWord:c.edgeWord,e.fillText(n.word,0,20)),e.restore()}e.globalAlpha=1,e.textAlign="left"}function Mr(e,t){t.phase!=="dying"||t.contactRecord?.outcome!=="pit"||!(Math.floor(t.phaseElapsed*8)%2===0)||(e.fillStyle="rgba(200,162,51,0.28)",e.fillRect(0,1046,g,4))}function Nr(e,t,n,a){a?e.drawImage(a,0,0):(e.fillStyle=c.voidTop,e.fillRect(0,0,g,R)),e.save(),e.translate(n.shakeX,n.shakeY);const r=kr(t);Sr(e),Pr(e,t,r),Tr(e,r,n),Mr(e,t);const l=t.phase==="ready"||t.phase==="swinging"||t.phase==="resetting"&&t.phaseElapsed>=.15;
1Rr(e,t,l),Er(e,t,r),br(e),Ar(e,n),e.restore(),Cr(e,n)}function Lr(e,t,n){if(t.attract)return;const a=hr(n);if(e.save(),e.textAlign="center",e.translate(g/2,84),e.scale(a,a),e.font=`bold 64px ${Ue}`,e.fillStyle="#000000",e.fillText(String(t.score),2,2),e.fillStyle=c.score,e.fillText(String(t.score),0,0),e.restore(),e.textAlign="center",e.font=`500 13px ${ue}`,e.fillStyle=c.hudDim,e.fillText(`BEST ${Math.max(t.bestScore,t.score)}`,g/2,106),t.perfectStreak>=2){const r=`x${Math.min(t.perfectStreak,99)} PERFECT`;e.font=`600 12px ${ue}`;const l=e.measureText(r).width+20,s=g/2-l/2;e.fillStyle="rgba(20,20,22,0.55)",e.strokeStyle="#5c5648",e.beginPath(),e.roundRect(s,114,l,20,3),e.fill(),e.stroke(),e.fillStyle=c.perfectWord,e.fillText(r,g/2,128)}if(t.phase==="ready"){const r=.4+.3*(.5+.5*Math.sin(t.elapsed*2*Math.PI*.7));e.font=`600 15px ${ue}`,e.fillStyle=`rgba(240,237,223,${r.toFixed(3)})`,e.fillText("TAP TO RELEASE",g/2,640)}e.textAlign="left"}function ht(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):0}function gt(e){e&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e)}const bt=3343;function Ir(e,t){const n=e.getContext("2d",{alpha:!1});if(!n)throw new Error("Canvas 2D context not available");e.width=g,e.height=R;const a=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;let r=Re(bt,fe("ranked"),!0),l=ve(a);const s=gr();let f=0,m=0,o=!1,h=!1;const{state:v,cleanup:b}=Hn(e);function C(y){switch(fr(l,y,r.blockY),y.type){case"release":xn();break;case"impact":Mt(y.quality,r.landings),y.quality==="perfect"&&Zn(r.perfectStreak+1);break;case"teeterStart":er();break;case"settle":tr(r.landings);break;case"score":{y.perfect||ar(y.streak);const S=y.perfect?"PERFECT":r.contactRecord?.outcome==="settled"?"EDGE":null;ur(l,r.blockX,r.platform.topY-X-24,S);break}case"tip":nr();break;case"pit":rr();break}}const I={onScoreChange:t.onScoreChange,onGameOver:t.onGameOver,onPhaseChange:t.onPhaseChange,onAudioResume:Qn,onBestScore:Kn,onEvent:C};function E(y){if(!o)return;m===0&&(m=y);const S=Vn((y-m)/1e3);m=y,Yn(r,S,v,I),pr(l,S),Nr(n,r,l,s),Lr(n,r,l),f=ht(E)}function N(){m=0,!o&&!h&&(o=!0,f=ht(E))}const P={start(y){r=Re(y,fe("ranked"),!1),l=ve(a),v.pendingRelease=!1,N(),t.onScoreChange(0),t.onPhaseChange("ready")},stop(){o=!1,gt(f),f=0,b()},toAttract(){r=Re(bt,fe("ranked"),!0),l=ve(a),v.pendingRelease=!1,N(),t.onScoreChange(0),t.onPhaseChange("ready")},revive(){return Xn(r)?(m=0,v.pendingRelease=!1,t.onPhaseChange("playing"),!0):!1},snapshot(){return Wn(r)},resume(y){r=Gn(y,fe(y.mode)),l=ve(a),(r.phase==="ready"||r.phase==="swinging")&&(r.swingTime=0,r.armLockRemaining=Math.max(r.armLockRemaining,lt)),v.pendingRelease=!1,N(),t.onScoreChange(r.score),t.onPhaseChange(Be(r.phase))},setPaused(y){y!==h&&(h=y,h?(o=!1,gt(f),f=0,v.pendingRelease=!1,r.fallAccumulator=0):((r.phase==="ready"||r.phase==="swinging")&&(r.swingTime=0,r.armLockRemaining=Math.max(r.armLockRemaining,lt)),N()))},getState(){return r}};return N(),P}const Fr=1.5;function _r({callbacks:e,onHandleReady:t,active:n}){const a=u.useRef(null),r=u.useRef(null),l=u.useRef(e);l.current=e;const s=u.useRef(t);s.current=t;const f=u.useRef(n);return f.current=n,u.useEffect(()=>{r.current?.setPaused(!n)},[n]),u.useEffect(()=>{const m=a.current;if(!m)return;const o=Ir(m,{onScoreChange:E=>l.current.onScoreChange(E),onGameOver:(E,N)=>l.current.onGameOver(E,N),onPhaseChange:E=>l.current.onPhaseChange(E)});r.current=o,o.setPaused(!f.current),s.current(o);const h=()=>m.focus({preventScroll:!0});m.addEventListener("pointerdown",h);const v=()=>{document.visibilityState==="hidden"?o.setPaused(!0):o.setPaused(!f.current)};document.addEventListener("visibilitychange",v);const b=m.parentElement,C=()=>{if(!b)return;const E=b.getBoundingClientRect();if(E.width<=0||E.height<=0)return;const N=Math.min(E.width/g,E.height/R,Fr);m.style.width=`${Math.floor(g*N)}px`,m.style.height=`${Math.floor(R*N)}px`};C();const I=typeof ResizeObserver<"u"?new ResizeObserver(C):null;return I&&b&&I.observe(b),()=>{I?.disconnect(),document.removeEventListener("visibilitychange",v),m.removeEventListener("pointerdown",h),o.stop()}},[]),i.jsx("canvas",{ref:a,tabIndex:0,role:"application","aria-label":"Foam Drop game"})}const Ze="foam-drop";function jr(e,t){return`fd:${e}:${t}`}function qr(e){const t=e?.games?.[Ze];return t&&t.packageId&&t.boardId?t:null}function Vr(e){const t=qr(e);return t?{...e,game:t}:null}function Or({sessionAddress:e}){const[t,n]=u.useState(null),[a,r]=u.useState(!1),[l,s]=u.useState(!0),f=u.useCallback(()=>{s(!0),r(!1),vt({game:Ze}).then(b=>n(b)).catch(()=>r(!0)).finally(()=>s(!1))},[]);u.useEffect(()=>{f()},[f]);const m=t?t.stale?t.previousEntries:t.entries:[],o=e?.toLowerCase()??null,h=t?t.stale?t.boardWeekIndex:t.currentWeekIndex:null,v=l&&!t;return i.jsxs("div",{className:"fd-lb",children:[i.jsxs("div",{className:"fd-lb-head",children:[i.jsxs("div",{className:"fd-lb-head-titles",children:[i.jsxs("div",{className:"fd-lb-title",children:[h!==null?`Week ${h}`:"Weekly leaderboard",t?.stale&&i.jsx("span",{className:"fd-lb-final",children:"Final"})]}),h!==null&&i.jsx("div",{className:"fd-lb-range",children:Ut(h)})]}),i.jsx("button",{type:"button",className:"fd-lb-refresh",onClick:f,disabled:l,"aria-label":"Refresh leaderboard","aria-busy":l,children:i.jsx("span",{className:"fd-lb-refresh-glyph","aria-hidden":"true",children:"â»"})})]}),i.jsxs("div",{className:"fd-lb-board",children:[t?.stale&&i.jsx("div",{className:"fd-lb-banner",children:"New week â showing last week's final standings until the first ranked run lands."}),v&&i.jsx("div",{className:"fd-lb-skeleton ef-skeleton-list","aria-busy":"true","aria-label":"Loading leaderboard",children:Array.from({length:6},(b,C)=>i.jsxs("div",{className:"ef-skeleton-row",children:[i.jsx("div",{className:"ef-skeleton ef-skeleton-line",style:{width:"18%"}}),i.jsx("div",{className:"ef-skeleton ef-skeleton-line",style:{width:"46%"}}),i.jsx("div",{className:"ef-skeleton ef-skeleton-line",style:{width:"22%"}})]},C))}),a&&!v&&m.length===0&&i.jsxs("div",{className:"fd-lb-msg",children:[i.jsx("div",{className:"fd-lb-msg-title",children:"Leaderboard unavailable"}),i.jsx("div",{className:"fd-lb-msg-body",children:"The board could not be reached. Try refresh in a moment."})]}),a&&m.length>0&&i.jsx("div",{className:"fd-lb-banner",children:"Refresh failed â showing the last loaded board."}),!v&&!a&&t&&m.length===0&&i.jsxs("div",{className:"fd-lb-msg",children:[i.jsx("div",{className:"fd-lb-msg-title",children:"No ranked runs yet"}),i.jsx("div",{className:"fd-lb-msg-body",children:"Be the first to post a score this week."})]}),m.length>0&&i.jsx("div",{className:"fd-lb-scroll ef-scrollable",tabIndex:0,role:"group","aria-label":"Leaderboard standings",children:i.jsxs("table",{className:"fd-lb-table","aria-label":`Foam Drop leaderboard, week ${h??""}`,children:[i.jsxs("colgroup",{children:[i.jsx("col",{className:"fd-lb-c-rank"}),i.jsx("col",{className:"fd-lb-c-pilot"}),i.jsx("col",{className:"fd-lb-c-score"}),i.jsx("col",{className:"fd-lb-c-rev"}),i.jsx("col",{className:"fd-lb-c-time"})]}),i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{scope:"col",className:"fd-lb-c-rank",children:"#"}),i.jsx("th",{scope:"col",className:"fd-lb-c-pilot",children:"Pilot"}),i.jsx("th",{scope:"col",className:"fd-lb-c-score",children:"Drops"}),i.jsx("th",{scope:"col",className:"fd-lb-c-rev",children:"Rev"}),i.jsx("th",{scope:"col",className:"fd-lb-c-time",children:"Posted"})]})}),i.jsx("tbody",{children:m.map(b=>{const C=!!(o&&b.player.toLowerCase()===o);return i.jsxs("tr",{className:C?"fd-lb-row--self":void 0,"aria-current":C?"true":void 0,children:[i.jsx("th",{scope:"row",className:"fd-lb-c-rank",children:b.rank}),i.jsx("td",{className:"fd-lb-c-pilot",children:i.jsxs("div",{className:"fd-lb-pilot",children:[i.jsx("span",{className:"fd-lb-pilot-name",title:b.player,children:b.name??$t(b.player)}),b.reviveCount===0&&i.jsx("span",{className:"fd-lb-clean",title:"Clean run â landed every drop without buying any revives",children:"CLEAN"})]})}),i.jsx("td",{className:"fd-lb-c-score",children:b.score}),i.jsx("td",{className:"fd-lb-c-rev",children:b.reviveCount}),i.jsx("td",{className:"fd-lb-c-time",children:new Date(b.timestampMs).toISOString().slice(5,16).replace("T"," ")})]},`${b.player}-${b.rank}`)})})]})})]}),i.jsxs("div",{className:"fd-lb-status",role:"status","aria-live":"polite",children:[i.jsx("span",{children:"Weekly best per pilot"}),i.jsx("span",{className:"fd-lb-status-right",children:a&&m.length>0?"refresh failed":m.length>0?`${m.length} ranked`:""})]})]})}
1const Dr=Ht({storageKey:"ef.foamdrop.rankedRun.v1",unresolvedKey:"ef.foamdrop.unresolvedPayments.v1",tabIdKey:"ef.foamdrop.tabId",refPrefix:"fd"}),{ownedByAnotherLiveTab:Br,heartbeatRun:yt,loadPersistedRun:ce,savePersistedRun:Yr,clearPersistedRun:Q,updatePendingRevive:K,archiveUnresolvedPayment:x}=Dr,Xr=12e4;function Wr(e){const t=rn(),n=u.useRef(null),a=u.useRef(null),r=u.useRef(!1),l=u.useRef(!0);u.useEffect(()=>(l.current=!0,()=>{l.current=!1}),[]);const[s,f]=u.useState(null),[m,o]=u.useState(!1),[h,v]=u.useState("ready"),[b,C]=u.useState(0),[I,E]=u.useState(null),[N,P]=u.useState(null),[y,S]=u.useState(null),[W,L]=u.useState(null),[Ce,Z]=u.useState(null),[H,T]=u.useState(null),[ee,Me]=u.useState(!1),[O,D]=u.useState(null),[Ft,et]=u.useState(0),te=u.useCallback((d,p,k)=>{p instanceof le&&p.reason==="locked"&&!p.submitted?(S(null),L(d)):(L(null),S(p instanceof le?p.message:k))},[]),_=u.useCallback(()=>{S(null),L(null)},[]);u.useEffect(()=>{Kt().then(f).catch(()=>o(!0))},[]);const j=u.useMemo(()=>s?Vr(s):null,[s]),_t=!!(s&&!j),Ne=!!(j&&j.game.rulesetVersion!==ye);u.useEffect(()=>{const d=ce();if(d){if(d.rulesetVersion!==ye){x(d),Q(),Me(!0);return}if(d.weekIndex!==zt(Date.now())){x(d),Q();return}Br(d)||T(d)}},[]),u.useEffect(()=>{if(!I)return;yt(I.ticketId);const d=setInterval(()=>yt(I.ticketId),1e4);return()=>clearInterval(d)},[I]);const z=u.useCallback(d=>{a.current=d,E(d)},[]),jt=u.useCallback(d=>{n.current=d},[]),qt=u.useCallback(d=>{v(d);const p=n.current?.getState();p&&et(p.reviveCount)},[]),Vt=u.useCallback(d=>C(d),[]),Le=u.useCallback(()=>{const d=n.current,p=a.current;if(!d||!p)return;const k=ce();k&&k.ticketId!==p.ticketId&&x(k),Yr({v:1,ticketId:p.ticketId,weekIndex:p.weekIndex,seedU256:p.seedU256,seed32:p.seed32,startedAtMs:p.startedAtMs,rulesetVersion:ye,snapshot:d.snapshot(),savedAtMs:Date.now(),pendingRevive:k?.ticketId===p.ticketId?k.pendingRevive:null})},[]),tt=!!(t.walletAddress&&e&&t.walletAddress.toLowerCase()!==e.toLowerCase()),Ot=!!(t.isConnected&&t.signer&&t.walletAddress&&e&&!tt),Dt=u.useCallback(async()=>{if(O)return!1;if(Ne)return L(null),S("The game was updated â reload this page to play ranked."),!1;if(r.current||!j)return!1;if(!t.signer||!t.walletAddress||!t.isConnected)return L(null),S("EVE Vault is not connected â reconnect it, then try again."),!1;r.current=!0,_(),P({kind:"start",stage:"preparing"});try{const d=await Jt(j,t.signer,t.walletAddress,k=>P({kind:"start",stage:k}));if(!l.current)return!1;Z(null);const p=ce();return p&&x(p),Q(),D(null),z(d),n.current?.start(d.seed32),!0}catch(d){return l.current&&te("start",d,`Could not start a ranked run: ${String(d?.message||d)}`),!1}finally{l.current&&P(null),r.current=!1}},[j,t.signer,t.walletAddress,t.isConnected,z,O,Ne,_,te]),ge=u.useCallback(()=>{const d=n.current;if(d&&d.revive()){const p=d.getState();et(p.reviveCount),or(),Le(),K(null,a.current?.ticketId)}},[Le]),Bt=u.useCallback(async()=>{const d=n.current,p=a.current;if(O||r.current||!j||!d||!p)return;if(!t.signer||!t.walletAddress||!t.isConnected){L(null),S("EVE Vault is not connected â reconnect it, then try again. Your run is safe.");return}if(!e){L(null),S("Your EF-Map session expired. Sign in again before buying a revive â your run is safe.");return}if(d.getState().phase!=="dead")return;r.current=!0,_();const k=d.getState().reviveCount+1,A=jr(p.ticketId,k);P({kind:"revive",stage:"preparing"});try{const M=K({ref:A,reviveNo:k,status:"attempting",startedAtMs:Date.now()},p.ticketId);if(M!=="ok"){r.current=!1,P(null),S(M==="write-failed"?"Your browser could not save this run, so a payment could not be verified afterwards. Free up site storage (or leave private browsing) and try again â nothing has been charged.":"This run is no longer the active one in this browser, so a payment could not be tied to it. Nothing has been charged.");return}const be=await Qt(j,t.signer,t.walletAddress,A,oe=>P({kind:"revive",stage:oe}));K({ref:A,reviveNo:k,status:"paid",digest:be.digest,startedAtMs:Date.now()},p.ticketId),l.current&&ge()}catch(M){M instanceof le&&!M.submitted?(K(null,p.ticketId),l.current&&(M.reason==="rejected"?S("Payment cancelled â the run is still waiting at the death screen."):te("revive",M,M.message))):M instanceof le&&M.reason==="timeout"&&M.submitted?(ce()?.pendingRevive?.ref===A&&K({ref:A,reviveNo:k,status:"attempting",startedAtMs:Date.now()},p.ticketId),l.current&&(D({ref:A,reviveNo:k}),S('The wallet did not answer in time. If an approval window is still open in EVE Vault, DISM
1ISS it (do not approve), then use "Verify previous payment".'))):l.current&&(D({ref:A,reviveNo:k}),S(M instanceof Error?M.message:`Revive payment failed: ${String(M)}`))}finally{l.current&&P(null),r.current=!1}},[j,t.signer,t.walletAddress,t.isConnected,e,ge,O,_,te]),Yt=u.useCallback(async()=>{const d=n.current,p=a.current;if(O||r.current||!j||!d||!p)return;if(!t.signer||!t.walletAddress||!t.isConnected){L(null),S("EVE Vault is not connected â reconnect it, then submit. Your score is safe.");return}const k=d.getState();if(k.phase==="dead"){r.current=!0,_(),P({kind:"submit",stage:"preparing"});try{const A=k.score,M=t.walletAddress,be=await xt(j,t.signer,t.walletAddress,p.ticketId,A,k.reviveCount,ye,Fe=>P({kind:"submit",stage:Fe}));if(!l.current)return;Q(),z(null),lr();let oe={kind:"new-best"};if(!be.qualified)try{const Fe=await vt({timeoutMs:4e3,noStore:!0,game:Ze});oe=Zt({qualified:!1,submittedScore:A,playerAddress:M,board:Fe})}catch{oe={kind:"recorded"}}Z({digest:be.digest,outcome:oe,submittedScore:A})}catch(A){if(!l.current)return;A instanceof le&&A.reason==="rejected"?S("Submission cancelled â your run is still here."):te("submit",A,`Score submission failed: ${String(A?.message||A)}`)}finally{l.current&&P(null),r.current=!1}}},[j,t.signer,t.walletAddress,t.isConnected,z,O,_,te]),Ie=u.useCallback((d,p)=>{const k=n.current?.getState();if(k&&k.reviveCount>=d.reviveNo){K(null,p);return}ge()},[ge]),ae=u.useCallback(async d=>{const p=d.pendingRevive;if(p){if(L(null),p.status==="paid"){Ie(p,d.ticketId);return}P({kind:"verify",stage:"checking"});try{const k=await en(p.ref);k.status==="paid"?(K({...p,status:"paid",digest:k.digest??void 0},d.ticketId),Ie({...p,status:"paid"},d.ticketId),D(null),S(null)):k.status==="auth_required"?(D({ref:p.ref,reviveNo:p.reviveNo}),S("Sign in again to verify your previous revive payment â the run and the payment evidence are safe.")):k.status==="not_found"&&Date.now()-p.startedAtMs>Xr?(K(null,d.ticketId),D(null)):(D({ref:p.ref,reviveNo:p.reviveNo}),S('A previous revive payment could not be verified yet. Wait a moment and use "Verify previous payment" â check your wallet history before paying again.'))}finally{P(null)}}},[Ie]),Xt=u.useCallback(async()=>{const d=H,p=n.current;if(!d||!p)return!1;if(T(null),_(),!Un(d.snapshot))return x(d),Q(),S("The saved run could not be restored (corrupt save). Any pending payment evidence was archived."),!1;z({digest:"",sponsored:!1,ticketId:d.ticketId,weekIndex:d.weekIndex,seedU256:d.seedU256,seed32:d.seed32,startedAtMs:d.startedAtMs,rulesetVersion:d.rulesetVersion});try{p.resume(d.snapshot)}catch{return x(d),Q(),z(null),S("The saved run could not be restored (corrupt save). Any pending payment evidence was archived."),!1}return await ae(d),!0},[H,z,ae,_]),Wt=u.useCallback(()=>{H&&x(H),Q(),T(null)},[H]),Gt=u.useCallback(async()=>{const d=ce(),p=a.current;if(d?.pendingRevive){D(null),_(),await ae(d);return}if(O&&p){D(null),_(),await ae({v:1,ticketId:p.ticketId,weekIndex:p.weekIndex,seedU256:p.seedU256,seed32:p.seed32,startedAtMs:p.startedAtMs,rulesetVersion:p.rulesetVersion,snapshot:null,savedAtMs:Date.now(),pendingRevive:{ref:O.ref,reviveNo:O.reviveNo,status:"attempting",startedAtMs:Date.now()}});return}D(null)},[ae,_,O]);let nt="100 EVE";if(s)try{nt=`${tn(BigInt(s.commerce.priceRaw),s.commerce.coinDecimals)} ${s.commerce.coinSymbol}`}catch{}return{config:s,configError:m,gameUnprovisioned:_t,rulesetSkew:Ne,staleRulesetNotice:ee,phase:h,score:b,ranked:I,reviveCount:Ft,busy:N,error:y,lockedRecovery:W,submitResult:Ce,resumeOffer:H,unverifiedPayment:O,revivePriceLabel:nt,walletReady:Ot,walletMismatch:tt,setHandle:jt,onEnginePhase:qt,onEngineScore:Vt,onEngineGameOver:Le,startRanked:Dt,revive:Bt,submit:Yt,acceptResume:Xt,declineResume:Wt,retryVerifyPayment:Gt,clearError:_}}const Gr={preparing:"Preparing transactionâ¦","requesting-sponsorship":"Requesting gas sponsorshipâ¦","sponsor-fallback":"Sponsor unavailable â your wallet pays its own gas","awaiting-signature":"Approve in EVE Vault⦠(it will ask for your PIN first if locked)","awaiting-signature-unsponsored":"Approve in your wallet â it will pay its own gas and submitâ¦",submitting:"Submitting to chainâ¦",confirming:"Waiting for confirmationâ¦",checking:"Checking previous paymentâ¦"};function Ur(e){if(!e)return null;if(e.outcome==="pit")return{stat:"ON THE DECK 0%",why:"The block missed the platform completely."};if(e.outcome==="tipped"){const t=Math.round(e.supportFraction*100),n=Math.round(e.neededFraction*100),a=Math.min(n,72),r=n>72?"It hit sliding too fast for an edge landing to hold at all.":a<=50?"Half the block has to be on the platform for it to settle.":"It was still sliding sideways, and that needs more platform under it.";return{stat:`ON THE DECK ${t}% · NEEDED ${a}%`,why:r}}return null}function Qr({sessionAddress:e,onConnectWallet:t,isMinimized:n=!1}){const[a,r]=u.useState("game"),[l,s]=u.useState(!1),[f,m]=u.useState(()=>zn()),o=Wr(e),h=u.useRef(null),v=u.useRef(null),b=u.useRef(0),C=u.useMemo(()=>({onScoreChange:o.onEngineScore,onGameOver:()=>o.onEngineGameOver(),onPhaseChange:o.onEnginePhase}),[o.onEngineScore,o.onEngineGameOver,o.onEnginePhase]),I=u.useMemo(()=>T=>{h.current=T,o.setHandle(T)},[o.setHandle]),E=u.useRef(!1);E.current=o.ranked!==null,u.useEffect(()=>{let T=new URLSearchParams(window.location.search).has("foamdev");try{T=T||localStorage.getItem("ef.foamdrop.dev")==="1"}catch{}if(!T)return;const ee=window;return ee.__foamDropDev={start:(Me=1)=>E.current?!1:(s(!0),h.current?.start(Me),!0),state:()=>h.current?.getState(),release:()=>{document.querySelector(".fd-stage canvas")?.dispatchEvent(new PointerEvent("pointerdown",{bubbles:!0}))}},()=>{delete ee.__foamDropDev}},[]),u.useEffect(()=>{const T=Date.now();if(o.score>0&&T-b.current>1e3&&v.current){const ee=h.current?.getState().contactRecord?.outcome;v.current.textContent=ee==="perfect"?`Score ${o.score}, perfect landing`:`Score ${o.score}`,b.current=T}},[o.score]);const N=!l&&o.phase==="ready",P=o.phase==="dead"&&!o.submitResult,y=o.busy?Gr[o.busy.stage]:null,S=h.current?.getState().contactRecord??null,W=P?Ur(S):null;u.useEffect(()=>{W&&v.current&&(v.current.textContent=`Run over. ${W.stat}. ${W.why}`)},[W?.stat]);const L=()=>{o.startRanked().then(T=>{T&&s(!0)})},Ce=()=>{o.acceptResume().then(T=>{T&&s(!0)})},Z=()=>{o.lockedRecovery==="submit"?o.submit():o.lockedRecovery==="revive"?o.revive():o.lockedRecovery==="start"&&L()},H=()=>{const T=!f;m(T),Jn(T)};return i.jsxs("div",{className:"fd-panel",children:[i.jsxs("div",{className:"fd-tabs",role:"tablist",children:[i.jsx("button",{type:"button",role:"tab","aria-selected":a==="game",className:`fd-tab${a==="game"?" is-active":""}`,onClick:()=>r("game"),children:"Play"}),i.jsx("button",{type:"button",role:"tab","aria-selected":a==="leaderboard",className:`fd-tab${a==="leaderboard"?" is-active":""}`,onClick:()=>r("leaderboard"),children:"Leaderboard"}),o.ranked&&i.jsxs("span",{className:"fd-status fd-run-chip",children:["RANKED · week ",o.ranked.weekIndex," · revives ",o.reviveCount]}),i.jsx("button",{type:"button",className:"fd-sound-toggle",onClick:H,"aria-label":f?"Unmute game sound":"Mute game sound","aria-pressed":f,title:f?"Sound off":"Sound on",children:f?"
1SND OFF":"SND ON"})]}),i.jsx("span",{ref:v,className:"fd-visually-hidden",role:"status","aria-live":"polite"}),i.jsxs("div",{className:"fd-stage",style:a==="leaderboard"?{display:"none"}:void 0,children:[i.jsx(_r,{callbacks:C,onHandleReady:I,active:a==="game"&&!n}),o.resumeOffer&&i.jsxs("div",{className:"fd-overlay",children:[i.jsx("div",{className:"fd-overlay-title",children:"Run interrupted"}),i.jsxs("div",{className:"fd-overlay-sub",children:["You have an unfinished ranked run (score ",o.resumeOffer.snapshot?.score??"?",", week ",o.resumeOffer.weekIndex,"). Resume it?"]}),o.resumeOffer.pendingRevive&&i.jsx("div",{className:"fd-error",children:"This run has an unresolved revive payment. Resume to verify it â abandoning keeps the evidence but stops any automatic recovery."}),i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",onClick:Ce,children:"Resume run"}),i.jsx("button",{type:"button",className:"fd-btn",onClick:o.declineResume,children:"Abandon it"})]}),!o.resumeOffer&&N&&i.jsxs("div",{className:"fd-overlay",children:[i.jsx("div",{className:"fd-overlay-title",children:"Foam Drop"}),i.jsx("div",{className:"fd-overlay-sub",children:"The crane swings a block of building foam. Tap, click or press Space to release it and land it on the platform below. Each landing scores a point; dead centre scores two. Ranked only â every drop this week uses the same crane timing, so scores are comparable."}),o.walletReady?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",disabled:!o.config||o.gameUnprovisioned||o.rulesetSkew||!!o.busy,onClick:L,children:"Start ranked run"}),i.jsx("div",{className:"fd-overlay-note",children:"Starting a run asks your wallet to sign a run ticket. EF-Map covers the network fee."})]}):i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",onClick:t,children:"Connect wallet to play"}),i.jsx("div",{className:"fd-overlay-note",children:"Signing in is free. Nothing is charged unless you choose to revive a run."})]}),o.configError&&i.jsx("div",{className:"fd-error",children:"Arcade services unreachable â ranked play is offline. Try again shortly."}),o.gameUnprovisioned&&!o.configError&&i.jsx("div",{className:"fd-error",children:"Ranked play opens shortly â the weekly board is being provisioned."}),o.rulesetSkew&&i.jsx("div",{className:"fd-error",children:"The game was updated â reload this page to play ranked."}),o.staleRulesetNotice&&i.jsx("div",{className:"fd-overlay-note",children:"A saved run from an earlier version of Foam Drop was closed out â the scoring rules changed, so it could not be resumed or submitted. Any pending payment evidence was kept."}),o.walletMismatch&&i.jsx("div",{className:"fd-error",children:"Connected wallet differs from your signed-in session â reconnect with the session wallet to play."}),y&&i.jsx("div",{className:"fd-status",children:y}),o.error&&i.jsx("div",{className:"fd-error",children:o.error}),o.walletReady&&o.lockedRecovery==="start"&&i.jsx(_e,{prefix:"fd",action:"start",hasRun:!1,disabled:!!o.busy||!o.config||o.gameUnprovisioned||o.rulesetSkew,onRetry:Z})]}),P&&!o.resumeOffer&&i.jsxs("div",{className:"fd-overlay",children:[i.jsx("div",{className:"fd-overlay-title",children:"Block lost"}),i.jsxs("div",{className:"fd-score-line",children:["Score ",o.score," · revives ",o.reviveCount]}),W&&i.jsxs("div",{className:"fd-mortem",children:[i.jsx("span",{className:"fd-mortem-stat",children:W.stat}),i.jsx("span",{className:"fd-mortem-why",children:W.why})]}),o.walletReady?i.jsxs(i.Fragment,{children:[o.unverifiedPayment?i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",disabled:!!o.busy,onClick:()=>void o.retryVerifyPayment(),children:"Verify previous payment"}):i.jsxs("button",{type:"button",className:"fd-btn fd-btn--primary",disabled:!!o.busy,onClick:()=>void o.revive(),children:["Revive for ",o.revivePriceLabel]}),i.jsx("button",{type:"button",className:"fd-btn fd-btn--accent-outline",disabled:!!o.busy||!!o.unverifiedPayment,onClick:()=>void o.submit(),children:"Submit score & finish"}),i.jsx("button",{type:"button",className:"fd-btn",disabled:!!o.busy||!!o.unverifiedPayment,onClick:L,children:"New run (free)"}),i.jsx("div",{className:"fd-overlay-note",children:"A revive puts a fresh block on the cable and keeps your score and platform. Starting over is free."})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"fd-error",children:o.walletMismatch?"Connected wallet differs from your signed-in session â reconnect with the session wallet to continue."
1:e?"EVE Vault is disconnected. Reconnect the same wallet to continue â your run is safe.":"Your EF-Map session expired. Sign in again with the same wallet â your run and any payment evidence are safe."}),o.unverifiedPayment&&i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",disabled:!!o.busy,onClick:()=>void o.retryVerifyPayment(),children:"Verify previous payment"}),i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",onClick:t,children:"Reconnect wallet"})]}),y&&i.jsx("div",{className:"fd-status",children:y}),o.error&&i.jsx("div",{className:"fd-error",children:o.error}),o.walletReady&&o.lockedRecovery&&i.jsx(_e,{prefix:"fd",action:o.lockedRecovery==="start"?"new-run":o.lockedRecovery,disabled:!!o.busy||o.lockedRecovery==="start"&&(!o.config||o.gameUnprovisioned||o.rulesetSkew),onRetry:Z})]}),o.submitResult&&o.phase==="dead"&&!o.resumeOffer&&i.jsxs("div",{className:"fd-overlay",children:[i.jsx("div",{className:"fd-overlay-title",children:"Score submitted"}),i.jsx("div",{className:"fd-overlay-sub",children:nn(o.submitResult.outcome,o.submitResult.submittedScore)}),i.jsx("button",{type:"button",className:"fd-btn fd-btn--primary",onClick:()=>r("leaderboard"),children:"View leaderboard"}),i.jsx("button",{type:"button",className:"fd-btn",disabled:!!o.busy,onClick:L,children:"New run (free)"}),y&&i.jsx("div",{className:"fd-status",children:y}),o.error&&i.jsx("div",{className:"fd-error",children:o.error}),o.walletReady&&o.lockedRecovery==="start"&&i.jsx(_e,{prefix:"fd",action:"new-run",hasRun:!1,disabled:!!o.busy||!o.config||o.gameUnprovisioned||o.rulesetSkew,onRetry:Z})]})]}),a==="game"&&!N&&!P&&!o.resumeOffer&&(y||o.error)&&i.jsxs("div",{children:[y&&i.jsx("div",{className:"fd-status",children:y}),o.error&&i.jsx("div",{className:"fd-error",children:o.error})]}),a==="leaderboard"&&i.jsx(Or,{sessionAddress:e}),i.jsxs("div",{className:"fd-footer",children:[i.jsx("span",{children:"Ranked · shared weekly crane"}),i.jsx("span",{children:"Best runs reset Sundays 00:00 UTC"})]})]})}export{Qr as default};
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.