From 2359a4cf939982c86da281482aa9d998dbc2bc71 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Sun, 25 Aug 2024 18:34:22 +0000 Subject: [PATCH] deploy: a49c4f46f52a5774aae8b63edabe37435a172096 --- index.html | 2 +- main-dcc07aba.js => main-39013d9e.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename main-dcc07aba.js => main-39013d9e.js (98%) diff --git a/index.html b/index.html index 7cf856b..60c8622 100644 --- a/index.html +++ b/index.html @@ -6,6 +6,6 @@ - + \ No newline at end of file diff --git a/main-dcc07aba.js b/main-39013d9e.js similarity index 98% rename from main-dcc07aba.js rename to main-39013d9e.js index 0dd7fb2..a67cf7d 100644 --- a/main-dcc07aba.js +++ b/main-39013d9e.js @@ -1 +1 @@ -if(!self.define){let t,e={};const A=(A,n)=>(A=new URL(A+".js",n).href,e[A]||new Promise((e=>{if("document"in self){const t=document.createElement("script");t.src=A,t.onload=e,document.head.appendChild(t)}else t=A,importScripts(A),e()})).then((()=>{let t=e[A];if(!t)throw new Error(`Module ${A} didn’t register its module`);return t})));self.define=(n,i)=>{const o=t||("document"in self?document.currentScript.src:"")||location.href;if(e[o])return;let s={};const a=t=>A(t,o),r={module:{uri:o},exports:s,require:a};e[o]=Promise.all(n.map((t=>r[t]||a(t)))).then((t=>(i(...t),s)))}}define(["require","./comlink-9648aa2d","./promise_despammer-c45d8fa6"],(function(t,e,A){"use strict";function n(t,e){void 0===e&&(e={});var A=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===A&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}var i="ui_corner_container__IzzWj",o="ui_menu_button__u2qWl",s="ui_nerdy_stats__JRI56";n('@charset "UTF-8";\nhtml {\n overflow: hidden;\n width: 100%;\n height: 100%;\n}\n\nbody {\n height: 100%;\n background-color: #202020;\n color: white;\n}\n\n.ui_corner_container__IzzWj {\n left: 0px;\n top: 0px;\n min-width: calc(min(100vw,200px));\n min-height: calc(min(100vh,200px));\n background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, transparent 50%, transparent 100%);\n background-position: top left;\n background-size: 200px 200px;\n background-repeat: no-repeat;\n position: absolute;\n z-index: 1;\n pointer-events: none;\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl {\n padding: 10px;\n margin: 5px;\n border: 0px solid transparent;\n border-radius: 100%;\n background-color: rgba(0, 0, 0, 0.2);\n transition: linear background-color 0.1s;\n box-sizing: content-box;\n width: 1em;\n height: 1em;\n font-size: 25px;\n line-height: 1em;\n cursor: pointer;\n float: left;\n color: white;\n font-weight: bold;\n pointer-events: all;\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl::after {\n content: "⋮";\n}\n.ui_corner_container__IzzWj .ui_nerdy_stats__JRI56 {\n color: #ff8888;\n font-size: 20px;\n padding: 10px;\n margin: 0px;\n top: 0px;\n left: 0px;\n max-width: 100vw;\n pointer-events: none;\n user-select: none;\n word-break: break-all;\n display: none;\n text-shadow: 0 0 3px black, 0 0 3px black, 0 0 3px black, 0 0 3px black;\n}');var a="time_controls_container__YPyNv",r="time_controls_play_button__vrV2y",l="time_controls_scrubber__7e443",h="time_controls_playing__PqjSE";n(".time_controls_container__YPyNv .time_controls_play_button__vrV2y {\n padding: 10px;\n margin: 5px;\n border: 0px solid transparent;\n border-radius: 100%;\n background-color: transparent;\n background-origin: content-box;\n background-repeat: no-repeat;\n background-size: 1em 1em;\n transition: linear background-color 0.1s;\n display: inline-block;\n box-sizing: content-box;\n width: 1em;\n height: 1em;\n font-size: 25px;\n line-height: 1em;\n cursor: pointer;\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.time_controls_container__YPyNv {\n pointer-events: none;\n position: absolute;\n width: 100%;\n left: 0px;\n bottom: 0px;\n padding-top: 30px;\n padding-left: 30px;\n padding-right: 30px;\n box-sizing: border-box;\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);\n color: white;\n font-family: Arial, Helvetica, sans-serif;\n user-select: none;\n}\n.time_controls_container__YPyNv input[type=range].time_controls_scrubber__7e443 {\n pointer-events: auto;\n box-sizing: border-box;\n margin: 0px;\n bottom: 0px;\n margin-top: -25px;\n padding-top: 30px;\n padding-bottom: 30px;\n cursor: pointer;\n display: block;\n width: 100%;\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y {\n pointer-events: auto;\n color: white;\n /*&::after {\r\n \tcontent: \"\\23f5\\fe0e\";\r\n }\r\n &.playing::after {\r\n \tcontent: \"\\23f8\\fe0e\";\r\n }*/\n background-image: url(\"data:image/svg+xml;utf8,\");\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y.time_controls_playing__PqjSE {\n background-image: url(\"data:image/svg+xml;utf8,\");\n}");class d{constructor(t){this.ui=t,this.container=document.createElement("div"),this.scrubber=document.createElement("input"),this.time_span=document.createElement("span"),this.duration_span=document.createElement("span"),this.play_button=document.createElement("button"),this.playback_speed=0,this.playback_speed_override=0,this.dragging=!1,this.handle_input=t=>{this.dragging=!0,this.set_time(+this.scrubber.value),this.time_span.textContent=g(+this.scrubber.value/10),this.update_play_button()},this.handle_change=t=>{this.dragging=!1,this.set_time(+this.scrubber.value),this.update_play_button(),this.current_time=+this.scrubber.value,this.ui.update_hash()},this.play_clicked=()=>{this.playback_speed=this.playback_speed?0:1,this.playback_speed&&this.ui.sound_player.ctx.resume(),this.ui.update_hash(),this.update_play_button()},this.current_time=0,this.holding_left=!1,this.holding_right=!1,this.holding_shift=!1,this.holding_ctrl=!1,this.handle_keydown=t=>{this.holding_shift=t.shiftKey,this.holding_ctrl=t.ctrlKey,this.update_keyboard_scrubbing(),!t.defaultPrevented&&t.target instanceof Element&&(t.target==document.body||this.container.contains(t.target)||this.ui.viewport.viewport_div.contains(t.target))&&("Space"==t.code?(t.shiftKey?this.playback_speed=5!=this.playback_speed?5:1:t.ctrlKey?this.playback_speed=-3!=this.playback_speed?-3:1:this.playback_speed=0==this.playback_speed?1:0,this.playback_speed&&this.ui.sound_player.ctx.resume(),this.update_play_button(),t.preventDefault(),this.ui.update_hash()):"ArrowLeft"==t.code?(this.holding_left=!0,this.update_keyboard_scrubbing(),t.preventDefault()):"ArrowRight"==t.code&&(this.holding_right=!0,this.update_keyboard_scrubbing(),t.preventDefault()))},this.handle_keyup=t=>{this.holding_shift=t.shiftKey,this.holding_ctrl=t.ctrlKey,this.update_keyboard_scrubbing(),"ArrowLeft"==t.code&&this.holding_left?(this.holding_left=!1,this.update_keyboard_scrubbing(),this.ui.update_hash()):"ArrowRight"==t.code&&this.holding_right&&(this.holding_right=!1,this.update_keyboard_scrubbing(),this.ui.update_hash())},this.set_time=A.despam_promise(this.ui.player.advance_time),this.container.classList.add(a),document.body.appendChild(this.container),this.play_button.classList.add(r),this.play_button.addEventListener("click",this.play_clicked),this.container.appendChild(this.play_button),this.update_play_button(),this.scrubber.type="range",this.scrubber.step="0",this.scrubber.addEventListener("input",this.handle_input),this.scrubber.addEventListener("change",this.handle_change),this.scrubber.classList.add(l),this.container.appendChild(this.time_span),this.container.appendChild(document.createTextNode(" / ")),this.container.appendChild(this.duration_span),this.container.appendChild(this.scrubber),document.addEventListener("keydown",this.handle_keydown),document.addEventListener("keyup",this.handle_keyup)}update_play_button(){this.playback_speed&&!this.dragging?this.play_button.classList.add(h):this.play_button.classList.remove(h)}update_time(t){this.dragging||(this.scrubber.value=""+t,this.time_span.textContent=g(t/10),this.current_time=t)}update_duration(t){this.scrubber.max=""+t,this.duration_span.textContent=g(t/10)}update_keyboard_scrubbing(){let t=0;this.holding_left&&t--,this.holding_right&&t++,this.holding_ctrl&&this.holding_shift?this.playback_speed_override=25*t:this.holding_shift?this.playback_speed_override=5*t:this.holding_ctrl?this.playback_speed_override=.5*t:this.playback_speed_override=t}}function g(t){let e=Math.floor(t/3600),A=Math.floor((t-3600*e)/60),n=t-3600*e-60*A;return`${e}`.padStart(2,"0")+":"+`${A}`.padStart(2,"0")+":"+`${n.toFixed(1)}`.padStart(4,"0")}var _="panel_panel_container__RUahc",c="panel_modal__tISr3",p="panel_panel__lP1UC",u="panel_collapsed__AUT3E",I="panel_panel_header__U1oyu",C="panel_drag_handle__vYmvQ",E="panel_close_button__p7n3-",m="panel_docked__BM5ZK",B="panel_transparent_button__puYR-",Q="panel_collapse_button__lWTen",f="panel_menu_button__GIbSs",w="panel_panel_content__WKUhB",v="panel_positioned__EoLI3",b="panel_transparent__IDtA-";n('@charset "UTF-8";\n.panel_panel_container__RUahc {\n position: absolute;\n left: 0px;\n top: 0px;\n width: 100%;\n height: 100%;\n pointer-events: none;\n display: flex;\n align-content: center;\n justify-content: center;\n z-index: 10;\n}\n.panel_panel_container__RUahc > * {\n pointer-events: auto;\n}\n\n.panel_panel_container__RUahc.panel_modal__tISr3 {\n pointer-events: auto;\n}\n\n.panel_panel__lP1UC {\n --min-width: 0px;\n --max-width: 100vw;\n --min-height: 0px;\n --max-height: 100vh;\n --highlight-color: #40628a;\n --highlight-color-text: #8ba5c4;\n display: inline-flex;\n flex-direction: column;\n max-width: calc(min(max(200px, var(--max-width)), 100vw));\n max-height: calc(min(max(90px, var(--max-height)), 100vh));\n min-width: calc(min(max(200px, var(--min-width)), 100vw));\n min-height: calc(min(max(90px, var(--min-height)), 100vh));\n background-color: #202020;\n box-sizing: border-box;\n border: 1px solid var(--highlight-color);\n margin: auto;\n color: white;\n font-family: Verdana, Geneva, sans-serif;\n font-size: 17px;\n box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);\n scrollbar-width: thin;\n}\n.panel_panel__lP1UC.panel_collapsed__AUT3E {\n min-height: 0px;\n}\n.panel_panel__lP1UC :focus {\n outline: none;\n}\n\n.panel_panel_header__U1oyu {\n margin: 0px;\n display: block;\n padding: 0px;\n background-color: #303030;\n font-size: 20px;\n min-height: 2em;\n line-height: 2em;\n user-select: none;\n color: var(--highlight-color-text);\n touch-action: pinch-zoom;\n overflow-y: hidden;\n flex-grow: 0;\n}\n.panel_panel_header__U1oyu button {\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n margin: 0px;\n font-family: sans-serif;\n vertical-align: middle;\n padding-left: 15px;\n padding-right: 15px;\n}\n.panel_panel_header__U1oyu button:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n.panel_panel_header__U1oyu span {\n vertical-align: middle;\n}\n.panel_panel__lP1UC:focus-within .panel_panel_header__U1oyu {\n color: #e9c183;\n}\n\n.panel_drag_handle__vYmvQ {\n box-sizing: border-box;\n touch-action: pinch-zoom;\n cursor: nwse-resize;\n}\n.panel_drag_handle__vYmvQ::after {\n content: "";\n float: right;\n margin-top: -40px;\n height: 0px;\n width: 0px;\n border-bottom: 20px solid var(--highlight-color);\n border-right: 20px solid var(--highlight-color);\n border-top: 20px solid transparent;\n border-left: 20px solid transparent;\n}\n.panel_collapsed__AUT3E .panel_drag_handle__vYmvQ {\n display: none;\n}\n\n.panel_close_button__p7n3- {\n float: right;\n}\n.panel_close_button__p7n3-::after {\n content: "×";\n display: inline-block;\n transform: scale(2);\n}\n\n.panel_dock_button__ha0bW {\n float: right;\n}\n.panel_dock_button__ha0bW::after {\n content: "◨";\n}\n.panel_docked__BM5ZK .panel_dock_button__ha0bW::after {\n content: "▣";\n}\n\n.panel_transparent_button__puYR- {\n float: right;\n}\n.panel_transparent_button__puYR-::after {\n content: "α";\n}\n.panel_docked__BM5ZK .panel_transparent_button__puYR-, button.panel_docked__BM5ZK .panel_transparent_button__puYR-:hover {\n background-color: transparent;\n color: grey;\n}\n\n.panel_collapse_button__lWTen {\n float: left;\n}\n.panel_collapse_button__lWTen::after {\n display: inline-block;\n content: "▼";\n transition: linear 0.1s transform;\n}\n.panel_collapsed__AUT3E .panel_collapse_button__lWTen::after {\n transform: rotate(-180deg);\n}\n\n.panel_menu_button__GIbSs {\n float: right;\n}\n.panel_menu_button__GIbSs::after {\n display: inline-block;\n content: "⋮";\n}\n\n.panel_panel_content__WKUhB {\n padding: 8px;\n padding-bottom: 40px;\n overflow: auto;\n flex-grow: 1;\n}\n.panel_collapsed__AUT3E .panel_panel_content__WKUhB {\n display: none;\n}\n\n.panel_positioned__EoLI3.panel_panel_container__RUahc {\n display: block;\n}\n.panel_positioned__EoLI3 .panel_panel__lP1UC {\n position: sticky;\n margin: 0px;\n}\n\n.panel_panel__lP1UC.panel_transparent__IDtA- {\n background-color: rgba(0, 0, 0, 0.1);\n border: none;\n pointer-events: none;\n box-shadow: none;\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_panel_header__U1oyu {\n pointer-events: all;\n border: 1px solid var(--highlight-color);\n box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_panel_content__WKUhB {\n padding: 9px;\n padding-top: 7px;\n text-shadow: 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black;\n overflow: hidden;\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_drag_handle__vYmvQ {\n display: none;\n}');class y extends EventTarget{constructor(t="Title",e=!1){super(),this.container_div=document.createElement("div"),this.panel_div=document.createElement("div"),this.header_div=document.createElement("div"),this.content_div=document.createElement("div"),this.close_button=document.createElement("button"),this.collapse_button=document.createElement("button"),this.title_span=document.createElement("span"),this.drag_handle_div=document.createElement("div"),this.header_pointerdown=t=>{var e,A;if(null===(A=null===(e=t.target)||void 0===e?void 0:e.closest)||void 0===A?void 0:A.call(e,"button"))return;this.take_focus(),t.preventDefault();let n=e=>{if(e.pointerId!=t.pointerId)return;e.preventDefault();let A=this.panel_div.getBoundingClientRect(),n=e.clientX-t.clientX,i=e.clientY-t.clientY;t=e,this.container_div.classList.add(v),this.panel_div.style.left=Math.max(0,A.left+n)+"px",this.panel_div.style.top=Math.max(0,A.top+i)+"px"},i=e=>{e.pointerId==t.pointerId&&(document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},this.resize_pointerdown=t=>{var e,A;if(null===(A=null===(e=t.target)||void 0===e?void 0:e.closest)||void 0===A?void 0:A.call(e,"button"))return;this.take_focus(),t.preventDefault();let n=e=>{if(e.pointerId!=t.pointerId)return;e.preventDefault();let A=this.panel_div.getBoundingClientRect(),n=e.clientX-t.clientX,i=e.clientY-t.clientY;t=e,this.set_fixed_size(A.width+n,A.height+i),this.container_div.classList.add(v),this.panel_div.style.left=Math.max(0,A.left)+"px",this.panel_div.style.top=Math.max(0,A.top)+"px"},i=e=>{e.pointerId==t.pointerId&&(document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},this.toggle_transparent=()=>{this.container_div.classList.contains(m)||this.panel_div.classList.toggle(b)},this.toggle_collapse=()=>{this.panel_div.classList.toggle(u)},this.container_div.classList.add(_),e&&this.container_div.classList.add(c),this.panel_div.tabIndex=0,this.panel_div.classList.add(p),this.container_div.appendChild(this.panel_div),this.header_div.classList.add(I),this.header_div.addEventListener("pointerdown",this.header_pointerdown),this.panel_div.appendChild(this.header_div),this.collapse_button.classList.add(Q),this.collapse_button.addEventListener("click",this.toggle_collapse),this.header_div.appendChild(this.collapse_button),this.close_button.classList.add(E),this.close_button.addEventListener("click",this.close.bind(this)),this.header_div.appendChild(this.close_button),this.header_div.appendChild(this.title_span),this.title_span.textContent=t,this.content_div.classList.add(w),this.panel_div.appendChild(this.content_div),this.drag_handle_div.classList.add(C),this.drag_handle_div.addEventListener("pointerdown",this.resize_pointerdown),this.panel_div.appendChild(this.drag_handle_div),this.panel_div.addEventListener("focusin",(async()=>{let t=10;for(let e of document.body.querySelectorAll("."+_))e!=this.container_div&&(t=Math.max(t,+(e.style.zIndex||10)));this.container_div.style.zIndex=""+(t+1)}))}set_fixed_size(t,e){if(null==t||null==e){let A=this.panel_div.getBoundingClientRect();null==t&&(t=A.width),null==e&&(e=A.height)}"number"==typeof t&&(t+="px"),"number"==typeof e&&(e+="px"),this.panel_div.style.setProperty("--min-width",t),this.panel_div.style.setProperty("--min-height",e),this.panel_div.style.setProperty("--max-width",t),this.panel_div.style.setProperty("--max-height",e)}enable_absolute_position(){this.container_div.classList.add(v)}add_transparent_toggle(){if(this.transparent_button)return;let t=document.createElement("button");t.classList.add(B),t.addEventListener("click",this.toggle_transparent),this.header_div.appendChild(t),this.transparent_button=t}add_menu_button(t){if(this.menu_button)return;let e=document.createElement("button");e.classList.add(f),e.addEventListener("click",(()=>{t(e)})),this.header_div.appendChild(e),this.menu_button=e}get is_open(){return document.body.contains(this.container_div)}take_focus(){var t;document.activeElement&&this.panel_div.contains(document.activeElement)||(null===(t=document.activeElement)||void 0===t||t.blur(),this.panel_div.focus())}close(){document.body.contains(this.container_div)&&(document.body.removeChild(this.container_div),this.dispatchEvent(new Event("close")))}open(t=!1){document.body.contains(this.container_div)||(document.body.appendChild(this.container_div),t&&this.take_focus(),this.dispatchEvent(new Event("open")))}}var x="progress_spinner_spinner__a4z6R",D="progress_spinner_definite__KxUY4",k="progress_spinner_segment__jbuQh",L="progress_spinner_full_page__Z0jDj",N="progress_spinner_fading_out__eG0Yi";n('@keyframes progress_spinner_spin__Xd8F6 {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1440deg);\n }\n}\n.progress_spinner_spinner__a4z6R {\n width: 5em;\n height: 5em;\n position: relative;\n border-radius: 100%;\n overflow: hidden;\n background-color: rgba(0, 0, 0, 0.5);\n margin: auto;\n pointer-events: none;\n opacity: 1;\n transition: opacity linear 0.5s;\n}\n.progress_spinner_spinner__a4z6R:not(.progress_spinner_definite__KxUY4)::after {\n content: "";\n height: 0.5em;\n margin-top: 2.25em;\n margin-bottom: 2.25em;\n background-color: white;\n animation-name: progress_spinner_spin__Xd8F6;\n animation-duration: 2s;\n animation-iteration-count: infinite;\n border-radius: 0.25em;\n width: 5em;\n position: absolute;\n}\n.progress_spinner_spinner__a4z6R:not(.progress_spinner_definite__KxUY4) .progress_spinner_segment__jbuQh {\n display: none;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 {\n line-height: 5em;\n vertical-align: middle;\n text-align: center;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 .progress_spinner_segment__jbuQh {\n width: 5em;\n height: 5em;\n top: 0px;\n left: 0px;\n position: absolute;\n box-sizing: border-box;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 .progress_spinner_segment__jbuQh::after {\n content: "";\n width: 2.51em;\n height: 2.51em;\n top: 2.49em;\n left: 2.49em;\n position: absolute;\n background-color: white;\n box-sizing: border-box;\n}\n.progress_spinner_spinner__a4z6R span {\n color: white;\n position: relative;\n text-shadow: 0px 0px 0.1em black;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_full_page__Z0jDj {\n position: absolute;\n margin-top: -2.5em;\n margin-left: -2.5em;\n top: 50%;\n left: 50%;\n font-size: calc(min(10vh, 10vw));\n z-index: 5;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_fading_out__eG0Yi {\n opacity: 0;\n}');class S{constructor(){this.element=document.createElement("div"),this.segments=[document.createElement("div"),document.createElement("div"),document.createElement("div"),document.createElement("div")],this.label=document.createElement("span"),this.element.classList.add(x);for(let t=0;t<4;t++)this.segments[t].classList.add(k),this.element.appendChild(this.segments[t]);this.element.appendChild(this.label)}get progress(){return this._progress}set progress(t){if(void 0!==t){t=Math.min(Math.max(t,0),1),this.label.textContent=Math.round(100*t)+"%",this.element.classList.add(D);for(let e=0;e<4;e++){let A=90*e-90,n=Math.PI/2*(1-Math.min(Math.max(4*t-e,0),1)),i=Math.cos(n),o=Math.sin(n);this.segments[e].style.transform=`rotate(${A}deg) matrix(1, 0, ${o}, ${i}, 0, 0)`}}else this.element.classList.remove(D);this._progress=t}get full_page(){return this.element.classList.contains(L)}set full_page(t){t?this.element.classList.add(L):this.element.classList.remove(L)}fade_out(){this.element.classList.add(N),setTimeout((()=>{var t;null===(t=this.element.parentElement)||void 0===t||t.removeChild(this.element)}),1e3)}}var R="menu_menu_content__FdBEI",F="menu_subtext__2IN7y",M="menu_no_min_height__wkhl3";n('.menu_menu_content__FdBEI {\n padding: 0px;\n font-size: 20px;\n}\n.menu_menu_content__FdBEI button {\n cursor: pointer;\n display: block;\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n line-height: 1em;\n min-height: 2em;\n margin: 0px;\n padding: 0px;\n padding-left: 10px;\n padding-right: 10px;\n font-family: sans-serif;\n text-align: left;\n width: 100%;\n}\n.menu_menu_content__FdBEI button span, .menu_menu_content__FdBEI button p {\n vertical-align: middle;\n margin: 0px;\n text-align: left;\n}\n.menu_menu_content__FdBEI button:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n.menu_menu_content__FdBEI button canvas {\n width: 64px;\n height: 64px;\n margin: 0px;\n float: left;\n position: relative;\n left: -10px;\n}\n.menu_menu_content__FdBEI button .menu_subtext__2IN7y {\n color: grey;\n}\n.menu_menu_content__FdBEI::after {\n content: "";\n height: 3px;\n width: 100%;\n background-color: calc(var(--highlight-color));\n display: block;\n}\n\n.menu_no_min_height__wkhl3 {\n max-height: calc(min(var(--max-height), 100vh));\n min-height: calc(min(var(--min-height), 100vh));\n}');const U={startup_chat:"true",startup_chat_transparent:"true"};var T;!function(t){let e=new Map;t.get=function(t){var A,n;try{return null!==(A=localStorage.getItem("dvmt-"+t))&&void 0!==A?A:U[t]}catch(A){return console.error(A),null!==(n=e.get(t))&&void 0!==n?n:U[t]}},t.set=function(t,A){e.set(t,A),window.localStorage&&(A==U[t]?localStorage.removeItem("dvmt-"+t):localStorage.setItem("dvmt-"+t,A))}}(T||(T={}));class Y extends y{constructor(t,e=!0){var n,i;super("Chat"),this.ui=t,this.follow_follower=!0,this.chat_target=void 0,this.scrolled_to_bottom=!0,this.last_frame_index=-1,this.frame_callback=async(t=this.last_frame_index)=>{let e=this.last_frame_index;if(t>this.last_frame_index){let A=await this.ui.player.get_chat_messages(this.chat_target,this.last_frame_index+1,t+1);if(e!=this.last_frame_index)return;if(A.length){let t=new DocumentFragment;for(let e of A){let A=document.createElement("div");A.style.wordBreak="break-word",A.style.whiteSpace="pre-wrap",A.dataset.msgTime=""+e.time,A.dataset.msgFrame=""+e.frame_index;let n="innerHTML",i="";"string"==typeof e.message?i=e.message:e.message.html?i=e.message.html:e.message.text&&(i=e.message.text),A[n]=i;for(let t of A.querySelectorAll("a"))t.target="_blank";t.appendChild(A)}this.content_div.appendChild(t),this.update_content_scroll()}}else if(t=0;e--){let A=this.content_div.children[e];if(!(A instanceof HTMLElement))continue;let n=A.dataset.msgFrame;null!=n&&+n>=t&&this.content_div.removeChild(A)}this.last_frame_index=t};let o=null===(n=this.ui.viewport.current_follow)||void 0===n?void 0:n.ref;"string"==typeof o&&(this.chat_target=o),this.add_transparent_toggle(),this.add_menu_button((t=>{new q(this).put_below(t).open(!0)})),this.set_fixed_size("min(800px, 80vw)","min(600px, 45vh)"),e&&("false"!=T.get("startup_chat_transparent")&&this.toggle_transparent(),this.enable_absolute_position(),this.panel_div.style.left="100vw",this.panel_div.style.top="0px"),this.content_div.classList.add("chat_window"),this.frame_callback=A.despam_promise(this.frame_callback),this.addEventListener("close",(()=>{this.detach_hooks();let t=this.ui.chat_windows.indexOf(this);t>=0&&this.ui.chat_windows.splice(t,1)})),this.addEventListener("open",(()=>{this.attach_hooks(),this.ui.chat_windows.push(this)}));let s=new ResizeObserver((()=>this.update_content_scroll()));s.observe(this.content_div),s.observe(this.container_div),null===(i=this.transparent_button)||void 0===i||i.addEventListener("click",(()=>this.update_content_scroll())),this.content_div.addEventListener("scroll",(()=>{this.scrolled_to_bottom=Math.ceil(this.content_div.clientHeight+this.content_div.scrollTop)>=Math.floor(this.content_div.scrollHeight)}))}attach_hooks(){this.remove_frame_callback||(this.remove_frame_callback=(async()=>{if(!document.getElementById("chat_css")){let t=await this.ui.player.chat_css;if(!document.getElementById("chat_css")){t=t.replace(/((?:^|[},])[^\@\{]*?)([a-zA-Z.#\[\]":=\-_][a-zA-Z0-9.# \[\]":=\-_]*)(?=.+\{)/g,"$1.chat_window $2"),t=t.replace(/height: [^;]+%;/g,""),t=t.replace(/ ?html| ?body/g,"");let e=document.createElement("style");e.textContent=t,e.id="chat_css",document.head.appendChild(e)}}return this.ui.player.add_frame_listener(e.proxy(this.frame_callback))})())}detach_hooks(){this.remove_frame_callback&&(this.remove_frame_callback.then((t=>{t(),t[e.releaseProxy]()})),this.remove_frame_callback=void 0)}set_chat_target(t){t!=this.chat_target&&(this.title_span.textContent=t?`Chat (${t})`:"Chat",this.detach_hooks(),this.last_frame_index=-1,this.content_div.innerHTML="",this.chat_target=t,this.is_open&&this.attach_hooks())}update_content_scroll(){this.scrolled_to_bottom&&(this.content_div.scrollTop=Math.ceil(this.content_div.scrollHeight),this.scrolled_to_bottom=!0)}adjust_font_size(t){let e=17,A=window.getComputedStyle(this.content_div).fontSize;A.endsWith("px")&&(e=+A.substring(0,A.length-2)||e),e+=t,e=Math.max(Math.min(e,30),1),this.content_div.style.fontSize=e+"px",this.update_content_scroll()}}class J extends y{constructor(){super("",!0),this.panel_div.style.setProperty("--max-height","calc(90vh)"),this.panel_div.removeChild(this.header_div),this.panel_div.removeChild(this.drag_handle_div),this.panel_div.classList.add(M),this.content_div.classList.add(R),this.container_div.addEventListener("pointerdown",(t=>{t.target==this.container_div&&this.close()})),this.container_div.addEventListener("keydown",(t=>{"Escape"==t.code&&this.close()}))}add_hr(){this.content_div.appendChild(document.createElement("hr"))}add_basic_button(t,e,A){let n=document.createElement("button");if(e){document.createElement("span").textContent=t;let A=document.createElement("span");A.textContent=e,A.classList.add(F),n.append(t,document.createElement("br"),A)}else n.textContent=t;return n.addEventListener("click",A),this.content_div.appendChild(n),n}put_to_right(t){this.enable_absolute_position();let e=t.getBoundingClientRect();return this.panel_div.style.left=e.x+e.width+"px",this.panel_div.style.top=e.y+"px",this}put_below(t){this.enable_absolute_position();let e=t.getBoundingClientRect();return this.panel_div.style.left=e.x+"px",this.panel_div.style.top=e.y+e.height+"px",this}}class G extends J{constructor(t){super(),this.ui=t,this.add_basic_button("Open Chat",null,(()=>{new Y(t,!1).open(!0),this.close()})),this.add_basic_button("Next Z-level",null,(()=>{this.ui.player.adjust_z(1)})),this.add_basic_button("Previous Z-level",null,(()=>{this.ui.player.adjust_z(-1)}));let e=this.add_basic_button("Clients",null,(()=>{new K(this.ui,this).put_to_right(e).open(!0)}));this.add_basic_button("Stats for Nerds",null,(()=>{this.ui.nerdy_stats.style.display="block"==this.ui.nerdy_stats.style.display?"none":"block",this.close()}));let A=this.add_basic_button("Set Vision",null,(()=>{new P(this.ui).put_to_right(A).open(!0)}));this.add_basic_button("Toggle Darkness",null,(()=>{this.ui.player.toggle_darkness(),this.close()})),this.add_basic_button("Dump Textures",null,(()=>{this.ui.player.dump_textures(),this.close()}))}}class z extends J{constructor(t,e,A){super(),this.ui=t,this.load_spinner=new S,this.content_div.appendChild(this.load_spinner.element),this.ui.player.get_objects_through_point(e,A).then((e=>{this.content_div.removeChild(this.load_spinner.element);let A=new DocumentFragment;for(let n of e){let e=document.createElement("button"),i=document.createElement("canvas"),o=document.createElement("span"),s=document.createElement("br"),a=document.createElement("span");this.ui.object_canvases.set(i,{ref:n.ref,remove_when_done:!0}),e.append(i,o,s,a),o.textContent=n.name,a.classList.add(F),a.textContent=`[0x${n.ref.toString(16)}]`,A.appendChild(e),e.addEventListener("click",(()=>{let A=new H(t,this,n.ref,n.clients);A.put_to_right(e),A.open(!0)}))}this.content_div.appendChild(A)}))}}class H extends J{constructor(t,e,A,n,i=!1,o){super(),this.ui=t,this.parent=e;let s=document.createElement("button");if(s.textContent="Inspect",s.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.open_inspector(A)})),this.content_div.appendChild(s),A>>24!=1){let e=document.createElement("button");e.textContent="Follow Object",e.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.viewport.follow(A)})),this.content_div.appendChild(e)}for(let e of n){let A=document.createElement("button");A.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.viewport.follow(e)}));let n=document.createElement("span");n.textContent="Follow Client";let s=document.createElement("br"),a=document.createElement("span");if(a.textContent=e,a.classList.add(F),A.append(n,s,a),this.content_div.appendChild(A),i){let t=document.createElement("button");t.textContent="Open Chat",t.addEventListener("click",(()=>{this.close(),this.parent.close();let t=new Y(this.ui,!1);t.set_chat_target(e),t.open(!0)})),this.content_div.appendChild(t)}}this.addEventListener("close",(()=>{this.parent.panel_div.focus()}))}}class K extends J{constructor(t,e){super(),this.ui=t,this.parent=e,this.load_spinner=new S,this.content_div.appendChild(this.load_spinner.element),this.ui.player.get_clients_mobs().then((e=>{this.content_div.removeChild(this.load_spinner.element);let A=new DocumentFragment;for(let n of e){let e=document.createElement("button"),i=document.createElement("canvas"),o=document.createElement("span"),s=document.createElement("br"),a=document.createElement("span");this.ui.object_canvases.set(i,{ref:n.ref,remove_when_done:!0}),e.append(i,o,s,a),o.textContent=n.name,a.classList.add(F),a.textContent=n.ckey,A.appendChild(e),e.addEventListener("click",(()=>{let A=new H(t,this,n.ref,[n.ckey],!0,(()=>{this.parent.close()}));A.put_to_right(e),A.open(!0)}))}this.content_div.appendChild(A)})),this.addEventListener("close",(()=>{this.parent.panel_div.focus()}))}}class q extends J{constructor(t){super(),this.parent=t,this.add_basic_button(t.follow_follower?"Lock Target":"Unlock Target",null,(()=>{var e;if(t.follow_follower=!t.follow_follower,t.follow_follower){let A=null===(e=t.ui.viewport.current_follow)||void 0===e?void 0:e.ref;t.set_chat_target("string"==typeof A?A:void 0)}this.close()})),this.add_basic_button("Increase Font Size",null,(()=>{t.adjust_font_size(1)})),this.add_basic_button("Decrease Font Size",null,(()=>{t.adjust_font_size(-1)}))}}class P extends J{constructor(t){super(),this.ui=t,this.add_basic_button("Minimum Possible Vision",null,(()=>{t.player.set_see_invisible(5)})),this.add_basic_button("Regular Vision",null,(()=>{t.player.set_see_invisible(25)})),this.add_basic_button("Ghost vision",null,(()=>{t.player.set_see_invisible(60)})),this.add_basic_button("ALL vision",null,(()=>{t.player.set_see_invisible(100)})),this.add_basic_button("Debug vision",null,(()=>{t.player.set_see_invisible(101)}))}}var O="viewport_viewport__M3NP6",X="viewport_stop_following_container__ILEMO",j="viewport_followview__Y0F4U";n(".viewport_viewport__M3NP6 {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n overflow: hidden;\n isolation: isolate;\n background-color: black;\n touch-action: none;\n}\n\n.viewport_nerdy_stats__xJ-FT {\n position: absolute;\n color: red;\n background-color: rgba(0, 0, 0, 0.5);\n font-size: 20px;\n padding: 10px;\n margin: 0px;\n top: 0px;\n left: 0px;\n max-width: 100vw;\n pointer-events: none;\n user-select: none;\n word-break: break-all;\n}\n\n.viewport_stop_following_container__ILEMO {\n position: absolute;\n bottom: 100px;\n left: 0px;\n right: 0px;\n width: 100%;\n text-align: center;\n z-index: 1;\n}\n.viewport_stop_following_container__ILEMO button {\n margin: auto;\n padding: 10px;\n font-size: 16px;\n font-family: Verdana, Geneva, sans-serif;\n color: white;\n background-color: rgba(0, 0, 0, 0.5);\n border: none;\n}\n.viewport_stop_following_container__ILEMO button:hover {\n background-color: rgba(0, 0, 0, 0.7);\n}\n\n.viewport_followview__Y0F4U {\n z-index: 1;\n border: 10000px solid rgba(0, 0, 0, 0.8);\n margin: -10000px;\n box-sizing: content-box;\n display: none;\n pointer-events: none;\n}");class W{constructor(t){this.ui=t,this.viewport_div=document.createElement("div"),this.viewport_elements=[],this.followview={elem:document.createElement("div"),x:0,y:0,width:0,height:0},this.x=128,this.y=128,this.log_zoom=0,this.zoom=1,this.current_follow=void 0,this.icon_width=32,this.icon_height=32,this.pointers=[],this.stop_following_button=document.createElement("button"),this.handle_keydown=t=>{t.defaultPrevented||("PageDown"==t.code?(this.ui.player.adjust_z(-1),t.preventDefault()):"PageUp"==t.code?(this.ui.player.adjust_z(1),t.preventDefault()):"Escape"==t.code&&this.follow(null))},this.handle_mousedown=t=>{var e,A;if(0!=t.button&&1!=t.button)return;let n=e=>{let A=e.clientX-t.clientX,n=e.clientY-t.clientY;t=e,this.x-=A/this.zoom/this.icon_width,this.y+=n/this.zoom/this.icon_height,this.update_viewport(),e.preventDefault()},i=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",i),this.ui.update_hash()};document.addEventListener("mousemove",n),document.addEventListener("mouseup",i),document.activeElement!=this.viewport_div&&(null===(A=null===(e=document.activeElement)||void 0===e?void 0:e.blur)||void 0===A||A.call(e),this.viewport_div.focus()),t.preventDefault()},this.handle_wheel=async t=>{t.preventDefault();let e=t.deltaY/2;t.deltaMode==WheelEvent.DOM_DELTA_PIXEL&&(e/=100),t.deltaMode==WheelEvent.DOM_DELTA_LINE&&(e/=3);let A=-Math.max(-1,Math.min(1,e)),n=Math.sign(A);if(A=Math.abs(A),A>.25){let e,i=performance.now();for(;A>1/1024&&(e=await new Promise(requestAnimationFrame),!(n>0&&this.log_zoom>=6||n<0&&this.log_zoom<=-6));){let o=Math.min(A,.005*(e-i));this.adjust_zoom(o*n,t.clientX,t.clientY),A-=o,i=e}}else this.adjust_zoom(A*n,t.clientX,t.clientY);this.ui.update_hash()},this.handle_pointerdown=t=>{var e,A;if("mouse"==t.pointerType)return;let n={id:t.pointerId,x:t.clientX,y:t.clientY,down_time:t.timeStamp,total_move:0};this.viewport_div.setPointerCapture(t.pointerId),this.pointers.unshift(n),t.preventDefault(),document.activeElement!=this.viewport_div&&(null===(A=null===(e=document.activeElement)||void 0===e?void 0:e.blur)||void 0===A||A.call(e),this.viewport_div.focus()),setTimeout((()=>{n.total_move<10&&1==this.pointers.length&&this.pointers[0]==n&&(this.pointers.length=0,this.handle_contextmenu({clientX:n.x,clientY:n.y}))}),600)},this.handle_pointermove=t=>{let e=this.get_pointer_index(t.pointerId);if(e<0||this.pointers.length<1)return;t.preventDefault();let[A,n,i]=this.get_pointers_xyd();this.pointers[e].total_move+=Math.abs(t.clientX-this.pointers[e].x)+Math.abs(t.clientY-this.pointers[e].y),this.pointers[e].x=t.clientX,this.pointers[e].y=t.clientY;let[o,s,a]=this.get_pointers_xyd();1==this.pointers.length?(this.x-=(o-A)/this.zoom/this.icon_width,this.y+=(s-n)/this.zoom/this.icon_height,this.update_viewport()):this.adjust_zoom(Math.max(-1,Math.min(1,Math.log2(a/i))),A,n,o,s)},this.last_shorttap=-123456,this.last_shorttap_x=0,this.last_shorttap_y=0,this.handle_pointerup=t=>{let e=this.get_pointer_index(t.pointerId);if(e<0)return;let A=this.pointers[e];this.pointers.splice(e,1),t.preventDefault(),t.timeStamp-A.down_time<300&&A.total_move<10&&Math.abs(A.x-this.last_shorttap_x)<10&&Math.abs(A.y-this.last_shorttap_y)&&(A.down_time-this.last_shorttap<600?this.handle_doubleclick(t):(this.last_shorttap=A.down_time,this.last_shorttap_x=A.x,this.last_shorttap_y=A.y)),this.pointers.length||this.ui.update_hash()},this.handle_focus=()=>{const t=document.querySelector("meta[name=viewport]");t&&t.setAttribute("content","width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0")},this.handle_blur=()=>{const t=document.querySelector("meta[name=viewport]");t&&t.setAttribute("content","width=device-width, initial-scale=1.0")},this.handle_contextmenu=t=>{t instanceof Event&&t.preventDefault(),this.pointers.length=0;let e=this.viewport_div.getBoundingClientRect(),A=this.x+(t.clientX-(e.left+e.right)/2)/this.zoom/this.icon_width,n=this.y-(t.clientY-(e.top+e.bottom)/2)/this.zoom/this.icon_height,i=new z(this.ui,A,n);i.enable_absolute_position(),i.panel_div.style.left=t.clientX+"px",i.panel_div.style.top=t.clientY+"px",i.open(!0)},this.handle_doubleclick=async t=>{t instanceof Event&&t.preventDefault(),this.last_shorttap=-123456;let e=this.viewport_div.getBoundingClientRect(),A=this.x+(t.clientX-(e.left+e.right)/2)/this.zoom/this.icon_width,n=this.y-(t.clientY-(e.top+e.bottom)/2)/this.zoom/this.icon_height,i=await this.ui.player.get_clicked_object_ref(A,n);i&&this.ui.open_inspector(i)},this.viewport_div.classList.add(O),document.body.appendChild(this.viewport_div),this.viewport_div.tabIndex=0,this.viewport_div.addEventListener("mousedown",this.handle_mousedown),this.viewport_div.addEventListener("wheel",this.handle_wheel),this.viewport_div.addEventListener("pointerdown",this.handle_pointerdown),this.viewport_div.addEventListener("pointermove",this.handle_pointermove),this.viewport_div.addEventListener("pointerup",this.handle_pointerup),this.viewport_div.addEventListener("pointercancel",this.handle_pointerup),this.viewport_div.addEventListener("pointerleave",this.handle_pointerup),this.viewport_div.addEventListener("keydown",this.handle_keydown),this.viewport_div.addEventListener("focus",this.handle_focus),this.viewport_div.addEventListener("blur",this.handle_blur),this.viewport_div.addEventListener("contextmenu",this.handle_contextmenu),this.viewport_div.addEventListener("dblclick",this.handle_doubleclick),this.followview.elem.classList.add(j),this.add_viewport_element(this.followview);let e=document.createElement("div");e.classList.add(X),document.body.appendChild(e),e.appendChild(this.stop_following_button),this.stop_following_button.textContent="Stop Following",this.stop_following_button.addEventListener("click",(()=>{this.follow(null),this.update_viewport()})),new ResizeObserver((()=>{this.update_viewport()})).observe(this.viewport_div),this.update_viewport()}follow(t){var e;if(null==t&&null==this.current_follow||null!=t&&(null===(e=this.current_follow)||void 0===e?void 0:e.ref)==t)return;this.current_follow=null!=t?{ref:t,x:void 0,y:void 0}:void 0;let A="string"==typeof t?t:void 0;for(let t of this.ui.chat_windows)t.follow_follower&&t.set_chat_target(A);this.ui.update_hash()}update_nerdy_stats(t){this.ui.nerdy_stats.textContent=t}add_viewport_element(t){this.viewport_elements.push(t),this.viewport_div.appendChild(t.elem)}update_zoom(){this.log_zoom=Math.max(-6,Math.min(6,this.log_zoom));let t=this.log_zoom;Math.abs(Math.round(t)-t)<.002&&(t=Math.round(t)),this.zoom=2**t}update_viewport(){this.update_zoom(),this.x>5e3&&(this.x=5e3),this.x<-5e3&&(this.x=-5e3),this.y>5e3&&(this.y=5e3),this.y<-5e3&&(this.y=-5e3);let t=this.viewport_div.getBoundingClientRect();for(let{x:e,y:A,width:n,height:i,elem:o}of this.viewport_elements)o.style.position="absolute",o.style.left=t.width/2+(e-this.x)*this.icon_width*this.zoom+"px",o.style.bottom=t.height/2+(A-this.y)*this.icon_height*this.zoom+"px",o.style.width=this.icon_width*this.zoom*n+"px",o.style.height=this.icon_height*this.zoom*i+"px";this.stop_following_button.style.display=this.current_follow?"unset":"none"}adjust_zoom(t,e,A,n=e,i=A){let o=this.viewport_div.getBoundingClientRect(),s=0,a=0;this.current_follow&&null!=this.current_follow.x&&null!=this.current_follow.y?(s=this.current_follow.x-this.x,a=this.current_follow.y-this.y,this.x+=s,this.y+=a):(this.x+=(e-(o.left+o.right)/2)/this.zoom/this.icon_width,this.y+=-(A-(o.top+o.bottom)/2)/this.zoom/this.icon_height);let r=this.zoom;this.log_zoom+=t,this.update_zoom(),this.current_follow&&null!=this.current_follow.x&&null!=this.current_follow.y?(this.x-=s*r/this.zoom,this.y-=a*r/this.zoom):(this.x-=(n-(o.left+o.right)/2)/this.zoom/this.icon_width,this.y-=-(i-(o.top+o.bottom)/2)/this.zoom/this.icon_height),this.update_viewport()}get_pointer_index(t){for(let e=0;e=2&&(t+=this.pointers[1].x,t/=2,e+=this.pointers[1].y,e/=2,A=Math.sqrt((this.pointers[1].x-this.pointers[0].x)**2+(this.pointers[1].y-this.pointers[0].y)**2)),A<.1&&(A=.1),[t,e,A]}get_turf_window(){let t=this.viewport_div.getBoundingClientRect();return{left:this.x-t.width/2/this.zoom/this.icon_width,right:this.x+t.width/2/this.zoom/this.icon_width,bottom:this.y-t.height/2/this.zoom/this.icon_height,top:this.y+t.height/2/this.zoom/this.icon_height,pixel_scale:this.zoom*devicePixelRatio,follow:this.current_follow}}}function V(t){if(null==t)throw new Error("Unexpected null value");return t}function Z(t,e){let A=et(t,`\n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp float;\n\t#else\n\t\tprecision mediump float;\n\t#endif\n\tattribute vec4 ${e?"a_color_r, a_color_g, a_color_b, a_color_a, a_color_c":"a_color"};\n\tattribute vec4 a_uv;\n\tattribute vec3 a_transform_x;\n\tattribute float a_layer;\n\tattribute vec3 a_transform_y;\n\tattribute vec2 a_position;\n\tvarying vec4 ${e?"v_color_r, v_color_g, v_color_b, v_color_a, v_color_c":"v_color"};\n\tvarying vec2 v_uv;\n\tuniform vec2 u_viewport_size;\n\tuniform vec2 u_texture_size;\n\tuniform vec2 u_viewport_center;\n\tuniform float u_zoom;\n\tvoid main() {\n\t\t${e?"v_color_r = a_color_r;\n\t\tv_color_g = a_color_g;\n\t\tv_color_b = a_color_b;\n\t\tv_color_a = a_color_a;\n\t\tv_color_c = a_color_c;":"v_color = a_color;"}\n\t\tvec2 sprite_size = a_uv.zw-a_uv.xy;\n\t\tv_uv = mix(a_uv.xy, a_uv.zw, a_position) / u_texture_size;\n\t\tvec3 scaled_position = vec3(sprite_size*(a_position-vec2(0.5,0.5)), 1);\n\t\tgl_Position = vec4((vec2(dot(a_transform_x, scaled_position)+sprite_size.x*0.5, dot(a_transform_y, scaled_position)+sprite_size.y*0.5) - u_viewport_center) * u_zoom / u_viewport_size * 2.0, a_layer, 1.0);\n\t}\n\t`,`\n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp float;\n\t#else\n\t\tprecision mediump float;\n\t#endif\n\tuniform sampler2D u_texture;\n\tvarying vec4 ${e?"v_color_r, v_color_g, v_color_b, v_color_a, v_color_c":"v_color"};\n\tvarying vec2 v_uv;\n\tvoid main() {\n\t\tvec4 out_color = texture2D(u_texture, v_uv)${e?"":" * v_color"};\n\t\t${e?"out_color = v_color_c\n\t\t+ v_color_r * out_color.x\n\t\t+ v_color_g * out_color.y\n\t\t+ v_color_b * out_color.z\n\t\t+ v_color_a * out_color.w;":""}\n\t\tout_color.xyz *= out_color.w;\n\t\tfloat z = gl_FragCoord.z;\n\t\tgl_FragColor = out_color;\n\t\tif(gl_FragColor.a < 0.001961)\n\t\t\tdiscard;\n\t}`),n=[];e?(n.push(t.getAttribLocation(A,"a_color_r")),n.push(t.getAttribLocation(A,"a_color_g")),n.push(t.getAttribLocation(A,"a_color_b")),n.push(t.getAttribLocation(A,"a_color_a")),n.push(t.getAttribLocation(A,"a_color_c"))):n.push(t.getAttribLocation(A,"a_color"));let i={shader:A,a_position:t.getAttribLocation(A,"a_position"),a_transform_x:t.getAttribLocation(A,"a_transform_x"),a_transform_y:t.getAttribLocation(A,"a_transform_y"),a_color:n,a_uv:t.getAttribLocation(A,"a_uv"),a_layer:t.getAttribLocation(A,"a_layer"),u_texture:V(t.getUniformLocation(A,"u_texture")),u_texture_size:V(t.getUniformLocation(A,"u_texture_size")),u_viewport_size:V(t.getUniformLocation(A,"u_viewport_size")),u_viewport_center:V(t.getUniformLocation(A,"u_viewport_center")),u_zoom:V(t.getUniformLocation(A,"u_zoom")),vao:null,all_attrib_arrays:[]};return i.all_attrib_arrays.push(i.a_position,i.a_transform_x,i.a_transform_y,...i.a_color,i.a_uv,i.a_layer),i.vao=$(t,i.all_attrib_arrays),i}function $(t,e){let A=t.getExtension("OES_vertex_array_object");if(A){let n;n=A.createVertexArrayOES(),A.bindVertexArrayOES(n);for(let A of e)t.enableVertexAttribArray(A);return A.bindVertexArrayOES(null),n}if(t instanceof window.WebGL2RenderingContext){let A;A=t.createVertexArray(),t.bindVertexArray(A);for(let A of e)t.enableVertexAttribArray(A);return t.bindVertexArray(null),A}return null}function tt(t,e,A){let n=V(t.createShader(A));if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error((A==t.VERTEX_SHADER?"VERTEX SHADER ":"FRAGMENT SHADER ")+t.getShaderInfoLog(n));return n}function et(t,e,A){var n;let i=V(t.createProgram());if(t.attachShader(i,tt(t,e,t.VERTEX_SHADER)),t.attachShader(i,tt(t,A,t.FRAGMENT_SHADER)),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error(null!==(n=t.getProgramInfoLog(i))&&void 0!==n?n:"unknown shader error");return i}const At="http://www.w3.org/2000/svg";async function nt(t,e,A){let n=function(t,e,A){t=""+t;let n=(new DOMParser).parseFromString(t,"text/html");function i(t){return t=t.replace(/-dm-text-outline: ([0-9\.]+)([a-z%]+) ([^ ;]+)*(?: (sharp|square))?;/g,((t,e,A,n,i)=>{let o=+e,s=[];for(let t=0;t<8;t++){let e=t/8*Math.PI*2,a=+Math.cos(e).toFixed(2),r=+Math.sin(e).toFixed(2);"square"==i&&(a=Math.sign(a),r=Math.sign(r)),s.push(`${o*a}${A} ${o*r}${A} 0px ${n}`)}return`text-shadow: ${s.join(",")};`})),(t=(t=(t=t.replace(/font-size: *([0-9]+)px;/g,((t,e)=>`font-size: ${e}pt;`))).replace(/font-size: *([0-9]+)pt;/g,((t,e)=>`font-size: ${Math.ceil(4*e/3)}px;`))).replace(/font(?:-family)?: *['"]MS Serif['"];/g,'font-family:"MS Serif", "MS Pゴシック", "MS Sans Serif", sans-serif;')).replace(/(text-align: [^;]+);/g,"$1; display: block;")}for(let t of n.querySelectorAll("style"))t.textContent&&(t.textContent=i(t.textContent));for(let t of n.querySelectorAll("[style]")){let e=t.getAttribute("style");e&&t.setAttribute("style",i(e))}let o=n.createElement("style"),s="position:absolute;left:0px;bottom:0px;width:100%;overflow:hidden;vertical-align:baseline;";n.querySelector("[valign=top]")&&(s=""),o.textContent=`body{margin:0px;}html{color:white;font-family:"MS Sans Serif", sans-serif;font-size:9px;${s}}`,n.head.insertBefore(o,n.head.firstChild);let a=n.createElementNS(At,"svg");a.setAttributeNS(null,"viewBox",`0 0 ${e} ${A}`),a.setAttributeNS(null,"width",`${e}`),a.setAttributeNS(null,"height",`${A}`);let r=n.createElementNS(At,"foreignObject");return r.setAttributeNS(null,"x","0"),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"width",`${e}`),r.setAttributeNS(null,"height",`${A}`),a.appendChild(r),r.appendChild(n.documentElement),(new XMLSerializer).serializeToString(a)}(t,e,A),i=new Image,o=`data:image/svg+xml;base64,${btoa(String.fromCharCode(...(new TextEncoder).encode(n)))}`;return await new Promise((async(t,e)=>{i.onload=t,i.onerror=e,i.src=o})),i}class it{constructor(t){var e,A;this.ui=t,this.atlas_textures=[],this.curr_blend_mode=-1,this.attrib_arrays_enabled=[];let n=document.createElement("canvas");if(this.gl2=null!==(e=n.getContext("webgl2",{desynchronized:!0,powerPreference:"high-performance"}))&&void 0!==e?e:void 0,this.gl2)this.gl=this.gl2;else{let t=n.getContext("webgl",{desynchronized:!0,alpha:!1});if(!t)throw new Error("Could not initialize WebGL");this.gl=t}const i=this.gl,o=this.gl2;if(o)this.instance_arrays={VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:o.VERTEX_ATTRIB_ARRAY_DIVISOR,drawArraysInstancedANGLE:o.drawArraysInstanced.bind(o),drawElementsInstancedANGLE:o.drawElementsInstanced.bind(o),vertexAttribDivisorANGLE:o.vertexAttribDivisor.bind(o)};else{let t=i.getExtension("ANGLE_instanced_arrays");if(!t)throw new Error("ANGLE_instanced_arrays is not supported");this.instance_arrays=t}this.vao=null!==(A=i.getExtension("OES_vertex_array_object"))&&void 0!==A?A:void 0,this.white_texture=V(i.createTexture()),i.bindTexture(i.TEXTURE_2D,this.white_texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),i.bindTexture(i.TEXTURE_2D,null),this.copy_framebuffer=V(i.createFramebuffer()),this.max_texture_size=Math.min(i.getParameter(i.MAX_TEXTURE_SIZE),32768),this.canvas_copy=V(i.createTexture()),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this.canvas_copy),this.square_buffer=V(i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,this.square_buffer),i.bufferData(i.ARRAY_BUFFER,new Float32Array([1,0,0,1,0,0,1,0,1,1,0,1]),i.STATIC_DRAW),i.enable(i.BLEND),i.enable(i.SCISSOR_TEST),this.shader=Z(i,!1),this.shader_matrix=Z(i,!0),this.shader_copy=function(t){let e=et(t,"\n\tprecision mediump float;\n\tattribute vec2 a_position;\n\tattribute vec2 a_size;\n\tattribute vec2 a_from;\n\tattribute vec2 a_to;\n\tuniform vec2 u_texture_size;\n\tvarying vec2 v_uv;\n\tvoid main() {\n\t\tv_uv = (a_size * a_position + a_from) / u_texture_size;\n\t\tgl_Position = vec4((mix(vec2(0,0), a_size, a_position) + a_to) / u_texture_size * 2.0 - vec2(1,1), 0, 1.0);\n\t}\n\t","\n\tprecision mediump float;\n\tuniform sampler2D u_texture;\n\tvarying vec2 v_uv;\n\tuniform vec2 u_texture_size;\n\tvoid main() {\n\t\tgl_FragColor = texture2D(u_texture, v_uv);\n\t}"),A={shader:e,a_position:t.getAttribLocation(e,"a_position"),a_from:t.getAttribLocation(e,"a_from"),a_to:t.getAttribLocation(e,"a_to"),a_size:t.getAttribLocation(e,"a_size"),u_texture:V(t.getUniformLocation(e,"u_texture")),u_texture_size:V(t.getUniformLocation(e,"u_texture_size")),vao:null,all_attrib_arrays:[]};return A.all_attrib_arrays.push(A.a_position,A.a_from,A.a_to,A.a_size),A.vao=$(t,A.all_attrib_arrays),A}(i),this.viewport_canvas={x:0,y:0,width:1,height:1,elem:document.createElement("canvas")},this.ui.viewport.add_viewport_element(this.viewport_canvas)}async process_frame_data(t,e,A){const n=this.gl,i=this.instance_arrays;let o={x:0,y:0,width:0,height:0},s={x:0,y:0,width:0,height:0},a=this.ui.viewport.icon_width,r=this.ui.viewport.icon_height,l=0,h=0;for(let e of t)"viewport"==e.cmd&&(l=Math.max(l,Math.ceil(e.x+e.width)),h=Math.max(h,Math.ceil(e.y+e.height)));n.canvas.widthObject.assign(Object.assign({},t),{data:await nt(t.maptext,t.width,t.height)})))),A=V(this.atlas_textures[e.index]);n.bindTexture(n.TEXTURE_2D,A.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0);for(let e of t)try{n.texSubImage2D(n.TEXTURE_2D,0,e.x,e.y,n.RGBA,n.UNSIGNED_BYTE,e.data)}catch(t){console.warn(e.maptext),console.error(t),n.texSubImage2D(n.TEXTURE_2D,0,e.x,e.y,e.width,e.height,n.RGBA,n.UNSIGNED_BYTE,null)}n.bindTexture(n.TEXTURE_2D,null)}else if("atlastexcopywithin"==e.cmd){let t=V(this.atlas_textures[e.index]),A=this.shader_copy;this.set_shader(A),n.disable(n.BLEND),n.disable(n.SCISSOR_TEST),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,this.copy_framebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t.texture,0),n.viewport(0,0,t.width,t.height),n.bindTexture(n.TEXTURE_2D,t.static_copy_texture),t.static_copy_dirty&&(n.copyTexSubImage2D(n.TEXTURE_2D,0,0,0,0,0,t.width,t.height),t.static_copy_dirty=!1);let o=new Float32Array(6*e.parts.length),s=0;for(let t of e.parts)o[s+0]=t.x1,o[s+1]=t.y1,o[s+2]=t.x2,o[s+3]=t.y2,o[s+4]=t.width,o[s+5]=t.height,s+=6;n.uniform1i(A.u_texture,0),n.uniform2f(A.u_texture_size,t.width,t.height),n.bindBuffer(n.ARRAY_BUFFER,this.square_buffer),n.vertexAttribPointer(A.a_position,2,n.FLOAT,!1,0,0);let a=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STREAM_DRAW),n.vertexAttribPointer(A.a_from,2,n.FLOAT,!1,24,0),n.vertexAttribPointer(A.a_to,2,n.FLOAT,!1,24,8),n.vertexAttribPointer(A.a_size,2,n.FLOAT,!1,24,16),i.vertexAttribDivisorANGLE(A.a_position,0),i.vertexAttribDivisorANGLE(A.a_from,1),i.vertexAttribDivisorANGLE(A.a_to,1),i.vertexAttribDivisorANGLE(A.a_size,1),i.drawArraysInstancedANGLE(n.TRIANGLES,0,6,e.parts.length),n.deleteBuffer(a),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindTexture(n.TEXTURE_2D,null),n.enable(n.BLEND),n.enable(n.SCISSOR_TEST)}else if("batchdraw"==e.cmd){let t=V(this.atlas_textures[e.atlas_index]);this.set_blend_mode(e.blend_mode);let A=e.use_color_matrix?this.shader_matrix:this.shader;this.set_shader(A),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,t.texture),n.uniform1i(A.u_texture,0),n.uniform2f(A.u_texture_size,t.width,t.height),n.uniform2f(A.u_viewport_size,o.width*a,o.height*r),n.uniform2f(A.u_viewport_center,(o.x+o.width/2)*a,(o.y+o.height/2)*r),n.uniform1f(A.u_zoom,1);let s=4*(e.use_color_matrix?31:15);n.bindBuffer(n.ARRAY_BUFFER,this.square_buffer),n.vertexAttribPointer(A.a_position,2,n.FLOAT,!1,0,0);let l=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,l),n.bufferData(n.ARRAY_BUFFER,e.data,n.STREAM_DRAW),n.vertexAttribPointer(A.a_transform_x,3,n.FLOAT,!1,s,0),n.vertexAttribPointer(A.a_transform_y,3,n.FLOAT,!1,s,12),n.vertexAttribPointer(A.a_uv,4,n.FLOAT,!1,s,24),n.vertexAttribPointer(A.a_layer,1,n.FLOAT,!1,s,40);for(let t=0;t{let o=await createImageBitmap(e,t.x,n.canvas.height-t.height-t.y,t.width,t.height),s=this.viewport_canvas.elem,r=V(s.getContext("2d"));s.width!=t.width&&(s.width=t.width),s.height!=t.height&&(s.height=t.height),r.globalCompositeOperation="copy",r.drawImage(o,0,0),Object.assign(this.viewport_canvas,A),a?(Object.assign(this.ui.viewport.followview,a),this.ui.viewport.followview.elem.style.display="block"):this.ui.viewport.followview.elem.style.display="none";let l=this.ui.viewport.current_follow;i&&l&&i.ref==l.ref&&(null!=i.x&&(null!=l.x?this.ui.viewport.x+=i.x-l.x:this.ui.viewport.x=i.x),null!=i.y&&(null!=l.y?this.ui.viewport.y+=i.y-l.y:this.ui.viewport.y=i.y),this.ui.viewport.current_follow=i),this.ui.viewport.update_viewport()}))}else if("copytocanvas"==e.cmd){let t=s,i=e.canvas_index;d.push((async e=>{let o=await createImageBitmap(e,t.x,n.canvas.height-t.height-t.y,t.width,t.height),s=A[i],a=V(s.getContext("2d"));s.width!=t.width&&(s.width=t.width),s.height!=t.height&&(s.height=t.height),a.globalCompositeOperation="copy",a.drawImage(o,0,0)}))}else if("flush"==e.cmd){if(d.length){let t=1==d.length?n.canvas:await createImageBitmap(n.canvas);await Promise.all(d.map((e=>e(t))))}d.length=0}}create_blank_texture(t,e){const A=this.gl,n=this.gl2,i=V(A.createTexture());return A.bindTexture(A.TEXTURE_2D,i),n?n.texStorage2D(A.TEXTURE_2D,1,A.RGBA8,t,e):A.texImage2D(A.TEXTURE_2D,0,A.RGBA,t,e,0,A.RGBA,A.UNSIGNED_BYTE,null),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),i}set_blend_mode(t){if(t==this.curr_blend_mode)return;this.curr_blend_mode=t;const e=this.gl;switch(t){case 1:default:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 3:e.blendEquation(e.FUNC_REVERSE_SUBTRACT),e.blendFuncSeparate(e.ONE,e.ONE,e.ZERO,e.ONE);break;case 4:case 6:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;case 5:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;case 7:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE)}}set_shader(t){if(t==this.curr_shader)return;this.curr_shader=t;this.gl.useProgram(t.shader),this.vao?this.vao.bindVertexArrayOES(t.vao):this.gl2?this.gl2.bindVertexArray(t.vao):this.update_vertex_attrib_arrays(...t.all_attrib_arrays)}update_vertex_attrib_arrays(...t){const e=this.gl;let A=[];for(let e of t)A[e]=!0;let n=Math.max(this.attrib_arrays_enabled.length,A.length);for(let t=0;t{if(!e)return null;t.bindFramebuffer(t.FRAMEBUFFER,this.copy_framebuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.texture,0);let A=new ImageData(e.width,e.height);t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,A.data);let n=document.createElement("canvas");n.width=e.width,n.height=e.height;let i=n.getContext("2d");return i?(i.putImageData(A,0,0),n.toDataURL()):void 0}));t.bindFramebuffer(t.FRAMEBUFFER,null);let A=window.open(void 0,"_blank");A&&(A.document.head.innerHTML='',A.document.body.innerHTML=e.map((t=>``)).join())}}var ot="inspector_main_canvas__2Tcvo",st="inspector_other_canvas__MSfqJ",at="inspector_name__gy0jz",rt="inspector_ref__4yQ7y",lt="inspector_clear__p0OKj",ht="inspector_subobject__wqpLv",dt="inspector_inspect_button__bNfXq",gt="inspector_follow_button__PCSpI";n(".inspector_main_canvas__2Tcvo {\n width: 128px;\n height: 128px;\n float: left;\n}\n\n.inspector_other_canvas__MSfqJ {\n width: 64px;\n height: 64px;\n float: left;\n}\n\n.inspector_name__gy0jz {\n color: white;\n display: block;\n margin-top: 0.1em;\n}\n\n.inspector_ref__4yQ7y {\n color: grey;\n display: block;\n}\n\n.inspector_clear__p0OKj {\n clear: both;\n}\n\n.inspector_subobject__wqpLv {\n margin-bottom: 2px;\n}\n\n.inspector_inspect_button__bNfXq, .inspector_follow_button__PCSpI {\n cursor: pointer;\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n line-height: 1em;\n min-height: 2.5em;\n margin: 0px;\n padding: 0px;\n padding-left: 10px;\n padding-right: 10px;\n text-align: left;\n}\n.inspector_inspect_button__bNfXq:hover, .inspector_follow_button__PCSpI:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.inspector_inspect_button__bNfXq {\n width: 100%;\n}\n\n.inspector_follow_button__PCSpI {\n padding-top: 0.25em;\n padding-bottom: 0.25em;\n}");class _t extends y{constructor(t,e){super("Inspector"),this.ui=t,this.ref=e,this.canvases=new Map,this.main_name=document.createElement("h3"),this.main_ref=document.createElement("div"),this.spinner=new S,this.clients_label=document.createElement("h3"),this.clients_elem=document.createElement("div"),this.location_label=document.createElement("h3"),this.location_elem=document.createElement("div"),this.contents_label=document.createElement("h3"),this.contents_elem=document.createElement("div"),this.follow_button=document.createElement("button"),this.handle_global_click=t=>{var e;if(!(t.target instanceof HTMLElement))return;let A=t.target.closest("."+dt);if(A){let n=null===(e=A.parentElement)||void 0===e?void 0:e.dataset.ref;n&&(t.ctrlKey?this.ui.open_inspector(+n):this.change_to_ref(+n))}},this.update_contents_callback=t=>{var e,A,n;if(t.ref!=this.ref)return void console.warn(`Received non-matching ref on inspecter, [0x${t.ref.toString(16)}] != [0x${this.ref.toString(16)}]`);let i=!!document.activeElement&&this.panel_div.contains(document.activeElement);this.follow_button.style.display=t.ref>>24!=1?"inline-block":"none",this.spinner.element.style.display="none",this.main_name.textContent=t.name,this.main_ref.textContent=`[0x${t.ref.toString(16)}]`,this.canvases.get(this.main_canvas)!=t.ref&&this.add_canvas(this.main_canvas,t.ref);let o=t.loc;t.ref>>24==1||o||(o={name:"null",ref:0}),this.create_object_element(o,this.location_elem),this.location_label.style.display=o?"block":"none";let s=[];for(let e of t.contents){let t=this.create_object_element(e,this.contents_elem.querySelector(`div[data-ref="${e.ref}"]`));s.push(t)}for(let A=0;At.contents.length;)this.remove_canvas(null===(A=this.contents_elem.lastElementChild)||void 0===A?void 0:A.querySelector("canvas")),this.contents_elem.removeChild(this.contents_elem.lastElementChild);let a=[];for(let e of t.clients){let t=this.contents_elem.querySelector(`div[data-client="${e}"]`);if(!t){t=document.createElement("button");let A=document.createElement("span");A.textContent="Follow Client";let n=document.createElement("span");n.classList.add(rt),n.textContent=e,t.dataset.client=e,t.append(A,n),t.style.display=this.ref>>24!=1?"inline-block":"none",t.classList.add(gt),t.addEventListener("click",this.ui.viewport.follow.bind(this.ui.viewport,e))}a.push(t)}for(let e=0;et.clients.length;)this.clients_elem.removeChild(this.clients_elem.lastElementChild);this.contents_label.style.display=t.contents.length?"block":"none",i&&this.panel_div.focus()},this.panel_div.style.setProperty("--min-width","300px"),this.panel_div.style.setProperty("--max-width","600px"),this.panel_div.style.setProperty("--max-height","750px"),this.main_canvas=document.createElement("canvas"),this.main_canvas.classList.add(ot),this.content_div.appendChild(this.main_canvas),this.add_canvas(this.main_canvas,e),this.main_name.classList.add(at),this.content_div.appendChild(this.main_name),this.main_ref.textContent=`[0x${e.toString(16)}]`,this.main_ref.classList.add(rt),this.content_div.appendChild(this.main_ref),this.follow_button.textContent="Follow Object",this.follow_button.style.display=this.ref>>24!=1?"inline-block":"none",this.follow_button.classList.add(gt),this.follow_button.addEventListener("click",(()=>{t.viewport.follow(this.ref)})),this.content_div.append(this.follow_button),this.content_div.appendChild(this.clients_elem);let A=document.createElement("hr");A.classList.add(lt),this.content_div.appendChild(A),this.content_div.appendChild(this.spinner.element),this.location_label.style.display="none",this.location_label.textContent="Location",this.contents_label.style.display="none",this.contents_label.textContent="Contents",this.content_div.append(this.location_label,this.location_elem,this.contents_label,this.contents_elem),this.content_div.addEventListener("click",this.handle_global_click),this.addEventListener("close",(()=>{this.detach_hooks();let t=this.ui.inspectors.indexOf(this);t>=0&&this.ui.inspectors.splice(t,1)})),this.addEventListener("open",(()=>{this.attach_hooks(),this.ui.inspectors.push(this)}))}attach_hooks(){for(let[t,e]of this.canvases)this.ui.object_canvases.set(t,{ref:e});this.remove_inspector_callback||(this.remove_inspector_callback=this.ui.player.add_inspect_listener(this.ref,e.proxy(this.update_contents_callback)))}detach_hooks(){for(let t of this.canvases.keys())this.ui.object_canvases.delete(t);this.remove_inspector_callback&&(this.remove_inspector_callback.then((t=>{t(),t[e.releaseProxy]()})),this.remove_inspector_callback=void 0)}add_canvas(t,e){this.canvases.get(t)!=e&&(this.canvases.set(t,e),this.is_open&&this.ui.object_canvases.set(t,{ref:e}))}remove_canvas(t){t&&(this.canvases.delete(t),this.ui.object_canvases.delete(t))}change_to_ref(t){t!=this.ref&&(this.is_open?(this.detach_hooks(),this.ref=t,this.attach_hooks()):this.ref=t)}create_object_element(t,e){if(e||(e=document.createElement("div")),e.classList.add(ht),t){e.style.display="block",e.dataset.ref=""+t.ref;let A=e.querySelector("."+dt);A||(A=document.createElement("button"),A.classList.add(dt),e.appendChild(A));let n=e.querySelector("canvas");n||(n=document.createElement("canvas"),n.classList.add(st),A.appendChild(n)),this.add_canvas(n,t.ref);let i=e.querySelector("."+at);i||(i=document.createElement("b"),i.classList.add(at),A.appendChild(i)),i.textContent=t.name;let o=e.querySelector("."+rt);if(o||(o=document.createElement("span"),o.classList.add(rt),A.appendChild(o)),o.textContent=`[0x${t.ref.toString(16)}]`,!e.querySelector("."+lt)){let t=document.createElement("div");t.classList.add(lt),A.appendChild(t)}}else e.style.display="none",e.dataset.ref="",this.remove_canvas(e.querySelector("canvas"));return e}}class ct{constructor(t){this.ui=t,this.ctx=new AudioContext,this.sound_buffers=[]}get_sound_buffer(t){if(this.sound_buffers[t])return this.sound_buffers[t];let e=this.ui.player.get_resource_blob(t).then((async t=>{try{return await this.ctx.decodeAudioData(await t.arrayBuffer())}catch(t){return void console.error(t)}}));return e.catch((A=>{this.sound_buffers[t]==e&&(this.sound_buffers[t]=void 0)})),this.sound_buffers[t]=e,e}async play(t){let e;for(let A of t.resources){try{e=await this.get_sound_buffer(A)}catch(t){}if(e)break}if(!e)return;let A=this.ctx.createBufferSource();A.buffer=e,0!=t.frequency&&(t.frequency>=-100&&t.frequency<=100?A.playbackRate.value=t.frequency:A.playbackRate.value=t.frequency/e.sampleRate);let n=A,i=this.ctx.createGain();if(n.connect(i),n=i,i.gain.value=t.volume/100,t.x||t.y||t.z){let e=this.ctx.createPanner();n.connect(e),n=e,e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=-t.z,e.rolloffFactor=t.falloff}n.connect(this.ctx.destination),A.start()}handle_sounds(t){console.log(t);for(let e of t)this.play(e)}}class pt{constructor(t){this.player=t,this.inspectors=[],this.chat_windows=[],this.object_canvases=new Map,this.corner_container=document.createElement("div"),this.menu_button=document.createElement("button"),this.nerdy_stats=document.createElement("pre"),this.hash_z=2,window.demo_player_ui=this,t.ui=e.proxy(this),this.viewport=new W(this),this.gl_holder=new it(this),this.time_controls=new d(this),this.sound_player=new ct(this),document.body.appendChild(this.corner_container),this.corner_container.classList.add(i),this.corner_container.appendChild(this.menu_button),this.menu_button.classList.add(o),this.corner_container.appendChild(this.nerdy_stats),this.nerdy_stats.classList.add(s),this.menu_button.addEventListener("click",(()=>{this.menu||(this.menu=new G(this)),this.menu.put_below(this.menu_button),this.menu.open(!0)})),t.initialize_ui(),this.frame_loop(),"false"!=T.get("startup_chat")&&new Y(this).open(),this.update_from_hash(),window.addEventListener("hashchange",this.update_from_hash.bind(this))}async frame_loop(){try{let t,e=await new Promise(requestAnimationFrame),A=await new Promise(requestAnimationFrame),n=NaN,i=NaN,o=NaN,s=[],a=async(t,e,A)=>{let n=performance.now(),o=await this.player.run_frame(t,e,this.viewport.get_turf_window(),A),s=performance.now();return i=s-n,o};for(;;){let r=A-e;n=1e3/r;let l=this.time_controls.playback_speed_override||this.time_controls.playback_speed;this.time_controls.dragging&&(l=0);let h=[],d=[];for(let[t,e]of this.object_canvases){let A=t.getBoundingClientRect();0!=A.width&&0!=A.height&&(0==e.ref?t.width=t.width:(h.push({width:A.width*devicePixelRatio,height:A.height*devicePixelRatio,ref:e.ref}),d.push(t))),e.remove_when_done&&this.object_canvases.delete(t)}let g=a(r,l,h);if(t){let e=performance.now();await this.gl_holder.process_frame_data(t,A,s),o=performance.now()-e}this.viewport.update_viewport(),t=await g,s=d,this.viewport.update_nerdy_stats(`FPS: ${n.toFixed(2)}\nFrame time (worker): ${i.toFixed(2)}ms\nWebGL time: ${o.toFixed(2)}ms\nExtra canvases: ${d.length}/${this.object_canvases.size}`),e=A,A=await new Promise(requestAnimationFrame)}}catch(t){this.report_error(t)}}report_error(t){"stack"in t?t=t+","+t.stack:t+="",this.viewport.update_nerdy_stats(t),console.error(t)}update_time(t){this.time_controls.update_time(t)}update_duration(t){this.time_controls.update_duration(t)}open_inspector(t){for(let e of this.inspectors)if(t==e.ref)return void e.take_focus();new _t(this,t).open(!0)}update_hash(t){null!=t&&(this.hash_z=t);let e="null";if(this.viewport.current_follow){let t=this.viewport.current_follow.ref;e="string"==typeof t?t:`[0x${t.toString(16)}]`}let A=`#${Math.round(this.time_controls.current_time)};${this.viewport.x.toFixed(2)};${this.viewport.y.toFixed(2)};${this.hash_z};${e};${this.viewport.log_zoom.toFixed(1)}`;A!=window.location.hash&&history.replaceState("","",A)}update_from_hash(t){let e=window.location.hash||"";if("#"==e[0]&&(e=e.substring(1)),t&&t.newURL.includes("#")&&(e=t.newURL.substring(t.newURL.indexOf("#")+1)),e.length){let t=e.split(";");if(+t[0]==+t[0]&&this.player.advance_time(+t[0]),+t[1]==+t[1]&&(this.viewport.x=+t[1],this.viewport.update_viewport()),+t[2]==+t[2]&&(this.viewport.y=+t[2],this.viewport.update_viewport()),+t[3]==+t[3]&&(this.player.z_level=+t[3]),+t[5]==+t[5]&&(this.viewport.log_zoom=+t[5],this.viewport.update_viewport()),"null"==t[4])this.viewport.follow(null);else{let e,A=t[4];e="["==A[0]?+A.substring(1,A.length-1):A,this.viewport.follow(e)}}}handle_sounds(t){this.sound_player.handle_sounds(t)}async dump_textures(){this.gl_holder.dump_textures()}}const ut=document.createElement("canvas"),It=ut.getContext("webgl2")||ut.getContext("webgl"),Ct=document.createElement("canvas"),Et=null==It?void 0:It.getParameter(It.MAX_TEXTURE_SIZE);async function mt(t){if(!It)throw new Error("Could not load image - webgl not available");t.type.startsWith("image/")||(t=new Blob([t],{type:"image/png"}));let A=await createImageBitmap(t,{premultiplyAlpha:"none"}),n=A.width,i=A.height;if(n>Et||i>Et){console.warn(`Image of size ${n}x${i} exceeds maximum WebGL texture size of ${Et} - falling back to canvas2d for loading. Colors in transparent parts will be mangled.`);const t=V(Ct.getContext("2d"));Ct.width=n,Ct.height=i,t.drawImage(A,0,0);let o=t.getImageData(0,0,n,i);return e.transfer(new Uint8Array(o.data.buffer),[o.data.buffer])}let o=It.createFramebuffer();It.bindFramebuffer(It.FRAMEBUFFER,o);let s=It.createTexture(),a=new Uint8Array(n*i*4);return It.activeTexture(It.TEXTURE0),It.bindTexture(It.TEXTURE_2D,s),It.pixelStorei(It.UNPACK_FLIP_Y_WEBGL,!1),It.texImage2D(It.TEXTURE_2D,0,It.RGBA,It.RGBA,It.UNSIGNED_BYTE,A),It.framebufferTexture2D(It.FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_2D,s,0),It.readPixels(0,0,n,i,It.RGBA,It.UNSIGNED_BYTE,a),It.deleteTexture(s),It.bindFramebuffer(It.FRAMEBUFFER,null),It.deleteFramebuffer(o),e.transfer(a,[a.buffer])}class Bt{constructor(t){this.exports=t.exports,this.memory=this.exports.memory,this.ptr=this.exports.create_context(),this._refresh(),this.bufSize=this.mem32[0],this.inStart=this.mem32[1]-this.ptr,this.inEnd=this.inStart+this.bufSize,this.outStart=this.mem32[4]-this.ptr}supplyInput(t){this.mem8.subarray(this.inStart,this.inEnd).set(t,0),this.exports.supply_input(this.ptr,t.byteLength),this._refresh()}getNextOutput(){const t=this.exports.get_next_output(this.ptr);if(this._refresh(),0!==t&&1!==t)throw new Error(`get_next_output failed with error code ${t}`);return{outChunk:this.mem8.slice(this.outStart,this.outStart+this.mem32[5]),finished:1===t}}needsMoreInput(){return this.mem32[2]===this.mem32[3]}outputBufferIsFull(){return this.mem32[5]===this.bufSize}resetOutputBuffer(){this.outPos=this.mem32[5]=0}dispose(){this.exports.destroy_context(this.ptr),this.exports=null}_refresh(){var t;this.memory.buffer!==(null===(t=this.mem8)||void 0===t?void 0:t.buffer)&&(this.mem8=new Uint8Array(this.memory.buffer,this.ptr),this.mem32=new Uint32Array(this.memory.buffer,this.ptr))}}class Qt extends ReadableStream{constructor(t){let e,A=null;const n=t.getReader();super({async start(t){Qt._moduleInstance||await(Qt._moduleInstancePromise||(Qt._moduleInstancePromise=Qt._getModuleInstance())),e=new Bt(Qt._moduleInstance)},async pull(t){if(e.needsMoreInput()){if(null===A||0===A.byteLength){const{done:t,value:e}=await n.read();t||(A=e)}const t=Math.min(e.bufSize,A.byteLength);e.supplyInput(A.subarray(0,t)),A=A.subarray(t)}const i=e.getNextOutput();t.enqueue(i.outChunk),e.resetOutputBuffer(),i.finished&&(e.dispose(),t.close())},cancel:()=>(e.dispose(),n.cancel())})}static async _getModuleInstance(){const t=await(await fetch("data:application/wasm;base64,AGFzbQEAAAABOApgAX8Bf2ABfwBgAABgA39/fwF/YAABf2ACf38AYAN/f34BfmACf38Bf2AEf39/fwF/YAN/f38AAx4dAAABAgMDAwMEAQUAAgMCBgcIAwMHAQcABwcBAwkEBQFwAQEBBQMBAAIGCAF/AUHwoAQLB04FBm1lbW9yeQIADmNyZWF0ZV9jb250ZXh0AAgPZGVzdHJveV9jb250ZXh0AAkMc3VwcGx5X2lucHV0AAoPZ2V0X25leHRfb3V0cHV0AAsK718d3wIBBX9BACEBAkAgAEEHaiICQRBJDQBBASEBIAJBA3YiA0ECRg0AQQ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0AIAAoAgQhBAwBCyAAIANBCHQiAzYCACAAIAAoAhAiBUEBajYCECAAIAAoAgRBCHQgBSAAKAIMai0AAHIiBDYCBAsCQAJAIAQgA0ELdiABLwEAIgZsIgVPDQAgACAFNgIAIAEgBkGAECAGa0EFdmo7AQAgASACQQR0akEEaiEHQQghCEECIQkMAQsgACAEIAVrIgQ2AgQgACADIAVrIgM2AgAgASAGIAZBBXZrOwEAAkAgA0H///8HSw0AIAAgA0EIdCIDNgIAIAAgACgCECIFQQFqNgIQIAAgBEEIdCAFIAAoAgxqLQAAciIENgIECwJAIAQgA0ELdiABLwECIgZsIgVPDQAgACAFNgIAIAEgBkGAECAGa0EFdmo7AQIgASACQQR0akGEAmohB0EIIQhBCiEJDAELIAAgBCAFayIENgIEIAAgAyAFayIFNgIAIAEgBiAGQQV2azsBAiABQYQEaiEHQYACIQhBEiEJCyAAQegAaiAJNgIAQQEhAQNAIAcgAUEBdCIBaiEDAkACQCAFQf///wdNDQAgBSECDAELIAAgBUEIdCICNgIAIAAgACgCECIFQQFqNgIQIAAgBEEIdCAFIAAoAgxqLQAAciIENgIECwJAAkAgBCACQQt2IAMvAQAiBmwiBUkNACAAIAQgBWsiBDYCBCAAIAIgBWsiBTYCACADIAYgBkEFdms7AQAgAUEBciEBDAELIAAgBTYCACADIAZBgBAgBmtBBXZqOwEACyABIAhJDQALIABB6ABqIAEgCGsgCWo2AgALCzUBAEGACAsuCAAAABAAAAAYAAAAIAAAACgAAAAwAAAAQAAAAFAAAACAAAAAAAEAAP03elhaAA==")).arrayBuffer(),e=new Response(t,{headers:{"Content-Type":"application/wasm"}}),A={},n="function"==typeof WebAssembly.instantiateStreaming?await WebAssembly.instantiateStreaming(e,A):await WebAssembly.instantiate(await e.arrayBuffer(),A);Qt._moduleInstance=n.instance}}class ft extends ReadableStream{constructor(t){let e,A=!1;[t,e]=t.tee();let n=t.getReader();super({pull:async t=>{let i=await n.read();i.done?t.close():(A||(A=!0,253==i.value[0]?(n.cancel(),n=new Qt(e).getReader(),i=await n.read()):e.cancel()),i.done?t.close():t.enqueue(i.value))},cancel:async()=>(e.cancel(),t.cancel(),await n.cancel())})}}class wt{constructor(){this._ended=!1,this._canceled=!1,this._readers=[],this._continue_cb=void 0,this.bytes_read=0,this._empty_callbacks=[],this.readable=new ReadableStream({pull:async t=>{let e=!1;for(;!e;){for(;!this._ended&&!this._readers.length;){for(let t of this._empty_callbacks)t();if(this._empty_callbacks.length=0,this._continue_cb)throw new Error("Multiple pulls!");await new Promise((t=>{this._continue_cb=t}))}if(this._readers.length){let A=this._readers[0],n=await A.read();if(n.done){if(A!=this._readers[0])throw new Error("Reader queue head got changed while reading");this._readers.shift()}else n.value instanceof Uint8Array&&(this.bytes_read+=n.value.length),t.enqueue(n.value),e=!0}else this._ended&&(t.close(),e=!0)}},cancel:async()=>{this._canceled=!0,await Promise.all(this._readers.map((t=>t.cancel()))),this._readers.length=0}})}_continue(){if(this._continue_cb){let t=this._continue_cb;this._continue_cb=void 0,t()}}end(){this._ended=!0,this._continue()}wait_empty(){return this._ended?Promise.reject(new Error("Already ended!")):this._readers.length?new Promise((t=>this._empty_callbacks.push(t))):Promise.resolve()}add(t){if(this._ended)throw new Error("Cannot add stream: stream queue has been closed");this._canceled||(this._readers.push(t.getReader()),this._continue())}}var vt;let bt=e.wrap(new Worker("parser_worker-82dd9ce4.js"));function yt(){return bt[e.createEndpoint]().then((async t=>{let A=new MessageChannel;e.expose(mt,A.port1);let n=e.wrap(new Worker("icon_loader-ffd33460.js"));await n.set_png_loader(e.transfer(A.port2,[A.port2]));let i=await n[e.createEndpoint]();n[e.releaseProxy]();let o=await new(e.wrap(new Worker("player_worker-c2ec0794.js")))(e.transfer(t,[t]),e.transfer(i,[i]));new pt(o)}))}let xt=new S;async function Dt(t,A){await t.set_progress_callback(e.proxy((async(t,e)=>{xt.progress=t,e&&xt.fade_out()})));let n,i=A.getReader(),o=0;for(;n=await i.read(),!n.done;)o+=n.value.length,await t.handle_data(e.transfer(n.value,[n.value.buffer]))}xt.full_page=!0;let kt=null,Lt=new URLSearchParams(window.location.search);Lt.has("demo_url")?kt=Lt.get("demo_url"):Lt.has("roundid")&&(kt=`https://yogstation.net/rounds/${Lt.get("roundid")}/replay`);const Nt=kt;function St(t){return"bytes"==t.headers.get("accept-ranges")||"true"==t.headers.get("x-allow-ss13-replay-streaming")}if(Nt)document.body.appendChild(xt.element),fetch(Nt,{credentials:+(null!==(vt=Lt.get("send_credentials"))&&void 0!==vt?vt:0)?"include":"same-origin"}).then((async t=>{if(!t.ok)return document.body.textContent=`Server responded with ${t.status} ${t.statusText}`,void(document.body.style.fontSize="40px");if(!t.body)throw new Error("No stream!");let e=t.body;St(t)&&(e=function(t,e){let A=new wt;if(!t.body)throw new Error("No stream!");return A.add(t.body),A.wait_empty().then((async()=>{var n;let i=!1;for(;St(t);){if(await new Promise((t=>setTimeout(t,i?1e3:1e4))),!(t=await fetch(e,{credentials:+(null!==(n=Lt.get("send_credentials"))&&void 0!==n?n:0)?"include":"same-origin",headers:{Range:"bytes="+A.bytes_read+"-"}})).body)throw new Error("No stream!");if(206==t.status){let e=A.bytes_read;A.add(t.body),await A.wait_empty(),A.bytes_read>e&&(i=!0)}else{if(416!=t.status)break;i=!1}}A.end()})),A.readable}(t,Nt));let A=yt();return Dt(bt,new ft(e)),A})).catch((t=>{document.body.textContent=`${"stack"in t?t+", "+t.stack:t}`,document.body.style.fontSize="40px"}));else{let t=document.createElement("input");t.type="file";let e=document.createElement("input");e.type="button",e.value="Open demo from file",e.addEventListener("click",(()=>{var e;(null===(e=t.files)||void 0===e?void 0:e[0])&&(document.body.appendChild(xt.element),yt().catch((t=>{document.body.textContent=`${"stack"in t?t+", "+t.stack:t}`,document.body.style.fontSize="40px"})),Dt(bt,new ft(t.files[0].stream())))})),document.body.appendChild(t),document.body.appendChild(e)}})); +if(!self.define){let t,e={};const A=(A,n)=>(A=new URL(A+".js",n).href,e[A]||new Promise((e=>{if("document"in self){const t=document.createElement("script");t.src=A,t.onload=e,document.head.appendChild(t)}else t=A,importScripts(A),e()})).then((()=>{let t=e[A];if(!t)throw new Error(`Module ${A} didn’t register its module`);return t})));self.define=(n,i)=>{const o=t||("document"in self?document.currentScript.src:"")||location.href;if(e[o])return;let s={};const a=t=>A(t,o),r={module:{uri:o},exports:s,require:a};e[o]=Promise.all(n.map((t=>r[t]||a(t)))).then((t=>(i(...t),s)))}}define(["require","./comlink-9648aa2d","./promise_despammer-c45d8fa6"],(function(t,e,A){"use strict";function n(t,e){void 0===e&&(e={});var A=e.insertAt;if(t&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===A&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}var i="ui_corner_container__IzzWj",o="ui_menu_button__u2qWl",s="ui_nerdy_stats__JRI56";n('@charset "UTF-8";\nhtml {\n overflow: hidden;\n width: 100%;\n height: 100%;\n}\n\nbody {\n height: 100%;\n background-color: #202020;\n color: white;\n}\n\n.ui_corner_container__IzzWj {\n left: 0px;\n top: 0px;\n min-width: calc(min(100vw,200px));\n min-height: calc(min(100vh,200px));\n background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.9) 0%, transparent 50%, transparent 100%);\n background-position: top left;\n background-size: 200px 200px;\n background-repeat: no-repeat;\n position: absolute;\n z-index: 1;\n pointer-events: none;\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl {\n padding: 10px;\n margin: 5px;\n border: 0px solid transparent;\n border-radius: 100%;\n background-color: rgba(0, 0, 0, 0.2);\n transition: linear background-color 0.1s;\n box-sizing: content-box;\n width: 1em;\n height: 1em;\n font-size: 25px;\n line-height: 1em;\n cursor: pointer;\n float: left;\n color: white;\n font-weight: bold;\n pointer-events: all;\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n.ui_corner_container__IzzWj .ui_menu_button__u2qWl::after {\n content: "⋮";\n}\n.ui_corner_container__IzzWj .ui_nerdy_stats__JRI56 {\n color: #ff8888;\n font-size: 20px;\n padding: 10px;\n margin: 0px;\n top: 0px;\n left: 0px;\n max-width: 100vw;\n pointer-events: none;\n user-select: none;\n word-break: break-all;\n display: none;\n text-shadow: 0 0 3px black, 0 0 3px black, 0 0 3px black, 0 0 3px black;\n}');var a="time_controls_container__YPyNv",r="time_controls_play_button__vrV2y",l="time_controls_scrubber__7e443",h="time_controls_playing__PqjSE";n(".time_controls_container__YPyNv .time_controls_play_button__vrV2y {\n padding: 10px;\n margin: 5px;\n border: 0px solid transparent;\n border-radius: 100%;\n background-color: transparent;\n background-origin: content-box;\n background-repeat: no-repeat;\n background-size: 1em 1em;\n transition: linear background-color 0.1s;\n display: inline-block;\n box-sizing: content-box;\n width: 1em;\n height: 1em;\n font-size: 25px;\n line-height: 1em;\n cursor: pointer;\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y:hover {\n background-color: rgba(0, 0, 0, 0.6);\n}\n\n.time_controls_container__YPyNv {\n pointer-events: none;\n position: absolute;\n width: 100%;\n left: 0px;\n bottom: 0px;\n padding-top: 30px;\n padding-left: 30px;\n padding-right: 30px;\n box-sizing: border-box;\n background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);\n color: white;\n font-family: Arial, Helvetica, sans-serif;\n user-select: none;\n}\n.time_controls_container__YPyNv input[type=range].time_controls_scrubber__7e443 {\n pointer-events: auto;\n box-sizing: border-box;\n margin: 0px;\n bottom: 0px;\n margin-top: -25px;\n padding-top: 30px;\n padding-bottom: 30px;\n cursor: pointer;\n display: block;\n width: 100%;\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y {\n pointer-events: auto;\n color: white;\n /*&::after {\r\n \tcontent: \"\\23f5\\fe0e\";\r\n }\r\n &.playing::after {\r\n \tcontent: \"\\23f8\\fe0e\";\r\n }*/\n background-image: url(\"data:image/svg+xml;utf8,\");\n}\n.time_controls_container__YPyNv .time_controls_play_button__vrV2y.time_controls_playing__PqjSE {\n background-image: url(\"data:image/svg+xml;utf8,\");\n}");class d{constructor(t){this.ui=t,this.container=document.createElement("div"),this.scrubber=document.createElement("input"),this.time_span=document.createElement("span"),this.duration_span=document.createElement("span"),this.play_button=document.createElement("button"),this.playback_speed=0,this.playback_speed_override=0,this.dragging=!1,this.handle_input=t=>{this.dragging=!0,this.set_time(+this.scrubber.value),this.time_span.textContent=g(+this.scrubber.value/10),this.update_play_button()},this.handle_change=t=>{this.dragging=!1,this.set_time(+this.scrubber.value),this.update_play_button(),this.current_time=+this.scrubber.value,this.ui.update_hash()},this.play_clicked=()=>{this.playback_speed=this.playback_speed?0:1,this.playback_speed&&this.ui.sound_player.ctx.resume(),this.ui.update_hash(),this.update_play_button()},this.current_time=0,this.holding_left=!1,this.holding_right=!1,this.holding_shift=!1,this.holding_ctrl=!1,this.handle_keydown=t=>{this.holding_shift=t.shiftKey,this.holding_ctrl=t.ctrlKey,this.update_keyboard_scrubbing(),!t.defaultPrevented&&t.target instanceof Element&&(t.target==document.body||this.container.contains(t.target)||this.ui.viewport.viewport_div.contains(t.target))&&("Space"==t.code?(t.shiftKey?this.playback_speed=5!=this.playback_speed?5:1:t.ctrlKey?this.playback_speed=-3!=this.playback_speed?-3:1:this.playback_speed=0==this.playback_speed?1:0,this.playback_speed&&this.ui.sound_player.ctx.resume(),this.update_play_button(),t.preventDefault(),this.ui.update_hash()):"ArrowLeft"==t.code?(this.holding_left=!0,this.update_keyboard_scrubbing(),t.preventDefault()):"ArrowRight"==t.code&&(this.holding_right=!0,this.update_keyboard_scrubbing(),t.preventDefault()))},this.handle_keyup=t=>{this.holding_shift=t.shiftKey,this.holding_ctrl=t.ctrlKey,this.update_keyboard_scrubbing(),"ArrowLeft"==t.code&&this.holding_left?(this.holding_left=!1,this.update_keyboard_scrubbing(),this.ui.update_hash()):"ArrowRight"==t.code&&this.holding_right&&(this.holding_right=!1,this.update_keyboard_scrubbing(),this.ui.update_hash())},this.set_time=A.despam_promise(this.ui.player.advance_time),this.container.classList.add(a),document.body.appendChild(this.container),this.play_button.classList.add(r),this.play_button.addEventListener("click",this.play_clicked),this.container.appendChild(this.play_button),this.update_play_button(),this.scrubber.type="range",this.scrubber.step="0",this.scrubber.addEventListener("input",this.handle_input),this.scrubber.addEventListener("change",this.handle_change),this.scrubber.classList.add(l),this.container.appendChild(this.time_span),this.container.appendChild(document.createTextNode(" / ")),this.container.appendChild(this.duration_span),this.container.appendChild(this.scrubber),document.addEventListener("keydown",this.handle_keydown),document.addEventListener("keyup",this.handle_keyup)}update_play_button(){this.playback_speed&&!this.dragging?this.play_button.classList.add(h):this.play_button.classList.remove(h)}update_time(t){this.dragging||(this.scrubber.value=""+t,this.time_span.textContent=g(t/10),this.current_time=t)}update_duration(t){this.scrubber.max=""+t,this.duration_span.textContent=g(t/10)}update_keyboard_scrubbing(){let t=0;this.holding_left&&t--,this.holding_right&&t++,this.holding_ctrl&&this.holding_shift?this.playback_speed_override=25*t:this.holding_shift?this.playback_speed_override=5*t:this.holding_ctrl?this.playback_speed_override=.5*t:this.playback_speed_override=t}}function g(t){let e=Math.floor(t/3600),A=Math.floor((t-3600*e)/60),n=t-3600*e-60*A;return`${e}`.padStart(2,"0")+":"+`${A}`.padStart(2,"0")+":"+`${n.toFixed(1)}`.padStart(4,"0")}var _="panel_panel_container__RUahc",c="panel_modal__tISr3",p="panel_panel__lP1UC",u="panel_collapsed__AUT3E",I="panel_panel_header__U1oyu",C="panel_drag_handle__vYmvQ",E="panel_close_button__p7n3-",m="panel_docked__BM5ZK",B="panel_transparent_button__puYR-",Q="panel_collapse_button__lWTen",f="panel_menu_button__GIbSs",w="panel_panel_content__WKUhB",v="panel_positioned__EoLI3",b="panel_transparent__IDtA-";n('@charset "UTF-8";\n.panel_panel_container__RUahc {\n position: absolute;\n left: 0px;\n top: 0px;\n width: 100%;\n height: 100%;\n pointer-events: none;\n display: flex;\n align-content: center;\n justify-content: center;\n z-index: 10;\n}\n.panel_panel_container__RUahc > * {\n pointer-events: auto;\n}\n\n.panel_panel_container__RUahc.panel_modal__tISr3 {\n pointer-events: auto;\n}\n\n.panel_panel__lP1UC {\n --min-width: 0px;\n --max-width: 100vw;\n --min-height: 0px;\n --max-height: 100vh;\n --highlight-color: #40628a;\n --highlight-color-text: #8ba5c4;\n display: inline-flex;\n flex-direction: column;\n max-width: calc(min(max(200px, var(--max-width)), 100vw));\n max-height: calc(min(max(90px, var(--max-height)), 100vh));\n min-width: calc(min(max(200px, var(--min-width)), 100vw));\n min-height: calc(min(max(90px, var(--min-height)), 100vh));\n background-color: #202020;\n box-sizing: border-box;\n border: 1px solid var(--highlight-color);\n margin: auto;\n color: white;\n font-family: Verdana, Geneva, sans-serif;\n font-size: 17px;\n box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);\n scrollbar-width: thin;\n}\n.panel_panel__lP1UC.panel_collapsed__AUT3E {\n min-height: 0px;\n}\n.panel_panel__lP1UC :focus {\n outline: none;\n}\n\n.panel_panel_header__U1oyu {\n margin: 0px;\n display: block;\n padding: 0px;\n background-color: #303030;\n font-size: 20px;\n min-height: 2em;\n line-height: 2em;\n user-select: none;\n color: var(--highlight-color-text);\n touch-action: pinch-zoom;\n overflow-y: hidden;\n flex-grow: 0;\n}\n.panel_panel_header__U1oyu button {\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n margin: 0px;\n font-family: sans-serif;\n vertical-align: middle;\n padding-left: 15px;\n padding-right: 15px;\n}\n.panel_panel_header__U1oyu button:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n.panel_panel_header__U1oyu span {\n vertical-align: middle;\n}\n.panel_panel__lP1UC:focus-within .panel_panel_header__U1oyu {\n color: #e9c183;\n}\n\n.panel_drag_handle__vYmvQ {\n box-sizing: border-box;\n touch-action: pinch-zoom;\n cursor: nwse-resize;\n}\n.panel_drag_handle__vYmvQ::after {\n content: "";\n float: right;\n margin-top: -40px;\n height: 0px;\n width: 0px;\n border-bottom: 20px solid var(--highlight-color);\n border-right: 20px solid var(--highlight-color);\n border-top: 20px solid transparent;\n border-left: 20px solid transparent;\n}\n.panel_collapsed__AUT3E .panel_drag_handle__vYmvQ {\n display: none;\n}\n\n.panel_close_button__p7n3- {\n float: right;\n}\n.panel_close_button__p7n3-::after {\n content: "×";\n display: inline-block;\n transform: scale(2);\n}\n\n.panel_dock_button__ha0bW {\n float: right;\n}\n.panel_dock_button__ha0bW::after {\n content: "◨";\n}\n.panel_docked__BM5ZK .panel_dock_button__ha0bW::after {\n content: "▣";\n}\n\n.panel_transparent_button__puYR- {\n float: right;\n}\n.panel_transparent_button__puYR-::after {\n content: "α";\n}\n.panel_docked__BM5ZK .panel_transparent_button__puYR-, button.panel_docked__BM5ZK .panel_transparent_button__puYR-:hover {\n background-color: transparent;\n color: grey;\n}\n\n.panel_collapse_button__lWTen {\n float: left;\n}\n.panel_collapse_button__lWTen::after {\n display: inline-block;\n content: "▼";\n transition: linear 0.1s transform;\n}\n.panel_collapsed__AUT3E .panel_collapse_button__lWTen::after {\n transform: rotate(-180deg);\n}\n\n.panel_menu_button__GIbSs {\n float: right;\n}\n.panel_menu_button__GIbSs::after {\n display: inline-block;\n content: "⋮";\n}\n\n.panel_panel_content__WKUhB {\n padding: 8px;\n padding-bottom: 40px;\n overflow: auto;\n flex-grow: 1;\n}\n.panel_collapsed__AUT3E .panel_panel_content__WKUhB {\n display: none;\n}\n\n.panel_positioned__EoLI3.panel_panel_container__RUahc {\n display: block;\n}\n.panel_positioned__EoLI3 .panel_panel__lP1UC {\n position: sticky;\n margin: 0px;\n}\n\n.panel_panel__lP1UC.panel_transparent__IDtA- {\n background-color: rgba(0, 0, 0, 0.1);\n border: none;\n pointer-events: none;\n box-shadow: none;\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_panel_header__U1oyu {\n pointer-events: all;\n border: 1px solid var(--highlight-color);\n box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_panel_content__WKUhB {\n padding: 9px;\n padding-top: 7px;\n text-shadow: 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black;\n overflow: hidden;\n}\n.panel_panel__lP1UC.panel_transparent__IDtA- .panel_drag_handle__vYmvQ {\n display: none;\n}');class y extends EventTarget{constructor(t="Title",e=!1){super(),this.container_div=document.createElement("div"),this.panel_div=document.createElement("div"),this.header_div=document.createElement("div"),this.content_div=document.createElement("div"),this.close_button=document.createElement("button"),this.collapse_button=document.createElement("button"),this.title_span=document.createElement("span"),this.drag_handle_div=document.createElement("div"),this.header_pointerdown=t=>{var e,A;if(null===(A=null===(e=t.target)||void 0===e?void 0:e.closest)||void 0===A?void 0:A.call(e,"button"))return;this.take_focus(),t.preventDefault();let n=e=>{if(e.pointerId!=t.pointerId)return;e.preventDefault();let A=this.panel_div.getBoundingClientRect(),n=e.clientX-t.clientX,i=e.clientY-t.clientY;t=e,this.container_div.classList.add(v),this.panel_div.style.left=Math.max(0,A.left+n)+"px",this.panel_div.style.top=Math.max(0,A.top+i)+"px"},i=e=>{e.pointerId==t.pointerId&&(document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},this.resize_pointerdown=t=>{var e,A;if(null===(A=null===(e=t.target)||void 0===e?void 0:e.closest)||void 0===A?void 0:A.call(e,"button"))return;this.take_focus(),t.preventDefault();let n=e=>{if(e.pointerId!=t.pointerId)return;e.preventDefault();let A=this.panel_div.getBoundingClientRect(),n=e.clientX-t.clientX,i=e.clientY-t.clientY;t=e,this.set_fixed_size(A.width+n,A.height+i),this.container_div.classList.add(v),this.panel_div.style.left=Math.max(0,A.left)+"px",this.panel_div.style.top=Math.max(0,A.top)+"px"},i=e=>{e.pointerId==t.pointerId&&(document.removeEventListener("pointermove",n),document.removeEventListener("pointerup",i),document.removeEventListener("pointercancel",i))};document.addEventListener("pointermove",n),document.addEventListener("pointerup",i),document.addEventListener("pointercancel",i)},this.toggle_transparent=()=>{this.container_div.classList.contains(m)||this.panel_div.classList.toggle(b)},this.toggle_collapse=()=>{this.panel_div.classList.toggle(u)},this.container_div.classList.add(_),e&&this.container_div.classList.add(c),this.panel_div.tabIndex=0,this.panel_div.classList.add(p),this.container_div.appendChild(this.panel_div),this.header_div.classList.add(I),this.header_div.addEventListener("pointerdown",this.header_pointerdown),this.panel_div.appendChild(this.header_div),this.collapse_button.classList.add(Q),this.collapse_button.addEventListener("click",this.toggle_collapse),this.header_div.appendChild(this.collapse_button),this.close_button.classList.add(E),this.close_button.addEventListener("click",this.close.bind(this)),this.header_div.appendChild(this.close_button),this.header_div.appendChild(this.title_span),this.title_span.textContent=t,this.content_div.classList.add(w),this.panel_div.appendChild(this.content_div),this.drag_handle_div.classList.add(C),this.drag_handle_div.addEventListener("pointerdown",this.resize_pointerdown),this.panel_div.appendChild(this.drag_handle_div),this.panel_div.addEventListener("focusin",(async()=>{let t=10;for(let e of document.body.querySelectorAll("."+_))e!=this.container_div&&(t=Math.max(t,+(e.style.zIndex||10)));this.container_div.style.zIndex=""+(t+1)}))}set_fixed_size(t,e){if(null==t||null==e){let A=this.panel_div.getBoundingClientRect();null==t&&(t=A.width),null==e&&(e=A.height)}"number"==typeof t&&(t+="px"),"number"==typeof e&&(e+="px"),this.panel_div.style.setProperty("--min-width",t),this.panel_div.style.setProperty("--min-height",e),this.panel_div.style.setProperty("--max-width",t),this.panel_div.style.setProperty("--max-height",e)}enable_absolute_position(){this.container_div.classList.add(v)}add_transparent_toggle(){if(this.transparent_button)return;let t=document.createElement("button");t.classList.add(B),t.addEventListener("click",this.toggle_transparent),this.header_div.appendChild(t),this.transparent_button=t}add_menu_button(t){if(this.menu_button)return;let e=document.createElement("button");e.classList.add(f),e.addEventListener("click",(()=>{t(e)})),this.header_div.appendChild(e),this.menu_button=e}get is_open(){return document.body.contains(this.container_div)}take_focus(){var t;document.activeElement&&this.panel_div.contains(document.activeElement)||(null===(t=document.activeElement)||void 0===t||t.blur(),this.panel_div.focus())}close(){document.body.contains(this.container_div)&&(document.body.removeChild(this.container_div),this.dispatchEvent(new Event("close")))}open(t=!1){document.body.contains(this.container_div)||(document.body.appendChild(this.container_div),t&&this.take_focus(),this.dispatchEvent(new Event("open")))}}var x="progress_spinner_spinner__a4z6R",D="progress_spinner_definite__KxUY4",k="progress_spinner_segment__jbuQh",L="progress_spinner_full_page__Z0jDj",N="progress_spinner_fading_out__eG0Yi";n('@keyframes progress_spinner_spin__Xd8F6 {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1440deg);\n }\n}\n.progress_spinner_spinner__a4z6R {\n width: 5em;\n height: 5em;\n position: relative;\n border-radius: 100%;\n overflow: hidden;\n background-color: rgba(0, 0, 0, 0.5);\n margin: auto;\n pointer-events: none;\n opacity: 1;\n transition: opacity linear 0.5s;\n}\n.progress_spinner_spinner__a4z6R:not(.progress_spinner_definite__KxUY4)::after {\n content: "";\n height: 0.5em;\n margin-top: 2.25em;\n margin-bottom: 2.25em;\n background-color: white;\n animation-name: progress_spinner_spin__Xd8F6;\n animation-duration: 2s;\n animation-iteration-count: infinite;\n border-radius: 0.25em;\n width: 5em;\n position: absolute;\n}\n.progress_spinner_spinner__a4z6R:not(.progress_spinner_definite__KxUY4) .progress_spinner_segment__jbuQh {\n display: none;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 {\n line-height: 5em;\n vertical-align: middle;\n text-align: center;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 .progress_spinner_segment__jbuQh {\n width: 5em;\n height: 5em;\n top: 0px;\n left: 0px;\n position: absolute;\n box-sizing: border-box;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_definite__KxUY4 .progress_spinner_segment__jbuQh::after {\n content: "";\n width: 2.51em;\n height: 2.51em;\n top: 2.49em;\n left: 2.49em;\n position: absolute;\n background-color: white;\n box-sizing: border-box;\n}\n.progress_spinner_spinner__a4z6R span {\n color: white;\n position: relative;\n text-shadow: 0px 0px 0.1em black;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_full_page__Z0jDj {\n position: absolute;\n margin-top: -2.5em;\n margin-left: -2.5em;\n top: 50%;\n left: 50%;\n font-size: calc(min(10vh, 10vw));\n z-index: 5;\n}\n.progress_spinner_spinner__a4z6R.progress_spinner_fading_out__eG0Yi {\n opacity: 0;\n}');class S{constructor(){this.element=document.createElement("div"),this.segments=[document.createElement("div"),document.createElement("div"),document.createElement("div"),document.createElement("div")],this.label=document.createElement("span"),this.element.classList.add(x);for(let t=0;t<4;t++)this.segments[t].classList.add(k),this.element.appendChild(this.segments[t]);this.element.appendChild(this.label)}get progress(){return this._progress}set progress(t){if(void 0!==t){t=Math.min(Math.max(t,0),1),this.label.textContent=Math.round(100*t)+"%",this.element.classList.add(D);for(let e=0;e<4;e++){let A=90*e-90,n=Math.PI/2*(1-Math.min(Math.max(4*t-e,0),1)),i=Math.cos(n),o=Math.sin(n);this.segments[e].style.transform=`rotate(${A}deg) matrix(1, 0, ${o}, ${i}, 0, 0)`}}else this.element.classList.remove(D);this._progress=t}get full_page(){return this.element.classList.contains(L)}set full_page(t){t?this.element.classList.add(L):this.element.classList.remove(L)}fade_out(){this.element.classList.add(N),setTimeout((()=>{var t;null===(t=this.element.parentElement)||void 0===t||t.removeChild(this.element)}),1e3)}}var R="menu_menu_content__FdBEI",F="menu_subtext__2IN7y",M="menu_no_min_height__wkhl3";n('.menu_menu_content__FdBEI {\n padding: 0px;\n font-size: 20px;\n}\n.menu_menu_content__FdBEI button {\n cursor: pointer;\n display: block;\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n line-height: 1em;\n min-height: 2em;\n margin: 0px;\n padding: 0px;\n padding-left: 10px;\n padding-right: 10px;\n font-family: sans-serif;\n text-align: left;\n width: 100%;\n}\n.menu_menu_content__FdBEI button span, .menu_menu_content__FdBEI button p {\n vertical-align: middle;\n margin: 0px;\n text-align: left;\n}\n.menu_menu_content__FdBEI button:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n.menu_menu_content__FdBEI button canvas {\n width: 64px;\n height: 64px;\n margin: 0px;\n float: left;\n position: relative;\n left: -10px;\n}\n.menu_menu_content__FdBEI button .menu_subtext__2IN7y {\n color: grey;\n}\n.menu_menu_content__FdBEI::after {\n content: "";\n height: 3px;\n width: 100%;\n background-color: calc(var(--highlight-color));\n display: block;\n}\n\n.menu_no_min_height__wkhl3 {\n max-height: calc(min(var(--max-height), 100vh));\n min-height: calc(min(var(--min-height), 100vh));\n}');const U={startup_chat:"true",startup_chat_transparent:"true"};var T;!function(t){let e=new Map;t.get=function(t){var A,n;try{return null!==(A=localStorage.getItem("dvmt-"+t))&&void 0!==A?A:U[t]}catch(A){return console.error(A),null!==(n=e.get(t))&&void 0!==n?n:U[t]}},t.set=function(t,A){e.set(t,A),window.localStorage&&(A==U[t]?localStorage.removeItem("dvmt-"+t):localStorage.setItem("dvmt-"+t,A))}}(T||(T={}));class Y extends y{constructor(t,e=!0){var n,i;super("Chat"),this.ui=t,this.follow_follower=!0,this.chat_target=void 0,this.scrolled_to_bottom=!0,this.last_frame_index=-1,this.frame_callback=async(t=this.last_frame_index)=>{let e=this.last_frame_index;if(t>this.last_frame_index){let A=await this.ui.player.get_chat_messages(this.chat_target,this.last_frame_index+1,t+1);if(e!=this.last_frame_index)return;if(A.length){let t=new DocumentFragment;for(let e of A){let A=document.createElement("div");A.style.wordBreak="break-word",A.style.whiteSpace="pre-wrap",A.dataset.msgTime=""+e.time,A.dataset.msgFrame=""+e.frame_index;let n="innerHTML",i="";"string"==typeof e.message?i=e.message:e.message.html?i=e.message.html:e.message.text&&(i=e.message.text),A[n]=i;for(let t of A.querySelectorAll("a"))t.target="_blank";t.appendChild(A)}this.content_div.appendChild(t),this.update_content_scroll()}}else if(t=0;e--){let A=this.content_div.children[e];if(!(A instanceof HTMLElement))continue;let n=A.dataset.msgFrame;null!=n&&+n>=t&&this.content_div.removeChild(A)}this.last_frame_index=t};let o=null===(n=this.ui.viewport.current_follow)||void 0===n?void 0:n.ref;"string"==typeof o&&(this.chat_target=o),this.add_transparent_toggle(),this.add_menu_button((t=>{new q(this).put_below(t).open(!0)})),this.set_fixed_size("min(800px, 80vw)","min(600px, 45vh)"),e&&("false"!=T.get("startup_chat_transparent")&&this.toggle_transparent(),this.enable_absolute_position(),this.panel_div.style.left="100vw",this.panel_div.style.top="0px"),this.content_div.classList.add("chat_window"),this.frame_callback=A.despam_promise(this.frame_callback),this.addEventListener("close",(()=>{this.detach_hooks();let t=this.ui.chat_windows.indexOf(this);t>=0&&this.ui.chat_windows.splice(t,1)})),this.addEventListener("open",(()=>{this.attach_hooks(),this.ui.chat_windows.push(this)}));let s=new ResizeObserver((()=>this.update_content_scroll()));s.observe(this.content_div),s.observe(this.container_div),null===(i=this.transparent_button)||void 0===i||i.addEventListener("click",(()=>this.update_content_scroll())),this.content_div.addEventListener("scroll",(()=>{this.scrolled_to_bottom=Math.ceil(this.content_div.clientHeight+this.content_div.scrollTop)>=Math.floor(this.content_div.scrollHeight)}))}attach_hooks(){this.remove_frame_callback||(this.remove_frame_callback=(async()=>{if(!document.getElementById("chat_css")){let t=await this.ui.player.chat_css;if(!document.getElementById("chat_css")){t=t.replace(/((?:^|[},])[^\@\{]*?)([a-zA-Z.#\[\]":=\-_][a-zA-Z0-9.# \[\]":=\-_]*)(?=.+\{)/g,"$1.chat_window $2"),t=t.replace(/height: [^;]+%;/g,""),t=t.replace(/ ?html| ?body/g,"");let e=document.createElement("style");e.textContent=t,e.id="chat_css",document.head.appendChild(e)}}return this.ui.player.add_frame_listener(e.proxy(this.frame_callback))})())}detach_hooks(){this.remove_frame_callback&&(this.remove_frame_callback.then((t=>{t(),t[e.releaseProxy]()})),this.remove_frame_callback=void 0)}set_chat_target(t){t!=this.chat_target&&(this.title_span.textContent=t?`Chat (${t})`:"Chat",this.detach_hooks(),this.last_frame_index=-1,this.content_div.innerHTML="",this.chat_target=t,this.is_open&&this.attach_hooks())}update_content_scroll(){this.scrolled_to_bottom&&(this.content_div.scrollTop=Math.ceil(this.content_div.scrollHeight),this.scrolled_to_bottom=!0)}adjust_font_size(t){let e=17,A=window.getComputedStyle(this.content_div).fontSize;A.endsWith("px")&&(e=+A.substring(0,A.length-2)||e),e+=t,e=Math.max(Math.min(e,30),1),this.content_div.style.fontSize=e+"px",this.update_content_scroll()}}class J extends y{constructor(){super("",!0),this.panel_div.style.setProperty("--max-height","calc(90vh)"),this.panel_div.removeChild(this.header_div),this.panel_div.removeChild(this.drag_handle_div),this.panel_div.classList.add(M),this.content_div.classList.add(R),this.container_div.addEventListener("pointerdown",(t=>{t.target==this.container_div&&this.close()})),this.container_div.addEventListener("keydown",(t=>{"Escape"==t.code&&this.close()}))}add_hr(){this.content_div.appendChild(document.createElement("hr"))}add_basic_button(t,e,A){let n=document.createElement("button");if(e){document.createElement("span").textContent=t;let A=document.createElement("span");A.textContent=e,A.classList.add(F),n.append(t,document.createElement("br"),A)}else n.textContent=t;return n.addEventListener("click",A),this.content_div.appendChild(n),n}put_to_right(t){this.enable_absolute_position();let e=t.getBoundingClientRect();return this.panel_div.style.left=e.x+e.width+"px",this.panel_div.style.top=e.y+"px",this}put_below(t){this.enable_absolute_position();let e=t.getBoundingClientRect();return this.panel_div.style.left=e.x+"px",this.panel_div.style.top=e.y+e.height+"px",this}}class G extends J{constructor(t){super(),this.ui=t,this.add_basic_button("Open Chat",null,(()=>{new Y(t,!1).open(!0),this.close()})),this.add_basic_button("Next Z-level",null,(()=>{this.ui.player.adjust_z(1)})),this.add_basic_button("Previous Z-level",null,(()=>{this.ui.player.adjust_z(-1)}));let e=this.add_basic_button("Clients",null,(()=>{new K(this.ui,this).put_to_right(e).open(!0)}));this.add_basic_button("Stats for Nerds",null,(()=>{this.ui.nerdy_stats.style.display="block"==this.ui.nerdy_stats.style.display?"none":"block",this.close()}));let A=this.add_basic_button("Set Vision",null,(()=>{new P(this.ui).put_to_right(A).open(!0)}));this.add_basic_button("Toggle Darkness",null,(()=>{this.ui.player.toggle_darkness(),this.close()})),this.add_basic_button("Dump Textures",null,(()=>{this.ui.player.dump_textures(),this.close()}))}}class z extends J{constructor(t,e,A){super(),this.ui=t,this.load_spinner=new S,this.content_div.appendChild(this.load_spinner.element),this.ui.player.get_objects_through_point(e,A).then((e=>{this.content_div.removeChild(this.load_spinner.element);let A=new DocumentFragment;for(let n of e){let e=document.createElement("button"),i=document.createElement("canvas"),o=document.createElement("span"),s=document.createElement("br"),a=document.createElement("span");this.ui.object_canvases.set(i,{ref:n.ref,remove_when_done:!0}),e.append(i,o,s,a),o.textContent=n.name,a.classList.add(F),a.textContent=`[0x${n.ref.toString(16)}]`,A.appendChild(e),e.addEventListener("click",(()=>{let A=new H(t,this,n.ref,n.clients);A.put_to_right(e),A.open(!0)}))}this.content_div.appendChild(A)}))}}class H extends J{constructor(t,e,A,n,i=!1,o){super(),this.ui=t,this.parent=e;let s=document.createElement("button");if(s.textContent="Inspect",s.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.open_inspector(A)})),this.content_div.appendChild(s),A>>24!=1){let e=document.createElement("button");e.textContent="Follow Object",e.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.viewport.follow(A)})),this.content_div.appendChild(e)}for(let e of n){let A=document.createElement("button");A.addEventListener("click",(()=>{this.close(),this.parent.close(),null==o||o(),t.viewport.follow(e)}));let n=document.createElement("span");n.textContent="Follow Client";let s=document.createElement("br"),a=document.createElement("span");if(a.textContent=e,a.classList.add(F),A.append(n,s,a),this.content_div.appendChild(A),i){let t=document.createElement("button");t.textContent="Open Chat",t.addEventListener("click",(()=>{this.close(),this.parent.close();let t=new Y(this.ui,!1);t.set_chat_target(e),t.open(!0)})),this.content_div.appendChild(t)}}this.addEventListener("close",(()=>{this.parent.panel_div.focus()}))}}class K extends J{constructor(t,e){super(),this.ui=t,this.parent=e,this.load_spinner=new S,this.content_div.appendChild(this.load_spinner.element),this.ui.player.get_clients_mobs().then((e=>{this.content_div.removeChild(this.load_spinner.element);let A=new DocumentFragment;for(let n of e){let e=document.createElement("button"),i=document.createElement("canvas"),o=document.createElement("span"),s=document.createElement("br"),a=document.createElement("span");this.ui.object_canvases.set(i,{ref:n.ref,remove_when_done:!0}),e.append(i,o,s,a),o.textContent=n.name,a.classList.add(F),a.textContent=n.ckey,A.appendChild(e),e.addEventListener("click",(()=>{let A=new H(t,this,n.ref,[n.ckey],!0,(()=>{this.parent.close()}));A.put_to_right(e),A.open(!0)}))}this.content_div.appendChild(A)})),this.addEventListener("close",(()=>{this.parent.panel_div.focus()}))}}class q extends J{constructor(t){super(),this.parent=t,this.add_basic_button(t.follow_follower?"Lock Target":"Unlock Target",null,(()=>{var e;if(t.follow_follower=!t.follow_follower,t.follow_follower){let A=null===(e=t.ui.viewport.current_follow)||void 0===e?void 0:e.ref;t.set_chat_target("string"==typeof A?A:void 0)}this.close()})),this.add_basic_button("Increase Font Size",null,(()=>{t.adjust_font_size(1)})),this.add_basic_button("Decrease Font Size",null,(()=>{t.adjust_font_size(-1)}))}}class P extends J{constructor(t){super(),this.ui=t,this.add_basic_button("Minimum Possible Vision",null,(()=>{t.player.set_see_invisible(5)})),this.add_basic_button("Regular Vision",null,(()=>{t.player.set_see_invisible(25)})),this.add_basic_button("Ghost vision",null,(()=>{t.player.set_see_invisible(60)})),this.add_basic_button("ALL vision",null,(()=>{t.player.set_see_invisible(100)})),this.add_basic_button("Debug vision",null,(()=>{t.player.set_see_invisible(101)}))}}var O="viewport_viewport__M3NP6",X="viewport_stop_following_container__ILEMO",j="viewport_followview__Y0F4U";n(".viewport_viewport__M3NP6 {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0px;\n left: 0px;\n overflow: hidden;\n isolation: isolate;\n background-color: black;\n touch-action: none;\n}\n\n.viewport_nerdy_stats__xJ-FT {\n position: absolute;\n color: red;\n background-color: rgba(0, 0, 0, 0.5);\n font-size: 20px;\n padding: 10px;\n margin: 0px;\n top: 0px;\n left: 0px;\n max-width: 100vw;\n pointer-events: none;\n user-select: none;\n word-break: break-all;\n}\n\n.viewport_stop_following_container__ILEMO {\n position: absolute;\n bottom: 100px;\n left: 0px;\n right: 0px;\n width: 100%;\n text-align: center;\n z-index: 1;\n}\n.viewport_stop_following_container__ILEMO button {\n margin: auto;\n padding: 10px;\n font-size: 16px;\n font-family: Verdana, Geneva, sans-serif;\n color: white;\n background-color: rgba(0, 0, 0, 0.5);\n border: none;\n}\n.viewport_stop_following_container__ILEMO button:hover {\n background-color: rgba(0, 0, 0, 0.7);\n}\n\n.viewport_followview__Y0F4U {\n z-index: 1;\n border: 10000px solid rgba(0, 0, 0, 0.8);\n margin: -10000px;\n box-sizing: content-box;\n display: none;\n pointer-events: none;\n}");class W{constructor(t){this.ui=t,this.viewport_div=document.createElement("div"),this.viewport_elements=[],this.followview={elem:document.createElement("div"),x:0,y:0,width:0,height:0},this.x=128,this.y=128,this.log_zoom=0,this.zoom=1,this.current_follow=void 0,this.icon_width=32,this.icon_height=32,this.pointers=[],this.stop_following_button=document.createElement("button"),this.handle_keydown=t=>{t.defaultPrevented||("PageDown"==t.code?(this.ui.player.adjust_z(-1),t.preventDefault()):"PageUp"==t.code?(this.ui.player.adjust_z(1),t.preventDefault()):"Escape"==t.code&&this.follow(null))},this.handle_mousedown=t=>{var e,A;if(0!=t.button&&1!=t.button)return;let n=e=>{let A=e.clientX-t.clientX,n=e.clientY-t.clientY;t=e,this.x-=A/this.zoom/this.icon_width,this.y+=n/this.zoom/this.icon_height,this.update_viewport(),e.preventDefault()},i=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",i),this.ui.update_hash()};document.addEventListener("mousemove",n),document.addEventListener("mouseup",i),document.activeElement!=this.viewport_div&&(null===(A=null===(e=document.activeElement)||void 0===e?void 0:e.blur)||void 0===A||A.call(e),this.viewport_div.focus()),t.preventDefault()},this.handle_wheel=async t=>{t.preventDefault();let e=t.deltaY/2;t.deltaMode==WheelEvent.DOM_DELTA_PIXEL&&(e/=100),t.deltaMode==WheelEvent.DOM_DELTA_LINE&&(e/=3);let A=-Math.max(-1,Math.min(1,e)),n=Math.sign(A);if(A=Math.abs(A),A>.25){let e,i=performance.now();for(;A>1/1024&&(e=await new Promise(requestAnimationFrame),!(n>0&&this.log_zoom>=6||n<0&&this.log_zoom<=-6));){let o=Math.min(A,.005*(e-i));this.adjust_zoom(o*n,t.clientX,t.clientY),A-=o,i=e}}else this.adjust_zoom(A*n,t.clientX,t.clientY);this.ui.update_hash()},this.handle_pointerdown=t=>{var e,A;if("mouse"==t.pointerType)return;let n={id:t.pointerId,x:t.clientX,y:t.clientY,down_time:t.timeStamp,total_move:0};this.viewport_div.setPointerCapture(t.pointerId),this.pointers.unshift(n),t.preventDefault(),document.activeElement!=this.viewport_div&&(null===(A=null===(e=document.activeElement)||void 0===e?void 0:e.blur)||void 0===A||A.call(e),this.viewport_div.focus()),setTimeout((()=>{n.total_move<10&&1==this.pointers.length&&this.pointers[0]==n&&(this.pointers.length=0,this.handle_contextmenu({clientX:n.x,clientY:n.y}))}),600)},this.handle_pointermove=t=>{let e=this.get_pointer_index(t.pointerId);if(e<0||this.pointers.length<1)return;t.preventDefault();let[A,n,i]=this.get_pointers_xyd();this.pointers[e].total_move+=Math.abs(t.clientX-this.pointers[e].x)+Math.abs(t.clientY-this.pointers[e].y),this.pointers[e].x=t.clientX,this.pointers[e].y=t.clientY;let[o,s,a]=this.get_pointers_xyd();1==this.pointers.length?(this.x-=(o-A)/this.zoom/this.icon_width,this.y+=(s-n)/this.zoom/this.icon_height,this.update_viewport()):this.adjust_zoom(Math.max(-1,Math.min(1,Math.log2(a/i))),A,n,o,s)},this.last_shorttap=-123456,this.last_shorttap_x=0,this.last_shorttap_y=0,this.handle_pointerup=t=>{let e=this.get_pointer_index(t.pointerId);if(e<0)return;let A=this.pointers[e];this.pointers.splice(e,1),t.preventDefault(),t.timeStamp-A.down_time<300&&A.total_move<10&&Math.abs(A.x-this.last_shorttap_x)<10&&Math.abs(A.y-this.last_shorttap_y)&&(A.down_time-this.last_shorttap<600?this.handle_doubleclick(t):(this.last_shorttap=A.down_time,this.last_shorttap_x=A.x,this.last_shorttap_y=A.y)),this.pointers.length||this.ui.update_hash()},this.handle_focus=()=>{const t=document.querySelector("meta[name=viewport]");t&&t.setAttribute("content","width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0")},this.handle_blur=()=>{const t=document.querySelector("meta[name=viewport]");t&&t.setAttribute("content","width=device-width, initial-scale=1.0")},this.handle_contextmenu=t=>{t instanceof Event&&t.preventDefault(),this.pointers.length=0;let e=this.viewport_div.getBoundingClientRect(),A=this.x+(t.clientX-(e.left+e.right)/2)/this.zoom/this.icon_width,n=this.y-(t.clientY-(e.top+e.bottom)/2)/this.zoom/this.icon_height,i=new z(this.ui,A,n);i.enable_absolute_position(),i.panel_div.style.left=t.clientX+"px",i.panel_div.style.top=t.clientY+"px",i.open(!0)},this.handle_doubleclick=async t=>{t instanceof Event&&t.preventDefault(),this.last_shorttap=-123456;let e=this.viewport_div.getBoundingClientRect(),A=this.x+(t.clientX-(e.left+e.right)/2)/this.zoom/this.icon_width,n=this.y-(t.clientY-(e.top+e.bottom)/2)/this.zoom/this.icon_height,i=await this.ui.player.get_clicked_object_ref(A,n);i&&this.ui.open_inspector(i)},this.viewport_div.classList.add(O),document.body.appendChild(this.viewport_div),this.viewport_div.tabIndex=0,this.viewport_div.addEventListener("mousedown",this.handle_mousedown),this.viewport_div.addEventListener("wheel",this.handle_wheel),this.viewport_div.addEventListener("pointerdown",this.handle_pointerdown),this.viewport_div.addEventListener("pointermove",this.handle_pointermove),this.viewport_div.addEventListener("pointerup",this.handle_pointerup),this.viewport_div.addEventListener("pointercancel",this.handle_pointerup),this.viewport_div.addEventListener("pointerleave",this.handle_pointerup),this.viewport_div.addEventListener("keydown",this.handle_keydown),this.viewport_div.addEventListener("focus",this.handle_focus),this.viewport_div.addEventListener("blur",this.handle_blur),this.viewport_div.addEventListener("contextmenu",this.handle_contextmenu),this.viewport_div.addEventListener("dblclick",this.handle_doubleclick),this.followview.elem.classList.add(j),this.add_viewport_element(this.followview);let e=document.createElement("div");e.classList.add(X),document.body.appendChild(e),e.appendChild(this.stop_following_button),this.stop_following_button.textContent="Stop Following",this.stop_following_button.addEventListener("click",(()=>{this.follow(null),this.update_viewport()})),new ResizeObserver((()=>{this.update_viewport()})).observe(this.viewport_div),this.update_viewport()}follow(t){var e;if(null==t&&null==this.current_follow||null!=t&&(null===(e=this.current_follow)||void 0===e?void 0:e.ref)==t)return;this.current_follow=null!=t?{ref:t,x:void 0,y:void 0}:void 0;let A="string"==typeof t?t:void 0;for(let t of this.ui.chat_windows)t.follow_follower&&t.set_chat_target(A);this.ui.update_hash()}update_nerdy_stats(t){this.ui.nerdy_stats.textContent=t}add_viewport_element(t){this.viewport_elements.push(t),this.viewport_div.appendChild(t.elem)}update_zoom(){this.log_zoom=Math.max(-6,Math.min(6,this.log_zoom));let t=this.log_zoom;Math.abs(Math.round(t)-t)<.002&&(t=Math.round(t)),this.zoom=2**t}update_viewport(){this.update_zoom(),this.x>5e3&&(this.x=5e3),this.x<-5e3&&(this.x=-5e3),this.y>5e3&&(this.y=5e3),this.y<-5e3&&(this.y=-5e3);let t=this.viewport_div.getBoundingClientRect();for(let{x:e,y:A,width:n,height:i,elem:o}of this.viewport_elements)o.style.position="absolute",o.style.left=t.width/2+(e-this.x)*this.icon_width*this.zoom+"px",o.style.bottom=t.height/2+(A-this.y)*this.icon_height*this.zoom+"px",o.style.width=this.icon_width*this.zoom*n+"px",o.style.height=this.icon_height*this.zoom*i+"px";this.stop_following_button.style.display=this.current_follow?"unset":"none"}adjust_zoom(t,e,A,n=e,i=A){let o=this.viewport_div.getBoundingClientRect(),s=0,a=0;this.current_follow&&null!=this.current_follow.x&&null!=this.current_follow.y?(s=this.current_follow.x-this.x,a=this.current_follow.y-this.y,this.x+=s,this.y+=a):(this.x+=(e-(o.left+o.right)/2)/this.zoom/this.icon_width,this.y+=-(A-(o.top+o.bottom)/2)/this.zoom/this.icon_height);let r=this.zoom;this.log_zoom+=t,this.update_zoom(),this.current_follow&&null!=this.current_follow.x&&null!=this.current_follow.y?(this.x-=s*r/this.zoom,this.y-=a*r/this.zoom):(this.x-=(n-(o.left+o.right)/2)/this.zoom/this.icon_width,this.y-=-(i-(o.top+o.bottom)/2)/this.zoom/this.icon_height),this.update_viewport()}get_pointer_index(t){for(let e=0;e=2&&(t+=this.pointers[1].x,t/=2,e+=this.pointers[1].y,e/=2,A=Math.sqrt((this.pointers[1].x-this.pointers[0].x)**2+(this.pointers[1].y-this.pointers[0].y)**2)),A<.1&&(A=.1),[t,e,A]}get_turf_window(){let t=this.viewport_div.getBoundingClientRect();return{left:this.x-t.width/2/this.zoom/this.icon_width,right:this.x+t.width/2/this.zoom/this.icon_width,bottom:this.y-t.height/2/this.zoom/this.icon_height,top:this.y+t.height/2/this.zoom/this.icon_height,pixel_scale:this.zoom*devicePixelRatio,follow:this.current_follow}}}function V(t){if(null==t)throw new Error("Unexpected null value");return t}function Z(t,e){let A=et(t,`\n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp float;\n\t#else\n\t\tprecision mediump float;\n\t#endif\n\tattribute vec4 ${e?"a_color_r, a_color_g, a_color_b, a_color_a, a_color_c":"a_color"};\n\tattribute vec4 a_uv;\n\tattribute vec3 a_transform_x;\n\tattribute float a_layer;\n\tattribute vec3 a_transform_y;\n\tattribute vec2 a_position;\n\tvarying vec4 ${e?"v_color_r, v_color_g, v_color_b, v_color_a, v_color_c":"v_color"};\n\tvarying vec2 v_uv;\n\tuniform vec2 u_viewport_size;\n\tuniform vec2 u_texture_size;\n\tuniform vec2 u_viewport_center;\n\tuniform float u_zoom;\n\tvoid main() {\n\t\t${e?"v_color_r = a_color_r;\n\t\tv_color_g = a_color_g;\n\t\tv_color_b = a_color_b;\n\t\tv_color_a = a_color_a;\n\t\tv_color_c = a_color_c;":"v_color = a_color;"}\n\t\tvec2 sprite_size = a_uv.zw-a_uv.xy;\n\t\tv_uv = mix(a_uv.xy, a_uv.zw, a_position) / u_texture_size;\n\t\tvec3 scaled_position = vec3(sprite_size*(a_position-vec2(0.5,0.5)), 1);\n\t\tgl_Position = vec4((vec2(dot(a_transform_x, scaled_position)+sprite_size.x*0.5, dot(a_transform_y, scaled_position)+sprite_size.y*0.5) - u_viewport_center) * u_zoom / u_viewport_size * 2.0, a_layer, 1.0);\n\t}\n\t`,`\n\t#ifdef GL_FRAGMENT_PRECISION_HIGH\n\t\tprecision highp float;\n\t#else\n\t\tprecision mediump float;\n\t#endif\n\tuniform sampler2D u_texture;\n\tvarying vec4 ${e?"v_color_r, v_color_g, v_color_b, v_color_a, v_color_c":"v_color"};\n\tvarying vec2 v_uv;\n\tvoid main() {\n\t\tvec4 out_color = texture2D(u_texture, v_uv)${e?"":" * v_color"};\n\t\t${e?"out_color = v_color_c\n\t\t+ v_color_r * out_color.x\n\t\t+ v_color_g * out_color.y\n\t\t+ v_color_b * out_color.z\n\t\t+ v_color_a * out_color.w;":""}\n\t\tout_color.xyz *= out_color.w;\n\t\tfloat z = gl_FragCoord.z;\n\t\tgl_FragColor = out_color;\n\t\tif(gl_FragColor.a < 0.001961)\n\t\t\tdiscard;\n\t}`),n=[];e?(n.push(t.getAttribLocation(A,"a_color_r")),n.push(t.getAttribLocation(A,"a_color_g")),n.push(t.getAttribLocation(A,"a_color_b")),n.push(t.getAttribLocation(A,"a_color_a")),n.push(t.getAttribLocation(A,"a_color_c"))):n.push(t.getAttribLocation(A,"a_color"));let i={shader:A,a_position:t.getAttribLocation(A,"a_position"),a_transform_x:t.getAttribLocation(A,"a_transform_x"),a_transform_y:t.getAttribLocation(A,"a_transform_y"),a_color:n,a_uv:t.getAttribLocation(A,"a_uv"),a_layer:t.getAttribLocation(A,"a_layer"),u_texture:V(t.getUniformLocation(A,"u_texture")),u_texture_size:V(t.getUniformLocation(A,"u_texture_size")),u_viewport_size:V(t.getUniformLocation(A,"u_viewport_size")),u_viewport_center:V(t.getUniformLocation(A,"u_viewport_center")),u_zoom:V(t.getUniformLocation(A,"u_zoom")),vao:null,all_attrib_arrays:[]};return i.all_attrib_arrays.push(i.a_position,i.a_transform_x,i.a_transform_y,...i.a_color,i.a_uv,i.a_layer),i.vao=$(t,i.all_attrib_arrays),i}function $(t,e){let A=t.getExtension("OES_vertex_array_object");if(A){let n;n=A.createVertexArrayOES(),A.bindVertexArrayOES(n);for(let A of e)t.enableVertexAttribArray(A);return A.bindVertexArrayOES(null),n}if(t instanceof window.WebGL2RenderingContext){let A;A=t.createVertexArray(),t.bindVertexArray(A);for(let A of e)t.enableVertexAttribArray(A);return t.bindVertexArray(null),A}return null}function tt(t,e,A){let n=V(t.createShader(A));if(t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw new Error((A==t.VERTEX_SHADER?"VERTEX SHADER ":"FRAGMENT SHADER ")+t.getShaderInfoLog(n));return n}function et(t,e,A){var n;let i=V(t.createProgram());if(t.attachShader(i,tt(t,e,t.VERTEX_SHADER)),t.attachShader(i,tt(t,A,t.FRAGMENT_SHADER)),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error(null!==(n=t.getProgramInfoLog(i))&&void 0!==n?n:"unknown shader error");return i}const At="http://www.w3.org/2000/svg";async function nt(t,e,A){let n=function(t,e,A){t=""+t;let n=(new DOMParser).parseFromString(t,"text/html");function i(t){return t=t.replace(/-dm-text-outline: ([0-9\.]+)([a-z%]+) ([^ ;]+)*(?: (sharp|square))?;/g,((t,e,A,n,i)=>{let o=+e,s=[];for(let t=0;t<8;t++){let e=t/8*Math.PI*2,a=+Math.cos(e).toFixed(2),r=+Math.sin(e).toFixed(2);"square"==i&&(a=Math.sign(a),r=Math.sign(r)),s.push(`${o*a}${A} ${o*r}${A} 0px ${n}`)}return`text-shadow: ${s.join(",")};`})),(t=(t=(t=t.replace(/font-size: *([0-9]+)px;/g,((t,e)=>`font-size: ${e}pt;`))).replace(/font-size: *([0-9]+)pt;/g,((t,e)=>`font-size: ${Math.ceil(4*e/3)}px;`))).replace(/font(?:-family)?: *['"]MS Serif['"];/g,'font-family:"MS Serif", "MS Pゴシック", "MS Sans Serif", sans-serif;')).replace(/(text-align: [^;]+);/g,"$1; display: block;")}for(let t of n.querySelectorAll("style"))t.textContent&&(t.textContent=i(t.textContent));for(let t of n.querySelectorAll("[style]")){let e=t.getAttribute("style");e&&t.setAttribute("style",i(e))}let o=n.createElement("style"),s="position:absolute;left:0px;bottom:0px;width:100%;overflow:hidden;vertical-align:baseline;";n.querySelector("[valign=top]")&&(s=""),o.textContent=`body{margin:0px;}html{color:white;font-family:"MS Sans Serif", sans-serif;font-size:9px;${s}}`,n.head.insertBefore(o,n.head.firstChild);let a=n.createElementNS(At,"svg");a.setAttributeNS(null,"viewBox",`0 0 ${e} ${A}`),a.setAttributeNS(null,"width",`${e}`),a.setAttributeNS(null,"height",`${A}`);let r=n.createElementNS(At,"foreignObject");return r.setAttributeNS(null,"x","0"),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"width",`${e}`),r.setAttributeNS(null,"height",`${A}`),a.appendChild(r),r.appendChild(n.documentElement),(new XMLSerializer).serializeToString(a)}(t,e,A),i=new Image,o=`data:image/svg+xml;base64,${btoa(String.fromCharCode(...(new TextEncoder).encode(n)))}`;return await new Promise((async(t,e)=>{i.onload=t,i.onerror=e,i.src=o})),i}class it{constructor(t){var e,A;this.ui=t,this.atlas_textures=[],this.curr_blend_mode=-1,this.attrib_arrays_enabled=[];let n=document.createElement("canvas");if(this.gl2=null!==(e=n.getContext("webgl2",{desynchronized:!0,powerPreference:"high-performance"}))&&void 0!==e?e:void 0,this.gl2)this.gl=this.gl2;else{let t=n.getContext("webgl",{desynchronized:!0,alpha:!1});if(!t)throw new Error("Could not initialize WebGL");this.gl=t}const i=this.gl,o=this.gl2;if(o)this.instance_arrays={VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE:o.VERTEX_ATTRIB_ARRAY_DIVISOR,drawArraysInstancedANGLE:o.drawArraysInstanced.bind(o),drawElementsInstancedANGLE:o.drawElementsInstanced.bind(o),vertexAttribDivisorANGLE:o.vertexAttribDivisor.bind(o)};else{let t=i.getExtension("ANGLE_instanced_arrays");if(!t)throw new Error("ANGLE_instanced_arrays is not supported");this.instance_arrays=t}this.vao=null!==(A=i.getExtension("OES_vertex_array_object"))&&void 0!==A?A:void 0,this.white_texture=V(i.createTexture()),i.bindTexture(i.TEXTURE_2D,this.white_texture),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,1,1,0,i.RGBA,i.UNSIGNED_BYTE,new Uint8Array([0,0,0,0])),i.bindTexture(i.TEXTURE_2D,null),this.copy_framebuffer=V(i.createFramebuffer()),this.max_texture_size=Math.min(i.getParameter(i.MAX_TEXTURE_SIZE),32768),this.canvas_copy=V(i.createTexture()),i.activeTexture(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this.canvas_copy),this.square_buffer=V(i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,this.square_buffer),i.bufferData(i.ARRAY_BUFFER,new Float32Array([1,0,0,1,0,0,1,0,1,1,0,1]),i.STATIC_DRAW),i.enable(i.BLEND),i.enable(i.SCISSOR_TEST),this.shader=Z(i,!1),this.shader_matrix=Z(i,!0),this.shader_copy=function(t){let e=et(t,"\n\tprecision mediump float;\n\tattribute vec2 a_position;\n\tattribute vec2 a_size;\n\tattribute vec2 a_from;\n\tattribute vec2 a_to;\n\tuniform vec2 u_texture_size;\n\tvarying vec2 v_uv;\n\tvoid main() {\n\t\tv_uv = (a_size * a_position + a_from) / u_texture_size;\n\t\tgl_Position = vec4((mix(vec2(0,0), a_size, a_position) + a_to) / u_texture_size * 2.0 - vec2(1,1), 0, 1.0);\n\t}\n\t","\n\tprecision mediump float;\n\tuniform sampler2D u_texture;\n\tvarying vec2 v_uv;\n\tuniform vec2 u_texture_size;\n\tvoid main() {\n\t\tgl_FragColor = texture2D(u_texture, v_uv);\n\t}"),A={shader:e,a_position:t.getAttribLocation(e,"a_position"),a_from:t.getAttribLocation(e,"a_from"),a_to:t.getAttribLocation(e,"a_to"),a_size:t.getAttribLocation(e,"a_size"),u_texture:V(t.getUniformLocation(e,"u_texture")),u_texture_size:V(t.getUniformLocation(e,"u_texture_size")),vao:null,all_attrib_arrays:[]};return A.all_attrib_arrays.push(A.a_position,A.a_from,A.a_to,A.a_size),A.vao=$(t,A.all_attrib_arrays),A}(i),this.viewport_canvas={x:0,y:0,width:1,height:1,elem:document.createElement("canvas")},this.ui.viewport.add_viewport_element(this.viewport_canvas)}async process_frame_data(t,e,A){const n=this.gl,i=this.instance_arrays;let o={x:0,y:0,width:0,height:0},s={x:0,y:0,width:0,height:0},a=this.ui.viewport.icon_width,r=this.ui.viewport.icon_height,l=0,h=0;for(let e of t)"viewport"==e.cmd&&(l=Math.max(l,Math.ceil(e.x+e.width)),h=Math.max(h,Math.ceil(e.y+e.height)));n.canvas.widthObject.assign(Object.assign({},t),{data:await nt(t.maptext,t.width,t.height)})))),A=V(this.atlas_textures[e.index]);n.bindTexture(n.TEXTURE_2D,A.texture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0);for(let e of t)try{n.texSubImage2D(n.TEXTURE_2D,0,e.x,e.y,n.RGBA,n.UNSIGNED_BYTE,e.data)}catch(t){console.warn(e.maptext),console.error(t),n.texSubImage2D(n.TEXTURE_2D,0,e.x,e.y,e.width,e.height,n.RGBA,n.UNSIGNED_BYTE,null)}n.bindTexture(n.TEXTURE_2D,null)}else if("atlastexcopywithin"==e.cmd){let t=V(this.atlas_textures[e.index]),A=this.shader_copy;this.set_shader(A),n.disable(n.BLEND),n.disable(n.SCISSOR_TEST),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,this.copy_framebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t.texture,0),n.viewport(0,0,t.width,t.height),n.bindTexture(n.TEXTURE_2D,t.static_copy_texture),t.static_copy_dirty&&(n.copyTexSubImage2D(n.TEXTURE_2D,0,0,0,0,0,t.width,t.height),t.static_copy_dirty=!1);let o=new Float32Array(6*e.parts.length),s=0;for(let t of e.parts)o[s+0]=t.x1,o[s+1]=t.y1,o[s+2]=t.x2,o[s+3]=t.y2,o[s+4]=t.width,o[s+5]=t.height,s+=6;n.uniform1i(A.u_texture,0),n.uniform2f(A.u_texture_size,t.width,t.height),n.bindBuffer(n.ARRAY_BUFFER,this.square_buffer),n.vertexAttribPointer(A.a_position,2,n.FLOAT,!1,0,0);let a=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STREAM_DRAW),n.vertexAttribPointer(A.a_from,2,n.FLOAT,!1,24,0),n.vertexAttribPointer(A.a_to,2,n.FLOAT,!1,24,8),n.vertexAttribPointer(A.a_size,2,n.FLOAT,!1,24,16),i.vertexAttribDivisorANGLE(A.a_position,0),i.vertexAttribDivisorANGLE(A.a_from,1),i.vertexAttribDivisorANGLE(A.a_to,1),i.vertexAttribDivisorANGLE(A.a_size,1),i.drawArraysInstancedANGLE(n.TRIANGLES,0,6,e.parts.length),n.deleteBuffer(a),n.bindFramebuffer(n.FRAMEBUFFER,null),n.bindTexture(n.TEXTURE_2D,null),n.enable(n.BLEND),n.enable(n.SCISSOR_TEST)}else if("batchdraw"==e.cmd){let t=V(this.atlas_textures[e.atlas_index]);this.set_blend_mode(e.blend_mode);let A=e.use_color_matrix?this.shader_matrix:this.shader;this.set_shader(A),n.activeTexture(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,t.texture),n.uniform1i(A.u_texture,0),n.uniform2f(A.u_texture_size,t.width,t.height),n.uniform2f(A.u_viewport_size,o.width*a,o.height*r),n.uniform2f(A.u_viewport_center,(o.x+o.width/2)*a,(o.y+o.height/2)*r),n.uniform1f(A.u_zoom,1);let s=4*(e.use_color_matrix?31:15);n.bindBuffer(n.ARRAY_BUFFER,this.square_buffer),n.vertexAttribPointer(A.a_position,2,n.FLOAT,!1,0,0);let l=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,l),n.bufferData(n.ARRAY_BUFFER,e.data,n.STREAM_DRAW),n.vertexAttribPointer(A.a_transform_x,3,n.FLOAT,!1,s,0),n.vertexAttribPointer(A.a_transform_y,3,n.FLOAT,!1,s,12),n.vertexAttribPointer(A.a_uv,4,n.FLOAT,!1,s,24),n.vertexAttribPointer(A.a_layer,1,n.FLOAT,!1,s,40);for(let t=0;t{let o=await createImageBitmap(e,t.x,n.canvas.height-t.height-t.y,t.width,t.height),s=this.viewport_canvas.elem,r=V(s.getContext("2d"));s.width!=t.width&&(s.width=t.width),s.height!=t.height&&(s.height=t.height),r.globalCompositeOperation="copy",r.drawImage(o,0,0),Object.assign(this.viewport_canvas,A),a?(Object.assign(this.ui.viewport.followview,a),this.ui.viewport.followview.elem.style.display="block"):this.ui.viewport.followview.elem.style.display="none";let l=this.ui.viewport.current_follow;i&&l&&i.ref==l.ref&&(null!=i.x&&(null!=l.x?this.ui.viewport.x+=i.x-l.x:this.ui.viewport.x=i.x),null!=i.y&&(null!=l.y?this.ui.viewport.y+=i.y-l.y:this.ui.viewport.y=i.y),this.ui.viewport.current_follow=i),this.ui.viewport.update_viewport()}))}else if("copytocanvas"==e.cmd){let t=s,i=e.canvas_index;d.push((async e=>{let o=await createImageBitmap(e,t.x,n.canvas.height-t.height-t.y,t.width,t.height),s=A[i],a=V(s.getContext("2d"));s.width!=t.width&&(s.width=t.width),s.height!=t.height&&(s.height=t.height),a.globalCompositeOperation="copy",a.drawImage(o,0,0)}))}else if("flush"==e.cmd){if(d.length){let t=1==d.length?n.canvas:await createImageBitmap(n.canvas);await Promise.all(d.map((e=>e(t))))}d.length=0}}create_blank_texture(t,e){const A=this.gl,n=this.gl2,i=V(A.createTexture());return A.bindTexture(A.TEXTURE_2D,i),n?n.texStorage2D(A.TEXTURE_2D,1,A.RGBA8,t,e):A.texImage2D(A.TEXTURE_2D,0,A.RGBA,t,e,0,A.RGBA,A.UNSIGNED_BYTE,null),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MIN_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_MAG_FILTER,A.NEAREST),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_2D,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),i}set_blend_mode(t){if(t==this.curr_blend_mode)return;this.curr_blend_mode=t;const e=this.gl;switch(t){case 1:default:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 3:e.blendEquation(e.FUNC_REVERSE_SUBTRACT),e.blendFuncSeparate(e.ONE,e.ONE,e.ZERO,e.ONE);break;case 4:case 6:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;case 5:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;case 7:e.blendEquation(e.FUNC_ADD),e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE)}}set_shader(t){if(t==this.curr_shader)return;this.curr_shader=t;this.gl.useProgram(t.shader),this.vao?this.vao.bindVertexArrayOES(t.vao):this.gl2?this.gl2.bindVertexArray(t.vao):this.update_vertex_attrib_arrays(...t.all_attrib_arrays)}update_vertex_attrib_arrays(...t){const e=this.gl;let A=[];for(let e of t)A[e]=!0;let n=Math.max(this.attrib_arrays_enabled.length,A.length);for(let t=0;t{if(!e)return null;t.bindFramebuffer(t.FRAMEBUFFER,this.copy_framebuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.texture,0);let A=new ImageData(e.width,e.height);t.readPixels(0,0,e.width,e.height,t.RGBA,t.UNSIGNED_BYTE,A.data);let n=document.createElement("canvas");n.width=e.width,n.height=e.height;let i=n.getContext("2d");return i?(i.putImageData(A,0,0),n.toDataURL()):void 0}));t.bindFramebuffer(t.FRAMEBUFFER,null);let A=window.open(void 0,"_blank");A&&(A.document.head.innerHTML='',A.document.body.innerHTML=e.map((t=>``)).join())}}var ot="inspector_main_canvas__2Tcvo",st="inspector_other_canvas__MSfqJ",at="inspector_name__gy0jz",rt="inspector_ref__4yQ7y",lt="inspector_clear__p0OKj",ht="inspector_subobject__wqpLv",dt="inspector_inspect_button__bNfXq",gt="inspector_follow_button__PCSpI";n(".inspector_main_canvas__2Tcvo {\n width: 128px;\n height: 128px;\n float: left;\n}\n\n.inspector_other_canvas__MSfqJ {\n width: 64px;\n height: 64px;\n float: left;\n}\n\n.inspector_name__gy0jz {\n color: white;\n display: block;\n margin-top: 0.1em;\n}\n\n.inspector_ref__4yQ7y {\n color: grey;\n display: block;\n}\n\n.inspector_clear__p0OKj {\n clear: both;\n}\n\n.inspector_subobject__wqpLv {\n margin-bottom: 2px;\n}\n\n.inspector_inspect_button__bNfXq, .inspector_follow_button__PCSpI {\n cursor: pointer;\n background: transparent;\n border: none;\n color: inherit;\n font: inherit;\n line-height: 1em;\n min-height: 2.5em;\n margin: 0px;\n padding: 0px;\n padding-left: 10px;\n padding-right: 10px;\n text-align: left;\n}\n.inspector_inspect_button__bNfXq:hover, .inspector_follow_button__PCSpI:hover {\n background-color: rgba(0, 0, 0, 0.5);\n}\n\n.inspector_inspect_button__bNfXq {\n width: 100%;\n}\n\n.inspector_follow_button__PCSpI {\n padding-top: 0.25em;\n padding-bottom: 0.25em;\n}");class _t extends y{constructor(t,e){super("Inspector"),this.ui=t,this.ref=e,this.canvases=new Map,this.main_name=document.createElement("h3"),this.main_ref=document.createElement("div"),this.spinner=new S,this.clients_label=document.createElement("h3"),this.clients_elem=document.createElement("div"),this.location_label=document.createElement("h3"),this.location_elem=document.createElement("div"),this.contents_label=document.createElement("h3"),this.contents_elem=document.createElement("div"),this.follow_button=document.createElement("button"),this.handle_global_click=t=>{var e;if(!(t.target instanceof HTMLElement))return;let A=t.target.closest("."+dt);if(A){let n=null===(e=A.parentElement)||void 0===e?void 0:e.dataset.ref;n&&(t.ctrlKey?this.ui.open_inspector(+n):this.change_to_ref(+n))}},this.update_contents_callback=t=>{var e,A,n;if(t.ref!=this.ref)return void console.warn(`Received non-matching ref on inspecter, [0x${t.ref.toString(16)}] != [0x${this.ref.toString(16)}]`);let i=!!document.activeElement&&this.panel_div.contains(document.activeElement);this.follow_button.style.display=t.ref>>24!=1?"inline-block":"none",this.spinner.element.style.display="none",this.main_name.textContent=t.name,this.main_ref.textContent=`[0x${t.ref.toString(16)}]`,this.canvases.get(this.main_canvas)!=t.ref&&this.add_canvas(this.main_canvas,t.ref);let o=t.loc;t.ref>>24==1||o||(o={name:"null",ref:0}),this.create_object_element(o,this.location_elem),this.location_label.style.display=o?"block":"none";let s=[];for(let e of t.contents){let t=this.create_object_element(e,this.contents_elem.querySelector(`div[data-ref="${e.ref}"]`));s.push(t)}for(let A=0;At.contents.length;)this.remove_canvas(null===(A=this.contents_elem.lastElementChild)||void 0===A?void 0:A.querySelector("canvas")),this.contents_elem.removeChild(this.contents_elem.lastElementChild);let a=[];for(let e of t.clients){let t=this.contents_elem.querySelector(`div[data-client="${e}"]`);if(!t){t=document.createElement("button");let A=document.createElement("span");A.textContent="Follow Client";let n=document.createElement("span");n.classList.add(rt),n.textContent=e,t.dataset.client=e,t.append(A,n),t.style.display=this.ref>>24!=1?"inline-block":"none",t.classList.add(gt),t.addEventListener("click",this.ui.viewport.follow.bind(this.ui.viewport,e))}a.push(t)}for(let e=0;et.clients.length;)this.clients_elem.removeChild(this.clients_elem.lastElementChild);this.contents_label.style.display=t.contents.length?"block":"none",i&&this.panel_div.focus()},this.panel_div.style.setProperty("--min-width","300px"),this.panel_div.style.setProperty("--max-width","600px"),this.panel_div.style.setProperty("--max-height","750px"),this.main_canvas=document.createElement("canvas"),this.main_canvas.classList.add(ot),this.content_div.appendChild(this.main_canvas),this.add_canvas(this.main_canvas,e),this.main_name.classList.add(at),this.content_div.appendChild(this.main_name),this.main_ref.textContent=`[0x${e.toString(16)}]`,this.main_ref.classList.add(rt),this.content_div.appendChild(this.main_ref),this.follow_button.textContent="Follow Object",this.follow_button.style.display=this.ref>>24!=1?"inline-block":"none",this.follow_button.classList.add(gt),this.follow_button.addEventListener("click",(()=>{t.viewport.follow(this.ref)})),this.content_div.append(this.follow_button),this.content_div.appendChild(this.clients_elem);let A=document.createElement("hr");A.classList.add(lt),this.content_div.appendChild(A),this.content_div.appendChild(this.spinner.element),this.location_label.style.display="none",this.location_label.textContent="Location",this.contents_label.style.display="none",this.contents_label.textContent="Contents",this.content_div.append(this.location_label,this.location_elem,this.contents_label,this.contents_elem),this.content_div.addEventListener("click",this.handle_global_click),this.addEventListener("close",(()=>{this.detach_hooks();let t=this.ui.inspectors.indexOf(this);t>=0&&this.ui.inspectors.splice(t,1)})),this.addEventListener("open",(()=>{this.attach_hooks(),this.ui.inspectors.push(this)}))}attach_hooks(){for(let[t,e]of this.canvases)this.ui.object_canvases.set(t,{ref:e});this.remove_inspector_callback||(this.remove_inspector_callback=this.ui.player.add_inspect_listener(this.ref,e.proxy(this.update_contents_callback)))}detach_hooks(){for(let t of this.canvases.keys())this.ui.object_canvases.delete(t);this.remove_inspector_callback&&(this.remove_inspector_callback.then((t=>{t(),t[e.releaseProxy]()})),this.remove_inspector_callback=void 0)}add_canvas(t,e){this.canvases.get(t)!=e&&(this.canvases.set(t,e),this.is_open&&this.ui.object_canvases.set(t,{ref:e}))}remove_canvas(t){t&&(this.canvases.delete(t),this.ui.object_canvases.delete(t))}change_to_ref(t){t!=this.ref&&(this.is_open?(this.detach_hooks(),this.ref=t,this.attach_hooks()):this.ref=t)}create_object_element(t,e){if(e||(e=document.createElement("div")),e.classList.add(ht),t){e.style.display="block",e.dataset.ref=""+t.ref;let A=e.querySelector("."+dt);A||(A=document.createElement("button"),A.classList.add(dt),e.appendChild(A));let n=e.querySelector("canvas");n||(n=document.createElement("canvas"),n.classList.add(st),A.appendChild(n)),this.add_canvas(n,t.ref);let i=e.querySelector("."+at);i||(i=document.createElement("b"),i.classList.add(at),A.appendChild(i)),i.textContent=t.name;let o=e.querySelector("."+rt);if(o||(o=document.createElement("span"),o.classList.add(rt),A.appendChild(o)),o.textContent=`[0x${t.ref.toString(16)}]`,!e.querySelector("."+lt)){let t=document.createElement("div");t.classList.add(lt),A.appendChild(t)}}else e.style.display="none",e.dataset.ref="",this.remove_canvas(e.querySelector("canvas"));return e}}class ct{constructor(t){this.ui=t,this.ctx=new AudioContext,this.sound_buffers=[]}get_sound_buffer(t){if(this.sound_buffers[t])return this.sound_buffers[t];let e=this.ui.player.get_resource_blob(t).then((async t=>{try{return await this.ctx.decodeAudioData(await t.arrayBuffer())}catch(t){return void console.error(t)}}));return e.catch((A=>{this.sound_buffers[t]==e&&(this.sound_buffers[t]=void 0)})),this.sound_buffers[t]=e,e}async play(t){let e;for(let A of t.resources){try{e=await this.get_sound_buffer(A)}catch(t){}if(e)break}if(!e)return;let A=this.ctx.createBufferSource();A.buffer=e,0!=t.frequency&&(t.frequency>=-100&&t.frequency<=100?A.playbackRate.value=t.frequency:A.playbackRate.value=t.frequency/e.sampleRate);let n=A,i=this.ctx.createGain();if(n.connect(i),n=i,i.gain.value=t.volume/100,t.x||t.y||t.z){let e=this.ctx.createPanner();n.connect(e),n=e,e.positionX.value=t.x,e.positionY.value=t.y,e.positionZ.value=-t.z,e.rolloffFactor=t.falloff}n.connect(this.ctx.destination),A.start()}handle_sounds(t){console.log(t);for(let e of t)this.play(e)}}class pt{constructor(t){this.player=t,this.inspectors=[],this.chat_windows=[],this.object_canvases=new Map,this.corner_container=document.createElement("div"),this.menu_button=document.createElement("button"),this.nerdy_stats=document.createElement("pre"),this.hash_z=2,window.demo_player_ui=this,t.ui=e.proxy(this),this.viewport=new W(this),this.gl_holder=new it(this),this.time_controls=new d(this),this.sound_player=new ct(this),document.body.appendChild(this.corner_container),this.corner_container.classList.add(i),this.corner_container.appendChild(this.menu_button),this.menu_button.classList.add(o),this.corner_container.appendChild(this.nerdy_stats),this.nerdy_stats.classList.add(s),this.menu_button.addEventListener("click",(()=>{this.menu||(this.menu=new G(this)),this.menu.put_below(this.menu_button),this.menu.open(!0)})),t.initialize_ui(),this.frame_loop(),"false"!=T.get("startup_chat")&&new Y(this).open(),this.update_from_hash(),window.addEventListener("hashchange",this.update_from_hash.bind(this))}async frame_loop(){try{let t,e=await new Promise(requestAnimationFrame),A=await new Promise(requestAnimationFrame),n=NaN,i=NaN,o=NaN,s=[],a=async(t,e,A)=>{let n=performance.now(),o=await this.player.run_frame(t,e,this.viewport.get_turf_window(),A),s=performance.now();return i=s-n,o};for(;;){let r=A-e;n=1e3/r;let l=this.time_controls.playback_speed_override||this.time_controls.playback_speed;this.time_controls.dragging&&(l=0);let h=[],d=[];for(let[t,e]of this.object_canvases){let A=t.getBoundingClientRect();0!=A.width&&0!=A.height&&(0==e.ref?t.width=t.width:(h.push({width:A.width*devicePixelRatio,height:A.height*devicePixelRatio,ref:e.ref}),d.push(t))),e.remove_when_done&&this.object_canvases.delete(t)}let g=a(r,l,h);if(t){let e=performance.now();await this.gl_holder.process_frame_data(t,A,s),o=performance.now()-e}this.viewport.update_viewport(),t=await g,s=d,this.viewport.update_nerdy_stats(`FPS: ${n.toFixed(2)}\nFrame time (worker): ${i.toFixed(2)}ms\nWebGL time: ${o.toFixed(2)}ms\nExtra canvases: ${d.length}/${this.object_canvases.size}`),e=A,A=await new Promise(requestAnimationFrame)}}catch(t){this.report_error(t)}}report_error(t){"stack"in t?t=t+","+t.stack:t+="",this.viewport.update_nerdy_stats(t),console.error(t)}update_time(t){this.time_controls.update_time(t)}update_duration(t){this.time_controls.update_duration(t)}open_inspector(t){for(let e of this.inspectors)if(t==e.ref)return void e.take_focus();new _t(this,t).open(!0)}update_hash(t){null!=t&&(this.hash_z=t);let e="null";if(this.viewport.current_follow){let t=this.viewport.current_follow.ref;e="string"==typeof t?t:`[0x${t.toString(16)}]`}let A=`#${Math.round(this.time_controls.current_time)};${this.viewport.x.toFixed(2)};${this.viewport.y.toFixed(2)};${this.hash_z};${e};${this.viewport.log_zoom.toFixed(1)}`;A!=window.location.hash&&history.replaceState("","",A)}update_from_hash(t){let e=window.location.hash||"";if("#"==e[0]&&(e=e.substring(1)),t&&t.newURL.includes("#")&&(e=t.newURL.substring(t.newURL.indexOf("#")+1)),e.length){let t=e.split(";");if(+t[0]==+t[0]&&this.player.advance_time(+t[0]),+t[1]==+t[1]&&(this.viewport.x=+t[1],this.viewport.update_viewport()),+t[2]==+t[2]&&(this.viewport.y=+t[2],this.viewport.update_viewport()),+t[3]==+t[3]&&(this.player.z_level=+t[3]),+t[5]==+t[5]&&(this.viewport.log_zoom=+t[5],this.viewport.update_viewport()),"null"==t[4])this.viewport.follow(null);else{let e,A=t[4];e="["==A[0]?+A.substring(1,A.length-1):A,this.viewport.follow(e)}}}handle_sounds(t){this.sound_player.handle_sounds(t)}async dump_textures(){this.gl_holder.dump_textures()}}const ut=document.createElement("canvas"),It=ut.getContext("webgl2")||ut.getContext("webgl"),Ct=document.createElement("canvas"),Et=null==It?void 0:It.getParameter(It.MAX_TEXTURE_SIZE);async function mt(t){if(!It)throw new Error("Could not load image - webgl not available");t.type.startsWith("image/")||(t=new Blob([t],{type:"image/png"}));let A=await createImageBitmap(t,{premultiplyAlpha:"none"}),n=A.width,i=A.height;if(n>Et||i>Et){console.warn(`Image of size ${n}x${i} exceeds maximum WebGL texture size of ${Et} - falling back to canvas2d for loading. Colors in transparent parts will be mangled.`);const t=V(Ct.getContext("2d"));Ct.width=n,Ct.height=i,t.drawImage(A,0,0);let o=t.getImageData(0,0,n,i);return e.transfer(new Uint8Array(o.data.buffer),[o.data.buffer])}let o=It.createFramebuffer();It.bindFramebuffer(It.FRAMEBUFFER,o);let s=It.createTexture(),a=new Uint8Array(n*i*4);return It.activeTexture(It.TEXTURE0),It.bindTexture(It.TEXTURE_2D,s),It.pixelStorei(It.UNPACK_FLIP_Y_WEBGL,!1),It.texImage2D(It.TEXTURE_2D,0,It.RGBA,It.RGBA,It.UNSIGNED_BYTE,A),It.framebufferTexture2D(It.FRAMEBUFFER,It.COLOR_ATTACHMENT0,It.TEXTURE_2D,s,0),It.readPixels(0,0,n,i,It.RGBA,It.UNSIGNED_BYTE,a),It.deleteTexture(s),It.bindFramebuffer(It.FRAMEBUFFER,null),It.deleteFramebuffer(o),e.transfer(a,[a.buffer])}class Bt{constructor(t){this.exports=t.exports,this.memory=this.exports.memory,this.ptr=this.exports.create_context(),this._refresh(),this.bufSize=this.mem32[0],this.inStart=this.mem32[1]-this.ptr,this.inEnd=this.inStart+this.bufSize,this.outStart=this.mem32[4]-this.ptr}supplyInput(t){this.mem8.subarray(this.inStart,this.inEnd).set(t,0),this.exports.supply_input(this.ptr,t.byteLength),this._refresh()}getNextOutput(){const t=this.exports.get_next_output(this.ptr);if(this._refresh(),0!==t&&1!==t)throw new Error(`get_next_output failed with error code ${t}`);return{outChunk:this.mem8.slice(this.outStart,this.outStart+this.mem32[5]),finished:1===t}}needsMoreInput(){return this.mem32[2]===this.mem32[3]}outputBufferIsFull(){return this.mem32[5]===this.bufSize}resetOutputBuffer(){this.outPos=this.mem32[5]=0}dispose(){this.exports.destroy_context(this.ptr),this.exports=null}_refresh(){var t;this.memory.buffer!==(null===(t=this.mem8)||void 0===t?void 0:t.buffer)&&(this.mem8=new Uint8Array(this.memory.buffer,this.ptr),this.mem32=new Uint32Array(this.memory.buffer,this.ptr))}}class Qt extends ReadableStream{constructor(t){let e,A=null;const n=t.getReader();super({async start(t){Qt._moduleInstance||await(Qt._moduleInstancePromise||(Qt._moduleInstancePromise=Qt._getModuleInstance())),e=new Bt(Qt._moduleInstance)},async pull(t){if(e.needsMoreInput()){if(null===A||0===A.byteLength){const{done:t,value:e}=await n.read();t||(A=e)}const t=Math.min(e.bufSize,A.byteLength);e.supplyInput(A.subarray(0,t)),A=A.subarray(t)}const i=e.getNextOutput();t.enqueue(i.outChunk),e.resetOutputBuffer(),i.finished&&(e.dispose(),t.close())},cancel:()=>(e.dispose(),n.cancel())})}static async _getModuleInstance(){const t=await(await fetch("data:application/wasm;base64,AGFzbQEAAAABOApgAX8Bf2ABfwBgAABgA39/fwF/YAABf2ACf38AYAN/f34BfmACf38Bf2AEf39/fwF/YAN/f38AAx4dAAABAgMDAwMEAQUAAgMCBgcIAwMHAQcABwcBAwkEBQFwAQEBBQMBAAIGCAF/AUHwoAQLB04FBm1lbW9yeQIADmNyZWF0ZV9jb250ZXh0AAgPZGVzdHJveV9jb250ZXh0AAkMc3VwcGx5X2lucHV0AAoPZ2V0X25leHRfb3V0cHV0AAsK718d3wIBBX9BACEBAkAgAEEHaiICQRBJDQBBASEBIAJBA3YiA0ECRg0AQQIhASACQSBJDQBBAyEBIANBBEYNAEEEIQEgAkEwSQ0AQQUhASADQQZGDQBBBiEBIAJByABJDQBBByEBIAJB2ABJDQBBCCEBIAJBiAFJDQBBCSEBIAJBiAJJDQAgABCBgICAACIAQQhqQQAgABsPCwJAAkAgAUECdEHAiICAAGoiBCgCACIADQBBACEAAkACQEEAKALkiICAACICRQ0AQQAgAigCADYC5IiAgAAMAQtBABCBgICAACICRQ0CCyACQYCAfHEiACACQQh2Qf8BcSICciABOgAAIAJBCHQgAHJBgAJqIQBBACECQQAgAUECdEGAiICAAGooAgAiA2shBSADIQEDQCAAIAVqIgAgAjYCACAAIQIgASADaiIBQYECSQ0ACyAEIAA2AgALIAQgACgCADYCAAsgAAvnBwEHfwJAAkACQAJAAkBBAC0AtIiAgABFDQBBAEEAOgC0iICAAEEAKAKwiICAACIBRQ0BQbCIgIAAIQIDQAJAAkAgAUEIaiIDIAEoAgQiBG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AE2AhwgAAsVACAAKAIcEJWAgIAAIAAQgoCAgAALFgAgAEEMaiABNgIAIABBCGpBADYCAAsbACAAKAIcIABBBGogAEEMaigCAEUQk4CAgAALVAEDf0EAIQADQEEIIQEgACECA0BBACACQQFxa0GghuLtfnEgAkEBdnMhAiABQX9qIgENAAsgAEECdEHwiICAAGogAjYCACAAQQFqIgBBgAJHDQALC0oAIAJBf3MhAgJAIAFFDQADQCACQf8BcSAALQAAc0ECdEHwiICAAGooAgAgAkEIdnMhAiAAQQFqIQAgAUF/aiIBDQALCyACQX9zC2kEAX8BfgF/AX5BACEAQgAhAQNAQQghAiABIQMDQEIAIANCAYN9QsKenLzd8pW2SYMgA0IBiIUhAyACQX9qIgINAAsgAEEDdEHwkICAAGogAzcDACAAQQFqIQAgAUIBfCIBQoACUg0ACwtLACACQn+FIQICQCABRQ0AA0AgAkL/AYMgADEAAIWnQQN0QfCQgIAAaikDACACQgiIhSECIABBAWohACABQX9qIgENAAsLIAJCf4UL+xMCDn8CfgJAAkAgACgCJEUNACAAKAIAIQIMAQtBACECIABBADoAKCAAQgA3AwAgAEIANwMYIABByABqQQBB5AAQhoCAgAAaIABBrAFqQQw2AgALIAAgASgCBCIDNgIQIABBsAFqIQQgAEHgAGohBSAAQcgAaiEGIABBugFqIQcgAEG2AWohCCAAQagBaiEJIAFBBGohCiABKAIQIQsCQAJAAkACQANAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIAIOCgECAAQFBgcICQoPCyABKAIEIQwgASgCCCENIAEoAgAhDiAAKAKoASECIAAoAqwBIQ8MAgsgCSAAKAKoASIMakEIaiABKAIAIAEoAgQiAmogASgCCCACayICIAAoAqwBIAxrIgwgAiAMSRsiAhCHgICAABogASABKAIEIAJqNgIEQQAhDCAAQQAgACgCqAEgAmoiAiACIAAoAqwBIg9GGzYCqAEgAiAPRw0RIABBATYCAAJAIARBqIiAgABBBhCEgICAAEUNAEEFIQwMEgsgCEECQQAQjYCAgAAgACgAuAFHDRB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UEBdCIBaiEDAkACQCAFQf///wdNDQAgBSECDAELIAAgBUEIdCICNgIAIAAgACgCECIFQQFqNgIQIAAgBEEIdCAFIAAoAgxqLQAAciIENgIECwJAAkAgBCACQQt2IAMvAQAiBmwiBUkNACAAIAQgBWsiBDYCBCAAIAIgBWsiBTYCACADIAYgBkEFdms7AQAgAUEBciEBDAELIAAgBTYCACADIAZBgBAgBmtBBXZqOwEACyABIAhJDQALIABB6ABqIAEgCGsgCWo2AgALCzUBAEGACAsuCAAAABAAAAAYAAAAIAAAACgAAAAwAAAAQAAAAFAAAACAAAAAAAEAAP03elhaAA==")).arrayBuffer(),e=new Response(t,{headers:{"Content-Type":"application/wasm"}}),A={},n="function"==typeof WebAssembly.instantiateStreaming?await WebAssembly.instantiateStreaming(e,A):await WebAssembly.instantiate(await e.arrayBuffer(),A);Qt._moduleInstance=n.instance}}class ft extends ReadableStream{constructor(t){let e,A=!1;[t,e]=t.tee();let n=t.getReader();super({pull:async t=>{let i=await n.read();i.done?t.close():(A||(A=!0,253==i.value[0]?(n.cancel(),n=new Qt(e).getReader(),i=await n.read()):e.cancel()),i.done?t.close():t.enqueue(i.value))},cancel:async()=>(e.cancel(),t.cancel(),await n.cancel())})}}class wt{constructor(){this._ended=!1,this._canceled=!1,this._readers=[],this._continue_cb=void 0,this.bytes_read=0,this._empty_callbacks=[],this.readable=new ReadableStream({pull:async t=>{let e=!1;for(;!e;){for(;!this._ended&&!this._readers.length;){for(let t of this._empty_callbacks)t();if(this._empty_callbacks.length=0,this._continue_cb)throw new Error("Multiple pulls!");await new Promise((t=>{this._continue_cb=t}))}if(this._readers.length){let A=this._readers[0],n=await A.read();if(n.done){if(A!=this._readers[0])throw new Error("Reader queue head got changed while reading");this._readers.shift()}else n.value instanceof Uint8Array&&(this.bytes_read+=n.value.length),t.enqueue(n.value),e=!0}else this._ended&&(t.close(),e=!0)}},cancel:async()=>{this._canceled=!0,await Promise.all(this._readers.map((t=>t.cancel()))),this._readers.length=0}})}_continue(){if(this._continue_cb){let t=this._continue_cb;this._continue_cb=void 0,t()}}end(){this._ended=!0,this._continue()}wait_empty(){return this._ended?Promise.reject(new Error("Already ended!")):this._readers.length?new Promise((t=>this._empty_callbacks.push(t))):Promise.resolve()}add(t){if(this._ended)throw new Error("Cannot add stream: stream queue has been closed");this._canceled||(this._readers.push(t.getReader()),this._continue())}}var vt;let bt=e.wrap(new Worker("parser_worker-82dd9ce4.js"));function yt(){return bt[e.createEndpoint]().then((async t=>{let A=new MessageChannel;e.expose(mt,A.port1);let n=e.wrap(new Worker("icon_loader-ffd33460.js"));await n.set_png_loader(e.transfer(A.port2,[A.port2]));let i=await n[e.createEndpoint]();n[e.releaseProxy]();let o=await new(e.wrap(new Worker("player_worker-c2ec0794.js")))(e.transfer(t,[t]),e.transfer(i,[i]));new pt(o)}))}let xt=new S;async function Dt(t,A){await t.set_progress_callback(e.proxy((async(t,e)=>{xt.progress=t,e&&xt.fade_out()})));let n,i=A.getReader(),o=0;for(;n=await i.read(),!n.done;)o+=n.value.length,await t.handle_data(e.transfer(n.value,[n.value.buffer]))}xt.full_page=!0;let kt=null,Lt=new URLSearchParams(window.location.search);Lt.has("demo_url")?kt=Lt.get("demo_url"):Lt.has("roundid")&&(kt=`https://logis-dev.ss220.space/in/logis/api/replay/ParadiseMain/${Lt.get("roundid")}`);const Nt=kt;function St(t){return"bytes"==t.headers.get("accept-ranges")||"true"==t.headers.get("x-allow-ss13-replay-streaming")}if(Nt)document.body.appendChild(xt.element),fetch(Nt,{credentials:+(null!==(vt=Lt.get("send_credentials"))&&void 0!==vt?vt:0)?"include":"same-origin"}).then((async t=>{if(!t.ok)return document.body.textContent=`Server responded with ${t.status} ${t.statusText}`,void(document.body.style.fontSize="40px");if(!t.body)throw new Error("No stream!");let e=t.body;St(t)&&(e=function(t,e){let A=new wt;if(!t.body)throw new Error("No stream!");return A.add(t.body),A.wait_empty().then((async()=>{var n;let i=!1;for(;St(t);){if(await new Promise((t=>setTimeout(t,i?1e3:1e4))),!(t=await fetch(e,{credentials:+(null!==(n=Lt.get("send_credentials"))&&void 0!==n?n:0)?"include":"same-origin",headers:{Range:"bytes="+A.bytes_read+"-"}})).body)throw new Error("No stream!");if(206==t.status){let e=A.bytes_read;A.add(t.body),await A.wait_empty(),A.bytes_read>e&&(i=!0)}else{if(416!=t.status)break;i=!1}}A.end()})),A.readable}(t,Nt));let A=yt();return Dt(bt,new ft(e)),A})).catch((t=>{document.body.textContent=`${"stack"in t?t+", "+t.stack:t}`,document.body.style.fontSize="40px"}));else{let t=document.createElement("input");t.type="file";let e=document.createElement("input");e.type="button",e.value="Open demo from file",e.addEventListener("click",(()=>{var e;(null===(e=t.files)||void 0===e?void 0:e[0])&&(document.body.appendChild(xt.element),yt().catch((t=>{document.body.textContent=`${"stack"in t?t+", "+t.stack:t}`,document.body.style.fontSize="40px"})),Dt(bt,new ft(t.files[0].stream())))})),document.body.appendChild(t),document.body.appendChild(e)}}));