-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
1 lines (1 loc) · 34.7 KB
/
index.html
1
<!doctype html><html><head><meta charset="utf-8"><meta name="monetization" content="$ilp.uphold.com/NanhqQLkB9Y9"><style>*{margin:0;padding:0;color:#ddd;font:28px "Arial Black"}b,body,html,nav,p,span{transition:all .1s;overflow:hidden;position:absolute;display:flex;flex-direction:column;justify-content:center;align-items:center;user-select:none}b,body,html,span{width:100%;height:100%}div,input{width:100%;display:flex;justify-content:center}h1{font-size:2.5em}h6{font-size:.7em;color:#888}a:active,a:hover{background:#fff}a{color:#444;margin-bottom:.5em;background:#ddd;width:100%;line-height:2em;text-align:center;user-select:none}input{margin-bottom:.5em;background:0 0;border:none;border-bottom:3px solid #ddd}#h{top:0;left:.4em}#s{top:0;right:.4em}#c{right:.4em;bottom:.2em}#r{opacity:.5;left:.4em;bottom:.2em}#r:hover{opacity:1}#a{opacity:.4;border:2px solid #ddd;border-radius:50%;bottom:15%;right:15%;width:2em;line-height:2em;text-align:center}.hit{background:#722}[hidden]{display:none}</style></head><body><span hidden>✛</span><b></b><nav><h1>_INVADERS</h1><a>START</a><a>CO-OP</a><a hidden></a><a></a></nav><nav hidden><a>BACK</a><h6></h6><input placeholder="CODE"><input placeholder="OFFER"><input placeholder="ANSWER"><div><a>HOST</a> <a>JOIN</a></div><a></a><a>START</a></nav><nav hidden><h1>GAME OVER</h1><a>TRY AGAIN</a></nav><p id="r">📷</p><p id="s"></p><p hidden id="h"></p><p hidden id="c">𝒞</p><p hidden id="a">A</p><canvas></canvas><script src="/socket.io/socket.io.js"></script><script>function t(t,e,s=0,i=0,h=t.length-s){for(let r=0;r<h;++r)e[i+r]=t[s+r];return e}function e(t,e,s){for(let i=0;i<t.length;++i)s[i]=t[i]*e;return s}function s(t,e,s,i){let h=e.length/t,r=s.length/t,n=0;for(let o=0;o<r;++o)for(let r=0;r<h;++r){n=0;for(let i=0;i<t;++i)n+=e[i*h+r]*s[o*t+i];i[o*h+r]=n}return i}let i=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function h(t){for(let e=0;e<16;++e)t[e]=e%5?0:1;return t}function r(e,h,r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]){return t(s(4,e,h,i),r)}function n(t=0,e=0,s=0,i=0){return[t,e,s,i]}n(),c();let o=n(),a=n();function c(t=0,e=0,s=0){return[t,e,s]}function u(t,e=0,s=0,i=0){return t[0]=e,t[1]=s,t[2]=i,t}function l(t,e,s=c()){return((t,e,s)=>{for(let i=0;i<t.length;++i)s[i]=t[i]+e[i];return s})(t,e,s)}function f(t,s,i=c()){return e(t,s,i)}function d(e,i,h=c()){return((t,e=0,s=0,i=0,h=0)=>{t[0]=e,t[1]=s,t[2]=i,t[3]=h})(o,i[0],i[1],i[2],1),t(s(4,e,o,a),h,0,0,3)}let m=[0,0,0,1],p=[0,0,0,1];function v(t,s,i=[0,0,0,1]){return e(t,Math.sin(s/2),i),i[3]=Math.cos(s/2),i}function M(t,e,s=[0,0,0,1]){let i=t[0],h=t[1],r=t[2],n=t[3],o=e[0],a=e[1],c=e[2],u=e[3];return s[0]=n*o+i*u+h*c-r*a,s[1]=n*a+h*u+r*o-i*c,s[2]=n*c+r*u+i*a-h*o,s[3]=n*u-i*o-h*a-r*c,s}function w(e,s,i=c()){return t(s,m,0,0,3),m[3]=0,M(M(e,m,m),((t,e=[0,0,0,1])=>{let s=1/((t=>((t,e)=>{let s=0;for(let i=0;i<t.length;++i)s+=t[i]*e[i];return s})(t,t))(t)||1);return e[0]=-t[0]*s,e[1]=-t[1]*s,e[2]=-t[2]*s,e[3]=t[3]*s,e})(e,p),m),t(m,i,0,0,3)}function g(e,s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]){return h(s),t(e,s,0,12,3),s}function y(t,e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]){return h(e),e[0]=t[0],e[5]=t[1],e[10]=t[2],e}function E(t,e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]){return((t,e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])=>{let s=t[0]*t[0],i=t[0]*t[1],h=t[0]*t[2],r=t[1]*t[1],n=t[1]*t[2],o=t[2]*t[2],a=t[3]*t[0],c=t[3]*t[1],u=t[3]*t[2];return e[0]=1-2*(r+o),e[1]=2*(i+u),e[2]=2*(h-c),e[4]=2*(i-u),e[5]=1-2*(s+o),e[6]=2*(n+a),e[8]=2*(h+c),e[9]=2*(n-a),e[10]=1-2*(s+r),e[3]=e[7]=e[11]=e[12]=e[13]=e[14]=0,e[15]=1,e})(t,e)}c(),c(),c();class b{constructor(t,e){this.min=t,this.max=e}}let C=c(),N=c();function x(t=c(),e=c()){return new b(t,e)}function O(e,s,i=x()){for(let t=0;t<3;++t){C[t]=s[12+t],N[t]=s[12+t];for(let i=0;i<3;++i){let h=e.min[i]*s[4*i+t],r=e.max[i]*s[4*i+t];C[t]+=Math.min(h,r),N[t]+=Math.max(h,r)}}return t(C,i.min),t(N,i.max),i}let R=`stun:stun${5*Math.random()|0||""}.l.google.com:19302`,k=[-20,0,-50],A=[20,50,50],P=[0,-15,0],S=x([-.5,0,-.5],[.5,2,.5]),F=x([-16,0,30],[16,0,50]),z=x([-.5,0,-.5],[.5,1.5,.5]),T=x([-.6,2.4,-.6],[.6,3.6,.6]),I=x([-.6,.4,-.6],[.6,1.6,.6]),L=[.13,.16,.18,1],_=[.92,.92,.92,.5],D=[.3,.15,.15,.5],J=[.89,.38,.17,.5],G=[.53,.84,.96,.7],W=[.95,.85,.45,.7],B=[.94,.87,.71,1],H=[.18,.13,.18,1],U=[.18,.13,.18,1],V=[.18,.15,.15,1],K=[.29,.69,.78,1],$=[.78,.74,.68,-.5],q=`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.${btoa('{"sub":"did:ethr:0xFeA36a9eA4B45f4f920e4097c1eD60C6Ce34F62F","iss":"nft-storage","iat":1630640955680,"name":"_INVADERS"}')}.Du37jRGc3Fg25Ut7tT7JGIa0BKNHXZeXKJqUm9GZakE`;function X(t,e){for(let s of t.i)d(e,s,s);return t}function j(t,e){let s=t.i.length;for(let s of e.i)t.i.push([...s]);for(let s of e.c)t.c.push([...s]);for(let i of e.o)t.o.push([i[0]+s,i[1]+s,i[2]+s]);return t}function Y(t,e,s,i){return{i:[[-t,+e,+s],[+t,+e,+s],[+t,-e,+s],[-t,-e,+s],[+t,+e,-s],[-t,+e,-s],[-t,-e,-s],[+t,-e,-s]],o:[[2,1,0],[2,0,3],[6,5,4],[6,4,7],[7,4,1],[7,1,2],[3,0,5],[3,5,6],[1,4,5],[1,5,0],[6,7,2],[3,6,2]],c:[,,,,,,,,].fill(i)}}function Z(t,e){return E(v(t,e))}let Q=X(Y(100,.05,100,B),g([0,-.05,0])),tt=Y(.5,.5,.4,_);j(tt,X(Y(.3,.3,.2,K),g([0,0,.25]))),j(tt,X(Y(.15,.15,.2,U),g([0,0,.28]))),X(tt,g([0,1,0]));let et=Y(.5,.5,.4,_);j(et,X(Y(.3,.3,.2,[.84,.23,.18,1]),g([0,0,.25]))),j(et,X(Y(.15,.15,.2,U),g([0,0,.28]))),X(et,g([0,1,0]));let st=X(X(Y(.6,.1,.05,H),Z([0,0,1],-Math.PI/6)),g([-1,.7,0]));j(st,X(X(Y(.6,.1,.03,H),Z([0,0,1],Math.PI/4)),g([-1.8,.5,0]))),j(st,X(X(Y(.5,.1,.02,H),Z([0,0,1],Math.PI/4)),g([-1.5,.4,0]))),j(st,X(X(Y(.4,.1,.01,H),Z([0,0,1],Math.PI/4)),g([-1.2,.3,0]))),X(st,g([0,1,0]));let it=j({i:[],o:[],c:[]},et),ht=X(X(X(Y(.5,.5,.5,H),Z([0,0,1],Math.PI/4)),Z([1,0,0],Math.PI/4)),g([0,0,-.5]));j(ht,X(X(X(Y(.5,.5,.5,H),Z([0,0,1],-Math.PI/4)),Z([1,0,0],-Math.PI/4)),g([0,0,-.5]))),X(ht,g([0,1,0])),j(it,ht);let rt=Y(.2,.1,.3,H),nt=Y(.4,.4,.3,B),ot=Y(.3,.3,.2,K);X(nt,g([0,1.7,0])),X(ot,g([0,.7,0])),j(nt,ot);let at=Y(.1,.1,.1,[.89,.38,.17,-.95]);X(at,Z([0,0,1],Math.PI/4)),X(at,y([1,1.5,.38])),X(at,g([0,.95,0])),j(at,Y(.04,.8,.04,V));let ct={i:[],o:[],c:[]};j(ct,X(Y(.1,.012,.012,$),g([0,0,-.105]))),j(ct,X(Y(.12,.01,.012,$),g([0,0,.105]))),j(ct,X(Y(.01,.01,.12,$),g([-.105,0,0]))),j(ct,X(Y(.01,.01,.12,$),g([.105,0,0])));let ut=j({i:[],o:[],c:[]},ct);X(ct,y([.8,1,.8])),X(ct,g([0,.09,0])),j(ut,ct),X(ct,y([.8,1,.8])),X(ct,g([0,.09,0])),j(ut,ct),j(ut,X(Y(.07,.07,.07,[.95,.85,.45,-.9]),g([0,.35,0]))),X(ut,g([0,.5,0])),X(ut,Z([0,1,0],Math.PI/24)),j(ut,Y(.015,.8,.015,V));let lt=[1.12,,219,.02,.06,0,3,1.27,-6.6,,,,.04,,,,,.88,.03,.3],ft=[1.31,,126,,.07,.22,4,.29,1.5,,,,.07,.2,,.3,,.76],dt=(t,...e)=>{let s=t.createBufferSource(),i=t.createBuffer(e.length,e[0].length,44100);return e.map(((t,e)=>i.getChannelData(e).set(t))),s.buffer=i,s},mt=(t=1,e=.05,s=220,i=0,h=0,r=.1,n=0,o=1,a=0,c=0,u=0,l=0,f=0,d=0,m=0,p=0,v=0,M=1,w=0,g=0)=>{let y,E,b=2*Math.PI,C=a*=500*b/44100**2,N=(0<m?1:-1)*b/4,x=s*=(1+2*e*Math.random()-e)*b/44100,O=[],R=0,k=0,A=0,P=1,S=0,F=0,z=0;for(c*=500*b/44100**3,m*=b/44100,u*=b/44100,l*=44100,f=44100*f|0,E=(i=99+44100*i)+(w*=44100)+(h*=44100)+(r*=44100)+(v*=44100)|0;A<E;O[A++]=z)++F%(100*p|0)||(z=n?1<n?2<n?3<n?Math.sin((R%b)**3):Math.max(Math.min(Math.tan(R),1),-1):1-(2*R/b%2+2)%2:1-4*Math.abs(Math.round(R/b)-R/b):Math.sin(R),z=(f?1-g+g*Math.sin(2*Math.PI*A/f):1)*(0<z?1:-1)*Math.abs(z)**o*t*.3*(A<i?A/i:A<i+w?1-(A-i)/w*(1-M):A<i+w+h?M:A<E-v?(E-A-v)/r*M:0),z=v?z/2+(v>A?0:(A<E-v?1:(E-A)/v)*O[A-v|0]/2):z),y=(s+=a+=c)*Math.sin(k*m-N),R+=y-y*d*(1-1e9*(Math.sin(A)+1)%2),k+=y-y*d*(1-1e9*(Math.sin(A)**2+1)%2),P&&++P>l&&(s+=u,x+=u,P=0),!f||++S%f||(s=x,a=C,P=P||1);return O},pt=(t,...e)=>dt(t,mt(...e)),vt=((t,e,s,i=125)=>{let h,r,n,o,a,c,u,l,f,d,m,p,v,M,w,g=0,y=[],E=[],b=[],C=0,N=0,x=1,O={},R=44100/i*60>>2;for(;x;C++)y=[x=l=m=v=0],s.map(((i,m)=>{for(u=e[i][C]||[0,0,0],x|=!!e[i][C],w=v+(e[i][0].length-2-!l)*R,M=m==s.length-1,r=2,o=v;r<u.length+M;l=++r){for(a=u[r],f=r==u.length+M-1&&M||d!=(u[0]||0)|a|0,n=0;n<R&&l;n++>R-99&&f?p+=(p<1)/99:0)c=(1-p)*y[g++]/2||0,E[o]=(E[o]||0)-c*N+c,b[o]=(b[o++]||0)+c*N+c;a&&(p=a%1,N=u[1]||0,(a|=0)&&(y=O[[d=u[g=0]||0,a]]=O[[d,a]]||(h=[...t[d]],h[2]*=2**((a-12)/12),a>0?mt(...h):[])))}v=w}));return[E,b]})([[.75,0,386,,,.25,2],[.75,0,386,,,.25,2]],[[[1,-.4,20,,,,,,,,,,18,,16,,,,18,,,,,,,,,,,,16,,18,,20,,,,,,25,,,,20,,18,,,,18,,,,,,,,,,,,16,,15,,],[,.3,13,,,,25,,13,,,,13,,25,,,,13,,,,25,,13,,,,13,,25,,,,13,,,,25,,13,,,,13,,25,,,,6,,,,18,,6,,,,6,,18,,,,]],[[1,-.3,16,,,,,,,,18,,,,20,,,,25,,,,,,22,20,22,,,,25,,,,,,,,,,,,,,,,,,,,24,,,,,,,,,,24,,25,,27,,],[,.3,13,,,,25,,13,,,,13,,25,,,,10,,,,22,,10,,,,10,,22,,,,10,,,,22,,10,,,,10,,22,,,,8,,,,20,,8,,,,8,,20,,23,,]],[[1,-.3,27,,,,,,,,32,,,,27,,32,,30,,,,32,,30,,27,,30,,27,,30,,32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,],[,.3,8,,20,8,18,20,,,8,,20,8,18,20,,,11,,23,11,21,23,,,11,,23,11,21,23,,,13,,25,13,23,25,,,13,,25,13,23,25,,,13,,25,13,23,25,,,28,,25,,23,,25,,]]],[0,1,2]),Mt=[[[[,,,,,4,,,,,],[,,,,4,4,,,,,],[,,,,,4,,,,,],[,,,,,4,,,,,],[,,,,3,3,3,,,,]]],[[[4,4,4,,,,,,4,3,4],[,3,,,,,,,4,,4],[,3,,,,,,,4,3,4]],[[,,,3,,,,3,,,],[,,,4,,4,,4,,,],[2,1,2,1,3,,3,1,2,1,2]]],[[[,,,,5,2,5,,,,]],[[4,4,4,,4,4,3,,,3],[,4,,,3,,,,,4],[,4,2,1,4,2,,1,2,4]],[[4,4,4,,4,4,3,,,3],[,4,,,3,,,,,4],[1,4,,,4,,,,,4,1]],[[5,5,,2,,1,,2,,5,5]]]],wt=[[[[,,,3,,,,3,,,],[,,,,4,4,4,,,,],[,,,4,3,4,3,4,,,],[,,3,4,4,4,4,4,3,,],[,,3,,,,,,3,,],[2,,,3,3,,3,3,,,2]],[[,,,,3,,3,,,,],[,,,,4,4,4,,,,],[,,,4,4,4,4,4,,,],[,3,4,4,4,3,4,4,4,3],[5,3,,4,,,,4,,3,5],[2,2,,3,,,,3,,2,2]],[[],[,,,,4,4,4,,,,],[,,,4,4,4,4,4,,,],[,,,,4,4,4,,,,],[],[,5,2,5,,,,5,2,5]]],[[[2,1,,,,,,,,1,2]],[[1,2,,,,,,,,2,1]],[[,,,4,4,4,4,4,,,],[,,4,,,4,,,4,,],[,,4,,,4,,,4,,],[,,4,4,4,4,4,4,4,,],[,,,4,,,,4,,,],[5,5,,,4,4,4,,,5,5]],[[,,,,4,4,4,,,,],[,,,3,3,4,3,3,,,],[,,,3,3,4,3,3,,,],[,,,3,4,4,4,3,,,],[,,,,3,3,3,,,,],[5,5,,,4,,4,,,5,5]],[[],[,,,,3,4,3,,,,],[,,,,3,4,3,,,,],[,,,,4,4,4,,,,],[,,,,4,3,4,,,,],[,,5,5,,,,5,5,,]]],[[[],[],[],[,3,,,,,,,,3],[3,,3,,,,,,3,,3],[,3,,,,,,,,3],[5,,5,,5,,5,,5,,5]],[[],[],[],[3,4,3,,,,,,3,4,3],[4,3,4,,,,,,4,3,4],[3,4,3,,,,,,3,4,3],[,5,,5,,,,5,,5]],[[],[,,,,,4,,,,,],[,,,,3,4,3,,,,],[,3,3,,4,4,4,,3,3],[3,4,3,,,,,,3,4,3],[,3,3,,,,,,3,3],[5,,5,,5,,5,,5,,5]],[[,,3,4,,,,4,3,,],[,,3,,3,4,3,,3,,],[,,,,3,4,3,,,,],[,,,,4,3,4,,,,],[],[],[,5,,5,,,,5,,5]],[[],[,,,4,3,4,3,4,,,],[,,,,4,3,4,,,,],[,,,,,4,,,,,],[],[],[5,,5,,5,,5,,5,,5]]],[[],[[2,1,,,,,,,,2,1]],[[,,,,4,4,4,,,,],[,4,,4,4,3,4,4,,4],[,,4,4,3,3,3,4,4,,],[,,,4,4,3,4,4,,,],[1,2,,,4,4,4,,,1,2]],[[4,,,,3,4,3,,,,4],[4,4,,3,4,4,4,3,,4,4],[4,,,4,4,4,4,4,,,4],[,,,3,4,4,4,3,,,],[2,1,,,3,4,3,,,2,1]],[[,,,,4,4,4,,,,],[,,,4,3,4,3,4,,,],[,,,4,4,3,4,4,,,],[,,,4,3,4,3,4,,,],[,5,,,4,4,4,,,5]],[[,,,,4,3,4,,,,],[,,,4,4,4,4,4,,,],[,,,3,4,4,4,3,,,],[,,,4,4,4,4,4,,,],[5,5,5,,4,3,4,,5,5,5]]]],gt=window.io&&window.io(),yt=null,Et=[];function bt(){let t=new RTCPeerConnection({iceServers:[{urls:R}]}),e=t.createDataChannel("data",{negotiated:!0,id:0});return e.onmessage=t=>{try{Et.push(JSON.parse(t.data))}catch(t){}},{pc:t,ch:e}}function Ct(){return new Promise(((t,e)=>{yt||(yt=bt()),yt.pc.createOffer().then((t=>yt.pc.setLocalDescription(t))).then((()=>yt.pc.onicecandidate=e=>!e.candidate&&t(btoa(JSON.stringify(yt.pc.localDescription))))).catch(e)}))}function Nt(t){return new Promise(((e,s)=>{yt||(yt=bt()),yt.pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(t)))).then((()=>yt.pc.createAnswer())).then((t=>yt.pc.setLocalDescription(t))).then((()=>yt.pc.onicecandidate=t=>!t.candidate&&e(btoa(JSON.stringify(yt.pc.localDescription))))).catch(s)}))}function xt(t,e){return new Promise(((s,i)=>{if(!yt||t&&!e)return i();var h;t&&(h=e,yt.pc.setRemoteDescription(new RTCSessionDescription(JSON.parse(atob(h))))),"open"===yt.ch.readyState?s():"failed"===yt.pc.iceConnectionState?i("NETWORK ERROR"):(yt.ch.onopen=()=>s(),setTimeout((()=>i("TIMEOUT")),15e3))}))}function Ot(){yt&&(yt.pc.close(),yt=null),Et.length=0}function Rt(t){try{yt&&yt.ch.send(JSON.stringify(t))}catch(t){}}let kt={scr:1,touch:!1,sub:!1,coil:!1,p2p:!1,host:!0,beg:!0,sl:!gt,wave:-1,score:0,score2:0,hp:0},At=[];function Pt(t,e=!1){let s=kt;kt={...kt,...t};for(let t of At)t(kt,s,e)}function St(t,e=!1){Pt({scr:4,hp:3+(kt.coil?1:0),score:0,wave:-1,touch:t,p2p:e,host:!e||kt.host,beg:!e&&kt.beg})}class Ft{u=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];t=c();r=[0,0,0,1];m=[];constructor(t=null){(this.parent=t)&&t.m.push(this)}detach(){if(this.parent){let t=this.parent.m,e=t.indexOf(this);e>=0&&(t[e]=t[t.length-1],t.pop())}}update(e){if(!this.hide){this.body&&t(this.body.i,this.t),E(this.r,this.u),t(this.t,this.u,0,12,3),this.parent&&r(this.parent.u,this.u,this.u),this.v&&(this.v.u=this.u),this.M&&this.M.update(this.u);for(let t of this.m)t.update(e)}}}function zt(t,e){if(!t.hide){e(t);for(let s of t.m)zt(s,e)}}function Tt(t,e,s){return t<e?e:t>s?s:t}function It(t,e,s){return t*(1-s)+e*s}let Lt=[0,0,0,1];function _t(t){switch(t){case"ArrowUp":case"w":return 4;case"ArrowDown":case"s":return 8;case"ArrowLeft":case"a":return 1;case"ArrowRight":case"d":return 2;case"Enter":case"e":return 16}return 0}let Dt=[5126,5120,5121,5122,5123],Jt=[4,1,1,2,2];function Gt(t){return Jt[255&t]*Wt(t)}function Wt(t){return t>>8&255}function Bt(t){return Dt[255&t]}function Ht(t){return!!(t>>16)}function Ut(t){return t-5123+2}class Vt{constructor(t,e){this.g=t,this.C={type:34962,N:35044,...e},t.bindBuffer(this.C.type,this.O=t.createBuffer()),t.bufferData(this.C.type,this.C.size,this.C.N)}data(t,e=0){return this.g.bindBuffer(this.C.type,this.O),this.g.bufferSubData(this.C.type,e,t),this}}class Kt{constructor(t,e){this.g=t;let s=this.R=t.createShader(this.type=e.type);t.shaderSource(s,this.source=e.source),t.compileShader(s)}}class $t{constructor(t,e){this.g=t;let s=0;this.C={mode:4,k:5123,...e,A:e.A.map((({P:t,S:e,F:i=!1})=>{this.o=this.o||i;let h=Array(t.length),r=0;for(let e=0;e<t.length;++e,++s){let{name:i,format:n,offset:o=r,T:a=s}=t[e];h[e]={name:i,format:n,offset:o,T:a},r=Math.max(r,o)+Gt(n)}return{P:h,S:e||r,F:i}}))},this.I=((t,e,s,i)=>{let h=t.createProgram();t.attachShader(h,e.R),t.attachShader(h,s.R);for(let{P:e}of i)for(let s of e)t.bindAttribLocation(h,s.T,s.name);return t.linkProgram(h),h})(t,e.L,e._,this.C.A)}}function qt(t,e,s){s?t.enable(e):t.disable(e)}class Xt{constructor(t){this.D=!1,this.g=t,this.canvas=t.canvas,this.r=new jt(t,this.J("ANGLE_instanced_arrays"))}get width(){return this.g.drawingBufferWidth}get height(){return this.g.drawingBufferHeight}buffer(t){return new Vt(this.g,t)}G(t){return new Kt(this.g,t)}W(t){return new $t(this.g,t)}B(t={}){return((t={})=>({C:t,H:null,U(){}}))(t)}V(t){let e=this.width,s=this.height;this.g.viewport(0,0,e,s);let i=0;return t.C.clearColor&&(i|=16384,this.g.clearColor(...t.C.clearColor),this.g.colorMask(!0,!0,!0,!0)),isNaN(t.C.clearDepth)||(i|=256,this.g.clearDepth(t.C.clearDepth),this.g.depthMask(!0)),i&&this.g.clear(i),this.r}J(t){return this.g.getExtension(t)}reset(){this.r.reset()}}class jt{constructor(t,e){this.g=t,this.K=e,this.reset()}reset(){this.s={p:null,r:0}}W(t){if(this.s.p!==t){this.s.p=t,this.g.useProgram(t.I),((t,e,s=0)=>{let{$:i,q:h,X:r}=e;if(e.j,qt(t,2929,!!h),h&&(t.depthMask(!!h.write),t.depthFunc(h.Y||519)),qt(t,3042,!!i),i){let e=i.colorMask||255;t.colorMask(!!(1&e),!!(2&e),!!(4&e),!!(8&e)),t.blendFuncSeparate(i.Z||1,i.tt||0,i.et||1,i.st||0),t.blendEquationSeparate(i.it||32774,i.ht||32774)}})(this.g,t.C,this.s.r);for(let t=0;t<16;++t)this.g.disableVertexAttribArray(t);for(let{P:e}of t.C.A)for(let{T:t}of e)this.g.enableVertexAttribArray(t)}return this}index({O:t}){return this.g.bindBuffer(34963,t),this}rt(t,{O:e}){let{P:s,S:i,F:h}=this.s.p.C.A[t];this.g.bindBuffer(34962,e);for(let{format:t,offset:e,T:r}of s)this.g.vertexAttribPointer(r,Wt(t),Bt(t),Ht(t),i,e),this.K&&this.K.vertexAttribDivisorANGLE(r,h?1:0);return this}nt(t){for(let e of t){let t=this.g.getUniformLocation(this.s.p.I,e.name);if(t)if(e.values){let s=this.s.p.C.nt.find((t=>t.name===e.name));if(s)switch(s.ot){case 35676:this.g.uniformMatrix4fv(t,!1,e.values);break;case 35675:this.g.uniformMatrix3fv(t,!1,e.values);break;case 35666:this.g.uniform4fv(t,e.values);break;case 35665:this.g.uniform3fv(t,e.values);break;case 35664:this.g.uniform2fv(t,e.values);break;default:this.g.uniform1fv(t,e.values)}}else isNaN(e.value)||this.g.uniform1f(t,e.value)}return this}at(t,e=1,s=0){let{C:{mode:i},o:h}=this.s.p;return h?this.K&&this.K.drawArraysInstancedANGLE(i,s,t,e):this.g.drawArrays(i,s,t),this}ct(t,e=1,s=0){let{C:{k:i,mode:h},o:r}=this.s.p;return r?this.K&&this.K.drawElementsInstancedANGLE(h,t,i,s*Ut(i),e):this.g.drawElements(h,t,i,s*Ut(i)),this}end(){}}let Yt=document.getElementsByTagName.bind(document),Zt=Yt("canvas")[0],Qt=Yt("nav")[0],te=Yt("nav")[1],ee=Yt("nav")[2],se=Yt("a")[0],ie=Yt("a")[1],he=Yt("a")[2],re=Yt("a")[3],ne=Yt("a")[4],oe=Yt("a")[5],ae=Yt("a")[6],ce=Yt("a")[7],ue=Yt("a")[8],le=Yt("a")[9],fe=Yt("b")[0],de=Yt("span")[0],me=Yt("p")[0],pe=Yt("p")[1],ve=Yt("p")[2],Me=Yt("p")[3],we=Yt("p")[4],ge=Yt("input")[0],ye=Yt("input")[1],Ee=Yt("input")[2],be=Yt("h6")[0],Ce=((t,e)=>{let s=t.getContext("webgl",{preserveDrawingBuffer:!0});return s?new Xt(s):null})(Zt);Ce.J("OES_standard_derivatives");let Ne=Ce.B({clearColor:L,clearDepth:1}),xe=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Oe=c(),Re=Ce.W({L:Ce.G({type:35633,source:"uniform mat4 vp;attribute vec4 pos,c,m1,m2,m3,m4;varying vec3 vPos;varying vec4 vC;void main(){vec4 v=mat4(m1,m2,m3,m4)*pos;vPos=v.xyz;vC=c;gl_Position=vp*v;}"}),_:Ce.G({type:35632,source:"#extension GL_OES_standard_derivatives:require\nprecision highp float;uniform vec3 p;uniform vec4 f;varying vec3 vPos;varying vec4 vC;void main(){vec3 v=-vec3(.41,.82,.41),m=normalize(cross(dFdx(vPos),dFdy(vPos))),s=normalize(v+normalize(p-vPos));float d=mix(min(max(dot(m,v),0.)+pow(max(dot(m,s),0.),abs(vC.w)),1.),1.,abs(vC.w)*step(0.,-vC.w)),a=max(smoothstep(10.,80.,length(p-vPos)),max(smoothstep(18.,22.,abs(vPos.x)),smoothstep(50.,60.,abs(vPos.z))));gl_FragColor=vec4(mix(vC.xyz*max(d,.25),f.xyz,a),1.);}"}),A:[{P:[{name:"pos",format:768},{name:"c",format:1024}]},{P:[{name:"m1",format:1024},{name:"m2",format:1024},{name:"m3",format:1024},{name:"m4",format:1024}],F:!0}],nt:[{name:"vp",ot:35676},{name:"p",ot:35665},{name:"f",ot:35666}],q:{Y:515,write:!0}}),ke=Ce.W({L:Ce.G({type:35633,source:"uniform mat4 vp;uniform float vw,ct;attribute vec4 p,v,c;attribute float t,s;varying vec4 vC;void main(){vC=vec4(c.xyz,c.w*(1.-mod(ct,t)/t/2.)),gl_Position=vp*vec4((p+mod(ct,t)*v).xyz,1.),gl_PointSize=vw/gl_Position.w*(1.-mod(ct,t)/t)*s;}"}),_:Ce.G({type:35632,source:"precision highp float;varying vec4 vC;void main(){gl_FragColor=vec4(vC.xyz,smoothstep(1.,0.,length(2.*gl_PointCoord.xy-vec2(1.)))*vC.w);}"}),A:[{P:[{name:"p",format:768},{name:"v",format:768},{name:"t",format:256},{name:"s",format:256},{name:"c",format:1024}]}],nt:[{name:"vp",ot:35676},{name:"vw"},{name:"ct"}],q:{Y:515,write:!1},$:{Z:770,et:1,tt:771,st:771},mode:0}),Ae=[],Pe=[],Se=new Float32Array(73728),Fe=Ce.buffer({N:35040,size:Se.byteLength});function ze(t){return Ae.push(t),Ae.length-1}function Te(e,s,i,h,r,n,o,a,c){let u=new Float32Array(12*e);for(let s=0,l=0;l<e;++l){for(let t=0;t<3;++t)Oe[t]=It(r[t],n[t],Math.random());t(Oe,u,0,s,3),s+=3;for(let t=0;t<3;++t)Oe[t]=It(o[t],a[t],Math.random());t(Oe,u,0,s,3),s+=3,u[s++]=Math.max(.01,Math.random())*i,u[s++]=h,t(c,u,0,s,4),s+=4}Pe.push({s:0,t:s,d:u})}function Ie(t,e){return t.reduce(((t,s,i)=>(t.push(...e(s,i)),t)),[])}function Le(t=6){let e=0;for(let s=0;s<t;++s)e+=Math.random();return e/6}function _e(t,e,s=128){let i=new Float32Array(Ie(e.i,((t,s)=>[...t,...e.c[s]]))),h=new Float32Array(16*s),r=new Uint16Array(Ie(e.o,(t=>t)));return{ut:t.buffer({size:i.byteLength}).data(i),lt:t.buffer({type:34963,size:r.byteLength}).data(r),count:r.length,ft:h,dt:t.buffer({N:35040,size:h.byteLength}),vt:0}}let De,Je={Mt:ze(_e(Ce,nt,16)),wt:ze(_e(Ce,Q,16)),wand:ze(_e(Ce,at,16)),coil:ze(_e(Ce,ut,16)),gt:ze(_e(Ce,it,256)),eye:ze(_e(Ce,tt,256)),yt:ze(_e(Ce,et,256)),Et:ze(_e(Ce,st,512)),bt:ze(_e(Ce,rt,512))},Ge=c(),We=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],Be=x(),He=x();function Ue(t,e){for(let s=0;s<3;++s)if(t.max[s]<=e.min[s]||t.min[s]>=e.max[s])return!1;return!0}function Ve(t,e,s=!0){return{node:t,Ct:2+(s?1:0),i:[0,0,0],Nt:[0,0,0],shape:e}}function Ke(t){Te(32,.2,.4,.3,[t.body.i[0]+t.body.shape.min[0],t.body.i[1]+t.body.shape.min[1],t.body.i[2]+t.body.shape.min[2]],[t.body.i[0]+t.body.shape.max[0],t.body.i[1]+t.body.shape.max[1],t.body.i[2]+t.body.shape.max[2]],[-10,-10,-10],[10,10,10],_),Te(32,.2,.4,.3,[t.body.i[0]+t.body.shape.min[0],t.body.i[1]+t.body.shape.min[1],t.body.i[2]+t.body.shape.min[2]],[t.body.i[0]+t.body.shape.max[0],t.body.i[1]+t.body.shape.max[1],t.body.i[2]+t.body.shape.max[2]],[-10,-10,-10],[10,10,10],D)}class $e extends Ft{xt=0;Ot=0;constructor(t,e,s,i,h,r){super(t),this.id=e,this.type=s,this.Rt=r,this.body=Ve(this,i,h)}update(t){super.update(t),this.xt=(this.xt+t)%(2*Math.PI),this.Ot=Math.max(0,this.Ot-t),this.id&&!this.Ot&&Math.random()<t/10*this.type&&(this.Ot=this.Rt,this.kt())}kt(){}detach(){super.detach(),Ke(this)}}class qe extends $e{constructor(t,e,s=0){super(t,e,1+s,z,!0,5),this.At=s,new Ft(this).v={id:s?Je.yt:Je.eye},new Ft(this).v={id:Je.bt},new Ft(this).v={id:Je.bt}}update(t){let e=-3*this.xt;u(this.m[0].t,0,-.1*Math.cos(2*e),0),u(this.m[1].t,-.35,Math.max(.1,.1*(1+Math.sin(e))),.25+.1*Math.cos(e)),u(this.m[2].t,.35,Math.max(.1,.1*(1+Math.sin(e+Math.PI))),.25+.1*Math.cos(e+Math.PI)),super.update(t)}kt(){this.At&&rs(3,[this.u[12],this.u[13]+1,this.u[14]],[0,0,10])}}class Xe extends $e{constructor(t,e,s=0){super(t,e,3+s,T,!1,3),this.At=s;let i=this.root=new Ft(this);i.v={id:s?Je.yt:Je.eye},new Ft(i).v={id:Je.Et},new Ft(i).v={id:Je.Et}}update(t){let e=Math.abs(Math.sin(-3*this.xt));u(this.root.t,0,3-Math.cos(e),0),v([1,0,0],Tt(Math.atan2(this.u[13]+2-fs.u[13],fs.u[14]-this.u[14]+.5),0,Math.PI/3),this.root.r),v([0,1,0],-Math.PI*e/3,this.root.m[0].r),v([0,1,0],Math.PI*(1+e/3),this.root.m[1].r),super.update(t)}kt(){if(this.At){let t=c(0,0,10);w(this.root.r,t,t),rs(3,[this.u[12],this.u[13]+3,this.u[14]],t)}}}class je extends $e{constructor(t,e){super(t,e,5,I,!0,0),this.v={id:Je.gt}}kt(){rs(4,[this.u[12],this.u[13]+1,this.u[14]],[0,0,50])}}function Ye(){if(!De){De=new AudioContext;let t=dt(De,...vt);t.loop=!0,Qe(t)}}function Ze(){De&&Qe(pt(De,...ft))}function Qe(t){t.connect(De.destination),t.start()}class ts extends Ft{Pt=0;o=0;constructor(t,e,s,i=1){super(t),this.c=e,this.p=s,this.s=i;let h=Math.max(1,i/2);this.body=Ve(this,x([-.5*h,-.5*h,-.5*h],[.5*h,.5*h,.5*h]),!1),s&&De&&Qe(pt(De,...lt))}update(t){super.update(t),++this.o%2&&Te(16,.05*this.s,.1*this.s,.3*this.s,[this.body.i[0]-.2,this.body.i[1]-.2,this.body.i[2]-.2],[this.body.i[0]+.2,this.body.i[1]+.2,this.body.i[2]+.2],[Math.min(0,-this.body.Nt[0])-5*this.s,Math.min(0,-this.body.Nt[1])-5*this.s,Math.min(0,-this.body.Nt[1])-5*this.s],[Math.max(0,-this.body.Nt[0])+5*this.s,Math.max(0,-this.body.Nt[1])+5*this.s,Math.max(0,-this.body.Nt[1])+5*this.s],this.c),((this.Pt+=t)>=10||this.u[13]<0||this.u[14]<-50||this.u[14]>50)&&this.detach()}detach(){super.detach(),Te(32,.2,.4,.2*this.s,[this.body.i[0]-.2,this.body.i[1]-.2,this.body.i[2]-.2],[this.body.i[0]+.2,this.body.i[1]+.2,this.body.i[2]+.2],[-10*this.s,-10*this.s,-10*this.s],[10*this.s,10*this.s,10*this.s],this.c)}}let es=[],ss=[],is=[0,0];function hs(t,e){return t<3?new qe(as,e,1&t):t<5?new Xe(as,e,1&t):new je(as,e)}function rs(e,s,i,h=!1){let r=e<2?new ts(cs,J,!0):e<3?new ts(cs,W,!0,2.5):e<4?new ts(cs,D,!1):new ts(cs,G,!1,.75);return t(s,r.body.i,0,0,3),t(i,r.body.Nt,0,0,3),!(r.remote=h)&&kt.p2p&&es.push([e,s,i]),r}class ns extends Ft{hp=0;St=0;constructor(t,e,s,i=!e){super(t),this.control=s,this.remote=i,this.body=Ve(this,S),this.body.bound=F,this.Ft=new Ft(this),this.Ft.v={id:Je.wand},!e&&(this.v={id:Je.Mt});let h=this.zt=new Ft(this),r=new Ft(h);r.M=e,u(r.t,0,1.7,0),v([0,1,0],Math.PI,r.r),v([0,1,0],Math.PI,this.r)}update(t){let e=!1;if(this.control){this.control.update(),this.St=Math.max(0,this.St-t),!this.St&&this.control.Rt&&(this.St=.5,e=!0),v([1,0,0],this.control.Tt,this.zt.r),v([0,1,0],this.control.It,this.r);let s=this.control.dir,i=this.body.Nt;i[0]=10*s[0],i[1]=this.body.i[1]&&s[1]?20:i[1],i[2]=10*s[2]}if(super.update(t),e){let t=c(0,0,25);w(this.r,w(this.zt.r,t,t),t),rs(this.Ft.v.id===Je.wand?1:2,[this.u[12],this.u[13]+1.7,this.u[14]],t)}let s=this.St?(Math.sin(6*(.5-this.St))+1)/2:0;v([1,0,0],Math.max(Math.PI/6,Math.PI/3*s),this.Ft.r),u(this.Ft.t,-.7,1,1-.5*s)}}let os=new Ft,as=new Ft(os),cs=new Ft(os),us=new class{i=c();view=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];Lt=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];_t=1;Dt=Math.PI/4;Jt=.1;Gt=200;update(e){((t,e,s,i=1/0,r=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])=>{let n=1/Math.tan(e/2);if(h(r),r[0]=n/t,r[5]=n,r[11]=-1,r[15]=0,isFinite(i)){let t=1/(s-i);r[10]=(s+i)*t,r[14]=2*s*i*t}else r[10]=-1,r[14]=-2*s})(this._t,this.Dt,this.Jt,this.Gt,this.Lt),((t,e=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])=>{((t,e,s)=>{let i=0;for(let t=0;t<4;++t)for(let h=t;h<4;++h)i=e[4*h+t],s[4*h+t]=e[4*t+h],s[4*t+h]=i})(0,t,e)})(e,this.view),this.view[3]=this.view[7]=this.view[11]=0,t(d(this.view,f(t(e,this.i,12,0,3),-1)),this.view,0,12,3)}},ls=new class{touch=!1;paused=!0;dir=c();touches={};Wt={};constructor(t,e,s=Math.PI/2){this.canvas=t,this.Bt=e,this.w=s,this.reset(),document.addEventListener("pointerlockchange",this.lock)}start(){this.paused&&(this.touch?(this.Ht(!0),document.body.requestFullscreen&&document.body.requestFullscreen(),this.paused=!1):this.canvas.requestPointerLock())}pause(){this.touch?this.Ht(!1):document.exitPointerLock&&document.exitPointerLock()}reset(){this.pause(),this.paused=!0,this.Tt=-(this.It=Math.PI)/12,this.Rt=!1,this.action=0}update(){let t=this.paused?0:this.action|(t=>{let e=navigator.getGamepads&&navigator.getGamepads()[0],s=0;if(e){(e.buttons[0]&&e.buttons[0].pressed||e.buttons[7]&&e.buttons[7].pressed)&&(s|=16);let i=e.axes[0]||0,h=e.axes[1]||0;Math.abs(i)>.3&&(s|=i<0?1:2),Math.abs(h)>.3&&(s|=h<0?4:8),i=e.axes[2]||0,h=e.axes[3]||0,t.Ut(Math.abs(i)>.3?i/200:0,Math.abs(h)>.3?h/200:0)}return s})(this);this.Rt=!!(16&t),this.dir[0]=(1&t?1:0)+(2&t?-1:0),this.dir[1]=0,this.dir[2]=(8&t?-1:0)+(4&t?1:0),w(v([0,1,0],this.It,Lt),this.dir,this.dir)}Ut(t,e){this.It=Tt((this.It-t*this.w+2*Math.PI)%(2*Math.PI),Math.PI/2,Math.PI/2*3),this.Tt=Tt(this.Tt+e*this.w,-Math.PI/4,Math.PI/24)}Ht(t){this.Bt.hidden=!t;let e=(t?this.Bt.addEventListener:this.Bt.removeEventListener).bind(this.Bt),s=t?addEventListener:removeEventListener;e("touchstart",this.Vt),e("touchend",this.Kt),s("touchstart",this.$t),s("touchend",this.qt),s("touchmove",this.Xt)}lock=()=>{let t=(this.paused=document.pointerLockElement!==this.canvas)?removeEventListener:addEventListener;t("mousemove",this.jt),t("mousedown",this.Yt),t("mouseup",this.Zt),t("keydown",this.Qt),t("keyup",this.te)};jt=t=>{this.Ut(t.movementX/innerWidth,t.movementY/innerHeight)};Yt=t=>{t.preventDefault(),0===t.button&&(this.action=16|this.action)};Zt=t=>{t.preventDefault(),0===t.button&&(this.action=-17&this.action)};Xt=t=>{t.preventDefault();for(let e=0;e<t.changedTouches.length;++e){let s=t.changedTouches.item(e),i=this.Wt[s.identifier];if(!i)continue;let h=this.touches[i],r=(s.clientX-h[0])/innerWidth,n=(s.clientY-h[1])/innerHeight;1===i?(this.action=-16&this.action,Math.abs(r)>.02&&(this.action=this.action|(r<0?1:2)),Math.abs(n)>.02&&(this.action=this.action|(n<0?4:8))):(this.Ut(r,n),h[0]=s.clientX,h[1]=s.clientY)}};$t=t=>{for(let e=0;e<t.changedTouches.length;++e){let s=t.changedTouches.item(e),i=s.clientX/innerWidth<.5?1:2;this.touches[i]||(this.touches[i]=[s.clientX,s.clientY],this.Wt[s.identifier]=i)}};qt=t=>{t.preventDefault();for(let e=0;e<t.changedTouches.length;++e){let s=t.changedTouches.item(e).identifier,i=this.Wt[s];i&&(1===i&&(this.action=-16&this.action),delete this.touches[i],delete this.Wt[s])}};Vt=t=>{t.preventDefault(),this.action=16|this.action};Kt=t=>{t.preventDefault(),this.action=-17&this.action};Qt=t=>{t.preventDefault(),this.action=this.action|_t(t.key)};te=t=>{t.preventDefault(),this.action=this.action&~_t(t.key)}}(Zt,we),fs=new ns(os,us,ls),ds=new ns(os);ds.hide=!0,Te(384,1/0,1,4,[-32,50,-52],[-30,52,-50],[-.1,-.1,-.1],[.1,.1,.1],[1,.95,.65,.5]),Te(384,1/0,7,.4,[-100,10,-100],[100,100,100],[0,0,0],[0,0,0],_),new Ft(os).v={id:Je.wt};let ms=new Ft(os),ps=new Xe(ms,0,1),vs=new Xe(ms,0,0),Ms=new qe(ms,0,0),ws=new qe(ms,0,1);u(ps.body.i,5,5,28),u(vs.body.i,-7,4,25),u(Ms.body.i,3,0,15),u(ws.body.i,-3,0,23),v([0,1,0],Math.PI/-8,ps.r),v([0,1,0],Math.PI/8,vs.r);let gs=0,ys=0;try{let t=JSON.parse(localStorage.getItem("_INVADERS")||"{}")||{};gs=+(t.s||0),ys=+(t.w||0)}catch(t){}let Es=!0;function bs(){us._t=(Zt.width=innerWidth)/(Zt.height=innerHeight)}function Cs(){Es&&(Es=!1,Zt.toBlob((t=>fetch("https://api.nft.storage/upload",{method:"POST",headers:new Headers({Authorization:"Bearer "+q}),body:t}).then((t=>t.json())).then((t=>{open("https://cloudflare-ipfs.com/ipfs/"+t.value.cid,"_blank"),Es=!0})))))}function Ns(){ls.start()}bs(),addEventListener("resize",bs),me.addEventListener("click",Cs),addEventListener("keypress",(t=>{"p"===t.key&&Cs()})),se.addEventListener("touchend",(t=>{t.preventDefault(),Ye(),St(!0)})),se.addEventListener("click",(()=>{Ye(),St(!1)})),ue.addEventListener("touchend",(t=>{t.preventDefault(),xt(kt.host,Ee.value).then((()=>{Ye(),St(!0,!0)}),(t=>be.innerText=t||""))})),ue.addEventListener("click",(()=>{xt(kt.host,Ee.value).then((()=>{Ye(),St(!1,!0)}),(t=>be.innerText=t||""))})),re.addEventListener("click",(()=>{Pt({beg:!kt.beg})})),he.addEventListener("click",(()=>{Pt({coil:!kt.coil})})),ie.addEventListener("click",(()=>{Pt({scr:2})})),le.addEventListener("click",(()=>{Pt({scr:1,beg:ys<Mt.length&&kt.beg})})),ne.addEventListener("click",(()=>{Pt({scr:1})})),ce.addEventListener("click",(()=>{Pt({sl:!kt.sl})})),oe.addEventListener("click",(()=>kt.sl?Ct().then((t=>{ye.value=t,Pt({host:!0})}),(()=>be.innerText="NETWORK ERROR")):(be.innerText="NOT CONNECTED",gt&>.connected&&(be.innerText="CONNECTING",gt.off("P"),gt.once(ge.value,(t=>Ct().then((e=>{gt.emit("P","O",ye.value=e,t),gt.once("P",((t,e)=>{Ee.value=e,be.innerText="READY"})),Pt({host:!0})}))))),gt&>.connected))),ae.addEventListener("click",(()=>kt.sl?Nt(ye.value).then((t=>{Ee.value=t,Pt({host:!1})}),(()=>be.innerText="NETWORK ERROR")):(be.innerText="NOT CONNECTED",gt&>.connected&&(be.innerText="CONNECTING",gt.off("P"),gt.emit("J",ge.value),gt.once("P",((t,e,s)=>Nt(ye.value=e).then((t=>{gt.emit("P","A",Ee.value=t,s),be.innerText="READY",Pt({host:!1})}))))),gt&>.connected))),At.push(((t,e,s)=>{(s||t.scr!==e.scr)&&(Qt.hidden=1!==t.scr,te.hidden=2!==t.scr,ee.hidden=8!==t.scr,de.hidden=4!==t.scr,ve.hidden=4!==t.scr,ms.hide=4===t.scr,ye.value="",Ee.value="",be.innerText="",1===t.scr&&Ot(),4===t.scr&&((ls.touch=t.touch)||addEventListener("mouseup",Ns),Ns()),8===t.scr&&(ls.reset(),!t.touch&&removeEventListener("mouseup",Ns),((t,e)=>{try{localStorage.setItem("_INVADERS",JSON.stringify({s:gs=Math.max(gs,t),w:ys=Math.max(ys,e)}))}catch(t){}})(t.score,t.wave))),t.sub&&(Me.hidden=!1,he.hidden=!1),1===t.scr&&(pe.innerText="HISCORE "+gs,re.innerText=(t.beg?"☑":"☐")+" BEGINNER",he.innerText=(t.coil?"☑":"☐")+" COIL WEAPON",fs.Ft.v.id=t.coil?Je.coil:Je.wand),2===t.scr&&(ce.innerText=(t.sl?"☑":"☐")+" SERVERLESS",ge.hidden=t.sl,ye.hidden=!t.sl,Ee.hidden=!t.sl),4===t.scr&&(pe.innerText=`SCORE ${t.score} ${t.p2p?": "+t.score2:""}`,ve.innerText="LIVE "+Array(0|t.hp).fill("⬤").join(" "),t.hp<e.hp&&(fe.classList.add("hit"),setTimeout((()=>fe.classList.remove("hit")),50)))}));let xs=-1.5,Os=0,Rs=0;At.push(((t,e,s)=>{(s||t.scr!==e.scr)&&(4===t.scr?(fs.hp=t.hp,Rs=0,u(fs.body.i,kt.p2p?10*(kt.host?1:-1):0,0,40)):(u(fs.body.i,0,0,40),u(fs.body.Nt,0,0,0),cs.m.length=0,as.m.length=0,ds.hide=!0)),t.wave!==e.wave&&(t.beg&&e.wave<=Mt.length?fs.hp=4+(kt.coil?1:0):!e.wave||e.wave%4||(fs.hp=Math.min(5,fs.hp+2)))}));let ks=[],As=[],Ps=0,Ss=0;function Fs(t,e){let s=t.node,i=e.node;i instanceof ts?!i.p&&s instanceof ns?s.remote||(Ze(),i.detach(),fs.hp--):i.p&&s instanceof $e?(Ze(),i.detach(),i.remote||(s.detach(),ss.push(s.id),fs.St=0,Pt({score:kt.score+1}))):i.p&&s instanceof ts&&!s.p&&(Ze(),i.detach(),s.detach(),i.remote||(fs.St=0)):i instanceof $e&&s instanceof ns&&(s.remote||(Ze(),i.detach(),fs.hp--,ss.push(i.id)))}function zs(t){for(let e=0,s=0;s<t.length;++s)for(let i=0;i<t[s].length;++i)for(let h=0;h<11;++h){let r=t[s][t[s].length-i-1][h];r&&u(hs(r,++e).body.i,3*(h-5),3*i+(r<3||5===r?20:0),Math.min(15,kt.wave/2|0)-6*s-i)}}!function e(s){requestAnimationFrame(e);let i=(s/=1e3)-Ps;Ps=s,Rs=Rs||s,4===kt.scr&&(kt.p2p&&!kt.host||(()=>{if(!as.m.length){Pt({wave:kt.wave+1});let t=kt.beg&&kt.wave<Mt.length?Mt[kt.wave]:(kt.wave+1)%4?(()=>{let t=[];for(let e=0;e<5;++e){let e=[];for(let t=0;t<4;++t)e.push([]);t.push(e)}let e=22+Math.min(33,(kt.wave+5)*Math.random()|0);for(let s=0,i=0;s<e&&i<256;++i){let e=5*Le(2)|0,i=4*Le()|0,h=11*(Math.random()<.4?Math.random():Le())|0;if(t[e][i][h])continue;let r=Math.random();t[e][i][h]=r<.05?5:r<.15?1:r<.3?2:r<.65?3:4,++s}return t})():wt[wt.length*Math.random()|0];zs(t),xs=-1.5,Os=0,is[0]=0,is[1]=0,kt.p2p&&((t,e)=>{Rt({t:Date.now(),w:t,e})})(kt.wave,t)}})(),kt.p2p&&(s-Rs>15?(Ot(),Pt({p2p:!1,host:!0}),ds.hide=!0):((!(Ss=(Ss+1)%4)||!fs.hp)&&(Rt({t:Date.now(),h:fs.hp,p:fs.body.i,s:kt.score,c:kt.coil,l:is[0],f:is[1],d:ss,b:es}),ss.length=0,es.length=0),(e=>{Et.length&&(Rs=e);for(let e of Et)if(e.e&&(Pt({wave:e.w}),zs(e.e),xs=-1.5,Os=0,is[0]=0,is[1]=0),e.p){Pt({score2:e.s});let s=!ds.hide;(ds.hide=e.h<=0)&&s&&(Ze(),Ke(ds)),ds.Ft.v.id=e.c?Je.coil:Je.wand,t(e.p,ds.body.i,0,0,3);for(let t of e.d){let e=as.m.find((e=>e.id===t));e&&e.detach()}for(let t of e.b)rs(...t,!0),t[0]<3&&(ds.St=.5);if(!kt.host){for(let t of as.m)t.type>=3&&t.type<5&&(t.body.i[0]+=e.l-is[0],t.body.i[2]+=e.f-is[1]);is[0]=e.l,is[1]=e.f}}Et.length=0})(s))),kt.hp!==fs.hp&&Pt({scr:Math.max(fs.hp,0)?4:8,hp:Math.max(fs.hp,0)}),(t=>{Os=Math.max(0,Os-t);let e=20,s=-20;for(let t of as.m)3!==t.type&&4!==t.type||(e=Math.min(e,t.u[12]),s=Math.max(s,t.u[12])),t.u[14]>40&&(Ze(),fs.hp=0);(xs<0&&e<=-20||xs>0&&s>=20)&&(xs*=-1,Os=4),is[0]+=xs*t,is[1]+=Os?t:0;for(let t of as.m)t.type<3?u(t.body.Nt,0,t.body.Nt[1],1):t.type<5&&u(t.body.Nt,xs,0,Os?1:0)})(i)),ks.length=As.length=0,zt(os,(t=>{t.body&&ks.push(t.body),t.v&&As.push(t.v)})),((t,e,s)=>{for(let s of e)if(1&s.Ct&&(f(P,t,Ge),l(s.Nt,Ge,s.Nt)),f(s.Nt,t,Ge),l(s.i,Ge,s.i),1&s.Ct){for(let t=0;t<3;++t)s.i[t]=Tt(s.i[t],k[t],A[t]),s.bound&&(s.i[t]=Tt(s.i[t],s.bound.min[t],s.bound.max[t]));s.i[1]===k[1]&&(s.Nt[1]=0)}for(let t=0;t<e.length;++t)if(2&e[t].Ct){O(e[t].shape,g(e[t].i,We),Be);for(let i=0;i<e.length;++i)t!=i&&(O(e[i].shape,g(e[i].i,We),He),Ue(Be,He)&&s&&s(e[t],e[i]))}})(i,ks,Fs),os.update(i);let h=Ce.V(Ne);((e,s,i)=>{for(let t of Ae)t.vt=0;i.sort(((t,e)=>t.id-e.id));for(let e of i){let s=Ae[e.id];16*(s.vt+1)<=s.ft.length&&t(e.u||xe,s.ft,0,16*s.vt++)}e.W(Re).nt([{name:"vp",values:r(s.Lt,s.view)},{name:"p",values:s.i},{name:"f",values:L}]);for(let t of Ae)t.vt&&(t.dt.data(t.ft),e.rt(0,t.ut).rt(1,t.dt).index(t.lt).ct(t.count,t.vt))})(h,us,As),((e,s,i)=>{if(!Pe.length)return;e.W(ke).rt(0,Fe).nt([{name:"vp",values:r(s.Lt,s.view)},{name:"vw",value:2e3},{name:"ct",value:i}]);let h=0;for(let e=0;e<Pe.length;){let s=Pe[e];i>(s.s=s.s||i)+s.t?(Pe[e]=Pe[Pe.length-1],Pe.pop()):(h+s.d.length<=Se.length&&(t(s.d,Se,0,h,s.d.length),h+=s.d.length),++e)}Fe.data(Se),e.at(h/12)})(h,us,s),h.end()}(0),document.monetization&&document.monetization.addEventListener("monetizationstart",(()=>Pt({sub:!0,coil:!0}))),Pt(kt,!0);</script></body></html>