${r.D}m`:s.innerHTML=`You ran
${r.D}m`,B(s),h.d=r.d,n.finish(()=>{h.l.push(f-r.lT),h.l.push(Qt),h.n=new Date(r.sT).toLocaleDateString(),h.d=r.D,Nt(t.story.id)(h)})},n.isInSkill()?jt+1e3:1e3))}else n.rE(),ce(n.E,!0),pe(q(".cursor"),r),h.l.push(f-r.lT),h.l.push(Kt);r.lT=f},Q(rt,e.keyPressHandler),e.keyDownHandler=t=>"Escape"===t.key&&R("title"),Q(at,e.keyDownHandler);let c=e.O.context;e.L=_({update:function(){n.dec(),n.update(),r.iS&&o.forEach(t=>{t.dec(),t.update()}),r.D=(n.x/200).toFixed(2),ne(r.D),ue(n.x),ct(e,n.isInSkill()?3:1),gt(e)},render:function(){c.save(),c.globalAlpha=.4,o.forEach(t=>t.render(n)),c.restore(),n.render(),ut(e),yt(e)}}),e.L.start()}unmount(){let t=this;t.L&&(t.L.stop(),t.L=null),V(rt,t.keyPressHandler),V(at,t.keyDownHandler),mt(t),$(q("#d-t")),$(q("#d-d")),$(q("#d-e")),$(q("#d-l")),$(q("#d-pm")),$(q("#d-r")),$(q("#d-gm"))}showSkillEffect(){let t=q(".wind"),e=t.parentNode;for(let i=0;i<15;i++)(()=>{Y(()=>{let i=t.cloneNode(),s=960*Z(),n=300*Z()+30,r=.4*Z()+.2;e.appendChild(i),i.style.left=s+"px",i.style.top=n+"px",i.style.opacity=r,(t=>{Y(()=>{it(t,"m")},100),Y(()=>{e.removeChild(i)},1e3)})(i)},200*i)})()}}function ne(t){ie.D.innerHTML=t+"m"}let re=t=>t.replace(/(\r\n|\n|\r)/gm," ").replace(/\s+/g," ").split(" ");function ae(t,e,i){let s=oe(t.L.sCI+t.L.P.length-1,e,i);he(s.P);let n=oe(-1,e,s.lWI+1);return le(n.P),s}function oe(t,e,i){let s=i,n="";for(let r=i;ree)return{P:nt(n+" "),sCI:t+1,lWI:s};n=i,s=r}return{P:nt(n),sCI:t+1,lWI:s}}let he=t=>ie.text.innerHTML=t,le=t=>ie.subText.innerHTML=t;function de(t,e){let{P:i,sCI:s}=t,n=e-s,r=i.slice(0,n),a=i.slice(n+1),o=i.charAt(n);return he(''+r+''+o+""+a),e}function ce(t,e=!1){let i=ie.bar;if(e){let t=i.cloneNode(),e=i.parentNode;t.removeAttribute("id"),e.appendChild(t),it(t,"e"),J(()=>{it(t,"d")}),Y(()=>{e.removeChild(t)},1e3)}let s=ie.frame.offsetWidth-2,n=et(t*(s/100),s);i.style.width=n+"px"}function ue(t){ie.ground.style.backgroundPositionX=-t%960+"px"}function me(t){t.forEach(t=>{let e=t.O.logs.l,i=0;for(let s=0;s{Y(()=>{switch(s){case Gt:t.incE(),t.acc();break;case Kt:t.rE()}},i)})(0,e[s+1]);t.showLabel()})}function pe(t,e){e.cT&&(X(e.cT),st(t,ot)),J(()=>{J(()=>{it(t,ot),e.cT=Y(()=>{st(t,ot)},500)})})}function fe(t){let e=t.offsetLeft,i=U("span");it(i,"e","p"),i.innerHTML="+1",i.style.left=e-23+"px",ie.tC.appendChild(i),Y(()=>{ie.tC.removeChild(i)},1e3)}var ge=se;let ye=0;class xe extends F{constructor(t){super("story",t)}mount(){let t=this;B(q("#d-sp")),B(q("#d-gm"));let e=q("#sl");e.innerHTML="",Dt.forEach((t,i)=>{let s=we(t,i);e.appendChild(s)}),t.keyHandler=be({ArrowUp:()=>{--ye<0&&(ye=Dt.length-1),t.updateStoryList()},ArrowDown:()=>{++ye>=Dt.length&&(ye=0),t.updateStoryList()},Enter:()=>t.selectStory(),Escape:()=>R("title")}),Q(at,t.keyHandler)}updateStoryList(){q("#sl").childNodes.forEach((t,e)=>{e===ye?it(t,"s"):st(t,"s")})}selectStory(){R("game",{story:Dt[ye]})}unmount(){$(q("#d-sp")),$(q("#d-gm")),V(at,this.keyHandler)}}let we=(t,e)=>{let i=U("li");return it(i,"story"),i.innerHTML=`${e+1}. ${t.title}`,0===e&&it(i,"s"),i},be=t=>e=>{t[e.key]&&t[e.key]()};var ve=xe;i(0),Q("DOMContentLoaded",()=>{let{context:t}=w();f("images"),Promise.all([g("m.png"),g("c.png"),g("d.png")]).then(()=>{z("title",new Tt({context:t})),z("story",new ve),z("game",new ge({context:t})),R("title")})})}]);