(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))h(e);new MutationObserver(e=>{for(const o of e)if(o.type==="childList")for(const n of o.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&h(n)}).observe(document,{childList:!0,subtree:!0});function t(e){const o={};return e.integrity&&(o.integrity=e.integrity),e.referrerPolicy&&(o.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?o.credentials="include":e.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function h(e){if(e.ep)return;e.ep=!0;const o=t(e);fetch(e.href,o)}})();const l=10,c=7.5,d=4,C=17,E=300;class F{constructor(i,t,h){this.position={x:i,y:t},this.size={width:l,height:l},this.color=h}update(i){}draw(i){i.fillStyle=this.color,i.beginPath(),i.rect(this.position.x*this.size.width,this.position.y*this.size.height,this.size.width,this.size.height),i.fill()}}class B{constructor(i,t,h,e,o){this.position={x:t.x,y:t.y},this.radius=c,this.levelBounds=i,this.velocity={x:h.x,y:h.y},this.color=e,this.oppositeColor=o,this.drawCollisions=!1}update(i){this.position.x,this.position.y,this.position.x+=this.velocity.x,this.position.y+=this.velocity.y,this.position.xthis.levelBounds.width-this.radius&&(this.position.x=this.levelBounds.width-this.radius,this.velocity.x*=-1),this.position.y>this.levelBounds.height-this.radius&&(this.position.y=this.levelBounds.height-this.radius,this.velocity.y*=-1);const t={x:Math.floor(this.position.x/l),y:Math.floor(this.position.y/l)},h=i.filter(n=>n instanceof F).filter(n=>n.color==this.color).sort(n=>2*Math.random()).filter(n=>n.position.x>t.x-2&&n.position.xt.y-2&&n.position.y0?e=r.position.x*r.size.width-(this.position.x+this.radius):this.velocity.x<0&&(e=r.position.x*r.size.width+r.size.width-(this.position.x-this.radius)),this.velocity.y>0?o=r.position.y*r.size.height-(this.position.y+this.radius):this.velocity.y<0&&(o=r.position.y*r.size.height+r.size.height-(this.position.y-this.radius)),Math.abs(e)t.position.x*t.size.width&&i.x-this.radiust.position.y*t.size.height&&i.y-this.radius{W(),A()});window.addEventListener("resize",W);window.addEventListener("keydown",s=>{switch(s.code){case"F9":b=!b,b?m():z();break;case"Equal":g=Math.max(C,g-30),m(),z();break;case"Minus":g=g+30,m(),z();break;default:console.log(s.code);break}});function _(s,i){return s>=a.width/l/2?is.text(),s=>{M(u,y)}).then(s=>new DOMParser().parseFromString(s,"text/xml")).then(s=>{let i=[...s.getElementsByTagName("item")];for(let t=0;ts.x-t&&i.xs.y-t&&i.ys.update(p))}function O(s){p.forEach(i=>i.draw(s))}function P(){L.clearRect(0,0,a.width,a.height),O(L),window.requestAnimationFrame(P)}function W(s){const i=w.getBoundingClientRect();w.width=i.width,w.height=i.height,L.width=i.width,L.height=i.height}