Spaces:
Running
Running
Download game.js from CyberMax-tools/prismwick: direct link, hf CLI and curl.
- Browser
- Download file 76.2 kB
-
https://huggingface.co/spaces/CyberMax-tools/prismwick/resolve/main/game.js
- Command line
-
hf download hf://spaces/CyberMax-tools/prismwick/game.js
-
curl -L -o game.js https://huggingface.co/spaces/CyberMax-tools/prismwick/resolve/main/game.js
76.2 kB
| /* Prism Volley (c) 2026 CyberMax. All rights reserved. */ | |
| var pn=Object.defineProperty;var mn=(e,t)=>{for(var o in t)pn(e,o,{get:t[o],enumerable:!0})};var $t=e=>Math.floor(Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10))/864e5),St=e=>e*2654435761%2147483629+7;function At(e,t={}){let o={seed:e,rs:Math.abs(Math.floor(e))%2147483646+1,wave:0,balls:1,x:3.5,alive:!0,over:"",score:0,shards:0,cells:new Array(70).fill(null),waves:[],hard:!!t.hard,zen:!!t.zen,limit:t.limit||0,broke:0,bestVolley:0,hits:0,fx:[],v:null,quiet:!!t.quiet};return kt(o),kt(o),kt(o),o.wave=1,o}var Ct=(e,t,o)=>t<0||t>=7||o<0||o>=10?null:e.cells[o*7+t];function hn(e){return e.rs=e.rs*48271%2147483647,(e.rs-1)/2147483646}function kt(e){let t=++e.wave,o=()=>hn(e);for(let d=9;d>0;d--)for(let h=0;h<7;h++)e.cells[d*7+h]=e.cells[(d-1)*7+h];for(let d=0;d<7;d++)e.cells[d]=null;for(let d=0;d<7;d++){let h=63+d,f=e.cells[h];f&&(f.k==="o"?(e.balls++,e.fx.push({t:"orb",c:d,r:9,late:1}),e.cells[h]=null):f.k==="s"?(e.shards++,e.fx.push({t:"shard",c:d,r:9,late:1}),e.cells[h]=null):f.k==="z"?e.cells[h]=null:e.zen?(e.cells[h]=null,e.fx.push({t:"melt",c:d})):(e.alive=!1,e.over="wall",e.fx.push({t:"breach",c:d})))}if(!e.alive)return;let a=[0,1,2,3,4,5,6],n=()=>a.splice(Math.floor(o()*a.length),1)[0],s=n();e.cells[s]={k:"o",hp:1,max:1};let r=Math.min(6,2+Math.floor(o()*(2+Math.min(3,Math.floor(t/3))))+(!e.limit&&t>25&&o()<.5?1:0)),l=e.limit?t:t+Math.max(0,Math.floor((t-15)*(t-15)/12)),c=e.hard?l*2:l;for(let d=0;d<r&&a.length;d++){let h=n(),w=o()<.3?c*2:c;e.cells[h]={k:t>=3&&o()<.1?"n":"b",hp:w,max:w}}a.length&&o()<.45&&(e.cells[n()]={k:"s",hp:1,max:1}),a.length&&t>=4&&o()<.14&&(e.cells[n()]={k:"z",hp:1,max:1}),e.fx.push({t:"wave",w:t})}function io(e){let t=Math.max(-940,Math.min(940,Math.round(e))),a=(Math.sign(t)*Math.max(60,Math.abs(t))||60)/1e3;return{x:a,y:-Math.sqrt(1-a*a)}}var He=e=>Math.abs(e)<60?e<0?-60:e>0?60:0:Math.max(-940,Math.min(940,Math.round(e)));function lo(e,t,o,a){let n=o-e,s=a-t;if(s>-.25)return null;let r=Math.sqrt(n*n+s*s);return He(n/r*1e3)}function co(e,t){if(!e.alive||e.v)return!1;let o=io(t),a=-1;for(let n=0;n<e.cells.length;n++)e.cells[n]&&(a=Math.floor(n/7));return e.v={low:a,aim:He(t),d:o,tick:0,launched:0,home:0,firstX:null,balls:[],broke:0,hits:0,beams:[],dmg:0},!0}function vt(e,t,o,a,n){let s=o*7+t,r=e.cells[s];if(!r||r.k!=="b"&&r.k!=="n")return;let l=Math.min(a,r.hp);if(r.hp-=l,e.score+=l*10,e.v.dmg+=l,e.v.hits++,e.hits++,r.hp<=0){if(e.cells[s]=null,e.broke++,e.v.broke++,e.score+=r.max*10,e.fx.push({t:"break",c:t,r:o,max:r.max,k:r.k,src:n}),r.k==="n"){e.fx.push({t:"nova",c:t,r:o});for(let c=-1;c<=1;c++)for(let d=-1;d<=1;d++)if(c||d){let h=t+d,f=o+c;h>=0&&h<7&&f>=0&&f<10&&vt(e,h,f,2,"nova")}}}else e.quiet||e.fx.push({t:"hit",c:t,r:o,hp:r.hp,max:r.max,src:n})}function gn(e,t){t.x<.15?(t.x=.15+(.15-t.x),t.vx=Math.abs(t.vx),e.quiet||e.fx.push({t:"wall",x:t.x,y:t.y})):t.x>7-.15&&(t.x=7-.15-(t.x-(7-.15)),t.vx=-Math.abs(t.vx),e.quiet||e.fx.push({t:"wall",x:t.x,y:t.y})),t.y<.15&&(t.y=.15+(.15-t.y),t.vy=Math.abs(t.vy),e.quiet||e.fx.push({t:"wall",x:t.x,y:t.y}));let o=Math.floor(t.x),a=Math.floor(t.y),n=-1,s=0,r=0,l=0,c=0,d=0;if(a-1>e.v.low)return;for(let x=a-1;x<=a+1;x++)if(!(x<0||x>=10))for(let $=o-1;$<=o+1;$++){if($<0||$>=7)continue;let F=e.cells[x*7+$];if(!F)continue;if(F.k==="o"||F.k==="s"||F.k==="z"){let ra=t.x-($+.5),ia=t.y-(x+.5);ra*ra+ia*ia<(.24+.15)*(.24+.15)&&yn(e,$,x,F,t);continue}let ao=$+.05,ln=$+1-.05,cn=x+.05,dn=x+1-.05,fn=Math.max(ao,Math.min(ln,t.x)),un=Math.max(cn,Math.min(dn,t.y)),no=t.x-fn,so=t.y-un,ro=no*no+so*so;if(ro>=.15*.15)continue;let sa=.15-Math.sqrt(ro);(n<0||sa>d)&&(n=$,s=x,r=no,l=so,c=ro,d=sa)}if(n<0)return;let h=n,f=s,w=r,A=l,v=c,M,u;if(v>1e-12){let x=Math.sqrt(v);M=w/x,u=A/x}else M=-t.vx/.3,u=-t.vy/.3;let S=t.vx*M+t.vy*u;S<0&&(t.vx-=2*S*M,t.vy-=2*S*u),t.x+=M*(d+.001),t.y+=u*(d+.001);let C=.3*.12;if(Math.abs(t.vy)<C){t.vy=t.vy<0?-C:C;let x=.3*.3-C*C;t.vx=(t.vx<0?-1:1)*Math.sqrt(x)}vt(e,h,f,1,t.i)}function yn(e,t,o,a,n){let s=o*7+t;if(a.k==="o")e.cells[s]=null,e.balls++,e.fx.push({t:"orb",c:t,r:o});else if(a.k==="s")e.cells[s]=null,e.shards++,e.fx.push({t:"shard",c:t,r:o});else if(a.k==="z"){if(n.z===s)return;n.z=s,e.v.beams.includes(s)||e.v.beams.push(s),e.fx.push({t:"beam",c:t,r:o});for(let r=0;r<7;r++)r!==t&&vt(e,r,o,1,"beam");for(let r=0;r<10;r++)r!==o&&vt(e,t,r,1,"beam")}}function fo(e){let t=e.v;if(!t)return!1;t.tick++,t.launched<e.balls&&(t.tick-1)%4===0&&(t.balls.push({i:t.launched,x:e.x,y:11-.15,vx:t.d.x*.3,vy:t.d.y*.3,done:!1,z:-1}),t.launched++,e.quiet||e.fx.push({t:"launch",i:t.launched}));let o=1/2;for(let a of t.balls)if(!a.done){for(let n=0;n<2;n++)if(a.x+=a.vx*o,a.y+=a.vy*o,gn(e,a),a.y>=11-.15&&a.vy>0){a.done=!0,a.y=11-.15,t.home++,t.firstX===null&&(t.firstX=Math.max(.15*2,Math.min(7-.15*2,a.x)),e.fx.push({t:"first",x:t.firstX})),e.quiet||e.fx.push({t:"home",x:a.x});break}}if(t.tick>=1500)for(let a of t.balls)a.done||(a.done=!0,t.home++);return t.launched>=e.balls&&t.home>=t.launched?(bn(e),!1):!0}function bn(e){let t=e.v;e.v=null,t.firstX!==null&&(e.x=t.firstX);for(let n of t.beams)e.cells[n]&&e.cells[n].k==="z"&&(e.cells[n]=null);let o=0;for(let n of e.cells)n&&(n.k==="b"||n.k==="n")&&o++;let a=o===0;if(a&&(e.score+=250*e.wave,e.fx.push({t:"clear",bonus:250*e.wave})),e.waves.push({w:e.wave,broke:t.broke,clear:a,dmg:t.dmg,aim:t.aim}),t.dmg>e.bestVolley&&(e.bestVolley=t.dmg),e.fx.push({t:"volley",broke:t.broke,dmg:t.dmg,clear:a}),e.limit&&e.wave>=e.limit){e.alive=!1,e.over="done",e.fx.push({t:"done"});return}kt(e)}function Pe(e,t){if(!co(e,t))return!1;let o=0;for(;fo(e)&&o<1510;)o++,e.fx.length>256&&(e.fx.length=0);return e.fx.length=0,!0}function xn(e){let t=JSON.parse(JSON.stringify({...e,v:null,fx:[]}));return t.fx=[],t}function wn(e){let t=null;for(let o=9;o>=0&&!t;o--)for(let a=0;a<7;a++){let n=Ct(e,a,o);n&&(n.k==="b"||n.k==="n")&&(!t||n.hp<t.hp)&&(t={c:a,r:o,hp:n.hp})}return t?lo(e.x,11,t.c+.5,t.r+1.2)??0:0}function Mt(e,t=1){let o=wn(e);if(t<1)return o;let a=9*t,n=o,s=-1e9;for(let r=0;r<=a;r++){let l=r===a?o:He(-900+1800*r/(a-1)),c=xn(e);c.quiet=!0,Pe(c,l);let d=0;for(let f=9;f>=0&&!d;f--)for(let w=0;w<7;w++){let A=Ct(c,w,f);if(A&&(A.k==="b"||A.k==="n")){d=f;break}}let h=(c.alive?0:-1e6)+c.score-e.score+(c.balls-e.balls)*120-d*40;h>s&&(s=h,n=l)}return n}var Ve=e=>e.map(t=>(t<0?"-":"")+Math.abs(Math.round(t)).toString(36)).join(".");function it(e){if(typeof e!="string"||e.length>2e3||!/^-?[0-9a-z]{1,3}(\.-?[0-9a-z]{1,3})*$/.test(e))return null;let t=e.split(".").map(o=>o[0]==="-"?-parseInt(o.slice(1),36):parseInt(o,36));return t.every(o=>Number.isFinite(o)&&Math.abs(o)<=940)?t:null}function uo(e,t,o={}){let a=At(e,{quiet:!0,...o});a.fx.length=0;for(let n of t){if(!a.alive)break;Pe(a,n)}return a}var la=e=>e.shards*5+Math.floor(e.score/100);function Ye(e){return e.waves.map(t=>t.clear?"\u{1F48E}":t.broke>=3?"\u{1F537}":t.broke>=1?"\u{1F539}":"\u25AB\uFE0F").join("")+(e.over==="wall"?"\u{1F4A5}":"")}var se={glass:{name:"Glass",cost:0,bg:["#0B0A1F","#161042"],tint:"rgba(16,10,48,.5)",ramp:[[70,225,255],[125,110,255],[205,80,255],[255,80,170]],line:"#7FE8FF",key:0},reef:{name:"Neon Reef",cost:900,bg:["#03161A","#062A2E"],tint:"rgba(0,30,34,.55)",ramp:[[70,255,210],[170,255,90],[255,214,80]],line:"#6BFFD8",key:2},forge:{name:"Ember Forge",cost:1400,bg:["#160806","#2A0E08"],tint:"rgba(40,10,4,.55)",ramp:[[255,200,90],[255,120,50],[235,40,70]],line:"#FFB45C",key:5},garden:{name:"Midnight Garden",cost:2e3,bg:["#081410","#141A2A"],tint:"rgba(8,20,22,.5)",ramp:[[140,255,190],[255,150,200],[170,90,255]],line:"#A8FFD0",key:7},sunset:{name:"Sunset Pop",cost:0,pack:"collection",bg:["#1A0820","#2E0C2A"],tint:"rgba(40,6,30,.5)",ramp:[[255,210,140],[255,110,150],[160,80,255]],line:"#FFC48A",key:3},gilded:{name:"Gilded Hall",cost:0,pack:"collection",bg:["#120E06","#1E170A"],tint:"rgba(24,18,6,.55)",ramp:[[255,240,190],[255,205,90],[210,150,40]],line:"#FFE08A",key:9}},re={spark:{name:"Spark",cost:0,c:"#FFFFFF",g:[180,240,255]},ember:{name:"Ember",cost:300,c:"#FFE2B8",g:[255,140,60]},mint:{name:"Mint",cost:300,c:"#E8FFF4",g:[80,255,180]},rose:{name:"Rose",cost:600,c:"#FFE6F2",g:[255,90,170]},void:{name:"Void",cost:900,c:"#1A1030",g:[170,110,255],ring:!0},sol:{name:"Sol",cost:1500,c:"#FFF8D8",g:[255,210,70]},comet:{name:"Kindle Comet",cost:0,pack:"starter",c:"#FFF1D6",g:[255,120,40],ring:!0},prism:{name:"Prism",cost:0,pack:"collection",c:"#FFFFFF",g:"rainbow"},gilded:{name:"Gilded",cost:0,pack:"collection",c:"#FFF4C8",g:[255,200,60],ring:!0}},ft={none:{name:"No trail",cost:0,n:0},ribbon:{name:"Ribbon",cost:400,n:6,w:.7},stardust:{name:"Stardust",cost:800,n:8,dots:!0},comet:{name:"Comet tail",cost:0,pack:"starter",n:10,w:1},aurora:{name:"Aurora",cost:1500,n:10,w:.9,rainbow:!0},lightning:{name:"Lightning",cost:0,pack:"collection",n:8,zig:!0}},ze,i,W=0,G=0,Se=1,m=40,N=0,U=0,ut=!1,ge={theme:"glass",ball:"spark",trail:"none"},Ee=null,ne=0,$e=0,me=0,po=0,Fe=[],ct=[],Pt=[],dt=[],Et=[],Ft=new Map,Ke=new Map,Tt=new Map;function ca(e,t={}){if(ze=e,i=ze.getContext("2d",{alpha:!1}),ut=!!t.reduce,t.look&&(ge={...ge,...t.look}),t.bg){let o=new Image;o.decoding="async",o.onload=()=>{Ee=o},o.src=t.bg}go()}function da(e){ge={...ge,...e}}function go(){Se=Math.min(2,window.devicePixelRatio||1);let e=ze.getBoundingClientRect();W=Math.max(200,e.width),G=Math.max(300,e.height),ze.width=Math.round(W*Se),ze.height=Math.round(G*Se);let t=Math.min(78,Math.max(58,G*.085)),o=34;m=Math.floor(Math.min((W-16)/7,(G-t-o)/11)),N=Math.round((W-m*7)/2),U=Math.round(t+Math.max(0,(G-t-o-m*11)/2))}var fa=(e,t)=>({x:(e-N)/m,y:(t-U)/m}),ua=()=>se[ge.theme]||se.glass;function mo(e){let t=ua().ramp,o=Math.max(0,Math.min(1,e))*(t.length-1),a=Math.min(t.length-2,Math.floor(o)),n=o-a,s=t[a],r=t[a+1];return[s[0]+(r[0]-s[0])*n,s[1]+(r[1]-s[1])*n,s[2]+(r[2]-s[2])*n]}var _=(e,t=1)=>`rgba(${e[0]|0},${e[1]|0},${e[2]|0},${t})`;function pt(e,t){let o=`${e[0]>>3},${e[1]>>3},${e[2]>>3},${t}`,a=Tt.get(o);if(!a){a=document.createElement("canvas"),a.width=a.height=t*2;let n=a.getContext("2d"),s=n.createRadialGradient(t,t,0,t,t,t);s.addColorStop(0,_(e,.9)),s.addColorStop(.25,_(e,.38)),s.addColorStop(.6,_(e,.09)),s.addColorStop(1,_(e,0)),n.fillStyle=s,n.fillRect(0,0,t*2,t*2),Tt.size>300&&Tt.clear(),Tt.set(o,a)}return a}var pa=e=>{let t=o=>{let a=(o+e/60)%6;return 255*(1-Math.max(0,Math.min(a,4-a,1)))};return[t(5),t(3),t(1)]},ho=e=>{let t=re[ge.ball]||re.spark;return t.g==="rainbow"?pa((ne*90+e*37)%360):t.g},ue=e=>N+(e+.5)*m,pe=e=>U+(e+.5)*m;function Rt(e,t,o,a,n=1){a=ut?Math.ceil(a/3):a;for(let s=0;s<a;s++){let r=Math.random()*Math.PI*2,l=(.6+Math.random()*1.6)*m*2.2*n;Fe.push({x:e,y:t,vx:Math.cos(r)*l,vy:Math.sin(r)*l-m*.8,life:0,max:.55+Math.random()*.5,s:m*(.06+Math.random()*.1),rot:Math.random()*6,vr:(Math.random()-.5)*14,col:o})}Fe.length>700&&Fe.splice(0,Fe.length-700)}function ma(e,t,o){if(e.t==="hit"){let a=Ke.get(e.r*7+e.c)||{k:0,w:0};a.k=1,a.w=1,Ke.set(e.r*7+e.c,a),Math.random()<.5&&Rt(ue(e.c),pe(e.r),mo(e.hp/Math.max(1,o*2)),2,.5)}else if(e.t==="break"){let a=mo(e.max/Math.max(1,o*2));Rt(ue(e.c),pe(e.r),a,16,1),Rt(ue(e.c),pe(e.r),[255,255,255],5,.7),ct.push({x:ue(e.c),y:pe(e.r),life:0,max:.45,r0:m*.3,r1:m*1.1,col:a}),Ke.delete(e.r*7+e.c)}else e.t==="nova"?(ct.push({x:ue(e.c),y:pe(e.r),life:0,max:.7,r0:m*.4,r1:m*2.6,col:[255,236,170],w:3}),ut||($e=Math.min(1,$e+.55)),me=Math.min(.35,me+.18)):e.t==="beam"?Pt.push({c:e.c,r:e.r,life:0,max:.35}):e.t==="orb"||e.t==="shard"?(Et.push({x:ue(e.c),y:pe(e.r),life:0,max:.6,k:e.t,tx:null}),Rt(ue(e.c),pe(e.r),e.t==="orb"?[255,255,255]:[255,220,120],6,.6)):e.t==="clear"?(dt.push({text:`CLEAR +${e.bonus.toLocaleString("en-US")}`,x:N+m*7/2,y:U+m*3,life:0,max:1.6,big:!0}),me=Math.min(.4,me+.25)):e.t==="breach"?(ut||($e=1),me=.5):e.t==="wave"&&(Ot=1)}var Ot=0;function ha(e,t=!1){dt.push({text:e,x:N+m*7/2,y:U+m*4.2,life:0,max:t?1.6:1.1,big:t})}function ga(){Ft.clear()}function Sn(e,t){let o=io(t),a=e.x,n=11-.15,s=o.x,r=o.y,l=0,c=[[a,n]],d=.08;for(let h=0;h<260&&l<12;h++){a+=s*d,n+=r*d,l+=d,a<.15&&(a=.15,s=-s,c.push([a,n])),a>7-.15&&(a=7-.15,s=-s,c.push([a,n])),n<.15&&(n=.15,r=-r,c.push([a,n]));let f=Math.floor(a),w=Math.floor(n),A=Ct(e,f,w);if(A&&(A.k==="b"||A.k==="n"))break}return c.push([a,n]),c}function lt(e,t,o,a,n){i.beginPath(),i.moveTo(e+n,t),i.arcTo(e+o,t,e+o,t+a,n),i.arcTo(e+o,t+a,e,t+a,n),i.arcTo(e,t+a,e,t,n),i.arcTo(e,t,e+o,t,n),i.closePath()}function An(){let e=ua(),t=i.createLinearGradient(0,0,0,G);if(t.addColorStop(0,e.bg[0]),t.addColorStop(1,e.bg[1]),i.fillStyle=t,i.fillRect(0,0,W,G),Ee){let n=Math.max(W/Ee.width,G/Ee.height),s=Ee.width*n,r=Ee.height*n;i.globalAlpha=1,i.drawImage(Ee,(W-s)/2,(G-r)/2+(ut?0:Math.sin(ne*.15)*6),s,r),i.globalAlpha=1,i.globalAlpha=.25,i.fillStyle=e.tint,i.fillRect(0,0,W,G),i.globalAlpha=1}let o=i.createLinearGradient(0,0,0,G);o.addColorStop(0,"rgba(150,200,255,.52)"),o.addColorStop(.55,"rgba(190,160,255,.42)"),o.addColorStop(1,"rgba(255,170,215,.46)"),i.globalCompositeOperation="screen",i.fillStyle=o,i.fillRect(0,0,W,G),i.globalCompositeOperation="source-over",i.fillStyle="rgba(20,16,60,.16)",lt(N-6,U-6,m*7+12,m*11+12,16),i.fill(),i.strokeStyle="rgba(255,255,255,.22)",i.lineWidth=1,i.stroke();let a=U+9*m;i.fillStyle=`rgba(255,80,120,${.05+po*.22*(.7+.3*Math.sin(ne*6))})`,i.fillRect(N,a,m*7,2)}function Cn(e,t){let o=Ot*m,a=Math.max(4,m*.16);for(let n=0;n<10;n++)for(let s=0;s<7;s++){let r=e.cells[n*7+s];if(!r)continue;let l=N+s*m,c=U+n*m-o;if(r.k==="o"){let $=1+Math.sin(ne*4+s)*.08,F=.24*m*$;i.globalCompositeOperation="lighter";let ao=pt([200,240,255],32);i.drawImage(ao,l+m/2-F*2.2,c+m/2-F*2.2,F*4.4,F*4.4),i.globalCompositeOperation="source-over",i.strokeStyle="rgba(255,255,255,.95)",i.lineWidth=Math.max(2,m*.06),i.beginPath(),i.arc(l+m/2,c+m/2,F,0,Math.PI*2),i.stroke(),i.fillStyle="#fff",i.font=`800 ${Math.round(m*.26)}px ${Xe}`,i.textAlign="center",i.textBaseline="middle",i.fillText("+1",l+m/2,c+m/2+1);continue}if(r.k==="s"){let $=ne*2+s,F=m*.17;i.save(),i.translate(l+m/2,c+m/2),i.rotate(Math.sin($)*.3),i.scale(Math.abs(Math.cos($*.7))*.5+.5,1),i.fillStyle="#FFD86B",i.beginPath(),i.moveTo(0,-F*1.3),i.lineTo(F,0),i.lineTo(0,F*1.3),i.lineTo(-F,0),i.closePath(),i.fill(),i.fillStyle="rgba(255,255,255,.7)",i.beginPath(),i.moveTo(0,-F*1.3),i.lineTo(F*.4,-F*.2),i.lineTo(-F*.3,-F*.1),i.closePath(),i.fill(),i.restore();continue}if(r.k==="z"){let $=.6+.4*Math.sin(ne*5+n);i.strokeStyle=`rgba(150,255,255,${$})`,i.lineWidth=Math.max(2,m*.07),i.lineCap="round",i.beginPath(),i.moveTo(l+m*.25,c+m/2),i.lineTo(l+m*.75,c+m/2),i.moveTo(l+m/2,c+m*.25),i.lineTo(l+m/2,c+m*.75),i.stroke();continue}let d=Ke.get(n*7+s),h=r.hp/Math.max(1,t*1.6),f=mo(h),w=d?d.k:0,A=.05*m-w*m*.04,v=l+A,M=c+A,u=m-A*2,S=m-A*2;i.globalCompositeOperation="lighter";let C=pt(f,48);i.globalAlpha=.6+w*.4,i.drawImage(C,v-u*.45,M-S*.45,u*1.9,S*1.9),i.globalAlpha=1,i.globalCompositeOperation="source-over";let x=i.createLinearGradient(v,M,v+u,M+S);x.addColorStop(0,_(f.map($=>Math.min(255,$*1.08+50)),1)),x.addColorStop(.55,_(f,.96)),x.addColorStop(1,_(f.map($=>$*.62),.95)),i.fillStyle=x,lt(v,M,u,S,a),i.fill(),i.fillStyle="rgba(255,255,255,.16)",lt(v+3,M+3,u-6,S*.38,a*.7),i.fill(),i.strokeStyle=_(f.map($=>Math.min(255,$+90)),.9),i.lineWidth=1.5,lt(v+.75,M+.75,u-1.5,S-1.5,a),i.stroke(),r.k==="n"&&(i.fillStyle="rgba(255,248,210,.95)",Mn(v+u/2,M+S/2,u*.16,u*.07,5+.5*Math.sin(ne*3))),d&&d.w>0&&(i.fillStyle=`rgba(255,255,255,${d.w*.55})`,lt(v,M,u,S,a),i.fill()),i.fillStyle="rgba(10,8,24,.88)",i.font=`800 ${Math.round(m*(r.hp>=100?.3:.36))}px ${Xe}`,i.textAlign="center",i.textBaseline="middle",i.fillText(String(r.hp),v+u/2,M+S/2+(r.k==="n"?S*.24:1))}}function Mn(e,t,o,a,n){i.beginPath();for(let s=0;s<10;s++){let r=n*.2+s*Math.PI/5,l=s%2?a:o;i.lineTo(e+Math.cos(r)*l,t+Math.sin(r)*l)}i.closePath(),i.fill()}function Tn(e){let t=e.v;if(!t)return;let o=ft[ge.trail]||ft.none,a=re[ge.ball]||re.spark,n=.15*m;i.globalCompositeOperation="lighter";for(let s of t.balls){if(s.done){Ft.delete(s.i);continue}let r=N+s.x*m,l=U+s.y*m,c=ho(s.i);if(o.n){let h=Ft.get(s.i);h||(h=[],Ft.set(s.i,h)),h.push([r,l]),h.length>o.n&&h.shift();for(let f=0;f<h.length-1;f++){let w=(f+1)/h.length,A=o.rainbow?pa((ne*120+f*30)%360):c;o.dots?(i.fillStyle=_(A,w*.6),i.beginPath(),i.arc(h[f][0]+Math.sin(f*7.1)*2,h[f][1]+Math.cos(f*5.3)*2,n*.35*w,0,6.3),i.fill()):(i.strokeStyle=_(A,w*.55),i.lineWidth=n*1.6*w*(o.w||1),i.lineCap="round",i.beginPath(),i.moveTo(h[f][0]+(o.zig?f%2?3:-3:0),h[f][1]),i.lineTo(h[f+1][0],h[f+1][1]),i.stroke())}}let d=pt(c,32);i.drawImage(d,r-n*3.4,l-n*3.4,n*6.8,n*6.8)}i.globalCompositeOperation="source-over";for(let s of t.balls){if(s.done)continue;let r=N+s.x*m,l=U+s.y*m;i.fillStyle=a.c,i.beginPath(),i.arc(r,l,n,0,Math.PI*2),i.fill(),a.ring&&(i.strokeStyle=_(ho(s.i),.95),i.lineWidth=1.5,i.stroke())}}function Rn(e,t){let o=N+e.x*m,a=U+(11-.15)*m,n=.15*m*1.15,s=re[ge.ball]||re.spark,r=ho(0);i.globalCompositeOperation="lighter",i.drawImage(pt(r,32),o-n*3.6,a-n*3.6,n*7.2,n*7.2),i.globalCompositeOperation="source-over",(!e.v||e.v.launched<e.balls)&&(i.fillStyle=s.c,i.beginPath(),i.arc(o,a,n,0,Math.PI*2),i.fill());let l=e.v?e.balls-e.v.launched:e.balls;if(l>0&&(i.fillStyle="rgba(255,255,255,.75)",i.font=`700 ${Math.round(m*.3)}px ${Xe}`,i.textAlign="center",i.textBaseline="top",i.fillText(`\xD7${l}`,o,a+n+4)),t.aiming&&t.aim!=null&&!e.v){let c=Sn(e,t.aim),d=0,h=m*.32,f=ne*m*1.6%h;for(let w=0;w<c.length-1;w++){let[A,v]=c[w],[M,u]=c[w+1],S=Math.hypot(M-A,u-v)*m;for(let C=(h-f)%h;C<S;C+=h){let x=C/S,$=1-(d+C)/(m*12);if($<=0)break;i.fillStyle=`rgba(255,255,255,${.85*$})`,i.beginPath(),i.arc(N+(A+(M-A)*x)*m,U+(v+(u-v)*x)*m,Math.max(1.6,m*.045),0,6.3),i.fill()}d+=S,f=0}}}function Pn(e){i.globalCompositeOperation="lighter";for(let t=Fe.length-1;t>=0;t--){let o=Fe[t];if(o.life+=e,o.life>o.max){Fe.splice(t,1);continue}o.vy+=m*7*e,o.vx*=.985,o.x+=o.vx*e,o.y+=o.vy*e,o.rot+=o.vr*e;let a=1-o.life/o.max;i.fillStyle=_(o.col,a),i.save(),i.translate(o.x,o.y),i.rotate(o.rot),i.beginPath(),i.moveTo(0,-o.s*1.4),i.lineTo(o.s,o.s),i.lineTo(-o.s,o.s*.6),i.closePath(),i.fill(),i.restore()}for(let t=ct.length-1;t>=0;t--){let o=ct[t];if(o.life+=e,o.life>o.max){ct.splice(t,1);continue}let a=o.life/o.max,n=1-(1-a)*(1-a);i.strokeStyle=_(o.col,(1-a)*.8),i.lineWidth=(o.w||2)*(1-a)+.5,i.beginPath(),i.arc(o.x,o.y,o.r0+(o.r1-o.r0)*n,0,6.3),i.stroke()}for(let t=Pt.length-1;t>=0;t--){let o=Pt[t];if(o.life+=e,o.life>o.max){Pt.splice(t,1);continue}let a=1-o.life/o.max,n=m*.22*a;i.fillStyle=`rgba(140,255,255,${.5*a})`,i.fillRect(N,pe(o.r)-n/2,m*7,n),i.fillRect(ue(o.c)-n/2,U,n,m*10),i.fillStyle=`rgba(255,255,255,${.8*a})`,i.fillRect(N,pe(o.r)-n/6,m*7,n/3),i.fillRect(ue(o.c)-n/6,U,n/3,m*10)}i.globalCompositeOperation="source-over"}function En(e,t){let o=N+e.x*m,a=U+(11-.15)*m;for(let n=Et.length-1;n>=0;n--){let s=Et[n];if(s.life+=t,s.life>s.max){Et.splice(n,1);continue}let r=s.life/s.max,l=r*r*(3-2*r),c=s.x+(o-s.x)*l,d=s.y+(a-s.y)*l-Math.sin(r*Math.PI)*m;i.globalCompositeOperation="lighter",i.drawImage(pt(s.k==="orb"?[220,245,255]:[255,210,90],32),c-m*.3,d-m*.3,m*.6,m*.6),i.globalCompositeOperation="source-over"}}function Fn(e){for(let t=dt.length-1;t>=0;t--){let o=dt[t];if(o.life+=e,o.life>o.max){dt.splice(t,1);continue}let a=o.life/o.max,n=a<.15?a/.15:1-Math.max(0,(a-.6)/.4);i.globalAlpha=n,i.fillStyle="#fff",i.font=`800 ${Math.round(m*(o.big?.62:.42))}px ${Xe}`,i.textAlign="center",i.textBaseline="middle",i.shadowColor="rgba(120,200,255,.8)",i.shadowBlur=14,i.fillText(o.text,o.x,o.y-a*m*.6),i.shadowBlur=0,i.globalAlpha=1}}var Xe='"Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif';function ya(e,t,o={}){ne+=t,Ot=Math.max(0,Ot-t*5.5);for(let[s,r]of Ke)r.k=Math.max(0,r.k-t*7),r.w=Math.max(0,r.w-t*9),!r.k&&!r.w&&Ke.delete(s);let a=-1;for(let s=0;s<e.cells.length;s++){let r=e.cells[s];r&&(r.k==="b"||r.k==="n")&&(a=Math.floor(s/7))}if(po+=((a>=8?1:a>=7?.4:0)-po)*Math.min(1,t*3),i.setTransform(Se,0,0,Se,0,0),$e>0){let s=$e*$e*m*.18;i.translate((Math.random()-.5)*s,(Math.random()-.5)*s),$e=Math.max(0,$e-t*2.6)}An(),Cn(e,e.wave),Pn(t),Tn(e),En(e,t),Rn(e,o),Fn(t),me>0&&(i.fillStyle=`rgba(255,255,255,${me})`,i.fillRect(-20,-20,W+40,G+40),me=Math.max(0,me-t*1.6));let n=i.createRadialGradient(W/2,G/2,Math.min(W,G)*.35,W/2,G/2,Math.max(W,G)*.75);n.addColorStop(0,"rgba(0,0,0,0)"),n.addColorStop(1,"rgba(20,10,60,.10)"),i.fillStyle=n,i.fillRect(0,0,W,G)}function yo(e=900){let t=document.createElement("canvas");t.width=e,t.height=Math.round(e*(11+.6)/7*.82);let o=t.getContext("2d"),a=(N-8)*Se,n=(U-8)*Se,s=(m*7+16)*Se,r=s*t.height/t.width;return o.drawImage(ze,a,n,s,r,0,0,t.width,t.height),t}function ba(e,t){let o=e.getContext("2d"),a=e.width,n=re[t]||re.spark,s=n.g==="rainbow"?[200,160,255]:n.g;o.clearRect(0,0,a,a);let r=o.createRadialGradient(a/2,a/2,0,a/2,a/2,a/2);r.addColorStop(0,_(s,.8)),r.addColorStop(.5,_(s,.18)),r.addColorStop(1,_(s,0)),o.fillStyle=r,o.fillRect(0,0,a,a),o.fillStyle=n.c,o.beginPath(),o.arc(a/2,a/2,a*.16,0,6.3),o.fill(),n.ring&&(o.strokeStyle=_(s,1),o.lineWidth=2,o.stroke())}function xa(e,t){let o=e.getContext("2d"),a=e.width,n=e.height,s=se[t]||se.glass,r=o.createLinearGradient(0,0,0,n);r.addColorStop(0,s.bg[0]),r.addColorStop(1,s.bg[1]),o.fillStyle=r,o.fillRect(0,0,a,n);let l=a/4.6;s.ramp.forEach((c,d)=>{let h=o.createLinearGradient(0,0,l,l);h.addColorStop(0,_(c.map(f=>Math.min(255,f+40)))),h.addColorStop(1,_(c.map(f=>f*.55))),o.fillStyle=h,o.fillRect(l*.3+d*l*1.45,n/2-l/2,l,l)})}var k=null,Oe=null,Le=null,Ie=null,ye=null,mt=null,ht=!1,ka=!0,De=null,Lt=[],wa=0,wo=0,V=0,Ln=[0,2,4,7,9];function Ae(){if(k){k.state==="suspended"&&k.resume();return}let e=window.AudioContext||window.webkitAudioContext;if(!e)return;k=new e,Oe=k.createGain(),Oe.gain.value=ht?0:.8,ye=k.createDynamicsCompressor(),ye.threshold.value=-20,ye.knee.value=18,ye.ratio.value=3,ye.attack.value=.01,ye.release.value=.25;let t=k.createBiquadFilter();t.type="lowpass",t.frequency.value=7200,t.Q.value=.3,Ie=k.createGain(),Ie.gain.value=1,Le=k.createGain(),Le.gain.value=.28;let o=k.createConvolver();o.buffer=In(1.8),Ie.connect(ye),Le.connect(o),o.connect(ye),ye.connect(t),t.connect(Oe),Oe.connect(k.destination);try{mt=k.createMediaStreamDestination(),Oe.connect(mt)}catch{mt=null}ka&&Sa()}function In(e){let t=Math.floor(k.sampleRate*e),o=k.createBuffer(2,t,k.sampleRate);for(let a=0;a<2;a++){let n=o.getChannelData(a);for(let s=0;s<t;s++)n[s]=(Math.random()*2-1)*Math.pow(1-s/t,2.6)*.6}return o}var va=()=>mt?mt.stream:null;function ko(e){ht=e,Oe&&Oe.gain.setTargetAtTime(e?0:.8,k.currentTime,.05)}function $a(e){ka=e,k&&(e?Sa():Dn())}function vo(e){V=e||0}function $o(){wo=0}function ee(e,t=1,o=.9,a=0){if(!k||ht)return;let n=k.currentTime+a;if(Lt=Lt.filter(r=>r>k.currentTime),Lt.length>16)return;Lt.push(n+o);let s=k.createGain();s.gain.value=0,s.gain.setValueAtTime(0,n),s.gain.linearRampToValueAtTime(.16*t,n+.006),s.gain.exponentialRampToValueAtTime(8e-4,n+o),s.connect(Ie),s.connect(Le);for(let[r,l]of[[1,1],[2.005,.32],[3.01,.12],[4.2,.05]]){let c=k.createOscillator();c.type="sine",c.frequency.value=e*r;let d=k.createGain();d.gain.value=l,c.connect(d),d.connect(s),c.start(n),c.stop(n+o+.05)}}function bo(e,t,o,a,n=0){if(!k||ht)return;let s=k.currentTime+n,r=Math.floor(k.sampleRate*e),l=k.createBuffer(1,r,k.sampleRate),c=l.getChannelData(0);for(let w=0;w<r;w++)c[w]=Math.random()*2-1;let d=k.createBufferSource();d.buffer=l;let h=k.createBiquadFilter();h.type="bandpass",h.frequency.value=t,h.Q.value=o;let f=k.createGain();f.gain.setValueAtTime(0,s),f.gain.linearRampToValueAtTime(a,s+.02),f.gain.exponentialRampToValueAtTime(5e-4,s+e),d.connect(h),h.connect(f),f.connect(Le),f.connect(Ie),d.start(s)}function Je(e,t,o,a="sine",n=0,s=0){if(!k||ht)return;let r=k.currentTime+s,l=k.createOscillator(),c=k.createGain();l.type=a,l.frequency.setValueAtTime(e,r),n&&l.frequency.exponentialRampToValueAtTime(n,r+t),c.gain.setValueAtTime(0,r),c.gain.linearRampToValueAtTime(o,r+.015),c.gain.exponentialRampToValueAtTime(5e-4,r+t),l.connect(c),c.connect(Ie),c.connect(Le),l.start(r),l.stop(r+t+.05)}var j=e=>261.63*Math.pow(2,e/12),xo=e=>V+Ln[(e%5+5)%5]+12*Math.floor(e/5),I={hit(e=1){if(!k)return;let t=k.currentTime;if(t-wa<.035)return;wa=t;let o=wo++%15;ee(j(xo(o)),.65*e,.7)},break(e=1){if(!k)return;let t=wo%15;ee(j(xo(t)+12),.7,1.2),ee(j(xo(t+2)+12),.35,1.1,.04),bo(.35,5200,1.2,.05*e)},nova(){Je(110,.6,.22,"sine",55),bo(.7,2600,.7,.07),ee(j(V+24),.5,1.6,.05)},beam(){Je(880,.25,.05,"triangle",1760),bo(.25,7e3,2,.03)},orb(){ee(j(V+19),.55,.5),ee(j(V+24),.45,.6,.07)},shard(){ee(j(V+28),.35,.4)},launch(){Je(520,.08,.025,"sine",640)},clear(){[0,4,7,12,16].forEach((e,t)=>ee(j(V+12+e),.55,1.6,t*.07))},wave(){Je(j(V-12),.5,.05,"triangle")},breach(){[7,4,0,-5].forEach((e,t)=>ee(j(V+e),.5,1.4,t*.16)),Je(90,1.2,.12,"sine",50)},done(){[0,7,12,16,19,24].forEach((e,t)=>ee(j(V+e),.5,1.8,t*.09))},ui(){Je(660,.07,.04,"sine",760)},coin(){ee(j(V+31),.4,.5)}};function Sa(){if(!k||De)return;let e=k.createGain();e.gain.value=0,e.gain.setTargetAtTime(.035,k.currentTime,1.5);let t=k.createBiquadFilter();t.type="lowpass",t.frequency.value=900;let o=k.createOscillator(),a=k.createGain();o.frequency.value=.07,a.gain.value=350,o.connect(a),a.connect(t.frequency),o.start();let n=[0,7,12].map((s,r)=>{let l=k.createOscillator();return l.type="triangle",l.frequency.value=j(V+s-24),l.detune.value=(r-1)*6,l.connect(t),l.start(),l});t.connect(e),e.connect(Le),e.connect(Ie),De={out:e,oscs:n,lfo:o}}function Dn(){if(!De)return;let e=De;De=null,e.out.gain.setTargetAtTime(0,k.currentTime,.4),setTimeout(()=>{for(let t of e.oscs)t.stop();e.lfo.stop()},2e3)}function Aa(){De&&De.oscs.forEach((e,t)=>e.frequency.setTargetAtTime(j(V+[0,7,12][t]-24),k.currentTime,.8))}var Ca="cmx-ft";var Qe=(e,t)=>String(e||"").toLowerCase().replace(/^www\./,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").slice(0,t).replace(/-+$/,""),Bn=e=>e.replace(/(^|-)(test|e2e|check|probe|audit|lane\d*|internal)(?=-|$)/g,"$1x");function Gn(e,t){let o=new URLSearchParams(e.search||""),a=o.get("utm_source"),n=o.get("utm_campaign"),s=o.get("s"),r;if(a)r=Qe(a,14)+(n?`-${Qe(String(n).replace(/^\d{4}-\d{2}-\d{2}-(\d+-)?/,""),18)}`:"");else if(s)r=`s-${Qe(s,24)}`;else{let d="";try{d=t?new URL(t).hostname.toLowerCase():""}catch{d="other"}r=d?/(^|\.)cybermaxtools\.com$|cybermax-tools/.test(d)?`site-${Qe(d.split(".")[0],12)}`:`r-${Qe(d,24)}`:"direct"}let l=String(e.pathname||"/").toLowerCase().split("/").filter(d=>d&&!/^index\.html?$/.test(d)),c=Qe(l.slice(-2).join("-"),18)||"home";return Bn(`ft-${r||"direct"}-at-${c}`).slice(0,48).replace(/-+$/,"")}function Ma(){try{let e=JSON.parse(localStorage.getItem(Ca)||"null");if(e&&e.t&&Date.now()-e.at<90*864e5)return e.t;let t=Gn(location,document.referrer);return localStorage.setItem(Ca,JSON.stringify({t,at:Date.now()})),t}catch{return""}}function Nn(e,t){if(!t)return e;try{let o=new URL(e);if(o.hostname==="data.cybermaxtools.com"&&o.pathname.startsWith("/buy/")){let a=(o.searchParams.get("s")||"unknown").toLowerCase().replace(/[^a-z0-9-]/g,"");return a.includes("--ft-")?e:(o.searchParams.set("s",`${a}--${t}`.slice(0,80).replace(/-+$/,"")),o.toString())}if(o.hostname==="buy.stripe.com"){let a=o.searchParams.get("client_reference_id")||"data_unknown";return a.includes("--ft-")?e:(o.searchParams.set("client_reference_id",`${a}--${t}`.slice(0,200)),o.toString())}}catch{}return e}typeof document<"u"&&typeof location<"u"&&!window.__cmxFt&&(window.__cmxFt=1,Ma(),document.addEventListener("click",e=>{let t=e.target&&e.target.closest&&e.target.closest('a[href*="data.cybermaxtools.com/buy/"],a[href*="buy.stripe.com/"]');if(t){let o=Ma();o&&(t.href=Nn(t.href,o))}},!0));var Ta="https://data.cybermaxtools.com",So=/^cs_(live|test)_[A-Za-z0-9]{10,200}$/,Un="https://cybermaxtools.com/terms#payments",Y=e=>String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),be={get(e){try{return localStorage.getItem(e)}catch{return null}},set(e,t){try{t==null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}},Ao=()=>typeof document<"u"&&(!!document.querySelector('meta[name="cmx-portal"]')||!!(window.CMXPortal&&window.CMXPortal.portal));function Ra(e){let t=e.fetch||((...u)=>fetch(...u)),o=`${e.game}:iap-pending`,a=()=>{let u=be.get("cmx-device");if(!u||!/^[A-Za-z0-9_-]{8,64}$/.test(u)){let S=crypto.getRandomValues(new Uint8Array(12));u=btoa(String.fromCharCode(...S)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),be.set("cmx-device",u)}return u},n=(u,S="shop")=>`${Ta}/buy/st-${e.game}-shop-${u}?s=game-${e.game}-${S}`,s=()=>e.offers.filter(u=>u.coins&&!u.looks),r=u=>s().find(S=>S.coins>=u)||s()[s().length-1],l=!1;async function c(u,S=!1){if(u=String(u||"").trim(),S&&e.preRedeem&&u&&!l){l=!0;let C;try{C=await e.preRedeem(u)}finally{l=!1}if(C==="ok"||C==="pass")return C}if(!So.test(u))return e.toast("Paste the order code from your receipt page (it starts with cs_live_).",3500),"bad";if(e.has(u))return be.set(o,null),e.toast("That order is already added on this device.",3e3),"dup";if(l)return"busy";l=!0;try{let C,x;try{C=await t(`${Ta}/unlock/${e.game}-shop/redeem`,{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify({code:u,device:a()})}),x=await C.json()}catch{x=null}if(x&&x.ok){e.credit({coins:x.coins||0,looks:x.looks||[],all:!!x.all,ref:x.ref},u),be.set(o,null);let $=e.offers.find(F=>F.ref===x.ref);return e.toast(`${$?$.name:"Your order"} added${x.coins?`: +${x.coins.toLocaleString("en-US")} coins`:""}. Thank you!`,4e3),e.count("pro",`shop-${x.ref}`),"ok"}return x&&x.error==="already_redeemed"?(be.set(o,null),x.looks&&x.looks.length||x.all?(e.credit({coins:0,looks:x.looks||[],all:!!x.all,ref:x.ref},u),e.toast("Looks restored. The coins of an order are added once, and these already were.",4500),"restored"):(e.toast(x.message||"Those coins were already added (each order adds its coins once).",4e3),"used")):x&&C&&(C.status===400||C.status===402||C.status===404)?(C.status!==402&&be.set(o,null),e.toast(x.message||"That code is not a paid order from this shop.",4e3),"refused"):(be.set(o,u),e.toast(x&&x.message||"Could not reach the shop check. Your order is safe; we will try again next time you open the game.",4500),"later")}finally{l=!1}}function d(){if(Ao())return;let u=new URLSearchParams(location.search),S=/[#&]cmx-pro=([^&]+)/.exec(location.hash||"");if(u.get("unlock")==="shop"&&S){let x=decodeURIComponent(S[1]);u.delete("unlock"),history.replaceState(null,"",location.pathname+(u.toString()?`?${u}`:"")),So.test(x)&&(be.set(o,x),c(x));return}let C=be.get(o);C&&So.test(C)&&c(C)}let h=u=>(e.catalog||[]).find(S=>S.offer===u)||{},f=u=>`<span class="shop-pv" aria-hidden="true" style="background:${u.sw&&u.sw.length>1?`linear-gradient(135deg,${u.sw.map(Y).join(",")})`:Y((u.sw||["#FFB547"])[0])}"><i>${Y(u.icon||"\u{1FA99}")}</i>${u.img?`<img src="${Y(u.img)}" alt="" loading="lazy" onerror="this.remove()">`:""}</span>`,w=u=>Math.round(parseFloat(String(u).replace(/[^0-9.]/g,""))*100)||0;function A(u,S,C="",x=""){let $=S?`<a class="btn sm pass shop-buy x-buy" data-pass href="${S}" rel="nofollow" data-offer="${Y(u.offer)}">${Y(u.price)}${u.per?`<small>${Y(u.per)}</small>`:""}</a>`:"";return{cents:u.cents||0,top:u.kind==="campaign"||u.kind==="full",html:`<div class="shop-row ${C}">${f(u)}<div class="shop-t"><b>${Y(u.name)}</b><span><em>What you get:</em> ${Y(u.what)}</span>${x}</div>${$}</div>`}}function v(u="shop",S=""){let x=[...e.offers.map($=>{let F=h(`st-${e.game}-shop-${$.ref}`);return{cents:F.cents||w($.price),html:`<div class="shop-row${$.best?" best":""}">${f(F)}<div class="shop-t"><b>${Y($.name)}</b><span><em>What you get:</em> ${Y($.what)}</span></div><a class="btn sm pass shop-buy" data-pass href="${n($.ref,u)}" rel="nofollow" data-ref="${$.ref}">${Y($.price)}</a></div>`}}),...e.rows?e.rows(u,A):[]].sort(($,F)=>(F.top?1:0)-($.top?1:0)||$.cents-F.cents);return`${S?`<p class="shop-note">${S}</p>`:""}${e.extra?e.extra(u):""}<div class="shop">${x.map($=>$.html).join("")}</div><p class="shop-fine">${Y(e.fair||"Looks only: coins and packs never change speed, score or the daily board.")} One-time payments unless marked /month or /year, by secure Stripe checkout; your coins are added when you come back here. Coins live in this browser like the rest of your progress. 14-day promise: if it doesn't work as described, we fix it or refund you (<a href="${Un}" target="_blank" rel="noopener">terms</a>). Prices in USD, + tax where applicable.</p>`+(e.foot?`<p class="shop-fine">${e.foot}</p>`:"")+'<details class="shop-code"><summary>Already paid?</summary><form><input aria-label="Order code" autocomplete="off" placeholder="Order code from your receipt page (cs_live_\u2026)"><button class="btn sm" type="submit">Add</button></form></details>'}function M(u){for(let C of u.querySelectorAll("a.shop-buy"))C.addEventListener("click",()=>e.count("cta",C.dataset.ref?`shop-buy-${C.dataset.ref}`:`buy-${String(C.dataset.offer).replace(/^st-/,"")}`.slice(0,40)));for(let C of u.querySelectorAll("a.cplus-buy"))C.addEventListener("click",()=>e.count("cta","plus-buy"));let S=u.querySelector(".shop-code form");S&&S.addEventListener("submit",C=>{C.preventDefault(),c(S.querySelector("input").value,!0)})}return{capture:d,redeem:c,html:v,bind:M,buyUrl:n,packFor:r,device:a,portal:Ao,row:A}}(()=>{if(typeof document>"u"||window.__cmxBd)return;window.__cmxBd=1;let e=null;try{e=JSON.parse(sessionStorage.getItem("cmx-bd")||"null")}catch{}!e&&!Ao()&&fetch("https://cybermaxtools.com/store/buy-direct.json").then(t=>t.json()).then(t=>{e=t;try{sessionStorage.setItem("cmx-bd",JSON.stringify(t))}catch{}}).catch(()=>{}),document.addEventListener("click",t=>{let o=t.target&&t.target.closest&&t.target.closest('a[href*="data.cybermaxtools.com/buy/"]');if(!(!o||!e||!e.offers))try{let a=new URL(o.href),n=/^\/buy\/([a-z0-9-]+)\/?$/.exec(a.pathname),s=n&&e.offers[n[1]];if(!s)return;let r=String(a.searchParams.get("s")||"unknown").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,80)||"unknown";o.href=s.split(e.ph).join(r),navigator.webdriver||navigator.sendBeacon(a.href+(a.search?"&":"?")+"b=1")}catch{}},!0)})();var Ea="https://data.cybermaxtools.com",Pa="prismwick-plus";var Mo=e=>`${Ea}/buy/st-prismwick-plus-unlock?s=game-prismwick-${e}`,Ce="pw-plus",_e="cmx-pro:fun-pass",Wn=/^(cs_(live|test)_[A-Za-z0-9]{10,200}|[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})$/i,qn=/^cmxk1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/;var jn="u0FDxbu0d9B9Sz5-yLT6AuL5IagyTlFcbBgEDqZxWtk",xe=e=>{try{return JSON.parse(localStorage.getItem(e)||"null")}catch{return null}},et=(e,t)=>{try{t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))}catch{}},Co=e=>{for(e=e.replace(/-/g,"+").replace(/_/g,"/");e.length%4;)e+="=";return Uint8Array.from(atob(e),t=>t.charCodeAt(0))};function Fa(e){let t=e.fetch||((...f)=>fetch(...f)),o=()=>{let f=xe(Ce);return!!(f&&f.code&&!f.pend)},a=()=>{let f=xe(_e);return!!(f&&f.code)},n=()=>o()||a(),s=()=>{try{e.onChange(n())}catch{}};async function r(f,w=Pa){try{let v=await(await t(`${Ea}/unlock/${w}?json=1&session_id=${encodeURIComponent(f)}`)).json();return v&&typeof v.pro=="boolean"?v.pro:null}catch{return null}}async function l(f){let[w,A,v]=f.split("."),M;try{M=JSON.parse(new TextDecoder().decode(Co(A)))}catch{return!1}if(!M||M.a!==Pa)return!1;try{let u=await crypto.subtle.importKey("raw",Co(jn),{name:"Ed25519"},!1,["verify"]);if(await crypto.subtle.verify({name:"Ed25519"},u,Co(v),new TextEncoder().encode(`${w}.${A}`))&&(!M.x||M.x*1e3>Date.now()))return!0}catch{}return M.c?r(M.c):!1}function c(f,w){et(Ce,{code:f,...w?{key:w}:{},at:new Date().toISOString()}),e.count("pro","plus-unlocked"),e.toast("Prism+ is on: Zen mode, the Daily archive and Hard mode. Thank you!",4e3),s()}async function d(f,{quiet:w=!1,key:A=""}={}){let v=String(f||"").trim();if(qn.test(v))return d("",{quiet:w,key:v});if(!v&&!A)return"bad";if(n()&&v&&(xe(Ce)?.code===v||xe(_e)?.code===v))return e.toast("Prism+ is already on in this browser.",3e3),"ok";let M=A?await l(A):null;if(M!==!0&&v){if(!Wn.test(v))return"bad";M=await r(v)}return M===!0?(c(v||A,A),"ok"):M===null&&w?"later":M===null?(et(Ce,{code:v||A,pend:!0}),e.toast("Could not reach the order check. Your order is safe: we will try again next time you open the game.",4500),"later"):v&&await r(v,"fun-pass")===!0?(et(_e,{code:v,at:new Date().toISOString(),checked:Date.now()}),e.count("pro","plus-funpass"),e.toast("Fun Pass is on. It includes Prism+: Zen mode, the Daily archive and Hard mode.",4e3),s(),"pass"):(xe(Ce)?.pend&&et(Ce,null),w||e.toast("That code is not a Prism+ order.",3500),"no")}async function h(){if(e.portal())return;let f=new URLSearchParams(location.search),w=location.hash||"",A=/[#&]cmx-pro=([^&]+)/.exec(w),v=/[#&]cmx-key=([^&]+)/.exec(w);if(f.get("unlock")==="plus"&&A)return f.delete("unlock"),history.replaceState(null,"",location.pathname+(f.toString()?`?${f}`:"")),d(decodeURIComponent(A[1]),{key:v?decodeURIComponent(v[1]):""});let M=xe(Ce);if(M&&M.pend)return d(M.code);let u=xe(_e);if(u&&u.code&&Date.now()-(u.checked||0)>2592e5){let S=/^cmxk1\./.test(u.code)?!0:await r(u.code,"fun-pass");S===!1?(et(_e,null),s()):S&&et(_e,{...u,checked:Date.now()})}return null}return{on:n,own:o,pass:a,redeem:d,capture:h,code:()=>xe(Ce)?.code||xe(_e)?.code||""}}var jo={};mn(jo,{ARENA_API:()=>tt,BOARD_SIZE:()=>Po,POLICY:()=>Be,board:()=>Do,cachedBoard:()=>Gt,cleanNick:()=>ot,cupNumber:()=>Lo,drain:()=>qo,flush:()=>It,groupBoard:()=>Uo,groupFromUrl:()=>Go,groupLink:()=>No,h2h:()=>Wt,h2hRecord:()=>Ut,joinGroup:()=>_o,leaveGroup:()=>Kn,loadTraffic:()=>Fo,ls:()=>P,mondayOf:()=>Bt,myGroups:()=>Ge,newGroup:()=>Bo,noteMode:()=>Dt,pending:()=>Hn,post:()=>Wo,queued:()=>Zn,quiet:()=>Ba,sent:()=>Ga,tag:()=>Nt,tally:()=>Oo,traffic:()=>we,weekOf:()=>_t});var tt="https://toys.cybermaxtools.com",Be={normal:{w:1,board:3e5},high:{w:10,board:9e5},surge:{w:100,board:36e5}},Po=20,T=globalThis,_a=/^[A-HJ-NP-Z2-9]{6}$/,Oa="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";function P(e,t){try{if(t===void 0)return JSON.parse(T.localStorage.getItem(e)||"null");t===null?T.localStorage.removeItem(e):T.localStorage.setItem(e,JSON.stringify(t))}catch{}return t}var Z=()=>Date.now(),Eo=()=>{try{return T.location.hostname||""}catch{return""}};function Ba(){return T.__cmxBeaconTest?!1:T.__cmxNoBeacon?!0:/^(localhost|127\.|0\.0\.0\.0|\[::1\])/.test(Eo())||!!(T.navigator&&T.navigator.webdriver)}function we(){let e=P("cmx-traffic");return e&&e.until>Z()&&Be[e.mode]?e.mode:"normal"}function Dt(e,t=30*6e4){if(!Be[e])return;let o=P("cmx-traffic");o&&o.forced&&o.until>Z()||P("cmx-traffic",{mode:e,until:Z()+t})}async function Fo(e=""){try{if(!T.__cmxTrafficBase&&!/(^|\.)cybermaxtools\.com$/.test(Eo()))return we();let t=P("cmx-traffic-file");if(t&&Z()-t<6*36e5)return we();P("cmx-traffic-file",Z());let o=await T.fetch(`${T.__cmxTrafficBase||e||""}/games/traffic.json`,{cache:"no-cache",signal:yt(3e3)}),a=o.ok?await o.json():null;a&&Be[a.mode]&&P("cmx-traffic",{mode:a.mode,until:Z()+6*36e5,forced:!0})}catch{}return we()}var yt=e=>T.AbortSignal&&T.AbortSignal.timeout?T.AbortSignal.timeout(e):void 0,gt=new Map,To=0,La=!1,Ga=[],Ia=e=>String(e||"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,40);function Oo(e,t,o=""){let a=Ia(o);try{T.dispatchEvent&&T.dispatchEvent(new T.CustomEvent("cmx:count",{detail:{game:e,ev:t,ch:a}}))}catch{}if(Ba())return;let n=`${t}:${Ia((T.__cmxChPrefix||"")+a)}`,s=gt.get(e)||{};s[n]=(s[n]||0)+1,gt.set(e,s),To++,!La&&T.addEventListener&&(La=!0,T.addEventListener("pagehide",()=>It("pagehide")),T.document&&T.document.addEventListener("visibilitychange",()=>{T.document.visibilityState==="hidden"&&It("hidden")})),To>=60&&It("full")}var Hn=()=>Object.fromEntries([...gt].map(([e,t])=>[e,{...t}]));function It(e=""){let t=0,o=Be[we()].w;for(let[a,n]of gt)if(Object.keys(n).length&&(T.__cmxRandom||Math.random)()*o<1){let s=JSON.stringify({t:a,n,w:o});try{T.navigator&&T.navigator.sendBeacon&&T.navigator.sendBeacon(`${tt}/eb`,new T.Blob([s],{type:"text/plain"}))||T.fetch(`${tt}/eb`,{method:"POST",body:s,keepalive:!0,mode:"no-cors",headers:{"content-type":"text/plain"}}).catch(()=>{})}catch{}Ga.push({game:a,n:{...n},w:o,why:e}),t++}return gt.clear(),To=0,t}function _t(e){let[t,o,a]=e.split("-").map(Number),n=new Date(Date.UTC(t,o-1,a));n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+6)%7+3);let s=n.getUTCFullYear();return`${s}-W${String(Math.floor((n-Date.UTC(s,0,1))/864e5/7)+1).padStart(2,"0")}`}function Bt(e){let t=+e.slice(0,4),o=+e.slice(6),a=Date.UTC(t,0,4),n=(new Date(a).getUTCDay()+6)%7;return new Date(a-n*864e5+(o-1)*7*864e5).toISOString().slice(0,10)}var Lo=e=>Math.round((Date.parse(Bt(e))-Date.parse("2026-11-02"))/(7*864e5))+1;function Vn(e,t){let o=Date.parse(t);if(/^\d{4}-\d{2}-\d{2}$/.test(e))return Math.abs(Date.parse(e)-o)<=864e5;let a=n=>new Date(o+n*864e5).toISOString().slice(0,10);return[a(-1),a(0),a(1)].some(n=>_t(n)===e)}var Io=e=>({top:(e.top||[]).slice(0,Po).map(t=>({name:t.name,score:t.score})),cut:e.cut||0,ghost:e.ghost&&typeof e.ghost.taps=="string"&&e.ghost.taps.length<=12e3?e.ghost:null,mode:e.mode||""}),Yn=e=>e&&e.top&&e.top.length>=Po?e.cut||e.top[e.top.length-1].score:0;function Gt(e,t){let o=P(`cmx-board:${e}:${t}`);return o?{...o.j,at:o.at}:null}function Na(e,t,o){P(`cmx-board:${e}:${t}`,{at:Z(),j:Io(o)});try{let a=[];for(let n=0;n<T.localStorage.length;n++){let s=T.localStorage.key(n);s&&s.startsWith("cmx-board:")&&a.push(s)}a.length>8&&a.map(n=>[n,(P(n)||{}).at||0]).sort((n,s)=>n[1]-s[1]).slice(0,a.length-8).forEach(([n])=>P(n,null))}catch{}}async function Do(e,t,{fresh:o=!1,wait:a=4500}={}){let n=P(`cmx-board:${e}:${t}`);if(!o&&n&&Z()-n.at<Be[we()].board)return{...n.j,src:"cache"};try{let r=await T.fetch(`${tt}/api/board?g=${encodeURIComponent(e)}&d=${encodeURIComponent(t)}`,{signal:yt(a)});if(r.ok){let l=await r.json();return l.mode&&Dt(l.mode),Na(e,t,l),{...Io(l),src:"live"}}}catch{}let s=await zn(e,t);return s?{...s,src:"snapshot"}:n?{...n.j,src:"stale"}:null}async function zn(e,t){try{if(!T.__cmxSnapshotBase&&!/(^|\.)cybermaxtools\.com$/.test(Eo()))return null;let o=await T.fetch(`${T.__cmxSnapshotBase||""}/games/boards/${e}.json`,{signal:yt(3e3)}),a=o.ok?await o.json():null,n=a&&a.boards&&a.boards[t];return n?Io(n):null}catch{return null}}function Nt(){let e=P("cmx-p");if(!/^[a-z0-9]{8}$/.test(e||"")){e="";for(let t=0;t<8;t++)e+="abcdefghijkmnpqrstuvwxyz23456789"[Math.floor(Math.random()*32)];P("cmx-p",e)}return e}var ot=e=>String(e||"").replace(/[^A-Za-z0-9 ]/g,"").replace(/\s+/g," ").trim().slice(0,10),Ge=()=>Array.isArray(P("cmx-groups"))?P("cmx-groups").filter(e=>_a.test(e.code)):[];function _o(e){if(e=String(e||"").toUpperCase(),!_a.test(e))return!1;let t=Ge().filter(o=>o.code!==e);return t.unshift({code:e,at:Z()}),P("cmx-groups",t.slice(0,3)),!0}function Kn(e){P("cmx-groups",Ge().filter(t=>t.code!==e))}function Bo(){let e="";for(let t=0;t<6;t++)e+=Oa[Math.floor(Math.random()*Oa.length)];return _o(e),e}function Go(e){try{let t=new URLSearchParams(e??T.location.search).get("fg");return t&&_o(t)?t.toUpperCase():""}catch{return""}}function No(e,t){let o=new URL(e);return o.searchParams.set("fg",t),o.toString()}async function Uo(e,t,o,{fresh:a=!1}={}){let n=`cmx-group:${e}:${t}:${o}`,s=P(n);if(!a&&s&&Z()-s.at<Be[we()].board)return{...s.j,src:"cache"};try{let r=await T.fetch(`${tt}/api/group?g=${encodeURIComponent(e)}&d=${encodeURIComponent(o)}&code=${t}`,{signal:yt(4500)});if(r.ok){let l=await r.json();l.mode&&Dt(l.mode);let c={top:(l.top||[]).slice(0,50)};return P(n,{at:Z(),j:c}),{...c,src:"live"}}}catch{}return s?{...s.j,src:"stale"}:null}var Da=(e,t,o)=>`${e}|${t}|${o}`;function Ua(e,t,o,a){let n=P("cmx-gbest")||{};if(a===void 0)return n[Da(e,t,o)]||0;n[Da(e,t,o)]=a;let s=Object.keys(n);if(s.length>60)for(let r of s.slice(0,s.length-60))delete n[r];return P("cmx-gbest",n),a}async function Wo(e,t,{name:o,taps:a,score:n,nick:s="",groups:r=!0,today:l=""}={}){let c=r?Ge().map(w=>w.code).filter(w=>n>Ua(e,w,t)):[],d=Gt(e,t),h=Yn(d);if(h&&n<=h&&!c.length)return{state:"skipped",rank:0,score:n,cut:h,message:`Saved on this device. The top 20 starts at ${h.toLocaleString("en-US")}.`};let f={game:e,d:t,name:o,taps:a,score:n,nick:ot(s)||o,gs:c,at:Z(),today:l};return we()==="surge"?Ro(f,"Busy moment on the board: saved, and it posts on its own later."):Wa(f)}async function Wa(e){let t;try{t=await T.fetch(`${tt}/api/board`,{method:"POST",headers:{"content-type":"application/json"},signal:yt(8e3),body:JSON.stringify({g:e.game,d:e.d,name:e.name,taps:e.taps,s:e.score,groups:e.gs,p:e.gs.length?Nt():void 0,nick:e.nick})})}catch{return Ro(e,"Offline for now: saved, and it posts on its own later.")}let o=null;try{o=await t.json()}catch{}if(t.ok&&o&&o.ok){o.mode&&Dt(o.mode),Array.isArray(o.top)&&Na(e.game,e.d,o);for(let a of o.groups||[])a&&a.best&&Ua(e.game,a.code,e.d,a.best);return{state:"posted",rank:o.rank||0,score:o.score??e.score,groups:o.groups||[],checked:o.checked!==!1,message:o.rank?`Posted! You're #${o.rank}.`:"Posted! Not in the top 20 yet. Keep going."}}return t.status===422||t.status===400?{state:"refused",rank:0,score:e.score,message:o&&o.message||"That run could not be posted."}:Ro(e,"The board is busy: saved, and it posts on its own later.")}function Ro(e,t){let o=(P("cmx-q")||[]).filter(a=>!(a.game===e.game&&a.d===e.d&&a.score>=e.score));if(!o.some(a=>a.game===e.game&&a.d===e.d))o.push(e);else for(let a=0;a<o.length;a++)o[a].game===e.game&&o[a].d===e.d&&(o[a]=e);return P("cmx-q",o.slice(-10)),{state:"queued",rank:0,score:e.score,message:t}}var Zn=e=>(P("cmx-q")||[]).filter(t=>!e||t.game===e);async function qo(e,t){if(we()==="surge")return null;let a=(P("cmx-q")||[]).filter(r=>Vn(r.d,t||new Date().toISOString().slice(0,10))),n=a.findIndex(r=>r.game===e);if(n<0)return P("cmx-q",a),null;let[s]=a.splice(n,1);return P("cmx-q",a),Wa(s)}function Ut(e,t,o,a,n){let s=P("cmx-h2h")||{},r=s[e]||(s[e]={}),l=ot(t).toLowerCase()||"friend",c=r[l]||(r[l]={name:ot(t)||"Friend",c:{}}),d=c.c[o];(!d||a>d.mine)&&(c.c[o]={mine:a,theirs:n});let h=Object.keys(c.c);if(h.length>50)for(let f of h.slice(0,h.length-50))delete c.c[f];return P("cmx-h2h",s),Wt(e,t)}function Wt(e,t){let o=((P("cmx-h2h")||{})[e]||{})[ot(t).toLowerCase()||"friend"],a={name:o?o.name:ot(t),w:0,l:0,t:0};if(o)for(let{mine:n,theirs:s}of Object.values(o.c))n>s?a.w++:n<s?a.l++:a.t++;return a}var qt=[{offer:"st-prismwick-plus-unlock",kind:"campaign",name:"Prism+",what:"Zen mode, Hard mode and every past Daily Prism. One payment.",cents:299,price:"$2.99",per:"",icon:"\u2728",sw:["#B98BFF","#3A2BFF"],store:"https://cybermaxtools.com/store/prism-volley-plus/",img:"https://cybermaxtools.com/store/img/prismwick-plus-0.webp"},{offer:"st-prismwick-shop-shards-1500",kind:"coins",name:"Shard Pouch",what:"1,500 shards for balls, trails and themes.",cents:99,price:"$0.99",per:"",icon:"\u{1F48E}",sw:["#BFF6FF","#7FE8FF"],store:"https://cybermaxtools.com/store/prism-volley-shop/"},{offer:"st-prismwick-shop-starter",kind:"coins",name:"Starter Pack",what:"3,000 shards + the Kindle Comet ball and Comet tail (only in this pack).",cents:199,price:"$1.99",per:"",icon:"\u2604\uFE0F",sw:["#FFB36B","#FF6A3D"],store:"https://cybermaxtools.com/store/prism-volley-shop/"},{offer:"st-prismwick-shop-shards-5000",kind:"coins",name:"Shard Chest",what:"5,000 shards.",cents:299,price:"$2.99",per:"",icon:"\u{1F48E}",sw:["#7FE8FF","#7A6BFF"],store:"https://cybermaxtools.com/store/prism-volley-shop/"},{offer:"st-fun-pass-monthly",kind:"pass",name:"Fun Pass",what:"In Prism Volley: Prism+ (Zen mode, Hard mode, every past Daily Prism). Plus every paid level, chapter and mode in every CyberMax game. Cancel any time.",cents:299,price:"$2.99",per:"/month",icon:"\u2728",sw:["#FFB547","#FF6A3D"],store:"https://cybermaxtools.com/store/fun-pass/",img:"https://cybermaxtools.com/store/img/fun-pass-icon.webp",alt:[{offer:"st-fun-pass-yearly",label:"$19/year"},{offer:"st-fun-pass-unlock",label:"$29.99 for life"}]},{offer:"st-prismwick-shop-collection",kind:"looks",name:"Prism Collection",what:"Every ball, trail and theme now, plus the Prism and Gilded balls, the Lightning trail and 2 exclusive themes.",cents:499,price:"$4.99",per:"",icon:"\u{1F308}",sw:["#7FE8FF","#B98BFF","#FF6AC8"],store:"https://cybermaxtools.com/store/prism-volley-shop/"},{offer:"st-prismwick-shop-shards-15000",kind:"coins",name:"Shard Vault",what:"15,000 shards, the most shards per dollar.",cents:699,price:"$6.99",per:"",icon:"\u{1F4B0}",sw:["#E7D8FF","#7A2BFF"],store:"https://cybermaxtools.com/store/prism-volley-shop/"},{offer:"st-arcade-lifetime-lifetime",kind:"arcade",name:"Arcade Lifetime",what:"In Prism Volley: Prism+ for good. Plus every content unlock in every CyberMax game (full games, Campaign+, new chapters), the Fun Pass for life and every Skin, Look and Founder Pack. Shard packs not included.",cents:3999,price:"$39.99",per:"",icon:"\u{1F579}\uFE0F",sw:["#5CF2FF","#B26BFF"],store:"https://cybermaxtools.com/store/arcade-lifetime/",img:"https://cybermaxtools.com/store/img/arcade-lifetime-icon.webp"}],Ho={shopFrom:"$0.99",shopResults:"\u{1F48E} Shards, looks & Prism+ \u2192",shopStore:"https://cybermaxtools.com/store/prism-volley-shop/",shopPass:!0};var le="prismwick",za="https://cybermaxtools.com/games/prism-volley/",q=new URLSearchParams(location.search),fe=q.has("cap"),Xt=/^(localhost|127\.|0\.0\.0\.0|\[::1\])/.test(location.hostname)&&!q.has("api"),Ka=matchMedia("(prefers-reduced-motion: reduce)").matches||q.has("calm"),g=e=>document.getElementById(e),L=e=>Math.round(e).toLocaleString("en-US"),We=e=>String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),Me=q.get("day")&&/^\d{4}-\d{2}-\d{2}$/.test(q.get("day"))&&(Xt||fe)?q.get("day"):new Date().toISOString().slice(0,10),z=$t(Me),Za=St(z),Yt=$t("2026-10-31"),je=z-Yt+1,ae=_t(Me),qe=Lo(ae),Jn=St($t(Bt(ae))),H={get(e,t){try{let o=localStorage.getItem("pw-"+e);return o==null?t:JSON.parse(o)}catch{return t}},set(e,t){try{localStorage.setItem("pw-"+e,JSON.stringify(t))}catch{}}},p={shards:H.get("shards",0),best:H.get("best",0),own:H.get("own",["spark","none","glass"]),look:H.get("look",{ball:"spark",trail:"none",theme:"glass"}),daily:H.get("daily",null),streak:H.get("streak",{last:0,n:0}),name:H.get("name",""),mute:H.get("mute",!1),music:H.get("music",!0),runs:H.get("runs",0),iap:H.get("iap",[]),fired:H.get("fired",0),week:H.get("week",null)};Array.isArray(p.iap)||(p.iap=[]);var Te=()=>{for(let e of Object.keys(p))H.set(e,p[e])};function Re(e,t=""){fe||Oo(le,e,t)}var b=null;if(q.get("c")){let[e,t,o,a]=q.get("c").split("."),n=parseInt(e,36);if(n>0&&n<2147483647&&(b={seed:n,score:Math.max(0,+t||0),name:(o||"A FRIEND").toUpperCase().replace(/[^A-Z0-9 ]/g,"").slice(0,10)||"A FRIEND",wave:Math.max(0,+a||0),aims:it(q.get("gh")||"")||null,lim:+q.get("lim")===20?20:0,re:Math.max(0,+q.get("re")||0),id:q.get("c"),checked:null}),b&&b.aims&&!b.aims.length&&(b.aims=null),b&&b.aims){let s=uo(b.seed,b.aims,b.lim?{limit:b.lim}:{});b.checked=s.score===b.score,b.score=s.score,b.wave=s.wave}b&&b.re&&Ut(le,b.name,`re:${b.id}`,b.re,b.score)}var qa=Go(location.search),O=null,ve=g("c");ca(ve,{reduce:Ka,look:p.look,bg:"art/bg.webp"});ko(p.mute);vo(se[p.look.theme]?.key||0);var y=null,E="daily",at=Za,B="aim",ce=[],de=!1,ie=null,Ue=1,Ne=0,Yo=0,Xa=0,zt=0,Jt=null,Kt=-1,te=null,Vo=[],zo=0,Qo=null,Ko=!p.fired,R=window.__prismwick={state:B,get run(){return y},aims:()=>ce,errors:[],restartMs:[],version:1},nt=e=>{B=e,R.state=e,document.documentElement.dataset.state=e},J={daily:{label:()=>`Daily Prism #${je}`,opts:()=>({limit:20}),seed:()=>Za},endless:{label:()=>"Endless",opts:()=>({}),seed:()=>(fe||Xt)&&+q.get("seed")>0?+q.get("seed"):(Math.random()*2147483640|0)+1},challenge:{label:()=>`Beat ${b.name}`,opts:()=>b.lim?{limit:b.lim}:{},seed:()=>b.seed},week:{label:()=>`Weekly Cup #${qe}`,opts:()=>({limit:20}),seed:()=>Jn},zen:{label:()=>"Zen",opts:()=>({zen:!0}),seed:()=>(Math.random()*2147483640|0)+1,plus:!0},hard:{label:()=>"Hard",opts:()=>({hard:!0}),seed:()=>(Math.random()*2147483640|0)+1,plus:!0},archive:{label:()=>`Daily Prism #${Zo-Yt+1}`,opts:()=>({limit:20}),seed:()=>St(Zo),plus:!0}},Zo=z-1;function xt(e=E,t={}){let o=performance.now();if(J[e].plus&&!ke.on())return st(`mode-${e}`),o;E=e,at=J[e].seed(),y=At(at,J[e].opts()),y.fx.length=0,O=null;let a=e==="challenge"&&b&&b.aims?{name:b.name,score:b.score,aims:b.aims}:e==="daily"&&t.ghost==="top"&&Ht()?{name:`#1 ${Ht().name}`,score:Ht().score,aims:it(Ht().taps)}:e==="week"&&p.week&&p.week.wk===ae&&p.week.enc?{name:"your best",score:p.week.score,aims:it(p.week.enc)}:null;a&&a.aims&&(O={...a,run:At(at,J[e].opts()),i:0}),ce=[],de=!1,ie=null,Ue=1,Ne=0,Jt=null,Kt=-1,Qo=null,ga(),$o();for(let n of["over","sheet"])g(n).hidden=!0;return g("hud").hidden=!1,g("h-fast").hidden=!0,nt("aim"),Qt(),Re("play",e),p.runs++,Te(),o}R.start=e=>xt(e);function ea(e){let t=ve.getBoundingClientRect(),o=fa(e.clientX-t.left,e.clientY-t.top);return lo(y.x,11,o.x,o.y)}ve.addEventListener("pointerdown",e=>{if(Ae(),B==="volley"){oa();return}B==="aim"&&(de=!0,ie=ea(e),ve.setPointerCapture?.(e.pointerId),e.preventDefault())});ve.addEventListener("pointermove",e=>{if(B==="aim"&&(de||e.pointerType==="mouse")){let t=ea(e);t!=null&&(ie=t),e.pointerType==="mouse"&&(de=!0)}});ve.addEventListener("pointerup",e=>{if(B!=="aim"||!de)return;let t=ea(e);t!=null&&(ie=t),ie!=null&&(e.pointerType!=="mouse"||t!=null)&&ta(ie),e.pointerType!=="mouse"&&(de=!1)});ve.addEventListener("pointerleave",e=>{e.pointerType==="mouse"&&B==="aim"&&(de=!1)});addEventListener("keydown",e=>{e.target.closest?.("input,form,textarea")||(B==="aim"&&(e.code==="ArrowLeft"||e.code==="ArrowRight"||e.code==="KeyA"||e.code==="KeyD")?(Ae(),de=!0,ie=He((ie??0)+(e.code==="ArrowLeft"||e.code==="KeyA"?-25:25)*(e.shiftKey?4:1)),e.preventDefault()):e.code==="Space"||e.code==="Enter"?(e.preventDefault(),Ae(),B==="aim"?ta(ie??0):B==="volley"?oa():B==="over"&&eo()):e.code==="KeyM"?rn():e.code==="Escape"&&!g("sheet").hidden&&sn())});function ta(e){!y||!y.alive||y.v||(e=He(e),co(y,e)&&(ce.push(e),de=!1,Yo=0,Ne=0,Ue=1,nt("volley"),$o(),Ko&&(Ko=!1,p.fired=1,Te(),g("hint").classList.add("gone")),ns()))}R.fire=e=>ta(e);function oa(){Ue=Ue===1?2.5:1,g("h-fast").classList.toggle("on",Ue>1),I.ui()}g("h-fast").onclick=e=>{e.stopPropagation(),oa()};function Qn(e){Ne+=e*60*Ue;let t=0;for(;Ne>=1&&t<12&&y.v;){Ne-=1,t++;let o=fo(y);for(let a of y.fx)es(a);if(y.fx.length=0,!o){ts();break}}Ne>12&&(Ne=0)}function es(e){ma(e,y,y.wave),e.t==="hit"?e.src!=="beam"&&e.src!=="nova"&&I.hit():e.t==="break"?(I.break(e.max>y.wave?1.2:.8),jt(8)):e.t==="nova"?(I.nova(),jt(25)):e.t==="beam"?I.beam():e.t==="orb"?I.orb():e.t==="shard"?I.shard():e.t==="launch"&&e.i%3===1?I.launch():e.t==="clear"?(I.clear(),jt([15,30,15])):e.t==="breach"?(I.breach(),jt([40,60,120])):e.t==="done"?I.done():e.t==="wave"&&y.wave>1&&I.wave()}var jt=e=>{if(!Ka)try{navigator.vibrate?.(e)}catch{}};function ts(){let e=y.waves[y.waves.length-1];if(ss(e?e.dmg:0),e&&e.dmg>=Kt*.999&&(Qo=yo(900)),e&&e.broke>=5&&!e.clear&&ha(e.broke>=8?"PRISMATIC!":"SHATTER!",e.broke>=8),Ue=1,g("h-fast").classList.remove("on"),g("h-fast").hidden=!0,Qa(),!y.alive){nt("end"),zt=0;return}nt("aim"),Qt()}var Xo=performance.now();function aa(e){B==="volley"?(Yo+=e,Qn(e),Yo>2.2&&g("h-fast").hidden&&(g("h-fast").hidden=!1),Qt()):B==="end"&&(zt+=e,zt>(y.over==="wall"?1.1:1.4)&&os()),y&&ya(y,e,{aiming:de&&B==="aim",aim:ie}),R.restartAt&&B==="aim"&&(R.restartMs.push(performance.now()-R.restartAt),R.restartAt=0)}R.frame=aa;function Ja(e){let t=Math.min(.05,(e-Xo)/1e3);Xo=e,aa(t),requestAnimationFrame(Ja)}var ja="";function Qa(){if(!(!O||!y)){for(;O.run.alive&&O.i<O.aims.length&&O.run.waves.length<y.waves.length;)Pe(O.run,O.aims[O.i++]);O.run.fx.length=0}}function Qt(){Qa();let e=J[E].opts().limit,t=`${J[E].label()} \xB7 Wave ${y.wave}${e?`/${e}`:""}|${L(y.score)}`;if(t===ja)return;ja=t;let[o,a]=t.split("|");if(g("h-mode").textContent=o,g("h-score").textContent=a,O&&y.waves.length){let n=y.score-O.run.score;g("h-mode").textContent=`${n>=0?"\u25B2":"\u25BC"} ${L(Math.abs(n))} vs ${O.name} \xB7 Wave ${y.wave}`}else E==="challenge"&&(g("h-mode").textContent=y.score>b.score?`${b.name} beaten \xB7 Wave ${y.wave}`:`Beat ${b.name}: ${L(b.score-y.score)} to go`)}function os(){if(nt("over"),Xa=performance.now(),O){for(;O.run.alive&&O.i<O.aims.length;)Pe(O.run,O.aims[O.i++]);O.run.fx.length=0}let e=y.score,t=la(y);p.shards+=t;let o,a=J[E].opts().limit,n=!1;if(E==="daily")(!p.daily||p.daily.day!==z||e>p.daily.score)&&(p.daily={day:z,score:e,enc:Ve(ce),grid:Ye(y),wave:y.wave},n=!0),p.streak.last!==z&&(p.streak={last:z,n:p.streak.last===z-1?p.streak.n+1:1}),o=y.over==="done"?`Daily Prism #${je} complete`:`The wall reached you on wave ${y.wave}`;else if(E==="week"){let c=!p.week||p.week.wk!==ae||e>p.week.score;c&&(p.week={wk:ae,score:e,enc:Ve(ce),grid:Ye(y)}),o=c?`Weekly Cup #${qe}: new best`:`Weekly Cup #${qe}`,c&&(n=!0)}else{let c=E!=="archive"&&e>p.best;c&&(p.best=e),o=E==="challenge"?e>b.score?`You beat ${b.name}!`:`${b.name} still leads`:c?"New best!":`Wave ${y.wave}`}let s="";if(E==="challenge"&&b){let c=Ut(le,b.name,b.id,e,b.score);s=` \xB7 vs ${c.name} ${c.w}\u2013${c.l}${c.t?`\u2013${c.t}`:""}`}Te(),g("o-head").textContent=o,g("o-score").textContent=L(e),g("o-sub").textContent=`${a?`${y.waves.length}/${a} waves`:`${y.wave} waves`} \xB7 ${y.broke} blocks \xB7 +${L(t)} shards${E==="daily"&&p.streak.n>1?` \xB7 \u{1F525} ${p.streak.n}-day streak`:""}${O?` \xB7 ${O.name}: ${L(O.run.score)}`:""}${s}`,g("o-grid").textContent=Ye(y),g("o-post").hidden=!(E==="daily"||E==="week"),g("o-share").textContent=E==="challenge"?`\u21A9 Send it back to ${b.name}`:"Copy result",n&&p.name&&Ge().length&&!fe&&an(p.name,!0),g("o-clip").hidden=!Jt,g("o-form").hidden=!0;let r=!K.portal()&&fs();g("o-shop").hidden=K.portal();let l=!K.portal()&&!ke.on()&&p.runs>=3&&(qt||[]).find(c=>c.offer==="st-prismwick-plus-unlock");g("o-shop").textContent=l?`\u2728 Prism+: Zen, Hard and every past Daily Prism \xB7 ${l.price} \u2192`:r?`${r.it.name}: ${nn(r.need)}`:Ho.shopResults||"\u{1F48E} Shards & looks \u2192",g("over").hidden=!1,g("hud").hidden=!0,Re("win",E)}function eo(){B==="over"&&performance.now()-Xa<300||(I.ui(),R.restartAt=performance.now(),xt(E==="archive"?"archive":E),R.resetMs=R.resetMs||[],R.resetMs.push(performance.now()-R.restartAt))}R.again=eo;function as(){if(typeof MediaRecorder>"u")return"";for(let e of["video/mp4;codecs=avc1","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"])if(MediaRecorder.isTypeSupported?.(e))return e;return""}function ns(){if(fe||!ve.captureStream)return;let e=as();if(e)try{let t=ve.captureStream(30),o=va();if(o)for(let a of o.getAudioTracks())t.addTrack(a);Vo=[],te=new MediaRecorder(t,{mimeType:e,videoBitsPerSecond:35e5}),te.ondataavailable=a=>{a.data&&a.data.size&&Vo.push(a.data)},te.onstop=()=>{let a=new Blob(Vo,{type:e.split(";")[0]});zo>=Kt&&a.size>1e3&&(Jt=a,Kt=zo,B==="over"&&(g("o-clip").hidden=!1))},te.start(250),setTimeout(()=>{te&&te.state==="recording"&&B!=="volley"&&te.stop()},14e3)}catch{te=null}}function ss(e){zo=e,te&&te.state==="recording"&&setTimeout(()=>{try{te.stop()}catch{}},450)}function en(){let o=document.createElement("canvas");o.width=1080,o.height=1350;let a=o.getContext("2d"),n=se[p.look.theme]||se.glass,s=a.createLinearGradient(0,0,0,1350);s.addColorStop(0,n.bg[0]),s.addColorStop(1,n.bg[1]),a.fillStyle=s,a.fillRect(0,0,1080,1350);let r=Xe;a.textAlign="center",a.fillStyle="#fff",a.font=`800 64px ${r}`,a.fillText("PRISM VOLLEY",1080/2,110),a.fillStyle="rgba(255,255,255,.7)",a.font=`600 34px ${r}`,a.fillText(E==="daily"?`Daily Prism #${je} \xB7 ${Me}`:J[E].label(),1080/2,160);let l=Qo||yo(900),c=760,d=Math.round(l.height*c/l.width),h=(1080-c)/2,f=200;a.save(),a.beginPath(),a.roundRect?.(h,f,c,Math.min(d,640),28),a.clip(),a.drawImage(l,h,f,c,d),a.restore(),a.strokeStyle="rgba(255,255,255,.18)",a.lineWidth=2,a.beginPath(),a.roundRect?.(h,f,c,Math.min(d,640),28),a.stroke(),a.fillStyle="#fff",a.font=`800 150px ${r}`,a.shadowColor=n.line,a.shadowBlur=40,a.fillText(L(y.score),1080/2,1e3),a.shadowBlur=0,a.fillStyle="rgba(255,255,255,.8)",a.font=`600 38px ${r}`,a.fillText(`${y.waves.length} waves \xB7 ${y.broke} blocks shattered`,1080/2,1060);let w=Ye(y),A=Math.ceil([...w].length/2);a.font='48px "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif';let v=[...w];return a.fillText(v.slice(0,A).join(""),1080/2,1150),v.length>A&&a.fillText(v.slice(A).join(""),1080/2,1210),a.fillStyle=n.line,a.font=`700 34px ${r}`,a.fillText("Play free: cybermaxtools.com/games/prism-volley",1080/2,1300),o}R.card=()=>en().toDataURL("image/png");function tn(){let e=J[E].opts().limit;return`${E==="daily"?`Prism Volley Daily #${je}`:E==="challenge"?`Prism Volley: ${y.score>b.score?`beat ${b.name}`:`vs ${b.name}`}`:`Prism Volley ${J[E].label()}`} \xB7 ${L(y.score)}${e?` \xB7 ${y.waves.length}/${e}`:` \xB7 wave ${y.wave}`} | |
| ${Ye(y)}`}R.shareText=tn;function on(){let e=(p.name||"FRIEND").replace(/[^A-Z0-9]/gi,"").toUpperCase()||"FRIEND",t=J[E].opts().limit;return`${za}?c=${at.toString(36)}.${y.score}.${e}.${y.wave}&gh=${Ve(ce)}${t?`&lim=${t}`:""}${E==="challenge"&&b?`&re=${b.score}`:""}&utm_source=share&utm_medium=${E==="daily"?"daily":"challenge"}&utm_campaign=prismwick`}R.challengeUrl=()=>on();async function na(e){I.ui(),Re("share",e);let t=on(),o=tn();try{if(e==="card"||e==="clip"){let a=e==="clip"?Jt:await new Promise(l=>en().toBlob(l,"image/png"));if(!a)return;let n=e==="clip"?a.type.includes("mp4")?"mp4":"webm":"png",s=new File([a],`prismwick-${E}-${y.score}.${n}`,{type:a.type});if(navigator.canShare?.({files:[s]})){await navigator.share({files:[s],text:o,url:t});return}let r=document.createElement("a");r.href=URL.createObjectURL(a),r.download=s.name,r.click(),setTimeout(()=>URL.revokeObjectURL(r.href),4e3),oe(e==="clip"?"Clip saved. Post it, then send the link.":"Score card saved.");return}if(navigator.share&&matchMedia("(pointer: coarse)").matches){await navigator.share({text:o,url:t});return}await navigator.clipboard.writeText(`${o} | |
| ${t}`),oe("Copied. Paste it anywhere.")}catch(a){if(a?.name!=="AbortError")try{await navigator.clipboard.writeText(`${o} | |
| ${t}`),oe("Copied.")}catch{prompt("Copy this:",`${o} | |
| ${t}`)}}}function oe(e,t=2600){let o=g("toast");o.textContent=e,o.hidden=!1,clearTimeout(o._h),o._h=setTimeout(()=>o.hidden=!0,t)}var X="today",Jo=null,Ht=()=>Jo&&Jo.ghost||(Gt(le,Me)||{}).ghost||null,Ha=(e,t="")=>e.map((o,a)=>`<li class="${t&&o.p===t?"me":""}"><b>${a+1}</b><span>${We(o.nick||o.name)}</span><em>${L(o.score)}</em></li>`).join("");async function rs(){let e=g("b-list"),t=g("b-extra");if(!e)return;let o=X;if(e.innerHTML='<li class="muted">Loading\u2026</li>',t.innerHTML="",o==="friends"){let l=Ge();if(e.innerHTML="",!l.length){t.innerHTML=`<p class="muted">Start a group, send the link: everyone's best Daily Prism lands on one board. No accounts.</p><button class="mb sm" data-act="newgroup" type="button">\u2795 Start a friend group</button>`;return}let c=Nt(),d=p.name?"":'<p class="muted small">Post your Daily Prism once and your best shows up here on its own.</p>';for(let h of l){let f=await Uo(le,h.code,Me);if(X!==o)return;d+=`<p class="mlab chips">Group ${h.code} <button class="chip" data-act="invite" data-code="${h.code}" type="button">Invite</button></p><ol class="board">${f&&f.top.length?Ha(f.top,c):`<li class="muted">${f?"Nobody posted today yet.":"Offline right now."}</li>`}</ol>`}l.length<3&&(d+='<p class="chips"><button class="chip" data-act="newgroup" type="button">\u2795 Another group</button></p>'),t.innerHTML=d;return}let n=await Do(le,o==="cup"?ae:Me);if(X!==o)return;o==="today"&&(Jo=n);let s=n?n.top:[];e.innerHTML=n?s.length?Ha(s):`<li class="muted">Nobody yet ${o==="cup"?"this week":"today"}. Post the first score.</li>`:'<li class="muted">Board offline. Your scores still count on this device.</li>';let r=n&&(n.src==="snapshot"||n.src==="stale")?'<p class="muted small">Saved copy: the live board is resting.</p>':"";o==="today"&&n&&n.ghost?t.innerHTML=`<button class="mb sm" data-act="ghost" type="button">\u{1F47B} Race ${We(n.ghost.name)}'s #1 run (${L(n.ghost.score)})</button>${r}`:o==="cup"?t.innerHTML=`<button class="mb sm" data-mode="week" type="button">\u25B6 Play Weekly Cup #${qe}</button><p class="muted small">One course all week (Monday's Prism). ${p.week&&p.week.wk===ae?`Your best: ${L(p.week.score)}`:"Your best run counts."}</p>${r}`:t.innerHTML=r}R.boardTab=e=>{X=e,Vt("board")};async function an(e,t=!1){let o=E==="week",a=o?p.week&&p.week.wk===ae?p.week:null:p.daily&&p.daily.day===z?p.daily:null,n=a?a.enc:Ve(ce),s=a?a.score:y.score,r=await Wo(le,o?ae:Me,{name:e,taps:n,score:s,nick:e});R.lastPost=r;let l=(r.groups||[]).filter(c=>c.rank).map(c=>`#${c.rank} in ${c.code}`).join(", ");return r.state==="posted"?(g("o-form").hidden=!0,Re("share",o?"cup":"board"),(!t||r.rank||l)&&oe(r.rank?`Posted: #${r.rank} ${o?"in the Cup":"today"} with ${L(r.score)}.${l?` ${l}.`:""}`:l?`Friends board: ${l}.`:`Posted ${L(r.score)}. Not top 20 yet.`,3500)):t||(oe(r.message,3500),r.state!=="refused"&&(g("o-form").hidden=!0)),r}async function is(e){e.preventDefault();let t=g("o-name").value.toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,3);if(!t){oe("Initials: 1 to 3 letters or digits.");return}p.name=t,Te(),await an(t)}async function Va(e){let t=No(`${za}?utm_source=share&utm_medium=group&utm_campaign=prismwick`,e),o=`Join my Prism Volley friend group ${e}: one Daily Prism, our best scores on one board.`;Re("share","group");try{if(navigator.share&&matchMedia("(pointer: coarse)").matches){await navigator.share({text:o,url:t});return}}catch(a){if(a?.name==="AbortError")return}try{await navigator.clipboard.writeText(`${o} | |
| ${t}`),oe("Invite link copied. Send it to your friends.")}catch{prompt("Copy your invite link:",t)}}var wt=[["ball","Balls",re],["trail","Trails",ft],["theme","Themes",se]],ls={starter:"Starter Pack",collection:"Prism Collection"},cs=[{ref:"shards-1500",name:"Shard Pouch",what:"1,500 shards for balls, trails and themes",price:"$0.99",coins:1500},{ref:"starter",name:"Starter Pack",what:"3,000 shards + the Kindle Comet ball and Comet tail trail (only in this pack)",price:"$1.99",coins:3e3,looks:["ball:comet","trail:comet"]},{ref:"shards-5000",name:"Shard Chest",what:"5,000 shards",price:"$2.99",coins:5e3},{ref:"collection",name:"Prism Collection",what:"Every ball, trail and theme now, plus the Prism and Gilded balls, the Lightning trail and the Sunset Pop and Gilded Hall themes",price:"$4.99",looks:["ball:prism","ball:gilded","trail:lightning","theme:sunset","theme:gilded"],best:!0},{ref:"shards-15000",name:"Shard Vault",what:"15,000 shards, the most shards per dollar",price:"$6.99",coins:15e3}],ke=Fa({toast:oe,count:(e,t)=>Re(e,t),onChange:()=>{!g("sheet").hidden&&to==="menu"&&rt()},portal:()=>K.portal()}),K=Ra({game:le,name:"Prism Volley",offers:cs,catalog:qt,rows:(e,t)=>ds(e,t),preRedeem:e=>ke.redeem(e,{quiet:!0}),fair:"Shards and packs are looks only. Prism+ adds Zen, Hard and past dailies. Nothing sold changes the Daily Prism, its board or anyone's score there.",has:e=>p.iap.includes(e),credit(e,t){p.shards+=Math.max(0,Math.floor(e.coins||0));let o=a=>{p.own.includes(a)||p.own.push(a)};if(e.all)for(let[,,a]of wt)for(let[n,s]of Object.entries(a))s.pack||o(n);for(let a of e.looks||[]){let[n,s]=String(a).split(":"),r=wt.find(l=>l[0]===n)?.[2];r&&r[s]&&o(s)}p.iap.includes(t)||p.iap.push(t),Te(),!g("sheet").hidden&&to==="garage"&&Zt()},toast:oe,count:(e,t)=>Re(e,t)}),Ya=(e,t)=>`https://data.cybermaxtools.com/buy/${e}?s=game-prismwick-${t}`;function ds(e,t){let o=s=>(qt||[]).find(r=>r.offer===s),a=[],n=o("st-prismwick-plus-unlock");n&&a.push(ke.on()?t({...n,name:"Prism+ is on",what:`Zen mode, Hard mode and every past Daily Prism${ke.pass()&&!ke.own()?" (with your Fun Pass)":""}. Thank you!`},"","cplus on"):{...t(n,Mo(e),"cplus"),html:t(n,Mo(e),"cplus").html.replace("shop-buy x-buy","cplus-buy")});for(let s of["st-fun-pass-monthly","st-arcade-lifetime-lifetime"]){let r=o(s);if(!r)continue;let l=r.alt?`<span class="shop-alt">or ${r.alt.map(c=>`<a href="${Ya(c.offer,e)}" rel="nofollow" data-offer="${c.offer}">${We(c.label)}</a>`).join(" \xB7 ")}</span>`:"";a.push(t(r,Ya(s,e),"xall",l))}return a}function fs(){let t=wt.flatMap(([,,o])=>Object.entries(o)).filter(([o,a])=>a.cost>0&&!p.own.includes(o)).sort((o,a)=>o[1].cost-a[1].cost)[0];return t&&t[1].cost>p.shards?{it:t[1],need:t[1].cost-p.shards}:null}var nn=e=>{let t=K.packFor(e);return`${L(e)} more shards, or get ${L(t.coins)} for ${t.price}`},to="";function oo(e,t,o){to=e,g("s-title").textContent=t,g("s-body").innerHTML=o,g("sheet").hidden=!1,g("sheet").dataset.kind=e}function sn(){g("sheet").hidden=!0,to="",I.ui(),B==="over"&&(g("over").hidden=!1)}g("s-close").onclick=sn;function st(e,t=""){if(K.portal()){oe("Prism+ modes are part of the full game on cybermaxtools.com.");return}oo("shop","Shop",K.html(e,t)),K.bind(g("s-body")),g("over").hidden=!0,Re("cta",`shop-open-${e}`)}R.shop=(e="test")=>st(e);function Zt(e=""){let t=`<p class="gnote">\u{1F48E} <b>${L(p.shards)}</b> shards${e?` \xB7 <a href="#" data-get>${We(e)}</a>`:""}${K.portal()?"":' \xB7 <a href="#" data-get>Get shards</a>'}</p>`+wt.map(([o,a,n])=>`<h3>${a}</h3><div class="grow">`+Object.entries(n).map(([s,r])=>{let l=p.own.includes(s),c=p.look[o]===s;if(r.pack&&!l&&K.portal())return"";let d=c?"On":l?"Use":r.pack?ls[r.pack]:`\u{1F48E} ${L(r.cost)}`;return`<button class="gi${c?" on":""}${l?"":" lock"}" data-slot="${o}" data-id="${s}" type="button"><canvas width="${o==="theme"?120:72}" height="72" data-pv="${o}:${s}"></canvas><b>${We(r.name)}</b><small>${d}</small></button>`}).join("")+"</div>").join("");oo("garage","Garage",t);for(let o of g("s-body").querySelectorAll("canvas[data-pv]")){let[a,n]=o.dataset.pv.split(":");a==="theme"?xa(o,n):a==="ball"?ba(o,n):us(o,n)}}function us(e,t){let o=e.getContext("2d"),a=ft[t],n=e.width;if(o.clearRect(0,0,n,n),!a.n){o.fillStyle="rgba(255,255,255,.35)",o.font="600 12px system-ui",o.textAlign="center",o.fillText("none",n/2,n/2+4);return}for(let s=0;s<12;s++){let r=s/11,l=a.rainbow?s*30:0;o.fillStyle=a.rainbow?`hsla(${l},90%,65%,${r})`:`rgba(180,230,255,${r*.8})`,o.beginPath(),o.arc(8+s*5,n/2+(a.zig?s%2?5:-5:Math.sin(s/2)*6),(a.dots?2:3+3*r)*(a.w||1),0,6.3),o.fill()}o.fillStyle="#fff",o.beginPath(),o.arc(n-10,n/2,6,0,6.3),o.fill()}g("s-body").addEventListener("click",e=>{if(e.target.closest("[data-get]")){e.preventDefault(),st("garage");return}let o=e.target.closest("[data-mode]");if(o){Ae(),o.dataset.mode==="archive"&&(Zo=+o.dataset.day),xt(o.dataset.mode);return}let a=e.target.closest("[data-act]");if(a&&a.dataset.act==="ghost"){Ae(),xt("daily",{ghost:"top"});return}if(a&&a.dataset.act==="newgroup"){let d=Bo();oe(`Group ${d} made. Send the invite.`),Va(d),X="friends",Vt("board");return}if(a&&a.dataset.act==="invite"){Va(a.dataset.code);return}let n=e.target.closest("[data-btab]");if(n){X=n.dataset.btab,Vt("board");return}if(a){Vt(a.dataset.act);return}let s=e.target.closest("button.gi");if(!s)return;let{slot:r,id:l}=s.dataset,c=wt.find(d=>d[0]===r)[2][l];if(!p.own.includes(l)&&c.pack){I.ui(),st(`garage-${c.pack}`);return}if(!p.own.includes(l)){if(p.shards<c.cost){I.ui(),Zt(K.portal()?`${L(c.cost-p.shards)} more shards`:nn(c.cost-p.shards));return}p.shards-=c.cost,p.own.push(l),I.coin()}p.look[r]=l,Te(),da(p.look),r==="theme"&&(vo(se[l].key),Aa()),I.ui(),Zt()});function rt(){let e=a=>ke.on()?"":' <i class="lockt">Prism+</i>',t=[];for(let a=z-1;a>=Math.max(Yt,z-14);a--)t.push(`<button class="chip" data-mode="archive" data-day="${a}" type="button">#${a-Yt+1}</button>`);let o=`<div class="mgrid"> | |
| <button class="mb main" data-mode="daily" type="button"><b>Daily Prism #${je}</b><small>${p.daily&&p.daily.day===z?`Today: ${L(p.daily.score)} ${We(p.daily.grid||"")}`:"20 waves \xB7 same for everyone"}</small></button> | |
| <button class="mb" data-mode="week" type="button"><b>Weekly Cup #${qe}</b><small>${p.week&&p.week.wk===ae?`Your best ${L(p.week.score)}`:"One course all week"}</small></button> | |
| <button class="mb" data-mode="endless" type="button"><b>Endless</b><small>Best ${L(p.best)}</small></button> | |
| <button class="mb" data-mode="zen" type="button"><b>Zen${e()}</b><small>No game over, just light and sound</small></button> | |
| <button class="mb" data-mode="hard" type="button"><b>Hard${e()}</b><small>Double-strength crystal</small></button> | |
| </div> | |
| ${t.length?`<p class="mlab">Past dailies${e()}</p><div class="chips">${t.join("")}</div>`:""} | |
| <div class="mrow"> | |
| <button class="mb sm" data-act="garage" type="button">\u{1F3A8} Garage</button> | |
| <button class="mb sm" data-act="board" type="button">\u{1F3C6} Board</button> | |
| ${K.portal()?"":`<button class="mb sm" data-act="shop" type="button">\u{1F6CD}\uFE0F Shop <small>from ${We(Ho.shopFrom||"$0.99")}</small></button>`} | |
| <button class="mb sm" data-act="sound" type="button">${p.mute?"\u{1F507} Sound off":"\u{1F50A} Sound on"}</button> | |
| <button class="mb sm" data-act="music" type="button">${p.music?"\u{1F3B5} Pad on":"\u{1F3B5} Pad off"}</button> | |
| </div> | |
| <p class="muted small">Drag to aim, let go to fire. Tap during a volley to speed it up. Keyboard: \u2190 \u2192 aim, Space fires.</p>`;oo("menu","Prism Volley",o)}function Vt(e){if(I.ui(),e==="garage")Zt();else if(e==="board"){let t=(o,a)=>`<button class="chip${X===o?" on":""}" data-btab="${o}" type="button" aria-pressed="${X===o}">${a}</button>`;oo("board",X==="cup"?`Weekly Cup #${qe}`:X==="friends"?"Friends":`Daily Prism #${je}`,`<div class="chips">${t("today","Today")}${t("cup",`Cup #${qe}`)}${t("friends","Friends")}</div><p class="muted">${X==="friends"?"Your friend groups, today.":"Top 20. Every score is re-played on the server from its aims."}</p><ol class="board" id="b-list"></ol><div id="b-extra"></div>`+(X==="today"?`<p class="muted small">${p.daily&&p.daily.day===z?`Your best today: ${L(p.daily.score)}`:"You have not played today's Prism yet."}</p>`:"")),rs()}else e==="shop"?st("menu"):e==="sound"?(rn(),rt()):e==="music"&&(p.music=!p.music,$a(p.music),Te(),rt())}R.menu=()=>rt();g("h-menu").onclick=e=>{e.stopPropagation(),Ae(),rt()};function rn(){p.mute=!p.mute,ko(p.mute),Te()}g("o-again").onclick=eo;g("o-more").onclick=()=>{let e=g("o-details");e.hidden=!e.hidden,g("o-more").textContent=e.hidden?"Share & more \u25BE":"Less \u25B4"};g("o-share").onclick=()=>na("text");g("o-card").onclick=()=>na("card");g("o-clip").onclick=()=>na("clip");g("o-shop").onclick=()=>st("results");g("o-post").onclick=()=>{g("o-form").hidden=!1,g("o-name").value=p.name||"",g("o-name").focus()};g("o-form").onsubmit=is;g("o-menu").onclick=()=>{g("over").hidden=!0,rt()};g("over").addEventListener("pointerdown",e=>{e.target===g("over")&&eo()});addEventListener("resize",()=>go());addEventListener("error",e=>R.errors.push(String(e.message||e)));R.save=()=>JSON.parse(JSON.stringify(p));R.plus=ke;R.warp=(e=1)=>{for(;y.alive;){let t=Mt(y,e);ce.push(t),Pe(y,t)}y.fx.length=0,nt("end"),zt=9,aa(.016)};R.botAim=(e=1)=>Mt(y,e);R.skip=(e=1)=>{for(let t=0;t<e&&y.alive&&!y.v;t++){let o=Mt(y,1);ce.push(o),Pe(y,o)}y.fx.length=0,Qt()};R.replayScore=()=>uo(at,it(Ve(ce)),J[E].opts()).score;R.seed=()=>at;R.dayn=je;if(b){E="challenge";let e=Wt(le,b.name),t=e.w+e.l+e.t?` You ${e.w}\u2013${e.l}.`:"";g("hint").textContent=b.re?`${b.name} answered your ${L(b.re)} with ${L(b.score)}${b.checked?" \u2713":""}. Your move.${t}`:`${b.name} scored ${L(b.score)}${b.checked?" \u2713":""} (wave ${b.wave}).${b.aims?" Race their ghost.":""} Drag to aim, let go to fire.${t}`}else qa&&(g("hint").textContent=`You joined friend group ${qa}. Your best Daily Prism goes on its board.`);xt(b?"challenge":(fe||Xt)&&q.get("mode")==="endless"?"endless":"daily");Ko||g("hint").classList.add("gone");fe||(K.capture(),ke.capture());fe?(Ae(),R.ready=!0):requestAnimationFrame(e=>{Xo=e,Ja(e),R.ready=!0});"serviceWorker"in navigator&&!Xt&&!fe&&navigator.serviceWorker.register("sw.js").catch(()=>{});fe||setTimeout(()=>{Fo(),qo(le,Me)},1500);R.arena=jo;R.ghost=()=>O&&{name:O.name,score:O.run.score,waves:O.run.waves.length};R.chal=()=>b&&{...b,aims:!!b.aims};R.weekId=ae;document.documentElement.classList.add("booted"); | |