',kt='" fill="#',Lt='" fill="none',It='" stroke="#',Et='" stroke-width="',Rt='" stroke-linecap="round',Ot='" stroke-linejoin="round',Dt='" opacity="',At='",Pt='" style="paint-order:normal',Tt='",Yt=tt("div");let Vt,Xt=e=>Yt.innerHTML+=``,Jt=["m126 65a62 62 0 0 1-63 62 62 62 0 0 1-62-62 62 62 0 0 1 62-62 62 62 0 0 1 63 62l-62 0.55z","m126 75a62 62 0 0 1-67 51 62 62 0 0 1-57-62 62 62 0 0 1 57-62 62 62 0 0 1 67 51l-62 11z","m123 85a62 62 0 0 1-70 40 62 62 0 0 1-52-62 62 62 0 0 1 52-62 62 62 0 0 1 70 40l-59 21z","m118 95a62 62 0 0 1-70 29 62 62 0 0 1-46-60 62 62 0 0 1 46-60 62 62 0 0 1 70 29l-54 31z","m112 104a62 62 0 0 1-69 19 62 62 0 0 1-41-59 62 62 0 0 1 41-59 62 62 0 0 1 69 19l-48 40z"],Kt=[{i:"0",w:74,h:74,y:0,d:"m37 1c-20 0-36 16-36 36s16 36 36 36c20 0 36-16 36-36s-16-36-36-36z"},{i:"1",w:46,h:69,y:0,d:"m45 1h-32l-11 32h8.6v35h35z"},{i:"2",w:70,h:69,y:0,d:"m52 1h-50v34h11v0.67c-8.4 1.9-13 8.6-13 17v16h66v-34h-13v-0.67c9.4-1.8 15-7.4 15-16 0-8.6-7.5-17-17-17z"},{i:"3",w:62,h:69,y:0,d:"m1 1v23h14v2.9h-14v16h14v2.9h-14v23h34c24 0 34-25 19-36 11-12 0.58-31-18-31h-35z"},{i:"4",w:69,h:69,y:0,d:"m1 19c0 18 14 33 32 34v16h35v-67h-67z"},{i:"5",w:68,h:69,y:0,d:"m51 68c9.2 0 17-8.2 17-17s-5.9-14-15-16v-0.58h13v-34h-64v34h12v2.9h-12v31h50z"},{i:"6",w:73,h:72,y:0,d:"m38 22c5.6-7.8 9.5-13 15-21h-36l-11 15c-3.8 5.4-5.8 13-5.8 19 0 20 13 36 36 36 22-0.096 35-14 35-33 0-12-6.2-23-22-28l-9.2 13z"},{i:"7",w:70,h:69,y:0,d:"m1.4 68h44c7.9-22 16-45 24-67h-67v32h12z"},{i:"8",w:67,h:74,y:0,d:"m38 73c26 0 37-26 20-39 12-13-1.2-33-21-33h-8.4c-20 0-32 20-20 33-17 12-5.4 39 20 39z"},{i:"9",w:73,h:72,y:0,d:"m35 50c-5.6 7.8-9.5 13-15 21h36l11-15c3.8-5.4 5.8-13 5.8-19 0-20-13-36-36-36-22 0.096-35 14-35 33 0 12 6.2 23 22 28l9.2-13z"},{},{},{},{i:"=",w:58,h:75,y:0,d:"m49 42h-40v-15h40z"},{},{},{i:"@",w:88,h:75,y:0,d:"m56 9.7q4.3 4.3 6.7 10 2.4 5.9 2.4 13 0 5.3-1.5 11-1.5 5.5-3.8 9.1h-19l-0.61-3q-2.2 1.4-4.2 2.3-2 0.84-5.8 0.84-6.2 0-10-5.1-3.8-5.1-3.8-14 0-4.6 1.3-8.1 1.3-3.5 3.5-6.1 2.1-2.4 5.1-3.8 3-1.4 5.9-1.4 2.5 0 4.5 0.95 1.9 0.91 3 1.9v-2.4h8.8v31h6.5q1.4-3 2-6.5 0.69-3.5 0.69-6.8 0-6.4-1.8-11-1.8-4.9-5-8.1-3.2-3.3-7.6-4.9-4.3-1.6-9.4-1.6-4.8 0-9.2 1.9-4.3 1.9-7.7 5.1-3.4 3.3-5.5 8.3-2.1 5-2.1 11 0 6.5 2 11 2 5 5.3 8.3 3.3 3.3 7.7 5 4.4 1.7 9.3 1.7 3.2 0 7.4-0.61 4.2-0.57 7.4-1.5v7.4q-3.5 0.8-7 1.2-3.5 0.42-7.7 0.42-7 0-13-2.4-5.9-2.4-10-6.8-4.3-4.4-6.7-11-2.4-6.2-2.4-14 0-7.1 2.5-13 2.5-6.1 6.9-11 4.3-4.4 10-7 6-2.6 13-2.6 6.7 0 12 2.4 5.8 2.4 10 6.6zm-17 33v-19q-1.6-0.8-2.9-1.1-1.3-0.38-3-0.38-3.7 0-5.6 3.2-2 3.2-2 8.8 0 6 1.6 8.9 1.6 2.9 5.4 2.9 2 0 3.5-0.76 1.5-0.8 3-2.3z"},{i:"A",w:88,h:75,y:0,d:"m1.8 74h85l-42-72z"},{i:"B",w:62,h:69,y:0,d:"m1 1v67h34c24 0 34-25 19-36 11-12 0.58-31-18-31h-35z"},{i:"C",w:63,h:73,y:0,d:"m11 11c-14 14-14 36 0 50 14 14 36 14 50 0l-25-25 25-25c-14-14-36-14-50 0z"},{i:"D",w:69,h:69,y:0,d:"m35 68c19 0 34-15 34-34 0-19-15-34-34-34h-34v67z"},{i:"E",w:58,h:69,y:0,d:"m1 1v67h56v-23h-14v-2.9h14v-16h-14v-2.9h14v-23z"},{i:"F",w:58,h:69,y:0,d:"m1 1v67h41v-20h15v-22h-14v-2.9h14v-23z"},{i:"G",w:73,h:73,y:0,d:"m37 37 18-31c-7.1-4-15-5.6-23-4.3-17 2.8-30 17-30 35 0 20 16 36 36 36 20 0 36-16 36-36z"},{i:"H",w:69,h:69,y:0,d:"m1 1v67h32v-25h2.9v25h32v-67h-32v25h-2.9v-25z"},{i:"I",w:37,h:69,y:0,d:"m1 1v67h35v-67z"},{i:"J",w:69,h:71,y:0,d:"m68 40v-39h-32v37h-2.9v-12h-32v14c0 40 67 40 67 0z"},{i:"K",w:69,h:69,y:0,d:"m1 1v67h66l-25-34 25-34z"},{i:"L",w:54,h:69,y:0,d:"m35 35v-34h-34v67h52v-34z"},{i:"M",w:69,h:73,y:0,d:"m1.2 72h67l-0.19-70-34 25-34-25z"},{i:"N",w:69,h:72,y:0,d:"m1 2.1v69h67v-67h-33v25z"},{i:"O",w:74,h:74,y:0,d:"m37 1c-20 0-36 16-36 36s16 36 36 36 36-16 36-36-16-36-36-36z"},{i:"P",w:62,h:69,y:0,d:"m33 1h-32v67h32v-13c15 0 27-12 27-27 0-15-12-27-27-27z"},{i:"Q",w:73,h:73,y:0,d:"m36 1c-20 0-35 16-35 35 0 19 16 35 35 35h35v-0.58l-20-19 2-2 9.6 9.4c5.1-6.1 8.3-14 8.3-23 0-20-16-35-35-35z"},{i:"R",w:62,h:69,y:0,d:"m33 1h-32v67h59l-9.9-19c6.4-5 10-13 10-21 0-15-12-27-27-27z"},{i:"S",w:70,h:69,y:0,d:"m18 1c-9.2 0-17 8.1-17 17 0 8.7 5.9 15 15 16v0.67h-14v34h50c19 0 23-29 3.6-33v-0.67h12v-34z"},{i:"T",w:63,h:69,y:0,d:"m49 35h13v-34h-61v34h14v34h34z"},{i:"U",w:69,h:71,y:0,d:"m1 36c0 19 15 34 34 34s34-15 34-34v-35h-67z"},{i:"V",w:88,h:75,y:0,d:"m87 1h-85l43 72z"},{i:"W",w:124,h:75,y:0,d:"m1.8 1 42 72 16-27-6.8-12 2.1-2c8 14 16 27 24 40l42-72h-120z"},{i:"X",w:75,h:69,y:0,d:"m1.7 1 19 34-19 34h71l-19-34 19-34h-71z"},{i:"Y",w:75,h:69,y:0,d:"m54 35 19-34h-71l19 34v34h34z"},{i:"Z",w:70,h:69,y:0,d:"m1.4 68h67v-32h-12l12-35h-67v32h12z"}],Mt=["f9c","f00","3ff","fc3"],Zt=[{w:32,f:"eee",s:"999"},{w:32,f:"ff0",s:"fd0"},{w:80,f:"eee",s:"999"},{w:80,f:"ff0",s:"fd0"}];starData=[{w:12,f:"555",s:"111"},{w:18,f:"999",s:"555"},{w:24,f:"eee",s:"999"}];for(let e=0;e${bt}m0.54 64c0-62 63-62 63-62s64 0 64 62v62l-16-17-16 17-16-17-16 17-16-17-16 17-16-17-15 17z${kt}${Mt[e]}${It}000${Et}3${Ct}${Bt}26${Nt}54${Ft}15${qt}27${kt}fff${Ht}${Bt}22${Nt}52${Ft}8.1${qt}15${kt}00f${Ht}${Bt}62${Nt}54${Ft}15${qt}27${kt}fff${Ht}${Bt}59${Nt}52${Ft}8.1${qt}15${kt}00f${Ht}${Wt}${Gt}`;Xt(`ghost${e}`)}Vt=`${xt}128${pt}128${zt}${bt}m0.55 64c0-62 63-62 63-62s64 0 64 62v62l-16-17-16 17-16-17-16 17-16-17-16 17-16-17-15 17z${kt}00f${It}000${Et}3.1${Ct}${Bt}22${Nt}52${Ft}8.1${qt}15${kt}fff"/>${Wt}${Bt}70${Nt}59${Ft}25${qt}24${kt}f00${It}a00${Ht}${Bt}26${Nt}71${Ft}25${qt}24${kt}f00${It}a00${Ht}${bt}m30 54c0.15-0.36 9.9-23 26-38 15-14 17-13 17-13l3.4 3.2c-17 9.9-17 24-8 42l-4.9 2.5s-5.7-11-6.4-19c-0.65-7.7 0.65-10 0.65-10-5 4.8-14 14-23 35z${kt}0f0${It}0a0${Rt}${Ot}${Et}3${Ct}${Wt}${Bt}36${Nt}67${Ft}6.9${qt}8${kt}f88${Ht}${Bt}80${Nt}52${Ft}6.9${qt}8${kt}f88${Ht}${bt}m28 50c4.2 6.7 9.6 4.6 11 4.1${kt}none${It}a00$${Rt}${Ot}${Et}3${Ct}${bt}m61 49c0.04-0.13 6.3 1.1 9-5.6${kt}none${It}a00$${Rt}${Ot}${Et}3${Ct}${Gt}`;Xt("cherry");Vt=`${xt}128${pt}128${zt}${At}(0 -169)${Lt}${It}ff0">${bt}m128 233a64 64 0 0 1-45-19 64 64 0 0 1-19-45${Et}32${Pt}${Ct}${bt}m3e-7 233a64 64 0 0 1 64 64${Et}32${Pt}${Ct}${Wt}${Gt}`;Xt("truchet");Vt=`${xt}1300${pt}375${zt}${At}(1.3 -1.3)${kt}ff0${It}aa0${Et}4.6">${bt}m111 264 54-94c-22-12-47-17-72-13-52 8.5-92 54-92 108 0 60 49 109 109 109s109-49 109-109z${Ct}${bt}m233 161v206h99v-76h8.8v76h99v-206h-99v76h-8.8v-76z${Ct}${bt}m561 154c-61 0-110 49-110 110s49 110 110 110 110-49 110-110-49-110-110-110z${Ct}${bt}m728 161c-28 0-51 25-51 51 0 27 18 45 47 50v2.1h-41v103h153c59 0 70-87 11-101v-2.1h36v-104z${Ct}${bt}m1038 264h40v-103h-186v103h43v103h103z${Ct}${bt}m1137 161c-28 0-51 25-51 51 0 27 18 45 47 50v2.1h-41v103h153c59 0 70-87 11-101v-2.1h36v-104z${Ct}${bt}m66 140c36 0 65-29 65-65s-29-65-65-65h-65v130z${Ct}${bt}m206 4.7c-38 0-69 31-69 69s31 69 69 69 69-31 69-69-31-69-69-69z${Ct}${bt}m284 6v133h130v-130h-65v48z${Ct}${bt}m515 75h25v-65h-117v65h27v65h65z${Ct}${bt}m690 140c36 0 65-29 65-65s-29-65-65-65h-65v130z${Ct}${bt}m764 9.2v130h68v-130z${Ct}${bt}m843 9v130h108v-44h-27v-5.6h27v-31h-27v-5.6h27v-44z${Ct}${bt}m1126 75h25v-65h-117v65h27v65h65z${Ct}${bt}m1227 4.7c-38 0-69 31-69 69s31 69 69 69 69-31 69-69-31-69-69-69z${Ct}${Wt}${Gt}`;Xt("logo");Vt=`${xt}64${pt}64${zt}${St}ff0${It}880${Et}2">${bt}m1 43v20h20l-6-6 7-7-8-8-7 7z${Ct}${bt}m62 43v20h-20l6-6-7-7 8-8 7 7z${Ct}${bt}m1 22v-20h20l-6 6 7 7-8 8-7-7z${Ct}${bt}m62 22v-20h-20l6 6-7 7 8 8 7-7z${Ct}${Wt}${Gt}`;Xt("fullscreen");Vt=`${xt}64${pt}64${zt}${St}ff0${It}880${Et}2">${bt}m41 3v20h20l-6-6 7-7-8-8-7 7z${Ct}${bt}m22 3v20h-20l6-6-7-7 8-8 7 7z${Ct}${bt}m41 62v-20h20l-6 6 7 7-8 8-7-7z${Ct}${bt}m22 62v-20h-20l6 6-7 7 8 8 7-7z${Ct}${Wt}${Gt}`;Xt("windowed");let jt=()=>{let t=1,i=100,l=0,r=i,h=[],s=0,f=Yt.getElementsByTagName("*");for(let e=0;eo){if(t>l)l=t;r+=s;t=1;i+=s;s=g}if(g>s)s=g;h.push({image:a,x:t,y:i});oe[$]={id:$,x:t,y:i,width:d,height:n};t+=c}ge=e.createElement("canvas");ge.width=l;ge.height=r+s;ye=ge.getContext("2d");for(let e=0;eoe[e],_t=e=>{let t=0;for(let i=0;i=Kt.length){t+=V}else{t+=Kt[l].w+Y}}return t},ei=e=>{let t=0,i=0,l,r;for(let a=0;a=Kt.length){t+=V}else{r=Kt[l];t+=r.w+Y;if(r.h>i)i=r.h}}return{w:t,h:i}},ti=(e,t,i,l)=>{let r,a,h;for(let s=0;s=Kt.length){e+=V}else{h=Kt[a];r=Qt(h.i);l.drawImage(ge,r.x,r.y,r.width,r.height,e,t,r.width,r.height);e+=r.width+Y}}},ii=e=>(o-_t(e))/2,li=e=>(o-e)/2,ri=e=>{re=e;le=1;fi(w)},ai=e=>{re=e;le=0;fi(v)},hi=()=>{if(Q.onClose)Q.onClose(Q);_e(Q.div,false);Q=null;si(_)},si=e=>{if(Q){_=e;et(Q.div,false);if(Q.beforeClose)Q.beforeClose(Q);ri(hi)}else{if(!e.created){let t,i,l,r,a=tt("div");a.classList.add("m","a","h","d");ce.appendChild(a);e.div=a;for(let h=0;h{s.onClick(e)};l.id="b"}}else{r=ei(s.l);i=it(r.w,r.h);ti(0,0,s.l,i.ctx);l=tt("img");l.id=s.id;l.classList.add("a");l.src=i.toDataURL();a.appendChild(l);Qe(l,s.c?li(r.w):s.x,s.y);if(s.onClick){l.onclick=()=>{s.onClick(e)};l.id="b"}s.i=l}}e.created=true}if(e.beforeOpen)e.beforeOpen(e);_e(e.div,true);et(e.div,false);ai((()=>{Q=e;if(e.onOpen)e.onOpen(e);et(e.div,true)}))}};toggleWidgetVisibilityByIndex=(e,t)=>{for(let i=0;i{if(e.i){e.l=t;let i=e.i,l=ei(e.l),r=it(l.w,l.h);ti(0,0,e.l,r.ctx);i.src=r.toDataURL();Qe(i,e.c?li(l.w):e.x,e.y)}};e.onvisibilitychange=()=>{if(document.visibilityState==="hidden"){J=true}else{Z=Date.now();J=false}};t.onpointerdown=e=>{if(Je){if(e.clientX{if(Je){if(e.clientX{if(Je){ft(false);let t=e.keyCode;if(t===37||t===Ue.c.l.k){Ke=true}else if(t===39||t===Ue.c.r.k){Me=true}}};t.onkeyup=e=>{let t;if(Ye){t=e.key.toUpperCase();Ve.k=e.keyCode;Ve.c=t;setWidgetLabel(Xe,t);Ye=false;for(let e=0;eft(true);t.onbeforeunload=ht;t.onload=()=>{ce=je("g");gt([2.07,706,.01,.01,.02,2,.87,0,0,0,0,0,0,24,0,.06,.9,.01,0]);gt([.35,1,.01,.01,.01,2,.49,0,0,0,0,.07,0,-6.6,.4,.25,1,0,0]);gt([1,568,.05,.3,.32,0,1.32,0,0,47,.08,.11,.2,0,0,0,.65,.21,0]);gt([.3,91,.02,.04,.07,2,.63,18,0,0,0,0,.9,0,0,0,.87,.01,0]);gt([1.1,684,.07,.19,.38,1,1.44,0,-3.4,-22,.03,.1,0,0,0,0,.63,.2,.08]);gt([1.03,171,.02,.24,.44,2,1.65,1.2,.9,131,.02,.02,0,0,.1,0,.72,.15,.18]);gt([1,182,.1,.27,.44,2,.16,0,0,457,.08,.04,0,7.8,0,0,.68,.2,0]);gt([1,374,.07,.28,.47,2,1.92,0,7.9,100,.02,.11,0,9.5,0,0,.98,.29,0]);gt([1,.05,262,0,.2,.35,2,1.39,9.4,0,18,.15,.11,0,0,0,0,.53,.22,0]);gt([1.19,79,.07,.15,.49,2,1.41,0,0,244,.02,.04,0,30,0,.08,.94,.27,0]);jt();Ue=i.getItem(l);!Ue?st():Ue=JSON.parse(Ue);Pe=Ue.b;for(let e=0;e<96;e++){Ze.push([h()*o,h()*870])}e.body.removeChild(je("l"));oi();de=it(o,g);de.id="c";ce.appendChild(de);ne=de.ctx;$t();si(gi);Z=Date.now();ui()};let fi=e=>X=e,$i=()=>ne.clearRect(0,0,o,g),di=e=>{We+=e;if(!Te){if(We>Pe){Te=true;yt(W);let e=0,t=600;for(let i=0;i<30;i++){He.push({x:o/2,y:G,vx:d(e)*t,vy:n(e)*t,r:28,i:"star"});e+=$/30}}}},ni=(e=false)=>{if(e){We=0;Ne=0;Oe=10;De=5;Ae=200;K=false;Te=false}Ne++;me=0;xe=0;ue=false;Ee=false;Ce=20;be=false;ze=false;Ke=false;Me=false;Se={x:o/2,y:P,r:64,f:[0,1,2,3,4,3,2,1],c:0,facingLeft:false,draw:true};Ie=[];let t=1;for(let e=0;e<4;e++){Ie.push({id:e,x:at(24,o-48),y:-at(128,g),vx:h()<.5?-Ae:Ae,vy:0,r:64,gravity:5,multiplier:t,facingLeft:false,turning:false,turningLeft:false,turnTimer:h()*Oe+De,munched:false,canCollide:true,scared:false,draw:true,frames:[e,4,e,4,e,4]});t+=.25}Oe=rt(Oe-1.97,5,10);De=rt(De-.09,3,5);Ae=rt(Ae-17,100,200);ve=[];pe=[];bonusImages=[];He=[];si(vi)};let ci=()=>{fe.clearRect(0,0,o,890);fe.save();fe.globalAlpha=.075;fe.beginPath();fe.rect(0,0,o,890);fe.clip();let e=Qt("truchet");for(let t=0;t<896/128;t++){for(let i=0;i{se=it(o,g);se.id="c";fe=se.ctx;ce.appendChild(se);$e=fe.createLinearGradient(0,890,0,900);$e.addColorStop(0,"#001");$e.addColorStop(.3,"#00f");$e.addColorStop(1,"#001");fe.fillStyle="#001";fe.fillRect(0,0,o,890);fe.fillStyle="#000014";fe.fillRect(0,890,o,g-890);fe.fillStyle=$e;fe.fillRect(0,890,o,10)};let gi={onOpen:()=>{fi(u)},beforeOpen:e=>{setWidgetLabel(e.widgets[1],`BEST ${Pe}`);te=true;ft(true);e.widgets[4].i.style.opacity=".4";se.ctx.clearRect(0,0,o,890)},widgets:[{t:"img",y:32,c:true,regions:["logo"]},{t:"a",y:475,c:true,l:""},{t:"a",y:615,c:true,l:"OPTIONS",onClick:()=>{yt(k);si(yi)}},{t:"a",y:750,c:true,l:"PLAY",onClick:()=>{yt(k);ft(false);ni(true)}},{t:"img",y:1024,c:true,regions:["tag"]},{t:"img",x:o-80,y:16,regions:["fullscreen","windowed"],onClick:t=>{yt(k);let i=t.widgets[5];if(ee){if(document.exitFullscreen){document.exitFullscreen()}else if(document.webkitExitFullscreen){document.webkitExitFullscreen()}i.i.src=i.images[0]}else{let t=e.documentElement;if(t.requestFullscreen){t.requestFullscreen()}else if(t.webkitRequestFullscreen){t.webkitRequestFullscreen()}i.i.src=i.images[1]}ee=!ee}}]},yi={onOpen:()=>{fi(m)},beforeOpen:e=>{setWidgetLabel(e.widgets[2],Ue.c.l.c);setWidgetLabel(e.widgets[5],Ue.c.r.c);for(let t=4;t<9;t++){_e(e.widgets[t].i,true)}_e(e.widgets[10].i,false);let t;Ue.a?t="ENABLED":t="DISABLED";setWidgetLabel(e.widgets[8],t)},widgets:[{t:"a",y:64,c:true,l:"OPTIONS"},{t:"a",x:o/2-(128+_t("LEFT")),y:250,l:"LEFT"},{t:"a",x:850,y:250,l:"",c:true,id:"lk"},{t:"a",x:1100,y:250,l:"CHANGE",onClick:e=>{yt(k);Ye=true;Ve=Ue.c.l;Xe=e.widgets[2];for(let t=4;t<9;t++){_e(e.widgets[t].i,false)}_e(e.widgets[10].i,true)}},{t:"a",x:o/2-(128+_t("RIGHT")),y:400,l:"RIGHT"},{t:"a",x:850,y:400,l:"",c:true,id:"rk"},{t:"a",x:1100,y:400,l:"CHANGE",onClick:e=>{yt(k);Ye=true;Ve=Ue.c.r;Xe=e.widgets[5];toggleWidgetVisibilityByIndex(e.widgets,[1,2,3,7,8,-10])}},{t:"a",x:530,y:550,l:"SOUND"},{t:"a",x:1040,y:550,l:"W",id:"ts",onClick:()=>{Ue.a=!Ue.a;let e;Ue.a?e="ENABLED":e="DISABLED";setWidgetLabel(yi.widgets[8],e);Ge=true;yt(k)}},{t:"a",y:750,c:true,l:"BACK",onClick:()=>{yt(k);ht();si(gi)}},{t:"a",y:550,c:true,l:"PRESS NEW KEY A=Z 0=9",h:true}]},vi={onOpen:()=>{fi(p)},beforeOpen:e=>{wt();$i();fe.clearRect(0,0,o,890);yt(O);ie=2;te=false;setWidgetLabel(e.widgets[0],`LEVEL ${Ne}`)},widgets:[{t:"a",y:750,c:true,l:"",id:"ll"}]},wi={onOpen:()=>{qe=false;Je=true;fi(C)},beforeOpen:e=>{_e(e.widgets[0].i,false);ci()},beforeClose:()=>{Je=false;ae=true;te=false},widgets:[{t:"a",y:g/2,c:true,l:"YOU DIED TO GHOSTS",h:true}]};let ui=()=>{if(!J){scoreUpdateRequired=false;M=Date.now();j=(M-Z)/1e3;Z=M;let e=()=>{for(let e=He.length-1;e>=0;e--){const t=He[e];if(t.gy){t.vy+=t.gy}t.x+=t.vx*j;t.y+=t.vy*j;if(t.y>=g+80||t.y<-80||t.x<-80||t.x>o+80){He.splice(e,1)}else{textureRegion=Qt(t.i);ne.drawImage(ge,textureRegion.x,textureRegion.y,textureRegion.width,textureRegion.height,t.x-t.r,t.y-t.r,textureRegion.width,textureRegion.height)}}};switch(X){case p:ie-=j;if(ie<=0){fi(y);si(wi)}break;case b:$i();e();postPlayCounter-=j;if(postPlayCounter<=0){fi(y);si(gi)}break;case C:let t,i,l,s;playerY=Se.y-Se.r,collidedWithPlayer=e=>{if(e.canCollide&&e.y+e.r>playerY){return r.hypot(Se.x-e.x,Se.y-e.y)<=Se.r+e.r}return false},drawActor=e=>{if(e.draw&&!K){ne.save();if(e.facingLeft){ne.translate(e.x-e.r,0);ne.scale(-1,1);ne.drawImage(ge,i.x,i.y,i.width,i.height,0,e.y-e.r,-i.width,i.height)}else{ne.drawImage(ge,i.x,i.y,i.width,i.height,e.x-e.r,e.y-e.r,i.width,i.height)}ne.restore()}};$i();if(!ue){we-=j;if(we<=0){we+=B;if(me<244){ve.push({x:at(24,o-48),y:-at(32,g),vy:N,r:16,bounced:false,gravity:F,canCollide:true,draw:true,f:[0],c:0});me++;xe++}else if(me===244){for(let e=0;e=0;e--){let t=ve[e];t.vy=rt(t.vy+t.gravity,-500,500);t.y+=t.vy*j;if(t.bounced){if(t.y>=g+96){t.x=at(24,o-48);t.y=-96;t.gravity=F;t.bounced=false}}else{if(t.y>=950){t.y-=t.vy*j;t.vy=-t.vy;t.gravity=14+h();t.bounced=true}}if(collidedWithPlayer(t)){ve.splice(e,1);t.draw=false;if(t.isPill){di(50);yt(D);for(let e=0;e=1)t.c-=1}}if(Ee){Re-=j;if(Re<=0){Ee=false;for(let e=0;e=0;e--){let t=Ie[e];if(t.munched){t.turning=false;t.facingLeft=false;t.vx=0;t.gravity=-20}else{if(t.turning){if(t.turningLeft){t.vx-=1*t.multiplier;if(t.vx<=-Ae){t.vx=-Ae;t.turning=false}}else{t.vx+=1*t.multiplier;if(t.vx>=Ae){t.vx=Ae;t.turning=false}}}else{t.turnTimer-=j;if(t.turnTimer<=0){t.turningLeft=t.vx>0;t.turnTimer=h()*Oe+De;t.turning=true}}t.x+=t.vx*t.multiplier*j;if(t.x<=-t.r){t.x+=o+t.r*2}else if(t.x>o+t.r){t.x-=o+t.r*2}}t.vy=rt(t.vy+t.gravity*t.multiplier,-650,650);t.y+=t.vy*t.multiplier*j;if(t.y>=950){t.y-=t.vy*j;t.vy=-t.vy;yt(E)}if(t.scared){if(collidedWithPlayer(t)){yt(I);t.munched=true;t.canCollide=false;di(Be);He.push({x:t.x,y:t.y,vx:0,vy:-600,r:6,i:`b${Be}`});Be=Be*2}if(Re<=2){i=Qt(`ghost${t.frames[a(t.frames.length*(Re%1))]}`)}else{i=Qt(`ghost4`)}}else{i=Qt(`ghost${e}`);if(collidedWithPlayer(t)){for(let e=0;e<200;e++){l=h()*$;s=h()*500+1200;He.push({x:Se.x,y:Se.y,vx:d(l+$/2)*s,vy:n(l+$/2)*s,gy:h()*8+24,s:s,r:6,i:"dot320"})}yt(R);Se.draw=false;ae=false;Je=false;ae=false;K=true;if(Te){Pe=We;Ge=true}_e(wi.widgets[0].i,true);postPlayCounter=2;fi(b)}}if(t.munched){i=Qt("eyes");if(t.y<=-g/2){t.munched=false;t.canCollide=true;t.gravity=5;t.scared=false}}t.facingLeft=t.vx>0;drawActor(t)}e();if(Ke){Se.x-=T*j;if(Se.x<=-Se.r)Se.x+=o+Se.r*2;Se.facingLeft=true}else if(Me){Se.x+=T*j;if(Se.x>o+Se.r)Se.x-=o+Se.r*2;Se.facingLeft=false}i=Qt(`player${Se.f[a(Se.f.length*Se.c)]}`);Se.c+=j*8;if(Se.c>=1)Se.c=0;if(!qe)drawActor(Se);if(!ze){Ce-=j;if(Ce<=0){ke=H;Le={x:o/2,y:P,r:48,canCollide:true};ze=true}}else if(!be&&!K){ke-=j;if(ke<=0)be=true;i=Qt("cherry");ne.drawImage(ge,i.x,i.y,i.width,i.height,Le.x-Le.r,Le.y-Le.r,i.width,i.height);if(collidedWithPlayer(Le)){Le.canCollide=false;be=true;yt(A);di(3200);He.push({x:o/2,y:P,vx:0,vy:-600,r:6,i:"b3200"})}}let f=`${We}`;ti(ii(f),G,f,ne);break;case u:break;case w:le-=j*2;if(le<=0){le=0;fi(y);re()}lt(le);break;case v:le+=j*2;if(le>=1){le=1;fi(y);re()}lt(le);break;default:break}if(te){$i();let e,t,i=0;while(i=o)x=-32;t[0]=x;e=Qt(`star${z}`);ne.drawImage(ge,e.x,e.y,e.width,e.height,x,t[1],e.width,e.height)}ne.save();ne.globalAlpha=.3;ne.translate(0,g);ne.scale(1,-.75);ne.drawImage(de,0,700,o,180,0,0,o,180);ne.restore()}}requestAnimationFrame(ui)};