1window.JSBUILD='2026-10-01 12:00';Promise.withResolvers??=function(){let a,b;return{promise:new Promise((x,y)=>{a=x,b=y}),resolve:a,reject:b}}; 2import{a as l}from"../chunk-RILSDENA.js";import"../chunk-KX5PMGKD.js";import"../chunk-3CICPQC6.js";import"../chunk-FRXRO6T3.js";import"../chunk-H6CIB4SK.js";import"../chunk-I2ZKOIO3.js";import"../chunk-E4ARHDNQ.js";import{a as o}from"../chunk-KCTW6FPD.js";cssInject("protocol");var h=class{static{o(this,"Gameplay")}#t;#e;#s;#r;#i;#n;#a;#o;constructor(t){this.#t=[],this.#e=-1,this.#s=0,this.#r=0,this.game=t,this.opPanel=html(`<div class='oppanel display_none flexline center' style='padding: 0.3em 0'> 3 <span class='emoji rem2 control' data-action='playpause' title='Play/pause (Space)'>â¶ï¸ï¸ï¸</span> 4 <input type='range' class='display_none visible' min=0 max=1 value=100 class='rem1 control'>ï¸</input> 5 <span class='fade sheet hideempty control' style='padding: 0.1em 0.5em; font-size: 1.3rem' data-action='backward' title='Move backward (Arrow left)'>â</span> 6 <span class='sheet fadeempty' style='min-width: 3em; text-align: center; padding: 0.1em 0.5em' data-action='framename'>ï¸</span> 7 <span class='fade sheet hideempty control' style='padding: 0.1em 0.5em; font-size: 1.3rem' data-action='forward' title='Move forward (Arrow right)'>â</span> 8 </div>`,t.controlZone,this.click.bind(this)),this.opSlider=this.opPanel.$('input[type="range"]'),this.opSlider.oninput=this.sliderClick.bind(this),this.playpause=this.opPanel.$('[data-action="playpause"]'),this.frameName=this.opPanel.$('[data-action="framename"]'),this.forward=this.opPanel.$('[data-action="forward"]'),this.backward=this.opPanel.$('[data-action="backward"]'),this.log=html("<div class='fade protocol lightborder' style='overflow: auto; display: grid; grid-template-columns: 1fr 2fr 2fr; align-content: start'></div>"),this.log.addEventListener("click",this.logClick.bind(this)),addEventListener("keydown",this.keyDown.bind(this)),this.#r=this.#s=0,this.game.installLittle("log",{holder:this.log,icon:construct(".control.grayhover.invertdark.protocol_icon @{Protocol}")},!0),t.addRoute({placechanged:this.placechanged.bind(this)}),this.placechanged()}checkSlider(){let t=this.#t.length-1;this.opSlider.max=t,this.opSlider.value=this.#e;let e=this.#t[this.#e];this.frameName.textContent=e?.name||"",this.#i&&delete this.#i.dataset.marked,this.#n=!0;let i=e?.logElement;for(let s=this.#e;s<this.#t.length&&!i;s++){let a=this.#t[s];if(!a)break;i=a.logElement}this.#i=i,this.#n=e?.logElement!==i,i&&(i.dataset.marked=this.#n?"partial":"complete",i.scrollIntoView({behavior:"smooth",block:"nearest"})),this.forward.makeVisible(this.#e<t),this.backward.makeVisible(this.#e>0)}goLast(){this.goFrame(this.#t.length-1),this.game.vgame.route("inforecommend log")}get animatingNow(){return this.nextFrameTimer}goFrame(t,e){if(!(t>=0)||(t>=this.#t.length&&(t=this.#t.length),t<0&&(t=0),this.#e===t))return;let i=this.#t[t];if(i){if(e!=="no"&&(t===this.#e+1||e)){if(this.#a=t,this.animatingNow)return;this.playNext(!0);return}if(i.snapshot)this.#e!==t+1&&(document.body.classList.add("notransition"),setTimeout(()=>document.body.classList.remove("notransition"),200)),this.game.vgame.route(i.snapshot);else{let s=t-1;for(;s>=0&&!this.#t[s]?.snapshot;s--);if(s<0)return;for(;s<=t;s++)this.playFrame(this.#t[s])}this.#e=t,this.checkSlider(),this.stop(),setHash("frame_"+t)}}click(t){if(t.target.dataset.action==="playpause")return this.playPause();if(t.target.dataset.action==="forward")return this.nextLog();if(t.target.dataset.action==="backward")return this.prevLog(!0);if(t.target.dataset.action==="framename")return this.game.toggleLittle("log")}sliderClick(t){if(this.game.isplayer)return;let e=this.opSlider.value;log("Slider "+e),this.stop(),this.goFrame(+e)}placechanged(){let t=this.game.isSolo||!this.game.isPlayer;this.opPanel.makeVisible(t),this.game.controlZone.makeVisible(t)}addLog(t,e){let i=this.lastFrame;e||(e=i.name||"");let s="";try{for(let n=0;!n;)this.#s===0&&(s+=`<span class='moveno'>${++this.#r}</span>`),(this.#s===t||this.game.maxPlayers>=t)&&(n=1),s+=`<span data-frameno='${this.#t.length-1}' data-column='${t}'>${n?e:""}</span>`,this.#s=(this.#s+1)%this.game.maxPlayers}catch(n){e(n)}this.log.insertAdjacentHTML("beforeend",s);let a=this.log.lastElementChild;this.lastLog&&(this.lastLog.nextLog=a),a.prevLog=this.lastLog,this.lastLog=a,i.logElement=a}get count(){return this.log.children.length}get lastFrame(){return this.#t[this.#t.length-1]}addFrame(t){t.game=this.game,t.frameno=this.#t.length,this.#t.push(t),this.checkSlider(),t.play&&log("Added frame "+JSON.stringify(t.play)),this.#e===this.#t.length-2&&this.goFrame(this.#e+1),t.snapshot==="make"&&this.checkSnapshot(t)}checkPlay(t){this.playing!==t&&(this.playing=t,this.playpause.textContent=t?"â¸ï¸":"â¶ï¸")}playPause(){this.nextFrameTimer?this.stop():this.playNext(!0)}stop(){this.nextFrameTimer&&clearTimeout(this.nextFrameTimer),this.nextFrameTimer=null,this.#a=null,this.checkPlay(!1)}playNext(t){if(!this.#t.length)return;this.#e+1>=this.#t.length?this.#e=0:this.#e++;let e=this.#t[this.#e];
8if(!e){log(`#currentFrame=${this.#e} this.#frames.length=${this.#t.length}`),bugReport("Bad frame in protocol");return}this.playFrame(e),this.checkSlider(),this.checkPlay(t);let i=this.#a||this.#t.length-1;t&&this.#e<i?this.nextFrameTimer=setTimeout(()=>this.playNext(!0),e.duration||1e3):this.stop()}playFrame(t){t&&(t.play?(this.game.vgame.route(t.play),this.checkSnapshot(t)):t.snapshot&&this.game.vgame.route(t.snapshot))}checkSnapshot(t){(!t.snapshot||t.snapshot==="make")&&(t.snapshot={},(this.game.makeSnapshot||this.game.baseSnapshot)(t.snapshot))}logClick(t){let e=t.target.dataset.frameno;this.goFrame(+e)}checkAnimationAction(t){let e=Date.now()<this.#o?"no":!0;return this.#o=Date.now()+(t||1e3),e}nextLog(t){if(t)return this.playNext();let e=this.checkAnimationAction();if(!this.#i)return;if(this.#t[this.#a]?.logElement){let s=this.#t[this.#a].logElement,a=s.nextLog;return a?(this.stop(),this.goFrame(+a.dataset.frameno,"no")):void 0}if(this.#t[this.#e].logElement!==this.#i)return this.goFrame(+this.#i.dataset.frameno,e);let i=this.#i.nextLog;i&&this.goFrame(+i.dataset.frameno,e)}prevLog(t){if(this.checkAnimationAction(500),t&&this.#e)return this.goFrame(this.#e-1);if(this.#i){for(let e=this.#i.previousElementSibling;e;e=e.previousElementSibling)if(e.dataset.frameno)return this.goFrame(+e.dataset.frameno)}}upLog(){if(this.checkAnimationAction(500),!this.#i)return;let t=this.#i.dataset.column;for(let e=this.#i.previousElementSibling;e;e=e.previousElementSibling)if(e.dataset.column===t)return this.goFrame(+e.dataset.frameno);this.log.firstElementChild.scrollIntoView({behavior:"smooth",block:"center"})}downLog(){if(!this.#i)return;let t=this.#i.dataset.column;for(let e=this.#i.nextElementSibling;e;e=e.nextElementSibling)if(e.dataset.column===t)return this.goFrame(+e.dataset.frameno);this.log.lastElementChild.scrollIntoView({behavior:"smooth",block:"center"})}keyDown(t){if(this.game.isActive&&(!["INPUT","TEXTAREA"].includes(t.target.tagName)||t.target===this.opSlider)){if(t.key.startsWith("Arrow")&&t.preventDefault(),t.key==="ArrowRight")return this.nextLog(t.ctrlKey||t.metaKey);if(t.key==="ArrowLeft")return this.prevLog(t.ctrlKey||t.metaKey);if(t.key==="ArrowUp")return this.upLog();if(t.key==="ArrowDown")return this.downLog();if(t.key===" ")return this.playPause()}}};function m(r){r.protocol||(r.protocol=new h(r))}o(m,"set");function g(r){let t=r;if(r instanceof URLSearchParams){t={};for(let[i,s]of r)t[i]=s}let e=t.game;return new l({id:"game_proto",game:e,replay:!0,nosubscription:!0,autoshow:!0,bigwindow:r.bigwindow,setproto:t})}o(g,"makeProtogame");export{h as Gameplay,m as default,g as makeProtogame};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.