1import{f as s,j as e,g as E}from"./app-DQCW1V05.js";import{B as R}from"./BreakShell-Brv4oUdh.js";import"./rotate-ccw-OKFV1yOT.js";import"./play-sC4Adzc4.js";const d=3e4,k=650,j="rhythm-tap:best-v1";function I(){const[t,l]=s.useState("idle"),[n,i]=s.useState(0),[w,m]=s.useState(!1),[g,u]=s.useState(d),[c,v]=s.useState(()=>Number(localStorage.getItem(j)||0)),x=s.useRef(!1),h=s.useRef(0),p=s.useRef(0),f=s.useRef([]),o=()=>{f.current.forEach(r=>window.clearInterval(r)),f.current=[]};s.useEffect(()=>()=>o(),[]);const N=()=>{o(),i(0),u(d),p.current=performance.now(),l("playing");const r=window.setInterval(()=>{x.current=!0,m(!0),window.setTimeout(()=>{x.current=!1,m(!1)},220)},k),a=window.setInterval(()=>{const b=Math.max(0,d-(performance.now()-p.current));u(b),b<=0&&(o(),l("over"))},50);f.current=[r,a]},S=()=>{o(),l("idle"),m(!1)};s.useEffect(()=>{t==="over"&&n>c&&(v(n),localStorage.setItem(j,String(n)))},[t,n,c]);const y=()=>{if(t!=="playing")return;const r=performance.now();r-h.current<120||(h.current=r,x.current?i(a=>a+1):i(a=>Math.max(0,a-1)))};return e.jsx(R,{hint:"РиÑмге Ð±Ð°Ñ â ÑоÒÒÑда +1, баÑÒа ÑаÒÑÑÑа â1",phase:t,onStart:N,onStop:S,children:e.jsxs("div",{className:"flex min-h-[400px] flex-col items-center justify-center bg-[#18181b] px-4 py-8 text-white",children:[e.jsxs("div",{className:"mb-6 flex w-full max-w-sm items-center justify-between",children:[e.jsx("span",{className:"text-3xl font-black",children:n}),(t==="playing"||t==="over")&&e.jsxs("span",{className:"font-mono text-sm text-zinc-400",children:[(g/1e3).toFixed(1),"s"]})]}),t==="idle"&&e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"mb-3 text-5xl",children:"ð¥"}),e.jsx("h2",{className:"text-2xl font-black",children:"РиÑм ÑоÒÒÑ"}),e.jsx("p",{className:"mt-2 text-sm text-zinc-400",children:"Ð¨ÐµÒ£Ð±ÐµÑ Ð¶Ð°ÑÒÑÑаÒанда баÑ!"}),c>0&&e.jsxs("p",{className:"mt-2 text-xs text-amber-300",children:["РекоÑд: ",c]})]}),(t==="playing"||t==="over")&&e.jsx("button",{type:"button",onClick:y,disabled:t!=="playing",className:E("h-44 w-44 rounded-full border-4 transition-transform active:scale-95",w?"scale-110 border-amber-300 bg-amber-400 shadow-[0_0_50px_rgba(251,191,36,0.7)]":"border-zinc-600 bg-zinc-800")}),t==="over"&&e.jsx("p",{className:"mt-6 text-2xl font-black",children:n})]})})}function z(){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold tracking-tight sm:text-2xl",children:"ð¥ РиÑм ÑоÒÒÑ"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"РиÑмге Ð±Ð°Ñ â ÑоÒÒÑда ұпай."})]}),e.jsx(I,{})]})}export{z as default}; 2//# sourceMappingURL=RhythmTap-Dc21UEsu.js.map
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.