\n\n\n`,(r=a).addEventListener("mousedown",e=>re(r,e,"mouse")),r.addEventListener("touchstart",e=>re(r,e,"touch")),a}function re(e,t,a){Q=d("#cardList .card:last-child");var r=t.pageX||t.touches[0].pageX;let n=e=>{var t=e.pageX||e.touches[0].pageX;K=t-r,H&&(T.classList.remove("-demo"),K=Math[1===H?"max":"min"](0,K)),K&&function(){ee=K/10,Q.style.transform=`translateX(${K}px) rotate(${ee}deg)`;var e=K/100;Q.querySelector(".-reject").style.opacity=e>=0?0:Math.abs(e),Q.querySelector(".-accept").style.opacity=e<=0?0:e}()},l=e=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",l),K&&le()},i=e=>{document.removeEventListener("touchmove",n),document.removeEventListener("touchend",i),K&&le()};document.addEventListener(`${a}move`,n),"mouse"===a?document.addEventListener("mouseup",l):document.addEventListener("touchend",i)}function ne(e){B||(Q=d("#cardList .card:last-child"))&&(B=!0,Q.classList.add(e>0?"to-right":"to-left"),Q.classList.add("inactive"),clearTimeout(k),clearTimeout(w),function(e,t){if(e>0&&t.error||e<0&&!t.error){O(G),Z=0,L=1;let e=t.error?m()>.5?`🤨️ ${t.error.m}, really?`:`☠️️ Have you ever seen ${t.error.m}?`:"🤨️ why did you reject him?";e=e+=`
${oe({...t,...t.error})}
`,F.innerHTML=e,F.classList.remove("-shown"),F.offsetWidth,F.classList.add("-shown"),k=setTimeout(()=>{F.classList.remove("-shown")},5e3),V.classList.remove("-success")}else O(Y),A+=L,++Z,function(){let e=`${g(["🤘","🚀","🔥"])} Combo x${Z}! `;if(Z%3==0){let t=Math.min(Z/3,5);E+=1e3*t,e+=` +${t}s`}Z%5==0&&(e+=` score x${++L}`);Z>1&&(V.innerHTML=e,V.classList.remove("-success"),V.offsetWidth,V.classList.add("-success"),w=setTimeout(()=>{V.classList.remove("-success")},2e3))}(),F.classList.remove("-shown");var a;A=Math.max(0,A),ce()}(e,x[D-4]),setTimeout(()=>{Q.remove(),B=!1,1===H?(T.dataset.tutorial=3,T.classList.add("-demo"),++H):2===H&&setTimeout(()=>{s("t1").removeChild(s("t1").firstChild),s("helpButton").classList.add("-active","-blink"),T.dataset.tutorial=1},500),ie()},300))}function le(){Math.abs(K)>=te?ne(K>=te?1:-1):Q.classList.add("reset"),setTimeout(()=>{Q.setAttribute("style",""),Q.classList.remove("reset"),Q.querySelector(".-reject").style.opacity=0,Q.querySelector(".-accept").style.opacity=0,K=0},300)}function ie(){x.push(function(){let t=H&&1===D,s=t?e[3]:g(e),d={race:s.name,name:J(s.name),deathCause:g(c),height:p(10*s.minHeight,10*s.maxHeight)/10,weight:p(s.minWeight,s.maxWeight),age:p(s.minAge,s.maxAge)};Object.keys(o).forEach(e=>{let t=M(0,o[e].length-1);d[e]=o[e][t],d[e+"Col"]=n[e][M(0,n[e].length-1)]}),"orc"==d.race&&(d.faceCol=g(l));"elf"==d.race&&(d.faceCol=g(i),d.ear=a);"orc"==d.race&&(d.mouth=r);d.age15;if(m()<.35){var d=["elf","orc"].indexOf(t.race)>=0?e[M(0,1)]:e[M(2,3)];t.error={race:d.name,m:`a ${c} looking like ${d.name}`}}"dwarf"==c&&m()<.25&&(r={height:p(1.8,2.4),m:"a Dwarf taller than 1.5m"});if("elf"==c)m()<.25?r={height:p(1,1.4),m:"an Elf smaller than 1.9m"}:m()<.25&&(r={ear:g(o.ear),m:"an Elf without pointy ears"}),s&&m()<.2&&(r={weight:p(100,120),m:"an Elf weigh more than 100kg"});else if("orc"!=c&&m()<.25&&(r={ear:a,m:`a ${c} with pointy ears`}),s&&"orc"==c&&m()<.2&&(r={weight:p(50,70),m:"an Orc weigh less than 80kg"}),s&&"human"==c&&m()<.25&&(r={age:M(160,230),m:`a ${c} older than 150 years`}),s&&m()<.2){let e=g(["orc","elf"].indexOf(c)>=0?n.face:l.concat(i));r={faceCol:e,earCol:e,m:`a ${c} with this skin color`}}if(s&&m()<.2){let e=["orc","elf","human","dwarf"];e.splice(e.indexOf(c),1);let t=J(g(e));r={name:t,m:`a ${c} named ${t}`}}if(m<.6&&t.wrinkles.length&&(t.deathCause="old Age",s&&m<.5)){let e="elf"==c?120:55,t=M(40,e);r={age:t,m:`a ${c} dying from old age at ${t}`}}t.error=r}(d);return d.earCol=d.faceCol,d.eyebrowCol=d.hairCol,d.beardCol=d.hairCol,d}());let t=ae(x[D++]);W.insertBefore(t,W.firstChild)}function oe(e){let t=`\n ${y(326,305,[{d:"M116.7 214.8a61.7 61.7 0 0 1 46-19.3c18.8 0 35.4 7.6 46 19.3a40.3 40.3 0 0 1 34.6 39.7V305H82v-50.5a40.3 40.3 0 0 1 34.7-39.7Z",fill:`#${e.clothesCol}`}])}`;return Object.keys(o).forEach(a=>{for(var r in e[a]){let n={fill:"mouth"==a?"transparent":r<1||"eye"==a?`#${e[a+"Col"]}`:"rgba(0, 0 ,0, 0.1)"};e[a][r]&&(e[a][r].startsWith("M")?n.d=e[a][r]:n=Object.assign(n,JSON.parse(e[a][r])),t+=y(326,305,[n]))}}),t}function ce(){_.innerHTML=A,_.classList.remove("-success"),_.offsetWidth,_.classList.add("-success")}function se(){!function e(){$=10;let t=E/1e3;setTimeout(()=>{if(E>9999)var a=("0"+~~(t/60)).slice(-2)+":"+("0"+~~t%60).slice(-2);else var a=("0"+t.toFixed(2).replace(".",":")).slice(-5);s("time").textContent=a,(E-=$)<0?function(){let e=f("bestScore")||0;A>e&&v("bestScore",A);s("endscore").innerHTML=A,C.stop();let t=he();A<10&&(t.eye=o.eye[3]);A<15&&(t.eyebrow=o.eyebrow[3]);A<42&&(t.mouth=o.mouth[1]);A<25&&(t.mouth=o.mouth[2]);d("#end .card__image").innerHTML=oe(t),T.dataset.screen=3}():e()},10)}()}function de(){++H,T.dataset.screen=1,T.dataset.tutorial=1,s("tutorial1Button").addEventListener("click",ue),s("tutorialEndButton").addEventListener("click",me);let e=he();h("#t1 .card__image").forEach((t,a)=>{a>1&&(e.mouth=o.mouth[1]),4==a&&(e.eye=o.eye[3],e.mouth=o.mouth[2],e.eyebrow=o.eyebrow[3]),t.innerHTML=oe(e)}),[...h(".next")].forEach(e=>e.addEventListener("click",e=>{s("t1").removeChild(s("t1").firstChild)}))}function he(){return{face:o.face[2],faceCol:"ce3033",hair:o.hair[2],hairCol:"3a2e34",eye:o.eye[0],eyeCol:"fbbc0e",eyebrow:o.eyebrow[1],eyebrowCol:"3a2e34",mouth:o.mouth[4],ear:a,earCol:"ce3033",clothesCol:"3a2e34"}}function ue(){T.dataset.tutorial=2,T.classList.add("-demo"),ie(),ie(),ie(),ie()}function me(){delete T.dataset.tutorial,H=0,v("tutoWatched",!0),s("tutorial-repeat").style.display="block",ge()}function fe(){!S&&z&&((C=O(...U)).loop=!0)}function ve(){z=!0,fe(),f("tutoWatched")?ge():de()}function ge(){T.dataset.screen=2,x=[],W.innerHTML="",D=0,A=0,Z=0,L=1,E=6e4,ce(),ie(),ie(),ie(),ie(),se()}document.addEventListener("keydown",e=>{"ArrowLeft"==e.key&&1!==H?(H&&(T.classList.remove("-demo"),T.offsetWidth),ne(-1)):"ArrowRight"==e.key&&2!==H&&(H&&(T.classList.remove("-demo"),T.offsetWidth),ne(1))}),[...h(".sB")].forEach(e=>{e.addEventListener("click",ve)}),s("tutorial-repeat").addEventListener("click",de),s("helpClose").addEventListener("click",()=>{s("help").classList.remove("-active")}),s("helpButton").addEventListener("click",()=>{s("helpButton").classList.remove("-blink"),s("help").classList.add("-active")}),s("soundButton").addEventListener("click",()=>{S=!S,s("soundButton").innerHTML=S?"🔇":"🔊",S?C&&C.stop():fe()}),function(){let e="";[{t:130,l:30},{t:108,l:36},{t:164,l:41},{t:116,l:59},{t:92,l:53},{t:132,l:57}].forEach((t,a)=>{e+=y(122,78,[{d:"M107 48.4h-.5v-4.5c0-8-6.5-14.4-14.4-14.4-3 0-5.9.9-8.2 2.5.5-1.9.7-3.9.7-6C84.6 12 73.2.6 59.2.6S33.8 12 33.8 26c0 .7 0 1.3.1 2-2.7-1-5.5-1.5-8.5-1.5C11.4 26.5 0 37.8 0 51.9c0 14 11.4 25.4 25.4 25.4H107c8 0 14.4-6.5 14.4-14.4 0-8.1-6.5-14.5-14.4-14.5z"}],{style:`top: ${t.t}px; left: ${t.l}%; animation-delay: -${4*a}s; animation-duration: ${a%3*2+6}s;`})}),s("clouds").innerHTML=e}();let Me=f("bestScore");Me&&(s("bestScore").innerHTML=`Best score: ${Me}`),f("tutoWatched")?s("helpButton").classList.add("-active"):s("tutorial-repeat").style.display="none"}();