From 4133697fd818b1f79eb7421dff98997729f37c0c Mon Sep 17 00:00:00 2001 From: Zutatensuppe Date: Thu, 3 Jun 2021 23:55:39 +0200 Subject: [PATCH] lower volume of click --- build/public/assets/click.550555f3.mp3 | Bin 6783 -> 0 bytes build/public/assets/click.f7a156d0.mp3 | Bin 0 -> 7254 bytes .../{index.e2df6757.js => index.404633f1.js} | 2 +- build/public/index.html | 2 +- src/frontend/click.mp3 | Bin 6783 -> 7254 bytes 5 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 build/public/assets/click.550555f3.mp3 create mode 100644 build/public/assets/click.f7a156d0.mp3 rename build/public/assets/{index.e2df6757.js => index.404633f1.js} (99%) diff --git a/build/public/assets/click.550555f3.mp3 b/build/public/assets/click.550555f3.mp3 deleted file mode 100644 index af958b7f947a40692fd0f3f03a0f84708936ed06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6783 zcmeI0XHb((|L+3?h=52{K#&$f73sZ54<(e)rFVjWz)eR@=phv89iPzlNhKU zo2ur3I)D1~2jnm~WI0x)^XN>Ti>`wCxmnl5{H2KAn?^Jad; zb#ZP5?K3Cac!`ItR^bnPUHr=b#UL^2^@}gXg-81wf!gq%9Fyy-tu^?yy8bzTW88W* z{OLZQSz}}KoZTDA7d-R>8KSM<)l=M-BA1PJ9r)f%IKTsUu7Yqpv)l7C%t4o_l9tW? zkX!EgRGePMRjNC81kTXyHQ3@m!Ht!UsEG&w@Bjip7HUFZ+SOglEGHti_&$ui1AbR8 zTWCfc2ue1c{RuzaL}IK5H6j`|(5=9p%x^`|5ZWg!0z|1c1!E=yLvtTLu%&vWLco{t zx;Gf)f#nXmZ&QQs#Ue1n1!Mc*5yIPv=M*JL35^mBEc9j>6H8QHq{+-uXoHtsWxYth~%q2 zu{~7*hh&4Zk@*yP$#2zyUP8y?rWujk+@+jmZT!NlH8VfXKhKX%vPOD!mp1Wy7i=^} z21zxU_OGNbmued|v^%H|WI8X(6(wiw1#Gx0(tIi;0g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JP0+Y9CDhF=^b_A_ACtAoP8 zkV&slo;?8#aQPHv*`G+*0AMPq_IW8%8+jHq5E`>`XhbbD?Y&?K#r$S^<{u%#(~iz2 zMZfdeKE~kTW~EXb6VE*35H{EE%3c>XITBBJ#m#4Z^(*r+PF6NGy5^>$LYcUiYnLHz3&~?JkGMDOpdwh!I=^Hsg4(K0F+8!7US9OmM z?As>l@`YOg9ib~ta>l1_$P@IBXjqS^ z#<-qmv97V+1dZGhslH3$Zj!|P-t#Hea&{sTPrsTf)?v!#Jf&g1n=xp8!6Gu&;rK?zY{!gb!h%Dqk+HPL&@^*J)GXzkpx`ika{S+OW;yn8F{J%Ib^~xs2wks*ftgy&iYsjfD*%2&nn} zVni58T+8i;>Vzk?lnO=B-<068*^wApyCoOn88f$-mnjvf=U};ZJK(YG za0~1nY^4FZH7m+Qq()L$3=_4;HE0>(j=Yw(A9ed|xh)%Zq0^$$9qAq##(xN#; z&4M|^oj0MRjFH9T3emY5rgg^!c-nk@q;jy2+BGnn8hV)JU`Ko|<=4qC$7%3a#l_@> z&Y~v~7syB`Qu+KPDtr#%__=BT^>y<0gnJ{A&~~k>Z?{>WU7(i&*b&#wFOh2;{;aJl zqAx)|LTFVX%DbGpUoM*InIrY-CR`mGi{V#0tU(7FXeGoGc)sCey`Qwn41v1Uizt!{ zmYM58Ad}~iJCW40V4H;du}5YDj>#^sV8cp1=EsglWX$wRopOt^Fv+f;L~QjemY&Zd zGuhH6#K0!dw4hnr8U$_CGd!??H6Sa(rq5wb)2PE>`#?Ld#=F(V_?ZXrb}{RzF!{c`QUI0Aw_oU#x`MI89) zm;N$DGFj?BjP@BvG1>^JNEEWiVb#;bU=;lguJN=Zt*TrH<7iDbpVmU?*_*eh8 sEdF1x26Y28Ta5e-0QlSo<9$Nz!Tl-P{g!v{19|`ee18}7f1=v|0MoY7YybcN literal 0 HcmV?d00001 diff --git a/build/public/assets/index.e2df6757.js b/build/public/assets/index.404633f1.js similarity index 99% rename from build/public/assets/index.e2df6757.js rename to build/public/assets/index.404633f1.js index 5ed9514..cbb1de0 100644 --- a/build/public/assets/index.e2df6757.js +++ b/build/public/assets/index.404633f1.js @@ -1 +1 @@ -import{d as e,c as t,a as n,w as o,b as l,r as a,o as i,e as s,t as r,F as d,f as c,g as u,h as g,v as p,i as h,j as m,p as y,k as f,l as w,m as v,n as b,q as x,s as C,u as k,x as A,y as S}from"./vendor.684f7bc8.js";var T=e({name:"app",computed:{showNav(){return!["game","replay"].includes(String(this.$route.name))}}});const z={id:"app"},P={key:0,class:"nav"},I=s("Index"),_=s("New game");T.render=function(e,s,r,d,c,u){const g=a("router-link"),p=a("router-view");return i(),t("div",z,[e.showNav?(i(),t("ul",P,[n("li",null,[n(g,{class:"btn",to:{name:"index"}},{default:o((()=>[I])),_:1})]),n("li",null,[n(g,{class:"btn",to:{name:"new-game"}},{default:o((()=>[_])),_:1})])])):l("",!0),n(p)])};const E=864e5,D=e=>{const t=Math.floor(e/E);e%=E;const n=Math.floor(e/36e5);e%=36e5;const o=Math.floor(e/6e4);e%=6e4;return`${t}d ${n}h ${o}m ${Math.floor(e/1e3)}s`};var M=1e3,B=()=>{const e=new Date;return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())},O=(e,t)=>D(t-e),N=D,U=e({name:"game-teaser",props:{game:{type:Object,required:!0}},computed:{style(){return{"background-image":`url("${this.game.imageUrl.replace("uploads/","uploads/r/")+"-375x210.webp"}")`}}},methods:{time(e,t){const n=t?"🏁":"⏳",o=e,l=t||B();return`${n} ${O(o,l)}`}}});const G={class:"game-info-text"},V=n("br",null,null,-1),$=n("br",null,null,-1),R=n("br",null,null,-1),F=s(" β†ͺ️ Watch replay ");U.render=function(e,d,c,u,g,p){const h=a("router-link");return i(),t("div",{class:"game-teaser",style:e.style},[n(h,{class:"game-info",to:{name:"game",params:{id:e.game.id}}},{default:o((()=>[n("span",G,[s(" 🧩 "+r(e.game.tilesFinished)+"/"+r(e.game.tilesTotal),1),V,s(" πŸ‘₯ "+r(e.game.players),1),$,s(" "+r(e.time(e.game.started,e.game.finished)),1),R])])),_:1},8,["to"]),e.game.hasReplay?(i(),t(h,{key:0,class:"game-replay",to:{name:"replay",params:{id:e.game.id}}},{default:o((()=>[F])),_:1},8,["to"])):l("",!0)],4)};var L=e({components:{GameTeaser:U},data:()=>({gamesRunning:[],gamesFinished:[]}),async created(){const e=await fetch("/api/index-data"),t=await e.json();this.gamesRunning=t.gamesRunning,this.gamesFinished=t.gamesFinished}});const j=n("h1",null,"Running games",-1),W=n("h1",null,"Finished games",-1);L.render=function(e,o,l,s,r,u){const g=a("game-teaser");return i(),t("div",null,[j,(i(!0),t(d,null,c(e.gamesRunning,((e,o)=>(i(),t("div",{class:"game-teaser-wrap",key:o},[n(g,{game:e},null,8,["game"])])))),128)),W,(i(!0),t(d,null,c(e.gamesFinished,((e,o)=>(i(),t("div",{class:"game-teaser-wrap",key:o},[n(g,{game:e},null,8,["game"])])))),128))])};var q=e({name:"image-teaser",props:{image:{type:Object,required:!0}},computed:{style(){return{backgroundImage:`url("${this.image.url.replace("uploads/","uploads/r/")+"-150x100.webp"}")`}}},emits:{click:null,editClick:null},methods:{onClick(){this.$emit("click")},onEditClick(){this.$emit("editClick")}}});q.render=function(e,o,l,a,s,r){return i(),t("div",{class:"imageteaser",style:e.style,onClick:o[2]||(o[2]=(...t)=>e.onClick&&e.onClick(...t))},[n("div",{class:"btn edit",onClick:o[1]||(o[1]=u(((...t)=>e.onEditClick&&e.onEditClick(...t)),["stop"]))},"✏️")],4)};var H=e({name:"image-library",components:{ImageTeaser:q},props:{images:{type:Array,required:!0}},emits:{imageClicked:null,imageEditClicked:null},methods:{imageClicked(e){this.$emit("imageClicked",e)},imageEditClicked(e){this.$emit("imageEditClicked",e)}}});H.render=function(e,n,o,l,s,r){const u=a("image-teaser");return i(),t("div",null,[(i(!0),t(d,null,c(e.images,((n,o)=>(i(),t(u,{image:n,onClick:t=>e.imageClicked(n),onEditClick:t=>e.imageEditClicked(n),key:o},null,8,["image","onClick","onEditClick"])))),128))])};const Y={name:"responsive-image",props:{src:String,title:{type:String,default:""},height:{type:String,default:"100%"},width:{type:String,default:"100%"}},computed:{style(){return{display:"inline-block",verticalAlign:"text-bottom",backgroundImage:`url('${this.src}')`,backgroundRepeat:"no-repeat",backgroundSize:"contain",backgroundPosition:"center",width:this.width,height:this.height}}}};Y.render=function(e,n,o,l,a,s){return i(),t("div",{style:s.style,title:o.title},null,12,["title"])};var Q=e({name:"tags-input",props:{modelValue:{type:Array,required:!0},autocompleteTags:{type:Function}},emits:{"update:modelValue":null},data:()=>({input:"",values:[],autocomplete:{idx:-1,values:[]}}),created(){this.values=this.modelValue},methods:{onKeyUp(e){return"ArrowDown"===e.key&&this.autocomplete.values.length>0?(this.autocomplete.idx0?(this.autocomplete.idx>0&&this.autocomplete.idx--,e.stopPropagation(),!1):","===e.key?(this.add(),e.stopPropagation(),!1):void(this.input&&this.autocompleteTags?(this.autocomplete.values=this.autocompleteTags(this.input,this.values),this.autocomplete.idx=-1):(this.autocomplete.values=[],this.autocomplete.idx=-1))},addVal(e){const t=e.replace(/,/g,"").trim();t&&(this.values.includes(t)||this.values.push(t),this.input="",this.autocomplete.values=[],this.autocomplete.idx=-1,this.$emit("update:modelValue",this.values),this.$refs.input.focus())},add(){const e=this.autocomplete.idx>=0?this.autocomplete.values[this.autocomplete.idx]:this.input;this.addVal(e)},rm(e){this.values=this.values.filter((t=>t!==e)),this.$emit("update:modelValue",this.values)}}});const Z=m();y("data-v-39ed99c7");const K={key:0,class:"autocomplete"};f();const J=Z(((e,o,a,s,u,m)=>(i(),t("div",null,[g(n("input",{ref:"input",class:"input",type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.input=t),placeholder:"Plants, People",onChange:o[2]||(o[2]=(...t)=>e.onChange&&e.onChange(...t)),onKeydown:o[3]||(o[3]=h(((...t)=>e.add&&e.add(...t)),["enter"])),onKeyup:o[4]||(o[4]=(...t)=>e.onKeyUp&&e.onKeyUp(...t))},null,544),[[p,e.input]]),e.autocomplete.values?(i(),t("div",K,[n("ul",null,[(i(!0),t(d,null,c(e.autocomplete.values,((n,o)=>(i(),t("li",{key:o,class:{active:o===e.autocomplete.idx},onClick:t=>e.addVal(n)},r(n),11,["onClick"])))),128))])])):l("",!0),(i(!0),t(d,null,c(e.values,((n,o)=>(i(),t("span",{key:o,class:"bit",onClick:t=>e.rm(n)},r(n)+" βœ–",9,["onClick"])))),128))]))));Q.render=J,Q.__scopeId="data-v-39ed99c7";var X=e({name:"new-image-dialog",components:{ResponsiveImage:Y,TagsInput:Q},props:{autocompleteTags:{type:Function}},emits:{bgclick:null,setupGameClick:null,postToGalleryClick:null},data:()=>({previewUrl:"",file:null,title:"",tags:[]}),computed:{canPostToGallery(){return!(!this.previewUrl||!this.file)},canSetupGameClick(){return!(!this.previewUrl||!this.file)}},methods:{preview(e){const t=e.target;if(!t.files)return;const n=t.files[0];if(!n)return;const o=new FileReader;o.readAsDataURL(n),o.onload=e=>{this.previewUrl=e.target.result,this.file=n}},postToGallery(){this.$emit("postToGalleryClick",{file:this.file,title:this.title,tags:this.tags})},setupGameClick(){this.$emit("setupGameClick",{file:this.file,title:this.title,tags:this.tags})}}});const ee={key:0,class:"has-image"},te={key:1},ne={class:"upload"},oe=n("span",{class:"btn"},"Upload File",-1),le={class:"area-settings"},ae=n("td",null,[n("label",null,"Title")],-1),ie=n("tr",null,[n("td",{colspan:"2"},[n("div",{class:"hint"},"Feel free to leave a credit to the artist/photographer in the title :)")])],-1),se=n("td",null,[n("label",null,"Tags")],-1),re={class:"area-buttons"},de=s("🧩 Post to gallery "),ce=n("br",null,null,-1),ue=s(" + set up game");X.render=function(e,o,l,s,r,d){const c=a("responsive-image"),h=a("tags-input");return i(),t("div",{class:"overlay new-image-dialog",onClick:o[8]||(o[8]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[7]||(o[7]=u((()=>{}),["stop"]))},[n("div",{class:["area-image",{"has-image":!!e.previewUrl,"no-image":!e.previewUrl}]},[e.previewUrl?(i(),t("div",ee,[n("span",{class:"remove btn",onClick:o[1]||(o[1]=t=>e.previewUrl="")},"X"),n(c,{src:e.previewUrl},null,8,["src"])])):(i(),t("div",te,[n("label",ne,[n("input",{type:"file",style:{display:"none"},onChange:o[2]||(o[2]=(...t)=>e.preview&&e.preview(...t)),accept:"image/*"},null,32),oe])]))],2),n("div",le,[n("table",null,[n("tr",null,[ae,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[3]||(o[3]=t=>e.title=t),placeholder:"Flower by @artist"},null,512),[[p,e.title]])])]),ie,n("tr",null,[se,n("td",null,[n(h,{modelValue:e.tags,"onUpdate:modelValue":o[4]||(o[4]=t=>e.tags=t),autocompleteTags:e.autocompleteTags},null,8,["modelValue","autocompleteTags"])])])])]),n("div",re,[n("button",{class:"btn",disabled:!e.canPostToGallery,onClick:o[5]||(o[5]=(...t)=>e.postToGallery&&e.postToGallery(...t))},"πŸ–ΌοΈ Post to gallery",8,["disabled"]),n("button",{class:"btn",disabled:!e.canSetupGameClick,onClick:o[6]||(o[6]=(...t)=>e.setupGameClick&&e.setupGameClick(...t))},[de,ce,ue],8,["disabled"])])])])};var ge=e({name:"edit-image-dialog",components:{ResponsiveImage:Y,TagsInput:Q},props:{image:{type:Object,required:!0},autocompleteTags:{type:Function}},emits:{bgclick:null,saveClick:null},data:()=>({title:"",tags:[]}),created(){this.title=this.image.title,this.tags=this.image.tags.map((e=>e.title))},methods:{saveImage(){this.$emit("saveClick",{id:this.image.id,title:this.title,tags:this.tags})}}});const pe={class:"area-image"},he={class:"has-image"},me={class:"area-settings"},ye=n("td",null,[n("label",null,"Title")],-1),fe=n("tr",null,[n("td",{colspan:"2"},[n("div",{class:"hint"},"Feel free to leave a credit to the artist/photographer in the title :)")])],-1),we=n("td",null,[n("label",null,"Tags")],-1),ve={class:"area-buttons"};var be,xe,Ce,ke,Ae,Se;ge.render=function(e,o,l,s,r,d){const c=a("responsive-image"),h=a("tags-input");return i(),t("div",{class:"overlay edit-image-dialog",onClick:o[5]||(o[5]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[4]||(o[4]=u((()=>{}),["stop"]))},[n("div",pe,[n("div",he,[n(c,{src:e.image.url,title:e.image.title},null,8,["src","title"])])]),n("div",me,[n("table",null,[n("tr",null,[ye,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.title=t),placeholder:"Flower by @artist"},null,512),[[p,e.title]])])]),fe,n("tr",null,[we,n("td",null,[n(h,{modelValue:e.tags,"onUpdate:modelValue":o[2]||(o[2]=t=>e.tags=t),autocompleteTags:e.autocompleteTags},null,8,["modelValue","autocompleteTags"])])])])]),n("div",ve,[n("button",{class:"btn",onClick:o[3]||(o[3]=(...t)=>e.saveImage&&e.saveImage(...t))},"πŸ–ΌοΈ Save image")])])])},(xe=be||(be={}))[xe.Flat=0]="Flat",xe[xe.Out=1]="Out",xe[xe.In=-1]="In",(ke=Ce||(Ce={}))[ke.FINAL=0]="FINAL",ke[ke.ANY=1]="ANY",(Se=Ae||(Ae={}))[Se.NORMAL=0]="NORMAL",Se[Se.ANY=1]="ANY",Se[Se.FLAT=2]="FLAT";var Te=e({name:"new-game-dialog",components:{ResponsiveImage:Y},props:{image:{type:Object,required:!0}},emits:{newGame:null,bgclick:null},data:()=>({tiles:1e3,scoreMode:Ce.ANY,shapeMode:Ae.NORMAL}),methods:{onNewGameClick(){this.$emit("newGame",{tiles:this.tilesInt,image:this.image,scoreMode:this.scoreModeInt,shapeMode:this.shapeModeInt})}},computed:{canStartNewGame(){return!!(this.tilesInt&&this.image&&this.image.url&&[0,1].includes(this.scoreModeInt))},scoreModeInt(){return parseInt(`${this.scoreMode}`,10)},shapeModeInt(){return parseInt(`${this.shapeMode}`,10)},tilesInt(){return parseInt(`${this.tiles}`,10)}}});const ze={class:"area-image"},Pe={class:"has-image"},Ie={class:"area-settings"},_e=n("td",null,[n("label",null,"Pieces")],-1),Ee=n("td",null,[n("label",null,"Scoring: ")],-1),De=s(" Any (Score when pieces are connected to each other or on final location)"),Me=n("br",null,null,-1),Be=s(" Final (Score when pieces are put to their final location)"),Oe=n("td",null,[n("label",null,"Shapes: ")],-1),Ne=s(" Normal"),Ue=n("br",null,null,-1),Ge=s(" Any (flat pieces can occur anywhere)"),Ve=n("br",null,null,-1),$e=s(" Flat (all pieces flat on all sides)"),Re={class:"area-buttons"};Te.render=function(e,o,l,s,r,d){const c=a("responsive-image");return i(),t("div",{class:"overlay new-game-dialog",onClick:o[9]||(o[9]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[8]||(o[8]=u((()=>{}),["stop"]))},[n("div",ze,[n("div",Pe,[n(c,{src:e.image.url,title:e.image.title},null,8,["src","title"])])]),n("div",Ie,[n("table",null,[n("tr",null,[_e,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.tiles=t)},null,512),[[p,e.tiles]])])]),n("tr",null,[Ee,n("td",null,[n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[2]||(o[2]=t=>e.scoreMode=t),value:"1"},null,512),[[w,e.scoreMode]]),De]),Me,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[3]||(o[3]=t=>e.scoreMode=t),value:"0"},null,512),[[w,e.scoreMode]]),Be])])]),n("tr",null,[Oe,n("td",null,[n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[4]||(o[4]=t=>e.shapeMode=t),value:"0"},null,512),[[w,e.shapeMode]]),Ne]),Ue,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[5]||(o[5]=t=>e.shapeMode=t),value:"1"},null,512),[[w,e.shapeMode]]),Ge]),Ve,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[6]||(o[6]=t=>e.shapeMode=t),value:"2"},null,512),[[w,e.shapeMode]]),$e])])])])]),n("div",Re,[n("button",{class:"btn",disabled:!e.canStartNewGame,onClick:o[7]||(o[7]=(...t)=>e.onNewGameClick&&e.onNewGameClick(...t))}," 🧩 Generate Puzzle ",8,["disabled"])])])])};class Fe{constructor(e){this.rand_high=e||3735929054,this.rand_low=1231121986^e}random(e,t){this.rand_high=(this.rand_high<<16)+(this.rand_high>>16)+this.rand_low&4294967295,this.rand_low=this.rand_low+this.rand_high&4294967295;return e+(this.rand_high>>>0)/4294967295*(t-e+1)|0}choice(e){return e[this.random(0,e.length-1)]}shuffle(e){const t=e.slice();for(let n=0;n<=t.length-2;n++){const e=this.random(n,t.length-1),o=t[n];t[n]=t[e],t[e]=o}return t}static serialize(e){return{rand_high:e.rand_high,rand_low:e.rand_low}}static unserialize(e){const t=new Fe(0);return t.rand_high=e.rand_high,t.rand_low=e.rand_low,t}}const Le=(e,t)=>{const n=`${e}`;return n.length>=t.length?n:t.substr(0,t.length-n.length)+n},je=(...e)=>{const t=t=>(...n)=>{const o=new Date,l=Le(o.getHours(),"00"),a=Le(o.getMinutes(),"00"),i=Le(o.getSeconds(),"00");console[t](`${l}:${a}:${i}`,...e,...n)};return{log:t("log"),error:t("error"),info:t("info")}};var We={hash:e=>{let t=0;for(let n=0;n{let t=e.toLowerCase();return t=t.replace(/[^a-z0-9]+/g,"-"),t=t.replace(/^-|-$/,""),t},uniqId:()=>Date.now().toString(36)+Math.random().toString(36).substring(2),encodeShape:function(e){return e.top+1<<0|e.right+1<<2|e.bottom+1<<4|e.left+1<<6},decodeShape:function(e){return{top:(e>>0&3)-1,right:(e>>2&3)-1,bottom:(e>>4&3)-1,left:(e>>6&3)-1}},encodePiece:function(e){return[e.idx,e.pos.x,e.pos.y,e.z,e.owner,e.group]},decodePiece:function(e){return{idx:e[0],pos:{x:e[1],y:e[2]},z:e[3],owner:e[4],group:e[5]}},encodePlayer:function(e){return[e.id,e.x,e.y,e.d,e.name,e.color,e.bgcolor,e.points,e.ts]},decodePlayer:function(e){return{id:e[0],x:e[1],y:e[2],d:e[3],name:e[4],color:e[5],bgcolor:e[6],points:e[7],ts:e[8]}},encodeGame:function(e){return[e.id,e.rng.type||"",Fe.serialize(e.rng.obj),e.puzzle,e.players,e.evtInfos,e.scoreMode||Ce.FINAL]},decodeGame:function(e){return{id:e[0],rng:{type:e[1],obj:Fe.unserialize(e[2])},puzzle:e[3],players:e[4],evtInfos:e[5],scoreMode:e[6]}},coordByPieceIdx:function(e,t){const n=e.width/e.tileSize;return{x:t%n,y:Math.floor(t/n)}},asQueryArgs:function(e){const t=[];for(const n in e){const o=[n,e[n]].map(encodeURIComponent);t.push(o.join("="))}return 0===t.length?"":`?${t.join("&")}`}},qe=e({components:{ImageLibrary:H,NewImageDialog:X,EditImageDialog:ge,NewGameDialog:Te},data:()=>({filters:{sort:"date_desc",tags:[]},images:[],tags:[],image:{id:0,filename:"",file:"",url:"",title:"",tags:[],created:0},dialog:""}),async created(){await this.loadImages()},computed:{relevantTags(){return this.tags.filter((e=>e.total>0))}},methods:{autocompleteTags(e,t){return this.tags.filter((n=>!t.includes(n.title)&&n.title.toLowerCase().startsWith(e.toLowerCase()))).slice(0,10).map((e=>e.title))},toggleTag(e){this.filters.tags.includes(e.slug)?this.filters.tags=this.filters.tags.filter((t=>t!==e.slug)):this.filters.tags.push(e.slug),this.filtersChanged()},async loadImages(){const e=await fetch(`/api/newgame-data${We.asQueryArgs(this.filters)}`),t=await e.json();this.images=t.images,this.tags=t.tags},async filtersChanged(){await this.loadImages()},onImageClicked(e){this.image=e,this.dialog="new-game"},onImageEditClicked(e){this.image=e,this.dialog="edit-image"},async uploadImage(e){const t=new FormData;t.append("file",e.file,e.file.name),t.append("title",e.title),t.append("tags",e.tags);const n=await fetch("/api/upload",{method:"post",body:t});return await n.json()},async saveImage(e){const t=await fetch("/api/save-image",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({id:e.id,title:e.title,tags:e.tags})});return await t.json()},async onSaveImageClick(e){await this.saveImage(e),this.dialog="",await this.loadImages()},async postToGalleryClick(e){await this.uploadImage(e),this.dialog="",await this.loadImages()},async setupGameClick(e){const t=await this.uploadImage(e);this.loadImages(),this.image=t,this.dialog="new-game"},async onNewGame(e){const t=await fetch("/api/newgame",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(200===t.status){const e=await t.json();this.$router.push({name:"game",params:{id:e.id}})}}}});const He={class:"upload-image-teaser"},Ye=n("div",{class:"hint"},"(The image you upload will be added to the public gallery.)",-1),Qe={key:0},Ze=s(" Tags: "),Ke=s(" Sort by: "),Je=n("option",{value:"date_desc"},"Newest first",-1),Xe=n("option",{value:"date_asc"},"Oldest first",-1),et=n("option",{value:"alpha_asc"},"A-Z",-1),tt=n("option",{value:"alpha_desc"},"Z-A",-1);qe.render=function(e,o,s,u,p,h){const m=a("image-library"),y=a("new-image-dialog"),f=a("edit-image-dialog"),w=a("new-game-dialog");return i(),t("div",null,[n("div",He,[n("div",{class:"btn btn-big",onClick:o[1]||(o[1]=t=>e.dialog="new-image")},"Upload your image"),Ye]),n("div",null,[e.tags.length>0?(i(),t("label",Qe,[Ze,(i(!0),t(d,null,c(e.relevantTags,((n,o)=>(i(),t("span",{class:["bit",{on:e.filters.tags.includes(n.slug)}],key:o,onClick:t=>e.toggleTag(n)},r(n.title)+" ("+r(n.total)+")",11,["onClick"])))),128))])):l("",!0),n("label",null,[Ke,g(n("select",{"onUpdate:modelValue":o[2]||(o[2]=t=>e.filters.sort=t),onChange:o[3]||(o[3]=(...t)=>e.filtersChanged&&e.filtersChanged(...t))},[Je,Xe,et,tt],544),[[v,e.filters.sort]])])]),n(m,{images:e.images,onImageClicked:e.onImageClicked,onImageEditClicked:e.onImageEditClicked},null,8,["images","onImageClicked","onImageEditClicked"]),"new-image"===e.dialog?(i(),t(y,{key:0,autocompleteTags:e.autocompleteTags,onBgclick:o[4]||(o[4]=t=>e.dialog=""),onPostToGalleryClick:e.postToGalleryClick,onSetupGameClick:e.setupGameClick},null,8,["autocompleteTags","onPostToGalleryClick","onSetupGameClick"])):l("",!0),"edit-image"===e.dialog?(i(),t(f,{key:1,autocompleteTags:e.autocompleteTags,onBgclick:o[5]||(o[5]=t=>e.dialog=""),onSaveClick:e.onSaveImageClick,image:e.image},null,8,["autocompleteTags","onSaveClick","image"])):l("",!0),e.image&&"new-game"===e.dialog?(i(),t(w,{key:2,onBgclick:o[6]||(o[6]=t=>e.dialog=""),onNewGame:e.onNewGame,image:e.image},null,8,["onNewGame","image"])):l("",!0)])};var nt=e({name:"scores",props:{activePlayers:{type:Array,required:!0},idlePlayers:{type:Array,required:!0}},computed:{actives(){return this.activePlayers.sort(((e,t)=>t.points-e.points)),this.activePlayers},idles(){return this.idlePlayers.sort(((e,t)=>t.points-e.points)),this.idlePlayers}}});const ot={class:"scores"},lt=n("div",null,"Scores",-1),at=n("td",null,"⚑",-1),it=n("td",null,"πŸ’€",-1);nt.render=function(e,o,l,a,s,u){return i(),t("div",ot,[lt,n("table",null,[(i(!0),t(d,null,c(e.actives,((e,o)=>(i(),t("tr",{key:o,style:{color:e.color}},[at,n("td",null,r(e.name),1),n("td",null,r(e.points),1)],4)))),128)),(i(!0),t(d,null,c(e.idles,((e,o)=>(i(),t("tr",{key:o,style:{color:e.color}},[it,n("td",null,r(e.name),1),n("td",null,r(e.points),1)],4)))),128))])])};var st=e({name:"puzzle-status",props:{finished:{type:Boolean,required:!0},duration:{type:Number,required:!0},piecesDone:{type:Number,required:!0},piecesTotal:{type:Number,required:!0}},computed:{icon(){return this.finished?"🏁":"⏳"},durationStr(){return N(this.duration)}}});const rt={class:"timer"};st.render=function(e,o,l,a,s,d){return i(),t("div",rt,[n("div",null," 🧩 "+r(e.piecesDone)+"/"+r(e.piecesTotal),1),n("div",null,r(e.icon)+" "+r(e.durationStr),1),b(e.$slots,"default")])};var dt=e({name:"settings-overlay",emits:{bgclick:null,"update:modelValue":null},props:{modelValue:Object},created(){this.$watch("modelValue",(e=>{this.$emit("update:modelValue",e)}),{deep:!0})}});const ct=n("td",null,[n("label",null,"Background: ")],-1),ut=n("td",null,[n("label",null,"Color: ")],-1),gt=n("td",null,[n("label",null,"Name: ")],-1),pt=n("td",null,[n("label",null,"Sounds: ")],-1);dt.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay transparent",onClick:o[6]||(o[6]=t=>e.$emit("bgclick"))},[n("table",{class:"overlay-content settings",onClick:o[5]||(o[5]=u((()=>{}),["stop"]))},[n("tr",null,[ct,n("td",null,[g(n("input",{type:"color","onUpdate:modelValue":o[1]||(o[1]=t=>e.modelValue.background=t)},null,512),[[p,e.modelValue.background]])])]),n("tr",null,[ut,n("td",null,[g(n("input",{type:"color","onUpdate:modelValue":o[2]||(o[2]=t=>e.modelValue.color=t)},null,512),[[p,e.modelValue.color]])])]),n("tr",null,[gt,n("td",null,[g(n("input",{type:"text",maxLength:"16","onUpdate:modelValue":o[3]||(o[3]=t=>e.modelValue.name=t)},null,512),[[p,e.modelValue.name]])])]),n("tr",null,[pt,n("td",null,[g(n("input",{type:"checkbox","onUpdate:modelValue":o[4]||(o[4]=t=>e.modelValue.soundsEnabled=t)},null,512),[[x,e.modelValue.soundsEnabled]])])])])])};var ht=e({name:"preview-overlay",props:{img:String},emits:{bgclick:null},computed:{previewStyle(){return{backgroundImage:`url('${this.img}')`}}}});const mt={class:"preview"};ht.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay",onClick:o[1]||(o[1]=t=>e.$emit("bgclick"))},[n("div",mt,[n("div",{class:"img",style:e.previewStyle},null,4)])])};var yt=1,ft=4,wt=2,vt=3,bt=2,xt=4,Ct=3,kt=9,At=1,St=2,Tt=3,zt=4,Pt=5,It=6,_t=7,Et=8,Dt=10,Mt=11,Bt=1,Ot=2,Nt=3;const Ut=je("Communication.js");let Gt,Vt=[],$t=e=>{Vt.push(e)},Rt=[],Ft=e=>{Rt.push(e)};let Lt=0;const jt=e=>{Lt!==e&&(Lt=e,Ft(e))};function Wt(e){if(2===Lt)try{Gt.send(JSON.stringify(e))}catch(t){Ut.info("unable to send message.. maybe because ws is invalid?")}}let qt,Ht;var Yt={connect:function(e,t,n){return qt=0,Ht={},jt(3),new Promise((o=>{Gt=new WebSocket(e,n+"|"+t),Gt.onopen=()=>{jt(2),Wt([vt])},Gt.onmessage=e=>{const t=JSON.parse(e.data),l=t[0];if(l===ft){const e=t[1];o(e)}else{if(l!==yt)throw`[ 2021-05-09 invalid connect msgType ${l} ]`;{const e=t[1],o=t[2];if(e===n&&Ht[o])return void delete Ht[o];$t(t)}}},Gt.onerror=()=>{throw jt(1),"[ 2021-05-15 onerror ]"},Gt.onclose=e=>{4e3===e.code||1001===e.code?jt(4):jt(1)}}))},requestReplayData:async function(e,t,n){const o={gameId:e,offset:t,size:n},l=await fetch(`/api/replay-data${We.asQueryArgs(o)}`);return await l.json()},disconnect:function(){Gt&&Gt.close(4e3),qt=0,Ht={}},sendClientEvent:function(e){qt++,Ht[qt]=e,Wt([wt,qt,Ht[qt]])},onServerChange:function(e){$t=e;for(const t of Vt)$t(t);Vt=[]},onConnectionStateChange:function(e){Ft=e;for(const t of Rt)Ft(t);Rt=[]},CODE_CUSTOM_DISCONNECT:4e3,CONN_STATE_NOT_CONNECTED:0,CONN_STATE_DISCONNECTED:1,CONN_STATE_CLOSED:4,CONN_STATE_CONNECTED:2,CONN_STATE_CONNECTING:3},Qt=e({name:"connection-overlay",emits:{reconnect:null},props:{connectionState:Number},computed:{lostConnection(){return this.connectionState===Yt.CONN_STATE_DISCONNECTED},connecting(){return this.connectionState===Yt.CONN_STATE_CONNECTING},show(){return!(!this.lostConnection&&!this.connecting)}}});const Zt={key:0,class:"overlay connection-lost"},Kt={key:0,class:"overlay-content"},Jt=n("div",null,"⁉️ LOST CONNECTION ⁉️",-1),Xt={key:1,class:"overlay-content"},en=n("div",null,"Connecting...",-1);Qt.render=function(e,o,a,s,r,d){return e.show?(i(),t("div",Zt,[e.lostConnection?(i(),t("div",Kt,[Jt,n("span",{class:"btn",onClick:o[1]||(o[1]=t=>e.$emit("reconnect"))},"Reconnect")])):l("",!0),e.connecting?(i(),t("div",Xt,[en])):l("",!0)])):l("",!0)};var tn=e({name:"help-overlay",emits:{bgclick:null}});const nn=n("tr",null,[n("td",null,"⬆️ Move up:"),n("td",null,[n("div",null,[n("kbd",null,"W"),s("/"),n("kbd",null,"↑"),s("/πŸ–±οΈ")])])],-1),on=n("tr",null,[n("td",null,"⬇️ Move down:"),n("td",null,[n("div",null,[n("kbd",null,"S"),s("/"),n("kbd",null,"↓"),s("/πŸ–±οΈ")])])],-1),ln=n("tr",null,[n("td",null,"⬅️ Move left:"),n("td",null,[n("div",null,[n("kbd",null,"A"),s("/"),n("kbd",null,"←"),s("/πŸ–±οΈ")])])],-1),an=n("tr",null,[n("td",null,"➑️ Move right:"),n("td",null,[n("div",null,[n("kbd",null,"D"),s("/"),n("kbd",null,"β†’"),s("/πŸ–±οΈ")])])],-1),sn=n("tr",null,[n("td"),n("td",null,[n("div",null,[s("Move faster by holding "),n("kbd",null,"Shift")])])],-1),rn=n("tr",null,[n("td",null,"πŸ”+ Zoom in:"),n("td",null,[n("div",null,[n("kbd",null,"E"),s("/πŸ–±οΈ-Wheel")])])],-1),dn=n("tr",null,[n("td",null,"πŸ”- Zoom out:"),n("td",null,[n("div",null,[n("kbd",null,"Q"),s("/πŸ–±οΈ-Wheel")])])],-1),cn=n("tr",null,[n("td",null,"πŸ–ΌοΈ Toggle preview:"),n("td",null,[n("div",null,[n("kbd",null,"Space")])])],-1),un=n("tr",null,[n("td",null,"πŸ§©βœ”οΈ Toggle fixed pieces:"),n("td",null,[n("div",null,[n("kbd",null,"F")])])],-1),gn=n("tr",null,[n("td",null,"πŸ§©β“ Toggle loose pieces:"),n("td",null,[n("div",null,[n("kbd",null,"G")])])],-1),pn=n("tr",null,[n("td",null,"πŸ”‰ Toggle sounds:"),n("td",null,[n("div",null,[n("kbd",null,"M")])])],-1);tn.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay transparent",onClick:o[2]||(o[2]=t=>e.$emit("bgclick"))},[n("table",{class:"overlay-content help",onClick:o[1]||(o[1]=u((()=>{}),["stop"]))},[nn,on,ln,an,sn,rn,dn,cn,un,gn,pn])])};var hn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"/assets/click.550555f3.mp3"}),mn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAW0lEQVQ4je1RywrAIAxLxP//5exixRWlVgZelpOKeTQFfnDypgy3eLIkSLLL8mxGPoHsU2hPAgDHBLvRX6hZZw/fwT0BtlLSONqCbWAmEIqMZOCDDlaDR3N03gOyDCn+y4DWmAAAAABJRU5ErkJggg=="}),yn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAARElEQVQ4jWNgGAU0Af+hmBCbgYGBgYERhwHEAEYGBgYGJtIdiApYyLAZBVDsAqoagC1ACQJyY4ERg0GCISh6KA4DigEAou8LC+LnIJoAAAAASUVORK5CYII="}),fn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVQ4ja1TQQ7AIAgD///n7jCozA2Hbk00jbG1KIrcARszTugoBs49qioZj7r2kKACptkyAOCJsJuA+GzglwHjvMSSWFVaENWVASxh5eRLiq5fN/ASjI89VcP2K3hHpq1cEXNaMfnrL3TDZP2tDuoOA6MzCCXWr38AAAAASUVORK5CYII="}),wn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAU0lEQVQ4jWNgoAH4D8X42HDARKlt5BoAd82AuQAOGLGIYQQUPv0wF5CiCQUge4EsQ5C9QI4BjMguwBYeBAElscCIy1ZivMKIwSDBEBQ9FCckigEAU3QOD7TGvY4AAAAASUVORK5CYII="});function vn(){let e=0,t=0,n=1;const o=(o,l)=>{e+=o/n,t+=l/n},l=e=>{const t=n+.05*n*("in"===e?1:-1);return Math.min(Math.max(t,.1),6)},a=o=>({x:o.x/n-e,y:o.y/n-t}),i=o=>({x:(o.x+e)*n,y:(o.y+t)*n}),s=e=>({w:e.w*n,h:e.h*n}),r=e=>({w:e.w/n,h:e.h/n});return{getCurrentZoom:()=>n,move:o,canZoom:e=>n!=l(e),zoom:(e,t)=>((e,t)=>{if(n==e)return!1;const l=1-n/e;return o(-t.x*l,-t.y*l),n=e,!0})(l(e),t),worldToViewport:e=>{const{x:t,y:n}=i(e);return{x:Math.round(t),y:Math.round(n)}},worldToViewportRaw:i,worldDimToViewport:e=>{const{w:t,h:n}=s(e);return{w:Math.round(t),h:Math.round(n)}},worldDimToViewportRaw:s,viewportToWorld:e=>{const{x:t,y:n}=a(e);return{x:Math.round(t),y:Math.round(n)}},viewportToWorldRaw:a,viewportDimToWorld:e=>{const{w:t,h:n}=r(e);return{w:Math.round(t),h:Math.round(n)}},viewportDimToWorldRaw:r}}function bn(e=0,t=0){const n=document.createElement("canvas");return n.width=e,n.height=t,n}var xn={createCanvas:bn,loadImageToBitmap:async function(e){return new Promise((t=>{const n=new Image;n.onload=()=>{createImageBitmap(n).then(t)},n.src=e}))},resizeBitmap:async function(e,t,n){const o=bn(t,n);return o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t,n),await createImageBitmap(o)},colorizedCanvas:function(e,t,n){const o=bn(e.width,e.height),l=o.getContext("2d");return l.save(),l.drawImage(t,0,0),l.fillStyle=n,l.globalCompositeOperation="source-in",l.fillRect(0,0,t.width,t.height),l.restore(),l.save(),l.globalCompositeOperation="destination-over",l.drawImage(e,0,0),l.restore(),o}};const Cn=je("Debug.js");let kn=0,An=0;var Sn=e=>{kn=performance.now(),An=e},Tn=e=>{const t=performance.now(),n=t-kn;n>An&&Cn.log(e+": "+n),kn=t};function zn(e,t){const n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)}function Pn(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}var In={pointSub:function(e,t){return{x:e.x-t.x,y:e.y-t.y}},pointAdd:function(e,t){return{x:e.x+t.x,y:e.y+t.y}},pointDistance:zn,pointInBounds:function(e,t){return e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h},rectCenter:Pn,rectMoved:function(e,t,n){return{x:e.x+t,y:e.y+n,w:e.w,h:e.h}},rectCenterDistance:function(e,t){return zn(Pn(e),Pn(t))},rectsOverlap:function(e,t){return!(t.x>e.x+e.w||e.x>t.x+t.w||t.y>e.y+e.h||e.y>t.y+t.h)}};const _n=je("PuzzleGraphics.js");function En(e,t){const n=We.coordByPieceIdx(e,t);return{x:n.x*e.tileSize,y:n.y*e.tileSize,w:e.tileSize,h:e.tileSize}}var Dn={loadPuzzleBitmaps:async function(e){const t=await xn.loadImageToBitmap(e.info.imageUrl),n=await xn.resizeBitmap(t,e.info.width,e.info.height);return await async function(e,t,n){_n.log("start createPuzzleTileBitmaps");const o=n.tileSize,l=n.tileMarginWidth,a=n.tileDrawSize,i=o/100,s=[0,0,40,15,37,5,37,5,40,0,38,-5,38,-5,20,-20,50,-20,50,-20,80,-20,62,-5,62,-5,60,0,63,5,63,5,65,15,100,0],r=new Array(t.length),d={};function c(e){const t=`${e.top}${e.right}${e.left}${e.bottom}`;if(d[t])return d[t];const n=new Path2D,a={x:l,y:l},r=In.pointAdd(a,{x:o,y:0}),c=In.pointAdd(r,{x:0,y:o}),u=In.pointSub(c,{x:o,y:0});if(n.moveTo(a.x,a.y),0!==e.top)for(let o=0;oWe.decodePiece(Mn[e].puzzle.tiles[t]),Hn=(e,t)=>qn(e,t).group,Yn=(e,t)=>{const n=Mn[e].puzzle.info,o={x:(n.table.width-n.width)/2,y:(n.table.height-n.height)/2},l=function(e,t){const n=Mn[e].puzzle.info,o=We.coordByPieceIdx(n,t),l=o.x*n.tileSize,a=o.y*n.tileSize;return{x:l,y:a}}(e,t);return In.pointAdd(o,l)},Qn=(e,t)=>qn(e,t).pos,Zn=e=>{const t=go(e),n=po(e),o=Math.round(t/4),l=Math.round(n/4);return{x:0-o,y:0-l,w:t+2*o,h:n+2*l}},Kn=(e,t)=>{const n=to(e),o=qn(e,t);return{x:o.pos.x,y:o.pos.y,w:n,h:n}},Jn=(e,t)=>qn(e,t).z,Xn=(e,t)=>{for(const n of Mn[e].puzzle.tiles){const e=We.decodePiece(n);if(e.owner===t)return e.idx}return-1},eo=e=>Mn[e].puzzle.info.tileDrawSize,to=e=>Mn[e].puzzle.info.tileSize,no=e=>Mn[e].puzzle.data.maxGroup,oo=e=>Mn[e].puzzle.data.maxZ;function lo(e,t){const n=Mn[e].puzzle.info,o=We.coordByPieceIdx(n,t);return[o.y>0?t-n.tilesX:-1,o.x0?t-1:-1]}const ao=(e,t,n)=>{for(const o of t)Wn(e,o,{z:n})},io=(e,t,n)=>{const o=Qn(e,t);Wn(e,t,{pos:In.pointAdd(o,n)})},so=(e,t,n)=>{const o=eo(e),l=Zn(e),a=n;for(const i of t){const t=qn(e,i);t.pos.x+n.xl.x+l.w&&(a.x=Math.min(l.x+l.w-t.pos.x+o,a.x)),t.pos.y+n.yl.y+l.h&&(a.y=Math.min(l.y+l.h-t.pos.y+o,a.y))}for(const i of t)io(e,i,a)},ro=(e,t,n)=>{for(const o of t)Wn(e,o,{owner:n})};function co(e,t){const n=Mn[e].puzzle.tiles,o=We.decodePiece(n[t]),l=[];if(o.group)for(const a of n){const e=We.decodePiece(a);e.group===o.group&&l.push(e.idx)}else l.push(o.idx);return l}const uo=(e,t)=>{const n=On(e,t);return n?n.points:0},go=e=>Mn[e].puzzle.info.table.width,po=e=>Mn[e].puzzle.info.table.height;var ho={setGame:function(e,t){Mn[e]=t},exists:function(e){return!!Mn[e]||!1},playerExists:Un,getActivePlayers:function(e,t){const n=t-30*M;return Gn(e).filter((e=>e.ts>=n))},getIdlePlayers:function(e,t){const n=t-30*M;return Gn(e).filter((e=>e.ts0))},addPlayer:function(e,t,n){Un(e,t)?Ln(e,t,{ts:n}):Nn(e,t,function(e,t){return{id:e,x:0,y:0,d:0,name:null,color:null,bgcolor:null,points:0,ts:t}}(t,n))},getFinishedPiecesCount:Fn,getPieceCount:Vn,getImageUrl:function(e){return Mn[e].puzzle.info.imageUrl},setImageUrl:function(e,t){Mn[e].puzzle.info.imageUrl=t},get:function(e){return Mn[e]||null},getAllGames:function(){return Object.values(Mn).sort(((e,t)=>Rn(e.id)===Rn(t.id)?t.puzzle.data.started-e.puzzle.data.started:Rn(e.id)?1:-1))},getPlayerBgColor:(e,t)=>{const n=On(e,t);return n?n.bgcolor:null},getPlayerColor:(e,t)=>{const n=On(e,t);return n?n.color:null},getPlayerName:(e,t)=>{const n=On(e,t);return n?n.name:null},getPlayerIndexById:Bn,getPlayerIdByIndex:function(e,t){return Mn[e].players.length>t?We.decodePlayer(Mn[e].players[t]).id:null},changePlayer:Ln,setPlayer:Nn,setPiece:function(e,t,n){Mn[e].puzzle.tiles[t]=We.encodePiece(n)},setPuzzleData:function(e,t){Mn[e].puzzle.data=t},getTableWidth:go,getTableHeight:po,getPuzzle:e=>Mn[e].puzzle,getRng:e=>Mn[e].rng.obj,getPuzzleWidth:e=>Mn[e].puzzle.info.width,getPuzzleHeight:e=>Mn[e].puzzle.info.height,getPiecesSortedByZIndex:function(e){return Mn[e].puzzle.tiles.map(We.decodePiece).sort(((e,t)=>e.z-t.z))},getFirstOwnedPiece:(e,t)=>{const n=Xn(e,t);return n<0?null:Mn[e].puzzle.tiles[n]},getPieceDrawOffset:e=>Mn[e].puzzle.info.tileDrawOffset,getPieceDrawSize:eo,getFinalPiecePos:Yn,getStartTs:e=>Mn[e].puzzle.data.started,getFinishTs:e=>Mn[e].puzzle.data.finished,handleInput:function(e,t,n,o,l){const a=Mn[e].puzzle,i=function(e,t){return t in Mn[e].evtInfos?Mn[e].evtInfos[t]:{_last_mouse:null,_last_mouse_down:null}}(e,t),s=[],r=()=>{s.push([Bt,a.data])},d=t=>{s.push([Ot,We.encodePiece(qn(e,t))])},c=e=>{for(const t of e)d(t)},u=()=>{const n=On(e,t);n&&s.push([Nt,We.encodePlayer(n)])},g=n[0];if(g===It){const l=n[1];Ln(e,t,{bgcolor:l,ts:o}),u()}else if(g===_t){const l=n[1];Ln(e,t,{color:l,ts:o}),u()}else if(g===Et){const l=`${n[1]}`.substr(0,16);Ln(e,t,{name:l,ts:o}),u()}else if(g===kt){const l=n[1],a=n[2],i=On(e,t);if(i){const n=i.x-l,s=i.y-a;Ln(e,t,{ts:o,x:n,y:s}),u()}}else if(g===At){const l={x:n[1],y:n[2]};Ln(e,t,{d:1,ts:o}),u(),i._last_mouse_down=l;const a=((e,t)=>{const n=Mn[e].puzzle.info,o=Mn[e].puzzle.tiles;let l=-1,a=-1;for(let i=0;il)&&(l=e.z,a=i)}return a})(e,l);if(a>=0){const n=oo(e)+1;jn(e,{maxZ:n}),r();const o=co(e,a);ao(e,o,oo(e)),ro(e,o,t),c(o)}i._last_mouse=l}else if(g===Tt){const l=n[1],a=n[2],s={x:l,y:a};if(null===i._last_mouse_down)Ln(e,t,{x:l,y:a,ts:o}),u();else{const n=Xn(e,t);if(n>=0){Ln(e,t,{x:l,y:a,ts:o}),u();const r=co(e,n);let d=In.pointInBounds(s,Zn(e))&&In.pointInBounds(i._last_mouse_down,Zn(e));for(const t of r){const n=Kn(e,t);if(In.pointInBounds(s,n)){d=!0;break}}if(d){const t=l-i._last_mouse_down.x,n=a-i._last_mouse_down.y;so(e,r,{x:t,y:n}),c(r)}}else Ln(e,t,{ts:o}),u();i._last_mouse_down=s}i._last_mouse=s}else if(g===St){const s={x:n[1],y:n[2]},g=0;i._last_mouse_down=null;const p=Xn(e,t);if(p>=0){const n=co(e,p);ro(e,n,0),c(n);const i=Qn(e,p),s=Yn(e,p);if(In.pointDistance(s,i){for(const n of t)Wn(e,n,{owner:-1,z:1})})(e,n),c(n);let d=uo(e,t);$n(e)===Ce.FINAL?d+=n.length:$n(e)===Ce.ANY&&(d+=1),Ln(e,t,{d:g,ts:o,points:d}),u(),Fn(e)===Vn(e)&&(jn(e,{finished:o}),r()),l&&l(t)}else{const n=(e,t,n,o)=>{const l=Mn[e].puzzle.info;if(n<0)return!1;if(((e,t,n)=>{const o=Hn(e,t),l=Hn(e,n);return!(!o||o!==l)})(e,t,n))return!1;const a=Qn(e,t),i=In.pointAdd(Qn(e,n),{x:o[0]*l.tileSize,y:o[1]*l.tileSize});if(In.pointDistance(a,i){const o=Mn[e].puzzle.tiles,l=Hn(e,t),a=Hn(e,n);let i;const s=[];l&&s.push(l),a&&s.push(a),l?i=l:a?i=a:(jn(e,{maxGroup:no(e)+1}),r(),i=no(e));if(Wn(e,t,{group:i}),d(t),Wn(e,n,{group:i}),d(n),s.length>0)for(const r of o){const t=We.decodePiece(r);s.includes(t.group)&&(Wn(e,t.idx,{group:i}),d(t.idx))}})(e,t,n),l=co(e,t);const s=((e,t)=>{let n=0;for(const o of t){const t=Jn(e,o);t>n&&(n=t)}return n})(e,l);return ao(e,l,s),c(l),!0}return!1};let a=!1;for(const t of co(e,p)){const o=lo(e,t);if(n(e,t,o[0],[0,1])||n(e,t,o[1],[-1,0])||n(e,t,o[2],[0,-1])||n(e,t,o[3],[1,0])){a=!0;break}}if(a&&$n(e)===Ce.ANY){const n=uo(e,t)+1;Ln(e,t,{d:g,ts:o,points:n}),u()}else Ln(e,t,{d:g,ts:o}),u();a&&l&&l(t)}}else Ln(e,t,{d:g,ts:o}),u();i._last_mouse=s}else if(g===zt){const l=n[1],a=n[2];Ln(e,t,{x:l,y:a,ts:o}),u(),i._last_mouse={x:l,y:a}}else if(g===Pt){const l=n[1],a=n[2];Ln(e,t,{x:l,y:a,ts:o}),u(),i._last_mouse={x:l,y:a}}else Ln(e,t,{ts:o}),u();return function(e,t,n){Mn[e].evtInfos[t]=n}(e,t,i),s}};let mo=-10,yo=20,fo=2,wo=15;class vo{constructor(e){this.radius=10,this.previousRadius=10,this.explodingDuration=100,this.hasExploded=!1,this.alive=!0,this.color=function(e){return"rgba("+e.random(0,255)+","+e.random(0,255)+","+e.random(0,255)+", 0.8)"}(e),this.px=window.innerWidth/4+Math.random()*window.innerWidth/2,this.py=window.innerHeight,this.vx=mo+Math.random()*yo,this.vy=-1*(fo+Math.random()*wo),this.duration=0}update(e){if(this.hasExploded){const e=200-this.radius;this.previousRadius=this.radius,this.radius+=e/10,this.explodingDuration--,0==this.explodingDuration&&(this.alive=!1)}else this.vx+=0,this.vy+=1,this.vy>=0&&e&&this.explode(e),this.px+=this.vx,this.py+=this.vy}draw(e){e.beginPath(),e.arc(this.px,this.py,this.previousRadius,0,2*Math.PI,!1),this.hasExploded||(e.fillStyle=this.color,e.lineWidth=1,e.fill())}explode(e){this.hasExploded=!0;const t=3+Math.floor(3*Math.random());for(let n=0;n{this.resize()}))}setSpeedParams(){let e=0,t=0;for(;e=0;)t+=1,e+=t;fo=t/2,wo=t-fo;const n=1/4*this.canvas.width/(t/2);mo=-n,yo=2*n}resize(){this.setSpeedParams()}init(){this.readyBombs=[],this.explodedBombs=[],this.particles=[];for(let e=0;e<1;e++)this.readyBombs.push(new vo(this.rng))}update(){100*Math.random()<5&&this.readyBombs.push(new vo(this.rng));const e=[];for(;this.explodedBombs.length>0;){const t=this.explodedBombs.shift();if(!t)break;t.update(),t.alive&&e.push(t)}this.explodedBombs=e;const t=[];for(;this.readyBombs.length>0;){const e=this.readyBombs.shift();if(!e)break;e.update(this.particles),e.hasExploded?this.explodedBombs.push(e):t.push(e)}this.readyBombs=t;const n=[];for(;this.particles.length>0;){const e=this.particles.shift();if(!e)break;e.update(),e.alive&&n.push(e)}this.particles=n}render(){this.ctx.beginPath(),this.ctx.fillStyle="rgba(0, 0, 0, 0.1)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);for(let e=0;e{const t=e.color+" "+e.d;if(!y[t]){const n=e.d?r:d;if(e.color){const o=e.d?c:u;y[t]=await createImageBitmap(xn.colorizedCanvas(n,o,e.color))}else y[t]=n}return y[t]},w=function(e,t){return t.width=window.innerWidth,t.height=window.innerHeight,e.appendChild(t),window.addEventListener("resize",(()=>{t.width=window.innerWidth,t.height=window.innerHeight,To=!0})),t}(l,xn.createCanvas()),v={final:!1,requesting:!0,log:[],logPointer:0,speeds:[.5,1,2,5,10,20,50,100,250,500],speedIdx:1,paused:!1,lastRealTs:0,lastGameTs:0,gameStartTs:0,dataOffset:0,dataSize:1e4};Yt.onConnectionStateChange((e=>{a.setConnectionState(e)}));const b=async e=>{v.requesting=!0;const t=await Yt.requestReplayData(e,v.dataOffset,v.dataSize);return v.dataOffset+=v.dataSize,v.requesting=!1,t};let x=()=>0;const C=async()=>{if("play"===o){const o=await Yt.connect(n,e,t),l=We.decodeGame(o);ho.setGame(l.id,l),x=()=>B()}else{if("replay"!==o)throw"[ 2020-12-22 MODE invalid, must be play|replay ]";{const t=await b(e);if(!t.game)throw"[ 2021-05-29 no game received ]";const n=We.decodeGame(t.game);ho.setGame(n.id,n),v.requesting=!1,v.log=t.log,v.lastRealTs=B(),v.gameStartTs=parseInt(v.log[0][4],10),v.lastGameTs=v.gameStartTs,x=()=>v.lastGameTs}}To=!0};await C();const k=ho.getPieceDrawOffset(e),A=ho.getPieceDrawSize(e),S=ho.getPuzzleWidth(e),T=ho.getPuzzleHeight(e),z=ho.getTableWidth(e),P=ho.getTableHeight(e),I={x:(z-S)/2,y:(P-T)/2},_={w:S,h:T},E={w:A,h:A},D=await Dn.loadPuzzleBitmaps(ho.getPuzzle(e)),M=new xo(w,ho.getRng(e));M.init();const O=w.getContext("2d");w.classList.add("loaded");const N=vn();N.move(-(z-w.width)/2,-(P-w.height)/2);const U=function(e,t,n){let o=[],l=!0,a=!1,i=!1,s=!1,r=!1,d=!1,c=!1,u=!1;const g=(e,t)=>{const o=n.viewportToWorld({x:e,y:t});return[o.x,o.y]},p=e=>g(e.offsetX,e.offsetY),h=()=>g(e.width/2,e.height/2),m=(e,t)=>{l&&("Shift"===t.key?u=e:"ArrowUp"===t.key||"w"===t.key||"W"===t.key?s=e:"ArrowDown"===t.key||"s"===t.key||"S"===t.key?r=e:"ArrowLeft"===t.key||"a"===t.key||"A"===t.key?a=e:"ArrowRight"===t.key||"d"===t.key||"D"===t.key?i=e:"q"===t.key?c=e:"e"===t.key&&(d=e))};let y=null;e.addEventListener("mousedown",(e=>{y=p(e),0===e.button&&f([At,...y])})),e.addEventListener("mouseup",(e=>{y=p(e),0===e.button&&f([St,...y])})),e.addEventListener("mousemove",(e=>{y=p(e),f([Tt,...y])})),e.addEventListener("wheel",(e=>{if(y=p(e),n.canZoom(e.deltaY<0?"in":"out")){const t=e.deltaY<0?zt:Pt;f([t,...y])}})),t.addEventListener("keydown",(e=>m(!0,e))),t.addEventListener("keyup",(e=>m(!1,e))),t.addEventListener("keypress",(e=>{l&&(" "===e.key&&f([Dt]),"F"!==e.key&&"f"!==e.key||(Ao=!Ao,To=!0),"G"!==e.key&&"g"!==e.key||(So=!So,To=!0),"M"!==e.key&&"m"!==e.key||f([Mt]))}));const f=e=>{o.push(e)};return{addEvent:f,consumeAll:()=>{if(0===o.length)return[];const e=o.slice();return o=[],e},createKeyEvents:()=>{const e=(a?1:0)-(i?1:0),t=(s?1:0)-(r?1:0);if(0!==e||0!==t){const o=(u?24:12)*Math.sqrt(n.getCurrentZoom()),l=n.viewportDimToWorld({w:e*o,h:t*o});f([kt,l.w,l.h]),y&&(y[0]-=l.w,y[1]-=l.h)}if(d&&c);else if(d){if(n.canZoom("in")){const e=y||h();f([zt,...e])}}else if(c&&n.canZoom("out")){const e=y||h();f([Pt,...e])}},setHotkeys:e=>{l=e}}}(w,window,N),G=ho.getImageUrl(e),V=()=>{const t=ho.getStartTs(e),n=ho.getFinishTs(e),o=x();a.setFinished(!!n),a.setDuration((n||o)-t)};V(),a.setPiecesDone(ho.getFinishedPiecesCount(e)),a.setPiecesTotal(ho.getPieceCount(e));const $=x();a.setActivePlayers(ho.getActivePlayers(e,$)),a.setIdlePlayers(ho.getIdlePlayers(e,$));const R=!!ho.getFinishTs(e);let F=R;const L=()=>F&&!R,j=()=>{const e=localStorage.getItem("sound_enabled");return null!==e&&"1"===e},W=()=>ho.getPlayerBgColor(e,t)||localStorage.getItem("bg_color")||"#222222",q=()=>ho.getPlayerColor(e,t)||localStorage.getItem("player_color")||"#ffffff";let H="",Y="",Q=!1;const Z=e=>{Q=e;const[t,n]=e?[H,"grab"]:[Y,"default"];w.style.cursor=`url('${t}') ${p} ${m}, ${n}`},K=e=>{H=xn.colorizedCanvas(r,c,e).toDataURL(),Y=xn.colorizedCanvas(d,u,e).toDataURL(),Z(Q)};K(q());const J=()=>{a.setReplaySpeed&&a.setReplaySpeed(v.speeds[v.speedIdx]),a.setReplayPaused&&a.setReplayPaused(v.paused)};if("play"===o?setInterval(V,1e3):"replay"===o&&J(),"play"===o)Yt.onServerChange((n=>{n[0],n[1],n[2];const o=n[3];for(const[l,a]of o)switch(l){case Nt:{const n=We.decodePlayer(a);n.id!==t&&(ho.setPlayer(e,n.id,n),To=!0)}break;case Ot:{const t=We.decodePiece(a);ho.setPiece(e,t.idx,t),To=!0}break;case Bt:ho.setPuzzleData(e,a),To=!0}F=!!ho.getFinishTs(e)}));else if("replay"===o){const t=setInterval((()=>{const n=B();if(v.requesting)return void(v.lastRealTs=n);if(v.logPointer+1>=v.log.length)return v.lastRealTs=n,void(async e=>{const t=await b(e);v.log=v.log.slice(v.logPointer),v.logPointer=0,v.log.push(...t.log),t.log.length=v.log.length){v.final&&clearInterval(t);break}const o=v.log[n],a=v.gameStartTs+o[o.length-1];if(a>l)break;const i=o.slice();if(i[0]===bt){const t=i[1];ho.addPlayer(e,t,a),To=!0}else if(i[0]===xt){const t=ho.getPlayerIdByIndex(e,i[1]);if(!t)throw"[ 2021-05-17 player not found (update player) ]";ho.addPlayer(e,t,a),To=!0}else if(i[0]===Ct){const t=ho.getPlayerIdByIndex(e,i[1]);if(!t)throw"[ 2021-05-17 player not found (handle input) ]";const n=i[2];ho.handleInput(e,t,n,a),To=!0}v.logPointer=n}v.lastRealTs=n,v.lastGameTs=l,V()}),50)}let X=null;return(e=>{const t=e.fps||60,n=e.slow||1,o=e.update,l=e.render,a=window.requestAnimationFrame,i=1/t,s=n*i;let r,d=0,c=window.performance.now();const u=()=>{for(r=window.performance.now(),d+=Math.min(1,(r-c)/1e3);d>s;)d-=s,o(i);l(d/n),c=r,a(u)};a(u)})({update:()=>{U.createKeyEvents();for(const n of U.consumeAll())if("play"===o){const o=n[0];if(o===kt){const e=n[1],t=n[2],o=N.worldDimToViewport({w:e,h:t});To=!0,N.move(o.w,o.h)}else if(o===Tt){if(X&&!ho.getFirstOwnedPiece(e,t)){const e={x:n[1],y:n[2]},t=N.worldToViewport(e),o=Math.round(t.x-X.x),l=Math.round(t.y-X.y);To=!0,N.move(o,l),X=t}}else if(o===_t)K(n[1]);else if(o===At){const e={x:n[1],y:n[2]};X=N.worldToViewport(e),Z(!0)}else if(o===St)X=null,Z(!1);else if(o===zt){const e={x:n[1],y:n[2]};To=!0,N.zoom("in",N.worldToViewport(e))}else if(o===Pt){const e={x:n[1],y:n[2]};To=!0,N.zoom("out",N.worldToViewport(e))}else o===Dt?a.togglePreview():o===Mt&&a.toggleSoundsEnabled();const l=x();ho.handleInput(e,t,n,l,(e=>{j()&&s.play()})).length>0&&(To=!0),Yt.sendClientEvent(n)}else if("replay"===o){const e=n[0];if(e===kt){const e=n[1],t=n[2];To=!0,N.move(e,t)}else if(e===Tt){if(X){const e={x:n[1],y:n[2]},t=N.worldToViewport(e),o=Math.round(t.x-X.x),l=Math.round(t.y-X.y);To=!0,N.move(o,l),X=t}}else if(e===At){const e={x:n[1],y:n[2]};X=N.worldToViewport(e)}else if(e===St)X=null;else if(e===zt){const e={x:n[1],y:n[2]};To=!0,N.zoom("in",N.worldToViewport(e))}else if(e===Pt){const e={x:n[1],y:n[2]};To=!0,N.zoom("out",N.worldToViewport(e))}else e===Dt&&a.togglePreview()}F=!!ho.getFinishTs(e),L()&&(M.update(),To=!0)},render:async()=>{if(!To)return;const n=x();let l,i,s;window.DEBUG&&Sn(0),O.fillStyle=W(),O.fillRect(0,0,w.width,w.height),window.DEBUG&&Tn("clear done"),l=N.worldToViewportRaw(I),i=N.worldDimToViewportRaw(_),O.fillStyle="rgba(255, 255, 255, .3)",O.fillRect(l.x,l.y,i.w,i.h),window.DEBUG&&Tn("board done");const r=ho.getPiecesSortedByZIndex(e);window.DEBUG&&Tn("get tiles done"),i=N.worldDimToViewportRaw(E);for(const e of r)(-1===e.owner?Ao:So)&&(s=D[e.idx],l=N.worldToViewportRaw({x:k+e.pos.x,y:k+e.pos.y}),O.drawImage(s,0,0,s.width,s.height,l.x,l.y,i.w,i.h));window.DEBUG&&Tn("tiles done");const d=[];for(const a of ho.getActivePlayers(e,n))c=a,("replay"===o||c.id!==t)&&(s=await f(a),l=N.worldToViewport(a),O.drawImage(s,l.x-p,l.y-m),d.push([`${a.name} (${a.points})`,l.x,l.y+h]));var c;O.fillStyle="white",O.textAlign="center";for(const[e,t,o]of d)O.fillText(e,t,o);window.DEBUG&&Tn("players done"),a.setActivePlayers(ho.getActivePlayers(e,n)),a.setIdlePlayers(ho.getIdlePlayers(e,n)),a.setPiecesDone(ho.getFinishedPiecesCount(e)),window.DEBUG&&Tn("HUD done"),L()&&M.render(),To=!1}}),{setHotkeys:e=>{U.setHotkeys(e)},onBgChange:e=>{localStorage.setItem("bg_color",e),U.addEvent([It,e])},onColorChange:e=>{localStorage.setItem("player_color",e),U.addEvent([_t,e])},onNameChange:e=>{localStorage.setItem("player_name",e),U.addEvent([Et,e])},onSoundsEnabledChange:e=>{localStorage.setItem("sound_enabled",e?"1":"0")},replayOnSpeedUp:()=>{v.speedIdx+1{v.speedIdx>=1&&(v.speedIdx--,J())},replayOnPauseToggle:()=>{v.paused=!v.paused,J()},previewImageUrl:G,player:{background:W(),color:q(),name:ho.getPlayerName(e,t)||localStorage.getItem("player_name")||"anon",soundsEnabled:j()},disconnect:Yt.disconnect,connect:C}}var Po=e({name:"game",components:{PuzzleStatus:st,Scores:nt,SettingsOverlay:dt,PreviewOverlay:ht,ConnectionOverlay:Qt,HelpOverlay:tn},data:()=>({activePlayers:[],idlePlayers:[],finished:!1,duration:0,piecesDone:0,piecesTotal:0,overlay:"",connectionState:0,g:{player:{background:"",color:"",name:"",soundsEnabled:!1},previewImageUrl:"",setHotkeys:e=>{},onBgChange:e=>{},onColorChange:e=>{},onNameChange:e=>{},onSoundsEnabledChange:e=>{},disconnect:()=>{},connect:()=>{}}}),async mounted(){this.$route.params.id&&(this.$watch((()=>this.g.player.background),(e=>{this.g.onBgChange(e)})),this.$watch((()=>this.g.player.color),(e=>{this.g.onColorChange(e)})),this.$watch((()=>this.g.player.name),(e=>{this.g.onNameChange(e)})),this.$watch((()=>this.g.player.soundsEnabled),(e=>{this.g.onSoundsEnabledChange(e)})),this.g=await zo(`${this.$route.params.id}`,this.$clientId,this.$config.WS_ADDRESS,"play",this.$el,{setActivePlayers:e=>{this.activePlayers=e},setIdlePlayers:e=>{this.idlePlayers=e},setFinished:e=>{this.finished=e},setDuration:e=>{this.duration=e},setPiecesDone:e=>{this.piecesDone=e},setPiecesTotal:e=>{this.piecesTotal=e},setConnectionState:e=>{this.connectionState=e},togglePreview:()=>{this.toggle("preview",!1)},toggleSoundsEnabled:()=>{this.g.player.soundsEnabled=!this.g.player.soundsEnabled}}))},unmounted(){this.g.disconnect()},methods:{reconnect(){this.g.connect()},toggle(e,t){""===this.overlay?(this.overlay=e,t&&this.g.setHotkeys(!1)):(this.overlay="",t&&this.g.setHotkeys(!0))}}});const Io={id:"game"},_o={class:"menu"},Eo={class:"tabs"},Do=s("🧩 Puzzles");Po.render=function(e,l,s,r,d,c){const u=a("settings-overlay"),p=a("preview-overlay"),h=a("help-overlay"),m=a("connection-overlay"),y=a("puzzle-status"),f=a("router-link"),w=a("scores");return i(),t("div",Io,[g(n(u,{onBgclick:l[1]||(l[1]=t=>e.toggle("settings",!0)),modelValue:e.g.player,"onUpdate:modelValue":l[2]||(l[2]=t=>e.g.player=t)},null,8,["modelValue"]),[[C,"settings"===e.overlay]]),g(n(p,{onBgclick:l[3]||(l[3]=t=>e.toggle("preview",!1)),img:e.g.previewImageUrl},null,8,["img"]),[[C,"preview"===e.overlay]]),g(n(h,{onBgclick:l[4]||(l[4]=t=>e.toggle("help",!0))},null,512),[[C,"help"===e.overlay]]),n(m,{connectionState:e.connectionState,onReconnect:e.reconnect},null,8,["connectionState","onReconnect"]),n(y,{finished:e.finished,duration:e.duration,piecesDone:e.piecesDone,piecesTotal:e.piecesTotal},null,8,["finished","duration","piecesDone","piecesTotal"]),n("div",_o,[n("div",Eo,[n(f,{class:"opener",to:{name:"index"},target:"_blank"},{default:o((()=>[Do])),_:1}),n("div",{class:"opener",onClick:l[5]||(l[5]=t=>e.toggle("preview",!1))},"πŸ–ΌοΈ Preview"),n("div",{class:"opener",onClick:l[6]||(l[6]=t=>e.toggle("settings",!0))},"πŸ› οΈ Settings"),n("div",{class:"opener",onClick:l[7]||(l[7]=t=>e.toggle("help",!0))},"ℹ️ Help")])]),n(w,{activePlayers:e.activePlayers,idlePlayers:e.idlePlayers},null,8,["activePlayers","idlePlayers"])])};var Mo=e({name:"replay",components:{PuzzleStatus:st,Scores:nt,SettingsOverlay:dt,PreviewOverlay:ht,HelpOverlay:tn},data:()=>({activePlayers:[],idlePlayers:[],finished:!1,duration:0,piecesDone:0,piecesTotal:0,overlay:"",connectionState:0,g:{player:{background:"",color:"",name:"",soundsEnabled:!1},previewImageUrl:"",setHotkeys:e=>{},onBgChange:e=>{},onColorChange:e=>{},onNameChange:e=>{},onSoundsEnabledChange:e=>{},replayOnSpeedUp:()=>{},replayOnSpeedDown:()=>{},replayOnPauseToggle:()=>{},disconnect:()=>{}},replay:{speed:1,paused:!1}}),async mounted(){this.$route.params.id&&(this.$watch((()=>this.g.player.background),(e=>{this.g.onBgChange(e)})),this.$watch((()=>this.g.player.color),(e=>{this.g.onColorChange(e)})),this.$watch((()=>this.g.player.name),(e=>{this.g.onNameChange(e)})),this.$watch((()=>this.g.player.soundsEnabled),(e=>{this.g.onSoundsEnabledChange(e)})),this.g=await zo(`${this.$route.params.id}`,this.$clientId,this.$config.WS_ADDRESS,"replay",this.$el,{setActivePlayers:e=>{this.activePlayers=e},setIdlePlayers:e=>{this.idlePlayers=e},setFinished:e=>{this.finished=e},setDuration:e=>{this.duration=e},setPiecesDone:e=>{this.piecesDone=e},setPiecesTotal:e=>{this.piecesTotal=e},togglePreview:()=>{this.toggle("preview",!1)},setConnectionState:e=>{this.connectionState=e},setReplaySpeed:e=>{this.replay.speed=e},setReplayPaused:e=>{this.replay.paused=e},toggleSoundsEnabled:()=>{this.g.player.soundsEnabled=!this.g.player.soundsEnabled}}))},unmounted(){this.g.disconnect()},methods:{toggle(e,t){""===this.overlay?(this.overlay=e,t&&this.g.setHotkeys(!1)):(this.overlay="",t&&this.g.setHotkeys(!0))}},computed:{replayText(){return"Replay-Speed: "+this.replay.speed+"x"+(this.replay.paused?" Paused":"")}}});const Bo={id:"replay"},Oo={class:"menu"},No={class:"tabs"},Uo=s("🧩 Puzzles");Mo.render=function(e,l,s,d,c,u){const p=a("settings-overlay"),h=a("preview-overlay"),m=a("help-overlay"),y=a("puzzle-status"),f=a("router-link"),w=a("scores");return i(),t("div",Bo,[g(n(p,{onBgclick:l[1]||(l[1]=t=>e.toggle("settings",!0)),modelValue:e.g.player,"onUpdate:modelValue":l[2]||(l[2]=t=>e.g.player=t)},null,8,["modelValue"]),[[C,"settings"===e.overlay]]),g(n(h,{onBgclick:l[3]||(l[3]=t=>e.toggle("preview",!1)),img:e.g.previewImageUrl},null,8,["img"]),[[C,"preview"===e.overlay]]),g(n(m,{onBgclick:l[4]||(l[4]=t=>e.toggle("help",!0))},null,512),[[C,"help"===e.overlay]]),n(y,{finished:e.finished,duration:e.duration,piecesDone:e.piecesDone,piecesTotal:e.piecesTotal},{default:o((()=>[n("div",null,[n("div",null,r(e.replayText),1),n("button",{class:"btn",onClick:l[5]||(l[5]=t=>e.g.replayOnSpeedUp())},"⏫"),n("button",{class:"btn",onClick:l[6]||(l[6]=t=>e.g.replayOnSpeedDown())},"⏬"),n("button",{class:"btn",onClick:l[7]||(l[7]=t=>e.g.replayOnPauseToggle())},"⏸️")])])),_:1},8,["finished","duration","piecesDone","piecesTotal"]),n("div",Oo,[n("div",No,[n(f,{class:"opener",to:{name:"index"},target:"_blank"},{default:o((()=>[Uo])),_:1}),n("div",{class:"opener",onClick:l[8]||(l[8]=t=>e.toggle("preview",!1))},"πŸ–ΌοΈ Preview"),n("div",{class:"opener",onClick:l[9]||(l[9]=t=>e.toggle("settings",!0))},"πŸ› οΈ Settings"),n("div",{class:"opener",onClick:l[10]||(l[10]=t=>e.toggle("help",!0))},"ℹ️ Help")])]),n(w,{activePlayers:e.activePlayers,idlePlayers:e.idlePlayers},null,8,["activePlayers","idlePlayers"])])},(async()=>{const e=await fetch("/api/conf"),t=await e.json();const n=k({history:A(),routes:[{name:"index",path:"/",component:L},{name:"new-game",path:"/new-game",component:qe},{name:"game",path:"/g/:id",component:Po},{name:"replay",path:"/replay/:id",component:Mo}]});n.beforeEach(((e,t)=>{t.name&&document.documentElement.classList.remove(`view-${String(t.name)}`),document.documentElement.classList.add(`view-${String(e.name)}`)}));const o=S(T);o.config.globalProperties.$config=t,o.config.globalProperties.$clientId=function(){let e=localStorage.getItem("ID");return e||(e=We.uniqId(),localStorage.setItem("ID",e)),e}(),o.use(n),o.mount("#app")})(); +import{d as e,c as t,a as n,w as o,b as l,r as a,o as i,e as s,t as r,F as d,f as c,g as u,h as g,v as p,i as h,j as m,p as y,k as f,l as w,m as v,n as b,q as x,s as C,u as k,x as A,y as S}from"./vendor.684f7bc8.js";var T=e({name:"app",computed:{showNav(){return!["game","replay"].includes(String(this.$route.name))}}});const z={id:"app"},P={key:0,class:"nav"},I=s("Index"),_=s("New game");T.render=function(e,s,r,d,c,u){const g=a("router-link"),p=a("router-view");return i(),t("div",z,[e.showNav?(i(),t("ul",P,[n("li",null,[n(g,{class:"btn",to:{name:"index"}},{default:o((()=>[I])),_:1})]),n("li",null,[n(g,{class:"btn",to:{name:"new-game"}},{default:o((()=>[_])),_:1})])])):l("",!0),n(p)])};const E=864e5,D=e=>{const t=Math.floor(e/E);e%=E;const n=Math.floor(e/36e5);e%=36e5;const o=Math.floor(e/6e4);e%=6e4;return`${t}d ${n}h ${o}m ${Math.floor(e/1e3)}s`};var M=1e3,B=()=>{const e=new Date;return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())},O=(e,t)=>D(t-e),N=D,U=e({name:"game-teaser",props:{game:{type:Object,required:!0}},computed:{style(){return{"background-image":`url("${this.game.imageUrl.replace("uploads/","uploads/r/")+"-375x210.webp"}")`}}},methods:{time(e,t){const n=t?"🏁":"⏳",o=e,l=t||B();return`${n} ${O(o,l)}`}}});const G={class:"game-info-text"},V=n("br",null,null,-1),$=n("br",null,null,-1),R=n("br",null,null,-1),F=s(" β†ͺ️ Watch replay ");U.render=function(e,d,c,u,g,p){const h=a("router-link");return i(),t("div",{class:"game-teaser",style:e.style},[n(h,{class:"game-info",to:{name:"game",params:{id:e.game.id}}},{default:o((()=>[n("span",G,[s(" 🧩 "+r(e.game.tilesFinished)+"/"+r(e.game.tilesTotal),1),V,s(" πŸ‘₯ "+r(e.game.players),1),$,s(" "+r(e.time(e.game.started,e.game.finished)),1),R])])),_:1},8,["to"]),e.game.hasReplay?(i(),t(h,{key:0,class:"game-replay",to:{name:"replay",params:{id:e.game.id}}},{default:o((()=>[F])),_:1},8,["to"])):l("",!0)],4)};var L=e({components:{GameTeaser:U},data:()=>({gamesRunning:[],gamesFinished:[]}),async created(){const e=await fetch("/api/index-data"),t=await e.json();this.gamesRunning=t.gamesRunning,this.gamesFinished=t.gamesFinished}});const j=n("h1",null,"Running games",-1),W=n("h1",null,"Finished games",-1);L.render=function(e,o,l,s,r,u){const g=a("game-teaser");return i(),t("div",null,[j,(i(!0),t(d,null,c(e.gamesRunning,((e,o)=>(i(),t("div",{class:"game-teaser-wrap",key:o},[n(g,{game:e},null,8,["game"])])))),128)),W,(i(!0),t(d,null,c(e.gamesFinished,((e,o)=>(i(),t("div",{class:"game-teaser-wrap",key:o},[n(g,{game:e},null,8,["game"])])))),128))])};var q=e({name:"image-teaser",props:{image:{type:Object,required:!0}},computed:{style(){return{backgroundImage:`url("${this.image.url.replace("uploads/","uploads/r/")+"-150x100.webp"}")`}}},emits:{click:null,editClick:null},methods:{onClick(){this.$emit("click")},onEditClick(){this.$emit("editClick")}}});q.render=function(e,o,l,a,s,r){return i(),t("div",{class:"imageteaser",style:e.style,onClick:o[2]||(o[2]=(...t)=>e.onClick&&e.onClick(...t))},[n("div",{class:"btn edit",onClick:o[1]||(o[1]=u(((...t)=>e.onEditClick&&e.onEditClick(...t)),["stop"]))},"✏️")],4)};var H=e({name:"image-library",components:{ImageTeaser:q},props:{images:{type:Array,required:!0}},emits:{imageClicked:null,imageEditClicked:null},methods:{imageClicked(e){this.$emit("imageClicked",e)},imageEditClicked(e){this.$emit("imageEditClicked",e)}}});H.render=function(e,n,o,l,s,r){const u=a("image-teaser");return i(),t("div",null,[(i(!0),t(d,null,c(e.images,((n,o)=>(i(),t(u,{image:n,onClick:t=>e.imageClicked(n),onEditClick:t=>e.imageEditClicked(n),key:o},null,8,["image","onClick","onEditClick"])))),128))])};const Y={name:"responsive-image",props:{src:String,title:{type:String,default:""},height:{type:String,default:"100%"},width:{type:String,default:"100%"}},computed:{style(){return{display:"inline-block",verticalAlign:"text-bottom",backgroundImage:`url('${this.src}')`,backgroundRepeat:"no-repeat",backgroundSize:"contain",backgroundPosition:"center",width:this.width,height:this.height}}}};Y.render=function(e,n,o,l,a,s){return i(),t("div",{style:s.style,title:o.title},null,12,["title"])};var Q=e({name:"tags-input",props:{modelValue:{type:Array,required:!0},autocompleteTags:{type:Function}},emits:{"update:modelValue":null},data:()=>({input:"",values:[],autocomplete:{idx:-1,values:[]}}),created(){this.values=this.modelValue},methods:{onKeyUp(e){return"ArrowDown"===e.key&&this.autocomplete.values.length>0?(this.autocomplete.idx0?(this.autocomplete.idx>0&&this.autocomplete.idx--,e.stopPropagation(),!1):","===e.key?(this.add(),e.stopPropagation(),!1):void(this.input&&this.autocompleteTags?(this.autocomplete.values=this.autocompleteTags(this.input,this.values),this.autocomplete.idx=-1):(this.autocomplete.values=[],this.autocomplete.idx=-1))},addVal(e){const t=e.replace(/,/g,"").trim();t&&(this.values.includes(t)||this.values.push(t),this.input="",this.autocomplete.values=[],this.autocomplete.idx=-1,this.$emit("update:modelValue",this.values),this.$refs.input.focus())},add(){const e=this.autocomplete.idx>=0?this.autocomplete.values[this.autocomplete.idx]:this.input;this.addVal(e)},rm(e){this.values=this.values.filter((t=>t!==e)),this.$emit("update:modelValue",this.values)}}});const Z=m();y("data-v-39ed99c7");const K={key:0,class:"autocomplete"};f();const J=Z(((e,o,a,s,u,m)=>(i(),t("div",null,[g(n("input",{ref:"input",class:"input",type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.input=t),placeholder:"Plants, People",onChange:o[2]||(o[2]=(...t)=>e.onChange&&e.onChange(...t)),onKeydown:o[3]||(o[3]=h(((...t)=>e.add&&e.add(...t)),["enter"])),onKeyup:o[4]||(o[4]=(...t)=>e.onKeyUp&&e.onKeyUp(...t))},null,544),[[p,e.input]]),e.autocomplete.values?(i(),t("div",K,[n("ul",null,[(i(!0),t(d,null,c(e.autocomplete.values,((n,o)=>(i(),t("li",{key:o,class:{active:o===e.autocomplete.idx},onClick:t=>e.addVal(n)},r(n),11,["onClick"])))),128))])])):l("",!0),(i(!0),t(d,null,c(e.values,((n,o)=>(i(),t("span",{key:o,class:"bit",onClick:t=>e.rm(n)},r(n)+" βœ–",9,["onClick"])))),128))]))));Q.render=J,Q.__scopeId="data-v-39ed99c7";var X=e({name:"new-image-dialog",components:{ResponsiveImage:Y,TagsInput:Q},props:{autocompleteTags:{type:Function}},emits:{bgclick:null,setupGameClick:null,postToGalleryClick:null},data:()=>({previewUrl:"",file:null,title:"",tags:[]}),computed:{canPostToGallery(){return!(!this.previewUrl||!this.file)},canSetupGameClick(){return!(!this.previewUrl||!this.file)}},methods:{preview(e){const t=e.target;if(!t.files)return;const n=t.files[0];if(!n)return;const o=new FileReader;o.readAsDataURL(n),o.onload=e=>{this.previewUrl=e.target.result,this.file=n}},postToGallery(){this.$emit("postToGalleryClick",{file:this.file,title:this.title,tags:this.tags})},setupGameClick(){this.$emit("setupGameClick",{file:this.file,title:this.title,tags:this.tags})}}});const ee={key:0,class:"has-image"},te={key:1},ne={class:"upload"},oe=n("span",{class:"btn"},"Upload File",-1),le={class:"area-settings"},ae=n("td",null,[n("label",null,"Title")],-1),ie=n("tr",null,[n("td",{colspan:"2"},[n("div",{class:"hint"},"Feel free to leave a credit to the artist/photographer in the title :)")])],-1),se=n("td",null,[n("label",null,"Tags")],-1),re={class:"area-buttons"},de=s("🧩 Post to gallery "),ce=n("br",null,null,-1),ue=s(" + set up game");X.render=function(e,o,l,s,r,d){const c=a("responsive-image"),h=a("tags-input");return i(),t("div",{class:"overlay new-image-dialog",onClick:o[8]||(o[8]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[7]||(o[7]=u((()=>{}),["stop"]))},[n("div",{class:["area-image",{"has-image":!!e.previewUrl,"no-image":!e.previewUrl}]},[e.previewUrl?(i(),t("div",ee,[n("span",{class:"remove btn",onClick:o[1]||(o[1]=t=>e.previewUrl="")},"X"),n(c,{src:e.previewUrl},null,8,["src"])])):(i(),t("div",te,[n("label",ne,[n("input",{type:"file",style:{display:"none"},onChange:o[2]||(o[2]=(...t)=>e.preview&&e.preview(...t)),accept:"image/*"},null,32),oe])]))],2),n("div",le,[n("table",null,[n("tr",null,[ae,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[3]||(o[3]=t=>e.title=t),placeholder:"Flower by @artist"},null,512),[[p,e.title]])])]),ie,n("tr",null,[se,n("td",null,[n(h,{modelValue:e.tags,"onUpdate:modelValue":o[4]||(o[4]=t=>e.tags=t),autocompleteTags:e.autocompleteTags},null,8,["modelValue","autocompleteTags"])])])])]),n("div",re,[n("button",{class:"btn",disabled:!e.canPostToGallery,onClick:o[5]||(o[5]=(...t)=>e.postToGallery&&e.postToGallery(...t))},"πŸ–ΌοΈ Post to gallery",8,["disabled"]),n("button",{class:"btn",disabled:!e.canSetupGameClick,onClick:o[6]||(o[6]=(...t)=>e.setupGameClick&&e.setupGameClick(...t))},[de,ce,ue],8,["disabled"])])])])};var ge=e({name:"edit-image-dialog",components:{ResponsiveImage:Y,TagsInput:Q},props:{image:{type:Object,required:!0},autocompleteTags:{type:Function}},emits:{bgclick:null,saveClick:null},data:()=>({title:"",tags:[]}),created(){this.title=this.image.title,this.tags=this.image.tags.map((e=>e.title))},methods:{saveImage(){this.$emit("saveClick",{id:this.image.id,title:this.title,tags:this.tags})}}});const pe={class:"area-image"},he={class:"has-image"},me={class:"area-settings"},ye=n("td",null,[n("label",null,"Title")],-1),fe=n("tr",null,[n("td",{colspan:"2"},[n("div",{class:"hint"},"Feel free to leave a credit to the artist/photographer in the title :)")])],-1),we=n("td",null,[n("label",null,"Tags")],-1),ve={class:"area-buttons"};var be,xe,Ce,ke,Ae,Se;ge.render=function(e,o,l,s,r,d){const c=a("responsive-image"),h=a("tags-input");return i(),t("div",{class:"overlay edit-image-dialog",onClick:o[5]||(o[5]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[4]||(o[4]=u((()=>{}),["stop"]))},[n("div",pe,[n("div",he,[n(c,{src:e.image.url,title:e.image.title},null,8,["src","title"])])]),n("div",me,[n("table",null,[n("tr",null,[ye,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.title=t),placeholder:"Flower by @artist"},null,512),[[p,e.title]])])]),fe,n("tr",null,[we,n("td",null,[n(h,{modelValue:e.tags,"onUpdate:modelValue":o[2]||(o[2]=t=>e.tags=t),autocompleteTags:e.autocompleteTags},null,8,["modelValue","autocompleteTags"])])])])]),n("div",ve,[n("button",{class:"btn",onClick:o[3]||(o[3]=(...t)=>e.saveImage&&e.saveImage(...t))},"πŸ–ΌοΈ Save image")])])])},(xe=be||(be={}))[xe.Flat=0]="Flat",xe[xe.Out=1]="Out",xe[xe.In=-1]="In",(ke=Ce||(Ce={}))[ke.FINAL=0]="FINAL",ke[ke.ANY=1]="ANY",(Se=Ae||(Ae={}))[Se.NORMAL=0]="NORMAL",Se[Se.ANY=1]="ANY",Se[Se.FLAT=2]="FLAT";var Te=e({name:"new-game-dialog",components:{ResponsiveImage:Y},props:{image:{type:Object,required:!0}},emits:{newGame:null,bgclick:null},data:()=>({tiles:1e3,scoreMode:Ce.ANY,shapeMode:Ae.NORMAL}),methods:{onNewGameClick(){this.$emit("newGame",{tiles:this.tilesInt,image:this.image,scoreMode:this.scoreModeInt,shapeMode:this.shapeModeInt})}},computed:{canStartNewGame(){return!!(this.tilesInt&&this.image&&this.image.url&&[0,1].includes(this.scoreModeInt))},scoreModeInt(){return parseInt(`${this.scoreMode}`,10)},shapeModeInt(){return parseInt(`${this.shapeMode}`,10)},tilesInt(){return parseInt(`${this.tiles}`,10)}}});const ze={class:"area-image"},Pe={class:"has-image"},Ie={class:"area-settings"},_e=n("td",null,[n("label",null,"Pieces")],-1),Ee=n("td",null,[n("label",null,"Scoring: ")],-1),De=s(" Any (Score when pieces are connected to each other or on final location)"),Me=n("br",null,null,-1),Be=s(" Final (Score when pieces are put to their final location)"),Oe=n("td",null,[n("label",null,"Shapes: ")],-1),Ne=s(" Normal"),Ue=n("br",null,null,-1),Ge=s(" Any (flat pieces can occur anywhere)"),Ve=n("br",null,null,-1),$e=s(" Flat (all pieces flat on all sides)"),Re={class:"area-buttons"};Te.render=function(e,o,l,s,r,d){const c=a("responsive-image");return i(),t("div",{class:"overlay new-game-dialog",onClick:o[9]||(o[9]=t=>e.$emit("bgclick"))},[n("div",{class:"overlay-content",onClick:o[8]||(o[8]=u((()=>{}),["stop"]))},[n("div",ze,[n("div",Pe,[n(c,{src:e.image.url,title:e.image.title},null,8,["src","title"])])]),n("div",Ie,[n("table",null,[n("tr",null,[_e,n("td",null,[g(n("input",{type:"text","onUpdate:modelValue":o[1]||(o[1]=t=>e.tiles=t)},null,512),[[p,e.tiles]])])]),n("tr",null,[Ee,n("td",null,[n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[2]||(o[2]=t=>e.scoreMode=t),value:"1"},null,512),[[w,e.scoreMode]]),De]),Me,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[3]||(o[3]=t=>e.scoreMode=t),value:"0"},null,512),[[w,e.scoreMode]]),Be])])]),n("tr",null,[Oe,n("td",null,[n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[4]||(o[4]=t=>e.shapeMode=t),value:"0"},null,512),[[w,e.shapeMode]]),Ne]),Ue,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[5]||(o[5]=t=>e.shapeMode=t),value:"1"},null,512),[[w,e.shapeMode]]),Ge]),Ve,n("label",null,[g(n("input",{type:"radio","onUpdate:modelValue":o[6]||(o[6]=t=>e.shapeMode=t),value:"2"},null,512),[[w,e.shapeMode]]),$e])])])])]),n("div",Re,[n("button",{class:"btn",disabled:!e.canStartNewGame,onClick:o[7]||(o[7]=(...t)=>e.onNewGameClick&&e.onNewGameClick(...t))}," 🧩 Generate Puzzle ",8,["disabled"])])])])};class Fe{constructor(e){this.rand_high=e||3735929054,this.rand_low=1231121986^e}random(e,t){this.rand_high=(this.rand_high<<16)+(this.rand_high>>16)+this.rand_low&4294967295,this.rand_low=this.rand_low+this.rand_high&4294967295;return e+(this.rand_high>>>0)/4294967295*(t-e+1)|0}choice(e){return e[this.random(0,e.length-1)]}shuffle(e){const t=e.slice();for(let n=0;n<=t.length-2;n++){const e=this.random(n,t.length-1),o=t[n];t[n]=t[e],t[e]=o}return t}static serialize(e){return{rand_high:e.rand_high,rand_low:e.rand_low}}static unserialize(e){const t=new Fe(0);return t.rand_high=e.rand_high,t.rand_low=e.rand_low,t}}const Le=(e,t)=>{const n=`${e}`;return n.length>=t.length?n:t.substr(0,t.length-n.length)+n},je=(...e)=>{const t=t=>(...n)=>{const o=new Date,l=Le(o.getHours(),"00"),a=Le(o.getMinutes(),"00"),i=Le(o.getSeconds(),"00");console[t](`${l}:${a}:${i}`,...e,...n)};return{log:t("log"),error:t("error"),info:t("info")}};var We={hash:e=>{let t=0;for(let n=0;n{let t=e.toLowerCase();return t=t.replace(/[^a-z0-9]+/g,"-"),t=t.replace(/^-|-$/,""),t},uniqId:()=>Date.now().toString(36)+Math.random().toString(36).substring(2),encodeShape:function(e){return e.top+1<<0|e.right+1<<2|e.bottom+1<<4|e.left+1<<6},decodeShape:function(e){return{top:(e>>0&3)-1,right:(e>>2&3)-1,bottom:(e>>4&3)-1,left:(e>>6&3)-1}},encodePiece:function(e){return[e.idx,e.pos.x,e.pos.y,e.z,e.owner,e.group]},decodePiece:function(e){return{idx:e[0],pos:{x:e[1],y:e[2]},z:e[3],owner:e[4],group:e[5]}},encodePlayer:function(e){return[e.id,e.x,e.y,e.d,e.name,e.color,e.bgcolor,e.points,e.ts]},decodePlayer:function(e){return{id:e[0],x:e[1],y:e[2],d:e[3],name:e[4],color:e[5],bgcolor:e[6],points:e[7],ts:e[8]}},encodeGame:function(e){return[e.id,e.rng.type||"",Fe.serialize(e.rng.obj),e.puzzle,e.players,e.evtInfos,e.scoreMode||Ce.FINAL]},decodeGame:function(e){return{id:e[0],rng:{type:e[1],obj:Fe.unserialize(e[2])},puzzle:e[3],players:e[4],evtInfos:e[5],scoreMode:e[6]}},coordByPieceIdx:function(e,t){const n=e.width/e.tileSize;return{x:t%n,y:Math.floor(t/n)}},asQueryArgs:function(e){const t=[];for(const n in e){const o=[n,e[n]].map(encodeURIComponent);t.push(o.join("="))}return 0===t.length?"":`?${t.join("&")}`}},qe=e({components:{ImageLibrary:H,NewImageDialog:X,EditImageDialog:ge,NewGameDialog:Te},data:()=>({filters:{sort:"date_desc",tags:[]},images:[],tags:[],image:{id:0,filename:"",file:"",url:"",title:"",tags:[],created:0},dialog:""}),async created(){await this.loadImages()},computed:{relevantTags(){return this.tags.filter((e=>e.total>0))}},methods:{autocompleteTags(e,t){return this.tags.filter((n=>!t.includes(n.title)&&n.title.toLowerCase().startsWith(e.toLowerCase()))).slice(0,10).map((e=>e.title))},toggleTag(e){this.filters.tags.includes(e.slug)?this.filters.tags=this.filters.tags.filter((t=>t!==e.slug)):this.filters.tags.push(e.slug),this.filtersChanged()},async loadImages(){const e=await fetch(`/api/newgame-data${We.asQueryArgs(this.filters)}`),t=await e.json();this.images=t.images,this.tags=t.tags},async filtersChanged(){await this.loadImages()},onImageClicked(e){this.image=e,this.dialog="new-game"},onImageEditClicked(e){this.image=e,this.dialog="edit-image"},async uploadImage(e){const t=new FormData;t.append("file",e.file,e.file.name),t.append("title",e.title),t.append("tags",e.tags);const n=await fetch("/api/upload",{method:"post",body:t});return await n.json()},async saveImage(e){const t=await fetch("/api/save-image",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({id:e.id,title:e.title,tags:e.tags})});return await t.json()},async onSaveImageClick(e){await this.saveImage(e),this.dialog="",await this.loadImages()},async postToGalleryClick(e){await this.uploadImage(e),this.dialog="",await this.loadImages()},async setupGameClick(e){const t=await this.uploadImage(e);this.loadImages(),this.image=t,this.dialog="new-game"},async onNewGame(e){const t=await fetch("/api/newgame",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(e)});if(200===t.status){const e=await t.json();this.$router.push({name:"game",params:{id:e.id}})}}}});const He={class:"upload-image-teaser"},Ye=n("div",{class:"hint"},"(The image you upload will be added to the public gallery.)",-1),Qe={key:0},Ze=s(" Tags: "),Ke=s(" Sort by: "),Je=n("option",{value:"date_desc"},"Newest first",-1),Xe=n("option",{value:"date_asc"},"Oldest first",-1),et=n("option",{value:"alpha_asc"},"A-Z",-1),tt=n("option",{value:"alpha_desc"},"Z-A",-1);qe.render=function(e,o,s,u,p,h){const m=a("image-library"),y=a("new-image-dialog"),f=a("edit-image-dialog"),w=a("new-game-dialog");return i(),t("div",null,[n("div",He,[n("div",{class:"btn btn-big",onClick:o[1]||(o[1]=t=>e.dialog="new-image")},"Upload your image"),Ye]),n("div",null,[e.tags.length>0?(i(),t("label",Qe,[Ze,(i(!0),t(d,null,c(e.relevantTags,((n,o)=>(i(),t("span",{class:["bit",{on:e.filters.tags.includes(n.slug)}],key:o,onClick:t=>e.toggleTag(n)},r(n.title)+" ("+r(n.total)+")",11,["onClick"])))),128))])):l("",!0),n("label",null,[Ke,g(n("select",{"onUpdate:modelValue":o[2]||(o[2]=t=>e.filters.sort=t),onChange:o[3]||(o[3]=(...t)=>e.filtersChanged&&e.filtersChanged(...t))},[Je,Xe,et,tt],544),[[v,e.filters.sort]])])]),n(m,{images:e.images,onImageClicked:e.onImageClicked,onImageEditClicked:e.onImageEditClicked},null,8,["images","onImageClicked","onImageEditClicked"]),"new-image"===e.dialog?(i(),t(y,{key:0,autocompleteTags:e.autocompleteTags,onBgclick:o[4]||(o[4]=t=>e.dialog=""),onPostToGalleryClick:e.postToGalleryClick,onSetupGameClick:e.setupGameClick},null,8,["autocompleteTags","onPostToGalleryClick","onSetupGameClick"])):l("",!0),"edit-image"===e.dialog?(i(),t(f,{key:1,autocompleteTags:e.autocompleteTags,onBgclick:o[5]||(o[5]=t=>e.dialog=""),onSaveClick:e.onSaveImageClick,image:e.image},null,8,["autocompleteTags","onSaveClick","image"])):l("",!0),e.image&&"new-game"===e.dialog?(i(),t(w,{key:2,onBgclick:o[6]||(o[6]=t=>e.dialog=""),onNewGame:e.onNewGame,image:e.image},null,8,["onNewGame","image"])):l("",!0)])};var nt=e({name:"scores",props:{activePlayers:{type:Array,required:!0},idlePlayers:{type:Array,required:!0}},computed:{actives(){return this.activePlayers.sort(((e,t)=>t.points-e.points)),this.activePlayers},idles(){return this.idlePlayers.sort(((e,t)=>t.points-e.points)),this.idlePlayers}}});const ot={class:"scores"},lt=n("div",null,"Scores",-1),at=n("td",null,"⚑",-1),it=n("td",null,"πŸ’€",-1);nt.render=function(e,o,l,a,s,u){return i(),t("div",ot,[lt,n("table",null,[(i(!0),t(d,null,c(e.actives,((e,o)=>(i(),t("tr",{key:o,style:{color:e.color}},[at,n("td",null,r(e.name),1),n("td",null,r(e.points),1)],4)))),128)),(i(!0),t(d,null,c(e.idles,((e,o)=>(i(),t("tr",{key:o,style:{color:e.color}},[it,n("td",null,r(e.name),1),n("td",null,r(e.points),1)],4)))),128))])])};var st=e({name:"puzzle-status",props:{finished:{type:Boolean,required:!0},duration:{type:Number,required:!0},piecesDone:{type:Number,required:!0},piecesTotal:{type:Number,required:!0}},computed:{icon(){return this.finished?"🏁":"⏳"},durationStr(){return N(this.duration)}}});const rt={class:"timer"};st.render=function(e,o,l,a,s,d){return i(),t("div",rt,[n("div",null," 🧩 "+r(e.piecesDone)+"/"+r(e.piecesTotal),1),n("div",null,r(e.icon)+" "+r(e.durationStr),1),b(e.$slots,"default")])};var dt=e({name:"settings-overlay",emits:{bgclick:null,"update:modelValue":null},props:{modelValue:Object},created(){this.$watch("modelValue",(e=>{this.$emit("update:modelValue",e)}),{deep:!0})}});const ct=n("td",null,[n("label",null,"Background: ")],-1),ut=n("td",null,[n("label",null,"Color: ")],-1),gt=n("td",null,[n("label",null,"Name: ")],-1),pt=n("td",null,[n("label",null,"Sounds: ")],-1);dt.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay transparent",onClick:o[6]||(o[6]=t=>e.$emit("bgclick"))},[n("table",{class:"overlay-content settings",onClick:o[5]||(o[5]=u((()=>{}),["stop"]))},[n("tr",null,[ct,n("td",null,[g(n("input",{type:"color","onUpdate:modelValue":o[1]||(o[1]=t=>e.modelValue.background=t)},null,512),[[p,e.modelValue.background]])])]),n("tr",null,[ut,n("td",null,[g(n("input",{type:"color","onUpdate:modelValue":o[2]||(o[2]=t=>e.modelValue.color=t)},null,512),[[p,e.modelValue.color]])])]),n("tr",null,[gt,n("td",null,[g(n("input",{type:"text",maxLength:"16","onUpdate:modelValue":o[3]||(o[3]=t=>e.modelValue.name=t)},null,512),[[p,e.modelValue.name]])])]),n("tr",null,[pt,n("td",null,[g(n("input",{type:"checkbox","onUpdate:modelValue":o[4]||(o[4]=t=>e.modelValue.soundsEnabled=t)},null,512),[[x,e.modelValue.soundsEnabled]])])])])])};var ht=e({name:"preview-overlay",props:{img:String},emits:{bgclick:null},computed:{previewStyle(){return{backgroundImage:`url('${this.img}')`}}}});const mt={class:"preview"};ht.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay",onClick:o[1]||(o[1]=t=>e.$emit("bgclick"))},[n("div",mt,[n("div",{class:"img",style:e.previewStyle},null,4)])])};var yt=1,ft=4,wt=2,vt=3,bt=2,xt=4,Ct=3,kt=9,At=1,St=2,Tt=3,zt=4,Pt=5,It=6,_t=7,Et=8,Dt=10,Mt=11,Bt=1,Ot=2,Nt=3;const Ut=je("Communication.js");let Gt,Vt=[],$t=e=>{Vt.push(e)},Rt=[],Ft=e=>{Rt.push(e)};let Lt=0;const jt=e=>{Lt!==e&&(Lt=e,Ft(e))};function Wt(e){if(2===Lt)try{Gt.send(JSON.stringify(e))}catch(t){Ut.info("unable to send message.. maybe because ws is invalid?")}}let qt,Ht;var Yt={connect:function(e,t,n){return qt=0,Ht={},jt(3),new Promise((o=>{Gt=new WebSocket(e,n+"|"+t),Gt.onopen=()=>{jt(2),Wt([vt])},Gt.onmessage=e=>{const t=JSON.parse(e.data),l=t[0];if(l===ft){const e=t[1];o(e)}else{if(l!==yt)throw`[ 2021-05-09 invalid connect msgType ${l} ]`;{const e=t[1],o=t[2];if(e===n&&Ht[o])return void delete Ht[o];$t(t)}}},Gt.onerror=()=>{throw jt(1),"[ 2021-05-15 onerror ]"},Gt.onclose=e=>{4e3===e.code||1001===e.code?jt(4):jt(1)}}))},requestReplayData:async function(e,t,n){const o={gameId:e,offset:t,size:n},l=await fetch(`/api/replay-data${We.asQueryArgs(o)}`);return await l.json()},disconnect:function(){Gt&&Gt.close(4e3),qt=0,Ht={}},sendClientEvent:function(e){qt++,Ht[qt]=e,Wt([wt,qt,Ht[qt]])},onServerChange:function(e){$t=e;for(const t of Vt)$t(t);Vt=[]},onConnectionStateChange:function(e){Ft=e;for(const t of Rt)Ft(t);Rt=[]},CODE_CUSTOM_DISCONNECT:4e3,CONN_STATE_NOT_CONNECTED:0,CONN_STATE_DISCONNECTED:1,CONN_STATE_CLOSED:4,CONN_STATE_CONNECTED:2,CONN_STATE_CONNECTING:3},Qt=e({name:"connection-overlay",emits:{reconnect:null},props:{connectionState:Number},computed:{lostConnection(){return this.connectionState===Yt.CONN_STATE_DISCONNECTED},connecting(){return this.connectionState===Yt.CONN_STATE_CONNECTING},show(){return!(!this.lostConnection&&!this.connecting)}}});const Zt={key:0,class:"overlay connection-lost"},Kt={key:0,class:"overlay-content"},Jt=n("div",null,"⁉️ LOST CONNECTION ⁉️",-1),Xt={key:1,class:"overlay-content"},en=n("div",null,"Connecting...",-1);Qt.render=function(e,o,a,s,r,d){return e.show?(i(),t("div",Zt,[e.lostConnection?(i(),t("div",Kt,[Jt,n("span",{class:"btn",onClick:o[1]||(o[1]=t=>e.$emit("reconnect"))},"Reconnect")])):l("",!0),e.connecting?(i(),t("div",Xt,[en])):l("",!0)])):l("",!0)};var tn=e({name:"help-overlay",emits:{bgclick:null}});const nn=n("tr",null,[n("td",null,"⬆️ Move up:"),n("td",null,[n("div",null,[n("kbd",null,"W"),s("/"),n("kbd",null,"↑"),s("/πŸ–±οΈ")])])],-1),on=n("tr",null,[n("td",null,"⬇️ Move down:"),n("td",null,[n("div",null,[n("kbd",null,"S"),s("/"),n("kbd",null,"↓"),s("/πŸ–±οΈ")])])],-1),ln=n("tr",null,[n("td",null,"⬅️ Move left:"),n("td",null,[n("div",null,[n("kbd",null,"A"),s("/"),n("kbd",null,"←"),s("/πŸ–±οΈ")])])],-1),an=n("tr",null,[n("td",null,"➑️ Move right:"),n("td",null,[n("div",null,[n("kbd",null,"D"),s("/"),n("kbd",null,"β†’"),s("/πŸ–±οΈ")])])],-1),sn=n("tr",null,[n("td"),n("td",null,[n("div",null,[s("Move faster by holding "),n("kbd",null,"Shift")])])],-1),rn=n("tr",null,[n("td",null,"πŸ”+ Zoom in:"),n("td",null,[n("div",null,[n("kbd",null,"E"),s("/πŸ–±οΈ-Wheel")])])],-1),dn=n("tr",null,[n("td",null,"πŸ”- Zoom out:"),n("td",null,[n("div",null,[n("kbd",null,"Q"),s("/πŸ–±οΈ-Wheel")])])],-1),cn=n("tr",null,[n("td",null,"πŸ–ΌοΈ Toggle preview:"),n("td",null,[n("div",null,[n("kbd",null,"Space")])])],-1),un=n("tr",null,[n("td",null,"πŸ§©βœ”οΈ Toggle fixed pieces:"),n("td",null,[n("div",null,[n("kbd",null,"F")])])],-1),gn=n("tr",null,[n("td",null,"πŸ§©β“ Toggle loose pieces:"),n("td",null,[n("div",null,[n("kbd",null,"G")])])],-1),pn=n("tr",null,[n("td",null,"πŸ”‰ Toggle sounds:"),n("td",null,[n("div",null,[n("kbd",null,"M")])])],-1);tn.render=function(e,o,l,a,s,r){return i(),t("div",{class:"overlay transparent",onClick:o[2]||(o[2]=t=>e.$emit("bgclick"))},[n("table",{class:"overlay-content help",onClick:o[1]||(o[1]=u((()=>{}),["stop"]))},[nn,on,ln,an,sn,rn,dn,cn,un,gn,pn])])};var hn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"/assets/click.f7a156d0.mp3"}),mn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAW0lEQVQ4je1RywrAIAxLxP//5exixRWlVgZelpOKeTQFfnDypgy3eLIkSLLL8mxGPoHsU2hPAgDHBLvRX6hZZw/fwT0BtlLSONqCbWAmEIqMZOCDDlaDR3N03gOyDCn+y4DWmAAAAABJRU5ErkJggg=="}),yn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAARElEQVQ4jWNgGAU0Af+hmBCbgYGBgYERhwHEAEYGBgYGJtIdiApYyLAZBVDsAqoagC1ACQJyY4ERg0GCISh6KA4DigEAou8LC+LnIJoAAAAASUVORK5CYII="}),fn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAcUlEQVQ4ja1TQQ7AIAgD///n7jCozA2Hbk00jbG1KIrcARszTugoBs49qioZj7r2kKACptkyAOCJsJuA+GzglwHjvMSSWFVaENWVASxh5eRLiq5fN/ASjI89VcP2K3hHpq1cEXNaMfnrL3TDZP2tDuoOA6MzCCXWr38AAAAASUVORK5CYII="}),wn=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAU0lEQVQ4jWNgoAH4D8X42HDARKlt5BoAd82AuQAOGLGIYQQUPv0wF5CiCQUge4EsQ5C9QI4BjMguwBYeBAElscCIy1ZivMKIwSDBEBQ9FCckigEAU3QOD7TGvY4AAAAASUVORK5CYII="});function vn(){let e=0,t=0,n=1;const o=(o,l)=>{e+=o/n,t+=l/n},l=e=>{const t=n+.05*n*("in"===e?1:-1);return Math.min(Math.max(t,.1),6)},a=o=>({x:o.x/n-e,y:o.y/n-t}),i=o=>({x:(o.x+e)*n,y:(o.y+t)*n}),s=e=>({w:e.w*n,h:e.h*n}),r=e=>({w:e.w/n,h:e.h/n});return{getCurrentZoom:()=>n,move:o,canZoom:e=>n!=l(e),zoom:(e,t)=>((e,t)=>{if(n==e)return!1;const l=1-n/e;return o(-t.x*l,-t.y*l),n=e,!0})(l(e),t),worldToViewport:e=>{const{x:t,y:n}=i(e);return{x:Math.round(t),y:Math.round(n)}},worldToViewportRaw:i,worldDimToViewport:e=>{const{w:t,h:n}=s(e);return{w:Math.round(t),h:Math.round(n)}},worldDimToViewportRaw:s,viewportToWorld:e=>{const{x:t,y:n}=a(e);return{x:Math.round(t),y:Math.round(n)}},viewportToWorldRaw:a,viewportDimToWorld:e=>{const{w:t,h:n}=r(e);return{w:Math.round(t),h:Math.round(n)}},viewportDimToWorldRaw:r}}function bn(e=0,t=0){const n=document.createElement("canvas");return n.width=e,n.height=t,n}var xn={createCanvas:bn,loadImageToBitmap:async function(e){return new Promise((t=>{const n=new Image;n.onload=()=>{createImageBitmap(n).then(t)},n.src=e}))},resizeBitmap:async function(e,t,n){const o=bn(t,n);return o.getContext("2d").drawImage(e,0,0,e.width,e.height,0,0,t,n),await createImageBitmap(o)},colorizedCanvas:function(e,t,n){const o=bn(e.width,e.height),l=o.getContext("2d");return l.save(),l.drawImage(t,0,0),l.fillStyle=n,l.globalCompositeOperation="source-in",l.fillRect(0,0,t.width,t.height),l.restore(),l.save(),l.globalCompositeOperation="destination-over",l.drawImage(e,0,0),l.restore(),o}};const Cn=je("Debug.js");let kn=0,An=0;var Sn=e=>{kn=performance.now(),An=e},Tn=e=>{const t=performance.now(),n=t-kn;n>An&&Cn.log(e+": "+n),kn=t};function zn(e,t){const n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)}function Pn(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}var In={pointSub:function(e,t){return{x:e.x-t.x,y:e.y-t.y}},pointAdd:function(e,t){return{x:e.x+t.x,y:e.y+t.y}},pointDistance:zn,pointInBounds:function(e,t){return e.x>=t.x&&e.x<=t.x+t.w&&e.y>=t.y&&e.y<=t.y+t.h},rectCenter:Pn,rectMoved:function(e,t,n){return{x:e.x+t,y:e.y+n,w:e.w,h:e.h}},rectCenterDistance:function(e,t){return zn(Pn(e),Pn(t))},rectsOverlap:function(e,t){return!(t.x>e.x+e.w||e.x>t.x+t.w||t.y>e.y+e.h||e.y>t.y+t.h)}};const _n=je("PuzzleGraphics.js");function En(e,t){const n=We.coordByPieceIdx(e,t);return{x:n.x*e.tileSize,y:n.y*e.tileSize,w:e.tileSize,h:e.tileSize}}var Dn={loadPuzzleBitmaps:async function(e){const t=await xn.loadImageToBitmap(e.info.imageUrl),n=await xn.resizeBitmap(t,e.info.width,e.info.height);return await async function(e,t,n){_n.log("start createPuzzleTileBitmaps");const o=n.tileSize,l=n.tileMarginWidth,a=n.tileDrawSize,i=o/100,s=[0,0,40,15,37,5,37,5,40,0,38,-5,38,-5,20,-20,50,-20,50,-20,80,-20,62,-5,62,-5,60,0,63,5,63,5,65,15,100,0],r=new Array(t.length),d={};function c(e){const t=`${e.top}${e.right}${e.left}${e.bottom}`;if(d[t])return d[t];const n=new Path2D,a={x:l,y:l},r=In.pointAdd(a,{x:o,y:0}),c=In.pointAdd(r,{x:0,y:o}),u=In.pointSub(c,{x:o,y:0});if(n.moveTo(a.x,a.y),0!==e.top)for(let o=0;oWe.decodePiece(Mn[e].puzzle.tiles[t]),Hn=(e,t)=>qn(e,t).group,Yn=(e,t)=>{const n=Mn[e].puzzle.info,o={x:(n.table.width-n.width)/2,y:(n.table.height-n.height)/2},l=function(e,t){const n=Mn[e].puzzle.info,o=We.coordByPieceIdx(n,t),l=o.x*n.tileSize,a=o.y*n.tileSize;return{x:l,y:a}}(e,t);return In.pointAdd(o,l)},Qn=(e,t)=>qn(e,t).pos,Zn=e=>{const t=go(e),n=po(e),o=Math.round(t/4),l=Math.round(n/4);return{x:0-o,y:0-l,w:t+2*o,h:n+2*l}},Kn=(e,t)=>{const n=to(e),o=qn(e,t);return{x:o.pos.x,y:o.pos.y,w:n,h:n}},Jn=(e,t)=>qn(e,t).z,Xn=(e,t)=>{for(const n of Mn[e].puzzle.tiles){const e=We.decodePiece(n);if(e.owner===t)return e.idx}return-1},eo=e=>Mn[e].puzzle.info.tileDrawSize,to=e=>Mn[e].puzzle.info.tileSize,no=e=>Mn[e].puzzle.data.maxGroup,oo=e=>Mn[e].puzzle.data.maxZ;function lo(e,t){const n=Mn[e].puzzle.info,o=We.coordByPieceIdx(n,t);return[o.y>0?t-n.tilesX:-1,o.x0?t-1:-1]}const ao=(e,t,n)=>{for(const o of t)Wn(e,o,{z:n})},io=(e,t,n)=>{const o=Qn(e,t);Wn(e,t,{pos:In.pointAdd(o,n)})},so=(e,t,n)=>{const o=eo(e),l=Zn(e),a=n;for(const i of t){const t=qn(e,i);t.pos.x+n.xl.x+l.w&&(a.x=Math.min(l.x+l.w-t.pos.x+o,a.x)),t.pos.y+n.yl.y+l.h&&(a.y=Math.min(l.y+l.h-t.pos.y+o,a.y))}for(const i of t)io(e,i,a)},ro=(e,t,n)=>{for(const o of t)Wn(e,o,{owner:n})};function co(e,t){const n=Mn[e].puzzle.tiles,o=We.decodePiece(n[t]),l=[];if(o.group)for(const a of n){const e=We.decodePiece(a);e.group===o.group&&l.push(e.idx)}else l.push(o.idx);return l}const uo=(e,t)=>{const n=On(e,t);return n?n.points:0},go=e=>Mn[e].puzzle.info.table.width,po=e=>Mn[e].puzzle.info.table.height;var ho={setGame:function(e,t){Mn[e]=t},exists:function(e){return!!Mn[e]||!1},playerExists:Un,getActivePlayers:function(e,t){const n=t-30*M;return Gn(e).filter((e=>e.ts>=n))},getIdlePlayers:function(e,t){const n=t-30*M;return Gn(e).filter((e=>e.ts0))},addPlayer:function(e,t,n){Un(e,t)?Ln(e,t,{ts:n}):Nn(e,t,function(e,t){return{id:e,x:0,y:0,d:0,name:null,color:null,bgcolor:null,points:0,ts:t}}(t,n))},getFinishedPiecesCount:Fn,getPieceCount:Vn,getImageUrl:function(e){return Mn[e].puzzle.info.imageUrl},setImageUrl:function(e,t){Mn[e].puzzle.info.imageUrl=t},get:function(e){return Mn[e]||null},getAllGames:function(){return Object.values(Mn).sort(((e,t)=>Rn(e.id)===Rn(t.id)?t.puzzle.data.started-e.puzzle.data.started:Rn(e.id)?1:-1))},getPlayerBgColor:(e,t)=>{const n=On(e,t);return n?n.bgcolor:null},getPlayerColor:(e,t)=>{const n=On(e,t);return n?n.color:null},getPlayerName:(e,t)=>{const n=On(e,t);return n?n.name:null},getPlayerIndexById:Bn,getPlayerIdByIndex:function(e,t){return Mn[e].players.length>t?We.decodePlayer(Mn[e].players[t]).id:null},changePlayer:Ln,setPlayer:Nn,setPiece:function(e,t,n){Mn[e].puzzle.tiles[t]=We.encodePiece(n)},setPuzzleData:function(e,t){Mn[e].puzzle.data=t},getTableWidth:go,getTableHeight:po,getPuzzle:e=>Mn[e].puzzle,getRng:e=>Mn[e].rng.obj,getPuzzleWidth:e=>Mn[e].puzzle.info.width,getPuzzleHeight:e=>Mn[e].puzzle.info.height,getPiecesSortedByZIndex:function(e){return Mn[e].puzzle.tiles.map(We.decodePiece).sort(((e,t)=>e.z-t.z))},getFirstOwnedPiece:(e,t)=>{const n=Xn(e,t);return n<0?null:Mn[e].puzzle.tiles[n]},getPieceDrawOffset:e=>Mn[e].puzzle.info.tileDrawOffset,getPieceDrawSize:eo,getFinalPiecePos:Yn,getStartTs:e=>Mn[e].puzzle.data.started,getFinishTs:e=>Mn[e].puzzle.data.finished,handleInput:function(e,t,n,o,l){const a=Mn[e].puzzle,i=function(e,t){return t in Mn[e].evtInfos?Mn[e].evtInfos[t]:{_last_mouse:null,_last_mouse_down:null}}(e,t),s=[],r=()=>{s.push([Bt,a.data])},d=t=>{s.push([Ot,We.encodePiece(qn(e,t))])},c=e=>{for(const t of e)d(t)},u=()=>{const n=On(e,t);n&&s.push([Nt,We.encodePlayer(n)])},g=n[0];if(g===It){const l=n[1];Ln(e,t,{bgcolor:l,ts:o}),u()}else if(g===_t){const l=n[1];Ln(e,t,{color:l,ts:o}),u()}else if(g===Et){const l=`${n[1]}`.substr(0,16);Ln(e,t,{name:l,ts:o}),u()}else if(g===kt){const l=n[1],a=n[2],i=On(e,t);if(i){const n=i.x-l,s=i.y-a;Ln(e,t,{ts:o,x:n,y:s}),u()}}else if(g===At){const l={x:n[1],y:n[2]};Ln(e,t,{d:1,ts:o}),u(),i._last_mouse_down=l;const a=((e,t)=>{const n=Mn[e].puzzle.info,o=Mn[e].puzzle.tiles;let l=-1,a=-1;for(let i=0;il)&&(l=e.z,a=i)}return a})(e,l);if(a>=0){const n=oo(e)+1;jn(e,{maxZ:n}),r();const o=co(e,a);ao(e,o,oo(e)),ro(e,o,t),c(o)}i._last_mouse=l}else if(g===Tt){const l=n[1],a=n[2],s={x:l,y:a};if(null===i._last_mouse_down)Ln(e,t,{x:l,y:a,ts:o}),u();else{const n=Xn(e,t);if(n>=0){Ln(e,t,{x:l,y:a,ts:o}),u();const r=co(e,n);let d=In.pointInBounds(s,Zn(e))&&In.pointInBounds(i._last_mouse_down,Zn(e));for(const t of r){const n=Kn(e,t);if(In.pointInBounds(s,n)){d=!0;break}}if(d){const t=l-i._last_mouse_down.x,n=a-i._last_mouse_down.y;so(e,r,{x:t,y:n}),c(r)}}else Ln(e,t,{ts:o}),u();i._last_mouse_down=s}i._last_mouse=s}else if(g===St){const s={x:n[1],y:n[2]},g=0;i._last_mouse_down=null;const p=Xn(e,t);if(p>=0){const n=co(e,p);ro(e,n,0),c(n);const i=Qn(e,p),s=Yn(e,p);if(In.pointDistance(s,i){for(const n of t)Wn(e,n,{owner:-1,z:1})})(e,n),c(n);let d=uo(e,t);$n(e)===Ce.FINAL?d+=n.length:$n(e)===Ce.ANY&&(d+=1),Ln(e,t,{d:g,ts:o,points:d}),u(),Fn(e)===Vn(e)&&(jn(e,{finished:o}),r()),l&&l(t)}else{const n=(e,t,n,o)=>{const l=Mn[e].puzzle.info;if(n<0)return!1;if(((e,t,n)=>{const o=Hn(e,t),l=Hn(e,n);return!(!o||o!==l)})(e,t,n))return!1;const a=Qn(e,t),i=In.pointAdd(Qn(e,n),{x:o[0]*l.tileSize,y:o[1]*l.tileSize});if(In.pointDistance(a,i){const o=Mn[e].puzzle.tiles,l=Hn(e,t),a=Hn(e,n);let i;const s=[];l&&s.push(l),a&&s.push(a),l?i=l:a?i=a:(jn(e,{maxGroup:no(e)+1}),r(),i=no(e));if(Wn(e,t,{group:i}),d(t),Wn(e,n,{group:i}),d(n),s.length>0)for(const r of o){const t=We.decodePiece(r);s.includes(t.group)&&(Wn(e,t.idx,{group:i}),d(t.idx))}})(e,t,n),l=co(e,t);const s=((e,t)=>{let n=0;for(const o of t){const t=Jn(e,o);t>n&&(n=t)}return n})(e,l);return ao(e,l,s),c(l),!0}return!1};let a=!1;for(const t of co(e,p)){const o=lo(e,t);if(n(e,t,o[0],[0,1])||n(e,t,o[1],[-1,0])||n(e,t,o[2],[0,-1])||n(e,t,o[3],[1,0])){a=!0;break}}if(a&&$n(e)===Ce.ANY){const n=uo(e,t)+1;Ln(e,t,{d:g,ts:o,points:n}),u()}else Ln(e,t,{d:g,ts:o}),u();a&&l&&l(t)}}else Ln(e,t,{d:g,ts:o}),u();i._last_mouse=s}else if(g===zt){const l=n[1],a=n[2];Ln(e,t,{x:l,y:a,ts:o}),u(),i._last_mouse={x:l,y:a}}else if(g===Pt){const l=n[1],a=n[2];Ln(e,t,{x:l,y:a,ts:o}),u(),i._last_mouse={x:l,y:a}}else Ln(e,t,{ts:o}),u();return function(e,t,n){Mn[e].evtInfos[t]=n}(e,t,i),s}};let mo=-10,yo=20,fo=2,wo=15;class vo{constructor(e){this.radius=10,this.previousRadius=10,this.explodingDuration=100,this.hasExploded=!1,this.alive=!0,this.color=function(e){return"rgba("+e.random(0,255)+","+e.random(0,255)+","+e.random(0,255)+", 0.8)"}(e),this.px=window.innerWidth/4+Math.random()*window.innerWidth/2,this.py=window.innerHeight,this.vx=mo+Math.random()*yo,this.vy=-1*(fo+Math.random()*wo),this.duration=0}update(e){if(this.hasExploded){const e=200-this.radius;this.previousRadius=this.radius,this.radius+=e/10,this.explodingDuration--,0==this.explodingDuration&&(this.alive=!1)}else this.vx+=0,this.vy+=1,this.vy>=0&&e&&this.explode(e),this.px+=this.vx,this.py+=this.vy}draw(e){e.beginPath(),e.arc(this.px,this.py,this.previousRadius,0,2*Math.PI,!1),this.hasExploded||(e.fillStyle=this.color,e.lineWidth=1,e.fill())}explode(e){this.hasExploded=!0;const t=3+Math.floor(3*Math.random());for(let n=0;n{this.resize()}))}setSpeedParams(){let e=0,t=0;for(;e=0;)t+=1,e+=t;fo=t/2,wo=t-fo;const n=1/4*this.canvas.width/(t/2);mo=-n,yo=2*n}resize(){this.setSpeedParams()}init(){this.readyBombs=[],this.explodedBombs=[],this.particles=[];for(let e=0;e<1;e++)this.readyBombs.push(new vo(this.rng))}update(){100*Math.random()<5&&this.readyBombs.push(new vo(this.rng));const e=[];for(;this.explodedBombs.length>0;){const t=this.explodedBombs.shift();if(!t)break;t.update(),t.alive&&e.push(t)}this.explodedBombs=e;const t=[];for(;this.readyBombs.length>0;){const e=this.readyBombs.shift();if(!e)break;e.update(this.particles),e.hasExploded?this.explodedBombs.push(e):t.push(e)}this.readyBombs=t;const n=[];for(;this.particles.length>0;){const e=this.particles.shift();if(!e)break;e.update(),e.alive&&n.push(e)}this.particles=n}render(){this.ctx.beginPath(),this.ctx.fillStyle="rgba(0, 0, 0, 0.1)",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height);for(let e=0;e{const t=e.color+" "+e.d;if(!y[t]){const n=e.d?r:d;if(e.color){const o=e.d?c:u;y[t]=await createImageBitmap(xn.colorizedCanvas(n,o,e.color))}else y[t]=n}return y[t]},w=function(e,t){return t.width=window.innerWidth,t.height=window.innerHeight,e.appendChild(t),window.addEventListener("resize",(()=>{t.width=window.innerWidth,t.height=window.innerHeight,To=!0})),t}(l,xn.createCanvas()),v={final:!1,requesting:!0,log:[],logPointer:0,speeds:[.5,1,2,5,10,20,50,100,250,500],speedIdx:1,paused:!1,lastRealTs:0,lastGameTs:0,gameStartTs:0,dataOffset:0,dataSize:1e4};Yt.onConnectionStateChange((e=>{a.setConnectionState(e)}));const b=async e=>{v.requesting=!0;const t=await Yt.requestReplayData(e,v.dataOffset,v.dataSize);return v.dataOffset+=v.dataSize,v.requesting=!1,t};let x=()=>0;const C=async()=>{if("play"===o){const o=await Yt.connect(n,e,t),l=We.decodeGame(o);ho.setGame(l.id,l),x=()=>B()}else{if("replay"!==o)throw"[ 2020-12-22 MODE invalid, must be play|replay ]";{const t=await b(e);if(!t.game)throw"[ 2021-05-29 no game received ]";const n=We.decodeGame(t.game);ho.setGame(n.id,n),v.requesting=!1,v.log=t.log,v.lastRealTs=B(),v.gameStartTs=parseInt(v.log[0][4],10),v.lastGameTs=v.gameStartTs,x=()=>v.lastGameTs}}To=!0};await C();const k=ho.getPieceDrawOffset(e),A=ho.getPieceDrawSize(e),S=ho.getPuzzleWidth(e),T=ho.getPuzzleHeight(e),z=ho.getTableWidth(e),P=ho.getTableHeight(e),I={x:(z-S)/2,y:(P-T)/2},_={w:S,h:T},E={w:A,h:A},D=await Dn.loadPuzzleBitmaps(ho.getPuzzle(e)),M=new xo(w,ho.getRng(e));M.init();const O=w.getContext("2d");w.classList.add("loaded");const N=vn();N.move(-(z-w.width)/2,-(P-w.height)/2);const U=function(e,t,n){let o=[],l=!0,a=!1,i=!1,s=!1,r=!1,d=!1,c=!1,u=!1;const g=(e,t)=>{const o=n.viewportToWorld({x:e,y:t});return[o.x,o.y]},p=e=>g(e.offsetX,e.offsetY),h=()=>g(e.width/2,e.height/2),m=(e,t)=>{l&&("Shift"===t.key?u=e:"ArrowUp"===t.key||"w"===t.key||"W"===t.key?s=e:"ArrowDown"===t.key||"s"===t.key||"S"===t.key?r=e:"ArrowLeft"===t.key||"a"===t.key||"A"===t.key?a=e:"ArrowRight"===t.key||"d"===t.key||"D"===t.key?i=e:"q"===t.key?c=e:"e"===t.key&&(d=e))};let y=null;e.addEventListener("mousedown",(e=>{y=p(e),0===e.button&&f([At,...y])})),e.addEventListener("mouseup",(e=>{y=p(e),0===e.button&&f([St,...y])})),e.addEventListener("mousemove",(e=>{y=p(e),f([Tt,...y])})),e.addEventListener("wheel",(e=>{if(y=p(e),n.canZoom(e.deltaY<0?"in":"out")){const t=e.deltaY<0?zt:Pt;f([t,...y])}})),t.addEventListener("keydown",(e=>m(!0,e))),t.addEventListener("keyup",(e=>m(!1,e))),t.addEventListener("keypress",(e=>{l&&(" "===e.key&&f([Dt]),"F"!==e.key&&"f"!==e.key||(Ao=!Ao,To=!0),"G"!==e.key&&"g"!==e.key||(So=!So,To=!0),"M"!==e.key&&"m"!==e.key||f([Mt]))}));const f=e=>{o.push(e)};return{addEvent:f,consumeAll:()=>{if(0===o.length)return[];const e=o.slice();return o=[],e},createKeyEvents:()=>{const e=(a?1:0)-(i?1:0),t=(s?1:0)-(r?1:0);if(0!==e||0!==t){const o=(u?24:12)*Math.sqrt(n.getCurrentZoom()),l=n.viewportDimToWorld({w:e*o,h:t*o});f([kt,l.w,l.h]),y&&(y[0]-=l.w,y[1]-=l.h)}if(d&&c);else if(d){if(n.canZoom("in")){const e=y||h();f([zt,...e])}}else if(c&&n.canZoom("out")){const e=y||h();f([Pt,...e])}},setHotkeys:e=>{l=e}}}(w,window,N),G=ho.getImageUrl(e),V=()=>{const t=ho.getStartTs(e),n=ho.getFinishTs(e),o=x();a.setFinished(!!n),a.setDuration((n||o)-t)};V(),a.setPiecesDone(ho.getFinishedPiecesCount(e)),a.setPiecesTotal(ho.getPieceCount(e));const $=x();a.setActivePlayers(ho.getActivePlayers(e,$)),a.setIdlePlayers(ho.getIdlePlayers(e,$));const R=!!ho.getFinishTs(e);let F=R;const L=()=>F&&!R,j=()=>{const e=localStorage.getItem("sound_enabled");return null!==e&&"1"===e},W=()=>ho.getPlayerBgColor(e,t)||localStorage.getItem("bg_color")||"#222222",q=()=>ho.getPlayerColor(e,t)||localStorage.getItem("player_color")||"#ffffff";let H="",Y="",Q=!1;const Z=e=>{Q=e;const[t,n]=e?[H,"grab"]:[Y,"default"];w.style.cursor=`url('${t}') ${p} ${m}, ${n}`},K=e=>{H=xn.colorizedCanvas(r,c,e).toDataURL(),Y=xn.colorizedCanvas(d,u,e).toDataURL(),Z(Q)};K(q());const J=()=>{a.setReplaySpeed&&a.setReplaySpeed(v.speeds[v.speedIdx]),a.setReplayPaused&&a.setReplayPaused(v.paused)};if("play"===o?setInterval(V,1e3):"replay"===o&&J(),"play"===o)Yt.onServerChange((n=>{n[0],n[1],n[2];const o=n[3];for(const[l,a]of o)switch(l){case Nt:{const n=We.decodePlayer(a);n.id!==t&&(ho.setPlayer(e,n.id,n),To=!0)}break;case Ot:{const t=We.decodePiece(a);ho.setPiece(e,t.idx,t),To=!0}break;case Bt:ho.setPuzzleData(e,a),To=!0}F=!!ho.getFinishTs(e)}));else if("replay"===o){const t=setInterval((()=>{const n=B();if(v.requesting)return void(v.lastRealTs=n);if(v.logPointer+1>=v.log.length)return v.lastRealTs=n,void(async e=>{const t=await b(e);v.log=v.log.slice(v.logPointer),v.logPointer=0,v.log.push(...t.log),t.log.length=v.log.length){v.final&&clearInterval(t);break}const o=v.log[n],a=v.gameStartTs+o[o.length-1];if(a>l)break;const i=o.slice();if(i[0]===bt){const t=i[1];ho.addPlayer(e,t,a),To=!0}else if(i[0]===xt){const t=ho.getPlayerIdByIndex(e,i[1]);if(!t)throw"[ 2021-05-17 player not found (update player) ]";ho.addPlayer(e,t,a),To=!0}else if(i[0]===Ct){const t=ho.getPlayerIdByIndex(e,i[1]);if(!t)throw"[ 2021-05-17 player not found (handle input) ]";const n=i[2];ho.handleInput(e,t,n,a),To=!0}v.logPointer=n}v.lastRealTs=n,v.lastGameTs=l,V()}),50)}let X=null;return(e=>{const t=e.fps||60,n=e.slow||1,o=e.update,l=e.render,a=window.requestAnimationFrame,i=1/t,s=n*i;let r,d=0,c=window.performance.now();const u=()=>{for(r=window.performance.now(),d+=Math.min(1,(r-c)/1e3);d>s;)d-=s,o(i);l(d/n),c=r,a(u)};a(u)})({update:()=>{U.createKeyEvents();for(const n of U.consumeAll())if("play"===o){const o=n[0];if(o===kt){const e=n[1],t=n[2],o=N.worldDimToViewport({w:e,h:t});To=!0,N.move(o.w,o.h)}else if(o===Tt){if(X&&!ho.getFirstOwnedPiece(e,t)){const e={x:n[1],y:n[2]},t=N.worldToViewport(e),o=Math.round(t.x-X.x),l=Math.round(t.y-X.y);To=!0,N.move(o,l),X=t}}else if(o===_t)K(n[1]);else if(o===At){const e={x:n[1],y:n[2]};X=N.worldToViewport(e),Z(!0)}else if(o===St)X=null,Z(!1);else if(o===zt){const e={x:n[1],y:n[2]};To=!0,N.zoom("in",N.worldToViewport(e))}else if(o===Pt){const e={x:n[1],y:n[2]};To=!0,N.zoom("out",N.worldToViewport(e))}else o===Dt?a.togglePreview():o===Mt&&a.toggleSoundsEnabled();const l=x();ho.handleInput(e,t,n,l,(e=>{j()&&s.play()})).length>0&&(To=!0),Yt.sendClientEvent(n)}else if("replay"===o){const e=n[0];if(e===kt){const e=n[1],t=n[2];To=!0,N.move(e,t)}else if(e===Tt){if(X){const e={x:n[1],y:n[2]},t=N.worldToViewport(e),o=Math.round(t.x-X.x),l=Math.round(t.y-X.y);To=!0,N.move(o,l),X=t}}else if(e===At){const e={x:n[1],y:n[2]};X=N.worldToViewport(e)}else if(e===St)X=null;else if(e===zt){const e={x:n[1],y:n[2]};To=!0,N.zoom("in",N.worldToViewport(e))}else if(e===Pt){const e={x:n[1],y:n[2]};To=!0,N.zoom("out",N.worldToViewport(e))}else e===Dt&&a.togglePreview()}F=!!ho.getFinishTs(e),L()&&(M.update(),To=!0)},render:async()=>{if(!To)return;const n=x();let l,i,s;window.DEBUG&&Sn(0),O.fillStyle=W(),O.fillRect(0,0,w.width,w.height),window.DEBUG&&Tn("clear done"),l=N.worldToViewportRaw(I),i=N.worldDimToViewportRaw(_),O.fillStyle="rgba(255, 255, 255, .3)",O.fillRect(l.x,l.y,i.w,i.h),window.DEBUG&&Tn("board done");const r=ho.getPiecesSortedByZIndex(e);window.DEBUG&&Tn("get tiles done"),i=N.worldDimToViewportRaw(E);for(const e of r)(-1===e.owner?Ao:So)&&(s=D[e.idx],l=N.worldToViewportRaw({x:k+e.pos.x,y:k+e.pos.y}),O.drawImage(s,0,0,s.width,s.height,l.x,l.y,i.w,i.h));window.DEBUG&&Tn("tiles done");const d=[];for(const a of ho.getActivePlayers(e,n))c=a,("replay"===o||c.id!==t)&&(s=await f(a),l=N.worldToViewport(a),O.drawImage(s,l.x-p,l.y-m),d.push([`${a.name} (${a.points})`,l.x,l.y+h]));var c;O.fillStyle="white",O.textAlign="center";for(const[e,t,o]of d)O.fillText(e,t,o);window.DEBUG&&Tn("players done"),a.setActivePlayers(ho.getActivePlayers(e,n)),a.setIdlePlayers(ho.getIdlePlayers(e,n)),a.setPiecesDone(ho.getFinishedPiecesCount(e)),window.DEBUG&&Tn("HUD done"),L()&&M.render(),To=!1}}),{setHotkeys:e=>{U.setHotkeys(e)},onBgChange:e=>{localStorage.setItem("bg_color",e),U.addEvent([It,e])},onColorChange:e=>{localStorage.setItem("player_color",e),U.addEvent([_t,e])},onNameChange:e=>{localStorage.setItem("player_name",e),U.addEvent([Et,e])},onSoundsEnabledChange:e=>{localStorage.setItem("sound_enabled",e?"1":"0")},replayOnSpeedUp:()=>{v.speedIdx+1{v.speedIdx>=1&&(v.speedIdx--,J())},replayOnPauseToggle:()=>{v.paused=!v.paused,J()},previewImageUrl:G,player:{background:W(),color:q(),name:ho.getPlayerName(e,t)||localStorage.getItem("player_name")||"anon",soundsEnabled:j()},disconnect:Yt.disconnect,connect:C}}var Po=e({name:"game",components:{PuzzleStatus:st,Scores:nt,SettingsOverlay:dt,PreviewOverlay:ht,ConnectionOverlay:Qt,HelpOverlay:tn},data:()=>({activePlayers:[],idlePlayers:[],finished:!1,duration:0,piecesDone:0,piecesTotal:0,overlay:"",connectionState:0,g:{player:{background:"",color:"",name:"",soundsEnabled:!1},previewImageUrl:"",setHotkeys:e=>{},onBgChange:e=>{},onColorChange:e=>{},onNameChange:e=>{},onSoundsEnabledChange:e=>{},disconnect:()=>{},connect:()=>{}}}),async mounted(){this.$route.params.id&&(this.$watch((()=>this.g.player.background),(e=>{this.g.onBgChange(e)})),this.$watch((()=>this.g.player.color),(e=>{this.g.onColorChange(e)})),this.$watch((()=>this.g.player.name),(e=>{this.g.onNameChange(e)})),this.$watch((()=>this.g.player.soundsEnabled),(e=>{this.g.onSoundsEnabledChange(e)})),this.g=await zo(`${this.$route.params.id}`,this.$clientId,this.$config.WS_ADDRESS,"play",this.$el,{setActivePlayers:e=>{this.activePlayers=e},setIdlePlayers:e=>{this.idlePlayers=e},setFinished:e=>{this.finished=e},setDuration:e=>{this.duration=e},setPiecesDone:e=>{this.piecesDone=e},setPiecesTotal:e=>{this.piecesTotal=e},setConnectionState:e=>{this.connectionState=e},togglePreview:()=>{this.toggle("preview",!1)},toggleSoundsEnabled:()=>{this.g.player.soundsEnabled=!this.g.player.soundsEnabled}}))},unmounted(){this.g.disconnect()},methods:{reconnect(){this.g.connect()},toggle(e,t){""===this.overlay?(this.overlay=e,t&&this.g.setHotkeys(!1)):(this.overlay="",t&&this.g.setHotkeys(!0))}}});const Io={id:"game"},_o={class:"menu"},Eo={class:"tabs"},Do=s("🧩 Puzzles");Po.render=function(e,l,s,r,d,c){const u=a("settings-overlay"),p=a("preview-overlay"),h=a("help-overlay"),m=a("connection-overlay"),y=a("puzzle-status"),f=a("router-link"),w=a("scores");return i(),t("div",Io,[g(n(u,{onBgclick:l[1]||(l[1]=t=>e.toggle("settings",!0)),modelValue:e.g.player,"onUpdate:modelValue":l[2]||(l[2]=t=>e.g.player=t)},null,8,["modelValue"]),[[C,"settings"===e.overlay]]),g(n(p,{onBgclick:l[3]||(l[3]=t=>e.toggle("preview",!1)),img:e.g.previewImageUrl},null,8,["img"]),[[C,"preview"===e.overlay]]),g(n(h,{onBgclick:l[4]||(l[4]=t=>e.toggle("help",!0))},null,512),[[C,"help"===e.overlay]]),n(m,{connectionState:e.connectionState,onReconnect:e.reconnect},null,8,["connectionState","onReconnect"]),n(y,{finished:e.finished,duration:e.duration,piecesDone:e.piecesDone,piecesTotal:e.piecesTotal},null,8,["finished","duration","piecesDone","piecesTotal"]),n("div",_o,[n("div",Eo,[n(f,{class:"opener",to:{name:"index"},target:"_blank"},{default:o((()=>[Do])),_:1}),n("div",{class:"opener",onClick:l[5]||(l[5]=t=>e.toggle("preview",!1))},"πŸ–ΌοΈ Preview"),n("div",{class:"opener",onClick:l[6]||(l[6]=t=>e.toggle("settings",!0))},"πŸ› οΈ Settings"),n("div",{class:"opener",onClick:l[7]||(l[7]=t=>e.toggle("help",!0))},"ℹ️ Help")])]),n(w,{activePlayers:e.activePlayers,idlePlayers:e.idlePlayers},null,8,["activePlayers","idlePlayers"])])};var Mo=e({name:"replay",components:{PuzzleStatus:st,Scores:nt,SettingsOverlay:dt,PreviewOverlay:ht,HelpOverlay:tn},data:()=>({activePlayers:[],idlePlayers:[],finished:!1,duration:0,piecesDone:0,piecesTotal:0,overlay:"",connectionState:0,g:{player:{background:"",color:"",name:"",soundsEnabled:!1},previewImageUrl:"",setHotkeys:e=>{},onBgChange:e=>{},onColorChange:e=>{},onNameChange:e=>{},onSoundsEnabledChange:e=>{},replayOnSpeedUp:()=>{},replayOnSpeedDown:()=>{},replayOnPauseToggle:()=>{},disconnect:()=>{}},replay:{speed:1,paused:!1}}),async mounted(){this.$route.params.id&&(this.$watch((()=>this.g.player.background),(e=>{this.g.onBgChange(e)})),this.$watch((()=>this.g.player.color),(e=>{this.g.onColorChange(e)})),this.$watch((()=>this.g.player.name),(e=>{this.g.onNameChange(e)})),this.$watch((()=>this.g.player.soundsEnabled),(e=>{this.g.onSoundsEnabledChange(e)})),this.g=await zo(`${this.$route.params.id}`,this.$clientId,this.$config.WS_ADDRESS,"replay",this.$el,{setActivePlayers:e=>{this.activePlayers=e},setIdlePlayers:e=>{this.idlePlayers=e},setFinished:e=>{this.finished=e},setDuration:e=>{this.duration=e},setPiecesDone:e=>{this.piecesDone=e},setPiecesTotal:e=>{this.piecesTotal=e},togglePreview:()=>{this.toggle("preview",!1)},setConnectionState:e=>{this.connectionState=e},setReplaySpeed:e=>{this.replay.speed=e},setReplayPaused:e=>{this.replay.paused=e},toggleSoundsEnabled:()=>{this.g.player.soundsEnabled=!this.g.player.soundsEnabled}}))},unmounted(){this.g.disconnect()},methods:{toggle(e,t){""===this.overlay?(this.overlay=e,t&&this.g.setHotkeys(!1)):(this.overlay="",t&&this.g.setHotkeys(!0))}},computed:{replayText(){return"Replay-Speed: "+this.replay.speed+"x"+(this.replay.paused?" Paused":"")}}});const Bo={id:"replay"},Oo={class:"menu"},No={class:"tabs"},Uo=s("🧩 Puzzles");Mo.render=function(e,l,s,d,c,u){const p=a("settings-overlay"),h=a("preview-overlay"),m=a("help-overlay"),y=a("puzzle-status"),f=a("router-link"),w=a("scores");return i(),t("div",Bo,[g(n(p,{onBgclick:l[1]||(l[1]=t=>e.toggle("settings",!0)),modelValue:e.g.player,"onUpdate:modelValue":l[2]||(l[2]=t=>e.g.player=t)},null,8,["modelValue"]),[[C,"settings"===e.overlay]]),g(n(h,{onBgclick:l[3]||(l[3]=t=>e.toggle("preview",!1)),img:e.g.previewImageUrl},null,8,["img"]),[[C,"preview"===e.overlay]]),g(n(m,{onBgclick:l[4]||(l[4]=t=>e.toggle("help",!0))},null,512),[[C,"help"===e.overlay]]),n(y,{finished:e.finished,duration:e.duration,piecesDone:e.piecesDone,piecesTotal:e.piecesTotal},{default:o((()=>[n("div",null,[n("div",null,r(e.replayText),1),n("button",{class:"btn",onClick:l[5]||(l[5]=t=>e.g.replayOnSpeedUp())},"⏫"),n("button",{class:"btn",onClick:l[6]||(l[6]=t=>e.g.replayOnSpeedDown())},"⏬"),n("button",{class:"btn",onClick:l[7]||(l[7]=t=>e.g.replayOnPauseToggle())},"⏸️")])])),_:1},8,["finished","duration","piecesDone","piecesTotal"]),n("div",Oo,[n("div",No,[n(f,{class:"opener",to:{name:"index"},target:"_blank"},{default:o((()=>[Uo])),_:1}),n("div",{class:"opener",onClick:l[8]||(l[8]=t=>e.toggle("preview",!1))},"πŸ–ΌοΈ Preview"),n("div",{class:"opener",onClick:l[9]||(l[9]=t=>e.toggle("settings",!0))},"πŸ› οΈ Settings"),n("div",{class:"opener",onClick:l[10]||(l[10]=t=>e.toggle("help",!0))},"ℹ️ Help")])]),n(w,{activePlayers:e.activePlayers,idlePlayers:e.idlePlayers},null,8,["activePlayers","idlePlayers"])])},(async()=>{const e=await fetch("/api/conf"),t=await e.json();const n=k({history:A(),routes:[{name:"index",path:"/",component:L},{name:"new-game",path:"/new-game",component:qe},{name:"game",path:"/g/:id",component:Po},{name:"replay",path:"/replay/:id",component:Mo}]});n.beforeEach(((e,t)=>{t.name&&document.documentElement.classList.remove(`view-${String(t.name)}`),document.documentElement.classList.add(`view-${String(e.name)}`)}));const o=S(T);o.config.globalProperties.$config=t,o.config.globalProperties.$clientId=function(){let e=localStorage.getItem("ID");return e||(e=We.uniqId(),localStorage.setItem("ID",e)),e}(),o.use(n),o.mount("#app")})(); diff --git a/build/public/index.html b/build/public/index.html index 13893b5..1e3ba43 100644 --- a/build/public/index.html +++ b/build/public/index.html @@ -4,7 +4,7 @@ 🧩 jigsaw.hyottoko.club - + diff --git a/src/frontend/click.mp3 b/src/frontend/click.mp3 index af958b7f947a40692fd0f3f03a0f84708936ed06..54f953699f27afc0421f7645dd5adf9375fbd263 100644 GIT binary patch literal 7254 zcmds+Wl&sCm&ONoGB6MV!7W(O0YV@IcY@6jAVAQ;gF}D>27*g)cV}=-kl+wpf;$8a z9$bf6@^1e7^{uVit=igO-CNh5>OS}M>Av0PqHdzh0RILZt9KUnk_Y!YApk(F4WRgo z_+JeE;_(mRf64kw%|G<~W$7=+|8V;k)L-uFQdf~wl@;LTV2G=o^zOAX0?>{_QO> zE#61{@q%X?K;r#-Z#bF`fJRyFU+&D*b;OXcLvB|s|G7M4P^uwFF;swi0A)R6zU|y=WuFCwTdQY z*)MAQbu+UPK@&dA4W@1B(;N)I`tr6%aM}29p)=}EOB(2oeD9r+OnXcnD(ib5khw#u zEjcFjC`1`3^UFmz`&b2u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