1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1492],{1492:function(e,t,n){n.r(t),n.d(t,{default:function(){return v}});var s=n(5893),a=n(7294);let l=[220,360,500],r="planeta-drive:record:v1",i=e=>["van","barrier","pothole","cone"].includes(e),c=e=>{switch(e){case"van":return[68,140];case"barrier":return[104,60];case"pothole":return[100,66];case"cone":return[54,54];default:return[42,42]}};function d(){return{phase:"ready",lane:1,x:360,distance:0,parts:0,time:0,speed:260,offset:0,spawnIn:0,row:0,shield:!1,magnet:0,invincible:0,flash:0,entities:[],sparks:[],nextId:1}}function o(e,t){"running"===e.phase&&(e.lane=Math.max(0,Math.min(2,e.lane+t)))}function x(e){"running"===e.phase&&(e.phase="paused")}let m=["car","van","barrier","pothole","cone","wrench","shield","magnet","tree","roof","road","roadside"],h={car:[148,155,876,1317],van:[278,256,745,1246],barrier:[302,225,1234,753],pothole:[271,166,1265,844],cone:[319,316,935,930],wrench:[112,85,1233,1151],shield:[317,187,978,994],magnet:[370,213,1e3,893],tree:[210,149,1067,1018],roof:[200,204,861,1281]};async function u(){return Object.fromEntries(await Promise.all(m.map(e=>new Promise((t,n)=>{let s=new Image;s.onload=()=>t([e,s]),s.onerror=()=>n(Error(`Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ ${e}.png`)),s.src=`/images/game/${e}.png`}))))}function p(e,t,n,s,a,l,r,i=0){let c=h[n];
1e.save(),e.translate(s,a),e.rotate(i),e.drawImage(t[n],c[0],c[1],c[2]-c[0],c[3]-c[1],-l/2,-r/2,l,r),e.restore()}let f="rounded-xl bg-[#ef242b] px-7 py-3.5 text-sm font-bold text-white transition-colors hover:bg-[#d81d25] focus-visible:ring-4 focus-visible:ring-cyan-400 focus-visible:ring-offset-2 disabled:cursor-wait disabled:opacity-50",g="rounded-lg border border-[#d9dbd9] bg-white px-4 py-2 text-sm font-semibold text-[#293139] hover:bg-[#f1f1ec] focus-visible:ring-4 focus-visible:ring-cyan-400",b=e=>Math.floor(e).toLocaleString("ru-RU");function v(){let e=(0,a.useRef)(null),t=(0,a.useRef)(null),n=(0,a.useRef)(null),[m,h]=(0,a.useState)(0),[v,j]=(0,a.useState)(!0),[w,N]=(0,a.useState)(!1),[y,k]=(0,a.useState)(0),[M,S]=(0,a.useState)(!1),[E,I]=(0,a.useState)(()=>d());(0,a.useEffect)(()=>{let s=e.current;if(!s)return;let a=s.getContext("2d");if(!a){j(!1),N(!0);return}let m=!1,h=0,f=0,g=0,b=0,v=!0,w=null,y=d(),M=0;try{M=function(e){if(!e)return 0;try{let t=JSON.parse(e);return"number"==typeof t&&Number.isFinite(t)&&t>=0&&t<=1e7?Math.floor(t):0}catch{return 0}}(localStorage.getItem(r))}catch{}k(M),j(!0),N(!1),I({...y});let E=window.matchMedia("(prefers-reduced-motion: reduce)"),L=()=>I({...y}),R=()=>{let e=Math.min(window.devicePixelRatio||1,2);s.width=720*e,s.height=800*e,a.setTransform(e,0,0,e,0,0),v=!0};R();let A=()=>{if(!(Math.floor(y.distance)<=M)){k(M=Math.floor(y.distance)),S(!0);try{localStorage.setItem(r,JSON.stringify(M))}catch{}}},C=()=>{var e;w&&!m&&("ready"===y.phase||"over"===y.phase)&&((y=d()).phase="running",g=0,f=performance.now(),S(!1),v=!0,L(),null===(e=t.current)||void 0===e||e.focus({preventScroll:!0}))},P=()=>{var e;if("running"===y.phase)x(y);else{if("paused"!==y.phase)return;y.phase="running",f=performance.now(),g=0}v=!0,L(),null===(e=t.current)||void 0===e||e.focus({preventScroll:!0})},D=()=>{"running"===y.phase&&(x(y),v=!0,L())},F=()=>{document.hidden&&D()};n.current={start:C,toggle:P,move:e=>o(y,e)};let $=e=>{let t=e.target;if(e.altKey||e.ctrlKey||e.metaKey||(null==t?void 0:t.closest('input,textarea,select,[contenteditable="true"]')))return;let n=e.code,s=["ArrowLeft","KeyA"].includes(n)?-1:["ArrowRight","KeyD"].includes(n)?1:0;s&&"running"===y.phase&&(e.preventDefault(),e.repeat||o(y,s)),["Escape","KeyP"].includes(n)&&["running","paused"].includes(y.phase)&&(e.preventDefault(),e.repeat||P()),!["Enter","Space"].includes(n)||(null==t?void 0:t.closest("button,a"))||"running"===y.phase||(e.preventDefault(),e.repeat||("paused"===y.phase?P():C()))},K=()=>"over"===y.phase&&(A(),L(),!0),_=e=>{if(m)return;let t=f?Math.min((e-f)/1e3,.05):0;if(f=e,w){if("running"===y.phase){for(g+=t;g>=1/120&&"running"===y.phase;)!function(e,t,n=Math.random){if("running"!==e.phase)return;let s=Math.max(0,Math.min(t,.05));e.time+=s,e.speed=Math.min(500,260+3*e.time);let a=e.speed*s;e.distance+=a/10,e.offset+=a,e.spawnIn-=a,e.spawnIn<=0&&(function(e,t=Math.random){let n=Math.min(2,Math.floor(3*t())),s=[0,1,2].filter(e=>e!==n),a=e.row>5&&t()>.45?2:1;t()>.5&&s.reverse();let l=["van","barrier","pothole","cone"];for(let n of s.slice(0,a)){let s=l[Math.min(3,Math.floor(t()*l.length))];e.entities.push({id:e.nextId++,kind:s,lane:n,y:-120})}for(let t=0;t<3;t++)e.entities.push({id:e.nextId++,kind:"wrench",lane:n,y:-110-66*t});e.row%4==1&&e.entities.push({id:e.nextId++,kind:e.row%8==1?"shield":"magnet",lane:n,y:-320}),e.row++}(e,n),e.spawnIn+=460),e.magnet=Math.max(0,e.magnet-s),e.invincible=Math.max(0,e.invincible-s),e.flash=Math.max(0,e.flash-s);let r=l[e.lane]-e.x;for(let t of(e.x+=Math.sign(r)*Math.min(Math.abs(r),1e3*s),e.sparks))t.life-=s,t.y+=.3*a;for(let t of(e.sparks=e.sparks.filter(e=>e.life>0),e.entities)){if(t.y+=a,t.collected)continue;let n=Math.abs(l[t.lane]-e.x),s=Math.abs(t.y-650);if(i(t.kind)){let[a,l]=c(t.kind);if(n<(a+58)*.41&&s<(l+100)*.4&&e.invincible<=0){if(t.collected=!0,e.flash=.25,e.shield)e.shield=!1,e.invincible=1.2;else{e.phase="over";break}}}else("wrench"===t.kind&&e.magnet>0&&s<135||n<46&&s<62)&&(t.collected=!0,"wrench"===t.kind&&e.parts++,"shield"===t.kind&&(e.shield=!0),"magnet"===t.kind&&(e.magnet=8),e.sparks.push({x:l[t.lane],y:t.y,life:.45,color:"wrench"===t.kind?"#ffd54a":"#35d8ea"}))}e.entities=e.entities.filter(e=>!e.collected&&e.y<970)}(y,1/120),g-=1/120;v=!0,!K()&&e-b>=100&&(L(),b=e)}v&&(!function(e,t,n,s){e.clearRect(0,0,720,800),e.fillStyle="#6b963f",e.fillRect(0,0,720,800);let a=t.offset%320;for(let t=-320+a;t<800;t+=320)e.drawImage(n.roadside,0,t,142,320),e.save(),e.translate(720,0),e.scale(-1,1),e.drawImage(n.roadside,0,t,142,320),e.restore(
1);for(let s of(e.drawImage(n.road,80,0,200,1536,142,0,436,800),e.fillStyle="#dddcd0",e.fillRect(147,0,4,800),e.fillRect(569,0,4,800),e.fillStyle="#efeee5",[290,430]))for(let n=-110+t.offset%110;n<800;n+=110)e.fillRect(s-3,n,6,52);let r=Math.floor(t.offset/250);for(let s=-2;s<5;s++){let a=250*s+t.offset%250;p(e,n,"tree",47,a,94,96),p(e,n,"roof",674,a+80,98,150),(s-r)%2==0?p(e,n,"roof",29,a+130,105,165):p(e,n,"tree",679,a+210,92,94)}for(let a of t.entities){let[r,i]=c(a.kind);if(a.y>-160&&a.y<960){let c=!s&&["shield","magnet"].includes(a.kind)?4*Math.sin(4*t.time):0;p(e,n,a.kind,l[a.lane],a.y+c,r,i)}}(t.shield||t.invincible>0)&&(e.fillStyle="#31d8ee25",e.strokeStyle="#63eeff",e.lineWidth=3,e.beginPath(),e.ellipse(t.x,650,48,70,0,0,2*Math.PI),e.fill(),e.stroke()),t.magnet>0&&(e.strokeStyle="#ffcc6760",e.lineWidth=2,e.setLineDash([5,8]),e.beginPath(),e.ellipse(t.x,650,93,100,0,0,2*Math.PI),e.stroke(),e.setLineDash([]));let i=s?0:Math.max(-.11,Math.min(.11,(l[t.lane]-t.x)/600));if(p(e,n,"car",t.x,650,68,109,i),!s){for(let n of t.sparks)e.globalAlpha=Math.min(1,3*n.life),e.strokeStyle=n.color,e.lineWidth=3,e.beginPath(),e.arc(n.x,n.y,15+(.45-n.life)*60,0,2*Math.PI),e.stroke();e.globalAlpha=1,t.flash>0&&(e.fillStyle=`rgba(255,60,35,${.6*t.flash})`,e.fillRect(0,0,720,800))}}(a,y,w,E.matches),v=!1)}h=requestAnimationFrame(_)};return u().then(e=>{m||(w=e,j(!1),v=!0,h=requestAnimationFrame(_))}).catch(()=>{m||(j(!1),N(!0))}),window.addEventListener("keydown",$),window.addEventListener("blur",D),window.addEventListener("resize",R),document.addEventListener("visibilitychange",F),()=>{m=!0,cancelAnimationFrame(h),n.current=null,window.removeEventListener("keydown",$),window.removeEventListener("blur",D),window.removeEventListener("resize",R),document.removeEventListener("visibilitychange",F)}},[m]);let L="running"!==E.phase||v||w;return(0,s.jsxs)("div",{ref:t,tabIndex:-1,className:"outline-none",children:[(0,s.jsxs)("div",{className:"mx-auto mb-4 flex max-w-[1110px] items-end justify-between gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"mb-1 text-[10px] font-bold uppercase tracking-[0.2em] text-[#797e80]",children:"ÐÑкада \xb7 3 полоÑÑ"}),(0,s.jsxs)("h1",{className:"text-2xl font-extrabold tracking-tight text-[#20282e] sm:text-3xl",children:["ÐланеÑа ",(0,s.jsx)("span",{className:"text-[#ef242b]",children:"ÐÑайв"})]})]}),(0,s.jsxs)("button",{type:"button",className:g,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.toggle()},disabled:!["running","paused"].includes(E.phase),"aria-label":"paused"===E.phase?"ÐÑодолжиÑÑ Ð¸Ð³ÑÑ":"ÐаÑза",children:["paused"===E.phase?"ÐÑодолжиÑÑ":"â
¡ ÐаÑза"," ",(0,s.jsx)("span",{className:"ml-2 hidden text-xs font-normal text-[#7a8082] sm:inline",children:"Esc"})]})]}),(0,s.jsxs)("div",{className:"mx-auto grid max-w-[1110px] grid-cols-1 items-start gap-6 lg:grid-cols-[180px_minmax(0,1fr)_180px]",children:[(0,s.jsxs)("aside",{className:"hidden pt-5 lg:block",children:[(0,s.jsx)("p",{className:"text-[11px] font-bold uppercase tracking-[0.16em] text-[#7a8082]",children:"Твой ÑекоÑд"}),(0,s.jsxs)("p",{className:"mt-2 text-3xl font-extrabold text-[#252d33]",children:[b(y)," ",(0,s.jsx)("span",{className:"text-base font-medium",children:"м"})]}),(0,s.jsx)("img",{src:"/images/game/trophy.png",alt:"",className:"-ml-3 mt-2 h-24 w-24 object-contain"}),(0,s.jsxs)("div",{className:"mt-6 border-t border-[#ddded9] pt-5",children:[(0,s.jsx)("h2",{className:"text-sm font-bold",children:"Ðак игÑаÑÑ"}),(0,s.jsx)("p",{className:"mt-2 text-xs leading-6 text-[#6c7376]",children:"ÐенÑй полоÑÑ, ÑобиÑай деÑали и обÑезжай пÑепÑÑÑÑвиÑ. Ðдин ÑÐ´Ð°Ñ â ÐºÐ¾Ð½ÐµÑ Ð·Ð°ÐµÐ·Ð´Ð°."}),(0,s.jsx)("p",{className:"mt-3 text-xs leading-6 text-[#6c7376]",children:"Ð©Ð¸Ñ Ð´Ð°ÑÑ Ð²ÑоÑой ÑанÑ."})]})]}),(0,s.jsxs)("div",{className:"mx-auto w-full max-w-[650px]",children:[(0,s.jsxs)("div",{className:"relative mx-auto aspect-[9/10] max-h-[calc(100dvh-210px)] min-h-[400px] w-full overflow-hidden rounded-2xl bg-[#444c4e] shadow-lg sm:min-h-[440px]",style:{maxWidth:"calc((100dvh - 210px) * 0.9)",minWidth:"min(100%, 360
1px)"},children:[(0,s.jsx)("canvas",{ref:e,width:720,height:800,className:"h-full w-full","aria-label":"ÐгÑÐ¾Ð²Ð°Ñ Ð´Ð¾Ñога. УпÑавление: ÑÑÑелки влево и впÑаво или A и D. ÐаÑза: Escape.",role:"img"}),(0,s.jsx)("div",{className:"pointer-events-none absolute left-[17%] right-[17%] top-3 flex justify-between gap-1.5","aria-label":"СÑÑÑ Ð¸Ð³ÑÑ",children:[["ÐиÑÑанÑиÑ",`${b(E.distance)} м`],["ÐеÑали",String(E.parts)],["СкоÑоÑÑÑ",`${Math.round(E.speed/3.6)} км/Ñ`]].map(([e,t])=>(0,s.jsxs)("div",{className:"min-w-0 flex-1 rounded-lg bg-[#faf9f3]/95 px-2 py-2 text-center shadow-sm",children:[(0,s.jsx)("p",{className:"text-[8px] font-bold uppercase tracking-wide text-[#788080] sm:text-[9px]",children:e}),(0,s.jsx)("p",{className:"mt-1 whitespace-nowrap text-sm font-extrabold text-[#263039] sm:text-base",children:t})]},e))}),"running"===E.phase&&(E.shield||E.magnet>0)?(0,s.jsxs)("div",{className:"pointer-events-none absolute bottom-3 left-0 right-0 flex justify-center gap-2",children:[E.shield?(0,s.jsx)("span",{className:"rounded-full bg-cyan-100 px-3 py-1 text-xs font-bold text-cyan-900",children:"Ð©Ð¸Ñ Ð°ÐºÑивен"}):null,E.magnet>0?(0,s.jsxs)("span",{className:"rounded-full bg-amber-100 px-3 py-1 text-xs font-bold text-amber-900",children:["ÐÐ°Ð³Ð½Ð¸Ñ \xb7 ",Math.ceil(E.magnet)," Ñ"]}):null]}):null,L?(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-[#18252c]/55 p-5 backdrop-blur-[3px]",children:(0,s.jsx)("div",{className:"w-full max-w-[330px] rounded-2xl bg-[#faf9f4] px-6 py-7 text-center shadow-xl",role:"region","aria-label":"ÐÐµÐ½Ñ Ð¸Ð³ÑÑ","aria-live":"polite",children:w?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h2",{className:"text-xl font-extrabold",children:"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ Ð¸Ð³ÑÑ"}),(0,s.jsx)("p",{className:"my-4 text-sm leading-6 text-[#697477]",children:"ÐÑовеÑÑ Ñоединение и попÑобÑй еÑÑ Ñаз."}),(0,s.jsx)("button",{type:"button",className:f,onClick:()=>h(e=>e+1),children:"ÐовÑоÑиÑÑ Ð·Ð°Ð³ÑÑзкÑ"})]}):v?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-xl font-extrabold",children:"ÐоÑовим ÑÑаÑÑÑâ¦"}),(0,s.jsx)("p",{className:"mt-3 text-sm text-[#697477]",children:"ÐагÑÑжаем маÑÐ¸Ð½ÐºÑ Ð¸ гоÑод"})]}):"ready"===E.phase?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("img",{src:"/images/game/car.png",alt:"ÐÑаÑÐ½Ð°Ñ Ð¼Ð°Ñинка ÐланеÑÑ",className:"mx-auto -mt-2 h-32 w-24 object-contain"}),(0,s.jsx)("h2",{className:"mt-2 text-2xl font-extrabold tracking-tight",children:"ÐоеÑ
али?"}),(0,s.jsxs)("p",{className:"mt-3 text-sm leading-6 text-[#697477]",children:["СобиÑай деÑали.",(0,s.jsx)("br",{}),"ÐбÑезжай пÑепÑÑÑÑвиÑ.",(0,s.jsx)("br",{}),"ÐоÑÑÐ°Ð²Ñ Ñвой ÑекоÑд."]}),(0,s.jsx)("button",{type:"button",className:`${f} mt-6 w-full`,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.start()},children:"ÐаÑаÑÑ Ð·Ð°ÐµÐ·Ð´ â"}),(0,s.jsx)("p",{className:"mt-3 text-[11px] text-[#7c8384]",children:"или нажми пÑобел \xb7 â â / A D"})]}):"paused"===E.phase?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-[#7b8282]",children:"Ðожно вÑдоÑ
нÑÑÑ"}),(0,s.jsx)("h2",{className:"mt-3 text-2xl font-extrabold",children:"ÐаÑза"}),(0,s.jsx)("p",{className:"my-5 text-sm text-[#697477]",children:"ТÑаÑÑа подождÑÑ."}),(0,s.jsx)("button",{type:"button",className:`${f} w-full`,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.toggle()},children:"ÐÑодолжиÑÑ â"}),(0,s.jsx)("p",{className:"mt-3 text-xs text-[#7c8384]",children:"Esc или пÑобел"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"text-xs font-bold uppercase tracking-[0.15em] text-[#ef242b]",children:M?"ÐовÑй ÑекоÑд!":"Ðаезд завеÑÑÑн"}),(0,s.jsxs)("h2",{className:"mt-3 text-4xl font-extrabold tracking-tight",children:[b(E.distance)," ",(0,s.jsx)("span",{className:"text-xl",children:"м"})]}),(0,s.jsxs)("p",{className:"mt-3 text-sm text-[#697477]",children:["СобÑано деÑалей: ",(0,s.jsx)("b",{className:"text-[#263039]",children:E.parts})]}),(0,s.jsxs)("p",{className:"mt-2 text-xs text-[#7c8384]",children:["РекоÑд: ",b(y)," м"]}),(0,s.jsx)("button",{type:"button",className:`${f} mt-6 w-full`,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.start()},children:"ÐÑÑ Ð·Ð°ÐµÐ·Ð´ â"}),(0,s.jsx)("p",{className:"mt-3 text-xs text-[#7c8384]",children:"или нажми пÑобел"})]})})}):null]}),(0,s.jsxs)("p",{className:"mt-4 text-center text-xs leading-6 text-[#71797a]",children:[(0,s.jsx)("span",{className:"font-bold text-[#344047]",children:"â â / A D"})," â Ñмена полоÑÑ ",(0,s.jsx)("span",{className:"mx-2 text-[#c0c3bf]",children:"\xb7"}),(0,s.jsx)("span",{className:"font-bold text-[#344047]",children:"Esc"})," â паÑза"]}),(0,s.jsxs)("div",{className:"mt-3 flex justify-center gap-3 sm:hidden",children:[(0,s.jsx)("button",{type:"button","aria-label":"ÐеÑеÑÑÑоиÑÑÑÑ Ð²Ð»ÐµÐ²Ð¾",className:g,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.move(-1)},children:"â"}),(0,s.jsx)("button",{type:"button","aria-label":"ÐеÑеÑÑÑоиÑÑÑÑ Ð²Ð¿Ñаво",className:g,onClick:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.move(1)},children:"â"})]})]}),(0,s.jsxs)("aside",{className:"hidden pt-5 lg:block",children:[(0,s.jsx)("h2",{className:"text-[11px] font-bold uppercase tracking-[0.16em] text-[#7a8082]",children:"ÐомоÑÑ Ð² пÑÑи"}),[["shield","ЩиÑ","СпаÑÐ°ÐµÑ Ð¾Ñ Ð¾Ð´Ð½Ð¾Ð³Ð¾ ÑдаÑа"],["magnet","ÐагниÑ","СобиÑÐ°ÐµÑ Ð´ÐµÑали 8 ÑекÑнд"],["wrench","ÐеÑали","СобеÑи как можно болÑÑе"]].map(([e,t,n])=>(0,s.jsxs)("div",{className:"mt-5 flex items-center gap-2",children:[(0,s.jsx)("img",{src:`/images/game/${e}.png`,alt:"",className:"h-14 w-14 shrink-0 object-contain"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-bold",children:t}),(0,s.jsx)("p",{className:"mt-1 text-[11px] leading-4 text-[#788080]",children:n})]})]},e)),(0,s.jsx)("p",{className:"mt-8 border-t border-[#ddded9] pt-5 text-[11px] leading-5 text-[#8b9090]",children:"РекоÑд ÑоÑ
ÑанÑеÑÑÑ Ð² ÑÑом бÑаÑзеÑе."})]})]})]})}}}]);
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.