PageSourceSearch

https://whallycoin.com/assets/MemoryCurrents-Bl6X1LX2.js

js whallycoin.com collected 2026-10-09 00:42:09 UTC 9,429 bytes, 1 lines download raw bytes

1import{r as n,j as t,B,L as F}from"./index-CJnYSCP2.js";import{O as L}from"./OceanBackground-BsxWsoyD.js";import{u as D}from"./useScoreSubmission-CcH6Yg4H.js";import{T as $,A as G}from"./TmaTopBar-JH4aY3Y7.js";import{A as P}from"./arrow-left-5rM3LIYy.js";import{B as z}from"./brain-BrnoY1gt.js";import"./AvatarUploadModal-EGgP__vb.js";import"./AuthModal-CaCzYz42.js";const v=9,H=600,O=220,W=.92,K=140,b=(e=0)=>({status:"idle",sequence:[],inputIndex:0,round:0,score:0,best:e,ended:null}),N=(e=Math.random)=>Math.floor(e()*v),Y=(e,o=Math.random)=>({...b(e.best),status:"showing",sequence:[N(o)],round:1}),Z=(e,o=Math.random)=>({...e,status:"showing",sequence:[...e.sequence,N(o)],inputIndex:0,round:e.round+1}),J=e=>({...e,status:"input",inputIndex:0}),Q=(e,o)=>{if(e.status!=="input")return e;const p=e.sequence[e.inputIndex];if(o!==p)return{...e,status:"gameover",ended:"wrong-tile",score:Math.max(e.score,e.sequence.length-1),best:Math.max(e.best,e.score,e.sequence.length-1)};const i=e.inputIndex+1;if(i>=e.sequence.length){const u=e.sequence.length;return{...e,inputIndex:i,score:Math.max(e.score,u),best:Math.max(e.best,u)}}return{...e,inputIndex:i}},U=e=>({...e,status:"gameover",ended:"timeout",score:Math.max(e.score,e.sequence.length-1),best:Math.max(e.best,e.score,e.sequence.length-1)}),V=e=>e.status==="input"&&e.inputIndex>=e.sequence.length&&e.sequence.length>0,X=e=>Math.max(O,Math.round(H*Math.pow(W,Math.max(0,e-1)))),ee=()=>K,te=e=>2500+e*1200,f="whally_memory_currents_best",se=()=>{const[e,o]=n.useState(()=>{let s=0;try{s=parseInt(localStorage.getItem(f)||"0",10)||0}catch{}return b(s)}),[p,i]=n.useState(null),[u,g]=n.useState(null),[w,k]=n.useState(0),[_,T]=n.useState(0),[,M]=n.useState(0),[S,I]=n.useState(0),l=n.useRef([]),a=n.useRef(void 0),c=n.useRef(void 0),x=()=>{l.current.forEach(s=>window.clearTimeout(s)),l.current=[],a.current&&(window.clearTimeout(a.current),a.current=void 0),c.current&&(window.clearInterval(c.current),c.current=void 0)};n.useEffect(()=>{if(e.status!=="showing")return;x();const s=X(e.round),r=ee();let d=200;e.sequence.forEach(h=>{const E=window.setTimeout(()=>i(h),d),C=window.setTimeout(()=>i(null),d+s);l.current.push(E,C),d+=s+r});const m=window.setTimeout(()=>{o(h=>J(h))},d+100);return l.current.push(m),x},[e.status,e.round,e.sequence]),n.useEffect(()=>{if(e.status!=="input")return;const s=te(e.sequence.length);return k(s),T(performance.now()),a.current=window.setTimeout(()=>{o(r=>U(r))},s),c.current=window.setInterval(()=>M(r=>r+1),100),()=>{a.current&&window.clearTimeout(a.current),c.current&&window.clearInterval(c.current)}},[e.status,e.sequence.length]),n.useEffect(()=>{if(!V(e))return;a.current&&window.clearTimeout(a.current),c.current&&window.clearInterval(c.current);const s=window.setTimeout(()=>o(r=>Z(r)),500);l.current.push(s)},[e]),n.useEffect(()=>{if(e.status==="gameover"&&(x(),i(null),e.score>0)){try{const s=parseInt(localStorage.getItem(f)||"0",10)||0;e.score>s&&localStorage.setItem(f,String(e.score))}catch{}I(s=>s+1)}},[e.status,e.score]),n.useEffect(()=>()=>x(),[]),D("memory-currents",Math.max(e.score,e.best),S);const q=n.useCallback(s=>{if(e.status!=="input")return;const r=e.sequence[e.inputIndex];g({tile:s,kind:s===r?"ok":"bad"}),window.setTimeout(()=>g(null),250),o(m=>Q(m,s))},[e.status,e.sequence,e.inputIndex]),y=n.useCallback(()=>o(s=>Y(s)),[]),A=n.useCallback(()=>o(s=>b(s.best)),[]),j=e.status==="input"&&w>0?Math.max(0,100-(performance.now()-_)/w*100):100,R=Array.from({length:v},(s,r)=>r);return t.jsxs("div",{className:"w-full flex flex-col gap-4",children:[t.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[t.jsxs("div",{className:"card-ocean rounded-lg px-3 py-2 text-center",children:[t.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-body",children:"Round"}),t.jsx("div",{className:"font-mono font-bold text-foreground text-base",children:e.round||"—"})]}),t.jsxs("div",{className:"card-ocean rounded-lg px-3 py-2 text-center",children:[t.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-body",children:"Score"}),t.jsx("div",{className:"font-mono font-bold text-amber-300 text-base",children:e.score})]}),t.jsxs("div",{className:"card-ocean rounded-lg px-3 py-2 text-center",children:[t.jsx("div",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-body",children:"Best"}),t.jsx("div",{className:"font-mono font-bold text-primary text-base",children:e.best||"—"})]})]}),t.jsx("div",{className:"h-2 rounded-full bg-muted/40 overflow-hidden",children:t.jsx("div",{className:`h-full transition-[width] duration-100 ${e.status==="input"?j<30?"bg-red-500":"bg-cyan-400":"bg-primary/40"}`,style:{width:e.status==="input"?`${j}
1%`:e.status==="showing"?"100%":"0%"}})}),t.jsxs("div",{className:"relative w-full aspect-square rounded-2xl overflow-hidden border border-border bg-gradient-to-br from-[hsl(210_70%_12%)] to-[hsl(225_85%_5%)] p-3 sm:p-4 select-none",children:[t.jsx("div",{className:"grid grid-cols-3 gap-2 sm:gap-3 w-full h-full",children:R.map(s=>{const r=p===s,d=(u==null?void 0:u.tile)===s?u.kind:null;return t.jsx("button",{onPointerDown:m=>{m.stopPropagation(),q(s)},disabled:e.status!=="input","aria-label":`Tile ${s+1}`,className:`relative rounded-xl border transition-all duration-150 touch-none active:scale-95 ${r?"bg-cyan-300 border-cyan-200 shadow-[0_0_30px_hsl(190_100%_60%/0.9)] scale-[1.04]":d==="ok"?"bg-emerald-400/80 border-emerald-300 shadow-[0_0_20px_hsl(150_80%_55%/0.7)]":d==="bad"?"bg-red-500/80 border-red-400 shadow-[0_0_20px_hsl(0_85%_60%/0.7)]":"bg-[hsl(210_50%_18%)]/70 border-cyan-500/20 hover:border-cyan-400/40"} ${e.status!=="input"?"cursor-default":"cursor-pointer"}`,children:t.jsx("span",{className:"absolute inset-0 flex items-center justify-center",children:t.jsx("span",{className:`block rounded-full transition-all duration-200 ${r?"w-6 h-6 bg-white/70":"w-2 h-2 bg-cyan-300/30"}`})})},s)})}),e.status==="idle"&&t.jsxs("div",{className:"absolute inset-0 bg-background/85 backdrop-blur-sm flex flex-col items-center justify-center gap-3 p-6 text-center rounded-2xl",children:[t.jsx("h2",{className:"font-body font-bold text-foreground text-lg",children:"Memory Currents"}),t.jsx("p",{className:"text-muted-foreground text-xs font-body max-w-xs",children:"Watch the tiles flash, then tap them back in order. Each round adds one tile."}),t.jsx("button",{onClick:y,className:"btn-primary mt-2 px-6 py-3 min-h-[44px]",children:"Start Run"}),e.best>0&&t.jsxs("p",{className:"text-xs text-primary font-body font-bold",children:["Best: ",e.best]})]}),e.status==="showing"&&t.jsx("div",{className:"absolute inset-x-0 top-2 flex justify-center pointer-events-none",children:t.jsx("span",{className:"text-[11px] uppercase tracking-widest text-cyan-300/90 font-mono animate-pulse bg-background/40 px-2 py-1 rounded",children:"Watch the currents…"})}),e.status==="input"&&t.jsx("div",{className:"absolute inset-x-0 top-2 flex justify-center pointer-events-none",children:t.jsxs("span",{className:"text-[11px] uppercase tracking-widest text-amber-300/90 font-mono bg-background/40 px-2 py-1 rounded",children:["Your turn — ",e.sequence.length-e.inputIndex," left"]})}),e.status==="gameover"&&t.jsxs("div",{className:"absolute inset-0 bg-background/85 backdrop-blur-sm flex flex-col items-center justify-center gap-3 p-6 text-center rounded-2xl",children:[t.jsx("h2",{className:"font-body font-bold text-foreground text-lg",children:e.ended==="timeout"?"Time's up!":"Wrong tile!"}),t.jsx("div",{className:"font-mono text-3xl font-bold text-amber-300",children:e.score}),t.jsx("p",{className:"text-[11px] text-muted-foreground font-body",children:"longest sequence completed"}),e.score>0&&e.score>=e.best&&t.jsx("p",{className:"text-xs text-primary font-bold font-body",children:"🏆 New personal best"}),t.jsxs("div",{className:"flex gap-2 mt-2",children:[t.jsx("button",{onClick:y,className:"btn-primary px-5 py-2 min-h-[44px]",children:"Play Again"}),t.jsx("button",{onClick:A,className:"px-5 py-2 min-h-[44px] rounded-lg border border-border text-foreground font-body text-sm hover:bg-muted/50",children:"Reset"})]})]})]})]})},le=()=>{const{isTMA:e}=B();return t.jsxs("div",{className:"min-h-[100dvh] bg-background relative",children:[t.jsx(L,{}),t.jsxs("div",{className:"relative z-10",children:[e?t.jsx($,{}):t.jsx("header",{className:"border-b border-border bg-background/80 backdrop-blur-md sticky top-0 z-20",children:t.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center gap-3",children:[t.jsxs(F,{to:"/arcade",className:"text-muted-foreground hover:text-primary transition-colors flex items-center gap-2 font-body text-sm min-h-[44px]",children:[t.jsx(P,{size:18})," Arcade"]}),t.jsx(G,{}),t.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[t.jsx(z,{size:18,className:"text-primary"}),t.jsx("span",{className:"font-body font-bold text-foreground text-sm sm:text-base",children:"Memory Currents"})]})]})}),t.jsxs("main",{className:"container mx-auto px-4 py-6 sm:py-10 max-w-md",children:[t.jsxs("div",{className:"text-center mb-4",children:[t.jsx("h1",{className:"text-xl sm:text-2xl font-bold gradient-text",children:"Memory Currents"}),t.jsx("p",{className:"text-muted-foreground text-xs sm:text-sm font-body",children:"Watch the sequence. Tap it back. Don't lose the rhythm."})]}),t.jsx(se,{})]})]})]})};export{le 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.